@wrongstack/core 0.89.3 → 0.107.2

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 (51) hide show
  1. package/dist/{agent-bridge-DbVe1dHT.d.ts → agent-bridge-mOxbpFcg.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-C6eqID1t.d.ts → agent-subagent-runner-DukQLUcS.d.ts} +5 -5
  3. package/dist/{brain-s9DyD_Vf.d.ts → brain-Dfv4Y82E.d.ts} +1 -1
  4. package/dist/{config-84VaZpH6.d.ts → config-BSU-6vah.d.ts} +1 -1
  5. package/dist/coordination/index.d.ts +9 -9
  6. package/dist/coordination/index.js +103 -0
  7. package/dist/coordination/index.js.map +1 -1
  8. package/dist/defaults/index.d.ts +18 -17
  9. package/dist/defaults/index.js +276 -12
  10. package/dist/defaults/index.js.map +1 -1
  11. package/dist/execution/index.d.ts +61 -365
  12. package/dist/execution/index.js +423 -8
  13. package/dist/execution/index.js.map +1 -1
  14. package/dist/extension/index.d.ts +4 -4
  15. package/dist/goal-preamble-CI8lxeY1.d.ts +378 -0
  16. package/dist/{goal-store-DvWLNu52.d.ts → goal-store-ht0VmR1A.d.ts} +63 -21
  17. package/dist/{index-CqrroYcU.d.ts → index-BWRN6wOb.d.ts} +5 -5
  18. package/dist/{index-D3Nax3YU.d.ts → index-DIKEcfgC.d.ts} +3 -3
  19. package/dist/index.d.ts +31 -29
  20. package/dist/index.js +530 -53
  21. package/dist/index.js.map +1 -1
  22. package/dist/infrastructure/index.d.ts +4 -4
  23. package/dist/kernel/index.d.ts +6 -6
  24. package/dist/{mcp-servers-D3E5ixAR.d.ts → mcp-servers-CXCsANdY.d.ts} +1 -1
  25. package/dist/{multi-agent-coordinator-DHNrjPaA.d.ts → multi-agent-coordinator-51LvnXkD.d.ts} +1 -1
  26. package/dist/{null-fleet-bus-BzzciAc4.d.ts → null-fleet-bus-D09hMzFQ.d.ts} +5 -5
  27. package/dist/observability/index.d.ts +1 -1
  28. package/dist/{parallel-eternal-engine-CTpcrb9O.d.ts → parallel-eternal-engine-CUtmM_0V.d.ts} +24 -5
  29. package/dist/{path-resolver-B7hgMAVe.d.ts → path-resolver-DDJiMAtX.d.ts} +1 -1
  30. package/dist/{pipeline-C1Ad9OjI.d.ts → pipeline-BqiA_UMr.d.ts} +2 -2
  31. package/dist/{plan-templates-CNphsz0n.d.ts → plan-templates-BdDxl9cI.d.ts} +2 -2
  32. package/dist/{provider-runner-cqvlB_oS.d.ts → provider-runner-BUunikwY.d.ts} +1 -1
  33. package/dist/sdd/index.d.ts +11 -6
  34. package/dist/sdd/index.js +124 -5
  35. package/dist/sdd/index.js.map +1 -1
  36. package/dist/{session-event-bridge-IVzs2GpE.d.ts → session-event-bridge-BpJ5trO9.d.ts} +1 -1
  37. package/dist/{skill-BJxzIyyN.d.ts → skill-Bj6Ezqb8.d.ts} +1 -1
  38. package/dist/skills/index.d.ts +1 -1
  39. package/dist/spec-TBi3Jr6T.d.ts +78 -0
  40. package/dist/storage/index.d.ts +21 -9
  41. package/dist/storage/index.js +157 -14
  42. package/dist/storage/index.js.map +1 -1
  43. package/dist/task-format-vGOIftmK.d.ts +23 -0
  44. package/dist/task-graph-u1q9Jkyk.d.ts +84 -0
  45. package/dist/types/index.d.ts +15 -14
  46. package/dist/utils/index.d.ts +3 -1
  47. package/dist/utils/index.js +110 -1
  48. package/dist/utils/index.js.map +1 -1
  49. package/package.json +1 -1
  50. package/skills/tech-stack/SKILL.md +177 -0
  51. package/dist/task-graph-DJBqO0EY.d.ts +0 -161
@@ -90,4 +90,4 @@ declare function resolveSessionLoggingConfig(cfg?: {
90
90
  };
91
91
  };
92
92
 
93
- export { type AuditLevel as A, CORE_RECONSTRUCT_EVENTS as C, STANDARD_AUDIT_EVENTS as S, type ToolProgressSamplingOptions as T, type SessionEventBridge as a, type SessionEventBridgeOptions as b, type SessionSamplingOptions as c, createSessionEventBridge as d, resolveSessionLoggingConfig as e, resolveAuditLevel as r };
93
+ export { type AuditLevel as A, CORE_RECONSTRUCT_EVENTS as C, type SessionEventBridge as S, type ToolProgressSamplingOptions as T, STANDARD_AUDIT_EVENTS as a, type SessionEventBridgeOptions as b, type SessionSamplingOptions as c, createSessionEventBridge as d, resolveSessionLoggingConfig as e, resolveAuditLevel as r };
@@ -26,4 +26,4 @@ interface SkillLoader {
26
26
  invalidateCache(): void;
27
27
  }
28
28
 
29
- export type { SkillLoader as S, SkillEntry as a, SkillManifest as b };
29
+ export type { SkillLoader as S, SkillManifest as a, SkillEntry as b };
@@ -1,4 +1,4 @@
1
- import { S as SkillLoader } from '../skill-BJxzIyyN.js';
1
+ import { S as SkillLoader } from '../skill-Bj6Ezqb8.js';
2
2
 
3
3
  interface InstalledSkillEntry {
4
4
  name: string;
@@ -0,0 +1,78 @@
1
+ type SpecStatus = 'draft' | 'review' | 'approved' | 'implemented' | 'deprecated';
2
+ type SpecSectionType = 'overview' | 'requirements' | 'architecture' | 'api' | 'data' | 'security' | 'acceptance';
3
+ interface SpecSection {
4
+ type: SpecSectionType;
5
+ title: string;
6
+ content: string;
7
+ level: number;
8
+ children?: SpecSection[] | undefined;
9
+ }
10
+ interface SpecRequirement {
11
+ id: string;
12
+ type: 'functional' | 'non-functional' | 'security' | 'performance' | 'ux';
13
+ priority: 'critical' | 'high' | 'medium' | 'low';
14
+ description: string;
15
+ acceptanceCriteria: string[];
16
+ blockedBy?: string[] | undefined;
17
+ implements?: string[] | undefined;
18
+ }
19
+ interface SpecApiEndpoint {
20
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
21
+ path: string;
22
+ description: string;
23
+ request?: Record<string, unknown>;
24
+ response?: Record<string, unknown>;
25
+ auth?: boolean | undefined;
26
+ }
27
+ interface Specification {
28
+ id: string;
29
+ title: string;
30
+ version: string;
31
+ status: SpecStatus;
32
+ overview: string;
33
+ sections: SpecSection[];
34
+ requirements: SpecRequirement[];
35
+ apiEndpoints?: SpecApiEndpoint[] | undefined;
36
+ dependencies?: string[] | undefined;
37
+ createdAt: number;
38
+ updatedAt: number;
39
+ metadata?: Record<string, unknown>;
40
+ }
41
+ interface SpecAnalysis {
42
+ specId: string;
43
+ completeness: number;
44
+ coverage: {
45
+ requirements: number;
46
+ apiEndpoints: number;
47
+ edgeCases: number;
48
+ errorHandling: number;
49
+ };
50
+ gaps: string[];
51
+ risks: {
52
+ requirement: string;
53
+ risk: string;
54
+ severity: 'high' | 'medium' | 'low';
55
+ }[];
56
+ suggestions: string[];
57
+ }
58
+ interface SpecValidationResult {
59
+ valid: boolean;
60
+ errors: {
61
+ path: string;
62
+ message: string;
63
+ }[];
64
+ warnings: {
65
+ path: string;
66
+ message: string;
67
+ }[];
68
+ }
69
+ interface SpecTemplate {
70
+ id: string;
71
+ name: string;
72
+ description: string;
73
+ sections: Omit<SpecSection, 'content'>[];
74
+ defaultRequirements: Omit<SpecRequirement, 'id' | 'description'>[];
75
+ }
76
+ declare const DEFAULT_SPEC_TEMPLATE: SpecTemplate;
77
+
78
+ export { DEFAULT_SPEC_TEMPLATE as D, type SpecAnalysis as S, type SpecApiEndpoint as a, type SpecRequirement as b, type SpecSection as c, type SpecSectionType as d, type SpecStatus as e, type SpecTemplate as f, type SpecValidationResult as g, type Specification as h };
@@ -1,21 +1,23 @@
1
- import { M as MemoryBackend, j as FileMemoryBackendOptions } from '../plan-templates-CNphsz0n.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-CNphsz0n.js';
3
- import { M as MemoryScope, k as MemoryEntry, l as MemoryStore } from '../brain-s9DyD_Vf.js';
4
- import { l as AgentExtension, j as AfterRunHook } from '../index-D3Nax3YU.js';
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
5
  import { P as Provider, R as Request, b as Response, S as SessionEvent } from '../context-CNRYfhUv.js';
6
6
  export { D as DefaultSessionReader, f as DefaultSessionReaderOptions, S as SessionReader } from '../session-reader-DDz1Ek4V.js';
7
7
  import { S as SessionRewinder, C as CheckpointInfo, a as RewindResultExtended } from '../session-rewinder-C9HnMkhP.js';
8
+ import { T as TaskItem } from '../task-format-vGOIftmK.js';
8
9
  export { a as DirectorStateCheckpoint, D as DirectorStateSnapshot, b as DirectorSubagentState, c as DirectorTaskState, l as loadDirectorState } from '../director-state-BfeCUbmk.js';
9
- export { G as GoalFile, J as JournalEntry, M as MAX_JOURNAL_ENTRIES, a as appendJournal, e as emptyGoal, f as formatGoal, g as goalFilePath, l as loadGoal, s as saveGoal, b as summarizeUsage } from '../goal-store-DvWLNu52.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-ht0VmR1A.js';
10
11
  import { W as WstackPaths } from '../wstack-paths-_lqjzErq.js';
11
- import { w as SyncCategory, e as SyncConfig } from '../config-84VaZpH6.js';
12
- export { A as AuditLevel, C as CORE_RECONSTRUCT_EVENTS, S as STANDARD_AUDIT_EVENTS, a as SessionEventBridge, b as SessionEventBridgeOptions, c as SessionSamplingOptions, T as ToolProgressSamplingOptions, d as createSessionEventBridge, r as resolveAuditLevel, e as resolveSessionLoggingConfig } from '../session-event-bridge-IVzs2GpE.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';
13
14
  import '../permission-BDv7z0mk.js';
14
15
  import '../secret-vault-DoISxaKO.js';
15
16
  import '../logger-B63L5bTg.js';
16
- import '../pipeline-C1Ad9OjI.js';
17
+ import '../pipeline-BqiA_UMr.js';
17
18
  import '../observability-D-HZN_mF.js';
18
19
  import '../models-registry-B6_KfS65.js';
20
+ import '../task-graph-u1q9Jkyk.js';
19
21
 
20
22
  interface GraphNode {
21
23
  id: string;
@@ -555,6 +557,16 @@ declare class DefaultSessionRewinder implements SessionRewinder {
555
557
  rewindToStart(sessionId: string): Promise<RewindResultExtended>;
556
558
  }
557
559
 
560
+ interface TaskFile {
561
+ version: 1;
562
+ sessionId: string;
563
+ updatedAt: string;
564
+ tasks: TaskItem[];
565
+ }
566
+ declare function emptyTaskFile(sessionId: string): TaskFile;
567
+ declare function loadTasks(filePath: string): Promise<TaskFile | null>;
568
+ declare function saveTasks(filePath: string, tasks: TaskFile): Promise<void>;
569
+
558
570
  interface PromptEntry {
559
571
  id: string;
560
572
  title: string;
@@ -624,4 +636,4 @@ declare class CloudSync {
624
636
  private walkDir;
625
637
  }
626
638
 
627
- export { ALL_SYNC_CATEGORIES, type Annotation, AnnotationsStore, type AnnotationsStoreOptions, type AuditEntry, CloudSync, type ConsolidationOp, DefaultPromptStore, DefaultSessionRewinder, FileMemoryBackendOptions, GraphMemoryBackend, type GraphMemoryBackendOptions, MemoryBackend, type MemoryConsolidatorOptions, type PromptEntry, type PromptStore, type RecoveryPlan, type ReplayEntry, ReplayLogStore, type ReplayLogStoreOptions, SessionMemoryConsolidator, SessionRecovery, type SessionRewinderOptions, type StaleSession, SyncCategory, SyncConfig, type SyncResult, ToolAuditLog, type ToolAuditLogOptions, type VerifyResult };
639
+ export { ALL_SYNC_CATEGORIES, type Annotation, AnnotationsStore, type AnnotationsStoreOptions, type AuditEntry, CloudSync, type ConsolidationOp, DefaultPromptStore, DefaultSessionRewinder, FileMemoryBackendOptions, GraphMemoryBackend, type GraphMemoryBackendOptions, MemoryBackend, type MemoryConsolidatorOptions, type PromptEntry, type PromptStore, type RecoveryPlan, type ReplayEntry, ReplayLogStore, type ReplayLogStoreOptions, SessionMemoryConsolidator, SessionRecovery, type SessionRewinderOptions, type StaleSession, SyncCategory, SyncConfig, type SyncResult, type TaskFile, ToolAuditLog, type ToolAuditLogOptions, type VerifyResult, emptyTaskFile, loadTasks, saveTasks };
@@ -4310,6 +4310,40 @@ ${cat}:`);
4310
4310
  }
4311
4311
  return lines.join("\n");
4312
4312
  }
4313
+ function emptyTaskFile(sessionId) {
4314
+ return {
4315
+ version: 1,
4316
+ sessionId,
4317
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
4318
+ tasks: []
4319
+ };
4320
+ }
4321
+ async function loadTasks(filePath) {
4322
+ let raw;
4323
+ try {
4324
+ raw = await fsp.readFile(filePath, "utf8");
4325
+ } catch {
4326
+ return null;
4327
+ }
4328
+ try {
4329
+ const parsed = JSON.parse(raw);
4330
+ if (parsed?.version !== 1 || !Array.isArray(parsed.tasks)) return null;
4331
+ return parsed;
4332
+ } catch {
4333
+ return null;
4334
+ }
4335
+ }
4336
+ async function saveTasks(filePath, tasks) {
4337
+ try {
4338
+ tasks.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
4339
+ await atomicWrite(filePath, JSON.stringify(tasks, null, 2), { mode: 384 });
4340
+ } catch (err) {
4341
+ console.warn(
4342
+ "[task-store] save failed:",
4343
+ err instanceof Error ? err.message : String(err)
4344
+ );
4345
+ }
4346
+ }
4313
4347
  async function loadDirectorState(filePath) {
4314
4348
  let raw;
4315
4349
  try {
@@ -4489,6 +4523,44 @@ var DirectorStateCheckpoint = class {
4489
4523
  }
4490
4524
  };
4491
4525
 
4526
+ // src/utils/term.ts
4527
+ var hasStdout = () => typeof process !== "undefined" && !!process.stdout;
4528
+ function isStdoutTTY() {
4529
+ return hasStdout() && Boolean(process.stdout.isTTY);
4530
+ }
4531
+
4532
+ // src/utils/color.ts
4533
+ var isColorTty = () => {
4534
+ if (envFlag(process.env.NO_COLOR)) return false;
4535
+ if (envFlag(process.env.FORCE_COLOR)) return true;
4536
+ return isStdoutTTY();
4537
+ };
4538
+ function envFlag(value) {
4539
+ if (value === void 0) return false;
4540
+ if (value.trim() === "") return false;
4541
+ return !/^(0|false|no|off)$/i.test(value.trim());
4542
+ }
4543
+ var COLOR = isColorTty();
4544
+ var wrap = (open5, close) => (s) => COLOR ? `\x1B[${open5}m${s}\x1B[${close}m` : s;
4545
+ var color = {
4546
+ reset: wrap("0", "0"),
4547
+ bold: wrap("1", "22"),
4548
+ dim: wrap("2", "22"),
4549
+ italic: wrap("3", "23"),
4550
+ underline: wrap("4", "24"),
4551
+ red: wrap("31", "39"),
4552
+ green: wrap("32", "39"),
4553
+ yellow: wrap("33", "39"),
4554
+ blue: wrap("34", "39"),
4555
+ magenta: wrap("35", "39"),
4556
+ cyan: wrap("36", "39"),
4557
+ gray: wrap("90", "39"),
4558
+ amber: wrap("38;5;214", "39"),
4559
+ pink: wrap("38;5;205", "39"),
4560
+ bgRed: wrap("41", "49"),
4561
+ bgGreen: wrap("42", "49")
4562
+ };
4563
+
4492
4564
  // src/types/errors.ts
4493
4565
  var ERROR_CODES = {
4494
4566
  // File system
@@ -4588,6 +4660,14 @@ function emptyGoal(goal) {
4588
4660
  journal: []
4589
4661
  };
4590
4662
  }
4663
+ function setProgress(goal, progress, note) {
4664
+ const clamped = Math.min(100, Math.max(0, progress));
4665
+ return {
4666
+ ...goal,
4667
+ progress: clamped,
4668
+ progressNote: note ?? clamped + "% complete"
4669
+ };
4670
+ }
4591
4671
  function appendJournal(goal, entry) {
4592
4672
  const iteration = goal.iterations + 1;
4593
4673
  const at = (/* @__PURE__ */ new Date()).toISOString();
@@ -4616,34 +4696,97 @@ function summarizeUsage(goal) {
4616
4696
  }
4617
4697
  return { totalCostUsd, totalInputTokens, totalOutputTokens, iterationsWithUsage };
4618
4698
  }
4699
+ var DOLLAR = "$";
4619
4700
  function formatGoal(goal, journalLimit = 10) {
4620
4701
  const lines = [];
4621
- lines.push(`Goal: ${goal.goal}`);
4622
- lines.push(`Set: ${goal.setAt}`);
4623
- lines.push(`Last activity: ${goal.lastActivityAt}`);
4624
- lines.push(`Iterations: ${goal.iterations}`);
4702
+ const displayGoal = goal.refinedGoal || goal.goal;
4703
+ lines.push(color.bold("Goal") + ": " + displayGoal);
4704
+ if (goal.refinedGoal && goal.refinedGoal !== goal.goal) {
4705
+ const snippet = goal.goal.length > 60 ? goal.goal.slice(0, 60) + "\u2026" : goal.goal;
4706
+ lines.push(color.dim(' (original: "' + snippet + '")'));
4707
+ }
4708
+ if (typeof goal.progress === "number") {
4709
+ const pct = Math.min(100, Math.max(0, Math.round(goal.progress)));
4710
+ const filled = Math.round(pct / 5);
4711
+ const empty = 20 - filled;
4712
+ const bar = color.green("\u2588".repeat(filled)) + color.dim("\u2591".repeat(empty));
4713
+ lines.push("Progress: " + bar + " " + color.bold(pct + "%"));
4714
+ if (goal.progressNote) {
4715
+ lines.push(" " + color.dim(goal.progressNote));
4716
+ }
4717
+ if (goal.progressTrend) {
4718
+ const trendIcon = goal.progressTrend === "accelerating" ? "\u{1F680}" : goal.progressTrend === "stalling" ? "\u26A0\uFE0F" : "\u27A1\uFE0F";
4719
+ lines.push(" Trend: " + trendIcon + " " + goal.progressTrend);
4720
+ }
4721
+ }
4722
+ if (goal.deliverables && goal.deliverables.length > 0) {
4723
+ lines.push("");
4724
+ lines.push(color.bold("Deliverables:"));
4725
+ for (const d of goal.deliverables) {
4726
+ const done = /^\[[x✓]\]|✅|\(done\)/i.test(d);
4727
+ const marker = done ? color.green("\u2713") : color.dim("\u25CB");
4728
+ lines.push(" " + marker + " " + d);
4729
+ }
4730
+ }
4731
+ lines.push("");
4732
+ lines.push("Set: " + goal.setAt);
4733
+ lines.push("Last activity: " + goal.lastActivityAt);
4734
+ lines.push("Iterations: " + goal.iterations);
4625
4735
  const stateLabel = goal.goalState ?? "active";
4626
- lines.push(`State: ${stateLabel}${goal.iterations > 0 ? ` (iteration #${goal.iterations})` : ""}`);
4627
- lines.push(`Engine: ${goal.engineState}`);
4736
+ lines.push("State: " + stateLabel + (goal.iterations > 0 ? " (iteration #" + goal.iterations + ")" : ""));
4737
+ lines.push("Engine: " + goal.engineState);
4628
4738
  const usage = summarizeUsage(goal);
4629
4739
  if (usage.iterationsWithUsage > 0) {
4630
- lines.push(
4631
- `Spent: $${usage.totalCostUsd.toFixed(4)} (in ${usage.totalInputTokens} / out ${usage.totalOutputTokens} tokens across ${usage.iterationsWithUsage} iterations)`
4632
- );
4740
+ const spent = "Spent: " + DOLLAR + usage.totalCostUsd.toFixed(4) + " (in " + usage.totalInputTokens + " / out " + usage.totalOutputTokens + " tokens across " + usage.iterationsWithUsage + " iterations)";
4741
+ lines.push(spent);
4633
4742
  }
4634
4743
  if (goal.journal.length > 0) {
4635
4744
  lines.push("");
4636
- lines.push(`Recent journal (last ${Math.min(journalLimit, goal.journal.length)}):`);
4745
+ lines.push("Recent journal (last " + Math.min(journalLimit, goal.journal.length) + "):");
4637
4746
  const tail = goal.journal.slice(-journalLimit);
4638
4747
  for (const e of tail) {
4639
4748
  const mark = e.status === "success" ? "\u2713" : e.status === "failure" ? "\u2717" : e.status === "aborted" ? "\u2298" : "\xB7";
4640
- const note = e.note ? ` \u2014 ${e.note}` : "";
4641
- const cost = typeof e.costUsd === "number" ? ` ($${e.costUsd.toFixed(4)})` : "";
4642
- lines.push(` #${e.iteration} ${mark} [${e.source}] ${e.task}${cost}${note}`);
4749
+ const note = e.note ? " \u2014 " + e.note : "";
4750
+ const cost = typeof e.costUsd === "number" ? " (" + DOLLAR + e.costUsd.toFixed(4) + ")" : "";
4751
+ lines.push(" #" + e.iteration + " " + mark + " [" + e.source + "] " + e.task + cost + note);
4643
4752
  }
4644
4753
  }
4645
4754
  return lines.join("\n");
4646
4755
  }
4756
+ function parseProgressFromText(text) {
4757
+ const re = /\[progress:\s*(\d{1,3})%\]\s*(?:[—\-]\s*(.+))?/i;
4758
+ const m = text.match(re);
4759
+ if (!m) return null;
4760
+ const progress = Math.min(100, Math.max(0, Number.parseInt(m[1], 10)));
4761
+ const note = m[2]?.trim() || void 0;
4762
+ return { progress, note };
4763
+ }
4764
+ function recordProgress(goal, progress, note) {
4765
+ const clamped = Math.min(100, Math.max(0, progress));
4766
+ const history = [...goal.progressHistory ?? [], { at: (/* @__PURE__ */ new Date()).toISOString(), progress: clamped, note }];
4767
+ const trimmed = history.length > 200 ? history.slice(-200) : history;
4768
+ return {
4769
+ ...goal,
4770
+ progress: clamped,
4771
+ progressNote: note ?? `${clamped}% complete`,
4772
+ progressHistory: trimmed,
4773
+ progressTrend: computeTrend(trimmed)
4774
+ };
4775
+ }
4776
+ var MAX_PROGRESS_HISTORY = 200;
4777
+ function computeTrend(history) {
4778
+ if (history.length < 3) return void 0;
4779
+ const recent = history.slice(-5);
4780
+ const deltas = [];
4781
+ for (let i = 1; i < recent.length; i++) {
4782
+ deltas.push(recent[i].progress - recent[i - 1].progress);
4783
+ }
4784
+ if (deltas.length < 2) return void 0;
4785
+ const avgDelta = deltas.reduce((a, b) => a + b, 0) / deltas.length;
4786
+ if (avgDelta > 2) return "accelerating";
4787
+ if (avgDelta < -1) return "stalling";
4788
+ return "steady";
4789
+ }
4647
4790
  var DefaultPromptStore = class {
4648
4791
  dir;
4649
4792
  constructor(paths) {
@@ -5127,6 +5270,6 @@ function resolveSessionLoggingConfig(cfg) {
5127
5270
  };
5128
5271
  }
5129
5272
 
5130
- export { ALL_SYNC_CATEGORIES, AnnotationsStore, CORE_RECONSTRUCT_EVENTS, CloudSync, ConfigMigrationError, DEFAULT_CONFIG_MIGRATIONS, DefaultAttachmentStore, DefaultConfigLoader, DefaultConfigStore, DefaultMemoryStore, DefaultPromptStore, DefaultSessionReader, DefaultSessionRewinder, DefaultSessionStore, DirectorStateCheckpoint, FileMemoryBackend, GraphMemoryBackend, MAX_JOURNAL_ENTRIES, QueueStore, RecoveryLock, ReplayLogStore, STANDARD_AUDIT_EVENTS, SessionAnalyzer, SessionMemoryConsolidator, SessionRecovery, ToolAuditLog, addPlanItem, appendJournal, attachPlanCheckpoint, attachTodosCheckpoint, clearPlan, createSessionEventBridge, deriveTodosFromPlanItem, emptyGoal, emptyPlan, formatGoal, formatPlan, formatPlanTemplates, getPlanTemplate, goalFilePath, listPlanTemplates, loadDirectorState, loadGoal, loadPlan, loadTodosCheckpoint, parseEntries, removePlanItem, resolveAuditLevel, resolveSessionLoggingConfig, runConfigMigrations, saveGoal, savePlan, saveTodosCheckpoint, setPlanItemStatus, summarizeUsage };
5273
+ export { ALL_SYNC_CATEGORIES, AnnotationsStore, CORE_RECONSTRUCT_EVENTS, CloudSync, ConfigMigrationError, DEFAULT_CONFIG_MIGRATIONS, DefaultAttachmentStore, DefaultConfigLoader, DefaultConfigStore, DefaultMemoryStore, DefaultPromptStore, DefaultSessionReader, DefaultSessionRewinder, DefaultSessionStore, DirectorStateCheckpoint, FileMemoryBackend, GraphMemoryBackend, MAX_JOURNAL_ENTRIES, MAX_PROGRESS_HISTORY, QueueStore, RecoveryLock, ReplayLogStore, STANDARD_AUDIT_EVENTS, SessionAnalyzer, SessionMemoryConsolidator, SessionRecovery, ToolAuditLog, addPlanItem, appendJournal, attachPlanCheckpoint, attachTodosCheckpoint, clearPlan, createSessionEventBridge, deriveTodosFromPlanItem, emptyGoal, emptyPlan, emptyTaskFile, formatGoal, formatPlan, formatPlanTemplates, getPlanTemplate, goalFilePath, listPlanTemplates, loadDirectorState, loadGoal, loadPlan, loadTasks, loadTodosCheckpoint, parseEntries, parseProgressFromText, recordProgress, removePlanItem, resolveAuditLevel, resolveSessionLoggingConfig, runConfigMigrations, saveGoal, savePlan, saveTasks, saveTodosCheckpoint, setPlanItemStatus, setProgress, summarizeUsage };
5131
5274
  //# sourceMappingURL=index.js.map
5132
5275
  //# sourceMappingURL=index.js.map