@xopcai/xopc 0.0.330 → 0.0.332
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/{agent-avatar-dicebear-BDG0hI-J.js → agent-avatar-dicebear-C2wg3xC_.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-Se1Z72VG.js +1 -0
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-BX_Bhre1.js → agent-plugin-dialog-BeNnu1Ts.js} +1 -1
- package/dist/gateway/static/root/assets/agents-udIitwV8.js +70 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DgttzUCG.js → app-management-settings-panel-etFSkfzl.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CHpyWV8Z.js → appearance-settings-DKmU2VAP.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-DVNySL58.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-B7Q7Oeo7.js → archive-plugin-D0z_Fr2G.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-BYwqQ8qN.js → attachment-load-DNCDbeOX.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CsvAtTNd.js → automations-page-B7_C-p66.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BMgJvdcv.js +7 -0
- package/dist/gateway/static/root/assets/{binary-plugins-DdgWCI-M.js → binary-plugins-BYn2hScX.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DyOagNnn.js → block-editor-ChWW8Z9L.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-CwF8OQFN.js → browser-automation-inputs-C5s1yHOu.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-D_EQjiiu.js → browser-automations-page-BV00BXRb.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-xwTmuZjS.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-CHA-sTAZ.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-page-v0WkhV5o.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DefBGjhV.js +8 -0
- package/dist/gateway/static/root/assets/{capability-header-actions-C5F2GNE9.js → capability-header-actions-vmx35sbu.js} +1 -1
- package/dist/gateway/static/root/assets/channels-Eo4ONF5X.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-C6tl9Rfw.js → chat-terminal-dock-C41mXCAi.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-C0MsVw4l.js → computer-settings-page-BJkqok2G.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-DsF60pPs.js → connector-service-page-BKCZMmwm.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-DZYgogQw.js +2 -0
- package/dist/gateway/static/root/assets/{date-picker-CELKKqYN.js → date-picker-CrOV4Ynd.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-BcEwCnI5.js → dependency-picker-CqADAHZp.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-Ww7Gm8-x.js → desktop-pet-Bab-iWED.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-D-dbAxGu.js → desktop-pet-settings-BqgzLOdi.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-DsYY6szg.js → device-pairing-wizard-DFg7FDPf.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-CVmuCRyO.js → directory-picker-path-field-hqJ9sFCR.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-UUHNJj-d.js → extension-debug-page-DX3PFhRE.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BvL452mX.js → extension-page-DkREdHLs.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CrNnUSOs.js → extension-settings-page-wF-HNTM-.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-DMm1vU51.js → gateway-config-swr-cR-tz7-Q.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-Du-Dos9O.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-Ck6tj6yE.js → gateway-startup-retry-6jLRcQsu.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-D7YoMHq4.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-BOh6j0BF.js → image-generation-api-CSSkwsyC.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-BuqdzA7h.js → imports-page-B80Cv043.js} +1 -1
- package/dist/gateway/static/root/assets/index-BEw0xrde.css +1 -0
- package/dist/gateway/static/root/assets/index-DalslRUx.js +121 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-D9L7IdUg.js → keyboard-shortcuts-settings-BgoFaTwv.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-BKL5UZAj.js +1 -0
- package/dist/gateway/static/root/assets/local-apps-page-HO6OQlQT.js +1 -0
- package/dist/gateway/static/root/assets/{locale-store-DAOwT3Zp.js → locale-store-wNXWkWu5.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-CjzR9Rpj.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-Dk_gTJb9.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-nL4xzvI8.js → markdown-view-DlT9KqwF.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-dHbcqMan.js → media-plugins-Dlj6TD3M.js} +1 -1
- package/dist/gateway/static/root/assets/messages-fmf0dnr4.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-BebJPjjk.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-CmS_hvz8.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-BKsMcPOy.js → page-context-capture-button-BArPtqp5.js} +1 -1
- package/dist/gateway/static/root/assets/page-tabs-vqI30Yrg.js +1 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Du18QgWc.js → preview-open-alternatives-B-mwPBJW.js} +1 -1
- package/dist/gateway/static/root/assets/product-open-page-D--sj_uN.js +1 -0
- package/dist/gateway/static/root/assets/project-detail-page-BFUdtWXF.js +1 -0
- package/dist/gateway/static/root/assets/{projects-page-BdYbDNUn.js → projects-page-DBsBwAQ6.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-DCFXWBOt.js → registry-api-BIpltJ47.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BurdDY0m.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CuTFmXyj.js → runtime-tools-settings-panel-CAnb0PNY.js} +1 -1
- package/dist/gateway/static/root/assets/scenes-page-Cj8xtr5t.js +2 -0
- package/dist/gateway/static/root/assets/{schema-form-qWQii8IU.js → schema-form-BKj6wIMb.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-BCsjgkCs.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BLL7csOJ.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-B0ZBr0L9.js → settings-form-section-78ycUHfv.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DpII4NO3.js → settings-page-BOdxIVzo.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-CbKHBjrU.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-B2CGYZHc.js → share-preview-page-DyLfktib.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-BzvSNouj.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-_ddww47C.js → skill-api-CiBGQ0Jg.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BHnru0F5.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-C35VKjhb.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-25ABVt7H.js → system-settings-panel-CyJUeREH.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-Bd1_Fguk.js +1 -0
- package/dist/gateway/static/root/assets/{tunnel-api-CwQGBI_4.js → tunnel-api-Day9zhKi.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-CL3wytbs.js → use-autosave-Bj9hC6ML.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-DuYzuR1T.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-zjAzQrx4.js → voice-api-key-field-fWRD6B8r.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-DvzQ-128.js → voice-config-api-ujEySjyc.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-MaPPjWwl.js → work-discovery-overlay-CnxdvIk8.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-C3dQN1fE.js → workflow-run-setup-panel-DlWNN1VA.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-B45YDiEw.js +6 -0
- package/dist/gateway/static/root/index.html +9 -9
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/automations.js +15 -0
- package/dist/src/agent/orchestration/agent-orchestrator.js +0 -21
- package/dist/src/automations/capabilities/write.d.ts +17 -0
- package/dist/src/automations/capabilities/write.js +26 -2
- package/dist/src/automations/domain/defaults.js +1 -1
- package/dist/src/automations/domain/index.js +2 -2
- package/dist/src/automations/domain/types.d.ts +22 -0
- package/dist/src/automations/domain/validation.d.ts +68 -0
- package/dist/src/automations/domain/validation.js +17 -1
- package/dist/src/automations/draft/automation-draft-validator.d.ts +9 -0
- package/dist/src/automations/draft/automation-draft-validator.js +1 -0
- package/dist/src/automations/index.js +2 -2
- package/dist/src/automations/service/action-executor.js +16 -0
- package/dist/src/automations/storage/automation-repository.js +4 -3
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/config/schema.d.ts +4 -0
- package/dist/src/config/schema.js +4 -0
- package/dist/src/gateway/home-intelligence-automation-reconciler.d.ts +3 -0
- package/dist/src/gateway/home-intelligence-automation-reconciler.js +49 -0
- package/dist/src/gateway/hono/routes/config-patch/misc.js +16 -2
- package/dist/src/gateway/hono/routes/home.js +0 -1
- package/dist/src/gateway/hono/routes/update.js +6 -1
- package/dist/src/gateway/memory-maintenance-automation-reconciler.js +17 -14
- package/dist/src/gateway/service.d.ts +1 -0
- package/dist/src/gateway/service.js +35 -13
- package/dist/src/home-intelligence/host.d.ts +1 -1
- package/dist/src/home-intelligence/host.js +2 -10
- package/dist/src/home-intelligence/notification.js +1 -1
- package/dist/src/home-intelligence/repository.d.ts +1 -1
- package/dist/src/infra/update-check.d.ts +8 -4
- package/dist/src/infra/update-check.js +43 -41
- package/dist/src/infra/update-startup.d.ts +7 -1
- package/dist/src/infra/update-startup.js +15 -6
- package/dist/src/memory-maintenance/index.js +2 -2
- package/dist/src/memory-maintenance/schedule.d.ts +0 -3
- package/dist/src/memory-maintenance/schedule.js +1 -8
- package/dist/src/storage/sqlite/migrations/208_automation_management.sql +2 -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/schema.js +1 -1
- package/dist/src/tasks/home-query-service.js +1 -0
- package/dist/src/user-context/config.d.ts +9 -0
- package/dist/src/user-context/config.js +13 -4
- package/package.json +2 -2
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-ArM6Sm9S.js +0 -1
- package/dist/gateway/static/root/assets/agents-BiQqpMw0.js +0 -70
- package/dist/gateway/static/root/assets/apps-page-BhfYQcm8.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-DMH_1Ped.js +0 -7
- package/dist/gateway/static/root/assets/browser-settings-page-BE6691Jz.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-page-MweWNrC1.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-sAZT4brT.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CdSWkh89.js +0 -8
- package/dist/gateway/static/root/assets/channels-NGfwR3He.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-BE8NdQcR.js +0 -2
- package/dist/gateway/static/root/assets/gateway-settings-DrHhtZqv.js +0 -1
- package/dist/gateway/static/root/assets/home-page-YgI6jfGA.js +0 -1
- package/dist/gateway/static/root/assets/index-DJmO2VAY.css +0 -1
- package/dist/gateway/static/root/assets/index-vCIBfJp7.js +0 -121
- package/dist/gateway/static/root/assets/local-app-workbench-page-DO8uUtos.js +0 -1
- package/dist/gateway/static/root/assets/local-apps-page-BEvyufm7.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-Jev1m9sS.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-41i7B1RO.js +0 -1
- package/dist/gateway/static/root/assets/messages-BZbt9x1y.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-DonP0E6Q.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-CYHMeVKo.js +0 -8
- package/dist/gateway/static/root/assets/product-open-page-IY1QL6s0.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-Bpw9mxfV.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CLhbz3TF.js +0 -1
- package/dist/gateway/static/root/assets/scenes-page-XwK2IEmr.js +0 -2
- package/dist/gateway/static/root/assets/sessions-page-4-QoiDES.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BggQVM1y.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-HPpC7EE0.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DhVCRYGP.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-XPZkWJJe.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-uF7DkJMC.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-gepxhO4j.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-DldQW9Wh.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-B9lnTU3U.js +0 -6
|
@@ -38,6 +38,8 @@ import { ProjectService } from "../projects/project-service.js";
|
|
|
38
38
|
import { resolveProjectAgentId } from "../projects/project-agent.js";
|
|
39
39
|
import "../projects/index.js";
|
|
40
40
|
import { resolveEffectiveGatewayPort } from "./host.js";
|
|
41
|
+
import { runMemoryMaintenance } from "../memory-maintenance/service.js";
|
|
42
|
+
import "../memory-maintenance/index.js";
|
|
41
43
|
import { RealtimeExtensionBrowserProvider } from "../browser/providers/realtime-extension.js";
|
|
42
44
|
import { onSessionTranscriptUpdate } from "../session/transcript-events.js";
|
|
43
45
|
import { buildNoteAgentContext } from "../notes/agent-context.js";
|
|
@@ -72,28 +74,25 @@ import { ChatPreviewService } from "../chat-previews/service.js";
|
|
|
72
74
|
import "../chat-previews/index.js";
|
|
73
75
|
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
74
76
|
import "../config/index.js";
|
|
75
|
-
import { DiscussionService } from "../discussions/service.js";
|
|
76
|
-
import { DiscussionOrganizer } from "../discussions/organizer.js";
|
|
77
|
-
import { DiscussionLiveWorker } from "../discussions/live-worker.js";
|
|
78
|
-
import { DiscussionOrganizerWorker } from "../discussions/organizer-worker.js";
|
|
79
|
-
import { DiscussionSealer } from "../discussions/sealer.js";
|
|
80
|
-
import "../discussions/index.js";
|
|
81
77
|
import { ManagedComposioEventPoller } from "../connectors/composio-managed-events.js";
|
|
82
78
|
import { startConnectedKnowledgeCoordinator } from "../knowledge/coordinator.js";
|
|
83
79
|
import "../knowledge/index.js";
|
|
84
80
|
import { ConnectionRecoveryService } from "../connectors/connection-recovery-service.js";
|
|
85
81
|
import { startConnectorLearningCoordinator } from "../connectors/learning-coordinator.js";
|
|
86
82
|
import { startConnectorSupervisor } from "../connectors/supervisor.js";
|
|
83
|
+
import { DiscussionService } from "../discussions/service.js";
|
|
84
|
+
import { DiscussionOrganizer } from "../discussions/organizer.js";
|
|
85
|
+
import { DiscussionLiveWorker } from "../discussions/live-worker.js";
|
|
86
|
+
import { DiscussionOrganizerWorker } from "../discussions/organizer-worker.js";
|
|
87
|
+
import { DiscussionSealer } from "../discussions/sealer.js";
|
|
88
|
+
import "../discussions/index.js";
|
|
87
89
|
import { EndpointToolRuntime } from "../endpoint-tools/runtime.js";
|
|
88
90
|
import "../endpoint-tools/index.js";
|
|
89
|
-
import { HomeCapabilityPreflightService } from "../home-intelligence/capability-preflight.js";
|
|
90
|
-
import { HomeAdviceGenerator } from "../home-intelligence/generator.js";
|
|
91
|
-
import { HomeIntelligenceHost } from "../home-intelligence/host.js";
|
|
92
|
-
import { HomeSnapshotBuilder } from "../home-intelligence/snapshot.js";
|
|
93
91
|
import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
|
|
94
92
|
import { prepareAutomationAgentSession } from "./automation-agent-session.js";
|
|
95
93
|
import { stopTailscaleExposure } from "./tailscale-lifecycle.js";
|
|
96
94
|
import { getGatewayFileSpaceService } from "./file-space-service.js";
|
|
95
|
+
import { reconcileHomeIntelligenceAutomation } from "./home-intelligence-automation-reconciler.js";
|
|
97
96
|
import { createBackgroundTask } from "../infra/background-task.js";
|
|
98
97
|
import { buildTaskAgentContext } from "../agent/source-context/task-context.js";
|
|
99
98
|
import { buildFileAgentContext } from "../agent/source-context/file-context.js";
|
|
@@ -144,6 +143,10 @@ import { createGatewayStartupTrace } from "./startup-trace.js";
|
|
|
144
143
|
import { GatewaySceneHost } from "./scenes/host.js";
|
|
145
144
|
import { checkAppContextAccess, prepareAppContext } from "./service/app-context-access.js";
|
|
146
145
|
import { applyAutomaticVoiceLanguage, inferProductLanguageFromEnvironment, initializeVoiceDefaults } from "../voice/language-profile.js";
|
|
146
|
+
import { HomeIntelligenceHost } from "../home-intelligence/host.js";
|
|
147
|
+
import { HomeAdviceGenerator } from "../home-intelligence/generator.js";
|
|
148
|
+
import { HomeSnapshotBuilder } from "../home-intelligence/snapshot.js";
|
|
149
|
+
import { HomeCapabilityPreflightService } from "../home-intelligence/capability-preflight.js";
|
|
147
150
|
import crypto from "node:crypto";
|
|
148
151
|
//#region src/gateway/service.ts
|
|
149
152
|
init_session_repository();
|
|
@@ -726,6 +729,7 @@ var GatewayService = class {
|
|
|
726
729
|
...result.runId ? { runId: result.runId } : {}
|
|
727
730
|
};
|
|
728
731
|
},
|
|
732
|
+
executeSystemAction: (input) => this.executeSystemAutomationAction(input),
|
|
729
733
|
onRunCompleted: (run) => this.handleAutomationRunCompleted(run)
|
|
730
734
|
});
|
|
731
735
|
return this._agentService;
|
|
@@ -1089,7 +1093,7 @@ var GatewayService = class {
|
|
|
1089
1093
|
publish: (type, payload) => this.realtime.broker.publish("gateway", type, payload),
|
|
1090
1094
|
notifyOpportunity: (payload) => this.emit("home.opportunity.ready", payload),
|
|
1091
1095
|
locale: () => "en",
|
|
1092
|
-
enabled: () => this.config.userContext.enabled,
|
|
1096
|
+
enabled: () => this.config.userContext.enabled && this.config.userContext.homeIntelligence.enabled,
|
|
1093
1097
|
dispatchTaskRuns: () => this.dispatchTaskRuns()
|
|
1094
1098
|
});
|
|
1095
1099
|
await this.localApps.recoverPendingReleases();
|
|
@@ -1234,6 +1238,7 @@ var GatewayService = class {
|
|
|
1234
1238
|
...result.runId ? { runId: result.runId } : {}
|
|
1235
1239
|
};
|
|
1236
1240
|
},
|
|
1241
|
+
executeSystemAction: (input) => this.executeSystemAutomationAction(input),
|
|
1237
1242
|
onRunCompleted: (run) => this.handleAutomationRunCompleted(run)
|
|
1238
1243
|
});
|
|
1239
1244
|
this.startAutomationProductEventBridge();
|
|
@@ -1246,6 +1251,7 @@ var GatewayService = class {
|
|
|
1246
1251
|
});
|
|
1247
1252
|
});
|
|
1248
1253
|
await trace.measure("automations.initialize", () => this.automationService.initialize());
|
|
1254
|
+
await trace.measure("homeIntelligence.reconcileAutomation", () => reconcileHomeIntelligenceAutomation(this.automationService));
|
|
1249
1255
|
await trace.measure("memoryMaintenance.reconcile", () => this.reconcileMemoryMaintenanceAutomations());
|
|
1250
1256
|
await this.notesService.initialize();
|
|
1251
1257
|
this.discussionLiveWorker.start();
|
|
@@ -1700,6 +1706,21 @@ var GatewayService = class {
|
|
|
1700
1706
|
automationService: this.automationService
|
|
1701
1707
|
});
|
|
1702
1708
|
}
|
|
1709
|
+
executeSystemAutomationAction(input) {
|
|
1710
|
+
if (input.capability === "home.advisor.refresh") {
|
|
1711
|
+
const generationId = this.homeIntelligence.requestRefresh("scheduled_refresh", `automation:${input.runId}`);
|
|
1712
|
+
return { summary: generationId === "disabled" ? "Home AI suggestions are disabled" : `Home advice refresh queued: ${generationId}` };
|
|
1713
|
+
}
|
|
1714
|
+
const maintenance = this.config.userContext.userModel.maintenance;
|
|
1715
|
+
if (!this.config.userContext.enabled || !this.config.userContext.userModel.enabled || !maintenance.enabled) return { summary: "Memory maintenance is disabled" };
|
|
1716
|
+
const result = runMemoryMaintenance({
|
|
1717
|
+
jobType: input.capability.slice(7),
|
|
1718
|
+
limit: maintenance.limit,
|
|
1719
|
+
staleRetentionDays: maintenance.staleRetentionDays,
|
|
1720
|
+
evidenceThreshold: maintenance.evidenceThreshold
|
|
1721
|
+
});
|
|
1722
|
+
return { summary: `Memory maintenance completed: ${JSON.stringify(result.metrics)}` };
|
|
1723
|
+
}
|
|
1703
1724
|
get notesServiceInstance() {
|
|
1704
1725
|
return this.notesService;
|
|
1705
1726
|
}
|
|
@@ -1759,7 +1780,8 @@ var GatewayService = class {
|
|
|
1759
1780
|
const job = payload;
|
|
1760
1781
|
if (job.status === "completed" && typeof job.sourceInstanceId === "string" && typeof job.updatedAt === "string") this.homeIntelligenceHost?.sourceChanged({
|
|
1761
1782
|
sourceInstanceId: job.sourceInstanceId,
|
|
1762
|
-
revision: job.updatedAt
|
|
1783
|
+
revision: job.updatedAt,
|
|
1784
|
+
refresh: this.config.userContext.homeIntelligence.refreshOnContextChange
|
|
1763
1785
|
});
|
|
1764
1786
|
}
|
|
1765
1787
|
this.realtime.broker.publish("gateway", type, payload);
|
|
@@ -1806,7 +1828,7 @@ var GatewayService = class {
|
|
|
1806
1828
|
});
|
|
1807
1829
|
}
|
|
1808
1830
|
if (event.type.startsWith("task.")) this.emit(event.type, event.payload);
|
|
1809
|
-
if (event.type.startsWith("task.") || event.type.startsWith("project.")) {
|
|
1831
|
+
if (this.config.userContext.homeIntelligence.refreshOnContextChange && (event.type.startsWith("task.") || event.type.startsWith("project."))) {
|
|
1810
1832
|
const payload = event.payload;
|
|
1811
1833
|
const objectId = event.type.startsWith("task.") ? payload.taskId : payload.projectId;
|
|
1812
1834
|
const revision = payload.version ?? payload.revision ?? "unknown";
|
|
@@ -30,7 +30,6 @@ export declare class HomeIntelligenceHost {
|
|
|
30
30
|
private timer?;
|
|
31
31
|
private running;
|
|
32
32
|
private stopped;
|
|
33
|
-
private nextScheduledRefresh;
|
|
34
33
|
private abortController;
|
|
35
34
|
private localeHint;
|
|
36
35
|
constructor(db: DatabaseSync, deps: HomeIntelligenceHostDeps);
|
|
@@ -43,6 +42,7 @@ export declare class HomeIntelligenceHost {
|
|
|
43
42
|
sourceChanged(input: {
|
|
44
43
|
sourceInstanceId: string;
|
|
45
44
|
revision: string;
|
|
45
|
+
refresh: boolean;
|
|
46
46
|
}): void;
|
|
47
47
|
act(opportunityId: string, input: HomeOpportunityActionRequest): HomeOpportunityActionResponse;
|
|
48
48
|
feedback(opportunityId: string, input: HomeOpportunityFeedbackRequest): void;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
3
|
import { homePatternKey } from "./strategy.js";
|
|
4
|
+
import { HomeAdvicePolicy } from "./policy.js";
|
|
4
5
|
import { HomeIntelligenceRepository } from "./repository.js";
|
|
5
6
|
import { HomeOpportunityApplicationService } from "./application-service.js";
|
|
6
|
-
import { HomeAdvicePolicy } from "./policy.js";
|
|
7
7
|
import { buildHomeOpportunityNotification } from "./notification.js";
|
|
8
8
|
import { createHash } from "node:crypto";
|
|
9
9
|
//#region src/home-intelligence/host.ts
|
|
10
10
|
init_logger();
|
|
11
11
|
const log = createLogger("HomeIntelligence");
|
|
12
12
|
const POLL_INTERVAL_MS = 5e3;
|
|
13
|
-
const REFRESH_INTERVAL_MS = 30 * 6e4;
|
|
14
13
|
const GENERATION_LEASE_MS = 5 * 6e4;
|
|
15
14
|
const DAILY_MODEL_GENERATION_BUDGET = 12;
|
|
16
15
|
function generationFingerprint(snapshotHash, capabilities) {
|
|
@@ -28,7 +27,6 @@ var HomeIntelligenceHost = class {
|
|
|
28
27
|
timer;
|
|
29
28
|
running = false;
|
|
30
29
|
stopped = false;
|
|
31
|
-
nextScheduledRefresh = 0;
|
|
32
30
|
abortController = new AbortController();
|
|
33
31
|
localeHint;
|
|
34
32
|
constructor(db, deps) {
|
|
@@ -41,7 +39,6 @@ var HomeIntelligenceHost = class {
|
|
|
41
39
|
start() {
|
|
42
40
|
if (this.timer) return;
|
|
43
41
|
this.stopped = false;
|
|
44
|
-
this.nextScheduledRefresh = this.now();
|
|
45
42
|
this.timer = setInterval(() => void this.tick(), POLL_INTERVAL_MS);
|
|
46
43
|
this.timer.unref?.();
|
|
47
44
|
this.tick();
|
|
@@ -78,14 +75,13 @@ var HomeIntelligenceHost = class {
|
|
|
78
75
|
return request.generationId;
|
|
79
76
|
}
|
|
80
77
|
sourceChanged(input) {
|
|
81
|
-
if (this.deps.enabled?.() === false) return;
|
|
82
78
|
const now = this.now();
|
|
83
79
|
const invalidated = this.repository.invalidateOpportunitiesByEvidenceSources(this.deps.principal, new Set([
|
|
84
80
|
"calendar",
|
|
85
81
|
"mail",
|
|
86
82
|
"communication"
|
|
87
83
|
]), now);
|
|
88
|
-
this.requestRefresh("connector_changed", `connector:${input.sourceInstanceId}:${input.revision}`);
|
|
84
|
+
if (input.refresh) this.requestRefresh("connector_changed", `connector:${input.sourceInstanceId}:${input.revision}`);
|
|
89
85
|
if (invalidated > 0) this.deps.publish("home.advisor.updated", {
|
|
90
86
|
state: "source_changed",
|
|
91
87
|
sourceInstanceId: input.sourceInstanceId,
|
|
@@ -155,10 +151,6 @@ var HomeIntelligenceHost = class {
|
|
|
155
151
|
try {
|
|
156
152
|
const now = this.now();
|
|
157
153
|
this.repository.maintain(now);
|
|
158
|
-
if (now >= this.nextScheduledRefresh) {
|
|
159
|
-
this.nextScheduledRefresh = now + REFRESH_INTERVAL_MS;
|
|
160
|
-
this.requestRefresh("scheduled_refresh", `scheduled_refresh:${Math.floor(now / REFRESH_INTERVAL_MS)}`);
|
|
161
|
-
}
|
|
162
154
|
const claim = this.repository.claimNext(this.deps.principal, `gateway:${process.pid}`, now, GENERATION_LEASE_MS);
|
|
163
155
|
if (!claim) return;
|
|
164
156
|
await this.process(claim);
|
|
@@ -2,7 +2,7 @@ import { createHash } from "node:crypto";
|
|
|
2
2
|
//#region src/home-intelligence/notification.ts
|
|
3
3
|
function buildHomeOpportunityNotification(opportunity, reasons, placement) {
|
|
4
4
|
const backgroundRefresh = reasons.includes("connector_changed") || reasons.includes("scheduled_refresh");
|
|
5
|
-
const foregroundRefresh = reasons.includes("
|
|
5
|
+
const foregroundRefresh = reasons.includes("manual_refresh");
|
|
6
6
|
const hasCrossSourceEvidence = opportunity.evidence.some((item) => item.sourceType === "calendar" || item.sourceType === "mail" || item.sourceType === "communication");
|
|
7
7
|
if (!backgroundRefresh || foregroundRefresh || placement !== "primary" || opportunity.confidence !== "high" || opportunity.urgency !== "now" || !opportunity.actions.canStart || !hasCrossSourceEvidence) return void 0;
|
|
8
8
|
const evidenceRevision = opportunity.evidence.map((item) => `${item.sourceType}:${item.sourceRef}:${item.revision}`).sort().join("\n");
|
|
@@ -6,7 +6,7 @@ export interface HomePrincipal {
|
|
|
6
6
|
ownerId: string;
|
|
7
7
|
workspaceId: string;
|
|
8
8
|
}
|
|
9
|
-
export type HomeGenerationReason = '
|
|
9
|
+
export type HomeGenerationReason = 'manual_refresh' | 'project_changed' | 'task_changed' | 'conversation_changed' | 'connector_changed' | 'scheduled_refresh';
|
|
10
10
|
export interface HomeGenerationClaim extends HomePrincipal {
|
|
11
11
|
generationId: string;
|
|
12
12
|
leaseOwner: string;
|
|
@@ -5,6 +5,10 @@ export type NpmTagResult = {
|
|
|
5
5
|
version: string | null;
|
|
6
6
|
error?: string;
|
|
7
7
|
};
|
|
8
|
+
type RegistryResponse = Pick<Response, 'ok' | 'status' | 'json'>;
|
|
9
|
+
type RegistryFetch = (url: string, init: {
|
|
10
|
+
signal: AbortSignal;
|
|
11
|
+
}) => Promise<RegistryResponse>;
|
|
8
12
|
export type UpdateCheckResult = {
|
|
9
13
|
installKind: InstallKind;
|
|
10
14
|
root: string | null;
|
|
@@ -21,6 +25,7 @@ export type UpdateAvailable = {
|
|
|
21
25
|
export declare function fetchNpmTagVersion(params: {
|
|
22
26
|
tag: string;
|
|
23
27
|
timeoutMs?: number;
|
|
28
|
+
fetchImpl?: RegistryFetch;
|
|
24
29
|
}): Promise<NpmTagResult>;
|
|
25
30
|
/**
|
|
26
31
|
* Resolve the best version for the given update channel.
|
|
@@ -29,10 +34,8 @@ export declare function fetchNpmTagVersion(params: {
|
|
|
29
34
|
export declare function resolveNpmChannelTag(params: {
|
|
30
35
|
channel: UpdateChannel;
|
|
31
36
|
timeoutMs?: number;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
version: string | null;
|
|
35
|
-
}>;
|
|
37
|
+
fetchImpl?: RegistryFetch;
|
|
38
|
+
}): Promise<NpmTagResult>;
|
|
36
39
|
/**
|
|
37
40
|
* Compare two semver strings. Returns:
|
|
38
41
|
* -1 if a < b, 0 if equal, 1 if a > b, null if either is unparseable.
|
|
@@ -51,3 +54,4 @@ export declare function detectInstallKind(packageRoot: string): Promise<InstallK
|
|
|
51
54
|
export declare function resolvePackageRoot(): Promise<string | null>;
|
|
52
55
|
/** Get the current running version from package.json. */
|
|
53
56
|
export declare function getCurrentVersion(): string;
|
|
57
|
+
export {};
|
|
@@ -3,6 +3,7 @@ import { channelToNpmTag } from "./update-channels.js";
|
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { access, readFile } from "node:fs/promises";
|
|
6
|
+
import { Agent, fetch } from "undici";
|
|
6
7
|
//#region src/infra/update-check.ts
|
|
7
8
|
init_package_version();
|
|
8
9
|
const REGISTRY_BASE = "https://registry.npmjs.org";
|
|
@@ -17,32 +18,42 @@ const INITIAL_REGISTRY_RETRY_DELAY_MS = 500;
|
|
|
17
18
|
async function fetchNpmTagVersion(params) {
|
|
18
19
|
const timeoutMs = params.timeoutMs ?? REGISTRY_TIMEOUT_MS;
|
|
19
20
|
const url = `${REGISTRY_BASE}/${encodeURIComponent(PACKAGE_NAME).replace("%40", "@")}/${encodeURIComponent(params.tag)}`;
|
|
21
|
+
const dispatcher = params.fetchImpl ? null : new Agent();
|
|
22
|
+
const fetchImpl = params.fetchImpl ?? ((input, init) => fetch(input, {
|
|
23
|
+
...init,
|
|
24
|
+
dispatcher
|
|
25
|
+
}));
|
|
20
26
|
let lastError;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
try {
|
|
28
|
+
for (let attempt = 0; attempt <= MAX_REGISTRY_RETRIES; attempt++) {
|
|
29
|
+
if (attempt > 0) {
|
|
30
|
+
const delayMs = INITIAL_REGISTRY_RETRY_DELAY_MS * Math.pow(2, attempt - 1);
|
|
31
|
+
await new Promise((r) => setTimeout(r, delayMs));
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
const response = await fetchImpl(url, { signal: AbortSignal.timeout(timeoutMs) });
|
|
35
|
+
if (!response.ok) {
|
|
36
|
+
lastError = `HTTP ${response.status}`;
|
|
37
|
+
if (response.status >= 400 && response.status < 500) return {
|
|
38
|
+
tag: params.tag,
|
|
39
|
+
version: null,
|
|
40
|
+
error: lastError
|
|
41
|
+
};
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
const json = await response.json();
|
|
45
|
+
const version = typeof json?.version === "string" ? json.version : null;
|
|
46
|
+
return {
|
|
31
47
|
tag: params.tag,
|
|
32
|
-
version
|
|
33
|
-
error:
|
|
48
|
+
version,
|
|
49
|
+
...version ? {} : { error: "Registry response did not include a version" }
|
|
34
50
|
};
|
|
35
|
-
|
|
51
|
+
} catch (err) {
|
|
52
|
+
lastError = err instanceof Error ? err.message : String(err);
|
|
36
53
|
}
|
|
37
|
-
const json = await response.json();
|
|
38
|
-
const version = typeof json?.version === "string" ? json.version : null;
|
|
39
|
-
return {
|
|
40
|
-
tag: params.tag,
|
|
41
|
-
version
|
|
42
|
-
};
|
|
43
|
-
} catch (err) {
|
|
44
|
-
lastError = String(err);
|
|
45
54
|
}
|
|
55
|
+
} finally {
|
|
56
|
+
await dispatcher?.close().catch(() => void 0);
|
|
46
57
|
}
|
|
47
58
|
return {
|
|
48
59
|
tag: params.tag,
|
|
@@ -58,33 +69,24 @@ async function resolveNpmChannelTag(params) {
|
|
|
58
69
|
const channelTag = channelToNpmTag(params.channel);
|
|
59
70
|
const channelResult = await fetchNpmTagVersion({
|
|
60
71
|
tag: channelTag,
|
|
61
|
-
timeoutMs: params.timeoutMs
|
|
72
|
+
timeoutMs: params.timeoutMs,
|
|
73
|
+
fetchImpl: params.fetchImpl
|
|
62
74
|
});
|
|
63
|
-
if (params.channel !== "beta") return
|
|
64
|
-
tag: channelTag,
|
|
65
|
-
version: channelResult.version
|
|
66
|
-
};
|
|
75
|
+
if (params.channel !== "beta") return channelResult;
|
|
67
76
|
const latestResult = await fetchNpmTagVersion({
|
|
68
77
|
tag: "latest",
|
|
69
|
-
timeoutMs: params.timeoutMs
|
|
78
|
+
timeoutMs: params.timeoutMs,
|
|
79
|
+
fetchImpl: params.fetchImpl
|
|
70
80
|
});
|
|
71
|
-
if (!latestResult.version) return {
|
|
81
|
+
if (!latestResult.version) return channelResult.version ? channelResult : {
|
|
72
82
|
tag: channelTag,
|
|
73
|
-
version:
|
|
74
|
-
|
|
75
|
-
if (!channelResult.version) return {
|
|
76
|
-
tag: "latest",
|
|
77
|
-
version: latestResult.version
|
|
83
|
+
version: null,
|
|
84
|
+
error: [channelResult.error, latestResult.error].filter(Boolean).join("; ") || void 0
|
|
78
85
|
};
|
|
86
|
+
if (!channelResult.version) return latestResult;
|
|
79
87
|
const comparison = compareSemver(channelResult.version, latestResult.version);
|
|
80
|
-
if (comparison !== null && comparison < 0) return
|
|
81
|
-
|
|
82
|
-
version: latestResult.version
|
|
83
|
-
};
|
|
84
|
-
return {
|
|
85
|
-
tag: channelTag,
|
|
86
|
-
version: channelResult.version
|
|
87
|
-
};
|
|
88
|
+
if (comparison !== null && comparison < 0) return latestResult;
|
|
89
|
+
return channelResult;
|
|
88
90
|
}
|
|
89
91
|
/**
|
|
90
92
|
* Parse a version string into comparable numeric parts.
|
|
@@ -3,6 +3,12 @@ import { type UpdateAvailable } from './update-check.js';
|
|
|
3
3
|
import type { InProcessRestartTrigger } from './update-restart.js';
|
|
4
4
|
/** Get the cached update-available state (populated after startup check). */
|
|
5
5
|
export declare function getUpdateAvailable(): UpdateAvailable | null;
|
|
6
|
+
export type GatewayUpdateCheckResult = {
|
|
7
|
+
ok: true;
|
|
8
|
+
} | {
|
|
9
|
+
ok: false;
|
|
10
|
+
error: string;
|
|
11
|
+
};
|
|
6
12
|
/**
|
|
7
13
|
* Main startup update check. Called once when the gateway starts (or on demand).
|
|
8
14
|
*/
|
|
@@ -12,7 +18,7 @@ export declare function runGatewayUpdateCheck(params: {
|
|
|
12
18
|
triggerInProcessRestart?: InProcessRestartTrigger;
|
|
13
19
|
/** When true, bypass checkOnStart/auto-disabled early exit and throttle (for POST /api/update/check). */
|
|
14
20
|
force?: boolean;
|
|
15
|
-
}): Promise<
|
|
21
|
+
}): Promise<GatewayUpdateCheckResult>;
|
|
16
22
|
/**
|
|
17
23
|
* Schedule periodic update checks. Returns a cleanup function to stop the timer.
|
|
18
24
|
*/
|
|
@@ -65,7 +65,7 @@ async function runGatewayUpdateCheck(params) {
|
|
|
65
65
|
const { config, force } = params;
|
|
66
66
|
const autoEnabled = config.update?.auto?.enabled ?? false;
|
|
67
67
|
const shouldCheckHints = config.update?.checkOnStart !== false;
|
|
68
|
-
if (!force && !shouldCheckHints && !autoEnabled) return;
|
|
68
|
+
if (!force && !shouldCheckHints && !autoEnabled) return { ok: true };
|
|
69
69
|
const statePath = resolveUpdateCheckStatePath();
|
|
70
70
|
const state = await readState(statePath);
|
|
71
71
|
const now = Date.now();
|
|
@@ -83,8 +83,10 @@ async function runGatewayUpdateCheck(params) {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
const checkIntervalMs = resolveCheckIntervalMs(config);
|
|
86
|
-
const
|
|
87
|
-
|
|
86
|
+
const staleAvailableComparison = compareSemver(PACKAGE_VERSION, state.lastAvailableVersion ?? null);
|
|
87
|
+
const hasStaleAvailableVersion = staleAvailableComparison !== null && staleAvailableComparison >= 0;
|
|
88
|
+
const shouldBypassThrottleForVersion = state.lastCheckPackageVersion === void 0 || state.lastCheckPackageVersion !== PACKAGE_VERSION || hasStaleAvailableVersion;
|
|
89
|
+
if (!force && !shouldBypassThrottleForVersion && lastCheckedAt && Number.isFinite(lastCheckedAt) && now - lastCheckedAt < checkIntervalMs) return { ok: true };
|
|
88
90
|
const root = await resolvePackageRoot();
|
|
89
91
|
let installKind = "unknown";
|
|
90
92
|
if (root) {
|
|
@@ -101,9 +103,15 @@ async function runGatewayUpdateCheck(params) {
|
|
|
101
103
|
lastCheckedAt: new Date(now).toISOString()
|
|
102
104
|
};
|
|
103
105
|
if (!resolved.version) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
const error = resolved.error ?? `npm tag ${resolved.tag} did not return a version`;
|
|
107
|
+
log.warn({
|
|
108
|
+
tag: resolved.tag,
|
|
109
|
+
errorMessage: error
|
|
110
|
+
}, `Update check failed: ${error}`);
|
|
111
|
+
return {
|
|
112
|
+
ok: false,
|
|
113
|
+
error
|
|
114
|
+
};
|
|
107
115
|
}
|
|
108
116
|
const comparison = compareSemver(PACKAGE_VERSION, resolved.version);
|
|
109
117
|
if (comparison !== null && comparison < 0) {
|
|
@@ -147,6 +155,7 @@ async function runGatewayUpdateCheck(params) {
|
|
|
147
155
|
}
|
|
148
156
|
nextState.lastCheckPackageVersion = PACKAGE_VERSION;
|
|
149
157
|
await writeState(statePath, nextState);
|
|
158
|
+
return { ok: true };
|
|
150
159
|
}
|
|
151
160
|
async function handleAutoUpdate(params) {
|
|
152
161
|
const { channel, version, tag, state, nextState, now, root, config } = params;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { resolveMemoryMaintenanceSchedules } from "./schedule.js";
|
|
2
2
|
import { listMemoryMaintenanceRuns, runMemoryMaintenance } from "./service.js";
|
|
3
|
-
export {
|
|
3
|
+
export { listMemoryMaintenanceRuns, resolveMemoryMaintenanceSchedules, runMemoryMaintenance };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Config } from '../config/schema.js';
|
|
2
2
|
import type { MemoryMaintenanceJob } from './service.js';
|
|
3
|
-
export declare const MEMORY_MAINTENANCE_TOKEN = "__xopc_memory_maintenance__";
|
|
4
3
|
export interface MemoryMaintenanceSchedule {
|
|
5
4
|
jobType: Exclude<MemoryMaintenanceJob, 'manual_repair'>;
|
|
6
5
|
automationId: string;
|
|
@@ -9,5 +8,3 @@ export interface MemoryMaintenanceSchedule {
|
|
|
9
8
|
timezone: string;
|
|
10
9
|
}
|
|
11
10
|
export declare function resolveMemoryMaintenanceSchedules(config: Config): MemoryMaintenanceSchedule[];
|
|
12
|
-
export declare function maintenanceInstruction(jobType: MemoryMaintenanceSchedule['jobType']): string;
|
|
13
|
-
export declare function parseMaintenanceInstruction(value: string): MemoryMaintenanceSchedule['jobType'] | undefined;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
//#region src/memory-maintenance/schedule.ts
|
|
2
|
-
const MEMORY_MAINTENANCE_TOKEN = "__xopc_memory_maintenance__";
|
|
3
2
|
const WEEKDAY = {
|
|
4
3
|
sun: 0,
|
|
5
4
|
mon: 1,
|
|
@@ -41,11 +40,5 @@ function resolveMemoryMaintenanceSchedules(config) {
|
|
|
41
40
|
}
|
|
42
41
|
];
|
|
43
42
|
}
|
|
44
|
-
function maintenanceInstruction(jobType) {
|
|
45
|
-
return `${MEMORY_MAINTENANCE_TOKEN}:${jobType}`;
|
|
46
|
-
}
|
|
47
|
-
function parseMaintenanceInstruction(value) {
|
|
48
|
-
return new RegExp(`${MEMORY_MAINTENANCE_TOKEN}:(temporal_sweep|daily_reconciliation|weekly_knowledge)`).exec(value)?.[1];
|
|
49
|
-
}
|
|
50
43
|
//#endregion
|
|
51
|
-
export {
|
|
44
|
+
export { resolveMemoryMaintenanceSchedules };
|
|
@@ -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 = 165;
|
|
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 = 208;
|
|
7
7
|
export declare function resolveMigrationsDir(override?: string): string;
|
|
8
8
|
/**
|
|
9
9
|
* Apply sequential SQL migrations from (currentVersion + 1) through targetVersion.
|
|
@@ -57,7 +57,7 @@ function applySingleMigration(db, migration, discardOldScenes = false) {
|
|
|
57
57
|
*/
|
|
58
58
|
function applyPendingMigrations(db, options = {}) {
|
|
59
59
|
db.function("xopc_operation_id", () => currentOperationId() ?? null);
|
|
60
|
-
const targetVersion = options.targetVersion ??
|
|
60
|
+
const targetVersion = options.targetVersion ?? 208;
|
|
61
61
|
let currentVersion = readSchemaVersion(db);
|
|
62
62
|
if (currentVersion > targetVersion) throw new DatabaseSchemaTooNewError(currentVersion, targetVersion);
|
|
63
63
|
if (!options.migrationsDir && currentVersion < 165) throw new DatabaseSchemaTooOldError(currentVersion, 165);
|
|
@@ -95,7 +95,7 @@ function applyPendingMigrations(db, options = {}) {
|
|
|
95
95
|
}
|
|
96
96
|
/** Inspect schema version without mutating the database. */
|
|
97
97
|
function inspectSchemaMigrationStatus(db, options = {}) {
|
|
98
|
-
const appVersion = options.targetVersion ??
|
|
98
|
+
const appVersion = options.targetVersion ?? 208;
|
|
99
99
|
const dbVersion = readSchemaVersion(db);
|
|
100
100
|
if (dbVersion > appVersion) return {
|
|
101
101
|
dbVersion,
|
|
@@ -137,7 +137,7 @@ var init_runner = __esmMin((() => {
|
|
|
137
137
|
init_errors();
|
|
138
138
|
log = createLogger("Sqlite:Migrations");
|
|
139
139
|
XOPC_DB_BASELINE_SCHEMA_VERSION = 165;
|
|
140
|
-
XOPC_DB_SCHEMA_VERSION =
|
|
140
|
+
XOPC_DB_SCHEMA_VERSION = 208;
|
|
141
141
|
}));
|
|
142
142
|
//#endregion
|
|
143
143
|
init_runner();
|
|
@@ -37,6 +37,7 @@ function actionLabel(automation) {
|
|
|
37
37
|
if (automation.action.kind === "workflow") return `workflow:${automation.action.workflowId}`;
|
|
38
38
|
if (automation.action.kind === "browser_automation") return `browser-automation:${automation.action.automationId}`;
|
|
39
39
|
if (automation.action.kind === "task_command") return `task:${automation.action.command.type}`;
|
|
40
|
+
if (automation.action.kind === "system") return `system:${automation.action.capability}`;
|
|
40
41
|
return automation.action.agentId ? `agent:${automation.action.agentId}` : "agent";
|
|
41
42
|
}
|
|
42
43
|
function toHomeAutomation(automation) {
|
|
@@ -145,6 +145,10 @@ export declare const ContextPlanningConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
145
145
|
postCompactionSections: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
146
146
|
}, z.core.$strict>>;
|
|
147
147
|
}, z.core.$strict>>;
|
|
148
|
+
export declare const HomeIntelligenceConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
149
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
150
|
+
refreshOnContextChange: z.ZodDefault<z.ZodBoolean>;
|
|
151
|
+
}, z.core.$strict>>;
|
|
148
152
|
export declare const UserContextConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
149
153
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
150
154
|
preferences: z.ZodDefault<z.ZodObject<{
|
|
@@ -259,9 +263,14 @@ export declare const UserContextConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
259
263
|
postCompactionSections: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
260
264
|
}, z.core.$strict>>;
|
|
261
265
|
}, z.core.$strict>>;
|
|
266
|
+
homeIntelligence: z.ZodDefault<z.ZodObject<{
|
|
267
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
268
|
+
refreshOnContextChange: z.ZodDefault<z.ZodBoolean>;
|
|
269
|
+
}, z.core.$strict>>;
|
|
262
270
|
}, z.core.$strict>>;
|
|
263
271
|
export type UserContextConfig = z.infer<typeof UserContextConfigSchema>;
|
|
264
272
|
export type UserModelConfig = z.infer<typeof UserModelConfigSchema>;
|
|
265
273
|
export type KnowledgeMemoryConfig = z.infer<typeof KnowledgeMemoryConfigSchema>;
|
|
266
274
|
export type ContextPlanningConfig = z.infer<typeof ContextPlanningConfigSchema>;
|
|
275
|
+
export type HomeIntelligenceConfig = z.infer<typeof HomeIntelligenceConfigSchema>;
|
|
267
276
|
export declare function resolveKnowledgeReadPolicy(config: KnowledgeMemoryConfig): KnowledgeReadPolicy;
|
|
@@ -16,7 +16,7 @@ function resolveKnowledgeReadPolicy(config) {
|
|
|
16
16
|
contentSources: config.contentSources
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
var DEFAULT_CONTEXT_COMPACTION_POLICY, ContextCompactionPolicySchema, WritePolicySchema, MaintenanceTimeSchema, UserModelConfigSchema, KnowledgeMemoryConfigSchema, ContextPlanningConfigSchema, UserContextConfigSchema;
|
|
19
|
+
var DEFAULT_CONTEXT_COMPACTION_POLICY, ContextCompactionPolicySchema, WritePolicySchema, MaintenanceTimeSchema, UserModelConfigSchema, KnowledgeMemoryConfigSchema, ContextPlanningConfigSchema, HomeIntelligenceConfigSchema, UserContextConfigSchema;
|
|
20
20
|
var init_config = __esmMin((() => {
|
|
21
21
|
init_response_language();
|
|
22
22
|
DEFAULT_CONTEXT_COMPACTION_POLICY = {
|
|
@@ -193,20 +193,29 @@ var init_config = __esmMin((() => {
|
|
|
193
193
|
maxChars: 6e3,
|
|
194
194
|
compaction: DEFAULT_CONTEXT_COMPACTION_POLICY
|
|
195
195
|
});
|
|
196
|
+
HomeIntelligenceConfigSchema = z.object({
|
|
197
|
+
enabled: z.boolean().default(true),
|
|
198
|
+
refreshOnContextChange: z.boolean().default(true)
|
|
199
|
+
}).strict().default({
|
|
200
|
+
enabled: true,
|
|
201
|
+
refreshOnContextChange: true
|
|
202
|
+
});
|
|
196
203
|
UserContextConfigSchema = z.object({
|
|
197
204
|
enabled: z.boolean().default(true),
|
|
198
205
|
preferences: z.object({ responseLanguage: ResponseLanguageSchema.default("auto") }).strict().default({ responseLanguage: "auto" }),
|
|
199
206
|
userModel: UserModelConfigSchema,
|
|
200
207
|
knowledgeMemory: KnowledgeMemoryConfigSchema,
|
|
201
|
-
contextPlanning: ContextPlanningConfigSchema
|
|
208
|
+
contextPlanning: ContextPlanningConfigSchema,
|
|
209
|
+
homeIntelligence: HomeIntelligenceConfigSchema
|
|
202
210
|
}).strict().default({
|
|
203
211
|
enabled: true,
|
|
204
212
|
preferences: { responseLanguage: "auto" },
|
|
205
213
|
userModel: UserModelConfigSchema.parse({}),
|
|
206
214
|
knowledgeMemory: KnowledgeMemoryConfigSchema.parse({}),
|
|
207
|
-
contextPlanning: ContextPlanningConfigSchema.parse({})
|
|
215
|
+
contextPlanning: ContextPlanningConfigSchema.parse({}),
|
|
216
|
+
homeIntelligence: HomeIntelligenceConfigSchema.parse({})
|
|
208
217
|
});
|
|
209
218
|
}));
|
|
210
219
|
//#endregion
|
|
211
220
|
init_config();
|
|
212
|
-
export { ContextCompactionPolicySchema, ContextPlanningConfigSchema, DEFAULT_CONTEXT_COMPACTION_POLICY, KnowledgeMemoryConfigSchema, UserContextConfigSchema, UserModelConfigSchema, init_config, resolveKnowledgeReadPolicy };
|
|
221
|
+
export { ContextCompactionPolicySchema, ContextPlanningConfigSchema, DEFAULT_CONTEXT_COMPACTION_POLICY, HomeIntelligenceConfigSchema, KnowledgeMemoryConfigSchema, UserContextConfigSchema, UserModelConfigSchema, init_config, resolveKnowledgeReadPolicy };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xopcai/xopc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.332",
|
|
4
4
|
"description": "Local-first personal AI for the one-person company, with durable context, tasks, workflows, automations, and local or cloud models.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -158,9 +158,9 @@
|
|
|
158
158
|
"vitepress": "^1.6.4",
|
|
159
159
|
"vitest": "4.1.5",
|
|
160
160
|
"vue": "^3.5.35",
|
|
161
|
+
"@xopcai/browser-control-contract": "0.1.0",
|
|
161
162
|
"@xopcai/computer-control-contract": "0.1.0",
|
|
162
163
|
"@xopcai/endpoint-tools-client": "0.0.0",
|
|
163
|
-
"@xopcai/browser-control-contract": "0.1.0",
|
|
164
164
|
"@xopcai/endpoint-tools-protocol": "0.0.0",
|
|
165
165
|
"@xopcai/gateway-contract": "0.0.0",
|
|
166
166
|
"@xopcai/realtime-client": "0.0.0",
|