@astrosheep/keiyaku 4.6.1 → 4.6.3

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 (55) hide show
  1. package/README.md +93 -45
  2. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-bind/SKILL.md +3 -2
  3. package/build/src/akuma/providers/pi/events.js +3 -2
  4. package/build/src/akuma/providers/pi/index.d.ts +3 -4
  5. package/build/src/akuma/providers/pi/index.js +30 -26
  6. package/build/src/body/render.d.ts +9 -1
  7. package/build/src/body/render.js +11 -0
  8. package/build/src/cli/commands/akuma-grammar.js +12 -3
  9. package/build/src/cli/commands/akuma.js +6 -0
  10. package/build/src/cli/commands/contract-grammar.js +7 -0
  11. package/build/src/cli/commands/contract-help.d.ts +1 -1
  12. package/build/src/cli/commands/contract-help.js +21 -9
  13. package/build/src/cli/commands/contract.js +3 -1
  14. package/build/src/cli/commands/task-grammar.js +9 -7
  15. package/build/src/cli/parse.js +5 -0
  16. package/build/src/cli/render/akuma-activity.d.ts +26 -6
  17. package/build/src/cli/render/akuma-activity.js +128 -118
  18. package/build/src/cli/render/akuma-tool.js +1 -1
  19. package/build/src/cli/render/audit.js +4 -6
  20. package/build/src/cli/render/catalog.js +7 -4
  21. package/build/src/cli/render/contract-history.js +8 -18
  22. package/build/src/cli/render/contract.js +5 -10
  23. package/build/src/cli/render/kanshi-akuma.js +1 -1
  24. package/build/src/cli/render/kanshi.js +24 -30
  25. package/build/src/cli/render/receipt.d.ts +1 -2
  26. package/build/src/cli/render/receipt.js +1 -6
  27. package/build/src/cli/render/refusal.js +2 -1
  28. package/build/src/cli/render/task.js +2 -1
  29. package/build/src/core/facts/codec.js +0 -6
  30. package/build/src/core/facts/fold.js +0 -7
  31. package/build/src/core/facts/types.d.ts +1 -4
  32. package/build/src/core/verbs/deliver.js +2 -14
  33. package/build/src/library/bind.d.ts +20 -20
  34. package/build/src/library/bind.js +2 -1
  35. package/build/src/library/contract-composition.d.ts +5 -2
  36. package/build/src/library/contract-composition.js +5 -3
  37. package/build/src/library/contract-creation.d.ts +7 -1
  38. package/build/src/library/contract-creation.js +19 -9
  39. package/build/src/library/contract-execution.d.ts +1 -0
  40. package/build/src/library/contract-execution.js +12 -4
  41. package/build/src/library/contract-settings.d.ts +2 -2
  42. package/build/src/library/contract-settings.js +21 -12
  43. package/build/src/library/outcome.d.ts +476 -652
  44. package/build/src/library/refusal.d.ts +2 -2
  45. package/build/src/protocol/bind.d.ts +1 -1
  46. package/build/src/protocol/deliver.js +1 -1
  47. package/build/src/protocol/execution-observation.d.ts +0 -8
  48. package/build/src/protocol/intent.js +2 -2
  49. package/build/src/protocol/operations.d.ts +1 -1
  50. package/build/src/protocol/read/status.d.ts +1 -1
  51. package/build/src/protocol/read/status.js +0 -2
  52. package/build/src/runtime/proc/windows-launch.exe +0 -0
  53. package/build/src/world.d.ts +1 -0
  54. package/build/src/world.js +14 -0
  55. package/package.json +3 -3
@@ -13,7 +13,7 @@ function settingsScopedFailure(error) {
13
13
  /**
14
14
  * Hooks, freshness, and gate bundles are read from the captured Settings only at the operation
15
15
  * that consumes them. Bare core (omitted Settings) keeps empty hooks, false freshness, and
16
- * literal gate words; a broken selected namespace fails before any admission.
16
+ * built-in gate words; a broken selected namespace fails before any admission.
17
17
  */
18
18
  export function derivedHooks(composition) {
19
19
  if (composition.settings === undefined)
@@ -77,28 +77,28 @@ function gateValue(value, message, configured) {
77
77
  }
78
78
  function bundleGates(name, value) {
79
79
  if (value === null || typeof value !== "object" || Array.isArray(value)) {
80
- throw new SettingsError(`gate bundle '${name}' must be an object`);
80
+ throw new SettingsError(`gate group '${name}' must be an object`);
81
81
  }
82
82
  const bundle = value;
83
83
  if (bundle.kind !== "bundle") {
84
- throw new SettingsError(`gate bundle '${name}' has unsupported kind: ${String(bundle.kind)}`);
84
+ throw new SettingsError(`gate group '${name}' has unsupported kind: ${String(bundle.kind)}`);
85
85
  }
86
86
  for (const field of Object.keys(bundle)) {
87
87
  if (field !== "kind" && field !== "gates") {
88
- throw new SettingsError(`gate bundle '${name}' has unknown field: ${field}`);
88
+ throw new SettingsError(`gate group '${name}' has unknown field: ${field}`);
89
89
  }
90
90
  }
91
91
  if (!Array.isArray(bundle.gates))
92
- throw new SettingsError(`gate bundle '${name}'.gates must be an array`);
93
- return bundle.gates.map((value) => gateValue(value, `gate bundle '${name}' contains an invalid gate word`, true));
92
+ throw new SettingsError(`gate group '${name}'.gates must be an array`);
93
+ return bundle.gates.map((value) => gateValue(value, `gate group '${name}' contains an invalid gate word`, true));
94
94
  }
95
- /** Bare words and configured bundles share validation, first-seen accumulation, and freezing. */
95
+ /** Built-in words and configured bundles share validation, first-seen accumulation, and freezing. */
96
96
  export function derivedGates(composition, names) {
97
97
  const settings = composition.settings;
98
98
  const configured = settings !== undefined;
99
99
  try {
100
100
  const selected = (names ?? (configured ? ["default"] : [])).map((name, index) => gateValue(name, configured
101
- ? "gate or bundle name must match ^[a-z][a-z0-9-]{0,63}$"
101
+ ? "gate name must match ^[a-z][a-z0-9-]{0,63}$"
102
102
  : `gates[${index}] must match ^[a-z][a-z0-9-]{0,63}$`, configured));
103
103
  // Explicit empty selection never looks up a namespace.
104
104
  if (selected.length === 0)
@@ -106,13 +106,22 @@ export function derivedGates(composition, names) {
106
106
  const view = settings?.namespace("gates");
107
107
  if (view?.kind === "failed")
108
108
  namespaceFailure(view);
109
+ const known = [
110
+ ...new Set(["reviewed", "verified", ...(view?.entries.map((entry) => entry.name).filter(gateWord) ?? [])]),
111
+ ];
109
112
  const expanded = new Set();
110
113
  for (const name of selected) {
111
114
  const entry = view?.entries.find((entry) => entry.name === name);
112
- const gates = entry === undefined
113
- ? [configured && names === undefined ? gate("reviewed") : name]
114
- : bundleGates(name, entry.value);
115
- for (const value of gates)
115
+ if (entry === undefined) {
116
+ // The implicit default bundle falls back to the built-in review gate.
117
+ const implicit = configured && names === undefined;
118
+ const word = implicit ? gate("reviewed") : name;
119
+ if (word !== "reviewed" && word !== "verified")
120
+ throw new KeiyakuError("invalid-input", `Unknown gate '${word}'. Known gate names: ${known.join(", ")}`);
121
+ expanded.add(word);
122
+ continue;
123
+ }
124
+ for (const value of bundleGates(name, entry.value))
116
125
  expanded.add(value);
117
126
  }
118
127
  return Object.freeze([...expanded]);