@xopcai/xopc 0.0.360 → 0.0.361
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-CnmHVy1D.js → activity-store-tpFInIoh.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CQTERenW.js → agent-avatar-dicebear-DUhFW_Go.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BNILmgey.js +1 -0
- package/dist/gateway/static/root/assets/agent-plugin-dialog-CnWci4JJ.js +1 -0
- package/dist/gateway/static/root/assets/agents-CKS5LUUs.js +66 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-BtnYiq7O.js → agents-admin-api-CiAjB2iQ.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-V5QVeMvW.js → app-management-settings-panel-DEig00YU.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BDkRcoI6.js → appearance-settings-CccnRRrL.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DzCyL89L.js → apps-page-CkT6UNZW.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-DZCN9m71.js → archive-plugin-CIlmZBe5.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DOu1wMOV.js → automations-page-8kZugDcf.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-3V54ShL0.js +7 -0
- package/dist/gateway/static/root/assets/{binary-plugins-U63xxRgh.js → binary-plugins-BuQiee_b.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-K6is5GrS.js → block-editor-BFFRbsKX.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-MmkUGn9W.js → browser-automation-inputs-CWujpdCx.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-B8IiXEBs.js → browser-automations-page-HVXiBKXE.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-DpxAXNvM.js +3 -0
- package/dist/gateway/static/root/assets/{capabilities-BXG_5wIg.js → capabilities-CngwB2JU.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-Bigu28Z6.js → capabilities-RMlKKfGF.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-page-BBi4ef3u.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-IxszGl-Q.js +8 -0
- package/dist/gateway/static/root/assets/{capability-header-actions-wh3Nr0qS.js → capability-header-actions-BLOIJvIZ.js} +1 -1
- package/dist/gateway/static/root/assets/channels-Ced5nFBc.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-BU-X9nu1.js → chat-terminal-dock-BskUzDCS.js} +2 -2
- package/dist/gateway/static/root/assets/{computer-settings-page-MyXsSqFJ.js → computer-settings-page-De-pjlvn.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-DyxPM_MZ.js → connector-service-page-Qc1mVfp9.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-CPqeY1x5.js +2 -0
- package/dist/gateway/static/root/assets/{date-picker-WRFvi7Pu.js → date-picker-7ppMIGfQ.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-CLun5Tst.js → dependency-picker-DfYC22si.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-iaVa9vVM.js → desktop-pet-GKEfqHDF.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-0RS3sP3Z.js → desktop-pet-settings-qoFZBKe9.js} +1 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-D8sTDd5s.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-Btlldlt3.js → directory-picker-path-field-BC87CZa2.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-BImQT4PU.js → extension-debug-page-VxCq29jC.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BmuLv-ET.js → extension-page-DypBVBTt.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-Dg7cRxDX.js → extension-provider-wlvxPese.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-7Kr8UJK4.js → extension-settings-page-DzzkBN9y.js} +1 -1
- package/dist/gateway/static/root/assets/{fallback-models-B0w1lumZ.js → fallback-models-s4qTRcPJ.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-EZxaKXdC.js → gateway-config-swr-ZM72jovc.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-DBRa17u3.js → gateway-realtime-B-hrykag.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-B6B1fw_K.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings--M7ZH_37.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-Wtxq_y2f.js → gateway-startup-retry-DjWuTj8B.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-KFs5suD1.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-Bnl0CH4n.js → image-generation-api-C9cwrqCr.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-BLOJY67-.js → imports-page-BKy0ImXk.js} +1 -1
- package/dist/gateway/static/root/assets/index-C0JT9Ja4.js +106 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-Dlbsip2R.js → keyboard-shortcuts-settings-CexiL-Ey.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-nyWeTK0r.js → local-app-workbench-page-CcU1OLWQ.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-CfEpFLs0.js → local-apps-page-BcLijQx4.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-CeHhcudO.js → local-session-drafts-C7QjBMNp.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-ChN_vjs2.js → locale-store-5sV3dDRG.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-A38cawkA.js → logs-page-48nrZNQe.js} +2 -2
- package/dist/gateway/static/root/assets/management-settings-B_gzl_Vh.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-DKlJx4eo.js → markdown-view-V0f5NW7D.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-JWzrPQwt.js → media-plugins-_obxSZmT.js} +1 -1
- package/dist/gateway/static/root/assets/{messages-CnM6Qfr7.js → messages-CaURu8bb.js} +2 -2
- package/dist/gateway/static/root/assets/models-hub-cache-Cs3E5pEA.js +1 -0
- package/dist/gateway/static/root/assets/{note-detail-panel-CUGVyo2V.js → note-detail-panel-B9AeX98W.js} +3 -3
- package/dist/gateway/static/root/assets/{notes-api-D8nvWMMC.js → notes-api-CBnMq6Nc.js} +1 -1
- package/dist/gateway/static/root/assets/notes-page-CKTTfxw-.js +8 -0
- package/dist/gateway/static/root/assets/{oauth-api-BXn1a9qx.js → oauth-api-Bu2RoLF2.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-C72qIgBg.js → page-context-capture-button-BsxBAWD_.js} +1 -1
- package/dist/gateway/static/root/assets/personal-page-Cfl1FR3i.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-CT98FsVl.js → product-open-page-D1ARqS3r.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-BlqOVwKP.js → project-detail-page-Cro1OE8P.js} +1 -1
- package/dist/gateway/static/root/assets/projects-page-CdEmmBCz.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-BM_81rLe.js → registry-api-j1rNFkP2.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-C9_ea_4p.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-ry0jprz7.js → runtime-tools-settings-panel-DtmQbC72.js} +1 -1
- package/dist/gateway/static/root/assets/{scenes-page-CV1GkOj6.js → scenes-page-DeFdMf2q.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-C5zMrxgR.js → schema-form-ByEHHW6n.js} +1 -1
- package/dist/gateway/static/root/assets/{send-session-input-Dt0t5SoR.js → send-session-input-CO_vUCb8.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-UkGomZfv.js → session-api-CYPGi01d.js} +1 -1
- package/dist/gateway/static/root/assets/{session-manager-DDR-gv_e.js → session-manager-BdJThQQ6.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-CV0JlaXS.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-D9sW0hKa.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-C88fsfZF.js → settings-page-CHKsZFAN.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-DESlRgZS.js → setup-status-panel-CC58OVOe.js} +1 -1
- package/dist/gateway/static/root/assets/{share-link-dialog-BvSRHs1P.js → share-link-dialog-ZOdnHkmb.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-D5Gey-6E.js → share-preview-page-BPDWUuH_.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-DwqLga5H.js → shares-api-T5gR8yqz.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DaXvdH8c.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-1hbX3qDC.js → skill-api-CHCLMcfO.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-C1hzIawD.js → skill-reload-api-C-RoiUJi.js} +1 -1
- package/dist/gateway/static/root/assets/skills-page-a9UQQnqn.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-DbNk-Jwq.js → system-settings-panel-Dho_dlBS.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-DoLKOJrE.js → task-detail-page-B5JyH4z7.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-DTYk7Gll.js → theme-store-CEl74p7l.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-H3FheXYH.js → tunnel-api-BDqCyf8G.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-DGbqcsV6.js → usage-page-DKwKfszc.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-R3hEHQQq.js → use-autosave-D09eZTLp.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-pzPAUV_o.js → use-composer-attachments-CkvJM8Km.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-DNhXjL0W.js → use-file-preview-expanded-J3HnG8OH.js} +2 -2
- package/dist/gateway/static/root/assets/user-model-page-BsgADrGL.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-C-AF-IcO.js → voice-api-key-field-DH-to9Rd.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-CxGsCDoW.js → voice-config-api-CmCfVy3H.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-DfyI9kVf.js → work-discovery-overlay-x1vZDBhu.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-De80GODZ.js → workflow-run-setup-panel-DGatvmK1.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-DgNy6mBQ.js +6 -0
- package/dist/gateway/static/root/assets/{workspace-api-Dwa8kHdY.js → workspace-api-DzPw92Kx.js} +2 -2
- package/dist/gateway/static/root/index.html +27 -28
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +3 -3
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +70 -4
- package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/inbound/attachment-pipeline.js +13 -0
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
- package/dist/src/agent/memory/compaction-policy.d.ts +4 -0
- package/dist/src/agent/memory/compaction-policy.js +3 -0
- package/dist/src/agent/memory/idle-compaction-scheduler.d.ts +28 -0
- package/dist/src/agent/memory/idle-compaction-scheduler.js +127 -0
- package/dist/src/agent/service/process-direct-one-shot.js +1 -0
- package/dist/src/agent/service/process-direct-streaming.js +1 -0
- package/dist/src/agent/service.js +3 -2
- package/dist/src/agent/session/session-config-service.js +1 -1
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/skills/index.js +1 -1
- package/dist/src/agent/skills/managed-store.js +1 -1
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/tools/delegation-policy.js +1 -0
- package/dist/src/agent/tools/factory.js +16 -2
- package/dist/src/agent/tools/index.d.ts +1 -0
- package/dist/src/agent/tools/index.js +2 -1
- package/dist/src/agent/tools/media-read-tool.d.ts +5 -1
- package/dist/src/agent/tools/media-read-tool.js +44 -5
- package/dist/src/agent/tools/personal-read-tool.d.ts +3 -0
- package/dist/src/agent/tools/personal-read-tool.js +155 -0
- package/dist/src/agent/tools/personal-task-tool.js +1 -1
- package/dist/src/agent/tools/read.d.ts +3 -0
- package/dist/src/agent/tools/read.js +26 -8
- package/dist/src/agent/tools/session-search-tool.d.ts +1 -0
- package/dist/src/agent/tools/session-search-tool.js +39 -5
- package/dist/src/agent/tools/xopc-use-tool.js +2 -2
- package/dist/src/agent-catalog/capabilities.js +2 -2
- package/dist/src/auth/credentials.js +1 -1
- package/dist/src/auth/oauth-provider-lock.js +1 -1
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/bootstrap/application-state.js +1 -1
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/capabilities/runtime/dispatcher.js +1 -1
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/cli/commands/agent.js +1 -1
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard/model.js +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/config/index.js +3 -3
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/config/schema.d.ts +10 -0
- package/dist/src/config/schema.js +1 -1
- package/dist/src/extensions/agent-plugins/validation.js +1 -1
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +10 -0
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
- package/dist/src/gateway/hono/routes/notes.js +2 -2
- package/dist/src/gateway/hono/routes/personal-agent.js +1 -1
- package/dist/src/gateway/hono/routes/projects.js +2 -2
- package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
- package/dist/src/gateway/hono/routes/sessions.js +1 -1
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/hono/routes/voice.js +1 -1
- package/dist/src/gateway/image-generation-setup.js +2 -2
- package/dist/src/gateway/lock.js +1 -1
- package/dist/src/gateway/service/agent-runner.js +1 -0
- package/dist/src/gateway/service/session-command-service.js +1 -1
- package/dist/src/gateway/service/session-input-coordinator.d.ts +1 -0
- package/dist/src/gateway/service/session-input-coordinator.js +2 -0
- package/dist/src/gateway/service.js +1 -1
- package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
- package/dist/src/local-apps/service.js +1 -1
- package/dist/src/media/store.js +5 -1
- package/dist/src/personal-agent/policy.d.ts +1 -1
- package/dist/src/personal-agent/policy.js +4 -0
- package/dist/src/personal-agent/request-service.js +1 -1
- package/dist/src/personal-agent/service.js +9 -7
- package/dist/src/providers/model-catalog-persistence.js +1 -1
- package/dist/src/session/store.d.ts +12 -1
- package/dist/src/session/store.js +33 -0
- package/dist/src/storage/sqlite/transcript-repository.d.ts +4 -1
- package/dist/src/storage/sqlite/transcript-repository.js +15 -1
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tasks/task-main-update-decision-service.js +1 -1
- package/dist/src/tasks/task-result-delivery-repository.js +1 -1
- package/dist/src/tui/backends/embedded-backend.js +2 -2
- package/dist/src/user-context/config.d.ts +48 -0
- package/dist/src/user-context/config.js +23 -3
- package/dist/src/voice/realtime/persona-context.js +1 -1
- package/dist/src/voice/realtime/runtime.js +1 -1
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CPF0lunJ.js +0 -1
- package/dist/gateway/static/root/assets/agent-plugin-dialog-BjDaZlKy.js +0 -1
- package/dist/gateway/static/root/assets/agents-XopBILLB.js +0 -66
- package/dist/gateway/static/root/assets/automations-workspace-CiY_2otj.js +0 -7
- package/dist/gateway/static/root/assets/browser-settings-page-Cms2Bu3Q.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-page-BAFRNHQv.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-Cws6od1d.js +0 -8
- package/dist/gateway/static/root/assets/channels-DxwismTc.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-C7-OC3MW.js +0 -2
- package/dist/gateway/static/root/assets/device-pairing-wizard-DVAGb04L.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-7glMlD2l.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-DmPvmwYp.js +0 -1
- package/dist/gateway/static/root/assets/home-page-N0Mp-eTJ.js +0 -1
- package/dist/gateway/static/root/assets/index-BXrBL_Hb.js +0 -106
- package/dist/gateway/static/root/assets/management-settings-Cse9K61x.js +0 -1
- package/dist/gateway/static/root/assets/model-display-name-DXhO9rcM.js +0 -1
- package/dist/gateway/static/root/assets/models-hub-cache-DnIOzcvn.js +0 -1
- package/dist/gateway/static/root/assets/notes-page-Dk89l5dC.js +0 -8
- package/dist/gateway/static/root/assets/personal-page-DCtduzh8.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-DVN2q_yR.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BP5kUgIN.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-BXtGeOsR.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CvFVkELy.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-btoP07Fx.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-DYJbwwBT.js +0 -2
- package/dist/gateway/static/root/assets/user-model-page-7pW4Pazn.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-BuH3pC1C.js +0 -6
|
@@ -15,12 +15,14 @@ function clampMaxBytes(raw) {
|
|
|
15
15
|
if (typeof raw !== "number" || !Number.isFinite(raw) || raw <= 0) return DEFAULT_MAX_BYTES;
|
|
16
16
|
return Math.min(Math.floor(raw), HARD_MAX_BYTES);
|
|
17
17
|
}
|
|
18
|
-
function createReadMediaTool() {
|
|
18
|
+
function createReadMediaTool(options) {
|
|
19
19
|
return {
|
|
20
20
|
name: "read_media",
|
|
21
21
|
label: "Read Media Attachment",
|
|
22
22
|
description: "Read an attachment by media:// URI. Use this for xopc-media-uri attachments in user messages.",
|
|
23
23
|
parameters: ReadMediaSchema,
|
|
24
|
+
supportsParallel: true,
|
|
25
|
+
idempotent: true,
|
|
24
26
|
async execute(_toolCallId, params, _signal) {
|
|
25
27
|
const uri = typeof params.uri === "string" ? params.uri.trim() : "";
|
|
26
28
|
if (!uri) return {
|
|
@@ -34,7 +36,7 @@ function createReadMediaTool() {
|
|
|
34
36
|
}
|
|
35
37
|
};
|
|
36
38
|
try {
|
|
37
|
-
const { buffer, path } = await readMediaReference(uri, clampMaxBytes(params.maxBytes));
|
|
39
|
+
const { buffer, path } = await readMediaReference(uri, Math.min(clampMaxBytes(params.maxBytes), options?.maxReadBytes ?? HARD_MAX_BYTES));
|
|
38
40
|
const mimeType = mimeTypeFromMediaPath(path);
|
|
39
41
|
const metadata = {
|
|
40
42
|
ok: true,
|
|
@@ -43,14 +45,35 @@ function createReadMediaTool() {
|
|
|
43
45
|
size: buffer.byteLength,
|
|
44
46
|
path
|
|
45
47
|
};
|
|
46
|
-
if (isLikelyText(mimeType))
|
|
48
|
+
if (isLikelyText(mimeType)) {
|
|
49
|
+
const fullText = buffer.toString("utf8");
|
|
50
|
+
const maxChars = options?.maxChars ?? fullText.length;
|
|
51
|
+
const truncated = fullText.length > maxChars;
|
|
52
|
+
return {
|
|
53
|
+
content: [{
|
|
54
|
+
type: "text",
|
|
55
|
+
text: fullText.slice(0, maxChars) + (truncated ? "\n[Attachment truncated; delegate full analysis to a specialist.]" : "")
|
|
56
|
+
}],
|
|
57
|
+
details: {
|
|
58
|
+
...metadata,
|
|
59
|
+
kind: "text",
|
|
60
|
+
truncated,
|
|
61
|
+
...truncated && options?.textOnly ? {
|
|
62
|
+
requiresSpecialist: true,
|
|
63
|
+
reason: "large_attachment"
|
|
64
|
+
} : {}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
if (options?.textOnly) return {
|
|
47
69
|
content: [{
|
|
48
70
|
type: "text",
|
|
49
|
-
text:
|
|
71
|
+
text: "Binary attachment: delegate document parsing or media analysis to a specialist."
|
|
50
72
|
}],
|
|
51
73
|
details: {
|
|
52
74
|
...metadata,
|
|
53
|
-
kind: "
|
|
75
|
+
kind: "binary",
|
|
76
|
+
requiresSpecialist: true
|
|
54
77
|
}
|
|
55
78
|
};
|
|
56
79
|
return {
|
|
@@ -68,6 +91,22 @@ function createReadMediaTool() {
|
|
|
68
91
|
}
|
|
69
92
|
};
|
|
70
93
|
} catch (err) {
|
|
94
|
+
if (options?.textOnly && err?.code === "MEDIA_READ_LIMIT") {
|
|
95
|
+
const size = err.size;
|
|
96
|
+
return {
|
|
97
|
+
content: [{
|
|
98
|
+
type: "text",
|
|
99
|
+
text: `Attachment is large (${size} bytes; local read limit ${options.maxReadBytes ?? HARD_MAX_BYTES} bytes). Tell the user briefly, then delegate reading and processing with this URI: ${uri}`
|
|
100
|
+
}],
|
|
101
|
+
details: {
|
|
102
|
+
ok: true,
|
|
103
|
+
uri,
|
|
104
|
+
size,
|
|
105
|
+
requiresSpecialist: true,
|
|
106
|
+
reason: "large_attachment"
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
71
110
|
const message = err instanceof Error ? err.message : String(err);
|
|
72
111
|
return {
|
|
73
112
|
content: [{
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { CapabilityDispatcher } from "../../capabilities/runtime/dispatcher.js";
|
|
2
|
+
import { registerNoteReadCapabilities } from "../../notes/capabilities/read.js";
|
|
3
|
+
import { registerProjectReadCapabilities } from "../../projects/capabilities/read.js";
|
|
4
|
+
import { registerAutomationReadCapabilities } from "../../automations/capabilities/read.js";
|
|
5
|
+
import { Type } from "@sinclair/typebox";
|
|
6
|
+
//#region src/agent/tools/personal-read-tool.ts
|
|
7
|
+
const schema = Type.Object({
|
|
8
|
+
kind: Type.Union([
|
|
9
|
+
Type.Literal("note"),
|
|
10
|
+
Type.Literal("project"),
|
|
11
|
+
Type.Literal("automation")
|
|
12
|
+
]),
|
|
13
|
+
command: Type.Union([Type.Literal("list"), Type.Literal("get")]),
|
|
14
|
+
id: Type.Optional(Type.String()),
|
|
15
|
+
search: Type.Optional(Type.String({ maxLength: 500 })),
|
|
16
|
+
projectId: Type.Optional(Type.String()),
|
|
17
|
+
offset: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
18
|
+
limit: Type.Optional(Type.Integer({
|
|
19
|
+
minimum: 1,
|
|
20
|
+
maximum: 10
|
|
21
|
+
}))
|
|
22
|
+
});
|
|
23
|
+
const fields = [
|
|
24
|
+
"id",
|
|
25
|
+
"name",
|
|
26
|
+
"title",
|
|
27
|
+
"status",
|
|
28
|
+
"kind",
|
|
29
|
+
"projectId",
|
|
30
|
+
"description",
|
|
31
|
+
"markdown",
|
|
32
|
+
"objective",
|
|
33
|
+
"enabled",
|
|
34
|
+
"createdAt",
|
|
35
|
+
"updatedAt",
|
|
36
|
+
"createdAtMs",
|
|
37
|
+
"updatedAtMs",
|
|
38
|
+
"trigger",
|
|
39
|
+
"action",
|
|
40
|
+
"state"
|
|
41
|
+
];
|
|
42
|
+
/** Small projections keep local reads from expanding the next model request. */
|
|
43
|
+
function compact(value, textLimit) {
|
|
44
|
+
if (!value || typeof value !== "object") return {};
|
|
45
|
+
const source = value;
|
|
46
|
+
const result = {};
|
|
47
|
+
const truncatedFields = [];
|
|
48
|
+
for (const key of fields) {
|
|
49
|
+
const entry = source[key];
|
|
50
|
+
if (typeof entry === "string") {
|
|
51
|
+
result[key] = entry.slice(0, textLimit);
|
|
52
|
+
if (entry.length > textLimit) truncatedFields.push(key);
|
|
53
|
+
} else if (typeof entry === "number" || typeof entry === "boolean" || entry === null) result[key] = entry;
|
|
54
|
+
else if (entry && typeof entry === "object" && !Array.isArray(entry)) result[key] = Object.fromEntries(Object.entries(entry).slice(0, 12).filter(([, item]) => [
|
|
55
|
+
"string",
|
|
56
|
+
"number",
|
|
57
|
+
"boolean"
|
|
58
|
+
].includes(typeof item) || item === null).map(([field, item]) => [field, typeof item === "string" ? item.slice(0, 200) : item]));
|
|
59
|
+
}
|
|
60
|
+
if (truncatedFields.length) result.truncatedFields = truncatedFields;
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
function createPersonalReadTool(deps) {
|
|
64
|
+
const dispatcher = new CapabilityDispatcher();
|
|
65
|
+
if (deps.getNotesService) registerNoteReadCapabilities(dispatcher, () => {
|
|
66
|
+
const notes = deps.getNotesService();
|
|
67
|
+
if (!notes) throw new Error("Notes service unavailable");
|
|
68
|
+
return notes;
|
|
69
|
+
});
|
|
70
|
+
const projects = deps.getProjectService?.();
|
|
71
|
+
if (projects) registerProjectReadCapabilities(dispatcher, projects);
|
|
72
|
+
const automations = deps.getAutomationService?.();
|
|
73
|
+
if (automations) registerAutomationReadCapabilities(dispatcher, automations, projects);
|
|
74
|
+
return {
|
|
75
|
+
name: "personal_read",
|
|
76
|
+
label: "Read local objects",
|
|
77
|
+
description: "Read local notes, projects or automation state. Only list/get; bounded excerpts, no network or model calls. Use personal_task for delegated tasks.",
|
|
78
|
+
parameters: schema,
|
|
79
|
+
supportsParallel: true,
|
|
80
|
+
idempotent: true,
|
|
81
|
+
async execute(_id, raw, signal) {
|
|
82
|
+
const input = raw;
|
|
83
|
+
if (![
|
|
84
|
+
"note",
|
|
85
|
+
"project",
|
|
86
|
+
"automation"
|
|
87
|
+
].includes(input.kind) || !["list", "get"].includes(input.command)) throw new Error("Only local note/project/automation list/get is supported");
|
|
88
|
+
if (input.command === "get" && !input.id?.trim()) throw new Error("id is required");
|
|
89
|
+
if (input.kind === "automation" && input.search) throw new Error("Automation search is unsupported; use list");
|
|
90
|
+
const operation = `xopc.${input.kind === "note" ? "notes" : input.kind === "project" ? "projects" : "automations"}.${input.command}`;
|
|
91
|
+
const limit = Math.min(10, Math.max(1, input.limit ?? 5));
|
|
92
|
+
const offset = Math.max(0, input.offset ?? 0);
|
|
93
|
+
const args = input.command === "get" ? { id: input.id } : input.kind === "automation" ? { ...input.projectId ? { projectId: input.projectId } : {} } : {
|
|
94
|
+
limit,
|
|
95
|
+
offset,
|
|
96
|
+
...input.search ? { search: input.search } : {},
|
|
97
|
+
...input.kind === "note" && input.projectId ? { projectId: input.projectId } : {}
|
|
98
|
+
};
|
|
99
|
+
const result = await dispatcher.call(operation, args, {
|
|
100
|
+
principalId: `agent:${deps.getCurrentAgentId?.() ?? "main"}`,
|
|
101
|
+
surface: "agent",
|
|
102
|
+
scopes: ["workspace.read", "automations.read"],
|
|
103
|
+
allowedCapabilities: [operation],
|
|
104
|
+
authorize: deps.authorizeCapability ?? (() => true),
|
|
105
|
+
signal
|
|
106
|
+
});
|
|
107
|
+
let payload;
|
|
108
|
+
if (input.command === "get") payload = {
|
|
109
|
+
kind: input.kind,
|
|
110
|
+
item: compact(result[input.kind], 6e3),
|
|
111
|
+
excerpts: true
|
|
112
|
+
};
|
|
113
|
+
else {
|
|
114
|
+
const rows = result.items ?? [];
|
|
115
|
+
const selected = input.kind === "automation" ? rows.slice(offset, offset + limit) : rows;
|
|
116
|
+
payload = {
|
|
117
|
+
kind: input.kind,
|
|
118
|
+
items: selected.map((row) => compact(row, 200)),
|
|
119
|
+
offset,
|
|
120
|
+
total: result.total ?? rows.length,
|
|
121
|
+
nextOffset: selected.length === limit ? offset + selected.length : void 0,
|
|
122
|
+
excerpts: true
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
const serialized = JSON.stringify(payload);
|
|
126
|
+
const requiresSpecialist = input.command === "get" && (serialized.length > 12e3 || Boolean(payload.item?.truncatedFields));
|
|
127
|
+
if (requiresSpecialist) payload = {
|
|
128
|
+
...payload,
|
|
129
|
+
requiresSpecialist: true,
|
|
130
|
+
reason: "large_object",
|
|
131
|
+
id: input.id,
|
|
132
|
+
guidance: "Briefly tell the user the material is large, then delegate full reading and processing using this object kind and ID."
|
|
133
|
+
};
|
|
134
|
+
const output = JSON.stringify(payload);
|
|
135
|
+
return {
|
|
136
|
+
content: [{
|
|
137
|
+
type: "text",
|
|
138
|
+
text: output.length <= 12e3 ? output : JSON.stringify({
|
|
139
|
+
kind: input.kind,
|
|
140
|
+
excerpt: output.slice(0, 1e4),
|
|
141
|
+
truncated: true,
|
|
142
|
+
requiresSpecialist: true,
|
|
143
|
+
id: input.id
|
|
144
|
+
})
|
|
145
|
+
}],
|
|
146
|
+
details: {
|
|
147
|
+
localOnly: true,
|
|
148
|
+
requiresSpecialist: requiresSpecialist || output.length > 12e3
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
//#endregion
|
|
155
|
+
export { createPersonalReadTool };
|
|
@@ -3,9 +3,9 @@ import { init_agent_config } from "../../agent-config/index.js";
|
|
|
3
3
|
import { AgentCatalogRepository, init_repository } from "../../agent-catalog/repository.js";
|
|
4
4
|
import { resolveEffectiveAgentConfigForAgent } from "../../config/agent-profile.js";
|
|
5
5
|
import { init_providers, isProviderConfiguredSync, resolveModel } from "../../providers/index.js";
|
|
6
|
+
import { isPersonalConversation } from "../../personal-agent/repository.js";
|
|
6
7
|
import { TaskOriginRepository } from "../../tasks/task-origin-repository.js";
|
|
7
8
|
import { createXopcUseTool } from "./xopc-use-tool.js";
|
|
8
|
-
import { isPersonalConversation } from "../../personal-agent/repository.js";
|
|
9
9
|
import { PERSONAL_WORKER_RESULT_GUIDANCE } from "../../personal-agent/communication.js";
|
|
10
10
|
import { randomUUID } from "node:crypto";
|
|
11
11
|
import { Type } from "@sinclair/typebox";
|
|
@@ -2,5 +2,8 @@ import type { AgentTool } from '@earendil-works/pi-agent-core';
|
|
|
2
2
|
export interface CreateReadFileToolOptions {
|
|
3
3
|
/** When set and the path is a bare profile filename (e.g. SOUL.md), try this root if not in workspace. */
|
|
4
4
|
profileMarkdownRoot?: string;
|
|
5
|
+
defaultMaxLines?: number;
|
|
6
|
+
maxOutputBytes?: number;
|
|
7
|
+
maxReadBytes?: number;
|
|
5
8
|
}
|
|
6
9
|
export declare function createReadFileTool(workspace: string, options?: CreateReadFileToolOptions): AgentTool;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { checkedFilePath, readWorkspaceFileAsync } from "../sandbox/fileAccess.js";
|
|
2
2
|
import { dataScheduler } from "../data-acquisition/scheduler.js";
|
|
3
3
|
import { checkFileSafety } from "../prompt/safety.js";
|
|
4
|
-
import {
|
|
4
|
+
import { formatSize, truncateHead } from "./truncate.js";
|
|
5
5
|
import { isBareProfileMarkdownFileName, resolvePathUnderWorkspace, resolveProfileMarkdownPathIfBareName } from "./tool-paths.js";
|
|
6
6
|
import { stat } from "fs/promises";
|
|
7
7
|
import { Type } from "@sinclair/typebox";
|
|
@@ -29,11 +29,13 @@ function createReadFileTool(workspace, options) {
|
|
|
29
29
|
supportsParallel: true,
|
|
30
30
|
idempotent: true,
|
|
31
31
|
async execute(_toolCallId, params, signal) {
|
|
32
|
-
return dataScheduler.run(workspace, signal, () => executeReadFile(workspace, options
|
|
32
|
+
return dataScheduler.run(workspace, signal, () => executeReadFile(workspace, options, params, signal));
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
async function executeReadFile(workspace,
|
|
36
|
+
async function executeReadFile(workspace, options, params, signal) {
|
|
37
|
+
const profileMarkdownRoot = options?.profileMarkdownRoot;
|
|
38
|
+
const maxOutputBytes = options?.maxOutputBytes ?? 51200;
|
|
37
39
|
try {
|
|
38
40
|
const safety = checkFileSafety("read", params.path);
|
|
39
41
|
if (!safety.allowed) return {
|
|
@@ -60,6 +62,18 @@ async function executeReadFile(workspace, profileMarkdownRoot, params, signal) {
|
|
|
60
62
|
}
|
|
61
63
|
} else throw e;
|
|
62
64
|
}
|
|
65
|
+
if (options?.maxReadBytes && stats.size > options.maxReadBytes) return {
|
|
66
|
+
content: [{
|
|
67
|
+
type: "text",
|
|
68
|
+
text: `File is large (${formatSize(stats.size)}; local read limit ${formatSize(options.maxReadBytes)}). Tell the user briefly, then delegate reading and processing. Path: ${normalized}`
|
|
69
|
+
}],
|
|
70
|
+
details: {
|
|
71
|
+
path: normalized,
|
|
72
|
+
size: stats.size,
|
|
73
|
+
requiresSpecialist: true,
|
|
74
|
+
reason: "large_file"
|
|
75
|
+
}
|
|
76
|
+
};
|
|
63
77
|
if (stats.size > MAX_FILE_SIZE) return {
|
|
64
78
|
content: [{
|
|
65
79
|
type: "text",
|
|
@@ -72,12 +86,12 @@ async function executeReadFile(workspace, profileMarkdownRoot, params, signal) {
|
|
|
72
86
|
const lines = content.split("\n");
|
|
73
87
|
if (offset > lines.length) throw new Error(`Offset ${offset} exceeds ${lines.length} lines`);
|
|
74
88
|
const truncation = truncateHead(lines.slice(offset - 1).join("\n"), {
|
|
75
|
-
maxLines: params.limit || DEFAULT_MAX_LINES,
|
|
76
|
-
maxBytes:
|
|
89
|
+
maxLines: params.limit || options?.defaultMaxLines || DEFAULT_MAX_LINES,
|
|
90
|
+
maxBytes: maxOutputBytes
|
|
77
91
|
});
|
|
78
92
|
let outputText = truncation.content;
|
|
79
|
-
if (truncation.truncated) if (truncation.firstLineExceedsLimit) outputText = `(Line exceeds ${formatSize(
|
|
80
|
-
else outputText += `\n\n[Lines ${offset}-${offset + truncation.outputLines - 1} of ${lines.length}; continue with offset=${offset + truncation.outputLines}]`;
|
|
93
|
+
if (truncation.truncated) if (truncation.firstLineExceedsLimit) outputText = `(Line exceeds ${formatSize(maxOutputBytes)})`;
|
|
94
|
+
else outputText += options?.maxReadBytes ? `\n\n[File excerpt only. Tell the user briefly and delegate full reading and processing. Path: ${normalized}]` : `\n\n[Lines ${offset}-${offset + truncation.outputLines - 1} of ${lines.length}; continue with offset=${offset + truncation.outputLines}]`;
|
|
81
95
|
return {
|
|
82
96
|
content: [{
|
|
83
97
|
type: "text",
|
|
@@ -87,7 +101,11 @@ async function executeReadFile(workspace, profileMarkdownRoot, params, signal) {
|
|
|
87
101
|
path: normalized,
|
|
88
102
|
offset,
|
|
89
103
|
totalLines: lines.length,
|
|
90
|
-
truncated: truncation.truncated
|
|
104
|
+
truncated: truncation.truncated,
|
|
105
|
+
...options?.maxReadBytes && truncation.truncated ? {
|
|
106
|
+
requiresSpecialist: true,
|
|
107
|
+
reason: "large_file"
|
|
108
|
+
} : {}
|
|
91
109
|
}
|
|
92
110
|
};
|
|
93
111
|
} catch (error) {
|
|
@@ -6,5 +6,6 @@ export interface SessionSearchToolDeps {
|
|
|
6
6
|
getPrimaryModel: () => Model<Api>;
|
|
7
7
|
getCurrentConversationId?: () => string | undefined;
|
|
8
8
|
canAccess?: () => boolean;
|
|
9
|
+
localOnly?: boolean;
|
|
9
10
|
}
|
|
10
11
|
export declare function createSessionSearchTool(deps: SessionSearchToolDeps): AgentTool;
|
|
@@ -91,8 +91,10 @@ function createSessionSearchTool(deps) {
|
|
|
91
91
|
return {
|
|
92
92
|
name: "session_search",
|
|
93
93
|
label: "Session search",
|
|
94
|
-
description: "Search other chat sessions by keywords and get short summaries, or omit `query` to list recent sessions (no LLM cost). Uses the same session store as the gateway. Narrow with roleFilter if needed.",
|
|
94
|
+
description: deps.localOnly ? "Search other chats locally and return short matching transcript excerpts. Omit query to list recent chats. No model or network calls." : "Search other chat sessions by keywords and get short summaries, or omit `query` to list recent sessions (no LLM cost). Uses the same session store as the gateway. Narrow with roleFilter if needed.",
|
|
95
95
|
parameters: SessionSearchSchema,
|
|
96
|
+
supportsParallel: true,
|
|
97
|
+
idempotent: true,
|
|
96
98
|
async execute(_toolCallId, params, signal) {
|
|
97
99
|
if (deps.canAccess && !deps.canAccess()) return {
|
|
98
100
|
content: [{
|
|
@@ -103,7 +105,7 @@ function createSessionSearchTool(deps) {
|
|
|
103
105
|
};
|
|
104
106
|
const p = params;
|
|
105
107
|
const store = deps.getSessionStore();
|
|
106
|
-
const limit = Math.min(15, Math.max(1, p.limit ?? 5));
|
|
108
|
+
const limit = Math.min(deps.localOnly ? 5 : 15, Math.max(1, p.limit ?? (deps.localOnly ? 3 : 5)));
|
|
107
109
|
const query = p.query?.trim() ?? "";
|
|
108
110
|
try {
|
|
109
111
|
if (!query) {
|
|
@@ -114,7 +116,7 @@ function createSessionSearchTool(deps) {
|
|
|
114
116
|
});
|
|
115
117
|
const items = listed.items.slice(0, limit).map((s) => ({
|
|
116
118
|
key: s.key,
|
|
117
|
-
name: s.name,
|
|
119
|
+
name: deps.localOnly ? s.name?.slice(0, 200) : s.name,
|
|
118
120
|
updatedAt: s.updatedAt,
|
|
119
121
|
messageCount: s.messageCount,
|
|
120
122
|
sourceChannel: s.sourceChannel
|
|
@@ -135,18 +137,50 @@ function createSessionSearchTool(deps) {
|
|
|
135
137
|
}
|
|
136
138
|
};
|
|
137
139
|
}
|
|
138
|
-
|
|
140
|
+
const listed = await store.list({
|
|
139
141
|
search: query,
|
|
140
142
|
limit: limit + 10,
|
|
141
143
|
sortBy: "updatedAt",
|
|
142
144
|
sortOrder: "desc"
|
|
143
|
-
})
|
|
145
|
+
});
|
|
146
|
+
let matches = listed.items.map((item) => ({
|
|
144
147
|
key: item.key,
|
|
145
148
|
score: 1
|
|
146
149
|
}));
|
|
147
150
|
const exclude = p.excludeConversationId?.trim() || deps.getCurrentConversationId?.() || "";
|
|
148
151
|
if (exclude) matches = matches.filter((m) => m.key !== exclude);
|
|
149
152
|
const top = matches.slice(0, limit);
|
|
153
|
+
if (deps.localOnly) {
|
|
154
|
+
const results = top.map(({ key }) => ({
|
|
155
|
+
conversationId: key,
|
|
156
|
+
name: listed.items.find((item) => item.key === key)?.name?.slice(0, 200),
|
|
157
|
+
excerpts: store.recallSession(key, query, { limit: 2 }).filter((match) => !p.roleFilter || match.role === p.roleFilter).map((match) => {
|
|
158
|
+
const at = match.content.toLowerCase().indexOf(query.toLowerCase());
|
|
159
|
+
const start = Math.max(0, at - 200);
|
|
160
|
+
return {
|
|
161
|
+
seq: match.seq,
|
|
162
|
+
role: match.role,
|
|
163
|
+
content: match.content.slice(start, start + 800),
|
|
164
|
+
truncated: start > 0 || match.content.length > start + 800
|
|
165
|
+
};
|
|
166
|
+
})
|
|
167
|
+
}));
|
|
168
|
+
return {
|
|
169
|
+
content: [{
|
|
170
|
+
type: "text",
|
|
171
|
+
text: JSON.stringify({
|
|
172
|
+
success: true,
|
|
173
|
+
mode: "keyword",
|
|
174
|
+
query,
|
|
175
|
+
results
|
|
176
|
+
})
|
|
177
|
+
}],
|
|
178
|
+
details: {
|
|
179
|
+
localOnly: true,
|
|
180
|
+
count: results.length
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
}
|
|
150
184
|
const summaries = await Promise.all(top.map(async ({ key, score }) => {
|
|
151
185
|
let messages = await store.load(key);
|
|
152
186
|
if (p.roleFilter) messages = messages.filter((m) => m.role === p.roleFilter);
|
|
@@ -10,10 +10,10 @@ import { TaskRunRepository } from "../../tasks/task-run-repository.js";
|
|
|
10
10
|
import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
|
|
11
11
|
import { init_sqlite } from "../../storage/sqlite/index.js";
|
|
12
12
|
import "../../activity/index.js";
|
|
13
|
-
import { CapabilityError } from "../../capabilities/runtime/errors.js";
|
|
14
|
-
import "../../capabilities/runtime/dispatcher.js";
|
|
15
13
|
import { getDefaultAgentId, init_resolve_route } from "../../routing/resolve-route.js";
|
|
16
14
|
import { TaskConversationRepository } from "../../tasks/task-conversation-repository.js";
|
|
15
|
+
import { CapabilityError } from "../../capabilities/runtime/errors.js";
|
|
16
|
+
import "../../capabilities/runtime/dispatcher.js";
|
|
17
17
|
import { resolveProjectAgentId } from "../../projects/project-agent.js";
|
|
18
18
|
import "../../projects/index.js";
|
|
19
19
|
import { TaskDeletionService } from "../../tasks/task-deletion-service.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AgentEntrySchema, EffectiveAgentConfigSchema } from "../agent-config/schema.js";
|
|
2
2
|
import { resolveEffectiveAgentConfig } from "../agent-config/resolver.js";
|
|
3
3
|
import { init_agent_config } from "../agent-config/index.js";
|
|
4
|
-
import { CapabilityError } from "../capabilities/runtime/errors.js";
|
|
5
|
-
import { defineAtomicCapability, defineReadCapability } from "../capabilities/runtime/dispatcher.js";
|
|
6
4
|
import { AgentCatalogRepository, init_repository } from "./repository.js";
|
|
7
5
|
import { init_agent_scope, resolveAgentWorkspaceDir } from "../agent/agent-scope.js";
|
|
6
|
+
import { CapabilityError } from "../capabilities/runtime/errors.js";
|
|
7
|
+
import { defineAtomicCapability, defineReadCapability } from "../capabilities/runtime/dispatcher.js";
|
|
8
8
|
import { AgentCatalogService } from "./service.js";
|
|
9
9
|
import { z } from "zod";
|
|
10
10
|
//#region src/agent-catalog/capabilities.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
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_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
|
|
5
4
|
import { init_paths, resolveAgentAuthProfilesPath, resolveAuthProfilesPath, resolveCredentialsDir, resolveOAuthPath } from "../config/paths.js";
|
|
6
5
|
import { getOAuthProviderDefinition, init_registry } from "./oauth/registry.js";
|
|
6
|
+
import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
|
|
7
7
|
import { getApiKeyFromEnv, init_env_keys } from "../providers/env-keys.js";
|
|
8
8
|
import { init_oauth_provider_lock, withOAuthProviderLock } from "./oauth-provider-lock.js";
|
|
9
9
|
import { dirname, join } from "path";
|
|
@@ -3,8 +3,8 @@ import { init_paths, resolveOAuthPath } from "../config/paths.js";
|
|
|
3
3
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
4
|
import { dirname } from "node:path";
|
|
5
5
|
import { randomUUID } from "node:crypto";
|
|
6
|
-
import { mkdir, open, readFile, rm, stat } from "node:fs/promises";
|
|
7
6
|
import { setTimeout } from "node:timers/promises";
|
|
7
|
+
import { mkdir, open, readFile, rm, stat } from "node:fs/promises";
|
|
8
8
|
//#region src/auth/oauth-provider-lock.ts
|
|
9
9
|
function lockPath(providerId) {
|
|
10
10
|
return `${resolveOAuthPath(providerId.toLowerCase())}.lock`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { init_write_file_atomic, writeTextAtomicSync } from "../../infra/write-file-atomic.js";
|
|
2
1
|
import { init_paths, resolveCredentialsDir } from "../../config/paths.js";
|
|
2
|
+
import { init_write_file_atomic, writeTextAtomicSync } from "../../infra/write-file-atomic.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
|
|
@@ -3,10 +3,10 @@ import { init_src } from "../../../packages/gateway-contract/src/index.js";
|
|
|
3
3
|
import { init_trust_policy, resolveAutomationSafetyForTrust } from "../../user-context/trust-policy.js";
|
|
4
4
|
import { getUserTrustPolicy } from "../../storage/sqlite/user-trust-repository.js";
|
|
5
5
|
import { init_sqlite } from "../../storage/sqlite/index.js";
|
|
6
|
+
import { init_agent_scope, resolveDefaultAgentId } from "../../agent/agent-scope.js";
|
|
6
7
|
import { CapabilityError } from "../../capabilities/runtime/errors.js";
|
|
7
8
|
import { ExternalEffectNotAppliedError } from "../../capabilities/runtime/external-operations.js";
|
|
8
9
|
import { defineExternalCapability, defineReadCapability } from "../../capabilities/runtime/dispatcher.js";
|
|
9
|
-
import { init_agent_scope, resolveDefaultAgentId } from "../../agent/agent-scope.js";
|
|
10
10
|
import { AutomationCreateCapabilityInputSchema } from "./write.js";
|
|
11
11
|
import { simulateAutomation } from "../draft/automation-draft-validator.js";
|
|
12
12
|
import { AutomationDraftService } from "../draft/automation-draft-service.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { requireXopcDatabase } from "../storage/sqlite/connection.js";
|
|
2
2
|
import { init_sqlite } from "../storage/sqlite/index.js";
|
|
3
3
|
import { AgentCatalogService } from "../agent-catalog/service.js";
|
|
4
|
+
import { ensureStarterAgentsInitialized } from "../agent/starter-agents.js";
|
|
4
5
|
import { cutoverLegacyAgentConfig } from "../agent-catalog/migrations/legacy-config-cutover.js";
|
|
5
6
|
import "../agent-catalog/index.js";
|
|
6
|
-
import { ensureStarterAgentsInitialized } from "../agent/starter-agents.js";
|
|
7
7
|
import { migrateIdentityMarkdownToCatalog } from "../agent-catalog/migrations/identity-markdown-cutover.js";
|
|
8
8
|
import { runBootstrapMigrationsSync } from "../migrations/runner.js";
|
|
9
9
|
//#region src/bootstrap/application-state.ts
|
|
@@ -2,8 +2,8 @@ import { PACKAGE_VERSION, init_package_version } from "../../package-version.js"
|
|
|
2
2
|
import { resolveStateDir } from "../../config/paths-state.js";
|
|
3
3
|
import { createLogger } from "../../utils/logger/index.js";
|
|
4
4
|
import { init_logger } from "../../utils/logger.js";
|
|
5
|
-
import { init_write_file_atomic, writeTextAtomic } from "../../infra/write-file-atomic.js";
|
|
6
5
|
import { init_paths, resolveBinDir, resolveConfigPath } from "../../config/paths.js";
|
|
6
|
+
import { init_write_file_atomic, writeTextAtomic } from "../../infra/write-file-atomic.js";
|
|
7
7
|
import { assertCacheDir } from "../cache-dir-policy.js";
|
|
8
8
|
import { BROWSER_EXTENSION_ID, BROWSER_NATIVE_HOST_NAME } from "../extension-identity.js";
|
|
9
9
|
import "../native-messaging-host.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SqliteCommitEffectError, init_transaction } from "../../storage/sqlite/transaction.js";
|
|
2
|
-
import { OperationConflictError, executeAtomicOperation } from "./atomic-operations.js";
|
|
3
2
|
import { CapabilityError } from "./errors.js";
|
|
4
3
|
import { executeExternalOperation } from "./external-operations.js";
|
|
4
|
+
import { OperationConflictError, executeAtomicOperation } from "./atomic-operations.js";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
//#region src/capabilities/runtime/dispatcher.ts
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CapabilityError } from "./errors.js";
|
|
2
2
|
import { CapabilityDispatcher } from "./dispatcher.js";
|
|
3
|
-
import { registerAgentCapabilities } from "../../agent-catalog/capabilities.js";
|
|
4
3
|
import { registerLocalAppReadCapabilities } from "../../local-apps/capabilities/read.js";
|
|
5
4
|
import { registerNoteReadCapabilities } from "../../notes/capabilities/read.js";
|
|
6
5
|
import { registerNoteWriteCapabilities } from "../../notes/capabilities/write.js";
|
|
@@ -19,6 +18,7 @@ import { registerSceneReadCapabilities } from "../../scenes/capabilities/read.js
|
|
|
19
18
|
import { registerSceneWriteCapabilities } from "../../scenes/capabilities/write.js";
|
|
20
19
|
import { registerSettingsCapability } from "./settings.js";
|
|
21
20
|
import { registerAppContextCapability } from "./app-context.js";
|
|
21
|
+
import { registerAgentCapabilities } from "../../agent-catalog/capabilities.js";
|
|
22
22
|
//#region src/capabilities/runtime/product.ts
|
|
23
23
|
function createProductDispatcher(getNotes, taskWrites) {
|
|
24
24
|
const dispatcher = new CapabilityDispatcher();
|
|
@@ -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_agent_scope, resolveDefaultAgentId } from "../../agent/agent-scope.js";
|
|
4
3
|
import { getAgentDefaultModelRef, init_schema } from "../../config/schema.js";
|
|
4
|
+
import { init_agent_scope, resolveDefaultAgentId } from "../../agent/agent-scope.js";
|
|
5
5
|
import { init_agent_session_key, resolveAgentMainConversationId } from "../../routing/agent-session-key.js";
|
|
6
6
|
import { ExtensionLoader } from "../../extensions/loader.js";
|
|
7
7
|
import "../../extensions/index.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { normalizeAgentId, validateAgentIdForNewAgent } from "../../agent-catalog/id.js";
|
|
2
2
|
import { AgentCatalogRepository, init_repository } from "../../agent-catalog/repository.js";
|
|
3
3
|
import { init_agent_scope, resolveAgentDir, resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../../agent/agent-scope.js";
|
|
4
|
-
import { AgentCatalogService } from "../../agent-catalog/service.js";
|
|
5
4
|
import { resolveEffectiveAgentConfigForAgent } from "../../config/agent-profile.js";
|
|
5
|
+
import { AgentCatalogService } from "../../agent-catalog/service.js";
|
|
6
6
|
import { colors } from "../utils/colors.js";
|
|
7
7
|
//#region src/cli/commands/agents.ts
|
|
8
8
|
init_repository();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AgentCatalogRepository, init_repository } from "../../agent-catalog/repository.js";
|
|
2
|
-
import { AgentCatalogService } from "../../agent-catalog/service.js";
|
|
3
2
|
import { getAgentDefaultModelRef, init_schema } from "../../config/schema.js";
|
|
4
3
|
import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
|
|
5
4
|
import { getAllModels, getAvailableModels, getConfiguredProviders, getProviderAuthState, getProviderDisplayName, init_providers, isProviderConfigured, providerSupportsApiKey, providerSupportsOAuth, resolveModel } from "../../providers/index.js";
|
|
5
|
+
import { AgentCatalogService } from "../../agent-catalog/service.js";
|
|
6
6
|
import { loadConfig } from "../../config/loader.js";
|
|
7
7
|
import { formatExamples, register } from "../registry.js";
|
|
8
8
|
import { getContextWithOpts } from "../context.js";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AgentCatalogRepository, init_repository } from "../../../agent-catalog/repository.js";
|
|
2
|
-
import { AgentCatalogService } from "../../../agent-catalog/service.js";
|
|
3
2
|
import { getAgentDefaultModelRef, init_schema } from "../../../config/schema.js";
|
|
4
3
|
import { resolveModelsJsonPath } from "../../../config/paths.js";
|
|
5
4
|
import { init_models_json, loadModelsJson, saveModelsJson } from "../../../config/models-json.js";
|
|
@@ -7,6 +6,7 @@ import { getApiKeyFromEnv } from "../../../providers/env-keys.js";
|
|
|
7
6
|
import { getModelRegistry } from "../../../providers/model-registry.js";
|
|
8
7
|
import { CredentialResolver, init_credentials } from "../../../auth/credentials.js";
|
|
9
8
|
import { getAllProviders, getModelsByProvider, getProviderDisplayName, init_providers, providerSupportsApiKey, providerSupportsOAuth } from "../../../providers/index.js";
|
|
9
|
+
import { AgentCatalogService } from "../../../agent-catalog/service.js";
|
|
10
10
|
import { prepareUpdateGlobalDefaults } from "../../../gateway/global-defaults-admin.js";
|
|
11
11
|
import { discoverProviderModels, isProviderApiDiscoverable } from "../../../providers/model-discovery.js";
|
|
12
12
|
import { getXopcCloudCatalogCoordinator } from "../../../providers/xopc-cloud-catalog-coordinator.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AgentCatalogRepository, init_repository } from "../../agent-catalog/repository.js";
|
|
2
|
-
import { AgentCatalogService } from "../../agent-catalog/service.js";
|
|
3
2
|
import { ConfigSchema, init_schema } from "../../config/schema.js";
|
|
3
|
+
import { AgentCatalogService } from "../../agent-catalog/service.js";
|
|
4
4
|
import { assertConfigRewriteSafeForRunningGateway, saveConfig } from "../../config/loader.js";
|
|
5
5
|
import { ensureStarterAgentsInitialized } from "../../agent/starter-agents.js";
|
|
6
6
|
import { bootstrapApplicationStateSync } from "../../bootstrap/application-state.js";
|
package/dist/src/config/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ENV_VARS, XOPC_DB_FILENAME, resolveHomeDir, resolveStateDir, resolveXopcCloudCatalogCachePath, resolveXopcDatabasePath } from "./paths-state.js";
|
|
2
|
-
import { expandWorkspacePathString, init_workspace_path, normalizeWorkspaceDir, resolveWorkspaceRoot } from "./workspace-path.js";
|
|
3
|
-
import { resolveDefaultAgentWorkspaceDir } from "./workspace-defaults.js";
|
|
4
|
-
import { resolveAgentWorkspaceDir } from "../agent/agent-scope.js";
|
|
5
2
|
import { TelegramAccountConfigSchema, TelegramConfigSchema, TelegramGroupConfigSchema, TelegramTopicConfigSchema } from "../../extensions/telegram/src/config-schema.js";
|
|
6
3
|
import { WeixinAccountConfigSchema, WeixinConfigSchema } from "../../extensions/weixin/src/config-schema.js";
|
|
7
4
|
import { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema, BrowserConfigSchema, ChannelsConfigSchema, CommandsConfigSchema, ConfigSchema, ConnectorsConfigSchema, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewayScenesConfigSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GatewayWebchatConfigSchema, McpConfigSchema, McpOAuthConfigSchema, 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, TunnelConfigSchema, TunnelConsentSchema, UpdateAutoConfigSchema, UpdateConfigSchema, VoiceConfigSchema, VoiceRefinementConfigSchema, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, getAgentDefaultImageGenerationModelConfig, getAgentDefaultImageModelConfig, getAgentDefaultModelRef, init_schema, parseModelRef } from "./schema.js";
|
|
8
5
|
import { applyConfigOverrides, getConfigOverrides, resetConfigOverrides, setConfigOverride, unsetConfigOverride } from "./runtime-overrides.js";
|
|
6
|
+
import { expandWorkspacePathString, init_workspace_path, normalizeWorkspaceDir, resolveWorkspaceRoot } from "./workspace-path.js";
|
|
7
|
+
import { resolveDefaultAgentWorkspaceDir } from "./workspace-defaults.js";
|
|
8
|
+
import { resolveAgentWorkspaceDir } from "../agent/agent-scope.js";
|
|
9
9
|
import { extractProfileAgentId, resolveEffectiveAgentConfigForAgent, resolveEffectiveAgentConfigForSession, resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "./agent-profile.js";
|
|
10
10
|
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, resolveMcpOAuthPath, resolveModelsJsonPath, resolveNodeBinDir, resolveNodeBinPath, resolveNodeToolsDir, resolveNpmBinPath, resolveOAuthPath, resolvePidPath, resolveSkillPath, resolveSkillsCachePath, resolveSkillsDir, resolveSkillsLockPath, resolveSocketPath, resolveStatusPath, resolveToolsDir, resolveWorkspaceExtensionsDir, resolveWorkspaceFile, resolveWorkspaceStateDir, resolveWorkspaceStatePath, resolveXopcBinPath } from "./paths.js";
|
|
11
11
|
import { clearConfigValueCache, getAllowedCommands, getCacheStats, init_resolve_config_value, resolveConfigValue, resolveHeaders, testApiKeyResolution } from "./resolve-config-value.js";
|