@tacuchi/agent-workflow-cli 21.7.0 → 21.8.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.
@@ -18,10 +18,34 @@
18
18
  * transition of the run authorized to overwrite anything. A grant is now scoped
19
19
  * to the exact thing that was shown — a sealed proposal, or a named transition's
20
20
  * exact effects — and covers nothing else.
21
+ *
22
+ * Custody is the one cover that comes from the registry instead of a person, and
23
+ * it is not a second policy over classes — it is the axis the taxonomy does not
24
+ * carry: WHOSE books the effect writes. A row declared `custody: "run"` only
25
+ * touches the run's own ledger (its session, its state, the progress marks of
26
+ * the flow's own document, the checks the run itself declared), so a preflight
27
+ * would ask a person to authorize the chassis keeping its books — a question
28
+ * with nothing to decide. The cover is bounded twice: never over a sealed
29
+ * proposal (bytes are material, not bookkeeping) and never over the two classes
30
+ * outside {@link CUSTODY_COVERABLE_CLASSES}, whatever the row claims.
21
31
  */
22
32
  import { semanticDigest } from "../../application/semantic-operation/protocol.js";
23
33
  import { authorizeEffects, } from "../capability/effects.js";
24
- import { effectsOf } from "./authority.js";
34
+ import { custodyOf, effectsOf } from "./authority.js";
35
+ /**
36
+ * What run custody may cover, and the two classes it never will.
37
+ *
38
+ * Rewriting its own artifacts and running its own declared checks are the run
39
+ * keeping its books. Destroying something no later run can reconstruct, or
40
+ * leaving the machine, are not bookkeeping under any description — a row
41
+ * claiming custody over them stays uncovered, whatever it declares.
42
+ */
43
+ export const CUSTODY_COVERABLE_CLASSES = [
44
+ "read_only",
45
+ "local_additive",
46
+ "mutate_overwrite",
47
+ "execute",
48
+ ];
25
49
  /**
26
50
  * Decide whether the run may apply this transition right now.
27
51
  *
@@ -49,13 +73,17 @@ export function authorizeTransition(decision, grants, subject = null) {
49
73
  });
50
74
  const seal = subject?.digest ?? effectApprovalDigest(decision.id, planned);
51
75
  const held = heldFor(grants, seal);
76
+ // Run custody covers only the row's OWN effects: a standing proposal is
77
+ // somebody's sealed bytes, so it keeps its preflight whoever publishes it.
78
+ const custody = subject === null && custodyOf(decision) === "run";
79
+ const coveredByCustody = (effect) => custody && CUSTODY_COVERABLE_CLASSES.includes(effect);
52
80
  return {
53
81
  planned,
54
82
  covered: [
55
83
  ...verdict.selfAuthorized,
56
- ...verdict.needsPreflight.filter((effect) => held.has(effect)),
84
+ ...verdict.needsPreflight.filter((effect) => held.has(effect) || coveredByCustody(effect)),
57
85
  ],
58
- missing: verdict.needsPreflight.filter((effect) => !held.has(effect)),
86
+ missing: verdict.needsPreflight.filter((effect) => !held.has(effect) && !coveredByCustody(effect)),
59
87
  seal,
60
88
  };
61
89
  }
@@ -1 +1 @@
1
- {"version":3,"file":"authorization.js","sourceRoot":"","sources":["../../../src/domain/flow/authorization.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,kDAAkD,CAAC;AAClF,OAAO,EAGL,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAqB,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAiD9D;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CACjC,QAAsB,EACtB,MAA8B,EAC9B,UAAgC,IAAI;IAEpC,MAAM,OAAO,GAAG,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACnF,MAAM,YAAY,GAAwB,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACjE,KAAK,EAAE,MAAM;QACb,UAAU,EAAE,IAAI;QAChB,aAAa,EAAE,YAAY;QAC3B,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAC,CAAC;IACJ,+EAA+E;IAC/E,gFAAgF;IAChF,6EAA6E;IAC7E,+EAA+E;IAC/E,oEAAoE;IACpE,MAAM,OAAO,GAAG,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,UAAU,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AACtE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tacuchi/agent-workflow-cli",
3
- "version": "21.7.0",
3
+ "version": "21.8.0",
4
4
  "description": "Runtime CLI for Workline — the stages + loops + artifacts system for agent work. Bundles the universal `w` skill set under `skills/w/` (slash commands `/w:*`: spec-new/spec-refine, plan-new/plan-exec, quick, persist, workspace-init, export-*); `self install --target <host>` copies SKILL + commands + hooks into the host. Pluggable capability skills via `.workflow/skills.toml`. Multi-empresa parametrization via `profile.json` cascade. Namespace auto-detected from any `.<ns>/sessions/` dir in CWD; default `workflow`.",
5
5
  "type": "module",
6
6
  "bin": {