@codeany/open-agent-sdk 0.2.1 → 0.2.2
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/.env.example +8 -0
- package/examples/01-simple-query.ts +43 -0
- package/examples/02-multi-tool.ts +44 -0
- package/examples/03-multi-turn.ts +39 -0
- package/examples/04-prompt-api.ts +29 -0
- package/examples/05-custom-system-prompt.ts +26 -0
- package/examples/06-mcp-server.ts +49 -0
- package/examples/07-custom-tools.ts +87 -0
- package/examples/08-official-api-compat.ts +38 -0
- package/examples/09-subagents.ts +48 -0
- package/examples/10-permissions.ts +40 -0
- package/examples/11-custom-mcp-tools.ts +101 -0
- package/examples/12-skills.ts +88 -0
- package/examples/13-hooks.ts +88 -0
- package/examples/14-openai-compat.ts +71 -0
- package/examples/web/index.html +365 -0
- package/examples/web/server.ts +157 -0
- package/package.json +1 -7
- package/src/engine.ts +3 -0
- package/tsconfig.json +19 -0
- package/dist/agent.d.ts +0 -113
- package/dist/agent.d.ts.map +0 -1
- package/dist/agent.js +0 -446
- package/dist/agent.js.map +0 -1
- package/dist/engine.d.ts +0 -62
- package/dist/engine.d.ts.map +0 -1
- package/dist/engine.js +0 -494
- package/dist/engine.js.map +0 -1
- package/dist/hooks.d.ts +0 -111
- package/dist/hooks.d.ts.map +0 -1
- package/dist/hooks.js +0 -179
- package/dist/hooks.js.map +0 -1
- package/dist/index.d.ts +0 -66
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -133
- package/dist/index.js.map +0 -1
- package/dist/mcp/client.d.ts +0 -19
- package/dist/mcp/client.d.ts.map +0 -1
- package/dist/mcp/client.js +0 -126
- package/dist/mcp/client.js.map +0 -1
- package/dist/providers/anthropic.d.ts +0 -17
- package/dist/providers/anthropic.d.ts.map +0 -1
- package/dist/providers/anthropic.js +0 -47
- package/dist/providers/anthropic.js.map +0 -1
- package/dist/providers/index.d.ts +0 -20
- package/dist/providers/index.d.ts.map +0 -1
- package/dist/providers/index.js +0 -26
- package/dist/providers/index.js.map +0 -1
- package/dist/providers/openai.d.ts +0 -26
- package/dist/providers/openai.d.ts.map +0 -1
- package/dist/providers/openai.js +0 -212
- package/dist/providers/openai.js.map +0 -1
- package/dist/providers/types.d.ts +0 -84
- package/dist/providers/types.d.ts.map +0 -1
- package/dist/providers/types.js +0 -11
- package/dist/providers/types.js.map +0 -1
- package/dist/sdk-mcp-server.d.ts +0 -52
- package/dist/sdk-mcp-server.d.ts.map +0 -1
- package/dist/sdk-mcp-server.js +0 -57
- package/dist/sdk-mcp-server.js.map +0 -1
- package/dist/session.d.ts +0 -73
- package/dist/session.d.ts.map +0 -1
- package/dist/session.js +0 -159
- package/dist/session.js.map +0 -1
- package/dist/skills/bundled/commit.d.ts +0 -7
- package/dist/skills/bundled/commit.d.ts.map +0 -1
- package/dist/skills/bundled/commit.js +0 -35
- package/dist/skills/bundled/commit.js.map +0 -1
- package/dist/skills/bundled/debug.d.ts +0 -7
- package/dist/skills/bundled/debug.d.ts.map +0 -1
- package/dist/skills/bundled/debug.js +0 -46
- package/dist/skills/bundled/debug.js.map +0 -1
- package/dist/skills/bundled/index.d.ts +0 -11
- package/dist/skills/bundled/index.d.ts.map +0 -1
- package/dist/skills/bundled/index.js +0 -26
- package/dist/skills/bundled/index.js.map +0 -1
- package/dist/skills/bundled/review.d.ts +0 -7
- package/dist/skills/bundled/review.d.ts.map +0 -1
- package/dist/skills/bundled/review.js +0 -38
- package/dist/skills/bundled/review.js.map +0 -1
- package/dist/skills/bundled/simplify.d.ts +0 -8
- package/dist/skills/bundled/simplify.d.ts.map +0 -1
- package/dist/skills/bundled/simplify.js +0 -48
- package/dist/skills/bundled/simplify.js.map +0 -1
- package/dist/skills/bundled/test.d.ts +0 -7
- package/dist/skills/bundled/test.d.ts.map +0 -1
- package/dist/skills/bundled/test.js +0 -40
- package/dist/skills/bundled/test.js.map +0 -1
- package/dist/skills/index.d.ts +0 -7
- package/dist/skills/index.d.ts.map +0 -1
- package/dist/skills/index.js +0 -8
- package/dist/skills/index.js.map +0 -1
- package/dist/skills/registry.d.ts +0 -43
- package/dist/skills/registry.d.ts.map +0 -1
- package/dist/skills/registry.js +0 -111
- package/dist/skills/registry.js.map +0 -1
- package/dist/skills/types.d.ts +0 -83
- package/dist/skills/types.d.ts.map +0 -1
- package/dist/skills/types.js +0 -8
- package/dist/skills/types.js.map +0 -1
- package/dist/tool-helper.d.ts +0 -73
- package/dist/tool-helper.d.ts.map +0 -1
- package/dist/tool-helper.js +0 -86
- package/dist/tool-helper.js.map +0 -1
- package/dist/tools/agent-tool.d.ts +0 -17
- package/dist/tools/agent-tool.d.ts.map +0 -1
- package/dist/tools/agent-tool.js +0 -146
- package/dist/tools/agent-tool.js.map +0 -1
- package/dist/tools/ask-user.d.ts +0 -18
- package/dist/tools/ask-user.d.ts.map +0 -1
- package/dist/tools/ask-user.js +0 -72
- package/dist/tools/ask-user.js.map +0 -1
- package/dist/tools/bash.d.ts +0 -5
- package/dist/tools/bash.d.ts.map +0 -1
- package/dist/tools/bash.js +0 -67
- package/dist/tools/bash.js.map +0 -1
- package/dist/tools/config-tool.d.ts +0 -20
- package/dist/tools/config-tool.d.ts.map +0 -1
- package/dist/tools/config-tool.js +0 -83
- package/dist/tools/config-tool.js.map +0 -1
- package/dist/tools/cron-tools.d.ts +0 -33
- package/dist/tools/cron-tools.d.ts.map +0 -1
- package/dist/tools/cron-tools.js +0 -128
- package/dist/tools/cron-tools.js.map +0 -1
- package/dist/tools/edit.d.ts +0 -5
- package/dist/tools/edit.d.ts.map +0 -1
- package/dist/tools/edit.js +0 -70
- package/dist/tools/edit.js.map +0 -1
- package/dist/tools/glob.d.ts +0 -5
- package/dist/tools/glob.d.ts.map +0 -1
- package/dist/tools/glob.js +0 -75
- package/dist/tools/glob.js.map +0 -1
- package/dist/tools/grep.d.ts +0 -5
- package/dist/tools/grep.d.ts.map +0 -1
- package/dist/tools/grep.js +0 -168
- package/dist/tools/grep.js.map +0 -1
- package/dist/tools/index.d.ts +0 -45
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -162
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/lsp-tool.d.ts +0 -9
- package/dist/tools/lsp-tool.d.ts.map +0 -1
- package/dist/tools/lsp-tool.js +0 -137
- package/dist/tools/lsp-tool.js.map +0 -1
- package/dist/tools/mcp-resource-tools.d.ts +0 -14
- package/dist/tools/mcp-resource-tools.d.ts.map +0 -1
- package/dist/tools/mcp-resource-tools.js +0 -117
- package/dist/tools/mcp-resource-tools.js.map +0 -1
- package/dist/tools/notebook-edit.d.ts +0 -5
- package/dist/tools/notebook-edit.d.ts.map +0 -1
- package/dist/tools/notebook-edit.js +0 -85
- package/dist/tools/notebook-edit.js.map +0 -1
- package/dist/tools/plan-tools.d.ts +0 -12
- package/dist/tools/plan-tools.d.ts.map +0 -1
- package/dist/tools/plan-tools.js +0 -77
- package/dist/tools/plan-tools.js.map +0 -1
- package/dist/tools/read.d.ts +0 -5
- package/dist/tools/read.d.ts.map +0 -1
- package/dist/tools/read.js +0 -66
- package/dist/tools/read.js.map +0 -1
- package/dist/tools/send-message.d.ts +0 -31
- package/dist/tools/send-message.d.ts.map +0 -1
- package/dist/tools/send-message.js +0 -77
- package/dist/tools/send-message.js.map +0 -1
- package/dist/tools/skill-tool.d.ts +0 -9
- package/dist/tools/skill-tool.d.ts.map +0 -1
- package/dist/tools/skill-tool.js +0 -115
- package/dist/tools/skill-tool.js.map +0 -1
- package/dist/tools/task-tools.d.ts +0 -48
- package/dist/tools/task-tools.d.ts.map +0 -1
- package/dist/tools/task-tools.js +0 -242
- package/dist/tools/task-tools.js.map +0 -1
- package/dist/tools/team-tools.d.ts +0 -34
- package/dist/tools/team-tools.d.ts.map +0 -1
- package/dist/tools/team-tools.js +0 -103
- package/dist/tools/team-tools.js.map +0 -1
- package/dist/tools/todo-tool.d.ts +0 -22
- package/dist/tools/todo-tool.d.ts.map +0 -1
- package/dist/tools/todo-tool.js +0 -93
- package/dist/tools/todo-tool.js.map +0 -1
- package/dist/tools/tool-search.d.ts +0 -13
- package/dist/tools/tool-search.d.ts.map +0 -1
- package/dist/tools/tool-search.js +0 -76
- package/dist/tools/tool-search.js.map +0 -1
- package/dist/tools/types.d.ts +0 -29
- package/dist/tools/types.d.ts.map +0 -1
- package/dist/tools/types.js +0 -52
- package/dist/tools/types.js.map +0 -1
- package/dist/tools/web-fetch.d.ts +0 -5
- package/dist/tools/web-fetch.d.ts.map +0 -1
- package/dist/tools/web-fetch.js +0 -60
- package/dist/tools/web-fetch.js.map +0 -1
- package/dist/tools/web-search.d.ts +0 -5
- package/dist/tools/web-search.d.ts.map +0 -1
- package/dist/tools/web-search.js +0 -77
- package/dist/tools/web-search.js.map +0 -1
- package/dist/tools/worktree-tools.d.ts +0 -10
- package/dist/tools/worktree-tools.d.ts.map +0 -1
- package/dist/tools/worktree-tools.js +0 -130
- package/dist/tools/worktree-tools.js.map +0 -1
- package/dist/tools/write.d.ts +0 -5
- package/dist/tools/write.d.ts.map +0 -1
- package/dist/tools/write.js +0 -40
- package/dist/tools/write.js.map +0 -1
- package/dist/types.d.ts +0 -423
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -5
- package/dist/types.js.map +0 -1
- package/dist/utils/compact.d.ts +0 -44
- package/dist/utils/compact.d.ts.map +0 -1
- package/dist/utils/compact.js +0 -162
- package/dist/utils/compact.js.map +0 -1
- package/dist/utils/context.d.ts +0 -35
- package/dist/utils/context.d.ts.map +0 -1
- package/dist/utils/context.js +0 -174
- package/dist/utils/context.js.map +0 -1
- package/dist/utils/fileCache.d.ts +0 -64
- package/dist/utils/fileCache.d.ts.map +0 -1
- package/dist/utils/fileCache.js +0 -117
- package/dist/utils/fileCache.js.map +0 -1
- package/dist/utils/messages.d.ts +0 -57
- package/dist/utils/messages.d.ts.map +0 -1
- package/dist/utils/messages.js +0 -152
- package/dist/utils/messages.js.map +0 -1
- package/dist/utils/retry.d.ts +0 -48
- package/dist/utils/retry.d.ts.map +0 -1
- package/dist/utils/retry.js +0 -111
- package/dist/utils/retry.js.map +0 -1
- package/dist/utils/tokens.d.ts +0 -57
- package/dist/utils/tokens.d.ts.map +0 -1
- package/dist/utils/tokens.js +0 -134
- package/dist/utils/tokens.js.map +0 -1
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SendMessageTool - Inter-agent messaging
|
|
3
|
-
*
|
|
4
|
-
* Supports plain text and structured protocol messages
|
|
5
|
-
* between teammates in a multi-agent setup.
|
|
6
|
-
*/
|
|
7
|
-
const mailboxes = new Map();
|
|
8
|
-
/**
|
|
9
|
-
* Read messages from a mailbox.
|
|
10
|
-
*/
|
|
11
|
-
export function readMailbox(agentName) {
|
|
12
|
-
const messages = mailboxes.get(agentName) || [];
|
|
13
|
-
mailboxes.set(agentName, []); // Clear after reading
|
|
14
|
-
return messages;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Write to a mailbox.
|
|
18
|
-
*/
|
|
19
|
-
export function writeToMailbox(agentName, message) {
|
|
20
|
-
const messages = mailboxes.get(agentName) || [];
|
|
21
|
-
messages.push(message);
|
|
22
|
-
mailboxes.set(agentName, messages);
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Clear all mailboxes.
|
|
26
|
-
*/
|
|
27
|
-
export function clearMailboxes() {
|
|
28
|
-
mailboxes.clear();
|
|
29
|
-
}
|
|
30
|
-
export const SendMessageTool = {
|
|
31
|
-
name: 'SendMessage',
|
|
32
|
-
description: 'Send a message to another agent or teammate. Supports plain text and structured protocol messages.',
|
|
33
|
-
inputSchema: {
|
|
34
|
-
type: 'object',
|
|
35
|
-
properties: {
|
|
36
|
-
to: { type: 'string', description: 'Recipient agent name or ID. Use "*" for broadcast.' },
|
|
37
|
-
content: { type: 'string', description: 'Message content' },
|
|
38
|
-
type: {
|
|
39
|
-
type: 'string',
|
|
40
|
-
enum: ['text', 'shutdown_request', 'shutdown_response', 'plan_approval_response'],
|
|
41
|
-
description: 'Message type (default: text)',
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
required: ['to', 'content'],
|
|
45
|
-
},
|
|
46
|
-
isReadOnly: () => false,
|
|
47
|
-
isConcurrencySafe: () => true,
|
|
48
|
-
isEnabled: () => true,
|
|
49
|
-
async prompt() { return 'Send a message to another agent.'; },
|
|
50
|
-
async call(input) {
|
|
51
|
-
const message = {
|
|
52
|
-
from: 'self',
|
|
53
|
-
to: input.to,
|
|
54
|
-
content: input.content,
|
|
55
|
-
timestamp: new Date().toISOString(),
|
|
56
|
-
type: input.type || 'text',
|
|
57
|
-
};
|
|
58
|
-
if (input.to === '*') {
|
|
59
|
-
// Broadcast to all known mailboxes
|
|
60
|
-
for (const [name] of mailboxes) {
|
|
61
|
-
writeToMailbox(name, { ...message, to: name });
|
|
62
|
-
}
|
|
63
|
-
return {
|
|
64
|
-
type: 'tool_result',
|
|
65
|
-
tool_use_id: '',
|
|
66
|
-
content: `Message broadcast to all agents`,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
writeToMailbox(input.to, message);
|
|
70
|
-
return {
|
|
71
|
-
type: 'tool_result',
|
|
72
|
-
tool_use_id: '',
|
|
73
|
-
content: `Message sent to ${input.to}`,
|
|
74
|
-
};
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
//# sourceMappingURL=send-message.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"send-message.js","sourceRoot":"","sources":["../../src/tools/send-message.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAeH,MAAM,SAAS,GAAG,IAAI,GAAG,EAA0B,CAAA;AAEnD;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,SAAiB;IAC3C,MAAM,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,CAAA;IAC/C,SAAS,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,CAAC,CAAA,CAAC,sBAAsB;IACnD,OAAO,Q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AC,OAAO;YACtB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACnC,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,MAAM;SAC3B,CAAA;QAED,IAAI,KAAK,CAAC,EAAE,KAAK,GAAG,EAAE,CAAC;YACrB,mCAAmC;YACnC,KAAK,MAAM,CAAC,IAAI,CAAC,IAAI,SAAS,EAAE,CAAC;gBAC/B,cAAc,CAAC,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;YAChD,CAAC;YACD,OAAO;gBACL,IAAI,EAAE,aAAa;gBACnB,WAAW,EAAE,EAAE;gBACf,OAAO,EAAE,iCAAiC;aAC3C,CAAA;QACH,CAAC;QAED,cAAc,CAAC,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,CAAA;QACjC,OAAO;YACL,IAAI,EAAE,aAAa;YACnB,WAAW,EAAE,EAAE;YACf,OAAO,EAAE,mBAAmB,KAAK,CAAC,EAAE,EAAE;SACvC,CAAA;IACH,CAAC;CACF,CAAA"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Skill Tool
|
|
3
|
-
*
|
|
4
|
-
* Allows the model to invoke registered skills by name.
|
|
5
|
-
* Skills are prompt templates that provide specialized capabilities.
|
|
6
|
-
*/
|
|
7
|
-
import type { ToolDefinition } from '../types.js';
|
|
8
|
-
export declare const SkillTool: ToolDefinition;
|
|
9
|
-
//# sourceMappingURL=skill-tool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"skill-tool.d.ts","sourceRoot":"","sources":["../../src/tools/skill-tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAA2B,MAAM,aAAa,CAAA;AAG1E,eAAO,MAAM,SAAS,EAAE,cA0HvB,CAAA"}
|
package/dist/tools/skill-tool.js
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Skill Tool
|
|
3
|
-
*
|
|
4
|
-
* Allows the model to invoke registered skills by name.
|
|
5
|
-
* Skills are prompt templates that provide specialized capabilities.
|
|
6
|
-
*/
|
|
7
|
-
import { getSkill, getUserInvocableSkills } from '../skills/registry.js';
|
|
8
|
-
export const SkillTool = {
|
|
9
|
-
name: 'Skill',
|
|
10
|
-
description: 'Execute a skill within the current conversation. ' +
|
|
11
|
-
'Skills provide specialized capabilities and domain knowledge. ' +
|
|
12
|
-
'Use this tool with the skill name and optional arguments. ' +
|
|
13
|
-
'Available skills are listed in system-reminder messages.',
|
|
14
|
-
inputSchema: {
|
|
15
|
-
type: 'object',
|
|
16
|
-
properties: {
|
|
17
|
-
skill: {
|
|
18
|
-
type: 'string',
|
|
19
|
-
description: 'The skill name to execute (e.g., "commit", "review", "simplify")',
|
|
20
|
-
},
|
|
21
|
-
args: {
|
|
22
|
-
type: 'string',
|
|
23
|
-
description: 'Optional arguments for the skill',
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
required: ['skill'],
|
|
27
|
-
},
|
|
28
|
-
isReadOnly: () => false,
|
|
29
|
-
isConcurrencySafe: () => false,
|
|
30
|
-
isEnabled: () => getUserInvocableSkills().length > 0,
|
|
31
|
-
async prompt() {
|
|
32
|
-
const skills = getUserInvocableSkills();
|
|
33
|
-
if (skills.length === 0)
|
|
34
|
-
return '';
|
|
35
|
-
const lines = skills.map((s) => {
|
|
36
|
-
const desc = s.description.length > 200
|
|
37
|
-
? s.description.slice(0, 200) + '...'
|
|
38
|
-
: s.description;
|
|
39
|
-
return `- ${s.name}: ${desc}`;
|
|
40
|
-
});
|
|
41
|
-
return ('Execute a skill within the main conversation.\n\n' +
|
|
42
|
-
'Available skills:\n' +
|
|
43
|
-
lines.join('\n') +
|
|
44
|
-
'\n\nWhen a skill matches the user\'s request, invoke it using the Skill tool.');
|
|
45
|
-
},
|
|
46
|
-
async call(input, context) {
|
|
47
|
-
const skillName = input.skill;
|
|
48
|
-
const args = input.args || '';
|
|
49
|
-
if (!skillName) {
|
|
50
|
-
return {
|
|
51
|
-
type: 'tool_result',
|
|
52
|
-
tool_use_id: '',
|
|
53
|
-
content: 'Error: skill name is required',
|
|
54
|
-
is_error: true,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
const skill = getSkill(skillName);
|
|
58
|
-
if (!skill) {
|
|
59
|
-
const available = getUserInvocableSkills()
|
|
60
|
-
.map((s) => s.name)
|
|
61
|
-
.join(', ');
|
|
62
|
-
return {
|
|
63
|
-
type: 'tool_result',
|
|
64
|
-
tool_use_id: '',
|
|
65
|
-
content: `Error: Unknown skill "${skillName}". Available skills: ${available || 'none'}`,
|
|
66
|
-
is_error: true,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
// Check if skill is enabled
|
|
70
|
-
if (skill.isEnabled && !skill.isEnabled()) {
|
|
71
|
-
return {
|
|
72
|
-
type: 'tool_result',
|
|
73
|
-
tool_use_id: '',
|
|
74
|
-
content: `Error: Skill "${skillName}" is currently disabled`,
|
|
75
|
-
is_error: true,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
try {
|
|
79
|
-
// Get skill prompt
|
|
80
|
-
const contentBlocks = await skill.getPrompt(args, context);
|
|
81
|
-
// Convert content blocks to text
|
|
82
|
-
const promptText = contentBlocks
|
|
83
|
-
.filter((b) => b.type === 'text')
|
|
84
|
-
.map((b) => b.text)
|
|
85
|
-
.join('\n\n');
|
|
86
|
-
// Build result with metadata
|
|
87
|
-
const result = {
|
|
88
|
-
success: true,
|
|
89
|
-
commandName: skill.name,
|
|
90
|
-
status: skill.context === 'fork' ? 'forked' : 'inline',
|
|
91
|
-
prompt: promptText,
|
|
92
|
-
};
|
|
93
|
-
if (skill.allowedTools) {
|
|
94
|
-
result.allowedTools = skill.allowedTools;
|
|
95
|
-
}
|
|
96
|
-
if (skill.model) {
|
|
97
|
-
result.model = skill.model;
|
|
98
|
-
}
|
|
99
|
-
return {
|
|
100
|
-
type: 'tool_result',
|
|
101
|
-
tool_use_id: '',
|
|
102
|
-
content: JSON.stringify(result),
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
catch (err) {
|
|
106
|
-
return {
|
|
107
|
-
type: 'tool_result',
|
|
108
|
-
tool_use_id: '',
|
|
109
|
-
content: `Error executing skill "${skillName}": ${err.message}`,
|
|
110
|
-
is_error: true,
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
};
|
|
115
|
-
//# sourceMappingURL=skill-tool.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"skill-tool.js","sourceRoot":"","sources":["../../src/tools/skill-tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAExE,MAAM,CAAC,MAAM,SAAS,GAAmB;IACvC,IAAI,EAAE,OAAO;IACb,WAAW,EACT,mDAAmD;QACnD,gEAAgE;QAChE,4DAA4D;QAC5D,0DAA0D;IAC5D,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,kEAAkE;aAChF;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,kCAAkC;aAChD;SACF;QACD,QAAQ,EAAE,CAAC,OAAO,CAAC;KACpB;IAED,UAAU,EAAE,GAAG,EAAE,CAAC,KAAK;IACvB,iBAAiB,EAAE,GAAG,EAAE,CAAC,KAAK;IAC9B,SAAS,EAAE,GAAG,EAAE,CAAC,sBAAsB,EAAE,CAAC,MAAM,GAAG,CAAC;IAEpD,KAAK,CAAC,MAAM;QACV,MAAM,MAAM,GAAG,sBAAsB,EAAE,CAAA;QACvC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,EAAE,CAAA;QAElC,MA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AAE,aAAa;gBACnB,WAAW,EAAE,EAAE;gBACf,OAAO,EAAE,0BAA0B,SAAS,MAAM,GAAG,CAAC,OAAO,EAAE;gBAC/D,QAAQ,EAAE,IAAI;aACf,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAA"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Task Management Tools
|
|
3
|
-
*
|
|
4
|
-
* TaskCreate, TaskList, TaskUpdate, TaskGet, TaskStop, TaskOutput
|
|
5
|
-
*
|
|
6
|
-
* Provides in-memory task tracking for agent coordination.
|
|
7
|
-
* Tasks persist across turns within a session.
|
|
8
|
-
*/
|
|
9
|
-
import type { ToolDefinition } from '../types.js';
|
|
10
|
-
/**
|
|
11
|
-
* Task status.
|
|
12
|
-
*/
|
|
13
|
-
export type TaskStatus = 'pending' | 'in_progress' | 'completed' | 'failed' | 'cancelled';
|
|
14
|
-
/**
|
|
15
|
-
* Task entry.
|
|
16
|
-
*/
|
|
17
|
-
export interface Task {
|
|
18
|
-
id: string;
|
|
19
|
-
subject: string;
|
|
20
|
-
description?: string;
|
|
21
|
-
status: TaskStatus;
|
|
22
|
-
owner?: string;
|
|
23
|
-
createdAt: string;
|
|
24
|
-
updatedAt: string;
|
|
25
|
-
output?: string;
|
|
26
|
-
blockedBy?: string[];
|
|
27
|
-
blocks?: string[];
|
|
28
|
-
metadata?: Record<string, unknown>;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Get all tasks.
|
|
32
|
-
*/
|
|
33
|
-
export declare function getAllTasks(): Task[];
|
|
34
|
-
/**
|
|
35
|
-
* Get a task by ID.
|
|
36
|
-
*/
|
|
37
|
-
export declare function getTask(id: string): Task | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* Clear all tasks (for session reset).
|
|
40
|
-
*/
|
|
41
|
-
export declare function clearTasks(): void;
|
|
42
|
-
export declare const TaskCreateTool: ToolDefinition;
|
|
43
|
-
export declare const TaskListTool: ToolDefinition;
|
|
44
|
-
export declare const TaskUpdateTool: ToolDefinition;
|
|
45
|
-
export declare const TaskGetTool: ToolDefinition;
|
|
46
|
-
export declare const TaskStopTool: ToolDefinition;
|
|
47
|
-
export declare const TaskOutputTool: ToolDefinition;
|
|
48
|
-
//# sourceMappingURL=task-tools.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"task-tools.d.ts","sourceRoot":"","sources":["../../src/tools/task-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,cAAc,EAA2B,MAAM,aAAa,CAAA;AAE1E;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,aAAa,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAA;AAEzF;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,UAAU,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACnC;AASD;;GAEG;AACH,wBAAgB,WAAW,IAAI,IAAI,EAAE,CAEpC;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAEpD;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,IAAI,CAGjC;AAMD,eAAO,MAAM,cAAc,EAAE,cAoC5B,CAAA;AAMD,eAAO,MAAM,YAAY,EAAE,cAsC1B,CAAA;AAMD,eAAO,MAAM,cAAc,EAAE,cAoC5B,CAAA;AAMD,eAAO,MAAM,WAAW,EAAE,cA0BzB,CAAA;AAMD,eAAO,MAAM,YAAY,EAAE,cA+B1B,CAAA;AAMD,eAAO,MAAM,cAAc,EAAE,cA0B5B,CAAA"}
|
package/dist/tools/task-tools.js
DELETED
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Task Management Tools
|
|
3
|
-
*
|
|
4
|
-
* TaskCreate, TaskList, TaskUpdate, TaskGet, TaskStop, TaskOutput
|
|
5
|
-
*
|
|
6
|
-
* Provides in-memory task tracking for agent coordination.
|
|
7
|
-
* Tasks persist across turns within a session.
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Global task store (shared across tools in a session).
|
|
11
|
-
*/
|
|
12
|
-
const taskStore = new Map();
|
|
13
|
-
let taskCounter = 0;
|
|
14
|
-
/**
|
|
15
|
-
* Get all tasks.
|
|
16
|
-
*/
|
|
17
|
-
export function getAllTasks() {
|
|
18
|
-
return Array.from(taskStore.values());
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Get a task by ID.
|
|
22
|
-
*/
|
|
23
|
-
export function getTask(id) {
|
|
24
|
-
return taskStore.get(id);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Clear all tasks (for session reset).
|
|
28
|
-
*/
|
|
29
|
-
export function clearTasks() {
|
|
30
|
-
taskStore.clear();
|
|
31
|
-
taskCounter = 0;
|
|
32
|
-
}
|
|
33
|
-
// ============================================================================
|
|
34
|
-
// TaskCreateTool
|
|
35
|
-
// ============================================================================
|
|
36
|
-
export const TaskCreateTool = {
|
|
37
|
-
name: 'TaskCreate',
|
|
38
|
-
description: 'Create a new task for tracking work progress. Tasks help organize multi-step operations.',
|
|
39
|
-
inputSchema: {
|
|
40
|
-
type: 'object',
|
|
41
|
-
properties: {
|
|
42
|
-
subject: { type: 'string', description: 'Short task title' },
|
|
43
|
-
description: { type: 'string', description: 'Detailed task description' },
|
|
44
|
-
owner: { type: 'string', description: 'Task owner/assignee' },
|
|
45
|
-
status: { type: 'string', enum: ['pending', 'in_progress'], description: 'Initial status' },
|
|
46
|
-
},
|
|
47
|
-
required: ['subject'],
|
|
48
|
-
},
|
|
49
|
-
isReadOnly: () => false,
|
|
50
|
-
isConcurrencySafe: () => true,
|
|
51
|
-
isEnabled: () => true,
|
|
52
|
-
async prompt() { return 'Create a task for tracking progress.'; },
|
|
53
|
-
async call(input) {
|
|
54
|
-
const id = `task_${++taskCounter}`;
|
|
55
|
-
const task = {
|
|
56
|
-
id,
|
|
57
|
-
subject: input.subject,
|
|
58
|
-
description: input.description,
|
|
59
|
-
status: input.status || 'pending',
|
|
60
|
-
owner: input.owner,
|
|
61
|
-
createdAt: new Date().toISOString(),
|
|
62
|
-
updatedAt: new Date().toISOString(),
|
|
63
|
-
};
|
|
64
|
-
taskStore.set(id, task);
|
|
65
|
-
return {
|
|
66
|
-
type: 'tool_result',
|
|
67
|
-
tool_use_id: '',
|
|
68
|
-
content: `Task created: ${id} - "${task.subject}" (${task.status})`,
|
|
69
|
-
};
|
|
70
|
-
},
|
|
71
|
-
};
|
|
72
|
-
// ============================================================================
|
|
73
|
-
// TaskListTool
|
|
74
|
-
// ============================================================================
|
|
75
|
-
export const TaskListTool = {
|
|
76
|
-
name: 'TaskList',
|
|
77
|
-
description: 'List all tasks with their status, ownership, and dependencies.',
|
|
78
|
-
inputSchema: {
|
|
79
|
-
type: 'object',
|
|
80
|
-
properties: {
|
|
81
|
-
status: { type: 'string', description: 'Filter by status' },
|
|
82
|
-
owner: { type: 'string', description: 'Filter by owner' },
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
isReadOnly: () => true,
|
|
86
|
-
isConcurrencySafe: () => true,
|
|
87
|
-
isEnabled: () => true,
|
|
88
|
-
async prompt() { return 'List tasks.'; },
|
|
89
|
-
async call(input) {
|
|
90
|
-
let tasks = getAllTasks();
|
|
91
|
-
if (input.status) {
|
|
92
|
-
tasks = tasks.filter(t => t.status === input.status);
|
|
93
|
-
}
|
|
94
|
-
if (input.owner) {
|
|
95
|
-
tasks = tasks.filter(t => t.owner === input.owner);
|
|
96
|
-
}
|
|
97
|
-
if (tasks.length === 0) {
|
|
98
|
-
return { type: 'tool_result', tool_use_id: '', content: 'No tasks found.' };
|
|
99
|
-
}
|
|
100
|
-
const lines = tasks.map(t => `[${t.id}] ${t.status.toUpperCase()} - ${t.subject}${t.owner ? ` (owner: ${t.owner})` : ''}`);
|
|
101
|
-
return {
|
|
102
|
-
type: 'tool_result',
|
|
103
|
-
tool_use_id: '',
|
|
104
|
-
content: lines.join('\n'),
|
|
105
|
-
};
|
|
106
|
-
},
|
|
107
|
-
};
|
|
108
|
-
// ============================================================================
|
|
109
|
-
// TaskUpdateTool
|
|
110
|
-
// ============================================================================
|
|
111
|
-
export const TaskUpdateTool = {
|
|
112
|
-
name: 'TaskUpdate',
|
|
113
|
-
description: 'Update a task\'s status, description, or other properties.',
|
|
114
|
-
inputSchema: {
|
|
115
|
-
type: 'object',
|
|
116
|
-
properties: {
|
|
117
|
-
id: { type: 'string', description: 'Task ID' },
|
|
118
|
-
status: { type: 'string', enum: ['pending', 'in_progress', 'completed', 'failed', 'cancelled'] },
|
|
119
|
-
description: { type: 'string', description: 'Updated description' },
|
|
120
|
-
owner: { type: 'string', description: 'New owner' },
|
|
121
|
-
output: { type: 'string', description: 'Task output/result' },
|
|
122
|
-
},
|
|
123
|
-
required: ['id'],
|
|
124
|
-
},
|
|
125
|
-
isReadOnly: () => false,
|
|
126
|
-
isConcurrencySafe: () => true,
|
|
127
|
-
isEnabled: () => true,
|
|
128
|
-
async prompt() { return 'Update a task.'; },
|
|
129
|
-
async call(input) {
|
|
130
|
-
const task = taskStore.get(input.id);
|
|
131
|
-
if (!task) {
|
|
132
|
-
return { type: 'tool_result', tool_use_id: '', content: `Task not found: ${input.id}`, is_error: true };
|
|
133
|
-
}
|
|
134
|
-
if (input.status)
|
|
135
|
-
task.status = input.status;
|
|
136
|
-
if (input.description)
|
|
137
|
-
task.description = input.description;
|
|
138
|
-
if (input.owner)
|
|
139
|
-
task.owner = input.owner;
|
|
140
|
-
if (input.output)
|
|
141
|
-
task.output = input.output;
|
|
142
|
-
task.updatedAt = new Date().toISOString();
|
|
143
|
-
return {
|
|
144
|
-
type: 'tool_result',
|
|
145
|
-
tool_use_id: '',
|
|
146
|
-
content: `Task updated: ${task.id} - ${task.status} - "${task.subject}"`,
|
|
147
|
-
};
|
|
148
|
-
},
|
|
149
|
-
};
|
|
150
|
-
// ============================================================================
|
|
151
|
-
// TaskGetTool
|
|
152
|
-
// ============================================================================
|
|
153
|
-
export const TaskGetTool = {
|
|
154
|
-
name: 'TaskGet',
|
|
155
|
-
description: 'Get full details of a specific task.',
|
|
156
|
-
inputSchema: {
|
|
157
|
-
type: 'object',
|
|
158
|
-
properties: {
|
|
159
|
-
id: { type: 'string', description: 'Task ID' },
|
|
160
|
-
},
|
|
161
|
-
required: ['id'],
|
|
162
|
-
},
|
|
163
|
-
isReadOnly: () => true,
|
|
164
|
-
isConcurrencySafe: () => true,
|
|
165
|
-
isEnabled: () => true,
|
|
166
|
-
async prompt() { return 'Get task details.'; },
|
|
167
|
-
async call(input) {
|
|
168
|
-
const task = taskStore.get(input.id);
|
|
169
|
-
if (!task) {
|
|
170
|
-
return { type: 'tool_result', tool_use_id: '', content: `Task not found: ${input.id}`, is_error: true };
|
|
171
|
-
}
|
|
172
|
-
return {
|
|
173
|
-
type: 'tool_result',
|
|
174
|
-
tool_use_id: '',
|
|
175
|
-
content: JSON.stringify(task, null, 2),
|
|
176
|
-
};
|
|
177
|
-
},
|
|
178
|
-
};
|
|
179
|
-
// ============================================================================
|
|
180
|
-
// TaskStopTool
|
|
181
|
-
// ============================================================================
|
|
182
|
-
export const TaskStopTool = {
|
|
183
|
-
name: 'TaskStop',
|
|
184
|
-
description: 'Stop/cancel a running task.',
|
|
185
|
-
inputSchema: {
|
|
186
|
-
type: 'object',
|
|
187
|
-
properties: {
|
|
188
|
-
id: { type: 'string', description: 'Task ID to stop' },
|
|
189
|
-
reason: { type: 'string', description: 'Reason for stopping' },
|
|
190
|
-
},
|
|
191
|
-
required: ['id'],
|
|
192
|
-
},
|
|
193
|
-
isReadOnly: () => false,
|
|
194
|
-
isConcurrencySafe: () => true,
|
|
195
|
-
isEnabled: () => true,
|
|
196
|
-
async prompt() { return 'Stop a task.'; },
|
|
197
|
-
async call(input) {
|
|
198
|
-
const task = taskStore.get(input.id);
|
|
199
|
-
if (!task) {
|
|
200
|
-
return { type: 'tool_result', tool_use_id: '', content: `Task not found: ${input.id}`, is_error: true };
|
|
201
|
-
}
|
|
202
|
-
task.status = 'cancelled';
|
|
203
|
-
task.updatedAt = new Date().toISOString();
|
|
204
|
-
if (input.reason)
|
|
205
|
-
task.output = `Stopped: ${input.reason}`;
|
|
206
|
-
return {
|
|
207
|
-
type: 'tool_result',
|
|
208
|
-
tool_use_id: '',
|
|
209
|
-
content: `Task stopped: ${task.id}`,
|
|
210
|
-
};
|
|
211
|
-
},
|
|
212
|
-
};
|
|
213
|
-
// ============================================================================
|
|
214
|
-
// TaskOutputTool
|
|
215
|
-
// ============================================================================
|
|
216
|
-
export const TaskOutputTool = {
|
|
217
|
-
name: 'TaskOutput',
|
|
218
|
-
description: 'Get the output/result of a task.',
|
|
219
|
-
inputSchema: {
|
|
220
|
-
type: 'object',
|
|
221
|
-
properties: {
|
|
222
|
-
id: { type: 'string', description: 'Task ID' },
|
|
223
|
-
},
|
|
224
|
-
required: ['id'],
|
|
225
|
-
},
|
|
226
|
-
isReadOnly: () => true,
|
|
227
|
-
isConcurrencySafe: () => true,
|
|
228
|
-
isEnabled: () => true,
|
|
229
|
-
async prompt() { return 'Get task output.'; },
|
|
230
|
-
async call(input) {
|
|
231
|
-
const task = taskStore.get(input.id);
|
|
232
|
-
if (!task) {
|
|
233
|
-
return { type: 'tool_result', tool_use_id: '', content: `Task not found: ${input.id}`, is_error: true };
|
|
234
|
-
}
|
|
235
|
-
return {
|
|
236
|
-
type: 'tool_result',
|
|
237
|
-
tool_use_id: '',
|
|
238
|
-
content: task.output || '(no output yet)',
|
|
239
|
-
};
|
|
240
|
-
},
|
|
241
|
-
};
|
|
242
|
-
//# sourceMappingURL=task-tools.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"task-tools.js","sourceRoot":"","sources":["../../src/tools/task-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA0BH;;GAEG;AACH,MAAM,SAAS,GAAG,IAAI,GAAG,EAAgB,CAAA;AAEzC,IAAI,WAAW,GAAG,CAAC,CAAA;AAEnB;;GAEG;AACH,MAAM,UAAU,WAAW;IACzB,OAAO,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAA;AACvC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,OAAO,CAAC,EAAU;IAChC,OAAO,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU;IACxB,SAAS,CAAC,KAAK,EAAE,CAAA;IACjB,WAAW,GAAG,CAAC,CAAA;AACjB,CAAC;AAED,+EAA+E;AAC/E,iBAAiB;AACjB,+EAA+E;AAE/E,MAAM,CAAC,MAAM,cAAc,GAAmB;IAC5C,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,0FAA0F;IACvG,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,kBAAkB,EAAE;YAC5D,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,2BAA2B,EAAE;YACzE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,qBAAqB,EAAE;YAC7D,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,SAAS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C,MAAM,IAAI,iBAAiB;SAC1C,CAAA;IACH,CAAC;CACF,CAAA"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Team Management Tools
|
|
3
|
-
*
|
|
4
|
-
* TeamCreate, TeamDelete - Multi-agent team coordination.
|
|
5
|
-
* Manages team composition, task lists, and inter-agent messaging.
|
|
6
|
-
*/
|
|
7
|
-
import type { ToolDefinition } from '../types.js';
|
|
8
|
-
/**
|
|
9
|
-
* Team definition.
|
|
10
|
-
*/
|
|
11
|
-
export interface Team {
|
|
12
|
-
id: string;
|
|
13
|
-
name: string;
|
|
14
|
-
members: string[];
|
|
15
|
-
leaderId: string;
|
|
16
|
-
taskListId?: string;
|
|
17
|
-
createdAt: string;
|
|
18
|
-
status: 'active' | 'disbanded';
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Get all teams.
|
|
22
|
-
*/
|
|
23
|
-
export declare function getAllTeams(): Team[];
|
|
24
|
-
/**
|
|
25
|
-
* Get a team by ID.
|
|
26
|
-
*/
|
|
27
|
-
export declare function getTeam(id: string): Team | undefined;
|
|
28
|
-
/**
|
|
29
|
-
* Clear all teams.
|
|
30
|
-
*/
|
|
31
|
-
export declare function clearTeams(): void;
|
|
32
|
-
export declare const TeamCreateTool: ToolDefinition;
|
|
33
|
-
export declare const TeamDeleteTool: ToolDefinition;
|
|
34
|
-
//# sourceMappingURL=team-tools.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"team-tools.d.ts","sourceRoot":"","sources":["../../src/tools/team-tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,aAAa,CAAA;AAE7D;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,QAAQ,GAAG,WAAW,CAAA;CAC/B;AAQD;;GAEG;AACH,wBAAgB,WAAW,IAAI,IAAI,EAAE,CAEpC;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAEpD;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,IAAI,CAGjC;AAMD,eAAO,MAAM,cAAc,EAAE,cAsC5B,CAAA;AAMD,eAAO,MAAM,cAAc,EAAE,cA6B5B,CAAA"}
|
package/dist/tools/team-tools.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Team Management Tools
|
|
3
|
-
*
|
|
4
|
-
* TeamCreate, TeamDelete - Multi-agent team coordination.
|
|
5
|
-
* Manages team composition, task lists, and inter-agent messaging.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Global team store.
|
|
9
|
-
*/
|
|
10
|
-
const teamStore = new Map();
|
|
11
|
-
let teamCounter = 0;
|
|
12
|
-
/**
|
|
13
|
-
* Get all teams.
|
|
14
|
-
*/
|
|
15
|
-
export function getAllTeams() {
|
|
16
|
-
return Array.from(teamStore.values());
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Get a team by ID.
|
|
20
|
-
*/
|
|
21
|
-
export function getTeam(id) {
|
|
22
|
-
return teamStore.get(id);
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Clear all teams.
|
|
26
|
-
*/
|
|
27
|
-
export function clearTeams() {
|
|
28
|
-
teamStore.clear();
|
|
29
|
-
teamCounter = 0;
|
|
30
|
-
}
|
|
31
|
-
// ============================================================================
|
|
32
|
-
// TeamCreateTool
|
|
33
|
-
// ============================================================================
|
|
34
|
-
export const TeamCreateTool = {
|
|
35
|
-
name: 'TeamCreate',
|
|
36
|
-
description: 'Create a multi-agent team for coordinated work. Assigns a lead and manages member composition.',
|
|
37
|
-
inputSchema: {
|
|
38
|
-
type: 'object',
|
|
39
|
-
properties: {
|
|
40
|
-
name: { type: 'string', description: 'Team name' },
|
|
41
|
-
members: {
|
|
42
|
-
type: 'array',
|
|
43
|
-
items: { type: 'string' },
|
|
44
|
-
description: 'List of agent/teammate names',
|
|
45
|
-
},
|
|
46
|
-
task_description: { type: 'string', description: 'Description of the team\'s mission' },
|
|
47
|
-
},
|
|
48
|
-
required: ['name'],
|
|
49
|
-
},
|
|
50
|
-
isReadOnly: () => false,
|
|
51
|
-
isConcurrencySafe: () => false,
|
|
52
|
-
isEnabled: () => true,
|
|
53
|
-
async prompt() { return 'Create a team for multi-agent coordination.'; },
|
|
54
|
-
async call(input) {
|
|
55
|
-
const id = `team_${++teamCounter}`;
|
|
56
|
-
const team = {
|
|
57
|
-
id,
|
|
58
|
-
name: input.name,
|
|
59
|
-
members: input.members || [],
|
|
60
|
-
leaderId: 'self',
|
|
61
|
-
createdAt: new Date().toISOString(),
|
|
62
|
-
status: 'active',
|
|
63
|
-
};
|
|
64
|
-
teamStore.set(id, team);
|
|
65
|
-
return {
|
|
66
|
-
type: 'tool_result',
|
|
67
|
-
tool_use_id: '',
|
|
68
|
-
content: `Team created: ${id} "${team.name}" with ${team.members.length} members`,
|
|
69
|
-
};
|
|
70
|
-
},
|
|
71
|
-
};
|
|
72
|
-
// ============================================================================
|
|
73
|
-
// TeamDeleteTool
|
|
74
|
-
// ============================================================================
|
|
75
|
-
export const TeamDeleteTool = {
|
|
76
|
-
name: 'TeamDelete',
|
|
77
|
-
description: 'Disband a team and clean up resources.',
|
|
78
|
-
inputSchema: {
|
|
79
|
-
type: 'object',
|
|
80
|
-
properties: {
|
|
81
|
-
id: { type: 'string', description: 'Team ID to disband' },
|
|
82
|
-
},
|
|
83
|
-
required: ['id'],
|
|
84
|
-
},
|
|
85
|
-
isReadOnly: () => false,
|
|
86
|
-
isConcurrencySafe: () => false,
|
|
87
|
-
isEnabled: () => true,
|
|
88
|
-
async prompt() { return 'Delete/disband a team.'; },
|
|
89
|
-
async call(input) {
|
|
90
|
-
const team = teamStore.get(input.id);
|
|
91
|
-
if (!team) {
|
|
92
|
-
return { type: 'tool_result', tool_use_id: '', content: `Team not found: ${input.id}`, is_error: true };
|
|
93
|
-
}
|
|
94
|
-
team.status = 'disbanded';
|
|
95
|
-
teamStore.delete(input.id);
|
|
96
|
-
return {
|
|
97
|
-
type: 'tool_result',
|
|
98
|
-
tool_use_id: '',
|
|
99
|
-
content: `Team disbanded: ${team.name}`,
|
|
100
|
-
};
|
|
101
|
-
},
|
|
102
|
-
};
|
|
103
|
-
//# sourceMappingURL=team-tools.js.map
|