@astrosheep/keiyaku 4.5.6 → 4.5.8
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 +10 -0
- package/build/integrations/marketplace/plugins/keiyaku/.claude-plugin/plugin.json +1 -1
- package/build/integrations/marketplace/plugins/keiyaku/.codex-plugin/plugin.json +1 -1
- package/build/integrations/marketplace/plugins/keiyaku/opencode.js +3 -2
- package/build/integrations/marketplace/plugins/keiyaku/package.json +1 -1
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku/SKILL.md +10 -8
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/SKILL.md +22 -1
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-babysit/SKILL.md +53 -0
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-bind/SKILL.md +28 -49
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-task/SKILL.md +21 -15
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-workflow/SKILL.md +148 -89
- package/build/src/akuma/abort.d.ts +2 -1
- package/build/src/akuma/abort.js +6 -23
- package/build/src/akuma/akuma-handle.js +4 -2
- package/build/src/akuma/akuma-observe.d.ts +2 -0
- package/build/src/akuma/akuma-observe.js +1 -0
- package/build/src/akuma/akuma-product.js +9 -7
- package/build/src/akuma/akuma.d.ts +372 -9
- package/build/src/akuma/akuma.js +31 -1
- package/build/src/akuma/allowed.d.ts +1 -1
- package/build/src/akuma/allowed.js +1 -0
- package/build/src/akuma/body.d.ts +7 -5
- package/build/src/akuma/body.js +25 -36
- package/build/src/akuma/call-request.d.ts +80 -0
- package/build/src/akuma/call-request.js +211 -0
- package/build/src/akuma/heart/facts.d.ts +6 -78
- package/build/src/akuma/heart/index.d.ts +3 -3
- package/build/src/akuma/heart/index.js +2 -2
- package/build/src/akuma/heart/request-authority.d.ts +6 -4
- package/build/src/akuma/heart/request-authority.js +31 -35
- package/build/src/akuma/heart/request-rows.js +12 -23
- package/build/src/akuma/heart/schema.d.ts +1 -1
- package/build/src/akuma/heart/schema.js +5 -13
- package/build/src/akuma/heart/storage.d.ts +0 -1
- package/build/src/akuma/heart/storage.js +0 -54
- package/build/src/akuma/index.d.ts +1 -1
- package/build/src/akuma/index.js +1 -1
- package/build/src/akuma/projection-read.d.ts +1 -0
- package/build/src/akuma/projection-read.js +8 -1
- package/build/src/akuma/projection.d.ts +856 -137
- package/build/src/akuma/projection.js +190 -0
- package/build/src/akuma/provider.d.ts +30 -3
- package/build/src/akuma/provider.js +104 -0
- package/build/src/akuma/providers/acp/core.d.ts +2 -2
- package/build/src/akuma/providers/acp/core.js +13 -6
- package/build/src/akuma/providers/acp/index.js +5 -4
- package/build/src/akuma/providers/claude/index.d.ts +3 -3
- package/build/src/akuma/providers/claude/index.js +16 -5
- package/build/src/akuma/providers/codex-app-server/events.js +1 -1
- package/build/src/akuma/providers/codex-app-server/index.js +18 -6
- package/build/src/akuma/providers/grok-build/index.js +5 -4
- package/build/src/akuma/providers/opencode-sdk/index.js +66 -25
- package/build/src/akuma/providers/opencode-sdk/session.d.ts +3 -2
- package/build/src/akuma/providers/opencode-sdk/session.js +28 -11
- package/build/src/akuma/providers/pi/index.js +42 -14
- package/build/src/akuma/publication.js +75 -13
- package/build/src/akuma/request-lifecycle.d.ts +3 -9
- package/build/src/akuma/request-lifecycle.js +12 -25
- package/build/src/akuma/request-rendezvous.d.ts +26 -0
- package/build/src/akuma/request-rendezvous.js +100 -0
- package/build/src/akuma/request-serve.d.ts +5 -65
- package/build/src/akuma/request-serve.js +92 -204
- package/build/src/akuma/request-wire.d.ts +109 -115
- package/build/src/akuma/request-wire.js +63 -318
- package/build/src/akuma/requests.d.ts +19 -47
- package/build/src/akuma/requests.js +51 -107
- package/build/src/akuma/turn-drive.d.ts +5 -3
- package/build/src/akuma/turn-drive.js +32 -10
- package/build/src/akuma-body.d.ts +7 -2
- package/build/src/akuma-body.js +68 -46
- package/build/src/cli/accepted.d.ts +1 -1
- package/build/src/cli/accepted.js +2 -2
- package/build/src/cli/commands/akuma-invoke.d.ts +2 -0
- package/build/src/cli/commands/akuma-invoke.js +17 -9
- package/build/src/cli/commands/akuma.js +7 -7
- package/build/src/cli/commands/contract-invoke.d.ts +3 -2
- package/build/src/cli/commands/contract-invoke.js +26 -19
- package/build/src/cli/commands/contract.d.ts +13 -13
- package/build/src/cli/commands/contract.js +32 -17
- package/build/src/cli/commands/install.d.ts +1 -1
- package/build/src/cli/commands/install.js +1 -1
- package/build/src/cli/commands/task-invoke.d.ts +7 -2
- package/build/src/cli/commands/task-invoke.js +67 -158
- package/build/src/cli/commands/task.d.ts +1 -1
- package/build/src/cli/commands/task.js +60 -22
- package/build/src/cli/coordinates.d.ts +2 -0
- package/build/src/cli/coordinates.js +18 -2
- package/build/src/cli/invoke.js +39 -25
- package/build/src/cli/main.js +2 -1
- package/build/src/cli/parse.d.ts +2 -2
- package/build/src/cli/parse.js +37 -22
- package/build/src/cli/render/akuma-activity.d.ts +4 -1
- package/build/src/cli/render/akuma-activity.js +45 -30
- package/build/src/cli/render/akuma-tool.d.ts +5 -1
- package/build/src/cli/render/akuma.js +5 -9
- package/build/src/cli/render/audit.js +1 -1
- package/build/src/cli/render/catalog.js +80 -21
- package/build/src/cli/render/contract-observation.d.ts +2 -0
- package/build/src/cli/render/contract-observation.js +11 -0
- package/build/src/cli/render/contract.js +25 -65
- package/build/src/cli/render/kanshi-akuma.d.ts +8 -0
- package/build/src/cli/render/kanshi-akuma.js +111 -0
- package/build/src/cli/render/kanshi.js +108 -213
- package/build/src/cli/render/receipt.d.ts +1 -2
- package/build/src/cli/render/receipt.js +76 -26
- package/build/src/cli/render/refusal.js +2 -10
- package/build/src/cli/render/region.js +5 -2
- package/build/src/cli/render/settings.d.ts +1 -1
- package/build/src/cli/render/settings.js +27 -8
- package/build/src/cli/render/task.js +28 -10
- package/build/src/cli/render/terminal.d.ts +28 -0
- package/build/src/cli/render/terminal.js +65 -0
- package/build/src/cli/result.d.ts +3 -3
- package/build/src/cli/runtime.js +3 -1
- package/build/src/cli/selectors.d.ts +2 -1
- package/build/src/cli/selectors.js +4 -3
- package/build/src/cli/square-edge.js +120 -36
- package/build/src/cli/usage.js +2 -1
- package/build/src/contract-guidance.d.ts +5 -0
- package/build/src/contract-guidance.js +121 -0
- package/build/src/contract-worktree.d.ts +0 -1
- package/build/src/contract-worktree.js +32 -83
- package/build/src/coordination/sqlite-transaction-lock.d.ts +1 -0
- package/build/src/coordination/sqlite-transaction-lock.js +5 -0
- package/build/src/core/facts/codec.d.ts +2 -0
- package/build/src/core/facts/codec.js +4 -0
- package/build/src/core/verbs/placement.d.ts +6 -1
- package/build/src/core/verbs/placement.js +5 -3
- package/build/src/dispatch/index.d.ts +0 -2
- package/build/src/dispatch/index.js +54 -55
- package/build/src/git/admission.js +2 -2
- package/build/src/git/hooks.d.ts +9 -15
- package/build/src/git/hooks.js +23 -317
- package/build/src/git/nuke.d.ts +2 -1
- package/build/src/git/nuke.js +36 -18
- package/build/src/git/private-state-seat.d.ts +12 -0
- package/build/src/git/private-state-seat.js +39 -0
- package/build/src/git/process.d.ts +6 -0
- package/build/src/git/process.js +19 -7
- package/build/src/git/read-observation.js +29 -20
- package/build/src/git/reconcile.d.ts +11 -0
- package/build/src/git/reconcile.js +64 -11
- package/build/src/git/repository.d.ts +8 -2
- package/build/src/git/repository.js +42 -21
- package/build/src/git/target-placement.d.ts +1 -0
- package/build/src/git/target-placement.js +5 -6
- package/build/src/git/tender.d.ts +1 -0
- package/build/src/git/terminal-reconcile.d.ts +1 -1
- package/build/src/git/terminal-reconcile.js +22 -20
- package/build/src/git/workspace.d.ts +14 -0
- package/build/src/git/workspace.js +44 -0
- package/build/src/kanshi/index.d.ts +1 -1
- package/build/src/kanshi/read.js +16 -16
- package/build/src/kanshi/report.d.ts +2 -2
- package/build/src/library/address.d.ts +9 -3
- package/build/src/library/address.js +3 -2
- package/build/src/library/akuma-creation.d.ts +4 -3
- package/build/src/library/akuma-creation.js +19 -13
- package/build/src/library/audit.d.ts +1 -1
- package/build/src/library/audit.js +5 -3
- package/build/src/library/catalog.d.ts +3 -1
- package/build/src/library/catalog.js +20 -6
- package/build/src/library/composition.d.ts +371 -0
- package/build/src/library/composition.js +28 -0
- package/build/src/library/configuration.js +8 -2
- package/build/src/library/continuation.js +66 -30
- package/build/src/library/contract-bind.js +10 -2
- package/build/src/library/contract-forwarding-reconciliation-result.d.ts +96 -0
- package/build/src/library/contract-forwarding-reconciliation-result.js +83 -0
- package/build/src/library/contract-forwarding-result.d.ts +6723 -0
- package/build/src/library/contract-forwarding-result.js +521 -0
- package/build/src/library/contract-forwarding.d.ts +72 -0
- package/build/src/library/contract-forwarding.js +125 -0
- package/build/src/library/contract-handle.d.ts +36 -0
- package/build/src/library/contract-handle.js +313 -0
- package/build/src/library/contract-operations.d.ts +1044 -67
- package/build/src/library/contract-operations.js +190 -118
- package/build/src/library/contract.d.ts +11 -32
- package/build/src/library/contract.js +16 -289
- package/build/src/library/fleet-result.d.ts +1454 -0
- package/build/src/library/fleet-result.js +96 -0
- package/build/src/library/fleet.d.ts +112 -54
- package/build/src/library/fleet.js +211 -71
- package/build/src/library/input.d.ts +2 -0
- package/build/src/library/input.js +4 -0
- package/build/src/library/keiyaku.d.ts +371 -20
- package/build/src/library/keiyaku.js +8 -21
- package/build/src/library/mutation.d.ts +3 -3
- package/build/src/library/mutation.js +5 -9
- package/build/src/library/nuke.d.ts +1 -1
- package/build/src/library/nuke.js +4 -3
- package/build/src/library/reconcile.d.ts +4 -0
- package/build/src/library/reconcile.js +2 -0
- package/build/src/library/refusal.d.ts +0 -9
- package/build/src/library/refusal.js +0 -7
- package/build/src/protocol/amend.js +56 -50
- package/build/src/protocol/attempt.d.ts +2 -0
- package/build/src/protocol/attempt.js +17 -5
- package/build/src/protocol/completion.js +7 -0
- package/build/src/protocol/deliver.js +6 -2
- package/build/src/protocol/operations.d.ts +4 -1
- package/build/src/protocol/operations.js +5 -2
- package/build/src/protocol/placement.d.ts +1 -0
- package/build/src/protocol/placement.js +52 -38
- package/build/src/protocol/read/observation.d.ts +1 -4
- package/build/src/protocol/read/observation.js +2 -15
- package/build/src/protocol/reintegrate.js +62 -58
- package/build/src/protocol/review.js +5 -0
- package/build/src/protocol/run.js +17 -13
- package/build/src/runtime/proc/run.d.ts +8 -0
- package/build/src/runtime/proc/run.js +27 -0
- package/build/src/runtime/proc/termination.js +26 -22
- package/build/src/runtime/proc/windows-launch.exe +0 -0
- package/build/src/settlement/holder.d.ts +2 -1
- package/build/src/settlement/holder.js +15 -4
- package/build/src/settlement/settle.js +99 -33
- package/build/src/task/board.d.ts +68 -27
- package/build/src/task/board.js +31 -1
- package/build/src/task/catalog.d.ts +4 -0
- package/build/src/task/catalog.js +23 -0
- package/build/src/task/compose-language.d.ts +4 -0
- package/build/src/task/compose-language.js +40 -7
- package/build/src/task/compose-parser.d.ts +2 -1
- package/build/src/task/compose-parser.js +5 -3
- package/build/src/task/compose.d.ts +1 -0
- package/build/src/task/compose.js +4 -1
- package/build/src/task/context.d.ts +7 -1
- package/build/src/task/context.js +25 -6
- package/build/src/task/index.d.ts +18 -5
- package/build/src/task/index.js +97 -16
- package/build/src/task/mutation-result.d.ts +923 -0
- package/build/src/task/mutation-result.js +140 -0
- package/build/src/task/mutation.d.ts +552 -28
- package/build/src/task/mutation.js +304 -97
- package/build/src/task/operations.d.ts +1 -4
- package/build/src/task/operations.js +0 -6
- package/build/src/task/public.d.ts +2 -0
- package/build/src/task/public.js +1 -0
- package/build/src/workspace-place.d.ts +7 -2
- package/build/src/workspace-place.js +34 -24
- package/build/src/world.d.ts +1 -0
- package/build/src/world.js +11 -0
- package/package.json +8 -6
- package/build/src/akuma/request-execution.d.ts +0 -8
- package/build/src/akuma/request-execution.js +0 -98
|
@@ -1,299 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { decodeArcDocument } from "../body/arc.js";
|
|
4
|
-
import { decodeContractDocument } from "../body/decode.js";
|
|
5
|
-
import { renderContractGuidance } from "../contract-worktree.js";
|
|
6
|
-
import { actorOption, contractTerms, documentDerivation, normalizedGates, normalizedList, optionalBoolean, optionalNonblank, optionalSignal, requireInput, requireMarkdown, } from "./input.js";
|
|
7
|
-
import { observeChangedRegion } from "./region.js";
|
|
8
|
-
import { worktreeHooksOption } from "./configuration.js";
|
|
1
|
+
// Contract's static facade deliberately depends only on construction and observation.
|
|
2
|
+
import { requireInput } from "./input.js";
|
|
9
3
|
import { contractId, } from "../core/facts/types.js";
|
|
10
4
|
export { AuthorityCorruptionError } from "../core/facts/errors.js";
|
|
11
|
-
import { contractObservationOperation, contractsOperation,
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { mintSnapshotId } from "../git/identity.js";
|
|
17
|
-
import { observeContractsForAdmissionInObservationAt } from "../git/observe.js";
|
|
18
|
-
import { withGitDecodeChannel, withGitReadObservation } from "../git/read-observation.js";
|
|
19
|
-
import { releaseTaskHolder, releaseTaskHolderWithFence, taskHolderObservationSelection } from "../settlement/holder.js";
|
|
20
|
-
import { reconcileInput, scopeForRepo } from "./repo.js";
|
|
21
|
-
import { injectedBodyRequests, requestBodyDeliver, requestBodyReview } from "../akuma/requests.js";
|
|
22
|
-
import { auditContract } from "./audit.js";
|
|
23
|
-
import { Delivery, deliveryHandle } from "./delivery.js";
|
|
24
|
-
import { completionInput, completeHolderMutation, completeMutation } from "./mutation.js";
|
|
25
|
-
import { completeReconcile } from "./reconcile.js";
|
|
5
|
+
import { contractObservationOperation, contractsOperation, } from "../protocol/operations.js";
|
|
6
|
+
import { withGitDecodeChannel } from "../git/read-observation.js";
|
|
7
|
+
import { scopeForRepo } from "./repo.js";
|
|
8
|
+
import { localExecutionContext } from "../akuma/requests.js";
|
|
9
|
+
import { Delivery } from "./delivery.js";
|
|
26
10
|
import { bindFromCli as bindFromCliImplementation, bindKeiyaku as bindKeiyakuImplementation } from "./contract-bind.js";
|
|
27
|
-
|
|
28
|
-
import {
|
|
11
|
+
export { KeiyakuHandle } from "./contract-handle.js";
|
|
12
|
+
import { KeiyakuHandle } from "./contract-handle.js";
|
|
13
|
+
import { KeiyakuRetry } from "./refusal.js";
|
|
29
14
|
export { KeiyakuRefused } from "./refusal.js";
|
|
30
15
|
export { KeiyakuRetry };
|
|
31
|
-
export { executeForwardedDeliver, executeForwardedReview } from "./contract-operations.js";
|
|
32
16
|
export { gatesFrom, requireBranchesToBeUpToDateFrom, SettingsError } from "./configuration.js";
|
|
33
17
|
export { Delivery };
|
|
34
|
-
export
|
|
35
|
-
id;
|
|
36
|
-
scope;
|
|
37
|
-
constructor(id, scope) {
|
|
38
|
-
this.id = id;
|
|
39
|
-
this.scope = scope;
|
|
40
|
-
KEIYAKU_SEATS.set(this, { id, scope });
|
|
41
|
-
}
|
|
42
|
-
async state() {
|
|
43
|
-
return withGitDecodeChannel(this.scope, (channel) => stateOperation({
|
|
44
|
-
scope: this.scope,
|
|
45
|
-
channel,
|
|
46
|
-
contractId: this.id,
|
|
47
|
-
}));
|
|
48
|
-
}
|
|
49
|
-
async history() {
|
|
50
|
-
return withGitDecodeChannel(this.scope, (channel) => withGitReadObservation(this.scope, channel, async (observation) => {
|
|
51
|
-
const [journals, dispatches] = await Promise.all([
|
|
52
|
-
observeContractsForAdmissionInObservationAt(observation, [this.id]),
|
|
53
|
-
readDispatchesAt(observation),
|
|
54
|
-
]);
|
|
55
|
-
const record = journals.journals.get(this.id);
|
|
56
|
-
if (record === undefined)
|
|
57
|
-
throw new Error(`missing requested contract observation: ${this.id}`);
|
|
58
|
-
if (record.state === null)
|
|
59
|
-
throw new KeiyakuRefused({ kind: "contract-missing", contractId: this.id });
|
|
60
|
-
const commit = observation.snapshot.commit;
|
|
61
|
-
if (commit === null)
|
|
62
|
-
throw new Error("contract history requires a keiyaku-state snapshot");
|
|
63
|
-
const recordedAt = (event) => event.source === "journal" ? event.fact.at : event.dispatch.dispatchedAt;
|
|
64
|
-
const events = [
|
|
65
|
-
...record.entries.map((fact) => ({ source: "journal", fact })),
|
|
66
|
-
...dispatches
|
|
67
|
-
.filter((dispatch) => dispatch.contractId === this.id)
|
|
68
|
-
.map((dispatch) => ({ source: "dispatch", dispatch })),
|
|
69
|
-
].sort((left, right) => {
|
|
70
|
-
const leftAt = recordedAt(left);
|
|
71
|
-
const rightAt = recordedAt(right);
|
|
72
|
-
if (leftAt !== rightAt)
|
|
73
|
-
return leftAt < rightAt ? -1 : 1;
|
|
74
|
-
if (left.source !== right.source)
|
|
75
|
-
return left.source === "journal" ? -1 : 1;
|
|
76
|
-
return 0;
|
|
77
|
-
});
|
|
78
|
-
return { id: this.id, state: mintSnapshotId(commit), events };
|
|
79
|
-
}));
|
|
80
|
-
}
|
|
81
|
-
async guidance() {
|
|
82
|
-
return withGitDecodeChannel(this.scope, async (channel) => {
|
|
83
|
-
const observed = await contractObservationOperation({ scope: this.scope, channel, contractId: this.id });
|
|
84
|
-
if (observed.kind === "missing")
|
|
85
|
-
throw new KeiyakuRefused({ kind: "contract-missing", contractId: this.id });
|
|
86
|
-
return renderContractGuidance(await stateOperation({ scope: this.scope, channel, contractId: this.id }));
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
async delivery() {
|
|
90
|
-
const delivery = await withGitDecodeChannel(this.scope, (channel) => deliveryOperation({
|
|
91
|
-
scope: this.scope,
|
|
92
|
-
channel,
|
|
93
|
-
contractId: this.id,
|
|
94
|
-
}));
|
|
95
|
-
return delivery === null ? null : this.deliveryHandle(delivery);
|
|
96
|
-
}
|
|
97
|
-
async amend(input) {
|
|
98
|
-
const values = requireInput(input, "amend input");
|
|
99
|
-
const hooks = worktreeHooksOption(values.hooks);
|
|
100
|
-
const markdown = values.markdown === undefined ? undefined : requireMarkdown(values.markdown);
|
|
101
|
-
const actor = actorOption(values.actor);
|
|
102
|
-
const gates = values.gates === undefined ? undefined : normalizedGates(values.gates);
|
|
103
|
-
const prerequisites = values.after === undefined ? undefined : normalizedList(values.after, "after", contractId);
|
|
104
|
-
if (markdown === undefined && gates === undefined && prerequisites === undefined) {
|
|
105
|
-
throw new TypeError("amend requires markdown, after, or gates");
|
|
106
|
-
}
|
|
107
|
-
const amendment = await withGitDecodeChannel(this.scope, async (channel) => {
|
|
108
|
-
let changedSections;
|
|
109
|
-
const accepted = requireAccepted(await amendOperation({
|
|
110
|
-
scope: this.scope,
|
|
111
|
-
channel,
|
|
112
|
-
contractId: this.id,
|
|
113
|
-
...actor,
|
|
114
|
-
deriveAmendment: (source) => {
|
|
115
|
-
const amendment = markdown === undefined
|
|
116
|
-
? undefined
|
|
117
|
-
: applyAmendDocument(markdown, decodeContractDocument(source.document.bytes));
|
|
118
|
-
changedSections = amendment?.changedSections;
|
|
119
|
-
const document = amendment === undefined
|
|
120
|
-
? decodeContractDocument(source.document.bytes)
|
|
121
|
-
: decodeContractDocument(amendment.document);
|
|
122
|
-
const terms = markdown === undefined
|
|
123
|
-
? {
|
|
124
|
-
document: source.document,
|
|
125
|
-
segments: source.segments,
|
|
126
|
-
gates: gates ?? source.gates,
|
|
127
|
-
after: prerequisites ?? source.after,
|
|
128
|
-
}
|
|
129
|
-
: contractTerms(document, gates ?? source.gates, prerequisites ?? source.after);
|
|
130
|
-
return {
|
|
131
|
-
terms,
|
|
132
|
-
verification: documentDerivation(document, terms.gates, this.id).verification,
|
|
133
|
-
};
|
|
134
|
-
},
|
|
135
|
-
}));
|
|
136
|
-
const completed = await completeMutation({
|
|
137
|
-
...completionInput(this.scope, channel, this.id, () => undefined, hooks),
|
|
138
|
-
accepted,
|
|
139
|
-
});
|
|
140
|
-
return {
|
|
141
|
-
completed,
|
|
142
|
-
document: decodeContractDocument(accepted.value.terms.document.bytes),
|
|
143
|
-
changedSections,
|
|
144
|
-
documentDiff: documentDiff("before", "after", accepted.value.source.document.bytes, accepted.value.terms.document.bytes),
|
|
145
|
-
};
|
|
146
|
-
});
|
|
147
|
-
const regionObservation = await observeChangedRegion(this.scope, this.id, amendment.changedSections, amendment.document.region);
|
|
148
|
-
return {
|
|
149
|
-
...amendment.completed,
|
|
150
|
-
documentDiff: amendment.documentDiff,
|
|
151
|
-
...regionObservation,
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
async deliver(input) {
|
|
155
|
-
const values = input === undefined ? undefined : requireInput(input, "deliver input");
|
|
156
|
-
const hooks = worktreeHooksOption(values?.hooks);
|
|
157
|
-
const message = optionalNonblank(values?.message, "deliver message");
|
|
158
|
-
const requireBranchesToBeUpToDate = optionalBoolean(values?.requireBranchesToBeUpToDate, "requireBranchesToBeUpToDate") ?? false;
|
|
159
|
-
const includeDirty = optionalBoolean(values?.includeDirty, "includeDirty") ?? false;
|
|
160
|
-
const materializeConflict = optionalBoolean(values?.materializeConflict, "materializeConflict") ?? false;
|
|
161
|
-
const actor = actorOption(values?.actor);
|
|
162
|
-
const signal = optionalSignal(values?.signal);
|
|
163
|
-
const requests = injectedBodyRequests();
|
|
164
|
-
const result = requests === null
|
|
165
|
-
? await executeLocalDelivery({
|
|
166
|
-
scope: this.scope,
|
|
167
|
-
contractId: this.id,
|
|
168
|
-
...actor,
|
|
169
|
-
...(message === undefined ? {} : { message }),
|
|
170
|
-
requireBranchesToBeUpToDate,
|
|
171
|
-
includeDirty,
|
|
172
|
-
materializeConflict,
|
|
173
|
-
...(signal === undefined ? {} : { signal }),
|
|
174
|
-
hooks,
|
|
175
|
-
})
|
|
176
|
-
: requireForwarded(forwardedReceipt(await requestBodyDeliver({
|
|
177
|
-
directory: requests,
|
|
178
|
-
repoRoot: this.scope.primaryWorktree,
|
|
179
|
-
contractId: this.id,
|
|
180
|
-
...(message === undefined ? {} : { message }),
|
|
181
|
-
includeDirty,
|
|
182
|
-
materializeConflict,
|
|
183
|
-
...(signal === undefined ? {} : { signal }),
|
|
184
|
-
}), "deliver"));
|
|
185
|
-
return "facts" in result ? { ...result, value: this.deliveryHandle(result.value) } : result;
|
|
186
|
-
}
|
|
187
|
-
async review(input) {
|
|
188
|
-
const values = requireInput(input, "review input");
|
|
189
|
-
const hooks = worktreeHooksOption(values.hooks);
|
|
190
|
-
const verdict = values.verdict;
|
|
191
|
-
if (verdict !== "satisfied" && verdict !== "unsatisfied") {
|
|
192
|
-
throw new TypeError("verdict must be satisfied or unsatisfied");
|
|
193
|
-
}
|
|
194
|
-
const summary = optionalNonblank(values.summary, "review summary");
|
|
195
|
-
const actor = actorOption(values.actor);
|
|
196
|
-
const requests = injectedBodyRequests();
|
|
197
|
-
if (requests !== null) {
|
|
198
|
-
return requireForwarded(forwardedReceipt(await requestBodyReview({
|
|
199
|
-
directory: requests,
|
|
200
|
-
repoRoot: this.scope.primaryWorktree,
|
|
201
|
-
contractId: this.id,
|
|
202
|
-
verdict,
|
|
203
|
-
...(summary === undefined ? {} : { summary }),
|
|
204
|
-
}), "review"));
|
|
205
|
-
}
|
|
206
|
-
return await executeLocalReview({
|
|
207
|
-
scope: this.scope,
|
|
208
|
-
contractId: this.id,
|
|
209
|
-
...actor,
|
|
210
|
-
verdict,
|
|
211
|
-
...(summary === undefined ? {} : { summary }),
|
|
212
|
-
hooks,
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
async abandon(input) {
|
|
216
|
-
const values = input === undefined ? undefined : requireInput(input, "abandon input");
|
|
217
|
-
const hooks = worktreeHooksOption(values?.hooks);
|
|
218
|
-
const note = optionalNonblank(values?.note, "abandon note");
|
|
219
|
-
return withGitDecodeChannel(this.scope, async (channel) => {
|
|
220
|
-
const admission = await releaseTaskHolderWithFence(this.scope, channel, this.id, () => abandonOperation({
|
|
221
|
-
scope: this.scope,
|
|
222
|
-
channel,
|
|
223
|
-
contractId: this.id,
|
|
224
|
-
...actorOption(values?.actor),
|
|
225
|
-
...(note === undefined ? {} : { note }),
|
|
226
|
-
observationSelection: taskHolderObservationSelection(),
|
|
227
|
-
decorateOffer: async ({ observation, contractId: owner }) => {
|
|
228
|
-
const companion = await releaseTaskHolder(channel, observation, owner);
|
|
229
|
-
return companion === null ? [] : [companion];
|
|
230
|
-
},
|
|
231
|
-
}));
|
|
232
|
-
return completeHolderMutation({
|
|
233
|
-
completion: completionInput(this.scope, channel, this.id, () => undefined, hooks),
|
|
234
|
-
admission,
|
|
235
|
-
requireAccepted,
|
|
236
|
-
});
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
async arc(input) {
|
|
240
|
-
const values = requireInput(input, "arc input");
|
|
241
|
-
const hooks = worktreeHooksOption(values.hooks);
|
|
242
|
-
const chapter = decodeArcDocument(requireMarkdown(values.markdown));
|
|
243
|
-
return withGitDecodeChannel(this.scope, async (channel) => {
|
|
244
|
-
const accepted = requireAccepted(await arcOperation({
|
|
245
|
-
scope: this.scope,
|
|
246
|
-
channel,
|
|
247
|
-
contractId: this.id,
|
|
248
|
-
...actorOption(values.actor),
|
|
249
|
-
chapter,
|
|
250
|
-
}));
|
|
251
|
-
return completeMutation({
|
|
252
|
-
...completionInput(this.scope, channel, this.id, () => undefined, hooks),
|
|
253
|
-
accepted,
|
|
254
|
-
});
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
async audit(input) {
|
|
258
|
-
return auditContract({
|
|
259
|
-
scope: this.scope,
|
|
260
|
-
contractId: this.id,
|
|
261
|
-
...(input === undefined ? {} : { input }),
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
async reconcile(input) {
|
|
265
|
-
const options = reconcileInput(input);
|
|
266
|
-
return withGitDecodeChannel(this.scope, (channel) => completeReconcile({
|
|
267
|
-
scope: this.scope,
|
|
268
|
-
channel,
|
|
269
|
-
contractId: this.id,
|
|
270
|
-
...options,
|
|
271
|
-
}));
|
|
272
|
-
}
|
|
273
|
-
deliveryHandle(delivery) {
|
|
274
|
-
return deliveryHandle(delivery, () => deliveryDiffOperation({
|
|
275
|
-
scope: this.scope,
|
|
276
|
-
integrationPredecessor: delivery.integration.predecessor,
|
|
277
|
-
integrationSnapshot: delivery.integration.snapshot,
|
|
278
|
-
}));
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
const KEIYAKU_SEATS = new WeakMap();
|
|
282
|
-
/** Internal package composition capability; not exported from the package root. */
|
|
283
|
-
export function seatForKeiyaku(value) {
|
|
284
|
-
if (!(value instanceof KeiyakuHandle))
|
|
285
|
-
throw new TypeError("contract must be a Keiyaku");
|
|
286
|
-
const seat = KEIYAKU_SEATS.get(value);
|
|
287
|
-
if (seat === undefined)
|
|
288
|
-
throw new TypeError("contract must be a Keiyaku");
|
|
289
|
-
return seat;
|
|
290
|
-
}
|
|
291
|
-
export function keiyakuOf(input) {
|
|
18
|
+
export function keiyakuOf(input, execution = localExecutionContext()) {
|
|
292
19
|
const values = requireInput(input, "Keiyaku.of input");
|
|
293
20
|
const scope = scopeForRepo(values.repo);
|
|
294
21
|
if (typeof values.id !== "string")
|
|
295
22
|
throw new TypeError("contract ID must be a string");
|
|
296
|
-
return new KeiyakuHandle(contractId(values.id), scope);
|
|
23
|
+
return new KeiyakuHandle(contractId(values.id), scope, execution);
|
|
297
24
|
}
|
|
298
25
|
export async function listKeiyaku(input) {
|
|
299
26
|
const values = requireInput(input, "Keiyaku.list input");
|
|
@@ -320,10 +47,10 @@ export async function observeKeiyaku(input) {
|
|
|
320
47
|
}
|
|
321
48
|
return withGitDecodeChannel(scope, (channel) => contractObservationOperation({ scope, channel, contractId: id }));
|
|
322
49
|
}
|
|
323
|
-
export async function bindKeiyaku(input) {
|
|
324
|
-
return bindKeiyakuImplementation(input, (id, scope) => new KeiyakuHandle(id, scope));
|
|
50
|
+
export async function bindKeiyaku(input, execution = localExecutionContext()) {
|
|
51
|
+
return bindKeiyakuImplementation(input, (id, scope) => new KeiyakuHandle(id, scope, execution));
|
|
325
52
|
}
|
|
326
53
|
/** Internal CLI composition; not exported from the package root. */
|
|
327
|
-
export async function bindFromCli(input) {
|
|
328
|
-
return bindFromCliImplementation(input, (id, scope) => new KeiyakuHandle(id, scope));
|
|
54
|
+
export async function bindFromCli(input, execution = localExecutionContext()) {
|
|
55
|
+
return bindFromCliImplementation(input, (id, scope) => new KeiyakuHandle(id, scope, execution));
|
|
329
56
|
}
|