@moxxy/plugin-provider-acp 0.0.0-stage → 0.46.0

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.
Files changed (74) hide show
  1. package/LICENSE +21 -0
  2. package/dist/acp-session.d.ts +201 -0
  3. package/dist/acp-session.d.ts.map +1 -0
  4. package/dist/acp-session.js +812 -0
  5. package/dist/acp-session.js.map +1 -0
  6. package/dist/agent-provider.d.ts +71 -0
  7. package/dist/agent-provider.d.ts.map +1 -0
  8. package/dist/agent-provider.js +203 -0
  9. package/dist/agent-provider.js.map +1 -0
  10. package/dist/agents.d.ts +23 -0
  11. package/dist/agents.d.ts.map +1 -0
  12. package/dist/agents.js +21 -0
  13. package/dist/agents.js.map +1 -0
  14. package/dist/constants.d.ts +31 -0
  15. package/dist/constants.d.ts.map +1 -0
  16. package/dist/constants.js +31 -0
  17. package/dist/constants.js.map +1 -0
  18. package/dist/executable.d.ts +47 -0
  19. package/dist/executable.d.ts.map +1 -0
  20. package/dist/executable.js +106 -0
  21. package/dist/executable.js.map +1 -0
  22. package/dist/index.d.ts +10 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +69 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/login.d.ts +48 -0
  27. package/dist/login.d.ts.map +1 -0
  28. package/dist/login.js +180 -0
  29. package/dist/login.js.map +1 -0
  30. package/dist/opencode-api.d.ts +32 -0
  31. package/dist/opencode-api.d.ts.map +1 -0
  32. package/dist/opencode-api.js +86 -0
  33. package/dist/opencode-api.js.map +1 -0
  34. package/dist/opencode-helpers.d.ts +49 -0
  35. package/dist/opencode-helpers.d.ts.map +1 -0
  36. package/dist/opencode-helpers.js +175 -0
  37. package/dist/opencode-helpers.js.map +1 -0
  38. package/dist/protocol.d.ts +143 -0
  39. package/dist/protocol.d.ts.map +1 -0
  40. package/dist/protocol.js +7 -0
  41. package/dist/protocol.js.map +1 -0
  42. package/dist/rules.d.ts +47 -0
  43. package/dist/rules.d.ts.map +1 -0
  44. package/dist/rules.js +84 -0
  45. package/dist/rules.js.map +1 -0
  46. package/dist/translate.d.ts +50 -0
  47. package/dist/translate.d.ts.map +1 -0
  48. package/dist/translate.js +290 -0
  49. package/dist/translate.js.map +1 -0
  50. package/package.json +81 -3
  51. package/src/acp-session.ts +892 -0
  52. package/src/agent-cli.test.ts +76 -0
  53. package/src/agent-provider.test.ts +1137 -0
  54. package/src/agent-provider.ts +234 -0
  55. package/src/agents.ts +37 -0
  56. package/src/constants.ts +36 -0
  57. package/src/event-coverage.test.ts +65 -0
  58. package/src/executable.test.ts +89 -0
  59. package/src/executable.ts +143 -0
  60. package/src/fake-opencode.testkit.ts +755 -0
  61. package/src/fixtures/acp-session-updates.json +19 -0
  62. package/src/index.test.ts +69 -0
  63. package/src/index.ts +83 -0
  64. package/src/login.test.ts +155 -0
  65. package/src/login.ts +222 -0
  66. package/src/opencode-api.ts +105 -0
  67. package/src/opencode-helpers.test.ts +76 -0
  68. package/src/opencode-helpers.ts +195 -0
  69. package/src/protocol.ts +104 -0
  70. package/src/rules.test.ts +107 -0
  71. package/src/rules.ts +102 -0
  72. package/src/translate.test.ts +253 -0
  73. package/src/translate.ts +318 -0
  74. package/README.md +0 -3
@@ -0,0 +1,49 @@
1
+ import type { AgentBackgroundWork, AgentStepEvent } from '@moxxy/sdk';
2
+ import type { OpenCodeEvent } from './opencode-api.js';
3
+ /** What one OpenCode event meant for the conversation. */
4
+ export interface HelperNews {
5
+ /** What subagents did: their tools, what they said, how they ended. */
6
+ readonly steps: AgentStepEvent[];
7
+ /** The background work list changed. */
8
+ readonly workChanged: boolean;
9
+ /** OpenCode prompted the conversation's session itself with a background subagent's result: it starts a turn of its own. */
10
+ readonly finished?: {
11
+ readonly workId: string;
12
+ readonly label: string;
13
+ readonly failed: boolean;
14
+ };
15
+ /** The conversation's session started or stopped working. */
16
+ readonly status?: 'busy' | 'idle';
17
+ /** OpenCode waits for the person's account limit (its free tier, its Go plan) to reset before it tries again. */
18
+ readonly limitReached?: true;
19
+ }
20
+ /**
21
+ * The subagents OpenCode runs in one conversation's session, read from its
22
+ * HTTP API's events: ACP reports a `task` call and its answer, not what the
23
+ * subagent does, nor the end of one working in the background (OpenCode 1.19,
24
+ * `task` with `background: true`). Each subagent works in a session of its
25
+ * own, named by the conversation's `task` tool part.
26
+ */
27
+ export declare class OpenCodeHelpers {
28
+ private readonly parent;
29
+ /** By the subagent's session id. */
30
+ private readonly helpers;
31
+ private readonly early;
32
+ constructor(parent: () => string);
33
+ take(event: OpenCodeEvent): HelperNews;
34
+ /** What runs in the background now. */
35
+ running(): AgentBackgroundWork[];
36
+ /** Whether the subagent of the `task` call `callId` works in the background. */
37
+ inBackground(callId: string): boolean;
38
+ /** The session of the background subagent `workId` that still works, marked as being stopped by the person. */
39
+ stop(workId: string): string | undefined;
40
+ /** Stopping it failed: its end is reported as it comes. */
41
+ unstop(workId: string): void;
42
+ /** The OpenCode running them is gone, and they with it. */
43
+ clear(): void;
44
+ private fromParent;
45
+ /** The conversation's `task` call names its subagent's session once it runs. */
46
+ private named;
47
+ private fromHelper;
48
+ }
49
+ //# sourceMappingURL=opencode-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opencode-helpers.d.ts","sourceRoot":"","sources":["../src/opencode-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGvD,0DAA0D;AAC1D,MAAM,WAAW,UAAU;IACzB,uEAAuE;IACvE,QAAQ,CAAC,KAAK,EAAE,cAAc,EAAE,CAAC;IACjC,wCAAwC;IACxC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,4HAA4H;IAC5H,QAAQ,CAAC,QAAQ,CAAC,EAAE;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC;IAClG,6DAA6D;IAC7D,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAClC,iHAAiH;IACjH,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC;CAC9B;AA2BD;;;;;;GAMG;AACH,qBAAa,eAAe;IAKd,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJnC,oCAAoC;IACpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6B;IACrD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAsC;gBAE/B,MAAM,EAAE,MAAM,MAAM;IAEjD,IAAI,CAAC,KAAK,EAAE,aAAa,GAAG,UAAU;IAkBtC,uCAAuC;IACvC,OAAO,IAAI,mBAAmB,EAAE;IAIhC,gFAAgF;IAChF,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAKrC,+GAA+G;IAC/G,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IASxC,2DAA2D;IAC3D,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAI5B,2DAA2D;IAC3D,KAAK,IAAI,IAAI;IAKb,OAAO,CAAC,UAAU;IAiBlB,gFAAgF;IAChF,OAAO,CAAC,KAAK;IAeb,OAAO,CAAC,UAAU;CAuCnB"}
@@ -0,0 +1,175 @@
1
+ import { shownCall } from './translate.js';
2
+ /** Events of a subagent session OpenCode reported before the `task` call naming it; kept until it does. */
3
+ const MAX_EARLY_EVENTS = 64;
4
+ const TASK_TOOL = 'task';
5
+ const ABORTED = 'MessageAbortedError';
6
+ const TASK_RESULT = /^<task id="([^"]+)" state="([a-z]+)">/;
7
+ /** Why OpenCode 1.19 retries when an account limit, not the provider, holds it up. */
8
+ const LIMIT_REASONS = new Set(['free_tier_limit', 'account_rate_limit']);
9
+ const quiet = { steps: [], workChanged: false };
10
+ /**
11
+ * The subagents OpenCode runs in one conversation's session, read from its
12
+ * HTTP API's events: ACP reports a `task` call and its answer, not what the
13
+ * subagent does, nor the end of one working in the background (OpenCode 1.19,
14
+ * `task` with `background: true`). Each subagent works in a session of its
15
+ * own, named by the conversation's `task` tool part.
16
+ */
17
+ export class OpenCodeHelpers {
18
+ parent;
19
+ /** By the subagent's session id. */
20
+ helpers = new Map();
21
+ early = new Map();
22
+ constructor(parent) {
23
+ this.parent = parent;
24
+ }
25
+ take(event) {
26
+ const session = sessionOf(event);
27
+ if (!session)
28
+ return quiet;
29
+ if (session === this.parent())
30
+ return this.fromParent(event);
31
+ if (event.type === 'session.created') {
32
+ const info = record(event.properties.info);
33
+ if (info.parentID === this.parent() && !this.helpers.has(session))
34
+ this.early.set(session, []);
35
+ return quiet;
36
+ }
37
+ const helper = this.helpers.get(session);
38
+ if (!helper) {
39
+ const kept = this.early.get(session);
40
+ if (kept && kept.length < MAX_EARLY_EVENTS)
41
+ kept.push(event);
42
+ return quiet;
43
+ }
44
+ return this.fromHelper(helper, event);
45
+ }
46
+ /** What runs in the background now. */
47
+ running() {
48
+ return [...this.helpers.values()].flatMap((helper) => (helper.background && !helper.done ? [{ id: helper.callId, kind: 'agent', label: helper.label }] : []));
49
+ }
50
+ /** Whether the subagent of the `task` call `callId` works in the background. */
51
+ inBackground(callId) {
52
+ for (const helper of this.helpers.values())
53
+ if (helper.callId === callId)
54
+ return helper.background;
55
+ return false;
56
+ }
57
+ /** The session of the background subagent `workId` that still works, marked as being stopped by the person. */
58
+ stop(workId) {
59
+ for (const [session, helper] of this.helpers) {
60
+ if (helper.callId !== workId || !helper.background || helper.done)
61
+ continue;
62
+ helper.stopping = true;
63
+ return session;
64
+ }
65
+ return undefined;
66
+ }
67
+ /** Stopping it failed: its end is reported as it comes. */
68
+ unstop(workId) {
69
+ for (const helper of this.helpers.values())
70
+ if (helper.callId === workId)
71
+ helper.stopping = false;
72
+ }
73
+ /** The OpenCode running them is gone, and they with it. */
74
+ clear() {
75
+ this.helpers.clear();
76
+ this.early.clear();
77
+ }
78
+ fromParent(event) {
79
+ if (event.type === 'session.status') {
80
+ const status = record(event.properties.status);
81
+ if (status.type === 'retry')
82
+ return { ...quiet, status: 'busy', ...(LIMIT_REASONS.has(String(record(status.action).reason)) ? { limitReached: true } : {}) };
83
+ return status.type === 'idle' || status.type === 'busy' ? { ...quiet, status: status.type } : quiet;
84
+ }
85
+ if (event.type !== 'message.part.updated')
86
+ return quiet;
87
+ const part = record(event.properties.part);
88
+ if (part.type === 'tool' && part.tool === TASK_TOOL && typeof part.callID === 'string')
89
+ return this.named(part.callID, record(part.state));
90
+ if (part.type === 'text' && part.synthetic === true && typeof part.text === 'string') {
91
+ const result = TASK_RESULT.exec(part.text);
92
+ const helper = result?.[1] ? this.helpers.get(result[1]) : undefined;
93
+ if (helper?.background)
94
+ return { ...quiet, finished: { workId: helper.callId, label: helper.label, failed: result?.[2] !== 'completed' } };
95
+ }
96
+ return quiet;
97
+ }
98
+ /** The conversation's `task` call names its subagent's session once it runs. */
99
+ named(callId, state) {
100
+ const metadata = record(state.metadata);
101
+ const session = typeof metadata.sessionId === 'string' ? metadata.sessionId : undefined;
102
+ if (!session || this.helpers.has(session))
103
+ return quiet;
104
+ const input = record(state.input);
105
+ const label = text(input.description) ?? text(state.title) ?? 'subagent';
106
+ const background = metadata.background === true || input.background === true;
107
+ const helper = { callId, label, background, said: '', error: undefined, stopping: false, done: false, shownTools: new Set(), shownTexts: new Set() };
108
+ this.helpers.set(session, helper);
109
+ const early = this.early.get(session) ?? [];
110
+ this.early.delete(session);
111
+ const steps = early.flatMap((event) => this.fromHelper(helper, event).steps);
112
+ return { ...quiet, steps, workChanged: background };
113
+ }
114
+ fromHelper(helper, event) {
115
+ if (helper.done)
116
+ return quiet;
117
+ if (event.type === 'session.error') {
118
+ const error = record(event.properties.error);
119
+ if (error.name === ABORTED)
120
+ helper.stopping = true;
121
+ else
122
+ helper.error = text(record(error.data).message) ?? text(error.name) ?? 'the subagent failed';
123
+ return quiet;
124
+ }
125
+ if (event.type === 'session.status') {
126
+ // A subagent the turn waits for ends with its `task` call, which ACP reports.
127
+ if (record(event.properties.status).type !== 'idle' || !helper.background)
128
+ return quiet;
129
+ helper.done = true;
130
+ const end = helper.stopping
131
+ ? { type: 'subagent_completed', id: helper.callId, text: helper.said, stopped: true }
132
+ : { type: 'subagent_completed', id: helper.callId, text: helper.said, ...(helper.error ? { error: helper.error } : {}) };
133
+ return { ...quiet, steps: [end], workChanged: true };
134
+ }
135
+ if (event.type !== 'message.part.updated')
136
+ return quiet;
137
+ const part = record(event.properties.part);
138
+ const partId = text(part.id);
139
+ if (!partId)
140
+ return quiet;
141
+ if (part.type === 'tool' && typeof part.tool === 'string') {
142
+ const state = record(part.state);
143
+ const input = record(state.input);
144
+ if (helper.shownTools.has(partId) || state.status === 'pending' || Object.keys(input).length === 0)
145
+ return quiet;
146
+ helper.shownTools.add(partId);
147
+ const shown = shownCall(part.tool, undefined, input);
148
+ return { ...quiet, steps: [{ type: 'subagent_tool_call', id: helper.callId, name: shown.name, input: shown.input }] };
149
+ }
150
+ // What the subagent said, once a part of it is finished; its task, the first message of its session, has no time.
151
+ if (part.type === 'text' && part.synthetic !== true && record(part.time).end !== undefined) {
152
+ const said = text(part.text)?.trim();
153
+ if (!said || helper.shownTexts.has(partId))
154
+ return quiet;
155
+ helper.shownTexts.add(partId);
156
+ helper.said = said;
157
+ return { ...quiet, steps: [{ type: 'subagent_message', id: helper.callId, text: said }] };
158
+ }
159
+ return quiet;
160
+ }
161
+ }
162
+ function sessionOf(event) {
163
+ const { sessionID } = event.properties;
164
+ if (typeof sessionID === 'string')
165
+ return sessionID;
166
+ const fromPart = record(event.properties.part).sessionID;
167
+ return typeof fromPart === 'string' ? fromPart : undefined;
168
+ }
169
+ function record(value) {
170
+ return typeof value === 'object' && value !== null && !Array.isArray(value) ? value : {};
171
+ }
172
+ function text(value) {
173
+ return typeof value === 'string' && value ? value : undefined;
174
+ }
175
+ //#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 -0,0 +1,143 @@
1
+ /**
2
+ * The part of the Agent Client Protocol (ACP, protocol version 1) Moxxy
3
+ * speaks, written by hand from recorded `opencode acp` 1.18.35 sessions.
4
+ * Agents send more than this; anything not listed here is left alone.
5
+ */
6
+ export declare const ACP_PROTOCOL_VERSION = 1;
7
+ export interface AcpSelectOption {
8
+ readonly value: string;
9
+ readonly name?: string;
10
+ }
11
+ /** A session setting the agent offers (`model`, `mode`, `effort`), changed with `session/set_config_option`. */
12
+ export interface AcpConfigOption {
13
+ readonly id: string;
14
+ readonly name?: string;
15
+ /** `model`, `mode`, `thought_level`, … */
16
+ readonly category?: string;
17
+ readonly type: string;
18
+ readonly currentValue: string;
19
+ readonly options?: ReadonlyArray<AcpSelectOption>;
20
+ }
21
+ /** What `initialize` answers, as far as Moxxy reads it. */
22
+ export interface AcpInitializeResponse {
23
+ readonly agentCapabilities?: {
24
+ readonly sessionCapabilities?: {
25
+ readonly list?: object;
26
+ };
27
+ };
28
+ }
29
+ /** One page of `session/list`. */
30
+ export interface AcpSessionList {
31
+ readonly sessions: ReadonlyArray<{
32
+ readonly sessionId: string;
33
+ readonly cwd?: string;
34
+ }>;
35
+ readonly nextCursor?: string;
36
+ }
37
+ export interface AcpSessionResponse {
38
+ readonly sessionId?: string;
39
+ readonly configOptions?: ReadonlyArray<AcpConfigOption>;
40
+ }
41
+ export type AcpStopReason = 'end_turn' | 'max_tokens' | 'max_turn_requests' | 'refusal' | 'cancelled';
42
+ export interface AcpUsage {
43
+ /** Prompt tokens not served from the cache. */
44
+ readonly inputTokens?: number;
45
+ readonly outputTokens?: number;
46
+ readonly thoughtTokens?: number;
47
+ readonly cachedReadTokens?: number;
48
+ readonly cachedWriteTokens?: number;
49
+ readonly totalTokens?: number;
50
+ }
51
+ export interface AcpPromptResponse {
52
+ readonly stopReason: AcpStopReason;
53
+ readonly usage?: AcpUsage;
54
+ }
55
+ export type AcpContentBlock = {
56
+ readonly type: 'text';
57
+ readonly text: string;
58
+ } | {
59
+ readonly type: 'image';
60
+ readonly mimeType: string;
61
+ readonly data: string;
62
+ } | {
63
+ readonly type: 'resource';
64
+ readonly resource: {
65
+ readonly uri: string;
66
+ readonly mimeType?: string;
67
+ readonly text?: string;
68
+ readonly blob?: string;
69
+ };
70
+ };
71
+ export type AcpToolKind = 'read' | 'edit' | 'delete' | 'move' | 'search' | 'execute' | 'think' | 'fetch' | 'switch_mode' | 'other';
72
+ export type AcpToolStatus = 'pending' | 'in_progress' | 'completed' | 'failed';
73
+ export type AcpToolCallContent = {
74
+ readonly type: 'content';
75
+ readonly content: {
76
+ readonly type: string;
77
+ readonly text?: string;
78
+ };
79
+ } | {
80
+ readonly type: 'diff';
81
+ readonly path: string;
82
+ readonly oldText?: string | null;
83
+ readonly newText: string;
84
+ } | {
85
+ readonly type: 'terminal';
86
+ readonly terminalId: string;
87
+ };
88
+ /** A `tool_call` or `tool_call_update`: each update carries only what changed. */
89
+ export interface AcpToolCall {
90
+ readonly toolCallId: string;
91
+ readonly title?: string;
92
+ readonly kind?: AcpToolKind;
93
+ readonly status?: AcpToolStatus;
94
+ readonly rawInput?: unknown;
95
+ readonly rawOutput?: unknown;
96
+ readonly content?: ReadonlyArray<AcpToolCallContent>;
97
+ readonly locations?: ReadonlyArray<{
98
+ readonly path: string;
99
+ }>;
100
+ }
101
+ export type AcpSessionUpdate = {
102
+ readonly sessionUpdate: 'agent_message_chunk';
103
+ readonly messageId?: string;
104
+ readonly content: {
105
+ readonly type: string;
106
+ readonly text?: string;
107
+ };
108
+ } | {
109
+ readonly sessionUpdate: 'agent_thought_chunk';
110
+ readonly messageId?: string;
111
+ readonly content: {
112
+ readonly type: string;
113
+ readonly text?: string;
114
+ };
115
+ } | ({
116
+ readonly sessionUpdate: 'tool_call';
117
+ } & AcpToolCall) | ({
118
+ readonly sessionUpdate: 'tool_call_update';
119
+ } & AcpToolCall) | {
120
+ readonly sessionUpdate: string;
121
+ readonly [key: string]: unknown;
122
+ };
123
+ export type AcpPermissionOptionKind = 'allow_once' | 'allow_always' | 'reject_once' | 'reject_always';
124
+ export interface AcpPermissionRequest {
125
+ readonly sessionId: string;
126
+ readonly toolCall: AcpToolCall;
127
+ readonly options: ReadonlyArray<{
128
+ readonly optionId: string;
129
+ readonly kind: AcpPermissionOptionKind;
130
+ readonly name?: string;
131
+ }>;
132
+ }
133
+ export type AcpPermissionOutcome = {
134
+ readonly outcome: {
135
+ readonly outcome: 'selected';
136
+ readonly optionId: string;
137
+ };
138
+ } | {
139
+ readonly outcome: {
140
+ readonly outcome: 'cancelled';
141
+ };
142
+ };
143
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,gHAAgH;AAChH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,0CAA0C;IAC1C,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;CACnD;AAED,2DAA2D;AAC3D,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,iBAAiB,CAAC,EAAE;QAAE,QAAQ,CAAC,mBAAmB,CAAC,EAAE;YAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;CAC5F;AAED,kCAAkC;AAClC,MAA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oB;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;QAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,uBAAuB,CAAC;QAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAChI;AAED,MAAM,MAAM,oBAAoB,GAC5B;IAAE,QAAQ,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;QAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GACjF;IAAE,QAAQ,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAA;KAAE,CAAA;CAAE,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The part of the Agent Client Protocol (ACP, protocol version 1) Moxxy
3
+ * speaks, written by hand from recorded `opencode acp` 1.18.35 sessions.
4
+ * Agents send more than this; anything not listed here is left alone.
5
+ */
6
+ export const ACP_PROTOCOL_VERSION = 1;
7
+ //# sourceMappingURL=protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * OpenCode's permission rules, as `opencode debug agent <name>` reports them:
3
+ * an ordered list in which the last rule matching a permission and input wins.
4
+ */
5
+ export interface OpenCodeRule {
6
+ readonly permission: string;
7
+ readonly pattern: string;
8
+ readonly action: 'allow' | 'ask' | 'deny';
9
+ }
10
+ type Action = OpenCodeRule['action'];
11
+ /** Reads the rules of one of the person's OpenCode agents; `undefined` when OpenCode cannot say. */
12
+ export type ReadAgentRules = (opts: {
13
+ readonly cwd: string;
14
+ readonly agent: string;
15
+ }) => Promise<ReadonlyArray<OpenCodeRule> | undefined>;
16
+ /** Reads the names of the person's own MCP servers that are on; `undefined` when the agent cannot say. */
17
+ export type ReadAgentMcpServers = (opts: {
18
+ readonly cwd: string;
19
+ }) => Promise<ReadonlyArray<string> | undefined>;
20
+ /** Whether OpenCode edits files and runs commands without asking anyone. */
21
+ export declare function runsWithoutAsking(rules: ReadonlyArray<OpenCodeRule>): boolean;
22
+ /**
23
+ * Whether the person's own OpenCode runs without asking in `cwd`, from its
24
+ * default `build` agent's rules; `undefined` when OpenCode cannot be asked.
25
+ */
26
+ export declare function openCodeOwnAutoApprove(cwd: string, readRules: ReadAgentRules): Promise<boolean | undefined>;
27
+ /**
28
+ * The permission config that makes OpenCode ask before what it would do on its
29
+ * own. Each permission's rules are repeated in their order with every allow
30
+ * turned into an ask, so what the person denied stays denied. Given as the
31
+ * agent's own permissions, they come after every other rule and win.
32
+ */
33
+ export declare function askingRules(rules: ReadonlyArray<OpenCodeRule>): Record<string, Action | Record<string, Action>>;
34
+ /**
35
+ * `OPENCODE_CONFIG_CONTENT` for an OpenCode that asks: the agent's permissions,
36
+ * nothing written to disk. Inline config the person already passes is kept;
37
+ * its rules are already among those read, so this agent's permissions replace them.
38
+ */
39
+ export declare function askingConfig(agent: string, rules: ReadonlyArray<OpenCodeRule>, inline?: string): string;
40
+ /**
41
+ * Whether an ask is OpenCode's `external_directory`, which it puts to the
42
+ * person even on its defaults: about a file it names the parent folder
43
+ * (`parentDir`), about a command the folders (`directories`).
44
+ */
45
+ export declare function asksOutsideProject(rawInput: unknown): boolean;
46
+ export {};
47
+ //# sourceMappingURL=rules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../src/rules.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;I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0,0 +1,84 @@
1
+ /** Permissions whose rules take an input pattern (a command, a path). */
2
+ const PATTERNED = ['edit', 'bash'];
3
+ /** Permissions with one action for every input. */
4
+ const UNPATTERNED = ['webfetch', 'websearch'];
5
+ /** Whether OpenCode edits files and runs commands without asking anyone. */
6
+ export function runsWithoutAsking(rules) {
7
+ return PATTERNED.every((permission) => anyInput(rules, permission) === 'allow');
8
+ }
9
+ /**
10
+ * Whether the person's own OpenCode runs without asking in `cwd`, from its
11
+ * default `build` agent's rules; `undefined` when OpenCode cannot be asked.
12
+ */
13
+ export async function openCodeOwnAutoApprove(cwd, readRules) {
14
+ const rules = await readRules({ cwd, agent: 'build' }).catch(() => undefined);
15
+ return rules ? runsWithoutAsking(rules) : undefined;
16
+ }
17
+ /**
18
+ * The permission config that makes OpenCode ask before what it would do on its
19
+ * own. Each permission's rules are repeated in their order with every allow
20
+ * turned into an ask, so what the person denied stays denied. Given as the
21
+ * agent's own permissions, they come after every other rule and win.
22
+ */
23
+ export function askingRules(rules) {
24
+ const config = {};
25
+ for (const permission of PATTERNED) {
26
+ const patterns = new Map();
27
+ for (const rule of rules) {
28
+ if (rule.permission !== permission && !(rule.pattern === '*' && matches(rule.permission, permission)))
29
+ continue;
30
+ // An earlier rule for the same pattern never wins over this one.
31
+ patterns.delete(rule.pattern);
32
+ patterns.set(rule.pattern, asked(rule.action));
33
+ }
34
+ if (!patterns.has('*'))
35
+ patterns.set('*', 'ask');
36
+ config[permission] = Object.fromEntries(patterns);
37
+ }
38
+ for (const permission of UNPATTERNED)
39
+ config[permission] = asked(anyInput(rules, permission) ?? 'allow');
40
+ return config;
41
+ }
42
+ /**
43
+ * `OPENCODE_CONFIG_CONTENT` for an OpenCode that asks: the agent's permissions,
44
+ * nothing written to disk. Inline config the person already passes is kept;
45
+ * its rules are already among those read, so this agent's permissions replace them.
46
+ */
47
+ export function askingConfig(agent, rules, inline) {
48
+ let config = {};
49
+ try {
50
+ const parsed = inline ? JSON.parse(inline) : {};
51
+ if (typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed))
52
+ config = parsed;
53
+ }
54
+ catch {
55
+ // OpenCode skips inline config it cannot read; so does Moxxy.
56
+ }
57
+ const agents = config.agent ?? {};
58
+ return JSON.stringify({ ...config, agent: { ...agents, [agent]: { ...agents[agent], permission: askingRules(rules) } } });
59
+ }
60
+ /**
61
+ * Whether an ask is OpenCode's `external_directory`, which it puts to the
62
+ * person even on its defaults: about a file it names the parent folder
63
+ * (`parentDir`), about a command the folders (`directories`).
64
+ */
65
+ export function asksOutsideProject(rawInput) {
66
+ if (typeof rawInput !== 'object' || rawInput === null)
67
+ return false;
68
+ const input = rawInput;
69
+ return typeof input.parentDir === 'string' || Array.isArray(input.directories);
70
+ }
71
+ /** The action for an input no narrower rule names. */
72
+ function anyInput(rules, permission) {
73
+ return rules.findLast((rule) => rule.pattern === '*' && matches(rule.permission, permission))?.action;
74
+ }
75
+ function asked(action) {
76
+ return action === 'allow' ? 'ask' : action;
77
+ }
78
+ function matches(pattern, name) {
79
+ if (!pattern.includes('*'))
80
+ return pattern === name;
81
+ const source = pattern.split('*').map((part) => part.replace(/[.+?^${}()|[\]\\]/g, '\\$&')).join('.*');
82
+ return new RegExp(`^${source}$`).test(name);
83
+ }
84
+ //# sourceMappingURL=rules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.js","sourceRoot":"","sources":["../src/rules.ts"],"names":[],"mappings":"AAkBA,yEAAyE;AACzE,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,MAAM,CAAU,CAAC;AAC5C,mDAAmD;AACnD,MAAM,WAAW,GAAG,CAAC,UAAU,EAAE,WAAW,CAAU,CAAC;AAEvD,4EAA4E;AAC5E,MAAM,UAAU,iBAAiB,CAAC,KAAkC;IAClE,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC,KAAK,OAAO,CAAC,CAAC;AAClF,CAAC;AAED;;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CAAC,IAAI,CAAC,OAAO,KAAK,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,EAAE,MAAM,CAAC;AACxG,CAAC;AAED,SAAS,KAAK,CAAC,MAAc;IAC3B,OAAO,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;AAC7C,CAAC;AAED,SAAS,OAAO,CAAC,OAAe,EAAE,IAAY;IAC5C,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,OAAO,KAAK,IAAI,CAAC;IACpD,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvG,OAAO,IAAI,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,50 @@
1
+ import type { AgentStepEvent, ContentBlock, TokenUsage } from '@moxxy/sdk';
2
+ import type { AcpContentBlock, AcpSessionUpdate, AcpToolCall, AcpToolKind, AcpUsage } from './protocol.js';
3
+ /** A tool the agent runs itself, as Moxxy names it (`Bash`, `Read`, … so Moxxy's rules and formatting apply). */
4
+ export interface AcpShownCall {
5
+ readonly name: string;
6
+ readonly input: unknown;
7
+ }
8
+ /**
9
+ * One agent prompt's `session/update` notifications as Moxxy agent events.
10
+ * ACP announces a tool before its input is known (a `pending` `tool_call`
11
+ * with no or partial `rawInput`, OpenCode's command with its folder only, then
12
+ * an `in_progress` update with the input), so a call is shown once it starts. Calls to Moxxy's own tools (`moxxy_*` for OpenCode) are left
13
+ * out: Moxxy records those when it runs them.
14
+ */
15
+ export declare class AcpTurnTranslator {
16
+ private readonly moxxyToolPrefix;
17
+ private readonly cwd;
18
+ private readonly calls;
19
+ private text;
20
+ private thought;
21
+ /** Plans the agent reported this prompt; each is shown as a call of its own. */
22
+ private plans;
23
+ private readonly planPrefix;
24
+ /** `cwd`: the project folder, which the paths of file diffs are shown relative to. */
25
+ constructor(moxxyToolPrefix: string, cwd?: string);
26
+ update(update: AcpSessionUpdate): AgentStepEvent[];
27
+ /** The prompt ended: what the agent said last is its final message. */
28
+ finish(): AgentStepEvent[];
29
+ /** The call a permission ask is about, shown first if it is not yet. */
30
+ callFor(toolCall: AcpToolCall): {
31
+ readonly call: AcpShownCall;
32
+ readonly events: AgentStepEvent[];
33
+ };
34
+ /** Close the calls still open (the prompt ended without their result). */
35
+ openCalls(): string[];
36
+ private toolCall;
37
+ /** An ACP agent's plan (`entries` of `{ content, status }`), whole each time, shown as a call of its own. */
38
+ private plan;
39
+ private show;
40
+ private isMoxxyTool;
41
+ private flushText;
42
+ private flushThought;
43
+ }
44
+ /** The agent's tool under the name Moxxy knows it by, with Moxxy's input keys. */
45
+ export declare function shownCall(tool: string, kind: AcpToolKind | undefined, input: Record<string, unknown>): AcpShownCall;
46
+ export declare function toTokenUsage(usage: AcpUsage): TokenUsage;
47
+ /** The person's message as ACP content: text, images, and documents as embedded resources. */
48
+ export declare function toAcpPrompt(prompt: ReadonlyArray<ContentBlock>): AcpContentBlock[];
49
+ export declare function promptText(prompt: ReadonlyArray<ContentBlock>): string;
50
+ //# sourceMappingURL=translate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translate.d.ts","sourceRoot":"","sources":["../src/translate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAmB,UAAU,EAAa,MAAM,YAAY,CAAC;AAEvG,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE3G,iHAAiH;AACjH,MAAM,WAAW,YAAY;IAC3B,QA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