@runfusion/fusion 0.76.0-beta.1 → 0.76.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 +503 -213
  2. package/dist/child-process-worker.js +466 -207
  3. package/dist/client/.vite/manifest.json +260 -260
  4. package/dist/client/assets/{AgentDetailView-Cbl1sw6i.js → AgentDetailView-gak4EWTI.js} +1 -1
  5. package/dist/client/assets/{AgentPermissionPolicyEditor-DD1U5M9p.js → AgentPermissionPolicyEditor-DP1QbZL-.js} +1 -1
  6. package/dist/client/assets/{AgentsView-BMcCbple.js → AgentsView-DAMRTKzI.js} +3 -3
  7. package/dist/client/assets/ChatView-iE-2gf5P.js +13 -0
  8. package/dist/client/assets/{CommandCenter-D7mcD61V.js → CommandCenter-B6RnkLYm.js} +1 -1
  9. package/dist/client/assets/{DevServerView-DaqCn0p5.js → DevServerView-DcFL_LzK.js} +1 -1
  10. package/dist/client/assets/{DirectoryPicker-CLdqqqYN.js → DirectoryPicker-CtjqrYoO.js} +1 -1
  11. package/dist/client/assets/{DocumentsView-BOROVxPm.js → DocumentsView-BkAe2S4H.js} +1 -1
  12. package/dist/client/assets/{EvalsView-BQMXRUlQ.js → EvalsView-CbGA9dMn.js} +1 -1
  13. package/dist/client/assets/{ExperimentalAgentOnboardingModal-1GNeCIQT.js → ExperimentalAgentOnboardingModal-CMgO_S8T.js} +1 -1
  14. package/dist/client/assets/{GoalsView-Cr3c_2GC.js → GoalsView-_3P9J5sf.js} +1 -1
  15. package/dist/client/assets/{InsightsView-DgVBVQM4.js → InsightsView-DOhO7xH5.js} +1 -1
  16. package/dist/client/assets/{MemoryView-C0VzzMSw.js → MemoryView-DwJas8vi.js} +1 -1
  17. package/dist/client/assets/{PiExtensionsManager-D1kkkVtP.js → PiExtensionsManager-B_LiW_e9.js} +1 -1
  18. package/dist/client/assets/{PluginManager-BW-_Zyo5.js → PluginManager-BkB6WLQc.js} +1 -1
  19. package/dist/client/assets/{PullRequestView-Cmlo4nWA.js → PullRequestView-DcH5tmYc.js} +1 -1
  20. package/dist/client/assets/{ReportModal-BWuaroTF.js → ReportModal-BOEbqtqG.js} +1 -1
  21. package/dist/client/assets/{ResearchView-BmkF_vZU.js → ResearchView-Dp6V42pI.js} +1 -1
  22. package/dist/client/assets/{SecretsView-DVc8Hky0.js → SecretsView-BCqXHB2L.js} +1 -1
  23. package/dist/client/assets/{SessionTerminal-DCXrxA57.js → SessionTerminal-CkdoQv4y.js} +1 -1
  24. package/dist/client/assets/{SettingsModal-DZ32F1c-.js → SettingsModal-D4Fn4GlS.js} +3 -3
  25. package/dist/client/assets/{SettingsModal-DqwpLnDU.js → SettingsModal-Dc7YG6KB.js} +1 -1
  26. package/dist/client/assets/{SettingsTextareaRow-B5spAoOY.js → SettingsTextareaRow-WSkBoAOO.js} +1 -1
  27. package/dist/client/assets/{SetupWizardModal-VTBLyFzr.js → SetupWizardModal-VTrJAsKd.js} +2 -2
  28. package/dist/client/assets/{SkillsView-CR91ey9d.js → SkillsView-CXeXOxfF.js} +1 -1
  29. package/dist/client/assets/{WorkflowNodeEditor-BzGh_Fd9.js → WorkflowNodeEditor-DoxLGPRF.js} +1 -1
  30. package/dist/client/assets/{agent-import-generation-D27NKQsr.js → agent-import-generation-upc0yw-M.js} +1 -1
  31. package/dist/client/assets/{agentsOrgChartLayout-C2K_M3x3.js → agentsOrgChartLayout-C3iumMrW.js} +1 -1
  32. package/dist/client/assets/{architectureDiagram-3BPJPVTR-BQy8UcRx.js → architectureDiagram-3BPJPVTR-D6jqc3fJ.js} +1 -1
  33. package/dist/client/assets/{blockDiagram-GPEHLZMM-CZG1bqFQ.js → blockDiagram-GPEHLZMM-DY3AKuPD.js} +1 -1
  34. package/dist/client/assets/{c4Diagram-AAUBKEIU-CZmO_kg3.js → c4Diagram-AAUBKEIU-CpD52V4g.js} +1 -1
  35. package/dist/client/assets/channel-CaxOu15c.js +1 -0
  36. package/dist/client/assets/{chunk-2J33WTMH-jsad6DTE.js → chunk-2J33WTMH-CPeIHyAX.js} +1 -1
  37. package/dist/client/assets/{chunk-4BX2VUAB-DX7SuvwP.js → chunk-4BX2VUAB-ivAwI4xM.js} +1 -1
  38. package/dist/client/assets/{chunk-55IACEB6-De20xFgU.js → chunk-55IACEB6-BtVQ5XaZ.js} +1 -1
  39. package/dist/client/assets/{chunk-727SXJPM-CNiri9yW.js → chunk-727SXJPM-1eap1vDU.js} +1 -1
  40. package/dist/client/assets/{chunk-AQP2D5EJ-DvDqG-ax.js → chunk-AQP2D5EJ-B2NB3BW9.js} +1 -1
  41. package/dist/client/assets/{chunk-FMBD7UC4-DkMdKaUq.js → chunk-FMBD7UC4-Hk_smNYv.js} +1 -1
  42. package/dist/client/assets/{chunk-ND2GUHAM-Do5BwIrI.js → chunk-ND2GUHAM-BmGCAojk.js} +1 -1
  43. package/dist/client/assets/{chunk-QZHKN3VN-BnJgt9vl.js → chunk-QZHKN3VN-D0aXZ8CV.js} +1 -1
  44. package/dist/client/assets/classDiagram-4FO5ZUOK-DXIkGbsl.js +1 -0
  45. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-DXIkGbsl.js +1 -0
  46. package/dist/client/assets/{cose-bilkent-S5V4N54A-D-ivAzzF.js → cose-bilkent-S5V4N54A-DAbu_gnF.js} +1 -1
  47. package/dist/client/assets/{dagre-BM42HDAG-Bpd9L0or.js → dagre-BM42HDAG-BdmLlrDJ.js} +1 -1
  48. package/dist/client/assets/{dashboard-view-DSvVO6Vr.js → dashboard-view-BoFBSXUn.js} +1 -1
  49. package/dist/client/assets/{dashboard-view-CgBo8Ctn.js → dashboard-view-CULL1yhL.js} +1 -1
  50. package/dist/client/assets/{dashboard-view-C-XU9CVv.js → dashboard-view-CxXMDfNY.js} +1 -1
  51. package/dist/client/assets/{dashboard-view-DbaRE8Ma.js → dashboard-view-PRCWCSLm.js} +1 -1
  52. package/dist/client/assets/{diagram-2AECGRRQ-B6TT1NWU.js → diagram-2AECGRRQ-PpqLbVUA.js} +1 -1
  53. package/dist/client/assets/{diagram-5GNKFQAL-DpRS2yRw.js → diagram-5GNKFQAL-9rkGmTwh.js} +1 -1
  54. package/dist/client/assets/{diagram-KO2AKTUF-BVbZr02C.js → diagram-KO2AKTUF-BT-efOMo.js} +1 -1
  55. package/dist/client/assets/{diagram-LMA3HP47-DzENbfal.js → diagram-LMA3HP47-w79OWFxg.js} +1 -1
  56. package/dist/client/assets/{diagram-OG6HWLK6-BIePG5SY.js → diagram-OG6HWLK6-Bye9I5IO.js} +1 -1
  57. package/dist/client/assets/{erDiagram-TEJ5UH35-CQo3WBwo.js → erDiagram-TEJ5UH35-aodREgDf.js} +1 -1
  58. package/dist/client/assets/{flowDiagram-I6XJVG4X-Ct2H4jYo.js → flowDiagram-I6XJVG4X-D0DKItY3.js} +1 -1
  59. package/dist/client/assets/{folder-open-DAh8mpTX.js → folder-open-CqvaMJvx.js} +1 -1
  60. package/dist/client/assets/{ganttDiagram-6RSMTGT7-DyOLCG4B.js → ganttDiagram-6RSMTGT7-CZVApkvw.js} +1 -1
  61. package/dist/client/assets/{gitGraphDiagram-PVQCEYII-sC28-su3.js → gitGraphDiagram-PVQCEYII-D_ynwJ4p.js} +1 -1
  62. package/dist/client/assets/index-DWRJyaa3.js +2818 -0
  63. package/dist/client/assets/{infoDiagram-5YYISTIA-Q81_5aBZ.js → infoDiagram-5YYISTIA-pJG6zxjk.js} +1 -1
  64. package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-Cwkjs0z5.js → ishikawaDiagram-YF4QCWOH-nFZ5laUo.js} +1 -1
  65. package/dist/client/assets/{journeyDiagram-JHISSGLW-BXcBV1Bc.js → journeyDiagram-JHISSGLW-CWpCaAIe.js} +1 -1
  66. package/dist/client/assets/{kanban-definition-UN3LZRKU-BI7hW892.js → kanban-definition-UN3LZRKU-ATkPspKa.js} +1 -1
  67. package/dist/client/assets/{mermaid.core-B8oDA6jj.js → mermaid.core-CDXPNs7a.js} +4 -4
  68. package/dist/client/assets/{mindmap-definition-RKZ34NQL-COG6_9eD.js → mindmap-definition-RKZ34NQL-BkqS9tpe.js} +1 -1
  69. package/dist/client/assets/{pieDiagram-4H26LBE5-D11brZ_N.js → pieDiagram-4H26LBE5-DEUyVLs-.js} +1 -1
  70. package/dist/client/assets/{puzzle-D3_Z_rlW.js → puzzle-DQ0y1-XK.js} +1 -1
  71. package/dist/client/assets/{quadrantDiagram-W4KKPZXB-jmhDVZcv.js → quadrantDiagram-W4KKPZXB-ESBJNK5c.js} +1 -1
  72. package/dist/client/assets/{requirementDiagram-4Y6WPE33-BKCUWI1E.js → requirementDiagram-4Y6WPE33-CqPs7zcv.js} +1 -1
  73. package/dist/client/assets/{sankeyDiagram-5OEKKPKP-HsZdEl2t.js → sankeyDiagram-5OEKKPKP-CkFN0m14.js} +1 -1
  74. package/dist/client/assets/{sequenceDiagram-3UESZ5HK-CsDf7Fup.js → sequenceDiagram-3UESZ5HK-Dx2nDuMO.js} +1 -1
  75. package/dist/client/assets/{shield-alert-C16k8wNu.js → shield-alert-BS05s4RM.js} +1 -1
  76. package/dist/client/assets/{standing-instructions-template-BqAyftqe.js → standing-instructions-template-xprxYNHm.js} +1 -1
  77. package/dist/client/assets/{stateDiagram-AJRCARHV-fvzWhltB.js → stateDiagram-AJRCARHV-EUPmRFGd.js} +1 -1
  78. package/dist/client/assets/{stateDiagram-v2-BHNVJYJU-cnt42Sr_.js → stateDiagram-v2-BHNVJYJU-DcQ2mhi5.js} +1 -1
  79. package/dist/client/assets/{timeline-definition-PNZ67QCA-DsZFCSMb.js → timeline-definition-PNZ67QCA-D4YO_3V-.js} +1 -1
  80. package/dist/client/assets/{upload-_s5sL5Pq.js → upload-BjyBtxo7.js} +1 -1
  81. package/dist/client/assets/{users-DH1U5ISc.js → users-D5ogZ7WQ.js} +1 -1
  82. package/dist/client/assets/{vennDiagram-CIIHVFJN-B3KDWS-e.js → vennDiagram-CIIHVFJN-BT5_XuQL.js} +1 -1
  83. package/dist/client/assets/{wardley-L42UT6IY-BKs5MtQS.js → wardley-L42UT6IY-X_ZMW457.js} +1 -1
  84. package/dist/client/assets/{wardleyDiagram-YWT4CUSO-CNsEoXVB.js → wardleyDiagram-YWT4CUSO-GK9nONHU.js} +1 -1
  85. package/dist/client/assets/{xychartDiagram-2RQKCTM6-kq_gW4QC.js → xychartDiagram-2RQKCTM6-Dw3zXHAq.js} +1 -1
  86. package/dist/client/index.html +1 -1
  87. package/dist/client/version.json +1 -1
  88. package/dist/droid-cli/package.json +1 -1
  89. package/dist/extension.js +647 -207
  90. package/dist/migrations/0057_fn_9004_project_ownership_default_reconciliation.sql +13 -0
  91. package/dist/migrations/0058_fn_9014_message_archive.sql +13 -0
  92. package/dist/pi-claude-cli/package.json +5 -5
  93. package/dist/plugin-sdk/index.js +69 -23
  94. package/dist/plugins/fusion-plugin-acp-runtime/bundled.js +69 -23
  95. package/dist/plugins/fusion-plugin-acp-runtime/package.json +1 -1
  96. package/dist/plugins/fusion-plugin-claude-runtime/bundled.js +69 -23
  97. package/dist/plugins/fusion-plugin-claude-runtime/package.json +1 -1
  98. package/dist/plugins/fusion-plugin-cli-printing-press/bundled.js +69 -23
  99. package/dist/plugins/fusion-plugin-cli-printing-press/package.json +1 -1
  100. package/dist/plugins/fusion-plugin-compound-engineering/bundled.js +69 -23
  101. package/dist/plugins/fusion-plugin-compound-engineering/package.json +1 -1
  102. package/dist/plugins/fusion-plugin-cursor-runtime/bundled.js +69 -23
  103. package/dist/plugins/fusion-plugin-cursor-runtime/package.json +1 -1
  104. package/dist/plugins/fusion-plugin-dependency-graph/bundled.js +69 -23
  105. package/dist/plugins/fusion-plugin-dependency-graph/package.json +1 -1
  106. package/dist/plugins/fusion-plugin-droid-runtime/bundled.js +71 -25
  107. package/dist/plugins/fusion-plugin-droid-runtime/package.json +1 -1
  108. package/dist/plugins/fusion-plugin-grok-runtime/bundled.js +69 -23
  109. package/dist/plugins/fusion-plugin-grok-runtime/package.json +1 -1
  110. package/dist/plugins/fusion-plugin-hermes-runtime/bundled.js +69 -23
  111. package/dist/plugins/fusion-plugin-hermes-runtime/package.json +1 -1
  112. package/dist/plugins/fusion-plugin-linear-import/bundled.js +69 -23
  113. package/dist/plugins/fusion-plugin-linear-import/package.json +1 -1
  114. package/dist/plugins/fusion-plugin-omp-runtime/bundled.js +69 -23
  115. package/dist/plugins/fusion-plugin-omp-runtime/package.json +1 -1
  116. package/dist/plugins/fusion-plugin-openclaw-runtime/bundled.js +69 -23
  117. package/dist/plugins/fusion-plugin-openclaw-runtime/package.json +1 -1
  118. package/dist/plugins/fusion-plugin-paperclip-runtime/bundled.js +69 -23
  119. package/dist/plugins/fusion-plugin-paperclip-runtime/package.json +1 -1
  120. package/dist/plugins/fusion-plugin-quality/bundled.js +69 -23
  121. package/dist/plugins/fusion-plugin-quality/package.json +1 -1
  122. package/dist/plugins/fusion-plugin-reports/bundled.js +69 -23
  123. package/dist/plugins/fusion-plugin-reports/package.json +1 -1
  124. package/dist/plugins/fusion-plugin-roadmap/bundled.js +69 -23
  125. package/dist/plugins/fusion-plugin-roadmap/package.json +1 -1
  126. package/dist/plugins/fusion-plugin-todos/bundled.js +69 -23
  127. package/dist/plugins/fusion-plugin-todos/package.json +1 -1
  128. package/dist/plugins/fusion-plugin-whatsapp-chat/bundled.js +69 -23
  129. package/dist/plugins/fusion-plugin-whatsapp-chat/package.json +1 -1
  130. package/package.json +3 -3
  131. package/skill/fusion/SKILL.md +1 -1
  132. package/skill/fusion/references/extension-tools.md +22 -0
  133. package/skill/fusion/references/fusion-capabilities.md +2 -0
  134. package/dist/client/assets/ChatView-DcM-ARpZ.js +0 -13
  135. package/dist/client/assets/channel-Cwl9FefC.js +0 -1
  136. package/dist/client/assets/classDiagram-4FO5ZUOK-BZtWCoHC.js +0 -1
  137. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-BZtWCoHC.js +0 -1
  138. package/dist/client/assets/index-BlGpMJSZ.js +0 -2818
@@ -0,0 +1,13 @@
1
+ /*
2
+ FNXC:MultiProjectIsolation 2026-08-12-15:43:
3
+ Migration 0048 created github_check_states after ownership migration 0006 and retained its
4
+ pre-isolation empty project_id default. Reconcile only that default so omitted ownership values
5
+ continue through the database GUC/trigger path without rewriting rows, keys, RLS, or triggers.
6
+ */
7
+ DO $$
8
+ BEGIN
9
+ IF to_regclass('project.github_check_states') IS NOT NULL THEN
10
+ ALTER TABLE project.github_check_states
11
+ ALTER COLUMN project_id SET DEFAULT COALESCE(NULLIF(current_setting('fusion.project_id', true), ''), '__legacy_unscoped__');
12
+ END IF;
13
+ END $$;
@@ -0,0 +1,13 @@
1
+ /*
2
+ FNXC:MessageArchive 2026-08-12-22:14:
3
+ Mailbox archive is the default non-destructive removal action. Existing correspondence remains
4
+ visible as non-archived until an operator explicitly archives it, while delete stays available.
5
+ */
6
+ DO $$
7
+ BEGIN
8
+ IF to_regclass('project.messages') IS NOT NULL THEN
9
+ ALTER TABLE project.messages ADD COLUMN IF NOT EXISTS archived integer DEFAULT 0;
10
+ CREATE INDEX IF NOT EXISTS "idxMessagesToArchived"
11
+ ON project.messages (to_id, to_type, archived);
12
+ END IF;
13
+ END $$;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fusion/pi-claude-cli",
3
- "version": "0.76.0-beta.1",
3
+ "version": "0.76.0-beta.2",
4
4
  "type": "module",
5
5
  "private": true,
6
6
  "main": "index.ts",
@@ -13,14 +13,14 @@
13
13
  "@agentclientprotocol/sdk": "0.24.0"
14
14
  },
15
15
  "devDependencies": {
16
- "@earendil-works/pi-ai": "0.82.1",
17
- "@earendil-works/pi-coding-agent": "0.82.1",
16
+ "@earendil-works/pi-ai": "0.84.1",
17
+ "@earendil-works/pi-coding-agent": "0.84.1",
18
18
  "@types/node": "^22.0.0",
19
19
  "typescript": "^5.7.0",
20
20
  "vitest": "^4.1.10"
21
21
  },
22
22
  "peerDependencies": {
23
- "@earendil-works/pi-ai": "0.82.1",
24
- "@earendil-works/pi-coding-agent": "0.82.1"
23
+ "@earendil-works/pi-ai": "0.84.1",
24
+ "@earendil-works/pi-coding-agent": "0.84.1"
25
25
  }
26
26
  }
@@ -6114,9 +6114,14 @@ var config = projectSchema.table("config", {
6114
6114
  // now keyed per-project on `project_id` (the effective PK). `id` is retained
6115
6115
  // for column-shape parity (always 1) but is no longer the PK and no longer
6116
6116
  // CHECK-constrained. Single-project / SQLite-parity callers leave project_id
6117
- // at its '' default (one row), preserving the pre-isolation behavior.
6117
+ // through the database ownership trigger, preserving the pre-isolation behavior.
6118
+ /*
6119
+ FNXC:MultiProjectIsolation 2026-08-12-15:43:
6120
+ Migration 0006 owns config's project_id default and leaves its catalog PK as (project_id).
6121
+ Drizzle emits DEFAULT while the database GUC/trigger selects the effective ownership partition.
6122
+ */
6118
6123
  id: integer("id").default(1),
6119
- projectId: text("project_id").notNull().default("").primaryKey(),
6124
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`).primaryKey(),
6120
6125
  nextId: integer("next_id").default(1),
6121
6126
  nextWorkflowStepId: integer("next_workflow_step_id").default(1),
6122
6127
  // FNXC:SqliteFinalRemoval 2026-06-28:
@@ -6510,9 +6515,13 @@ var taskCommitAssociations = projectSchema.table("task_commit_associations", {
6510
6515
  var automations = projectSchema.table("automations", {
6511
6516
  /*
6512
6517
  * FNXC:AutomationIsolation 2026-07-13-22:37:
6513
- * Automations are partitioned by the AsyncDataLayer's project ID because embedded PostgreSQL consolidates the per-project SQLite files into one table. The composite key deliberately permits the same automation ID in two projects without allowing either project's CRUD or cron-claim path to address the other row. The empty default preserves an explicit partition for legacy and project-agnostic callers until startup stamps migrated rows.
6518
+ * Automations are partitioned by the AsyncDataLayer's project ID because embedded PostgreSQL consolidates the per-project SQLite files into one table. The composite key deliberately permits the same automation ID in two projects without allowing either project's CRUD or cron-claim path to address the other row.
6519
+ *
6520
+ * FNXC:MultiProjectIsolation 2026-08-12-15:43:
6521
+ * Migration 0006 owns the default through the database GUC/trigger; Drizzle emits DEFAULT
6522
+ * without replacing the physical legacy fallback or the fail-closed bound writer contract.
6514
6523
  */
6515
- projectId: text("project_id").notNull().default(""),
6524
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
6516
6525
  id: text("id").notNull(),
6517
6526
  name: text("name").notNull(),
6518
6527
  description: text("description"),
@@ -6811,7 +6820,8 @@ var taskDocuments = projectSchema.table("task_documents", {
6811
6820
  index("idxTaskDocumentsTaskId").on(t.taskId)
6812
6821
  ]);
6813
6822
  var artifacts = projectSchema.table("artifacts", {
6814
- id: text("id").primaryKey(),
6823
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
6824
+ id: text("id").notNull(),
6815
6825
  type: text("type").notNull(),
6816
6826
  title: text("title").notNull(),
6817
6827
  description: text("description"),
@@ -6826,7 +6836,8 @@ var artifacts = projectSchema.table("artifacts", {
6826
6836
  createdAt: text("created_at").notNull(),
6827
6837
  updatedAt: text("updated_at").notNull()
6828
6838
  }, (t) => [
6829
- foreignKey({ columns: [t.taskId], foreignColumns: [tasks.id] }).onDelete("cascade"),
6839
+ primaryKey({ columns: [t.projectId, t.id] }),
6840
+ foreignKey({ name: "artifacts_task_id_fkey", columns: [t.projectId, t.taskId], foreignColumns: [tasks.projectId, tasks.id] }).onDelete("cascade"),
6830
6841
  index("idxArtifactsTaskId").on(t.taskId),
6831
6842
  index("idxArtifactsAuthorId").on(t.authorId),
6832
6843
  index("idxArtifactsType").on(t.type),
@@ -7016,7 +7027,8 @@ var evalRunEvents = projectSchema.table("eval_run_events", {
7016
7027
  index("idxEvalRunEventsRunIdSeq").on(t.runId, t.seq)
7017
7028
  ]);
7018
7029
  var secrets = projectSchema.table("secrets", {
7019
- id: text("id").primaryKey(),
7030
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
7031
+ id: text("id").notNull(),
7020
7032
  key: text("key").notNull(),
7021
7033
  valueCiphertext: bytea("value_ciphertext").notNull(),
7022
7034
  nonce: bytea("nonce").notNull(),
@@ -7029,7 +7041,8 @@ var secrets = projectSchema.table("secrets", {
7029
7041
  lastReadAt: text("last_read_at"),
7030
7042
  lastReadBy: text("last_read_by")
7031
7043
  }, (t) => [
7032
- unique("secrets_key_unique").on(t.key),
7044
+ primaryKey({ columns: [t.projectId, t.id] }),
7045
+ unique("secrets_key_unique").on(t.projectId, t.key),
7033
7046
  check("secrets_access_policy_check", sql`${t.accessPolicy} IN ('auto', 'prompt', 'deny')`),
7034
7047
  check("secrets_env_exportable_check", sql`${t.envExportable} IN (0, 1)`)
7035
7048
  ]);
@@ -7071,10 +7084,11 @@ var missions = projectSchema.table("missions", {
7071
7084
  updatedAt: text("updated_at").notNull()
7072
7085
  }, (t) => [primaryKey({ columns: [t.projectId, t.id] })]);
7073
7086
  var branchGroups = projectSchema.table("branch_groups", {
7074
- id: text("id").primaryKey(),
7087
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
7088
+ id: text("id").notNull(),
7075
7089
  sourceType: text("source_type").notNull(),
7076
7090
  sourceId: text("source_id").notNull(),
7077
- branchName: text("branch_name").notNull().unique(),
7091
+ branchName: text("branch_name").notNull(),
7078
7092
  worktreePath: text("worktree_path"),
7079
7093
  autoMerge: integer("auto_merge").notNull().default(0),
7080
7094
  prState: text("pr_state").notNull().default("none"),
@@ -7090,6 +7104,8 @@ var branchGroups = projectSchema.table("branch_groups", {
7090
7104
  updatedAt: bigint("updated_at", { mode: "number" }).notNull(),
7091
7105
  closedAt: bigint("closed_at", { mode: "number" })
7092
7106
  }, (t) => [
7107
+ primaryKey({ columns: [t.projectId, t.id] }),
7108
+ unique("branch_groups_branch_name_key").on(t.projectId, t.branchName),
7093
7109
  check("branch_groups_source_type_check", sql`${t.sourceType} IN ('mission','planning','new-task')`),
7094
7110
  check("branch_groups_pr_state_check", sql`${t.prState} IN ('none','open','merged','closed')`),
7095
7111
  check("branch_groups_status_check", sql`${t.status} IN ('open','finalized','abandoned')`),
@@ -7491,12 +7507,14 @@ var usageEvents = projectSchema.table("usage_events", {
7491
7507
  index("idxUsageEventsKindTs").on(t.kind, t.ts)
7492
7508
  ]);
7493
7509
  var pluginActivations = projectSchema.table("plugin_activations", {
7494
- id: integer("id").generatedAlwaysAsIdentity().primaryKey(),
7510
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
7511
+ id: integer("id").generatedAlwaysAsIdentity().notNull(),
7495
7512
  pluginId: text("plugin_id").notNull(),
7496
7513
  source: text("source").notNull(),
7497
7514
  pluginVersion: text("plugin_version"),
7498
7515
  activatedAt: text("activated_at").notNull()
7499
7516
  }, (t) => [
7517
+ primaryKey({ columns: [t.projectId, t.id] }),
7500
7518
  index("idxPluginActivationsActivatedAt").on(t.activatedAt),
7501
7519
  index("idxPluginActivationsPluginId").on(t.pluginId)
7502
7520
  ]);
@@ -7521,8 +7539,13 @@ var knowledgePages = projectSchema.table("knowledge_pages", {
7521
7539
  index("idxKnowledgePagesUpdatedAt").on(t.updatedAt)
7522
7540
  ]);
7523
7541
  var deployments = projectSchema.table("deployments", {
7524
- id: integer("id").generatedAlwaysAsIdentity().primaryKey(),
7525
- projectId: text("project_id").notNull().default(""),
7542
+ id: integer("id").generatedAlwaysAsIdentity().notNull(),
7543
+ /*
7544
+ FNXC:MultiProjectIsolation 2026-08-12-15:43:
7545
+ Migration 0006 rebuilt deployments_pkey as (project_id, id). Drizzle emits DEFAULT while the
7546
+ database GUC/trigger keeps ownership stamping and the physical legacy fallback authoritative.
7547
+ */
7548
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
7526
7549
  deploymentId: text("deployment_id").notNull(),
7527
7550
  service: text("service"),
7528
7551
  environment: text("environment"),
@@ -7533,6 +7556,7 @@ var deployments = projectSchema.table("deployments", {
7533
7556
  meta: jsonb("meta"),
7534
7557
  createdAt: text("created_at").notNull()
7535
7558
  }, (t) => [
7559
+ primaryKey({ columns: [t.projectId, t.id], name: "deployments_pkey" }),
7536
7560
  uniqueIndex("idxDeploymentsProjectDeploymentId").on(t.projectId, t.deploymentId),
7537
7561
  index("idxDeploymentsProjectDeployedAt").on(t.projectId, t.deployedAt),
7538
7562
  index("idxDeploymentsDeployedAt").on(t.deployedAt),
@@ -7540,7 +7564,12 @@ var deployments = projectSchema.table("deployments", {
7540
7564
  ]);
7541
7565
  var githubCheckStates = projectSchema.table("github_check_states", {
7542
7566
  id: integer("id").generatedAlwaysAsIdentity().notNull(),
7543
- projectId: text("project_id").notNull().default(""),
7567
+ /*
7568
+ FNXC:MultiProjectIsolation 2026-08-12-15:43:
7569
+ Migration 0048 post-dated 0006, so FN-9004 reconciles its physical default to the ownership
7570
+ expression. Drizzle emits DEFAULT while the database GUC/trigger remains the stamping authority.
7571
+ */
7572
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
7544
7573
  repo: text("repo").notNull(),
7545
7574
  headSha: text("head_sha").notNull(),
7546
7575
  checkName: text("check_name").notNull(),
@@ -7560,9 +7589,14 @@ var githubCheckStates = projectSchema.table("github_check_states", {
7560
7589
  index("idxGithubCheckStatesProjectReceived").on(t.projectId, t.receivedAt)
7561
7590
  ]);
7562
7591
  var incidents = projectSchema.table("incidents", {
7563
- id: integer("id").generatedAlwaysAsIdentity().primaryKey(),
7564
- projectId: text("project_id").notNull().default(""),
7565
- incidentId: text("incident_id").notNull().unique(),
7592
+ id: integer("id").generatedAlwaysAsIdentity().notNull(),
7593
+ /*
7594
+ FNXC:MultiProjectIsolation 2026-08-12-15:43:
7595
+ Migration 0006 rebuilt incident keys with project_id first. Drizzle emits DEFAULT while the
7596
+ database GUC/trigger retains ownership stamping and its physical legacy fallback.
7597
+ */
7598
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
7599
+ incidentId: text("incident_id").notNull(),
7566
7600
  groupingKey: text("grouping_key").notNull(),
7567
7601
  title: text("title").notNull(),
7568
7602
  severity: text("severity"),
@@ -7576,6 +7610,8 @@ var incidents = projectSchema.table("incidents", {
7576
7610
  createdAt: text("created_at").notNull(),
7577
7611
  updatedAt: text("updated_at").notNull()
7578
7612
  }, (t) => [
7613
+ primaryKey({ columns: [t.projectId, t.id], name: "incidents_pkey" }),
7614
+ unique("incidents_incident_id_key").on(t.projectId, t.incidentId),
7579
7615
  index("idxIncidentsProjectOpenedAt").on(t.projectId, t.openedAt),
7580
7616
  index("idxIncidentsProjectStatus").on(t.projectId, t.status),
7581
7617
  index("idxIncidentsGroupingKey").on(t.groupingKey),
@@ -7630,12 +7666,14 @@ var messages = projectSchema.table("messages", {
7630
7666
  content: text("content").notNull(),
7631
7667
  type: text("type").notNull(),
7632
7668
  read: integer("read").default(0),
7669
+ archived: integer("archived").default(0),
7633
7670
  metadata: jsonb("metadata"),
7634
7671
  createdAt: text("created_at").notNull(),
7635
7672
  updatedAt: text("updated_at").notNull()
7636
7673
  }, (t) => [
7637
7674
  primaryKey({ columns: [t.projectId, t.id] }),
7638
7675
  index("idxMessagesTo").on(t.toId, t.toType, t.read),
7676
+ index("idxMessagesToArchived").on(t.toId, t.toType, t.archived),
7639
7677
  index("idxMessagesFrom").on(t.fromId, t.fromType),
7640
7678
  index("idxMessagesCreatedAt").on(t.createdAt)
7641
7679
  ]);
@@ -7736,7 +7774,8 @@ var cliSessions = projectSchema.table("cli_sessions", {
7736
7774
  index("idx_cli_sessions_project_state").on(t.projectId, t.agentState)
7737
7775
  ]);
7738
7776
  var chatMessages = projectSchema.table("chat_messages", {
7739
- id: text("id").primaryKey(),
7777
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
7778
+ id: text("id").notNull(),
7740
7779
  sessionId: text("session_id").notNull(),
7741
7780
  role: text("role").notNull(),
7742
7781
  content: text("content").notNull(),
@@ -7745,6 +7784,7 @@ var chatMessages = projectSchema.table("chat_messages", {
7745
7784
  createdAt: text("created_at").notNull(),
7746
7785
  attachments: jsonb("attachments")
7747
7786
  }, (t) => [
7787
+ primaryKey({ columns: [t.projectId, t.id] }),
7748
7788
  index("idxChatMessagesSessionId").on(t.sessionId),
7749
7789
  index("idxChatMessagesCreatedAt").on(t.createdAt)
7750
7790
  ]);
@@ -7770,7 +7810,8 @@ var chatTokenUsage = projectSchema.table("chat_token_usage", {
7770
7810
  index("idxChatTokenUsageCreatedAt").on(t.createdAt)
7771
7811
  ]);
7772
7812
  var runAuditEvents = projectSchema.table("run_audit_events", {
7773
- id: text("id").primaryKey(),
7813
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
7814
+ id: text("id").notNull(),
7774
7815
  timestamp: text("timestamp").notNull(),
7775
7816
  taskId: text("task_id"),
7776
7817
  agentId: text("agent_id").notNull(),
@@ -7780,6 +7821,7 @@ var runAuditEvents = projectSchema.table("run_audit_events", {
7780
7821
  target: text("target").notNull(),
7781
7822
  metadata: jsonb("metadata")
7782
7823
  }, (t) => [
7824
+ primaryKey({ columns: [t.projectId, t.id] }),
7783
7825
  index("idxRunAuditEventsRunIdTimestamp").on(t.runId, t.timestamp),
7784
7826
  index("idxRunAuditEventsTaskIdTimestamp").on(t.taskId, t.timestamp),
7785
7827
  index("idxRunAuditEventsTimestamp").on(t.timestamp)
@@ -7880,13 +7922,14 @@ var missionLineageStops = projectSchema.table("mission_lineage_stops", {
7880
7922
  index("idxMissionLineageStopsMissionId").on(t.projectId, t.missionId)
7881
7923
  ]);
7882
7924
  var verificationCache = projectSchema.table("verification_cache", {
7925
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
7883
7926
  treeSha: text("tree_sha").notNull(),
7884
7927
  testCommand: text("test_command").notNull().default(""),
7885
7928
  buildCommand: text("build_command").notNull().default(""),
7886
7929
  recordedAt: text("recorded_at").notNull(),
7887
7930
  taskId: text("task_id")
7888
7931
  }, (t) => [
7889
- primaryKey({ columns: [t.treeSha, t.testCommand, t.buildCommand] }),
7932
+ primaryKey({ columns: [t.projectId, t.treeSha, t.testCommand, t.buildCommand] }),
7890
7933
  index("idxVerificationCacheRecordedAt").on(t.recordedAt)
7891
7934
  ]);
7892
7935
  var importTranslationCache = projectSchema.table("import_translation_cache", {
@@ -7919,7 +7962,8 @@ var importTranslationCache = projectSchema.table("import_translation_cache", {
7919
7962
  index("idxImportTranslationCacheRecordedAt").on(t.recordedAt)
7920
7963
  ]);
7921
7964
  var approvalRequests = projectSchema.table("approval_requests", {
7922
- id: text("id").primaryKey(),
7965
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
7966
+ id: text("id").notNull(),
7923
7967
  status: text("status").notNull(),
7924
7968
  requesterActorId: text("requester_actor_id").notNull(),
7925
7969
  requesterActorType: text("requester_actor_type").notNull(),
@@ -7938,13 +7982,14 @@ var approvalRequests = projectSchema.table("approval_requests", {
7938
7982
  createdAt: text("created_at").notNull(),
7939
7983
  updatedAt: text("updated_at").notNull()
7940
7984
  }, (t) => [
7985
+ primaryKey({ columns: [t.projectId, t.id] }),
7941
7986
  index("idxApprovalRequestsStatusCreatedAt").on(t.status, t.createdAt),
7942
7987
  index("idxApprovalRequestsRequesterCreatedAt").on(t.requesterActorId, t.createdAt),
7943
7988
  index("idxApprovalRequestsTaskCreatedAt").on(t.taskId, t.createdAt)
7944
7989
  ]);
7945
7990
  var approvalRequestAuditEvents = projectSchema.table("approval_request_audit_events", {
7946
- projectId: text("project_id").notNull().default(""),
7947
- id: text("id").primaryKey(),
7991
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
7992
+ id: text("id").notNull(),
7948
7993
  requestId: text("request_id").notNull(),
7949
7994
  eventType: text("event_type").notNull(),
7950
7995
  actorId: text("actor_id").notNull(),
@@ -7953,6 +7998,7 @@ var approvalRequestAuditEvents = projectSchema.table("approval_request_audit_eve
7953
7998
  note: text("note"),
7954
7999
  createdAt: text("created_at").notNull()
7955
8000
  }, (t) => [
8001
+ primaryKey({ columns: [t.projectId, t.id] }),
7956
8002
  index("idxApprovalRequestAuditRequestCreatedAt").on(t.requestId, t.createdAt, t.id),
7957
8003
  index("idxApprovalRequestAuditProjectCreatedAt").on(t.projectId, t.createdAt)
7958
8004
  ]);
@@ -6113,9 +6113,14 @@ var config = projectSchema.table("config", {
6113
6113
  // now keyed per-project on `project_id` (the effective PK). `id` is retained
6114
6114
  // for column-shape parity (always 1) but is no longer the PK and no longer
6115
6115
  // CHECK-constrained. Single-project / SQLite-parity callers leave project_id
6116
- // at its '' default (one row), preserving the pre-isolation behavior.
6116
+ // through the database ownership trigger, preserving the pre-isolation behavior.
6117
+ /*
6118
+ FNXC:MultiProjectIsolation 2026-08-12-15:43:
6119
+ Migration 0006 owns config's project_id default and leaves its catalog PK as (project_id).
6120
+ Drizzle emits DEFAULT while the database GUC/trigger selects the effective ownership partition.
6121
+ */
6117
6122
  id: integer("id").default(1),
6118
- projectId: text("project_id").notNull().default("").primaryKey(),
6123
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`).primaryKey(),
6119
6124
  nextId: integer("next_id").default(1),
6120
6125
  nextWorkflowStepId: integer("next_workflow_step_id").default(1),
6121
6126
  // FNXC:SqliteFinalRemoval 2026-06-28:
@@ -6509,9 +6514,13 @@ var taskCommitAssociations = projectSchema.table("task_commit_associations", {
6509
6514
  var automations = projectSchema.table("automations", {
6510
6515
  /*
6511
6516
  * FNXC:AutomationIsolation 2026-07-13-22:37:
6512
- * Automations are partitioned by the AsyncDataLayer's project ID because embedded PostgreSQL consolidates the per-project SQLite files into one table. The composite key deliberately permits the same automation ID in two projects without allowing either project's CRUD or cron-claim path to address the other row. The empty default preserves an explicit partition for legacy and project-agnostic callers until startup stamps migrated rows.
6517
+ * Automations are partitioned by the AsyncDataLayer's project ID because embedded PostgreSQL consolidates the per-project SQLite files into one table. The composite key deliberately permits the same automation ID in two projects without allowing either project's CRUD or cron-claim path to address the other row.
6518
+ *
6519
+ * FNXC:MultiProjectIsolation 2026-08-12-15:43:
6520
+ * Migration 0006 owns the default through the database GUC/trigger; Drizzle emits DEFAULT
6521
+ * without replacing the physical legacy fallback or the fail-closed bound writer contract.
6513
6522
  */
6514
- projectId: text("project_id").notNull().default(""),
6523
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
6515
6524
  id: text("id").notNull(),
6516
6525
  name: text("name").notNull(),
6517
6526
  description: text("description"),
@@ -6810,7 +6819,8 @@ var taskDocuments = projectSchema.table("task_documents", {
6810
6819
  index("idxTaskDocumentsTaskId").on(t.taskId)
6811
6820
  ]);
6812
6821
  var artifacts = projectSchema.table("artifacts", {
6813
- id: text("id").primaryKey(),
6822
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
6823
+ id: text("id").notNull(),
6814
6824
  type: text("type").notNull(),
6815
6825
  title: text("title").notNull(),
6816
6826
  description: text("description"),
@@ -6825,7 +6835,8 @@ var artifacts = projectSchema.table("artifacts", {
6825
6835
  createdAt: text("created_at").notNull(),
6826
6836
  updatedAt: text("updated_at").notNull()
6827
6837
  }, (t) => [
6828
- foreignKey({ columns: [t.taskId], foreignColumns: [tasks.id] }).onDelete("cascade"),
6838
+ primaryKey({ columns: [t.projectId, t.id] }),
6839
+ foreignKey({ name: "artifacts_task_id_fkey", columns: [t.projectId, t.taskId], foreignColumns: [tasks.projectId, tasks.id] }).onDelete("cascade"),
6829
6840
  index("idxArtifactsTaskId").on(t.taskId),
6830
6841
  index("idxArtifactsAuthorId").on(t.authorId),
6831
6842
  index("idxArtifactsType").on(t.type),
@@ -7015,7 +7026,8 @@ var evalRunEvents = projectSchema.table("eval_run_events", {
7015
7026
  index("idxEvalRunEventsRunIdSeq").on(t.runId, t.seq)
7016
7027
  ]);
7017
7028
  var secrets = projectSchema.table("secrets", {
7018
- id: text("id").primaryKey(),
7029
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
7030
+ id: text("id").notNull(),
7019
7031
  key: text("key").notNull(),
7020
7032
  valueCiphertext: bytea("value_ciphertext").notNull(),
7021
7033
  nonce: bytea("nonce").notNull(),
@@ -7028,7 +7040,8 @@ var secrets = projectSchema.table("secrets", {
7028
7040
  lastReadAt: text("last_read_at"),
7029
7041
  lastReadBy: text("last_read_by")
7030
7042
  }, (t) => [
7031
- unique("secrets_key_unique").on(t.key),
7043
+ primaryKey({ columns: [t.projectId, t.id] }),
7044
+ unique("secrets_key_unique").on(t.projectId, t.key),
7032
7045
  check("secrets_access_policy_check", sql`${t.accessPolicy} IN ('auto', 'prompt', 'deny')`),
7033
7046
  check("secrets_env_exportable_check", sql`${t.envExportable} IN (0, 1)`)
7034
7047
  ]);
@@ -7070,10 +7083,11 @@ var missions = projectSchema.table("missions", {
7070
7083
  updatedAt: text("updated_at").notNull()
7071
7084
  }, (t) => [primaryKey({ columns: [t.projectId, t.id] })]);
7072
7085
  var branchGroups = projectSchema.table("branch_groups", {
7073
- id: text("id").primaryKey(),
7086
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
7087
+ id: text("id").notNull(),
7074
7088
  sourceType: text("source_type").notNull(),
7075
7089
  sourceId: text("source_id").notNull(),
7076
- branchName: text("branch_name").notNull().unique(),
7090
+ branchName: text("branch_name").notNull(),
7077
7091
  worktreePath: text("worktree_path"),
7078
7092
  autoMerge: integer("auto_merge").notNull().default(0),
7079
7093
  prState: text("pr_state").notNull().default("none"),
@@ -7089,6 +7103,8 @@ var branchGroups = projectSchema.table("branch_groups", {
7089
7103
  updatedAt: bigint("updated_at", { mode: "number" }).notNull(),
7090
7104
  closedAt: bigint("closed_at", { mode: "number" })
7091
7105
  }, (t) => [
7106
+ primaryKey({ columns: [t.projectId, t.id] }),
7107
+ unique("branch_groups_branch_name_key").on(t.projectId, t.branchName),
7092
7108
  check("branch_groups_source_type_check", sql`${t.sourceType} IN ('mission','planning','new-task')`),
7093
7109
  check("branch_groups_pr_state_check", sql`${t.prState} IN ('none','open','merged','closed')`),
7094
7110
  check("branch_groups_status_check", sql`${t.status} IN ('open','finalized','abandoned')`),
@@ -7490,12 +7506,14 @@ var usageEvents = projectSchema.table("usage_events", {
7490
7506
  index("idxUsageEventsKindTs").on(t.kind, t.ts)
7491
7507
  ]);
7492
7508
  var pluginActivations = projectSchema.table("plugin_activations", {
7493
- id: integer("id").generatedAlwaysAsIdentity().primaryKey(),
7509
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
7510
+ id: integer("id").generatedAlwaysAsIdentity().notNull(),
7494
7511
  pluginId: text("plugin_id").notNull(),
7495
7512
  source: text("source").notNull(),
7496
7513
  pluginVersion: text("plugin_version"),
7497
7514
  activatedAt: text("activated_at").notNull()
7498
7515
  }, (t) => [
7516
+ primaryKey({ columns: [t.projectId, t.id] }),
7499
7517
  index("idxPluginActivationsActivatedAt").on(t.activatedAt),
7500
7518
  index("idxPluginActivationsPluginId").on(t.pluginId)
7501
7519
  ]);
@@ -7520,8 +7538,13 @@ var knowledgePages = projectSchema.table("knowledge_pages", {
7520
7538
  index("idxKnowledgePagesUpdatedAt").on(t.updatedAt)
7521
7539
  ]);
7522
7540
  var deployments = projectSchema.table("deployments", {
7523
- id: integer("id").generatedAlwaysAsIdentity().primaryKey(),
7524
- projectId: text("project_id").notNull().default(""),
7541
+ id: integer("id").generatedAlwaysAsIdentity().notNull(),
7542
+ /*
7543
+ FNXC:MultiProjectIsolation 2026-08-12-15:43:
7544
+ Migration 0006 rebuilt deployments_pkey as (project_id, id). Drizzle emits DEFAULT while the
7545
+ database GUC/trigger keeps ownership stamping and the physical legacy fallback authoritative.
7546
+ */
7547
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
7525
7548
  deploymentId: text("deployment_id").notNull(),
7526
7549
  service: text("service"),
7527
7550
  environment: text("environment"),
@@ -7532,6 +7555,7 @@ var deployments = projectSchema.table("deployments", {
7532
7555
  meta: jsonb("meta"),
7533
7556
  createdAt: text("created_at").notNull()
7534
7557
  }, (t) => [
7558
+ primaryKey({ columns: [t.projectId, t.id], name: "deployments_pkey" }),
7535
7559
  uniqueIndex("idxDeploymentsProjectDeploymentId").on(t.projectId, t.deploymentId),
7536
7560
  index("idxDeploymentsProjectDeployedAt").on(t.projectId, t.deployedAt),
7537
7561
  index("idxDeploymentsDeployedAt").on(t.deployedAt),
@@ -7539,7 +7563,12 @@ var deployments = projectSchema.table("deployments", {
7539
7563
  ]);
7540
7564
  var githubCheckStates = projectSchema.table("github_check_states", {
7541
7565
  id: integer("id").generatedAlwaysAsIdentity().notNull(),
7542
- projectId: text("project_id").notNull().default(""),
7566
+ /*
7567
+ FNXC:MultiProjectIsolation 2026-08-12-15:43:
7568
+ Migration 0048 post-dated 0006, so FN-9004 reconciles its physical default to the ownership
7569
+ expression. Drizzle emits DEFAULT while the database GUC/trigger remains the stamping authority.
7570
+ */
7571
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
7543
7572
  repo: text("repo").notNull(),
7544
7573
  headSha: text("head_sha").notNull(),
7545
7574
  checkName: text("check_name").notNull(),
@@ -7559,9 +7588,14 @@ var githubCheckStates = projectSchema.table("github_check_states", {
7559
7588
  index("idxGithubCheckStatesProjectReceived").on(t.projectId, t.receivedAt)
7560
7589
  ]);
7561
7590
  var incidents = projectSchema.table("incidents", {
7562
- id: integer("id").generatedAlwaysAsIdentity().primaryKey(),
7563
- projectId: text("project_id").notNull().default(""),
7564
- incidentId: text("incident_id").notNull().unique(),
7591
+ id: integer("id").generatedAlwaysAsIdentity().notNull(),
7592
+ /*
7593
+ FNXC:MultiProjectIsolation 2026-08-12-15:43:
7594
+ Migration 0006 rebuilt incident keys with project_id first. Drizzle emits DEFAULT while the
7595
+ database GUC/trigger retains ownership stamping and its physical legacy fallback.
7596
+ */
7597
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
7598
+ incidentId: text("incident_id").notNull(),
7565
7599
  groupingKey: text("grouping_key").notNull(),
7566
7600
  title: text("title").notNull(),
7567
7601
  severity: text("severity"),
@@ -7575,6 +7609,8 @@ var incidents = projectSchema.table("incidents", {
7575
7609
  createdAt: text("created_at").notNull(),
7576
7610
  updatedAt: text("updated_at").notNull()
7577
7611
  }, (t) => [
7612
+ primaryKey({ columns: [t.projectId, t.id], name: "incidents_pkey" }),
7613
+ unique("incidents_incident_id_key").on(t.projectId, t.incidentId),
7578
7614
  index("idxIncidentsProjectOpenedAt").on(t.projectId, t.openedAt),
7579
7615
  index("idxIncidentsProjectStatus").on(t.projectId, t.status),
7580
7616
  index("idxIncidentsGroupingKey").on(t.groupingKey),
@@ -7629,12 +7665,14 @@ var messages = projectSchema.table("messages", {
7629
7665
  content: text("content").notNull(),
7630
7666
  type: text("type").notNull(),
7631
7667
  read: integer("read").default(0),
7668
+ archived: integer("archived").default(0),
7632
7669
  metadata: jsonb("metadata"),
7633
7670
  createdAt: text("created_at").notNull(),
7634
7671
  updatedAt: text("updated_at").notNull()
7635
7672
  }, (t) => [
7636
7673
  primaryKey({ columns: [t.projectId, t.id] }),
7637
7674
  index("idxMessagesTo").on(t.toId, t.toType, t.read),
7675
+ index("idxMessagesToArchived").on(t.toId, t.toType, t.archived),
7638
7676
  index("idxMessagesFrom").on(t.fromId, t.fromType),
7639
7677
  index("idxMessagesCreatedAt").on(t.createdAt)
7640
7678
  ]);
@@ -7735,7 +7773,8 @@ var cliSessions = projectSchema.table("cli_sessions", {
7735
7773
  index("idx_cli_sessions_project_state").on(t.projectId, t.agentState)
7736
7774
  ]);
7737
7775
  var chatMessages = projectSchema.table("chat_messages", {
7738
- id: text("id").primaryKey(),
7776
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
7777
+ id: text("id").notNull(),
7739
7778
  sessionId: text("session_id").notNull(),
7740
7779
  role: text("role").notNull(),
7741
7780
  content: text("content").notNull(),
@@ -7744,6 +7783,7 @@ var chatMessages = projectSchema.table("chat_messages", {
7744
7783
  createdAt: text("created_at").notNull(),
7745
7784
  attachments: jsonb("attachments")
7746
7785
  }, (t) => [
7786
+ primaryKey({ columns: [t.projectId, t.id] }),
7747
7787
  index("idxChatMessagesSessionId").on(t.sessionId),
7748
7788
  index("idxChatMessagesCreatedAt").on(t.createdAt)
7749
7789
  ]);
@@ -7769,7 +7809,8 @@ var chatTokenUsage = projectSchema.table("chat_token_usage", {
7769
7809
  index("idxChatTokenUsageCreatedAt").on(t.createdAt)
7770
7810
  ]);
7771
7811
  var runAuditEvents = projectSchema.table("run_audit_events", {
7772
- id: text("id").primaryKey(),
7812
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
7813
+ id: text("id").notNull(),
7773
7814
  timestamp: text("timestamp").notNull(),
7774
7815
  taskId: text("task_id"),
7775
7816
  agentId: text("agent_id").notNull(),
@@ -7779,6 +7820,7 @@ var runAuditEvents = projectSchema.table("run_audit_events", {
7779
7820
  target: text("target").notNull(),
7780
7821
  metadata: jsonb("metadata")
7781
7822
  }, (t) => [
7823
+ primaryKey({ columns: [t.projectId, t.id] }),
7782
7824
  index("idxRunAuditEventsRunIdTimestamp").on(t.runId, t.timestamp),
7783
7825
  index("idxRunAuditEventsTaskIdTimestamp").on(t.taskId, t.timestamp),
7784
7826
  index("idxRunAuditEventsTimestamp").on(t.timestamp)
@@ -7879,13 +7921,14 @@ var missionLineageStops = projectSchema.table("mission_lineage_stops", {
7879
7921
  index("idxMissionLineageStopsMissionId").on(t.projectId, t.missionId)
7880
7922
  ]);
7881
7923
  var verificationCache = projectSchema.table("verification_cache", {
7924
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
7882
7925
  treeSha: text("tree_sha").notNull(),
7883
7926
  testCommand: text("test_command").notNull().default(""),
7884
7927
  buildCommand: text("build_command").notNull().default(""),
7885
7928
  recordedAt: text("recorded_at").notNull(),
7886
7929
  taskId: text("task_id")
7887
7930
  }, (t) => [
7888
- primaryKey({ columns: [t.treeSha, t.testCommand, t.buildCommand] }),
7931
+ primaryKey({ columns: [t.projectId, t.treeSha, t.testCommand, t.buildCommand] }),
7889
7932
  index("idxVerificationCacheRecordedAt").on(t.recordedAt)
7890
7933
  ]);
7891
7934
  var importTranslationCache = projectSchema.table("import_translation_cache", {
@@ -7918,7 +7961,8 @@ var importTranslationCache = projectSchema.table("import_translation_cache", {
7918
7961
  index("idxImportTranslationCacheRecordedAt").on(t.recordedAt)
7919
7962
  ]);
7920
7963
  var approvalRequests = projectSchema.table("approval_requests", {
7921
- id: text("id").primaryKey(),
7964
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
7965
+ id: text("id").notNull(),
7922
7966
  status: text("status").notNull(),
7923
7967
  requesterActorId: text("requester_actor_id").notNull(),
7924
7968
  requesterActorType: text("requester_actor_type").notNull(),
@@ -7937,13 +7981,14 @@ var approvalRequests = projectSchema.table("approval_requests", {
7937
7981
  createdAt: text("created_at").notNull(),
7938
7982
  updatedAt: text("updated_at").notNull()
7939
7983
  }, (t) => [
7984
+ primaryKey({ columns: [t.projectId, t.id] }),
7940
7985
  index("idxApprovalRequestsStatusCreatedAt").on(t.status, t.createdAt),
7941
7986
  index("idxApprovalRequestsRequesterCreatedAt").on(t.requesterActorId, t.createdAt),
7942
7987
  index("idxApprovalRequestsTaskCreatedAt").on(t.taskId, t.createdAt)
7943
7988
  ]);
7944
7989
  var approvalRequestAuditEvents = projectSchema.table("approval_request_audit_events", {
7945
- projectId: text("project_id").notNull().default(""),
7946
- id: text("id").primaryKey(),
7990
+ projectId: text("project_id").notNull().default(sql`current_setting('fusion.project_id', true)`),
7991
+ id: text("id").notNull(),
7947
7992
  requestId: text("request_id").notNull(),
7948
7993
  eventType: text("event_type").notNull(),
7949
7994
  actorId: text("actor_id").notNull(),
@@ -7952,6 +7997,7 @@ var approvalRequestAuditEvents = projectSchema.table("approval_request_audit_eve
7952
7997
  note: text("note"),
7953
7998
  createdAt: text("created_at").notNull()
7954
7999
  }, (t) => [
8000
+ primaryKey({ columns: [t.projectId, t.id] }),
7955
8001
  index("idxApprovalRequestAuditRequestCreatedAt").on(t.requestId, t.createdAt, t.id),
7956
8002
  index("idxApprovalRequestAuditProjectCreatedAt").on(t.projectId, t.createdAt)
7957
8003
  ]);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fusion-plugin-examples/acp-runtime",
3
- "version": "0.1.35-beta.1",
3
+ "version": "0.1.35-beta.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {