@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,242 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Bounded, notification-driven A2A caller. No polling or child-session log reader."""
|
|
3
|
+
import argparse
|
|
4
|
+
import datetime
|
|
5
|
+
import hashlib
|
|
6
|
+
import json
|
|
7
|
+
import os
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
import re
|
|
10
|
+
import urllib.error
|
|
11
|
+
import urllib.request
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def now():
|
|
15
|
+
return datetime.datetime.now(datetime.timezone.utc).isoformat()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def save(path, value):
|
|
19
|
+
path = Path(path)
|
|
20
|
+
temporary = path.with_name(path.name + '.tmp')
|
|
21
|
+
with temporary.open('w') as stream:
|
|
22
|
+
os.chmod(temporary, 0o600)
|
|
23
|
+
json.dump(value, stream, ensure_ascii=False, indent=2)
|
|
24
|
+
stream.write('\n')
|
|
25
|
+
os.replace(temporary, path)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def transcript(run):
|
|
29
|
+
# Only this root's native records; never open a worker session or print reasoning.
|
|
30
|
+
with Path(run['rootTranscript']).open() as stream:
|
|
31
|
+
for line in stream:
|
|
32
|
+
# Image/tool outputs can be huge; they are not calls, user notices or turn boundaries.
|
|
33
|
+
header = line[:320]
|
|
34
|
+
if any('"' + kind + '"' in header for kind in ['custom_tool_call_output', 'function_call_output', 'reasoning']):
|
|
35
|
+
continue
|
|
36
|
+
try:
|
|
37
|
+
yield json.loads(line)
|
|
38
|
+
except json.JSONDecodeError:
|
|
39
|
+
continue
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def calls(run):
|
|
43
|
+
output, seen = [], set()
|
|
44
|
+
for row in transcript(run):
|
|
45
|
+
item = row.get('payload', {})
|
|
46
|
+
if row.get('type') == 'response_item' and item.get('type') in ['function_call', 'custom_tool_call']:
|
|
47
|
+
key = item.get('call_id')
|
|
48
|
+
if key and key not in seen:
|
|
49
|
+
seen.add(key)
|
|
50
|
+
output.append({'callId': key, 'name': item.get('name'), 'timestamp': row.get('timestamp')})
|
|
51
|
+
return output
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def action(run, name):
|
|
55
|
+
current = calls(run)[-1]
|
|
56
|
+
run.setdefault('actionCalls', {})[name] = current['callId']
|
|
57
|
+
return current
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def rpc(run, method, params):
|
|
61
|
+
request = urllib.request.Request(run['gatewayUrl'].rstrip('/') + '/invoke',
|
|
62
|
+
data=json.dumps({'method': method, 'params': params}).encode(),
|
|
63
|
+
headers={'Content-Type': 'application/json'})
|
|
64
|
+
with urllib.request.urlopen(request, timeout=20) as response:
|
|
65
|
+
return json.load(response)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def actual_notice(run, notice_id):
|
|
69
|
+
entered = False
|
|
70
|
+
for row in transcript(run):
|
|
71
|
+
item = row.get('payload', {})
|
|
72
|
+
if item.get('call_id') == run['actionCalls']['dispatch']:
|
|
73
|
+
entered = True
|
|
74
|
+
if not entered or row.get('type') != 'response_item' or item.get('type') != 'message' or item.get('role') != 'user':
|
|
75
|
+
continue
|
|
76
|
+
text = ''.join(c.get('text', '') for c in item.get('content', []) if isinstance(c, dict))
|
|
77
|
+
for candidate in re.findall(r'\{[^{}]*"noticeId"\s*:[^{}]*\}', text):
|
|
78
|
+
try:
|
|
79
|
+
notice = json.loads(candidate)
|
|
80
|
+
except json.JSONDecodeError:
|
|
81
|
+
continue
|
|
82
|
+
receipt = run['dispatchReceipt']
|
|
83
|
+
if notice.get('noticeId') == notice_id and notice.get('originSessionId') == run['originSessionId']:
|
|
84
|
+
matches = (notice.get('jobId') == receipt['jobId'] if 'jobId' in notice
|
|
85
|
+
else notice.get('taskId') == receipt.get('taskId') and notice.get('remote') == receipt.get('remote'))
|
|
86
|
+
if matches:
|
|
87
|
+
return {**notice, 'receivedAt': row.get('timestamp')}
|
|
88
|
+
raise ValueError('No matching real user notification in the root transcript; querying before wake is prohibited')
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def dispatch(path, run, invoke=rpc):
|
|
92
|
+
if run['phase'] != 'prepared' or not run.get('developmentReady'):
|
|
93
|
+
raise ValueError('Dispatch requires finished development/deployment and a prepared run; never automatically resend')
|
|
94
|
+
if not run['request'].get('clientRequestId'):
|
|
95
|
+
raise ValueError('A stable clientRequestId is required')
|
|
96
|
+
run['dispatchBoundary'] = action(run, 'dispatch')
|
|
97
|
+
run['phase'] = 'admission_inflight'
|
|
98
|
+
save(path, run) # Crash after sending never creates permission to resend.
|
|
99
|
+
try:
|
|
100
|
+
receipt = invoke(run, 'execution_submit', {'originSessionId': run['originSessionId'], **run['request']})
|
|
101
|
+
if receipt.get('error') or receipt.get('submissionStatus') != 'accepted':
|
|
102
|
+
run['phase'] = 'admission_requires_attention'
|
|
103
|
+
else:
|
|
104
|
+
run['phase'] = 'waiting_notification'
|
|
105
|
+
run['dispatchReceipt'] = receipt
|
|
106
|
+
except Exception as error:
|
|
107
|
+
run['phase'] = 'admission_unknown'
|
|
108
|
+
run['admissionError'] = str(error)
|
|
109
|
+
save(path, run)
|
|
110
|
+
summary = {k: v for k, v in run.get('dispatchReceipt', {}).items() if k in
|
|
111
|
+
['jobId', 'attemptId', 'remote', 'taskId', 'contextId', 'sessionId', 'submissionStatus', 'executionStatus', 'error']}
|
|
112
|
+
return {'phase': run['phase'], 'receipt': summary, 'error': run.get('admissionError'),
|
|
113
|
+
'mustEndTurn': True, 'nextAction': 'End this turn now. Handle only a real arriving notice.',
|
|
114
|
+
'prohibited': ['task polling', 'sleep/wait for completion', 'worker session logs', 'repeat artifact QA', 'post-dispatch development']}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def inspect(path, run, notice_id, invoke=rpc):
|
|
118
|
+
if run['phase'] != 'waiting_notification':
|
|
119
|
+
raise ValueError('Inspect is a one-shot operation after a notification, not a polling command')
|
|
120
|
+
notice = actual_notice(run, notice_id)
|
|
121
|
+
action(run, 'inspect')
|
|
122
|
+
run['notice'] = notice
|
|
123
|
+
run['phase'] = 'inspection_inflight'
|
|
124
|
+
save(path, run)
|
|
125
|
+
errors, report, receipt = [], None, None
|
|
126
|
+
try:
|
|
127
|
+
receipt = invoke(run, 'execution_get', {'originSessionId': run['originSessionId'], 'jobId': run['dispatchReceipt']['jobId']})
|
|
128
|
+
if receipt['attemptId'] != run['dispatchReceipt']['attemptId'] or receipt.get('taskId') != run['dispatchReceipt'].get('taskId'):
|
|
129
|
+
raise ValueError('Receipt execution identity changed')
|
|
130
|
+
metadata = receipt.get('resultMetadata') or {}
|
|
131
|
+
if receipt['executionStatus'] != 'completed' or metadata.get('producer') != '1agents/a2a-host' or metadata.get('outcome') != 'completed':
|
|
132
|
+
raise ValueError('Worker did not deliver a completed host-authored result')
|
|
133
|
+
if metadata.get('taskId') != receipt['taskId'] or metadata.get('validation', {}).get('status') != 'passed':
|
|
134
|
+
raise ValueError('Host result validation or task binding failed')
|
|
135
|
+
if metadata.get('sessionId') == run['review'].get('producerSessionId'):
|
|
136
|
+
raise ValueError('Reviewer must be independent of the PPT producer')
|
|
137
|
+
if receipt.get('sessionId') and metadata.get('sessionId') != receipt['sessionId']:
|
|
138
|
+
raise ValueError('Host result session differs from the execution receipt')
|
|
139
|
+
if run['review'].get('expectedPreset') and metadata.get('agentPreset') != run['review']['expectedPreset']:
|
|
140
|
+
raise ValueError('Reviewer preset differs from the frozen target')
|
|
141
|
+
# Read only the NEW report, bound to the host receipt. Never reopen PPTs/PNGs or download them here.
|
|
142
|
+
target = Path(run['review']['reportPath']).resolve()
|
|
143
|
+
artifact = next(a for a in metadata.get('artifacts', []) if Path(a['path']).resolve() == target)
|
|
144
|
+
raw = target.read_bytes()
|
|
145
|
+
if hashlib.sha256(raw).hexdigest() != artifact['sha256'] or len(raw) != artifact['size']:
|
|
146
|
+
raise ValueError('Review report differs from the host receipt')
|
|
147
|
+
report = json.loads(raw)
|
|
148
|
+
if report.get('artifactDigest') != run['review']['artifactDigest']:
|
|
149
|
+
raise ValueError('Report is bound to a different PPT version')
|
|
150
|
+
if report.get('verdict') not in ['passed', 'changes_requested'] or not isinstance(report.get('issues'), list):
|
|
151
|
+
raise ValueError('Invalid report verdict or issues')
|
|
152
|
+
if report['verdict'] == 'passed' and (report['issues'] or report.get('factsChecked') is not True or report.get('allSlidesViewed') is not True):
|
|
153
|
+
raise ValueError('Passed report lacks required independent checks')
|
|
154
|
+
except Exception as error:
|
|
155
|
+
errors.append(str(error))
|
|
156
|
+
run['inspection'] = {'receipt': receipt, 'report': report, 'errors': errors, 'valid': not errors}
|
|
157
|
+
run['phase'] = 'inspected'
|
|
158
|
+
save(path, run)
|
|
159
|
+
return {'phase': run['phase'], 'valid': not errors, 'report': report, 'errors': errors,
|
|
160
|
+
'existingArtifacts': run['review'].get('links', []), 'nextAction': 'Record the conclusion once; do not repeat worker QA or dispatch fixes.'}
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def record(path, run):
|
|
164
|
+
if run['phase'] != 'inspected':
|
|
165
|
+
raise ValueError('Record requires the one-shot receipt inspection')
|
|
166
|
+
action(run, 'record')
|
|
167
|
+
report = run['inspection'].get('report') or {}
|
|
168
|
+
run['conclusion'] = {'recordedAt': now(), 'jobId': run['dispatchReceipt']['jobId'],
|
|
169
|
+
'attemptId': run['dispatchReceipt']['attemptId'], 'noticeId': run['notice']['noticeId'],
|
|
170
|
+
'reportValid': run['inspection']['valid'], 'verdict': report.get('verdict', 'unverified'),
|
|
171
|
+
'issues': report.get('issues', []), 'errors': run['inspection']['errors'],
|
|
172
|
+
'decision': 'Preserve the existing PPT and report; no edits or follow-up production authorized',
|
|
173
|
+
'pptBusinessAccepted': False, 'executionReviewRecorded': False}
|
|
174
|
+
save(Path(path).with_name('processing-conclusion.json'), run['conclusion'])
|
|
175
|
+
run['phase'] = 'conclusion_recorded'
|
|
176
|
+
save(path, run)
|
|
177
|
+
return run['conclusion']
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def audit(run):
|
|
181
|
+
native = calls(run)
|
|
182
|
+
start = next(i for i, c in enumerate(native) if c['callId'] == run['actionCalls']['dispatch'])
|
|
183
|
+
stop = next(i for i, c in enumerate(native) if c['callId'] == run['actionCalls']['ack'])
|
|
184
|
+
measured = native[start:stop + 1]
|
|
185
|
+
notice = actual_notice(run, run['notice']['noticeId'])
|
|
186
|
+
before_wake = [c for c in measured[1:] if c['timestamp'] < notice['receivedAt']]
|
|
187
|
+
unexpected = [c for c in measured if c['callId'] not in run['actionCalls'].values()]
|
|
188
|
+
yielded = False
|
|
189
|
+
for row in transcript(run):
|
|
190
|
+
if not (run['dispatchBoundary']['timestamp'] <= row.get('timestamp', '') < notice['receivedAt']):
|
|
191
|
+
continue
|
|
192
|
+
item = row.get('payload', {})
|
|
193
|
+
if row.get('type') == 'response_item' and item.get('role') == 'assistant' and (item.get('phase') == 'final_answer' or item.get('channel') == 'final'):
|
|
194
|
+
yielded = True
|
|
195
|
+
if row.get('type') == 'event_msg' and item.get('type') in ['task_complete', 'task_completed', 'turn_complete', 'turn_completed']:
|
|
196
|
+
yielded = True
|
|
197
|
+
return {'countingRule': 'Every unique native root tool call from dispatch through this ack inclusive; development before dispatch and worker calls excluded; no reset.',
|
|
198
|
+
'rootToolCalls': len(measured), 'calls': measured, 'actionCalls': run['actionCalls'],
|
|
199
|
+
'callsBeforeNotification': before_wake, 'unexpectedCalls': unexpected,
|
|
200
|
+
'nativeNotificationReceived': True, 'rootTurnEndedBeforeNotification': yielded,
|
|
201
|
+
'stepBudgetMet': 3 <= len(measured) <= 5,
|
|
202
|
+
'strictAsyncFlowPassed': 3 <= len(measured) <= 5 and not before_wake and not unexpected and yielded,
|
|
203
|
+
'qualityVerdict': run['conclusion']['verdict'], 'pptChanged': False}
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
def acknowledge(path, run, invoke=rpc):
|
|
207
|
+
if run['phase'] != 'conclusion_recorded':
|
|
208
|
+
raise ValueError('Save a conclusion before acknowledging')
|
|
209
|
+
action(run, 'ack')
|
|
210
|
+
method = 'execution_ack' if 'jobId' in run['notice'] else 'remote_agent_ack'
|
|
211
|
+
run['ack'] = invoke(run, method, {'originSessionId': run['originSessionId'], 'noticeId': run['notice']['noticeId']})
|
|
212
|
+
run['phase'] = 'acknowledged'
|
|
213
|
+
run['measurement'] = audit(run)
|
|
214
|
+
save(path, run)
|
|
215
|
+
save(Path(path).with_name('step-count.json'), run['measurement'])
|
|
216
|
+
return {'phase': run['phase'], 'ack': run['ack'], 'measurement': run['measurement'],
|
|
217
|
+
'existingArtifacts': run['review'].get('links', []), 'nextAction': 'Final answer now; no extra query or audit call.'}
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
def main():
|
|
221
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
222
|
+
parser.add_argument('action', choices=['dispatch', 'inspect', 'record', 'ack'])
|
|
223
|
+
parser.add_argument('--run', required=True)
|
|
224
|
+
parser.add_argument('--notice-id')
|
|
225
|
+
args = parser.parse_args()
|
|
226
|
+
path = Path(args.run)
|
|
227
|
+
lock = path.with_name(path.name + '.lock')
|
|
228
|
+
fd = os.open(lock, os.O_CREAT | os.O_EXCL | os.O_WRONLY, 0o600)
|
|
229
|
+
try:
|
|
230
|
+
run = json.loads(path.read_text())
|
|
231
|
+
if args.action == 'dispatch': result = dispatch(path, run)
|
|
232
|
+
elif args.action == 'inspect': result = inspect(path, run, args.notice_id)
|
|
233
|
+
elif args.action == 'record': result = record(path, run)
|
|
234
|
+
else: result = acknowledge(path, run)
|
|
235
|
+
print(json.dumps(result, ensure_ascii=False, indent=2))
|
|
236
|
+
finally:
|
|
237
|
+
os.close(fd)
|
|
238
|
+
lock.unlink()
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
if __name__ == '__main__':
|
|
242
|
+
main()
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rsi-coach
|
|
3
|
+
description: 作为教练智能体训练一个领域角色(执行者 + 质检),用 acp-service rsi run 跑任务、读程序检查和质检意见、把反复出现的问题沉淀成技能、工具和程序检查。用户提到训练智能体、教练、RSI、执行者和质检、打回重做、角色目录(.1agents/roles)、ROLE.md / QA.md / checklist、把意见写成程序检查、复现或回炉时使用,即使没说“教练”两个字。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# RSI 教练
|
|
7
|
+
|
|
8
|
+
你是教练。执行者负责把任务做出来,质检(QA)负责把质量审出来,你负责节奏:派任务、读结果、决定何时打回、何时停下交给人,并把经验沉淀进角色目录。你不替执行者写产出,不替质检下结论,不上线,也不改锁定项。
|
|
9
|
+
|
|
10
|
+
目标是**在过程中尽量代码化**:把自然语言里反复出现的要求,逐步变成程序能守住的检查、脚本和 schema,让自然语言编程变成可控的程序。每迭代一轮,留给模型判断的部分就少一些。
|
|
11
|
+
|
|
12
|
+
## 三个阶段
|
|
13
|
+
|
|
14
|
+
**开发**:执行者和质检各按自己的目标做事,你把控节奏,指导两者创建技能、工具和验收条件。每改一次角色目录就提交一次,一次提交是一个角色版本。
|
|
15
|
+
|
|
16
|
+
**测试**:在干净上下文里(新会话、只带角色目录里沉淀的东西)复现。原题复现证明东西记下来了;变体题(换一个项目)证明学会的是做法。复现不了,说明还有东西留在对话里,回到开发。进入测试要先过门禁(见下文“开发 → 测试的门禁”)。
|
|
17
|
+
|
|
18
|
+
**发布**:通用性和专业可控达到相对均衡就发布,由人决定。发布后允许用户拒绝结果;被拒绝的结果和理由是数据,攒起来回炉。
|
|
19
|
+
|
|
20
|
+
## 角色目录
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
.1agents/roles/<role-id>/
|
|
24
|
+
├── profile.json # 角色 id
|
|
25
|
+
├── ROLE.md # 执行者的做法(可训练)
|
|
26
|
+
├── QA.md # 质检的评分标准和复审规则(可训练)
|
|
27
|
+
├── checklist.json # 检查项清单,locked: true 的项你不能改
|
|
28
|
+
├── checks/ # 程序检查,例如 check_outline.py(锁定)
|
|
29
|
+
└── cases/<case-id>/ # 用例:固定提交的仓库、受众、功能清单(人维护);kind 为 original(原题)或 variant(变体题)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## 跑一轮
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
acp-service rsi run --role .1agents/roles/<role-id> --case <case-id> \
|
|
36
|
+
--project <本地仓库> --workspace .1agents/runtime/rsi --qa
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
流程:执行者产出 → 程序检查(不过就打回执行者原会话)→ 质检审稿(同一任务只开一个质检会话,复审接着原会话,先核对上一轮意见)→ 需要修改就打回执行者 → 再检查、再复审。默认程序打回 1 次、质检修改最多 3 轮(`--max-bounces`、`--qa-max-revisions`)。同一条质检意见连续两次复审都没改到位,或总分连续两轮没有提高,就提前停下:再改也不会更好。
|
|
40
|
+
|
|
41
|
+
所有打回都走任务单,不靠对话里贴意见。任务单挂在执行者的任务上,存在网关的执行台账里,每次变化都是一条 `ticket.*` 台账事件,记着操作者和轮次:
|
|
42
|
+
|
|
43
|
+
- 程序检查没过的项、质检的意见,都写成带编号的条目(如 `P1-P2`、`Q1-3`),每条记着谁提的、谁处理、谁确认。
|
|
44
|
+
- 执行者用 DSH 工具 `ticket_show`、`ticket_mark`、`ticket_submit` 把条目标成 `done` 或 `disputed` 并写说明,再提交。操作者由调用的方法认定,执行者的会话只能操作自己任务的任务单。它不能核实自己的修改,也不能关单;违规的请求网关直接拒绝。
|
|
45
|
+
- 程序项由宿主重跑检查核实;质检意见由质检在复审的 `previous` 里按编号核实(`fixed`、`partly`、`not_fixed`、`withdrawn`),宿主合并进任务单,没改到位的会被重新打开。质检没有写任务单的方法,`issues` 只写新问题。
|
|
46
|
+
- 质检通过就关单,否则记下停止原因。
|
|
47
|
+
|
|
48
|
+
你和人用命令行看任务单、处理提议(`--job` 是 run.json 里执行者的 jobId):
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
acp-service ticket show --job <jobId>
|
|
52
|
+
acp-service ticket events --job <jobId>
|
|
53
|
+
acp-service ticket proposal --job <jobId> --id <提议编号> accept|reject|done --note "理由"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
查一个任务的完整留痕(谁发起、派给谁、谁批了什么、产物摘要、谁看过,含质检子任务):
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
acp-service trail --job <jobId>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
结果在工作目录:`run.json`(每轮的检查结果和质检记录,以及停止原因 `stopReason` 和角色版本)、`ticket.json`(网关写出的任务单只读导出)、`reviews/outline-rN.json`(每轮被审的版本)、`reviews/review-rN.json`(质检的分数、意见、`previous` 核对和 `proposals`)。每次运行还会在 `<workspace>/<role-id>/ledger.jsonl` 追加一行,门禁就读这本账。
|
|
63
|
+
|
|
64
|
+
停止原因:`passed` 通过;`max_bounces` 程序打回用完;`max_revisions` 质检修改轮数用完;`stalled` 改不动了;`needs_human` 改不动了且质检提了锁定项提议;`not_completed`、`review_failed` 执行者或质检没跑完。
|
|
65
|
+
|
|
66
|
+
## 读结果、做沉淀
|
|
67
|
+
|
|
68
|
+
每轮跑完,按这个顺序看:
|
|
69
|
+
|
|
70
|
+
1. **程序检查失败项**:执行者为什么没自查出来?通常是 ROLE.md 没写清规则,补进 ROLE.md。
|
|
71
|
+
2. **质检的改进提议**(任务单的 `proposals`):质检审稿时按类别提出该怎么改角色,逐条处理,处理完用 `acp-service ticket proposal` 标成采纳、不采纳或已完成,并写理由。
|
|
72
|
+
- **`check`,确定性的、能写成程序的**:写成新的程序检查,加进 checks/ 和 checklist.json,再在 ROLE.md 里告诉执行者、在 QA.md 里告诉质检“这项程序已经查了”。这是最有价值的沉淀。checks/ 和已锁定的项要由人确认后改。
|
|
73
|
+
- **`role`,做法上的**(开头要场景加结果、技术细节放附录):写进 ROLE.md。
|
|
74
|
+
- **`qa`,评判标准上的**(质检打分忽松忽紧、复审加码):写进 QA.md。
|
|
75
|
+
- **`locked`,卡在锁定项上的**(大纲模板、schema、程序检查、用例):交给人。
|
|
76
|
+
3. **质检意见和 `previous` 核对**:没写成提议、但在多次运行里反复出现的意见,同样按上面三类处理。`not_fixed` 或 `partly` 反复出现,说明执行者理解不了这类意见,换一种写法放进 ROLE.md。执行者标 `disputed` 而质检 `withdrawn` 的,看是不是规则本身写得不清楚。
|
|
77
|
+
4. **执行者编造**:质检抓到“仓库里没有这个能力”时,在 ROLE.md 里强调出处要求;能程序化的(出处文件不存在)已由检查守住。
|
|
78
|
+
|
|
79
|
+
### 把意见写成程序检查:P8–P14 的例子
|
|
80
|
+
|
|
81
|
+
产品介绍大纲角色的 P8–P14 就是这样来的:实跑里质检指出的确定性问题,写成了程序。P8–P11 来自两次实跑里质检的手工意见;P12–P14 来自之后几次运行的意见和 `check` 提议。
|
|
82
|
+
|
|
83
|
+
| 检查 | 规则 | 刻意不拦的情况 |
|
|
84
|
+
| --- | --- | --- |
|
|
85
|
+
| P8 | 每页要点不超过 5 条 | — |
|
|
86
|
+
| P9 | 受众看得到的文字里没有“待补”“TODO”“占位”这类占位符 | 项目自己写明的“待确认”这类限制 |
|
|
87
|
+
| P10 | 同一条要点不在多页逐字重复(去掉空白和标点后至少 12 个字相同) | 换了说法的重复,仍交给质检 |
|
|
88
|
+
| P11 | 发布文件名(zip、dmg 等)里写死的版本号,必须和项目所有版本记录一致(package.json,以及 RELEASE_NOTES.md 或 CHANGELOG.md 的第一个标题);记录之间本身不一致时,不能写死版本号 | “Node.js 22.18.0”这类运行环境版本 |
|
|
89
|
+
| P12 | 全稿最后一页用 `closing` 版式,且只有这一页用 | — |
|
|
90
|
+
| P13 | 标题里数本页条目(“四个动作”“三步”)时,数字和本页要点条数一致 | 序数(“第一步”)和描述对象的数量(“六个演示场景”) |
|
|
91
|
+
| P14 | 不同页的两条要点引用同一组出处文件时,不能有连续 8 个以上相同的汉字 | 英文词、命令和链接;换了说法但用词不同的重复,仍交给质检 |
|
|
92
|
+
|
|
93
|
+
写新检查时照这几条做:
|
|
94
|
+
|
|
95
|
+
- **规则对准实际问题,不图省事。** P11 没有只对照 package.json,因为 xingjian-showroom 自己的记录就不一致(package.json 0.2.0,RELEASE_NOTES.md v0.1.1),质检指出的正是这个。
|
|
96
|
+
- **写明不该拦什么。** 误报会把对的内容打回去,比漏报更伤;判断不了的留给质检。
|
|
97
|
+
- **用已有运行的产出回放验证。** 拿 `reviews/outline-rN.json` 跑新检查,确认质检当时指出的问题被拦下、已改好的版本能通过。P8–P11 在两次实跑的 4 份大纲上就是这样验证的;P13、P14 在之前运行的 10 份大纲上回放,P14 的阈值(8 个字)就是按“只拦真重复”定下来的。
|
|
98
|
+
- **加测试**:逐条故意违反、确认能拦住,再确认不会误报。
|
|
99
|
+
- **同步三处**:checklist.json 加条目(锁定),ROLE.md 告诉执行者,QA.md 告诉质检不必再查。打回提示写“全部检查通过”,不写死检查编号。
|
|
100
|
+
|
|
101
|
+
写成程序之后,这类问题会先被程序打回,到不了质检那里,质检就能专注在质量上。
|
|
102
|
+
|
|
103
|
+
改完用 git 提交角色目录,一次提交就是一个版本,提交说明写清这次沉淀了什么、来自哪次运行。
|
|
104
|
+
|
|
105
|
+
## 开发 → 测试的门禁
|
|
106
|
+
|
|
107
|
+
```sh
|
|
108
|
+
acp-service rsi gate --role .1agents/roles/<role-id> --workspace .1agents/runtime/rsi
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
门禁读账本,只看当前已提交的角色版本。放行要满足:
|
|
112
|
+
|
|
113
|
+
- 角色目录没有未提交的改动;
|
|
114
|
+
- 在原题上连续 2 次开发运行都通过(`--required` 可调);
|
|
115
|
+
- 每次的初稿都一次通过程序检查;
|
|
116
|
+
- 没有剩下没核实的“必须改”;
|
|
117
|
+
- 这几次运行里质检没有再提 `check` 或 `locked` 提议(还有能写成程序的、或卡在锁定项上的,就还没练完)。
|
|
118
|
+
|
|
119
|
+
角色目录一改就是新版本,计数从零开始。所以先把一批沉淀改完、提交,再在这个版本上连跑;不要边跑边改。
|
|
120
|
+
|
|
121
|
+
放行后用 `--phase test` 跑测试:它要求角色目录已提交、带 `--qa`、门禁已放行。原题和每道变体题都跑一遍,`rsi gate` 会列出每个用例在当前版本上的测试结果。变体题的功能清单要先由人确认,没确认的用例跑不起来。
|
|
122
|
+
|
|
123
|
+
## 什么时候停下交给人
|
|
124
|
+
|
|
125
|
+
- 停止原因是 `needs_human`,或质检多轮仍判“需要修改”且剩下的是取舍问题而不是错误。
|
|
126
|
+
- 要改锁定项、checks/、cases/,或要改 preset 和工具权限;质检的 `locked` 提议也在这一类。
|
|
127
|
+
- 执行者请求装依赖、提权、写工作目录以外的文件。不要放行,记录下来:反复出现说明工具不够,由人调整环境(例如给出装好依赖的解释器路径)。
|
|
128
|
+
- 要发布,或要把用户拒绝的结果回炉。
|
|
129
|
+
|
|
130
|
+
## 注意
|
|
131
|
+
|
|
132
|
+
- 质检分数是模型自评,没有经人校准;看同一会话前后两轮的趋势,不看绝对值。
|
|
133
|
+
- 每次运行都会在工作台留下真实任务,跑之前想清楚要验证什么。
|
|
134
|
+
- 不要为了让结果好看去删用例或放宽检查;这类改动交给人。
|
package/vendor/dsh/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Use persistent native Codex, Claude Code, Grok Build and other locally discovered ACP Agent sessions inside DeepSeek Harness. Choose native models and settings, use advertised commands, and answer tool permissions in DSH. The plugin is embedded with the runtime and service in the single public **`@1agents/acp-service`** package. This directory is its private source module.
|
|
4
4
|
|
|
5
|
-
The CI API baseline is **DSH 0.1.7-rc.2**, commit `21638c56315ae6a2b552d6091945d3144c9af32e`. Additional installed-package and interactive checks used an isolated profile on a locally modified DSH build labeled `0.2.0-rc.1`; see the [verification record](https://github.com/scottzx/
|
|
5
|
+
The CI API baseline is **DSH 0.1.7-rc.2**, commit `21638c56315ae6a2b552d6091945d3144c9af32e`. Additional installed-package and interactive checks used an isolated profile on a locally modified DSH build labeled `0.2.0-rc.1`; see the [verification record](https://github.com/scottzx/agent-workflow/blob/main/docs/marketplaces/verification-2026-10-09.md) for the exact scope. Other DSH releases require checking their plugin and preset APIs.
|
|
6
6
|
|
|
7
|
-
The same host supports opt-in A2A 1.0 delegation, disabled by default: remote text messages create or restore DSH sessions, return task IDs, and continue execution independently of HTTP clients. Configure `a2a` on the existing plugin row, set the host's `DSH_A2A_TOKEN`, and choose its public origin, default cwd and preset. Query and subscribe through the official A2A interfaces; allowed webhook origins enable completion callbacks. Waking a caller's main Agent requires its receiving host adapter. See the [service README's DSH A2A section](https://github.com/scottzx/
|
|
7
|
+
The same host supports opt-in A2A 1.0 delegation, disabled by default: remote text messages create or restore DSH sessions, return task IDs, and continue execution independently of HTTP clients. Configure `a2a` on the existing plugin row, set the host's `DSH_A2A_TOKEN`, and choose its public origin, default cwd and preset. Query and subscribe through the official A2A interfaces; allowed webhook origins enable completion callbacks. Waking a caller's main Agent requires its receiving host adapter. See the [service README's DSH A2A section](https://github.com/scottzx/agent-workflow/blob/main/packages/service/README.md#dsh-a2a) for configuration, metadata and recovery behavior. The shared server is exported as `@1agents/acp-service/a2a` and remains independent of DSH imports.
|
|
8
8
|
|
|
9
9
|
## Install and start a session
|
|
10
10
|
|
|
@@ -20,10 +20,10 @@ If pnpm pauses or fails with an ignored transitive `esbuild` build script, follo
|
|
|
20
20
|
|
|
21
21
|
Restart DSH after updating packages, confirm **`@1agents/acp-service`** is enabled on its Plugins page, and choose a discovered **ACP · Agent** preset for a new session. Select an existing workspace, then send a text prompt. Replace `web` with your profile name, such as `desktop`; from a DSH source checkout, use `pnpm dsh` in place of `dsh`.
|
|
22
22
|
|
|
23
|
-
For a pinned fallback, install the identical npm artifact from [GitHub Release 0.6.0](https://github.com/scottzx/
|
|
23
|
+
For a pinned fallback, install the identical npm artifact from [GitHub Release 0.6.0](https://github.com/scottzx/agent-workflow/releases/tag/acp-service-v0.6.0).
|
|
24
24
|
|
|
25
25
|
```sh
|
|
26
|
-
dsh plugin --profile web add https://github.com/scottzx/
|
|
26
|
+
dsh plugin --profile web add https://github.com/scottzx/agent-workflow/releases/download/acp-service-v0.6.0/1agents-acp-service-0.6.0.tgz
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
The package declares `dsh.bundle.patch` and its browser entry, so installation selects the bundle automatically.
|
|
@@ -34,7 +34,7 @@ The plugin starts its bundled ACP service on `127.0.0.1:36812` when no service i
|
|
|
34
34
|
npx --yes @1agents/acp-service@^0.7.0 serve --host 127.0.0.1 --port 36812 --no-report
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
Installing the package alone starts no process; activating the plugin starts the service. For local development, install the built checkout with `pnpm dsh plugin --profile web add /absolute/path/
|
|
37
|
+
Installing the package alone starts no process; activating the plugin starts the service. For local development, install the built checkout with `pnpm dsh plugin --profile web add /absolute/path/agent-workflow/packages/service`.
|
|
38
38
|
|
|
39
39
|
ACP routes are not listed as ordinary DSH models, and the adapter rejects requests from ordinary presets, including previously saved ACP routes. Before the first turn, switching the Agent preset replaces the discovery connection and its native commands. Once a turn starts, the session keeps its remote Agent and workspace; start a new session to change Agent. Native Agent binaries and authentication belong to acp-service.
|
|
40
40
|
|
|
@@ -73,6 +73,8 @@ Provider mapping is `claude → claude`, `codex → codex`, `grok → grok-build
|
|
|
73
73
|
|
|
74
74
|
Opening an ACP session initializes or restores its remote session without sending a prompt. The plugin consumes `available_commands_update`, `config_option_update`, and mode updates. Advertised slash commands with names accepted by DSH (`[a-z][a-z0-9_-]*`) are registered in that session and forwarded verbatim through `session/prompt`, including their arguments. `/model` opens the model options advertised by the remote Agent. Choosing a model or reasoning setting uses `session/set_config_option`; choosing a mode uses `session/set_mode`. Unsupported options are not invented. Configuration changes are rejected while a turn runs.
|
|
75
75
|
|
|
76
|
+
A successful choice in **ACP 设置** is remembered for that absolute workspace and that ACP agent. Grok Build and Codex keep separate records, each with the mode id and config-option ids that agent accepted. The file is `agent-session-settings.json` in `stateDirectory`, beside session bindings. A later new session replays only its own record before the first prompt: model options first, then the other options against each catalog returned by `session/set_config_option`, then the mode through `session/set_mode`. A missing id or value fails before the prompt and closes the new remote session. When the record includes a mode, that mode is used. An agent with no record still receives only `initialModeId`. A record with options and no mode still applies `initialModeId`. Continuing, loading, or importing an existing session keeps the settings already on that session. `initialModeId` and untouched session defaults are not written into the file. Choosing the same option again replaces that id. `execution_submit` does not carry these values.
|
|
77
|
+
|
|
76
78
|
The bundle disables the stock `ui-model-selection` row and supplies a session-aware model selector using DSH's existing UI slot and command contribution APIs. Ordinary sessions still select their DSH provider/model and reasoning effort; ACP sessions select only native Agent options. The Agent's additional options appear under **ACP 设置**. An idle ACP connection is retained so metadata updates and controls share the same session owner. The visible browser refreshes its capability snapshot every five seconds.
|
|
77
79
|
|
|
78
80
|
The bundle registers `oneagents-acp-*` presets with DSH's preset registry. Older filesystem presets remain untouched; DSH 0.1.7 uses registry declarations instead of scanning those files. ACP bindings are stored separately under `$DSH_HOME/plugins/1agents-acp/sessions`.
|
|
@@ -81,6 +83,8 @@ The bundle registers `oneagents-acp-*` presets with DSH's preset registry. Older
|
|
|
81
83
|
|
|
82
84
|
ACP one-shot tool permissions use DSH's approval UI and policy. Grok questions and plan approval use its question UI. Persistent grants are not synthesized. Read operations follow acp-service's `approve-reads` policy; operations requiring permission are presented to the user.
|
|
83
85
|
|
|
86
|
+
When `a2a.workbench` is configured, DSH's own tool approvals inside an A2A task (for example a `danger-full-access` escalation from `tool-bash` under the `standard` preset) become `permission` process requests on the gateway workbench. The workbench is the only place to answer them, because DSH's approval UI keeps its prompt for the request's whole lifetime and could not withdraw it after a workbench answer. Approve grants that one call, reject denies it, and an expired or closed request cancels it. If the workbench cannot be reached, DSH's approval UI answers as before. Sessions outside A2A tasks, and ACP presets (which open their own request), are unaffected.
|
|
87
|
+
|
|
84
88
|
Transport reconnects load the same service session and replay the current managed turn. Stable request IDs prevent duplicate execution, and update sequence numbers suppress duplicate output. A browser refresh leaves the Host request running. Stopping a DSH turn sends ACP cancellation. Provider errors fail the turn without automatic resubmission.
|
|
85
89
|
|
|
86
90
|
The owned ACP Adapter sanitizes provider failures before the official DSH host normalizes them. Category, provider code, retryability, outcome uncertainty, origin and request identity are persisted in the plugin's `oneagents_acp_diagnostics` domain, using official `storageDomain` and JSON storage plugins. The plugin owns their lifetime so cancellation and A2A drain before storage closes. DSH source, native `LlmFailure` and Session event schemas stay unchanged; its ordinary logs can retain only code and message. Complete diagnostics appear under A2A `metadata['1agents'].error`, with the A2A caller's operation identity. Host error properties and arbitrary in-band metadata cannot supply missing diagnostics.
|
|
@@ -97,6 +101,8 @@ This plugin supports **text prompts**. Attachments and specialized external-tool
|
|
|
97
101
|
|
|
98
102
|
The bundle's `oneagents-acp` row accepts `serviceUrl`, `serviceMode`, `serviceStartupTimeoutMs`, `serviceShutdownTimeoutMs`, `agents`, `stateDirectory`, `diagnosticsDirectory`, `reconnectAttempts` and `reconnectDelayMs`. Change it through the profile's `cordis.patch.yml`, not the DSH repository. Use a new session after changing endpoint or workspace. When `agents` is omitted, plugin startup fetches `GET /agents` from acp-service and registers presets for entries with `chat_ready: true`, using their service-provided names. Discovery runs on the service host. Restart the plugin after installing or removing a harness. An explicit `agents` list bypasses discovery and preserves manual registry selection; `[]` registers no presets. Service startup, connection errors and invalid inventory responses fail plugin initialization instead of selecting fallback agents.
|
|
99
103
|
|
|
104
|
+
Explicitly authorized unattended work can declare `sessionPolicies`, with an exact absolute `cwd`, ACP registry `agent`, and optional `initialModeId`. A policy matches only that workspace and Agent; wildcards and duplicate scopes are rejected. New sessions select the advertised native mode before sending any prompt; an unavailable mode fails without prompting. A stored ACP 设置 record for the same workspace and Agent is applied on that new session, and its mode replaces `initialModeId`. Existing sessions keep their native mode and any ACP settings already selected or imported. `permissionMode` (`approve-reads`, `approve-all`, `deny-all`) may still appear in older configs and is ignored: the bridge does not apply that three-state shield. Mode and reasoning effort come from ACP 设置 (`session/set_mode`, `session/set_config_option`) or from the native session an import resumes. For example, an authorized Codex video workspace can use `initialModeId: "agent-full-access"` without changing the host's global model or other workspaces. Remove the declaration when the authorized batch ends; existing native sessions retain their own stored mode.
|
|
105
|
+
|
|
100
106
|
Diagnostic storage defaults to `stateDirectory/diagnostics`; `diagnosticsDirectory` selects a separate explicit location. Keep this directory with the A2A state when moving a host. Its version is independent of DSH Session formats. The plugin privately mounts official storage components; it does not require a shared host storage-domain configuration. Only one plugin instance may write the directory at a time.
|
|
101
107
|
|
|
102
108
|
### Local service lifecycle
|
|
@@ -1,13 +1,56 @@
|
|
|
1
1
|
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
-
import
|
|
2
|
+
import type { SessionId } from '@deepseek-ai/dsh-session';
|
|
3
|
+
import { type A2ABackend, type A2AExecutionRef, type A2APreflightInput, type A2APrepareInput, type A2ARunResult, type A2ATarget } from '@1agents/acp-service/a2a';
|
|
3
4
|
import type { Diagnostics } from './diagnostics.js';
|
|
5
|
+
export interface SessionControl {
|
|
6
|
+
release(sessionId: string): Promise<{
|
|
7
|
+
processReleased: true | 'pending';
|
|
8
|
+
acp?: boolean;
|
|
9
|
+
}>;
|
|
10
|
+
delete?(sessionId: string): Promise<{
|
|
11
|
+
processReleased: true | 'pending';
|
|
12
|
+
acp?: boolean;
|
|
13
|
+
}>;
|
|
14
|
+
status(sessionId: string): Promise<{
|
|
15
|
+
attached: boolean;
|
|
16
|
+
activeTurn: boolean;
|
|
17
|
+
lastUsedAt?: string;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
type SessionInspection = {
|
|
21
|
+
meta: {
|
|
22
|
+
id: string;
|
|
23
|
+
cwd?: string;
|
|
24
|
+
agentPreset?: string;
|
|
25
|
+
};
|
|
26
|
+
} | null;
|
|
27
|
+
/**
|
|
28
|
+
* Read a Session's identity without resuming it; null when it does not exist.
|
|
29
|
+
* Current DSH dropped sessionController.inspect, so this observes the stored header through sessionQuery instead.
|
|
30
|
+
*/
|
|
31
|
+
export declare function inspectSession(ctx: Context, sessionId: SessionId): Promise<SessionInspection>;
|
|
4
32
|
/** Uses public session-controller and inbox events to account for one A2A prompt's exact DSH turn. */
|
|
5
33
|
export declare class DshA2ABackend implements A2ABackend {
|
|
6
34
|
private readonly ctx;
|
|
7
35
|
private readonly diagnostics?;
|
|
36
|
+
private readonly sessions?;
|
|
8
37
|
private readonly executions;
|
|
9
38
|
/** @param ctx DSH plugin context that owns session-controller and execution event registrations. */
|
|
10
|
-
constructor(ctx: Context, diagnostics?: Diagnostics | undefined);
|
|
39
|
+
constructor(ctx: Context, diagnostics?: Diagnostics | undefined, sessions?: SessionControl | undefined);
|
|
40
|
+
close(target: A2ATarget): Promise<{
|
|
41
|
+
processReleased: true | 'pending';
|
|
42
|
+
acp?: boolean;
|
|
43
|
+
}>;
|
|
44
|
+
/** Non-ACP presets only drop the A2A binding; DSH session history is never deleted. */
|
|
45
|
+
delete(target: A2ATarget): Promise<{
|
|
46
|
+
processReleased: true | 'pending';
|
|
47
|
+
acp?: boolean;
|
|
48
|
+
}>;
|
|
49
|
+
status(target: A2ATarget): Promise<{
|
|
50
|
+
attached: boolean;
|
|
51
|
+
activeTurn: boolean;
|
|
52
|
+
lastUsedAt?: string;
|
|
53
|
+
}>;
|
|
11
54
|
/** Restart reconciliation reads the plugin domain and never dispatches another prompt. */
|
|
12
55
|
recover(target: A2ATarget, options: {
|
|
13
56
|
requestId: string;
|
|
@@ -17,7 +60,13 @@ export declare class DshA2ABackend implements A2ABackend {
|
|
|
17
60
|
* @param input Remote host directory, preset, and optional existing DSH session identity.
|
|
18
61
|
* @returns The resolved DSH session and its durable workspace and preset.
|
|
19
62
|
*/
|
|
20
|
-
prepare(input: A2APrepareInput
|
|
63
|
+
prepare(input: A2APrepareInput, options?: {
|
|
64
|
+
signal: AbortSignal;
|
|
65
|
+
}): Promise<A2ATarget>;
|
|
66
|
+
/** Standard presets only. The catalog must list the exact model; a miss never falls back to the host default. */
|
|
67
|
+
private requireModel;
|
|
68
|
+
/** Install the requested model before the first prompt and return what DSH resolved. Omitted fields leave the session unchanged. */
|
|
69
|
+
private selectModel;
|
|
21
70
|
/** Admit one identified queued prompt and wait only for its own turn, independent of the HTTP connection.
|
|
22
71
|
* @param target Previously prepared DSH session.
|
|
23
72
|
* @param prompt Plain-text A2A message content.
|
|
@@ -27,7 +76,15 @@ export declare class DshA2ABackend implements A2ABackend {
|
|
|
27
76
|
run(target: A2ATarget, prompt: string, options: {
|
|
28
77
|
requestId: string;
|
|
29
78
|
signal: AbortSignal;
|
|
79
|
+
beforeStart?: (signal?: AbortSignal) => Promise<void>;
|
|
80
|
+
onCapacity?: (pending: {
|
|
81
|
+
code: 'CAPACITY_PENDING';
|
|
82
|
+
position: number;
|
|
83
|
+
waitedMs: number;
|
|
84
|
+
} | undefined) => void;
|
|
85
|
+
execution?: A2AExecutionRef;
|
|
30
86
|
}): Promise<A2ARunResult>;
|
|
31
87
|
private execute;
|
|
32
88
|
private agent;
|
|
33
89
|
}
|
|
90
|
+
export {};
|