@astrosheep/keiyaku 4.6.7 → 4.6.9
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 +46 -16
- package/build/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/build/plugins/claude/skills/keiyaku/SKILL.md +5 -6
- package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +1 -1
- package/build/plugins/claude/skills/keiyaku-akuma/references/automation.md +8 -8
- package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +9 -9
- package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +91 -0
- package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +2 -2
- package/build/plugins/codex/.codex-plugin/plugin.json +1 -1
- package/build/plugins/codex/skills/keiyaku/SKILL.md +5 -6
- package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +1 -1
- package/build/plugins/codex/skills/keiyaku-akuma/references/automation.md +8 -8
- package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +9 -9
- package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +91 -0
- package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +2 -2
- package/build/plugins/opencode/index.js +1 -1
- package/build/plugins/opencode/skills/keiyaku/SKILL.md +5 -6
- package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +1 -1
- package/build/plugins/opencode/skills/keiyaku-akuma/references/automation.md +8 -8
- package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +9 -9
- package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +91 -0
- package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +2 -2
- package/build/plugins/pi/keiyaku.ts +0 -5
- package/build/skills/keiyaku/SKILL.md +5 -6
- package/build/skills/keiyaku-akuma/SKILL.md +1 -1
- package/build/skills/keiyaku-akuma/references/automation.md +8 -8
- package/build/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/skills/keiyaku-bind/SKILL.md +9 -9
- package/build/skills/keiyaku-debt/SKILL.md +91 -0
- package/build/skills/keiyaku-workflow/SKILL.md +2 -2
- package/build/src/akuma/akuma-call.d.ts +2 -0
- package/build/src/akuma/akuma-call.js +8 -2
- package/build/src/akuma/akuma-instance.d.ts +14 -1
- package/build/src/akuma/akuma-instance.js +37 -7
- package/build/src/akuma/akuma-observe.d.ts +33 -8
- package/build/src/akuma/akuma-observe.js +89 -63
- package/build/src/akuma/akuma-owner.d.ts +14 -2
- package/build/src/akuma/akuma-owner.js +49 -35
- package/build/src/akuma/akuma-selection-execution.js +9 -1
- package/build/src/akuma/akuma-stream.d.ts +22 -0
- package/build/src/akuma/akuma-stream.js +116 -0
- package/build/src/akuma/akuma-wait.d.ts +1 -40
- package/build/src/akuma/akuma-wait.js +23 -84
- package/build/src/akuma/akuma.d.ts +52 -16
- package/build/src/akuma/akuma.js +10 -10
- package/build/src/akuma/allowed.d.ts +7 -12
- package/build/src/akuma/allowed.js +13 -4
- package/build/src/akuma/archetype.d.ts +7 -15
- package/build/src/akuma/archetype.js +36 -35
- package/build/src/akuma/body-supervisor.d.ts +5 -5
- package/build/src/akuma/body-supervisor.js +22 -20
- package/build/src/akuma/body.d.ts +5 -3
- package/build/src/akuma/body.js +57 -8
- package/build/src/akuma/call-request.d.ts +30 -32
- package/build/src/akuma/call-request.js +10 -3
- package/build/src/akuma/caller.d.ts +39 -0
- package/build/src/akuma/caller.js +36 -0
- package/build/src/akuma/dispatch-association.d.ts +0 -1
- package/build/src/akuma/dispatch-association.js +0 -3
- package/build/src/akuma/heart/activity-schema.d.ts +12 -0
- package/build/src/akuma/heart/activity-schema.js +6 -0
- package/build/src/akuma/heart/facts.d.ts +16 -12
- package/build/src/akuma/heart/facts.js +8 -0
- package/build/src/akuma/heart/index.d.ts +61 -9
- package/build/src/akuma/heart/index.js +89 -24
- package/build/src/akuma/heart/rows.d.ts +3 -3
- package/build/src/akuma/heart/rows.js +5 -3
- package/build/src/akuma/heart/soul.d.ts +10 -1
- package/build/src/akuma/heart/soul.js +34 -24
- package/build/src/akuma/heart/storage.d.ts +20 -0
- package/build/src/akuma/heart/storage.js +62 -3
- package/build/src/akuma/heart/timeline.d.ts +7 -0
- package/build/src/akuma/heart/timeline.js +10 -0
- package/build/src/akuma/identity.d.ts +0 -1
- package/build/src/akuma/identity.js +2 -5
- package/build/src/akuma/index.d.ts +6 -2
- package/build/src/akuma/index.js +1 -0
- package/build/src/akuma/nuke.js +6 -28
- package/build/src/akuma/projection.d.ts +25 -11
- package/build/src/akuma/projection.js +24 -7
- package/build/src/akuma/provider-recipe.d.ts +18 -6
- package/build/src/akuma/provider-recipe.js +24 -1
- package/build/src/akuma/provider.d.ts +31 -10
- package/build/src/akuma/provider.js +105 -14
- package/build/src/akuma/providers/acp/events.js +29 -19
- package/build/src/akuma/providers/acp/index.js +2 -3
- package/build/src/akuma/providers/claude/events.js +110 -69
- package/build/src/akuma/providers/claude/index.d.ts +2 -2
- package/build/src/akuma/providers/claude/index.js +4 -8
- package/build/src/akuma/providers/codex-app-server/events.js +17 -2
- package/build/src/akuma/providers/codex-app-server/index.js +17 -11
- package/build/src/akuma/providers/decode.d.ts +33 -0
- package/build/src/akuma/providers/decode.js +65 -0
- package/build/src/akuma/providers/execution-environment.d.ts +2 -1
- package/build/src/akuma/providers/execution-environment.js +3 -0
- package/build/src/akuma/providers/grok-build/index.js +16 -48
- package/build/src/akuma/providers/index.js +2 -0
- package/build/src/akuma/providers/lifecycle.d.ts +9 -0
- package/build/src/akuma/providers/lifecycle.js +10 -0
- package/build/src/akuma/providers/opencode-sdk/event-stream.d.ts +3 -3
- package/build/src/akuma/providers/opencode-sdk/event-stream.js +2 -25
- package/build/src/akuma/providers/opencode-sdk/events.d.ts +7 -43
- package/build/src/akuma/providers/opencode-sdk/events.js +146 -296
- package/build/src/akuma/providers/opencode-sdk/index.js +270 -431
- package/build/src/akuma/providers/opencode-sdk/native-http.d.ts +9 -0
- package/build/src/akuma/providers/opencode-sdk/native-http.js +69 -0
- package/build/src/akuma/providers/opencode-sdk/session.d.ts +42 -36
- package/build/src/akuma/providers/opencode-sdk/session.js +75 -84
- package/build/src/akuma/providers/paseo/events.d.ts +33 -0
- package/build/src/akuma/providers/paseo/events.js +204 -0
- package/build/src/akuma/providers/paseo/index.d.ts +9 -0
- package/build/src/akuma/providers/paseo/index.js +357 -0
- package/build/src/akuma/providers/pi/events.d.ts +2 -0
- package/build/src/akuma/providers/pi/events.js +36 -38
- package/build/src/akuma/providers/pi/index.js +21 -35
- package/build/src/akuma/publication.d.ts +2 -0
- package/build/src/akuma/publication.js +5 -0
- package/build/src/akuma/request-lifecycle.d.ts +4 -2
- package/build/src/akuma/request-lifecycle.js +27 -12
- package/build/src/akuma/request-rendezvous.js +38 -55
- package/build/src/akuma/request-serve.d.ts +1 -1
- package/build/src/akuma/request-serve.js +77 -113
- package/build/src/akuma/requests.d.ts +3 -1
- package/build/src/akuma/requests.js +32 -0
- package/build/src/akuma/selection-observation.d.ts +129 -53
- package/build/src/akuma/selection-observation.js +3 -9
- package/build/src/akuma/turn-drive.d.ts +3 -0
- package/build/src/akuma/turn-drive.js +28 -10
- package/build/src/akuma-body.js +12 -22
- package/build/src/cli/akuma-caller.d.ts +3 -0
- package/build/src/cli/akuma-caller.js +31 -0
- package/build/src/cli/commands/akuma-grammar.js +10 -16
- package/build/src/cli/commands/akuma.js +25 -55
- package/build/src/cli/commands/contract-grammar.d.ts +9 -7
- package/build/src/cli/commands/contract-grammar.js +40 -47
- package/build/src/cli/commands/contract-help.d.ts +17 -7
- package/build/src/cli/commands/contract-help.js +50 -11
- package/build/src/cli/commands/contract.js +34 -63
- package/build/src/cli/commands/debt-grammar.d.ts +19 -0
- package/build/src/cli/commands/debt-grammar.js +323 -0
- package/build/src/cli/commands/debt-query.d.ts +5 -0
- package/build/src/cli/commands/{task-query.js → debt-query.js} +9 -9
- package/build/src/cli/commands/{task.d.ts → debt.d.ts} +2 -2
- package/build/src/cli/commands/{task.js → debt.js} +87 -164
- package/build/src/cli/coordinates.d.ts +1 -1
- package/build/src/cli/coordinates.js +1 -1
- package/build/src/cli/parse.d.ts +5 -5
- package/build/src/cli/parse.js +17 -16
- package/build/src/cli/render/akuma-activity.d.ts +11 -83
- package/build/src/cli/render/akuma-activity.js +20 -382
- package/build/src/cli/render/catalog.d.ts +4 -7
- package/build/src/cli/render/catalog.js +5 -5
- package/build/src/cli/render/contract-history.js +3 -6
- package/build/src/cli/render/contract.js +17 -52
- package/build/src/cli/render/debt.d.ts +28 -0
- package/build/src/cli/render/{task.js → debt.js} +55 -133
- package/build/src/cli/render/kanshi.js +28 -28
- package/build/src/cli/render/marks.d.ts +5 -5
- package/build/src/cli/render/marks.js +4 -10
- package/build/src/cli/render/nuke.js +1 -1
- package/build/src/cli/render/receipt.js +3 -10
- package/build/src/cli/runtime.d.ts +1 -1
- package/build/src/cli/runtime.js +14 -20
- package/build/src/cli/scan.d.ts +1 -1
- package/build/src/cli/selectors.d.ts +3 -6
- package/build/src/cli/selectors.js +22 -53
- package/build/src/cli/usage.d.ts +1 -1
- package/build/src/cli/usage.js +4 -4
- package/build/src/contract-worktree.js +3 -3
- package/build/src/debt/board.d.ts +160 -0
- package/build/src/{task → debt}/board.js +89 -89
- package/build/src/debt/catalog.d.ts +11 -0
- package/build/src/debt/catalog.js +59 -0
- package/build/src/{task → debt}/context.d.ts +1 -1
- package/build/src/{task → debt}/context.js +1 -1
- package/build/src/{task → debt}/created-observation.d.ts +6 -10
- package/build/src/{task → debt}/created-observation.js +7 -7
- package/build/src/debt/document.d.ts +37 -0
- package/build/src/{task → debt}/document.js +37 -37
- package/build/src/debt/identity.d.ts +21 -0
- package/build/src/{task → debt}/identity.js +35 -35
- package/build/src/debt/index.d.ts +111 -0
- package/build/src/debt/index.js +203 -0
- package/build/src/{task → debt}/input.d.ts +8 -8
- package/build/src/{task → debt}/input.js +21 -21
- package/build/src/debt/lifecycle-operations.d.ts +6 -0
- package/build/src/{task → debt}/lifecycle-operations.js +27 -31
- package/build/src/debt/mutation-result.d.ts +981 -0
- package/build/src/debt/mutation-result.js +109 -0
- package/build/src/debt/mutation.d.ts +424 -0
- package/build/src/debt/mutation.js +223 -0
- package/build/src/debt/operation-types.d.ts +71 -0
- package/build/src/debt/operations.d.ts +28 -0
- package/build/src/{task → debt}/operations.js +59 -60
- package/build/src/debt/query.d.ts +76 -0
- package/build/src/{task → debt}/query.js +55 -55
- package/build/src/{task → debt}/store.d.ts +13 -13
- package/build/src/{task → debt}/store.js +58 -49
- package/build/src/debt/view.d.ts +4 -0
- package/build/src/debt/view.js +7 -0
- package/build/src/dispatch/index.d.ts +3 -3
- package/build/src/dispatch/index.js +1 -2
- package/build/src/git/observe.d.ts +6 -2
- package/build/src/git/observe.js +6 -2
- package/build/src/identity/coordinates.d.ts +1 -1
- package/build/src/index.d.ts +17 -17
- package/build/src/index.js +11 -11
- package/build/src/kanshi/index.d.ts +2 -2
- package/build/src/kanshi/read.js +54 -39
- package/build/src/kanshi/report.d.ts +7 -7
- package/build/src/kanshi/select.js +4 -4
- package/build/src/library/address.js +2 -4
- package/build/src/library/akuma-creation.d.ts +5 -1
- package/build/src/library/akuma-creation.js +27 -47
- package/build/src/library/akumas.d.ts +7 -7
- package/build/src/library/akumas.js +13 -9
- package/build/src/library/bind.d.ts +17 -17
- package/build/src/library/bind.js +16 -12
- package/build/src/library/contract-address.d.ts +9 -0
- package/build/src/library/contract-address.js +71 -0
- package/build/src/library/contract-composition.d.ts +4 -7
- package/build/src/library/contract-composition.js +6 -18
- package/build/src/library/contract-creation.d.ts +3 -5
- package/build/src/library/contract-creation.js +24 -22
- package/build/src/library/contract-execution.js +21 -26
- package/build/src/library/contract-outcomes.d.ts +2 -14
- package/build/src/library/contract-outcomes.js +2 -13
- package/build/src/library/contract-types.d.ts +38 -4
- package/build/src/library/delivery.d.ts +0 -2
- package/build/src/library/delivery.js +2 -5
- package/build/src/library/input.d.ts +2 -2
- package/build/src/library/input.js +5 -5
- package/build/src/library/invocation.js +2 -2
- package/build/src/library/keiyaku.d.ts +0 -5
- package/build/src/library/keiyaku.js +6 -12
- package/build/src/library/nuke.js +3 -3
- package/build/src/library/outcome.d.ts +626 -625
- package/build/src/library/outcome.js +13 -3
- package/build/src/library/reconcile.js +8 -16
- package/build/src/library/refusal.d.ts +2 -2
- package/build/src/library/repo.d.ts +3 -2
- package/build/src/library/repo.js +10 -5
- package/build/src/library/selection.d.ts +5 -8
- package/build/src/library/selection.js +22 -73
- package/build/src/plugin/akuma-signals.d.ts +2 -0
- package/build/src/plugin/akuma-signals.js +4 -0
- package/build/src/plugin/public.d.ts +32 -2
- package/build/src/plugin/runtime.js +5 -3
- package/build/src/protocol/amend.js +3 -2
- package/build/src/protocol/attempt.js +3 -8
- package/build/src/protocol/bind.d.ts +2 -2
- package/build/src/protocol/bind.js +1 -1
- package/build/src/protocol/deliver.js +3 -3
- package/build/src/protocol/operations.d.ts +1 -3
- package/build/src/protocol/operations.js +0 -8
- package/build/src/protocol/outcome.d.ts +1 -2
- package/build/src/protocol/outcome.js +1 -13
- package/build/src/protocol/placement.js +3 -10
- package/build/src/protocol/read/status.js +31 -70
- package/build/src/protocol/reintegrate.js +3 -10
- package/build/src/protocol/review.js +3 -3
- package/build/src/protocol/run.d.ts +5 -1
- package/build/src/protocol/run.js +3 -3
- package/build/src/runtime/proc/windows-launch.exe +0 -0
- package/build/src/settlement/fence.d.ts +3 -3
- package/build/src/settlement/fence.js +4 -4
- package/build/src/settlement/holder.d.ts +16 -16
- package/build/src/settlement/holder.js +69 -63
- package/build/src/settlement/settle.d.ts +5 -5
- package/build/src/settlement/settle.js +53 -53
- package/package.json +19 -9
- package/plugins/paseo/plugin/index.server.ts +17 -0
- package/plugins/paseo/plugin/paseo-plugin.json +4 -0
- package/plugins/paseo/plugin/server/attach.ts +52 -0
- package/plugins/paseo/plugin/server/keiyaku.ts +44 -0
- package/plugins/paseo/plugin/server/message.ts +60 -0
- package/plugins/paseo/plugin/server/mirror.ts +193 -0
- package/plugins/paseo/plugin/server/model.ts +14 -0
- package/plugins/paseo/plugin/server/provider.ts +276 -0
- package/plugins/paseo/plugin/server/sdk-worker.ts +237 -0
- package/plugins/paseo/plugin/server/sdk.ts +289 -0
- package/plugins/paseo/plugin/server/stop.ts +26 -0
- package/plugins/paseo/plugin/server/transport.ts +35 -0
- package/plugins/paseo/plugin/shared/attach-rpc.ts +10 -0
- package/plugins/paseo/plugin/shared/refresh-rpc.ts +6 -0
- package/plugins/paseo/plugin/tsconfig.json +6 -0
- package/plugins/pi/keiyaku.ts +57 -0
- package/skills/keiyaku/SKILL.md +43 -0
- package/skills/keiyaku-akuma/SKILL.md +130 -0
- package/skills/keiyaku-akuma/references/automation.md +269 -0
- package/skills/keiyaku-babysit/SKILL.md +65 -0
- package/skills/keiyaku-bind/SKILL.md +216 -0
- package/skills/keiyaku-bind/agents/openai.yaml +4 -0
- package/skills/keiyaku-debt/SKILL.md +91 -0
- package/skills/keiyaku-workflow/SKILL.md +129 -0
- package/build/plugins/claude/skills/keiyaku-task/SKILL.md +0 -104
- package/build/plugins/codex/skills/keiyaku-task/SKILL.md +0 -104
- package/build/plugins/opencode/skills/keiyaku-task/SKILL.md +0 -104
- package/build/skills/keiyaku-task/SKILL.md +0 -104
- package/build/src/cli/commands/amend.d.ts +0 -12
- package/build/src/cli/commands/amend.js +0 -10
- package/build/src/cli/commands/bind.d.ts +0 -11
- package/build/src/cli/commands/bind.js +0 -23
- package/build/src/cli/commands/task-grammar.d.ts +0 -19
- package/build/src/cli/commands/task-grammar.js +0 -384
- package/build/src/cli/commands/task-query.d.ts +0 -5
- package/build/src/cli/render/task.d.ts +0 -41
- package/build/src/dispatch/association.d.ts +0 -1
- package/build/src/dispatch/association.js +0 -1
- package/build/src/task/board.d.ts +0 -168
- package/build/src/task/catalog.d.ts +0 -11
- package/build/src/task/catalog.js +0 -59
- package/build/src/task/compose-language.d.ts +0 -57
- package/build/src/task/compose-language.js +0 -364
- package/build/src/task/compose-parser.d.ts +0 -32
- package/build/src/task/compose-parser.js +0 -180
- package/build/src/task/compose.d.ts +0 -16
- package/build/src/task/compose.js +0 -189
- package/build/src/task/document.d.ts +0 -39
- package/build/src/task/identity.d.ts +0 -21
- package/build/src/task/index.d.ts +0 -138
- package/build/src/task/index.js +0 -269
- package/build/src/task/lifecycle-operations.d.ts +0 -6
- package/build/src/task/mutation-result.d.ts +0 -1726
- package/build/src/task/mutation-result.js +0 -198
- package/build/src/task/mutation.d.ts +0 -590
- package/build/src/task/mutation.js +0 -262
- package/build/src/task/operation-types.d.ts +0 -71
- package/build/src/task/operations.d.ts +0 -28
- package/build/src/task/query.d.ts +0 -76
- package/build/src/task/view.d.ts +0 -4
- package/build/src/task/view.js +0 -7
- /package/build/src/{task → debt}/operation-types.js +0 -0
|
@@ -49,8 +49,12 @@ export type BindTargetSelection = Readonly<{
|
|
|
49
49
|
export declare function normalizeTargetBranch(repository: GitRepository, input: string): Promise<string | null>;
|
|
50
50
|
/** Read one worktree's attached branch, or null for detached HEAD. */
|
|
51
51
|
export declare function currentBranch(repository: GitRepository, path?: string): Promise<string | null>;
|
|
52
|
-
/**
|
|
53
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Observe bind's tender start and optional reward target without creating persistent state.
|
|
54
|
+
* `current-branch` reads the observed worktree coordinate's own attached branch; the caller names
|
|
55
|
+
* which coordinate it wants observed.
|
|
56
|
+
*/
|
|
57
|
+
export declare function observeBindCoordinates(repository: GitRepository, selection: BindTargetSelection): Promise<BindCoordinatesObservation | UnbornHeadObservation | null>;
|
|
54
58
|
export declare function observeActiveContractWorld(observation: GitReadObservation): Promise<ActiveContractWorldObservation>;
|
|
55
59
|
export declare function observeContractWorld(observation: GitReadObservation, requested?: readonly ContractId[]): Promise<ContractWorldObservation>;
|
|
56
60
|
export declare function observeContractsForAdmissionAt(repository: GitRepository, channel: GitDecodeChannel, ids: readonly ContractId[], selection?: GitTreeSelection): Promise<GitDecisionObservation>;
|
package/build/src/git/observe.js
CHANGED
|
@@ -77,8 +77,12 @@ async function observeHeadCoordinates(repository) {
|
|
|
77
77
|
throw error;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
/**
|
|
81
|
-
|
|
80
|
+
/**
|
|
81
|
+
* Observe bind's tender start and optional reward target without creating persistent state.
|
|
82
|
+
* `current-branch` reads the observed worktree coordinate's own attached branch; the caller names
|
|
83
|
+
* which coordinate it wants observed.
|
|
84
|
+
*/
|
|
85
|
+
export async function observeBindCoordinates(repository, selection) {
|
|
82
86
|
if (selection.kind === "explicit") {
|
|
83
87
|
const requestedTarget = selection.target;
|
|
84
88
|
if (isKeiyakuOwnedRef(requestedTarget)) {
|
package/build/src/index.d.ts
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The package root: the curated Contract, Akuma, Akumas,
|
|
2
|
+
* The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
|
|
3
3
|
* Settings, and Plugin surfaces. Internal composition, execution, and
|
|
4
4
|
* configuration helpers stay off this entry; only CLI and Body import them.
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
|
-
* The package root: the curated Contract, Akuma, Akumas,
|
|
7
|
+
* The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
|
|
8
8
|
* Settings, and Plugin surfaces. Internal composition, execution, and
|
|
9
9
|
* configuration helpers stay off this entry; only CLI and Body import them.
|
|
10
10
|
*/
|
|
11
11
|
export { AuthorityCorruptionError } from "./core/facts/errors.js";
|
|
12
12
|
/**
|
|
13
|
-
* The package root: the curated Contract, Akuma, Akumas,
|
|
13
|
+
* The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
|
|
14
14
|
* Settings, and Plugin surfaces. Internal composition, execution, and
|
|
15
15
|
* configuration helpers stay off this entry; only CLI and Body import them.
|
|
16
16
|
*/
|
|
17
17
|
export { Delivery } from "./library/delivery.js";
|
|
18
18
|
/**
|
|
19
|
-
* The package root: the curated Contract, Akuma, Akumas,
|
|
19
|
+
* The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
|
|
20
20
|
* Settings, and Plugin surfaces. Internal composition, execution, and
|
|
21
21
|
* configuration helpers stay off this entry; only CLI and Body import them.
|
|
22
22
|
*/
|
|
23
23
|
export { Keiyaku } from "./library/keiyaku.js";
|
|
24
24
|
/**
|
|
25
|
-
* The package root: the curated Contract, Akuma, Akumas,
|
|
25
|
+
* The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
|
|
26
26
|
* Settings, and Plugin surfaces. Internal composition, execution, and
|
|
27
27
|
* configuration helpers stay off this entry; only CLI and Body import them.
|
|
28
28
|
*/
|
|
29
29
|
export { KeiyakuError } from "./library/outcome.js";
|
|
30
30
|
/**
|
|
31
|
-
* The package root: the curated Contract, Akuma, Akumas,
|
|
31
|
+
* The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
|
|
32
32
|
* Settings, and Plugin surfaces. Internal composition, execution, and
|
|
33
33
|
* configuration helpers stay off this entry; only CLI and Body import them.
|
|
34
34
|
*/
|
|
35
35
|
export { NoGitWorldError, Repo } from "./library/repo.js";
|
|
36
36
|
/**
|
|
37
|
-
* The package root: the curated Contract, Akuma, Akumas,
|
|
37
|
+
* The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
|
|
38
38
|
* Settings, and Plugin surfaces. Internal composition, execution, and
|
|
39
39
|
* configuration helpers stay off this entry; only CLI and Body import them.
|
|
40
40
|
*/
|
|
41
41
|
export { actorId } from "./core/facts/types.js";
|
|
42
42
|
/**
|
|
43
|
-
* The package root: the curated Contract, Akuma, Akumas,
|
|
43
|
+
* The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
|
|
44
44
|
* Settings, and Plugin surfaces. Internal composition, execution, and
|
|
45
45
|
* configuration helpers stay off this entry; only CLI and Body import them.
|
|
46
46
|
*/
|
|
47
47
|
export { z } from "zod";
|
|
48
|
-
export { ALLOWED_ACTIONS, Akuma, AkumaBusyError, AkumaDecodeError, AkumaNotBornError, AkumaProviderError, Schema, } from "./akuma/index.js";
|
|
49
|
-
export type { ActivityHistory, ActivityRow, AkuId, AkumaAskObservation, AkumaAskOptions, AkumaAskResult, AkumaBirthInput, AkumaHistoryOptions, AkumaIdleOptions, AkumaIdleResult, AkumaSignalOptions, AkumaStatus, AkumaTellOptions, AkumaTellResult, AllowedAction, AllowedActions, InterruptReceipt, JsonSchema, JsonSchemaDocument, KillEvidence, SchemaLike, StandardSchemaV1, } from "./akuma/index.js";
|
|
48
|
+
export { ALLOWED_ACTIONS, Akuma, AkumaArchetypeError, AkumaBusyError, AkumaDecodeError, AkumaNotBornError, AkumaProviderError, Schema, listArchetypeDefinitions, } from "./akuma/index.js";
|
|
49
|
+
export type { AkumaCaller, AkumaOrigin, ActivityHistory, ActivityRow, AkuId, AkumaAskObservation, AkumaAskOptions, AkumaAskResult, AkumaBirthInput, AkumaHistoryOptions, AkumaHostOptions, AkumaIdleOptions, AkumaIdleResult, AkumaSignalOptions, AkumaStatus, AkumaStreamSnapshot, AkumaTellOptions, AkumaTellResult, AllowedAction, AllowedActions, ArchetypeCatalog, ArchetypeCatalogInput, ArchetypeCatalogRow, InterruptReceipt, JsonSchema, JsonSchemaDocument, KillEvidence, SchemaLike, StandardSchemaV1, } from "./akuma/index.js";
|
|
50
50
|
export type { ActorId, ChangeId, ContractHead, ContractId, ContractState, JournalEntry as Fact, FactKind, SnapshotId, } from "./core/facts/types.js";
|
|
51
|
-
export { kanshi, observeKanshi, selectKanshi, selectRegion } from "./kanshi/index.js";
|
|
52
|
-
export type { AkumaKanshiRow, AkumaKanshiWorld, ContractEndpointObservation, ContractHolderObservation, ContractKanshiBoard, ContractKanshiRow, KanshiInput, KanshiRegionSelection, KanshiReport, KanshiSelection, RegionDeclaration, RegionRead, Section,
|
|
51
|
+
export { kanshi, kanshiCategory, observeKanshi, selectKanshi, selectRegion } from "./kanshi/index.js";
|
|
52
|
+
export type { AkumaKanshiRow, AkumaKanshiWorld, ContractEndpointObservation, ContractHolderObservation, ContractKanshiBoard, ContractKanshiRow, KanshiCategoryInput, KanshiCategoryReport, KanshiInput, KanshiRegionSelection, KanshiReport, KanshiSelection, RegionDeclaration, RegionRead, Section, DebtKanshiRow, DebtKanshiWorld, } from "./kanshi/index.js";
|
|
53
53
|
export { AkumaAddressError, AkumaWorldScopeError, Akumas } from "./library/akumas.js";
|
|
54
|
-
export type { AkumaAddressInput, AkumaAskInput, AkumaHistoryInput, AkumaHistoryResult, AkumaKillInput, AkumaKillResult, AkumaList, AkumaListInput, AkumaObservation, AkumaObservationStage, AkumaTellInput, AkumaWaitInput, AkumaWaitResult, AkumaWorldScopeRefusal, CallInput, CallResult, CallWaitHead,
|
|
54
|
+
export type { AkumaAddressInput, AkumaAskInput, AkumaHistoryInput, AkumaHistoryResult, AkumaKillInput, AkumaKillResult, AkumaList, AkumaListInput, AkumaObservation, AkumaObservationStage, AkumaTellInput, AkumaWaitInput, AkumaWaitResult, AkumaWorldScopeRefusal, CallInput, CallResult, CallWaitHead, CreatedDebtObservation, DispatchAssociation, DispatchStage, ForkInput, ForkResult, TellResult, TellWake, } from "./library/akumas.js";
|
|
55
55
|
export type { ContinuationReport } from "./library/continuation.js";
|
|
56
56
|
export type { KeiyakuLibrary, ReconcileInput } from "./library/contract-composition.js";
|
|
57
57
|
export type { AbandonOutcome, AmendOutcome, ArcOutcome, AuditOutcome, BindOutcome, BindResult, DeliverOutcome, ReviewOutcome, } from "./library/contract-outcomes.js";
|
|
58
|
-
export type { AbandonInput, AmendInput, ArcInput, BindInput, ContractHistory, ContractHistoryEvent, ContractList, ContractListInput, ContractObservationInput, DeliverInput, KeiyakuSelectInput, LocalContractComposition, ReviewInput, } from "./library/contract-types.js";
|
|
58
|
+
export type { AbandonInput, AmendInput, ArcInput, BindInput, ContractHistory, ContractHistoryEvent, ContractList, ContractListInput, ContractObservationInput, ContractResolveInput, ContractResolution, ContractSelectorRefusal, DeliverInput, KeiyakuSelectInput, LocalContractComposition, ReviewInput, } from "./library/contract-types.js";
|
|
59
59
|
export { nukeKeiyaku as nuke } from "./library/nuke.js";
|
|
60
60
|
export type { NukeInput, NukeResult } from "./library/nuke.js";
|
|
61
61
|
export type { InvocationEffect, KeiyakuErrorCategory, PartialOutcomeEnvelope, PendingSurface, ReconciliationLag, Review, } from "./library/outcome.js";
|
|
@@ -63,7 +63,7 @@ export type { ReconcileCompletion, RepoContractReconcileReport, RepoReconcileRep
|
|
|
63
63
|
export type { KeiyakuRefusal, KeiyakuRetryReason, NukeConfirmationRefusal, NukeConfirmationRequiredRefusal, OperationRetries, } from "./library/refusal.js";
|
|
64
64
|
export type { RegionOverlap } from "./library/region.js";
|
|
65
65
|
export type { RepoAtInput } from "./library/repo.js";
|
|
66
|
-
export type { KeiyakuPlugin, PluginBodyEnd, PluginContext, PluginHooks, PluginInstance, PluginManifest, PluginOutcome, PluginSignal, PluginSignalMap, } from "./plugin/public.js";
|
|
66
|
+
export type { KeiyakuPlugin, PluginAkumaCaller, PluginAkumaOrigin, PluginBodyEnd, PluginContext, PluginHooks, PluginInstance, PluginManifest, PluginOutcome, PluginSignal, PluginSignalMap, } from "./plugin/public.js";
|
|
67
67
|
export type { AuditReport } from "./protocol/audit.js";
|
|
68
68
|
export type { IntegrationConflictMaterialized, VerificationReuse } from "./protocol/deliver.js";
|
|
69
69
|
export type { ExecutionObservation, ExecutionObserver } from "./protocol/execution-observation.js";
|
|
@@ -74,8 +74,8 @@ export { SettingsError, settings } from "./settings.js";
|
|
|
74
74
|
export type { Gate } from "./library/contract-types.js";
|
|
75
75
|
export type { Settings, SettingsEntry, SettingsInput, SettingsNamespaceFailure, SettingsNamespaceView, SettingsScope, SettingsScopeState, } from "./settings.js";
|
|
76
76
|
export type { SettlementAction, SettlementLag, SettlementReport } from "./settlement/settle.js";
|
|
77
|
-
export type * from "./
|
|
78
|
-
export {
|
|
77
|
+
export type * from "./debt/index.js";
|
|
78
|
+
export { DEBT_RELATION_PREDICATE_FIELDS, DebtAuthorityCorruptionError, Debts } from "./debt/index.js";
|
|
79
79
|
export { World, WorldError } from "./world.js";
|
|
80
80
|
export type { WorldResolution, WorldResolutionInput, WorldRoot } from "./world.js";
|
|
81
81
|
export type { ReconcileReport, TopologyEffect } from "./library/reconcile.js";
|
package/build/src/index.js
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The package root: the curated Contract, Akuma, Akumas,
|
|
2
|
+
* The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
|
|
3
3
|
* Settings, and Plugin surfaces. Internal composition, execution, and
|
|
4
4
|
* configuration helpers stay off this entry; only CLI and Body import them.
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
|
-
* The package root: the curated Contract, Akuma, Akumas,
|
|
7
|
+
* The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
|
|
8
8
|
* Settings, and Plugin surfaces. Internal composition, execution, and
|
|
9
9
|
* configuration helpers stay off this entry; only CLI and Body import them.
|
|
10
10
|
*/
|
|
11
11
|
export { AuthorityCorruptionError } from "./core/facts/errors.js";
|
|
12
12
|
/**
|
|
13
|
-
* The package root: the curated Contract, Akuma, Akumas,
|
|
13
|
+
* The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
|
|
14
14
|
* Settings, and Plugin surfaces. Internal composition, execution, and
|
|
15
15
|
* configuration helpers stay off this entry; only CLI and Body import them.
|
|
16
16
|
*/
|
|
17
17
|
export { Delivery } from "./library/delivery.js";
|
|
18
18
|
/**
|
|
19
|
-
* The package root: the curated Contract, Akuma, Akumas,
|
|
19
|
+
* The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
|
|
20
20
|
* Settings, and Plugin surfaces. Internal composition, execution, and
|
|
21
21
|
* configuration helpers stay off this entry; only CLI and Body import them.
|
|
22
22
|
*/
|
|
23
23
|
export { Keiyaku } from "./library/keiyaku.js";
|
|
24
24
|
/**
|
|
25
|
-
* The package root: the curated Contract, Akuma, Akumas,
|
|
25
|
+
* The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
|
|
26
26
|
* Settings, and Plugin surfaces. Internal composition, execution, and
|
|
27
27
|
* configuration helpers stay off this entry; only CLI and Body import them.
|
|
28
28
|
*/
|
|
29
29
|
export { KeiyakuError } from "./library/outcome.js";
|
|
30
30
|
/**
|
|
31
|
-
* The package root: the curated Contract, Akuma, Akumas,
|
|
31
|
+
* The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
|
|
32
32
|
* Settings, and Plugin surfaces. Internal composition, execution, and
|
|
33
33
|
* configuration helpers stay off this entry; only CLI and Body import them.
|
|
34
34
|
*/
|
|
35
35
|
export { NoGitWorldError, Repo } from "./library/repo.js";
|
|
36
36
|
/**
|
|
37
|
-
* The package root: the curated Contract, Akuma, Akumas,
|
|
37
|
+
* The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
|
|
38
38
|
* Settings, and Plugin surfaces. Internal composition, execution, and
|
|
39
39
|
* configuration helpers stay off this entry; only CLI and Body import them.
|
|
40
40
|
*/
|
|
41
41
|
export { actorId } from "./core/facts/types.js";
|
|
42
42
|
/**
|
|
43
|
-
* The package root: the curated Contract, Akuma, Akumas,
|
|
43
|
+
* The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
|
|
44
44
|
* Settings, and Plugin surfaces. Internal composition, execution, and
|
|
45
45
|
* configuration helpers stay off this entry; only CLI and Body import them.
|
|
46
46
|
*/
|
|
47
47
|
export { z } from "zod";
|
|
48
|
-
export { ALLOWED_ACTIONS, Akuma, AkumaBusyError, AkumaDecodeError, AkumaNotBornError, AkumaProviderError, Schema, } from "./akuma/index.js";
|
|
49
|
-
export { kanshi, observeKanshi, selectKanshi, selectRegion } from "./kanshi/index.js";
|
|
48
|
+
export { ALLOWED_ACTIONS, Akuma, AkumaArchetypeError, AkumaBusyError, AkumaDecodeError, AkumaNotBornError, AkumaProviderError, Schema, listArchetypeDefinitions, } from "./akuma/index.js";
|
|
49
|
+
export { kanshi, kanshiCategory, observeKanshi, selectKanshi, selectRegion } from "./kanshi/index.js";
|
|
50
50
|
export { AkumaAddressError, AkumaWorldScopeError, Akumas } from "./library/akumas.js";
|
|
51
51
|
export { nukeKeiyaku as nuke } from "./library/nuke.js";
|
|
52
52
|
export { SettingsError, settings } from "./settings.js";
|
|
53
|
-
export {
|
|
53
|
+
export { DEBT_RELATION_PREDICATE_FIELDS, DebtAuthorityCorruptionError, Debts } from "./debt/index.js";
|
|
54
54
|
export { World, WorldError } from "./world.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { kanshi, kanshiCategory, observeKanshi } from "./read.js";
|
|
2
2
|
export { selectKanshi, selectRegion } from "./select.js";
|
|
3
|
-
export type { KanshiInput } from "./read.js";
|
|
4
|
-
export type { AkumaKanshiRow, AkumaKanshiWorld, ContractEndpointObservation, ContractHolderObservation, ContractKanshiBoard, ContractKanshiRow, KanshiCategoryReport, KanshiReport, Section,
|
|
3
|
+
export type { KanshiCategoryInput, KanshiInput } from "./read.js";
|
|
4
|
+
export type { AkumaKanshiRow, AkumaKanshiWorld, ContractEndpointObservation, ContractHolderObservation, ContractKanshiBoard, ContractKanshiRow, KanshiCategoryReport, KanshiReport, Section, DebtKanshiRow, DebtKanshiWorld, KanshiRegionSelection, RegionDeclaration, RegionOverlap, RegionRead, } from "./report.js";
|
|
5
5
|
export type { KanshiSelection } from "./select.js";
|
package/build/src/kanshi/read.js
CHANGED
|
@@ -10,10 +10,10 @@ import { Repo, scopeForRepo } from "../library/repo.js";
|
|
|
10
10
|
import { readDocuments } from "../protocol/read/documents.js";
|
|
11
11
|
import { observeCurrentPhysicalIssue } from "../protocol/read/observation.js";
|
|
12
12
|
import { readContractBoard, readContractCatalogue, readContractPhase } from "../protocol/read/status.js";
|
|
13
|
-
import {
|
|
14
|
-
import { contractNamespace } from "../
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
13
|
+
import { readDebtHolderProjectionAt } from "../settlement/holder.js";
|
|
14
|
+
import { contractNamespace } from "../debt/identity.js";
|
|
15
|
+
import { observeRecentDebtStatus, DebtAuthorityCorruptionError } from "../debt/index.js";
|
|
16
|
+
import { observeDebtBoard } from "../debt/operations.js";
|
|
17
17
|
import { ROSTER_SNAPSHOT_ROWS, ROSTER_VISIBLE_ROWS } from "./roster.js";
|
|
18
18
|
import { selectKanshi, selectRegion } from "./select.js";
|
|
19
19
|
const WORLD_CONTRACT_ROWS = 10;
|
|
@@ -89,6 +89,12 @@ function regionSelection(value) {
|
|
|
89
89
|
}
|
|
90
90
|
throw new TypeError(`kanshi region selection kind is invalid: ${selection.kind}`);
|
|
91
91
|
}
|
|
92
|
+
function worldCoordinate(world, repo) {
|
|
93
|
+
if (world !== null && (typeof world !== "string" || world.trim().length === 0))
|
|
94
|
+
throw new TypeError("kanshi world must be a WorldRoot or null");
|
|
95
|
+
if (repo !== undefined && !(repo instanceof Repo))
|
|
96
|
+
throw new TypeError("kanshi repo must be a Repo");
|
|
97
|
+
}
|
|
92
98
|
function coordinate(input) {
|
|
93
99
|
if (typeof input !== "object" || input === null || Array.isArray(input))
|
|
94
100
|
throw new TypeError("kanshi input must be an object");
|
|
@@ -97,11 +103,7 @@ function coordinate(input) {
|
|
|
97
103
|
throw new TypeError(`kanshi input has unknown field: ${key}`);
|
|
98
104
|
}
|
|
99
105
|
}
|
|
100
|
-
|
|
101
|
-
throw new TypeError("kanshi world must be a WorldRoot or null");
|
|
102
|
-
}
|
|
103
|
-
if (input.repo !== undefined && !(input.repo instanceof Repo))
|
|
104
|
-
throw new TypeError("kanshi repo must be a Repo");
|
|
106
|
+
worldCoordinate(input.world, input.repo);
|
|
105
107
|
return {
|
|
106
108
|
...input,
|
|
107
109
|
...(input.region === undefined ? {} : { region: regionSelection(input.region) }),
|
|
@@ -144,7 +146,7 @@ async function readContracts(observation, include, limit = WORLD_CONTRACT_ROWS)
|
|
|
144
146
|
}
|
|
145
147
|
async function readHolders(observation) {
|
|
146
148
|
try {
|
|
147
|
-
return { kind: "present", value: await
|
|
149
|
+
return { kind: "present", value: await readDebtHolderProjectionAt(observation) };
|
|
148
150
|
}
|
|
149
151
|
catch (error) {
|
|
150
152
|
return { kind: "failed", failure: { message: diagnostic(error) } };
|
|
@@ -171,7 +173,7 @@ function attachRoster(contracts, akuma) {
|
|
|
171
173
|
},
|
|
172
174
|
};
|
|
173
175
|
}
|
|
174
|
-
function decorateContracts(contracts, holders,
|
|
176
|
+
function decorateContracts(contracts, holders, namespaceDebts) {
|
|
175
177
|
if (contracts.kind !== "present")
|
|
176
178
|
return contracts;
|
|
177
179
|
return {
|
|
@@ -179,22 +181,22 @@ function decorateContracts(contracts, holders, namespaceTasks) {
|
|
|
179
181
|
value: {
|
|
180
182
|
...contracts.value,
|
|
181
183
|
rows: contracts.value.rows.map((row) => {
|
|
182
|
-
const selected =
|
|
184
|
+
const selected = namespaceDebts?.(row.id);
|
|
183
185
|
if (holders.kind === "failed") {
|
|
184
186
|
return {
|
|
185
187
|
...row,
|
|
186
188
|
holder: { kind: "unavailable" },
|
|
187
189
|
roster: [],
|
|
188
|
-
...(selected === undefined ? {} : {
|
|
190
|
+
...(selected === undefined ? {} : { namespaceDebts: selected }),
|
|
189
191
|
};
|
|
190
192
|
}
|
|
191
193
|
const holder = holders.kind === "present" ? holders.value.get(row.id) : undefined;
|
|
192
194
|
return {
|
|
193
195
|
...row,
|
|
194
196
|
roster: [],
|
|
195
|
-
...(selected === undefined ? {} : {
|
|
197
|
+
...(selected === undefined ? {} : { namespaceDebts: selected }),
|
|
196
198
|
holder: holder?.disposition === "held"
|
|
197
|
-
? { kind: "held",
|
|
199
|
+
? { kind: "held", debtId: holder.debtId }
|
|
198
200
|
: { kind: "none" },
|
|
199
201
|
};
|
|
200
202
|
}),
|
|
@@ -212,11 +214,11 @@ function contractEndpointObserver(contracts) {
|
|
|
212
214
|
return "hasMore" in contracts.value ? "unavailable" : "missing";
|
|
213
215
|
};
|
|
214
216
|
}
|
|
215
|
-
function
|
|
217
|
+
function joinDebts(rows, holders, observeContract) {
|
|
216
218
|
const associations = new Map(holders.kind === "present"
|
|
217
219
|
? [...holders.value.values()]
|
|
218
220
|
.filter((holder) => holder.disposition === "held")
|
|
219
|
-
.map((holder) => [holder.
|
|
221
|
+
.map((holder) => [holder.debtId, holder.contractId])
|
|
220
222
|
: []);
|
|
221
223
|
return rows.map((row) => {
|
|
222
224
|
const contractId = associations.get(row.id);
|
|
@@ -225,43 +227,43 @@ function joinTasks(rows, holders, observeContract) {
|
|
|
225
227
|
return { ...row, contract: { id: contractId, observed: observeContract(contractId) } };
|
|
226
228
|
});
|
|
227
229
|
}
|
|
228
|
-
/** Attribute a
|
|
229
|
-
function
|
|
230
|
+
/** Attribute a Debt board failure to the malformed document that caused it, when one is known. */
|
|
231
|
+
function debtFailure(error) {
|
|
230
232
|
return {
|
|
231
233
|
message: diagnostic(error),
|
|
232
|
-
...(error instanceof
|
|
234
|
+
...(error instanceof DebtAuthorityCorruptionError && error.coordinate !== undefined
|
|
233
235
|
? { coordinate: error.coordinate }
|
|
234
236
|
: {}),
|
|
235
237
|
};
|
|
236
238
|
}
|
|
237
|
-
async function
|
|
239
|
+
async function readDebtWorld(path) {
|
|
238
240
|
if (path === null)
|
|
239
241
|
return { kind: "absent" };
|
|
240
242
|
try {
|
|
241
|
-
return { kind: "present", observation: await
|
|
243
|
+
return { kind: "present", observation: await observeDebtBoard(path) };
|
|
242
244
|
}
|
|
243
245
|
catch (error) {
|
|
244
|
-
return { kind: "failed", failure:
|
|
246
|
+
return { kind: "failed", failure: debtFailure(error) };
|
|
245
247
|
}
|
|
246
248
|
}
|
|
247
249
|
/**
|
|
248
|
-
* A selected Contract's own
|
|
249
|
-
* board's
|
|
250
|
+
* A selected Contract's own Debt namespace view. A failed Debt board is reported once by the
|
|
251
|
+
* board's Debt section, so the entity block omits it rather than repeating the same row.
|
|
250
252
|
*/
|
|
251
|
-
function
|
|
253
|
+
function namespaceDebtSection(board, id) {
|
|
252
254
|
if (board.kind === "absent")
|
|
253
255
|
return { kind: "absent" };
|
|
254
256
|
if (board.kind === "failed")
|
|
255
257
|
return undefined;
|
|
256
258
|
return { kind: "present", value: board.observation.selectNamespace(contractNamespace(id)) };
|
|
257
259
|
}
|
|
258
|
-
async function
|
|
260
|
+
async function readDebts(path, holders, observeContract) {
|
|
259
261
|
if (holders.kind === "failed")
|
|
260
262
|
return { kind: "failed", failure: holders.failure };
|
|
261
|
-
return
|
|
263
|
+
return observeRecentDebtStatus(path, { limit: 10 }).then((recent) => ({
|
|
262
264
|
kind: "present",
|
|
263
|
-
value: { root: path, hasMore: recent.hasMore, rows:
|
|
264
|
-
}), (error) => ({ kind: "failed", failure:
|
|
265
|
+
value: { root: path, hasMore: recent.hasMore, rows: joinDebts(recent.rows, holders, observeContract) },
|
|
266
|
+
}), (error) => ({ kind: "failed", failure: debtFailure(error) }));
|
|
265
267
|
}
|
|
266
268
|
/**
|
|
267
269
|
* Placement discharge for the observed roster snapshots: an associated Contract
|
|
@@ -355,7 +357,7 @@ async function observeWithoutRepo(world, region, observedAt, branch) {
|
|
|
355
357
|
const contracts = { kind: "absent" };
|
|
356
358
|
const holders = { kind: "absent" };
|
|
357
359
|
const observeContract = contractEndpointObserver(contracts);
|
|
358
|
-
const
|
|
360
|
+
const debts = world === null ? { kind: "absent" } : await readDebts(world, holders, observeContract);
|
|
359
361
|
const aliases = world === null ? { kind: "absent" } : await readAliasBindings(world);
|
|
360
362
|
const akuma = world === null
|
|
361
363
|
? { kind: "absent" }
|
|
@@ -366,7 +368,7 @@ async function observeWithoutRepo(world, region, observedAt, branch) {
|
|
|
366
368
|
observedAt,
|
|
367
369
|
branch,
|
|
368
370
|
contracts,
|
|
369
|
-
|
|
371
|
+
debts,
|
|
370
372
|
akuma,
|
|
371
373
|
...(region === undefined ? {} : { region: { kind: "absent" } }),
|
|
372
374
|
},
|
|
@@ -386,11 +388,11 @@ async function observeRepo(input) {
|
|
|
386
388
|
const selectedContract = contract !== undefined &&
|
|
387
389
|
contractSection.kind === "present" &&
|
|
388
390
|
contractSection.value.rows.some((row) => row.id === contract);
|
|
389
|
-
const board = selectedContract ? await
|
|
390
|
-
const contracts = decorateContracts(contractSection, holders, selectedContract ? (id) => (id === contract ?
|
|
391
|
+
const board = selectedContract ? await readDebtWorld(world) : undefined;
|
|
392
|
+
const contracts = decorateContracts(contractSection, holders, selectedContract ? (id) => (id === contract ? namespaceDebtSection(board, id) : undefined) : undefined);
|
|
391
393
|
const observeContract = contractEndpointObserver(contracts);
|
|
392
394
|
const aliases = world === null ? { kind: "absent" } : await readAliasBindings(world);
|
|
393
|
-
const
|
|
395
|
+
const debts = world === null ? { kind: "absent" } : await readDebts(world, holders, observeContract);
|
|
394
396
|
const claimed = dispatches.kind === "present"
|
|
395
397
|
? await claimedAssociatedContracts(observation, dispatches.value)
|
|
396
398
|
: new Set();
|
|
@@ -404,7 +406,7 @@ async function observeRepo(input) {
|
|
|
404
406
|
observedAt,
|
|
405
407
|
branch,
|
|
406
408
|
contracts: attachRoster(contracts, akuma),
|
|
407
|
-
|
|
409
|
+
debts,
|
|
408
410
|
akuma,
|
|
409
411
|
...(regionSection === undefined ? {} : { region: regionSection }),
|
|
410
412
|
};
|
|
@@ -428,7 +430,7 @@ async function observeRepo(input) {
|
|
|
428
430
|
observedAt,
|
|
429
431
|
branch,
|
|
430
432
|
contracts: failure,
|
|
431
|
-
|
|
433
|
+
debts: world === null ? { kind: "absent" } : failure,
|
|
432
434
|
akuma: world === null ? { kind: "absent" } : failure,
|
|
433
435
|
...(region === undefined ? {} : { region: failure }),
|
|
434
436
|
},
|
|
@@ -447,7 +449,7 @@ export async function observeKanshi(input) {
|
|
|
447
449
|
export async function kanshi(input) {
|
|
448
450
|
return (await observeKanshi(input)).report;
|
|
449
451
|
}
|
|
450
|
-
/** Category observations reuse owner rows without reading the
|
|
452
|
+
/** Category observations reuse owner rows without reading the Debt board. */
|
|
451
453
|
async function observeAkumaCategory(world, repo, limit, observedAt) {
|
|
452
454
|
const report = (akuma) => ({
|
|
453
455
|
category: "akuma",
|
|
@@ -498,9 +500,22 @@ async function observeContractCategory(world, repo, limit, observedAt) {
|
|
|
498
500
|
return report({ kind: "failed", failure: { message: diagnostic(error) } });
|
|
499
501
|
}
|
|
500
502
|
}
|
|
503
|
+
const DEFAULT_CATEGORY_LIMIT = 10;
|
|
504
|
+
/** Caller-invalid category requests are refused here, before any owner observation runs. */
|
|
505
|
+
function validateCategoryInput(input) {
|
|
506
|
+
const value = record(input, "category input");
|
|
507
|
+
exactKeys(value, ["world", "repo", "category", "limit"], "category input");
|
|
508
|
+
worldCoordinate(value.world, value.repo);
|
|
509
|
+
if (value.category !== "akuma" && value.category !== "contract")
|
|
510
|
+
throw new TypeError(`kanshi category is invalid: ${String(value.category)}`);
|
|
511
|
+
const { limit } = value;
|
|
512
|
+
if (limit !== undefined && (typeof limit !== "number" || !Number.isSafeInteger(limit) || limit < 1))
|
|
513
|
+
throw new TypeError("kanshi category limit must be a positive safe integer");
|
|
514
|
+
}
|
|
501
515
|
export async function kanshiCategory(input) {
|
|
502
516
|
const observedAt = new Date().toISOString();
|
|
503
|
-
|
|
517
|
+
validateCategoryInput(input);
|
|
518
|
+
const { world, repo, category, limit = DEFAULT_CATEGORY_LIMIT } = input;
|
|
504
519
|
if (category === "contract") {
|
|
505
520
|
if (repo === undefined)
|
|
506
521
|
throw new TypeError("kanshi contract category requires a Repo");
|
|
@@ -6,7 +6,7 @@ import type { ContractId } from "../index.js";
|
|
|
6
6
|
import type { RegionOverlap } from "../library/region.js";
|
|
7
7
|
import type { CurrentPhysicalIssue } from "../protocol/read/observation.js";
|
|
8
8
|
import type { ContractBoard, ContractDisposition, ContractPhase } from "../protocol/read/status.js";
|
|
9
|
-
import type {
|
|
9
|
+
import type { DebtId, DebtRef, DebtRow } from "../debt/index.js";
|
|
10
10
|
import type { WorldRoot } from "../world.js";
|
|
11
11
|
export type { RegionOverlap };
|
|
12
12
|
export type Section<Value> = Readonly<{
|
|
@@ -24,7 +24,7 @@ export type Section<Value> = Readonly<{
|
|
|
24
24
|
export type ContractEndpointObservation = ContractDisposition | "missing" | "unavailable";
|
|
25
25
|
export type ContractHolderObservation = Readonly<{
|
|
26
26
|
kind: "held";
|
|
27
|
-
|
|
27
|
+
debtId: DebtId;
|
|
28
28
|
}> | Readonly<{
|
|
29
29
|
kind: "none";
|
|
30
30
|
}> | Readonly<{
|
|
@@ -38,21 +38,21 @@ export type ContractKanshiRow = ContractBoard["rows"][number] & Readonly<{
|
|
|
38
38
|
phase: ContractPhase;
|
|
39
39
|
holder: ContractHolderObservation;
|
|
40
40
|
roster: readonly ContractRosterAttachment[];
|
|
41
|
-
|
|
41
|
+
namespaceDebts?: Section<readonly DebtRow[]>;
|
|
42
42
|
issue?: CurrentPhysicalIssue;
|
|
43
43
|
}>;
|
|
44
44
|
export type ContractKanshiBoard = Omit<ContractBoard, "rows"> & Readonly<{
|
|
45
45
|
rows: readonly ContractKanshiRow[];
|
|
46
46
|
hasMore?: boolean;
|
|
47
47
|
}>;
|
|
48
|
-
export type
|
|
48
|
+
export type DebtKanshiRow = DebtRow & Readonly<{
|
|
49
49
|
contract?: Readonly<{
|
|
50
50
|
id: string;
|
|
51
51
|
observed: ContractEndpointObservation;
|
|
52
52
|
}>;
|
|
53
|
-
blockers?: readonly
|
|
53
|
+
blockers?: readonly DebtRef[];
|
|
54
54
|
}>;
|
|
55
|
-
export type
|
|
55
|
+
export type DebtKanshiWorld = BoundedList<DebtKanshiRow> & Readonly<{
|
|
56
56
|
root: WorldRoot;
|
|
57
57
|
}>;
|
|
58
58
|
export type AkumaKanshiRow = (AkumaListRow | UnbornAkumaListRow) & Readonly<{
|
|
@@ -96,7 +96,7 @@ export type KanshiReport = Readonly<{
|
|
|
96
96
|
observedAt: string;
|
|
97
97
|
branch: string | null;
|
|
98
98
|
contracts: Section<ContractKanshiBoard>;
|
|
99
|
-
|
|
99
|
+
debts: Section<DebtKanshiWorld>;
|
|
100
100
|
akuma: Section<AkumaKanshiWorld>;
|
|
101
101
|
region?: Section<RegionRead>;
|
|
102
102
|
}>;
|
|
@@ -29,15 +29,15 @@ export function selectKanshi(input) {
|
|
|
29
29
|
},
|
|
30
30
|
}
|
|
31
31
|
: report.contracts,
|
|
32
|
-
|
|
32
|
+
debts: report.debts.kind === "present"
|
|
33
33
|
? {
|
|
34
34
|
kind: "present",
|
|
35
35
|
value: {
|
|
36
|
-
...report.
|
|
37
|
-
rows: report.
|
|
36
|
+
...report.debts.value,
|
|
37
|
+
rows: report.debts.value.rows.filter((row) => row.contract?.id === contract),
|
|
38
38
|
},
|
|
39
39
|
}
|
|
40
|
-
: report.
|
|
40
|
+
: report.debts,
|
|
41
41
|
akuma: report.akuma.kind === "present"
|
|
42
42
|
? {
|
|
43
43
|
kind: "present",
|
|
@@ -7,6 +7,7 @@ import { contractId } from "../core/facts/types.js";
|
|
|
7
7
|
import { readDispatches } from "../dispatch/index.js";
|
|
8
8
|
import { matchesAkumaGlob, parseReadableAkumaAlias, parseAkumaGlob, } from "../identity/selector.js";
|
|
9
9
|
import { World } from "../world.js";
|
|
10
|
+
import { matchContractCandidates } from "./contract-address.js";
|
|
10
11
|
import { requireInput } from "./input.js";
|
|
11
12
|
import { scopeForRepo } from "./repo.js";
|
|
12
13
|
export class AkumaAddressError extends Error {
|
|
@@ -69,10 +70,7 @@ export function resolveNamedAddress(input) {
|
|
|
69
70
|
if (selector.startsWith("aku/"))
|
|
70
71
|
return { kind: "akuma", id: parseAddressId(selector).id };
|
|
71
72
|
const alias = parseAddressAlias(selector);
|
|
72
|
-
const contractMatches = (input.report.contracts.kind === "present" ? input.report.contracts.value.rows : []
|
|
73
|
-
row.workspace === "worktree" &&
|
|
74
|
-
row.worktreePath !== null &&
|
|
75
|
-
`@${row.id.slice("kei/".length)}` === alias);
|
|
73
|
+
const contractMatches = matchContractCandidates(input.report.contracts.kind === "present" ? input.report.contracts.value.rows : [], { selector: alias });
|
|
76
74
|
const aliasId = input.aliases.kind === "present"
|
|
77
75
|
? (input.aliases.value.find((binding) => binding.alias === alias)?.akuId ?? null)
|
|
78
76
|
: null;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type AkumaCaller } from "../akuma/caller.js";
|
|
1
2
|
import { type ForkReceipt } from "../akuma/akuma-owner.js";
|
|
2
3
|
import { type AskObserver } from "../akuma/akuma-selection-execution.js";
|
|
3
4
|
import type { AkumaStatus } from "../akuma/akuma.js";
|
|
@@ -63,6 +64,7 @@ export type CallInput = Readonly<{
|
|
|
63
64
|
allowed?: readonly AllowedAction[];
|
|
64
65
|
schema?: Schema<unknown>;
|
|
65
66
|
initiator?: string;
|
|
67
|
+
caller?: AkumaCaller;
|
|
66
68
|
signal?: AbortSignal;
|
|
67
69
|
observe?: CallWaitObserver;
|
|
68
70
|
}>;
|
|
@@ -98,6 +100,8 @@ export type ForkInput = Readonly<{
|
|
|
98
100
|
akuma: string;
|
|
99
101
|
at: string;
|
|
100
102
|
repo?: Repo;
|
|
103
|
+
caller?: AkumaCaller;
|
|
104
|
+
initiator?: string;
|
|
101
105
|
}>;
|
|
102
106
|
export type ForkResult = Readonly<{
|
|
103
107
|
kind: "forked";
|
|
@@ -112,7 +116,7 @@ export type ForkResult = Readonly<{
|
|
|
112
116
|
}>);
|
|
113
117
|
export declare function callAkumas(input: CallInput & Readonly<{
|
|
114
118
|
path: WorldRoot;
|
|
115
|
-
}>, execution?: ExecutionContext): Promise<CallResult>;
|
|
119
|
+
}>, execution?: ExecutionContext, reportDiagnostic?: (message: string) => void): Promise<CallResult>;
|
|
116
120
|
export declare function forkAkumas(input: ForkInput & Readonly<{
|
|
117
121
|
path: WorldRoot;
|
|
118
122
|
}>): Promise<ForkResult>;
|