@astrosheep/keiyaku 4.0.0 → 4.0.2
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 +133 -8
- package/build/integrations/marketplace/plugins/keiyaku/.claude-plugin/plugin.json +2 -2
- package/build/integrations/marketplace/plugins/keiyaku/.codex-plugin/plugin.json +4 -4
- package/build/integrations/marketplace/plugins/keiyaku/opencode.js +2 -2
- package/build/integrations/marketplace/plugins/keiyaku/package.json +2 -2
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku/SKILL.md +13 -5
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/SKILL.md +91 -32
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-bind/SKILL.md +134 -0
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-bind/agents/openai.yaml +4 -0
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-task/SKILL.md +41 -6
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-workflow/SKILL.md +262 -46
- package/build/src/akuma/abort.d.ts +2 -0
- package/build/src/akuma/abort.js +50 -0
- package/build/src/akuma/akuma.d.ts +50 -33
- package/build/src/akuma/akuma.js +175 -127
- package/build/src/akuma/archetype.d.ts +14 -5
- package/build/src/akuma/archetype.js +85 -39
- package/build/src/akuma/body.d.ts +3 -5
- package/build/src/akuma/body.js +490 -183
- package/build/src/akuma/coordinate.d.ts +9 -0
- package/build/src/akuma/coordinate.js +22 -0
- package/build/src/akuma/heart/facts.d.ts +88 -45
- package/build/src/akuma/heart/facts.js +19 -8
- package/build/src/akuma/heart/index.d.ts +64 -55
- package/build/src/akuma/heart/index.js +172 -252
- package/build/src/akuma/heart/rows.d.ts +38 -83
- package/build/src/akuma/heart/rows.js +117 -155
- package/build/src/akuma/heart/schema.d.ts +1 -1
- package/build/src/akuma/heart/schema.js +61 -22
- package/build/src/akuma/heart/soul.d.ts +8 -0
- package/build/src/akuma/heart/soul.js +136 -0
- package/build/src/akuma/heart/storage.d.ts +47 -0
- package/build/src/akuma/heart/storage.js +224 -0
- package/build/src/akuma/heart/tells.d.ts +12 -0
- package/build/src/akuma/heart/tells.js +79 -0
- package/build/src/akuma/heart/timeline.d.ts +15 -0
- package/build/src/akuma/heart/timeline.js +86 -0
- package/build/src/akuma/identity.d.ts +2 -2
- package/build/src/akuma/identity.js +9 -9
- package/build/src/akuma/index.d.ts +10 -3
- package/build/src/akuma/index.js +7 -1
- package/build/src/akuma/projection.d.ts +176 -0
- package/build/src/akuma/projection.js +256 -0
- package/build/src/akuma/provider-recipe.d.ts +24 -0
- package/build/src/akuma/provider-recipe.js +100 -0
- package/build/src/akuma/provider.d.ts +67 -13
- package/build/src/akuma/provider.js +172 -105
- package/build/src/akuma/providers/acp/core.d.ts +19 -0
- package/build/src/akuma/providers/acp/core.js +159 -0
- package/build/src/akuma/providers/acp/events.d.ts +20 -0
- package/build/src/akuma/providers/acp/events.js +73 -0
- package/build/src/akuma/providers/acp/index.d.ts +12 -0
- package/build/src/akuma/providers/acp/index.js +94 -0
- package/build/src/akuma/providers/{claude.d.ts → claude/events.d.ts} +9 -41
- package/build/src/akuma/providers/claude/events.js +238 -0
- package/build/src/akuma/providers/claude/index.d.ts +47 -0
- package/build/src/akuma/providers/claude/index.js +279 -0
- package/build/src/akuma/providers/claude/input.d.ts +13 -0
- package/build/src/akuma/providers/claude/input.js +109 -0
- package/build/src/akuma/providers/codex-app-server/events.d.ts +1 -1
- package/build/src/akuma/providers/codex-app-server/events.js +15 -12
- package/build/src/akuma/providers/codex-app-server/index.d.ts +15 -13
- package/build/src/akuma/providers/codex-app-server/index.js +77 -33
- package/build/src/akuma/providers/grok-build/index.d.ts +4 -0
- package/build/src/akuma/providers/grok-build/index.js +70 -0
- package/build/src/akuma/providers/index.d.ts +5 -3
- package/build/src/akuma/providers/index.js +35 -56
- package/build/src/akuma/providers/opencode-sdk/events.d.ts +54 -0
- package/build/src/akuma/providers/opencode-sdk/events.js +235 -0
- package/build/src/akuma/providers/opencode-sdk/index.d.ts +33 -0
- package/build/src/akuma/providers/opencode-sdk/index.js +308 -0
- package/build/src/akuma/providers/opencode-sdk/session.d.ts +26 -0
- package/build/src/akuma/providers/opencode-sdk/session.js +63 -0
- package/build/src/akuma/providers/pi/events.d.ts +33 -0
- package/build/src/akuma/providers/pi/events.js +166 -0
- package/build/src/akuma/providers/pi/index.d.ts +11 -0
- package/build/src/akuma/providers/pi/index.js +191 -0
- package/build/src/akuma/publication.d.ts +3 -3
- package/build/src/akuma/publication.js +28 -40
- package/build/src/akuma/requests.d.ts +9 -6
- package/build/src/akuma/requests.js +95 -65
- package/build/src/alias/index.d.ts +4 -3
- package/build/src/alias/index.js +12 -13
- package/build/src/body/decode.js +7 -1
- package/build/src/body/region.d.ts +2 -0
- package/build/src/body/region.js +77 -7
- package/build/src/body/render.js +2 -1
- package/build/src/body/shape.js +7 -1
- package/build/src/body/verification.js +19 -4
- package/build/src/cli/accepted.d.ts +18 -12
- package/build/src/cli/accepted.js +73 -34
- package/build/src/cli/actor.js +3 -3
- package/build/src/cli/commands/akuma-invoke.d.ts +44 -19
- package/build/src/cli/commands/akuma-invoke.js +101 -52
- package/build/src/cli/commands/akuma.d.ts +27 -9
- package/build/src/cli/commands/akuma.js +151 -80
- package/build/src/cli/commands/contract.d.ts +155 -0
- package/build/src/cli/commands/contract.js +20 -0
- package/build/src/cli/commands/install.js +2 -0
- package/build/src/cli/commands/task-invoke.d.ts +19 -4
- package/build/src/cli/commands/task-invoke.js +65 -17
- package/build/src/cli/commands/task-query.d.ts +5 -0
- package/build/src/cli/commands/task-query.js +247 -0
- package/build/src/cli/commands/task.d.ts +3 -1
- package/build/src/cli/commands/task.js +52 -14
- package/build/src/cli/coordinates.d.ts +18 -0
- package/build/src/cli/coordinates.js +120 -0
- package/build/src/cli/draft.d.ts +8 -0
- package/build/src/cli/draft.js +96 -0
- package/build/src/cli/invoke.d.ts +9 -3
- package/build/src/cli/invoke.js +287 -108
- package/build/src/cli/main.js +54 -7
- package/build/src/cli/parse.d.ts +21 -117
- package/build/src/cli/parse.js +79 -84
- package/build/src/cli/render/akuma-tool-command.d.ts +6 -0
- package/build/src/cli/render/akuma-tool-command.js +144 -0
- package/build/src/cli/render/akuma-tool.d.ts +4 -2
- package/build/src/cli/render/akuma-tool.js +35 -5
- package/build/src/cli/render/akuma.d.ts +3 -1
- package/build/src/cli/render/akuma.js +247 -212
- package/build/src/cli/render/audit.d.ts +3 -0
- package/build/src/cli/render/audit.js +104 -0
- package/build/src/cli/render/catalog.d.ts +2 -0
- package/build/src/cli/render/catalog.js +16 -0
- package/build/src/cli/render/contract.d.ts +3 -3
- package/build/src/cli/render/contract.js +200 -54
- package/build/src/cli/render/kanshi.js +272 -129
- package/build/src/cli/render/receipt.d.ts +19 -0
- package/build/src/cli/render/receipt.js +106 -0
- package/build/src/cli/render/refusal.d.ts +16 -2
- package/build/src/cli/render/refusal.js +88 -3
- package/build/src/cli/render/region.d.ts +2 -0
- package/build/src/cli/render/region.js +17 -0
- package/build/src/cli/render/task.d.ts +2 -1
- package/build/src/cli/render/task.js +223 -60
- package/build/src/cli/render/terminal.d.ts +20 -0
- package/build/src/cli/render/terminal.js +121 -0
- package/build/src/cli/render/text.js +11 -3
- package/build/src/cli/result.d.ts +126 -19
- package/build/src/cli/usage.d.ts +1 -0
- package/build/src/cli/usage.js +3 -0
- package/build/src/contract-worktree.d.ts +44 -0
- package/build/src/contract-worktree.js +251 -0
- package/build/src/coordination/durable-file.d.ts +5 -1
- package/build/src/coordination/durable-file.js +57 -10
- package/build/src/coordination/sqlite-transaction-lock.d.ts +4 -0
- package/build/src/coordination/sqlite-transaction-lock.js +22 -5
- package/build/src/core/facts/codec.js +23 -4
- package/build/src/core/facts/eligibility.d.ts +1 -10
- package/build/src/core/facts/eligibility.js +0 -49
- package/build/src/core/facts/fold.js +1 -6
- package/build/src/core/facts/gate.d.ts +1 -0
- package/build/src/core/facts/gate.js +1 -0
- package/build/src/core/facts/observation.d.ts +3 -0
- package/build/src/core/facts/observation.js +12 -0
- package/build/src/core/facts/types.d.ts +10 -3
- package/build/src/core/subject.js +2 -2
- package/build/src/core/verbs/amend.d.ts +1 -1
- package/build/src/core/verbs/amend.js +3 -18
- package/build/src/core/verbs/bind.js +2 -16
- package/build/src/core/verbs/deliver.d.ts +1 -1
- package/build/src/core/verbs/deliver.js +14 -4
- package/build/src/core/verbs/placement.d.ts +1 -1
- package/build/src/core/verbs/placement.js +7 -9
- package/build/src/dispatch/index.d.ts +5 -3
- package/build/src/dispatch/index.js +30 -21
- package/build/src/duration.d.ts +10 -0
- package/build/src/duration.js +22 -0
- package/build/src/git/admission.d.ts +2 -2
- package/build/src/git/admission.js +33 -23
- package/build/src/git/hooks.d.ts +15 -0
- package/build/src/git/hooks.js +70 -18
- package/build/src/git/identity.d.ts +5 -1
- package/build/src/git/identity.js +23 -4
- package/build/src/git/integration.d.ts +48 -0
- package/build/src/git/integration.js +250 -0
- package/build/src/git/observe.d.ts +29 -15
- package/build/src/git/observe.js +185 -76
- package/build/src/git/read-observation.d.ts +41 -0
- package/build/src/git/read-observation.js +361 -0
- package/build/src/git/reconcile.d.ts +17 -5
- package/build/src/git/reconcile.js +305 -109
- package/build/src/git/repository.d.ts +41 -18
- package/build/src/git/repository.js +220 -114
- package/build/src/git/scratch.d.ts +17 -0
- package/build/src/git/scratch.js +73 -0
- package/build/src/git/target-placement.d.ts +92 -0
- package/build/src/git/target-placement.js +375 -0
- package/build/src/git/tender.d.ts +49 -0
- package/build/src/git/tender.js +63 -0
- package/build/src/git/terminal-seal.d.ts +24 -0
- package/build/src/git/terminal-seal.js +89 -0
- package/build/src/git/tree.d.ts +2 -2
- package/build/src/git/tree.js +4 -0
- package/build/src/git/workspace.d.ts +53 -0
- package/build/src/git/workspace.js +139 -0
- package/build/src/identity/selector.d.ts +6 -0
- package/build/src/identity/selector.js +19 -0
- package/build/src/index.d.ts +4 -2
- package/build/src/index.js +2 -1
- package/build/src/kanshi/index.d.ts +2 -2
- package/build/src/kanshi/index.js +1 -1
- package/build/src/kanshi/read.d.ts +7 -3
- package/build/src/kanshi/read.js +245 -45
- package/build/src/kanshi/report.d.ts +81 -6
- package/build/src/kanshi/select.d.ts +5 -0
- package/build/src/kanshi/select.js +33 -1
- package/build/src/library/address.d.ts +57 -0
- package/build/src/library/address.js +165 -0
- package/build/src/library/akuma-creation.d.ts +16 -7
- package/build/src/library/akuma-creation.js +96 -22
- package/build/src/library/audit.d.ts +18 -0
- package/build/src/library/audit.js +44 -0
- package/build/src/library/bind.d.ts +21 -0
- package/build/src/library/bind.js +56 -0
- package/build/src/library/catalog.d.ts +58 -0
- package/build/src/library/catalog.js +69 -0
- package/build/src/library/configuration.d.ts +6 -15
- package/build/src/library/configuration.js +14 -17
- package/build/src/library/contract.d.ts +23 -49
- package/build/src/library/contract.js +171 -185
- package/build/src/library/delivery.d.ts +24 -0
- package/build/src/library/delivery.js +21 -0
- package/build/src/library/fleet.d.ts +65 -0
- package/build/src/library/fleet.js +153 -0
- package/build/src/library/input.d.ts +3 -0
- package/build/src/library/input.js +19 -0
- package/build/src/library/keiyaku.d.ts +18 -3
- package/build/src/library/keiyaku.js +12 -1
- package/build/src/library/mutation.d.ts +39 -0
- package/build/src/library/mutation.js +37 -0
- package/build/src/library/reconcile.d.ts +29 -0
- package/build/src/library/reconcile.js +179 -0
- package/build/src/library/refusal.d.ts +21 -0
- package/build/src/library/refusal.js +29 -0
- package/build/src/library/region.d.ts +14 -1
- package/build/src/library/region.js +18 -4
- package/build/src/library/repo.d.ts +4 -13
- package/build/src/library/repo.js +14 -24
- package/build/src/protocol/attempt.d.ts +16 -3
- package/build/src/protocol/attempt.js +41 -10
- package/build/src/protocol/bind.d.ts +9 -2
- package/build/src/protocol/bind.js +48 -40
- package/build/src/protocol/intent.d.ts +57 -20
- package/build/src/protocol/intent.js +55 -79
- package/build/src/protocol/operations.d.ts +152 -43
- package/build/src/protocol/operations.js +482 -166
- package/build/src/protocol/outcome.d.ts +14 -3
- package/build/src/protocol/outcome.js +11 -3
- package/build/src/protocol/placement.d.ts +41 -0
- package/build/src/protocol/placement.js +147 -0
- package/build/src/protocol/read/documents.d.ts +2 -2
- package/build/src/protocol/read/documents.js +4 -4
- package/build/src/protocol/read/status.d.ts +18 -5
- package/build/src/protocol/read/status.js +73 -13
- package/build/src/protocol/run.d.ts +49 -7
- package/build/src/protocol/run.js +53 -25
- package/build/src/runtime/proc/line-rpc.d.ts +4 -8
- package/build/src/runtime/proc/line-rpc.js +22 -28
- package/build/src/runtime/proc/run.d.ts +23 -21
- package/build/src/runtime/proc/run.js +123 -89
- package/build/src/runtime/proc/stdio.d.ts +18 -0
- package/build/src/runtime/proc/stdio.js +58 -0
- package/build/src/settings.d.ts +7 -1
- package/build/src/settings.js +32 -17
- package/build/src/settlement/fence.d.ts +5 -0
- package/build/src/settlement/fence.js +14 -0
- package/build/src/settlement/holder.d.ts +35 -4
- package/build/src/settlement/holder.js +127 -28
- package/build/src/settlement/settle.d.ts +9 -1
- package/build/src/settlement/settle.js +74 -37
- package/build/src/task/board.d.ts +23 -5
- package/build/src/task/board.js +17 -10
- package/build/src/task/compose.d.ts +2 -2
- package/build/src/task/compose.js +18 -10
- package/build/src/task/context.d.ts +3 -3
- package/build/src/task/context.js +15 -20
- package/build/src/task/document.d.ts +2 -1
- package/build/src/task/document.js +15 -5
- package/build/src/task/index.d.ts +27 -15
- package/build/src/task/index.js +57 -35
- package/build/src/task/operations.d.ts +38 -13
- package/build/src/task/operations.js +80 -46
- package/build/src/task/query.d.ts +67 -0
- package/build/src/task/query.js +279 -0
- package/build/src/task/store.d.ts +5 -7
- package/build/src/task/store.js +43 -28
- package/build/src/verification/declaration.d.ts +1 -0
- package/build/src/verification/execution.d.ts +51 -0
- package/build/src/verification/execution.js +108 -0
- package/build/src/workspace-place.d.ts +41 -0
- package/build/src/workspace-place.js +386 -0
- package/build/src/world.d.ts +24 -0
- package/build/src/world.js +136 -0
- package/package.json +8 -4
- package/build/src/akuma/activity.d.ts +0 -66
- package/build/src/akuma/activity.js +0 -139
- package/build/src/akuma/providers/claude.js +0 -305
- package/build/src/context-root.d.ts +0 -4
- package/build/src/context-root.js +0 -15
- package/build/src/git/delivery.d.ts +0 -20
- package/build/src/git/delivery.js +0 -109
- package/build/src/git/verification.d.ts +0 -14
- package/build/src/git/verification.js +0 -56
- package/build/src/protocol/read/audit.d.ts +0 -25
- package/build/src/protocol/read/audit.js +0 -39
- package/build/src/verification/producer.d.ts +0 -23
- package/build/src/verification/producer.js +0 -54
|
@@ -1,26 +1,17 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { SettingsError, type Settings } from "../settings.js";
|
|
2
|
+
import type { WorktreeHooks } from "../git/hooks.js";
|
|
3
|
+
export type { HookCommand, WorktreeHooks } from "../git/hooks.js";
|
|
2
4
|
export type Gate = string;
|
|
3
5
|
export type GatesFromInput = Readonly<{
|
|
4
6
|
settings: Settings;
|
|
5
7
|
name?: string;
|
|
6
8
|
}>;
|
|
7
|
-
export type
|
|
8
|
-
argv: readonly string[];
|
|
9
|
-
timeoutMs: number;
|
|
10
|
-
}>;
|
|
11
|
-
export type WorktreeHooks = Readonly<{
|
|
12
|
-
create: readonly HookCommand[];
|
|
13
|
-
destroy: readonly HookCommand[];
|
|
14
|
-
}>;
|
|
15
|
-
export type WorktreeHooksFromInput = Readonly<{
|
|
9
|
+
export type RequireBranchesToBeUpToDateFromInput = Readonly<{
|
|
16
10
|
settings: Settings;
|
|
17
11
|
}>;
|
|
18
|
-
export
|
|
19
|
-
readonly kind = "settings";
|
|
20
|
-
constructor(message: string);
|
|
21
|
-
}
|
|
12
|
+
export { SettingsError };
|
|
22
13
|
export declare function gatesFrom(input: GatesFromInput): readonly Gate[];
|
|
23
|
-
export declare function
|
|
14
|
+
export declare function requireBranchesToBeUpToDateFrom(input: RequireBranchesToBeUpToDateFromInput): boolean;
|
|
24
15
|
export declare function normalizedWorktreeHooks(value: unknown): WorktreeHooks;
|
|
25
16
|
export declare const EMPTY_WORKTREE_HOOKS: WorktreeHooks;
|
|
26
17
|
export declare function worktreeHooksOption(value: unknown): WorktreeHooks;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { gateWord } from "../core/facts/types.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
constructor(message) {
|
|
5
|
-
super(message);
|
|
6
|
-
this.name = "SettingsError";
|
|
7
|
-
}
|
|
8
|
-
}
|
|
2
|
+
import { SettingsError } from "../settings.js";
|
|
3
|
+
export { SettingsError };
|
|
9
4
|
function record(value) {
|
|
10
5
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
11
6
|
}
|
|
@@ -62,22 +57,24 @@ function commands(value, coordinate, ErrorType) {
|
|
|
62
57
|
throw new ErrorType(`${coordinate} must be an array`);
|
|
63
58
|
return Object.freeze(value.map((item, index) => command(item, `${coordinate}[${index}]`, ErrorType)));
|
|
64
59
|
}
|
|
65
|
-
export function
|
|
60
|
+
export function requireBranchesToBeUpToDateFrom(input) {
|
|
66
61
|
if (!record(input))
|
|
67
|
-
throw new TypeError("
|
|
68
|
-
const view = input.settings.namespace("
|
|
62
|
+
throw new TypeError("requireBranchesToBeUpToDateFrom input must be an object");
|
|
63
|
+
const view = input.settings.namespace("git");
|
|
69
64
|
if (view.kind === "failed")
|
|
70
65
|
namespaceFailure(view);
|
|
71
66
|
for (const entry of view.entries) {
|
|
72
|
-
if (entry.name !== "
|
|
73
|
-
throw new SettingsError(`
|
|
67
|
+
if (entry.name !== "requireBranchesToBeUpToDate") {
|
|
68
|
+
throw new SettingsError(`git has unknown entry: ${entry.name}`);
|
|
74
69
|
}
|
|
75
70
|
}
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
return
|
|
79
|
-
|
|
80
|
-
|
|
71
|
+
const selected = view.entries.find((entry) => entry.name === "requireBranchesToBeUpToDate");
|
|
72
|
+
if (selected === undefined)
|
|
73
|
+
return false;
|
|
74
|
+
if (typeof selected.value !== "boolean") {
|
|
75
|
+
throw new SettingsError("git.requireBranchesToBeUpToDate must be a boolean");
|
|
76
|
+
}
|
|
77
|
+
return selected.value;
|
|
81
78
|
}
|
|
82
79
|
export function normalizedWorktreeHooks(value) {
|
|
83
80
|
if (!record(value))
|
|
@@ -1,54 +1,42 @@
|
|
|
1
|
+
import { type ContractFileEffect, type ContractFileLag } from "../contract-worktree.js";
|
|
1
2
|
import { type RegionObservation, type RegionOverlap } from "./region.js";
|
|
2
3
|
import { type Gate, type WorktreeHooks } from "./configuration.js";
|
|
3
|
-
import { type ChangeId, type
|
|
4
|
+
import { type ChangeId, type ContractId, type ContractState, type JournalEntry, type SnapshotId } from "../core/facts/types.js";
|
|
4
5
|
export { AuthorityCorruptionError } from "../core/facts/errors.js";
|
|
5
|
-
import { type AuditReport, type ContractBoard, type ContractDisposition, type ContractGateCurrent, type ContractGateReport, type ContractObservation, type ContractPhase, type ContractRow, type
|
|
6
|
+
import { type AuditReport, type ContractBoard, type ContractDisposition, type ContractGateCurrent, type ContractGateReport, type ContractObservation, type ContractPhase, type ContractRow, type FactKind, type PlacementStop, type ReconcileReport as ProtocolReconcileReport, type RepositoryScope, type ReviewValue, type VerificationReuse, type VerificationStop, type DeliveryPreparationRefusal } from "../protocol/operations.js";
|
|
6
7
|
import { type SettlementReport } from "../settlement/settle.js";
|
|
7
|
-
import { type TaskHolder } from "../settlement/holder.js";
|
|
8
8
|
import { type TaskId } from "../task/identity.js";
|
|
9
9
|
import { Repo, type ReconcileInput } from "./repo.js";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
import { type AuditInput } from "./audit.js";
|
|
11
|
+
import { Delivery } from "./delivery.js";
|
|
12
|
+
import { type MutationResult } from "./mutation.js";
|
|
13
|
+
export { KeiyakuRefused, KeiyakuRetry, type ContractAppointmentRefusal, type KeiyakuRefusal, type KeiyakuRetryReason, } from "./refusal.js";
|
|
14
|
+
export { gatesFrom, requireBranchesToBeUpToDateFrom, SettingsError } from "./configuration.js";
|
|
15
|
+
export type { Gate, GatesFromInput, HookCommand, RequireBranchesToBeUpToDateFromInput, WorktreeHooks } from "./configuration.js";
|
|
16
|
+
export type { AuditReport, DeliveryPreparationRefusal, ChangeId, ContractId, ContractState, ContractBoard, ContractDisposition, ContractGateCurrent, ContractGateReport, ContractObservation, ContractPhase, ContractRow, FactKind, SnapshotId, };
|
|
13
17
|
export type { TaskId };
|
|
14
18
|
export type { RegionOverlap };
|
|
15
19
|
export type Fact = JournalEntry;
|
|
16
20
|
export type ActorId = string;
|
|
17
21
|
export type AttestationVerdict = "satisfied" | "unsatisfied";
|
|
18
22
|
export type Review = ReviewValue;
|
|
19
|
-
export type
|
|
20
|
-
export type
|
|
21
|
-
export type
|
|
22
|
-
export type
|
|
23
|
-
export
|
|
24
|
-
export type MutationResult<Value> = Readonly<{
|
|
25
|
-
facts: readonly Fact[];
|
|
26
|
-
head: ContractHead;
|
|
27
|
-
value: Value;
|
|
28
|
-
effects: readonly TopologyEffect[];
|
|
29
|
-
lags: readonly Lag[];
|
|
30
|
-
settlement: SettlementReport;
|
|
31
|
-
}>;
|
|
23
|
+
export type { PlacementStop, VerificationReuse, VerificationStop };
|
|
24
|
+
export type TopologyEffect = ProtocolReconcileReport["effects"][number] | ContractFileEffect;
|
|
25
|
+
export type Lag = ProtocolReconcileReport["lag"][number] | ContractFileLag;
|
|
26
|
+
export type { MutationResult };
|
|
27
|
+
export { Delivery };
|
|
32
28
|
export type BindResult = Readonly<Omit<MutationResult<Keiyaku>, "value"> & {
|
|
33
29
|
keiyaku: Keiyaku;
|
|
34
30
|
} & RegionObservation>;
|
|
35
31
|
export type AmendResult = Readonly<MutationResult<void> & RegionObservation & {
|
|
36
32
|
documentDiff: string;
|
|
37
33
|
}>;
|
|
38
|
-
export type ReconcileReport = Readonly<
|
|
34
|
+
export type ReconcileReport = Readonly<{
|
|
35
|
+
effects: readonly TopologyEffect[];
|
|
36
|
+
lag: readonly Lag[];
|
|
39
37
|
settlement: SettlementReport;
|
|
40
38
|
}>;
|
|
41
39
|
export type { SettlementAction, SettlementLag, SettlementReport } from "../settlement/settle.js";
|
|
42
|
-
export declare class KeiyakuRefused extends Error {
|
|
43
|
-
readonly refusal: KeiyakuRefusal;
|
|
44
|
-
constructor(refusal: KeiyakuRefusal);
|
|
45
|
-
get code(): KeiyakuRefusal["kind"];
|
|
46
|
-
}
|
|
47
|
-
export declare class KeiyakuRetry extends Error {
|
|
48
|
-
readonly reason: KeiyakuRetryReason;
|
|
49
|
-
constructor(reason: KeiyakuRetryReason);
|
|
50
|
-
get code(): KeiyakuRetryReason["kind"];
|
|
51
|
-
}
|
|
52
40
|
export type BindInput = Readonly<{
|
|
53
41
|
repo: Repo;
|
|
54
42
|
markdown: string;
|
|
@@ -98,29 +86,17 @@ export type AbandonInput = ActorOptions & Readonly<{
|
|
|
98
86
|
}>;
|
|
99
87
|
export type DeliverInput = ActorOptions & Readonly<{
|
|
100
88
|
message?: string;
|
|
89
|
+
requireBranchesToBeUpToDate?: boolean;
|
|
90
|
+
includeDirty?: boolean;
|
|
91
|
+
signal?: AbortSignal;
|
|
101
92
|
}>;
|
|
102
|
-
export type AuditInput
|
|
103
|
-
declare class DeliveryHandle {
|
|
104
|
-
readonly snapshotId: SnapshotId;
|
|
105
|
-
readonly changeId: ChangeId;
|
|
106
|
-
readonly expectedPredecessor: SnapshotId;
|
|
107
|
-
private readonly readDiff;
|
|
108
|
-
readonly verification?: DeliverValue["verification"];
|
|
109
|
-
readonly placement?: DeliverValue["placement"];
|
|
110
|
-
readonly leak?: DeliverValue["leak"];
|
|
111
|
-
constructor(snapshotId: SnapshotId, changeId: ChangeId, expectedPredecessor: SnapshotId, readDiff: () => Promise<string | null>, outcomes?: Partial<Pick<DeliverValue, "verification" | "placement" | "leak">>);
|
|
112
|
-
diff(): Promise<string | null>;
|
|
113
|
-
}
|
|
114
|
-
export type Delivery = DeliveryHandle;
|
|
115
|
-
export declare const Delivery: Readonly<{
|
|
116
|
-
prototype: DeliveryHandle;
|
|
117
|
-
[Symbol.hasInstance](value: unknown): boolean;
|
|
118
|
-
}>;
|
|
93
|
+
export type { AuditInput };
|
|
119
94
|
export declare class KeiyakuHandle {
|
|
120
95
|
private readonly id;
|
|
121
96
|
private readonly scope;
|
|
122
97
|
constructor(id: ContractId, scope: RepositoryScope);
|
|
123
98
|
state(): Promise<ContractState>;
|
|
99
|
+
guidance(): Promise<string>;
|
|
124
100
|
delivery(): Promise<Delivery | null>;
|
|
125
101
|
amend(input: AmendInput): Promise<AmendResult>;
|
|
126
102
|
deliver(input?: DeliverInput): Promise<MutationResult<Delivery>>;
|
|
@@ -141,5 +117,3 @@ export declare function keiyakuOf(input: KeiyakuOfInput): Keiyaku;
|
|
|
141
117
|
export declare function listKeiyaku(input: ContractListInput): Promise<ContractBoard>;
|
|
142
118
|
export declare function observeKeiyaku(input: ContractObservationInput): Promise<ContractObservation>;
|
|
143
119
|
export declare function bindKeiyaku(input: BindInput): Promise<BindResult>;
|
|
144
|
-
/** Internal package composition read used by Kanshi; not a package-root export. */
|
|
145
|
-
export declare function taskHoldersForRepo(repo: Repo): readonly TaskHolder[];
|
|
@@ -2,46 +2,26 @@ import { documentDiff } from "../markdown/diff.js";
|
|
|
2
2
|
import { applyAmendDocument } from "../body/amend.js";
|
|
3
3
|
import { decodeArcDocument } from "../body/arc.js";
|
|
4
4
|
import { decodeContractDocument } from "../body/decode.js";
|
|
5
|
-
import {
|
|
5
|
+
import { renderContractGuidance, } from "../contract-worktree.js";
|
|
6
|
+
import { actorOption, contractTerms, documentDerivation, normalizedGates, normalizedList, optionalBoolean, optionalNonblank, optionalSignal, requireInput, requireMarkdown, } from "./input.js";
|
|
6
7
|
import { observeRegion } from "./region.js";
|
|
7
|
-
import { worktreeHooksOption
|
|
8
|
+
import { worktreeHooksOption } from "./configuration.js";
|
|
8
9
|
import { contractId, } from "../core/facts/types.js";
|
|
9
10
|
export { AuthorityCorruptionError } from "../core/facts/errors.js";
|
|
10
|
-
import { abandonOperation, amendOperation, arcOperation,
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { abandonOperation, amendOperation, arcOperation, contractObservationOperation, contractsOperation, deliveryDiffOperation, deliverOperation, deliveryOperation, reviewOperation, stateOperation, } from "../protocol/operations.js";
|
|
12
|
+
import { withGitDecodeChannel } from "../git/read-observation.js";
|
|
13
|
+
import { claimTaskHolderWithFence, releaseTaskHolder, releaseTaskHolderWithFence, taskHolderObservationSelection, } from "../settlement/holder.js";
|
|
13
14
|
import { parseTaskId } from "../task/identity.js";
|
|
14
15
|
import { reconcileInput, scopeForRepo } from "./repo.js";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return this.refusal.kind;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
export class KeiyakuRetry extends Error {
|
|
28
|
-
reason;
|
|
29
|
-
constructor(reason) {
|
|
30
|
-
super(reason.kind === "publication-failed" ? reason.diagnostic : `Keiyaku retry required: ${reason.kind}`);
|
|
31
|
-
this.reason = reason;
|
|
32
|
-
this.name = "KeiyakuRetry";
|
|
33
|
-
}
|
|
34
|
-
get code() {
|
|
35
|
-
return this.reason.kind;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function requireAccepted(result) {
|
|
39
|
-
if (result.kind === "refused")
|
|
40
|
-
throw new KeiyakuRefused(result.refusal);
|
|
41
|
-
if (result.kind === "retry")
|
|
42
|
-
throw new KeiyakuRetry(result.reason);
|
|
43
|
-
return result;
|
|
44
|
-
}
|
|
16
|
+
import { auditContract } from "./audit.js";
|
|
17
|
+
import { Delivery, deliveryHandle } from "./delivery.js";
|
|
18
|
+
import { completeHolderMutation, completeMutation, } from "./mutation.js";
|
|
19
|
+
import { completeReconcile } from "./reconcile.js";
|
|
20
|
+
import { admitBindWithAppointment } from "./bind.js";
|
|
21
|
+
import { KeiyakuRefused, requireAccepted } from "./refusal.js";
|
|
22
|
+
export { KeiyakuRefused, KeiyakuRetry, } from "./refusal.js";
|
|
23
|
+
export { gatesFrom, requireBranchesToBeUpToDateFrom, SettingsError } from "./configuration.js";
|
|
24
|
+
export { Delivery };
|
|
45
25
|
function taskOption(value) {
|
|
46
26
|
if (value === undefined)
|
|
47
27
|
return undefined;
|
|
@@ -55,38 +35,9 @@ function taskOption(value) {
|
|
|
55
35
|
}
|
|
56
36
|
return value;
|
|
57
37
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const settlement = await settle({ repository: scope, state: reconciled.state, effects: reconciled.report.effects });
|
|
61
|
-
return {
|
|
62
|
-
facts: accepted.facts,
|
|
63
|
-
head: accepted.head,
|
|
64
|
-
value: value(accepted.value),
|
|
65
|
-
effects: reconciled.report.effects,
|
|
66
|
-
lags: reconciled.report.lag,
|
|
67
|
-
settlement,
|
|
68
|
-
};
|
|
38
|
+
function completion(scope, channel, id, value, hooks) {
|
|
39
|
+
return { scope, channel, contractId: id, value, hooks };
|
|
69
40
|
}
|
|
70
|
-
class DeliveryHandle {
|
|
71
|
-
snapshotId;
|
|
72
|
-
changeId;
|
|
73
|
-
expectedPredecessor;
|
|
74
|
-
readDiff;
|
|
75
|
-
constructor(snapshotId, changeId, expectedPredecessor, readDiff, outcomes = {}) {
|
|
76
|
-
this.snapshotId = snapshotId;
|
|
77
|
-
this.changeId = changeId;
|
|
78
|
-
this.expectedPredecessor = expectedPredecessor;
|
|
79
|
-
this.readDiff = readDiff;
|
|
80
|
-
Object.assign(this, outcomes);
|
|
81
|
-
}
|
|
82
|
-
diff() {
|
|
83
|
-
return this.readDiff();
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
function handleType(prototype, hasInstance) {
|
|
87
|
-
return Object.freeze({ prototype, [Symbol.hasInstance]: hasInstance });
|
|
88
|
-
}
|
|
89
|
-
export const Delivery = handleType(DeliveryHandle.prototype, (value) => value instanceof DeliveryHandle);
|
|
90
41
|
export class KeiyakuHandle {
|
|
91
42
|
id;
|
|
92
43
|
scope;
|
|
@@ -96,10 +47,26 @@ export class KeiyakuHandle {
|
|
|
96
47
|
KEIYAKU_SEATS.set(this, { id, scope });
|
|
97
48
|
}
|
|
98
49
|
async state() {
|
|
99
|
-
return
|
|
50
|
+
return withGitDecodeChannel(this.scope, (channel) => stateOperation({
|
|
51
|
+
scope: this.scope,
|
|
52
|
+
channel,
|
|
53
|
+
contractId: this.id,
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
async guidance() {
|
|
57
|
+
return withGitDecodeChannel(this.scope, async (channel) => {
|
|
58
|
+
const observed = await contractObservationOperation({ scope: this.scope, channel, contractId: this.id });
|
|
59
|
+
if (observed.kind === "missing")
|
|
60
|
+
throw new KeiyakuRefused({ kind: "contract-missing", contractId: this.id });
|
|
61
|
+
return renderContractGuidance(await stateOperation({ scope: this.scope, channel, contractId: this.id }));
|
|
62
|
+
});
|
|
100
63
|
}
|
|
101
64
|
async delivery() {
|
|
102
|
-
const delivery =
|
|
65
|
+
const delivery = await withGitDecodeChannel(this.scope, (channel) => deliveryOperation({
|
|
66
|
+
scope: this.scope,
|
|
67
|
+
channel,
|
|
68
|
+
contractId: this.id,
|
|
69
|
+
}));
|
|
103
70
|
return delivery === null
|
|
104
71
|
? null
|
|
105
72
|
: this.deliveryHandle(delivery);
|
|
@@ -113,53 +80,57 @@ export class KeiyakuHandle {
|
|
|
113
80
|
const prerequisites = values.after === undefined
|
|
114
81
|
? undefined
|
|
115
82
|
: normalizedList(values.after, "after", contractId);
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
...await mutationResult(this.scope, this.id, accepted, () => undefined, hooks),
|
|
142
|
-
documentDiff: documentDiff("before", "after", before, after),
|
|
143
|
-
...observeRegion(this.scope, this.id, document.region),
|
|
144
|
-
};
|
|
83
|
+
return withGitDecodeChannel(this.scope, async (channel) => {
|
|
84
|
+
const accepted = requireAccepted(await amendOperation({
|
|
85
|
+
scope: this.scope,
|
|
86
|
+
channel,
|
|
87
|
+
contractId: this.id,
|
|
88
|
+
...actor,
|
|
89
|
+
deriveAmendment: (source) => {
|
|
90
|
+
const document = decodeContractDocument(applyAmendDocument(markdown, decodeContractDocument(source.document.bytes)));
|
|
91
|
+
const terms = contractTerms(document, gates ?? source.gates, prerequisites ?? source.after);
|
|
92
|
+
return {
|
|
93
|
+
terms,
|
|
94
|
+
verification: documentDerivation(document, terms.gates, this.id).verification,
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
}));
|
|
98
|
+
const document = decodeContractDocument(accepted.value.terms.document.bytes);
|
|
99
|
+
return {
|
|
100
|
+
...await completeMutation({
|
|
101
|
+
...completion(this.scope, channel, this.id, () => undefined, hooks),
|
|
102
|
+
accepted,
|
|
103
|
+
}),
|
|
104
|
+
documentDiff: documentDiff("before", "after", accepted.value.source.document.bytes, accepted.value.terms.document.bytes),
|
|
105
|
+
...await observeRegion(this.scope, channel, this.id, document.region),
|
|
106
|
+
};
|
|
107
|
+
});
|
|
145
108
|
}
|
|
146
109
|
async deliver(input) {
|
|
147
110
|
const values = input === undefined ? undefined : requireInput(input, "deliver input");
|
|
148
111
|
const hooks = worktreeHooksOption(values?.hooks);
|
|
149
112
|
const message = optionalNonblank(values?.message, "deliver message");
|
|
113
|
+
const requireBranchesToBeUpToDate = optionalBoolean(values?.requireBranchesToBeUpToDate, "requireBranchesToBeUpToDate") ?? false;
|
|
114
|
+
const includeDirty = optionalBoolean(values?.includeDirty, "includeDirty") ?? false;
|
|
150
115
|
const actor = actorOption(values?.actor);
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
116
|
+
const signal = optionalSignal(values?.signal);
|
|
117
|
+
return withGitDecodeChannel(this.scope, async (channel) => {
|
|
118
|
+
const accepted = requireAccepted(await deliverOperation({
|
|
119
|
+
scope: this.scope,
|
|
120
|
+
channel,
|
|
121
|
+
contractId: this.id,
|
|
122
|
+
deriveDocument: (state) => documentDerivation(decodeContractDocument(state.terms.document.bytes), state.terms.gates, state.id),
|
|
123
|
+
...actor,
|
|
124
|
+
...(message === undefined ? {} : { message }),
|
|
125
|
+
requireBranchesToBeUpToDate,
|
|
126
|
+
includeDirty,
|
|
127
|
+
...(signal === undefined ? {} : { signal }),
|
|
128
|
+
}));
|
|
129
|
+
return completeMutation({
|
|
130
|
+
...completion(this.scope, channel, this.id, (delivery) => this.deliveryHandle(delivery), hooks),
|
|
131
|
+
accepted,
|
|
132
|
+
});
|
|
133
|
+
});
|
|
163
134
|
}
|
|
164
135
|
async review(input) {
|
|
165
136
|
const values = requireInput(input, "review input");
|
|
@@ -169,73 +140,82 @@ export class KeiyakuHandle {
|
|
|
169
140
|
throw new TypeError("verdict must be satisfied or unsatisfied");
|
|
170
141
|
}
|
|
171
142
|
const summary = optionalNonblank(values.summary, "review summary");
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
143
|
+
return withGitDecodeChannel(this.scope, async (channel) => {
|
|
144
|
+
const accepted = requireAccepted(await reviewOperation({
|
|
145
|
+
scope: this.scope,
|
|
146
|
+
channel,
|
|
147
|
+
contractId: this.id,
|
|
148
|
+
verdict,
|
|
149
|
+
...(summary === undefined ? {} : { summary }),
|
|
150
|
+
...actorOption(values.actor),
|
|
151
|
+
}));
|
|
152
|
+
return completeMutation({
|
|
153
|
+
...completion(this.scope, channel, this.id, (value) => value, hooks),
|
|
154
|
+
accepted,
|
|
155
|
+
});
|
|
156
|
+
});
|
|
180
157
|
}
|
|
181
158
|
async abandon(input) {
|
|
182
159
|
const values = input === undefined ? undefined : requireInput(input, "abandon input");
|
|
183
160
|
const hooks = worktreeHooksOption(values?.hooks);
|
|
184
161
|
const note = optionalNonblank(values?.note, "abandon note");
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
162
|
+
return withGitDecodeChannel(this.scope, async (channel) => {
|
|
163
|
+
const admission = await releaseTaskHolderWithFence(this.scope, channel, this.id, () => abandonOperation({
|
|
164
|
+
scope: this.scope,
|
|
165
|
+
channel,
|
|
166
|
+
contractId: this.id,
|
|
167
|
+
...actorOption(values?.actor),
|
|
168
|
+
...(note === undefined ? {} : { note }),
|
|
169
|
+
observationSelection: taskHolderObservationSelection(),
|
|
170
|
+
decorateOffer: async ({ observation, contractId: owner }) => {
|
|
171
|
+
const companion = await releaseTaskHolder(channel, observation, owner);
|
|
172
|
+
return companion === null ? [] : [companion];
|
|
173
|
+
},
|
|
174
|
+
}));
|
|
175
|
+
return completeHolderMutation({
|
|
176
|
+
completion: completion(this.scope, channel, this.id, () => undefined, hooks),
|
|
177
|
+
admission,
|
|
178
|
+
requireAccepted,
|
|
179
|
+
});
|
|
180
|
+
});
|
|
196
181
|
}
|
|
197
182
|
async arc(input) {
|
|
198
183
|
const values = requireInput(input, "arc input");
|
|
199
184
|
const hooks = worktreeHooksOption(values.hooks);
|
|
200
185
|
const chapter = decodeArcDocument(requireMarkdown(values.markdown));
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
186
|
+
return withGitDecodeChannel(this.scope, async (channel) => {
|
|
187
|
+
const accepted = requireAccepted(await arcOperation({
|
|
188
|
+
scope: this.scope,
|
|
189
|
+
channel,
|
|
190
|
+
contractId: this.id,
|
|
191
|
+
...actorOption(values.actor),
|
|
192
|
+
chapter,
|
|
193
|
+
}));
|
|
194
|
+
return completeMutation({
|
|
195
|
+
...completion(this.scope, channel, this.id, () => undefined, hooks),
|
|
196
|
+
accepted,
|
|
197
|
+
});
|
|
198
|
+
});
|
|
208
199
|
}
|
|
209
200
|
async audit(input) {
|
|
210
|
-
|
|
211
|
-
const hooks = worktreeHooksOption(values?.hooks);
|
|
212
|
-
const actor = actorOption(values?.actor);
|
|
213
|
-
const state = readStateOperation({ scope: this.scope, contractId: this.id });
|
|
214
|
-
const derivation = state === null
|
|
215
|
-
? undefined
|
|
216
|
-
: documentDerivation(decodeContractDocument(state.terms.document.bytes), state.terms.gates, state.id);
|
|
217
|
-
const accepted = requireAccepted(await auditOperation({
|
|
201
|
+
return auditContract({
|
|
218
202
|
scope: this.scope,
|
|
219
203
|
contractId: this.id,
|
|
220
|
-
...(
|
|
221
|
-
|
|
222
|
-
}));
|
|
223
|
-
return mutationResult(this.scope, this.id, accepted, (report) => report, hooks);
|
|
204
|
+
...(input === undefined ? {} : { input }),
|
|
205
|
+
});
|
|
224
206
|
}
|
|
225
207
|
async reconcile(input) {
|
|
226
208
|
const options = reconcileInput(input);
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
settlement: await settle({ repository: this.scope, state: reconciled.state, effects: reconciled.report.effects }),
|
|
231
|
-
};
|
|
209
|
+
return withGitDecodeChannel(this.scope, (channel) => completeReconcile({
|
|
210
|
+
scope: this.scope, channel, contractId: this.id, ...options,
|
|
211
|
+
}));
|
|
232
212
|
}
|
|
233
213
|
deliveryHandle(delivery) {
|
|
234
|
-
return
|
|
214
|
+
return deliveryHandle(delivery, () => deliveryDiffOperation({
|
|
235
215
|
scope: this.scope,
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
})
|
|
216
|
+
integrationPredecessor: delivery.integration.predecessor,
|
|
217
|
+
integrationSnapshot: delivery.integration.snapshot,
|
|
218
|
+
}));
|
|
239
219
|
}
|
|
240
220
|
}
|
|
241
221
|
const KEIYAKU_SEATS = new WeakMap();
|
|
@@ -260,7 +240,8 @@ export async function listKeiyaku(input) {
|
|
|
260
240
|
for (const key of Object.keys(values))
|
|
261
241
|
if (key !== "repo")
|
|
262
242
|
throw new TypeError(`Keiyaku.list input has unknown field: ${key}`);
|
|
263
|
-
|
|
243
|
+
const scope = scopeForRepo(values.repo);
|
|
244
|
+
return withGitDecodeChannel(scope, (channel) => contractsOperation({ scope, channel }));
|
|
264
245
|
}
|
|
265
246
|
export async function observeKeiyaku(input) {
|
|
266
247
|
const values = requireInput(input, "Keiyaku.observe input");
|
|
@@ -277,7 +258,7 @@ export async function observeKeiyaku(input) {
|
|
|
277
258
|
catch (error) {
|
|
278
259
|
throw new TypeError(error instanceof Error ? error.message : "contract ID is invalid");
|
|
279
260
|
}
|
|
280
|
-
return contractObservationOperation({ scope, contractId: id });
|
|
261
|
+
return withGitDecodeChannel(scope, (channel) => contractObservationOperation({ scope, channel, contractId: id }));
|
|
281
262
|
}
|
|
282
263
|
export async function bindKeiyaku(input) {
|
|
283
264
|
const values = requireInput(input, "Keiyaku.bind input");
|
|
@@ -294,32 +275,37 @@ export async function bindKeiyaku(input) {
|
|
|
294
275
|
throw new TypeError("target must be a string");
|
|
295
276
|
const actor = actorOption(values.actor);
|
|
296
277
|
const terms = contractTerms(document, normalizedGates(values.gates), normalizedList(values.after, "after", contractId));
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
278
|
+
return withGitDecodeChannel(scope, async (channel) => {
|
|
279
|
+
const admitCandidate = () => admitBindWithAppointment({
|
|
280
|
+
scope,
|
|
281
|
+
channel,
|
|
282
|
+
title: document.title,
|
|
283
|
+
terms,
|
|
284
|
+
verification: documentDerivation(document, terms.gates).verification,
|
|
285
|
+
workspace,
|
|
286
|
+
...(target === undefined ? {} : { target }),
|
|
287
|
+
...(task === undefined ? {} : { task }),
|
|
288
|
+
...actor,
|
|
289
|
+
});
|
|
290
|
+
const admission = task === undefined ? null : await claimTaskHolderWithFence(scope, task, admitCandidate);
|
|
291
|
+
const accepted = requireAccepted(admission === null ? await admitCandidate() : admission.result);
|
|
292
|
+
const id = accepted.value.contractId;
|
|
293
|
+
const toHandle = ({ contractId: contract }) => new KeiyakuHandle(contract, scope);
|
|
294
|
+
const result = admission === null
|
|
295
|
+
? await completeMutation({ ...completion(scope, channel, id, toHandle, hooks), accepted })
|
|
296
|
+
: await completeHolderMutation({
|
|
297
|
+
completion: completion(scope, channel, id, toHandle, hooks),
|
|
298
|
+
admission,
|
|
299
|
+
requireAccepted,
|
|
300
|
+
});
|
|
301
|
+
return {
|
|
302
|
+
facts: result.facts,
|
|
303
|
+
head: result.head,
|
|
304
|
+
keiyaku: result.value,
|
|
305
|
+
effects: result.effects,
|
|
306
|
+
lags: result.lags,
|
|
307
|
+
settlement: result.settlement,
|
|
308
|
+
...await observeRegion(scope, channel, id, document.region),
|
|
309
|
+
};
|
|
308
310
|
});
|
|
309
|
-
const accepted = requireAccepted(admitted);
|
|
310
|
-
const id = accepted.value.contractId;
|
|
311
|
-
const result = await mutationResult(scope, id, accepted, ({ contractId: contract }) => new KeiyakuHandle(contract, scope), hooks);
|
|
312
|
-
return {
|
|
313
|
-
facts: result.facts,
|
|
314
|
-
head: result.head,
|
|
315
|
-
keiyaku: result.value,
|
|
316
|
-
effects: result.effects,
|
|
317
|
-
lags: result.lags,
|
|
318
|
-
settlement: result.settlement,
|
|
319
|
-
...observeRegion(scope, id, document.region),
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
|
-
/** Internal package composition read used by Kanshi; not a package-root export. */
|
|
323
|
-
export function taskHoldersForRepo(repo) {
|
|
324
|
-
return readTaskHolders(scopeForRepo(repo));
|
|
325
311
|
}
|