@koalaauto/agentchannel 3.63.2 → 3.64.0

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 CHANGED
@@ -168,12 +168,38 @@ Claude runs with no user/project settings and no MCP servers
168
168
  hooks or global `AGENTS.md`) and a link to the login file of your Codex home
169
169
  (placed by path; the file is never read or copied by AgentChannel).
170
170
 
171
- ## Host capabilities
171
+ ## Host capabilities, MCP servers and skills
172
+
173
+ Background runs cannot read your home or the machine's secrets, and they load none of your own Claude or Codex settings (no
174
+ MCP servers, plugins or skills of yours, and not the apps or connectors of your account login). What a run may use besides
175
+ its task directory is what you declare in `<agent home>/capabilities.json`, for every teammate who sends it a task or
176
+ mentions it. Declare only what is safe for anyone on the team (read-only).
177
+
178
+ ```json
179
+ {
180
+ "capabilities": [{ "name": "task_logs", "description": "Logs of a video task", "command": ["/usr/local/bin/task-logs", "{id}"], "args": { "id": { "pattern": "[0-9]+" } } }],
181
+ "mcp": [
182
+ { "name": "posthog", "description": "PostHog analytics, project 593642", "url": "https://mcp.posthog.com/mcp", "oauth": true, "tools": ["query-run"] },
183
+ { "name": "sentry", "description": "Sentry issues", "url": "https://mcp.sentry.dev/mcp", "headers": { "Authorization": "Bearer <read-only token>" }, "tools": ["search_issues"] },
184
+ { "name": "files", "description": "Our docs search", "command": ["npx", "-y", "@acme/docs-mcp"], "env": { "DOCS_KEY": "..." }, "tools": ["search"] }
185
+ ],
186
+ "skills": ["/home/me/skills"]
187
+ }
188
+ ```
172
189
 
173
- Background runs cannot read your home or the machine's secrets. To let them (and every teammate who sends them a task or
174
- mentions them) still look things up that only this machine reaches, declare commands in `<agent home>/capabilities.json`:
175
- each becomes a tool the run calls without asking, executed outside the sandbox with checked arguments and no shell. Declare
176
- only what is safe for anyone on the team (read-only). `ach caps` lists them, `ach caps run <name> arg=value` tries one.
190
+ - **commands**: each becomes a tool the run calls without asking, executed outside the sandbox with checked arguments and no
191
+ shell. `ach caps run <name> arg=value` tries one.
192
+ - **mcp**: each becomes an MCP server of that name in the run, offering only the listed `tools`. AgentChannel connects to the
193
+ real server for the run (remote: streamable HTTP or SSE; local: the command), so the address, headers, env and login stay
194
+ on this machine. `ach caps tools <name>` lists what a server offers (and which tools it marks read-only), `ach caps login
195
+ <name>` logs in to a server declared with `"oauth": true` (a browser here, or paste the address it lands on). Give a server
196
+ a credential that cannot write: a generic tool writes or not according to its credential.
197
+ - **skills**: a folder with a `SKILL.md`, or a folder of them. Each run gets a copy (Claude Code and Codex load them as their
198
+ own skills, other runtimes are told where they are). A skill's scripts run in the sandbox; what needs secrets is a command
199
+ or an MCP server.
200
+
201
+ `ach caps` lists all of it and what is wrong; calls are logged to `<agent home>/logs/caps.log`. Teammates see the names and
202
+ descriptions (never addresses or credentials) on the agent's page. Kiro runs, in Kiro's cloud, get none of it.
177
203
 
178
204
  ## Where things are kept
179
205
 
@@ -1,3 +1,4 @@
1
+ import type { RunTools } from '../caps.js';
1
2
  import type { RuntimeModels } from './models.js';
2
3
  import { type AdapterEvent, type AdapterResult, type AdapterRunOptions, type RuntimeAdapter } from './types.js';
3
4
  import type { Perm } from '../perm.js';
@@ -40,11 +41,11 @@ export interface AgyMcpServer {
40
41
  command: string;
41
42
  args: string[];
42
43
  }
43
- /** The MCP servers of a work run: `ach` as a tool, and the owner's host capabilities when declared. Other runs get none. */
44
+ /** The MCP servers of a work run: `ach` as a tool, and the servers its owner declared (decisions §34, §38). Other runs get none. */
44
45
  export declare function agyServers(o: {
45
46
  mode?: AdapterRunOptions['mode'];
46
47
  cli: string;
47
- caps?: AgyMcpServer;
48
+ tools?: RunTools;
48
49
  }): Record<string, AgyMcpServer>;
49
50
  /** `.agents/mcp_config.json` of the work dir with the run's servers added to what the project has there. Pure. */
50
51
  export declare function agyMcpConfig(existing: string | undefined, servers: Record<string, AgyMcpServer>): string;
@@ -159,6 +160,7 @@ export declare class AntigravityAdapter implements RuntimeAdapter {
159
160
  readonly reads: "machine";
160
161
  readonly budget: false;
161
162
  readonly ownerMemory: "prompt";
163
+ readonly skills: "prompt";
162
164
  readonly ownFiles: readonly [];
163
165
  readonly login: {
164
166
  readonly command: "agy";
@@ -2,7 +2,6 @@ import { execFile } from 'node:child_process';
2
2
  import { existsSync, mkdirSync, readFileSync, rmdirSync, rmSync, writeFileSync } from 'node:fs';
3
3
  import { dirname, join, relative, isAbsolute } from 'node:path';
4
4
  import { fileURLToPath } from 'node:url';
5
- import { CAPS_SERVER } from '../caps.js';
6
5
  import { RUN_TOOL_SERVER } from '../runtool.js';
7
6
  import { RUNTIME_SPECS } from './spec.js';
8
7
  import { spawnGroup } from './procgroup.js';
@@ -64,11 +63,14 @@ export function agySettings(o) {
64
63
  return { permissions: { ...allow, deny: ['command(*)', 'unsandboxed(*)', 'write_file(*)', ...net, ...secrets] } };
65
64
  return { toolPermission: 'proceed-in-sandbox', enableTerminalSandbox: true, permissions: { ...allow, deny: ['unsandboxed(*)', ...net, ...secrets] } };
66
65
  }
67
- /** The MCP servers of a work run: `ach` as a tool, and the owner's host capabilities when declared. Other runs get none. */
66
+ /** The MCP servers of a work run: `ach` as a tool, and the servers its owner declared (decisions §34, §38). Other runs get none. */
68
67
  export function agyServers(o) {
69
68
  if (o.mode && o.mode !== 'work')
70
69
  return {};
71
- return { [RUN_TOOL_SERVER]: { command: process.execPath, args: [o.cli, 'run-tool-serve'] }, ...(o.caps ? { [CAPS_SERVER]: { command: o.caps.command, args: o.caps.args } } : {}) };
70
+ return {
71
+ [RUN_TOOL_SERVER]: { command: process.execPath, args: [o.cli, 'run-tool-serve'] },
72
+ ...Object.fromEntries((o.tools?.servers ?? []).filter((s) => s.tools.length).map((s) => [s.name, { command: s.command, args: s.args }])),
73
+ };
72
74
  }
73
75
  /** `.agents/mcp_config.json` of the work dir with the run's servers added to what the project has there. Pure. */
74
76
  export function agyMcpConfig(existing, servers) {
@@ -358,7 +360,7 @@ export class AntigravityAdapter {
358
360
  opts.onEvent({ type: 'error', data: error });
359
361
  return { finalText: '', ok: false, error };
360
362
  }
361
- const servers = agyServers({ mode: opts.mode, cli: this.o.cli ?? fileURLToPath(new URL('../cli.js', import.meta.url)), caps: opts.caps });
363
+ const servers = agyServers({ mode: opts.mode, cli: this.o.cli ?? fileURLToPath(new URL('../cli.js', import.meta.url)), tools: opts.tools });
362
364
  const mcp = Object.keys(servers);
363
365
  let restore = () => { };
364
366
  try {
@@ -1,6 +1,6 @@
1
1
  import type { CanUseTool, HookCallbackMatcher, Options } from '@anthropic-ai/claude-agent-sdk';
2
2
  import type { Perm } from '../perm.js';
3
- import { type CapsServerSpec } from '../caps.js';
3
+ import type { RunTools } from '../caps.js';
4
4
  import { type PathPolicy } from './paths.js';
5
5
  import { type RuntimeModels } from './models.js';
6
6
  import { type AdapterResult, type AdapterRunOptions, type RuntimeAdapter } from './types.js';
@@ -96,12 +96,22 @@ export declare function sandboxNetwork(hubHost: string | undefined, netAllow?: s
96
96
  */
97
97
  export declare function claudePermOptions(perm: Perm, o: ClaudePermInput): Partial<Options>;
98
98
  /**
99
- * decisions §34: the run's host capabilities as Claude Code options: a stdio MCP server Claude Code starts itself, outside the
100
- * sandbox that wraps the run's commands, and its tools pre-approved (read runs allow only listed tools). Pure.
99
+ * decisions §34, §38: the run's declared tools as Claude Code options. Each server is a stdio MCP server Claude Code starts
100
+ * itself, outside the sandbox that wraps the run's commands, its declared tools pre-approved (read runs allow only listed
101
+ * tools); the skills are the run's copy as a local plugin, whose own MCP servers are not loaded (they are declared or nothing).
102
+ * Pure.
101
103
  */
102
- export declare function claudeCapsOptions(caps?: CapsServerSpec): {
104
+ export declare function claudeToolsOptions(tools?: RunTools): {
103
105
  mcpServers?: Options['mcpServers'];
104
106
  allowedTools: string[];
107
+ plugins?: Options['plugins'];
108
+ };
109
+ /**
110
+ * The claude.ai connectors that come with the login are not loaded in a run (decisions §38): what a run can reach is what its
111
+ * owner declared, not what someone connected to the account.
112
+ */
113
+ export declare const CLAUDE_RUN_ENV: {
114
+ ENABLE_CLAUDEAI_MCP_SERVERS: string;
105
115
  };
106
116
  /**
107
117
  * Claude Code's own temporary directory for one sandboxed run, handed to it as CLAUDE_CODE_TMPDIR: a sandboxed command's output is a
@@ -164,6 +174,7 @@ export declare class ClaudeAdapter implements RuntimeAdapter {
164
174
  readonly reads: "scoped";
165
175
  readonly budget: true;
166
176
  readonly ownerMemory: "native";
177
+ readonly skills: "native";
167
178
  readonly ownFiles: readonly [];
168
179
  readonly lightModel: {
169
180
  readonly model: "claude-haiku-5-5";
@@ -2,7 +2,6 @@ import { mkdtempSync, realpathSync, rmSync } from 'node:fs';
2
2
  import { RUNTIME_SPECS } from './spec.js';
3
3
  import { homedir, tmpdir } from 'node:os';
4
4
  import { join } from 'node:path';
5
- import { CAPS_SERVER } from '../caps.js';
6
5
  import { isSessionToolResult, READ_TOOLS, toolDenied, toolPaths } from './paths.js';
7
6
  import { macTempPatterns, readable, systemPaths } from './scope.js';
8
7
  import { spawnGroup } from './procgroup.js';
@@ -302,17 +301,24 @@ export function claudePermOptions(perm, o) {
302
301
  return { ...common, permissionMode: 'acceptEdits', canUseTool: workdirCanUseTool(pol) };
303
302
  }
304
303
  /**
305
- * decisions §34: the run's host capabilities as Claude Code options: a stdio MCP server Claude Code starts itself, outside the
306
- * sandbox that wraps the run's commands, and its tools pre-approved (read runs allow only listed tools). Pure.
304
+ * decisions §34, §38: the run's declared tools as Claude Code options. Each server is a stdio MCP server Claude Code starts
305
+ * itself, outside the sandbox that wraps the run's commands, its declared tools pre-approved (read runs allow only listed
306
+ * tools); the skills are the run's copy as a local plugin, whose own MCP servers are not loaded (they are declared or nothing).
307
+ * Pure.
307
308
  */
308
- export function claudeCapsOptions(caps) {
309
- if (!caps?.tools.length)
310
- return { allowedTools: [] };
309
+ export function claudeToolsOptions(tools) {
310
+ const servers = tools?.servers.filter((s) => s.tools.length) ?? [];
311
311
  return {
312
- mcpServers: { [CAPS_SERVER]: { type: 'stdio', command: caps.command, args: caps.args } },
313
- allowedTools: caps.tools.map((t) => `mcp__${CAPS_SERVER}__${t.name}`),
312
+ ...(servers.length ? { mcpServers: Object.fromEntries(servers.map((s) => [s.name, { type: 'stdio', command: s.command, args: s.args }])) } : {}),
313
+ allowedTools: servers.flatMap((s) => s.tools.map((t) => `mcp__${s.name}__${t.name}`)),
314
+ ...(tools?.pluginDir && tools.skills.length ? { plugins: [{ type: 'local', path: tools.pluginDir, skipMcpDiscovery: true }] } : {}),
314
315
  };
315
316
  }
317
+ /**
318
+ * The claude.ai connectors that come with the login are not loaded in a run (decisions §38): what a run can reach is what its
319
+ * owner declared, not what someone connected to the account.
320
+ */
321
+ export const CLAUDE_RUN_ENV = { ENABLE_CLAUDEAI_MCP_SERVERS: 'false' };
316
322
  /**
317
323
  * Claude Code's own temporary directory for one sandboxed run, handed to it as CLAUDE_CODE_TMPDIR: a sandboxed command's output is a
318
324
  * file there, and it is the command's TMPDIR. Left to itself, Claude Code on macOS ignores TMPDIR and uses /tmp/claude-<uid>, which
@@ -468,10 +474,10 @@ export class ClaudeAdapter {
468
474
  claudeTmpDir: claudeTmp,
469
475
  netAllow: opts.netAllow,
470
476
  });
471
- const caps = claudeCapsOptions(opts.caps);
477
+ const caps = claudeToolsOptions(opts.tools);
472
478
  const options = {
473
479
  cwd: opts.cwd,
474
- env: claudeTmp ? { ...opts.env, CLAUDE_CODE_TMPDIR: claudeTmp } : opts.env,
480
+ env: { ...opts.env, ...CLAUDE_RUN_ENV, ...(claudeTmp ? { CLAUDE_CODE_TMPDIR: claudeTmp } : {}) },
475
481
  abortController,
476
482
  ...(opts.resume ? { resume: opts.resume } : {}),
477
483
  ...((opts.model ?? this.o.model) ? { model: (opts.model ?? this.o.model) } : {}),
@@ -480,6 +486,7 @@ export class ClaudeAdapter {
480
486
  ...(withThinking ? thinkingFor((opts.model ?? this.o.model), opts.env) : {}),
481
487
  ...permOptions,
482
488
  ...(caps.mcpServers ? { mcpServers: caps.mcpServers } : {}),
489
+ ...(caps.plugins ? { plugins: caps.plugins } : {}),
483
490
  ...(permOptions.allowedTools && caps.allowedTools.length ? { allowedTools: [...permOptions.allowedTools, ...caps.allowedTools] } : {}),
484
491
  // after the policy's own hooks, never instead of them: the first tool call or the end of a turn tells what effort applied
485
492
  hooks: { ...permOptions.hooks, PreToolUse: [...(permOptions.hooks?.PreToolUse ?? []), effortHook], Stop: [...(permOptions.hooks?.Stop ?? []), effortHook] },
@@ -1,6 +1,6 @@
1
1
  import type { SandboxMode, ThreadOptions, Usage } from '@openai/codex-sdk';
2
2
  import type { Perm } from '../perm.js';
3
- import { type CapsServerSpec } from '../caps.js';
3
+ import type { RunTools } from '../caps.js';
4
4
  import { type RuntimeModels } from './models.js';
5
5
  import { type AdapterResult, type AdapterRunOptions, type RuntimeAdapter } from './types.js';
6
6
  /** USD per 1M tokens. Configurable via ACH_CODEX_PRICE='{"input":..,"cached_input":..,"output":..}'. */
@@ -61,10 +61,10 @@ export declare const WINDOWS_HOME_DENY: string[];
61
61
  */
62
62
  export declare function codexSandboxOverrides(o: CodexSandboxInput): string[];
63
63
  /**
64
- * decisions §34: the run's host capabilities as Codex `--config` overrides: a stdio MCP server Codex starts itself, outside the
65
- * sandbox of the run's commands (approval_policy is never, so its tools run without asking). Pure.
64
+ * decisions §34, §38: the run's declared servers as Codex `--config` overrides: stdio MCP servers Codex starts itself, outside
65
+ * the sandbox of the run's commands, only their declared tools enabled and approved. Pure.
66
66
  */
67
- export declare function codexCapsOverrides(caps?: CapsServerSpec): string[];
67
+ export declare function codexToolsOverrides(tools?: RunTools): string[];
68
68
  /**
69
69
  * Codex client options.
70
70
  * - allow_login_shell=false: by default Codex runs tool commands in a login
@@ -133,6 +133,7 @@ export declare class CodexAdapter implements RuntimeAdapter {
133
133
  readonly reads: "scoped";
134
134
  readonly budget: false;
135
135
  readonly ownerMemory: "prompt";
136
+ readonly skills: "native";
136
137
  readonly ownFiles: readonly ["AGENTS.md"];
137
138
  readonly lightModel: {
138
139
  readonly model: "gpt-6.1-sol";
@@ -5,7 +5,7 @@ import { join } from 'node:path';
5
5
  import { readable, systemPaths } from './scope.js';
6
6
  import { KILL_GRACE_MS } from './procgroup.js';
7
7
  import { ensureCodexDaemonDir } from '../codexdaemon.js';
8
- import { CAPS_SERVER } from '../caps.js';
8
+ import { linkCodexSkills } from '../capskills.js';
9
9
  import { ask, CODEX_MODEL_LIST_INPUT, codexModelListReply } from './models.js';
10
10
  import { sdkCodexBinary } from '../sandboxcheck.js';
11
11
  import { modelId } from './types.js';
@@ -135,14 +135,25 @@ export function codexSandboxOverrides(o) {
135
135
  ];
136
136
  }
137
137
  /**
138
- * decisions §34: the run's host capabilities as Codex `--config` overrides: a stdio MCP server Codex starts itself, outside the
139
- * sandbox of the run's commands (approval_policy is never, so its tools run without asking). Pure.
138
+ * decisions §34, §38: the run's declared servers as Codex `--config` overrides: stdio MCP servers Codex starts itself, outside
139
+ * the sandbox of the run's commands, only their declared tools enabled and approved. Pure.
140
140
  */
141
- export function codexCapsOverrides(caps) {
142
- if (!caps?.tools.length)
143
- return [];
144
- const p = `mcp_servers.${CAPS_SERVER}`;
145
- return [`${p}.command=${JSON.stringify(caps.command)}`, `${p}.args=${JSON.stringify(caps.args)}`, `${p}.startup_timeout_sec=30`, `${p}.tool_timeout_sec=3700`];
141
+ export function codexToolsOverrides(tools) {
142
+ return (tools?.servers ?? [])
143
+ .filter((s) => s.tools.length)
144
+ .flatMap((s) => {
145
+ const p = `mcp_servers.${s.name}`;
146
+ return [
147
+ `${p}.command=${JSON.stringify(s.command)}`,
148
+ `${p}.args=${JSON.stringify(s.args)}`,
149
+ `${p}.startup_timeout_sec=30`,
150
+ `${p}.tool_timeout_sec=${(s.timeout ?? 3600) + 100}`,
151
+ // codex 0.165 asks before every tool of a configured server, and a worker run approves nothing (approval_policy never):
152
+ // these were declared, so they are approved; anything else is still refused (live test 2026-11-21)
153
+ `${p}.default_tools_approval_mode="approve"`,
154
+ `${p}.enabled_tools=${JSON.stringify(s.tools.map((t) => t.name))}`,
155
+ ];
156
+ });
146
157
  }
147
158
  /**
148
159
  * Codex client options.
@@ -328,13 +339,17 @@ export class CodexAdapter {
328
339
  async run(opts) {
329
340
  const { Codex } = await import('@openai/codex-sdk');
330
341
  const to = codexThreadOptions(opts.perm, opts.cwd, (opts.model ?? this.o.model), opts.mode, opts.effort);
342
+ // decisions §38: the owner's skills, linked from the run's own Codex home (an undeclared one does not stay)
343
+ if (opts.env.CODEX_HOME)
344
+ linkCodexSkills(opts.env.CODEX_HOME, opts.tools?.skills ?? []);
331
345
  const sandbox = to.sandboxMode
332
346
  ? []
333
347
  : codexSandboxOverrides({
334
348
  perm: opts.perm,
335
349
  mode: opts.mode,
336
350
  cwd: opts.cwd,
337
- readRoots: opts.readRoots,
351
+ // decisions §38: the owner's skills are linked from the run's Codex home, which is hidden; that folder alone is readable
352
+ readRoots: [...(opts.readRoots ?? []), ...(opts.tools?.skills.length && opts.env.CODEX_HOME ? [join(opts.env.CODEX_HOME, 'skills')] : [])],
338
353
  tmpDir: opts.tmpDir,
339
354
  hub: opts.hub,
340
355
  netAllow: opts.netAllow,
@@ -345,7 +360,7 @@ export class CodexAdapter {
345
360
  // Codex will not start its sandbox over a wrong socket folder: put it right (a problem left shows in Codex's own error)
346
361
  if (sandbox.length && process.platform !== 'win32')
347
362
  ensureCodexDaemonDir();
348
- const codex = new Codex(codexClientOptions(opts.env, [...sandbox, ...codexCapsOverrides(opts.caps)]));
363
+ const codex = new Codex(codexClientOptions(opts.env, [...sandbox, ...codexToolsOverrides(opts.tools)]));
349
364
  const thread = opts.resume ? codex.resumeThread(opts.resume, to) : codex.startThread(to);
350
365
  const price = this.o.price ?? priceFromEnv(opts.env);
351
366
  let sessionId = opts.resume;
@@ -58,7 +58,7 @@ export interface FakeRunInfo {
58
58
  readRoots?: string[];
59
59
  outputSchema?: unknown;
60
60
  netAllow?: string[];
61
- caps?: import('../caps.js').CapsServerSpec;
61
+ tools?: import('../caps.js').RunTools;
62
62
  }
63
63
  export interface FakeAdapterOptions {
64
64
  /** Steps for each run; receives the run info so a script can branch on prompt / resume. */
@@ -48,6 +48,7 @@ export class FakeAdapter {
48
48
  reads: 'scoped',
49
49
  budget: false,
50
50
  ownerMemory: 'prompt',
51
+ skills: 'prompt',
51
52
  ownFiles: [],
52
53
  login: { key: 'FAKE_KEY' },
53
54
  check: 'tool',
@@ -75,7 +76,7 @@ export class FakeAdapter {
75
76
  readRoots: opts.readRoots,
76
77
  outputSchema: opts.outputSchema,
77
78
  netAllow: opts.netAllow,
78
- caps: opts.caps,
79
+ tools: opts.tools,
79
80
  };
80
81
  this.runs.push(info);
81
82
  const sessionId = opts.resume ?? `fake-session-${info.index}-${Math.random().toString(36).slice(2, 8)}`;
@@ -98,6 +98,7 @@ export declare class KiroAdapter implements RuntimeAdapter {
98
98
  readonly reads: "scoped";
99
99
  readonly budget: false;
100
100
  readonly ownerMemory: "prompt";
101
+ readonly skills: "prompt";
101
102
  readonly ownFiles: readonly [];
102
103
  readonly login: {
103
104
  readonly key: "KIRO_API_KEY";
@@ -38,6 +38,8 @@ export interface RuntimeSpec {
38
38
  budget: boolean;
39
39
  /** native: the tool shows the owner's memory index itself. prompt: the runner puts it in the prompt. */
40
40
  ownerMemory: 'native' | 'prompt';
41
+ /** native: the tool loads the owner's skills itself (decisions §38). prompt: the runner lists them, with their paths, in the prompt. */
42
+ skills: 'native' | 'prompt';
41
43
  /** Project instruction files the tool loads by itself; the runner puts the others in the prompt. */
42
44
  ownFiles: readonly string[];
43
45
  /** The cheap model for housekeeping runs (the agent's description); none: the runtime's default. */
@@ -70,6 +72,7 @@ export declare const RUNTIME_SPECS: {
70
72
  readonly reads: "scoped";
71
73
  readonly budget: true;
72
74
  readonly ownerMemory: "native";
75
+ readonly skills: "native";
73
76
  readonly ownFiles: readonly [];
74
77
  readonly lightModel: {
75
78
  readonly model: "claude-haiku-5-5";
@@ -95,6 +98,7 @@ export declare const RUNTIME_SPECS: {
95
98
  readonly reads: "scoped";
96
99
  readonly budget: false;
97
100
  readonly ownerMemory: "prompt";
101
+ readonly skills: "native";
98
102
  readonly ownFiles: readonly ["AGENTS.md"];
99
103
  readonly lightModel: {
100
104
  readonly model: "gpt-6.1-sol";
@@ -120,6 +124,7 @@ export declare const RUNTIME_SPECS: {
120
124
  readonly reads: "scoped";
121
125
  readonly budget: false;
122
126
  readonly ownerMemory: "prompt";
127
+ readonly skills: "prompt";
123
128
  readonly ownFiles: readonly [];
124
129
  readonly login: {
125
130
  readonly key: "KIRO_API_KEY";
@@ -141,6 +146,7 @@ export declare const RUNTIME_SPECS: {
141
146
  readonly reads: "machine";
142
147
  readonly budget: false;
143
148
  readonly ownerMemory: "prompt";
149
+ readonly skills: "prompt";
144
150
  readonly ownFiles: readonly [];
145
151
  readonly login: {
146
152
  readonly command: "agy";
@@ -13,6 +13,7 @@ export const RUNTIME_SPECS = {
13
13
  reads: 'scoped',
14
14
  budget: true,
15
15
  ownerMemory: 'native',
16
+ skills: 'native',
16
17
  ownFiles: [],
17
18
  lightModel: { model: 'claude-haiku-5-5', effort: 'low' },
18
19
  login: { command: 'claude auth login' },
@@ -30,6 +31,7 @@ export const RUNTIME_SPECS = {
30
31
  reads: 'scoped',
31
32
  budget: false,
32
33
  ownerMemory: 'prompt',
34
+ skills: 'native',
33
35
  ownFiles: ['AGENTS.md'],
34
36
  lightModel: { model: 'gpt-6.1-sol', effort: 'medium' },
35
37
  login: { command: 'codex login' },
@@ -48,6 +50,7 @@ export const RUNTIME_SPECS = {
48
50
  reads: 'scoped',
49
51
  budget: false,
50
52
  ownerMemory: 'prompt',
53
+ skills: 'prompt',
51
54
  ownFiles: [],
52
55
  login: { key: 'KIRO_API_KEY' },
53
56
  check: 'tool',
@@ -66,6 +69,7 @@ export const RUNTIME_SPECS = {
66
69
  reads: 'machine',
67
70
  budget: false,
68
71
  ownerMemory: 'prompt',
72
+ skills: 'prompt',
69
73
  ownFiles: [],
70
74
  login: { command: 'agy' },
71
75
  check: 'tool',
@@ -1,5 +1,5 @@
1
1
  import type { Perm } from '../perm.js';
2
- import type { CapsServerSpec } from '../caps.js';
2
+ import type { RunTools } from '../caps.js';
3
3
  import type { RuntimeSpec } from './spec.js';
4
4
  /**
5
5
  * `tool_start` / `tool_end` (data: {id}) bracket one tool call; the runner's
@@ -50,8 +50,8 @@ export interface AdapterRunOptions {
50
50
  maxBudgetUsd?: number;
51
51
  /** JSON schema the final message must follow (codex answer runs). */
52
52
  outputSchema?: unknown;
53
- /** decisions §34: the host capabilities server of this run (an MCP server outside the sandbox); absent = none declared. */
54
- caps?: CapsServerSpec;
53
+ /** decisions §34, §38: the MCP servers (started outside the sandbox) and skills the owner declared for runs; absent = none. */
54
+ tools?: RunTools;
55
55
  }
56
56
  export interface AdapterResult {
57
57
  finalText: string;
package/dist/src/args.js CHANGED
@@ -217,9 +217,11 @@ Finishing: ach complete [--task <id>] [--run-id <r>] [--result-file <f> | "<tex
217
217
  ach fail [--task <id>] [--run-id <r>] [--cause <c> --needs <what>] "<reason>" | ach cancel <id> [--reason <r>]
218
218
  With your agent key and no --run-id: an unclaimed task sent to your agent is claimed interactively
219
219
  first (complete), or declined (fail); a task you claimed with \`ach claim\` uses that claim.
220
- Capabilities: ach caps (lists the host capabilities in <agent home>/capabilities.json: commands your runner's agents may run
221
- outside their sandbox, with no approval, for anyone who sends them a task or mentions them)
222
- ach caps run <name> [arg=value ...] (runs one here, as a run would: to check a declaration)
220
+ Capabilities: ach caps (lists what <agent home>/capabilities.json gives your runner's agents: commands and MCP servers they may
221
+ use outside their sandbox, with no approval, and skills, for anyone who sends them a task or mentions them)
222
+ ach caps run <name> [arg=value ...] (runs one command here, as a run would: to check a declaration)
223
+ ach caps tools <mcp> (connects to a declared MCP server and lists its tools, to pick its "tools")
224
+ ach caps login <mcp> | ach caps logout <mcp> (the OAuth login of a server declared with "oauth": true)
223
225
  Runner: ach run --dir <path> [--repo name=path ...] [--runtime ${RUNTIME_NAMES.join('|')}] [--interval 3] [--max 2]
224
226
  [--perm read|workdir|full] [--model m] [--pass-env NAME ...]
225
227
  [--claim-delay <sec> | --interactive-first] (default 0; --interactive-first = 60 s for you to claim first)
@@ -51,10 +51,58 @@ export interface Capability {
51
51
  */
52
52
  confirm?: boolean;
53
53
  }
54
+ /** decisions §38: an MCP server the owner declared; its runs reach it through `ach caps-serve --mcp <name>`. */
55
+ export interface McpDecl {
56
+ name: string;
57
+ description: string;
58
+ /** a remote server (streamable HTTP, SSE as fallback) */
59
+ url?: string;
60
+ /** a local server: argv of its command */
61
+ command?: string[];
62
+ /** literal HTTP headers for a remote server (an API key) */
63
+ headers?: Record<string, string>;
64
+ /** literal environment variables for a local server */
65
+ env?: Record<string, string>;
66
+ /** absolute working directory of a local server (default: the agent's home) */
67
+ cwd?: string;
68
+ /** a remote server that needs a login: `ach caps login <name>` */
69
+ oauth?: boolean | {
70
+ scope?: string;
71
+ client_id?: string;
72
+ client_secret?: string;
73
+ };
74
+ /** the only tools a run is offered */
75
+ tools: string[];
76
+ /** seconds one call may take (default 300, at most 3600) */
77
+ timeout?: number;
78
+ }
79
+ /** decisions §38: one skill the owner declared (a folder with a SKILL.md). */
80
+ export interface SkillDecl {
81
+ name: string;
82
+ description: string;
83
+ /** the skill's folder on this machine */
84
+ dir: string;
85
+ }
54
86
  export interface CapsLoad {
55
87
  caps: Capability[];
88
+ mcp: McpDecl[];
89
+ skills: SkillDecl[];
56
90
  problems: string[];
57
91
  }
92
+ /** Server names a declared MCP server cannot take: the runner's own servers and the account apps it turns off. */
93
+ export declare const RESERVED_SERVERS: string[];
94
+ /** One MCP declaration checked; a problem string, or undefined when it is usable. Pure. */
95
+ export declare function mcpProblem(m: any): string | undefined;
96
+ /** "name" and "description" of a SKILL.md's front matter. Pure. */
97
+ export declare function skillFrontMatter(text: string): {
98
+ name?: string;
99
+ description?: string;
100
+ };
101
+ /** The skills under one declared path: the folder itself when it has a SKILL.md, else its sub-folders that have one (a plugin's skills/ too). */
102
+ export declare function skillsAt(path: string): {
103
+ skills: SkillDecl[];
104
+ problems: string[];
105
+ };
58
106
  /** Values the server fills, never the agent: the run's task and who asked for it. */
59
107
  export declare const RUN_VARS: string[];
60
108
  /** Filled from the person's confirmation, for a `confirm: true` capability. */
@@ -62,7 +110,10 @@ export declare const CONFIRM_VARS: string[];
62
110
  export declare function capsPath(home: string): string;
63
111
  /** One declaration checked; a problem string, or undefined when it is usable. Pure. */
64
112
  export declare function capProblem(c: any): string | undefined;
65
- /** The declarations of a capabilities file (`{"capabilities": [...]}`), the broken ones left out with a reason. A missing file is no capabilities. */
113
+ /**
114
+ * The declarations of a capabilities file (`{"capabilities": [...], "mcp": [...], "skills": [...]}`, every part optional), the
115
+ * broken ones left out with a reason. A missing file is nothing declared.
116
+ */
66
117
  export declare function loadCaps(file: string): CapsLoad;
67
118
  export interface CapCall {
68
119
  argv: string[];
@@ -99,8 +150,14 @@ export interface CapResult {
99
150
  }
100
151
  /** Run one call of a capability (outside any sandbox: this is the host side). */
101
152
  export declare function runCap(cap: Capability, input: Record<string, unknown>, o: CapRunOptions): Promise<CapResult>;
102
- /** What the runner hands an adapter: how to start the capabilities server and which tools it offers. */
103
- export interface CapsServerSpec {
153
+ /**
154
+ * One MCP server the runner hands a run (decisions §34, §38): the runtime starts it itself, outside the sandbox that wraps the
155
+ * run's commands. `caps` serves the declared commands; every declared MCP server is a server of its own name.
156
+ */
157
+ export interface ToolServerSpec {
158
+ name: string;
159
+ /** what the server is for (a declared MCP server's description) */
160
+ description?: string;
104
161
  command: string;
105
162
  args: string[];
106
163
  tools: {
@@ -108,14 +165,21 @@ export interface CapsServerSpec {
108
165
  description: string;
109
166
  confirm?: boolean;
110
167
  }[];
168
+ /** seconds one call may take (the runtime's own limit is set above it) */
169
+ timeout?: number;
111
170
  }
112
- /** Trusted prompt text about the run's capabilities. Pure. */
113
- export declare function capsPromptText(tools: {
114
- name: string;
115
- description: string;
116
- confirm?: boolean;
117
- }[]): string;
118
- /** argv of `ach caps-serve` for one run. Pure. */
171
+ /** What a run gets of its owner's declarations: its servers, and its skills (each `dir` is the run's own copy). */
172
+ export interface RunTools {
173
+ servers: ToolServerSpec[];
174
+ skills: SkillDecl[];
175
+ /** the copied skills as a Claude Code plugin folder (capskills.ts); absent when there are none */
176
+ pluginDir?: string;
177
+ }
178
+ /** Trusted prompt text about the run's tools. `skillPaths`: the runtime does not load skills itself, so the prompt lists them. Pure. */
179
+ export declare function capsPromptText(t: RunTools, o?: {
180
+ skillPaths?: boolean;
181
+ }): string;
182
+ /** argv of `ach caps-serve` for one run (`mcp`: serve that declared MCP server instead of the commands). Pure. */
119
183
  export declare function capsServeArgs(o: {
120
184
  file: string;
121
185
  home: string;
@@ -123,8 +187,9 @@ export declare function capsServeArgs(o: {
123
187
  outDir?: string;
124
188
  log?: string;
125
189
  context?: Record<string, string>;
190
+ mcp?: string;
126
191
  }): string[];
127
- /** The stdio MCP server of `ach caps-serve`: one tool per declared capability. */
192
+ /** The stdio MCP server of `ach caps-serve`: one tool per declared capability (`--mcp <name>`: that declared MCP server, capsmcp.ts). */
128
193
  export declare function serveCaps(argv: string[]): Promise<void>;
129
194
  /**
130
195
  * The values the server fills for one call: the run's task, who asked for it, and for a `confirm: true` capability the person's