@wrongstack/core 0.257.2 → 0.264.0

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 (82) hide show
  1. package/dist/{agent-bridge-BrxWHEOm.d.ts → agent-bridge-D8sa1vtv.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-US741uBH.d.ts → agent-subagent-runner-c9DLkaas.d.ts} +31 -9
  3. package/dist/{brain-TjEEwSpw.d.ts → brain-O1IdKPaK.d.ts} +59 -2
  4. package/dist/{compactor-C5sT4U7I.d.ts → compactor-BBy0rCtB.d.ts} +1 -1
  5. package/dist/{config-DuAu23zm.d.ts → config-Dz2F3H2K.d.ts} +7 -1
  6. package/dist/{context-CGdgA0q6.d.ts → context-BGSpZNSE.d.ts} +33 -0
  7. package/dist/coordination/index.d.ts +1681 -15
  8. package/dist/coordination/index.js +2826 -405
  9. package/dist/coordination/index.js.map +1 -1
  10. package/dist/defaults/index.d.ts +25 -25
  11. package/dist/defaults/index.js +2258 -1433
  12. package/dist/defaults/index.js.map +1 -1
  13. package/dist/dispatcher-types.d-BBeXBQgS.d.ts +66 -0
  14. package/dist/execution/index.d.ts +15 -15
  15. package/dist/execution/index.js +502 -398
  16. package/dist/execution/index.js.map +1 -1
  17. package/dist/execution/prompt-enhancer.d.ts +2 -2
  18. package/dist/execution/prompt-enhancer.js +7 -1
  19. package/dist/execution/prompt-enhancer.js.map +1 -1
  20. package/dist/extension/index.d.ts +6 -6
  21. package/dist/extension/index.js.map +1 -1
  22. package/dist/{goal-preamble-CznHTZqP.d.ts → goal-preamble-DzjFuN3p.d.ts} +21 -9
  23. package/dist/{goal-store-CV9Yz2X_.d.ts → goal-store-CxWmCGbH.d.ts} +4 -2
  24. package/dist/{index-CC0Mcm05.d.ts → index-CYIQrXVF.d.ts} +8 -8
  25. package/dist/{index-CitPrI3a.d.ts → index-CbLSI66_.d.ts} +5 -5
  26. package/dist/index.d.ts +50 -94
  27. package/dist/index.js +16009 -12406
  28. package/dist/index.js.map +1 -1
  29. package/dist/infrastructure/index.d.ts +6 -6
  30. package/dist/kernel/index.d.ts +9 -9
  31. package/dist/kernel/index.js +6 -1
  32. package/dist/kernel/index.js.map +1 -1
  33. package/dist/{llm-selector-CJ4SyAFE.d.ts → llm-selector-DzxuZnNz.d.ts} +2 -2
  34. package/dist/{mcp-servers-D8YnLaEp.d.ts → mcp-servers-DC4QRPUI.d.ts} +3 -3
  35. package/dist/models/index.d.ts +5 -5
  36. package/dist/models/index.js +6 -1
  37. package/dist/models/index.js.map +1 -1
  38. package/dist/{models-registry-ByZCdFuQ.d.ts → models-registry-B_siPxqN.d.ts} +1 -1
  39. package/dist/{multi-agent-coordinator-DqTUEAeC.d.ts → multi-agent-coordinator-CK5Jdj9K.d.ts} +2 -2
  40. package/dist/{null-fleet-bus-B5mfTJXT.d.ts → null-fleet-bus-DgvD4SCO.d.ts} +13 -8
  41. package/dist/observability/index.d.ts +2 -2
  42. package/dist/observability/index.js +8 -3
  43. package/dist/observability/index.js.map +1 -1
  44. package/dist/{parallel-eternal-engine-C0juOszP.d.ts → parallel-eternal-engine-bK0JQBR_.d.ts} +13 -9
  45. package/dist/{path-resolver-CbkT-RMU.d.ts → path-resolver-BPEDlN38.d.ts} +3 -3
  46. package/dist/{permission-CwBBpCoF.d.ts → permission-4yvGmMRB.d.ts} +1 -1
  47. package/dist/{permission-policy-B8rSu908.d.ts → permission-policy-C6XpsBOy.d.ts} +3 -2
  48. package/dist/{pipeline-JG8XoudC.d.ts → pipeline-CXCeMz8J.d.ts} +58 -3
  49. package/dist/{plan-templates-DPiQMkBz.d.ts → plan-templates-BvzRBkJc.d.ts} +32 -11
  50. package/dist/{provider-runner-hM7EXlLI.d.ts → provider-runner-C5aQpDWE.d.ts} +3 -3
  51. package/dist/{retry-policy-Tg7LXkoK.d.ts → retry-policy-CFhdtRzz.d.ts} +1 -1
  52. package/dist/sdd/index.d.ts +8 -8
  53. package/dist/sdd/index.js +59 -31
  54. package/dist/sdd/index.js.map +1 -1
  55. package/dist/{secret-vault-gxtFZYBt.d.ts → secret-vault-CxiVLbt1.d.ts} +1 -1
  56. package/dist/security/index.d.ts +4 -4
  57. package/dist/security/index.js +238 -204
  58. package/dist/security/index.js.map +1 -1
  59. package/dist/{selector-DWsqVjGf.d.ts → selector-gIuhRTkN.d.ts} +1 -1
  60. package/dist/{session-event-bridge-BAFWdgQ3.d.ts → session-event-bridge-DkvvrpDt.d.ts} +8 -2
  61. package/dist/{session-reader-CqRvaL5v.d.ts → session-reader-KdfVwkKP.d.ts} +1 -1
  62. package/dist/skills/index.js +67 -64
  63. package/dist/skills/index.js.map +1 -1
  64. package/dist/storage/index.d.ts +50 -22
  65. package/dist/storage/index.js +1654 -525
  66. package/dist/storage/index.js.map +1 -1
  67. package/dist/tools/index.d.ts +57 -0
  68. package/dist/tools/index.js +411 -0
  69. package/dist/tools/index.js.map +1 -0
  70. package/dist/types/index.d.ts +19 -19
  71. package/dist/types/index.js +711 -694
  72. package/dist/types/index.js.map +1 -1
  73. package/dist/utils/error.d.ts +7 -0
  74. package/dist/utils/error.js +8 -0
  75. package/dist/utils/error.js.map +1 -0
  76. package/dist/utils/index.d.ts +7 -67
  77. package/dist/utils/index.js +17 -5
  78. package/dist/utils/index.js.map +1 -1
  79. package/package.json +5 -1
  80. package/skills/output-standards/SKILL.md +14 -9
  81. package/skills/output-standards/SKILL.save.md +3 -2
  82. package/dist/package-outdated-watcher-BSgR_kK-.d.ts +0 -581
@@ -1,20 +1,20 @@
1
- import { M as MemoryBackend, j as FileMemoryBackendOptions } from '../plan-templates-DPiQMkBz.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 mutatePlan, J as parseEntries, K as removePlanItem, L as runConfigMigrations, N as savePlan, O as saveTodosCheckpoint, U as setPlanItemStatus } from '../plan-templates-DPiQMkBz.js';
3
- import { M as MemoryScope, k as MemoryEntry, l as MemoryStore, E as EventBus } from '../brain-TjEEwSpw.js';
4
- import { l as AgentExtension, j as AfterRunHook } from '../index-CitPrI3a.js';
5
- import { P as Provider, R as Request, b as Response, S as SessionEvent } from '../context-CGdgA0q6.js';
6
- export { D as DefaultSessionReader, f as DefaultSessionReaderOptions, S as SessionReader } from '../session-reader-CqRvaL5v.js';
1
+ import { M as MemoryBackend, j as FileMemoryBackendOptions } from '../plan-templates-BvzRBkJc.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 mutatePlan, J as parseEntries, K as removePlanItem, L as runConfigMigrations, N as savePlan, O as saveTodosCheckpoint, U as setPlanItemStatus } from '../plan-templates-BvzRBkJc.js';
3
+ import { M as MemoryScope, b as MemoryEntry, c as MemoryStore, E as EventBus } from '../brain-O1IdKPaK.js';
4
+ import { l as AgentExtension, j as AfterRunHook } from '../index-CbLSI66_.js';
5
+ import { P as Provider, R as Request, b as Response, S as SessionEvent } from '../context-BGSpZNSE.js';
6
+ export { D as DefaultSessionReader, f as DefaultSessionReaderOptions, S as SessionReader } from '../session-reader-KdfVwkKP.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
- 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';
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-CxWmCGbH.js';
11
11
  import { W as WstackPaths } from '../wstack-paths-CJjEwPXn.js';
12
- import { E as SyncCategory, k as SyncConfig } from '../config-DuAu23zm.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-BAFWdgQ3.js';
14
- import '../permission-CwBBpCoF.js';
12
+ import { E as SyncCategory, k as SyncConfig } from '../config-Dz2F3H2K.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-DkvvrpDt.js';
14
+ import '../permission-4yvGmMRB.js';
15
15
  import '../secret-vault-BJDY28ev.js';
16
16
  import '../logger-B63L5bTg.js';
17
- import '../pipeline-JG8XoudC.js';
17
+ import '../pipeline-CXCeMz8J.js';
18
18
  import '../observability-D-HZN_mF.js';
19
19
  import '../task-graph-u1q9Jkyk.js';
20
20
 
@@ -186,16 +186,23 @@ interface Annotation {
186
186
  interface AnnotationsStoreOptions {
187
187
  /** Directory where `<sessionId>.annotations.json` files live. */
188
188
  dir: string;
189
+ events?: EventBus;
190
+ traceId?: string;
189
191
  }
190
192
  declare class AnnotationsStore {
191
193
  private readonly dir;
194
+ private readonly events;
195
+ private readonly traceId;
192
196
  /** Per-session write queue. Created lazily on first add. */
193
197
  private readonly writeChains;
194
198
  constructor(opts: AnnotationsStoreOptions);
195
199
  /**
196
200
  * Return all annotations for `sessionId` in insertion order
197
201
  * (oldest first). Returns an empty array when no file exists
198
- * yet (the normal case for a fresh session).
202
+ * yet (the normal case for a fresh session) and also degrades
203
+ * gracefully to `[]` on a read error (permissions, corruption) —
204
+ * the failure is still surfaced via a `storage.read` event so it
205
+ * never silently hides I/O problems from observers.
199
206
  */
200
207
  list(sessionId: string): Promise<Annotation[]>;
201
208
  /**
@@ -279,9 +286,13 @@ interface ReplayLogStoreOptions {
279
286
  * session which is a reasonable upper bound.
280
287
  */
281
288
  maxEntries?: number | undefined;
289
+ events?: EventBus;
290
+ traceId?: string;
282
291
  }
283
292
  declare class ReplayLogStore {
284
293
  private readonly dir;
294
+ private readonly events;
295
+ private readonly traceId;
285
296
  private readonly writeChains;
286
297
  /** Per-session hash → entry index, kept in memory after the first load. */
287
298
  private readonly cache;
@@ -299,12 +310,6 @@ declare class ReplayLogStore {
299
310
  request: Request;
300
311
  response: Response;
301
312
  }): Promise<string>;
302
- /**
303
- * Compact the replay log to keep only the most recent maxEntries.
304
- * Called when entry count exceeds the cap. Rewrites the entire file
305
- * but only happens O(n / maxEntries) times per session.
306
- */
307
- private rewriteCache;
308
313
  /**
309
314
  * Look up an entry by hash. Returns `null` when the request has
310
315
  * not been recorded for this session. O(1) after the first call
@@ -491,13 +496,24 @@ interface ToolAuditLogOptions {
491
496
  * Set to `Infinity` to disable periodic fsync (fastest, but highest data-loss risk).
492
497
  */
493
498
  fsyncEvery?: number | undefined;
499
+ events?: EventBus;
500
+ traceId?: string;
494
501
  }
495
502
  declare class ToolAuditLog {
496
503
  private readonly dir;
504
+ private readonly events;
505
+ private readonly traceId;
497
506
  /** In-memory cache of the last entry's hash (per session), to compute chains efficiently. */
498
507
  private readonly tailHash;
499
508
  /** In-memory counter for entry indices — avoids re-reading the file on every write. */
500
509
  private readonly tailIndex;
510
+ /**
511
+ * File mtime+size recorded after our last write, per session. Used to
512
+ * detect cross-process writes (session handoff, recovery) that would
513
+ * invalidate the in-memory tail cache: if the stat no longer matches
514
+ * we re-read the file to re-establish the chain tip before appending.
515
+ */
516
+ private readonly tailStat;
501
517
  /** Tracks writes since last fsync, per session. */
502
518
  private readonly unSyncedWrites;
503
519
  private readonly writeChains;
@@ -517,6 +533,13 @@ declare class ToolAuditLog {
517
533
  output: unknown;
518
534
  isError: boolean;
519
535
  }): Promise<AuditEntry>;
536
+ /**
537
+ * Resolve the chain tip (previous hash + next index) for an append.
538
+ * Uses the in-memory `tailHash`/`tailIndex` cache when the file's
539
+ * stat matches our last known write; falls back to a full read on
540
+ * cache miss or when an external writer has extended the file.
541
+ */
542
+ private _resolveChainTip;
520
543
  /**
521
544
  * Walk the chain and verify every entry's hash and prevHash.
522
545
  * Returns a structured verdict — never throws.
@@ -526,7 +549,12 @@ declare class ToolAuditLog {
526
549
  load(sessionId: string): Promise<AuditEntry[]>;
527
550
  private filePath;
528
551
  private readAll;
529
- private writeAll;
552
+ /**
553
+ * Tracks writes since last fsync and triggers periodic fsync.
554
+ * Called after each O(1) append to maintain the same durability
555
+ * guarantees as the old writeAll approach.
556
+ */
557
+ private _trackUnsynced;
530
558
  /**
531
559
  * Explicitly sync the file to disk. Called automatically every
532
560
  * `fsyncEvery` writes, and available for callers who want to
@@ -687,12 +715,12 @@ interface TaskFile {
687
715
  }
688
716
  declare function emptyTaskFile(sessionId: string): TaskFile;
689
717
  /** Read the task file. Returns null when the file doesn't exist. */
690
- declare function loadTasks(filePath: string): Promise<TaskFile | null>;
718
+ declare function loadTasks(filePath: string, events?: EventBus, traceId?: string): Promise<TaskFile | null>;
691
719
  /**
692
720
  * Write the task file atomically. Prefer `mutateTasks` for read-modify-write
693
721
  * cycles — this low-level function does NOT acquire a lock.
694
722
  */
695
- declare function saveTasks(filePath: string, tasks: TaskFile): Promise<void>;
723
+ declare function saveTasks(filePath: string, tasks: TaskFile, events?: EventBus, traceId?: string): Promise<void>;
696
724
  /**
697
725
  * Load, modify, and save the task file under a file-level lock.
698
726
  * `fn` receives the current TaskFile (or a fresh empty one) and must
@@ -702,7 +730,7 @@ declare function saveTasks(filePath: string, tasks: TaskFile): Promise<void>;
702
730
  * This is the primary API for any code path that reads *and then writes*
703
731
  * the task file — it prevents races from parallel `batch_tool_use` calls.
704
732
  */
705
- declare function mutateTasks(filePath: string, sessionId: string, fn: (file: TaskFile) => TaskFile | Promise<TaskFile>): Promise<TaskFile>;
733
+ declare function mutateTasks(filePath: string, sessionId: string, fn: (file: TaskFile) => TaskFile | Promise<TaskFile>, events?: EventBus, traceId?: string): Promise<TaskFile>;
706
734
 
707
735
  interface PromptEntry {
708
736
  id: string;