@astrosheep/keiyaku 4.6.31 → 4.6.32
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 +34 -17
- package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +16 -11
- package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +5 -3
- package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +4 -3
- package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +17 -17
- package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +4 -3
- package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +16 -11
- package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +5 -3
- package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +4 -3
- package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +17 -17
- package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +4 -3
- package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +16 -11
- package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +5 -3
- package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +4 -3
- package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +17 -17
- package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +4 -3
- package/build/plugins/pi/README.md +16 -18
- package/build/plugins/pi/akuma-tools.ts +31 -38
- package/build/plugins/pi/keiyaku.ts +15 -4
- package/build/skills/keiyaku-akuma/SKILL.md +16 -11
- package/build/skills/keiyaku-babysit/SKILL.md +5 -3
- package/build/skills/keiyaku-bind/SKILL.md +4 -3
- package/build/skills/keiyaku-debt/SKILL.md +17 -17
- package/build/skills/keiyaku-workflow/SKILL.md +4 -3
- package/build/src/akuma/akuma-call.d.ts +3 -5
- package/build/src/akuma/akuma-call.js +7 -10
- package/build/src/akuma/akuma-errors.d.ts +7 -4
- package/build/src/akuma/akuma-errors.js +16 -12
- package/build/src/akuma/akuma-instance.d.ts +39 -303
- package/build/src/akuma/akuma-instance.js +48 -48
- package/build/src/akuma/akuma-observe.d.ts +5 -4
- package/build/src/akuma/akuma-observe.js +1 -7
- package/build/src/akuma/akuma-owner.d.ts +14 -6
- package/build/src/akuma/akuma-owner.js +33 -27
- package/build/src/akuma/akuma-selection-execution.d.ts +22 -19
- package/build/src/akuma/akuma-selection-execution.js +71 -124
- package/build/src/akuma/akuma-wait.d.ts +3 -3
- package/build/src/akuma/akuma.d.ts +47 -384
- package/build/src/akuma/akuma.js +8 -58
- package/build/src/akuma/archetype.d.ts +16 -19
- package/build/src/akuma/archetype.js +48 -49
- package/build/src/akuma/body.js +31 -26
- package/build/src/akuma/call-initial-tell.d.ts +4 -1
- package/build/src/akuma/call-initial-tell.js +9 -1
- package/build/src/akuma/call-input.d.ts +8 -1
- package/build/src/akuma/call-input.js +27 -18
- package/build/src/akuma/caller.js +2 -1
- package/build/src/akuma/detached-body.js +1 -1
- package/build/src/akuma/heart/facts.d.ts +5 -4
- package/build/src/akuma/heart/facts.js +5 -5
- package/build/src/akuma/heart/soul.js +20 -4
- package/build/src/akuma/identity.d.ts +1 -1
- package/build/src/akuma/identity.js +9 -4
- package/build/src/akuma/index.d.ts +6 -7
- package/build/src/akuma/index.js +2 -3
- package/build/src/akuma/projection.d.ts +3 -0
- package/build/src/akuma/provider-recipe.js +3 -2
- package/build/src/akuma/providers/acp/config.js +11 -10
- package/build/src/akuma/providers/acp/index.js +2 -1
- package/build/src/akuma/providers/codex-app-server/index.js +7 -1
- package/build/src/akuma/providers/grok-build/index.js +2 -1
- package/build/src/akuma/providers/index.d.ts +0 -1
- package/build/src/akuma/providers/index.js +0 -8
- package/build/src/akuma/providers/paseo/index.js +7 -4
- package/build/src/akuma/providers/pi/index.js +4 -3
- package/build/src/akuma/publication.d.ts +1 -2
- package/build/src/akuma/publication.js +16 -14
- package/build/src/akuma/schema.d.ts +3 -49
- package/build/src/akuma/schema.js +6 -147
- package/build/src/akuma/selection-observation.d.ts +281 -240
- package/build/src/akuma/selection-observation.js +122 -68
- package/build/src/akuma/status-projection.d.ts +49 -285
- package/build/src/akuma/status-projection.js +178 -138
- package/build/src/body/amend.js +2 -1
- package/build/src/body/arc.js +3 -2
- package/build/src/body/criteria.js +4 -3
- package/build/src/body/decode.js +2 -1
- package/build/src/body/envelope.js +2 -1
- package/build/src/body/region.d.ts +1 -3
- package/build/src/body/region.js +3 -8
- package/build/src/body-host.d.ts +4 -11
- package/build/src/body-host.js +5 -4
- package/build/src/bounded-list.js +2 -1
- package/build/src/cli/commands/akuma-grammar.d.ts +109 -66
- package/build/src/cli/commands/akuma-grammar.js +75 -95
- package/build/src/cli/commands/akuma.d.ts +8 -3
- package/build/src/cli/commands/akuma.js +63 -122
- package/build/src/cli/commands/contract-grammar.d.ts +3 -135
- package/build/src/cli/commands/contract-grammar.js +125 -218
- package/build/src/cli/commands/contract-help.d.ts +24 -21
- package/build/src/cli/commands/contract-help.js +43 -35
- package/build/src/cli/commands/contract.d.ts +6 -18
- package/build/src/cli/commands/contract.js +65 -272
- package/build/src/cli/commands/debt-grammar.d.ts +2 -4
- package/build/src/cli/commands/debt-grammar.js +22 -190
- package/build/src/cli/commands/debt.js +10 -87
- package/build/src/cli/commands/report.d.ts +2 -4
- package/build/src/cli/coordinates.d.ts +1 -1
- package/build/src/cli/coordinates.js +1 -1
- package/build/src/cli/main.js +9 -3
- package/build/src/cli/parse.d.ts +80 -3
- package/build/src/cli/parse.js +76 -16
- package/build/src/cli/render/akuma-activity.d.ts +19 -24
- package/build/src/cli/render/akuma-activity.js +164 -259
- package/build/src/cli/render/akuma.d.ts +3 -3
- package/build/src/cli/render/akuma.js +36 -43
- package/build/src/cli/render/catalog.d.ts +2 -5
- package/build/src/cli/render/catalog.js +2 -33
- package/build/src/cli/render/contract-history.js +1 -2
- package/build/src/cli/render/contract-observation.d.ts +0 -7
- package/build/src/cli/render/contract-observation.js +0 -3
- package/build/src/cli/render/contract.d.ts +7 -9
- package/build/src/cli/render/contract.js +35 -64
- package/build/src/cli/render/debt.d.ts +3 -11
- package/build/src/cli/render/debt.js +17 -88
- package/build/src/cli/render/delivery-preview.js +4 -4
- package/build/src/cli/render/kanshi-akuma.d.ts +5 -3
- package/build/src/cli/render/kanshi-akuma.js +22 -18
- package/build/src/cli/render/kanshi.d.ts +1 -3
- package/build/src/cli/render/kanshi.js +16 -39
- package/build/src/cli/render/receipt.d.ts +21 -12
- package/build/src/cli/render/receipt.js +49 -44
- package/build/src/cli/render/refusal.d.ts +4 -3
- package/build/src/cli/render/refusal.js +15 -17
- package/build/src/cli/render/settings.d.ts +1 -1
- package/build/src/cli/render/terminal.d.ts +9 -8
- package/build/src/cli/render/terminal.js +48 -32
- package/build/src/cli/render/verbs.d.ts +3 -1
- package/build/src/cli/render/verbs.js +74 -116
- package/build/src/cli/runtime.js +66 -65
- package/build/src/cli/streams.d.ts +2 -9
- package/build/src/cli/streams.js +8 -1
- package/build/src/cli/usage.d.ts +2 -1
- package/build/src/cli/usage.js +3 -2
- package/build/src/contract-worktree.js +2 -10
- package/build/src/core/facts/codec.js +9 -23
- package/build/src/core/facts/errors.d.ts +2 -1
- package/build/src/core/facts/errors.js +3 -3
- package/build/src/core/facts/types.d.ts +2 -13
- package/build/src/core/facts/types.js +1 -6
- package/build/src/core/verbs/abandon.d.ts +1 -2
- package/build/src/core/verbs/amend.d.ts +1 -2
- package/build/src/core/verbs/arc.d.ts +1 -2
- package/build/src/core/verbs/attestation.d.ts +1 -2
- package/build/src/core/verbs/bind.d.ts +1 -2
- package/build/src/core/verbs/deliver.d.ts +1 -2
- package/build/src/core/verbs/placement.d.ts +1 -2
- package/build/src/core/verbs/reintegrate.d.ts +1 -2
- package/build/src/debt/board.d.ts +14 -94
- package/build/src/debt/board.js +25 -160
- package/build/src/debt/catalog.d.ts +0 -2
- package/build/src/debt/catalog.js +1 -22
- package/build/src/debt/document.d.ts +8 -11
- package/build/src/debt/document.js +19 -62
- package/build/src/debt/identity.d.ts +2 -14
- package/build/src/debt/identity.js +19 -49
- package/build/src/debt/index.d.ts +81 -219
- package/build/src/debt/index.js +61 -110
- package/build/src/debt/input.d.ts +19 -5
- package/build/src/debt/input.js +51 -177
- package/build/src/debt/lifecycle-operations.d.ts +1 -3
- package/build/src/debt/lifecycle-operations.js +1 -73
- package/build/src/debt/operation-types.d.ts +24 -128
- package/build/src/debt/operation-types.js +6 -62
- package/build/src/debt/operations.d.ts +8 -17
- package/build/src/debt/operations.js +58 -154
- package/build/src/debt/store.d.ts +0 -2
- package/build/src/debt/store.js +32 -87
- package/build/src/errors.d.ts +28 -0
- package/build/src/errors.js +26 -0
- package/build/src/git/hooks.d.ts +1 -1
- package/build/src/git/observe.d.ts +3 -0
- package/build/src/git/observe.js +19 -5
- package/build/src/git/reconcile.d.ts +3 -16
- package/build/src/git/reconcile.js +0 -18
- package/build/src/git/repository.d.ts +2 -1
- package/build/src/git/repository.js +3 -3
- package/build/src/git/target-placement.d.ts +4 -4
- package/build/src/git/target.d.ts +2 -2
- package/build/src/git/tender.d.ts +1 -2
- package/build/src/git/tender.js +5 -12
- package/build/src/identity/coordinates.d.ts +1 -1
- package/build/src/identity/coordinates.js +3 -2
- package/build/src/identity/normalize.js +2 -1
- package/build/src/identity/selector.js +4 -3
- package/build/src/index.d.ts +34 -57
- package/build/src/index.js +11 -36
- package/build/src/kanshi/counts.d.ts +3 -8
- package/build/src/kanshi/counts.js +6 -14
- package/build/src/kanshi/index.d.ts +22 -7
- package/build/src/kanshi/index.js +30 -4
- package/build/src/kanshi/read.d.ts +81 -270
- package/build/src/kanshi/read.js +39 -199
- package/build/src/kanshi/report.d.ts +340 -1619
- package/build/src/kanshi/report.js +19 -31
- package/build/src/library/address.d.ts +11 -11
- package/build/src/library/address.js +34 -27
- package/build/src/library/akuma-creation.d.ts +210 -79
- package/build/src/library/akuma-creation.js +201 -242
- package/build/src/library/akumas.d.ts +24 -5
- package/build/src/library/akumas.js +96 -29
- package/build/src/library/bind.d.ts +7 -10
- package/build/src/library/bind.js +2 -8
- package/build/src/library/continuation.d.ts +141 -231
- package/build/src/library/continuation.js +22 -31
- package/build/src/library/contract-address.d.ts +6 -9
- package/build/src/library/contract-address.js +11 -16
- package/build/src/library/contract-composition.d.ts +2 -3
- package/build/src/library/contract-composition.js +12 -19
- package/build/src/library/contract-creation.js +33 -34
- package/build/src/library/contract-outcomes.d.ts +1278 -806
- package/build/src/library/contract-outcomes.js +11 -37
- package/build/src/library/contract-settings.d.ts +1 -2
- package/build/src/library/contract-settings.js +5 -7
- package/build/src/library/contract-types.d.ts +42 -67
- package/build/src/library/contract-types.js +15 -56
- package/build/src/library/contract-wait.d.ts +40 -3
- package/build/src/library/contract-wait.js +28 -21
- package/build/src/library/delivery.d.ts +366 -389
- package/build/src/library/delivery.js +5 -25
- package/build/src/library/input.d.ts +31 -5
- package/build/src/library/input.js +40 -40
- package/build/src/library/invocation.d.ts +13 -11
- package/build/src/library/invocation.js +69 -58
- package/build/src/library/kei.d.ts +16 -8
- package/build/src/library/kei.js +459 -19
- package/build/src/library/keiyaku-attribution.d.ts +0 -8
- package/build/src/library/keiyaku-attribution.js +0 -11
- package/build/src/library/keiyaku-classify.d.ts +2 -2
- package/build/src/library/keiyaku-classify.js +40 -59
- package/build/src/library/keiyaku-coordinates.d.ts +3 -8
- package/build/src/library/keiyaku-coordinates.js +6 -26
- package/build/src/library/keiyaku-debt.d.ts +21 -93
- package/build/src/library/keiyaku-debt.js +8 -157
- package/build/src/library/keiyaku-identity.js +5 -4
- package/build/src/library/keiyaku-verbs.d.ts +4004 -3885
- package/build/src/library/keiyaku-verbs.js +309 -271
- package/build/src/library/keiyaku.d.ts +30 -860
- package/build/src/library/keiyaku.js +169 -256
- package/build/src/library/nuke.d.ts +4 -2
- package/build/src/library/nuke.js +5 -1
- package/build/src/library/outcome.d.ts +424 -307
- package/build/src/library/outcome.js +167 -362
- package/build/src/library/reconcile.d.ts +331 -143
- package/build/src/library/reconcile.js +38 -72
- package/build/src/library/refusal.d.ts +20 -28
- package/build/src/library/refusal.js +1 -11
- package/build/src/library/repo.js +4 -3
- package/build/src/library/selection.d.ts +32 -21
- package/build/src/library/selection.js +63 -87
- package/build/src/mcp/adapter.d.ts +6 -0
- package/build/src/mcp/adapter.js +177 -42
- package/build/src/mcp/help.d.ts +1 -1
- package/build/src/mcp/help.js +12 -7
- package/build/src/mcp/output.d.ts +385 -0
- package/build/src/mcp/output.js +193 -0
- package/build/src/plugin/public.d.ts +4 -0
- package/build/src/plugin/runtime.d.ts +1 -1
- package/build/src/plugin/runtime.js +2 -2
- package/build/src/protocol/amend.d.ts +1 -1
- package/build/src/protocol/amend.js +2 -2
- package/build/src/protocol/bind.d.ts +5 -7
- package/build/src/protocol/bind.js +3 -3
- package/build/src/protocol/completion.d.ts +158 -195
- package/build/src/protocol/completion.js +55 -19
- package/build/src/protocol/deliver.d.ts +11 -6
- package/build/src/protocol/deliver.js +30 -30
- package/build/src/protocol/delivery-preview.d.ts +13 -11
- package/build/src/protocol/delivery-preview.js +2 -2
- package/build/src/protocol/execution-observation.d.ts +5 -13
- package/build/src/protocol/intent.d.ts +6 -9
- package/build/src/protocol/intent.js +18 -31
- package/build/src/protocol/operations.d.ts +48 -53
- package/build/src/protocol/operations.js +16 -25
- package/build/src/protocol/outcome.d.ts +3 -1
- package/build/src/protocol/placement.d.ts +1 -2
- package/build/src/protocol/placement.js +1 -1
- package/build/src/protocol/progress.d.ts +1 -0
- package/build/src/protocol/read/status.d.ts +29 -112
- package/build/src/protocol/read/status.js +52 -78
- package/build/src/protocol/reintegrate.d.ts +1 -2
- package/build/src/protocol/reintegrate.js +0 -1
- package/build/src/protocol/result-leaves.d.ts +11 -32
- package/build/src/protocol/result-leaves.js +18 -57
- package/build/src/protocol/result-reasons.d.ts +6 -6
- package/build/src/protocol/review.js +0 -1
- package/build/src/protocol/verify.d.ts +192 -146
- package/build/src/protocol/verify.js +60 -47
- package/build/src/runtime/proc/windows-launch.exe +0 -0
- package/build/src/settings.d.ts +8 -9
- package/build/src/settings.js +16 -13
- package/build/src/settlement/holder.js +2 -2
- package/build/src/settlement/settle.d.ts +0 -6
- package/build/src/settlement/settle.js +0 -4
- package/build/src/verification/declaration.d.ts +3 -6
- package/build/src/verification/declaration.js +3 -5
- package/build/src/verification/observation.d.ts +2 -2
- package/build/src/world.d.ts +3 -2
- package/build/src/world.js +5 -6
- package/package.json +1 -1
- package/plugins/paseo/plugin/index.server.ts +1 -1
- package/plugins/paseo/plugin/server/attach.ts +74 -67
- package/plugins/paseo/plugin/server/keiyaku.ts +80 -14
- package/plugins/paseo/plugin/server/message.ts +2 -1
- package/plugins/paseo/plugin/server/mirror-identity.ts +6 -4
- package/plugins/paseo/plugin/server/sdk.ts +9 -11
- package/plugins/paseo/plugin/server/transport.ts +24 -1
- package/plugins/pi/README.md +16 -18
- package/plugins/pi/akuma-tools.ts +31 -38
- package/plugins/pi/keiyaku.ts +15 -4
- package/skills/keiyaku-akuma/SKILL.md +16 -11
- package/skills/keiyaku-babysit/SKILL.md +5 -3
- package/skills/keiyaku-bind/SKILL.md +4 -3
- package/skills/keiyaku-debt/SKILL.md +17 -17
- package/skills/keiyaku-workflow/SKILL.md +4 -3
- package/build/src/akuma/providers/codex-app-server/configuration.d.ts +0 -5
- package/build/src/akuma/providers/codex-app-server/configuration.js +0 -72
- package/build/src/cli/commands/debt-query.d.ts +0 -5
- package/build/src/cli/commands/debt-query.js +0 -194
- package/build/src/cli/render/akuma-tool-command.d.ts +0 -6
- package/build/src/cli/render/akuma-tool-command.js +0 -143
- package/build/src/cli/render/akuma-tool.d.ts +0 -29
- package/build/src/cli/render/akuma-tool.js +0 -225
- package/build/src/debt/context.d.ts +0 -28
- package/build/src/debt/context.js +0 -102
- package/build/src/debt/created-observation.d.ts +0 -26
- package/build/src/debt/created-observation.js +0 -38
- package/build/src/debt/query.d.ts +0 -80
- package/build/src/debt/query.js +0 -283
- package/build/src/library/contract-execution.d.ts +0 -28
- package/build/src/library/contract-execution.js +0 -506
- package/build/src/library/keiyaku-policy.d.ts +0 -27
- package/build/src/library/keiyaku-policy.js +0 -44
- package/build/src/library/keiyaku-status.d.ts +0 -1487
- package/build/src/library/keiyaku-status.js +0 -92
package/build/src/cli/runtime.js
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import { resolve } from "node:path";
|
|
2
2
|
import { AkumaNotBornError, AkumaObservationError } from "../akuma/akuma-errors.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { AkumaNameError, Keiyaku } from "../index.js";
|
|
4
|
+
import { errorCategory } from "../errors.js";
|
|
5
|
+
import { AkumaAddressError, AkumaWorldScopeError, observeNamedAddress, resolveNamedAddress, } from "../library/address.js";
|
|
5
6
|
import { projectFailure, KeiyakuError } from "../library/outcome.js";
|
|
6
7
|
import { classifyVerb } from "../library/keiyaku-verbs.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
8
|
+
import { acquireAkumaRequest, runSpawn, runAsk, runAkumaHistory } from "./commands/akuma.js";
|
|
9
|
+
import { acquireContractRequest, admitBindMarkdown, runContractRequest } from "./commands/contract.js";
|
|
9
10
|
import { installOutcome, installHarnesses, renderInstallText } from "./commands/install.js";
|
|
10
11
|
import { runDebtCommand } from "./commands/debt.js";
|
|
11
12
|
import { runReport } from "./commands/report.js";
|
|
12
13
|
import { runWhoami } from "./commands/whoami.js";
|
|
13
14
|
import { resolveInvocationCoordinates } from "./coordinates.js";
|
|
14
15
|
import { BindDraftError } from "./draft.js";
|
|
15
|
-
import { assertExplicitRepoUse, CliUsageError, usageGuideForCommand, } from "./parse.js";
|
|
16
|
+
import { assertExplicitRepoUse, commandName, CliUsageError, usageGuideForCommand, } from "./parse.js";
|
|
16
17
|
import { createExecutionProgressRenderer } from "./render/execution-progress.js";
|
|
17
18
|
import { renderVerb } from "./render/verbs.js";
|
|
18
19
|
import { renderRefusal } from "./render/refusal.js";
|
|
19
|
-
import { DEFAULT_CLI_COLUMNS, safeText } from "./render/terminal.js";
|
|
20
|
+
import { DEFAULT_CLI_COLUMNS, formatNextCall, safeText } from "./render/terminal.js";
|
|
20
21
|
import { cliExitCode, displayContext, emit, writeJson, writeStderr, writeStdout } from "./streams.js";
|
|
21
|
-
import { usageAcceptanceLines } from "./usage.js";
|
|
22
|
+
import { renderUsageMessage, usageAcceptanceLines } from "./usage.js";
|
|
22
23
|
async function processStdin() {
|
|
23
24
|
const chunks = [];
|
|
24
25
|
for await (const chunk of process.stdin)
|
|
@@ -62,33 +63,22 @@ function cliCancellation(signal) {
|
|
|
62
63
|
},
|
|
63
64
|
};
|
|
64
65
|
}
|
|
65
|
-
//
|
|
66
|
-
// there was a wire input. The name still selects operation-specific judgment.
|
|
66
|
+
// Acquisition may fail before the parsed input has all its required fields.
|
|
67
67
|
function thrownCompletion(error, command) {
|
|
68
|
-
const name = (
|
|
69
|
-
? command.
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
const name = ("name" in command
|
|
69
|
+
? command.name
|
|
70
|
+
: command.command === "debt"
|
|
71
|
+
? command.action === "add" && command.stdin === "document"
|
|
72
72
|
? "debt.addDocument"
|
|
73
73
|
: `debt.${command.action}`
|
|
74
|
-
: command.command === "deliver" && command.dryRun
|
|
75
|
-
? "deliver.preview"
|
|
76
74
|
: command.command);
|
|
77
|
-
const input =
|
|
75
|
+
const input = ("input" in command ? command.input : {});
|
|
78
76
|
const completion = { kind: "threw", error };
|
|
79
77
|
return {
|
|
80
78
|
outcome: classifyVerb(name, input, completion),
|
|
81
79
|
text: () => renderVerb(name, input, completion, displayContext()),
|
|
82
80
|
};
|
|
83
81
|
}
|
|
84
|
-
/** Install is a CLI-only operation, not a facet verb. */
|
|
85
|
-
function writeInstallFailure(error, command) {
|
|
86
|
-
if (command.output === "json")
|
|
87
|
-
writeJson(projectFailure(error));
|
|
88
|
-
else
|
|
89
|
-
writeStderr(`× install failed\n reason ${safeText(error instanceof Error ? error.message : String(error))}`);
|
|
90
|
-
return "failed";
|
|
91
|
-
}
|
|
92
82
|
function writeBindDraftFailure(error, command) {
|
|
93
83
|
const refusal = {
|
|
94
84
|
kind: "invalid-document",
|
|
@@ -110,44 +100,42 @@ function writeAkumaFailure(error, command, shared) {
|
|
|
110
100
|
return shared.outcome;
|
|
111
101
|
}
|
|
112
102
|
function writeArchetypeFailure(error, command, shared) {
|
|
113
|
-
const missing = error.
|
|
103
|
+
const missing = error.absent;
|
|
114
104
|
if (command.output === "json") {
|
|
115
105
|
writeJson({
|
|
116
106
|
kind: "refused",
|
|
117
107
|
diagnostic: missing ? "Akuma not found" : error.reason,
|
|
118
108
|
akumaName: error.akumaName,
|
|
119
109
|
searched: error.searched,
|
|
120
|
-
...(
|
|
110
|
+
...(error.next === undefined ? {} : { available: formatNextCall(error.next), next: error.next }),
|
|
121
111
|
});
|
|
122
112
|
}
|
|
123
113
|
else
|
|
124
114
|
writeStdout([shared.text(), ...usageAcceptanceLines(usageGuideForCommand(command))].join("\n"));
|
|
125
115
|
return shared.outcome;
|
|
126
116
|
}
|
|
127
|
-
|
|
117
|
+
function writeFailure(error, command) {
|
|
128
118
|
if (error instanceof BindDraftError)
|
|
129
119
|
return writeBindDraftFailure(error, command);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
if (command.command === "install")
|
|
138
|
-
return writeInstallFailure(error, command);
|
|
139
|
-
const shared = thrownCompletion(error, command);
|
|
120
|
+
const shared = "command" in command && command.command === "install"
|
|
121
|
+
? {
|
|
122
|
+
outcome: errorCategory(error) === "invalid-input" ? "usage" : "failed",
|
|
123
|
+
text: () => `× install failed\n reason ${safeText(error instanceof Error ? error.message : String(error))}`,
|
|
124
|
+
}
|
|
125
|
+
: thrownCompletion(error, command);
|
|
140
126
|
if (error instanceof AkumaNotBornError ||
|
|
141
127
|
error instanceof AkumaAddressError ||
|
|
142
128
|
error instanceof AkumaWorldScopeError ||
|
|
143
129
|
error instanceof AkumaObservationError)
|
|
144
130
|
return writeAkumaFailure(error, command, shared);
|
|
145
|
-
if (error instanceof
|
|
131
|
+
if (error instanceof AkumaNameError && commandName(command) === "spawn")
|
|
146
132
|
return writeArchetypeFailure(error, command, shared);
|
|
147
133
|
if (command.output === "json")
|
|
148
134
|
writeJson(projectFailure(error));
|
|
149
135
|
else if (error instanceof KeiyakuError && error.outcome !== undefined)
|
|
150
136
|
writeStdout(shared.text());
|
|
137
|
+
else if (shared.outcome === "usage")
|
|
138
|
+
writeStderr(renderUsageMessage(error instanceof Error ? error.message : String(error), error instanceof CliUsageError ? (error.guide ?? usageGuideForCommand(command)) : usageGuideForCommand(command)));
|
|
151
139
|
else
|
|
152
140
|
writeStderr(shared.text());
|
|
153
141
|
return shared.outcome;
|
|
@@ -166,12 +154,12 @@ function invocationCoordinates(invocation, input, environment) {
|
|
|
166
154
|
// eslint-disable-next-line complexity -- dispatch keeps acquisition, the facet, and process outcome in one edge.
|
|
167
155
|
async function runCommand(invocation, input) {
|
|
168
156
|
const command = invocation.command;
|
|
169
|
-
|
|
170
|
-
const environment = input.environment ?? process.env;
|
|
157
|
+
const environment = { ...(input.environment ?? process.env) };
|
|
171
158
|
const home = homeFromEnvironment(environment);
|
|
172
159
|
const cancellation = cliCancellation(input.signal);
|
|
173
160
|
let progress;
|
|
174
161
|
try {
|
|
162
|
+
assertExplicitRepoUse(command, invocation.repo);
|
|
175
163
|
const runtime = {
|
|
176
164
|
environment,
|
|
177
165
|
facet: Keiyaku.at({
|
|
@@ -185,40 +173,53 @@ async function runCommand(invocation, input) {
|
|
|
185
173
|
signal: cancellation.signal,
|
|
186
174
|
progress: () => (progress ??= writeExecutionProgress()),
|
|
187
175
|
};
|
|
188
|
-
if (command
|
|
189
|
-
|
|
190
|
-
|
|
176
|
+
if ("command" in command) {
|
|
177
|
+
if (command.command === "install") {
|
|
178
|
+
const result = await installHarnesses(command.harnesses, environment);
|
|
179
|
+
return emit(command.output, result, () => renderInstallText(result), installOutcome(result));
|
|
180
|
+
}
|
|
181
|
+
if (command.command === "report")
|
|
182
|
+
return await runReport(command, runtime);
|
|
183
|
+
if (command.command === "whoami")
|
|
184
|
+
return await runWhoami(command, runtime);
|
|
185
|
+
return await runDebtCommand(command, runtime);
|
|
191
186
|
}
|
|
192
|
-
if (command.
|
|
187
|
+
if (command.name === "bind" && "acquire" in command) {
|
|
193
188
|
await admitBindMarkdown({
|
|
194
189
|
markdown: await runtime.readStdin(),
|
|
195
190
|
processCwd: input.cwd ?? process.cwd(),
|
|
196
191
|
...(invocation.cwd === undefined ? {} : { cwd: invocation.cwd }),
|
|
197
192
|
});
|
|
198
193
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
if (command.
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
return await runContractCommand(command, runtime);
|
|
210
|
-
}
|
|
211
|
-
catch (error) {
|
|
212
|
-
if (error instanceof KeiyakuUsageError) {
|
|
213
|
-
const usage = new CliUsageError(error.message, usageGuideForCommand(command));
|
|
214
|
-
if (command.command === "ls" && command.query.kind === "akuma" && command.query.caller?.kind === "mine")
|
|
215
|
-
return await writeFailure(usage, command);
|
|
216
|
-
throw usage;
|
|
194
|
+
let request;
|
|
195
|
+
let selectedAlias;
|
|
196
|
+
if ("acquire" in command && command.name === "status") {
|
|
197
|
+
const { world, repo } = await invocationCoordinates(invocation, input, environment);
|
|
198
|
+
const selector = command.acquire.selector;
|
|
199
|
+
const authority = await observeNamedAddress({ world, repo: repo ?? null, selectors: [selector] });
|
|
200
|
+
const address = resolveNamedAddress({ selector, ...authority });
|
|
201
|
+
if (address.kind === "akuma")
|
|
202
|
+
selectedAlias = selector;
|
|
203
|
+
request = { name: "status", input: { id: address.id }, output: command.output };
|
|
217
204
|
}
|
|
218
|
-
|
|
219
|
-
|
|
205
|
+
else {
|
|
206
|
+
request =
|
|
207
|
+
"acquire" in command
|
|
208
|
+
? command.name === "spawn" || command.name === "tell" || command.name === "ask"
|
|
209
|
+
? await acquireAkumaRequest(command, invocation.workdir, runtime)
|
|
210
|
+
: await acquireContractRequest(command, runtime)
|
|
211
|
+
: command;
|
|
220
212
|
}
|
|
221
|
-
|
|
213
|
+
if (request.name === "spawn")
|
|
214
|
+
return await runSpawn(request, runtime);
|
|
215
|
+
if (request.name === "ask" || (request.name === "tell" && request.input.wait !== undefined))
|
|
216
|
+
return await runAsk(request, runtime);
|
|
217
|
+
if (request.name === "history" && !request.input.selector.startsWith("kei/"))
|
|
218
|
+
return await runAkumaHistory(request, runtime);
|
|
219
|
+
return await runContractRequest(request, runtime, selectedAlias);
|
|
220
|
+
}
|
|
221
|
+
catch (error) {
|
|
222
|
+
return writeFailure(error, command);
|
|
222
223
|
}
|
|
223
224
|
finally {
|
|
224
225
|
cancellation.close();
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
+
import type { VerbDisposition } from "../library/keiyaku-verbs.js";
|
|
1
2
|
import { type TextRenderContext } from "./render/terminal.js";
|
|
2
|
-
|
|
3
|
-
readonly accepted: 0;
|
|
4
|
-
readonly refused: 1;
|
|
5
|
-
readonly retryable: 2;
|
|
6
|
-
readonly failed: 3;
|
|
7
|
-
readonly usage: 64;
|
|
8
|
-
};
|
|
9
|
-
export type CliOutcome = keyof typeof EXIT_CODES;
|
|
3
|
+
export type CliOutcome = VerbDisposition;
|
|
10
4
|
export declare function cliExitCode(outcome: CliOutcome): number;
|
|
11
5
|
/** Append one complete line to a process stream unless the body already ends with a newline. */
|
|
12
6
|
export declare function writeCliStream(stream: NodeJS.WritableStream, body: string): void;
|
|
@@ -23,4 +17,3 @@ export declare function writeJson(value: unknown): void;
|
|
|
23
17
|
* and the native exit classifier's verdict follows.
|
|
24
18
|
*/
|
|
25
19
|
export declare function emit<Result>(output: "text" | "json", result: Result, text: () => string, outcome: CliOutcome): CliOutcome;
|
|
26
|
-
export {};
|
package/build/src/cli/streams.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { DEFAULT_CLI_COLUMNS } from "./render/terminal.js";
|
|
2
|
-
const EXIT_CODES = {
|
|
2
|
+
const EXIT_CODES = {
|
|
3
|
+
accepted: 0,
|
|
4
|
+
refused: 1,
|
|
5
|
+
retryable: 2,
|
|
6
|
+
failed: 3,
|
|
7
|
+
unsatisfied: 4,
|
|
8
|
+
usage: 64,
|
|
9
|
+
};
|
|
3
10
|
export function cliExitCode(outcome) {
|
|
4
11
|
return EXIT_CODES[outcome];
|
|
5
12
|
}
|
package/build/src/cli/usage.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { KeiyakuError } from "../errors.js";
|
|
1
2
|
export type CliUsageGuide = Readonly<{
|
|
2
3
|
scope: string;
|
|
3
4
|
accepts: string;
|
|
@@ -14,7 +15,7 @@ export declare function unknownCommandGuide(guide: CliUsageGuide, given: string)
|
|
|
14
15
|
export declare function renderUsageMessage(diagnostic: string, guide?: CliUsageGuide, kind?: "usage" | "selector"): string;
|
|
15
16
|
/** The acceptance grammar tail shared by usage and substantive refusals. */
|
|
16
17
|
export declare function usageAcceptanceLines(guide: CliUsageGuide): readonly string[];
|
|
17
|
-
export declare class CliUsageError extends
|
|
18
|
+
export declare class CliUsageError extends KeiyakuError {
|
|
18
19
|
readonly diagnostic: string;
|
|
19
20
|
readonly guide?: CliUsageGuide | undefined;
|
|
20
21
|
constructor(diagnostic: string, guide?: CliUsageGuide | undefined);
|
package/build/src/cli/usage.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { KeiyakuError } from "../errors.js";
|
|
1
2
|
export const ROOT_USAGE_GUIDE = {
|
|
2
3
|
scope: "keiyaku",
|
|
3
4
|
accepts: "keiyaku <command> [options]",
|
|
@@ -58,11 +59,11 @@ export function usageAcceptanceLines(guide) {
|
|
|
58
59
|
` help ${guide.help}`,
|
|
59
60
|
];
|
|
60
61
|
}
|
|
61
|
-
export class CliUsageError extends
|
|
62
|
+
export class CliUsageError extends KeiyakuError {
|
|
62
63
|
diagnostic;
|
|
63
64
|
guide;
|
|
64
65
|
constructor(diagnostic, guide) {
|
|
65
|
-
super(
|
|
66
|
+
super("invalid-input", diagnostic);
|
|
66
67
|
this.diagnostic = diagnostic;
|
|
67
68
|
this.guide = guide;
|
|
68
69
|
this.name = "CliUsageError";
|
|
@@ -6,8 +6,6 @@ import { CONTRACT_DELIVERER_SKILL, CONTRACT_REVIEWER_SKILL, CONTRACT_ONBOARDING_
|
|
|
6
6
|
import { executeGit } from "./git/process.js";
|
|
7
7
|
import { worktreePath } from "./git/workspace.js";
|
|
8
8
|
import { appointmentFor, placeRegisterPath } from "./workspace-place.js";
|
|
9
|
-
import { repairNamespaceContext } from "./debt/context.js";
|
|
10
|
-
import { contractNamespace } from "./debt/identity.js";
|
|
11
9
|
const IGNORE_BYTES = ".gitignore\nKEIYAKU.md\n";
|
|
12
10
|
const PRIMARY_IGNORE_BYTES = "*\n!settings.json\n!akumas/\n!akumas/*.md\n";
|
|
13
11
|
const SEAT_IGNORE_BYTES = ".gitignore\nSKILL.md\n";
|
|
@@ -90,7 +88,7 @@ async function materializeSeatSkill(worktree, seat, bytes, tracked) {
|
|
|
90
88
|
await repair(worktree, `${leaf}/.gitignore`, SEAT_IGNORE_BYTES, tracked);
|
|
91
89
|
await repair(worktree, skill, bytes, tracked);
|
|
92
90
|
}
|
|
93
|
-
async function materialize(repository, worktree, guidance
|
|
91
|
+
async function materialize(repository, worktree, guidance) {
|
|
94
92
|
const failed = (path, error) => ({
|
|
95
93
|
lag: [
|
|
96
94
|
{
|
|
@@ -125,12 +123,6 @@ async function materialize(repository, worktree, guidance, namespace) {
|
|
|
125
123
|
],
|
|
126
124
|
};
|
|
127
125
|
}
|
|
128
|
-
try {
|
|
129
|
-
await repairNamespaceContext(worktree, namespace);
|
|
130
|
-
}
|
|
131
|
-
catch (error) {
|
|
132
|
-
return failed(join(worktree, ".keiyaku", "namespace", "current"), error);
|
|
133
|
-
}
|
|
134
126
|
if (worktree !== primaryWorktree) {
|
|
135
127
|
try {
|
|
136
128
|
tracked = await readTrackedPaths(repository, worktree, GENERATED_PATHS);
|
|
@@ -175,5 +167,5 @@ export async function projectContractWorktree(repository, state, register, _onCo
|
|
|
175
167
|
],
|
|
176
168
|
};
|
|
177
169
|
}
|
|
178
|
-
return await materialize(repository, worktreePath(repository, appointed.place), renderContractGuidance(state)
|
|
170
|
+
return await materialize(repository, worktreePath(repository, appointed.place), renderContractGuidance(state));
|
|
179
171
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseDependencyKeySet } from "../subject.js";
|
|
2
2
|
import { AuthorityCorruptionError } from "./errors.js";
|
|
3
|
-
import { changeId,
|
|
3
|
+
import { changeId, contractId, documentKey, documentSegmentKey, entryUlid, gate, requirementId, snapshotId, } from "./types.js";
|
|
4
4
|
const VERSION_BY_KIND = {
|
|
5
5
|
bind: 1,
|
|
6
6
|
amend: 1,
|
|
@@ -22,12 +22,7 @@ function requireRecord(value, path) {
|
|
|
22
22
|
fail(path, "expected an object");
|
|
23
23
|
return value;
|
|
24
24
|
}
|
|
25
|
-
function requireKeys(value, required, path
|
|
26
|
-
const expected = new Set([...required, ...optional]);
|
|
27
|
-
for (const key of Object.keys(value)) {
|
|
28
|
-
if (!expected.has(key))
|
|
29
|
-
fail(path, `unknown field '${key}'`);
|
|
30
|
-
}
|
|
25
|
+
function requireKeys(value, required, path) {
|
|
31
26
|
for (const key of required) {
|
|
32
27
|
if (!(key in value))
|
|
33
28
|
fail(path, `missing field '${key}'`);
|
|
@@ -112,7 +107,7 @@ function targetValue(value, path) {
|
|
|
112
107
|
}
|
|
113
108
|
function validateCoordinates(value, path) {
|
|
114
109
|
const object = requireRecord(value, path);
|
|
115
|
-
requireKeys(object, ["start", "workspace"], path
|
|
110
|
+
requireKeys(object, ["start", "workspace"], path);
|
|
116
111
|
const workspace = stringValue(object.workspace, `${path}.workspace`);
|
|
117
112
|
if (workspace !== "worktree")
|
|
118
113
|
fail(`${path}.workspace`, "unknown workspace");
|
|
@@ -148,7 +143,7 @@ function termsValue(value, path) {
|
|
|
148
143
|
}
|
|
149
144
|
function validateAttestation(value, path) {
|
|
150
145
|
const object = requireRecord(value, path);
|
|
151
|
-
requireKeys(object, ["gate", "requirement", "subject", "verdict"], path
|
|
146
|
+
requireKeys(object, ["gate", "requirement", "subject", "verdict"], path);
|
|
152
147
|
const declaredGate = brandedValue(object.gate, `${path}.gate`, gate);
|
|
153
148
|
const verdict = stringValue(object.verdict, `${path}.verdict`);
|
|
154
149
|
if (verdict !== "satisfied" && verdict !== "unsatisfied")
|
|
@@ -192,7 +187,7 @@ function validateData(kind, value) {
|
|
|
192
187
|
return termsValue(value, path);
|
|
193
188
|
case "deliver": {
|
|
194
189
|
const object = requireRecord(value, path);
|
|
195
|
-
requireKeys(object, ["tenderSnapshot", "integration", "method", "policy"], path
|
|
190
|
+
requireKeys(object, ["tenderSnapshot", "integration", "method", "policy"], path);
|
|
196
191
|
const integration = requireRecord(object.integration, `${path}.integration`);
|
|
197
192
|
requireKeys(integration, ["predecessor", "snapshot", "changeId"], `${path}.integration`);
|
|
198
193
|
const method = stringValue(object.method, `${path}.method`);
|
|
@@ -233,7 +228,6 @@ function validateData(kind, value) {
|
|
|
233
228
|
return validateArc(value, path);
|
|
234
229
|
case "abandoned": {
|
|
235
230
|
const object = requireRecord(value, path);
|
|
236
|
-
requireKeys(object, [], path, ["note"]);
|
|
237
231
|
return {
|
|
238
232
|
...(object.note === undefined ? {} : { note: stringValue(object.note, `${path}.note`) }),
|
|
239
233
|
};
|
|
@@ -242,7 +236,7 @@ function validateData(kind, value) {
|
|
|
242
236
|
}
|
|
243
237
|
export function validateEntry(value) {
|
|
244
238
|
const object = requireRecord(value, "entry");
|
|
245
|
-
requireKeys(object, ["v", "kind", "contract", "entry", "at", "data"], "entry"
|
|
239
|
+
requireKeys(object, ["v", "kind", "contract", "entry", "at", "data"], "entry");
|
|
246
240
|
const kind = object.kind;
|
|
247
241
|
if (typeof kind !== "string" || !Object.hasOwn(VERSION_BY_KIND, kind)) {
|
|
248
242
|
throw new AuthorityCorruptionError(`unknown journal entry kind: ${String(kind)}`);
|
|
@@ -256,7 +250,6 @@ export function validateEntry(value) {
|
|
|
256
250
|
contract: brandedValue(object.contract, "entry.contract", contractId),
|
|
257
251
|
entry: brandedValue(object.entry, "entry.entry", entryUlid),
|
|
258
252
|
at: validateTimestamp(object.at, "entry.at"),
|
|
259
|
-
...(object.actor === undefined ? {} : { actor: brandedValue(object.actor, "entry.actor", actorId) }),
|
|
260
253
|
data: validateData(kind, object.data),
|
|
261
254
|
};
|
|
262
255
|
const after = entry.kind === "bind" ? entry.data.terms.after : entry.kind === "amend" ? entry.data.after : undefined;
|
|
@@ -287,10 +280,7 @@ export function encodeEntry(entry) {
|
|
|
287
280
|
const validated = validateEntry(entry);
|
|
288
281
|
return `${canonicalValue(validated)}\n`;
|
|
289
282
|
}
|
|
290
|
-
function decodeEntry(
|
|
291
|
-
if (line.includes("\r") || line.includes("\n\n"))
|
|
292
|
-
throw new AuthorityCorruptionError("journal entry must be one LF-delimited JSON value");
|
|
293
|
-
const body = line.endsWith("\n") ? line.slice(0, -1) : line;
|
|
283
|
+
function decodeEntry(body) {
|
|
294
284
|
if (body.length === 0)
|
|
295
285
|
throw new AuthorityCorruptionError("journal entry cannot be empty");
|
|
296
286
|
let value;
|
|
@@ -300,18 +290,14 @@ function decodeEntry(line) {
|
|
|
300
290
|
catch (error) {
|
|
301
291
|
throw new AuthorityCorruptionError("journal entry is not valid JSON", { cause: error });
|
|
302
292
|
}
|
|
303
|
-
const entry = validateEntry(value);
|
|
304
293
|
if (canonicalValue(value) !== body)
|
|
305
294
|
throw new AuthorityCorruptionError("journal entry is not canonical");
|
|
306
|
-
return
|
|
295
|
+
return validateEntry(value);
|
|
307
296
|
}
|
|
308
297
|
export function decodeJournal(journal) {
|
|
309
298
|
if (journal.length === 0)
|
|
310
299
|
return [];
|
|
311
300
|
if (journal.includes("\r") || !journal.endsWith("\n"))
|
|
312
301
|
throw new AuthorityCorruptionError("journal must use LF lines and end with LF");
|
|
313
|
-
return journal
|
|
314
|
-
.slice(0, -1)
|
|
315
|
-
.split("\n")
|
|
316
|
-
.map((line) => decodeEntry(line));
|
|
302
|
+
return journal.slice(0, -1).split("\n").map(decodeEntry);
|
|
317
303
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { KeiyakuError } from "../../errors.js";
|
|
2
|
+
export class AuthorityCorruptionError extends KeiyakuError {
|
|
2
3
|
constructor(message, options) {
|
|
3
|
-
super(message, options);
|
|
4
|
-
this.name = "AuthorityCorruptionError";
|
|
4
|
+
super("authority-corruption", message, options);
|
|
5
5
|
}
|
|
6
6
|
}
|
|
@@ -5,10 +5,8 @@ declare const snapshotIdBrand: unique symbol;
|
|
|
5
5
|
declare const changeIdBrand: unique symbol;
|
|
6
6
|
declare const documentKeyBrand: unique symbol;
|
|
7
7
|
declare const documentSegmentKeyBrand: unique symbol;
|
|
8
|
-
declare const gateBrand: unique symbol;
|
|
9
8
|
declare const requirementIdBrand: unique symbol;
|
|
10
9
|
declare const dependencyKeySetBrand: unique symbol;
|
|
11
|
-
declare const actorIdBrand: unique symbol;
|
|
12
10
|
export type ContractId = string & {
|
|
13
11
|
readonly [contractIdBrand]: "ContractId";
|
|
14
12
|
};
|
|
@@ -30,18 +28,13 @@ export type DocumentKey = string & {
|
|
|
30
28
|
export type DocumentSegmentKey = string & {
|
|
31
29
|
readonly [documentSegmentKeyBrand]: "DocumentSegmentKey";
|
|
32
30
|
};
|
|
33
|
-
export type Gate = string
|
|
34
|
-
readonly [gateBrand]: "Gate";
|
|
35
|
-
};
|
|
31
|
+
export type Gate = string;
|
|
36
32
|
export type RequirementId = string & {
|
|
37
33
|
readonly [requirementIdBrand]: "RequirementId";
|
|
38
34
|
};
|
|
39
35
|
export type DependencyKeySet = string & {
|
|
40
36
|
readonly [dependencyKeySetBrand]: "DependencyKeySet";
|
|
41
37
|
};
|
|
42
|
-
export type ActorId = string & {
|
|
43
|
-
readonly [actorIdBrand]: "ActorId";
|
|
44
|
-
};
|
|
45
38
|
export declare function contractId(value: string): ContractId;
|
|
46
39
|
export declare function contractIdFromSegment(segment: string): ContractId;
|
|
47
40
|
export declare function contractSegment(value: ContractId): string;
|
|
@@ -51,8 +44,6 @@ export declare function contractHead(value: string): ContractHead;
|
|
|
51
44
|
export declare function snapshotId(value: string): SnapshotId;
|
|
52
45
|
/** Validate an opaque persisted change value; only Git may mint one. */
|
|
53
46
|
export declare function changeId(value: string): ChangeId;
|
|
54
|
-
/** Validate optional opaque testimony without imposing a registry. */
|
|
55
|
-
export declare function actorId(value: string): ActorId;
|
|
56
47
|
export declare function documentKey(value: string): DocumentKey;
|
|
57
48
|
export declare function documentSegmentKey(value: string): DocumentSegmentKey;
|
|
58
49
|
export declare function requirementId(value: string): RequirementId;
|
|
@@ -129,7 +120,6 @@ type JournalEnvelope<Kind extends string, Data> = Readonly<{
|
|
|
129
120
|
contract: ContractId;
|
|
130
121
|
entry: EntryUlid;
|
|
131
122
|
at: string;
|
|
132
|
-
actor?: ActorId;
|
|
133
123
|
data: Data;
|
|
134
124
|
}>;
|
|
135
125
|
export type BindEntry = JournalEnvelope<"bind", BindData>;
|
|
@@ -144,12 +134,11 @@ export type JournalEntry = BindEntry | AmendEntry | DeliverEntry | ReintegratedE
|
|
|
144
134
|
export type FactKind = JournalEntry["kind"];
|
|
145
135
|
/**
|
|
146
136
|
* The one journal-envelope constructor for every verb offering a single fact: entry identity, the
|
|
147
|
-
* invoking decision input's Contract
|
|
137
|
+
* invoking decision input's Contract and timestamp, and the verb's own payload.
|
|
148
138
|
*/
|
|
149
139
|
export declare function journalEntry<Kind extends FactKind, Input extends Readonly<{
|
|
150
140
|
contractId: ContractId;
|
|
151
141
|
at: string;
|
|
152
|
-
actor?: ActorId;
|
|
153
142
|
}>>(kind: Kind, input: Input, entry: EntryUlid, data: Extract<JournalEntry, {
|
|
154
143
|
kind: Kind;
|
|
155
144
|
}>["data"]): Extract<JournalEntry, {
|
|
@@ -45,10 +45,6 @@ export function snapshotId(value) {
|
|
|
45
45
|
export function changeId(value) {
|
|
46
46
|
return requireOpaqueId(value, "change ID");
|
|
47
47
|
}
|
|
48
|
-
/** Validate optional opaque testimony without imposing a registry. */
|
|
49
|
-
export function actorId(value) {
|
|
50
|
-
return requireOpaqueId(value, "actor");
|
|
51
|
-
}
|
|
52
48
|
export function documentKey(value) {
|
|
53
49
|
return requireOpaqueId(value, "document key");
|
|
54
50
|
}
|
|
@@ -72,7 +68,7 @@ export function targetName(target) {
|
|
|
72
68
|
}
|
|
73
69
|
/**
|
|
74
70
|
* The one journal-envelope constructor for every verb offering a single fact: entry identity, the
|
|
75
|
-
* invoking decision input's Contract
|
|
71
|
+
* invoking decision input's Contract and timestamp, and the verb's own payload.
|
|
76
72
|
*/
|
|
77
73
|
export function journalEntry(kind, input, entry, data) {
|
|
78
74
|
return {
|
|
@@ -81,7 +77,6 @@ export function journalEntry(kind, input, entry, data) {
|
|
|
81
77
|
contract: input.contractId,
|
|
82
78
|
entry,
|
|
83
79
|
at: input.at,
|
|
84
|
-
...(input.actor === undefined ? {} : { actor: input.actor }),
|
|
85
80
|
data,
|
|
86
81
|
};
|
|
87
82
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { DecideInput, OfferDecision } from "../decide.js";
|
|
2
2
|
import { type ActiveContractRefusal } from "../facts/observation.js";
|
|
3
|
-
import { type
|
|
3
|
+
import { type ContractId } from "../facts/types.js";
|
|
4
4
|
export type AbandonInput = Readonly<{
|
|
5
5
|
contractId: ContractId;
|
|
6
|
-
actor?: ActorId;
|
|
7
6
|
at: string;
|
|
8
7
|
note?: string;
|
|
9
8
|
}>;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { DecideInput, OfferDecision, Preparation } from "../decide.js";
|
|
2
|
-
import { type
|
|
2
|
+
import { type AmendData, type ContractId, type ContractTerms } from "../facts/types.js";
|
|
3
3
|
export type AmendInput<Failure = never> = Readonly<{
|
|
4
4
|
contractId: ContractId;
|
|
5
|
-
actor?: ActorId;
|
|
6
5
|
at: string;
|
|
7
6
|
source?: ContractTerms;
|
|
8
7
|
preparation?: Preparation<AmendData, Failure>;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { DecideInput, OfferDecision } from "../decide.js";
|
|
2
2
|
import { type ActiveContractRefusal } from "../facts/observation.js";
|
|
3
|
-
import { type
|
|
3
|
+
import { type ContractId } from "../facts/types.js";
|
|
4
4
|
export type ArcInput = Readonly<{
|
|
5
5
|
contractId: ContractId;
|
|
6
|
-
actor?: ActorId;
|
|
7
6
|
at: string;
|
|
8
7
|
data: Readonly<{
|
|
9
8
|
title: string;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { DecideInput, OfferDecision, Preparation } from "../decide.js";
|
|
2
2
|
import { type ActiveContractRefusal } from "../facts/observation.js";
|
|
3
|
-
import { type
|
|
3
|
+
import { type AttestationData, type ContractId } from "../facts/types.js";
|
|
4
4
|
export type AttestationInput<Failure = never> = Readonly<{
|
|
5
5
|
contractId: ContractId;
|
|
6
|
-
actor?: ActorId;
|
|
7
6
|
at: string;
|
|
8
7
|
preparation?: Preparation<AttestationData, Failure>;
|
|
9
8
|
}>;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { DecideInput, OfferDecision, Preparation } from "../decide.js";
|
|
2
2
|
import { type TargetContractRefusal } from "../facts/observation.js";
|
|
3
|
-
import { type
|
|
3
|
+
import { type BindData, type ContractId } from "../facts/types.js";
|
|
4
4
|
export type BindInput<Failure = never> = Readonly<{
|
|
5
5
|
contractId: ContractId;
|
|
6
|
-
actor?: ActorId;
|
|
7
6
|
at: string;
|
|
8
7
|
preparation: Preparation<BindData, Failure>;
|
|
9
8
|
targetContract?: ContractId;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { DecideInput, OfferDecision, StampedPreparation } from "../decide.js";
|
|
2
2
|
import { type TargetContractRefusal } from "../facts/observation.js";
|
|
3
|
-
import { type
|
|
3
|
+
import { type ContractId, type DeliverData } from "../facts/types.js";
|
|
4
4
|
export type DeliverInput<Failure = never> = Readonly<{
|
|
5
5
|
contractId: ContractId;
|
|
6
|
-
actor?: ActorId;
|
|
7
6
|
at: string;
|
|
8
7
|
preparation: StampedPreparation<DeliverData, Failure>;
|
|
9
8
|
}>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { type GateReport } from "../facts/gate.js";
|
|
2
2
|
import { type TargetContractRefusal } from "../facts/observation.js";
|
|
3
|
-
import { type
|
|
3
|
+
import { type ContractId, type ContractState } from "../facts/types.js";
|
|
4
4
|
import type { DecideInput, OfferDecision } from "../decide.js";
|
|
5
5
|
type PlacementInput = Readonly<{
|
|
6
6
|
contractId: ContractId;
|
|
7
|
-
actor?: ActorId;
|
|
8
7
|
at: string;
|
|
9
8
|
}>;
|
|
10
9
|
type UnmetPrerequisite = Readonly<{
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { DecideInput, OfferDecision, Preparation } from "../decide.js";
|
|
2
2
|
import { type TargetContractRefusal } from "../facts/observation.js";
|
|
3
|
-
import { type
|
|
3
|
+
import { type ContractId, type ReintegratedData } from "../facts/types.js";
|
|
4
4
|
export type ReintegrateInput<Failure = never> = Readonly<{
|
|
5
5
|
contractId: ContractId;
|
|
6
|
-
actor?: ActorId;
|
|
7
6
|
at: string;
|
|
8
7
|
preparation: Preparation<ReintegratedData, Failure>;
|
|
9
8
|
}>;
|