@wrongstack/core 0.155.0 → 0.236.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-bridge-BbZU5TPN.d.ts → agent-bridge-Cimv7bK7.d.ts} +1 -1
- package/dist/{agent-subagent-runner-Bsueu0J2.d.ts → agent-subagent-runner-C658wj_c.d.ts} +9 -8
- package/dist/{brain-CS_B0vIE.d.ts → brain-sCZ3lCjq.d.ts} +26 -2
- package/dist/{compactor-BueGt7LG.d.ts → compactor-BRfg3QPd.d.ts} +1 -1
- package/dist/{config-BaVThgnT.d.ts → config-Koq6f3fs.d.ts} +2 -2
- package/dist/{context-C7G_MtLV.d.ts → context-CLz3z_E8.d.ts} +126 -2
- package/dist/coordination/index.d.ts +70 -13
- package/dist/coordination/index.js +1983 -145
- package/dist/coordination/index.js.map +1 -1
- package/dist/defaults/index.d.ts +26 -26
- package/dist/defaults/index.js +1105 -289
- package/dist/defaults/index.js.map +1 -1
- package/dist/execution/index.d.ts +45 -16
- package/dist/execution/index.js +224 -53
- package/dist/execution/index.js.map +1 -1
- package/dist/execution/prompt-enhancer.d.ts +86 -0
- package/dist/execution/prompt-enhancer.js +125 -0
- package/dist/execution/prompt-enhancer.js.map +1 -0
- package/dist/extension/index.d.ts +6 -6
- package/dist/extension/index.js +3 -1
- package/dist/extension/index.js.map +1 -1
- package/dist/{goal-preamble-CbV8pXLD.d.ts → goal-preamble-CnbzyVvl.d.ts} +19 -10
- package/dist/{index-CI1hRfPt.d.ts → index-BlMqh5GO.d.ts} +8 -8
- package/dist/{index-B5wz-GXm.d.ts → index-C2eSNPsB.d.ts} +7 -5
- package/dist/index.d.ts +438 -128
- package/dist/index.js +4974 -836
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +7 -7
- package/dist/infrastructure/index.js +61 -13
- package/dist/infrastructure/index.js.map +1 -1
- package/dist/kernel/index.d.ts +9 -9
- package/dist/kernel/index.js +7 -1
- package/dist/kernel/index.js.map +1 -1
- package/dist/{llm-selector-CP72f1lC.d.ts → llm-selector-D22R4AFz.d.ts} +2 -2
- package/dist/logger-DmmQhf4P.d.ts +65 -0
- package/dist/{mcp-servers-CPERR2De.d.ts → mcp-servers-DFbirBv6.d.ts} +3 -3
- package/dist/models/index.d.ts +5 -5
- package/dist/models/index.js +89 -9
- package/dist/models/index.js.map +1 -1
- package/dist/{models-registry-D90K9UnM.d.ts → models-registry-CnJRjTXc.d.ts} +1 -1
- package/dist/{multi-agent-coordinator-BSKSFNhv.d.ts → multi-agent-coordinator-60weDZoA.d.ts} +8 -8
- package/dist/{null-fleet-bus-CGOez8Le.d.ts → null-fleet-bus-1068dEnr.d.ts} +7 -7
- package/dist/observability/index.d.ts +2 -2
- package/dist/package-outdated-watcher-pzJ5w7y8.d.ts +560 -0
- package/dist/{parallel-eternal-engine-CYoTKjsz.d.ts → parallel-eternal-engine-DtG1fjc9.d.ts} +13 -9
- package/dist/{path-resolver-DuhlmPil.d.ts → path-resolver-CA1ULU0J.d.ts} +3 -3
- package/dist/{permission-B7nKnEvQ.d.ts → permission-DbWPbuoA.d.ts} +1 -1
- package/dist/{permission-policy-8-6zBmfA.d.ts → permission-policy-AOk0LVsV.d.ts} +2 -2
- package/dist/pipeline-DsmlwTXu.d.ts +493 -0
- package/dist/{plan-templates-DbH7lg-t.d.ts → plan-templates-DPABrDvy.d.ts} +18 -7
- package/dist/{provider-runner-Cocq0O9E.d.ts → provider-runner-D0HgUqwV.d.ts} +3 -3
- package/dist/{retry-policy-rutAfVeR.d.ts → retry-policy-BVnkbMET.d.ts} +1 -1
- package/dist/sdd/index.d.ts +8 -8
- package/dist/sdd/index.js +215 -79
- package/dist/sdd/index.js.map +1 -1
- package/dist/{secret-vault-w8MbUe2Q.d.ts → secret-vault-CeVNiy_f.d.ts} +3 -2
- package/dist/security/index.d.ts +5 -4
- package/dist/security/index.js +155 -13
- package/dist/security/index.js.map +1 -1
- package/dist/{selector-4vDFZKt3.d.ts → selector-Cb4_9-hf.d.ts} +1 -1
- package/dist/{session-event-bridge-DWlvglC2.d.ts → session-event-bridge-BhtkkFFy.d.ts} +4 -2
- package/dist/{session-reader-BAtCxdaw.d.ts → session-reader-CCOssnBS.d.ts} +1 -1
- package/dist/skills/index.js +171 -21
- package/dist/skills/index.js.map +1 -1
- package/dist/storage/index.d.ts +150 -12
- package/dist/storage/index.js +1041 -214
- package/dist/storage/index.js.map +1 -1
- package/dist/types/index.d.ts +67 -20
- package/dist/types/index.js +557 -52
- package/dist/types/index.js.map +1 -1
- package/dist/utils/expect-defined.js +3 -1
- package/dist/utils/expect-defined.js.map +1 -1
- package/dist/utils/index.d.ts +16 -4
- package/dist/utils/index.js +40 -14
- package/dist/utils/index.js.map +1 -1
- package/dist/{wstack-paths-DD50Omgn.d.ts → wstack-paths-CJjEwPXn.d.ts} +14 -1
- package/package.json +7 -3
- package/skills/chimera/SKILL.md +105 -0
- package/skills/research-web/SKILL.md +342 -0
- package/dist/logger-B9J5puGM.d.ts +0 -32
- package/dist/pipeline-BG7UgbDc.d.ts +0 -239
package/dist/index.d.ts
CHANGED
|
@@ -1,72 +1,77 @@
|
|
|
1
|
-
import { S as SystemPromptBuilder,
|
|
2
|
-
export {
|
|
3
|
-
import { E as EventBus, l as MemoryStore,
|
|
4
|
-
export {
|
|
5
|
-
import { W as WorktreeManager } from './index-
|
|
6
|
-
export { A as AllocateOpts, M as MergeOpts, a as MergeResult, R as RunController, b as RunControllerOptions, T as TOKENS, c as WorktreeHandle, d as WorktreeManagerOptions, e as WorktreeRunResult, f as WorktreeStatus, g as assertSafePath } from './index-
|
|
7
|
-
import { C as Context, P as Provider, T as Tool, R as Request, b as Response,
|
|
8
|
-
export { A as AgentError, k as Capabilities, u as ConfigError, v as ContextInit, t as ConversationState, E as ERROR_CODES, w as ErrorCode, x as ErrorSeverity, y as ErrorSubsystem, F as FileSnapshot, z as FsError, I as ImageBlock, J as JSONSchema, B as MessageRole, f as Permission, D as PluginError, e as ProviderError, G as ProviderErrorBody, H as ReadonlyConversationState, p as ResumedSession, K as RiskTier, L as RunEnv, o as RunOptions, q as SessionData,
|
|
9
|
-
import { P as ProviderRunner, R as RunProviderOptions$1 } from './provider-runner-
|
|
10
|
-
import { c as MCPServerConfig, h as Config, l as HookInput, m as HookOutcome, H as HookEvent, e as HookMatcher, I as InProcessHook, d as ModelMatrixEntry, i as ConfigStore } from './config-
|
|
11
|
-
export { A as AutonomyConfig, n as CONTEXT_WINDOW_MODES, j as ConfigLoader, o as ContextConfig, C as ContextWindowAggressiveOn, p as ContextWindowConfigLike, q as ContextWindowMode, r as ContextWindowModeId, g as ContextWindowPolicy, s as ContextWindowThresholds, t as CustomModelDefinition, D as DEFAULT_CONTEXT_WINDOW_MODE_ID, F as FeaturesConfig, f as HookEntry, u as IndexingConfig, L as LaunchConfig, v as LogConfig, a as ModelsDevPayload,
|
|
12
|
-
export { a as CompactReport, C as Compactor } from './compactor-
|
|
13
|
-
|
|
1
|
+
import { S as SystemPromptBuilder, m as ModelCapabilities, B as BuildContext, C as Container, H as HookRegistry, b as Mailbox, d as MailboxMessage, a as Renderer } from './pipeline-DsmlwTXu.js';
|
|
2
|
+
export { h as AgentHeartbeatInput, A as AgentRegistrationInput, o as BindOptions, D as Decorator, F as Factory, f as MailboxAckInput, g as MailboxAgentStatus, i as MailboxMessageType, e as MailboxQuery, c as MailboxSendInput, j as MailboxTaskContext, p as Middleware, M as MiddlewareHandler, N as NextFn, P as Pipeline, q as PipelineOptions, k as ReadReceipts, l as RegisteredAgent, T as Token, r as hookMatcherMatches, n as normalizeRecipient } from './pipeline-DsmlwTXu.js';
|
|
3
|
+
import { E as EventBus, l as MemoryStore, a as EventName, L as Listener, B as BrainArbiter } from './brain-sCZ3lCjq.js';
|
|
4
|
+
export { b as BrainDecision, c as BrainDecisionOption, d as BrainDecisionQueue, e as BrainDecisionRequest, f as BrainDecisionSource, g as BrainFallback, h as BrainRisk, D as DefaultBrainArbiter, i as DefaultBrainArbiterOptions, n as EventLogger, o as EventMap, H as HumanEscalatingBrainArbiter, p as MEMORY_TYPE_LABELS, q as MemoryClearedPayload, r as MemoryConsolidatedPayload, k as MemoryEntry, s as MemoryForgottenPayload, t as MemoryPriority, m as MemoryRelevanceContext, u as MemoryRememberedPayload, M as MemoryScope, v as MemoryType, O as ObservableBrainArbiter, w as ScopedEventBus, S as ScoredEntry, j as formatHumanPrompt } from './brain-sCZ3lCjq.js';
|
|
5
|
+
import { W as WorktreeManager } from './index-BlMqh5GO.js';
|
|
6
|
+
export { A as AllocateOpts, M as MergeOpts, a as MergeResult, R as RunController, b as RunControllerOptions, T as TOKENS, c as WorktreeHandle, d as WorktreeManagerOptions, e as WorktreeRunResult, f as WorktreeStatus, g as assertSafePath } from './index-BlMqh5GO.js';
|
|
7
|
+
import { C as Context, P as Provider, T as Tool, R as Request, b as Response, M as Message, g as ContentBlock, n as TextBlock } from './context-CLz3z_E8.js';
|
|
8
|
+
export { A as AgentError, k as Capabilities, u as ConfigError, v as ContextInit, t as ConversationState, E as ERROR_CODES, w as ErrorCode, x as ErrorSeverity, y as ErrorSubsystem, F as FileSnapshot, z as FsError, I as ImageBlock, J as JSONSchema, B as MessageRole, f as Permission, D as PluginError, e as ProviderError, G as ProviderErrorBody, H as ReadonlyConversationState, p as ResumedSession, K as RiskTier, L as RunEnv, o as RunOptions, N as SddError, q as SessionData, O as SessionError, S as SessionEvent, h as SessionMetadata, i as SessionStore, r as SessionSummary, a as SessionWriter, Q as StateChange, V as StateChangeHandler, W as StopReason, X as StreamEvent, Y as StreamHangError, Z as ThinkingBlock, s as TodoItem, c as TokenCounter, _ as ToolCallContext, $ as ToolError, a0 as ToolFinalEvent, j as ToolProgressEvent, m as ToolResultBlock, a1 as ToolStreamEvent, l as ToolUseBlock, U as Usage, a2 as WrongStackError, a3 as asBlocks, a4 as asText, a5 as extractRunEnv, a6 as isAgentError, a7 as isConfigError, a8 as isFsError, a9 as isImageBlock, aa as isPluginError, ab as isSddError, ac as isSessionError, ad as isTextBlock, ae as isThinkingBlock, af as isToolError, ag as isToolResultBlock, ah as isToolUseBlock, ai as isWrongStackError, aj as toWrongStackError, ak as wrapAsState } from './context-CLz3z_E8.js';
|
|
9
|
+
import { P as ProviderRunner, R as RunProviderOptions$1 } from './provider-runner-D0HgUqwV.js';
|
|
10
|
+
import { c as MCPServerConfig, h as Config, l as HookInput, m as HookOutcome, H as HookEvent, e as HookMatcher, I as InProcessHook, d as ModelMatrixEntry, i as ConfigStore } from './config-Koq6f3fs.js';
|
|
11
|
+
export { A as AutonomyConfig, n as CONTEXT_WINDOW_MODES, j as ConfigLoader, o as ContextConfig, C as ContextWindowAggressiveOn, p as ContextWindowConfigLike, q as ContextWindowMode, r as ContextWindowModeId, g as ContextWindowPolicy, s as ContextWindowThresholds, t as CustomModelDefinition, D as DEFAULT_CONTEXT_WINDOW_MODE_ID, F as FeaturesConfig, f as HookEntry, u as IndexingConfig, L as LaunchConfig, v as LogConfig, w as ModelsDevModel, a as ModelsDevPayload, x as ModelsDevProvider, M as ModelsRegistry, y as PluginConfig, z as ProviderApiKey, P as ProviderConfig, b as ResolvedModel, R as ResolvedProvider, B as SessionLoggingConfig, S as ShellHook, E as SyncCategory, k as SyncConfig, T as ToolsConfig, W as WireFamily, G as formatContextWindowModeList, J as getContextWindowMode, K as isContextWindowModeId, N as listContextWindowModes, O as resolveContextWindowPolicy } from './config-Koq6f3fs.js';
|
|
12
|
+
export { a as CompactReport, C as Compactor } from './compactor-BRfg3QPd.js';
|
|
13
|
+
import { P as PermissionPolicy } from './permission-DbWPbuoA.js';
|
|
14
|
+
export { a as PermissionDecision, S as SecretScrubber, T as TrustPolicy } from './permission-DbWPbuoA.js';
|
|
14
15
|
export { C as CheckpointInfo, R as RewindResult, a as RewindResultExtended, S as SessionRewinder } from './session-rewinder-C9HnMkhP.js';
|
|
15
|
-
import { A as AttachmentStore, b as AttachmentRef, a as AddAttachmentInput } from './session-reader-
|
|
16
|
-
export { c as Attachment, d as AttachmentKind, e as AttachmentMeta, D as DefaultSessionReader, f as DefaultSessionReaderOptions, S as SessionReader } from './session-reader-
|
|
16
|
+
import { A as AttachmentStore, b as AttachmentRef, a as AddAttachmentInput } from './session-reader-CCOssnBS.js';
|
|
17
|
+
export { c as Attachment, d as AttachmentKind, e as AttachmentMeta, D as DefaultSessionReader, f as DefaultSessionReaderOptions, S as SessionReader } from './session-reader-CCOssnBS.js';
|
|
17
18
|
export { D as DEFAULT_AUTONOMY_CONFIG, a as DEFAULT_CONTEXT_CONFIG, b as DEFAULT_SESSION_LOGGING_CONFIG, c as DEFAULT_SESSION_PRUNE_DAYS, d as DEFAULT_TOOLS_CONFIG } from './default-config-CXsDvOmP.js';
|
|
18
|
-
import { a as DefaultSecretVault } from './secret-vault-
|
|
19
|
-
export { D as DefaultSecretScrubber, S as SecretVaultOptions, d as decryptConfigSecrets, e as encryptConfigSecrets, i as isSecretField, m as migratePlaintextSecrets, r as rewriteConfigEncrypted } from './secret-vault-
|
|
20
|
-
import { D as DefaultLogger } from './logger-
|
|
21
|
-
export { a as DefaultLoggerOptions } from './logger-
|
|
22
|
-
import { D as DefaultPathResolver } from './path-resolver-
|
|
23
|
-
export { a as DefaultTokenCounter } from './path-resolver-
|
|
24
|
-
export { C as CompactorOptions,
|
|
19
|
+
import { a as DefaultSecretVault } from './secret-vault-CeVNiy_f.js';
|
|
20
|
+
export { D as DefaultSecretScrubber, S as SecretVaultOptions, d as decryptConfigSecrets, e as encryptConfigSecrets, i as isSecretField, m as migratePlaintextSecrets, r as rewriteConfigEncrypted } from './secret-vault-CeVNiy_f.js';
|
|
21
|
+
import { D as DefaultLogger } from './logger-DmmQhf4P.js';
|
|
22
|
+
export { a as DefaultLoggerOptions, L as LogFormat, n as noOpLogger } from './logger-DmmQhf4P.js';
|
|
23
|
+
import { D as DefaultPathResolver } from './path-resolver-CA1ULU0J.js';
|
|
24
|
+
export { a as DefaultTokenCounter } from './path-resolver-CA1ULU0J.js';
|
|
25
|
+
export { C as CompactorOptions, D as DEFAULT_RECOVERY_STRATEGIES, a as DefaultErrorHandler, b as DefaultRetryPolicy, E as EternalAutonomyEngine, c as EternalAutonomyOptions, d as EternalEngineState, H as HybridCompactor, I as IterationStage, P as ParallelEngineState, e as ParallelEternalEngine, f as ParallelEternalOptions, g as ParallelIterationStage, R as RecoveryStrategy, T as ToolExecutor, h as buildRecoveryStrategies } from './parallel-eternal-engine-DtG1fjc9.js';
|
|
25
26
|
import { S as SkillLoader } from './skill-Bj6Ezqb8.js';
|
|
26
27
|
export { b as SkillEntry, a as SkillManifest } from './skill-Bj6Ezqb8.js';
|
|
27
28
|
export { I as InputReader, P as PromptOption } from './input-reader-E-ffP2ee.js';
|
|
28
|
-
import { z as SlashCommand, P as PluginAPI, E as PluginPipelines, G as ToolRegistryView, H as ProviderRegistryView, I as MCPRegistryView, J as SlashCommandRegistryView, K as SessionWriterView, L as MetricsSinkView, N as Plugin } from './agent-subagent-runner-
|
|
29
|
-
export { g as Agent, h as AgentFactory, i as AgentFactoryResult, j as AgentRunnerOptions, k as BudgetExceededError, l as BudgetKind, m as BudgetLimits, r as BudgetUsage, O as CoordinatorEvents, C as CoordinatorStatus, D as DoneCondition, F as FleetBus, s as FleetEvent, t as FleetHandler, u as FleetUsage, v as FleetUsageAggregator, c as MultiAgentConfig, M as MultiAgentCoordinator, Q as PluginCapabilities, R as PluginDependency, e as SpawnResult, w as SubagentBudget, S as SubagentConfig, U as SubagentContext, V as SubagentError, W as SubagentErrorKind, X as SubagentRunContext, Y as SubagentRunOutcome, d as SubagentRunner, x as SubagentUsageSnapshot, Z as TaskDelegation, f as TaskResult, T as TaskSpec, y as makeAgentSubagentRunner } from './agent-subagent-runner-
|
|
30
|
-
export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from './models-registry-
|
|
29
|
+
import { z as SlashCommand, P as PluginAPI, E as PluginPipelines, G as ToolRegistryView, H as ProviderRegistryView, I as MCPRegistryView, J as SlashCommandRegistryView, K as SessionWriterView, L as MetricsSinkView, N as Plugin } from './agent-subagent-runner-C658wj_c.js';
|
|
30
|
+
export { g as Agent, h as AgentFactory, i as AgentFactoryResult, j as AgentRunnerOptions, k as BudgetExceededError, l as BudgetKind, m as BudgetLimits, r as BudgetUsage, O as CoordinatorEvents, C as CoordinatorStatus, D as DoneCondition, F as FleetBus, s as FleetEvent, t as FleetHandler, u as FleetUsage, v as FleetUsageAggregator, c as MultiAgentConfig, M as MultiAgentCoordinator, Q as PluginCapabilities, R as PluginDependency, e as SpawnResult, w as SubagentBudget, S as SubagentConfig, U as SubagentContext, V as SubagentError, W as SubagentErrorKind, X as SubagentRunContext, Y as SubagentRunOutcome, d as SubagentRunner, x as SubagentUsageSnapshot, Z as TaskDelegation, f as TaskResult, T as TaskSpec, y as makeAgentSubagentRunner } from './agent-subagent-runner-C658wj_c.js';
|
|
31
|
+
export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from './models-registry-CnJRjTXc.js';
|
|
31
32
|
import { M as ModeStore } from './mode-CZlO9iU1.js';
|
|
32
33
|
export { D as DEFAULT_MODES, b as Mode, a as ModeConfig, c as ModeManifest } from './mode-CZlO9iU1.js';
|
|
33
|
-
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from './agent-bridge-
|
|
34
|
+
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from './agent-bridge-Cimv7bK7.js';
|
|
34
35
|
export { D as DEFAULT_SPEC_TEMPLATE, S as SpecAnalysis, a as SpecApiEndpoint, b as SpecRequirement, c as SpecSection, d as SpecSectionType, e as SpecStatus, f as SpecTemplate, g as SpecValidationResult, h as Specification } from './spec-TBi3Jr6T.js';
|
|
35
36
|
import { d as TaskGraph, T as TaskType, a as TaskPriority, e as TaskNode } from './task-graph-u1q9Jkyk.js';
|
|
36
37
|
export { C as CriticalPathResult, f as TaskAssignment, g as TaskDependency, h as TaskEdge, i as TaskFilter, c as TaskProgress, j as TaskSort, b as TaskStatus, k as computeTaskProgress, l as findCriticalPath, t as topologicalSort } from './task-graph-u1q9Jkyk.js';
|
|
37
38
|
import { T as Tracer, M as MetricsSink, H as HealthRegistry } from './observability-D-HZN_mF.js';
|
|
38
39
|
export { A as AggregateHealth, a as HealthCheck, b as HealthCheckResult, c as HealthStatus, d as MetricLabels, e as MetricSeries, f as MetricsSnapshot, S as Span } from './observability-D-HZN_mF.js';
|
|
39
|
-
import { S as SystemPromptContributor, E as ExtensionRegistry, e as ToolRegistry, P as ProviderRegistry, c as ToolCallPipelinePayload } from './index-
|
|
40
|
-
export { i as AfterIterationHook, j as AfterRunHook, k as AfterToolExecutionHook, l as AgentExtension, g as AgentInit, h as AgentInput,
|
|
41
|
-
export { AutonomyStage } from './types/index.js';
|
|
42
|
-
|
|
40
|
+
import { S as SystemPromptContributor, E as ExtensionRegistry, e as ToolRegistry, P as ProviderRegistry, A as AgentPipelines, f as ToolExecutorLike, c as ToolCallPipelinePayload } from './index-C2eSNPsB.js';
|
|
41
|
+
export { i as AfterIterationHook, j as AfterRunHook, k as AfterToolExecutionHook, l as AgentExtension, g as AgentInit, h as AgentInput, B as BeforeIterationHook, m as BeforeRunHook, n as BeforeToolExecutionHook, D as DEFAULT_MAX_ITERATIONS, H as HookRunEnv, o as HookRunner, p as HookRunnerOptions, O as OnErrorHook, q as PreToolUseResult, r as PromptResult, s as ProviderFactory, t as ProviderRunnerWrapper, R as RunResult, d as ToolWrapper, U as UserInputPayload, u as createDefaultPipelines } from './index-C2eSNPsB.js';
|
|
42
|
+
export { AutonomyStage, DistributiveOmit, DistributivePick } from './types/index.js';
|
|
43
|
+
import { estimateMessageTokens } from './utils/index.js';
|
|
44
|
+
export { AtomicWriteOptions, BuildChildEnvOptions, CompileFail, CompileResult, DeepMergeOptions, FORBIDDEN_PROTO_KEYS, FileLockOptions, MessageRepairReport, MessageRepairResult, NewlineStyle, OutputLineGuard, RequestTokenBreakdown, SafeParseResult, ToolOutputSerializerOptions, UnifiedDiffOptions, ValidationError, ValidationResult, assertNever, atomicWrite, buildChildEnv, color, compileGlob, compileUserRegex, completePartialObject, computeMessageTokens, createToolOutputSerializer, deepMerge, detectNewlineStyle, ensureDir, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob, formatTodosList, getCalibrationState, getTermSize, isInteractive, isPrimitiveArray, isStdinTTY, isStdoutTTY, matchAny, matchGlob, mergeCustomModelDefs, mergeModelsPayload, normalizeToLf, onResize, recordActualUsage, repairToolUseAdjacency, resetCalibration, safeParse, safeStringify, sanitizeJsonString, setOutputLineGuard, setRawMode, sleep, stripAnsi, toStyle, unifiedDiff, validateAgainstSchema, withFileLock, writeErr, writeOut } from './utils/index.js';
|
|
43
45
|
export { T as TaskItem, c as computeTaskItemProgress, f as formatTaskList, a as formatTaskProgress } from './task-format-vGOIftmK.js';
|
|
44
|
-
import { W as WstackPaths } from './wstack-paths-
|
|
45
|
-
export { a as WstackPathOptions, p as projectHash, b as projectSlug, r as resolveWstackPaths } from './wstack-paths-
|
|
46
|
+
import { W as WstackPaths } from './wstack-paths-CJjEwPXn.js';
|
|
47
|
+
export { a as WstackPathOptions, p as projectHash, b as projectSlug, r as resolveWstackPaths, w as wstackGlobalRoot } from './wstack-paths-CJjEwPXn.js';
|
|
46
48
|
export { expectDefined } from './utils/expect-defined.js';
|
|
47
|
-
export { A as AbandonedSession, a as AttachmentStoreOptions, C as ConfigLoaderOptions, b as ConfigMigration, c as ConfigMigrationError, d as ConfigSource, D as DEFAULT_CONFIG_MIGRATIONS, e as DefaultAttachmentStore, f as DefaultConfigLoader, g as DefaultConfigStore, h as DefaultMemoryStore, i as DefaultSessionStore, F as FileMemoryBackend, j as FileMemoryBackendOptions, M as MemoryBackend, k as MemoryStoreOptions, l as MigrationContext, m as MigrationResult, P as PersistedQueueItem, n as PlanFile, o as PlanItem, p as PlanTemplate, Q as QueueStore, R as RecoveryLock, q as RecoveryLockOptions, S as SessionAnalyzer, r as SessionStoreOptions, T as TodosCheckpointFile, s as addPlanItem, t as attachPlanCheckpoint, u as attachTodosCheckpoint, v as clearPlan, w as deriveTodosFromPlanItem, x as emptyPlan, y as formatPlan, z as formatPlanTemplates, B as getPlanTemplate, E as listPlanTemplates, G as loadPlan, H as loadTodosCheckpoint, I as
|
|
48
|
-
export { A as AuditLevel, C as CORE_RECONSTRUCT_EVENTS, a as STANDARD_AUDIT_EVENTS, S as SessionEventBridge, b as SessionEventBridgeOptions, c as SessionSamplingOptions, T as ToolProgressSamplingOptions, d as createSessionEventBridge, r as resolveAuditLevel, e as resolveSessionLoggingConfig } from './session-event-bridge-
|
|
49
|
+
export { A as AbandonedSession, a as AttachmentStoreOptions, C as ConfigLoaderOptions, b as ConfigMigration, c as ConfigMigrationError, d as ConfigSource, D as DEFAULT_CONFIG_MIGRATIONS, e as DefaultAttachmentStore, f as DefaultConfigLoader, g as DefaultConfigStore, h as DefaultMemoryStore, i as DefaultSessionStore, F as FileMemoryBackend, j as FileMemoryBackendOptions, M as MemoryBackend, k as MemoryStoreOptions, l as MigrationContext, m as MigrationResult, P as PersistedQueueItem, n as PlanFile, o as PlanItem, p as PlanTemplate, Q as QueueStore, R as RecoveryLock, q as RecoveryLockOptions, S as SessionAnalyzer, r as SessionStoreOptions, T as TodosCheckpointFile, s as addPlanItem, t as attachPlanCheckpoint, u as attachTodosCheckpoint, v as clearPlan, w as deriveTodosFromPlanItem, x as emptyPlan, y as formatPlan, z as formatPlanTemplates, B as getPlanTemplate, E as listPlanTemplates, G as loadPlan, H as loadTodosCheckpoint, I as mutatePlan, J as parseEntries, K as removePlanItem, L as runConfigMigrations, N as savePlan, O as saveTodosCheckpoint, U as setPlanItemStatus } from './plan-templates-DPABrDvy.js';
|
|
50
|
+
export { A as AuditLevel, C as CORE_RECONSTRUCT_EVENTS, a as STANDARD_AUDIT_EVENTS, S as SessionEventBridge, b as SessionEventBridgeOptions, c as SessionSamplingOptions, T as ToolProgressSamplingOptions, d as createSessionEventBridge, r as resolveAuditLevel, e as resolveSessionLoggingConfig } from './session-event-bridge-BhtkkFFy.js';
|
|
49
51
|
export { a as DirectorStateCheckpoint, D as DirectorStateSnapshot, b as DirectorSubagentState, c as DirectorTaskState, l as loadDirectorState } from './director-state-BfeCUbmk.js';
|
|
50
|
-
export { A as AutoApprovePermissionPolicy, D as DefaultPermissionPolicy, P as PermissionPolicyOptions } from './permission-policy-
|
|
51
|
-
export { A as AutoCompactionMiddleware, a as AutonomousRunner, b as AutonomousRunnerOptions, c as AutonomyPromptContributorOptions, C as CompactorStrategy, D as DefaultSkillLoader, d as DoneCheckResult, e as DoneConditionChecker, I as IntelligentCompactor, f as IntelligentCompactorOptions, S as SelectiveCompactor, g as SelectiveCompactorOptions, h as SkillLoaderOptions, i as StrategyCompactorOptions, j as buildGoalPreamble, k as createStrategyCompactor, m as makeAutonomyPromptContributor } from './goal-preamble-
|
|
52
|
+
export { A as AutoApprovePermissionPolicy, D as DefaultPermissionPolicy, P as PermissionPolicyOptions } from './permission-policy-AOk0LVsV.js';
|
|
53
|
+
export { A as AutoCompactionMiddleware, a as AutonomousRunner, b as AutonomousRunnerOptions, c as AutonomyPromptContributorOptions, C as CompactorStrategy, D as DefaultSkillLoader, d as DoneCheckResult, e as DoneConditionChecker, I as IntelligentCompactor, f as IntelligentCompactorOptions, S as SelectiveCompactor, g as SelectiveCompactorOptions, h as SkillLoaderOptions, i as StrategyCompactorOptions, j as buildGoalPreamble, k as createStrategyCompactor, m as makeAutonomyPromptContributor } from './goal-preamble-CnbzyVvl.js';
|
|
52
54
|
export { DefaultProviderRunner } from './defaults/index.js';
|
|
53
|
-
export { A as ACP_AGENTS, a as AGENTS_BY_PHASE, b as AGENT_CATALOG, c as ALL_AGENT_DEFINITIONS, d as ALL_FLEET_AGENTS, e as AUDIT_LOG_AGENT, f as AutoExtendCeiling, g as AutoExtendPolicy, B as BUG_HUNTER_AGENT, n as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, q as DEFAULT_SUBAGENT_BASELINE, r as DelegateHost, s as Director, w as DirectorPromptParts, x as DirectorSessionFactory, y as DirectorSessionFactoryOptions, F as FLEET_ROSTER, z as FLEET_ROSTER_BUDGETS, E as FLEET_ROSTER_WITHACP, G as FleetCostCapError, H as FleetManager, I as FleetManagerOptions, J as FleetRosterBudget, K as FleetSpawnBudgetError, L as ICoordinator, M as IFleetManager, O as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, S as SECURITY_SCANNER_AGENT, V as SubagentPromptParts, W as applyRosterBudget, X as attachAutoExtend, Y as composeDirectorPrompt, Z as composeSubagentPrompt, _ as createDelegateTool, $ as getAgentDefinition, a1 as makeAskTool, a2 as makeAssignTool, a3 as makeAwaitTasksTool, a4 as makeCollabDebugTool, a5 as makeDirectorSessionFactory, a6 as makeFleetEmitTool, a7 as makeFleetHealthTool, a8 as makeFleetSessionTool, a9 as makeFleetStatusTool, aa as makeFleetUsageTool, ab as makeRollUpTool, ac as makeSpawnTool, ad as makeTerminateTool, af as rosterSummaryFromConfigs } from './null-fleet-bus-
|
|
54
|
-
export { b as AgentBudgetTier, c as AgentCapability, A as AgentDefinition, d as AgentPhase, e as DEFAULT_DISPATCH_ROLE, a as DefaultMultiAgentCoordinator, f as DispatchCandidate, D as DispatchClassifier, g as DispatchMethod, h as DispatchOptions, i as DispatchResult, j as MultiAgentCoordinatorOptions, k as dispatchAgent, m as makeLLMClassifier, s as scoreAgents } from './multi-agent-coordinator-
|
|
55
|
-
export { D as DefaultModeStore, L as LLMSelector, a as LLMSelectorOptions, M as ModeLoaderOptions, l as loadProjectModes, b as loadUserModes } from './llm-selector-
|
|
55
|
+
export { A as ACP_AGENTS, a as AGENTS_BY_PHASE, b as AGENT_CATALOG, c as ALL_AGENT_DEFINITIONS, d as ALL_FLEET_AGENTS, e as AUDIT_LOG_AGENT, f as AutoExtendCeiling, g as AutoExtendPolicy, B as BUG_HUNTER_AGENT, n as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, q as DEFAULT_SUBAGENT_BASELINE, r as DelegateHost, s as Director, w as DirectorPromptParts, x as DirectorSessionFactory, y as DirectorSessionFactoryOptions, F as FLEET_ROSTER, z as FLEET_ROSTER_BUDGETS, E as FLEET_ROSTER_WITHACP, G as FleetCostCapError, H as FleetManager, I as FleetManagerOptions, J as FleetRosterBudget, K as FleetSpawnBudgetError, L as ICoordinator, M as IFleetManager, O as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, S as SECURITY_SCANNER_AGENT, V as SubagentPromptParts, W as applyRosterBudget, X as attachAutoExtend, Y as composeDirectorPrompt, Z as composeSubagentPrompt, _ as createDelegateTool, $ as getAgentDefinition, a1 as makeAskTool, a2 as makeAssignTool, a3 as makeAwaitTasksTool, a4 as makeCollabDebugTool, a5 as makeDirectorSessionFactory, a6 as makeFleetEmitTool, a7 as makeFleetHealthTool, a8 as makeFleetSessionTool, a9 as makeFleetStatusTool, aa as makeFleetUsageTool, ab as makeRollUpTool, ac as makeSpawnTool, ad as makeTerminateTool, af as rosterSummaryFromConfigs } from './null-fleet-bus-1068dEnr.js';
|
|
56
|
+
export { b as AgentBudgetTier, c as AgentCapability, A as AgentDefinition, d as AgentPhase, e as DEFAULT_DISPATCH_ROLE, a as DefaultMultiAgentCoordinator, f as DispatchCandidate, D as DispatchClassifier, g as DispatchMethod, h as DispatchOptions, i as DispatchResult, j as MultiAgentCoordinatorOptions, k as dispatchAgent, m as makeLLMClassifier, s as scoreAgents } from './multi-agent-coordinator-60weDZoA.js';
|
|
57
|
+
export { D as DefaultModeStore, L as LLMSelector, a as LLMSelectorOptions, M as ModeLoaderOptions, l as loadProjectModes, b as loadUserModes } from './llm-selector-D22R4AFz.js';
|
|
56
58
|
import { TaskStore } from './sdd/index.js';
|
|
57
59
|
export { AISpecBuilder, AISpecBuilderOptions, AISpecPhase, AISpecSession, AutoExecutor, AutoExecutorOptions, BottleneckTask, CollectedAnswer, CriticalPathAnalysis, DefaultTaskStore, ExecutionSummary, GeneratedTask, SPEC_TEMPLATES, SddParallelRun, SddParallelRunOptions, SddProgress, SddTaskDecomposer, SddTaskDecomposerOptions, SpecDiff, SpecDrivenDev, SpecDrivenDevOptions, SpecIndexEntry, SpecParser, SpecStore, SpecStoreOptions, SpecVersion, SpecVersioning, TaskBatch, TaskExecutionContext, TaskExecutionResult, TaskFlow, TaskFlowEventMap, TaskFlowEventName, TaskFlowExecutionContext, TaskFlowOptions, TaskFlowPhase, TaskGenerator, TaskGeneratorOptions, TaskGraphIndexEntry, TaskGraphStore, TaskGraphStoreOptions, TaskTracker, TaskTrackerOptions, TaskTransition, WaveResult, analyzeCriticalPath, createAutoExecutor, getTemplate, listTemplates, renderProgress, renderSpecAnalysis, renderTaskGraph, renderTaskList, templateToMarkdown } from './sdd/index.js';
|
|
58
60
|
export { DefaultHealthRegistry, InMemoryMetricsSink, MetricsServerHandle, MetricsServerOptions, NoopMetricsSink, NoopTracer, OTelTracer, OtlpMetricsExporterHandle, OtlpMetricsExporterOptions, OtlpTraceExporterHandle, OtlpTraceExporterOptions, PROMETHEUS_CONTENT_TYPE, buildOtlpMetricsRequest, buildOtlpTracesRequest, renderPrometheus, startMetricsServer, startOtlpMetricsExporter, startOtlpTraceExporter, wireMetricsToEvents } from './observability/index.js';
|
|
59
|
-
export { C as ContextManagerAction, a as ContextManagerInput, b as ContextManagerResult, c as ContextManagerToolOptions, d as allServers, e as awsServer, f as blockServer, g as braveSearchServer, h as context7Server, i as contextManagerTool, j as createContextManagerTool, k as everArtServer, l as filesystemServer, m as githubServer, n as googleMapsServer, o as miniMaxVisionServer, s as sentinelServer, q as slackServer, z as zaiVisionServer } from './mcp-servers-
|
|
61
|
+
export { C as ContextManagerAction, a as ContextManagerInput, b as ContextManagerResult, c as ContextManagerToolOptions, d as allServers, e as awsServer, f as blockServer, g as braveSearchServer, h as context7Server, i as contextManagerTool, j as createContextManagerTool, k as everArtServer, l as filesystemServer, m as githubServer, n as googleMapsServer, o as miniMaxVisionServer, s as sentinelServer, q as slackServer, z as zaiVisionServer } from './mcp-servers-DFbirBv6.js';
|
|
60
62
|
export { DownloadResult, InstallResult, InstalledSkillEntry, ManifestData, ParsedRef, SkillInstaller, SkillInstallerOptions, SkillManifestStore, UpdateResult, downloadGitHubTarball, parseSkillRef } from './skills/index.js';
|
|
61
63
|
import { ReplayLogStore, DefaultPromptStore } from './storage/index.js';
|
|
62
|
-
export { ALL_SYNC_CATEGORIES, Annotation, AnnotationsStore, AnnotationsStoreOptions, AuditEntry, CloudSync, ConsolidationOp, DefaultSessionRewinder, GraphMemoryBackend, GraphMemoryBackendOptions, MemoryConsolidatorOptions, PromptEntry, PromptStore, RecoveryPlan, ReplayEntry, ReplayLogStoreOptions, SessionMemoryConsolidator, SessionRecovery, SessionRewinderOptions, StaleSession, SyncResult, TaskFile, ToolAuditLog, ToolAuditLogOptions, VerifyResult, emptyTaskFile, loadTasks, saveTasks } from './storage/index.js';
|
|
64
|
+
export { ALL_SYNC_CATEGORIES, AgentEntry, AgentLiveStatus, AgentStatusTracker, AgentStatusTrackerOptions, Annotation, AnnotationsStore, AnnotationsStoreOptions, AuditEntry, CloudSync, ConsolidationOp, DefaultSessionRewinder, GraphMemoryBackend, GraphMemoryBackendOptions, MemoryConsolidatorOptions, PromptEntry, PromptStore, RecoveryPlan, ReplayEntry, ReplayLogStoreOptions, SessionLiveStatus, SessionMemoryConsolidator, SessionRecovery, SessionRegistry, SessionRegistryEntry, SessionRewinderOptions, StaleSession, SyncResult, TaskFile, ToolAuditLog, ToolAuditLogOptions, VerifyResult, emptyTaskFile, getSessionRegistry, hasSessionRegistry, loadTasks, mutateTasks, saveTasks } from './storage/index.js';
|
|
63
65
|
export { G as GoalFile, J as JournalEntry, M as MAX_JOURNAL_ENTRIES, a as MAX_PROGRESS_HISTORY, P as ProgressSnapshot, b as appendJournal, e as emptyGoal, f as formatGoal, g as goalFilePath, l as loadGoal, p as parseProgressFromText, r as recordProgress, s as saveGoal, c as setProgress, d as summarizeUsage } from './goal-store-CV9Yz2X_.js';
|
|
64
|
-
import { R as RetryPolicy, E as ErrorHandler } from './retry-policy-
|
|
66
|
+
import { R as RetryPolicy, E as ErrorHandler } from './retry-policy-BVnkbMET.js';
|
|
65
67
|
import { L as Logger } from './logger-B63L5bTg.js';
|
|
66
68
|
export { a as LogLevel } from './logger-B63L5bTg.js';
|
|
67
69
|
export { S as SecretVault, n as noOpVault } from './secret-vault-BJDY28ev.js';
|
|
70
|
+
export { ConversationTurn, ENHANCER_SYSTEM_PROMPT, EnhanceResult, EnhanceUserPromptOptions, enhanceUserPrompt, normalizedEqual, recentTextTurns, shouldEnhance } from './execution/prompt-enhancer.js';
|
|
71
|
+
export { B as BrainInterventionInput, a as BrainMonitor, b as BrainMonitorOptions, D as DEPENDENCY_FILE_PATTERNS, c as DefaultMailbox, d as DepWatchEntry, e as DepWatcherBridgeOptions, f as DependencyWatcherConfig, G as GlobalMailbox, M as MailToolsOptions, g as MailboxResolver, h as MailboxToolOptions, O as OutdatedNotifyMessage, P as PackageAuthorEntry, i as PackageAuthorLog, j as PackageAuthorTrackerOptions, k as PackageOutdatedEntry, l as PackageOutdatedResult, m as PackageOutdatedWatcherOptions, n as attachDepWatcherBridge, o as detectPackageEcosystem, p as getFullPackageLog, q as getManifestPackages, r as getPackageAuthor, s as getPackagesByAgent, t as mailboxSessionTag, u as makeDependencyWatcherConfig, v as makeMailInboxTool, w as makeMailSendTool, x as makeMailboxTool, y as recordPackageAction, z as resolveMailboxIdentity, A as resolveProjectDir, C as startPackageOutdatedWatcher, E as updatePackageOutdatedStatus } from './package-outdated-watcher-pzJ5w7y8.js';
|
|
72
|
+
export { AutonomyBrainOptions, BrainAutoRisk, TieredBrainArbiterOptions, createAutonomyBrain, createTieredBrainArbiter, formatDecisionSummary } from './execution/index.js';
|
|
68
73
|
import './path-resolver-CPRj4bFY.js';
|
|
69
|
-
import './selector-
|
|
74
|
+
import './selector-Cb4_9-hf.js';
|
|
70
75
|
import 'node:events';
|
|
71
76
|
|
|
72
77
|
/**
|
|
@@ -437,6 +442,89 @@ interface ShellHookSpec {
|
|
|
437
442
|
*/
|
|
438
443
|
declare function runShellHook(spec: ShellHookSpec, input: HookInput, logger?: Logger | undefined): Promise<HookOutcome | null>;
|
|
439
444
|
|
|
445
|
+
/**
|
|
446
|
+
* Token estimate for a message array (text + tool I/O). Re-exported from the
|
|
447
|
+
* canonical `token-estimate` helper so compactors and the context-pressure
|
|
448
|
+
* monitor share one number.
|
|
449
|
+
*/
|
|
450
|
+
declare const estimateMessages: typeof estimateMessageTokens;
|
|
451
|
+
/**
|
|
452
|
+
* Shared, pure compaction primitives.
|
|
453
|
+
*
|
|
454
|
+
* Before this module the three compactors (`HybridCompactor`,
|
|
455
|
+
* `IntelligentCompactor`, `SelectiveCompactor`) each carried their own copies
|
|
456
|
+
* of message-token estimation, tool-result elision, text detection and digest
|
|
457
|
+
* rendering — with subtle divergences (notably Selective lacked the
|
|
458
|
+
* tool_use/tool_result pair preservation, so it could elide the result of a
|
|
459
|
+
* tool call it was supposed to keep). These helpers are the single source of
|
|
460
|
+
* truth. They operate on plain `Message[]` and never touch `Context`/state, so
|
|
461
|
+
* each compactor keeps its own `ctx.state.replaceMessages(...)` plumbing.
|
|
462
|
+
*/
|
|
463
|
+
/** Does this message carry any non-empty text? */
|
|
464
|
+
declare function hasTextContent(m: Message): boolean;
|
|
465
|
+
/**
|
|
466
|
+
* Index where the preserved (recent) window starts. Walks back counting
|
|
467
|
+
* user/assistant messages until `preserveK` are covered, then walks forward to
|
|
468
|
+
* keep any tool_use/tool_result protocol pair intact — so a tool_result whose
|
|
469
|
+
* tool_use is preserved is never elided.
|
|
470
|
+
*/
|
|
471
|
+
declare function findPreserveStart(messages: readonly Message[], preserveK: number): number;
|
|
472
|
+
interface EliseResult {
|
|
473
|
+
/** New message array, or the same reference when nothing changed. */
|
|
474
|
+
messages: Message[];
|
|
475
|
+
/** Estimated tokens reclaimed. */
|
|
476
|
+
saved: number;
|
|
477
|
+
changed: boolean;
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Elide oversized tool_results that fall before the preserve window. Pure:
|
|
481
|
+
* returns a fresh array (or the same reference when unchanged). Replaces the
|
|
482
|
+
* duplicate copies that lived in all three compactors.
|
|
483
|
+
*/
|
|
484
|
+
declare function eliseOldToolResults(messages: readonly Message[], opts: {
|
|
485
|
+
preserveK: number;
|
|
486
|
+
eliseThreshold: number;
|
|
487
|
+
}): EliseResult;
|
|
488
|
+
/**
|
|
489
|
+
* Lossless textual digest of a message range. Every text block is kept verbatim
|
|
490
|
+
* (across all roles, so prior `system` digests fold forward and nothing
|
|
491
|
+
* accumulates as loss). `tool_use` / `tool_result` blocks are counted and
|
|
492
|
+
* replaced with a marker rather than serialized — their payload is already
|
|
493
|
+
* persisted in the session log. Empty/tool-only messages are skipped.
|
|
494
|
+
*/
|
|
495
|
+
declare function buildLosslessDigest(messages: readonly Message[]): string;
|
|
496
|
+
/** Importance score for a message — drives retention vs. summarization. */
|
|
497
|
+
type ContentScore = 0 | 1 | 2 | 3 | 4 | 5;
|
|
498
|
+
/**
|
|
499
|
+
* Extract the plain text from a message (ignoring tool blocks).
|
|
500
|
+
* Returns empty string if no text content exists.
|
|
501
|
+
*/
|
|
502
|
+
declare function extractText(m: Message): string;
|
|
503
|
+
/**
|
|
504
|
+
* Score a message by content importance.
|
|
505
|
+
*
|
|
506
|
+
* CRITICAL (5): user corrections, explicit "no/wrong/stop", error messages,
|
|
507
|
+
* architecture decisions, security findings.
|
|
508
|
+
* MEDIUM (3): normal exchanges, successful tool calls, file reads, edits.
|
|
509
|
+
* LOW (1): large tool results (>3K chars), grep/file-list outputs, boilerplate.
|
|
510
|
+
* NOISE (0): repeated identical failures (same tool, same error, 5th+ occurrence
|
|
511
|
+
* within the range), pure tool I/O with no text.
|
|
512
|
+
*/
|
|
513
|
+
declare function scoreMessage(m: Message, context?: {
|
|
514
|
+
failureCounts?: Map<string, number>;
|
|
515
|
+
}): ContentScore;
|
|
516
|
+
/**
|
|
517
|
+
* Build a content-aware digest of messages.
|
|
518
|
+
*
|
|
519
|
+
* Unlike `buildLosslessDigest` which preserves all text equally, this uses
|
|
520
|
+
* `scoreMessage` to apply tiered treatment:
|
|
521
|
+
* - Score 5 (critical): verbatim text
|
|
522
|
+
* - Score 3 (medium): first sentence only
|
|
523
|
+
* - Score 1 (low): one-line summary
|
|
524
|
+
* - Score 0 (noise): collapsed to count marker
|
|
525
|
+
*/
|
|
526
|
+
declare function buildSmartDigest(messages: readonly Message[]): string;
|
|
527
|
+
|
|
440
528
|
/**
|
|
441
529
|
* Options for {@link bootConfig}. Both the CLI and the WebUI server boot the
|
|
442
530
|
* same way; the only intentional differences are the label used in the
|
|
@@ -617,6 +705,61 @@ declare function consumeBtwNotes(ctx: Context): string[];
|
|
|
617
705
|
*/
|
|
618
706
|
declare function buildBtwBlock(notes: string[]): string;
|
|
619
707
|
|
|
708
|
+
/**
|
|
709
|
+
* Queue awareness — let the running agent *see* messages the user typed
|
|
710
|
+
* while it was busy, without delivering them early.
|
|
711
|
+
*
|
|
712
|
+
* The TUI queues plain messages typed mid-run and replays them as real user
|
|
713
|
+
* turns after the run finishes (the queue drainer in app.tsx). That keeps
|
|
714
|
+
* turn-taking clean, but the model is blind to the backlog: a queued message
|
|
715
|
+
* may invalidate the current approach, add a constraint, or just be a
|
|
716
|
+
* "by the way" note the user expected the agent to notice.
|
|
717
|
+
*
|
|
718
|
+
* Unlike `/btw` (a consume-once note channel, {@link ./btw.ts}), this is a
|
|
719
|
+
* SNAPSHOT channel: the host mirrors the queue's current contents onto the
|
|
720
|
+
* live `Context` on every queue mutation (enqueue, /queue delete, /queue
|
|
721
|
+
* clear, dequeue-for-delivery). At each iteration boundary the agent loop
|
|
722
|
+
* asks "did the snapshot change since the model last saw it?" and, if so,
|
|
723
|
+
* injects an informational block listing the pending messages. The queue
|
|
724
|
+
* itself is untouched — every queued message still arrives later as its own
|
|
725
|
+
* user turn.
|
|
726
|
+
*
|
|
727
|
+
* Deliberate quietness: when the queue transitions to empty (cleared by the
|
|
728
|
+
* user, drained between runs, or dropped by steering/abort) the snapshot is
|
|
729
|
+
* marked seen WITHOUT injecting a "queue is now empty" block. The empty
|
|
730
|
+
* transition usually happens at run boundaries where such a notice is stale
|
|
731
|
+
* noise; the cost is that a mid-run `/queue clear` isn't announced, which is
|
|
732
|
+
* safe because the block's framing already tells the model the queue may
|
|
733
|
+
* change and the authoritative messages arrive as future turns.
|
|
734
|
+
*/
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* Mirror the host's pending-message queue onto the context. Call on every
|
|
738
|
+
* queue mutation with the FULL current queue (head first) — not a delta.
|
|
739
|
+
* Blank entries are dropped; the head-most {@link MAX_ITEMS} are kept since
|
|
740
|
+
* the head is what arrives first.
|
|
741
|
+
*/
|
|
742
|
+
declare function setQueuedMessagesSnapshot(ctx: Context, texts: string[]): void;
|
|
743
|
+
/** Current snapshot (previews), without affecting seen-state. */
|
|
744
|
+
declare function peekQueuedMessages(ctx: Context): string[];
|
|
745
|
+
/**
|
|
746
|
+
* Called by the agent loop at each iteration boundary. Returns the queued
|
|
747
|
+
* messages to surface when the snapshot changed since the model last saw it,
|
|
748
|
+
* or `null` when there is nothing new to say. Marks the snapshot seen either
|
|
749
|
+
* way, so the same state is never injected twice. An empty snapshot is
|
|
750
|
+
* acknowledged silently (see module comment).
|
|
751
|
+
*/
|
|
752
|
+
declare function consumeQueuedMessagesUpdate(ctx: Context): string[] | null;
|
|
753
|
+
/**
|
|
754
|
+
* Format the awareness block. Framing goals: (1) the model must NOT treat
|
|
755
|
+
* the listed messages as instructions to execute now — they each arrive as
|
|
756
|
+
* their own turn later; (2) it SHOULD let them influence in-flight decisions
|
|
757
|
+
* (a queued message may invalidate the current approach or be a /btw-style
|
|
758
|
+
* note); (3) the list is a full replacement of any earlier notice, so a
|
|
759
|
+
* shrunken list implicitly communicates deletions.
|
|
760
|
+
*/
|
|
761
|
+
declare function buildQueuedMessagesBlock(items: string[]): string;
|
|
762
|
+
|
|
620
763
|
interface InputBuilderOptions {
|
|
621
764
|
store: AttachmentStore;
|
|
622
765
|
/**
|
|
@@ -710,7 +853,7 @@ declare class InputBuilder {
|
|
|
710
853
|
private shouldCollapse;
|
|
711
854
|
}
|
|
712
855
|
|
|
713
|
-
declare const LAYER_1_IDENTITY = "You are WrongStack, a command-line AI coding agent.\n\nYou operate inside the user's terminal with direct read and write access to their working directory, the ability to run shell commands, and access to the web. You assist a developer who knows what they're doing \u2014 your job is to accelerate them, not to second-guess them.\n\nThese are your baseline instructions. When an active mode prompt (Teach, Brief, Code Reviewer, etc.) is present in your context, its instructions **override** conflicting defaults below \u2014 the mode layer always wins on conflict.\n\n## Core principles\n\n1. **Read before you write.** Always inspect the relevant files before proposing changes. Assumptions about code you haven't read are bugs in waiting.\n2. **Prefer surgical edits over rewrites.** When modifying existing files, use the edit tool with str_replace; only use write for new files or full replacements explicitly requested.\n3. **Show your work.** Before non-trivial changes, briefly state what you're about to do \u2014 one sentence, not a wall of text. After tool calls, summarize what happened, not what you did mechanically.\n4. **Be honest about limits.** If you don't know, say so. If something failed, say what failed and what you'll try next. Never fabricate file contents, API responses, or test results.\n5. **Be concise.** The user is a developer in a terminal. No marketing language, no \"great question!\", no bullet-point lists when prose works. If a one-liner answers, a one-liner is the answer. (Active modes may override verbosity \u2014 follow the mode's guidance on depth.)\n6. **Ask when blocked, proceed when not.** If the task is ambiguous in a way that meaningfully changes the approach, ask. If it's ambiguous in a way that doesn't, pick a reasonable default and proceed, stating the assumption.\n7. **Trust the tools.** If a permission prompt is shown, the user will answer. Do not preemptively explain that you \"would like to\" do something \u2014 call the tool, let the permission flow decide.\n8. **Format for scanability.** Use code blocks for code, backticks for file paths, bold for key terms. One-liners stay one line. Paragraphs max 3 sentences.\n9. **Match the user's language.** Respond in the same language the user writes in. If they write in Turkish, reply in Turkish. If they mix languages, follow the dominant one.\n10. **Recover explicitly.** When a tool fails, distinguish the failure type and respond accordingly:\n\n| Failure type | Examples | Strategy |\n|---|---|---|\n| **Transient** | Timeout, rate limit, network hiccup | Retry once with adjusted params, then report |\n| **Permanent** | Syntax error, missing file, type error, permission denied | Do NOT retry \u2014 diagnose and report the root cause |\n| **Validation** | Invalid argument, out-of-range value, schema mismatch | State what was rejected and what range/format is accepted |\n\nNever silently skip a failure \u2014 always report it, even when you choose not to retry.\n\n## Decision heuristics\n\n- **Task is ambiguous** (unclear which file, conflicting requirements) \u2192 ask before proceeding\n- **Task is clear, approach is unknown** \u2192 try one approach, report what happened\n- **Tool fails** \u2192 classify the failure (transient/permanent/validation), then apply the appropriate recovery\n- **Permission prompt shown** \u2192 wait for user, do not act unilaterally\n- **Tool denied by user** \u2192 do NOT retry the same tool in the next iteration. If the user denies a write, bash, or any tool, respect that decision. The user's \"no\" is final \u2014 acknowledge it and ask if they'd like to clarify what they actually want.\n- **Context window filling up** \u2192 use context_manager proactively; don't wait to be told\n\n## How you work\n\n- **Stay focused.** When fixing a bug, fix only the bug \u2014 don't refactor neighboring code unless the user asks.\n- **Comment with purpose.** Add comments only when they explain why, not what. The code already says what.\n- **Own your output.** Never call work \"production-ready\" or \"fully tested\" \u2014 the user makes that call.\n- **Move on from mistakes.** When something fails, report what happened and what you'll do next. No apologies, no hand-wringing.\n- **Respect denied tools.** If the user denies a tool call (via permission prompt), do not retry that same operation in the next iteration. The user's \"no\" means \"find another way or ask\". Never re-attempt a denied tool unless the user explicitly asks you to try again.\n- **When denied, ask.** If the user refuses a tool call, do not attempt to work around it, do not suggest alternatives unprompted, and do not retry. Acknowledge the denial and explicitly ask: \"What would you like me to do instead?\"\n- **Stay in your lane.** Don't lecture about software engineering principles unless explicitly asked \u2014 the user is the expert on their codebase.\n\n## After-task suggestions\n\nAfter completing a significant task, end your response with 2\u20134 suggested next\nactions under a `\uD83D\uDCA1 Next steps` heading. Use this format so the user can\nselect them with `/next 1`, `/next 2`, or `/next 1 2 3`:\n\n```\n\uD83D\uDCA1 Next steps\n1. First suggestion \u2014 imperative, specific, actionable\n2. Second suggestion\n3. Third suggestion\n```\n\nRules:\n- Each line is a single imperative sentence the user can act on immediately.\n- Be specific: mention file names, tool names, or commands.\n- Order by priority. Keep each suggestion to one line.\n- Skip during multi-step operations \u2014 only show after completion.\n- If nothing is pending, say \"No pending actions.\"\n\nThe user can execute via `/next 1`, view via `/next list`, or generate\nfresh suggestions via `/suggest`.";
|
|
856
|
+
declare const LAYER_1_IDENTITY = "You are WrongStack, a command-line AI coding agent.\n\nYou operate inside the user's terminal with direct read and write access to their working directory, the ability to run shell commands, and access to the web. You assist a developer who knows what they're doing \u2014 your job is to accelerate them, not to second-guess them.\n\nThese are your baseline instructions. When an active mode prompt (Teach, Brief, Code Reviewer, etc.) is present in your context, its instructions **override** conflicting defaults below \u2014 the mode layer always wins on conflict.\n\n## Core principles\n\n1. **Read before you write.** Always inspect the relevant files before proposing changes. Assumptions about code you haven't read are bugs in waiting.\n2. **Prefer surgical edits over rewrites.** When modifying existing files, use the edit tool with str_replace; only use write for new files or full replacements explicitly requested.\n3. **Show your work.** Before non-trivial changes, briefly state what you're about to do \u2014 one sentence, not a wall of text. After tool calls, summarize what happened, not what you did mechanically.\n4. **Be honest about limits.** If you don't know, say so. If something failed, say what failed and what you'll try next. Never fabricate file contents, API responses, or test results.\n5. **Be concise.** The user is a developer in a terminal. No marketing language, no \"great question!\", no bullet-point lists when prose works. If a one-liner answers, a one-liner is the answer. (Active modes may override verbosity \u2014 follow the mode's guidance on depth.)\n6. **Ask when blocked, proceed when not.** If the task is ambiguous in a way that meaningfully changes the approach, ask. If it's ambiguous in a way that doesn't, pick a reasonable default and proceed, stating the assumption.\n7. **Trust the tools.** If a permission prompt is shown, the user will answer. Do not preemptively explain that you \"would like to\" do something \u2014 call the tool, let the permission flow decide.\n8. **Format for scanability.** Use code blocks for code, backticks for file paths, bold for key terms. One-liners stay one line. Paragraphs max 3 sentences.\n9. **Match the user's language.** Respond in the same language the user writes in. If they write in Turkish, reply in Turkish. If they mix languages, follow the dominant one.\n10. **Recover explicitly.** When a tool fails, distinguish the failure type and respond accordingly:\n\n| Failure type | Examples | Strategy |\n|---|---|---|\n| **Transient** | Timeout, rate limit, network hiccup | Retry once with adjusted params, then report |\n| **Permanent** | Syntax error, missing file, type error, permission denied | Do NOT retry \u2014 diagnose and report the root cause |\n| **Validation** | Invalid argument, out-of-range value, schema mismatch | State what was rejected and what range/format is accepted |\n\nNever silently skip a failure \u2014 always report it, even when you choose not to retry.\n\n## Decision heuristics\n\n- **Task is ambiguous** (unclear which file, conflicting requirements) \u2192 ask before proceeding\n- **Task is clear, approach is unknown** \u2192 try one approach, report what happened\n- **Tool fails** \u2192 classify the failure (transient/permanent/validation), then apply the appropriate recovery\n- **Permission prompt shown** \u2192 wait for user, do not act unilaterally\n- **Tool denied by user** \u2192 do NOT retry the same tool in the next iteration. If the user denies a write, bash, or any tool, respect that decision. The user's \"no\" is final \u2014 acknowledge it and ask if they'd like to clarify what they actually want.\n- **Context window filling up** \u2192 use context_manager proactively; don't wait to be told\n\n## How you work\n\n- **Stay focused.** When fixing a bug, fix only the bug \u2014 don't refactor neighboring code unless the user asks.\n- **Comment with purpose.** Add comments only when they explain why, not what. The code already says what.\n- **Own your output.** Never call work \"production-ready\" or \"fully tested\" \u2014 the user makes that call.\n- **Move on from mistakes.** When something fails, report what happened and what you'll do next. No apologies, no hand-wringing.\n- **Respect denied tools.** If the user denies a tool call (via permission prompt), do not retry that same operation in the next iteration. The user's \"no\" means \"find another way or ask\". Never re-attempt a denied tool unless the user explicitly asks you to try again.\n- **When denied, ask.** If the user refuses a tool call, do not attempt to work around it, do not suggest alternatives unprompted, and do not retry. Acknowledge the denial and explicitly ask: \"What would you like me to do instead?\"\n- **Stay in your lane.** Don't lecture about software engineering principles unless explicitly asked \u2014 the user is the expert on their codebase.\n\n## After-task suggestions\n\nAfter completing a significant task, end your response with 2\u20134 suggested next\nactions under a `\uD83D\uDCA1 Next steps` heading. Use this format so the user can\nselect them with `/next 1`, `/next 2`, or `/next 1 2 3`:\n\n```\n\uD83D\uDCA1 Next steps\n1. First suggestion \u2014 imperative, specific, actionable\n2. Second suggestion\n3. Third suggestion\n```\n\nRules:\n- Each line is a single imperative sentence the user can act on immediately.\n- Be specific: mention file names, tool names, or commands.\n- Order by priority. Keep each suggestion to one line.\n- Skip during multi-step operations \u2014 only show after completion.\n- If nothing is pending, say \"No pending actions.\"\n\n**After a significant task**, also post a status update to the inter-agent\nmailbox so other agents in the fleet can discover what you finished and\nroute follow-on work. Use:\n`mailbox action=send to=* type=status subject=\"<one-line task summary>\" body=\"<brief outcome>\"`\n\nThe user can execute via `/next 1`, view via `/next list`, or generate\nfresh suggestions via `/suggest`.";
|
|
714
857
|
interface DefaultSystemPromptBuilderOptions {
|
|
715
858
|
memoryStore?: MemoryStore | undefined;
|
|
716
859
|
skillLoader?: SkillLoader | undefined;
|
|
@@ -761,6 +904,13 @@ declare class DefaultSystemPromptBuilder implements SystemPromptBuilder {
|
|
|
761
904
|
private _lastBuildTools?;
|
|
762
905
|
constructor(opts?: DefaultSystemPromptBuilderOptions);
|
|
763
906
|
build(ctx: BuildContext): Promise<TextBlock[]>;
|
|
907
|
+
/**
|
|
908
|
+
* Cached plan content keyed by (planPath, mtimeMs). The plan is read
|
|
909
|
+
* once per system-prompt build; most turns don't change the plan, so
|
|
910
|
+
* this avoids a blocking fs.readFile + JSON.parse on every iteration.
|
|
911
|
+
* Cleared when the file's mtime changes (the `/plan` tool mutated it).
|
|
912
|
+
*/
|
|
913
|
+
private _planCache?;
|
|
764
914
|
/**
|
|
765
915
|
* Reads `<sessionId>.plan.json` (when configured) and produces a short
|
|
766
916
|
* "Active plan" block listing open items so the model is anchored to
|
|
@@ -769,6 +919,7 @@ declare class DefaultSystemPromptBuilder implements SystemPromptBuilder {
|
|
|
769
919
|
* turn without restarting the session.
|
|
770
920
|
*/
|
|
771
921
|
private buildActivePlan;
|
|
922
|
+
private _formatPlan;
|
|
772
923
|
private buildToolUsage;
|
|
773
924
|
private buildEnvironment;
|
|
774
925
|
private buildMemoryAndSkills;
|
|
@@ -969,89 +1120,6 @@ declare function loadPlugins(plugins: Plugin[], opts: LoadPluginsOptions): Promi
|
|
|
969
1120
|
*/
|
|
970
1121
|
declare function unloadPlugins(loadedPlugins: Plugin[], opts: LoadPluginsOptions): Promise<void>;
|
|
971
1122
|
|
|
972
|
-
/**
|
|
973
|
-
* Prompt refinement ("did you mean this?").
|
|
974
|
-
*
|
|
975
|
-
* Runs a one-shot LLM call in a SEPARATE context (its own system prompt, no
|
|
976
|
-
* conversation history, no tools) that rewrites a raw user message into a
|
|
977
|
-
* clearer, more complete instruction BEFORE the main agent sees it. The goal
|
|
978
|
-
* is to make the main context start from a well-understood request rather than
|
|
979
|
-
* guessing intent from terse input like "fix the bug".
|
|
980
|
-
*
|
|
981
|
-
* This mirrors `IntelligentCompactor.callSummarizer` — a plain
|
|
982
|
-
* `provider.complete()` with a dedicated system prompt — and is deliberately
|
|
983
|
-
* free of React / TUI dependencies so it can be unit-tested in isolation.
|
|
984
|
-
*/
|
|
985
|
-
declare const ENHANCER_SYSTEM_PROMPT = "You are a request refiner embedded in a coding agent. Your ONLY job is to rewrite the user's message into clearer, unambiguous instructions that the coding agent can act on confidently.\n\nRules:\n- Preserve the user's intent and scope EXACTLY. Do not add new requirements, features, constraints, or steps the user did not ask for. Do not remove anything they did ask for.\n- Do NOT answer, solve, or perform the request. Only restate it more clearly.\n- Keep all concrete details verbatim: file paths, identifiers, code, error text, numbers, names, URLs.\n- Resolve obvious ambiguity by making the implied subject explicit, not by inventing specifics. If something is genuinely unspecified, leave it general rather than guessing.\n- Be concise: one tight instruction per version (a few sentences at most). No preamble, no explanation, no quotes, no markdown headers.\n- If the message is already clear and complete, return it essentially unchanged.\n\nYou MUST output TWO versions of the refined request, separated by a line containing only \"---\".\n- First version: refined in the SAME LANGUAGE the user wrote in (if Turkish \u2192 Turkish, if Spanish \u2192 Spanish, etc.).\n- Second version: refined in ENGLISH (translate the intent into clear English while preserving all concrete details).\n\nOutput format:\n<refined in user's language>\n---\n<refined in English>\n\nWhen earlier conversation turns are provided, they are CONTEXT ONLY. Use them to resolve references in the user's latest message \u2014 \"it\", \"that\", \"the same\", \"the other one\", \"this file\", \"again\" \u2014 so the refined instruction is self-contained. Refine ONLY the user's latest message; do not answer it, do not act on or restate earlier turns, and do not summarize the conversation.\n\nOutput ONLY the two versions separated by \"---\" \u2014 nothing else.";
|
|
986
|
-
/**
|
|
987
|
-
* Heuristic gate: should this raw input be sent through the refiner at all?
|
|
988
|
-
* Pure + exported for unit testing. Returns false for inputs where refinement
|
|
989
|
-
* is pointless or unwanted (slash commands, one-word affirmations, trivially
|
|
990
|
-
* short text, bare numbers).
|
|
991
|
-
*/
|
|
992
|
-
declare function shouldEnhance(text: string): boolean;
|
|
993
|
-
/**
|
|
994
|
-
* Normalize for "did the refiner actually change anything?" comparison —
|
|
995
|
-
* collapse whitespace and lowercase so trivial reformatting doesn't trigger
|
|
996
|
-
* the confirmation panel.
|
|
997
|
-
*/
|
|
998
|
-
declare function normalizedEqual(a: string, b: string): boolean;
|
|
999
|
-
/** A single text-only conversation turn used as refiner context. */
|
|
1000
|
-
interface ConversationTurn {
|
|
1001
|
-
role: 'user' | 'assistant';
|
|
1002
|
-
text: string;
|
|
1003
|
-
}
|
|
1004
|
-
/**
|
|
1005
|
-
* Result of a successful prompt refinement. Contains both the
|
|
1006
|
-
* original-language and English versions so the UI can offer both.
|
|
1007
|
-
*/
|
|
1008
|
-
interface EnhanceResult {
|
|
1009
|
-
/** Refined in the user's original language. */
|
|
1010
|
-
refined: string;
|
|
1011
|
-
/** Refined in English. */
|
|
1012
|
-
english: string;
|
|
1013
|
-
}
|
|
1014
|
-
interface EnhanceUserPromptOptions {
|
|
1015
|
-
provider: Provider;
|
|
1016
|
-
model: string;
|
|
1017
|
-
text: string;
|
|
1018
|
-
/**
|
|
1019
|
-
* Recent conversation turns (oldest→newest), text only, used purely as
|
|
1020
|
-
* CONTEXT so the refiner can resolve references in a follow-up message
|
|
1021
|
-
* ("it", "the same", "that file"). Without this, the refiner is blind to
|
|
1022
|
-
* the conversation and can only refine self-contained prompts. Build with
|
|
1023
|
-
* `recentTextTurns(ctx.messages)`.
|
|
1024
|
-
*/
|
|
1025
|
-
history?: ConversationTurn[] | undefined;
|
|
1026
|
-
/** Parent abort signal (e.g. the run controller / Esc). */
|
|
1027
|
-
signal?: AbortSignal | undefined;
|
|
1028
|
-
/** Hard cap on how long to wait for the refiner before giving up. Default 90s. */
|
|
1029
|
-
timeoutMs?: number | undefined;
|
|
1030
|
-
/** Max tokens for the refined output. Default 2048. */
|
|
1031
|
-
maxTokens?: number | undefined;
|
|
1032
|
-
/**
|
|
1033
|
-
* Called with a short reason when refinement fails (provider error, timeout,
|
|
1034
|
-
* empty response). NOT called when the caller cancels via `signal`. Lets the
|
|
1035
|
-
* UI surface *why* a refine fell through instead of a generic message.
|
|
1036
|
-
*/
|
|
1037
|
-
onError?: ((reason: string) => void) | undefined;
|
|
1038
|
-
}
|
|
1039
|
-
/**
|
|
1040
|
-
* Refine a raw user prompt. Returns the refined text, or `null` when the
|
|
1041
|
-
* caller should fall back to the original (refiner errored, timed out, was
|
|
1042
|
-
* aborted, or returned nothing useful). NEVER throws — refinement is a
|
|
1043
|
-
* best-effort convenience and must never block the user from sending.
|
|
1044
|
-
*/
|
|
1045
|
-
declare function enhanceUserPrompt(opts: EnhanceUserPromptOptions): Promise<EnhanceResult | null>;
|
|
1046
|
-
/**
|
|
1047
|
-
* Extract the last few user/assistant TEXT turns from a conversation, newest
|
|
1048
|
-
* last, for use as refiner context. Skips system messages and tool-only turns
|
|
1049
|
-
* (tool_use / tool_result carry no useful natural-language context and bloat
|
|
1050
|
-
* the call). Each turn is truncated to `maxChars`; at most `maxTurns` are
|
|
1051
|
-
* returned. Pure + exported for unit testing.
|
|
1052
|
-
*/
|
|
1053
|
-
declare function recentTextTurns(messages: Message[], maxTurns?: number, maxChars?: number): ConversationTurn[];
|
|
1054
|
-
|
|
1055
1123
|
type PhaseStatus = 'pending' | 'ready' | 'running' | 'paused' | 'completed' | 'failed' | 'skipped';
|
|
1056
1124
|
interface PhaseNode {
|
|
1057
1125
|
id: string;
|
|
@@ -1816,6 +1884,218 @@ interface InjectedToolResult {
|
|
|
1816
1884
|
authorId: string;
|
|
1817
1885
|
}
|
|
1818
1886
|
|
|
1887
|
+
/**
|
|
1888
|
+
* mailbox-loop — Agent-loop integration for mailbox checking.
|
|
1889
|
+
*
|
|
1890
|
+
* Integrates the inter-agent mailbox into the agent's iteration cycle.
|
|
1891
|
+
* Before each LLM call, checks for unread high-priority messages (steer, btw).
|
|
1892
|
+
* Found messages are folded into the conversation so the agent can react.
|
|
1893
|
+
*
|
|
1894
|
+
* Uses the project-level GlobalMailbox for cross-session communication.
|
|
1895
|
+
*
|
|
1896
|
+
* @module mailbox-loop
|
|
1897
|
+
*/
|
|
1898
|
+
|
|
1899
|
+
interface MailboxLoopOptions {
|
|
1900
|
+
mailbox: Mailbox;
|
|
1901
|
+
/**
|
|
1902
|
+
* The agent's globally unique mailbox identity (e.g. `leader@a1b2c3d4`,
|
|
1903
|
+
* session-bound). Read receipts are recorded under this id, so two
|
|
1904
|
+
* sessions whose leaders share a base name never consume each other's
|
|
1905
|
+
* receipts. Pass a GETTER when the identity can change at runtime (an
|
|
1906
|
+
* in-process session swap moves the leader onto a new session tag).
|
|
1907
|
+
*/
|
|
1908
|
+
agentId: string | (() => string);
|
|
1909
|
+
/**
|
|
1910
|
+
* Additional addresses this agent also answers to — typically the bare
|
|
1911
|
+
* base id (`leader`). Lets other agents (and humans) address "leader"
|
|
1912
|
+
* without knowing the session tag; every live leader session receives it.
|
|
1913
|
+
*/
|
|
1914
|
+
aliases?: string[] | undefined;
|
|
1915
|
+
}
|
|
1916
|
+
declare function createMailboxChecker(opts: MailboxLoopOptions): () => Promise<MailboxMessage[]>;
|
|
1917
|
+
declare function buildMailboxBlock(messages: MailboxMessage[]): {
|
|
1918
|
+
type: 'text';
|
|
1919
|
+
text: string;
|
|
1920
|
+
};
|
|
1921
|
+
declare function injectPendingMailboxMessages(checkMailbox: () => Promise<MailboxMessage[]>, foldFn: (block: {
|
|
1922
|
+
type: 'text';
|
|
1923
|
+
text: string;
|
|
1924
|
+
}) => void, a: {
|
|
1925
|
+
events: {
|
|
1926
|
+
emit: (type: string, payload: unknown) => void;
|
|
1927
|
+
};
|
|
1928
|
+
logger: {
|
|
1929
|
+
debug?: (...args: unknown[]) => void;
|
|
1930
|
+
};
|
|
1931
|
+
}): Promise<void>;
|
|
1932
|
+
|
|
1933
|
+
/**
|
|
1934
|
+
* Minimal interface exposing the Agent fields that the extracted
|
|
1935
|
+
* loop / tool-execution / response modules need. Each extracted
|
|
1936
|
+
* function takes this interface instead of the full Agent class,
|
|
1937
|
+
* keeping coupling explicit and testable.
|
|
1938
|
+
*/
|
|
1939
|
+
interface AgentInternals {
|
|
1940
|
+
readonly container: Container;
|
|
1941
|
+
readonly tools: ToolRegistry;
|
|
1942
|
+
readonly providers: ProviderRegistry;
|
|
1943
|
+
readonly events: EventBus;
|
|
1944
|
+
readonly pipelines: AgentPipelines;
|
|
1945
|
+
readonly ctx: Context;
|
|
1946
|
+
readonly maxIterations: number;
|
|
1947
|
+
readonly executionStrategy: 'parallel' | 'sequential' | 'smart';
|
|
1948
|
+
readonly perIterationOutputCapBytes: number;
|
|
1949
|
+
readonly autoExtendLimit: boolean;
|
|
1950
|
+
readonly toolExecutor: ToolExecutorLike;
|
|
1951
|
+
readonly extensions: ExtensionRegistry;
|
|
1952
|
+
readonly logger: Logger;
|
|
1953
|
+
readonly retry: RetryPolicy;
|
|
1954
|
+
readonly errorHandler: ErrorHandler;
|
|
1955
|
+
readonly permission: PermissionPolicy;
|
|
1956
|
+
readonly renderer: Renderer | undefined;
|
|
1957
|
+
readonly tracer: Tracer | undefined;
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1960
|
+
/**
|
|
1961
|
+
* mailbox-attach — composition glue for the agent-loop mailbox checker.
|
|
1962
|
+
*
|
|
1963
|
+
* Lives at the src root (composition layer) because it constructs the
|
|
1964
|
+
* concrete GlobalMailbox from coordination/ and hands the resulting
|
|
1965
|
+
* checker to core/ — core/ itself may only depend on the Mailbox
|
|
1966
|
+
* interface (architecture Rule 3, see tests/architecture/
|
|
1967
|
+
* package-boundaries.test.ts).
|
|
1968
|
+
*
|
|
1969
|
+
* @module mailbox-attach
|
|
1970
|
+
*/
|
|
1971
|
+
|
|
1972
|
+
declare function attachMailboxChecker(a: AgentInternals, source?: 'cli' | 'webui'): () => Promise<MailboxMessage[]>;
|
|
1973
|
+
|
|
1974
|
+
/**
|
|
1975
|
+
* file-author-tracker — JSON-based tracking of which agent created/edited files.
|
|
1976
|
+
*
|
|
1977
|
+
* Stores a per-project JSON log in the global project directory:
|
|
1978
|
+
* ~/.wrongstack/projects/<slug-hash>/file-authors.json
|
|
1979
|
+
*
|
|
1980
|
+
* Each entry records: file path, action (create|edit), agent id/name,
|
|
1981
|
+
* timestamp, and optional session id.
|
|
1982
|
+
*
|
|
1983
|
+
* Used by the tech-stack agent and other coordination tools to know
|
|
1984
|
+
* who touched what, so warnings can be routed to the right agent.
|
|
1985
|
+
*
|
|
1986
|
+
* @module file-author-tracker
|
|
1987
|
+
*/
|
|
1988
|
+
interface FileAuthorEntry {
|
|
1989
|
+
/** Absolute or relative file path. */
|
|
1990
|
+
filePath: string;
|
|
1991
|
+
/** What happened to the file. */
|
|
1992
|
+
action: 'create' | 'edit' | 'delete';
|
|
1993
|
+
/** Agent id (e.g. 'leader', 'tech-stack', 'executor'). */
|
|
1994
|
+
agentId: string;
|
|
1995
|
+
/** Human-readable agent name. */
|
|
1996
|
+
agentName?: string | undefined;
|
|
1997
|
+
/** Session that performed the action. */
|
|
1998
|
+
sessionId?: string | undefined;
|
|
1999
|
+
/** ISO8601 timestamp. */
|
|
2000
|
+
timestamp: string;
|
|
2001
|
+
/** Optional commit hash if known. */
|
|
2002
|
+
commitHash?: string | undefined;
|
|
2003
|
+
}
|
|
2004
|
+
interface FileAuthorLog {
|
|
2005
|
+
/** Project root this log belongs to. */
|
|
2006
|
+
projectRoot: string;
|
|
2007
|
+
/** All entries, newest last. */
|
|
2008
|
+
entries: FileAuthorEntry[];
|
|
2009
|
+
/** Last time the log was compacted (old entries archived). */
|
|
2010
|
+
lastCompactedAt?: string | undefined;
|
|
2011
|
+
}
|
|
2012
|
+
interface FileAuthorTrackerOptions {
|
|
2013
|
+
/** Directory where the JSON log is stored. Usually the global project dir. */
|
|
2014
|
+
storageDir: string;
|
|
2015
|
+
/** Project root for reference. */
|
|
2016
|
+
projectRoot: string;
|
|
2017
|
+
/** Max entries before auto-compaction. Default: 5000. */
|
|
2018
|
+
maxEntries?: number | undefined;
|
|
2019
|
+
}
|
|
2020
|
+
/**
|
|
2021
|
+
* Record that an agent created, edited, or deleted a file.
|
|
2022
|
+
*/
|
|
2023
|
+
declare function recordFileAction(opts: FileAuthorTrackerOptions, entry: Omit<FileAuthorEntry, 'timestamp'>): Promise<void>;
|
|
2024
|
+
/**
|
|
2025
|
+
* Get the most recent author entry for a given file path.
|
|
2026
|
+
* Returns undefined if no entry exists.
|
|
2027
|
+
*/
|
|
2028
|
+
declare function getLastAuthor(opts: Pick<FileAuthorTrackerOptions, 'storageDir' | 'projectRoot'>, filePath: string): Promise<FileAuthorEntry | undefined>;
|
|
2029
|
+
/**
|
|
2030
|
+
* Get all entries for a file, newest last.
|
|
2031
|
+
*/
|
|
2032
|
+
declare function getFileHistory(opts: Pick<FileAuthorTrackerOptions, 'storageDir' | 'projectRoot'>, filePath: string): Promise<FileAuthorEntry[]>;
|
|
2033
|
+
/**
|
|
2034
|
+
* Get all files last touched by a specific agent.
|
|
2035
|
+
*/
|
|
2036
|
+
declare function getFilesByAgent(opts: Pick<FileAuthorTrackerOptions, 'storageDir' | 'projectRoot'>, agentId: string): Promise<Map<string, FileAuthorEntry>>;
|
|
2037
|
+
/**
|
|
2038
|
+
* Return the full log (for debugging/auditing).
|
|
2039
|
+
*/
|
|
2040
|
+
declare function getFullLog(opts: Pick<FileAuthorTrackerOptions, 'storageDir' | 'projectRoot'>): Promise<FileAuthorLog>;
|
|
2041
|
+
/**
|
|
2042
|
+
* Compact the log by archiving old entries to a separate file.
|
|
2043
|
+
* Keeps the most recent `keepCount` entries in the active log.
|
|
2044
|
+
*/
|
|
2045
|
+
declare function compactLog(opts: Pick<FileAuthorTrackerOptions, 'storageDir' | 'projectRoot'>, keepCount?: number): Promise<{
|
|
2046
|
+
archived: number;
|
|
2047
|
+
kept: number;
|
|
2048
|
+
}>;
|
|
2049
|
+
|
|
2050
|
+
/**
|
|
2051
|
+
* techstack-mailbox-consumer — Auto-spawns the tech-stack agent when
|
|
2052
|
+
* dep-watcher messages land in the mailbox.
|
|
2053
|
+
*
|
|
2054
|
+
* This module runs a lightweight polling loop that checks the mailbox
|
|
2055
|
+
* for unread `assign` messages directed at the `tech-stack` agent.
|
|
2056
|
+
* When found, it invokes the provided `onSpawn` callback to spawn a
|
|
2057
|
+
* tech-stack subagent, passing the manifest path as the task.
|
|
2058
|
+
*
|
|
2059
|
+
* The consumer also records file-author entries when it detects that
|
|
2060
|
+
* a manifest was edited, so the tech-stack agent knows who to warn.
|
|
2061
|
+
*
|
|
2062
|
+
* @module techstack-mailbox-consumer
|
|
2063
|
+
*/
|
|
2064
|
+
|
|
2065
|
+
interface TechStackConsumerOptions {
|
|
2066
|
+
/** The mailbox to poll. */
|
|
2067
|
+
mailbox: Mailbox;
|
|
2068
|
+
/** Called when a tech-stack agent should be spawned. Receives the task description. */
|
|
2069
|
+
onSpawn: (task: string, name: string) => Promise<{
|
|
2070
|
+
subagentId: string;
|
|
2071
|
+
taskId: string;
|
|
2072
|
+
}>;
|
|
2073
|
+
/** Agent id that the consumer watches for. Default: 'tech-stack'. */
|
|
2074
|
+
targetAgent?: string | undefined;
|
|
2075
|
+
/** Agent id that sends the completion ack. Default: 'tech-stack-consumer'. */
|
|
2076
|
+
consumerAgentId?: string | undefined;
|
|
2077
|
+
/** Polling interval in ms. Default: 5000. */
|
|
2078
|
+
pollIntervalMs?: number | undefined;
|
|
2079
|
+
/** File-author tracker config (for recording manifest edits). */
|
|
2080
|
+
fileAuthorOpts?: FileAuthorTrackerOptions | undefined;
|
|
2081
|
+
/** Current session id (for file-author entries). */
|
|
2082
|
+
sessionId?: string | undefined;
|
|
2083
|
+
/** Current agent id (for file-author entries). */
|
|
2084
|
+
currentAgentId?: string | undefined;
|
|
2085
|
+
/** Current agent name (for file-author entries). */
|
|
2086
|
+
currentAgentName?: string | undefined;
|
|
2087
|
+
/** Called on each poll cycle for logging. */
|
|
2088
|
+
onLog?: ((msg: string) => void) | undefined;
|
|
2089
|
+
/** Called when an error occurs. */
|
|
2090
|
+
onError?: ((err: unknown) => void) | undefined;
|
|
2091
|
+
}
|
|
2092
|
+
/**
|
|
2093
|
+
* Start the mailbox consumer loop.
|
|
2094
|
+
*
|
|
2095
|
+
* Returns a dispose function that stops polling and cleans up.
|
|
2096
|
+
*/
|
|
2097
|
+
declare function startTechStackConsumer(opts: TechStackConsumerOptions): () => void;
|
|
2098
|
+
|
|
1819
2099
|
/**
|
|
1820
2100
|
* collabPauseMiddleware — gates the agent's `toolCall` pipeline on
|
|
1821
2101
|
* the collaboration pause signal.
|
|
@@ -2056,4 +2336,34 @@ interface PlanPluginOptions {
|
|
|
2056
2336
|
*/
|
|
2057
2337
|
declare function createPlanPlugin(opts?: PlanPluginOptions): Plugin;
|
|
2058
2338
|
|
|
2059
|
-
|
|
2339
|
+
interface ChimeraConfig {
|
|
2340
|
+
enabled?: boolean | undefined;
|
|
2341
|
+
provider?: string | undefined;
|
|
2342
|
+
model?: string | undefined;
|
|
2343
|
+
maxFiles?: number | undefined;
|
|
2344
|
+
maxTokens?: number | undefined;
|
|
2345
|
+
}
|
|
2346
|
+
interface ResolvedChimeraConfig {
|
|
2347
|
+
enabled: boolean;
|
|
2348
|
+
provider: string;
|
|
2349
|
+
model: string;
|
|
2350
|
+
maxFiles: number;
|
|
2351
|
+
maxTokens: number;
|
|
2352
|
+
}
|
|
2353
|
+
declare function resolveChimeraConfig(cfg: ChimeraConfig, sessionProvider: string, sessionModel: string): ResolvedChimeraConfig;
|
|
2354
|
+
interface ChimeraReviewNeededPayload {
|
|
2355
|
+
/** Resolved chimera config */
|
|
2356
|
+
config: ResolvedChimeraConfig;
|
|
2357
|
+
/** Project root for git operations */
|
|
2358
|
+
cwd: string;
|
|
2359
|
+
/** Changed files with their contents */
|
|
2360
|
+
files: Array<{
|
|
2361
|
+
path: string;
|
|
2362
|
+
status: 'added' | 'modified';
|
|
2363
|
+
content: string;
|
|
2364
|
+
}>;
|
|
2365
|
+
}
|
|
2366
|
+
declare const CHIMERA_REVIEW_PROMPT = "You are Chimera, a post-session code quality agent. You review files that\nwere ADDED or MODIFIED during an AI coding session and produce a concise,\nactionable report.\n\nRULES\n1. Only review the files provided \u2014 do not expand scope.\n2. Use read/grep/lint tools to inspect files before flagging issues.\n3. Be surgical \u2014 flag real bugs, not style preferences.\n4. Severity-ranked: Critical > High > Medium > Low. Only report Medium+.\n5. One finding per line with severity, file:line, and a one-sentence fix.\n\nWHAT TO LOOK FOR\n- Logic bugs: off-by-one, inverted condition, null deref without guard\n- Type safety: `as any`, missing return type on export, `!` assertion\n- Error handling: missing try/catch on async, swallowed errors\n- Security: hardcoded secret, shell injection, innerHTML XSS\n- Resource leaks: event listener not removed, file handle not closed\n- Test gaps: new logic without corresponding test\n- API design: wrong status code, missing validation, secrets in URL\n\nREPORT FORMAT\n## \uD83E\uDD82 Chimera Review\n\n### Critical (N)\n1. [BUG] `path/file.ts:42` \u2014 description\n \u2192 fix suggestion\n\n### High (N)\n...\n\n### Medium (N)\n...\n\n### Summary\n- Files reviewed: N\n- Findings: C critical, H high, M medium\n- Clean files: N\n\nIf NOTHING worth flagging:\n## \uD83E\uDD82 Chimera Review \u2014 all clear \u2705\nNo issues found in N changed files.";
|
|
2367
|
+
declare function createChimeraPlugin(): Plugin;
|
|
2368
|
+
|
|
2369
|
+
export { AddAttachmentInput, AgentPipelines, AttachmentRef, AttachmentStore, type AutoPhaseOptions, type AutoPhasePlanResult, AutoPhasePlanner, type AutoPhasePlannerOptions, AutoPhaseRunner, type AutoPhaseRunnerOptions, type BootConfigOptions, type BootConfigResult, BrainArbiter, BuildContext, CHIMERA_REVIEW_PROMPT, type Checkpoint, CheckpointManager, type CheckpointManagerOptions, type ChimeraReviewNeededPayload, type CollabBusState, type InjectedToolResult as CollabInjectedToolResult, type CollabPauseMiddlewareOptions, CollaborationBus, Config, ConfigStore, Container, ContentBlock, type ContentScore, Context, type ContinueDirective, DefaultLogger, DefaultPathResolver, DefaultPluginAPI, DefaultPromptStore, DefaultSecretVault, DefaultSystemPromptBuilder, type DefaultSystemPromptBuilderOptions, type DetectedDependency, type DetectionResult, type EliseResult, EventBus, EventName, ExtensionRegistry, type FileAuthorEntry, type FileAuthorLog, type FileAuthorTrackerOptions, type Finding, type FullScanResult, type GeneratedSecuritySkill, type GeneratedSkill, type GeneratedSkillContent, GitignoreUpdater, HealthRegistry, HookEvent, HookInput, HookMatcher, HookOutcome, HookRegistry, InProcessHook, InputBuilder, type InputBuilderEvent, type InputBuilderOptions, KERNEL_API_VERSION, LAYER_1_IDENTITY, Listener, type LoadPluginsOptions, Logger, MATRIX_PHASE_KEYS, type MCPRegistryHandle, MCPRegistryView, MCPServerConfig, Mailbox, type MailboxLoopOptions, MailboxMessage, type MatrixKeyKind, MemoryStore, Message, MetricsSink, MetricsSinkView, ModeStore, ModelCapabilities, ModelMatrixEntry, type PackageManager, PermissionPolicy, type PhaseEventMap, type PhaseEventName, type PhaseExecutionContext, type PhaseFilter, type PhaseGraph, PhaseGraphBuilder, type PhaseGraphBuilderOptions, type PhaseNode, PhaseOrchestrator, type PhaseOrchestratorOptions, type PhaseProgress, type PhaseSort, type PhaseStatus, PhaseStore, type PhaseStoreOptions, type PhaseTemplate, Plugin, PluginAPI, type PluginAPIInit, PluginPipelines, Provider, ProviderRegistry, ProviderRegistryView, ProviderRunner, Renderer, ReplayLogStore, type ReplayMode, ReplayProviderRunner, type ReplayProviderRunnerOptions, ReportGenerator, type ReportOptions, Request, type ResolvedChimeraConfig, Response, RunProviderOptions$1 as RunProviderOptions, type ScanOptions, type ScanResult, type ScanScope, type SecurityPattern, SecurityScanner, type SecurityScannerContext, type SecurityScannerOptions, SecurityScannerOrchestrator, SessionWriterView, type SeverityLevel, type ShellHookSpec, type SkillGenerationContext, SkillGenerator, type SkillGeneratorOptions, SkillLoader, SlashCommand, SlashCommandRegistry, SlashCommandRegistryView, SystemPromptBuilder, SystemPromptContributor, TaskGraph, TaskNode, TaskPriority, TaskStore, TaskType, type TechStack, type TechStackConsumerOptions, TechStackDetector, type TechStackInfo, TextBlock, Tool, ToolCallPipelinePayload, ToolRegistry, ToolRegistryView, Tracer, WorktreeManager, WstackPaths, attachMailboxChecker, bootConfig, buildBtwBlock, buildLosslessDigest, buildMailboxBlock, buildQueuedMessagesBlock, buildSmartDigest, collabInjectMiddleware, collabPauseMiddleware, compactLog, consumeBtwNotes, consumeQueuedMessagesUpdate, createAutoPhaseFromTaskGraph, createChimeraPlugin, createGitPlugin, createMailboxChecker, createMcpControlTool, createObservabilityPlugin, createPlanPlugin, createPromptsPlugin, createSecurityPlugin, createSecuritySlashCommand, createSkillsPlugin, createSyncPlugin, defaultGitignoreUpdater, defaultOrchestrator, defaultReportGenerator, defaultSecurityScanner, defaultSkillGenerator, defaultTechStackDetector, eliseOldToolResults, estimateMessageTokens, estimateMessages, extractText, findPreserveStart, flagsToConfigPatch, getFileHistory, getFilesByAgent, getFullLog, getLastAuthor, hasTextContent, hashRequest, injectPendingMailboxMessages, isValidMatrixKey, loadPlugins, makeContinueToNextIterationTool, matrixKeyKind, parseContinueDirective, peekQueuedMessages, pendingBtwCount, phaseForRole, recordFileAction, resolveChimeraConfig, resolveModelMatrix, runProviderWithRetry, runShellHook, scoreMessage, securitySlashCommand, setBtwNote, setQueuedMessagesSnapshot, stableStringify, startTechStackConsumer, unloadPlugins };
|