@tacuchi/agent-workflow-cli 21.10.1 → 21.12.0

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.
Files changed (56) hide show
  1. package/dist/application/dev-bootstrap-dsn-service.js +45 -35
  2. package/dist/application/dev-bootstrap-dsn-service.js.map +1 -1
  3. package/dist/application/docs-canon-service.js +68 -0
  4. package/dist/application/docs-canon-service.js.map +1 -0
  5. package/dist/application/dsn-reader-service.js +53 -2
  6. package/dist/application/dsn-reader-service.js.map +1 -1
  7. package/dist/application/flow/advance.js +132 -18
  8. package/dist/application/flow/advance.js.map +1 -1
  9. package/dist/application/flow/flow-service.js +100 -2
  10. package/dist/application/flow/flow-service.js.map +1 -1
  11. package/dist/application/flow/internal-drive.js +16 -13
  12. package/dist/application/flow/internal-drive.js.map +1 -1
  13. package/dist/application/flow/run-state-service.js +236 -5
  14. package/dist/application/flow/run-state-service.js.map +1 -1
  15. package/dist/application/flow/submit.js +90 -35
  16. package/dist/application/flow/submit.js.map +1 -1
  17. package/dist/application/mcp-dbhub-launcher.js +193 -34
  18. package/dist/application/mcp-dbhub-launcher.js.map +1 -1
  19. package/dist/application/mcp-doctor-service.js +13 -4
  20. package/dist/application/mcp-doctor-service.js.map +1 -1
  21. package/dist/application/mcp-test-connection-service.js +5 -11
  22. package/dist/application/mcp-test-connection-service.js.map +1 -1
  23. package/dist/application/paths-service.js +17 -0
  24. package/dist/application/paths-service.js.map +1 -1
  25. package/dist/application/session-narrative.js +7 -3
  26. package/dist/application/session-narrative.js.map +1 -1
  27. package/dist/application/session-resolver.js +12 -2
  28. package/dist/application/session-resolver.js.map +1 -1
  29. package/dist/application/session-resume-service.js +7 -0
  30. package/dist/application/session-resume-service.js.map +1 -1
  31. package/dist/application/visibility-doctor-service.js +89 -49
  32. package/dist/application/visibility-doctor-service.js.map +1 -1
  33. package/dist/application/workspace-migrate/apply.js +57 -0
  34. package/dist/application/workspace-migrate/apply.js.map +1 -0
  35. package/dist/application/workspace-migrate/markers.js +177 -0
  36. package/dist/application/workspace-migrate/markers.js.map +1 -0
  37. package/dist/application/workspace-migrate/plan.js +171 -0
  38. package/dist/application/workspace-migrate/plan.js.map +1 -0
  39. package/dist/application/workspace-migrate/preview.js +111 -0
  40. package/dist/application/workspace-migrate/preview.js.map +1 -0
  41. package/dist/cli/commands/flow.js +52 -5
  42. package/dist/cli/commands/flow.js.map +1 -1
  43. package/dist/cli/commands/unknown-flags.js +51 -0
  44. package/dist/cli/commands/unknown-flags.js.map +1 -0
  45. package/dist/cli/commands/visibility.js +105 -16
  46. package/dist/cli/commands/visibility.js.map +1 -1
  47. package/dist/cli/commands/workspace-migrate.js +70 -0
  48. package/dist/cli/commands/workspace-migrate.js.map +1 -0
  49. package/dist/domain/capability/effects.js +13 -0
  50. package/dist/domain/capability/effects.js.map +1 -1
  51. package/dist/domain/flow/answer.js +105 -0
  52. package/dist/domain/flow/answer.js.map +1 -1
  53. package/dist/domain/flow/run-state.js +215 -11
  54. package/dist/domain/flow/run-state.js.map +1 -1
  55. package/package.json +1 -1
  56. package/skills/w/loops/CHASSIS.md +5 -7
@@ -0,0 +1,70 @@
1
+ /**
2
+ * `aw workspace-migrate`: bring a hub that carries a legacy session series up to
3
+ * the model the rest of the CLI operates.
4
+ *
5
+ * Read-only by default and explicit by design. It is a PUNCTUAL operation, not
6
+ * a reconciliation another command performs on the side: it decides by
7
+ * comparing the durable record against the disk, the two can disagree, and a
8
+ * disagreement is answered by leaving that session exactly as it was and saying
9
+ * so. Nothing is written until somebody types `--apply`, and what gets written
10
+ * is re-derived under the workspace lock at that moment.
11
+ */
12
+ import { applyWorkspaceMigration, } from "../../application/workspace-migrate/apply.js";
13
+ import { planWorkspaceMigration } from "../../application/workspace-migrate/plan.js";
14
+ import { migrationPreview, renderMigrationApplied, renderMigrationPreview, } from "../../application/workspace-migrate/preview.js";
15
+ import { failSemantic } from "../render.js";
16
+ import { reviewFlags, unknownFlagMessage } from "./unknown-flags.js";
17
+ // A command born today has no caller that ever passed it a flag of more, so
18
+ // there is nothing to break by refusing one — which is why the rejection can be
19
+ // total here and had to be scoped elsewhere.
20
+ const FLAGS = { known: ["apply"] };
21
+ export const workspaceMigrateCommand = {
22
+ name: "workspace-migrate",
23
+ describe: "Pone al día un workspace con serie legacy: renombra los marcadores del bloque de proyecto al namespace vigente, " +
24
+ "siembra los centinelas de cierre que el histórico ya declara y reserva los números legacy en el registro durable. " +
25
+ "Sin --apply no escribe nada: muestra qué va a pasar. Una sesión sobre la que el histórico y el disco se contradicen " +
26
+ "queda intacta y se reporta. Usage: aw workspace-migrate [--apply].",
27
+ async execute(args, ctx) {
28
+ const review = reviewFlags(args, FLAGS);
29
+ if (review.unknown.length > 0) {
30
+ return failSemantic({
31
+ code: "UNKNOWN_FLAG",
32
+ message: unknownFlagMessage(review, FLAGS),
33
+ action: "corregí el flag y reintentá: `aw workspace-migrate [--apply]`",
34
+ });
35
+ }
36
+ if (!args.flags.has("--apply")) {
37
+ const plan = await planWorkspaceMigration(ctx.fs, ctx.paths);
38
+ return {
39
+ ok: true,
40
+ data: {
41
+ action: "preview",
42
+ ...migrationPreview(plan),
43
+ next: "aw workspace-migrate --apply",
44
+ },
45
+ exitCode: 0,
46
+ };
47
+ }
48
+ const applied = await applyWorkspaceMigration(ctx.fs, ctx.paths);
49
+ if ("error" in applied) {
50
+ return failSemantic({
51
+ code: "LOCK_BUSY",
52
+ message: applied.error,
53
+ action: "esperá a que termine la operación en curso y reintentá",
54
+ });
55
+ }
56
+ return { ok: true, data: { action: "apply", ...applied }, exitCode: 0 };
57
+ },
58
+ renderHuman(result, context) {
59
+ if (!result.ok || result.data === undefined)
60
+ return "";
61
+ const data = result.data;
62
+ const lines = data.action === "apply" ? [renderMigrationApplied(data)] : [renderMigrationPreview(data)];
63
+ if (context.detail && data.action === "preview") {
64
+ lines.push("", `Serie legacy: ${data.legacy.join(", ") || "(ninguna)"}`);
65
+ }
66
+ // The writer emits this verbatim, so the trailing newline belongs here.
67
+ return `${lines.join("\n").trimEnd()}\n`;
68
+ },
69
+ };
70
+ //# sourceMappingURL=workspace-migrate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-migrate.js","sourceRoot":"","sources":["../../../src/cli/commands/workspace-migrate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAEL,uBAAuB,GACxB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAEL,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,gDAAgD,CAAC;AAIxD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAqB,WAAW,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExF,4EAA4E;AAC5E,gFAAgF;AAChF,6CAA6C;AAC7C,MAAM,KAAK,GAAiB,EAAE,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;AAcjD,MAAM,CAAC,MAAM,uBAAuB,GAAuC;IACzE,IAAI,EAAE,mBAAmB;IACzB,QAAQ,EACN,kHAAkH;QAClH,oHAAoH;QACpH,sHAAsH;QACtH,oEAAoE;IAEtE,KAAK,CAAC,OAAO,CAAC,IAAgB,EAAE,GAAe;QAC7C,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACxC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC9B,OAAO,YAAY,CAAyB;gBAC1C,IAAI,EAAE,cAAc;gBACpB,OAAO,EAAE,kBAAkB,CAAC,MAAM,EAAE,KAAK,CAAC;gBAC1C,MAAM,EAAE,+DAA+D;aACxE,CAAC,CAAC;QACL,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YAC/B,MAAM,IAAI,GAAG,MAAM,sB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AAC,IAAI,WAAW,EAAE,CAAC,CAAC;QAC3E,CAAC;QACD,wEAAwE;QACxE,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC;IAC3C,CAAC;CACF,CAAC"}
@@ -42,6 +42,19 @@ export function isEffectClass(value) {
42
42
  * which.
43
43
  */
44
44
  export const SELF_AUTHORIZABLE_CLASSES = ["read_only", "local_additive"];
45
+ /**
46
+ * Whether these classes reach anything a second attempt could double.
47
+ *
48
+ * `read_only` is the one class that leaves nothing behind: repeating it produces
49
+ * the same reading and credits nothing. Every other class writes, runs, leaves
50
+ * the machine or destroys, and each of those makes "do it again" a different
51
+ * question from "do it once". Two guards ask exactly this — whether an exhausted
52
+ * boundary may be passed over, and whether one may be handed back as answerable
53
+ * — and they ask it through this predicate so they cannot answer it differently.
54
+ */
55
+ export function touchesTheWorld(classes) {
56
+ return classes.some((effect) => effect !== "read_only");
57
+ }
45
58
  export const OPEN_EFFECT_POLICY = { denied: [], preflight: [] };
46
59
  /**
47
60
  * Decide, for one operation, what the invocation may do by itself and what has
@@ -1 +1 @@
1
- {"version":3,"file":"effects.js","sourceRoot":"","sources":["../../../src/domain/capability/effects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,2EAA2E;IAC3E,WAAW;IACX,6EAA6E;IAC7E,gBAAgB;IAChB,0DAA0D;IAC1D,kBAAkB;IAClB,qDAAqD;IACrD,SAAS;IACT,8DAA8D;IAC9D,kBAAkB;IAClB,uEAAuE;IACvE,aAAa;CACL,CAAC;AAkBX,MAAM,SAAS,GAAwB,IAAI,GAAG,CAAC,cAAc,CAAC,CAAC;AAE/D,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAC3D,CAAC;AAED;;;;;;;;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MAAM;QAAE,OAAO,KAAK,CAAC;IACtF,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC1D,IAAI,MAAM,CAAC,KAAK,KAAK,WAAW;QAAE,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC;IACnE,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC;AAChC,CAAC"}
@@ -21,6 +21,111 @@ import { isEffectClass } from "../capability/effects.js";
21
21
  import { CAPABILITY_OUTCOMES, } from "../capability/protocol.js";
22
22
  import { proposalContractOf, } from "./authority.js";
23
23
  import { STOP_LABEL, isFlowControl } from "./directive.js";
24
+ /**
25
+ * Which rejections COUNT as an attempt at the boundary, and which never reached
26
+ * it.
27
+ *
28
+ * The cap of three exists to stop a gap from being re-fired forever — that is
29
+ * doctrine. What it never meant to protect against is a typo in the envelope, and
30
+ * the difference had a measured cost: hosts spent whole sessions discovering that
31
+ * `outcome` goes at the top level, that a validation carries `id` and not `name`,
32
+ * that an authoring boundary wants its bytes in `artifacts` — and every discovery
33
+ * burned one of the three tries at a boundary they had not yet been able to
34
+ * answer once. Two typos plus one real attempt exhausted a run.
35
+ *
36
+ * So the line is: **did the payload deliver a decision this boundary could
37
+ * weigh?**
38
+ *
39
+ * - `envelope` — nothing was weighed. No payload at all, unparseable JSON, an
40
+ * answer addressed to another boundary (`STALE`), a boundary that expects none,
41
+ * a result that is not a result (`FLOW_RESULT_INVALID`), bytes in the wrong
42
+ * channel or missing from the only channel that carries them
43
+ * (`FLOW_ARTIFACTS_*`, and the path/size refusals the semantic protocol
44
+ * raises). At an execution boundary the decision IS the result and at an
45
+ * authoring one it IS the bytes: with neither there, there is nothing to judge,
46
+ * and charging for it charges for the envelope.
47
+ * - `evaluated` — the decision arrived and did not resolve the gap. A signal
48
+ * outside the declared vocabulary, a label that is not one of the emitted
49
+ * alternatives, an approval over other effects or none at all, a result about a
50
+ * different invocation, an execution that did not complete or left its effect
51
+ * half-applied, a scope naming sources the workspace or the plan does not, a
52
+ * proposal reaching past what its row declares — and an answer that declares
53
+ * nothing at all, which is the feigned convergence the chassis degrades and
54
+ * exactly what the cap is for.
55
+ * - `control` — a real answer that deliberately applies nothing, or the same
56
+ * answer arriving twice. Pausing to compact, stopping the run, and a resend are
57
+ * all decisions somebody made on purpose; charging them would make the flow
58
+ * control the CLI itself offers cost an attempt, which is the loop the cap is
59
+ * supposed to prevent rather than one it is supposed to count.
60
+ *
61
+ * `FLOW_ANSWER_STALE` is the one worth spelling out. It looks like a bad answer
62
+ * and is not: it answers a boundary the run has left, so charging it would spend
63
+ * the CURRENT boundary's budget on a payload that was never about it — and
64
+ * staleness is frequently the engine's own doing, since the run may have moved
65
+ * between the directive and the answer.
66
+ *
67
+ * Every code the parser, the execution verdict and `submit` can put in front of a
68
+ * boundary is in here. That is not tidiness: `submit`'s own refusals used to sit
69
+ * outside the table and outside the charge, so a scope answered with an alias the
70
+ * plan does not name could be re-sent forever — never exhausting, never
71
+ * degrading, never recovering. A guard walks the three sources and fails if a
72
+ * code is missing from this table.
73
+ */
74
+ export const FLOW_ANSWER_REJECTIONS = {
75
+ FLOW_ANSWER_MISSING: "envelope",
76
+ FLOW_ANSWER_INVALID: "envelope",
77
+ FLOW_ANSWER_STALE: "envelope",
78
+ FLOW_ANSWER_NOT_EXPECTED: "envelope",
79
+ FLOW_RESULT_INVALID: "envelope",
80
+ FLOW_ARTIFACTS_MISSING: "envelope",
81
+ FLOW_ARTIFACTS_NOT_EXPECTED: "envelope",
82
+ // Raised by `parseSemanticArtifacts` and forwarded verbatim: a destination
83
+ // outside the allowlist, a duplicate, an oversized artifact.
84
+ SEMANTIC_PATH_REJECTED: "envelope",
85
+ SEMANTIC_RESPONSE_INVALID: "envelope",
86
+ // The registry moved under a run in flight, so the invocation the result is
87
+ // about is no longer the one this build emits. Nothing about the ANSWER was
88
+ // weighed, and the next `advance` re-binds the action by itself.
89
+ FLOW_ACTION_CHANGED: "envelope",
90
+ FLOW_ANSWER_AMBIGUOUS: "evaluated",
91
+ FLOW_SIGNAL_UNKNOWN: "evaluated",
92
+ FLOW_CHOICE_UNKNOWN: "evaluated",
93
+ FLOW_APPROVAL_MISSING: "evaluated",
94
+ FLOW_APPROVAL_MISMATCH: "evaluated",
95
+ FLOW_ACTION_MISMATCH: "evaluated",
96
+ // The execution verdict's own vocabulary: it judges a result that WAS read.
97
+ FLOW_EXECUTION_NOT_COMPLETED: "evaluated",
98
+ FLOW_EVIDENCE_MISSING: "evaluated",
99
+ FLOW_EFFECT_PARTIAL: "evaluated",
100
+ // The scope boundary's own vocabulary. Its answer is `decisions.sources` plus
101
+ // `decisions.plan`, and every one of these means the CLI read them and found
102
+ // them wanting — a decision that did not resolve the gap.
103
+ FLOW_SCOPE_INVALID: "evaluated",
104
+ FLOW_SCOPE_UNKNOWN_SOURCE: "evaluated",
105
+ FLOW_SCOPE_NOT_IN_PLAN: "evaluated",
106
+ FLOW_SCOPE_PLAN_UNREADABLE: "evaluated",
107
+ // The authoring boundary's: the bytes arrived and what they would do is not
108
+ // what the row declares, or their destination could not be read.
109
+ FLOW_PROPOSAL_BEYOND_CONTRACT: "evaluated",
110
+ FLOW_PROPOSAL_DESTINATION_UNOBSERVED: "evaluated",
111
+ FLOW_PROPOSAL_BASE_UNREADABLE: "evaluated",
112
+ FLOW_BOUNDARY_PAUSED: "control",
113
+ FLOW_BOUNDARY_DECLINED: "control",
114
+ FLOW_ANSWER_RESENT: "control",
115
+ };
116
+ /**
117
+ * Whether this refusal spends one of the boundary's three attempts.
118
+ *
119
+ * A code the table does not classify spends, deliberately: the cap is the only
120
+ * thing standing between a run and an infinite loop, and a silent exemption would
121
+ * remove it for whatever was added last. The table is a closed set precisely so
122
+ * this default is never reached — a guard walks the sources and refuses a code
123
+ * nobody placed on one side or the other.
124
+ */
125
+ export function spendsAttempt(code) {
126
+ const classified = FLOW_ANSWER_REJECTIONS[code];
127
+ return classified === undefined || classified === "evaluated";
128
+ }
24
129
  export function parseFlowAnswer(input) {
25
130
  const payload = readPayload(input.raw);
26
131
  if (!payload.ok)
@@ -1 +1 @@
1
- {"version":3,"file":"answer.js","sourceRoot":"","sources":["../../../src/domain/flow/answer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,OAAO,EAAE,sBAAsB,EAAE,MAAM,kDAAkD,CAAC;AAC1F,OAAO,EAAE,mBAAmB,EAAqB,MAAM,6BAA6B,CAAC;AACrF,OAAO,EAAoB,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EACL,mBAAmB,GAOpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAIL,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAA0C,UAAU,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAoEnG,MAAM,UAAU,eAAe,CAAC,KAAuB;IACrD,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACvC,IAAI,CAAC,OAAO,CAAC,EAAE;QAAE,OAAO,OAAO,CAAC;IAChC,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC;IAE3B,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACpC,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAEvD,QAAQ,KAAK,CAAC,QAAQ,EAAE,CAAC;QACvB,KAAK,UAAU;YACb,OAAO,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACrC,KAAK,OAAO;YACV,OAAO,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACnC,KAAK,eAAe;YAClB,OAAO,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACrC,KAAK,WAAW;YACd,OAAO,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;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
@@ -23,8 +23,32 @@
23
23
  */
24
24
  import { WORKLINE_FLOWS } from "../../application/capability/compose.js";
25
25
  import { canonicalJson, semanticDigest } from "../../application/semantic-operation/protocol.js";
26
- import { isEffectClass } from "../capability/effects.js";
27
- export const FLOW_RUN_STATE_VERSION = 7;
26
+ import { isEffectClass, touchesTheWorld } from "../capability/effects.js";
27
+ /**
28
+ * The version this CLI WRITES. Every state it persists carries it.
29
+ *
30
+ * Raised by the attempt accounting: a state that carries the monotone floor is a
31
+ * state whose cap depends on a reader that knows to consult it. The version gate
32
+ * is an exact-equality check in every build that ever shipped, so an older CLI
33
+ * refuses a file stamped with a version it does not know — which is the only
34
+ * mechanism that stops it from reading the new format, IGNORING the floor, and
35
+ * turning the cap off in silence while somebody alternates CLI versions over one
36
+ * run. Failing with a cause is the requirement; failing silently is the defect.
37
+ */
38
+ export const FLOW_RUN_STATE_VERSION = 8;
39
+ /**
40
+ * The versions this CLI READS, newest first.
41
+ *
42
+ * Two, and the second one is not a migration: every field version 8 added is
43
+ * OPTIONAL and its absence is the conservative reading — no floor beyond the
44
+ * ledger, nothing forgiven, no degradation declared. So a run written before
45
+ * them is read exactly as it always was, keeps walking, and is re-stamped as
46
+ * version 8 by its first write. Refusing it instead would strand runs that were
47
+ * mid-journey when the CLI was upgraded, which is the compatibility the spec
48
+ * demands; inventing values for the missing fields would be the fabrication the
49
+ * version gate exists to refuse. Neither happens here.
50
+ */
51
+ export const FLOW_RUN_STATE_READABLE = [FLOW_RUN_STATE_VERSION, 7];
28
52
  /** The CLI-owned run state inside the session folder. Machine-local, dotted. */
29
53
  export const FLOW_RUN_STATE_FILE = ".flow-run.json";
30
54
  /**
@@ -37,9 +61,55 @@ export const FLOW_RUN_STATE_FILE = ".flow-run.json";
37
61
  * more. The fourth would be the loop the rule exists to prevent.
38
62
  */
39
63
  export const MAX_BOUNDARY_ATTEMPTS = 3;
40
- /** How many attempts this run has already spent on one transition. */
64
+ /**
65
+ * How many attempts this run has EFFECTIVELY spent on one transition.
66
+ *
67
+ * Three numbers, and none of them alone is the answer. The ledger rows are what
68
+ * this file remembers, and they are exactly what a restored copy of the file
69
+ * rolls back — the seal detects an edit but not a `cp` of yesterday's state, so
70
+ * counting rows alone made the cap evadable. The FLOOR is the monotone counter
71
+ * kept outside the sealed blob (see the run-state service): it never goes
72
+ * backwards, so the maximum of the two is the count that survives a restore. The
73
+ * GRANTS are what a recovery gave back, and they are subtracted rather than
74
+ * deleted from the floor, because a recovery that lowered the counter would
75
+ * reopen the very hole it is fenced by.
76
+ *
77
+ * Both maps are optional on purpose: a run written before the counter existed has
78
+ * only its rows, which is precisely what it always had. Absence is read as "no
79
+ * floor beyond the ledger, nothing forgiven" — the conservative value — and never
80
+ * as a reason to refuse a run that was walking fine.
81
+ */
41
82
  export function attemptsAt(state, transition) {
42
- return state.attempts.filter((attempt) => attempt.transition === transition).length;
83
+ const spent = state.attempts.filter((attempt) => attempt.transition === transition).length;
84
+ const floor = state.attempt_floor?.[transition] ?? 0;
85
+ const granted = state.attempt_grants?.[transition] ?? 0;
86
+ return Math.max(0, Math.max(spent, floor) - granted);
87
+ }
88
+ export function recoveryBlockedAt(state, transition) {
89
+ const trace = state.events.filter((event) => event.transition === transition);
90
+ const material = [...trace].reverse().find(declaresMaterialEffect);
91
+ if (material !== undefined)
92
+ return { reason: "materialized", event: material };
93
+ const pending = state.pending_action;
94
+ if (pending?.transition === transition && pending.attempted && trace.length === 0) {
95
+ return { reason: "unverified" };
96
+ }
97
+ return null;
98
+ }
99
+ /**
100
+ * Whether this event says the world moved — including when it cannot say.
101
+ *
102
+ * `FLOW_EFFECT_PARTIAL` is its own answer: the invocation declared complete and
103
+ * did not apply everything the row demanded, so what it DID apply is exactly the
104
+ * unknown. And a `failed` event with no `effects` at all comes from a trace
105
+ * written before the field existed: same unknown, same refusal.
106
+ */
107
+ function declaresMaterialEffect(event) {
108
+ if (event.kind !== "failed")
109
+ return touchesTheWorld(event.effects);
110
+ if (event.effects === undefined)
111
+ return true;
112
+ return event.code === "FLOW_EFFECT_PARTIAL" || touchesTheWorld(event.effects);
43
113
  }
44
114
  /**
45
115
  * The seal of everything an answer was written AGAINST — attempts excluded.
@@ -52,9 +122,15 @@ export function attemptsAt(state, transition) {
52
122
  * action, same effects. Sealing the attempts into it would report the caller's
53
123
  * own previous refusal back to them as `FLOW_ANSWER_STALE`, replacing a precise
54
124
  * reason ("this evidence is missing") with a vague one.
125
+ *
126
+ * The floor and the grants leave with the attempts, for the same reason rather
127
+ * than a new one: they are the same bookkeeping, reconciled from the monotone
128
+ * counter on every read. A seal that moved when the counter did would turn
129
+ * recording an attempt — or recovering a boundary — into staleness for an answer
130
+ * that is still about exactly this position.
55
131
  */
56
132
  export function positionDigest(state) {
57
- const { attempts: _spent, digest: _seal, ...position } = state;
133
+ const { attempts: _spent, attempt_floor: _floor, attempt_grants: _granted, digest: _seal, ...position } = state;
58
134
  return semanticDigest(position);
59
135
  }
60
136
  /** The state minus its own seal — exactly what {@link sealRunState} digests. */
@@ -121,6 +197,74 @@ export function skipTransition(state, decisionId) {
121
197
  skipped: [...state.skipped, decisionId],
122
198
  });
123
199
  }
200
+ /**
201
+ * Pass over a boundary the run GAVE UP on, saying so in its own field.
202
+ *
203
+ * A degradation is a skip — the cursor has to leave the step behind — but it is
204
+ * not the same fact, and the difference is the whole point: one says the
205
+ * condition never fired, the other says the question was asked as often as it may
206
+ * be and nobody resolved it. Recorded apart so a reader of the final state can
207
+ * tell them without reconstructing the attempt history.
208
+ */
209
+ export function degradeTransition(state, decisionId, cause) {
210
+ const skipped = skipTransition(state, decisionId);
211
+ return sealRunState({
212
+ ...withoutSeal(skipped),
213
+ degraded: [...(state.degraded ?? []), { transition: decisionId, cause }],
214
+ });
215
+ }
216
+ /**
217
+ * Give a boundary back the attempts it spent — as a GRANT, never as a deletion.
218
+ *
219
+ * Recovery cannot lower the monotone counter: the counter is what makes restoring
220
+ * an older ledger useless, and a recovery that decremented it would hand back the
221
+ * same hole wearing a supported name. So what is recorded is how many attempts
222
+ * were forgiven, which only ever grows; the effective count is the difference.
223
+ * See {@link attemptsAt}.
224
+ */
225
+ export function grantAttempts(state, transition, attempts) {
226
+ const granted = { ...(state.attempt_grants ?? {}) };
227
+ granted[transition] = (granted[transition] ?? 0) + attempts;
228
+ return sealRunState({ ...withoutSeal(state), attempt_grants: granted });
229
+ }
230
+ /**
231
+ * Stamp a state read from an older readable version with the current one.
232
+ *
233
+ * Applied on the way OUT of the reader, so the run walks — and is written back —
234
+ * as one format from the first read onwards, and the version stops being a fact
235
+ * that varies per file within one workspace. Nothing else is touched: the older
236
+ * versions this build reads differ from the current one only by fields whose
237
+ * absence is already the conservative reading, so there is nothing to fill in
238
+ * and nothing is filled in. Re-sealed because the version is inside the seal.
239
+ */
240
+ export function atCurrentVersion(state) {
241
+ if (state.version === FLOW_RUN_STATE_VERSION)
242
+ return state;
243
+ return sealRunState({ ...withoutSeal(state), version: FLOW_RUN_STATE_VERSION });
244
+ }
245
+ /**
246
+ * Reconcile the state with the monotone counter that lives outside its seal.
247
+ *
248
+ * The only writer of both maps, so "the sidecar is the authority and the state is
249
+ * its cache" is one statement in one place. An empty map is written as ABSENT
250
+ * rather than as `{}`: a run that never spent an attempt keeps the exact bytes it
251
+ * had before this field existed, which is what makes the change readable in both
252
+ * directions instead of a silent format break.
253
+ */
254
+ export function withAttemptCounters(state, counters) {
255
+ const floor = emptyToAbsent(counters.floor);
256
+ const grants = emptyToAbsent(counters.grants);
257
+ const { attempt_floor: _floor, attempt_grants: _granted, ...rest } = withoutSeal(state);
258
+ return sealRunState({
259
+ ...rest,
260
+ ...(floor === undefined ? {} : { attempt_floor: floor }),
261
+ ...(grants === undefined ? {} : { attempt_grants: grants }),
262
+ });
263
+ }
264
+ function emptyToAbsent(counter) {
265
+ const entries = Object.entries(counter).filter(([, count]) => count > 0);
266
+ return entries.length === 0 ? undefined : Object.fromEntries(entries);
267
+ }
124
268
  /** Move the boundary to where the walk stopped, applying nothing. */
125
269
  export function withBoundary(state, boundary) {
126
270
  return sealRunState({ ...withoutSeal(state), boundary });
@@ -170,6 +314,23 @@ export function withActionAttempted(state) {
170
314
  export function withEvent(state, event) {
171
315
  return sealRunState({ ...withoutSeal(state), events: [...state.events, event] });
172
316
  }
317
+ /**
318
+ * Whether appending this failure would only restate the one already there.
319
+ *
320
+ * The same failure, still standing, is ONE fact: re-running a broken action or
321
+ * re-sending the same refused result reaches the identical verdict, and
322
+ * appending it every time would turn the trace into a retry counter — which is
323
+ * what the attempt history is for. Both producers of a failure event ask here,
324
+ * so the internal driver and an external result cannot disagree about it.
325
+ */
326
+ export function restatesLastEvent(state, event) {
327
+ const last = state.events.at(-1);
328
+ if (last === undefined || last.kind !== "failed" || event.kind !== "failed")
329
+ return false;
330
+ return (last.transition === event.transition &&
331
+ last.code === event.code &&
332
+ last.message === event.message);
333
+ }
173
334
  /** Keep a validated observation for the rule that consumes it later. */
174
335
  export function withObservation(state, observation) {
175
336
  return sealRunState({
@@ -254,11 +415,13 @@ export function parseRunState(raw) {
254
415
  if (!isRecord(parsed)) {
255
416
  return refuse("FLOW_RUN_INVALID", "el estado de corrida no es un objeto JSON", "restauralo o re-adoptá la sesión con 'aw flow advance --adopt'");
256
417
  }
257
- if (parsed.version !== FLOW_RUN_STATE_VERSION) {
258
- // No silent migration, in either direction: an older state predates fields
259
- // the engine now reads, and inventing them would fabricate the very history
260
- // this file exists to make trustworthy. Re-adoption is explicit and cheap.
261
- return refuse("FLOW_RUN_VERSION_UNSUPPORTED", `versión de estado de corrida no soportada: ${String(parsed.version)}`, `esta versión del CLI lee la ${FLOW_RUN_STATE_VERSION}: actualizá el CLI, o re-adoptá la sesión con 'aw flow advance --flow <flow> --adopt' (no hay migración automática)`);
418
+ if (!FLOW_RUN_STATE_READABLE.includes(parsed.version)) {
419
+ // No silent migration, in either direction: a version outside the readable
420
+ // set either predates fields the engine now reads and inventing them would
421
+ // fabricate the very history this file exists to make trustworthy or comes
422
+ // from a build ahead of this one, whose fields this build would ignore.
423
+ // Refusing with the cause is what keeps the second case from being silent.
424
+ return refuse("FLOW_RUN_VERSION_UNSUPPORTED", `versión de estado de corrida no soportada: ${String(parsed.version)}`, `esta versión del CLI lee ${FLOW_RUN_STATE_READABLE.join(" y ")} y escribe la ${FLOW_RUN_STATE_VERSION}: actualizá el CLI, o re-adoptá la sesión con 'aw flow advance --flow <flow> --adopt' (no hay migración automática)`);
262
425
  }
263
426
  const shape = checkShape(parsed);
264
427
  if (shape !== null)
@@ -357,6 +520,18 @@ function checkRecordShape(parsed, invalid) {
357
520
  return invalid("no trae el registro de efectos completo");
358
521
  if (!isAttemptArray(parsed.attempts))
359
522
  return invalid("trae un historial de intentos inválido");
523
+ if (!isDegradationArray(parsed.degraded)) {
524
+ return invalid("declara una degradación sin transición o sin causa");
525
+ }
526
+ // A degradation is a skip that says why: one recorded over a step the run never
527
+ // passed over would be a claim about a boundary it is still standing on.
528
+ const skipped = parsed.skipped;
529
+ if ((parsed.degraded ?? []).some((entry) => !skipped.includes(entry.transition))) {
530
+ return invalid("declara degradada una transición que el recorrido nunca pasó por alto");
531
+ }
532
+ if (!isCounterMap(parsed.attempt_floor) || !isCounterMap(parsed.attempt_grants)) {
533
+ return invalid("trae una contabilidad de intentos que no es un contador por transición");
534
+ }
360
535
  if (typeof parsed.digest !== "string")
361
536
  return invalid("no trae su sello");
362
537
  return null;
@@ -479,7 +654,10 @@ function isEventArray(value) {
479
654
  if (entry.kind === "failed") {
480
655
  return (typeof entry.code === "string" &&
481
656
  typeof entry.message === "string" &&
482
- typeof entry.recovery === "string");
657
+ typeof entry.recovery === "string" &&
658
+ // ABSENT-or-well-formed, never defaulted: a version 7 trace has no such
659
+ // field, and the guard that reads it treats its absence as the refusal.
660
+ (entry.effects === undefined || isEffectClassArray(entry.effects)));
483
661
  }
484
662
  return false;
485
663
  });
@@ -489,6 +667,32 @@ function isObservationArray(value) {
489
667
  return false;
490
668
  return value.every((entry) => isRecord(entry) && typeof entry.transition === "string" && isStringArray(entry.signals));
491
669
  }
670
+ /**
671
+ * The two optional fields are checked as ABSENT-or-well-formed, never defaulted.
672
+ *
673
+ * Absence is the reading a run written before them gets, and it is the
674
+ * conservative one — no floor beyond the ledger, nothing forgiven. What is
675
+ * refused is a field that is THERE and unusable: a counter that is not a number
676
+ * per transition would make the cap depend on whatever somebody typed, which is
677
+ * the failure the counter exists to close.
678
+ */
679
+ function isCounterMap(value) {
680
+ if (value === undefined)
681
+ return true;
682
+ if (!isRecord(value))
683
+ return false;
684
+ return Object.values(value).every((count) => Number.isInteger(count) && count >= 0);
685
+ }
686
+ function isDegradationArray(value) {
687
+ if (value === undefined)
688
+ return true;
689
+ if (!Array.isArray(value))
690
+ return false;
691
+ return value.every((entry) => isRecord(entry) &&
692
+ typeof entry.transition === "string" &&
693
+ typeof entry.cause === "string" &&
694
+ entry.cause.trim().length > 0);
695
+ }
492
696
  function isAttemptArray(value) {
493
697
  if (!Array.isArray(value))
494
698
  return false;