@phuetz/code-buddy 0.1.24 → 0.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1049 -741
- package/dist/agent/codebuddy-agent.d.ts +5 -0
- package/dist/agent/codebuddy-agent.js +46 -1
- package/dist/agent/codebuddy-agent.js.map +1 -1
- package/dist/agent/execution/agent-executor.d.ts +12 -0
- package/dist/agent/execution/agent-executor.js +147 -6
- package/dist/agent/execution/agent-executor.js.map +1 -1
- package/dist/agent/lessons-tracker.d.ts +50 -0
- package/dist/agent/lessons-tracker.js +234 -0
- package/dist/agent/lessons-tracker.js.map +1 -0
- package/dist/agent/message-queue.d.ts +39 -2
- package/dist/agent/message-queue.js +67 -2
- package/dist/agent/message-queue.js.map +1 -1
- package/dist/agent/middleware/index.d.ts +1 -0
- package/dist/agent/middleware/index.js +1 -0
- package/dist/agent/middleware/index.js.map +1 -1
- package/dist/agent/middleware/workflow-guard.d.ts +21 -0
- package/dist/agent/middleware/workflow-guard.js +94 -0
- package/dist/agent/middleware/workflow-guard.js.map +1 -0
- package/dist/agent/repo-profiler.d.ts +61 -0
- package/dist/agent/repo-profiler.js +295 -0
- package/dist/agent/repo-profiler.js.map +1 -0
- package/dist/agent/response-constraint.d.ts +61 -0
- package/dist/agent/response-constraint.js +91 -0
- package/dist/agent/response-constraint.js.map +1 -0
- package/dist/agent/todo-tracker.d.ts +67 -0
- package/dist/agent/todo-tracker.js +245 -0
- package/dist/agent/todo-tracker.js.map +1 -0
- package/dist/agent/tool-handler.d.ts +11 -0
- package/dist/agent/tool-handler.js +79 -1
- package/dist/agent/tool-handler.js.map +1 -1
- package/dist/agent/types.d.ts +20 -2
- package/dist/agent/wide-research.d.ts +93 -0
- package/dist/agent/wide-research.js +232 -0
- package/dist/agent/wide-research.js.map +1 -0
- package/dist/channels/index.d.ts +2 -0
- package/dist/channels/index.js +2 -0
- package/dist/channels/index.js.map +1 -1
- package/dist/channels/pro/callback-router.d.ts +54 -0
- package/dist/channels/pro/callback-router.js +178 -0
- package/dist/channels/pro/callback-router.js.map +1 -0
- package/dist/channels/pro/ci-watcher.d.ts +86 -0
- package/dist/channels/pro/ci-watcher.js +343 -0
- package/dist/channels/pro/ci-watcher.js.map +1 -0
- package/dist/channels/pro/diff-first.d.ts +63 -0
- package/dist/channels/pro/diff-first.js +187 -0
- package/dist/channels/pro/diff-first.js.map +1 -0
- package/dist/channels/pro/enhanced-commands.d.ts +83 -0
- package/dist/channels/pro/enhanced-commands.js +218 -0
- package/dist/channels/pro/enhanced-commands.js.map +1 -0
- package/dist/channels/pro/index.d.ts +19 -0
- package/dist/channels/pro/index.js +21 -0
- package/dist/channels/pro/index.js.map +1 -0
- package/dist/channels/pro/pro-features.d.ts +79 -0
- package/dist/channels/pro/pro-features.js +203 -0
- package/dist/channels/pro/pro-features.js.map +1 -0
- package/dist/channels/pro/run-commands.d.ts +59 -0
- package/dist/channels/pro/run-commands.js +122 -0
- package/dist/channels/pro/run-commands.js.map +1 -0
- package/dist/channels/pro/run-tracker.d.ts +74 -0
- package/dist/channels/pro/run-tracker.js +252 -0
- package/dist/channels/pro/run-tracker.js.map +1 -0
- package/dist/channels/pro/scoped-auth.d.ts +97 -0
- package/dist/channels/pro/scoped-auth.js +340 -0
- package/dist/channels/pro/scoped-auth.js.map +1 -0
- package/dist/channels/pro/text-formatter.d.ts +27 -0
- package/dist/channels/pro/text-formatter.js +269 -0
- package/dist/channels/pro/text-formatter.js.map +1 -0
- package/dist/channels/pro/types.d.ts +242 -0
- package/dist/channels/pro/types.js +14 -0
- package/dist/channels/pro/types.js.map +1 -0
- package/dist/channels/streaming-policy.d.ts +66 -0
- package/dist/channels/streaming-policy.js +266 -0
- package/dist/channels/streaming-policy.js.map +1 -0
- package/dist/channels/telegram/ci-watcher.d.ts +5 -0
- package/dist/channels/telegram/ci-watcher.js +5 -0
- package/dist/channels/telegram/ci-watcher.js.map +1 -0
- package/dist/channels/telegram/client.d.ts +28 -0
- package/dist/channels/telegram/client.js +147 -1
- package/dist/channels/telegram/client.js.map +1 -1
- package/dist/channels/telegram/diff-first.d.ts +5 -0
- package/dist/channels/telegram/diff-first.js +5 -0
- package/dist/channels/telegram/diff-first.js.map +1 -0
- package/dist/channels/telegram/enhanced-commands.d.ts +6 -0
- package/dist/channels/telegram/enhanced-commands.js +6 -0
- package/dist/channels/telegram/enhanced-commands.js.map +1 -0
- package/dist/channels/telegram/index.d.ts +6 -0
- package/dist/channels/telegram/index.js +6 -0
- package/dist/channels/telegram/index.js.map +1 -1
- package/dist/channels/telegram/pro-formatter.d.ts +30 -0
- package/dist/channels/telegram/pro-formatter.js +276 -0
- package/dist/channels/telegram/pro-formatter.js.map +1 -0
- package/dist/channels/telegram/run-commands.d.ts +5 -0
- package/dist/channels/telegram/run-commands.js +6 -0
- package/dist/channels/telegram/run-commands.js.map +1 -0
- package/dist/channels/telegram/run-tracker.d.ts +5 -0
- package/dist/channels/telegram/run-tracker.js +5 -0
- package/dist/channels/telegram/run-tracker.js.map +1 -0
- package/dist/channels/telegram/scoped-auth.d.ts +6 -0
- package/dist/channels/telegram/scoped-auth.js +5 -0
- package/dist/channels/telegram/scoped-auth.js.map +1 -0
- package/dist/channels/telegram/types.d.ts +34 -0
- package/dist/codebuddy/client.js +14 -1
- package/dist/codebuddy/client.js.map +1 -1
- package/dist/commands/dev/index.d.ts +12 -0
- package/dist/commands/dev/index.js +231 -0
- package/dist/commands/dev/index.js.map +1 -0
- package/dist/commands/dev/workflows.d.ts +31 -0
- package/dist/commands/dev/workflows.js +214 -0
- package/dist/commands/dev/workflows.js.map +1 -0
- package/dist/commands/execpolicy.d.ts +17 -0
- package/dist/commands/execpolicy.js +155 -0
- package/dist/commands/execpolicy.js.map +1 -0
- package/dist/commands/knowledge.d.ts +13 -0
- package/dist/commands/knowledge.js +142 -0
- package/dist/commands/knowledge.js.map +1 -0
- package/dist/commands/lessons.d.ts +11 -0
- package/dist/commands/lessons.js +129 -0
- package/dist/commands/lessons.js.map +1 -0
- package/dist/commands/pairing.d.ts +14 -0
- package/dist/commands/pairing.js +132 -0
- package/dist/commands/pairing.js.map +1 -0
- package/dist/commands/research/index.d.ts +13 -0
- package/dist/commands/research/index.js +91 -0
- package/dist/commands/research/index.js.map +1 -0
- package/dist/commands/run-cli/index.d.ts +11 -0
- package/dist/commands/run-cli/index.js +49 -0
- package/dist/commands/run-cli/index.js.map +1 -0
- package/dist/commands/todos.d.ts +9 -0
- package/dist/commands/todos.js +119 -0
- package/dist/commands/todos.js.map +1 -0
- package/dist/config/toml-config.d.ts +21 -0
- package/dist/config/toml-config.js +15 -0
- package/dist/config/toml-config.js.map +1 -1
- package/dist/context/enhanced-compression.js +12 -1
- package/dist/context/enhanced-compression.js.map +1 -1
- package/dist/context/observation-variator.d.ts +44 -0
- package/dist/context/observation-variator.js +83 -0
- package/dist/context/observation-variator.js.map +1 -0
- package/dist/context/precompaction-flush.d.ts +40 -0
- package/dist/context/precompaction-flush.js +134 -0
- package/dist/context/precompaction-flush.js.map +1 -0
- package/dist/context/restorable-compression.d.ts +80 -0
- package/dist/context/restorable-compression.js +228 -0
- package/dist/context/restorable-compression.js.map +1 -0
- package/dist/daemon/daily-reset.d.ts +77 -0
- package/dist/daemon/daily-reset.js +175 -0
- package/dist/daemon/daily-reset.js.map +1 -0
- package/dist/daemon/index.d.ts +1 -0
- package/dist/daemon/index.js +1 -0
- package/dist/daemon/index.js.map +1 -1
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -1
- package/dist/knowledge/knowledge-manager.d.ts +77 -0
- package/dist/knowledge/knowledge-manager.js +244 -0
- package/dist/knowledge/knowledge-manager.js.map +1 -0
- package/dist/observability/run-store.d.ts +133 -0
- package/dist/observability/run-store.js +419 -0
- package/dist/observability/run-store.js.map +1 -0
- package/dist/observability/run-viewer.d.ts +33 -0
- package/dist/observability/run-viewer.js +254 -0
- package/dist/observability/run-viewer.js.map +1 -0
- package/dist/optimization/cache-breakpoints.d.ts +52 -0
- package/dist/optimization/cache-breakpoints.js +97 -0
- package/dist/optimization/cache-breakpoints.js.map +1 -0
- package/dist/persistence/session-store.d.ts +3 -1
- package/dist/persistence/session-store.js +1 -1
- package/dist/persistence/session-store.js.map +1 -1
- package/dist/prompts/system-base.js +51 -7
- package/dist/prompts/system-base.js.map +1 -1
- package/dist/prompts/variation-injector.d.ts +55 -0
- package/dist/prompts/variation-injector.js +171 -0
- package/dist/prompts/variation-injector.js.map +1 -0
- package/dist/prompts/workflow-rules.d.ts +10 -0
- package/dist/prompts/workflow-rules.js +79 -0
- package/dist/prompts/workflow-rules.js.map +1 -0
- package/dist/sandbox/execpolicy.d.ts +45 -0
- package/dist/sandbox/execpolicy.js +80 -0
- package/dist/sandbox/execpolicy.js.map +1 -1
- package/dist/sandbox/os-sandbox.d.ts +25 -0
- package/dist/sandbox/os-sandbox.js +73 -0
- package/dist/sandbox/os-sandbox.js.map +1 -1
- package/dist/security/security-audit.d.ts +10 -0
- package/dist/security/security-audit.js +116 -0
- package/dist/security/security-audit.js.map +1 -1
- package/dist/security/shell-env-policy.d.ts +45 -0
- package/dist/security/shell-env-policy.js +141 -0
- package/dist/security/shell-env-policy.js.map +1 -0
- package/dist/security/ssrf-guard.d.ts +61 -0
- package/dist/security/ssrf-guard.js +382 -0
- package/dist/security/ssrf-guard.js.map +1 -0
- package/dist/security/write-policy.d.ts +57 -0
- package/dist/security/write-policy.js +117 -0
- package/dist/security/write-policy.js.map +1 -0
- package/dist/services/prompt-builder.js +37 -0
- package/dist/services/prompt-builder.js.map +1 -1
- package/dist/themes/theme-schema.d.ts +10 -10
- package/dist/tools/ask-human-tool.d.ts +62 -0
- package/dist/tools/ask-human-tool.js +112 -0
- package/dist/tools/ask-human-tool.js.map +1 -0
- package/dist/tools/bash/bash-tool.d.ts +15 -0
- package/dist/tools/bash/bash-tool.js +62 -0
- package/dist/tools/bash/bash-tool.js.map +1 -1
- package/dist/tools/bash/command-validator.d.ts +1 -0
- package/dist/tools/bash/command-validator.js +5 -0
- package/dist/tools/bash/command-validator.js.map +1 -1
- package/dist/tools/create-skill-tool.d.ts +87 -0
- package/dist/tools/create-skill-tool.js +142 -0
- package/dist/tools/create-skill-tool.js.map +1 -0
- package/dist/tools/fetch-tool.js +5 -3
- package/dist/tools/fetch-tool.js.map +1 -1
- package/dist/tools/hooks/default-hooks.js +24 -23
- package/dist/tools/hooks/default-hooks.js.map +1 -1
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.js +1 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/plan-tool.d.ts +22 -0
- package/dist/tools/plan-tool.js +128 -0
- package/dist/tools/plan-tool.js.map +1 -0
- package/dist/tools/registry/attention-tools.d.ts +32 -0
- package/dist/tools/registry/attention-tools.js +225 -0
- package/dist/tools/registry/attention-tools.js.map +1 -0
- package/dist/tools/registry/index.d.ts +9 -1
- package/dist/tools/registry/index.js +30 -2
- package/dist/tools/registry/index.js.map +1 -1
- package/dist/tools/registry/knowledge-tools.d.ts +46 -0
- package/dist/tools/registry/knowledge-tools.js +293 -0
- package/dist/tools/registry/knowledge-tools.js.map +1 -0
- package/dist/tools/registry/lessons-tools.d.ts +48 -0
- package/dist/tools/registry/lessons-tools.js +359 -0
- package/dist/tools/registry/lessons-tools.js.map +1 -0
- package/dist/tools/registry/plan-tools.d.ts +2 -0
- package/dist/tools/registry/plan-tools.js +7 -0
- package/dist/tools/registry/plan-tools.js.map +1 -0
- package/dist/tools/registry/script-tools.d.ts +2 -0
- package/dist/tools/registry/script-tools.js +7 -0
- package/dist/tools/registry/script-tools.js.map +1 -0
- package/dist/tools/registry/tool-aliases.d.ts +44 -0
- package/dist/tools/registry/tool-aliases.js +130 -0
- package/dist/tools/registry/tool-aliases.js.map +1 -0
- package/dist/tools/run-script-tool.d.ts +13 -0
- package/dist/tools/run-script-tool.js +146 -0
- package/dist/tools/run-script-tool.js.map +1 -0
- package/dist/tools/web-search.d.ts +25 -0
- package/dist/tools/web-search.js +68 -6
- package/dist/tools/web-search.js.map +1 -1
- package/dist/utils/config-validation/schema.d.ts +2 -2
- package/dist/utils/debug-logger.d.ts +1 -1
- package/dist/utils/rtk-compressor.d.ts +13 -10
- package/dist/utils/rtk-compressor.js +83 -34
- package/dist/utils/rtk-compressor.js.map +1 -1
- package/dist/utils/stable-json.d.ts +27 -0
- package/dist/utils/stable-json.js +50 -0
- package/dist/utils/stable-json.js.map +1 -0
- package/dist/webhooks/webhook-manager.d.ts +7 -0
- package/dist/webhooks/webhook-manager.js +29 -0
- package/dist/webhooks/webhook-manager.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attention Tool Adapters
|
|
3
|
+
*
|
|
4
|
+
* ITool-compliant adapters for:
|
|
5
|
+
* - TodoAttentionTool (`todo_update`) — Manus AI attention bias
|
|
6
|
+
* - RestoreContextTool (`restore_context`) — Manus AI restorable compression
|
|
7
|
+
*
|
|
8
|
+
* These two tools work together: the agent updates todos to maintain
|
|
9
|
+
* focus across long sessions, and can restore compressed context content
|
|
10
|
+
* by identifier when it needs to revisit earlier information.
|
|
11
|
+
*/
|
|
12
|
+
import { getTodoTracker } from '../../agent/todo-tracker.js';
|
|
13
|
+
import { getRestorableCompressor } from '../../context/restorable-compression.js';
|
|
14
|
+
// ============================================================================
|
|
15
|
+
// TodoAttentionTool
|
|
16
|
+
// ============================================================================
|
|
17
|
+
export class TodoAttentionTool {
|
|
18
|
+
name = 'todo_update';
|
|
19
|
+
description = [
|
|
20
|
+
'Manage the persistent task list (todo.md). Use this to track progress on complex tasks.',
|
|
21
|
+
'Actions: add (create item), complete (mark done), update (change status/text), remove (delete), clear_done (remove completed items), list (show all).',
|
|
22
|
+
'The current task list is automatically appended to the end of the LLM context each turn to keep objectives in focus.',
|
|
23
|
+
].join(' ');
|
|
24
|
+
async execute(input) {
|
|
25
|
+
const action = input.action;
|
|
26
|
+
const tracker = getTodoTracker(process.cwd());
|
|
27
|
+
try {
|
|
28
|
+
switch (action) {
|
|
29
|
+
case 'add': {
|
|
30
|
+
const text = input.text;
|
|
31
|
+
if (!text)
|
|
32
|
+
return { success: false, error: 'text is required for add action' };
|
|
33
|
+
const item = tracker.add(text, input.priority ?? 'medium');
|
|
34
|
+
return { success: true, output: `Added: [${item.id}] ${item.text}` };
|
|
35
|
+
}
|
|
36
|
+
case 'complete': {
|
|
37
|
+
const id = input.id;
|
|
38
|
+
if (!id)
|
|
39
|
+
return { success: false, error: 'id is required for complete action' };
|
|
40
|
+
const ok = tracker.complete(id);
|
|
41
|
+
return ok
|
|
42
|
+
? { success: true, output: `Marked complete: ${id}` }
|
|
43
|
+
: { success: false, error: `Item not found: ${id}` };
|
|
44
|
+
}
|
|
45
|
+
case 'update': {
|
|
46
|
+
const id = input.id;
|
|
47
|
+
if (!id)
|
|
48
|
+
return { success: false, error: 'id is required for update action' };
|
|
49
|
+
const ok = tracker.update(id, {
|
|
50
|
+
text: input.text,
|
|
51
|
+
status: input.status,
|
|
52
|
+
priority: input.priority,
|
|
53
|
+
});
|
|
54
|
+
return ok
|
|
55
|
+
? { success: true, output: `Updated: ${id}` }
|
|
56
|
+
: { success: false, error: `Item not found: ${id}` };
|
|
57
|
+
}
|
|
58
|
+
case 'remove': {
|
|
59
|
+
const id = input.id;
|
|
60
|
+
if (!id)
|
|
61
|
+
return { success: false, error: 'id is required for remove action' };
|
|
62
|
+
const ok = tracker.remove(id);
|
|
63
|
+
return ok
|
|
64
|
+
? { success: true, output: `Removed: ${id}` }
|
|
65
|
+
: { success: false, error: `Item not found: ${id}` };
|
|
66
|
+
}
|
|
67
|
+
case 'clear_done': {
|
|
68
|
+
const n = tracker.clearDone();
|
|
69
|
+
return { success: true, output: `Cleared ${n} completed items` };
|
|
70
|
+
}
|
|
71
|
+
case 'list': {
|
|
72
|
+
const items = tracker.getAll();
|
|
73
|
+
if (items.length === 0)
|
|
74
|
+
return { success: true, output: 'No items in todo list.' };
|
|
75
|
+
const lines = items.map(i => `[${i.id}] (${i.status}/${i.priority}) ${i.text}`);
|
|
76
|
+
return { success: true, output: lines.join('\n') };
|
|
77
|
+
}
|
|
78
|
+
default:
|
|
79
|
+
return { success: false, error: `Unknown action: ${action}. Valid: add, complete, update, remove, clear_done, list` };
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
catch (err) {
|
|
83
|
+
return {
|
|
84
|
+
success: false,
|
|
85
|
+
error: `todo_update failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
getSchema() {
|
|
90
|
+
return {
|
|
91
|
+
name: this.name,
|
|
92
|
+
description: this.description,
|
|
93
|
+
parameters: {
|
|
94
|
+
type: 'object',
|
|
95
|
+
properties: {
|
|
96
|
+
action: {
|
|
97
|
+
type: 'string',
|
|
98
|
+
enum: ['add', 'complete', 'update', 'remove', 'clear_done', 'list'],
|
|
99
|
+
description: 'Action to perform',
|
|
100
|
+
},
|
|
101
|
+
text: {
|
|
102
|
+
type: 'string',
|
|
103
|
+
description: 'Item text (required for add; optional for update)',
|
|
104
|
+
},
|
|
105
|
+
id: {
|
|
106
|
+
type: 'string',
|
|
107
|
+
description: 'Item ID (required for complete/update/remove)',
|
|
108
|
+
},
|
|
109
|
+
status: {
|
|
110
|
+
type: 'string',
|
|
111
|
+
enum: ['pending', 'in_progress', 'done', 'blocked'],
|
|
112
|
+
description: 'New status (for update)',
|
|
113
|
+
},
|
|
114
|
+
priority: {
|
|
115
|
+
type: 'string',
|
|
116
|
+
enum: ['high', 'medium', 'low'],
|
|
117
|
+
description: 'Priority (for add/update, default: medium)',
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
required: ['action'],
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
validate(input) {
|
|
125
|
+
const validActions = ['add', 'complete', 'update', 'remove', 'clear_done', 'list'];
|
|
126
|
+
if (!input.action || !validActions.includes(input.action)) {
|
|
127
|
+
return {
|
|
128
|
+
isValid: false,
|
|
129
|
+
errors: [`action must be one of: ${validActions.join(', ')}`],
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
if ((input.action === 'add') && !input.text) {
|
|
133
|
+
return { isValid: false, errors: ['text is required for add'] };
|
|
134
|
+
}
|
|
135
|
+
if (['complete', 'update', 'remove'].includes(input.action) && !input.id) {
|
|
136
|
+
return { isValid: false, errors: ['id is required for this action'] };
|
|
137
|
+
}
|
|
138
|
+
return { isValid: true, errors: [] };
|
|
139
|
+
}
|
|
140
|
+
getMetadata() {
|
|
141
|
+
return {
|
|
142
|
+
name: this.name,
|
|
143
|
+
version: '1.0.0',
|
|
144
|
+
author: 'Code Buddy',
|
|
145
|
+
category: 'planning',
|
|
146
|
+
tags: ['todo', 'tasks', 'planning', 'attention'],
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
async isAvailable() {
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
// ============================================================================
|
|
154
|
+
// RestoreContextTool
|
|
155
|
+
// ============================================================================
|
|
156
|
+
export class RestoreContextTool {
|
|
157
|
+
name = 'restore_context';
|
|
158
|
+
description = [
|
|
159
|
+
'Restore compressed context content by identifier (file path or URL).',
|
|
160
|
+
'When context is compressed, file paths and URLs are preserved as identifiers.',
|
|
161
|
+
'Use this tool to retrieve the full original content that was compressed away.',
|
|
162
|
+
'Provide the exact file path (e.g. "src/agent/types.ts") or URL seen in an earlier message.',
|
|
163
|
+
].join(' ');
|
|
164
|
+
async execute(input) {
|
|
165
|
+
const identifier = input.identifier;
|
|
166
|
+
if (!identifier)
|
|
167
|
+
return { success: false, error: 'identifier is required' };
|
|
168
|
+
const compressor = getRestorableCompressor();
|
|
169
|
+
const result = compressor.restore(identifier);
|
|
170
|
+
if (result.found) {
|
|
171
|
+
return {
|
|
172
|
+
success: true,
|
|
173
|
+
output: `Restored content for "${identifier}":\n\n${result.content}`,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
success: false,
|
|
178
|
+
error: result.content, // contains helpful hint (web_fetch, etc.)
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
getSchema() {
|
|
182
|
+
return {
|
|
183
|
+
name: this.name,
|
|
184
|
+
description: this.description,
|
|
185
|
+
parameters: {
|
|
186
|
+
type: 'object',
|
|
187
|
+
properties: {
|
|
188
|
+
identifier: {
|
|
189
|
+
type: 'string',
|
|
190
|
+
description: 'File path (e.g. "src/agent/types.ts") or URL to restore',
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
required: ['identifier'],
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
validate(input) {
|
|
198
|
+
if (!input.identifier) {
|
|
199
|
+
return { isValid: false, errors: ['identifier is required'] };
|
|
200
|
+
}
|
|
201
|
+
return { isValid: true, errors: [] };
|
|
202
|
+
}
|
|
203
|
+
getMetadata() {
|
|
204
|
+
return {
|
|
205
|
+
name: this.name,
|
|
206
|
+
version: '1.0.0',
|
|
207
|
+
author: 'Code Buddy',
|
|
208
|
+
category: 'context',
|
|
209
|
+
tags: ['context', 'memory', 'compression', 'restore'],
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
async isAvailable() {
|
|
213
|
+
return true;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
// ============================================================================
|
|
217
|
+
// Factory
|
|
218
|
+
// ============================================================================
|
|
219
|
+
export function createAttentionTools() {
|
|
220
|
+
return [
|
|
221
|
+
new TodoAttentionTool(),
|
|
222
|
+
new RestoreContextTool(),
|
|
223
|
+
];
|
|
224
|
+
}
|
|
225
|
+
//# sourceMappingURL=attention-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attention-tools.js","sourceRoot":"","sources":["../../../src/tools/registry/attention-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAA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ubernetesTools, resetKubernetesInstance
|
|
|
19
19
|
export { GitOperationTool, createGitTools, resetGitInstance, } from './git-tools.js';
|
|
20
20
|
export { BrowserExecuteTool, ReasoningExecuteTool, createMiscTools, resetMiscInstances, } from './misc-tools.js';
|
|
21
21
|
export { ProcessOperationTool, createProcessTools, resetProcessInstance, } from './process-tools.js';
|
|
22
|
+
export { createScriptTools, } from './script-tools.js';
|
|
23
|
+
export { createPlanTools, } from './plan-tools.js';
|
|
24
|
+
export { KnowledgeSearchTool, KnowledgeAddTool, AskHumanExecuteTool, CreateSkillExecuteTool, createKnowledgeTools, } from './knowledge-tools.js';
|
|
25
|
+
export { TodoAttentionTool, RestoreContextTool, createAttentionTools, } from './attention-tools.js';
|
|
26
|
+
export { LessonsAddTool, LessonsSearchTool, LessonsListTool, TaskVerifyTool, createLessonsTools, } from './lessons-tools.js';
|
|
27
|
+
export { createAliasTools, toCanonicalName, toLegacyName, TOOL_ALIASES, CANONICAL_NAME, } from './tool-aliases.js';
|
|
22
28
|
export type { JsonSchema, JsonSchemaProperty, ToolSchema, ToolCategoryType, ITool, IToolMetadata, IValidationResult, ToolExecutorFn, IToolExecutionContext, IToolExecutionResult, IToolRegistrationOptions, IRegisteredTool, IToolQueryOptions, IToolRegistry, IRegistryStats, IToolRegistryEvents, ToolRegistryEventHandler, } from './types.js';
|
|
23
29
|
/**
|
|
24
|
-
* Create all tool instances for registration (async for lazy loading)
|
|
30
|
+
* Create all tool instances for registration (async for lazy loading).
|
|
31
|
+
* Also registers canonical-prefix alias tools (shell_*, file_*, browser_*, etc.)
|
|
32
|
+
* for Codex-style tool naming convention.
|
|
25
33
|
*/
|
|
26
34
|
export declare function createAllToolsAsync(): Promise<ITool[]>;
|
|
27
35
|
import type { ITool } from './types.js';
|
|
@@ -30,8 +30,22 @@ export { GitOperationTool, createGitTools, resetGitInstance, } from './git-tools
|
|
|
30
30
|
export { BrowserExecuteTool, ReasoningExecuteTool, createMiscTools, resetMiscInstances, } from './misc-tools.js';
|
|
31
31
|
// Tool Adapters - Process
|
|
32
32
|
export { ProcessOperationTool, createProcessTools, resetProcessInstance, } from './process-tools.js';
|
|
33
|
+
// Tool Adapters - Script
|
|
34
|
+
export { createScriptTools, } from './script-tools.js';
|
|
35
|
+
// Tool Adapters - Plan
|
|
36
|
+
export { createPlanTools, } from './plan-tools.js';
|
|
37
|
+
// Tool Adapters - Knowledge, AskHuman, CreateSkill
|
|
38
|
+
export { KnowledgeSearchTool, KnowledgeAddTool, AskHumanExecuteTool, CreateSkillExecuteTool, createKnowledgeTools, } from './knowledge-tools.js';
|
|
39
|
+
// Tool Adapters - Attention (Todo + RestoreContext)
|
|
40
|
+
export { TodoAttentionTool, RestoreContextTool, createAttentionTools, } from './attention-tools.js';
|
|
41
|
+
// Tool Adapters - Lessons (self-improvement loop + verification contract)
|
|
42
|
+
export { LessonsAddTool, LessonsSearchTool, LessonsListTool, TaskVerifyTool, createLessonsTools, } from './lessons-tools.js';
|
|
43
|
+
// Tool Prefix Naming Convention — Codex-inspired canonical aliases
|
|
44
|
+
export { createAliasTools, toCanonicalName, toLegacyName, TOOL_ALIASES, CANONICAL_NAME, } from './tool-aliases.js';
|
|
33
45
|
/**
|
|
34
|
-
* Create all tool instances for registration (async for lazy loading)
|
|
46
|
+
* Create all tool instances for registration (async for lazy loading).
|
|
47
|
+
* Also registers canonical-prefix alias tools (shell_*, file_*, browser_*, etc.)
|
|
48
|
+
* for Codex-style tool naming convention.
|
|
35
49
|
*/
|
|
36
50
|
export async function createAllToolsAsync() {
|
|
37
51
|
const { createTextEditorTools } = await import('./text-editor-tools.js');
|
|
@@ -44,7 +58,13 @@ export async function createAllToolsAsync() {
|
|
|
44
58
|
const { createGitTools } = await import('./git-tools.js');
|
|
45
59
|
const { createMiscTools } = await import('./misc-tools.js');
|
|
46
60
|
const { createProcessTools } = await import('./process-tools.js');
|
|
47
|
-
|
|
61
|
+
const { createKnowledgeTools } = await import('./knowledge-tools.js');
|
|
62
|
+
const { createScriptTools } = await import('./script-tools.js');
|
|
63
|
+
const { createPlanTools } = await import('./plan-tools.js');
|
|
64
|
+
const { createAttentionTools } = await import('./attention-tools.js');
|
|
65
|
+
const { createAliasTools } = await import('./tool-aliases.js');
|
|
66
|
+
const { createLessonsTools } = await import('./lessons-tools.js');
|
|
67
|
+
const primaryTools = [
|
|
48
68
|
...createTextEditorTools(),
|
|
49
69
|
...createBashTools(),
|
|
50
70
|
...createSearchTools(),
|
|
@@ -55,6 +75,14 @@ export async function createAllToolsAsync() {
|
|
|
55
75
|
...createGitTools(),
|
|
56
76
|
...createMiscTools(),
|
|
57
77
|
...createProcessTools(),
|
|
78
|
+
...createKnowledgeTools(),
|
|
79
|
+
...createScriptTools(),
|
|
80
|
+
...createPlanTools(),
|
|
81
|
+
...createAttentionTools(),
|
|
82
|
+
...createLessonsTools(),
|
|
58
83
|
];
|
|
84
|
+
// Register backward-compat canonical-prefix aliases (shell_exec, file_read, etc.)
|
|
85
|
+
const aliasTools = createAliasTools(primaryTools);
|
|
86
|
+
return [...primaryTools, ...aliasTools];
|
|
59
87
|
}
|
|
60
88
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/registry/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,WAAW;AACX,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEvG,8BAA8B;AAC9B,OAAO,EACL,YAAY,EACZ,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,wBAAwB,CAAC;AAEhC,uBAAuB;AACvB,OAAO,EACL,eAAe,EACf,eAAe,EACf,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAEzB,yBAAyB;AACzB,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAE3B,sBAAsB;AACtB,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,cAAc,EACd,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AAExB,uBAAuB;AACvB,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAEzB,yBAAyB;AACzB,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAE3B,6BAA6B;AAC7B,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAE/B,sBAAsB;AACtB,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AAExB,4CAA4C;AAC5C,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AAEzB,0BAA0B;AAC1B,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/registry/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,WAAW;AACX,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEvG,8BAA8B;AAC9B,OAAO,EACL,YAAY,EACZ,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,wBAAwB,CAAC;AAEhC,uBAAuB;AACvB,OAAO,EACL,eAAe,EACf,eAAe,EACf,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAEzB,yBAAyB;AACzB,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,k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C,CAAC;IACtE,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAC/D,MAAM,EAAE,kBAAkB,EAAE,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAC;IAElE,MAAM,YAAY,GAAY;QAC5B,GAAG,qBAAqB,EAAE;QAC1B,GAAG,eAAe,EAAE;QACpB,GAAG,iBAAiB,EAAE;QACtB,GAAG,cAAc,EAAE;QACnB,GAAG,eAAe,EAAE;QACpB,GAAG,iBAAiB,EAAE;QACtB,GAAG,qBAAqB,EAAE;QAC1B,GAAG,cAAc,EAAE;QACnB,GAAG,eAAe,EAAE;QACpB,GAAG,kBAAkB,EAAE;QACvB,GAAG,oBAAoB,EAAE;QACzB,GAAG,iBAAiB,EAAE;QACtB,GAAG,eAAe,EAAE;QACpB,GAAG,oBAAoB,EAAE;QACzB,GAAG,kBAAkB,EAAE;KACxB,CAAC;IAEF,kFAAkF;IAClF,MAAM,UAAU,GAAG,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAElD,OAAO,CAAC,GAAG,YAAY,EAAE,GAAG,UAAU,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Knowledge Tool Adapters
|
|
3
|
+
*
|
|
4
|
+
* ITool-compliant adapters exposing the KnowledgeManager to the agent:
|
|
5
|
+
* - knowledge_search: semantic keyword search across loaded knowledge bases
|
|
6
|
+
* - knowledge_add: create a new knowledge entry from within a session
|
|
7
|
+
*/
|
|
8
|
+
import type { ToolResult } from '../../types/index.js';
|
|
9
|
+
import type { ITool, ToolSchema, IToolMetadata, IValidationResult } from './types.js';
|
|
10
|
+
export declare class KnowledgeSearchTool implements ITool {
|
|
11
|
+
readonly name = "knowledge_search";
|
|
12
|
+
readonly description = "Search the agent knowledge base for domain knowledge, conventions, or procedures. Returns ranked excerpts from loaded Knowledge.md files.";
|
|
13
|
+
execute(input: Record<string, unknown>): Promise<ToolResult>;
|
|
14
|
+
getSchema(): ToolSchema;
|
|
15
|
+
validate(input: unknown): IValidationResult;
|
|
16
|
+
getMetadata(): IToolMetadata;
|
|
17
|
+
isAvailable(): boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare class KnowledgeAddTool implements ITool {
|
|
20
|
+
readonly name = "knowledge_add";
|
|
21
|
+
readonly description = "Add a new entry to the user-level knowledge base (~/.codebuddy/knowledge/). Use this to persist learned conventions, procedures, or domain knowledge across sessions.";
|
|
22
|
+
execute(input: Record<string, unknown>): Promise<ToolResult>;
|
|
23
|
+
getSchema(): ToolSchema;
|
|
24
|
+
validate(input: unknown): IValidationResult;
|
|
25
|
+
getMetadata(): IToolMetadata;
|
|
26
|
+
isAvailable(): boolean;
|
|
27
|
+
}
|
|
28
|
+
export declare class AskHumanExecuteTool implements ITool {
|
|
29
|
+
readonly name = "ask_human";
|
|
30
|
+
readonly description = "Pause execution and ask the user a clarifying question. Use when you need information that cannot be inferred from context, or when multiple interpretations exist. Returns the user's response.";
|
|
31
|
+
execute(input: Record<string, unknown>): Promise<ToolResult>;
|
|
32
|
+
getSchema(): ToolSchema;
|
|
33
|
+
validate(input: unknown): IValidationResult;
|
|
34
|
+
getMetadata(): IToolMetadata;
|
|
35
|
+
isAvailable(): boolean;
|
|
36
|
+
}
|
|
37
|
+
export declare class CreateSkillExecuteTool implements ITool {
|
|
38
|
+
readonly name = "create_skill";
|
|
39
|
+
readonly description = "Create a new SKILL.md file in the workspace skills directory. Use this to codify reusable workflows or procedures for future sessions. Skills are hot-reloaded immediately.";
|
|
40
|
+
execute(input: Record<string, unknown>): Promise<ToolResult>;
|
|
41
|
+
getSchema(): ToolSchema;
|
|
42
|
+
validate(input: unknown): IValidationResult;
|
|
43
|
+
getMetadata(): IToolMetadata;
|
|
44
|
+
isAvailable(): boolean;
|
|
45
|
+
}
|
|
46
|
+
export declare function createKnowledgeTools(): ITool[];
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Knowledge Tool Adapters
|
|
3
|
+
*
|
|
4
|
+
* ITool-compliant adapters exposing the KnowledgeManager to the agent:
|
|
5
|
+
* - knowledge_search: semantic keyword search across loaded knowledge bases
|
|
6
|
+
* - knowledge_add: create a new knowledge entry from within a session
|
|
7
|
+
*/
|
|
8
|
+
import { getKnowledgeManager } from '../../knowledge/knowledge-manager.js';
|
|
9
|
+
// ============================================================================
|
|
10
|
+
// knowledge_search
|
|
11
|
+
// ============================================================================
|
|
12
|
+
export class KnowledgeSearchTool {
|
|
13
|
+
name = 'knowledge_search';
|
|
14
|
+
description = 'Search the agent knowledge base for domain knowledge, conventions, or procedures. Returns ranked excerpts from loaded Knowledge.md files.';
|
|
15
|
+
async execute(input) {
|
|
16
|
+
const km = getKnowledgeManager();
|
|
17
|
+
if (!km.isLoaded) {
|
|
18
|
+
await km.load();
|
|
19
|
+
}
|
|
20
|
+
const query = input.query;
|
|
21
|
+
const limit = input.limit ?? 5;
|
|
22
|
+
const scope = input.scope;
|
|
23
|
+
const results = km.search(query, limit);
|
|
24
|
+
if (results.length === 0) {
|
|
25
|
+
// Try to give context about what's loaded
|
|
26
|
+
const all = km.list();
|
|
27
|
+
if (all.length === 0) {
|
|
28
|
+
return {
|
|
29
|
+
success: true,
|
|
30
|
+
output: 'No knowledge entries loaded. Create a Knowledge.md file in the project root or ~/.codebuddy/knowledge/ to add domain knowledge.',
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
success: true,
|
|
35
|
+
output: `No matches found for "${query}". Available knowledge entries: ${all.map(e => e.title).join(', ')}`,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const lines = [`Found ${results.length} knowledge entries for "${query}":\n`];
|
|
39
|
+
for (const { entry, score, excerpt } of results) {
|
|
40
|
+
lines.push(`### ${entry.title} (score: ${score.toFixed(2)}, source: ${entry.source})`);
|
|
41
|
+
if (entry.tags.length > 0) {
|
|
42
|
+
lines.push(`Tags: ${entry.tags.join(', ')}`);
|
|
43
|
+
}
|
|
44
|
+
lines.push('');
|
|
45
|
+
lines.push(excerpt);
|
|
46
|
+
lines.push('');
|
|
47
|
+
}
|
|
48
|
+
return { success: true, output: lines.join('\n') };
|
|
49
|
+
}
|
|
50
|
+
getSchema() {
|
|
51
|
+
return {
|
|
52
|
+
name: this.name,
|
|
53
|
+
description: this.description,
|
|
54
|
+
parameters: {
|
|
55
|
+
type: 'object',
|
|
56
|
+
properties: {
|
|
57
|
+
query: {
|
|
58
|
+
type: 'string',
|
|
59
|
+
description: 'Keywords or phrase to search for in knowledge bases',
|
|
60
|
+
},
|
|
61
|
+
limit: {
|
|
62
|
+
type: 'number',
|
|
63
|
+
description: 'Maximum number of results to return (default: 5)',
|
|
64
|
+
},
|
|
65
|
+
scope: {
|
|
66
|
+
type: 'string',
|
|
67
|
+
description: 'Filter by agent mode scope (e.g. "code", "review")',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
required: ['query'],
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
validate(input) {
|
|
75
|
+
if (typeof input !== 'object' || input === null) {
|
|
76
|
+
return { valid: false, errors: ['Input must be an object'] };
|
|
77
|
+
}
|
|
78
|
+
const data = input;
|
|
79
|
+
if (typeof data.query !== 'string' || !data.query.trim()) {
|
|
80
|
+
return { valid: false, errors: ['query must be a non-empty string'] };
|
|
81
|
+
}
|
|
82
|
+
return { valid: true };
|
|
83
|
+
}
|
|
84
|
+
getMetadata() {
|
|
85
|
+
return {
|
|
86
|
+
name: this.name,
|
|
87
|
+
description: this.description,
|
|
88
|
+
category: 'utility',
|
|
89
|
+
keywords: ['knowledge', 'search', 'conventions', 'docs', 'domain'],
|
|
90
|
+
priority: 4,
|
|
91
|
+
requiresConfirmation: false,
|
|
92
|
+
modifiesFiles: false,
|
|
93
|
+
makesNetworkRequests: false,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
isAvailable() {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
// ============================================================================
|
|
101
|
+
// knowledge_add
|
|
102
|
+
// ============================================================================
|
|
103
|
+
export class KnowledgeAddTool {
|
|
104
|
+
name = 'knowledge_add';
|
|
105
|
+
description = 'Add a new entry to the user-level knowledge base (~/.codebuddy/knowledge/). Use this to persist learned conventions, procedures, or domain knowledge across sessions.';
|
|
106
|
+
async execute(input) {
|
|
107
|
+
const km = getKnowledgeManager();
|
|
108
|
+
const title = input.title;
|
|
109
|
+
const content = input.content;
|
|
110
|
+
const tags = input.tags ?? [];
|
|
111
|
+
const scope = input.scope ?? [];
|
|
112
|
+
try {
|
|
113
|
+
const filePath = await km.add(title, content, tags, scope);
|
|
114
|
+
return {
|
|
115
|
+
success: true,
|
|
116
|
+
output: `Knowledge entry "${title}" saved to ${filePath}`,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
catch (err) {
|
|
120
|
+
return {
|
|
121
|
+
success: false,
|
|
122
|
+
error: `Failed to save knowledge: ${err instanceof Error ? err.message : String(err)}`,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
getSchema() {
|
|
127
|
+
return {
|
|
128
|
+
name: this.name,
|
|
129
|
+
description: this.description,
|
|
130
|
+
parameters: {
|
|
131
|
+
type: 'object',
|
|
132
|
+
properties: {
|
|
133
|
+
title: {
|
|
134
|
+
type: 'string',
|
|
135
|
+
description: 'Title for this knowledge entry (becomes the filename)',
|
|
136
|
+
},
|
|
137
|
+
content: {
|
|
138
|
+
type: 'string',
|
|
139
|
+
description: 'Markdown content of the knowledge entry',
|
|
140
|
+
},
|
|
141
|
+
tags: {
|
|
142
|
+
type: 'array',
|
|
143
|
+
items: { type: 'string' },
|
|
144
|
+
description: 'Tags for discovery',
|
|
145
|
+
},
|
|
146
|
+
scope: {
|
|
147
|
+
type: 'array',
|
|
148
|
+
items: { type: 'string' },
|
|
149
|
+
description: 'Agent modes this applies to (e.g. ["code", "review"])',
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
required: ['title', 'content'],
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
validate(input) {
|
|
157
|
+
if (typeof input !== 'object' || input === null) {
|
|
158
|
+
return { valid: false, errors: ['Input must be an object'] };
|
|
159
|
+
}
|
|
160
|
+
const data = input;
|
|
161
|
+
if (typeof data.title !== 'string' || !data.title.trim()) {
|
|
162
|
+
return { valid: false, errors: ['title must be a non-empty string'] };
|
|
163
|
+
}
|
|
164
|
+
if (typeof data.content !== 'string' || !data.content.trim()) {
|
|
165
|
+
return { valid: false, errors: ['content must be a non-empty string'] };
|
|
166
|
+
}
|
|
167
|
+
return { valid: true };
|
|
168
|
+
}
|
|
169
|
+
getMetadata() {
|
|
170
|
+
return {
|
|
171
|
+
name: this.name,
|
|
172
|
+
description: this.description,
|
|
173
|
+
category: 'utility',
|
|
174
|
+
keywords: ['knowledge', 'add', 'save', 'persist', 'conventions'],
|
|
175
|
+
priority: 3,
|
|
176
|
+
requiresConfirmation: false,
|
|
177
|
+
modifiesFiles: true,
|
|
178
|
+
makesNetworkRequests: false,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
isAvailable() {
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
// ============================================================================
|
|
186
|
+
// AskHuman ITool adapter
|
|
187
|
+
// ============================================================================
|
|
188
|
+
import { getAskHumanTool } from '../ask-human-tool.js';
|
|
189
|
+
export class AskHumanExecuteTool {
|
|
190
|
+
name = 'ask_human';
|
|
191
|
+
description = "Pause execution and ask the user a clarifying question. Use when you need information that cannot be inferred from context, or when multiple interpretations exist. Returns the user's response.";
|
|
192
|
+
async execute(input) {
|
|
193
|
+
return await getAskHumanTool().execute({
|
|
194
|
+
question: input.question,
|
|
195
|
+
options: input.options,
|
|
196
|
+
timeout: input.timeout,
|
|
197
|
+
default: input.default,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
getSchema() {
|
|
201
|
+
return getAskHumanTool().getSchema();
|
|
202
|
+
}
|
|
203
|
+
validate(input) {
|
|
204
|
+
if (typeof input !== 'object' || input === null) {
|
|
205
|
+
return { valid: false, errors: ['Input must be an object'] };
|
|
206
|
+
}
|
|
207
|
+
const data = input;
|
|
208
|
+
if (typeof data.question !== 'string' || !data.question.trim()) {
|
|
209
|
+
return { valid: false, errors: ['question must be a non-empty string'] };
|
|
210
|
+
}
|
|
211
|
+
return { valid: true };
|
|
212
|
+
}
|
|
213
|
+
getMetadata() {
|
|
214
|
+
return {
|
|
215
|
+
name: this.name,
|
|
216
|
+
description: this.description,
|
|
217
|
+
category: 'utility',
|
|
218
|
+
keywords: ['ask', 'human', 'input', 'clarify', 'pause', 'question'],
|
|
219
|
+
priority: 6,
|
|
220
|
+
requiresConfirmation: false,
|
|
221
|
+
modifiesFiles: false,
|
|
222
|
+
makesNetworkRequests: false,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
isAvailable() {
|
|
226
|
+
return true;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
// ============================================================================
|
|
230
|
+
// CreateSkill ITool adapter
|
|
231
|
+
// ============================================================================
|
|
232
|
+
import { getCreateSkillTool } from '../create-skill-tool.js';
|
|
233
|
+
export class CreateSkillExecuteTool {
|
|
234
|
+
name = 'create_skill';
|
|
235
|
+
description = 'Create a new SKILL.md file in the workspace skills directory. Use this to codify reusable workflows or procedures for future sessions. Skills are hot-reloaded immediately.';
|
|
236
|
+
async execute(input) {
|
|
237
|
+
return await getCreateSkillTool().execute({
|
|
238
|
+
name: input.name,
|
|
239
|
+
description: input.description,
|
|
240
|
+
body: input.body,
|
|
241
|
+
tags: input.tags,
|
|
242
|
+
env: input.env,
|
|
243
|
+
requires: input.requires,
|
|
244
|
+
overwrite: input.overwrite,
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
getSchema() {
|
|
248
|
+
return getCreateSkillTool().getSchema();
|
|
249
|
+
}
|
|
250
|
+
validate(input) {
|
|
251
|
+
if (typeof input !== 'object' || input === null) {
|
|
252
|
+
return { valid: false, errors: ['Input must be an object'] };
|
|
253
|
+
}
|
|
254
|
+
const data = input;
|
|
255
|
+
if (typeof data.name !== 'string' || !data.name.trim()) {
|
|
256
|
+
return { valid: false, errors: ['name is required'] };
|
|
257
|
+
}
|
|
258
|
+
if (typeof data.description !== 'string' || !data.description.trim()) {
|
|
259
|
+
return { valid: false, errors: ['description is required'] };
|
|
260
|
+
}
|
|
261
|
+
if (typeof data.body !== 'string' || !data.body.trim()) {
|
|
262
|
+
return { valid: false, errors: ['body is required'] };
|
|
263
|
+
}
|
|
264
|
+
return { valid: true };
|
|
265
|
+
}
|
|
266
|
+
getMetadata() {
|
|
267
|
+
return {
|
|
268
|
+
name: this.name,
|
|
269
|
+
description: this.description,
|
|
270
|
+
category: 'utility',
|
|
271
|
+
keywords: ['skill', 'create', 'write', 'self-author', 'extension', 'workflow'],
|
|
272
|
+
priority: 3,
|
|
273
|
+
requiresConfirmation: false,
|
|
274
|
+
modifiesFiles: true,
|
|
275
|
+
makesNetworkRequests: false,
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
isAvailable() {
|
|
279
|
+
return true;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
// ============================================================================
|
|
283
|
+
// Factory
|
|
284
|
+
// ============================================================================
|
|
285
|
+
export function createKnowledgeTools() {
|
|
286
|
+
return [
|
|
287
|
+
new KnowledgeSearchTool(),
|
|
288
|
+
new KnowledgeAddTool(),
|
|
289
|
+
new AskHumanExecuteTool(),
|
|
290
|
+
new CreateSkillExecuteTool(),
|
|
291
|
+
];
|
|
292
|
+
}
|
|
293
|
+
//# sourceMappingURL=knowledge-tools.js.map
|