@sema-agent/core 7.63.0 → 7.65.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 +725 -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 +25 -5
- 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/auto-promote.d.ts +3 -2
- package/dist/core/background-agent-store.d.ts +14 -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 +7 -4
- package/dist/core/context-settings.d.ts +39 -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 +37 -2
- package/dist/core/engine-notice.js +3 -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 +30 -2
- package/dist/core/file-history-store.js +48 -9
- package/dist/core/fs-write-gate-policy.js +1 -1
- package/dist/core/gate-fold.js +5 -1
- 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 +8 -4
- package/dist/core/governance-codes.js +8 -3
- package/dist/core/leg-identity.d.ts +35 -1
- package/dist/core/leg-identity.js +10 -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 +13 -6
- package/dist/core/memory-engine/consolidation.js +26 -0
- package/dist/core/memory-engine/control-objects.d.ts +58 -0
- package/dist/core/memory-engine/control-objects.js +273 -0
- package/dist/core/memory-engine/control-plane-adoption.d.ts +51 -0
- package/dist/core/memory-engine/control-plane-adoption.js +161 -0
- package/dist/core/memory-engine/delegation-settlement.d.ts +73 -40
- package/dist/core/memory-engine/delegation-settlement.js +271 -107
- package/dist/core/memory-engine/dual-root.d.ts +3 -2
- package/dist/core/memory-engine/dual-root.js +7 -3
- package/dist/core/memory-engine/engine.d.ts +54 -33
- package/dist/core/memory-engine/engine.js +150 -157
- package/dist/core/memory-engine/file-backend.d.ts +58 -76
- package/dist/core/memory-engine/file-backend.js +111 -268
- 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 +135 -50
- package/dist/core/memory-engine/layout.js +214 -89
- package/dist/core/memory-engine/memory-age.d.ts +12 -0
- package/dist/core/memory-engine/memory-age.js +17 -0
- package/dist/core/memory-engine/memory-backend-contract.d.ts +10 -3
- package/dist/core/memory-engine/memory-backend-contract.js +159 -2
- package/dist/core/memory-engine/memory-deployment.d.ts +12 -4
- 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 +64 -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/tools.d.ts +2 -2
- package/dist/core/memory-engine/tools.js +7 -7
- package/dist/core/memory-engine/types.d.ts +55 -12
- package/dist/core/memory-engine/types.js +2 -1
- package/dist/core/memory-vector.d.ts +6 -14
- package/dist/core/memory.d.ts +0 -462
- package/dist/core/memory.js +0 -333
- 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 +64 -22
- package/dist/core/permission-rule-consent.js +106 -58
- package/dist/core/permission-rule-store.d.ts +56 -21
- 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 +175 -10
- package/dist/core/retention.js +44 -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 +10 -2
- 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 +28 -9
- package/dist/core/runner/delegation-owner.d.ts +2 -3
- package/dist/core/runner/delegation-owner.js +2 -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 +8 -0
- package/dist/core/runner/prepare-gate-stations.js +15 -7
- 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-engine-session.js +1 -1
- package/dist/core/runner/prepare-memory.d.ts +4 -0
- package/dist/core/runner/prepare-memory.js +22 -28
- package/dist/core/runner/prepare-policy-chain.js +18 -10
- package/dist/core/runner/prepare-prompt-inputs.js +1 -1
- package/dist/core/runner/prepare-task.d.ts +5 -1
- package/dist/core/runner/prepare-task.js +16 -11
- 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 +23 -23
- 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/sub-agent-deny-lists.d.ts +19 -0
- package/dist/core/runner/sub-agent-deny-lists.js +25 -0
- 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/secret-env.d.ts +2 -2
- package/dist/core/secret-env.js +6 -20
- package/dist/core/session-checkout.d.ts +63 -3
- package/dist/core/session-checkout.js +152 -58
- package/dist/core/session-store.d.ts +6 -6
- package/dist/core/session-store.js +3 -3
- package/dist/core/shell-read-silence.js +8 -0
- package/dist/core/store-contracts/background-agent-store-contract.js +13 -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 +137 -31
- package/dist/core/task-notification.js +198 -100
- package/dist/core/task-registry-agent.d.ts +11 -0
- package/dist/core/task-registry-agent.js +12 -3
- package/dist/core/task-registry-shared.d.ts +11 -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 +17 -9
- 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 +10 -6
- 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/core/write-protect.d.ts +16 -0
- package/dist/core/write-protect.js +10 -0
- package/dist/engine/compaction/compaction.d.ts +2 -1
- package/dist/engine/harness/types.d.ts +1 -0
- package/dist/engine/session/repo-utils.d.ts +14 -4
- package/dist/engine/session/repo-utils.js +5 -4
- package/dist/engine/session/session.d.ts +7 -1
- package/dist/engine/session/session.js +5 -2
- package/dist/index.d.ts +13 -11
- package/dist/index.js +13 -11
- 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/prompts/default.d.ts +1 -2
- package/dist/scenarios/full-body.d.ts +1 -1
- package/dist/stores/file/adoption/adopt.d.ts +1 -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 +12 -16
- package/dist/stores/file/index.js +7 -25
- package/dist/stores/file/permission-rule-store.d.ts +34 -0
- package/dist/stores/file/permission-rule-store.js +104 -9
- package/dist/stores/file/session-store.js +1 -1
- 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 +71 -73
- package/wire-changes/core-stores-sql@7.64.0.json +30 -0
- package/wire-changes/core-stores-sql@7.65.0.json +30 -0
- package/wire-changes/core@7.64.0.json +2653 -0
- package/wire-changes/core@7.65.0.json +1650 -0
- package/wire-changes/mods-kernel@7.64.0.json +30 -0
- package/wire-changes/mods-kernel@7.65.0.json +30 -0
- package/wire-changes/primitives@7.64.0.json +30 -0
- package/wire-changes/primitives@7.65.0.json +337 -0
- package/dist/core/memory-recall.d.ts +0 -208
- package/dist/core/memory-recall.js +0 -136
- package/dist/stores/file/memory-store.d.ts +0 -124
- package/dist/stores/file/memory-store.js +0 -353
|
@@ -871,10 +871,12 @@ export type TaskEvent = ({
|
|
|
871
871
|
* - `"blocked"` — a `preCompact` hook deliberately blocked the pass.
|
|
872
872
|
* - `"suppressed"` — wanted to fire, held under the §25.2 anti-thrash floor.
|
|
873
873
|
* - `"noop"` — the pass ran but found nothing to compact (no valid cut point/empty history).
|
|
874
|
-
* - `"disabled"` —
|
|
875
|
-
* or the rapid-refill breaker disabled compaction mid-task (`reason` says
|
|
876
|
-
*
|
|
877
|
-
*
|
|
874
|
+
* - `"disabled"` — a requested pass (`trigger:"manual"`) was refused because the `manualCompact`
|
|
875
|
+
* seat is off, or the rapid-refill breaker disabled compaction mid-task (`reason` says so; the
|
|
876
|
+
* trigger is the landing pass's). The `trigger` names the seat: a `"manual"` frame is the
|
|
877
|
+
* `manualCompact` seat's, never the `autoCompact` seat's. A seat that is statically off does NOT
|
|
878
|
+
* produce one of these per boundary for the passes the engine would start (that would be
|
|
879
|
+
* per-boundary noise about a static configuration, not a state change).
|
|
878
880
|
* - `"mooted"` — the pass did not run to its end: a manual request no boundary could serve
|
|
879
881
|
* (`trigger:"manual"`, `reason:"task_ending"`), or a request withdrawn / a pass cut in flight by its
|
|
880
882
|
* caller — a `compact({ signal })` withdrawal, `halt()`, `interrupt()`, `destroy()` or the task's own
|
|
@@ -1392,6 +1394,8 @@ export interface HumanInputAttachment {
|
|
|
1392
1394
|
* durable suspend / plan review in flight), or the task settled before any boundary arrived.
|
|
1393
1395
|
* - `"noop"` — the attempt ran but there was nothing to compact (no valid cut point / empty history).
|
|
1394
1396
|
* - `"blocked"` — a `preCompact` hook deliberately blocked this compaction (not a failure).
|
|
1395
|
-
* - `"disabled"` — compaction is
|
|
1397
|
+
* - `"disabled"` — requested compaction is switched off: the `manualCompact` seat is `false` (the task's
|
|
1398
|
+
* `compaction.manualCompact`, else the deployment's `contextSettings[word].manualCompact`). No pass ran. The
|
|
1399
|
+
* `autoCompact` seat never answers a request: with it off a requested pass still runs.
|
|
1396
1400
|
*/
|
|
1397
1401
|
export type CompactOutcome = "compacted" | "failed" | "mooted" | "noop" | "blocked" | "disabled";
|
|
@@ -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,53 @@ 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
|
+
/** The words {@link DiscardedDeliveryPath} is made of, as a value (#3505): the closed set a host reads off
|
|
527
|
+
* `delegation.delivery_discarded`'s `detail.path` against, so it does not copy the four words by hand. Root-exported. */
|
|
528
|
+
export declare const DISCARDED_DELIVERY_PATHS: readonly ["live", "box", "drain", "notice"];
|
|
529
|
+
/** Which seat a delivery addressed to an earlier occupant of a session would have reached under the occupant the session
|
|
530
|
+
* holds now: for a frame, that occupant's live run, its durable box, or its next run's turn-open drain; for a delegated leg's
|
|
531
|
+
* user-face notice addressed to its tree's root, the notice sink that routes it to the root session (`notice`). Derived from
|
|
532
|
+
* {@link DISCARDED_DELIVERY_PATHS}, so the type and the value are one set. */
|
|
533
|
+
export type DiscardedDeliveryPath = (typeof DISCARDED_DELIVERY_PATHS)[number];
|
|
534
|
+
/** What a discarded delivery was, by name only: a frame's task (its id and type), or a delegated leg's user-face notice (the
|
|
535
|
+
* leg it came from — its agent id, else its session — and the notice's code). */
|
|
536
|
+
export interface DiscardedDelivery {
|
|
537
|
+
readonly taskId: string;
|
|
538
|
+
readonly taskType: string;
|
|
539
|
+
}
|
|
540
|
+
/** The Runner's judge of a delegated leg's notice destination ({@link PendingSessionNotifications.discardsStaleNotice}): `true`
|
|
541
|
+
* = the notice is addressed to an occupant the root no longer holds, and was discarded and announced. */
|
|
542
|
+
export type NoticeDestinationJudge = (destination: SessionAddress, delivery: DiscardedDelivery) => boolean;
|
|
543
|
+
/** A frame's name as a discarded delivery: its task id and type, nothing of its text. */
|
|
544
|
+
export declare function frameDelivery(payload: TaskNotificationPayload): DiscardedDelivery;
|
|
545
|
+
/**
|
|
546
|
+
* The account of a delivery discarded because its address names an occupant the session no longer holds — the one mint of
|
|
547
|
+
* `delegation.delivery_discarded`. Counts and words only: the delivery's text (a child's summary, a peer's words, a notice's
|
|
548
|
+
* sentence) never rides it, nor either occupant token (only whether each side had one).
|
|
549
|
+
*/
|
|
550
|
+
export declare function deliveryDiscardedNotice(address: Pick<SessionAddress, "sessionId" | "occupant">, current: string | undefined, delivery: DiscardedDelivery, path: DiscardedDeliveryPath): EngineNotice;
|
|
503
551
|
/**
|
|
504
552
|
* A session's DURABLE box, bound to the park seat by the leg that mounts its session-box drain — one
|
|
505
553
|
* mint (the drain mount judgment), two readers (the drain and {@link routeOrParkNotification}), so
|
|
@@ -597,9 +645,9 @@ export type EngineFrameDecode = {
|
|
|
597
645
|
* writer must never have encoded is dropped rather than trusted. */
|
|
598
646
|
export declare function decodeEngineFrame(content: string): EngineFrameDecode;
|
|
599
647
|
/** 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,
|
|
648
|
+
* the box owner as `fromRoot` (the park seat's own fact, as for a peer-words record) and with the occupant the frame is
|
|
649
|
+
* addressed to (`occupant`, when the address has one); no hop chain — it is not a peer message and is never admitted as one. */
|
|
650
|
+
export declare function engineFrameRecordOf(payload: TaskNotificationPayload, priority: SystemInjectionPriority, to: Pick<SessionAddress, "sessionId" | "occupant">): MailboxAppendMessage;
|
|
603
651
|
/**
|
|
604
652
|
* RB-375 A2 (ruled 2026-08-03) — is this frame the TERMINAL of a delegated background agent?
|
|
605
653
|
*
|
|
@@ -809,20 +857,26 @@ export declare function createLiveNotificationLane(seat: {
|
|
|
809
857
|
* run" — and every lane is tried once, so a lane that has stopped, or that has already handed this very
|
|
810
858
|
* frame away, is passed over rather than swallowing it. A lane that refused a frame therefore cannot be
|
|
811
859
|
* reached by it again, which is what makes a route of any length terminate on the parked store.
|
|
860
|
+
*
|
|
861
|
+
* A lane sits under its run's {@link SessionAddress}: a frame is offered only to the lanes of the occupant it is
|
|
862
|
+
* addressed to ({@link sameOccupant}). A run of another occupant of the same id — the id deleted and created again,
|
|
863
|
+
* by another principal or the same one — is never a destination for it.
|
|
812
864
|
*/
|
|
813
865
|
export declare class SessionLiveNotificationLanes {
|
|
814
866
|
private readonly lanes;
|
|
815
|
-
register(
|
|
867
|
+
register(address: SessionAddress, lane: LiveNotificationLane): void;
|
|
816
868
|
/** Idempotent (a lane withdraws at its stop AND again at its outermost teardown). The key is dropped
|
|
817
869
|
* with its last lane so an idle process holds no per-session entry. */
|
|
818
|
-
unregister(
|
|
870
|
+
unregister(address: SessionAddress, lane: LiveNotificationLane): void;
|
|
819
871
|
/**
|
|
820
|
-
* Offer the payload to the
|
|
872
|
+
* Offer the payload to the addressed occupant's live lanes, newest first. The caller's OWN lane is not
|
|
821
873
|
* special-cased: a lane that just refused this frame reports `"unavailable"` for it from then on.
|
|
822
874
|
*/
|
|
823
|
-
deliver(
|
|
875
|
+
deliver(address: SessionAddress, payload: TaskNotificationPayload, priority: SystemInjectionPriority, opts?: {
|
|
824
876
|
onDisposition?: (d: NotificationDisposition) => void;
|
|
825
877
|
}): "taken" | "pending" | "duplicate" | "unavailable";
|
|
878
|
+
/** Does the addressed occupant hold a live lane here? */
|
|
879
|
+
holds(address: SessionAddress): boolean;
|
|
826
880
|
/** Sessions holding at least one live lane (observability + the tests' rollback detector). */
|
|
827
881
|
get size(): number;
|
|
828
882
|
}
|
|
@@ -836,12 +890,26 @@ export interface SessionBoxDebt {
|
|
|
836
890
|
readonly box: SessionBoxBinding;
|
|
837
891
|
readonly record: MailboxAppendMessage;
|
|
838
892
|
}
|
|
893
|
+
/**
|
|
894
|
+
* Where a notification addressed to a session goes ({@link SessionAddress}): its live lanes, its durable box, its parked
|
|
895
|
+
* records — every seat held for ONE occupant of the session id. The session's CURRENT occupant is the one its latest leg in
|
|
896
|
+
* this process acquired ({@link admit}): an acquire answers the row as it stands, a row created again under the id is
|
|
897
|
+
* another occupant, and an occupant once replaced never stands again. So from an admission on, whatever is addressed to,
|
|
898
|
+
* or kept for, another occupant of that id is discarded — announced `delegation.delivery_discarded` (operator), never
|
|
899
|
+
* delivered and never silent. A session no leg of which was admitted here (or whose seat aged out of the bound) has no
|
|
900
|
+
* current occupant on record: its frames park under their own address and are judged by the leg that drains them.
|
|
901
|
+
*/
|
|
839
902
|
export declare class PendingSessionNotifications {
|
|
840
903
|
private readonly sessions;
|
|
904
|
+
/** Where a discard is announced: the deployment's notice sink, read when the discard happens (absent ⇒ the process default seat). */
|
|
905
|
+
private readonly noticeSeat;
|
|
906
|
+
constructor(seats?: {
|
|
907
|
+
readonly onNotice?: () => ((notice: EngineNotice) => void) | undefined;
|
|
908
|
+
});
|
|
841
909
|
/**
|
|
842
910
|
* The LIVE half of the same question this store answers. Together they are one seat — "where does a
|
|
843
911
|
* 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
|
|
912
|
+
* one, this parked queue when it does not. One object, one lifetime, one key (the session address).
|
|
845
913
|
*/
|
|
846
914
|
readonly liveLanes: SessionLiveNotificationLanes;
|
|
847
915
|
/** Whole sessions evicted by {@link MAX_PENDING_SESSIONS} (their pendings were never delivered). */
|
|
@@ -859,16 +927,46 @@ export declare class PendingSessionNotifications {
|
|
|
859
927
|
/** Whole-session losses whose tombstone was itself evicted — the count survives, the attribution
|
|
860
928
|
* does not. Surfaced on the next session-level disclosure so it is never simply forgotten. */
|
|
861
929
|
private unattributedDrops;
|
|
862
|
-
/**
|
|
863
|
-
private readonly
|
|
930
|
+
/** Each session's current occupant and its durable park backend ({@link SessionBoxBinding}); insertion-ordered, bounded. */
|
|
931
|
+
private readonly seats;
|
|
932
|
+
/**
|
|
933
|
+
* A leg of the session has acquired its row as `address.occupant` — its current occupant from now on — and binds (or, with
|
|
934
|
+
* `undefined`, unbinds) the session's durable box. Written at EVERY drain mount of a session's leg, so the binding tracks the
|
|
935
|
+
* deployment's current seats (a mailbox swapped out unbinds at the next mount); a re-admission refreshes the entry's LRU
|
|
936
|
+
* position. What this store still keeps for another occupant of the id — parked frames, their tombstone, their delivered and
|
|
937
|
+
* durable keys — is addressed to a row that will never stand again: the frames are discarded, each announced.
|
|
938
|
+
* A leg that could not read its occupant (`address.unread`) is no admission: the current occupant on record and what is kept
|
|
939
|
+
* 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,
|
|
940
|
+
* so a parked record is always judged against the occupant that parked it, never against whichever frame arrives next.
|
|
941
|
+
*/
|
|
942
|
+
admit(address: SessionAddress, box: SessionBoxBinding | undefined): void;
|
|
943
|
+
/** The addressed occupant's durable box: the one its own leg in this process bound, never another occupant's. */
|
|
944
|
+
sessionBoxFor(address: SessionAddress): SessionBoxBinding | undefined;
|
|
945
|
+
/**
|
|
946
|
+
* Is `address` an earlier occupant of a session whose current occupant is another? Then the frame is discarded here —
|
|
947
|
+
* announced with the seat it would have reached under the current occupant — and the answer is `true`: nothing routes,
|
|
948
|
+
* parks or folds it. `false` for the current occupant, and for a session with no current occupant on record. An unread
|
|
949
|
+
* address (a leg that could not read its occupant) is nobody's: its frames are discarded the same way, whatever the seat.
|
|
950
|
+
*/
|
|
951
|
+
discardsStale(address: SessionAddress, payload: TaskNotificationPayload): boolean;
|
|
864
952
|
/**
|
|
865
|
-
*
|
|
866
|
-
*
|
|
867
|
-
*
|
|
953
|
+
* The same question for a delegated leg's user-face notice, addressed to its tree's root: is `destination` (the root's id
|
|
954
|
+
* and the occupant the tree was born under) an earlier occupant of a session whose current occupant is another? Then the
|
|
955
|
+
* notice is discarded — announced with path `notice` — and the answer is `true`: the leg delivers nothing. `false` for the
|
|
956
|
+
* current occupant, and for a root no leg of which this process admitted. A notice cannot wait for the root's next leg
|
|
957
|
+
* the way a frame parks, so a root that was created again but not yet admitted here is not known to be another occupant.
|
|
868
958
|
*/
|
|
869
|
-
|
|
870
|
-
/** The
|
|
871
|
-
|
|
959
|
+
discardsStaleNotice(destination: SessionAddress, delivery: DiscardedDelivery): boolean;
|
|
960
|
+
/** The one judgement both discards read: `undefined` when `address` is the session's current occupant, or the session has
|
|
961
|
+
* none on record; else the seat it was judged against (absent for an unread address on a session with no seat). */
|
|
962
|
+
private staleAgainst;
|
|
963
|
+
/** The one place a discarded delivery is announced. */
|
|
964
|
+
private announceDiscard;
|
|
965
|
+
/** Discard a record parked for an occupant the session no longer holds: every frame in it is announced; the record's own
|
|
966
|
+
* bookkeeping (its eviction counts, its box debts) belongs to that occupant and goes with it. */
|
|
967
|
+
private discardRecord;
|
|
968
|
+
/** The session's record when it is parked for the addressed occupant. */
|
|
969
|
+
private recordOf;
|
|
872
970
|
/**
|
|
873
971
|
* Settle what the session's pending copies owe their boxes ({@link SessionBoxDebt}): each is asked of its own box once
|
|
874
972
|
* more, under its record, in pend order. A box that answers took the record — it holds it, or received it already —
|
|
@@ -879,17 +977,22 @@ export declare class PendingSessionNotifications {
|
|
|
879
977
|
* unasked, stays owed — and a copy that owes its box is never drained ({@link drain} keeps it back) — until a later
|
|
880
978
|
* leg's settlement asks.
|
|
881
979
|
*/
|
|
882
|
-
settleBoxDebts(
|
|
980
|
+
settleBoxDebts(address: SessionAddress, signal?: AbortSignal): Promise<void> | undefined;
|
|
883
981
|
/** 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. */
|
|
982
|
+
* into the store as the session's record (with their occupant, keys, tiers and debts) for the leg that settles them. */
|
|
885
983
|
private keepBackOwing;
|
|
886
984
|
private settleBoxDebt;
|
|
887
|
-
|
|
985
|
+
/** Park a frame for the addressed occupant's next run. A frame addressed to an occupant the session no longer holds is
|
|
986
|
+
* discarded ({@link discardsStale}); a record kept for another occupant of an id no leg of which this process admitted (a
|
|
987
|
+
* record-holding seat is never aged out) names one of the two only — the newer arrival's record replaces it, its frames
|
|
988
|
+
* announced as discarded. `true` = the frame is
|
|
989
|
+
* parked for the address (a repeat of a parked key folds into it); `false` = discarded. */
|
|
990
|
+
pend(address: SessionAddress, n: TaskNotificationPayload, priority?: SystemInjectionPriority, debt?: SessionBoxDebt): boolean;
|
|
888
991
|
/** Remove and return the session's pendings (one-shot — the next run consumes them exactly once); a copy that
|
|
889
992
|
* still owes its box stays parked for the leg that settles it ({@link settleBoxDebts}).
|
|
890
993
|
* design/373 §3.5: the batch comes out PRIORITY-MAJOR (stable sort — pend order within a class;
|
|
891
994
|
* a no-priority record ranks as later), the idle-dequeue min-value-first form. */
|
|
892
|
-
drain(
|
|
995
|
+
drain(address: SessionAddress): DrainedPendingNotifications | undefined;
|
|
893
996
|
/**
|
|
894
997
|
* Keys a live lane of this session has already put in front of a model (the delivered half of the
|
|
895
998
|
* ledger below). Kept beside the parked keys because the WINDOW is the session's, not any one run's:
|
|
@@ -899,23 +1002,23 @@ export declare class PendingSessionNotifications {
|
|
|
899
1002
|
*/
|
|
900
1003
|
private readonly routed;
|
|
901
1004
|
/**
|
|
902
|
-
* Does this session ALREADY own this exact frame — parked, or routed onto a live lane? Only one of
|
|
1005
|
+
* Does this session's addressed occupant ALREADY own this exact frame — parked, or routed onto a live lane? Only one of
|
|
903
1006
|
* the two may hold a key: a producer retrying a frame the session has already taken must FOLD rather
|
|
904
1007
|
* 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.
|
|
1008
|
+
* next drain. Callers ask BEFORE routing and BEFORE parking. Another occupant's keys answer nothing here.
|
|
906
1009
|
*/
|
|
907
|
-
holdsKey(
|
|
1010
|
+
holdsKey(address: SessionAddress, dedupKey: string): boolean;
|
|
908
1011
|
/** Keys the session's DURABLE box took ({@link routeOrParkNotification}'s durable arm) — the third holder
|
|
909
1012
|
* {@link holdsKey} consults, so a retry of a frame the box already holds folds exactly as one the
|
|
910
1013
|
* in-process store holds. Bounded like {@link routed}; a key is released when the append faulted and
|
|
911
1014
|
* the frame took the in-process park instead (that store then owns it). */
|
|
912
1015
|
private readonly durable;
|
|
913
|
-
noteDurablePark(
|
|
914
|
-
forgetDurablePark(
|
|
915
|
-
/** Record that this session has DELIVERED this frame — see {@link routed}. Written at ONE place, the
|
|
1016
|
+
noteDurablePark(address: SessionAddress, dedupKey: string): void;
|
|
1017
|
+
forgetDurablePark(address: SessionAddress, dedupKey: string): void;
|
|
1018
|
+
/** Record that this session's addressed occupant has DELIVERED this frame — see {@link routed}. Written at ONE place, the
|
|
916
1019
|
* harness's consumption sink (the step where a queued frame enters the model's input), so the record
|
|
917
1020
|
* can never run ahead of the delivery it claims. */
|
|
918
|
-
markDelivered(
|
|
1021
|
+
markDelivered(address: SessionAddress, dedupKey: string): void;
|
|
919
1022
|
get size(): number;
|
|
920
1023
|
}
|
|
921
1024
|
/**
|
|
@@ -946,8 +1049,11 @@ export declare class DurableAppendObligations {
|
|
|
946
1049
|
* then, so only the lane that actually delivers writes ownership
|
|
947
1050
|
* ({@link LiveNotificationLaneSeat.markDelivered});
|
|
948
1051
|
* · nothing can take it ⇒ park, carrying the tier, for the session's next run.
|
|
1052
|
+
* The address names the session's occupant ({@link SessionAddress}): every one of the three is that occupant's — its keys,
|
|
1053
|
+
* its live lanes, its box, its record — and a frame addressed to an occupant the session no longer holds is discarded
|
|
1054
|
+
* before any of them ({@link PendingSessionNotifications.discardsStale}); its receipt says `"refused"`.
|
|
949
1055
|
*/
|
|
950
|
-
export declare function routeOrParkNotification(store: PendingSessionNotifications,
|
|
1056
|
+
export declare function routeOrParkNotification(store: PendingSessionNotifications, address: SessionAddress, payload: TaskNotificationPayload, priority: SystemInjectionPriority, onDisposition?: (d: NotificationDisposition) => void): void;
|
|
951
1057
|
/**
|
|
952
1058
|
* The durable form of a parked peer-words frame: the SAME `peer_message` record the cross-session lane
|
|
953
1059
|
* appends (the recipient's drain renders it through the one envelope and judges it through the one
|
|
@@ -960,7 +1066,7 @@ export declare function sessionBoxRecordOf(payload: TaskNotificationPayload & {
|
|
|
960
1066
|
from: string;
|
|
961
1067
|
body: string;
|
|
962
1068
|
};
|
|
963
|
-
},
|
|
1069
|
+
}, to: Pick<SessionAddress, "sessionId" | "occupant">): MailboxAppendMessage;
|
|
964
1070
|
/**
|
|
965
1071
|
* Delivery-side overflow disclosure: fold the per-task drop counts into the drained payloads. Two
|
|
966
1072
|
* carrier shapes, chosen per survivor:
|