@xopcai/xopc 0.0.308 → 0.0.309
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/_locales/en/messages.json +8 -0
- package/dist/browser-ext/_locales/zh_CN/messages.json +8 -0
- package/dist/browser-ext/dist/assets/{sidepanel-BbSQr-6P.css → sidepanel-DD6GEMvc.css} +16 -0
- package/dist/browser-ext/dist/sidepanel.html +1 -1
- package/dist/browser-ext/dist/sidepanel.js +537 -96
- 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-wgSB2HYK.js → activity-store-XKNYlFUI.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-dUotwUO6.js → agent-avatar-dicebear-1S2TFECE.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-C6LflMXr.js → agent-defaults-settings-panel-f0-YFMUz.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-VPDIGRSS.js → agents-CPqUMtCL.js} +1 -1
- package/dist/gateway/static/root/assets/{api-BKHmTb0w.js → api-BEUEE4f2.js} +1 -1
- package/dist/gateway/static/root/assets/api-CN4id43t.js +1 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-zPz0rOND.js → app-management-settings-panel-CgVBSqzu.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DhvhR43G.js → appearance-settings-CoWdCokb.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-Pmslbzzr.js → apps-page-CexHOcWg.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-BQVZMreT.js → archive-plugin-C3ZA6LRS.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CPE-TMPf.js → attachment-load-CdgS6_zy.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-C4IAy_zF.js → automations-page-BtHL2hpg.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-Fx5VUJRu.js → automations-workspace-onJPfmO6.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-DgTl7diZ.js → binary-plugins-CiDhtq_H.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CcOVA-Gw.js → block-editor-Br00T83w.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automation-inputs-BzkJog8e.js → browser-automation-inputs-D2tILykA.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page--zKAgj1k.js → browser-automations-page-BVuEmryB.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-DBms6d35.js → browser-settings-page-BgVTyPFY.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-epdDWIZy.js → capabilities-settings-panel-Dra8wj1S.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-B0bsDtmP.js → channels-settings-CkxiMDJ4.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-status-swr-B2JwuTjG.js → channels-status-swr-Dtder4G_.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-BfLd2rIJ.js → chat-terminal-dock-JsMtzDao.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-Ckgc0Py-.js → computer-settings-page-DHerePwo.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-BlC1OXX4.js → connector-service-page-DZFNUTiN.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-By33-bF1.js → connectors-page-cl9ZrV4D.js} +1 -1
- package/dist/gateway/static/root/assets/{cron-expression-CqNE-nf6.js → cron-expression-DAhdv_Xv.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-BS9ZjzYJ.js → date-picker-PacO1m3a.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-CF_zYzxX.js → dependency-picker-B-BcuG1y.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CDwtLR7Z.js → desktop-pet-CdBBhhdY.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-C0djIc1J.js → desktop-pet-settings-Gy03NgMI.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-CDKj9LQj.js → device-pairing-wizard-aV25nKag.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-CX5OXxEU.js → extension-debug-page-BFp5eKtY.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BytR1PaY.js → extension-page-DL3vyyH6.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CkaMJA5F.js → extension-settings-page-BXtvdAsY.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-B6wHa6ZI.js → gateway-config-swr-xAOGtenO.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-B53R0CA4.js → gateway-realtime-BuaTsMSi.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-BG95uGVW.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-settings-_YU-1p0z.js → gateway-settings-Dcr2Ikeh.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DRzGnEV-.js → gateway-startup-retry-BwDxKHd4.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-CVIvvm4x.js → heartbeat-settings-DOy3alvT.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-COCHelcL.js → home-page-CDm3dGVy.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-Ck_pyDom.js → image-generation-api-wGMeI_yW.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-DrtbjL8O.js → imports-page-zexFT5Rq.js} +1 -1
- package/dist/gateway/static/root/assets/index-D-vczw_0.css +1 -0
- package/dist/gateway/static/root/assets/{index-CDfcPiPb.js → index-DJo4DimT.js} +47 -47
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BlZh41Xq.js → keyboard-shortcuts-settings-CutG9zLh.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-D7_Raxjw.js → local-app-workbench-page-CwLvTwjn.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-DbP7wWuh.js → local-apps-page-CJy6I7Dt.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-msTfRK8P.js → locale-store-DPZ79W1-.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-C0n66FiO.js → logs-page-egGcPHNi.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-i6GhxpGV.js → management-settings-BQhIOELc.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-BInabSKf.js → markdown-view-p2P5hP1U.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CnWChQ3Y.js → media-plugins-CsBylqlN.js} +1 -1
- package/dist/gateway/static/root/assets/messages-BiYTyLJr.js +3 -0
- package/dist/gateway/static/root/assets/{note-detail-panel-C59d8vDW.js → note-detail-panel-c2k5Uz6X.js} +3 -3
- package/dist/gateway/static/root/assets/{notes-page-C1GBPrVI.js → notes-page-BLQWJMhf.js} +1 -1
- package/dist/gateway/static/root/assets/{page-tabs-BWitjb3e.js → page-tabs-ChQ4jJFs.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-UaCWCxZv.js → preview-open-alternatives-9B5W7nVE.js} +1 -1
- package/dist/gateway/static/root/assets/{proactive-page-CtSFJxoM.js → proactive-page-iOjI0d_e.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-gmi5LLwM.js → product-open-page-BADxWEdP.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-ILTmQ1YN.js → project-detail-page-BcxbQn2M.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-snl4rOQZ.js → projects-page-BuSvld0O.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-BSWtko7U.js → registry-api-B_e_nZSN.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-BbaAcEN3.js → remote-access-hub-CFS8LQKW.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CtOjKGWg.js → runtime-tools-settings-panel-D-pwiIyp.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-DkyyDcl2.js → schema-form-IWmb05DX.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-DrWL71O8.js → sessions-page-DZjc__ok.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-C1SM5B93.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-C0JDGN_V.js → settings-form-section-B0veRBZs.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DiIyMQ52.js → settings-page-CxRWyWYe.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-EPazhoZO.js → setup-status-panel-D9Rl7Tec.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-Bt1K657Y.js → share-preview-page-CirpgkfD.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-g2MdRXSZ.js → shares-settings-CwCThBs0.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DG6VGbOX.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-Wd0uYSPG.js → skills-page-BdRJ2vnL.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-vq5Ujm03.js → skills-page.utils-B42mpWKV.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-Cz1P-HDH.js → system-settings-panel-DXIZpAvU.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-BG3A5gPZ.js → task-detail-page-QXo9LJly.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-1SZ-HFHX.js → theme-store-BFbj_2Tu.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-DQGoFuZO.js → tunnel-api-Db2guRdW.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-DVDlBb95.js → use-autosave-DDY9qoXZ.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-qM5UiTGx.js → user-model-page-CzPmMkaO.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-B2pZCcxY.js → voice-api-key-field-BZbKQ8HT.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-DgJML_uM.js → voice-config-api-SKCeQLrH.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-Bptv7bEY.js → work-discovery-overlay-BRVTTXNG.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BijCrNc4.js → workflow-run-setup-panel-D2kuwv5e.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-DRy1RAYH.js → workflows-page-CQXtiYtq.js} +1 -1
- package/dist/gateway/static/root/index.html +12 -12
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/sessions.js +6 -1
- package/dist/src/agent/agent-manager.js +29 -4
- package/dist/src/agent/child-agent-factory.d.ts +1 -0
- package/dist/src/agent/child-agent-factory.js +18 -4
- package/dist/src/agent/coding/repository-instructions.d.ts +4 -0
- package/dist/src/agent/coding/repository-instructions.js +46 -2
- package/dist/src/agent/data-acquisition/git.d.ts +17 -0
- package/dist/src/agent/data-acquisition/git.js +100 -0
- package/dist/src/agent/data-acquisition/render.d.ts +7 -0
- package/dist/src/agent/data-acquisition/render.js +79 -0
- package/dist/src/agent/data-acquisition/scheduler.d.ts +12 -0
- package/dist/src/agent/data-acquisition/scheduler.js +53 -0
- package/dist/src/agent/data-acquisition/schema.d.ts +75 -0
- package/dist/src/agent/data-acquisition/schema.js +206 -0
- package/dist/src/agent/data-acquisition/service.d.ts +10 -0
- package/dist/src/agent/data-acquisition/service.js +292 -0
- package/dist/src/agent/data-acquisition/types.d.ts +37 -0
- package/dist/src/agent/data-acquisition/types.js +5 -0
- package/dist/src/agent/embedded/run-turn.js +16 -4
- package/dist/src/agent/embedded/session-runner.d.ts +1 -0
- package/dist/src/agent/embedded/session-runner.js +3 -0
- package/dist/src/agent/embedded/tool-result-truncation.js +11 -0
- package/dist/src/agent/embedded/xopc-tools-bridge.js +2 -1
- package/dist/src/agent/external-tools/composio-provider.js +12 -1
- package/dist/src/agent/external-tools/gateway-tools.js +2 -1
- package/dist/src/agent/external-tools/index.js +8 -1
- package/dist/src/agent/external-tools/read-policy.d.ts +6 -0
- package/dist/src/agent/external-tools/read-policy.js +21 -0
- package/dist/src/agent/external-tools/service.d.ts +1 -0
- package/dist/src/agent/external-tools/service.js +4 -1
- package/dist/src/agent/external-tools/types.d.ts +2 -0
- package/dist/src/agent/orchestration/agent-turn-policy.js +25 -10
- package/dist/src/agent/orchestration/delegation-scope.d.ts +9 -0
- package/dist/src/agent/orchestration/delegation-scope.js +11 -0
- package/dist/src/agent/prompt/sections/tooling.js +3 -1
- package/dist/src/agent/prompt/subagent-context.js +4 -2
- package/dist/src/agent/sandbox/fileAccess.d.ts +2 -0
- package/dist/src/agent/sandbox/fileAccess.js +31 -2
- package/dist/src/agent/tools/dataBatch.d.ts +4 -0
- package/dist/src/agent/tools/dataBatch.js +50 -0
- package/dist/src/agent/tools/delegate-tool.d.ts +6 -3
- package/dist/src/agent/tools/delegate-tool.js +65 -48
- package/dist/src/agent/tools/delegation-parent-policy.d.ts +7 -0
- package/dist/src/agent/tools/delegation-parent-policy.js +41 -0
- package/dist/src/agent/tools/delegation-policy.d.ts +16 -0
- package/dist/src/agent/tools/delegation-policy.js +93 -0
- package/dist/src/agent/tools/factory.d.ts +2 -0
- package/dist/src/agent/tools/factory.js +42 -3
- package/dist/src/agent/tools/fetch-text.d.ts +7 -0
- package/dist/src/agent/tools/fetch-text.js +86 -0
- package/dist/src/agent/tools/find.js +1 -1
- package/dist/src/agent/tools/grep.js +11 -23
- package/dist/src/agent/tools/index.d.ts +1 -0
- package/dist/src/agent/tools/index.js +2 -1
- package/dist/src/agent/tools/knowledge-memory-tool.js +10 -2
- package/dist/src/agent/tools/read.js +7 -5
- package/dist/src/agent/tools/repository-search.d.ts +12 -2
- package/dist/src/agent/tools/repository-search.js +127 -74
- package/dist/src/agent/tools/web.js +19 -28
- package/dist/src/agent/workflow/subagent-runner.js +25 -3
- package/dist/src/agent/workflow/workflow-child-tools.js +13 -8
- package/dist/src/agent-config/schema.d.ts +7 -0
- package/dist/src/agent-config/schema.js +2 -0
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/config/schema.d.ts +4 -0
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/heartbeat/service.js +2 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +2 -0
- package/dist/src/gateway/hono/routes/sessions.js +141 -13
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/storage/sqlite/index.d.ts +1 -0
- package/dist/src/storage/sqlite/index.js +2 -1
- package/dist/src/storage/sqlite/migrations/186_sidebar_layout.sql +16 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/sidebar-layout-repository.d.ts +12 -0
- package/dist/src/storage/sqlite/sidebar-layout-repository.js +53 -0
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/api-DFOlahZv.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-BLDgrJ30.js +0 -1
- package/dist/gateway/static/root/assets/index-CRu1p38D.css +0 -1
- package/dist/gateway/static/root/assets/messages-F74LVAiU.js +0 -3
- package/dist/gateway/static/root/assets/settings-advanced-gate-BG0kl4HT.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-B1DPzu98.js +0 -1
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?v=20260910-1" />
|
|
12
12
|
<link rel="manifest" href="/site.webmanifest?v=20260910-1" />
|
|
13
13
|
<title>XOPC — Keep what matters moving.</title>
|
|
14
|
-
<script type="module" crossorigin src="/assets/index-
|
|
14
|
+
<script type="module" crossorigin src="/assets/index-DJo4DimT.js"></script>
|
|
15
15
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-aKtaBQYM.js">
|
|
16
16
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-zJ_50EbN.js">
|
|
17
17
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-BOUWij0V.js">
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
<link rel="modulepreload" crossorigin href="/assets/download-Dk-ZjtO6.js">
|
|
26
26
|
<link rel="modulepreload" crossorigin href="/assets/plus-Q2yW6OE7.js">
|
|
27
27
|
<link rel="modulepreload" crossorigin href="/assets/x-B_N4OPjy.js">
|
|
28
|
-
<link rel="modulepreload" crossorigin href="/assets/messages-
|
|
29
|
-
<link rel="modulepreload" crossorigin href="/assets/locale-store-
|
|
28
|
+
<link rel="modulepreload" crossorigin href="/assets/messages-BiYTyLJr.js">
|
|
29
|
+
<link rel="modulepreload" crossorigin href="/assets/locale-store-DPZ79W1-.js">
|
|
30
30
|
<link rel="modulepreload" crossorigin href="/assets/cn-JdwAhgNB.js">
|
|
31
31
|
<link rel="modulepreload" crossorigin href="/assets/schemas-BaskVM5g.js">
|
|
32
32
|
<link rel="modulepreload" crossorigin href="/assets/product-delivery-CCC4FJ3Y.js">
|
|
33
33
|
<link rel="modulepreload" crossorigin href="/assets/app-link-BiBXVEvp.js">
|
|
34
34
|
<link rel="modulepreload" crossorigin href="/assets/copy-to-clipboard-HOJ79TWv.js">
|
|
35
|
-
<link rel="modulepreload" crossorigin href="/assets/markdown-view-
|
|
35
|
+
<link rel="modulepreload" crossorigin href="/assets/markdown-view-p2P5hP1U.js">
|
|
36
36
|
<link rel="modulepreload" crossorigin href="/assets/dist-Che_jiQF.js">
|
|
37
37
|
<link rel="modulepreload" crossorigin href="/assets/vendor-swr-BIWyz7Rc.js">
|
|
38
38
|
<link rel="modulepreload" crossorigin href="/assets/check-DUBLcKHA.js">
|
|
@@ -46,19 +46,19 @@
|
|
|
46
46
|
<link rel="modulepreload" crossorigin href="/assets/globe-DSSGFWFn.js">
|
|
47
47
|
<link rel="modulepreload" crossorigin href="/assets/loader-circle-CifKLtgG.js">
|
|
48
48
|
<link rel="modulepreload" crossorigin href="/assets/middleware-Pd0e8Igk.js">
|
|
49
|
-
<link rel="modulepreload" crossorigin href="/assets/gateway-realtime-store-
|
|
50
|
-
<link rel="modulepreload" crossorigin href="/assets/gateway-realtime-
|
|
49
|
+
<link rel="modulepreload" crossorigin href="/assets/gateway-realtime-store-BG95uGVW.js">
|
|
50
|
+
<link rel="modulepreload" crossorigin href="/assets/gateway-realtime-BuaTsMSi.js">
|
|
51
51
|
<link rel="modulepreload" crossorigin href="/assets/files-Be5viEFY.js">
|
|
52
52
|
<link rel="modulepreload" crossorigin href="/assets/tool-activity-BtJkgjFf.js">
|
|
53
53
|
<link rel="modulepreload" crossorigin href="/assets/button-CS04eWY9.js">
|
|
54
|
-
<link rel="modulepreload" crossorigin href="/assets/gateway-startup-retry-
|
|
55
|
-
<link rel="modulepreload" crossorigin href="/assets/registry-api-
|
|
56
|
-
<link rel="modulepreload" crossorigin href="/assets/gateway-config-swr-
|
|
54
|
+
<link rel="modulepreload" crossorigin href="/assets/gateway-startup-retry-BwDxKHd4.js">
|
|
55
|
+
<link rel="modulepreload" crossorigin href="/assets/registry-api-B_e_nZSN.js">
|
|
56
|
+
<link rel="modulepreload" crossorigin href="/assets/gateway-config-swr-xAOGtenO.js">
|
|
57
57
|
<link rel="modulepreload" crossorigin href="/assets/electron-env-Dit0bHgy.js">
|
|
58
|
-
<link rel="modulepreload" crossorigin href="/assets/activity-store-
|
|
59
|
-
<link rel="modulepreload" crossorigin href="/assets/theme-store-
|
|
58
|
+
<link rel="modulepreload" crossorigin href="/assets/activity-store-XKNYlFUI.js">
|
|
59
|
+
<link rel="modulepreload" crossorigin href="/assets/theme-store-BFbj_2Tu.js">
|
|
60
60
|
<link rel="stylesheet" crossorigin href="/assets/markdown-view-Y68dCxuc.css">
|
|
61
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
61
|
+
<link rel="stylesheet" crossorigin href="/assets/index-D-vczw_0.css">
|
|
62
62
|
</head>
|
|
63
63
|
<body>
|
|
64
64
|
<div id="root"></div>
|
package/dist/package.js
CHANGED
|
@@ -138,7 +138,12 @@ var init_sessions = __esmMin((() => {
|
|
|
138
138
|
offset: z.number(),
|
|
139
139
|
hasMore: z.boolean()
|
|
140
140
|
}),
|
|
141
|
-
inbox: sessionsListResponseSchema
|
|
141
|
+
inbox: sessionsListResponseSchema,
|
|
142
|
+
pinned: z.array(z.unknown()).default([]),
|
|
143
|
+
layouts: z.record(z.string(), z.object({
|
|
144
|
+
itemIds: z.array(z.string()),
|
|
145
|
+
revision: z.number().int().nonnegative()
|
|
146
|
+
})).default({})
|
|
142
147
|
}).passthrough();
|
|
143
148
|
}));
|
|
144
149
|
//#endregion
|
|
@@ -967,6 +967,8 @@ var AgentManager = class {
|
|
|
967
967
|
conversationId,
|
|
968
968
|
disabledTools: profile.tools.denied,
|
|
969
969
|
getPrimaryModel: () => agent?.state.model ?? model,
|
|
970
|
+
getParentTools: () => agent?.state.tools ?? [],
|
|
971
|
+
createDelegationPolicy: () => this.createAgentTurnPolicy(conversationId),
|
|
970
972
|
getMemoryManager: () => rt.memoryManager,
|
|
971
973
|
getSkillManager: () => rt.skillManager
|
|
972
974
|
});
|
|
@@ -1009,11 +1011,12 @@ var AgentManager = class {
|
|
|
1009
1011
|
};
|
|
1010
1012
|
}
|
|
1011
1013
|
buildAgentTurnPolicy(conversationId, profile) {
|
|
1014
|
+
const currentProfile = () => resolveEffectiveAgentProfileForSession(this.config.config, conversationId);
|
|
1012
1015
|
return createAgentTurnPolicy({
|
|
1013
1016
|
maxTurns: profile.config.runtime.maxTurns,
|
|
1014
1017
|
maxToolFailures: profile.config.runtime.maxToolFailuresPerTurn,
|
|
1015
1018
|
resolveToolLimit: (toolName, args) => {
|
|
1016
|
-
const policy = this.resolveToolPolicy(
|
|
1019
|
+
const policy = this.resolveToolPolicy(currentProfile(), toolName, args);
|
|
1017
1020
|
const maxCalls = policy?.maxCallsPerTurn;
|
|
1018
1021
|
return policy && maxCalls ? {
|
|
1019
1022
|
id: policy.id,
|
|
@@ -1039,8 +1042,12 @@ var AgentManager = class {
|
|
|
1039
1042
|
reason: decision.reason ?? "Blocked by collaboration rule."
|
|
1040
1043
|
};
|
|
1041
1044
|
}
|
|
1042
|
-
const policy = this.resolveToolPolicy(
|
|
1045
|
+
const policy = this.resolveToolPolicy(currentProfile(), toolName, args);
|
|
1043
1046
|
const detail = JSON.stringify(args ?? {});
|
|
1047
|
+
if (policy?.mode === "deny") return {
|
|
1048
|
+
block: true,
|
|
1049
|
+
reason: `${policy.id} is denied by tool policy.`
|
|
1050
|
+
};
|
|
1044
1051
|
if (policy?.mode === "ask") {
|
|
1045
1052
|
if (!await this.requestToolConfirmation(conversationId, policy?.id ?? toolName, detail)) return {
|
|
1046
1053
|
block: true,
|
|
@@ -1082,6 +1089,11 @@ var AgentManager = class {
|
|
|
1082
1089
|
});
|
|
1083
1090
|
}
|
|
1084
1091
|
resolveToolPolicy(profile, toolName, args) {
|
|
1092
|
+
const gatewayPolicy = profile.config.tools[toolName];
|
|
1093
|
+
if (gatewayPolicy && gatewayPolicy.mode !== "allow") return {
|
|
1094
|
+
id: toolName,
|
|
1095
|
+
...gatewayPolicy
|
|
1096
|
+
};
|
|
1085
1097
|
if (toolName !== "xopc_tool_execute") {
|
|
1086
1098
|
const policy = profile.config.tools[toolName];
|
|
1087
1099
|
return policy ? {
|
|
@@ -1089,13 +1101,26 @@ var AgentManager = class {
|
|
|
1089
1101
|
...policy
|
|
1090
1102
|
} : void 0;
|
|
1091
1103
|
}
|
|
1092
|
-
const
|
|
1093
|
-
|
|
1104
|
+
const toolRef = typeof args?.toolRef === "string" ? args.toolRef : "";
|
|
1105
|
+
const parsed = parseExternalToolRef(toolRef, "mcp");
|
|
1106
|
+
if (!parsed) {
|
|
1107
|
+
const externalPolicy = profile.config.tools[toolRef];
|
|
1108
|
+
return externalPolicy ? {
|
|
1109
|
+
id: toolRef,
|
|
1110
|
+
...externalPolicy
|
|
1111
|
+
} : gatewayPolicy ? {
|
|
1112
|
+
id: toolName,
|
|
1113
|
+
...gatewayPolicy
|
|
1114
|
+
} : void 0;
|
|
1115
|
+
}
|
|
1094
1116
|
const id = mcpToolPolicyId(parsed.namespace, parsed.toolName);
|
|
1095
1117
|
const policy = profile.config.tools[id];
|
|
1096
1118
|
return policy ? {
|
|
1097
1119
|
id,
|
|
1098
1120
|
...policy
|
|
1121
|
+
} : gatewayPolicy ? {
|
|
1122
|
+
id: toolName,
|
|
1123
|
+
...gatewayPolicy
|
|
1099
1124
|
} : void 0;
|
|
1100
1125
|
}
|
|
1101
1126
|
async requestToolConfirmation(conversationId, toolName, detail) {
|
|
@@ -30,6 +30,7 @@ export interface DelegateChildProgressHooks {
|
|
|
30
30
|
}) => void;
|
|
31
31
|
}
|
|
32
32
|
export interface DelegateChildHandleOptions {
|
|
33
|
+
authorizeToolCall?: import('./orchestration/agent-turn-policy.js').AgentTurnPolicyOptions['authorizeToolCall'];
|
|
33
34
|
workspace: string;
|
|
34
35
|
goal: string;
|
|
35
36
|
context?: string;
|
|
@@ -29,14 +29,20 @@ function createDelegateChildHandle(options) {
|
|
|
29
29
|
agentId: options.agentId,
|
|
30
30
|
getConfig: options.getConfig,
|
|
31
31
|
toolExecutorConfig: options.toolExecutorConfig,
|
|
32
|
-
browserConversationId: options.requesterConversationId ?? conversationId
|
|
32
|
+
browserConversationId: options.requesterConversationId ?? options.conversationId
|
|
33
33
|
}).filter((tool) => allow.has(tool.name));
|
|
34
34
|
const limit = Math.min(60, Math.max(1, Math.floor(options.maxIterations)));
|
|
35
35
|
let toolIterations = 0, exhausted = false, tokens = 0;
|
|
36
|
+
let terminationReason;
|
|
36
37
|
const policy = createAgentTurnPolicy({
|
|
37
38
|
maxTurns: limit + 1,
|
|
38
39
|
maxToolFailures: 5,
|
|
39
|
-
authorizeToolCall: async () => {
|
|
40
|
+
authorizeToolCall: async (context, signal) => {
|
|
41
|
+
const { toolCall } = context;
|
|
42
|
+
if (!allow.has(toolCall.name)) return {
|
|
43
|
+
block: true,
|
|
44
|
+
reason: "Tool is outside the delegated capability set."
|
|
45
|
+
};
|
|
40
46
|
if (toolIterations >= limit || tokens >= 1e5) {
|
|
41
47
|
exhausted = true;
|
|
42
48
|
return {
|
|
@@ -45,7 +51,15 @@ function createDelegateChildHandle(options) {
|
|
|
45
51
|
reason: "Sub-agent budget exhausted."
|
|
46
52
|
};
|
|
47
53
|
}
|
|
48
|
-
toolIterations++;
|
|
54
|
+
if (toolCall.name !== "data_batch") toolIterations++;
|
|
55
|
+
const decision = await options.authorizeToolCall?.(context, signal);
|
|
56
|
+
if (decision?.block) {
|
|
57
|
+
if (decision.terminate) {
|
|
58
|
+
exhausted = true;
|
|
59
|
+
terminationReason = decision.reason;
|
|
60
|
+
}
|
|
61
|
+
return decision;
|
|
62
|
+
}
|
|
49
63
|
}
|
|
50
64
|
});
|
|
51
65
|
const baseStop = policy.shouldStopAfterTurn;
|
|
@@ -118,7 +132,7 @@ function createDelegateChildHandle(options) {
|
|
|
118
132
|
const proof = verification?.type === "custom" ? verification.data : void 0;
|
|
119
133
|
const unverified = options.verifyChanges && proof?.changed && (!proof.evidence.some((item) => item.kind === "check" && item.status === "passed") || proof.evidence.some((item) => item.status !== "passed"));
|
|
120
134
|
return {
|
|
121
|
-
summary: result.lastAssistantText || result.errorMessage || (exhausted ? "Sub-agent budget exhausted." : "(no final response)"),
|
|
135
|
+
summary: [result.lastAssistantText || result.errorMessage, terminationReason].filter(Boolean).join("\n\n") || (exhausted ? "Sub-agent budget exhausted." : "(no final response)"),
|
|
122
136
|
toolIterations,
|
|
123
137
|
messages: await runtime.loadMessages(),
|
|
124
138
|
status: controller.signal.aborted ? "cancelled" : !result.ok ? "failed" : exhausted || unverified ? "partial" : "success",
|
|
@@ -8,5 +8,9 @@ export declare class RepositoryInstructions {
|
|
|
8
8
|
private constructor();
|
|
9
9
|
static open(workspace: string): Promise<RepositoryInstructions>;
|
|
10
10
|
forTool(name: string, input: unknown): Promise<string>;
|
|
11
|
+
forDataResult(content: Array<{
|
|
12
|
+
type: string;
|
|
13
|
+
text?: string;
|
|
14
|
+
}>): Promise<string>;
|
|
11
15
|
load(path: string, directory: boolean): Promise<string>;
|
|
12
16
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { validateDataBatch } from "../data-acquisition/schema.js";
|
|
2
|
+
import { isDataBatchResult } from "../data-acquisition/render.js";
|
|
3
|
+
import { basename, dirname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
2
4
|
import { execFile } from "node:child_process";
|
|
3
5
|
import { promisify } from "node:util";
|
|
4
6
|
import { readFile, realpath, stat } from "node:fs/promises";
|
|
@@ -35,6 +37,22 @@ var RepositoryInstructions = class RepositoryInstructions {
|
|
|
35
37
|
return new RepositoryInstructions(root, canonicalWorkspace);
|
|
36
38
|
}
|
|
37
39
|
async forTool(name, input) {
|
|
40
|
+
if (name === "data_batch") {
|
|
41
|
+
validateDataBatch(input);
|
|
42
|
+
const sections = [];
|
|
43
|
+
for (const operation of input.operations) {
|
|
44
|
+
const paths = operation.kind === "file_read" || operation.kind === "git_read" ? [operation.path] : operation.kind === "file_search" ? operation.paths : operation.kind === "git_recent" ? operation.paths ?? ["."] : [];
|
|
45
|
+
for (const path of paths) {
|
|
46
|
+
let directory = false;
|
|
47
|
+
try {
|
|
48
|
+
directory = (await stat(resolve(this.workspace, path))).isDirectory();
|
|
49
|
+
} catch {}
|
|
50
|
+
const section = await this.load(path, directory);
|
|
51
|
+
if (section && !sections.includes(section)) sections.push(section);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return sections.join("\n\n");
|
|
55
|
+
}
|
|
38
56
|
const args = input && typeof input === "object" ? input : {};
|
|
39
57
|
if (name === "apply_patch") {
|
|
40
58
|
const paths = [...String(args.patch ?? "").matchAll(/^\*\*\* (?:Add File|Update File|Delete File|Move to): (.+)$/gm)].map((match) => match[1].trim());
|
|
@@ -44,8 +62,34 @@ var RepositoryInstructions = class RepositoryInstructions {
|
|
|
44
62
|
if (name === "exec_command" || name === "managed_job" && args.action === "start") return this.load(typeof args.cwd === "string" ? args.cwd : ".", true);
|
|
45
63
|
return "";
|
|
46
64
|
}
|
|
65
|
+
async forDataResult(content) {
|
|
66
|
+
const sections = /* @__PURE__ */ new Set();
|
|
67
|
+
for (const block of content) {
|
|
68
|
+
if (block.type !== "text" || !block.text) continue;
|
|
69
|
+
let result;
|
|
70
|
+
try {
|
|
71
|
+
result = JSON.parse(block.text);
|
|
72
|
+
} catch {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
if (!isDataBatchResult(result)) continue;
|
|
76
|
+
for (const fragment of result.fragments) {
|
|
77
|
+
if (fragment.source.kind !== "file") continue;
|
|
78
|
+
const section = await this.load(fragment.source.resource, false);
|
|
79
|
+
if (section) sections.add(section);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return [...sections].join("\n\n");
|
|
83
|
+
}
|
|
47
84
|
async load(path, directory) {
|
|
48
|
-
|
|
85
|
+
let target = resolve(this.workspace, path);
|
|
86
|
+
try {
|
|
87
|
+
target = await realpath(target);
|
|
88
|
+
} catch {
|
|
89
|
+
try {
|
|
90
|
+
target = resolve(await realpath(dirname(target)), basename(target));
|
|
91
|
+
} catch {}
|
|
92
|
+
}
|
|
49
93
|
if (!inside(this.root, target)) return "";
|
|
50
94
|
const leaf = directory ? target : dirname(target);
|
|
51
95
|
const directories = [];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type GitDataOperation = {
|
|
2
|
+
kind: 'git_recent';
|
|
3
|
+
paths?: string[];
|
|
4
|
+
since?: string;
|
|
5
|
+
until?: string;
|
|
6
|
+
} | {
|
|
7
|
+
kind: 'git_read';
|
|
8
|
+
path: string;
|
|
9
|
+
commit: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function readGitData(workspace: string, operation: GitDataOperation, signal: AbortSignal, onRequest: () => void): Promise<{
|
|
12
|
+
text: string;
|
|
13
|
+
resource: string;
|
|
14
|
+
revision: string;
|
|
15
|
+
exhausted: boolean;
|
|
16
|
+
reason: string;
|
|
17
|
+
}>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { runProcess } from "../../process/run-process.js";
|
|
2
|
+
import { evaluateExecPolicy } from "../sandbox/exec-policy.js";
|
|
3
|
+
import { checkedFilePath } from "../sandbox/fileAccess.js";
|
|
4
|
+
import { dataScheduler } from "./scheduler.js";
|
|
5
|
+
import { relative, resolve, sep } from "node:path";
|
|
6
|
+
//#region src/agent/data-acquisition/git.ts
|
|
7
|
+
async function readGitData(workspace, operation, signal, onRequest) {
|
|
8
|
+
const cwd = checkedFilePath(workspace, workspace, "read");
|
|
9
|
+
const policy = evaluateExecPolicy({
|
|
10
|
+
command: "git log",
|
|
11
|
+
cwd,
|
|
12
|
+
workspaceRoot: workspace
|
|
13
|
+
});
|
|
14
|
+
if (!policy.allowed) throw new Error(`Sandbox: ${policy.reason}`);
|
|
15
|
+
const env = Object.fromEntries(Object.entries(policy.sanitizedEnv).filter(([key]) => !key.startsWith("GIT_")));
|
|
16
|
+
env.GIT_CONFIG_NOSYSTEM = "1";
|
|
17
|
+
env.GIT_CONFIG_GLOBAL = process.platform === "win32" ? "NUL" : "/dev/null";
|
|
18
|
+
env.GIT_OPTIONAL_LOCKS = "0";
|
|
19
|
+
const run = async (args) => dataScheduler.run(cwd, signal, async () => {
|
|
20
|
+
onRequest();
|
|
21
|
+
const result = await runProcess({
|
|
22
|
+
program: "git",
|
|
23
|
+
args: [
|
|
24
|
+
"--no-pager",
|
|
25
|
+
"--literal-pathspecs",
|
|
26
|
+
"-c",
|
|
27
|
+
"core.fsmonitor=false",
|
|
28
|
+
"-c",
|
|
29
|
+
"core.hooksPath=/dev/null",
|
|
30
|
+
...args
|
|
31
|
+
],
|
|
32
|
+
cwd,
|
|
33
|
+
env,
|
|
34
|
+
signal,
|
|
35
|
+
timeoutMs: 5e3,
|
|
36
|
+
maxOutputBytes: 64 * 1024,
|
|
37
|
+
terminationPolicy: "tree"
|
|
38
|
+
});
|
|
39
|
+
signal.throwIfAborted();
|
|
40
|
+
if (result.exitCode !== 0 || result.timedOut) throw new Error(result.stderr || "Git data is unavailable");
|
|
41
|
+
return result;
|
|
42
|
+
});
|
|
43
|
+
if (operation.kind === "git_read") {
|
|
44
|
+
const target = checkedFilePath(workspace, resolve(workspace, operation.path), "read");
|
|
45
|
+
const path = relative((await run(["rev-parse", "--show-toplevel"])).stdout.trim(), target).split(sep).join("/");
|
|
46
|
+
if (path.startsWith("../") || path === "..") throw new Error("Git file must be inside the repository");
|
|
47
|
+
const result = await run([
|
|
48
|
+
"show",
|
|
49
|
+
"--no-ext-diff",
|
|
50
|
+
"--no-textconv",
|
|
51
|
+
`${operation.commit}:${path}`
|
|
52
|
+
]);
|
|
53
|
+
if (result.stdout.includes("\0")) throw new Error("Git object is binary; use a format-specific tool");
|
|
54
|
+
return {
|
|
55
|
+
text: result.stdout,
|
|
56
|
+
resource: target,
|
|
57
|
+
revision: operation.commit,
|
|
58
|
+
exhausted: !result.outputTruncated,
|
|
59
|
+
reason: result.outputTruncated ? "output_budget" : void 0
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
const paths = (operation.paths ?? ["."]).map((path) => checkedFilePath(workspace, resolve(workspace, path), "read"));
|
|
63
|
+
for (const value of [operation.since, operation.until]) if (value && !Number.isFinite(Date.parse(value))) throw new Error("Invalid Git date");
|
|
64
|
+
const head = (await run([
|
|
65
|
+
"rev-parse",
|
|
66
|
+
"--verify",
|
|
67
|
+
"HEAD"
|
|
68
|
+
])).stdout.trim();
|
|
69
|
+
const shallow = (await run(["rev-parse", "--is-shallow-repository"])).stdout.trim() === "true";
|
|
70
|
+
const recent = await run([
|
|
71
|
+
"log",
|
|
72
|
+
"--no-ext-diff",
|
|
73
|
+
"--no-textconv",
|
|
74
|
+
"--format=%H %cI %s",
|
|
75
|
+
"-21",
|
|
76
|
+
...operation.since ? [`--since=${operation.since}`] : [],
|
|
77
|
+
...operation.until ? [`--until=${operation.until}`] : [],
|
|
78
|
+
"HEAD",
|
|
79
|
+
"--",
|
|
80
|
+
...paths
|
|
81
|
+
]);
|
|
82
|
+
const rows = recent.stdout.trim().split("\n").filter(Boolean);
|
|
83
|
+
const dirty = (await run([
|
|
84
|
+
"status",
|
|
85
|
+
"--porcelain",
|
|
86
|
+
"--untracked-files=normal",
|
|
87
|
+
"--",
|
|
88
|
+
...paths
|
|
89
|
+
])).stdout.length > 0;
|
|
90
|
+
const omitted = recent.outputTruncated || rows.length > 20;
|
|
91
|
+
return {
|
|
92
|
+
text: `HEAD: ${head}\nDirty worktree: ${dirty}\nShallow history: ${shallow}\n${rows.slice(0, 20).join("\n")}`,
|
|
93
|
+
resource: cwd,
|
|
94
|
+
revision: head,
|
|
95
|
+
exhausted: !omitted && !shallow,
|
|
96
|
+
reason: omitted ? "output_budget" : shallow ? "shallow_history" : void 0
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
100
|
+
export { readGitData };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type DataBatchResult } from './types.js';
|
|
2
|
+
/** Keep a valid envelope and explicit omissions even under a second context reduction. */
|
|
3
|
+
export declare function renderDataBatch(input: DataBatchResult, maxChars?: number): {
|
|
4
|
+
text: string;
|
|
5
|
+
result: DataBatchResult;
|
|
6
|
+
};
|
|
7
|
+
export declare function isDataBatchResult(value: unknown): value is DataBatchResult;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { DATA_MAX_CHARS } from "./types.js";
|
|
2
|
+
//#region src/agent/data-acquisition/render.ts
|
|
3
|
+
/** Keep a valid envelope and explicit omissions even under a second context reduction. */
|
|
4
|
+
function renderDataBatch(input, maxChars = DATA_MAX_CHARS) {
|
|
5
|
+
const result = structuredClone(input);
|
|
6
|
+
const omitted = /* @__PURE__ */ new Set();
|
|
7
|
+
const encode = () => JSON.stringify(result);
|
|
8
|
+
const mark = () => {
|
|
9
|
+
for (const operation of result.operations) {
|
|
10
|
+
operation.fragmentIds = operation.fragmentIds.filter((id) => result.fragments.some((fragment) => fragment.id === id));
|
|
11
|
+
if (omitted.has(operation.id)) {
|
|
12
|
+
operation.outputOmitted = true;
|
|
13
|
+
if (operation.status === "ok") operation.status = "partial";
|
|
14
|
+
operation.reason ??= "output_budget";
|
|
15
|
+
if (operation.kind === "file_read") {
|
|
16
|
+
const original = input.fragments.find((fragment) => fragment.operationIds.includes(operation.id));
|
|
17
|
+
const kept = result.fragments.find((fragment) => fragment.operationIds.includes(operation.id));
|
|
18
|
+
if (original?.startLine !== void 0) operation.next = {
|
|
19
|
+
path: original.source.resource,
|
|
20
|
+
startLine: kept?.endLine !== void 0 ? kept.endLine + 1 : original.startLine,
|
|
21
|
+
maxLines: operation.next?.maxLines ?? 120
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
let text = encode();
|
|
28
|
+
while (text.length > maxChars || Buffer.byteLength(text) > 32768) {
|
|
29
|
+
const nonempty = result.fragments.filter((fragment) => fragment.text.length > 0);
|
|
30
|
+
if (nonempty.length) {
|
|
31
|
+
for (const fragment of nonempty) {
|
|
32
|
+
fragment.operationIds.forEach((id) => omitted.add(id));
|
|
33
|
+
const lines = fragment.text.split("\n");
|
|
34
|
+
if (lines.length > 1) {
|
|
35
|
+
fragment.text = lines.slice(0, Math.floor(lines.length / 2)).join("\n");
|
|
36
|
+
if (fragment.startLine !== void 0) fragment.endLine = fragment.startLine + fragment.text.split("\n").length - 1;
|
|
37
|
+
} else fragment.text = "";
|
|
38
|
+
}
|
|
39
|
+
result.fragments = result.fragments.filter((fragment) => fragment.text.length > 0);
|
|
40
|
+
} else {
|
|
41
|
+
for (const operation of result.operations) {
|
|
42
|
+
operation.scope = "";
|
|
43
|
+
operation.reason = operation.reason?.slice(0, 80);
|
|
44
|
+
delete operation.next;
|
|
45
|
+
}
|
|
46
|
+
mark();
|
|
47
|
+
for (const operation of result.operations) delete operation.next;
|
|
48
|
+
text = encode();
|
|
49
|
+
if (text.length <= maxChars && Buffer.byteLength(text) <= 32768) break;
|
|
50
|
+
text = JSON.stringify({
|
|
51
|
+
status: "partial",
|
|
52
|
+
reason: "output_budget",
|
|
53
|
+
operations: result.operations.map((op) => ({
|
|
54
|
+
id: op.id,
|
|
55
|
+
status: op.status
|
|
56
|
+
}))
|
|
57
|
+
});
|
|
58
|
+
if (text.length > maxChars) text = "{\"status\":\"partial\"}";
|
|
59
|
+
if (text.length > maxChars) text = "";
|
|
60
|
+
return {
|
|
61
|
+
text,
|
|
62
|
+
result
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
mark();
|
|
66
|
+
text = encode();
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
text,
|
|
70
|
+
result
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function isDataBatchResult(value) {
|
|
74
|
+
if (!value || typeof value !== "object") return false;
|
|
75
|
+
const item = value;
|
|
76
|
+
return item.schemaVersion === 1 && Array.isArray(item.operations) && item.operations.length <= 8 && item.operations.every((op) => op && typeof op.id === "string" && Array.isArray(op.fragmentIds) && typeof op.scope === "string") && Array.isArray(item.fragments) && item.fragments.length <= 256 && item.fragments.every((fragment) => fragment && typeof fragment.text === "string" && Array.isArray(fragment.operationIds) && fragment.source && typeof fragment.source.kind === "string" && typeof fragment.source.resource === "string");
|
|
77
|
+
}
|
|
78
|
+
//#endregion
|
|
79
|
+
export { isDataBatchResult, renderDataBatch };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Shared limits across batches and callers; queued cancellation never consumes a permit. */
|
|
2
|
+
export declare class DataScheduler {
|
|
3
|
+
private readonly totalLimit;
|
|
4
|
+
private readonly resourceLimit;
|
|
5
|
+
private readonly running;
|
|
6
|
+
private readonly queue;
|
|
7
|
+
private active;
|
|
8
|
+
constructor(totalLimit?: number, resourceLimit?: number);
|
|
9
|
+
run<T>(key: string, signal: AbortSignal | undefined, task: () => Promise<T>): Promise<T>;
|
|
10
|
+
private drain;
|
|
11
|
+
}
|
|
12
|
+
export declare const dataScheduler: DataScheduler;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//#region src/agent/data-acquisition/scheduler.ts
|
|
2
|
+
/** Shared limits across batches and callers; queued cancellation never consumes a permit. */
|
|
3
|
+
var DataScheduler = class {
|
|
4
|
+
running = /* @__PURE__ */ new Map();
|
|
5
|
+
queue = [];
|
|
6
|
+
active = 0;
|
|
7
|
+
constructor(totalLimit = 8, resourceLimit = 4) {
|
|
8
|
+
this.totalLimit = totalLimit;
|
|
9
|
+
this.resourceLimit = resourceLimit;
|
|
10
|
+
}
|
|
11
|
+
run(key, signal, task) {
|
|
12
|
+
signal?.throwIfAborted();
|
|
13
|
+
return new Promise((resolve, reject) => {
|
|
14
|
+
const item = {
|
|
15
|
+
key,
|
|
16
|
+
signal,
|
|
17
|
+
abort: () => {
|
|
18
|
+
const index = this.queue.indexOf(item);
|
|
19
|
+
if (index !== -1) this.queue.splice(index, 1);
|
|
20
|
+
reject(signal?.reason ?? /* @__PURE__ */ new Error("Data operation cancelled"));
|
|
21
|
+
},
|
|
22
|
+
start: () => {
|
|
23
|
+
signal?.removeEventListener("abort", item.abort);
|
|
24
|
+
this.active++;
|
|
25
|
+
this.running.set(key, (this.running.get(key) ?? 0) + 1);
|
|
26
|
+
Promise.resolve().then(() => {
|
|
27
|
+
signal?.throwIfAborted();
|
|
28
|
+
return task();
|
|
29
|
+
}).then(resolve, reject).finally(() => {
|
|
30
|
+
this.active--;
|
|
31
|
+
const count = (this.running.get(key) ?? 1) - 1;
|
|
32
|
+
if (count) this.running.set(key, count);
|
|
33
|
+
else this.running.delete(key);
|
|
34
|
+
this.drain();
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
signal?.addEventListener("abort", item.abort, { once: true });
|
|
39
|
+
this.queue.push(item);
|
|
40
|
+
this.drain();
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
drain() {
|
|
44
|
+
while (this.active < this.totalLimit) {
|
|
45
|
+
const index = this.queue.findIndex((item) => (this.running.get(item.key) ?? 0) < this.resourceLimit);
|
|
46
|
+
if (index === -1) return;
|
|
47
|
+
this.queue.splice(index, 1)[0].start();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const dataScheduler = new DataScheduler();
|
|
52
|
+
//#endregion
|
|
53
|
+
export { DataScheduler, dataScheduler };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { type Static } from '@sinclair/typebox';
|
|
2
|
+
export declare const DataBatchSchema: import("@sinclair/typebox").TObject<{
|
|
3
|
+
operations: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
4
|
+
id: import("@sinclair/typebox").TString;
|
|
5
|
+
kind: import("@sinclair/typebox").TLiteral<"file_read">;
|
|
6
|
+
path: import("@sinclair/typebox").TString;
|
|
7
|
+
startLine: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
8
|
+
maxLines: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
9
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
10
|
+
id: import("@sinclair/typebox").TString;
|
|
11
|
+
kind: import("@sinclair/typebox").TLiteral<"file_search">;
|
|
12
|
+
paths: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
13
|
+
patterns: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
14
|
+
literal: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
15
|
+
ignoreCase: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
16
|
+
glob: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
17
|
+
contextLines: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
18
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
19
|
+
id: import("@sinclair/typebox").TString;
|
|
20
|
+
kind: import("@sinclair/typebox").TLiteral<"git_recent">;
|
|
21
|
+
paths: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
22
|
+
since: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
23
|
+
until: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
24
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
25
|
+
id: import("@sinclair/typebox").TString;
|
|
26
|
+
kind: import("@sinclair/typebox").TLiteral<"git_read">;
|
|
27
|
+
path: import("@sinclair/typebox").TString;
|
|
28
|
+
commit: import("@sinclair/typebox").TString;
|
|
29
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
30
|
+
id: import("@sinclair/typebox").TString;
|
|
31
|
+
kind: import("@sinclair/typebox").TLiteral<"knowledge_search">;
|
|
32
|
+
query: import("@sinclair/typebox").TString;
|
|
33
|
+
maxResults: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
34
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
35
|
+
id: import("@sinclair/typebox").TString;
|
|
36
|
+
kind: import("@sinclair/typebox").TLiteral<"knowledge_get">;
|
|
37
|
+
knowledgeId: import("@sinclair/typebox").TString;
|
|
38
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
39
|
+
id: import("@sinclair/typebox").TString;
|
|
40
|
+
kind: import("@sinclair/typebox").TLiteral<"web_search">;
|
|
41
|
+
query: import("@sinclair/typebox").TString;
|
|
42
|
+
count: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
43
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
44
|
+
id: import("@sinclair/typebox").TString;
|
|
45
|
+
kind: import("@sinclair/typebox").TLiteral<"web_fetch">;
|
|
46
|
+
url: import("@sinclair/typebox").TString;
|
|
47
|
+
maxChars: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
48
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
49
|
+
id: import("@sinclair/typebox").TString;
|
|
50
|
+
kind: import("@sinclair/typebox").TLiteral<"external_read">;
|
|
51
|
+
toolRef: import("@sinclair/typebox").TString;
|
|
52
|
+
revision: import("@sinclair/typebox").TString;
|
|
53
|
+
arguments: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>;
|
|
54
|
+
}>]>>;
|
|
55
|
+
}>;
|
|
56
|
+
export type DataBatchArgs = Static<typeof DataBatchSchema>;
|
|
57
|
+
export type DataOperation = DataBatchArgs['operations'][number];
|
|
58
|
+
export declare const DATA_OPERATION_TOOLS: {
|
|
59
|
+
readonly file_read: "read_file";
|
|
60
|
+
readonly file_search: "grep";
|
|
61
|
+
readonly git_recent: "exec_command";
|
|
62
|
+
readonly git_read: "exec_command";
|
|
63
|
+
readonly knowledge_search: "knowledge_search";
|
|
64
|
+
readonly knowledge_get: "knowledge_get";
|
|
65
|
+
readonly web_search: "web_search";
|
|
66
|
+
readonly web_fetch: "web_fetch";
|
|
67
|
+
readonly external_read: "xopc_tool_execute";
|
|
68
|
+
};
|
|
69
|
+
export declare function nativeDataArgs(op: DataOperation): Record<string, unknown>;
|
|
70
|
+
/** Expose each underlying access to existing approval, hook and call-limit policies. */
|
|
71
|
+
export declare function dataOperationCalls(args: unknown): Array<{
|
|
72
|
+
name: string;
|
|
73
|
+
args: Record<string, unknown>;
|
|
74
|
+
}>;
|
|
75
|
+
export declare function validateDataBatch(args: unknown): asserts args is DataBatchArgs;
|