@wrongstack/core 0.6.5 → 0.6.6

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.
@@ -52,7 +52,7 @@ interface GoalFile {
52
52
  * Optional for backward compatibility — pre-existing `goal.json` files
53
53
  * without this field load as `active`.
54
54
  */
55
- goalState?: 'active' | 'completed' | 'abandoned';
55
+ goalState?: 'active' | 'paused' | 'completed' | 'abandoned';
56
56
  /**
57
57
  * Per-todo attempt counter. Keyed by TodoItem id. Used by the engine
58
58
  * to skip a todo that has failed N times rather than spinning on it
package/dist/index.d.ts CHANGED
@@ -29,7 +29,7 @@ import { c as ModeStore } from './mode-CV077NjV.js';
29
29
  export { D as DEFAULT_MODES, M as Mode, a as ModeConfig, b as ModeManifest } from './mode-CV077NjV.js';
30
30
  export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from './agent-bridge-BBXK_ppx.js';
31
31
  export { n as BudgetExceededError, o as BudgetKind, p as BudgetLimits, q as BudgetUsage, C as CoordinatorEvents, a as CoordinatorStatus, D as DoneCondition, M as MultiAgentConfig, b as MultiAgentCoordinator, S as SpawnResult, r as SubagentBudget, c as SubagentConfig, d as SubagentContext, e as SubagentError, f as SubagentErrorKind, g as SubagentRunContext, h as SubagentRunOutcome, i as SubagentRunner, T as TaskDelegation, j as TaskResult, k as TaskSpec } from './multi-agent-D5IbASk_.js';
32
- export { C as CriticalPathResult, D as DEFAULT_SPEC_TEMPLATE, S as SpecAnalysis, a as SpecApiEndpoint, b as SpecRequirement, c as SpecSection, d as SpecSectionType, e as SpecStatus, f as SpecTemplate, g as SpecValidationResult, h as Specification, T as TaskAssignment, i as TaskDependency, j as TaskEdge, k as TaskFilter, l as TaskGraph, m as TaskNode, n as TaskPriority, o as TaskProgress, p as TaskSort, q as TaskStatus, r as TaskType, s as computeTaskProgress, t as findCriticalPath, u as topologicalSort } from './task-graph-BITvWt4t.js';
32
+ export { C as CriticalPathResult, D as DEFAULT_SPEC_TEMPLATE, S as SpecAnalysis, a as SpecApiEndpoint, b as SpecRequirement, c as SpecSection, d as SpecSectionType, e as SpecStatus, f as SpecTemplate, g as SpecValidationResult, h as Specification, T as TaskAssignment, i as TaskDependency, j as TaskEdge, k as TaskFilter, l as TaskGraph, m as TaskNode, n as TaskPriority, o as TaskProgress, p as TaskSort, q as TaskStatus, r as TaskType, s as computeTaskProgress, t as findCriticalPath, u as topologicalSort } from './task-graph-D1YQbpxF.js';
33
33
  export { A as AggregateHealth, H as HealthCheck, a as HealthCheckResult, b as HealthRegistry, c as HealthStatus, M as MetricLabels, d as MetricSeries, e as MetricsSink, f as MetricsSnapshot, S as Span, T as Tracer } from './observability-BhnVLBLS.js';
34
34
  export { AtomicWriteOptions, BuildChildEnvOptions, CompileFail, CompileResult, MessageRepairReport, MessageRepairResult, NewlineStyle, RequestTokenBreakdown, SafeParseResult, ToolOutputSerializerOptions, UnifiedDiffOptions, ValidationError, ValidationResult, atomicWrite, buildChildEnv, color, compileGlob, compileUserRegex, createToolOutputSerializer, detectNewlineStyle, ensureDir, estimateRequestTokens, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, formatTodosList, matchAny, matchGlob, normalizeToLf, repairToolUseAdjacency, safeParse, safeStringify, sanitizeJsonString, stripAnsi, toStyle, unifiedDiff, validateAgainstSchema } from './utils/index.js';
35
35
  export { a as WstackPathOptions, W as WstackPaths, p as projectHash, r as resolveWstackPaths } from './wstack-paths-86YPFktR.js';
@@ -46,7 +46,7 @@ export { DefaultHealthRegistry, InMemoryMetricsSink, MetricsServerHandle, Metric
46
46
  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-CevFHHM1.js';
47
47
  export { DownloadResult, InstallResult, InstalledSkillEntry, ManifestData, ParsedRef, SkillInstaller, SkillInstallerOptions, SkillManifestStore, UpdateResult, downloadGitHubTarball, parseSkillRef } from './skills/index.js';
48
48
  export { DefaultSessionRewinder, SessionRewinderOptions } from './storage/index.js';
49
- 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-_Er467ya.js';
49
+ 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-HHgaq5ue.js';
50
50
  import { R as RetryPolicy, E as ErrorHandler } from './retry-policy-BZSIMxrJ.js';
51
51
  import { L as Logger } from './logger-BMQgxvdy.js';
52
52
  export { a as LogLevel } from './logger-BMQgxvdy.js';
package/dist/index.js CHANGED
@@ -7428,7 +7428,8 @@ function formatGoal(goal, journalLimit = 10) {
7428
7428
  lines.push(`Set: ${goal.setAt}`);
7429
7429
  lines.push(`Last activity: ${goal.lastActivityAt}`);
7430
7430
  lines.push(`Iterations: ${goal.iterations}`);
7431
- lines.push(`Mission: ${goal.goalState ?? "active"}`);
7431
+ const stateLabel = goal.goalState ?? "active";
7432
+ lines.push(`State: ${stateLabel}${goal.iterations > 0 ? ` (iteration #${goal.iterations})` : ""}`);
7432
7433
  lines.push(`Engine: ${goal.engineState}`);
7433
7434
  const usage = summarizeUsage(goal);
7434
7435
  if (usage.iterationsWithUsage > 0) {
@@ -7535,23 +7536,33 @@ var EternalAutonomyEngine = class {
7535
7536
  * `agent.run()` avoids race conditions on the shared Context.
7536
7537
  */
7537
7538
  async runOneIteration() {
7539
+ const emit = (stage) => {
7540
+ this.opts.onStage?.(stage);
7541
+ };
7538
7542
  const goal = await loadGoal(this.goalPath);
7539
7543
  if (!goal) {
7544
+ emit({ phase: "stopped" });
7540
7545
  this.stopRequested = true;
7541
7546
  return false;
7542
7547
  }
7543
7548
  const missionState = goal.goalState ?? "active";
7544
7549
  if (missionState !== "active") {
7550
+ emit({ phase: missionState === "paused" ? "paused" : "stopped" });
7545
7551
  this.stopRequested = true;
7546
7552
  return false;
7547
7553
  }
7554
+ emit({ phase: "decide", reason: "picking next task" });
7548
7555
  const action = await this.decide(goal);
7549
7556
  if (!action) {
7550
7557
  if (!this.stopRequested) {
7558
+ emit({ phase: "sleep", ms: 5e3 });
7551
7559
  await sleep(5e3);
7560
+ } else {
7561
+ emit({ phase: "stopped" });
7552
7562
  }
7553
7563
  return false;
7554
7564
  }
7565
+ emit({ phase: "execute", task: action.task });
7555
7566
  const ctrl = new AbortController();
7556
7567
  this.currentCtrl = ctrl;
7557
7568
  const timer = setTimeout(
@@ -7629,6 +7640,7 @@ var EternalAutonomyEngine = class {
7629
7640
  tokens,
7630
7641
  costUsd
7631
7642
  });
7643
+ emit({ phase: "reflect", status, note });
7632
7644
  let iterationIndex = 0;
7633
7645
  try {
7634
7646
  const reloaded = await loadGoal(this.goalPath);
@@ -7650,6 +7662,7 @@ var EternalAutonomyEngine = class {
7650
7662
  this.consecutiveTransientRetries++;
7651
7663
  const delay = this.computeTransientBackoffMs();
7652
7664
  if (delay > 0) {
7665
+ emit({ phase: "sleep", ms: delay });
7653
7666
  await this.sleepInterruptible(delay);
7654
7667
  }
7655
7668
  return false;
@@ -7663,6 +7676,9 @@ var EternalAutonomyEngine = class {
7663
7676
  return false;
7664
7677
  }
7665
7678
  this.consecutiveTransientRetries = 0;
7679
+ const cycleGapMs = this.opts.cycleGapMs ?? 1e3;
7680
+ emit({ phase: "sleep", ms: cycleGapMs });
7681
+ await sleep(cycleGapMs);
7666
7682
  if (GOAL_COMPLETE_MARKER.test(finalText)) {
7667
7683
  await this.markGoalCompleted(action, finalText);
7668
7684
  this.stopRequested = true;
@@ -11715,6 +11731,10 @@ var TaskTracker = class {
11715
11731
  node.updatedAt = now;
11716
11732
  if (status === "completed") {
11717
11733
  node.completedAt = now;
11734
+ node.startedAt = node.startedAt ?? now;
11735
+ }
11736
+ if (status === "in_progress") {
11737
+ node.startedAt = now;
11718
11738
  }
11719
11739
  this.transitions.push({ from, to: status, timestamp: now, reason });
11720
11740
  if (status === "completed") {
@@ -11726,6 +11746,23 @@ var TaskTracker = class {
11726
11746
  this.graph.updatedAt = now;
11727
11747
  this.persist();
11728
11748
  }
11749
+ /**
11750
+ * Update node fields (title, description, priority, estimateHours, tags).
11751
+ * Does NOT change status. Use updateNodeStatus for status changes.
11752
+ */
11753
+ updateNode(id, patch) {
11754
+ if (!this.graph) throw new Error("No graph loaded");
11755
+ const node = this.graph.nodes.get(id);
11756
+ if (!node) throw new Error(`Node ${id} not found`);
11757
+ if (patch.title !== void 0) node.title = patch.title;
11758
+ if (patch.description !== void 0) node.description = patch.description;
11759
+ if (patch.priority !== void 0) node.priority = patch.priority;
11760
+ if (patch.estimateHours !== void 0) node.estimateHours = patch.estimateHours;
11761
+ if (patch.tags !== void 0) node.tags = patch.tags;
11762
+ node.updatedAt = Date.now();
11763
+ this.graph.updatedAt = node.updatedAt;
11764
+ this.persist();
11765
+ }
11729
11766
  getNode(id) {
11730
11767
  return this.graph?.nodes.get(id);
11731
11768
  }
@@ -19282,9 +19319,7 @@ var SlashCommandRegistry = class {
19282
19319
  }
19283
19320
  }
19284
19321
  if (this.cmds.has(fullName)) {
19285
- if (!isPlugin) {
19286
- throw new Error(`Built-in slash command "${fullName}" is already registered.`);
19287
- }
19322
+ if (!isPlugin) return;
19288
19323
  this.cmds.set(fullName, { cmd, owner });
19289
19324
  for (const a of cmd.aliases ?? []) {
19290
19325
  this.cmds.set(`${owner}:${a}`, { cmd, owner });