@xopcai/xopc 0.0.217 → 0.0.218

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 (168) 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/{activity-store-D6trMTyZ.js → activity-store-DF2dYXG1.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CAQdFrcu.js → agent-avatar-dicebear-Dw9rF5o1.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agents-C6q_vDzP.js → agents-Dj86bHkl.js} +1 -1
  6. package/dist/gateway/static/root/assets/{api-B9pZAyMB.js → api-_H0Bam-t.js} +1 -1
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-DRsTwFbF.js → app-management-settings-panel-D-M6GN-8.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-B99NaPTf.js → appearance-settings-XDhmzdIc.js} +1 -1
  9. package/dist/gateway/static/root/assets/{apps-page-Dx66anqa.js → apps-page-sfO835uz.js} +1 -1
  10. package/dist/gateway/static/root/assets/{archive-plugin-BF0q7N24.js → archive-plugin-DZCOhXch.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-D1qmjGDo.js → attachment-load-Bjb0FH2B.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automations-page-Ccu4yRFa.js → automations-page-D4N3ZDhu.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automations-workspace-CHbA8d-P.js → automations-workspace-PptuZgoo.js} +1 -1
  14. package/dist/gateway/static/root/assets/{binary-plugins-DooqxEZz.js → binary-plugins-uXPt0s47.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-Dqg9kvb9.js → block-editor-gukkIEro.js} +1 -1
  16. package/dist/gateway/static/root/assets/{browser-settings-page-CpRc-9Jy.js → browser-settings-page-BoCmzMFV.js} +1 -1
  17. package/dist/gateway/static/root/assets/{browser-workflow-inputs-CsIh8ySc.js → browser-workflow-inputs-DAhdS-XZ.js} +1 -1
  18. package/dist/gateway/static/root/assets/{browser-workflows-page-BXQFxT0p.js → browser-workflows-page-LKjYzXS_.js} +1 -1
  19. package/dist/gateway/static/root/assets/{capabilities-settings-panel-C89FGECN.js → capabilities-settings-panel-DhkJsU8Z.js} +2 -2
  20. package/dist/gateway/static/root/assets/{capability-presets-api-BX9U0FRh.js → capability-presets-api-BBUkH833.js} +1 -1
  21. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-XT6WEz9E.js → capability-presets-settings-panel-Dm7T61fE.js} +1 -1
  22. package/dist/gateway/static/root/assets/{channel-recipient-api-CUBTQ0Bz.js → channel-recipient-api-E5mo8M3a.js} +1 -1
  23. package/dist/gateway/static/root/assets/{channels-settings-DhKk1oNT.js → channels-settings-dG6UFVqt.js} +1 -1
  24. package/dist/gateway/static/root/assets/channels-status-swr-DgJxfNyK.js +1 -0
  25. package/dist/gateway/static/root/assets/{chat-terminal-dock-CTbkTsc2.js → chat-terminal-dock-CT5yoSMD.js} +1 -1
  26. package/dist/gateway/static/root/assets/{connectors-page-BDn3HTzX.js → connectors-page-BC6Ft9SU.js} +1 -1
  27. package/dist/gateway/static/root/assets/{cron-expression-XzPZhzVM.js → cron-expression-BGNuaqvI.js} +1 -1
  28. package/dist/gateway/static/root/assets/date-picker-k7mkklMU.js +1 -0
  29. package/dist/gateway/static/root/assets/{dependency-picker-ndtb88_T.js → dependency-picker-DZVSgLXH.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-DZjW-7Tw.js → desktop-pet-p9EZyGzV.js} +1 -1
  31. package/dist/gateway/static/root/assets/{desktop-pet-settings-C7BLs783.js → desktop-pet-settings-Bw4cCFzI.js} +1 -1
  32. package/dist/gateway/static/root/assets/{directory-picker-path-field-BWiap88p.js → directory-picker-path-field-Cbst7IXR.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-debug-page-D7APnE3n.js → extension-debug-page-Cd4BMKm_.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-page-BhV5hz70.js → extension-page-CzEGCkOa.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-settings-page-BhbcGuiJ.js → extension-settings-page-C1PAKSy2.js} +1 -1
  36. package/dist/gateway/static/root/assets/{gateway-config-api-CUt9bIpL.js → gateway-config-api-Bch9vO6t.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-config-swr-BTH9HVUk.js → gateway-config-swr-DNrttVr2.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-settings-RafSECLG.js → gateway-settings-DkDxZFGG.js} +1 -1
  39. package/dist/gateway/static/root/assets/{gateway-startup-retry-DAEk_tnd.js → gateway-startup-retry-B1vD3vRb.js} +1 -1
  40. package/dist/gateway/static/root/assets/{heartbeat-settings-CwVPlPLB.js → heartbeat-settings-DXNMxy5b.js} +1 -1
  41. package/dist/gateway/static/root/assets/{home-page-CbdBcCwC.js → home-page-CYcpVFNT.js} +1 -1
  42. package/dist/gateway/static/root/assets/{image-generation-api-HqcQrSed.js → image-generation-api-BTR0Wk_k.js} +1 -1
  43. package/dist/gateway/static/root/assets/index-Dgb1R07E.css +2 -0
  44. package/dist/gateway/static/root/assets/{index-CMLkr37Y.js → index-DlOYwVFK.js} +49 -49
  45. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BG6lShzn.js → keyboard-shortcuts-settings-CYlS4RGA.js} +1 -1
  46. package/dist/gateway/static/root/assets/{local-app-workbench-page-DdaPtQ5M.js → local-app-workbench-page-BFrgPwGE.js} +2 -2
  47. package/dist/gateway/static/root/assets/{local-apps-page-vaz8ewe2.js → local-apps-page-CNppYVew.js} +1 -1
  48. package/dist/gateway/static/root/assets/{locale-store-De8wYkd7.js → locale-store-gf9Bg2gb.js} +1 -1
  49. package/dist/gateway/static/root/assets/{logs-page-CjxMHTQO.js → logs-page-CPweLw3k.js} +1 -1
  50. package/dist/gateway/static/root/assets/{management-settings-tqTGCHt0.js → management-settings-IYk9xLgt.js} +1 -1
  51. package/dist/gateway/static/root/assets/{markdown-split-BGx8Aao0.js → markdown-split-D8e6pRMH.js} +1 -1
  52. package/dist/gateway/static/root/assets/{markdown-view-ybRARsPs.js → markdown-view-D0fiJjBQ.js} +1 -1
  53. package/dist/gateway/static/root/assets/{media-plugins-xbM-SSP5.js → media-plugins-CCq6TtEf.js} +1 -1
  54. package/dist/gateway/static/root/assets/messages-B9WQcZ1V.js +3 -0
  55. package/dist/gateway/static/root/assets/{notes-api-D9CCwyWK.js → notes-api-BBtWnlUU.js} +1 -1
  56. package/dist/gateway/static/root/assets/{notes-page-CMNBbg6g.js → notes-page-BKe1xa3U.js} +1 -1
  57. package/dist/gateway/static/root/assets/{notes-workbench-V9C-8vSn.js → notes-workbench-wieRAd1y.js} +2 -2
  58. package/dist/gateway/static/root/assets/{page-tabs-e99j9S9K.js → page-tabs-Bsluqyfb.js} +1 -1
  59. package/dist/gateway/static/root/assets/{preview-open-alternatives-DW9MDOva.js → preview-open-alternatives-BrpTWv44.js} +1 -1
  60. package/dist/gateway/static/root/assets/{product-open-page-CZdzgPZW.js → product-open-page-DXe5iWI6.js} +1 -1
  61. package/dist/gateway/static/root/assets/{project-detail-page-DHmAUggu.js → project-detail-page-Cww6V7HJ.js} +1 -1
  62. package/dist/gateway/static/root/assets/{projects-page-D0EiN69Y.js → projects-page-D0LKhCCw.js} +1 -1
  63. package/dist/gateway/static/root/assets/{registry-api-DYmKEwiG.js → registry-api-xj5gOva_.js} +1 -1
  64. package/dist/gateway/static/root/assets/{remote-access-hub-BuAVFk2O.js → remote-access-hub-Sf4Pde6Z.js} +1 -1
  65. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DQ12tLCL.js → runtime-tools-settings-panel-BJTvmBCA.js} +1 -1
  66. package/dist/gateway/static/root/assets/{schema-form-DNCDIkqC.js → schema-form-DvGBa_7R.js} +1 -1
  67. package/dist/gateway/static/root/assets/{sessions-page-hzlTfgOl.js → sessions-page-S5gvgfu5.js} +1 -1
  68. package/dist/gateway/static/root/assets/settings-advanced-gate-B3XvdEy8.js +1 -0
  69. package/dist/gateway/static/root/assets/{settings-form-section-z0JH53Fu.js → settings-form-section-CiGFtdD8.js} +1 -1
  70. package/dist/gateway/static/root/assets/{settings-loading-skeleton-xgo41cfo.js → settings-loading-skeleton-sbef7GTm.js} +1 -1
  71. package/dist/gateway/static/root/assets/{settings-page-8astk_1U.js → settings-page-BNGxxXZe.js} +1 -1
  72. package/dist/gateway/static/root/assets/{setup-status-panel-fZQfoJAk.js → setup-status-panel-CGU_Mxjr.js} +1 -1
  73. package/dist/gateway/static/root/assets/{share-preview-page-BBZV4AGy.js → share-preview-page-C1523ij3.js} +1 -1
  74. package/dist/gateway/static/root/assets/{shares-settings-B5dPMq3Y.js → shares-settings-k0UQ8WxO.js} +1 -1
  75. package/dist/gateway/static/root/assets/skill-reload-api-DQ1GvL1w.js +1 -0
  76. package/dist/gateway/static/root/assets/{skills-page-BSN2VaqR.js → skills-page-OuHd9GcN.js} +1 -1
  77. package/dist/gateway/static/root/assets/{skills-page.utils-HmoDhJVh.js → skills-page.utils-Ditgz7Vo.js} +1 -1
  78. package/dist/gateway/static/root/assets/{system-settings-panel-CSibO8vj.js → system-settings-panel-CERqCsz2.js} +1 -1
  79. package/dist/gateway/static/root/assets/tab-completion-input-D64VNmiA.js +1 -0
  80. package/dist/gateway/static/root/assets/tab-completion-input.utils-BP3NH_du.js +1 -0
  81. package/dist/gateway/static/root/assets/{task-detail-page-HCKZ11E8.js → task-detail-page-BnRNL2sn.js} +1 -1
  82. package/dist/gateway/static/root/assets/{theme-store-STx6jo38.js → theme-store-DgSjes3O.js} +1 -1
  83. package/dist/gateway/static/root/assets/{typed-models-lib-zrYg51t3.js → typed-models-lib-abEJNkCO.js} +1 -1
  84. package/dist/gateway/static/root/assets/{use-autosave-CqFVx92z.js → use-autosave-Bp_qFZkl.js} +1 -1
  85. package/dist/gateway/static/root/assets/user-context-page-Cnkaiky5.js +1 -0
  86. package/dist/gateway/static/root/assets/{voice-api-key-field-pYDiKKMo.js → voice-api-key-field-hbzDfErG.js} +1 -1
  87. package/dist/gateway/static/root/assets/{work-discovery-overlay-LJLw9zf0.js → work-discovery-overlay-DZVib-04.js} +1 -1
  88. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-D0WhQ3kI.js → workflow-run-setup-panel-C2RKay1p.js} +1 -1
  89. package/dist/gateway/static/root/assets/workflows-page-B_VlcKiK.js +5 -0
  90. package/dist/gateway/static/root/index.html +11 -11
  91. package/dist/package.js +1 -1
  92. package/dist/src/agent/agent-manager.js +4 -4
  93. package/dist/src/agent/background-review/prompts.d.ts +1 -1
  94. package/dist/src/agent/background-review/prompts.js +4 -1
  95. package/dist/src/agent/embedded/model-runtime.js +1 -1
  96. package/dist/src/agent/embedded/run-for-session.js +1 -1
  97. package/dist/src/agent/image/tool-model-config.js +1 -1
  98. package/dist/src/agent/ipc/inbox.js +1 -1
  99. package/dist/src/agent/memory/create-memory-manager.js +1 -1
  100. package/dist/src/agent/service.js +2 -2
  101. package/dist/src/agent/session/session-inspector.js +1 -1
  102. package/dist/src/agent/skills/hub-lock.js +1 -1
  103. package/dist/src/agent/tasks/task-judge-service.js +3 -3
  104. package/dist/src/agent-runtime/index.js +1 -1
  105. package/dist/src/agent-runtime/runtime-profile.js +1 -1
  106. package/dist/src/ai-assist/text-assist.js +1 -1
  107. package/dist/src/auth/credentials.js +2 -2
  108. package/dist/src/auth/profiles/store.js +1 -1
  109. package/dist/src/auth/sync-provider-auth.js +2 -2
  110. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  111. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  112. package/dist/src/cli/commands/models.js +1 -1
  113. package/dist/src/config/agent-profile.js +1 -1
  114. package/dist/src/config/index.js +4 -4
  115. package/dist/src/config/loader.js +1 -1
  116. package/dist/src/config/models-json.js +1 -1
  117. package/dist/src/connectors/connected-source-ingestion.js +21 -4
  118. package/dist/src/connectors/connected-source-normalizers.js +51 -4
  119. package/dist/src/connectors/connected-source-understanding.d.ts +19 -0
  120. package/dist/src/connectors/connected-source-understanding.js +132 -0
  121. package/dist/src/connectors/content-enrichment.d.ts +1 -0
  122. package/dist/src/connectors/content-enrichment.js +11 -7
  123. package/dist/src/connectors/learning-coordinator.js +55 -4
  124. package/dist/src/connectors/learning-recipes.js +2 -2
  125. package/dist/src/document-understanding/extract.d.ts +1 -1
  126. package/dist/src/document-understanding/extract.js +54 -1
  127. package/dist/src/extensions/lockfile.js +1 -1
  128. package/dist/src/gateway/agents-admin.js +2 -2
  129. package/dist/src/gateway/file-path-classifier.js +1 -1
  130. package/dist/src/gateway/heartbeat/service.js +1 -1
  131. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  132. package/dist/src/gateway/hono/routes/models.js +1 -1
  133. package/dist/src/gateway/hono/routes/understanding-sources.js +25 -7
  134. package/dist/src/gateway/hono/routes/workflows.js +2 -2
  135. package/dist/src/gateway/rate-limit/buckets.d.ts +1 -1
  136. package/dist/src/gateway/rate-limit/buckets.js +2 -2
  137. package/dist/src/gateway/service/config-coordinator.js +1 -1
  138. package/dist/src/gateway/service.js +9 -9
  139. package/dist/src/heartbeat/index.js +1 -1
  140. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  141. package/dist/src/providers/index.js +2 -2
  142. package/dist/src/providers/model-registry.js +1 -1
  143. package/dist/src/providers/register-runtime-providers.js +1 -1
  144. package/dist/src/tui/tui-startup-resources.js +1 -1
  145. package/dist/src/tui/tui.js +1 -1
  146. package/dist/src/user-context/sources/catalog.js +9 -2
  147. package/dist/src/user-context/sources/local-source-contract.d.ts +1 -1
  148. package/dist/src/user-context/sources/local-source-contract.js +1 -0
  149. package/dist/src/user-context/understanding-writing.d.ts +1 -0
  150. package/dist/src/user-context/understanding-writing.js +4 -0
  151. package/dist/src/work-discovery/analyzer.d.ts +6 -0
  152. package/dist/src/work-discovery/analyzer.js +181 -57
  153. package/dist/src/work-discovery/index.js +1 -1
  154. package/dist/src/work-discovery/probe.js +20 -0
  155. package/dist/src/work-discovery/service.d.ts +9 -0
  156. package/dist/src/work-discovery/service.js +18 -6
  157. package/dist/src/work-discovery/types.d.ts +5 -0
  158. package/dist/src/workflows/service/workflow-run-service.js +1 -1
  159. package/package.json +3 -3
  160. package/dist/gateway/static/root/assets/channels-status-swr-CiwOOoVL.js +0 -1
  161. package/dist/gateway/static/root/assets/date-picker-BmZjs4Bq.js +0 -1
  162. package/dist/gateway/static/root/assets/index-AbNnQyKk.css +0 -2
  163. package/dist/gateway/static/root/assets/messages-VI9m1xJl.js +0 -3
  164. package/dist/gateway/static/root/assets/settings-advanced-gate-BlCoA_9h.js +0 -1
  165. package/dist/gateway/static/root/assets/skill-reload-api-i1PGf1V2.js +0 -1
  166. package/dist/gateway/static/root/assets/tab-completion-input-B-VsxKhC.js +0 -1
  167. package/dist/gateway/static/root/assets/user-context-page-CqG56cDS.js +0 -1
  168. package/dist/gateway/static/root/assets/workflows-page-DQAJzV5w.js +0 -5
@@ -14,11 +14,14 @@ import { createUnderstandingSourceRun, listUnderstandingSourceRuns, updateUnders
14
14
  import { ConnectedUnderstandingPipeline } from "../knowledge/connected-understanding-pipeline.js";
15
15
  import "../knowledge/index.js";
16
16
  import { ingestComposioConnectedSource } from "./connected-source-ingestion.js";
17
+ import { deriveConnectedSourceUnderstanding } from "./connected-source-understanding.js";
18
+ import { listConnectedContentCandidates, readConnectedContent } from "./content-enrichment.js";
17
19
  //#region src/connectors/learning-coordinator.ts
18
20
  init_logger();
19
21
  const log = createLogger("ConnectorLearning");
20
22
  const CONNECTED_ACCOUNT_UNAVAILABLE = "connected_account_unavailable";
21
23
  const CONNECTED_SOURCE_SYNC_FAILED = "connected_source_sync_failed";
24
+ const CONNECTED_SOURCE_ANALYSIS_FAILED = "connected_source_analysis_failed";
22
25
  function learningFailureCode(error) {
23
26
  const message = error instanceof Error ? error.message : String(error);
24
27
  return message.includes("ToolRouterV2_InvalidConnectedAccountIds") || message.includes("Could not find connected account(s)") || message.includes("missing its provider identity") ? CONNECTED_ACCOUNT_UNAVAILABLE : CONNECTED_SOURCE_SYNC_FAILED;
@@ -178,6 +181,22 @@ function startConnectorLearningCoordinator(options) {
178
181
  itemsSeen += synced.itemsSeen;
179
182
  itemsIndexed += synced.itemsIndexed;
180
183
  }
184
+ const enrichmentErrors = [];
185
+ if (plan.toolkit === "googledrive") {
186
+ const candidates = listConnectedContentCandidates({
187
+ agentId: job.agentId,
188
+ sourceInstanceId: job.sourceInstanceId,
189
+ limit: 5
190
+ });
191
+ if (candidates.length) {
192
+ const enriched = await readConnectedContent({
193
+ agentId: job.agentId,
194
+ sourceItemIds: candidates.map((candidate) => candidate.sourceItemId)
195
+ });
196
+ enrichmentErrors.push(...enriched.failed.map((failure) => failure.error));
197
+ itemsIndexed += enriched.completed;
198
+ }
199
+ }
181
200
  if (listConnectorLearningJobs({
182
201
  accountId: job.accountId,
183
202
  limit: 100
@@ -199,22 +218,54 @@ function startConnectorLearningCoordinator(options) {
199
218
  evidenceRefs: [`connector-account:${job.accountId}`],
200
219
  sourceRunId: sourceRun.id
201
220
  });
221
+ let semantic = {
222
+ created: 0,
223
+ focusCount: 0,
224
+ status: "completed"
225
+ };
226
+ try {
227
+ semantic = await deriveConnectedSourceUnderstanding({
228
+ config: options.getConfig(),
229
+ agentId: job.agentId,
230
+ sourceInstanceId: job.sourceInstanceId,
231
+ sourceRunId: sourceRun.id,
232
+ memoryManager: options.getMemoryManager()
233
+ });
234
+ } catch (error) {
235
+ const errorMessage = error instanceof Error ? error.message : String(error);
236
+ semantic = {
237
+ created: 0,
238
+ focusCount: 0,
239
+ status: "failed",
240
+ error: CONNECTED_SOURCE_ANALYSIS_FAILED
241
+ };
242
+ log.warn({
243
+ err: error,
244
+ jobId: job.id,
245
+ connectorId: job.connectorId
246
+ }, `Connected source semantic analysis failed: ${errorMessage}`);
247
+ }
248
+ const candidatesCreated = understanding.created + semantic.created + semantic.focusCount;
249
+ const incomplete = enrichmentErrors.length > 0 || semantic.status !== "completed";
202
250
  const completed = updateConnectorLearningJob(job.id, {
203
251
  status: "completed",
204
252
  phase: "completed",
205
- candidatesCreated: understanding.created,
253
+ candidatesCreated,
206
254
  nextRunAt: null,
207
255
  finished: true
208
256
  });
209
257
  updateUnderstandingSourceRun(sourceRun.id, {
210
- status: "completed",
258
+ status: incomplete ? "partial" : "completed",
211
259
  itemsSeen,
212
260
  cursorAfter: (/* @__PURE__ */ new Date()).toISOString(),
213
261
  completed: true,
214
262
  metadata: {
215
263
  ...sourceRun.metadata,
216
264
  itemsIndexed,
217
- candidatesCreated: understanding.created
265
+ candidatesCreated,
266
+ semanticStatus: semantic.status,
267
+ ...semantic.error ? { semanticError: semantic.error } : {},
268
+ ...enrichmentErrors.length ? { enrichmentFailureCount: enrichmentErrors.length } : {}
218
269
  }
219
270
  });
220
271
  updateUnderstandingSourceGrantCheckpoint(sourceRun.grantId, {
@@ -258,7 +309,7 @@ function startConnectorLearningCoordinator(options) {
258
309
  const definition = getConnectorDefinition(job.connectorId);
259
310
  if (definition?.runtime.type === "composio" && definition.runtime.role === "toolkit") updateUnderstandingSourceRun(ensureUnderstandingSourceRun(job, definition.runtime.toolkit, definition.displayName).id, {
260
311
  status: "failed",
261
- errorMessage,
312
+ errorMessage: learningFailureCode(err),
262
313
  completed: true
263
314
  });
264
315
  log.warn({
@@ -43,8 +43,8 @@ const PLANS = {
43
43
  actionId: "GMAIL_FETCH_EMAILS",
44
44
  kind: "activity",
45
45
  arguments: {
46
- max_results: 100,
47
- include_payload: false,
46
+ max_results: 30,
47
+ include_payload: true,
48
48
  verbose: false,
49
49
  query: "newer_than:30d -in:spam -in:trash"
50
50
  }
@@ -1,7 +1,7 @@
1
1
  export type DocumentExtractionResult = {
2
2
  ok: true;
3
3
  text: string;
4
- kind: 'plain' | 'pdf';
4
+ kind: 'plain' | 'pdf' | 'office';
5
5
  } | {
6
6
  ok: false;
7
7
  reason: string;
@@ -1,6 +1,9 @@
1
1
  import { extname } from "node:path";
2
+ import AdmZip from "adm-zip";
2
3
  //#region src/document-understanding/extract.ts
3
4
  const MAX_EXTRACTED_CHARS = 6e4;
5
+ const MAX_OFFICE_XML_BYTES = 8 * 1024 * 1024;
6
+ const MAX_OFFICE_TOTAL_XML_BYTES = 16 * 1024 * 1024;
4
7
  function truncate(text) {
5
8
  return text.length > MAX_EXTRACTED_CHARS ? `${text.slice(0, MAX_EXTRACTED_CHARS)}\n\n[document extraction truncated ${text.length - MAX_EXTRACTED_CHARS} chars]` : text;
6
9
  }
@@ -43,11 +46,61 @@ function extractPdfText(buffer) {
43
46
  text: truncate(text)
44
47
  };
45
48
  }
49
+ function decodeXmlText(value) {
50
+ return value.replaceAll("&amp;", "&").replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&quot;", "\"").replaceAll("&apos;", "'");
51
+ }
52
+ function officeXmlText(buffer, extension) {
53
+ let zip;
54
+ try {
55
+ zip = new AdmZip(buffer);
56
+ } catch {
57
+ return {
58
+ ok: false,
59
+ reason: "Office document archive is invalid."
60
+ };
61
+ }
62
+ const prefixes = extension === ".docx" ? ["word/document.xml"] : extension === ".pptx" ? ["ppt/slides/"] : ["xl/sharedStrings.xml", "xl/worksheets/"];
63
+ const entries = zip.getEntries().filter((entry) => !entry.isDirectory && entry.header.size <= MAX_OFFICE_XML_BYTES && prefixes.some((prefix) => entry.entryName.startsWith(prefix))).sort((left, right) => left.entryName.localeCompare(right.entryName));
64
+ const parts = [];
65
+ let extractedBytes = 0;
66
+ for (const entry of entries) {
67
+ if (extractedBytes + entry.header.size > MAX_OFFICE_TOTAL_XML_BYTES) break;
68
+ extractedBytes += entry.header.size;
69
+ const xml = entry.getData().toString("utf8");
70
+ for (const match of xml.matchAll(/<(?:w:t|a:t|t)(?:\s[^>]*)?>([\s\S]*?)<\/(?:w:t|a:t|t)>/g)) {
71
+ const text = decodeXmlText((match[1] ?? "").replace(/<[^>]+>/g, "")).trim();
72
+ if (text) parts.push(text);
73
+ }
74
+ }
75
+ const text = parts.join("\n").replace(/\n{3,}/g, "\n\n").trim();
76
+ return text ? {
77
+ ok: true,
78
+ kind: "office",
79
+ text: truncate(text)
80
+ } : {
81
+ ok: false,
82
+ reason: "Office document extraction found no readable text."
83
+ };
84
+ }
46
85
  function extractDocumentText(params) {
47
86
  const ext = extname(params.fileName).toLowerCase();
48
87
  const mime = params.mimeType?.toLowerCase() ?? "";
49
88
  if (mime === "application/pdf" || ext === ".pdf") return extractPdfText(params.buffer);
50
- if (mime.startsWith("text/")) return {
89
+ if ([
90
+ ".docx",
91
+ ".pptx",
92
+ ".xlsx"
93
+ ].includes(ext)) return officeXmlText(params.buffer, ext);
94
+ if (mime.startsWith("text/") || [
95
+ ".csv",
96
+ ".html",
97
+ ".json",
98
+ ".md",
99
+ ".rtf",
100
+ ".tsv",
101
+ ".txt",
102
+ ".xml"
103
+ ].includes(ext)) return {
51
104
  ok: true,
52
105
  kind: "plain",
53
106
  text: truncate(params.buffer.toString("utf8"))
@@ -1,7 +1,7 @@
1
1
  import { createLogger } from "../utils/logger/index.js";
2
2
  import { init_logger } from "../utils/logger.js";
3
- import { init_paths, resolveExtensionsDir, resolveExtensionsLockPath } from "../config/paths.js";
4
3
  import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
4
+ import { init_paths, resolveExtensionsDir, resolveExtensionsLockPath } from "../config/paths.js";
5
5
  import { dirname, join } from "path";
6
6
  import { existsSync } from "fs";
7
7
  import { mkdir, readFile } from "fs/promises";
@@ -1,7 +1,7 @@
1
- import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveAgentDir, resolveAgentProfileDir, resolveAgentWorkspaceDir, resolveDefaultAgentId, resolveUserPath, validateAgentIdForNewAgent } from "../agent/agent-scope.js";
2
1
  import { resolveCapabilityPresetLayer, resolveEffectiveAgentManifest } from "../agent-manifest/resolver.js";
3
- import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
2
+ import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveAgentDir, resolveAgentProfileDir, resolveAgentWorkspaceDir, resolveDefaultAgentId, resolveUserPath, validateAgentIdForNewAgent } from "../agent/agent-scope.js";
4
3
  import { WORKSPACE_FILES, init_paths } from "../config/paths.js";
4
+ import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
5
5
  import { AGENT_PROFILE_MARKDOWN_SYSTEM_FILES, REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET } from "../agent/context/workspace.js";
6
6
  import { isPathUnderWorkspace, resolveWorkspaceSafePath } from "./workspace-editor-path.js";
7
7
  import { seedAgentProfileMarkdownFiles } from "../agent/context/workspace-seed.js";
@@ -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 { extractProfileAgentId } from "../config/agent-profile.js";
4
3
  import { init_paths, resolveConfigPath, resolveSkillsDir } from "../config/paths.js";
4
+ import { extractProfileAgentId } from "../config/agent-profile.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";
@@ -1,9 +1,9 @@
1
1
  import { createLogger } from "../../utils/logger/index.js";
2
2
  import { init_logger } from "../../utils/logger.js";
3
3
  import { shouldSilence, stripHeartbeatToken } from "../../heartbeat/tokens.js";
4
- import { appendCronEventLines } from "../../heartbeat/event-prompt.js";
5
4
  import { isWithinActiveHours } from "../../heartbeat/active-hours.js";
6
5
  import { isHeartbeatContentEmpty } from "../../heartbeat/content-check.js";
6
+ import { appendCronEventLines } from "../../heartbeat/event-prompt.js";
7
7
  import { createHeartbeatWake } from "../../heartbeat/wake.js";
8
8
  import { resolveHeartbeatMdPath } from "../workspace-heartbeat-path.js";
9
9
  import { readFile } from "fs/promises";
@@ -1,9 +1,9 @@
1
1
  import { ContextCompactionPolicySchema, UserContextDreamingSchema, UserContextPrivacySchema, init_config } from "../../../user-context/config.js";
2
2
  import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
3
3
  import { resolveModelsJsonPath } from "../../../config/paths.js";
4
- import { buildChannelCatalogForConfig, buildChannelCatalogFromSnapshot, getChannelSetupStatus, init_channel_catalog_service } from "../../../channels/catalog/channel-catalog-service.js";
5
4
  import { init_models_json, loadModelsJson } from "../../../config/models-json.js";
6
5
  import { CredentialResolver, init_credentials } from "../../../auth/credentials.js";
6
+ import { buildChannelCatalogForConfig, buildChannelCatalogFromSnapshot, getChannelSetupStatus, init_channel_catalog_service } from "../../../channels/catalog/channel-catalog-service.js";
7
7
  import { getProviderRegistry, init_plugin_registry } from "../../../providers/plugin-registry.js";
8
8
  import { getAllProviders, init_providers, isProviderConfigured } from "../../../providers/index.js";
9
9
  import { normalizeConfiguredMcpServers } from "../../../config/mcp-config-normalize.js";
@@ -1,5 +1,5 @@
1
- import { resolveModelsJsonPath } from "../../../config/paths.js";
2
1
  import { init_resolve_config_value, testApiKeyResolution } from "../../../config/resolve-config-value.js";
2
+ import { resolveModelsJsonPath } from "../../../config/paths.js";
3
3
  import { init_models_json, loadModelsJson, saveModelsJson, validateModelsConfig } from "../../../config/models-json.js";
4
4
  import { getModelCatalogStore, init_model_catalog_store } from "../../../providers/model-catalog-store.js";
5
5
  import { getModelRegistry } from "../../../providers/model-registry.js";
@@ -2,7 +2,7 @@ import { deleteUnderstanding, listUnderstandingEvidence, listUnderstandings } fr
2
2
  import { getConnectorAccount } from "../../../storage/sqlite/connector-account-repository.js";
3
3
  import "../../../storage/sqlite/index.js";
4
4
  import { init_agent_scope, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
5
- import { deleteUserFocus, getUnderstandingSourceGrant, listUnderstandingSourceGrants, listUserFocuses, revokeUnderstandingSourceGrant, setUserFocusStatus } from "../../../user-context/sources/repository.js";
5
+ import { deleteUserFocus, getUnderstandingSourceGrant, listUnderstandingSourceGrants, listUnderstandingSourceRuns, listUserFocuses, revokeUnderstandingSourceGrant, setUserFocusStatus } from "../../../user-context/sources/repository.js";
6
6
  import { listConnectedContentCandidates, readConnectedContent } from "../../../connectors/content-enrichment.js";
7
7
  import { getWorkDiscoveryService } from "./work-discovery.js";
8
8
  import { listUnderstandingSourceDefinitions } from "../../../user-context/sources/catalog.js";
@@ -38,10 +38,17 @@ function registerUnderstandingSourceRoutes(authenticated, deps) {
38
38
  sources: listUnderstandingSourceDefinitions(platform)
39
39
  });
40
40
  });
41
- authenticated.get("/api/understanding/sources/grants", (c) => c.json({
42
- ok: true,
43
- grants: listUnderstandingSourceGrants({ includeRevoked: c.req.query("includeRevoked") === "true" })
44
- }));
41
+ authenticated.get("/api/understanding/sources/grants", (c) => {
42
+ const grants = listUnderstandingSourceGrants({ includeRevoked: c.req.query("includeRevoked") === "true" });
43
+ return c.json({
44
+ ok: true,
45
+ grants,
46
+ latestRuns: Object.fromEntries(grants.flatMap((grant) => {
47
+ const run = listUnderstandingSourceRuns(grant.id, 1)[0];
48
+ return run ? [[grant.id, run]] : [];
49
+ }))
50
+ });
51
+ });
45
52
  authenticated.get("/api/understanding/sources/content-candidates", (c) => {
46
53
  const agentId = resolveDefaultAgentId(deps.service.currentConfig);
47
54
  return c.json({
@@ -71,14 +78,25 @@ function registerUnderstandingSourceRoutes(authenticated, deps) {
71
78
  authenticated.delete("/api/understanding/sources/grants/:grantId", limited, (c) => {
72
79
  const current = getUnderstandingSourceGrant(c.req.param("grantId"));
73
80
  const accountId = typeof current?.config.accountId === "string" ? current.config.accountId : void 0;
81
+ const connectorId = typeof current?.config.connectorId === "string" ? current.config.connectorId : void 0;
82
+ const sourceInstanceId = accountId && connectorId ? `composio:${connectorId}:${accountId}` : void 0;
74
83
  const connectionId = accountId ? getConnectorAccount(accountId)?.currentConnectionId : void 0;
75
84
  if (connectionId) deps.service.setConnectorLearningPaused(connectionId, true);
76
85
  const grant = revokeUnderstandingSourceGrant(c.req.param("grantId"));
77
86
  if (grant && c.req.query("deleteDerived") === "true") {
78
87
  const activeGrantIds = new Set(listUnderstandingSourceGrants().map((item) => item.id));
88
+ const activeSourceInstanceIds = new Set(listUnderstandingSourceGrants().flatMap((item) => {
89
+ const activeAccountId = typeof item.config.accountId === "string" ? item.config.accountId : void 0;
90
+ const activeConnectorId = typeof item.config.connectorId === "string" ? item.config.connectorId : void 0;
91
+ return activeAccountId && activeConnectorId ? [`composio:${activeConnectorId}:${activeAccountId}`] : [];
92
+ }));
79
93
  for (const understanding of listUnderstandings()) {
80
- const grantEvidence = listUnderstandingEvidence(understanding.id).map((evidence) => /^understanding-source-grant:([^:]+):/.exec(evidence.sourceRef)?.[1]).filter((id) => Boolean(id));
81
- if (grantEvidence.includes(grant.id) && !grantEvidence.some((id) => id !== grant.id && activeGrantIds.has(id))) deleteUnderstanding(understanding.id);
94
+ const evidence = listUnderstandingEvidence(understanding.id);
95
+ const grantEvidence = evidence.map((evidence) => /^understanding-source-grant:([^:]+):/.exec(evidence.sourceRef)?.[1]).filter((id) => Boolean(id));
96
+ const connectorEvidence = evidence.map((item) => item.sourceInstanceId).filter((id) => Boolean(id));
97
+ const belongsToRevokedSource = grantEvidence.includes(grant.id) || Boolean(sourceInstanceId && connectorEvidence.includes(sourceInstanceId));
98
+ const hasActiveAlternative = grantEvidence.some((id) => id !== grant.id && activeGrantIds.has(id)) || connectorEvidence.some((id) => id !== sourceInstanceId && activeSourceInstanceIds.has(id));
99
+ if (belongsToRevokedSource && !hasActiveAlternative) deleteUnderstanding(understanding.id);
82
100
  }
83
101
  }
84
102
  return grant ? c.json({
@@ -7,10 +7,10 @@ import { messagesToClientHistory } from "../../../session/client-history.js";
7
7
  import "../../../workflows/domain/index.js";
8
8
  import { resolveWorkflowRunArtifactsDir } from "../../../workflows/store/paths.js";
9
9
  import { WorkflowDraftService } from "../../../workflows/draft/workflow-draft-service.js";
10
- import { WorkflowDraftConflictError, WorkflowDraftStore } from "../../../workflows/authoring/workflow-draft-store.js";
11
- import "../../../workflows/authoring/index.js";
12
10
  import "../../../workflows/draft/index.js";
13
11
  import { ProjectWorkflowPresetRepository } from "../../../workflows/project-presets/project-workflow-preset-repository.js";
12
+ import { WorkflowDraftConflictError, WorkflowDraftStore } from "../../../workflows/authoring/workflow-draft-store.js";
13
+ import "../../../workflows/authoring/index.js";
14
14
  import { basename, join } from "node:path";
15
15
  import { readFile, stat } from "node:fs/promises";
16
16
  //#region src/gateway/hono/routes/workflows.ts
@@ -50,7 +50,7 @@ declare class BucketRegistry {
50
50
  * config read.
51
51
  */
52
52
  authFailure(cfg: ResolvedAuthRateLimitConfig): FailureLimiter;
53
- /** Sensitive admin / mutation endpoints — 15 req / 60 s per client IP. */
53
+ /** Authenticated admin / mutation endpoints — 150 req / 60 s per client IP. */
54
54
  strictApi(): RateLimiter;
55
55
  /** Interactive chat actions — 180 req / 60 s per client IP. */
56
56
  chatApi(): RateLimiter;
@@ -75,10 +75,10 @@ var BucketRegistry = class {
75
75
  }
76
76
  return this.authFailureLimiter;
77
77
  }
78
- /** Sensitive admin / mutation endpoints — 15 req / 60 s per client IP. */
78
+ /** Authenticated admin / mutation endpoints — 150 req / 60 s per client IP. */
79
79
  strictApi() {
80
80
  if (!this.strictApiLimiter) this.strictApiLimiter = new RateLimiter({
81
- maxRequests: 15,
81
+ maxRequests: 150,
82
82
  windowMs: 6e4
83
83
  });
84
84
  return this.strictApiLimiter;
@@ -1,7 +1,7 @@
1
1
  import { createLogger } from "../../utils/logger/index.js";
2
2
  import { init_logger } from "../../utils/logger.js";
3
- import { loadConfig, saveConfig } from "../../config/loader.js";
4
3
  import { getModelRegistry } from "../../providers/model-registry.js";
4
+ import { loadConfig, saveConfig } from "../../config/loader.js";
5
5
  import { init_providers } from "../../providers/index.js";
6
6
  import { disposeAllSessionMcpRuntimes } from "../../agent/mcp/bundle-mcp-runtime.js";
7
7
  import { reloadImageGenerationProviders } from "../../agent/image/generation/provider-registry.js";
@@ -9,14 +9,14 @@ import { closeXopcDatabase, openXopcDatabase } from "../storage/sqlite/connectio
9
9
  import "../storage/sqlite/index.js";
10
10
  import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
11
11
  import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveDefaultAgentId } from "../agent/agent-scope.js";
12
- import { buildSessionKey, init_session_key, sanitizeSegment } from "../routing/session-key.js";
13
- import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
14
12
  import { init_paths, resolveAgentDir, resolveConfigPath, resolveExtensionsDir } from "../config/paths.js";
13
+ import { prewarmModelRegistry } from "../providers/model-registry.js";
15
14
  import { areExtensionsGloballyDisabled } from "../extensions/discover-extensions.js";
16
15
  import { buildExtensionMetadataSnapshot } from "../extensions/extension-metadata-snapshot.js";
17
16
  import { buildChannelCatalogForConfig, buildChannelCatalogFromSnapshot, init_channel_catalog_service } from "../channels/catalog/channel-catalog-service.js";
18
17
  import { loadConfig, saveConfig } from "../config/loader.js";
19
- import { prewarmModelRegistry } from "../providers/model-registry.js";
18
+ import { buildSessionKey, init_session_key, sanitizeSegment } from "../routing/session-key.js";
19
+ import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
20
20
  import { init_providers, providers_exports } from "../providers/index.js";
21
21
  import { TaskRepository } from "../tasks/task-repository.js";
22
22
  import { TaskConversationRepository } from "../tasks/task-conversation-repository.js";
@@ -50,18 +50,18 @@ import { registerClarifyBridge } from "./clarify-runtime.js";
50
50
  import { ChannelManager } from "../channels/manager.js";
51
51
  import { getWorkspacePath } from "../config/workspace-path-helpers.js";
52
52
  import "../config/index.js";
53
- import { ManagedComposioEventPoller } from "../connectors/composio-managed-events.js";
54
- import { startConnectedKnowledgeCoordinator } from "../knowledge/coordinator.js";
55
- import "../knowledge/index.js";
56
- import { startConnectorLearningCoordinator } from "../connectors/learning-coordinator.js";
57
- import { ConnectedSourceChangePublisher } from "../connectors/source-change-publisher.js";
58
- import { startConnectorSupervisor } from "../connectors/supervisor.js";
59
53
  import { DiscussionService } from "../discussions/service.js";
60
54
  import { DiscussionOrganizer } from "../discussions/organizer.js";
61
55
  import { DiscussionLiveWorker } from "../discussions/live-worker.js";
62
56
  import { DiscussionOrganizerWorker } from "../discussions/organizer-worker.js";
63
57
  import { DiscussionSealer } from "../discussions/sealer.js";
64
58
  import "../discussions/index.js";
59
+ import { ManagedComposioEventPoller } from "../connectors/composio-managed-events.js";
60
+ import { startConnectedKnowledgeCoordinator } from "../knowledge/coordinator.js";
61
+ import "../knowledge/index.js";
62
+ import { startConnectorLearningCoordinator } from "../connectors/learning-coordinator.js";
63
+ import { ConnectedSourceChangePublisher } from "../connectors/source-change-publisher.js";
64
+ import { startConnectorSupervisor } from "../connectors/supervisor.js";
65
65
  import { EndpointToolRuntime } from "../endpoint-tools/runtime.js";
66
66
  import "../endpoint-tools/index.js";
67
67
  import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
@@ -1,6 +1,6 @@
1
1
  import { DEFAULT_ACK_MAX_CHARS, HEARTBEAT_OK, NO_REPLY, shouldSilence, stripHeartbeatToken } from "./tokens.js";
2
- import { appendCronEventLines } from "./event-prompt.js";
3
2
  import { isWithinActiveHours } from "./active-hours.js";
4
3
  import { isHeartbeatContentEmpty } from "./content-check.js";
4
+ import { appendCronEventLines } from "./event-prompt.js";
5
5
  import { createHeartbeatWake } from "./wake.js";
6
6
  export { DEFAULT_ACK_MAX_CHARS, HEARTBEAT_OK, NO_REPLY, appendCronEventLines, createHeartbeatWake, isHeartbeatContentEmpty, isWithinActiveHours, shouldSilence, stripHeartbeatToken };
@@ -1,5 +1,5 @@
1
- import { init_sync_provider_auth, resolveProviderApiKeyForAgentSync } from "../../auth/sync-provider-auth.js";
2
1
  import { getApiKeyFromEnv, init_env_keys } from "../env-keys.js";
2
+ import { init_sync_provider_auth, resolveProviderApiKeyForAgentSync } from "../../auth/sync-provider-auth.js";
3
3
  import { getDefaultAuthProfileStore } from "./auth-profile-store.js";
4
4
  //#region src/providers/auth-runtime/resolve-auth.ts
5
5
  init_env_keys();
@@ -1,11 +1,11 @@
1
1
  import { __esmMin, __exportAll } from "../../_virtual/_rolldown/runtime.js";
2
2
  import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
3
- import { getOAuthProviderIds, init_registry } from "../auth/oauth/registry.js";
4
- import { hasProviderAuthOnDiskSync, init_sync_provider_auth } from "../auth/sync-provider-auth.js";
5
3
  import { PROVIDER_ENV_MAP, getApiKeyFromEnv, init_env_keys } from "./env-keys.js";
6
4
  import { init_model_ref, splitProviderModelRef } from "./model-ref.js";
7
5
  import { ModelRegistry, getModelRegistry, init_model_registry, prewarmModelRegistry, resetModelRegistry } from "./model-registry.js";
6
+ import { getOAuthProviderIds, init_registry } from "../auth/oauth/registry.js";
8
7
  import { CredentialResolver, hasCredentials, init_credentials } from "../auth/credentials.js";
8
+ import { hasProviderAuthOnDiskSync, init_sync_provider_auth } from "../auth/sync-provider-auth.js";
9
9
  import { EXTENSION_PROVIDER_BASE_URL, init_constants } from "./constants.js";
10
10
  import { applyOfficialModelMetadataCorrections, getSupplementalModels, init_model_supplements } from "./model-supplements.js";
11
11
  import { getProviderRegistry, init_plugin_registry } from "./plugin-registry.js";
@@ -1,8 +1,8 @@
1
1
  import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
2
2
  import { createLogger } from "../utils/logger/index.js";
3
3
  import { init_logger } from "../utils/logger.js";
4
- import { resolveModelsJsonPath } from "../config/paths.js";
5
4
  import { init_resolve_config_value, resolveConfigValue, resolveHeaders } from "../config/resolve-config-value.js";
5
+ import { resolveModelsJsonPath } from "../config/paths.js";
6
6
  import { getDefaultModelValues, init_models_json, validateModelsConfig } from "../config/models-json.js";
7
7
  import { getApiKeyFromEnv, init_env_keys } from "./env-keys.js";
8
8
  import { getModelCatalogStore, init_model_catalog_store } from "./model-catalog-store.js";
@@ -1,6 +1,6 @@
1
1
  import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
2
- import { getOAuthProviderDefinition, init_registry } from "../auth/oauth/registry.js";
3
2
  import { getModelCatalogStore, init_model_catalog_store } from "./model-catalog-store.js";
3
+ import { getOAuthProviderDefinition, init_registry } from "../auth/oauth/registry.js";
4
4
  import { XOPC_CLOUD_PROVIDER_ID, init_xopc_cloud_config, resolveXopcModelRouterUrl } from "./xopc-cloud-config.js";
5
5
  //#region src/providers/register-runtime-providers.ts
6
6
  function registerRuntimeProvider(modelRuntime, source) {
@@ -1,6 +1,6 @@
1
1
  import { resolveStateDir } from "../config/paths-state.js";
2
- import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
3
2
  import { init_paths, resolveAgentProfileDir, resolveBundledSkillsDir } from "../config/paths.js";
3
+ import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
4
4
  import { resolveBootstrapFilesSync } from "../agent/bootstrap/bootstrap-files.js";
5
5
  import { createSkillConfigManager, isSkillEnabled } from "../agent/skills/config.js";
6
6
  import { loadSkills } from "../agent/skills/index.js";
@@ -2,10 +2,10 @@ import { version } from "../../package.js";
2
2
  import { resolveStateDir, resolveXopcDatabasePath } from "../config/paths-state.js";
3
3
  import { parseAgentSessionKey } from "../routing/session-key-utils.js";
4
4
  import { init_agent_session_key, normalizeAgentId } from "../routing/agent-session-key.js";
5
- import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
6
5
  import { init_paths } from "../config/paths.js";
7
6
  import { loadConfig } from "../config/loader.js";
8
7
  import { getAllModels, getAllProviders, getApiKey, init_providers, isProviderConfiguredSync } from "../providers/index.js";
8
+ import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
9
9
  import { ProjectTrustStore, hasTrustRequiringProjectResources } from "../project-trust/trust-store.js";
10
10
  import { renderWorkflowFinalSummary, renderWorkflowPanel } from "../agent/workflow/snapshot.js";
11
11
  import { ensureStarterAgentsInitialized } from "../agent/starter-agents.js";
@@ -18,7 +18,7 @@ const COMMON = [
18
18
  category: "recent_documents",
19
19
  platform: "all",
20
20
  displayName: "Recent files",
21
- description: "Read-only metadata for recent documents on Desktop, Documents, and Downloads.",
21
+ description: "Bounded text from recent readable documents on Desktop, Documents, and Downloads.",
22
22
  availability: "available",
23
23
  permission: "not_requested",
24
24
  defaultAccessMode: "once",
@@ -114,6 +114,13 @@ const PLATFORM = {
114
114
  "Recent unlocked notes selected through macOS Automation",
115
115
  true
116
116
  ],
117
+ [
118
+ "apple-mail",
119
+ "mail",
120
+ "Apple Mail",
121
+ "Recent inbox and sent-message content selected through macOS Automation",
122
+ true
123
+ ],
117
124
  [
118
125
  "apple-calendar",
119
126
  "calendar",
@@ -138,7 +145,7 @@ const PLATFORM = {
138
145
  permission: "not_requested",
139
146
  defaultAccessMode: "once",
140
147
  supportedAccessModes: ["once"],
141
- recommended: category !== "notes",
148
+ recommended: category !== "notes" && category !== "mail",
142
149
  sensitive: Boolean(sensitive)
143
150
  })),
144
151
  win32: [{
@@ -1,3 +1,3 @@
1
- export declare const LOCAL_UNDERSTANDING_SOURCE_IDS: readonly ["local-recent-files", "chromium-bookmarks", "apple-notes", "apple-calendar", "apple-reminders", "windows-recent-documents", "linux-recent-documents"];
1
+ export declare const LOCAL_UNDERSTANDING_SOURCE_IDS: readonly ["local-recent-files", "chromium-bookmarks", "apple-notes", "apple-mail", "apple-calendar", "apple-reminders", "windows-recent-documents", "linux-recent-documents"];
2
2
  export type LocalUnderstandingSourceId = typeof LOCAL_UNDERSTANDING_SOURCE_IDS[number];
3
3
  export declare function isLocalUnderstandingSourceId(value: string): value is LocalUnderstandingSourceId;
@@ -3,6 +3,7 @@ const LOCAL_UNDERSTANDING_SOURCE_IDS = [
3
3
  "local-recent-files",
4
4
  "chromium-bookmarks",
5
5
  "apple-notes",
6
+ "apple-mail",
6
7
  "apple-calendar",
7
8
  "apple-reminders",
8
9
  "windows-recent-documents",
@@ -0,0 +1 @@
1
+ export declare const USER_FACING_UNDERSTANDING_WRITING_GUIDANCE = "Write each understanding as concise, neutral profile copy that can be shown directly to the person described, not as an internal note about \"the user\". Prefer a subject-omitted predicate or noun phrase. For example, write \u201C\u503E\u5411\u4F7F\u7528 pnpm \u4F5C\u4E3A\u5305\u7BA1\u7406\u5668\u201D or \u201Cxopc \u9879\u76EE\u7684\u6838\u5FC3\u5F00\u53D1\u8005\u201D, not \u201C\u7528\u6237\u503E\u5411\u4E8E\u4F7F\u7528 pnpm\u201D or \u201C\u7528\u6237\u662F xopc \u9879\u76EE\u7684\u5F00\u53D1\u8005\u201D; write \u201CPrefers pnpm as the package manager\u201D or \u201CCore maintainer of xopc\u201D, not \u201CThe user prefers pnpm\u201D or \u201CThe user is a maintainer of xopc\u201D. Do not begin with generic subject labels or pronouns such as \u201C\u7528\u6237\u201D, \u201C\u8BE5\u7528\u6237\u201D, \u201C\u6B64\u7528\u6237\u201D, \u201C\u4F60\u201D, \u201C\u6211\u201D, \u201Cthe user\u201D, \u201Cuser\u201D, \u201Cyou\u201D, or \u201CI\u201D.";
@@ -0,0 +1,4 @@
1
+ //#region src/user-context/understanding-writing.ts
2
+ const USER_FACING_UNDERSTANDING_WRITING_GUIDANCE = `Write each understanding as concise, neutral profile copy that can be shown directly to the person described, not as an internal note about "the user". Prefer a subject-omitted predicate or noun phrase. For example, write “倾向使用 pnpm 作为包管理器” or “xopc 项目的核心开发者”, not “用户倾向于使用 pnpm” or “用户是 xopc 项目的开发者”; write “Prefers pnpm as the package manager” or “Core maintainer of xopc”, not “The user prefers pnpm” or “The user is a maintainer of xopc”. Do not begin with generic subject labels or pronouns such as “用户”, “该用户”, “此用户”, “你”, “我”, “the user”, “user”, “you”, or “I”.`;
3
+ //#endregion
4
+ export { USER_FACING_UNDERSTANDING_WRITING_GUIDANCE };
@@ -10,6 +10,11 @@ export declare function analyzeWorkContext(input: {
10
10
  modelRef: string;
11
11
  result: WorkDiscoveryResult;
12
12
  }>;
13
+ export type UnderstandingSourceAnalysisStatus = {
14
+ sourceId: string;
15
+ status: 'completed' | 'partial' | 'failed';
16
+ error?: string;
17
+ };
13
18
  export declare function analyzeUnderstandingSources(input: {
14
19
  config: Config;
15
20
  items: UnderstandingSourceItem[];
@@ -19,5 +24,6 @@ export declare function analyzeUnderstandingSources(input: {
19
24
  modelRef: string;
20
25
  profileCandidates: WorkDiscoveryProfileCandidate[];
21
26
  workThreadCandidates: WorkUnderstandingThreadCandidate[];
27
+ sourceStatuses: UnderstandingSourceAnalysisStatus[];
22
28
  }>;
23
29
  export declare function workDiscoveryResultMarkdown(result: WorkDiscoveryResult): string;