@sudoke/kernel 0.3.0 → 0.4.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.
- package/README.md +221 -0
- package/package.json +4 -3
- package/src/canonical.ts +18 -0
- package/src/catalog.ts +282 -0
- package/src/contract-shape.ts +531 -0
- package/src/execution-core.ts +115 -0
- package/src/gate-audit.ts +131 -0
- package/src/gate-results.ts +93 -0
- package/src/gate.ts +333 -386
- package/src/idempotency.ts +133 -0
- package/src/index.ts +7 -1
- package/src/mcp.ts +183 -29
- package/src/permissions.ts +92 -0
- package/src/projections.ts +16 -2
- package/src/protocol.ts +7 -1
- package/src/queries.ts +5 -0
- package/src/registry.ts +130 -6
- package/src/releases.ts +527 -0
- package/src/state.ts +33 -1
- package/src/storage.ts +44 -2
- package/src/types.ts +195 -0
- package/src/undo.ts +671 -0
- package/src/visibility.ts +7 -2
package/src/visibility.ts
CHANGED
|
@@ -46,18 +46,23 @@ export type CommandAccess = { visible: false } | { visible: true; restriction?:
|
|
|
46
46
|
|
|
47
47
|
/** Whether (and under what restriction) an identity may be told about a command. Pure — no input,
|
|
48
48
|
* no targetOf, no policy call: a delegation with only target-restricted entries is announced as
|
|
49
|
-
* restricted rather than proven per-target (proving needs an input; the gate re-checks at execution)
|
|
49
|
+
* restricted rather than proven per-target (proving needs an input; the gate re-checks at execution).
|
|
50
|
+
* A scope:'none' command with only target-restricted entries is NOT announced — the gate extracts
|
|
51
|
+
* no target from it (no targetOf), so the delegation check can never pass. The catalog never
|
|
52
|
+
* promises what the gate will refuse. */
|
|
50
53
|
export function commandAccessOf(def: CommandDefinition<any>, identity: Identity | null): CommandAccess {
|
|
51
54
|
if (!identity) return { visible: false }
|
|
52
55
|
if (!roleAllowsCommand(def, identity.role)) return { visible: false }
|
|
53
56
|
if (identity.delegation) {
|
|
54
57
|
const entries = delegationScopeEntries(identity.delegation.scopes, def.name)
|
|
55
58
|
if (entries.length === 0) return { visible: false }
|
|
56
|
-
if (!entries.some((sc) => !sc.includes(':')))
|
|
59
|
+
if (!entries.some((sc) => !sc.includes(':'))) {
|
|
60
|
+
if (def.scope === 'none') return { visible: false }
|
|
57
61
|
return {
|
|
58
62
|
visible: true,
|
|
59
63
|
restriction: { type: 'delegation-targets', targets: entries.map((sc) => sc.slice(sc.indexOf(':') + 1)) },
|
|
60
64
|
}
|
|
65
|
+
}
|
|
61
66
|
}
|
|
62
67
|
return def.scope !== 'none' ? { visible: true, restriction: { type: 'target-policy' } } : { visible: true }
|
|
63
68
|
}
|