@sema-agent/core 5.60.1 → 5.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +125 -0
- package/dist/agents/subagent.d.ts +4 -2
- package/dist/agents/subagent.js +9 -9
- package/dist/brain/open-responses.js +8 -3
- package/dist/brain/openai.js +4 -4
- package/dist/brain/stream-engine.d.ts +13 -2
- package/dist/brain/stream-engine.js +3 -3
- package/dist/core/auto-mode-prompt-assets.js +1 -1
- package/dist/core/checkpoint-store.d.ts +36 -4
- package/dist/core/checkpoint-store.js +1 -0
- package/dist/core/governance-codes.d.ts +1 -1
- package/dist/core/governance-codes.js +4 -2
- package/dist/core/hooks.d.ts +83 -4
- package/dist/core/hooks.js +3 -3
- package/dist/core/memory-engine/consolidation-driver.d.ts +19 -1
- package/dist/core/memory-engine/consolidation-driver.js +75 -3
- package/dist/core/memory-engine/consolidation.d.ts +52 -5
- package/dist/core/memory-engine/consolidation.js +3 -1
- package/dist/core/memory-engine/distiller.d.ts +89 -1
- package/dist/core/memory-engine/distiller.js +94 -5
- package/dist/core/memory-engine/engine.d.ts +8 -0
- package/dist/core/memory-engine/engine.js +51 -8
- package/dist/core/memory-engine/index.d.ts +1 -1
- package/dist/core/memory-engine/index.js +1 -1
- package/dist/core/park-selfcheck.js +2 -0
- package/dist/core/pricing.d.ts +24 -0
- package/dist/core/pricing.js +18 -0
- package/dist/core/runner/prepare-config-doors.d.ts +34 -0
- package/dist/core/runner/prepare-config-doors.js +55 -0
- package/dist/core/runner/prepare-task.d.ts +52 -10
- package/dist/core/runner/prepare-task.js +77 -42
- package/dist/core/runner/runtask.d.ts +7 -0
- package/dist/core/runner/runtask.js +254 -38
- package/dist/core/runner/turn-attachments.d.ts +137 -5
- package/dist/core/runner/turn-attachments.js +25 -2
- package/dist/core/store-contracts/checkpoint-store-contract.js +19 -0
- package/dist/core/task-notification.d.ts +50 -23
- package/dist/core/task-notification.js +20 -4
- package/dist/core/tool-errors.d.ts +2 -1
- package/dist/core/tool-policy.d.ts +27 -0
- package/dist/core/types.d.ts +214 -31
- package/dist/core/untrusted-text.d.ts +5 -4
- package/dist/core/untrusted-text.js +8 -0
- package/dist/core/usage-window-store.d.ts +109 -8
- package/dist/core/usage-window-store.js +79 -12
- package/dist/engine/harness/agent-harness.d.ts +58 -2
- package/dist/engine/harness/agent-harness.js +115 -5
- package/dist/engine/loop/agent-loop.js +153 -15
- package/dist/engine/loop/types.d.ts +32 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/orchestration/run-workflow-tool.d.ts +9 -4
- package/dist/orchestration/run-workflow-tool.js +1 -1
- package/dist/orchestration/workflow.d.ts +2 -2
- package/dist/prompt-assembly/event-registry.js +2 -0
- package/dist/server/http.d.ts +1 -1
- package/dist/stores/file/usage-window-store.d.ts +1 -1
- package/dist/stores/file/usage-window-store.js +27 -6
- package/dist/tools/loop-tick.js +1 -1
- package/dist/tools/monitor.d.ts +3 -3
- package/dist/tools/monitor.js +1 -1
- package/dist/tools/scheduler-tools.js +9 -1
- package/package.json +1 -1
- package/test/export-surface.snapshot.json +7 -1
|
@@ -380,6 +380,38 @@ export interface AgentLoopConfig extends SimpleStreamOptions {
|
|
|
380
380
|
* Contract: must not throw or reject. Return [] when no follow-up messages are available.
|
|
381
381
|
*/
|
|
382
382
|
getFollowUpMessages?: () => Promise<AgentMessage[]>;
|
|
383
|
+
/**
|
|
384
|
+
* design/373 S1 — the TURN-scoped interrupt seat. The loop publishes each main turn's own
|
|
385
|
+
* AbortController here BEFORE its pre-request injection re-check (the linearization the
|
|
386
|
+
* immediate-class contract depends on: an interrupt request that missed the re-check must find the
|
|
387
|
+
* seat already live), and retracts it (`undefined`) the moment the turn's provider stream + tool
|
|
388
|
+
* batch have settled — an interrupt landing in the between-turns window is a no-op whose frame
|
|
389
|
+
* simply rides the next boundary drain, mirroring the upstream form (only an in-flight request is
|
|
390
|
+
* ever aborted). Aborting the published controller cancels THIS turn only: the loop reconciles
|
|
391
|
+
* (real results for work that finished, paired never-started results for calls that never began,
|
|
392
|
+
* the interruption marker) and the run CONTINUES at the next boundary. The run-level signal always
|
|
393
|
+
* wins: when both fire, the loop takes the run-terminal path.
|
|
394
|
+
*/
|
|
395
|
+
publishTurnInterruptSeat?: (seat: AbortController | undefined) => void;
|
|
396
|
+
/**
|
|
397
|
+
* design/373 S1 — the pre-request re-check (the level half of the immediate-class contract):
|
|
398
|
+
* called once per turn, after the interrupt seat above is published and before the provider
|
|
399
|
+
* request, with the turn's pending injection batch. The host drains any queued immediate-class
|
|
400
|
+
* ("now") frames and returns the batch to inject — merged at their class position (after
|
|
401
|
+
* immediate frames already pending, ahead of everything else), so an immediate frame that arrived
|
|
402
|
+
* after the boundary drain still rides THIS request instead of waiting a whole turn.
|
|
403
|
+
*/
|
|
404
|
+
recheckImmediateInjections?: (pending: AgentMessage[]) => Promise<AgentMessage[]>;
|
|
405
|
+
/**
|
|
406
|
+
* design/373 S1 — the FINAL COMMIT POINT's synchronous double-check: how many queued injection
|
|
407
|
+
* frames a boundary drain could deliver right now (steer + follow-up, excluding frames a live
|
|
408
|
+
* hold or an unwinding run would refuse to drain). Consulted SYNCHRONOUSLY after the follow-up
|
|
409
|
+
* drain (and stop gate) answered empty, with zero awaits between the check and the terminal
|
|
410
|
+
* commit — a frame that arrived during the stop gate's await window is therefore served by this
|
|
411
|
+
* run instead of being stranded behind an already-decided terminal. Absent ⇒ the pre-373 commit
|
|
412
|
+
* behavior (the follow-up drain's answer is final).
|
|
413
|
+
*/
|
|
414
|
+
pendingInjectionCount?: () => number;
|
|
383
415
|
/**
|
|
384
416
|
* Tool execution mode.
|
|
385
417
|
* - "sequential": execute tool calls one by one
|
package/dist/index.d.ts
CHANGED
|
@@ -110,7 +110,7 @@ export { createSensitivePathPolicy, RECOMMENDED_SENSITIVE_PATTERNS } from "./cor
|
|
|
110
110
|
export { createFsWriteGatePolicy, type FsWriteGatePolicyOptions } from "./core/fs-write-gate-policy.js";
|
|
111
111
|
export { RETIRED_TOOL_NAMES } from "./core/tool-name-aliases.js";
|
|
112
112
|
export { DEFAULT_SUBAGENT_TOOL_NAME } from "./agents/subagent.js";
|
|
113
|
-
export { renderTaskNotificationXml, taskNotificationDedupKey, isDelegatedAgentTerminal, SystemInjectionQueue, type TaskNotificationPayload, type TaskNotificationStatus, type ExternalNotificationInput, type SystemInjection, type SystemInjectionPriority, } from "./core/task-notification.js";
|
|
113
|
+
export { renderTaskNotificationXml, taskNotificationDedupKey, isDelegatedAgentTerminal, isTerminalTaskNotification, SystemInjectionQueue, type TaskNotificationPayload, type TaskNotificationStatus, type ExternalNotificationInput, type SystemInjection, type SystemInjectionPriority, } from "./core/task-notification.js";
|
|
114
114
|
export { describeStaticWiring, deriveWiringManifest, deriveAskEffective, resolveDeclaredDurability, resolveSubagentTranscriptTier, type SubagentTranscriptTier, resolveAskSeamForm, resolveQuestionSeam, countElicitOptIns, type WiringManifest, type WiringFacts, type WiringLegKind, type AskSeamForm, type AskEffective, type QuestionChannelState, type SeamProvenance, type ParkLaneReason, type ManifestDurability, type StaticWiringDeps, type StaticWiringSpec, } from "./core/wiring-manifest.js";
|
|
115
115
|
export { probeParkRoundTrip, durableParkGapOf, durableParkGapFor, PARK_SELFCHECK_SCOPE_PREFIX, type ParkSelfCheckResult, type ParkProbeFinding, type ParkProbeFindingCode, } from "./core/park-selfcheck.js";
|
|
116
116
|
export { type StoreDurability } from "./core/checkpoint-store.js";
|
|
@@ -168,7 +168,7 @@ export { AdoptionError, assertAdoptionBootGate, readRootAdoptionFile, writeRootA
|
|
|
168
168
|
export { adoptLocalDataRoot, ackAdoptionConfig, witnessAdoptionConfig, listAdoptionQuarantine, readAdoptionStatus, type AdoptionStatus, type AdoptLocalDataRootOptions, type AdoptLocalDataRootResult, type AdoptionCarriageLeg, type AdoptionCarriageLegContext, type AdoptionConfigWitnessReceipt, } from "./stores/file/adoption/adopt.js";
|
|
169
169
|
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, type PermissionDeniedSource, } from "./core/hooks.js";
|
|
170
170
|
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";
|
|
171
|
-
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, ambiguousOriginRepresentation, type OriginClearanceRow, type OriginClearanceEvent, committedDistilledOf, distilledEquals, type MemoryEntryDistilled, type MemoryEntryDistilledInput, CONSOLIDATION_DEFAULTS, ConsolidationRefusedError, MEMORY_SEARCH_SUPERSEDED_TAG, consolidationTypeEligible, deriveSupersededSet, memorySupersededNote, readIntentCredentials, supersessionFuseCeiling, memoryConsolidationRecommendedNotice, memoryConsolidationCommittedNotice, memoryConsolidationConflictNotice, memoryConsolidationIncompleteNotice, memoryConsolidationRefusedNotice, 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, 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, mintLlmConsolidationPlan, 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 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, readV2HeaderHints, type V2HeaderHints, LINEAGE_FILE, CHALLENGES_FILE, CHALLENGED_HISTORY_FILE, CHALLENGE_LEDGER_MAX_EVENTS, rebuildStrictControlPlaneLedger, type ControlPlaneRebuildReceipt, type StrictControlPlaneLedger, type ChallengeAssignment, type ChallengeEvent, type ChallengedHistoryRow, type LineagePendingTxn, type LineagePromotion, MEMORY_INDEX_FILENAME, MEMORY_INDEX_MAX_LINES, MEMORY_INDEX_MAX_BYTES, MEMORY_SEARCH_TOOL_NAME, MEMORY_GET_TOOL_NAME, MEMORY_ENGINE_TOOL_NAMES, type MemorySearchDetails, type MemorySearchHit, type CleanMemorySearchHit, type ExposedMemorySearchHit, MEMORY_EXPOSURE_BANNER, MEMORY_EXPOSURE_HANDLE_TAG, memoryExposureIndexRow, type MemoryGetDetails, STUB_ARCHIVED_LINE, DEFAULT_MAX_MEMORY_FILES, DEFAULT_MAX_ENTRY_DEPTH, DEFAULT_HARVEST_DEADLINE_MS, DEFAULT_HARVEST_FILE_BUDGET, MASS_DELETION_FUSE_RATIO, scanMemoryWrite, scanMemoryFileName, scanRemediation, MEMORY_FILENAME_SEGMENT_RE, renderAnnouncements, enqueueMemoryAnnouncement, drainMemoryAnnouncements, peekMemoryAnnouncements, bumpScanFuse, scanFuseCount, clearScanFuse, ANNOUNCEMENTS_FILE, MEMORY_ANNOUNCEMENTS_MAX, SCAN_FUSE_FILE, SCAN_FUSE_THRESHOLD, type MemoryAnnouncement, type ScanFinding, type MemoryEngineOptions, type MemoryInjection, type 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";
|
|
171
|
+
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, ambiguousOriginRepresentation, type OriginClearanceRow, type OriginClearanceEvent, committedDistilledOf, distilledEquals, type MemoryEntryDistilled, type MemoryEntryDistilledInput, CONSOLIDATION_DEFAULTS, ConsolidationRefusedError, MEMORY_SEARCH_SUPERSEDED_TAG, consolidationTypeEligible, deriveSupersededSet, memorySupersededNote, readIntentCredentials, supersessionFuseCeiling, memoryConsolidationRecommendedNotice, memoryConsolidationCommittedNotice, memoryConsolidationConflictNotice, memoryConsolidationIncompleteNotice, memoryConsolidationRefusedNotice, 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, 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, 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, readV2HeaderHints, type V2HeaderHints, LINEAGE_FILE, CHALLENGES_FILE, CHALLENGED_HISTORY_FILE, CHALLENGE_LEDGER_MAX_EVENTS, rebuildStrictControlPlaneLedger, type ControlPlaneRebuildReceipt, type StrictControlPlaneLedger, type ChallengeAssignment, type ChallengeEvent, type ChallengedHistoryRow, type LineagePendingTxn, type LineagePromotion, MEMORY_INDEX_FILENAME, MEMORY_INDEX_MAX_LINES, MEMORY_INDEX_MAX_BYTES, MEMORY_SEARCH_TOOL_NAME, MEMORY_GET_TOOL_NAME, MEMORY_ENGINE_TOOL_NAMES, type MemorySearchDetails, type MemorySearchHit, type CleanMemorySearchHit, type ExposedMemorySearchHit, MEMORY_EXPOSURE_BANNER, MEMORY_EXPOSURE_HANDLE_TAG, memoryExposureIndexRow, type MemoryGetDetails, STUB_ARCHIVED_LINE, DEFAULT_MAX_MEMORY_FILES, DEFAULT_MAX_ENTRY_DEPTH, DEFAULT_HARVEST_DEADLINE_MS, DEFAULT_HARVEST_FILE_BUDGET, MASS_DELETION_FUSE_RATIO, scanMemoryWrite, scanMemoryFileName, scanRemediation, MEMORY_FILENAME_SEGMENT_RE, renderAnnouncements, enqueueMemoryAnnouncement, drainMemoryAnnouncements, peekMemoryAnnouncements, bumpScanFuse, scanFuseCount, clearScanFuse, ANNOUNCEMENTS_FILE, MEMORY_ANNOUNCEMENTS_MAX, SCAN_FUSE_FILE, SCAN_FUSE_THRESHOLD, type MemoryAnnouncement, type ScanFinding, type MemoryEngineOptions, type MemoryInjection, type 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";
|
|
172
172
|
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";
|
|
173
173
|
export { sharedMemoryStoreContract, type SharedMemoryFixture, type SharedMemoryStoreContractHooks, } from "./core/shared-memory/contract.js";
|
|
174
174
|
export { termSet, jaccardDistance, cosineDistance } from "./core/memory-vector.js";
|
package/dist/index.js
CHANGED
|
@@ -89,7 +89,7 @@ export { createSensitivePathPolicy, RECOMMENDED_SENSITIVE_PATTERNS } from "./cor
|
|
|
89
89
|
export { createFsWriteGatePolicy } from "./core/fs-write-gate-policy.js";
|
|
90
90
|
export { RETIRED_TOOL_NAMES } from "./core/tool-name-aliases.js";
|
|
91
91
|
export { DEFAULT_SUBAGENT_TOOL_NAME } from "./agents/subagent.js";
|
|
92
|
-
export { renderTaskNotificationXml, taskNotificationDedupKey, isDelegatedAgentTerminal, SystemInjectionQueue, } from "./core/task-notification.js";
|
|
92
|
+
export { renderTaskNotificationXml, taskNotificationDedupKey, isDelegatedAgentTerminal, isTerminalTaskNotification, SystemInjectionQueue, } from "./core/task-notification.js";
|
|
93
93
|
export { describeStaticWiring, deriveWiringManifest, deriveAskEffective, resolveDeclaredDurability, resolveSubagentTranscriptTier, resolveAskSeamForm, resolveQuestionSeam, countElicitOptIns, } from "./core/wiring-manifest.js";
|
|
94
94
|
export { probeParkRoundTrip, durableParkGapOf, durableParkGapFor, PARK_SELFCHECK_SCOPE_PREFIX, } from "./core/park-selfcheck.js";
|
|
95
95
|
export {} from "./core/checkpoint-store.js";
|
|
@@ -130,7 +130,7 @@ export { AdoptionError, assertAdoptionBootGate, readRootAdoptionFile, writeRootA
|
|
|
130
130
|
export { adoptLocalDataRoot, ackAdoptionConfig, witnessAdoptionConfig, listAdoptionQuarantine, readAdoptionStatus, } from "./stores/file/adoption/adopt.js";
|
|
131
131
|
export { formatHookFeedback, runToolGate, createHookEnvCapabilities, createPreToolUseConstraintPolicy, normalizePersistedRuleHit, } from "./core/hooks.js";
|
|
132
132
|
export { InMemoryMemoryStore, composeMemoryBlock, composeLayeredMemoryBlock, normalizeMemorySpec, supportsConsolidation, supportsPeriodicConsolidation, firstSentence, expandLexicalTerms, lexicalSearchMatch, classifyPromotable, enforcePromotableWriteGate, guardedMemoryStore, MemoryGateError, detectSecret, enforceSecretWriteGate, enforceStructuredNoteSecretGate, } from "./core/memory.js";
|
|
133
|
-
export { MemoryEngine, FileMemoryEngineBackend, memoryBackendContract, assertMemoryBackendSearchEquivalence, buildMemoryInstruction, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, deriveRepoControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, MEMORY_ORIGIN_CAUSES, committedOriginOf, originEquals, ambiguousOriginRepresentation, committedDistilledOf, distilledEquals, CONSOLIDATION_DEFAULTS, ConsolidationRefusedError, MEMORY_SEARCH_SUPERSEDED_TAG, consolidationTypeEligible, deriveSupersededSet, memorySupersededNote, readIntentCredentials, supersessionFuseCeiling, memoryConsolidationRecommendedNotice, memoryConsolidationCommittedNotice, memoryConsolidationConflictNotice, memoryConsolidationIncompleteNotice, memoryConsolidationRefusedNotice, 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, mintLlmConsolidationPlan, 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, readV2HeaderHints, LINEAGE_FILE, CHALLENGES_FILE, CHALLENGED_HISTORY_FILE, CHALLENGE_LEDGER_MAX_EVENTS, rebuildStrictControlPlaneLedger, MEMORY_INDEX_FILENAME, MEMORY_INDEX_MAX_LINES, MEMORY_INDEX_MAX_BYTES, MEMORY_SEARCH_TOOL_NAME, MEMORY_GET_TOOL_NAME, MEMORY_ENGINE_TOOL_NAMES, 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";
|
|
133
|
+
export { MemoryEngine, FileMemoryEngineBackend, memoryBackendContract, assertMemoryBackendSearchEquivalence, buildMemoryInstruction, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, deriveRepoControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, MEMORY_ORIGIN_CAUSES, committedOriginOf, originEquals, ambiguousOriginRepresentation, committedDistilledOf, distilledEquals, CONSOLIDATION_DEFAULTS, ConsolidationRefusedError, MEMORY_SEARCH_SUPERSEDED_TAG, consolidationTypeEligible, deriveSupersededSet, memorySupersededNote, readIntentCredentials, supersessionFuseCeiling, memoryConsolidationRecommendedNotice, memoryConsolidationCommittedNotice, memoryConsolidationConflictNotice, memoryConsolidationIncompleteNotice, memoryConsolidationRefusedNotice, 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, 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, readV2HeaderHints, LINEAGE_FILE, CHALLENGES_FILE, CHALLENGED_HISTORY_FILE, CHALLENGE_LEDGER_MAX_EVENTS, rebuildStrictControlPlaneLedger, MEMORY_INDEX_FILENAME, MEMORY_INDEX_MAX_LINES, MEMORY_INDEX_MAX_BYTES, MEMORY_SEARCH_TOOL_NAME, MEMORY_GET_TOOL_NAME, MEMORY_ENGINE_TOOL_NAMES, 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";
|
|
134
134
|
export { SHARED_MEMORY_READ_CAP_BYTES, SHARED_MEMORY_LIST_PAGE_SIZE, SharedMemoryStoreError, } from "./core/shared-memory/types.js";
|
|
135
135
|
export { sharedMemoryStoreContract, } from "./core/shared-memory/contract.js";
|
|
136
136
|
export { termSet, jaccardDistance, cosineDistance } from "./core/memory-vector.js";
|
|
@@ -188,8 +188,13 @@ export interface RunWorkflowToolDeps {
|
|
|
188
188
|
rootSessionId?: string;
|
|
189
189
|
/** Process-local unified task registry. When present, RunWorkflow returns `task_id === runId` with a `w*` id. */
|
|
190
190
|
taskRegistry?: TaskRegistry;
|
|
191
|
-
/** design/115 P2 core slice: run-local task-notification sink for SDK event + live model XML injection.
|
|
192
|
-
|
|
191
|
+
/** design/115 P2 core slice: run-local task-notification sink for SDK event + live model XML injection.
|
|
192
|
+
* design/373 §3.7: the sink accepts the injection tier — workflow terminals declare `"next"`
|
|
193
|
+
* explicitly (a completion must reach a busy model at the boundary; the parameterless funnel
|
|
194
|
+
* default is the EXTERNAL lane's `"later"` and no internal lane may lean on it). */
|
|
195
|
+
taskNotification?: (notification: TaskNotificationPayload, opts?: {
|
|
196
|
+
priority?: "now" | "next" | "later";
|
|
197
|
+
}) => void;
|
|
193
198
|
/** Runner-owned owner fallback for registry access when the execute context is unavailable. */
|
|
194
199
|
taskOwner?: string;
|
|
195
200
|
/** Hard ceilings. */
|
|
@@ -273,8 +278,8 @@ export interface RunWorkflowToolDeps {
|
|
|
273
278
|
* (`RunnerDeps.onAsk`, else the fail-closed headless auto-deny). */
|
|
274
279
|
parentOnAsk?: import("../core/tool-policy.js").OnAsk;
|
|
275
280
|
/** The HOST run's display sink (its `RunInternals.onForwardEvent` behind the runner's ctx wrapper:
|
|
276
|
-
* `task_progress` always, plus the children's content events — `text_delta`/`
|
|
277
|
-
* `tool_start`/`tool_end`, UNTRUSTED-RAW: the consumer must redact — when the HOST spec set
|
|
281
|
+
* `task_progress` always, plus the children's content events — `text_delta`/`text_end`/
|
|
282
|
+
* `reasoning_delta`/`tool_start`/`tool_end`, UNTRUSTED-RAW: the consumer must redact — when the HOST spec set
|
|
278
283
|
* `forwardSubagentEvents: true`) — threaded via `startWorkflow` into every spawned agent's trusted
|
|
279
284
|
* internals so a workflow child's events bubble to the deployment's one sink, the same
|
|
280
285
|
* channel a `createSubagentTool` delegation threads. Display-only; absent ⇒ ticks stay in each
|
|
@@ -384,8 +384,8 @@ export interface RunWorkflowOptions {
|
|
|
384
384
|
parentCenterArtifactDigest?: string;
|
|
385
385
|
parentCenterSourceRevision?: string;
|
|
386
386
|
/** The launching run's display sink (`RunInternals.onForwardEvent` behind the runner's ctx wrapper:
|
|
387
|
-
* `task_progress` always, PLUS the children's content events — `text_delta`/`
|
|
388
|
-
* `tool_start`/`tool_end`, UNTRUSTED-RAW: the consumer must redact — when the HOST spec set
|
|
387
|
+
* `task_progress` always, PLUS the children's content events — `text_delta`/`text_end`/
|
|
388
|
+
* `reasoning_delta`/`tool_start`/`tool_end`, UNTRUSTED-RAW: the consumer must redact — when the HOST spec set
|
|
389
389
|
* `forwardSubagentEvents: true`) — threaded into every spawned agent's trusted internals so the
|
|
390
390
|
* children's events bubble out of their isolated streams to the deployment's one sink (fleet
|
|
391
391
|
* footer/monitor rows). Display-only; absent ⇒ ticks stay in each child's own stream. */
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
export const EVENT_PROMPT_REGISTRY = new Map([
|
|
2
2
|
{ kind: "todo_reminder", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "off", rendererRef: "turn-attachments.ts#TODO_REMINDER_BASE" },
|
|
3
3
|
{ kind: "task_reminder", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "off", rendererRef: "turn-attachments.ts#TASK_REMINDER_BASE" },
|
|
4
|
+
{ kind: "tool_search_usage_reminder", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "off", rendererRef: "turn-attachments.ts#renderToolSearchUsageReminder" },
|
|
4
5
|
{ kind: "changed_files", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "off", rendererRef: "turn-attachments.ts#renderChangedFiles" },
|
|
5
6
|
{ kind: "plan_mode", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "off", rendererRef: "turn-attachments.ts#PLAN_MODE_FULL_BODY" },
|
|
6
7
|
{ kind: "date_change", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "always", rendererRef: "turn-attachments.ts#renderDateChange" },
|
|
7
8
|
{ kind: "instructions_change", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", maxBytes: 512, defaultPolicy: "always", rendererRef: "turn-attachments.ts#collectInstructionsChange" },
|
|
8
9
|
{ kind: "workflow_size_guideline_change", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "always", rendererRef: "runtask.ts#workflowSizeGuidelineChangeNotice" },
|
|
9
10
|
{ kind: "budget_usd", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "off", rendererRef: "turn-attachments.ts#renderBudgetUsd" },
|
|
11
|
+
{ kind: "total_tokens_reminder", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "off", rendererRef: "turn-attachments.ts#renderTotalTokensReminder" },
|
|
10
12
|
{ kind: "background_tasks", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "on", rendererRef: "turn-attachments.ts#renderBackgroundTasks" },
|
|
11
13
|
{ kind: "tools_delta", carrier: "message.user-prefix", trust: "external", dedupe: "replace-by-key", defaultPolicy: "off", rendererRef: "turn-attachments.ts#renderToolsDelta" },
|
|
12
14
|
{ kind: "agent_listing", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "on", rendererRef: "turn-attachments.ts#renderAgentListingDelta" },
|
package/dist/server/http.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export interface TaskServerOptions {
|
|
|
27
27
|
/**
|
|
28
28
|
* Create an HTTP server exposing the runner over two endpoints:
|
|
29
29
|
* POST /task → run to completion, returns TaskResult JSON
|
|
30
|
-
* POST /task/stream → Server-Sent Events of TaskEvent (text_delta / reasoning_delta / tool_* / done)
|
|
30
|
+
* POST /task/stream → Server-Sent Events of TaskEvent (text_delta / text_end / reasoning_delta / tool_* / done)
|
|
31
31
|
*
|
|
32
32
|
* The request body provides { objective, sessionId?, images? }; `resolveSpec` supplies the rest
|
|
33
33
|
* (model, tools, mcp, systemPrompt, limits) server-side.
|
|
@@ -22,6 +22,6 @@ export declare class FileUsageWindowStore implements UsageWindowStore {
|
|
|
22
22
|
* distinct principals can never share a ledger file). */
|
|
23
23
|
private pathFor;
|
|
24
24
|
private loadRecord;
|
|
25
|
-
charge(key: string, tokens: number, at: number, windows: readonly UsageWindow[]): Promise<void>;
|
|
25
|
+
charge(key: string, tokens: number, at: number, windows: readonly UsageWindow[], costMicroUsd?: number | null): Promise<void>;
|
|
26
26
|
read(key: string, windows: readonly UsageWindow[], now: number): Promise<readonly UsageWindowReading[]>;
|
|
27
27
|
}
|
|
@@ -38,8 +38,8 @@ export class FileUsageWindowStore {
|
|
|
38
38
|
const buckets = validateBuckets(rec.buckets, path);
|
|
39
39
|
return { slots, buckets };
|
|
40
40
|
}
|
|
41
|
-
async charge(key, tokens, at, windows) {
|
|
42
|
-
const next = chargeUsageRecord(this.loadRecord(key), tokens, at, windows);
|
|
41
|
+
async charge(key, tokens, at, windows, costMicroUsd) {
|
|
42
|
+
const next = chargeUsageRecord(this.loadRecord(key), tokens, at, windows, costMicroUsd);
|
|
43
43
|
atomicWriteFile(join(this.dir, "tmp"), this.pathFor(key), JSON.stringify(next));
|
|
44
44
|
}
|
|
45
45
|
async read(key, windows, now) {
|
|
@@ -59,11 +59,21 @@ function validateSlots(value, path) {
|
|
|
59
59
|
return value.map((s) => {
|
|
60
60
|
if (s === null || typeof s !== "object")
|
|
61
61
|
throw corrupt(path, "`slots` entry is not an object");
|
|
62
|
-
const { at, tokens } = s;
|
|
62
|
+
const { at, tokens, costMicroUsd, costUnknown } = s;
|
|
63
63
|
if (typeof at !== "number" || !Number.isFinite(at) || typeof tokens !== "number" || !Number.isFinite(tokens)) {
|
|
64
64
|
throw corrupt(path, "`slots` entry has a non-numeric `at`/`tokens`");
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
if (costMicroUsd !== undefined && (typeof costMicroUsd !== "number" || !Number.isFinite(costMicroUsd))) {
|
|
67
|
+
throw corrupt(path, "`slots` entry has a non-numeric `costMicroUsd`");
|
|
68
|
+
}
|
|
69
|
+
if (costUnknown !== undefined && costUnknown !== true)
|
|
70
|
+
throw corrupt(path, "`slots` entry has a `costUnknown` that is not `true`");
|
|
71
|
+
return {
|
|
72
|
+
at,
|
|
73
|
+
tokens,
|
|
74
|
+
...(costMicroUsd === undefined ? {} : { costMicroUsd }),
|
|
75
|
+
...(costUnknown === true ? { costUnknown: true } : {}),
|
|
76
|
+
};
|
|
67
77
|
});
|
|
68
78
|
}
|
|
69
79
|
function validateBuckets(value, path) {
|
|
@@ -74,7 +84,7 @@ function validateBuckets(value, path) {
|
|
|
74
84
|
return value.map((b) => {
|
|
75
85
|
if (b === null || typeof b !== "object")
|
|
76
86
|
throw corrupt(path, "`buckets` entry is not an object");
|
|
77
|
-
const { windowMs, openedAt, tokens } = b;
|
|
87
|
+
const { windowMs, openedAt, tokens, costMicroUsd, costUnknown } = b;
|
|
78
88
|
if (typeof windowMs !== "number" ||
|
|
79
89
|
!Number.isFinite(windowMs) ||
|
|
80
90
|
typeof openedAt !== "number" ||
|
|
@@ -83,6 +93,17 @@ function validateBuckets(value, path) {
|
|
|
83
93
|
!Number.isFinite(tokens)) {
|
|
84
94
|
throw corrupt(path, "`buckets` entry has a non-numeric `windowMs`/`openedAt`/`tokens`");
|
|
85
95
|
}
|
|
86
|
-
|
|
96
|
+
if (costMicroUsd !== undefined && (typeof costMicroUsd !== "number" || !Number.isFinite(costMicroUsd))) {
|
|
97
|
+
throw corrupt(path, "`buckets` entry has a non-numeric `costMicroUsd`");
|
|
98
|
+
}
|
|
99
|
+
if (costUnknown !== undefined && costUnknown !== true)
|
|
100
|
+
throw corrupt(path, "`buckets` entry has a `costUnknown` that is not `true`");
|
|
101
|
+
return {
|
|
102
|
+
windowMs,
|
|
103
|
+
openedAt,
|
|
104
|
+
tokens,
|
|
105
|
+
...(costMicroUsd === undefined ? {} : { costMicroUsd }),
|
|
106
|
+
...(costUnknown === true ? { costUnknown: true } : {}),
|
|
107
|
+
};
|
|
87
108
|
});
|
|
88
109
|
}
|
package/dist/tools/loop-tick.js
CHANGED
|
@@ -68,7 +68,7 @@ function dynamicTick(push) {
|
|
|
68
68
|
|
|
69
69
|
Run the autonomous check using the loop instructions established earlier in this conversation. If you cannot find them, treat this as a no-op tick.
|
|
70
70
|
|
|
71
|
-
You scheduled this tick via the ${SCHEDULE_WAKEUP_TOOL_NAME} tool (not a recurring cron). To keep the loop alive, call ${SCHEDULE_WAKEUP_TOOL_NAME} again at the end of this turn with \`prompt\` set to the literal sentinel \`${AUTONOMOUS_LOOP_DYNAMIC_SENTINEL}\` — otherwise the loop ends after this tick.${DYNAMIC_APPENDIX}${push}`;
|
|
71
|
+
You scheduled this tick via the ${SCHEDULE_WAKEUP_TOOL_NAME} tool (not a recurring cron). To keep the loop alive, call ${SCHEDULE_WAKEUP_TOOL_NAME} again at the end of this turn with \`prompt\` set to the literal sentinel \`${AUTONOMOUS_LOOP_DYNAMIC_SENTINEL}\` and \`noop\` set to \`true\` if this tick changed nothing (or \`false\` if it did) — otherwise the loop ends after this tick.${DYNAMIC_APPENDIX}${push}`;
|
|
72
72
|
}
|
|
73
73
|
export function resolveAutonomousLoopPrompt(prompt, opts) {
|
|
74
74
|
if (prompt !== AUTONOMOUS_LOOP_SENTINEL && prompt !== AUTONOMOUS_LOOP_DYNAMIC_SENTINEL)
|
package/dist/tools/monitor.d.ts
CHANGED
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
* Wiring: the process runs through the SAME ExecutionEnv background seam as Bash(run_in_background)
|
|
15
15
|
* (`spawnBackground` — remote envs included); the watcher/batching/timeout machinery lives in
|
|
16
16
|
* {@link TaskRegistry.registerMonitor} (background_bash G2b watcher's near kin); events ride the
|
|
17
|
-
* TaskNotificationPayload lane at "
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* TaskNotificationPayload lane at "next" priority (design/373 #445 ALIGNED re-seat: the running turn's
|
|
18
|
+
* next boundary — consecutive frames drain as one boundary batch, the rate limiter + engine-note cap
|
|
19
|
+
* with terminal preference keep a chatty watcher from monopolizing the run's boundaries).
|
|
20
20
|
* (1.257): events born BETWEEN turns (run torn down / harness idle — the long-watch main case)
|
|
21
21
|
* are no longer lost: the Runner parks them per session (bounded, drop-disclosing) and the session's next
|
|
22
22
|
* run redelivers them through the same notification lane at its first turn boundary.
|
package/dist/tools/monitor.js
CHANGED
|
@@ -89,7 +89,7 @@ export function createMonitorTool(env, opts) {
|
|
|
89
89
|
persistent: isPersistent,
|
|
90
90
|
...(sessionScoped ? { sessionScoped: true } : {}),
|
|
91
91
|
...(isPersistent ? {} : { timeoutMs }),
|
|
92
|
-
...(onNotify !== undefined ? { onEvent: (n) => onNotify(n, { priority: "
|
|
92
|
+
...(onNotify !== undefined ? { onEvent: (n) => onNotify(n, { priority: "next" }) } : {}),
|
|
93
93
|
...(opts.timers !== undefined ? { timers: opts.timers } : {}),
|
|
94
94
|
...(opts.batchWindowMs !== undefined ? { batchWindowMs: opts.batchWindowMs } : {}),
|
|
95
95
|
...(opts.maxBatchesPerMinute !== undefined ? { maxBatchesPerMinute: opts.maxBatchesPerMinute } : {}),
|
|
@@ -13,6 +13,8 @@ Do NOT schedule a short-interval wakeup to poll for background work you started
|
|
|
13
13
|
|
|
14
14
|
Pass the same /loop prompt back via \`prompt\` each turn so the next firing repeats the task. For an autonomous /loop (no user prompt), pass the literal sentinel \`${AUTONOMOUS_LOOP_DYNAMIC_SENTINEL}\` as \`prompt\` instead — the runtime resolves it back to the autonomous-loop instructions at fire time. (There is a similar \`${AUTONOMOUS_LOOP_SENTINEL}\` sentinel for CronCreate-based autonomous loops; do not confuse the two — ${SCHEDULE_WAKEUP_TOOL_NAME} always uses the \`-dynamic\` variant.) To end the loop, call this tool with \`stop: true\` (omit every other field) — the loop ends immediately and no further wakeups fire.
|
|
15
15
|
|
|
16
|
+
Set \`noop: true\` if nothing changed — you checked and there's nothing to report ("no change", "still waiting", "quiet hold"). Set \`noop: false\` if something happened worth keeping — you edited a file, posted a message, advanced state, or surfaced a finding. Consecutive \`noop: true\` ticks are collapsed in the user's terminal view and tracked as a streak, so long quiet holds stay legible to the user without scrolling. Omit \`noop\` when stopping (\`stop: true\`).
|
|
17
|
+
|
|
16
18
|
## Picking delaySeconds
|
|
17
19
|
|
|
18
20
|
The provider prompt cache decides how expensive a wake-up is: waking inside the cache TTL re-reads your conversation context cached (fast, cheap); waking past it re-reads everything uncached. The TTL depends on the provider route this session uses — Anthropic-family routes default to about 5 minutes (1-hour optional), while some routes (e.g. DeepSeek) typically retain unused prefixes for hours, with no guaranteed TTL.
|
|
@@ -422,6 +424,9 @@ MOUNT NOTE: this host does not vouch for session-scoped scheduling, so a wakeup
|
|
|
422
424
|
stop: Type.Optional(Type.Boolean({
|
|
423
425
|
description: "Immediately end the dynamic loop: cancel this session's pending wakeup(s) and schedule nothing. All other fields are ignored when true.",
|
|
424
426
|
})),
|
|
427
|
+
noop: Type.Optional(Type.Boolean({
|
|
428
|
+
description: "true = nothing changed (you checked and there is nothing to report). false = something happened worth keeping (edited a file, posted a message, advanced state, surfaced a finding). Consecutive noop:true ticks are collapsed in the user's terminal view and tracked as a streak. Required unless `stop` is true.",
|
|
429
|
+
})),
|
|
425
430
|
}),
|
|
426
431
|
effect: "write",
|
|
427
432
|
execute: async (args) => serializedWakeupOp(async () => {
|
|
@@ -439,6 +444,9 @@ MOUNT NOTE: this host does not vouch for session-scoped scheduling, so a wakeup
|
|
|
439
444
|
if (a.delaySeconds === undefined || a.reason === undefined || a.prompt === undefined) {
|
|
440
445
|
return errorResult(`Error (${SCHEDULE_WAKEUP_TOOL_NAME}): delaySeconds, reason and prompt are required unless \`stop\` is true.`);
|
|
441
446
|
}
|
|
447
|
+
if (a.noop === undefined) {
|
|
448
|
+
return errorResult(`Error (${SCHEDULE_WAKEUP_TOOL_NAME}): \`noop\` is required unless \`stop\` is true — pass \`noop: true\` if this tick changed nothing, \`noop: false\` if something happened worth keeping.`);
|
|
449
|
+
}
|
|
442
450
|
if (sched.schedulerCapabilities.supportsSessionWakeup === false) {
|
|
443
451
|
return errorResult(`Error (${SCHEDULE_WAKEUP_TOOL_NAME}): this environment has no resident scheduler that can honor a session wakeup — the wakeup would never fire. Wait in the foreground instead, or start the work in a self-detaching form.`);
|
|
444
452
|
}
|
|
@@ -468,7 +476,7 @@ MOUNT NOTE: this host does not vouch for session-scoped scheduling, so a wakeup
|
|
|
468
476
|
: " Note: this scheduler does not vouch for session-lifetime reap, so this wakeup is scheduled as a persistent one and may outlive the session — end the loop explicitly with `stop: true` rather than relying on the session ending.";
|
|
469
477
|
return {
|
|
470
478
|
content: `Next wakeup scheduled for ${hhmmss} (in ${clampedDelaySeconds}s)${clampNote}. Nothing more to do this turn — the harness re-invokes you when the wakeup fires or a task-notification arrives.${reapNote}${cleanupNote}`,
|
|
471
|
-
details: { type: "schedule-wakeup", stopped: false, scheduledFor, clampedDelaySeconds, wasClamped, reason: a.reason },
|
|
479
|
+
details: { type: "schedule-wakeup", stopped: false, scheduledFor, clampedDelaySeconds, wasClamped, reason: a.reason, noop: a.noop },
|
|
472
480
|
};
|
|
473
481
|
}),
|
|
474
482
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_comment": "design/87 L3 — frozen public export surface of src/index.ts (name -> kind). DO NOT edit by hand to silence a red test. A removed/changed entry = a SemVer-BREAKING change; bump MAJOR and update this fixture in the SAME commit (design/87 §4.2 / §5.2). Regenerate via REGEN in test/export-surface.test.ts.",
|
|
3
3
|
"_tierComment": "#435 v1 — machine-readable layering of the public surface: stable = demonstrated by README.md / src/examples; internal = an `Internal`-marked name or a runner/engine deep-subtree declaration (the model seam src/engine/llm is excluded — it is the BYOM contract, not an engine internal); advanced = a supported export the front door does not walk you through. THIS IS AN INITIAL HEURISTIC, derived mechanically and expected to be refined ticket by ticket: no human reviewed these 1700+ entries one by one, and nothing here claims otherwise. Known bias: a short or English-word export name (ok, err, Result, Usage) can match ordinary prose in README.md and land `stable` on a coincidence. Every export MUST carry a tier — a new export with no row fails the gate in export-surface.test.ts.",
|
|
4
|
-
"count":
|
|
4
|
+
"count": 1763,
|
|
5
5
|
"exports": {
|
|
6
6
|
"A2ATaskState": "type",
|
|
7
7
|
"A2ATaskStateReversal": "type",
|
|
@@ -442,6 +442,7 @@
|
|
|
442
442
|
"LineagePendingTxn": "interface",
|
|
443
443
|
"LineagePromotion": "interface",
|
|
444
444
|
"LlmConsolidationPlan": "interface",
|
|
445
|
+
"LlmConsolidationPlanArm": "interface",
|
|
445
446
|
"LlmConsolidationPlanProduct": "interface",
|
|
446
447
|
"LlmDistillerContract": "interface",
|
|
447
448
|
"LockedConfig": "interface",
|
|
@@ -1473,6 +1474,7 @@
|
|
|
1473
1474
|
"isSelfOrchestrationActive": "function",
|
|
1474
1475
|
"isSessionConflict": "function",
|
|
1475
1476
|
"isSuspendable": "function",
|
|
1477
|
+
"isTerminalTaskNotification": "function",
|
|
1476
1478
|
"isTerminalWorkflowStatus": "function",
|
|
1477
1479
|
"isThinkingLevel": "function",
|
|
1478
1480
|
"isValidCronExpr": "function",
|
|
@@ -1519,6 +1521,7 @@
|
|
|
1519
1521
|
"migrateScope": "function",
|
|
1520
1522
|
"mintCheckpointId": "function",
|
|
1521
1523
|
"mintCheckpointToken": "function",
|
|
1524
|
+
"mintExposurePartitionedPlan": "function",
|
|
1522
1525
|
"mintLlmConsolidationPlan": "function",
|
|
1523
1526
|
"mintReminderMark": "function",
|
|
1524
1527
|
"mintRuleTicket": "function",
|
|
@@ -2204,6 +2207,7 @@
|
|
|
2204
2207
|
"LineagePendingTxn": "advanced",
|
|
2205
2208
|
"LineagePromotion": "advanced",
|
|
2206
2209
|
"LlmConsolidationPlan": "advanced",
|
|
2210
|
+
"LlmConsolidationPlanArm": "advanced",
|
|
2207
2211
|
"LlmConsolidationPlanProduct": "advanced",
|
|
2208
2212
|
"LlmDistillerContract": "advanced",
|
|
2209
2213
|
"LockedConfig": "advanced",
|
|
@@ -3235,6 +3239,7 @@
|
|
|
3235
3239
|
"isSelfOrchestrationActive": "advanced",
|
|
3236
3240
|
"isSessionConflict": "stable",
|
|
3237
3241
|
"isSuspendable": "advanced",
|
|
3242
|
+
"isTerminalTaskNotification": "advanced",
|
|
3238
3243
|
"isTerminalWorkflowStatus": "advanced",
|
|
3239
3244
|
"isThinkingLevel": "advanced",
|
|
3240
3245
|
"isValidCronExpr": "advanced",
|
|
@@ -3281,6 +3286,7 @@
|
|
|
3281
3286
|
"migrateScope": "advanced",
|
|
3282
3287
|
"mintCheckpointId": "advanced",
|
|
3283
3288
|
"mintCheckpointToken": "advanced",
|
|
3289
|
+
"mintExposurePartitionedPlan": "advanced",
|
|
3284
3290
|
"mintLlmConsolidationPlan": "advanced",
|
|
3285
3291
|
"mintReminderMark": "advanced",
|
|
3286
3292
|
"mintRuleTicket": "advanced",
|