@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.
Files changed (67) hide show
  1. package/README.md +14 -1
  2. package/dist/agents/security-agent.d.ts +31 -0
  3. package/dist/agents/security-agent.js +180 -0
  4. package/dist/agents/security-rules.d.ts +35 -0
  5. package/dist/agents/security-rules.js +206 -0
  6. package/dist/agents/specialists.d.ts +6 -0
  7. package/dist/agents/specialists.js +45 -0
  8. package/dist/architect.js +5 -0
  9. package/dist/auth.js +1 -1
  10. package/dist/channels/matrix.d.ts +4 -0
  11. package/dist/channels/matrix.js +28 -0
  12. package/dist/channels/office.d.ts +78 -0
  13. package/dist/channels/office.js +169 -0
  14. package/dist/channels/registry.d.ts +8 -0
  15. package/dist/channels/registry.js +38 -0
  16. package/dist/channels/signal.d.ts +4 -0
  17. package/dist/channels/signal.js +29 -0
  18. package/dist/channels/slack.d.ts +4 -0
  19. package/dist/channels/slack.js +97 -0
  20. package/dist/channels/teams.d.ts +4 -0
  21. package/dist/channels/teams.js +29 -0
  22. package/dist/channels/telegram.d.ts +4 -0
  23. package/dist/channels/telegram.js +28 -0
  24. package/dist/channels/types.d.ts +50 -0
  25. package/dist/channels/types.js +13 -0
  26. package/dist/channels/whatsapp.d.ts +4 -0
  27. package/dist/channels/whatsapp.js +28 -0
  28. package/dist/cli.js +81 -0
  29. package/dist/computer-use-coordinator.d.ts +44 -0
  30. package/dist/computer-use-coordinator.js +0 -0
  31. package/dist/file-library.d.ts +76 -0
  32. package/dist/file-library.js +269 -0
  33. package/dist/ide/mcp-server.js +4 -4
  34. package/dist/managed-agents-anthropic.d.ts +90 -0
  35. package/dist/managed-agents-anthropic.js +123 -0
  36. package/dist/plugins-integrity.d.ts +72 -0
  37. package/dist/plugins-integrity.js +153 -0
  38. package/dist/plugins.d.ts +13 -2
  39. package/dist/plugins.js +87 -10
  40. package/dist/setup-editor.d.ts +28 -0
  41. package/dist/setup-editor.js +222 -0
  42. package/dist/tools/anthropic-managed-agents-tools.d.ts +22 -0
  43. package/dist/tools/anthropic-managed-agents-tools.js +191 -0
  44. package/dist/tools/channel-tools.d.ts +4 -0
  45. package/dist/tools/channel-tools.js +80 -0
  46. package/dist/tools/computer-coordinator-tools.d.ts +13 -0
  47. package/dist/tools/computer-coordinator-tools.js +104 -0
  48. package/dist/tools/computer.js +463 -299
  49. package/dist/tools/file-library-tools.d.ts +12 -0
  50. package/dist/tools/file-library-tools.js +191 -0
  51. package/dist/tools/image-thoughtful.d.ts +31 -0
  52. package/dist/tools/image-thoughtful.js +233 -0
  53. package/dist/tools/index.js +1 -0
  54. package/dist/tools/matrix.js +3 -3
  55. package/dist/tools/redblue.js +2 -2
  56. package/dist/tools/security-agent-tools.d.ts +34 -0
  57. package/dist/tools/security-agent-tools.js +30 -0
  58. package/dist/tools/security-hunt.js +1 -1
  59. package/dist/tools/subagent.js +2 -2
  60. package/dist/tools/swarm-2026-04.d.ts +2 -0
  61. package/dist/tools/swarm-2026-04.js +91 -0
  62. package/dist/tools/visa-payments.js +1 -1
  63. package/dist/tools/workspace-agent-tools.d.ts +19 -0
  64. package/dist/tools/workspace-agent-tools.js +191 -0
  65. package/dist/workspace-agents.d.ts +132 -0
  66. package/dist/workspace-agents.js +379 -0
  67. package/package.json +1 -1
@@ -0,0 +1,91 @@
1
+ // Tools landed via the 2026-04 capability swarm — parity with OpenClaw +
2
+ // ChatGPT/Codex April 2026 ships. Single registration entry-point so the
3
+ // lazy registry picks them up alongside everything else.
4
+ import { registerTool } from './index.js';
5
+ import { imageThoughtfulTool } from './image-thoughtful.js';
6
+ import { channelSendTool, channelReceiveTool } from './channel-tools.js';
7
+ import { fileLibraryAddTool, fileLibraryListTool, fileLibrarySearchTool, fileLibraryGetTool, } from './file-library-tools.js';
8
+ import { workspaceAgentTools } from './workspace-agent-tools.js';
9
+ import { computerCoordinatorTools } from './computer-coordinator-tools.js';
10
+ import { SECURITY_AGENT_TOOLS } from './security-agent-tools.js';
11
+ import { anthropicManagedAgentTools } from './anthropic-managed-agents-tools.js';
12
+ function adaptCoordinatorTool(t) {
13
+ const props = t.inputSchema.properties ?? {};
14
+ const required = new Set(t.inputSchema.required ?? []);
15
+ const parameters = {};
16
+ for (const [key, val] of Object.entries(props)) {
17
+ parameters[key] = {
18
+ type: val.type ?? 'string',
19
+ description: val.description ?? '',
20
+ required: required.has(key),
21
+ ...(val.items ? { items: val.items } : {}),
22
+ };
23
+ }
24
+ return {
25
+ name: t.name,
26
+ description: t.description,
27
+ parameters,
28
+ execute: async (args) => {
29
+ try {
30
+ const res = await t.handler(args);
31
+ return typeof res === 'string' ? res : JSON.stringify(res, null, 2);
32
+ }
33
+ catch (e) {
34
+ return `Error: ${e.message}`;
35
+ }
36
+ },
37
+ tier: 'free',
38
+ };
39
+ }
40
+ function adaptSecurityTool(t) {
41
+ // zod object shape extraction — best-effort parameter map for the API surface
42
+ const shape = t.schema._def?.shape?.() ??
43
+ t.schema.shape ??
44
+ {};
45
+ const parameters = {};
46
+ for (const [key, zodType] of Object.entries(shape)) {
47
+ const optional = typeof zodType.isOptional === 'function'
48
+ ? zodType.isOptional()
49
+ : false;
50
+ parameters[key] = {
51
+ type: 'string',
52
+ description: zodType.description ?? '',
53
+ required: !optional,
54
+ };
55
+ }
56
+ return {
57
+ name: t.name,
58
+ description: t.description,
59
+ parameters,
60
+ execute: async (args) => {
61
+ try {
62
+ const parsed = t.schema.parse(args);
63
+ const res = await t.run(parsed);
64
+ return typeof res === 'string' ? res : JSON.stringify(res, null, 2);
65
+ }
66
+ catch (e) {
67
+ return `Error: ${e.message}`;
68
+ }
69
+ },
70
+ tier: 'free',
71
+ };
72
+ }
73
+ export function registerSwarm2026Tools() {
74
+ registerTool(imageThoughtfulTool);
75
+ registerTool(channelSendTool);
76
+ registerTool(channelReceiveTool);
77
+ registerTool(fileLibraryAddTool);
78
+ registerTool(fileLibraryListTool);
79
+ registerTool(fileLibrarySearchTool);
80
+ registerTool(fileLibraryGetTool);
81
+ for (const t of workspaceAgentTools)
82
+ registerTool(t);
83
+ for (const t of anthropicManagedAgentTools)
84
+ registerTool(t);
85
+ for (const t of computerCoordinatorTools)
86
+ registerTool(adaptCoordinatorTool(t));
87
+ for (const t of SECURITY_AGENT_TOOLS) {
88
+ registerTool(adaptSecurityTool(t));
89
+ }
90
+ }
91
+ //# sourceMappingURL=swarm-2026-04.js.map
@@ -132,7 +132,7 @@ export function registerVisaPaymentTools() {
132
132
  });
133
133
  registerTool({
134
134
  name: 'visa_purchase',
135
- description: 'Purchase a digital resource (API key, domain, cloud credits, SaaS subscription) via Visa CLI. The agent can autonomously buy resources needed for task completion.',
135
+ description: 'Purchase a digital resource (API key, domain, cloud credits, SaaS subscription) via the Visa CLI on the user\'s machine. The user\'s configured spend limit applies; purchases over $100 require manual confirmation in the CLI. Use only when the user has authorized a purchase.',
136
136
  parameters: {
137
137
  service: { type: 'string', description: 'Service name (e.g., "vercel", "aws", "namecheap", "openai")', required: true },
138
138
  product: { type: 'string', description: 'Product or plan to purchase', required: true },
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Workspace Agent kbot tool definitions.
3
+ *
4
+ * NOT registered in tools/index.ts. Wire up via `registerWorkspaceAgentTools()`
5
+ * from a higher-level bootstrap once the feature is shipped.
6
+ *
7
+ * Each tool returns a string (the kbot tool contract). State persists via
8
+ * the WorkspaceAgent class — file at <root>/<id>.json.
9
+ */
10
+ import type { ToolDefinition } from './index.js';
11
+ export declare const workspaceAgentCreate: ToolDefinition;
12
+ export declare const workspaceAgentStart: ToolDefinition;
13
+ export declare const workspaceAgentResume: ToolDefinition;
14
+ export declare const workspaceAgentStatus: ToolDefinition;
15
+ export declare const workspaceAgentStop: ToolDefinition;
16
+ export declare const workspaceAgentList: ToolDefinition;
17
+ /** Convenience array — caller can iterate to register all six. */
18
+ export declare const workspaceAgentTools: ToolDefinition[];
19
+ //# sourceMappingURL=workspace-agent-tools.d.ts.map
@@ -0,0 +1,191 @@
1
+ /**
2
+ * Workspace Agent kbot tool definitions.
3
+ *
4
+ * NOT registered in tools/index.ts. Wire up via `registerWorkspaceAgentTools()`
5
+ * from a higher-level bootstrap once the feature is shipped.
6
+ *
7
+ * Each tool returns a string (the kbot tool contract). State persists via
8
+ * the WorkspaceAgent class — file at <root>/<id>.json.
9
+ */
10
+ import { WorkspaceAgent, } from '../workspace-agents.js';
11
+ function getAgent(opts) {
12
+ return new WorkspaceAgent(opts ?? {});
13
+ }
14
+ function fmt(value) {
15
+ if (typeof value === 'string')
16
+ return value;
17
+ return '```json\n' + JSON.stringify(value, null, 2) + '\n```';
18
+ }
19
+ function parseJsonArray(raw, field) {
20
+ if (raw === undefined || raw === null || raw === '')
21
+ return [];
22
+ if (Array.isArray(raw))
23
+ return raw.map(String);
24
+ if (typeof raw === 'string') {
25
+ const trimmed = raw.trim();
26
+ if (!trimmed)
27
+ return [];
28
+ try {
29
+ const parsed = JSON.parse(trimmed);
30
+ if (!Array.isArray(parsed)) {
31
+ throw new Error(`${field} must be a JSON array`);
32
+ }
33
+ return parsed.map(String);
34
+ }
35
+ catch (e) {
36
+ // accept comma-separated as a convenience
37
+ if (!trimmed.startsWith('[')) {
38
+ return trimmed
39
+ .split(',')
40
+ .map(s => s.trim())
41
+ .filter(Boolean);
42
+ }
43
+ throw e;
44
+ }
45
+ }
46
+ throw new Error(`${field} must be a string or array`);
47
+ }
48
+ export const workspaceAgentCreate = {
49
+ name: 'workspace_agent_create',
50
+ description: 'Create a long-running named workspace agent. Persists at ~/.kbot/workspace-agents/<id>.json. ' +
51
+ 'Names must be unique per workspace. Permissions enforced via allowedTools whitelist + scopes.',
52
+ parameters: {
53
+ name: {
54
+ type: 'string',
55
+ description: 'Unique name for this agent in the workspace.',
56
+ required: true,
57
+ },
58
+ mission: {
59
+ type: 'string',
60
+ description: '1–3 sentence mission the agent will pursue across sessions.',
61
+ required: true,
62
+ },
63
+ allowedTools: {
64
+ type: 'string',
65
+ description: 'JSON array (or comma-separated list) of tool names this agent may invoke. Empty = no tool calls.',
66
+ },
67
+ scopes: {
68
+ type: 'string',
69
+ description: 'JSON array (or comma-separated list) of capability scopes, e.g. ["read:files","write:tools","invoke:slack"].',
70
+ },
71
+ },
72
+ tier: 'free',
73
+ async execute(args) {
74
+ try {
75
+ const allowedTools = parseJsonArray(args.allowedTools, 'allowedTools');
76
+ const scopes = parseJsonArray(args.scopes, 'scopes');
77
+ const result = await getAgent().create({
78
+ name: String(args.name),
79
+ mission: String(args.mission),
80
+ allowedTools,
81
+ scopes,
82
+ });
83
+ return fmt({ created: result });
84
+ }
85
+ catch (e) {
86
+ return `Error: ${e.message}`;
87
+ }
88
+ },
89
+ };
90
+ export const workspaceAgentStart = {
91
+ name: 'workspace_agent_start',
92
+ description: 'Start a workspace agent on a task. Transitions status to "running", invokes the planner, persists tool calls into history.',
93
+ parameters: {
94
+ agentId: { type: 'string', description: 'Agent id from create.', required: true },
95
+ taskInput: {
96
+ type: 'string',
97
+ description: 'Task prompt to plan and execute.',
98
+ required: true,
99
+ },
100
+ },
101
+ tier: 'free',
102
+ async execute(args) {
103
+ try {
104
+ const result = await getAgent().start(String(args.agentId), String(args.taskInput));
105
+ return fmt({ started: result });
106
+ }
107
+ catch (e) {
108
+ return `Error: ${e.message}`;
109
+ }
110
+ },
111
+ };
112
+ export const workspaceAgentResume = {
113
+ name: 'workspace_agent_resume',
114
+ description: 'Resume a paused or failed workspace agent. Loads state from disk and transitions to running.',
115
+ parameters: {
116
+ agentId: { type: 'string', description: 'Agent id.', required: true },
117
+ },
118
+ tier: 'free',
119
+ async execute(args) {
120
+ try {
121
+ const state = await getAgent().resume(String(args.agentId));
122
+ return fmt({
123
+ resumed: { id: state.id, name: state.name, status: state.status },
124
+ });
125
+ }
126
+ catch (e) {
127
+ return `Error: ${e.message}`;
128
+ }
129
+ },
130
+ };
131
+ export const workspaceAgentStatus = {
132
+ name: 'workspace_agent_status',
133
+ description: 'Get full state for a workspace agent (status, history, plan).',
134
+ parameters: {
135
+ agentId: { type: 'string', description: 'Agent id.', required: true },
136
+ },
137
+ tier: 'free',
138
+ async execute(args) {
139
+ try {
140
+ const state = await getAgent().status(String(args.agentId));
141
+ return fmt(state);
142
+ }
143
+ catch (e) {
144
+ return `Error: ${e.message}`;
145
+ }
146
+ },
147
+ };
148
+ export const workspaceAgentStop = {
149
+ name: 'workspace_agent_stop',
150
+ description: 'Stop a running workspace agent. Transitions status to "paused".',
151
+ parameters: {
152
+ agentId: { type: 'string', description: 'Agent id.', required: true },
153
+ },
154
+ tier: 'free',
155
+ async execute(args) {
156
+ try {
157
+ const state = await getAgent().stop(String(args.agentId));
158
+ return fmt({
159
+ stopped: { id: state.id, name: state.name, status: state.status },
160
+ });
161
+ }
162
+ catch (e) {
163
+ return `Error: ${e.message}`;
164
+ }
165
+ },
166
+ };
167
+ export const workspaceAgentList = {
168
+ name: 'workspace_agent_list',
169
+ description: 'List all workspace agents in this workspace.',
170
+ parameters: {},
171
+ tier: 'free',
172
+ async execute() {
173
+ try {
174
+ const list = await getAgent().list();
175
+ return fmt({ agents: list, count: list.length });
176
+ }
177
+ catch (e) {
178
+ return `Error: ${e.message}`;
179
+ }
180
+ },
181
+ };
182
+ /** Convenience array — caller can iterate to register all six. */
183
+ export const workspaceAgentTools = [
184
+ workspaceAgentCreate,
185
+ workspaceAgentStart,
186
+ workspaceAgentResume,
187
+ workspaceAgentStatus,
188
+ workspaceAgentStop,
189
+ workspaceAgentList,
190
+ ];
191
+ //# sourceMappingURL=workspace-agent-tools.js.map
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Workspace Agents — long-running named agents bound to a workspace with
3
+ * permissions and resumable state. Parity with OpenAI's Workspace Agents
4
+ * (Apr 2026). Wraps the hierarchical planner at ./planner/hierarchical/.
5
+ *
6
+ * State JSON shape (one file per agent at <root>/<id>.json):
7
+ * { id, name, mission, allowedTools, scopes, status, createdAt, updatedAt,
8
+ * currentPlanId?, history: [{ ts, event, data }] }
9
+ *
10
+ * Storage root: process.env.KBOT_WORKSPACE_AGENTS_ROOT
11
+ * ?? <homedir>/.kbot/workspace-agents
12
+ *
13
+ * Permissions: every tool invocation must pass through `gate(toolName)` which
14
+ * checks `allowedTools`. Scopes are recorded but enforcement is per-tool via
15
+ * the allowedTools whitelist.
16
+ */
17
+ import type { AgentOptions } from './agent.js';
18
+ export type WorkspaceAgentStatus = 'idle' | 'running' | 'paused' | 'completed' | 'failed';
19
+ export type Scope = string;
20
+ export interface HistoryEvent {
21
+ ts: string;
22
+ event: string;
23
+ data?: unknown;
24
+ }
25
+ export interface WorkspaceAgentState {
26
+ id: string;
27
+ name: string;
28
+ mission: string;
29
+ allowedTools: string[];
30
+ scopes: Scope[];
31
+ status: WorkspaceAgentStatus;
32
+ createdAt: string;
33
+ updatedAt: string;
34
+ currentPlanId?: string;
35
+ history: HistoryEvent[];
36
+ }
37
+ export interface CreateOptions {
38
+ name: string;
39
+ mission: string;
40
+ allowedTools?: string[];
41
+ scopes?: Scope[];
42
+ }
43
+ export interface CreateResult {
44
+ id: string;
45
+ name: string;
46
+ }
47
+ export interface StartResult {
48
+ id: string;
49
+ status: WorkspaceAgentStatus;
50
+ planId?: string;
51
+ steps: unknown[];
52
+ }
53
+ export interface ListEntry {
54
+ id: string;
55
+ name: string;
56
+ status: WorkspaceAgentStatus;
57
+ }
58
+ export declare class ScopeError extends Error {
59
+ readonly toolName: string;
60
+ constructor(toolName: string, message?: string);
61
+ }
62
+ export declare class WorkspaceAgentError extends Error {
63
+ constructor(message: string);
64
+ }
65
+ export declare function defaultRoot(): string;
66
+ /** A single tool call surfaced by the planner, ready to be gated + recorded. */
67
+ export interface PlannerToolCall {
68
+ tool: string;
69
+ args?: unknown;
70
+ result?: unknown;
71
+ }
72
+ export interface PlannerStartResult {
73
+ planId: string;
74
+ steps: unknown[];
75
+ /**
76
+ * Optional list of tool calls the planner produced. When present, the
77
+ * WorkspaceAgent will run each through `gate()` and `recordToolCall()`,
78
+ * capturing `tool_blocked` events for any that ScopeError out.
79
+ */
80
+ toolCalls?: PlannerToolCall[];
81
+ /**
82
+ * Free-form notes the planner wants surfaced as history events. Each entry
83
+ * becomes a `planner_note` event on the agent's timeline.
84
+ */
85
+ notes?: string[];
86
+ }
87
+ export type PlannerStartFn = (taskInput: string, state: WorkspaceAgentState, agentOpts?: AgentOptions | null) => Promise<PlannerStartResult>;
88
+ /**
89
+ * Default planner adapter — implements the 3-tier strategy:
90
+ *
91
+ * Tier 1: KBOT_PLANNER=hierarchical AND non-null agentOpts → real
92
+ * HierarchicalPlanner.planAndExecute. Tool calls extracted from
93
+ * the resulting Action.steps and surfaced for gating.
94
+ * Tier 2: HierarchicalPlanner module loadable but no agentOpts → call
95
+ * createGoal only; emit a TODO note; return early.
96
+ * Tier 3: Module import fails (e.g. test env) → deterministic stub
97
+ * `{ planId: 'stub', steps: [] }`.
98
+ *
99
+ * The function never throws on planner-internal failures: each tier degrades
100
+ * to the next so the WorkspaceAgent.start() lifecycle stays predictable.
101
+ */
102
+ export declare const defaultPlannerStart: PlannerStartFn;
103
+ export interface WorkspaceAgentOptions {
104
+ /** Override storage root. Defaults to env or ~/.kbot/workspace-agents. */
105
+ root?: string;
106
+ /** Override planner adapter (used by tests). */
107
+ plannerStart?: PlannerStartFn;
108
+ }
109
+ export declare class WorkspaceAgent {
110
+ private readonly root;
111
+ private readonly plannerStart;
112
+ constructor(opts?: WorkspaceAgentOptions);
113
+ create(opts: CreateOptions): Promise<CreateResult>;
114
+ start(agentId: string, taskInput: string, agentOpts?: AgentOptions | null): Promise<StartResult>;
115
+ resume(agentId: string): Promise<WorkspaceAgentState>;
116
+ stop(agentId: string): Promise<WorkspaceAgentState>;
117
+ status(agentId: string): Promise<WorkspaceAgentState>;
118
+ list(): Promise<ListEntry[]>;
119
+ /**
120
+ * Permission gate. Throws ScopeError if the tool isn't in allowedTools and
121
+ * appends a `tool_denied` event to history. On allow, appends `tool_allowed`.
122
+ */
123
+ gate(agentId: string, toolName: string): Promise<void>;
124
+ /**
125
+ * Append a tool-call record to the agent's history. Caller must call
126
+ * `gate()` first; this method does NOT enforce permissions.
127
+ */
128
+ recordToolCall(agentId: string, toolName: string, args: unknown, result?: unknown): Promise<void>;
129
+ private appendEvent;
130
+ private requireState;
131
+ }
132
+ //# sourceMappingURL=workspace-agents.d.ts.map