chore: merge dev into v2 (#35591)
Co-authored-by: Frank <frank@anoma.ly> Co-authored-by: Aarav Sareen <96787824+arvsrn@users.noreply.github.com> Co-authored-by: Brendan Allan <git@brendonovich.dev> Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> Co-authored-by: Jack <jack@anoma.ly> Co-authored-by: Brendan Allan <14191578+Brendonovich@users.noreply.github.com> Co-authored-by: Shoubhit Dash <shoubhit2005@gmail.com> Co-authored-by: opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com> Co-authored-by: James Long <longster@gmail.com> Co-authored-by: Dustin Deus <deusdustin@gmail.com> Co-authored-by: starptech <starptech@starptechs-MBP.fritz.box> Co-authored-by: Luke Parker <10430890+Hona@users.noreply.github.com> Co-authored-by: 𝓛𝓲𝓽𝓽𝓵𝓮 𝓕𝓻𝓪𝓷𝓴 <little-frank@opencord.local> Co-authored-by: Dax <mail@thdxr.com> Co-authored-by: usrnk1 <7547651+usrnk1@users.noreply.github.com> Co-authored-by: Jay <53023+jayair@users.noreply.github.com> Co-authored-by: runvip <164729189+runvip@users.noreply.github.com> Co-authored-by: opencode <opencode@sst.dev> Co-authored-by: Julian Coy <julian@ex-machina.co> Co-authored-by: Vladimir Glafirov <vglafirov@gitlab.com> Co-authored-by: Adam <2363879+adamdotdevin@users.noreply.github.com> Co-authored-by: Kit Langton <kit.langton@gmail.com> Co-authored-by: Simon Klee <hello@simonklee.dk> Co-authored-by: Jay <air@live.ca> Co-authored-by: David Hill <1879069+iamdavidhill@users.noreply.github.com>
This commit is contained in:
@@ -1630,33 +1630,21 @@ const scenarios: Scenario[] = [
|
||||
const session = yield* ctx.session({ title: "Summarize session" })
|
||||
yield* ctx.message(session.id, { text: "summarize this work" })
|
||||
const summary = [
|
||||
"## Goal",
|
||||
"## Objective",
|
||||
"- Exercise session summarize.",
|
||||
"",
|
||||
"## Constraints & Preferences",
|
||||
"## Important Details",
|
||||
"- Use fake LLM.",
|
||||
"",
|
||||
"## Progress",
|
||||
"### Done",
|
||||
"- Summary generated.",
|
||||
"",
|
||||
"### In Progress",
|
||||
"- (none)",
|
||||
"",
|
||||
"### Blocked",
|
||||
"- (none)",
|
||||
"",
|
||||
"## Key Decisions",
|
||||
"- Keep route local.",
|
||||
"- Test fixture: test/server/httpapi-exercise/index.ts.",
|
||||
"",
|
||||
"## Next Steps",
|
||||
"- (none)",
|
||||
"## Work State",
|
||||
"- Completed: Summary generated.",
|
||||
"- Active: (none)",
|
||||
"- Blocked: (none)",
|
||||
"",
|
||||
"## Critical Context",
|
||||
"- Test fixture.",
|
||||
"",
|
||||
"## Relevant Files",
|
||||
"- test/server/httpapi-exercise/index.ts: scenario",
|
||||
"## Next Move",
|
||||
"1. (none)",
|
||||
].join("\n")
|
||||
yield* ctx.llmText(summary)
|
||||
yield* ctx.llmText(summary)
|
||||
|
||||
@@ -21,6 +21,7 @@ import { InstanceStore } from "../../src/project/instance-store"
|
||||
import { Project } from "../../src/project/project"
|
||||
import { HttpApiApp } from "../../src/server/routes/instance/httpapi/server"
|
||||
import * as HttpSessionError from "../../src/server/routes/instance/httpapi/handlers/session-errors"
|
||||
import { ExperimentalPaths } from "../../src/server/routes/instance/httpapi/groups/experimental"
|
||||
import { SessionPaths } from "../../src/server/routes/instance/httpapi/groups/session"
|
||||
import { Session } from "@/session/session"
|
||||
import { MessageID, PartID, SessionID, type SessionID as SessionIDType } from "../../src/session/schema"
|
||||
@@ -879,6 +880,78 @@ describe("session HttpApi", () => {
|
||||
{ git: true, config: { formatter: false, lsp: false } },
|
||||
)
|
||||
|
||||
it.instance(
|
||||
"lists sessions created through an equivalent directory hint",
|
||||
() =>
|
||||
Effect.gen(function* () {
|
||||
const test = yield* TestInstance
|
||||
const hint = test.directory + path.sep
|
||||
const headers = { "x-opencode-directory": hint, "content-type": "application/json" }
|
||||
const created = yield* requestJson<Session.Info>(SessionPaths.create, {
|
||||
method: "POST",
|
||||
headers,
|
||||
body: JSON.stringify({ title: "hinted" }),
|
||||
})
|
||||
|
||||
const query = new URLSearchParams({ directory: hint, roots: "true" })
|
||||
const listed = yield* requestJson<Session.Info[]>(`${SessionPaths.list}?${query}`, { headers })
|
||||
expect(listed.map((item) => item.id)).toContain(created.id)
|
||||
|
||||
const globalQuery = new URLSearchParams({ directory: hint })
|
||||
const global = yield* requestJson<Session.Info[]>(`${ExperimentalPaths.session}?${globalQuery}`, { headers })
|
||||
expect(global.map((item) => item.id)).toContain(created.id)
|
||||
}),
|
||||
{ git: true, config: { formatter: false, lsp: false, share: "disabled" } },
|
||||
)
|
||||
|
||||
it.instance(
|
||||
"lists Windows sessions for equivalent directory spellings",
|
||||
() =>
|
||||
Effect.gen(function* () {
|
||||
if (process.platform !== "win32") return
|
||||
const test = yield* TestInstance
|
||||
const headers = { "x-opencode-directory": test.directory, "content-type": "application/json" }
|
||||
const created = yield* requestJson<Session.Info>(SessionPaths.create, {
|
||||
method: "POST",
|
||||
headers,
|
||||
body: JSON.stringify({ title: "windows spelling" }),
|
||||
})
|
||||
|
||||
const forwardSlashes = test.directory.replaceAll("\\", "/")
|
||||
const lowercaseDrive = test.directory.replace(/^[A-Z]:/, (drive) => drive.toLowerCase())
|
||||
const trailingSeparator = `${test.directory}\\`
|
||||
for (const spelling of [forwardSlashes, lowercaseDrive, trailingSeparator]) {
|
||||
const query = new URLSearchParams({ directory: spelling, roots: "true" })
|
||||
const listed = yield* requestJson<Session.Info[]>(`${SessionPaths.list}?${query}`, { headers })
|
||||
expect({ spelling, ids: listed.map((item) => item.id) }).toEqual({ spelling, ids: [created.id] })
|
||||
}
|
||||
}),
|
||||
{ git: true, config: { formatter: false, lsp: false, share: "disabled" } },
|
||||
{ timeout: 15000 },
|
||||
)
|
||||
|
||||
it.instance(
|
||||
"lists Windows sessions created through the global worktree sentinel",
|
||||
() =>
|
||||
Effect.gen(function* () {
|
||||
if (process.platform !== "win32") return
|
||||
const globalWorktreeSentinel = "/"
|
||||
const headers = { "x-opencode-directory": globalWorktreeSentinel, "content-type": "application/json" }
|
||||
const driveRootSession = yield* requestJson<Session.Info>(SessionPaths.create, {
|
||||
method: "POST",
|
||||
headers,
|
||||
body: JSON.stringify({ title: "created at drive root" }),
|
||||
})
|
||||
expect(driveRootSession.directory).toMatch(/^[A-Za-z]:\\$/)
|
||||
|
||||
const query = new URLSearchParams({ directory: globalWorktreeSentinel, roots: "true" })
|
||||
const listed = yield* requestJson<Session.Info[]>(`${SessionPaths.list}?${query}`, { headers })
|
||||
expect(listed.map((item) => item.id)).toContain(driveRootSession.id)
|
||||
}),
|
||||
{ git: true, config: { formatter: false, lsp: false, share: "disabled" } },
|
||||
{ timeout: 15000 },
|
||||
)
|
||||
|
||||
it.instance(
|
||||
"serves paginated message link headers",
|
||||
() =>
|
||||
|
||||
Reference in New Issue
Block a user