@wrongstack/core 0.7.0 → 0.7.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 (56) hide show
  1. package/dist/{agent-bridge-CrQpYjM7.d.ts → agent-bridge-hXRN-GO_.d.ts} +1 -1
  2. package/dist/{compactor-CWV1u-IU.d.ts → compactor-Mw7-rNyb.d.ts} +1 -1
  3. package/dist/{config-C34JRwl4.d.ts → config-Bi4Q0fnz.d.ts} +2 -2
  4. package/dist/{context-bmR0YgBm.d.ts → context-z2x5gv_V.d.ts} +5 -1
  5. package/dist/coordination/index.d.ts +42 -12
  6. package/dist/coordination/index.js +2522 -33
  7. package/dist/coordination/index.js.map +1 -1
  8. package/dist/defaults/index.d.ts +24 -24
  9. package/dist/defaults/index.js +2783 -228
  10. package/dist/defaults/index.js.map +1 -1
  11. package/dist/{events-CEKFTmIY.d.ts → events-D4pGukpI.d.ts} +26 -2
  12. package/dist/execution/index.d.ts +38 -15
  13. package/dist/execution/index.js +2406 -21
  14. package/dist/execution/index.js.map +1 -1
  15. package/dist/extension/index.d.ts +8 -8
  16. package/dist/{index-BJIFLGII.d.ts → index-BUHs7xJ9.d.ts} +8 -8
  17. package/dist/index.d.ts +40 -32
  18. package/dist/index.js +2813 -215
  19. package/dist/index.js.map +1 -1
  20. package/dist/infrastructure/index.d.ts +9 -9
  21. package/dist/infrastructure/index.js +12 -0
  22. package/dist/infrastructure/index.js.map +1 -1
  23. package/dist/kernel/index.d.ts +11 -11
  24. package/dist/kernel/index.js +12 -0
  25. package/dist/kernel/index.js.map +1 -1
  26. package/dist/{logger-BMQgxvdy.d.ts → logger-DDd5C--Z.d.ts} +1 -1
  27. package/dist/{logger-BH6AE0W9.d.ts → logger-bOzkF5LL.d.ts} +1 -1
  28. package/dist/{mcp-servers-BRJicm5o.d.ts → mcp-servers-n2L9ohMX.d.ts} +3 -3
  29. package/dist/models/index.d.ts +4 -4
  30. package/dist/{models-registry-Y2xbog0E.d.ts → models-registry-BcYJDKLm.d.ts} +1 -1
  31. package/dist/{models-registry-DqzwpBQy.d.ts → models-registry-OG_30xqZ.d.ts} +1 -1
  32. package/dist/{multi-agent-Cm1wYSrw.d.ts → multi-agent-7OK4pEKW.d.ts} +6 -3
  33. package/dist/{multi-agent-coordinator-CCupVFqv.d.ts → multi-agent-coordinator-D8PLzfz6.d.ts} +165 -4
  34. package/dist/{index-CZR0HjxM.d.ts → null-fleet-bus-Bkk3gafb.d.ts} +97 -6
  35. package/dist/observability/index.d.ts +2 -2
  36. package/dist/{path-resolver-CfT7e_HT.d.ts → path-resolver-DPUjF10O.d.ts} +3 -3
  37. package/dist/{plan-templates-Q78an-GJ.d.ts → plan-templates-DWbEIJvV.d.ts} +5 -5
  38. package/dist/{provider-runner-WDj28o7J.d.ts → provider-runner-iST8U3ni.d.ts} +4 -4
  39. package/dist/{retry-policy-Dpxp4SET.d.ts → retry-policy-OwtKNxo8.d.ts} +2 -2
  40. package/dist/sdd/index.d.ts +3 -3
  41. package/dist/{secret-scrubber-CowtdEF8.d.ts → secret-scrubber-DXkhwuka.d.ts} +1 -1
  42. package/dist/{secret-scrubber-C2YCYtkn.d.ts → secret-scrubber-nI8qjaqW.d.ts} +1 -1
  43. package/dist/security/index.d.ts +3 -3
  44. package/dist/{selector-CP39HhCe.d.ts → selector-DkvgYVS4.d.ts} +1 -1
  45. package/dist/{session-reader-Dwjn4WZR.d.ts → session-reader-DsadjyF9.d.ts} +1 -1
  46. package/dist/storage/index.d.ts +7 -7
  47. package/dist/storage/index.js +8 -4
  48. package/dist/storage/index.js.map +1 -1
  49. package/dist/{system-prompt-CfgXqyv2.d.ts → system-prompt-CWA6ml-d.d.ts} +2 -2
  50. package/dist/{tool-executor-D5NFi_LV.d.ts → tool-executor-Tutu4ePV.d.ts} +6 -5
  51. package/dist/types/index.d.ts +19 -19
  52. package/dist/types/index.js +29 -0
  53. package/dist/types/index.js.map +1 -1
  54. package/dist/utils/index.d.ts +2 -2
  55. package/dist/{wstack-paths-86YPFktR.d.ts → wstack-paths-BGu2INTm.d.ts} +1 -1
  56. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { T as TextBlock, b as ContentBlock, x as Tool } from './context-bmR0YgBm.js';
1
+ import { T as TextBlock, c as ContentBlock, Q as Tool } from './context-z2x5gv_V.js';
2
2
 
3
3
  /**
4
4
  * Container — dependency injection with explicit bind / override / decorate.
@@ -183,4 +183,4 @@ interface SystemPromptBuilder {
183
183
  build(ctx: BuildContext): Promise<TextBlock[]>;
184
184
  }
185
185
 
186
- export { type BuildContext as B, Container as C, type Decorator as D, type Factory as F, type ModelCapabilities as M, type NextFn as N, Pipeline as P, type Renderer as R, type SystemPromptBuilder as S, type Token as T, type BindOptions as a, type Middleware as b, type MiddlewareHandler as c, type PipelineOptions as d, type ReadonlyPipeline as e };
186
+ export { type BindOptions as B, Container as C, type Decorator as D, type Factory as F, type Middleware as M, type NextFn as N, Pipeline as P, type ReadonlyPipeline as R, type SystemPromptBuilder as S, type Token as T, type BuildContext as a, type MiddlewareHandler as b, type ModelCapabilities as c, type PipelineOptions as d, type Renderer as e };
@@ -1,8 +1,8 @@
1
- import { a5 as Context, j as ProviderError, x as Tool, K as ToolUseBlock, G as ToolResultBlock } from './context-bmR0YgBm.js';
2
- import { a as Compactor, C as CompactReport } from './compactor-CWV1u-IU.js';
3
- import { a as RecoveryDecision, E as ErrorHandler, R as RetryPolicy } from './retry-policy-Dpxp4SET.js';
4
- import { M as ModelsRegistry } from './models-registry-Y2xbog0E.js';
5
- import { l as ToolExecutorOptions, m as ToolExecutorStrategy, n as ToolBatchResult } from './index-BJIFLGII.js';
1
+ import { d as Context, n as ProviderError, Q as Tool, _ as ToolUseBlock, Y as ToolResultBlock } from './context-z2x5gv_V.js';
2
+ import { a as Compactor, C as CompactReport } from './compactor-Mw7-rNyb.js';
3
+ import { R as RecoveryDecision, E as ErrorHandler, a as RetryPolicy } from './retry-policy-OwtKNxo8.js';
4
+ import { b as ModelsRegistry } from './models-registry-BcYJDKLm.js';
5
+ import { x as ToolExecutorOptions, y as ToolExecutorStrategy, T as ToolBatchResult } from './index-BUHs7xJ9.js';
6
6
 
7
7
  interface CompactorOptions {
8
8
  preserveK?: number;
@@ -91,6 +91,7 @@ declare class ToolExecutor {
91
91
  private runWithTimeout;
92
92
  private runStreamedTool;
93
93
  private unknownToolResult;
94
+ private malformedInputResult;
94
95
  private deniedResult;
95
96
  private decrementBudget;
96
97
  /**
@@ -1,29 +1,29 @@
1
- export { A as AgentError, C as Capabilities, a as ConfigError, b as ContentBlock, E as ERROR_CODES, c as ErrorCode, d as ErrorSeverity, e as ErrorSubsystem, F as FileSnapshot, f as FsError, I as ImageBlock, J as JSONSchema, M as Message, g as MessageRole, P as Permission, h as PluginError, i as Provider, j as ProviderError, k as ProviderErrorBody, R as Request, l as Response, m as ResumedSession, n as RiskTier, S as SessionData, o as SessionError, p as SessionEvent, q as SessionMetadata, r as SessionStore, s as SessionSummary, t as SessionWriter, u as StopReason, v as StreamEvent, T as TextBlock, w as ThinkingBlock, x as Tool, y as ToolCallContext, z as ToolError, B as ToolFinalEvent, D as ToolProgressEvent, G as ToolResultBlock, H as ToolStreamEvent, K as ToolUseBlock, U as Usage, W as WrongStackError, L as asBlocks, N as asText, O as isAgentError, Q as isConfigError, V as isFsError, X as isImageBlock, Y as isPluginError, Z as isSessionError, _ as isTextBlock, $ as isThinkingBlock, a0 as isToolError, a1 as isToolResultBlock, a2 as isToolUseBlock, a3 as isWrongStackError, a4 as toWrongStackError } from '../context-bmR0YgBm.js';
2
- export { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-WDj28o7J.js';
3
- export { C as CONTEXT_WINDOW_MODES, a as Config, 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, M as MCPServerConfig, 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-C34JRwl4.js';
4
- export { C as CompactReport, a as Compactor } from '../compactor-CWV1u-IU.js';
5
- export { P as PermissionDecision, a as PermissionPolicy, T as TrustPolicy } from '../secret-scrubber-C2YCYtkn.js';
1
+ export { A as AgentError, a as Capabilities, b as ConfigError, c as ContentBlock, E as ERROR_CODES, g as ErrorCode, h as ErrorSeverity, i as ErrorSubsystem, F as FileSnapshot, j as FsError, I as ImageBlock, J as JSONSchema, M as Message, k as MessageRole, P as Permission, l as PluginError, m as Provider, n as ProviderError, o as ProviderErrorBody, p as Request, q as Response, r as ResumedSession, s as RiskTier, S as SessionData, v as SessionError, w as SessionEvent, x as SessionMetadata, y as SessionStore, z as SessionSummary, B as SessionWriter, H as StopReason, K as StreamEvent, T as TextBlock, L as ThinkingBlock, Q as Tool, U as ToolCallContext, V as ToolError, W as ToolFinalEvent, X as ToolProgressEvent, Y as ToolResultBlock, Z as ToolStreamEvent, _ as ToolUseBlock, $ as Usage, a0 as WrongStackError, a1 as asBlocks, a2 as asText, a4 as isAgentError, a5 as isConfigError, a6 as isFsError, a7 as isImageBlock, a8 as isPluginError, a9 as isSessionError, aa as isTextBlock, ab as isThinkingBlock, ac as isToolError, ad as isToolResultBlock, ae as isToolUseBlock, af as isWrongStackError, ag as toWrongStackError } from '../context-z2x5gv_V.js';
2
+ export { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-iST8U3ni.js';
3
+ export { C as CONTEXT_WINDOW_MODES, a as Config, 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, M as MCPServerConfig, 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-Bi4Q0fnz.js';
4
+ export { C as CompactReport, a as Compactor } from '../compactor-Mw7-rNyb.js';
5
+ export { P as PermissionDecision, a as PermissionPolicy, T as TrustPolicy } from '../secret-scrubber-nI8qjaqW.js';
6
6
  export { C as CheckpointInfo, R as RewindResult, a as RewindResultExtended, S as SessionRewinder } from '../session-rewinder-C9HnMkhP.js';
7
- export { A as AddAttachmentInput, a as Attachment, b as AttachmentKind, c as AttachmentMeta, d as AttachmentRef, e as AttachmentStore, D as DefaultSessionReader } from '../session-reader-Dwjn4WZR.js';
7
+ export { A as AddAttachmentInput, a as Attachment, b as AttachmentKind, c as AttachmentMeta, d as AttachmentRef, e as AttachmentStore, D as DefaultSessionReader } from '../session-reader-DsadjyF9.js';
8
8
  export { D as DEFAULT_CONTEXT_CONFIG, a as DEFAULT_TOOLS_CONFIG } from '../default-config-DvRSTELf.js';
9
- 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-CowtdEF8.js';
10
- export { D as DefaultLogger, a as DefaultLoggerOptions } from '../logger-BH6AE0W9.js';
11
- export { D as DefaultPathResolver, a as DefaultTokenCounter } from '../path-resolver-CfT7e_HT.js';
9
+ 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-DXkhwuka.js';
10
+ export { D as DefaultLogger, a as DefaultLoggerOptions } from '../logger-bOzkF5LL.js';
11
+ export { D as DefaultPathResolver, a as DefaultTokenCounter } from '../path-resolver-DPUjF10O.js';
12
12
  export { M as MemoryEntry, a as MemoryScope, b as MemoryStore } from '../memory-CEXuo7sz.js';
13
- 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-D5NFi_LV.js';
13
+ 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-Tutu4ePV.js';
14
14
  export { S as SkillEntry, a as SkillLoader, b as SkillManifest } from '../skill-CxuWrsKK.js';
15
- export { B as BuildContext, M as ModelCapabilities, R as Renderer, S as SystemPromptBuilder } from '../system-prompt-CfgXqyv2.js';
15
+ export { a as BuildContext, c as ModelCapabilities, e as Renderer, S as SystemPromptBuilder } from '../system-prompt-CWA6ml-d.js';
16
16
  export { I as InputReader, P as PromptOption } from '../input-reader-E-ffP2ee.js';
17
- export { M as MCPRegistryView, a as MetricsSinkView, P as Plugin, b as PluginAPI, c as PluginCapabilities, d as PluginDependency, e as PluginPipelines, f as ProviderFactory, g as ProviderRegistryView, S as SessionWriterView, h as SlashCommand, i as SlashCommandRegistryView, j as SystemPromptContributor, T as ToolRegistryView } from '../index-BJIFLGII.js';
18
- export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from '../models-registry-DqzwpBQy.js';
17
+ export { M as MCPRegistryView, j as MetricsSinkView, P as Plugin, k as PluginAPI, l as PluginCapabilities, m as PluginDependency, n as PluginPipelines, o as ProviderFactory, r as ProviderRegistryView, S as SessionWriterView, u as SlashCommand, v as SlashCommandRegistryView, w as SystemPromptContributor, C as ToolRegistryView } from '../index-BUHs7xJ9.js';
18
+ export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from '../models-registry-OG_30xqZ.js';
19
19
  export { D as DEFAULT_MODES, M as Mode, a as ModeConfig, b as ModeManifest, c as ModeStore } from '../mode-CV077NjV.js';
20
- export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-CrQpYjM7.js';
21
- export { C as CoordinatorEvents, a as CoordinatorStatus, D as DoneCondition, M as MultiAgentConfig, b as MultiAgentCoordinator, S as SpawnResult, 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-Cm1wYSrw.js';
20
+ export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-hXRN-GO_.js';
21
+ export { C as CoordinatorEvents, j as CoordinatorStatus, D as DoneCondition, M as MultiAgentConfig, k as MultiAgentCoordinator, S as SpawnResult, m as SubagentConfig, n as SubagentContext, o as SubagentError, p as SubagentErrorKind, q as SubagentRunContext, r as SubagentRunOutcome, s as SubagentRunner, T as TaskDelegation, t as TaskResult, u as TaskSpec } from '../multi-agent-7OK4pEKW.js';
22
22
  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-D1YQbpxF.js';
23
23
  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';
24
- import '../events-CEKFTmIY.js';
25
- import '../logger-BMQgxvdy.js';
26
- import '../retry-policy-Dpxp4SET.js';
27
- import '../models-registry-Y2xbog0E.js';
24
+ import '../events-D4pGukpI.js';
25
+ import '../logger-DDd5C--Z.js';
26
+ import '../retry-policy-OwtKNxo8.js';
27
+ import '../models-registry-BcYJDKLm.js';
28
28
  import '../secret-vault-DoISxaKO.js';
29
29
  import '../path-resolver-CPRj4bFY.js';
@@ -691,6 +691,7 @@ function formatCtx(ctx) {
691
691
  }
692
692
 
693
693
  // src/infrastructure/token-counter.ts
694
+ var PRICE_CACHE_MAX_SIZE = 100;
694
695
  var DefaultTokenCounter = class {
695
696
  input = 0;
696
697
  output = 0;
@@ -721,6 +722,10 @@ var DefaultTokenCounter = class {
721
722
  if (price) {
722
723
  this.applyPrice(usage, price);
723
724
  } else if (this.registry && this.providerId && model) {
725
+ if (this.priceCache.size >= PRICE_CACHE_MAX_SIZE) {
726
+ const keys = [...this.priceCache.keys()];
727
+ this.priceCache.delete(keys[0]);
728
+ }
724
729
  void this.registry.getModel(this.providerId, model).then((m) => {
725
730
  if (m) {
726
731
  const p = priceFromModel(m);
@@ -742,6 +747,10 @@ var DefaultTokenCounter = class {
742
747
  this.lastInput = usage.input;
743
748
  this.lastCacheRead = usage.cacheRead ?? 0;
744
749
  const price = priceFromModel(resolved);
750
+ if (this.priceCache.size >= PRICE_CACHE_MAX_SIZE) {
751
+ const keys = [...this.priceCache.keys()];
752
+ this.priceCache.delete(keys[0]);
753
+ }
745
754
  this.priceCache.set(resolved.modelId, price);
746
755
  this.applyPrice(usage, price);
747
756
  }
@@ -2200,6 +2209,11 @@ var ToolExecutor = class {
2200
2209
  budget = this.decrementBudget(result, budget);
2201
2210
  return { result, tool, durationMs: Date.now() - start };
2202
2211
  }
2212
+ if (hasMalformedArguments(use.input)) {
2213
+ const result = this.malformedInputResult(use);
2214
+ budget = this.decrementBudget(result, budget);
2215
+ return { result, tool, durationMs: Date.now() - start };
2216
+ }
2203
2217
  const decision = await this.opts.permissionPolicy.evaluate(tool, use.input, ctx);
2204
2218
  if (decision.permission === "deny") {
2205
2219
  const result = this.deniedResult(use, decision.reason);
@@ -2403,6 +2417,14 @@ var ToolExecutor = class {
2403
2417
  is_error: true
2404
2418
  };
2405
2419
  }
2420
+ malformedInputResult(use) {
2421
+ return {
2422
+ type: "tool_result",
2423
+ tool_use_id: use.id,
2424
+ content: `Tool "${use.name}" received arguments that were not a valid JSON object, so they could not be parsed. Re-issue the call with the arguments encoded as a single well-formed JSON object matching the tool's input schema.`,
2425
+ is_error: true
2426
+ };
2427
+ }
2406
2428
  deniedResult(use, reason) {
2407
2429
  return {
2408
2430
  type: "tool_result",
@@ -2448,6 +2470,13 @@ var ToolExecutor = class {
2448
2470
  return void 0;
2449
2471
  }
2450
2472
  };
2473
+ var MALFORMED_ARG_MARKERS = ["__raw", "__raw_arguments", "_raw"];
2474
+ function hasMalformedArguments(input) {
2475
+ if (!input || typeof input !== "object" || Array.isArray(input)) return false;
2476
+ const obj = input;
2477
+ const keys = Object.keys(obj);
2478
+ return keys.length === 1 && MALFORMED_ARG_MARKERS.includes(keys[0]);
2479
+ }
2451
2480
 
2452
2481
  // src/utils/regex-guard.ts
2453
2482
  var MAX_PATTERN_LEN = 512;