@parcha/agentrun-serve 0.1.0-beta.40 → 0.1.0-beta.42
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 +130 -0
- package/NOTICE +2 -0
- package/README.md +149 -21
- package/dist/agent-rows.d.ts +1 -1
- package/dist/agents-store.js +3 -1
- package/dist/api-only.d.ts +3 -1
- package/dist/api-only.js +4 -2
- package/dist/api-token.d.ts +30 -0
- package/dist/api-token.js +89 -0
- package/dist/calendar/address.d.ts +49 -0
- package/dist/calendar/address.js +153 -0
- package/dist/calendar/fetch.d.ts +24 -0
- package/dist/calendar/fetch.js +146 -0
- package/dist/calendar/ics-faux.d.ts +39 -0
- package/dist/calendar/ics-faux.js +236 -0
- package/dist/calendar/labels.d.ts +3 -0
- package/dist/calendar/labels.js +61 -0
- package/dist/calendar/names.d.ts +52 -0
- package/dist/calendar/names.js +54 -0
- package/dist/calendar/parse.d.ts +108 -0
- package/dist/calendar/parse.js +625 -0
- package/dist/calendar/routes.d.ts +17 -0
- package/dist/calendar/routes.js +81 -0
- package/dist/calendar/tools.d.ts +23 -0
- package/dist/calendar/tools.js +124 -0
- package/dist/cli.js +22 -6
- package/dist/composio-made.d.ts +54 -0
- package/dist/composio-made.js +83 -0
- package/dist/composio-preset.d.ts +16 -8
- package/dist/composio-preset.js +106 -43
- package/dist/composio-triggers.d.ts +7 -2
- package/dist/composio-triggers.js +13 -7
- package/dist/computer-attach.d.ts +29 -11
- package/dist/computer-attach.js +141 -47
- package/dist/computer-keys.d.ts +4 -0
- package/dist/computer-keys.js +5 -0
- package/dist/computer-record.d.ts +55 -0
- package/dist/computer-record.js +315 -0
- package/dist/computer-setting.d.ts +1 -0
- package/dist/computer-setting.js +15 -2
- package/dist/computers.d.ts +11 -1
- package/dist/computers.js +23 -26
- package/dist/console/assets/{index-B8Zn1Iqn.css → index-C3gNPz58.css} +1 -1
- package/dist/console/assets/index-DYJ_wj27.js +711 -0
- package/dist/console/index.html +2 -2
- package/dist/decisions.js +9 -2
- package/dist/eval-feed.d.ts +26 -0
- package/dist/eval-feed.js +72 -0
- package/dist/eval-mailbox.d.ts +4 -1
- package/dist/eval-mailbox.js +11 -3
- package/dist/exa-keyless.d.ts +1 -1
- package/dist/exa-keyless.js +1 -1
- package/dist/feed/feed-faux.d.ts +62 -0
- package/dist/feed/feed-faux.js +123 -0
- package/dist/feed/fetch.d.ts +41 -0
- package/dist/feed/fetch.js +128 -0
- package/dist/feed/parse.d.ts +42 -0
- package/dist/feed/parse.js +291 -0
- package/dist/feed/pointer.d.ts +2 -0
- package/dist/feed/pointer.js +17 -0
- package/dist/file-types.js +1 -0
- package/dist/host-command.d.ts +3 -0
- package/dist/host-command.js +18 -0
- package/dist/host.d.ts +3 -0
- package/dist/host.js +3 -0
- package/dist/learn/check.d.ts +17 -1
- package/dist/learn/check.js +240 -5
- package/dist/learn/compile.d.ts +48 -27
- package/dist/learn/compile.js +134 -101
- package/dist/learn/promote.d.ts +61 -5
- package/dist/learn/promote.js +12 -2
- package/dist/learned-nodes.d.ts +21 -4
- package/dist/learned-nodes.js +21 -8
- package/dist/learned-workflow.d.ts +3 -3
- package/dist/learned-workflow.js +14 -5
- package/dist/learning-setting.d.ts +23 -0
- package/dist/learning-setting.js +51 -0
- package/dist/learning-words.d.ts +3 -0
- package/dist/learning-words.js +3 -0
- package/dist/learning.d.ts +3 -2
- package/dist/learning.js +5 -3
- package/dist/mcp-oauth.d.ts +23 -1
- package/dist/mcp-oauth.js +46 -5
- package/dist/mcp-pin-first.d.ts +4 -2
- package/dist/mcp-pin-first.js +4 -3
- package/dist/mcp-private-hosts.d.ts +13 -0
- package/dist/mcp-private-hosts.js +16 -0
- package/dist/mcp-servers-store.d.ts +58 -5
- package/dist/mcp-servers-store.js +136 -17
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.js +2 -2
- package/dist/observation/http.d.ts +4 -1
- package/dist/observation/http.js +5 -4
- package/dist/openapi.d.ts +1 -0
- package/dist/openapi.js +151 -21
- package/dist/print.d.ts +6 -3
- package/dist/print.js +4 -2
- package/dist/run-files.d.ts +6 -2
- package/dist/run-files.js +29 -7
- package/dist/run-labels.d.ts +23 -0
- package/dist/run-labels.js +79 -0
- package/dist/run-learning-served.d.ts +1 -1
- package/dist/run-reads-over-store.d.ts +5 -1
- package/dist/run-reads-over-store.js +8 -4
- package/dist/run-recordings.d.ts +20 -0
- package/dist/run-recordings.js +133 -0
- package/dist/run-secrets.js +12 -4
- package/dist/runner/adapter-loop.d.ts +1 -1
- package/dist/runner/adapter-loop.js +94 -16
- package/dist/runner/adapter-run-spec.d.ts +19 -0
- package/dist/runner/adapter-run-spec.js +57 -36
- package/dist/runner/beside.d.ts +6 -3
- package/dist/runner/beside.js +9 -7
- package/dist/runner/cli-run-spec.js +41 -32
- package/dist/runner/conformance/harness.js +69 -14
- package/dist/runner/conformance/subject.d.ts +4 -1
- package/dist/runner/feedback-round.d.ts +9 -25
- package/dist/runner/feedback-round.js +22 -40
- package/dist/runner/learning-end.d.ts +17 -7
- package/dist/runner/learning-end.js +79 -53
- package/dist/runner/main.d.ts +12 -1
- package/dist/runner/main.js +31 -4
- package/dist/runner/mcp-claim.d.ts +3 -0
- package/dist/runner/mcp-claim.js +1 -1
- package/dist/runner/mcp-run.d.ts +6 -2
- package/dist/runner/mcp-run.js +5 -3
- package/dist/runner/model-route.d.ts +4 -2
- package/dist/runner/model-route.js +8 -8
- package/dist/runner/promotion.d.ts +44 -4
- package/dist/runner/promotion.js +323 -21
- package/dist/runner/reflect-hook.d.ts +5 -0
- package/dist/runner/reflect-hook.js +22 -14
- package/dist/runner/store-secrets.js +3 -1
- package/dist/runner/workflow-first.d.ts +6 -11
- package/dist/runner/workflow-first.js +16 -20
- package/dist/runs-over-store.d.ts +1 -1
- package/dist/runs-over-store.js +5 -2
- package/dist/sdk/runs.d.ts +7 -1
- package/dist/sdk/runs.js +21 -7
- package/dist/secret-cut.js +3 -1
- package/dist/secrets.js +5 -3
- package/dist/server.d.ts +31 -5
- package/dist/server.js +240 -61
- package/dist/store/agent-body.d.ts +5 -3
- package/dist/store/agent-body.js +14 -10
- package/dist/store/dialect.d.ts +3 -0
- package/dist/store/dialect.js +1 -0
- package/dist/store/index.d.ts +1 -1
- package/dist/store/postgres/dialect.js +1 -0
- package/dist/store/postgres/migrations/0015_run_labels.sql +5 -0
- package/dist/store/postgres/migrations/0016_minted_tokens.sql +21 -0
- package/dist/store/schema.d.ts +9 -0
- package/dist/store/schema.js +26 -2
- package/dist/store/sqlite/connection.js +11 -3
- package/dist/store/sqlite/run-patch.d.ts +2 -1
- package/dist/store/sqlite/run-patch.js +3 -2
- package/dist/store/sqlite/store.js +64 -10
- package/dist/store/store.d.ts +38 -1
- package/dist/store-reads/journal.js +2 -1
- package/dist/store-reads/learning.d.ts +1 -1
- package/dist/store-reads/learning.js +6 -1
- package/dist/store-reads/loop.d.ts +1 -0
- package/dist/store-reads/loop.js +14 -4
- package/dist/store-reads/runs.d.ts +4 -3
- package/dist/store-reads/runs.js +3 -2
- package/dist/store-view.d.ts +5 -0
- package/dist/store-view.js +8 -2
- package/dist/template-eval.d.ts +11 -0
- package/dist/template-eval.js +177 -52
- package/dist/templates.d.ts +13 -1
- package/dist/templates.js +89 -18
- package/dist/timeline/computer.js +2 -1
- package/dist/timeline/origin.d.ts +1 -1
- package/dist/timeline/origin.js +2 -2
- package/dist/tool-list.js +1 -0
- package/dist/tools.d.ts +7 -0
- package/dist/tools.js +11 -0
- package/dist/trigger-adapter.d.ts +9 -4
- package/dist/trigger-adapters.js +2 -1
- package/dist/trigger-feed.d.ts +12 -0
- package/dist/trigger-feed.js +420 -0
- package/dist/triggers.d.ts +2 -1
- package/dist/triggers.js +23 -5
- package/dist/validate.js +7 -2
- package/dist/webhooks.js +9 -5
- package/dist/workspace/computer-deps.d.ts +5 -1
- package/dist/workspace/computer-deps.js +2 -2
- package/dist/workspace/computer-for-claim.d.ts +7 -0
- package/dist/workspace/computer-for-claim.js +12 -2
- package/dist/workspace/index.d.ts +1 -0
- package/dist/workspace/index.js +2 -0
- package/dist/workspace/paths.d.ts +4 -0
- package/dist/workspace/paths.js +9 -0
- package/dist/workspace/resolve-computer.d.ts +35 -4
- package/dist/workspace/resolve-computer.js +47 -9
- package/launcher/agentrun-serve +34 -22
- package/package.json +11 -9
- package/templates/README.md +38 -4
- package/dist/console/assets/index-Jbxjcmdp.js +0 -705
|
@@ -132,6 +132,7 @@ function crashAt(point, holder) {
|
|
|
132
132
|
beforeIntent: async () => (point === "beforeIntent" ? crash() : undefined),
|
|
133
133
|
beforeResult: async () => (point === "beforeResult" ? crash() : undefined),
|
|
134
134
|
afterMessageSent: async () => (point === "afterMessageSent" ? crash() : undefined),
|
|
135
|
+
afterSteerPlaced: async () => (point === "afterSteerPlaced" ? crash() : undefined),
|
|
135
136
|
};
|
|
136
137
|
}
|
|
137
138
|
/** The Postgres store each registered subject's worlds open (registerHarnessConformance's `storeUrl`), by the subject
|
|
@@ -206,6 +207,8 @@ async function world(subject, t, timing = STEADY) {
|
|
|
206
207
|
await settled(() => server.runs.create({ id: RUN, agentId: "agent-1", revisionId: "rev-1" }), () => server.runs.get(RUN));
|
|
207
208
|
/** The command rows a runner has handed to a loop's command(): with the loop, whether or not taken yet. */
|
|
208
209
|
const handed = new Set();
|
|
210
|
+
/** The command rows a loop's command() has answered: a steer it took is with the session by then (a CLI's has it). */
|
|
211
|
+
const answered = new Set();
|
|
209
212
|
/** Each runner's claims in flight (store.runs.claimMany), by its name: what claimsSettled waits for. */
|
|
210
213
|
const claiming = new Map();
|
|
211
214
|
/** `store` as runner `name` is handed it: the same store, its claims in flight counted (claiming). */
|
|
@@ -274,7 +277,15 @@ async function world(subject, t, timing = STEADY) {
|
|
|
274
277
|
},
|
|
275
278
|
}),
|
|
276
279
|
});
|
|
277
|
-
return {
|
|
280
|
+
return {
|
|
281
|
+
...loop,
|
|
282
|
+
command: (command) => {
|
|
283
|
+
handed.add(command.id);
|
|
284
|
+
const outcome = loop.command(command);
|
|
285
|
+
void Promise.resolve(outcome).then(() => answered.add(command.id), () => undefined);
|
|
286
|
+
return outcome;
|
|
287
|
+
},
|
|
288
|
+
};
|
|
278
289
|
};
|
|
279
290
|
const runner = startRunner({ store: claimsCounted(store, name), createLoop: observedLoop, name, ...TIMING, ...timing, onEvent: (event) => events.push({ runner: name, at: Date.now(), ...event }) });
|
|
280
291
|
runners.push(runner);
|
|
@@ -371,7 +382,7 @@ async function world(subject, t, timing = STEADY) {
|
|
|
371
382
|
assert.ok(ask, "the run wrote its ask");
|
|
372
383
|
return String(ask.data.callId);
|
|
373
384
|
};
|
|
374
|
-
return { dir, storeUrl: url, storeEnv, clockFile, runOut, runOutUnknown, claimsSettled, server, start, run, read, ended, began, commandRow, askedCall, events, handedOver: (id) => handed.has(id), liveRows, servedRows };
|
|
385
|
+
return { dir, storeUrl: url, storeEnv, clockFile, runOut, runOutUnknown, claimsSettled, server, start, run, read, ended, began, commandRow, askedCall, events, handedOver: (id) => handed.has(id), answered: (id) => answered.has(id), liveRows, servedRows };
|
|
375
386
|
}
|
|
376
387
|
/**
|
|
377
388
|
* The claim's fence, as the stalled process's own events show it: once it went on (`continuedAt`, its lease run out and no
|
|
@@ -697,11 +708,13 @@ const CASES = [
|
|
|
697
708
|
const { calls, messages } = await w.read();
|
|
698
709
|
const slow = calls.find((call) => call.tool === "slow");
|
|
699
710
|
const steered = messages.find((message) => message.role === "steer");
|
|
700
|
-
const said = messages.filter((message) => message.role === "model");
|
|
701
711
|
assert.ok(slow?.endEntry !== undefined && slow.status === "done", `slow ran to its end: ${JSON.stringify(calls)}`);
|
|
712
|
+
// Everything the model said once the call started. What it said with the call, before the call's row (a CLI's
|
|
713
|
+
// "Calling slow."), is that step's, as deny-note reads it; the step after the call said only the steer.
|
|
714
|
+
const said = messages.filter((message) => message.role === "model" && message.entry > slow.startEntry);
|
|
702
715
|
assert.equal(steered?.text, "check the totals", `the steer is in the journal: ${JSON.stringify(messages)}`);
|
|
703
716
|
assert.ok(steered.entry > slow.endEntry, "after the tool's end: mid-turn, not lost");
|
|
704
|
-
assert.deepEqual(said.map((message) => message.text), ["check the totals"],
|
|
717
|
+
assert.deepEqual(said.map((message) => message.text), ["check the totals"], `the next step saw it: ${JSON.stringify(messages)}`);
|
|
705
718
|
assert.ok(said[0].entry > steered.entry);
|
|
706
719
|
assert.ok((await w.commandRow(steer.id)).takenAt !== null, "the steer row is taken");
|
|
707
720
|
},
|
|
@@ -725,8 +738,9 @@ const CASES = [
|
|
|
725
738
|
const rows = [];
|
|
726
739
|
for (const text of texts)
|
|
727
740
|
rows.push(await sendCommand(w.server, RUN, { kind: "steer", body: { text } }));
|
|
728
|
-
// The tool goes on once
|
|
729
|
-
|
|
741
|
+
// The tool goes on once the loop has answered every message: the turn in flight has them, never a timer. (Handed to
|
|
742
|
+
// the loop is not enough: a CLI's steer is with the CLI only once the loop's steer() returns.)
|
|
743
|
+
await until(() => rows.every((row) => w.answered(row.id)), "the messages placed by the loop mid-turn");
|
|
730
744
|
letSlowGo();
|
|
731
745
|
await w.ended("ended");
|
|
732
746
|
const { calls, messages } = await w.read();
|
|
@@ -788,6 +802,37 @@ const CASES = [
|
|
|
788
802
|
assert.ok(!rows.slice(0, at).some((one) => one.kind === "user_message" && one.text === text), `no row of the message before the notice: ${shown}`);
|
|
789
803
|
},
|
|
790
804
|
},
|
|
805
|
+
{
|
|
806
|
+
id: "steer-placed-crash",
|
|
807
|
+
title: "a steer placed by a runner lost before its row was taken reaches the model once, and the next runner takes its row",
|
|
808
|
+
async body(subject, t) {
|
|
809
|
+
const w = await world(subject, t);
|
|
810
|
+
const { tools, letSlowGo, slowStarted } = suiteTools();
|
|
811
|
+
const text = "check the totals";
|
|
812
|
+
// The call, then what the model says after it, then what it says on the resume that follows the crash: each the
|
|
813
|
+
// steer it was given, when it was given one.
|
|
814
|
+
const script = [{ call: "slow" }, { sayLastSteer: true }, { sayLastSteer: true }];
|
|
815
|
+
const holder = {};
|
|
816
|
+
await w.start("runner-a", { script, tools, hooks: crashAt("afterSteerPlaced", holder) }, holder);
|
|
817
|
+
await w.began(slowStarted, "the slow tool to start");
|
|
818
|
+
const row = await sendCommand(w.server, RUN, { kind: "steer", body: { text } });
|
|
819
|
+
// runner-a dies once its session holds the steer, while the tool it was sent during still runs, before the commit
|
|
820
|
+
// that records it and takes its row.
|
|
821
|
+
await until(() => (w.runOutUnknown(), holder.crashed), "the crash after the steer was placed", EVENT_WAIT_MS);
|
|
822
|
+
assert.equal((await w.commandRow(row.id)).takenAt, null, "the row is untaken when runner-a is lost");
|
|
823
|
+
await w.claimsSettled("runner-a");
|
|
824
|
+
w.runOut();
|
|
825
|
+
letSlowGo();
|
|
826
|
+
await w.start("runner-b", { script, tools, hooks: quiet });
|
|
827
|
+
await w.ended("ended", EVENT_WAIT_MS);
|
|
828
|
+
const { messages } = await w.read();
|
|
829
|
+
const sent = messages.filter((message) => message.role !== "model" && message.text === text);
|
|
830
|
+
assert.equal(sent.length, 1, `the steer is on the record once: ${JSON.stringify(messages)}`);
|
|
831
|
+
assert.ok(messages.some((message) => message.role === "model" && message.text.includes(text) && message.entry > sent[0].entry), `the model answered it: ${JSON.stringify(messages)}`);
|
|
832
|
+
const taken = await w.commandRow(row.id);
|
|
833
|
+
assert.ok(taken.takenAt !== null && taken.refused === null, `its row is taken by runner-b: ${JSON.stringify(taken)}`);
|
|
834
|
+
},
|
|
835
|
+
},
|
|
791
836
|
{
|
|
792
837
|
id: "stop-ends-turn",
|
|
793
838
|
title: "stop ends the turn; the run says why",
|
|
@@ -891,15 +936,20 @@ const CASES = [
|
|
|
891
936
|
await w.began(slowStarted, "the slow tool to start");
|
|
892
937
|
const origin = { kind: "trigger", trigger_id: "trigger-1", source: "webhook", owner: false };
|
|
893
938
|
const steer = await sendCommand(w.server, RUN, { kind: "steer", body: { text: "a new order came in", origin } });
|
|
894
|
-
// The tool goes on once the
|
|
895
|
-
await until(() => w.
|
|
939
|
+
// The tool goes on once the loop has answered the steer: the turn in flight has it, never a timer.
|
|
940
|
+
await until(() => w.answered(steer.id), "the steer placed by the loop");
|
|
896
941
|
letSlowGo();
|
|
897
942
|
await w.ended("ended");
|
|
898
|
-
const { messages } = await w.read();
|
|
943
|
+
const { calls, messages } = await w.read();
|
|
899
944
|
const steered = messages.find((message) => message.text === "a new order came in" && message.role !== "model");
|
|
900
945
|
assert.deepEqual(steered?.origin, origin, `the message keeps its origin: ${JSON.stringify(messages)}`);
|
|
901
|
-
|
|
902
|
-
|
|
946
|
+
// Everything the model said once the call started (what it said with the call, before its row, is that step's, as in
|
|
947
|
+
// steer-mid-turn): only its answer to the steer, after it.
|
|
948
|
+
const slow = calls.find((call) => call.tool === "slow");
|
|
949
|
+
assert.ok(slow, `slow is on the record: ${JSON.stringify(calls)}`);
|
|
950
|
+
const said = messages.filter((message) => message.role === "model" && message.entry > slow.startEntry);
|
|
951
|
+
assert.deepEqual(said.map((message) => message.text), ["a new order came in"], `the model read it as any message: ${JSON.stringify(messages)}`);
|
|
952
|
+
assert.ok(said[0].entry > steered.entry, `it answered after the steer: ${JSON.stringify(messages)}`);
|
|
903
953
|
},
|
|
904
954
|
},
|
|
905
955
|
{
|
|
@@ -1192,7 +1242,8 @@ async function modelSaid(w) {
|
|
|
1192
1242
|
const { messages } = await w.read();
|
|
1193
1243
|
return messages.filter((message) => message.role === "model").map((message) => message.text).join("\n");
|
|
1194
1244
|
}
|
|
1195
|
-
const STEERS_IN_TURN = "it places a message sent mid-turn in the turn in flight,
|
|
1245
|
+
const STEERS_IN_TURN = "it places a message sent mid-turn in the turn in flight, so it never sends one as a turn of its own (message-resent-after-crash; a runner lost after placing a steer is steer-placed-crash)";
|
|
1246
|
+
const STEER_TAKEN_WITH_PLACEMENT = "it takes a steer's row in the commit that places it (its submission's), so no runner is lost between the placement and the take (steer-placed-crash)";
|
|
1196
1247
|
const CLI_NEVER_RERUNS = "a CLI never reruns a call that started; only the model calls again (its adapter's facts: rerunsStarted false)";
|
|
1197
1248
|
/** The cases a harness's declared facts rule out, each with why: what it does by design, not what it cannot model yet. */
|
|
1198
1249
|
export function factsRuleOut(facts) {
|
|
@@ -1201,7 +1252,7 @@ export function factsRuleOut(facts) {
|
|
|
1201
1252
|
const noSteer = `${facts.id} takes no message mid-turn (its adapter's facts: steer false), so a message sent while it works is never placed in the turn in flight: it is the run's next turn (message-mid-turn-kept)`;
|
|
1202
1253
|
return {
|
|
1203
1254
|
// steer-origin steers the turn in flight too: its message is taken mid-turn, or never.
|
|
1204
|
-
...(facts.steer ? {} : { "steer-mid-turn": noSteer, "steer-origin": noSteer }),
|
|
1255
|
+
...(facts.steer ? {} : { "steer-mid-turn": noSteer, "steer-origin": noSteer, "steer-placed-crash": noSteer }),
|
|
1205
1256
|
...(facts.rerunsStarted === false ? { "replay-safe-rerun": CLI_NEVER_RERUNS, "fault-restarts-bounded": CLI_NEVER_RERUNS } : {}),
|
|
1206
1257
|
// A harness that resumes a cut answer itself never ends a turn on the cut; one whose cut ends its turn never goes on
|
|
1207
1258
|
// from it in the same turn.
|
|
@@ -1242,7 +1293,11 @@ export function registerHarnessConformance(given, { test, storeUrl }) {
|
|
|
1242
1293
|
const processCase = entry.id.endsWith("-process");
|
|
1243
1294
|
// A harness that steers (any whose facts do not say steer false, as message-mid-turn-kept reads them) places a message
|
|
1244
1295
|
// in the turn in flight, its row taken in the commit of its submission: it never sends one as a turn of its own.
|
|
1245
|
-
|
|
1296
|
+
// A harness that steers and is no CLI (whose started calls a restart may run again) takes a steer's row as it places it:
|
|
1297
|
+
// only a CLI's record, written once its model took the steer, leaves a runner to lose between the two.
|
|
1298
|
+
const byFacts = ruledOut[entry.id]
|
|
1299
|
+
?? (entry.id === "message-resent-after-crash" && subject.facts?.steer !== false ? STEERS_IN_TURN : undefined)
|
|
1300
|
+
?? (entry.id === "steer-placed-crash" && subject.facts?.rerunsStarted !== false ? STEER_TAKEN_WITH_PLACEMENT : undefined);
|
|
1246
1301
|
const notYet = subject.unsupported?.[entry.id] ?? (processCase && !subject.process ? "it names no module a runner process can load (subject.process)" : undefined) ?? (subject.metaTools === false && META_CASES.has(entry.id) ? "its loop gives its sessions no tools_search, tools_call or codemode (they are the adapter loop's: runner/meta-tools.ts)" : undefined);
|
|
1247
1302
|
const onPostgres = storeUrl ? POSTGRES_PENDING[entry.id] : undefined;
|
|
1248
1303
|
const skip = byFacts ? `${subject.name} does not do this by design: ${byFacts}` : notYet ? `${subject.name} cannot model this yet: ${notYet}` : onPostgres ? `on Postgres, ${onPostgres}` : undefined;
|
|
@@ -51,6 +51,9 @@ export interface KernelHooks {
|
|
|
51
51
|
/** A message taken mid-turn was sent as a turn of its own (the adapter loop's sendAfterTurn): the session holds it, and
|
|
52
52
|
* the commit that records it and takes its row has not run yet. */
|
|
53
53
|
afterMessageSent?(): Promise<void>;
|
|
54
|
+
/** A message steered into the turn in flight was placed (the session holds it under the row's request id), and the
|
|
55
|
+
* commit that takes its row has not run yet: a CLI's waits for its model to take it (the adapter loop's steerCli). */
|
|
56
|
+
afterSteerPlaced?(): Promise<void>;
|
|
54
57
|
}
|
|
55
58
|
export interface ConformanceSetup {
|
|
56
59
|
readonly script: readonly ScriptStep[];
|
|
@@ -59,7 +62,7 @@ export interface ConformanceSetup {
|
|
|
59
62
|
/** The run's agent, for the subject's spec to name (AdapterRunSpec.agentId): the end-of-run step is asked with it. */
|
|
60
63
|
readonly agentId?: string;
|
|
61
64
|
}
|
|
62
|
-
export type ConformanceCase = "crash-before-intent" | "crash-after-intent" | "crash-before-intent-process" | "crash-after-intent-process" | "stalled-past-lease-process" | "replay-safe-rerun" | "steer-mid-turn" | "message-mid-turn-kept" | "message-resent-after-crash" | "cancel-ends-for-good" | "cancel-parked" | "deny-note" | "steer-origin" | "stop-ends-turn" | "park-on-ask" | "approval-names-its-call" | "approval-double-click" | "approval-race" | "message-never-answers" | "end-of-run-answer" | "fault-effects-once" | "fault-restarts-bounded" | "length-ends-failed" | "length-mid-run" | "meta-search" | "meta-call-park" | "meta-call-deny" | "meta-codemode-park" | "meta-codemode-stop" | "meta-codemode-crash";
|
|
65
|
+
export type ConformanceCase = "crash-before-intent" | "crash-after-intent" | "crash-before-intent-process" | "crash-after-intent-process" | "stalled-past-lease-process" | "replay-safe-rerun" | "steer-mid-turn" | "message-mid-turn-kept" | "message-resent-after-crash" | "steer-placed-crash" | "cancel-ends-for-good" | "cancel-parked" | "deny-note" | "steer-origin" | "stop-ends-turn" | "park-on-ask" | "approval-names-its-call" | "approval-double-click" | "approval-race" | "message-never-answers" | "end-of-run-answer" | "fault-effects-once" | "fault-restarts-bounded" | "length-ends-failed" | "length-mid-run" | "meta-search" | "meta-call-park" | "meta-call-deny" | "meta-codemode-park" | "meta-codemode-stop" | "meta-codemode-crash";
|
|
63
66
|
export interface ConformanceSubject {
|
|
64
67
|
/** The harness's name, as the suite's tests are titled. */
|
|
65
68
|
readonly name: string;
|
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
import { type Grade } from "../learn/promote.js";
|
|
2
2
|
import type { RunPath } from "../learning-cost.js";
|
|
3
3
|
import { type Command, type Store } from "../store/store.js";
|
|
4
|
-
export declare const FEEDBACK_ROUNDS: readonly ["
|
|
4
|
+
export declare const FEEDBACK_ROUNDS: readonly ["look_back"];
|
|
5
5
|
export type FeedbackRound = (typeof FEEDBACK_ROUNDS)[number];
|
|
6
6
|
/** A feedback round, as its steer's body carries it (`feedback`) and its FEEDBACK entry keeps it: the round, whether the
|
|
7
|
-
* grade said right,
|
|
7
|
+
* grade said right, and the grade's words (`text`). */
|
|
8
8
|
export interface FeedbackData {
|
|
9
9
|
readonly round: FeedbackRound;
|
|
10
10
|
readonly correct: boolean;
|
|
11
|
-
readonly workflow?: string;
|
|
12
11
|
readonly text: string;
|
|
13
12
|
}
|
|
14
|
-
/** What a grade asks for: `
|
|
15
|
-
*
|
|
13
|
+
/** What a grade asks for: `look_back` for a graded run the agent finished when the grade has words, else none
|
|
14
|
+
* (undefined): a run its learned workflow answered alone opens none, right or wrong (its grade is kept). A replay run
|
|
15
|
+
* is never graded. */
|
|
16
16
|
export declare function feedbackRoundOf(grade: {
|
|
17
|
-
readonly correct: boolean;
|
|
18
17
|
readonly path: RunPath;
|
|
19
|
-
readonly workflow?: string;
|
|
20
18
|
}, label: string | undefined): FeedbackRound | undefined;
|
|
21
|
-
/** The grade's words as the round says them: its `label`, else the fields a right answer holds (`expected`), else
|
|
22
|
-
* "(no words)". Never the verdict: feedbackAsk and the compile ask each say it once. (A right grade opens a round only
|
|
23
|
-
* with a label (feedbackRoundOf), so none reaches here without one.) */
|
|
24
|
-
export declare function feedbackWords(label: string | undefined, expected: Readonly<Record<string, unknown>> | undefined): string;
|
|
25
19
|
/** The feedback round a steer's body asks for (`body.feedback`, the server's own: server.ts gradeRun writes it, and the
|
|
26
20
|
* message API never does), else undefined. */
|
|
27
21
|
export declare function feedbackOf(body: unknown): FeedbackData | undefined;
|
|
@@ -31,17 +25,8 @@ export declare function pendingFeedbackOf(entries: readonly {
|
|
|
31
25
|
readonly kind: string;
|
|
32
26
|
readonly data?: unknown;
|
|
33
27
|
}[]): FeedbackData | undefined;
|
|
34
|
-
/** What the end-of-run turn of a feedback round is told before its prompt:
|
|
35
|
-
|
|
36
|
-
* (`job`, `served`); then the grade and its words. The look-back keeps notes only: a revision's ask to give the workflow
|
|
37
|
-
* again changed is the compile turn's, after it (learning-end.ts compileAskOf reads the round, learn/compile.ts asks). */
|
|
38
|
-
export declare function feedbackAsk(feedback: FeedbackData, seen?: {
|
|
39
|
-
readonly job: string;
|
|
40
|
-
readonly served: {
|
|
41
|
-
readonly workflow: string;
|
|
42
|
-
readonly answer: string;
|
|
43
|
-
};
|
|
44
|
-
}): string;
|
|
28
|
+
/** What the end-of-run turn of a feedback round is told before its prompt: the grade and its words. */
|
|
29
|
+
export declare function feedbackAsk(feedback: FeedbackData): string;
|
|
45
30
|
/** How a feedback round stands (GET /runs/{id}/learning `graded.feedback_status`): `running` until it settles; `ended`,
|
|
46
31
|
* its run took the grade's words and ended after them; `not_run`, its run ended before it took them. */
|
|
47
32
|
export declare const FEEDBACK_STATUSES: readonly ["running", "ended", "not_run"];
|
|
@@ -65,9 +50,8 @@ export interface OpenedRound {
|
|
|
65
50
|
readonly command: number;
|
|
66
51
|
}
|
|
67
52
|
/** Opens run `grade.run` again on the feedback round its grade asks for (feedbackRoundOf), with the grade's words
|
|
68
|
-
* (`label
|
|
69
|
-
* never one that only uses what was learned,
|
|
70
|
-
* feedback, neither archived nor of an archived
|
|
53
|
+
* (`label`), and says which, with its steer: only a run that learns (its launch's learning start,
|
|
54
|
+
* never one that only uses what was learned), whose runner supports managed feedback, neither archived nor of an archived
|
|
71
55
|
* agent (closed history: a grade of it starts no paid work), and one the store opens again (an agentic run that answered
|
|
72
56
|
* or that a person stopped). Null when the grade asks for nothing more, or the run can't be opened again (the grade is
|
|
73
57
|
* kept either way). */
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
// A grade's feedback round: what a run's grade (PUT /runs/{id}/grade, a person's feedback or an eval's label) asks of its
|
|
2
2
|
// learning, and how the run's next end reads it. The run's path is who wrote its final answer, so a grade never makes
|
|
3
3
|
// the agent answer the job again:
|
|
4
|
-
// - a run its learned workflow answered alone (path `workflow`), graded right: the grade is kept (
|
|
5
|
-
// read it) and nothing else happens: no turn, $0;
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
// whose look-back hears the job, the workflow's answer and the grade's words (notes), and whose compile turn asks for
|
|
9
|
-
// the workflow again, changed (learning-end.ts compileAskOf). Its spend is learning spend, and the run's path stays
|
|
10
|
-
// `workflow`;
|
|
4
|
+
// - a run its learned workflow answered alone (path `workflow`), graded right or wrong: the grade is kept (the graded
|
|
5
|
+
// hold, replay and refit read it) and nothing else happens: no round, no turn, $0. One wrong answer is one sample;
|
|
6
|
+
// the graded hold reads it among the workflow's others, and a hold asks the workflow's revision (learning-end.ts
|
|
7
|
+
// compileAskOf);
|
|
11
8
|
// - a run the agent finished (path `agent` or `handed_back`) graded with words (`label`): a look-back round on them
|
|
12
|
-
// (#2579's later round, notes)
|
|
9
|
+
// (#2579's later round, notes). The run opens again on it: the grade's words are on its record, the agent is asked no
|
|
10
|
+
// turn of the job's, and the run goes straight to its end-of-run turn, which reads the words. Its spend is learning
|
|
11
|
+
// spend.
|
|
13
12
|
// A grade with neither asks for nothing more. The server writes the round's steer (server.ts gradeRun, runs.reopen); the
|
|
14
13
|
// adapter loop takes it (adapter-loop.ts steer: a FEEDBACK entry, no turn), and the end-of-run step reads it
|
|
15
14
|
// (learning-end.ts: heard, never "nothing new"; adapter-loop.ts askEndOfRun: feedbackAsk before the prompt).
|
|
@@ -18,24 +17,12 @@ import { readLaunchBody } from "../run-launch.js";
|
|
|
18
17
|
import { RunFinal } from "../store/store.js";
|
|
19
18
|
import { KINDS } from "./journal-kinds.js";
|
|
20
19
|
import { commandRequest } from "./loop.js";
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
*
|
|
20
|
+
export const FEEDBACK_ROUNDS = ["look_back"];
|
|
21
|
+
/** What a grade asks for: `look_back` for a graded run the agent finished when the grade has words, else none
|
|
22
|
+
* (undefined): a run its learned workflow answered alone opens none, right or wrong (its grade is kept). A replay run
|
|
23
|
+
* is never graded. */
|
|
25
24
|
export function feedbackRoundOf(grade, label) {
|
|
26
|
-
|
|
27
|
-
return !grade.correct && grade.workflow ? "revise" : undefined;
|
|
28
|
-
if (grade.path === "agent" || grade.path === "handed_back")
|
|
29
|
-
return label ? "look_back" : undefined;
|
|
30
|
-
return undefined;
|
|
31
|
-
}
|
|
32
|
-
/** The grade's words as the round says them: its `label`, else the fields a right answer holds (`expected`), else
|
|
33
|
-
* "(no words)". Never the verdict: feedbackAsk and the compile ask each say it once. (A right grade opens a round only
|
|
34
|
-
* with a label (feedbackRoundOf), so none reaches here without one.) */
|
|
35
|
-
export function feedbackWords(label, expected) {
|
|
36
|
-
if (label?.trim())
|
|
37
|
-
return label.trim();
|
|
38
|
-
return expected ? `A right answer holds: ${JSON.stringify(expected)}` : "(no words)";
|
|
25
|
+
return (grade.path === "agent" || grade.path === "handed_back") && label ? "look_back" : undefined;
|
|
39
26
|
}
|
|
40
27
|
/** The feedback round a steer's body asks for (`body.feedback`, the server's own: server.ts gradeRun writes it, and the
|
|
41
28
|
* message API never does), else undefined. */
|
|
@@ -44,7 +31,7 @@ export function feedbackOf(body) {
|
|
|
44
31
|
const text = body?.text;
|
|
45
32
|
if (!fed || typeof fed !== "object" || !FEEDBACK_ROUNDS.includes(fed.round) || typeof fed.correct !== "boolean" || typeof text !== "string")
|
|
46
33
|
return undefined;
|
|
47
|
-
return { round: fed.round, correct: fed.correct,
|
|
34
|
+
return { round: fed.round, correct: fed.correct, text };
|
|
48
35
|
}
|
|
49
36
|
/** The feedback round the run's root `entries` say its next end closes: its newest FEEDBACK entry when no end came after
|
|
50
37
|
* it, else undefined. */
|
|
@@ -54,13 +41,9 @@ export function pendingFeedbackOf(entries) {
|
|
|
54
41
|
return undefined;
|
|
55
42
|
return feedbackOf({ feedback: entries[at].data, text: entries[at].data?.text });
|
|
56
43
|
}
|
|
57
|
-
/** What the end-of-run turn of a feedback round is told before its prompt:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
* again changed is the compile turn's, after it (learning-end.ts compileAskOf reads the round, learn/compile.ts asks). */
|
|
61
|
-
export function feedbackAsk(feedback, seen) {
|
|
62
|
-
const graded = `A reviewer graded ${seen ? "that" : "this run's"} answer ${feedback.correct ? "right" : "wrong"}. What they said:`;
|
|
63
|
-
return [...(seen ? [seen.job, servedAnswerText(seen.served.workflow, seen.served.answer)] : []), graded, "", feedback.text].join("\n\n").replace(/\n{3,}/g, "\n\n");
|
|
44
|
+
/** What the end-of-run turn of a feedback round is told before its prompt: the grade and its words. */
|
|
45
|
+
export function feedbackAsk(feedback) {
|
|
46
|
+
return [`A reviewer graded this run's answer ${feedback.correct ? "right" : "wrong"}. What they said:`, "", feedback.text].join("\n\n").replace(/\n{3,}/g, "\n\n");
|
|
64
47
|
}
|
|
65
48
|
/** How a feedback round stands (GET /runs/{id}/learning `graded.feedback_status`): `running` until it settles; `ended`,
|
|
66
49
|
* its run took the grade's words and ended after them; `not_run`, its run ended before it took them. */
|
|
@@ -83,16 +66,15 @@ export function feedbackStatus(entries, command) {
|
|
|
83
66
|
return command.refused !== null ? "not_run" : "running";
|
|
84
67
|
}
|
|
85
68
|
/** Opens run `grade.run` again on the feedback round its grade asks for (feedbackRoundOf), with the grade's words
|
|
86
|
-
* (`label
|
|
87
|
-
* never one that only uses what was learned,
|
|
88
|
-
* feedback, neither archived nor of an archived
|
|
69
|
+
* (`label`), and says which, with its steer: only a run that learns (its launch's learning start,
|
|
70
|
+
* never one that only uses what was learned), whose runner supports managed feedback, neither archived nor of an archived
|
|
89
71
|
* agent (closed history: a grade of it starts no paid work), and one the store opens again (an agentic run that answered
|
|
90
72
|
* or that a person stopped). Null when the grade asks for nothing more, or the run can't be opened again (the grade is
|
|
91
73
|
* kept either way). */
|
|
92
74
|
export async function openFeedbackRound(store, grade, label) {
|
|
93
75
|
const words = label?.trim() ? label.trim() : undefined;
|
|
94
76
|
const round = feedbackRoundOf(grade, words);
|
|
95
|
-
if (!round)
|
|
77
|
+
if (!round || !words)
|
|
96
78
|
return null;
|
|
97
79
|
const run = await store.runs.get(grade.run);
|
|
98
80
|
if (!run || run.archivedAt !== null || (await store.agents.get(run.agentId))?.archivedAt !== null)
|
|
@@ -103,11 +85,11 @@ export async function openFeedbackRound(store, grade, label) {
|
|
|
103
85
|
if (launch?.native || launch?.sdk)
|
|
104
86
|
return null;
|
|
105
87
|
const learning = launch?.learning;
|
|
106
|
-
if (!learning || learning.use
|
|
88
|
+
if (!learning || learning.use)
|
|
107
89
|
return null;
|
|
108
|
-
const feedback = { round, correct: grade.correct
|
|
90
|
+
const feedback = { round, correct: grade.correct };
|
|
109
91
|
try {
|
|
110
|
-
const steer = await store.runs.reopen(grade.run, { kind: "steer", body: { text:
|
|
92
|
+
const steer = await store.runs.reopen(grade.run, { kind: "steer", body: { text: words, feedback } });
|
|
111
93
|
return { round, command: steer.id };
|
|
112
94
|
}
|
|
113
95
|
catch (error) {
|
|
@@ -78,6 +78,15 @@ export declare function modelsOwn(rows: readonly TimelineEvent[]): (row: Timelin
|
|
|
78
78
|
* came in. Anything else is asked its end-of-run turn. Read on the job's turns (withoutFeedbackRounds): a grade's
|
|
79
79
|
* feedback round is no message of the job's. */
|
|
80
80
|
export declare function onlyLearnedWorkflows(rows: readonly TimelineEvent[]): boolean;
|
|
81
|
+
/** Whether a run carries its owner's feedback, the only thing a run of a job that compiles workflows is looked back on
|
|
82
|
+
* for: a grade's words its end closes (a feedback round, feedback-round.ts pendingFeedbackOf over its root `entries`),
|
|
83
|
+
* or a person's message after its first in its timeline `rows` (a follow-up, or a word while it ran: traceFrom's
|
|
84
|
+
* feedback), the end-of-run turn's own, a grade's round's and a subagent's (a child conversation's rows carry its
|
|
85
|
+
* spawning call, parent_tool_use_id: its task prompt is the job's, not the owner's) rows left out. */
|
|
86
|
+
export declare function ownerSaid(entries: readonly {
|
|
87
|
+
readonly kind: string;
|
|
88
|
+
readonly data?: unknown;
|
|
89
|
+
}[], rows: readonly TimelineEvent[]): boolean;
|
|
81
90
|
/** The path a run took (learning-cost.ts RunPath), by its timeline `rows` as runTimeline labels them (its end-of-run
|
|
82
91
|
* turn's rows, LEARNING_LABEL, are the learning's and left out): `workflow` when its job did only what
|
|
83
92
|
* onlyLearnedWorkflows asks of a run with nothing new to look back on, `handed_back` when it called a learned workflow
|
|
@@ -99,12 +108,14 @@ export declare function traceOf(store: Store, runId: string, refuse: readonly st
|
|
|
99
108
|
* shape. */
|
|
100
109
|
export declare function traceFrom(timeline: readonly TimelineEvent[], refuse: readonly string[]): CompileTrace;
|
|
101
110
|
/** The compile turn's facts for run `runId` of agent `agentId` (learn/compile.ts): a revision of the learned workflow
|
|
102
|
-
* that
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* agent
|
|
106
|
-
*
|
|
107
|
-
* of its last COMPILE_QUIET_RUNS runs compiled, and it
|
|
111
|
+
* that fits the run's input and whose promotion holds it at main's digest (runner/promotion.ts: its replay on the
|
|
112
|
+
* agent's graded inputs, or its graded served runs, fell under the bar; its champion served the run, or the agent did by
|
|
113
|
+
* hand), its text as main holds it, with the hold's numbers, once per hold (none when any run since the hold compiled
|
|
114
|
+
* it, read from the agent's kept learning; a check's hold with the inputs it disagreed on, a stopped check's none);
|
|
115
|
+
* else, when the job is due (compileDue: the run completed, the agent has no learned workflow active or waiting, none
|
|
116
|
+
* of its last COMPILE_QUIET_RUNS runs compiled, and it has its definition's compile_after completed agent runs), a new
|
|
117
|
+
* one. Nothing else asks one: a hand-back, a wrong grade of a served answer and the money rule's
|
|
118
|
+
* stop are single runs, which the hold reads among many. Either way the
|
|
108
119
|
* agent's active notes whole, the traces of its last COMPILE_TRACES completed runs before this one, the tools a call node
|
|
109
120
|
* may run (draftTools) with what each takes and gives, its decision providers, the run's input (`input`, its fields for
|
|
110
121
|
* the workflow's input schema), the agent's output schema when it has one (its final output's shape) and the DSL's
|
|
@@ -116,6 +127,5 @@ export declare function compileAskOf(deps: LearningEndDeps, input: {
|
|
|
116
127
|
outcome: "completed" | "failed";
|
|
117
128
|
refuse: readonly string[];
|
|
118
129
|
input?: unknown;
|
|
119
|
-
seedNotes?: number;
|
|
120
130
|
seedWorkflows?: number;
|
|
121
131
|
}): Promise<CompileAsk | undefined>;
|