summaryrefslogtreecommitdiffhomepage
path: root/packages/app/src/context
diff options
context:
space:
mode:
authorDaniel Polito <[email protected]>2025-12-31 21:07:45 -0300
committerGitHub <[email protected]>2025-12-31 18:07:45 -0600
commit87978b1c172626e7a70134f485dd68896f75a594 (patch)
treead7c6813ab4b5273d9d6c94dad565efb15124bf3 /packages/app/src/context
parent63d2b21b8fd89ee11282be7a62479b0ba2ae3f0c (diff)
downloadopencode-87978b1c172626e7a70134f485dd68896f75a594.tar.gz
opencode-87978b1c172626e7a70134f485dd68896f75a594.zip
Desktop: Add Subagents Mention Support (#6540)
Diffstat (limited to 'packages/app/src/context')
-rw-r--r--packages/app/src/context/prompt.tsx11
1 files changed, 10 insertions, 1 deletions
diff --git a/packages/app/src/context/prompt.tsx b/packages/app/src/context/prompt.tsx
index 8d3590cd9..25d8146ea 100644
--- a/packages/app/src/context/prompt.tsx
+++ b/packages/app/src/context/prompt.tsx
@@ -21,6 +21,11 @@ export interface FileAttachmentPart extends PartBase {
selection?: TextSelection
}
+export interface AgentPart extends PartBase {
+ type: "agent"
+ name: string
+}
+
export interface ImageAttachmentPart {
type: "image"
id: string
@@ -29,7 +34,7 @@ export interface ImageAttachmentPart {
dataUrl: string
}
-export type ContentPart = TextPart | FileAttachmentPart | ImageAttachmentPart
+export type ContentPart = TextPart | FileAttachmentPart | AgentPart | ImageAttachmentPart
export type Prompt = ContentPart[]
export const DEFAULT_PROMPT: Prompt = [{ type: "text", content: "", start: 0, end: 0 }]
@@ -46,6 +51,9 @@ export function isPromptEqual(promptA: Prompt, promptB: Prompt): boolean {
if (partA.type === "file" && partA.path !== (partB as FileAttachmentPart).path) {
return false
}
+ if (partA.type === "agent" && partA.name !== (partB as AgentPart).name) {
+ return false
+ }
if (partA.type === "image" && partA.id !== (partB as ImageAttachmentPart).id) {
return false
}
@@ -61,6 +69,7 @@ function cloneSelection(selection?: TextSelection) {
function clonePart(part: ContentPart): ContentPart {
if (part.type === "text") return { ...part }
if (part.type === "image") return { ...part }
+ if (part.type === "agent") return { ...part }
return {
...part,
selection: cloneSelection(part.selection),