@kernel.chat/kbot 3.99.31 → 3.99.34
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 +14 -1
- package/dist/agents/security-agent.d.ts +31 -0
- package/dist/agents/security-agent.js +180 -0
- package/dist/agents/security-rules.d.ts +35 -0
- package/dist/agents/security-rules.js +206 -0
- package/dist/agents/specialists.d.ts +6 -0
- package/dist/agents/specialists.js +45 -0
- package/dist/architect.js +5 -0
- package/dist/auth.js +1 -1
- package/dist/channels/matrix.d.ts +4 -0
- package/dist/channels/matrix.js +28 -0
- package/dist/channels/office.d.ts +78 -0
- package/dist/channels/office.js +169 -0
- package/dist/channels/registry.d.ts +8 -0
- package/dist/channels/registry.js +38 -0
- package/dist/channels/signal.d.ts +4 -0
- package/dist/channels/signal.js +29 -0
- package/dist/channels/slack.d.ts +4 -0
- package/dist/channels/slack.js +97 -0
- package/dist/channels/teams.d.ts +4 -0
- package/dist/channels/teams.js +29 -0
- package/dist/channels/telegram.d.ts +4 -0
- package/dist/channels/telegram.js +28 -0
- package/dist/channels/types.d.ts +50 -0
- package/dist/channels/types.js +13 -0
- package/dist/channels/whatsapp.d.ts +4 -0
- package/dist/channels/whatsapp.js +28 -0
- package/dist/cli.js +81 -0
- package/dist/computer-use-coordinator.d.ts +44 -0
- package/dist/computer-use-coordinator.js +0 -0
- package/dist/file-library.d.ts +76 -0
- package/dist/file-library.js +269 -0
- package/dist/ide/mcp-server.js +4 -4
- package/dist/managed-agents-anthropic.d.ts +90 -0
- package/dist/managed-agents-anthropic.js +123 -0
- package/dist/plugins-integrity.d.ts +72 -0
- package/dist/plugins-integrity.js +153 -0
- package/dist/plugins.d.ts +13 -2
- package/dist/plugins.js +87 -10
- package/dist/setup-editor.d.ts +28 -0
- package/dist/setup-editor.js +222 -0
- package/dist/tools/anthropic-managed-agents-tools.d.ts +22 -0
- package/dist/tools/anthropic-managed-agents-tools.js +191 -0
- package/dist/tools/channel-tools.d.ts +4 -0
- package/dist/tools/channel-tools.js +80 -0
- package/dist/tools/computer-coordinator-tools.d.ts +13 -0
- package/dist/tools/computer-coordinator-tools.js +104 -0
- package/dist/tools/computer.js +463 -299
- package/dist/tools/file-library-tools.d.ts +12 -0
- package/dist/tools/file-library-tools.js +191 -0
- package/dist/tools/image-thoughtful.d.ts +31 -0
- package/dist/tools/image-thoughtful.js +233 -0
- package/dist/tools/index.js +1 -0
- package/dist/tools/matrix.js +3 -3
- package/dist/tools/redblue.js +2 -2
- package/dist/tools/security-agent-tools.d.ts +34 -0
- package/dist/tools/security-agent-tools.js +30 -0
- package/dist/tools/security-hunt.js +1 -1
- package/dist/tools/subagent.js +2 -2
- package/dist/tools/swarm-2026-04.d.ts +2 -0
- package/dist/tools/swarm-2026-04.js +91 -0
- package/dist/tools/visa-payments.js +1 -1
- package/dist/tools/workspace-agent-tools.d.ts +19 -0
- package/dist/tools/workspace-agent-tools.js +191 -0
- package/dist/workspace-agents.d.ts +132 -0
- package/dist/workspace-agents.js +379 -0
- package/package.json +1 -1
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
// kbot setup-editor — idempotent installers that wire kbot's MCP server into
|
|
2
|
+
// editor settings (Claude Code, Cursor, Zed) and, for Claude Code, copy the
|
|
3
|
+
// kbot skill into the project's .claude/skills directory.
|
|
4
|
+
//
|
|
5
|
+
// All writes are atomic (tmp file + rename). Re-running is a no-op if the
|
|
6
|
+
// entries already exist. Existing user config is preserved.
|
|
7
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync, renameSync, copyFileSync, unlinkSync, } from 'node:fs';
|
|
8
|
+
import { dirname, join, resolve } from 'node:path';
|
|
9
|
+
import { homedir, platform, tmpdir } from 'node:os';
|
|
10
|
+
import { execSync } from 'node:child_process';
|
|
11
|
+
import { fileURLToPath } from 'node:url';
|
|
12
|
+
// ─── helpers ───────────────────────────────────────────────────────────────
|
|
13
|
+
function getHome(opts) {
|
|
14
|
+
return opts.home ?? homedir();
|
|
15
|
+
}
|
|
16
|
+
function getCwd(opts) {
|
|
17
|
+
return opts.cwd ?? process.cwd();
|
|
18
|
+
}
|
|
19
|
+
/** Resolve the kbot binary. Prefer process.execPath when run as `kbot`,
|
|
20
|
+
* fall back to `which kbot`, then to the literal string `kbot`. */
|
|
21
|
+
function resolveKbotBin(opts) {
|
|
22
|
+
if (opts.kbotBin)
|
|
23
|
+
return opts.kbotBin;
|
|
24
|
+
try {
|
|
25
|
+
const which = execSync('which kbot', { encoding: 'utf8' }).trim();
|
|
26
|
+
if (which)
|
|
27
|
+
return which;
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
/* fall through */
|
|
31
|
+
}
|
|
32
|
+
return 'kbot';
|
|
33
|
+
}
|
|
34
|
+
/** Resolve the local-MCP server path (lives at repo-root/tools/kbot-local-mcp.ts). */
|
|
35
|
+
function resolveKbotLocalMcpPath(opts) {
|
|
36
|
+
if (opts.kbotLocalMcpPath)
|
|
37
|
+
return opts.kbotLocalMcpPath;
|
|
38
|
+
// From this file: packages/kbot/src/setup-editor.ts → repo root is ../../..
|
|
39
|
+
try {
|
|
40
|
+
const here = fileURLToPath(import.meta.url);
|
|
41
|
+
const repoRoot = resolve(dirname(here), '..', '..', '..');
|
|
42
|
+
const candidate = join(repoRoot, 'tools', 'kbot-local-mcp.ts');
|
|
43
|
+
if (existsSync(candidate))
|
|
44
|
+
return candidate;
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
/* fall through */
|
|
48
|
+
}
|
|
49
|
+
return 'tools/kbot-local-mcp.ts';
|
|
50
|
+
}
|
|
51
|
+
function resolveSkillTemplatePath(opts) {
|
|
52
|
+
if (opts.skillTemplatePath)
|
|
53
|
+
return opts.skillTemplatePath;
|
|
54
|
+
try {
|
|
55
|
+
const here = fileURLToPath(import.meta.url);
|
|
56
|
+
// src/setup-editor.ts → packages/kbot/templates/kbot-skill.md
|
|
57
|
+
const pkgRoot = resolve(dirname(here), '..');
|
|
58
|
+
const candidate = join(pkgRoot, 'templates', 'kbot-skill.md');
|
|
59
|
+
if (existsSync(candidate))
|
|
60
|
+
return candidate;
|
|
61
|
+
// dist build: dist/setup-editor.js → packages/kbot/templates/kbot-skill.md
|
|
62
|
+
const candidate2 = resolve(dirname(here), '..', 'templates', 'kbot-skill.md');
|
|
63
|
+
if (existsSync(candidate2))
|
|
64
|
+
return candidate2;
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
/* fall through */
|
|
68
|
+
}
|
|
69
|
+
return '';
|
|
70
|
+
}
|
|
71
|
+
function readJson(p) {
|
|
72
|
+
if (!existsSync(p))
|
|
73
|
+
return {};
|
|
74
|
+
const txt = readFileSync(p, 'utf8').trim();
|
|
75
|
+
if (!txt)
|
|
76
|
+
return {};
|
|
77
|
+
try {
|
|
78
|
+
const parsed = JSON.parse(txt);
|
|
79
|
+
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
|
80
|
+
return parsed;
|
|
81
|
+
}
|
|
82
|
+
return {};
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
// Corrupt config — bail rather than overwrite.
|
|
86
|
+
throw new Error(`Refusing to overwrite invalid JSON at ${p}`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function writeJsonAtomic(p, data) {
|
|
90
|
+
mkdirSync(dirname(p), { recursive: true });
|
|
91
|
+
const tmp = join(dirname(p), `.${Date.now()}-${Math.random().toString(36).slice(2)}.tmp`);
|
|
92
|
+
const body = JSON.stringify(data, null, 2) + '\n';
|
|
93
|
+
writeFileSync(tmp, body, 'utf8');
|
|
94
|
+
try {
|
|
95
|
+
renameSync(tmp, p);
|
|
96
|
+
}
|
|
97
|
+
catch (e) {
|
|
98
|
+
try {
|
|
99
|
+
unlinkSync(tmp);
|
|
100
|
+
}
|
|
101
|
+
catch { /* ignore */ }
|
|
102
|
+
throw e;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/** Get an object property as a Record (creating it if missing/invalid). */
|
|
106
|
+
function getOrCreateObj(parent, key) {
|
|
107
|
+
const existing = parent[key];
|
|
108
|
+
if (existing && typeof existing === 'object' && !Array.isArray(existing)) {
|
|
109
|
+
return existing;
|
|
110
|
+
}
|
|
111
|
+
const fresh = {};
|
|
112
|
+
parent[key] = fresh;
|
|
113
|
+
return fresh;
|
|
114
|
+
}
|
|
115
|
+
/** MCP server entry shapes. Same shape works for Claude Code and Cursor;
|
|
116
|
+
* Zed nests under `context_servers` with the same `command`/`args` form. */
|
|
117
|
+
function buildMcpEntries(opts) {
|
|
118
|
+
const kbotBin = resolveKbotBin(opts);
|
|
119
|
+
const localMcp = resolveKbotLocalMcpPath(opts);
|
|
120
|
+
return {
|
|
121
|
+
kbot: { command: kbotBin, args: ['ide', 'mcp'] },
|
|
122
|
+
'kbot-local': { command: 'npx', args: ['tsx', localMcp] },
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
/** Merge MCP entries into a target map. Idempotent: if the key already exists,
|
|
126
|
+
* we leave it alone (user may have customized it). */
|
|
127
|
+
function mergeMcp(target, entries) {
|
|
128
|
+
const added = [];
|
|
129
|
+
const alreadyPresent = [];
|
|
130
|
+
for (const [name, entry] of Object.entries(entries)) {
|
|
131
|
+
if (name in target) {
|
|
132
|
+
alreadyPresent.push(name);
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
target[name] = entry;
|
|
136
|
+
added.push(name);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return { added, alreadyPresent };
|
|
140
|
+
}
|
|
141
|
+
// ─── Claude Code ───────────────────────────────────────────────────────────
|
|
142
|
+
export function setupClaudeCode(opts = {}) {
|
|
143
|
+
const home = getHome(opts);
|
|
144
|
+
const cwd = getCwd(opts);
|
|
145
|
+
const configPath = join(home, '.claude', 'settings.json');
|
|
146
|
+
const cfg = readJson(configPath);
|
|
147
|
+
const mcp = getOrCreateObj(cfg, 'mcpServers');
|
|
148
|
+
const { added, alreadyPresent } = mergeMcp(mcp, buildMcpEntries(opts));
|
|
149
|
+
if (added.length > 0)
|
|
150
|
+
writeJsonAtomic(configPath, cfg);
|
|
151
|
+
// Skill copy
|
|
152
|
+
const skillDir = join(cwd, '.claude', 'skills');
|
|
153
|
+
const skillDest = join(skillDir, 'kbot.md');
|
|
154
|
+
const skillSrc = resolveSkillTemplatePath(opts);
|
|
155
|
+
let skillCopied;
|
|
156
|
+
let skillAlreadyPresent;
|
|
157
|
+
if (skillSrc && existsSync(skillSrc)) {
|
|
158
|
+
mkdirSync(skillDir, { recursive: true });
|
|
159
|
+
if (existsSync(skillDest) && !opts.force) {
|
|
160
|
+
skillAlreadyPresent = skillDest;
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
copyFileSync(skillSrc, skillDest);
|
|
164
|
+
skillCopied = skillDest;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return {
|
|
168
|
+
configPath,
|
|
169
|
+
mcpAdded: added,
|
|
170
|
+
mcpAlreadyPresent: alreadyPresent,
|
|
171
|
+
skillCopied,
|
|
172
|
+
skillAlreadyPresent,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
// ─── Cursor ────────────────────────────────────────────────────────────────
|
|
176
|
+
function cursorConfigPath(home) {
|
|
177
|
+
if (platform() === 'darwin') {
|
|
178
|
+
return join(home, 'Library', 'Application Support', 'Cursor', 'User', 'settings.json');
|
|
179
|
+
}
|
|
180
|
+
if (platform() === 'win32') {
|
|
181
|
+
const appData = process.env.APPDATA ?? join(home, 'AppData', 'Roaming');
|
|
182
|
+
return join(appData, 'Cursor', 'User', 'settings.json');
|
|
183
|
+
}
|
|
184
|
+
// linux + everything else
|
|
185
|
+
return join(home, '.config', 'Cursor', 'User', 'settings.json');
|
|
186
|
+
}
|
|
187
|
+
export function setupCursor(opts = {}) {
|
|
188
|
+
const home = getHome(opts);
|
|
189
|
+
const configPath = cursorConfigPath(home);
|
|
190
|
+
const cfg = readJson(configPath);
|
|
191
|
+
// Cursor's evolving schema: it reads `mcp.servers` (nested) for MCP entries.
|
|
192
|
+
const mcp = getOrCreateObj(cfg, 'mcp');
|
|
193
|
+
const servers = getOrCreateObj(mcp, 'servers');
|
|
194
|
+
const { added, alreadyPresent } = mergeMcp(servers, buildMcpEntries(opts));
|
|
195
|
+
if (added.length > 0)
|
|
196
|
+
writeJsonAtomic(configPath, cfg);
|
|
197
|
+
return {
|
|
198
|
+
configPath,
|
|
199
|
+
mcpAdded: added,
|
|
200
|
+
mcpAlreadyPresent: alreadyPresent,
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
// ─── Zed ───────────────────────────────────────────────────────────────────
|
|
204
|
+
export function setupZed(opts = {}) {
|
|
205
|
+
const home = getHome(opts);
|
|
206
|
+
const configPath = join(home, '.config', 'zed', 'settings.json');
|
|
207
|
+
const cfg = readJson(configPath);
|
|
208
|
+
// Zed's assistant config is in flux. Best-effort shape: `assistant.mcpServers`.
|
|
209
|
+
const assistant = getOrCreateObj(cfg, 'assistant');
|
|
210
|
+
const mcp = getOrCreateObj(assistant, 'mcpServers');
|
|
211
|
+
const { added, alreadyPresent } = mergeMcp(mcp, buildMcpEntries(opts));
|
|
212
|
+
if (added.length > 0)
|
|
213
|
+
writeJsonAtomic(configPath, cfg);
|
|
214
|
+
return {
|
|
215
|
+
configPath,
|
|
216
|
+
mcpAdded: added,
|
|
217
|
+
mcpAlreadyPresent: alreadyPresent,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
// ─── tmpdir helper exported for tests ──────────────────────────────────────
|
|
221
|
+
export const _testHelpers = { tmpdir };
|
|
222
|
+
//# sourceMappingURL=setup-editor.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* kbot tool definitions wrapping the Anthropic Managed Agents client.
|
|
3
|
+
*
|
|
4
|
+
* Six tools mirror the client surface: create / turn / list / close /
|
|
5
|
+
* memory_read / memory_write. Each uses the canonical ToolDefinition shape
|
|
6
|
+
* from ./index.js.
|
|
7
|
+
*
|
|
8
|
+
* Wiring into the global tool registry happens elsewhere (tools/index.ts).
|
|
9
|
+
* This file only exports the definitions so workspace-agents.ts can pick
|
|
10
|
+
* them up when ANTHROPIC_API_KEY is set.
|
|
11
|
+
*
|
|
12
|
+
* SPEC: best-effort, refine when official docs published.
|
|
13
|
+
*/
|
|
14
|
+
import type { ToolDefinition } from './index.js';
|
|
15
|
+
export declare const anthropicManagedAgentCreate: ToolDefinition;
|
|
16
|
+
export declare const anthropicManagedAgentTurn: ToolDefinition;
|
|
17
|
+
export declare const anthropicManagedAgentList: ToolDefinition;
|
|
18
|
+
export declare const anthropicManagedAgentClose: ToolDefinition;
|
|
19
|
+
export declare const anthropicManagedAgentMemoryRead: ToolDefinition;
|
|
20
|
+
export declare const anthropicManagedAgentMemoryWrite: ToolDefinition;
|
|
21
|
+
export declare const anthropicManagedAgentTools: ToolDefinition[];
|
|
22
|
+
//# sourceMappingURL=anthropic-managed-agents-tools.d.ts.map
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* kbot tool definitions wrapping the Anthropic Managed Agents client.
|
|
3
|
+
*
|
|
4
|
+
* Six tools mirror the client surface: create / turn / list / close /
|
|
5
|
+
* memory_read / memory_write. Each uses the canonical ToolDefinition shape
|
|
6
|
+
* from ./index.js.
|
|
7
|
+
*
|
|
8
|
+
* Wiring into the global tool registry happens elsewhere (tools/index.ts).
|
|
9
|
+
* This file only exports the definitions so workspace-agents.ts can pick
|
|
10
|
+
* them up when ANTHROPIC_API_KEY is set.
|
|
11
|
+
*
|
|
12
|
+
* SPEC: best-effort, refine when official docs published.
|
|
13
|
+
*/
|
|
14
|
+
import { AnthropicManagedAgentsClient } from '../managed-agents-anthropic.js';
|
|
15
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
16
|
+
// Helpers
|
|
17
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
18
|
+
function getClient() {
|
|
19
|
+
// Construct fresh per call so callers can rotate API keys without
|
|
20
|
+
// restarting the process. The constructor cost is trivial (just a string
|
|
21
|
+
// copy and a fetch reference).
|
|
22
|
+
return new AnthropicManagedAgentsClient();
|
|
23
|
+
}
|
|
24
|
+
function asString(v) {
|
|
25
|
+
return typeof v === 'string' ? v : undefined;
|
|
26
|
+
}
|
|
27
|
+
function asStringArray(v) {
|
|
28
|
+
if (!Array.isArray(v))
|
|
29
|
+
return undefined;
|
|
30
|
+
const out = [];
|
|
31
|
+
for (const item of v) {
|
|
32
|
+
if (typeof item === 'string')
|
|
33
|
+
out.push(item);
|
|
34
|
+
}
|
|
35
|
+
return out;
|
|
36
|
+
}
|
|
37
|
+
async function safeRun(fn) {
|
|
38
|
+
try {
|
|
39
|
+
const result = await fn();
|
|
40
|
+
return JSON.stringify(result, null, 2);
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
44
|
+
return `Error: ${message}`;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
48
|
+
// Tools
|
|
49
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
50
|
+
export const anthropicManagedAgentCreate = {
|
|
51
|
+
name: 'anthropic_managed_agent_create',
|
|
52
|
+
description: 'Create a hosted Anthropic Managed Agent session. Returns session_id. Requires ANTHROPIC_API_KEY. Sends anthropic-beta: managed-agents-2026-04-01.',
|
|
53
|
+
tier: 'pro',
|
|
54
|
+
parameters: {
|
|
55
|
+
mission: {
|
|
56
|
+
type: 'string',
|
|
57
|
+
description: 'The agent\'s long-horizon goal / mission statement.',
|
|
58
|
+
required: true,
|
|
59
|
+
},
|
|
60
|
+
allowed_tools: {
|
|
61
|
+
type: 'array',
|
|
62
|
+
description: 'Optional list of tool names the hosted agent may invoke.',
|
|
63
|
+
items: { type: 'string' },
|
|
64
|
+
},
|
|
65
|
+
model: {
|
|
66
|
+
type: 'string',
|
|
67
|
+
description: 'Optional model override (e.g., "claude-sonnet-4-7").',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
async execute(args) {
|
|
71
|
+
return safeRun(async () => {
|
|
72
|
+
const mission = asString(args.mission) ?? '';
|
|
73
|
+
const allowedTools = asStringArray(args.allowed_tools);
|
|
74
|
+
const model = asString(args.model);
|
|
75
|
+
return getClient().createSession({ mission, allowedTools, model });
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
export const anthropicManagedAgentTurn = {
|
|
80
|
+
name: 'anthropic_managed_agent_turn',
|
|
81
|
+
description: 'Send a turn (user input) to an Anthropic Managed Agent session. Returns the agent output and any tool calls.',
|
|
82
|
+
tier: 'pro',
|
|
83
|
+
parameters: {
|
|
84
|
+
session_id: {
|
|
85
|
+
type: 'string',
|
|
86
|
+
description: 'Session id returned by anthropic_managed_agent_create.',
|
|
87
|
+
required: true,
|
|
88
|
+
},
|
|
89
|
+
input: {
|
|
90
|
+
type: 'string',
|
|
91
|
+
description: 'The user-side input for this turn.',
|
|
92
|
+
required: true,
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
async execute(args) {
|
|
96
|
+
return safeRun(async () => {
|
|
97
|
+
const sessionId = asString(args.session_id) ?? '';
|
|
98
|
+
const input = asString(args.input) ?? '';
|
|
99
|
+
return getClient().sendTurn({ sessionId, input });
|
|
100
|
+
});
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
export const anthropicManagedAgentList = {
|
|
104
|
+
name: 'anthropic_managed_agent_list',
|
|
105
|
+
description: 'List all hosted Anthropic Managed Agent sessions for the configured API key.',
|
|
106
|
+
tier: 'pro',
|
|
107
|
+
parameters: {},
|
|
108
|
+
async execute() {
|
|
109
|
+
return safeRun(async () => getClient().listSessions());
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
export const anthropicManagedAgentClose = {
|
|
113
|
+
name: 'anthropic_managed_agent_close',
|
|
114
|
+
description: 'Close (DELETE) a hosted Anthropic Managed Agent session.',
|
|
115
|
+
tier: 'pro',
|
|
116
|
+
parameters: {
|
|
117
|
+
session_id: {
|
|
118
|
+
type: 'string',
|
|
119
|
+
description: 'Session id to close.',
|
|
120
|
+
required: true,
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
async execute(args) {
|
|
124
|
+
return safeRun(async () => {
|
|
125
|
+
const sessionId = asString(args.session_id) ?? '';
|
|
126
|
+
return getClient().closeSession({ sessionId });
|
|
127
|
+
});
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
export const anthropicManagedAgentMemoryRead = {
|
|
131
|
+
name: 'anthropic_managed_agent_memory_read',
|
|
132
|
+
description: 'Read a memory value from a hosted Anthropic Managed Agent session. Pass key to read a single entry; omit key for the full memory.',
|
|
133
|
+
tier: 'pro',
|
|
134
|
+
parameters: {
|
|
135
|
+
session_id: {
|
|
136
|
+
type: 'string',
|
|
137
|
+
description: 'Session id.',
|
|
138
|
+
required: true,
|
|
139
|
+
},
|
|
140
|
+
key: {
|
|
141
|
+
type: 'string',
|
|
142
|
+
description: 'Optional memory key. If omitted, returns the full memory.',
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
async execute(args) {
|
|
146
|
+
return safeRun(async () => {
|
|
147
|
+
const sessionId = asString(args.session_id) ?? '';
|
|
148
|
+
const key = asString(args.key);
|
|
149
|
+
return getClient().memoryRead({ sessionId, key });
|
|
150
|
+
});
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
export const anthropicManagedAgentMemoryWrite = {
|
|
154
|
+
name: 'anthropic_managed_agent_memory_write',
|
|
155
|
+
description: 'Write a memory value to a hosted Anthropic Managed Agent session.',
|
|
156
|
+
tier: 'pro',
|
|
157
|
+
parameters: {
|
|
158
|
+
session_id: {
|
|
159
|
+
type: 'string',
|
|
160
|
+
description: 'Session id.',
|
|
161
|
+
required: true,
|
|
162
|
+
},
|
|
163
|
+
key: {
|
|
164
|
+
type: 'string',
|
|
165
|
+
description: 'Memory key to write.',
|
|
166
|
+
required: true,
|
|
167
|
+
},
|
|
168
|
+
value: {
|
|
169
|
+
type: 'string',
|
|
170
|
+
description: 'Value to store. Strings are stored as-is; if the value is a JSON string it is forwarded verbatim.',
|
|
171
|
+
required: true,
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
async execute(args) {
|
|
175
|
+
return safeRun(async () => {
|
|
176
|
+
const sessionId = asString(args.session_id) ?? '';
|
|
177
|
+
const key = asString(args.key) ?? '';
|
|
178
|
+
const value = args.value;
|
|
179
|
+
return getClient().memoryWrite({ sessionId, key, value });
|
|
180
|
+
});
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
export const anthropicManagedAgentTools = [
|
|
184
|
+
anthropicManagedAgentCreate,
|
|
185
|
+
anthropicManagedAgentTurn,
|
|
186
|
+
anthropicManagedAgentList,
|
|
187
|
+
anthropicManagedAgentClose,
|
|
188
|
+
anthropicManagedAgentMemoryRead,
|
|
189
|
+
anthropicManagedAgentMemoryWrite,
|
|
190
|
+
];
|
|
191
|
+
//# sourceMappingURL=anthropic-managed-agents-tools.js.map
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// kbot tool definitions for the unified channel adapter family.
|
|
2
|
+
//
|
|
3
|
+
// These tools are NOT auto-registered. Whoever wires them in (cli.ts,
|
|
4
|
+
// a plugin, or an agent prompt) should call `registerTool(channelSendTool)`
|
|
5
|
+
// and `registerTool(channelReceiveTool)`. Keeping registration external
|
|
6
|
+
// preserves the CURATION_PLAN.md target of 52 core tools.
|
|
7
|
+
import { getChannel } from '../channels/registry.js';
|
|
8
|
+
export const channelSendTool = {
|
|
9
|
+
name: 'channel_send',
|
|
10
|
+
description: 'Send a message through a unified channel adapter (slack, whatsapp, telegram, signal, matrix, teams). Slack is fully implemented; others are stubs and will throw until implemented.',
|
|
11
|
+
tier: 'pro',
|
|
12
|
+
parameters: {
|
|
13
|
+
channel_type: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
description: 'Adapter name: slack | whatsapp | telegram | signal | matrix | teams',
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
channel: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
description: 'Target channel/chat/room id understood by the adapter',
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
text: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
description: 'Plain-text message body',
|
|
26
|
+
required: true,
|
|
27
|
+
},
|
|
28
|
+
blocks: {
|
|
29
|
+
type: 'array',
|
|
30
|
+
description: 'Optional rich content (Slack blocks, etc.)',
|
|
31
|
+
required: false,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
async execute(args) {
|
|
35
|
+
const adapter = getChannel(String(args.channel_type));
|
|
36
|
+
const result = await adapter.send({
|
|
37
|
+
channel: String(args.channel),
|
|
38
|
+
text: String(args.text),
|
|
39
|
+
blocks: args.blocks,
|
|
40
|
+
});
|
|
41
|
+
return JSON.stringify({ ok: true, adapter: adapter.name, ...result });
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
export const channelReceiveTool = {
|
|
45
|
+
name: 'channel_receive',
|
|
46
|
+
description: 'Fetch recent messages from a unified channel adapter. Returns a JSON array of {id, from, text, ts}.',
|
|
47
|
+
tier: 'pro',
|
|
48
|
+
parameters: {
|
|
49
|
+
channel_type: {
|
|
50
|
+
type: 'string',
|
|
51
|
+
description: 'Adapter name: slack | whatsapp | telegram | signal | matrix | teams',
|
|
52
|
+
required: true,
|
|
53
|
+
},
|
|
54
|
+
channel: {
|
|
55
|
+
type: 'string',
|
|
56
|
+
description: 'Source channel/chat/room id',
|
|
57
|
+
required: true,
|
|
58
|
+
},
|
|
59
|
+
oldest: {
|
|
60
|
+
type: 'number',
|
|
61
|
+
description: 'Unix epoch ms; only return messages newer than this',
|
|
62
|
+
required: false,
|
|
63
|
+
},
|
|
64
|
+
limit: {
|
|
65
|
+
type: 'number',
|
|
66
|
+
description: 'Maximum messages to return',
|
|
67
|
+
required: false,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
async execute(args) {
|
|
71
|
+
const adapter = getChannel(String(args.channel_type));
|
|
72
|
+
const messages = await adapter.receive({
|
|
73
|
+
channel: String(args.channel),
|
|
74
|
+
oldest: args.oldest === undefined ? undefined : Number(args.oldest),
|
|
75
|
+
limit: args.limit === undefined ? undefined : Number(args.limit),
|
|
76
|
+
});
|
|
77
|
+
return JSON.stringify({ ok: true, adapter: adapter.name, messages });
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
//# sourceMappingURL=channel-tools.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface ToolDef {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
inputSchema: Record<string, unknown>;
|
|
5
|
+
handler: (args: Record<string, unknown>) => Promise<unknown> | unknown;
|
|
6
|
+
}
|
|
7
|
+
export declare const computerCoordinatorRegister: ToolDef;
|
|
8
|
+
export declare const computerCoordinatorClaim: ToolDef;
|
|
9
|
+
export declare const computerCoordinatorRelease: ToolDef;
|
|
10
|
+
export declare const computerCoordinatorStatus: ToolDef;
|
|
11
|
+
export declare const computerCoordinatorUnregister: ToolDef;
|
|
12
|
+
export declare const computerCoordinatorTools: ToolDef[];
|
|
13
|
+
//# sourceMappingURL=computer-coordinator-tools.d.ts.map
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// Tool definitions for the Computer-Use Coordinator.
|
|
2
|
+
//
|
|
3
|
+
// NOT registered here — wiring lives in computer.ts (or wherever the
|
|
4
|
+
// `--computer-use` flag is interpreted). Exporting plain definitions
|
|
5
|
+
// keeps this file pure and testable.
|
|
6
|
+
import { Coordinator } from '../computer-use-coordinator.js';
|
|
7
|
+
let shared = null;
|
|
8
|
+
function instance() {
|
|
9
|
+
if (!shared)
|
|
10
|
+
shared = new Coordinator();
|
|
11
|
+
return shared;
|
|
12
|
+
}
|
|
13
|
+
function asString(v, field) {
|
|
14
|
+
if (typeof v !== 'string' || !v)
|
|
15
|
+
throw new Error(`${field} must be a non-empty string`);
|
|
16
|
+
return v;
|
|
17
|
+
}
|
|
18
|
+
function asStringArray(v, field) {
|
|
19
|
+
if (!Array.isArray(v) || v.some((x) => typeof x !== 'string')) {
|
|
20
|
+
throw new Error(`${field} must be a string[]`);
|
|
21
|
+
}
|
|
22
|
+
return v;
|
|
23
|
+
}
|
|
24
|
+
export const computerCoordinatorRegister = {
|
|
25
|
+
name: 'computer_coordinator_register',
|
|
26
|
+
description: 'Register an agent with the parallel computer-use coordinator. Declares which apps it intends to drive.',
|
|
27
|
+
inputSchema: {
|
|
28
|
+
type: 'object',
|
|
29
|
+
required: ['agentId', 'apps'],
|
|
30
|
+
properties: {
|
|
31
|
+
agentId: { type: 'string' },
|
|
32
|
+
apps: { type: 'array', items: { type: 'string' } },
|
|
33
|
+
windowIds: { type: 'array', items: { type: 'string' } },
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
handler: (args) => {
|
|
37
|
+
const agentId = asString(args.agentId, 'agentId');
|
|
38
|
+
const apps = asStringArray(args.apps, 'apps');
|
|
39
|
+
const windowIds = args.windowIds === undefined ? undefined : asStringArray(args.windowIds, 'windowIds');
|
|
40
|
+
instance().register(agentId, { apps, windowIds });
|
|
41
|
+
return { ok: true, agentId, apps, windowIds: windowIds ?? [] };
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
export const computerCoordinatorClaim = {
|
|
45
|
+
name: 'computer_coordinator_claim',
|
|
46
|
+
description: 'Claim exclusive control of one app for an agent. Denied if another live agent already holds it.',
|
|
47
|
+
inputSchema: {
|
|
48
|
+
type: 'object',
|
|
49
|
+
required: ['agentId', 'app'],
|
|
50
|
+
properties: {
|
|
51
|
+
agentId: { type: 'string' },
|
|
52
|
+
app: { type: 'string' },
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
handler: (args) => {
|
|
56
|
+
const agentId = asString(args.agentId, 'agentId');
|
|
57
|
+
const app = asString(args.app, 'app');
|
|
58
|
+
return instance().claim(agentId, app);
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
export const computerCoordinatorRelease = {
|
|
62
|
+
name: 'computer_coordinator_release',
|
|
63
|
+
description: 'Release a previously claimed app so another agent can take it.',
|
|
64
|
+
inputSchema: {
|
|
65
|
+
type: 'object',
|
|
66
|
+
required: ['agentId', 'app'],
|
|
67
|
+
properties: {
|
|
68
|
+
agentId: { type: 'string' },
|
|
69
|
+
app: { type: 'string' },
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
handler: (args) => {
|
|
73
|
+
const agentId = asString(args.agentId, 'agentId');
|
|
74
|
+
const app = asString(args.app, 'app');
|
|
75
|
+
return { released: instance().release(agentId, app) };
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
export const computerCoordinatorStatus = {
|
|
79
|
+
name: 'computer_coordinator_status',
|
|
80
|
+
description: 'List all registered agents and which apps they currently hold.',
|
|
81
|
+
inputSchema: { type: 'object', properties: {} },
|
|
82
|
+
handler: () => instance().status(),
|
|
83
|
+
};
|
|
84
|
+
export const computerCoordinatorUnregister = {
|
|
85
|
+
name: 'computer_coordinator_unregister',
|
|
86
|
+
description: 'Unregister an agent and release every claim it owns.',
|
|
87
|
+
inputSchema: {
|
|
88
|
+
type: 'object',
|
|
89
|
+
required: ['agentId'],
|
|
90
|
+
properties: { agentId: { type: 'string' } },
|
|
91
|
+
},
|
|
92
|
+
handler: (args) => {
|
|
93
|
+
const agentId = asString(args.agentId, 'agentId');
|
|
94
|
+
return { released: instance().unregister(agentId) };
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
export const computerCoordinatorTools = [
|
|
98
|
+
computerCoordinatorRegister,
|
|
99
|
+
computerCoordinatorClaim,
|
|
100
|
+
computerCoordinatorRelease,
|
|
101
|
+
computerCoordinatorStatus,
|
|
102
|
+
computerCoordinatorUnregister,
|
|
103
|
+
];
|
|
104
|
+
//# sourceMappingURL=computer-coordinator-tools.js.map
|