@agntk/core 0.1.2 → 0.2.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 +56 -90
- package/dist/advanced/index.d.ts +9 -2
- package/dist/advanced/index.d.ts.map +1 -1
- package/dist/advanced/index.js +13 -2
- package/dist/advanced/index.js.map +1 -1
- package/dist/agent.d.ts +27 -31
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +228 -275
- package/dist/agent.js.map +1 -1
- package/dist/config/schema.d.ts +38 -38
- package/dist/evals/runner.js +16 -9
- package/dist/evals/runner.js.map +1 -1
- package/dist/evals/types.d.ts +1 -1
- package/dist/evals/types.d.ts.map +1 -1
- package/dist/index.d.ts +4 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -9
- package/dist/index.js.map +1 -1
- package/dist/observability/langfuse.d.ts +2 -2
- package/dist/observability/langfuse.d.ts.map +1 -1
- package/dist/observability/langfuse.js +39 -17
- package/dist/observability/langfuse.js.map +1 -1
- package/dist/presets/sub-agent-configs.d.ts +11 -3
- package/dist/presets/sub-agent-configs.d.ts.map +1 -1
- package/dist/presets/sub-agent-configs.js +5 -10
- package/dist/presets/sub-agent-configs.js.map +1 -1
- package/dist/presets/tools.d.ts +5 -5
- package/dist/tools/browser/tool.d.ts +2 -2
- package/dist/tools/browser/types.d.ts +2 -2
- package/dist/tools/plan/tools.d.ts +1 -1
- package/dist/tools/plan/types.d.ts +2 -2
- package/dist/tools/progress/index.d.ts +2 -2
- package/dist/tools/spawn-agent/index.d.ts +7 -9
- package/dist/tools/spawn-agent/index.d.ts.map +1 -1
- package/dist/tools/spawn-agent/index.js +2 -4
- package/dist/tools/spawn-agent/index.js.map +1 -1
- package/dist/types/agent.d.ts +69 -199
- package/dist/types/agent.d.ts.map +1 -1
- package/dist/types/agent.js +4 -2
- package/dist/types/agent.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/usage-limits.d.ts +1 -1
- package/dist/usage-limits.js +1 -1
- package/dist/workflow/index.d.ts +1 -5
- package/dist/workflow/index.d.ts.map +1 -1
- package/dist/workflow/index.js +1 -9
- package/dist/workflow/index.js.map +1 -1
- package/dist/wrappers/best-of-n.d.ts +1 -1
- package/dist/wrappers/best-of-n.d.ts.map +1 -1
- package/dist/wrappers/best-of-n.js +11 -6
- package/dist/wrappers/best-of-n.js.map +1 -1
- package/package.json +4 -14
- package/dist/pool/index.d.ts +0 -7
- package/dist/pool/index.d.ts.map +0 -1
- package/dist/pool/index.js +0 -6
- package/dist/pool/index.js.map +0 -1
- package/dist/pool/specialist-pool.d.ts +0 -59
- package/dist/pool/specialist-pool.d.ts.map +0 -1
- package/dist/pool/specialist-pool.js +0 -224
- package/dist/pool/specialist-pool.js.map +0 -1
- package/dist/pool/tools.d.ts +0 -63
- package/dist/pool/tools.d.ts.map +0 -1
- package/dist/pool/tools.js +0 -83
- package/dist/pool/tools.js.map +0 -1
- package/dist/pool/types.d.ts +0 -79
- package/dist/pool/types.d.ts.map +0 -1
- package/dist/pool/types.js +0 -5
- package/dist/pool/types.js.map +0 -1
- package/dist/presets/index.d.ts +0 -5
- package/dist/presets/index.d.ts.map +0 -1
- package/dist/presets/index.js +0 -5
- package/dist/presets/index.js.map +0 -1
- package/dist/presets/role-registry.d.ts +0 -41
- package/dist/presets/role-registry.d.ts.map +0 -1
- package/dist/presets/role-registry.js +0 -213
- package/dist/presets/role-registry.js.map +0 -1
- package/dist/presets/roles.d.ts +0 -105
- package/dist/presets/roles.d.ts.map +0 -1
- package/dist/presets/roles.js +0 -207
- package/dist/presets/roles.js.map +0 -1
- package/dist/workflow/builders/adapt.d.ts +0 -20
- package/dist/workflow/builders/adapt.d.ts.map +0 -1
- package/dist/workflow/builders/adapt.js +0 -33
- package/dist/workflow/builders/adapt.js.map +0 -1
- package/dist/workflow/builders/index.d.ts +0 -8
- package/dist/workflow/builders/index.d.ts.map +0 -1
- package/dist/workflow/builders/index.js +0 -7
- package/dist/workflow/builders/index.js.map +0 -1
- package/dist/workflow/builders/parallel.d.ts +0 -25
- package/dist/workflow/builders/parallel.d.ts.map +0 -1
- package/dist/workflow/builders/parallel.js +0 -60
- package/dist/workflow/builders/parallel.js.map +0 -1
- package/dist/workflow/builders/pipeline.d.ts +0 -22
- package/dist/workflow/builders/pipeline.d.ts.map +0 -1
- package/dist/workflow/builders/pipeline.js +0 -48
- package/dist/workflow/builders/pipeline.js.map +0 -1
- package/dist/workflow/builders/types.d.ts +0 -54
- package/dist/workflow/builders/types.d.ts.map +0 -1
- package/dist/workflow/builders/types.js +0 -5
- package/dist/workflow/builders/types.js.map +0 -1
- package/dist/workflow/schedulers.d.ts +0 -231
- package/dist/workflow/schedulers.d.ts.map +0 -1
- package/dist/workflow/schedulers.js +0 -250
- package/dist/workflow/schedulers.js.map +0 -1
- package/dist/workflow/team/create-team.d.ts +0 -34
- package/dist/workflow/team/create-team.d.ts.map +0 -1
- package/dist/workflow/team/create-team.js +0 -242
- package/dist/workflow/team/create-team.js.map +0 -1
- package/dist/workflow/team/index.d.ts +0 -9
- package/dist/workflow/team/index.d.ts.map +0 -1
- package/dist/workflow/team/index.js +0 -8
- package/dist/workflow/team/index.js.map +0 -1
- package/dist/workflow/team/machines.d.ts +0 -152
- package/dist/workflow/team/machines.d.ts.map +0 -1
- package/dist/workflow/team/machines.js +0 -197
- package/dist/workflow/team/machines.js.map +0 -1
- package/dist/workflow/team/task-board.d.ts +0 -47
- package/dist/workflow/team/task-board.d.ts.map +0 -1
- package/dist/workflow/team/task-board.js +0 -111
- package/dist/workflow/team/task-board.js.map +0 -1
- package/dist/workflow/team/tools.d.ts +0 -66
- package/dist/workflow/team/tools.d.ts.map +0 -1
- package/dist/workflow/team/tools.js +0 -100
- package/dist/workflow/team/tools.js.map +0 -1
- package/dist/workflow/team/types.d.ts +0 -109
- package/dist/workflow/team/types.d.ts.map +0 -1
- package/dist/workflow/team/types.js +0 -5
- package/dist/workflow/team/types.js.map +0 -1
- package/dist/workflow/templates.d.ts +0 -71
- package/dist/workflow/templates.d.ts.map +0 -1
- package/dist/workflow/templates.js +0 -132
- package/dist/workflow/templates.js.map +0 -1
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @agntk/core - Sub-Agent Role Configurations
|
|
3
|
-
* Predefined configurations for specialized sub-agent roles
|
|
3
|
+
* Predefined configurations for specialized sub-agent roles.
|
|
4
|
+
*
|
|
5
|
+
* Sub-agents always use the 'full' tool preset (same as the parent agent).
|
|
6
|
+
* These configs only define role-specific instructions.
|
|
4
7
|
*/
|
|
5
8
|
/**
|
|
6
|
-
* Sub-agent role configurations with specialized prompts
|
|
9
|
+
* Sub-agent role configurations with specialized prompts.
|
|
7
10
|
*/
|
|
8
11
|
export const subAgentConfigs = {
|
|
9
12
|
coder: {
|
|
@@ -17,8 +20,6 @@ Always read relevant code before making changes. Match the existing style.
|
|
|
17
20
|
Be thorough but efficient. Don't over-engineer simple tasks.
|
|
18
21
|
|
|
19
22
|
When you finish, write a clear summary of what you did: files changed, key decisions made, and any issues encountered.`,
|
|
20
|
-
tools: ['glob', 'grep', 'shell', 'ast_grep_search'],
|
|
21
|
-
model: 'powerful', // resolved via tier-based model resolution
|
|
22
23
|
},
|
|
23
24
|
researcher: {
|
|
24
25
|
instructions: `You are a research specialist. Your focus areas:
|
|
@@ -31,8 +32,6 @@ Be thorough but efficient. Focus on actionable information.
|
|
|
31
32
|
Cite sources and provide confidence levels for findings.
|
|
32
33
|
|
|
33
34
|
When you finish, write a clear summary of your findings: key facts, sources, confidence levels, and recommendations.`,
|
|
34
|
-
tools: ['web'],
|
|
35
|
-
model: 'fast', // resolved via tier-based model resolution
|
|
36
35
|
},
|
|
37
36
|
analyst: {
|
|
38
37
|
instructions: `You are an analysis specialist. Your focus areas:
|
|
@@ -45,8 +44,6 @@ Be systematic and logical. Support conclusions with evidence.
|
|
|
45
44
|
Present findings clearly with actionable insights.
|
|
46
45
|
|
|
47
46
|
When you finish, write a clear summary of your analysis: key findings, trade-offs identified, and your recommendations.`,
|
|
48
|
-
tools: ['glob', 'grep', 'reasoning'],
|
|
49
|
-
model: 'powerful', // resolved via tier-based model resolution
|
|
50
47
|
},
|
|
51
48
|
generic: {
|
|
52
49
|
instructions: `You are a general-purpose assistant. Adapt your approach to the task at hand.
|
|
@@ -54,8 +51,6 @@ Use tools fluidly as part of your reasoning process.
|
|
|
54
51
|
Be autonomous but ask for clarification when genuinely uncertain.
|
|
55
52
|
|
|
56
53
|
When you finish, write a clear summary of what you accomplished and any important details.`,
|
|
57
|
-
tools: ['glob', 'grep', 'shell', 'web'],
|
|
58
|
-
model: 'standard', // resolved via tier-based model resolution
|
|
59
54
|
},
|
|
60
55
|
};
|
|
61
56
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sub-agent-configs.js","sourceRoot":"","sources":["../../src/presets/sub-agent-configs.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sub-agent-configs.js","sourceRoot":"","sources":["../../src/presets/sub-agent-configs.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAmC;IAC7D,KAAK,EAAE;QACL,YAAY,EAAE;;;;;;;;;uHASqG;KACpH;IAED,UAAU,EAAE;QACV,YAAY,EAAE;;;;;;;;;qHASmG;KAClH;IAED,OAAO,EAAE;QACP,YAAY,EAAE;;;;;;;;;wHASsG;KACrH;IAED,OAAO,EAAE;QACP,YAAY,EAAE;;;;2FAIyE;KACxF;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO,eAAe,CAAC,IAAI,CAAC,IAAI,eAAe,CAAC,OAAO,CAAC;AAC1D,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,CAAU,CAAC"}
|
package/dist/presets/tools.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export declare function createToolPreset(preset: ToolPresetLevel, options?: Tool
|
|
|
43
43
|
action: "create" | "decide" | "update_status" | "add_note" | "add_step" | "view";
|
|
44
44
|
steps?: string[] | undefined;
|
|
45
45
|
title?: string | undefined;
|
|
46
|
-
status?: "
|
|
46
|
+
status?: "blocked" | "completed" | "pending" | "in_progress" | undefined;
|
|
47
47
|
decision?: "delegate" | "proceed" | undefined;
|
|
48
48
|
stepName?: string | undefined;
|
|
49
49
|
note?: string | undefined;
|
|
@@ -97,8 +97,8 @@ export declare function createToolPreset(preset: ToolPresetLevel, options?: Tool
|
|
|
97
97
|
}, string>;
|
|
98
98
|
} | {
|
|
99
99
|
browser: import("ai").Tool<{
|
|
100
|
-
action: "open";
|
|
101
100
|
url: string;
|
|
101
|
+
action: "open";
|
|
102
102
|
} | {
|
|
103
103
|
action: "snapshot";
|
|
104
104
|
interactive?: boolean | undefined;
|
|
@@ -162,11 +162,11 @@ export declare function createToolPreset(preset: ToolPresetLevel, options?: Tool
|
|
|
162
162
|
}, string>;
|
|
163
163
|
progress_read: import("ai").Tool<{}, string>;
|
|
164
164
|
progress_update: import("ai").Tool<{
|
|
165
|
-
action?: string | undefined;
|
|
166
165
|
sessionId?: string | undefined;
|
|
166
|
+
action?: string | undefined;
|
|
167
167
|
featureId?: string | undefined;
|
|
168
168
|
featureName?: string | undefined;
|
|
169
|
-
featureStatus?: "
|
|
169
|
+
featureStatus?: "blocked" | "completed" | "pending" | "in_progress" | undefined;
|
|
170
170
|
featureDescription?: string | undefined;
|
|
171
171
|
featureNotes?: string | undefined;
|
|
172
172
|
}, string>;
|
|
@@ -203,7 +203,7 @@ export declare function createToolPreset(preset: ToolPresetLevel, options?: Tool
|
|
|
203
203
|
action: "create" | "decide" | "update_status" | "add_note" | "add_step" | "view";
|
|
204
204
|
steps?: string[] | undefined;
|
|
205
205
|
title?: string | undefined;
|
|
206
|
-
status?: "
|
|
206
|
+
status?: "blocked" | "completed" | "pending" | "in_progress" | undefined;
|
|
207
207
|
decision?: "delegate" | "proceed" | undefined;
|
|
208
208
|
stepName?: string | undefined;
|
|
209
209
|
note?: string | undefined;
|
|
@@ -14,8 +14,8 @@ export declare function executeBrowserCommand(args: string[], timeout?: number):
|
|
|
14
14
|
durationMs: number;
|
|
15
15
|
}>;
|
|
16
16
|
export declare function createBrowserTool(config?: BrowserConfig): import("ai").Tool<{
|
|
17
|
-
action: "open";
|
|
18
17
|
url: string;
|
|
18
|
+
action: "open";
|
|
19
19
|
} | {
|
|
20
20
|
action: "snapshot";
|
|
21
21
|
interactive?: boolean | undefined;
|
|
@@ -78,8 +78,8 @@ export declare function createBrowserTool(config?: BrowserConfig): import("ai").
|
|
|
78
78
|
action: "close";
|
|
79
79
|
}, string>;
|
|
80
80
|
export declare const browserTool: import("ai").Tool<{
|
|
81
|
-
action: "open";
|
|
82
81
|
url: string;
|
|
82
|
+
action: "open";
|
|
83
83
|
} | {
|
|
84
84
|
action: "snapshot";
|
|
85
85
|
interactive?: boolean | undefined;
|
|
@@ -7,11 +7,11 @@ export declare const browserInputSchema: z.ZodDiscriminatedUnion<"action", [z.Zo
|
|
|
7
7
|
action: z.ZodLiteral<"open">;
|
|
8
8
|
url: z.ZodString;
|
|
9
9
|
}, "strip", z.ZodTypeAny, {
|
|
10
|
-
action: "open";
|
|
11
10
|
url: string;
|
|
12
|
-
}, {
|
|
13
11
|
action: "open";
|
|
12
|
+
}, {
|
|
14
13
|
url: string;
|
|
14
|
+
action: "open";
|
|
15
15
|
}>, z.ZodObject<{
|
|
16
16
|
action: z.ZodLiteral<"snapshot">;
|
|
17
17
|
interactive: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -3,7 +3,7 @@ export declare function createPlanTool(config?: PlanToolConfig): import("ai").To
|
|
|
3
3
|
action: "create" | "decide" | "update_status" | "add_note" | "add_step" | "view";
|
|
4
4
|
steps?: string[] | undefined;
|
|
5
5
|
title?: string | undefined;
|
|
6
|
-
status?: "
|
|
6
|
+
status?: "blocked" | "completed" | "pending" | "in_progress" | undefined;
|
|
7
7
|
decision?: "delegate" | "proceed" | undefined;
|
|
8
8
|
stepName?: string | undefined;
|
|
9
9
|
note?: string | undefined;
|
|
@@ -39,7 +39,7 @@ export declare const planInputSchema: z.ZodObject<{
|
|
|
39
39
|
action: "create" | "decide" | "update_status" | "add_note" | "add_step" | "view";
|
|
40
40
|
steps?: string[] | undefined;
|
|
41
41
|
title?: string | undefined;
|
|
42
|
-
status?: "
|
|
42
|
+
status?: "blocked" | "completed" | "pending" | "in_progress" | undefined;
|
|
43
43
|
decision?: "delegate" | "proceed" | undefined;
|
|
44
44
|
stepName?: string | undefined;
|
|
45
45
|
note?: string | undefined;
|
|
@@ -47,7 +47,7 @@ export declare const planInputSchema: z.ZodObject<{
|
|
|
47
47
|
action: "create" | "decide" | "update_status" | "add_note" | "add_step" | "view";
|
|
48
48
|
steps?: string[] | undefined;
|
|
49
49
|
title?: string | undefined;
|
|
50
|
-
status?: "
|
|
50
|
+
status?: "blocked" | "completed" | "pending" | "in_progress" | undefined;
|
|
51
51
|
decision?: "delegate" | "proceed" | undefined;
|
|
52
52
|
stepName?: string | undefined;
|
|
53
53
|
note?: string | undefined;
|
|
@@ -40,11 +40,11 @@ export interface ProgressData {
|
|
|
40
40
|
export declare function createProgressTools(workspaceRoot: string): {
|
|
41
41
|
progress_read: import("ai").Tool<{}, string>;
|
|
42
42
|
progress_update: import("ai").Tool<{
|
|
43
|
-
action?: string | undefined;
|
|
44
43
|
sessionId?: string | undefined;
|
|
44
|
+
action?: string | undefined;
|
|
45
45
|
featureId?: string | undefined;
|
|
46
46
|
featureName?: string | undefined;
|
|
47
|
-
featureStatus?: "
|
|
47
|
+
featureStatus?: "blocked" | "completed" | "pending" | "in_progress" | undefined;
|
|
48
48
|
featureDescription?: string | undefined;
|
|
49
49
|
featureNotes?: string | undefined;
|
|
50
50
|
}, string>;
|
|
@@ -14,21 +14,19 @@ export interface SpawnAgentOptions {
|
|
|
14
14
|
*/
|
|
15
15
|
currentDepth?: number;
|
|
16
16
|
/**
|
|
17
|
-
* Agent factory function - must be provided to enable spawning
|
|
18
|
-
* This is called to create the sub-agent instance
|
|
17
|
+
* Agent factory function - must be provided to enable spawning.
|
|
18
|
+
* This is called to create the sub-agent instance.
|
|
19
19
|
*/
|
|
20
20
|
createAgent?: (options: {
|
|
21
21
|
role: string;
|
|
22
22
|
instructions?: string;
|
|
23
|
-
tools?: string[];
|
|
24
|
-
maxSpawnDepth?: number;
|
|
25
23
|
}) => {
|
|
26
24
|
stream: (input: {
|
|
27
25
|
prompt: string;
|
|
28
26
|
}) => {
|
|
29
27
|
fullStream: AsyncIterable<{
|
|
30
28
|
type: string;
|
|
31
|
-
|
|
29
|
+
text?: string;
|
|
32
30
|
}>;
|
|
33
31
|
text: Promise<string>;
|
|
34
32
|
};
|
|
@@ -51,13 +49,13 @@ export declare const spawnAgentParametersSchema: z.ZodObject<{
|
|
|
51
49
|
role: z.ZodDefault<z.ZodEnum<["coder", "researcher", "analyst", "generic"]>>;
|
|
52
50
|
context: z.ZodOptional<z.ZodString>;
|
|
53
51
|
}, "strip", z.ZodTypeAny, {
|
|
54
|
-
role: "generic" | "coder" | "researcher" | "analyst";
|
|
55
52
|
task: string;
|
|
53
|
+
role: "coder" | "researcher" | "analyst" | "generic";
|
|
56
54
|
context?: string | undefined;
|
|
57
55
|
}, {
|
|
58
56
|
task: string;
|
|
59
|
-
role?: "generic" | "coder" | "researcher" | "analyst" | undefined;
|
|
60
57
|
context?: string | undefined;
|
|
58
|
+
role?: "coder" | "researcher" | "analyst" | "generic" | undefined;
|
|
61
59
|
}>;
|
|
62
60
|
export type SpawnAgentInput = z.infer<typeof spawnAgentParametersSchema>;
|
|
63
61
|
export interface SpawnAgentResult {
|
|
@@ -82,13 +80,13 @@ export declare function createSpawnAgentTool(options?: SpawnAgentOptions): {
|
|
|
82
80
|
role: z.ZodDefault<z.ZodEnum<["coder", "researcher", "analyst", "generic"]>>;
|
|
83
81
|
context: z.ZodOptional<z.ZodString>;
|
|
84
82
|
}, "strip", z.ZodTypeAny, {
|
|
85
|
-
role: "generic" | "coder" | "researcher" | "analyst";
|
|
86
83
|
task: string;
|
|
84
|
+
role: "coder" | "researcher" | "analyst" | "generic";
|
|
87
85
|
context?: string | undefined;
|
|
88
86
|
}, {
|
|
89
87
|
task: string;
|
|
90
|
-
role?: "generic" | "coder" | "researcher" | "analyst" | undefined;
|
|
91
88
|
context?: string | undefined;
|
|
89
|
+
role?: "coder" | "researcher" | "analyst" | "generic" | undefined;
|
|
92
90
|
}>;
|
|
93
91
|
execute: (input: SpawnAgentInput) => Promise<SpawnAgentResult>;
|
|
94
92
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/spawn-agent/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE;QACtB,IAAI,EAAE,MAAM,CAAC;QACb,YAAY,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/spawn-agent/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE;QACtB,IAAI,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gent({
|
|
69
69
|
role,
|
|
70
70
|
instructions: roleConfig.instructions,
|
|
71
|
-
tools: roleConfig.tools,
|
|
72
|
-
maxSpawnDepth: 0, // Sub-agents can't spawn further
|
|
73
71
|
});
|
|
74
72
|
const stream = subAgent.stream({ prompt: fullPrompt });
|
|
75
73
|
// Stream sub-agent output
|
|
76
74
|
for await (const chunk of stream.fullStream) {
|
|
77
|
-
if (chunk.type === 'text-delta' && chunk.
|
|
75
|
+
if (chunk.type === 'text-delta' && chunk.text) {
|
|
78
76
|
if (onStream) {
|
|
79
77
|
onStream({
|
|
80
78
|
type: 'sub-agent-stream',
|
|
81
79
|
agentId,
|
|
82
80
|
role,
|
|
83
|
-
text: chunk.
|
|
81
|
+
text: chunk.text,
|
|
84
82
|
status: 'streaming',
|
|
85
83
|
});
|
|
86
84
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/spawn-agent/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/spawn-agent/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AA2C5C,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;kFAe8D,CAA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AC,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC;KACvE,CAAC;AACJ,CAAC;AAED,eAAe,oBAAoB,CAAC"}
|
package/dist/types/agent.d.ts
CHANGED
|
@@ -1,218 +1,88 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @fileoverview Core type definitions for
|
|
3
|
-
*
|
|
2
|
+
* @fileoverview Core type definitions for the agent API.
|
|
3
|
+
*
|
|
4
|
+
* The agent is a fully-equipped worker. You give it a name, instructions,
|
|
5
|
+
* and a prompt. Everything else is auto-detected from the environment.
|
|
4
6
|
*/
|
|
5
|
-
import type { LanguageModel,
|
|
6
|
-
import type { SkillsConfig } from '../skills/types.js';
|
|
7
|
+
import type { LanguageModel, LanguageModelUsage, Tool } from 'ai';
|
|
7
8
|
import type { UsageLimits } from '../usage-limits.js';
|
|
8
|
-
import type { ReflectionConfig } from '../reflection.js';
|
|
9
|
-
import type { ApprovalConfig } from '../tools/approval.js';
|
|
10
|
-
import type { GuardrailsConfig } from '../guardrails/types.js';
|
|
11
|
-
import type { StreamEventCallback } from './streaming.js';
|
|
12
|
-
import type { ObservabilityConfig } from '../observability/types.js';
|
|
13
9
|
/**
|
|
14
|
-
* Configuration
|
|
10
|
+
* Configuration for creating an agent.
|
|
11
|
+
*
|
|
12
|
+
* Only `name` is required. Everything else has sensible defaults or
|
|
13
|
+
* is auto-detected from the environment.
|
|
15
14
|
*/
|
|
16
15
|
export interface AgentOptions {
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*
|
|
16
|
+
/**
|
|
17
|
+
* Display name for this agent.
|
|
18
|
+
* Used in logs, traces, multi-agent coordination, and persistent state.
|
|
19
|
+
* Persistent agent state is stored at `~/.agntk/agents/{name}/`.
|
|
21
20
|
*/
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
agentId?: string;
|
|
27
|
-
/** Maximum number of tool execution steps. Default: 10 */
|
|
28
|
-
maxSteps?: number;
|
|
29
|
-
/** Token and request caps. Throws UsageLimitExceeded when exceeded.
|
|
30
|
-
* @example
|
|
31
|
-
* ```typescript
|
|
32
|
-
* const agent = createAgent({
|
|
33
|
-
* usageLimits: { maxRequests: 20, maxTotalTokens: 100_000 },
|
|
34
|
-
* });
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
usageLimits?: UsageLimits;
|
|
38
|
-
/** Condition to stop agent execution. */
|
|
39
|
-
stopWhen?: 'task_complete' | 'max_steps' | StopFunction;
|
|
40
|
-
/** Reflection strategy injected between tool steps.
|
|
41
|
-
* 'reflact' injects goal-state reflection after every step.
|
|
42
|
-
* 'periodic' injects reflection every N steps (configurable via frequency).
|
|
43
|
-
* 'none' preserves default behavior (no reflection).
|
|
44
|
-
* @example
|
|
45
|
-
* ```typescript
|
|
46
|
-
* const agent = createAgent({
|
|
47
|
-
* reflection: { strategy: 'reflact' },
|
|
48
|
-
* });
|
|
49
|
-
* ```
|
|
21
|
+
name: string;
|
|
22
|
+
/**
|
|
23
|
+
* What this agent does. Natural language context injected as the system prompt.
|
|
24
|
+
* This is NOT a role — it's the agent's understanding of its job.
|
|
50
25
|
*/
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
modelProvider?: ModelProvider;
|
|
56
|
-
/** Model name/identifier within the provider. */
|
|
57
|
-
modelName?: string;
|
|
58
|
-
/** Custom tools to add to the agent. Merged with preset tools. */
|
|
59
|
-
tools?: Record<string, Tool>;
|
|
60
|
-
/** Predefined tool preset to use. Default: 'standard' */
|
|
61
|
-
toolPreset?: ToolPreset;
|
|
62
|
-
/** Specific tools to enable (whitelist). If set, only these tools are active. */
|
|
63
|
-
enableTools?: string[];
|
|
64
|
-
/** Specific tools to disable (blacklist). Removed from preset/custom tools. */
|
|
65
|
-
disableTools?: string[];
|
|
66
|
-
/** Maximum retries per tool when a ModelRetry error is thrown. Default: 3 */
|
|
67
|
-
maxToolRetries?: number;
|
|
68
|
-
/** Require human approval before executing dangerous tools.
|
|
69
|
-
* `true` enables approval for default dangerous tools (shell, browser, file_write, file_edit).
|
|
70
|
-
* Provide an ApprovalConfig object for fine-grained control.
|
|
71
|
-
* @example
|
|
72
|
-
* ```typescript
|
|
73
|
-
* const agent = createAgent({
|
|
74
|
-
* approval: true, // enable for default dangerous tools
|
|
75
|
-
* });
|
|
76
|
-
* // or
|
|
77
|
-
* const agent = createAgent({
|
|
78
|
-
* approval: { enabled: true, tools: ['shell'], timeout: 30000 },
|
|
79
|
-
* });
|
|
80
|
-
* ```
|
|
26
|
+
instructions?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Where the agent operates. Root for file tools, skill discovery, memory.
|
|
29
|
+
* Default: process.cwd()
|
|
81
30
|
*/
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* ```typescript
|
|
88
|
-
* const agent = createAgent({
|
|
89
|
-
* guardrails: {
|
|
90
|
-
* output: [contentFilter(), lengthLimit({ maxChars: 5000 })],
|
|
91
|
-
* onBlock: 'retry',
|
|
92
|
-
* },
|
|
93
|
-
* });
|
|
94
|
-
* ```
|
|
31
|
+
workspaceRoot?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Override the auto-selected model.
|
|
34
|
+
* Most users should never touch this — the agent picks the best
|
|
35
|
+
* available model from your API keys.
|
|
95
36
|
*/
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
|
|
99
|
-
/** Custom configurations for specific sub-agent roles. */
|
|
100
|
-
subAgentRoles?: Record<string, SubAgentConfig>;
|
|
101
|
-
/** Maximum depth of sub-agent spawning to prevent infinite recursion. Default: 2 */
|
|
102
|
-
maxSpawnDepth?: number;
|
|
103
|
-
/** Enable transient streaming for tool data (file contents, shell output, etc). Default: true */
|
|
104
|
-
enableTransientStreaming?: boolean;
|
|
105
|
-
/** Enable durable workflow wrapping for tool executions. Default: true */
|
|
106
|
-
durable?: boolean;
|
|
107
|
-
/** Configuration for workflow durability. */
|
|
108
|
-
workflowOptions?: WorkflowOptions;
|
|
109
|
-
/** Enable persistent memory for the agent. Default: false
|
|
110
|
-
* When true, creates a MarkdownMemoryStore that reads/writes .agntk/ files.
|
|
111
|
-
* @example
|
|
112
|
-
* ```typescript
|
|
113
|
-
* const agent = createAgent({ enableMemory: true });
|
|
114
|
-
* ```
|
|
37
|
+
model?: LanguageModel;
|
|
38
|
+
/**
|
|
39
|
+
* Safety limit on tool-loop iterations. Default: 25
|
|
115
40
|
*/
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
|
|
119
|
-
/** Skills to inject into the agent's system prompt.
|
|
120
|
-
* Skills are discovered from SKILL.md files in configured directories.
|
|
121
|
-
* @example
|
|
122
|
-
* ```typescript
|
|
123
|
-
* const agent = createAgent({
|
|
124
|
-
* skills: { directories: ['.agents/skills'] },
|
|
125
|
-
* });
|
|
126
|
-
* ```
|
|
41
|
+
maxSteps?: number;
|
|
42
|
+
/**
|
|
43
|
+
* Token/request caps. Throws UsageLimitExceeded when hit.
|
|
127
44
|
*/
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
askUserHandler?: AskUserHandler;
|
|
133
|
-
/** Callback fired after each tool execution step. */
|
|
134
|
-
onStepFinish?: StepFinishCallback;
|
|
135
|
-
/** Callback for streaming events. */
|
|
136
|
-
onEvent?: StreamEventCallback;
|
|
137
|
-
/** Telemetry configuration for OpenTelemetry-based tracing.
|
|
138
|
-
* When provided, initializes observability and passes telemetry settings
|
|
139
|
-
* to the underlying AI SDK ToolLoopAgent.
|
|
140
|
-
*
|
|
141
|
-
* Requires `langfuse-vercel` and `@vercel/otel` as optional peer dependencies.
|
|
142
|
-
* Gracefully degrades (no-op) if not installed.
|
|
143
|
-
*
|
|
144
|
-
* @example
|
|
145
|
-
* ```typescript
|
|
146
|
-
* const agent = createAgent({
|
|
147
|
-
* telemetry: {
|
|
148
|
-
* provider: { provider: 'langfuse' },
|
|
149
|
-
* functionId: 'my-agent',
|
|
150
|
-
* },
|
|
151
|
-
* });
|
|
152
|
-
* ```
|
|
45
|
+
usageLimits?: UsageLimits;
|
|
46
|
+
/**
|
|
47
|
+
* Additional tools to merge with the agent's built-in tools.
|
|
48
|
+
* Useful for testing with mock tools or adding custom capabilities.
|
|
153
49
|
*/
|
|
154
|
-
|
|
155
|
-
/** Observability provider config (e.g., Langfuse keys/URL). */
|
|
156
|
-
provider?: ObservabilityConfig;
|
|
157
|
-
/** Identifier for this agent function in traces. Defaults to `agent:<agentId>`. */
|
|
158
|
-
functionId?: string;
|
|
159
|
-
/** Additional metadata to include in traces. */
|
|
160
|
-
metadata?: Record<string, unknown>;
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
/** Predefined agent roles with associated configurations. */
|
|
164
|
-
export type AgentRole = 'generic' | 'coder' | 'researcher' | 'analyst';
|
|
165
|
-
/** Supported model providers. */
|
|
166
|
-
export type ModelProvider = 'openrouter' | 'ollama' | 'openai' | (string & {});
|
|
167
|
-
/** Predefined tool presets. */
|
|
168
|
-
export type ToolPreset = 'none' | 'minimal' | 'standard' | 'full';
|
|
169
|
-
/** Custom stop condition function. */
|
|
170
|
-
export type StopFunction = (ctx: StopContext) => boolean;
|
|
171
|
-
/** Context passed to stop condition function. */
|
|
172
|
-
export interface StopContext {
|
|
173
|
-
steps: StepResult<ToolSet>[];
|
|
174
|
-
stepCount: number;
|
|
50
|
+
tools?: Record<string, Tool>;
|
|
175
51
|
}
|
|
176
|
-
/** Handler for user interaction requests. */
|
|
177
|
-
export type AskUserHandler = (question: string) => Promise<string>;
|
|
178
|
-
/** Callback for step completion. */
|
|
179
|
-
export type StepFinishCallback = (step: StepResult<ToolSet>, index: number) => void | Promise<void>;
|
|
180
52
|
/**
|
|
181
|
-
*
|
|
182
|
-
* Re-exported from types/streaming.ts — the canonical source with full type safety.
|
|
53
|
+
* An agent instance. Stream-only — no generate().
|
|
183
54
|
*/
|
|
184
|
-
export
|
|
185
|
-
/**
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
|
|
200
|
-
/** Default timeout for tool executions. Format: "30s", "5m", "1h". Default: "5m" */
|
|
201
|
-
defaultTimeout?: string;
|
|
202
|
-
/** Whether independent tools should run in parallel. Default: true */
|
|
203
|
-
parallelIndependent?: boolean;
|
|
204
|
-
/** Storage backend for workflow state. Default: 'memory' */
|
|
205
|
-
storage?: 'vercel' | 'sqlite' | 'memory';
|
|
206
|
-
/** Workflow run ID for resumption. */
|
|
207
|
-
workflowRunId?: string;
|
|
55
|
+
export interface Agent {
|
|
56
|
+
/** The agent's name. */
|
|
57
|
+
readonly name: string;
|
|
58
|
+
/** Initialize async resources (memory, telemetry). Called automatically by stream(). */
|
|
59
|
+
init(): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Stream a response. This is the only way to run an agent.
|
|
62
|
+
* Returns the AI SDK stream result.
|
|
63
|
+
*/
|
|
64
|
+
stream(input: {
|
|
65
|
+
prompt: string;
|
|
66
|
+
}): Promise<AgentStreamResult>;
|
|
67
|
+
/** Get the current system prompt (includes auto-injected context + memory). */
|
|
68
|
+
getSystemPrompt(): string;
|
|
69
|
+
/** Get the list of all tool names available to this agent. */
|
|
70
|
+
getToolNames(): string[];
|
|
208
71
|
}
|
|
209
|
-
/**
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
72
|
+
/**
|
|
73
|
+
* Stream result from an agent.
|
|
74
|
+
* Wraps the AI SDK ToolLoopAgent stream result with additional metadata.
|
|
75
|
+
*/
|
|
76
|
+
export interface AgentStreamResult {
|
|
77
|
+
/** Async iterable of stream chunks (text deltas, tool calls, tool results, etc.) */
|
|
78
|
+
fullStream: AsyncIterable<{
|
|
79
|
+
type: string;
|
|
80
|
+
text?: string;
|
|
81
|
+
[key: string]: unknown;
|
|
82
|
+
}>;
|
|
83
|
+
/** Promise-like that resolves to the final text output. */
|
|
84
|
+
text: PromiseLike<string>;
|
|
85
|
+
/** Promise-like that resolves to token usage. */
|
|
86
|
+
usage: PromiseLike<LanguageModelUsage>;
|
|
217
87
|
}
|
|
218
88
|
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/types/agent.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/types/agent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAMnD;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAIvB;;;;OAIG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;CAC9B;AAMD;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB,wBAAwB;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,wFAAwF;IACxF,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtB;;;OAGG;IACH,MAAM,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAE9D,+EAA+E;IAC/E,eAAe,IAAI,MAAM,CAAC;IAE1B,8DAA8D;IAC9D,YAAY,IAAI,MAAM,EAAE,CAAC;CAC1B;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,oFAAoF;IACpF,UAAU,EAAE,aAAa,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC,CAAC;IACnF,2DAA2D;IAC3D,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1B,iDAAiD;IACjD,KAAK,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAC;CACxC"}
|
package/dist/types/agent.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @fileoverview Core type definitions for
|
|
3
|
-
*
|
|
2
|
+
* @fileoverview Core type definitions for the agent API.
|
|
3
|
+
*
|
|
4
|
+
* The agent is a fully-equipped worker. You give it a name, instructions,
|
|
5
|
+
* and a prompt. Everything else is auto-detected from the environment.
|
|
4
6
|
*/
|
|
5
7
|
export {};
|
|
6
8
|
//# sourceMappingURL=agent.js.map
|
package/dist/types/agent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/types/agent.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/types/agent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Type exports for @agntk/core
|
|
3
3
|
*/
|
|
4
|
-
export type { AgentOptions,
|
|
4
|
+
export type { AgentOptions, Agent, AgentStreamResult, } from './agent.js';
|
|
5
5
|
export { ToolErrorType, ToolError, } from './lifecycle.js';
|
|
6
6
|
export type { ToolLifecycle, ToolContext, ValidationResult, BypassResult, DurabilityConfig, LifecycleToolConfig, ToolExecuteFn, InferToolInput, InferToolOutput, StreamWriter, } from './lifecycle.js';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,YAAY,EACV,YAAY,EACZ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,YAAY,EACV,YAAY,EACZ,KAAK,EACL,iBAAiB,GAClB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,aAAa,EACb,SAAS,GACV,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,eAAe,EACf,YAAY,GACb,MAAM,aAAa,CAAC"}
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,uBAAuB;AACvB,OAAO,EACL,aAAa,EACb,SAAS,GACV,MAAM,aAAa,CAAC"}
|