@astrosheep/keiyaku 4.0.0 → 4.0.1
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 +2 -9
- 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 +11 -3
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/SKILL.md +9 -6
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-bind/SKILL.md +94 -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 +162 -45
- package/build/src/akuma/akuma.d.ts +33 -25
- package/build/src/akuma/akuma.js +93 -61
- package/build/src/akuma/archetype.d.ts +8 -0
- package/build/src/akuma/archetype.js +28 -9
- package/build/src/akuma/body.js +196 -84
- 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 +67 -15
- package/build/src/akuma/heart/facts.js +3 -3
- package/build/src/akuma/heart/index.d.ts +41 -29
- package/build/src/akuma/heart/index.js +72 -193
- package/build/src/akuma/heart/rows.d.ts +30 -53
- package/build/src/akuma/heart/rows.js +91 -111
- package/build/src/akuma/heart/schema.d.ts +1 -1
- package/build/src/akuma/heart/schema.js +55 -8
- package/build/src/akuma/heart/storage.d.ts +33 -0
- package/build/src/akuma/heart/storage.js +164 -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/index.d.ts +4 -2
- package/build/src/akuma/index.js +1 -1
- package/build/src/akuma/projection.d.ts +97 -0
- package/build/src/akuma/projection.js +145 -0
- package/build/src/akuma/provider.d.ts +57 -11
- package/build/src/akuma/provider.js +57 -37
- package/build/src/akuma/providers/{claude.d.ts → claude/events.d.ts} +9 -41
- package/build/src/akuma/providers/claude/events.js +185 -0
- package/build/src/akuma/providers/claude/index.d.ts +46 -0
- package/build/src/akuma/providers/claude/index.js +265 -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 +12 -12
- package/build/src/akuma/providers/codex-app-server/index.d.ts +13 -11
- package/build/src/akuma/providers/codex-app-server/index.js +73 -22
- package/build/src/akuma/providers/index.js +22 -8
- package/build/src/akuma/providers/opencode-sdk/events.d.ts +48 -0
- package/build/src/akuma/providers/opencode-sdk/events.js +116 -0
- package/build/src/akuma/providers/opencode-sdk/index.d.ts +32 -0
- package/build/src/akuma/providers/opencode-sdk/index.js +203 -0
- package/build/src/akuma/providers/opencode-sdk/session.d.ts +41 -0
- package/build/src/akuma/providers/opencode-sdk/session.js +62 -0
- package/build/src/akuma/providers/pi/events.d.ts +33 -0
- package/build/src/akuma/providers/pi/events.js +128 -0
- package/build/src/akuma/providers/pi/index.d.ts +11 -0
- package/build/src/akuma/providers/pi/index.js +162 -0
- package/build/src/akuma/requests.d.ts +1 -0
- package/build/src/akuma/requests.js +5 -2
- package/build/src/alias/index.d.ts +4 -3
- package/build/src/alias/index.js +2 -3
- 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 +2 -0
- package/build/src/cli/accepted.js +2 -1
- package/build/src/cli/commands/akuma-invoke.d.ts +42 -18
- package/build/src/cli/commands/akuma-invoke.js +94 -50
- package/build/src/cli/commands/akuma.d.ts +15 -7
- package/build/src/cli/commands/akuma.js +94 -56
- package/build/src/cli/commands/contract.d.ts +142 -0
- package/build/src/cli/commands/contract.js +14 -0
- package/build/src/cli/commands/install.js +2 -0
- package/build/src/cli/commands/task-invoke.d.ts +3 -1
- package/build/src/cli/commands/task-invoke.js +27 -2
- package/build/src/cli/commands/task.js +2 -2
- package/build/src/cli/invoke.d.ts +6 -1
- package/build/src/cli/invoke.js +241 -43
- package/build/src/cli/main.js +20 -1
- package/build/src/cli/parse.d.ts +13 -116
- package/build/src/cli/parse.js +51 -78
- package/build/src/cli/render/akuma-tool.d.ts +2 -0
- package/build/src/cli/render/akuma-tool.js +6 -2
- package/build/src/cli/render/akuma.d.ts +2 -1
- package/build/src/cli/render/akuma.js +157 -217
- 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 +1 -1
- package/build/src/cli/render/contract.js +38 -5
- package/build/src/cli/render/kanshi.js +53 -5
- package/build/src/cli/render/refusal.js +17 -0
- package/build/src/cli/render/terminal.d.ts +13 -0
- package/build/src/cli/render/terminal.js +75 -0
- package/build/src/cli/render/text.js +5 -0
- package/build/src/cli/result.d.ts +15 -3
- package/build/src/contract-worktree.d.ts +43 -0
- package/build/src/contract-worktree.js +213 -0
- package/build/src/coordination/durable-file.d.ts +3 -0
- package/build/src/coordination/durable-file.js +44 -1
- 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/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.js +12 -16
- package/build/src/core/verbs/bind.js +2 -16
- package/build/src/core/verbs/deliver.js +20 -4
- package/build/src/core/verbs/placement.js +3 -8
- package/build/src/dispatch/index.d.ts +3 -1
- package/build/src/dispatch/index.js +14 -5
- 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 +26 -16
- package/build/src/git/hooks.d.ts +15 -0
- package/build/src/git/hooks.js +57 -5
- package/build/src/git/identity.d.ts +5 -1
- package/build/src/git/identity.js +23 -4
- package/build/src/git/integration.d.ts +49 -0
- package/build/src/git/integration.js +214 -0
- package/build/src/git/observe.d.ts +25 -13
- package/build/src/git/observe.js +175 -72
- 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 +15 -5
- package/build/src/git/reconcile.js +238 -85
- package/build/src/git/repository.d.ts +19 -4
- package/build/src/git/repository.js +77 -43
- package/build/src/git/scratch.d.ts +13 -0
- package/build/src/git/scratch.js +66 -0
- package/build/src/git/target-placement.d.ts +56 -0
- package/build/src/git/target-placement.js +255 -0
- package/build/src/git/tender.d.ts +48 -0
- package/build/src/git/tender.js +82 -0
- package/build/src/git/terminal-seal.d.ts +24 -0
- package/build/src/git/terminal-seal.js +87 -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 +21 -0
- package/build/src/git/workspace.js +104 -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 +1 -1
- package/build/src/kanshi/read.d.ts +5 -2
- package/build/src/kanshi/read.js +154 -45
- package/build/src/kanshi/report.d.ts +31 -6
- package/build/src/kanshi/select.js +1 -1
- package/build/src/library/address.d.ts +48 -0
- package/build/src/library/address.js +134 -0
- package/build/src/library/akuma-creation.d.ts +10 -6
- package/build/src/library/akuma-creation.js +12 -11
- 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 +72 -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 +21 -46
- package/build/src/library/contract.js +193 -183
- package/build/src/library/delivery.d.ts +23 -0
- package/build/src/library/delivery.js +21 -0
- package/build/src/library/fleet.d.ts +65 -0
- package/build/src/library/fleet.js +189 -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 +16 -2
- package/build/src/library/keiyaku.js +11 -1
- package/build/src/library/mutation.d.ts +38 -0
- package/build/src/library/mutation.js +39 -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 +2 -1
- package/build/src/library/region.js +3 -3
- package/build/src/library/repo.d.ts +4 -1
- package/build/src/library/repo.js +31 -16
- package/build/src/protocol/attempt.d.ts +16 -3
- package/build/src/protocol/attempt.js +39 -8
- package/build/src/protocol/bind.d.ts +9 -2
- package/build/src/protocol/bind.js +47 -39
- package/build/src/protocol/intent.d.ts +42 -18
- package/build/src/protocol/intent.js +36 -75
- package/build/src/protocol/operations.d.ts +93 -35
- package/build/src/protocol/operations.js +235 -123
- package/build/src/protocol/outcome.d.ts +7 -2
- package/build/src/protocol/outcome.js +9 -3
- package/build/src/protocol/placement.d.ts +30 -0
- package/build/src/protocol/placement.js +114 -0
- package/build/src/protocol/read/audit.d.ts +9 -3
- package/build/src/protocol/read/audit.js +25 -9
- 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 +11 -5
- package/build/src/protocol/read/status.js +28 -15
- 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 +1 -0
- package/build/src/runtime/proc/line-rpc.js +21 -0
- package/build/src/runtime/proc/run.d.ts +18 -2
- package/build/src/runtime/proc/run.js +34 -8
- package/build/src/settings.d.ts +6 -0
- package/build/src/settings.js +29 -14
- package/build/src/settlement/fence.d.ts +9 -0
- package/build/src/settlement/fence.js +23 -0
- package/build/src/settlement/holder.d.ts +25 -4
- package/build/src/settlement/holder.js +102 -28
- package/build/src/settlement/settle.d.ts +8 -0
- package/build/src/settlement/settle.js +102 -28
- package/build/src/task/board.d.ts +20 -2
- package/build/src/task/board.js +11 -1
- package/build/src/task/compose.d.ts +2 -2
- package/build/src/task/compose.js +2 -2
- package/build/src/task/context.js +2 -7
- package/build/src/task/index.d.ts +9 -9
- package/build/src/task/index.js +15 -12
- package/build/src/task/operations.d.ts +31 -12
- package/build/src/task/operations.js +8 -4
- package/build/src/task/store.d.ts +4 -6
- package/build/src/task/store.js +3 -3
- package/build/src/verification/declaration.d.ts +1 -0
- package/build/src/verification/execution.d.ts +49 -0
- package/build/src/verification/execution.js +104 -0
- package/build/src/world.d.ts +13 -0
- package/build/src/world.js +103 -0
- package/package.json +7 -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/verification/producer.d.ts +0 -23
- package/build/src/verification/producer.js +0 -54
|
@@ -1,23 +1,12 @@
|
|
|
1
1
|
import type { AkuId, AkumaPaths } from "../identity.js";
|
|
2
|
-
import type { BodyEnd, BodyFact, Collar,
|
|
3
|
-
|
|
2
|
+
import type { BodyEnd, BodyFact, Collar, 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 { HeldAkumaLeash, initializeHeart, probeLeash } from "./storage.js";
|
|
4
7
|
export { life } from "./facts.js";
|
|
5
|
-
export type { AkumaLife, AkumaOrigin, BodyEnd, BodyFact, Collar, CollarProbe, Confinement,
|
|
6
|
-
export
|
|
7
|
-
export declare class HeldAkumaLeash {
|
|
8
|
-
private readonly database;
|
|
9
|
-
private closed;
|
|
10
|
-
private constructor();
|
|
11
|
-
static try(paths: AkumaPaths): HeldAkumaLeash | null;
|
|
12
|
-
birth(paths: AkumaPaths, soul: Soul, session?: Omit<SessionFact, "sequence">): "born" | "already-born" | "sealed";
|
|
13
|
-
sealIfUnborn(paths: AkumaPaths, input: Readonly<{
|
|
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;
|
|
8
|
+
export type { AkumaLife, AkumaOrigin, BodyEnd, BodyFact, Collar, CollarProbe, Confinement, HeartSnapshot, ForkPoint, KillEvidence, KillFact, LeashProbe, ProviderOptions, ProviderExecution, 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";
|
|
21
10
|
export declare function readSoul(paths: AkumaPaths): Soul | null;
|
|
22
11
|
export declare function heartExists(paths: AkumaPaths): boolean;
|
|
23
12
|
export declare function readSeal(paths: AkumaPaths): SealFact | null;
|
|
@@ -27,7 +16,7 @@ export declare function recordBody(paths: AkumaPaths, input: Readonly<{
|
|
|
27
16
|
}>): BodyFact;
|
|
28
17
|
export declare function recordSession(paths: AkumaPaths, input: Omit<SessionFact, "sequence">): SessionFact;
|
|
29
18
|
export declare function appendActivity(paths: AkumaPaths, input: Readonly<{
|
|
30
|
-
|
|
19
|
+
turnSequence: number;
|
|
31
20
|
event: unknown;
|
|
32
21
|
at: string;
|
|
33
22
|
}>): number;
|
|
@@ -38,9 +27,16 @@ export type ActivitySliceInput = Readonly<{
|
|
|
38
27
|
}>;
|
|
39
28
|
export type ActivitySlice = ActivityFactSlice;
|
|
40
29
|
export type { ActivityFact };
|
|
30
|
+
export type { TimelineFact } from "./timeline.js";
|
|
41
31
|
export declare function activitySlice(paths: AkumaPaths, input?: ActivitySliceInput): ActivitySlice;
|
|
42
|
-
export declare function recordTell(paths: AkumaPaths, tell: Omit<TellFact, "
|
|
43
|
-
|
|
32
|
+
export declare function recordTell(paths: AkumaPaths, tell: Omit<TellFact, "sequence" | "state" | "deliveries">): Readonly<{
|
|
33
|
+
kind: "not-born";
|
|
34
|
+
} | {
|
|
35
|
+
kind: "recorded";
|
|
36
|
+
tell: TellFact;
|
|
37
|
+
}>;
|
|
38
|
+
export declare function recordTellDeliveries(paths: AkumaPaths, inputs: readonly TellDeliveryInput[]): void;
|
|
39
|
+
export declare function recordTellReceipt(paths: AkumaPaths, input: TellReceiptInput): void;
|
|
44
40
|
export declare function admitRequest(paths: AkumaPaths, input: RequestInput & Readonly<{
|
|
45
41
|
admittedAt: string;
|
|
46
42
|
}>): RequestFact;
|
|
@@ -50,18 +46,36 @@ export declare function refuseRequest(paths: AkumaPaths, id: string, diagnostic:
|
|
|
50
46
|
export declare function voidRequest(paths: AkumaPaths, id: string, evidence: string): RequestFact;
|
|
51
47
|
export declare function readRequest(paths: AkumaPaths, id: string): RequestFact | null;
|
|
52
48
|
export declare function readNonterminalRequests(paths: AkumaPaths): readonly RequestFact[];
|
|
53
|
-
export declare function
|
|
54
|
-
export declare function
|
|
55
|
-
|
|
49
|
+
export declare function readKill(paths: AkumaPaths, bodySequence: number): KillFact | null;
|
|
50
|
+
export declare function requestStop(paths: AkumaPaths, at: string): Readonly<{
|
|
51
|
+
kind: "requested";
|
|
52
|
+
body: BodyFact;
|
|
53
|
+
}> | Readonly<{
|
|
54
|
+
kind: "already-killed";
|
|
55
|
+
body: BodyFact;
|
|
56
|
+
}>;
|
|
57
|
+
export declare function requestPause(paths: AkumaPaths, at: string): Readonly<{
|
|
58
|
+
kind: "not-born";
|
|
59
|
+
} | {
|
|
60
|
+
kind: "requested";
|
|
61
|
+
}>;
|
|
62
|
+
export declare function stopRequested(paths: AkumaPaths, bodySequence?: number): boolean;
|
|
56
63
|
export declare function pauseRequested(paths: AkumaPaths): boolean;
|
|
57
|
-
export declare function clearAbandonedControl(paths: AkumaPaths): void;
|
|
58
|
-
export declare function recordDeath(paths: AkumaPaths, death: DeathFact): "recorded" | "already-dead";
|
|
59
64
|
export declare function breakBody(paths: AkumaPaths, input: Readonly<{
|
|
60
65
|
sequence: number;
|
|
61
66
|
end: Exclude<BodyEnd, "exited">;
|
|
62
67
|
at: string;
|
|
63
68
|
}>): void;
|
|
64
|
-
export declare function
|
|
69
|
+
export declare function beginTurn(paths: AkumaPaths, input: Readonly<{
|
|
70
|
+
bodySequence: number;
|
|
71
|
+
startedAt: string;
|
|
72
|
+
call?: string;
|
|
73
|
+
}>): TurnStartFact;
|
|
74
|
+
export declare function endTurn(paths: AkumaPaths, input: Readonly<{
|
|
75
|
+
turnSequence: number;
|
|
76
|
+
outcome: TurnOutcome;
|
|
77
|
+
completedAt: string;
|
|
78
|
+
}>): TurnEndFact;
|
|
65
79
|
export declare function finishBodyIfIdle(paths: AkumaPaths, input: Readonly<{
|
|
66
80
|
sequence: number;
|
|
67
81
|
at: string;
|
|
@@ -72,7 +86,5 @@ export declare function finishBodyIfIdle(paths: AkumaPaths, input: Readonly<{
|
|
|
72
86
|
tells: readonly string[];
|
|
73
87
|
}>;
|
|
74
88
|
export declare function readHeart(paths: AkumaPaths): HeartSnapshot;
|
|
75
|
-
export declare function readTurns(paths: AkumaPaths): readonly TurnFact[];
|
|
76
89
|
export declare function readLastAnsweredTurn(paths: AkumaPaths): TurnFact | null;
|
|
77
|
-
export declare function readCurrentTurn(paths: AkumaPaths): TurnFact | null;
|
|
78
90
|
export declare function readForkPoint(paths: AkumaPaths, historyId: string): ForkPoint | null;
|
|
@@ -1,125 +1,11 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { activityFactSlice,
|
|
2
|
+
import { answeredTurnFact, endBodyFact, finishBodyFact, insertActivityFact, insertBodyFact, insertTurnEndFact, insertTurnStartFact, insertPauseControl, insertRequestFact, insertSessionFact, insertStopControl, killFactForBody, latestBodyFact, latestKillFact, latestSessionFact, lastAnsweredTurnFact, nonterminalRequestFacts, pauseExists, requestFact, sessionFactForCoordinate, soulFact, stopFact, updateRequestRefused, updateRequestReserved, updateRequestServed, updateRequestVoided, } from "./rows.js";
|
|
3
|
+
import { insertTellDeliveryFact, insertTellFact, insertTellReceiptFact, pendingTellFacts, tellFact, tellIdsForFence, } from "./tells.js";
|
|
4
|
+
import { activityFactSlice, pruneActivityFacts, } from "./timeline.js";
|
|
5
|
+
import { readSealFromLeash, transaction, withHeart } from "./storage.js";
|
|
6
|
+
export { HeldAkumaLeash, initializeHeart, probeLeash } from "./storage.js";
|
|
5
7
|
export { life } from "./facts.js";
|
|
6
8
|
const ACTIVITY_LIMIT = 5_000;
|
|
7
|
-
function isBusy(error) {
|
|
8
|
-
const value = error;
|
|
9
|
-
const message = String(value?.message ?? "").toLowerCase();
|
|
10
|
-
return value?.code === "ERR_SQLITE_BUSY" || value?.code === "ERR_SQLITE_LOCKED"
|
|
11
|
-
|| value?.errcode === 5 || message.includes("database is locked") || message.includes("database is busy");
|
|
12
|
-
}
|
|
13
|
-
function openHeart(path, verify = true) {
|
|
14
|
-
const database = new DatabaseSync(path);
|
|
15
|
-
database.exec("PRAGMA foreign_keys=ON; PRAGMA busy_timeout=5000; PRAGMA journal_mode=WAL");
|
|
16
|
-
if (verify)
|
|
17
|
-
assertHeartSchemaVersion(database);
|
|
18
|
-
return database;
|
|
19
|
-
}
|
|
20
|
-
function withHeart(paths, body) {
|
|
21
|
-
const database = openHeart(paths.heart);
|
|
22
|
-
try {
|
|
23
|
-
return body(database);
|
|
24
|
-
}
|
|
25
|
-
finally {
|
|
26
|
-
database.close();
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
function transaction(database, body) {
|
|
30
|
-
database.exec("BEGIN IMMEDIATE");
|
|
31
|
-
try {
|
|
32
|
-
const result = body();
|
|
33
|
-
database.exec("COMMIT");
|
|
34
|
-
return result;
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
try {
|
|
38
|
-
database.exec("ROLLBACK");
|
|
39
|
-
}
|
|
40
|
-
catch { /* preserve the adjudication failure */ }
|
|
41
|
-
throw error;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
export function initializeHeart(paths) {
|
|
45
|
-
const heart = openHeart(paths.heart, false);
|
|
46
|
-
try {
|
|
47
|
-
heart.exec(HEART_SCHEMA);
|
|
48
|
-
assertHeartSchemaVersion(heart);
|
|
49
|
-
}
|
|
50
|
-
finally {
|
|
51
|
-
heart.close();
|
|
52
|
-
}
|
|
53
|
-
const leash = new DatabaseSync(paths.leash);
|
|
54
|
-
try {
|
|
55
|
-
leash.exec(LEASH_SCHEMA);
|
|
56
|
-
assertLeashSchemaVersion(leash);
|
|
57
|
-
}
|
|
58
|
-
finally {
|
|
59
|
-
leash.close();
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
export class HeldAkumaLeash {
|
|
63
|
-
database;
|
|
64
|
-
closed = false;
|
|
65
|
-
constructor(database) {
|
|
66
|
-
this.database = database;
|
|
67
|
-
}
|
|
68
|
-
static try(paths) {
|
|
69
|
-
const database = new DatabaseSync(paths.leash, { timeout: 0 });
|
|
70
|
-
try {
|
|
71
|
-
assertLeashSchemaVersion(database);
|
|
72
|
-
database.exec("PRAGMA busy_timeout=0; BEGIN EXCLUSIVE");
|
|
73
|
-
return new HeldAkumaLeash(database);
|
|
74
|
-
}
|
|
75
|
-
catch (error) {
|
|
76
|
-
database.close();
|
|
77
|
-
if (isBusy(error))
|
|
78
|
-
return null;
|
|
79
|
-
throw error;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
birth(paths, soul, session) {
|
|
83
|
-
if (sealExists(this.database))
|
|
84
|
-
return "sealed";
|
|
85
|
-
return withHeart(paths, (heart) => transaction(heart, () => {
|
|
86
|
-
if (soulFact(heart) !== null)
|
|
87
|
-
return "already-born";
|
|
88
|
-
insertSoulFact(heart, soul);
|
|
89
|
-
if (session !== undefined)
|
|
90
|
-
insertSessionFact(heart, session);
|
|
91
|
-
return "born";
|
|
92
|
-
}));
|
|
93
|
-
}
|
|
94
|
-
sealIfUnborn(paths, input) {
|
|
95
|
-
if (withHeart(paths, (heart) => soulFact(heart)) !== null)
|
|
96
|
-
return "born";
|
|
97
|
-
insertSealFact(this.database, input);
|
|
98
|
-
this.database.exec("COMMIT");
|
|
99
|
-
this.closed = true;
|
|
100
|
-
this.database.close();
|
|
101
|
-
return "sealed";
|
|
102
|
-
}
|
|
103
|
-
clearPause(paths) { withHeart(paths, deletePauseControl); }
|
|
104
|
-
release() {
|
|
105
|
-
if (this.closed)
|
|
106
|
-
return;
|
|
107
|
-
this.closed = true;
|
|
108
|
-
try {
|
|
109
|
-
this.database.exec("ROLLBACK");
|
|
110
|
-
}
|
|
111
|
-
finally {
|
|
112
|
-
this.database.close();
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
export function probeLeash(paths) {
|
|
117
|
-
const claim = HeldAkumaLeash.try(paths);
|
|
118
|
-
if (claim === null)
|
|
119
|
-
return "held";
|
|
120
|
-
claim.release();
|
|
121
|
-
return "free";
|
|
122
|
-
}
|
|
123
9
|
export function readSoul(paths) {
|
|
124
10
|
if (!existsSync(paths.heart))
|
|
125
11
|
return null;
|
|
@@ -129,14 +15,7 @@ export function heartExists(paths) { return existsSync(paths.heart); }
|
|
|
129
15
|
export function readSeal(paths) {
|
|
130
16
|
if (!existsSync(paths.leash))
|
|
131
17
|
return null;
|
|
132
|
-
|
|
133
|
-
try {
|
|
134
|
-
assertLeashSchemaVersion(leash);
|
|
135
|
-
return sealFact(leash);
|
|
136
|
-
}
|
|
137
|
-
finally {
|
|
138
|
-
leash.close();
|
|
139
|
-
}
|
|
18
|
+
return readSealFromLeash(paths);
|
|
140
19
|
}
|
|
141
20
|
export function recordBody(paths, input) {
|
|
142
21
|
return withHeart(paths, (heart) => {
|
|
@@ -159,27 +38,34 @@ export function activitySlice(paths, input = {}) {
|
|
|
159
38
|
}
|
|
160
39
|
export function recordTell(paths, tell) {
|
|
161
40
|
return withHeart(paths, (heart) => transaction(heart, () => {
|
|
162
|
-
if (
|
|
163
|
-
return "
|
|
164
|
-
insertTellFact(heart, tell);
|
|
165
|
-
|
|
41
|
+
if (soulFact(heart) === null)
|
|
42
|
+
return { kind: "not-born" };
|
|
43
|
+
const sequence = insertTellFact(heart, tell);
|
|
44
|
+
pruneActivityFacts(heart, ACTIVITY_LIMIT);
|
|
45
|
+
return { kind: "recorded", tell: { sequence, ...tell, state: "pending", deliveries: [] } };
|
|
166
46
|
}));
|
|
167
47
|
}
|
|
168
|
-
|
|
169
|
-
recorded: 0,
|
|
170
|
-
delivered: 1,
|
|
171
|
-
seen: 2,
|
|
172
|
-
consumed: 3,
|
|
173
|
-
"voided-by-death": 3,
|
|
174
|
-
};
|
|
175
|
-
export function advanceTell(paths, id, state) {
|
|
48
|
+
export function recordTellDeliveries(paths, inputs) {
|
|
176
49
|
withHeart(paths, (heart) => transaction(heart, () => {
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
50
|
+
for (const input of inputs) {
|
|
51
|
+
const current = tellFact(heart, input.tellId);
|
|
52
|
+
if (current === null)
|
|
53
|
+
throw new Error(`unknown tell ${input.tellId}`);
|
|
54
|
+
}
|
|
55
|
+
for (const input of inputs)
|
|
56
|
+
insertTellDeliveryFact(heart, input);
|
|
57
|
+
pruneActivityFacts(heart, ACTIVITY_LIMIT);
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
export function recordTellReceipt(paths, input) {
|
|
61
|
+
withHeart(paths, (heart) => transaction(heart, () => {
|
|
62
|
+
const tellIds = input.evidence === "exact"
|
|
63
|
+
? [input.tellId]
|
|
64
|
+
: tellIdsForFence(heart, input.turnSequence, input.fence);
|
|
65
|
+
if (tellIds.length === 0)
|
|
66
|
+
throw new Error("tell receipt has no delivery mapping");
|
|
67
|
+
insertTellReceiptFact(heart, input);
|
|
68
|
+
pruneActivityFacts(heart, ACTIVITY_LIMIT);
|
|
183
69
|
}));
|
|
184
70
|
}
|
|
185
71
|
function sameRequestInput(fact, input) {
|
|
@@ -259,56 +145,55 @@ export function readRequest(paths, id) {
|
|
|
259
145
|
export function readNonterminalRequests(paths) {
|
|
260
146
|
return withHeart(paths, nonterminalRequestFacts);
|
|
261
147
|
}
|
|
148
|
+
export function readKill(paths, bodySequence) {
|
|
149
|
+
return withHeart(paths, (heart) => killFactForBody(heart, bodySequence));
|
|
150
|
+
}
|
|
262
151
|
export function requestStop(paths, at) {
|
|
263
152
|
return withHeart(paths, (heart) => transaction(heart, () => {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
153
|
+
const body = latestBodyFact(heart);
|
|
154
|
+
if (body === null)
|
|
155
|
+
throw new Error("Akuma has no Body to kill");
|
|
156
|
+
if (latestKillFact(heart)?.bodySequence === body.sequence)
|
|
157
|
+
return { kind: "already-killed", body };
|
|
158
|
+
const existing = stopFact(heart);
|
|
159
|
+
if (existing !== null && existing.bodySequence !== body.sequence) {
|
|
160
|
+
throw new Error("Akuma stop target is not the latest Body");
|
|
161
|
+
}
|
|
162
|
+
insertStopControl(heart, body.sequence, at);
|
|
163
|
+
return { kind: "requested", body };
|
|
268
164
|
}));
|
|
269
165
|
}
|
|
270
166
|
export function requestPause(paths, at) {
|
|
271
167
|
return withHeart(paths, (heart) => transaction(heart, () => {
|
|
272
|
-
if (
|
|
273
|
-
return "
|
|
168
|
+
if (soulFact(heart) === null)
|
|
169
|
+
return { kind: "not-born" };
|
|
274
170
|
insertPauseControl(heart, at);
|
|
275
|
-
return "requested";
|
|
171
|
+
return { kind: "requested" };
|
|
276
172
|
}));
|
|
277
173
|
}
|
|
278
|
-
export function stopRequested(paths
|
|
174
|
+
export function stopRequested(paths, bodySequence) {
|
|
175
|
+
return withHeart(paths, (heart) => {
|
|
176
|
+
const target = stopFact(heart);
|
|
177
|
+
return target !== null && (bodySequence === undefined || target.bodySequence === bodySequence);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
279
180
|
export function pauseRequested(paths) { return withHeart(paths, pauseExists); }
|
|
280
|
-
export function
|
|
281
|
-
|
|
282
|
-
withHeart(paths, deleteAbandonedControls);
|
|
181
|
+
export function breakBody(paths, input) {
|
|
182
|
+
withHeart(paths, (heart) => endBodyFact(heart, input));
|
|
283
183
|
}
|
|
284
|
-
export function
|
|
184
|
+
export function beginTurn(paths, input) {
|
|
285
185
|
return withHeart(paths, (heart) => transaction(heart, () => {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
voidTellsByDeath(heart);
|
|
290
|
-
voidRequestsByDeath(heart, `death:${death.evidence}`);
|
|
291
|
-
return "recorded";
|
|
186
|
+
const fact = insertTurnStartFact(heart, input);
|
|
187
|
+
pruneActivityFacts(heart, ACTIVITY_LIMIT);
|
|
188
|
+
return fact;
|
|
292
189
|
}));
|
|
293
190
|
}
|
|
294
|
-
export function
|
|
295
|
-
withHeart(paths, (heart) =>
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
? insertAnsweredTurnFact(heart, {
|
|
301
|
-
bodySequence: input.bodySequence,
|
|
302
|
-
outcome: input.outcome,
|
|
303
|
-
completedAt: input.completedAt,
|
|
304
|
-
})
|
|
305
|
-
: insertFailedTurnFact(heart, {
|
|
306
|
-
bodySequence: input.bodySequence,
|
|
307
|
-
outcome: input.outcome,
|
|
308
|
-
completedAt: input.completedAt,
|
|
309
|
-
});
|
|
310
|
-
return { sequence, ...input };
|
|
311
|
-
});
|
|
191
|
+
export function endTurn(paths, input) {
|
|
192
|
+
return withHeart(paths, (heart) => transaction(heart, () => {
|
|
193
|
+
const fact = insertTurnEndFact(heart, { kind: "turn-end", ...input });
|
|
194
|
+
pruneActivityFacts(heart, ACTIVITY_LIMIT);
|
|
195
|
+
return fact;
|
|
196
|
+
}));
|
|
312
197
|
}
|
|
313
198
|
export function finishBodyIfIdle(paths, input) {
|
|
314
199
|
return withHeart(paths, (heart) => transaction(heart, () => {
|
|
@@ -321,38 +206,32 @@ export function finishBodyIfIdle(paths, input) {
|
|
|
321
206
|
}
|
|
322
207
|
export function readHeart(paths) {
|
|
323
208
|
if (!existsSync(paths.heart)) {
|
|
324
|
-
return { soul: null, latestBody: null, latestSession: null, pending: [],
|
|
209
|
+
return { soul: null, latestBody: null, latestSession: null, pending: [], latestKill: null };
|
|
325
210
|
}
|
|
326
211
|
return withHeart(paths, (heart) => ({
|
|
327
212
|
soul: soulFact(heart),
|
|
328
213
|
latestBody: latestBodyFact(heart),
|
|
329
214
|
latestSession: latestSessionFact(heart),
|
|
330
215
|
pending: pendingTellFacts(heart),
|
|
331
|
-
|
|
216
|
+
latestKill: latestKillFact(heart),
|
|
332
217
|
}));
|
|
333
218
|
}
|
|
334
|
-
export function readTurns(paths) {
|
|
335
|
-
return withHeart(paths, historyFacts);
|
|
336
|
-
}
|
|
337
219
|
export function readLastAnsweredTurn(paths) {
|
|
338
220
|
return withHeart(paths, lastAnsweredTurnFact);
|
|
339
221
|
}
|
|
340
|
-
export function readCurrentTurn(paths) {
|
|
341
|
-
return withHeart(paths, latestTurnFact);
|
|
342
|
-
}
|
|
343
222
|
export function readForkPoint(paths, historyId) {
|
|
344
223
|
if (!existsSync(paths.heart))
|
|
345
224
|
return null;
|
|
346
225
|
return withHeart(paths, (heart) => {
|
|
347
226
|
const turn = answeredTurnFact(heart, historyId);
|
|
348
|
-
if (turn?.outcome.kind !== "answered")
|
|
227
|
+
if (turn?.end?.outcome.kind !== "answered")
|
|
349
228
|
return null;
|
|
350
|
-
const recipe = sessionFactForCoordinate(heart, turn.outcome.session);
|
|
229
|
+
const recipe = sessionFactForCoordinate(heart, turn.end.outcome.session);
|
|
351
230
|
if (recipe === null)
|
|
352
231
|
throw new Error(`Akuma fork point ${historyId} has no session recipe`);
|
|
353
232
|
return {
|
|
354
|
-
historyId: turn.outcome.historyId,
|
|
355
|
-
session: turn.outcome.session,
|
|
233
|
+
historyId: turn.end.outcome.historyId,
|
|
234
|
+
session: turn.end.outcome.session,
|
|
356
235
|
provider: recipe.provider,
|
|
357
236
|
cwd: recipe.cwd,
|
|
358
237
|
options: recipe.options,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DatabaseSync } from "node:sqlite";
|
|
2
2
|
import type { AkuId } from "../identity.js";
|
|
3
|
-
import type { BodyEnd, BodyFact, Collar,
|
|
3
|
+
import type { BodyEnd, BodyFact, CallFact, Collar, KillFact, RequestFact, RequestInput, ResumeCoordinate, SessionFact, Soul, StopFact, TurnFact, TurnStartFact, TurnEndFact } from "./facts.js";
|
|
4
4
|
export type SoulRow = Readonly<{
|
|
5
5
|
id: string;
|
|
6
6
|
archetype: string;
|
|
@@ -36,18 +36,20 @@ export type SessionRow = Readonly<{
|
|
|
36
36
|
export type TurnRow = Readonly<{
|
|
37
37
|
sequence: number;
|
|
38
38
|
body_sequence: number;
|
|
39
|
-
|
|
39
|
+
started_at: string;
|
|
40
|
+
end_sequence: number | null;
|
|
41
|
+
outcome: "answered" | "failed" | null;
|
|
40
42
|
history_id: string | null;
|
|
41
43
|
session_json: string | null;
|
|
42
44
|
answer: string | null;
|
|
43
45
|
diagnostic: string | null;
|
|
44
|
-
completed_at: string;
|
|
46
|
+
completed_at: string | null;
|
|
45
47
|
}>;
|
|
46
|
-
export type
|
|
47
|
-
|
|
48
|
+
export type CallRow = Readonly<{
|
|
49
|
+
sequence: number;
|
|
50
|
+
turn_sequence: number;
|
|
48
51
|
body: string;
|
|
49
|
-
|
|
50
|
-
recorded_at: string;
|
|
52
|
+
at: string;
|
|
51
53
|
}>;
|
|
52
54
|
export type RequestRow = Readonly<{
|
|
53
55
|
sequence: number;
|
|
@@ -65,23 +67,21 @@ export type RequestRow = Readonly<{
|
|
|
65
67
|
}>;
|
|
66
68
|
export type ActivityRow = Readonly<{
|
|
67
69
|
sequence: number;
|
|
68
|
-
|
|
70
|
+
turn_sequence: number;
|
|
69
71
|
event_json: string;
|
|
70
72
|
at: string;
|
|
71
73
|
}>;
|
|
72
74
|
export type ActivityFact = Readonly<{
|
|
75
|
+
kind: "activity";
|
|
73
76
|
sequence: number;
|
|
74
|
-
|
|
77
|
+
turnSequence: number;
|
|
75
78
|
event: unknown;
|
|
76
79
|
at: string;
|
|
77
80
|
}>;
|
|
78
|
-
export type
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}>;
|
|
83
|
-
export type DeathRow = Readonly<{
|
|
84
|
-
value_json: string;
|
|
81
|
+
export type KillRow = Readonly<{
|
|
82
|
+
sequence: number;
|
|
83
|
+
body_sequence: number;
|
|
84
|
+
evidence: "killed";
|
|
85
85
|
at: string;
|
|
86
86
|
}>;
|
|
87
87
|
export declare function encodeSoulRow(soul: Soul): readonly [
|
|
@@ -101,12 +101,10 @@ export declare function encodeResumeCoordinate(coordinate: ResumeCoordinate): st
|
|
|
101
101
|
export declare function decodeSessionRow(row: SessionRow): SessionFact;
|
|
102
102
|
export declare function decodeBodyRow(row: BodyRow): BodyFact;
|
|
103
103
|
export declare function decodeTurnRow(row: TurnRow): TurnFact;
|
|
104
|
-
export declare function
|
|
104
|
+
export declare function decodeCallRow(row: CallRow): CallFact;
|
|
105
105
|
export declare function decodeRequestRow(row: RequestRow): RequestFact;
|
|
106
106
|
export declare function encodeActivityEvent(event: unknown): string;
|
|
107
107
|
export declare function decodeActivityRow(row: ActivityRow): ActivityFact;
|
|
108
|
-
export declare function encodeDeathRow(death: DeathFact): string;
|
|
109
|
-
export declare function decodeDeathRow(row: DeathRow): DeathFact;
|
|
110
108
|
export declare function soulFact(database: DatabaseSync): Soul | null;
|
|
111
109
|
export declare function sealExists(database: DatabaseSync): boolean;
|
|
112
110
|
export declare function insertSoulFact(database: DatabaseSync, soul: Soul): void;
|
|
@@ -115,6 +113,7 @@ export declare function insertSealFact(database: DatabaseSync, input: Readonly<{
|
|
|
115
113
|
at: string;
|
|
116
114
|
}>): void;
|
|
117
115
|
export declare function deletePauseControl(database: DatabaseSync): void;
|
|
116
|
+
export declare function deleteStopControl(database: DatabaseSync): void;
|
|
118
117
|
export declare function sealFact(database: DatabaseSync): Readonly<{
|
|
119
118
|
evidence: string;
|
|
120
119
|
at: string;
|
|
@@ -125,20 +124,10 @@ export declare function insertBodyFact(database: DatabaseSync, input: Readonly<{
|
|
|
125
124
|
}>): number;
|
|
126
125
|
export declare function insertSessionFact(database: DatabaseSync, input: Omit<SessionFact, "sequence">): number;
|
|
127
126
|
export declare function insertActivityFact(database: DatabaseSync, input: Readonly<{
|
|
128
|
-
|
|
127
|
+
turnSequence: number;
|
|
129
128
|
event: unknown;
|
|
130
129
|
at: string;
|
|
131
130
|
}>): number;
|
|
132
|
-
export declare function pruneActivityFacts(database: DatabaseSync, limit: number): void;
|
|
133
|
-
export declare function activityFactSlice(database: DatabaseSync, input: Readonly<{
|
|
134
|
-
before?: number;
|
|
135
|
-
since?: number;
|
|
136
|
-
limit: number;
|
|
137
|
-
}>): ActivityFactSlice;
|
|
138
|
-
export declare function deathExists(database: DatabaseSync): boolean;
|
|
139
|
-
export declare function insertTellFact(database: DatabaseSync, tell: Omit<TellFact, "state">): void;
|
|
140
|
-
export declare function tellState(database: DatabaseSync, id: string): TellState | null;
|
|
141
|
-
export declare function updateTellState(database: DatabaseSync, id: string, state: TellState): void;
|
|
142
131
|
export declare function insertRequestFact(database: DatabaseSync, input: RequestInput & Readonly<{
|
|
143
132
|
admittedAt: string;
|
|
144
133
|
}>): void;
|
|
@@ -148,31 +137,22 @@ export declare function updateRequestReserved(database: DatabaseSync, id: string
|
|
|
148
137
|
export declare function updateRequestServed(database: DatabaseSync, id: string, child: AkuId): void;
|
|
149
138
|
export declare function updateRequestRefused(database: DatabaseSync, id: string, diagnostic: string): void;
|
|
150
139
|
export declare function updateRequestVoided(database: DatabaseSync, id: string, evidence: string): void;
|
|
151
|
-
export declare function insertStopControl(database: DatabaseSync, at: string): void;
|
|
140
|
+
export declare function insertStopControl(database: DatabaseSync, bodySequence: number, at: string): void;
|
|
152
141
|
export declare function insertPauseControl(database: DatabaseSync, at: string): void;
|
|
153
|
-
export declare function
|
|
142
|
+
export declare function stopFact(database: DatabaseSync): StopFact | null;
|
|
154
143
|
export declare function pauseExists(database: DatabaseSync): boolean;
|
|
155
|
-
export declare function
|
|
156
|
-
export declare function insertDeathFact(database: DatabaseSync, death: DeathFact): void;
|
|
157
|
-
export declare function voidTellsByDeath(database: DatabaseSync): void;
|
|
158
|
-
export declare function voidRequestsByDeath(database: DatabaseSync, evidence: string): void;
|
|
144
|
+
export declare function insertKillFact(database: DatabaseSync, bodySequence: number, at: string): void;
|
|
159
145
|
export declare function endBodyFact(database: DatabaseSync, input: Readonly<{
|
|
160
146
|
sequence: number;
|
|
161
147
|
end: BodyEnd;
|
|
162
148
|
at: string;
|
|
163
149
|
}>): void;
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
export declare function
|
|
170
|
-
type FailedTurn = Omit<TurnFact, "sequence" | "outcome"> & Readonly<{
|
|
171
|
-
outcome: Extract<TurnFact["outcome"], {
|
|
172
|
-
kind: "failed";
|
|
173
|
-
}>;
|
|
174
|
-
}>;
|
|
175
|
-
export declare function insertFailedTurnFact(database: DatabaseSync, input: FailedTurn): number;
|
|
150
|
+
export declare function insertTurnStartFact(database: DatabaseSync, input: Readonly<{
|
|
151
|
+
bodySequence: number;
|
|
152
|
+
startedAt: string;
|
|
153
|
+
call?: string;
|
|
154
|
+
}>): TurnStartFact;
|
|
155
|
+
export declare function insertTurnEndFact(database: DatabaseSync, input: Omit<TurnEndFact, "sequence">): TurnEndFact;
|
|
176
156
|
export declare function finishBodyFact(database: DatabaseSync, input: Readonly<{
|
|
177
157
|
sequence: number;
|
|
178
158
|
at: string;
|
|
@@ -180,10 +160,7 @@ export declare function finishBodyFact(database: DatabaseSync, input: Readonly<{
|
|
|
180
160
|
export declare function latestBodyFact(database: DatabaseSync): BodyFact | null;
|
|
181
161
|
export declare function latestSessionFact(database: DatabaseSync): SessionFact | null;
|
|
182
162
|
export declare function sessionFactForCoordinate(database: DatabaseSync, coordinate: ResumeCoordinate): SessionFact | null;
|
|
183
|
-
export declare function
|
|
184
|
-
export declare function
|
|
185
|
-
export declare function historyFacts(database: DatabaseSync): readonly TurnFact[];
|
|
163
|
+
export declare function latestKillFact(database: DatabaseSync): KillFact | null;
|
|
164
|
+
export declare function killFactForBody(database: DatabaseSync, bodySequence: number): KillFact | null;
|
|
186
165
|
export declare function lastAnsweredTurnFact(database: DatabaseSync): TurnFact | null;
|
|
187
|
-
export declare function latestTurnFact(database: DatabaseSync): TurnFact | null;
|
|
188
166
|
export declare function answeredTurnFact(database: DatabaseSync, historyId: string): TurnFact | null;
|
|
189
|
-
export {};
|