@1agents/acp-service 0.8.3 → 0.9.1
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/README.md +25 -13
- package/dist/bin/a2a.js +16 -4
- package/dist/bin/acp-service.js +30 -0
- package/dist/bin/process.d.ts +4 -0
- package/dist/bin/process.js +57 -0
- package/dist/bin/roles.d.ts +1 -0
- package/dist/bin/roles.js +24 -0
- package/dist/bin/rsi.d.ts +3 -0
- package/dist/bin/rsi.js +114 -0
- package/dist/bin/ticket.d.ts +13 -0
- package/dist/bin/ticket.js +97 -0
- package/dist/bin/trail.d.ts +4 -0
- package/dist/bin/trail.js +62 -0
- package/dist/src/a2a/artifact-content.d.ts +9 -0
- package/dist/src/a2a/artifact-content.js +45 -0
- package/dist/src/a2a/desktop-notify.d.ts +1 -0
- package/dist/src/a2a/desktop-notify.js +12 -0
- package/dist/src/a2a/execution-binding.d.ts +9 -0
- package/dist/src/a2a/execution-binding.js +19 -0
- package/dist/src/a2a/executor.d.ts +22 -1
- package/dist/src/a2a/executor.js +308 -22
- package/dist/src/a2a/gateway.d.ts +613 -1
- package/dist/src/a2a/gateway.js +1337 -88
- package/dist/src/a2a/index.d.ts +14 -1
- package/dist/src/a2a/index.js +8 -0
- package/dist/src/a2a/job-directory.d.ts +6 -0
- package/dist/src/a2a/job-directory.js +19 -0
- package/dist/src/a2a/preflight.js +16 -1
- package/dist/src/a2a/resubmit.d.ts +46 -0
- package/dist/src/a2a/resubmit.js +82 -0
- package/dist/src/a2a/result-metadata.d.ts +6 -0
- package/dist/src/a2a/result-metadata.js +25 -6
- package/dist/src/a2a/server.d.ts +10 -0
- package/dist/src/a2a/server.js +127 -2
- package/dist/src/a2a/session-lifecycle.d.ts +40 -0
- package/dist/src/a2a/session-lifecycle.js +54 -0
- package/dist/src/a2a/store.d.ts +4 -0
- package/dist/src/a2a/store.js +76 -1
- package/dist/src/a2a/types.d.ts +77 -1
- package/dist/src/a2a/types.js +11 -1
- package/dist/src/a2a/workbench-ui.d.ts +28 -0
- package/dist/src/a2a/workbench-ui.js +182 -0
- package/dist/src/acp-connection.js +119 -14
- package/dist/src/bridge.d.ts +1 -0
- package/dist/src/bridge.js +312 -37
- package/dist/src/capacity-lifecycle.d.ts +5 -0
- package/dist/src/capacity-lifecycle.js +57 -0
- package/dist/src/capacity-queue.d.ts +58 -0
- package/dist/src/capacity-queue.js +388 -0
- package/dist/src/capacity.d.ts +101 -0
- package/dist/src/capacity.js +416 -0
- package/dist/src/dsh.js +1 -1
- package/dist/src/execution/agent-files.d.ts +25 -0
- package/dist/src/execution/agent-files.js +90 -0
- package/dist/src/execution/agent-registry.d.ts +164 -0
- package/dist/src/execution/agent-registry.js +275 -0
- package/dist/src/execution/human-review.d.ts +105 -0
- package/dist/src/execution/human-review.js +89 -0
- package/dist/src/execution/ledger.d.ts +57 -0
- package/dist/src/execution/ledger.js +122 -13
- package/dist/src/execution/ppt-delivery.d.ts +36 -3
- package/dist/src/execution/ppt-delivery.js +243 -53
- package/dist/src/execution/process-request.d.ts +151 -0
- package/dist/src/execution/process-request.js +177 -0
- package/dist/src/execution/project-discovery.d.ts +56 -0
- package/dist/src/execution/project-discovery.js +429 -0
- package/dist/src/execution/report-review.d.ts +60 -0
- package/dist/src/execution/report-review.js +173 -0
- package/dist/src/execution/targets.d.ts +20 -0
- package/dist/src/execution/targets.js +23 -3
- package/dist/src/execution/ticket-executor.d.ts +25 -0
- package/dist/src/execution/ticket-executor.js +27 -0
- package/dist/src/execution/ticket.d.ts +326 -0
- package/dist/src/execution/ticket.js +301 -0
- package/dist/src/execution/workbench-chat.d.ts +25 -0
- package/dist/src/execution/workbench-chat.js +54 -0
- package/dist/src/execution/workbench.d.ts +162 -0
- package/dist/src/execution/workbench.js +356 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.js +3 -0
- package/dist/src/roles/index.d.ts +1 -0
- package/dist/src/roles/index.js +1 -0
- package/dist/src/roles/skills.d.ts +71 -0
- package/dist/src/roles/skills.js +427 -0
- package/dist/src/rsi/gate.d.ts +25 -0
- package/dist/src/rsi/gate.js +59 -0
- package/dist/src/rsi/outline-run.d.ts +107 -0
- package/dist/src/rsi/outline-run.js +443 -0
- package/dist/workbench-ui/app.css +453 -0
- package/dist/workbench-ui/app.js +13 -0
- package/dist/workbench-ui/chunk-23JHGYT3.js +1 -0
- package/dist/workbench-ui/chunk-3H6STGPV.js +1 -0
- package/dist/workbench-ui/chunk-3SNBBMGH.js +1 -0
- package/dist/workbench-ui/chunk-3XJZ6DIE.js +1 -0
- package/dist/workbench-ui/chunk-44KDLLKJ.js +1 -0
- package/dist/workbench-ui/chunk-46H7FU5Y.js +7 -0
- package/dist/workbench-ui/chunk-4N44QPL7.js +1 -0
- package/dist/workbench-ui/chunk-4YN4BS7I.js +1 -0
- package/dist/workbench-ui/chunk-53EG4IVQ.js +96 -0
- package/dist/workbench-ui/chunk-5FIPUNR4.js +1 -0
- package/dist/workbench-ui/chunk-6DWWYA6G.js +2 -0
- package/dist/workbench-ui/chunk-6FU3T633.js +99 -0
- package/dist/workbench-ui/chunk-6XKIHRA4.js +1 -0
- package/dist/workbench-ui/chunk-7GIX43Y5.js +1 -0
- package/dist/workbench-ui/chunk-7Q4WBGX6.js +4 -0
- package/dist/workbench-ui/chunk-A3BQM7HR.js +1 -0
- package/dist/workbench-ui/chunk-AFCFDDOP.js +24 -0
- package/dist/workbench-ui/chunk-AG67EUYD.js +89 -0
- package/dist/workbench-ui/chunk-AGJHMMTN.js +1 -0
- package/dist/workbench-ui/chunk-AO6JUBV6.js +41 -0
- package/dist/workbench-ui/chunk-AUSLTP43.js +72 -0
- package/dist/workbench-ui/chunk-AVZL46TT.js +1 -0
- package/dist/workbench-ui/chunk-AZRIGIV2.js +168 -0
- package/dist/workbench-ui/chunk-B2LIVH37.js +1 -0
- package/dist/workbench-ui/chunk-B7YX5TR5.js +1 -0
- package/dist/workbench-ui/chunk-BCB4X4XX.js +1 -0
- package/dist/workbench-ui/chunk-BCRQUL2A.js +88 -0
- package/dist/workbench-ui/chunk-BI6UHHQP.js +1 -0
- package/dist/workbench-ui/chunk-BLSLQ4AQ.js +120 -0
- package/dist/workbench-ui/chunk-C3QSRS6E.js +1 -0
- package/dist/workbench-ui/chunk-CK7M2PJ3.js +62 -0
- package/dist/workbench-ui/chunk-CM6LZ7TU.js +1 -0
- package/dist/workbench-ui/chunk-CP63H27F.js +36 -0
- package/dist/workbench-ui/chunk-CPUMMIS2.js +70 -0
- package/dist/workbench-ui/chunk-CSEIBI5U.js +2 -0
- package/dist/workbench-ui/chunk-CUS65DKZ.js +161 -0
- package/dist/workbench-ui/chunk-CVQY7TNC.js +1 -0
- package/dist/workbench-ui/chunk-D6S3XBIX.js +106 -0
- package/dist/workbench-ui/chunk-E253Y562.js +1 -0
- package/dist/workbench-ui/chunk-EADDJUDC.js +1 -0
- package/dist/workbench-ui/chunk-EBGJ3YXG.js +206 -0
- package/dist/workbench-ui/chunk-EKPVZ3WY.js +8 -0
- package/dist/workbench-ui/chunk-EQDCEAFY.js +1 -0
- package/dist/workbench-ui/chunk-ES3SSDJY.js +40 -0
- package/dist/workbench-ui/chunk-ESFD2H7N.js +231 -0
- package/dist/workbench-ui/chunk-FVOHPMS6.js +1 -0
- package/dist/workbench-ui/chunk-FXMQAGVT.js +1 -0
- package/dist/workbench-ui/chunk-GGTADRXD.js +24 -0
- package/dist/workbench-ui/chunk-GHIVPGNQ.js +1 -0
- package/dist/workbench-ui/chunk-GLU2YQV2.js +1 -0
- package/dist/workbench-ui/chunk-GOCKBYSM.js +1 -0
- package/dist/workbench-ui/chunk-H2KMMTJB.js +1 -0
- package/dist/workbench-ui/chunk-HGVLDNPP.js +39 -0
- package/dist/workbench-ui/chunk-HSAVC5GY.js +1 -0
- package/dist/workbench-ui/chunk-HSEAD2JH.js +1 -0
- package/dist/workbench-ui/chunk-HSIHOBTY.js +1 -0
- package/dist/workbench-ui/chunk-IZXOKUGG.js +67 -0
- package/dist/workbench-ui/chunk-JFT2LC2T.js +1 -0
- package/dist/workbench-ui/chunk-JHL3ZDYK.js +3 -0
- package/dist/workbench-ui/chunk-JMORLCZG.js +257 -0
- package/dist/workbench-ui/chunk-JR4SIX7A.js +1 -0
- package/dist/workbench-ui/chunk-K23HAGEH.js +30 -0
- package/dist/workbench-ui/chunk-K43JDCBH.js +1 -0
- package/dist/workbench-ui/chunk-KINKFJY7.js +1 -0
- package/dist/workbench-ui/chunk-KKQSA4LI.js +2 -0
- package/dist/workbench-ui/chunk-KOUZX3UX.js +1 -0
- package/dist/workbench-ui/chunk-KR4DRHW2.js +78 -0
- package/dist/workbench-ui/chunk-KT4DJNOR.js +1 -0
- package/dist/workbench-ui/chunk-KTPNKRRZ.js +292 -0
- package/dist/workbench-ui/chunk-LFHIPGSU.js +7 -0
- package/dist/workbench-ui/chunk-LWDL4HZB.js +125 -0
- package/dist/workbench-ui/chunk-MVYC3CY4.js +1 -0
- package/dist/workbench-ui/chunk-NWUPALCY.js +129 -0
- package/dist/workbench-ui/chunk-NY7C662Z.js +1 -0
- package/dist/workbench-ui/chunk-O76WTHWP.js +1 -0
- package/dist/workbench-ui/chunk-OTF7YHRE.js +162 -0
- package/dist/workbench-ui/chunk-P6TKKRKP.js +1 -0
- package/dist/workbench-ui/chunk-PFHOOWV3.js +1 -0
- package/dist/workbench-ui/chunk-PUQLANIM.js +1 -0
- package/dist/workbench-ui/chunk-PZCGBYVO.js +1 -0
- package/dist/workbench-ui/chunk-QOHUZGP4.js +1 -0
- package/dist/workbench-ui/chunk-QSEG3OFF.js +1 -0
- package/dist/workbench-ui/chunk-QYPOXZIA.js +84 -0
- package/dist/workbench-ui/chunk-R6SOF3JC.js +1 -0
- package/dist/workbench-ui/chunk-RCLOYU5F.js +1 -0
- package/dist/workbench-ui/chunk-RSRUP64S.js +1 -0
- package/dist/workbench-ui/chunk-RVAIT6JW.js +1 -0
- package/dist/workbench-ui/chunk-S2CCN3II.js +1 -0
- package/dist/workbench-ui/chunk-S2Q52W46.js +1 -0
- package/dist/workbench-ui/chunk-S2W5THJ5.js +1 -0
- package/dist/workbench-ui/chunk-S6ZQZNOX.js +1 -0
- package/dist/workbench-ui/chunk-S74PLMMS.js +1 -0
- package/dist/workbench-ui/chunk-S7C4HKEY.js +1 -0
- package/dist/workbench-ui/chunk-SDTB3Q65.js +1 -0
- package/dist/workbench-ui/chunk-SLPRGYUV.js +32 -0
- package/dist/workbench-ui/chunk-SQE76S5B.js +1 -0
- package/dist/workbench-ui/chunk-SSDZPVPW.js +1 -0
- package/dist/workbench-ui/chunk-SVI7DGIE.js +1 -0
- package/dist/workbench-ui/chunk-T6QKLZ4H.js +62 -0
- package/dist/workbench-ui/chunk-TJNRPTFL.js +1 -0
- package/dist/workbench-ui/chunk-TP6U4EDH.js +2 -0
- package/dist/workbench-ui/chunk-TYAAT3GQ.js +1 -0
- package/dist/workbench-ui/chunk-U6OCY4ZH.js +1 -0
- package/dist/workbench-ui/chunk-UAN3NLRF.js +1 -0
- package/dist/workbench-ui/chunk-UMLU3FIX.js +1 -0
- package/dist/workbench-ui/chunk-URIY2OTM.js +1 -0
- package/dist/workbench-ui/chunk-V2NUKAA7.js +38 -0
- package/dist/workbench-ui/chunk-V4QLL4TE.js +139 -0
- package/dist/workbench-ui/chunk-VASHXUK4.js +2 -0
- package/dist/workbench-ui/chunk-VJLIWNIU.js +1 -0
- package/dist/workbench-ui/chunk-VQNQFBID.js +1 -0
- package/dist/workbench-ui/chunk-VSIWU7XA.js +3 -0
- package/dist/workbench-ui/chunk-VSJASPUZ.js +321 -0
- package/dist/workbench-ui/chunk-VXPNUNUX.js +3 -0
- package/dist/workbench-ui/chunk-WBKLDCV6.js +1 -0
- package/dist/workbench-ui/chunk-WOKJM3FY.js +1 -0
- package/dist/workbench-ui/chunk-X3U3NA3X.js +34 -0
- package/dist/workbench-ui/chunk-XBYU7M4J.js +1 -0
- package/dist/workbench-ui/chunk-XBZAO4ID.js +10 -0
- package/dist/workbench-ui/chunk-XLLPZ2WO.js +1 -0
- package/dist/workbench-ui/chunk-YFVL4NJL.js +1 -0
- package/dist/workbench-ui/chunk-YRFQENM4.js +1 -0
- package/dist/workbench-ui/chunk-YUADQVB2.js +1 -0
- package/dist/workbench-ui/chunk-Z3TCAKM5.js +1 -0
- package/dist/workbench-ui/chunk-Z6QR6FRE.js +10 -0
- package/dist/workbench-ui/chunk-ZJPSORPP.js +3 -0
- package/dist/workbench-ui/chunk-ZLGCSTR2.js +15 -0
- package/dist/workbench-ui/chunk-ZLR4SG5X.js +1 -0
- package/dist/workbench-ui/chunk-ZND3TTGF.js +1 -0
- package/dist/workbench-ui/chunk-ZOP3ZYH7.js +2 -0
- package/dist/workbench-ui/index.html +14 -0
- package/package.json +23 -8
- package/skills/acp-service/SKILL.md +24 -8
- package/skills/acp-service/references/a2a.md +24 -8
- package/skills/acp-service/references/async-caller.md +48 -0
- package/skills/acp-service/references/dsh.md +2 -0
- package/skills/acp-service/references/roles-and-tasks.md +120 -0
- package/skills/acp-service/scripts/a2a-caller.py +242 -0
- package/skills/rsi-coach/SKILL.md +134 -0
- package/vendor/dsh/README.md +11 -5
- package/vendor/dsh/a2a-executor.d.ts +60 -3
- package/vendor/dsh/a2a-executor.js +208 -18
- package/vendor/dsh/a2a.d.ts +12 -2
- package/vendor/dsh/a2a.js +9 -2
- package/vendor/dsh/adapter.d.ts +61 -2
- package/vendor/dsh/adapter.js +354 -23
- package/vendor/dsh/client.js +67 -11
- package/vendor/dsh/index.js +57 -4
- package/vendor/dsh/native-approvals.d.ts +4 -0
- package/vendor/dsh/native-approvals.js +44 -0
- package/vendor/dsh/preset-route.d.ts +49 -0
- package/vendor/dsh/preset-route.js +51 -0
- package/vendor/dsh/preset.js +10 -3
- package/vendor/dsh/process-admission.d.ts +25 -0
- package/vendor/dsh/process-admission.js +87 -0
- package/vendor/dsh/process-requests.d.ts +57 -0
- package/vendor/dsh/process-requests.js +49 -0
- package/vendor/dsh/review-mcp.d.ts +1 -0
- package/vendor/dsh/review-mcp.js +56 -0
- package/vendor/dsh/review.d.ts +30 -0
- package/vendor/dsh/review.js +149 -0
- package/vendor/dsh/session-settings.d.ts +34 -0
- package/vendor/dsh/session-settings.js +114 -0
- package/vendor/dsh/ticket-spec.d.ts +30 -0
- package/vendor/dsh/ticket-spec.js +10 -0
- package/vendor/dsh/ticket-tools.d.ts +21 -0
- package/vendor/dsh/ticket-tools.js +43 -0
- package/vendor/dsh/workbench.d.ts +18 -0
- package/vendor/dsh/workbench.js +91 -0
- package/vendor/runtime/README.md +6 -4
- package/vendor/runtime/dist/{cli-DeOpE2Xz.js → cli-DXmYwv3U.js} +4 -4
- package/vendor/runtime/dist/{cli-DeOpE2Xz.js.map → cli-DXmYwv3U.js.map} +1 -1
- package/vendor/runtime/dist/cli.js +7 -7
- package/vendor/runtime/dist/client-VQsqcIOJ.d.ts.map +1 -1
- package/vendor/runtime/dist/docs-site/CLI.html +2 -2
- package/vendor/runtime/dist/docs-site/VISION.html +2 -2
- package/vendor/runtime/dist/docs-site/agents.html +2 -2
- package/vendor/runtime/dist/docs-site/compare.html +2 -2
- package/vendor/runtime/dist/docs-site/config.html +2 -2
- package/vendor/runtime/dist/docs-site/custom-agents.html +2 -2
- package/vendor/runtime/dist/docs-site/exit-codes.html +2 -2
- package/vendor/runtime/dist/docs-site/flows.html +2 -2
- package/vendor/runtime/dist/docs-site/index.html +1 -1
- package/vendor/runtime/dist/docs-site/install.html +2 -2
- package/vendor/runtime/dist/docs-site/llms.txt +1 -1
- package/vendor/runtime/dist/docs-site/output-formats.html +2 -2
- package/vendor/runtime/dist/docs-site/permissions.html +2 -2
- package/vendor/runtime/dist/docs-site/prompting.html +2 -2
- package/vendor/runtime/dist/docs-site/quickstart.html +2 -2
- package/vendor/runtime/dist/docs-site/releasing.html +2 -2
- package/vendor/runtime/dist/docs-site/runtime-environment.html +2 -2
- package/vendor/runtime/dist/docs-site/runtime-process-lifecycle.html +3 -2
- package/vendor/runtime/dist/docs-site/safe-errors.html +2 -2
- package/vendor/runtime/dist/docs-site/session-control.html +2 -2
- package/vendor/runtime/dist/docs-site/session-watch.html +2 -2
- package/vendor/runtime/dist/docs-site/sessions.html +2 -2
- package/vendor/runtime/dist/docs-site/shared-sessions.html +2 -2
- package/vendor/runtime/dist/{flows-oaBGn31w.js → flows-DJ17ajbw.js} +3 -3
- package/vendor/runtime/dist/{flows-oaBGn31w.js.map → flows-DJ17ajbw.js.map} +1 -1
- package/vendor/runtime/dist/flows.js +1 -1
- package/vendor/runtime/dist/{invocation-options-CUDEE8vW.js → invocation-options-PBfCgrdi.js} +3 -3
- package/vendor/runtime/dist/{invocation-options-CUDEE8vW.js.map → invocation-options-PBfCgrdi.js.map} +1 -1
- package/vendor/runtime/dist/{output-CFv3jcOQ.js → output-B3MDn7kv.js} +2 -2
- package/vendor/runtime/dist/{output-CFv3jcOQ.js.map → output-B3MDn7kv.js.map} +1 -1
- package/vendor/runtime/dist/{queue-owner-runtime-DvMJiGbP.js → queue-owner-runtime-DXCVngwU.js} +15 -8
- package/vendor/runtime/dist/queue-owner-runtime-DXCVngwU.js.map +1 -0
- package/vendor/runtime/dist/runtime.js +1 -1
- package/vendor/runtime/dist/{session-watch-Di-wIdCH.js → session-watch-DURyCw31.js} +2 -2
- package/vendor/runtime/dist/{session-watch-Di-wIdCH.js.map → session-watch-DURyCw31.js.map} +1 -1
- package/vendor/runtime/package.json +6 -4
- package/vendor/runtime/skills/acpx/SKILL.md +2 -0
- package/vendor/runtime/dist/queue-owner-runtime-DvMJiGbP.js.map +0 -1
|
@@ -1,8 +1,54 @@
|
|
|
1
1
|
/** DSH session execution behind the shared A2A service's transport-independent backend. */
|
|
2
2
|
import { realpath, stat } from 'node:fs/promises';
|
|
3
3
|
import { isAbsolute } from 'node:path';
|
|
4
|
-
import { A2APreflightError, runA2APreflight } from '@1agents/acp-service/a2a';
|
|
4
|
+
import { A2APreflightError, bindA2AExecution, runA2APreflight, unbindA2AExecution } from '@1agents/acp-service/a2a';
|
|
5
5
|
import { toSafeError } from '@1agents/acp-service/runtime';
|
|
6
|
+
import { modelSelectionOf } from './preset-route.js';
|
|
7
|
+
import { consumeProcessReady, readProcessCapacity, readSessionRestore } from './process-admission.js';
|
|
8
|
+
function sessionError(code, message) {
|
|
9
|
+
const error = new Error(message);
|
|
10
|
+
error.code = code;
|
|
11
|
+
return error;
|
|
12
|
+
}
|
|
13
|
+
/** Host inspect either returns null or throws its own not-found error. Other failures stay unchanged. */
|
|
14
|
+
function isMissingSession(error, sessionId) {
|
|
15
|
+
if (!error || typeof error !== 'object')
|
|
16
|
+
return false;
|
|
17
|
+
const value = error;
|
|
18
|
+
return value.name === 'ApiSessionNotFound'
|
|
19
|
+
|| value.message === `Session ${sessionId} not found`
|
|
20
|
+
|| value.message === `session "${sessionId}" not found`;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Read a Session's identity without resuming it; null when it does not exist.
|
|
24
|
+
* Current DSH dropped sessionController.inspect, so this observes the stored header through sessionQuery instead.
|
|
25
|
+
*/
|
|
26
|
+
export async function inspectSession(ctx, sessionId) {
|
|
27
|
+
if (typeof ctx.sessionController.inspect === 'function')
|
|
28
|
+
return ctx.sessionController.inspect(sessionId);
|
|
29
|
+
const live = ctx.sessions?.get?.(sessionId);
|
|
30
|
+
if (live?.header)
|
|
31
|
+
return { meta: { id: live.header.id, cwd: live.header.cwd, agentPreset: live.header.agentPreset } };
|
|
32
|
+
const query = ctx.get('sessionQuery');
|
|
33
|
+
if (!query)
|
|
34
|
+
throw new Error('This DSH host offers neither sessionController.inspect nor sessionQuery');
|
|
35
|
+
let observation;
|
|
36
|
+
try {
|
|
37
|
+
observation = await query.observeSession(sessionId, { projectionMode: 'none' });
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
if (isMissingSession(error, sessionId))
|
|
41
|
+
return null;
|
|
42
|
+
throw error;
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
const { id, cwd, agentPreset } = observation.header;
|
|
46
|
+
return { meta: { id, ...(cwd === undefined ? {} : { cwd }), ...(agentPreset === undefined ? {} : { agentPreset }) } };
|
|
47
|
+
}
|
|
48
|
+
finally {
|
|
49
|
+
observation[Symbol.dispose]();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
6
52
|
function resultOf(reason, text, finalAnswerExpected, operationId, diagnostic) {
|
|
7
53
|
switch (reason.kind) {
|
|
8
54
|
case 'completed': return finalAnswerExpected && !text.trim()
|
|
@@ -36,15 +82,58 @@ function answerOf(content, turn) {
|
|
|
36
82
|
authoritative: false, phased,
|
|
37
83
|
};
|
|
38
84
|
}
|
|
85
|
+
async function waitForIdle(agent, signal) {
|
|
86
|
+
signal.throwIfAborted();
|
|
87
|
+
let abort;
|
|
88
|
+
const canceled = new Promise((_, reject) => {
|
|
89
|
+
abort = () => reject(signal.reason);
|
|
90
|
+
signal.addEventListener('abort', abort, { once: true });
|
|
91
|
+
});
|
|
92
|
+
try {
|
|
93
|
+
await Promise.race([agent.whenIdle(), canceled]);
|
|
94
|
+
}
|
|
95
|
+
finally {
|
|
96
|
+
signal.removeEventListener('abort', abort);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
39
99
|
/** Uses public session-controller and inbox events to account for one A2A prompt's exact DSH turn. */
|
|
40
100
|
export class DshA2ABackend {
|
|
41
101
|
ctx;
|
|
42
102
|
diagnostics;
|
|
103
|
+
sessions;
|
|
43
104
|
executions = new Map();
|
|
44
105
|
/** @param ctx DSH plugin context that owns session-controller and execution event registrations. */
|
|
45
|
-
constructor(ctx, diagnostics) {
|
|
106
|
+
constructor(ctx, diagnostics, sessions) {
|
|
46
107
|
this.ctx = ctx;
|
|
47
108
|
this.diagnostics = diagnostics;
|
|
109
|
+
this.sessions = sessions;
|
|
110
|
+
}
|
|
111
|
+
async close(target) {
|
|
112
|
+
if (!target.agentPreset?.startsWith('oneagents-acp-'))
|
|
113
|
+
return { processReleased: true, acp: false };
|
|
114
|
+
if (!this.sessions) {
|
|
115
|
+
const error = new Error('Host close is not supported');
|
|
116
|
+
error.code = 'UNSUPPORTED';
|
|
117
|
+
throw error;
|
|
118
|
+
}
|
|
119
|
+
return this.sessions.release(target.sessionId);
|
|
120
|
+
}
|
|
121
|
+
/** Non-ACP presets only drop the A2A binding; DSH session history is never deleted. */
|
|
122
|
+
async delete(target) {
|
|
123
|
+
if (!target.agentPreset?.startsWith('oneagents-acp-'))
|
|
124
|
+
return { processReleased: true, acp: false };
|
|
125
|
+
if (!this.sessions?.delete) {
|
|
126
|
+
const error = new Error('Host delete is not supported');
|
|
127
|
+
error.code = 'UNSUPPORTED';
|
|
128
|
+
throw error;
|
|
129
|
+
}
|
|
130
|
+
return this.sessions.delete(target.sessionId);
|
|
131
|
+
}
|
|
132
|
+
async status(target) {
|
|
133
|
+
if (target.agentPreset?.startsWith('oneagents-acp-') && this.sessions)
|
|
134
|
+
return this.sessions.status(target.sessionId);
|
|
135
|
+
const found = await inspectSession(this.ctx, target.sessionId).catch(() => null);
|
|
136
|
+
return { attached: found != null, activeTurn: false };
|
|
48
137
|
}
|
|
49
138
|
/** Restart reconciliation reads the plugin domain and never dispatches another prompt. */
|
|
50
139
|
async recover(target, options) {
|
|
@@ -57,52 +146,113 @@ export class DshA2ABackend {
|
|
|
57
146
|
* @param input Remote host directory, preset, and optional existing DSH session identity.
|
|
58
147
|
* @returns The resolved DSH session and its durable workspace and preset.
|
|
59
148
|
*/
|
|
60
|
-
async prepare(input) {
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (input.sessionId !== undefined
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
149
|
+
async prepare(input, options) {
|
|
150
|
+
const signal = options?.signal;
|
|
151
|
+
signal?.throwIfAborted();
|
|
152
|
+
let previous;
|
|
153
|
+
if (input.sessionId !== undefined) {
|
|
154
|
+
try {
|
|
155
|
+
previous = await inspectSession(this.ctx, input.sessionId);
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
if (isMissingSession(error, input.sessionId))
|
|
159
|
+
throw sessionError('SESSION_NOT_FOUND', `Session ${input.sessionId} not found`);
|
|
160
|
+
throw error;
|
|
161
|
+
}
|
|
162
|
+
signal?.throwIfAborted();
|
|
163
|
+
if (previous == null)
|
|
164
|
+
throw sessionError('SESSION_NOT_FOUND', `Session ${input.sessionId} not found`);
|
|
165
|
+
}
|
|
166
|
+
if (previous != null && previous.meta.id !== input.sessionId)
|
|
167
|
+
throw sessionError('SESSION_CONFLICT', 'Existing session identity conflicts');
|
|
68
168
|
const requestedCwd = input.cwd ?? previous?.meta.cwd ?? process.cwd();
|
|
69
169
|
if (!isAbsolute(requestedCwd))
|
|
70
170
|
throw new Error('A2A cwd must be an absolute directory on the DSH host');
|
|
71
171
|
const cwd = await realpath(requestedCwd);
|
|
172
|
+
signal?.throwIfAborted();
|
|
72
173
|
if (!(await stat(cwd)).isDirectory())
|
|
73
174
|
throw new Error('A2A cwd must point to a directory on the DSH host');
|
|
175
|
+
signal?.throwIfAborted();
|
|
74
176
|
const preflight = await this.preflight({ ...input.preflight, cwd });
|
|
177
|
+
signal?.throwIfAborted();
|
|
75
178
|
if (!preflight.ok)
|
|
76
179
|
throw new A2APreflightError(preflight);
|
|
77
180
|
const agentPreset = input.agentPreset ?? previous?.meta.agentPreset;
|
|
78
|
-
if (input.sessionId !== undefined && previous
|
|
181
|
+
if (input.sessionId !== undefined && previous != null) {
|
|
79
182
|
if (previous.meta.cwd === undefined || await realpath(previous.meta.cwd) !== cwd)
|
|
80
|
-
throw
|
|
183
|
+
throw sessionError('SESSION_CONFLICT', 'Existing session cwd conflicts');
|
|
81
184
|
if (input.agentPreset !== undefined && input.agentPreset !== previous.meta.agentPreset)
|
|
82
|
-
throw
|
|
185
|
+
throw sessionError('SESSION_CONFLICT', 'Existing session preset conflicts');
|
|
83
186
|
// create() only reuses blank Sessions on current DSH; resolve the saved
|
|
84
187
|
// identity directly so an active or completed context keeps its queue.
|
|
85
188
|
const agent = await this.agent(input.sessionId);
|
|
189
|
+
signal?.throwIfAborted();
|
|
86
190
|
if (agent.id !== input.sessionId || agent.session.id !== input.sessionId)
|
|
87
|
-
throw
|
|
191
|
+
throw sessionError('SESSION_CONFLICT', 'Existing session identity conflicts');
|
|
88
192
|
if (agent.session.header.cwd === undefined || await realpath(agent.session.header.cwd) !== cwd)
|
|
89
|
-
throw
|
|
193
|
+
throw sessionError('SESSION_CONFLICT', 'Existing session cwd conflicts');
|
|
194
|
+
signal?.throwIfAborted();
|
|
90
195
|
if (agent.session.header.agentPreset !== previous.meta.agentPreset)
|
|
91
|
-
throw
|
|
92
|
-
|
|
196
|
+
throw sessionError('SESSION_CONFLICT', 'Existing session preset conflicts');
|
|
197
|
+
if (input.provider !== undefined)
|
|
198
|
+
await this.requireModel(input, agentPreset, signal);
|
|
199
|
+
const selected = await this.selectModel(input, input.sessionId, signal);
|
|
200
|
+
return { sessionId: input.sessionId, cwd, ...(agentPreset === undefined ? {} : { agentPreset }), preflight, ...selected };
|
|
93
201
|
}
|
|
202
|
+
// Reject an unknown model before a blank session is created for it.
|
|
203
|
+
if (input.provider !== undefined)
|
|
204
|
+
await this.requireModel(input, agentPreset, signal);
|
|
94
205
|
const created = await this.ctx.sessionController.create({
|
|
95
206
|
cwd,
|
|
96
207
|
...(agentPreset === undefined ? {} : { agentPreset }),
|
|
97
208
|
});
|
|
209
|
+
// Native create owns a durable blank session, not an ACP launch or prompt.
|
|
210
|
+
// If its non-abortable host operation finishes late, do not restore or run it.
|
|
211
|
+
signal?.throwIfAborted();
|
|
98
212
|
const agent = await this.agent(created.sessionId);
|
|
213
|
+
signal?.throwIfAborted();
|
|
214
|
+
const selected = await this.selectModel(input, created.sessionId, signal);
|
|
99
215
|
return {
|
|
100
216
|
sessionId: created.sessionId,
|
|
101
217
|
cwd: agent.session.header.cwd ?? cwd,
|
|
102
218
|
...(created.agentPreset === undefined ? {} : { agentPreset: created.agentPreset }),
|
|
103
219
|
preflight,
|
|
220
|
+
...selected,
|
|
104
221
|
};
|
|
105
222
|
}
|
|
223
|
+
/** Standard presets only. The catalog must list the exact model; a miss never falls back to the host default. */
|
|
224
|
+
async requireModel(input, agentPreset, signal) {
|
|
225
|
+
if (agentPreset?.startsWith('oneagents-acp-'))
|
|
226
|
+
throw sessionError('MODEL_SELECTION_UNSUPPORTED', 'provider and model apply only to standard presets');
|
|
227
|
+
const catalog = await this.ctx.sessionController.modelCatalog();
|
|
228
|
+
signal?.throwIfAborted();
|
|
229
|
+
if (!catalog.groups.some(group => group.id === input.provider && group.models.some(model => model.id === input.model))) {
|
|
230
|
+
throw sessionError('MODEL_UNAVAILABLE', `Model ${input.provider}/${input.model} is not in the DSH model catalog`);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
/** Install the requested model before the first prompt and return what DSH resolved. Omitted fields leave the session unchanged. */
|
|
234
|
+
async selectModel(input, sessionId, signal) {
|
|
235
|
+
if (input.provider === undefined || input.model === undefined)
|
|
236
|
+
return {};
|
|
237
|
+
let selected = { provider: input.provider, model: input.model };
|
|
238
|
+
try {
|
|
239
|
+
const agent = await this.agent(sessionId);
|
|
240
|
+
// sessionController.selectModel also saves the choice as the host's default model.
|
|
241
|
+
// A task only chooses for its own session, so current DSH selects on the agent directly.
|
|
242
|
+
const model = modelSelectionOf(agent);
|
|
243
|
+
if (model) {
|
|
244
|
+
await this.ctx.llm.resolveCallConfig?.(selected);
|
|
245
|
+
model.select(selected);
|
|
246
|
+
}
|
|
247
|
+
else
|
|
248
|
+
({ selected } = await this.ctx.sessionController.selectModel({ sessionId, ...selected }));
|
|
249
|
+
}
|
|
250
|
+
catch (error) {
|
|
251
|
+
throw Object.assign(sessionError('MODEL_UNAVAILABLE', `DSH did not select ${input.provider}/${input.model}`), { cause: error });
|
|
252
|
+
}
|
|
253
|
+
signal?.throwIfAborted();
|
|
254
|
+
return { provider: selected.provider, model: selected.model };
|
|
255
|
+
}
|
|
106
256
|
/** Admit one identified queued prompt and wait only for its own turn, independent of the HTTP connection.
|
|
107
257
|
* @param target Previously prepared DSH session.
|
|
108
258
|
* @param prompt Plain-text A2A message content.
|
|
@@ -134,6 +284,8 @@ export class DshA2ABackend {
|
|
|
134
284
|
const agent = await this.agent(target.sessionId);
|
|
135
285
|
options.signal.throwIfAborted();
|
|
136
286
|
const completion = Promise.withResolvers();
|
|
287
|
+
const startupAbort = new AbortController();
|
|
288
|
+
const startupSignal = AbortSignal.any([options.signal, startupAbort.signal]);
|
|
137
289
|
const listeners = [];
|
|
138
290
|
let messageId;
|
|
139
291
|
let turn;
|
|
@@ -151,6 +303,9 @@ export class DshA2ABackend {
|
|
|
151
303
|
completion.resolve(result);
|
|
152
304
|
};
|
|
153
305
|
const finishTurn = (reason) => {
|
|
306
|
+
const restoreMethod = readSessionRestore(agent.id);
|
|
307
|
+
if (restoreMethod)
|
|
308
|
+
Object.assign(target, { resumed: true, restoreMethod });
|
|
154
309
|
const start = agent.session.snapshotEvents().findLast(event => event.type === 'turn/start' && event.data.turn === turn);
|
|
155
310
|
let diagnostic;
|
|
156
311
|
try {
|
|
@@ -209,9 +364,11 @@ export class DshA2ABackend {
|
|
|
209
364
|
}
|
|
210
365
|
}));
|
|
211
366
|
listeners.push(agent.ctx.on('agent/disposed', event => {
|
|
212
|
-
if (event.agent === agent)
|
|
367
|
+
if (event.agent === agent) {
|
|
213
368
|
settle({ outcome: 'failed', text, failureReason: 'disposed', detail: 'DSH session was disposed before the task finished',
|
|
214
369
|
error: toSafeError(undefined, { origin: 'dsh', operationId: options.requestId, outcomeUnknown: turn !== undefined }) });
|
|
370
|
+
startupAbort.abort(new Error('DSH session was disposed before startup'));
|
|
371
|
+
}
|
|
215
372
|
}));
|
|
216
373
|
listeners.push(agent.ctx.on('session/event', (session, event) => {
|
|
217
374
|
if (session !== agent.session || turn === undefined)
|
|
@@ -235,9 +392,38 @@ export class DshA2ABackend {
|
|
|
235
392
|
}
|
|
236
393
|
}));
|
|
237
394
|
options.signal.addEventListener('abort', cancel, { once: true });
|
|
395
|
+
let capacityTimer;
|
|
396
|
+
if (options.onCapacity && target.agentPreset?.startsWith('oneagents-acp-')) {
|
|
397
|
+
const tick = () => {
|
|
398
|
+
const pending = readProcessCapacity(target.sessionId);
|
|
399
|
+
if (pending)
|
|
400
|
+
options.onCapacity?.({ code: 'CAPACITY_PENDING', position: pending.position, waitedMs: pending.waitedMs });
|
|
401
|
+
else if (consumeProcessReady(target.sessionId))
|
|
402
|
+
options.onCapacity?.(undefined);
|
|
403
|
+
capacityTimer = setTimeout(tick, 50);
|
|
404
|
+
capacityTimer.unref?.();
|
|
405
|
+
};
|
|
406
|
+
tick();
|
|
407
|
+
}
|
|
238
408
|
try {
|
|
409
|
+
if (options.execution)
|
|
410
|
+
bindA2AExecution(target.sessionId, options.execution);
|
|
239
411
|
// Recheck after event registration; cancellation can arrive during Agent restoration.
|
|
240
412
|
options.signal.throwIfAborted();
|
|
413
|
+
// Native user turns do not share this backend's execution map.
|
|
414
|
+
try {
|
|
415
|
+
if (options.beforeStart)
|
|
416
|
+
await waitForIdle(agent, startupSignal);
|
|
417
|
+
await options.beforeStart?.(startupSignal);
|
|
418
|
+
}
|
|
419
|
+
catch (error) {
|
|
420
|
+
if (settled)
|
|
421
|
+
return await completion.promise;
|
|
422
|
+
throw error;
|
|
423
|
+
}
|
|
424
|
+
if (settled)
|
|
425
|
+
return await completion.promise;
|
|
426
|
+
options.signal.throwIfAborted();
|
|
241
427
|
await this.ctx.sessionController.prompt({
|
|
242
428
|
requestId: options.requestId,
|
|
243
429
|
sessionId: agent.id,
|
|
@@ -249,6 +435,10 @@ export class DshA2ABackend {
|
|
|
249
435
|
return await completion.promise;
|
|
250
436
|
}
|
|
251
437
|
finally {
|
|
438
|
+
if (capacityTimer)
|
|
439
|
+
clearTimeout(capacityTimer);
|
|
440
|
+
if (options.execution)
|
|
441
|
+
unbindA2AExecution(target.sessionId, options.execution);
|
|
252
442
|
options.signal.removeEventListener('abort', cancel);
|
|
253
443
|
for (const dispose of listeners.reverse())
|
|
254
444
|
dispose();
|
package/vendor/dsh/a2a.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/** Mount the shared A2A implementation on the current DSH web host. */
|
|
2
|
-
import { type A2AServerOptions } from '@1agents/acp-service/a2a';
|
|
2
|
+
import { createA2AServer, type A2AServerOptions } from '@1agents/acp-service/a2a';
|
|
3
3
|
import type { Context } from '@deepseek-ai/cordis';
|
|
4
4
|
import type { Diagnostics } from './diagnostics.js';
|
|
5
|
+
import { type SessionControl } from './a2a-executor.js';
|
|
5
6
|
/** Optional host configuration; omitted configuration leaves A2A disabled. */
|
|
6
7
|
export interface DshA2AOptions extends Omit<A2AServerOptions, 'backend' | 'token' | 'stateDirectory' | 'publicUrl'> {
|
|
7
8
|
enabled?: boolean;
|
|
@@ -11,6 +12,15 @@ export interface DshA2AOptions extends Omit<A2AServerOptions, 'backend' | 'token
|
|
|
11
12
|
stateDirectory?: string;
|
|
12
13
|
/** Public DSH origin, for example its Tailscale URL. */
|
|
13
14
|
publicUrl?: string;
|
|
15
|
+
/** Gateway workbench that records questions and plan approvals for this host's A2A turns.
|
|
16
|
+
* `pageRelaySecret` matches the gateway's workbench.pageRelaySecret so this host's page can publish and decide reviews. */
|
|
17
|
+
workbench?: {
|
|
18
|
+
url: string;
|
|
19
|
+
token?: string;
|
|
20
|
+
pageRelaySecret?: string;
|
|
21
|
+
};
|
|
14
22
|
}
|
|
23
|
+
/** In-process takeover controls of the mounted host; absent while A2A is disabled or closed. */
|
|
24
|
+
export type A2AHostControls = Pick<Awaited<ReturnType<typeof createA2AServer>>, 'sessionTask' | 'taskSession' | 'resubmit'>;
|
|
15
25
|
/** Routes and in-flight turns are released with the owning Cordis plugin. */
|
|
16
|
-
export declare function mountDshA2A(ctx: Context, options: DshA2AOptions, stateDirectory: string, diagnostics?: Diagnostics): Promise<() => Promise<void>>;
|
|
26
|
+
export declare function mountDshA2A(ctx: Context, options: DshA2AOptions, stateDirectory: string, diagnostics?: Diagnostics, sessions?: SessionControl, expose?: (host: A2AHostControls | undefined) => void): Promise<() => Promise<void>>;
|
package/vendor/dsh/a2a.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { createA2AServer } from '@1agents/acp-service/a2a';
|
|
3
3
|
import { DshA2ABackend } from './a2a-executor.js';
|
|
4
4
|
/** Routes and in-flight turns are released with the owning Cordis plugin. */
|
|
5
|
-
export async function mountDshA2A(ctx, options, stateDirectory, diagnostics) {
|
|
5
|
+
export async function mountDshA2A(ctx, options, stateDirectory, diagnostics, sessions, expose) {
|
|
6
6
|
if (options.enabled === false)
|
|
7
7
|
return async () => { };
|
|
8
8
|
const token = options.token ?? process.env[options.tokenEnv ?? 'DSH_A2A_TOKEN'];
|
|
@@ -10,7 +10,8 @@ export async function mountDshA2A(ctx, options, stateDirectory, diagnostics) {
|
|
|
10
10
|
throw new Error('Set DSH_A2A_TOKEN or a2a.token before enabling DSH A2A');
|
|
11
11
|
let close = async () => { };
|
|
12
12
|
await ctx.effect(async () => {
|
|
13
|
-
const
|
|
13
|
+
const { workbench: _workbench, ...serverOptions } = options;
|
|
14
|
+
const server = await createA2AServer({ ...serverOptions, token, backend: new DshA2ABackend(ctx, diagnostics, sessions),
|
|
14
15
|
stateDirectory: options.stateDirectory ?? stateDirectory,
|
|
15
16
|
publicUrl: options.publicUrl ?? `http://127.0.0.1:${ctx.webServer.port}` });
|
|
16
17
|
const routes = [];
|
|
@@ -18,6 +19,10 @@ export async function mountDshA2A(ctx, options, stateDirectory, diagnostics) {
|
|
|
18
19
|
routes.push(ctx.webServer.register({ kind: 'exact', path: '/.well-known/agent-card.json', handler: server.cardHandler }));
|
|
19
20
|
routes.push(ctx.webServer.register({ kind: 'exact', path: server.path, handler: server.handler }));
|
|
20
21
|
routes.push(ctx.webServer.register({ kind: 'exact', path: `${server.path}/preflight`, handler: server.handler }));
|
|
22
|
+
routes.push(ctx.webServer.register({ kind: 'exact', path: `${server.path}/sessions/close`, handler: server.handler }));
|
|
23
|
+
routes.push(ctx.webServer.register({ kind: 'exact', path: `${server.path}/sessions/status`, handler: server.handler }));
|
|
24
|
+
routes.push(ctx.webServer.register({ kind: 'exact', path: `${server.path}/sessions/delete`, handler: server.handler }));
|
|
25
|
+
routes.push(ctx.webServer.register({ kind: 'exact', path: `${server.path}/artifacts/content`, handler: server.handler }));
|
|
21
26
|
}
|
|
22
27
|
catch (error) {
|
|
23
28
|
for (const dispose of routes.reverse())
|
|
@@ -26,7 +31,9 @@ export async function mountDshA2A(ctx, options, stateDirectory, diagnostics) {
|
|
|
26
31
|
throw error;
|
|
27
32
|
}
|
|
28
33
|
let closing;
|
|
34
|
+
expose?.({ sessionTask: server.sessionTask, taskSession: server.taskSession, resubmit: server.resubmit });
|
|
29
35
|
close = () => closing ??= (async () => {
|
|
36
|
+
expose?.(undefined);
|
|
30
37
|
for (const dispose of routes.reverse())
|
|
31
38
|
dispose();
|
|
32
39
|
await server.close();
|
package/vendor/dsh/adapter.d.ts
CHANGED
|
@@ -2,15 +2,34 @@ import type { Context } from '@deepseek-ai/cordis';
|
|
|
2
2
|
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
3
3
|
import type { LlmAdapter, GenerateOptions, StreamChunk, LlmModelInfo } from '@deepseek-ai/dsh-llm';
|
|
4
4
|
import type { Diagnostics } from './diagnostics.js';
|
|
5
|
-
import type { SessionConfigOption, SessionModeState, AvailableCommand } from '@agentclientprotocol/sdk';
|
|
5
|
+
import type { McpServer, SessionConfigOption, SessionModeState, AvailableCommand } from '@agentclientprotocol/sdk';
|
|
6
6
|
import { type Binding } from './state.js';
|
|
7
|
+
import type { ProcessRequestClient } from './process-requests.js';
|
|
8
|
+
declare module '@deepseek-ai/dsh-session-projection/types' {
|
|
9
|
+
interface SessionProjectionStateMap {
|
|
10
|
+
sandboxMode: 'read-only' | 'workspace-write' | 'danger-full-access' | null;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export interface SessionPolicy {
|
|
14
|
+
/** Exact workspace and ACP registry name; no global or wildcard policy. */
|
|
15
|
+
cwd: string;
|
|
16
|
+
agent: string;
|
|
17
|
+
/**
|
|
18
|
+
* Accepted so older host configs still load. Not sent and not applied.
|
|
19
|
+
* Tool posture comes from ACP settings: native mode and config options.
|
|
20
|
+
*/
|
|
21
|
+
permissionMode?: 'approve-reads' | 'approve-all' | 'deny-all';
|
|
22
|
+
initialModeId?: string;
|
|
23
|
+
}
|
|
7
24
|
export interface Config {
|
|
8
25
|
serviceUrl: string;
|
|
9
26
|
agents: string[];
|
|
10
27
|
stateDirectory: string;
|
|
11
28
|
reconnectAttempts: number;
|
|
12
29
|
reconnectDelayMs: number;
|
|
30
|
+
sessionPolicies?: SessionPolicy[];
|
|
13
31
|
}
|
|
32
|
+
export declare function validateSessionPolicies(policies?: SessionPolicy[]): SessionPolicy[];
|
|
14
33
|
export interface Capabilities {
|
|
15
34
|
agent: string;
|
|
16
35
|
writable?: boolean;
|
|
@@ -23,7 +42,9 @@ export declare class AcpAdapter implements LlmAdapter {
|
|
|
23
42
|
private ctx;
|
|
24
43
|
private config;
|
|
25
44
|
private readonly diagnostics?;
|
|
45
|
+
private readonly processRequests?;
|
|
26
46
|
private state;
|
|
47
|
+
private initializationFailures;
|
|
27
48
|
private controllers;
|
|
28
49
|
private jobs;
|
|
29
50
|
private links;
|
|
@@ -34,7 +55,10 @@ export declare class AcpAdapter implements LlmAdapter {
|
|
|
34
55
|
private commandDisposers;
|
|
35
56
|
private output;
|
|
36
57
|
private lifetime;
|
|
37
|
-
|
|
58
|
+
private readonly sessionSettings;
|
|
59
|
+
/** MCP servers offered when a session is created or restored, such as the A2A hand-back tool. */
|
|
60
|
+
mcpServersFor?: (sessionId: string) => McpServer[];
|
|
61
|
+
constructor(ctx: Context, config: Config, diagnostics?: Diagnostics | undefined, processRequests?: ProcessRequestClient | undefined);
|
|
38
62
|
providerInfo(provider: string): {
|
|
39
63
|
id: string;
|
|
40
64
|
name: string;
|
|
@@ -48,6 +72,16 @@ export declare class AcpAdapter implements LlmAdapter {
|
|
|
48
72
|
jitterRatio: number;
|
|
49
73
|
};
|
|
50
74
|
imageRequestPricing(): undefined;
|
|
75
|
+
/** DSH 0.2.1 requires this. ACP Agents take text only, so keep the base class's untouched image target. */
|
|
76
|
+
imageRequestTarget(_provider: string, _model: string, image: {
|
|
77
|
+
width: number;
|
|
78
|
+
height: number;
|
|
79
|
+
bytes: number;
|
|
80
|
+
}): {
|
|
81
|
+
width: number;
|
|
82
|
+
height: number;
|
|
83
|
+
maxBytes: number;
|
|
84
|
+
};
|
|
51
85
|
listModels(provider: string): Promise<LlmModelInfo[]>;
|
|
52
86
|
resolveModel(provider: string, model: string): Promise<{
|
|
53
87
|
provider: string;
|
|
@@ -76,11 +110,36 @@ export declare class AcpAdapter implements LlmAdapter {
|
|
|
76
110
|
*/
|
|
77
111
|
importNative(name: string, cwd: string, nativeSessionId: string): Promise<Binding>;
|
|
78
112
|
private publishCommands;
|
|
113
|
+
/** Replay this Agent's own accepted values. Another Agent's catalog is never consulted. */
|
|
114
|
+
private applyPinnedSettings;
|
|
79
115
|
private connection;
|
|
80
116
|
private openConnection;
|
|
117
|
+
/** Ordinary ACP release. The binding, session id, and restore method stay. No session/delete. */
|
|
118
|
+
releaseSession(sessionId: string): Promise<{
|
|
119
|
+
processReleased: true | 'pending';
|
|
120
|
+
acp: boolean;
|
|
121
|
+
}>;
|
|
122
|
+
/**
|
|
123
|
+
* Controlled delete. ACP session/delete closes the process and marks the record deleted.
|
|
124
|
+
* The DSH session and its history stay. A detached session gets a bare link, so no agent process starts.
|
|
125
|
+
*/
|
|
126
|
+
deleteSession(sessionId: string): Promise<{
|
|
127
|
+
processReleased: true | 'pending';
|
|
128
|
+
acp: boolean;
|
|
129
|
+
}>;
|
|
130
|
+
sessionStatus(sessionId: string): Promise<{
|
|
131
|
+
attached: boolean;
|
|
132
|
+
activeTurn: boolean;
|
|
133
|
+
}>;
|
|
81
134
|
stream(options: GenerateOptions): AsyncIterable<StreamChunk>;
|
|
82
135
|
private permission;
|
|
136
|
+
private questionsOf;
|
|
137
|
+
private askQuestions;
|
|
138
|
+
private askPlan;
|
|
83
139
|
private question;
|
|
84
140
|
private plan;
|
|
141
|
+
/** The workbench answer completes this wait. A later A2A user message does not. */
|
|
142
|
+
private withProcessRequest;
|
|
143
|
+
private reportProcess;
|
|
85
144
|
private run;
|
|
86
145
|
}
|