@sema-agent/core 7.14.0 → 7.16.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 (136) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/dist/core/ask-origin.d.ts +2 -2
  3. package/dist/core/checkpoint-store.d.ts +14 -15
  4. package/dist/core/governance-codes.js +2 -0
  5. package/dist/core/hooks.d.ts +4 -3
  6. package/dist/core/memory-engine/delegation-settlement.d.ts +37 -12
  7. package/dist/core/memory-engine/delegation-settlement.js +128 -39
  8. package/dist/core/memory-engine/engine.d.ts +9 -8
  9. package/dist/core/memory-engine/engine.js +115 -120
  10. package/dist/core/memory-engine/file-backend.d.ts +17 -5
  11. package/dist/core/memory-engine/file-backend.js +78 -34
  12. package/dist/core/memory-engine/index.d.ts +2 -2
  13. package/dist/core/memory-engine/index.js +2 -2
  14. package/dist/core/memory-engine/layout.d.ts +152 -54
  15. package/dist/core/memory-engine/layout.js +441 -104
  16. package/dist/core/memory-engine/types.d.ts +8 -3
  17. package/dist/core/memory-engine/types.js +5 -0
  18. package/dist/core/runner/abort-race.d.ts +3 -3
  19. package/dist/core/runner/active-skill-scope.d.ts +2 -2
  20. package/dist/core/runner/assemble-result.d.ts +29 -29
  21. package/dist/core/runner/checkpoint-scope.d.ts +4 -4
  22. package/dist/core/runner/clock-and-limits.d.ts +3 -3
  23. package/dist/core/runner/compaction-call-options.d.ts +11 -11
  24. package/dist/core/runner/compaction-knobs.d.ts +4 -4
  25. package/dist/core/runner/compaction-seams.d.ts +5 -5
  26. package/dist/core/runner/contracts.d.ts +224 -226
  27. package/dist/core/runner/decide-continuation.d.ts +6 -6
  28. package/dist/core/runner/denial-limit-arms.d.ts +8 -8
  29. package/dist/core/runner/derived-route-fallback.d.ts +2 -2
  30. package/dist/core/runner/gate-exit.d.ts +6 -6
  31. package/dist/core/runner/git-status-frame.d.ts +7 -7
  32. package/dist/core/runner/inherited-ask-grants.d.ts +6 -6
  33. package/dist/core/runner/memory-capture-optout.d.ts +1 -1
  34. package/dist/core/runner/memory-consolidation-driver.d.ts +4 -4
  35. package/dist/core/runner/memory-consolidation.d.ts +6 -6
  36. package/dist/core/runner/park-commit.d.ts +6 -6
  37. package/dist/core/runner/permission-rule-lanes.d.ts +22 -20
  38. package/dist/core/runner/permission-rule-lanes.js +1 -1
  39. package/dist/core/runner/prepare-acquire-reconcile.d.ts +4 -4
  40. package/dist/core/runner/prepare-ask-lane.d.ts +3 -3
  41. package/dist/core/runner/prepare-boundary-parks.d.ts +3 -3
  42. package/dist/core/runner/prepare-caps-and-workflow.d.ts +5 -5
  43. package/dist/core/runner/prepare-config-doors.d.ts +21 -21
  44. package/dist/core/runner/prepare-context-lane.d.ts +6 -6
  45. package/dist/core/runner/prepare-defer-classify.d.ts +3 -3
  46. package/dist/core/runner/prepare-defer-classify.js +12 -10
  47. package/dist/core/runner/prepare-delegation-surface.d.ts +1 -1
  48. package/dist/core/runner/prepare-file-history.d.ts +2 -2
  49. package/dist/core/runner/prepare-gate-stations.d.ts +8 -9
  50. package/dist/core/runner/prepare-gate-stations.js +2 -2
  51. package/dist/core/runner/prepare-hands-readface.d.ts +41 -41
  52. package/dist/core/runner/prepare-hands-readface.js +27 -29
  53. package/dist/core/runner/prepare-inherited-gate.d.ts +6 -6
  54. package/dist/core/runner/prepare-listings.d.ts +3 -3
  55. package/dist/core/runner/prepare-lsp.d.ts +3 -3
  56. package/dist/core/runner/prepare-memory-engine-session.d.ts +5 -5
  57. package/dist/core/runner/prepare-memory.js +6 -7
  58. package/dist/core/runner/prepare-offload-wrappers.d.ts +2 -2
  59. package/dist/core/runner/prepare-park-ask.d.ts +11 -12
  60. package/dist/core/runner/prepare-park-ask.js +3 -3
  61. package/dist/core/runner/prepare-policy-chain.d.ts +6 -6
  62. package/dist/core/runner/prepare-policy-chain.js +2 -2
  63. package/dist/core/runner/prepare-prompt-inputs.d.ts +5 -5
  64. package/dist/core/runner/prepare-protocol-tools.d.ts +1 -1
  65. package/dist/core/runner/prepare-question-face.d.ts +4 -4
  66. package/dist/core/runner/prepare-run-refs.d.ts +11 -11
  67. package/dist/core/runner/prepare-safety-scan.d.ts +1 -1
  68. package/dist/core/runner/prepare-suspend-saga.d.ts +4 -4
  69. package/dist/core/runner/prepare-task.d.ts +12 -12
  70. package/dist/core/runner/prepare-task.js +5 -7
  71. package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +2 -3
  72. package/dist/core/runner/prepare-wiring-manifest.d.ts +4 -4
  73. package/dist/core/runner/prepare-workspace-restore.d.ts +1 -1
  74. package/dist/core/runner/remote-env-retry.d.ts +3 -3
  75. package/dist/core/runner/resume-admission.d.ts +1 -1
  76. package/dist/core/runner/resume-claim.d.ts +1 -1
  77. package/dist/core/runner/resume-internals-and-config.d.ts +1 -1
  78. package/dist/core/runner/resume-policy-outcome.d.ts +1 -1
  79. package/dist/core/runner/resume-preflight.d.ts +1 -1
  80. package/dist/core/runner/resume-review-outcome.d.ts +1 -1
  81. package/dist/core/runner/run-brain-sinks.d.ts +1 -1
  82. package/dist/core/runner/run-clock-and-content.d.ts +4 -4
  83. package/dist/core/runner/run-compaction-machinery.d.ts +3 -3
  84. package/dist/core/runner/run-git-lane.d.ts +1 -1
  85. package/dist/core/runner/run-harness-handlers.d.ts +2 -2
  86. package/dist/core/runner/run-identity-wiring.d.ts +4 -4
  87. package/dist/core/runner/run-leg.d.ts +3 -3
  88. package/dist/core/runner/run-notification-lane.d.ts +2 -2
  89. package/dist/core/runner/run-reasoning-seat.d.ts +2 -2
  90. package/dist/core/runner/run-settle-and-teardown.d.ts +4 -4
  91. package/dist/core/runner/run-telemetry-and-budget-seats.d.ts +2 -2
  92. package/dist/core/runner/run-terminal-adoption.d.ts +5 -5
  93. package/dist/core/runner/runtask.d.ts +14 -14
  94. package/dist/core/runner/session-file-state-replay.d.ts +3 -3
  95. package/dist/core/runner/session-rule-policy.d.ts +2 -2
  96. package/dist/core/runner/steer-admission.d.ts +2 -2
  97. package/dist/core/runner/stream-halt-verbs.d.ts +1 -1
  98. package/dist/core/runner/stream-reap.d.ts +1 -1
  99. package/dist/core/runner/synthetic-tools.d.ts +8 -8
  100. package/dist/core/runner/teardown-bounded.d.ts +2 -2
  101. package/dist/core/runner/tool-defer-gate.d.ts +86 -0
  102. package/dist/core/runner/tool-defer-gate.js +57 -0
  103. package/dist/core/runner/tool-disclosure.d.ts +33 -69
  104. package/dist/core/runner/tool-disclosure.js +0 -43
  105. package/dist/core/runner/tool-end-body.d.ts +3 -3
  106. package/dist/core/runner/tool-face-overlay.d.ts +2 -2
  107. package/dist/core/runner/tool-output-projection.d.ts +2 -2
  108. package/dist/core/runner/turn-attachments.d.ts +53 -53
  109. package/dist/core/runner/usage-accounting.d.ts +4 -4
  110. package/dist/core/runner/workspace-path.d.ts +1 -1
  111. package/dist/core/runner-deps.d.ts +16 -9
  112. package/dist/core/task-spec.d.ts +8 -2
  113. package/dist/core/tool-spec.d.ts +7 -4
  114. package/dist/core/types.d.ts +1 -1
  115. package/dist/engine/llm/types.d.ts +1 -1
  116. package/dist/index.d.ts +4 -4
  117. package/dist/index.js +3 -3
  118. package/dist/tools/fs/bash-readonly-classifier.d.ts +40 -40
  119. package/dist/tools/fs/encoding.d.ts +31 -40
  120. package/dist/tools/fs/fs-bash.d.ts +76 -35
  121. package/dist/tools/fs/fs-bash.js +86 -29
  122. package/dist/tools/fs/fs-pdf.d.ts +8 -8
  123. package/dist/tools/fs/fs-search-tools.d.ts +4 -4
  124. package/dist/tools/fs/fs-shared.d.ts +144 -158
  125. package/dist/tools/fs/fs-write.d.ts +8 -8
  126. package/dist/tools/fs/gh-rate-limit.d.ts +13 -14
  127. package/dist/tools/fs/index.d.ts +74 -78
  128. package/dist/tools/fs/notebook.d.ts +24 -25
  129. package/dist/tools/fs/pdf.d.ts +3 -3
  130. package/dist/tools/fs/read-deny.d.ts +22 -22
  131. package/dist/tools/fs/read-face.d.ts +21 -24
  132. package/dist/tools/fs/repo-map.d.ts +8 -8
  133. package/dist/tools/fs/safety.d.ts +116 -129
  134. package/dist/tools/fs/search.d.ts +63 -71
  135. package/package.json +5 -2
  136. package/test/export-surface.snapshot.json +9 -1
package/dist/index.d.ts CHANGED
@@ -39,7 +39,7 @@ export { selectModel, selectModelOrThrow, type ModelCriteria, type ModelTier } f
39
39
  export { BrainError, classifyHttp, type BrainErrorCode } from "./brain/errors.js";
40
40
  export { looksDegenerate, inspectDegenerate, trimDegenerateTail } from "./brain/repetition.js";
41
41
  export type { RepetitionEvent, RepetitionInspection } from "./brain/repetition.js";
42
- export { computeCostMicroUsd, modelCostToPricing, type ModelPricing, type TokenCounts, } from "./core/pricing.js";
42
+ export { computeCostMicroUsd, isModelPriced, modelCostToPricing, type ModelPricing, type TokenCounts, } from "./core/pricing.js";
43
43
  export { cacheFamilyOf, promptTokensOf, uncachedInputTokensOf, type CacheFamily } from "./core/runner/usage-accounting.js";
44
44
  export { emitTrace, type ToolDisclosureManifest, type TraceEvent, type TracerHook } from "./core/trace.js";
45
45
  export { InMemoryStrategyStore, seedStrategies, type StrategyStore, type StoredStrategy, type StrategyOrigin, type StrategyStoreIncident, type SeedStrategyEntry, type SeedStrategiesReport, } from "./core/strategy-store.js";
@@ -93,7 +93,7 @@ export { sanitizeUntrustedText, delimitUntrusted, inlineUntrusted } from "./core
93
93
  export { mintReminderMark, isValidReminderMark, openSystemReminder, mintSystemReminder, reminderMarkDeclaration } from "./core/reminder-mint.js";
94
94
  export { deriveInvariants, checkInvariants } from "./core/property-harness.js";
95
95
  export type { InvariantKind, FunctionContract, Invariant, InvariantViolation, CheckResult, } from "./core/property-harness.js";
96
- export { bashReversibilityProbe, BASH_READONLY_DEFAULT_ALLOW, parseLeadingCommandName, classifyCompoundReadonly, MAX_EDIT_BYTES } from "./tools/fs/index.js";
96
+ export { bashReversibilityProbe, bashReadBoundaryProbe, BASH_READONLY_DEFAULT_ALLOW, parseLeadingCommandName, classifyCompoundReadonly, MAX_EDIT_BYTES } from "./tools/fs/index.js";
97
97
  export { classifyCompoundReadonlyDetailed, formatOutOfRootReadApprovalOption, type BashReadonlyRootBoundary, type CompoundReadonlyVerdict, } from "./tools/fs/index.js";
98
98
  export { resolveBashTimeoutCaps } from "./tools/fs/index.js";
99
99
  export { READ_FACE_DEFAULT_DENY_ENTRIES, READ_FACE_BUILTIN_DENY_TABLE, READ_DENY_BUILTIN_TIERS, READ_DENY_DEFAULT_TIERS, resolveReadDenyBuiltins, compileReadDeny, type ReadDenyEntry, type ReadDenyMatcher, type NormalizedReadDenyEntry, type ReadDenyBuiltinTier, type ReadDenyBuiltinRow, type ReadDenyBuiltinConfig, } from "./tools/fs/index.js";
@@ -208,7 +208,7 @@ export { AdoptionError, assertAdoptionBootGate, readRootAdoptionFile, writeRootA
208
208
  export { adoptLocalDataRoot, ackAdoptionConfig, witnessAdoptionConfig, listAdoptionQuarantine, readAdoptionStatus, type AdoptionStatus, type AdoptLocalDataRootOptions, type AdoptLocalDataRootResult, type AdoptionCarriageLeg, type AdoptionCarriageLegContext, type AdoptionConfigWitnessReceipt, } from "./stores/file/adoption/adopt.js";
209
209
  export { formatHookFeedback, runToolGate, createHookEnvCapabilities, createPreToolUseConstraintPolicy, type PersistedRuleHit, type PersistedRuleHitRule, type PersistedRuleUnreadable, type PersistedRuleCoverage, type PersistedRuleAnswer, normalizePersistedRuleHit, type Hooks, type HookToolContext, type HookInvocationIdentity, type UserPromptSubmitContext, type PostToolBatchContext, 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, } from "./core/hooks.js";
210
210
  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";
211
- export { MemoryEngine, FileMemoryEngineBackend, memoryBackendContract, assertMemoryBackendSearchEquivalence, type MemoryBackendContractHooks, buildMemoryInstruction, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, deriveRepoControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, 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, readIntentCredentials, supersessionFuseCeiling, memoryConsolidationRecommendedNotice, memoryConsolidationCommittedNotice, memoryConsolidationConflictNotice, memoryConsolidationIncompleteNotice, memoryConsolidationRefusedNotice, memoryConsolidationWithheldNotice, type ConsolidationGateRead, type ConsolidationGateRow, type ConsolidationIntent, type ConsolidationIntentCredentialRow, type ConsolidationLeaseSeat, type ConsolidationProductProposal, type ConsolidationProposal, 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_DRIVER_PLANS_DIR, CONSOLIDATION_DRIVER_RUNS_FILE, CONSOLIDATION_RUN_STOP_REASONS, archiveDistillerPlan, readConsolidationDriverRun, runMemoryConsolidationDriver, type ConsolidationDriverEngine, type ConsolidationDriverRunRow, type ConsolidationRunReceipt, type ConsolidationRunStopReason, 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, SESSION_CAPTURE_OPTOUT_DIR, markSessionCaptureOptOut, readSessionCaptureOptOut, listSessionCaptureOptOut, fileSessionCaptureRecordStore, type SessionCaptureOptOutRecord, type SessionCaptureOptOutMarkOutcome, type SessionCaptureRecordStore, 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 ErasureSelect, type ErasedBinding, type MemoryErasureAttestation, computeMemoryBundleHash, type MemoryExportBundle, type MemoryImportReport, type MemoryExportSnapshot, type MemoryBundleImportPlan, type BundleChallengeRow, type BundleLineageRow, type BundlePollutedSession, type MemoryBackend, 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, 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";
211
+ export { MemoryEngine, FileMemoryEngineBackend, memoryBackendContract, assertMemoryBackendSearchEquivalence, type MemoryBackendContractHooks, buildMemoryInstruction, writableRootOf, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, deriveRepoControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, 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, readIntentCredentials, supersessionFuseCeiling, memoryConsolidationRecommendedNotice, memoryConsolidationCommittedNotice, memoryConsolidationConflictNotice, memoryConsolidationIncompleteNotice, memoryConsolidationRefusedNotice, memoryConsolidationWithheldNotice, type ConsolidationGateRead, type ConsolidationGateRow, type ConsolidationIntent, type ConsolidationIntentCredentialRow, type ConsolidationLeaseSeat, type ConsolidationProductProposal, type ConsolidationProposal, 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_DRIVER_PLANS_DIR, CONSOLIDATION_DRIVER_RUNS_FILE, CONSOLIDATION_RUN_STOP_REASONS, archiveDistillerPlan, readConsolidationDriverRun, runMemoryConsolidationDriver, type ConsolidationDriverEngine, type ConsolidationDriverRunRow, type ConsolidationRunReceipt, type ConsolidationRunStopReason, 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, SESSION_CAPTURE_OPTOUT_DIR, markSessionCaptureOptOut, readSessionCaptureOptOut, listSessionCaptureOptOut, fileSessionCaptureRecordStore, type SessionCaptureOptOutRecord, type SessionCaptureOptOutMarkOutcome, type SessionCaptureRecordStore, 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 ErasureSelect, type ErasedBinding, type MemoryErasureAttestation, computeMemoryBundleHash, type MemoryExportBundle, type MemoryImportReport, type MemoryExportSnapshot, type MemoryBundleImportPlan, type BundleChallengeRow, type BundleLineageRow, type BundlePollutedSession, type MemoryBackend, 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, 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";
212
212
  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";
213
213
  export { sharedMemoryStoreContract, type SharedMemoryFixture, type SharedMemoryStoreContractHooks, } from "./core/shared-memory/contract.js";
214
214
  export { termSet, jaccardDistance, cosineDistance } from "./core/memory-vector.js";
@@ -318,7 +318,7 @@ export { ROUTE_ADJUDICATION_CONFORMANCE_CORPUS, type RouteAdjudicationVector } f
318
318
  export { type BrainTimeoutConfig } from "./brain/timeout.js";
319
319
  export { createAssistantMessageEventStream } from "./internal/llm.js";
320
320
  export type { AssistantMessage, AssistantMessageEvent, CompleteSimpleFn, Context, DocumentContent, ImageContent, Message, StopReason, StreamFn, TextContent, ThinkingContent, ToolCall, ToolResultMessage, Usage, UserMessage, } from "./internal/llm.js";
321
- export type { AgentDefinition, BeforeWriteHook, BeforeWriteRequest, BeforeWriteResult, TrackFileEditHook, TrackEditRequest, TrackEditResult, FileEditedHook, FileEditedNotice, HandsBandOptions, Brain, BrainStatus, BrainStatusPhase, BrainRetryErrClass, ImageInput, McpElicitRequest, McpElicitResponse, McpServerSpec, A2aServerSpec, OnElicit, Model, ModelRef, ProjectMemoryLoad, RunnerDeps, ResumePreflightInfo, ResumePreflightVerdict, EngineNotice, RuntimeCaps, BackgroundChildEvent, DelegationLifecycleEvent, SkillManifest, SkillSpec, TaskEvent, TaskEventIdentity, ToolActivity, TaskLimits, StaleToolResultOffloadOptions, TaskResult, TerminalCause, PausedCause, EffectiveMemoryScopes, RemoteEnvFailureNote, TaskSpec, TaskStatus, TaskStream, CompactOutcome, ThinkingLevel, ToolExecuteContext, ToolReturn, ToolSpec, ToolInputVerdict, ToolInputValidationContext, ReversibilityVerdict, ToolEffect, ToolContentOrigin, WorkflowGovernanceBaseline, DelegationTaskType, } from "./core/types.js";
321
+ export type { AgentDefinition, BeforeWriteHook, BeforeWriteRequest, BeforeWriteResult, TrackFileEditHook, TrackEditRequest, TrackEditResult, FileEditedHook, FileEditedNotice, HandsBandOptions, Brain, BrainStatus, BrainStatusPhase, BrainRetryErrClass, ImageInput, McpElicitRequest, McpElicitResponse, McpServerSpec, A2aServerSpec, OnElicit, Model, ModelRef, ProjectMemoryLoad, RunnerDeps, ResumePreflightInfo, ResumePreflightVerdict, EngineNotice, RuntimeCaps, BackgroundChildEvent, DelegationLifecycleEvent, SkillManifest, SkillSpec, TaskEvent, TaskEventIdentity, ToolActivity, TaskLimits, StaleToolResultOffloadOptions, TaskResult, TerminalCause, PausedCause, EffectiveMemoryScopes, RemoteEnvFailureNote, TaskSpec, ShellGateDoctrine, TaskStatus, TaskStream, CompactOutcome, ThinkingLevel, ToolExecuteContext, ToolReturn, ToolSpec, ToolInputVerdict, ToolInputValidationContext, ReversibilityVerdict, ToolEffect, ToolContentOrigin, WorkflowGovernanceBaseline, DelegationTaskType, } from "./core/types.js";
322
322
  export { Type } from "typebox";
323
323
  export type { TSchema, Static } from "typebox";
324
324
  export { explainPromptAssembly, describeDefaultPack, type DefaultPackDescription, type ExplainInput } from "./prompt-assembly/explain.js";
package/dist/index.js CHANGED
@@ -26,7 +26,7 @@ export { resolveModel, resolveTaskModel, parseModelMention, expandTiers, DEFAULT
26
26
  export { selectModel, selectModelOrThrow } from "./core/select-model.js";
27
27
  export { BrainError, classifyHttp } from "./brain/errors.js";
28
28
  export { looksDegenerate, inspectDegenerate, trimDegenerateTail } from "./brain/repetition.js";
29
- export { computeCostMicroUsd, modelCostToPricing, } from "./core/pricing.js";
29
+ export { computeCostMicroUsd, isModelPriced, modelCostToPricing, } from "./core/pricing.js";
30
30
  export { cacheFamilyOf, promptTokensOf, uncachedInputTokensOf } from "./core/runner/usage-accounting.js";
31
31
  export { emitTrace } from "./core/trace.js";
32
32
  export { InMemoryStrategyStore, seedStrategies, } from "./core/strategy-store.js";
@@ -72,7 +72,7 @@ export { runExecGate } from "./core/exec-gate.js";
72
72
  export { sanitizeUntrustedText, delimitUntrusted, inlineUntrusted } from "./core/untrusted-text.js";
73
73
  export { mintReminderMark, isValidReminderMark, openSystemReminder, mintSystemReminder, reminderMarkDeclaration } from "./core/reminder-mint.js";
74
74
  export { deriveInvariants, checkInvariants } from "./core/property-harness.js";
75
- export { bashReversibilityProbe, BASH_READONLY_DEFAULT_ALLOW, parseLeadingCommandName, classifyCompoundReadonly, MAX_EDIT_BYTES } from "./tools/fs/index.js";
75
+ export { bashReversibilityProbe, bashReadBoundaryProbe, BASH_READONLY_DEFAULT_ALLOW, parseLeadingCommandName, classifyCompoundReadonly, MAX_EDIT_BYTES } from "./tools/fs/index.js";
76
76
  export { classifyCompoundReadonlyDetailed, formatOutOfRootReadApprovalOption, } from "./tools/fs/index.js";
77
77
  export { resolveBashTimeoutCaps } from "./tools/fs/index.js";
78
78
  export { READ_FACE_DEFAULT_DENY_ENTRIES, READ_FACE_BUILTIN_DENY_TABLE, READ_DENY_BUILTIN_TIERS, READ_DENY_DEFAULT_TIERS, resolveReadDenyBuiltins, compileReadDeny, } from "./tools/fs/index.js";
@@ -167,7 +167,7 @@ export { AdoptionError, assertAdoptionBootGate, readRootAdoptionFile, writeRootA
167
167
  export { adoptLocalDataRoot, ackAdoptionConfig, witnessAdoptionConfig, listAdoptionQuarantine, readAdoptionStatus, } from "./stores/file/adoption/adopt.js";
168
168
  export { formatHookFeedback, runToolGate, createHookEnvCapabilities, createPreToolUseConstraintPolicy, normalizePersistedRuleHit, } from "./core/hooks.js";
169
169
  export { InMemoryMemoryStore, composeMemoryBlock, composeLayeredMemoryBlock, normalizeMemorySpec, supportsConsolidation, supportsPeriodicConsolidation, firstSentence, expandLexicalTerms, lexicalSearchMatch, classifyPromotable, enforcePromotableWriteGate, guardedMemoryStore, MemoryGateError, detectSecret, enforceSecretWriteGate, enforceStructuredNoteSecretGate, } from "./core/memory.js";
170
- export { MemoryEngine, FileMemoryEngineBackend, memoryBackendContract, assertMemoryBackendSearchEquivalence, buildMemoryInstruction, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, deriveRepoControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, MEMORY_ORIGIN_CAUSES, committedOriginOf, originEquals, consolidationExposedFrontmatter, ambiguousOriginRepresentation, committedDistilledOf, distilledEquals, CONSOLIDATION_DEFAULTS, ConsolidationRefusedError, MEMORY_SEARCH_SUPERSEDED_TAG, consolidationTypeEligible, deriveSupersededSet, memorySupersededNote, readIntentCredentials, supersessionFuseCeiling, 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_DRIVER_PLANS_DIR, CONSOLIDATION_DRIVER_RUNS_FILE, CONSOLIDATION_RUN_STOP_REASONS, archiveDistillerPlan, readConsolidationDriverRun, runMemoryConsolidationDriver, isInstructionEntry, MEMORY_INSTRUCTION_TEMPLATE, MEMORY_RECALL_DISCIPLINE, MEMORY_PREFERENCE_DISCIPLINE, MEMORY_READONLY_NOTICE, MEMORY_CAPTURE_OPTOUT_NOTICE, memoryCaptureOptedOutNotice, memoryCaptureOptOutUnpersistedNotice, SESSION_CAPTURE_OPTOUT_DIR, markSessionCaptureOptOut, readSessionCaptureOptOut, listSessionCaptureOptOut, fileSessionCaptureRecordStore, 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, 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";
170
+ export { MemoryEngine, FileMemoryEngineBackend, memoryBackendContract, assertMemoryBackendSearchEquivalence, buildMemoryInstruction, writableRootOf, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, deriveRepoControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, MEMORY_ORIGIN_CAUSES, committedOriginOf, originEquals, consolidationExposedFrontmatter, ambiguousOriginRepresentation, committedDistilledOf, distilledEquals, CONSOLIDATION_DEFAULTS, ConsolidationRefusedError, MEMORY_SEARCH_SUPERSEDED_TAG, consolidationTypeEligible, deriveSupersededSet, memorySupersededNote, readIntentCredentials, supersessionFuseCeiling, 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_DRIVER_PLANS_DIR, CONSOLIDATION_DRIVER_RUNS_FILE, CONSOLIDATION_RUN_STOP_REASONS, archiveDistillerPlan, readConsolidationDriverRun, runMemoryConsolidationDriver, isInstructionEntry, MEMORY_INSTRUCTION_TEMPLATE, MEMORY_RECALL_DISCIPLINE, MEMORY_PREFERENCE_DISCIPLINE, MEMORY_READONLY_NOTICE, MEMORY_CAPTURE_OPTOUT_NOTICE, memoryCaptureOptedOutNotice, memoryCaptureOptOutUnpersistedNotice, SESSION_CAPTURE_OPTOUT_DIR, markSessionCaptureOptOut, readSessionCaptureOptOut, listSessionCaptureOptOut, fileSessionCaptureRecordStore, 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, 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";
171
171
  export { SHARED_MEMORY_READ_CAP_BYTES, SHARED_MEMORY_LIST_PAGE_SIZE, SharedMemoryStoreError, } from "./core/shared-memory/types.js";
172
172
  export { sharedMemoryStoreContract, } from "./core/shared-memory/contract.js";
173
173
  export { termSet, jaccardDistance, cosineDistance } from "./core/memory-vector.js";
@@ -1,22 +1,22 @@
1
1
  /**
2
2
  * Bare command names `bash_readonly` permits out of the box, ALSO the default reversible set for the
3
- * design/80 D-2 {@link import("./fs-bash.js").bashReversibilityProbe} classifier. **Coarse first filter, NOT a security
3
+ * The {@link import("./fs-bash.js").bashReversibilityProbe} classifier. **Coarse first filter, NOT a security
4
4
  * boundary**: {@link coarseReadonlyCheck} matches only the command NAME, so a listed command with a
5
5
  * writing flag (e.g. `find -delete`, `sort -o`, `tee`) would still write. Such commands are therefore
6
6
  * kept OFF this default — the list is curated to commands with NO write/mutation mode under ANY args, so
7
7
  * the `effect:"read"` declaration (relied on by wake/resume reconcile + the verifier read-only boundary)
8
8
  * AND the classifier's "reversible" promise both stay truthful. The deployment's tool-policy gate is the
9
- * authoritative control (design/44 §5, council blocker #1); anything that can mutate state or run arbitrary
9
+ * authoritative control (council blocker #1); anything that can mutate state or run arbitrary
10
10
  * code belongs on the full `bash` (effect:write, gated), not here. A deployment may widen this list,
11
11
  * accepting that responsibility.
12
12
  *
13
- * design/80 D-2 final-council MAJOR: `date` (`-s`/`--set` → CLOCK_SETTIME), `hostname` (`<name>` → kernel
13
+ * Deliberately ABSENT: `date` (`-s`/`--set` → CLOCK_SETTIME), `hostname` (`<name>` → kernel
14
14
  * hostname), and `file` (`-C -m` → compiles/writes a magic file) were REMOVED — each is read-only by NAME
15
15
  * but state-MUTATING with args, which an argv[0]-only filter cannot tell apart. Leaving them in defeated
16
16
  * both the `effect:read` truthfulness here and the classifier's irreversibility promise (a `date -s` would
17
17
  * auto-allow an irreversible clock jump under `shellGate:"classify"`).
18
18
  *
19
- * backlog #482 (CC parity): rows 3-4 are the CC-anchored expansion — the members of CC's safe-command
19
+ * Rows 3-4 are the CC-anchored expansion — the members of CC's safe-command
20
20
  * set (pretty223.js:420513-420565 `e6s`; identical in the 220 corpus; the 220→245 campaign diff records
21
21
  * no change on this face) that satisfy THIS list's curation bar (no write/mutation mode under any args)
22
22
  * without new stdin-floor/option-value modeling: pure status/computation printers (`cal`…`sleep` — none
@@ -27,7 +27,7 @@
27
27
  * `uniq` (second positional is an OUTPUT file; CC allows a flags-only regex form this filter cannot
28
28
  * express), `printf` (builtin `-v var` assigns), `find` (CC allows only a regex excluding
29
29
  * `-delete`/`-exec`/…), and the bare-stdin text filters (`od`/`strings`/`nl`/`tsort`/`pr`/…) whose
30
- * value-taking options defeat the stdin-floor operand count without a per-verb option-value model (#109)
30
+ * value-taking options defeat the stdin-floor operand count without a per-verb option-value model
31
31
  * — those are a follow-on slice, not a silent drop.
32
32
  */
33
33
  /** The verdict every unresolvable / out-of-root / unbounded finding ends on. The findings differ in what
@@ -35,7 +35,7 @@
35
35
  export declare const NOT_AUTO_ALLOWED = "\u2014 not auto-allowed";
36
36
  export declare const BASH_READONLY_DEFAULT_ALLOW: readonly string[];
37
37
  /**
38
- * backlog #482 slice 2 — the CLASSIFY face's default allow set: the shared list PLUS the verbs that are
38
+ * The CLASSIFY face's default allow set: the shared list PLUS the verbs that are
39
39
  * admissible only where the compound classifier's per-verb judgment runs, and NOT on the shared list's
40
40
  * other consumer faces:
41
41
  * · `find` — read-only only when no CC `aCy` dangerous predicate token is present (guard arm);
@@ -123,13 +123,13 @@ export declare function parseLeadingCommandName(command: string, options?: Leadi
123
123
  * with no shell operators. It validates the NAME only (+ blocks operators/path-prefix/env-assignment); it
124
124
  * does NOT inspect arguments for write flags — keeping the allowlist free of write-capable commands and
125
125
  * the policy gate are what make `effect:"read"` truthful. Returns a reason when rejected, else undefined.
126
- * design/154: this `effect:"read"` DECLARATION face deliberately stays strict-single-command; only the
126
+ * This `effect:"read"` DECLARATION face deliberately stays strict-single-command; only the
127
127
  * classify face ({@link classifyCompoundReadonly} via {@link import("./fs-bash.js").bashReversibilityProbe}) segments compounds. */
128
128
  export declare function coarseReadonlyCheck(command: string, allow: ReadonlySet<string>, options?: LeadingCommandNameOptions): string | undefined;
129
129
  /**
130
130
  * Does this text carry a bare redirection operator — the ONE metacharacter family
131
- * {@link splitShellCompoundSegments} can be asked to tolerate at its whole-string gate (#490 修①,
132
- * `redirection: "tolerate"`)?
131
+ * {@link splitShellCompoundSegments} can be asked to tolerate at its whole-string gate
132
+ * (`redirection: "tolerate"`)?
133
133
  *
134
134
  * Exported because the tolerating caller owes a PER-SEGMENT judgement in its place, and that judgement
135
135
  * must read the same character class this module tolerated — two hand-kept lists would drift, and a
@@ -162,7 +162,7 @@ export interface ShellCompoundSegments {
162
162
  * bash's quoted regions and the unquoted connectors are exactly bash's command boundaries. Callers
163
163
  * that tolerate a narrow redirection subset (the read-only classify face and its two data-free
164
164
  * spellings) remove those words BEFORE calling; nothing here restores them. `redirection:
165
- * "tolerate"` (#490 修①) narrows this step to {@link rejectedSansRedirection} — the mask argument
165
+ * "tolerate"` narrows this step to {@link rejectedSansRedirection} — the mask argument
166
166
  * is untouched (`<`/`>` neither quote nor bound) and the refusal moves to the caller's per-segment
167
167
  * vetting via {@link carriesShellRedirection}. The default refuses the whole string as it always did.
168
168
  * 2. one trailing `;` is stripped — a no-op terminator, not an empty command. OPTIONAL, because it is
@@ -189,7 +189,7 @@ export declare function splitShellCompoundSegments(source: string, options?: {
189
189
  reject: string;
190
190
  };
191
191
  /**
192
- * RB-412 — the READ-BOUNDARY face of the read-only classification (opt-in).
192
+ * The READ-BOUNDARY face of the read-only classification (opt-in).
193
193
  *
194
194
  * The allowlist vets `argv[0]` only, so until this face existed every listed reader could name ANY
195
195
  * path: `ls /etc` and `cat /etc/passwd` classified read-only, and a deployment whose manual-mode shell
@@ -198,7 +198,7 @@ export declare function splitShellCompoundSegments(source: string, options?: {
198
198
  * pretty220 @457568) and renders an approval option naming the directory (@905642 (cli250.js:66007)).
199
199
  *
200
200
  * Supplying this object turns the check ON; omitting it leaves the classifier byte-identical to its
201
- * pre-RB-412 behaviour, so a consumer pinned to an older calling convention is unaffected.
201
+ * name-only behaviour, so a consumer pinned to an older calling convention is unaffected.
202
202
  */
203
203
  export interface BashReadonlyRootBoundary {
204
204
  /** Canonical containment roots — the primary root plus any additional allowed directories. An EMPTY
@@ -213,13 +213,13 @@ export interface BashReadonlyRootBoundary {
213
213
  * out-of-root signal — the classifier does not know where it points, which is a different verdict
214
214
  * from knowing it points outside). */
215
215
  homeDir?: string;
216
- /** design/199 件B — the sensitive-path read deny judge over LEXICALLY RESOLVED operands: a hit
216
+ /** The sensitive-path read deny judge over LEXICALLY RESOLVED operands: a hit
217
217
  * demotes the command (ask, never auto-allow), independently of the roots — in-root operands are
218
218
  * judged too. Returns the matched pattern, or null. TWO named residuals, both inherited from this
219
- * classifier's declared purity (synchronous, zero I/O — RB-448/RB-451 state the same scope for the
219
+ * classifier's declared purity (synchronous, zero I/O — the same scope stated for the
220
220
  * containment half): ① operand TARGET matching only — no ancestor intersection: the judge sees
221
221
  * the operand's own resolved spelling, never its subtree. The RECURSIVE-reach half of that
222
- * residual has since been narrowed (backlog #222): a listed recursive/expanding verb's path
222
+ * residual has since been narrowed: a listed recursive/expanding verb's path
223
223
  * operand under this wired seat rides {@link CompoundReadonlyVerdict.recursiveReadPaths}
224
224
  * (⊂ undecidedPaths), so `grep -r x ~/` no longer auto-allows — it demotes to ask through the
225
225
  * undecided contract. What REMAINS of ① is the form table's stated open set (see the KNOWN OPEN
@@ -230,19 +230,19 @@ export interface BashReadonlyRootBoundary {
230
230
  * (the enforcing/canonicalizing recheck is the bash_readonly leg's job via checkedPaths; the
231
231
  * classify auto-allow lane has no I/O seat by contract). The structured read faces judge BOTH
232
232
  * views (canonical + lexical) — this seat is the shell lane's honest-friction floor, not its
233
- * security boundary (§3.0). The `bash_readonly` face deliberately does NOT wire this seat (its
233
+ * security boundary. The `bash_readonly` face deliberately does NOT wire this seat (its
234
234
  * roots containment + command allowlist double gate is the deployment's own read-safety
235
235
  * declaration — v1 ruling). */
236
236
  denyMatch?: (resolvedPath: string) => string | null;
237
- /** design/199 件A — the resolved read-face containment state. Under "open" the CONTAINMENT half of
237
+ /** The resolved read-face containment state. Under "open" the CONTAINMENT half of
238
238
  * this boundary is structurally satisfied (an out-of-roots operand is not a demotion; it reports
239
- * as a checked candidate instead), while the deny half above keeps judging in both faces (§2.0).
239
+ * as a checked candidate instead), while the deny half above keeps judging in both faces.
240
240
  * Absent ⇒ "roots" (byte-compat). The `bash_readonly` face never passes this seat — its
241
241
  * containment is load-bearing and never opens. */
242
242
  face?: "open" | "roots";
243
243
  }
244
244
  /**
245
- * RB-412 — the structured verdict of {@link classifyCompoundReadonlyDetailed}. `reason === undefined`
245
+ * The structured verdict of {@link classifyCompoundReadonlyDetailed}. `reason === undefined`
246
246
  * is the read-only verdict; everything else is a demotion.
247
247
  */
248
248
  export interface CompoundReadonlyVerdict {
@@ -262,7 +262,7 @@ export interface CompoundReadonlyVerdict {
262
262
  * tier question, never one the read face itself asked. Structural sibling of `outOfRootRead`. */
263
263
  readDenied?: true;
264
264
  /**
265
- * RB-451 — the paths this scan resolved INSIDE the roots (de-duplicated, first-seen order), i.e. the
265
+ * The paths this scan resolved INSIDE the roots (de-duplicated, first-seen order), i.e. the
266
266
  * candidates a caller holding a filesystem should re-check with symlinks resolved. Absent when there
267
267
  * are none.
268
268
  *
@@ -287,7 +287,7 @@ export interface CompoundReadonlyVerdict {
287
287
  */
288
288
  checkedPaths?: readonly string[];
289
289
  /**
290
- * RB-474 — operands whose spelling carries an UNEXPANDED glob (`*`, `?`, `[…]`, unquoted). Lexical
290
+ * Operands whose spelling carries an UNEXPANDED glob (`*`, `?`, `[…]`, unquoted). Lexical
291
291
  * containment is not decidable for them: the shell expands the pattern AFTER this verdict is made, and
292
292
  * inside a root an expansion can land on a symlink that points out of it (`cat *` where the directory
293
293
  * holds a link to an out-of-root file — reproduced end-to-end, not a theoretical shape).
@@ -333,8 +333,8 @@ export interface CompoundReadonlyVerdict {
333
333
  recursiveReadPaths?: readonly string[];
334
334
  }
335
335
  /**
336
- * RB-412 — the single minting point for the out-of-root-read approval option text, so a gate rendering
337
- * the prompt and any other consumer cannot drift apart. Shape follows CC 2.1.220 (@905642 (cli250.js:66007)): the option
336
+ * The single minting point for the out-of-root-read approval option text, so a gate rendering
337
+ * the prompt and any other consumer cannot drift apart. Shape follows CC: the option
338
338
  * shows the LAST segment of the grantable directory followed by a separator, not the full path.
339
339
  *
340
340
  * `directory` is the directory to be granted — a caller holding a filesystem (this classifier does not)
@@ -344,13 +344,13 @@ export interface CompoundReadonlyVerdict {
344
344
  */
345
345
  export declare function formatOutOfRootReadApprovalOption(directory: string): string;
346
346
  /**
347
- * RB-412 — {@link classifyCompoundReadonly} with the structured verdict. The name/operator/blocking arms
347
+ * {@link classifyCompoundReadonly} with the structured verdict. The name/operator/blocking arms
348
348
  * run FIRST and unchanged, so an existing demotion keeps its exact reason and never acquires the
349
349
  * out-of-root signal; the boundary scan below only ever converts a would-be READ-ONLY verdict into a
350
- * demotion, which is why omitting `boundary` reproduces the pre-RB-412 behaviour exactly.
350
+ * demotion, which is why omitting `boundary` reproduces the name-only behaviour exactly.
351
351
  */
352
352
  export declare function classifyCompoundReadonlyDetailed(command: string, allow: ReadonlySet<string>, boundary?: BashReadonlyRootBoundary,
353
- /** backlog #482 slice 3 (C4): the poll-loop face passes `iterated:true` over a body REPLICATED
353
+ /** The poll-loop face passes `iterated:true` over a body REPLICATED
354
354
  * `beats` times — a single cd repeated per iteration is a legitimate accumulating shift, not the
355
355
  * ">1 cd = ask for clarity" compound CC refuses (a `for` loop is a sema-only face; CC asks for any
356
356
  * loop). It suppresses ONLY that multi-cd refuse; every read is still threaded + boundary-judged
@@ -359,7 +359,7 @@ opts?: {
359
359
  readonly iterated?: boolean;
360
360
  }): CompoundReadonlyVerdict;
361
361
  /**
362
- * RB-413 — the read boundary ALONE, for the `bash_readonly` face.
362
+ * The read boundary ALONE, for the `bash_readonly` face.
363
363
  *
364
364
  * `bash_readonly` declares `effect:"read"` and is admitted by {@link coarseReadonlyCheck}, an argv[0]-NAME
365
365
  * filter: path operands were invisible to it, so an allowlisted reader could name any file on the host
@@ -379,16 +379,16 @@ opts?: {
379
379
  * kinds — resolved-and-outside (`outOfRootRead`, with `outOfRootPaths`) and could-not-resolve (reason
380
380
  * only) — as a refusal; there is nowhere to degrade to.
381
381
  *
382
- * SCOPE OF THE GUARANTEE (RB-448, both directions): "inside the roots" is LEXICAL containment — see
382
+ * SCOPE OF THE GUARANTEE (both directions): "inside the roots" is LEXICAL containment — see
383
383
  * {@link resolveOperandLexically}. A symlink inside a root that points out of it reads as in-root here,
384
384
  * so this face bounds where a command may NAME a file, not where the kernel will ultimately take it.
385
- * RB-451 — a deployment that needs filesystem-true containment resolves the operands itself, and this
385
+ * A deployment that needs filesystem-true containment resolves the operands itself, and this
386
386
  * verdict hands it the list to resolve ({@link CompoundReadonlyVerdict.checkedPaths}, on both arms).
387
387
  * `createBashReadonlyTool` is that caller for the `bash_readonly` leg and does it on a local env.
388
388
  */
389
389
  export declare function classifySimpleCommandReadBoundary(command: string, boundary: BashReadonlyRootBoundary): CompoundReadonlyVerdict;
390
390
  /**
391
- * #502 — what {@link classifyOutOfRootReadGate} answers. Two members and one rule between them:
391
+ * What {@link classifyOutOfRootReadGate} answers. Two members and one rule between them:
392
392
  * `paths` is EVIDENCE for a `gated` answer, never the answer itself. A caller decides on `gated`.
393
393
  */
394
394
  export interface OutOfRootReadGateVerdict {
@@ -404,7 +404,7 @@ export interface OutOfRootReadGateVerdict {
404
404
  * Exported for that one assertion — production code reads the constant directly. */
405
405
  export declare const COMMAND_LAUNCHERS_FOR_TEST: ReadonlySet<string>;
406
406
  /**
407
- * #502 — the OUT-OF-ROOT READ GATE asked as its OWN question: does any listed reader in this command
407
+ * The OUT-OF-ROOT READ GATE asked as its OWN question: does any listed reader in this command
408
408
  * name a path outside the allowed directories?
409
409
  *
410
410
  * {@link classifyCompoundReadonlyDetailed} answers a different question — "is this whole command
@@ -435,7 +435,7 @@ export declare const COMMAND_LAUNCHERS_FOR_TEST: ReadonlySet<string>;
435
435
  * unchanged on the full face, and this one keeps answering its own question underneath it.
436
436
  * · `face: "open"` is honoured: under the open read face containment is structurally satisfied, an
437
437
  * out-of-roots operand is not a finding, and this gate is silent — a full-read deployment sees no
438
- * gate here, by the same one mechanism §2.0 already defines.
438
+ * gate here, by the same one mechanism the face already defines.
439
439
  *
440
440
  * Answers `gated` with the resolved paths behind it, and NOT gated for every whole-string refusal (an
441
441
  * unparseable grammar, a substitution, a redirection) and for an operand that cannot be resolved
@@ -456,12 +456,12 @@ export declare const COMMAND_LAUNCHERS_FOR_TEST: ReadonlySet<string>;
456
456
  */
457
457
  export declare function classifyOutOfRootReadGate(command: string, allow: ReadonlySet<string>, boundary: BashReadonlyRootBoundary): OutOfRootReadGateVerdict;
458
458
  /**
459
- * design/154 — compound read-only classification, reason-only face. Returns the demotion reason, or
459
+ * Compound read-only classification, reason-only face. Returns the demotion reason, or
460
460
  * undefined when the command classifies read-only. ⚠️ `undefined` is NOT "safe to auto-execute":
461
461
  * the detailed verdict may still carry `undecidedPaths` (operands whose unexpanded spelling — a
462
462
  * glob — is what got checked), and this face discards that field. An auto-allow decision must read
463
463
  * {@link classifyCompoundReadonlyDetailed} and treat a non-empty `undecidedPaths` as ask — the
464
- * engine's own probe does exactly that (fs-bash.ts). RB-412 added the optional `boundary`: with it,
464
+ * engine's own probe does exactly that (fs-bash.ts). The optional `boundary`: with it,
465
465
  * an allowlisted reader whose path arguments leave the allowed directories is demoted too (use the
466
466
  * detailed face when the caller wants to know WHY, e.g. to offer the narrow "allow reading from
467
467
  * <dir>" approval); without it the verdict is exactly what it always was.
@@ -477,7 +477,7 @@ export declare function classifyCompoundReadonly(command: string, allow: Readonl
477
477
  export declare const POLL_LOOP_MAX_BEATS = 120;
478
478
  /**
479
479
  * Per-`sleep` cap (seconds) for {@link classifyBoundedReadonlyPollLoop}. A literal `sleep 99999999`
480
- * is technically bounded but practically a hang — the same hazard class the RB-41 availability arms
480
+ * is technically bounded but practically a hang — the same hazard class the availability arms
481
481
  * demote (a green verdict that blocks until the tool timeout is green in name only).
482
482
  */
483
483
  export declare const POLL_LOOP_MAX_SLEEP_SECONDS = 600;
@@ -497,7 +497,7 @@ export declare const POLL_LOOP_MAX_SLEEP_SECONDS = 600;
497
497
  * maps to a test group in test/poll-loop-classifier.test.ts (G1-G6):
498
498
  * G1 BOUNDED TERMINATION. The loop head must be one of three LITERAL forms with a computable
499
499
  * iteration count ≤ {@link POLL_LOOP_MAX_BEATS} ({@link pollLoopBeatsOf}); `while`/`until` never
500
- * match the skeleton. Every body command terminates: non-`sleep` segments inherit the RB-41/84/
500
+ * match the skeleton. Every body command terminates: non-`sleep` segments inherit the availability/
501
501
  * 108/153 availability arms via {@link classifyCompoundReadonlyDetailed} (blocking stdin, `tail
502
502
  * -f`, unbounded devices all reject), and `sleep` must be a literal ≤
503
503
  * {@link POLL_LOOP_MAX_SLEEP_SECONDS}. Bounded beats × terminating body ⇒ the loop halts.
@@ -512,7 +512,7 @@ export declare const POLL_LOOP_MAX_SLEEP_SECONDS = 600;
512
512
  * the allowlist. Nothing can chain past the vetted segment heads.
513
513
  * G4 READ BOUNDARY UNCHANGED. The reassembled body goes through the boundary scan of
514
514
  * {@link classifyCompoundReadonlyDetailed} with the caller's boundary — out-of-root operands
515
- * reject exactly as on the plain face (RB-412/413, not relaxed by one rule). STRICTER here: a
515
+ * reject exactly as on the plain face (not relaxed by one rule). STRICTER here: a
516
516
  * verdict carrying {@link CompoundReadonlyVerdict.undecidedPaths} (an unexpanded glob) rejects,
517
517
  * because the probe face is reason-only and a repeated read of a runtime-decided target must not
518
518
  * auto-allow.
@@ -534,7 +534,7 @@ export declare const POLL_LOOP_MAX_SLEEP_SECONDS = 600;
534
534
  * so the counter is write-only and inert.
535
535
  *
536
536
  * ACCEPTED-COST NOTES (the residuals, recorded rather than silently tolerated — same posture as the
537
- * RB-84 `head` note above):
537
+ * `head` note above):
538
538
  * · `$(seq …)` RESOLVES A COMMAND. This is the ONE command-substitution form the ruling exempts, and
539
539
  * it does run whatever `seq` resolves to on PATH (or a shell function/alias of that name). Two
540
540
  * facts bound the exposure. FIRST, the trust assumption is ISOMORPHIC to the allowlist itself:
@@ -547,8 +547,8 @@ export declare const POLL_LOOP_MAX_SLEEP_SECONDS = 600;
547
547
  * no-egress envelope — every beat still runs allowlisted readers + literal `sleep`), and the
548
548
  * walltime axis cascades a hard kill regardless. A deployment wanting NO command-substitution at
549
549
  * all can prefer `{<lo>..<hi>}` or a literal list, which bash expands internally with no command
550
- * run. (falsification review flagged the substitution as [high] and recommended dropping it;
551
- * kept per the ruling that names `$(seq <int> <int>)` as the one exemption — recorded for a
550
+ * run. (The substitution is a flagged, high-severity shape kept per the ruling that names
551
+ * `$(seq <int> <int>)` as the one exemption — recorded for a
552
552
  * tightening decision, since the brace form is a drop-in equivalent.)
553
553
  * · STDIN-BLOCKING BODY (an availability residual, not a safety one). CLOSED for the shape this note
554
554
  * used to record: a quoted multiword operand like `grep "x y"` read, to the then whitespace-blind
@@ -1,25 +1,19 @@
1
1
  /**
2
- * 编码 parity 批(docs/CC-TOOL-PARITY-SWEEP-2026-07.md P0)— file encoding + line-ending detection
3
- * for the Read/Edit/Write band, ported from CC's `utils/fileRead.ts` mechanism and hardened where CC
4
- * is lossy:
2
+ * File encoding + line-ending detection for the Read/Edit/Write band, ported from CC's
3
+ * `utils/fileRead.ts` mechanism and hardened where CC is lossy:
5
4
  *
6
- * - BOM detection: `FF FE` → utf16le, `EF BB BF` → utf8-with-BOM, else plain utf8. (CC 88→2.1.187
7
- * dynamic-verified: detection is BOM-only; UTF-16BE / heuristic sniffing deliberately NOT done —
8
- * a wrong guess silently corrupts, and the BOM-less case stays a refusal at the Read layer.)
5
+ * - BOM detection: `FF FE` → utf16le, `EF BB BF` → utf8-with-BOM, else plain utf8. Detection is
6
+ * BOM-only; UTF-16BE / heuristic sniffing is deliberately NOT done — a wrong guess silently
7
+ * corrupts, and the BOM-less case stays a refusal at the Read layer.
9
8
  * - The MODEL-FACING text is BOM-stripped and CRLF-normalized (what the model quotes in `old_string`
10
- * must match what Read showed it).
11
- * RB-285 (encoding LOW, 归因收窄 — CC 220 亲核): the blanket "(CC parity)" that used to sit on this
12
- * line was half wrong, because CC has TWO read lanes and they disagree with each other.
13
- * · CRLF-normalize parity on both lanes (`Zr_` @276877 and `Mqe` @58197 both `replaceAll`).
14
- * · BOM-strip — parity on CC's READ lane only (`Zr_` @276877: `charCodeAt(0) === 65279 slice(1)`).
15
- * CC's EDIT/WRITE lane (`Mqe`) does NOT strip: it hands the model text with the leading U+FEFF
16
- * still in it, and only the staleness/hash coordinate (`X9` = `CTe` + CRLF, @365630-365635)
17
- * strips. sema strips in ONE shared decoder for every lane, so the model-facing view and the
18
- * hash coordinate cannot drift apart — an improvement over CC's split, recorded as such rather
19
- * than claimed as parity.
20
- * - Write-back re-encodes with the ORIGINAL encoding, PRESERVES the BOM (CC drops it on Write — its
21
- * lossy face, dynamic-verified W1; we keep it, recorded as a deliberate improvement), and restores
22
- * the file's dominant line endings for Edit (Write keeps the model's endings as-is, CC decision).
9
+ * must match what Read showed it). CRLF-normalize is parity on both of CC's read lanes; BOM-strip
10
+ * is parity on CC's READ lane only CC's EDIT/WRITE lane hands the model text with the leading
11
+ * U+FEFF still in it and strips only inside its staleness/hash coordinate. sema strips in ONE
12
+ * shared decoder for every lane, so the model-facing view and the hash coordinate cannot drift
13
+ * apart: a registered delta, not parity.
14
+ * - Write-back re-encodes with the ORIGINAL encoding, PRESERVES the BOM (CC drops it on Write — a
15
+ * registered deliberate improvement), and restores the file's dominant line endings for Edit
16
+ * (Write keeps the model's endings as-is, CC decision).
23
17
  */
24
18
  /** Detected byte-level encoding of a text file (BOM-driven; utf8 is the no-BOM default). */
25
19
  export interface DetectedFileEncoding {
@@ -31,19 +25,17 @@ export interface DecodedTextFile {
31
25
  /** Model-facing text: BOM stripped, `\r\n` normalized to `\n`. The staleness-hash coordinate. */
32
26
  text: string;
33
27
  encoding: DetectedFileEncoding;
34
- /** Dominant line ending of the ORIGINAL bytes (majority vote CC `CKt` @58184 同算法).
28
+ /** Dominant line ending of the ORIGINAL bytes (majority vote; CC's counting rule).
35
29
  * Deliberately NOT per-line lossless: a mixed-endings file is unified to the dominant ending on
36
- * the first edit (镜头1/2 LOW, accepted non-goal — CC behaves the same way).
37
- * RB-285 (encoding LOW): the COUNTING RULE is CC's; the SAMPLE is not. CC votes on the first 4096
38
- * characters only (`CKt(s.slice(0, 4096))` @58201) while {@link detectLineEndings} below votes on
39
- * the whole file so a file whose first 4KB is LF and whose bulk is CRLF gets opposite verdicts.
40
- * sema's whole-file vote is kept on purpose: the verdict decides what an Edit WRITES BACK across
41
- * the entire file, so sampling a prefix is exactly the case where the cheap answer flips the
42
- * remaining 99% of the lines. Registered as a deliberate delta, not parity. */
30
+ * the first edit (accepted non-goal — CC behaves the same way).
31
+ * The SAMPLE is a registered delta: CC votes on the first 4096 characters only, while
32
+ * {@link detectLineEndings} below votes on the whole file. The verdict decides what an Edit WRITES
33
+ * BACK across the entire file, so sampling a prefix is exactly the case where the cheap answer
34
+ * flips the remaining 99% of the lines. */
43
35
  endings: DetectedLineEndings;
44
- /** 双镜头 MED: a utf16le body with an ODD byte count is TRUNCATED/corrupt — decoding would
45
- * silently drop the dangling byte and a later write-back would destroy it permanently. Flagged so
46
- * the tool layer fails closed instead of "repairing" the file. */
36
+ /** A utf16le body with an ODD byte count is TRUNCATED/corrupt — decoding would silently drop the
37
+ * dangling byte and a later write-back would destroy it permanently. Flagged so the tool layer
38
+ * fails closed instead of "repairing" the file. */
47
39
  malformed?: true;
48
40
  }
49
41
  /** BOM-only encoding detection (CC `detectEncodingForResolvedPath` parity — no content heuristics). */
@@ -56,8 +48,8 @@ export declare function decodeTextBytes(bytes: Uint8Array): DecodedTextFile;
56
48
  * @param text normalized (`\n`) text when `endings` is CRLF/LF (Edit path — restore the file's
57
49
  * dominant endings); pass `endings:"preserve"` to write the text's OWN line endings untouched
58
50
  * (Write path — CC decision: the model sent explicit endings in `content` and meant them).
59
- * @returns a plain string for the no-BOM utf8 + LF-or-preserve fast path (byte-compatible with the
60
- * pre-batch writer), else the exact bytes (BOM + encoded body).
51
+ * @returns a plain string for the no-BOM utf8 + LF-or-preserve fast path, else the exact bytes
52
+ * (BOM + encoded body).
61
53
  */
62
54
  export declare function encodeTextForFile(text: string, encoding: DetectedFileEncoding, endings: DetectedLineEndings | "preserve"): string | Uint8Array;
63
55
  /** Normalize model-supplied match/replacement text the same way the file text was normalized
@@ -65,16 +57,15 @@ export declare function encodeTextForFile(text: string, encoding: DetectedFileEn
65
57
  * Deliberately does NOT strip a leading U+FEFF: an `old_string` starting with one may be quoting
66
58
  * genuine file content — use {@link normalizeFileText} only where the string stands for a whole file. */
67
59
  export declare function normalizeEditText(s: string): string;
68
- /** RB-222 — split a leading U+FEFF off MODEL-SUPPLIED whole-file text (CC `CTe` parity,
69
- * 220 @365630). The BOM is a file-level byte marker, not text: decodeTextBytes strips it on the way
70
- * in, so it can never live in the normalized coordinate. Only for strings that stand for a WHOLE
71
- * file (Write `content`, readFileState seeding) — a decoded file text's leading U+FEFF is genuine
72
- * content and must stay. */
60
+ /** Split a leading U+FEFF off MODEL-SUPPLIED whole-file text (CC parity). The BOM is a file-level
61
+ * byte marker, not text: decodeTextBytes strips it on the way in, so it can never live in the
62
+ * normalized coordinate. Only for strings that stand for a WHOLE file (Write `content`,
63
+ * readFileState seeding) — a decoded file text's leading U+FEFF is genuine content and must stay. */
73
64
  export declare function splitLeadingBom(text: string): {
74
65
  hadBom: boolean;
75
66
  text: string;
76
67
  };
77
- /** RB-222 — CC `X9` parity (220 @365635 = BOM-strip + CRLF-normalize): THE coordinate
78
- * every readFileState hash lives in (Read/Edit/Write staleness all hash `decodeTextBytes(...).text`).
79
- * A hash taken on raw model content with a leading U+FEFF can never agree with any later re-read. */
68
+ /** CC parity (BOM-strip + CRLF-normalize): THE coordinate every readFileState hash lives in
69
+ * (Read/Edit/Write staleness all hash `decodeTextBytes(...).text`). A hash taken on raw model content
70
+ * with a leading U+FEFF can never agree with any later re-read. */
80
71
  export declare function normalizeFileText(s: string): string;