@astrosheep/keiyaku 4.5.7 → 4.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +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 +12 -11
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/SKILL.md +33 -12
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-babysit/SKILL.md +35 -96
- 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 +392 -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/archetype.js +1 -1
- package/build/src/akuma/body.d.ts +8 -5
- package/build/src/akuma/body.js +12 -5
- 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 +16 -78
- package/build/src/akuma/heart/facts.js +11 -0
- package/build/src/akuma/heart/index.d.ts +3 -2
- package/build/src/akuma/heart/index.js +4 -1
- package/build/src/akuma/heart/request-authority.d.ts +5 -4
- package/build/src/akuma/heart/request-authority.js +20 -34
- 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/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 +907 -137
- package/build/src/akuma/projection.js +193 -9
- package/build/src/akuma/provider.d.ts +30 -3
- package/build/src/akuma/provider.js +111 -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/events.d.ts +2 -2
- package/build/src/akuma/providers/claude/events.js +16 -3
- 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.d.ts +2 -2
- package/build/src/akuma/providers/codex-app-server/events.js +25 -4
- 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 +72 -58
- package/build/src/akuma/request-lifecycle.d.ts +4 -10
- package/build/src/akuma/request-lifecycle.js +7 -5
- 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 +6 -66
- package/build/src/akuma/request-serve.js +83 -210
- 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 +39 -11
- package/build/src/akuma-body.d.ts +7 -2
- package/build/src/akuma-body.js +68 -46
- package/build/src/body/amend.js +18 -19
- 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 +8 -8
- package/build/src/cli/commands/contract-invoke.d.ts +3 -2
- package/build/src/cli/commands/contract-invoke.js +42 -30
- package/build/src/cli/commands/contract.d.ts +16 -20
- package/build/src/cli/commands/contract.js +58 -25
- package/build/src/cli/commands/install.d.ts +2 -1
- package/build/src/cli/commands/install.js +3 -2
- package/build/src/cli/commands/task-invoke.d.ts +3 -0
- package/build/src/cli/commands/task-invoke.js +23 -140
- package/build/src/cli/commands/task.js +54 -20
- 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 +56 -27
- package/build/src/cli/render/akuma-activity.d.ts +3 -0
- package/build/src/cli/render/akuma-activity.js +45 -29
- package/build/src/cli/render/akuma-tool.d.ts +5 -1
- package/build/src/cli/render/akuma.js +4 -8
- 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 +35 -62
- package/build/src/cli/render/kanshi-akuma.d.ts +8 -0
- package/build/src/cli/render/kanshi-akuma.js +132 -0
- package/build/src/cli/render/kanshi.js +131 -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 +22 -5
- package/build/src/cli/render/terminal.d.ts +32 -1
- package/build/src/cli/render/terminal.js +77 -1
- package/build/src/cli/result.d.ts +3 -3
- package/build/src/cli/runtime.js +4 -2
- 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 +39 -21
- 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 +26 -11
- package/build/src/git/read-observation.js +29 -20
- package/build/src/git/reconcile.d.ts +13 -1
- package/build/src/git/reconcile.js +70 -11
- package/build/src/git/ref-migration.d.ts +22 -0
- package/build/src/git/ref-migration.js +55 -0
- package/build/src/git/repository.d.ts +10 -6
- package/build/src/git/repository.js +16 -8
- package/build/src/git/target-placement.d.ts +1 -0
- package/build/src/git/target-placement.js +5 -0
- 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 +14 -6
- package/build/src/library/audit.js +13 -23
- package/build/src/library/catalog.d.ts +3 -1
- package/build/src/library/catalog.js +20 -6
- package/build/src/library/composition.d.ts +385 -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 +102 -0
- package/build/src/library/contract-forwarding-reconciliation-result.js +92 -0
- package/build/src/library/contract-forwarding-result.d.ts +4464 -0
- package/build/src/library/contract-forwarding-result.js +521 -0
- package/build/src/library/contract-forwarding.d.ts +71 -0
- package/build/src/library/contract-forwarding.js +114 -0
- package/build/src/library/contract-handle.d.ts +38 -0
- package/build/src/library/contract-handle.js +314 -0
- package/build/src/library/contract-operations.d.ts +214 -69
- package/build/src/library/contract-operations.js +189 -118
- package/build/src/library/contract-types.d.ts +7 -3
- package/build/src/library/contract.d.ts +21 -34
- package/build/src/library/contract.js +29 -287
- package/build/src/library/fleet-result.d.ts +1580 -0
- package/build/src/library/fleet-result.js +98 -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 +3 -1
- package/build/src/library/input.js +11 -1
- package/build/src/library/keiyaku.d.ts +388 -20
- package/build/src/library/keiyaku.js +13 -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 +8 -1
- 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 +9 -0
- package/build/src/runtime/proc/run.js +51 -4
- 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.js +33 -7
- package/build/src/task/compose-parser.d.ts +1 -1
- package/build/src/task/compose-parser.js +1 -1
- package/build/src/task/compose.js +2 -0
- package/build/src/task/index.d.ts +12 -4
- 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
|
@@ -70,6 +70,50 @@ export async function followManagedWorktree(repository, workspace, tender) {
|
|
|
70
70
|
await runGit(repository, ["-C", workspace, "reset", "--mixed", gitObjectId(tender)]);
|
|
71
71
|
return { kind: "followed", before: head, after: tender };
|
|
72
72
|
}
|
|
73
|
+
/** Follow a dependency baseline only through a clean, detached fast-forward. */
|
|
74
|
+
export async function followDependentManagedWorktree(repository, workspace, target) {
|
|
75
|
+
const head = await workspaceRevision(repository, workspace, "HEAD");
|
|
76
|
+
if (head === null)
|
|
77
|
+
throw new Error("managed worktree HEAD is missing");
|
|
78
|
+
const status = await workspaceStatus(repository, workspace);
|
|
79
|
+
const gitDirectory = await worktreeGitDirectory(repository, workspace);
|
|
80
|
+
const operation = await workspaceOperationState(repository, workspace, gitDirectory);
|
|
81
|
+
const mergeHead = await workspaceRevision(repository, workspace, "MERGE_HEAD");
|
|
82
|
+
const paths = [
|
|
83
|
+
...new Set([
|
|
84
|
+
...status.staged,
|
|
85
|
+
...status.unstaged,
|
|
86
|
+
...status.untracked,
|
|
87
|
+
...status.submodules,
|
|
88
|
+
...status.unmergedPaths,
|
|
89
|
+
]),
|
|
90
|
+
].sort();
|
|
91
|
+
const attached = await runGit(repository, ["-C", workspace, "symbolic-ref", "--quiet", "HEAD"]).then(() => true, (error) => {
|
|
92
|
+
if (error instanceof GitPlumbingError && error.status === 1)
|
|
93
|
+
return false;
|
|
94
|
+
throw error;
|
|
95
|
+
});
|
|
96
|
+
if (attached)
|
|
97
|
+
return { kind: "retained", head, reason: "head-attached", paths };
|
|
98
|
+
if (mergeHead !== null || operation.other || operation.unmerged || paths.length > 0) {
|
|
99
|
+
return { kind: "retained", head, reason: "operation-in-progress", paths };
|
|
100
|
+
}
|
|
101
|
+
if (head === target)
|
|
102
|
+
return { kind: "unchanged" };
|
|
103
|
+
let ancestor = false;
|
|
104
|
+
try {
|
|
105
|
+
await runGit(repository, ["merge-base", "--is-ancestor", gitObjectId(head), gitObjectId(target)]);
|
|
106
|
+
ancestor = true;
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
if (!(error instanceof GitPlumbingError) || error.status !== 1)
|
|
110
|
+
throw error;
|
|
111
|
+
}
|
|
112
|
+
if (!ancestor)
|
|
113
|
+
return { kind: "retained", head, reason: "head-moved", paths };
|
|
114
|
+
await runGit(repository, ["-C", workspace, "checkout", "--quiet", "--detach", gitObjectId(target)]);
|
|
115
|
+
return { kind: "followed", before: head, after: target };
|
|
116
|
+
}
|
|
73
117
|
export async function withPrivateGitIndex(action) {
|
|
74
118
|
const directory = await mkdtemp(join(tmpdir(), "keiyaku-v4-index-"));
|
|
75
119
|
try {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { kanshi, observeKanshi } from "./read.js";
|
|
2
2
|
export { selectKanshi, selectRegion } from "./select.js";
|
|
3
3
|
export type { KanshiInput } from "./read.js";
|
|
4
|
-
export type { AkumaKanshiRow, AkumaKanshiWorld, ContractEndpointObservation, ContractHolderObservation, ContractKanshiBoard, ContractKanshiRow,
|
|
4
|
+
export type { AkumaKanshiRow, AkumaKanshiWorld, ContractEndpointObservation, ContractHolderObservation, ContractKanshiBoard, ContractKanshiRow, KanshiReport, Section, TaskKanshiRow, TaskKanshiWorld, KanshiRegionSelection, RegionDeclaration, RegionOverlap, RegionRead, } from "./report.js";
|
|
5
5
|
export type { KanshiSelection } from "./select.js";
|
package/build/src/kanshi/read.js
CHANGED
|
@@ -122,22 +122,6 @@ async function readContracts(observation, include) {
|
|
|
122
122
|
return { kind: "failed", failure: { message: diagnostic(error) } };
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
async function attachSelectedIssue(observation, contracts, selected) {
|
|
126
|
-
if (contracts.kind !== "present")
|
|
127
|
-
return contracts;
|
|
128
|
-
try {
|
|
129
|
-
const rows = await Promise.all(contracts.value.rows.map(async (row) => {
|
|
130
|
-
if (row.id !== selected)
|
|
131
|
-
return row;
|
|
132
|
-
const issue = await observeCurrentPhysicalIssue(observation.repository, row);
|
|
133
|
-
return issue === undefined ? row : { ...row, issue };
|
|
134
|
-
}));
|
|
135
|
-
return { kind: "present", value: { ...contracts.value, rows } };
|
|
136
|
-
}
|
|
137
|
-
catch (error) {
|
|
138
|
-
return { kind: "failed", failure: { message: diagnostic(error) } };
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
125
|
async function readHolders(observation) {
|
|
142
126
|
try {
|
|
143
127
|
return { kind: "present", value: await readTaskHolderProjectionAt(observation) };
|
|
@@ -393,3 +377,19 @@ export async function observeKanshi(input) {
|
|
|
393
377
|
export async function kanshi(input) {
|
|
394
378
|
return (await observeKanshi(input)).report;
|
|
395
379
|
}
|
|
380
|
+
async function attachSelectedIssue(observation, contracts, selected) {
|
|
381
|
+
if (contracts.kind !== "present")
|
|
382
|
+
return contracts;
|
|
383
|
+
try {
|
|
384
|
+
const rows = await Promise.all(contracts.value.rows.map(async (row) => {
|
|
385
|
+
if (row.id !== selected)
|
|
386
|
+
return row;
|
|
387
|
+
const issue = await observeCurrentPhysicalIssue(observation.repository, row);
|
|
388
|
+
return issue === undefined ? row : { ...row, issue };
|
|
389
|
+
}));
|
|
390
|
+
return { kind: "present", value: { ...contracts.value, rows } };
|
|
391
|
+
}
|
|
392
|
+
catch (error) {
|
|
393
|
+
return { kind: "failed", failure: { message: diagnostic(error) } };
|
|
394
|
+
}
|
|
395
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { ContractBoard, ContractDisposition, ContractPhase } from "../library/contract.js";
|
|
2
|
-
import type { CurrentPhysicalIssue } from "../protocol/read/observation.js";
|
|
3
2
|
import type { TaskId, TaskRef, TaskRow } from "../task/index.js";
|
|
4
3
|
import type { AkumaList, AkumaListRow, UnbornAkumaListRow, ActivitySnapshot } from "../akuma/index.js";
|
|
5
4
|
import type { AkumaAlias } from "../identity/selector.js";
|
|
6
5
|
import type { WorldRoot } from "../world.js";
|
|
7
6
|
import type { ContractId } from "../library/contract.js";
|
|
8
7
|
import type { RegionOverlap } from "../library/region.js";
|
|
8
|
+
import type { CurrentPhysicalIssue } from "../protocol/read/observation.js";
|
|
9
9
|
export type { RegionOverlap };
|
|
10
10
|
export type Section<Value> = Readonly<{
|
|
11
11
|
kind: "present";
|
|
@@ -31,7 +31,6 @@ export type ContractFleetAttachment = Readonly<{
|
|
|
31
31
|
id: string;
|
|
32
32
|
aliases: readonly AkumaAlias[];
|
|
33
33
|
}>;
|
|
34
|
-
export type { CurrentPhysicalIssue };
|
|
35
34
|
export type ContractKanshiRow = ContractBoard["rows"][number] & Readonly<{
|
|
36
35
|
phase: ContractPhase;
|
|
37
36
|
holder: ContractHolderObservation;
|
|
@@ -98,3 +97,4 @@ export type KanshiReport = Readonly<{
|
|
|
98
97
|
akuma: Section<AkumaKanshiWorld>;
|
|
99
98
|
region?: Section<RegionRead>;
|
|
100
99
|
}>;
|
|
100
|
+
export type { CurrentPhysicalIssue };
|
|
@@ -2,7 +2,7 @@ import { type AliasBinding } from "../alias/index.js";
|
|
|
2
2
|
import { type AkuId } from "../akuma/identity.js";
|
|
3
3
|
import { contractId } from "../core/facts/types.js";
|
|
4
4
|
import { type AkumaAlias, type AkumaGlob } from "../identity/selector.js";
|
|
5
|
-
import type
|
|
5
|
+
import { type WorldRoot } from "../world.js";
|
|
6
6
|
import type { KanshiReport, Section } from "../kanshi/index.js";
|
|
7
7
|
import { type Repo } from "./repo.js";
|
|
8
8
|
export type DirectAkumaSelector = AkuId | AkumaAlias;
|
|
@@ -17,6 +17,11 @@ export type AkumaSetAddressInput = Readonly<{
|
|
|
17
17
|
akuma: readonly string[];
|
|
18
18
|
repo?: Repo;
|
|
19
19
|
}>;
|
|
20
|
+
type UncheckedAkumaAddressInput = Readonly<{
|
|
21
|
+
path: unknown;
|
|
22
|
+
akuma: unknown;
|
|
23
|
+
repo?: unknown;
|
|
24
|
+
}>;
|
|
20
25
|
export type AkumaWorldScopeRefusal = Readonly<{
|
|
21
26
|
kind: "akuma-not-in-world";
|
|
22
27
|
ids: readonly AkuId[];
|
|
@@ -39,11 +44,12 @@ export type NamedAddressInput = Readonly<{
|
|
|
39
44
|
aliases: Section<readonly AliasBinding[]>;
|
|
40
45
|
}>;
|
|
41
46
|
export declare function resolveNamedAddress(input: NamedAddressInput): NamedAddress;
|
|
42
|
-
export declare function addressAkuma(input:
|
|
47
|
+
export declare function addressAkuma(input: UncheckedAkumaAddressInput): Promise<Readonly<{
|
|
43
48
|
path: WorldRoot;
|
|
44
49
|
id: AkuId;
|
|
45
50
|
}>>;
|
|
46
|
-
export declare function addressAkumaSet(input:
|
|
51
|
+
export declare function addressAkumaSet(input: UncheckedAkumaAddressInput): Promise<Readonly<{
|
|
47
52
|
path: WorldRoot;
|
|
48
53
|
ids: readonly AkuId[];
|
|
49
54
|
}>>;
|
|
55
|
+
export {};
|
|
@@ -5,6 +5,7 @@ import { parseAkuId } from "../akuma/identity.js";
|
|
|
5
5
|
import { contractId } from "../core/facts/types.js";
|
|
6
6
|
import { readDispatches } from "../dispatch/index.js";
|
|
7
7
|
import { matchesAkumaGlob, parseAkumaAlias, parseAkumaGlob, } from "../identity/selector.js";
|
|
8
|
+
import { World } from "../world.js";
|
|
8
9
|
import { requireInput } from "./input.js";
|
|
9
10
|
import { scopeForRepo } from "./repo.js";
|
|
10
11
|
export class AkumaWorldScopeError extends TypeError {
|
|
@@ -72,7 +73,7 @@ export async function addressAkuma(input) {
|
|
|
72
73
|
}
|
|
73
74
|
if (values.repo !== undefined)
|
|
74
75
|
scopeForRepo(values.repo);
|
|
75
|
-
const path = nonblank(values.path, "path");
|
|
76
|
+
const path = await World.prove(nonblank(values.path, "path"));
|
|
76
77
|
return { path, id: await directId(path, nonblank(values.akuma, "akuma")) };
|
|
77
78
|
}
|
|
78
79
|
function idsFromFleet(fleet) {
|
|
@@ -143,7 +144,7 @@ export async function addressAkumaSet(input) {
|
|
|
143
144
|
}
|
|
144
145
|
if (!Array.isArray(values.akuma) || values.akuma.length === 0)
|
|
145
146
|
throw new TypeError("akuma must be a nonempty selector array");
|
|
146
|
-
const path = nonblank(values.path, "path");
|
|
147
|
+
const path = await World.prove(nonblank(values.path, "path"));
|
|
147
148
|
const selectors = values.akuma.map(parseSetSelector);
|
|
148
149
|
if (hasSelectorKind(selectors, "contract") && values.repo === undefined) {
|
|
149
150
|
throw new TypeError("Contract Akuma selector requires repo");
|
|
@@ -5,8 +5,9 @@ import type { AkuId } from "../akuma/identity.js";
|
|
|
5
5
|
import { type Dispatch, type DispatchFailure } from "../dispatch/index.js";
|
|
6
6
|
import { type AkumaAlias } from "../identity/selector.js";
|
|
7
7
|
import type { Settings } from "../settings.js";
|
|
8
|
-
import type
|
|
8
|
+
import { type WorldRoot } from "../world.js";
|
|
9
9
|
import type { AllowedAction } from "../akuma/allowed.js";
|
|
10
|
+
import { type ExecutionContext } from "../akuma/requests.js";
|
|
10
11
|
import { type Keiyaku } from "./contract.js";
|
|
11
12
|
import { type Repo } from "./repo.js";
|
|
12
13
|
export type { AkumaStatus } from "../akuma/akuma.js";
|
|
@@ -98,7 +99,7 @@ export type ForkResult = Readonly<{
|
|
|
98
99
|
}>> & Readonly<{
|
|
99
100
|
parent: AkuId;
|
|
100
101
|
}>);
|
|
101
|
-
export declare function beginCall(input: CallInput): Promise<BornCall>;
|
|
102
|
+
export declare function beginCall(input: CallInput, context: ExecutionContext): Promise<BornCall>;
|
|
102
103
|
export declare function finishCall(born: BornCall, participantName?: string): Promise<CallResult>;
|
|
103
|
-
export declare function callKeiyaku(input: CallInput): Promise<CallResult>;
|
|
104
|
+
export declare function callKeiyaku(input: CallInput, execution?: ExecutionContext): Promise<CallResult>;
|
|
104
105
|
export declare function forkKeiyaku(input: ForkInput): Promise<ForkResult>;
|
|
@@ -6,9 +6,12 @@ import { AuthorityCorruptionError } from "../core/facts/errors.js";
|
|
|
6
6
|
import { publishDispatch, readDispatch } from "../dispatch/index.js";
|
|
7
7
|
import { parseAkumaAlias } from "../identity/selector.js";
|
|
8
8
|
import { readManagedWorktreeAppointment } from "../workspace-place.js";
|
|
9
|
+
import { World } from "../world.js";
|
|
10
|
+
import { localExecutionContext } from "../akuma/requests.js";
|
|
9
11
|
import { requireInput } from "./input.js";
|
|
10
12
|
import { addressAkuma } from "./address.js";
|
|
11
|
-
import { KeiyakuRefused
|
|
13
|
+
import { KeiyakuRefused } from "./contract.js";
|
|
14
|
+
import { seatForKeiyaku } from "./contract-handle.js";
|
|
12
15
|
import { scopeForRepo } from "./repo.js";
|
|
13
16
|
function nonblank(value, label) {
|
|
14
17
|
if (typeof value !== "string" || value.trim().length === 0) {
|
|
@@ -36,10 +39,11 @@ function homeOption(value) {
|
|
|
36
39
|
return undefined;
|
|
37
40
|
return nonblank(value, "home");
|
|
38
41
|
}
|
|
39
|
-
function akumaWorld(path, home, settings) {
|
|
42
|
+
function akumaWorld(path, home, settings, execution) {
|
|
40
43
|
return Akuma.of(path, {
|
|
41
44
|
...(home === undefined ? {} : { home }),
|
|
42
45
|
...(settings === undefined ? {} : { settings }),
|
|
46
|
+
...(execution === undefined ? {} : { execution }),
|
|
43
47
|
});
|
|
44
48
|
}
|
|
45
49
|
function onlyKeys(values, allowed, label) {
|
|
@@ -151,6 +155,8 @@ async function resolveCallExecution(input) {
|
|
|
151
155
|
}
|
|
152
156
|
if (input.contract !== undefined) {
|
|
153
157
|
const seat = seatForKeiyaku(input.contract);
|
|
158
|
+
if (seat === null)
|
|
159
|
+
throw new TypeError("contract must be a Keiyaku");
|
|
154
160
|
const state = await currentManagedContract(input.contract, seat.id);
|
|
155
161
|
const appointment = await readManagedWorktreeAppointment(seat.scope, state.id);
|
|
156
162
|
if (appointment.kind === "unappointed") {
|
|
@@ -166,7 +172,7 @@ async function resolveCallExecution(input) {
|
|
|
166
172
|
}
|
|
167
173
|
return undefined;
|
|
168
174
|
}
|
|
169
|
-
export async function beginCall(input) {
|
|
175
|
+
export async function beginCall(input, context) {
|
|
170
176
|
const values = requireInput(input, "Keiyaku.call input");
|
|
171
177
|
onlyKeys(values, [
|
|
172
178
|
"path",
|
|
@@ -182,7 +188,7 @@ export async function beginCall(input) {
|
|
|
182
188
|
"alias",
|
|
183
189
|
"allowed",
|
|
184
190
|
], "Keiyaku.call input");
|
|
185
|
-
const path = nonblank(values.path, "path");
|
|
191
|
+
const path = await World.prove(nonblank(values.path, "path"));
|
|
186
192
|
const archetype = nonblank(values.archetype, "archetype");
|
|
187
193
|
const body = text(values.body, "body");
|
|
188
194
|
const readonlyRequested = callReadonly(values.readonly);
|
|
@@ -192,13 +198,16 @@ export async function beginCall(input) {
|
|
|
192
198
|
const home = homeOption(values.home);
|
|
193
199
|
const settings = settingsOption(values.settings);
|
|
194
200
|
const alias = values.alias === undefined ? undefined : parseAkumaAlias(nonblank(values.alias, "alias"));
|
|
195
|
-
const
|
|
201
|
+
const selectedSeat = values.contract === undefined ? undefined : seatForKeiyaku(values.contract);
|
|
202
|
+
if (values.contract !== undefined && selectedSeat === null)
|
|
203
|
+
throw new TypeError("contract must be a Keiyaku");
|
|
204
|
+
const seat = selectedSeat ?? undefined;
|
|
196
205
|
const execution = await resolveCallExecution({
|
|
197
206
|
path,
|
|
198
207
|
...(cwd === undefined ? {} : { cwd }),
|
|
199
208
|
...(seat === undefined ? {} : { contract: values.contract }),
|
|
200
209
|
});
|
|
201
|
-
const world = akumaWorld(path, home, settings);
|
|
210
|
+
const world = akumaWorld(path, home, settings, context);
|
|
202
211
|
const call = {
|
|
203
212
|
archetype,
|
|
204
213
|
body,
|
|
@@ -255,18 +264,15 @@ export async function finishCall(born, participantName) {
|
|
|
255
264
|
observation,
|
|
256
265
|
};
|
|
257
266
|
}
|
|
258
|
-
export async function callKeiyaku(input) {
|
|
259
|
-
return await finishCall(await beginCall(input));
|
|
267
|
+
export async function callKeiyaku(input, execution = localExecutionContext()) {
|
|
268
|
+
return await finishCall(await beginCall(input, execution));
|
|
260
269
|
}
|
|
261
270
|
export async function forkKeiyaku(input) {
|
|
262
271
|
const values = requireInput(input, "Keiyaku.fork input");
|
|
263
272
|
onlyKeys(values, ["path", "akuma", "at", "repo"], "Keiyaku.fork input");
|
|
264
|
-
const path = nonblank(values.path, "path");
|
|
265
273
|
const at = nonblank(values.at, "at");
|
|
266
|
-
const
|
|
267
|
-
|
|
268
|
-
akuma: nonblank(values.akuma, "akuma"),
|
|
269
|
-
})).id;
|
|
274
|
+
const addressed = await addressAkuma({ path: values.path, akuma: nonblank(values.akuma, "akuma") });
|
|
275
|
+
const { path, id: akuma } = addressed;
|
|
270
276
|
const repository = values.repo === undefined ? undefined : scopeForRepo(values.repo);
|
|
271
277
|
const receipt = await Akuma.of(path).of({ id: akuma }).fork({ at });
|
|
272
278
|
if (receipt.kind !== "forked")
|
|
@@ -1,19 +1,27 @@
|
|
|
1
|
-
import type { ContractId } from "../core/facts/types.js";
|
|
1
|
+
import type { ActorId, ContractId } from "../core/facts/types.js";
|
|
2
2
|
import { type AuditReport } from "../protocol/audit.js";
|
|
3
|
-
import type
|
|
3
|
+
import { type RepositoryScope } from "../protocol/operations.js";
|
|
4
4
|
import { type WorktreeHooks } from "./configuration.js";
|
|
5
5
|
import { type MutationResult } from "./mutation.js";
|
|
6
6
|
export type AuditInput = Readonly<{
|
|
7
|
-
actor?: string;
|
|
8
|
-
hooks?: WorktreeHooks;
|
|
9
7
|
includeDirty?: boolean;
|
|
10
8
|
showDiff?: boolean;
|
|
11
|
-
requireBranchesToBeUpToDate?: boolean;
|
|
12
9
|
signal?: AbortSignal;
|
|
13
10
|
}>;
|
|
11
|
+
export type AuditOptions = Readonly<{
|
|
12
|
+
includeDirty: boolean;
|
|
13
|
+
showDiff: boolean;
|
|
14
|
+
signal?: AbortSignal;
|
|
15
|
+
}>;
|
|
16
|
+
export type AuditComposition = Readonly<{
|
|
17
|
+
actor?: ActorId;
|
|
18
|
+
hooks?: WorktreeHooks;
|
|
19
|
+
requireBranchesToBeUpToDate?: boolean;
|
|
20
|
+
}>;
|
|
14
21
|
/** Normalize public audit input and project the protocol audit operation. */
|
|
15
22
|
export declare function auditContract(input: Readonly<{
|
|
16
23
|
scope: RepositoryScope;
|
|
17
24
|
contractId: ContractId;
|
|
18
|
-
input
|
|
25
|
+
input: AuditOptions;
|
|
26
|
+
composition?: AuditComposition;
|
|
19
27
|
}>): Promise<MutationResult<AuditReport>>;
|
|
@@ -1,44 +1,34 @@
|
|
|
1
1
|
import { decodeContractDocument } from "../body/decode.js";
|
|
2
2
|
import { withGitDecodeChannel } from "../git/read-observation.js";
|
|
3
3
|
import { auditOperation } from "../protocol/audit.js";
|
|
4
|
+
import { withScopeAbortSignal } from "../protocol/operations.js";
|
|
4
5
|
import { worktreeHooksOption } from "./configuration.js";
|
|
5
|
-
import {
|
|
6
|
+
import { documentDerivation } from "./input.js";
|
|
6
7
|
import { completeMutation } from "./mutation.js";
|
|
7
8
|
import { requireAccepted } from "./refusal.js";
|
|
8
|
-
function normalizeAuditInput(input) {
|
|
9
|
-
const values = input === undefined ? undefined : requireInput(input, "audit input");
|
|
10
|
-
const signal = optionalSignal(values?.signal);
|
|
11
|
-
return {
|
|
12
|
-
hooks: worktreeHooksOption(values?.hooks),
|
|
13
|
-
...actorOption(values?.actor),
|
|
14
|
-
includeDirty: optionalBoolean(values?.includeDirty, "includeDirty") ?? false,
|
|
15
|
-
showDiff: optionalBoolean(values?.showDiff, "showDiff") ?? false,
|
|
16
|
-
requireBranchesToBeUpToDate: optionalBoolean(values?.requireBranchesToBeUpToDate, "requireBranchesToBeUpToDate") ?? false,
|
|
17
|
-
...(signal === undefined ? {} : { signal }),
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
9
|
/** Normalize public audit input and project the protocol audit operation. */
|
|
21
10
|
export async function auditContract(input) {
|
|
22
|
-
const
|
|
23
|
-
|
|
11
|
+
const composition = input.composition;
|
|
12
|
+
const scope = withScopeAbortSignal(input.scope, input.input.signal);
|
|
13
|
+
return withGitDecodeChannel(scope, async (channel) => {
|
|
24
14
|
const accepted = requireAccepted(await auditOperation({
|
|
25
|
-
scope
|
|
15
|
+
scope,
|
|
26
16
|
channel,
|
|
27
17
|
contractId: input.contractId,
|
|
28
18
|
deriveDocument: (state) => documentDerivation(decodeContractDocument(state.terms.document.bytes), state.terms.gates, state.id),
|
|
29
|
-
includeDirty:
|
|
30
|
-
showDiff:
|
|
31
|
-
requireBranchesToBeUpToDate:
|
|
32
|
-
...(
|
|
33
|
-
...(
|
|
19
|
+
includeDirty: input.input.includeDirty,
|
|
20
|
+
showDiff: input.input.showDiff,
|
|
21
|
+
requireBranchesToBeUpToDate: composition?.requireBranchesToBeUpToDate ?? false,
|
|
22
|
+
...(input.input.signal === undefined ? {} : { signal: input.input.signal }),
|
|
23
|
+
...(composition?.actor === undefined ? {} : { actor: composition.actor }),
|
|
34
24
|
}));
|
|
35
25
|
return completeMutation({
|
|
36
|
-
scope
|
|
26
|
+
scope,
|
|
37
27
|
channel,
|
|
38
28
|
contractId: input.contractId,
|
|
39
29
|
accepted,
|
|
40
30
|
value: (report) => report,
|
|
41
|
-
hooks:
|
|
31
|
+
hooks: composition?.hooks ?? worktreeHooksOption(undefined),
|
|
42
32
|
});
|
|
43
33
|
});
|
|
44
34
|
}
|
|
@@ -3,9 +3,10 @@ import { type ArchetypeCatalogRow } from "../akuma/archetype.js";
|
|
|
3
3
|
import type { TaskRow } from "../task/index.js";
|
|
4
4
|
import { type ContractBoard } from "./contract.js";
|
|
5
5
|
import { Repo } from "./repo.js";
|
|
6
|
-
import type
|
|
6
|
+
import { type WorldRoot } from "../world.js";
|
|
7
7
|
export type CatalogQuery = Readonly<{
|
|
8
8
|
kind: "tasks";
|
|
9
|
+
namespace?: readonly string[];
|
|
9
10
|
}> | Readonly<{
|
|
10
11
|
kind: "contracts";
|
|
11
12
|
}> | Readonly<{
|
|
@@ -52,6 +53,7 @@ export type Catalog = Readonly<{
|
|
|
52
53
|
kind: "akuma";
|
|
53
54
|
root: WorldRoot;
|
|
54
55
|
archetype: string | null;
|
|
56
|
+
observedAt: string;
|
|
55
57
|
rows: AkumaList["rows"];
|
|
56
58
|
searched: readonly string[];
|
|
57
59
|
}>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Akuma } from "../akuma/akuma.js";
|
|
2
2
|
import { listArchetypeDefinitions } from "../akuma/archetype.js";
|
|
3
|
-
import { observeTaskCatalogRows } from "../task/
|
|
3
|
+
import { observeTaskCatalogRows } from "../task/catalog.js";
|
|
4
4
|
import { listKeiyaku } from "./contract.js";
|
|
5
5
|
import { requireInput } from "./input.js";
|
|
6
6
|
import { Repo } from "./repo.js";
|
|
7
|
+
import { World } from "../world.js";
|
|
7
8
|
function optionalHome(value) {
|
|
8
9
|
if (value === undefined)
|
|
9
10
|
return undefined;
|
|
@@ -12,10 +13,18 @@ function optionalHome(value) {
|
|
|
12
13
|
}
|
|
13
14
|
return value;
|
|
14
15
|
}
|
|
15
|
-
function worldRoot(value) {
|
|
16
|
+
async function worldRoot(value) {
|
|
16
17
|
if (typeof value !== "string" || value.trim().length === 0)
|
|
17
18
|
throw new TypeError("path must be a WorldRoot");
|
|
18
|
-
return value;
|
|
19
|
+
return await World.prove(value);
|
|
20
|
+
}
|
|
21
|
+
function taskQueryValue(query) {
|
|
22
|
+
if (query.namespace !== undefined && !Array.isArray(query.namespace))
|
|
23
|
+
throw new TypeError("Keiyaku.ls Task namespace must be an array");
|
|
24
|
+
return {
|
|
25
|
+
kind: "tasks",
|
|
26
|
+
...(query.namespace === undefined ? {} : { namespace: query.namespace }),
|
|
27
|
+
};
|
|
19
28
|
}
|
|
20
29
|
function queryValue(value) {
|
|
21
30
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
@@ -26,10 +35,14 @@ function queryValue(value) {
|
|
|
26
35
|
throw new TypeError("Keiyaku.ls query kind is invalid");
|
|
27
36
|
}
|
|
28
37
|
for (const key of Object.keys(query)) {
|
|
29
|
-
if (key !== "kind" &&
|
|
38
|
+
if (key !== "kind" &&
|
|
39
|
+
!(query.kind === "akuma" && key === "archetype") &&
|
|
40
|
+
!(query.kind === "tasks" && key === "namespace")) {
|
|
30
41
|
throw new TypeError(`Keiyaku.ls query has unknown field: ${key}`);
|
|
31
42
|
}
|
|
32
43
|
}
|
|
44
|
+
if (query.kind === "tasks")
|
|
45
|
+
return taskQueryValue(query);
|
|
33
46
|
if (query.kind !== "akuma")
|
|
34
47
|
return { kind: query.kind };
|
|
35
48
|
if (query.archetype !== undefined && typeof query.archetype !== "string") {
|
|
@@ -62,15 +75,16 @@ export async function listCatalog(input) {
|
|
|
62
75
|
rows: await listArchetypeDefinitions(home === undefined ? {} : { home }),
|
|
63
76
|
};
|
|
64
77
|
}
|
|
65
|
-
const path = worldRoot(values.path);
|
|
78
|
+
const path = await worldRoot(values.path);
|
|
66
79
|
if (query.kind === "tasks") {
|
|
67
|
-
return { kind: "tasks", root: path, rows: await observeTaskCatalogRows(path) };
|
|
80
|
+
return { kind: "tasks", root: path, rows: await observeTaskCatalogRows(path, query.namespace) };
|
|
68
81
|
}
|
|
69
82
|
const listed = await Akuma.of(path).list(query.archetype === undefined ? undefined : { archetype: query.archetype });
|
|
70
83
|
return {
|
|
71
84
|
kind: "akuma",
|
|
72
85
|
root: path,
|
|
73
86
|
archetype: query.archetype ?? null,
|
|
87
|
+
observedAt: listed.observedAt,
|
|
74
88
|
rows: listed.rows,
|
|
75
89
|
searched: listed.searched,
|
|
76
90
|
};
|