@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
@@ -1,43 +1,44 @@
1
1
  export { D as DefaultLogger, a as DefaultLoggerOptions } from '../logger-B9J5puGM.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, 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, J as removePlanItem, K as runConfigMigrations, L as savePlan, N as saveTodosCheckpoint, O as setPlanItemStatus } 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, 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, J as removePlanItem, K as runConfigMigrations, L as savePlan, N as saveTodosCheckpoint, O as setPlanItemStatus } from '../plan-templates-BdDxl9cI.js';
3
3
  export { D as DefaultSessionReader } from '../session-reader-DDz1Ek4V.js';
4
- export { A as AuditLevel, 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';
4
+ export { A as AuditLevel, 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';
5
5
  export { a as DirectorStateCheckpoint, D as DirectorStateSnapshot, b as DirectorSubagentState, c as DirectorTaskState, l as loadDirectorState } from '../director-state-BfeCUbmk.js';
6
6
  export { D as DefaultSecretScrubber, a as DefaultSecretVault, S as SecretVaultOptions, d as decryptConfigSecrets, e as encryptConfigSecrets, m as migratePlaintextSecrets, r as rewriteConfigEncrypted } from '../secret-vault-DrOhc2i5.js';
7
7
  export { A as AutoApprovePermissionPolicy, D as DefaultPermissionPolicy, P as PermissionPolicyOptions } from '../permission-policy-dF74EpDp.js';
8
- export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, E as EternalAutonomyEngine, c as EternalAutonomyOptions, d as EternalEngineState, H as HybridCompactor, I as IterationStage, P as ParallelEngineState, e as ParallelEternalEngine, f as ParallelEternalOptions, g as ParallelIterationStage, T as ToolExecutor } from '../parallel-eternal-engine-CTpcrb9O.js';
9
- export { AutoCompactionMiddleware, AutonomousRunner, AutonomousRunnerOptions, AutonomyPromptContributorOptions, DefaultSkillLoader, DoneCheckResult, DoneConditionChecker, IntelligentCompactor, IntelligentCompactorOptions, SelectiveCompactor, SelectiveCompactorOptions, SkillLoaderOptions, buildGoalPreamble, makeAutonomyPromptContributor } from '../execution/index.js';
10
- import { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-cqvlB_oS.js';
8
+ export { C as CompactorOptions, D as DefaultErrorHandler, a as DefaultRetryPolicy, E as EternalAutonomyEngine, b as EternalAutonomyOptions, c as EternalEngineState, H as HybridCompactor, I as IterationStage, P as ParallelEngineState, d as ParallelEternalEngine, e as ParallelEternalOptions, f as ParallelIterationStage, T as ToolExecutor } from '../parallel-eternal-engine-CUtmM_0V.js';
9
+ export { A as AutoCompactionMiddleware, a as AutonomousRunner, b as AutonomousRunnerOptions, c as AutonomyPromptContributorOptions, D as DefaultSkillLoader, d as DoneCheckResult, e as DoneConditionChecker, I as IntelligentCompactor, f as IntelligentCompactorOptions, S as SelectiveCompactor, g as SelectiveCompactorOptions, h as SkillLoaderOptions, i as buildGoalPreamble, m as makeAutonomyPromptContributor } from '../goal-preamble-CI8lxeY1.js';
10
+ import { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-BUunikwY.js';
11
11
  import { b as Response } from '../context-CNRYfhUv.js';
12
- export { a as AGENTS_BY_PHASE, b as AGENT_CATALOG, c as ALL_AGENT_DEFINITIONS, d as ALL_FLEET_AGENTS, e as AUDIT_LOG_AGENT, f as AutoExtendCeiling, g as AutoExtendPolicy, B as BUG_HUNTER_AGENT, n as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, q as DEFAULT_SUBAGENT_BASELINE, r as DelegateHost, s as Director, w as DirectorPromptParts, x as DirectorSessionFactory, y as DirectorSessionFactoryOptions, F as FLEET_ROSTER, z as FLEET_ROSTER_BUDGETS, J as FleetRosterBudget, K as FleetSpawnBudgetError, L as ICoordinator, M as IFleetManager, O as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, S as SECURITY_SCANNER_AGENT, V as SubagentPromptParts, W as applyRosterBudget, X as attachAutoExtend, Y as composeDirectorPrompt, Z as composeSubagentPrompt, _ as createDelegateTool, $ as getAgentDefinition, a1 as makeAskTool, a2 as makeAssignTool, a3 as makeAwaitTasksTool, a4 as makeCollabDebugTool, a5 as makeDirectorSessionFactory, a6 as makeFleetEmitTool, a7 as makeFleetHealthTool, a8 as makeFleetSessionTool, a9 as makeFleetStatusTool, aa as makeFleetUsageTool, ab as makeRollUpTool, ac as makeSpawnTool, ad as makeTerminateTool, af as rosterSummaryFromConfigs } from '../null-fleet-bus-BzzciAc4.js';
13
- export { b as AgentBudgetTier, c as AgentCapability, A as AgentDefinition, d as AgentPhase, e as DEFAULT_DISPATCH_ROLE, a as DefaultMultiAgentCoordinator, f as DispatchCandidate, D as DispatchClassifier, g as DispatchMethod, h as DispatchOptions, i as DispatchResult, j as MultiAgentCoordinatorOptions, k as dispatchAgent, m as makeLLMClassifier, s as scoreAgents } from '../multi-agent-coordinator-DHNrjPaA.js';
14
- export { h as AgentFactory, i as AgentFactoryResult, j as AgentRunnerOptions, k as BudgetExceededError, l as BudgetKind, m as BudgetLimits, r as BudgetUsage, F as FleetBus, s as FleetEvent, t as FleetHandler, u as FleetUsage, v as FleetUsageAggregator, w as SubagentBudget, x as SubagentUsageSnapshot, y as makeAgentSubagentRunner } from '../agent-subagent-runner-C6eqID1t.js';
15
- export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-DbVe1dHT.js';
12
+ export { a as AGENTS_BY_PHASE, b as AGENT_CATALOG, c as ALL_AGENT_DEFINITIONS, d as ALL_FLEET_AGENTS, e as AUDIT_LOG_AGENT, f as AutoExtendCeiling, g as AutoExtendPolicy, B as BUG_HUNTER_AGENT, n as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, q as DEFAULT_SUBAGENT_BASELINE, r as DelegateHost, s as Director, w as DirectorPromptParts, x as DirectorSessionFactory, y as DirectorSessionFactoryOptions, F as FLEET_ROSTER, z as FLEET_ROSTER_BUDGETS, J as FleetRosterBudget, K as FleetSpawnBudgetError, L as ICoordinator, M as IFleetManager, O as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, S as SECURITY_SCANNER_AGENT, V as SubagentPromptParts, W as applyRosterBudget, X as attachAutoExtend, Y as composeDirectorPrompt, Z as composeSubagentPrompt, _ as createDelegateTool, $ as getAgentDefinition, a1 as makeAskTool, a2 as makeAssignTool, a3 as makeAwaitTasksTool, a4 as makeCollabDebugTool, a5 as makeDirectorSessionFactory, a6 as makeFleetEmitTool, a7 as makeFleetHealthTool, a8 as makeFleetSessionTool, a9 as makeFleetStatusTool, aa as makeFleetUsageTool, ab as makeRollUpTool, ac as makeSpawnTool, ad as makeTerminateTool, af as rosterSummaryFromConfigs } from '../null-fleet-bus-D09hMzFQ.js';
13
+ export { b as AgentBudgetTier, c as AgentCapability, A as AgentDefinition, d as AgentPhase, e as DEFAULT_DISPATCH_ROLE, a as DefaultMultiAgentCoordinator, f as DispatchCandidate, D as DispatchClassifier, g as DispatchMethod, h as DispatchOptions, i as DispatchResult, j as MultiAgentCoordinatorOptions, k as dispatchAgent, m as makeLLMClassifier, s as scoreAgents } from '../multi-agent-coordinator-51LvnXkD.js';
14
+ export { h as AgentFactory, i as AgentFactoryResult, j as AgentRunnerOptions, k as BudgetExceededError, l as BudgetKind, m as BudgetLimits, r as BudgetUsage, F as FleetBus, s as FleetEvent, t as FleetHandler, u as FleetUsage, v as FleetUsageAggregator, w as SubagentBudget, x as SubagentUsageSnapshot, y as makeAgentSubagentRunner } from '../agent-subagent-runner-DukQLUcS.js';
15
+ export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-mOxbpFcg.js';
16
16
  export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from '../models-registry-DU64QxQa.js';
17
17
  export { DefaultModeStore, LLMSelector, LLMSelectorOptions, ModeLoaderOptions, loadProjectModes, loadUserModes } from '../models/index.js';
18
18
  export { AISpecBuilder, AISpecBuilderOptions, AISpecPhase, AISpecSession, AutoExecutor, AutoExecutorOptions, BottleneckTask, CollectedAnswer, CriticalPathAnalysis, DefaultTaskStore, ExecutionSummary, GeneratedTask, RunResult, SPEC_TEMPLATES, SddParallelRun, SddParallelRunOptions, SddProgress, SddTaskDecomposer, SddTaskDecomposerOptions, SpecDiff, SpecDrivenDev, SpecDrivenDevOptions, SpecIndexEntry, SpecParser, SpecStore, SpecStoreOptions, SpecVersion, SpecVersioning, TaskBatch, TaskExecutionContext, TaskExecutionResult, TaskFlow, TaskFlowEventMap, TaskFlowEventName, TaskFlowExecutionContext, TaskFlowOptions, TaskFlowPhase, TaskGenerator, TaskGeneratorOptions, TaskGraphIndexEntry, TaskGraphStore, TaskGraphStoreOptions, TaskStore, TaskTracker, TaskTrackerOptions, TaskTransition, WaveResult, analyzeCriticalPath, createAutoExecutor, getTemplate, listTemplates, renderProgress, renderSpecAnalysis, renderTaskGraph, renderTaskList, templateToMarkdown } from '../sdd/index.js';
19
19
  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';
20
- 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-D3E5ixAR.js';
20
+ 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-CXCsANdY.js';
21
21
  export { D as DEFAULT_AUTONOMY_CONFIG, a as DEFAULT_CONTEXT_CONFIG, d as DEFAULT_TOOLS_CONFIG } from '../default-config-CXsDvOmP.js';
22
22
  import '../logger-B63L5bTg.js';
23
- import '../brain-s9DyD_Vf.js';
23
+ import '../brain-Dfv4Y82E.js';
24
24
  import '../permission-BDv7z0mk.js';
25
25
  import '../wstack-paths-_lqjzErq.js';
26
- import '../config-84VaZpH6.js';
26
+ import '../config-BSU-6vah.js';
27
27
  import '../models-registry-B6_KfS65.js';
28
28
  import '../secret-vault-DoISxaKO.js';
29
29
  import '../input-reader-E-ffP2ee.js';
30
30
  import '../retry-policy-BcmuT_V0.js';
31
31
  import '../compactor-DXLxLcmU.js';
32
- import '../index-D3Nax3YU.js';
33
- import '../pipeline-C1Ad9OjI.js';
32
+ import '../index-DIKEcfgC.js';
33
+ import '../pipeline-BqiA_UMr.js';
34
34
  import '../observability-D-HZN_mF.js';
35
- import '../goal-store-DvWLNu52.js';
35
+ import '../goal-store-ht0VmR1A.js';
36
+ import '../skill-Bj6Ezqb8.js';
36
37
  import '../selector-C7wcdqMA.js';
37
- import '../skill-BJxzIyyN.js';
38
38
  import 'node:events';
39
39
  import '../mode-ARA3HrkY.js';
40
- import '../task-graph-DJBqO0EY.js';
40
+ import '../spec-TBi3Jr6T.js';
41
+ import '../task-graph-u1q9Jkyk.js';
41
42
 
42
43
  /**
43
44
  * Default ProviderRunner — thin adapter over `runProviderWithRetry`.
@@ -7084,12 +7084,58 @@ function appendJournal(goal, entry) {
7084
7084
  journal: trimmed
7085
7085
  };
7086
7086
  }
7087
+ function parseProgressFromText(text) {
7088
+ const re = /\[progress:\s*(\d{1,3})%\]\s*(?:[—\-]\s*(.+))?/i;
7089
+ const m = text.match(re);
7090
+ if (!m) return null;
7091
+ const progress = Math.min(100, Math.max(0, Number.parseInt(m[1], 10)));
7092
+ const note = m[2]?.trim() || void 0;
7093
+ return { progress, note };
7094
+ }
7095
+ function recordProgress(goal, progress, note) {
7096
+ const clamped = Math.min(100, Math.max(0, progress));
7097
+ const history = [...goal.progressHistory ?? [], { at: (/* @__PURE__ */ new Date()).toISOString(), progress: clamped, note }];
7098
+ const trimmed = history.length > 200 ? history.slice(-200) : history;
7099
+ return {
7100
+ ...goal,
7101
+ progress: clamped,
7102
+ progressNote: note ?? `${clamped}% complete`,
7103
+ progressHistory: trimmed,
7104
+ progressTrend: computeTrend(trimmed)
7105
+ };
7106
+ }
7107
+ function computeTrend(history) {
7108
+ if (history.length < 3) return void 0;
7109
+ const recent = history.slice(-5);
7110
+ const deltas = [];
7111
+ for (let i = 1; i < recent.length; i++) {
7112
+ deltas.push(recent[i].progress - recent[i - 1].progress);
7113
+ }
7114
+ if (deltas.length < 2) return void 0;
7115
+ const avgDelta = deltas.reduce((a, b) => a + b, 0) / deltas.length;
7116
+ if (avgDelta > 2) return "accelerating";
7117
+ if (avgDelta < -1) return "stalling";
7118
+ return "steady";
7119
+ }
7087
7120
 
7088
7121
  // src/utils/sleep.ts
7089
7122
  function sleep(ms) {
7090
7123
  return new Promise((resolve5) => setTimeout(resolve5, ms));
7091
7124
  }
7092
7125
 
7126
+ // src/execution/autonomy-brain.ts
7127
+ function formatDecisionSummary(decision, request) {
7128
+ const question = request.question.length > 80 ? request.question.slice(0, 77) + "\u2026" : request.question;
7129
+ if (decision.type === "deny") {
7130
+ return `\u{1F9E0} Brain: DENIED \u2014 "${question}" \u2192 ${decision.reason}`;
7131
+ }
7132
+ if (decision.type === "answer") {
7133
+ const action = decision.optionId ? `chose [${decision.optionId}]` : decision.text.length > 60 ? decision.text.slice(0, 57) + "\u2026" : decision.text;
7134
+ return `\u{1F9E0} Brain: DECIDED \u2014 "${question}" \u2192 ${action}`;
7135
+ }
7136
+ return `\u{1F9E0} Brain: ASKED HUMAN \u2014 "${question}"`;
7137
+ }
7138
+
7093
7139
  // src/execution/eternal-autonomy.ts
7094
7140
  var execFileP = promisify(execFile);
7095
7141
  var BRAINSTORM_DONE = /* @__PURE__ */ Symbol("brainstorm-done");
@@ -7159,7 +7205,7 @@ var EternalAutonomyEngine = class {
7159
7205
  this.consecutiveFailures = 0;
7160
7206
  }
7161
7207
  if (this.stopRequested) break;
7162
- await sleep(this.opts.cycleGapMs ?? 1e3);
7208
+ await sleep(this.opts.cycleGapMs ?? 0);
7163
7209
  }
7164
7210
  } finally {
7165
7211
  this.state = "stopped";
@@ -7329,6 +7375,18 @@ var EternalAutonomyEngine = class {
7329
7375
  this.stopRequested = true;
7330
7376
  return true;
7331
7377
  }
7378
+ const parsed = parseProgressFromText(finalText);
7379
+ if (parsed) {
7380
+ await this.updateProgress(parsed.progress, parsed.note);
7381
+ if (parsed.progress >= 100) {
7382
+ await this.markGoalCompleted(
7383
+ { source: action.source, task: action.task, directive: action.directive },
7384
+ `progress reached 100%: ${parsed.note ?? "goal complete"}`
7385
+ );
7386
+ this.stopRequested = true;
7387
+ return true;
7388
+ }
7389
+ }
7332
7390
  this.iterationsSinceCompact++;
7333
7391
  await this.maybeCompact().catch((err) => {
7334
7392
  this.opts.onError?.(
@@ -7415,11 +7473,16 @@ var EternalAutonomyEngine = class {
7415
7473
  this.consecutiveBrainstormDone++;
7416
7474
  const threshold = this.opts.brainstormDoneStopThreshold ?? 3;
7417
7475
  if (this.consecutiveBrainstormDone >= threshold) {
7418
- await this.markGoalCompleted(
7419
- { source: "brainstorm", task: "no further work", directive: "" },
7420
- `brainstorm returned DONE ${this.consecutiveBrainstormDone}x in a row`
7421
- );
7422
- this.stopRequested = true;
7476
+ const shouldStop = await this.consultBrainForDone(goal);
7477
+ if (shouldStop) {
7478
+ await this.markGoalCompleted(
7479
+ { source: "brainstorm", task: "no further work", directive: "" },
7480
+ `brainstorm returned DONE ${this.consecutiveBrainstormDone}x in a row${this.opts.brain ? ", brain confirmed" : ""}`
7481
+ );
7482
+ this.stopRequested = true;
7483
+ } else {
7484
+ this.consecutiveBrainstormDone = 0;
7485
+ }
7423
7486
  }
7424
7487
  return null;
7425
7488
  }
@@ -7653,6 +7716,69 @@ ${recentJournal}` : "No prior iterations.",
7653
7716
  async appendFailure(task, note) {
7654
7717
  await this.appendIterationEntry({ source: "manual", task, status: "failure", note });
7655
7718
  }
7719
+ /**
7720
+ * Consult the brain on whether the goal is truly complete.
7721
+ * Without a brain, always returns true (use heuristic: DONE threshold met = done).
7722
+ */
7723
+ async consultBrainForDone(goal) {
7724
+ if (!this.opts.brain) return true;
7725
+ const deliverablesStatus = goal.deliverables?.length ? `
7726
+ Deliverables: ${goal.deliverables.length} total, progress ${goal.progress ?? "unknown"}%` : "";
7727
+ const recentJournal = goal.journal.slice(-5).map(
7728
+ (e) => ` #${e.iteration} [${e.status}] ${e.task}`
7729
+ ).join("\n");
7730
+ try {
7731
+ const decision = await this.opts.brain.decide({
7732
+ id: `goal-done-${goal.iterations}`,
7733
+ source: "system",
7734
+ question: `Brainstorm returned DONE ${this.consecutiveBrainstormDone}x. Is the goal truly complete?`,
7735
+ context: [
7736
+ `Goal: ${goal.goal}`,
7737
+ `Iterations: ${goal.iterations}`,
7738
+ `Progress: ${goal.progress ?? "unknown"}%`,
7739
+ deliverablesStatus,
7740
+ recentJournal ? `
7741
+ Recent work:
7742
+ ${recentJournal}` : ""
7743
+ ].join("\n"),
7744
+ risk: "high",
7745
+ fallback: "continue"
7746
+ });
7747
+ const summary = formatDecisionSummary(decision, {
7748
+ id: `goal-done-${goal.iterations}`,
7749
+ source: "system",
7750
+ question: "Is the goal complete?",
7751
+ risk: "high",
7752
+ fallback: "continue"
7753
+ });
7754
+ const rationale = "rationale" in decision ? decision.rationale : void 0;
7755
+ await this.appendIterationEntry({
7756
+ source: "brainstorm",
7757
+ task: summary,
7758
+ status: "success",
7759
+ note: rationale
7760
+ });
7761
+ if (decision.type === "deny") {
7762
+ return false;
7763
+ }
7764
+ if (decision.type === "answer") {
7765
+ const text = decision.text.toLowerCase();
7766
+ return text.includes("complete") || text.includes("done") || text.includes("yes");
7767
+ }
7768
+ return true;
7769
+ } catch {
7770
+ return true;
7771
+ }
7772
+ }
7773
+ /**
7774
+ * Persist a progress update from the agent's [PROGRESS: N%] output.
7775
+ */
7776
+ async updateProgress(progress, note) {
7777
+ const current = await loadGoal(this.goalPath);
7778
+ if (!current) return;
7779
+ const updated = recordProgress(current, progress, note);
7780
+ await saveGoal(this.goalPath, updated);
7781
+ }
7656
7782
  async persistEngineState(state) {
7657
7783
  const current = await loadGoal(this.goalPath);
7658
7784
  if (!current) return;
@@ -10306,6 +10432,109 @@ Working rules:
10306
10432
  "cloud cost"
10307
10433
  ]
10308
10434
  }
10435
+ },
10436
+ {
10437
+ config: {
10438
+ id: "tech-stack",
10439
+ name: "Tech Stack Validator",
10440
+ role: "tech-stack",
10441
+ tools: ["search", "fetch", "read", "grep", "glob", "outdated", "audit", "json"],
10442
+ prompt: `You are the Tech Stack Validator \u2014 a single-shot validation agent that fires
10443
+ before any package, library, or framework choice is committed.
10444
+
10445
+ Your ONLY job: verify that a technology choice is current, real, and not obsolete.
10446
+ You are the "this isn't code, this is 10-year-old technology" agent. Intervene
10447
+ hard when the LLM hallucinates a version number or suggests dead tech.
10448
+
10449
+ ## Critical rules
10450
+
10451
+ 1. **Verify existence.** Search npm registry (fetch https://registry.npmjs.org/<pkg>/latest)
10452
+ or web search. A package that doesn't exist = hallucination.
10453
+
10454
+ 2. **Check latest version.** Never trust any version number from the model. Always
10455
+ fetch the actual latest stable version from npm or the project's release page.
10456
+
10457
+ 3. **Reject dead packages.** No release in >2 years + unresolved critical issues =
10458
+ dead. Suggest a maintained replacement.
10459
+
10460
+ 4. **Reject prehistoric tech.** Any package/pattern superseded \u22655 years ago is
10461
+ REJECTED. Key blocklist:
10462
+ - axios / node-fetch / got / request \u2192 native fetch (Node 18+)
10463
+ - moment \u2192 date-fns / luxon / Temporal
10464
+ - jQuery (new projects) \u2192 vanilla DOM / React
10465
+ - Gulp / Grunt \u2192 tsup / esbuild / vite
10466
+ - CoffeeScript / Flow \u2192 TypeScript
10467
+ - Bluebird \u2192 native Promises
10468
+ - crypto-js \u2192 node:crypto / Web Crypto
10469
+ - Bower \u2192 npm/pnpm
10470
+ - underscore \u2192 lodash or native ES2020+
10471
+
10472
+ 5. **The intervention phrase.** When rejecting on age grounds, you MUST output
10473
+ exactly: "This isn't code, this is X-year-old technology." where X =
10474
+ current year \u2212 the year the technology was made obsolete. Follow with
10475
+ what replaced it and a one-step migration path.
10476
+
10477
+ 6. **Prefer built-in over third-party.** Check Node 22+ native APIs first:
10478
+ node:test, node:sqlite, fetch, WebSocket, Web Crypto \u2014 all built-in.
10479
+
10480
+ ## Workflow (single-shot \u2014 do NOT loop)
10481
+
10482
+ 1. Receive the proposed package + version
10483
+ 2. Search npm registry or web for the latest version
10484
+ 3. Check age, maintenance status, deprecation
10485
+ 4. Output verdict: APPROVED (with exact version) or REJECTED (with replacement)
10486
+
10487
+ ## Output format
10488
+
10489
+ ### Tech Stack Validation \u2014 <package>
10490
+
10491
+ **Status**: APPROVED | REJECTED
10492
+
10493
+ **Package**: <name>@<version>
10494
+ **Source**: <URL you checked \u2014 npm registry, GitHub, web search>
10495
+ **Age**: <first release> \u2014 <last release date>
10496
+ **Verdict**: 1\u20132 sentence explanation.
10497
+
10498
+ When REJECTED on age:
10499
+ **"This isn't code, this is X-year-old technology."**
10500
+ **Replaced by**: <modern alternative>
10501
+ **Migration**: <one concrete step>
10502
+
10503
+ When APPROVED:
10504
+ **Install**: pnpm add <name>@^<major>.<minor>.0`
10505
+ },
10506
+ budget: {
10507
+ timeoutMs: 6e4,
10508
+ maxIterations: 5,
10509
+ maxToolCalls: 20,
10510
+ maxTokens: 4e4,
10511
+ maxCostUsd: 0.1
10512
+ },
10513
+ capability: {
10514
+ phase: "meta",
10515
+ summary: "Single-shot tech stack validator: checks npm for latest versions, rejects dead/obsolete packages, enforces modern alternatives.",
10516
+ keywords: [
10517
+ "tech stack",
10518
+ "version",
10519
+ "package",
10520
+ "library",
10521
+ "framework",
10522
+ "dependency",
10523
+ "install",
10524
+ "upgrade",
10525
+ "latest",
10526
+ "npm",
10527
+ "pnpm add",
10528
+ "outdated",
10529
+ "obsolete",
10530
+ "deprecated",
10531
+ "what version",
10532
+ "which package",
10533
+ "check version",
10534
+ "verify version",
10535
+ "is this current"
10536
+ ]
10537
+ }
10309
10538
  }
10310
10539
  ];
10311
10540
 
@@ -12098,7 +12327,17 @@ ${journalTail.join("\n")}` : "Recent journal: (none \u2014 this is the first ite
12098
12327
  }
12099
12328
 
12100
12329
  // src/execution/goal-preamble.ts
12101
- function buildGoalPreamble(goal) {
12330
+ function buildGoalPreamble(goal, deliverables) {
12331
+ const deliverableBlock = deliverables && deliverables.length > 0 ? [
12332
+ "",
12333
+ "CONCRETE DELIVERABLES (check these off as you go):",
12334
+ ...deliverables.map((d, i) => ` ${i + 1}. ${d}`),
12335
+ "",
12336
+ "After EACH iteration, estimate your completion percentage (0\u2013100)",
12337
+ "against this deliverable list. Output it as:",
12338
+ " [PROGRESS: N%] \u2014 <1-sentence status>",
12339
+ "The eternal engine reads this to update the progress bar."
12340
+ ].join("\n") : "";
12102
12341
  return [
12103
12342
  "[GOAL \u2014 LOCKED IN. You will work on this until it is verifiably done.",
12104
12343
  "The user granted you full autonomy. Read these constraints once, then act.",
@@ -12107,6 +12346,7 @@ function buildGoalPreamble(goal) {
12107
12346
  "---",
12108
12347
  goal,
12109
12348
  "---",
12349
+ deliverableBlock,
12110
12350
  "",
12111
12351
  "AUTHORITY YOU HAVE:",
12112
12352
  "- Spawn as many subagents as the work needs (delegate / spawn_subagent).",
@@ -12128,6 +12368,7 @@ function buildGoalPreamble(goal) {
12128
12368
  "- You can tell the user HOW to verify it themselves in 10 seconds.",
12129
12369
  '- You have NOT hedged. None of: "looks like it should work", "I',
12130
12370
  ' believe this fixes it", "the changes appear correct".',
12371
+ `- Progress bar shows 100%. All deliverables checked off.`,
12131
12372
  "",
12132
12373
  "WHAT IS NOT DONE \u2014 never report any of these as completion:",
12133
12374
  "- An error message you didn't recover from.",
@@ -12142,6 +12383,13 @@ function buildGoalPreamble(goal) {
12142
12383
  " respond to with a fresh attempt (different role, different model,",
12143
12384
  " tighter prompt).",
12144
12385
  "",
12386
+ "PROGRESS REPORTING \u2014 MANDATORY every iteration:",
12387
+ "- End every response with exactly: [PROGRESS: N%] \u2014 <status note>",
12388
+ " where N is your honest estimate (0-100) of how much of the goal",
12389
+ " is done. The engine tracks this and shows a live progress bar.",
12390
+ "- Example: [PROGRESS: 45%] \u2014 Auth module refactored, 3/5 tests pass,",
12391
+ " remaining: test coverage + docs update.",
12392
+ "",
12145
12393
  "PERSISTENCE PROTOCOL:",
12146
12394
  "- If blocked, try at least 3 different angles before reporting the",
12147
12395
  " problem to the user. Different tool inputs, different subagent",
@@ -16840,7 +17088,7 @@ var TaskTracker = class {
16840
17088
  const blockers = this.getBlockers(taskId);
16841
17089
  return blockers.every((id) => {
16842
17090
  const node = this.graph?.nodes.get(id);
16843
- return node?.status === "completed";
17091
+ return node?.status === "completed" || node?.status === "failed";
16844
17092
  });
16845
17093
  }
16846
17094
  getProgress() {
@@ -16872,7 +17120,7 @@ var TaskTracker = class {
16872
17120
  const remainingBlockers = this.getBlockers(depId);
16873
17121
  const allUnblocked = remainingBlockers.every((id) => {
16874
17122
  const blocker = this.graph?.nodes.get(id);
16875
- return blocker?.status === "completed";
17123
+ return blocker?.status === "completed" || blocker?.status === "failed";
16876
17124
  });
16877
17125
  if (allUnblocked) {
16878
17126
  dep.status = "pending";
@@ -16886,7 +17134,7 @@ var TaskTracker = class {
16886
17134
  const blockers = this.getBlockers(taskId);
16887
17135
  const someBlocked = blockers.some((id) => {
16888
17136
  const blocker = this.graph?.nodes.get(id);
16889
- return blocker?.status !== "completed";
17137
+ return blocker?.status !== "completed" && blocker?.status !== "failed";
16890
17138
  });
16891
17139
  if (someBlocked) {
16892
17140
  const node = this.graph.nodes.get(taskId);
@@ -18705,14 +18953,17 @@ var SddParallelRun = class {
18705
18953
  this.opts = opts;
18706
18954
  this.slots = Math.min(16, Math.max(1, opts.parallelSlots ?? 4));
18707
18955
  this.timeoutMs = opts.taskTimeoutMs ?? 3e5;
18956
+ this.maxRetries = Math.max(0, opts.maxRetries ?? 2);
18708
18957
  this.decomposer = new SddTaskDecomposer(opts.tracker, opts.graph, { parallelSlots: this.slots });
18709
18958
  }
18710
18959
  opts;
18711
18960
  slots;
18712
18961
  timeoutMs;
18962
+ maxRetries;
18713
18963
  decomposer;
18714
18964
  coordinator = null;
18715
18965
  stopRequested = false;
18966
+ retryMap = /* @__PURE__ */ new Map();
18716
18967
  // -------------------------------------------------------------------
18717
18968
  // Public API
18718
18969
  // -------------------------------------------------------------------
@@ -18724,6 +18975,7 @@ var SddParallelRun = class {
18724
18975
  /** Execute all waves until completion or deadlock. Returns final summary. */
18725
18976
  async run() {
18726
18977
  this.stopRequested = false;
18978
+ this.retryMap.clear();
18727
18979
  const startTime = Date.now();
18728
18980
  let totalCompleted = 0;
18729
18981
  let totalFailed = 0;
@@ -18852,9 +19104,20 @@ var SddParallelRun = class {
18852
19104
  const taskId = expectDefined(taskIds[i]);
18853
19105
  if (result.status === "success") {
18854
19106
  this.opts.tracker.updateNodeStatus(taskId, "completed");
19107
+ this.retryMap.delete(taskId);
18855
19108
  } else {
18856
19109
  const errMsg = result.error?.kind ? `${result.error.kind}: ${result.error.message}` : result.error?.message ?? "unknown error";
18857
- this.opts.tracker.updateNodeStatus(taskId, "failed", errMsg);
19110
+ const currentRetries = this.retryMap.get(taskId) ?? 0;
19111
+ if (currentRetries < this.maxRetries) {
19112
+ this.retryMap.set(taskId, currentRetries + 1);
19113
+ this.opts.tracker.updateNodeStatus(
19114
+ taskId,
19115
+ "pending",
19116
+ `Retry ${currentRetries + 1}/${this.maxRetries}: ${errMsg}`
19117
+ );
19118
+ } else {
19119
+ this.opts.tracker.updateNodeStatus(taskId, "failed", errMsg);
19120
+ }
18858
19121
  }
18859
19122
  }
18860
19123
  return {
@@ -18869,6 +19132,7 @@ var SddParallelRun = class {
18869
19132
  }
18870
19133
  buildProgress() {
18871
19134
  const gp = this.opts.tracker.getProgress();
19135
+ const isDeadlocked = !this.decomposer.isDone() && this.decomposer.nextBatch().deadlocked;
18872
19136
  return {
18873
19137
  wave: this.decomposer.getWaveCount(),
18874
19138
  total: gp.total,
@@ -18878,7 +19142,7 @@ var SddParallelRun = class {
18878
19142
  blocked: gp.blocked,
18879
19143
  pending: gp.pending,
18880
19144
  percent: gp.percentComplete,
18881
- deadlocked: false
19145
+ deadlocked: isDeadlocked
18882
19146
  };
18883
19147
  }
18884
19148
  };