@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.
@@ -5,7 +5,8 @@ import { join } from 'node:path';
5
5
  import { fileURLToPath } from 'node:url';
6
6
  import { gitCommonDir } from '../adapters/index.js';
7
7
  import { memoryIndex, ownerMemoryDir, projectInstructions } from './context.js';
8
- import { capsPath, capsPromptText, capsServeArgs, loadCaps } from '../caps.js';
8
+ import { CAPS_SERVER, capsPath, capsPromptText, capsServeArgs, loadCaps } from '../caps.js';
9
+ import { copySkills } from '../capskills.js';
9
10
  import { autorunPath, loadAutorun, ruleName, smallRule } from '../autorun.js';
10
11
  import { toolchainReadRoots } from '../adapters/paths.js';
11
12
  import { developerDir } from '../adapters/scope.js';
@@ -557,13 +558,21 @@ export class Runner {
557
558
  runnerReported = false;
558
559
  /** the capabilities file problems last logged (logged again only when they change) */
559
560
  capsProblems = '';
560
- /** the capabilities last told to the hub (decisions §34): an edit of the file is reported again on the next poll */
561
+ /** the capabilities last told to the hub (decisions §34, §38): an edit of the file is reported again on the next poll */
561
562
  capsReported = '';
562
563
  async reportRunner() {
563
564
  if (!this.o.client.reportRunner)
564
565
  return;
565
566
  // the names and descriptions only, never the commands: teammates see them in the agent directory
566
- const capabilities = this.cloud ? [] : loadCaps(this.o.capsFile ?? capsPath(this.o.home)).caps.map((c) => ({ name: c.name, description: c.description.slice(0, 300) }));
567
+ // decisions §38: MCP servers with their tool names, skills by name; never a URL, a command or a credential
568
+ const decl = this.cloud ? undefined : loadCaps(this.o.capsFile ?? capsPath(this.o.home));
569
+ const capabilities = decl
570
+ ? [
571
+ ...decl.caps.map((c) => ({ kind: 'command', name: c.name, description: c.description.slice(0, 300) })),
572
+ ...decl.mcp.map((m) => ({ kind: 'mcp', name: m.name, description: m.description.slice(0, 300), tools: m.tools.slice(0, 50) })),
573
+ ...decl.skills.map((k) => ({ kind: 'skill', name: k.name, description: k.description.slice(0, 300) })),
574
+ ].slice(0, 50)
575
+ : [];
567
576
  const sig = JSON.stringify(capabilities);
568
577
  if (this.runnerReported && sig === this.capsReported)
569
578
  return;
@@ -1769,10 +1778,12 @@ export class Runner {
1769
1778
  entry.controller.abort();
1770
1779
  }
1771
1780
  }, Math.max(10, Math.min(60_000, Math.floor(this.o.idleMs / 4))));
1772
- // decisions §34: the host capabilities the owner declared on this machine, read for every run (an edit applies to the next run)
1773
- // a read-ahead only reads the task and the checkout: the owner's commands (some of which change things elsewhere) are for the work
1774
- const caps = mode === 'prepare' ? undefined : this.capsFor(taskId, rec.runId, realHome, env.TMPDIR);
1775
- this.taskLog(taskId, `${mode} run start perm=${perm} resume=${resume ?? '-'} cwd=${rec.workdir}${caps ? ` caps=${caps.tools.map((t) => t.name).join(',')}` : ''}`);
1781
+ // decisions §34, §38: the commands, MCP servers and skills the owner declared on this machine, read for every run (an edit
1782
+ // applies to the next run). A read-ahead only reads the task and the checkout: the owner's tools (some of which change things
1783
+ // elsewhere) are for the work
1784
+ const tools = mode === 'prepare' ? undefined : this.toolsFor(taskId, rec.runId, realHome, env.TMPDIR);
1785
+ const toolsSaid = tools ? [...tools.servers.map((s) => `${s.name}=${s.tools.map((t) => t.name).join(',')}`), ...(tools.skills.length ? [`skills=${tools.skills.map((k) => k.name).join(',')}`] : [])].join(' ') : '';
1786
+ this.taskLog(taskId, `${mode} run start perm=${perm} resume=${resume ?? '-'} cwd=${rec.workdir}${toolsSaid ? ` tools: ${toolsSaid}` : ''}`);
1776
1787
  let result;
1777
1788
  // the model the agent's owner or an admin picked for its runs (the hub's setting, read for every run); none: the runner's
1778
1789
  // --model, else the runtime's default
@@ -1783,8 +1794,8 @@ export class Runner {
1783
1794
  const go = (m, e) => this.o.adapter.run({
1784
1795
  ...(m ? { model: m } : {}),
1785
1796
  ...(e ? { effort: e } : {}),
1786
- prompt: caps ? `${prompt}\n\n${capsPromptText(caps.tools)}` : prompt,
1787
- ...(caps ? { caps } : {}),
1797
+ prompt: tools ? `${prompt}\n\n${capsPromptText(tools, { skillPaths: this.o.adapter.spec.skills === 'prompt' })}` : prompt,
1798
+ ...(tools ? { tools } : {}),
1788
1799
  cwd: rec.workdir,
1789
1800
  resume,
1790
1801
  perm,
@@ -1893,26 +1904,34 @@ export class Runner {
1893
1904
  await this.traces.add(target, rec.runId, mode, startedAt, result, recorder, !this.fatal);
1894
1905
  return result;
1895
1906
  }
1896
- /** decisions §34: the capabilities server of one run, or undefined when nothing is declared (or the run is in the cloud). */
1897
- capsFor(taskId, runId, realHome, tmpDir) {
1907
+ /**
1908
+ * decisions §34, §38: what one run gets of the owner's declarations: the commands server, a proxy per MCP server, and a copy of
1909
+ * the skills in the run's TMPDIR. Undefined when nothing is declared, or the run is in the cloud (nothing of this machine
1910
+ * reaches it).
1911
+ */
1912
+ toolsFor(taskId, runId, realHome, tmpDir) {
1898
1913
  if (this.cloud)
1899
1914
  return undefined;
1900
1915
  const file = this.o.capsFile ?? capsPath(this.o.home);
1901
- const { caps, problems } = loadCaps(file);
1902
- const said = problems.join('; ');
1916
+ const { caps, mcp, skills, problems } = loadCaps(file);
1917
+ const copied = skills.length && tmpDir ? copySkills(skills, tmpDir) : undefined;
1918
+ const said = [...problems, ...(copied?.problems ?? []), ...(skills.length && !tmpDir ? ['skills: this run has no TMPDIR to copy them to'] : [])].join('; ');
1903
1919
  if (said && said !== this.capsProblems)
1904
1920
  this.log(`capabilities: ${said}`);
1905
1921
  this.capsProblems = said;
1906
- if (!caps.length)
1907
- return undefined;
1908
- return {
1922
+ const cli = this.o.cliPath ?? fileURLToPath(new URL('../cli.js', import.meta.url));
1923
+ const serve = (extra) => ({
1909
1924
  command: process.execPath,
1910
- args: [
1911
- this.o.cliPath ?? fileURLToPath(new URL('../cli.js', import.meta.url)),
1912
- ...capsServeArgs({ file, home: this.o.home, realHome, outDir: tmpDir, log: join(this.o.home, 'logs', 'caps.log'), context: { task: taskId, run: runId } }),
1913
- ],
1914
- tools: caps.map((c) => ({ name: c.name, description: c.description, ...(c.confirm ? { confirm: true } : {}) })),
1915
- };
1925
+ args: [cli, ...capsServeArgs({ file, home: this.o.home, realHome, outDir: tmpDir, log: join(this.o.home, 'logs', 'caps.log'), context: { task: taskId, run: runId }, ...extra })],
1926
+ });
1927
+ const servers = [
1928
+ ...(caps.length ? [{ name: CAPS_SERVER, ...serve({}), tools: caps.map((c) => ({ name: c.name, description: c.description, ...(c.confirm ? { confirm: true } : {}) })), timeout: Math.max(...caps.map((c) => c.timeout ?? 120)) }] : []),
1929
+ ...mcp.map((m) => ({ name: m.name, description: m.description, ...serve({ mcp: m.name }), tools: m.tools.map((t) => ({ name: t, description: '' })), timeout: m.timeout ?? 300 })),
1930
+ ];
1931
+ const runSkills = copied?.skills ?? [];
1932
+ if (!servers.length && !runSkills.length)
1933
+ return undefined;
1934
+ return { servers, skills: runSkills, ...(runSkills.length ? { pluginDir: copied.pluginDir } : {}) };
1916
1935
  }
1917
1936
  // ---- the execution trace -------------------------------------------------------------------------------------------------
1918
1937
  /** Polls until stop() or a 401 (B7: resolves 'unauthorized' after aborting every job). */
@@ -1,4 +1,4 @@
1
- export declare const VERSION = "3.63.2";
1
+ export declare const VERSION = "3.64.0";
2
2
  /** The npm package (scripts/release.mjs keeps it and VERSION in step with package.json). */
3
3
  export declare const PKG_NAME = "@koalaauto/agentchannel";
4
4
  /**
@@ -1,4 +1,4 @@
1
- export const VERSION = '3.63.2';
1
+ export const VERSION = '3.64.0';
2
2
  /** The npm package (scripts/release.mjs keeps it and VERSION in step with package.json). */
3
3
  export const PKG_NAME = '@koalaauto/agentchannel';
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koalaauto/agentchannel",
3
- "version": "3.63.2",
3
+ "version": "3.64.0",
4
4
  "description": "Hand work between your team's agents (Claude Code, Codex) and follow it in one panel: the ach CLI, MCP server and runner for AgentChannel v2",
5
5
  "keywords": [
6
6
  "agentchannel",