@xopcai/xopc 0.0.173 → 0.0.174
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.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-ByVA0N5n.js → activity-store-CyEDJeIt.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CJ5HvqE7.js → agent-avatar-dicebear-DF7Bol6I.js} +1 -1
- package/dist/gateway/static/root/assets/agents-BVxEFPQ5.js +2 -0
- package/dist/gateway/static/root/assets/{api-BZtCKzg4.js → api-DYunqroX.js} +1 -1
- package/dist/gateway/static/root/assets/api-DwyUxpgY.js +1 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-B0oNNcFn.js → app-management-settings-panel-B4xJyvDu.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DbIj4NQ1.js → appearance-settings-B2PQxRiu.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-BtIgd82S.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BICLQFWJ.js → archive-plugin-DWhBmmjD.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-DV3PteSU.js → attachment-load-BOpZfa_I.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-CZUImis0.js → automation-suggestion-card-Byu3I7Rs.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-CG_SCH5b.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-D6zkab6N.js → binary-plugins-6AG1qatz.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-zCzoQI-g.js → block-editor-CJhrn98_.js} +5 -5
- package/dist/gateway/static/root/assets/browser-settings-page-CfLqPWZC.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-CY3X83xQ.js → browser-workflow-inputs-CBVb4mt9.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-DDRtZLuM.js → browser-workflows-page-Cq4XUKbu.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DCJmm6cR.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-pYLW6P7g.js → capability-presets-api-hbW4NAKO.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-CnkAYvWI.js +1 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-DxyOH3BO.js → channel-recipient-api-CzMjHb17.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-DtqqFpDn.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-C-5yHbc0.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-BgANwjt-.js → connector-logo-B9Au6gMZ.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-CaHfs8YF.js +2 -0
- package/dist/gateway/static/root/assets/copy-VueTIC2x.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-CvFMKYdb.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-settings-8CaU1Mhm.js → desktop-pet-settings-CNff5TFb.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BtNRUvzM.js → directory-picker-path-field-Bf956uo-.js} +1 -1
- package/dist/gateway/static/root/assets/dreaming-settings-CHM8FE1g.js +3 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-DFjTfx6f.js → extension-debug-page-ZqM_0eUs.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-NyEYtWWg.js → extension-page-D4hvXOMM.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BynTCfgf.js → extension-settings-page-GsqxaJjA.js} +1 -1
- package/dist/gateway/static/root/assets/focus-detail-page-CE6uwrl1.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-api-BzOWImvU.js → gateway-config-api-B4THmgnS.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-DXepE_Jw.js → gateway-settings-CPv-MxGE.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-C2JXXtwg.js → gateway-startup-retry-MP3K71pP.js} +1 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-DAeb82xP.js +1 -0
- package/dist/gateway/static/root/assets/goal-detail-page-CwLSp01r.js +4 -0
- package/dist/gateway/static/root/assets/{goals-config-api-CU3JR9MI.js → goals-config-api-DCcDuIjG.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-DvJQ6_4M.js +2 -0
- package/dist/gateway/static/root/assets/{goals-settings-DSZguLEx.js → goals-settings-o9QMXvNq.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-KRkYziEF.js → heartbeat-settings-DixwpXnH.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-Y-n6TaZ_.js → image-generation-api-BOGH9FGi.js} +1 -1
- package/dist/gateway/static/root/assets/index-CfXiRNN5.css +1 -0
- package/dist/gateway/static/root/assets/index-eyttVNS_.js +212 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CwrQv952.js → keyboard-shortcuts-settings-D4o4ZPF6.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CPcfqn_A.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DtITcS4K.js → local-apps-page-GzMmpO7G.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-Ccv7tH8B.js → locale-store-CAuhEGCn.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-DXABWCZp.js +7 -0
- package/dist/gateway/static/root/assets/{markdown-split-D1oZlq1m.js → markdown-split-CIX8D1pv.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-BKz5V32t.js → media-plugins-Bp3eIA45.js} +1 -1
- package/dist/gateway/static/root/assets/messages-BiBdO1-O.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-DLekBQPa.js → notes-page-RVFiYAoO.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-DgJzZRX3.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-pT4nLfqS.js → page-tabs-BGAYH3Ef.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-OtAiaJm2.js → preview-open-alternatives-BM6pDkHp.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-CfryBKD9.js → product-open-page-BiMetEmn.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DF7F70Vg.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-Cw3jyi5s.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-ChAJsaNY.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-nP1SB3Lf.js → save-bar-controls-BdjV8MK5.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-OEQTsUNz.js → schedule-field-ChlqXU46.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-DIcAa7CJ.js → schema-form-DDKf5ZSH.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-BxZIxt7z.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DcDLS0xV.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-BxNcTbYO.js → settings-form-section-CPG0KGVs.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-Dpdxu4sf.js → settings-loading-skeleton-DRSDHucM.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DwPeOm1c.js → settings-page-CeB7_xD0.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-CqirFmMn.js → settings-page-layout-BENrkwd0.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-4Xa9NA7v.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-D72gYeux.js → share-preview-page-DIzczJkG.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-BpN0o5Cf.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-DvF2UAaL.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-CGKXpNfy.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-U0tBgW46.js → system-settings-panel-Dp4d5Q1B.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-DCKDVPFF.js → theme-store-CbGc1laW.js} +1 -1
- package/dist/gateway/static/root/assets/{time-picker-BpiBF5-d.js → time-picker-BhgCeDuO.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-D0XCOCAM.js → typed-models-lib-DwPk3OPL.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-mq_Inao2.js → use-channel-catalog-CXrEu2dw.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-Dy_fKAK_.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-CKaDitO6.js → voice-api-key-field-DFoA79LB.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-page-BWkjb1NK.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-DLBNFse5.js +1 -0
- package/dist/gateway/static/root/assets/work-page-Bn5RXMIE.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-s_kS_FYA.js → workflow-run-setup-panel-BuniGPO0.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-_vFhRrAl.js +11 -0
- package/dist/gateway/static/root/index.html +7 -7
- package/dist/package.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/focuses/candidate-repository.d.ts +15 -0
- package/dist/src/focuses/candidate-repository.js +91 -0
- package/dist/src/focuses/index.d.ts +7 -0
- package/dist/src/focuses/index.js +7 -0
- package/dist/src/focuses/insight-repository.d.ts +22 -0
- package/dist/src/focuses/insight-repository.js +77 -0
- package/dist/src/focuses/prompts.d.ts +2 -0
- package/dist/src/focuses/prompts.js +18 -0
- package/dist/src/focuses/reconciler.d.ts +5 -0
- package/dist/src/focuses/reconciler.js +26 -0
- package/dist/src/focuses/repository.d.ts +61 -0
- package/dist/src/focuses/repository.js +214 -0
- package/dist/src/focuses/run-processor.d.ts +18 -0
- package/dist/src/focuses/run-processor.js +162 -0
- package/dist/src/focuses/service.d.ts +42 -0
- package/dist/src/focuses/service.js +241 -0
- package/dist/src/focuses/types.d.ts +89 -0
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/routes/focuses.d.ts +3 -0
- package/dist/src/gateway/hono/routes/focuses.js +319 -0
- package/dist/src/gateway/hono/routes/home.js +15 -17
- package/dist/src/gateway/hono/routes/index.js +2 -0
- package/dist/src/gateway/hono/routes/local-apps.js +1 -1
- package/dist/src/gateway/hono/routes/projects.js +2 -103
- package/dist/src/gateway/hono/routes/work-discovery.js +0 -239
- package/dist/src/gateway/service.d.ts +1 -1
- package/dist/src/gateway/service.js +17 -13
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/mcp/channel-bridge.js +1 -1
- package/dist/src/storage/sqlite/migrations/066_first_class_focuses.sql +126 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/work-discovery/index.d.ts +0 -2
- package/dist/src/work-discovery/index.js +1 -3
- package/dist/src/work-discovery/service.d.ts +0 -30
- package/dist/src/work-discovery/service.js +1 -35
- package/dist/src/work-discovery/thread-service.d.ts +5 -0
- package/dist/src/work-discovery/thread-service.js +36 -88
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/agents--TQ9jM_1.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-BDsoZDEn.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-CHrNcppN.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-BQoRuQzH.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BOcU0qeM.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-CJ1F_hlX.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-C4vDwRil.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-B0Pgq5x2.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-D6JEqDEj.js +0 -2
- package/dist/gateway/static/root/assets/desktop-pet-BPjQbPeA.js +0 -1
- package/dist/gateway/static/root/assets/dreaming-settings-Byv-h8XZ.js +0 -3
- package/dist/gateway/static/root/assets/goal-create-dialog-ClOZyG52.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-UbZB77De.js +0 -4
- package/dist/gateway/static/root/assets/goals-page-GMqV8Fwv.js +0 -2
- package/dist/gateway/static/root/assets/index-BCkNJ5cR.css +0 -1
- package/dist/gateway/static/root/assets/index-CAZ9343h.js +0 -212
- package/dist/gateway/static/root/assets/local-app-workbench-page-m5HEyrHT.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-Bf_nk75f.js +0 -7
- package/dist/gateway/static/root/assets/messages-DWrg3c4K.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-BTDmprHM.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-C7kntu4H.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-3ubcbqHr.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-DoUkN3ik.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-ElAAlZ-R.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CQn_KBqr.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DX_LdcTN.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-nSfe-5xK.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-1tYpZrJf.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-BUJl8LJG.js +0 -2
- package/dist/gateway/static/root/assets/user-context-page-BOC6Hn19.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-DWGYp5yV.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-CpeWcpSp.js +0 -1
- package/dist/gateway/static/root/assets/work-page-MsEKzmSt.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-ByhHaUHB.js +0 -11
- package/dist/src/proactive/calendar-signals.d.ts +0 -4
- package/dist/src/proactive/calendar-signals.js +0 -120
- package/dist/src/proactive/focus-service.d.ts +0 -62
- package/dist/src/proactive/focus-service.js +0 -173
- package/dist/src/proactive/index.d.ts +0 -7
- package/dist/src/proactive/index.js +0 -7
- package/dist/src/proactive/insight-repository.d.ts +0 -21
- package/dist/src/proactive/insight-repository.js +0 -109
- package/dist/src/proactive/run-processor.d.ts +0 -19
- package/dist/src/proactive/run-processor.js +0 -146
- package/dist/src/proactive/trial-expiry-reconciler.d.ts +0 -5
- package/dist/src/proactive/trial-expiry-reconciler.js +0 -30
- package/dist/src/proactive/types.d.ts +0 -66
- package/dist/src/proactive/value-score.d.ts +0 -13
- package/dist/src/proactive/value-score.js +0 -30
- package/dist/src/proactive/watch-repository.d.ts +0 -28
- package/dist/src/proactive/watch-repository.js +0 -129
- package/dist/src/work-discovery/governance.d.ts +0 -25
- package/dist/src/work-discovery/governance.js +0 -96
- package/dist/src/work-discovery/thread-repository.d.ts +0 -34
- package/dist/src/work-discovery/thread-repository.js +0 -112
- /package/dist/src/{proactive → focuses}/types.js +0 -0
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { getAgentDefaultModelRef, init_schema } from "../../../config/schema.js";
|
|
2
2
|
import { init_providers, resolveModel } from "../../../providers/index.js";
|
|
3
3
|
import { isLocalModelBaseUrl } from "../../../providers/model-call.js";
|
|
4
|
-
import { listFocusCalendarSignals } from "../../../proactive/calendar-signals.js";
|
|
5
|
-
import { FocusService } from "../../../proactive/focus-service.js";
|
|
6
|
-
import { claimProactiveInsightApproval, getProactiveInsight, setProactiveInsightStatus } from "../../../proactive/insight-repository.js";
|
|
7
|
-
import "../../../proactive/index.js";
|
|
8
4
|
import { previewWorkDiscoveryRoot } from "../../../work-discovery/probe.js";
|
|
9
5
|
import { WorkDiscoveryService } from "../../../work-discovery/service.js";
|
|
10
6
|
//#region src/gateway/hono/routes/work-discovery.ts
|
|
@@ -30,7 +26,6 @@ function stringField(body, field) {
|
|
|
30
26
|
}
|
|
31
27
|
function registerWorkDiscoveryRoutes(authenticated, deps) {
|
|
32
28
|
const service = workDiscoveryService(deps);
|
|
33
|
-
const focuses = new FocusService(deps.service.automationServiceInstance);
|
|
34
29
|
const limited = deps.strictRateLimitMiddleware;
|
|
35
30
|
authenticated.get("/api/onboarding/work-discovery", (c) => c.json({
|
|
36
31
|
enabled: service.isEnabled(),
|
|
@@ -304,240 +299,6 @@ function registerWorkDiscoveryRoutes(authenticated, deps) {
|
|
|
304
299
|
error: "Investigation not found"
|
|
305
300
|
}, 404);
|
|
306
301
|
});
|
|
307
|
-
authenticated.get("/api/work-understanding/threads", (c) => {
|
|
308
|
-
const projectId = c.req.query("projectId")?.trim();
|
|
309
|
-
const limit = Number(c.req.query("limit"));
|
|
310
|
-
return c.json({
|
|
311
|
-
ok: true,
|
|
312
|
-
threads: service.listWorkThreads({
|
|
313
|
-
...projectId ? { projectId } : {},
|
|
314
|
-
...Number.isFinite(limit) ? { limit } : {}
|
|
315
|
-
})
|
|
316
|
-
});
|
|
317
|
-
});
|
|
318
|
-
authenticated.get("/api/work-understanding/metrics", (c) => c.json({
|
|
319
|
-
ok: true,
|
|
320
|
-
metrics: service.getUnderstandingMetrics()
|
|
321
|
-
}));
|
|
322
|
-
authenticated.get("/api/work-understanding/sources/:sourceId/lineage", (c) => {
|
|
323
|
-
const lineage = service.getSourceLineage(c.req.param("sourceId"));
|
|
324
|
-
return lineage ? c.json({
|
|
325
|
-
ok: true,
|
|
326
|
-
lineage
|
|
327
|
-
}) : c.json({
|
|
328
|
-
ok: false,
|
|
329
|
-
error: "Source not found"
|
|
330
|
-
}, 404);
|
|
331
|
-
});
|
|
332
|
-
authenticated.delete("/api/work-understanding/sources/:sourceId/derived-data", limited, (c) => {
|
|
333
|
-
const deleted = service.deleteSourceDerivedData(c.req.param("sourceId"));
|
|
334
|
-
return deleted ? c.json({
|
|
335
|
-
ok: true,
|
|
336
|
-
deleted
|
|
337
|
-
}) : c.json({
|
|
338
|
-
ok: false,
|
|
339
|
-
error: "Source not found"
|
|
340
|
-
}, 404);
|
|
341
|
-
});
|
|
342
|
-
authenticated.get("/api/work-understanding/threads/:threadId", (c) => {
|
|
343
|
-
const thread = service.getWorkThread(c.req.param("threadId"));
|
|
344
|
-
return thread ? c.json({
|
|
345
|
-
ok: true,
|
|
346
|
-
thread
|
|
347
|
-
}) : c.json({
|
|
348
|
-
ok: false,
|
|
349
|
-
error: "Work thread not found"
|
|
350
|
-
}, 404);
|
|
351
|
-
});
|
|
352
|
-
authenticated.patch("/api/work-understanding/threads/:threadId", limited, async (c) => {
|
|
353
|
-
const body = await c.req.json().catch(() => null);
|
|
354
|
-
const decision = stringField(body, "decision");
|
|
355
|
-
if (![
|
|
356
|
-
"confirmed",
|
|
357
|
-
"corrected",
|
|
358
|
-
"rejected",
|
|
359
|
-
"paused",
|
|
360
|
-
"completed"
|
|
361
|
-
].includes(decision)) return c.json({
|
|
362
|
-
ok: false,
|
|
363
|
-
error: "Invalid work thread decision"
|
|
364
|
-
}, 400);
|
|
365
|
-
const thread = service.updateWorkThread({
|
|
366
|
-
id: c.req.param("threadId"),
|
|
367
|
-
decision,
|
|
368
|
-
...stringField(body, "correctedTitle") ? { correctedTitle: stringField(body, "correctedTitle") } : {},
|
|
369
|
-
...stringField(body, "correctedSummary") ? { correctedSummary: stringField(body, "correctedSummary") } : {}
|
|
370
|
-
});
|
|
371
|
-
return thread ? c.json({
|
|
372
|
-
ok: true,
|
|
373
|
-
thread
|
|
374
|
-
}) : c.json({
|
|
375
|
-
ok: false,
|
|
376
|
-
error: "Work thread not found"
|
|
377
|
-
}, 404);
|
|
378
|
-
});
|
|
379
|
-
authenticated.get("/api/focuses", (c) => {
|
|
380
|
-
return c.json({
|
|
381
|
-
ok: true,
|
|
382
|
-
focuses: focuses.list({ includeUnreviewed: c.req.query("includeUnreviewed") === "true" })
|
|
383
|
-
});
|
|
384
|
-
});
|
|
385
|
-
authenticated.post("/api/focuses/:focusId/confirm", limited, (c) => {
|
|
386
|
-
const focus = focuses.confirm(c.req.param("focusId"));
|
|
387
|
-
return focus ? c.json({
|
|
388
|
-
ok: true,
|
|
389
|
-
focus
|
|
390
|
-
}) : c.json({
|
|
391
|
-
ok: false,
|
|
392
|
-
error: "Focus not found"
|
|
393
|
-
}, 404);
|
|
394
|
-
});
|
|
395
|
-
authenticated.post("/api/focuses/:focusId/watches/trial", limited, async (c) => {
|
|
396
|
-
const requestedKind = stringField(await c.req.json().catch(() => null), "kind");
|
|
397
|
-
const kind = [
|
|
398
|
-
"progress",
|
|
399
|
-
"staleness",
|
|
400
|
-
"deadline",
|
|
401
|
-
"intelligence"
|
|
402
|
-
].includes(requestedKind) ? requestedKind : void 0;
|
|
403
|
-
try {
|
|
404
|
-
const result = await focuses.activateTrial({
|
|
405
|
-
threadId: c.req.param("focusId"),
|
|
406
|
-
...kind ? { kind } : {}
|
|
407
|
-
});
|
|
408
|
-
return c.json({
|
|
409
|
-
ok: true,
|
|
410
|
-
...result
|
|
411
|
-
}, 201);
|
|
412
|
-
} catch (error) {
|
|
413
|
-
return c.json({
|
|
414
|
-
ok: false,
|
|
415
|
-
error: error instanceof Error ? error.message : String(error)
|
|
416
|
-
}, 400);
|
|
417
|
-
}
|
|
418
|
-
});
|
|
419
|
-
authenticated.post("/api/focuses/:focusId/watches/:watchId/pause", limited, async (c) => {
|
|
420
|
-
const watch = focuses.list({ includeUnreviewed: true }).find((item) => item.id === c.req.param("focusId"))?.watches.find((item) => item.id === c.req.param("watchId"));
|
|
421
|
-
if (!watch) return c.json({
|
|
422
|
-
ok: false,
|
|
423
|
-
error: "Watch not found"
|
|
424
|
-
}, 404);
|
|
425
|
-
const paused = await focuses.pauseWatch(watch.id);
|
|
426
|
-
return c.json({
|
|
427
|
-
ok: true,
|
|
428
|
-
watch: paused
|
|
429
|
-
});
|
|
430
|
-
});
|
|
431
|
-
authenticated.patch("/api/proactive/insights/:insightId", limited, async (c) => {
|
|
432
|
-
const requested = stringField(await c.req.json().catch(() => null), "status");
|
|
433
|
-
const status = requested === "read" || requested === "dismissed" ? requested : void 0;
|
|
434
|
-
if (!status) return c.json({
|
|
435
|
-
ok: false,
|
|
436
|
-
error: "Status must be read or dismissed"
|
|
437
|
-
}, 400);
|
|
438
|
-
const insight = setProactiveInsightStatus(c.req.param("insightId"), status, Date.now(), "unread");
|
|
439
|
-
if (!insight) return c.json({
|
|
440
|
-
ok: false,
|
|
441
|
-
error: "Insight was already handled or not found"
|
|
442
|
-
}, 409);
|
|
443
|
-
if (status === "dismissed") await focuses.recordInsightFeedback(insight.watchId, false);
|
|
444
|
-
return c.json({
|
|
445
|
-
ok: true,
|
|
446
|
-
insight
|
|
447
|
-
});
|
|
448
|
-
});
|
|
449
|
-
authenticated.post("/api/proactive/insights/:insightId/approve", limited, async (c) => {
|
|
450
|
-
const insight = getProactiveInsight(c.req.param("insightId"));
|
|
451
|
-
if (!insight) return c.json({
|
|
452
|
-
ok: false,
|
|
453
|
-
error: "Insight not found"
|
|
454
|
-
}, 404);
|
|
455
|
-
if (insight.status !== "unread") return c.json({
|
|
456
|
-
ok: false,
|
|
457
|
-
error: `Insight is ${insight.status}`
|
|
458
|
-
}, 409);
|
|
459
|
-
const focus = focuses.list({ includeUnreviewed: true }).find((item) => item.watches.some((watch) => watch.id === insight.watchId));
|
|
460
|
-
if (!focus) return c.json({
|
|
461
|
-
ok: false,
|
|
462
|
-
error: "Focus not found"
|
|
463
|
-
}, 404);
|
|
464
|
-
if (!claimProactiveInsightApproval(insight.id)) return c.json({
|
|
465
|
-
ok: false,
|
|
466
|
-
error: "Insight was already handled"
|
|
467
|
-
}, 409);
|
|
468
|
-
let automationId;
|
|
469
|
-
try {
|
|
470
|
-
const automation = await deps.service.automationServiceInstance.create({
|
|
471
|
-
name: `Investigate: ${insight.title}`.slice(0, 200),
|
|
472
|
-
description: `User-approved read-only proposal from proactive insight ${insight.id}.`,
|
|
473
|
-
...focus.projectIds[0] ? { projectId: focus.projectIds[0] } : {},
|
|
474
|
-
trigger: { kind: "manual" },
|
|
475
|
-
action: {
|
|
476
|
-
kind: "agent",
|
|
477
|
-
instruction: [
|
|
478
|
-
"The user approved this evidence-backed proposal for read-only investigation and preparation.",
|
|
479
|
-
`Focus: ${focus.title}`,
|
|
480
|
-
`Observed change: ${insight.summary}`,
|
|
481
|
-
`Why it matters: ${insight.whyItMatters}`,
|
|
482
|
-
`Approved next step: ${insight.nextAction}`,
|
|
483
|
-
`Evidence: ${JSON.stringify(insight.evidence)}`,
|
|
484
|
-
"Investigate or prepare the requested material. Return a concise result with evidence. Do not modify files or external systems."
|
|
485
|
-
].join("\n"),
|
|
486
|
-
timeoutSeconds: 300
|
|
487
|
-
},
|
|
488
|
-
safety: { mode: "suggest_only" },
|
|
489
|
-
afterRun: { kind: "none" },
|
|
490
|
-
reliability: {
|
|
491
|
-
timeoutSeconds: 300,
|
|
492
|
-
disableAfterConsecutiveFailures: 1
|
|
493
|
-
}
|
|
494
|
-
});
|
|
495
|
-
automationId = automation.id;
|
|
496
|
-
const run = await deps.service.automationServiceInstance.runNow(automation.id);
|
|
497
|
-
await focuses.recordInsightFeedback(insight.watchId, true);
|
|
498
|
-
return c.json({
|
|
499
|
-
ok: true,
|
|
500
|
-
automationId: automation.id,
|
|
501
|
-
runId: run.id
|
|
502
|
-
}, 202);
|
|
503
|
-
} catch (error) {
|
|
504
|
-
if (automationId) await deps.service.automationServiceInstance.remove(automationId);
|
|
505
|
-
setProactiveInsightStatus(insight.id, "unread", Date.now(), "approved");
|
|
506
|
-
return c.json({
|
|
507
|
-
ok: false,
|
|
508
|
-
error: error instanceof Error ? error.message : String(error)
|
|
509
|
-
}, 500);
|
|
510
|
-
}
|
|
511
|
-
});
|
|
512
|
-
authenticated.post("/api/focuses/:focusId/calendar/:signalId/prepare", limited, async (c) => {
|
|
513
|
-
const focus = focuses.list().find((item) => item.id === c.req.param("focusId"));
|
|
514
|
-
if (!focus) return c.json({
|
|
515
|
-
ok: false,
|
|
516
|
-
error: "Focus not found"
|
|
517
|
-
}, 404);
|
|
518
|
-
const signal = listFocusCalendarSignals([focus]).find((item) => item.id === c.req.param("signalId"));
|
|
519
|
-
if (!signal) return c.json({
|
|
520
|
-
ok: false,
|
|
521
|
-
error: "Calendar event not found"
|
|
522
|
-
}, 404);
|
|
523
|
-
const eventContext = `${signal.title} at ${new Date(signal.startsAt).toISOString()}`;
|
|
524
|
-
try {
|
|
525
|
-
const result = await focuses.activateTrial({
|
|
526
|
-
threadId: focus.id,
|
|
527
|
-
kind: "deadline",
|
|
528
|
-
eventContext
|
|
529
|
-
});
|
|
530
|
-
return c.json({
|
|
531
|
-
ok: true,
|
|
532
|
-
...result
|
|
533
|
-
});
|
|
534
|
-
} catch (error) {
|
|
535
|
-
return c.json({
|
|
536
|
-
ok: false,
|
|
537
|
-
error: error instanceof Error ? error.message : String(error)
|
|
538
|
-
}, 500);
|
|
539
|
-
}
|
|
540
|
-
});
|
|
541
302
|
authenticated.post("/api/work-discovery/runs/:runId/cancel", (c) => {
|
|
542
303
|
const run = service.cancelRun(c.req.param("runId"));
|
|
543
304
|
return run ? c.json({
|
|
@@ -68,7 +68,7 @@ export declare class GatewayService {
|
|
|
68
68
|
private connectedKnowledgeCoordinator;
|
|
69
69
|
private stopAutomationProductEventBridge;
|
|
70
70
|
private stopSessionTranscriptAutomationEvents;
|
|
71
|
-
private
|
|
71
|
+
private stopFocusReconciler;
|
|
72
72
|
/**
|
|
73
73
|
* Webchat agent invocation surface (`runAgent`, `abortAgentRun`, `steer*`,
|
|
74
74
|
* `submitClarifyResponse`, clarify-bridge dispatch). Owns the
|
|
@@ -46,14 +46,12 @@ import { startConnectedKnowledgeCoordinator } from "../knowledge/coordinator.js"
|
|
|
46
46
|
import "../knowledge/index.js";
|
|
47
47
|
import { startConnectorLearningCoordinator } from "../connectors/learning-coordinator.js";
|
|
48
48
|
import { startConnectorSupervisor } from "../connectors/supervisor.js";
|
|
49
|
-
import {
|
|
50
|
-
import "../
|
|
49
|
+
import { FocusService } from "../focuses/service.js";
|
|
50
|
+
import { processFocusMonitorRun } from "../focuses/run-processor.js";
|
|
51
|
+
import { startFocusReconciler } from "../focuses/reconciler.js";
|
|
52
|
+
import "../focuses/index.js";
|
|
51
53
|
import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
|
|
52
54
|
import { reconcileDreamingAutomations } from "./dreaming-automation-reconciler.js";
|
|
53
|
-
import { FocusService } from "../proactive/focus-service.js";
|
|
54
|
-
import { processFocusAutomationRun } from "../proactive/run-processor.js";
|
|
55
|
-
import { startTrialExpiryReconciler } from "../proactive/trial-expiry-reconciler.js";
|
|
56
|
-
import "../proactive/index.js";
|
|
57
55
|
import { NotesStore } from "../notes/store.js";
|
|
58
56
|
import { buildNoteAgentContext } from "../notes/agent-context.js";
|
|
59
57
|
import { NotesService } from "../notes/service.js";
|
|
@@ -79,6 +77,8 @@ import { auditGatewayConfig } from "./security/audit.js";
|
|
|
79
77
|
import { ModelCatalogSyncService } from "../providers/model-catalog-sync-service.js";
|
|
80
78
|
import { runBootstrapMigrationsSync } from "../migrations/runner.js";
|
|
81
79
|
import { MobileNotificationService } from "../mobile/notification-service.js";
|
|
80
|
+
import { LocalAppService } from "../local-apps/service.js";
|
|
81
|
+
import "../local-apps/index.js";
|
|
82
82
|
import { createRuntimeBrowserRecipeService } from "../browser/recipes/runtime-service.js";
|
|
83
83
|
import "../browser/recipes/index.js";
|
|
84
84
|
import { scheduleGatewayUpdateCheck } from "../infra/update-startup.js";
|
|
@@ -163,7 +163,7 @@ var GatewayService = class {
|
|
|
163
163
|
connectedKnowledgeCoordinator = null;
|
|
164
164
|
stopAutomationProductEventBridge = null;
|
|
165
165
|
stopSessionTranscriptAutomationEvents = null;
|
|
166
|
-
|
|
166
|
+
stopFocusReconciler = null;
|
|
167
167
|
/**
|
|
168
168
|
* Webchat agent invocation surface (`runAgent`, `abortAgentRun`, `steer*`,
|
|
169
169
|
* `submitClarifyResponse`, clarify-bridge dispatch). Owns the
|
|
@@ -706,7 +706,7 @@ var GatewayService = class {
|
|
|
706
706
|
});
|
|
707
707
|
await trace.measure("automations.initialize", () => this.automationService.initialize());
|
|
708
708
|
await trace.measure("dreaming.reconcile", () => this.reconcileDreamingAutomations());
|
|
709
|
-
this.
|
|
709
|
+
this.stopFocusReconciler = startFocusReconciler(new FocusService(this.automationService));
|
|
710
710
|
await this.notesService.initialize();
|
|
711
711
|
this.ensureHeartbeatService().start(heartbeatRunnerConfigFromConfig(this.config));
|
|
712
712
|
this.connectorSupervisor = startConnectorSupervisor({
|
|
@@ -866,8 +866,8 @@ var GatewayService = class {
|
|
|
866
866
|
this.lastChannelConnectDeferMode = "auto";
|
|
867
867
|
this.lastChannelConnectDeferSource = "off";
|
|
868
868
|
await this.channelManager.stop();
|
|
869
|
-
await this.
|
|
870
|
-
this.
|
|
869
|
+
await this.stopFocusReconciler?.();
|
|
870
|
+
this.stopFocusReconciler = null;
|
|
871
871
|
await this.automationService.stop();
|
|
872
872
|
this.stopAutomationProductEventBridge?.();
|
|
873
873
|
this.stopAutomationProductEventBridge = null;
|
|
@@ -1273,12 +1273,16 @@ var GatewayService = class {
|
|
|
1273
1273
|
}
|
|
1274
1274
|
handleAutomationRunCompleted(run) {
|
|
1275
1275
|
try {
|
|
1276
|
-
const
|
|
1276
|
+
const focusResult = processFocusMonitorRun(run);
|
|
1277
1277
|
this.emit("automation.run.completed", {
|
|
1278
1278
|
run,
|
|
1279
|
-
silent:
|
|
1279
|
+
silent: focusResult.handled
|
|
1280
|
+
});
|
|
1281
|
+
if (focusResult.handled) this.emit("focus.run.updated", {
|
|
1282
|
+
automationId: run.automationId,
|
|
1283
|
+
run
|
|
1280
1284
|
});
|
|
1281
|
-
if (
|
|
1285
|
+
if (focusResult.insight) this.emit("focus.insight.created", { insight: focusResult.insight });
|
|
1282
1286
|
} catch (err) {
|
|
1283
1287
|
log.warn({
|
|
1284
1288
|
err,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_ACK_MAX_CHARS, HEARTBEAT_OK, NO_REPLY, shouldSilence, stripHeartbeatToken } from "./tokens.js";
|
|
2
|
+
import { appendCronEventLines } from "./event-prompt.js";
|
|
2
3
|
import { isWithinActiveHours } from "./active-hours.js";
|
|
3
4
|
import { isHeartbeatContentEmpty } from "./content-check.js";
|
|
4
|
-
import { appendCronEventLines } from "./event-prompt.js";
|
|
5
5
|
import { createHeartbeatWake } from "./wake.js";
|
|
6
6
|
export { DEFAULT_ACK_MAX_CHARS, HEARTBEAT_OK, NO_REPLY, appendCronEventLines, createHeartbeatWake, isHeartbeatContentEmpty, isWithinActiveHours, shouldSilence, stripHeartbeatToken };
|
|
@@ -2,9 +2,9 @@ import { createLogger } from "../utils/logger/index.js";
|
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
3
|
import { init_loader, loadConfig } from "../config/loader.js";
|
|
4
4
|
import { gatewayCredentialAuthorization } from "../gateway/credential.js";
|
|
5
|
+
import { loadUndiciRuntimeDeps } from "../infra/undici-fetch.js";
|
|
5
6
|
import { toConversation } from "./channel-shared.js";
|
|
6
7
|
import { createGatewayHttpClientFromConfig, resolveGatewayHttpBaseUrl } from "./gateway-http-client.js";
|
|
7
|
-
import { loadUndiciRuntimeDeps } from "../infra/undici-fetch.js";
|
|
8
8
|
//#region src/mcp/channel-bridge.ts
|
|
9
9
|
init_loader();
|
|
10
10
|
init_logger();
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
DROP TABLE IF EXISTS proactive_insights;
|
|
2
|
+
DROP TABLE IF EXISTS focus_watches;
|
|
3
|
+
DROP TABLE IF EXISTS work_understanding_thread_feedback;
|
|
4
|
+
DROP TABLE IF EXISTS work_understanding_thread_evidence;
|
|
5
|
+
DROP TABLE IF EXISTS work_understanding_thread_projects;
|
|
6
|
+
DROP TABLE IF EXISTS work_understanding_threads;
|
|
7
|
+
|
|
8
|
+
CREATE TABLE focus_candidates (
|
|
9
|
+
candidate_id TEXT PRIMARY KEY,
|
|
10
|
+
canonical_key TEXT NOT NULL UNIQUE,
|
|
11
|
+
title TEXT NOT NULL,
|
|
12
|
+
summary TEXT NOT NULL,
|
|
13
|
+
confidence REAL NOT NULL CHECK (confidence >= 0 AND confidence <= 1),
|
|
14
|
+
evidence_json TEXT NOT NULL DEFAULT '[]',
|
|
15
|
+
status TEXT NOT NULL CHECK (status IN ('pending', 'accepted', 'dismissed')),
|
|
16
|
+
discovered_at INTEGER NOT NULL,
|
|
17
|
+
updated_at INTEGER NOT NULL
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
CREATE TABLE focus_candidate_projects (
|
|
21
|
+
candidate_id TEXT NOT NULL,
|
|
22
|
+
project_id TEXT NOT NULL,
|
|
23
|
+
created_at INTEGER NOT NULL,
|
|
24
|
+
PRIMARY KEY (candidate_id, project_id),
|
|
25
|
+
FOREIGN KEY (candidate_id) REFERENCES focus_candidates(candidate_id) ON DELETE CASCADE,
|
|
26
|
+
FOREIGN KEY (project_id) REFERENCES projects(project_id) ON DELETE CASCADE
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
CREATE TABLE focuses (
|
|
30
|
+
focus_id TEXT PRIMARY KEY,
|
|
31
|
+
title TEXT NOT NULL,
|
|
32
|
+
summary TEXT NOT NULL,
|
|
33
|
+
status TEXT NOT NULL CHECK (status IN ('active', 'paused', 'completed')),
|
|
34
|
+
source TEXT NOT NULL CHECK (source IN ('user', 'discovery')),
|
|
35
|
+
source_candidate_id TEXT,
|
|
36
|
+
goal_id TEXT,
|
|
37
|
+
created_at INTEGER NOT NULL,
|
|
38
|
+
updated_at INTEGER NOT NULL,
|
|
39
|
+
completed_at INTEGER,
|
|
40
|
+
last_activity_at INTEGER,
|
|
41
|
+
FOREIGN KEY (source_candidate_id) REFERENCES focus_candidates(candidate_id) ON DELETE SET NULL,
|
|
42
|
+
FOREIGN KEY (goal_id) REFERENCES goals(goal_id) ON DELETE SET NULL
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
CREATE TABLE focus_projects (
|
|
46
|
+
focus_id TEXT NOT NULL,
|
|
47
|
+
project_id TEXT NOT NULL,
|
|
48
|
+
created_at INTEGER NOT NULL,
|
|
49
|
+
PRIMARY KEY (focus_id, project_id),
|
|
50
|
+
FOREIGN KEY (focus_id) REFERENCES focuses(focus_id) ON DELETE CASCADE,
|
|
51
|
+
FOREIGN KEY (project_id) REFERENCES projects(project_id) ON DELETE CASCADE
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
CREATE TABLE focus_monitors (
|
|
55
|
+
monitor_id TEXT PRIMARY KEY,
|
|
56
|
+
focus_id TEXT NOT NULL,
|
|
57
|
+
kind TEXT NOT NULL CHECK (kind IN ('progress', 'external_changes')),
|
|
58
|
+
enabled INTEGER NOT NULL DEFAULT 0 CHECK (enabled IN (0, 1)),
|
|
59
|
+
run_state TEXT NOT NULL DEFAULT 'idle' CHECK (run_state IN ('idle', 'queued', 'running', 'failed')),
|
|
60
|
+
cadence_json TEXT NOT NULL,
|
|
61
|
+
automation_id TEXT,
|
|
62
|
+
last_run_id TEXT,
|
|
63
|
+
last_run_at INTEGER,
|
|
64
|
+
next_run_at INTEGER,
|
|
65
|
+
last_meaningful_result_at INTEGER,
|
|
66
|
+
last_error TEXT,
|
|
67
|
+
consecutive_failures INTEGER NOT NULL DEFAULT 0,
|
|
68
|
+
created_at INTEGER NOT NULL,
|
|
69
|
+
updated_at INTEGER NOT NULL,
|
|
70
|
+
UNIQUE (focus_id, kind),
|
|
71
|
+
FOREIGN KEY (focus_id) REFERENCES focuses(focus_id) ON DELETE CASCADE,
|
|
72
|
+
FOREIGN KEY (automation_id) REFERENCES automations(automation_id) ON DELETE SET NULL
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
CREATE TABLE focus_activities (
|
|
76
|
+
activity_id TEXT PRIMARY KEY,
|
|
77
|
+
focus_id TEXT NOT NULL,
|
|
78
|
+
monitor_id TEXT,
|
|
79
|
+
type TEXT NOT NULL CHECK (type IN (
|
|
80
|
+
'created', 'updated', 'paused', 'resumed', 'completed',
|
|
81
|
+
'monitor_enabled', 'monitor_disabled', 'run_started', 'run_no_change',
|
|
82
|
+
'run_failed', 'insight_created', 'insight_dismissed', 'insight_approved'
|
|
83
|
+
)),
|
|
84
|
+
summary TEXT NOT NULL,
|
|
85
|
+
details_json TEXT NOT NULL DEFAULT '{}',
|
|
86
|
+
created_at INTEGER NOT NULL,
|
|
87
|
+
FOREIGN KEY (focus_id) REFERENCES focuses(focus_id) ON DELETE CASCADE,
|
|
88
|
+
FOREIGN KEY (monitor_id) REFERENCES focus_monitors(monitor_id) ON DELETE SET NULL
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
CREATE TABLE focus_insights (
|
|
92
|
+
insight_id TEXT PRIMARY KEY,
|
|
93
|
+
focus_id TEXT NOT NULL,
|
|
94
|
+
monitor_id TEXT NOT NULL,
|
|
95
|
+
run_id TEXT NOT NULL,
|
|
96
|
+
kind TEXT NOT NULL CHECK (kind IN ('progress', 'external_changes')),
|
|
97
|
+
title TEXT NOT NULL,
|
|
98
|
+
summary TEXT NOT NULL,
|
|
99
|
+
why_it_matters TEXT NOT NULL,
|
|
100
|
+
next_action TEXT NOT NULL,
|
|
101
|
+
evidence_json TEXT NOT NULL,
|
|
102
|
+
content_hash TEXT NOT NULL,
|
|
103
|
+
status TEXT NOT NULL CHECK (status IN ('unread', 'dismissed', 'approved')),
|
|
104
|
+
value_score REAL NOT NULL DEFAULT 0,
|
|
105
|
+
value_reasons_json TEXT NOT NULL DEFAULT '[]',
|
|
106
|
+
created_at INTEGER NOT NULL,
|
|
107
|
+
updated_at INTEGER NOT NULL,
|
|
108
|
+
UNIQUE (monitor_id, content_hash),
|
|
109
|
+
FOREIGN KEY (focus_id) REFERENCES focuses(focus_id) ON DELETE CASCADE,
|
|
110
|
+
FOREIGN KEY (monitor_id) REFERENCES focus_monitors(monitor_id) ON DELETE CASCADE
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
CREATE INDEX idx_focus_candidates_status
|
|
114
|
+
ON focus_candidates(status, updated_at DESC);
|
|
115
|
+
CREATE INDEX idx_focuses_status_activity
|
|
116
|
+
ON focuses(status, last_activity_at DESC, updated_at DESC);
|
|
117
|
+
CREATE UNIQUE INDEX idx_focuses_source_candidate
|
|
118
|
+
ON focuses(source_candidate_id) WHERE source_candidate_id IS NOT NULL;
|
|
119
|
+
CREATE INDEX idx_focus_monitors_focus
|
|
120
|
+
ON focus_monitors(focus_id, enabled, updated_at DESC);
|
|
121
|
+
CREATE INDEX idx_focus_monitors_automation
|
|
122
|
+
ON focus_monitors(automation_id);
|
|
123
|
+
CREATE INDEX idx_focus_activities_focus
|
|
124
|
+
ON focus_activities(focus_id, created_at DESC);
|
|
125
|
+
CREATE INDEX idx_focus_insights_focus
|
|
126
|
+
ON focus_insights(focus_id, status, created_at DESC);
|
|
@@ -3,7 +3,7 @@ import type { ApplyMigrationsOptions } from './types.js';
|
|
|
3
3
|
/** Baseline schema version applied from schema.sql on first open. */
|
|
4
4
|
export declare const XOPC_DB_BASELINE_SCHEMA_VERSION = 11;
|
|
5
5
|
/** Latest schema version this release supports (increment when adding migrations). */
|
|
6
|
-
export declare const XOPC_DB_SCHEMA_VERSION =
|
|
6
|
+
export declare const XOPC_DB_SCHEMA_VERSION = 66;
|
|
7
7
|
export declare function resolveMigrationsDir(override?: string): string;
|
|
8
8
|
/**
|
|
9
9
|
* Apply sequential SQL migrations from (currentVersion + 1) through targetVersion.
|
|
@@ -12,7 +12,7 @@ const log = createLogger("Sqlite:Migrations");
|
|
|
12
12
|
/** Baseline schema version applied from schema.sql on first open. */
|
|
13
13
|
const XOPC_DB_BASELINE_SCHEMA_VERSION = 11;
|
|
14
14
|
/** Latest schema version this release supports (increment when adding migrations). */
|
|
15
|
-
const XOPC_DB_SCHEMA_VERSION =
|
|
15
|
+
const XOPC_DB_SCHEMA_VERSION = 66;
|
|
16
16
|
const MODULE_DIR = dirname(fileURLToPath(import.meta.url));
|
|
17
17
|
function resolveMigrationsDir(override) {
|
|
18
18
|
if (override) return override;
|
|
@@ -46,7 +46,7 @@ function applySingleMigration(db, migration) {
|
|
|
46
46
|
* Each step runs in its own transaction and updates schema_meta on success.
|
|
47
47
|
*/
|
|
48
48
|
function applyPendingMigrations(db, options = {}) {
|
|
49
|
-
const targetVersion = options.targetVersion ??
|
|
49
|
+
const targetVersion = options.targetVersion ?? 66;
|
|
50
50
|
let currentVersion = readSchemaVersion(db);
|
|
51
51
|
if (currentVersion > targetVersion) throw new DatabaseSchemaTooNewError(currentVersion, targetVersion);
|
|
52
52
|
if (currentVersion >= targetVersion) return currentVersion;
|
|
@@ -62,7 +62,7 @@ function applyPendingMigrations(db, options = {}) {
|
|
|
62
62
|
}
|
|
63
63
|
/** Inspect schema version without mutating the database. */
|
|
64
64
|
function inspectSchemaMigrationStatus(db, options = {}) {
|
|
65
|
-
const appVersion = options.targetVersion ??
|
|
65
|
+
const appVersion = options.targetVersion ?? 66;
|
|
66
66
|
const dbVersion = readSchemaVersion(db);
|
|
67
67
|
if (dbVersion > appVersion) return {
|
|
68
68
|
dbVersion,
|
|
@@ -19,7 +19,7 @@ const log = createLogger('Sqlite:Migrations');
|
|
|
19
19
|
export const XOPC_DB_BASELINE_SCHEMA_VERSION = 11;
|
|
20
20
|
|
|
21
21
|
/** Latest schema version this release supports (increment when adding migrations). */
|
|
22
|
-
export const XOPC_DB_SCHEMA_VERSION =
|
|
22
|
+
export const XOPC_DB_SCHEMA_VERSION = 66;
|
|
23
23
|
|
|
24
24
|
const MODULE_DIR = dirname(fileURLToPath(import.meta.url));
|
|
25
25
|
|
|
@@ -31,7 +31,7 @@ function ensureXopcDatabaseSchema(db) {
|
|
|
31
31
|
bootstrapFreshDatabase(db);
|
|
32
32
|
currentVersion = 11;
|
|
33
33
|
}
|
|
34
|
-
applyPendingMigrations(db, { targetVersion:
|
|
34
|
+
applyPendingMigrations(db, { targetVersion: 66 });
|
|
35
35
|
}
|
|
36
36
|
//#endregion
|
|
37
37
|
export { SCHEMA_META_SCHEMA_VERSION_KEY, XOPC_DB_BASELINE_SCHEMA_VERSION, XOPC_DB_SCHEMA_VERSION, ensureSchemaMetaTable, ensureXopcDatabaseSchema, readSchemaVersion, readSchemaVersionForTest, setSchemaVersion };
|
|
@@ -9,7 +9,5 @@ export * from './investigation-repository.js';
|
|
|
9
9
|
export * from './investigator.js';
|
|
10
10
|
export * from './incremental.js';
|
|
11
11
|
export * from './incremental-repository.js';
|
|
12
|
-
export * from './governance.js';
|
|
13
12
|
export * from './evaluation.js';
|
|
14
|
-
export * from './thread-repository.js';
|
|
15
13
|
export * from './thread-service.js';
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { addWorkUnderstandingThreadFeedback, attachWorkUnderstandingThreadEvidence, getWorkUnderstandingThread, getWorkUnderstandingThreadByCanonicalKey, listWorkUnderstandingThreads, upsertWorkUnderstandingThread } from "./thread-repository.js";
|
|
2
1
|
import { WORK_DISCOVERY_SCAN_POLICY_VERSION, canonicalWorkDiscoveryRoot, previewWorkDiscoveryRoot, probeWorkDiscoveryRoot, readWorkDiscoveryTextExcerpt, searchWorkDiscoveryText, summarizeWorkContextSnapshot } from "./probe.js";
|
|
3
2
|
import { analyzePersonalContext, analyzeWorkContext, workDiscoveryResultMarkdown } from "./analyzer.js";
|
|
4
3
|
import { discoverWorkCandidates } from "./candidate-discovery.js";
|
|
5
|
-
import { deleteWorkUnderstandingDerivedData, getWorkUnderstandingMetrics, getWorkUnderstandingSourceLineage } from "./governance.js";
|
|
6
4
|
import { workDiscoveryFingerprintsEqual } from "./incremental.js";
|
|
7
5
|
import { findActiveWorkDiscoverySourceRefresh, listWorkDiscoverySourceRefreshes, recordWorkDiscoverySourceRefresh, updateWorkDiscoverySourceRefreshForRun } from "./incremental-repository.js";
|
|
8
6
|
import { appendWorkUnderstandingEvidence, createWorkUnderstandingInvestigation, getWorkUnderstandingInvestigation, getWorkUnderstandingInvestigationForRun, listWorkUnderstandingEvidence, resetWorkUnderstandingInvestigation, updateWorkUnderstandingEvidenceObservation, updateWorkUnderstandingInvestigation } from "./investigation-repository.js";
|
|
@@ -12,4 +10,4 @@ import { createWorkDiscoveryRun, getWorkDiscoveryOnboardingState, getWorkDiscove
|
|
|
12
10
|
import { getWorkDiscoveryDirectorySource, listWorkDiscoveryDirectorySources, revokeWorkDiscoveryDirectorySource, upsertWorkDiscoveryDirectorySource } from "./source-repository.js";
|
|
13
11
|
import { WorkDiscoveryService } from "./service.js";
|
|
14
12
|
import { evaluateWorkUnderstandingCase } from "./evaluation.js";
|
|
15
|
-
export { DEFAULT_WORK_INVESTIGATION_BUDGET, WORK_DISCOVERY_SCAN_POLICY_VERSION, WorkDiscoveryService,
|
|
13
|
+
export { DEFAULT_WORK_INVESTIGATION_BUDGET, WORK_DISCOVERY_SCAN_POLICY_VERSION, WorkDiscoveryService, analyzePersonalContext, analyzeWorkContext, appendWorkUnderstandingEvidence, canonicalWorkDiscoveryRoot, createWorkDiscoveryRun, createWorkUnderstandingInvestigation, discoverWorkCandidates, evaluateWorkUnderstandingCase, findActiveWorkDiscoverySourceRefresh, getWorkDiscoveryDirectorySource, getWorkDiscoveryOnboardingState, getWorkDiscoveryRun, getWorkDiscoveryRunByIdempotencyKey, getWorkUnderstandingInvestigation, getWorkUnderstandingInvestigationForRun, investigateWorkContext, listWorkDiscoveryDirectorySources, listWorkDiscoverySourceRefreshes, listWorkUnderstandingEvidence, persistWorkThreadsFromDiscovery, previewWorkDiscoveryRoot, probeWorkDiscoveryRoot, readWorkDiscoveryTextExcerpt, recordWorkDiscoverySourceRefresh, resetWorkUnderstandingInvestigation, revokeWorkDiscoveryDirectorySource, searchWorkDiscoveryText, setWorkDiscoveryFeedback, setWorkDiscoveryOnboardingState, summarizeWorkContextSnapshot, updateWorkDiscoveryRun, updateWorkDiscoverySourceRefreshForRun, updateWorkUnderstandingEvidenceObservation, updateWorkUnderstandingInvestigation, upsertWorkDiscoveryDirectorySource, workDiscoveryFingerprintsEqual, workDiscoveryResultMarkdown };
|
|
@@ -22,36 +22,6 @@ export declare class WorkDiscoveryService {
|
|
|
22
22
|
investigation: import("./types.js").WorkUnderstandingInvestigation;
|
|
23
23
|
evidence: import("./types.js").WorkUnderstandingEvidenceItem[];
|
|
24
24
|
};
|
|
25
|
-
listWorkThreads(options?: {
|
|
26
|
-
projectId?: string;
|
|
27
|
-
includeRejected?: boolean;
|
|
28
|
-
limit?: number;
|
|
29
|
-
}): import("./types.js").WorkUnderstandingThread[];
|
|
30
|
-
getWorkThread(id: string): import("./types.js").WorkUnderstandingThread;
|
|
31
|
-
getSourceLineage(sourceId: string): import("./governance.js").WorkUnderstandingSourceLineage;
|
|
32
|
-
deleteSourceDerivedData(sourceId: string): {
|
|
33
|
-
deletedMemoryRecords: number;
|
|
34
|
-
evidenceCount: number | bigint;
|
|
35
|
-
deletedThreads: number;
|
|
36
|
-
retainedThreads: number;
|
|
37
|
-
};
|
|
38
|
-
getUnderstandingMetrics(): {
|
|
39
|
-
completedInvestigations: number;
|
|
40
|
-
averageToolCalls: number;
|
|
41
|
-
activeThreads: number;
|
|
42
|
-
confirmedThreads: number;
|
|
43
|
-
recognitionConfirmationRate: number;
|
|
44
|
-
evidenceBySource: {
|
|
45
|
-
sourceType: string;
|
|
46
|
-
count: number;
|
|
47
|
-
}[];
|
|
48
|
-
};
|
|
49
|
-
updateWorkThread(input: {
|
|
50
|
-
id: string;
|
|
51
|
-
decision: 'confirmed' | 'corrected' | 'rejected' | 'paused' | 'completed';
|
|
52
|
-
correctedTitle?: string;
|
|
53
|
-
correctedSummary?: string;
|
|
54
|
-
}): import("./types.js").WorkUnderstandingThread;
|
|
55
25
|
discoverCandidates(signal?: AbortSignal): Promise<WorkDiscoveryCandidate[]>;
|
|
56
26
|
listDirectorySources(): import("./types.js").WorkDiscoveryDirectorySource[];
|
|
57
27
|
grantDirectorySource(rootPath: string): Promise<import("./types.js").WorkDiscoveryDirectorySource>;
|