@xopcai/xopc 0.0.331 → 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.
Files changed (169) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B0BtF24E.js → agent-avatar-dicebear-C2wg3xC_.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-DgP5DEJF.js → agent-defaults-settings-panel-Se1Z72VG.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agent-plugin-dialog-DbvLXQO2.js → agent-plugin-dialog-BeNnu1Ts.js} +1 -1
  6. package/dist/gateway/static/root/assets/{agents-Bh4XNLyk.js → agents-udIitwV8.js} +3 -3
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-fwzTRJfP.js → app-management-settings-panel-etFSkfzl.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-v_GGe8UZ.js → appearance-settings-DKmU2VAP.js} +1 -1
  9. package/dist/gateway/static/root/assets/{apps-page-C9ZMEuuA.js → apps-page-DVNySL58.js} +1 -1
  10. package/dist/gateway/static/root/assets/{archive-plugin-B6EgADeH.js → archive-plugin-D0z_Fr2G.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-B4H_IFeX.js → attachment-load-DNCDbeOX.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automations-page-UlVCvg4r.js → automations-page-B7_C-p66.js} +1 -1
  13. package/dist/gateway/static/root/assets/automations-workspace-BMgJvdcv.js +7 -0
  14. package/dist/gateway/static/root/assets/{binary-plugins-BxTSx30f.js → binary-plugins-BYn2hScX.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-CVzdrpjl.js → block-editor-ChWW8Z9L.js} +1 -1
  16. package/dist/gateway/static/root/assets/{browser-automations-page-CBVD8k6O.js → browser-automations-page-BV00BXRb.js} +1 -1
  17. package/dist/gateway/static/root/assets/{browser-settings-page-CC43CC43.js → browser-settings-page-xwTmuZjS.js} +1 -1
  18. package/dist/gateway/static/root/assets/capabilities-CHA-sTAZ.js +1 -0
  19. package/dist/gateway/static/root/assets/{capabilities-page-BAT7Vvb8.js → capabilities-page-v0WkhV5o.js} +2 -2
  20. package/dist/gateway/static/root/assets/{capabilities-settings-panel-DPETQOfF.js → capabilities-settings-panel-DefBGjhV.js} +1 -1
  21. package/dist/gateway/static/root/assets/{capability-header-actions-EETjXmkG.js → capability-header-actions-vmx35sbu.js} +1 -1
  22. package/dist/gateway/static/root/assets/{channels-CwA619os.js → channels-Eo4ONF5X.js} +1 -1
  23. package/dist/gateway/static/root/assets/{chat-terminal-dock-DCqm9j9W.js → chat-terminal-dock-C41mXCAi.js} +1 -1
  24. package/dist/gateway/static/root/assets/{computer-settings-page-CxFWdovV.js → computer-settings-page-BJkqok2G.js} +1 -1
  25. package/dist/gateway/static/root/assets/{connector-service-page-wxsEhmlU.js → connector-service-page-BKCZMmwm.js} +1 -1
  26. package/dist/gateway/static/root/assets/{connectors-page-l7goF6QS.js → connectors-page-DZYgogQw.js} +1 -1
  27. package/dist/gateway/static/root/assets/{date-picker-h_OS6uBR.js → date-picker-CrOV4Ynd.js} +1 -1
  28. package/dist/gateway/static/root/assets/{dependency-picker-DNgSSH3z.js → dependency-picker-CqADAHZp.js} +1 -1
  29. package/dist/gateway/static/root/assets/{desktop-pet-CflvPnB-.js → desktop-pet-Bab-iWED.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-settings-CXy0X5Js.js → desktop-pet-settings-BqgzLOdi.js} +1 -1
  31. package/dist/gateway/static/root/assets/{device-pairing-wizard-BDMiJcsK.js → device-pairing-wizard-DFg7FDPf.js} +1 -1
  32. package/dist/gateway/static/root/assets/{directory-picker-path-field-BqkOh13m.js → directory-picker-path-field-hqJ9sFCR.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-debug-page-VT4s-9pK.js → extension-debug-page-DX3PFhRE.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-page-CBSeGhGA.js → extension-page-DkREdHLs.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-settings-page-DRB6uOo8.js → extension-settings-page-wF-HNTM-.js} +1 -1
  36. package/dist/gateway/static/root/assets/{gateway-settings-lF-FpnZy.js → gateway-settings-Du-Dos9O.js} +1 -1
  37. package/dist/gateway/static/root/assets/{home-page-DSaXXoLm.js → home-page-D7YoMHq4.js} +1 -1
  38. package/dist/gateway/static/root/assets/{imports-page-DGkOijwE.js → imports-page-B80Cv043.js} +1 -1
  39. package/dist/gateway/static/root/assets/{index-D99vN3es.js → index-DalslRUx.js} +8 -8
  40. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-iU6c2zg1.js → keyboard-shortcuts-settings-BgoFaTwv.js} +1 -1
  41. package/dist/gateway/static/root/assets/{local-app-workbench-page-rH33N8I9.js → local-app-workbench-page-BKL5UZAj.js} +1 -1
  42. package/dist/gateway/static/root/assets/{local-apps-page-C0BWC8D2.js → local-apps-page-HO6OQlQT.js} +1 -1
  43. package/dist/gateway/static/root/assets/{logs-page-Dpoi-r-_.js → logs-page-CjzR9Rpj.js} +1 -1
  44. package/dist/gateway/static/root/assets/{management-settings-RFDLaquR.js → management-settings-Dk_gTJb9.js} +1 -1
  45. package/dist/gateway/static/root/assets/{media-plugins-C8E_F2F_.js → media-plugins-Dlj6TD3M.js} +1 -1
  46. package/dist/gateway/static/root/assets/{note-detail-panel-DI7CIjmM.js → note-detail-panel-BebJPjjk.js} +3 -3
  47. package/dist/gateway/static/root/assets/{notes-page-BkqnU-Jh.js → notes-page-CmS_hvz8.js} +1 -1
  48. package/dist/gateway/static/root/assets/{page-context-capture-button-qqWG_gs_.js → page-context-capture-button-BArPtqp5.js} +1 -1
  49. package/dist/gateway/static/root/assets/{page-tabs-b3lheKy4.js → page-tabs-vqI30Yrg.js} +1 -1
  50. package/dist/gateway/static/root/assets/{preview-open-alternatives-0Q4rTfGX.js → preview-open-alternatives-B-mwPBJW.js} +1 -1
  51. package/dist/gateway/static/root/assets/{product-open-page-jnJZCrKQ.js → product-open-page-D--sj_uN.js} +1 -1
  52. package/dist/gateway/static/root/assets/{project-detail-page-BvvcTH2F.js → project-detail-page-BFUdtWXF.js} +1 -1
  53. package/dist/gateway/static/root/assets/{projects-page-r96k_2wB.js → projects-page-DBsBwAQ6.js} +1 -1
  54. package/dist/gateway/static/root/assets/{remote-access-hub-B1d8pB_y.js → remote-access-hub-BurdDY0m.js} +1 -1
  55. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Do_iF13W.js → runtime-tools-settings-panel-CAnb0PNY.js} +1 -1
  56. package/dist/gateway/static/root/assets/{scenes-page-DK316w9a.js → scenes-page-Cj8xtr5t.js} +1 -1
  57. package/dist/gateway/static/root/assets/{schema-form-Cfft26Je.js → schema-form-BKj6wIMb.js} +1 -1
  58. package/dist/gateway/static/root/assets/{sessions-page-EIk8iJTK.js → sessions-page-BCsjgkCs.js} +1 -1
  59. package/dist/gateway/static/root/assets/settings-advanced-gate-BLL7csOJ.js +1 -0
  60. package/dist/gateway/static/root/assets/{settings-form-section-iI0MTyuU.js → settings-form-section-78ycUHfv.js} +1 -1
  61. package/dist/gateway/static/root/assets/{settings-page-C2Ka9oJm.js → settings-page-BOdxIVzo.js} +1 -1
  62. package/dist/gateway/static/root/assets/{setup-status-panel-nnmS_p5h.js → setup-status-panel-CbKHBjrU.js} +1 -1
  63. package/dist/gateway/static/root/assets/{share-preview-page-D0Knvtlp.js → share-preview-page-DyLfktib.js} +1 -1
  64. package/dist/gateway/static/root/assets/{shares-settings-BcaxGQLC.js → shares-settings-BzvSNouj.js} +1 -1
  65. package/dist/gateway/static/root/assets/{skill-api-BuZKcy9b.js → skill-api-CiBGQ0Jg.js} +1 -1
  66. package/dist/gateway/static/root/assets/{skill-reload-api-Cb_CUL-U.js → skill-reload-api-BHnru0F5.js} +1 -1
  67. package/dist/gateway/static/root/assets/{skills-page-DcxWxIrR.js → skills-page-C35VKjhb.js} +1 -1
  68. package/dist/gateway/static/root/assets/{system-settings-panel-CMG0ZAsd.js → system-settings-panel-CyJUeREH.js} +1 -1
  69. package/dist/gateway/static/root/assets/{task-detail-page-Cvr1qUTW.js → task-detail-page-Bd1_Fguk.js} +1 -1
  70. package/dist/gateway/static/root/assets/{tunnel-api-DGYA6GyO.js → tunnel-api-Day9zhKi.js} +1 -1
  71. package/dist/gateway/static/root/assets/{use-autosave-CDemMoSX.js → use-autosave-Bj9hC6ML.js} +1 -1
  72. package/dist/gateway/static/root/assets/{user-model-page-VXfz3rE7.js → user-model-page-DuYzuR1T.js} +1 -1
  73. package/dist/gateway/static/root/assets/{voice-api-key-field-CXArY4t5.js → voice-api-key-field-fWRD6B8r.js} +1 -1
  74. package/dist/gateway/static/root/assets/{work-discovery-overlay-Dk5KsKOm.js → work-discovery-overlay-CnxdvIk8.js} +1 -1
  75. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DNpdaI-2.js → workflow-run-setup-panel-DlWNN1VA.js} +1 -1
  76. package/dist/gateway/static/root/assets/{workflows-page-DDNDLdId.js → workflows-page-B45YDiEw.js} +1 -1
  77. package/dist/gateway/static/root/index.html +2 -2
  78. package/dist/package.js +1 -1
  79. package/dist/packages/gateway-contract/src/automations.js +15 -0
  80. package/dist/src/agent/agent-manager.js +4 -4
  81. package/dist/src/agent/background-review/run-background-review.js +1 -1
  82. package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -1
  83. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  84. package/dist/src/agent/image/tool-model-config.js +1 -1
  85. package/dist/src/agent/orchestration/agent-orchestrator.js +0 -21
  86. package/dist/src/agent/service.js +2 -2
  87. package/dist/src/agent/tools/xopc-use-tool.js +1 -1
  88. package/dist/src/agent-catalog/capabilities.js +2 -2
  89. package/dist/src/auth/credentials.js +1 -1
  90. package/dist/src/auth/oauth-provider-lock.js +1 -1
  91. package/dist/src/auth/sync-provider-auth.js +1 -1
  92. package/dist/src/automations/capabilities/drafts.js +1 -1
  93. package/dist/src/automations/capabilities/write.d.ts +17 -0
  94. package/dist/src/automations/capabilities/write.js +26 -2
  95. package/dist/src/automations/domain/defaults.js +1 -1
  96. package/dist/src/automations/domain/index.js +2 -2
  97. package/dist/src/automations/domain/types.d.ts +22 -0
  98. package/dist/src/automations/domain/validation.d.ts +68 -0
  99. package/dist/src/automations/domain/validation.js +17 -1
  100. package/dist/src/automations/draft/automation-draft-validator.d.ts +9 -0
  101. package/dist/src/automations/draft/automation-draft-validator.js +1 -0
  102. package/dist/src/automations/index.js +2 -2
  103. package/dist/src/automations/service/action-executor.js +16 -0
  104. package/dist/src/automations/storage/automation-repository.js +4 -3
  105. package/dist/src/bootstrap/application-state.js +1 -1
  106. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  107. package/dist/src/capabilities/runtime/product.js +1 -1
  108. package/dist/src/chat-commands/agent-edit.js +1 -1
  109. package/dist/src/chat-commands/builtins/config.js +1 -1
  110. package/dist/src/cli/commands/agent.js +1 -1
  111. package/dist/src/cli/commands/agents.js +1 -1
  112. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  113. package/dist/src/cli/commands/models.js +1 -1
  114. package/dist/src/cli/commands/onboard/model.js +2 -2
  115. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  116. package/dist/src/config/index.js +4 -4
  117. package/dist/src/config/loader.js +2 -2
  118. package/dist/src/config/models-json.js +1 -1
  119. package/dist/src/config/schema.d.ts +4 -0
  120. package/dist/src/config/schema.js +5 -1
  121. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  122. package/dist/src/gateway/agents-admin.js +2 -2
  123. package/dist/src/gateway/file-path-classifier.js +1 -1
  124. package/dist/src/gateway/home-intelligence-automation-reconciler.d.ts +3 -0
  125. package/dist/src/gateway/home-intelligence-automation-reconciler.js +49 -0
  126. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  127. package/dist/src/gateway/hono/routes/config-patch/misc.js +18 -4
  128. package/dist/src/gateway/hono/routes/home.js +0 -1
  129. package/dist/src/gateway/hono/routes/notes.js +2 -2
  130. package/dist/src/gateway/hono/routes/projects.js +2 -2
  131. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  132. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  133. package/dist/src/gateway/hono/routes/update.js +6 -1
  134. package/dist/src/gateway/image-generation-setup.js +2 -2
  135. package/dist/src/gateway/lock.js +1 -1
  136. package/dist/src/gateway/memory-maintenance-automation-reconciler.js +17 -14
  137. package/dist/src/gateway/service.d.ts +1 -0
  138. package/dist/src/gateway/service.js +27 -5
  139. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  140. package/dist/src/home-intelligence/host.d.ts +1 -1
  141. package/dist/src/home-intelligence/host.js +1 -9
  142. package/dist/src/home-intelligence/notification.js +1 -1
  143. package/dist/src/home-intelligence/repository.d.ts +1 -1
  144. package/dist/src/infra/update-check.d.ts +8 -4
  145. package/dist/src/infra/update-check.js +43 -41
  146. package/dist/src/infra/update-startup.d.ts +7 -1
  147. package/dist/src/infra/update-startup.js +15 -6
  148. package/dist/src/local-apps/service.js +1 -1
  149. package/dist/src/memory-maintenance/index.js +2 -2
  150. package/dist/src/memory-maintenance/schedule.d.ts +0 -3
  151. package/dist/src/memory-maintenance/schedule.js +1 -8
  152. package/dist/src/providers/model-catalog-persistence.js +1 -1
  153. package/dist/src/storage/sqlite/migrations/208_automation_management.sql +2 -0
  154. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  155. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  156. package/dist/src/storage/sqlite/schema.js +1 -1
  157. package/dist/src/tasks/capabilities/read.js +2 -2
  158. package/dist/src/tasks/home-query-service.js +1 -0
  159. package/dist/src/tui/backends/embedded-backend.js +2 -2
  160. package/dist/src/tui/tui-commands.js +1 -1
  161. package/dist/src/tui/tui-startup-resources.js +1 -1
  162. package/dist/src/tui/tui.js +1 -1
  163. package/dist/src/user-context/config.d.ts +9 -0
  164. package/dist/src/user-context/config.js +13 -4
  165. package/dist/src/voice/realtime/persona-context.js +1 -1
  166. package/package.json +5 -5
  167. package/dist/gateway/static/root/assets/automations-workspace-C7VS-yb7.js +0 -7
  168. package/dist/gateway/static/root/assets/capabilities-sAZT4brT.js +0 -1
  169. package/dist/gateway/static/root/assets/settings-advanced-gate-DcOsdz78.js +0 -1
@@ -1,7 +1,7 @@
1
1
  import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
2
2
  import { init_paths, resolveModelsJsonPath } from "./paths.js";
3
- import { init_write_file_atomic, writeTextAtomicSync } from "../infra/write-file-atomic.js";
4
3
  import { ComputerProfileSchema, init_src } from "../../packages/computer-control-contract/src/index.js";
4
+ import { init_write_file_atomic, writeTextAtomicSync } from "../infra/write-file-atomic.js";
5
5
  import { init_model_policy, isComputerModel } from "../computer/model-policy.js";
6
6
  import { existsSync, readFileSync } from "fs";
7
7
  import { z } from "zod";
@@ -1360,6 +1360,10 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
1360
1360
  postCompactionSections: z.ZodDefault<z.ZodArray<z.ZodString>>;
1361
1361
  }, z.core.$strict>>;
1362
1362
  }, z.core.$strict>>;
1363
+ homeIntelligence: z.ZodDefault<z.ZodObject<{
1364
+ enabled: z.ZodDefault<z.ZodBoolean>;
1365
+ refreshOnContextChange: z.ZodDefault<z.ZodBoolean>;
1366
+ }, z.core.$strict>>;
1363
1367
  }, z.core.$strict>>;
1364
1368
  session: z.ZodDefault<z.ZodObject<{
1365
1369
  scope: z.ZodDefault<z.ZodEnum<{
@@ -1,9 +1,9 @@
1
1
  import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
2
+ import { ComputerConfigSchema, init_config } from "../computer/config.js";
2
3
  import { AgentModelsOverrideSchema, ImageGenerationRouteSchema, ModelRouteSchema } from "../agent-config/schema.js";
3
4
  import { resolveEffectiveAgentConfig } from "../agent-config/resolver.js";
4
5
  import { init_agent_config } from "../agent-config/index.js";
5
6
  import { AgentCatalogRepository, init_repository } from "../agent-catalog/repository.js";
6
- import { ComputerConfigSchema, init_config } from "../computer/config.js";
7
7
  import { DEFAULT_CONTEXT_COMPACTION_POLICY, UserContextConfigSchema, init_config as init_config$1 } from "../user-context/config.js";
8
8
  import { init_public_url, validatePublicUrl } from "./public-url.js";
9
9
  import { PlatformConfigSchema, init_contracts } from "../platform/contracts.js";
@@ -1052,6 +1052,10 @@ workDiscoveryOnboarding: z.boolean().default(true) }).strict().default({ workDis
1052
1052
  maxKnowledge: 12,
1053
1053
  maxChars: 6e3,
1054
1054
  compaction: DEFAULT_CONTEXT_COMPACTION_POLICY
1055
+ },
1056
+ homeIntelligence: {
1057
+ enabled: true,
1058
+ refreshOnContextChange: true
1055
1059
  }
1056
1060
  },
1057
1061
  session: {
@@ -1,8 +1,8 @@
1
1
  import { dirname, isAbsolute, join, relative, resolve } from "node:path";
2
2
  import { existsSync, lstatSync, readFileSync, readdirSync, realpathSync, statSync } from "node:fs";
3
3
  import { z } from "zod";
4
- import yaml from "js-yaml";
5
4
  import { validateHeaderName, validateHeaderValue } from "node:http";
5
+ import yaml from "js-yaml";
6
6
  //#region src/extensions/agent-plugins/validation.ts
7
7
  const PLUGIN_SCHEMA = "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json";
8
8
  const MCP_SCHEMA = "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json";
@@ -1,11 +1,11 @@
1
1
  import { normalizeAgentId, validateAgentIdForNewAgent } from "../agent-catalog/id.js";
2
2
  import { AgentCatalogRepository, init_repository } from "../agent-catalog/repository.js";
3
3
  import { init_agent_scope, listAgentEntries, resolveAgentProfileDir, resolveAgentWorkspaceDir, resolveDefaultAgentId, resolveUserPath } from "../agent/agent-scope.js";
4
+ import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
4
5
  import { WORKSPACE_FILES, init_paths } from "../config/paths.js";
5
6
  import { AGENT_PROFILE_MARKDOWN_SYSTEM_FILES, REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET } from "../agent/context/workspace.js";
6
- import { AgentCatalogService } from "../agent-catalog/service.js";
7
- import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
8
7
  import { isPathUnderWorkspace, resolveWorkspaceSafePath } from "./workspace-editor-path.js";
8
+ import { AgentCatalogService } from "../agent-catalog/service.js";
9
9
  import { GATEWAY_BUILTIN_TOOL_IDS } from "./agent-builtin-tools.js";
10
10
  import { join, resolve } from "node:path";
11
11
  import { mkdir, readFile, realpath, stat, unlink, writeFile } from "node:fs/promises";
@@ -1,7 +1,7 @@
1
1
  import { init_paths_state, resolveStateDir } from "../config/paths-state.js";
2
2
  import { init_agent_scope, resolveAgentProfileDir } from "../agent/agent-scope.js";
3
- import { init_paths, resolveConfigPath, resolveSkillsDir } from "../config/paths.js";
4
3
  import { extractProfileAgentId } from "../config/agent-profile.js";
4
+ import { init_paths, resolveConfigPath, resolveSkillsDir } from "../config/paths.js";
5
5
  import { isBareProfileMarkdownFileName, resolveProfileMarkdownPathIfBareName } from "../agent/tools/tool-paths.js";
6
6
  import { isPathUnderWorkspace, resolveWorkspaceSafePath } from "./workspace-editor-path.js";
7
7
  import { basename, isAbsolute, resolve } from "node:path";
@@ -0,0 +1,3 @@
1
+ import type { AutomationService } from '../automations/index.js';
2
+ export declare const HOME_ADVISOR_REFRESH_AUTOMATION_ID = "system-home-advisor-refresh";
3
+ export declare function reconcileHomeIntelligenceAutomation(automationService: AutomationService): Promise<'created' | 'updated' | 'unchanged'>;
@@ -0,0 +1,49 @@
1
+ //#region src/gateway/home-intelligence-automation-reconciler.ts
2
+ const HOME_ADVISOR_REFRESH_AUTOMATION_ID = "system-home-advisor-refresh";
3
+ async function reconcileHomeIntelligenceAutomation(automationService) {
4
+ const current = await automationService.get(HOME_ADVISOR_REFRESH_AUTOMATION_ID);
5
+ const managed = {
6
+ name: "Refresh Home AI suggestions",
7
+ description: "Re-evaluate Home suggestions from current workspace context.",
8
+ action: {
9
+ kind: "system",
10
+ capability: "home.advisor.refresh"
11
+ },
12
+ safety: { mode: "auto_apply" },
13
+ conversationMode: "new_session",
14
+ notificationPolicy: "none",
15
+ reliability: { disableAfterConsecutiveFailures: 3 },
16
+ management: {
17
+ owner: "home-intelligence",
18
+ editable: ["enabled", "trigger"],
19
+ runnable: true,
20
+ deletable: false
21
+ }
22
+ };
23
+ if (!current) {
24
+ await automationService.create({
25
+ id: HOME_ADVISOR_REFRESH_AUTOMATION_ID,
26
+ enabled: false,
27
+ trigger: {
28
+ kind: "schedule",
29
+ schedule: {
30
+ kind: "interval",
31
+ everyMs: 30 * 6e4,
32
+ anchorMs: Date.now()
33
+ }
34
+ },
35
+ ...managed
36
+ });
37
+ return "created";
38
+ }
39
+ const patch = {
40
+ ...managed,
41
+ enabled: current.enabled,
42
+ trigger: current.trigger
43
+ };
44
+ if (!Object.entries(patch).some(([key, value]) => JSON.stringify(current[key]) !== JSON.stringify(value))) return "unchanged";
45
+ await automationService.update(HOME_ADVISOR_REFRESH_AUTOMATION_ID, patch);
46
+ return "updated";
47
+ }
48
+ //#endregion
49
+ export { HOME_ADVISOR_REFRESH_AUTOMATION_ID, reconcileHomeIntelligenceAutomation };
@@ -1,8 +1,8 @@
1
1
  import { normalizeAgentId } from "../../../agent-catalog/id.js";
2
2
  import { AgentCatalogRepository, init_repository } from "../../../agent-catalog/repository.js";
3
+ import { ContextPlanningConfigSchema, KnowledgeMemoryConfigSchema, UserModelConfigSchema, init_config } from "../../../user-context/config.js";
3
4
  import { init_agent_scope, listAgentEntries, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
4
5
  import { resolveModelsJsonPath } from "../../../config/paths.js";
5
- import { ContextPlanningConfigSchema, KnowledgeMemoryConfigSchema, UserModelConfigSchema, init_config } from "../../../user-context/config.js";
6
6
  import { init_models_json, loadModelsJson } from "../../../config/models-json.js";
7
7
  import { CredentialResolver, init_credentials } from "../../../auth/credentials.js";
8
8
  import { getProviderRegistry, init_plugin_registry } from "../../../providers/plugin-registry.js";
@@ -1,10 +1,10 @@
1
- import { BindingsSchema, init_binding_schema } from "../../../../routing/binding-schema.js";
2
- import { AgentCatalogService } from "../../../../agent-catalog/service.js";
3
1
  import { ComputerConfigSchema, init_config } from "../../../../computer/config.js";
4
- import { ContextPlanningConfigSchema, KnowledgeMemoryConfigSchema, UserContextConfigSchema, UserModelConfigSchema, init_config as init_config$1 } from "../../../../user-context/config.js";
2
+ import { BindingsSchema, init_binding_schema } from "../../../../routing/binding-schema.js";
3
+ import { ContextPlanningConfigSchema, HomeIntelligenceConfigSchema, KnowledgeMemoryConfigSchema, UserContextConfigSchema, UserModelConfigSchema, init_config as init_config$1 } from "../../../../user-context/config.js";
5
4
  import { BrowserConfigSchema, McpConfigSchema, VoiceConfigSchema, init_schema } from "../../../../config/schema.js";
6
5
  import { CredentialResolver, init_credentials } from "../../../../auth/credentials.js";
7
6
  import { canonicalizeConfiguredMcpServer } from "../../../../config/mcp-config-normalize.js";
7
+ import { AgentCatalogService } from "../../../../agent-catalog/service.js";
8
8
  import { mergeGatewaySkillsMarketplacePatch, mergeSessionConfigPatch, mergeUpdateConfigPatch } from "../../../../config/web-patch.js";
9
9
  import { assertGatewayAuthConfigured, resolveGatewayAuth } from "../../../auth.js";
10
10
  import { isMaskedSecretPatchValue } from "../../lib/mask-secret-length.js";
@@ -37,7 +37,8 @@ async function applyMiscPatch(config, body) {
37
37
  "preferences",
38
38
  "userModel",
39
39
  "knowledgeMemory",
40
- "contextPlanning"
40
+ "contextPlanning",
41
+ "homeIntelligence"
41
42
  ].includes(key));
42
43
  if (unknownKeys.length) return patchError(`Unknown userContext settings: ${unknownKeys.join(", ")}`);
43
44
  if (userContextPatch.enabled !== void 0) {
@@ -111,6 +112,19 @@ async function applyMiscPatch(config, body) {
111
112
  contextPlanning: parsed.data
112
113
  };
113
114
  }
115
+ if (userContextPatch.homeIntelligence !== void 0) {
116
+ const patch = userContextPatch.homeIntelligence;
117
+ if (typeof patch !== "object" || patch === null || Array.isArray(patch)) return patchError("userContext.homeIntelligence must be an object");
118
+ const parsed = HomeIntelligenceConfigSchema.safeParse({
119
+ ...config.userContext.homeIntelligence,
120
+ ...patch
121
+ });
122
+ if (!parsed.success) return patchError(parsed.error.issues.map((issue) => issue.message).join("; "));
123
+ config.userContext = {
124
+ ...config.userContext,
125
+ homeIntelligence: parsed.data
126
+ };
127
+ }
114
128
  const parsedUserContext = UserContextConfigSchema.safeParse(config.userContext);
115
129
  if (!parsedUserContext.success) return patchError(parsedUserContext.error.issues.map((issue) => issue.message).join("; "));
116
130
  config.userContext = parsedUserContext.data;
@@ -16,7 +16,6 @@ function registerHomeRoutes(authenticated, deps) {
16
16
  const home = new HomeQueryService(service, () => service.homeIntelligence.getAdvisor());
17
17
  authenticated.get("/api/home", async (c) => {
18
18
  const locale = c.req.query("locale");
19
- service.homeIntelligence.requestRefresh("home_opened", void 0, locale);
20
19
  return c.json(await home.getSnapshot(locale));
21
20
  });
22
21
  authenticated.get("/api/home/advisor/metrics", (c) => {
@@ -1,9 +1,9 @@
1
1
  import { NoteDeleteOutputSchema, NoteGetOutputSchema, ProductReadContracts } from "../../../../packages/gateway-contract/src/capabilities.js";
2
2
  import { init_src } from "../../../../packages/gateway-contract/src/index.js";
3
- import { CapabilityError } from "../../../capabilities/runtime/errors.js";
4
- import "../../../capabilities/runtime/dispatcher.js";
5
3
  import { init_session_key, resolveConversationId } from "../../../routing/session-key.js";
6
4
  import { agentExists, getDefaultAgentId, init_resolve_route } from "../../../routing/resolve-route.js";
5
+ import { CapabilityError } from "../../../capabilities/runtime/errors.js";
6
+ import "../../../capabilities/runtime/dispatcher.js";
7
7
  import { resolveGatewayEffectiveHost } from "../../../config/gateway-bind.js";
8
8
  import { getShareStore } from "../../../share/share-store.js";
9
9
  import { resolveShareUrl } from "../../../share/share-url.js";
@@ -7,12 +7,12 @@ import { loadTranscriptRowsForSession } from "../../../storage/sqlite/transcript
7
7
  import { init_sqlite } from "../../../storage/sqlite/index.js";
8
8
  import { ActivityService } from "../../../activity/service.js";
9
9
  import "../../../activity/index.js";
10
- import { CapabilityError } from "../../../capabilities/runtime/errors.js";
11
- import "../../../capabilities/runtime/dispatcher.js";
12
10
  import { resolveEffectiveAgentProfile } from "../../../config/agent-profile.js";
13
11
  import { TaskReadModelProjector } from "../../../tasks/task-read-model-projector.js";
14
12
  import { listKnowledgeItems, writeKnowledgeItem } from "../../../knowledge-memory/repository.js";
15
13
  import "../../../knowledge-memory/index.js";
14
+ import { CapabilityError } from "../../../capabilities/runtime/errors.js";
15
+ import "../../../capabilities/runtime/dispatcher.js";
16
16
  import { ProjectWorkspaceConflictError, ProjectWorkspaceMissingError } from "../../../projects/workspace-project.js";
17
17
  import { inferProjectExecutionMode, inferProjectKind } from "../../../projects/project-kind.js";
18
18
  import { ProjectDeletionBlockedError, ProjectWorkspaceInUseError } from "../../../projects/project-service.js";
@@ -4,9 +4,9 @@ import { parseUserTurnDocument, userTurnDocumentRefIds } from "../../../../packa
4
4
  import { browserPageContextsInputSchema } from "../../../../packages/gateway-contract/src/browser-page-context.js";
5
5
  import { init_src } from "../../../../packages/gateway-contract/src/index.js";
6
6
  import { endpointTurnClaimSchema, init_src as init_src$1 } from "../../../../packages/endpoint-tools-protocol/src/index.js";
7
+ import { init_providers, resolveModel } from "../../../providers/index.js";
7
8
  import { CapabilityError } from "../../../capabilities/runtime/errors.js";
8
9
  import "../../../capabilities/runtime/dispatcher.js";
9
- import { init_providers, resolveModel } from "../../../providers/index.js";
10
10
  import { validateWebchatAttachments, validateWebchatContent } from "../../chat-limits.js";
11
11
  import { isTaskDestructiveCommand } from "../../../session/reset-triggers.js";
12
12
  import { parseSlashCommand } from "../../../chat-commands/command-parse.js";
@@ -5,9 +5,9 @@ import { init_src } from "../../../../packages/gateway-contract/src/index.js";
5
5
  import { enqueueTaskChangedEvent, init_task_change_events } from "../../../tasks/task-change-events.js";
6
6
  import { TaskRepository, init_task_repository } from "../../../tasks/task-repository.js";
7
7
  import { TaskRunRepository, init_task_run_repository } from "../../../tasks/task-run-repository.js";
8
+ import { TaskConversationRepository } from "../../../tasks/task-conversation-repository.js";
8
9
  import { CapabilityError } from "../../../capabilities/runtime/errors.js";
9
10
  import "../../../capabilities/runtime/dispatcher.js";
10
- import { TaskConversationRepository } from "../../../tasks/task-conversation-repository.js";
11
11
  import { TaskContextMutationOutputSchema } from "../../../tasks/capabilities/relations.js";
12
12
  import { TaskDeleteOutputSchema } from "../../../tasks/capabilities/management.js";
13
13
  import { TaskMutationOutputSchema } from "../../../tasks/capabilities/write.js";
@@ -32,13 +32,18 @@ function registerUpdateRoutes(authenticated, deps) {
32
32
  });
33
33
  });
34
34
  authenticated.post("/api/update/check", strictRateLimitMiddleware, async (c) => {
35
- await runGatewayUpdateCheck({
35
+ const checkResult = await runGatewayUpdateCheck({
36
36
  config: loadConfig(service.getHealth().configPath),
37
37
  force: true,
38
38
  onUpdateAvailableChange: (update) => {
39
39
  service.emit("update.available", update);
40
40
  }
41
41
  });
42
+ if (checkResult.ok === false) return c.json({
43
+ ok: false,
44
+ error: "update-check-failed",
45
+ message: `Could not check npm for updates: ${checkResult.error}`
46
+ }, 502);
42
47
  const result = getUpdateAvailable();
43
48
  return c.json({
44
49
  ok: true,
@@ -1,11 +1,11 @@
1
1
  import { normalizeAgentId } from "../agent-catalog/id.js";
2
2
  import { AgentCatalogRepository, init_repository } from "../agent-catalog/repository.js";
3
- import { init_agent_scope } from "../agent/agent-scope.js";
4
- import { AgentCatalogService } from "../agent-catalog/service.js";
5
3
  import { ConfigSchema, init_schema } from "../config/schema.js";
4
+ import { init_agent_scope } from "../agent/agent-scope.js";
6
5
  import { resolveEffectiveAgentConfigForAgent } from "../config/agent-profile.js";
7
6
  import { fetchWithTimeoutGuarded } from "../media-shared/http/provider-http.js";
8
7
  import "../media-shared/http/index.js";
8
+ import { AgentCatalogService } from "../agent-catalog/service.js";
9
9
  import { getImageGenerationProvider, listImageGenerationProvidersSummary } from "../agent/image/generation/provider-registry.js";
10
10
  //#region src/gateway/image-generation-setup.ts
11
11
  init_repository();
@@ -1,8 +1,8 @@
1
1
  import path from "node:path";
2
2
  import fs from "node:fs";
3
3
  import { createHash } from "node:crypto";
4
- import fs$1 from "node:fs/promises";
5
4
  import net from "node:net";
5
+ import fs$1 from "node:fs/promises";
6
6
  import { homedir } from "os";
7
7
  //#region src/gateway/lock.ts
8
8
  /**
@@ -1,9 +1,6 @@
1
- import { normalizeAgentId } from "../agent-catalog/id.js";
2
- import { init_agent_scope, resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agent/agent-scope.js";
3
- import { maintenanceInstruction, resolveMemoryMaintenanceSchedules } from "../memory-maintenance/schedule.js";
1
+ import { resolveMemoryMaintenanceSchedules } from "../memory-maintenance/schedule.js";
4
2
  import "../memory-maintenance/index.js";
5
3
  //#region src/gateway/memory-maintenance-automation-reconciler.ts
6
- init_agent_scope();
7
4
  const AUTOMATION_IDS = [
8
5
  "system-memory-temporal-sweep",
9
6
  "system-memory-daily-reconciliation",
@@ -17,8 +14,6 @@ async function reconcileMemoryMaintenanceAutomations(input) {
17
14
  };
18
15
  const schedules = resolveMemoryMaintenanceSchedules(input.config);
19
16
  const enabledIds = new Set(schedules.map((item) => item.automationId));
20
- const agentId = normalizeAgentId(resolveDefaultAgentId());
21
- const workingDirectory = resolveAgentWorkspaceDir(agentId);
22
17
  for (const id of AUTOMATION_IDS) {
23
18
  if (enabledIds.has(id)) continue;
24
19
  if ((await input.automationService.get(id))?.enabled) {
@@ -36,11 +31,8 @@ async function reconcileMemoryMaintenanceAutomations(input) {
36
31
  }
37
32
  };
38
33
  const action = {
39
- kind: "agent",
40
- agentId,
41
- instruction: maintenanceInstruction(schedule.jobType),
42
- workingDirectory,
43
- timeoutSeconds: 300
34
+ kind: "system",
35
+ capability: `memory.${schedule.jobType}`
44
36
  };
45
37
  const next = {
46
38
  name: schedule.name,
@@ -51,7 +43,13 @@ async function reconcileMemoryMaintenanceAutomations(input) {
51
43
  safety: { mode: "auto_apply" },
52
44
  conversationMode: "continuous",
53
45
  notificationPolicy: "none",
54
- reliability: { disableAfterConsecutiveFailures: 3 }
46
+ reliability: { disableAfterConsecutiveFailures: 3 },
47
+ management: {
48
+ owner: "memory-maintenance",
49
+ editable: ["enabled", "trigger"],
50
+ runnable: true,
51
+ deletable: false
52
+ }
55
53
  };
56
54
  const current = await input.automationService.get(schedule.automationId);
57
55
  if (!current) {
@@ -62,8 +60,13 @@ async function reconcileMemoryMaintenanceAutomations(input) {
62
60
  result.created += 1;
63
61
  continue;
64
62
  }
65
- if (current.name !== next.name || current.description !== next.description || !current.enabled || JSON.stringify(current.trigger) !== JSON.stringify(trigger) || JSON.stringify(current.action) !== JSON.stringify(action) || current.safety?.mode !== "auto_apply" || current.notificationPolicy !== "none") {
66
- await input.automationService.update(schedule.automationId, next);
63
+ const reconciled = current.management ? {
64
+ ...next,
65
+ enabled: current.enabled,
66
+ trigger: current.trigger
67
+ } : next;
68
+ if (current.name !== reconciled.name || current.description !== next.description || current.enabled !== reconciled.enabled || JSON.stringify(current.trigger) !== JSON.stringify(reconciled.trigger) || JSON.stringify(current.action) !== JSON.stringify(action) || current.safety?.mode !== "auto_apply" || current.notificationPolicy !== "none" || JSON.stringify(current.management) !== JSON.stringify(next.management)) {
69
+ await input.automationService.update(schedule.automationId, reconciled);
67
70
  result.updated += 1;
68
71
  }
69
72
  }
@@ -318,6 +318,7 @@ export declare class GatewayService {
318
318
  getEffectiveListenPort(): number;
319
319
  get automationServiceInstance(): AutomationService;
320
320
  private reconcileMemoryMaintenanceAutomations;
321
+ private executeSystemAutomationAction;
321
322
  get notesServiceInstance(): NotesService;
322
323
  get sessionIndexInstance(): SessionIndex;
323
324
  /** Shared workflow run orchestrator + session bridge (one instance per gateway). */
@@ -17,14 +17,14 @@ import { init_session_repository, listSessionMetadata, patchSessionMetadata } fr
17
17
  import { getSessionConfig, init_config_repository } from "../storage/sqlite/config-repository.js";
18
18
  import { init_sqlite } from "../storage/sqlite/index.js";
19
19
  import { normalizeAgentId } from "../agent-catalog/id.js";
20
- import { init_agent_scope, listAgentEntries, resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agent/agent-scope.js";
21
- import { init_paths, resolveConfigPath, resolveExtensionsDir } from "../config/paths.js";
22
20
  import { init_config, resolveKnowledgeReadPolicy } from "../user-context/config.js";
23
21
  import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
22
+ import { init_agent_scope, listAgentEntries, resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agent/agent-scope.js";
24
23
  import { init_agent_session_key, resolveAgentMainConversationId } from "../routing/agent-session-key.js";
25
24
  import { init_session_key, resolveConversationId, sanitizeSegment } from "../routing/session-key.js";
26
25
  import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
27
26
  import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
27
+ import { init_paths, resolveConfigPath, resolveExtensionsDir } from "../config/paths.js";
28
28
  import { prewarmModelRegistry } from "../providers/model-registry.js";
29
29
  import { init_providers, providers_exports } from "../providers/index.js";
30
30
  import { TaskConversationRepository } from "../tasks/task-conversation-repository.js";
@@ -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";
@@ -90,6 +92,7 @@ import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validate
90
92
  import { prepareAutomationAgentSession } from "./automation-agent-session.js";
91
93
  import { stopTailscaleExposure } from "./tailscale-lifecycle.js";
92
94
  import { getGatewayFileSpaceService } from "./file-space-service.js";
95
+ import { reconcileHomeIntelligenceAutomation } from "./home-intelligence-automation-reconciler.js";
93
96
  import { createBackgroundTask } from "../infra/background-task.js";
94
97
  import { buildTaskAgentContext } from "../agent/source-context/task-context.js";
95
98
  import { buildFileAgentContext } from "../agent/source-context/file-context.js";
@@ -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";
@@ -1,7 +1,7 @@
1
1
  import { AgentCatalogRepository, init_repository } from "../agent-catalog/repository.js";
2
- import { AgentCatalogService } from "../agent-catalog/service.js";
3
2
  import { getModelCatalogStore, init_model_catalog_store } from "../providers/model-catalog-store.js";
4
3
  import { compareCatalogModels } from "../providers/model-catalog-ranking.js";
4
+ import { AgentCatalogService } from "../agent-catalog/service.js";
5
5
  import { prepareUpdateGlobalDefaults } from "./global-defaults-admin.js";
6
6
  //#region src/gateway/xopc-cloud-capability-setup.ts
7
7
  init_repository();
@@ -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;
@@ -10,7 +10,6 @@ import { createHash } from "node:crypto";
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("home_opened") || reasons.includes("manual_refresh");
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 = 'home_opened' | 'manual_refresh' | 'project_changed' | 'task_changed' | 'conversation_changed' | 'connector_changed' | 'scheduled_refresh';
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
- }): Promise<{
33
- tag: string;
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 {};