@xopcai/xopc 0.0.159 → 0.0.160

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 (195) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{action-boundary-settings-panel-CaRK2vIy.js → action-boundary-settings-panel-CY3sizqC.js} +1 -1
  4. package/dist/gateway/static/root/assets/{activity-store-C-57rvkX.js → activity-store-3Cso_2qm.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BeVf03hx.js → agent-avatar-dicebear-B_27aaZQ.js} +1 -1
  6. package/dist/gateway/static/root/assets/agents-B1l3iii6.js +2 -0
  7. package/dist/gateway/static/root/assets/{api-BjcBIV2O.js → api-BbzB57CJ.js} +1 -1
  8. package/dist/gateway/static/root/assets/{app-management-settings-panel-BG2ulMYw.js → app-management-settings-panel-DfmyWcyh.js} +1 -1
  9. package/dist/gateway/static/root/assets/{appearance-settings-0Kjenr2T.js → appearance-settings-B2v0c-K-.js} +1 -1
  10. package/dist/gateway/static/root/assets/apps-page-DaNFLsp0.js +1 -0
  11. package/dist/gateway/static/root/assets/{archive-plugin-ChiNnH1e.js → archive-plugin-DL5Lnx0C.js} +1 -1
  12. package/dist/gateway/static/root/assets/{attachment-load-pbBlQR-g.js → attachment-load-InuP-ZjQ.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automation-suggestion-card-CTZDOyDy.js → automation-suggestion-card-CahGuh7B.js} +1 -1
  14. package/dist/gateway/static/root/assets/automations-page-Cd0gMx6p.js +6 -0
  15. package/dist/gateway/static/root/assets/{binary-plugins-BeZGzpGF.js → binary-plugins-CdOTGYVu.js} +1 -1
  16. package/dist/gateway/static/root/assets/{block-editor-BnDmhN5Z.js → block-editor-D6ShK1S-.js} +3 -3
  17. package/dist/gateway/static/root/assets/browser-settings-page-BmUYDL2Z.js +8 -0
  18. package/dist/gateway/static/root/assets/{capability-presets-api-Ii36j_7v.js → capability-presets-api-BzoLm52Z.js} +1 -1
  19. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-Cl3dw4yh.js → capability-presets-settings-panel-CE7mrWtS.js} +2 -2
  20. package/dist/gateway/static/root/assets/{channel-recipient-api-CFqrSi5K.js → channel-recipient-api-DbgydMjl.js} +1 -1
  21. package/dist/gateway/static/root/assets/channels-settings-D1_gcAHK.js +1 -0
  22. package/dist/gateway/static/root/assets/channels-status-swr-Cqfqv59m.js +1 -0
  23. package/dist/gateway/static/root/assets/{connector-logo-CiLxuZ8S.js → connector-logo-C3bJC9nt.js} +1 -1
  24. package/dist/gateway/static/root/assets/connectors-page-CaLBi6Na.js +2 -0
  25. package/dist/gateway/static/root/assets/desktop-pet-settings-BrHVvbBw.js +1 -0
  26. package/dist/gateway/static/root/assets/desktop-pet-sprite-CFd1jGLJ.js +1 -0
  27. package/dist/gateway/static/root/assets/desktop-pet-wacrnJJ1.js +1 -0
  28. package/dist/gateway/static/root/assets/{directory-picker-path-field-CC2VL5Mc.js → directory-picker-path-field-BPI969w-.js} +1 -1
  29. package/dist/gateway/static/root/assets/{dreaming-settings-KY7ZfVsy.js → dreaming-settings-iw6QXD45.js} +3 -3
  30. package/dist/gateway/static/root/assets/{extension-debug-page-C8KBeucs.js → extension-debug-page-rCHyhEr6.js} +1 -1
  31. package/dist/gateway/static/root/assets/{extension-page-CV-5Kcyk.js → extension-page-C4gQsAPt.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-settings-page-DvUtDrAu.js → extension-settings-page-DB_3eik7.js} +1 -1
  33. package/dist/gateway/static/root/assets/{gateway-config-api-DXfVeJLc.js → gateway-config-api-Cdt38iF2.js} +1 -1
  34. package/dist/gateway/static/root/assets/gateway-settings-DM4BgyGw.js +1 -0
  35. package/dist/gateway/static/root/assets/{gateway-startup-retry-cxQ94qMm.js → gateway-startup-retry-ChRFNjj_.js} +1 -1
  36. package/dist/gateway/static/root/assets/goal-create-dialog-BQamcEmF.js +1 -0
  37. package/dist/gateway/static/root/assets/goal-detail-page-DZUQ0Lf1.js +4 -0
  38. package/dist/gateway/static/root/assets/{goals-config-api-P8VhLqYF.js → goals-config-api-RvljeEm6.js} +1 -1
  39. package/dist/gateway/static/root/assets/goals-page-BtxVD27C.js +2 -0
  40. package/dist/gateway/static/root/assets/{goals-settings-DHXyaH_O.js → goals-settings-DMGV4S4L.js} +1 -1
  41. package/dist/gateway/static/root/assets/{heartbeat-settings-CNckP_Dv.js → heartbeat-settings-B8r5EXc5.js} +1 -1
  42. package/dist/gateway/static/root/assets/index-CHKe7nwC.js +197 -0
  43. package/dist/gateway/static/root/assets/index-CXhfUIjh.css +1 -0
  44. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-jXmv1RVX.js → keyboard-shortcuts-settings-1-LYibQ4.js} +1 -1
  45. package/dist/gateway/static/root/assets/local-app-workbench-page-CTTfyFe3.js +2 -0
  46. package/dist/gateway/static/root/assets/{local-apps-page-Cs5LKjtc.js → local-apps-page-CC4vtUUI.js} +1 -1
  47. package/dist/gateway/static/root/assets/{locale-store-C_M71MK9.js → locale-store-CPbGB_6l.js} +1 -1
  48. package/dist/gateway/static/root/assets/logs-page-Bn_taxBV.js +7 -0
  49. package/dist/gateway/static/root/assets/{markdown-split-BFqeSNte.js → markdown-split-CprEIf8A.js} +1 -1
  50. package/dist/gateway/static/root/assets/{media-plugins-Cc8379gq.js → media-plugins-BXt_Sj2O.js} +1 -1
  51. package/dist/gateway/static/root/assets/{messages-BuT0SR1R.js → messages-DDsiqdJS.js} +4 -4
  52. package/dist/gateway/static/root/assets/models-hub-panel-DJReXRP9.js +2 -0
  53. package/dist/gateway/static/root/assets/{notes-page-DlGU4ipo.js → notes-page-Wf5-eyyM.js} +1 -1
  54. package/dist/gateway/static/root/assets/notes-workbench-BbdjzYzs.js +4 -0
  55. package/dist/gateway/static/root/assets/{page-tabs-kFOswGlG.js → page-tabs-dtpK_4Fs.js} +1 -1
  56. package/dist/gateway/static/root/assets/{preview-open-alternatives-CvjuvABg.js → preview-open-alternatives-DijtEVxG.js} +1 -1
  57. package/dist/gateway/static/root/assets/project-detail-page-BwG8SOzI.js +1 -0
  58. package/dist/gateway/static/root/assets/projects-page-nUlyUtxh.js +1 -0
  59. package/dist/gateway/static/root/assets/remote-access-hub-rf7bjije.js +1 -0
  60. package/dist/gateway/static/root/assets/{save-bar-controls-DwrD7ODx.js → save-bar-controls-qhDisdqY.js} +1 -1
  61. package/dist/gateway/static/root/assets/{schedule-field-Ba4WzTmE.js → schedule-field-AhJ50NoT.js} +1 -1
  62. package/dist/gateway/static/root/assets/{schema-form-DvydL8eF.js → schema-form-AuJg2CXU.js} +1 -1
  63. package/dist/gateway/static/root/assets/sessions-page-CSoHUe38.js +1 -0
  64. package/dist/gateway/static/root/assets/settings-advanced-gate-Db976IEa.js +1 -0
  65. package/dist/gateway/static/root/assets/{settings-collapsible-section-LaQqGGej.js → settings-collapsible-section-D5ganr_X.js} +1 -1
  66. package/dist/gateway/static/root/assets/{settings-form-section-DruI__qO.js → settings-form-section-Db3cKRsg.js} +1 -1
  67. package/dist/gateway/static/root/assets/{settings-loading-skeleton-UvA-eDhF.js → settings-loading-skeleton-D05YKT2x.js} +1 -1
  68. package/dist/gateway/static/root/assets/{settings-page-5oCGSebm.js → settings-page-DYfXmfTx.js} +1 -1
  69. package/dist/gateway/static/root/assets/{settings-page-layout-DG-XMIPu.js → settings-page-layout-Cv_Cu4I5.js} +1 -1
  70. package/dist/gateway/static/root/assets/setup-status-panel-wBWOFpvw.js +1 -0
  71. package/dist/gateway/static/root/assets/{share-preview-page-FLVeTrRt.js → share-preview-page-CYkZVuse.js} +1 -1
  72. package/dist/gateway/static/root/assets/shares-settings-BAMma1-P.js +1 -0
  73. package/dist/gateway/static/root/assets/skill-reload-api-TWxFFWxM.js +1 -0
  74. package/dist/gateway/static/root/assets/skills-page-Ca2RA29R.js +2 -0
  75. package/dist/gateway/static/root/assets/{system-settings-panel-CeK93xVi.js → system-settings-panel-C1Ng5bXh.js} +1 -1
  76. package/dist/gateway/static/root/assets/{theme-store-C8ohIHhw.js → theme-store-LMHIDR9n.js} +1 -1
  77. package/dist/gateway/static/root/assets/{typed-models-lib-D1Lr2gG0.js → typed-models-lib-Ch2Bdm_5.js} +1 -1
  78. package/dist/gateway/static/root/assets/{use-channel-catalog-BWzou5ar.js → use-channel-catalog-CZnaMOeL.js} +1 -1
  79. package/dist/gateway/static/root/assets/user-context-page-CTumZa0y.js +1 -0
  80. package/dist/gateway/static/root/assets/voice-api-key-field-DdlMxeqO.js +1 -0
  81. package/dist/gateway/static/root/assets/work-discovery-page-CcfZhdBi.js +1 -0
  82. package/dist/gateway/static/root/assets/work-item-detail-page--wxLw1p_.js +1 -0
  83. package/dist/gateway/static/root/assets/work-page-DyS0XBpV.js +1 -0
  84. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Bynqe4kV.js → workflow-run-setup-panel-BFk8TvTw.js} +2 -2
  85. package/dist/gateway/static/root/assets/workflows-page-CVVJd4gy.js +11 -0
  86. package/dist/gateway/static/root/index.html +7 -7
  87. package/dist/package.js +1 -1
  88. package/dist/src/automations/service/action-executor.js +1 -1
  89. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  90. package/dist/src/gateway/chat-stream/mapper.d.ts +1 -0
  91. package/dist/src/gateway/chat-stream/mapper.js +43 -7
  92. package/dist/src/gateway/hono/routes/home.js +15 -2
  93. package/dist/src/gateway/hono/routes/work-discovery.js +451 -0
  94. package/dist/src/gateway/service.d.ts +2 -0
  95. package/dist/src/gateway/service.js +27 -2
  96. package/dist/src/mobile/notification-service.js +1 -0
  97. package/dist/src/pets/factory.js +23 -26
  98. package/dist/src/pets/manifest.d.ts +2 -1
  99. package/dist/src/pets/manifest.js +15 -8
  100. package/dist/src/pets/validator.js +8 -3
  101. package/dist/src/proactive/calendar-signals.d.ts +4 -0
  102. package/dist/src/proactive/calendar-signals.js +120 -0
  103. package/dist/src/proactive/focus-service.d.ts +62 -0
  104. package/dist/src/proactive/focus-service.js +173 -0
  105. package/dist/src/proactive/index.d.ts +7 -0
  106. package/dist/src/proactive/index.js +7 -0
  107. package/dist/src/proactive/insight-repository.d.ts +19 -0
  108. package/dist/src/proactive/insight-repository.js +106 -0
  109. package/dist/src/proactive/run-processor.d.ts +19 -0
  110. package/dist/src/proactive/run-processor.js +125 -0
  111. package/dist/src/proactive/trial-expiry-reconciler.d.ts +5 -0
  112. package/dist/src/proactive/trial-expiry-reconciler.js +30 -0
  113. package/dist/src/proactive/types.d.ts +64 -0
  114. package/dist/src/proactive/types.js +1 -0
  115. package/dist/src/proactive/watch-repository.d.ts +28 -0
  116. package/dist/src/proactive/watch-repository.js +129 -0
  117. package/dist/src/storage/sqlite/knowledge-repository.d.ts +1 -0
  118. package/dist/src/storage/sqlite/knowledge-repository.js +4 -0
  119. package/dist/src/storage/sqlite/migrations/047_work_discovery_sources.sql +16 -0
  120. package/dist/src/storage/sqlite/migrations/048_work_understanding_investigations.sql +40 -0
  121. package/dist/src/storage/sqlite/migrations/049_work_understanding_threads.sql +52 -0
  122. package/dist/src/storage/sqlite/migrations/050_work_discovery_source_refreshes.sql +15 -0
  123. package/dist/src/storage/sqlite/migrations/051_focus_watches.sql +26 -0
  124. package/dist/src/storage/sqlite/migrations/052_proactive_insights.sql +25 -0
  125. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  126. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  127. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  128. package/dist/src/storage/sqlite/schema.js +1 -1
  129. package/dist/src/work-discovery/analyzer.d.ts +12 -1
  130. package/dist/src/work-discovery/analyzer.js +126 -7
  131. package/dist/src/work-discovery/candidate-discovery.d.ts +17 -0
  132. package/dist/src/work-discovery/candidate-discovery.js +279 -0
  133. package/dist/src/work-discovery/evaluation.d.ts +11 -0
  134. package/dist/src/work-discovery/evaluation.js +17 -0
  135. package/dist/src/work-discovery/governance.d.ts +25 -0
  136. package/dist/src/work-discovery/governance.js +96 -0
  137. package/dist/src/work-discovery/incremental-repository.d.ts +13 -0
  138. package/dist/src/work-discovery/incremental-repository.js +55 -0
  139. package/dist/src/work-discovery/incremental.d.ts +2 -0
  140. package/dist/src/work-discovery/incremental.js +7 -0
  141. package/dist/src/work-discovery/index.d.ts +10 -0
  142. package/dist/src/work-discovery/index.js +13 -3
  143. package/dist/src/work-discovery/investigation-repository.d.ts +16 -0
  144. package/dist/src/work-discovery/investigation-repository.js +122 -0
  145. package/dist/src/work-discovery/investigator.d.ts +55 -0
  146. package/dist/src/work-discovery/investigator.js +358 -0
  147. package/dist/src/work-discovery/probe.d.ts +22 -0
  148. package/dist/src/work-discovery/probe.js +88 -1
  149. package/dist/src/work-discovery/service.d.ts +110 -1
  150. package/dist/src/work-discovery/service.js +578 -8
  151. package/dist/src/work-discovery/source-repository.d.ts +13 -0
  152. package/dist/src/work-discovery/source-repository.js +72 -0
  153. package/dist/src/work-discovery/thread-repository.d.ts +34 -0
  154. package/dist/src/work-discovery/thread-repository.js +112 -0
  155. package/dist/src/work-discovery/thread-service.d.ts +8 -0
  156. package/dist/src/work-discovery/thread-service.js +104 -0
  157. package/dist/src/work-discovery/types.d.ts +145 -0
  158. package/package.json +1 -1
  159. package/skills/creative/hatch-pet/SKILL.md +2 -2
  160. package/dist/gateway/static/root/assets/agents-P05C4A-3.js +0 -2
  161. package/dist/gateway/static/root/assets/apps-page-DANGrBpN.js +0 -1
  162. package/dist/gateway/static/root/assets/automations-page-BXfGL_cm.js +0 -6
  163. package/dist/gateway/static/root/assets/browser-settings-page-534luV0B.js +0 -8
  164. package/dist/gateway/static/root/assets/channels-settings-M91zFJVi.js +0 -1
  165. package/dist/gateway/static/root/assets/channels-status-swr-vooEF4lG.js +0 -1
  166. package/dist/gateway/static/root/assets/connectors-page-CV5UulW6.js +0 -2
  167. package/dist/gateway/static/root/assets/desktop-pet-Cil2eSpW.js +0 -1
  168. package/dist/gateway/static/root/assets/desktop-pet-settings-DwsC6l5F.js +0 -1
  169. package/dist/gateway/static/root/assets/desktop-pet-sprite-DqZ6fbIj.js +0 -1
  170. package/dist/gateway/static/root/assets/gateway-settings-BpJ0v56l.js +0 -1
  171. package/dist/gateway/static/root/assets/goal-create-dialog-lMHD-2CX.js +0 -1
  172. package/dist/gateway/static/root/assets/goal-detail-page-yPmF-G7b.js +0 -4
  173. package/dist/gateway/static/root/assets/goals-page-BHTCKobG.js +0 -2
  174. package/dist/gateway/static/root/assets/index-BgZhEOkN.css +0 -1
  175. package/dist/gateway/static/root/assets/index-BuqGh2SW.js +0 -193
  176. package/dist/gateway/static/root/assets/local-app-workbench-page-zpp_wciE.js +0 -2
  177. package/dist/gateway/static/root/assets/logs-page-B4CRYqYR.js +0 -7
  178. package/dist/gateway/static/root/assets/models-hub-panel-1hdoAoB_.js +0 -2
  179. package/dist/gateway/static/root/assets/notes-workbench-DQEAZTA5.js +0 -4
  180. package/dist/gateway/static/root/assets/project-detail-page-Bp9bC7A6.js +0 -1
  181. package/dist/gateway/static/root/assets/projects-page-RNorFXTw.js +0 -1
  182. package/dist/gateway/static/root/assets/remote-access-hub-BqRTcM_6.js +0 -1
  183. package/dist/gateway/static/root/assets/sessions-page-B2EfW1cm.js +0 -1
  184. package/dist/gateway/static/root/assets/settings-advanced-gate-CklL85T4.js +0 -1
  185. package/dist/gateway/static/root/assets/setup-status-panel-D3my1HgB.js +0 -1
  186. package/dist/gateway/static/root/assets/shares-settings-DVxgjrsP.js +0 -1
  187. package/dist/gateway/static/root/assets/skill-reload-api-Bcu58ZaF.js +0 -1
  188. package/dist/gateway/static/root/assets/skills-page-CDd-84FE.js +0 -2
  189. package/dist/gateway/static/root/assets/sliding-segmented-uWmrxE3P.js +0 -1
  190. package/dist/gateway/static/root/assets/user-context-page-1OyJnTyR.js +0 -1
  191. package/dist/gateway/static/root/assets/voice-api-key-field-B2ncRwHS.js +0 -1
  192. package/dist/gateway/static/root/assets/work-discovery-page-BZlY4PZL.js +0 -1
  193. package/dist/gateway/static/root/assets/work-item-detail-page-DPXMrneY.js +0 -1
  194. package/dist/gateway/static/root/assets/work-page-CTERoqyv.js +0 -1
  195. package/dist/gateway/static/root/assets/workflows-page-CLgsnqFQ.js +0 -11
@@ -0,0 +1,25 @@
1
+ export interface WorkUnderstandingSourceLineage {
2
+ sourceId: string;
3
+ evidenceCount: number;
4
+ threadCount: number;
5
+ memoryRecordCount: number;
6
+ discoveryRunCount: number;
7
+ }
8
+ export declare function getWorkUnderstandingSourceLineage(sourceId: string): WorkUnderstandingSourceLineage | null;
9
+ export declare function deleteWorkUnderstandingDerivedData(sourceId: string): {
10
+ deletedMemoryRecords: number;
11
+ evidenceCount: number | bigint;
12
+ deletedThreads: number;
13
+ retainedThreads: number;
14
+ };
15
+ export declare function getWorkUnderstandingMetrics(): {
16
+ completedInvestigations: number;
17
+ averageToolCalls: number;
18
+ activeThreads: number;
19
+ confirmedThreads: number;
20
+ recognitionConfirmationRate: number;
21
+ evidenceBySource: {
22
+ sourceType: string;
23
+ count: number;
24
+ }[];
25
+ };
@@ -0,0 +1,96 @@
1
+ import { requireXopcDatabase } from "../storage/sqlite/connection.js";
2
+ import { runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
3
+ import { deleteMemoryRecord, listMemoryRecords } from "../storage/sqlite/memory-records-repository.js";
4
+ //#region src/work-discovery/governance.ts
5
+ function memoryRecordsForSource(sourceId, rootPath) {
6
+ const { db } = requireXopcDatabase();
7
+ const runIds = rootPath ? db.prepare("SELECT id FROM work_discovery_runs WHERE root_path = ?").all(rootPath).map((row) => row.id) : [];
8
+ const runPaths = new Set(runIds.map((id) => `work-discovery://${id}`));
9
+ const records = [];
10
+ for (let offset = 0;; offset += 500) {
11
+ const page = listMemoryRecords({
12
+ limit: 500,
13
+ offset
14
+ });
15
+ records.push(...page.filter((record) => runPaths.has(record.source.path)));
16
+ if (page.length < 500) break;
17
+ }
18
+ return records;
19
+ }
20
+ function getWorkUnderstandingSourceLineage(sourceId) {
21
+ const { db } = requireXopcDatabase();
22
+ const source = db.prepare("SELECT root_path FROM work_discovery_sources WHERE source_id = ?").get(sourceId);
23
+ if (!source) return null;
24
+ const evidenceCount = db.prepare("SELECT COUNT(*) AS count FROM work_understanding_evidence WHERE source_grant_id = ?").get(sourceId).count;
25
+ const threadCount = db.prepare(`SELECT COUNT(DISTINCT te.thread_id) AS count
26
+ FROM work_understanding_thread_evidence te
27
+ JOIN work_understanding_evidence e ON e.evidence_id = te.evidence_id
28
+ WHERE e.source_grant_id = ?`).get(sourceId).count;
29
+ const discoveryRunCount = source.root_path ? db.prepare("SELECT COUNT(*) AS count FROM work_discovery_runs WHERE root_path = ?").get(source.root_path).count : 0;
30
+ return {
31
+ sourceId,
32
+ evidenceCount,
33
+ threadCount,
34
+ memoryRecordCount: memoryRecordsForSource(sourceId, source.root_path).length,
35
+ discoveryRunCount
36
+ };
37
+ }
38
+ function deleteWorkUnderstandingDerivedData(sourceId) {
39
+ if (!getWorkUnderstandingSourceLineage(sourceId)) return null;
40
+ const { db } = requireXopcDatabase();
41
+ const memoryRecords = memoryRecordsForSource(sourceId, db.prepare("SELECT root_path FROM work_discovery_sources WHERE source_id = ?").get(sourceId).root_path).filter((record) => record.explicitness !== "explicit");
42
+ const affectedThreadIds = db.prepare(`SELECT DISTINCT te.thread_id AS id
43
+ FROM work_understanding_thread_evidence te
44
+ JOIN work_understanding_evidence e ON e.evidence_id = te.evidence_id
45
+ WHERE e.source_grant_id = ?`).all(sourceId).map((row) => row.id);
46
+ const result = runSqliteWriteTransaction((transaction) => {
47
+ transaction.prepare(`DELETE FROM work_understanding_thread_evidence
48
+ WHERE evidence_id IN (SELECT evidence_id FROM work_understanding_evidence WHERE source_grant_id = ?)`).run(sourceId);
49
+ const evidence = transaction.prepare("DELETE FROM work_understanding_evidence WHERE source_grant_id = ?").run(sourceId);
50
+ let deletedThreads = 0;
51
+ let retainedThreads = 0;
52
+ for (const threadId of affectedThreadIds) {
53
+ if (transaction.prepare("SELECT COUNT(*) AS count FROM work_understanding_thread_evidence WHERE thread_id = ?").get(threadId).count > 0) continue;
54
+ const thread = transaction.prepare("SELECT user_status, status FROM work_understanding_threads WHERE thread_id = ?").get(threadId);
55
+ if (!thread) continue;
56
+ if (thread.user_status === "confirmed" || thread.user_status === "corrected") {
57
+ transaction.prepare(`UPDATE work_understanding_threads SET confidence = MIN(confidence, 0.5),
58
+ status = CASE WHEN status IN ('paused', 'completed') THEN status ELSE 'uncertain' END,
59
+ updated_at = ? WHERE thread_id = ?`).run(Date.now(), threadId);
60
+ retainedThreads += 1;
61
+ } else {
62
+ transaction.prepare("DELETE FROM work_understanding_threads WHERE thread_id = ?").run(threadId);
63
+ deletedThreads += 1;
64
+ }
65
+ }
66
+ return {
67
+ evidenceCount: evidence.changes,
68
+ deletedThreads,
69
+ retainedThreads
70
+ };
71
+ });
72
+ const deletedMemoryRecords = memoryRecords.filter((record) => deleteMemoryRecord(record.id)).length;
73
+ return {
74
+ ...result,
75
+ deletedMemoryRecords
76
+ };
77
+ }
78
+ function getWorkUnderstandingMetrics() {
79
+ const { db } = requireXopcDatabase();
80
+ const scalar = (sql) => db.prepare(sql).get().value;
81
+ const evidenceBySource = db.prepare("SELECT source_type AS sourceType, COUNT(*) AS count FROM work_understanding_evidence GROUP BY source_type").all();
82
+ const recognition = db.prepare(`SELECT recognition_decision AS decision, COUNT(*) AS count
83
+ FROM work_discovery_feedback GROUP BY recognition_decision`).all();
84
+ const reviewed = recognition.reduce((sum, item) => sum + (item.decision === "dismissed" ? 0 : item.count), 0);
85
+ const confirmed = recognition.find((item) => item.decision === "confirmed")?.count ?? 0;
86
+ return {
87
+ completedInvestigations: scalar("SELECT COUNT(*) AS value FROM work_understanding_investigations WHERE status = 'completed'"),
88
+ averageToolCalls: scalar("SELECT COALESCE(AVG(tool_call_count), 0) AS value FROM work_understanding_investigations"),
89
+ activeThreads: scalar("SELECT COUNT(*) AS value FROM work_understanding_threads WHERE status IN ('active', 'blocked') AND user_status <> 'rejected'"),
90
+ confirmedThreads: scalar("SELECT COUNT(*) AS value FROM work_understanding_threads WHERE user_status IN ('confirmed', 'corrected')"),
91
+ recognitionConfirmationRate: reviewed ? confirmed / reviewed : 0,
92
+ evidenceBySource
93
+ };
94
+ }
95
+ //#endregion
96
+ export { deleteWorkUnderstandingDerivedData, getWorkUnderstandingMetrics, getWorkUnderstandingSourceLineage };
@@ -0,0 +1,13 @@
1
+ import type { WorkDiscoveryPreview, WorkDiscoverySourceRefresh } from './types.js';
2
+ export declare function recordWorkDiscoverySourceRefresh(input: {
3
+ sourceId: string;
4
+ changed: boolean;
5
+ previousFingerprint?: WorkDiscoveryPreview['fingerprint'];
6
+ currentFingerprint: WorkDiscoveryPreview['fingerprint'];
7
+ status?: WorkDiscoverySourceRefresh['status'];
8
+ discoveryRunId?: string;
9
+ checkedAt?: number;
10
+ }): WorkDiscoverySourceRefresh;
11
+ export declare function listWorkDiscoverySourceRefreshes(sourceId: string, limit?: number): WorkDiscoverySourceRefresh[];
12
+ export declare function findActiveWorkDiscoverySourceRefresh(sourceId: string, fingerprint: WorkDiscoveryPreview['fingerprint']): WorkDiscoverySourceRefresh | null;
13
+ export declare function updateWorkDiscoverySourceRefreshForRun(runId: string, status: 'completed' | 'failed'): void;
@@ -0,0 +1,55 @@
1
+ import { requireXopcDatabase } from "../storage/sqlite/connection.js";
2
+ import { runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
3
+ import { workDiscoveryFingerprintsEqual } from "./incremental.js";
4
+ import { randomUUID } from "node:crypto";
5
+ //#region src/work-discovery/incremental-repository.ts
6
+ function parseFingerprint(value) {
7
+ if (!value) return void 0;
8
+ try {
9
+ return JSON.parse(value);
10
+ } catch {
11
+ return;
12
+ }
13
+ }
14
+ function fromRow(row) {
15
+ return {
16
+ id: row.refresh_id,
17
+ sourceId: row.source_id,
18
+ changed: row.changed === 1,
19
+ ...parseFingerprint(row.previous_fingerprint_json) ? { previousFingerprint: parseFingerprint(row.previous_fingerprint_json) } : {},
20
+ currentFingerprint: parseFingerprint(row.current_fingerprint_json),
21
+ status: row.status,
22
+ ...row.discovery_run_id ? { discoveryRunId: row.discovery_run_id } : {},
23
+ checkedAt: row.checked_at
24
+ };
25
+ }
26
+ function recordWorkDiscoverySourceRefresh(input) {
27
+ const id = randomUUID();
28
+ runSqliteWriteTransaction((db) => {
29
+ db.prepare(`INSERT INTO work_discovery_source_refreshes (
30
+ refresh_id, source_id, discovery_run_id, changed, previous_fingerprint_json,
31
+ current_fingerprint_json, status, checked_at
32
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`).run(id, input.sourceId, input.discoveryRunId ?? null, input.changed ? 1 : 0, input.previousFingerprint ? JSON.stringify(input.previousFingerprint) : null, JSON.stringify(input.currentFingerprint), input.status ?? "checked", input.checkedAt ?? Date.now());
33
+ });
34
+ const { db } = requireXopcDatabase();
35
+ return fromRow(db.prepare("SELECT * FROM work_discovery_source_refreshes WHERE refresh_id = ?").get(id));
36
+ }
37
+ function listWorkDiscoverySourceRefreshes(sourceId, limit = 20) {
38
+ const { db } = requireXopcDatabase();
39
+ return db.prepare("SELECT * FROM work_discovery_source_refreshes WHERE source_id = ? ORDER BY checked_at DESC LIMIT ?").all(sourceId, Math.max(1, Math.min(100, limit))).map(fromRow);
40
+ }
41
+ function findActiveWorkDiscoverySourceRefresh(sourceId, fingerprint) {
42
+ const { db } = requireXopcDatabase();
43
+ return db.prepare(`SELECT refresh.* FROM work_discovery_source_refreshes refresh
44
+ JOIN work_discovery_runs run ON run.id = refresh.discovery_run_id
45
+ WHERE refresh.source_id = ? AND refresh.status = 'queued'
46
+ AND run.status IN ('queued', 'probing', 'analyzing')
47
+ ORDER BY refresh.checked_at DESC`).all(sourceId).map(fromRow).find((refresh) => workDiscoveryFingerprintsEqual(refresh.currentFingerprint, fingerprint)) ?? null;
48
+ }
49
+ function updateWorkDiscoverySourceRefreshForRun(runId, status) {
50
+ runSqliteWriteTransaction((db) => {
51
+ db.prepare("UPDATE work_discovery_source_refreshes SET status = ? WHERE discovery_run_id = ?").run(status, runId);
52
+ });
53
+ }
54
+ //#endregion
55
+ export { findActiveWorkDiscoverySourceRefresh, listWorkDiscoverySourceRefreshes, recordWorkDiscoverySourceRefresh, updateWorkDiscoverySourceRefreshForRun };
@@ -0,0 +1,2 @@
1
+ import type { WorkDiscoveryPreview } from './types.js';
2
+ export declare function workDiscoveryFingerprintsEqual(left: WorkDiscoveryPreview['fingerprint'] | undefined, right: WorkDiscoveryPreview['fingerprint']): boolean;
@@ -0,0 +1,7 @@
1
+ //#region src/work-discovery/incremental.ts
2
+ function workDiscoveryFingerprintsEqual(left, right) {
3
+ if (!left) return false;
4
+ return left.branch === right.branch && left.changedFileCount === right.changedFileCount && left.contentSignature === right.contentSignature && JSON.stringify(left.recentAreas) === JSON.stringify(right.recentAreas);
5
+ }
6
+ //#endregion
7
+ export { workDiscoveryFingerprintsEqual };
@@ -2,4 +2,14 @@ export * from './types.js';
2
2
  export * from './repository.js';
3
3
  export * from './probe.js';
4
4
  export * from './analyzer.js';
5
+ export * from './candidate-discovery.js';
5
6
  export * from './service.js';
7
+ export * from './source-repository.js';
8
+ export * from './investigation-repository.js';
9
+ export * from './investigator.js';
10
+ export * from './incremental.js';
11
+ export * from './incremental-repository.js';
12
+ export * from './governance.js';
13
+ export * from './evaluation.js';
14
+ export * from './thread-repository.js';
15
+ export * from './thread-service.js';
@@ -1,5 +1,15 @@
1
- import { WORK_DISCOVERY_SCAN_POLICY_VERSION, canonicalWorkDiscoveryRoot, previewWorkDiscoveryRoot, probeWorkDiscoveryRoot, summarizeWorkContextSnapshot } from "./probe.js";
2
- import { analyzeWorkContext, workDiscoveryResultMarkdown } from "./analyzer.js";
1
+ import { addWorkUnderstandingThreadFeedback, attachWorkUnderstandingThreadEvidence, getWorkUnderstandingThread, getWorkUnderstandingThreadByCanonicalKey, listWorkUnderstandingThreads, upsertWorkUnderstandingThread } from "./thread-repository.js";
2
+ import { WORK_DISCOVERY_SCAN_POLICY_VERSION, canonicalWorkDiscoveryRoot, previewWorkDiscoveryRoot, probeWorkDiscoveryRoot, readWorkDiscoveryTextExcerpt, searchWorkDiscoveryText, summarizeWorkContextSnapshot } from "./probe.js";
3
+ import { analyzePersonalContext, analyzeWorkContext, workDiscoveryResultMarkdown } from "./analyzer.js";
4
+ import { discoverWorkCandidates } from "./candidate-discovery.js";
5
+ import { deleteWorkUnderstandingDerivedData, getWorkUnderstandingMetrics, getWorkUnderstandingSourceLineage } from "./governance.js";
6
+ import { workDiscoveryFingerprintsEqual } from "./incremental.js";
7
+ import { findActiveWorkDiscoverySourceRefresh, listWorkDiscoverySourceRefreshes, recordWorkDiscoverySourceRefresh, updateWorkDiscoverySourceRefreshForRun } from "./incremental-repository.js";
8
+ import { appendWorkUnderstandingEvidence, createWorkUnderstandingInvestigation, getWorkUnderstandingInvestigation, getWorkUnderstandingInvestigationForRun, listWorkUnderstandingEvidence, resetWorkUnderstandingInvestigation, updateWorkUnderstandingEvidenceObservation, updateWorkUnderstandingInvestigation } from "./investigation-repository.js";
9
+ import { DEFAULT_WORK_INVESTIGATION_BUDGET, investigateWorkContext } from "./investigator.js";
10
+ import { persistWorkThreadsFromDiscovery } from "./thread-service.js";
3
11
  import { createWorkDiscoveryRun, getWorkDiscoveryOnboardingState, getWorkDiscoveryRun, getWorkDiscoveryRunByIdempotencyKey, setWorkDiscoveryFeedback, setWorkDiscoveryOnboardingState, updateWorkDiscoveryRun } from "./repository.js";
12
+ import { getWorkDiscoveryDirectorySource, listWorkDiscoveryDirectorySources, revokeWorkDiscoveryDirectorySource, upsertWorkDiscoveryDirectorySource } from "./source-repository.js";
4
13
  import { WorkDiscoveryService } from "./service.js";
5
- export { WORK_DISCOVERY_SCAN_POLICY_VERSION, WorkDiscoveryService, analyzeWorkContext, canonicalWorkDiscoveryRoot, createWorkDiscoveryRun, getWorkDiscoveryOnboardingState, getWorkDiscoveryRun, getWorkDiscoveryRunByIdempotencyKey, previewWorkDiscoveryRoot, probeWorkDiscoveryRoot, setWorkDiscoveryFeedback, setWorkDiscoveryOnboardingState, summarizeWorkContextSnapshot, updateWorkDiscoveryRun, workDiscoveryResultMarkdown };
14
+ import { evaluateWorkUnderstandingCase } from "./evaluation.js";
15
+ export { DEFAULT_WORK_INVESTIGATION_BUDGET, WORK_DISCOVERY_SCAN_POLICY_VERSION, WorkDiscoveryService, addWorkUnderstandingThreadFeedback, analyzePersonalContext, analyzeWorkContext, appendWorkUnderstandingEvidence, attachWorkUnderstandingThreadEvidence, canonicalWorkDiscoveryRoot, createWorkDiscoveryRun, createWorkUnderstandingInvestigation, deleteWorkUnderstandingDerivedData, discoverWorkCandidates, evaluateWorkUnderstandingCase, findActiveWorkDiscoverySourceRefresh, getWorkDiscoveryDirectorySource, getWorkDiscoveryOnboardingState, getWorkDiscoveryRun, getWorkDiscoveryRunByIdempotencyKey, getWorkUnderstandingInvestigation, getWorkUnderstandingInvestigationForRun, getWorkUnderstandingMetrics, getWorkUnderstandingSourceLineage, getWorkUnderstandingThread, getWorkUnderstandingThreadByCanonicalKey, investigateWorkContext, listWorkDiscoveryDirectorySources, listWorkDiscoverySourceRefreshes, listWorkUnderstandingEvidence, listWorkUnderstandingThreads, persistWorkThreadsFromDiscovery, previewWorkDiscoveryRoot, probeWorkDiscoveryRoot, readWorkDiscoveryTextExcerpt, recordWorkDiscoverySourceRefresh, resetWorkUnderstandingInvestigation, revokeWorkDiscoveryDirectorySource, searchWorkDiscoveryText, setWorkDiscoveryFeedback, setWorkDiscoveryOnboardingState, summarizeWorkContextSnapshot, updateWorkDiscoveryRun, updateWorkDiscoverySourceRefreshForRun, updateWorkUnderstandingEvidenceObservation, updateWorkUnderstandingInvestigation, upsertWorkDiscoveryDirectorySource, upsertWorkUnderstandingThread, workDiscoveryFingerprintsEqual, workDiscoveryResultMarkdown };
@@ -0,0 +1,16 @@
1
+ import type { WorkUnderstandingEvidenceItem, WorkUnderstandingInvestigation, WorkUnderstandingInvestigationBudget } from './types.js';
2
+ export declare function createWorkUnderstandingInvestigation(input: {
3
+ discoveryRunId: string;
4
+ budget: WorkUnderstandingInvestigationBudget;
5
+ nowMs?: number;
6
+ }): WorkUnderstandingInvestigation;
7
+ export declare function getWorkUnderstandingInvestigation(id: string): WorkUnderstandingInvestigation | null;
8
+ export declare function getWorkUnderstandingInvestigationForRun(runId: string): WorkUnderstandingInvestigation | null;
9
+ export declare function updateWorkUnderstandingInvestigation(id: string, patch: Partial<Pick<WorkUnderstandingInvestigation, 'status' | 'plan' | 'toolCallCount' | 'contentCharsRead' | 'completedAt' | 'errorMessage'>>): WorkUnderstandingInvestigation | null;
10
+ export declare function resetWorkUnderstandingInvestigation(id: string, budget: WorkUnderstandingInvestigationBudget, nowMs?: number): WorkUnderstandingInvestigation | null;
11
+ export declare function appendWorkUnderstandingEvidence(input: Omit<WorkUnderstandingEvidenceItem, 'id' | 'collectedAt'> & {
12
+ id?: string;
13
+ collectedAt?: number;
14
+ }): WorkUnderstandingEvidenceItem;
15
+ export declare function updateWorkUnderstandingEvidenceObservation(id: string, observation: string): void;
16
+ export declare function listWorkUnderstandingEvidence(investigationId: string): WorkUnderstandingEvidenceItem[];
@@ -0,0 +1,122 @@
1
+ import { requireXopcDatabase } from "../storage/sqlite/connection.js";
2
+ import { runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
3
+ import { randomUUID } from "node:crypto";
4
+ //#region src/work-discovery/investigation-repository.ts
5
+ function parseJson(value, fallback) {
6
+ try {
7
+ return JSON.parse(value);
8
+ } catch {
9
+ return fallback;
10
+ }
11
+ }
12
+ function investigationFromRow(row) {
13
+ return {
14
+ id: row.investigation_id,
15
+ discoveryRunId: row.discovery_run_id,
16
+ status: row.status,
17
+ plan: parseJson(row.plan_json, {
18
+ hypotheses: [],
19
+ questions: []
20
+ }),
21
+ budget: parseJson(row.budget_json, {
22
+ maxToolCalls: 0,
23
+ maxContentChars: 0,
24
+ maxDurationMs: 0
25
+ }),
26
+ toolCallCount: row.tool_call_count,
27
+ contentCharsRead: row.content_chars_read,
28
+ startedAt: row.started_at,
29
+ ...row.completed_at != null ? { completedAt: row.completed_at } : {},
30
+ ...row.error_message ? { errorMessage: row.error_message } : {}
31
+ };
32
+ }
33
+ function evidenceFromRow(row) {
34
+ return {
35
+ id: row.evidence_id,
36
+ investigationId: row.investigation_id,
37
+ ...row.source_grant_id ? { sourceGrantId: row.source_grant_id } : {},
38
+ ...row.project_id ? { projectId: row.project_id } : {},
39
+ sourceType: row.source_type,
40
+ sourceRef: row.source_ref,
41
+ observation: row.observation,
42
+ ...row.content_hash ? { contentHash: row.content_hash } : {},
43
+ ...row.observed_at != null ? { observedAt: row.observed_at } : {},
44
+ collectedAt: row.collected_at,
45
+ sensitivity: row.sensitivity === "restricted" ? "restricted" : "normal"
46
+ };
47
+ }
48
+ function createWorkUnderstandingInvestigation(input) {
49
+ const now = input.nowMs ?? Date.now();
50
+ const id = randomUUID();
51
+ runSqliteWriteTransaction((db) => {
52
+ db.prepare(`INSERT INTO work_understanding_investigations (
53
+ investigation_id, discovery_run_id, status, plan_json, budget_json,
54
+ tool_call_count, content_chars_read, started_at
55
+ ) VALUES (?, ?, 'planning', ?, ?, 0, 0, ?)`).run(id, input.discoveryRunId, JSON.stringify({
56
+ hypotheses: [],
57
+ questions: []
58
+ }), JSON.stringify(input.budget), now);
59
+ });
60
+ return getWorkUnderstandingInvestigation(id);
61
+ }
62
+ function getWorkUnderstandingInvestigation(id) {
63
+ const { db } = requireXopcDatabase();
64
+ const row = db.prepare("SELECT * FROM work_understanding_investigations WHERE investigation_id = ?").get(id);
65
+ return row ? investigationFromRow(row) : null;
66
+ }
67
+ function getWorkUnderstandingInvestigationForRun(runId) {
68
+ const { db } = requireXopcDatabase();
69
+ const row = db.prepare("SELECT * FROM work_understanding_investigations WHERE discovery_run_id = ?").get(runId);
70
+ return row ? investigationFromRow(row) : null;
71
+ }
72
+ function updateWorkUnderstandingInvestigation(id, patch) {
73
+ const existing = getWorkUnderstandingInvestigation(id);
74
+ if (!existing) return null;
75
+ const next = {
76
+ ...existing,
77
+ ...patch
78
+ };
79
+ runSqliteWriteTransaction((db) => {
80
+ db.prepare(`UPDATE work_understanding_investigations SET
81
+ status = ?, plan_json = ?, tool_call_count = ?, content_chars_read = ?,
82
+ error_message = ?, completed_at = ? WHERE investigation_id = ?`).run(next.status, JSON.stringify(next.plan), next.toolCallCount, next.contentCharsRead, next.errorMessage ?? null, next.completedAt ?? null, id);
83
+ });
84
+ return getWorkUnderstandingInvestigation(id);
85
+ }
86
+ function resetWorkUnderstandingInvestigation(id, budget, nowMs = Date.now()) {
87
+ if (!getWorkUnderstandingInvestigation(id)) return null;
88
+ runSqliteWriteTransaction((db) => {
89
+ db.prepare("DELETE FROM work_understanding_evidence WHERE investigation_id = ?").run(id);
90
+ db.prepare(`UPDATE work_understanding_investigations SET
91
+ status = 'planning', plan_json = ?, budget_json = ?, tool_call_count = 0,
92
+ content_chars_read = 0, error_message = NULL, started_at = ?, completed_at = NULL
93
+ WHERE investigation_id = ?`).run(JSON.stringify({
94
+ hypotheses: [],
95
+ questions: []
96
+ }), JSON.stringify(budget), nowMs, id);
97
+ });
98
+ return getWorkUnderstandingInvestigation(id);
99
+ }
100
+ function appendWorkUnderstandingEvidence(input) {
101
+ const id = input.id ?? randomUUID();
102
+ const collectedAt = input.collectedAt ?? Date.now();
103
+ runSqliteWriteTransaction((db) => {
104
+ db.prepare(`INSERT INTO work_understanding_evidence (
105
+ evidence_id, investigation_id, source_grant_id, project_id, source_type,
106
+ source_ref, observation, content_hash, observed_at, collected_at, sensitivity
107
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(id, input.investigationId, input.sourceGrantId ?? null, input.projectId ?? null, input.sourceType, input.sourceRef, input.observation, input.contentHash ?? null, input.observedAt ?? null, collectedAt, input.sensitivity);
108
+ });
109
+ const { db } = requireXopcDatabase();
110
+ return evidenceFromRow(db.prepare("SELECT * FROM work_understanding_evidence WHERE evidence_id = ?").get(id));
111
+ }
112
+ function updateWorkUnderstandingEvidenceObservation(id, observation) {
113
+ runSqliteWriteTransaction((db) => {
114
+ db.prepare("UPDATE work_understanding_evidence SET observation = ? WHERE evidence_id = ?").run(observation.slice(0, 1e3), id);
115
+ });
116
+ }
117
+ function listWorkUnderstandingEvidence(investigationId) {
118
+ const { db } = requireXopcDatabase();
119
+ return db.prepare("SELECT * FROM work_understanding_evidence WHERE investigation_id = ? ORDER BY collected_at ASC").all(investigationId).map(evidenceFromRow);
120
+ }
121
+ //#endregion
122
+ export { appendWorkUnderstandingEvidence, createWorkUnderstandingInvestigation, getWorkUnderstandingInvestigation, getWorkUnderstandingInvestigationForRun, listWorkUnderstandingEvidence, resetWorkUnderstandingInvestigation, updateWorkUnderstandingEvidenceObservation, updateWorkUnderstandingInvestigation };
@@ -0,0 +1,55 @@
1
+ import type { Config } from '../config/schema.js';
2
+ import type { WorkContextDocument, WorkContextSnapshot, WorkUnderstandingEvidenceItem, WorkUnderstandingInvestigation, WorkUnderstandingInvestigationBudget } from './types.js';
3
+ export declare const DEFAULT_WORK_INVESTIGATION_BUDGET: WorkUnderstandingInvestigationBudget;
4
+ type InvestigationAction = {
5
+ tool: 'read_text_excerpt';
6
+ relativePath: string;
7
+ reason: string;
8
+ } | {
9
+ tool: 'search_authorized_text';
10
+ query: string;
11
+ reason: string;
12
+ } | {
13
+ tool: 'finish';
14
+ reason: string;
15
+ };
16
+ export interface InvestigationDecision {
17
+ hypotheses: string[];
18
+ questions: string[];
19
+ evidenceSummaries: Array<{
20
+ evidenceId: string;
21
+ observation: string;
22
+ }>;
23
+ action: InvestigationAction;
24
+ }
25
+ interface RuntimeEvidence {
26
+ record: WorkUnderstandingEvidenceItem;
27
+ content: string;
28
+ modifiedAt?: number;
29
+ }
30
+ export interface WorkInvestigationResult {
31
+ investigation: WorkUnderstandingInvestigation;
32
+ evidence: WorkUnderstandingEvidenceItem[];
33
+ documents: WorkContextDocument[];
34
+ degraded: boolean;
35
+ }
36
+ declare function chooseAction(input: {
37
+ config: Config;
38
+ snapshot: WorkContextSnapshot;
39
+ runtimeEvidence: RuntimeEvidence[];
40
+ toolCallsRemaining: number;
41
+ contentCharsRemaining: number;
42
+ signal?: AbortSignal;
43
+ }): Promise<InvestigationDecision | null>;
44
+ export declare function investigateWorkContext(input: {
45
+ config: Config;
46
+ snapshot: WorkContextSnapshot;
47
+ rootPath: string;
48
+ discoveryRunId: string;
49
+ projectId: string;
50
+ sourceGrantId?: string;
51
+ budget?: Partial<WorkUnderstandingInvestigationBudget>;
52
+ decisionProvider?: typeof chooseAction;
53
+ signal?: AbortSignal;
54
+ }): Promise<WorkInvestigationResult>;
55
+ export {};