@sema-agent/core 5.34.0 → 5.35.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.
@@ -13,6 +13,26 @@ export const APPROVAL_SETTLED_BY_VALUES = ["human", "timeout", "aborted"];
13
13
  export function isApprovalSettledBy(v) {
14
14
  return typeof v === "string" && APPROVAL_SETTLED_BY_VALUES.includes(v);
15
15
  }
16
+ export const APPROVER_ATTRIBUTION_MAX_CHARS = 256;
17
+ const APPROVER_REFUSED_CHARS_RE = /[\u0000-\u001f\u007f-\u009f\u061c\u200e\u200f\u2028\u2029\u202a-\u202e\u2066-\u2069]/u;
18
+ export function screenApproverAttribution(v) {
19
+ if (v === undefined || v === "")
20
+ return {};
21
+ if (typeof v !== "string") {
22
+ return { defect: `an approver attribution must be a plain string (got ${v === null ? "null" : typeof v})` };
23
+ }
24
+ if (v.length > 2 * APPROVER_ATTRIBUTION_MAX_CHARS || [...v].length > APPROVER_ATTRIBUTION_MAX_CHARS) {
25
+ return { defect: `an approver attribution is capped at ${APPROVER_ATTRIBUTION_MAX_CHARS} characters and this one is longer; it is refused rather than truncated, because a cut identifier names someone else` };
26
+ }
27
+ if (/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/.test(v)) {
28
+ return { defect: "an approver attribution contains an unpaired surrogate; it is not well-formed text and would collapse to a replacement character in a UTF-8 sink, so two distinct approvers could converge into one record" };
29
+ }
30
+ if (APPROVER_REFUSED_CHARS_RE.test(v)) {
31
+ return { defect: "an approver attribution carries control characters, line separators or bidirectional overrides; an identifier whose bytes can forge a line — or reorder what a reader sees — in whatever renders it is refused" };
32
+ }
33
+ return { approver: v };
34
+ }
35
+ export const ASK_EVIDENCE_ABSENCE_VALUES = ["not_wired", "not_adjudicated", "unavailable", "no_match", "not_reported"];
16
36
  export function decisionText(d) {
17
37
  return d.message;
18
38
  }
@@ -899,10 +919,12 @@ export async function resolveAsk(req, onAsk, signal) {
899
919
  let supplied;
900
920
  let allowed;
901
921
  let suppliedEdit;
922
+ let suppliedApprover;
902
923
  try {
903
924
  supplied = ok.settledBy;
904
925
  allowed = ok.allow;
905
926
  suppliedEdit = ok.updatedInput;
927
+ suppliedApprover = ok.approver;
906
928
  }
907
929
  catch (err) {
908
930
  return {
@@ -930,6 +952,16 @@ export async function resolveAsk(req, onAsk, signal) {
930
952
  settledBy: "aborted",
931
953
  };
932
954
  }
955
+ const attribution = screenApproverAttribution(suppliedApprover);
956
+ if (attribution.defect !== undefined) {
957
+ return {
958
+ action: "deny",
959
+ message: `the approver for "${req.toolName}" reported an attribution this seam refuses: ${attribution.defect}; denied fail-closed`,
960
+ decisionReason: "mode",
961
+ settledBy: "aborted",
962
+ };
963
+ }
964
+ const attributionCell = attribution.approver !== undefined ? { approver: attribution.approver } : {};
933
965
  if (supplied === "timeout" && allowed === true) {
934
966
  return {
935
967
  action: "deny",
@@ -969,10 +1001,11 @@ export async function resolveAsk(req, onAsk, signal) {
969
1001
  : humanRefusalMessage(req, reasonText),
970
1002
  decisionReason: "mode",
971
1003
  settledBy: supplied === "timeout" ? "timeout" : "human",
1004
+ ...attributionCell,
972
1005
  };
973
1006
  }
974
1007
  if (suppliedEdit === undefined)
975
- return { action: "allow", decisionReason: "mode", presentedInput: presented.value, settledBy: "human" };
1008
+ return { action: "allow", decisionReason: "mode", presentedInput: presented.value, settledBy: "human", ...attributionCell };
976
1009
  const edit = tryCloneArgs(suppliedEdit);
977
1010
  if (!edit.ok) {
978
1011
  return {
@@ -982,7 +1015,7 @@ export async function resolveAsk(req, onAsk, signal) {
982
1015
  settledBy: "aborted",
983
1016
  };
984
1017
  }
985
- return { action: "allow", updatedInput: edit.value, decisionReason: "mode", settledBy: "human" };
1018
+ return { action: "allow", updatedInput: edit.value, decisionReason: "mode", settledBy: "human", ...attributionCell };
986
1019
  }
987
1020
  const okRaw = ok;
988
1021
  if (okRaw === true)
@@ -3437,6 +3437,26 @@ export type TaskEvent = ({
3437
3437
  * must not treat "absent" as "a human decided".
3438
3438
  */
3439
3439
  settledBy?: import("./tool-policy.js").ApprovalSettledBy;
3440
+ /**
3441
+ * design/252 G-7 — WHOSE settlement that was: the identifier the approval channel reported for
3442
+ * the party that ended this wait, beside the {@link settledBy} word that says what KIND of end
3443
+ * it was. The two are read together and neither substitutes for the other:
3444
+ * `settledBy:"timeout"` with an `approver` names the queue whose window elapsed, NOT someone
3445
+ * who refused.
3446
+ *
3447
+ * WHAT CORE PROMISES ABOUT IT — exactly one thing: it is what the settling caller said, screened
3448
+ * for shape (a plain string, bounded, no control characters) and otherwise untouched. Core does
3449
+ * NOT authenticate it, does not compare it to a principal, and never reads it back to decide
3450
+ * anything. Identity is established by the approval channel a deployment integrates (its card,
3451
+ * its signature, its console); this is the transcription that lets an audit which already knows
3452
+ * a person ended a wait also say which person, without the engine growing an identity surface it
3453
+ * deliberately does not have. Treat it accordingly: it is a RECORD of a claim, and its
3454
+ * trustworthiness is exactly the trustworthiness of the channel that made it.
3455
+ *
3456
+ * ABSENT on every frame that settled no approval, and on a settled approval whose channel named
3457
+ * nobody. Absence means nobody SAID — never "nobody approved this", and never "a human did".
3458
+ */
3459
+ approver?: string;
3440
3460
  /**
3441
3461
  * design/99 §E1 — `true` when {@link output} was SIZE-bounded by core (the full body exceeded the cap and
3442
3462
  * was degraded to a truncated string). Lets a consumer detect truncation programmatically instead of
@@ -3876,8 +3896,12 @@ export interface TaskStream extends AsyncIterable<TaskEvent> {
3876
3896
  /**
3877
3897
  * Inject a mid-task **steering** message (design/47) that the running task sees at the start of its
3878
3898
  * next turn (delivered via the harness steering queue). Resolves once queued; **throws** (code
3879
- * `steering.not_running`) if the task hasn't started yet or has already finished — never silently
3880
- * dropped. By default the text enters as a normal **user** message (in an orchestration the caller IS
3899
+ * `steering.not_running`) once the task has finished (teardown included) — never silently dropped. A
3900
+ * steer issued BEFORE the run has ISSUED ITS FIRST PROMPT is not refused: it is HELD for the birth
3901
+ * window and enters the queue as soon as the loop goes live, so the model sees it at the next turn
3902
+ * boundary like any other steer — it is refused if the loop ends first, or if that BOUNDED wait runs
3903
+ * out while the run still has not started (ruled 2026-08-05; a retry under the same `inputId` is then
3904
+ * clean — a refusal reserves nothing). By default the text enters as a normal **user** message (in an orchestration the caller IS
3881
3905
  * the task's user). Pass `trusted: true` ONLY for operator/system-level guidance: it is wrapped as a
3882
3906
  * `<system-reminder>` (elevated authority) — do NOT use it for caller/third-party content that could
3883
3907
  * carry a prompt injection. The seam gives the channel; the caller owns the judgement (design/43 §6).
@@ -3885,10 +3909,55 @@ export interface TaskStream extends AsyncIterable<TaskEvent> {
3885
3909
  * design/171 §5.2 — `actor` attributes WHO steered (a shared session's second voice): the text gets
3886
3910
  * the speaker envelope from the single projection point and the queued message carries the
3887
3911
  * metadata seat. Attribution only, never authority; absent = anonymous (bytes unchanged).
3912
+ *
3913
+ * design/171 §6.3 (additive) — `inputId` is the caller's correlation/idempotency key, the SAME key
3914
+ * space as the parked queue's `PendingSteerEntry.inputId` and the `human_input` event's `inputId`
3915
+ * (an ingress that already minted a message id passes it here, and the emitted frame carries it
3916
+ * VERBATIM instead of a fresh uuidv7). It exists because the two legs of one steering ingress must be
3917
+ * equally replay-safe: the parked leg has taken this key since the queue landed, so a retried request
3918
+ * that arrives while the task is LIVE was the only one that injected twice.
3919
+ * - **Absent ⇒ nothing changes**: a uuidv7 is minted for the event, nothing is recorded for the call,
3920
+ * and the delivered bytes are what they always were. Every pre-existing caller is on this arm.
3921
+ * - **Replay ⇒ idempotent no-op**: re-steering an id this stream already ACCEPTED, with an identical
3922
+ * payload (same text, same `trusted`, same `actor`), injects nothing and emits no second
3923
+ * `human_input` frame. What is remembered is exactly what QUEUED: a delivery that was refused
3924
+ * (not running) can be retried under its own id, and a call whose DELIVERED payload is
3925
+ * whitespace-only — which the harness discards without minting a frame; note a `trusted` steer is
3926
+ * wrapped first, so it queues even for blank text — reserves nothing, leaving that id usable.
3927
+ * - **Same id, DIFFERENT instruction ⇒ typed throw** `steering.duplicate_input_id`: a key is not
3928
+ * evidence of a replay, and two callers colliding on one id must not silently lose the second
3929
+ * (the parked leg's `appendPendingSteer` refuses it identically). Re-issue under a fresh id.
3930
+ * - **Bad value ⇒ typed throw** `steering.invalid_content`, never a silent fallback to "no id": the
3931
+ * value domain is the parked leg's (a non-empty string of at most `MAX_STEER_INPUT_ID_CHARS`
3932
+ * characters, and never the reserved `LEGACY_PENDING_STEER_INPUT_ID`), so one key is accepted or
3933
+ * refused the same way on both legs. Validated before the liveness check, like the parked leg's.
3934
+ * - **Liveness outranks the key**: once the run's loop-liveness latch has flipped (the same signal
3935
+ * the injection path stops polling on) a replay is refused `steering.not_running` like any other
3936
+ * steer, never answered "already accepted" — the parked leg's row CAS answers `false` for a
3937
+ * resolved checkpoint on a replayed id for the same reason. The one asymmetry, stated rather than
3938
+ * papered over: in the sub-window where the harness has gone idle but the latch has not yet
3939
+ * flipped, a FRESH steer polls (and is refused when the latch flips) while a replay answers
3940
+ * immediately with the SAME outcome its original call reported — a key whose answer depended on
3941
+ * microsecond timing would defeat its own purpose. Note what that outcome has always meant on this
3942
+ * verb: ACCEPTED INTO THE QUEUE, not consumed by the model. A steer accepted in the last moments of
3943
+ * a run can be stranded by the run ending before the next boundary drains it (true of every steer,
3944
+ * keyed or not); a caller that needs delivery evidence reads the run's own events, not this receipt.
3945
+ * - **The receipt does NOT distinguish the two**: a fresh accept and a replay both resolve `void`,
3946
+ * exactly as `setPendingSteer` answers `true` for both. The observable difference is on the event
3947
+ * stream (a fresh accept emits the `human_input` frame; a replay emits none), which is also where
3948
+ * the parked leg's difference shows (a replay adds no queue entry, so the resume drains one frame).
3949
+ * - **Honest window** (weaker than the parked leg's, deliberately stated): the live dedup domain is
3950
+ * THIS stream object — one run leg, in this process. It is not persisted, so it does not span a
3951
+ * restart, a replica, or a second `runTaskStream`/`resumeStream` call on the same session; and it
3952
+ * holds only what the LIVE verb accepted, so an id already delivered by the parked leg (drained
3953
+ * into this run's resume prompt) is NOT in it and WOULD inject again. A deployment that needs
3954
+ * cross-leg or cross-process idempotency owns that half (its own key ledger), the same division
3955
+ * of labor `notify`'s park-window dedup states.
3888
3956
  */
3889
3957
  steer(text: string, options?: {
3890
3958
  trusted?: boolean;
3891
3959
  actor?: ActorAssertion;
3960
+ inputId?: string;
3892
3961
  }): Promise<void>;
3893
3962
  /**
3894
3963
  * design/144 §2 — inject an EXTERNAL structured event into this run's task-notification lane, as a
package/dist/index.d.ts CHANGED
@@ -108,6 +108,7 @@ export { RETIRED_TOOL_NAMES } from "./core/tool-name-aliases.js";
108
108
  export { DEFAULT_SUBAGENT_TOOL_NAME } from "./agents/subagent.js";
109
109
  export { renderTaskNotificationXml, taskNotificationDedupKey, isDelegatedAgentTerminal, SystemInjectionQueue, type TaskNotificationPayload, type TaskNotificationStatus, type ExternalNotificationInput, type SystemInjection, type SystemInjectionPriority, } from "./core/task-notification.js";
110
110
  export { describeStaticWiring, deriveWiringManifest, deriveAskEffective, resolveDeclaredDurability, resolveAskSeamForm, resolveQuestionSeam, countElicitOptIns, type WiringManifest, type WiringFacts, type WiringLegKind, type AskSeamForm, type AskEffective, type QuestionChannelState, type SeamProvenance, type ParkLaneReason, type ManifestDurability, type StaticWiringDeps, type StaticWiringSpec, } from "./core/wiring-manifest.js";
111
+ export { probeParkRoundTrip, durableParkGapOf, durableParkGapFor, PARK_SELFCHECK_SCOPE_PREFIX, type ParkSelfCheckResult, type ParkProbeFinding, type ParkProbeFindingCode, } from "./core/park-selfcheck.js";
111
112
  export { type StoreDurability } from "./core/checkpoint-store.js";
112
113
  export { type StoreFidelity } from "./core/checkpoint-store.js";
113
114
  export { projectHumanInput, buildHumanInputEvent, type HumanInputSource, type HumanInputFrame, type HumanInputEvent, type HumanInputDelivery, } from "./core/human-input-projection.js";
@@ -131,7 +132,7 @@ export type { SchedulerCapability, SchedulerErrorCode, ScheduledIntent, Schedule
131
132
  export { createSchedulerTools, type SchedulerToolContext, SCHEDULE_WAKEUP_TOOL_NAME, AUTONOMOUS_LOOP_SENTINEL, AUTONOMOUS_LOOP_DYNAMIC_SENTINEL, } from "./tools/scheduler-tools.js";
132
133
  export { resolveAutonomousLoopPrompt, AUTONOMOUS_LOOP_PREAMBLE, AUTONOMOUS_LOOP_PREAMBLE_PERSISTENT, type AutonomousLoopPromptOptions, } from "./tools/loop-tick.js";
133
134
  export { tightenTaskSpec, TaskSpecTightenError } from "./core/tighten-task-spec.js";
134
- export { createAllowDenyPolicy, createApprovalPolicy, COARSE_SHELL_TOOLS, createCoarseCommandNamePolicy, createTranscriptIntegrityPolicy, createUnverifiableDeletePolicy, findUnverifiableRecursiveDelete, combinePolicies, decisionText, resolveAsk, toolPolicyNameSets, type ToolPolicyNameSets, type NamedToolPolicy, type ToolPolicyProjection, type ToolPolicyProjectionComponent, type ConstraintChainEntry, checkToolPolicyProjection, constraintChainEntryOf, constraintChainDigest, type ToolPolicy, type ToolCallRequest, type PermissionResult, type DecisionReason, type ApprovalSettledBy, APPROVAL_SETTLED_BY_VALUES, isApprovalSettledBy, type OnAsk, type AskOutcome, type ResolvedAsk, type AskRequest, type AskDelegationProvenance, } from "./core/tool-policy.js";
135
+ export { createAllowDenyPolicy, createApprovalPolicy, COARSE_SHELL_TOOLS, createCoarseCommandNamePolicy, createTranscriptIntegrityPolicy, createUnverifiableDeletePolicy, findUnverifiableRecursiveDelete, combinePolicies, decisionText, resolveAsk, toolPolicyNameSets, type ToolPolicyNameSets, type NamedToolPolicy, type ToolPolicyProjection, type ToolPolicyProjectionComponent, type ConstraintChainEntry, checkToolPolicyProjection, constraintChainEntryOf, constraintChainDigest, type ToolPolicy, type ToolCallRequest, type PermissionResult, type DecisionReason, type ApprovalSettledBy, APPROVAL_SETTLED_BY_VALUES, isApprovalSettledBy, screenApproverAttribution, APPROVER_ATTRIBUTION_MAX_CHARS, type OnAsk, type AskOutcome, type ResolvedAsk, type AskRequest, type AskDelegationProvenance, type AskRuleEvidence, type AskEvidenceAbsence, ASK_EVIDENCE_ABSENCE_VALUES, } from "./core/tool-policy.js";
135
136
  export { parseAutoModeResponse, createAutoModeDecider, type AutoModeVerdict, type AutoModeDecider, type AutoModeDeciderOptions, type AutoModeClassifyFn, type AutoModeClassifyInput, } from "./core/auto-mode.js";
136
137
  export { buildAutoModePrompt, renderAutoModeWindow, renderAutoModeAction, AUTO_MODE_DEFAULTS_SENTINEL, type AutoModeRules, type BuildAutoModePromptOptions, type AutoModeWindowOptions, } from "./core/auto-mode-prompt.js";
137
138
  export { AUTO_MODE_BASE_PROMPT, AUTO_MODE_PERMISSIONS_EXTERNAL } from "./core/auto-mode-prompt-assets.js";
@@ -161,7 +162,7 @@ export { FilePermissionRuleStoreProvider } from "./stores/file/permission-rule-s
161
162
  export { adoptFilePermissionRuleStore, type AdoptFileRuleStoreResult } from "./stores/file/permission-rule-adopt.js";
162
163
  export { AdoptionError, assertAdoptionBootGate, readRootAdoptionFile, writeRootAdoptionFile, ROOT_ADOPTION_FILE, type AdoptionErrorCode, type AdoptionSource, type AdoptionReport, type AdoptionReceipt, type AdoptionLegReport, type AffectedDeploymentConfig, type RootAdoptionFile, } from "./stores/file/adoption/marker.js";
163
164
  export { adoptLocalDataRoot, ackAdoptionConfig, witnessAdoptionConfig, listAdoptionQuarantine, readAdoptionStatus, type AdoptionStatus, type AdoptLocalDataRootOptions, type AdoptLocalDataRootResult, type AdoptionCarriageLeg, type AdoptionCarriageLegContext, type AdoptionConfigWitnessReceipt, } from "./stores/file/adoption/adopt.js";
164
- export { formatHookFeedback, runToolGate, createHookEnvCapabilities, createPreToolUseConstraintPolicy, type Hooks, type HookToolContext, type HookEnvCapabilities, type HookToolOutput, type PreToolUseResult, type PostToolUseResult, type UserPromptSubmitResult, type HookToolFailure, type PostToolUseFailureResult, type PostToolBatchCall, type PostToolBatchResult, type PreCompactContext, type PreCompactResult, type PostCompactContext, type StopFailureContext, type PermissionDeniedPayload, type PermissionDeniedSource, } from "./core/hooks.js";
165
+ export { formatHookFeedback, runToolGate, createHookEnvCapabilities, createPreToolUseConstraintPolicy, type PersistedRuleHit, type PersistedRuleUnreadable, type PersistedRuleAnswer, normalizePersistedRuleHit, type Hooks, type HookToolContext, type HookEnvCapabilities, type HookToolOutput, type PreToolUseResult, type PostToolUseResult, type UserPromptSubmitResult, type HookToolFailure, type PostToolUseFailureResult, type PostToolBatchCall, type PostToolBatchResult, type PreCompactContext, type PreCompactResult, type PostCompactContext, type StopFailureContext, type PermissionDeniedPayload, type PermissionDeniedSource, } from "./core/hooks.js";
165
166
  export { InMemoryMemoryStore, composeMemoryBlock, composeLayeredMemoryBlock, normalizeMemorySpec, type NormalizedMemorySpec, type MemorySpecInput, supportsConsolidation, supportsPeriodicConsolidation, firstSentence, expandLexicalTerms, lexicalSearchMatch, type Embedder, classifyPromotable, enforcePromotableWriteGate, guardedMemoryStore, MemoryGateError, detectSecret, enforceSecretWriteGate, enforceStructuredNoteSecretGate, type UtilityGate, type MemoryStore, type MemoryVectorMode, type ScoredMemory, type MemoryNoteHeader, type MemoryNoteRecord, type MemoryNoteType, type StructuredNoteInput, } from "./core/memory.js";
166
167
  export { MemoryEngine, FileMemoryEngineBackend, memoryBackendContract, assertMemoryBackendSearchEquivalence, type MemoryBackendContractHooks, buildMemoryInstruction, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, deriveRepoControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, MEMORY_INSTRUCTION_TEMPLATE, MEMORY_RECALL_DISCIPLINE, MEMORY_PREFERENCE_DISCIPLINE, MEMORY_READONLY_NOTICE, readV2HeaderHints, type V2HeaderHints, LINEAGE_FILE, CHALLENGES_FILE, CHALLENGED_HISTORY_FILE, CHALLENGE_LEDGER_MAX_EVENTS, rebuildStrictControlPlaneLedger, type ControlPlaneRebuildReceipt, type StrictControlPlaneLedger, type ChallengeAssignment, type ChallengeEvent, type ChallengedHistoryRow, type LineagePendingTxn, type LineagePromotion, MEMORY_INDEX_FILENAME, MEMORY_INDEX_MAX_LINES, MEMORY_INDEX_MAX_BYTES, MEMORY_SEARCH_TOOL_NAME, MEMORY_GET_TOOL_NAME, MEMORY_ENGINE_TOOL_NAMES, type MemorySearchDetails, type MemorySearchHit, type MemoryGetDetails, STUB_ARCHIVED_LINE, DEFAULT_MAX_MEMORY_FILES, DEFAULT_MAX_ENTRY_DEPTH, DEFAULT_HARVEST_DEADLINE_MS, DEFAULT_HARVEST_FILE_BUDGET, MASS_DELETION_FUSE_RATIO, scanMemoryWrite, scanMemoryFileName, scanRemediation, MEMORY_FILENAME_SEGMENT_RE, renderAnnouncements, enqueueMemoryAnnouncement, drainMemoryAnnouncements, peekMemoryAnnouncements, bumpScanFuse, scanFuseCount, clearScanFuse, ANNOUNCEMENTS_FILE, MEMORY_ANNOUNCEMENTS_MAX, SCAN_FUSE_FILE, SCAN_FUSE_THRESHOLD, type MemoryAnnouncement, type ScanFinding, type MemoryEngineOptions, type MemoryInjection, type MemoryBackend, type MemoryEntry, type MemoryEntryFrontmatter, type MemoryEntryHeader, type ScoredMemoryEntry, type NotePatch, type PatchReport, type MaterializedFile, type MemorySessionHandle, type HarvestReport, type HarvestRejection, type HarvestRejectionCode, type ParsedEntryFile, type ScannedEntryFile, SCOPE_SEGMENT_MAX_ENCODED, PROJECT_MARKER_PATH, encodeScopeSegment, decodeScopeSegment, parseScopeKey, formatUserScope, formatOrgScope, formatProjScope, formatUserProjScope, isPersonalScope, assertScopeContractPlacement, formatProjectMarker, parseProjectMarker, resolveProjectId, PROJECT_ID_REGEX, type ParsedScopeKey, migrateScope, type MigrateScopeReport, materializeEntriesToFiles, harvestFilesToPatches, projectionsToWriteBack, screenInboundEntries, REMOTE_HARVEST_PER_FILE_BYTES, REMOTE_MASS_DELETION_FUSE_RATIO, type RemoteMemoryFile, type RemoteMemoryBaseline, type RemoteMaterialization, type RemoteHarvestResult, type InboundEntryFinding, deriveProjectMemoryDir, deriveProjectControlDir, recordProjectIdHint, lookupProjectIdHint, PROJECT_ID_HINTS_FILE, reconcileMemoryEntries, nextSyncBaseline, mergeRecallHits, type MemorySyncCursor, type MemorySyncConflict, type MemorySyncPlan, type RecallSource, syncMemoryScope, type MemorySyncTransport, type MemorySyncRequestBody, type MemorySyncResponseBody, type MemorySyncClientConflict, type SyncMemoryScopeOptions, type MemorySyncClientResult, } from "./core/memory-engine/index.js";
167
168
  export { SHARED_MEMORY_READ_CAP_BYTES, SHARED_MEMORY_LIST_PAGE_SIZE, SharedMemoryStoreError, type SharedMemoryStoreProvider, type SharedMemoryStoreReader, type SharedMemoryPagedList, type SharedMemoryStoreInfo, type SharedMemoryDocumentEntry, type SharedMemorySnapshot, type SharedMemoryRequestContext, type MemoryListDetails, type MemoryReadDetails, } from "./core/shared-memory/types.js";
package/dist/index.js CHANGED
@@ -87,6 +87,7 @@ export { RETIRED_TOOL_NAMES } from "./core/tool-name-aliases.js";
87
87
  export { DEFAULT_SUBAGENT_TOOL_NAME } from "./agents/subagent.js";
88
88
  export { renderTaskNotificationXml, taskNotificationDedupKey, isDelegatedAgentTerminal, SystemInjectionQueue, } from "./core/task-notification.js";
89
89
  export { describeStaticWiring, deriveWiringManifest, deriveAskEffective, resolveDeclaredDurability, resolveAskSeamForm, resolveQuestionSeam, countElicitOptIns, } from "./core/wiring-manifest.js";
90
+ export { probeParkRoundTrip, durableParkGapOf, durableParkGapFor, PARK_SELFCHECK_SCOPE_PREFIX, } from "./core/park-selfcheck.js";
90
91
  export {} from "./core/checkpoint-store.js";
91
92
  export {} from "./core/checkpoint-store.js";
92
93
  export { projectHumanInput, buildHumanInputEvent, } from "./core/human-input-projection.js";
@@ -108,7 +109,7 @@ export { hasScheduler, isValidCronExpr, SchedulerError } from "./core/scheduler.
108
109
  export { createSchedulerTools, SCHEDULE_WAKEUP_TOOL_NAME, AUTONOMOUS_LOOP_SENTINEL, AUTONOMOUS_LOOP_DYNAMIC_SENTINEL, } from "./tools/scheduler-tools.js";
109
110
  export { resolveAutonomousLoopPrompt, AUTONOMOUS_LOOP_PREAMBLE, AUTONOMOUS_LOOP_PREAMBLE_PERSISTENT, } from "./tools/loop-tick.js";
110
111
  export { tightenTaskSpec, TaskSpecTightenError } from "./core/tighten-task-spec.js";
111
- export { createAllowDenyPolicy, createApprovalPolicy, COARSE_SHELL_TOOLS, createCoarseCommandNamePolicy, createTranscriptIntegrityPolicy, createUnverifiableDeletePolicy, findUnverifiableRecursiveDelete, combinePolicies, decisionText, resolveAsk, toolPolicyNameSets, checkToolPolicyProjection, constraintChainEntryOf, constraintChainDigest, APPROVAL_SETTLED_BY_VALUES, isApprovalSettledBy, } from "./core/tool-policy.js";
112
+ export { createAllowDenyPolicy, createApprovalPolicy, COARSE_SHELL_TOOLS, createCoarseCommandNamePolicy, createTranscriptIntegrityPolicy, createUnverifiableDeletePolicy, findUnverifiableRecursiveDelete, combinePolicies, decisionText, resolveAsk, toolPolicyNameSets, checkToolPolicyProjection, constraintChainEntryOf, constraintChainDigest, APPROVAL_SETTLED_BY_VALUES, isApprovalSettledBy, screenApproverAttribution, APPROVER_ATTRIBUTION_MAX_CHARS, ASK_EVIDENCE_ABSENCE_VALUES, } from "./core/tool-policy.js";
112
113
  export { parseAutoModeResponse, createAutoModeDecider, } from "./core/auto-mode.js";
113
114
  export { buildAutoModePrompt, renderAutoModeWindow, renderAutoModeAction, AUTO_MODE_DEFAULTS_SENTINEL, } from "./core/auto-mode-prompt.js";
114
115
  export { AUTO_MODE_BASE_PROMPT, AUTO_MODE_PERMISSIONS_EXTERNAL } from "./core/auto-mode-prompt-assets.js";
@@ -123,7 +124,7 @@ export { FilePermissionRuleStoreProvider } from "./stores/file/permission-rule-s
123
124
  export { adoptFilePermissionRuleStore } from "./stores/file/permission-rule-adopt.js";
124
125
  export { AdoptionError, assertAdoptionBootGate, readRootAdoptionFile, writeRootAdoptionFile, ROOT_ADOPTION_FILE, } from "./stores/file/adoption/marker.js";
125
126
  export { adoptLocalDataRoot, ackAdoptionConfig, witnessAdoptionConfig, listAdoptionQuarantine, readAdoptionStatus, } from "./stores/file/adoption/adopt.js";
126
- export { formatHookFeedback, runToolGate, createHookEnvCapabilities, createPreToolUseConstraintPolicy, } from "./core/hooks.js";
127
+ export { formatHookFeedback, runToolGate, createHookEnvCapabilities, createPreToolUseConstraintPolicy, normalizePersistedRuleHit, } from "./core/hooks.js";
127
128
  export { InMemoryMemoryStore, composeMemoryBlock, composeLayeredMemoryBlock, normalizeMemorySpec, supportsConsolidation, supportsPeriodicConsolidation, firstSentence, expandLexicalTerms, lexicalSearchMatch, classifyPromotable, enforcePromotableWriteGate, guardedMemoryStore, MemoryGateError, detectSecret, enforceSecretWriteGate, enforceStructuredNoteSecretGate, } from "./core/memory.js";
128
129
  export { MemoryEngine, FileMemoryEngineBackend, memoryBackendContract, assertMemoryBackendSearchEquivalence, buildMemoryInstruction, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, deriveRepoControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, MEMORY_INSTRUCTION_TEMPLATE, MEMORY_RECALL_DISCIPLINE, MEMORY_PREFERENCE_DISCIPLINE, MEMORY_READONLY_NOTICE, readV2HeaderHints, LINEAGE_FILE, CHALLENGES_FILE, CHALLENGED_HISTORY_FILE, CHALLENGE_LEDGER_MAX_EVENTS, rebuildStrictControlPlaneLedger, MEMORY_INDEX_FILENAME, MEMORY_INDEX_MAX_LINES, MEMORY_INDEX_MAX_BYTES, MEMORY_SEARCH_TOOL_NAME, MEMORY_GET_TOOL_NAME, MEMORY_ENGINE_TOOL_NAMES, STUB_ARCHIVED_LINE, DEFAULT_MAX_MEMORY_FILES, DEFAULT_MAX_ENTRY_DEPTH, DEFAULT_HARVEST_DEADLINE_MS, DEFAULT_HARVEST_FILE_BUDGET, MASS_DELETION_FUSE_RATIO, scanMemoryWrite, scanMemoryFileName, scanRemediation, MEMORY_FILENAME_SEGMENT_RE, renderAnnouncements, enqueueMemoryAnnouncement, drainMemoryAnnouncements, peekMemoryAnnouncements, bumpScanFuse, scanFuseCount, clearScanFuse, ANNOUNCEMENTS_FILE, MEMORY_ANNOUNCEMENTS_MAX, SCAN_FUSE_FILE, SCAN_FUSE_THRESHOLD, SCOPE_SEGMENT_MAX_ENCODED, PROJECT_MARKER_PATH, encodeScopeSegment, decodeScopeSegment, parseScopeKey, formatUserScope, formatOrgScope, formatProjScope, formatUserProjScope, isPersonalScope, assertScopeContractPlacement, formatProjectMarker, parseProjectMarker, resolveProjectId, PROJECT_ID_REGEX, migrateScope, materializeEntriesToFiles, harvestFilesToPatches, projectionsToWriteBack, screenInboundEntries, REMOTE_HARVEST_PER_FILE_BYTES, REMOTE_MASS_DELETION_FUSE_RATIO, deriveProjectMemoryDir, deriveProjectControlDir, recordProjectIdHint, lookupProjectIdHint, PROJECT_ID_HINTS_FILE, reconcileMemoryEntries, nextSyncBaseline, mergeRecallHits, syncMemoryScope, } from "./core/memory-engine/index.js";
129
130
  export { SHARED_MEMORY_READ_CAP_BYTES, SHARED_MEMORY_LIST_PAGE_SIZE, SharedMemoryStoreError, } from "./core/shared-memory/types.js";
@@ -198,7 +198,7 @@ export interface WorkflowAgentHandle {
198
198
  * its reply with the returned marker. Returns that MARKER so the launcher can correlate the worker's tagged
199
199
  * reply via the #5 transcript (the worker self-stamps; reply is best-effort). One-directional + leader-driven
200
200
  * (the worker can't address the leader except by the marker). A steer issued BEFORE the worker's loop goes
201
- * live is parked and delivered onto turn 1 (birth-window delivery, bounded — ledger item 36); steers are
201
+ * live is parked and delivered into the NEXT turn's context (birth-window delivery, bounded — ledger item 36); steers are
202
202
  * delivered in call order, the birth window included. Rejects with `steering.not_running` once the task has
203
203
  * finished (teardown included).
204
204
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/core",
3
- "version": "5.34.0",
3
+ "version": "5.35.0",
4
4
  "description": "Stateless, task-oriented AI agent core",
5
5
  "type": "module",
6
6
  "license": "BUSL-1.1",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "_comment": "design/87 L3 — frozen public export surface of src/index.ts (name -> kind). DO NOT edit by hand to silence a red test. A removed/changed entry = a SemVer-BREAKING change; bump MAJOR and update this fixture in the SAME commit (design/87 §4.2 / §5.2). Regenerate via REGEN in test/export-surface.test.ts.",
3
- "count": 1546,
3
+ "count": 1562,
4
4
  "exports": {
5
5
  "A2ATaskState": "type",
6
6
  "A2ATaskStateReversal": "type",
@@ -19,7 +19,9 @@
19
19
  "AGGREGATE_TOOL_RESULT_BUDGET_CHARS": "variable",
20
20
  "ANNOUNCEMENTS_FILE": "variable",
21
21
  "APPROVAL_SETTLED_BY_VALUES": "variable",
22
+ "APPROVER_ATTRIBUTION_MAX_CHARS": "variable",
22
23
  "ARTIFACT_LIMITS": "variable",
24
+ "ASK_EVIDENCE_ABSENCE_VALUES": "variable",
23
25
  "AUTONOMOUS_LOOP_DYNAMIC_SENTINEL": "variable",
24
26
  "AUTONOMOUS_LOOP_PREAMBLE": "variable",
25
27
  "AUTONOMOUS_LOOP_PREAMBLE_PERSISTENT": "variable",
@@ -57,12 +59,14 @@
57
59
  "AskAnswerContinuationSource": "type",
58
60
  "AskDelegationProvenance": "interface",
59
61
  "AskEffective": "type",
62
+ "AskEvidenceAbsence": "type",
60
63
  "AskOutcome": "type",
61
64
  "AskQuestion": "interface",
62
65
  "AskQuestionCardDetails": "type",
63
66
  "AskQuestionOption": "interface",
64
67
  "AskQuestionRequest": "interface",
65
68
  "AskRequest": "interface",
69
+ "AskRuleEvidence": "interface",
66
70
  "AskSeamForm": "type",
67
71
  "AskUserQuestionToolOptions": "interface",
68
72
  "AssertOracleIsolationOptions": "interface",
@@ -539,6 +543,7 @@
539
543
  "OrphanToolCall": "interface",
540
544
  "OutputChunk": "type",
541
545
  "OwnOrgAdmissionVerdict": "interface",
546
+ "PARK_SELFCHECK_SCOPE_PREFIX": "variable",
542
547
  "PEER_ADMISSION_DEFAULTS": "variable",
543
548
  "PEER_HOP_CHAIN_WINDOW": "variable",
544
549
  "PEER_MESSAGE_NOTICE": "variable",
@@ -556,6 +561,9 @@
556
561
  "PROTOCOL_TABLE": "variable",
557
562
  "PackSectionDeclaration": "interface",
558
563
  "ParkLaneReason": "type",
564
+ "ParkProbeFinding": "interface",
565
+ "ParkProbeFindingCode": "type",
566
+ "ParkSelfCheckResult": "interface",
559
567
  "ParkedClaimTicket": "interface",
560
568
  "ParsedAllowRule": "interface",
561
569
  "ParsedEntryFile": "interface",
@@ -591,8 +599,11 @@
591
599
  "PermissionRuleWriter": "interface",
592
600
  "PersistedAllowRule": "interface",
593
601
  "PersistedOrgRuleState": "interface",
602
+ "PersistedRuleAnswer": "type",
603
+ "PersistedRuleHit": "interface",
594
604
  "PersistedRuleMatch": "type",
595
605
  "PersistedRuleTool": "type",
606
+ "PersistedRuleUnreadable": "interface",
596
607
  "PlatformLimitReason": "type",
597
608
  "PostCompactContext": "interface",
598
609
  "PostToolBatchCall": "interface",
@@ -1230,6 +1241,8 @@
1230
1241
  "devWorkflowScriptRunner": "variable",
1231
1242
  "dotAtOrBelowFrontier": "function",
1232
1243
  "drainMemoryAnnouncements": "function",
1244
+ "durableParkGapFor": "function",
1245
+ "durableParkGapOf": "function",
1233
1246
  "editBudget": "function",
1234
1247
  "effectivePermissionRules": "function",
1235
1248
  "emitTaskOutcome": "function",
@@ -1345,6 +1358,7 @@
1345
1358
  "normalizeAgentName": "function",
1346
1359
  "normalizeForExactMatch": "function",
1347
1360
  "normalizeMemorySpec": "function",
1361
+ "normalizePersistedRuleHit": "function",
1348
1362
  "normalizePromptEpoch": "function",
1349
1363
  "normalizeRules": "function",
1350
1364
  "normalizeToolResultProvenance": "function",
@@ -1375,6 +1389,7 @@
1375
1389
  "prepareCardApproval": "function",
1376
1390
  "prepareCcImport": "function",
1377
1391
  "prepareStarterBatch": "function",
1392
+ "probeParkRoundTrip": "function",
1378
1393
  "probeSearchBackend": "function",
1379
1394
  "projectHumanInput": "function",
1380
1395
  "projectToolManifest": "function",
@@ -1475,6 +1490,7 @@
1475
1490
  "scanRemediation": "function",
1476
1491
  "scopeCoversCwd": "function",
1477
1492
  "scopeDirName": "function",
1493
+ "screenApproverAttribution": "function",
1478
1494
  "screenInboundEntries": "function",
1479
1495
  "screenRuleSyncState": "function",
1480
1496
  "scrubSecretEnv": "function",