@sema-agent/core 1.451.0 → 2.0.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 (191) hide show
  1. package/dist/agents/agent-transcript-tool.d.ts +15 -0
  2. package/dist/agents/agent-transcript-tool.js +122 -0
  3. package/dist/agents/cascade.js +5 -8
  4. package/dist/agents/observer.js +3 -0
  5. package/dist/agents/repair-loop.d.ts +1 -1
  6. package/dist/agents/repair-loop.js +1 -1
  7. package/dist/agents/retain-ledger.d.ts +60 -0
  8. package/dist/agents/retain-ledger.js +225 -0
  9. package/dist/agents/roster-store.d.ts +1 -0
  10. package/dist/agents/roster-store.js +9 -0
  11. package/dist/agents/send-message-tool.d.ts +41 -0
  12. package/dist/agents/send-message-tool.js +469 -0
  13. package/dist/agents/subagent.d.ts +33 -108
  14. package/dist/agents/subagent.js +40 -813
  15. package/dist/agents/teacher.d.ts +0 -1
  16. package/dist/agents/teacher.js +0 -9
  17. package/dist/bin/sema-tb.js +3 -3
  18. package/dist/brain/anthropic.js +15 -40
  19. package/dist/brain/openai.js +15 -40
  20. package/dist/brain/reasoning.d.ts +1 -1
  21. package/dist/brain/stream-engine.js +2 -2
  22. package/dist/brain/stream-shared.d.ts +17 -0
  23. package/dist/brain/stream-shared.js +50 -0
  24. package/dist/brain/timeout.d.ts +1 -1
  25. package/dist/brain/timeout.js +1 -1
  26. package/dist/config/catalog.js +1 -3
  27. package/dist/config/defaults.d.ts +6 -0
  28. package/dist/config/defaults.js +6 -0
  29. package/dist/core/ask-question.d.ts +1 -1
  30. package/dist/core/ask-question.js +5 -5
  31. package/dist/core/background-agent-store.d.ts +2 -0
  32. package/dist/core/background-agent-store.js +5 -1
  33. package/dist/core/background-shell.d.ts +1 -1
  34. package/dist/core/checkpoint-store.d.ts +0 -1
  35. package/dist/core/exec-gate.d.ts +1 -1
  36. package/dist/core/exec-output-tail.d.ts +19 -1
  37. package/dist/core/exec-output-tail.js +44 -5
  38. package/dist/core/file-snapshot-store.d.ts +1 -1
  39. package/dist/core/fs-write-gate-policy.d.ts +1 -1
  40. package/dist/core/git-worktree-env.d.ts +1 -1
  41. package/dist/core/hooks.d.ts +1 -1
  42. package/dist/core/image-downsample.d.ts +44 -0
  43. package/dist/core/image-downsample.js +97 -0
  44. package/dist/core/lsp-session.d.ts +1 -0
  45. package/dist/core/lsp-session.js +24 -6
  46. package/dist/core/lsp.d.ts +11 -1
  47. package/dist/core/lsp.js +63 -6
  48. package/dist/core/mailbox-store.d.ts +3 -2
  49. package/dist/core/mailbox-store.js +19 -4
  50. package/dist/core/mcp.d.ts +3 -45
  51. package/dist/core/mcp.js +2 -97
  52. package/dist/core/media-byte-cap.d.ts +1 -1
  53. package/dist/core/memory-recall.d.ts +0 -12
  54. package/dist/core/memory-recall.js +0 -222
  55. package/dist/core/memory.d.ts +0 -6
  56. package/dist/core/memory.js +0 -88
  57. package/dist/core/message-utils.d.ts +1 -1
  58. package/dist/core/oracle-isolation.d.ts +1 -1
  59. package/dist/core/remote-env.d.ts +1 -1
  60. package/dist/core/roles.d.ts +1 -1
  61. package/dist/core/runner/active-skill-scope.d.ts +1 -1
  62. package/dist/core/runner/assemble-result.d.ts +0 -2
  63. package/dist/core/runner/memory-consolidation.d.ts +1 -1
  64. package/dist/core/runner/prepare-memory.d.ts +16 -0
  65. package/dist/core/runner/prepare-memory.js +191 -0
  66. package/dist/core/runner/prepare-task.d.ts +4 -28
  67. package/dist/core/runner/prepare-task.js +29 -208
  68. package/dist/core/runner/prompt-suggestions.d.ts +1 -1
  69. package/dist/core/runner/runtask.d.ts +2 -3
  70. package/dist/core/runner/runtask.js +337 -529
  71. package/dist/core/runner/session-rule-policy.d.ts +1 -1
  72. package/dist/core/runner/synthetic-tools.d.ts +5 -5
  73. package/dist/core/runner/synthetic-tools.js +4 -4
  74. package/dist/core/runner/tool-disclosure.d.ts +3 -3
  75. package/dist/core/runner/tool-disclosure.js +2 -2
  76. package/dist/core/runner/tool-output-projection.d.ts +6 -0
  77. package/dist/core/runner/tool-output-projection.js +81 -0
  78. package/dist/core/runtime.d.ts +1 -1
  79. package/dist/core/scheduler.d.ts +1 -1
  80. package/dist/core/sensitive-path-policy.d.ts +1 -1
  81. package/dist/core/session-reconcile.d.ts +1 -1
  82. package/dist/core/session-reconcile.js +5 -2
  83. package/dist/core/session-store.d.ts +2 -1
  84. package/dist/core/session-store.js +2 -1
  85. package/dist/core/session.d.ts +0 -1
  86. package/dist/core/task-notification.d.ts +1 -0
  87. package/dist/core/task-registry-agent.d.ts +115 -0
  88. package/dist/core/task-registry-agent.js +1163 -0
  89. package/dist/core/task-registry-monitor.d.ts +13 -0
  90. package/dist/core/task-registry-monitor.js +347 -0
  91. package/dist/core/task-registry-shared.d.ts +294 -0
  92. package/dist/core/task-registry-shared.js +271 -0
  93. package/dist/core/task-registry-workflow.d.ts +5 -0
  94. package/dist/core/task-registry-workflow.js +143 -0
  95. package/dist/core/task-registry.d.ts +54 -213
  96. package/dist/core/task-registry.js +190 -1766
  97. package/dist/core/task-tool-shape.d.ts +32 -0
  98. package/dist/core/task-tool-shape.js +83 -0
  99. package/dist/core/tool-policy.d.ts +1 -2
  100. package/dist/core/tool-result-budget.d.ts +1 -1
  101. package/dist/core/tool-result-store.d.ts +2 -2
  102. package/dist/core/tool-result-store.js +3 -3
  103. package/dist/core/tools.d.ts +7 -3
  104. package/dist/core/tools.js +3 -8
  105. package/dist/core/trace.d.ts +2 -2
  106. package/dist/core/types.d.ts +1 -29
  107. package/dist/core/workflow-journal-store.d.ts +2 -0
  108. package/dist/core/workflow-journal-store.js +14 -0
  109. package/dist/core/workflow-run-store-contract.d.ts +1 -1
  110. package/dist/core/workflow-run-store-contract.js +19 -19
  111. package/dist/engine/execution-env/node-execution-env.d.ts +14 -0
  112. package/dist/engine/execution-env/node-execution-env.js +184 -44
  113. package/dist/engine/lsp/frame-decoder.d.ts +1 -1
  114. package/dist/engine/lsp/frame-decoder.js +1 -1
  115. package/dist/engine/lsp/node-lsp-manager.d.ts +4 -2
  116. package/dist/engine/lsp/node-lsp-manager.js +22 -5
  117. package/dist/engine/lsp/stdio-lsp-transport.d.ts +1 -1
  118. package/dist/engine/lsp/stdio-lsp-transport.js +19 -8
  119. package/dist/index.d.ts +18 -16
  120. package/dist/index.js +15 -13
  121. package/dist/internal/harness-types.d.ts +7 -0
  122. package/dist/internal/harness-types.js +1 -0
  123. package/dist/internal/harness.d.ts +1 -7
  124. package/dist/internal/harness.js +1 -0
  125. package/dist/orchestration/goal.js +2 -2
  126. package/dist/orchestration/run-workflow-tool.d.ts +2 -1
  127. package/dist/orchestration/run-workflow-tool.js +29 -6
  128. package/dist/orchestration/workflow-types.d.ts +193 -0
  129. package/dist/orchestration/workflow-types.js +54 -0
  130. package/dist/orchestration/workflow.d.ts +3 -184
  131. package/dist/orchestration/workflow.js +87 -64
  132. package/dist/prompt-assembly/assemble.d.ts +3 -3
  133. package/dist/prompt-assembly/assemble.js +0 -16
  134. package/dist/prompt-assembly/explain.d.ts +1 -1
  135. package/dist/prompt-assembly/tool-catalog.d.ts +1 -1
  136. package/dist/prompts/default.d.ts +1 -6
  137. package/dist/prompts/default.js +3 -11
  138. package/dist/scenarios/env.d.ts +1 -1
  139. package/dist/scenarios/full-body.d.ts +0 -3
  140. package/dist/scenarios/full-body.js +0 -2
  141. package/dist/stores/cc/mailbox-store.js +6 -1
  142. package/dist/stores/file/background-agent-store.d.ts +2 -15
  143. package/dist/stores/file/background-agent-store.js +33 -102
  144. package/dist/stores/file/checkpoint-store.d.ts +1 -14
  145. package/dist/stores/file/checkpoint-store.js +47 -119
  146. package/dist/stores/file/file-snapshot-store.d.ts +1 -1
  147. package/dist/stores/file/mailbox-store.d.ts +1 -1
  148. package/dist/stores/file/mailbox-store.js +9 -7
  149. package/dist/stores/file/shared-ledger.d.ts +35 -0
  150. package/dist/stores/file/shared-ledger.js +94 -0
  151. package/dist/stores/file/workflow-run-store.d.ts +1 -14
  152. package/dist/stores/file/workflow-run-store.js +24 -93
  153. package/dist/tools/fs/bash-readonly-classifier.d.ts +8 -0
  154. package/dist/tools/fs/bash-readonly-classifier.js +166 -0
  155. package/dist/tools/fs/encoding.d.ts +5 -0
  156. package/dist/tools/fs/encoding.js +6 -0
  157. package/dist/tools/fs/fs-bash.d.ts +31 -0
  158. package/dist/tools/fs/fs-bash.js +672 -0
  159. package/dist/tools/fs/fs-pdf.d.ts +22 -0
  160. package/dist/tools/fs/fs-pdf.js +236 -0
  161. package/dist/tools/fs/fs-read.d.ts +8 -0
  162. package/dist/tools/fs/fs-read.js +286 -0
  163. package/dist/tools/fs/fs-search-tools.d.ts +5 -0
  164. package/dist/tools/fs/fs-search-tools.js +173 -0
  165. package/dist/tools/fs/fs-shared.d.ts +55 -0
  166. package/dist/tools/fs/fs-shared.js +144 -0
  167. package/dist/tools/fs/fs-write.d.ts +8 -0
  168. package/dist/tools/fs/fs-write.js +423 -0
  169. package/dist/tools/fs/index.d.ts +12 -65
  170. package/dist/tools/fs/index.js +26 -2026
  171. package/dist/tools/fs/notebook.d.ts +43 -0
  172. package/dist/tools/fs/notebook.js +141 -0
  173. package/dist/tools/fs/pdf.d.ts +1 -1
  174. package/dist/tools/fs/repo-map.d.ts +3 -3
  175. package/dist/tools/fs/repo-map.js +3 -3
  176. package/dist/tools/fs/safety.d.ts +1 -1
  177. package/dist/tools/fs/search.d.ts +1 -1
  178. package/dist/tools/fs/search.js +141 -12
  179. package/dist/tools/gitea-issue.js +4 -2
  180. package/dist/tools/monitor.d.ts +1 -1
  181. package/dist/tools/monitor.js +12 -8
  182. package/dist/tools/scheduler-tools.d.ts +1 -1
  183. package/dist/tools/scheduler-tools.js +16 -16
  184. package/dist/tools/task-list.js +34 -12
  185. package/dist/tools/web.d.ts +4 -2
  186. package/dist/tools/web.js +106 -20
  187. package/dist/tools/worktree.d.ts +1 -1
  188. package/dist/tools/worktree.js +14 -14
  189. package/package.json +1 -1
  190. package/dist/core/dynamic-recall.d.ts +0 -32
  191. package/dist/core/dynamic-recall.js +0 -76
package/dist/index.d.ts CHANGED
@@ -1,25 +1,25 @@
1
1
  export { Runner, runTask, DEFAULT_MAX_TURNS } from "./core/runner/runtask.js";
2
2
  export { SESSION_LOG_DIGEST_SCHEME, sessionEntryDigest, sessionLogDigest, sessionLogDigestsComparable, } from "./engine/session/log-digest.js";
3
3
  export type { ResumeTaskConfig } from "./core/runner/runtask.js";
4
- export { defineTool, toSkill } from "./core/tools.js";
4
+ export { defineTool } from "./core/tools.js";
5
5
  export { SKILL_TOOL_NAME } from "./core/runner/synthetic-tools.js";
6
6
  export { REPORT_FINDINGS_TOOL_NAME, type ReportedFinding } from "./core/runner/synthetic-tools.js";
7
7
  export { formatToolError, formatZodValidationError, formatValidationPath, truncateError, errorClassOf } from "./core/tool-errors.js";
8
8
  export type { WorkerErrorClass } from "./core/tool-errors.js";
9
- export { createWebFetchTool, webFetchToolSpec, htmlToText, type WebFetchConfig, createWebSearchTool, type WebSearchConfig, makeWebFetchSummarizer, WEBFETCH_SUMMARY_MAX_CONTENT, WEBFETCH_SUMMARY_GUIDELINES, } from "./tools/web.js";
9
+ export { createWebFetchTool, webFetchToolSpec, htmlToText, type WebFetchConfig, createWebSearchTool, type WebSearchConfig, createWebFetchSummarizer, WEBFETCH_SUMMARY_MAX_CONTENT, WEBFETCH_SUMMARY_GUIDELINES, } from "./tools/web.js";
10
10
  export { createTodoWriteTool } from "./tools/todo.js";
11
11
  export { createTaskListTools, createMemoryTaskListStore, assertJsonMetadata, type TaskListItem, type TaskListStore } from "./tools/task-list.js";
12
- export { assembleCodeTools, type CodeToolsConfig, CODE_ROLE, assembleFullBodyTools, type FullBodyToolsConfig, FULL_BODY_ROLE } from "./scenarios/full-body.js";
12
+ export { assembleCodeTools, type CodeToolsConfig, CODE_ROLE } from "./scenarios/full-body.js";
13
13
  export { capAggregateToolResults, AGGREGATE_TOOL_RESULT_BUDGET_CHARS, DEFAULT_BUDGET_EXEMPT_TOOLS, type AggregateBudgetOptions, } from "./core/tool-result-budget.js";
14
14
  export { capAggregateMediaBytes, AGGREGATE_MEDIA_BUDGET_BYTES, type MediaStripInfo } from "./core/media-byte-cap.js";
15
15
  export { createAskUserQuestionTool, createDurableQuestionPolicy, QUESTION_AWAITS_RESUME, type OnQuestion, type AskQuestion, type AskQuestionOption, type AskQuestionRequest, type QuestionAnswer, type QuestionAnswerItem, } from "./core/ask-question.js";
16
- export { createLspTool, gitCheckIgnoreFilter, LSP_OPERATIONS, type LspOperation, type LspServerManager, type LspSession, type LspResult, type LspLocation, type LspSymbolInfo, type LspRequestParams, type LspToolOptions, type LspTransport, type LspReadText, } from "./core/lsp.js";
16
+ export { createLspTool, gitCheckIgnoreFilter, LSP_OPERATIONS, LSP_FAILURE_BRAND, brandLspFailure, lspFailureOf, type LspNoneReason, type LspOperation, type LspServerManager, type LspSession, type LspResult, type LspLocation, type LspSymbolInfo, type LspRequestParams, type LspToolOptions, type LspTransport, type LspReadText, } from "./core/lsp.js";
17
17
  export { buildRequest, parseResult, callHierarchyMethod, pathToUri } from "./core/lsp-protocol.js";
18
18
  export { TransportLspSession, type SessionWarmup } from "./core/lsp-session.js";
19
19
  export { LspDiagnosticsRegistry, formatDiagnosticsBlock, formatDiagnosticsSummary, type LspDiagnostic, type LspFileDiagnostics, } from "./core/lsp-diagnostics.js";
20
20
  export { NodeLspManager, DEFAULT_LSP_SERVERS, languageFor, defaultLspSpawn, type NodeLspManagerOptions, type LspSpawn, } from "./engine/lsp/node-lsp-manager.js";
21
21
  export { StdioLspTransport, type LspChildProcess } from "./engine/lsp/stdio-lsp-transport.js";
22
- export { encodeFrame, makeFrameDecoder } from "./engine/lsp/frame-decoder.js";
22
+ export { encodeFrame, createFrameDecoder } from "./engine/lsp/frame-decoder.js";
23
23
  export { resolveModel, resolveTaskModel, parseModelMention, expandTiers, DEFAULT_TIER_ORDER, CC_MODEL_TIER_ALIASES, ROLE_TIER_DEFAULTS, type ModelRole, type RoleSpec, type ModelRoles, type ResolvedRole, type ModelMention, } from "./core/roles.js";
24
24
  export { selectModel, selectModelOrThrow, type ModelCriteria, type ModelTier } from "./core/select-model.js";
25
25
  export { BrainError, classifyHttp, type BrainErrorCode } from "./brain/errors.js";
@@ -44,7 +44,7 @@ export { SAFETY_AXIS_VOCABULARY } from "./core/safety-axis-vocab.js";
44
44
  export { createSessionRulePolicy } from "./core/runner/session-rule-policy.js";
45
45
  export { TtlSessionStore, type TtlSessionStoreOptions, type EvictPolicy } from "./core/session-store.js";
46
46
  export { reconcileInterruptedSession, findOrphanToolCalls, type OrphanToolCall, type ReconcileReport, } from "./core/session-reconcile.js";
47
- export { StoredSession, InMemorySessionRepo, InMemorySessionStorage, BaseSessionStorage, leafIdAfterEntry, validateEntriesForImport, StreamingImportValidator, boundedTail, SessionError, isSessionConflict, hasSessionFork, uuidv7, type Session, type SessionStore, type AcquiredSession, type SessionStoreSummary, type SessionSummary, type SessionStorage, type SessionRepo, type SessionMetadata, type SessionTreeEntry, type SessionWriteOptions, } from "./core/session.js";
47
+ export { StoredSession, InMemorySessionRepo, InMemorySessionStorage, BaseSessionStorage, leafIdAfterEntry, validateEntriesForImport, StreamingImportValidator, boundedTail, SessionError, isSessionConflict, hasSessionFork, uuidv7, type Session, type SessionStore, type AcquiredSession, type SessionStoreSummary, type SessionStorage, type SessionRepo, type SessionMetadata, type SessionTreeEntry, type SessionWriteOptions, } from "./core/session.js";
48
48
  export { warmResume } from "./core/warm-resume.js";
49
49
  export { StubExecutionEnv } from "./core/stub-env.js";
50
50
  export { NodeExecutionEnv, FileError, ExecutionError } from "./internal/harness.js";
@@ -91,8 +91,8 @@ export { createCcFileMailboxStore, sanitizeCcAgentName, type CcFileMailboxStoreO
91
91
  export { listCcSidecarAgents, readCcSidecarTranscript, ccSidecarToMessages, readCcSidecarMessages, type CcSidecarHandle, type CcSidecarMeta, type CcSidecarLine, type CcSidecarTranscript, type CcSidecarMessages, } from "./stores/cc/sidecar-transcript.js";
92
92
  export { createMonitorTool, type MonitorToolOptions } from "./tools/monitor.js";
93
93
  export { createWorktreeTools, type WorktreeToolsOptions, type ActiveWorktreeSession, type WorktreeSessionRef } from "./tools/worktree.js";
94
- export { sharpImageResizer, type McpImageResizer } from "./core/mcp.js";
95
- export { makeImageDownsampler, sharpImageDownsampler, MCP_IMAGE_MAX_BASE64, IMAGE_TARGET_RAW_SIZE, type ImageDownsampler, type ImageDimensions, } from "./core/mcp.js";
94
+ export { sharpImageResizer, type McpImageResizer } from "./core/image-downsample.js";
95
+ export { createImageDownsampler, sharpImageDownsampler, MCP_IMAGE_MAX_BASE64, IMAGE_TARGET_RAW_SIZE, type ImageDownsampler, type ImageDimensions, } from "./core/image-downsample.js";
96
96
  export { hasBackgroundShell, BackgroundShellError } from "./core/background-shell.js";
97
97
  export type { BackgroundShellCapability, BackgroundShellId, BackgroundShellStatus, BackgroundShellErrorCode, BackgroundSpawnOptions, BackgroundPoll, } from "./core/background-shell.js";
98
98
  export { hasScheduler, isValidCronExpr, SchedulerError } from "./core/scheduler.js";
@@ -100,21 +100,20 @@ export type { SchedulerCapability, SchedulerErrorCode, ScheduledIntent, Schedule
100
100
  export { createSchedulerTools, type SchedulerToolContext, SCHEDULE_WAKEUP_TOOL_NAME, AUTONOMOUS_LOOP_SENTINEL, AUTONOMOUS_LOOP_DYNAMIC_SENTINEL, } from "./tools/scheduler-tools.js";
101
101
  export { resolveAutonomousLoopPrompt, AUTONOMOUS_LOOP_PREAMBLE, AUTONOMOUS_LOOP_PREAMBLE_PERSISTENT, type AutonomousLoopPromptOptions, } from "./tools/loop-tick.js";
102
102
  export { tightenTaskSpec, TaskSpecTightenError } from "./core/tighten-task-spec.js";
103
- export { createAllowDenyPolicy, createApprovalPolicy, COARSE_SHELL_TOOLS, createCoarseCommandNamePolicy, createTranscriptIntegrityPolicy, createUnverifiableDeletePolicy, findUnverifiableRecursiveDelete, combinePolicies, decisionText, resolveAsk, toolPolicyNameSets, type ToolPolicyNameSets, type NamedToolPolicy, type ToolPolicy, type ToolCallRequest, type ToolDecision, type PermissionResult, type DecisionReason, type OnAsk, type AskOutcome, type ResolvedAsk, type AskRequest, } from "./core/tool-policy.js";
103
+ export { createAllowDenyPolicy, createApprovalPolicy, COARSE_SHELL_TOOLS, createCoarseCommandNamePolicy, createTranscriptIntegrityPolicy, createUnverifiableDeletePolicy, findUnverifiableRecursiveDelete, combinePolicies, decisionText, resolveAsk, toolPolicyNameSets, type ToolPolicyNameSets, type NamedToolPolicy, type ToolPolicy, type ToolCallRequest, type PermissionResult, type DecisionReason, type OnAsk, type AskOutcome, type ResolvedAsk, type AskRequest, } from "./core/tool-policy.js";
104
104
  export { parseAutoModeResponse, createAutoModeDecider, type AutoModeVerdict, type AutoModeDecider, type AutoModeDeciderOptions, type AutoModeClassifyFn, type AutoModeClassifyInput, } from "./core/auto-mode.js";
105
105
  export { buildAutoModePrompt, renderAutoModeWindow, renderAutoModeAction, AUTO_MODE_DEFAULTS_SENTINEL, type AutoModeRules, type BuildAutoModePromptOptions, type AutoModeWindowOptions, } from "./core/auto-mode-prompt.js";
106
106
  export { AUTO_MODE_BASE_PROMPT, AUTO_MODE_PERMISSIONS_EXTERNAL } from "./core/auto-mode-prompt-assets.js";
107
107
  export { createPermissionRulePolicy, validatePermissionRules, parsePermissionRule, wildcardMatch, type PermissionRule, type ParsedPermissionRule, type PermissionRuleIssue, type PermissionRuleCaps, type PermissionRulePolicyOptions, } from "./core/permission-rules.js";
108
108
  export { formatHookFeedback, runToolGate, type Hooks, type HookToolContext, 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";
109
- export { InMemoryMemoryStore, composeMemoryBlock, composeLayeredMemoryBlock, normalizeMemorySpec, type NormalizedMemorySpec, type MemorySpecInput, createRememberTool, createRecallTool, 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";
109
+ 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";
110
110
  export { MemoryEngine, FileMemoryEngineBackend, memoryBackendContract, assertMemoryBackendSearchEquivalence, type MemoryBackendContractHooks, buildMemoryInstruction, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, MEMORY_INSTRUCTION_TEMPLATE, MEMORY_INDEX_FILENAME, MEMORY_INDEX_MAX_LINES, MEMORY_INDEX_MAX_BYTES, STUB_ARCHIVED_LINE, DEFAULT_MAX_MEMORY_FILES, DEFAULT_MAX_ENTRY_DEPTH, DEFAULT_HARVEST_DEADLINE_MS, DEFAULT_HARVEST_FILE_BUDGET, MASS_DELETION_FUSE_RATIO, scanMemoryWrite, scanMemoryFileName, scanRemediation, MEMORY_FILENAME_SEGMENT_RE, renderAnnouncements, enqueueMemoryAnnouncement, drainMemoryAnnouncements, peekMemoryAnnouncements, bumpScanFuse, scanFuseCount, clearScanFuse, ANNOUNCEMENTS_FILE, MEMORY_ANNOUNCEMENTS_MAX, SCAN_FUSE_FILE, SCAN_FUSE_THRESHOLD, type MemoryAnnouncement, type ScanFinding, type MemoryEngineOptions, type MemoryInjection, type MemoryBackend, type MemoryEntry, type MemoryEntryFrontmatter, type MemoryEntryHeader, type ScoredMemoryEntry, type NotePatch, type PatchReport, type MaterializedFile, type MemorySessionHandle, type HarvestReport, type HarvestRejection, type HarvestRejectionCode, type ParsedEntryFile, type ScannedEntryFile, SCOPE_SEGMENT_MAX_ENCODED, PROJECT_MARKER_PATH, encodeScopeSegment, decodeScopeSegment, parseScopeKey, formatUserScope, formatOrgScope, formatProjScope, formatUserProjScope, isPersonalScope, assertScopeContractPlacement, formatProjectMarker, parseProjectMarker, resolveProjectId, PROJECT_ID_REGEX, type ParsedScopeKey, migrateScope, type MigrateScopeReport, materializeEntriesToFiles, harvestFilesToPatches, projectionsToWriteBack, screenInboundEntries, REMOTE_HARVEST_PER_FILE_BYTES, REMOTE_MASS_DELETION_FUSE_RATIO, type RemoteMemoryFile, type RemoteMemoryBaseline, type RemoteMaterialization, type RemoteHarvestResult, type InboundEntryFinding, deriveProjectMemoryDir, deriveProjectControlDir, recordProjectIdHint, lookupProjectIdHint, PROJECT_ID_HINTS_FILE, reconcileMemoryEntries, nextSyncBaseline, mergeRecallHits, type MemorySyncCursor, type MemorySyncConflict, type MemorySyncPlan, type RecallSource, syncMemoryScope, type MemorySyncTransport, type MemorySyncRequestBody, type MemorySyncResponseBody, type MemorySyncClientConflict, type SyncMemoryScopeOptions, type MemorySyncClientResult, } from "./core/memory-engine/index.js";
111
111
  export { termSet, jaccardDistance, cosineDistance } from "./core/memory-vector.js";
112
- export { createBrainMemorySelector, selectAndComposeMemory, selectAndComposeLayeredMemory, encodeSurfacedKey, buildManifestText, validateSelectedIds, composeSelectiveMemoryBlock, composeSelectiveBody, formatMemoryAge, resolveLinkedIds, RECALL_CAVEAT, DEFAULT_MAX_SELECTED, DEFAULT_MAX_LINKED, type MemorySelector, type MemorySelectRequest, type SelectiveRecallOptions, type SelectiveRecallResult, type LayeredRecallOptions, type LayeredRecallResult, type ScopedNoteHeader, type ScopedNoteRecord, } from "./core/memory-recall.js";
113
- export { buildRecallQuery, runDynamicRecall, DEFAULT_RECENT_MESSAGE_WINDOW, DEFAULT_MAX_QUERY_CHARS, type DynamicRecallConfig, type DynamicRecallInput, type DynamicRecallOutcome, } from "./core/dynamic-recall.js";
112
+ export { encodeSurfacedKey, buildManifestText, validateSelectedIds, composeSelectiveBody, formatMemoryAge, resolveLinkedIds, RECALL_CAVEAT, DEFAULT_MAX_SELECTED, DEFAULT_MAX_LINKED, type MemorySelector, type MemorySelectRequest, type SelectiveRecallOptions, type SelectiveRecallResult, type LayeredRecallOptions, type LayeredRecallResult, type ScopedNoteHeader, type ScopedNoteRecord, } from "./core/memory-recall.js";
114
113
  export { runMemoryConsolidation, CONSOLIDATION_SYSTEM_PROMPT, DEFAULT_CONSOLIDATION_BAND, DEFAULT_CONSOLIDATION_SEARCH_LIMIT, DEFAULT_CONSOLIDATION_MAX_NOTES, DEFAULT_CONSOLIDATION_TIMEOUT_SEC, normalizeForExactMatch, type ConsolidationParams, type ConsolidationStats, type ConsolidationNote, type ConsolidationLLM, } from "./core/runner/memory-consolidation.js";
115
114
  export { consolidateScope, advanceCursorAfterInline, type ConsolidateScopeDeps, type ConsolidateScopeOptions, } from "./core/consolidate-scope.js";
116
115
  export { DEFAULT_COMPACTION_INSTRUCTIONS } from "./core/auto-compaction.js";
117
- export { DEFAULT_SYSTEM_PROMPT, CODE_AGENT_PROMPT, SUBAGENT_PROMPT, AUTONOMY_SELF_AUDIT, ANTI_VERBOSITY, TOOL_PARAM_JSON, CODE_SYSTEM_PROMPT, FULL_BODY_SYSTEM_PROMPT, MEMORY_GUIDANCE, MEMORY_SAFETY, MEMORY_HYGIENE, OUTPUT_EFFICIENCY, CYBER_RISK, HARNESS_SECTION_ANCHOR, URL_SAFETY, SUMMARIZE_TOOL_RESULTS, EXECUTION_ENVIRONMENT, harnessContext, buildEnvironmentContext, buildGitSnapshot, buildScratchpadSection, GIT_STATUS_MAX_CHARS, formatLocalDate, type EnvironmentFacts, defaultPromptProvider, composeSystemPrompt, composeConstitution, constitutionBlocks, type PromptBlock, analyzePromptCacheFriendliness, assertPromptCacheFriendly, type PromptProvider, type PromptBuildContext, type StablePromptContext, type PromptCacheReport, type PromptTextDeclaration, } from "./prompts/default.js";
116
+ export { DEFAULT_SYSTEM_PROMPT, CODE_AGENT_PROMPT, SUBAGENT_PROMPT, AUTONOMY_SELF_AUDIT, ANTI_VERBOSITY, TOOL_PARAM_JSON, CODE_SYSTEM_PROMPT, MEMORY_GUIDANCE, MEMORY_SAFETY, MEMORY_HYGIENE, OUTPUT_EFFICIENCY, CYBER_RISK, HARNESS_SECTION_ANCHOR, URL_SAFETY, SUMMARIZE_TOOL_RESULTS, EXECUTION_ENVIRONMENT, harnessContext, buildEnvironmentContext, buildGitSnapshot, buildScratchpadSection, GIT_STATUS_MAX_CHARS, formatLocalDate, type EnvironmentFacts, defaultPromptProvider, composeSystemPrompt, composeConstitution, constitutionBlocks, type PromptBlock, analyzePromptCacheFriendliness, assertPromptCacheFriendly, type PromptProvider, type StablePromptContext, type PromptCacheReport, type PromptTextDeclaration, } from "./prompts/default.js";
118
117
  export { SUPERVISOR_PROMPT, ORCHESTRATION_GUIDANCE, ORCHESTRATION_AWARENESS, GOAL_COMPLETION_GUIDANCE } from "./prompts/supervisor.js";
119
118
  export { compose, validatePack } from "./prompt-assembly/composer.js";
120
119
  export { SEMA_DEFAULT_PACK } from "./prompt-assembly/packs/sema-default.js";
@@ -153,13 +152,16 @@ export { FileWorkflowRunStore, type FileWorkflowRunStoreOptions } from "./stores
153
152
  export { workflowRunStoreContract } from "./core/workflow-run-store-contract.js";
154
153
  export { type BackgroundAgentStore, type BackgroundAgentRecord, type BackgroundAgentRowSummary, type BackgroundAgentUsage, canAccessAgentRecord, BackgroundAgentStoreError, InMemoryBackgroundAgentStore, reconcileParkedAgents, } from "./core/background-agent-store.js";
155
154
  export { FileBackgroundAgentStore, type FileBackgroundAgentStoreOptions } from "./stores/file/background-agent-store.js";
156
- export { type WorkflowJournalStore, type WorkflowJournalEntry, InMemoryWorkflowJournalStore, callKeyOrdinal, } from "./core/workflow-journal-store.js";
155
+ export { type WorkflowJournalStore, type WorkflowJournalEntry, InMemoryWorkflowJournalStore, callKeyOrdinal, JOURNAL_OVERSIZE_ERROR_CODE, } from "./core/workflow-journal-store.js";
157
156
  export { untrustedEgressForHuman, redactHostLeaks, redactSecrets, boundedRedactedSummary } from "./core/untrusted-egress.js";
158
157
  export { MemoryRosterStore, FileRosterStore, type RosterStore, type RosterEntry, type RosterAccess, type RosterGcOptions } from "./agents/roster-store.js";
159
158
  export { CONFIG_CATALOG_VERSION, describeConfigCatalog, resolveEffectiveConfig, type ConfigKnob, type ConfigOverrideDeclaration, type ConfigProvenance, type EffectiveConfigField, } from "./config/catalog.js";
160
159
  export { normalizeAgentName } from "./core/task-registry.js";
161
160
  export { COORDINATOR_ROLE_PROMPT, TEAMMATE_COMMUNICATION_ADDENDUM, TEAMMATE_TASK_LIST_ADDENDUM } from "./prompts/coordinator.js";
162
- export { createSubagentTool, createSendMessageTool, createAgentTranscriptTool, AGENT_TRANSCRIPT_TOOL_NAME, FORK_SUBAGENT_TYPE, GENERAL_PURPOSE_SUBAGENT_TYPE, FORK_DEFAULT_MAX_TURNS, agentWhenToUseText, FORK_DIRECTIVE_FRAME, SEND_MESSAGE_TOOL_NAME, SUBAGENT_SYSTEM_NOTE, type SubagentToolOptions, type SubagentSpawnContext, type SubagentSteerHandle, type SendMessageToolOptions, type AgentTranscriptToolOptions, type SubagentStep, type SubagentEditedFile, getSessionRetainLedger, releaseSessionRetainLedger, } from "./agents/subagent.js";
161
+ export { createSubagentTool, FORK_SUBAGENT_TYPE, GENERAL_PURPOSE_SUBAGENT_TYPE, FORK_DEFAULT_MAX_TURNS, agentWhenToUseText, FORK_DIRECTIVE_FRAME, SUBAGENT_SYSTEM_NOTE, type SubagentToolOptions, type SubagentSpawnContext, type SubagentSteerHandle, type SubagentStep, type SubagentEditedFile, } from "./agents/subagent.js";
162
+ export { getSessionRetainLedger, releaseSessionRetainLedger, } from "./agents/retain-ledger.js";
163
+ export { createSendMessageTool, SEND_MESSAGE_TOOL_NAME, type SendMessageToolOptions } from "./agents/send-message-tool.js";
164
+ export { createAgentTranscriptTool, AGENT_TRANSCRIPT_TOOL_NAME, type AgentTranscriptToolOptions, } from "./agents/agent-transcript-tool.js";
163
165
  export { defineAgent } from "./agents/agent-definition.js";
164
166
  export { builtinAgentDefinitions, BUILTIN_READONLY_DENY_TOOLS, EXPLORE_WHEN_TO_USE, EXPLORE_WHEN_TO_USE_LEAN, PLAN_WHEN_TO_USE, EXPLORE_SYSTEM_PROMPT, PLAN_SYSTEM_PROMPT, } from "./agents/builtin-agents.js";
165
167
  export { runTeamDiscussion, type TeamDiscussionOptions, type TeamMember, type TeamResult, type TeamTurn, type TeamEvent, } from "./agents/team.js";
@@ -177,7 +179,7 @@ export { retryBackoffMs, parseRetryAfter } from "./brain/retry.js";
177
179
  export { type BrainTimeoutConfig } from "./brain/timeout.js";
178
180
  export { createAssistantMessageEventStream } from "./internal/llm.js";
179
181
  export type { AssistantMessage, AssistantMessageEvent, Context, DocumentContent, ImageContent, Message, StopReason, StreamFn, TextContent, ThinkingContent, ToolCall, ToolResultMessage, Usage, UserMessage, } from "./internal/llm.js";
180
- export type { AgentDefinition, BeforeWriteHook, BeforeWriteRequest, BeforeWriteResult, HandsBandOptions, Brain, BrainStatus, BrainStatusPhase, ImageInput, McpElicitRequest, McpElicitResponse, McpServerSpec, OnElicit, MemoryConsolidationConfig, Model, ModelRef, ProjectMemoryLoad, RunnerDeps, RuntimeCaps, BackgroundChildEvent, SkillManifest, SkillSpec, TaskEvent, TaskEventIdentity, ToolActivity, TaskResult, TaskSpec, TaskStatus, TaskStream, CompactOutcome, ThinkingLevel, ToolExecuteContext, ToolReturn, ToolSpec, ToolEffect, WorkflowGovernanceBaseline, } from "./core/types.js";
182
+ export type { AgentDefinition, BeforeWriteHook, BeforeWriteRequest, BeforeWriteResult, HandsBandOptions, Brain, BrainStatus, BrainStatusPhase, ImageInput, McpElicitRequest, McpElicitResponse, McpServerSpec, OnElicit, Model, ModelRef, ProjectMemoryLoad, RunnerDeps, RuntimeCaps, BackgroundChildEvent, SkillManifest, SkillSpec, TaskEvent, TaskEventIdentity, ToolActivity, TaskResult, TaskSpec, TaskStatus, TaskStream, CompactOutcome, ThinkingLevel, ToolExecuteContext, ToolReturn, ToolSpec, ToolEffect, WorkflowGovernanceBaseline, } from "./core/types.js";
181
183
  export { Type } from "typebox";
182
184
  export type { TSchema, Static } from "typebox";
183
185
  export { explainPromptAssembly, describeDefaultPack, type DefaultPackDescription, type ExplainInput } from "./prompt-assembly/explain.js";
package/dist/index.js CHANGED
@@ -1,23 +1,23 @@
1
1
  export { Runner, runTask, DEFAULT_MAX_TURNS } from "./core/runner/runtask.js";
2
2
  export { SESSION_LOG_DIGEST_SCHEME, sessionEntryDigest, sessionLogDigest, sessionLogDigestsComparable, } from "./engine/session/log-digest.js";
3
- export { defineTool, toSkill } from "./core/tools.js";
3
+ export { defineTool } from "./core/tools.js";
4
4
  export { SKILL_TOOL_NAME } from "./core/runner/synthetic-tools.js";
5
5
  export { REPORT_FINDINGS_TOOL_NAME } from "./core/runner/synthetic-tools.js";
6
6
  export { formatToolError, formatZodValidationError, formatValidationPath, truncateError, errorClassOf } from "./core/tool-errors.js";
7
- export { createWebFetchTool, webFetchToolSpec, htmlToText, createWebSearchTool, makeWebFetchSummarizer, WEBFETCH_SUMMARY_MAX_CONTENT, WEBFETCH_SUMMARY_GUIDELINES, } from "./tools/web.js";
7
+ export { createWebFetchTool, webFetchToolSpec, htmlToText, createWebSearchTool, createWebFetchSummarizer, WEBFETCH_SUMMARY_MAX_CONTENT, WEBFETCH_SUMMARY_GUIDELINES, } from "./tools/web.js";
8
8
  export { createTodoWriteTool } from "./tools/todo.js";
9
9
  export { createTaskListTools, createMemoryTaskListStore, assertJsonMetadata } from "./tools/task-list.js";
10
- export { assembleCodeTools, CODE_ROLE, assembleFullBodyTools, FULL_BODY_ROLE } from "./scenarios/full-body.js";
10
+ export { assembleCodeTools, CODE_ROLE } from "./scenarios/full-body.js";
11
11
  export { capAggregateToolResults, AGGREGATE_TOOL_RESULT_BUDGET_CHARS, DEFAULT_BUDGET_EXEMPT_TOOLS, } from "./core/tool-result-budget.js";
12
12
  export { capAggregateMediaBytes, AGGREGATE_MEDIA_BUDGET_BYTES } from "./core/media-byte-cap.js";
13
13
  export { createAskUserQuestionTool, createDurableQuestionPolicy, QUESTION_AWAITS_RESUME, } from "./core/ask-question.js";
14
- export { createLspTool, gitCheckIgnoreFilter, LSP_OPERATIONS, } from "./core/lsp.js";
14
+ export { createLspTool, gitCheckIgnoreFilter, LSP_OPERATIONS, LSP_FAILURE_BRAND, brandLspFailure, lspFailureOf, } from "./core/lsp.js";
15
15
  export { buildRequest, parseResult, callHierarchyMethod, pathToUri } from "./core/lsp-protocol.js";
16
16
  export { TransportLspSession } from "./core/lsp-session.js";
17
17
  export { LspDiagnosticsRegistry, formatDiagnosticsBlock, formatDiagnosticsSummary, } from "./core/lsp-diagnostics.js";
18
18
  export { NodeLspManager, DEFAULT_LSP_SERVERS, languageFor, defaultLspSpawn, } from "./engine/lsp/node-lsp-manager.js";
19
19
  export { StdioLspTransport } from "./engine/lsp/stdio-lsp-transport.js";
20
- export { encodeFrame, makeFrameDecoder } from "./engine/lsp/frame-decoder.js";
20
+ export { encodeFrame, createFrameDecoder } from "./engine/lsp/frame-decoder.js";
21
21
  export { resolveModel, resolveTaskModel, parseModelMention, expandTiers, DEFAULT_TIER_ORDER, CC_MODEL_TIER_ALIASES, ROLE_TIER_DEFAULTS, } from "./core/roles.js";
22
22
  export { selectModel, selectModelOrThrow } from "./core/select-model.js";
23
23
  export { BrainError, classifyHttp } from "./brain/errors.js";
@@ -81,8 +81,8 @@ export { createCcFileMailboxStore, sanitizeCcAgentName } from "./stores/cc/mailb
81
81
  export { listCcSidecarAgents, readCcSidecarTranscript, ccSidecarToMessages, readCcSidecarMessages, } from "./stores/cc/sidecar-transcript.js";
82
82
  export { createMonitorTool } from "./tools/monitor.js";
83
83
  export { createWorktreeTools } from "./tools/worktree.js";
84
- export { sharpImageResizer } from "./core/mcp.js";
85
- export { makeImageDownsampler, sharpImageDownsampler, MCP_IMAGE_MAX_BASE64, IMAGE_TARGET_RAW_SIZE, } from "./core/mcp.js";
84
+ export { sharpImageResizer } from "./core/image-downsample.js";
85
+ export { createImageDownsampler, sharpImageDownsampler, MCP_IMAGE_MAX_BASE64, IMAGE_TARGET_RAW_SIZE, } from "./core/image-downsample.js";
86
86
  export { hasBackgroundShell, BackgroundShellError } from "./core/background-shell.js";
87
87
  export { hasScheduler, isValidCronExpr, SchedulerError } from "./core/scheduler.js";
88
88
  export { createSchedulerTools, SCHEDULE_WAKEUP_TOOL_NAME, AUTONOMOUS_LOOP_SENTINEL, AUTONOMOUS_LOOP_DYNAMIC_SENTINEL, } from "./tools/scheduler-tools.js";
@@ -94,15 +94,14 @@ export { buildAutoModePrompt, renderAutoModeWindow, renderAutoModeAction, AUTO_M
94
94
  export { AUTO_MODE_BASE_PROMPT, AUTO_MODE_PERMISSIONS_EXTERNAL } from "./core/auto-mode-prompt-assets.js";
95
95
  export { createPermissionRulePolicy, validatePermissionRules, parsePermissionRule, wildcardMatch, } from "./core/permission-rules.js";
96
96
  export { formatHookFeedback, runToolGate, } from "./core/hooks.js";
97
- export { InMemoryMemoryStore, composeMemoryBlock, composeLayeredMemoryBlock, normalizeMemorySpec, createRememberTool, createRecallTool, supportsConsolidation, supportsPeriodicConsolidation, firstSentence, expandLexicalTerms, lexicalSearchMatch, classifyPromotable, enforcePromotableWriteGate, guardedMemoryStore, MemoryGateError, detectSecret, enforceSecretWriteGate, enforceStructuredNoteSecretGate, } from "./core/memory.js";
97
+ export { InMemoryMemoryStore, composeMemoryBlock, composeLayeredMemoryBlock, normalizeMemorySpec, supportsConsolidation, supportsPeriodicConsolidation, firstSentence, expandLexicalTerms, lexicalSearchMatch, classifyPromotable, enforcePromotableWriteGate, guardedMemoryStore, MemoryGateError, detectSecret, enforceSecretWriteGate, enforceStructuredNoteSecretGate, } from "./core/memory.js";
98
98
  export { MemoryEngine, FileMemoryEngineBackend, memoryBackendContract, assertMemoryBackendSearchEquivalence, buildMemoryInstruction, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, MEMORY_INSTRUCTION_TEMPLATE, MEMORY_INDEX_FILENAME, MEMORY_INDEX_MAX_LINES, MEMORY_INDEX_MAX_BYTES, STUB_ARCHIVED_LINE, DEFAULT_MAX_MEMORY_FILES, DEFAULT_MAX_ENTRY_DEPTH, DEFAULT_HARVEST_DEADLINE_MS, DEFAULT_HARVEST_FILE_BUDGET, MASS_DELETION_FUSE_RATIO, scanMemoryWrite, scanMemoryFileName, scanRemediation, MEMORY_FILENAME_SEGMENT_RE, renderAnnouncements, enqueueMemoryAnnouncement, drainMemoryAnnouncements, peekMemoryAnnouncements, bumpScanFuse, scanFuseCount, clearScanFuse, ANNOUNCEMENTS_FILE, MEMORY_ANNOUNCEMENTS_MAX, SCAN_FUSE_FILE, SCAN_FUSE_THRESHOLD, SCOPE_SEGMENT_MAX_ENCODED, PROJECT_MARKER_PATH, encodeScopeSegment, decodeScopeSegment, parseScopeKey, formatUserScope, formatOrgScope, formatProjScope, formatUserProjScope, isPersonalScope, assertScopeContractPlacement, formatProjectMarker, parseProjectMarker, resolveProjectId, PROJECT_ID_REGEX, migrateScope, materializeEntriesToFiles, harvestFilesToPatches, projectionsToWriteBack, screenInboundEntries, REMOTE_HARVEST_PER_FILE_BYTES, REMOTE_MASS_DELETION_FUSE_RATIO, deriveProjectMemoryDir, deriveProjectControlDir, recordProjectIdHint, lookupProjectIdHint, PROJECT_ID_HINTS_FILE, reconcileMemoryEntries, nextSyncBaseline, mergeRecallHits, syncMemoryScope, } from "./core/memory-engine/index.js";
99
99
  export { termSet, jaccardDistance, cosineDistance } from "./core/memory-vector.js";
100
- export { createBrainMemorySelector, selectAndComposeMemory, selectAndComposeLayeredMemory, encodeSurfacedKey, buildManifestText, validateSelectedIds, composeSelectiveMemoryBlock, composeSelectiveBody, formatMemoryAge, resolveLinkedIds, RECALL_CAVEAT, DEFAULT_MAX_SELECTED, DEFAULT_MAX_LINKED, } from "./core/memory-recall.js";
101
- export { buildRecallQuery, runDynamicRecall, DEFAULT_RECENT_MESSAGE_WINDOW, DEFAULT_MAX_QUERY_CHARS, } from "./core/dynamic-recall.js";
100
+ export { encodeSurfacedKey, buildManifestText, validateSelectedIds, composeSelectiveBody, formatMemoryAge, resolveLinkedIds, RECALL_CAVEAT, DEFAULT_MAX_SELECTED, DEFAULT_MAX_LINKED, } from "./core/memory-recall.js";
102
101
  export { runMemoryConsolidation, CONSOLIDATION_SYSTEM_PROMPT, DEFAULT_CONSOLIDATION_BAND, DEFAULT_CONSOLIDATION_SEARCH_LIMIT, DEFAULT_CONSOLIDATION_MAX_NOTES, DEFAULT_CONSOLIDATION_TIMEOUT_SEC, normalizeForExactMatch, } from "./core/runner/memory-consolidation.js";
103
102
  export { consolidateScope, advanceCursorAfterInline, } from "./core/consolidate-scope.js";
104
103
  export { DEFAULT_COMPACTION_INSTRUCTIONS } from "./core/auto-compaction.js";
105
- export { DEFAULT_SYSTEM_PROMPT, CODE_AGENT_PROMPT, SUBAGENT_PROMPT, AUTONOMY_SELF_AUDIT, ANTI_VERBOSITY, TOOL_PARAM_JSON, CODE_SYSTEM_PROMPT, FULL_BODY_SYSTEM_PROMPT, MEMORY_GUIDANCE, MEMORY_SAFETY, MEMORY_HYGIENE, OUTPUT_EFFICIENCY, CYBER_RISK, HARNESS_SECTION_ANCHOR, URL_SAFETY, SUMMARIZE_TOOL_RESULTS, EXECUTION_ENVIRONMENT, harnessContext, buildEnvironmentContext, buildGitSnapshot, buildScratchpadSection, GIT_STATUS_MAX_CHARS, formatLocalDate, defaultPromptProvider, composeSystemPrompt, composeConstitution, constitutionBlocks, analyzePromptCacheFriendliness, assertPromptCacheFriendly, } from "./prompts/default.js";
104
+ export { DEFAULT_SYSTEM_PROMPT, CODE_AGENT_PROMPT, SUBAGENT_PROMPT, AUTONOMY_SELF_AUDIT, ANTI_VERBOSITY, TOOL_PARAM_JSON, CODE_SYSTEM_PROMPT, MEMORY_GUIDANCE, MEMORY_SAFETY, MEMORY_HYGIENE, OUTPUT_EFFICIENCY, CYBER_RISK, HARNESS_SECTION_ANCHOR, URL_SAFETY, SUMMARIZE_TOOL_RESULTS, EXECUTION_ENVIRONMENT, harnessContext, buildEnvironmentContext, buildGitSnapshot, buildScratchpadSection, GIT_STATUS_MAX_CHARS, formatLocalDate, defaultPromptProvider, composeSystemPrompt, composeConstitution, constitutionBlocks, analyzePromptCacheFriendliness, assertPromptCacheFriendly, } from "./prompts/default.js";
106
105
  export { SUPERVISOR_PROMPT, ORCHESTRATION_GUIDANCE, ORCHESTRATION_AWARENESS, GOAL_COMPLETION_GUIDANCE } from "./prompts/supervisor.js";
107
106
  export { compose, validatePack } from "./prompt-assembly/composer.js";
108
107
  export { SEMA_DEFAULT_PACK } from "./prompt-assembly/packs/sema-default.js";
@@ -140,13 +139,16 @@ export { FileWorkflowRunStore } from "./stores/file/workflow-run-store.js";
140
139
  export { workflowRunStoreContract } from "./core/workflow-run-store-contract.js";
141
140
  export { canAccessAgentRecord, BackgroundAgentStoreError, InMemoryBackgroundAgentStore, reconcileParkedAgents, } from "./core/background-agent-store.js";
142
141
  export { FileBackgroundAgentStore } from "./stores/file/background-agent-store.js";
143
- export { InMemoryWorkflowJournalStore, callKeyOrdinal, } from "./core/workflow-journal-store.js";
142
+ export { InMemoryWorkflowJournalStore, callKeyOrdinal, JOURNAL_OVERSIZE_ERROR_CODE, } from "./core/workflow-journal-store.js";
144
143
  export { untrustedEgressForHuman, redactHostLeaks, redactSecrets, boundedRedactedSummary } from "./core/untrusted-egress.js";
145
144
  export { MemoryRosterStore, FileRosterStore } from "./agents/roster-store.js";
146
145
  export { CONFIG_CATALOG_VERSION, describeConfigCatalog, resolveEffectiveConfig, } from "./config/catalog.js";
147
146
  export { normalizeAgentName } from "./core/task-registry.js";
148
147
  export { COORDINATOR_ROLE_PROMPT, TEAMMATE_COMMUNICATION_ADDENDUM, TEAMMATE_TASK_LIST_ADDENDUM } from "./prompts/coordinator.js";
149
- export { createSubagentTool, createSendMessageTool, createAgentTranscriptTool, AGENT_TRANSCRIPT_TOOL_NAME, FORK_SUBAGENT_TYPE, GENERAL_PURPOSE_SUBAGENT_TYPE, FORK_DEFAULT_MAX_TURNS, agentWhenToUseText, FORK_DIRECTIVE_FRAME, SEND_MESSAGE_TOOL_NAME, SUBAGENT_SYSTEM_NOTE, getSessionRetainLedger, releaseSessionRetainLedger, } from "./agents/subagent.js";
148
+ export { createSubagentTool, FORK_SUBAGENT_TYPE, GENERAL_PURPOSE_SUBAGENT_TYPE, FORK_DEFAULT_MAX_TURNS, agentWhenToUseText, FORK_DIRECTIVE_FRAME, SUBAGENT_SYSTEM_NOTE, } from "./agents/subagent.js";
149
+ export { getSessionRetainLedger, releaseSessionRetainLedger, } from "./agents/retain-ledger.js";
150
+ export { createSendMessageTool, SEND_MESSAGE_TOOL_NAME } from "./agents/send-message-tool.js";
151
+ export { createAgentTranscriptTool, AGENT_TRANSCRIPT_TOOL_NAME, } from "./agents/agent-transcript-tool.js";
150
152
  export { defineAgent } from "./agents/agent-definition.js";
151
153
  export { builtinAgentDefinitions, BUILTIN_READONLY_DENY_TOOLS, EXPLORE_WHEN_TO_USE, EXPLORE_WHEN_TO_USE_LEAN, PLAN_WHEN_TO_USE, EXPLORE_SYSTEM_PROMPT, PLAN_SYSTEM_PROMPT, } from "./agents/builtin-agents.js";
152
154
  export { runTeamDiscussion, } from "./agents/team.js";
@@ -0,0 +1,7 @@
1
+ export type { CompactionPreparation, SummarizationClampDryRun } from "../engine/compaction/compaction.js";
2
+ export type { InvokedSkillRetention } from "../engine/compaction/utils.js";
3
+ export type { AgentCoreRuntimeDeps } from "../engine/loop/runtime-deps.js";
4
+ export type { AgentMessage, AgentTool, AgentToolResult, ThinkingLevel, } from "../engine/loop/types.js";
5
+ export type { AgentHarnessEvent, CompactionSettings, ExecutionEnv, ExecutionErrorCode, FileErrorCode, FileInfo, Result, Session, SessionMetadata, SessionRepo, SessionStorage, SessionTreeEntry, Skill, } from "../engine/harness/types.js";
6
+ export type { ExecutionEnvExecOptions } from "../engine/harness/types.js";
7
+ export type { SessionWriteOptions, CompactionEntry } from "../engine/harness/types.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -1,14 +1,9 @@
1
+ export * from "./harness-types.js";
1
2
  export { AgentHarness } from "../engine/harness/agent-harness.js";
2
3
  export { CompactionError, ExecutionError, FileError, ok, err } from "../engine/harness/types.js";
3
4
  export { DEFAULT_CHARS_PER_TOKEN, DEFAULT_CLAMP_TOLERANCE, DEFAULT_COMPACTION_SETTINGS, compact, computeFileLists, dryRunSummarizationClamp, estimateContextTokens, estimateTokens, prepareCompaction, shouldCompact, summaryOutputBudgetTokens, } from "../engine/compaction/compaction.js";
4
- export type { CompactionPreparation, SummarizationClampDryRun } from "../engine/compaction/compaction.js";
5
5
  export { SKILL_RETENTION_PER_SKILL_MAX_CHARS, SKILL_RETENTION_TOTAL_MAX_CHARS, SKILL_RETENTION_TRUNCATION_MARKER, readRetainedInvokedSkills, renderInvokedSkillsRetention, } from "../engine/compaction/utils.js";
6
- export type { InvokedSkillRetention } from "../engine/compaction/utils.js";
7
- export type { AgentCoreRuntimeDeps } from "../engine/loop/runtime-deps.js";
8
- export type { AgentMessage, AgentTool, AgentToolResult, ThinkingLevel, } from "../engine/loop/types.js";
9
- export type { AgentHarnessEvent, CompactionSettings, ExecutionEnv, ExecutionErrorCode, FileErrorCode, FileInfo, Result, Session, SessionMetadata, SessionRepo, SessionStorage, SessionTreeEntry, Skill, } from "../engine/harness/types.js";
10
6
  export { NodeExecutionEnv } from "../engine/execution-env/node-execution-env.js";
11
- export type { ExecutionEnvExecOptions } from "../engine/harness/types.js";
12
7
  export { StoredSession, buildSessionContext } from "../engine/session/session.js";
13
8
  export { getEntriesToFork } from "../engine/session/repo-utils.js";
14
9
  export { validateEntriesForImport, StreamingImportValidator } from "../engine/session/import-validate.js";
@@ -17,4 +12,3 @@ export { InMemorySessionStorage } from "../engine/session/memory-storage.js";
17
12
  export { InMemorySessionRepo } from "../engine/session/memory-repo.js";
18
13
  export { uuidv7 } from "../engine/session/uuid.js";
19
14
  export { SessionError } from "../engine/harness/types.js";
20
- export type { SessionWriteOptions, CompactionEntry } from "../engine/harness/types.js";
@@ -1,3 +1,4 @@
1
+ export * from "./harness-types.js";
1
2
  export { AgentHarness } from "../engine/harness/agent-harness.js";
2
3
  export { CompactionError, ExecutionError, FileError, ok, err } from "../engine/harness/types.js";
3
4
  export { DEFAULT_CHARS_PER_TOKEN, DEFAULT_CLAMP_TOLERANCE, DEFAULT_COMPACTION_SETTINGS, compact, computeFileLists, dryRunSummarizationClamp, estimateContextTokens, estimateTokens, prepareCompaction, shouldCompact, summaryOutputBudgetTokens, } from "../engine/compaction/compaction.js";
@@ -4,7 +4,7 @@ import { delimitUntrusted } from "../core/untrusted-text.js";
4
4
  import { OUTPUT_TOOL_NAME } from "../core/runner/synthetic-tools.js";
5
5
  import { isDurablePause } from "../agents/suspend-guard.js";
6
6
  export const DECLARE_DONE_TOOL_NAME = "DeclareDone";
7
- function makeDeclareDoneTool(ref) {
7
+ function createDeclareDoneTool(ref) {
8
8
  return {
9
9
  name: DECLARE_DONE_TOOL_NAME,
10
10
  description: "Call this ONLY when you believe the goal is FULLY achieved — verified against evidence, not just " +
@@ -133,7 +133,7 @@ export async function runGoal(runner, spec) {
133
133
  const doneRef = {};
134
134
  const tools = hasOutputSchema
135
135
  ? spec.taskSpec.tools
136
- : [...(spec.taskSpec.tools ?? []), makeDeclareDoneTool(doneRef)];
136
+ : [...(spec.taskSpec.tools ?? []), createDeclareDoneTool(doneRef)];
137
137
  const result = await runner.runTask({ ...spec.taskSpec, sessionId, objective, tools, signal: goalSignal }, { goalMode: true });
138
138
  lastResult = result;
139
139
  cumulativeTokens += (result.stats.tokens ?? 0) + (result.stats.nested?.tokens ?? 0);
@@ -1,4 +1,4 @@
1
- import type { AgentTool } from "../internal/harness.js";
1
+ import type { AgentTool } from "../internal/harness-types.js";
2
2
  import type { Model } from "../internal/llm.js";
3
3
  import type { Runner } from "../core/runner/runtask.js";
4
4
  import type { WorkflowGovernanceBaseline } from "../core/types.js";
@@ -25,6 +25,7 @@ export interface WorkflowCompletionNotifier {
25
25
  result?: string;
26
26
  usage?: unknown;
27
27
  diagnostics?: string;
28
+ completionId?: string;
28
29
  }): Promise<void> | void;
29
30
  ackServed?(input: {
30
31
  runId: string;
@@ -1,5 +1,5 @@
1
1
  import { Type } from "typebox";
2
- import { defineTool } from "../core/tools.js";
2
+ import { defineTool, errorResult } from "../core/tools.js";
3
3
  import { redactSecrets, redactHostLeaks, boundedRedactedSummary } from "../core/untrusted-egress.js";
4
4
  import { startWorkflow } from "./workflow.js";
5
5
  import { buildWorkflowPrimitives } from "./workflow-primitives.js";
@@ -27,8 +27,19 @@ function completionSummary(name, run) {
27
27
  const failed = run.agents.filter((a) => a.status === "failed").length;
28
28
  const secs = run.endedAt !== undefined ? Math.max(0, Math.round((run.endedAt - run.startedAt) / 1000)) : undefined;
29
29
  const elapsed = secs === undefined ? "" : secs >= 60 ? ` in ${Math.floor(secs / 60)}m${secs % 60}s` : ` in ${secs}s`;
30
+ const resumeClause = run.resume === undefined
31
+ ? ""
32
+ : run.resume.journalEntries === 0
33
+ ? "; resume found NO journal entries — nothing replayed, the whole script re-ran live"
34
+ : `; resume: replayed ${run.resume.replayed} of ${run.resume.journalEntries} journaled results`;
30
35
  return (`workflow${cleanName ? ` "${cleanName}"` : ""} completed${elapsed} — agents ${done}/${run.agents.length} done` +
31
- `${failed > 0 ? ` (${failed} failed)` : ""}; full result + per-agent rows via TaskOutput("${run.id}")`);
36
+ `${failed > 0 ? ` (${failed} failed)` : ""}${resumeClause}; full result + per-agent rows via TaskOutput("${run.id}")`);
37
+ }
38
+ function completionIdFromRejection(err) {
39
+ if (err === null || (typeof err !== "object" && typeof err !== "function"))
40
+ return undefined;
41
+ const run = err.workflowRun;
42
+ return run?.completionId;
32
43
  }
33
44
  function workflowUsageBlock(run) {
34
45
  const agents = run.agents;
@@ -38,19 +49,26 @@ function workflowUsageBlock(run) {
38
49
  agents_done: agents.filter((a) => a.status === "completed").length,
39
50
  agents_error: agents.filter((a) => a.status === "failed").length,
40
51
  agents_empty_result: agents.filter((a) => a.status === "completed" && (a.output === undefined || a.output === "")).length,
52
+ agents_replayed: agents.filter((a) => a.replayed === true).length,
53
+ ...(run.journalSkips !== undefined && run.journalSkips > 0 ? { journal_skipped: run.journalSkips } : {}),
54
+ ...(run.resume !== undefined ? { resume_journal_entries: run.resume.journalEntries } : {}),
41
55
  subagent_tokens: run.stats.tokens + run.stats.nested.tokens,
42
56
  tool_uses: agents.reduce((n, a) => n + (a.toolCalls ?? 0), 0),
43
57
  ...(run.endedAt !== undefined ? { duration_ms: run.endedAt - run.startedAt } : {}),
44
58
  };
45
59
  }
46
- function workflowDiagnostics(runId, journalRef) {
60
+ function workflowDiagnostics(runId, journalRef, resumeMiss) {
47
61
  const journalTeach = journalRef === undefined
48
62
  ? ""
49
63
  : journalRef.includes("://")
50
64
  ? ` Full journal: ${journalRef}.`
51
65
  : ` Full journal: ${journalRef} (a deployment data path — if Read is denied there, use the TaskOutput route above instead).`;
66
+ const resumeMissTeach = resumeMiss
67
+ ? ` NOTE: this was a resume, but the prior run's journal was not usable under this scope — verify the runId and that this deployment wires a journalStore; the results above are from a full live re-run.`
68
+ : "";
52
69
  return (`Per-agent rows (status / error / elapsed): TaskOutput({ task_id: "${runId}" }) — read them before assuming an empty or unexpected result.` +
53
70
  journalTeach +
71
+ resumeMissTeach +
54
72
  ` To continue after editing the script: re-invoke with resumeFromRunId: "${runId}" (completed agents replay from the journal; only new/changed calls run).`);
55
73
  }
56
74
  const SCRIPT_ERROR_CODES = new Set([
@@ -151,7 +169,7 @@ export async function createRunWorkflowTool(d) {
151
169
  const builtinsEnabled = d.builtinWorkflows !== false;
152
170
  const namedWorkflowSection = renderNamedWorkflowListing(await collectNamedWorkflowListings(d.scriptStore, builtinsEnabled));
153
171
  const sizeGuidelineSection = workflowSizeGuidelineSection(d.sizeGuideline ?? lim.sizeGuideline);
154
- const structuredError = (message) => ({ content: JSON.stringify({ error: message }) });
172
+ const structuredError = (message) => errorResult(JSON.stringify({ error: message }));
155
173
  return defineTool({
156
174
  name: RUN_WORKFLOW_TOOL_NAME,
157
175
  aliases: ["RunWorkflow", "run_workflow"],
@@ -460,6 +478,7 @@ export async function createRunWorkflowTool(d) {
460
478
  ...(notification.result !== undefined ? { result: redactHostLeaks(notification.result) } : {}),
461
479
  ...(notification.usage !== undefined ? { usage: notification.usage } : {}),
462
480
  ...(notification.diagnostics !== undefined ? { diagnostics: redactHostLeaks(notification.diagnostics) } : {}),
481
+ ...(notification.completionId !== undefined ? { completionId: notification.completionId } : {}),
463
482
  }))
464
483
  .catch(() => { });
465
484
  };
@@ -472,7 +491,8 @@ export async function createRunWorkflowTool(d) {
472
491
  summary: completionSummary(meta.name, res.run),
473
492
  result: boundedRedactedSummary(res.result, 4000),
474
493
  usage: workflowUsageBlock(res.run),
475
- diagnostics: workflowDiagnostics(runId, d.journalStore?.locator?.(runId, res.run.scope)),
494
+ diagnostics: workflowDiagnostics(runId, d.journalStore?.locator?.(runId, res.run.scope), res.run.resume?.journalEntries === 0),
495
+ completionId: res.run.completionId,
476
496
  }), (err) => fire({
477
497
  task_id: runId,
478
498
  task_type: "workflow",
@@ -480,6 +500,7 @@ export async function createRunWorkflowTool(d) {
480
500
  status: "failed",
481
501
  summary: failureSummary(err, runId),
482
502
  diagnostics: workflowDiagnostics(runId, undefined),
503
+ ...(completionIdFromRejection(err) !== undefined ? { completionId: completionIdFromRejection(err) } : {}),
483
504
  }))
484
505
  .catch(() => { });
485
506
  }
@@ -504,7 +525,8 @@ export async function createRunWorkflowTool(d) {
504
525
  summary: completionSummary(meta.name, res.run),
505
526
  result: boundedRedactedSummary(res.result, 4000),
506
527
  usage: workflowUsageBlock(res.run),
507
- diagnostics: workflowDiagnostics(runId, d.journalStore?.locator?.(runId, res.run.scope)),
528
+ diagnostics: workflowDiagnostics(runId, d.journalStore?.locator?.(runId, res.run.scope), res.run.resume?.journalEntries === 0),
529
+ completionId: res.run.completionId,
508
530
  }), (err) => fire({
509
531
  task_id: runId,
510
532
  task_type: "workflow",
@@ -512,6 +534,7 @@ export async function createRunWorkflowTool(d) {
512
534
  status: "failed",
513
535
  summary: failureSummary(err, runId),
514
536
  diagnostics: workflowDiagnostics(runId, undefined),
537
+ ...(completionIdFromRejection(err) !== undefined ? { completionId: completionIdFromRejection(err) } : {}),
515
538
  }))
516
539
  .catch(() => { });
517
540
  }
@@ -0,0 +1,193 @@
1
+ import type { TaskResult, TaskStatus, ToolActivity } from "../core/types.js";
2
+ export type WorkflowRunStatus = "running" | "completed" | "failed";
3
+ export type WorkflowItemStatus = "running" | "completed" | "failed";
4
+ export interface WorkflowPhase {
5
+ title: string;
6
+ status: WorkflowItemStatus | "pending";
7
+ detail?: string;
8
+ model?: string;
9
+ agentFailures?: number;
10
+ startedAt: number;
11
+ endedAt?: number;
12
+ }
13
+ export interface WorkflowGroup {
14
+ groupId: string;
15
+ parentGroupId?: string;
16
+ status: WorkflowItemStatus;
17
+ startedAt: number;
18
+ endedAt?: number;
19
+ }
20
+ export interface WorkflowAgentRun {
21
+ label: string;
22
+ callKey: string;
23
+ groupId?: string;
24
+ phase?: string;
25
+ model?: string;
26
+ prompt?: string;
27
+ output?: string;
28
+ toolCalls?: number;
29
+ activity?: ToolActivity[];
30
+ status: WorkflowItemStatus;
31
+ errorCode?: string;
32
+ errorMessage?: string;
33
+ taskStatus?: TaskStatus;
34
+ queuedAt: number;
35
+ startedAt?: number;
36
+ endedAt?: number;
37
+ stats?: {
38
+ tokens: number;
39
+ turns: number;
40
+ costMicroUsd?: number;
41
+ };
42
+ replayed?: boolean;
43
+ attempts?: number;
44
+ lastAttemptReason?: string;
45
+ sessionId?: string;
46
+ }
47
+ export interface WorkflowRunStats {
48
+ tokens: number;
49
+ turns: number;
50
+ costMicroUsd: number;
51
+ nested: {
52
+ tokens: number;
53
+ turns: number;
54
+ tasks: number;
55
+ costMicroUsd: number;
56
+ };
57
+ }
58
+ export interface WorkflowRun {
59
+ id: string;
60
+ scope: string;
61
+ name?: string;
62
+ description?: string;
63
+ sourceTaskId?: string;
64
+ originatingSessionId?: string;
65
+ effectiveArgs?: unknown;
66
+ status: WorkflowRunStatus;
67
+ agentFailures?: number;
68
+ phases: WorkflowPhase[];
69
+ agents: WorkflowAgentRun[];
70
+ groups: WorkflowGroup[];
71
+ stats: WorkflowRunStats;
72
+ startedAt: number;
73
+ endedAt?: number;
74
+ createdAt: number;
75
+ rev?: number;
76
+ error?: string;
77
+ result?: string;
78
+ resultFull?: string;
79
+ completionId?: string;
80
+ resume?: {
81
+ fromRunId: string;
82
+ journalEntries: number;
83
+ replayed: number;
84
+ divergedAtOrdinal?: number;
85
+ divergedReason?: string;
86
+ };
87
+ journalSkips?: number;
88
+ }
89
+ export type WorkflowEvent = {
90
+ type: "run_start";
91
+ runId: string;
92
+ scope: string;
93
+ ts: number;
94
+ } | {
95
+ type: "phase_start";
96
+ runId: string;
97
+ title: string;
98
+ ts: number;
99
+ } | {
100
+ type: "phase_end";
101
+ runId: string;
102
+ title: string;
103
+ status: WorkflowItemStatus;
104
+ agentFailures?: number;
105
+ ts: number;
106
+ } | {
107
+ type: "agent_start";
108
+ runId: string;
109
+ label: string;
110
+ phase?: string;
111
+ groupId?: string;
112
+ callKey?: string;
113
+ prompt?: string;
114
+ model?: string;
115
+ queuedAt?: number;
116
+ replayed?: boolean;
117
+ ts: number;
118
+ } | {
119
+ type: "agent_end";
120
+ runId: string;
121
+ label: string;
122
+ phase?: string;
123
+ groupId?: string;
124
+ status: WorkflowItemStatus;
125
+ output?: string;
126
+ errorCode?: string;
127
+ toolCalls?: number;
128
+ replayed?: boolean;
129
+ ts: number;
130
+ } | {
131
+ type: "agent_activity";
132
+ runId: string;
133
+ callKey: string;
134
+ label: string;
135
+ groupId?: string;
136
+ phase: "start" | "end";
137
+ toolCallId: string;
138
+ toolName: string;
139
+ arg?: string;
140
+ isError?: boolean;
141
+ ts: number;
142
+ } | {
143
+ type: "subgroup_start";
144
+ runId: string;
145
+ groupId: string;
146
+ parentGroupId?: string;
147
+ ts: number;
148
+ } | {
149
+ type: "subgroup_end";
150
+ runId: string;
151
+ groupId: string;
152
+ status: WorkflowItemStatus;
153
+ ts: number;
154
+ } | {
155
+ type: "log";
156
+ runId: string;
157
+ message: string;
158
+ ts: number;
159
+ } | {
160
+ type: "run_end";
161
+ runId: string;
162
+ status: WorkflowRunStatus;
163
+ agentFailures?: number;
164
+ ts: number;
165
+ };
166
+ export declare class WorkflowBudgetExceededError extends Error {
167
+ readonly spent: number;
168
+ readonly total: number;
169
+ readonly code = "workflow.budget_exceeded";
170
+ constructor(spent: number, total: number);
171
+ }
172
+ export declare class WorkflowNestingError extends Error {
173
+ readonly code = "workflow.nesting";
174
+ constructor();
175
+ }
176
+ export declare class WorkflowAgentSchemaError extends Error {
177
+ readonly label: string;
178
+ readonly result?: TaskResult | undefined;
179
+ readonly code = "workflow.agent_schema";
180
+ constructor(label: string, result?: TaskResult | undefined);
181
+ }
182
+ export declare class WorkflowAgentStalledError extends Error {
183
+ readonly attempts: number;
184
+ readonly stallMs: number;
185
+ readonly lastResult?: TaskResult | undefined;
186
+ readonly code = "workflow.agent_stalled";
187
+ constructor(attempts: number, stallMs: number, lastResult?: TaskResult | undefined);
188
+ }
189
+ export declare class WorkflowMaxAgentsError extends Error {
190
+ readonly max: number;
191
+ readonly code = "workflow.max_agents";
192
+ constructor(max: number);
193
+ }