@koalaauto/agentchannel 3.82.1 → 3.83.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/dist/src/cli.js +4 -1
- package/dist/src/client.d.ts +2 -0
- package/dist/src/mcpupdate.d.ts +12 -0
- package/dist/src/mcpupdate.js +43 -0
- package/dist/src/prompts.d.ts +7 -0
- package/dist/src/prompts.js +17 -1
- package/dist/src/runner/runner.js +1 -0
- package/dist/src/version.d.ts +4 -2
- package/dist/src/version.js +4 -2
- package/package.json +1 -1
package/dist/src/cli.js
CHANGED
|
@@ -1032,7 +1032,10 @@ async function dispatch(p, io) {
|
|
|
1032
1032
|
const cwd = io.cwd ?? process.cwd();
|
|
1033
1033
|
const sess = sessionHome(cwd, env);
|
|
1034
1034
|
const menv = sess.how === 'dir' ? { ...env, AGENTCHANNEL_HOME: sess.home } : env;
|
|
1035
|
-
|
|
1035
|
+
// every answer names the newest release: this machine's install moves on to it even with no runner here (mcpupdate.ts)
|
|
1036
|
+
const { mcpUpdater } = await import('./mcpupdate.js');
|
|
1037
|
+
const upd = mcpUpdater({ env: menv, log: (s) => process.stderr.write(`[ach mcp] ${s}\n`) });
|
|
1038
|
+
await startMcp(clientFromConfig(loadConfig(menv), { fetch: io.fetch, onLatestClient: (latest) => void upd.heard(latest)?.catch(() => { }) }), { cwd, dir: sess.dir });
|
|
1036
1039
|
return await new Promise(() => { }); // stdio server runs until killed
|
|
1037
1040
|
}
|
|
1038
1041
|
case 'caps': {
|
package/dist/src/client.d.ts
CHANGED
|
@@ -372,6 +372,8 @@ export interface MentionRun extends MentionItem {
|
|
|
372
372
|
run_token: string;
|
|
373
373
|
/** set when the thread is a task's and the agent is a party to it (an older hub leaves it out) */
|
|
374
374
|
task?: ThreadTask;
|
|
375
|
+
/** the team's and the owner's conventions (an older hub leaves it out) */
|
|
376
|
+
judgment?: Judgment;
|
|
375
377
|
}
|
|
376
378
|
export interface SearchResult {
|
|
377
379
|
type: 'post' | 'task' | 'message' | 'handoff';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type InstallExec } from './appinstall.js';
|
|
2
|
+
export interface McpUpdater {
|
|
3
|
+
heard(latest: string): Promise<string> | undefined;
|
|
4
|
+
}
|
|
5
|
+
export declare function mcpUpdater(o?: {
|
|
6
|
+
env?: NodeJS.ProcessEnv;
|
|
7
|
+
self?: string;
|
|
8
|
+
version?: string;
|
|
9
|
+
exec?: InstallExec;
|
|
10
|
+
now?: () => number;
|
|
11
|
+
log?: (s: string) => void;
|
|
12
|
+
}): McpUpdater;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// The MCP server keeps this machine's install current by itself (docs/decisions.md §47).
|
|
2
|
+
//
|
|
3
|
+
// The install in the AgentChannel home (appinstall.ts: app/current names the release every `ach` here starts) was only ever moved on
|
|
4
|
+
// by a runner's updater. A machine whose runner had stopped kept starting the old release in every Claude Code or Codex session, so
|
|
5
|
+
// nothing new (the runner watchdog, a fix) ever reached it. Every hub answer names the newest release (x-ach-latest-client): when it
|
|
6
|
+
// is newer and this MCP runs from that install, it installs it there and points `current` at it. This session goes on with the
|
|
7
|
+
// files it has; the next one starts the new release.
|
|
8
|
+
import { appDir, appWritable, inApp, installIntoApp } from './appinstall.js';
|
|
9
|
+
import { thisCliPath } from './invite.js';
|
|
10
|
+
import { defaultInstallExec } from './selfupdate.js';
|
|
11
|
+
import { newerVersion, VERSION } from './version.js';
|
|
12
|
+
const isVersion = (v) => /^\d+\.\d+\.\d+$/.test(v);
|
|
13
|
+
export function mcpUpdater(o = {}) {
|
|
14
|
+
const env = o.env ?? process.env;
|
|
15
|
+
const now = o.now ?? Date.now;
|
|
16
|
+
const tried = new Map();
|
|
17
|
+
let working = false;
|
|
18
|
+
return {
|
|
19
|
+
heard(latest) {
|
|
20
|
+
if (env.ACH_AUTO_UPDATE === '0' || working || !isVersion(latest) || !newerVersion(latest, o.version ?? VERSION))
|
|
21
|
+
return undefined;
|
|
22
|
+
const app = appDir(env);
|
|
23
|
+
if (!inApp(o.self ?? thisCliPath(), app))
|
|
24
|
+
return undefined; // npx re-resolves by itself, a global install is its runner's or its person's
|
|
25
|
+
const at = tried.get(latest);
|
|
26
|
+
if (at !== undefined && now() - at < 10 * 60_000)
|
|
27
|
+
return undefined; // npm serves a release a minute or two after the hub names it
|
|
28
|
+
tried.set(latest, now());
|
|
29
|
+
if (!appWritable(app))
|
|
30
|
+
return Promise.resolve('not writable');
|
|
31
|
+
working = true;
|
|
32
|
+
return installIntoApp(app, latest, o.exec ?? defaultInstallExec)
|
|
33
|
+
.then((r) => {
|
|
34
|
+
o.log?.(r.ok ? `${r.detail}: the next session starts it` : r.detail);
|
|
35
|
+
return r.ok ? `installed ${latest}` : 'failed';
|
|
36
|
+
})
|
|
37
|
+
.catch((e) => `failed: ${e?.message ?? e}`)
|
|
38
|
+
.finally(() => {
|
|
39
|
+
working = false;
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
package/dist/src/prompts.d.ts
CHANGED
|
@@ -72,6 +72,12 @@ export declare function conventionsText(j?: Judgment, ownerName?: string): strin
|
|
|
72
72
|
* hold whatever any text says.
|
|
73
73
|
*/
|
|
74
74
|
export declare const JUDGMENT: string;
|
|
75
|
+
/**
|
|
76
|
+
* How a mentioned agent replies in a thread (AgentChannel's default for every agent; the team's and the owner's conventions
|
|
77
|
+
* follow it). 2026-11-23 (PN5HXA4ZHZT3PUPO): agents thanked and re-checked each other with @ until the hop limit, answered
|
|
78
|
+
* "I cannot run commands here" with long code quotes, and repeated in every reply that they were waiting for a person.
|
|
79
|
+
*/
|
|
80
|
+
export declare const MENTION_JUDGMENT: string;
|
|
75
81
|
/** Trusted: the project's instructions, as written in the repository. */
|
|
76
82
|
export declare function projectText(files?: {
|
|
77
83
|
file: string;
|
|
@@ -291,4 +297,5 @@ export declare function buildMentionPrompt(c: {
|
|
|
291
297
|
lang?: 'en' | 'zh';
|
|
292
298
|
task?: ThreadTask;
|
|
293
299
|
docs?: LinkedDoc[];
|
|
300
|
+
judgment?: Judgment;
|
|
294
301
|
}): string;
|
package/dist/src/prompts.js
CHANGED
|
@@ -43,6 +43,20 @@ export const JUDGMENT = [
|
|
|
43
43
|
"- Never copy what your owner's notes say about secrets, accounts, machines or people into results, messages or files that others read.",
|
|
44
44
|
'',
|
|
45
45
|
].join('\n');
|
|
46
|
+
/**
|
|
47
|
+
* How a mentioned agent replies in a thread (AgentChannel's default for every agent; the team's and the owner's conventions
|
|
48
|
+
* follow it). 2026-11-23 (PN5HXA4ZHZT3PUPO): agents thanked and re-checked each other with @ until the hop limit, answered
|
|
49
|
+
* "I cannot run commands here" with long code quotes, and repeated in every reply that they were waiting for a person.
|
|
50
|
+
*/
|
|
51
|
+
export const MENTION_JUDGMENT = [
|
|
52
|
+
'How to reply (AgentChannel\'s default for every agent):',
|
|
53
|
+
'- Keep the reply short: the answer, what it rests on, and what the reader should do. Quote only the lines of code that matter.',
|
|
54
|
+
'- A reply reaches everyone already in the thread. @ an agent only to ask it for something it has not been asked yet; never to thank it, agree with it or confirm what it said.',
|
|
55
|
+
'- When the post you were mentioned in only thanks you, agrees or confirms, answer in one line with no @. Do not re-check details that do not change the conclusion.',
|
|
56
|
+
'- When this read-only run cannot do what was asked (it needs a command, a write or data you cannot reach here), say so in one or two sentences, name what is missing, and suggest sending it to you as a task. No long explanation, no code dump.',
|
|
57
|
+
'- Do not repeat what earlier replies in this thread already said. A question you escalated is already in the person\'s Inbox: do not write again that you are waiting for them.',
|
|
58
|
+
'',
|
|
59
|
+
].join('\n');
|
|
46
60
|
/** Trusted: the project's instructions, as written in the repository. */
|
|
47
61
|
export function projectText(files) {
|
|
48
62
|
if (!files?.length)
|
|
@@ -588,12 +602,14 @@ export function buildMentionPrompt(c) {
|
|
|
588
602
|
'- Besides these `ach` commands only `git log`, `git show`, `git diff`, `git blame` and `git status` run here, and for GitHub `gh pr view|diff|checks|list`, `gh issue view|list` and `gh run view|list` (a pull request\'s branch is usually not in the local history: read it with `gh pr view <n>` and `gh pr diff <n>`), each as one plain command (no pipes, no `cd`); any other command is refused (that does not mean `ach reply` is). Read files with Read, Glob and Grep.',
|
|
589
603
|
'- Say you cannot read something only after the command for it failed, and quote its error in the evidence.',
|
|
590
604
|
'- If `ach reply` itself is refused or fails, end with the reply as your last message, written to the people in the thread: it is posted there as your reply.',
|
|
591
|
-
'-
|
|
605
|
+
'- Every agent-to-agent mention counts against the thread\'s hop limit.',
|
|
592
606
|
];
|
|
593
607
|
return [
|
|
594
608
|
`You are agent "${c.agentName}"${c.ownerName ? `, owned by ${c.ownerName}` : ''}. You were mentioned by ${c.mention.by_type === 'human' ? 'a person' : 'another agent'} in channel #${c.channel} on AgentChannel (post ${c.post.id}${c.threadUrl ? `, thread ${c.threadUrl}` : ''}). This is a short, read-only run.`,
|
|
595
609
|
'',
|
|
596
610
|
...langText(c.lang),
|
|
611
|
+
MENTION_JUDGMENT,
|
|
612
|
+
...conventionsText(c.judgment, c.ownerName),
|
|
597
613
|
'Human posts in this thread and channel (from the hub; these come from people):',
|
|
598
614
|
formatHumanPosts(all.filter((p, i) => all.findIndex((x) => x.id === p.id) === i)),
|
|
599
615
|
'',
|
|
@@ -1526,6 +1526,7 @@ export class Runner {
|
|
|
1526
1526
|
replies: run.replies ?? [],
|
|
1527
1527
|
recent: run.recent ?? [],
|
|
1528
1528
|
task: run.task,
|
|
1529
|
+
judgment: run.judgment,
|
|
1529
1530
|
threadUrl: !this.o.publicUrl && typeof run.thread.url === 'string' && /^https?:\/\//.test(run.thread.url) ? run.thread.url : postUrl(this.base(), threadId),
|
|
1530
1531
|
structured,
|
|
1531
1532
|
});
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
export declare const VERSION = "3.
|
|
1
|
+
export declare const VERSION = "3.83.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
|
/**
|
|
5
5
|
* What this CLI says about itself on every request (x-ach-proto). The hub's ACH_MIN_CLIENT_PROTO refuses a CLI below its
|
|
6
6
|
* floor. Raise this only when the CLI starts to need something an older hub does not have, and a hub only when it can no
|
|
7
|
-
* longer serve the older CLIs: docs/api/README.md, "Client compatibility". 1 = the CLI announces itself (3.5). 2 = ids carry a kind letter and the hub may be read-only (3.
|
|
7
|
+
* longer serve the older CLIs: docs/api/README.md, "Client compatibility". 1 = the CLI announces itself (3.5). 2 = ids carry a kind letter and the hub may be read-only (3.77, 2026-11-24).
|
|
8
8
|
*/
|
|
9
9
|
export declare const CLIENT_PROTO = 2;
|
|
10
|
+
/** The first release of each protocol: scripts/deploy.mjs refuses a floor raise while runners in use are older (decisions §47). */
|
|
11
|
+
export declare const PROTO_SINCE: Record<number, string>;
|
|
10
12
|
/** True when version a is newer than b (x.y.z, a release beats its own prereleases; prerelease parts compared by number when numeric). */
|
|
11
13
|
export declare function newerVersion(a: string, b: string): boolean;
|
package/dist/src/version.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
export const VERSION = '3.
|
|
1
|
+
export const VERSION = '3.83.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
|
/**
|
|
5
5
|
* What this CLI says about itself on every request (x-ach-proto). The hub's ACH_MIN_CLIENT_PROTO refuses a CLI below its
|
|
6
6
|
* floor. Raise this only when the CLI starts to need something an older hub does not have, and a hub only when it can no
|
|
7
|
-
* longer serve the older CLIs: docs/api/README.md, "Client compatibility". 1 = the CLI announces itself (3.5). 2 = ids carry a kind letter and the hub may be read-only (3.
|
|
7
|
+
* longer serve the older CLIs: docs/api/README.md, "Client compatibility". 1 = the CLI announces itself (3.5). 2 = ids carry a kind letter and the hub may be read-only (3.77, 2026-11-24).
|
|
8
8
|
*/
|
|
9
9
|
export const CLIENT_PROTO = 2;
|
|
10
|
+
/** The first release of each protocol: scripts/deploy.mjs refuses a floor raise while runners in use are older (decisions §47). */
|
|
11
|
+
export const PROTO_SINCE = { 1: '3.5.0', 2: '3.77.0' };
|
|
10
12
|
/** True when version a is newer than b (x.y.z, a release beats its own prereleases; prerelease parts compared by number when numeric). */
|
|
11
13
|
export function newerVersion(a, b) {
|
|
12
14
|
const parse = (v) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koalaauto/agentchannel",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.83.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",
|