@dexto/agent-management 1.5.8 → 1.6.1
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/AgentFactory.cjs +5 -9
- package/dist/AgentFactory.d.ts +6 -5
- package/dist/AgentFactory.d.ts.map +1 -1
- package/dist/AgentFactory.js +5 -9
- package/dist/AgentManager.cjs +2 -2
- package/dist/AgentManager.d.ts +1 -1
- package/dist/AgentManager.d.ts.map +1 -1
- package/dist/AgentManager.js +4 -4
- package/dist/agent-creation.cjs +95 -0
- package/dist/agent-creation.d.ts +15 -0
- package/dist/agent-creation.d.ts.map +1 -0
- package/dist/agent-creation.js +78 -0
- package/dist/config/config-enrichment.cjs +8 -14
- package/dist/config/config-enrichment.d.ts +7 -1
- package/dist/config/config-enrichment.d.ts.map +1 -1
- package/dist/config/config-enrichment.js +8 -14
- package/dist/config/config-manager.cjs +4 -4
- package/dist/config/config-manager.d.ts +1 -1
- package/dist/config/config-manager.d.ts.map +1 -1
- package/dist/config/config-manager.js +3 -1
- package/dist/config/loader.d.ts +3 -3
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/images/image-store.cjs +256 -0
- package/dist/images/image-store.d.ts +70 -0
- package/dist/images/image-store.d.ts.map +1 -0
- package/dist/images/image-store.js +210 -0
- package/dist/index.cjs +32 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -1
- package/dist/plugins/discover-plugins.cjs +15 -31
- package/dist/plugins/discover-plugins.d.ts.map +1 -1
- package/dist/plugins/discover-plugins.js +15 -31
- package/dist/plugins/index.cjs +0 -2
- package/dist/plugins/index.d.ts +5 -6
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +0 -2
- package/dist/plugins/list-plugins.cjs +3 -1
- package/dist/plugins/list-plugins.d.ts.map +1 -1
- package/dist/plugins/list-plugins.js +3 -1
- package/dist/plugins/load-plugin.cjs +0 -13
- package/dist/plugins/load-plugin.d.ts +3 -5
- package/dist/plugins/load-plugin.d.ts.map +1 -1
- package/dist/plugins/load-plugin.js +0 -13
- package/dist/plugins/schemas.cjs +1 -11
- package/dist/plugins/schemas.d.ts +14 -69
- package/dist/plugins/schemas.d.ts.map +1 -1
- package/dist/plugins/schemas.js +1 -10
- package/dist/plugins/types.d.ts +2 -20
- package/dist/plugins/types.d.ts.map +1 -1
- package/dist/plugins/validate-plugin.cjs +7 -37
- package/dist/plugins/validate-plugin.d.ts +6 -24
- package/dist/plugins/validate-plugin.d.ts.map +1 -1
- package/dist/plugins/validate-plugin.js +8 -38
- package/dist/preferences/loader.cjs +21 -6
- package/dist/preferences/loader.d.ts +4 -0
- package/dist/preferences/loader.d.ts.map +1 -1
- package/dist/preferences/loader.js +21 -6
- package/dist/preferences/schemas.cjs +5 -1
- package/dist/preferences/schemas.d.ts +32 -0
- package/dist/preferences/schemas.d.ts.map +1 -1
- package/dist/preferences/schemas.js +5 -1
- package/dist/registry/registry.d.ts +4 -44
- package/dist/registry/registry.d.ts.map +1 -1
- package/dist/registry/types.cjs +4 -0
- package/dist/registry/types.d.ts +8 -0
- package/dist/registry/types.d.ts.map +1 -1
- package/dist/registry/types.js +4 -0
- package/dist/runtime/AgentPool.d.ts +2 -2
- package/dist/runtime/AgentPool.d.ts.map +1 -1
- package/dist/runtime/AgentRuntime.cjs +32 -19
- package/dist/runtime/AgentRuntime.d.ts +2 -2
- package/dist/runtime/AgentRuntime.d.ts.map +1 -1
- package/dist/runtime/AgentRuntime.js +32 -19
- package/dist/runtime/approval-delegation.cjs +6 -3
- package/dist/runtime/approval-delegation.d.ts +3 -2
- package/dist/runtime/approval-delegation.d.ts.map +1 -1
- package/dist/runtime/approval-delegation.js +6 -3
- package/dist/runtime/schemas.cjs +1 -1
- package/dist/runtime/schemas.d.ts +1 -1
- package/dist/runtime/schemas.js +1 -1
- package/dist/runtime/types.d.ts +3 -2
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/{tool-provider → tool-factories/agent-spawner}/error-codes.d.ts +1 -1
- package/dist/tool-factories/agent-spawner/error-codes.d.ts.map +1 -0
- package/dist/{tool-provider → tool-factories/agent-spawner}/errors.d.ts +1 -1
- package/dist/tool-factories/agent-spawner/errors.d.ts.map +1 -0
- package/dist/tool-factories/agent-spawner/factory.cjs +327 -0
- package/dist/tool-factories/agent-spawner/factory.d.ts +4 -0
- package/dist/tool-factories/agent-spawner/factory.d.ts.map +1 -0
- package/dist/tool-factories/agent-spawner/factory.js +316 -0
- package/dist/{tool-provider → tool-factories/agent-spawner}/index.cjs +9 -9
- package/dist/{tool-provider → tool-factories/agent-spawner}/index.d.ts +3 -3
- package/dist/tool-factories/agent-spawner/index.d.ts.map +1 -0
- package/dist/{tool-provider → tool-factories/agent-spawner}/index.js +4 -4
- package/dist/tool-factories/agent-spawner/llm-resolution.d.ts.map +1 -0
- package/dist/{tool-provider/runtime-service.cjs → tool-factories/agent-spawner/runtime.cjs} +149 -83
- package/dist/{tool-provider/runtime-service.d.ts → tool-factories/agent-spawner/runtime.d.ts} +11 -6
- package/dist/tool-factories/agent-spawner/runtime.d.ts.map +1 -0
- package/dist/{tool-provider/runtime-service.js → tool-factories/agent-spawner/runtime.js} +145 -79
- package/dist/{tool-provider → tool-factories/agent-spawner}/schemas.cjs +4 -4
- package/dist/{tool-provider → tool-factories/agent-spawner}/schemas.d.ts +5 -5
- package/dist/tool-factories/agent-spawner/schemas.d.ts.map +1 -0
- package/dist/{tool-provider → tool-factories/agent-spawner}/schemas.js +4 -4
- package/dist/{tool-provider → tool-factories/agent-spawner}/spawn-agent-tool.cjs +17 -7
- package/dist/tool-factories/agent-spawner/spawn-agent-tool.d.ts +11 -0
- package/dist/tool-factories/agent-spawner/spawn-agent-tool.d.ts.map +1 -0
- package/dist/{tool-provider → tool-factories/agent-spawner}/spawn-agent-tool.js +17 -7
- package/dist/tool-factories/agent-spawner/types.d.ts.map +1 -0
- package/dist/utils/path.cjs +10 -1
- package/dist/utils/path.d.ts +5 -2
- package/dist/utils/path.d.ts.map +1 -1
- package/dist/utils/path.js +10 -1
- package/dist/writer.d.ts +2 -1
- package/dist/writer.d.ts.map +1 -1
- package/package.json +6 -4
- package/dist/tool-provider/error-codes.d.ts.map +0 -1
- package/dist/tool-provider/errors.d.ts.map +0 -1
- package/dist/tool-provider/index.d.ts.map +0 -1
- package/dist/tool-provider/llm-resolution.d.ts.map +0 -1
- package/dist/tool-provider/runtime-service.d.ts.map +0 -1
- package/dist/tool-provider/schemas.d.ts.map +0 -1
- package/dist/tool-provider/spawn-agent-tool.d.ts +0 -10
- package/dist/tool-provider/spawn-agent-tool.d.ts.map +0 -1
- package/dist/tool-provider/tool-provider.cjs +0 -197
- package/dist/tool-provider/tool-provider.d.ts +0 -30
- package/dist/tool-provider/tool-provider.d.ts.map +0 -1
- package/dist/tool-provider/tool-provider.js +0 -180
- package/dist/tool-provider/types.d.ts.map +0 -1
- /package/dist/{tool-provider → tool-factories/agent-spawner}/error-codes.cjs +0 -0
- /package/dist/{tool-provider → tool-factories/agent-spawner}/error-codes.js +0 -0
- /package/dist/{tool-provider → tool-factories/agent-spawner}/errors.cjs +0 -0
- /package/dist/{tool-provider → tool-factories/agent-spawner}/errors.js +0 -0
- /package/dist/{tool-provider → tool-factories/agent-spawner}/llm-resolution.cjs +0 -0
- /package/dist/{tool-provider → tool-factories/agent-spawner}/llm-resolution.d.ts +0 -0
- /package/dist/{tool-provider → tool-factories/agent-spawner}/llm-resolution.js +0 -0
- /package/dist/{tool-provider → tool-factories/agent-spawner}/types.cjs +0 -0
- /package/dist/{tool-provider → tool-factories/agent-spawner}/types.d.ts +0 -0
- /package/dist/{tool-provider → tool-factories/agent-spawner}/types.js +0 -0
|
@@ -85,10 +85,14 @@ const PreferenceSetupSchema = import_zod.z.object({
|
|
|
85
85
|
}).strict();
|
|
86
86
|
const PreferenceSoundsSchema = import_zod.z.object({
|
|
87
87
|
enabled: import_zod.z.boolean().default(true).describe("Enable sound notifications (default: true)"),
|
|
88
|
+
onStartup: import_zod.z.boolean().default(false).describe("Play sound when the interactive CLI starts (default: false)"),
|
|
89
|
+
startupSoundFile: import_zod.z.string().min(1).optional().describe("Startup sound file path relative to ~/.dexto/sounds (optional)"),
|
|
88
90
|
onApprovalRequired: import_zod.z.boolean().default(true).describe(
|
|
89
91
|
"Play sound when tool approval is required (default: true when sounds enabled)"
|
|
90
92
|
),
|
|
91
|
-
|
|
93
|
+
approvalSoundFile: import_zod.z.string().min(1).optional().describe("Approval sound file path relative to ~/.dexto/sounds (optional)"),
|
|
94
|
+
onTaskComplete: import_zod.z.boolean().default(true).describe("Play sound when agent task completes (default: true when sounds enabled)"),
|
|
95
|
+
completeSoundFile: import_zod.z.string().min(1).optional().describe("Completion sound file path relative to ~/.dexto/sounds (optional)")
|
|
92
96
|
}).strict();
|
|
93
97
|
const AgentToolPreferencesSchema = import_zod.z.object({
|
|
94
98
|
disabled: import_zod.z.array(import_core3.NonEmptyTrimmed).default([]).describe("Tool names disabled for this agent (default: none)")
|
|
@@ -55,16 +55,28 @@ export declare const PreferenceSetupSchema: z.ZodObject<{
|
|
|
55
55
|
}>;
|
|
56
56
|
export declare const PreferenceSoundsSchema: z.ZodObject<{
|
|
57
57
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
58
|
+
onStartup: z.ZodDefault<z.ZodBoolean>;
|
|
59
|
+
startupSoundFile: z.ZodOptional<z.ZodString>;
|
|
58
60
|
onApprovalRequired: z.ZodDefault<z.ZodBoolean>;
|
|
61
|
+
approvalSoundFile: z.ZodOptional<z.ZodString>;
|
|
59
62
|
onTaskComplete: z.ZodDefault<z.ZodBoolean>;
|
|
63
|
+
completeSoundFile: z.ZodOptional<z.ZodString>;
|
|
60
64
|
}, "strict", z.ZodTypeAny, {
|
|
61
65
|
enabled: boolean;
|
|
66
|
+
onStartup: boolean;
|
|
62
67
|
onApprovalRequired: boolean;
|
|
63
68
|
onTaskComplete: boolean;
|
|
69
|
+
startupSoundFile?: string | undefined;
|
|
70
|
+
approvalSoundFile?: string | undefined;
|
|
71
|
+
completeSoundFile?: string | undefined;
|
|
64
72
|
}, {
|
|
65
73
|
enabled?: boolean | undefined;
|
|
74
|
+
onStartup?: boolean | undefined;
|
|
75
|
+
startupSoundFile?: string | undefined;
|
|
66
76
|
onApprovalRequired?: boolean | undefined;
|
|
77
|
+
approvalSoundFile?: string | undefined;
|
|
67
78
|
onTaskComplete?: boolean | undefined;
|
|
79
|
+
completeSoundFile?: string | undefined;
|
|
68
80
|
}>;
|
|
69
81
|
export declare const AgentToolPreferencesSchema: z.ZodObject<{
|
|
70
82
|
disabled: z.ZodDefault<z.ZodArray<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, "many">>;
|
|
@@ -147,16 +159,28 @@ export declare const GlobalPreferencesSchema: z.ZodObject<{
|
|
|
147
159
|
}>>;
|
|
148
160
|
sounds: z.ZodDefault<z.ZodObject<{
|
|
149
161
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
162
|
+
onStartup: z.ZodDefault<z.ZodBoolean>;
|
|
163
|
+
startupSoundFile: z.ZodOptional<z.ZodString>;
|
|
150
164
|
onApprovalRequired: z.ZodDefault<z.ZodBoolean>;
|
|
165
|
+
approvalSoundFile: z.ZodOptional<z.ZodString>;
|
|
151
166
|
onTaskComplete: z.ZodDefault<z.ZodBoolean>;
|
|
167
|
+
completeSoundFile: z.ZodOptional<z.ZodString>;
|
|
152
168
|
}, "strict", z.ZodTypeAny, {
|
|
153
169
|
enabled: boolean;
|
|
170
|
+
onStartup: boolean;
|
|
154
171
|
onApprovalRequired: boolean;
|
|
155
172
|
onTaskComplete: boolean;
|
|
173
|
+
startupSoundFile?: string | undefined;
|
|
174
|
+
approvalSoundFile?: string | undefined;
|
|
175
|
+
completeSoundFile?: string | undefined;
|
|
156
176
|
}, {
|
|
157
177
|
enabled?: boolean | undefined;
|
|
178
|
+
onStartup?: boolean | undefined;
|
|
179
|
+
startupSoundFile?: string | undefined;
|
|
158
180
|
onApprovalRequired?: boolean | undefined;
|
|
181
|
+
approvalSoundFile?: string | undefined;
|
|
159
182
|
onTaskComplete?: boolean | undefined;
|
|
183
|
+
completeSoundFile?: string | undefined;
|
|
160
184
|
}>>;
|
|
161
185
|
}, "strict", z.ZodTypeAny, {
|
|
162
186
|
llm: {
|
|
@@ -177,8 +201,12 @@ export declare const GlobalPreferencesSchema: z.ZodObject<{
|
|
|
177
201
|
};
|
|
178
202
|
sounds: {
|
|
179
203
|
enabled: boolean;
|
|
204
|
+
onStartup: boolean;
|
|
180
205
|
onApprovalRequired: boolean;
|
|
181
206
|
onTaskComplete: boolean;
|
|
207
|
+
startupSoundFile?: string | undefined;
|
|
208
|
+
approvalSoundFile?: string | undefined;
|
|
209
|
+
completeSoundFile?: string | undefined;
|
|
182
210
|
};
|
|
183
211
|
}, {
|
|
184
212
|
llm: {
|
|
@@ -199,8 +227,12 @@ export declare const GlobalPreferencesSchema: z.ZodObject<{
|
|
|
199
227
|
} | undefined;
|
|
200
228
|
sounds?: {
|
|
201
229
|
enabled?: boolean | undefined;
|
|
230
|
+
onStartup?: boolean | undefined;
|
|
231
|
+
startupSoundFile?: string | undefined;
|
|
202
232
|
onApprovalRequired?: boolean | undefined;
|
|
233
|
+
approvalSoundFile?: string | undefined;
|
|
203
234
|
onTaskComplete?: boolean | undefined;
|
|
235
|
+
completeSoundFile?: string | undefined;
|
|
204
236
|
} | undefined;
|
|
205
237
|
}>;
|
|
206
238
|
export type PreferenceLLM = z.output<typeof PreferenceLLMSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/preferences/schemas.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsE1B,CAAC;AAEP,eAAO,MAAM,wBAAwB;;;;;;;;;EAYxB,CAAC;AAEd,eAAO,MAAM,qBAAqB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vE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
|
|
@@ -62,10 +62,14 @@ const PreferenceSetupSchema = z.object({
|
|
|
62
62
|
}).strict();
|
|
63
63
|
const PreferenceSoundsSchema = z.object({
|
|
64
64
|
enabled: z.boolean().default(true).describe("Enable sound notifications (default: true)"),
|
|
65
|
+
onStartup: z.boolean().default(false).describe("Play sound when the interactive CLI starts (default: false)"),
|
|
66
|
+
startupSoundFile: z.string().min(1).optional().describe("Startup sound file path relative to ~/.dexto/sounds (optional)"),
|
|
65
67
|
onApprovalRequired: z.boolean().default(true).describe(
|
|
66
68
|
"Play sound when tool approval is required (default: true when sounds enabled)"
|
|
67
69
|
),
|
|
68
|
-
|
|
70
|
+
approvalSoundFile: z.string().min(1).optional().describe("Approval sound file path relative to ~/.dexto/sounds (optional)"),
|
|
71
|
+
onTaskComplete: z.boolean().default(true).describe("Play sound when agent task completes (default: true when sounds enabled)"),
|
|
72
|
+
completeSoundFile: z.string().min(1).optional().describe("Completion sound file path relative to ~/.dexto/sounds (optional)")
|
|
69
73
|
}).strict();
|
|
70
74
|
const AgentToolPreferencesSchema = z.object({
|
|
71
75
|
disabled: z.array(NonEmptyTrimmed).default([]).describe("Tool names disabled for this agent (default: none)")
|
|
@@ -1,51 +1,11 @@
|
|
|
1
1
|
import { Registry, AgentRegistry, AgentRegistryEntry } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Local agent registry implementation
|
|
4
|
+
* Loads and merges the bundled registry (shipped with the CLI bundle) with the user's custom
|
|
5
|
+
* registry under `~/.dexto`.
|
|
4
6
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* PROBLEM: Registry operations are CLI concerns but live in Core, causing:
|
|
8
|
-
* - Missing analytics for auto-install (when running `dexto`, registry installs agents but doesn't track)
|
|
9
|
-
* - Wrong separation of concerns (Core = execution engine, not discovery/setup)
|
|
10
|
-
* - Registry manages ~/.dexto/agents filesystem which is CLI-level setup
|
|
11
|
-
*
|
|
12
|
-
* THE RIGHT ARCHITECTURE:
|
|
13
|
-
*
|
|
14
|
-
* Move to CLI:
|
|
15
|
-
* 1. Agent Registry (packages/core/src/agent/registry/) → packages/cli/src/registry/
|
|
16
|
-
* - installAgent(), uninstallAgent(), resolveAgent(), listAgents()
|
|
17
|
-
* - Can directly call capture() for analytics
|
|
18
|
-
* - Manages ~/.dexto/agents installation directory
|
|
19
|
-
*
|
|
20
|
-
* 2. Global Preferences (packages/core/src/preferences/) → packages/cli/src/preferences/
|
|
21
|
-
* - User's default LLM, model, default agent
|
|
22
|
-
* - Used by `dexto setup` command
|
|
23
|
-
* - Manages ~/.dexto/preferences.json
|
|
24
|
-
*
|
|
25
|
-
* 3. Agent Resolution (packages/core/src/config/agent-resolver.ts) → packages/cli/src/agent-resolver.ts
|
|
26
|
-
* - Discovery logic: check registry, trigger installs, apply preferences
|
|
27
|
-
* - Returns resolved config PATH to core
|
|
28
|
-
*
|
|
29
|
-
* Core keeps:
|
|
30
|
-
* - config/loader.ts - Load YAML from path
|
|
31
|
-
* - config/schemas.ts - Zod validation
|
|
32
|
-
* - Agent execution (DextoAgent, LLM, tools, MCP)
|
|
33
|
-
*
|
|
34
|
-
* FLOW AFTER REFACTOR:
|
|
35
|
-
* CLI index.ts:
|
|
36
|
-
* → CLI: resolveAgentPath() (discovery logic)
|
|
37
|
-
* → CLI: registry.resolveAgent()
|
|
38
|
-
* → CLI: registry.installAgent() if needed
|
|
39
|
-
* → CLI: capture('dexto_install_agent', ...) ✓ Natural!
|
|
40
|
-
* → Core: new DextoAgent(configPath) (just loads & runs)
|
|
41
|
-
*
|
|
42
|
-
* BENEFITS:
|
|
43
|
-
* - Clear separation: CLI = setup/discovery, Core = execution
|
|
44
|
-
* - Analytics naturally colocated with operations
|
|
45
|
-
* - Core is portable (no CLI dependencies)
|
|
46
|
-
* - No circular deps (CLI → Core, correct direction)
|
|
47
|
-
*
|
|
48
|
-
* ESTIMATE: ~3-4 hours (mostly moving code + updating imports)
|
|
7
|
+
* Hosts (CLI, server, apps) use this to resolve an agent ID to a concrete YAML path, then
|
|
8
|
+
* load/validate that YAML and instantiate a `DextoAgent` from the resolved config.
|
|
49
9
|
*/
|
|
50
10
|
export declare class LocalAgentRegistry implements AgentRegistry {
|
|
51
11
|
private _registry;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/registry/registry.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,QAAQ,EAER,aAAa,EACb,kBAAkB,EAErB,MAAM,YAAY,CAAC;AAapB
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/registry/registry.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,QAAQ,EAER,aAAa,EACb,kBAAkB,EAErB,MAAM,YAAY,CAAC;AAapB;;;;;;;GAOG;AACH,qBAAa,kBAAmB,YAAW,aAAa;IACpD,OAAO,CAAC,SAAS,CAAyB;IAE1C;;OAEG;IACH,WAAW,IAAI,QAAQ;IAOvB;;;OAGG;IACH,OAAO,CAAC,YAAY;IAyCpB;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAKlC;;OAEG;IACH,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC;IAKxD;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAgC7B;;;OAGG;IACH,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;IA0C5D;;;OAGG;IACG,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAgFpD;;;;;;OAMG;IACG,0BAA0B,CAC5B,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,EAAE,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;KACjB,GACF,OAAO,CAAC,MAAM,CAAC;IAqJlB;;;;;;OAMG;IACG,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,GAAE,OAAc,GAAG,OAAO,CAAC,MAAM,CAAC;IAsCjF;;OAEG;IACG,kBAAkB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAsB7C;;OAEG;YACW,sBAAsB;IAYpC;;;;;;OAMG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC;CA8C/E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,kBAAkB,CAKrD;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAY9E"}
|
package/dist/registry/types.cjs
CHANGED
|
@@ -36,6 +36,7 @@ const AgentRegistryEntrySchema = import_zod.z.object({
|
|
|
36
36
|
tags: import_zod.z.array(import_zod.z.string()),
|
|
37
37
|
source: import_zod.z.string(),
|
|
38
38
|
main: import_zod.z.string().optional(),
|
|
39
|
+
enabled: import_zod.z.boolean().optional(),
|
|
39
40
|
type: import_zod.z.enum(["builtin", "custom"]).default("builtin").describe("Agent type")
|
|
40
41
|
}).strict();
|
|
41
42
|
const RegistrySchema = import_zod.z.object({
|
|
@@ -52,6 +53,9 @@ function normalizeRegistryJson(raw) {
|
|
|
52
53
|
for (const [agentId, value] of Object.entries(agents)) {
|
|
53
54
|
if (!value || typeof value !== "object") continue;
|
|
54
55
|
const entry = { ...value };
|
|
56
|
+
if (entry.enabled === false) {
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
55
59
|
if (!entry.id || typeof entry.id !== "string" || entry.id.trim() !== agentId) {
|
|
56
60
|
entry.id = agentId;
|
|
57
61
|
}
|
package/dist/registry/types.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare const AgentRegistryEntrySchema: z.ZodObject<{
|
|
|
11
11
|
tags: z.ZodArray<z.ZodString, "many">;
|
|
12
12
|
source: z.ZodString;
|
|
13
13
|
main: z.ZodOptional<z.ZodString>;
|
|
14
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
14
15
|
type: z.ZodDefault<z.ZodEnum<["builtin", "custom"]>>;
|
|
15
16
|
}, "strict", z.ZodTypeAny, {
|
|
16
17
|
id: string;
|
|
@@ -21,6 +22,7 @@ export declare const AgentRegistryEntrySchema: z.ZodObject<{
|
|
|
21
22
|
type: "custom" | "builtin";
|
|
22
23
|
source: string;
|
|
23
24
|
main?: string | undefined;
|
|
25
|
+
enabled?: boolean | undefined;
|
|
24
26
|
}, {
|
|
25
27
|
id: string;
|
|
26
28
|
name: string;
|
|
@@ -30,6 +32,7 @@ export declare const AgentRegistryEntrySchema: z.ZodObject<{
|
|
|
30
32
|
source: string;
|
|
31
33
|
type?: "custom" | "builtin" | undefined;
|
|
32
34
|
main?: string | undefined;
|
|
35
|
+
enabled?: boolean | undefined;
|
|
33
36
|
}>;
|
|
34
37
|
export type AgentRegistryEntry = z.output<typeof AgentRegistryEntrySchema>;
|
|
35
38
|
/**
|
|
@@ -45,6 +48,7 @@ export declare const RegistrySchema: z.ZodObject<{
|
|
|
45
48
|
tags: z.ZodArray<z.ZodString, "many">;
|
|
46
49
|
source: z.ZodString;
|
|
47
50
|
main: z.ZodOptional<z.ZodString>;
|
|
51
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
48
52
|
type: z.ZodDefault<z.ZodEnum<["builtin", "custom"]>>;
|
|
49
53
|
}, "strict", z.ZodTypeAny, {
|
|
50
54
|
id: string;
|
|
@@ -55,6 +59,7 @@ export declare const RegistrySchema: z.ZodObject<{
|
|
|
55
59
|
type: "custom" | "builtin";
|
|
56
60
|
source: string;
|
|
57
61
|
main?: string | undefined;
|
|
62
|
+
enabled?: boolean | undefined;
|
|
58
63
|
}, {
|
|
59
64
|
id: string;
|
|
60
65
|
name: string;
|
|
@@ -64,6 +69,7 @@ export declare const RegistrySchema: z.ZodObject<{
|
|
|
64
69
|
source: string;
|
|
65
70
|
type?: "custom" | "builtin" | undefined;
|
|
66
71
|
main?: string | undefined;
|
|
72
|
+
enabled?: boolean | undefined;
|
|
67
73
|
}>>;
|
|
68
74
|
}, "strict", z.ZodTypeAny, {
|
|
69
75
|
version: string;
|
|
@@ -76,6 +82,7 @@ export declare const RegistrySchema: z.ZodObject<{
|
|
|
76
82
|
type: "custom" | "builtin";
|
|
77
83
|
source: string;
|
|
78
84
|
main?: string | undefined;
|
|
85
|
+
enabled?: boolean | undefined;
|
|
79
86
|
}>;
|
|
80
87
|
}, {
|
|
81
88
|
version: string;
|
|
@@ -88,6 +95,7 @@ export declare const RegistrySchema: z.ZodObject<{
|
|
|
88
95
|
source: string;
|
|
89
96
|
type?: "custom" | "builtin" | undefined;
|
|
90
97
|
main?: string | undefined;
|
|
98
|
+
enabled?: boolean | undefined;
|
|
91
99
|
}>;
|
|
92
100
|
}>;
|
|
93
101
|
export type Registry = z.output<typeof RegistrySchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/registry/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMtD;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/registry/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMtD;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;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(),
|
|
12
12
|
main: z.string().optional(),
|
|
13
|
+
enabled: z.boolean().optional(),
|
|
13
14
|
type: z.enum(["builtin", "custom"]).default("builtin").describe("Agent type")
|
|
14
15
|
}).strict();
|
|
15
16
|
const RegistrySchema = z.object({
|
|
@@ -26,6 +27,9 @@ function normalizeRegistryJson(raw) {
|
|
|
26
27
|
for (const [agentId, value] of Object.entries(agents)) {
|
|
27
28
|
if (!value || typeof value !== "object") continue;
|
|
28
29
|
const entry = { ...value };
|
|
30
|
+
if (entry.enabled === false) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
29
33
|
if (!entry.id || typeof entry.id !== "string" || entry.id.trim() !== agentId) {
|
|
30
34
|
entry.id = agentId;
|
|
31
35
|
}
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
* Tracks active agents, enforces resource limits, and provides
|
|
5
5
|
* lookup and lifecycle management capabilities.
|
|
6
6
|
*/
|
|
7
|
-
import type {
|
|
7
|
+
import type { Logger } from '@dexto/core';
|
|
8
8
|
import type { AgentHandle, AgentStatus, AgentFilter } from './types.js';
|
|
9
9
|
import { type ValidatedAgentRuntimeConfig } from './schemas.js';
|
|
10
10
|
export declare class AgentPool {
|
|
11
11
|
private agents;
|
|
12
12
|
private config;
|
|
13
13
|
private logger;
|
|
14
|
-
constructor(config: Partial<ValidatedAgentRuntimeConfig>, logger:
|
|
14
|
+
constructor(config: Partial<ValidatedAgentRuntimeConfig>, logger: Logger);
|
|
15
15
|
/**
|
|
16
16
|
* Add an agent handle to the pool
|
|
17
17
|
* @throws RuntimeError if agent with same ID already exists or limit exceeded
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentPool.d.ts","sourceRoot":"","sources":["../../src/runtime/AgentPool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"AgentPool.d.ts","sourceRoot":"","sources":["../../src/runtime/AgentPool.ts"],"names":[],"mappings":"AAAA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|
@@ -22,11 +22,10 @@ __export(AgentRuntime_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(AgentRuntime_exports);
|
|
24
24
|
var import_crypto = require("crypto");
|
|
25
|
-
var import_core = require("@dexto/core");
|
|
26
|
-
var import_config = require("../config/index.js");
|
|
27
25
|
var import_AgentPool = require("./AgentPool.js");
|
|
28
26
|
var import_errors = require("./errors.js");
|
|
29
27
|
var import_schemas = require("./schemas.js");
|
|
28
|
+
var import_agent_creation = require("../agent-creation.js");
|
|
30
29
|
class AgentRuntime {
|
|
31
30
|
pool;
|
|
32
31
|
config;
|
|
@@ -55,14 +54,16 @@ class AgentRuntime {
|
|
|
55
54
|
throw import_errors.RuntimeError.agentAlreadyExists(agentId);
|
|
56
55
|
}
|
|
57
56
|
try {
|
|
58
|
-
const
|
|
59
|
-
config.agentConfig,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
const agent = await (0, import_agent_creation.createDextoAgentFromConfig)({
|
|
58
|
+
config: config.agentConfig,
|
|
59
|
+
enrichOptions: {
|
|
60
|
+
isInteractiveCli: false,
|
|
61
|
+
skipPluginDiscovery: true,
|
|
62
|
+
forceStoragePaths: true
|
|
63
|
+
},
|
|
64
|
+
agentIdOverride: agentId,
|
|
65
|
+
agentContext: "subagent"
|
|
66
|
+
});
|
|
66
67
|
const sessionId = `session-${(0, import_crypto.randomUUID)().slice(0, 8)}`;
|
|
67
68
|
const handle = {
|
|
68
69
|
agentId,
|
|
@@ -113,16 +114,28 @@ class AgentRuntime {
|
|
|
113
114
|
const taskTimeout = timeout ?? this.config.defaultTaskTimeout;
|
|
114
115
|
this.pool.updateStatus(agentId, "running");
|
|
115
116
|
try {
|
|
116
|
-
const timeoutPromise = new Promise((_, reject) => {
|
|
117
|
-
setTimeout(() => {
|
|
118
|
-
reject(import_errors.RuntimeError.taskTimeout(agentId, taskTimeout));
|
|
119
|
-
}, taskTimeout);
|
|
120
|
-
});
|
|
121
117
|
const generatePromise = handle.agent.generate(task, handle.sessionId);
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
118
|
+
let response;
|
|
119
|
+
if (taskTimeout === 0) {
|
|
120
|
+
response = await generatePromise;
|
|
121
|
+
} else {
|
|
122
|
+
let timeoutId;
|
|
123
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
124
|
+
timeoutId = setTimeout(() => {
|
|
125
|
+
reject(import_errors.RuntimeError.taskTimeout(agentId, taskTimeout));
|
|
126
|
+
}, taskTimeout);
|
|
127
|
+
});
|
|
128
|
+
try {
|
|
129
|
+
response = await Promise.race([
|
|
130
|
+
generatePromise,
|
|
131
|
+
timeoutPromise
|
|
132
|
+
]);
|
|
133
|
+
} finally {
|
|
134
|
+
if (timeoutId) {
|
|
135
|
+
clearTimeout(timeoutId);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
126
139
|
this.pool.updateStatus(agentId, "idle");
|
|
127
140
|
const result = {
|
|
128
141
|
success: true,
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* - Track agent status and lifecycle
|
|
14
14
|
* - Clean up agents when no longer needed
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
16
|
+
import type { Logger } from '@dexto/core';
|
|
17
17
|
import type { AgentRuntimeConfig, SpawnConfig, AgentHandle, TaskResult, AgentFilter } from './types.js';
|
|
18
18
|
import { type ValidatedAgentRuntimeConfig } from './schemas.js';
|
|
19
19
|
/**
|
|
@@ -23,7 +23,7 @@ export interface AgentRuntimeOptions {
|
|
|
23
23
|
/** Runtime configuration */
|
|
24
24
|
config?: AgentRuntimeConfig;
|
|
25
25
|
/** Logger instance */
|
|
26
|
-
logger:
|
|
26
|
+
logger: Logger;
|
|
27
27
|
}
|
|
28
28
|
export declare class AgentRuntime {
|
|
29
29
|
private pool;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentRuntime.d.ts","sourceRoot":"","sources":["../../src/runtime/AgentRuntime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,
|
|
1
|
+
{"version":3,"file":"AgentRuntime.d.ts","sourceRoot":"","sources":["../../src/runtime/AgentRuntime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAoB,MAAM,aAAa,CAAC;AAG5D,OAAO,KAAK,EACR,kBAAkB,EAClB,WAAW,EACX,WAAW,EACX,UAAU,EACV,WAAW,EACd,MAAM,YAAY,CAAC;AACpB,OAAO,EAA4B,KAAK,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAG1F;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,4BAA4B;IAC5B,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,YAAY;IACrB,OAAO,CAAC,IAAI,CAAY;IACxB,OAAO,CAAC,MAAM,CAA8B;IAC5C,OAAO,CAAC,MAAM,CAAS;gBAEX,OAAO,EAAE,mBAAmB;IAYxC;;;;;OAKG;IACG,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAwE3D;;;;;;;OAOG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAgFvF;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAIlD;;OAEG;IACH,UAAU,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,WAAW,EAAE;IAI/C;;OAEG;IACG,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsC/C;;OAEG;IACG,OAAO,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IASlD;;OAEG;IACH,SAAS,IAAI,2BAA2B;IAIxC;;OAEG;IACH,QAAQ,IAAI;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE;CAaxE"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { randomUUID } from "crypto";
|
|
2
|
-
import { DextoAgent } from "@dexto/core";
|
|
3
|
-
import { enrichAgentConfig } from "../config/index.js";
|
|
4
2
|
import { AgentPool } from "./AgentPool.js";
|
|
5
3
|
import { RuntimeError } from "./errors.js";
|
|
6
4
|
import { AgentRuntimeConfigSchema } from "./schemas.js";
|
|
5
|
+
import { createDextoAgentFromConfig } from "../agent-creation.js";
|
|
7
6
|
class AgentRuntime {
|
|
8
7
|
pool;
|
|
9
8
|
config;
|
|
@@ -32,14 +31,16 @@ class AgentRuntime {
|
|
|
32
31
|
throw RuntimeError.agentAlreadyExists(agentId);
|
|
33
32
|
}
|
|
34
33
|
try {
|
|
35
|
-
const
|
|
36
|
-
config.agentConfig,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
const agent = await createDextoAgentFromConfig({
|
|
35
|
+
config: config.agentConfig,
|
|
36
|
+
enrichOptions: {
|
|
37
|
+
isInteractiveCli: false,
|
|
38
|
+
skipPluginDiscovery: true,
|
|
39
|
+
forceStoragePaths: true
|
|
40
|
+
},
|
|
41
|
+
agentIdOverride: agentId,
|
|
42
|
+
agentContext: "subagent"
|
|
43
|
+
});
|
|
43
44
|
const sessionId = `session-${randomUUID().slice(0, 8)}`;
|
|
44
45
|
const handle = {
|
|
45
46
|
agentId,
|
|
@@ -90,16 +91,28 @@ class AgentRuntime {
|
|
|
90
91
|
const taskTimeout = timeout ?? this.config.defaultTaskTimeout;
|
|
91
92
|
this.pool.updateStatus(agentId, "running");
|
|
92
93
|
try {
|
|
93
|
-
const timeoutPromise = new Promise((_, reject) => {
|
|
94
|
-
setTimeout(() => {
|
|
95
|
-
reject(RuntimeError.taskTimeout(agentId, taskTimeout));
|
|
96
|
-
}, taskTimeout);
|
|
97
|
-
});
|
|
98
94
|
const generatePromise = handle.agent.generate(task, handle.sessionId);
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
95
|
+
let response;
|
|
96
|
+
if (taskTimeout === 0) {
|
|
97
|
+
response = await generatePromise;
|
|
98
|
+
} else {
|
|
99
|
+
let timeoutId;
|
|
100
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
101
|
+
timeoutId = setTimeout(() => {
|
|
102
|
+
reject(RuntimeError.taskTimeout(agentId, taskTimeout));
|
|
103
|
+
}, taskTimeout);
|
|
104
|
+
});
|
|
105
|
+
try {
|
|
106
|
+
response = await Promise.race([
|
|
107
|
+
generatePromise,
|
|
108
|
+
timeoutPromise
|
|
109
|
+
]);
|
|
110
|
+
} finally {
|
|
111
|
+
if (timeoutId) {
|
|
112
|
+
clearTimeout(timeoutId);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
103
116
|
this.pool.updateStatus(agentId, "idle");
|
|
104
117
|
const result = {
|
|
105
118
|
success: true,
|
|
@@ -21,7 +21,7 @@ __export(approval_delegation_exports, {
|
|
|
21
21
|
createDelegatingApprovalHandler: () => createDelegatingApprovalHandler
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(approval_delegation_exports);
|
|
24
|
-
function createDelegatingApprovalHandler(parentApprovalManager, subAgentId, logger) {
|
|
24
|
+
function createDelegatingApprovalHandler(parentApprovalManager, subAgentId, parentSessionId, logger) {
|
|
25
25
|
const pendingApprovalIds = /* @__PURE__ */ new Set();
|
|
26
26
|
const handler = Object.assign(
|
|
27
27
|
async (request) => {
|
|
@@ -33,10 +33,13 @@ function createDelegatingApprovalHandler(parentApprovalManager, subAgentId, logg
|
|
|
33
33
|
const delegatedDetails = {
|
|
34
34
|
type: request.type,
|
|
35
35
|
timeout: request.timeout,
|
|
36
|
-
|
|
36
|
+
// IMPORTANT: use the parent sessionId so the interactive CLI surfaces
|
|
37
|
+
// the approval in the correct active session.
|
|
38
|
+
sessionId: parentSessionId ?? request.sessionId,
|
|
37
39
|
metadata: {
|
|
38
40
|
...request.metadata,
|
|
39
|
-
delegatedFromAgent: subAgentId
|
|
41
|
+
delegatedFromAgent: subAgentId,
|
|
42
|
+
delegatedFromSessionId: request.sessionId
|
|
40
43
|
}
|
|
41
44
|
};
|
|
42
45
|
const response = await parentApprovalManager.requestApproval(delegatedDetails);
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Creates ApprovalHandler instances that delegate approval requests
|
|
5
5
|
* from sub-agents to the parent agent's approval system.
|
|
6
6
|
*/
|
|
7
|
-
import type { ApprovalHandler, ApprovalManager,
|
|
7
|
+
import type { ApprovalHandler, ApprovalManager, Logger } from '@dexto/core';
|
|
8
8
|
/**
|
|
9
9
|
* Creates an ApprovalHandler that delegates requests to a parent's ApprovalManager.
|
|
10
10
|
*
|
|
@@ -21,10 +21,11 @@ import type { ApprovalHandler, ApprovalManager, IDextoLogger } from '@dexto/core
|
|
|
21
21
|
* const delegatingHandler = createDelegatingApprovalHandler(
|
|
22
22
|
* parentAgent.services.approvalManager,
|
|
23
23
|
* subAgentId,
|
|
24
|
+
* parentSessionId,
|
|
24
25
|
* logger
|
|
25
26
|
* );
|
|
26
27
|
* subAgent.services.approvalManager.setHandler(delegatingHandler);
|
|
27
28
|
* ```
|
|
28
29
|
*/
|
|
29
|
-
export declare function createDelegatingApprovalHandler(parentApprovalManager: ApprovalManager, subAgentId: string, logger:
|
|
30
|
+
export declare function createDelegatingApprovalHandler(parentApprovalManager: ApprovalManager, subAgentId: string, parentSessionId: string | undefined, logger: Logger): ApprovalHandler;
|
|
30
31
|
//# sourceMappingURL=approval-delegation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approval-delegation.d.ts","sourceRoot":"","sources":["../../src/runtime/approval-delegation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACR,eAAe,EAIf,eAAe,EACf,
|
|
1
|
+
{"version":3,"file":"approval-delegation.d.ts","sourceRoot":"","sources":["../../src/runtime/approval-delegation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACR,eAAe,EAIf,eAAe,EACf,MAAM,EACT,MAAM,aAAa,CAAC;AAerB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,+BAA+B,CAC3C,qBAAqB,EAAE,eAAe,EACtC,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,MAAM,GAAG,SAAS,EACnC,MAAM,EAAE,MAAM,GACf,eAAe,CAwFjB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function createDelegatingApprovalHandler(parentApprovalManager, subAgentId, logger) {
|
|
1
|
+
function createDelegatingApprovalHandler(parentApprovalManager, subAgentId, parentSessionId, logger) {
|
|
2
2
|
const pendingApprovalIds = /* @__PURE__ */ new Set();
|
|
3
3
|
const handler = Object.assign(
|
|
4
4
|
async (request) => {
|
|
@@ -10,10 +10,13 @@ function createDelegatingApprovalHandler(parentApprovalManager, subAgentId, logg
|
|
|
10
10
|
const delegatedDetails = {
|
|
11
11
|
type: request.type,
|
|
12
12
|
timeout: request.timeout,
|
|
13
|
-
|
|
13
|
+
// IMPORTANT: use the parent sessionId so the interactive CLI surfaces
|
|
14
|
+
// the approval in the correct active session.
|
|
15
|
+
sessionId: parentSessionId ?? request.sessionId,
|
|
14
16
|
metadata: {
|
|
15
17
|
...request.metadata,
|
|
16
|
-
delegatedFromAgent: subAgentId
|
|
18
|
+
delegatedFromAgent: subAgentId,
|
|
19
|
+
delegatedFromSessionId: request.sessionId
|
|
17
20
|
}
|
|
18
21
|
};
|
|
19
22
|
const response = await parentApprovalManager.requestApproval(delegatedDetails);
|
package/dist/runtime/schemas.cjs
CHANGED
|
@@ -31,7 +31,7 @@ const DEFAULT_MAX_AGENTS = 20;
|
|
|
31
31
|
const DEFAULT_TASK_TIMEOUT = 3e5;
|
|
32
32
|
const AgentRuntimeConfigSchema = import_zod.z.object({
|
|
33
33
|
maxAgents: import_zod.z.number().int().positive().default(DEFAULT_MAX_AGENTS).describe("Maximum total agents managed by this runtime"),
|
|
34
|
-
defaultTaskTimeout: import_zod.z.number().int().
|
|
34
|
+
defaultTaskTimeout: import_zod.z.number().int().nonnegative().default(DEFAULT_TASK_TIMEOUT).describe("Default task timeout in milliseconds (0 = no timeout)")
|
|
35
35
|
}).strict().describe("Configuration for the AgentRuntime");
|
|
36
36
|
const SpawnConfigSchema = import_zod.z.object({
|
|
37
37
|
agentConfig: import_zod.z.record(import_zod.z.unknown()).describe("Base agent configuration"),
|
|
@@ -22,7 +22,7 @@ export declare const AgentRuntimeConfigSchema: z.ZodObject<{
|
|
|
22
22
|
export type ValidatedAgentRuntimeConfig = z.output<typeof AgentRuntimeConfigSchema>;
|
|
23
23
|
/**
|
|
24
24
|
* Schema for SpawnConfig
|
|
25
|
-
* Note: agentConfig is not validated here as it uses the
|
|
25
|
+
* Note: agentConfig is not validated here as it uses the agent-config AgentConfigSchema
|
|
26
26
|
*/
|
|
27
27
|
export declare const SpawnConfigSchema: z.ZodObject<{
|
|
28
28
|
agentConfig: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
package/dist/runtime/schemas.js
CHANGED
|
@@ -3,7 +3,7 @@ const DEFAULT_MAX_AGENTS = 20;
|
|
|
3
3
|
const DEFAULT_TASK_TIMEOUT = 3e5;
|
|
4
4
|
const AgentRuntimeConfigSchema = z.object({
|
|
5
5
|
maxAgents: z.number().int().positive().default(DEFAULT_MAX_AGENTS).describe("Maximum total agents managed by this runtime"),
|
|
6
|
-
defaultTaskTimeout: z.number().int().
|
|
6
|
+
defaultTaskTimeout: z.number().int().nonnegative().default(DEFAULT_TASK_TIMEOUT).describe("Default task timeout in milliseconds (0 = no timeout)")
|
|
7
7
|
}).strict().describe("Configuration for the AgentRuntime");
|
|
8
8
|
const SpawnConfigSchema = z.object({
|
|
9
9
|
agentConfig: z.record(z.unknown()).describe("Base agent configuration"),
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* Type definitions for the general-purpose agent runtime system that manages
|
|
5
5
|
* the lifecycle of multiple agent instances.
|
|
6
6
|
*/
|
|
7
|
-
import type {
|
|
7
|
+
import type { AgentConfig } from '@dexto/agent-config';
|
|
8
|
+
import type { DextoAgent } from '@dexto/core';
|
|
8
9
|
/**
|
|
9
10
|
* Configuration for spawning an agent
|
|
10
11
|
*/
|
|
@@ -77,7 +78,7 @@ export interface TaskResult {
|
|
|
77
78
|
export interface AgentRuntimeConfig {
|
|
78
79
|
/** Maximum total agents managed by this runtime (default: 20) */
|
|
79
80
|
maxAgents?: number;
|
|
80
|
-
/** Default task timeout in milliseconds (default: 300000 = 5 min) */
|
|
81
|
+
/** Default task timeout in milliseconds (default: 300000 = 5 min, 0 = no timeout) */
|
|
81
82
|
defaultTaskTimeout?: number;
|
|
82
83
|
}
|
|
83
84
|
/**
|