@wrongstack/core 0.6.1 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/{agent-bridge-DaCvA_uK.d.ts → agent-bridge-eb7qnNrd.d.ts} +1 -1
  2. package/dist/coordination/index.d.ts +5 -5
  3. package/dist/coordination/index.js +5 -33
  4. package/dist/coordination/index.js.map +1 -1
  5. package/dist/defaults/index.d.ts +8 -8
  6. package/dist/defaults/index.js +62 -39
  7. package/dist/defaults/index.js.map +1 -1
  8. package/dist/{events-CzkeaVVl.d.ts → events-BHuIHekD.d.ts} +19 -2
  9. package/dist/execution/index.d.ts +4 -4
  10. package/dist/execution/index.js +56 -5
  11. package/dist/execution/index.js.map +1 -1
  12. package/dist/extension/index.d.ts +2 -2
  13. package/dist/{index-BkKLQjea.d.ts → index-BOn9NK7D.d.ts} +1 -1
  14. package/dist/{index-i9rPR53g.d.ts → index-CPcDqvZh.d.ts} +4 -4
  15. package/dist/index.d.ts +11 -11
  16. package/dist/index.js +62 -39
  17. package/dist/index.js.map +1 -1
  18. package/dist/infrastructure/index.d.ts +2 -2
  19. package/dist/infrastructure/index.js +1 -1
  20. package/dist/infrastructure/index.js.map +1 -1
  21. package/dist/kernel/index.d.ts +2 -2
  22. package/dist/kernel/index.js.map +1 -1
  23. package/dist/{multi-agent-MfI6dmv-.d.ts → multi-agent-CxSb-9dQ.d.ts} +1 -1
  24. package/dist/observability/index.d.ts +1 -1
  25. package/dist/observability/index.js +1 -1
  26. package/dist/observability/index.js.map +1 -1
  27. package/dist/{path-resolver-CWINz5XR.d.ts → path-resolver-CMGNadvq.d.ts} +1 -1
  28. package/dist/{plan-templates-Bne1pB4d.d.ts → plan-templates-BJflQY2i.d.ts} +1 -1
  29. package/dist/{provider-runner-CZYIzeBp.d.ts → provider-runner-BFgNXpaP.d.ts} +1 -1
  30. package/dist/sdd/index.d.ts +2 -2
  31. package/dist/storage/index.d.ts +2 -2
  32. package/dist/{tool-executor-40Q6shR-.d.ts → tool-executor-FoxBjULX.d.ts} +1 -1
  33. package/dist/types/index.d.ts +7 -7
  34. package/dist/types/index.js +14 -3
  35. package/dist/types/index.js.map +1 -1
  36. package/dist/utils/index.js +1 -1
  37. package/dist/utils/index.js.map +1 -1
  38. package/package.json +1 -1
@@ -1,9 +1,9 @@
1
- export { A as AfterIterationHook, p as AfterRunHook, q as AfterToolExecutionHook, s as AgentExtension, B as BeforeIterationHook, w as BeforeRunHook, x as BeforeToolExecutionHook, E as ExtensionRegistry, O as OnErrorHook, G as ProviderRunnerFn, z as ProviderRunnerWrapper } from '../index-BkKLQjea.js';
1
+ export { A as AfterIterationHook, p as AfterRunHook, q as AfterToolExecutionHook, s as AgentExtension, B as BeforeIterationHook, w as BeforeRunHook, x as BeforeToolExecutionHook, E as ExtensionRegistry, O as OnErrorHook, G as ProviderRunnerFn, z as ProviderRunnerWrapper } from '../index-BOn9NK7D.js';
2
2
  import '../context-CDRyrkKQ.js';
3
3
  import '../logger-BMQgxvdy.js';
4
4
  import '../system-prompt-Dl2QY1_B.js';
5
5
  import '../observability-BhnVLBLS.js';
6
- import '../events-CzkeaVVl.js';
6
+ import '../events-BHuIHekD.js';
7
7
  import '../secret-scrubber-CfMdAJ_l.js';
8
8
  import '../config-BGGuP_Ar.js';
9
9
  import '../models-registry-Y2xbog0E.js';
@@ -2,7 +2,7 @@ import { v as Tool, B as ToolResultBlock, G as ToolUseBlock, a2 as Context, T as
2
2
  import { L as Logger } from './logger-BMQgxvdy.js';
3
3
  import { R as Renderer, B as BuildContext, C as Container, P as Pipeline, e as ReadonlyPipeline } from './system-prompt-Dl2QY1_B.js';
4
4
  import { T as Tracer } from './observability-BhnVLBLS.js';
5
- import { E as EventBus, a as EventName, L as Listener } from './events-CzkeaVVl.js';
5
+ import { E as EventBus, a as EventName, L as Listener } from './events-BHuIHekD.js';
6
6
  import { a as PermissionPolicy, S as SecretScrubber } from './secret-scrubber-CfMdAJ_l.js';
7
7
  import { l as ProviderConfig, a as Config } from './config-BGGuP_Ar.js';
8
8
  import { W as WireFamily } from './models-registry-Y2xbog0E.js';
@@ -1,10 +1,10 @@
1
1
  import { a as DirectorStateSnapshot } from './director-state-BmYi3DGA.js';
2
- import { c as SubagentConfig, j as TaskResult, a as CoordinatorStatus, k as TaskSpec, M as MultiAgentConfig, i as SubagentRunner, b as MultiAgentCoordinator, S as SpawnResult, l as BridgeMessage, A as AgentBridge } from './multi-agent-MfI6dmv-.js';
2
+ import { c as SubagentConfig, j as TaskResult, a as CoordinatorStatus, k as TaskSpec, M as MultiAgentConfig, i as SubagentRunner, b as MultiAgentCoordinator, S as SpawnResult, l as BridgeMessage, A as AgentBridge } from './multi-agent-CxSb-9dQ.js';
3
3
  import { r as SessionWriter, v as Tool, p as SessionStore } from './context-CDRyrkKQ.js';
4
- import { I as InMemoryAgentBridge } from './agent-bridge-DaCvA_uK.js';
5
- import { E as EventBus } from './events-CzkeaVVl.js';
4
+ import { I as InMemoryAgentBridge } from './agent-bridge-eb7qnNrd.js';
5
+ import { E as EventBus } from './events-BHuIHekD.js';
6
6
  import { EventEmitter } from 'node:events';
7
- import { r as Agent, u as AgentInput } from './index-BkKLQjea.js';
7
+ import { r as Agent, u as AgentInput } from './index-BOn9NK7D.js';
8
8
 
9
9
  /**
10
10
  * Interface for a fleet coordinator. Implemented by both `Director`
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { S as SystemPromptBuilder, M as ModelCapabilities, B as BuildContext, C as Container } from './system-prompt-Dl2QY1_B.js';
2
2
  export { a as BindOptions, D as Decorator, F as Factory, b as Middleware, c as MiddlewareHandler, N as NextFn, P as Pipeline, d as PipelineOptions, R as Renderer, T as Token } from './system-prompt-Dl2QY1_B.js';
3
- import { E as EventBus, a as EventName, L as Listener } from './events-CzkeaVVl.js';
4
- export { b as EventLogger, c as EventMap, S as ScopedEventBus } from './events-CzkeaVVl.js';
3
+ import { E as EventBus, a as EventName, L as Listener } from './events-BHuIHekD.js';
4
+ export { b as EventLogger, c as EventMap, S as ScopedEventBus } from './events-BHuIHekD.js';
5
5
  export { RunController, RunControllerOptions, TOKENS } from './kernel/index.js';
6
6
  import { a2 as Context, g as Provider, v as Tool, b as ContentBlock, T as TextBlock } from './context-CDRyrkKQ.js';
7
7
  export { A as AgentError, C as Capabilities, a as ConfigError, a7 as ContextInit, a6 as ConversationState, E as ErrorCode, c as ErrorSeverity, d as ErrorSubsystem, F as FileSnapshot, I as ImageBlock, J as JSONSchema, M as Message, e as MessageRole, P as Permission, f as PluginError, h as ProviderError, i as ProviderErrorBody, a8 as ReadonlyConversationState, R as Request, j as Response, k as ResumedSession, l as RiskTier, a9 as RunEnv, aa as RunOptions, S as SessionData, m as SessionError, n as SessionEvent, o as SessionMetadata, p as SessionStore, q as SessionSummary, r as SessionWriter, ab as StateChange, ac as StateChangeHandler, s as StopReason, t as StreamEvent, u as ThinkingBlock, a5 as TodoItem, a3 as TokenCounter, w as ToolCallContext, x as ToolError, y as ToolFinalEvent, z as ToolProgressEvent, B as ToolResultBlock, D as ToolStreamEvent, G as ToolUseBlock, U as Usage, W as WrongStackError, H as asBlocks, K as asText, ad as extractRunEnv, L as isAgentError, N as isConfigError, O as isImageBlock, Q as isPluginError, V as isSessionError, X as isTextBlock, Y as isThinkingBlock, Z as isToolError, _ as isToolResultBlock, $ as isToolUseBlock, a0 as isWrongStackError, a1 as toWrongStackError, ae as wrapAsState } from './context-CDRyrkKQ.js';
8
- export { P as ProviderRunner, R as RunProviderOptions } from './provider-runner-CZYIzeBp.js';
8
+ export { P as ProviderRunner, R as RunProviderOptions } from './provider-runner-BFgNXpaP.js';
9
9
  import { M as MCPServerConfig, a as Config } from './config-BGGuP_Ar.js';
10
10
  export { C as CONTEXT_WINDOW_MODES, b as ConfigLoader, c as ConfigStore, d as ContextConfig, e as ContextWindowAggressiveOn, f as ContextWindowConfigLike, g as ContextWindowMode, h as ContextWindowModeId, i as ContextWindowPolicy, j as ContextWindowThresholds, D as DEFAULT_CONTEXT_WINDOW_MODE_ID, F as FeaturesConfig, L as LogConfig, P as PluginConfig, k as ProviderApiKey, l as ProviderConfig, T as ToolsConfig, m as formatContextWindowModeList, n as getContextWindowMode, o as isContextWindowModeId, p as listContextWindowModes, r as resolveContextWindowPolicy } from './config-BGGuP_Ar.js';
11
11
  export { C as CompactReport, a as Compactor } from './compactor-RIPuTtWK.js';
@@ -15,30 +15,30 @@ import { e as AttachmentStore, d as AttachmentRef, A as AddAttachmentInput } fro
15
15
  export { a as Attachment, b as AttachmentKind, c as AttachmentMeta, D as DefaultSessionReader } from './session-reader-CzfRA6Vk.js';
16
16
  export { D as DefaultSecretScrubber, a as DefaultSecretVault, S as SecretVaultOptions, d as decryptConfigSecrets, e as encryptConfigSecrets, m as migratePlaintextSecrets, r as rewriteConfigEncrypted } from './secret-scrubber-BzQR5BiL.js';
17
17
  export { D as DefaultLogger, a as DefaultLoggerOptions } from './logger-BH6AE0W9.js';
18
- export { D as DefaultPathResolver, a as DefaultTokenCounter } from './path-resolver-CWINz5XR.js';
18
+ export { D as DefaultPathResolver, a as DefaultTokenCounter } from './path-resolver-CMGNadvq.js';
19
19
  import { b as MemoryStore } from './memory-CEXuo7sz.js';
20
20
  export { M as MemoryEntry, a as MemoryScope } from './memory-CEXuo7sz.js';
21
- export { C as CompactorOptions, D as DEFAULT_RECOVERY_STRATEGIES, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, R as RecoveryStrategy, T as ToolExecutor, c as buildRecoveryStrategies } from './tool-executor-40Q6shR-.js';
21
+ export { C as CompactorOptions, D as DEFAULT_RECOVERY_STRATEGIES, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, R as RecoveryStrategy, T as ToolExecutor, c as buildRecoveryStrategies } from './tool-executor-FoxBjULX.js';
22
22
  import { a as SkillLoader } from './skill-CxuWrsKK.js';
23
23
  export { S as SkillEntry, b as SkillManifest } from './skill-CxuWrsKK.js';
24
24
  export { I as InputReader, P as PromptOption } from './input-reader-E-ffP2ee.js';
25
- import { h as SlashCommand, j as SystemPromptContributor, b as PluginAPI, e as PluginPipelines, T as ToolRegistryView, g as ProviderRegistryView, M as MCPRegistryView, i as SlashCommandRegistryView, E as ExtensionRegistry, S as SessionWriterView, a as MetricsSinkView, n as ToolRegistry, o as ProviderRegistry, P as Plugin } from './index-BkKLQjea.js';
26
- export { A as AfterIterationHook, p as AfterRunHook, q as AfterToolExecutionHook, r as Agent, s as AgentExtension, t as AgentInit, u as AgentInput, v as AgentPipelines, B as BeforeIterationHook, w as BeforeRunHook, x as BeforeToolExecutionHook, D as DEFAULT_MAX_ITERATIONS, O as OnErrorHook, c as PluginCapabilities, d as PluginDependency, y as ProviderFactory, z as ProviderRunnerWrapper, R as RunResult, C as ToolWrapper, U as UserInputPayload, F as createDefaultPipelines } from './index-BkKLQjea.js';
25
+ import { h as SlashCommand, j as SystemPromptContributor, b as PluginAPI, e as PluginPipelines, T as ToolRegistryView, g as ProviderRegistryView, M as MCPRegistryView, i as SlashCommandRegistryView, E as ExtensionRegistry, S as SessionWriterView, a as MetricsSinkView, n as ToolRegistry, o as ProviderRegistry, P as Plugin } from './index-BOn9NK7D.js';
26
+ export { A as AfterIterationHook, p as AfterRunHook, q as AfterToolExecutionHook, r as Agent, s as AgentExtension, t as AgentInit, u as AgentInput, v as AgentPipelines, B as BeforeIterationHook, w as BeforeRunHook, x as BeforeToolExecutionHook, D as DEFAULT_MAX_ITERATIONS, O as OnErrorHook, c as PluginCapabilities, d as PluginDependency, y as ProviderFactory, z as ProviderRunnerWrapper, R as RunResult, C as ToolWrapper, U as UserInputPayload, F as createDefaultPipelines } from './index-BOn9NK7D.js';
27
27
  export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from './models-registry-DqzwpBQy.js';
28
28
  import { c as ModeStore } from './mode-CV077NjV.js';
29
29
  export { D as DEFAULT_MODES, M as Mode, a as ModeConfig, b as ModeManifest } from './mode-CV077NjV.js';
30
- export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from './agent-bridge-DaCvA_uK.js';
31
- export { n as BudgetExceededError, o as BudgetKind, p as BudgetLimits, q as BudgetUsage, C as CoordinatorEvents, a as CoordinatorStatus, D as DoneCondition, M as MultiAgentConfig, b as MultiAgentCoordinator, S as SpawnResult, r as SubagentBudget, c as SubagentConfig, d as SubagentContext, e as SubagentError, f as SubagentErrorKind, g as SubagentRunContext, h as SubagentRunOutcome, i as SubagentRunner, T as TaskDelegation, j as TaskResult, k as TaskSpec } from './multi-agent-MfI6dmv-.js';
30
+ export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from './agent-bridge-eb7qnNrd.js';
31
+ export { n as BudgetExceededError, o as BudgetKind, p as BudgetLimits, q as BudgetUsage, C as CoordinatorEvents, a as CoordinatorStatus, D as DoneCondition, M as MultiAgentConfig, b as MultiAgentCoordinator, S as SpawnResult, r as SubagentBudget, c as SubagentConfig, d as SubagentContext, e as SubagentError, f as SubagentErrorKind, g as SubagentRunContext, h as SubagentRunOutcome, i as SubagentRunner, T as TaskDelegation, j as TaskResult, k as TaskSpec } from './multi-agent-CxSb-9dQ.js';
32
32
  export { C as CriticalPathResult, 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, T as TaskAssignment, i as TaskDependency, j as TaskEdge, k as TaskFilter, l as TaskGraph, m as TaskNode, n as TaskPriority, o as TaskProgress, p as TaskSort, q as TaskStatus, r as TaskType, s as computeTaskProgress, t as findCriticalPath, u as topologicalSort } from './task-graph-BITvWt4t.js';
33
33
  export { A as AggregateHealth, H as HealthCheck, a as HealthCheckResult, b as HealthRegistry, c as HealthStatus, M as MetricLabels, d as MetricSeries, e as MetricsSink, f as MetricsSnapshot, S as Span, T as Tracer } from './observability-BhnVLBLS.js';
34
34
  export { AtomicWriteOptions, BuildChildEnvOptions, CompileFail, CompileResult, MessageRepairReport, MessageRepairResult, NewlineStyle, RequestTokenBreakdown, SafeParseResult, ToolOutputSerializerOptions, UnifiedDiffOptions, ValidationError, ValidationResult, atomicWrite, buildChildEnv, color, compileGlob, compileUserRegex, createToolOutputSerializer, detectNewlineStyle, ensureDir, estimateRequestTokens, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, formatTodosList, matchAny, matchGlob, normalizeToLf, repairToolUseAdjacency, safeParse, safeStringify, sanitizeJsonString, stripAnsi, toStyle, unifiedDiff, validateAgainstSchema } from './utils/index.js';
35
35
  export { a as WstackPathOptions, W as WstackPaths, p as projectHash, r as resolveWstackPaths } from './wstack-paths-86YPFktR.js';
36
- 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, M as MemoryStoreOptions, j as MigrationContext, k as MigrationResult, P as PersistedQueueItem, l as PlanFile, m as PlanItem, n as PlanTemplate, Q as QueueStore, R as RecoveryLock, o as RecoveryLockOptions, S as SessionAnalyzer, p as SessionStoreOptions, T as TodosCheckpointFile, q as addPlanItem, r as attachPlanCheckpoint, s as attachTodosCheckpoint, t as clearPlan, u as deriveTodosFromPlanItem, v as emptyPlan, w as formatPlan, x as formatPlanTemplates, y as getPlanTemplate, z as listPlanTemplates, B as loadPlan, E as loadTodosCheckpoint, F as removePlanItem, G as runConfigMigrations, H as savePlan, I as saveTodosCheckpoint, J as setPlanItemStatus } from './plan-templates-Bne1pB4d.js';
36
+ 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, M as MemoryStoreOptions, j as MigrationContext, k as MigrationResult, P as PersistedQueueItem, l as PlanFile, m as PlanItem, n as PlanTemplate, Q as QueueStore, R as RecoveryLock, o as RecoveryLockOptions, S as SessionAnalyzer, p as SessionStoreOptions, T as TodosCheckpointFile, q as addPlanItem, r as attachPlanCheckpoint, s as attachTodosCheckpoint, t as clearPlan, u as deriveTodosFromPlanItem, v as emptyPlan, w as formatPlan, x as formatPlanTemplates, y as getPlanTemplate, z as listPlanTemplates, B as loadPlan, E as loadTodosCheckpoint, F as removePlanItem, G as runConfigMigrations, H as savePlan, I as saveTodosCheckpoint, J as setPlanItemStatus } from './plan-templates-BJflQY2i.js';
37
37
  export { D as DirectorStateCheckpoint, a as DirectorStateSnapshot, b as DirectorSubagentState, c as DirectorTaskState, l as loadDirectorState } from './director-state-BmYi3DGA.js';
38
38
  export { AutoApprovePermissionPolicy, DefaultPermissionPolicy, PermissionPolicyOptions } from './security/index.js';
39
39
  export { AutoCompactionMiddleware, AutonomousRunner, AutonomousRunnerOptions, AutonomyPromptContributorOptions, DefaultSkillLoader, DoneCheckResult, DoneConditionChecker, EternalAutonomyEngine, EternalAutonomyOptions, EternalEngineState, IntelligentCompactor, IntelligentCompactorOptions, SelectiveCompactor, SelectiveCompactorOptions, SkillLoaderOptions, buildGoalPreamble, makeAutonomyPromptContributor } from './execution/index.js';
40
40
  export { DefaultProviderRunner } from './defaults/index.js';
41
- export { A as ALL_FLEET_AGENTS, a as AUDIT_LOG_AGENT, b as AgentFactory, c as AgentFactoryResult, d as AgentRunnerOptions, B as BUG_HUNTER_AGENT, C as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, e as DEFAULT_SUBAGENT_BASELINE, f as DefaultMultiAgentCoordinator, g as DelegateHost, h as Director, i as DirectorPromptParts, j as DirectorSessionFactory, k as DirectorSessionFactoryOptions, F as FLEET_ROSTER, l as FLEET_ROSTER_BUDGETS, m as FleetBus, n as FleetEvent, o as FleetHandler, p as FleetManager, q as FleetManagerOptions, r as FleetSpawnBudgetError, s as FleetUsage, t as FleetUsageAggregator, I as ICoordinator, u as IFleetManager, M as MultiAgentCoordinatorOptions, N as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, S as SECURITY_SCANNER_AGENT, v as SubagentPromptParts, w as SubagentUsageSnapshot, x as applyRosterBudget, y as composeDirectorPrompt, z as composeSubagentPrompt, E as createDelegateTool, G as makeAgentSubagentRunner, H as makeDirectorSessionFactory, J as rosterSummaryFromConfigs } from './index-i9rPR53g.js';
41
+ export { A as ALL_FLEET_AGENTS, a as AUDIT_LOG_AGENT, b as AgentFactory, c as AgentFactoryResult, d as AgentRunnerOptions, B as BUG_HUNTER_AGENT, C as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, e as DEFAULT_SUBAGENT_BASELINE, f as DefaultMultiAgentCoordinator, g as DelegateHost, h as Director, i as DirectorPromptParts, j as DirectorSessionFactory, k as DirectorSessionFactoryOptions, F as FLEET_ROSTER, l as FLEET_ROSTER_BUDGETS, m as FleetBus, n as FleetEvent, o as FleetHandler, p as FleetManager, q as FleetManagerOptions, r as FleetSpawnBudgetError, s as FleetUsage, t as FleetUsageAggregator, I as ICoordinator, u as IFleetManager, M as MultiAgentCoordinatorOptions, N as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, S as SECURITY_SCANNER_AGENT, v as SubagentPromptParts, w as SubagentUsageSnapshot, x as applyRosterBudget, y as composeDirectorPrompt, z as composeSubagentPrompt, E as createDelegateTool, G as makeAgentSubagentRunner, H as makeDirectorSessionFactory, J as rosterSummaryFromConfigs } from './index-CPcDqvZh.js';
42
42
  export { DefaultModeStore, LLMSelector, LLMSelectorOptions, ModeLoaderOptions, loadProjectModes, loadUserModes } from './models/index.js';
43
43
  export { AISpecBuilder, AISpecBuilderOptions, AISpecPhase, AISpecSession, AutoExecutor, AutoExecutorOptions, BottleneckTask, CollectedAnswer, CriticalPathAnalysis, DefaultTaskStore, ExecutionSummary, GeneratedTask, SPEC_TEMPLATES, SpecDiff, SpecDrivenDev, SpecDrivenDevOptions, SpecIndexEntry, SpecParser, SpecStore, SpecStoreOptions, SpecVersion, SpecVersioning, TaskExecutionContext, TaskExecutionResult, TaskFlow, TaskFlowEventMap, TaskFlowEventName, TaskFlowExecutionContext, TaskFlowOptions, TaskFlowPhase, TaskGenerator, TaskGeneratorOptions, TaskGraphIndexEntry, TaskGraphStore, TaskGraphStoreOptions, TaskStore, TaskTracker, TaskTrackerOptions, TaskTransition, analyzeCriticalPath, createAutoExecutor, getTemplate, listTemplates, renderProgress, renderSpecAnalysis, renderTaskGraph, renderTaskList, templateToMarkdown } from './sdd/index.js';
44
44
  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';
package/dist/index.js CHANGED
@@ -1347,7 +1347,7 @@ function round4(n) {
1347
1347
  }
1348
1348
 
1349
1349
  // src/utils/token-estimate.ts
1350
- var RoughTokenEstimate = (text) => Math.max(1, Math.ceil(text.length / 4));
1350
+ var RoughTokenEstimate = (text, charsPerToken = 3.5) => Math.max(1, Math.ceil(text.length / charsPerToken));
1351
1351
  var ESTIMATE_CACHE = /* @__PURE__ */ new Map();
1352
1352
  var ESTIMATE_CACHE_MAX_SIZE = 1e4;
1353
1353
  function getCachedEstimate(key, compute) {
@@ -1526,7 +1526,7 @@ var HybridCompactor = class {
1526
1526
  eliseThreshold;
1527
1527
  estimator;
1528
1528
  constructor(opts = {}) {
1529
- this.preserveK = opts.preserveK ?? 10;
1529
+ this.preserveK = opts.preserveK ?? 5;
1530
1530
  this.eliseThreshold = opts.eliseThreshold ?? 2e3;
1531
1531
  this.estimator = opts.estimator ?? estimateTextTokens;
1532
1532
  }
@@ -1570,6 +1570,17 @@ var HybridCompactor = class {
1570
1570
  preserveStart = i;
1571
1571
  }
1572
1572
  }
1573
+ for (let i = preserveStart; i < messages.length; i++) {
1574
+ const m = messages[i];
1575
+ if (!m || typeof m.content === "string" || !Array.isArray(m.content)) continue;
1576
+ const hasToolUse2 = m.content.some((b) => b.type === "tool_use");
1577
+ if (hasToolUse2 && i + 1 < messages.length) {
1578
+ const next = messages[i + 1];
1579
+ if (next && next.role === "user" && typeof next.content !== "string" && Array.isArray(next.content) && next.content.some((b) => b.type === "tool_result")) {
1580
+ preserveStart = i + 1;
1581
+ }
1582
+ }
1583
+ }
1573
1584
  let saved = 0;
1574
1585
  let changed = false;
1575
1586
  const nextMessages = new Array(messages.length);
@@ -1591,7 +1602,7 @@ var HybridCompactor = class {
1591
1602
  const elided = {
1592
1603
  type: "tool_result",
1593
1604
  tool_use_id: b.tool_use_id,
1594
- content: `[elided: ~${tokens} tokens removed. Call the tool again if needed.]`,
1605
+ content: `[elided: ~${tokens} tokens]`,
1595
1606
  is_error: b.is_error
1596
1607
  };
1597
1608
  return elided;
@@ -6496,7 +6507,28 @@ var IntelligentCompactor = class {
6496
6507
  try {
6497
6508
  summaryText = await this.callSummarizer(toSummarize, ctx);
6498
6509
  } catch {
6499
- summaryText = `[${toSummarize.length} earlier turns omitted \u2014 key decisions and file states preserved in context]`;
6510
+ const toolNames = /* @__PURE__ */ new Set();
6511
+ const filePaths = /* @__PURE__ */ new Set();
6512
+ let userTurns = 0, assistantTurns = 0;
6513
+ for (const m of toSummarize) {
6514
+ if (m.role === "user") userTurns++;
6515
+ else if (m.role === "assistant") {
6516
+ assistantTurns++;
6517
+ if (Array.isArray(m.content)) {
6518
+ for (const b of m.content) {
6519
+ if (b.type === "tool_use") toolNames.add(b.name ?? "unknown");
6520
+ }
6521
+ }
6522
+ }
6523
+ const text = typeof m.content === "string" ? m.content : "";
6524
+ const matches = text.matchAll(/(?:[\w.,\-/@]+\/)*[\w.,\-/@]+\.\w+/g);
6525
+ for (const m_ of matches) filePaths.add(m_[0]);
6526
+ }
6527
+ const parts = [`${toSummarize.length} turns (${userTurns} user, ${assistantTurns} assistant)`];
6528
+ if (toolNames.size > 0) parts.push(`tools: ${[...toolNames].join(", ")}`);
6529
+ if (filePaths.size > 0) parts.push(`files: ${[...filePaths].slice(0, 10).join(", ")}`);
6530
+ summaryText = parts.join(" | ");
6531
+ if (!summaryText) summaryText = `${toSummarize.length} earlier turns omitted`;
6500
6532
  }
6501
6533
  const summaryMsg = {
6502
6534
  role: "system",
@@ -6580,6 +6612,17 @@ var IntelligentCompactor = class {
6580
6612
  preserveStart = i;
6581
6613
  }
6582
6614
  }
6615
+ for (let i = preserveStart; i < messages.length; i++) {
6616
+ const m = messages[i];
6617
+ if (!m || typeof m.content === "string" || !Array.isArray(m.content)) continue;
6618
+ const hasToolUse2 = m.content.some((b) => b.type === "tool_use");
6619
+ if (hasToolUse2 && i + 1 < messages.length) {
6620
+ const next = messages[i + 1];
6621
+ if (next && next.role === "user" && typeof next.content !== "string" && Array.isArray(next.content) && next.content.some((b) => b.type === "tool_result")) {
6622
+ preserveStart = i + 1;
6623
+ }
6624
+ }
6625
+ }
6583
6626
  let saved = 0;
6584
6627
  let changed = false;
6585
6628
  const nextMessages = new Array(messages.length);
@@ -7094,7 +7137,15 @@ var AutoCompactionMiddleware = class {
7094
7137
  }
7095
7138
  async compact(ctx, aggressive, pressure) {
7096
7139
  try {
7097
- await this.compactor.compact(ctx, { aggressive });
7140
+ const report = await this.compactor.compact(ctx, { aggressive });
7141
+ this.events?.emit("compaction.fired", {
7142
+ level: pressure.level,
7143
+ tokens: pressure.tokens,
7144
+ load: pressure.load,
7145
+ maxContext: this._maxContext,
7146
+ report,
7147
+ aggressive
7148
+ });
7098
7149
  } catch (err) {
7099
7150
  const error = err instanceof Error ? err : new Error(String(err));
7100
7151
  const fatal = this.failureMode === "throw" || this.failureMode === "throw_on_hard" && pressure.level === "hard";
@@ -8161,40 +8212,12 @@ var FleetBus = class {
8161
8212
  * subagent teardown so the listeners don't outlive the run.
8162
8213
  */
8163
8214
  attach(subagentId, bus, taskId) {
8164
- const FORWARDED_TYPES = [
8165
- "tool.started",
8166
- "tool.executed",
8167
- "tool.progress",
8168
- "tool.confirm_needed",
8169
- "iteration.started",
8170
- "iteration.completed",
8171
- "provider.text_delta",
8172
- // Subagent extended-thinking output. Forwarded so the FleetPanel /
8173
- // /fleet log can surface "the planner is thinking…" instead of a
8174
- // silent gap between iteration.started and the first text_delta.
8175
- "provider.thinking_delta",
8176
- "provider.response",
8177
- "provider.retry",
8178
- "provider.error",
8179
- "session.started",
8180
- "session.ended",
8181
- "session.damaged",
8182
- "compaction.fired",
8183
- "compaction.failed",
8184
- "token.threshold",
8185
- // Subagent hit a soft budget limit — coordinator can extend or stop.
8186
- "budget.threshold_reached"
8187
- ];
8188
- const offs = [];
8189
- for (const t2 of FORWARDED_TYPES) {
8190
- offs.push(
8191
- bus.on(t2, (payload) => {
8192
- this.emit({ subagentId, taskId, ts: Date.now(), type: t2, payload });
8193
- })
8194
- );
8195
- }
8215
+ const off = bus.onPattern("*", (type, payload) => {
8216
+ if (type.startsWith("subagent.")) return;
8217
+ this.emit({ subagentId, taskId, ts: Date.now(), type, payload });
8218
+ });
8196
8219
  return () => {
8197
- for (const off of offs) off();
8220
+ off();
8198
8221
  };
8199
8222
  }
8200
8223
  /** Subscribe to every event from one subagent. */
@@ -13385,7 +13408,7 @@ function wireMetricsToEvents(events, sink) {
13385
13408
  events.on("token.threshold", (e) => sink.gauge("agent.tokens.used", e.used)),
13386
13409
  events.on("compaction.fired", (e) => {
13387
13410
  sink.counter("compaction.fired.total");
13388
- sink.histogram("compaction.reduction_tokens", e.before - e.after);
13411
+ sink.histogram("compaction.reduction_tokens", e.report.before - e.report.after);
13389
13412
  }),
13390
13413
  events.on(
13391
13414
  "mcp.server.connected",