@sema-agent/core 7.71.1 → 7.72.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.
Files changed (151) hide show
  1. package/CHANGELOG.md +181 -0
  2. package/dist/agents/cross-session-ref.d.ts +2 -2
  3. package/dist/agents/cross-session-ref.js +7 -2
  4. package/dist/agents/inherited-tool-pool.d.ts +4 -1
  5. package/dist/agents/inherited-tool-pool.js +7 -5
  6. package/dist/agents/send-message-tool.js +6 -2
  7. package/dist/agents/subagent.js +5 -1
  8. package/dist/agents/verify.js +1 -0
  9. package/dist/core/a2a.d.ts +24 -3
  10. package/dist/core/a2a.js +27 -8
  11. package/dist/core/agent-state.d.ts +28 -7
  12. package/dist/core/agent-state.js +19 -6
  13. package/dist/core/approval-object.d.ts +7 -3
  14. package/dist/core/approval-object.js +30 -9
  15. package/dist/core/checkpoint-features.d.ts +13 -3
  16. package/dist/core/checkpoint-features.js +34 -5
  17. package/dist/core/checkpoint-row-verdict.d.ts +1 -1
  18. package/dist/core/checkpoint-row-verdict.js +3 -3
  19. package/dist/core/effective-path-target.d.ts +19 -0
  20. package/dist/core/effective-path-target.js +95 -38
  21. package/dist/core/engine-notice.d.ts +4 -1
  22. package/dist/core/engine-version.js +1 -1
  23. package/dist/core/file-history-store.d.ts +15 -4
  24. package/dist/core/file-history-store.js +53 -23
  25. package/dist/core/gate-fold.js +3 -1
  26. package/dist/core/governance-codes.d.ts +4 -1
  27. package/dist/core/governance-codes.js +4 -0
  28. package/dist/core/judged-read.d.ts +57 -0
  29. package/dist/core/judged-read.js +1 -0
  30. package/dist/core/mcp-host-seat.d.ts +5 -0
  31. package/dist/core/mcp-host-seat.js +7 -1
  32. package/dist/core/mcp.js +3 -1
  33. package/dist/core/memory-engine/index.d.ts +1 -1
  34. package/dist/core/memory-engine/index.js +1 -1
  35. package/dist/core/memory-engine/layout.js +6 -4
  36. package/dist/core/memory-engine/scope-contract.d.ts +59 -6
  37. package/dist/core/memory-engine/scope-contract.js +90 -25
  38. package/dist/core/mounted-mcp.d.ts +7 -2
  39. package/dist/core/mounted-mcp.js +10 -1
  40. package/dist/core/param-rule-reach.d.ts +8 -3
  41. package/dist/core/param-rule-reach.js +9 -1
  42. package/dist/core/parent-spec-seat.d.ts +11 -1
  43. package/dist/core/parent-spec-seat.js +14 -0
  44. package/dist/core/peer-registration.d.ts +52 -0
  45. package/dist/core/peer-registration.js +37 -0
  46. package/dist/core/peer-seat.d.ts +3 -1
  47. package/dist/core/permission-rule-model.js +1 -1
  48. package/dist/core/runner/chain-mismatch.d.ts +32 -0
  49. package/dist/core/runner/chain-mismatch.js +29 -0
  50. package/dist/core/runner/changes-history.d.ts +1 -0
  51. package/dist/core/runner/changes-history.js +2 -2
  52. package/dist/core/runner/contracts.d.ts +3 -0
  53. package/dist/core/runner/file-history-restore.d.ts +3 -1
  54. package/dist/core/runner/file-history-restore.js +9 -6
  55. package/dist/core/runner/loaded-skills.d.ts +2 -0
  56. package/dist/core/runner/loaded-skills.js +10 -0
  57. package/dist/core/runner/person-path-rows.d.ts +2 -4
  58. package/dist/core/runner/person-path-rows.js +2 -3
  59. package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -0
  60. package/dist/core/runner/prepare-caps-and-workflow.js +7 -2
  61. package/dist/core/runner/prepare-file-history.js +1 -1
  62. package/dist/core/runner/prepare-hands-readface.d.ts +5 -0
  63. package/dist/core/runner/prepare-hands-readface.js +24 -21
  64. package/dist/core/runner/prepare-inherited-gate.d.ts +2 -2
  65. package/dist/core/runner/prepare-inherited-gate.js +1 -1
  66. package/dist/core/runner/prepare-memory-engine-session.d.ts +2 -2
  67. package/dist/core/runner/prepare-memory-engine-session.js +2 -2
  68. package/dist/core/runner/prepare-memory.js +3 -15
  69. package/dist/core/runner/prepare-project-context.d.ts +1 -1
  70. package/dist/core/runner/prepare-project-context.js +3 -7
  71. package/dist/core/runner/prepare-protocol-tools.d.ts +5 -0
  72. package/dist/core/runner/prepare-protocol-tools.js +2 -2
  73. package/dist/core/runner/prepare-task.js +20 -16
  74. package/dist/core/runner/prepare-wiring-manifest.d.ts +2 -0
  75. package/dist/core/runner/prepare-wiring-manifest.js +4 -3
  76. package/dist/core/runner/read-session-changes.js +1 -1
  77. package/dist/core/runner/resume-checkpoint-screen.d.ts +8 -7
  78. package/dist/core/runner/resume-checkpoint-screen.js +7 -6
  79. package/dist/core/runner/rewind-files.js +3 -2
  80. package/dist/core/runner/run-leg.js +6 -2
  81. package/dist/core/runner/terminal-account.d.ts +4 -0
  82. package/dist/core/runner/terminal-account.js +7 -2
  83. package/dist/core/runner/tool-face-overlay.d.ts +2 -11
  84. package/dist/core/runner/tool-face-overlay.js +39 -0
  85. package/dist/core/runner/trim-stretch.js +7 -2
  86. package/dist/core/scheduler.d.ts +47 -7
  87. package/dist/core/scheduler.js +19 -7
  88. package/dist/core/secret-env.d.ts +7 -0
  89. package/dist/core/secret-env.js +1 -1
  90. package/dist/core/sensitive-path-policy.js +14 -7
  91. package/dist/core/shell-read-silence.js +1 -0
  92. package/dist/core/store-contracts/checkpoint-store-contract.js +7 -0
  93. package/dist/core/task-event.d.ts +4 -3
  94. package/dist/core/task-notification.d.ts +2 -1
  95. package/dist/core/task-spec.d.ts +13 -5
  96. package/dist/core/tool-catalog-entries.js +2 -0
  97. package/dist/core/tool-face-reader.js +1 -1
  98. package/dist/core/tool-face.d.ts +7 -0
  99. package/dist/core/tool-face.js +1 -0
  100. package/dist/core/tool-mount-facts.d.ts +4 -2
  101. package/dist/core/tool-mount-facts.js +3 -3
  102. package/dist/core/tool-mount-plan.d.ts +4 -2
  103. package/dist/core/tool-mount-plan.js +5 -5
  104. package/dist/core/tool-mount-static.d.ts +1 -1
  105. package/dist/core/tool-mount-static.js +25 -13
  106. package/dist/core/tool-registry.d.ts +33 -1
  107. package/dist/core/tool-registry.js +33 -0
  108. package/dist/core/tool-roster.d.ts +16 -0
  109. package/dist/core/tool-roster.js +6 -0
  110. package/dist/core/tool-spec.d.ts +4 -2
  111. package/dist/core/tools.d.ts +6 -0
  112. package/dist/core/tools.js +1 -1
  113. package/dist/core/wiring-manifest.d.ts +66 -12
  114. package/dist/core/wiring-manifest.js +37 -1
  115. package/dist/engine/harness/messages.d.ts +1 -1
  116. package/dist/engine/harness/messages.js +2 -1
  117. package/dist/engine/loop/types.d.ts +2 -0
  118. package/dist/engine/session/session.js +1 -1
  119. package/dist/index.d.ts +9 -5
  120. package/dist/index.js +7 -4
  121. package/dist/orchestration/workflow.js +2 -1
  122. package/dist/stores/file/adoption/marker.d.ts +2 -27
  123. package/dist/stores/file/adoption/marker.js +12 -0
  124. package/dist/stores/file/index.d.ts +1 -1
  125. package/dist/stores/file/index.js +1 -1
  126. package/dist/tools/artifact/artifact-tool.js +11 -6
  127. package/dist/tools/fs/file-read-check.d.ts +45 -11
  128. package/dist/tools/fs/file-read-check.js +200 -57
  129. package/dist/tools/fs/judged-reads.d.ts +51 -0
  130. package/dist/tools/fs/judged-reads.js +68 -0
  131. package/dist/tools/fs/safety.d.ts +8 -0
  132. package/dist/tools/fs/safety.js +12 -1
  133. package/dist/tools/fs/shell-read-check.d.ts +16 -3
  134. package/dist/tools/fs/shell-read-check.js +4 -1
  135. package/dist/tools/fs/shell-read-establish.js +13 -3
  136. package/dist/tools/scheduler-store-move.d.ts +74 -0
  137. package/dist/tools/scheduler-store-move.js +103 -0
  138. package/dist/tools/scheduler-tools.d.ts +43 -29
  139. package/dist/tools/scheduler-tools.js +161 -118
  140. package/package.json +2 -2
  141. package/test/export-surface.snapshot.json +43 -3
  142. package/wire-changes/answers/core-stores-sql@7.72.0.json +12 -0
  143. package/wire-changes/answers/core@7.72.0.json +84 -0
  144. package/wire-changes/answers/mods-kernel@7.72.0.json +7 -0
  145. package/wire-changes/answers/primitives@7.72.0.json +6 -0
  146. package/wire-changes/answers/wiki-gate@7.72.0.json +7 -0
  147. package/wire-changes/core-stores-sql@7.72.0.json +215 -0
  148. package/wire-changes/core@7.72.0.json +2426 -0
  149. package/wire-changes/mods-kernel@7.72.0.json +147 -0
  150. package/wire-changes/primitives@7.72.0.json +143 -0
  151. package/wire-changes/wiki-gate@7.72.0.json +145 -0
package/dist/index.d.ts CHANGED
@@ -143,6 +143,7 @@ export { judgeWithheldEnv, WITHHELD_ENV_ANSWERS, type WithheldEnvJudgment, type
143
143
  export { credentialValueProblemOf } from "./core/secret-env.js";
144
144
  export { declarePeerHeldEnv, PEER_HELD_ENV_NOT_TAKEN_REASONS, type PeerHeldEnvAudience, type PeerHeldEnvDeclaration, type PeerHeldEnvNameNotTaken, type PeerHeldEnvNotTakenReason, type PeerHeldEnvReceipt, } from "./core/secret-env.js";
145
145
  export { isBlankCredential } from "./core/secret-env.js";
146
+ export { isNamespaceCredentialName } from "./core/secret-env.js";
146
147
  export { credentialHeaderValues, isCredentialHeaderName, isSchemedCredentialHeader } from "./core/secret-env.js";
147
148
  export { ENGINE_CAPABILITIES, type EngineCapability } from "./core/engine-capabilities.js";
148
149
  export { fastModeReadingOf, FAST_MODE_STATES, FAST_MODE_UNAVAILABLE_REASONS, FAST_MODE_COOLDOWN_REASONS, FAST_MODE_OVERAGE_CAUSES, type FastModeReading, type FastModeState, type FastModeUnavailableReason, type FastModeCooldownReason, type FastModeOverageCause } from "./brain/fast-mode.js";
@@ -249,6 +250,8 @@ export { describeToolCatalog, catalogEntriesNamed, catalogToolNames, catalogRule
249
250
  export { ToolRosterEntry, ToolRoster, ToolRosterDelta, ToolRosterRenderHints, ROSTER_SOURCES, type RosterSource, type ToolIdentity, toolIdentityOf, ROSTER_APPROVAL_BINDING, type RosterApprovalBinding, toolDeclarationDigestOf, mintCapabilityId, diffToolRoster, ruleFacesFromRoster, toolCallFaceOf, rosterToolName, ruleNamesOf, inputKeysOf, ruleFaceOfInstance, rosterMemberBoundProblem, TOOL_ROSTER_MAX_ENTRIES, type RosterBoundMembers, type RosterBoundCode, ToolRosterDeltaSeat, } from "./core/tool-roster.js";
250
251
  export { type ToolCallFace } from "./core/tool-policy.js";
251
252
  export { effectivePathTargetOf, pathTargetBaseOf, type ToolPathBases, type PathTargetReading, type CallTargetReading, type CallTargetView } from "./core/effective-path-target.js";
253
+ export type { JudgedRead, JudgedFile, JudgedReads, JudgedReadsUnavailable } from "./core/judged-read.js";
254
+ export { JUDGED_READS_UNAVAILABLE } from "./tools/fs/judged-reads.js";
252
255
  export { type BoundPathRule, type PathRuleSpec } from "./core/path-rule-binding.js";
253
256
  export { pathFamilyOf, isAbsoluteForFamily, pathIdentityOf, win32NamespaceScreen, WIN32_NAMESPACE_REFUSALS, type PathFamily, type PathIdentity, type PathIdentityReading, type Win32NamespaceRefusal } from "./tools/fs/safety.js";
254
257
  export { judgeShellRead, type ShellReadJudgeInput, type ShellReadJudgment, type ShellReadVerdict, type ShellReadStationSeat, type ShellReadAdmission, } from "./tools/fs/shell-read-check.js";
@@ -292,8 +295,9 @@ export { hasBackgroundShell, BackgroundShellError } from "./core/background-shel
292
295
  export type { BackgroundShellCapability, BackgroundShellId, BackgroundShellStatus, BackgroundShellErrorCode, BackgroundSpawnOptions, BackgroundPoll, BackgroundHardKillOutcome, } from "./core/background-shell.js";
293
296
  export { hasScheduler, SchedulerError } from "./core/scheduler.js";
294
297
  export { isValidCronExpr, nextCronFireTime } from "./core/cron.js";
295
- export type { SchedulerCapability, SchedulerErrorCode, ScheduledIntent, SchedulerContext, ScheduledTaskId, ScheduledTaskSummary, } from "./core/scheduler.js";
296
- export { createSchedulerTools, type SchedulerToolContext, sessionLaneScopeOf, schedulerLanesOf, listScheduled, cancelScheduled, type SchedulerLanes, SCHEDULE_WAKEUP_TOOL_NAME, AUTONOMOUS_LOOP_SENTINEL, AUTONOMOUS_LOOP_DYNAMIC_SENTINEL, } from "./tools/scheduler-tools.js";
298
+ export type { SchedulerCapability, SchedulerErrorCode, ScheduledIntent, SchedulerContext, ScheduledTaskId, ScheduledTaskSummary, SchedulerScopeKeys, } from "./core/scheduler.js";
299
+ export { migrateSchedulerStore, rollbackSchedulerStore, type SchedulerStoredRow, type SchedulerStoreRows, type SchedulerStoreMove, type SchedulerRowRefusalCode, } from "./tools/scheduler-store-move.js";
300
+ export { createSchedulerTools, type SchedulerToolContext, schedulerLanesOf, listScheduled, cancelScheduled, type SchedulerLanes, SCHEDULE_WAKEUP_TOOL_NAME, AUTONOMOUS_LOOP_SENTINEL, AUTONOMOUS_LOOP_DYNAMIC_SENTINEL, } from "./tools/scheduler-tools.js";
297
301
  export { resolveAutonomousLoopPrompt, AUTONOMOUS_LOOP_PREAMBLE, AUTONOMOUS_LOOP_PREAMBLE_PERSISTENT, type AutonomousLoopPromptOptions, } from "./tools/loop-tick.js";
298
302
  export { tightenTaskSpec, TaskSpecTightenError } from "./core/tighten-task-spec.js";
299
303
  export { createAllowDenyPolicy, createApprovalPolicy,
@@ -379,7 +383,7 @@ export { RULE_SYNC_DROP_CODES, type RuleSyncDropReason, type RuleQuarantineReaso
379
383
  export { prepareCardApproval, confirmRuleApproval, type ConfirmResult, type ConfirmRefusalReason, precheckEditedRuleText, type EditedRuleTextPrecheck, redeemRuleTicket, redeemRuleBatch, prepareCcImport, prepareStarterBatch, mintRuleTicket, STARTER_RULES, InMemoryRuleApprovalRecordStore, ruleOffersOfRecord, type RuleTicket, type RuleCandidate, type RuleApprovalKind, type RuleApprovalState, RULE_APPROVAL_KINDS, RULE_APPROVAL_STATES, IMPORTED_SETTINGS_LAYERS, RULE_APPROVAL_RECORD_SCHEMA, type RuleApprovalRecord, type RuleApprovalRecordStore, type RuleOffer2, readRuleOffer2, type RuleOffer2Reading, type StaleRuleApprovalRecord, type RuleConsentDeps, type RedeemResult, type RedeemedBatchMember, type CcImportLayer, type ImportedSettingsLayer, type ImportPreview, } from "./core/permission-rule-consent.js";
380
384
  export { FileDurableRulePartitionProvider, ORG_STATE_FILE } from "./stores/file/permission-rule-store.js";
381
385
  export { adoptFilePermissionRuleStore, type AdoptFileRuleStoreResult } from "./stores/file/permission-rule-adopt.js";
382
- export { AdoptionError, assertAdoptionBootGate, readRootAdoptionFile, writeRootAdoptionFile, ROOT_ADOPTION_FILE, type AdoptionErrorCode, type AdoptionReport, type AdoptionReceipt, type AdoptionLegReport, type AffectedDeploymentConfig, type RootAdoptionFile, } from "./stores/file/adoption/marker.js";
386
+ export { ADOPTION_ERROR_CODES, AdoptionError, assertAdoptionBootGate, readRootAdoptionFile, writeRootAdoptionFile, ROOT_ADOPTION_FILE, type AdoptionErrorCode, type AdoptionReport, type AdoptionReceipt, type AdoptionLegReport, type AffectedDeploymentConfig, type RootAdoptionFile, } from "./stores/file/adoption/marker.js";
383
387
  export { adoptLocalDataRoot, ackAdoptionConfig, witnessAdoptionConfig, listAdoptionQuarantine, readAdoptionStatus, type AdoptionStatus, type AdoptLocalDataRootOptions, type AdoptLocalDataRootResult, type AdoptionCarriageLeg, type AdoptionCarriageLegContext, type AdoptionConfigWitnessReceipt, } from "./stores/file/adoption/adopt.js";
384
388
  export { formatHookFeedback, runToolGate, createHookEnvCapabilities, type PersistedRuleHit, type PersistedRuleHitRule, type PersistedRuleUnreadable, type PersistedRuleCoverage, type PersistedRuleAnswer, normalizePersistedRuleHit, type HookInvocationIdentity, type ClassicEventBase, type PreToolUseEvent, type PostToolUseEvent, type PostToolUseFailureEvent, type PostToolBatchEvent, type UserPromptSubmitEvent, type SubagentStartEvent, type StopEvent, type TaskHookEvent, type TeammateIdleEvent, type StopFailureEvent, type SessionStartEvent, type SessionEndEvent, type PreCompactEvent, type PostCompactEvent, type MessageDisplayEvent, type MessageDisplayResult, type StopHookResult, type HookEnvCapabilities, type HookToolOutput, type PreToolUseResult, type PostToolUseResult, type UserPromptSubmitResult, type SubagentStartResult, type HookToolFailure, type PostToolUseFailureResult, type PostToolBatchCall, type PostToolBatchResult, type PreCompactContext, type PreCompactResult, type PostCompactContext, type PermissionDeniedPayload, } from "./core/hooks.js";
385
389
  export type { ClassicEventMap, ClassicEventName, ObservedAnswer, EngineModRegistration } from "./core/mods/classic-events.js";
@@ -395,7 +399,7 @@ export { loadModPackage, type ModPackageHost, type ModPackageRegistration, type
395
399
  export { CREDENTIAL_REF_KINDS, CREDENTIAL_REF_TRUST, CREDENTIAL_REF_TEXT_MAX, CREDENTIAL_REF_MAP_MAX, CREDENTIAL_REF_PROBLEM_REASONS, readCredentialRef, type CredentialRef, type CredentialRefKind, type CredentialRefRequestAdmission, type CredentialRefProblem, type CredentialRefProblemReason, type CredentialRefReading, } from "@sema-agent/primitives";
396
400
  export { composeMemoryBlock, composeLayeredMemoryBlock, normalizeMemorySpec, type NormalizedMemorySpec, type MemorySpecInput, firstSentence, detectSecret, MEMORY_PROJECT_KEY_ABSENT_REASONS, type MemoryProjectKeyAbsentReason, type MemoryProjectKey, } from "./core/memory.js";
397
401
  export { MemoryEngine, FileMemoryEngineBackend, readMemoryLedgerForm, memoryBackendContract, assertMemoryBackendSearchEquivalence, type MemoryBackendContractHooks, memoryGovernanceStoreContract, type MemoryGovernanceStoreContractHooks, buildMemoryInstruction, writableRootOf, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, deriveRepoControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, isValidEntryId, // the entry-id grammar a backend outside core judges a key by (the delete evidence of a key it fails carries the marker for such keys)
398
- MEMORY_ORIGIN_CAUSES, committedOriginOf, originEquals, consolidationExposedFrontmatter, ambiguousOriginRepresentation, type OriginClearanceRow, type OriginClearanceEvent, type OriginClearanceShadow, committedDistilledOf, distilledEquals, type MemoryEntryDistilled, type MemoryEntryDistilledInput, CONSOLIDATION_DEFAULTS, ConsolidationRefusedError, MEMORY_SEARCH_SUPERSEDED_TAG, consolidationTypeEligible, deriveSupersededSet, memorySupersededNote, supersessionFuseCeiling, DELETION_FUSE_FLOOR, fileGovernanceStore, memoryGovernanceDurability, type MemoryGovernanceDurability, deriveShadowedSet, memoryConsolidationRecommendedNotice, memoryConsolidationCommittedNotice, memoryConsolidationConflictNotice, memoryConsolidationIncompleteNotice, memoryConsolidationRefusedNotice, memoryConsolidationWithheldNotice, type ConsolidationGateRead, type ConsolidationGateRow, type ConsolidationIntent, type ConsolidationIntentCredentialRow, type ConsolidationLeaseSeat, type ConsolidationProductProposal, type ConsolidationProposal, type ConsolidationWriteGate, type MemoryConsolidationOptions, type ConsolidationCommitReceipt, type ConsolidationReconcileReport, type ConsolidationResolveReceipt, type ConsolidationPlanSummary, type ConsolidationPlanFoldEvidence, type SessionMemoryStatus, DISTILLER_DEFAULT_MAX_INPUTS_PER_PRODUCT, LLM_DISTILLER_CONTRACT, LLM_DISTILLER_CONTRACT_DL2, LLM_DISTILLER_CONTRACT_DL3, LLM_DISTILLER_CONTRACTS, MEMORY_DISTILLER_CONTRACT_V1, contractGroupingDiff, driveConsolidationToFixpoint, isAliasModelId, llmPlanDistiller, mintExposurePartitionedPlan, mintLlmConsolidationPlan, MEMORY_DISTILLER_PURITY_CONTRACT_V1, detectCleanArmVerbatimLeak, type CleanArmLeakFinding, type CleanArmLeakVerdict, type MemoryDistillerPurityContract, openAiCompatChatSeat, parseJsonAnswer, planParseRepairs, sanitizeLlmGroups, scheduleUnderFuse, type ConsolidationDistillFn, type ConsolidationDriveCycleRow, type ConsolidationDriveEngine, type ConsolidationDriveResult, type ConsolidationFoldState, type DistillerCandidate, type DistillerChatAnswer, type DistillerChatFn, type DistillerChatRequest, type FuseSchedule, type LlmConsolidationPlan, type LlmConsolidationPlanArm, type LlmConsolidationPlanProduct, type LlmDistillerContract, type MintLlmConsolidationPlanResult, type PlanParseRepairs, type SanitizedLlmGroups, CONSOLIDATION_RUN_STOP_REASONS, CONSOLIDATION_WRITE_REFUSED_CODE, runMemoryConsolidationDriver, type ConsolidationDriverEngine, type ConsolidationDriverRunRow, type ConsolidationRunReceipt, type ConsolidationRunStopReason, type ConsolidationWriteJudge, type ConsolidationWriteTarget, type RunMemoryConsolidationOptions, isInstructionEntry, type MemoryEntryOrigin, type MemoryOriginCause, MEMORY_INSTRUCTION_TEMPLATE, MEMORY_RECALL_DISCIPLINE, MEMORY_PREFERENCE_DISCIPLINE, MEMORY_READONLY_NOTICE, MEMORY_CAPTURE_OPTOUT_NOTICE, memoryCaptureOptedOutNotice, memoryCaptureOptOutUnpersistedNotice, CAPTURE_OPTOUT_UNPERSISTED_RETRY, type CaptureOptOutUnpersistedCause, type CaptureOptOutUnpersistedRetry, SESSION_CAPTURE_OPTOUT_DIR, fileSessionCaptureRecordStore, type SessionCaptureOptOutRecord, type SessionCaptureOptOutMarkOutcome, type SessionCaptureRecordStore, sessionRecordBindsIncarnation, usableSessionIncarnation, type SessionIdentityRead, 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_INDEX_TOOL_NAME, MEMORY_ENGINE_TOOL_NAMES, type MemorySearchDetails, type MemorySearchHit, type CleanMemorySearchHit, type ExposedMemorySearchHit, MEMORY_EXPOSURE_BANNER, MEMORY_EXPOSURE_HANDLE_TAG, memoryExposureIndexRow, type MemoryGetDetails, type MemoryIndexDetails, type MemoryIndexRow, type CleanMemoryIndexRow, type ExposedMemoryIndexRow, 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 EntryProvenanceAccount, type TransferEvidence, type CommittedBinding, type CommittedEntrySnapshot, type CommittedScopeSnapshots, type EntryCustodyReport, erasureSelectHash, type EraseMemoryEntriesInput, type ErasureCarrierAnswer, type ErasureCarrierClass, type ErasureCountAnswer, type ErasureSelect, type ErasedBinding, type MemoryErasureAttestation, computeMemoryBundleHash, type MemoryExportBundle, type MemoryImportReport, type MemoryExportSnapshot, type MemoryBundleImportPlan, type BundleChallengeRow, type BundleLineageRow, type BundlePollutedSession, type MemoryBackend, type MemoryGovernanceStore, MEMORY_GOVERNANCE_DOC_NAMES, type MemoryGovernanceDocName, MEMORY_CONTROL_OBJECT_KINDS, type MemoryControlObjectKind, adoptReplicaControlPlane, replicaControlPlaneStrays, type ControlPlaneAdoptionReport, type ReplicaControlPlaneStrays, type MemoryGovernanceDocs, type ConsolidationTx, type MemoryEntry, type MemoryEntryFrontmatter, type MemoryEntryHeader, type MemoryScopeEnumeration, 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, formatUserLocalScope, formatOrgScope, formatProjScope, formatUserProjScope, isPersonalScope, isReplicableScope, isOrgScopeKey, 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, memorySyncStoreOf, carriesCredential, type MemorySyncTransport, type MemorySyncRequestBody, type MemorySyncResponseBody, type MemorySyncClientConflict, type SyncMemoryScopeOptions, type MemorySyncClientResult, memorySyncReportOf, memoryTravelGapOf, type MemorySyncLayerReport, type MemorySyncRoundReport, } from "./core/memory-engine/index.js";
402
+ MEMORY_ORIGIN_CAUSES, committedOriginOf, originEquals, consolidationExposedFrontmatter, ambiguousOriginRepresentation, type OriginClearanceRow, type OriginClearanceEvent, type OriginClearanceShadow, committedDistilledOf, distilledEquals, type MemoryEntryDistilled, type MemoryEntryDistilledInput, CONSOLIDATION_DEFAULTS, ConsolidationRefusedError, MEMORY_SEARCH_SUPERSEDED_TAG, consolidationTypeEligible, deriveSupersededSet, memorySupersededNote, supersessionFuseCeiling, DELETION_FUSE_FLOOR, fileGovernanceStore, memoryGovernanceDurability, type MemoryGovernanceDurability, deriveShadowedSet, memoryConsolidationRecommendedNotice, memoryConsolidationCommittedNotice, memoryConsolidationConflictNotice, memoryConsolidationIncompleteNotice, memoryConsolidationRefusedNotice, memoryConsolidationWithheldNotice, type ConsolidationGateRead, type ConsolidationGateRow, type ConsolidationIntent, type ConsolidationIntentCredentialRow, type ConsolidationLeaseSeat, type ConsolidationProductProposal, type ConsolidationProposal, type ConsolidationWriteGate, type MemoryConsolidationOptions, type ConsolidationCommitReceipt, type ConsolidationReconcileReport, type ConsolidationResolveReceipt, type ConsolidationPlanSummary, type ConsolidationPlanFoldEvidence, type SessionMemoryStatus, DISTILLER_DEFAULT_MAX_INPUTS_PER_PRODUCT, LLM_DISTILLER_CONTRACT, LLM_DISTILLER_CONTRACT_DL2, LLM_DISTILLER_CONTRACT_DL3, LLM_DISTILLER_CONTRACTS, MEMORY_DISTILLER_CONTRACT_V1, contractGroupingDiff, driveConsolidationToFixpoint, isAliasModelId, llmPlanDistiller, mintExposurePartitionedPlan, mintLlmConsolidationPlan, MEMORY_DISTILLER_PURITY_CONTRACT_V1, detectCleanArmVerbatimLeak, type CleanArmLeakFinding, type CleanArmLeakVerdict, type MemoryDistillerPurityContract, openAiCompatChatSeat, parseJsonAnswer, planParseRepairs, sanitizeLlmGroups, scheduleUnderFuse, type ConsolidationDistillFn, type ConsolidationDriveCycleRow, type ConsolidationDriveEngine, type ConsolidationDriveResult, type ConsolidationFoldState, type DistillerCandidate, type DistillerChatAnswer, type DistillerChatFn, type DistillerChatRequest, type FuseSchedule, type LlmConsolidationPlan, type LlmConsolidationPlanArm, type LlmConsolidationPlanProduct, type LlmDistillerContract, type MintLlmConsolidationPlanResult, type PlanParseRepairs, type SanitizedLlmGroups, CONSOLIDATION_RUN_STOP_REASONS, CONSOLIDATION_WRITE_REFUSED_CODE, runMemoryConsolidationDriver, type ConsolidationDriverEngine, type ConsolidationDriverRunRow, type ConsolidationRunReceipt, type ConsolidationRunStopReason, type ConsolidationWriteJudge, type ConsolidationWriteTarget, type RunMemoryConsolidationOptions, isInstructionEntry, type MemoryEntryOrigin, type MemoryOriginCause, MEMORY_INSTRUCTION_TEMPLATE, MEMORY_RECALL_DISCIPLINE, MEMORY_PREFERENCE_DISCIPLINE, MEMORY_READONLY_NOTICE, MEMORY_CAPTURE_OPTOUT_NOTICE, memoryCaptureOptedOutNotice, memoryCaptureOptOutUnpersistedNotice, CAPTURE_OPTOUT_UNPERSISTED_RETRY, type CaptureOptOutUnpersistedCause, type CaptureOptOutUnpersistedRetry, SESSION_CAPTURE_OPTOUT_DIR, fileSessionCaptureRecordStore, type SessionCaptureOptOutRecord, type SessionCaptureOptOutMarkOutcome, type SessionCaptureRecordStore, sessionRecordBindsIncarnation, usableSessionIncarnation, type SessionIdentityRead, 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_INDEX_TOOL_NAME, MEMORY_ENGINE_TOOL_NAMES, type MemorySearchDetails, type MemorySearchHit, type CleanMemorySearchHit, type ExposedMemorySearchHit, MEMORY_EXPOSURE_BANNER, MEMORY_EXPOSURE_HANDLE_TAG, memoryExposureIndexRow, type MemoryGetDetails, type MemoryIndexDetails, type MemoryIndexRow, type CleanMemoryIndexRow, type ExposedMemoryIndexRow, 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 EntryProvenanceAccount, type TransferEvidence, type CommittedBinding, type CommittedEntrySnapshot, type CommittedScopeSnapshots, type EntryCustodyReport, erasureSelectHash, type EraseMemoryEntriesInput, type ErasureCarrierAnswer, type ErasureCarrierClass, type ErasureCountAnswer, type ErasureSelect, type ErasedBinding, type MemoryErasureAttestation, computeMemoryBundleHash, type MemoryExportBundle, type MemoryImportReport, type MemoryExportSnapshot, type MemoryBundleImportPlan, type BundleChallengeRow, type BundleLineageRow, type BundlePollutedSession, type MemoryBackend, type MemoryGovernanceStore, MEMORY_GOVERNANCE_DOC_NAMES, type MemoryGovernanceDocName, MEMORY_CONTROL_OBJECT_KINDS, type MemoryControlObjectKind, adoptReplicaControlPlane, replicaControlPlaneStrays, type ControlPlaneAdoptionReport, type ReplicaControlPlaneStrays, type MemoryGovernanceDocs, type ConsolidationTx, type MemoryEntry, type MemoryEntryFrontmatter, type MemoryEntryHeader, type MemoryScopeEnumeration, 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, formatUserLocalScope, formatOrgScope, formatProjScope, formatUserProjScope, isPersonalScope, isReplicableScope, isOrgScopeKey, assertScopeContractPlacement, formatProjectMarker, parseProjectMarker, resolveProjectId, PROJECT_ID_REGEX, PROJECT_IDENTITY_REFUSAL_KINDS, PROJECT_MARKER_UNREADABLE_REASONS, type ProjectIdentityRefusalKind, type ProjectMarkerUnreadableReason, type ProjectIdentityRefusalDetail, 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, memorySyncStoreOf, carriesCredential, type MemorySyncTransport, type MemorySyncRequestBody, type MemorySyncResponseBody, type MemorySyncClientConflict, type SyncMemoryScopeOptions, type MemorySyncClientResult, memorySyncReportOf, memoryTravelGapOf, type MemorySyncLayerReport, type MemorySyncRoundReport, } from "./core/memory-engine/index.js";
399
403
  export { createConsolidationWriteJudge, deliverWriteRefusal, type ConsolidationWriteJudgeInput } from "./core/runner/memory-consolidation-write-judge.js";
400
404
  export { STORE_FORM_REFUSAL_CODES, TARGET_OUTSIDE_STORE, TARGET_OUTSIDE_STORE_REASONS, SCOPE_HOME_NOT_DIRECTORY, CONTROL_PLANE_LINKS_UNSUPPORTED, SCOPE_HOME_FORMS, STORE_ABSENT, STORE_ABSENT_EXPECTED_BY, type StoreFormRefusalCode, type StoreFormRefusalDetail, type StoreFormRefusal, type ScopeHomeForm, type TargetOutsideStoreReason, type StoreAbsentExpectedBy, ROOT_ANCHOR_DAMAGED, type RootAnchorRefusalDetail } from "./core/memory-engine/layout.js";
401
405
  export { resolveMemoryScopeStore, type MemoryScopeStore, type MemoryScopeStoreInput } from "./core/memory-engine/dual-root.js";
@@ -491,7 +495,7 @@ export { BACKGROUND_AGENT_CONTRACT_SCOPE, backgroundAgentStoreContract, backgrou
491
495
  export { PEER_DIRECTORY_CONTRACT_SCOPE, peerDirectoryContract, type PeerDirectoryContractHooks } from "./core/store-contracts/peer-directory-contract.js";
492
496
  export { type BackgroundAgentStore, type BackgroundAgentRecord, type BackgroundAgentRowSummary, type BackgroundAgentUsage, canAccessAgentRecord, STALE_RUNNING_REAP_ATTRIBUTION, staleRunningFlip, staleRunningFlipOf, BackgroundAgentStoreError, InMemoryBackgroundAgentStore, reconcileParkedAgents, queryBackgroundAgents, type BackgroundAgentQuery, backgroundAgentSessionRows, BACKGROUND_AGENT_ROW_SHAPE, BACKGROUND_AGENT_ROW_MALFORMED_CODE, BACKGROUND_AGENT_STATUSES, type BackgroundAgentStatus, BACKGROUND_AGENT_SETTLED_STATUSES, type BackgroundAgentSettledStatus, isBackgroundAgentSettledStatus, BACKGROUND_AGENT_LIVE_STATUSES, isBackgroundAgentLiveStatus, type ReadableBackgroundAgentRowSummary, type DamagedBackgroundAgentRowSummary, readStoredBackgroundAgent, admitBackgroundAgent, planScopeRekey, scopeRekeyWritesOf, type ScopeRekeyMove, summarizeStoredBackgroundAgent, nextBackgroundAgentOnUpdate, assertDelegationRoot, } from "./core/background-agent-store.js";
493
497
  export { serveDurableAgentRowLane, buildAgentPollDetails, type AgentPollDetailsInput, } from "./core/task-registry-agent.js";
494
- export { readAgentState, agentStateSourceOfRecord, agentStateSummary, type AgentState, type AgentPark, type AgentParkGate, type AgentParkState, type AgentStateRow, type AgentStateSource, } from "./core/agent-state.js";
498
+ export { AGENT_PARK_UNREADABLE_CAUSES, readAgentState, agentStateSourceOfRecord, agentStateSummary, type AgentState, type AgentPark, type AgentParkGate, type AgentParkState, type AgentParkUnreadableCause, type AgentStateRow, type AgentStateSource, } from "./core/agent-state.js";
495
499
  export type { TranscriptStep } from "./agents/subagent-steps.js";
496
500
  export type { UnifiedTaskResult } from "./core/task-registry-shared.js";
497
501
  export { TASK_OUTPUT_REPLAY_KINDS, type TaskOutputReplay } from "./core/task-registry-shared.js";
package/dist/index.js CHANGED
@@ -119,6 +119,7 @@ export { judgeWithheldEnv, WITHHELD_ENV_ANSWERS } from "./core/secret-env.js";
119
119
  export { credentialValueProblemOf } from "./core/secret-env.js";
120
120
  export { declarePeerHeldEnv, PEER_HELD_ENV_NOT_TAKEN_REASONS, } from "./core/secret-env.js";
121
121
  export { isBlankCredential } from "./core/secret-env.js";
122
+ export { isNamespaceCredentialName } from "./core/secret-env.js";
122
123
  export { credentialHeaderValues, isCredentialHeaderName, isSchemedCredentialHeader } from "./core/secret-env.js";
123
124
  export { ENGINE_CAPABILITIES } from "./core/engine-capabilities.js";
124
125
  export { fastModeReadingOf, FAST_MODE_STATES, FAST_MODE_UNAVAILABLE_REASONS, FAST_MODE_COOLDOWN_REASONS, FAST_MODE_OVERAGE_CAUSES } from "./brain/fast-mode.js";
@@ -195,6 +196,7 @@ export { describeToolCatalog, catalogEntriesNamed, catalogToolNames, catalogRule
195
196
  export { ToolRosterEntry, ToolRoster, ToolRosterDelta, ToolRosterRenderHints, ROSTER_SOURCES, toolIdentityOf, ROSTER_APPROVAL_BINDING, toolDeclarationDigestOf, mintCapabilityId, diffToolRoster, ruleFacesFromRoster, toolCallFaceOf, rosterToolName, ruleNamesOf, inputKeysOf, ruleFaceOfInstance, rosterMemberBoundProblem, TOOL_ROSTER_MAX_ENTRIES, ToolRosterDeltaSeat, } from "./core/tool-roster.js";
196
197
  export {} from "./core/tool-policy.js";
197
198
  export { effectivePathTargetOf, pathTargetBaseOf } from "./core/effective-path-target.js";
199
+ export { JUDGED_READS_UNAVAILABLE } from "./tools/fs/judged-reads.js";
198
200
  export {} from "./core/path-rule-binding.js";
199
201
  export { pathFamilyOf, isAbsoluteForFamily, pathIdentityOf, win32NamespaceScreen, WIN32_NAMESPACE_REFUSALS } from "./tools/fs/safety.js";
200
202
  export { judgeShellRead, } from "./tools/fs/shell-read-check.js";
@@ -235,7 +237,8 @@ export { IMAGE_ADMISSION } from "./core/image-admission.js";
235
237
  export { hasBackgroundShell, BackgroundShellError } from "./core/background-shell.js";
236
238
  export { hasScheduler, SchedulerError } from "./core/scheduler.js";
237
239
  export { isValidCronExpr, nextCronFireTime } from "./core/cron.js";
238
- export { createSchedulerTools, sessionLaneScopeOf, schedulerLanesOf, listScheduled, cancelScheduled, SCHEDULE_WAKEUP_TOOL_NAME, AUTONOMOUS_LOOP_SENTINEL, AUTONOMOUS_LOOP_DYNAMIC_SENTINEL, } from "./tools/scheduler-tools.js";
240
+ export { migrateSchedulerStore, rollbackSchedulerStore, } from "./tools/scheduler-store-move.js";
241
+ export { createSchedulerTools, schedulerLanesOf, listScheduled, cancelScheduled, SCHEDULE_WAKEUP_TOOL_NAME, AUTONOMOUS_LOOP_SENTINEL, AUTONOMOUS_LOOP_DYNAMIC_SENTINEL, } from "./tools/scheduler-tools.js";
239
242
  export { resolveAutonomousLoopPrompt, AUTONOMOUS_LOOP_PREAMBLE, AUTONOMOUS_LOOP_PREAMBLE_PERSISTENT, } from "./tools/loop-tick.js";
240
243
  export { tightenTaskSpec, TaskSpecTightenError } from "./core/tighten-task-spec.js";
241
244
  export { createAllowDenyPolicy, createApprovalPolicy, COARSE_SHELL_TOOLS, createCoarseCommandNamePolicy, createTranscriptIntegrityPolicy, createUnverifiableDeletePolicy, combinePolicies, abortedSeatDeny, noApproverSeatDeny, wrapToolPolicy, decisionText, resolveAsk, toolPolicyNameSets, toolPolicyPathRules, CONSTRAINT_LAYER_KINDS, checkToolPolicyProjection, constraintChainEntryOf, constraintChainDigest, screenApproverAttribution, APPROVER_ATTRIBUTION_MAX_CHARS, BIDI_CONTROL_CHARS, carriesBidiControls, asPolicyApprover, isPolicyApprover, declareClassAnswers, ASK_EVIDENCE_ABSENCE_VALUES, } from "./core/tool-policy.js";
@@ -293,7 +296,7 @@ export { RULE_SYNC_DROP_CODES } from "./core/governance-codes.js";
293
296
  export { prepareCardApproval, confirmRuleApproval, precheckEditedRuleText, redeemRuleTicket, redeemRuleBatch, prepareCcImport, prepareStarterBatch, mintRuleTicket, STARTER_RULES, InMemoryRuleApprovalRecordStore, ruleOffersOfRecord, RULE_APPROVAL_KINDS, RULE_APPROVAL_STATES, IMPORTED_SETTINGS_LAYERS, RULE_APPROVAL_RECORD_SCHEMA, readRuleOffer2, } from "./core/permission-rule-consent.js";
294
297
  export { FileDurableRulePartitionProvider, ORG_STATE_FILE } from "./stores/file/permission-rule-store.js";
295
298
  export { adoptFilePermissionRuleStore } from "./stores/file/permission-rule-adopt.js";
296
- export { AdoptionError, assertAdoptionBootGate, readRootAdoptionFile, writeRootAdoptionFile, ROOT_ADOPTION_FILE, } from "./stores/file/adoption/marker.js";
299
+ export { ADOPTION_ERROR_CODES, AdoptionError, assertAdoptionBootGate, readRootAdoptionFile, writeRootAdoptionFile, ROOT_ADOPTION_FILE, } from "./stores/file/adoption/marker.js";
297
300
  export { adoptLocalDataRoot, ackAdoptionConfig, witnessAdoptionConfig, listAdoptionQuarantine, readAdoptionStatus, } from "./stores/file/adoption/adopt.js";
298
301
  export { formatHookFeedback, runToolGate, createHookEnvCapabilities, normalizePersistedRuleHit, } from "./core/hooks.js";
299
302
  export { KERNEL_CONTRACT_VERSION, MOD_TIERS, MOD_SEATS, MOD_EVENT_SIDES, MOD_EVENT_TABLE, MODS_INVALID_CODE, MODS_REGISTRATION_REFUSED_CODE, MODS_REGISTRATION_REFUSED_DEPLOYMENT_CODE, } from "./core/mods/kernel/index.js";
@@ -305,7 +308,7 @@ export { SESSION_SEND_ORIGIN_KINDS } from "./core/mods/session-send.js";
305
308
  export { loadModPackage } from "./core/mods/package.js";
306
309
  export { CREDENTIAL_REF_KINDS, CREDENTIAL_REF_TRUST, CREDENTIAL_REF_TEXT_MAX, CREDENTIAL_REF_MAP_MAX, CREDENTIAL_REF_PROBLEM_REASONS, readCredentialRef, } from "@sema-agent/primitives";
307
310
  export { composeMemoryBlock, composeLayeredMemoryBlock, normalizeMemorySpec, firstSentence, detectSecret, MEMORY_PROJECT_KEY_ABSENT_REASONS, } from "./core/memory.js";
308
- export { MemoryEngine, FileMemoryEngineBackend, readMemoryLedgerForm, memoryBackendContract, assertMemoryBackendSearchEquivalence, memoryGovernanceStoreContract, buildMemoryInstruction, writableRootOf, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, deriveRepoControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, isValidEntryId, MEMORY_ORIGIN_CAUSES, committedOriginOf, originEquals, consolidationExposedFrontmatter, ambiguousOriginRepresentation, committedDistilledOf, distilledEquals, CONSOLIDATION_DEFAULTS, ConsolidationRefusedError, MEMORY_SEARCH_SUPERSEDED_TAG, consolidationTypeEligible, deriveSupersededSet, memorySupersededNote, supersessionFuseCeiling, DELETION_FUSE_FLOOR, fileGovernanceStore, memoryGovernanceDurability, deriveShadowedSet, memoryConsolidationRecommendedNotice, memoryConsolidationCommittedNotice, memoryConsolidationConflictNotice, memoryConsolidationIncompleteNotice, memoryConsolidationRefusedNotice, memoryConsolidationWithheldNotice, DISTILLER_DEFAULT_MAX_INPUTS_PER_PRODUCT, LLM_DISTILLER_CONTRACT, LLM_DISTILLER_CONTRACT_DL2, LLM_DISTILLER_CONTRACT_DL3, LLM_DISTILLER_CONTRACTS, MEMORY_DISTILLER_CONTRACT_V1, contractGroupingDiff, driveConsolidationToFixpoint, isAliasModelId, llmPlanDistiller, mintExposurePartitionedPlan, mintLlmConsolidationPlan, MEMORY_DISTILLER_PURITY_CONTRACT_V1, detectCleanArmVerbatimLeak, openAiCompatChatSeat, parseJsonAnswer, planParseRepairs, sanitizeLlmGroups, scheduleUnderFuse, CONSOLIDATION_RUN_STOP_REASONS, CONSOLIDATION_WRITE_REFUSED_CODE, runMemoryConsolidationDriver, isInstructionEntry, MEMORY_INSTRUCTION_TEMPLATE, MEMORY_RECALL_DISCIPLINE, MEMORY_PREFERENCE_DISCIPLINE, MEMORY_READONLY_NOTICE, MEMORY_CAPTURE_OPTOUT_NOTICE, memoryCaptureOptedOutNotice, memoryCaptureOptOutUnpersistedNotice, CAPTURE_OPTOUT_UNPERSISTED_RETRY, SESSION_CAPTURE_OPTOUT_DIR, fileSessionCaptureRecordStore, sessionRecordBindsIncarnation, usableSessionIncarnation, 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_INDEX_TOOL_NAME, MEMORY_ENGINE_TOOL_NAMES, MEMORY_EXPOSURE_BANNER, MEMORY_EXPOSURE_HANDLE_TAG, memoryExposureIndexRow, 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, erasureSelectHash, computeMemoryBundleHash, MEMORY_GOVERNANCE_DOC_NAMES, MEMORY_CONTROL_OBJECT_KINDS, adoptReplicaControlPlane, replicaControlPlaneStrays, SCOPE_SEGMENT_MAX_ENCODED, PROJECT_MARKER_PATH, encodeScopeSegment, decodeScopeSegment, parseScopeKey, formatUserScope, formatUserLocalScope, formatOrgScope, formatProjScope, formatUserProjScope, isPersonalScope, isReplicableScope, isOrgScopeKey, 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, memorySyncStoreOf, carriesCredential, memorySyncReportOf, memoryTravelGapOf, } from "./core/memory-engine/index.js";
311
+ export { MemoryEngine, FileMemoryEngineBackend, readMemoryLedgerForm, memoryBackendContract, assertMemoryBackendSearchEquivalence, memoryGovernanceStoreContract, buildMemoryInstruction, writableRootOf, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, deriveRepoControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, isValidEntryId, MEMORY_ORIGIN_CAUSES, committedOriginOf, originEquals, consolidationExposedFrontmatter, ambiguousOriginRepresentation, committedDistilledOf, distilledEquals, CONSOLIDATION_DEFAULTS, ConsolidationRefusedError, MEMORY_SEARCH_SUPERSEDED_TAG, consolidationTypeEligible, deriveSupersededSet, memorySupersededNote, supersessionFuseCeiling, DELETION_FUSE_FLOOR, fileGovernanceStore, memoryGovernanceDurability, deriveShadowedSet, memoryConsolidationRecommendedNotice, memoryConsolidationCommittedNotice, memoryConsolidationConflictNotice, memoryConsolidationIncompleteNotice, memoryConsolidationRefusedNotice, memoryConsolidationWithheldNotice, DISTILLER_DEFAULT_MAX_INPUTS_PER_PRODUCT, LLM_DISTILLER_CONTRACT, LLM_DISTILLER_CONTRACT_DL2, LLM_DISTILLER_CONTRACT_DL3, LLM_DISTILLER_CONTRACTS, MEMORY_DISTILLER_CONTRACT_V1, contractGroupingDiff, driveConsolidationToFixpoint, isAliasModelId, llmPlanDistiller, mintExposurePartitionedPlan, mintLlmConsolidationPlan, MEMORY_DISTILLER_PURITY_CONTRACT_V1, detectCleanArmVerbatimLeak, openAiCompatChatSeat, parseJsonAnswer, planParseRepairs, sanitizeLlmGroups, scheduleUnderFuse, CONSOLIDATION_RUN_STOP_REASONS, CONSOLIDATION_WRITE_REFUSED_CODE, runMemoryConsolidationDriver, isInstructionEntry, MEMORY_INSTRUCTION_TEMPLATE, MEMORY_RECALL_DISCIPLINE, MEMORY_PREFERENCE_DISCIPLINE, MEMORY_READONLY_NOTICE, MEMORY_CAPTURE_OPTOUT_NOTICE, memoryCaptureOptedOutNotice, memoryCaptureOptOutUnpersistedNotice, CAPTURE_OPTOUT_UNPERSISTED_RETRY, SESSION_CAPTURE_OPTOUT_DIR, fileSessionCaptureRecordStore, sessionRecordBindsIncarnation, usableSessionIncarnation, 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_INDEX_TOOL_NAME, MEMORY_ENGINE_TOOL_NAMES, MEMORY_EXPOSURE_BANNER, MEMORY_EXPOSURE_HANDLE_TAG, memoryExposureIndexRow, 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, erasureSelectHash, computeMemoryBundleHash, MEMORY_GOVERNANCE_DOC_NAMES, MEMORY_CONTROL_OBJECT_KINDS, adoptReplicaControlPlane, replicaControlPlaneStrays, SCOPE_SEGMENT_MAX_ENCODED, PROJECT_MARKER_PATH, encodeScopeSegment, decodeScopeSegment, parseScopeKey, formatUserScope, formatUserLocalScope, formatOrgScope, formatProjScope, formatUserProjScope, isPersonalScope, isReplicableScope, isOrgScopeKey, assertScopeContractPlacement, formatProjectMarker, parseProjectMarker, resolveProjectId, PROJECT_ID_REGEX, PROJECT_IDENTITY_REFUSAL_KINDS, PROJECT_MARKER_UNREADABLE_REASONS, 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, memorySyncStoreOf, carriesCredential, memorySyncReportOf, memoryTravelGapOf, } from "./core/memory-engine/index.js";
309
312
  export { createConsolidationWriteJudge, deliverWriteRefusal } from "./core/runner/memory-consolidation-write-judge.js";
310
313
  export { STORE_FORM_REFUSAL_CODES, TARGET_OUTSIDE_STORE, TARGET_OUTSIDE_STORE_REASONS, SCOPE_HOME_NOT_DIRECTORY, CONTROL_PLANE_LINKS_UNSUPPORTED, SCOPE_HOME_FORMS, STORE_ABSENT, STORE_ABSENT_EXPECTED_BY, ROOT_ANCHOR_DAMAGED } from "./core/memory-engine/layout.js";
311
314
  export { resolveMemoryScopeStore } from "./core/memory-engine/dual-root.js";
@@ -397,7 +400,7 @@ export { BACKGROUND_AGENT_CONTRACT_SCOPE, backgroundAgentStoreContract, backgrou
397
400
  export { PEER_DIRECTORY_CONTRACT_SCOPE, peerDirectoryContract } from "./core/store-contracts/peer-directory-contract.js";
398
401
  export { canAccessAgentRecord, STALE_RUNNING_REAP_ATTRIBUTION, staleRunningFlip, staleRunningFlipOf, BackgroundAgentStoreError, InMemoryBackgroundAgentStore, reconcileParkedAgents, queryBackgroundAgents, backgroundAgentSessionRows, BACKGROUND_AGENT_ROW_SHAPE, BACKGROUND_AGENT_ROW_MALFORMED_CODE, BACKGROUND_AGENT_STATUSES, BACKGROUND_AGENT_SETTLED_STATUSES, isBackgroundAgentSettledStatus, BACKGROUND_AGENT_LIVE_STATUSES, isBackgroundAgentLiveStatus, readStoredBackgroundAgent, admitBackgroundAgent, planScopeRekey, scopeRekeyWritesOf, summarizeStoredBackgroundAgent, nextBackgroundAgentOnUpdate, assertDelegationRoot, } from "./core/background-agent-store.js";
399
402
  export { serveDurableAgentRowLane, buildAgentPollDetails, } from "./core/task-registry-agent.js";
400
- export { readAgentState, agentStateSourceOfRecord, agentStateSummary, } from "./core/agent-state.js";
403
+ export { AGENT_PARK_UNREADABLE_CAUSES, readAgentState, agentStateSourceOfRecord, agentStateSummary, } from "./core/agent-state.js";
401
404
  export { TASK_OUTPUT_REPLAY_KINDS } from "./core/task-registry-shared.js";
402
405
  export { REMOVAL_LIVENESS_WORDS, RULE_REFUSAL_CODES, RULE_WRITE_COMMITTED_WORDS } from "./core/permission-rule-store.js";
403
406
  export { normalizeReadRootCandidate, READ_ROOT_CANDIDATE_DIR_MAX } from "./core/read-root-candidate.js";
@@ -2790,7 +2790,7 @@ export function startWorkflow(runner, fn, opts = {}, internals) {
2790
2790
  opts.onForwardEvent(e.type === "task_progress" || e.type === "task_started" ? memberStamp(e, callKey, label) : e);
2791
2791
  }
2792
2792
  : undefined;
2793
- const baseInternals = { ...parkGapInherit(seatedSpec), ...(agentOpts.isolation ? { isolation: agentOpts.isolation } : {}), ...(opts.parentCwd !== undefined ? { parentCwd: opts.parentCwd } : {}), ...callerPlacementSeats(opts.parentCwd, opts.callerRoot), ...spawnAttribution, ...definitionSeats(typed), ...(await captureFloorSeatsNow()), ...(enrichedForward !== undefined ? { onForwardEvent: enrichedForward } : {}), delegationTaskType: "workflow", spendParent: memberSpendParent, agentName: label, ...memberSeat(callKey, label), onWorkspaceResolved: createWorkspaceObserver(rec) };
2793
+ const baseInternals = { ...parkGapInherit(seatedSpec), ...(agentOpts.isolation ? { isolation: agentOpts.isolation } : {}), ...(opts.parentCwd !== undefined ? { parentCwd: opts.parentCwd } : {}), ...(opts.parentSpecSeat?.projectId !== undefined ? { parentProjectId: opts.parentSpecSeat.projectId } : {}), ...callerPlacementSeats(opts.parentCwd, opts.callerRoot), ...spawnAttribution, ...definitionSeats(typed), ...(await captureFloorSeatsNow()), ...(enrichedForward !== undefined ? { onForwardEvent: enrichedForward } : {}), delegationTaskType: "workflow", spendParent: memberSpendParent, agentName: label, ...memberSeat(callKey, label), onWorkspaceResolved: createWorkspaceObserver(rec) };
2794
2794
  let attempts = 0;
2795
2795
  let throttleRetried = false;
2796
2796
  let throttleFirst;
@@ -3266,6 +3266,7 @@ export function startWorkflow(runner, fn, opts = {}, internals) {
3266
3266
  ...(drive === undefined && !spec.sessionId && childSessionId !== undefined ? { sessionIdMintedBySpawner: true } : {}),
3267
3267
  ...(agentOpts.isolation ? { isolation: agentOpts.isolation } : {}),
3268
3268
  ...(opts.parentCwd !== undefined ? { parentCwd: opts.parentCwd } : {}),
3269
+ ...(opts.parentSpecSeat?.projectId !== undefined ? { parentProjectId: opts.parentSpecSeat.projectId } : {}),
3269
3270
  ...callerPlacementSeats(opts.parentCwd, opts.callerRoot),
3270
3271
  ...spawnAttribution,
3271
3272
  ...definitionSeats(typed),
@@ -20,33 +20,8 @@
20
20
  import { type RuleOwner } from "../../../core/rule-owner.js";
21
21
  /** Typed refusal codes (design/183 §7.3): every adoption refusal is discriminable — from `not_found`,
22
22
  * from a broken deployment, and from each other. */
23
- export type AdoptionErrorCode =
24
- /** I6 boot gate: a store construction (or engine boot) over a root whose adoption is mid-flight. */
25
- "adoption_in_flight"
26
- /** A DIFFERENT adoption is mid-flight in this root — resume the original or repair the marker. */
27
- | "adoption_in_flight_mismatch"
28
- /** The root already completed an adoption toward another principal; a second adoption is a
29
- * multi-tenant transfer, out of this protocol's scope (design/183 §1 non-goals / D7). */
30
- | "adoption_retarget"
31
- /** A live instance (engine or another adoption) owns the data root right now. */
32
- | "adoption_locked"
33
- /** A re-key target already holds a row that is not this adoption's arrival (equal bytes included): no merge. Also a row whose
34
- * identity the move changes but which this engine cannot read as one, damaged or a newer engine's (a `plan`'s conflicting), named. */
35
- | "adoption_row_collision"
36
- /** The marker exists but cannot be read as a marker. Fail-closed: after phase 4 the marker IS the
37
- * owner-resolution truth, so guessing would fork ownership. Repair by hand, then resume. */
38
- | "adoption_marker_corrupt"
39
- /** A config-witness receipt does not bind (wrong adoption id / value / unknown entry). */
40
- | "adoption_witness_mismatch"
41
- /** A resume supplies LESS than the recorded migration plan (a dropped rules/carriage leg or a
42
- * changed credentials claim) — completing the arc on the thinner plan would terminalize an
43
- * incompletely migrated root, so the mismatch is refused instead. */
44
- | "adoption_plan_mismatch"
45
- /** The nested permission-rule leg refused (its own collision / lock / marker grammar) — surfaced
46
- * under the root arc's typed contract, original reason preserved in the message. */
47
- | "adoption_rule_leg_refused"
48
- /** Malformed request (empty principal, from == to, …). */
49
- | "adoption_bad_request";
23
+ export declare const ADOPTION_ERROR_CODES: readonly ["adoption_in_flight", "adoption_in_flight_mismatch", "adoption_retarget", "adoption_locked", "adoption_row_collision", "adoption_marker_corrupt", "adoption_witness_mismatch", "adoption_plan_mismatch", "adoption_rule_leg_refused", "adoption_bad_request"];
24
+ export type AdoptionErrorCode = (typeof ADOPTION_ERROR_CODES)[number];
50
25
  export declare class AdoptionError extends Error {
51
26
  readonly code: AdoptionErrorCode;
52
27
  constructor(code: AdoptionErrorCode, message: string);
@@ -3,6 +3,18 @@ import { join } from "node:path";
3
3
  import { readRecordedRuleOwner, sameRuleOwner } from "../../../core/rule-owner.js";
4
4
  import { recordedPrincipalNameOf } from "../../../core/principal-name.js";
5
5
  import { atomicWriteFile, ensureDir } from "../fs-atomic.js";
6
+ export const ADOPTION_ERROR_CODES = Object.freeze([
7
+ "adoption_in_flight",
8
+ "adoption_in_flight_mismatch",
9
+ "adoption_retarget",
10
+ "adoption_locked",
11
+ "adoption_row_collision",
12
+ "adoption_marker_corrupt",
13
+ "adoption_witness_mismatch",
14
+ "adoption_plan_mismatch",
15
+ "adoption_rule_leg_refused",
16
+ "adoption_bad_request",
17
+ ]);
6
18
  export class AdoptionError extends Error {
7
19
  code;
8
20
  constructor(code, message) {
@@ -34,7 +34,7 @@ export { atomicWriteFile, writeThenLink, ensureDir, readJsonlRecords, AppendLog
34
34
  export { setAppendLogDescriptorBudget, appendLogDescriptorStats, type AppendLogDescriptorStats } from "./descriptor-seat.js";
35
35
  export { processFingerprint, isProcessLive, type ProcessFingerprint } from "./fs-atomic.js";
36
36
  export { declareDataRoot, type DataRootDeclaration } from "./data-root-declaration.js";
37
- export { AdoptionError, assertAdoptionBootGate, readRootAdoptionFile, writeRootAdoptionFile, ROOT_ADOPTION_FILE, type AdoptionErrorCode, type AdoptionReport, type AdoptionReceipt, type AdoptionLegReport, type AffectedDeploymentConfig, type RootAdoptionFile, } from "./adoption/marker.js";
37
+ export { ADOPTION_ERROR_CODES, AdoptionError, assertAdoptionBootGate, readRootAdoptionFile, writeRootAdoptionFile, ROOT_ADOPTION_FILE, type AdoptionErrorCode, type AdoptionReport, type AdoptionReceipt, type AdoptionLegReport, type AffectedDeploymentConfig, type RootAdoptionFile, } from "./adoption/marker.js";
38
38
  export { adoptLocalDataRoot, ackAdoptionConfig, witnessAdoptionConfig, listAdoptionQuarantine, readAdoptionStatus, type AdoptionStatus, type AdoptLocalDataRootOptions, type AdoptLocalDataRootResult, type AdoptionCarriageLeg, type AdoptionCarriageLegContext, type AdoptionConfigWitnessReceipt, } from "./adoption/adopt.js";
39
39
  /**
40
40
  * design/80 — the file-backed {@link EngineStorageBackend} for the local (TOC) single-user binary, selected
@@ -42,7 +42,7 @@ export { atomicWriteFile, writeThenLink, ensureDir, readJsonlRecords, AppendLog
42
42
  export { setAppendLogDescriptorBudget, appendLogDescriptorStats } from "./descriptor-seat.js";
43
43
  export { processFingerprint, isProcessLive } from "./fs-atomic.js";
44
44
  export { declareDataRoot } from "./data-root-declaration.js";
45
- export { AdoptionError, assertAdoptionBootGate, readRootAdoptionFile, writeRootAdoptionFile, ROOT_ADOPTION_FILE, } from "./adoption/marker.js";
45
+ export { ADOPTION_ERROR_CODES, AdoptionError, assertAdoptionBootGate, readRootAdoptionFile, writeRootAdoptionFile, ROOT_ADOPTION_FILE, } from "./adoption/marker.js";
46
46
  export { adoptLocalDataRoot, ackAdoptionConfig, witnessAdoptionConfig, listAdoptionQuarantine, readAdoptionStatus, } from "./adoption/adopt.js";
47
47
  const FILE_STORAGE_BACKEND_OPTION_KEYS = optionKeys()({ root: 0, evict: 0, checkpoint: 0, holderIsCurrent: 0, retention: 0, fileHistory: 0, sessionPolicy: 0, onCorruptRead: 0, sessions: 0, admit: 0 });
48
48
  function refuseNestedHolderJudge(record) {
@@ -1,6 +1,7 @@
1
1
  import { arbitrateByMode, askClassMembersOf, classifyAsk } from "../../core/ask-origin.js";
2
2
  import { deliverEngineNotice } from "../../core/engine-notice.js";
3
3
  import { modeReleaseOf } from "../../core/gate-outcome.js";
4
+ import { attestationOf } from "../../core/engine-attestation.js";
4
5
  import { createHash } from "node:crypto";
5
6
  import { Type } from "typebox";
6
7
  import { ARTIFACT_ACTION_CONCURRENCY_SAFE, ARTIFACT_COMMIT_THROW_OUTCOME, ARTIFACT_FAILURE_RESULT_CODE, ARTIFACT_HOST_ERROR_CODE, ARTIFACT_LIST_SCOPES, ARTIFACT_PLANE_CONTENT_ORIGIN, ARTIFACT_PUBLISH_CONTEXTS, readArtifactHostCapabilities, } from "../../core/artifact-host.js";
@@ -175,6 +176,8 @@ function readArtifactCallBinding(raw) {
175
176
  }
176
177
  const invalid = (text) => errorResult(`Error (Artifact): ${text}`, { type: "artifact", invalidArguments: true });
177
178
  const typed = (code, text, extra = {}) => errorResult(`Error (Artifact): ${text}`, { type: "artifact", code: ARTIFACT_FAILURE_RESULT_CODE[code], ...extra });
179
+ const SHARED_READ_REFUSED = { mode: "was refused by the permission mode", classifier: "was refused by auto mode's classifier", ask_resolution: "was not approved" };
180
+ const sharedReadRefused = (url, target, refusal, withheld) => typed("refused", `reading the shared artifact ${target} ${SHARED_READ_REFUSED[refusal.deniedBy]} (${foreignLine(refusal.reason, 200)}); its ${withheld} ${withheld === "files" ? "were" : "was"} not delivered.`, { url, sharedRead: "not_approved", deniedBy: refusal.deniedBy, ...(refusal.settlement !== undefined ? { settlement: refusal.settlement } : {}) });
178
181
  export function createArtifactTool(opts) {
179
182
  const verdict = readArtifactHostCapabilities(opts.host);
180
183
  if (!verdict.ok)
@@ -530,7 +533,7 @@ export function assembleArtifactTool(opts, caps, onNotice) {
530
533
  return { ok: true };
531
534
  }
532
535
  if (verdict.kind === "denied_by_mode")
533
- return { ok: false, reason: `the ${verdict.mode} permission mode refuses to read another person's artifact without approval` };
536
+ return { ok: false, reason: `the ${verdict.mode} permission mode refuses to read another person's artifact without approval`, deniedBy: "mode" };
534
537
  return undefined;
535
538
  };
536
539
  const first = byMode();
@@ -545,7 +548,7 @@ export function assembleArtifactTool(opts, caps, onNotice) {
545
548
  return { ok: true };
546
549
  }
547
550
  if (judged.kind === "deny")
548
- return { ok: false, reason: judged.reason };
551
+ return { ok: false, reason: judged.reason, deniedBy: "classifier" };
549
552
  return byMode(judged.also) ?? askPerson(url, question, ctx, judged.settle, judged.request);
550
553
  });
551
554
  };
@@ -571,10 +574,12 @@ export function assembleArtifactTool(opts, caps, onNotice) {
571
574
  }, onAsk, ctx.signal, undefined, undefined, undefined, undefined, undefined, "close");
572
575
  const allowed = resolved.action === "allow" && resolved.updatedInput === undefined;
573
576
  settle?.(allowed);
577
+ const settlement = attestationOf(resolved, { toolCallId: ctx.toolCallId, toolName: ARTIFACT_TOOL_NAME })?.settlement?.kind;
578
+ const byResolution = { deniedBy: "ask_resolution", ...(settlement !== undefined ? { settlement } : {}) };
574
579
  if (resolved.action !== "allow")
575
- return { ok: false, reason: resolved.message ?? "not approved" };
580
+ return { ok: false, reason: resolved.message ?? "not approved", ...byResolution };
576
581
  if (resolved.updatedInput !== undefined)
577
- return { ok: false, reason: "the approval edited the request; an edited approval does not authorize the original target" };
582
+ return { ok: false, reason: "the approval edited the request; an edited approval does not authorize the original target", ...byResolution };
578
583
  sharedReadApproved.add(url);
579
584
  return { ok: true };
580
585
  })().finally(() => {
@@ -602,7 +607,7 @@ export function assembleArtifactTool(opts, caps, onNotice) {
602
607
  if (!sharedUrls.has(url))
603
608
  return undefined;
604
609
  const consent = await sharedReadConsent(url, undefined, ctx);
605
- return consent.ok ? undefined : typed("refused", `reading the shared artifact ${foreignLine(url, 200)} was not approved (${foreignLine(consent.reason, 200)}); its files were not delivered.`, { url, sharedRead: "not_approved" });
610
+ return consent.ok ? undefined : sharedReadRefused(url, foreignLine(url, 200), consent, "files");
606
611
  };
607
612
  async function read(a, ctx) {
608
613
  if (a.url === undefined)
@@ -621,7 +626,7 @@ export function assembleArtifactTool(opts, caps, onNotice) {
621
626
  if (sharedUrls.has(a.url)) {
622
627
  const consent = await sharedReadConsent(a.url, out.ref, ctx);
623
628
  if (!consent.ok)
624
- return typed("refused", `reading the shared artifact ${inlineUntrusted(a.url, 200)} was not approved (${foreignLine(consent.reason, 200)}); its content was not delivered.`, { url: a.url, sharedRead: "not_approved" });
629
+ return sharedReadRefused(a.url, inlineUntrusted(a.url, 200), consent, "content");
625
630
  }
626
631
  rememberRef(out.ref);
627
632
  const head = owner === "shared" ? `[isolated summary of a shared artifact — ${inlineUntrusted(out.ref.url, 300)}, version ${inlineUntrusted(out.ref.version, 60)}]\n` : "";
@@ -18,16 +18,19 @@
18
18
  * the gate never received (its wait elapsed, the judgment threw) admits nothing.
19
19
  */
20
20
  import type { ExecutionEnv } from "../../internal/harness-types.js";
21
+ import type { ToolCallPathTarget } from "../../core/tool-face.js";
22
+ import type { JudgedRead } from "../../core/judged-read.js";
21
23
  import type { ContainmentFace } from "./containment-face.js";
22
24
  import { type ReadDenyMatcher } from "./read-deny.js";
23
- import { type ShellReadCheck } from "./shell-read-check.js";
25
+ import { type ReadStationCall, type ShellReadCheck } from "./shell-read-check.js";
24
26
  /**
25
27
  * How a leg answers a file tool's read outside its roots — ONE judgment over the two declarations that bear on it:
26
28
  * `refusal` (the leg refuses reads outside its declared directories, `TaskSpec.blockReadsOutsideRoots`: the station refuses
27
29
  * at the gate, before the gate's own questions — save a host policy that asks its approver inside its own `check`, which has
28
30
  * asked by then, and the leg's approver re-asked about an approved edit that moves an in-root read outside), `tool_fence`
29
- * (the read-only mount: no station, the tool's own fence refuses), or
30
- * `question` (the station puts it to whoever answers). The station is mounted, and its arm chosen, off this answer alone.
31
+ * (the read-only mount: the file tools' own fence refuses, the station judges none of them; a DECLARED read, which has no fence
32
+ * of its own, is refused at the gate wherever the Read tool's fence would refuse it), or
33
+ * `question` (the station puts it to whoever answers). The station's arm is chosen off this answer alone.
31
34
  */
32
35
  export type OutsideReadDisposition = "question" | "refusal" | "tool_fence";
33
36
  export declare function outsideReadDisposition(leg: {
@@ -41,12 +44,27 @@ export declare function outsideReadDisposition(leg: {
41
44
  export declare const READ_BLOCK_REMEDY = "This task refuses reads outside its directories (blockReadsOutsideRoots); ask the user to add the directory to the task's directories.";
42
45
  export interface FileReadStation {
43
46
  readonly check: ShellReadCheck;
44
- /** The station's membership: the tool names whose declared read target it judges. */
47
+ /** The station's membership by NAME: the engine's file tools whose catalog read target it judges. A call under no such name
48
+ * whose face declares a read target is a member too ({@link declaredReadOf}), judged on its own declaration. */
45
49
  readonly tools: ReadonlySet<string>;
46
50
  /** Did the gate put THIS call's read of `canonicalKey` outside the roots to a question it then let through? Consumed
47
51
  * on a match: the admission covers one read of one target. */
48
52
  readonly admitted: (toolCallId: string | undefined, canonicalKey: string) => boolean;
53
+ /** The judged-read port of a call the station judged as a declared read (`ToolExecuteContext.judgedReads`); `undefined` when it
54
+ * judged no such call under this id. */
55
+ readonly judgedReadsOf: (toolCallId: string) => readonly JudgedRead[] | undefined;
56
+ /** Is this call the station's member by its face's declaration ({@link declaredReadOf})? */
57
+ readonly declares: (call: ReadStationCall) => boolean;
49
58
  }
59
+ /**
60
+ * The read target a call DECLARES on its own face, when the call is under no name of the engine's file tools: a tool the engine
61
+ * does not catalog (a caller's, an MCP server's under its `toolFaces`) that states `pathTarget.access: "read"`. Such a call is the
62
+ * file read station's member on that declaration; nothing but the station's judgment stands between the model's path and the
63
+ * tool, so the station refuses at the gate every target the read would refuse, and the tool reads through the port the station
64
+ * hands it. The slot is the declarer's whatever names the tool answers to (`declaredReadSlotOf`). `undefined` ⇒ not a declared read
65
+ * (a tool the engine mounted keeps its catalog slot and its own refusals).
66
+ */
67
+ export declare function declaredReadOf(call: ReadStationCall): ToolCallPathTarget | undefined;
50
68
  export interface FileReadStationOptions {
51
69
  readonly env: ExecutionEnv;
52
70
  readonly rootCanonical: string;
@@ -55,7 +73,8 @@ export interface FileReadStationOptions {
55
73
  readonly readDeny?: ReadDenyMatcher;
56
74
  readonly readFace?: ContainmentFace;
57
75
  readonly homeDir?: string;
58
- /** The file tools this leg mounts (their catalog path target is the one judged). */
76
+ /** The file tools the station judges by name (their catalog path target is the one judged): those the leg mounts, or none
77
+ * where their own fence answers (the read-only band). A declared read is judged whatever this set holds. */
59
78
  readonly tools: ReadonlySet<string>;
60
79
  /** A target no answer may admit (the store-isolation rule's judgment, `rootAdmittingArtifactStore`): it is left to
61
80
  * the tool's own refusal, no question is raised for it. */
@@ -65,13 +84,28 @@ export interface FileReadStationOptions {
65
84
  readonly exempt?: (canonicalKey: string) => boolean;
66
85
  /** The station's arm ({@link outsideReadDisposition}): `question` (absent) puts an out-of-root read to a question;
67
86
  * `refusal` refuses at the gate every read the tool would refuse itself — outside the roots, on a deny row, a target it
68
- * cannot resolve, the artifact store — with the resolution's own card, admits nothing, and refuses when it cannot judge. */
69
- readonly outsideReads?: Exclude<OutsideReadDisposition, "tool_fence">;
87
+ * cannot resolve, the artifact store — with the resolution's own card, admits nothing, and refuses when it cannot judge;
88
+ * `tool_fence` refuses each target of a declared read the Read tool's own fence would refuse (its sentence). */
89
+ readonly outsideReads?: OutsideReadDisposition;
70
90
  }
71
91
  export declare function createFileReadStation(opts: FileReadStationOptions): FileReadStation;
72
- /** One gate input over the leg's read stations: each call is judged by the station whose membership holds the first of
73
- * its names any station holds (the spelling first). */
74
- export declare function composeReadChecks(stations: ReadonlyArray<{
92
+ /** A read station as the gate input composes it: its check, its membership by name, and — for the file read station — whether a
93
+ * call under none of those names is its member by what its face declares. */
94
+ export interface ReadStationMember {
75
95
  readonly check: ShellReadCheck;
76
96
  readonly tools: ReadonlySet<string>;
77
- }>): ShellReadCheck | undefined;
97
+ readonly declares?: (call: ReadStationCall) => boolean;
98
+ }
99
+ /** Is `call` a member of any of `stations` — by one of its names, or by its face's declaration? */
100
+ export declare function readStationsHold(stations: ReadonlyArray<ReadStationMember>, call: ReadStationCall): boolean;
101
+ /** One gate input over the leg's read stations: a call whose own face declares a read target ({@link declaredReadOf}) is judged
102
+ * by the file read station, whatever names it answers to; any other call by the station whose membership holds the first of its
103
+ * names any station holds (the spelling first). */
104
+ export declare function composeReadChecks(stations: ReadonlyArray<ReadStationMember>): ShellReadCheck | undefined;
105
+ /**
106
+ * The read check of a leg that mounts no file read station (no execution environment, or its hands are off): a call whose face
107
+ * declares a read and whose tool does not read through the judged-read port (`ported` answers by the tool's wire name — an MCP
108
+ * tool, whose server opens the path by name with nothing after the gate) is refused and never dispatched, on a fresh leg and on a
109
+ * resumed one alike; every other call is not its member. A tool that reads through the port is handed `no_read_station` instead.
110
+ */
111
+ export declare function unjudgedReadsMember(ported: (toolName: string) => boolean): ReadStationMember;