@wrongstack/core 0.84.1 → 0.89.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/{agent-bridge-C9P_HPez.d.ts → agent-bridge-B8F2ORwg.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-2Aq0jOSj.d.ts → agent-subagent-runner-CQaLFNnA.d.ts} +3 -2
  3. package/dist/coordination/index.d.ts +7 -7
  4. package/dist/coordination/index.js +183 -56
  5. package/dist/coordination/index.js.map +1 -1
  6. package/dist/{default-config-DEXI4jsl.d.ts → default-config-CXsDvOmP.d.ts} +3 -1
  7. package/dist/defaults/index.d.ts +10 -10
  8. package/dist/defaults/index.js +268 -68
  9. package/dist/defaults/index.js.map +1 -1
  10. package/dist/{events-DnRqXaZ3.d.ts → events-DzyLtja6.d.ts} +6 -0
  11. package/dist/execution/index.d.ts +5 -5
  12. package/dist/execution/index.js +56 -19
  13. package/dist/execution/index.js.map +1 -1
  14. package/dist/extension/index.d.ts +2 -2
  15. package/dist/{index-BNOLadHw.d.ts → index-Ca_lOmKl.d.ts} +2 -2
  16. package/dist/{index-N0_c4bHQ.d.ts → index-Dx-CnrDN.d.ts} +3 -1
  17. package/dist/index.d.ts +24 -21
  18. package/dist/index.js +448 -179
  19. package/dist/index.js.map +1 -1
  20. package/dist/infrastructure/index.d.ts +2 -2
  21. package/dist/infrastructure/index.js +12 -3
  22. package/dist/infrastructure/index.js.map +1 -1
  23. package/dist/kernel/index.d.ts +3 -3
  24. package/dist/kernel/index.js +17 -0
  25. package/dist/kernel/index.js.map +1 -1
  26. package/dist/models/index.js.map +1 -1
  27. package/dist/{multi-agent-coordinator-DllpCVkF.d.ts → multi-agent-coordinator-Da9nd8Ic.d.ts} +1 -1
  28. package/dist/{null-fleet-bus-BY0AN-sr.d.ts → null-fleet-bus-CHJOXv3t.d.ts} +11 -5
  29. package/dist/observability/index.d.ts +1 -1
  30. package/dist/{parallel-eternal-engine-D402RASp.d.ts → parallel-eternal-engine-DyMCj2Pw.d.ts} +4 -3
  31. package/dist/{path-resolver-UPFTsDyD.d.ts → path-resolver-TjBlRKyH.d.ts} +1 -1
  32. package/dist/{plan-templates-DRvPgkfZ.d.ts → plan-templates-D9UhwoGh.d.ts} +1 -1
  33. package/dist/{provider-runner-COAJM8tC.d.ts → provider-runner-BEPWwkxH.d.ts} +1 -1
  34. package/dist/sdd/index.d.ts +3 -3
  35. package/dist/sdd/index.js +89 -19
  36. package/dist/sdd/index.js.map +1 -1
  37. package/dist/security/index.js +18 -2
  38. package/dist/security/index.js.map +1 -1
  39. package/dist/skills/index.js.map +1 -1
  40. package/dist/storage/index.d.ts +4 -4
  41. package/dist/storage/index.js +149 -90
  42. package/dist/storage/index.js.map +1 -1
  43. package/dist/types/index.d.ts +10 -10
  44. package/dist/types/index.js +44 -7
  45. package/dist/types/index.js.map +1 -1
  46. package/dist/utils/index.d.ts +6 -1
  47. package/dist/utils/index.js +51 -3
  48. package/dist/utils/index.js.map +1 -1
  49. package/package.json +1 -1
@@ -1,28 +1,28 @@
1
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-ToHAp4-U.js';
2
- export { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-COAJM8tC.js';
2
+ export { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-BEPWwkxH.js';
3
3
  export { A as AutonomyConfig, 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, k as CustomModelDefinition, D as DEFAULT_CONTEXT_WINDOW_MODE_ID, F as FeaturesConfig, H as HookEntry, l as HookEvent, m as HookInput, n as HookMatcher, o as HookOutcome, I as InProcessHook, p as IndexingConfig, L as LaunchConfig, q as LogConfig, M as MCPServerConfig, r as ModelMatrixEntry, P as PluginConfig, s as ProviderApiKey, t as ProviderConfig, S as SessionLoggingConfig, u as ShellHook, v as SyncCategory, w as SyncConfig, T as ToolsConfig, x as formatContextWindowModeList, y as getContextWindowMode, z as isContextWindowModeId, B as listContextWindowModes, E as resolveContextWindowPolicy } from '../config-_DZ7dN-T.js';
4
4
  export { C as CompactReport, a as Compactor } from '../compactor-CJq7LQev.js';
5
5
  export { P as PermissionDecision, a as PermissionPolicy, T as TrustPolicy } from '../permission-14CChMmO.js';
6
6
  export { C as CheckpointInfo, R as RewindResult, a as RewindResultExtended, S as SessionRewinder } from '../session-rewinder-C9HnMkhP.js';
7
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-BQU-toaN.js';
8
- export { D as DEFAULT_AUTONOMY_CONFIG, a as DEFAULT_CONTEXT_CONFIG, b as DEFAULT_SESSION_LOGGING_CONFIG, c as DEFAULT_TOOLS_CONFIG } from '../default-config-DEXI4jsl.js';
8
+ 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';
9
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-yGBFQYju.js';
10
10
  export { D as DefaultLogger, a as DefaultLoggerOptions } from '../logger-C_27pj9i.js';
11
- export { D as DefaultPathResolver, a as DefaultTokenCounter } from '../path-resolver-UPFTsDyD.js';
11
+ export { D as DefaultPathResolver, a as DefaultTokenCounter } from '../path-resolver-TjBlRKyH.js';
12
12
  export { M as MemoryEntry, a as MemoryScope, b as MemoryStore } from '../memory-CEXuo7sz.js';
13
- import { I as IterationStage, g as ParallelIterationStage } from '../parallel-eternal-engine-D402RASp.js';
14
- export { C as CompactorOptions, D as DEFAULT_RECOVERY_STRATEGIES, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, R as RecoveryStrategy, T as ToolExecutor, h as buildRecoveryStrategies } from '../parallel-eternal-engine-D402RASp.js';
13
+ import { I as IterationStage, g as ParallelIterationStage } from '../parallel-eternal-engine-DyMCj2Pw.js';
14
+ export { C as CompactorOptions, D as DEFAULT_RECOVERY_STRATEGIES, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, R as RecoveryStrategy, T as ToolExecutor, h as buildRecoveryStrategies } from '../parallel-eternal-engine-DyMCj2Pw.js';
15
15
  export { S as SkillEntry, a as SkillLoader, b as SkillManifest } from '../skill-BJeF2DwY.js';
16
16
  export { a as BuildContext, c as ModelCapabilities, e as Renderer, S as SystemPromptBuilder } from '../system-prompt-C0rLCeyn.js';
17
17
  export { I as InputReader, P as PromptOption } from '../input-reader-E-ffP2ee.js';
18
- export { C as CoordinatorEvents, o as CoordinatorStatus, D as DoneCondition, M as MCPRegistryView, t as MetricsSinkView, u as MultiAgentConfig, v as MultiAgentCoordinator, P as Plugin, w as PluginAPI, x as PluginCapabilities, y as PluginDependency, z as PluginPipelines, E as ProviderFactory, G as ProviderRegistryView, S as SessionWriterView, H as SlashCommand, I as SlashCommandRegistryView, J as SpawnResult, L as SubagentConfig, N as SubagentContext, O as SubagentError, Q as SubagentErrorKind, R as SubagentRunContext, T as SubagentRunOutcome, U as SubagentRunner, W as TaskDelegation, X as TaskResult, Y as TaskSpec, Z as ToolRegistryView } from '../agent-subagent-runner-2Aq0jOSj.js';
18
+ export { C as CoordinatorEvents, o as CoordinatorStatus, D as DoneCondition, M as MCPRegistryView, t as MetricsSinkView, u as MultiAgentConfig, v as MultiAgentCoordinator, P as Plugin, w as PluginAPI, x as PluginCapabilities, y as PluginDependency, z as PluginPipelines, E as ProviderFactory, G as ProviderRegistryView, S as SessionWriterView, H as SlashCommand, I as SlashCommandRegistryView, J as SpawnResult, L as SubagentConfig, N as SubagentContext, O as SubagentError, Q as SubagentErrorKind, R as SubagentRunContext, T as SubagentRunOutcome, U as SubagentRunner, W as TaskDelegation, X as TaskResult, Y as TaskSpec, Z as ToolRegistryView } from '../agent-subagent-runner-CQaLFNnA.js';
19
19
  export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from '../models-registry-Boz639EI.js';
20
20
  export { D as DEFAULT_MODES, M as Mode, a as ModeConfig, b as ModeManifest, c as ModeStore } from '../mode-CHo2XtHs.js';
21
- export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-C9P_HPez.js';
21
+ export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-B8F2ORwg.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-CikNdRTG.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-CoSNZdhX.js';
24
- export { S as SystemPromptContributor } from '../index-N0_c4bHQ.js';
25
- import '../events-DnRqXaZ3.js';
24
+ export { S as SystemPromptContributor } from '../index-Dx-CnrDN.js';
25
+ import '../events-DzyLtja6.js';
26
26
  import '../logger-B72yyPc6.js';
27
27
  import '../retry-policy-DSu6O6rD.js';
28
28
  import '../models-registry-Be3osGt5.js';
@@ -30,7 +30,7 @@ import '../secret-vault-DoISxaKO.js';
30
30
  import '../secret-scrubber-3MHDDAtm.js';
31
31
  import '../path-resolver-CPRj4bFY.js';
32
32
  import '../goal-store-DvWLNu52.js';
33
- import '../multi-agent-coordinator-DllpCVkF.js';
33
+ import '../multi-agent-coordinator-Da9nd8Ic.js';
34
34
  import 'node:events';
35
35
 
36
36
  /** Union of serial and parallel autonomy engine stage types (from EternalAutonomyEngine / ParallelEternalEngine). */
@@ -326,6 +326,7 @@ var DEFAULT_SESSION_LOGGING_CONFIG = Object.freeze({
326
326
  }
327
327
  }
328
328
  });
329
+ var DEFAULT_SESSION_PRUNE_DAYS = 30;
329
330
 
330
331
  // src/types/secret-vault.ts
331
332
  var ENCRYPTED_PREFIX = "enc:v1:";
@@ -547,9 +548,18 @@ async function restrictFilePermissions(filePath, opts) {
547
548
  const { execFile } = await import('child_process');
548
549
  const { promisify } = await import('util');
549
550
  const execFileAsync = promisify(execFile);
550
- await execFileAsync("icacls", [filePath, "/inheritance:r", "/grant:r", `${process.env.USERNAME}:(F)`]);
551
+ const user = windowsAccountName();
552
+ if (!user) {
553
+ warn(
554
+ `[secret-vault] Could not determine the current Windows user for ${filePath}; skipping icacls hardening.`
555
+ );
556
+ return;
557
+ }
558
+ await execFileAsync("icacls", [filePath, "/inheritance:r", "/grant:r", `${user}:(F)`]);
551
559
  } catch {
552
- warn(`[secret-vault] Could not restrict permissions on ${filePath} \u2014 config file may be readable by other users on this system.`);
560
+ warn(
561
+ `[secret-vault] Could not restrict permissions on ${filePath} \u2014 config file may be readable by other users on this system.`
562
+ );
553
563
  }
554
564
  } else {
555
565
  try {
@@ -558,6 +568,13 @@ async function restrictFilePermissions(filePath, opts) {
558
568
  }
559
569
  }
560
570
  }
571
+ function windowsAccountName() {
572
+ const username = process.env.USERNAME || process.env.USER;
573
+ if (!username || username.includes("\0")) return void 0;
574
+ const domain = process.env.USERDOMAIN;
575
+ if (domain && !domain.includes("\0")) return `${domain}\\${username}`;
576
+ return username;
577
+ }
561
578
  function walkCount(node, vault, counter) {
562
579
  if (node === null || node === void 0) return node;
563
580
  if (typeof node !== "object") return node;
@@ -618,10 +635,15 @@ function writeErr(s, stream = process.stderr) {
618
635
 
619
636
  // src/utils/color.ts
620
637
  var isColorTty = () => {
621
- if (process.env.NO_COLOR) return false;
622
- if (process.env.FORCE_COLOR) return true;
638
+ if (envFlag(process.env.NO_COLOR)) return false;
639
+ if (envFlag(process.env.FORCE_COLOR)) return true;
623
640
  return isStdoutTTY();
624
641
  };
642
+ function envFlag(value) {
643
+ if (value === void 0) return false;
644
+ if (value.trim() === "") return false;
645
+ return !/^(0|false|no|off)$/i.test(value.trim());
646
+ }
625
647
  var COLOR = isColorTty();
626
648
  var wrap = (open2, close) => (s) => COLOR ? `\x1B[${open2}m${s}\x1B[${close}m` : s;
627
649
  var color = {
@@ -658,6 +680,7 @@ var COLORS = {
658
680
  debug: color.gray,
659
681
  trace: color.dim
660
682
  };
683
+ var LOG_LEVELS = /* @__PURE__ */ new Set(["error", "warn", "info", "debug", "trace"]);
661
684
  var DefaultLogger = class _DefaultLogger {
662
685
  level;
663
686
  file;
@@ -665,7 +688,7 @@ var DefaultLogger = class _DefaultLogger {
665
688
  pretty;
666
689
  stderr;
667
690
  constructor(opts = {}) {
668
- this.level = opts.level ?? process.env.WRONGSTACK_LOG_LEVEL ?? "info";
691
+ this.level = opts.level ?? parseLogLevel(process.env.WRONGSTACK_LOG_LEVEL);
669
692
  this.file = opts.file;
670
693
  this.bindings = opts.bindings ?? {};
671
694
  this.pretty = opts.pretty ?? true;
@@ -730,6 +753,9 @@ var DefaultLogger = class _DefaultLogger {
730
753
  }
731
754
  }
732
755
  };
756
+ function parseLogLevel(raw) {
757
+ return raw && LOG_LEVELS.has(raw) ? raw : "info";
758
+ }
733
759
  function formatCtx(ctx) {
734
760
  if (ctx instanceof Error) return color.dim(ctx.message);
735
761
  if (typeof ctx === "string") return color.dim(ctx);
@@ -2654,6 +2680,7 @@ var ToolExecutor = class {
2654
2680
  this.registry = registry;
2655
2681
  this.opts = opts;
2656
2682
  this.iterationTimeoutMs = opts.iterationTimeoutMs ?? 3e5;
2683
+ this.maxToolTimeoutMs = opts.maxToolTimeoutMs ?? 3e5;
2657
2684
  this.serializer = createToolOutputSerializer({
2658
2685
  perIterationOutputCapBytes: opts.perIterationOutputCapBytes ?? 1e5
2659
2686
  });
@@ -2662,6 +2689,7 @@ var ToolExecutor = class {
2662
2689
  opts;
2663
2690
  serializer;
2664
2691
  iterationTimeoutMs;
2692
+ maxToolTimeoutMs;
2665
2693
  /**
2666
2694
  * Clear the interactive confirm awaiter so the executor returns
2667
2695
  * `ToolConfirmPendingResult` instead of blocking on stdin. Used by
@@ -2899,7 +2927,10 @@ ${post.additionalContext}` };
2899
2927
  if (parentSignal.reason instanceof Error) throw parentSignal.reason;
2900
2928
  throw new Error(typeof parentSignal.reason === "string" ? parentSignal.reason : "aborted");
2901
2929
  }
2902
- const timeoutMs = tool.timeoutMs ?? this.iterationTimeoutMs;
2930
+ const timeoutMs = clampTimeoutMs(
2931
+ tool.timeoutMs ?? this.iterationTimeoutMs,
2932
+ this.maxToolTimeoutMs
2933
+ );
2903
2934
  const ctrl = new AbortController();
2904
2935
  const timer = setTimeout(() => ctrl.abort(new Error("tool timeout")), timeoutMs);
2905
2936
  const combined = AbortSignal.any([parentSignal, ctrl.signal]);
@@ -3034,6 +3065,12 @@ ${excerpt}`;
3034
3065
  return void 0;
3035
3066
  }
3036
3067
  };
3068
+ function clampTimeoutMs(timeoutMs, maxTimeoutMs) {
3069
+ const fallback = 3e5;
3070
+ const finiteTimeout = Number.isFinite(timeoutMs) && timeoutMs > 0 ? timeoutMs : fallback;
3071
+ const finiteMax = Number.isFinite(maxTimeoutMs) && maxTimeoutMs > 0 ? maxTimeoutMs : fallback;
3072
+ return Math.max(1, Math.min(finiteTimeout, finiteMax));
3073
+ }
3037
3074
  var MALFORMED_ARG_MARKERS = ["__raw", "__raw_arguments", "_raw"];
3038
3075
  function hasMalformedArguments(input) {
3039
3076
  if (!input || typeof input !== "object" || Array.isArray(input)) return false;
@@ -3372,6 +3409,6 @@ function renderPlainText(meta, events) {
3372
3409
  return lines.join("\n");
3373
3410
  }
3374
3411
 
3375
- export { AgentError, CONTEXT_WINDOW_MODES, ConfigError, DEFAULT_AUTONOMY_CONFIG, DEFAULT_CONTEXT_CONFIG, DEFAULT_CONTEXT_WINDOW_MODE_ID, DEFAULT_MODES, DEFAULT_RECOVERY_STRATEGIES, DEFAULT_SESSION_LOGGING_CONFIG, DEFAULT_SPEC_TEMPLATE, DEFAULT_TOOLS_CONFIG, DefaultErrorHandler, DefaultLogger, DefaultModelsRegistry, DefaultPathResolver, DefaultRetryPolicy, DefaultSecretScrubber, DefaultSecretVault, DefaultSessionReader, DefaultTokenCounter, ERROR_CODES, FsError, HybridCompactor, InMemoryAgentBridge, InMemoryBridgeTransport, PluginError, ProviderError, SessionError, ToolError, ToolExecutor, WrongStackError, asBlocks, asText, buildRecoveryStrategies, classifyFamily, computeTaskProgress, createMessage, decryptConfigSecrets, encryptConfigSecrets, findCriticalPath, formatContextWindowModeList, getContextWindowMode, isAgentError, isConfigError, isContextWindowModeId, isFsError, isImageBlock, isPluginError, isSessionError, isTextBlock, isThinkingBlock, isToolError, isToolResultBlock, isToolUseBlock, isWrongStackError, listContextWindowModes, migratePlaintextSecrets, resolveContextWindowPolicy, rewriteConfigEncrypted, toWrongStackError, topologicalSort };
3412
+ export { AgentError, CONTEXT_WINDOW_MODES, ConfigError, DEFAULT_AUTONOMY_CONFIG, DEFAULT_CONTEXT_CONFIG, DEFAULT_CONTEXT_WINDOW_MODE_ID, DEFAULT_MODES, DEFAULT_RECOVERY_STRATEGIES, DEFAULT_SESSION_LOGGING_CONFIG, DEFAULT_SESSION_PRUNE_DAYS, DEFAULT_SPEC_TEMPLATE, DEFAULT_TOOLS_CONFIG, DefaultErrorHandler, DefaultLogger, DefaultModelsRegistry, DefaultPathResolver, DefaultRetryPolicy, DefaultSecretScrubber, DefaultSecretVault, DefaultSessionReader, DefaultTokenCounter, ERROR_CODES, FsError, HybridCompactor, InMemoryAgentBridge, InMemoryBridgeTransport, PluginError, ProviderError, SessionError, ToolError, ToolExecutor, WrongStackError, asBlocks, asText, buildRecoveryStrategies, classifyFamily, computeTaskProgress, createMessage, decryptConfigSecrets, encryptConfigSecrets, findCriticalPath, formatContextWindowModeList, getContextWindowMode, isAgentError, isConfigError, isContextWindowModeId, isFsError, isImageBlock, isPluginError, isSessionError, isTextBlock, isThinkingBlock, isToolError, isToolResultBlock, isToolUseBlock, isWrongStackError, listContextWindowModes, migratePlaintextSecrets, resolveContextWindowPolicy, rewriteConfigEncrypted, toWrongStackError, topologicalSort };
3376
3413
  //# sourceMappingURL=index.js.map
3377
3414
  //# sourceMappingURL=index.js.map