@astrosheep/keiyaku 4.6.2 → 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.
- package/README.md +93 -45
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-bind/SKILL.md +3 -2
- package/build/src/akuma/providers/pi/events.js +3 -2
- package/build/src/body/render.d.ts +9 -1
- package/build/src/body/render.js +11 -0
- package/build/src/cli/commands/akuma-grammar.js +12 -3
- package/build/src/cli/commands/akuma.js +6 -0
- package/build/src/cli/commands/contract-grammar.js +7 -0
- package/build/src/cli/commands/contract-help.d.ts +1 -1
- package/build/src/cli/commands/contract-help.js +21 -9
- package/build/src/cli/commands/contract.js +3 -1
- package/build/src/cli/commands/task-grammar.js +9 -7
- package/build/src/cli/parse.js +5 -0
- package/build/src/cli/render/akuma-activity.d.ts +26 -6
- package/build/src/cli/render/akuma-activity.js +128 -118
- package/build/src/cli/render/akuma-tool.js +1 -1
- package/build/src/cli/render/audit.js +4 -6
- package/build/src/cli/render/catalog.js +7 -4
- package/build/src/cli/render/contract-history.js +8 -18
- package/build/src/cli/render/contract.js +5 -10
- package/build/src/cli/render/kanshi-akuma.js +1 -1
- package/build/src/cli/render/kanshi.js +24 -30
- package/build/src/cli/render/receipt.d.ts +1 -2
- package/build/src/cli/render/receipt.js +1 -6
- package/build/src/cli/render/refusal.js +2 -1
- package/build/src/cli/render/task.js +2 -1
- package/build/src/core/facts/codec.js +0 -6
- package/build/src/core/facts/fold.js +0 -7
- package/build/src/core/facts/types.d.ts +1 -4
- package/build/src/core/verbs/deliver.js +2 -14
- package/build/src/library/bind.d.ts +20 -20
- package/build/src/library/bind.js +2 -1
- package/build/src/library/contract-composition.d.ts +5 -2
- package/build/src/library/contract-composition.js +5 -3
- package/build/src/library/contract-creation.d.ts +7 -1
- package/build/src/library/contract-creation.js +19 -9
- package/build/src/library/contract-execution.d.ts +1 -0
- package/build/src/library/contract-execution.js +12 -4
- package/build/src/library/contract-settings.d.ts +2 -2
- package/build/src/library/contract-settings.js +21 -12
- package/build/src/library/outcome.d.ts +476 -652
- package/build/src/library/refusal.d.ts +2 -2
- package/build/src/protocol/bind.d.ts +1 -1
- package/build/src/protocol/deliver.js +1 -1
- package/build/src/protocol/execution-observation.d.ts +0 -8
- package/build/src/protocol/intent.js +2 -2
- package/build/src/protocol/operations.d.ts +1 -1
- package/build/src/protocol/read/status.d.ts +1 -1
- package/build/src/protocol/read/status.js +0 -2
- package/build/src/runtime/proc/windows-launch.exe +0 -0
- package/build/src/world.d.ts +1 -0
- package/build/src/world.js +14 -0
- 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
|
-
*
|
|
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
|
|
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
|
|
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
|
|
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
|
|
93
|
-
return bundle.gates.map((value) => gateValue(value, `gate
|
|
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
|
-
/**
|
|
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
|
|
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
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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]);
|