@dexto/agent-management 1.5.1 → 1.5.3
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/config/discover-prompts.cjs +14 -4
- package/dist/config/discover-prompts.d.ts +4 -4
- package/dist/config/discover-prompts.d.ts.map +1 -1
- package/dist/config/discover-prompts.js +14 -4
- package/dist/index.cjs +6 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/runtime/AgentPool.cjs +181 -0
- package/dist/runtime/AgentPool.d.ts +76 -0
- package/dist/runtime/AgentPool.d.ts.map +1 -0
- package/dist/runtime/AgentPool.js +160 -0
- package/dist/runtime/AgentRuntime.cjs +225 -0
- package/dist/runtime/AgentRuntime.d.ts +77 -0
- package/dist/runtime/AgentRuntime.d.ts.map +1 -0
- package/dist/runtime/AgentRuntime.js +201 -0
- package/dist/runtime/approval-delegation.cjs +97 -0
- package/dist/runtime/approval-delegation.d.ts +30 -0
- package/dist/runtime/approval-delegation.d.ts.map +1 -0
- package/dist/runtime/approval-delegation.js +73 -0
- package/dist/runtime/error-codes.cjs +40 -0
- package/dist/runtime/error-codes.d.ts +17 -0
- package/dist/runtime/error-codes.d.ts.map +1 -0
- package/dist/runtime/error-codes.js +16 -0
- package/dist/runtime/errors.cjs +135 -0
- package/dist/runtime/errors.d.ts +40 -0
- package/dist/runtime/errors.d.ts.map +1 -0
- package/dist/runtime/errors.js +111 -0
- package/dist/runtime/index.cjs +53 -0
- package/dist/runtime/index.d.ts +19 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +26 -0
- package/dist/runtime/schemas.cjs +64 -0
- package/dist/runtime/schemas.d.ts +69 -0
- package/dist/runtime/schemas.d.ts.map +1 -0
- package/dist/runtime/schemas.js +35 -0
- package/dist/runtime/types.cjs +16 -0
- package/dist/runtime/types.d.ts +94 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/types.js +0 -0
- package/dist/tool-provider/error-codes.cjs +35 -0
- package/dist/tool-provider/error-codes.d.ts +11 -0
- package/dist/tool-provider/error-codes.d.ts.map +1 -0
- package/dist/tool-provider/error-codes.js +11 -0
- package/dist/tool-provider/errors.cjs +81 -0
- package/dist/tool-provider/errors.d.ts +19 -0
- package/dist/tool-provider/errors.d.ts.map +1 -0
- package/dist/tool-provider/errors.js +57 -0
- package/dist/tool-provider/index.cjs +46 -0
- package/dist/tool-provider/index.d.ts +16 -0
- package/dist/tool-provider/index.d.ts.map +1 -0
- package/dist/tool-provider/index.js +16 -0
- package/dist/tool-provider/runtime-service.cjs +370 -0
- package/dist/tool-provider/runtime-service.d.ts +83 -0
- package/dist/tool-provider/runtime-service.d.ts.map +1 -0
- package/dist/tool-provider/runtime-service.js +346 -0
- package/dist/tool-provider/schemas.cjs +73 -0
- package/dist/tool-provider/schemas.d.ts +83 -0
- package/dist/tool-provider/schemas.d.ts.map +1 -0
- package/dist/tool-provider/schemas.js +48 -0
- package/dist/tool-provider/spawn-agent-tool.cjs +89 -0
- package/dist/tool-provider/spawn-agent-tool.d.ts +10 -0
- package/dist/tool-provider/spawn-agent-tool.d.ts.map +1 -0
- package/dist/tool-provider/spawn-agent-tool.js +65 -0
- package/dist/tool-provider/tool-provider.cjs +44 -0
- package/dist/tool-provider/tool-provider.d.ts +24 -0
- package/dist/tool-provider/tool-provider.d.ts.map +1 -0
- package/dist/tool-provider/tool-provider.js +20 -0
- package/dist/tool-provider/types.cjs +16 -0
- package/dist/tool-provider/types.d.ts +17 -0
- package/dist/tool-provider/types.d.ts.map +1 -0
- package/dist/tool-provider/types.js +0 -0
- package/package.json +2 -2
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { SpawnAgentInputSchema } from "./schemas.js";
|
|
2
|
+
function buildDescription(service) {
|
|
3
|
+
const availableAgents = service.getAvailableAgents();
|
|
4
|
+
if (availableAgents.length === 0) {
|
|
5
|
+
return `Spawn a sub-agent to handle a specific task. The sub-agent executes the task and returns the result.
|
|
6
|
+
|
|
7
|
+
No specialized agents are configured. The sub-agent will inherit your LLM with a minimal config.
|
|
8
|
+
|
|
9
|
+
## Parameters
|
|
10
|
+
- **task**: Short description for UI/logs (e.g., "Search for authentication code")
|
|
11
|
+
- **instructions**: Detailed instructions for the sub-agent`;
|
|
12
|
+
}
|
|
13
|
+
const agentsList = availableAgents.map((agent) => {
|
|
14
|
+
const tags = agent.tags?.length ? ` [${agent.tags.slice(0, 3).join(", ")}]` : "";
|
|
15
|
+
return `### ${agent.id}
|
|
16
|
+
${agent.description}${tags}`;
|
|
17
|
+
}).join("\n\n");
|
|
18
|
+
return `Spawn a specialized sub-agent to handle a task. The sub-agent executes independently and returns the result.
|
|
19
|
+
|
|
20
|
+
## Available Agents
|
|
21
|
+
|
|
22
|
+
${agentsList}
|
|
23
|
+
|
|
24
|
+
## Parameters
|
|
25
|
+
- **task**: Short description for UI/logs (e.g., "Explore authentication flow")
|
|
26
|
+
- **instructions**: Detailed instructions sent to the sub-agent
|
|
27
|
+
- **agentId**: Agent ID from the list above (e.g., "${availableAgents[0]?.id ?? "explore-agent"}")
|
|
28
|
+
|
|
29
|
+
## Notes
|
|
30
|
+
- Sub-agents have their own tools, LLM, and conversation context
|
|
31
|
+
- Read-only agents (like explore-agent) have auto-approved tool calls for speed
|
|
32
|
+
- If a sub-agent's LLM fails, it automatically falls back to your LLM`;
|
|
33
|
+
}
|
|
34
|
+
function createSpawnAgentTool(service) {
|
|
35
|
+
return {
|
|
36
|
+
id: "spawn_agent",
|
|
37
|
+
description: buildDescription(service),
|
|
38
|
+
inputSchema: SpawnAgentInputSchema,
|
|
39
|
+
execute: async (input, context) => {
|
|
40
|
+
const validatedInput = input;
|
|
41
|
+
const options = {
|
|
42
|
+
task: validatedInput.task,
|
|
43
|
+
instructions: validatedInput.instructions
|
|
44
|
+
};
|
|
45
|
+
if (validatedInput.agentId !== void 0) {
|
|
46
|
+
options.agentId = validatedInput.agentId;
|
|
47
|
+
}
|
|
48
|
+
if (context?.toolCallId !== void 0) {
|
|
49
|
+
options.toolCallId = context.toolCallId;
|
|
50
|
+
}
|
|
51
|
+
if (context?.sessionId !== void 0) {
|
|
52
|
+
options.sessionId = context.sessionId;
|
|
53
|
+
}
|
|
54
|
+
const result = await service.spawnAndExecute(options);
|
|
55
|
+
if (result.success) {
|
|
56
|
+
return result.response ?? "Task completed successfully.";
|
|
57
|
+
} else {
|
|
58
|
+
return `Error: ${result.error ?? "Unknown error"}`;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
createSpawnAgentTool
|
|
65
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var tool_provider_exports = {};
|
|
20
|
+
__export(tool_provider_exports, {
|
|
21
|
+
agentSpawnerToolsProvider: () => agentSpawnerToolsProvider
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(tool_provider_exports);
|
|
24
|
+
var import_schemas = require("./schemas.js");
|
|
25
|
+
var import_runtime_service = require("./runtime-service.js");
|
|
26
|
+
var import_spawn_agent_tool = require("./spawn-agent-tool.js");
|
|
27
|
+
const agentSpawnerToolsProvider = {
|
|
28
|
+
type: "agent-spawner",
|
|
29
|
+
configSchema: import_schemas.AgentSpawnerConfigSchema,
|
|
30
|
+
create: (config, context) => {
|
|
31
|
+
const { logger, agent } = context;
|
|
32
|
+
const service = new import_runtime_service.RuntimeService(agent, config, logger);
|
|
33
|
+
return [(0, import_spawn_agent_tool.createSpawnAgentTool)(service)];
|
|
34
|
+
},
|
|
35
|
+
metadata: {
|
|
36
|
+
displayName: "Agent Spawner",
|
|
37
|
+
description: "Spawn sub-agents for task delegation",
|
|
38
|
+
category: "agents"
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
agentSpawnerToolsProvider
|
|
44
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Spawner Tool Provider
|
|
3
|
+
*
|
|
4
|
+
* Custom tool provider that enables agents to spawn sub-agents for task delegation.
|
|
5
|
+
*/
|
|
6
|
+
import type { CustomToolProvider } from '@dexto/core';
|
|
7
|
+
import { type AgentSpawnerConfig } from './schemas.js';
|
|
8
|
+
/**
|
|
9
|
+
* Agent Spawner Tools Provider
|
|
10
|
+
*
|
|
11
|
+
* Provides the spawn_agent tool for task delegation to sub-agents.
|
|
12
|
+
*
|
|
13
|
+
* Configuration:
|
|
14
|
+
* ```yaml
|
|
15
|
+
* tools:
|
|
16
|
+
* customTools:
|
|
17
|
+
* - type: agent-spawner
|
|
18
|
+
* maxConcurrentAgents: 5
|
|
19
|
+
* defaultTimeout: 300000
|
|
20
|
+
* allowSpawning: true
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare const agentSpawnerToolsProvider: CustomToolProvider<'agent-spawner', AgentSpawnerConfig>;
|
|
24
|
+
//# sourceMappingURL=tool-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-provider.d.ts","sourceRoot":"","sources":["../../src/tool-provider/tool-provider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAgB,MAAM,aAAa,CAAC;AACpE,OAAO,EAA4B,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAIjF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,yBAAyB,EAAE,kBAAkB,CAAC,eAAe,EAAE,kBAAkB,CAmB7F,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AgentSpawnerConfigSchema } from "./schemas.js";
|
|
2
|
+
import { RuntimeService } from "./runtime-service.js";
|
|
3
|
+
import { createSpawnAgentTool } from "./spawn-agent-tool.js";
|
|
4
|
+
const agentSpawnerToolsProvider = {
|
|
5
|
+
type: "agent-spawner",
|
|
6
|
+
configSchema: AgentSpawnerConfigSchema,
|
|
7
|
+
create: (config, context) => {
|
|
8
|
+
const { logger, agent } = context;
|
|
9
|
+
const service = new RuntimeService(agent, config, logger);
|
|
10
|
+
return [createSpawnAgentTool(service)];
|
|
11
|
+
},
|
|
12
|
+
metadata: {
|
|
13
|
+
displayName: "Agent Spawner",
|
|
14
|
+
description: "Spawn sub-agents for task delegation",
|
|
15
|
+
category: "agents"
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
agentSpawnerToolsProvider
|
|
20
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(types_exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Spawner Tool Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for tool inputs and outputs.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Output from spawn_agent tool
|
|
8
|
+
*/
|
|
9
|
+
export interface SpawnAgentOutput {
|
|
10
|
+
/** Whether the task completed successfully */
|
|
11
|
+
success: boolean;
|
|
12
|
+
/** Final response from the sub-agent */
|
|
13
|
+
response?: string;
|
|
14
|
+
/** Error message if the task failed */
|
|
15
|
+
error?: string;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tool-provider/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,8CAA8C;IAC9C,OAAO,EAAE,OAAO,CAAC;IAEjB,wCAAwC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dexto/agent-management",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"yaml": "^2.7.1",
|
|
18
18
|
"zod": "^3.25.0",
|
|
19
|
-
"@dexto/core": "1.5.
|
|
19
|
+
"@dexto/core": "1.5.3"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/node": "^22.13.5"
|