@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
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type ResumeCoordinate = Readonly<{
|
|
2
|
+
sessionId: string;
|
|
3
|
+
sessionFile?: never;
|
|
4
|
+
}> | Readonly<{
|
|
5
|
+
sessionFile: string;
|
|
6
|
+
sessionId?: string;
|
|
7
|
+
}>;
|
|
8
|
+
export declare function decodeResumeCoordinate(value: unknown): ResumeCoordinate | null;
|
|
9
|
+
export declare function encodeResumeCoordinate(coordinate: ResumeCoordinate): unknown;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
function record(value) {
|
|
2
|
+
return value !== null && typeof value === "object" && !Array.isArray(value)
|
|
3
|
+
? value : null;
|
|
4
|
+
}
|
|
5
|
+
export function decodeResumeCoordinate(value) {
|
|
6
|
+
const coordinate = record(value);
|
|
7
|
+
if (coordinate === null)
|
|
8
|
+
return null;
|
|
9
|
+
const keys = Object.keys(coordinate);
|
|
10
|
+
if (typeof coordinate.sessionFile === "string" && coordinate.sessionFile.trim().length > 0
|
|
11
|
+
&& (coordinate.sessionId === undefined || (typeof coordinate.sessionId === "string" && coordinate.sessionId.trim().length > 0))
|
|
12
|
+
&& keys.every((key) => key === "sessionFile" || key === "sessionId")) {
|
|
13
|
+
return { sessionFile: coordinate.sessionFile, ...(coordinate.sessionId === undefined ? {} : { sessionId: coordinate.sessionId }) };
|
|
14
|
+
}
|
|
15
|
+
return typeof coordinate.sessionId === "string" && coordinate.sessionId.trim().length > 0 && keys.length === 1
|
|
16
|
+
? { sessionId: coordinate.sessionId } : null;
|
|
17
|
+
}
|
|
18
|
+
export function encodeResumeCoordinate(coordinate) {
|
|
19
|
+
return "sessionFile" in coordinate
|
|
20
|
+
? { sessionFile: coordinate.sessionFile, ...(coordinate.sessionId === undefined ? {} : { sessionId: coordinate.sessionId }) }
|
|
21
|
+
: { sessionId: coordinate.sessionId };
|
|
22
|
+
}
|
|
@@ -1,29 +1,18 @@
|
|
|
1
1
|
import type { AkuId } from "../identity.js";
|
|
2
|
+
import type { ResumeCoordinate } from "../coordinate.js";
|
|
3
|
+
import type { ProviderExecution, ProviderOptions, ReadonlyRestraint } from "../provider-recipe.js";
|
|
4
|
+
export type { ResumeCoordinate } from "../coordinate.js";
|
|
2
5
|
export type Confinement = Readonly<{
|
|
3
6
|
kind: "unconfined";
|
|
4
7
|
}> | Readonly<{
|
|
5
8
|
kind: "declared";
|
|
6
9
|
writableRoots: readonly string[];
|
|
7
10
|
}>;
|
|
8
|
-
export type ProviderOptions = Readonly<{
|
|
9
|
-
model?: string;
|
|
10
|
-
effort?: string;
|
|
11
|
-
access?: "read" | "write" | "auto";
|
|
12
|
-
network?: "disabled" | "enabled";
|
|
13
|
-
systemPrompt?: string;
|
|
14
|
-
}>;
|
|
15
|
-
export type ProviderExecution = Readonly<{
|
|
16
|
-
name: string;
|
|
17
|
-
kind: "claude-agent-sdk" | "codex-app-server";
|
|
18
|
-
executable?: string;
|
|
19
|
-
config?: Readonly<Record<string, unknown>>;
|
|
20
|
-
env?: Readonly<Record<string, string>>;
|
|
21
|
-
}>;
|
|
22
11
|
export type AkumaOrigin = Readonly<{
|
|
23
12
|
kind: "direct";
|
|
24
13
|
}> | Readonly<{
|
|
25
14
|
kind: "request";
|
|
26
|
-
|
|
15
|
+
parent: AkuId;
|
|
27
16
|
requestId: string;
|
|
28
17
|
}> | Readonly<{
|
|
29
18
|
kind: "fork";
|
|
@@ -36,28 +25,24 @@ export type Soul = Readonly<{
|
|
|
36
25
|
description?: string;
|
|
37
26
|
provider: ProviderExecution;
|
|
38
27
|
options: ProviderOptions;
|
|
28
|
+
readonly?: ReadonlyRestraint;
|
|
39
29
|
cwd: string;
|
|
40
30
|
origin: AkumaOrigin;
|
|
41
31
|
confinement: Confinement;
|
|
42
32
|
createdAt: string;
|
|
43
33
|
}>;
|
|
44
|
-
export type RequestRecipe = Pick<Soul, "description" | "provider" | "options" | "confinement">;
|
|
45
|
-
export type Collar = Readonly<{
|
|
46
|
-
pid: number;
|
|
47
|
-
processGroup: number;
|
|
48
|
-
spawnedAt: string;
|
|
49
|
-
}>;
|
|
34
|
+
export type RequestRecipe = Pick<Soul, "description" | "provider" | "options" | "readonly" | "confinement">;
|
|
50
35
|
export type BodyEnd = "exited" | "broke-off" | "put-down";
|
|
51
36
|
export type BodyFact = Readonly<{
|
|
52
37
|
sequence: number;
|
|
53
|
-
collar: Collar;
|
|
54
38
|
leashTakenAt: string;
|
|
39
|
+
hung?: Readonly<{
|
|
40
|
+
diagnostic: string;
|
|
41
|
+
at: string;
|
|
42
|
+
}>;
|
|
55
43
|
end?: BodyEnd;
|
|
56
44
|
endedAt?: string;
|
|
57
45
|
}>;
|
|
58
|
-
export type ResumeCoordinate = Readonly<{
|
|
59
|
-
sessionId: string;
|
|
60
|
-
}>;
|
|
61
46
|
export type SessionFact = Readonly<{
|
|
62
47
|
sequence: number;
|
|
63
48
|
provider: string;
|
|
@@ -75,26 +60,73 @@ export type ForkPoint = Readonly<{
|
|
|
75
60
|
}>;
|
|
76
61
|
export type TurnOutcome = Readonly<{
|
|
77
62
|
kind: "answered";
|
|
78
|
-
historyId
|
|
63
|
+
historyId?: string;
|
|
79
64
|
session: ResumeCoordinate;
|
|
80
65
|
answer: string;
|
|
81
66
|
}> | Readonly<{
|
|
82
67
|
kind: "failed";
|
|
83
68
|
diagnostic: string;
|
|
84
69
|
}>;
|
|
85
|
-
export type
|
|
70
|
+
export type TurnStartFact = Readonly<{
|
|
71
|
+
kind: "turn-start";
|
|
86
72
|
sequence: number;
|
|
87
73
|
bodySequence: number;
|
|
74
|
+
startedAt: string;
|
|
75
|
+
}>;
|
|
76
|
+
export type TurnEndFact = Readonly<{
|
|
77
|
+
kind: "turn-end";
|
|
78
|
+
sequence: number;
|
|
79
|
+
turnSequence: number;
|
|
88
80
|
outcome: TurnOutcome;
|
|
89
81
|
completedAt: string;
|
|
90
82
|
}>;
|
|
91
|
-
export type
|
|
83
|
+
export type TurnFact = TurnStartFact & Readonly<{
|
|
84
|
+
end?: TurnEndFact;
|
|
85
|
+
}>;
|
|
86
|
+
export type CallFact = Readonly<{
|
|
87
|
+
kind: "call";
|
|
88
|
+
sequence: number;
|
|
89
|
+
turnSequence: number;
|
|
90
|
+
body: string;
|
|
91
|
+
at: string;
|
|
92
|
+
}>;
|
|
93
|
+
export type TellDelivery = Readonly<{
|
|
94
|
+
turnSequence: number;
|
|
95
|
+
route: "launch" | "live";
|
|
96
|
+
receipt?: "unavailable" | "required";
|
|
97
|
+
deliveredAt: string;
|
|
98
|
+
}>;
|
|
92
99
|
export type TellFact = Readonly<{
|
|
100
|
+
kind: "tell";
|
|
101
|
+
sequence: number;
|
|
93
102
|
id: string;
|
|
94
103
|
body: string;
|
|
95
|
-
state: TellState;
|
|
96
104
|
recordedAt: string;
|
|
97
|
-
|
|
105
|
+
state: "pending" | "told";
|
|
106
|
+
deliveries: readonly TellDelivery[];
|
|
107
|
+
}>;
|
|
108
|
+
export type TellDeliveryInput = Readonly<{
|
|
109
|
+
tellId: string;
|
|
110
|
+
turnSequence: number;
|
|
111
|
+
fence: string;
|
|
112
|
+
deliveredAt: string;
|
|
113
|
+
}> & (Readonly<{
|
|
114
|
+
route: "launch";
|
|
115
|
+
}> | Readonly<{
|
|
116
|
+
route: "live";
|
|
117
|
+
receipt: "unavailable" | "required";
|
|
118
|
+
}>);
|
|
119
|
+
export type TellReceiptInput = Readonly<{
|
|
120
|
+
kind: string;
|
|
121
|
+
receivedAt: string;
|
|
122
|
+
}> & (Readonly<{
|
|
123
|
+
evidence: "exact";
|
|
124
|
+
tellId: string;
|
|
125
|
+
}> | Readonly<{
|
|
126
|
+
evidence: "fence";
|
|
127
|
+
turnSequence: number;
|
|
128
|
+
fence: string;
|
|
129
|
+
}>);
|
|
98
130
|
export type RequestInput = Readonly<{
|
|
99
131
|
id: string;
|
|
100
132
|
archetype: string;
|
|
@@ -120,31 +152,42 @@ export type RequestFact = RequestInput & Readonly<{
|
|
|
120
152
|
state: "voided";
|
|
121
153
|
evidence: string;
|
|
122
154
|
}>);
|
|
123
|
-
export type KillEvidence = "killed" | "already-
|
|
124
|
-
export type
|
|
125
|
-
|
|
155
|
+
export type KillEvidence = "killed" | "already-killed" | "already-stopped" | "hung" | "untidy" | "unavailable";
|
|
156
|
+
export type KillFact = Readonly<{
|
|
157
|
+
sequence: number;
|
|
158
|
+
bodySequence: number;
|
|
159
|
+
evidence: "killed";
|
|
126
160
|
at: string;
|
|
127
161
|
}>;
|
|
162
|
+
export type StopFact = Readonly<{
|
|
163
|
+
bodySequence: number;
|
|
164
|
+
requestedAt: string;
|
|
165
|
+
}>;
|
|
166
|
+
export type PauseFact = Readonly<{
|
|
167
|
+
bodySequence: number;
|
|
168
|
+
requestedAt: string;
|
|
169
|
+
}>;
|
|
128
170
|
export type SealFact = Readonly<{
|
|
129
171
|
evidence: string;
|
|
130
172
|
at: string;
|
|
131
173
|
}>;
|
|
132
174
|
export type LeashProbe = "held" | "free";
|
|
133
|
-
export type
|
|
134
|
-
kind: "gone";
|
|
135
|
-
end: BodyEnd | null;
|
|
136
|
-
}> | Readonly<{
|
|
137
|
-
kind: "alive";
|
|
138
|
-
}> | Readonly<{
|
|
139
|
-
kind: "unverifiable";
|
|
140
|
-
diagnostic: string;
|
|
141
|
-
}>;
|
|
142
|
-
export type AkumaLife = "running" | "asleep" | "stranded" | "headless" | "dead";
|
|
175
|
+
export type AkumaLife = "running" | "asleep" | "stranded" | "hung" | "untidy" | "killed";
|
|
143
176
|
export type HeartSnapshot = Readonly<{
|
|
144
177
|
soul: Soul | null;
|
|
145
178
|
latestBody: BodyFact | null;
|
|
146
179
|
latestSession: SessionFact | null;
|
|
147
180
|
pending: readonly TellFact[];
|
|
148
|
-
|
|
181
|
+
latestKill: KillFact | null;
|
|
182
|
+
stop: StopFact | null;
|
|
183
|
+
pause: PauseFact | null;
|
|
184
|
+
}>;
|
|
185
|
+
export declare function life(input: Readonly<{
|
|
186
|
+
leash: LeashProbe;
|
|
187
|
+
body: BodyFact | null;
|
|
188
|
+
kill: KillFact | null;
|
|
189
|
+
}>): AkumaLife;
|
|
190
|
+
export declare function lifeAt(current: AkumaLife, body: BodyFact | null, kill: KillFact | null, createdAt: string): string | null;
|
|
191
|
+
export type SoulRow = Readonly<{
|
|
192
|
+
soul_json: string;
|
|
149
193
|
}>;
|
|
150
|
-
export declare function life(leashProbe: LeashProbe, collarProbe: CollarProbe, deathRow: DeathFact | null): AkumaLife;
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
export function life(
|
|
2
|
-
if (
|
|
3
|
-
return "
|
|
4
|
-
if (
|
|
5
|
-
return "
|
|
6
|
-
if (
|
|
7
|
-
return "
|
|
8
|
-
return
|
|
1
|
+
export function life(input) {
|
|
2
|
+
if (input.leash === "held")
|
|
3
|
+
return input.body?.hung === undefined ? "running" : "hung";
|
|
4
|
+
if (input.body === null || input.body.end === undefined)
|
|
5
|
+
return "untidy";
|
|
6
|
+
if (input.kill?.bodySequence === input.body.sequence)
|
|
7
|
+
return "killed";
|
|
8
|
+
return input.body.end === "exited" ? "asleep" : "stranded";
|
|
9
|
+
}
|
|
10
|
+
export function lifeAt(current, body, kill, createdAt) {
|
|
11
|
+
if (current === "running")
|
|
12
|
+
return body?.leashTakenAt ?? null;
|
|
13
|
+
if (current === "hung")
|
|
14
|
+
return body?.hung?.at ?? null;
|
|
15
|
+
if (current === "killed")
|
|
16
|
+
return kill?.at ?? null;
|
|
17
|
+
if (current === "asleep")
|
|
18
|
+
return body?.endedAt ?? createdAt;
|
|
19
|
+
return current === "stranded" ? body?.endedAt ?? null : null;
|
|
9
20
|
}
|
|
@@ -1,36 +1,21 @@
|
|
|
1
1
|
import type { AkuId, AkumaPaths } from "../identity.js";
|
|
2
|
-
import type { BodyEnd, BodyFact,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
evidence: string;
|
|
15
|
-
at: string;
|
|
16
|
-
}>): "born" | "sealed";
|
|
17
|
-
clearPause(paths: AkumaPaths): void;
|
|
18
|
-
release(): void;
|
|
19
|
-
}
|
|
20
|
-
export declare function probeLeash(paths: AkumaPaths): LeashProbe;
|
|
21
|
-
export declare function readSoul(paths: AkumaPaths): Soul | null;
|
|
22
|
-
export declare function heartExists(paths: AkumaPaths): boolean;
|
|
23
|
-
export declare function readSeal(paths: AkumaPaths): SealFact | null;
|
|
24
|
-
export declare function recordBody(paths: AkumaPaths, input: Readonly<{
|
|
25
|
-
collar: Collar;
|
|
26
|
-
leashTakenAt: string;
|
|
27
|
-
}>): BodyFact;
|
|
28
|
-
export declare function recordSession(paths: AkumaPaths, input: Omit<SessionFact, "sequence">): SessionFact;
|
|
2
|
+
import type { BodyEnd, BodyFact, ForkPoint, HeartSnapshot, KillFact, RequestFact, RequestInput, SealFact, SessionFact, Soul, TellDeliveryInput, TellFact, TellReceiptInput, TurnEndFact, TurnFact, TurnOutcome, TurnStartFact } from "./facts.js";
|
|
3
|
+
export type { CallFact } from "./facts.js";
|
|
4
|
+
import type { ActivityFact } from "./rows.js";
|
|
5
|
+
import { type ActivityFactSlice } from "./timeline.js";
|
|
6
|
+
export { HeartAbsentError, HeldAkumaLeash, initializeHeart, isHeartAbsent, probeLeash } from "./storage.js";
|
|
7
|
+
export { life, lifeAt } from "./facts.js";
|
|
8
|
+
export type { AkumaLife, AkumaOrigin, BodyEnd, BodyFact, Confinement, HeartSnapshot, ForkPoint, KillEvidence, KillFact, LeashProbe, PauseFact, RequestFact, RequestInput, RequestRecipe, SealFact, SessionFact, Soul, StopFact, TellFact, TellDelivery, TellDeliveryInput, TellReceiptInput, TurnEndFact, TurnFact, TurnOutcome, TurnStartFact, } from "./facts.js";
|
|
9
|
+
export type { ResumeCoordinate } from "../coordinate.js";
|
|
10
|
+
export declare function readSoul(paths: AkumaPaths): Promise<Soul | null>;
|
|
11
|
+
export declare function heartExists(paths: AkumaPaths): Promise<boolean>;
|
|
12
|
+
export declare function readSeal(paths: AkumaPaths): Promise<SealFact | null>;
|
|
13
|
+
export declare function recordSession(paths: AkumaPaths, input: Omit<SessionFact, "sequence">): Promise<SessionFact>;
|
|
29
14
|
export declare function appendActivity(paths: AkumaPaths, input: Readonly<{
|
|
30
|
-
|
|
15
|
+
turnSequence: number;
|
|
31
16
|
event: unknown;
|
|
32
17
|
at: string;
|
|
33
|
-
}>): number
|
|
18
|
+
}>): Promise<number>;
|
|
34
19
|
export type ActivitySliceInput = Readonly<{
|
|
35
20
|
before?: number;
|
|
36
21
|
since?: number;
|
|
@@ -38,41 +23,65 @@ export type ActivitySliceInput = Readonly<{
|
|
|
38
23
|
}>;
|
|
39
24
|
export type ActivitySlice = ActivityFactSlice;
|
|
40
25
|
export type { ActivityFact };
|
|
41
|
-
export
|
|
42
|
-
export declare function
|
|
43
|
-
export declare function
|
|
26
|
+
export type { TimelineFact } from "./timeline.js";
|
|
27
|
+
export declare function activitySlice(paths: AkumaPaths, input?: ActivitySliceInput): Promise<ActivitySlice>;
|
|
28
|
+
export declare function recordTell(paths: AkumaPaths, tell: Omit<TellFact, "sequence" | "state" | "deliveries">): Promise<Readonly<{
|
|
29
|
+
kind: "not-born";
|
|
30
|
+
} | {
|
|
31
|
+
kind: "recorded";
|
|
32
|
+
tell: TellFact;
|
|
33
|
+
}>>;
|
|
34
|
+
export declare function recordTellDeliveries(paths: AkumaPaths, inputs: readonly TellDeliveryInput[]): Promise<void>;
|
|
35
|
+
export declare function recordTellReceipt(paths: AkumaPaths, input: TellReceiptInput): Promise<void>;
|
|
44
36
|
export declare function admitRequest(paths: AkumaPaths, input: RequestInput & Readonly<{
|
|
45
37
|
admittedAt: string;
|
|
46
|
-
}>): RequestFact
|
|
47
|
-
export declare function reserveRequest(paths: AkumaPaths, id: string, child: AkuId): RequestFact
|
|
48
|
-
export declare function serveRequest(paths: AkumaPaths, id: string, child: AkuId): RequestFact
|
|
49
|
-
export declare function refuseRequest(paths: AkumaPaths, id: string, diagnostic: string): RequestFact
|
|
50
|
-
export declare function voidRequest(paths: AkumaPaths, id: string, evidence: string): RequestFact
|
|
51
|
-
export declare function readRequest(paths: AkumaPaths, id: string): RequestFact | null
|
|
52
|
-
export declare function readNonterminalRequests(paths: AkumaPaths): readonly RequestFact[]
|
|
53
|
-
export declare function
|
|
54
|
-
export declare function
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
38
|
+
}>): Promise<RequestFact>;
|
|
39
|
+
export declare function reserveRequest(paths: AkumaPaths, id: string, child: AkuId): Promise<RequestFact>;
|
|
40
|
+
export declare function serveRequest(paths: AkumaPaths, id: string, child: AkuId): Promise<RequestFact>;
|
|
41
|
+
export declare function refuseRequest(paths: AkumaPaths, id: string, diagnostic: string): Promise<RequestFact>;
|
|
42
|
+
export declare function voidRequest(paths: AkumaPaths, id: string, evidence: string): Promise<RequestFact>;
|
|
43
|
+
export declare function readRequest(paths: AkumaPaths, id: string): Promise<RequestFact | null>;
|
|
44
|
+
export declare function readNonterminalRequests(paths: AkumaPaths): Promise<readonly RequestFact[]>;
|
|
45
|
+
export declare function readKill(paths: AkumaPaths, bodySequence: number): Promise<KillFact | null>;
|
|
46
|
+
export declare function requestStop(paths: AkumaPaths, at: string): Promise<Readonly<{
|
|
47
|
+
kind: "requested";
|
|
48
|
+
body: BodyFact;
|
|
49
|
+
}> | Readonly<{
|
|
50
|
+
kind: "already-killed" | "already-stopped";
|
|
51
|
+
body: BodyFact;
|
|
52
|
+
}>>;
|
|
53
|
+
export declare function requestPause(paths: AkumaPaths, at: string): Promise<Readonly<{
|
|
54
|
+
kind: "not-born";
|
|
55
|
+
} | {
|
|
56
|
+
kind: "requested";
|
|
57
|
+
body: BodyFact;
|
|
58
|
+
}>>;
|
|
59
|
+
export declare function stopRequested(paths: AkumaPaths, bodySequence?: number): Promise<boolean>;
|
|
60
|
+
export declare function pauseRequested(paths: AkumaPaths, bodySequence?: number): Promise<boolean>;
|
|
59
61
|
export declare function breakBody(paths: AkumaPaths, input: Readonly<{
|
|
60
62
|
sequence: number;
|
|
61
63
|
end: Exclude<BodyEnd, "exited">;
|
|
62
64
|
at: string;
|
|
63
|
-
}>): void
|
|
64
|
-
export declare function
|
|
65
|
+
}>): Promise<void>;
|
|
66
|
+
export declare function beginTurn(paths: AkumaPaths, input: Readonly<{
|
|
67
|
+
bodySequence: number;
|
|
68
|
+
startedAt: string;
|
|
69
|
+
call?: string;
|
|
70
|
+
}>): Promise<TurnStartFact>;
|
|
71
|
+
export declare function endTurn(paths: AkumaPaths, input: Readonly<{
|
|
72
|
+
turnSequence: number;
|
|
73
|
+
outcome: TurnOutcome;
|
|
74
|
+
completedAt: string;
|
|
75
|
+
}>): Promise<TurnEndFact>;
|
|
65
76
|
export declare function finishBodyIfIdle(paths: AkumaPaths, input: Readonly<{
|
|
66
77
|
sequence: number;
|
|
67
78
|
at: string;
|
|
68
|
-
}>): Readonly<{
|
|
69
|
-
kind: "finished";
|
|
79
|
+
}>): Promise<Readonly<{
|
|
80
|
+
kind: "controlled" | "finished";
|
|
70
81
|
} | {
|
|
71
82
|
kind: "pending";
|
|
72
83
|
tells: readonly string[];
|
|
73
|
-
}
|
|
74
|
-
export declare function readHeart(paths: AkumaPaths): HeartSnapshot
|
|
75
|
-
export declare function
|
|
76
|
-
export declare function
|
|
77
|
-
export declare function readCurrentTurn(paths: AkumaPaths): TurnFact | null;
|
|
78
|
-
export declare function readForkPoint(paths: AkumaPaths, historyId: string): ForkPoint | null;
|
|
84
|
+
}>>;
|
|
85
|
+
export declare function readHeart(paths: AkumaPaths): Promise<HeartSnapshot>;
|
|
86
|
+
export declare function readLastAnsweredTurn(paths: AkumaPaths): Promise<TurnFact | null>;
|
|
87
|
+
export declare function readForkPoint(paths: AkumaPaths, historyId: string): Promise<ForkPoint | null>;
|