diff --git a/packages/cli/src/mini/stream-v2.transport.ts b/packages/cli/src/mini/stream-v2.transport.ts index d6998f200b..2cb58ad528 100644 --- a/packages/cli/src/mini/stream-v2.transport.ts +++ b/packages/cli/src/mini/stream-v2.transport.ts @@ -190,7 +190,7 @@ async function prepareFile(file: RunFilePart) { return { text: `\n${content}\n` } } -function promptFileSource(part: PromptFilePart) { +function promptFileMention(part: PromptFilePart) { if (!part.source?.text) return return { start: part.source.text.start, @@ -206,7 +206,7 @@ function promptFiles(next: SessionTurnInput) { { uri: part.url, name: part.filename, - source: promptFileSource(part), + mention: promptFileMention(part), }, ] : [], @@ -219,7 +219,7 @@ function promptAgents(next: SessionTurnInput) { ? [ { name: part.name, - source: part.source + mention: part.source ? { start: part.source.start, end: part.source.end, text: part.source.value } : undefined, }, diff --git a/packages/opencode/test/cli/run/session.shared.test.ts b/packages/opencode/test/cli/run/session.shared.test.ts index 2e098581ac..30a60958dc 100644 --- a/packages/opencode/test/cli/run/session.shared.test.ts +++ b/packages/opencode/test/cli/run/session.shared.test.ts @@ -256,21 +256,22 @@ describe("run session shared", () => { spyOn(client.message, "list").mockImplementation(() => Promise.resolve({ data: [ - { - id: "msg_prompt", - type: "user", - text: "Review @note.ts", - files: [ - { - uri: "file:///tmp/note.ts", - mime: "text/plain", - name: "note.ts", - source: { start: 7, end: 15, text: "@note.ts" }, - }, - ], - agents: [], - time: { created: 1 }, - }, + { + id: "msg_prompt", + type: "user", + text: "Review @note.ts", + files: [ + { + data: "", + mime: "text/plain", + name: "note.ts", + source: { type: "uri", uri: "file:///tmp/note.ts" }, + mention: { start: 7, end: 15, text: "@note.ts" }, + }, + ], + agents: [], + time: { created: 1 }, + }, ], cursor: {}, }), diff --git a/packages/opencode/test/cli/run/stream-v2.transport.test.ts b/packages/opencode/test/cli/run/stream-v2.transport.test.ts index 623b93c24d..5400c6c05e 100644 --- a/packages/opencode/test/cli/run/stream-v2.transport.test.ts +++ b/packages/opencode/test/cli/run/stream-v2.transport.test.ts @@ -302,12 +302,12 @@ describe("V2 mini transport", () => { { uri: pathToFileURL(filePath).href, name: "note.ts", - source: { start: 7, end: 15, text: "@note.ts" }, + mention: { start: 7, end: 15, text: "@note.ts" }, }, { uri: pathToFileURL(`${directoryPath}${path.sep}`).href, name: "docs", - source: { start: 20, end: 25, text: "@docs" }, + mention: { start: 20, end: 25, text: "@docs" }, }, ]) await transport.close() @@ -398,12 +398,12 @@ describe("V2 mini transport", () => { { uri: "file:///remote/project/note.ts", name: "note.ts", - source: { start: 7, end: 15, text: "@note.ts" }, + mention: { start: 7, end: 15, text: "@note.ts" }, }, { uri: "file:///remote/project/docs", name: "docs", - source: { start: 20, end: 25, text: "@docs" }, + mention: { start: 20, end: 25, text: "@docs" }, }, ]) await transport.close() @@ -486,7 +486,7 @@ describe("V2 mini transport", () => { { name: "diagram.png", uri: pathToFileURL(filePath).href, - source: { start: 7, end: 19, text: "@diagram.png" }, + mention: { start: 7, end: 19, text: "@diagram.png" }, }, ]) await transport.close()