@wrongstack/core 0.109.1 → 0.119.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 (62) hide show
  1. package/dist/{agent-bridge-mOxbpFcg.d.ts → agent-bridge-PRAbEX-9.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-DukQLUcS.d.ts → agent-subagent-runner-DXWImnNV.d.ts} +7 -8
  3. package/dist/{brain-Dfv4Y82E.d.ts → brain-NZZqL8sn.d.ts} +1 -1
  4. package/dist/{compactor-DXLxLcmU.d.ts → compactor-C3stu664.d.ts} +1 -1
  5. package/dist/{config-BSU-6vah.d.ts → config-DZV9VK9n.d.ts} +104 -3
  6. package/dist/{context-CNRYfhUv.d.ts → context-hvXINa6a.d.ts} +31 -1
  7. package/dist/coordination/index.d.ts +12 -13
  8. package/dist/coordination/index.js +198 -0
  9. package/dist/coordination/index.js.map +1 -1
  10. package/dist/defaults/index.d.ts +26 -27
  11. package/dist/defaults/index.js +243 -35
  12. package/dist/defaults/index.js.map +1 -1
  13. package/dist/execution/index.d.ts +15 -16
  14. package/dist/execution/index.js +209 -5
  15. package/dist/execution/index.js.map +1 -1
  16. package/dist/extension/index.d.ts +6 -7
  17. package/dist/{goal-preamble-CI8lxeY1.d.ts → goal-preamble-COpt55W8.d.ts} +10 -10
  18. package/dist/{index-DIKEcfgC.d.ts → index-4VVHuTZF.d.ts} +7 -6
  19. package/dist/{index-BWRN6wOb.d.ts → index-Cj3le7TI.d.ts} +9 -10
  20. package/dist/index.d.ts +40 -41
  21. package/dist/index.js +298 -43
  22. package/dist/index.js.map +1 -1
  23. package/dist/infrastructure/index.d.ts +6 -7
  24. package/dist/kernel/index.d.ts +10 -11
  25. package/dist/llm-selector-Bmx4PsVM.d.ts +58 -0
  26. package/dist/{mcp-servers-CXCsANdY.d.ts → mcp-servers-CofNHOqn.d.ts} +3 -3
  27. package/dist/{mode-ARA3HrkY.d.ts → mode-CZlO9iU1.d.ts} +1 -1
  28. package/dist/models/index.d.ts +157 -53
  29. package/dist/models/index.js +423 -1
  30. package/dist/models/index.js.map +1 -1
  31. package/dist/{models-registry-DU64QxQa.d.ts → models-registry-BzlsjKcy.d.ts} +1 -1
  32. package/dist/{multi-agent-coordinator-51LvnXkD.d.ts → multi-agent-coordinator-CmDmUgq2.d.ts} +1 -1
  33. package/dist/{null-fleet-bus-D09hMzFQ.d.ts → null-fleet-bus-CyH2YqP4.d.ts} +6 -6
  34. package/dist/observability/index.d.ts +2 -2
  35. package/dist/{parallel-eternal-engine-B2CbsKpc.d.ts → parallel-eternal-engine-uxVm4y4V.d.ts} +8 -8
  36. package/dist/{path-resolver-DDJiMAtX.d.ts → path-resolver-gfoGxpdd.d.ts} +3 -3
  37. package/dist/{permission-BDv7z0mk.d.ts → permission-DhLrgA30.d.ts} +1 -1
  38. package/dist/{permission-policy-dF74EpDp.d.ts → permission-policy-DGOvne7i.d.ts} +2 -2
  39. package/dist/{pipeline-BqiA_UMr.d.ts → pipeline-CqF7uju2.d.ts} +2 -2
  40. package/dist/{plan-templates-BdDxl9cI.d.ts → plan-templates-DoKhzenv.d.ts} +6 -6
  41. package/dist/{provider-runner-BUunikwY.d.ts → provider-runner-BPlI5sPZ.d.ts} +3 -3
  42. package/dist/{retry-policy-BcmuT_V0.d.ts → retry-policy-B4Q-FZgE.d.ts} +1 -1
  43. package/dist/sdd/index.d.ts +8 -9
  44. package/dist/sdd/index.js +198 -0
  45. package/dist/sdd/index.js.map +1 -1
  46. package/dist/{secret-vault-DrOhc2i5.d.ts → secret-vault-B7GnL6o9.d.ts} +1 -1
  47. package/dist/security/index.d.ts +4 -4
  48. package/dist/{selector-C7wcdqMA.d.ts → selector-BakeMnWR.d.ts} +1 -1
  49. package/dist/{session-event-bridge-BpJ5trO9.d.ts → session-event-bridge-DE5Oekwx.d.ts} +1 -1
  50. package/dist/{session-reader-DDz1Ek4V.d.ts → session-reader-DFC81-4p.d.ts} +1 -1
  51. package/dist/storage/index.d.ts +11 -12
  52. package/dist/storage/index.js +43 -34
  53. package/dist/storage/index.js.map +1 -1
  54. package/dist/types/index.d.ts +19 -20
  55. package/dist/types/index.js +35 -1
  56. package/dist/types/index.js.map +1 -1
  57. package/dist/utils/index.d.ts +3 -4
  58. package/dist/utils/index.js +2 -1
  59. package/dist/utils/index.js.map +1 -1
  60. package/dist/{wstack-paths-_lqjzErq.d.ts → wstack-paths-DD50Omgn.d.ts} +3 -0
  61. package/package.json +1 -1
  62. package/dist/models-registry-B6_KfS65.d.ts +0 -95
@@ -1,24 +1,23 @@
1
- export { C as CompactorOptions, D as DefaultErrorHandler, a as DefaultRetryPolicy, E as EternalAutonomyEngine, b as EternalAutonomyOptions, c as EternalEngineState, H as HybridCompactor, I as IterationStage, P as ParallelEngineState, d as ParallelEternalEngine, e as ParallelEternalOptions, f as ParallelIterationStage, T as ToolExecutor } from '../parallel-eternal-engine-B2CbsKpc.js';
2
- export { A as AutoCompactionMiddleware, a as AutonomousRunner, b as AutonomousRunnerOptions, c as AutonomyPromptContributorOptions, D as DefaultSkillLoader, d as DoneCheckResult, e as DoneConditionChecker, I as IntelligentCompactor, f as IntelligentCompactorOptions, S as SelectiveCompactor, g as SelectiveCompactorOptions, h as SkillLoaderOptions, i as buildGoalPreamble, m as makeAutonomyPromptContributor } from '../goal-preamble-CI8lxeY1.js';
3
- import { P as Provider } from '../context-CNRYfhUv.js';
4
- import { B as BrainDecision, a as BrainDecisionRequest, b as BrainArbiter } from '../brain-Dfv4Y82E.js';
5
- import '../retry-policy-BcmuT_V0.js';
6
- import '../compactor-DXLxLcmU.js';
7
- import '../models-registry-B6_KfS65.js';
8
- import '../index-DIKEcfgC.js';
1
+ export { C as CompactorOptions, D as DefaultErrorHandler, a as DefaultRetryPolicy, E as EternalAutonomyEngine, b as EternalAutonomyOptions, c as EternalEngineState, H as HybridCompactor, I as IterationStage, P as ParallelEngineState, d as ParallelEternalEngine, e as ParallelEternalOptions, f as ParallelIterationStage, T as ToolExecutor } from '../parallel-eternal-engine-uxVm4y4V.js';
2
+ export { A as AutoCompactionMiddleware, a as AutonomousRunner, b as AutonomousRunnerOptions, c as AutonomyPromptContributorOptions, D as DefaultSkillLoader, d as DoneCheckResult, e as DoneConditionChecker, I as IntelligentCompactor, f as IntelligentCompactorOptions, S as SelectiveCompactor, g as SelectiveCompactorOptions, h as SkillLoaderOptions, i as buildGoalPreamble, m as makeAutonomyPromptContributor } from '../goal-preamble-COpt55W8.js';
3
+ import { P as Provider } from '../context-hvXINa6a.js';
4
+ import { B as BrainDecision, a as BrainDecisionRequest, b as BrainArbiter } from '../brain-NZZqL8sn.js';
5
+ import '../retry-policy-B4Q-FZgE.js';
6
+ import '../compactor-C3stu664.js';
7
+ import '../config-DZV9VK9n.js';
8
+ import '../index-4VVHuTZF.js';
9
9
  import '../logger-B63L5bTg.js';
10
- import '../pipeline-BqiA_UMr.js';
11
- import '../config-BSU-6vah.js';
10
+ import '../pipeline-CqF7uju2.js';
12
11
  import '../observability-D-HZN_mF.js';
13
- import '../permission-BDv7z0mk.js';
14
- import '../agent-subagent-runner-DukQLUcS.js';
12
+ import '../permission-DhLrgA30.js';
13
+ import '../agent-subagent-runner-DXWImnNV.js';
15
14
  import '../goal-store-CV9Yz2X_.js';
16
- import '../multi-agent-coordinator-51LvnXkD.js';
15
+ import '../multi-agent-coordinator-CmDmUgq2.js';
17
16
  import 'node:events';
18
17
  import '../skill-Bj6Ezqb8.js';
19
- import '../wstack-paths-_lqjzErq.js';
20
- import '../selector-C7wcdqMA.js';
21
- import '../session-event-bridge-BpJ5trO9.js';
18
+ import '../wstack-paths-DD50Omgn.js';
19
+ import '../selector-BakeMnWR.js';
20
+ import '../session-event-bridge-DE5Oekwx.js';
22
21
 
23
22
  /**
24
23
  * AutonomyBrain — a self-driving decision layer for autonomous workflows.
@@ -2161,6 +2161,7 @@ function resolveWstackPaths(opts) {
2161
2161
  projectTrust: path2.join(projectDir, "trust.json"),
2162
2162
  projectMeta: path2.join(projectDir, "meta.json"),
2163
2163
  projectLocalConfig: path2.join(projectDir, "config.local.json"),
2164
+ inProjectConfig: path2.join(opts.projectRoot, ".wrongstack", "config.json"),
2164
2165
  inProjectAgentsFile: path2.join(opts.projectRoot, ".wrongstack", "AGENTS.md"),
2165
2166
  inProjectSkills: path2.join(opts.projectRoot, ".wrongstack", "skills"),
2166
2167
  inProjectWorktrees: path2.join(opts.projectRoot, ".wrongstack", "worktrees"),
@@ -2185,16 +2186,20 @@ async function loadGoal(filePath) {
2185
2186
  let raw;
2186
2187
  try {
2187
2188
  raw = await fs.readFile(filePath, "utf8");
2188
- } catch {
2189
- return null;
2189
+ } catch (err) {
2190
+ const code = err.code;
2191
+ if (code === "ENOENT") return null;
2192
+ throw err;
2190
2193
  }
2191
2194
  try {
2192
2195
  const parsed = JSON.parse(raw);
2193
2196
  if (parsed?.version !== 1 || typeof parsed.goal !== "string" || !Array.isArray(parsed.journal)) {
2197
+ console.warn(`[goal-store] Corrupt goal.json at ${filePath} \u2014 invalid schema. Consider deleting it and re-creating.`);
2194
2198
  return null;
2195
2199
  }
2196
2200
  return parsed;
2197
2201
  } catch {
2202
+ console.warn(`[goal-store] Corrupt goal.json at ${filePath} \u2014 JSON parse failed. Consider deleting it and re-creating.`);
2198
2203
  return null;
2199
2204
  }
2200
2205
  }
@@ -2248,7 +2253,7 @@ function computeTrend(history) {
2248
2253
  const recent = history.slice(-5);
2249
2254
  const deltas = [];
2250
2255
  for (let i = 1; i < recent.length; i++) {
2251
- deltas.push(recent[i].progress - recent[i - 1].progress);
2256
+ deltas.push((recent[i]?.progress ?? 0) - (recent[i - 1]?.progress ?? 0));
2252
2257
  }
2253
2258
  if (deltas.length < 2) return void 0;
2254
2259
  const avgDelta = deltas.reduce((a, b) => a + b, 0) / deltas.length;
@@ -3007,8 +3012,8 @@ ${recentJournal}` : "No prior iterations.",
3007
3012
  await saveGoal(this.goalPath, abandoned);
3008
3013
  }
3009
3014
  try {
3010
- const { unlink: unlink2 } = await import('fs/promises');
3011
- await unlink2(this.goalPath);
3015
+ const { unlink: unlink3 } = await import('fs/promises');
3016
+ await unlink3(this.goalPath);
3012
3017
  } catch {
3013
3018
  }
3014
3019
  this.opts.onEternalStop?.();
@@ -4009,6 +4014,53 @@ Working rules:
4009
4014
  "flaws"
4010
4015
  ]
4011
4016
  }
4017
+ },
4018
+ {
4019
+ config: {
4020
+ id: "refactor-planner",
4021
+ name: "Refactor Planner",
4022
+ role: "refactor-planner",
4023
+ tools: [...PLAN_TOOLS, "diff"],
4024
+ prompt: `You are the Refactor Planner agent. Your job is to analyze code
4025
+ structure and produce a concrete, phased refactoring plan with risk
4026
+ assessment, dependency ordering, and rollback strategy.
4027
+
4028
+ Scope:
4029
+ - Map module-level dependencies (import graph)
4030
+ - Identify coupling hotspots (high fan-in/out modules)
4031
+ - Assess refactoring risk by complexity and test coverage
4032
+ - Generate phased plans with checkpoint milestones
4033
+ - Produce diff-friendly task lists (one task = one concern)
4034
+
4035
+ Input format you accept:
4036
+ { "task": "plan | assess | roadmap", "target": "src/core", "constraint": "no-breaking-changes | minimal-downtime | full-rewrite", "focus": "architecture | performance | maintainability" }
4037
+
4038
+ Output: Markdown refactor plan with phases (Low Risk / Medium Risk / High Risk),
4039
+ dependency graph, rollback strategy, and exit criteria.
4040
+
4041
+ Working rules:
4042
+ - Always include rollback strategy \u2014 every refactor can fail
4043
+ - Merge tasks that take <1h into a single phase
4044
+ - Respect team constraints (reviewer availability, parallelization)
4045
+ - Never plan without analyzing the actual code first`
4046
+ },
4047
+ budget: HEAVY_BUDGET,
4048
+ capability: {
4049
+ phase: "planning",
4050
+ summary: "Refactoring planner: analyzes code structure, maps dependencies, produces risk-scored phased plans with rollback strategy.",
4051
+ keywords: [
4052
+ "refactor",
4053
+ "refactoring",
4054
+ "restructure",
4055
+ "debt",
4056
+ "technical debt",
4057
+ "clean up",
4058
+ "modularize",
4059
+ "decouple",
4060
+ "dependency graph",
4061
+ "code structure"
4062
+ ]
4063
+ }
4012
4064
  }
4013
4065
  ];
4014
4066
 
@@ -4548,6 +4600,157 @@ Working rules:
4548
4600
  "robustness"
4549
4601
  ]
4550
4602
  }
4603
+ },
4604
+ {
4605
+ config: {
4606
+ id: "security-scanner",
4607
+ name: "Security Scanner",
4608
+ role: "security-scanner",
4609
+ tools: [...TOOLS.inspect],
4610
+ prompt: `You are the Security Scanner agent. Your job is to scan code,
4611
+ configs, and dependencies for security issues from hardcoded secrets to
4612
+ supply chain risks.
4613
+
4614
+ Scope:
4615
+ - Detect hardcoded secrets: API keys, tokens, passwords, private keys
4616
+ - Find injection vectors: eval, innerHTML, SQL concat, shell injection
4617
+ - Identify insecure patterns: weak crypto, hardcoded IVs, disabled TLS
4618
+ - Scan dependencies for known CVEs (via npm/pnpm audit)
4619
+ - Flag supply chain risks: postinstall hooks, unverified scripts
4620
+
4621
+ Input format you accept:
4622
+ { "task": "scan | audit | secrets | dependencies", "paths": ["src", "config"], "depth": "quick | normal | deep" }
4623
+
4624
+ Output: Markdown security report with severity-ranked findings, injection
4625
+ vectors, dependency issues, and a remediation checklist.
4626
+
4627
+ Working rules:
4628
+ - Never scan node_modules \u2014 use npm audit instead
4629
+ - Always provide remediation steps, not just findings
4630
+ - Verify regex-based secrets before flagging (false positive risk)
4631
+ - When in doubt, flag as medium rather than ignoring potential issues`
4632
+ },
4633
+ budget: HEAVY_BUDGET,
4634
+ capability: {
4635
+ phase: "verify",
4636
+ summary: "Security scanner: detects hardcoded secrets, injection vectors, insecure patterns, and supply-chain risks with remediation.",
4637
+ keywords: [
4638
+ "security",
4639
+ "scan",
4640
+ "vulnerability",
4641
+ "secret",
4642
+ "api key",
4643
+ "hardcoded",
4644
+ "injection",
4645
+ "cve",
4646
+ "audit dependencies",
4647
+ "supply chain",
4648
+ "xss",
4649
+ "sqli",
4650
+ "shell injection",
4651
+ "sensitive data",
4652
+ "credential"
4653
+ ]
4654
+ }
4655
+ },
4656
+ {
4657
+ config: {
4658
+ id: "bug-hunter",
4659
+ name: "Bug Hunter",
4660
+ role: "bug-hunter",
4661
+ tools: [...TOOLS.inspect],
4662
+ prompt: `You are the Bug Hunter agent. Your job is to systematically scan
4663
+ source code for bugs, anti-patterns, and code smells using pattern matching
4664
+ and heuristics. Output a prioritized hit list with file:line references.
4665
+
4666
+ Scope:
4667
+ - Detect common bug patterns (uncaught errors, resource leaks, race conditions)
4668
+ - Identify anti-patterns (callback hell, God objects, circular deps)
4669
+ - Find TypeScript-specific issues (unsafe any, missing null checks, branded types)
4670
+ - Flag security-sensitive constructs (eval, innerHTML, hardcoded secrets)
4671
+ - Rank findings: critical > high > medium > low
4672
+
4673
+ Input format you accept:
4674
+ { "task": "scan | hunt | check", "paths": ["src/**/*.ts"], "focus": "bugs | patterns | security | all", "severityThreshold": "medium" }
4675
+
4676
+ Output: Markdown bug hunt report with critically/high/medium/low sections.
4677
+ Each entry: **[TYPE]** \`file:line\` \u2014 description + suggested fix
4678
+
4679
+ Working rules:
4680
+ - Never scan node_modules \u2014 it's noise
4681
+ - Always include file:line for every finding
4682
+ - If >30% of findings are false positives, note the confidence level
4683
+ - Ask director for clarification if paths are ambiguous`
4684
+ },
4685
+ budget: HEAVY_BUDGET,
4686
+ capability: {
4687
+ phase: "verify",
4688
+ summary: "Bug hunter: scans source code for bugs, anti-patterns, and code smells, producing a file:line-ranked hit list with fixes.",
4689
+ keywords: [
4690
+ "bug",
4691
+ "hunt",
4692
+ "scan",
4693
+ "code smell",
4694
+ "anti-pattern",
4695
+ "race condition",
4696
+ "memory leak",
4697
+ "null deref",
4698
+ "type safety",
4699
+ "unhandled error",
4700
+ "find bugs",
4701
+ "audit code",
4702
+ "code quality"
4703
+ ]
4704
+ }
4705
+ },
4706
+ {
4707
+ config: {
4708
+ id: "audit-log",
4709
+ name: "Audit Log",
4710
+ role: "audit-log",
4711
+ tools: [...TOOLS.inspect],
4712
+ prompt: `You are the Audit Log agent. Your job is to analyze structured JSONL
4713
+ session logs and produce actionable markdown reports.
4714
+
4715
+ Scope:
4716
+ - Parse session logs (iteration counts, tool calls, errors, usage)
4717
+ - Detect repeated failure patterns across multiple runs
4718
+ - Identify tool usage anomalies (over-use, failures, unexpected chains)
4719
+ - Track token consumption trends
4720
+ - Generate structured audit reports with severity ratings
4721
+
4722
+ Input format you accept:
4723
+ { "task": "analyze | report | trends", "sessionPath": "<path>", "focus": "errors | tools | usage | all" }
4724
+
4725
+ Output: Markdown audit report with Summary, Top Errors, Tool Usage table,
4726
+ Anomalies, and Cost Trend sections.
4727
+
4728
+ Working rules:
4729
+ - Never fabricate numbers \u2014 read the actual logs first
4730
+ - Always include file:line references for errors
4731
+ - If sessionPath is missing, ask the director to provide it
4732
+ - Report confidence level: high (>90% accuracy), medium, low`
4733
+ },
4734
+ budget: MEDIUM_BUDGET,
4735
+ capability: {
4736
+ phase: "verify",
4737
+ summary: "Audit log analyzer: parses session JSONL, detects failure patterns, tool anomalies, and cost trends with structured reports.",
4738
+ keywords: [
4739
+ "audit",
4740
+ "log",
4741
+ "logs",
4742
+ "session",
4743
+ "trace",
4744
+ "analyze logs",
4745
+ "error patterns",
4746
+ "cost analysis",
4747
+ "tool usage",
4748
+ "token usage",
4749
+ "post-mortem",
4750
+ "trend",
4751
+ "anomaly"
4752
+ ]
4753
+ }
4551
4754
  }
4552
4755
  ];
4553
4756
 
@@ -7555,6 +7758,7 @@ var DefaultRetryPolicy = class {
7555
7758
  if (err instanceof ProviderError) {
7556
7759
  if (err.status === 429) return 5;
7557
7760
  if (err.status === 529) return 3;
7761
+ if (err.status === 599) return 5;
7558
7762
  if (err.status >= 500) return 3;
7559
7763
  return 0;
7560
7764
  }