@moxxy/plugin-provider-claude-code 0.44.0 → 0.45.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.
- package/dist/account-limit.d.ts +8 -0
- package/dist/account-limit.d.ts.map +1 -0
- package/dist/account-limit.js +23 -0
- package/dist/account-limit.js.map +1 -0
- package/dist/agent-provider.d.ts +61 -0
- package/dist/agent-provider.d.ts.map +1 -0
- package/dist/agent-provider.js +195 -0
- package/dist/agent-provider.js.map +1 -0
- package/dist/agent-session.d.ts +145 -0
- package/dist/agent-session.d.ts.map +1 -0
- package/dist/agent-session.js +700 -0
- package/dist/agent-session.js.map +1 -0
- package/dist/background-work.d.ts +42 -0
- package/dist/background-work.d.ts.map +1 -0
- package/dist/background-work.js +140 -0
- package/dist/background-work.js.map +1 -0
- package/dist/constants.d.ts +2 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +2 -2
- package/dist/constants.js.map +1 -1
- package/dist/executable.d.ts +15 -0
- package/dist/executable.d.ts.map +1 -0
- package/dist/executable.js +30 -0
- package/dist/executable.js.map +1 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +55 -16
- package/dist/index.js.map +1 -1
- package/dist/login.d.ts +3 -0
- package/dist/login.d.ts.map +1 -1
- package/dist/login.js +8 -1
- package/dist/login.js.map +1 -1
- package/dist/offered-models.d.ts +13 -0
- package/dist/offered-models.d.ts.map +1 -0
- package/dist/offered-models.js +45 -0
- package/dist/offered-models.js.map +1 -0
- package/dist/own-settings.d.ts +12 -0
- package/dist/own-settings.d.ts.map +1 -0
- package/dist/own-settings.js +31 -0
- package/dist/own-settings.js.map +1 -0
- package/dist/questions.d.ts +6 -0
- package/dist/questions.d.ts.map +1 -0
- package/dist/questions.js +38 -0
- package/dist/questions.js.map +1 -0
- package/dist/scheduled-wakeups.d.ts +10 -0
- package/dist/scheduled-wakeups.d.ts.map +1 -0
- package/dist/scheduled-wakeups.js +30 -0
- package/dist/scheduled-wakeups.js.map +1 -0
- package/dist/sdk-install.d.ts +25 -0
- package/dist/sdk-install.d.ts.map +1 -0
- package/dist/sdk-install.js +94 -0
- package/dist/sdk-install.js.map +1 -0
- package/dist/sdk-types.d.ts +310 -0
- package/dist/sdk-types.d.ts.map +1 -0
- package/dist/sdk-types.js +8 -0
- package/dist/sdk-types.js.map +1 -0
- package/dist/subagents.d.ts +39 -0
- package/dist/subagents.d.ts.map +1 -0
- package/dist/subagents.js +114 -0
- package/dist/subagents.js.map +1 -0
- package/dist/task-list.d.ts +21 -0
- package/dist/task-list.d.ts.map +1 -0
- package/dist/task-list.js +68 -0
- package/dist/task-list.js.map +1 -0
- package/dist/translate.d.ts +57 -0
- package/dist/translate.d.ts.map +1 -0
- package/dist/translate.js +276 -0
- package/dist/translate.js.map +1 -0
- package/package.json +14 -9
- package/src/account-limit.ts +26 -0
- package/src/agent-cli.test.ts +83 -0
- package/src/agent-provider.test.ts +1156 -0
- package/src/agent-provider.ts +223 -0
- package/src/agent-session.ts +790 -0
- package/src/background-work.ts +163 -0
- package/src/constants.ts +2 -3
- package/src/event-coverage.test.ts +105 -0
- package/src/executable.test.ts +60 -0
- package/src/executable.ts +34 -0
- package/src/fake-claude.testkit.ts +376 -0
- package/src/fixtures/claude-agent-sdk-0.3.296.json +43 -0
- package/src/fixtures/claude-supported-models-0.3.296.json +218 -0
- package/src/index.test.ts +49 -0
- package/src/index.ts +61 -18
- package/src/login.ts +10 -1
- package/src/offered-models.test.ts +73 -0
- package/src/offered-models.ts +57 -0
- package/src/own-settings.test.ts +68 -0
- package/src/own-settings.ts +33 -0
- package/src/questions.test.ts +68 -0
- package/src/questions.ts +45 -0
- package/src/scheduled-wakeups.test.ts +41 -0
- package/src/scheduled-wakeups.ts +34 -0
- package/src/sdk-install.test.ts +124 -0
- package/src/sdk-install.ts +107 -0
- package/src/sdk-types.ts +277 -0
- package/src/subagents.ts +123 -0
- package/src/task-list.ts +65 -0
- package/src/translate.test.ts +439 -0
- package/src/translate.ts +280 -0
- package/dist/process.d.ts +0 -34
- package/dist/process.d.ts.map +0 -1
- package/dist/process.js +0 -197
- package/dist/process.js.map +0 -1
- package/dist/protocol.d.ts +0 -30
- package/dist/protocol.d.ts.map +0 -1
- package/dist/protocol.js +0 -368
- package/dist/protocol.js.map +0 -1
- package/dist/provider.d.ts +0 -53
- package/dist/provider.d.ts.map +0 -1
- package/dist/provider.js +0 -229
- package/dist/provider.js.map +0 -1
- package/src/process.test.ts +0 -208
- package/src/process.ts +0 -224
- package/src/protocol.ts +0 -390
- package/src/provider.test.ts +0 -671
- package/src/provider.ts +0 -267
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The part of the Claude Agent SDK (`@anthropic-ai/claude-agent-sdk`) Moxxy
|
|
3
|
+
* uses, typed here because the SDK is installed into `~/.moxxy` and loaded at
|
|
4
|
+
* runtime rather than bundled (it needs zod 4; the repo is on zod 3). Shapes
|
|
5
|
+
* follow the SDK's own `sdk.d.ts` (0.3.296); fields Moxxy does not read are left out.
|
|
6
|
+
*/
|
|
7
|
+
export type ClaudePermissionMode = 'default' | 'acceptEdits' | 'bypassPermissions' | 'plan' | 'dontAsk' | 'auto';
|
|
8
|
+
export type ClaudeEffort = 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
9
|
+
export interface ClaudeContentBlockText {
|
|
10
|
+
readonly type: 'text';
|
|
11
|
+
readonly text: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ClaudeContentBlockThinking {
|
|
14
|
+
readonly type: 'thinking';
|
|
15
|
+
readonly thinking: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ClaudeContentBlockToolUse {
|
|
18
|
+
readonly type: 'tool_use';
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly name: string;
|
|
21
|
+
readonly input: unknown;
|
|
22
|
+
}
|
|
23
|
+
export interface ClaudeContentBlockToolResult {
|
|
24
|
+
readonly type: 'tool_result';
|
|
25
|
+
readonly tool_use_id: string;
|
|
26
|
+
readonly content?: string | ReadonlyArray<{
|
|
27
|
+
readonly type: string;
|
|
28
|
+
readonly text?: string;
|
|
29
|
+
}>;
|
|
30
|
+
readonly is_error?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export type ClaudeContentBlock = ClaudeContentBlockText | ClaudeContentBlockThinking | ClaudeContentBlockToolUse | ClaudeContentBlockToolResult | {
|
|
33
|
+
readonly type: string;
|
|
34
|
+
};
|
|
35
|
+
/** What Moxxy sends: a user message of the Messages API. */
|
|
36
|
+
export type ClaudeUserContent = string | ReadonlyArray<{
|
|
37
|
+
readonly type: 'text';
|
|
38
|
+
readonly text: string;
|
|
39
|
+
} | {
|
|
40
|
+
readonly type: 'image';
|
|
41
|
+
readonly source: {
|
|
42
|
+
readonly type: 'base64';
|
|
43
|
+
readonly media_type: string;
|
|
44
|
+
readonly data: string;
|
|
45
|
+
};
|
|
46
|
+
} | {
|
|
47
|
+
readonly type: 'document';
|
|
48
|
+
readonly source: {
|
|
49
|
+
readonly type: 'base64';
|
|
50
|
+
readonly media_type: string;
|
|
51
|
+
readonly data: string;
|
|
52
|
+
};
|
|
53
|
+
}>;
|
|
54
|
+
export interface ClaudeUserMessage {
|
|
55
|
+
readonly type: 'user';
|
|
56
|
+
readonly message: {
|
|
57
|
+
readonly role: 'user';
|
|
58
|
+
readonly content: ClaudeUserContent;
|
|
59
|
+
};
|
|
60
|
+
readonly parent_tool_use_id: null;
|
|
61
|
+
readonly origin: {
|
|
62
|
+
readonly kind: 'human';
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export interface ClaudeUsage {
|
|
66
|
+
readonly input_tokens?: number;
|
|
67
|
+
readonly output_tokens?: number;
|
|
68
|
+
readonly cache_read_input_tokens?: number;
|
|
69
|
+
readonly cache_creation_input_tokens?: number;
|
|
70
|
+
}
|
|
71
|
+
/** One model's share of a query (`ModelUsage`); only the fields Moxxy reads. */
|
|
72
|
+
export interface ClaudeModelUsage {
|
|
73
|
+
readonly contextWindow?: number;
|
|
74
|
+
readonly maxOutputTokens?: number;
|
|
75
|
+
/** The model id behind an alias or a provider-specific id (`claude-opus-4-7`). */
|
|
76
|
+
readonly canonicalModel?: string;
|
|
77
|
+
}
|
|
78
|
+
/** The plan limit Claude reports for a claude.ai sign-in (absent on an API key). `resetsAt` is in epoch seconds. */
|
|
79
|
+
export interface ClaudeRateLimitInfo {
|
|
80
|
+
readonly status: 'allowed' | 'allowed_warning' | 'rejected';
|
|
81
|
+
readonly resetsAt?: number;
|
|
82
|
+
readonly rateLimitType?: string;
|
|
83
|
+
/** 0–1. */
|
|
84
|
+
readonly utilization?: number;
|
|
85
|
+
readonly overageStatus?: 'allowed' | 'allowed_warning' | 'rejected';
|
|
86
|
+
readonly isUsingOverage?: boolean;
|
|
87
|
+
}
|
|
88
|
+
/** Claude's messages Moxxy reads; others (status, hooks, task notes) arrive too and are passed over. */
|
|
89
|
+
export type ClaudeMessage = {
|
|
90
|
+
readonly type: 'system';
|
|
91
|
+
readonly subtype: 'init';
|
|
92
|
+
readonly session_id: string;
|
|
93
|
+
readonly permissionMode?: ClaudePermissionMode;
|
|
94
|
+
readonly model?: string;
|
|
95
|
+
} | {
|
|
96
|
+
readonly type: 'system';
|
|
97
|
+
readonly subtype: string;
|
|
98
|
+
readonly session_id?: string;
|
|
99
|
+
} | {
|
|
100
|
+
readonly type: 'assistant';
|
|
101
|
+
/** `usage` is that of the one API call the message came from. */
|
|
102
|
+
readonly message: {
|
|
103
|
+
readonly model?: string;
|
|
104
|
+
readonly content: ReadonlyArray<ClaudeContentBlock>;
|
|
105
|
+
readonly usage?: ClaudeUsage;
|
|
106
|
+
};
|
|
107
|
+
readonly parent_tool_use_id: string | null;
|
|
108
|
+
readonly session_id?: string;
|
|
109
|
+
/** Set on a message Claude Code wrote itself about a failed request (`rate_limit` when the plan's limit is used up). */
|
|
110
|
+
readonly error?: string;
|
|
111
|
+
} | {
|
|
112
|
+
readonly type: 'rate_limit_event';
|
|
113
|
+
readonly rate_limit_info: ClaudeRateLimitInfo;
|
|
114
|
+
readonly session_id?: string;
|
|
115
|
+
} | {
|
|
116
|
+
readonly type: 'user';
|
|
117
|
+
readonly message: {
|
|
118
|
+
readonly content: string | ReadonlyArray<ClaudeContentBlock>;
|
|
119
|
+
};
|
|
120
|
+
readonly parent_tool_use_id: string | null;
|
|
121
|
+
readonly isSynthetic?: boolean;
|
|
122
|
+
/** The tool's own output object (Edit and Write report their patch here), beside the text Claude read. */
|
|
123
|
+
readonly tool_use_result?: unknown;
|
|
124
|
+
} | {
|
|
125
|
+
readonly type: 'stream_event';
|
|
126
|
+
readonly event: {
|
|
127
|
+
readonly type: string;
|
|
128
|
+
readonly delta?: {
|
|
129
|
+
readonly type: string;
|
|
130
|
+
readonly text?: string;
|
|
131
|
+
readonly thinking?: string;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
readonly parent_tool_use_id: string | null;
|
|
135
|
+
} | {
|
|
136
|
+
readonly type: 'result';
|
|
137
|
+
readonly subtype: string;
|
|
138
|
+
/** Who started the turn: the person, or Claude itself after a background task. */
|
|
139
|
+
readonly origin?: {
|
|
140
|
+
readonly kind: string;
|
|
141
|
+
};
|
|
142
|
+
readonly is_error: boolean;
|
|
143
|
+
readonly result?: string;
|
|
144
|
+
readonly session_id: string;
|
|
145
|
+
readonly stop_reason?: string | null;
|
|
146
|
+
readonly terminal_reason?: string | null;
|
|
147
|
+
readonly usage?: ClaudeUsage;
|
|
148
|
+
readonly modelUsage?: Readonly<Record<string, ClaudeModelUsage>>;
|
|
149
|
+
readonly errors?: ReadonlyArray<string>;
|
|
150
|
+
};
|
|
151
|
+
export type ClaudePermissionResult = {
|
|
152
|
+
readonly behavior: 'allow';
|
|
153
|
+
readonly updatedInput?: Record<string, unknown>;
|
|
154
|
+
} | {
|
|
155
|
+
readonly behavior: 'deny';
|
|
156
|
+
readonly message: string;
|
|
157
|
+
readonly interrupt?: boolean;
|
|
158
|
+
};
|
|
159
|
+
export type ClaudeCanUseTool = (toolName: string, input: Record<string, unknown>, options: {
|
|
160
|
+
readonly signal: AbortSignal;
|
|
161
|
+
readonly toolUseID?: string;
|
|
162
|
+
/** Set when the call comes from inside a subagent. */
|
|
163
|
+
readonly agentID?: string;
|
|
164
|
+
readonly description?: string;
|
|
165
|
+
readonly title?: string;
|
|
166
|
+
readonly mcpServer?: {
|
|
167
|
+
readonly name: string;
|
|
168
|
+
readonly source: string;
|
|
169
|
+
};
|
|
170
|
+
}) => Promise<ClaudePermissionResult>;
|
|
171
|
+
export interface ClaudePreToolUseInput {
|
|
172
|
+
readonly hook_event_name: 'PreToolUse';
|
|
173
|
+
readonly tool_name: string;
|
|
174
|
+
readonly tool_input: unknown;
|
|
175
|
+
readonly tool_use_id: string;
|
|
176
|
+
/** Set when the call comes from inside a subagent. */
|
|
177
|
+
readonly agent_id?: string;
|
|
178
|
+
}
|
|
179
|
+
export interface ClaudePreToolUseOutput {
|
|
180
|
+
readonly hookSpecificOutput?: {
|
|
181
|
+
readonly hookEventName: 'PreToolUse';
|
|
182
|
+
readonly permissionDecision: 'deny';
|
|
183
|
+
readonly permissionDecisionReason: string;
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
export type ClaudeHookCallback = (input: ClaudePreToolUseInput, toolUseID: string | undefined, options: {
|
|
187
|
+
readonly signal: AbortSignal;
|
|
188
|
+
}) => Promise<ClaudePreToolUseOutput>;
|
|
189
|
+
/** A time Claude set itself to come back to the session (ScheduleWakeup, `/loop`, CronCreate). */
|
|
190
|
+
export interface ClaudeSessionCron {
|
|
191
|
+
readonly id: string;
|
|
192
|
+
/** A five-field cron expression; a one-shot wakeup's encodes its single fire time. */
|
|
193
|
+
readonly schedule: string;
|
|
194
|
+
readonly recurring: boolean;
|
|
195
|
+
/** What Claude is told when it fires; clipped by Claude at 1000 characters. */
|
|
196
|
+
readonly prompt: string;
|
|
197
|
+
}
|
|
198
|
+
/** Claude's `Stop` hook: it ran the turn to its end. Older Claude sends no `session_crons`. */
|
|
199
|
+
export interface ClaudeStopInput {
|
|
200
|
+
readonly hook_event_name: 'Stop';
|
|
201
|
+
readonly session_crons?: ReadonlyArray<ClaudeSessionCron>;
|
|
202
|
+
}
|
|
203
|
+
export type ClaudeStopHookCallback = (input: ClaudeStopInput, toolUseID: string | undefined, options: {
|
|
204
|
+
readonly signal: AbortSignal;
|
|
205
|
+
}) => Promise<Record<string, never>>;
|
|
206
|
+
export interface ClaudeQueryOptions {
|
|
207
|
+
readonly cwd: string;
|
|
208
|
+
readonly model?: string;
|
|
209
|
+
readonly effort?: ClaudeEffort;
|
|
210
|
+
/** The Claude Code preset for agent turns; a plain prompt for one-off text calls. */
|
|
211
|
+
readonly systemPrompt: {
|
|
212
|
+
readonly type: 'preset';
|
|
213
|
+
readonly preset: 'claude_code';
|
|
214
|
+
} | string;
|
|
215
|
+
readonly pathToClaudeCodeExecutable?: string;
|
|
216
|
+
/** Left out to keep the mode the person set up in Claude's own settings. */
|
|
217
|
+
readonly permissionMode?: ClaudePermissionMode;
|
|
218
|
+
readonly allowDangerouslySkipPermissions?: boolean;
|
|
219
|
+
readonly maxTurns?: number;
|
|
220
|
+
readonly includePartialMessages?: boolean;
|
|
221
|
+
readonly resume?: string;
|
|
222
|
+
readonly persistSession?: boolean;
|
|
223
|
+
readonly tools?: ReadonlyArray<string>;
|
|
224
|
+
readonly settingSources?: ReadonlyArray<'user' | 'project' | 'local'>;
|
|
225
|
+
readonly mcpServers?: Record<string, {
|
|
226
|
+
readonly type: 'http';
|
|
227
|
+
readonly url: string;
|
|
228
|
+
readonly headers: Record<string, string>;
|
|
229
|
+
}>;
|
|
230
|
+
/** Only the servers in `mcpServers`: none of the person's own, claude.ai connectors included. */
|
|
231
|
+
readonly strictMcpConfig?: boolean;
|
|
232
|
+
readonly canUseTool?: ClaudeCanUseTool;
|
|
233
|
+
readonly hooks?: {
|
|
234
|
+
readonly PreToolUse?: ReadonlyArray<{
|
|
235
|
+
readonly hooks: ReadonlyArray<ClaudeHookCallback>;
|
|
236
|
+
}>;
|
|
237
|
+
readonly Stop?: ReadonlyArray<{
|
|
238
|
+
readonly hooks: ReadonlyArray<ClaudeStopHookCallback>;
|
|
239
|
+
}>;
|
|
240
|
+
};
|
|
241
|
+
readonly env?: Record<string, string | undefined>;
|
|
242
|
+
readonly stderr?: (data: string) => void;
|
|
243
|
+
}
|
|
244
|
+
/** One of Claude's MCP servers; `status` is `connected`, `failed`, `needs-auth`, `pending` or `disabled`. */
|
|
245
|
+
export interface ClaudeMcpServerStatus {
|
|
246
|
+
readonly name: string;
|
|
247
|
+
readonly status: string;
|
|
248
|
+
}
|
|
249
|
+
/** A skill or command Claude can run; `builtin` marks Claude Code's own. */
|
|
250
|
+
export interface ClaudeSlashCommand {
|
|
251
|
+
readonly name: string;
|
|
252
|
+
readonly description: string;
|
|
253
|
+
readonly argumentHint: string;
|
|
254
|
+
readonly aliases?: ReadonlyArray<string>;
|
|
255
|
+
readonly builtin?: boolean;
|
|
256
|
+
}
|
|
257
|
+
/** One model of `supportedModels`: an alias row (`opus`) names the full id it stands for in `resolvedModel`. */
|
|
258
|
+
export interface ClaudeModelInfo {
|
|
259
|
+
readonly value: string;
|
|
260
|
+
readonly resolvedModel?: string;
|
|
261
|
+
readonly displayName: string;
|
|
262
|
+
readonly description: string;
|
|
263
|
+
readonly supportsEffort?: boolean;
|
|
264
|
+
readonly supportsFastMode?: boolean;
|
|
265
|
+
}
|
|
266
|
+
export interface ClaudeQuery extends AsyncIterable<ClaudeMessage> {
|
|
267
|
+
interrupt(): Promise<unknown>;
|
|
268
|
+
/** The skills and commands this Claude has. */
|
|
269
|
+
supportedCommands(): Promise<ClaudeSlashCommand[]>;
|
|
270
|
+
/** The models this Claude offers the signed-in account, as its own picker lists them. */
|
|
271
|
+
supportedModels(): Promise<ClaudeModelInfo[]>;
|
|
272
|
+
/** The MCP servers this Claude has, Moxxy's among them. */
|
|
273
|
+
mcpServerStatus(): Promise<ClaudeMcpServerStatus[]>;
|
|
274
|
+
setPermissionMode(mode: ClaudePermissionMode): Promise<void>;
|
|
275
|
+
setModel(model?: string): Promise<void>;
|
|
276
|
+
/** Stop one of Claude's tasks (a background command or helper); Claude then reports it stopped. */
|
|
277
|
+
stopTask(taskId: string): Promise<void>;
|
|
278
|
+
close(): void;
|
|
279
|
+
}
|
|
280
|
+
/** Claude's settings, as far as Moxxy reads them. */
|
|
281
|
+
export interface ClaudeSettings {
|
|
282
|
+
readonly permissions?: {
|
|
283
|
+
readonly defaultMode?: ClaudePermissionMode;
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
/** What `resolveSettings` answers: the merged settings, and each source's own. */
|
|
287
|
+
export interface ClaudeResolvedSettings {
|
|
288
|
+
readonly effective: ClaudeSettings;
|
|
289
|
+
readonly sources: ReadonlyArray<{
|
|
290
|
+
readonly source: string;
|
|
291
|
+
readonly settings: ClaudeSettings;
|
|
292
|
+
}>;
|
|
293
|
+
}
|
|
294
|
+
export interface ClaudeAgentSdk {
|
|
295
|
+
query(params: {
|
|
296
|
+
prompt: string | AsyncIterable<ClaudeUserMessage>;
|
|
297
|
+
options: ClaudeQueryOptions;
|
|
298
|
+
}): ClaudeQuery;
|
|
299
|
+
/** One of Claude's saved sessions, searched across every project; `undefined` when it no longer exists. */
|
|
300
|
+
getSessionInfo?(sessionId: string): Promise<{
|
|
301
|
+
readonly sessionId: string;
|
|
302
|
+
} | undefined>;
|
|
303
|
+
/** The person's Claude settings for a folder, merged the way Claude merges them. */
|
|
304
|
+
resolveSettings?(opts?: {
|
|
305
|
+
readonly cwd?: string;
|
|
306
|
+
}): Promise<ClaudeResolvedSettings>;
|
|
307
|
+
/** Drops an escalating `defaultMode` a repository's settings set, as Claude does before honoring it. */
|
|
308
|
+
filterEscalatingDefaultMode?(resolved: ClaudeResolvedSettings): ClaudeSettings;
|
|
309
|
+
}
|
|
310
|
+
//# sourceMappingURL=sdk-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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,CAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAA;KAAE,CAAC,CAAC;CACjG;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC,iBAAiB,CAAC,CAAC;QAAC,OAAO,EAAE,kBAAkB,CAAA;KAAE,GAAG,WAAW,CAAC;IAC/G,2GAA2G;IAC3G,cAAc,CAAC,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC,CAAC;IACxF,oFAAoF;IACpF,eAAe,CAAC,CAAC,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACpF,wGAAwG;IACxG,2BAA2B,CAAC,CAAC,QAAQ,EAAE,sBAAsB,GAAG,cAAc,CAAC;CAChF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The part of the Claude Agent SDK (`@anthropic-ai/claude-agent-sdk`) Moxxy
|
|
3
|
+
* uses, typed here because the SDK is installed into `~/.moxxy` and loaded at
|
|
4
|
+
* runtime rather than bundled (it needs zod 4; the repo is on zod 3). Shapes
|
|
5
|
+
* follow the SDK's own `sdk.d.ts` (0.3.296); fields Moxxy does not read are left out.
|
|
6
|
+
*/
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=sdk-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk-types.js","sourceRoot":"","sources":["../src/sdk-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { AgentStepEvent } from '@moxxy/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* Claude's subagents. The call that starts one is shown as the subagent; its own calls carry
|
|
4
|
+
* the starting call's id (`parent_tool_use_id`) and show under it. One running in the background
|
|
5
|
+
* ends later, when Claude reports its task finished, so the session keeps them across turns.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ClaudeSubagents {
|
|
8
|
+
private readonly agents;
|
|
9
|
+
/** A subagent's call → the subagent it belongs to. */
|
|
10
|
+
private readonly calls;
|
|
11
|
+
isSubagentTool(name: string): boolean;
|
|
12
|
+
/** Whether a call started a subagent. */
|
|
13
|
+
isSubagent(callId: string): boolean;
|
|
14
|
+
/** The subagent a call belongs to, if it is a subagent's call. */
|
|
15
|
+
ownerOf(callId: string): string | undefined;
|
|
16
|
+
started(callId: string, input: unknown): AgentStepEvent[];
|
|
17
|
+
/** What a subagent said and called, from one of its messages; each once, however often the message is read. */
|
|
18
|
+
fromMessage(parent: string, text: string, calls: ReadonlyArray<{
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly name: string;
|
|
21
|
+
readonly input: unknown;
|
|
22
|
+
}>): AgentStepEvent[];
|
|
23
|
+
/**
|
|
24
|
+
* The result of the call that started a subagent: its answer, unless it went on in the background.
|
|
25
|
+
* The result Claude's model reads wraps the answer in a hand-back note, so the report's own text is preferred.
|
|
26
|
+
*/
|
|
27
|
+
fromResult(callId: string, text: string, isError: boolean, report: unknown): AgentStepEvent[];
|
|
28
|
+
/** Claude's task reports: progress (tokens so far) and the end of a subagent in the background. */
|
|
29
|
+
fromTaskNote(note: {
|
|
30
|
+
readonly subtype: string;
|
|
31
|
+
readonly tool_use_id?: unknown;
|
|
32
|
+
readonly status?: unknown;
|
|
33
|
+
readonly summary?: unknown;
|
|
34
|
+
readonly usage?: unknown;
|
|
35
|
+
}): AgentStepEvent[];
|
|
36
|
+
private textOf;
|
|
37
|
+
private end;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=subagents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subagents.d.ts","sourceRoot":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,MAAM;IAKd,OAAO,CAAC,GAAG;CAOZ"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/** Claude's tool that starts a subagent: `Agent` in Claude Code 2.1, `Task` before. */
|
|
2
|
+
const SUBAGENT_TOOLS = new Set(['Agent', 'Task']);
|
|
3
|
+
/**
|
|
4
|
+
* Claude's subagents. The call that starts one is shown as the subagent; its own calls carry
|
|
5
|
+
* the starting call's id (`parent_tool_use_id`) and show under it. One running in the background
|
|
6
|
+
* ends later, when Claude reports its task finished, so the session keeps them across turns.
|
|
7
|
+
*/
|
|
8
|
+
export class ClaudeSubagents {
|
|
9
|
+
agents = new Map();
|
|
10
|
+
/** A subagent's call → the subagent it belongs to. */
|
|
11
|
+
calls = new Map();
|
|
12
|
+
isSubagentTool(name) {
|
|
13
|
+
return SUBAGENT_TOOLS.has(name);
|
|
14
|
+
}
|
|
15
|
+
/** Whether a call started a subagent. */
|
|
16
|
+
isSubagent(callId) {
|
|
17
|
+
return this.agents.has(callId);
|
|
18
|
+
}
|
|
19
|
+
/** The subagent a call belongs to, if it is a subagent's call. */
|
|
20
|
+
ownerOf(callId) {
|
|
21
|
+
return this.calls.get(callId);
|
|
22
|
+
}
|
|
23
|
+
started(callId, input) {
|
|
24
|
+
if (this.agents.has(callId))
|
|
25
|
+
return [];
|
|
26
|
+
this.agents.set(callId, { text: '', tokens: undefined, background: false, done: false, said: new Set() });
|
|
27
|
+
const fields = typeof input === 'object' && input !== null ? input : {};
|
|
28
|
+
const label = typeof fields.description === 'string' && fields.description ? fields.description : 'subagent';
|
|
29
|
+
const agentType = typeof fields.subagent_type === 'string' && fields.subagent_type ? fields.subagent_type : 'general-purpose';
|
|
30
|
+
const prompt = typeof fields.prompt === 'string' && fields.prompt ? fields.prompt : undefined;
|
|
31
|
+
return [{ type: 'subagent_started', id: callId, label, agentType, ...(prompt ? { prompt } : {}) }];
|
|
32
|
+
}
|
|
33
|
+
/** What a subagent said and called, from one of its messages; each once, however often the message is read. */
|
|
34
|
+
fromMessage(parent, text, calls) {
|
|
35
|
+
const agent = this.agents.get(parent);
|
|
36
|
+
if (!agent || agent.done)
|
|
37
|
+
return [];
|
|
38
|
+
const events = [];
|
|
39
|
+
if (text) {
|
|
40
|
+
agent.text = text;
|
|
41
|
+
if (!agent.said.has(text))
|
|
42
|
+
events.push({ type: 'subagent_message', id: parent, text });
|
|
43
|
+
agent.said.add(text);
|
|
44
|
+
}
|
|
45
|
+
for (const call of calls) {
|
|
46
|
+
if (this.calls.has(call.id))
|
|
47
|
+
continue;
|
|
48
|
+
this.calls.set(call.id, parent);
|
|
49
|
+
events.push({ type: 'subagent_tool_call', id: parent, name: call.name, input: call.input });
|
|
50
|
+
}
|
|
51
|
+
return events;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The result of the call that started a subagent: its answer, unless it went on in the background.
|
|
55
|
+
* The result Claude's model reads wraps the answer in a hand-back note, so the report's own text is preferred.
|
|
56
|
+
*/
|
|
57
|
+
fromResult(callId, text, isError, report) {
|
|
58
|
+
const r = typeof report === 'object' && report !== null ? report : {};
|
|
59
|
+
if (r.isAsync === true && !isError) {
|
|
60
|
+
const agent = this.agents.get(callId);
|
|
61
|
+
if (agent)
|
|
62
|
+
agent.background = true;
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
if (isError)
|
|
66
|
+
return this.end(callId, { text: '', error: text });
|
|
67
|
+
const answer = reportText(r.content) || text || this.textOf(callId);
|
|
68
|
+
return this.end(callId, { text: answer, ...(typeof r.totalTokens === 'number' ? { tokens: r.totalTokens } : {}) });
|
|
69
|
+
}
|
|
70
|
+
/** Claude's task reports: progress (tokens so far) and the end of a subagent in the background. */
|
|
71
|
+
fromTaskNote(note) {
|
|
72
|
+
if (typeof note.tool_use_id !== 'string')
|
|
73
|
+
return [];
|
|
74
|
+
const agent = this.agents.get(note.tool_use_id);
|
|
75
|
+
if (!agent)
|
|
76
|
+
return [];
|
|
77
|
+
if (note.subtype === 'task_progress') {
|
|
78
|
+
const usage = note.usage;
|
|
79
|
+
if (usage && typeof usage.total_tokens === 'number')
|
|
80
|
+
agent.tokens = usage.total_tokens;
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
83
|
+
// A subagent Claude waited for ends with the call's result, which carries its answer.
|
|
84
|
+
if (note.subtype !== 'task_notification' || !agent.background)
|
|
85
|
+
return [];
|
|
86
|
+
if (note.status === 'completed')
|
|
87
|
+
return this.end(note.tool_use_id, { text: agent.text || (typeof note.summary === 'string' ? note.summary : '') });
|
|
88
|
+
const reason = typeof note.summary === 'string' && note.summary ? note.summary : `The subagent ${typeof note.status === 'string' ? note.status : 'stopped'}.`;
|
|
89
|
+
return this.end(note.tool_use_id, { text: '', error: reason, stopped: note.status === 'stopped' });
|
|
90
|
+
}
|
|
91
|
+
textOf(callId) {
|
|
92
|
+
const agent = this.agents.get(callId);
|
|
93
|
+
return agent ? agent.text : '';
|
|
94
|
+
}
|
|
95
|
+
end(callId, outcome) {
|
|
96
|
+
const agent = this.agents.get(callId);
|
|
97
|
+
if (!agent || agent.done)
|
|
98
|
+
return [];
|
|
99
|
+
agent.done = true;
|
|
100
|
+
const tokens = outcome.tokens ?? agent.tokens;
|
|
101
|
+
return [{ type: 'subagent_completed', id: callId, text: outcome.text, ...(tokens !== undefined ? { tokensUsed: tokens } : {}), ...(outcome.error ? { error: outcome.error } : {}), ...(outcome.stopped ? { stopped: true } : {}) }];
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function reportText(content) {
|
|
105
|
+
if (!Array.isArray(content))
|
|
106
|
+
return '';
|
|
107
|
+
return content
|
|
108
|
+
.flatMap((part) => {
|
|
109
|
+
const p = typeof part === 'object' && part !== null ? part : {};
|
|
110
|
+
return p.type === 'text' && typeof p.text === 'string' && p.text ? [p.text] : [];
|
|
111
|
+
})
|
|
112
|
+
.join('\n');
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=subagents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version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AAO,OAAO;SACX,OAAO,CAAC,CAAC,IAAa,EAAE,EAAE;QACzB,MAAM,CAAC,GAAG,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,CAAC,CAAC,CAAE,IAA2C,CAAC,CAAC,CAAC,EAAE,CAAC;QACxG,OAAO,CAAC,CAAC,IAAI,KAAK,MAAM,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACnF,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ListedStep } from '@moxxy/sdk';
|
|
2
|
+
/** Claude's tools that change its list of steps. `TodoWrite` is the older one, written whole each time. */
|
|
3
|
+
export declare const CLAUDE_STEP_TOOLS: ReadonlySet<string>;
|
|
4
|
+
/**
|
|
5
|
+
* Claude's task list for one of its sessions. Claude Code 2.1 keeps it with
|
|
6
|
+
* TaskCreate, TaskUpdate and TaskList, one task at a time, and the list lives
|
|
7
|
+
* on across turns, so it is kept here as the calls finish. Ids come from
|
|
8
|
+
* Claude (TaskCreate reports its new task's id).
|
|
9
|
+
*/
|
|
10
|
+
export declare class ClaudeTaskList {
|
|
11
|
+
private readonly tasks;
|
|
12
|
+
/**
|
|
13
|
+
* The whole list after a call that finished, or undefined when the call is
|
|
14
|
+
* not one of the step tools or says nothing Moxxy can follow (a task it never
|
|
15
|
+
* saw created, from before Moxxy started this Claude).
|
|
16
|
+
*/
|
|
17
|
+
apply(name: string, input: unknown, result: unknown): ListedStep[] | undefined;
|
|
18
|
+
private replace;
|
|
19
|
+
private list;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=task-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-list.d.ts","sourceRoot":"","sources":["../src/task-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAE3E,2GAA2G;AAC3G,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAkE,CAAC;AAErH;;;;;GAKG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiC;IAEvD;;;;OAIG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,UAAU,EAAE,GAAG,SAAS;IAqB9E,OAAO,CAAC,OAAO;IAYf,OAAO,CAAC,IAAI;CAGb"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { stepStatusOf, stepsFromTodos } from '@moxxy/sdk';
|
|
2
|
+
/** Claude's tools that change its list of steps. `TodoWrite` is the older one, written whole each time. */
|
|
3
|
+
export const CLAUDE_STEP_TOOLS = new Set(['TodoWrite', 'TaskCreate', 'TaskUpdate', 'TaskList']);
|
|
4
|
+
/**
|
|
5
|
+
* Claude's task list for one of its sessions. Claude Code 2.1 keeps it with
|
|
6
|
+
* TaskCreate, TaskUpdate and TaskList, one task at a time, and the list lives
|
|
7
|
+
* on across turns, so it is kept here as the calls finish. Ids come from
|
|
8
|
+
* Claude (TaskCreate reports its new task's id).
|
|
9
|
+
*/
|
|
10
|
+
export class ClaudeTaskList {
|
|
11
|
+
tasks = new Map();
|
|
12
|
+
/**
|
|
13
|
+
* The whole list after a call that finished, or undefined when the call is
|
|
14
|
+
* not one of the step tools or says nothing Moxxy can follow (a task it never
|
|
15
|
+
* saw created, from before Moxxy started this Claude).
|
|
16
|
+
*/
|
|
17
|
+
apply(name, input, result) {
|
|
18
|
+
if (name === 'TodoWrite')
|
|
19
|
+
return stepsFromTodos(field(input, 'todos'));
|
|
20
|
+
if (name === 'TaskList')
|
|
21
|
+
return this.replace(field(result, 'tasks'));
|
|
22
|
+
if (name === 'TaskCreate') {
|
|
23
|
+
const created = field(result, 'task');
|
|
24
|
+
const id = text(created, 'id');
|
|
25
|
+
const subject = text(created, 'subject') ?? text(input, 'subject');
|
|
26
|
+
if (id === undefined || subject === undefined)
|
|
27
|
+
return undefined;
|
|
28
|
+
this.tasks.set(id, { text: subject, status: 'pending' });
|
|
29
|
+
return this.list();
|
|
30
|
+
}
|
|
31
|
+
if (name !== 'TaskUpdate' || field(result, 'success') === false)
|
|
32
|
+
return undefined;
|
|
33
|
+
const id = text(input, 'taskId') ?? text(result, 'taskId');
|
|
34
|
+
const task = id === undefined ? undefined : this.tasks.get(id);
|
|
35
|
+
if (id === undefined || task === undefined)
|
|
36
|
+
return undefined;
|
|
37
|
+
const status = field(input, 'status');
|
|
38
|
+
if (status === 'deleted')
|
|
39
|
+
this.tasks.delete(id);
|
|
40
|
+
else
|
|
41
|
+
this.tasks.set(id, { text: text(input, 'subject') ?? task.text, status: stepStatusOf(status) ?? task.status });
|
|
42
|
+
return this.list();
|
|
43
|
+
}
|
|
44
|
+
replace(listed) {
|
|
45
|
+
if (!Array.isArray(listed))
|
|
46
|
+
return undefined;
|
|
47
|
+
this.tasks.clear();
|
|
48
|
+
for (const task of listed) {
|
|
49
|
+
const id = text(task, 'id');
|
|
50
|
+
const subject = text(task, 'subject');
|
|
51
|
+
const status = stepStatusOf(field(task, 'status'));
|
|
52
|
+
if (id !== undefined && subject !== undefined && status !== undefined)
|
|
53
|
+
this.tasks.set(id, { text: subject, status });
|
|
54
|
+
}
|
|
55
|
+
return this.list();
|
|
56
|
+
}
|
|
57
|
+
list() {
|
|
58
|
+
return [...this.tasks.values()];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function field(value, key) {
|
|
62
|
+
return typeof value === 'object' && value !== null ? value[key] : undefined;
|
|
63
|
+
}
|
|
64
|
+
function text(value, key) {
|
|
65
|
+
const found = field(value, key);
|
|
66
|
+
return typeof found === 'string' && found.trim() ? found.trim() : undefined;
|
|
67
|
+
}
|
|
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