@sema-agent/core 7.63.0 → 7.64.0
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/CHANGELOG.md +408 -0
- package/dist/agents/cc-peer-directory.js +1 -0
- package/dist/agents/cc-peer-wire.d.ts +4 -0
- package/dist/agents/cc-peer-wire.js +1 -0
- package/dist/agents/cc-uds-peer-channel.js +5 -0
- package/dist/agents/cross-session-judge.d.ts +3 -1
- package/dist/agents/cross-session-judge.js +4 -1
- package/dist/agents/peer-directory.d.ts +8 -0
- package/dist/agents/peer-directory.js +4 -0
- package/dist/agents/peer-held-queue.d.ts +9 -3
- package/dist/agents/peer-held-queue.js +12 -9
- package/dist/agents/peer-idle.d.ts +20 -1
- package/dist/agents/peer-idle.js +23 -12
- package/dist/agents/peer-notice-route.d.ts +16 -5
- package/dist/agents/peer-notice-route.js +11 -9
- package/dist/agents/peer-notices.d.ts +25 -8
- package/dist/agents/peer-notices.js +6 -1
- package/dist/agents/peer-session-drain.d.ts +32 -6
- package/dist/agents/peer-session-drain.js +100 -26
- package/dist/agents/send-message-tool.d.ts +7 -0
- package/dist/agents/send-message-tool.js +18 -6
- package/dist/agents/subagent.js +20 -3
- package/dist/core/allow-entry.d.ts +4 -0
- package/dist/core/ask-origin.d.ts +1 -1
- package/dist/core/ask-origin.js +2 -2
- package/dist/core/ask-unresolvable-notice.d.ts +13 -4
- package/dist/core/ask-unresolvable-notice.js +10 -3
- package/dist/core/auto-compaction.d.ts +7 -5
- package/dist/core/background-agent-store.d.ts +7 -0
- package/dist/core/background-agent-store.js +3 -0
- package/dist/core/checkpoint-queries.d.ts +9 -6
- package/dist/core/checkpoint-queries.js +8 -3
- package/dist/core/checkpoint-store.d.ts +5 -1
- package/dist/core/context-settings.d.ts +40 -9
- package/dist/core/context-settings.js +32 -10
- package/dist/core/engine-attestation.d.ts +26 -6
- package/dist/core/engine-attestation.js +5 -1
- package/dist/core/engine-notice.d.ts +24 -1
- package/dist/core/extension-requester.d.ts +9 -0
- package/dist/core/extension-requester.js +7 -0
- package/dist/core/file-history-store.d.ts +28 -0
- package/dist/core/file-history-store.js +48 -5
- package/dist/core/fs-write-gate-policy.js +1 -1
- package/dist/core/gate-fold.js +2 -0
- package/dist/core/gate-lanes.js +2 -0
- package/dist/core/gate-outcome.d.ts +39 -2
- package/dist/core/gate-outcome.js +20 -1
- package/dist/core/governance-codes.d.ts +3 -1
- package/dist/core/governance-codes.js +4 -0
- package/dist/core/leg-identity.d.ts +19 -1
- package/dist/core/leg-identity.js +12 -0
- package/dist/core/mailbox-store.d.ts +39 -4
- package/dist/core/mailbox-store.js +14 -2
- package/dist/core/memory-engine/consolidation.d.ts +3 -2
- package/dist/core/memory-engine/consolidation.js +16 -0
- package/dist/core/memory-engine/control-objects.d.ts +25 -0
- package/dist/core/memory-engine/control-objects.js +151 -0
- package/dist/core/memory-engine/control-plane-adoption.d.ts +48 -0
- package/dist/core/memory-engine/control-plane-adoption.js +159 -0
- package/dist/core/memory-engine/delegation-settlement.d.ts +21 -5
- package/dist/core/memory-engine/delegation-settlement.js +217 -26
- package/dist/core/memory-engine/dual-root.js +2 -2
- package/dist/core/memory-engine/engine.d.ts +38 -23
- package/dist/core/memory-engine/engine.js +14 -14
- package/dist/core/memory-engine/file-backend.d.ts +41 -65
- package/dist/core/memory-engine/file-backend.js +59 -166
- package/dist/core/memory-engine/index.d.ts +3 -2
- package/dist/core/memory-engine/index.js +2 -1
- package/dist/core/memory-engine/layout.d.ts +6 -1
- package/dist/core/memory-engine/layout.js +12 -7
- package/dist/core/memory-engine/memory-backend-contract.d.ts +10 -3
- package/dist/core/memory-engine/memory-backend-contract.js +158 -2
- package/dist/core/memory-engine/memory-deployment.d.ts +11 -3
- package/dist/core/memory-engine/memory-deployment.js +31 -6
- package/dist/core/memory-engine/origin-clearance.d.ts +12 -3
- package/dist/core/memory-engine/origin-clearance.js +68 -9
- package/dist/core/memory-engine/session-write-home.d.ts +34 -1
- package/dist/core/memory-engine/session-write-home.js +37 -10
- package/dist/core/memory-engine/types.d.ts +44 -7
- package/dist/core/memory-engine/types.js +2 -1
- package/dist/core/mode-policy.js +3 -3
- package/dist/core/mods/agent-stations.d.ts +18 -0
- package/dist/core/mods/agent-stations.js +8 -6
- package/dist/core/mods/extension-call.d.ts +4 -0
- package/dist/core/mods/extension-call.js +8 -0
- package/dist/core/mods/tool-call.js +3 -4
- package/dist/core/parent-spec-seat.d.ts +2 -2
- package/dist/core/peer-channel.d.ts +5 -0
- package/dist/core/permission-rule-consent.d.ts +21 -10
- package/dist/core/permission-rule-consent.js +50 -23
- package/dist/core/permission-rule-store.d.ts +41 -16
- package/dist/core/permission-rule-store.js +2 -0
- package/dist/core/refusal-echo.d.ts +20 -0
- package/dist/core/refusal-echo.js +33 -0
- package/dist/core/retention.d.ts +180 -10
- package/dist/core/retention.js +45 -0
- package/dist/core/retired-keys.d.ts +5 -0
- package/dist/core/retired-keys.js +3 -0
- package/dist/core/rule-offer-read.d.ts +0 -4
- package/dist/core/rule-offer-read.js +2 -18
- package/dist/core/runner/classifier-ladder.d.ts +7 -1
- package/dist/core/runner/classifier-ladder.js +4 -2
- package/dist/core/runner/compact-session.js +10 -7
- package/dist/core/runner/compaction-call-options.d.ts +7 -7
- package/dist/core/runner/compaction-call-options.js +3 -2
- package/dist/core/runner/contracts.d.ts +21 -2
- package/dist/core/runner/delegation-owner.d.ts +10 -3
- package/dist/core/runner/delegation-owner.js +4 -1
- package/dist/core/runner/gate-exit.d.ts +6 -0
- package/dist/core/runner/gate-exit.js +11 -2
- package/dist/core/runner/memory-consolidation-driver.d.ts +4 -2
- package/dist/core/runner/memory-consolidation-driver.js +8 -5
- package/dist/core/runner/prepare-ask-lane.js +3 -3
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +3 -1
- package/dist/core/runner/prepare-caps-and-workflow.js +2 -2
- package/dist/core/runner/prepare-config-doors.js +4 -0
- package/dist/core/runner/prepare-delegation-surface.d.ts +3 -0
- package/dist/core/runner/prepare-delegation-surface.js +2 -2
- package/dist/core/runner/prepare-gate-stations.d.ts +5 -0
- package/dist/core/runner/prepare-gate-stations.js +5 -5
- package/dist/core/runner/prepare-hands-readface.js +1 -1
- package/dist/core/runner/prepare-inherited-gate.d.ts +3 -1
- package/dist/core/runner/prepare-inherited-gate.js +4 -2
- package/dist/core/runner/prepare-memory.d.ts +4 -0
- package/dist/core/runner/prepare-memory.js +14 -20
- package/dist/core/runner/prepare-policy-chain.js +7 -7
- package/dist/core/runner/prepare-prompt-inputs.js +1 -1
- package/dist/core/runner/prepare-task.js +15 -10
- package/dist/core/runner/prepare-wiring-manifest.d.ts +3 -1
- package/dist/core/runner/prepare-wiring-manifest.js +3 -2
- package/dist/core/runner/resume-admission.d.ts +2 -2
- package/dist/core/runner/resume-admission.js +2 -23
- package/dist/core/runner/role-resolution-table.d.ts +98 -0
- package/dist/core/runner/role-resolution-table.js +62 -0
- package/dist/core/runner/run-compaction-machinery.js +2 -2
- package/dist/core/runner/run-identity-wiring.js +12 -9
- package/dist/core/runner/run-leg.js +8 -4
- package/dist/core/runner/run-notification-lane.js +22 -22
- package/dist/core/runner/run-recovery-lanes.js +3 -3
- package/dist/core/runner/run-terminal-adoption.js +1 -1
- package/dist/core/runner/run-turn-boundary.js +14 -15
- package/dist/core/runner/runtask.js +1 -1
- package/dist/core/runner/tool-occurrence.d.ts +4 -2
- package/dist/core/runner/tool-occurrence.js +2 -2
- package/dist/core/runner-deps.d.ts +1 -1
- package/dist/core/session-checkout.d.ts +63 -3
- package/dist/core/session-checkout.js +152 -58
- package/dist/core/shell-read-silence.js +8 -0
- package/dist/core/store-contracts/peer-directory-contract.js +8 -1
- package/dist/core/task-event.d.ts +9 -5
- package/dist/core/task-notification.d.ts +110 -31
- package/dist/core/task-notification.js +180 -100
- package/dist/core/task-registry-agent.d.ts +11 -0
- package/dist/core/task-registry-agent.js +11 -3
- package/dist/core/task-registry-shared.d.ts +7 -0
- package/dist/core/task-registry.d.ts +18 -0
- package/dist/core/task-registry.js +27 -8
- package/dist/core/task-spec.d.ts +7 -2
- package/dist/core/tool-errors.d.ts +14 -6
- package/dist/core/tool-errors.js +1 -1
- package/dist/core/tool-policy.d.ts +18 -1
- package/dist/core/tool-policy.js +16 -7
- package/dist/core/tool-result-store.d.ts +20 -0
- package/dist/core/tool-spec.d.ts +4 -0
- package/dist/core/trace.d.ts +3 -2
- package/dist/core/workflow-journal-store.d.ts +11 -0
- package/dist/core/workflow-journal-store.js +7 -0
- package/dist/core/workflow-run-store.d.ts +9 -0
- package/dist/core/workflow-run-store.js +6 -0
- package/dist/engine/compaction/compaction.d.ts +2 -1
- package/dist/engine/harness/types.d.ts +1 -0
- package/dist/engine/session/session.d.ts +7 -1
- package/dist/engine/session/session.js +5 -2
- package/dist/index.d.ts +7 -5
- package/dist/index.js +7 -5
- package/dist/orchestration/run-workflow-tool.d.ts +4 -0
- package/dist/orchestration/run-workflow-tool.js +7 -0
- package/dist/orchestration/workflow-types.d.ts +2 -1
- package/dist/orchestration/workflow.d.ts +3 -0
- package/dist/orchestration/workflow.js +2 -1
- package/dist/stores/file/checkpoint-store.d.ts +6 -0
- package/dist/stores/file/checkpoint-store.js +4 -1
- package/dist/stores/file/file-history-store.d.ts +13 -0
- package/dist/stores/file/file-history-store.js +75 -13
- package/dist/stores/file/index.d.ts +11 -1
- package/dist/stores/file/index.js +7 -11
- package/dist/stores/file/permission-rule-store.d.ts +23 -0
- package/dist/stores/file/permission-rule-store.js +75 -7
- package/dist/stores/file/tool-result-store.d.ts +14 -0
- package/dist/stores/file/tool-result-store.js +39 -2
- package/dist/stores/file/workflow-journal-store.d.ts +4 -0
- package/dist/stores/file/workflow-journal-store.js +17 -0
- package/dist/stores/file/workflow-run-store.d.ts +3 -0
- package/dist/stores/file/workflow-run-store.js +15 -0
- package/dist/tools/fs/read-deny.d.ts +15 -2
- package/dist/tools/fs/read-deny.js +10 -2
- package/dist/tools/fs/shell-read-check.d.ts +8 -2
- package/dist/tools/fs/shell-read-check.js +7 -7
- package/package.json +2 -2
- package/test/export-surface.snapshot.json +63 -1
- package/wire-changes/core-stores-sql@7.64.0.json +30 -0
- package/wire-changes/core@7.64.0.json +2653 -0
- package/wire-changes/mods-kernel@7.64.0.json +30 -0
- package/wire-changes/primitives@7.64.0.json +30 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { MailboxAppendMessage, MailboxStore } from "./mailbox-store.js";
|
|
2
|
+
import { type EngineNotice } from "./engine-notice.js";
|
|
2
3
|
/** The TERMINAL words of {@link TaskNotificationStatus}: the one table every "is this frame a completion?"
|
|
3
4
|
* reading asks, exported as a value so a consumer outside the package reads these words rather than its own list. */
|
|
4
5
|
export declare const TASK_NOTIFICATION_TERMINAL_STATUSES: readonly ["completed", "failed", "killed", "cancelled"];
|
|
@@ -13,7 +14,7 @@ export type SystemInjectionPriority = "now" | "next" | "later";
|
|
|
13
14
|
* · `parked` — no live lane; pended IN PROCESS on {@link PendingSessionNotifications} for the
|
|
14
15
|
* session's next run in this process (a process restart loses it);
|
|
15
16
|
* · `parked_durably` — no live lane; appended to the session's DURABLE box
|
|
16
|
-
* ({@link PendingSessionNotifications.
|
|
17
|
+
* ({@link PendingSessionNotifications.admit}) — the next run drains it, in any process;
|
|
17
18
|
* · `dropped_duplicate` — the session already delivered this exact frame;
|
|
18
19
|
* · `refused` — a live lane took it and the session's receiving station did not hand it over: an extension consumed it,
|
|
19
20
|
* or a handler there failed ({@link FrameReceiver}). The model never saw it, and it is not owed again.
|
|
@@ -260,7 +261,7 @@ export interface TaskNotificationPayload {
|
|
|
260
261
|
};
|
|
261
262
|
/**
|
|
262
263
|
* design/385 §4.4 / §5.2 (slice 4) — the CROSS-SESSION NOTICE carrier: a delivery receipt about one of
|
|
263
|
-
* THIS session's own outbound messages (held / denied / expired / delivered / refused / dropped) or an
|
|
264
|
+
* THIS session's own outbound messages (held / held_by_policy / denied / expired / delivered / refused / dropped) or an
|
|
264
265
|
* idle notice for a `notify_when_idle` ask (idle / exited / unavailable / expired), drained from this
|
|
265
266
|
* session's own box as a notice-kind record. Its PRESENCE is the render discriminator: the model reads
|
|
266
267
|
* the engine-rendered notice line as-is (CC injects `[Cross-session delivery notice] …` /
|
|
@@ -500,6 +501,37 @@ export declare const MAX_PENDING_SESSIONS = 100;
|
|
|
500
501
|
* a long-lived leader's binding is not evicted by parked traffic (eviction = the park backend degrades
|
|
501
502
|
* to in-process, which the receipt then says). */
|
|
502
503
|
export declare const MAX_SESSION_BOX_BINDINGS = 4096;
|
|
504
|
+
/**
|
|
505
|
+
* WHERE a frame for one session goes: the session id and the occupant of its row — `SessionMetadata.incarnation`, as the
|
|
506
|
+
* run that names the address acquired the row (`undefined` = no token: a row written before occupants were minted, or a
|
|
507
|
+
* read that failed). A session id can be deleted and created again under the same spelling, by another principal or the
|
|
508
|
+
* same one; the new row is another occupant, and a frame addressed to the one before it is never delivered to it
|
|
509
|
+
* ({@link sameOccupant}). Every seat of {@link PendingSessionNotifications} — its live lanes, its durable box, its
|
|
510
|
+
* parked records — is held for one address.
|
|
511
|
+
*/
|
|
512
|
+
export interface SessionAddress {
|
|
513
|
+
readonly sessionId: string;
|
|
514
|
+
readonly occupant: string | undefined;
|
|
515
|
+
/** The leg could not read its occupant (the read threw): `occupant` is then no answer, and the address is nobody's. The store
|
|
516
|
+
* takes the leg as no admission, drains it nothing, registers no live lane for it, and discards (announced) what is routed
|
|
517
|
+
* to it ({@link PendingSessionNotifications.admit}, {@link PendingSessionNotifications.discardsStale}). */
|
|
518
|
+
readonly unread?: true;
|
|
519
|
+
}
|
|
520
|
+
/** A run leg's own session address — the session it prepared and the occupant its acquire read (the one construction). */
|
|
521
|
+
export declare function sessionAddressOf(leg: {
|
|
522
|
+
readonly sessionId: string;
|
|
523
|
+
readonly sessionIncarnation?: string;
|
|
524
|
+
readonly sessionIncarnationUnread?: true;
|
|
525
|
+
}): SessionAddress;
|
|
526
|
+
/** Which seat a frame addressed to an earlier occupant of a session would have reached under the occupant the session
|
|
527
|
+
* holds now: that occupant's live run, its durable box, or its next run's turn-open drain. */
|
|
528
|
+
export type DiscardedDeliveryPath = "live" | "box" | "drain";
|
|
529
|
+
/**
|
|
530
|
+
* The account of a frame discarded because its address names an occupant the session no longer holds — the one mint of
|
|
531
|
+
* `delegation.delivery_discarded`. Counts and words only: the frame's text (a child's summary, a peer's words) never
|
|
532
|
+
* rides it, nor either occupant token (only whether each side had one).
|
|
533
|
+
*/
|
|
534
|
+
export declare function deliveryDiscardedNotice(address: Pick<SessionAddress, "sessionId" | "occupant">, current: string | undefined, payload: TaskNotificationPayload, path: DiscardedDeliveryPath): EngineNotice;
|
|
503
535
|
/**
|
|
504
536
|
* A session's DURABLE box, bound to the park seat by the leg that mounts its session-box drain — one
|
|
505
537
|
* mint (the drain mount judgment), two readers (the drain and {@link routeOrParkNotification}), so
|
|
@@ -597,9 +629,9 @@ export type EngineFrameDecode = {
|
|
|
597
629
|
* writer must never have encoded is dropped rather than trusted. */
|
|
598
630
|
export declare function decodeEngineFrame(content: string): EngineFrameDecode;
|
|
599
631
|
/** The durable form of an engine frame: the codec text under `kind: "engine_frame"`, stamped with
|
|
600
|
-
* the box owner as `fromRoot` (the park seat's own fact, as for a peer-words record)
|
|
601
|
-
* it is not a peer message and is never admitted as one. */
|
|
602
|
-
export declare function engineFrameRecordOf(payload: TaskNotificationPayload, priority: SystemInjectionPriority,
|
|
632
|
+
* the box owner as `fromRoot` (the park seat's own fact, as for a peer-words record) and with the occupant the frame is
|
|
633
|
+
* addressed to (`occupant`, when the address has one); no hop chain — it is not a peer message and is never admitted as one. */
|
|
634
|
+
export declare function engineFrameRecordOf(payload: TaskNotificationPayload, priority: SystemInjectionPriority, to: Pick<SessionAddress, "sessionId" | "occupant">): MailboxAppendMessage;
|
|
603
635
|
/**
|
|
604
636
|
* RB-375 A2 (ruled 2026-08-03) — is this frame the TERMINAL of a delegated background agent?
|
|
605
637
|
*
|
|
@@ -809,20 +841,26 @@ export declare function createLiveNotificationLane(seat: {
|
|
|
809
841
|
* run" — and every lane is tried once, so a lane that has stopped, or that has already handed this very
|
|
810
842
|
* frame away, is passed over rather than swallowing it. A lane that refused a frame therefore cannot be
|
|
811
843
|
* reached by it again, which is what makes a route of any length terminate on the parked store.
|
|
844
|
+
*
|
|
845
|
+
* A lane sits under its run's {@link SessionAddress}: a frame is offered only to the lanes of the occupant it is
|
|
846
|
+
* addressed to ({@link sameOccupant}). A run of another occupant of the same id — the id deleted and created again,
|
|
847
|
+
* by another principal or the same one — is never a destination for it.
|
|
812
848
|
*/
|
|
813
849
|
export declare class SessionLiveNotificationLanes {
|
|
814
850
|
private readonly lanes;
|
|
815
|
-
register(
|
|
851
|
+
register(address: SessionAddress, lane: LiveNotificationLane): void;
|
|
816
852
|
/** Idempotent (a lane withdraws at its stop AND again at its outermost teardown). The key is dropped
|
|
817
853
|
* with its last lane so an idle process holds no per-session entry. */
|
|
818
|
-
unregister(
|
|
854
|
+
unregister(address: SessionAddress, lane: LiveNotificationLane): void;
|
|
819
855
|
/**
|
|
820
|
-
* Offer the payload to the
|
|
856
|
+
* Offer the payload to the addressed occupant's live lanes, newest first. The caller's OWN lane is not
|
|
821
857
|
* special-cased: a lane that just refused this frame reports `"unavailable"` for it from then on.
|
|
822
858
|
*/
|
|
823
|
-
deliver(
|
|
859
|
+
deliver(address: SessionAddress, payload: TaskNotificationPayload, priority: SystemInjectionPriority, opts?: {
|
|
824
860
|
onDisposition?: (d: NotificationDisposition) => void;
|
|
825
861
|
}): "taken" | "pending" | "duplicate" | "unavailable";
|
|
862
|
+
/** Does the addressed occupant hold a live lane here? */
|
|
863
|
+
holds(address: SessionAddress): boolean;
|
|
826
864
|
/** Sessions holding at least one live lane (observability + the tests' rollback detector). */
|
|
827
865
|
get size(): number;
|
|
828
866
|
}
|
|
@@ -836,12 +874,26 @@ export interface SessionBoxDebt {
|
|
|
836
874
|
readonly box: SessionBoxBinding;
|
|
837
875
|
readonly record: MailboxAppendMessage;
|
|
838
876
|
}
|
|
877
|
+
/**
|
|
878
|
+
* Where a notification addressed to a session goes ({@link SessionAddress}): its live lanes, its durable box, its parked
|
|
879
|
+
* records — every seat held for ONE occupant of the session id. The session's CURRENT occupant is the one its latest leg in
|
|
880
|
+
* this process acquired ({@link admit}): an acquire answers the row as it stands, a row created again under the id is
|
|
881
|
+
* another occupant, and an occupant once replaced never stands again. So from an admission on, whatever is addressed to,
|
|
882
|
+
* or kept for, another occupant of that id is discarded — announced `delegation.delivery_discarded` (operator), never
|
|
883
|
+
* delivered and never silent. A session no leg of which was admitted here (or whose seat aged out of the bound) has no
|
|
884
|
+
* current occupant on record: its frames park under their own address and are judged by the leg that drains them.
|
|
885
|
+
*/
|
|
839
886
|
export declare class PendingSessionNotifications {
|
|
840
887
|
private readonly sessions;
|
|
888
|
+
/** Where a discard is announced: the deployment's notice sink, read when the discard happens (absent ⇒ the process default seat). */
|
|
889
|
+
private readonly noticeSeat;
|
|
890
|
+
constructor(seats?: {
|
|
891
|
+
readonly onNotice?: () => ((notice: EngineNotice) => void) | undefined;
|
|
892
|
+
});
|
|
841
893
|
/**
|
|
842
894
|
* The LIVE half of the same question this store answers. Together they are one seat — "where does a
|
|
843
895
|
* notification addressed to session S go?" — with two answers: the session's live lane when it has
|
|
844
|
-
* one, this parked queue when it does not. One object, one lifetime, one key (the session
|
|
896
|
+
* one, this parked queue when it does not. One object, one lifetime, one key (the session address).
|
|
845
897
|
*/
|
|
846
898
|
readonly liveLanes: SessionLiveNotificationLanes;
|
|
847
899
|
/** Whole sessions evicted by {@link MAX_PENDING_SESSIONS} (their pendings were never delivered). */
|
|
@@ -859,16 +911,35 @@ export declare class PendingSessionNotifications {
|
|
|
859
911
|
/** Whole-session losses whose tombstone was itself evicted — the count survives, the attribution
|
|
860
912
|
* does not. Surfaced on the next session-level disclosure so it is never simply forgotten. */
|
|
861
913
|
private unattributedDrops;
|
|
862
|
-
/**
|
|
863
|
-
private readonly
|
|
914
|
+
/** Each session's current occupant and its durable park backend ({@link SessionBoxBinding}); insertion-ordered, bounded. */
|
|
915
|
+
private readonly seats;
|
|
916
|
+
/**
|
|
917
|
+
* A leg of the session has acquired its row as `address.occupant` — its current occupant from now on — and binds (or, with
|
|
918
|
+
* `undefined`, unbinds) the session's durable box. Written at EVERY drain mount of a session's leg, so the binding tracks the
|
|
919
|
+
* deployment's current seats (a mailbox swapped out unbinds at the next mount); a re-admission refreshes the entry's LRU
|
|
920
|
+
* position. What this store still keeps for another occupant of the id — parked frames, their tombstone, their delivered and
|
|
921
|
+
* durable keys — is addressed to a row that will never stand again: the frames are discarded, each announced.
|
|
922
|
+
* A leg that could not read its occupant (`address.unread`) is no admission: the current occupant on record and what is kept
|
|
923
|
+
* for it stand for the next leg that reads its own. A seat is aged out only while the store keeps no record for its session,
|
|
924
|
+
* so a parked record is always judged against the occupant that parked it, never against whichever frame arrives next.
|
|
925
|
+
*/
|
|
926
|
+
admit(address: SessionAddress, box: SessionBoxBinding | undefined): void;
|
|
927
|
+
/** The addressed occupant's durable box: the one its own leg in this process bound, never another occupant's. */
|
|
928
|
+
sessionBoxFor(address: SessionAddress): SessionBoxBinding | undefined;
|
|
864
929
|
/**
|
|
865
|
-
*
|
|
866
|
-
*
|
|
867
|
-
*
|
|
930
|
+
* Is `address` an earlier occupant of a session whose current occupant is another? Then the frame is discarded here —
|
|
931
|
+
* announced with the seat it would have reached under the current occupant — and the answer is `true`: nothing routes,
|
|
932
|
+
* parks or folds it. `false` for the current occupant, and for a session with no current occupant on record. An unread
|
|
933
|
+
* address (a leg that could not read its occupant) is nobody's: its frames are discarded the same way, whatever the seat.
|
|
868
934
|
*/
|
|
869
|
-
|
|
870
|
-
/** The
|
|
871
|
-
|
|
935
|
+
discardsStale(address: SessionAddress, payload: TaskNotificationPayload): boolean;
|
|
936
|
+
/** The one place a discarded frame is announced. */
|
|
937
|
+
private announceDiscard;
|
|
938
|
+
/** Discard a record parked for an occupant the session no longer holds: every frame in it is announced; the record's own
|
|
939
|
+
* bookkeeping (its eviction counts, its box debts) belongs to that occupant and goes with it. */
|
|
940
|
+
private discardRecord;
|
|
941
|
+
/** The session's record when it is parked for the addressed occupant. */
|
|
942
|
+
private recordOf;
|
|
872
943
|
/**
|
|
873
944
|
* Settle what the session's pending copies owe their boxes ({@link SessionBoxDebt}): each is asked of its own box once
|
|
874
945
|
* more, under its record, in pend order. A box that answers took the record — it holds it, or received it already —
|
|
@@ -879,17 +950,22 @@ export declare class PendingSessionNotifications {
|
|
|
879
950
|
* unasked, stays owed — and a copy that owes its box is never drained ({@link drain} keeps it back) — until a later
|
|
880
951
|
* leg's settlement asks.
|
|
881
952
|
*/
|
|
882
|
-
settleBoxDebts(
|
|
953
|
+
settleBoxDebts(address: SessionAddress, signal?: AbortSignal): Promise<void> | undefined;
|
|
883
954
|
/** What a drain hands out of a parked record: everything but the copies that still owe their box — those go back
|
|
884
|
-
* into the store as the session's record (with their keys, tiers and debts) for the leg that settles them. */
|
|
955
|
+
* into the store as the session's record (with their occupant, keys, tiers and debts) for the leg that settles them. */
|
|
885
956
|
private keepBackOwing;
|
|
886
957
|
private settleBoxDebt;
|
|
887
|
-
|
|
958
|
+
/** Park a frame for the addressed occupant's next run. A frame addressed to an occupant the session no longer holds is
|
|
959
|
+
* discarded ({@link discardsStale}); a record kept for another occupant of an id no leg of which this process admitted (a
|
|
960
|
+
* record-holding seat is never aged out) names one of the two only — the newer arrival's record replaces it, its frames
|
|
961
|
+
* announced as discarded. `true` = the frame is
|
|
962
|
+
* parked for the address (a repeat of a parked key folds into it); `false` = discarded. */
|
|
963
|
+
pend(address: SessionAddress, n: TaskNotificationPayload, priority?: SystemInjectionPriority, debt?: SessionBoxDebt): boolean;
|
|
888
964
|
/** Remove and return the session's pendings (one-shot — the next run consumes them exactly once); a copy that
|
|
889
965
|
* still owes its box stays parked for the leg that settles it ({@link settleBoxDebts}).
|
|
890
966
|
* design/373 §3.5: the batch comes out PRIORITY-MAJOR (stable sort — pend order within a class;
|
|
891
967
|
* a no-priority record ranks as later), the idle-dequeue min-value-first form. */
|
|
892
|
-
drain(
|
|
968
|
+
drain(address: SessionAddress): DrainedPendingNotifications | undefined;
|
|
893
969
|
/**
|
|
894
970
|
* Keys a live lane of this session has already put in front of a model (the delivered half of the
|
|
895
971
|
* ledger below). Kept beside the parked keys because the WINDOW is the session's, not any one run's:
|
|
@@ -899,23 +975,23 @@ export declare class PendingSessionNotifications {
|
|
|
899
975
|
*/
|
|
900
976
|
private readonly routed;
|
|
901
977
|
/**
|
|
902
|
-
* Does this session ALREADY own this exact frame — parked, or routed onto a live lane? Only one of
|
|
978
|
+
* Does this session's addressed occupant ALREADY own this exact frame — parked, or routed onto a live lane? Only one of
|
|
903
979
|
* the two may hold a key: a producer retrying a frame the session has already taken must FOLD rather
|
|
904
980
|
* than be handed to whichever run has since gone live, which would deliver it there and again at the
|
|
905
|
-
* next drain. Callers ask BEFORE routing and BEFORE parking.
|
|
981
|
+
* next drain. Callers ask BEFORE routing and BEFORE parking. Another occupant's keys answer nothing here.
|
|
906
982
|
*/
|
|
907
|
-
holdsKey(
|
|
983
|
+
holdsKey(address: SessionAddress, dedupKey: string): boolean;
|
|
908
984
|
/** Keys the session's DURABLE box took ({@link routeOrParkNotification}'s durable arm) — the third holder
|
|
909
985
|
* {@link holdsKey} consults, so a retry of a frame the box already holds folds exactly as one the
|
|
910
986
|
* in-process store holds. Bounded like {@link routed}; a key is released when the append faulted and
|
|
911
987
|
* the frame took the in-process park instead (that store then owns it). */
|
|
912
988
|
private readonly durable;
|
|
913
|
-
noteDurablePark(
|
|
914
|
-
forgetDurablePark(
|
|
915
|
-
/** Record that this session has DELIVERED this frame — see {@link routed}. Written at ONE place, the
|
|
989
|
+
noteDurablePark(address: SessionAddress, dedupKey: string): void;
|
|
990
|
+
forgetDurablePark(address: SessionAddress, dedupKey: string): void;
|
|
991
|
+
/** Record that this session's addressed occupant has DELIVERED this frame — see {@link routed}. Written at ONE place, the
|
|
916
992
|
* harness's consumption sink (the step where a queued frame enters the model's input), so the record
|
|
917
993
|
* can never run ahead of the delivery it claims. */
|
|
918
|
-
markDelivered(
|
|
994
|
+
markDelivered(address: SessionAddress, dedupKey: string): void;
|
|
919
995
|
get size(): number;
|
|
920
996
|
}
|
|
921
997
|
/**
|
|
@@ -946,8 +1022,11 @@ export declare class DurableAppendObligations {
|
|
|
946
1022
|
* then, so only the lane that actually delivers writes ownership
|
|
947
1023
|
* ({@link LiveNotificationLaneSeat.markDelivered});
|
|
948
1024
|
* · nothing can take it ⇒ park, carrying the tier, for the session's next run.
|
|
1025
|
+
* The address names the session's occupant ({@link SessionAddress}): every one of the three is that occupant's — its keys,
|
|
1026
|
+
* its live lanes, its box, its record — and a frame addressed to an occupant the session no longer holds is discarded
|
|
1027
|
+
* before any of them ({@link PendingSessionNotifications.discardsStale}); its receipt says `"refused"`.
|
|
949
1028
|
*/
|
|
950
|
-
export declare function routeOrParkNotification(store: PendingSessionNotifications,
|
|
1029
|
+
export declare function routeOrParkNotification(store: PendingSessionNotifications, address: SessionAddress, payload: TaskNotificationPayload, priority: SystemInjectionPriority, onDisposition?: (d: NotificationDisposition) => void): void;
|
|
951
1030
|
/**
|
|
952
1031
|
* The durable form of a parked peer-words frame: the SAME `peer_message` record the cross-session lane
|
|
953
1032
|
* appends (the recipient's drain renders it through the one envelope and judges it through the one
|
|
@@ -960,7 +1039,7 @@ export declare function sessionBoxRecordOf(payload: TaskNotificationPayload & {
|
|
|
960
1039
|
from: string;
|
|
961
1040
|
body: string;
|
|
962
1041
|
};
|
|
963
|
-
},
|
|
1042
|
+
}, to: Pick<SessionAddress, "sessionId" | "occupant">): MailboxAppendMessage;
|
|
964
1043
|
/**
|
|
965
1044
|
* Delivery-side overflow disclosure: fold the per-task drop counts into the drained payloads. Two
|
|
966
1045
|
* carrier shapes, chosen per survivor:
|