agent-worker 0.13.0 → 0.15.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 +6 -3
- package/dist/{backends-BWzhErjT.mjs → backends-BYWmuyF9.mjs} +1 -1
- package/dist/{backends-CziIqKRg.mjs → backends-C7pQwuAx.mjs} +310 -222
- package/dist/cli/index.mjs +2044 -478
- package/dist/context-CdcZpO-0.mjs +4 -0
- package/dist/create-tool-gcUuI1FD.mjs +32 -0
- package/dist/index.d.mts +65 -87
- package/dist/index.mjs +465 -21
- package/dist/{memory-provider-BtLYtdQH.mjs → memory-provider-ZLOKyCxA.mjs} +8 -3
- package/dist/runner-DB-b57iZ.mjs +670 -0
- package/dist/workflow-DQ6Eju4n.mjs +664 -0
- package/package.json +4 -3
- package/dist/context-BqEyt2SF.mjs +0 -4
- package/dist/logger-Bfdo83xL.mjs +0 -63
- package/dist/runner-CnxROIev.mjs +0 -1496
- package/dist/worker-DBJ8136Q.mjs +0 -448
- package/dist/workflow-CIE3WPNx.mjs +0 -272
- /package/dist/{display-pretty-BCJq5v9d.mjs → display-pretty-Kyd40DEF.mjs} +0 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { A as MENTION_PATTERN, B as formatProposal, C as DefaultDocumentStore, D as MemoryStorage, E as FileStorage, F as createResourceRef, G as getAgentId, H as createLogTool, I as extractMentions, K as EventLog, L as generateResourceId, M as RESOURCE_PREFIX, N as RESOURCE_SCHEME, O as ContextProviderImpl, P as calculatePriority, R as shouldUseResource, S as DefaultResourceStore, T as DefaultChannelStore, U as formatInbox, V as formatProposalList, W as formatToolParams, _ as FileContextProvider, b as resolveContextDir, j as MESSAGE_LENGTH_THRESHOLD, k as CONTEXT_DEFAULTS, v as createFileContextProvider, w as DefaultInboxStore, x as DefaultStatusStore, y as getDefaultContextDir, z as createContextMCPServer } from "./cli/index.mjs";
|
|
2
|
+
import { n as createMemoryContextProvider, t as MemoryContextProvider } from "./memory-provider-ZLOKyCxA.mjs";
|
|
3
|
+
|
|
4
|
+
export { createFileContextProvider };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsonSchema, tool } from "ai";
|
|
2
|
+
|
|
3
|
+
//#region src/agent/tools/create-tool.ts
|
|
4
|
+
/**
|
|
5
|
+
* Type-safe wrapper for AI SDK tool() with JSON Schema.
|
|
6
|
+
*
|
|
7
|
+
* The AI SDK's tool() function has complex generic types that don't align
|
|
8
|
+
* with jsonSchema() return types. This utility absorbs the necessary casts
|
|
9
|
+
* in one place instead of scattering `as unknown` across every tool file.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Create an AI SDK tool with a plain JSON Schema object.
|
|
13
|
+
*
|
|
14
|
+
* Usage:
|
|
15
|
+
* ```ts
|
|
16
|
+
* const myTool = createTool({
|
|
17
|
+
* description: "Do something",
|
|
18
|
+
* schema: { type: "object", properties: { name: { type: "string" } }, required: ["name"] },
|
|
19
|
+
* execute: async (args) => { ... },
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
function createTool(config) {
|
|
24
|
+
return tool({
|
|
25
|
+
description: config.description,
|
|
26
|
+
inputSchema: jsonSchema(config.schema),
|
|
27
|
+
execute: config.execute
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { createTool as t };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,57 @@
|
|
|
1
1
|
import { LanguageModel } from "ai";
|
|
2
2
|
import { BashToolkit, CreateBashToolOptions, createBashTool } from "bash-tool";
|
|
3
3
|
|
|
4
|
+
//#region src/backends/model-maps.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Model Translation Maps — Single Source of Truth
|
|
7
|
+
*
|
|
8
|
+
* All backend-specific model naming and translation logic lives here.
|
|
9
|
+
* Both `backends/types.ts` and `workflow/loop/types.ts` re-export from this module.
|
|
10
|
+
*/
|
|
11
|
+
/** Backend type (union of all supported backends) */
|
|
12
|
+
type BackendType = "default" | "claude" | "cursor" | "codex" | "opencode" | "mock";
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/backends/types.d.ts
|
|
15
|
+
interface BackendConfig {
|
|
16
|
+
type: BackendType;
|
|
17
|
+
/** Model identifier (interpretation depends on backend) */
|
|
18
|
+
model?: string;
|
|
19
|
+
/** Additional CLI flags or SDK options */
|
|
20
|
+
options?: Record<string, unknown>;
|
|
21
|
+
}
|
|
22
|
+
interface BackendResponse {
|
|
23
|
+
content: string;
|
|
24
|
+
/** Tool calls made during execution (if supported) */
|
|
25
|
+
toolCalls?: Array<{
|
|
26
|
+
name: string;
|
|
27
|
+
arguments: unknown;
|
|
28
|
+
result: unknown;
|
|
29
|
+
}>;
|
|
30
|
+
/** Usage statistics (if available) */
|
|
31
|
+
usage?: {
|
|
32
|
+
input: number;
|
|
33
|
+
output: number;
|
|
34
|
+
total: number;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
interface Backend {
|
|
38
|
+
readonly type: BackendType;
|
|
39
|
+
/** Send a message and get a response */
|
|
40
|
+
send(message: string, options?: {
|
|
41
|
+
system?: string;
|
|
42
|
+
}): Promise<BackendResponse>;
|
|
43
|
+
/** Check if the backend is available (CLI installed, API key set, etc.) */
|
|
44
|
+
isAvailable?(): Promise<boolean>;
|
|
45
|
+
/** Get backend info for display */
|
|
46
|
+
getInfo?(): {
|
|
47
|
+
name: string;
|
|
48
|
+
version?: string;
|
|
49
|
+
model?: string;
|
|
50
|
+
};
|
|
51
|
+
/** Abort any running operations and cleanup resources */
|
|
52
|
+
abort?(): void;
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
4
55
|
//#region src/workflow/types.d.ts
|
|
5
56
|
/**
|
|
6
57
|
* Custom provider configuration for API endpoint overrides.
|
|
@@ -145,61 +196,6 @@ interface Transcript {
|
|
|
145
196
|
createdAt: string;
|
|
146
197
|
}
|
|
147
198
|
//#endregion
|
|
148
|
-
//#region src/backends/model-maps.d.ts
|
|
149
|
-
/**
|
|
150
|
-
* Model Translation Maps — Single Source of Truth
|
|
151
|
-
*
|
|
152
|
-
* All backend-specific model naming and translation logic lives here.
|
|
153
|
-
* Both `backends/types.ts` and `workflow/controller/types.ts` re-export from this module.
|
|
154
|
-
*/
|
|
155
|
-
/** Backend type (union of all supported backends) */
|
|
156
|
-
type BackendType = "default" | "claude" | "cursor" | "codex" | "opencode" | "mock";
|
|
157
|
-
//#endregion
|
|
158
|
-
//#region src/backends/types.d.ts
|
|
159
|
-
interface BackendConfig {
|
|
160
|
-
type: BackendType;
|
|
161
|
-
/** Model identifier (interpretation depends on backend) */
|
|
162
|
-
model?: string;
|
|
163
|
-
/** Additional CLI flags or SDK options */
|
|
164
|
-
options?: Record<string, unknown>;
|
|
165
|
-
}
|
|
166
|
-
interface BackendResponse {
|
|
167
|
-
content: string;
|
|
168
|
-
/** Tool calls made during execution (if supported) */
|
|
169
|
-
toolCalls?: Array<{
|
|
170
|
-
name: string;
|
|
171
|
-
arguments: unknown;
|
|
172
|
-
result: unknown;
|
|
173
|
-
}>;
|
|
174
|
-
/** Usage statistics (if available) */
|
|
175
|
-
usage?: {
|
|
176
|
-
input: number;
|
|
177
|
-
output: number;
|
|
178
|
-
total: number;
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
interface Backend {
|
|
182
|
-
readonly type: BackendType;
|
|
183
|
-
/** Send a message and get a response */
|
|
184
|
-
send(message: string, options?: {
|
|
185
|
-
system?: string;
|
|
186
|
-
}): Promise<BackendResponse>;
|
|
187
|
-
/** Check if the backend is available (CLI installed, API key set, etc.) */
|
|
188
|
-
isAvailable?(): Promise<boolean>;
|
|
189
|
-
/** Get backend info for display */
|
|
190
|
-
getInfo?(): {
|
|
191
|
-
name: string;
|
|
192
|
-
version?: string;
|
|
193
|
-
model?: string;
|
|
194
|
-
};
|
|
195
|
-
/** Set up workspace directory with MCP config for workflow isolation */
|
|
196
|
-
setWorkspace?(workspaceDir: string, mcpConfig: {
|
|
197
|
-
mcpServers: Record<string, unknown>;
|
|
198
|
-
}): void;
|
|
199
|
-
/** Abort any running operations and cleanup resources */
|
|
200
|
-
abort?(): void;
|
|
201
|
-
}
|
|
202
|
-
//#endregion
|
|
203
199
|
//#region src/agent/worker.d.ts
|
|
204
200
|
/**
|
|
205
201
|
* Extended worker config that supports both SDK and CLI backends.
|
|
@@ -516,13 +512,6 @@ declare class ClaudeCodeBackend implements Backend {
|
|
|
516
512
|
private options;
|
|
517
513
|
private currentAbort?;
|
|
518
514
|
constructor(options?: ClaudeCodeOptions);
|
|
519
|
-
/**
|
|
520
|
-
* Set up workspace directory with MCP config
|
|
521
|
-
* Claude uses --mcp-config flag, so we just write the config file
|
|
522
|
-
*/
|
|
523
|
-
setWorkspace(workspaceDir: string, mcpConfig: {
|
|
524
|
-
mcpServers: Record<string, unknown>;
|
|
525
|
-
}): void;
|
|
526
515
|
send(message: string, options?: {
|
|
527
516
|
system?: string;
|
|
528
517
|
}): Promise<BackendResponse>;
|
|
@@ -533,10 +522,6 @@ declare class ClaudeCodeBackend implements Backend {
|
|
|
533
522
|
model?: string;
|
|
534
523
|
};
|
|
535
524
|
private buildArgs;
|
|
536
|
-
/**
|
|
537
|
-
* Set MCP config path (for workflow integration)
|
|
538
|
-
*/
|
|
539
|
-
setMcpConfigPath(path: string): void;
|
|
540
525
|
/**
|
|
541
526
|
* Abort any running claude process
|
|
542
527
|
*/
|
|
@@ -562,13 +547,6 @@ declare class CodexBackend implements Backend {
|
|
|
562
547
|
readonly type: "codex";
|
|
563
548
|
private options;
|
|
564
549
|
constructor(options?: CodexOptions);
|
|
565
|
-
/**
|
|
566
|
-
* Set up workspace directory with MCP config
|
|
567
|
-
* Creates .codex/config.yaml in the workspace with MCP server config
|
|
568
|
-
*/
|
|
569
|
-
setWorkspace(workspaceDir: string, mcpConfig: {
|
|
570
|
-
mcpServers: Record<string, unknown>;
|
|
571
|
-
}): void;
|
|
572
550
|
send(message: string, _options?: {
|
|
573
551
|
system?: string;
|
|
574
552
|
}): Promise<BackendResponse>;
|
|
@@ -597,16 +575,14 @@ interface CursorOptions {
|
|
|
597
575
|
declare class CursorBackend implements Backend {
|
|
598
576
|
readonly type: "cursor";
|
|
599
577
|
private options;
|
|
600
|
-
/** Resolved command: "cursor" (subcommand style) */
|
|
601
|
-
private resolvedCommand;
|
|
602
|
-
constructor(options?: CursorOptions);
|
|
603
578
|
/**
|
|
604
|
-
*
|
|
605
|
-
*
|
|
579
|
+
* Resolved command style:
|
|
580
|
+
* - "subcommand": `cursor agent -p ...` (IDE-bundled CLI)
|
|
581
|
+
* - "direct": `agent -p ...` (standalone install via cursor.com/install)
|
|
582
|
+
* - null: not yet resolved
|
|
606
583
|
*/
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
}): void;
|
|
584
|
+
private resolvedStyle;
|
|
585
|
+
constructor(options?: CursorOptions);
|
|
610
586
|
send(message: string, _options?: {
|
|
611
587
|
system?: string;
|
|
612
588
|
}): Promise<BackendResponse>;
|
|
@@ -617,11 +593,13 @@ declare class CursorBackend implements Backend {
|
|
|
617
593
|
model?: string;
|
|
618
594
|
};
|
|
619
595
|
/**
|
|
620
|
-
* Resolve which cursor command is available.
|
|
621
|
-
*
|
|
596
|
+
* Resolve which cursor command style is available.
|
|
597
|
+
* Tries in order:
|
|
598
|
+
* 1. `cursor agent --version` — IDE-bundled CLI (subcommand style)
|
|
599
|
+
* 2. `agent --version` — standalone install via cursor.com/install (direct style)
|
|
622
600
|
* Result is cached after first resolution.
|
|
623
601
|
*/
|
|
624
|
-
private
|
|
602
|
+
private resolveStyle;
|
|
625
603
|
protected buildCommand(message: string): Promise<{
|
|
626
604
|
command: string;
|
|
627
605
|
args: string[];
|
|
@@ -674,8 +652,8 @@ declare class SdkBackend implements Backend {
|
|
|
674
652
|
* Mock AI Backend for testing
|
|
675
653
|
*
|
|
676
654
|
* In single-agent mode, provides a simple echo send().
|
|
677
|
-
* In workflow mode, the
|
|
678
|
-
* via the mock runner strategy (
|
|
655
|
+
* In workflow mode, the loop handles MCP tool orchestration
|
|
656
|
+
* via the mock runner strategy (loop/mock-runner.ts).
|
|
679
657
|
*/
|
|
680
658
|
declare class MockAIBackend implements Backend {
|
|
681
659
|
private debugLog?;
|
|
@@ -907,4 +885,4 @@ declare function buildGitUrl(spec: ImportSpec): string;
|
|
|
907
885
|
*/
|
|
908
886
|
declare function getSpecDisplayName(spec: ImportSpec): string;
|
|
909
887
|
//#endregion
|
|
910
|
-
export { type AgentMessage, type AgentResponse, AgentWorker
|
|
888
|
+
export { type AgentMessage, type AgentResponse, AgentWorker, type AgentWorkerConfig, type ApprovalCheck, type Backend, type BackendConfig, type BackendOptions, type BackendResponse, type BackendType, type BashToolkit, type BashToolsOptions, ClaudeCodeBackend, type ClaudeCodeOptions, CodexBackend, type CodexOptions, type CreateBashToolOptions, CursorBackend, type CursorOptions, FEEDBACK_PROMPT, FRONTIER_MODELS, type FeedbackEntry, type FeedbackToolOptions, type FeedbackToolResult, type GitProvider, type ImportSpec, type ImportedSkill, type MessageStatus, MockAIBackend, type PendingApproval, SUPPORTED_PROVIDERS, SdkBackend, type SdkBackendOptions, type SendOptions, type SessionConfig, type SessionState, SkillImporter, type SkillMetadata, SkillsProvider, type StepInfo, type SupportedProvider, type TokenUsage, type ToolCall, type ToolInfo, type Transcript, buildGitUrl, checkBackends, createBackend, createBashTool, createBashTools, createBashToolsFromDirectory, createBashToolsFromFiles, createFeedbackTool, createMockBackend, createModel, createModelAsync, createSkillsTool, getSpecDisplayName, listBackends, parseImportSpec };
|