@basein/runner 0.3.19 → 0.3.20
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/bin/investigate.js +5 -0
- package/dist/control/server.d.ts +64 -0
- package/dist/control/server.js +637 -30
- package/dist/record/recorder.d.ts +37 -2
- package/dist/record/recorder.js +3 -0
- package/dist/record/remote-recorder.d.ts +9 -1
- package/dist/record/remote-recorder.js +30 -0
- package/dist/record/switchable-recorder.js +2 -0
- package/dist/replay/controller.js +3 -1
- package/dist/replay/derive.d.ts +10 -0
- package/dist/replay/derive.js +3 -0
- package/dist/replay/reads-only.d.ts +29 -0
- package/dist/replay/reads-only.js +261 -0
- package/docs/calculatedReplayGuide.md +4 -1
- package/package.json +1 -1
- package/production.md +14 -1
package/dist/bin/investigate.js
CHANGED
|
@@ -246,6 +246,11 @@ export const DECLINES = {
|
|
|
246
246
|
cause: "the plan was not ready before the hook that would have announced it had to answer: the prompt hook waits 7.5 s in all, match included, and a tool call that starts a plan mid-task waits 1.5 s. What arming waits for is the reading of the prompt's values (the derivation). A plan that was not announced is never run.",
|
|
247
247
|
fix: "run the prompt again. If it keeps happening the reading is slow: the recorder's log (`bir status` names the file) shows when its `replay.derived` line landed, and a dry replay shows what the service's reading took, under `reading` (`bir scenario replay <scnId> --prompt \"…\" --dry --json`). BIR_HOOK_DERIVE_BUDGET_MS does not help here, because the hook's own limit was reached first. To read values on this machine instead of asking the service, set BIR_DERIVE_API_KEY where Claude Code starts.",
|
|
248
248
|
},
|
|
249
|
+
// Nor this one: the control server's own rule (the service's offer1.md O8).
|
|
250
|
+
would_repeat: {
|
|
251
|
+
cause: "a plan the intent check matched would have started after the agent's call, not in its place, and its steps call that same tool: it would have made the call a second time — an e-mail sent twice (issue fx2). Never twice: it was not started, and the agent went on.",
|
|
252
|
+
fix: "nothing to fix in the plan. A scenario starts in the call's place only when the agent's call is its first step, value for value; one recorded in the order the agent works in (the agent's own run after a decision becomes one) is what starts there.",
|
|
253
|
+
},
|
|
249
254
|
// Nor is this one: the match itself was late, so nothing was armed at all.
|
|
250
255
|
match_late: {
|
|
251
256
|
cause: "the service's answer to the match landed too late: after the prompt hook had stopped waiting for it (3 s, BIR_MATCH_BUDGET_MS); while prompts were not waiting on the match at all — after one slow answer they stop waiting for a few minutes (`replay.match_gate state=holding`); or with the hook not waiting from the start, because a failure to reach the service was still on record (a `service.degraded` line, perhaps hours before, and no `service.recovered` until after this prompt) or the match request's first attempt failed. The agent did the task itself.",
|
package/dist/control/server.d.ts
CHANGED
|
@@ -1202,6 +1202,70 @@ export declare class ControlServer {
|
|
|
1202
1202
|
* computed is "no" — the directive then rides on the call's PostToolUse.
|
|
1203
1203
|
*/
|
|
1204
1204
|
private isFirstStep;
|
|
1205
|
+
/**
|
|
1206
|
+
* The agent's call against `state`'s first step, value for value (the
|
|
1207
|
+
* service's offer1.md O5): `hit` when every argument is the step's own,
|
|
1208
|
+
* `missing` when the only differences are values the plan does not have
|
|
1209
|
+
* (a target the reading left empty, which the agent's call may hold), and
|
|
1210
|
+
* `other` otherwise.
|
|
1211
|
+
*/
|
|
1212
|
+
private firstStepVerdict;
|
|
1213
|
+
/**
|
|
1214
|
+
* Whether `state`'s plan calls `toolName` in a step it would run: what makes
|
|
1215
|
+
* a plan started after a call of that tool make it a second time (the
|
|
1216
|
+
* service's offer1.md O8). A tool that only reads never counts — reading
|
|
1217
|
+
* twice changes nothing — by the service's own rule ({@link readsOnly}): a
|
|
1218
|
+
* `crm_search_customers` mid-task never keeps a plan that searches later from
|
|
1219
|
+
* starting.
|
|
1220
|
+
*/
|
|
1221
|
+
private planCallsTool;
|
|
1222
|
+
/**
|
|
1223
|
+
* A plan of this turn stopped at its decision: ask the service, once per
|
|
1224
|
+
* plan, which calculated scenarios can follow it, and arm each in the
|
|
1225
|
+
* background while the agent reads the note and decides (offer1.md O3, O4).
|
|
1226
|
+
* Called wherever a hand-over is first seen; a second call for the same plan
|
|
1227
|
+
* does nothing.
|
|
1228
|
+
*/
|
|
1229
|
+
private noteDecision;
|
|
1230
|
+
/**
|
|
1231
|
+
* Ask for a decision's next scenarios (offer1.md O3): each is checkable as
|
|
1232
|
+
* soon as the service answers, and armed in the background, each on its own
|
|
1233
|
+
* (O4). Resolves when the service has answered, not when the arms have.
|
|
1234
|
+
* Never rejects.
|
|
1235
|
+
*/
|
|
1236
|
+
private fetchNext;
|
|
1237
|
+
/**
|
|
1238
|
+
* Arm one next scenario in the background (offer1.md O4): its values read
|
|
1239
|
+
* from the turn's request and its results so far — or, once more, with the
|
|
1240
|
+
* agent's own call (O5) — and settled, so a call is compared with the first
|
|
1241
|
+
* step as it would really run. Never rejects.
|
|
1242
|
+
*/
|
|
1243
|
+
private armNext;
|
|
1244
|
+
/**
|
|
1245
|
+
* The agent's call after a decision, against the scenarios that can follow
|
|
1246
|
+
* it (offer1.md O5, O6). A hit — the call is a scenario's first step, value
|
|
1247
|
+
* for value — is answered in the call's place with that scenario's directive:
|
|
1248
|
+
* the agent calls `run_scenario`, and the scenario runs every step, this one
|
|
1249
|
+
* included, once. Undefined otherwise: the call runs as the agent wrote it.
|
|
1250
|
+
*/
|
|
1251
|
+
private tryNextScenarios;
|
|
1252
|
+
/** A next scenario's hit: bookkeeping as for any plan armed mid-task, then its directive in the call's place. */
|
|
1253
|
+
private nextHit;
|
|
1254
|
+
/**
|
|
1255
|
+
* A next scenario hit after the agent's own calls — looks — opened the
|
|
1256
|
+
* fragment of its work after the decision: the fragment ends here, with what
|
|
1257
|
+
* the agent did itself, and nothing more of this turn is recorded into it.
|
|
1258
|
+
* The scenario's own calls, pinned in steer mode or run in direct mode, are
|
|
1259
|
+
* not the agent's work, and would make the fragment a copy of that scenario
|
|
1260
|
+
* (offer1.md O7). A fragment still due is dropped instead
|
|
1261
|
+
* ({@link dropDecisionFragment}).
|
|
1262
|
+
*/
|
|
1263
|
+
private closeDecisionFragment;
|
|
1264
|
+
/**
|
|
1265
|
+
* End this turn's next scenarios (offer1.md O6): every one but the hit is
|
|
1266
|
+
* never announced, so never runs and is never reported.
|
|
1267
|
+
*/
|
|
1268
|
+
private endNext;
|
|
1205
1269
|
/**
|
|
1206
1270
|
* Whether an intent probe may arm a plan in its own `PreToolUse` — and so
|
|
1207
1271
|
* whether that hook waits for it. See {@link ControlServerOptions.intentArm}.
|