@wrongstack/core 0.267.0 → 0.268.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 (74) hide show
  1. package/dist/{agent-bridge-STJ3JwwK.d.ts → agent-bridge-UhojbpWx.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-CzPGP3jA.d.ts → agent-subagent-runner-Bvtf1o9K.d.ts} +7 -7
  3. package/dist/{brain-Cdg77tVN.d.ts → brain-69wzMKp1.d.ts} +1 -1
  4. package/dist/{compactor-iMZ84CXq.d.ts → compactor-CBQAJoDc.d.ts} +1 -1
  5. package/dist/{config-Du3pYYln.d.ts → config-VKfOZ-6X.d.ts} +70 -2
  6. package/dist/{context-dT5Ueund.d.ts → context-C0U8B9NF.d.ts} +24 -1
  7. package/dist/coordination/index.d.ts +56 -160
  8. package/dist/coordination/index.js +333 -63
  9. package/dist/coordination/index.js.map +1 -1
  10. package/dist/defaults/index.d.ts +26 -25
  11. package/dist/defaults/index.js +94 -68
  12. package/dist/defaults/index.js.map +1 -1
  13. package/dist/execution/index.d.ts +72 -16
  14. package/dist/execution/index.js +151 -36
  15. package/dist/execution/index.js.map +1 -1
  16. package/dist/execution/prompt-enhancer.d.ts +1 -1
  17. package/dist/extension/index.d.ts +7 -6
  18. package/dist/global-mailbox-KByEFFBa.d.ts +663 -0
  19. package/dist/{goal-preamble-SulMTowG.d.ts → goal-preamble-CrYjmdw4.d.ts} +9 -9
  20. package/dist/{goal-store-CABDwdFE.d.ts → goal-store-Y_zdLZ3q.d.ts} +1 -1
  21. package/dist/hq/index.d.ts +195 -0
  22. package/dist/hq/index.js +1884 -0
  23. package/dist/hq/index.js.map +1 -0
  24. package/dist/{index-IEuxQd-E.d.ts → index-BfaS-f_m.d.ts} +2 -2
  25. package/dist/{index-DtCVWel4.d.ts → index-CtQnmkaS.d.ts} +8 -8
  26. package/dist/{index-Bms0m4oy.d.ts → index-gCv830d7.d.ts} +5 -5
  27. package/dist/index.d.ts +46 -42
  28. package/dist/index.js +2955 -1498
  29. package/dist/index.js.map +1 -1
  30. package/dist/infrastructure/index.d.ts +6 -6
  31. package/dist/infrastructure/index.js +45 -18
  32. package/dist/infrastructure/index.js.map +1 -1
  33. package/dist/kernel/index.d.ts +10 -9
  34. package/dist/{pipeline-BfD2k1rT.d.ts → mailbox-types-Ct2hJq0P.d.ts} +1 -244
  35. package/dist/{mcp-servers-C2cBTxUR.d.ts → mcp-servers-HT3Fi7Bl.d.ts} +10 -4
  36. package/dist/models/index.d.ts +5 -5
  37. package/dist/models/index.js +3 -2
  38. package/dist/models/index.js.map +1 -1
  39. package/dist/{models-registry-BqGZNJQ-.d.ts → models-registry-Bvcl3Vaa.d.ts} +1 -1
  40. package/dist/{multi-agent-coordinator-B8R43uPz.d.ts → multi-agent-coordinator-BACjsmkC.d.ts} +1 -1
  41. package/dist/{null-fleet-bus-CnXa5oTH.d.ts → null-fleet-bus-DA7fvhUg.d.ts} +6 -6
  42. package/dist/observability/index.d.ts +2 -2
  43. package/dist/{parallel-eternal-engine-DdNnw9BQ.d.ts → parallel-eternal-engine-Ci71gYu_.d.ts} +9 -15
  44. package/dist/{path-resolver-COIMLCQL.d.ts → path-resolver-O1IJnmKE.d.ts} +4 -3
  45. package/dist/{permission-B75JAi3-.d.ts → permission-Bd-57Lbl.d.ts} +1 -1
  46. package/dist/{permission-policy-DlR9eJAM.d.ts → permission-policy-uNXC6Kge.d.ts} +2 -3
  47. package/dist/pipeline-BDNvENyV.d.ts +245 -0
  48. package/dist/{plan-templates-DSIKCXZN.d.ts → plan-templates-EMsalEtN.d.ts} +5 -5
  49. package/dist/{provider-model-resolve-BNRsNuJx.d.ts → provider-model-resolve-CEb9x886.d.ts} +3 -3
  50. package/dist/{provider-runner-CX7iIvox.d.ts → provider-runner-DWJbpo70.d.ts} +3 -3
  51. package/dist/{retry-policy-BilV1ujH.d.ts → retry-policy-C3s_lvdK.d.ts} +1 -1
  52. package/dist/sdd/index.d.ts +9 -8
  53. package/dist/sdd/index.js +32 -2
  54. package/dist/sdd/index.js.map +1 -1
  55. package/dist/{secret-vault-gkvEZZfE.d.ts → secret-vault-Cgduf5xL.d.ts} +1 -1
  56. package/dist/security/index.d.ts +5 -5
  57. package/dist/security/index.js +39 -29
  58. package/dist/security/index.js.map +1 -1
  59. package/dist/{selector-Bc7eWtT3.d.ts → selector-47LBnBVk.d.ts} +1 -1
  60. package/dist/{session-event-bridge-D-araDEz.d.ts → session-event-bridge-Cw7oqmW2.d.ts} +1 -1
  61. package/dist/{session-reader-D7Dapswh.d.ts → session-reader-DD4v2Obw.d.ts} +1 -1
  62. package/dist/storage/index.d.ts +14 -12
  63. package/dist/storage/index.js +63 -36
  64. package/dist/storage/index.js.map +1 -1
  65. package/dist/tools/index.d.ts +2 -2
  66. package/dist/tools/index.js +166 -31
  67. package/dist/tools/index.js.map +1 -1
  68. package/dist/types/index.d.ts +20 -19
  69. package/dist/types/index.js +68 -51
  70. package/dist/types/index.js.map +1 -1
  71. package/dist/utils/index.d.ts +22 -3
  72. package/dist/utils/index.js +139 -1
  73. package/dist/utils/index.js.map +1 -1
  74. package/package.json +5 -1
@@ -1,4 +1,4 @@
1
- import { M as Message } from './context-dT5Ueund.js';
1
+ import { M as Message } from './context-C0U8B9NF.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-dT5Ueund.js';
1
+ import { S as SessionEvent, a as SessionWriter } from './context-C0U8B9NF.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-dT5Ueund.js';
1
+ import { g as ContentBlock, S as SessionEvent, h as SessionMetadata, i as SessionStore } from './context-C0U8B9NF.js';
2
2
 
3
3
  type AttachmentKind = 'text' | 'image' | 'file';
4
4
  interface AttachmentMeta {
@@ -1,20 +1,21 @@
1
- import { M as MemoryBackend, j as FileMemoryBackendOptions } from '../plan-templates-DSIKCXZN.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-DSIKCXZN.js';
3
- import { M as MemoryScope, b as MemoryEntry, c as MemoryStore, E as EventBus } from '../brain-Cdg77tVN.js';
4
- import { l as AgentExtension, j as AfterRunHook } from '../index-Bms0m4oy.js';
5
- import { P as Provider, R as Request, b as Response, S as SessionEvent } from '../context-dT5Ueund.js';
6
- export { D as DefaultSessionReader, f as DefaultSessionReaderOptions, S as SessionReader } from '../session-reader-D7Dapswh.js';
1
+ import { M as MemoryBackend, j as FileMemoryBackendOptions } from '../plan-templates-EMsalEtN.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-EMsalEtN.js';
3
+ import { M as MemoryScope, b as MemoryEntry, c as MemoryStore, E as EventBus } from '../brain-69wzMKp1.js';
4
+ import { l as AgentExtension, j as AfterRunHook } from '../index-gCv830d7.js';
5
+ import { P as Provider, R as Request, b as Response, S as SessionEvent } from '../context-C0U8B9NF.js';
6
+ export { D as DefaultSessionReader, f as DefaultSessionReaderOptions, S as SessionReader } from '../session-reader-DD4v2Obw.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-CABDwdFE.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-Y_zdLZ3q.js';
11
11
  import { W as WstackPaths } from '../wstack-paths-hOpNLmvf.js';
12
- import { G as SyncCategory, l as SyncConfig } from '../config-Du3pYYln.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-D-araDEz.js';
14
- import '../permission-B75JAi3-.js';
12
+ import { O as SyncCategory, l as SyncConfig } from '../config-VKfOZ-6X.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-Cw7oqmW2.js';
14
+ import '../permission-Bd-57Lbl.js';
15
15
  import '../secret-vault-BAKpgFw_.js';
16
16
  import '../logger-B63L5bTg.js';
17
- import '../pipeline-BfD2k1rT.js';
17
+ import '../pipeline-BDNvENyV.js';
18
+ import '../mailbox-types-Ct2hJq0P.js';
18
19
  import '../observability-D-HZN_mF.js';
19
20
  import '../task-graph-u1q9Jkyk.js';
20
21
 
@@ -68,7 +69,7 @@ declare class GraphMemoryBackend implements MemoryBackend {
68
69
  forget(scope: MemoryScope, query: string, filePath: string): Promise<number>;
69
70
  readAll(scope: MemoryScope, filePath: string): Promise<string>;
70
71
  list(scope: MemoryScope, filePath: string, limit?: number): Promise<MemoryEntry[]>;
71
- search(scope: MemoryScope, query: string, filePath: string, limit?: number): Promise<MemoryEntry[]>;
72
+ search(scope: MemoryScope, query: string, _filePath: string, limit?: number): Promise<MemoryEntry[]>;
72
73
  clear(scope: MemoryScope, filePath: string): Promise<void>;
73
74
  consolidate(scope: MemoryScope, filePath: string): Promise<number>;
74
75
  /**
@@ -329,6 +330,7 @@ declare class ReplayLogStore {
329
330
  path: string;
330
331
  }>>;
331
332
  private filePath;
333
+ private countEntries;
332
334
  private readAll;
333
335
  private writeAll;
334
336
  private ensureCache;
@@ -237,7 +237,7 @@ function envFlag(value) {
237
237
  return !/^(0|false|no|off)$/i.test(value.trim());
238
238
  }
239
239
  var COLOR = isColorTty();
240
- var wrap = (open6, close) => (s) => COLOR ? `\x1B[${open6}m${s}\x1B[${close}m` : s;
240
+ var wrap = (open7, close) => (s) => COLOR ? `\x1B[${open7}m${s}\x1B[${close}m` : s;
241
241
  var color = {
242
242
  reset: wrap("0", "0"),
243
243
  bold: wrap("1", "22"),
@@ -626,6 +626,8 @@ var DefaultSessionStore = class _DefaultSessionStore {
626
626
  const cached = this._loadCache.get(id);
627
627
  if (cached && cached.mtimeMs === stat7.mtimeMs && cached.size === stat7.size) {
628
628
  cacheHit = true;
629
+ this._loadCache.delete(id);
630
+ this._loadCache.set(id, cached);
629
631
  return cached.data;
630
632
  }
631
633
  const raw = await fsp.readFile(file, "utf8");
@@ -2750,27 +2752,25 @@ var GraphMemoryBackend = class {
2750
2752
  enriched.sort((a, b) => b.ts.localeCompare(a.ts));
2751
2753
  return limit ? enriched.slice(0, limit) : enriched;
2752
2754
  }
2753
- async search(scope, query, filePath, limit) {
2755
+ async search(scope, query, _filePath, limit) {
2754
2756
  await this.loadGraph(scope);
2755
2757
  const needle = query.toLowerCase().split(/\s+/);
2756
- const all = await this.list(scope, filePath);
2757
- const scored = all.map((entry) => {
2758
- const words = entry.text.toLowerCase().split(/\s+/);
2758
+ const scored = [];
2759
+ for (const node of this.nodes.values()) {
2760
+ if (node.entry.scope !== scope) continue;
2761
+ const words = node.entry.text.toLowerCase().split(/\s+/);
2759
2762
  let score = 0;
2760
2763
  for (const n of needle) {
2761
2764
  if (words.some((w) => w.includes(n))) score += 1;
2762
- if (entry.tags?.some((t) => t.toLowerCase().includes(n))) score += 2;
2763
- }
2764
- const node = this.nodes.get(this.nodeId(entry));
2765
- if (node) {
2766
- if (node.priority === "critical") score += 3;
2767
- else if (node.priority === "high") score += 2;
2768
- score += node.count * 0.5;
2765
+ if (node.entry.tags?.some((t) => t.toLowerCase().includes(n))) score += 2;
2769
2766
  }
2770
- return { entry, score };
2771
- });
2767
+ if (node.priority === "critical") score += 3;
2768
+ else if (node.priority === "high") score += 2;
2769
+ score += node.count * 0.5;
2770
+ if (score > 0) scored.push({ entry: node.entry, score });
2771
+ }
2772
2772
  scored.sort((a, b) => b.score - a.score);
2773
- const matched = scored.filter((s) => s.score > 0).map((s) => s.entry);
2773
+ const matched = scored.map((s) => s.entry);
2774
2774
  return limit ? matched.slice(0, limit) : matched;
2775
2775
  }
2776
2776
  async clear(scope, filePath) {
@@ -3343,6 +3343,7 @@ var BEHAVIOR_DEFAULTS = {
3343
3343
  modelsRegistry: true,
3344
3344
  skills: true
3345
3345
  },
3346
+ mcpServers: {},
3346
3347
  indexing: {
3347
3348
  onSessionStart: true,
3348
3349
  onEdit: true,
@@ -4676,11 +4677,11 @@ var ReplayLogStore = class {
4676
4677
  if (!entry.isFile() || !entry.name.endsWith(".replay.jsonl")) continue;
4677
4678
  const base = entry.name.slice(0, -".replay.jsonl".length);
4678
4679
  const sessionId = prefix ? `${prefix}/${base}` : base;
4679
- const all = await this.load(sessionId);
4680
+ const fp = path2.join(dir, entry.name);
4680
4681
  out.push({
4681
4682
  sessionId,
4682
- entryCount: all.length,
4683
- path: path2.join(dir, entry.name)
4683
+ entryCount: await this.countEntries(fp),
4684
+ path: fp
4684
4685
  });
4685
4686
  }
4686
4687
  };
@@ -4691,6 +4692,33 @@ var ReplayLogStore = class {
4691
4692
  filePath(sessionId) {
4692
4693
  return sessionScopedPath(this.dir, sessionId, ".replay.jsonl");
4693
4694
  }
4695
+ async countEntries(filePath) {
4696
+ const handle = await fsp.open(filePath, "r");
4697
+ const buffer = Buffer.allocUnsafe(64 * 1024);
4698
+ let count = 0;
4699
+ let hasNonWhitespace = false;
4700
+ try {
4701
+ while (true) {
4702
+ const { bytesRead } = await handle.read(buffer, 0, buffer.length, null);
4703
+ if (bytesRead === 0) break;
4704
+ for (let i = 0; i < bytesRead; i++) {
4705
+ const ch = buffer[i];
4706
+ if (ch === 10) {
4707
+ if (hasNonWhitespace) count++;
4708
+ hasNonWhitespace = false;
4709
+ continue;
4710
+ }
4711
+ if (ch !== 13 && ch !== 32 && ch !== 9) {
4712
+ hasNonWhitespace = true;
4713
+ }
4714
+ }
4715
+ }
4716
+ } finally {
4717
+ await handle.close();
4718
+ }
4719
+ if (hasNonWhitespace) count++;
4720
+ return count;
4721
+ }
4694
4722
  async readAll(sessionId) {
4695
4723
  const fp = this.filePath(sessionId);
4696
4724
  try {
@@ -5494,25 +5522,24 @@ var SessionRegistry = class {
5494
5522
  async heartbeat() {
5495
5523
  if (!this.currentSessionId) return;
5496
5524
  try {
5497
- const raw = await fsp.readFile(this.filePath, "utf8").catch(() => "{}");
5498
- const registry = JSON.parse(raw);
5499
- const entry = registry[this.currentSessionId];
5500
- if (entry) {
5501
- entry.lastHeartbeatAt = (/* @__PURE__ */ new Date()).toISOString();
5502
- if (entry.status !== "closing") {
5503
- const hasRunning = (entry.agents ?? []).some(
5504
- (a) => a.status === "running" || a.status === "streaming"
5505
- );
5506
- entry.status = hasRunning ? "active" : "idle";
5507
- }
5508
- await this.writeAtomic(registry);
5509
- } else if (this.lastEntry) {
5510
- await this.atomicUpdate((reg) => {
5511
- if (!reg[this.currentSessionId] && this.lastEntry) {
5512
- reg[this.currentSessionId] = { ...this.lastEntry, lastHeartbeatAt: (/* @__PURE__ */ new Date()).toISOString() };
5525
+ const sessionId = this.currentSessionId;
5526
+ const nowIso = (/* @__PURE__ */ new Date()).toISOString();
5527
+ await this.atomicUpdate((registry) => {
5528
+ const entry = registry[sessionId];
5529
+ if (entry) {
5530
+ entry.lastHeartbeatAt = nowIso;
5531
+ if (entry.status !== "closing") {
5532
+ const hasRunning = (entry.agents ?? []).some(
5533
+ (a) => a.status === "running" || a.status === "streaming"
5534
+ );
5535
+ entry.status = hasRunning ? "active" : "idle";
5513
5536
  }
5514
- });
5515
- }
5537
+ return;
5538
+ }
5539
+ if (this.lastEntry) {
5540
+ registry[sessionId] = { ...this.lastEntry, lastHeartbeatAt: nowIso };
5541
+ }
5542
+ });
5516
5543
  } catch {
5517
5544
  }
5518
5545
  }