@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.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-D6trMTyZ.js → activity-store-DF2dYXG1.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CAQdFrcu.js → agent-avatar-dicebear-Dw9rF5o1.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-C6q_vDzP.js → agents-Dj86bHkl.js} +1 -1
- package/dist/gateway/static/root/assets/{api-B9pZAyMB.js → api-_H0Bam-t.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DRsTwFbF.js → app-management-settings-panel-D-M6GN-8.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-B99NaPTf.js → appearance-settings-XDhmzdIc.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-Dx66anqa.js → apps-page-sfO835uz.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-BF0q7N24.js → archive-plugin-DZCOhXch.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-D1qmjGDo.js → attachment-load-Bjb0FH2B.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-Ccu4yRFa.js → automations-page-D4N3ZDhu.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-CHbA8d-P.js → automations-workspace-PptuZgoo.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-DooqxEZz.js → binary-plugins-uXPt0s47.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Dqg9kvb9.js → block-editor-gukkIEro.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-CpRc-9Jy.js → browser-settings-page-BoCmzMFV.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-CsIh8ySc.js → browser-workflow-inputs-DAhdS-XZ.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-BXQFxT0p.js → browser-workflows-page-LKjYzXS_.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-C89FGECN.js → capabilities-settings-panel-DhkJsU8Z.js} +2 -2
- package/dist/gateway/static/root/assets/{capability-presets-api-BX9U0FRh.js → capability-presets-api-BBUkH833.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-XT6WEz9E.js → capability-presets-settings-panel-Dm7T61fE.js} +1 -1
- package/dist/gateway/static/root/assets/{channel-recipient-api-CUBTQ0Bz.js → channel-recipient-api-E5mo8M3a.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-DhKk1oNT.js → channels-settings-dG6UFVqt.js} +1 -1
- package/dist/gateway/static/root/assets/channels-status-swr-DgJxfNyK.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-CTbkTsc2.js → chat-terminal-dock-CT5yoSMD.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-BDn3HTzX.js → connectors-page-BC6Ft9SU.js} +1 -1
- package/dist/gateway/static/root/assets/{cron-expression-XzPZhzVM.js → cron-expression-BGNuaqvI.js} +1 -1
- package/dist/gateway/static/root/assets/date-picker-k7mkklMU.js +1 -0
- package/dist/gateway/static/root/assets/{dependency-picker-ndtb88_T.js → dependency-picker-DZVSgLXH.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-DZjW-7Tw.js → desktop-pet-p9EZyGzV.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-C7BLs783.js → desktop-pet-settings-Bw4cCFzI.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BWiap88p.js → directory-picker-path-field-Cbst7IXR.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-D7APnE3n.js → extension-debug-page-Cd4BMKm_.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BhV5hz70.js → extension-page-CzEGCkOa.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BhbcGuiJ.js → extension-settings-page-C1PAKSy2.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-CUt9bIpL.js → gateway-config-api-Bch9vO6t.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-BTH9HVUk.js → gateway-config-swr-DNrttVr2.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-RafSECLG.js → gateway-settings-DkDxZFGG.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DAEk_tnd.js → gateway-startup-retry-B1vD3vRb.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-CwVPlPLB.js → heartbeat-settings-DXNMxy5b.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-CbdBcCwC.js → home-page-CYcpVFNT.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-HqcQrSed.js → image-generation-api-BTR0Wk_k.js} +1 -1
- package/dist/gateway/static/root/assets/index-Dgb1R07E.css +2 -0
- package/dist/gateway/static/root/assets/{index-CMLkr37Y.js → index-DlOYwVFK.js} +49 -49
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BG6lShzn.js → keyboard-shortcuts-settings-CYlS4RGA.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-DdaPtQ5M.js → local-app-workbench-page-BFrgPwGE.js} +2 -2
- package/dist/gateway/static/root/assets/{local-apps-page-vaz8ewe2.js → local-apps-page-CNppYVew.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-De8wYkd7.js → locale-store-gf9Bg2gb.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-CjxMHTQO.js → logs-page-CPweLw3k.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-tqTGCHt0.js → management-settings-IYk9xLgt.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-BGx8Aao0.js → markdown-split-D8e6pRMH.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-ybRARsPs.js → markdown-view-D0fiJjBQ.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-xbM-SSP5.js → media-plugins-CCq6TtEf.js} +1 -1
- package/dist/gateway/static/root/assets/messages-B9WQcZ1V.js +3 -0
- package/dist/gateway/static/root/assets/{notes-api-D9CCwyWK.js → notes-api-BBtWnlUU.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-CMNBbg6g.js → notes-page-BKe1xa3U.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-workbench-V9C-8vSn.js → notes-workbench-wieRAd1y.js} +2 -2
- package/dist/gateway/static/root/assets/{page-tabs-e99j9S9K.js → page-tabs-Bsluqyfb.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-DW9MDOva.js → preview-open-alternatives-BrpTWv44.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-CZdzgPZW.js → product-open-page-DXe5iWI6.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-DHmAUggu.js → project-detail-page-Cww6V7HJ.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-D0EiN69Y.js → projects-page-D0LKhCCw.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-DYmKEwiG.js → registry-api-xj5gOva_.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-BuAVFk2O.js → remote-access-hub-Sf4Pde6Z.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DQ12tLCL.js → runtime-tools-settings-panel-BJTvmBCA.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-DNCDIkqC.js → schema-form-DvGBa_7R.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-hzlTfgOl.js → sessions-page-S5gvgfu5.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-B3XvdEy8.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-z0JH53Fu.js → settings-form-section-CiGFtdD8.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-xgo41cfo.js → settings-loading-skeleton-sbef7GTm.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-8astk_1U.js → settings-page-BNGxxXZe.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-fZQfoJAk.js → setup-status-panel-CGU_Mxjr.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-BBZV4AGy.js → share-preview-page-C1523ij3.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-B5dPMq3Y.js → shares-settings-k0UQ8WxO.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DQ1GvL1w.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-BSN2VaqR.js → skills-page-OuHd9GcN.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-HmoDhJVh.js → skills-page.utils-Ditgz7Vo.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CSibO8vj.js → system-settings-panel-CERqCsz2.js} +1 -1
- package/dist/gateway/static/root/assets/tab-completion-input-D64VNmiA.js +1 -0
- package/dist/gateway/static/root/assets/tab-completion-input.utils-BP3NH_du.js +1 -0
- package/dist/gateway/static/root/assets/{task-detail-page-HCKZ11E8.js → task-detail-page-BnRNL2sn.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-STx6jo38.js → theme-store-DgSjes3O.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-zrYg51t3.js → typed-models-lib-abEJNkCO.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-CqFVx92z.js → use-autosave-Bp_qFZkl.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-Cnkaiky5.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-pYDiKKMo.js → voice-api-key-field-hbzDfErG.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-LJLw9zf0.js → work-discovery-overlay-DZVib-04.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-D0WhQ3kI.js → workflow-run-setup-panel-C2RKay1p.js} +1 -1
- package/dist/gateway/static/root/assets/workflows-page-B_VlcKiK.js +5 -0
- package/dist/gateway/static/root/index.html +11 -11
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +4 -4
- package/dist/src/agent/background-review/prompts.d.ts +1 -1
- package/dist/src/agent/background-review/prompts.js +4 -1
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/ipc/inbox.js +1 -1
- package/dist/src/agent/memory/create-memory-manager.js +1 -1
- package/dist/src/agent/service.js +2 -2
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +3 -3
- package/dist/src/agent-runtime/index.js +1 -1
- package/dist/src/agent-runtime/runtime-profile.js +1 -1
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +2 -2
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/connectors/connected-source-ingestion.js +21 -4
- package/dist/src/connectors/connected-source-normalizers.js +51 -4
- package/dist/src/connectors/connected-source-understanding.d.ts +19 -0
- package/dist/src/connectors/connected-source-understanding.js +132 -0
- package/dist/src/connectors/content-enrichment.d.ts +1 -0
- package/dist/src/connectors/content-enrichment.js +11 -7
- package/dist/src/connectors/learning-coordinator.js +55 -4
- package/dist/src/connectors/learning-recipes.js +2 -2
- package/dist/src/document-understanding/extract.d.ts +1 -1
- package/dist/src/document-understanding/extract.js +54 -1
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/understanding-sources.js +25 -7
- package/dist/src/gateway/hono/routes/workflows.js +2 -2
- package/dist/src/gateway/rate-limit/buckets.d.ts +1 -1
- package/dist/src/gateway/rate-limit/buckets.js +2 -2
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service.js +9 -9
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/user-context/sources/catalog.js +9 -2
- package/dist/src/user-context/sources/local-source-contract.d.ts +1 -1
- package/dist/src/user-context/sources/local-source-contract.js +1 -0
- package/dist/src/user-context/understanding-writing.d.ts +1 -0
- package/dist/src/user-context/understanding-writing.js +4 -0
- package/dist/src/work-discovery/analyzer.d.ts +6 -0
- package/dist/src/work-discovery/analyzer.js +181 -57
- package/dist/src/work-discovery/index.js +1 -1
- package/dist/src/work-discovery/probe.js +20 -0
- package/dist/src/work-discovery/service.d.ts +9 -0
- package/dist/src/work-discovery/service.js +18 -6
- package/dist/src/work-discovery/types.d.ts +5 -0
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/channels-status-swr-CiwOOoVL.js +0 -1
- package/dist/gateway/static/root/assets/date-picker-BmZjs4Bq.js +0 -1
- package/dist/gateway/static/root/assets/index-AbNnQyKk.css +0 -2
- package/dist/gateway/static/root/assets/messages-VI9m1xJl.js +0 -3
- package/dist/gateway/static/root/assets/settings-advanced-gate-BlCoA_9h.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-i1PGf1V2.js +0 -1
- package/dist/gateway/static/root/assets/tab-completion-input-B-VsxKhC.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-CqG56cDS.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-DQAJzV5w.js +0 -5
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const MEMORY_REVIEW_USER_PROMPT = "Review the conversation above and identify durable user-understanding candidates.\n\nFocus on:\n1. Has the user revealed things about themselves \u2014 persona, desires, preferences, or personal details worth remembering?\n2. Has the user expressed expectations about how you should behave, their work style, emotional-support preferences, boundaries, or how they want you to communicate?\n3. Has the user explicitly corrected a prior assumption? Prefer the correction and do not preserve the contradicted interpretation.\n\nReturn JSON only, with this shape:\n{\"candidates\":[{\"kind\":\"preference\",\"content\":\"...\",\"confidence\":0.8,\"importance\":0.7,\"durability\":\"durable\",\"sensitivity\":\"normal\",\"disclosurePolicy\":\"referenceable\",\"tags\":[\"background-review\"]}]}\n\nAllowed kinds: preference, boundary, relationship, routine, current_state, long_term_goal, project_context, task_lesson, derived_insight.\nOnly include facts supported by the conversation and likely to matter in a future session. A temporary mood or one-off reaction is current context, not durable identity; omit it unless the user describes a recurring pattern that will matter later. Never include passwords, tokens, credentials, or speculative diagnoses. Use {\"candidates\":[]} when nothing qualifies.\n\nDo not turn a request about the current task into user understanding. Exclude requested outputs, follow-up instructions, project-note edits, investigations, and other one-off work. Every candidate must be a complete standalone statement
|
|
1
|
+
export declare const MEMORY_REVIEW_USER_PROMPT = "Review the conversation above and identify durable user-understanding candidates.\n\nFocus on:\n1. Has the user revealed things about themselves \u2014 persona, desires, preferences, or personal details worth remembering?\n2. Has the user expressed expectations about how you should behave, their work style, emotional-support preferences, boundaries, or how they want you to communicate?\n3. Has the user explicitly corrected a prior assumption? Prefer the correction and do not preserve the contradicted interpretation.\n\nReturn JSON only, with this shape:\n{\"candidates\":[{\"kind\":\"preference\",\"content\":\"...\",\"confidence\":0.8,\"importance\":0.7,\"durability\":\"durable\",\"sensitivity\":\"normal\",\"disclosurePolicy\":\"referenceable\",\"tags\":[\"background-review\"]}]}\n\nAllowed kinds: preference, boundary, relationship, routine, current_state, long_term_goal, project_context, task_lesson, derived_insight.\nOnly include facts supported by the conversation and likely to matter in a future session. A temporary mood or one-off reaction is current context, not durable identity; omit it unless the user describes a recurring pattern that will matter later. Never include passwords, tokens, credentials, or speculative diagnoses. Use {\"candidates\":[]} when nothing qualifies.\n\nWrite 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.\n\nDo not turn a request about the current task into user understanding. Exclude requested outputs, follow-up instructions, project-note edits, investigations, and other one-off work. Every candidate must be a complete standalone profile statement or enduring pattern; never return a clause fragment beginning with a connector such as \"and\", \"also\", \"\u5E76\u4E14\", \"\u4EE5\u53CA\", or \"\u7684\u4E8B\u9879\". Use long_term_goal only when the person states an enduring personal goal, not when they ask the assistant to create, update, investigate, summarize, or track something.";
|
|
2
2
|
export declare const UNDERSTANDING_REVIEW_SYSTEM_PROMPT = "You are the user-understanding synthesis stage for the same session. You do not chat with the user and cannot write storage directly. Extract only evidence-backed, durable candidates and return strict JSON matching the requested schema.";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { USER_FACING_UNDERSTANDING_WRITING_GUIDANCE } from "../../user-context/understanding-writing.js";
|
|
1
2
|
//#region src/agent/background-review/prompts.ts
|
|
2
3
|
const MEMORY_REVIEW_USER_PROMPT = `Review the conversation above and identify durable user-understanding candidates.
|
|
3
4
|
|
|
@@ -12,7 +13,9 @@ Return JSON only, with this shape:
|
|
|
12
13
|
Allowed kinds: preference, boundary, relationship, routine, current_state, long_term_goal, project_context, task_lesson, derived_insight.
|
|
13
14
|
Only include facts supported by the conversation and likely to matter in a future session. A temporary mood or one-off reaction is current context, not durable identity; omit it unless the user describes a recurring pattern that will matter later. Never include passwords, tokens, credentials, or speculative diagnoses. Use {"candidates":[]} when nothing qualifies.
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
${USER_FACING_UNDERSTANDING_WRITING_GUIDANCE}
|
|
17
|
+
|
|
18
|
+
Do not turn a request about the current task into user understanding. Exclude requested outputs, follow-up instructions, project-note edits, investigations, and other one-off work. Every candidate must be a complete standalone profile statement or enduring pattern; never return a clause fragment beginning with a connector such as "and", "also", "并且", "以及", or "的事项". Use long_term_goal only when the person states an enduring personal goal, not when they ask the assistant to create, update, investigate, summarize, or track something.`;
|
|
16
19
|
const UNDERSTANDING_REVIEW_SYSTEM_PROMPT = `You are the user-understanding synthesis stage for the same session. You do not chat with the user and cannot write storage directly. Extract only evidence-backed, durable candidates and return strict JSON matching the requested schema.`;
|
|
17
20
|
//#endregion
|
|
18
21
|
export { MEMORY_REVIEW_USER_PROMPT, UNDERSTANDING_REVIEW_SYSTEM_PROMPT };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { init_paths, resolveModelsJsonPath } from "../../config/paths.js";
|
|
2
|
-
import { init_sync_provider_auth, resolveProviderApiKeySync } from "../../auth/sync-provider-auth.js";
|
|
3
2
|
import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
|
|
3
|
+
import { init_sync_provider_auth, resolveProviderApiKeySync } from "../../auth/sync-provider-auth.js";
|
|
4
4
|
import { XopcModelCredentialStore, init_model_credential_store } from "../../auth/model-credential-store.js";
|
|
5
5
|
import { init_register_bundled_oauth_flows, registerBundledOAuthFlows } from "../../providers/register-bundled-oauth-flows.js";
|
|
6
6
|
import { init_register_runtime_providers, registerRuntimeProviders } from "../../providers/register-runtime-providers.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
-
import { resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
|
|
4
3
|
import { init_providers, resolveModel } from "../../providers/index.js";
|
|
4
|
+
import { resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
|
|
5
5
|
import { resolveAgentTurnTimeoutMs } from "../orchestration/run-agent-turn-with-timeout.js";
|
|
6
6
|
import { resolvePromptCachePolicy } from "../../providers/prompt-cache-plan.js";
|
|
7
7
|
import { evaluateContextBudget } from "../memory/context-budget.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getAgentDefaultImageModelConfig, getAgentDefaultModelRef, init_schema, parseModelRef } from "../../config/schema.js";
|
|
2
2
|
import { init_agent_scope, resolveDefaultAgentId } from "../agent-scope.js";
|
|
3
|
-
import { resolveEffectiveAgentManifestForAgent } from "../../config/agent-profile.js";
|
|
4
3
|
import { getDefaultModelSync, getModelsByProvider, init_providers, isProviderConfiguredSync, resolveModel } from "../../providers/index.js";
|
|
4
|
+
import { resolveEffectiveAgentManifestForAgent } from "../../config/agent-profile.js";
|
|
5
5
|
import { resolveAgentModelFallbackValues, resolveAgentModelPrimaryValue } from "../../config/model-input.js";
|
|
6
6
|
import { buildCapabilityPlansForConfig } from "../../capabilities/readiness/from-config.js";
|
|
7
7
|
import "../../capabilities/readiness/index.js";
|
|
@@ -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, resolveAgentDir } from "../../config/paths.js";
|
|
4
3
|
import { init_write_file_atomic, writeTextAtomic } from "../../infra/write-file-atomic.js";
|
|
4
|
+
import { init_paths, resolveAgentDir } from "../../config/paths.js";
|
|
5
5
|
import { join } from "path";
|
|
6
6
|
import { existsSync, watch } from "fs";
|
|
7
7
|
import { mkdir, readFile, readdir, rename } from "fs/promises";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { buildMemoryRuntime } from "../../agent-runtime/memory-runtime.js";
|
|
1
2
|
import { isMemorySubsystemEnabled } from "./memory-config.js";
|
|
2
3
|
import { BuiltinMemoryProvider } from "./builtin-provider.js";
|
|
3
4
|
import { MemoryManager } from "./manager.js";
|
|
4
5
|
import { loadMemoryPluginProviders } from "./plugin-discovery.js";
|
|
5
|
-
import { buildMemoryRuntime } from "../../agent-runtime/memory-runtime.js";
|
|
6
6
|
//#region src/agent/memory/create-memory-manager.ts
|
|
7
7
|
function createMemoryManagerFromConfig(config) {
|
|
8
8
|
const routing = resolveMemoryManagerOptions(config);
|
|
@@ -3,10 +3,10 @@ import { init_logger } from "../utils/logger.js";
|
|
|
3
3
|
import { getUserProfile } from "../storage/sqlite/user-context-repository.js";
|
|
4
4
|
import { parseNoteAttachmentTarget } from "../notes/attachment-ref.js";
|
|
5
5
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
6
|
-
import { applyConfigOverrides } from "../config/runtime-overrides.js";
|
|
7
6
|
import { init_agent_scope, resolveAgentHomeDir, resolveDefaultAgentId } from "./agent-scope.js";
|
|
8
|
-
import { extractProfileAgentId } from "../config/agent-profile.js";
|
|
9
7
|
import { init_providers, resolveModel } from "../providers/index.js";
|
|
8
|
+
import { applyConfigOverrides } from "../config/runtime-overrides.js";
|
|
9
|
+
import { extractProfileAgentId } from "../config/agent-profile.js";
|
|
10
10
|
import { extractTextContent } from "./context/workspace.js";
|
|
11
11
|
import { effectiveWorkspacePathForSession } from "../session/session-workspace.js";
|
|
12
12
|
import { getProjectForSession } from "../projects/workspace.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
3
|
import { init_workspace_defaults, resolveDefaultAgentWorkspaceDir } from "../../config/workspace-defaults.js";
|
|
4
|
-
import { resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
|
|
5
4
|
import { init_providers, resolveModel } from "../../providers/index.js";
|
|
5
|
+
import { resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
|
|
6
6
|
import { effectiveWorkspacePathForSession, projectWorkspacePath } from "../../session/session-workspace.js";
|
|
7
7
|
import { getProjectForSession } from "../../projects/workspace.js";
|
|
8
8
|
import { resolveCompactionPolicy } from "../memory/compaction-policy.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { init_paths, resolveSkillsLockPath } from "../../config/paths.js";
|
|
2
1
|
import { init_write_file_atomic, writeTextAtomicSync } from "../../infra/write-file-atomic.js";
|
|
2
|
+
import { init_paths, resolveSkillsLockPath } from "../../config/paths.js";
|
|
3
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
4
4
|
//#region src/agent/skills/hub-lock.ts
|
|
5
5
|
/**
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
+
import { extractAssistantText, getAssistantMessageErrorReason, stripCodeFences } from "../../providers/model-response.js";
|
|
3
4
|
import { getAgentDefaultModelRef, init_schema } from "../../config/schema.js";
|
|
4
|
-
import { resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
|
|
5
5
|
import { getApiKey, init_providers, resolveModel } from "../../providers/index.js";
|
|
6
|
+
import { completeWithResolvedCredentials } from "../../providers/model-call.js";
|
|
7
|
+
import { resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
|
|
6
8
|
import { TaskRepository } from "../../tasks/task-repository.js";
|
|
7
9
|
import { TaskConversationRepository } from "../../tasks/task-conversation-repository.js";
|
|
8
10
|
import { TaskRunRepository } from "../../tasks/task-run-repository.js";
|
|
9
|
-
import { completeWithResolvedCredentials } from "../../providers/model-call.js";
|
|
10
11
|
import { TaskApplicationService } from "../../tasks/task-application-service.js";
|
|
11
|
-
import { extractAssistantText, getAssistantMessageErrorReason, stripCodeFences } from "../../providers/model-response.js";
|
|
12
12
|
//#region src/agent/tasks/task-judge-service.ts
|
|
13
13
|
init_schema();
|
|
14
14
|
init_providers();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { buildMemoryRuntime } from "./memory-runtime.js";
|
|
2
1
|
import { checkBoundary } from "./boundary-guard.js";
|
|
3
2
|
import { resolveModelRole } from "./model-router.js";
|
|
4
3
|
import { buildRuntimeToolRegistry } from "./tool-registry.js";
|
|
4
|
+
import { buildMemoryRuntime } from "./memory-runtime.js";
|
|
5
5
|
import { resolveWorkflow, validateWorkflowForRuntime } from "./workflow-runtime.js";
|
|
6
6
|
import { buildAgentRuntimeProfile } from "./runtime-profile.js";
|
|
7
7
|
import { appendAgentRunEvent, createAgentRunTrace, finishAgentRunTrace, hashEffectiveManifest } from "./run-trace.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { buildAgentManifestPromptSection } from "../agent-manifest/prompt.js";
|
|
2
2
|
import "../agent-manifest/index.js";
|
|
3
|
-
import { buildMemoryRuntime } from "./memory-runtime.js";
|
|
4
3
|
import { checkBoundary } from "./boundary-guard.js";
|
|
5
4
|
import { resolveModelRole } from "./model-router.js";
|
|
6
5
|
import { buildRuntimeToolRegistry } from "./tool-registry.js";
|
|
6
|
+
import { buildMemoryRuntime } from "./memory-runtime.js";
|
|
7
7
|
import { resolveWorkflow, validateWorkflowForRuntime } from "./workflow-runtime.js";
|
|
8
8
|
//#region src/agent-runtime/runtime-profile.ts
|
|
9
9
|
function buildAgentRuntimeProfile(params) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
|
+
import { getAssistantMessageErrorReason, stripCodeFences } from "../providers/model-response.js";
|
|
3
4
|
import { getDefaultModelSync, init_providers, resolveModel } from "../providers/index.js";
|
|
4
5
|
import { createExtensionAwareStreamFn } from "../providers/extension-stream-bridge.js";
|
|
5
6
|
import { isLocalModelBaseUrl, resolveModelCallApiKey, resolveModelCallOptions } from "../providers/model-call.js";
|
|
6
|
-
import { getAssistantMessageErrorReason, stripCodeFences } from "../providers/model-response.js";
|
|
7
7
|
//#region src/ai-assist/text-assist.ts
|
|
8
8
|
init_providers();
|
|
9
9
|
init_logger();
|
|
@@ -1,10 +1,10 @@
|
|
|
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 { init_paths, resolveAgentAuthProfilesPath, resolveAuthProfilesPath, resolveCredentialsDir, resolveOAuthPath } from "../config/paths.js";
|
|
5
4
|
import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
|
|
6
|
-
import {
|
|
5
|
+
import { init_paths, resolveAgentAuthProfilesPath, resolveAuthProfilesPath, resolveCredentialsDir, resolveOAuthPath } from "../config/paths.js";
|
|
7
6
|
import { getApiKeyFromEnv, init_env_keys } from "../providers/env-keys.js";
|
|
7
|
+
import { getOAuthProviderDefinition, init_registry } from "./oauth/registry.js";
|
|
8
8
|
import { init_oauth_provider_lock, withOAuthProviderLock } from "./oauth-provider-lock.js";
|
|
9
9
|
import { dirname, join } from "path";
|
|
10
10
|
import { mkdir, readFile, readdir, rm } from "fs/promises";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { init_paths, resolveCredentialsDir } from "../../config/paths.js";
|
|
2
1
|
import { init_write_file_atomic, writeTextAtomicSync } from "../../infra/write-file-atomic.js";
|
|
2
|
+
import { init_paths, resolveCredentialsDir } from "../../config/paths.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { chmodSync, existsSync, mkdirSync, readFileSync } from "node:fs";
|
|
5
5
|
//#region src/auth/profiles/store.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
3
2
|
import { init_paths, resolveAgentAuthProfilesPath, resolveAuthProfilesPath, resolveOAuthPath } from "../config/paths.js";
|
|
4
|
-
import { init_loader, loadConfig } from "../config/loader.js";
|
|
5
3
|
import { init_registry, isOAuthOnlyProvider } from "./oauth/registry.js";
|
|
4
|
+
import { init_loader, loadConfig } from "../config/loader.js";
|
|
5
|
+
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
6
6
|
import { existsSync, readFileSync } from "node:fs";
|
|
7
7
|
//#region src/auth/sync-provider-auth.ts
|
|
8
8
|
/**
|
|
@@ -2,8 +2,8 @@ import { PACKAGE_VERSION, init_package_version } from "../../package-version.js"
|
|
|
2
2
|
import { createLogger } from "../../utils/logger/index.js";
|
|
3
3
|
import { init_logger } from "../../utils/logger.js";
|
|
4
4
|
import { assertCacheDir, init_cache_dir_policy } from "../cache-dir-policy.js";
|
|
5
|
-
import { init_paths, resolveBinDir } from "../../config/paths.js";
|
|
6
5
|
import { init_write_file_atomic, writeTextAtomic } from "../../infra/write-file-atomic.js";
|
|
6
|
+
import { init_paths, resolveBinDir } from "../../config/paths.js";
|
|
7
7
|
import { resolvePackageRoot } from "../../infra/update-check.js";
|
|
8
8
|
import { dirname, join } from "node:path";
|
|
9
9
|
import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getAgentDefaultModelRef, init_schema, parseModelRef } from "../../../../config/schema.js";
|
|
2
|
-
import { init_loader, loadConfig } from "../../../../config/loader.js";
|
|
3
2
|
import { PROVIDER_ENV_MAP, getApiKeyFromEnv, init_env_keys } from "../../../../providers/env-keys.js";
|
|
3
|
+
import { init_loader, loadConfig } from "../../../../config/loader.js";
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
5
5
|
//#region src/cli/commands/doctor/checks/provider-auth.ts
|
|
6
6
|
init_loader();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getAgentDefaultModelRef, init_schema } from "../../config/schema.js";
|
|
2
|
-
import { loadConfig, saveConfig } from "../../config/loader.js";
|
|
3
2
|
import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
|
|
3
|
+
import { loadConfig, saveConfig } from "../../config/loader.js";
|
|
4
4
|
import { getAllModels, getAvailableModels, getConfiguredProviders, getProviderAuthState, getProviderDisplayName, init_providers, isProviderConfigured, providerSupportsApiKey, providerSupportsOAuth, resolveModel } from "../../providers/index.js";
|
|
5
5
|
import { formatExamples, register } from "../registry.js";
|
|
6
6
|
import { getContextWithOpts } from "../context.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { init_agent_scope, normalizeAgentId, resolveAgentWorkspaceDir } from "../agent/agent-scope.js";
|
|
2
1
|
import { resolveEffectiveAgentManifest } from "../agent-manifest/resolver.js";
|
|
3
2
|
import "../agent-manifest/index.js";
|
|
3
|
+
import { init_agent_scope, normalizeAgentId, resolveAgentWorkspaceDir } from "../agent/agent-scope.js";
|
|
4
4
|
import { init_session_key, parseSessionKey } from "../routing/session-key.js";
|
|
5
5
|
import { agentExists, getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
6
6
|
//#region src/config/agent-profile.ts
|
package/dist/src/config/index.js
CHANGED
|
@@ -2,15 +2,15 @@ import { ENV_VARS, XOPC_DB_FILENAME, resolveHomeDir, resolveStateDir, resolveXop
|
|
|
2
2
|
import { TelegramAccountConfigSchema, TelegramConfigSchema, TelegramGroupConfigSchema, TelegramTopicConfigSchema } from "../../extensions/telegram/src/config-schema.js";
|
|
3
3
|
import { WeixinAccountConfigSchema, WeixinConfigSchema } from "../../extensions/weixin/src/config-schema.js";
|
|
4
4
|
import { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema, AgentTypedModelRoleSchema, AgentsConfigSchema, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, BrowserConfigSchema, ChannelsConfigSchema, CommandsConfigSchema, ConfigSchema, ConnectorsConfigSchema, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GatewayWebchatConfigSchema, HeartbeatConfigSchema, McpConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelCatalogConfigSchema, ModelsDevConfigSchema, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, RuntimeToolsConfigSchema, STTConfigSchema, STTFallbackConfigSchema, STTProviderConfigSchema, SearchProviderEntrySchema, SessionConfigSchema, SessionDmScopeSchema, SessionResetByTypeSchema, SessionResetConfigSchema, SessionResetModeSchema, SessionScopeSchema, SessionStorageConfigSchema, TTSConfigSchema, TTSEdgeConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSProviderConfigSchema, TTSSummarizationConfigSchema, ToolsConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, TuiConfigSchema, TunnelConfigSchema, TunnelConsentSchema, UpdateAutoConfigSchema, UpdateConfigSchema, VoiceConfigSchema, VoiceRefinementConfigSchema, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, getAgentDefaultImageGenerationModelConfig, getAgentDefaultImageModelConfig, getAgentDefaultModelRef, init_schema, parseModelRef } from "./schema.js";
|
|
5
|
-
import {
|
|
5
|
+
import { clearConfigValueCache, getAllowedCommands, getCacheStats, init_resolve_config_value, resolveConfigValue, resolveHeaders, testApiKeyResolution } from "./resolve-config-value.js";
|
|
6
6
|
import { expandWorkspacePathString, init_workspace_path, normalizeWorkspaceDir, resolveWorkspaceRoot } from "./workspace-path.js";
|
|
7
7
|
import { resolveDefaultAgentWorkspaceDir } from "./workspace-defaults.js";
|
|
8
8
|
import { resolveAgentDir as resolveAgentDir$1, resolveAgentHomeDir as resolveAgentHomeDir$1, resolveAgentWorkspaceDir } from "../agent/agent-scope.js";
|
|
9
|
-
import { extractProfileAgentId, resolveEffectiveAgentManifestForAgent, resolveEffectiveAgentManifestForSession, resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "./agent-profile.js";
|
|
10
9
|
import { FILENAMES, WORKSPACE_FILES, existsSync, hasBundledExtensionManifest, init_paths, resolveAgentAuthProfilesPath, resolveAgentDir, resolveAgentHomeDir, resolveAgentProfileDir, resolveAgentProfileMarkdownPath, resolveAuthProfilesPath, resolveBinDir, resolveBundledExtensionsDir, resolveBundledSkillsDir, resolveConfigPath, resolveCredentialsDir, resolveExtensionSdkPath, resolveExtensionsDir, resolveExtensionsLockPath, resolveInboxDir, resolveInboxMessagePath, resolveInboxPendingDir, resolveInboxProcessedDir, resolveLogPath, resolveLogsDir, resolveModelsJsonPath, resolveNodeBinDir, resolveNodeBinPath, resolveNodeToolsDir, resolveNpmBinPath, resolveOAuthPath, resolvePidPath, resolveSkillPath, resolveSkillsCachePath, resolveSkillsDir, resolveSkillsLockPath, resolveSocketPath, resolveStatusPath, resolveToolsDir, resolveWorkspaceExtensionsDir, resolveWorkspaceFile, resolveWorkspaceStateDir, resolveWorkspaceStatePath, resolveXopcBinPath } from "./paths.js";
|
|
11
|
-
import { init_loader, loadConfig, saveConfig } from "./loader.js";
|
|
12
|
-
import { clearConfigValueCache, getAllowedCommands, getCacheStats, init_resolve_config_value, resolveConfigValue, resolveHeaders, testApiKeyResolution } from "./resolve-config-value.js";
|
|
13
10
|
import { CustomModelSchema, ImageGenerationCapabilitiesSchema, ImageGenerationModelSchema, ImageGenerationProviderSchema, ModelOverrideSchema, ModelsJsonSchema, OpenAICompatSchema, OpenAICompletionsCompatSchema, OpenAIResponsesCompatSchema, OpenRouterRoutingSchema, ProviderConfigSchema, VercelGatewayRoutingSchema, getDefaultModelValues, init_models_json, loadModelsJson, modelsJsonExists, saveModelsJson, validateModelsConfig } from "./models-json.js";
|
|
11
|
+
import { init_loader, loadConfig, saveConfig } from "./loader.js";
|
|
12
|
+
import { applyConfigOverrides, getConfigOverrides, resetConfigOverrides, setConfigOverride, unsetConfigOverride } from "./runtime-overrides.js";
|
|
13
|
+
import { extractProfileAgentId, resolveEffectiveAgentManifestForAgent, resolveEffectiveAgentManifestForSession, resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "./agent-profile.js";
|
|
14
14
|
import { canonicalizeConfiguredMcpServer, isKnownCliMcpTypeAlias, normalizeConfiguredMcpServers, resolveXopcMcpTransportAlias } from "./mcp-config-normalize.js";
|
|
15
15
|
import { formatThinkingLevels, listThinkingLevels, normalizeElevatedMode, normalizeReasoningLevel, normalizeThinkLevel, normalizeVerboseLevel, thinkLevelToNumber } from "../agent/transcript/thinking-types.js";
|
|
16
16
|
import { getWorkspacePath } from "./workspace-path-helpers.js";
|
|
@@ -2,8 +2,8 @@ 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
4
|
import { ConfigSchema, init_schema } from "./schema.js";
|
|
5
|
-
import { init_paths, resolveConfigPath } from "./paths.js";
|
|
6
5
|
import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
|
|
6
|
+
import { init_paths, resolveConfigPath } from "./paths.js";
|
|
7
7
|
import { assertChannelPluginConfigs, init_validate_channel_configs } from "./validate-channel-configs.js";
|
|
8
8
|
import { dirname } from "path";
|
|
9
9
|
import { existsSync, mkdirSync, promises, readFileSync } from "fs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { init_paths, resolveModelsJsonPath } from "./paths.js";
|
|
3
2
|
import { init_write_file_atomic, writeTextAtomicSync } from "../infra/write-file-atomic.js";
|
|
3
|
+
import { init_paths, resolveModelsJsonPath } from "./paths.js";
|
|
4
4
|
import { existsSync, readFileSync } from "fs";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
//#region src/config/models-json.ts
|
|
@@ -31,6 +31,9 @@ function asRecord(value) {
|
|
|
31
31
|
function boundedPersonValue(value, maxLength = 320) {
|
|
32
32
|
return typeof value === "string" ? value.trim().slice(0, maxLength) : "";
|
|
33
33
|
}
|
|
34
|
+
function normalizedEmail(value) {
|
|
35
|
+
return /<([^<>\s]+@[^<>\s]+)>/.exec(value)?.[1]?.toLowerCase() ?? value.toLowerCase();
|
|
36
|
+
}
|
|
34
37
|
function personEntities(record) {
|
|
35
38
|
if (!record) return [];
|
|
36
39
|
const extractPerson = (value, role) => {
|
|
@@ -39,7 +42,7 @@ function personEntities(record) {
|
|
|
39
42
|
if (!normalized) return [];
|
|
40
43
|
return normalized.includes("@") ? [{
|
|
41
44
|
role,
|
|
42
|
-
email: normalized
|
|
45
|
+
email: normalizedEmail(normalized)
|
|
43
46
|
}] : [{
|
|
44
47
|
role,
|
|
45
48
|
name: normalized
|
|
@@ -91,6 +94,20 @@ function peopleSignals(entities) {
|
|
|
91
94
|
function connectionIdentities(identity) {
|
|
92
95
|
return [...new Set(Object.values(identity).filter((value) => typeof value === "string").map((value) => value.trim().toLowerCase()).filter(Boolean))];
|
|
93
96
|
}
|
|
97
|
+
function hasOwnerAttribution(toolkit, people, ownerIdentities) {
|
|
98
|
+
const attributableRoles = toolkit === "gmail" ? new Set(["sender", "from"]) : toolkit === "googlecalendar" ? new Set(["organizer"]) : new Set([
|
|
99
|
+
"author",
|
|
100
|
+
"user",
|
|
101
|
+
"username",
|
|
102
|
+
"owner",
|
|
103
|
+
"owners"
|
|
104
|
+
]);
|
|
105
|
+
return people.filter((person) => attributableRoles.has(person.role)).flatMap((person) => [
|
|
106
|
+
person.email,
|
|
107
|
+
person.username,
|
|
108
|
+
person.name
|
|
109
|
+
]).filter((value) => Boolean(value)).some((value) => ownerIdentities.includes(value.trim().toLowerCase()));
|
|
110
|
+
}
|
|
94
111
|
function resultPayload(value) {
|
|
95
112
|
const root = asRecord(value) ?? {};
|
|
96
113
|
return asRecord(root.data) ?? root;
|
|
@@ -119,10 +136,10 @@ function resultToSourceItems(input) {
|
|
|
119
136
|
const record = entity.value;
|
|
120
137
|
const people = personEntities(record);
|
|
121
138
|
const ownerIdentities = connectionIdentities(input.connectionIdentity);
|
|
122
|
-
const
|
|
123
|
-
const actorAttributed = entity.metadata.actorAttributed === true || input.toolkit === "gmail" || input.toolkit === "googlecalendar" || ["github", "googledrive"].includes(input.toolkit) && observedIdentities.some((value) => ownerIdentities.includes(value));
|
|
139
|
+
const actorAttributed = entity.metadata.actorAttributed === true || hasOwnerAttribution(input.toolkit, people, ownerIdentities);
|
|
124
140
|
const serialized = JSON.stringify(sanitizeConnectedSourceValue(entity.value), null, 2);
|
|
125
|
-
const
|
|
141
|
+
const contentChars = typeof entity.value.content === "string" ? 24e3 : 8e3;
|
|
142
|
+
const normalizedText = serialized.length > contentChars ? `${serialized.slice(0, contentChars)}\n…` : serialized;
|
|
126
143
|
const contentHash = createHash("sha256").update(serialized).digest("hex");
|
|
127
144
|
return {
|
|
128
145
|
sourceInstanceId: input.sourceInstanceId,
|
|
@@ -32,11 +32,57 @@ function rows(data, ...keys) {
|
|
|
32
32
|
function compact(value) {
|
|
33
33
|
return Object.fromEntries(Object.entries(value).filter(([, item]) => item !== void 0 && item !== null && item !== ""));
|
|
34
34
|
}
|
|
35
|
+
const MAX_EMAIL_CONTENT_CHARS = 24e3;
|
|
36
|
+
function gmailHeaders(message) {
|
|
37
|
+
const messagePayload = record(message.payload);
|
|
38
|
+
const values = Array.isArray(messagePayload?.headers) ? messagePayload.headers : [];
|
|
39
|
+
const headers = /* @__PURE__ */ new Map();
|
|
40
|
+
for (const value of values) {
|
|
41
|
+
const header = record(value);
|
|
42
|
+
const name = text(header, "name")?.toLowerCase();
|
|
43
|
+
const headerValue = text(header, "value");
|
|
44
|
+
if (name && headerValue) headers.set(name, headerValue);
|
|
45
|
+
}
|
|
46
|
+
return headers;
|
|
47
|
+
}
|
|
48
|
+
function decodeGmailBody(value) {
|
|
49
|
+
if (typeof value !== "string" || !value.trim() || value.length > 256e3) return void 0;
|
|
50
|
+
try {
|
|
51
|
+
return Buffer.from(value.replace(/-/g, "+").replace(/_/g, "/"), "base64").toString("utf8").trim() || void 0;
|
|
52
|
+
} catch {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function stripHtml(value) {
|
|
57
|
+
return value.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi, " ").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi, " ").replace(/<[^>]+>/g, " ").replace(/ /gi, " ").replace(/&/gi, "&").replace(/</gi, "<").replace(/>/gi, ">").replace(/\s+/g, " ").trim();
|
|
58
|
+
}
|
|
59
|
+
function gmailContent(message) {
|
|
60
|
+
const direct = text(message, "plainText", "plain_text", "text", "content", "body");
|
|
61
|
+
if (direct) return direct.slice(0, MAX_EMAIL_CONTENT_CHARS);
|
|
62
|
+
const plain = [];
|
|
63
|
+
const html = [];
|
|
64
|
+
const visit = (value, depth = 0) => {
|
|
65
|
+
if (depth > 10 || plain.join("").length >= MAX_EMAIL_CONTENT_CHARS) return;
|
|
66
|
+
const part = record(value);
|
|
67
|
+
if (!part) return;
|
|
68
|
+
const mimeType = text(part, "mimeType", "mime_type")?.toLowerCase();
|
|
69
|
+
const decoded = decodeGmailBody(record(part.body)?.data);
|
|
70
|
+
if (decoded) {
|
|
71
|
+
if (mimeType === "text/html") html.push(stripHtml(decoded));
|
|
72
|
+
else if (!mimeType || mimeType === "text/plain") plain.push(decoded);
|
|
73
|
+
}
|
|
74
|
+
if (Array.isArray(part.parts)) for (const nested of part.parts) visit(nested, depth + 1);
|
|
75
|
+
};
|
|
76
|
+
visit(message.payload);
|
|
77
|
+
const content = (plain.length ? plain : html).filter(Boolean).join("\n\n").trim();
|
|
78
|
+
return content ? content.slice(0, MAX_EMAIL_CONTENT_CHARS) : void 0;
|
|
79
|
+
}
|
|
35
80
|
function normalizeGmail(result) {
|
|
36
81
|
return rows(payload(result), "messages").flatMap((message) => {
|
|
37
82
|
const externalId = text(message, "id", "messageId", "message_id");
|
|
38
83
|
if (!externalId) return [];
|
|
39
84
|
const occurredAt = time(message.internalDate ?? message.internal_date ?? message.date ?? message.timestamp);
|
|
85
|
+
const headers = gmailHeaders(message);
|
|
40
86
|
return [{
|
|
41
87
|
externalId,
|
|
42
88
|
itemType: "email",
|
|
@@ -45,12 +91,13 @@ function normalizeGmail(result) {
|
|
|
45
91
|
value: compact({
|
|
46
92
|
id: externalId,
|
|
47
93
|
threadId: text(message, "threadId", "thread_id"),
|
|
48
|
-
subject: text(message, "subject"),
|
|
49
|
-
sender: message.sender ?? message.from,
|
|
50
|
-
recipients: message.recipients ?? message.to,
|
|
94
|
+
subject: text(message, "subject") ?? headers.get("subject"),
|
|
95
|
+
sender: message.sender ?? message.from ?? headers.get("from"),
|
|
96
|
+
recipients: message.recipients ?? message.to ?? headers.get("to"),
|
|
51
97
|
date: occurredAt,
|
|
52
98
|
labels: message.labelIds ?? message.label_ids ?? message.labels,
|
|
53
|
-
snippet: text(message, "snippet", "preview")
|
|
99
|
+
snippet: text(message, "snippet", "preview"),
|
|
100
|
+
content: gmailContent(message)
|
|
54
101
|
}),
|
|
55
102
|
metadata: {
|
|
56
103
|
observationKind: "message",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { MemoryManager } from '../agent/memory/manager.js';
|
|
2
|
+
import type { Config } from '../config/schema.js';
|
|
3
|
+
import type { KnowledgeSourceItem } from '../knowledge/types.js';
|
|
4
|
+
import type { UnderstandingSourceItem } from '../user-context/sources/types.js';
|
|
5
|
+
import { analyzeUnderstandingSources } from '../work-discovery/analyzer.js';
|
|
6
|
+
export declare function connectedItemsForUnderstanding(items: KnowledgeSourceItem[]): UnderstandingSourceItem[];
|
|
7
|
+
export declare function deriveConnectedSourceUnderstanding(input: {
|
|
8
|
+
config: Config;
|
|
9
|
+
agentId: string;
|
|
10
|
+
sourceInstanceId: string;
|
|
11
|
+
sourceRunId: string;
|
|
12
|
+
memoryManager: MemoryManager;
|
|
13
|
+
analyze?: typeof analyzeUnderstandingSources;
|
|
14
|
+
}): Promise<{
|
|
15
|
+
created: number;
|
|
16
|
+
focusCount: number;
|
|
17
|
+
status: 'completed' | 'partial' | 'failed';
|
|
18
|
+
error?: string;
|
|
19
|
+
}>;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { listKnowledgeSourceItems } from "../storage/sqlite/knowledge-repository.js";
|
|
2
|
+
import "../storage/sqlite/index.js";
|
|
3
|
+
import { upsertUserFocus } from "../user-context/sources/repository.js";
|
|
4
|
+
import { analyzeUnderstandingSources } from "../work-discovery/analyzer.js";
|
|
5
|
+
import { createHash } from "node:crypto";
|
|
6
|
+
//#region src/connectors/connected-source-understanding.ts
|
|
7
|
+
const MAX_CONNECTED_ITEMS = 150;
|
|
8
|
+
function normalizedValue(item) {
|
|
9
|
+
if (!item.normalizedText) return {};
|
|
10
|
+
try {
|
|
11
|
+
const value = JSON.parse(item.normalizedText);
|
|
12
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
13
|
+
} catch {
|
|
14
|
+
return {};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function text(value) {
|
|
18
|
+
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
19
|
+
}
|
|
20
|
+
function itemType(itemType) {
|
|
21
|
+
if (itemType === "email") return "mail";
|
|
22
|
+
if (itemType === "calendar_event") return "calendar_event";
|
|
23
|
+
if (itemType === "external_task") return "task";
|
|
24
|
+
if (itemType === "development_activity" || itemType === "repository") return "code_activity";
|
|
25
|
+
return "document";
|
|
26
|
+
}
|
|
27
|
+
function timestamp(value) {
|
|
28
|
+
if (!value) return void 0;
|
|
29
|
+
const parsed = Date.parse(value);
|
|
30
|
+
return Number.isFinite(parsed) ? parsed : void 0;
|
|
31
|
+
}
|
|
32
|
+
function contentPriority(item) {
|
|
33
|
+
const value = normalizedValue(item);
|
|
34
|
+
if (item.itemType === "connected_content") return 3;
|
|
35
|
+
if (text(value.content)) return 2;
|
|
36
|
+
return 1;
|
|
37
|
+
}
|
|
38
|
+
function connectedItemsForUnderstanding(items) {
|
|
39
|
+
return [...items].sort((left, right) => contentPriority(right) - contentPriority(left)).slice(0, MAX_CONNECTED_ITEMS).flatMap((item) => {
|
|
40
|
+
const value = normalizedValue(item);
|
|
41
|
+
const title = text(value.title) ?? text(value.subject) ?? text(value.fullName) ?? text(value.repository) ?? `${text(item.metadata.toolkit) ?? "Connected source"} ${item.itemType}`;
|
|
42
|
+
const normalizedText = item.normalizedText?.trim();
|
|
43
|
+
if (!title && !normalizedText) return [];
|
|
44
|
+
return [{
|
|
45
|
+
id: item.id,
|
|
46
|
+
sourceId: "connected-work",
|
|
47
|
+
type: itemType(item.itemType),
|
|
48
|
+
title,
|
|
49
|
+
...normalizedText ? { text: normalizedText.slice(0, 24e3) } : {},
|
|
50
|
+
...text(item.metadata.toolkit) ? { group: text(item.metadata.toolkit) } : {},
|
|
51
|
+
...timestamp(item.occurredAt) ? { occurredAt: timestamp(item.occurredAt) } : {},
|
|
52
|
+
...timestamp(item.sourceUpdatedAt) ? { modifiedAt: timestamp(item.sourceUpdatedAt) } : {},
|
|
53
|
+
ownerAttribution: item.metadata.actorAttributed === true ? "user" : "shared",
|
|
54
|
+
sensitivity: item.sensitivity,
|
|
55
|
+
evidenceRef: `knowledge-source://${item.id}`
|
|
56
|
+
}];
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function understandingKind(category) {
|
|
60
|
+
if (category === "preference") return "preference";
|
|
61
|
+
if (category === "workflow") return "routine";
|
|
62
|
+
if (category === "focus") return "current_state";
|
|
63
|
+
return "project_context";
|
|
64
|
+
}
|
|
65
|
+
function understandingCandidate(candidate) {
|
|
66
|
+
const normalized = candidate.statement.toLocaleLowerCase().replace(/[^\p{L}\p{N}]+/gu, " ").trim();
|
|
67
|
+
return {
|
|
68
|
+
kind: understandingKind(candidate.category),
|
|
69
|
+
content: candidate.statement,
|
|
70
|
+
canonicalKey: `connected-semantic:${candidate.category}:${createHash("sha256").update(normalized).digest("hex").slice(0, 20)}`,
|
|
71
|
+
confidence: candidate.confidence === "high" ? .9 : candidate.confidence === "medium" ? .72 : .55,
|
|
72
|
+
importance: candidate.category === "focus" ? .8 : .68,
|
|
73
|
+
explicitness: "inferred",
|
|
74
|
+
durability: candidate.category === "focus" ? "ephemeral" : candidate.category === "workflow" ? "recurring" : "durable",
|
|
75
|
+
sensitivity: "personal",
|
|
76
|
+
disclosurePolicy: "referenceable"
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function hasLongVerbatimOverlap(value, sourceTexts, minimumLength = 32) {
|
|
80
|
+
const normalized = value.replace(/\s+/g, " ").trim();
|
|
81
|
+
if (normalized.length < minimumLength) return false;
|
|
82
|
+
return sourceTexts.some((source) => source.replace(/\s+/g, " ").includes(normalized));
|
|
83
|
+
}
|
|
84
|
+
async function deriveConnectedSourceUnderstanding(input) {
|
|
85
|
+
const items = connectedItemsForUnderstanding(listKnowledgeSourceItems({
|
|
86
|
+
agentId: input.agentId,
|
|
87
|
+
sourceInstanceId: input.sourceInstanceId,
|
|
88
|
+
includeDeleted: false,
|
|
89
|
+
limit: MAX_CONNECTED_ITEMS
|
|
90
|
+
}));
|
|
91
|
+
if (!items.length) return {
|
|
92
|
+
created: 0,
|
|
93
|
+
focusCount: 0,
|
|
94
|
+
status: "completed"
|
|
95
|
+
};
|
|
96
|
+
const analysis = await (input.analyze ?? analyzeUnderstandingSources)({
|
|
97
|
+
config: input.config,
|
|
98
|
+
items
|
|
99
|
+
});
|
|
100
|
+
const rawTexts = items.flatMap((item) => item.text ? [item.text] : []);
|
|
101
|
+
const profileCandidates = analysis.profileCandidates.filter((candidate) => !hasLongVerbatimOverlap(candidate.statement, rawTexts));
|
|
102
|
+
const sourceItemIds = [...new Set([...profileCandidates.flatMap((candidate) => candidate.evidenceRefs ?? []), ...analysis.workThreadCandidates.flatMap((candidate) => candidate.evidenceRefs)].map((ref) => ref.startsWith("knowledge-source://") ? ref.slice(19) : ""))].filter(Boolean).slice(0, 20);
|
|
103
|
+
const reviewed = profileCandidates.length ? await input.memoryManager.applyUnderstandingCandidates(profileCandidates.map(understandingCandidate), {
|
|
104
|
+
agentId: input.agentId,
|
|
105
|
+
sourceItemIds,
|
|
106
|
+
sourceText: "Bounded semantic synthesis from explicitly connected work sources.",
|
|
107
|
+
source: {
|
|
108
|
+
provider: "connected-sources",
|
|
109
|
+
sourceInstanceId: input.sourceInstanceId
|
|
110
|
+
},
|
|
111
|
+
reviewSource: "background"
|
|
112
|
+
}) : { created: 0 };
|
|
113
|
+
const focuses = analysis.workThreadCandidates.filter((candidate) => !hasLongVerbatimOverlap(candidate.title, rawTexts) && !hasLongVerbatimOverlap(candidate.summary, rawTexts)).map((candidate) => upsertUserFocus({
|
|
114
|
+
canonicalKey: `connected-focus:${candidate.topicKey}`,
|
|
115
|
+
title: candidate.title,
|
|
116
|
+
summary: candidate.summary,
|
|
117
|
+
horizon: candidate.horizon,
|
|
118
|
+
status: "candidate",
|
|
119
|
+
confidence: candidate.confidence === "high" ? .9 : candidate.confidence === "medium" ? .72 : .55,
|
|
120
|
+
evidenceRefs: candidate.evidenceRefs,
|
|
121
|
+
sourceRunId: input.sourceRunId
|
|
122
|
+
}));
|
|
123
|
+
const sourceStatus = analysis.sourceStatuses.find((item) => item.sourceId === "connected-work");
|
|
124
|
+
return {
|
|
125
|
+
created: reviewed.created,
|
|
126
|
+
focusCount: focuses.length,
|
|
127
|
+
status: sourceStatus?.status ?? "failed",
|
|
128
|
+
...sourceStatus?.error ? { error: sourceStatus.error } : {}
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
export { connectedItemsForUnderstanding, deriveConnectedSourceUnderstanding };
|
|
@@ -19,6 +19,7 @@ export type ConnectedContentReadResult = {
|
|
|
19
19
|
};
|
|
20
20
|
export declare function listConnectedContentCandidates(options: {
|
|
21
21
|
agentId: string;
|
|
22
|
+
sourceInstanceId?: string;
|
|
22
23
|
limit?: number;
|
|
23
24
|
}): ConnectedContentCandidate[];
|
|
24
25
|
export declare function readConnectedContent(input: {
|
|
@@ -43,13 +43,16 @@ function candidateFor(item) {
|
|
|
43
43
|
const value = normalizedRecord(item);
|
|
44
44
|
const title = text(value.title) ?? text(value.subject);
|
|
45
45
|
if (!title) return void 0;
|
|
46
|
-
if (toolkit === "gmail" && item.itemType === "email")
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
if (toolkit === "gmail" && item.itemType === "email") {
|
|
47
|
+
if (text(value.content)) return void 0;
|
|
48
|
+
return {
|
|
49
|
+
sourceItemId: item.id,
|
|
50
|
+
sourceInstanceId: item.sourceInstanceId,
|
|
51
|
+
toolkit,
|
|
52
|
+
title,
|
|
53
|
+
occurredAt: item.occurredAt
|
|
54
|
+
};
|
|
55
|
+
}
|
|
53
56
|
const mimeType = text(item.metadata.mimeType) ?? text(value.mimeType);
|
|
54
57
|
if (toolkit === "googledrive" && item.itemType === "cloud_document" && mimeType && (mimeType === GOOGLE_DOCUMENT_MIME || DOWNLOADABLE_TEXT_MIMES.has(mimeType))) return {
|
|
55
58
|
sourceItemId: item.id,
|
|
@@ -64,6 +67,7 @@ function listConnectedContentCandidates(options) {
|
|
|
64
67
|
const limit = Math.max(1, Math.min(20, options.limit ?? 10));
|
|
65
68
|
const items = listKnowledgeSourceItems({
|
|
66
69
|
agentId: options.agentId,
|
|
70
|
+
...options.sourceInstanceId ? { sourceInstanceId: options.sourceInstanceId } : {},
|
|
67
71
|
includeDeleted: false,
|
|
68
72
|
limit: 500
|
|
69
73
|
});
|