@koalaauto/agentchannel 3.86.0 → 3.86.1
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/attention.d.ts
CHANGED
|
@@ -76,6 +76,12 @@ export interface ChangeFeedOptions {
|
|
|
76
76
|
wsCheckMs?: number;
|
|
77
77
|
/** Polling interval, when there is no socket. */
|
|
78
78
|
pollMs?: number;
|
|
79
|
+
/**
|
|
80
|
+
* After an event, wait a random moment up to this long before acting (events in that moment share the one act). For consumers
|
|
81
|
+
* many of which hear the same event: a person's sessions all hear what is addressed to that person, and asked the hub in the
|
|
82
|
+
* same instant. Absent: at once.
|
|
83
|
+
*/
|
|
84
|
+
spreadMs?: number;
|
|
79
85
|
/** In polling mode, try the socket again after this many polls (a hub that was down at start). */
|
|
80
86
|
wsRetryPolls?: number;
|
|
81
87
|
sleep?: (ms: number) => Promise<void>;
|
|
@@ -122,7 +128,8 @@ export declare function codexThreadId(env: NodeJS.ProcessEnv): string | undefine
|
|
|
122
128
|
export declare function codexQueue(text: string, env: NodeJS.ProcessEnv, exec?: Exec): Promise<boolean>;
|
|
123
129
|
/**
|
|
124
130
|
* Does this event mean a runner should look at its agent's inbox now? A task event that names the two agents it is between
|
|
125
|
-
* concerns only them; a post or a reply
|
|
131
|
+
* concerns only them; a post or a reply says which agents it is for (`agents`: the ones it mentions, its task's worker), and one
|
|
132
|
+
* from an older hub, which does not say, may mention anyone; what is addressed to a person (`notification`) or is about the
|
|
126
133
|
* channel list is not a runner's. An event that does not say (an older hub, a kind this release does not know) counts: asking
|
|
127
134
|
* once too often is harmless, missing work is not. `me` unknown yet: every event counts.
|
|
128
135
|
*/
|
package/dist/src/attention.js
CHANGED
|
@@ -299,6 +299,7 @@ export class ChangeFeed {
|
|
|
299
299
|
check = setInterval(() => void this.fire(), this.o.wsCheckMs ?? 5 * 60_000);
|
|
300
300
|
check.unref?.();
|
|
301
301
|
});
|
|
302
|
+
let spreading;
|
|
302
303
|
sock.addEventListener('message', (m) => {
|
|
303
304
|
if (done || this.stopped)
|
|
304
305
|
return;
|
|
@@ -313,7 +314,17 @@ export class ChangeFeed {
|
|
|
313
314
|
if (ev && typeof ev === 'object' && !this.o.relevant(ev))
|
|
314
315
|
return;
|
|
315
316
|
}
|
|
316
|
-
|
|
317
|
+
const spread = this.o.spreadMs ?? 0;
|
|
318
|
+
if (spread <= 0)
|
|
319
|
+
return void this.fire();
|
|
320
|
+
if (spreading)
|
|
321
|
+
return;
|
|
322
|
+
spreading = setTimeout(() => {
|
|
323
|
+
spreading = undefined;
|
|
324
|
+
if (!done && !this.stopped)
|
|
325
|
+
void this.fire();
|
|
326
|
+
}, Math.random() * spread);
|
|
327
|
+
spreading.unref?.();
|
|
317
328
|
});
|
|
318
329
|
sock.addEventListener('close', finish);
|
|
319
330
|
sock.addEventListener('error', () => {
|
|
@@ -394,14 +405,19 @@ export async function codexQueue(text, env, exec = defaultExec) {
|
|
|
394
405
|
}
|
|
395
406
|
/**
|
|
396
407
|
* Does this event mean a runner should look at its agent's inbox now? A task event that names the two agents it is between
|
|
397
|
-
* concerns only them; a post or a reply
|
|
408
|
+
* concerns only them; a post or a reply says which agents it is for (`agents`: the ones it mentions, its task's worker), and one
|
|
409
|
+
* from an older hub, which does not say, may mention anyone; what is addressed to a person (`notification`) or is about the
|
|
398
410
|
* channel list is not a runner's. An event that does not say (an older hub, a kind this release does not know) counts: asking
|
|
399
411
|
* once too often is harmless, missing work is not. `me` unknown yet: every event counts.
|
|
400
412
|
*/
|
|
401
413
|
export function wakesRunner(ev, me) {
|
|
402
414
|
if (ev.kind === 'notification' || ev.kind === 'channels')
|
|
403
415
|
return false;
|
|
404
|
-
if (
|
|
416
|
+
if (!me)
|
|
417
|
+
return true;
|
|
418
|
+
if ((ev.kind === 'post' || ev.kind === 'reply') && Array.isArray(ev.agents))
|
|
419
|
+
return ev.agents.includes(me);
|
|
420
|
+
if (ev.kind !== 'task')
|
|
405
421
|
return true;
|
|
406
422
|
if (typeof ev.to !== 'string' && typeof ev.from !== 'string')
|
|
407
423
|
return true;
|
package/dist/src/mcp.js
CHANGED
|
@@ -648,7 +648,9 @@ export function startSessionNotices(server, client, o = {}) {
|
|
|
648
648
|
log: o.log,
|
|
649
649
|
});
|
|
650
650
|
// (only what is addressed to this person: counting again for every event of the team made this the hub's most asked question)
|
|
651
|
-
|
|
651
|
+
// (and not in the same instant as the person's other sessions: 2026-11-24, six of them counted together two seconds after one
|
|
652
|
+
// reply, and D1 refused them all as overloaded)
|
|
653
|
+
const feed = new ChangeFeed({ socket: () => client.eventsSocket(), onChange: () => notifier.check(), relevant: wakesAttention, spreadMs: 3000, log: o.log, ...o.feed });
|
|
652
654
|
const done = feed.run();
|
|
653
655
|
// a session cannot be restarted from outside: when the hub names a newer ach, say so once (see selfupdate.ts)
|
|
654
656
|
const stale = startStaleNotice({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type AdapterResult, type RuntimeAdapter } from '../adapters/types.js';
|
|
2
2
|
import { type Agent, type Client, type MentionItem, type MentionOutcome, type Message } from '../client.js';
|
|
3
3
|
import { type Perm } from '../perm.js';
|
|
4
|
-
import { RunnerState } from './state.js';
|
|
4
|
+
import { RunnerState, type RunRecord } from './state.js';
|
|
5
5
|
import { type Workspace } from './workspace.js';
|
|
6
6
|
import { TraceRecorder } from '../trace.js';
|
|
7
7
|
import { type SandboxStatus } from '../sandboxcheck.js';
|
|
@@ -119,6 +119,8 @@ export type Job = {
|
|
|
119
119
|
taskId: string;
|
|
120
120
|
};
|
|
121
121
|
export declare function jobKey(j: Job): string;
|
|
122
|
+
/** Is no run going or queued? Parked runs do not count: they wait for an event, they do not need the hub asked every few seconds. */
|
|
123
|
+
export declare const nothingGoing: (active: number, queued: number, runs: Pick<RunRecord, "phase">[]) => boolean;
|
|
122
124
|
/** What the hub is told about a mention run that ended: whether it worked, why not, its last words, the commands that failed. */
|
|
123
125
|
/**
|
|
124
126
|
* The flags of an `ach reply` that failed (refused, or the hub said no): `--escalate`, `--to`, `--ask`, `--evidence`, read from the
|
|
@@ -51,6 +51,8 @@ export function jobKey(j) {
|
|
|
51
51
|
}
|
|
52
52
|
/** How many post ids a thread's session remembers having been shown (the newest; an older one shown again costs a few lines). */
|
|
53
53
|
const THREAD_SEEN_MAX = 400;
|
|
54
|
+
/** Is no run going or queued? Parked runs do not count: they wait for an event, they do not need the hub asked every few seconds. */
|
|
55
|
+
export const nothingGoing = (active, queued, runs) => active === 0 && queued === 0 && runs.every((r) => r.phase === 'parked');
|
|
54
56
|
/** The thread a mention job answers in ('' for any other job). */
|
|
55
57
|
const threadOf = (j) => (j.kind === 'mention' ? String(j.item.mention.thread || j.item.thread?.id || '') : '');
|
|
56
58
|
/** What the hub is told about a mention run that ended: whether it worked, why not, its last words, the commands that failed. */
|
|
@@ -2057,9 +2059,12 @@ export class Runner {
|
|
|
2057
2059
|
}
|
|
2058
2060
|
if (this.stopped)
|
|
2059
2061
|
break;
|
|
2060
|
-
// nothing
|
|
2061
|
-
// and the runner asks anyway every quietMs. With a run going
|
|
2062
|
-
|
|
2062
|
+
// nothing going and the stream is up: the hub says when there is something (asked at once, a second apart at most),
|
|
2063
|
+
// and the runner asks anyway every quietMs. With a run going or queued, or without the stream: as ever. A parked run
|
|
2064
|
+
// (waiting for an answer or a decision, often for days) is not a run going: its answer arrives as a task event that names
|
|
2065
|
+
// this agent, and its lease lasts far longer than quietMs. 2026-11-24: three runners with a parked run each asked every
|
|
2066
|
+
// 3 s around the clock, most of the hub's inbox reads.
|
|
2067
|
+
const idle = nothingGoing(this.active.size, this.queue.length, Object.values(this.state.runs.runs));
|
|
2063
2068
|
if (this.feed?.mode === 'ws' && idle && wait === this.o.intervalMs)
|
|
2064
2069
|
wait = this.nudged ? Math.min(1000, wait) : (this.o.quietMs ?? 20_000);
|
|
2065
2070
|
this.nudged = false;
|
package/dist/src/version.d.ts
CHANGED
package/dist/src/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koalaauto/agentchannel",
|
|
3
|
-
"version": "3.86.
|
|
3
|
+
"version": "3.86.1",
|
|
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",
|