@wrongstack/core 0.8.4 → 0.8.6

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 (47) hide show
  1. package/dist/{agent-bridge-DPxcUVkn.d.ts → agent-bridge-Bad3ZGQ7.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-Cav3yEJM.d.ts → agent-subagent-runner-Cc8sRJOF.d.ts} +3 -3
  3. package/dist/coordination/index.d.ts +8 -8
  4. package/dist/coordination/index.js +8 -1
  5. package/dist/coordination/index.js.map +1 -1
  6. package/dist/defaults/index.d.ts +11 -11
  7. package/dist/defaults/index.js +41 -21
  8. package/dist/defaults/index.js.map +1 -1
  9. package/dist/{events-DyhxkstG.d.ts → events-yCpJD4wa.d.ts} +49 -0
  10. package/dist/execution/index.d.ts +7 -7
  11. package/dist/execution/index.js +22 -3
  12. package/dist/execution/index.js.map +1 -1
  13. package/dist/extension/index.d.ts +2 -2
  14. package/dist/index-BvZld4Dr.d.ts +200 -0
  15. package/dist/{index-oYZeWsuJ.d.ts → index-SxpnwRlJ.d.ts} +1 -1
  16. package/dist/index.d.ts +132 -21
  17. package/dist/index.js +862 -146
  18. package/dist/index.js.map +1 -1
  19. package/dist/infrastructure/index.d.ts +2 -2
  20. package/dist/kernel/index.d.ts +16 -88
  21. package/dist/kernel/index.js +3 -1
  22. package/dist/kernel/index.js.map +1 -1
  23. package/dist/{multi-agent-CRMznZmf.d.ts → multi-agent-C8uY45AY.d.ts} +9 -1
  24. package/dist/{multi-agent-coordinator-IQKrMfXz.d.ts → multi-agent-coordinator-C7YbZUY8.d.ts} +2 -2
  25. package/dist/{null-fleet-bus-sKnVwEd8.d.ts → null-fleet-bus-Bb2jVLKr.d.ts} +5 -5
  26. package/dist/observability/index.d.ts +1 -1
  27. package/dist/{path-resolver-1CIYbH2Q.d.ts → path-resolver-DnC1nOjb.d.ts} +1 -1
  28. package/dist/{plan-templates-BnlpEkX8.d.ts → plan-templates-Cqdy6rtM.d.ts} +2 -2
  29. package/dist/{provider-runner-BrA0XR-l.d.ts → provider-runner-C4ouU7--.d.ts} +1 -1
  30. package/dist/sdd/index.d.ts +11 -11
  31. package/dist/sdd/index.js +10 -14
  32. package/dist/sdd/index.js.map +1 -1
  33. package/dist/security/index.js.map +1 -1
  34. package/dist/skills/index.js +7 -1
  35. package/dist/skills/index.js.map +1 -1
  36. package/dist/storage/index.d.ts +3 -3
  37. package/dist/storage/index.js +1 -3
  38. package/dist/storage/index.js.map +1 -1
  39. package/dist/{tool-executor-QwfWnQZ8.d.ts → tool-executor-Ch25BDwa.d.ts} +1 -1
  40. package/dist/types/index.d.ts +7 -7
  41. package/dist/types/index.js +22 -3
  42. package/dist/types/index.js.map +1 -1
  43. package/dist/utils/index.d.ts +1 -1
  44. package/dist/utils/index.js +41 -1
  45. package/dist/utils/index.js.map +1 -1
  46. package/dist/{wstack-paths-gCrJ631C.d.ts → wstack-paths-CJYrjQU8.d.ts} +4 -0
  47. package/package.json +1 -1
@@ -1,18 +1,18 @@
1
1
  export { D as DefaultLogger, a as DefaultLoggerOptions } from '../logger-bOzkF5LL.js';
2
- 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-BnlpEkX8.js';
2
+ 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-Cqdy6rtM.js';
3
3
  export { D as DefaultSessionReader } from '../session-reader-DsadjyF9.js';
4
4
  export { D as DirectorStateCheckpoint, a as DirectorStateSnapshot, b as DirectorSubagentState, c as DirectorTaskState, l as loadDirectorState } from '../director-state-BmYi3DGA.js';
5
5
  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-C0n1EqrC.js';
6
6
  export { A as AutoApprovePermissionPolicy, D as DefaultPermissionPolicy, P as PermissionPolicyOptions } from '../permission-policy-BBa1M1xc.js';
7
- export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, T as ToolExecutor } from '../tool-executor-QwfWnQZ8.js';
7
+ export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, T as ToolExecutor } from '../tool-executor-Ch25BDwa.js';
8
8
  export { AutoCompactionMiddleware, AutonomousRunner, AutonomousRunnerOptions, AutonomyPromptContributorOptions, DefaultSkillLoader, DoneCheckResult, DoneConditionChecker, EternalAutonomyEngine, EternalAutonomyOptions, EternalEngineState, IntelligentCompactor, IntelligentCompactorOptions, ParallelEngineState, ParallelEternalEngine, ParallelEternalOptions, SelectiveCompactor, SelectiveCompactorOptions, SkillLoaderOptions, buildGoalPreamble, makeAutonomyPromptContributor } from '../execution/index.js';
9
- import { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-BrA0XR-l.js';
9
+ import { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-C4ouU7--.js';
10
10
  import { q as Response } from '../context-z2x5gv_V.js';
11
- export { 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, C as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, h as DEFAULT_SUBAGENT_BASELINE, i as DelegateHost, j as Director, k as DirectorPromptParts, l as DirectorSessionFactory, m as DirectorSessionFactoryOptions, F as FLEET_ROSTER, n as FLEET_ROSTER_BUDGETS, s as FleetRosterBudget, t as FleetSpawnBudgetError, I as ICoordinator, u as IFleetManager, N 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, E as createDelegateTool, G as getAgentDefinition, H as makeDirectorSessionFactory, J as rosterSummaryFromConfigs } from '../null-fleet-bus-sKnVwEd8.js';
12
- export { A as AgentBudgetTier, a as AgentCapability, b as AgentDefinition, c as AgentPhase, D as DEFAULT_DISPATCH_ROLE, d as DefaultMultiAgentCoordinator, e as DispatchCandidate, f 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-IQKrMfXz.js';
13
- export { c as BudgetExceededError, d as BudgetKind, e as BudgetLimits, j as BudgetUsage, m as SubagentBudget } from '../multi-agent-CRMznZmf.js';
14
- export { A as AgentFactory, a as AgentFactoryResult, b as AgentRunnerOptions, F as FleetBus, c as FleetEvent, d as FleetHandler, e as FleetUsage, f as FleetUsageAggregator, S as SubagentUsageSnapshot, m as makeAgentSubagentRunner } from '../agent-subagent-runner-Cav3yEJM.js';
15
- export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-DPxcUVkn.js';
11
+ export { 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, C as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, h as DEFAULT_SUBAGENT_BASELINE, i as DelegateHost, j as Director, k as DirectorPromptParts, l as DirectorSessionFactory, m as DirectorSessionFactoryOptions, F as FLEET_ROSTER, n as FLEET_ROSTER_BUDGETS, s as FleetRosterBudget, t as FleetSpawnBudgetError, I as ICoordinator, u as IFleetManager, N 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, E as createDelegateTool, G as getAgentDefinition, H as makeDirectorSessionFactory, J as rosterSummaryFromConfigs } from '../null-fleet-bus-Bb2jVLKr.js';
12
+ export { A as AgentBudgetTier, a as AgentCapability, b as AgentDefinition, c as AgentPhase, D as DEFAULT_DISPATCH_ROLE, d as DefaultMultiAgentCoordinator, e as DispatchCandidate, f 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-C7YbZUY8.js';
13
+ export { c as BudgetExceededError, d as BudgetKind, e as BudgetLimits, j as BudgetUsage, m as SubagentBudget } from '../multi-agent-C8uY45AY.js';
14
+ export { A as AgentFactory, a as AgentFactoryResult, b as AgentRunnerOptions, F as FleetBus, c as FleetEvent, d as FleetHandler, e as FleetUsage, f as FleetUsageAggregator, S as SubagentUsageSnapshot, m as makeAgentSubagentRunner } from '../agent-subagent-runner-Cc8sRJOF.js';
15
+ export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-Bad3ZGQ7.js';
16
16
  export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from '../models-registry-OG_30xqZ.js';
17
17
  export { DefaultModeStore, LLMSelector, LLMSelectorOptions, ModeLoaderOptions, loadProjectModes, loadUserModes } from '../models/index.js';
18
18
  export { AISpecBuilder, AISpecBuilderOptions, AISpecPhase, AISpecSession, AutoExecutor, AutoExecutorOptions, BottleneckTask, CollectedAnswer, CriticalPathAnalysis, DefaultTaskStore, ExecutionSummary, GeneratedTask, RunResult, 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, TaskStore, TaskTracker, TaskTrackerOptions, TaskTransition, WaveResult, analyzeCriticalPath, createAutoExecutor, getTemplate, listTemplates, renderProgress, renderSpecAnalysis, renderTaskGraph, renderTaskList, templateToMarkdown } from '../sdd/index.js';
@@ -20,9 +20,9 @@ export { DefaultHealthRegistry, InMemoryMetricsSink, MetricsServerHandle, Metric
20
20
  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, p as slackServer, z as zaiVisionServer } from '../mcp-servers-n2L9ohMX.js';
21
21
  export { D as DEFAULT_CONTEXT_CONFIG, a as DEFAULT_TOOLS_CONFIG } from '../default-config-DvRSTELf.js';
22
22
  import '../logger-DDd5C--Z.js';
23
- import '../events-DyhxkstG.js';
23
+ import '../events-yCpJD4wa.js';
24
24
  import '../memory-CEXuo7sz.js';
25
- import '../wstack-paths-gCrJ631C.js';
25
+ import '../wstack-paths-CJYrjQU8.js';
26
26
  import '../config-Bi4Q0fnz.js';
27
27
  import '../models-registry-BcYJDKLm.js';
28
28
  import '../secret-vault-DoISxaKO.js';
@@ -30,7 +30,7 @@ import '../secret-scrubber-CyE1-EMG.js';
30
30
  import '../input-reader-E-ffP2ee.js';
31
31
  import '../compactor-Mw7-rNyb.js';
32
32
  import '../retry-policy-OwtKNxo8.js';
33
- import '../index-oYZeWsuJ.js';
33
+ import '../index-SxpnwRlJ.js';
34
34
  import '../system-prompt-CWA6ml-d.js';
35
35
  import '../observability-BhnVLBLS.js';
36
36
  import '../selector-DkvgYVS4.js';
@@ -1662,9 +1662,7 @@ var RecoveryLock = class {
1662
1662
  hostname: this.hostname,
1663
1663
  startedAt: (/* @__PURE__ */ new Date()).toISOString()
1664
1664
  };
1665
- const tmp = `${this.file}.tmp`;
1666
- await fsp.writeFile(tmp, JSON.stringify(lock), { mode: 384 });
1667
- await fsp.rename(tmp, this.file);
1665
+ await atomicWrite(this.file, JSON.stringify(lock), { mode: 384 });
1668
1666
  }
1669
1667
  /**
1670
1668
  * Release the lock. Idempotent — silently succeeds if the file is
@@ -5063,7 +5061,7 @@ var ToolExecutor = class {
5063
5061
  return { result, tool, durationMs: Date.now() - start };
5064
5062
  }
5065
5063
  if (hasMalformedArguments(use.input)) {
5066
- const result = this.malformedInputResult(use);
5064
+ const result = this.malformedInputResult(use, extractMalformedRaw(use.input));
5067
5065
  budget = this.decrementBudget(result, budget);
5068
5066
  return { result, tool, durationMs: Date.now() - start };
5069
5067
  }
@@ -5270,11 +5268,18 @@ var ToolExecutor = class {
5270
5268
  is_error: true
5271
5269
  };
5272
5270
  }
5273
- malformedInputResult(use) {
5271
+ malformedInputResult(use, raw) {
5272
+ let 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.`;
5273
+ if (raw) {
5274
+ const max = 800;
5275
+ const excerpt = raw.length > max ? `${raw.slice(0, max)}\u2026 (truncated, ${raw.length} chars total)` : raw;
5276
+ content += ` Common cause: a string field (e.g. code in old_string/new_string) contains literal newlines, quotes, or backslashes that must be JSON-escaped, or the payload was cut off mid-stream. The raw arguments received were:
5277
+ ${excerpt}`;
5278
+ }
5274
5279
  return {
5275
5280
  type: "tool_result",
5276
5281
  tool_use_id: use.id,
5277
- 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.`,
5282
+ content,
5278
5283
  is_error: true
5279
5284
  };
5280
5285
  }
@@ -5330,6 +5335,18 @@ function hasMalformedArguments(input) {
5330
5335
  const keys = Object.keys(obj);
5331
5336
  return keys.length === 1 && MALFORMED_ARG_MARKERS.includes(keys[0]);
5332
5337
  }
5338
+ function extractMalformedRaw(input) {
5339
+ if (!hasMalformedArguments(input)) return void 0;
5340
+ const obj = input;
5341
+ const value = obj[Object.keys(obj)[0]];
5342
+ if (value === void 0 || value === null) return void 0;
5343
+ if (typeof value === "string") return value;
5344
+ try {
5345
+ return JSON.stringify(value);
5346
+ } catch {
5347
+ return String(value);
5348
+ }
5349
+ }
5333
5350
 
5334
5351
  // src/execution/autonomous-runner.ts
5335
5352
  var DoneConditionChecker = class {
@@ -10676,7 +10693,7 @@ function makeSpawnTool(director, roster) {
10676
10693
  catalog: roster
10677
10694
  });
10678
10695
  const dispatchRole = dispatchResult.role;
10679
- if (roster && roster[dispatchRole]) {
10696
+ if (roster?.[dispatchRole]) {
10680
10697
  cfg = instantiateRosterConfig(dispatchRole, roster[dispatchRole]);
10681
10698
  } else {
10682
10699
  const def = dispatchResult.definition;
@@ -11166,6 +11183,13 @@ var Director = class {
11166
11183
  extendCounts.delete(guardKey);
11167
11184
  return;
11168
11185
  }
11186
+ if (payload.kind === "cost" && this.maxFleetCostUsd < Number.POSITIVE_INFINITY) {
11187
+ const totalCost = this.usage.snapshot().total?.cost ?? 0;
11188
+ if (totalCost >= this.maxFleetCostUsd) {
11189
+ payload.deny();
11190
+ return;
11191
+ }
11192
+ }
11169
11193
  extendCounts.set(guardKey, prior + 1);
11170
11194
  setImmediate(() => {
11171
11195
  const extra = {};
@@ -13136,6 +13160,13 @@ var TaskTracker = class {
13136
13160
  opts;
13137
13161
  graph = null;
13138
13162
  transitions = [];
13163
+ /**
13164
+ * Attach an existing graph (used by PhaseOrchestrator to associate a tracker
13165
+ * with a phase's pre-built task graph without re-creating it).
13166
+ */
13167
+ setGraph(graph) {
13168
+ this.graph = graph;
13169
+ }
13139
13170
  async createGraph(specId, title) {
13140
13171
  this.graph = {
13141
13172
  id: crypto.randomUUID(),
@@ -13208,10 +13239,6 @@ var TaskTracker = class {
13208
13239
  this.graph.updatedAt = now;
13209
13240
  this.persist();
13210
13241
  }
13211
- /**
13212
- * Update node fields (title, description, priority, estimateHours, tags).
13213
- * Does NOT change status. Use updateNodeStatus for status changes.
13214
- */
13215
13242
  updateNode(id, patch) {
13216
13243
  if (!this.graph) throw new Error("No graph loaded");
13217
13244
  const node = this.graph.nodes.get(id);
@@ -13289,8 +13316,7 @@ var TaskTracker = class {
13289
13316
  }
13290
13317
  return computeTaskProgress(this.graph);
13291
13318
  }
13292
- getTransitions(taskId) {
13293
- if (!taskId) return [...this.transitions];
13319
+ getTransitions(_taskId) {
13294
13320
  return [...this.transitions];
13295
13321
  }
13296
13322
  unblockDependents(completedId) {
@@ -13330,18 +13356,12 @@ var TaskTracker = class {
13330
13356
  * Fire-and-forget persistence with attached error handler.
13331
13357
  * Synchronous mutators (addNode/addEdge/updateNodeStatus) use this to
13332
13358
  * avoid forcing an async cascade through every caller; if the store
13333
- * rejects, the configured `onPersistError` is invoked so failures are
13334
- * surfaced instead of swallowed by an unhandled promise rejection.
13359
+ * is missing or throwing, the error is surfaced via onPersistError.
13335
13360
  */
13336
13361
  persist() {
13337
13362
  if (!this.graph) return;
13338
13363
  this.opts.store.saveGraph(this.graph).catch((err) => {
13339
- if (this.opts.onPersistError) this.opts.onPersistError(err);
13340
- else
13341
- console.warn(
13342
- "[task-tracker] saveGraph failed:",
13343
- err instanceof Error ? err.message : String(err)
13344
- );
13364
+ this.opts.onPersistError ? this.opts.onPersistError(err) : console.warn("[task-tracker] saveGraph failed:", err instanceof Error ? err.message : String(err));
13345
13365
  });
13346
13366
  }
13347
13367
  };