@code-yeongyu/senpi-agent-core 2026.11.4-2 → 2026.11.5-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/dist/agent-loop.js +14 -140
- package/dist/agent.d.ts +4 -0
- package/dist/agent.js +4 -0
- package/dist/conformance/index.d.ts +7 -0
- package/dist/conformance/index.js +4 -0
- package/dist/conformance/loop-core-manifest.d.ts +1 -1
- package/dist/conformance/loop-core-manifest.js +17 -0
- package/dist/conformance/registry.js +11 -17
- package/dist/egress/types.d.ts +102 -0
- package/dist/egress/types.js +7 -0
- package/dist/execution/canonical-digest.d.ts +10 -0
- package/dist/execution/canonical-digest.js +20 -0
- package/dist/execution/chain-count.d.ts +26 -0
- package/dist/execution/chain-count.js +45 -0
- package/dist/execution/coordinator-plan.d.ts +1 -2
- package/dist/execution/coordinator-plan.js +4 -17
- package/dist/execution/device-files-node.js +39 -1
- package/dist/execution/device-files.d.ts +30 -1
- package/dist/execution/device-files.js +38 -1
- package/dist/execution/ledger-types.d.ts +3 -1
- package/dist/execution/ledger.d.ts +9 -3
- package/dist/execution/ledger.js +8 -2
- package/dist/execution/loop-hook-host-hand.d.ts +33 -0
- package/dist/execution/loop-hook-host-hand.js +71 -0
- package/dist/execution/loop-hook-host-protocol.d.ts +46 -0
- package/dist/execution/loop-hook-host-protocol.js +47 -0
- package/dist/execution/loop-hook-host.d.ts +40 -0
- package/dist/execution/loop-hook-host.js +87 -0
- package/dist/execution/plane-session.d.ts +56 -0
- package/dist/execution/plane-session.js +178 -0
- package/dist/execution/plane.d.ts +5 -2
- package/dist/execution/plane.js +1 -1
- package/dist/execution/prepared/executor-body.d.ts +22 -0
- package/dist/execution/prepared/executor-body.js +73 -0
- package/dist/execution/prepared/executor-freeze.d.ts +17 -0
- package/dist/execution/prepared/executor-freeze.js +42 -0
- package/dist/execution/prepared/executor-pipeline.d.ts +11 -0
- package/dist/execution/prepared/executor-pipeline.js +26 -0
- package/dist/execution/prepared/executor-types.d.ts +131 -0
- package/dist/execution/prepared/executor-types.js +2 -0
- package/dist/execution/prepared/executor.d.ts +8 -0
- package/dist/execution/prepared/executor.js +261 -0
- package/dist/execution/prepared/memory-batch-store.d.ts +4 -0
- package/dist/execution/prepared/memory-batch-store.js +4 -0
- package/dist/execution/prepared/pipeline-prepared-batch.d.ts +27 -0
- package/dist/execution/prepared/pipeline-prepared-batch.js +175 -0
- package/dist/execution/prepared/pipeline-prepared.d.ts +10 -0
- package/dist/execution/prepared/pipeline-prepared.js +54 -0
- package/dist/execution/remote-device-files.js +33 -4
- package/dist/execution/remote-epoch-gate.d.ts +19 -0
- package/dist/execution/remote-epoch-gate.js +46 -0
- package/dist/execution/remote-epoch.d.ts +53 -0
- package/dist/execution/remote-epoch.js +74 -0
- package/dist/execution/remote-executor.d.ts +8 -1
- package/dist/execution/remote-executor.js +24 -6
- package/dist/execution/remote-file-call.js +1 -0
- package/dist/execution/remote-hand-ledger.d.ts +11 -3
- package/dist/execution/remote-hand-ledger.js +31 -15
- package/dist/execution/remote-link.d.ts +6 -1
- package/dist/execution/remote-link.js +50 -14
- package/dist/execution/remote-protocol.d.ts +30 -1
- package/dist/execution/remote-protocol.js +30 -0
- package/dist/execution/remote-tool-host.d.ts +12 -0
- package/dist/execution/remote-tool-host.js +3 -1
- package/dist/execution/testing/epoch-cases.d.ts +8 -0
- package/dist/execution/testing/epoch-cases.js +84 -0
- package/dist/execution/testing/epoch-harness.d.ts +47 -0
- package/dist/execution/testing/epoch-harness.js +172 -0
- package/dist/execution/testing/epoch-registry.d.ts +3 -0
- package/dist/execution/testing/epoch-registry.js +17 -0
- package/dist/execution/testing/hand-harness.d.ts +3 -0
- package/dist/execution/testing/hand-harness.js +27 -22
- package/dist/execution/testing/hand-registry.d.ts +3 -0
- package/dist/execution/testing/hand-registry.js +20 -0
- package/dist/execution/testing/kill-epoch.d.ts +9 -0
- package/dist/execution/testing/kill-epoch.js +71 -0
- package/dist/execution/testing/kill-hook.d.ts +14 -0
- package/dist/execution/testing/kill-hook.js +117 -0
- package/dist/execution/testing/multi-epoch-cases.d.ts +4 -0
- package/dist/execution/testing/multi-epoch-cases.js +29 -0
- package/dist/execution/tool-host.d.ts +13 -1
- package/dist/execution/tool-host.js +18 -1
- package/dist/harness/agent-harness.d.ts +6 -0
- package/dist/harness/execution/tool-host-call.d.ts +13 -0
- package/dist/harness/execution/tool-host-call.js +55 -0
- package/dist/harness/execution/tools.d.ts +2 -1
- package/dist/harness/execution/tools.js +32 -17
- package/dist/harness/runtime/drive/tools.js +1 -1
- package/dist/harness/runtime/harness.js +1 -0
- package/dist/harness/runtime/types.d.ts +1 -0
- package/dist/index.d.ts +16 -2
- package/dist/index.js +14 -1
- package/dist/public-entry.d.ts +10 -0
- package/dist/public-entry.js +23 -0
- package/dist/step-commit.d.ts +24 -0
- package/dist/step-commit.js +24 -0
- package/dist/tool-name-alias.d.ts +1 -7
- package/dist/tool-name-alias.js +0 -17
- package/dist/types.d.ts +37 -1
- package/package.json +3 -3
|
@@ -8,6 +8,12 @@ export class RemoteProtocolError extends Error {
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
const TERMINAL_REASONS = ["cancelled", "lease_expired", "hand_restarted", "uncertain"];
|
|
11
|
+
const EPOCH_REFUSALS = [
|
|
12
|
+
"peer_unauthorized",
|
|
13
|
+
"epoch_fenced",
|
|
14
|
+
"epoch_step_exceeded",
|
|
15
|
+
"epoch_unsupported",
|
|
16
|
+
];
|
|
11
17
|
const encoder = new TextEncoder();
|
|
12
18
|
const decoder = new TextDecoder();
|
|
13
19
|
export function encodeRemoteMessage(message) {
|
|
@@ -15,6 +21,25 @@ export function encodeRemoteMessage(message) {
|
|
|
15
21
|
}
|
|
16
22
|
const isRecord = (value) => typeof value === "object" && value !== null;
|
|
17
23
|
const isString = (value) => typeof value === "string" && value.length > 0;
|
|
24
|
+
const isEpoch = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 1;
|
|
25
|
+
function decodeFloorMessage(value) {
|
|
26
|
+
switch (value.kind) {
|
|
27
|
+
case "floor":
|
|
28
|
+
if (!isEpoch(value.epoch))
|
|
29
|
+
throw new RemoteProtocolError("malformed floor");
|
|
30
|
+
return { kind: "floor", epoch: value.epoch };
|
|
31
|
+
case "floor_ack":
|
|
32
|
+
if (!isEpoch(value.floor))
|
|
33
|
+
throw new RemoteProtocolError("malformed floor ack");
|
|
34
|
+
return { kind: "floor_ack", floor: value.floor };
|
|
35
|
+
case "floor_refused":
|
|
36
|
+
if (!EPOCH_REFUSALS.includes(value.reason))
|
|
37
|
+
throw new RemoteProtocolError("malformed floor refusal");
|
|
38
|
+
return { kind: "floor_refused", reason: value.reason };
|
|
39
|
+
default:
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
18
43
|
/** Parses one frame payload. Anything that is not exactly one of the messages is refused; nothing guesses. */
|
|
19
44
|
export function decodeRemoteMessage(payload) {
|
|
20
45
|
let value;
|
|
@@ -34,8 +59,13 @@ export function decodeRemoteMessage(payload) {
|
|
|
34
59
|
throw new RemoteProtocolError("malformed hello");
|
|
35
60
|
return { kind: "hello", instance, durable: durable ?? true, ops: ops ?? [] };
|
|
36
61
|
}
|
|
62
|
+
const floor = isRecord(value) ? decodeFloorMessage(value) : undefined;
|
|
63
|
+
if (floor !== undefined)
|
|
64
|
+
return floor;
|
|
37
65
|
if (!isRecord(value) || !isString(value.executionId))
|
|
38
66
|
throw new RemoteProtocolError("no execution ID");
|
|
67
|
+
if (value.epoch !== undefined && !isEpoch(value.epoch))
|
|
68
|
+
throw new RemoteProtocolError("malformed epoch");
|
|
39
69
|
switch (value.kind) {
|
|
40
70
|
case "invoke": {
|
|
41
71
|
const scope = value.scope;
|
|
@@ -22,6 +22,18 @@ export interface RemoteToolHostOptions {
|
|
|
22
22
|
* `plane_unavailable`.
|
|
23
23
|
*/
|
|
24
24
|
readonly planes?: Readonly<Record<string, PlaneHandler>>;
|
|
25
|
+
/**
|
|
26
|
+
* The planes a pending device file operation (S40) may host, on its own lane: a two-sided extension's forwarded tool
|
|
27
|
+
* events (S29), so its handler runs on the loop's copy for a file operation as for a tool call. Absent: none, so
|
|
28
|
+
* every nested request under a file operation is refused `parent_terminal`.
|
|
29
|
+
*/
|
|
30
|
+
readonly filePlanes?: readonly string[];
|
|
31
|
+
/**
|
|
32
|
+
* The session's owner epoch (brain/hand S35). With it, each scope lane first raises the hand's floor to this epoch
|
|
33
|
+
* and dispatches only after the hand acked exactly it; every invoke, file operation, abort and ack carries it.
|
|
34
|
+
* Without it, nothing about epochs is sent (a session that never moves).
|
|
35
|
+
*/
|
|
36
|
+
readonly epoch?: number;
|
|
25
37
|
}
|
|
26
38
|
/**
|
|
27
39
|
* The ToolHost that runs a session's tool calls on a hand (brain/hand split, S27a). The hand resolves, prepares,
|
|
@@ -26,7 +26,7 @@ function terminalResult(placement, terminal) {
|
|
|
26
26
|
*/
|
|
27
27
|
export function createRemoteToolHost(options) {
|
|
28
28
|
const mintId = options.mintId ?? (() => crypto.randomUUID());
|
|
29
|
-
const link = createHandLink(options.transport, options.planes ?? {});
|
|
29
|
+
const link = createHandLink(options.transport, options.planes ?? {}, options.filePlanes ?? [], options.epoch);
|
|
30
30
|
const resultOf = (reply) => {
|
|
31
31
|
switch (reply.kind) {
|
|
32
32
|
case "settled":
|
|
@@ -41,6 +41,8 @@ export function createRemoteToolHost(options) {
|
|
|
41
41
|
return errorResult(`The hand is unreachable: ${reply.reason}`);
|
|
42
42
|
case "closed":
|
|
43
43
|
return errorResult("The hand link was closed before the call settled");
|
|
44
|
+
case "epoch_refused":
|
|
45
|
+
return errorResult(`The hand refused this session's epoch: ${reply.reason}`);
|
|
44
46
|
}
|
|
45
47
|
};
|
|
46
48
|
const dispatch = (invoke, signal) => ({
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CaseImplementation } from "../../conformance/runner.ts";
|
|
2
|
+
import type { ToolHostResult } from "../tool-host.ts";
|
|
3
|
+
import { type HandCaseAdapters } from "./hand-harness.ts";
|
|
4
|
+
type EpochCase = CaseImplementation<HandCaseAdapters>;
|
|
5
|
+
export declare const texts: ({ messages }: ToolHostResult) => string[];
|
|
6
|
+
export declare const EPOCH_CASES: ReadonlyMap<string, EpochCase>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=epoch-cases.d.ts.map
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { expectEqual } from "../../durable/testing/store-harness.js";
|
|
2
|
+
import { floorCommit, openEpochRig, stepCommit } from "./epoch-harness.js";
|
|
3
|
+
import { call } from "./hand-harness.js";
|
|
4
|
+
export const texts = ({ messages }) => messages.map((message) => message.content.map((part) => (part.type === "text" ? part.text : "")).join(""));
|
|
5
|
+
const OLD = { name: "brain-old", epoch: 1 };
|
|
6
|
+
const NEW = { name: "brain-new", epoch: 2 };
|
|
7
|
+
/** SC-MOVE step 1: while the hand's floor ACK is held, the new owner's call has no effect, then runs once. */
|
|
8
|
+
const floorAckBarrier = async (adapters) => {
|
|
9
|
+
const rig = await openEpochRig(adapters, { brains: [OLD, NEW] });
|
|
10
|
+
rig.setOwner("s", OLD.name);
|
|
11
|
+
const before = await rig.settle(rig.execute(OLD.name, "s", [call("c0")]), "EPOCH-01: the first owner's call");
|
|
12
|
+
expectEqual(texts(before), ["ran:c0"], "EPOCH-01: the first owner runs on its floor");
|
|
13
|
+
rig.setOwner("s", NEW.name);
|
|
14
|
+
const barrier = rig.hold(floorCommit("s", NEW.epoch));
|
|
15
|
+
const moved = rig.execute(NEW.name, "s", [call("c1")]);
|
|
16
|
+
await rig.settle(barrier.reached, "EPOCH-01: the new owner's floor reached the hand's store");
|
|
17
|
+
await rig.advance(2_000);
|
|
18
|
+
expectEqual(rig.bodies, ["s:c0"], "EPOCH-01: nothing of the new owner's call ran while its floor ACK was held");
|
|
19
|
+
expectEqual((await rig.rows()).length, 1, "EPOCH-01: the new owner's call was not even recorded");
|
|
20
|
+
barrier.release();
|
|
21
|
+
expectEqual(texts(await rig.settle(moved, "EPOCH-01: the new owner's call")), ["ran:c1"], "EPOCH-01: result");
|
|
22
|
+
expectEqual(rig.bodies, ["s:c0", "s:c1"], "EPOCH-01: the new owner's call ran exactly once after the ACK");
|
|
23
|
+
};
|
|
24
|
+
/** SC-MOVE step 2: two brains claim the session at once; exactly one wins, and only the winner's calls run. */
|
|
25
|
+
const concurrentClaims = async (adapters) => {
|
|
26
|
+
const first = { name: "brain-first", epoch: 1 };
|
|
27
|
+
const rivals = [
|
|
28
|
+
{ name: "brain-a", epoch: 2 },
|
|
29
|
+
{ name: "brain-b", epoch: 2 },
|
|
30
|
+
];
|
|
31
|
+
const rig = await openEpochRig(adapters, { brains: [first, ...rivals] });
|
|
32
|
+
rig.setOwner("s", first.name);
|
|
33
|
+
await rig.settle(rig.execute(first.name, "s", [call("c0")]), "EPOCH-02: the first owner's call");
|
|
34
|
+
const session = await adapters.store.createMedium();
|
|
35
|
+
const opened = await Promise.all([0, 1, 2].map(() => adapters.store.open(session)));
|
|
36
|
+
const [owner, ...claimants] = opened;
|
|
37
|
+
await owner?.claim(0, 1);
|
|
38
|
+
const claims = await Promise.allSettled(claimants.map((store) => store.claim(1, 2)));
|
|
39
|
+
const won = rivals.filter((_, index) => claims[index]?.status === "fulfilled");
|
|
40
|
+
expectEqual(won.length, 1, "EPOCH-02: exactly one of two concurrent CAS claims wins");
|
|
41
|
+
const winner = won[0] ?? rivals[0];
|
|
42
|
+
const loser = rivals.find((rival) => rival !== winner) ?? rivals[1];
|
|
43
|
+
if (winner === undefined || loser === undefined)
|
|
44
|
+
throw new Error("EPOCH-02: no rivals");
|
|
45
|
+
rig.setOwner("s", winner.name);
|
|
46
|
+
const [ran, refused] = await rig.settle(Promise.all([rig.execute(winner.name, "s", [call("cw")]), rig.execute(loser.name, "s", [call("cl")])]), "EPOCH-02: both claimants' calls");
|
|
47
|
+
expectEqual(texts(ran), ["ran:cw"], "EPOCH-02: the winner's call runs");
|
|
48
|
+
expectEqual([texts(refused), refused.messages[0]?.isError], [["The hand refused this session's epoch: peer_unauthorized"], true], "EPOCH-02: the loser's floor is refused and its call is never sent");
|
|
49
|
+
expectEqual(rig.bodies, ["s:c0", "s:cw"], "EPOCH-02: only the winner's call ran");
|
|
50
|
+
};
|
|
51
|
+
/** SC-MOVE step 3: an old owner's delayed walk (prepare, release) and a delayed invoke after the move are refused. */
|
|
52
|
+
const delayedOldOwner = async (adapters) => {
|
|
53
|
+
const rig = await openEpochRig(adapters, { brains: [OLD, NEW] });
|
|
54
|
+
rig.setOwner("s", OLD.name);
|
|
55
|
+
await rig.settle(rig.execute(OLD.name, "s", [call("c0")]), "EPOCH-03: the old owner's first call");
|
|
56
|
+
const prepare = rig.hold(stepCommit(OLD.name, "prepare"));
|
|
57
|
+
const delayed = rig.execute(OLD.name, "s", [call("c2")]);
|
|
58
|
+
await rig.settle(prepare.reached, "EPOCH-03: the old owner's delayed call is mid-walk");
|
|
59
|
+
rig.setOwner("s", NEW.name);
|
|
60
|
+
const moved = rig.execute(NEW.name, "s", [call("c1")]);
|
|
61
|
+
await rig.advance(2_000);
|
|
62
|
+
prepare.release();
|
|
63
|
+
expectEqual(texts(await rig.settle(moved, "EPOCH-03: the new owner's call")), ["ran:c1"], "EPOCH-03: new owner");
|
|
64
|
+
expectEqual(texts(await rig.settle(delayed, "EPOCH-03: the old owner's mid-walk call")), ["The hand refused this tool call: epoch_fenced"], "EPOCH-03: the old owner's walk is refused at its next step");
|
|
65
|
+
const late = await rig.settle(rig.execute(OLD.name, "s", [call("c3")]), "EPOCH-03: a delayed old-owner invoke");
|
|
66
|
+
expectEqual(texts(late), ["The hand refused this tool call: epoch_fenced"], "EPOCH-03: a delayed invoke is fenced");
|
|
67
|
+
await rig.advance(200);
|
|
68
|
+
const rows = await rig.rows();
|
|
69
|
+
expectEqual(rig.bodies, ["s:c0", "s:c1"], "EPOCH-03: no old-owner call ran after the move");
|
|
70
|
+
expectEqual(rows.map(({ commandId, progress }) => [
|
|
71
|
+
commandId,
|
|
72
|
+
progress.state === "settled" ? progress.outcome.reason : progress.state,
|
|
73
|
+
]), [
|
|
74
|
+
["brain-new-1", "acked"],
|
|
75
|
+
["brain-old-1", "acked"],
|
|
76
|
+
["brain-old-3", "cancelled"],
|
|
77
|
+
], "EPOCH-03: the fenced walk's record is cancelled, never dispatched; the delayed invoke left no record");
|
|
78
|
+
};
|
|
79
|
+
export const EPOCH_CASES = new Map([
|
|
80
|
+
["EPOCH-01", floorAckBarrier],
|
|
81
|
+
["EPOCH-02", concurrentClaims],
|
|
82
|
+
["EPOCH-03", delayedOldOwner],
|
|
83
|
+
]);
|
|
84
|
+
//# sourceMappingURL=epoch-cases.js.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { AgentToolCall } from "../../types.ts";
|
|
2
|
+
import type { StoreValue, StoreWrite } from "../../durable/store.ts";
|
|
3
|
+
import type { ExecutionEntry } from "../ledger-types.ts";
|
|
4
|
+
import { type HandPlacement } from "../remote-tool-host.ts";
|
|
5
|
+
import type { ToolHostResult } from "../tool-host.ts";
|
|
6
|
+
import { type HandCaseAdapters, type TransportPump } from "./hand-harness.ts";
|
|
7
|
+
export type CommitMatch = (writes: readonly StoreWrite[]) => boolean;
|
|
8
|
+
export interface EpochBrainSpec {
|
|
9
|
+
/** The brain principal: its link's authenticated peer and the name `ownerOf` answers. */
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly epoch: number;
|
|
12
|
+
}
|
|
13
|
+
export interface EpochRig extends TransportPump {
|
|
14
|
+
/** Every tool body start, as `<scope>:<toolCallId>`, across all hand processes. */
|
|
15
|
+
readonly bodies: readonly string[];
|
|
16
|
+
readonly faults: readonly unknown[];
|
|
17
|
+
readonly killed: Promise<void>;
|
|
18
|
+
execute(brain: string, scope: string, calls: readonly AgentToolCall[]): Promise<ToolHostResult>;
|
|
19
|
+
/** Moves `scope` to `brain` in the hand's placement record (what `ownerOf` answers). */
|
|
20
|
+
setOwner(scope: string, brain: string): void;
|
|
21
|
+
/** Holds the next commit `match` picks until `release()`; `reached` settles when it arrives. */
|
|
22
|
+
hold(match: CommitMatch): {
|
|
23
|
+
readonly reached: Promise<void>;
|
|
24
|
+
release(): void;
|
|
25
|
+
};
|
|
26
|
+
/** A new hand process on the reopened store; every link's executor announces itself. */
|
|
27
|
+
restart(): Promise<void>;
|
|
28
|
+
rows(): Promise<ExecutionEntry[]>;
|
|
29
|
+
/** The floor persisted for `scope` (read from a fresh store instance), or `undefined`. */
|
|
30
|
+
floor(scope: string): Promise<StoreValue | undefined>;
|
|
31
|
+
}
|
|
32
|
+
export declare const floorCommit: (scope: string, epoch: number) => CommitMatch;
|
|
33
|
+
/** The ledger commit of `event` for a call `brain` sent (execution IDs are minted as `<brain>-<n>`). */
|
|
34
|
+
export declare const stepCommit: (brain: string, event: string) => CommitMatch;
|
|
35
|
+
/**
|
|
36
|
+
* One hand process reached by several brains, each over its own link with its own executor (a peer link per brain),
|
|
37
|
+
* sharing the hand's store, ledger and epoch fence: what a session sees when it moves from one brain to another.
|
|
38
|
+
*/
|
|
39
|
+
export declare function openEpochRig(adapters: HandCaseAdapters, options: {
|
|
40
|
+
readonly brains: readonly EpochBrainSpec[];
|
|
41
|
+
readonly placement?: HandPlacement;
|
|
42
|
+
readonly kill?: {
|
|
43
|
+
readonly match: CommitMatch;
|
|
44
|
+
readonly at: "before" | "durable";
|
|
45
|
+
};
|
|
46
|
+
}): Promise<EpochRig>;
|
|
47
|
+
//# sourceMappingURL=epoch-harness.d.ts.map
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { createAdmissionLine } from "../../durable/store-admission.js";
|
|
2
|
+
import { createManualTimers } from "../../durable/testing/manual-timers.js";
|
|
3
|
+
import { claimedStore } from "../../durable/testing/store-cases.js";
|
|
4
|
+
import { createInProcessNetwork } from "../../transport/in-process-carrier.js";
|
|
5
|
+
import { localEndpoint } from "../../transport/local-endpoint.js";
|
|
6
|
+
import { createGrantVerifier } from "../grant-verify.js";
|
|
7
|
+
import { createExecutionLedger } from "../ledger.js";
|
|
8
|
+
import { createHandEpochFence, EPOCH_FLOOR_PREFIX } from "../remote-epoch.js";
|
|
9
|
+
import { createRemoteExecutor } from "../remote-executor.js";
|
|
10
|
+
import { createHandLedger } from "../remote-hand-ledger.js";
|
|
11
|
+
import { createRemoteToolHost } from "../remote-tool-host.js";
|
|
12
|
+
import { transportPump } from "./hand-harness.js";
|
|
13
|
+
const LEASE_MS = 3_600_000;
|
|
14
|
+
const HAND = "hand";
|
|
15
|
+
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16
|
+
const field = (write, name) => {
|
|
17
|
+
const data = write.op === "delete" ? undefined : write.data;
|
|
18
|
+
return isRecord(data) ? data[name] : undefined;
|
|
19
|
+
};
|
|
20
|
+
export const floorCommit = (scope, epoch) => (writes) => writes.some((write) => write.op === "put" && write.key === `${EPOCH_FLOOR_PREFIX}${scope}` && field(write, "epoch") === epoch);
|
|
21
|
+
/** The ledger commit of `event` for a call `brain` sent (execution IDs are minted as `<brain>-<n>`). */
|
|
22
|
+
export const stepCommit = (brain, event) => (writes) => writes.some((write) => write.op === "append" &&
|
|
23
|
+
field(write, "event") === event &&
|
|
24
|
+
String(field(write, "commandId")).startsWith(`${brain}-`));
|
|
25
|
+
/** A hand process's store: holds and kills act on whole commits; after a kill every call fails, as in a dead process. */
|
|
26
|
+
function processStore(inner, holds, kill) {
|
|
27
|
+
let dead = false;
|
|
28
|
+
const alive = () => {
|
|
29
|
+
if (dead)
|
|
30
|
+
throw new Error("the hand was killed");
|
|
31
|
+
};
|
|
32
|
+
const die = (at) => {
|
|
33
|
+
dead = true;
|
|
34
|
+
kill?.die();
|
|
35
|
+
throw new Error(`hand killed ${at} the matched commit`);
|
|
36
|
+
};
|
|
37
|
+
let killArmed = kill !== undefined;
|
|
38
|
+
const live = (read) => async (...args) => {
|
|
39
|
+
alive();
|
|
40
|
+
return read(...args);
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
readEpoch: live(() => inner.readEpoch()),
|
|
44
|
+
readHead: live(() => inner.readHead()),
|
|
45
|
+
claim: live((expected, next) => inner.claim(expected, next)),
|
|
46
|
+
mintId: () => inner.mintId(),
|
|
47
|
+
scanRecords: live((query) => inner.scanRecords(query)),
|
|
48
|
+
getDocument: live((key) => inner.getDocument(key)),
|
|
49
|
+
scanDocuments: live((prefix) => inner.scanDocuments(prefix)),
|
|
50
|
+
exportSnapshot: live(() => inner.exportSnapshot()),
|
|
51
|
+
importSnapshot: live((epoch, snapshot) => inner.importSnapshot(epoch, snapshot)),
|
|
52
|
+
async commit(epoch, writes, adopt) {
|
|
53
|
+
alive();
|
|
54
|
+
const index = holds.findIndex((hold) => hold.match(writes));
|
|
55
|
+
const hold = index < 0 ? undefined : holds.splice(index, 1)[0];
|
|
56
|
+
if (hold !== undefined) {
|
|
57
|
+
hold.reached.resolve();
|
|
58
|
+
await hold.gate.promise;
|
|
59
|
+
alive();
|
|
60
|
+
}
|
|
61
|
+
const killing = killArmed && kill !== undefined && kill.match(writes);
|
|
62
|
+
if (!killing)
|
|
63
|
+
return inner.commit(epoch, writes, adopt);
|
|
64
|
+
killArmed = false;
|
|
65
|
+
if (kill.at === "before")
|
|
66
|
+
return die("before");
|
|
67
|
+
await inner.commit(epoch, writes, () => { });
|
|
68
|
+
return die("once durable");
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* One hand process reached by several brains, each over its own link with its own executor (a peer link per brain),
|
|
74
|
+
* sharing the hand's store, ledger and epoch fence: what a session sees when it moves from one brain to another.
|
|
75
|
+
*/
|
|
76
|
+
export async function openEpochRig(adapters, options) {
|
|
77
|
+
const timers = createManualTimers(1_000);
|
|
78
|
+
const pump = transportPump(timers);
|
|
79
|
+
const network = createInProcessNetwork({ schedule: (deliver) => void timers.setTimer(deliver, 0) });
|
|
80
|
+
const verifier = createGrantVerifier({ self: HAND, workspaces: [{ root: "/work" }], canonicalize: (path) => path });
|
|
81
|
+
verifier.install({
|
|
82
|
+
rv: 1,
|
|
83
|
+
expiresAt: Number.MAX_SAFE_INTEGER,
|
|
84
|
+
grants: options.brains.map(({ name }) => ({
|
|
85
|
+
holder: name,
|
|
86
|
+
target: HAND,
|
|
87
|
+
workspace: "omo",
|
|
88
|
+
capability: "execute",
|
|
89
|
+
})),
|
|
90
|
+
});
|
|
91
|
+
const handSides = new Map();
|
|
92
|
+
const hosts = new Map();
|
|
93
|
+
for (const { name, epoch } of options.brains) {
|
|
94
|
+
const sessionSide = adapters.transport.createSide(timers);
|
|
95
|
+
const handSide = adapters.transport.createSide(timers);
|
|
96
|
+
const endpoint = localEndpoint(adapters.platform, `epoch-${name}`, "/run/senpi-conformance");
|
|
97
|
+
network.listen(endpoint, handSide);
|
|
98
|
+
network.dial(endpoint, sessionSide).connect();
|
|
99
|
+
handSides.set(name, handSide);
|
|
100
|
+
let minted = 0;
|
|
101
|
+
const placement = options.placement ?? "cross-machine";
|
|
102
|
+
hosts.set(name, createRemoteToolHost({ transport: sessionSide, placement, epoch, mintId: () => `${name}-${minted++}` }));
|
|
103
|
+
}
|
|
104
|
+
const { medium } = await claimedStore(adapters.store);
|
|
105
|
+
const owners = new Map();
|
|
106
|
+
const bodies = [];
|
|
107
|
+
const faults = [];
|
|
108
|
+
const holds = [];
|
|
109
|
+
const killed = Promise.withResolvers();
|
|
110
|
+
const startHand = async (store) => {
|
|
111
|
+
const admission = createAdmissionLine();
|
|
112
|
+
const ledger = createExecutionLedger({ store, epoch: 1, admission });
|
|
113
|
+
const hand = createHandLedger({
|
|
114
|
+
ledger,
|
|
115
|
+
executor: HAND,
|
|
116
|
+
issuer: "session",
|
|
117
|
+
workspace: "workspace",
|
|
118
|
+
now: timers.now,
|
|
119
|
+
leaseMs: LEASE_MS,
|
|
120
|
+
});
|
|
121
|
+
const fence = createHandEpochFence({
|
|
122
|
+
ownerOf: (scope) => owners.get(scope),
|
|
123
|
+
durable: { store, epoch: 1, admission },
|
|
124
|
+
});
|
|
125
|
+
const executors = options.brains.map(({ name }) => {
|
|
126
|
+
const transport = handSides.get(name);
|
|
127
|
+
if (transport === undefined)
|
|
128
|
+
throw new Error(`no link for ${name}`);
|
|
129
|
+
return createRemoteExecutor({
|
|
130
|
+
authority: { kind: "peer", peer: name, verifier },
|
|
131
|
+
transport,
|
|
132
|
+
ledger: hand,
|
|
133
|
+
fence,
|
|
134
|
+
openScope: async (scope) => ({
|
|
135
|
+
run: async (handCall) => {
|
|
136
|
+
bodies.push(`${scope.id}:${handCall.toolCallId}`);
|
|
137
|
+
return { content: [{ type: "text", text: `ran:${handCall.toolCallId}` }], details: {} };
|
|
138
|
+
},
|
|
139
|
+
isSequential: () => false,
|
|
140
|
+
dispose: async () => { },
|
|
141
|
+
}),
|
|
142
|
+
onFault: (error) => faults.push(error),
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
await pump.settle(Promise.all(executors.map(({ ready }) => ready)), "every link's executor is ready");
|
|
146
|
+
};
|
|
147
|
+
const kill = options.kill === undefined ? undefined : { ...options.kill, die: () => killed.resolve() };
|
|
148
|
+
await startHand(processStore(await adapters.store.open(medium), holds, kill));
|
|
149
|
+
const reader = async () => adapters.store.open(medium);
|
|
150
|
+
return {
|
|
151
|
+
...pump,
|
|
152
|
+
bodies,
|
|
153
|
+
faults,
|
|
154
|
+
killed: killed.promise,
|
|
155
|
+
execute(brain, scope, calls) {
|
|
156
|
+
const host = hosts.get(brain);
|
|
157
|
+
if (host === undefined)
|
|
158
|
+
throw new Error(`no brain ${brain}`);
|
|
159
|
+
return host.execute({ scope: { id: scope, root: `/work/${scope}` }, calls, mode: "parallel" }, { emit: () => { } });
|
|
160
|
+
},
|
|
161
|
+
setOwner: (scope, brain) => void owners.set(scope, brain),
|
|
162
|
+
hold(match) {
|
|
163
|
+
const hold = { match, reached: Promise.withResolvers(), gate: Promise.withResolvers() };
|
|
164
|
+
holds.push(hold);
|
|
165
|
+
return { reached: hold.reached.promise, release: () => hold.gate.resolve() };
|
|
166
|
+
},
|
|
167
|
+
restart: async () => startHand(processStore(await reader(), holds, undefined)),
|
|
168
|
+
rows: async () => createExecutionLedger({ store: await reader(), epoch: 1, admission: createAdmissionLine() }).scan(),
|
|
169
|
+
floor: async (scope) => (await reader()).getDocument(`${EPOCH_FLOOR_PREFIX}${scope}`),
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=epoch-harness.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { KILL_EPOCH_DECLARATIONS } from "./kill-epoch.js";
|
|
2
|
+
const epochCase = (id, impl, expected) => ({
|
|
3
|
+
id,
|
|
4
|
+
impl,
|
|
5
|
+
intro: "#5729",
|
|
6
|
+
adapters: ["store", "transport", "executor"],
|
|
7
|
+
expected,
|
|
8
|
+
});
|
|
9
|
+
const EPOCH_IMPL = "packages/agent/src/execution/testing/epoch-cases.ts";
|
|
10
|
+
export const EPOCH_REGISTRY = [
|
|
11
|
+
epochCase("EPOCH-01", EPOCH_IMPL, "a barrier holding the floor ACK while the new owner dispatches: 0 effects, then once"),
|
|
12
|
+
epochCase("EPOCH-02", EPOCH_IMPL, "two concurrent CAS claims: exactly one owner; only its calls run"),
|
|
13
|
+
epochCase("EPOCH-03", EPOCH_IMPL, "an old owner's delayed prepare, release or invoke after the new owner's first call is refused"),
|
|
14
|
+
epochCase("MULTI-EPOCH-01", "packages/agent/src/execution/testing/multi-epoch-cases.ts", "one session's epoch bump leaves the other sessions' scopes on the hand untouched"),
|
|
15
|
+
...KILL_EPOCH_DECLARATIONS.map(({ id, expected }) => epochCase(id, "packages/agent/src/execution/testing/kill-epoch.ts", expected)),
|
|
16
|
+
];
|
|
17
|
+
//# sourceMappingURL=epoch-registry.js.map
|
|
@@ -40,6 +40,9 @@ export interface HandRig {
|
|
|
40
40
|
rows(): Promise<ExecutionEntry[]>;
|
|
41
41
|
}
|
|
42
42
|
export declare function call(id: string): AgentToolCall;
|
|
43
|
+
export type TransportPump = Pick<HandRig, "advance" | "settle" | "runUntil">;
|
|
44
|
+
/** Steps transport time on `timers` the way every hand rig waits (see {@link HandRig.advance}). */
|
|
45
|
+
export declare function transportPump(timers: ManualTimers): TransportPump;
|
|
43
46
|
export declare function openHandRig(adapters: HandCaseAdapters, options: {
|
|
44
47
|
readonly placement: HandPlacement;
|
|
45
48
|
readonly killAt?: KillPoint;
|
|
@@ -16,6 +16,31 @@ const drain = async () => {
|
|
|
16
16
|
export function call(id) {
|
|
17
17
|
return { type: "toolCall", id, name: "probe", arguments: { id } };
|
|
18
18
|
}
|
|
19
|
+
/** Steps transport time on `timers` the way every hand rig waits (see {@link HandRig.advance}). */
|
|
20
|
+
export function transportPump(timers) {
|
|
21
|
+
const pump = async (stop, ms) => {
|
|
22
|
+
const end = timers.now() + ms;
|
|
23
|
+
await drain();
|
|
24
|
+
while (!stop() && timers.now() < end) {
|
|
25
|
+
await timers.advanceTo(Math.min(end, timers.now() + TICK_MS));
|
|
26
|
+
await drain();
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const runUntil = async (done, what, budgetMs = 600_000) => {
|
|
30
|
+
await pump(done, budgetMs);
|
|
31
|
+
if (!done())
|
|
32
|
+
throw new Error(`${what}: not reached within ${budgetMs} ms of transport time`);
|
|
33
|
+
};
|
|
34
|
+
const settle = async (promise, what, budgetMs = 600_000) => {
|
|
35
|
+
let outcome;
|
|
36
|
+
promise.then((value) => void (outcome = { value }), (error) => void (outcome = { error }));
|
|
37
|
+
await runUntil(() => outcome !== undefined, what, budgetMs);
|
|
38
|
+
if (outcome === undefined || "error" in outcome)
|
|
39
|
+
throw outcome?.error;
|
|
40
|
+
return outcome.value;
|
|
41
|
+
};
|
|
42
|
+
return { advance: (ms) => pump(() => false, ms), settle, runUntil };
|
|
43
|
+
}
|
|
19
44
|
export async function openHandRig(adapters, options) {
|
|
20
45
|
const timers = createManualTimers(1_000);
|
|
21
46
|
const network = createInProcessNetwork({ schedule: (deliver) => void timers.setTimer(deliver, 0) });
|
|
@@ -83,29 +108,9 @@ export async function openHandRig(adapters, options) {
|
|
|
83
108
|
let current = await adapters.store.open(medium, { onWritePoint: killing });
|
|
84
109
|
await startHand(current).ready;
|
|
85
110
|
const host = createRemoteToolHost({ transport: sessionSide, placement: options.placement });
|
|
86
|
-
const
|
|
87
|
-
const end = timers.now() + ms;
|
|
88
|
-
await drain();
|
|
89
|
-
while (!stop() && timers.now() < end) {
|
|
90
|
-
await timers.advanceTo(Math.min(end, timers.now() + TICK_MS));
|
|
91
|
-
await drain();
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
const runUntil = async (done, what, budgetMs = 600_000) => {
|
|
95
|
-
await pump(done, budgetMs);
|
|
96
|
-
if (!done())
|
|
97
|
-
throw new Error(`${what}: not reached within ${budgetMs} ms of transport time`);
|
|
98
|
-
};
|
|
99
|
-
const settle = async (promise, what, budgetMs = 600_000) => {
|
|
100
|
-
let outcome;
|
|
101
|
-
promise.then((value) => void (outcome = { value }), (error) => void (outcome = { error }));
|
|
102
|
-
await runUntil(() => outcome !== undefined, what, budgetMs);
|
|
103
|
-
if (outcome === undefined || "error" in outcome)
|
|
104
|
-
throw outcome?.error;
|
|
105
|
-
return outcome.value;
|
|
106
|
-
};
|
|
111
|
+
const { advance, settle, runUntil } = transportPump(timers);
|
|
107
112
|
return {
|
|
108
|
-
advance
|
|
113
|
+
advance,
|
|
109
114
|
bodies,
|
|
110
115
|
faults,
|
|
111
116
|
killed: killed.promise,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { KILL_HAND_DECLARATIONS } from "./kill-hand.js";
|
|
2
|
+
const HAND_INTRO = "#5482";
|
|
3
|
+
const handCase = (id, impl, expected) => ({
|
|
4
|
+
id,
|
|
5
|
+
impl,
|
|
6
|
+
intro: HAND_INTRO,
|
|
7
|
+
adapters: ["store", "transport", "executor"],
|
|
8
|
+
expected,
|
|
9
|
+
});
|
|
10
|
+
const KILL_HAND_IMPL = "packages/agent/src/execution/testing/kill-hand.ts";
|
|
11
|
+
const MULTI_HAND_IMPL = "packages/agent/src/execution/testing/multi-hand-cases.ts";
|
|
12
|
+
const FAULT_HAND_IMPL = "packages/agent/src/execution/testing/fault-hand-cases.ts";
|
|
13
|
+
export const HAND_REGISTRY = [
|
|
14
|
+
...KILL_HAND_DECLARATIONS.map(({ id, expected }) => handCase(id, KILL_HAND_IMPL, expected)),
|
|
15
|
+
handCase("MULTI-HAND-01", MULTI_HAND_IMPL, "N scopes batch at once on one hand; each scope's calls start in lane order"),
|
|
16
|
+
handCase("MULTI-KILL-01", MULTI_HAND_IMPL, "cross-machine: a hand killed with several scopes in flight; each ends hand_restarted, uncertain, never rerun"),
|
|
17
|
+
...["slow", "lossy", "laggy", "flap", "drop-reattach"].map((profile, index) => handCase(`FAULT-HAND-0${index + 1}`, FAULT_HAND_IMPL, `${profile} profile: every call settles with its unfaulted result, runs once, per-scope order kept`)),
|
|
18
|
+
handCase("FAULT-HAND-MULTI-01", FAULT_HAND_IMPL, "hand unreachable past the resume window: dependent calls pause, then each scope resumes exactly once"),
|
|
19
|
+
];
|
|
20
|
+
//# sourceMappingURL=hand-registry.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CaseImplementation } from "../../conformance/runner.ts";
|
|
2
|
+
import { type HandCaseAdapters } from "./hand-harness.ts";
|
|
3
|
+
export interface KillEpochDeclaration {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly expected: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const KILL_EPOCH_DECLARATIONS: readonly KillEpochDeclaration[];
|
|
8
|
+
export declare const KILL_EPOCH_CASES: ReadonlyMap<string, CaseImplementation<HandCaseAdapters>>;
|
|
9
|
+
//# sourceMappingURL=kill-epoch.d.ts.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { expectEqual } from "../../durable/testing/store-harness.js";
|
|
2
|
+
import { texts } from "./epoch-cases.js";
|
|
3
|
+
import { floorCommit, openEpochRig, stepCommit } from "./epoch-harness.js";
|
|
4
|
+
import { call } from "./hand-harness.js";
|
|
5
|
+
const OLD = { name: "brain-old", epoch: 1 };
|
|
6
|
+
const NEW = { name: "brain-new", epoch: 2 };
|
|
7
|
+
const FENCED = "the old owner stays fenced";
|
|
8
|
+
const POINTS = [
|
|
9
|
+
{
|
|
10
|
+
id: "KILL-EPOCH-01-B",
|
|
11
|
+
match: floorCommit("s", NEW.epoch),
|
|
12
|
+
at: "before",
|
|
13
|
+
floorAfterKill: OLD.epoch,
|
|
14
|
+
newCallRuns: true,
|
|
15
|
+
expected: `kill before the floor raise is durable: no ACK; the re-sent floor is acked after restart, the new call runs once, ${FENCED}`,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: "KILL-EPOCH-01-D",
|
|
19
|
+
match: floorCommit("s", NEW.epoch),
|
|
20
|
+
at: "durable",
|
|
21
|
+
floorAfterKill: NEW.epoch,
|
|
22
|
+
newCallRuns: true,
|
|
23
|
+
expected: `kill once the floor is durable, before its ACK: the restarted hand holds the floor, the new call runs once, ${FENCED}`,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: "KILL-EPOCH-02-B",
|
|
27
|
+
match: stepCommit(NEW.name, "admit"),
|
|
28
|
+
at: "before",
|
|
29
|
+
floorAfterKill: NEW.epoch,
|
|
30
|
+
newCallRuns: true,
|
|
31
|
+
expected: `kill after the ACK, before the new owner's first call is recorded: the floor survives, the call runs once, ${FENCED}`,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: "KILL-EPOCH-02-D",
|
|
35
|
+
match: stepCommit(NEW.name, "admit"),
|
|
36
|
+
at: "durable",
|
|
37
|
+
floorAfterKill: NEW.epoch,
|
|
38
|
+
newCallRuns: false,
|
|
39
|
+
expected: `kill once the new owner's first call is recorded: the floor survives, the call ends hand_restarted and never runs, ${FENCED}`,
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
const cases = POINTS.map((point) => {
|
|
43
|
+
const run = async (adapters) => {
|
|
44
|
+
const what = point.id;
|
|
45
|
+
const rig = await openEpochRig(adapters, { brains: [OLD, NEW], kill: { match: point.match, at: point.at } });
|
|
46
|
+
rig.setOwner("s", OLD.name);
|
|
47
|
+
await rig.settle(rig.execute(OLD.name, "s", [call("c0")]), `${what}: the old owner's first call`);
|
|
48
|
+
rig.setOwner("s", NEW.name);
|
|
49
|
+
const moved = rig.execute(NEW.name, "s", [call("c1")]);
|
|
50
|
+
await rig.settle(rig.killed, `${what}: the kill point fired`);
|
|
51
|
+
expectEqual(await rig.floor("s"), { epoch: point.floorAfterKill, owner: point.floorAfterKill === NEW.epoch ? NEW.name : OLD.name }, `${what}: the floor durable at the kill`);
|
|
52
|
+
await rig.restart();
|
|
53
|
+
const result = await rig.settle(moved, `${what}: the new owner's call`);
|
|
54
|
+
if (point.newCallRuns)
|
|
55
|
+
expectEqual(texts(result), ["ran:c1"], `${what}: the new owner's call ran`);
|
|
56
|
+
else
|
|
57
|
+
expectEqual(result.messages[0]?.details, { outcome: "hand_restarted", uncertain: false, hooksRan: false }, `${what}: the recorded call ended hand_restarted, not uncertain`);
|
|
58
|
+
const delayed = await rig.settle(rig.execute(OLD.name, "s", [call("c2")]), `${what}: a delayed old-owner call`);
|
|
59
|
+
expectEqual(delayed.messages[0]?.isError, true, `${what}: the old owner's delayed call is refused`);
|
|
60
|
+
await rig.advance(200);
|
|
61
|
+
expectEqual(rig.bodies, point.newCallRuns ? ["s:c0", "s:c1"] : ["s:c0"], `${what}: tool body runs`);
|
|
62
|
+
expectEqual((await rig.rows()).map(({ commandId, progress }) => [commandId, progress.state]), [
|
|
63
|
+
["brain-new-1", "acked"],
|
|
64
|
+
["brain-old-1", "acked"],
|
|
65
|
+
], `${what}: one durable record per call that reached the ledger, acknowledged`);
|
|
66
|
+
};
|
|
67
|
+
return { declaration: { id: point.id, expected: point.expected }, run };
|
|
68
|
+
});
|
|
69
|
+
export const KILL_EPOCH_DECLARATIONS = cases.map(({ declaration }) => declaration);
|
|
70
|
+
export const KILL_EPOCH_CASES = new Map(cases.map(({ declaration, run }) => [declaration.id, run]));
|
|
71
|
+
//# sourceMappingURL=kill-epoch.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CaseImplementation } from "../../conformance/runner.ts";
|
|
2
|
+
import type { TransportCaseAdapters } from "../../transport/testing/transport-harness.ts";
|
|
3
|
+
import { type LoopHookPoint } from "../loop-hook-host-hand.ts";
|
|
4
|
+
/** Where the kill lands: a point of the call on the hand, or after the loop host committed the reply. */
|
|
5
|
+
type KillAt = LoopHookPoint | "committed";
|
|
6
|
+
export interface KillHookDeclaration {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly at: KillAt;
|
|
9
|
+
readonly expected: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const KILL_HOOK_DECLARATIONS: readonly KillHookDeclaration[];
|
|
12
|
+
export declare const KILL_HOOK_CASES: ReadonlyMap<string, CaseImplementation<TransportCaseAdapters>>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=kill-hook.d.ts.map
|