opencode-acp-provider 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -19
- package/package.json +3 -2
- package/src/acp-client.ts +67 -4
- package/src/acp-tools/antigravity.ts +117 -0
- package/src/acp-tools/claude.ts +105 -0
- package/src/acp-tools/codex.ts +204 -0
- package/src/acp-tools/command-code.ts +135 -0
- package/src/acp-tools/fallback.ts +92 -0
- package/src/acp-tools/shared.ts +436 -0
- package/src/acp-tools.ts +119 -241
- package/src/agent-command.ts +1 -1
- package/src/agent-pool.ts +5 -1
- package/src/index.ts +132 -47
- package/src/inventory.ts +14 -0
- package/src/language-model.ts +27 -13
- package/src/mcp-server.ts +73 -55
- package/src/prompt.ts +22 -5
- package/src/server-manager.ts +517 -74
- package/src/shim.ts +75 -35
- package/src/unsolicited.ts +388 -0
- package/src/mcp-config.ts +0 -198
package/src/prompt.ts
CHANGED
|
@@ -18,12 +18,29 @@ export function isAuxiliaryRequest(kind: unknown) {
|
|
|
18
18
|
return kind === "title" || kind === "generate" || kind === "compaction"
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* OpenCode injects harness blocks such as `<system-reminder>` (plan mode,
|
|
23
|
+
* opened-file notes) and `<system-update>` into user text. ACP agents run on
|
|
24
|
+
* their own instructions, so drop them. Only whole blocks that start and end
|
|
25
|
+
* on their own lines match, so a user mentioning a tag inline is untouched.
|
|
26
|
+
*/
|
|
27
|
+
const SYSTEM_BLOCK = /(^|\n)[ \t]*<(system(?:[-_][a-z]+)*)(?:\s[^>]*)?>[\s\S]*?<\/\2>[ \t]*(?=\n|$)/gi
|
|
28
|
+
|
|
29
|
+
export function stripSystemBlocks(text: string): string {
|
|
30
|
+
if (!text.includes("<system")) return text
|
|
31
|
+
const stripped = text.replace(SYSTEM_BLOCK, "$1")
|
|
32
|
+
return stripped === text ? text : stripped.replace(/\n{3,}/g, "\n\n").trim()
|
|
33
|
+
}
|
|
34
|
+
|
|
21
35
|
export function textOf(message: ChatMessage): string {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
36
|
+
const text = typeof message.content === "string"
|
|
37
|
+
? message.content
|
|
38
|
+
: Array.isArray(message.content)
|
|
39
|
+
? message.content
|
|
40
|
+
.flatMap((part) => part?.type === "text" && typeof part.text === "string" && part.text ? [part.text] : [])
|
|
41
|
+
.join("\n")
|
|
42
|
+
: ""
|
|
43
|
+
return message.role === "user" ? stripSystemBlocks(text) : text
|
|
27
44
|
}
|
|
28
45
|
|
|
29
46
|
const conversational = (message: ChatMessage) => message.role === "user" || message.role === "assistant"
|