@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
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const processQuestionSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
question: z.ZodPipe<z.ZodString, z.ZodString>;
|
|
5
|
+
header: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodString>>;
|
|
6
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
7
|
+
label: z.ZodPipe<z.ZodString, z.ZodString>;
|
|
8
|
+
description: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodString>>;
|
|
9
|
+
}, z.core.$strict>>>;
|
|
10
|
+
multiSelect: z.ZodOptional<z.ZodBoolean>;
|
|
11
|
+
}, z.core.$strict>;
|
|
12
|
+
export type ProcessQuestion = z.infer<typeof processQuestionSchema>;
|
|
13
|
+
export declare const processRequestAnswerSchema: z.ZodObject<{
|
|
14
|
+
clientRequestId: z.ZodString;
|
|
15
|
+
outcome: z.ZodEnum<{
|
|
16
|
+
cancelled: "cancelled";
|
|
17
|
+
abandoned: "abandoned";
|
|
18
|
+
accepted: "accepted";
|
|
19
|
+
rejected: "rejected";
|
|
20
|
+
approved: "approved";
|
|
21
|
+
}>;
|
|
22
|
+
answers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
|
|
23
|
+
note: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodString>>;
|
|
24
|
+
decidedBy: z.ZodOptional<z.ZodObject<{
|
|
25
|
+
kind: z.ZodEnum<{
|
|
26
|
+
person: "person";
|
|
27
|
+
coach: "coach";
|
|
28
|
+
}>;
|
|
29
|
+
agent: z.ZodOptional<z.ZodString>;
|
|
30
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
31
|
+
}, z.core.$strict>>;
|
|
32
|
+
stopTask: z.ZodOptional<z.ZodLiteral<true>>;
|
|
33
|
+
}, z.core.$strict>;
|
|
34
|
+
export type ProcessRequestAnswerInput = z.infer<typeof processRequestAnswerSchema>;
|
|
35
|
+
type ProcessKind = 'question' | 'plan' | 'permission';
|
|
36
|
+
export declare const processRequestCreateSchema: z.ZodObject<{
|
|
37
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
38
|
+
jobId: z.ZodString;
|
|
39
|
+
attemptId: z.ZodString;
|
|
40
|
+
sessionId: z.ZodString;
|
|
41
|
+
kind: z.ZodEnum<{
|
|
42
|
+
plan: "plan";
|
|
43
|
+
permission: "permission";
|
|
44
|
+
question: "question";
|
|
45
|
+
}>;
|
|
46
|
+
questions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
47
|
+
id: z.ZodString;
|
|
48
|
+
question: z.ZodPipe<z.ZodString, z.ZodString>;
|
|
49
|
+
header: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodString>>;
|
|
50
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
51
|
+
label: z.ZodPipe<z.ZodString, z.ZodString>;
|
|
52
|
+
description: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodString>>;
|
|
53
|
+
}, z.core.$strict>>>;
|
|
54
|
+
multiSelect: z.ZodOptional<z.ZodBoolean>;
|
|
55
|
+
}, z.core.$strict>>>;
|
|
56
|
+
planContent: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodString>>;
|
|
57
|
+
toolTitle: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodString>>;
|
|
58
|
+
toolDetail: z.ZodOptional<z.ZodString>;
|
|
59
|
+
}, z.core.$strict>;
|
|
60
|
+
export type ProcessRequestCreateInput = z.infer<typeof processRequestCreateSchema>;
|
|
61
|
+
export declare const PROCESS_REQUEST_TTL_MS: number;
|
|
62
|
+
export type ProcessRequestStatus = 'pending' | 'answered' | 'cancelled' | 'expired';
|
|
63
|
+
export interface ProcessRequestAnswer extends ProcessRequestAnswerInput {
|
|
64
|
+
at: string;
|
|
65
|
+
}
|
|
66
|
+
export interface ProcessRequest {
|
|
67
|
+
requestId: string;
|
|
68
|
+
jobId: string;
|
|
69
|
+
attemptId: string;
|
|
70
|
+
sessionId: string;
|
|
71
|
+
kind: ProcessKind;
|
|
72
|
+
questions?: ProcessQuestion[];
|
|
73
|
+
planContent?: string;
|
|
74
|
+
toolTitle?: string;
|
|
75
|
+
toolDetail?: string;
|
|
76
|
+
status: ProcessRequestStatus;
|
|
77
|
+
createdAt: string;
|
|
78
|
+
deadlineAt: string;
|
|
79
|
+
updatedAt: string;
|
|
80
|
+
answer?: ProcessRequestAnswer;
|
|
81
|
+
}
|
|
82
|
+
export declare const processRequestSchema: z.ZodObject<{
|
|
83
|
+
requestId: z.ZodString;
|
|
84
|
+
jobId: z.ZodString;
|
|
85
|
+
attemptId: z.ZodString;
|
|
86
|
+
sessionId: z.ZodString;
|
|
87
|
+
kind: z.ZodEnum<{
|
|
88
|
+
plan: "plan";
|
|
89
|
+
permission: "permission";
|
|
90
|
+
question: "question";
|
|
91
|
+
}>;
|
|
92
|
+
questions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
93
|
+
id: z.ZodString;
|
|
94
|
+
question: z.ZodPipe<z.ZodString, z.ZodString>;
|
|
95
|
+
header: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodString>>;
|
|
96
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
97
|
+
label: z.ZodPipe<z.ZodString, z.ZodString>;
|
|
98
|
+
description: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodString>>;
|
|
99
|
+
}, z.core.$strict>>>;
|
|
100
|
+
multiSelect: z.ZodOptional<z.ZodBoolean>;
|
|
101
|
+
}, z.core.$strict>>>;
|
|
102
|
+
planContent: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodString>>;
|
|
103
|
+
toolTitle: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodString>>;
|
|
104
|
+
toolDetail: z.ZodOptional<z.ZodString>;
|
|
105
|
+
status: z.ZodEnum<{
|
|
106
|
+
pending: "pending";
|
|
107
|
+
cancelled: "cancelled";
|
|
108
|
+
answered: "answered";
|
|
109
|
+
expired: "expired";
|
|
110
|
+
}>;
|
|
111
|
+
createdAt: z.ZodString;
|
|
112
|
+
deadlineAt: z.ZodString;
|
|
113
|
+
updatedAt: z.ZodString;
|
|
114
|
+
answer: z.ZodOptional<z.ZodObject<{
|
|
115
|
+
clientRequestId: z.ZodString;
|
|
116
|
+
outcome: z.ZodEnum<{
|
|
117
|
+
cancelled: "cancelled";
|
|
118
|
+
abandoned: "abandoned";
|
|
119
|
+
accepted: "accepted";
|
|
120
|
+
rejected: "rejected";
|
|
121
|
+
approved: "approved";
|
|
122
|
+
}>;
|
|
123
|
+
answers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
|
|
124
|
+
note: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodString>>;
|
|
125
|
+
decidedBy: z.ZodOptional<z.ZodObject<{
|
|
126
|
+
kind: z.ZodEnum<{
|
|
127
|
+
person: "person";
|
|
128
|
+
coach: "coach";
|
|
129
|
+
}>;
|
|
130
|
+
agent: z.ZodOptional<z.ZodString>;
|
|
131
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
132
|
+
}, z.core.$strict>>;
|
|
133
|
+
stopTask: z.ZodOptional<z.ZodLiteral<true>>;
|
|
134
|
+
at: z.ZodString;
|
|
135
|
+
}, z.core.$strict>>;
|
|
136
|
+
}, z.core.$strict>;
|
|
137
|
+
export declare class ProcessRequestError extends Error {
|
|
138
|
+
readonly code: 'forbidden' | 'expired' | 'already_decided' | 'idempotency_conflict' | 'not_found' | 'invalid';
|
|
139
|
+
constructor(code: 'forbidden' | 'expired' | 'already_decided' | 'idempotency_conflict' | 'not_found' | 'invalid', message: string);
|
|
140
|
+
}
|
|
141
|
+
export declare function sameProcessRequest(record: ProcessRequest, input: ProcessRequestCreateInput): boolean;
|
|
142
|
+
export declare function createProcessRequest(input: ProcessRequestCreateInput, at?: Date, ttlMs?: number): ProcessRequest;
|
|
143
|
+
/** A repeated clientRequestId returns the recorded answer. A late answer does not change an expired request. */
|
|
144
|
+
export declare function answerProcessRequest(request: ProcessRequest, input: ProcessRequestAnswerInput, at?: Date): {
|
|
145
|
+
request: ProcessRequest;
|
|
146
|
+
idempotent: boolean;
|
|
147
|
+
};
|
|
148
|
+
export declare function expireProcessRequest(request: ProcessRequest, at?: Date): ProcessRequest;
|
|
149
|
+
/** Reading a pending request past its deadline shows expired and does not change the stored record. */
|
|
150
|
+
export declare function projectProcessRequest(request: ProcessRequest, now?: number): ProcessRequest;
|
|
151
|
+
export {};
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/** Live ACP questions, plan approvals and tool permissions. Callers persist each returned value before the waiting call resumes. */
|
|
2
|
+
import { randomUUID } from 'node:crypto';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
const id = z.string().trim().min(1).max(512);
|
|
5
|
+
const control = /[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/;
|
|
6
|
+
const plain = (max) => z.string().max(max).refine(value => !control.test(value), 'Control characters are not allowed');
|
|
7
|
+
const optionSchema = z.object({
|
|
8
|
+
label: plain(500).pipe(z.string().trim().min(1)),
|
|
9
|
+
description: plain(2000).pipe(z.string().trim().min(1)).optional(),
|
|
10
|
+
}).strict();
|
|
11
|
+
export const processQuestionSchema = z.object({
|
|
12
|
+
id: z.string().trim().min(1).max(64),
|
|
13
|
+
question: plain(4000).pipe(z.string().trim().min(1)),
|
|
14
|
+
header: plain(200).pipe(z.string().trim().min(1)).optional(),
|
|
15
|
+
options: z.array(optionSchema).max(20).optional(),
|
|
16
|
+
multiSelect: z.boolean().optional(),
|
|
17
|
+
}).strict();
|
|
18
|
+
const answerValue = z.union([plain(8000), z.array(plain(8000)).max(20)]);
|
|
19
|
+
export const processRequestAnswerSchema = z.object({
|
|
20
|
+
clientRequestId: id,
|
|
21
|
+
outcome: z.enum(['accepted', 'cancelled', 'approved', 'rejected', 'abandoned']),
|
|
22
|
+
answers: z.record(z.string().trim().min(1).max(4000), answerValue).optional(),
|
|
23
|
+
/** Why it was decided so: a person's reason for a rejection, or the coach's for either. Shown on the page and, when the task is stopped, in the notice to the origin session. */
|
|
24
|
+
note: plain(2000).pipe(z.string().trim().min(1)).optional(),
|
|
25
|
+
/** Who decided. The page answers as a person; the coach answers through the gateway and names its agent session. */
|
|
26
|
+
decidedBy: z.object({ kind: z.enum(['person', 'coach']), agent: id.optional(), sessionId: id.optional() }).strict()
|
|
27
|
+
.refine(by => by.kind === 'coach' || (!by.agent && !by.sessionId), 'Only a coach names an agent session').optional(),
|
|
28
|
+
/** Reject and cancel the task, so the agent cannot retry the tool another way. */
|
|
29
|
+
stopTask: z.literal(true).optional(),
|
|
30
|
+
}).strict();
|
|
31
|
+
const processKind = z.enum(['question', 'plan', 'permission']);
|
|
32
|
+
/** The tool name and the arguments a person approves. Tool output never enters the record. */
|
|
33
|
+
const toolTitle = plain(500).pipe(z.string().trim().min(1));
|
|
34
|
+
const toolDetail = plain(16 * 1024);
|
|
35
|
+
function assertBody(input, ctx) {
|
|
36
|
+
if (input.kind === 'question' && !input.questions?.length)
|
|
37
|
+
ctx.addIssue({ code: 'custom', path: ['questions'], message: 'A question request needs questions' });
|
|
38
|
+
if (input.kind === 'plan' && !input.planContent)
|
|
39
|
+
ctx.addIssue({ code: 'custom', path: ['planContent'], message: 'A plan request needs plan text' });
|
|
40
|
+
if (input.kind === 'permission' && !input.toolTitle)
|
|
41
|
+
ctx.addIssue({ code: 'custom', path: ['toolTitle'], message: 'A permission request needs the tool title' });
|
|
42
|
+
if (input.kind !== 'plan' && input.planContent)
|
|
43
|
+
ctx.addIssue({ code: 'custom', path: ['planContent'], message: 'Only a plan request has plan text' });
|
|
44
|
+
if (input.kind !== 'question' && input.questions)
|
|
45
|
+
ctx.addIssue({ code: 'custom', path: ['questions'], message: 'Only a question request has questions' });
|
|
46
|
+
if (input.kind !== 'permission' && (input.toolTitle || input.toolDetail))
|
|
47
|
+
ctx.addIssue({ code: 'custom', path: ['toolTitle'], message: 'Only a permission request names a tool' });
|
|
48
|
+
}
|
|
49
|
+
export const processRequestCreateSchema = z.object({
|
|
50
|
+
requestId: id.optional(),
|
|
51
|
+
jobId: id,
|
|
52
|
+
attemptId: id,
|
|
53
|
+
sessionId: id,
|
|
54
|
+
kind: processKind,
|
|
55
|
+
questions: z.array(processQuestionSchema).min(1).max(20).optional(),
|
|
56
|
+
planContent: plain(64 * 1024).pipe(z.string().trim().min(1)).optional(),
|
|
57
|
+
toolTitle: toolTitle.optional(),
|
|
58
|
+
toolDetail: toolDetail.optional(),
|
|
59
|
+
}).strict().superRefine(assertBody);
|
|
60
|
+
export const PROCESS_REQUEST_TTL_MS = 5 * 60 * 1000;
|
|
61
|
+
export const processRequestSchema = z.object({
|
|
62
|
+
requestId: id,
|
|
63
|
+
jobId: id,
|
|
64
|
+
attemptId: id,
|
|
65
|
+
sessionId: id,
|
|
66
|
+
kind: processKind,
|
|
67
|
+
questions: z.array(processQuestionSchema).min(1).max(20).optional(),
|
|
68
|
+
planContent: plain(64 * 1024).pipe(z.string().trim().min(1)).optional(),
|
|
69
|
+
toolTitle: toolTitle.optional(),
|
|
70
|
+
toolDetail: toolDetail.optional(),
|
|
71
|
+
status: z.enum(['pending', 'answered', 'cancelled', 'expired']),
|
|
72
|
+
createdAt: z.string().datetime(),
|
|
73
|
+
deadlineAt: z.string().datetime(),
|
|
74
|
+
updatedAt: z.string().datetime(),
|
|
75
|
+
answer: processRequestAnswerSchema.extend({ at: z.string().datetime() }).optional(),
|
|
76
|
+
}).strict().superRefine(assertBody);
|
|
77
|
+
export class ProcessRequestError extends Error {
|
|
78
|
+
code;
|
|
79
|
+
constructor(code, message) {
|
|
80
|
+
super(message);
|
|
81
|
+
this.code = code;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function stable(value) {
|
|
85
|
+
if (Array.isArray(value))
|
|
86
|
+
return `[${value.map(stable).join(',')}]`;
|
|
87
|
+
if (value && typeof value === 'object') {
|
|
88
|
+
const record = value;
|
|
89
|
+
return `{${Object.keys(record).sort().map(key => `${JSON.stringify(key)}:${stable(record[key])}`).join(',')}}`;
|
|
90
|
+
}
|
|
91
|
+
return JSON.stringify(value) ?? 'null';
|
|
92
|
+
}
|
|
93
|
+
export function sameProcessRequest(record, input) {
|
|
94
|
+
return record.jobId === input.jobId && record.attemptId === input.attemptId && record.sessionId === input.sessionId
|
|
95
|
+
&& record.kind === input.kind && stable(record.questions ?? null) === stable(input.questions ?? null)
|
|
96
|
+
&& (record.planContent ?? '') === (input.planContent ?? '')
|
|
97
|
+
&& (record.toolTitle ?? '') === (input.toolTitle ?? '') && (record.toolDetail ?? '') === (input.toolDetail ?? '');
|
|
98
|
+
}
|
|
99
|
+
export function createProcessRequest(input, at = new Date(), ttlMs = PROCESS_REQUEST_TTL_MS) {
|
|
100
|
+
const parsed = processRequestCreateSchema.parse(input);
|
|
101
|
+
const createdAt = at.toISOString();
|
|
102
|
+
return {
|
|
103
|
+
requestId: parsed.requestId ?? randomUUID(), jobId: parsed.jobId, attemptId: parsed.attemptId, sessionId: parsed.sessionId, kind: parsed.kind,
|
|
104
|
+
...(parsed.questions ? { questions: parsed.questions } : {}), ...(parsed.planContent ? { planContent: parsed.planContent } : {}),
|
|
105
|
+
...(parsed.toolTitle ? { toolTitle: parsed.toolTitle } : {}), ...(parsed.toolDetail ? { toolDetail: parsed.toolDetail } : {}),
|
|
106
|
+
status: 'pending', createdAt, updatedAt: createdAt, deadlineAt: new Date(at.getTime() + ttlMs).toISOString(),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function assertAnswer(request, input) {
|
|
110
|
+
if (input.stopTask && input.outcome !== 'rejected')
|
|
111
|
+
throw new ProcessRequestError('invalid', 'Only a rejection stops the task');
|
|
112
|
+
if (input.note && input.outcome !== 'rejected' && input.decidedBy?.kind !== 'coach')
|
|
113
|
+
throw new ProcessRequestError('invalid', 'Only a rejection, or the coach, gives a reason');
|
|
114
|
+
if (request.kind === 'question') {
|
|
115
|
+
if (input.outcome !== 'accepted' && input.outcome !== 'cancelled')
|
|
116
|
+
throw new ProcessRequestError('invalid', 'Question answers must be accepted or cancelled');
|
|
117
|
+
if (input.outcome === 'cancelled' && input.answers && Object.keys(input.answers).length)
|
|
118
|
+
throw new ProcessRequestError('invalid', 'A cancelled question has no answers');
|
|
119
|
+
if (input.outcome === 'accepted') {
|
|
120
|
+
const expected = request.questions?.map(question => question.question) ?? [];
|
|
121
|
+
const answers = input.answers ?? {};
|
|
122
|
+
if (expected.length !== Object.keys(answers).length || expected.some(question => !Object.hasOwn(answers, question))) {
|
|
123
|
+
throw new ProcessRequestError('invalid', 'Answers must address the recorded questions');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (request.kind === 'permission') {
|
|
129
|
+
if (!['approved', 'rejected', 'cancelled'].includes(input.outcome))
|
|
130
|
+
throw new ProcessRequestError('invalid', 'Permission answers must be approved, rejected, or cancelled');
|
|
131
|
+
if (input.answers)
|
|
132
|
+
throw new ProcessRequestError('invalid', 'A permission answer has no question answers');
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (!['approved', 'rejected', 'abandoned'].includes(input.outcome))
|
|
136
|
+
throw new ProcessRequestError('invalid', 'Plan answers must be approved, rejected, or abandoned');
|
|
137
|
+
if (input.answers)
|
|
138
|
+
throw new ProcessRequestError('invalid', 'A plan answer has no question answers');
|
|
139
|
+
}
|
|
140
|
+
/** A repeated clientRequestId returns the recorded answer. A late answer does not change an expired request. */
|
|
141
|
+
export function answerProcessRequest(request, input, at = new Date()) {
|
|
142
|
+
const parsed = processRequestAnswerSchema.parse(input);
|
|
143
|
+
assertAnswer(request, parsed);
|
|
144
|
+
if (request.answer?.clientRequestId === parsed.clientRequestId) {
|
|
145
|
+
if (request.answer.outcome !== parsed.outcome || stable(request.answer.answers ?? null) !== stable(parsed.answers ?? null)
|
|
146
|
+
|| (request.answer.note ?? '') !== (parsed.note ?? '') || Boolean(request.answer.stopTask) !== Boolean(parsed.stopTask)) {
|
|
147
|
+
throw new ProcessRequestError('idempotency_conflict', 'clientRequestId conflicts with a recorded answer');
|
|
148
|
+
}
|
|
149
|
+
return { request: structuredClone(request), idempotent: true };
|
|
150
|
+
}
|
|
151
|
+
if (request.status === 'expired')
|
|
152
|
+
throw new ProcessRequestError('expired', 'This process request has expired');
|
|
153
|
+
if (request.answer || request.status !== 'pending')
|
|
154
|
+
throw new ProcessRequestError('already_decided', 'This process request is no longer pending');
|
|
155
|
+
if (Date.parse(request.deadlineAt) <= at.getTime())
|
|
156
|
+
throw new ProcessRequestError('expired', 'This process request has expired');
|
|
157
|
+
const next = structuredClone(request);
|
|
158
|
+
next.status = parsed.outcome === 'cancelled' || parsed.outcome === 'abandoned' ? 'cancelled' : 'answered';
|
|
159
|
+
next.answer = { ...parsed, at: at.toISOString() };
|
|
160
|
+
next.updatedAt = next.answer.at;
|
|
161
|
+
return { request: next, idempotent: false };
|
|
162
|
+
}
|
|
163
|
+
export function expireProcessRequest(request, at = new Date()) {
|
|
164
|
+
const next = structuredClone(request);
|
|
165
|
+
if (next.status === 'pending') {
|
|
166
|
+
next.status = 'expired';
|
|
167
|
+
next.updatedAt = at.toISOString();
|
|
168
|
+
}
|
|
169
|
+
return next;
|
|
170
|
+
}
|
|
171
|
+
/** Reading a pending request past its deadline shows expired and does not change the stored record. */
|
|
172
|
+
export function projectProcessRequest(request, now = Date.now()) {
|
|
173
|
+
const next = structuredClone(request);
|
|
174
|
+
if (next.status === 'pending' && Date.parse(next.deadlineAt) <= now)
|
|
175
|
+
next.status = 'expired';
|
|
176
|
+
return next;
|
|
177
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const projectDiscoveryConfigSchema: z.ZodObject<{
|
|
3
|
+
readerExecutable: z.ZodDefault<z.ZodString>;
|
|
4
|
+
allowedRoots: z.ZodArray<z.ZodString>;
|
|
5
|
+
explicitRoots: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
6
|
+
timeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
7
|
+
maxProjects: z.ZodDefault<z.ZodNumber>;
|
|
8
|
+
}, z.core.$strict>;
|
|
9
|
+
export declare const DISCOVERY_METHODS: {
|
|
10
|
+
execution_project_scan: {
|
|
11
|
+
description: string;
|
|
12
|
+
parameters: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{}, z.core.$strict>>;
|
|
13
|
+
};
|
|
14
|
+
execution_project_list: {
|
|
15
|
+
description: string;
|
|
16
|
+
parameters: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{}, z.core.$strict>>;
|
|
17
|
+
};
|
|
18
|
+
execution_discovery_config_get: {
|
|
19
|
+
description: string;
|
|
20
|
+
parameters: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{}, z.core.$strict>>;
|
|
21
|
+
};
|
|
22
|
+
execution_discovery_config_update: {
|
|
23
|
+
description: string;
|
|
24
|
+
parameters: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
|
|
25
|
+
mode: z.ZodEnum<{
|
|
26
|
+
manual: "manual";
|
|
27
|
+
interval: "interval";
|
|
28
|
+
}>;
|
|
29
|
+
intervalMs: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
}, z.core.$strict>>;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export declare class ProjectRoleDiscovery {
|
|
34
|
+
private readonly file;
|
|
35
|
+
private readonly config;
|
|
36
|
+
private state;
|
|
37
|
+
private started;
|
|
38
|
+
private closed;
|
|
39
|
+
private timer?;
|
|
40
|
+
private active?;
|
|
41
|
+
private controller?;
|
|
42
|
+
constructor(options: {
|
|
43
|
+
stateDirectory: string;
|
|
44
|
+
config: z.input<typeof projectDiscoveryConfigSchema>;
|
|
45
|
+
});
|
|
46
|
+
private commit;
|
|
47
|
+
private view;
|
|
48
|
+
start(): void;
|
|
49
|
+
private schedule;
|
|
50
|
+
close(): Promise<void>;
|
|
51
|
+
invoke(method: string, params: unknown): Promise<unknown>;
|
|
52
|
+
private scan;
|
|
53
|
+
private reader;
|
|
54
|
+
private collect;
|
|
55
|
+
private readRoles;
|
|
56
|
+
}
|