@runfusion/fusion 0.75.0-beta.0 → 0.75.0-beta.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 (138) hide show
  1. package/dist/bin.js +2858 -1801
  2. package/dist/child-process-worker.js +2650 -1824
  3. package/dist/client/.vite/manifest.json +249 -249
  4. package/dist/client/assets/{AgentDetailView-lS4k3-0w.js → AgentDetailView-C4Xpag_i.js} +1 -1
  5. package/dist/client/assets/{AgentPermissionPolicyEditor-D7LB_f1m.js → AgentPermissionPolicyEditor-D-Fp7-sy.js} +1 -1
  6. package/dist/client/assets/{AgentsView-DwCNc9_x.js → AgentsView-BmFsoY1Q.js} +3 -3
  7. package/dist/client/assets/{ChatView-CVxDxKOu.js → ChatView-5KsB3BVO.js} +1 -1
  8. package/dist/client/assets/{CommandCenter-Da3AiDs-.js → CommandCenter-CacGI8AV.js} +1 -1
  9. package/dist/client/assets/{DevServerView-C0UWmEhO.js → DevServerView-DufjauVn.js} +1 -1
  10. package/dist/client/assets/{DirectoryPicker-JH2ahFj8.js → DirectoryPicker-DvwqfQDS.js} +1 -1
  11. package/dist/client/assets/{DocumentsView-BA4Pqnfr.js → DocumentsView-BbYJFIQ1.js} +1 -1
  12. package/dist/client/assets/{EvalsView-DW88MPta.js → EvalsView-NBC8kOc-.js} +1 -1
  13. package/dist/client/assets/{ExperimentalAgentOnboardingModal-DOih_5nN.js → ExperimentalAgentOnboardingModal-C809yXXY.js} +1 -1
  14. package/dist/client/assets/{GoalsView-DDIorLyM.js → GoalsView-CpNO9eI0.js} +1 -1
  15. package/dist/client/assets/{InsightsView-B5VUUsmJ.js → InsightsView-Cahy5FcR.js} +1 -1
  16. package/dist/client/assets/{MemoryView-sDMj6cEL.js → MemoryView-BNJAQjqn.js} +1 -1
  17. package/dist/client/assets/{PiExtensionsManager-SpcPEzpg.js → PiExtensionsManager-DCHTyOmJ.js} +1 -1
  18. package/dist/client/assets/{PluginManager-lIMMAJYt.js → PluginManager-CBt-CqUz.js} +1 -1
  19. package/dist/client/assets/{PullRequestView-BfAHOr3-.js → PullRequestView-Dsb9RwmX.js} +1 -1
  20. package/dist/client/assets/{ReportModal-6RDeUqQG.js → ReportModal-8FjZOcbC.js} +1 -1
  21. package/dist/client/assets/{ResearchView-BUGq2GsN.js → ResearchView-DlSG7dOd.js} +1 -1
  22. package/dist/client/assets/{SecretsView-CTwukpAq.js → SecretsView-BSajNE-f.js} +1 -1
  23. package/dist/client/assets/{SessionTerminal-Dspbb2NO.js → SessionTerminal-M2fIpHrL.js} +1 -1
  24. package/dist/client/assets/{SettingsModal-B6guaVe8.js → SettingsModal-DLcvlp44.js} +3 -3
  25. package/dist/client/assets/{SettingsModal-D2DahTWc.js → SettingsModal-z6gOf7dG.js} +1 -1
  26. package/dist/client/assets/{SettingsTextareaRow-BZZnVXGb.js → SettingsTextareaRow-DeC19053.js} +1 -1
  27. package/dist/client/assets/{SetupWizardModal-xTlxjulj.js → SetupWizardModal-BOjMePFh.js} +2 -2
  28. package/dist/client/assets/{SkillsView-CMG1fM0H.js → SkillsView-BSBEC-Xm.js} +1 -1
  29. package/dist/client/assets/{WorkflowNodeEditor-BBrY5D7F.js → WorkflowNodeEditor-DZ9-RBqo.js} +1 -1
  30. package/dist/client/assets/{agent-import-generation-DV3YE8Rc.js → agent-import-generation-COItiXMT.js} +1 -1
  31. package/dist/client/assets/{architectureDiagram-3BPJPVTR-gMbSnyDo.js → architectureDiagram-3BPJPVTR-BwlCePoB.js} +1 -1
  32. package/dist/client/assets/{blockDiagram-GPEHLZMM-BRPa9ADn.js → blockDiagram-GPEHLZMM-KKrLi9v4.js} +1 -1
  33. package/dist/client/assets/{c4Diagram-AAUBKEIU-BZhZDOqG.js → c4Diagram-AAUBKEIU-CkIDt_8M.js} +1 -1
  34. package/dist/client/assets/channel-CeYcnOtQ.js +1 -0
  35. package/dist/client/assets/{chunk-2J33WTMH-bcODs8jt.js → chunk-2J33WTMH-D9sbdaqY.js} +1 -1
  36. package/dist/client/assets/{chunk-4BX2VUAB-BRVq7S5r.js → chunk-4BX2VUAB-D3DtFoAY.js} +1 -1
  37. package/dist/client/assets/{chunk-55IACEB6-Cl7bhvca.js → chunk-55IACEB6-gxblxRIN.js} +1 -1
  38. package/dist/client/assets/{chunk-727SXJPM-B9loHJy3.js → chunk-727SXJPM-D0AEDoHN.js} +1 -1
  39. package/dist/client/assets/{chunk-AQP2D5EJ-CFA8hWsC.js → chunk-AQP2D5EJ-BweoM7qY.js} +1 -1
  40. package/dist/client/assets/{chunk-FMBD7UC4-Buu3h7wx.js → chunk-FMBD7UC4-sjblhrjI.js} +1 -1
  41. package/dist/client/assets/{chunk-ND2GUHAM-DN_GDbIs.js → chunk-ND2GUHAM-CYuRENSs.js} +1 -1
  42. package/dist/client/assets/{chunk-QZHKN3VN-1t7Gs0aF.js → chunk-QZHKN3VN-CFKJr4kG.js} +1 -1
  43. package/dist/client/assets/classDiagram-4FO5ZUOK-CZwh2k1X.js +1 -0
  44. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-CZwh2k1X.js +1 -0
  45. package/dist/client/assets/{cose-bilkent-S5V4N54A-QqcFhiY1.js → cose-bilkent-S5V4N54A-6Jb6SgHM.js} +1 -1
  46. package/dist/client/assets/{dagre-BM42HDAG-DjGM9BIi.js → dagre-BM42HDAG-FQJ87Ol3.js} +1 -1
  47. package/dist/client/assets/{dashboard-view-BO_R8jyX.js → dashboard-view-B1Rq2-73.js} +1 -1
  48. package/dist/client/assets/{dashboard-view-CxXlYApd.js → dashboard-view-DH1Zo0m4.js} +1 -1
  49. package/dist/client/assets/{dashboard-view-UqmC6VTb.js → dashboard-view-DVMZNVoc.js} +1 -1
  50. package/dist/client/assets/{dashboard-view-C6rmfIOU.js → dashboard-view-DgLbkn5n.js} +1 -1
  51. package/dist/client/assets/{diagram-2AECGRRQ-BmCGpU8P.js → diagram-2AECGRRQ-CKYOu9to.js} +1 -1
  52. package/dist/client/assets/{diagram-5GNKFQAL-CKRL1dki.js → diagram-5GNKFQAL-DPwjFnde.js} +1 -1
  53. package/dist/client/assets/{diagram-KO2AKTUF-DE9deYyi.js → diagram-KO2AKTUF-DzZS9Nk3.js} +1 -1
  54. package/dist/client/assets/{diagram-LMA3HP47-BmUGF67J.js → diagram-LMA3HP47-DW9e5YSP.js} +1 -1
  55. package/dist/client/assets/{diagram-OG6HWLK6-DLUATSuY.js → diagram-OG6HWLK6-C7V3Mj63.js} +1 -1
  56. package/dist/client/assets/{erDiagram-TEJ5UH35-nl31ZyQ8.js → erDiagram-TEJ5UH35-DSQzBA0e.js} +1 -1
  57. package/dist/client/assets/{flowDiagram-I6XJVG4X-BZdpCw1-.js → flowDiagram-I6XJVG4X-BUuOq9tO.js} +1 -1
  58. package/dist/client/assets/{folder-open-DKvxGzrx.js → folder-open-DXNu4ED4.js} +1 -1
  59. package/dist/client/assets/{ganttDiagram-6RSMTGT7-DLsqztRx.js → ganttDiagram-6RSMTGT7-Bc32G_Ef.js} +1 -1
  60. package/dist/client/assets/{gitGraphDiagram-PVQCEYII-Dk_Sy9NG.js → gitGraphDiagram-PVQCEYII-Cvfa0W6a.js} +1 -1
  61. package/dist/client/assets/index-C5YdAqNQ.js +2767 -0
  62. package/dist/client/assets/index-DHk_s6rA.css +1 -0
  63. package/dist/client/assets/{infoDiagram-5YYISTIA-DoQ0ID21.js → infoDiagram-5YYISTIA-TqRUTfvy.js} +1 -1
  64. package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-By5pgTzr.js → ishikawaDiagram-YF4QCWOH-D33iop1_.js} +1 -1
  65. package/dist/client/assets/{journeyDiagram-JHISSGLW-296a-u4u.js → journeyDiagram-JHISSGLW-DH-TDR5Y.js} +1 -1
  66. package/dist/client/assets/{kanban-definition-UN3LZRKU-CgcRr3lQ.js → kanban-definition-UN3LZRKU-CAcebzyW.js} +1 -1
  67. package/dist/client/assets/{mermaid.core-BMcqO-oY.js → mermaid.core-C3Nh1Sak.js} +4 -4
  68. package/dist/client/assets/{mindmap-definition-RKZ34NQL-C6poaNyh.js → mindmap-definition-RKZ34NQL-CSIccWV8.js} +1 -1
  69. package/dist/client/assets/{pieDiagram-4H26LBE5-D5kkHa4c.js → pieDiagram-4H26LBE5-hXJ3G3MR.js} +1 -1
  70. package/dist/client/assets/{puzzle-Dn0zAogb.js → puzzle-DI3elldh.js} +1 -1
  71. package/dist/client/assets/{quadrantDiagram-W4KKPZXB-XYE61FOQ.js → quadrantDiagram-W4KKPZXB-B3wpvneC.js} +1 -1
  72. package/dist/client/assets/{requirementDiagram-4Y6WPE33-ChSV14Ej.js → requirementDiagram-4Y6WPE33-DPpYL2ca.js} +1 -1
  73. package/dist/client/assets/{sankeyDiagram-5OEKKPKP-ToxhxAPY.js → sankeyDiagram-5OEKKPKP-BS9QXSEF.js} +1 -1
  74. package/dist/client/assets/{sequenceDiagram-3UESZ5HK-shNTGnMF.js → sequenceDiagram-3UESZ5HK-C_fqU0MW.js} +1 -1
  75. package/dist/client/assets/{shield-alert-DoqrZ4qS.js → shield-alert-CzZYSqmH.js} +1 -1
  76. package/dist/client/assets/{standing-instructions-template-CbBEfZ8s.js → standing-instructions-template-CsXA4WMZ.js} +1 -1
  77. package/dist/client/assets/{stateDiagram-AJRCARHV-CRNXfwiP.js → stateDiagram-AJRCARHV-DbSZrprS.js} +1 -1
  78. package/dist/client/assets/{stateDiagram-v2-BHNVJYJU-atxeIHh0.js → stateDiagram-v2-BHNVJYJU-Cf_ckwmM.js} +1 -1
  79. package/dist/client/assets/{timeline-definition-PNZ67QCA-CguHqKR6.js → timeline-definition-PNZ67QCA-B1ohvKjs.js} +1 -1
  80. package/dist/client/assets/{upload-BF3YtpBl.js → upload-D7nNe9wD.js} +1 -1
  81. package/dist/client/assets/{users-CN7wFV_l.js → users-B79Dvre4.js} +1 -1
  82. package/dist/client/assets/{vennDiagram-CIIHVFJN-BpgXesnN.js → vennDiagram-CIIHVFJN-CxZYCQ72.js} +1 -1
  83. package/dist/client/assets/{wardley-L42UT6IY-4QN1B18l.js → wardley-L42UT6IY-clJem8VU.js} +1 -1
  84. package/dist/client/assets/{wardleyDiagram-YWT4CUSO-BuYjCimN.js → wardleyDiagram-YWT4CUSO-zE8lyaWe.js} +1 -1
  85. package/dist/client/assets/{xychartDiagram-2RQKCTM6-DL8viWGe.js → xychartDiagram-2RQKCTM6-DsdjuSxQ.js} +1 -1
  86. package/dist/client/index.html +2 -2
  87. package/dist/client/version.json +1 -1
  88. package/dist/droid-cli/package.json +1 -1
  89. package/dist/extension.js +2594 -1746
  90. package/dist/migrations/0000_initial.sql +1 -0
  91. package/dist/migrations/0043_fn8768_dispatch_dedupe.sql +17 -0
  92. package/dist/migrations/0044_fn_8785_queued_episode_signature.sql +3 -0
  93. package/dist/pi-claude-cli/package.json +1 -1
  94. package/dist/plugin-sdk/index.d.ts +38 -1
  95. package/dist/plugin-sdk/index.js +71 -20
  96. package/dist/plugins/fusion-plugin-acp-runtime/bundled.js +71 -20
  97. package/dist/plugins/fusion-plugin-acp-runtime/package.json +1 -1
  98. package/dist/plugins/fusion-plugin-claude-runtime/bundled.js +71 -20
  99. package/dist/plugins/fusion-plugin-claude-runtime/package.json +1 -1
  100. package/dist/plugins/fusion-plugin-cli-printing-press/bundled.js +71 -20
  101. package/dist/plugins/fusion-plugin-cli-printing-press/package.json +1 -1
  102. package/dist/plugins/fusion-plugin-compound-engineering/bundled.js +71 -20
  103. package/dist/plugins/fusion-plugin-compound-engineering/package.json +1 -1
  104. package/dist/plugins/fusion-plugin-cursor-runtime/bundled.js +71 -20
  105. package/dist/plugins/fusion-plugin-cursor-runtime/package.json +1 -1
  106. package/dist/plugins/fusion-plugin-dependency-graph/bundled.js +71 -20
  107. package/dist/plugins/fusion-plugin-dependency-graph/package.json +1 -1
  108. package/dist/plugins/fusion-plugin-droid-runtime/bundled.js +71 -20
  109. package/dist/plugins/fusion-plugin-droid-runtime/package.json +1 -1
  110. package/dist/plugins/fusion-plugin-grok-runtime/bundled.js +71 -20
  111. package/dist/plugins/fusion-plugin-grok-runtime/package.json +1 -1
  112. package/dist/plugins/fusion-plugin-hermes-runtime/.bundled.reload-3.js +19167 -0
  113. package/dist/plugins/fusion-plugin-hermes-runtime/bundled.js +71 -20
  114. package/dist/plugins/fusion-plugin-hermes-runtime/package.json +1 -1
  115. package/dist/plugins/fusion-plugin-linear-import/bundled.js +71 -20
  116. package/dist/plugins/fusion-plugin-linear-import/package.json +1 -1
  117. package/dist/plugins/fusion-plugin-omp-runtime/bundled.js +71 -20
  118. package/dist/plugins/fusion-plugin-omp-runtime/package.json +1 -1
  119. package/dist/plugins/fusion-plugin-openclaw-runtime/bundled.js +71 -20
  120. package/dist/plugins/fusion-plugin-openclaw-runtime/package.json +1 -1
  121. package/dist/plugins/fusion-plugin-paperclip-runtime/bundled.js +71 -20
  122. package/dist/plugins/fusion-plugin-paperclip-runtime/package.json +1 -1
  123. package/dist/plugins/fusion-plugin-quality/bundled.js +71 -20
  124. package/dist/plugins/fusion-plugin-quality/package.json +1 -1
  125. package/dist/plugins/fusion-plugin-reports/bundled.js +71 -20
  126. package/dist/plugins/fusion-plugin-reports/package.json +1 -1
  127. package/dist/plugins/fusion-plugin-roadmap/bundled.js +71 -20
  128. package/dist/plugins/fusion-plugin-roadmap/package.json +1 -1
  129. package/dist/plugins/fusion-plugin-todos/bundled.js +71 -20
  130. package/dist/plugins/fusion-plugin-todos/package.json +1 -1
  131. package/dist/plugins/fusion-plugin-whatsapp-chat/bundled.js +71 -20
  132. package/dist/plugins/fusion-plugin-whatsapp-chat/package.json +1 -1
  133. package/package.json +1 -1
  134. package/dist/client/assets/channel-CcVVD2V-.js +0 -1
  135. package/dist/client/assets/classDiagram-4FO5ZUOK-Bdeei39Q.js +0 -1
  136. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-Bdeei39Q.js +0 -1
  137. package/dist/client/assets/index-DTimvpMD.js +0 -2685
  138. package/dist/client/assets/index-DjY0GTMz.css +0 -1
@@ -52,6 +52,7 @@ CREATE TABLE IF NOT EXISTS project.tasks (
52
52
  worktree text,
53
53
  blocked_by text,
54
54
  overlap_blocked_by text,
55
+ queued_log_episode_signature text,
55
56
  paused integer DEFAULT 0,
56
57
  user_paused integer DEFAULT 0,
57
58
  paused_reason text,
@@ -0,0 +1,17 @@
1
+ CREATE TABLE IF NOT EXISTS project.unplanned_execution_blocks (
2
+ project_id text NOT NULL DEFAULT current_setting('fusion.project_id', true),
3
+ task_id text NOT NULL,
4
+ episode text NOT NULL,
5
+ created_at text NOT NULL,
6
+ PRIMARY KEY (project_id, task_id, episode)
7
+ );
8
+
9
+ ALTER TABLE project.unplanned_execution_blocks ENABLE ROW LEVEL SECURITY;
10
+ ALTER TABLE project.unplanned_execution_blocks FORCE ROW LEVEL SECURITY;
11
+ DROP POLICY IF EXISTS fusion_project_isolation ON project.unplanned_execution_blocks;
12
+ CREATE POLICY fusion_project_isolation ON project.unplanned_execution_blocks
13
+ USING (current_setting('fusion.project_bypass', true) = 'on' OR project_id = current_setting('fusion.project_id', true))
14
+ WITH CHECK (current_setting('fusion.project_bypass', true) = 'on' OR project_id = current_setting('fusion.project_id', true));
15
+ DROP TRIGGER IF EXISTS fusion_assign_project_id ON project.unplanned_execution_blocks;
16
+ CREATE TRIGGER fusion_assign_project_id BEFORE INSERT OR UPDATE OF project_id ON project.unplanned_execution_blocks
17
+ FOR EACH ROW EXECUTE FUNCTION project.fusion_assign_project_id();
@@ -0,0 +1,3 @@
1
+ -- FNXC:QueuedTaskLogging 2026-08-04-18:03: retain one durable full blocker signature per live task queue episode.
2
+ ALTER TABLE project.tasks
3
+ ADD COLUMN IF NOT EXISTS queued_log_episode_signature text;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fusion/pi-claude-cli",
3
- "version": "0.75.0-beta.0",
3
+ "version": "0.75.0-beta.2",
4
4
  "type": "module",
5
5
  "private": true,
6
6
  "main": "index.ts",
@@ -103,6 +103,16 @@ interface ProjectIdentity$1 {
103
103
  firstSeenPath: string;
104
104
  }
105
105
 
106
+ type BackendMode = "embedded" | "external";
107
+ interface ResolvedBackend {
108
+ readonly mode: BackendMode;
109
+ readonly runtimeUrl: string | null;
110
+ readonly migrationUrl: string | null;
111
+ readonly migrationUrlOverridden: boolean;
112
+ readonly directSessionUrl?: string | null;
113
+ readonly directSessionProvenance?: "embedded-lifecycle" | "migration-override" | null;
114
+ }
115
+
106
116
  type DrizzleDb = PostgresJsDatabase<Record<string, never>>;
107
117
  type DbTransaction = PostgresJsTransaction<Record<string, never>, Record<string, never>>;
108
118
  interface TransactionOptions {
@@ -113,6 +123,7 @@ interface TransactionOptions {
113
123
  interface AsyncDataLayer {
114
124
  readonly db: DrizzleDb;
115
125
  readonly projectId?: string;
126
+ readonly backend?: ResolvedBackend;
116
127
  transaction<T>(fn: (tx: DbTransaction) => Promise<T>, options?: TransactionOptions): Promise<T>;
117
128
  transactionImmediate<T>(fn: (tx: DbTransaction) => Promise<T>, options?: TransactionOptions): Promise<T>;
118
129
  ping(): Promise<void>;
@@ -331,6 +342,19 @@ interface WorkflowIrV2 {
331
342
  }
332
343
  type WorkflowIr = WorkflowIrV1 | WorkflowIrV2;
333
344
 
345
+ interface QueuedEpisodeTransition {
346
+ signature: string;
347
+ blockedBy: string | null;
348
+ overlapBlockedBy: string | null;
349
+ action: string;
350
+ outcome?: string;
351
+ runContext?: RunMutationContext;
352
+ }
353
+ interface QueuedEpisodeTransitionResult {
354
+ appended: boolean;
355
+ task: Task;
356
+ }
357
+
334
358
  type StepStartDisposition = "started" | "resumed" | "blocked" | "terminal";
335
359
  interface StepStartResult {
336
360
  task: Task;
@@ -3378,6 +3402,7 @@ interface TaskRow {
3378
3402
  worktree: string | null;
3379
3403
  blockedBy: string | null;
3380
3404
  overlapBlockedBy: string | null;
3405
+ queuedLogEpisodeSignature: string | null;
3381
3406
  paused: number | null;
3382
3407
  pausedReason: string | null;
3383
3408
  wedgeNotification: string | null;
@@ -3554,6 +3579,10 @@ interface ImportTranslationCacheKey {
3554
3579
 
3555
3580
  type TaskOriginWorkflowKind = "task-create" | "refinement";
3556
3581
 
3582
+ type PlanningDependencyInvalidation = {
3583
+ expectedCurrentDependencies: readonly string[];
3584
+ };
3585
+
3557
3586
  interface RehomeOccupantResult {
3558
3587
  readonly moved: boolean;
3559
3588
  readonly error?: string;
@@ -4068,6 +4097,7 @@ declare class TaskStore extends EventEmitter<TaskStoreEvents> {
4068
4097
  withConfigLock<T>(fn: () => Promise<T>): Promise<T>;
4069
4098
  withWorktreeAllocationLock<T>(fn: () => Promise<T>): Promise<T>;
4070
4099
  withTaskLock<T>(id: string, fn: () => Promise<T>): Promise<T>;
4100
+ withPlanningLifecycleLock<T>(id: string, fn: () => Promise<T>): Promise<T>;
4071
4101
  getTaskIdFromDir(dir: string): string;
4072
4102
  insertRunAuditEventRow(input: Omit<RunAuditEventInput, "agentId" | "runId"> & {
4073
4103
  agentId?: string;
@@ -4109,7 +4139,7 @@ declare class TaskStore extends EventEmitter<TaskStoreEvents> {
4109
4139
  writeTaskJsonFile(dir: string, task: Task): Promise<void>;
4110
4140
  atomicCreateTaskJson(dir: string, task: Task, operation: string): Promise<void>;
4111
4141
  atomicWriteTaskJson(dir: string, task: Task): Promise<void>;
4112
- atomicWriteTaskJsonWithAudit(dir: string, task: Task, auditInput?: RunAuditEventInput): Promise<void>;
4142
+ atomicWriteTaskJsonWithAudit(dir: string, task: Task, auditInput?: RunAuditEventInput, planningInvalidation?: PlanningDependencyInvalidation): Promise<void>;
4113
4143
  reconcileActiveTimingForEngineDowntime(now?: Date, opts?: {
4114
4144
  engineLastActiveAtOverride?: string;
4115
4145
  }): Promise<{
@@ -4288,6 +4318,7 @@ declare class TaskStore extends EventEmitter<TaskStoreEvents> {
4288
4318
  }>>;
4289
4319
  clearWorkflowRunBranches(taskId: string, keepRunId: string): Promise<void>;
4290
4320
  saveWorkflowRunStepInstance(state: WorkflowRunStepInstance): Promise<void>;
4321
+ hasWorkflowRunStepInstancesForTask(taskId: string): Promise<boolean>;
4291
4322
  loadWorkflowRunStepInstances(taskId: string, runId: string): Promise<WorkflowRunStepInstance[]>;
4292
4323
  clearWorkflowRunStepInstances(taskId: string, keepRunId?: string): Promise<void>;
4293
4324
  saveWorkflowRunStepInstanceAsync(state: WorkflowRunStepInstance): Promise<void>;
@@ -4564,6 +4595,8 @@ declare class TaskStore extends EventEmitter<TaskStoreEvents> {
4564
4595
  startStep(id: string, stepIndex: number, options?: {
4565
4596
  source?: "graph";
4566
4597
  }): Promise<StepStartResult>;
4598
+ checkAndRecordUnplannedExecutionBlock(id: string, episode: string): Promise<boolean>;
4599
+ transitionQueuedEpisode(id: string, transition: QueuedEpisodeTransition): Promise<QueuedEpisodeTransitionResult>;
4567
4600
  logEntry(id: string, action: string, outcome?: string, runContext?: RunMutationContext): Promise<Task>;
4568
4601
  getMutationsForRun(runId: string): Promise<TaskLogEntry[]>;
4569
4602
  rowToMergeQueueEntry(row: MergeQueueRow): MergeQueueEntry;
@@ -5729,6 +5762,9 @@ interface WorkflowStepResult {
5729
5762
  bypassReason?: string;
5730
5763
  bypassedFromStatus?: WorkflowStepResult["status"];
5731
5764
  bypassedFromVerdict?: WorkflowStepResult["verdict"];
5765
+ supersededAt?: string;
5766
+ supersededReason?: "dependency-change";
5767
+ planReviewAttemptCount?: number;
5732
5768
  priorAttempts?: WorkflowStepResult[];
5733
5769
  }
5734
5770
  type WorkflowRunStepInstanceStatus = "pending" | "in-progress" | "awaiting-integration" | "completed" | "failed";
@@ -6462,6 +6498,7 @@ interface Task {
6462
6498
  recentAgentActivityAt?: string;
6463
6499
  blockedBy?: string;
6464
6500
  overlapBlockedBy?: string;
6501
+ queuedLogEpisodeSignature?: string;
6465
6502
  paused?: boolean;
6466
6503
  userPaused?: boolean;
6467
6504
  pausedReason?: string;
@@ -5760,6 +5760,7 @@ __export(project_exports, {
5760
5760
  tasks: () => tasks,
5761
5761
  todoItems: () => todoItems,
5762
5762
  todoLists: () => todoLists,
5763
+ unplannedExecutionBlocks: () => unplannedExecutionBlocks,
5763
5764
  usageEvents: () => usageEvents,
5764
5765
  verificationCache: () => verificationCache,
5765
5766
  workflowPromptOverrides: () => workflowPromptOverrides,
@@ -5799,6 +5800,7 @@ var tasks = projectSchema.table("tasks", {
5799
5800
  worktree: text("worktree"),
5800
5801
  blockedBy: text("blocked_by"),
5801
5802
  overlapBlockedBy: text("overlap_blocked_by"),
5803
+ queuedLogEpisodeSignature: text("queued_log_episode_signature"),
5802
5804
  paused: integer("paused").default(0),
5803
5805
  userPaused: integer("user_paused").default(0),
5804
5806
  pausedReason: text("paused_reason"),
@@ -6604,6 +6606,14 @@ var workflowWorkItems = projectSchema.table("workflow_work_items", {
6604
6606
  index("idx_workflow_work_items_task_run").on(t.taskId, t.runId),
6605
6607
  uniqueIndex("idx_workflow_work_items_one_active_task_continuation").on(t.projectId, t.taskId).where(sql`${t.kind} = 'task' AND ${t.state} IN ('runnable', 'running', 'held', 'retrying')`)
6606
6608
  ]);
6609
+ var unplannedExecutionBlocks = projectSchema.table("unplanned_execution_blocks", {
6610
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
6611
+ taskId: text("task_id").notNull(),
6612
+ episode: text("episode").notNull(),
6613
+ createdAt: text("created_at").notNull()
6614
+ }, (t) => [
6615
+ primaryKey({ columns: [t.projectId, t.taskId, t.episode] })
6616
+ ]);
6607
6617
  var workflowRunBranches = projectSchema.table("workflow_run_branches", {
6608
6618
  projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
6609
6619
  taskId: text("task_id").notNull(),
@@ -12129,6 +12139,37 @@ var TRIAGE_POLICY_DEFAULTS = new Map(
12129
12139
  BUILTIN_TRIAGE_POLICY_SETTINGS.map((setting) => [setting.id, setting.default])
12130
12140
  );
12131
12141
 
12142
+ // ../core/src/agents/planning-review-policy.ts
12143
+ var PLANNING_COMPLETENESS_POLICY = `## Mandatory Planning Completeness Procedure
12144
+
12145
+ Before writing the final PROMPT.md:
12146
+
12147
+ 1. Build an internal **planning ledger** from the Original Description, user comments, project instructions, cited issue/report, and any saved planning document. Preserve every requirement, settled decision, explicit non-goal, and acceptance outcome; do not silently replace the reporter's contract with a narrower reproduction.
12148
+ 2. Research before structuring the plan. Trace the affected behavior through its real production entry points, callers, writers/readers, shared consumers, persistence boundaries, recovery paths, and existing tests. Resolve planning-time facts from the repository now; defer only details that genuinely require implementation-time discovery, and label those explicitly.
12149
+ 3. For stateful, lifecycle, persistence, or concurrency work, enumerate the participant graph and both relevant orderings: stale-work cancellation/fencing, lock order and reentrancy, transaction boundaries, pool/transport limits, competing recovery paths, configuration/deployment identities, bypass/force paths, and failure cleanup. Every stated invariant must name the surfaces that preserve it.
12150
+ 4. Map every ledger row to concrete File Scope entries, dependency-ordered implementation steps, and verification. Each feature-bearing step must name specific automated test scenarios with the input/state, action or ordering, and expected observable result; helper-only tests do not prove production reachability.
12151
+ 5. Keep scope disciplined. Reuse current architecture and documented patterns unless the reporter contract requires a redesign. Put optional cleanup and adjacent ideas outside the active steps.
12152
+ 6. Before persisting PROMPT.md, perform a fresh holistic completeness pass across the whole ledger. Try to disprove the plan by checking referenced paths and patterns, missing consumers, contradictory steps, uncovered failure orderings, and acceptance criteria without tests. Fix all gaps in one pass.
12153
+
12154
+ On a revision, treat the cumulative revision ledger as durable decisions unless a later entry explicitly supersedes one: preserve resolved items, address every unresolved item surgically, and rerun the complete procedure instead of checking only the latest comment.`;
12155
+ var FAST_PLANNING_COMPLETENESS_POLICY = `## Fast Planning Completeness Check
12156
+
12157
+ Before writing PROMPT.md, build a compact internal ledger from the Original Description, user comments, project rules, and acceptance outcomes. Inspect the real production callers/consumers, persistence or recovery paths, and nearby tests before choosing File Scope. For stateful or concurrent work, enumerate every participant plus both relevant orderings and failure cleanup. Map each requirement to a concrete step, file, and automated test scenario, then reread the whole plan once for missing surfaces, contradictions, and unproved outcomes. On revision, preserve prior decisions and address the complete cumulative ledger, not only the latest note.`;
12158
+ var PLAN_REVIEW_COMPLETENESS_POLICY = `## Mandatory Plan Review Procedure
12159
+
12160
+ Apply this procedure to plan/spec reviews only. Code reviews use their dedicated procedure.
12161
+
12162
+ Before choosing a verdict:
12163
+
12164
+ 1. Build one **review ledger** for the entire PROMPT.md: Original Description and user comments; Mission and Completion Criteria; Surface Enumeration and Symptom Verification when required; every implementation step, File Scope entry, dependency, risk, and test/verification promise.
12165
+ 2. Complete the full review before reporting. Check coherence and requirement traceability, feasibility against the current repository, scope discipline, execution ordering, and verification quality. When relevant, also inspect security/data integrity, state transitions, concurrency orderings, deployment/configuration boundaries, recovery competitors, and force/bypass paths.
12166
+ 3. Review at specification altitude. Block when a required behavior, surface, ordering, safety constraint, or proof is missing or the stated approach cannot work. Keep optional implementation detail, wording polish, and nonessential improvements advisory.
12167
+ 4. If REVISE is necessary, batch **all independently discoverable blocking findings** into this one verdict; do not stop after the first defect. Give each blocker a stable ID, cite the affected section or repository evidence, and state the concrete PROMPT.md correction. Put advisory observations in a separate list.
12168
+ 5. On re-review, use the supplied prior-review ledger as a decision primer. Verify every prior blocker, do not re-raise resolved or rejected semantic duplicates, and preserve accepted decisions. A newly blocking finding must say whether the revision introduced it, which prior blocker genuinely masked it, or why it is independently delivery-blocking for correctness, security, data safety, or executability. Record an earlier reviewer miss explicitly; never demote a critical defect merely because it was missed before.
12169
+ 6. After any same-session PROMPT.md edit, distrust the edit: reread the complete artifact, rebuild the ledger, and perform a fresh holistic pass before APPROVE.
12170
+
12171
+ APPROVE when the plan is executable and verifiable, not when it is cosmetically perfect. If returning REVISE, the verdict notes must contain the complete blocking checklist because those notes are the durable input to the next planning round.`;
12172
+
12132
12173
  // ../core/src/agents/agent-prompts.ts
12133
12174
  var FUSION_RUNTIME_SELF_AWARENESS = `## Runtime Self-Awareness
12134
12175
 
@@ -12335,6 +12376,8 @@ The tool prevents your session from being killed by the inactivity watchdog duri
12335
12376
  - If a verification command times out, do NOT blindly retry \u2014 investigate. Check for hung subprocesses, infinite test loops, or tests waiting on missing dependencies. Use \`node_modules/.modules.yaml\` presence to confirm bootstrap.`;
12336
12377
  var FAST_TRIAGE_PROMPT_TEXT = `You are a task specification agent for "fn". This task is running in **fast mode**.
12337
12378
 
12379
+ ${FAST_PLANNING_COMPLETENESS_POLICY}
12380
+
12338
12381
  Write a lean, executable PROMPT.md quickly. Preserve safety gates, but skip heavyweight ceremony, review scoring, and proactive subtask analysis.
12339
12382
 
12340
12383
  ## Fast-mode priorities
@@ -12343,7 +12386,7 @@ Write a lean, executable PROMPT.md quickly. Preserve safety gates, but skip heav
12343
12386
  - Preserve required safety sections for bugs, workflow routing, forensic tasks, and decision-only work.
12344
12387
 
12345
12388
  ## Duplicate check
12346
- Before writing a spec, call \`fn_task_list\` for active work, then call \`fn_task_search\` with 2-4 targeted keyword phrases from the title/description, such as file paths, symptoms, and symbols. For any likely match in \`done\` or \`archived\`, call \`fn_task_show\` and inspect it before deciding. If an existing task covers the same work, do not write a spec \u2014 but still write PROMPT.md, with its entire contents being the single line \`DUPLICATE: {existing-task-id}\` and nothing else. That file is how the duplicate is recorded; announcing it only in your reply leaves no plan behind and re-plans the task in a loop.
12389
+ Before writing a spec, call \`fn_task_list\` for active work, then call \`fn_task_search\` with \`includeDone: false\` and \`includeArchived: false\` for 2-4 targeted keyword phrases from the title/description, such as file paths, symptoms, and symbols. Do not search completed or archived work for duplicate candidates. When an active match is a duplicate, do not write a spec \u2014 but still write PROMPT.md, with its entire contents being the single line \`DUPLICATE: {existing-task-id}\` and nothing else. That file is how the duplicate is recorded; announcing it only in your reply leaves no plan behind and re-plans the task in a loop.
12347
12390
 
12348
12391
  ## Required PROMPT.md shape
12349
12392
  Write PROMPT.md with Original Description, Before \u2192 After Transformation, Mission, Dependencies, Context to Read First, File Scope, Steps, Documentation Requirements, Completion Criteria, Git Commit Convention, and Do NOT. Put \`## Original Description\` immediately after the title/\`Created\`/\`Size\` metadata with the operator's original task description copied **verbatim** (do not paraphrase). Put \`## Before \u2192 After Transformation\` next, before \`## Mission\`, with concise Before/After bullets: current state, target state, why it satisfies the user's request at a glance. In \`## Steps\`, every executable heading MUST use \`### Step N: <name>\` (e.g. \`### Step 1: Preflight\`). Do not write bare \`### Preflight\` / \`### Implementation\` headings, and do not add review-level, triage subtask, or proactive subtask headings.
@@ -12385,6 +12428,8 @@ If the requested outcome is only to decide, route, or coordinate work, include \
12385
12428
  Write PROMPT.md directly and stop. Do not call \`fn_review_spec()\`; workflow Plan Review is the single optional plan review gate before execution.`;
12386
12429
  var TRIAGE_PROMPT_TEXT = `You are a task specification agent for "fn", an AI-orchestrated task board.
12387
12430
 
12431
+ ${PLANNING_COMPLETENESS_POLICY}
12432
+
12388
12433
  ## Your Role
12389
12434
  You are the specification quality gate for implementation success.
12390
12435
  Your job: take a rough task description and produce a fully specified PROMPT.md that another AI agent can execute autonomously in a fresh context with zero memory of this conversation.
@@ -12609,9 +12654,9 @@ Verified facts about this codebase's storage \u2014 cite these correctly so Plan
12609
12654
  - New Postgres migrations must be **registered explicitly** in \`packages/core/src/postgres/schema-applier.ts\` (version constant + bookkeeping check); a \`.sql\` file dropped in the migrations dir that is not wired there silently never runs.
12610
12655
 
12611
12656
  ## Duplicate check
12612
- Before writing a spec, first call \`fn_task_list\` to see active tasks, then call \`fn_task_search\` with 2-4 distinct keyword phrases from the task title and description (for example file paths, error symptoms, and symbol names).
12613
- For any likely match in \`done\` or \`archived\`, call \`fn_task_show\` to inspect details before deciding.
12614
- If a task already covers the same work (even if worded differently), do not write a spec.
12657
+ Before writing a spec, first call \`fn_task_list\` to see active tasks, then call \`fn_task_search\` with \`includeDone: false\` and \`includeArchived: false\` for 2-4 distinct keyword phrases from the task title and description (for example file paths, error symptoms, and symbol names).
12658
+ Do not search completed or archived work for duplicate candidates.
12659
+ If an actionable task already covers the same work (even if worded differently), do not write a spec.
12615
12660
  Instead you MUST still write PROMPT.md, with its ENTIRE contents being this one line and nothing else:
12616
12661
  \`DUPLICATE: {existing-task-id}\`
12617
12662
  Writing that file IS how you report the duplicate. Reporting it only in your reply is not recorded:
@@ -12642,7 +12687,7 @@ Workflow policy can disable proactive oversized-task splitting for operators who
12642
12687
  ## Triage tools
12643
12688
  You have these extra tools during triage:
12644
12689
  - \`fn_task_list\` \u2014 list existing active tasks
12645
- - \`fn_task_search\` \u2014 keyword search across tasks, including done and archived tasks
12690
+ - \`fn_task_search\` \u2014 keyword search across active tasks by default; history is opt-in for non-duplicate research
12646
12691
  - \`fn_task_show\` \u2014 inspect a task and its PROMPT.md
12647
12692
  - \`fn_task_create\` \u2014 create a child/follow-up task while triaging
12648
12693
  - \`fn_task_document_write\` \u2014 save a planning document (e.g., key="plan")
@@ -12869,20 +12914,6 @@ Concrete examples:
12869
12914
  - [Optional improvements, not blocking]
12870
12915
  \`\`\`
12871
12916
 
12872
- ## Spec / Plan Review Convergence
12873
-
12874
- Specs and pre-execution Plan Review share this gate. Prefer **APPROVE** / **APPROVE_WITH_NOTES** when the plan is executable enough for an agent to implement. Put optional polish only under **Suggestions**.
12875
-
12876
- When you must **REVISE**:
12877
- - List each blocking issue as a concrete PROMPT.md edit (which section, what to add/change/remove).
12878
- - Do not demand a full rewrite unless the approach is fundamentally wrong (**RETHINK**).
12879
- - Prefer fixing local PROMPT.md defects in-session when you have write tools, then **APPROVE**, instead of bouncing the task through another full replan cycle.
12880
-
12881
- **Converging on re-review (when the request includes your prior feedback + a Plan Review attempt number):**
12882
- - This is a spec you already reviewed. VERIFY each issue you previously raised was addressed. REVISE only for (a) a PRIOR blocking issue still unresolved, or (b) a genuinely NEW problem THIS revision introduced.
12883
- - Do NOT introduce a new blocking issue that ALSO applied to the version you previously reviewed \u2014 that is your own earlier miss. Record it under **Suggestions**, not REVISE.
12884
- - **Severity ratchet at attempt 3+:** gate ONLY on \`critical\` (delivery-blocking) issues. Downgrade lone \`important\`/\`minor\` spec-wording nits to **Suggestions** and APPROVE. Rationale: the executor and downstream code review are later gates \u2014 a spec need not be perfect to be executable, only executable.
12885
-
12886
12917
  ## Spec Review \u2014 Undersplit Task Detection
12887
12918
 
12888
12919
  When reviewing specs, assess whether the task should have been broken into subtasks. The bar for splitting is high \u2014 most tasks should remain whole. Coordination overhead (worktrees, dependency wiring, merge sequencing) is real, so splitting must clearly pay for itself.
@@ -13530,6 +13561,22 @@ function browserVerificationOptionalGroupNode(column, options = {}) {
13530
13561
  };
13531
13562
  }
13532
13563
 
13564
+ // ../core/src/agents/code-review-policy.ts
13565
+ var CODE_REVIEW_COMPLETENESS_POLICY = `## Mandatory Code Review Procedure
13566
+
13567
+ Apply this procedure to code reviews only. Plan/spec reviews use their dedicated criteria below.
13568
+
13569
+ Before choosing a verdict:
13570
+
13571
+ 1. Build a **requirements ledger** from PROMPT.md. For every Mission outcome, Completion Criterion, relevant \`## Surface Enumeration\` item, and \`## Symptom Verification\` assertion, identify both implementation evidence and test evidence. A missing or partial required row is REVISE.
13572
+ 2. Trace each changed behavior from its **real production entry point** and selector through the changed helper to its consumers. A helper-only unit test does not prove that production can reach the new branch.
13573
+ 3. For bug fixes, locate an automated test that reproduces the exact reported failure and asserts it is gone across the enumerated surfaces. Green builds, nearby unit tests, and synthetic state injection alone are insufficient.
13574
+ 4. For persistence, lifecycle, and concurrency changes, verify that evidence belongs to the **current state, version, or planning episode**; every read-check-write path is atomic, locked, or CAS-protected; all mutation surfaces preserve the invariant; waits and locks are bounded and cleanup-safe; and a production-shaped integration test covers both relevant orderings.
13575
+ 5. For route or state changes, inspect all affected UI, API, CLI, and agent consumers plus paired success/failure or approve/reject paths for contract parity.
13576
+ 6. Before APPROVE, perform a fresh adversarial validation pass: try to disprove each completed ledger row by reading the real caller, guard, consumer, and test. Cite \`file:line\` for every blocker and name the exact missing proof.
13577
+
13578
+ APPROVE only when every required ledger row has implementation and test evidence.`;
13579
+
13533
13580
  // ../core/src/workflows/builtin-code-review-group.ts
13534
13581
  var CODE_REVIEW_GROUP_ID = "code-review";
13535
13582
  var CODE_REVIEW_STEP_NODE_ID = "code-review-step";
@@ -13549,6 +13596,8 @@ var CODE_REVIEW_PROMPT = `You are a senior code reviewer. Review the task's diff
13549
13596
  5. **Error handling** \u2014 swallowed errors, unhandled rejections/exceptions, missing validation at trust boundaries, misleading error messages.
13550
13597
  6. **Contract / signature changes** \u2014 changed function/exported-type signatures, API request/response shapes, or serialization that breaks existing callers.
13551
13598
 
13599
+ ${CODE_REVIEW_COMPLETENESS_POLICY}
13600
+
13552
13601
  Be specific: cite \`file:line\` for every finding and explain the concrete failure it causes.
13553
13602
 
13554
13603
  ## Output Requirements
@@ -13668,12 +13717,14 @@ var PLAN_REVIEW_PROMPT = `You are a senior plan reviewer. Review the task's PROM
13668
13717
  4. **Verification quality** \u2014 absent or weak tests/checks for the behavior being changed.
13669
13718
  5. **Risk callouts** \u2014 migrations, data-loss paths, external integrations, secrets, or plugin/runtime dependencies that need explicit handling.
13670
13719
 
13720
+ ${PLAN_REVIEW_COMPLETENESS_POLICY}
13721
+
13671
13722
  Be specific: cite the plan section or file path for every finding and explain the concrete correction.
13672
13723
 
13673
13724
  ## Output Requirements
13674
13725
  - APPROVE: the plan is ready for execution.
13675
13726
  - APPROVE_WITH_NOTES: execution may proceed, but include non-blocking advisory notes.
13676
- - REVISE: the plan should be corrected before execution; include the missing or wrong requirement and the needed change.
13727
+ - REVISE: the plan should be corrected before execution; include every blocking finding and needed change in the JSON notes, not only in preceding prose.
13677
13728
  - Final output: output exactly one trailing JSON object on the final line (no markdown fences, no surrounding prose):
13678
13729
  {"verdict":"APPROVE|APPROVE_WITH_NOTES|REVISE","notes":"..."}`;
13679
13730
  function planReviewOptionalGroupNode(column, options = {}) {
@@ -5759,6 +5759,7 @@ __export(project_exports, {
5759
5759
  tasks: () => tasks,
5760
5760
  todoItems: () => todoItems,
5761
5761
  todoLists: () => todoLists,
5762
+ unplannedExecutionBlocks: () => unplannedExecutionBlocks,
5762
5763
  usageEvents: () => usageEvents,
5763
5764
  verificationCache: () => verificationCache,
5764
5765
  workflowPromptOverrides: () => workflowPromptOverrides,
@@ -5798,6 +5799,7 @@ var tasks = projectSchema.table("tasks", {
5798
5799
  worktree: text("worktree"),
5799
5800
  blockedBy: text("blocked_by"),
5800
5801
  overlapBlockedBy: text("overlap_blocked_by"),
5802
+ queuedLogEpisodeSignature: text("queued_log_episode_signature"),
5801
5803
  paused: integer("paused").default(0),
5802
5804
  userPaused: integer("user_paused").default(0),
5803
5805
  pausedReason: text("paused_reason"),
@@ -6603,6 +6605,14 @@ var workflowWorkItems = projectSchema.table("workflow_work_items", {
6603
6605
  index("idx_workflow_work_items_task_run").on(t.taskId, t.runId),
6604
6606
  uniqueIndex("idx_workflow_work_items_one_active_task_continuation").on(t.projectId, t.taskId).where(sql`${t.kind} = 'task' AND ${t.state} IN ('runnable', 'running', 'held', 'retrying')`)
6605
6607
  ]);
6608
+ var unplannedExecutionBlocks = projectSchema.table("unplanned_execution_blocks", {
6609
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
6610
+ taskId: text("task_id").notNull(),
6611
+ episode: text("episode").notNull(),
6612
+ createdAt: text("created_at").notNull()
6613
+ }, (t) => [
6614
+ primaryKey({ columns: [t.projectId, t.taskId, t.episode] })
6615
+ ]);
6606
6616
  var workflowRunBranches = projectSchema.table("workflow_run_branches", {
6607
6617
  projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
6608
6618
  taskId: text("task_id").notNull(),
@@ -12128,6 +12138,37 @@ var TRIAGE_POLICY_DEFAULTS = new Map(
12128
12138
  BUILTIN_TRIAGE_POLICY_SETTINGS.map((setting) => [setting.id, setting.default])
12129
12139
  );
12130
12140
 
12141
+ // ../core/src/agents/planning-review-policy.ts
12142
+ var PLANNING_COMPLETENESS_POLICY = `## Mandatory Planning Completeness Procedure
12143
+
12144
+ Before writing the final PROMPT.md:
12145
+
12146
+ 1. Build an internal **planning ledger** from the Original Description, user comments, project instructions, cited issue/report, and any saved planning document. Preserve every requirement, settled decision, explicit non-goal, and acceptance outcome; do not silently replace the reporter's contract with a narrower reproduction.
12147
+ 2. Research before structuring the plan. Trace the affected behavior through its real production entry points, callers, writers/readers, shared consumers, persistence boundaries, recovery paths, and existing tests. Resolve planning-time facts from the repository now; defer only details that genuinely require implementation-time discovery, and label those explicitly.
12148
+ 3. For stateful, lifecycle, persistence, or concurrency work, enumerate the participant graph and both relevant orderings: stale-work cancellation/fencing, lock order and reentrancy, transaction boundaries, pool/transport limits, competing recovery paths, configuration/deployment identities, bypass/force paths, and failure cleanup. Every stated invariant must name the surfaces that preserve it.
12149
+ 4. Map every ledger row to concrete File Scope entries, dependency-ordered implementation steps, and verification. Each feature-bearing step must name specific automated test scenarios with the input/state, action or ordering, and expected observable result; helper-only tests do not prove production reachability.
12150
+ 5. Keep scope disciplined. Reuse current architecture and documented patterns unless the reporter contract requires a redesign. Put optional cleanup and adjacent ideas outside the active steps.
12151
+ 6. Before persisting PROMPT.md, perform a fresh holistic completeness pass across the whole ledger. Try to disprove the plan by checking referenced paths and patterns, missing consumers, contradictory steps, uncovered failure orderings, and acceptance criteria without tests. Fix all gaps in one pass.
12152
+
12153
+ On a revision, treat the cumulative revision ledger as durable decisions unless a later entry explicitly supersedes one: preserve resolved items, address every unresolved item surgically, and rerun the complete procedure instead of checking only the latest comment.`;
12154
+ var FAST_PLANNING_COMPLETENESS_POLICY = `## Fast Planning Completeness Check
12155
+
12156
+ Before writing PROMPT.md, build a compact internal ledger from the Original Description, user comments, project rules, and acceptance outcomes. Inspect the real production callers/consumers, persistence or recovery paths, and nearby tests before choosing File Scope. For stateful or concurrent work, enumerate every participant plus both relevant orderings and failure cleanup. Map each requirement to a concrete step, file, and automated test scenario, then reread the whole plan once for missing surfaces, contradictions, and unproved outcomes. On revision, preserve prior decisions and address the complete cumulative ledger, not only the latest note.`;
12157
+ var PLAN_REVIEW_COMPLETENESS_POLICY = `## Mandatory Plan Review Procedure
12158
+
12159
+ Apply this procedure to plan/spec reviews only. Code reviews use their dedicated procedure.
12160
+
12161
+ Before choosing a verdict:
12162
+
12163
+ 1. Build one **review ledger** for the entire PROMPT.md: Original Description and user comments; Mission and Completion Criteria; Surface Enumeration and Symptom Verification when required; every implementation step, File Scope entry, dependency, risk, and test/verification promise.
12164
+ 2. Complete the full review before reporting. Check coherence and requirement traceability, feasibility against the current repository, scope discipline, execution ordering, and verification quality. When relevant, also inspect security/data integrity, state transitions, concurrency orderings, deployment/configuration boundaries, recovery competitors, and force/bypass paths.
12165
+ 3. Review at specification altitude. Block when a required behavior, surface, ordering, safety constraint, or proof is missing or the stated approach cannot work. Keep optional implementation detail, wording polish, and nonessential improvements advisory.
12166
+ 4. If REVISE is necessary, batch **all independently discoverable blocking findings** into this one verdict; do not stop after the first defect. Give each blocker a stable ID, cite the affected section or repository evidence, and state the concrete PROMPT.md correction. Put advisory observations in a separate list.
12167
+ 5. On re-review, use the supplied prior-review ledger as a decision primer. Verify every prior blocker, do not re-raise resolved or rejected semantic duplicates, and preserve accepted decisions. A newly blocking finding must say whether the revision introduced it, which prior blocker genuinely masked it, or why it is independently delivery-blocking for correctness, security, data safety, or executability. Record an earlier reviewer miss explicitly; never demote a critical defect merely because it was missed before.
12168
+ 6. After any same-session PROMPT.md edit, distrust the edit: reread the complete artifact, rebuild the ledger, and perform a fresh holistic pass before APPROVE.
12169
+
12170
+ APPROVE when the plan is executable and verifiable, not when it is cosmetically perfect. If returning REVISE, the verdict notes must contain the complete blocking checklist because those notes are the durable input to the next planning round.`;
12171
+
12131
12172
  // ../core/src/agents/agent-prompts.ts
12132
12173
  var FUSION_RUNTIME_SELF_AWARENESS = `## Runtime Self-Awareness
12133
12174
 
@@ -12334,6 +12375,8 @@ The tool prevents your session from being killed by the inactivity watchdog duri
12334
12375
  - If a verification command times out, do NOT blindly retry \u2014 investigate. Check for hung subprocesses, infinite test loops, or tests waiting on missing dependencies. Use \`node_modules/.modules.yaml\` presence to confirm bootstrap.`;
12335
12376
  var FAST_TRIAGE_PROMPT_TEXT = `You are a task specification agent for "fn". This task is running in **fast mode**.
12336
12377
 
12378
+ ${FAST_PLANNING_COMPLETENESS_POLICY}
12379
+
12337
12380
  Write a lean, executable PROMPT.md quickly. Preserve safety gates, but skip heavyweight ceremony, review scoring, and proactive subtask analysis.
12338
12381
 
12339
12382
  ## Fast-mode priorities
@@ -12342,7 +12385,7 @@ Write a lean, executable PROMPT.md quickly. Preserve safety gates, but skip heav
12342
12385
  - Preserve required safety sections for bugs, workflow routing, forensic tasks, and decision-only work.
12343
12386
 
12344
12387
  ## Duplicate check
12345
- Before writing a spec, call \`fn_task_list\` for active work, then call \`fn_task_search\` with 2-4 targeted keyword phrases from the title/description, such as file paths, symptoms, and symbols. For any likely match in \`done\` or \`archived\`, call \`fn_task_show\` and inspect it before deciding. If an existing task covers the same work, do not write a spec \u2014 but still write PROMPT.md, with its entire contents being the single line \`DUPLICATE: {existing-task-id}\` and nothing else. That file is how the duplicate is recorded; announcing it only in your reply leaves no plan behind and re-plans the task in a loop.
12388
+ Before writing a spec, call \`fn_task_list\` for active work, then call \`fn_task_search\` with \`includeDone: false\` and \`includeArchived: false\` for 2-4 targeted keyword phrases from the title/description, such as file paths, symptoms, and symbols. Do not search completed or archived work for duplicate candidates. When an active match is a duplicate, do not write a spec \u2014 but still write PROMPT.md, with its entire contents being the single line \`DUPLICATE: {existing-task-id}\` and nothing else. That file is how the duplicate is recorded; announcing it only in your reply leaves no plan behind and re-plans the task in a loop.
12346
12389
 
12347
12390
  ## Required PROMPT.md shape
12348
12391
  Write PROMPT.md with Original Description, Before \u2192 After Transformation, Mission, Dependencies, Context to Read First, File Scope, Steps, Documentation Requirements, Completion Criteria, Git Commit Convention, and Do NOT. Put \`## Original Description\` immediately after the title/\`Created\`/\`Size\` metadata with the operator's original task description copied **verbatim** (do not paraphrase). Put \`## Before \u2192 After Transformation\` next, before \`## Mission\`, with concise Before/After bullets: current state, target state, why it satisfies the user's request at a glance. In \`## Steps\`, every executable heading MUST use \`### Step N: <name>\` (e.g. \`### Step 1: Preflight\`). Do not write bare \`### Preflight\` / \`### Implementation\` headings, and do not add review-level, triage subtask, or proactive subtask headings.
@@ -12384,6 +12427,8 @@ If the requested outcome is only to decide, route, or coordinate work, include \
12384
12427
  Write PROMPT.md directly and stop. Do not call \`fn_review_spec()\`; workflow Plan Review is the single optional plan review gate before execution.`;
12385
12428
  var TRIAGE_PROMPT_TEXT = `You are a task specification agent for "fn", an AI-orchestrated task board.
12386
12429
 
12430
+ ${PLANNING_COMPLETENESS_POLICY}
12431
+
12387
12432
  ## Your Role
12388
12433
  You are the specification quality gate for implementation success.
12389
12434
  Your job: take a rough task description and produce a fully specified PROMPT.md that another AI agent can execute autonomously in a fresh context with zero memory of this conversation.
@@ -12608,9 +12653,9 @@ Verified facts about this codebase's storage \u2014 cite these correctly so Plan
12608
12653
  - New Postgres migrations must be **registered explicitly** in \`packages/core/src/postgres/schema-applier.ts\` (version constant + bookkeeping check); a \`.sql\` file dropped in the migrations dir that is not wired there silently never runs.
12609
12654
 
12610
12655
  ## Duplicate check
12611
- Before writing a spec, first call \`fn_task_list\` to see active tasks, then call \`fn_task_search\` with 2-4 distinct keyword phrases from the task title and description (for example file paths, error symptoms, and symbol names).
12612
- For any likely match in \`done\` or \`archived\`, call \`fn_task_show\` to inspect details before deciding.
12613
- If a task already covers the same work (even if worded differently), do not write a spec.
12656
+ Before writing a spec, first call \`fn_task_list\` to see active tasks, then call \`fn_task_search\` with \`includeDone: false\` and \`includeArchived: false\` for 2-4 distinct keyword phrases from the task title and description (for example file paths, error symptoms, and symbol names).
12657
+ Do not search completed or archived work for duplicate candidates.
12658
+ If an actionable task already covers the same work (even if worded differently), do not write a spec.
12614
12659
  Instead you MUST still write PROMPT.md, with its ENTIRE contents being this one line and nothing else:
12615
12660
  \`DUPLICATE: {existing-task-id}\`
12616
12661
  Writing that file IS how you report the duplicate. Reporting it only in your reply is not recorded:
@@ -12641,7 +12686,7 @@ Workflow policy can disable proactive oversized-task splitting for operators who
12641
12686
  ## Triage tools
12642
12687
  You have these extra tools during triage:
12643
12688
  - \`fn_task_list\` \u2014 list existing active tasks
12644
- - \`fn_task_search\` \u2014 keyword search across tasks, including done and archived tasks
12689
+ - \`fn_task_search\` \u2014 keyword search across active tasks by default; history is opt-in for non-duplicate research
12645
12690
  - \`fn_task_show\` \u2014 inspect a task and its PROMPT.md
12646
12691
  - \`fn_task_create\` \u2014 create a child/follow-up task while triaging
12647
12692
  - \`fn_task_document_write\` \u2014 save a planning document (e.g., key="plan")
@@ -12868,20 +12913,6 @@ Concrete examples:
12868
12913
  - [Optional improvements, not blocking]
12869
12914
  \`\`\`
12870
12915
 
12871
- ## Spec / Plan Review Convergence
12872
-
12873
- Specs and pre-execution Plan Review share this gate. Prefer **APPROVE** / **APPROVE_WITH_NOTES** when the plan is executable enough for an agent to implement. Put optional polish only under **Suggestions**.
12874
-
12875
- When you must **REVISE**:
12876
- - List each blocking issue as a concrete PROMPT.md edit (which section, what to add/change/remove).
12877
- - Do not demand a full rewrite unless the approach is fundamentally wrong (**RETHINK**).
12878
- - Prefer fixing local PROMPT.md defects in-session when you have write tools, then **APPROVE**, instead of bouncing the task through another full replan cycle.
12879
-
12880
- **Converging on re-review (when the request includes your prior feedback + a Plan Review attempt number):**
12881
- - This is a spec you already reviewed. VERIFY each issue you previously raised was addressed. REVISE only for (a) a PRIOR blocking issue still unresolved, or (b) a genuinely NEW problem THIS revision introduced.
12882
- - Do NOT introduce a new blocking issue that ALSO applied to the version you previously reviewed \u2014 that is your own earlier miss. Record it under **Suggestions**, not REVISE.
12883
- - **Severity ratchet at attempt 3+:** gate ONLY on \`critical\` (delivery-blocking) issues. Downgrade lone \`important\`/\`minor\` spec-wording nits to **Suggestions** and APPROVE. Rationale: the executor and downstream code review are later gates \u2014 a spec need not be perfect to be executable, only executable.
12884
-
12885
12916
  ## Spec Review \u2014 Undersplit Task Detection
12886
12917
 
12887
12918
  When reviewing specs, assess whether the task should have been broken into subtasks. The bar for splitting is high \u2014 most tasks should remain whole. Coordination overhead (worktrees, dependency wiring, merge sequencing) is real, so splitting must clearly pay for itself.
@@ -13529,6 +13560,22 @@ function browserVerificationOptionalGroupNode(column, options = {}) {
13529
13560
  };
13530
13561
  }
13531
13562
 
13563
+ // ../core/src/agents/code-review-policy.ts
13564
+ var CODE_REVIEW_COMPLETENESS_POLICY = `## Mandatory Code Review Procedure
13565
+
13566
+ Apply this procedure to code reviews only. Plan/spec reviews use their dedicated criteria below.
13567
+
13568
+ Before choosing a verdict:
13569
+
13570
+ 1. Build a **requirements ledger** from PROMPT.md. For every Mission outcome, Completion Criterion, relevant \`## Surface Enumeration\` item, and \`## Symptom Verification\` assertion, identify both implementation evidence and test evidence. A missing or partial required row is REVISE.
13571
+ 2. Trace each changed behavior from its **real production entry point** and selector through the changed helper to its consumers. A helper-only unit test does not prove that production can reach the new branch.
13572
+ 3. For bug fixes, locate an automated test that reproduces the exact reported failure and asserts it is gone across the enumerated surfaces. Green builds, nearby unit tests, and synthetic state injection alone are insufficient.
13573
+ 4. For persistence, lifecycle, and concurrency changes, verify that evidence belongs to the **current state, version, or planning episode**; every read-check-write path is atomic, locked, or CAS-protected; all mutation surfaces preserve the invariant; waits and locks are bounded and cleanup-safe; and a production-shaped integration test covers both relevant orderings.
13574
+ 5. For route or state changes, inspect all affected UI, API, CLI, and agent consumers plus paired success/failure or approve/reject paths for contract parity.
13575
+ 6. Before APPROVE, perform a fresh adversarial validation pass: try to disprove each completed ledger row by reading the real caller, guard, consumer, and test. Cite \`file:line\` for every blocker and name the exact missing proof.
13576
+
13577
+ APPROVE only when every required ledger row has implementation and test evidence.`;
13578
+
13532
13579
  // ../core/src/workflows/builtin-code-review-group.ts
13533
13580
  var CODE_REVIEW_GROUP_ID = "code-review";
13534
13581
  var CODE_REVIEW_STEP_NODE_ID = "code-review-step";
@@ -13548,6 +13595,8 @@ var CODE_REVIEW_PROMPT = `You are a senior code reviewer. Review the task's diff
13548
13595
  5. **Error handling** \u2014 swallowed errors, unhandled rejections/exceptions, missing validation at trust boundaries, misleading error messages.
13549
13596
  6. **Contract / signature changes** \u2014 changed function/exported-type signatures, API request/response shapes, or serialization that breaks existing callers.
13550
13597
 
13598
+ ${CODE_REVIEW_COMPLETENESS_POLICY}
13599
+
13551
13600
  Be specific: cite \`file:line\` for every finding and explain the concrete failure it causes.
13552
13601
 
13553
13602
  ## Output Requirements
@@ -13667,12 +13716,14 @@ var PLAN_REVIEW_PROMPT = `You are a senior plan reviewer. Review the task's PROM
13667
13716
  4. **Verification quality** \u2014 absent or weak tests/checks for the behavior being changed.
13668
13717
  5. **Risk callouts** \u2014 migrations, data-loss paths, external integrations, secrets, or plugin/runtime dependencies that need explicit handling.
13669
13718
 
13719
+ ${PLAN_REVIEW_COMPLETENESS_POLICY}
13720
+
13670
13721
  Be specific: cite the plan section or file path for every finding and explain the concrete correction.
13671
13722
 
13672
13723
  ## Output Requirements
13673
13724
  - APPROVE: the plan is ready for execution.
13674
13725
  - APPROVE_WITH_NOTES: execution may proceed, but include non-blocking advisory notes.
13675
- - REVISE: the plan should be corrected before execution; include the missing or wrong requirement and the needed change.
13726
+ - REVISE: the plan should be corrected before execution; include every blocking finding and needed change in the JSON notes, not only in preceding prose.
13676
13727
  - Final output: output exactly one trailing JSON object on the final line (no markdown fences, no surrounding prose):
13677
13728
  {"verdict":"APPROVE|APPROVE_WITH_NOTES|REVISE","notes":"..."}`;
13678
13729
  function planReviewOptionalGroupNode(column, options = {}) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fusion-plugin-examples/acp-runtime",
3
- "version": "0.1.33-beta.0",
3
+ "version": "0.1.33-beta.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {