@sema-agent/core 1.452.0 → 2.0.1
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/dist/agents/agent-transcript-tool.d.ts +15 -0
- package/dist/agents/agent-transcript-tool.js +122 -0
- package/dist/agents/cascade.js +5 -8
- package/dist/agents/repair-loop.d.ts +1 -1
- package/dist/agents/repair-loop.js +1 -1
- package/dist/agents/retain-ledger.d.ts +60 -0
- package/dist/agents/retain-ledger.js +225 -0
- package/dist/agents/roster-store.d.ts +1 -0
- package/dist/agents/roster-store.js +9 -0
- package/dist/agents/send-message-tool.d.ts +41 -0
- package/dist/agents/send-message-tool.js +469 -0
- package/dist/agents/subagent.d.ts +33 -108
- package/dist/agents/subagent.js +22 -834
- package/dist/agents/teacher.d.ts +0 -1
- package/dist/agents/teacher.js +0 -9
- package/dist/bin/sema-tb.js +3 -3
- package/dist/brain/anthropic.js +15 -40
- package/dist/brain/openai.js +15 -40
- package/dist/brain/reasoning.d.ts +1 -1
- package/dist/brain/stream-engine.js +2 -2
- package/dist/brain/stream-shared.d.ts +17 -0
- package/dist/brain/stream-shared.js +50 -0
- package/dist/brain/timeout.d.ts +1 -1
- package/dist/brain/timeout.js +1 -1
- package/dist/config/catalog.js +1 -3
- package/dist/config/defaults.d.ts +6 -0
- package/dist/config/defaults.js +6 -0
- package/dist/core/ask-question.d.ts +1 -1
- package/dist/core/background-shell.d.ts +1 -1
- package/dist/core/checkpoint-store.d.ts +0 -1
- package/dist/core/exec-gate.d.ts +1 -1
- package/dist/core/exec-output-tail.d.ts +1 -0
- package/dist/core/exec-output-tail.js +6 -0
- package/dist/core/file-snapshot-store.d.ts +1 -1
- package/dist/core/fs-write-gate-policy.d.ts +1 -1
- package/dist/core/git-worktree-env.d.ts +1 -1
- package/dist/core/hooks.d.ts +1 -1
- package/dist/core/image-downsample.d.ts +44 -0
- package/dist/core/image-downsample.js +97 -0
- package/dist/core/lsp.d.ts +1 -1
- package/dist/core/mcp.d.ts +3 -45
- package/dist/core/mcp.js +2 -97
- package/dist/core/media-byte-cap.d.ts +1 -1
- package/dist/core/memory-recall.d.ts +0 -12
- package/dist/core/memory-recall.js +0 -222
- package/dist/core/memory.d.ts +0 -6
- package/dist/core/memory.js +0 -88
- package/dist/core/message-utils.d.ts +1 -1
- package/dist/core/oracle-isolation.d.ts +1 -1
- package/dist/core/remote-env.d.ts +1 -1
- package/dist/core/roles.d.ts +1 -1
- package/dist/core/runner/active-skill-scope.d.ts +1 -1
- package/dist/core/runner/assemble-result.d.ts +0 -2
- package/dist/core/runner/memory-consolidation.d.ts +1 -1
- package/dist/core/runner/prepare-memory.d.ts +16 -0
- package/dist/core/runner/prepare-memory.js +191 -0
- package/dist/core/runner/prepare-task.d.ts +4 -28
- package/dist/core/runner/prepare-task.js +19 -207
- package/dist/core/runner/prompt-suggestions.d.ts +1 -1
- package/dist/core/runner/runtask.d.ts +2 -3
- package/dist/core/runner/runtask.js +337 -529
- package/dist/core/runner/session-rule-policy.d.ts +1 -1
- package/dist/core/runner/synthetic-tools.d.ts +5 -5
- package/dist/core/runner/synthetic-tools.js +4 -4
- package/dist/core/runner/tool-disclosure.d.ts +3 -3
- package/dist/core/runner/tool-disclosure.js +2 -2
- package/dist/core/runner/tool-output-projection.d.ts +6 -0
- package/dist/core/runner/tool-output-projection.js +81 -0
- package/dist/core/runtime.d.ts +1 -1
- package/dist/core/scheduler.d.ts +1 -1
- package/dist/core/sensitive-path-policy.d.ts +1 -1
- package/dist/core/session-reconcile.d.ts +1 -1
- package/dist/core/session-store.d.ts +2 -1
- package/dist/core/session-store.js +2 -1
- package/dist/core/session.d.ts +0 -1
- package/dist/core/task-registry-agent.d.ts +115 -0
- package/dist/core/task-registry-agent.js +1163 -0
- package/dist/core/task-registry-monitor.d.ts +13 -0
- package/dist/core/task-registry-monitor.js +347 -0
- package/dist/core/task-registry-shared.d.ts +294 -0
- package/dist/core/task-registry-shared.js +271 -0
- package/dist/core/task-registry-workflow.d.ts +5 -0
- package/dist/core/task-registry-workflow.js +143 -0
- package/dist/core/task-registry.d.ts +51 -216
- package/dist/core/task-registry.js +127 -1940
- package/dist/core/task-tool-shape.d.ts +32 -0
- package/dist/core/task-tool-shape.js +83 -0
- package/dist/core/tool-policy.d.ts +1 -2
- package/dist/core/tool-result-budget.d.ts +1 -1
- package/dist/core/tool-result-store.d.ts +2 -2
- package/dist/core/tool-result-store.js +1 -1
- package/dist/core/tools.d.ts +2 -3
- package/dist/core/tools.js +1 -8
- package/dist/core/trace.d.ts +2 -2
- package/dist/core/types.d.ts +0 -29
- package/dist/core/workflow-run-store-contract.d.ts +1 -1
- package/dist/core/workflow-run-store-contract.js +19 -19
- package/dist/engine/execution-env/node-execution-env.d.ts +13 -0
- package/dist/engine/execution-env/node-execution-env.js +55 -25
- package/dist/engine/loop/agent-loop.d.ts +1 -1
- package/dist/engine/loop/agent-loop.js +10 -9
- package/dist/engine/lsp/frame-decoder.d.ts +1 -1
- package/dist/engine/lsp/frame-decoder.js +1 -1
- package/dist/engine/lsp/node-lsp-manager.d.ts +1 -1
- package/dist/engine/lsp/stdio-lsp-transport.js +2 -2
- package/dist/index.d.ts +16 -14
- package/dist/index.js +13 -11
- package/dist/internal/harness-types.d.ts +7 -0
- package/dist/internal/harness-types.js +1 -0
- package/dist/internal/harness.d.ts +1 -7
- package/dist/internal/harness.js +1 -0
- package/dist/orchestration/goal.js +2 -2
- package/dist/orchestration/run-workflow-tool.d.ts +1 -1
- package/dist/orchestration/workflow-types.d.ts +193 -0
- package/dist/orchestration/workflow-types.js +54 -0
- package/dist/orchestration/workflow.d.ts +3 -193
- package/dist/orchestration/workflow.js +7 -59
- package/dist/prompt-assembly/assemble.d.ts +3 -3
- package/dist/prompt-assembly/assemble.js +0 -16
- package/dist/prompt-assembly/explain.d.ts +1 -1
- package/dist/prompt-assembly/tool-catalog.d.ts +1 -1
- package/dist/prompts/default.d.ts +1 -6
- package/dist/prompts/default.js +3 -11
- package/dist/scenarios/env.d.ts +1 -1
- package/dist/scenarios/full-body.d.ts +0 -3
- package/dist/scenarios/full-body.js +0 -2
- package/dist/stores/file/background-agent-store.d.ts +2 -15
- package/dist/stores/file/background-agent-store.js +30 -100
- package/dist/stores/file/checkpoint-store.d.ts +1 -14
- package/dist/stores/file/checkpoint-store.js +47 -119
- package/dist/stores/file/file-snapshot-store.d.ts +1 -1
- package/dist/stores/file/mailbox-store.js +33 -2
- package/dist/stores/file/shared-ledger.d.ts +35 -0
- package/dist/stores/file/shared-ledger.js +94 -0
- package/dist/stores/file/workflow-run-store.d.ts +1 -14
- package/dist/stores/file/workflow-run-store.js +24 -93
- package/dist/tools/fs/bash-readonly-classifier.d.ts +8 -0
- package/dist/tools/fs/bash-readonly-classifier.js +166 -0
- package/dist/tools/fs/fs-bash.d.ts +31 -0
- package/dist/tools/fs/fs-bash.js +672 -0
- package/dist/tools/fs/fs-pdf.d.ts +22 -0
- package/dist/tools/fs/fs-pdf.js +236 -0
- package/dist/tools/fs/fs-read.d.ts +8 -0
- package/dist/tools/fs/fs-read.js +286 -0
- package/dist/tools/fs/fs-search-tools.d.ts +5 -0
- package/dist/tools/fs/fs-search-tools.js +175 -0
- package/dist/tools/fs/fs-shared.d.ts +56 -0
- package/dist/tools/fs/fs-shared.js +148 -0
- package/dist/tools/fs/fs-write.d.ts +8 -0
- package/dist/tools/fs/fs-write.js +421 -0
- package/dist/tools/fs/index.d.ts +12 -65
- package/dist/tools/fs/index.js +26 -2090
- package/dist/tools/fs/pdf.d.ts +1 -1
- package/dist/tools/fs/repo-map.d.ts +3 -3
- package/dist/tools/fs/repo-map.js +1 -1
- package/dist/tools/fs/safety.d.ts +4 -1
- package/dist/tools/fs/safety.js +7 -1
- package/dist/tools/fs/search.d.ts +2 -1
- package/dist/tools/fs/search.js +21 -3
- package/dist/tools/monitor.d.ts +1 -1
- package/dist/tools/scheduler-tools.d.ts +1 -1
- package/dist/tools/web.d.ts +2 -2
- package/dist/tools/web.js +46 -8
- package/dist/tools/worktree.d.ts +1 -1
- package/package.json +1 -1
- package/dist/core/dynamic-recall.d.ts +0 -32
- package/dist/core/dynamic-recall.js +0 -76
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type SessionWarmup } from "../../core/lsp-session.js";
|
|
2
2
|
import { type LspChildProcess } from "./stdio-lsp-transport.js";
|
|
3
3
|
import { type LspServerManager, type LspSession, type LspReadText } from "../../core/lsp.js";
|
|
4
|
-
import type { ExecutionEnv } from "../../internal/harness.js";
|
|
4
|
+
import type { ExecutionEnv } from "../../internal/harness-types.js";
|
|
5
5
|
export declare const DEFAULT_LSP_SERVERS: Readonly<Record<string, string>>;
|
|
6
6
|
export type LspSpawn = (command: string, args: string[], cwd: string, signal?: AbortSignal) => Promise<LspChildProcess | undefined>;
|
|
7
7
|
export interface NodeLspManagerOptions {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { encodeFrame,
|
|
1
|
+
import { encodeFrame, createFrameDecoder } from "./frame-decoder.js";
|
|
2
2
|
import { killProcessTree } from "../execution-env/kill-tree.js";
|
|
3
3
|
import { brandLspFailure } from "../../core/lsp.js";
|
|
4
4
|
export class StdioLspTransport {
|
|
@@ -7,7 +7,7 @@ export class StdioLspTransport {
|
|
|
7
7
|
nextId = 0;
|
|
8
8
|
pending = new Map();
|
|
9
9
|
isClosed = false;
|
|
10
|
-
decode =
|
|
10
|
+
decode = createFrameDecoder();
|
|
11
11
|
notificationHandlers = new Set();
|
|
12
12
|
constructor(child, requestTimeoutMs = 30_000) {
|
|
13
13
|
this.child = child;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
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
|
|
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,
|
|
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
|
|
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";
|
|
@@ -19,7 +19,7 @@ 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,
|
|
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
|
|
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/
|
|
95
|
-
export {
|
|
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
|
|
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,
|
|
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 {
|
|
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,
|
|
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";
|
|
@@ -159,7 +158,10 @@ export { MemoryRosterStore, FileRosterStore, type RosterStore, type RosterEntry,
|
|
|
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,
|
|
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,
|
|
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,13 +1,13 @@
|
|
|
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
|
|
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,
|
|
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
|
|
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";
|
|
@@ -17,7 +17,7 @@ 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,
|
|
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/
|
|
85
|
-
export {
|
|
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,
|
|
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 {
|
|
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,
|
|
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";
|
|
@@ -146,7 +145,10 @@ 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,
|
|
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";
|
package/dist/internal/harness.js
CHANGED
|
@@ -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
|
|
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 ?? []),
|
|
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";
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export class WorkflowBudgetExceededError extends Error {
|
|
2
|
+
spent;
|
|
3
|
+
total;
|
|
4
|
+
code = "workflow.budget_exceeded";
|
|
5
|
+
constructor(spent, total) {
|
|
6
|
+
super(`Workflow token budget exceeded (${spent.toLocaleString()} / ${total.toLocaleString()} output tokens). ` +
|
|
7
|
+
`Stopping further agent() calls. In-flight agents will complete; their results are preserved.`);
|
|
8
|
+
this.spent = spent;
|
|
9
|
+
this.total = total;
|
|
10
|
+
this.name = "WorkflowBudgetExceededError";
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export class WorkflowNestingError extends Error {
|
|
14
|
+
code = "workflow.nesting";
|
|
15
|
+
constructor() {
|
|
16
|
+
super("workflow nesting is capped at one level: a workflow's agent cannot start another workflow");
|
|
17
|
+
this.name = "WorkflowNestingError";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export class WorkflowAgentSchemaError extends Error {
|
|
21
|
+
label;
|
|
22
|
+
result;
|
|
23
|
+
code = "workflow.agent_schema";
|
|
24
|
+
constructor(label, result) {
|
|
25
|
+
super(`workflow agent "${label}" was asked for a structured result (schema) but completed with prose (no structuredOutput)`);
|
|
26
|
+
this.label = label;
|
|
27
|
+
this.result = result;
|
|
28
|
+
this.name = "WorkflowAgentSchemaError";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export class WorkflowAgentStalledError extends Error {
|
|
32
|
+
attempts;
|
|
33
|
+
stallMs;
|
|
34
|
+
lastResult;
|
|
35
|
+
code = "workflow.agent_stalled";
|
|
36
|
+
constructor(attempts, stallMs, lastResult) {
|
|
37
|
+
super(`agent stalled on all ${attempts} attempts (no progress for ${stallMs}ms each)`);
|
|
38
|
+
this.attempts = attempts;
|
|
39
|
+
this.stallMs = stallMs;
|
|
40
|
+
this.lastResult = lastResult;
|
|
41
|
+
this.name = "WorkflowAgentStalledError";
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export class WorkflowMaxAgentsError extends Error {
|
|
45
|
+
max;
|
|
46
|
+
code = "workflow.max_agents";
|
|
47
|
+
constructor(max) {
|
|
48
|
+
super(`Workflow agent() call cap reached (${max}). This usually means a loop using budget.remaining() never ` +
|
|
49
|
+
`terminates because no token budget was set — remaining() returns Infinity when budget.total is null. ` +
|
|
50
|
+
`Add a hard iteration cap to the loop, or pass a token budget.`);
|
|
51
|
+
this.max = max;
|
|
52
|
+
this.name = "WorkflowMaxAgentsError";
|
|
53
|
+
}
|
|
54
|
+
}
|