@parcha/agentrun-kernel 0.1.0-beta.57 → 0.1.0-beta.58
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/CHANGELOG.md +13 -0
- package/dist/host/parent-death.d.ts +7 -1
- package/dist/host/parent-death.js +11 -1
- package/dist/host/parent-watch.js +4 -2
- package/dist/runner.d.ts +4 -1
- package/dist/runner.js +6 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## 0.1.0-beta.58 (2026-11-25)
|
|
6
|
+
|
|
7
|
+
- `sessionSpendOf` also answers `chargedUsd`: what a session's answered requests were charged, a request a crash cut counted at its hold, and never one still in flight at its hold (null when one answered has no figure). `spentUsd` is unchanged and still counts the open ones at their holds. A host that checks a run's cap once it has settled reads `chargedUsd` in place of summing `figures` itself. <!-- changes/session-charged-usd.md -->
|
|
8
|
+
- More follow-ups to the Claude login on this machine (Settings → Model keys), and to the server's probe of the harness offers. <!-- changes/claude-sign-in-followups-2.md -->
|
|
9
|
+
- A tool key's save or delete while the offers held are behind the inputs, and the probe out was made from the inputs read now (a turn-on of the login, say), waits for that probe's turn and starts no probe of its own while it lands. The turn ends when the probe lands or fails, or when a later probe overtakes it; the change then reads the inputs again: landed, it composes the capabilities; failed, it probes for itself; overtaken, it goes by the later probe. So it never answers `500` for another request's failed probe once its key is stored, never waits on a dropped probe, and its key always shows in the capabilities it answers after. Before, it started a probe that dropped the one out, so the save answered only after a whole probe of its own. The server logs `harness_offers_wait` as it waits.
|
|
10
|
+
- A probe of the offers that fails leaves no probe out when it was the latest one, so a later change back to the inputs the offers held were made from reuses them. Before, that change probed again.
|
|
11
|
+
- The Playground's "No model yet" bar is gone while the login is on and reads signed in, no agent is picked (no agents yet, or the agents still being read), and the server's default place is the runner, where a first agent on Claude Agent runs on the login. The bar's ChatGPT and key offer goes with it, whatever harness the first agent will use. On a server whose default place is a box, or before its places are read, the bar stays: a first agent there runs in the box on the model keys. Before, a Playground with no agents offered ChatGPT or a key though an agent on Claude Agent would run on the login.
|
|
12
|
+
- A run of an agent on Claude Agent in a box, refused for its model while the login is on, on a model the login runs (Anthropic's own, `anthropic/<id>`, or none named), says that the login runs agents on the runner only, names the box, and says that moving the agent to the runner runs it on the login. Its `409 agent_not_runnable` carries a new `details.login_on_runner: true` (additive), and the Playground offers "Move it to the runner" there, which saves the agent's definition with its computer set to none and its box-only tools dropped, as the agent's Computer step does, and names the tools it dropped. Which tools run only in a box is the capabilities' word: a move taken before they are read, or after their read failed, reads them itself, and while that read fails it saves nothing and says so. The Computer step, with no tools read, refuses a pick that puts the agent on the runner, in words, and changes nothing. Before, either saved the agent on the runner with bash still granted, and its next run was refused there. The offer is the refused agent's: it shows only while that agent is picked and moves only that agent. After the move, a revision picked in the Playground becomes the one the move saved, so the next request runs on the runner. An agent already on the runner is not saved again. The login still runs agents on the runner only. An agent on any other model (an OpenRouter one, Anthropic's through OpenRouter included) is offered no move: on the runner it still needs its provider's key, which its refusal names. Serve puts a run on the login and makes the offer by one rule.
|
|
13
|
+
- A run's check of the login takes the Settings view's signed-in answer from a runner in a process of its own on the same data folder (`agentrun-serve --no-runner` beside `agentrun-serve runner`). The answer is kept in the data folder's `claude-login-answers/`: one file per login (0600, in a 0700 folder), named by a hash of the machine's id and the login, holding only the time; a signed-out answer removes it. A run's check reads it only as a regular file of at most 32 bytes, never through a link, and a FIFO there is no answer rather than a held check. A note tightens a wider folder to 0700 and never writes through a link at its name. On disk, an answer outlives a server restart for up to its 10 minutes. Before, it was in the server process's memory, so such a runner refused a first run whose two checks timed out right after Settings read signed in.
|
|
14
|
+
- A sign-in whose CLI is a script naming an interpreter that is not there (`#!/path`, or `#!/usr/bin/env <program>` with the program on no folder of the sign-in's PATH) fails at its start, in words that name the interpreter. Before, the parent watch's exit 127 read as the CLI's own exit. The `#!` line is read as the kernel reads it, as bytes, so an interpreter under a folder whose name is not ASCII (a home folder named `José`, say) is found.
|
|
15
|
+
- `parentWatched` throws a `RangeError` at the call for a `termGraceMs` the parent-watch shim would refuse (anything but a whole number of ms from 1 to 2^31 - 1), whichever watch is asked for. Before, the shim exited 2 at spawn, which read as the child's own exit.
|
|
16
|
+
- The status check reads an answer that is already in the CLI's output when the drain's second ends, though the server's event loop was held up past that second. Before, the loop ran the drain's timer before its reads, and the check read `no_status`.
|
|
17
|
+
|
|
5
18
|
## 0.1.0-beta.57 (2026-11-24)
|
|
6
19
|
|
|
7
20
|
- A live run shows what it waits on while it waits, not only once it answers (GRE-4835): a model request from the moment it is sent, on every harness, and each tool call until it returns. A slow local model reading a long prompt shows "inkling-2-mini thinking · 2:13" under the run's header, ticking; a slow `web_fetch` shows "web_fetch · 0:41". <!-- changes/in-flight-requests.md -->
|
|
@@ -18,5 +18,11 @@ export declare function parentWatchHere(): ParentWatch;
|
|
|
18
18
|
export interface ParentWatchOptions {
|
|
19
19
|
termGraceMs?: number;
|
|
20
20
|
}
|
|
21
|
-
/**
|
|
21
|
+
/** The longest grace the shim takes: a timer fires at once past it. */
|
|
22
|
+
export declare const MAX_TERM_GRACE_MS = 2147483647;
|
|
23
|
+
/** `arg` (`--term-grace`'s value) as the shim reads it: a positive whole number of milliseconds a timer can wait, in
|
|
24
|
+
* digits; undefined for anything else. parentWatched reads a caller's grace by the same rule. */
|
|
25
|
+
export declare function termGraceOf(arg: string): number | undefined;
|
|
26
|
+
/** `child`, started so that it dies with this process (`how`, default what this machine supports). A `termGraceMs` the
|
|
27
|
+
* shim would refuse (termGraceOf) throws a RangeError here, whichever watch `how` is. */
|
|
22
28
|
export declare function parentWatched(child: Readonly<LaunchCommand>, how?: ParentWatch, options?: Readonly<ParentWatchOptions>): LaunchCommand;
|
|
@@ -37,8 +37,18 @@ export function parentWatchHere() {
|
|
|
37
37
|
}
|
|
38
38
|
return (here = pdeathsig ? "pdeathsig" : "shim");
|
|
39
39
|
}
|
|
40
|
-
/**
|
|
40
|
+
/** The longest grace the shim takes: a timer fires at once past it. */
|
|
41
|
+
export const MAX_TERM_GRACE_MS = 2_147_483_647;
|
|
42
|
+
/** `arg` (`--term-grace`'s value) as the shim reads it: a positive whole number of milliseconds a timer can wait, in
|
|
43
|
+
* digits; undefined for anything else. parentWatched reads a caller's grace by the same rule. */
|
|
44
|
+
export function termGraceOf(arg) {
|
|
45
|
+
return /^[1-9]\d*$/.test(arg) && Number(arg) <= MAX_TERM_GRACE_MS ? Number(arg) : undefined;
|
|
46
|
+
}
|
|
47
|
+
/** `child`, started so that it dies with this process (`how`, default what this machine supports). A `termGraceMs` the
|
|
48
|
+
* shim would refuse (termGraceOf) throws a RangeError here, whichever watch `how` is. */
|
|
41
49
|
export function parentWatched(child, how = parentWatchHere(), options = {}) {
|
|
50
|
+
if (options.termGraceMs !== undefined && termGraceOf(String(options.termGraceMs)) === undefined)
|
|
51
|
+
throw new RangeError(`termGraceMs must be a whole number of ms from 1 to ${MAX_TERM_GRACE_MS}, not ${options.termGraceMs}`);
|
|
42
52
|
if (how === "pdeathsig")
|
|
43
53
|
return { command: SETPRIV, args: ["--pdeathsig", "KILL", "--", child.command, ...child.args] };
|
|
44
54
|
const grace = options.termGraceMs === undefined ? [] : ["--term-grace", String(options.termGraceMs)];
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
// host, is gone. With `--term-grace <ms>` it also kills the command (SIGKILL) when it outlasts a TERM passed on by
|
|
6
6
|
// that long.
|
|
7
7
|
import { spawn } from "node:child_process";
|
|
8
|
+
import { termGraceOf } from "./parent-death.js";
|
|
8
9
|
// `--term-grace`: a host that ends this child with TERM, and SIGKILL after a wait of its own sent to this process
|
|
9
10
|
// alone (startClaudeLogin's 5 s), asks for a grace shorter than that wait, since its SIGKILL would leave a child still
|
|
10
11
|
// running with no watch while the host lives. A host whose SIGKILL reaches the child too (a session machine's group
|
|
@@ -14,8 +15,9 @@ const [parentArg, ...rest] = process.argv.slice(2);
|
|
|
14
15
|
const parent = Number(parentArg);
|
|
15
16
|
const graceAsked = rest[0] === "--term-grace";
|
|
16
17
|
const graceArg = graceAsked ? rest[1] : undefined;
|
|
17
|
-
// A positive whole number of milliseconds a timer can wait (longer ones fire at once)
|
|
18
|
-
|
|
18
|
+
// A positive whole number of milliseconds a timer can wait (longer ones fire at once), by the rule parentWatched reads
|
|
19
|
+
// a caller's grace by.
|
|
20
|
+
const termGraceMs = graceArg === undefined ? undefined : termGraceOf(graceArg);
|
|
19
21
|
const [separator, command, ...args] = graceAsked ? rest.slice(2) : rest;
|
|
20
22
|
if (!Number.isSafeInteger(parent) || parent < 1 || (graceAsked && termGraceMs === undefined) || separator !== "--" || !command) {
|
|
21
23
|
process.stderr.write("usage: parent-watch.js <parent pid> [--term-grace <ms>] -- <command> [args...]\n");
|
package/dist/runner.d.ts
CHANGED
|
@@ -285,7 +285,9 @@ export declare function modelPortFor(writer: SessionWriter, options: ModelPortOp
|
|
|
285
285
|
* for each (`held`), the label of each the host sent beside the harness's own (`hosts`), which were answered, and the
|
|
286
286
|
* session's spend (null: unknown). A turn is a paid request that left: counted from the records written before each one
|
|
287
287
|
* left, so a request a crash cut off (or one still in flight, read from another process or session) counts at the
|
|
288
|
-
* figure its host held for it, and leaves the spend unknown when there is none.
|
|
288
|
+
* figure its host held for it, and leaves the spend unknown when there is none. `chargedUsd` is what the answered
|
|
289
|
+
* requests were charged alone (a crash's cut one at its hold among them), never one still in flight at its hold; null:
|
|
290
|
+
* one charged has no figure. */
|
|
289
291
|
export declare function sessionSpendOf(records: readonly SessionRecord[]): {
|
|
290
292
|
turns: number[];
|
|
291
293
|
held: Map<number, number>;
|
|
@@ -293,6 +295,7 @@ export declare function sessionSpendOf(records: readonly SessionRecord[]): {
|
|
|
293
295
|
answered: Set<number>;
|
|
294
296
|
openHolds: Set<number>;
|
|
295
297
|
spentUsd: number | null;
|
|
298
|
+
chargedUsd: number | null;
|
|
296
299
|
figures: {
|
|
297
300
|
turn: number;
|
|
298
301
|
usd: number | null;
|
package/dist/runner.js
CHANGED
|
@@ -61,7 +61,9 @@ export async function modelPortFor(writer, options) {
|
|
|
61
61
|
* for each (`held`), the label of each the host sent beside the harness's own (`hosts`), which were answered, and the
|
|
62
62
|
* session's spend (null: unknown). A turn is a paid request that left: counted from the records written before each one
|
|
63
63
|
* left, so a request a crash cut off (or one still in flight, read from another process or session) counts at the
|
|
64
|
-
* figure its host held for it, and leaves the spend unknown when there is none.
|
|
64
|
+
* figure its host held for it, and leaves the spend unknown when there is none. `chargedUsd` is what the answered
|
|
65
|
+
* requests were charged alone (a crash's cut one at its hold among them), never one still in flight at its hold; null:
|
|
66
|
+
* one charged has no figure. */
|
|
65
67
|
export function sessionSpendOf(records) {
|
|
66
68
|
const requests = records.filter((r) => r.kind === RUNNER_RECORDS.request).map((r) => (r.data ?? {}));
|
|
67
69
|
const turns = requests.map((data, i) => data.turn ?? i + 1);
|
|
@@ -128,6 +130,8 @@ export function sessionSpendOf(records) {
|
|
|
128
130
|
else
|
|
129
131
|
known += own.usd;
|
|
130
132
|
}
|
|
133
|
+
// Every figure so far is an answered request's: what they were charged, before the open ones count at their holds.
|
|
134
|
+
const chargedUsd = spentUsd;
|
|
131
135
|
const openHolds = new Set();
|
|
132
136
|
for (const turn of turns) {
|
|
133
137
|
if (answered.has(turn))
|
|
@@ -141,7 +145,7 @@ export function sessionSpendOf(records) {
|
|
|
141
145
|
if (!onPlan.has(turn))
|
|
142
146
|
unpriced++;
|
|
143
147
|
}
|
|
144
|
-
return { turns, held, hosts, answered, openHolds, spentUsd, figures, cost: costOfParts([{ known, bounded, atMost, unpriced }]) };
|
|
148
|
+
return { turns, held, hosts, answered, openHolds, spentUsd, chargedUsd, figures, cost: costOfParts([{ known, bounded, atMost, unpriced }]) };
|
|
145
149
|
}
|
|
146
150
|
/** The one rule for a cost made of parts, as every reader of a run's cost says it (the session's, the run's stored cost,
|
|
147
151
|
* its view and its usage row). Every charge counted: `usd` is their sum, holds included, and `atMost` how many of them are
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parcha/agentrun-kernel",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.58",
|
|
4
4
|
"description": "Agent harnesses other than Pi, starting with Codex, behind one seam: a DSL node's runNode and an AgentRun run on a harness adapter, durable in AgentRun's own store.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agentrun",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"test": "node --test --test-concurrency=8 'test/*.test.mjs'"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@parcha/agentrun-dsl": "0.1.0-beta.
|
|
65
|
+
"@parcha/agentrun-dsl": "0.1.0-beta.58",
|
|
66
66
|
"ajv": "8.18.0",
|
|
67
67
|
"typebox": "1.3.27"
|
|
68
68
|
},
|