@wrongstack/core 0.5.0 → 0.5.3

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 (44) hide show
  1. package/dist/{agent-bridge-BkjOkSkD.d.ts → agent-bridge-EiUFe3if.d.ts} +1 -1
  2. package/dist/{compactor-CTHjZAwf.d.ts → compactor-BP4xhKVi.d.ts} +1 -1
  3. package/dist/{config-DO2eCKgq.d.ts → config-BOD_HQBw.d.ts} +1 -1
  4. package/dist/{context-P207fTpo.d.ts → context-PH4DvBZV.d.ts} +49 -1
  5. package/dist/coordination/index.d.ts +9 -9
  6. package/dist/coordination/index.js +93 -2
  7. package/dist/coordination/index.js.map +1 -1
  8. package/dist/defaults/index.d.ts +18 -18
  9. package/dist/defaults/index.js +93 -2
  10. package/dist/defaults/index.js.map +1 -1
  11. package/dist/director-state-CVzkjKRZ.d.ts +539 -0
  12. package/dist/{events-DYAbU84e.d.ts → events-oxn-Wkub.d.ts} +18 -1
  13. package/dist/execution/index.d.ts +11 -11
  14. package/dist/extension/index.d.ts +6 -6
  15. package/dist/{index-BHL8QDCL.d.ts → index-CcbWbcpy.d.ts} +5 -5
  16. package/dist/{index-BNzUUDVR.d.ts → index-a12jc7-r.d.ts} +5 -5
  17. package/dist/index.d.ts +27 -25
  18. package/dist/index.js +266 -23
  19. package/dist/index.js.map +1 -1
  20. package/dist/infrastructure/index.d.ts +6 -6
  21. package/dist/kernel/index.d.ts +9 -9
  22. package/dist/kernel/index.js.map +1 -1
  23. package/dist/{mcp-servers-CLkhKdnF.d.ts → mcp-servers-uPmBxZ1B.d.ts} +3 -3
  24. package/dist/models/index.d.ts +2 -2
  25. package/dist/{multi-agent-B1Nn9eC0.d.ts → multi-agent-D6S4Z7H8.d.ts} +2 -2
  26. package/dist/observability/index.d.ts +2 -2
  27. package/dist/{path-resolver-mPccVA0l.d.ts → path-resolver-CprD5DhS.d.ts} +2 -2
  28. package/dist/{provider-runner-D7lHu07L.d.ts → provider-runner-DGisz_lG.d.ts} +3 -3
  29. package/dist/{retry-policy-CnYVKGPv.d.ts → retry-policy-DUJ8-Qc_.d.ts} +1 -1
  30. package/dist/sdd/index.d.ts +3 -3
  31. package/dist/{secret-scrubber-Buo9zLGs.d.ts → secret-scrubber-CB11A2P7.d.ts} +1 -1
  32. package/dist/{secret-scrubber-BSgec8CU.d.ts → secret-scrubber-EqFa0SyI.d.ts} +1 -1
  33. package/dist/security/index.d.ts +3 -3
  34. package/dist/{selector-B-CGOshv.d.ts → selector-yqyxt-Ii.d.ts} +1 -1
  35. package/dist/{session-reader-DmOEmSkq.d.ts → session-reader-1tOyoY1s.d.ts} +1 -1
  36. package/dist/session-rewinder-C9HnMkhP.d.ts +23 -0
  37. package/dist/storage/index.d.ts +21 -534
  38. package/dist/storage/index.js +246 -3
  39. package/dist/storage/index.js.map +1 -1
  40. package/dist/{system-prompt-CzY1zrbC.d.ts → system-prompt-BJlzKGO6.d.ts} +1 -1
  41. package/dist/{tool-executor-CYe5cp5U.d.ts → tool-executor-B6kRcWeF.d.ts} +4 -4
  42. package/dist/types/index.d.ts +16 -15
  43. package/dist/utils/index.d.ts +1 -1
  44. package/package.json +1 -1
@@ -1,35 +1,35 @@
1
1
  export { D as DefaultLogger, a as DefaultLoggerOptions } from '../logger-BH6AE0W9.js';
2
- export { AbandonedSession, AttachmentStoreOptions, ConfigLoaderOptions, ConfigMigration, ConfigMigrationError, ConfigSource, DEFAULT_CONFIG_MIGRATIONS, DefaultAttachmentStore, DefaultConfigLoader, DefaultConfigStore, DefaultMemoryStore, DefaultSessionStore, DirectorStateCheckpoint, DirectorStateSnapshot, DirectorSubagentState, DirectorTaskState, MemoryStoreOptions, MigrationContext, MigrationResult, PersistedQueueItem, PlanFile, PlanItem, QueueStore, RecoveryLock, RecoveryLockOptions, SessionAnalyzer, SessionStoreOptions, TodosCheckpointFile, addPlanItem, attachPlanCheckpoint, attachTodosCheckpoint, clearPlan, emptyPlan, formatPlan, loadDirectorState, loadPlan, loadTodosCheckpoint, removePlanItem, runConfigMigrations, savePlan, saveTodosCheckpoint, setPlanItemStatus } from '../storage/index.js';
3
- export { D as DefaultSessionReader } from '../session-reader-DmOEmSkq.js';
4
- 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-BSgec8CU.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, j as DirectorStateCheckpoint, k as DirectorStateSnapshot, l as DirectorSubagentState, m as DirectorTaskState, M as MemoryStoreOptions, n as MigrationContext, o as MigrationResult, P as PersistedQueueItem, p as PlanFile, q as PlanItem, Q as QueueStore, R as RecoveryLock, r as RecoveryLockOptions, S as SessionAnalyzer, s as SessionStoreOptions, T as TodosCheckpointFile, t as addPlanItem, u as attachPlanCheckpoint, v as attachTodosCheckpoint, w as clearPlan, x as emptyPlan, y as formatPlan, z as loadDirectorState, B as loadPlan, E as loadTodosCheckpoint, F as removePlanItem, G as runConfigMigrations, H as savePlan, I as saveTodosCheckpoint, J as setPlanItemStatus } from '../director-state-CVzkjKRZ.js';
3
+ export { D as DefaultSessionReader } from '../session-reader-1tOyoY1s.js';
4
+ 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-EqFa0SyI.js';
5
5
  export { AutoApprovePermissionPolicy, DefaultPermissionPolicy, PermissionPolicyOptions } from '../security/index.js';
6
- export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, T as ToolExecutor } from '../tool-executor-CYe5cp5U.js';
6
+ export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, T as ToolExecutor } from '../tool-executor-B6kRcWeF.js';
7
7
  export { AutoCompactionMiddleware, AutonomousRunner, AutonomousRunnerOptions, DefaultSkillLoader, DoneCheckResult, DoneConditionChecker, IntelligentCompactor, IntelligentCompactorOptions, SelectiveCompactor, SelectiveCompactorOptions, SkillLoaderOptions } from '../execution/index.js';
8
- import { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-D7lHu07L.js';
9
- import { j as Response } from '../context-P207fTpo.js';
10
- export { A as ALL_FLEET_AGENTS, a as AUDIT_LOG_AGENT, b as AgentFactory, c as AgentFactoryResult, d as AgentRunnerOptions, B as BUG_HUNTER_AGENT, C as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, e as DEFAULT_SUBAGENT_BASELINE, f as DefaultMultiAgentCoordinator, g as DelegateHost, h as Director, i as DirectorBudgetError, j as DirectorPromptParts, k as DirectorSessionFactory, l as DirectorSessionFactoryOptions, F as FLEET_ROSTER, m as FLEET_ROSTER_BUDGETS, n as FleetBus, o as FleetEvent, p as FleetHandler, q as FleetUsage, r as FleetUsageAggregator, M as MultiAgentCoordinatorOptions, R as REFACTOR_PLANNER_AGENT, S as SECURITY_SCANNER_AGENT, s as SubagentPromptParts, t as SubagentUsageSnapshot, u as applyRosterBudget, v as composeDirectorPrompt, w as composeSubagentPrompt, x as createDelegateTool, y as makeAgentSubagentRunner, z as makeDirectorSessionFactory, E as rosterSummaryFromConfigs } from '../index-BHL8QDCL.js';
11
- export { n as BudgetExceededError, o as BudgetKind, p as BudgetLimits, q as BudgetUsage, r as SubagentBudget } from '../multi-agent-B1Nn9eC0.js';
12
- export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-BkjOkSkD.js';
8
+ import { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-DGisz_lG.js';
9
+ import { j as Response } from '../context-PH4DvBZV.js';
10
+ export { A as ALL_FLEET_AGENTS, a as AUDIT_LOG_AGENT, b as AgentFactory, c as AgentFactoryResult, d as AgentRunnerOptions, B as BUG_HUNTER_AGENT, C as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, e as DEFAULT_SUBAGENT_BASELINE, f as DefaultMultiAgentCoordinator, g as DelegateHost, h as Director, i as DirectorBudgetError, j as DirectorPromptParts, k as DirectorSessionFactory, l as DirectorSessionFactoryOptions, F as FLEET_ROSTER, m as FLEET_ROSTER_BUDGETS, n as FleetBus, o as FleetEvent, p as FleetHandler, q as FleetUsage, r as FleetUsageAggregator, M as MultiAgentCoordinatorOptions, R as REFACTOR_PLANNER_AGENT, S as SECURITY_SCANNER_AGENT, s as SubagentPromptParts, t as SubagentUsageSnapshot, u as applyRosterBudget, v as composeDirectorPrompt, w as composeSubagentPrompt, x as createDelegateTool, y as makeAgentSubagentRunner, z as makeDirectorSessionFactory, E as rosterSummaryFromConfigs } from '../index-CcbWbcpy.js';
11
+ export { n as BudgetExceededError, o as BudgetKind, p as BudgetLimits, q as BudgetUsage, r as SubagentBudget } from '../multi-agent-D6S4Z7H8.js';
12
+ export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-EiUFe3if.js';
13
13
  export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from '../models-registry-DqzwpBQy.js';
14
14
  export { DefaultModeStore, LLMSelector, LLMSelectorOptions, ModeLoaderOptions, loadProjectModes, loadUserModes } from '../models/index.js';
15
15
  export { AISpecBuilder, AISpecBuilderOptions, AISpecPhase, AISpecSession, AutoExecutor, AutoExecutorOptions, BottleneckTask, CollectedAnswer, CriticalPathAnalysis, DefaultTaskStore, ExecutionSummary, GeneratedTask, SPEC_TEMPLATES, SpecDiff, SpecDrivenDev, SpecDrivenDevOptions, SpecIndexEntry, SpecParser, SpecStore, SpecStoreOptions, SpecVersion, SpecVersioning, TaskExecutionContext, TaskExecutionResult, TaskFlow, TaskFlowEventMap, TaskFlowEventName, TaskFlowExecutionContext, TaskFlowOptions, TaskFlowPhase, TaskGenerator, TaskGeneratorOptions, TaskGraphIndexEntry, TaskGraphStore, TaskGraphStoreOptions, TaskStore, TaskTracker, TaskTrackerOptions, TaskTransition, analyzeCriticalPath, createAutoExecutor, getTemplate, listTemplates, renderProgress, renderSpecAnalysis, renderTaskGraph, renderTaskList, templateToMarkdown } from '../sdd/index.js';
16
16
  export { DefaultHealthRegistry, InMemoryMetricsSink, MetricsServerHandle, MetricsServerOptions, NoopMetricsSink, NoopTracer, OTelTracer, OtlpMetricsExporterHandle, OtlpMetricsExporterOptions, OtlpTraceExporterHandle, OtlpTraceExporterOptions, PROMETHEUS_CONTENT_TYPE, buildOtlpMetricsRequest, buildOtlpTracesRequest, renderPrometheus, startMetricsServer, startOtlpMetricsExporter, startOtlpTraceExporter, wireMetricsToEvents } from '../observability/index.js';
17
- 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-CLkhKdnF.js';
17
+ 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-uPmBxZ1B.js';
18
18
  import '../logger-BMQgxvdy.js';
19
- import '../events-DYAbU84e.js';
19
+ import '../events-oxn-Wkub.js';
20
20
  import '../memory-CEXuo7sz.js';
21
21
  import '../wstack-paths-BGu2INTm.js';
22
- import '../config-DO2eCKgq.js';
22
+ import '../config-BOD_HQBw.js';
23
23
  import '../models-registry-Y2xbog0E.js';
24
24
  import '../secret-vault-DoISxaKO.js';
25
- import '../secret-scrubber-Buo9zLGs.js';
25
+ import '../secret-scrubber-CB11A2P7.js';
26
26
  import '../input-reader-E-ffP2ee.js';
27
- import '../compactor-CTHjZAwf.js';
28
- import '../retry-policy-CnYVKGPv.js';
29
- import '../index-BNzUUDVR.js';
30
- import '../system-prompt-CzY1zrbC.js';
27
+ import '../compactor-BP4xhKVi.js';
28
+ import '../retry-policy-DUJ8-Qc_.js';
29
+ import '../index-a12jc7-r.js';
30
+ import '../system-prompt-BJlzKGO6.js';
31
31
  import '../observability-BhnVLBLS.js';
32
- import '../selector-B-CGOshv.js';
32
+ import '../selector-yqyxt-Ii.js';
33
33
  import '../skill-CxuWrsKK.js';
34
34
  import 'node:events';
35
35
  import '../mode-CV077NjV.js';
@@ -309,7 +309,7 @@ var DefaultSessionStore = class {
309
309
  );
310
310
  }
311
311
  try {
312
- return new FileSessionWriter(id, handle, startedAt, meta, { dir: this.dir, filePath: file });
312
+ return new FileSessionWriter(id, handle, startedAt, meta, this.events, { dir: this.dir, filePath: file });
313
313
  } catch (err) {
314
314
  await handle.close().catch(() => {
315
315
  });
@@ -337,6 +337,7 @@ var DefaultSessionStore = class {
337
337
  model: data.metadata.model,
338
338
  provider: data.metadata.provider
339
339
  },
340
+ this.events,
340
341
  { resumed: true, dir: this.dir, filePath: file }
341
342
  );
342
343
  return { writer, data };
@@ -500,11 +501,12 @@ var DefaultSessionStore = class {
500
501
  }
501
502
  };
502
503
  var FileSessionWriter = class {
503
- constructor(id, handle, startedAt, meta, opts = {}) {
504
+ constructor(id, handle, startedAt, meta, events, opts = {}) {
504
505
  this.id = id;
505
506
  this.handle = handle;
506
507
  this.startedAt = startedAt;
507
508
  this.meta = meta;
509
+ this.events = events;
508
510
  this.resumed = opts.resumed ?? false;
509
511
  this.manifestFile = opts.dir ? path3.join(opts.dir, `${id}.summary.json`) : "";
510
512
  this.filePath = opts.filePath ?? "";
@@ -521,6 +523,7 @@ var FileSessionWriter = class {
521
523
  handle;
522
524
  startedAt;
523
525
  meta;
526
+ events;
524
527
  closed = false;
525
528
  closing = false;
526
529
  manifestFile;
@@ -538,6 +541,13 @@ var FileSessionWriter = class {
538
541
  resumed;
539
542
  appendFailCount = 0;
540
543
  lastAppendWarnAt = 0;
544
+ // Rewind support: track pending file changes and prompt index
545
+ promptIndex = 0;
546
+ pendingFileSnapshots = [];
547
+ // Register a pending file change. Call recordFileChange() from tools.
548
+ recordFileChange(input) {
549
+ this.pendingFileSnapshots.push(input);
550
+ }
541
551
  async writeSessionStartLazy() {
542
552
  const record = `${JSON.stringify({
543
553
  type: this.resumed ? "session_resumed" : "session_start",
@@ -613,6 +623,87 @@ var FileSessionWriter = class {
613
623
  } catch {
614
624
  }
615
625
  }
626
+ async writeCheckpoint(promptIndex, promptPreview) {
627
+ const fileCount = this.pendingFileSnapshots.length;
628
+ if (fileCount > 0) {
629
+ await this.writeFileSnapshot(promptIndex, [...this.pendingFileSnapshots]);
630
+ this.pendingFileSnapshots = [];
631
+ }
632
+ this.promptIndex = promptIndex + 1;
633
+ await this.append({
634
+ type: "checkpoint",
635
+ ts: (/* @__PURE__ */ new Date()).toISOString(),
636
+ promptIndex,
637
+ promptPreview
638
+ });
639
+ this.events?.emit("checkpoint.written", {
640
+ promptIndex,
641
+ promptPreview,
642
+ ts: (/* @__PURE__ */ new Date()).toISOString(),
643
+ fileCount
644
+ });
645
+ }
646
+ async writeFileSnapshot(promptIndex, files) {
647
+ await this.append({
648
+ type: "file_snapshot",
649
+ ts: (/* @__PURE__ */ new Date()).toISOString(),
650
+ promptIndex,
651
+ files
652
+ });
653
+ }
654
+ async truncateToCheckpoint(targetPromptIndex) {
655
+ if (!this.filePath) return 0;
656
+ const raw = await fsp.readFile(this.filePath, "utf8");
657
+ const lines = raw.split("\n");
658
+ const kept = [];
659
+ let removedCount = 0;
660
+ let targetCheckpointLine = -1;
661
+ let afterTarget = false;
662
+ for (let i = 0; i < lines.length; i++) {
663
+ const line = lines[i];
664
+ if (!line.trim()) continue;
665
+ let event;
666
+ try {
667
+ event = JSON.parse(line);
668
+ } catch {
669
+ kept.push(line);
670
+ continue;
671
+ }
672
+ if (event.type === "checkpoint") {
673
+ if (event.promptIndex === targetPromptIndex) {
674
+ targetCheckpointLine = kept.length;
675
+ afterTarget = true;
676
+ } else if (event.promptIndex > targetPromptIndex) {
677
+ afterTarget = true;
678
+ }
679
+ }
680
+ if (event.promptIndex !== void 0 && event.promptIndex > targetPromptIndex) {
681
+ removedCount++;
682
+ } else if (event.promptIndex === void 0) {
683
+ if (!afterTarget || targetCheckpointLine === -1) {
684
+ kept.push(line);
685
+ } else {
686
+ removedCount++;
687
+ }
688
+ } else {
689
+ kept.push(line);
690
+ }
691
+ }
692
+ const truncated = kept.join("\n");
693
+ await fsp.writeFile(this.filePath, truncated + "\n", "utf8");
694
+ await this.append({
695
+ type: "rewound",
696
+ ts: (/* @__PURE__ */ new Date()).toISOString(),
697
+ toPromptIndex: targetPromptIndex,
698
+ revertedFiles: []
699
+ });
700
+ this.events?.emit("session.rewound", {
701
+ toPromptIndex: targetPromptIndex,
702
+ revertedFiles: [],
703
+ removedEvents: removedCount
704
+ });
705
+ return removedCount;
706
+ }
616
707
  };
617
708
  function userInputTitle(content) {
618
709
  if (typeof content === "string") return content.slice(0, 60);