@wrongstack/core 0.3.3 → 0.3.7

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 (52) hide show
  1. package/dist/{agent-bridge-C3DUGjSb.d.ts → agent-bridge-DaOnnHNW.d.ts} +1 -1
  2. package/dist/{compactor-DpJBI1YH.d.ts → compactor-CFky6JKM.d.ts} +1 -1
  3. package/dist/{config-D2qvAxVd.d.ts → config-RlhKLjme.d.ts} +2 -1
  4. package/dist/{context-IovtuTf8.d.ts → context-B1kBj1lY.d.ts} +4 -3
  5. package/dist/coordination/index.d.ts +12 -10
  6. package/dist/coordination/index.js +50 -9
  7. package/dist/coordination/index.js.map +1 -1
  8. package/dist/defaults/index.d.ts +16 -16
  9. package/dist/defaults/index.js +213 -17
  10. package/dist/defaults/index.js.map +1 -1
  11. package/dist/{events-BHIQs4o1.d.ts → events-BBaKeMfb.d.ts} +11 -1
  12. package/dist/execution/index.d.ts +11 -11
  13. package/dist/execution/index.js +54 -1
  14. package/dist/execution/index.js.map +1 -1
  15. package/dist/extension/index.d.ts +6 -6
  16. package/dist/{index-hWNybrNZ.d.ts → index-meJRuQtc.d.ts} +26 -5
  17. package/dist/index.d.ts +26 -26
  18. package/dist/index.js +306 -39
  19. package/dist/index.js.map +1 -1
  20. package/dist/infrastructure/index.d.ts +6 -6
  21. package/dist/kernel/index.d.ts +9 -9
  22. package/dist/kernel/index.js.map +1 -1
  23. package/dist/{mcp-servers-C2OopXOn.d.ts → mcp-servers-Cf4-bJnd.d.ts} +3 -3
  24. package/dist/models/index.d.ts +2 -2
  25. package/dist/models/index.js +1 -0
  26. package/dist/models/index.js.map +1 -1
  27. package/dist/{multi-agent-B9a6sflH.d.ts → multi-agent-D5m66hzB.d.ts} +1 -1
  28. package/dist/observability/index.d.ts +2 -2
  29. package/dist/{path-resolver--59rCou3.d.ts → path-resolver-Bg4OP5fi.d.ts} +2 -2
  30. package/dist/{provider-runner-B39miKRw.d.ts → provider-runner-CU9gnU2E.d.ts} +3 -3
  31. package/dist/sdd/index.d.ts +3 -3
  32. package/dist/secret-scrubber-DyUAWS09.d.ts +54 -0
  33. package/dist/{secret-scrubber-Cuy5afaQ.d.ts → secret-scrubber-Dyh5LVYL.d.ts} +1 -1
  34. package/dist/security/index.d.ts +58 -5
  35. package/dist/security/index.js +95 -6
  36. package/dist/security/index.js.map +1 -1
  37. package/dist/{selector-wT2fv9Fg.d.ts → selector-DBEiwXBk.d.ts} +1 -1
  38. package/dist/{session-reader-CcPi4BQ8.d.ts → session-reader-D-z0AgHs.d.ts} +1 -1
  39. package/dist/{skill-C_7znCIC.d.ts → skill-DayhFUBb.d.ts} +1 -1
  40. package/dist/storage/index.d.ts +5 -5
  41. package/dist/storage/index.js +53 -1
  42. package/dist/storage/index.js.map +1 -1
  43. package/dist/{system-prompt-Dk1qm8ey.d.ts → system-prompt-DNetCecu.d.ts} +1 -1
  44. package/dist/{tool-executor-HsBLGRaA.d.ts → tool-executor-B5bgmEgE.d.ts} +12 -5
  45. package/dist/types/index.d.ts +15 -15
  46. package/dist/types/index.js +59 -2
  47. package/dist/types/index.js.map +1 -1
  48. package/dist/utils/index.d.ts +23 -2
  49. package/dist/utils/index.js +41 -1
  50. package/dist/utils/index.js.map +1 -1
  51. package/package.json +1 -1
  52. package/dist/secret-scrubber-CgG2tV2B.d.ts +0 -31
@@ -1,4 +1,4 @@
1
- import { T as TextBlock, b as ContentBlock, u as Tool } from './context-IovtuTf8.js';
1
+ import { T as TextBlock, b as ContentBlock, u as Tool } from './context-B1kBj1lY.js';
2
2
 
3
3
  /**
4
4
  * Container — dependency injection with explicit bind / override / decorate.
@@ -1,8 +1,8 @@
1
- import { a0 as Context, h as ProviderError, u as Tool, D as ToolUseBlock, z as ToolResultBlock } from './context-IovtuTf8.js';
2
- import { a as Compactor, C as CompactReport } from './compactor-DpJBI1YH.js';
3
- import { c as RecoveryDecision, E as ErrorHandler, R as RetryPolicy } from './skill-C_7znCIC.js';
1
+ import { a0 as Context, h as ProviderError, u as Tool, D as ToolUseBlock, z as ToolResultBlock } from './context-B1kBj1lY.js';
2
+ import { a as Compactor, C as CompactReport } from './compactor-CFky6JKM.js';
3
+ import { c as RecoveryDecision, E as ErrorHandler, R as RetryPolicy } from './skill-DayhFUBb.js';
4
4
  import { M as ModelsRegistry } from './models-registry-Y2xbog0E.js';
5
- import { k as ToolExecutorOptions, l as ToolExecutorStrategy, m as ToolBatchResult } from './index-hWNybrNZ.js';
5
+ import { k as ToolExecutorOptions, l as ToolExecutorStrategy, m as ToolBatchResult } from './index-meJRuQtc.js';
6
6
 
7
7
  interface CompactorOptions {
8
8
  preserveK?: number;
@@ -62,13 +62,20 @@ declare class DefaultRetryPolicy implements RetryPolicy {
62
62
 
63
63
  declare class ToolExecutor {
64
64
  private readonly registry;
65
- private readonly opts;
65
+ private opts;
66
66
  private readonly serializer;
67
67
  private readonly iterationTimeoutMs;
68
68
  constructor(registry: {
69
69
  get(name: string): Tool | undefined;
70
70
  list(): Tool[];
71
71
  }, opts: ToolExecutorOptions);
72
+ /**
73
+ * Clear the interactive confirm awaiter so the executor returns
74
+ * `ToolConfirmPendingResult` instead of blocking on stdin. Used by
75
+ * the CLI to switch from inline prompts (REPL) to event-driven
76
+ * confirmation (TUI) at runtime.
77
+ */
78
+ clearConfirmAwaiter(): void;
72
79
  /**
73
80
  * Execute a batch of tool uses using the configured strategy.
74
81
  * Returns the execution results and the remaining output budget.
@@ -1,25 +1,25 @@
1
- export { A as AgentError, C as Capabilities, a as ConfigError, b as ContentBlock, E as ErrorCode, c as ErrorSeverity, d as ErrorSubsystem, I as ImageBlock, J as JSONSchema, M as Message, e as MessageRole, P as Permission, f as PluginError, g as Provider, h as ProviderError, i as ProviderErrorBody, R as Request, j as Response, k as ResumedSession, S as SessionData, l as SessionError, m as SessionEvent, n as SessionMetadata, o as SessionStore, p as SessionSummary, q as SessionWriter, r as StopReason, s as StreamEvent, T as TextBlock, t as ThinkingBlock, u as Tool, v as ToolCallContext, w as ToolError, x as ToolFinalEvent, y as ToolProgressEvent, z as ToolResultBlock, B as ToolStreamEvent, D as ToolUseBlock, U as Usage, W as WrongStackError, F as asBlocks, G as asText, H as isAgentError, K as isConfigError, L as isImageBlock, N as isPluginError, O as isSessionError, Q as isTextBlock, V as isThinkingBlock, X as isToolError, Y as isToolResultBlock, Z as isToolUseBlock, _ as isWrongStackError, $ as toWrongStackError } from '../context-IovtuTf8.js';
2
- export { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-B39miKRw.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-D2qvAxVd.js';
4
- export { C as CompactReport, a as Compactor } from '../compactor-DpJBI1YH.js';
5
- export { P as PermissionDecision, a as PermissionPolicy, T as TrustPolicy } from '../secret-scrubber-CgG2tV2B.js';
6
- 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-CcPi4BQ8.js';
7
- 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-Cuy5afaQ.js';
1
+ export { A as AgentError, C as Capabilities, a as ConfigError, b as ContentBlock, E as ErrorCode, c as ErrorSeverity, d as ErrorSubsystem, I as ImageBlock, J as JSONSchema, M as Message, e as MessageRole, P as Permission, f as PluginError, g as Provider, h as ProviderError, i as ProviderErrorBody, R as Request, j as Response, k as ResumedSession, S as SessionData, l as SessionError, m as SessionEvent, n as SessionMetadata, o as SessionStore, p as SessionSummary, q as SessionWriter, r as StopReason, s as StreamEvent, T as TextBlock, t as ThinkingBlock, u as Tool, v as ToolCallContext, w as ToolError, x as ToolFinalEvent, y as ToolProgressEvent, z as ToolResultBlock, B as ToolStreamEvent, D as ToolUseBlock, U as Usage, W as WrongStackError, F as asBlocks, G as asText, H as isAgentError, K as isConfigError, L as isImageBlock, N as isPluginError, O as isSessionError, Q as isTextBlock, V as isThinkingBlock, X as isToolError, Y as isToolResultBlock, Z as isToolUseBlock, _ as isWrongStackError, $ as toWrongStackError } from '../context-B1kBj1lY.js';
2
+ export { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-CU9gnU2E.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-RlhKLjme.js';
4
+ export { C as CompactReport, a as Compactor } from '../compactor-CFky6JKM.js';
5
+ export { P as PermissionDecision, a as PermissionPolicy, T as TrustPolicy } from '../secret-scrubber-DyUAWS09.js';
6
+ 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-D-z0AgHs.js';
7
+ 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-Dyh5LVYL.js';
8
8
  export { D as DefaultLogger, a as DefaultLoggerOptions } from '../logger-BH6AE0W9.js';
9
- export { D as DefaultPathResolver, a as DefaultTokenCounter } from '../path-resolver--59rCou3.js';
9
+ export { D as DefaultPathResolver, a as DefaultTokenCounter } from '../path-resolver-Bg4OP5fi.js';
10
10
  export { M as MemoryEntry, a as MemoryScope, b as MemoryStore } from '../memory-CEXuo7sz.js';
11
- 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-HsBLGRaA.js';
12
- export { S as SkillEntry, a as SkillLoader, b as SkillManifest } from '../skill-C_7znCIC.js';
13
- export { B as BuildContext, M as ModelCapabilities, R as Renderer, S as SystemPromptBuilder } from '../system-prompt-Dk1qm8ey.js';
11
+ 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-B5bgmEgE.js';
12
+ export { S as SkillEntry, a as SkillLoader, b as SkillManifest } from '../skill-DayhFUBb.js';
13
+ export { B as BuildContext, M as ModelCapabilities, R as Renderer, S as SystemPromptBuilder } from '../system-prompt-DNetCecu.js';
14
14
  export { I as InputReader, P as PromptOption } from '../input-reader-E-ffP2ee.js';
15
- 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-hWNybrNZ.js';
15
+ 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-meJRuQtc.js';
16
16
  export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from '../models-registry-DqzwpBQy.js';
17
17
  export { D as DEFAULT_MODES, M as Mode, a as ModeConfig, b as ModeManifest, c as ModeStore } from '../mode-CV077NjV.js';
18
- export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-C3DUGjSb.js';
19
- 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-B9a6sflH.js';
18
+ export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-DaOnnHNW.js';
19
+ 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-D5m66hzB.js';
20
20
  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';
21
21
  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';
22
- import '../events-BHIQs4o1.js';
22
+ import '../events-BBaKeMfb.js';
23
23
  import '../logger-BMQgxvdy.js';
24
24
  import '../models-registry-Y2xbog0E.js';
25
25
  import '../secret-vault-DoISxaKO.js';
@@ -329,7 +329,7 @@ function walk(node, vault, transform) {
329
329
  if (Array.isArray(node)) {
330
330
  return node.map((item) => walk(item, vault, transform));
331
331
  }
332
- const out = {};
332
+ const out = /* @__PURE__ */ Object.create(null);
333
333
  for (const [k, v] of Object.entries(node)) {
334
334
  if (typeof v === "string" && isSecretField(k)) {
335
335
  out[k] = transform(v, k);
@@ -1283,6 +1283,7 @@ var FAMILY_BY_NPM = {
1283
1283
  "@ai-sdk/xai": "openai-compatible",
1284
1284
  "@ai-sdk/cerebras": "openai-compatible",
1285
1285
  "@ai-sdk/togetherai": "openai-compatible",
1286
+ "@ai-sdk/mistral": "openai-compatible",
1286
1287
  "@ai-sdk/perplexity": "openai-compatible",
1287
1288
  "@ai-sdk/deepinfra": "openai-compatible",
1288
1289
  "@openrouter/ai-sdk-provider": "openai-compatible",
@@ -1754,6 +1755,13 @@ var InMemoryAgentBridge = class {
1754
1755
  this.pendingRequests.delete(correlationId);
1755
1756
  reject(new Error(`Request ${correlationId} timed out after ${timeout}ms`));
1756
1757
  }, timeout);
1758
+ if (this.stopped) {
1759
+ clearTimeout(timer);
1760
+ this.inflightGuards.delete(correlationId);
1761
+ this.pendingRequests.delete(correlationId);
1762
+ reject(new Error("Bridge stopped"));
1763
+ return;
1764
+ }
1757
1765
  this.pendingRequests.set(correlationId, {
1758
1766
  resolve: resolve3,
1759
1767
  reject,
@@ -1957,6 +1965,15 @@ var ToolExecutor = class {
1957
1965
  opts;
1958
1966
  serializer;
1959
1967
  iterationTimeoutMs;
1968
+ /**
1969
+ * Clear the interactive confirm awaiter so the executor returns
1970
+ * `ToolConfirmPendingResult` instead of blocking on stdin. Used by
1971
+ * the CLI to switch from inline prompts (REPL) to event-driven
1972
+ * confirmation (TUI) at runtime.
1973
+ */
1974
+ clearConfirmAwaiter() {
1975
+ this.opts.confirmAwaiter = void 0;
1976
+ }
1960
1977
  /**
1961
1978
  * Execute a batch of tool uses using the configured strategy.
1962
1979
  * Returns the execution results and the remaining output budget.
@@ -2205,6 +2222,42 @@ var ToolExecutor = class {
2205
2222
  }
2206
2223
  };
2207
2224
 
2225
+ // src/utils/regex-guard.ts
2226
+ var MAX_PATTERN_LEN = 512;
2227
+ var DANGEROUS_PATTERNS = [
2228
+ /(\([^)]*[+*][^)]*\))[+*]/,
2229
+ // (a+)+, (.*)+, etc
2230
+ /(\(\?:[^)]*[+*][^)]*\))[+*]/
2231
+ // same, with non-capturing group
2232
+ ];
2233
+ function compileUserRegex(pattern, flags) {
2234
+ if (typeof pattern !== "string") {
2235
+ return { ok: false, reason: "pattern must be a string" };
2236
+ }
2237
+ if (pattern.length === 0) {
2238
+ return { ok: false, reason: "pattern is empty" };
2239
+ }
2240
+ if (pattern.length > MAX_PATTERN_LEN) {
2241
+ return { ok: false, reason: `pattern exceeds ${MAX_PATTERN_LEN} characters` };
2242
+ }
2243
+ for (const rx of DANGEROUS_PATTERNS) {
2244
+ if (rx.test(pattern)) {
2245
+ return {
2246
+ ok: false,
2247
+ reason: "pattern looks vulnerable to catastrophic backtracking \u2014 rewrite without nested quantifiers"
2248
+ };
2249
+ }
2250
+ }
2251
+ try {
2252
+ return { ok: true, regex: new RegExp(pattern, flags) };
2253
+ } catch (err) {
2254
+ return {
2255
+ ok: false,
2256
+ reason: err instanceof Error ? err.message : "invalid regex"
2257
+ };
2258
+ }
2259
+ }
2260
+
2208
2261
  // src/storage/session-reader.ts
2209
2262
  var DefaultSessionReader = class {
2210
2263
  store;
@@ -2299,7 +2352,11 @@ function buildMatcher(q) {
2299
2352
  const ci = q.caseInsensitive ?? true;
2300
2353
  if (q.regex) {
2301
2354
  const flags = ci ? "i" : "";
2302
- const re = new RegExp(q.query, flags);
2355
+ const compiled = compileUserRegex(q.query, flags);
2356
+ if (!compiled.ok) {
2357
+ throw new Error(`Invalid search regex "${q.query}": ${compiled.reason}`);
2358
+ }
2359
+ const re = compiled.regex;
2303
2360
  return (text) => {
2304
2361
  const m = re.exec(text);
2305
2362
  return m ? { start: m.index, end: m.index + m[0].length } : null;