agent-worker 0.17.0 → 0.19.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/README.md +49 -38
- package/dist/cli/index.mjs +208 -4320
- package/dist/client-DAKkzdOn.mjs +171 -0
- package/dist/daemon-CwaHgxs6.mjs +1071 -0
- package/dist/index.d.mts +249 -849
- package/dist/index.mjs +27 -1102
- package/dist/output-B0mwPqjv.mjs +20 -0
- package/dist/rolldown-runtime-wcPFST8Q.mjs +13 -0
- package/dist/target-9yiBRXxa.mjs +105 -0
- package/package.json +25 -37
- package/dist/backends-D7DT0uox.mjs +0 -1484
- package/dist/backends-DUvcm-ce.mjs +0 -3
- package/dist/context-CoRTddGx.mjs +0 -4
- package/dist/create-tool-gcUuI1FD.mjs +0 -32
- package/dist/display-pretty-Kyd40DEF.mjs +0 -190
- package/dist/memory-provider-Z9D8NdwS.mjs +0 -75
- package/dist/runner-BmT0Y8MD.mjs +0 -690
- package/dist/workflow-LOZUlaDo.mjs +0 -744
package/dist/index.d.mts
CHANGED
|
@@ -1,889 +1,289 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { Hono } from "hono";
|
|
2
|
+
import { AgentDefinition, AgentResponse, AgentWorker, AgentWorkerConfig, BackendType, CreateSkillToolOptions, Logger, ProviderConfig, ScheduleConfig, SendOptions, SendOptions as SendOptions$1, SessionState, SkillImporter, SkillToolkit, StepInfo, createSkillTool } from "@moniro/agent-loop";
|
|
3
|
+
import { ConversationLog, PersonalContextProvider, ThinThread } from "@moniro/agent-worker";
|
|
4
|
+
import { AgentInstruction, AgentLoop, EventKind, EventSink, Message, ParsedWorkflow, Workspace } from "@moniro/workspace";
|
|
4
5
|
|
|
5
|
-
//#region src/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
* Examples:
|
|
62
|
-
* provider: anthropic # string → built-in provider
|
|
63
|
-
* provider: # object → custom endpoint
|
|
64
|
-
* name: anthropic
|
|
65
|
-
* base_url: https://api.minimax.io/anthropic/v1
|
|
66
|
-
* api_key: $MINIMAX_API_KEY
|
|
67
|
-
*/
|
|
68
|
-
interface ProviderConfig {
|
|
69
|
-
/** Provider SDK name (e.g., 'anthropic', 'openai') */
|
|
70
|
-
name: string;
|
|
71
|
-
/** Override base URL for the provider */
|
|
72
|
-
base_url?: string;
|
|
73
|
-
/** API key — env var reference with '$' prefix (e.g., '$MINIMAX_API_KEY') or literal value */
|
|
74
|
-
api_key?: string;
|
|
75
|
-
}
|
|
76
|
-
//#endregion
|
|
77
|
-
//#region src/agent/types.d.ts
|
|
78
|
-
/**
|
|
79
|
-
* Message status for streaming/response tracking
|
|
80
|
-
*/
|
|
81
|
-
type MessageStatus = "responding" | "complete";
|
|
82
|
-
/**
|
|
83
|
-
* Extended message with status for tracking streaming state
|
|
84
|
-
*/
|
|
85
|
-
interface AgentMessage {
|
|
86
|
-
role: "user" | "assistant" | "system" | "tool";
|
|
87
|
-
content: string;
|
|
88
|
-
/** Message status - 'responding' while streaming, 'complete' when done */
|
|
89
|
-
status?: MessageStatus;
|
|
90
|
-
/** Timestamp when message started */
|
|
91
|
-
timestamp?: string;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Approval check — static boolean or dynamic function
|
|
95
|
-
*/
|
|
96
|
-
type ApprovalCheck = boolean | ((args: Record<string, unknown>) => boolean);
|
|
97
|
-
/**
|
|
98
|
-
* Tool info returned by getTools() — read-only view
|
|
99
|
-
*/
|
|
100
|
-
interface ToolInfo {
|
|
101
|
-
name: string;
|
|
102
|
-
description?: string;
|
|
103
|
-
needsApproval: boolean;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* A pending tool call awaiting user approval
|
|
107
|
-
*/
|
|
108
|
-
interface PendingApproval {
|
|
109
|
-
/** Unique approval ID */
|
|
110
|
-
id: string;
|
|
111
|
-
/** Tool name */
|
|
112
|
-
toolName: string;
|
|
113
|
-
/** Tool call ID from the model */
|
|
114
|
-
toolCallId: string;
|
|
115
|
-
/** Arguments passed to the tool */
|
|
116
|
-
arguments: Record<string, unknown>;
|
|
117
|
-
/** When the approval was requested */
|
|
118
|
-
requestedAt: string;
|
|
119
|
-
/** Current status */
|
|
120
|
-
status: "pending" | "approved" | "denied";
|
|
121
|
-
/** Denial reason if denied */
|
|
122
|
-
denyReason?: string;
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* A single tool call with its result
|
|
126
|
-
*/
|
|
127
|
-
interface ToolCall {
|
|
128
|
-
name: string;
|
|
129
|
-
arguments: Record<string, unknown>;
|
|
130
|
-
result: unknown;
|
|
131
|
-
timing: number;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Token usage statistics
|
|
135
|
-
*/
|
|
136
|
-
interface TokenUsage {
|
|
137
|
-
input: number;
|
|
138
|
-
output: number;
|
|
139
|
-
total: number;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Response from a single message exchange
|
|
143
|
-
*/
|
|
144
|
-
interface AgentResponse {
|
|
145
|
-
/** Final text content */
|
|
146
|
-
content: string;
|
|
147
|
-
/** All tool calls made during this turn */
|
|
148
|
-
toolCalls: ToolCall[];
|
|
149
|
-
/** Tool calls awaiting approval (response is incomplete until approved) */
|
|
150
|
-
pendingApprovals: PendingApproval[];
|
|
151
|
-
/** Token usage */
|
|
152
|
-
usage: TokenUsage;
|
|
153
|
-
/** Response latency in ms */
|
|
154
|
-
latency: number;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Session configuration
|
|
158
|
-
*/
|
|
159
|
-
interface SessionConfig {
|
|
160
|
-
/** Model identifier (e.g., 'openai/gpt-5.2' or 'anthropic:claude-sonnet-4-5') */
|
|
161
|
-
model: string;
|
|
162
|
-
/** System prompt */
|
|
163
|
-
system: string;
|
|
164
|
-
/** AI SDK tools — Record<name, tool()> */
|
|
165
|
-
tools?: Record<string, unknown>;
|
|
166
|
-
/** Per-tool approval config — Record<name, boolean | (args) => boolean> */
|
|
167
|
-
approval?: Record<string, ApprovalCheck>;
|
|
168
|
-
/** Maximum tokens for response (default: 4096) */
|
|
169
|
-
maxTokens?: number;
|
|
170
|
-
/** Maximum tool call steps per turn (default: 200) */
|
|
171
|
-
maxSteps?: number;
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Persisted session state for restoration
|
|
175
|
-
*/
|
|
176
|
-
interface SessionState {
|
|
177
|
-
/** Session ID to restore */
|
|
178
|
-
id: string;
|
|
179
|
-
/** Creation timestamp */
|
|
180
|
-
createdAt: string;
|
|
181
|
-
/** Conversation messages with status */
|
|
182
|
-
messages: AgentMessage[];
|
|
183
|
-
/** Accumulated token usage */
|
|
184
|
-
totalUsage: TokenUsage;
|
|
185
|
-
/** Pending tool approvals */
|
|
186
|
-
pendingApprovals: PendingApproval[];
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Exported transcript for analysis
|
|
190
|
-
*/
|
|
191
|
-
interface Transcript {
|
|
192
|
-
sessionId: string;
|
|
193
|
-
model: string;
|
|
194
|
-
system: string;
|
|
195
|
-
messages: AgentMessage[];
|
|
196
|
-
totalUsage: TokenUsage;
|
|
197
|
-
createdAt: string;
|
|
198
|
-
}
|
|
199
|
-
//#endregion
|
|
200
|
-
//#region src/agent/worker.d.ts
|
|
201
|
-
/**
|
|
202
|
-
* Extended worker config that supports both SDK and CLI backends.
|
|
203
|
-
* When a backend is provided, send() delegates to it instead of ToolLoopAgent.
|
|
204
|
-
* This enables unified worker management regardless of backend type.
|
|
205
|
-
*/
|
|
206
|
-
interface AgentWorkerConfig extends SessionConfig {
|
|
207
|
-
/** CLI backend - when provided, send() delegates to this backend */
|
|
208
|
-
backend?: Backend;
|
|
209
|
-
/** Provider configuration — when set, model is resolved via createModelWithProvider */
|
|
210
|
-
provider?: string | ProviderConfig;
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* Step finish callback info
|
|
214
|
-
*/
|
|
215
|
-
interface StepInfo {
|
|
216
|
-
stepNumber: number;
|
|
217
|
-
toolCalls: ToolCall[];
|
|
218
|
-
usage: TokenUsage;
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Options for send() method
|
|
222
|
-
*/
|
|
223
|
-
interface SendOptions {
|
|
224
|
-
/** Auto-approve all tool calls that require approval (default: true) */
|
|
225
|
-
autoApprove?: boolean;
|
|
226
|
-
/** Callback after each agent step */
|
|
227
|
-
onStepFinish?: (info: StepInfo) => void | Promise<void>;
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* AgentWorker - Stateful worker for controlled agent execution
|
|
231
|
-
*
|
|
232
|
-
* Uses ToolLoopAgent internally for multi-step reasoning loops.
|
|
233
|
-
* Maintains conversation state across multiple send() calls,
|
|
234
|
-
* enabling improvisational testing where you observe responses
|
|
235
|
-
* and decide next actions.
|
|
236
|
-
*
|
|
237
|
-
* Tools are AI SDK tool() objects passed as Record<name, tool()>.
|
|
238
|
-
* Approval is configured separately via Record<name, check>.
|
|
239
|
-
*/
|
|
240
|
-
declare class AgentWorker {
|
|
241
|
-
readonly id: string;
|
|
242
|
-
readonly model: string;
|
|
243
|
-
readonly system: string;
|
|
244
|
-
readonly createdAt: string;
|
|
245
|
-
private tools;
|
|
246
|
-
private approval;
|
|
247
|
-
private maxTokens;
|
|
248
|
-
private maxSteps;
|
|
249
|
-
private messages;
|
|
250
|
-
private totalUsage;
|
|
251
|
-
private pendingApprovals;
|
|
252
|
-
private backend;
|
|
253
|
-
private provider;
|
|
254
|
-
private cachedAgent;
|
|
255
|
-
private toolsChanged;
|
|
256
|
-
/**
|
|
257
|
-
* Whether this session supports tool management (SDK backend only)
|
|
258
|
-
*/
|
|
259
|
-
get supportsTools(): boolean;
|
|
260
|
-
/**
|
|
261
|
-
* Convert AgentMessage[] to ModelMessage[] for AI SDK
|
|
262
|
-
*/
|
|
263
|
-
private toModelMessages;
|
|
264
|
-
constructor(config: AgentWorkerConfig, restore?: SessionState);
|
|
265
|
-
/**
|
|
266
|
-
* Check if a tool needs approval for given arguments
|
|
267
|
-
*/
|
|
268
|
-
private checkApproval;
|
|
269
|
-
/**
|
|
270
|
-
* Build tools with approval wrapping for ToolLoopAgent
|
|
271
|
-
*/
|
|
272
|
-
private buildTools;
|
|
273
|
-
/**
|
|
274
|
-
* Get or create cached agent, rebuild if tools changed
|
|
275
|
-
*/
|
|
276
|
-
private getAgent;
|
|
277
|
-
/**
|
|
278
|
-
* Send a message via CLI backend (non-SDK path)
|
|
279
|
-
*/
|
|
280
|
-
private sendViaBackend;
|
|
6
|
+
//#region src/agent/agent-handle.d.ts
|
|
7
|
+
type AgentHandleState = "idle" | "running" | "stopped" | "error";
|
|
8
|
+
declare class AgentHandle implements PersonalContextProvider {
|
|
9
|
+
/** Agent definition (from YAML or API) */
|
|
10
|
+
readonly definition: AgentDefinition;
|
|
11
|
+
/** Absolute path to agent's persistent context directory */
|
|
12
|
+
readonly contextDir: string;
|
|
13
|
+
/**
|
|
14
|
+
* Whether this agent is ephemeral (in-memory only).
|
|
15
|
+
* Ephemeral agents are created via the daemon API (POST /agents) and
|
|
16
|
+
* lost on daemon restart. Config agents are defined in config.yml.
|
|
17
|
+
*/
|
|
18
|
+
readonly ephemeral: boolean;
|
|
19
|
+
/** Current agent state */
|
|
20
|
+
state: AgentHandleState;
|
|
21
|
+
/** The agent's execution loop (lazy — created on first run/serve) */
|
|
22
|
+
loop: AgentLoop | null;
|
|
23
|
+
/** Conversation log (lazy — created on first access) */
|
|
24
|
+
private _conversationLog?;
|
|
25
|
+
/** Thin thread (lazy — created on first access) */
|
|
26
|
+
private _thinThread?;
|
|
27
|
+
/** Optional logger (injected by registry; absent in standalone CLI) */
|
|
28
|
+
private log?;
|
|
29
|
+
constructor(definition: AgentDefinition, contextDir: string, logger?: Logger, ephemeral?: boolean);
|
|
30
|
+
/** Agent name (convenience accessor) */
|
|
31
|
+
get name(): string;
|
|
32
|
+
/**
|
|
33
|
+
* Get the conversation log (JSONL persistence).
|
|
34
|
+
* Returns null for ephemeral agents (no disk).
|
|
35
|
+
* Lazy — created on first access.
|
|
36
|
+
*/
|
|
37
|
+
get conversationLog(): ConversationLog | null;
|
|
38
|
+
/**
|
|
39
|
+
* Get the thin thread (bounded in-memory conversation buffer).
|
|
40
|
+
* Restores from ConversationLog on first access if history exists.
|
|
41
|
+
* Lazy — created on first access.
|
|
42
|
+
*/
|
|
43
|
+
get thinThread(): ThinThread;
|
|
44
|
+
/**
|
|
45
|
+
* Send a typed instruction to this agent's loop.
|
|
46
|
+
*
|
|
47
|
+
* Convenience method that creates an AgentInstruction and enqueues it.
|
|
48
|
+
* The loop must exist (call ensureAgentLoop first for standalone agents).
|
|
49
|
+
*
|
|
50
|
+
* @throws if no loop is attached
|
|
51
|
+
*/
|
|
52
|
+
send(instruction: AgentInstruction): void;
|
|
53
|
+
/**
|
|
54
|
+
* Send a simple message with auto-classified priority.
|
|
55
|
+
*
|
|
56
|
+
* Shorthand for creating an AgentInstruction from a raw message string.
|
|
57
|
+
*/
|
|
58
|
+
sendMessage(message: string, options?: {
|
|
59
|
+
priority?: AgentInstruction["priority"];
|
|
60
|
+
source?: AgentInstruction["source"];
|
|
61
|
+
}): void;
|
|
281
62
|
/**
|
|
282
|
-
*
|
|
63
|
+
* Ensure the context directory and all subdirectories exist.
|
|
64
|
+
* Called on agent load/creation. Idempotent.
|
|
283
65
|
*/
|
|
284
|
-
|
|
66
|
+
ensureContextDir(): void;
|
|
285
67
|
/**
|
|
286
|
-
*
|
|
68
|
+
* Read all memory entries as key-value records.
|
|
69
|
+
* Memory files are YAML in memory/<key>.yaml.
|
|
287
70
|
*/
|
|
288
|
-
|
|
71
|
+
readMemory(): Promise<Record<string, unknown>>;
|
|
289
72
|
/**
|
|
290
|
-
*
|
|
291
|
-
* Only supported for SDK backends (ToolLoopAgent)
|
|
73
|
+
* Write a memory entry. Creates/overwrites memory/<key>.yaml.
|
|
292
74
|
*/
|
|
293
|
-
|
|
75
|
+
writeMemory(key: string, value: unknown): Promise<void>;
|
|
294
76
|
/**
|
|
295
|
-
*
|
|
77
|
+
* Read agent's notes, most recent first.
|
|
78
|
+
* Notes are markdown files in notes/.
|
|
296
79
|
*/
|
|
297
|
-
|
|
80
|
+
readNotes(limit?: number): Promise<string[]>;
|
|
298
81
|
/**
|
|
299
|
-
*
|
|
82
|
+
* Append a note. Creates notes/<date>-<slug>.md.
|
|
300
83
|
*/
|
|
301
|
-
|
|
84
|
+
appendNote(content: string, slug?: string): Promise<string>;
|
|
302
85
|
/**
|
|
303
|
-
*
|
|
86
|
+
* Read active todos from todo/index.md.
|
|
87
|
+
* Returns lines that look like incomplete tasks: "- [ ] ..."
|
|
304
88
|
*/
|
|
305
|
-
|
|
89
|
+
readTodos(): Promise<string[]>;
|
|
306
90
|
/**
|
|
307
|
-
*
|
|
91
|
+
* Write the full todo list. Replaces todo/index.md.
|
|
308
92
|
*/
|
|
309
|
-
|
|
310
|
-
history(): AgentMessage[];
|
|
311
|
-
stats(): {
|
|
312
|
-
messageCount: number;
|
|
313
|
-
usage: TokenUsage;
|
|
314
|
-
};
|
|
315
|
-
export(): Transcript;
|
|
316
|
-
getState(): SessionState;
|
|
317
|
-
getPendingApprovals(): PendingApproval[];
|
|
318
|
-
approve(approvalId: string): Promise<unknown>;
|
|
319
|
-
deny(approvalId: string, reason?: string): void;
|
|
320
|
-
clear(): void;
|
|
93
|
+
writeTodos(todos: string[]): Promise<void>;
|
|
321
94
|
}
|
|
322
95
|
//#endregion
|
|
323
|
-
//#region src/agent/
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
/**
|
|
348
|
-
|
|
349
|
-
*/
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
* Always verify model availability with the provider before production use.
|
|
358
|
-
*/
|
|
359
|
-
declare const FRONTIER_MODELS: {
|
|
360
|
-
readonly anthropic: readonly ["claude-sonnet-4-5", "claude-haiku-4-5", "claude-opus-4-5"];
|
|
361
|
-
readonly openai: readonly ["gpt-5.2", "gpt-5.2-codex"];
|
|
362
|
-
readonly google: readonly ["gemini-3-pro-preview", "gemini-2.5-flash", "gemini-2.5-pro"];
|
|
363
|
-
readonly deepseek: readonly ["deepseek-chat", "deepseek-reasoner"];
|
|
364
|
-
readonly groq: readonly ["meta-llama/llama-4-scout-17b-16e-instruct", "deepseek-r1-distill-llama-70b"];
|
|
365
|
-
readonly mistral: readonly ["mistral-large-latest", "pixtral-large-latest", "magistral-medium-2506"];
|
|
366
|
-
readonly xai: readonly ["grok-4", "grok-4-fast-reasoning"];
|
|
367
|
-
};
|
|
368
|
-
//#endregion
|
|
369
|
-
//#region src/agent/tools/bash.d.ts
|
|
370
|
-
/**
|
|
371
|
-
* Options for creating bash tools compatible with AgentWorker
|
|
372
|
-
*/
|
|
373
|
-
interface BashToolsOptions extends CreateBashToolOptions {
|
|
374
|
-
/**
|
|
375
|
-
* Include readFile tool (default: true)
|
|
376
|
-
*/
|
|
377
|
-
includeReadFile?: boolean;
|
|
378
|
-
/**
|
|
379
|
-
* Include writeFile tool (default: true)
|
|
380
|
-
*/
|
|
381
|
-
includeWriteFile?: boolean;
|
|
96
|
+
//#region src/agent/agent-registry.d.ts
|
|
97
|
+
declare class AgentRegistry {
|
|
98
|
+
/** Loaded agent handles, keyed by name */
|
|
99
|
+
private agents;
|
|
100
|
+
/** Workspace root directory (e.g. ~/.agent-worker/ for global) */
|
|
101
|
+
readonly projectDir: string;
|
|
102
|
+
/** Optional logger (injected by daemon) */
|
|
103
|
+
private log?;
|
|
104
|
+
constructor(projectDir: string, logger?: Logger);
|
|
105
|
+
/**
|
|
106
|
+
* Register a config agent (from config.yml). Creates context dir on disk.
|
|
107
|
+
* Overwrites existing agent with same name (reload semantics).
|
|
108
|
+
*/
|
|
109
|
+
registerDefinition(def: AgentDefinition): AgentHandle;
|
|
110
|
+
/**
|
|
111
|
+
* Register an ephemeral agent (from daemon API).
|
|
112
|
+
* Exists only in memory, lost on restart.
|
|
113
|
+
*/
|
|
114
|
+
registerEphemeral(def: AgentDefinition): AgentHandle;
|
|
115
|
+
/**
|
|
116
|
+
* Unregister an agent from memory.
|
|
117
|
+
* @returns true if agent existed and was removed.
|
|
118
|
+
*/
|
|
119
|
+
delete(name: string): boolean;
|
|
120
|
+
/** Get agent handle by name */
|
|
121
|
+
get(name: string): AgentHandle | undefined;
|
|
122
|
+
/** Check if agent exists */
|
|
123
|
+
has(name: string): boolean;
|
|
124
|
+
/** List all registered agent handles */
|
|
125
|
+
list(): AgentHandle[];
|
|
126
|
+
/** Number of registered agents */
|
|
127
|
+
get size(): number;
|
|
128
|
+
/** Resolve agent's context directory (absolute path) */
|
|
129
|
+
private resolveContextDir;
|
|
382
130
|
}
|
|
383
|
-
/**
|
|
384
|
-
* Create bash tools as AI SDK tool() objects for use with AgentWorker
|
|
385
|
-
*
|
|
386
|
-
* @example
|
|
387
|
-
* ```typescript
|
|
388
|
-
* const { tools } = await createBashTools({
|
|
389
|
-
* files: { 'src/index.ts': 'console.log("hello")' }
|
|
390
|
-
* })
|
|
391
|
-
*
|
|
392
|
-
* const session = new AgentWorker({
|
|
393
|
-
* model: 'anthropic/claude-sonnet-4-5',
|
|
394
|
-
* system: 'You are a coding assistant.',
|
|
395
|
-
* tools
|
|
396
|
-
* })
|
|
397
|
-
* ```
|
|
398
|
-
*/
|
|
399
|
-
declare function createBashTools(options?: BashToolsOptions): Promise<{
|
|
400
|
-
tools: Record<string, unknown>;
|
|
401
|
-
toolkit: BashToolkit;
|
|
402
|
-
}>;
|
|
403
|
-
/**
|
|
404
|
-
* Quick helper to create bash tools with a directory
|
|
405
|
-
*/
|
|
406
|
-
declare function createBashToolsFromDirectory(source: string, options?: Omit<BashToolsOptions, "uploadDirectory">): Promise<{
|
|
407
|
-
tools: Record<string, unknown>;
|
|
408
|
-
toolkit: BashToolkit;
|
|
409
|
-
}>;
|
|
410
|
-
/**
|
|
411
|
-
* Quick helper to create bash tools with inline files
|
|
412
|
-
*/
|
|
413
|
-
declare function createBashToolsFromFiles(files: Record<string, string>, options?: Omit<BashToolsOptions, "files">): Promise<{
|
|
414
|
-
tools: Record<string, unknown>;
|
|
415
|
-
toolkit: BashToolkit;
|
|
416
|
-
}>;
|
|
417
131
|
//#endregion
|
|
418
|
-
//#region src/agent/
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
* @example
|
|
427
|
-
* ```typescript
|
|
428
|
-
* const { tool, getFeedback } = createFeedbackTool();
|
|
429
|
-
*
|
|
430
|
-
* const session = new AgentWorker({
|
|
431
|
-
* model: 'anthropic/claude-sonnet-4-5',
|
|
432
|
-
* system: FEEDBACK_PROMPT + '\nYou are a coding assistant.',
|
|
433
|
-
* tools: { feedback: tool, bash: bashTool },
|
|
434
|
-
* });
|
|
435
|
-
*
|
|
436
|
-
* await session.send('...');
|
|
437
|
-
* console.log(getFeedback()); // review what the agent reported
|
|
438
|
-
* ```
|
|
439
|
-
*/
|
|
440
|
-
interface FeedbackEntry {
|
|
441
|
-
/** ISO timestamp */
|
|
442
|
-
timestamp: string;
|
|
443
|
-
/** What area this is about — a tool name, workflow step, etc. */
|
|
444
|
-
target: string;
|
|
445
|
-
/** Category */
|
|
446
|
-
type: "missing" | "friction" | "suggestion";
|
|
447
|
-
/** What the agent needed or what could be improved */
|
|
448
|
-
description: string;
|
|
449
|
-
/** Optional: what the agent was trying to do */
|
|
450
|
-
context?: string;
|
|
451
|
-
}
|
|
452
|
-
interface FeedbackToolOptions {
|
|
453
|
-
/** Called each time the agent submits feedback */
|
|
454
|
-
onFeedback?: (entry: FeedbackEntry) => void;
|
|
455
|
-
/** Maximum entries to keep (default: 50) */
|
|
456
|
-
maxEntries?: number;
|
|
457
|
-
}
|
|
458
|
-
interface FeedbackToolResult {
|
|
459
|
-
/** AI SDK tool() object — pass to AgentWorker as a tool */
|
|
460
|
-
tool: unknown;
|
|
461
|
-
/** Retrieve all collected feedback entries */
|
|
462
|
-
getFeedback(): FeedbackEntry[];
|
|
463
|
-
/** Clear collected feedback */
|
|
464
|
-
clearFeedback(): void;
|
|
132
|
+
//#region src/agent/store.d.ts
|
|
133
|
+
interface StateStore {
|
|
134
|
+
/** Load conversation state for an agent. Returns null if no state exists. */
|
|
135
|
+
load(agentId: string): Promise<SessionState | null>;
|
|
136
|
+
/** Save conversation state for an agent. */
|
|
137
|
+
save(agentId: string, state: SessionState): Promise<void>;
|
|
138
|
+
/** Delete conversation state for an agent. */
|
|
139
|
+
delete(agentId: string): Promise<void>;
|
|
465
140
|
}
|
|
466
141
|
/**
|
|
467
|
-
*
|
|
468
|
-
*
|
|
142
|
+
* In-memory state store. State is lost when the daemon stops.
|
|
143
|
+
* Suitable for development and single-machine deployments.
|
|
469
144
|
*/
|
|
470
|
-
declare
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
interface StreamParserCallbacks {
|
|
476
|
-
/** Debug-level messages (kind="debug") */
|
|
477
|
-
debugLog: (message: string) => void;
|
|
478
|
-
/** Text output from backend (kind="output") — assistant/user messages */
|
|
479
|
-
outputLog?: (message: string) => void;
|
|
480
|
-
/** Backend native tool call (kind="tool_call", source="backend") */
|
|
481
|
-
toolCallLog?: (name: string, args: string) => void;
|
|
482
|
-
/** MCP tool names to skip (already logged by MCP server) */
|
|
483
|
-
mcpToolNames?: Set<string>;
|
|
145
|
+
declare class MemoryStateStore implements StateStore {
|
|
146
|
+
private states;
|
|
147
|
+
load(agentId: string): Promise<SessionState | null>;
|
|
148
|
+
save(agentId: string, state: SessionState): Promise<void>;
|
|
149
|
+
delete(agentId: string): Promise<void>;
|
|
484
150
|
}
|
|
485
151
|
//#endregion
|
|
486
|
-
//#region src/
|
|
487
|
-
interface
|
|
488
|
-
/**
|
|
489
|
-
|
|
490
|
-
/**
|
|
491
|
-
|
|
492
|
-
/** Allowed tools (permission rule syntax) */
|
|
493
|
-
allowedTools?: string[];
|
|
494
|
-
/** Output format: 'text' | 'json' | 'stream-json' */
|
|
495
|
-
outputFormat?: "text" | "json" | "stream-json";
|
|
496
|
-
/** Continue most recent conversation */
|
|
497
|
-
continue?: boolean;
|
|
498
|
-
/** Resume specific session by ID */
|
|
499
|
-
resume?: string;
|
|
500
|
-
/** Working directory (defaults to workspace if set) */
|
|
501
|
-
cwd?: string;
|
|
502
|
-
/** Workspace directory for agent isolation */
|
|
503
|
-
workspace?: string;
|
|
504
|
-
/** Idle timeout in milliseconds — kills process if no output for this duration */
|
|
505
|
-
timeout?: number;
|
|
506
|
-
/** MCP config file path (for workflow context) */
|
|
507
|
-
mcpConfigPath?: string;
|
|
508
|
-
/** Stream parser callbacks (structured event output) */
|
|
509
|
-
streamCallbacks?: StreamParserCallbacks;
|
|
510
|
-
}
|
|
511
|
-
declare class ClaudeCodeBackend implements Backend {
|
|
512
|
-
readonly type: "claude";
|
|
513
|
-
private options;
|
|
514
|
-
private currentAbort?;
|
|
515
|
-
constructor(options?: ClaudeCodeOptions);
|
|
516
|
-
send(message: string, options?: {
|
|
517
|
-
system?: string;
|
|
518
|
-
}): Promise<BackendResponse>;
|
|
519
|
-
isAvailable(): Promise<boolean>;
|
|
520
|
-
getInfo(): {
|
|
521
|
-
name: string;
|
|
522
|
-
version?: string;
|
|
523
|
-
model?: string;
|
|
524
|
-
};
|
|
525
|
-
private buildArgs;
|
|
526
|
-
/**
|
|
527
|
-
* Abort any running claude process
|
|
528
|
-
*/
|
|
529
|
-
abort(): void;
|
|
152
|
+
//#region src/daemon/serve.d.ts
|
|
153
|
+
interface ServerHandle {
|
|
154
|
+
/** Actual port the server is listening on */
|
|
155
|
+
port: number;
|
|
156
|
+
/** Gracefully close the server */
|
|
157
|
+
close(): Promise<void>;
|
|
530
158
|
}
|
|
531
159
|
//#endregion
|
|
532
|
-
//#region src/
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
/**
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
}
|
|
576
|
-
declare class CursorBackend implements Backend {
|
|
577
|
-
readonly type: "cursor";
|
|
578
|
-
private options;
|
|
579
|
-
/**
|
|
580
|
-
* Resolved command style:
|
|
581
|
-
* - "subcommand": `cursor agent -p ...` (IDE-bundled CLI)
|
|
582
|
-
* - "direct": `agent -p ...` (standalone install via cursor.com/install)
|
|
583
|
-
* - null: not yet resolved
|
|
584
|
-
*/
|
|
585
|
-
private resolvedStyle;
|
|
586
|
-
constructor(options?: CursorOptions);
|
|
587
|
-
send(message: string, _options?: {
|
|
588
|
-
system?: string;
|
|
589
|
-
}): Promise<BackendResponse>;
|
|
590
|
-
isAvailable(): Promise<boolean>;
|
|
591
|
-
getInfo(): {
|
|
592
|
-
name: string;
|
|
593
|
-
version?: string;
|
|
594
|
-
model?: string;
|
|
595
|
-
};
|
|
596
|
-
/**
|
|
597
|
-
* Resolve which cursor command style is available.
|
|
598
|
-
* Tries in order:
|
|
599
|
-
* 1. `cursor agent --version` — IDE-bundled CLI (subcommand style)
|
|
600
|
-
* 2. `agent --version` — standalone install via cursor.com/install (direct style)
|
|
601
|
-
* Result is cached after first resolution.
|
|
602
|
-
*/
|
|
603
|
-
private resolveStyle;
|
|
604
|
-
protected buildCommand(message: string): Promise<{
|
|
605
|
-
command: string;
|
|
606
|
-
args: string[];
|
|
607
|
-
}>;
|
|
608
|
-
}
|
|
609
|
-
//#endregion
|
|
610
|
-
//#region src/backends/opencode.d.ts
|
|
611
|
-
interface OpenCodeOptions {
|
|
612
|
-
/** Model to use in provider/model format (e.g., 'deepseek/deepseek-chat') */
|
|
613
|
-
model?: string;
|
|
614
|
-
/** Working directory (defaults to workspace if set) */
|
|
615
|
-
cwd?: string;
|
|
616
|
-
/** Workspace directory for agent isolation */
|
|
617
|
-
workspace?: string;
|
|
618
|
-
/** Idle timeout in milliseconds — kills process if no output for this duration */
|
|
619
|
-
timeout?: number;
|
|
620
|
-
/** Stream parser callbacks (structured event output) */
|
|
621
|
-
streamCallbacks?: StreamParserCallbacks;
|
|
622
|
-
}
|
|
160
|
+
//#region src/daemon/daemon.d.ts
|
|
161
|
+
/** Handle for a running workflow managed by the daemon */
|
|
162
|
+
interface WorkflowHandle {
|
|
163
|
+
/** Workflow name (from YAML name field or filename) */
|
|
164
|
+
name: string;
|
|
165
|
+
/** Workspace instance tag (optional) */
|
|
166
|
+
tag?: string;
|
|
167
|
+
/** Key for lookup: "name:tag" */
|
|
168
|
+
key: string;
|
|
169
|
+
/** Agent names in this workflow */
|
|
170
|
+
agents: string[];
|
|
171
|
+
/** Agent loops for lifecycle management */
|
|
172
|
+
loops: Map<string, AgentLoop>;
|
|
173
|
+
/** Workspace providing shared infrastructure */
|
|
174
|
+
workspace: Workspace;
|
|
175
|
+
/** Shutdown function (stops loops + cleans context) */
|
|
176
|
+
shutdown: () => Promise<void>;
|
|
177
|
+
/** Original workflow file path (for display) */
|
|
178
|
+
workflowPath?: string;
|
|
179
|
+
/** When this workflow was started */
|
|
180
|
+
startedAt: string;
|
|
181
|
+
}
|
|
182
|
+
interface DaemonState {
|
|
183
|
+
/** Agent registry — manages agent handles (definition + loop + state) */
|
|
184
|
+
agents: AgentRegistry;
|
|
185
|
+
/** Default workspace — shared by all standalone agents */
|
|
186
|
+
defaultWorkspace: Workspace | null;
|
|
187
|
+
/** Parsed config from config.yml (workflow format) */
|
|
188
|
+
config: ParsedWorkflow | null;
|
|
189
|
+
/** Running workflows — keyed by "name:tag" */
|
|
190
|
+
workflows: Map<string, WorkflowHandle>;
|
|
191
|
+
/** State store — conversation persistence (pluggable) */
|
|
192
|
+
store: StateStore;
|
|
193
|
+
/** HTTP server handle (optional — missing when app is used without server) */
|
|
194
|
+
server?: ServerHandle;
|
|
195
|
+
port: number;
|
|
196
|
+
host: string;
|
|
197
|
+
startedAt: string;
|
|
198
|
+
}
|
|
199
|
+
declare function startDaemon(config?: {
|
|
200
|
+
port?: number;
|
|
201
|
+
host?: string;
|
|
202
|
+
store?: StateStore;
|
|
203
|
+
}): Promise<void>;
|
|
623
204
|
//#endregion
|
|
624
|
-
//#region src/
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
}): Promise<BackendResponse>;
|
|
643
|
-
isAvailable(): Promise<boolean>;
|
|
644
|
-
getInfo(): {
|
|
645
|
-
name: string;
|
|
646
|
-
version?: string;
|
|
647
|
-
model?: string;
|
|
648
|
-
};
|
|
649
|
-
}
|
|
205
|
+
//#region src/daemon/registry.d.ts
|
|
206
|
+
declare const DEFAULT_PORT = 5099;
|
|
207
|
+
interface DaemonInfo {
|
|
208
|
+
pid: number;
|
|
209
|
+
host: string;
|
|
210
|
+
port: number;
|
|
211
|
+
startedAt: string;
|
|
212
|
+
/** Auth token for API access (random per daemon instance) */
|
|
213
|
+
token?: string;
|
|
214
|
+
}
|
|
215
|
+
/** Write daemon.json for client discovery */
|
|
216
|
+
declare function writeDaemonInfo(info: DaemonInfo): void;
|
|
217
|
+
/** Read daemon.json. Returns null if missing or malformed. */
|
|
218
|
+
declare function readDaemonInfo(): DaemonInfo | null;
|
|
219
|
+
/** Remove daemon.json (on shutdown) */
|
|
220
|
+
declare function removeDaemonInfo(): void;
|
|
221
|
+
/** Check if a daemon is already running (daemon.json exists + PID alive) */
|
|
222
|
+
declare function isDaemonRunning(): DaemonInfo | null;
|
|
650
223
|
//#endregion
|
|
651
|
-
//#region src/
|
|
224
|
+
//#region src/daemon/event-log.d.ts
|
|
652
225
|
/**
|
|
653
|
-
*
|
|
654
|
-
*
|
|
655
|
-
* In single-agent mode, provides a simple echo send().
|
|
656
|
-
* In workflow mode, the loop handles MCP tool orchestration
|
|
657
|
-
* via the mock runner strategy (loop/mock-runner.ts).
|
|
226
|
+
* Append-only JSONL event log for daemon-level events.
|
|
227
|
+
* Uses synchronous writes — daemon events are infrequent and must not be lost.
|
|
658
228
|
*/
|
|
659
|
-
declare class
|
|
660
|
-
private
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
system?: string;
|
|
665
|
-
}): Promise<BackendResponse>;
|
|
666
|
-
}
|
|
667
|
-
/**
|
|
668
|
-
* Create a mock AI backend
|
|
669
|
-
*/
|
|
670
|
-
declare function createMockBackend(debugLog?: (msg: string) => void): Backend;
|
|
671
|
-
//#endregion
|
|
672
|
-
//#region src/backends/index.d.ts
|
|
673
|
-
type BackendOptions = {
|
|
674
|
-
type: "default";
|
|
675
|
-
model?: string;
|
|
676
|
-
maxTokens?: number;
|
|
677
|
-
provider?: string | ProviderConfig;
|
|
678
|
-
} | {
|
|
679
|
-
type: "claude";
|
|
680
|
-
model?: string;
|
|
681
|
-
options?: Omit<ClaudeCodeOptions, "model">;
|
|
682
|
-
} | {
|
|
683
|
-
type: "codex";
|
|
684
|
-
model?: string;
|
|
685
|
-
options?: Omit<CodexOptions, "model">;
|
|
686
|
-
} | {
|
|
687
|
-
type: "cursor";
|
|
688
|
-
model?: string;
|
|
689
|
-
options?: Omit<CursorOptions, "model">;
|
|
690
|
-
} | {
|
|
691
|
-
type: "opencode";
|
|
692
|
-
model?: string;
|
|
693
|
-
options?: Omit<OpenCodeOptions, "model">;
|
|
694
|
-
};
|
|
695
|
-
/**
|
|
696
|
-
* Create a backend instance
|
|
697
|
-
* Model names are automatically translated to backend-specific format
|
|
698
|
-
* Accepts "sdk" as deprecated alias for "default"
|
|
699
|
-
*
|
|
700
|
-
* Examples:
|
|
701
|
-
* - "sonnet" → cursor: "sonnet-4.5", claude: "sonnet", default: "claude-sonnet-4-5-20250514"
|
|
702
|
-
* - "anthropic/claude-sonnet-4-5" → cursor: "sonnet-4.5", claude: "sonnet"
|
|
703
|
-
*/
|
|
704
|
-
declare function createBackend(config: BackendOptions | {
|
|
705
|
-
type: "sdk";
|
|
706
|
-
model?: string;
|
|
707
|
-
maxTokens?: number;
|
|
708
|
-
}): Backend;
|
|
709
|
-
/**
|
|
710
|
-
* Check which backends are available
|
|
711
|
-
*/
|
|
712
|
-
declare function checkBackends(): Promise<Record<BackendType, boolean>>;
|
|
713
|
-
/**
|
|
714
|
-
* List available backends with info
|
|
715
|
-
*/
|
|
716
|
-
declare function listBackends(): Promise<Array<{
|
|
717
|
-
type: BackendType;
|
|
718
|
-
available: boolean;
|
|
719
|
-
name: string;
|
|
720
|
-
}>>;
|
|
721
|
-
//#endregion
|
|
722
|
-
//#region src/agent/skills/provider.d.ts
|
|
723
|
-
interface SkillMetadata {
|
|
724
|
-
name: string;
|
|
725
|
-
description: string;
|
|
726
|
-
path: string;
|
|
727
|
-
}
|
|
728
|
-
declare class SkillsProvider {
|
|
729
|
-
private skills;
|
|
730
|
-
/**
|
|
731
|
-
* Add a single skill directory
|
|
732
|
-
*/
|
|
733
|
-
addSkill(skillPath: string): Promise<void>;
|
|
734
|
-
/**
|
|
735
|
-
* Scan a directory and add all valid skills found
|
|
736
|
-
*/
|
|
737
|
-
scanDirectory(dir: string): Promise<void>;
|
|
738
|
-
/**
|
|
739
|
-
* List all available skills (metadata only)
|
|
740
|
-
*/
|
|
741
|
-
list(): Array<{
|
|
742
|
-
name: string;
|
|
743
|
-
description: string;
|
|
744
|
-
}>;
|
|
745
|
-
/**
|
|
746
|
-
* View the full SKILL.md content
|
|
747
|
-
*/
|
|
748
|
-
view(skillName: string): Promise<string>;
|
|
749
|
-
/**
|
|
750
|
-
* Read a file within a skill directory (relative path)
|
|
751
|
-
*/
|
|
752
|
-
readFile(skillName: string, relativePath: string): Promise<string>;
|
|
753
|
-
/**
|
|
754
|
-
* Parse YAML frontmatter from SKILL.md
|
|
755
|
-
*/
|
|
756
|
-
private parseFrontmatter;
|
|
757
|
-
/**
|
|
758
|
-
* Resolve tilde and relative paths
|
|
759
|
-
*/
|
|
760
|
-
private resolvePath;
|
|
761
|
-
/**
|
|
762
|
-
* Synchronous version: Add a single skill directory
|
|
763
|
-
*/
|
|
764
|
-
addSkillSync(skillPath: string): void;
|
|
765
|
-
/**
|
|
766
|
-
* Synchronous version: Scan a directory and add all valid skills found
|
|
767
|
-
*/
|
|
768
|
-
scanDirectorySync(dir: string): void;
|
|
769
|
-
/**
|
|
770
|
-
* Synchronous version: Parse YAML frontmatter from SKILL.md
|
|
771
|
-
*/
|
|
772
|
-
private parseFrontmatterSync;
|
|
773
|
-
/**
|
|
774
|
-
* Add skills from a SkillImporter (async)
|
|
775
|
-
* Used for temporary imported skills during session lifecycle
|
|
776
|
-
*/
|
|
777
|
-
addImportedSkills(importer: {
|
|
778
|
-
getAllImportedSkillPaths(): string[];
|
|
779
|
-
}): Promise<void>;
|
|
780
|
-
/**
|
|
781
|
-
* Add skills from a SkillImporter (sync)
|
|
782
|
-
*/
|
|
783
|
-
addImportedSkillsSync(importer: {
|
|
784
|
-
getAllImportedSkillPaths(): string[];
|
|
229
|
+
declare class DaemonEventLog implements EventSink {
|
|
230
|
+
private filePath;
|
|
231
|
+
constructor(daemonDir: string);
|
|
232
|
+
append(from: string, content: string, options?: {
|
|
233
|
+
kind?: EventKind;
|
|
785
234
|
}): void;
|
|
235
|
+
/** Read all events (full file read). */
|
|
236
|
+
readAll(): Promise<Message[]>;
|
|
237
|
+
/** Read events from byte offset (incremental sync). */
|
|
238
|
+
readFrom(offset: number): Promise<{
|
|
239
|
+
events: Message[];
|
|
240
|
+
offset: number;
|
|
241
|
+
}>;
|
|
786
242
|
}
|
|
787
243
|
//#endregion
|
|
788
|
-
//#region src/agent/
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
*/
|
|
792
|
-
declare function createSkillsTool(provider: SkillsProvider): unknown;
|
|
793
|
-
//#endregion
|
|
794
|
-
//#region src/agent/skills/importer.d.ts
|
|
795
|
-
interface ImportedSkill {
|
|
244
|
+
//#region src/agent/config.d.ts
|
|
245
|
+
interface AgentConfig {
|
|
246
|
+
/** Agent name (unique within daemon) */
|
|
796
247
|
name: string;
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
*/
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
* Import skills from multiple specs
|
|
814
|
-
*/
|
|
815
|
-
importMultiple(specs: string[]): Promise<string[]>;
|
|
816
|
-
/**
|
|
817
|
-
* Get path for an imported skill
|
|
818
|
-
*/
|
|
819
|
-
getImportedSkillPath(skillName: string): string | null;
|
|
820
|
-
/**
|
|
821
|
-
* Get all imported skill paths
|
|
822
|
-
*/
|
|
823
|
-
getAllImportedSkillPaths(): string[];
|
|
824
|
-
/**
|
|
825
|
-
* Get all imported skills metadata
|
|
826
|
-
*/
|
|
827
|
-
getImportedSkills(): ImportedSkill[];
|
|
828
|
-
/**
|
|
829
|
-
* Get temporary directory path
|
|
830
|
-
*/
|
|
831
|
-
getTempDir(): string;
|
|
832
|
-
/**
|
|
833
|
-
* Cleanup temporary directory
|
|
834
|
-
*/
|
|
835
|
-
cleanup(): Promise<void>;
|
|
836
|
-
/**
|
|
837
|
-
* Clone Git repository (shallow clone)
|
|
838
|
-
*/
|
|
839
|
-
private cloneRepo;
|
|
840
|
-
/**
|
|
841
|
-
* Extract skills from cloned repository
|
|
842
|
-
*/
|
|
843
|
-
private extractSkills;
|
|
844
|
-
/**
|
|
845
|
-
* Find skills directory in repository
|
|
846
|
-
* Tries: skills/, agent-skills/, . (root)
|
|
847
|
-
*/
|
|
848
|
-
private findSkillsDirectory;
|
|
849
|
-
/**
|
|
850
|
-
* Find all skills in a directory
|
|
851
|
-
*/
|
|
852
|
-
private findAllSkills;
|
|
853
|
-
/**
|
|
854
|
-
* Execute git command
|
|
855
|
-
*/
|
|
856
|
-
private execGit;
|
|
248
|
+
/** Model identifier (e.g., 'anthropic/claude-sonnet-4-5' or just 'MiniMax-M2.5' when provider is set) */
|
|
249
|
+
model: string;
|
|
250
|
+
/** System prompt */
|
|
251
|
+
system: string;
|
|
252
|
+
/** Backend type */
|
|
253
|
+
backend: BackendType;
|
|
254
|
+
/** Provider configuration — string (built-in) or object (custom endpoint) */
|
|
255
|
+
provider?: string | ProviderConfig;
|
|
256
|
+
/** Workflow this agent belongs to (optional — standalone agents have no workflow) */
|
|
257
|
+
workflow?: string;
|
|
258
|
+
/** Workflow instance tag (optional — standalone agents have no tag) */
|
|
259
|
+
tag?: string;
|
|
260
|
+
/** When this agent was created */
|
|
261
|
+
createdAt: string;
|
|
262
|
+
/** Periodic wakeup schedule */
|
|
263
|
+
schedule?: ScheduleConfig;
|
|
857
264
|
}
|
|
858
265
|
//#endregion
|
|
859
|
-
//#region src/agent/
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
rawSpec: string;
|
|
266
|
+
//#region src/agent/handle.d.ts
|
|
267
|
+
interface WorkerHandle {
|
|
268
|
+
/** Send a message synchronously */
|
|
269
|
+
send(input: string, options?: SendOptions$1): Promise<AgentResponse>;
|
|
270
|
+
/** Send a message with streaming response */
|
|
271
|
+
sendStream(input: string, options?: SendOptions$1): AsyncGenerator<string, AgentResponse>;
|
|
272
|
+
/** Snapshot current conversation state (for persistence) */
|
|
273
|
+
getState(): SessionState;
|
|
868
274
|
}
|
|
869
275
|
/**
|
|
870
|
-
*
|
|
276
|
+
* LocalWorker — In-process execution via AgentWorker.
|
|
871
277
|
*
|
|
872
|
-
*
|
|
873
|
-
*
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
*/
|
|
883
|
-
declare function buildGitUrl(spec: ImportSpec): string;
|
|
884
|
-
/**
|
|
885
|
-
* Get display name for import spec
|
|
886
|
-
*/
|
|
887
|
-
declare function getSpecDisplayName(spec: ImportSpec): string;
|
|
278
|
+
* Wraps an AgentWorker instance. State lives in the AgentWorker's memory.
|
|
279
|
+
* This is the default for single-machine deployments.
|
|
280
|
+
*/
|
|
281
|
+
declare class LocalWorker implements WorkerHandle {
|
|
282
|
+
private engine;
|
|
283
|
+
constructor(config: AgentConfig, restore?: SessionState);
|
|
284
|
+
send(input: string, options?: SendOptions$1): Promise<AgentResponse>;
|
|
285
|
+
sendStream(input: string, options?: SendOptions$1): AsyncGenerator<string, AgentResponse>;
|
|
286
|
+
getState(): SessionState;
|
|
287
|
+
}
|
|
888
288
|
//#endregion
|
|
889
|
-
export { type
|
|
289
|
+
export { type AgentConfig, AgentHandle, type AgentHandleState, AgentRegistry, AgentWorker, type AgentWorkerConfig, type CreateSkillToolOptions, DEFAULT_PORT, DaemonEventLog, type DaemonInfo, type DaemonState, LocalWorker, MemoryStateStore, type SendOptions, SkillImporter, type SkillToolkit, type StateStore, type StepInfo, type WorkerHandle, type WorkflowHandle, createSkillTool, isDaemonRunning, readDaemonInfo, removeDaemonInfo, startDaemon, writeDaemonInfo };
|