@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,4 +1,4 @@
1
- import { S as SecretScrubber } from './permission-BDv7z0mk.js';
1
+ import { S as SecretScrubber } from './permission-DhLrgA30.js';
2
2
  import { S as SecretVault } from './secret-vault-DoISxaKO.js';
3
3
 
4
4
  declare class DefaultSecretScrubber implements SecretScrubber {
@@ -1,7 +1,7 @@
1
- export { D as DefaultSecretScrubber, a as DefaultSecretVault, S as SecretVaultOptions, d as decryptConfigSecrets, e as encryptConfigSecrets, m as migratePlaintextSecrets, r as rewriteConfigEncrypted } from '../secret-vault-DrOhc2i5.js';
2
- export { A as AutoApprovePermissionPolicy, D as DefaultPermissionPolicy, P as PermissionPolicyOptions } from '../permission-policy-dF74EpDp.js';
3
- import '../permission-BDv7z0mk.js';
4
- import '../context-CNRYfhUv.js';
1
+ export { D as DefaultSecretScrubber, a as DefaultSecretVault, S as SecretVaultOptions, d as decryptConfigSecrets, e as encryptConfigSecrets, m as migratePlaintextSecrets, r as rewriteConfigEncrypted } from '../secret-vault-B7GnL6o9.js';
2
+ export { A as AutoApprovePermissionPolicy, D as DefaultPermissionPolicy, P as PermissionPolicyOptions } from '../permission-policy-DGOvne7i.js';
3
+ import '../permission-DhLrgA30.js';
4
+ import '../context-hvXINa6a.js';
5
5
  import '../secret-vault-DoISxaKO.js';
6
6
  import '../input-reader-E-ffP2ee.js';
7
7
 
@@ -1,4 +1,4 @@
1
- import { M as Message } from './context-CNRYfhUv.js';
1
+ import { M as Message } from './context-hvXINa6a.js';
2
2
 
3
3
  /**
4
4
  * Result of LLM-driven message importance analysis.
@@ -1,4 +1,4 @@
1
- import { S as SessionEvent, a as SessionWriter } from './context-CNRYfhUv.js';
1
+ import { S as SessionEvent, a as SessionWriter } from './context-hvXINa6a.js';
2
2
 
3
3
  type AuditLevel = 'minimal' | 'standard' | 'full';
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { g as ContentBlock, S as SessionEvent, h as SessionMetadata, i as SessionStore } from './context-CNRYfhUv.js';
1
+ import { g as ContentBlock, S as SessionEvent, h as SessionMetadata, i as SessionStore } from './context-hvXINa6a.js';
2
2
 
3
3
  type AttachmentKind = 'text' | 'image' | 'file';
4
4
  interface AttachmentMeta {
@@ -1,22 +1,21 @@
1
- import { M as MemoryBackend, j as FileMemoryBackendOptions } from '../plan-templates-BdDxl9cI.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, F as FileMemoryBackend, k as MemoryStoreOptions, l as MigrationContext, m as MigrationResult, P as PersistedQueueItem, n as PlanFile, o as PlanItem, p as PlanTemplate, Q as QueueStore, R as RecoveryLock, q as RecoveryLockOptions, S as SessionAnalyzer, r as SessionStoreOptions, T as TodosCheckpointFile, s as addPlanItem, t as attachPlanCheckpoint, u as attachTodosCheckpoint, v as clearPlan, w as deriveTodosFromPlanItem, x as emptyPlan, y as formatPlan, z as formatPlanTemplates, B as getPlanTemplate, E as listPlanTemplates, G as loadPlan, H as loadTodosCheckpoint, I as parseEntries, J as removePlanItem, K as runConfigMigrations, L as savePlan, N as saveTodosCheckpoint, O as setPlanItemStatus } from '../plan-templates-BdDxl9cI.js';
3
- import { M as MemoryScope, k as MemoryEntry, l as MemoryStore } from '../brain-Dfv4Y82E.js';
4
- import { l as AgentExtension, j as AfterRunHook } from '../index-DIKEcfgC.js';
5
- import { P as Provider, R as Request, b as Response, S as SessionEvent } from '../context-CNRYfhUv.js';
6
- export { D as DefaultSessionReader, f as DefaultSessionReaderOptions, S as SessionReader } from '../session-reader-DDz1Ek4V.js';
1
+ import { M as MemoryBackend, j as FileMemoryBackendOptions } from '../plan-templates-DoKhzenv.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, F as FileMemoryBackend, k as MemoryStoreOptions, l as MigrationContext, m as MigrationResult, P as PersistedQueueItem, n as PlanFile, o as PlanItem, p as PlanTemplate, Q as QueueStore, R as RecoveryLock, q as RecoveryLockOptions, S as SessionAnalyzer, r as SessionStoreOptions, T as TodosCheckpointFile, s as addPlanItem, t as attachPlanCheckpoint, u as attachTodosCheckpoint, v as clearPlan, w as deriveTodosFromPlanItem, x as emptyPlan, y as formatPlan, z as formatPlanTemplates, B as getPlanTemplate, E as listPlanTemplates, G as loadPlan, H as loadTodosCheckpoint, I as parseEntries, J as removePlanItem, K as runConfigMigrations, L as savePlan, N as saveTodosCheckpoint, O as setPlanItemStatus } from '../plan-templates-DoKhzenv.js';
3
+ import { M as MemoryScope, k as MemoryEntry, l as MemoryStore } from '../brain-NZZqL8sn.js';
4
+ import { l as AgentExtension, j as AfterRunHook } from '../index-4VVHuTZF.js';
5
+ import { P as Provider, R as Request, b as Response, S as SessionEvent } from '../context-hvXINa6a.js';
6
+ export { D as DefaultSessionReader, f as DefaultSessionReaderOptions, S as SessionReader } from '../session-reader-DFC81-4p.js';
7
7
  import { S as SessionRewinder, C as CheckpointInfo, a as RewindResultExtended } from '../session-rewinder-C9HnMkhP.js';
8
8
  import { T as TaskItem } from '../task-format-vGOIftmK.js';
9
9
  export { a as DirectorStateCheckpoint, D as DirectorStateSnapshot, b as DirectorSubagentState, c as DirectorTaskState, l as loadDirectorState } from '../director-state-BfeCUbmk.js';
10
10
  export { G as GoalFile, J as JournalEntry, M as MAX_JOURNAL_ENTRIES, a as MAX_PROGRESS_HISTORY, P as ProgressSnapshot, b as appendJournal, e as emptyGoal, f as formatGoal, g as goalFilePath, l as loadGoal, p as parseProgressFromText, r as recordProgress, s as saveGoal, c as setProgress, d as summarizeUsage } from '../goal-store-CV9Yz2X_.js';
11
- import { W as WstackPaths } from '../wstack-paths-_lqjzErq.js';
12
- import { w as SyncCategory, g as SyncConfig } from '../config-BSU-6vah.js';
13
- export { A as AuditLevel, C as CORE_RECONSTRUCT_EVENTS, a as STANDARD_AUDIT_EVENTS, S as SessionEventBridge, b as SessionEventBridgeOptions, c as SessionSamplingOptions, T as ToolProgressSamplingOptions, d as createSessionEventBridge, r as resolveAuditLevel, e as resolveSessionLoggingConfig } from '../session-event-bridge-BpJ5trO9.js';
14
- import '../permission-BDv7z0mk.js';
11
+ import { W as WstackPaths } from '../wstack-paths-DD50Omgn.js';
12
+ import { B as SyncCategory, k as SyncConfig } from '../config-DZV9VK9n.js';
13
+ export { A as AuditLevel, C as CORE_RECONSTRUCT_EVENTS, a as STANDARD_AUDIT_EVENTS, S as SessionEventBridge, b as SessionEventBridgeOptions, c as SessionSamplingOptions, T as ToolProgressSamplingOptions, d as createSessionEventBridge, r as resolveAuditLevel, e as resolveSessionLoggingConfig } from '../session-event-bridge-DE5Oekwx.js';
14
+ import '../permission-DhLrgA30.js';
15
15
  import '../secret-vault-DoISxaKO.js';
16
16
  import '../logger-B63L5bTg.js';
17
- import '../pipeline-BqiA_UMr.js';
17
+ import '../pipeline-CqF7uju2.js';
18
18
  import '../observability-D-HZN_mF.js';
19
- import '../models-registry-B6_KfS65.js';
20
19
  import '../task-graph-u1q9Jkyk.js';
21
20
 
22
21
  interface GraphNode {
@@ -1322,39 +1322,41 @@ ${line}`;
1322
1322
  }
1323
1323
  async forget(scope, query, filePath) {
1324
1324
  const file = this.resolveFile(filePath, scope);
1325
- let existing;
1326
- try {
1327
- existing = await fsp.readFile(file, "utf8");
1328
- } catch {
1329
- return 0;
1330
- }
1331
- const needle = query.toLowerCase();
1332
- const idMatcher = /mem_\d+_\w+/;
1333
- let removed = 0;
1334
- const lines = existing.split("\n").filter((line) => {
1335
- const trimmed = line.trim();
1336
- if (!trimmed.startsWith("- ")) return true;
1337
- if (idMatcher.test(query)) {
1338
- const entryIdMatch = /mem_\d+_\w+/.exec(trimmed);
1339
- if (entryIdMatch && entryIdMatch[0] === query) {
1325
+ return withFileLock(file, async () => {
1326
+ let existing;
1327
+ try {
1328
+ existing = await fsp.readFile(file, "utf8");
1329
+ } catch {
1330
+ return 0;
1331
+ }
1332
+ const needle = query.toLowerCase();
1333
+ const idMatcher = /mem_\d+_\w+/;
1334
+ let removed = 0;
1335
+ const lines = existing.split("\n").filter((line) => {
1336
+ const trimmed = line.trim();
1337
+ if (!trimmed.startsWith("- ")) return true;
1338
+ if (idMatcher.test(query)) {
1339
+ const entryIdMatch = /mem_\d+_\w+/.exec(trimmed);
1340
+ if (entryIdMatch && entryIdMatch[0] === query) {
1341
+ removed++;
1342
+ return false;
1343
+ }
1344
+ }
1345
+ if (trimmed.toLowerCase().includes(needle)) {
1340
1346
  removed++;
1341
1347
  return false;
1342
1348
  }
1349
+ return true;
1350
+ });
1351
+ if (removed > 0) {
1352
+ if (lines.length === 0 || lines.length === 1 && !lines[0]?.trim()) {
1353
+ await atomicWrite(file, "");
1354
+ } else {
1355
+ await atomicWrite(file, lines.join("\n"));
1356
+ }
1343
1357
  }
1344
- if (trimmed.toLowerCase().includes(needle)) {
1345
- removed++;
1346
- return false;
1347
- }
1348
- return true;
1358
+ return removed;
1349
1359
  });
1350
- if (removed > 0) {
1351
- if (lines.length === 0 || lines.length === 1 && !lines[0]?.trim()) {
1352
- await atomicWrite(file, "");
1353
- } else {
1354
- await atomicWrite(file, lines.join("\n"));
1355
- }
1356
- }
1357
- return removed;
1358
1360
  }
1359
1361
  async readAll(scope, filePath) {
1360
1362
  const file = this.resolveFile(filePath, scope);
@@ -2067,7 +2069,7 @@ var SessionMemoryConsolidator = class {
2067
2069
  for (const op of parsed.operations) {
2068
2070
  switch (op.action) {
2069
2071
  case "add": {
2070
- if (op.text && op.text.trim()) {
2072
+ if (op.text?.trim()) {
2071
2073
  await this.memoryStore.remember(op.text.trim(), void 0, {
2072
2074
  type: op.type,
2073
2075
  tags: op.tags,
@@ -2439,12 +2441,14 @@ var DefaultConfigLoader = class {
2439
2441
  }
2440
2442
  async load(opts = {}) {
2441
2443
  let cfg = { ...BEHAVIOR_DEFAULTS };
2442
- const [global, local] = await Promise.all([
2444
+ const [global, local, inProject] = await Promise.all([
2443
2445
  this.readJson(this.paths.globalConfig),
2444
- this.readJson(this.paths.projectLocalConfig)
2446
+ this.readJson(this.paths.projectLocalConfig),
2447
+ this.readJson(this.paths.inProjectConfig)
2445
2448
  ]);
2446
2449
  cfg = deepMerge(cfg, global);
2447
2450
  cfg = deepMerge(cfg, local);
2451
+ cfg = deepMerge(cfg, inProject);
2448
2452
  for (const [key, fn] of Object.entries(ENV_MAP)) {
2449
2453
  const v = process.env[key];
2450
2454
  if (v) fn(cfg, v);
@@ -4597,6 +4601,7 @@ function resolveWstackPaths(opts) {
4597
4601
  projectTrust: path12.join(projectDir, "trust.json"),
4598
4602
  projectMeta: path12.join(projectDir, "meta.json"),
4599
4603
  projectLocalConfig: path12.join(projectDir, "config.local.json"),
4604
+ inProjectConfig: path12.join(opts.projectRoot, ".wrongstack", "config.json"),
4600
4605
  inProjectAgentsFile: path12.join(opts.projectRoot, ".wrongstack", "AGENTS.md"),
4601
4606
  inProjectSkills: path12.join(opts.projectRoot, ".wrongstack", "skills"),
4602
4607
  inProjectWorktrees: path12.join(opts.projectRoot, ".wrongstack", "worktrees"),
@@ -4671,16 +4676,20 @@ async function loadGoal(filePath) {
4671
4676
  let raw;
4672
4677
  try {
4673
4678
  raw = await fsp.readFile(filePath, "utf8");
4674
- } catch {
4675
- return null;
4679
+ } catch (err) {
4680
+ const code = err.code;
4681
+ if (code === "ENOENT") return null;
4682
+ throw err;
4676
4683
  }
4677
4684
  try {
4678
4685
  const parsed = JSON.parse(raw);
4679
4686
  if (parsed?.version !== 1 || typeof parsed.goal !== "string" || !Array.isArray(parsed.journal)) {
4687
+ console.warn(`[goal-store] Corrupt goal.json at ${filePath} \u2014 invalid schema. Consider deleting it and re-creating.`);
4680
4688
  return null;
4681
4689
  }
4682
4690
  return parsed;
4683
4691
  } catch {
4692
+ console.warn(`[goal-store] Corrupt goal.json at ${filePath} \u2014 JSON parse failed. Consider deleting it and re-creating.`);
4684
4693
  return null;
4685
4694
  }
4686
4695
  }
@@ -4829,7 +4838,7 @@ function computeTrend(history) {
4829
4838
  const recent = history.slice(-5);
4830
4839
  const deltas = [];
4831
4840
  for (let i = 1; i < recent.length; i++) {
4832
- deltas.push(recent[i].progress - recent[i - 1].progress);
4841
+ deltas.push((recent[i]?.progress ?? 0) - (recent[i - 1]?.progress ?? 0));
4833
4842
  }
4834
4843
  if (deltas.length < 2) return void 0;
4835
4844
  const avgDelta = deltas.reduce((a, b) => a + b, 0) / deltas.length;