@koalaauto/agentchannel 3.85.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.
@@ -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 in hand and the stream is up: the hub says when there is something (asked at once, a second apart at most),
2061
- // and the runner asks anyway every quietMs. With a run going, parked or queued, or without the stream: as ever.
2062
- const idle = this.active.size === 0 && this.queue.length === 0 && Object.keys(this.state.runs.runs).length === 0;
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;
@@ -1,4 +1,4 @@
1
- export declare const VERSION = "3.85.0";
1
+ export declare const VERSION = "3.86.1";
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.85.0';
1
+ export const VERSION = '3.86.1';
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.85.0",
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",