@1agents/acp-service 0.7.0 → 0.8.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 +10 -0
- package/dist/src/a2a/executor.js +34 -9
- package/dist/src/a2a/index.d.ts +1 -0
- package/dist/src/a2a/index.js +1 -0
- package/dist/src/a2a/lease.d.ts +13 -0
- package/dist/src/a2a/lease.js +149 -0
- package/dist/src/a2a/request-id.d.ts +2 -0
- package/dist/src/a2a/request-id.js +6 -0
- package/dist/src/a2a/server.js +13 -1
- package/dist/src/a2a/store.d.ts +4 -6
- package/dist/src/a2a/store.js +14 -114
- package/dist/src/a2a/types.d.ts +9 -0
- package/dist/src/acp-connection.d.ts +2 -1
- package/dist/src/acp-connection.js +52 -9
- package/dist/src/bridge.js +38 -39
- package/package.json +15 -13
- package/vendor/dsh/README.md +12 -2
- package/vendor/dsh/a2a-executor.d.ts +7 -1
- package/vendor/dsh/a2a-executor.js +56 -15
- package/vendor/dsh/a2a.d.ts +2 -1
- package/vendor/dsh/a2a.js +9 -5
- package/vendor/dsh/adapter.d.ts +3 -1
- package/vendor/dsh/adapter.js +144 -16
- package/vendor/dsh/diagnostics.d.ts +42 -0
- package/vendor/dsh/diagnostics.js +176 -0
- package/vendor/dsh/index.d.ts +1 -0
- package/vendor/dsh/index.js +16 -4
- package/vendor/runtime/dist/{cli-DUHyAADv.js → cli-Bdzplbpj.js} +4 -4
- package/vendor/runtime/dist/{cli-DUHyAADv.js.map → cli-Bdzplbpj.js.map} +1 -1
- package/vendor/runtime/dist/cli.d.ts +1 -1
- package/vendor/runtime/dist/cli.js +8 -8
- package/vendor/runtime/dist/{client-DjkWknf7.d.ts → client-BXOiB0ND.d.ts} +2 -2
- package/vendor/runtime/dist/{client-DjkWknf7.d.ts.map → client-BXOiB0ND.d.ts.map} +1 -1
- package/vendor/runtime/dist/{flows-CiJSCy4D.js → flows-BKlAuzM8.js} +4 -4
- package/vendor/runtime/dist/{flows-CiJSCy4D.js.map → flows-BKlAuzM8.js.map} +1 -1
- package/vendor/runtime/dist/flows.d.ts +2 -2
- package/vendor/runtime/dist/flows.js +1 -1
- package/vendor/runtime/dist/{invocation-options-BlIySxIw.js → invocation-options-DMy77sEU.js} +4 -4
- package/vendor/runtime/dist/{invocation-options-BlIySxIw.js.map → invocation-options-DMy77sEU.js.map} +1 -1
- package/vendor/runtime/dist/{ipc-BlljKR2b.js → ipc-CLv2iL89.js} +260 -2
- package/vendor/runtime/dist/ipc-CLv2iL89.js.map +1 -0
- package/vendor/runtime/dist/{output-BzXQKArM.js → output-I-t-v55D.js} +3 -3
- package/vendor/runtime/dist/{output-BzXQKArM.js.map → output-I-t-v55D.js.map} +1 -1
- package/vendor/runtime/dist/{queue-owner-runtime-DSFdsS_y.js → queue-owner-runtime-RN3uSid0.js} +2 -2
- package/vendor/runtime/dist/{queue-owner-runtime-DSFdsS_y.js.map → queue-owner-runtime-RN3uSid0.js.map} +1 -1
- package/vendor/runtime/dist/runtime.d.ts +25 -15
- package/vendor/runtime/dist/runtime.d.ts.map +1 -1
- package/vendor/runtime/dist/runtime.js +57 -37
- package/vendor/runtime/dist/runtime.js.map +1 -1
- package/vendor/runtime/dist/{session-options-ORCchZGk.d.ts → session-options-DNnDfiUt.d.ts} +18 -2
- package/vendor/runtime/dist/session-options-DNnDfiUt.d.ts.map +1 -0
- package/vendor/runtime/dist/{session-watch-BiBTBMz4.js → session-watch-CmHbH0jS.js} +4 -4
- package/vendor/runtime/dist/{session-watch-BiBTBMz4.js.map → session-watch-CmHbH0jS.js.map} +1 -1
- package/vendor/runtime/dist/{watch-iYiP-lOo.js → watch-BE-kKa7o.js} +2 -2
- package/vendor/runtime/dist/{watch-iYiP-lOo.js.map → watch-BE-kKa7o.js.map} +1 -1
- package/vendor/runtime/skills/acpx/SKILL.md +1 -0
- package/vendor/runtime/dist/docs-site/.nojekyll +0 -0
- package/vendor/runtime/dist/docs-site/CLI.html +0 -832
- package/vendor/runtime/dist/docs-site/CNAME +0 -1
- package/vendor/runtime/dist/docs-site/VISION.html +0 -415
- package/vendor/runtime/dist/docs-site/agents.html +0 -391
- package/vendor/runtime/dist/docs-site/compare.html +0 -359
- package/vendor/runtime/dist/docs-site/config.html +0 -450
- package/vendor/runtime/dist/docs-site/custom-agents.html +0 -408
- package/vendor/runtime/dist/docs-site/exit-codes.html +0 -347
- package/vendor/runtime/dist/docs-site/favicon.svg +0 -21
- package/vendor/runtime/dist/docs-site/flows.html +0 -497
- package/vendor/runtime/dist/docs-site/index.html +0 -367
- package/vendor/runtime/dist/docs-site/install.html +0 -386
- package/vendor/runtime/dist/docs-site/llms.txt +0 -35
- package/vendor/runtime/dist/docs-site/output-formats.html +0 -406
- package/vendor/runtime/dist/docs-site/permissions.html +0 -413
- package/vendor/runtime/dist/docs-site/prompting.html +0 -460
- package/vendor/runtime/dist/docs-site/proof-2026-07-18-grok-ext-methods/index.html +0 -336
- package/vendor/runtime/dist/docs-site/quickstart.html +0 -382
- package/vendor/runtime/dist/docs-site/runtime-environment.html +0 -329
- package/vendor/runtime/dist/docs-site/runtime-process-lifecycle.html +0 -335
- package/vendor/runtime/dist/docs-site/session-control.html +0 -406
- package/vendor/runtime/dist/docs-site/session-watch.html +0 -354
- package/vendor/runtime/dist/docs-site/sessions.html +0 -486
- package/vendor/runtime/dist/docs-site/shared-sessions.html +0 -377
- package/vendor/runtime/dist/ipc-BlljKR2b.js.map +0 -1
- package/vendor/runtime/dist/session-options-ORCchZGk.d.ts.map +0 -1
|
@@ -1,497 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
-
<title>Flows — acpx</title>
|
|
7
|
-
<meta name="description" content="Multi-step ACP workflows in acpx — define a TypeScript flow, mix acp / action / compute / decision / checkpoint nodes, persist runs, and replay.">
|
|
8
|
-
<link rel="canonical" href="https://acpx.sh/flows.html">
|
|
9
|
-
<meta property="og:type" content="website">
|
|
10
|
-
<meta property="og:site_name" content="acpx">
|
|
11
|
-
<meta property="og:title" content="Flows — acpx">
|
|
12
|
-
<meta property="og:description" content="Multi-step ACP workflows in acpx — define a TypeScript flow, mix acp / action / compute / decision / checkpoint nodes, persist runs, and replay.">
|
|
13
|
-
<meta property="og:url" content="https://acpx.sh/flows.html">
|
|
14
|
-
<meta name="twitter:card" content="summary_large_image">
|
|
15
|
-
<meta name="twitter:title" content="Flows — acpx">
|
|
16
|
-
<meta name="twitter:description" content="Multi-step ACP workflows in acpx — define a TypeScript flow, mix acp / action / compute / decision / checkpoint nodes, persist runs, and replay.">
|
|
17
|
-
<link rel="icon" href="favicon.svg" type="image/svg+xml">
|
|
18
|
-
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
19
|
-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
20
|
-
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
|
21
|
-
<script>(function(){var s;try{s=localStorage.getItem('theme')}catch(e){}var d=window.matchMedia&&matchMedia('(prefers-color-scheme: dark)').matches;document.documentElement.dataset.theme=s||(d?'dark':'light')})();</script>
|
|
22
|
-
<style>
|
|
23
|
-
:root{
|
|
24
|
-
--ink:#0b0e14;
|
|
25
|
-
--text:#1f2530;
|
|
26
|
-
--muted:#6a7282;
|
|
27
|
-
--subtle:#9aa1ab;
|
|
28
|
-
--bg:#f7f8fa;
|
|
29
|
-
--paper:#ffffff;
|
|
30
|
-
--accent:#0ea5e9;
|
|
31
|
-
--accent-soft:rgba(14,165,233,.10);
|
|
32
|
-
--accent-strong:#0284c7;
|
|
33
|
-
--accent-2:#a855f7;
|
|
34
|
-
--accent-3:#22c55e;
|
|
35
|
-
--accent-4:#f59e0b;
|
|
36
|
-
--line:#e5e7eb;
|
|
37
|
-
--line-soft:#eef0f3;
|
|
38
|
-
--code-bg:#0a0d14;
|
|
39
|
-
--code-fg:#e6edf3;
|
|
40
|
-
--code-inline-fg:#1c2128;
|
|
41
|
-
--pill-border:#dbe2eb;
|
|
42
|
-
--shadow-card:0 4px 14px rgba(15,17,21,.08);
|
|
43
|
-
--scrollbar:#cbd5e1;
|
|
44
|
-
}
|
|
45
|
-
:root[data-theme="dark"]{
|
|
46
|
-
--ink:#f3f5f9;
|
|
47
|
-
--text:#cdd3dd;
|
|
48
|
-
--muted:#8d96a4;
|
|
49
|
-
--subtle:#5d6371;
|
|
50
|
-
--bg:#08090f;
|
|
51
|
-
--paper:#13161f;
|
|
52
|
-
--accent:#38bdf8;
|
|
53
|
-
--accent-soft:rgba(56,189,248,.18);
|
|
54
|
-
--accent-strong:#7dd3fc;
|
|
55
|
-
--line:#23283a;
|
|
56
|
-
--line-soft:#1a1d28;
|
|
57
|
-
--code-bg:#040611;
|
|
58
|
-
--code-fg:#e6edf3;
|
|
59
|
-
--code-inline-fg:#e6edf3;
|
|
60
|
-
--pill-border:#2a2f3c;
|
|
61
|
-
--shadow-card:0 4px 18px rgba(0,0,0,.45);
|
|
62
|
-
--scrollbar:#3a4154;
|
|
63
|
-
}
|
|
64
|
-
:root{color-scheme:light}
|
|
65
|
-
:root[data-theme="dark"]{color-scheme:dark}
|
|
66
|
-
*{box-sizing:border-box}
|
|
67
|
-
html{scroll-behavior:smooth;scroll-padding-top:24px}
|
|
68
|
-
body{margin:0;background:var(--bg);color:var(--text);font-family:"Inter",ui-sans-serif,system-ui,-apple-system,Segoe UI,sans-serif;line-height:1.65;overflow-x:hidden;-webkit-font-smoothing:antialiased;font-feature-settings:"cv02","cv03","cv04","cv11";transition:background-color .18s,color .18s}
|
|
69
|
-
::selection{background:var(--accent);color:#04121d}
|
|
70
|
-
a{color:var(--accent);text-decoration:none;transition:color .12s}
|
|
71
|
-
a:hover{text-decoration:underline;text-underline-offset:.2em}
|
|
72
|
-
.shell{display:grid;grid-template-columns:268px minmax(0,1fr);min-height:100vh}
|
|
73
|
-
.sidebar{position:sticky;top:0;height:100vh;overflow:auto;padding:24px 22px;background:var(--paper);border-right:1px solid var(--line);scrollbar-width:thin;scrollbar-color:var(--line) transparent;transition:background-color .18s,border-color .18s}
|
|
74
|
-
.sidebar::-webkit-scrollbar{width:6px}
|
|
75
|
-
.sidebar::-webkit-scrollbar-thumb{background:var(--line);border-radius:6px}
|
|
76
|
-
.sidebar-head{display:flex;align-items:center;gap:10px;margin-bottom:24px}
|
|
77
|
-
.brand{display:flex;align-items:center;gap:11px;color:var(--ink);text-decoration:none;flex:1;min-width:0}
|
|
78
|
-
.brand:hover{text-decoration:none}
|
|
79
|
-
.brand .mark{flex:0 0 34px;width:34px;height:34px;border-radius:8px;background:linear-gradient(145deg,#08111f 0%,#101827 58%,#172554 100%);position:relative;overflow:hidden;display:grid;place-items:center;box-shadow:0 1px 0 rgba(255,255,255,.08) inset,0 10px 24px -13px rgba(14,165,233,.7)}
|
|
80
|
-
.brand .mark::before{content:"";position:absolute;inset:0;background:linear-gradient(135deg,rgba(125,211,252,.22),transparent 42%),linear-gradient(315deg,rgba(167,139,250,.2),transparent 48%);pointer-events:none}
|
|
81
|
-
.brand .mark::after{content:"";position:absolute;inset:1px;border-radius:7px;border:1px solid rgba(255,255,255,.1);pointer-events:none}
|
|
82
|
-
.brand .mark svg{position:relative;z-index:1;width:23px;height:23px;display:block}
|
|
83
|
-
.brand .mark .cursor{transform-origin:center;animation:acpx-blink 1.2s steps(2,jump-none) infinite}
|
|
84
|
-
@keyframes acpx-blink{0%,49%{opacity:1}50%,100%{opacity:.25}}
|
|
85
|
-
@media (prefers-reduced-motion: reduce){.brand .mark .cursor{animation:none}}
|
|
86
|
-
.brand strong{display:block;font-size:1.05rem;line-height:1.1;font-weight:600;letter-spacing:0;color:var(--ink)}
|
|
87
|
-
.brand small{display:block;color:var(--muted);font-size:.74rem;margin-top:3px;font-weight:400}
|
|
88
|
-
.theme-toggle{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:34px;height:34px;border-radius:8px;border:1px solid var(--line);background:var(--paper);color:var(--muted);cursor:pointer;padding:0;transition:border-color .15s,color .15s,background-color .15s,transform .12s}
|
|
89
|
-
.theme-toggle:hover{border-color:var(--ink);color:var(--ink)}
|
|
90
|
-
.theme-toggle:active{transform:scale(.94)}
|
|
91
|
-
.theme-toggle svg{width:16px;height:16px;display:block}
|
|
92
|
-
.theme-icon-sun{display:none}
|
|
93
|
-
:root[data-theme="dark"] .theme-icon-sun{display:block}
|
|
94
|
-
:root[data-theme="dark"] .theme-icon-moon{display:none}
|
|
95
|
-
.search{display:block;margin:0 0 22px}
|
|
96
|
-
.search span{display:block;color:var(--muted);font-size:.7rem;font-weight:600;text-transform:uppercase;letter-spacing:0;margin-bottom:7px}
|
|
97
|
-
.search input{width:100%;border:1px solid var(--line);background:var(--paper);border-radius:8px;padding:9px 12px;font:inherit;font-size:.9rem;color:var(--text);outline:none;transition:border-color .15s,box-shadow .15s,background-color .18s}
|
|
98
|
-
.search input:focus{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
|
|
99
|
-
nav section{margin:0 0 18px}
|
|
100
|
-
nav h2{font-size:.68rem;color:var(--muted);text-transform:uppercase;letter-spacing:0;margin:0 0 6px;font-weight:600}
|
|
101
|
-
.nav-link{display:block;color:var(--text);text-decoration:none;border-radius:6px;padding:5px 10px;margin:1px 0;font-size:.9rem;line-height:1.4;transition:background .12s,color .12s}
|
|
102
|
-
.nav-link:hover{background:var(--line-soft);color:var(--ink);text-decoration:none}
|
|
103
|
-
.nav-link.active{background:var(--accent-soft);color:var(--accent);font-weight:600}
|
|
104
|
-
main{min-width:0;padding:32px clamp(20px,4.5vw,56px) 80px;max-width:1180px;margin:0 auto;width:100%}
|
|
105
|
-
.hero{display:flex;align-items:flex-end;justify-content:space-between;gap:22px;border-bottom:1px solid var(--line);padding:8px 0 22px;margin-bottom:8px;flex-wrap:wrap}
|
|
106
|
-
.hero-text{min-width:0;flex:1 1 320px}
|
|
107
|
-
.eyebrow{margin:0 0 8px;color:var(--muted);font-weight:600;text-transform:uppercase;letter-spacing:0;font-size:.7rem}
|
|
108
|
-
.hero h1{font-size:2.25rem;line-height:1.1;letter-spacing:-.01em;margin:0;font-weight:700;color:var(--ink)}
|
|
109
|
-
.hero-meta{display:flex;gap:8px;flex:0 0 auto;flex-wrap:wrap}
|
|
110
|
-
.repo,.edit,.btn-ghost{border:1px solid var(--line);color:var(--text);text-decoration:none;border-radius:7px;padding:6px 11px;font-weight:500;font-size:.83rem;background:var(--paper);transition:border-color .15s,color .15s,background .15s}
|
|
111
|
-
.repo:hover,.edit:hover,.btn-ghost:hover{border-color:var(--ink);color:var(--ink);text-decoration:none}
|
|
112
|
-
.edit{color:var(--muted)}
|
|
113
|
-
.home-hero{padding:14px 0 28px;margin-bottom:8px;border-bottom:1px solid var(--line)}
|
|
114
|
-
.home-hero .eyebrow{display:inline-flex;align-items:center;gap:8px}
|
|
115
|
-
.home-hero .eyebrow .dot{width:7px;height:7px;border-radius:50%;background:var(--accent-3);box-shadow:0 0 0 3px rgba(34,197,94,.2)}
|
|
116
|
-
.home-hero h1{font-size:3.25rem;line-height:1.04;letter-spacing:-.015em;margin:0 0 .35em;font-weight:700;color:var(--ink)}
|
|
117
|
-
.home-hero h1 .accent{background:linear-gradient(110deg,var(--accent) 0%,var(--accent-2) 70%);-webkit-background-clip:text;background-clip:text;color:transparent}
|
|
118
|
-
.home-hero .lede{font-size:1.18rem;line-height:1.55;color:var(--text);margin:0 0 1.2em;max-width:60ch}
|
|
119
|
-
.home-cta{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin:0 0 18px}
|
|
120
|
-
.home-cta .btn{display:inline-flex;align-items:center;gap:7px;border-radius:8px;padding:10px 16px;font-weight:600;font-size:.92rem;text-decoration:none;transition:background .15s,border-color .15s,color .15s,transform .12s}
|
|
121
|
-
.home-cta .btn-primary{background:var(--ink);color:var(--paper);border:1px solid var(--ink)}
|
|
122
|
-
.home-cta .btn-primary:hover{background:var(--accent);border-color:var(--accent);color:#04121d;text-decoration:none}
|
|
123
|
-
.home-cta .btn-ghost{padding:10px 16px}
|
|
124
|
-
.home-install{display:flex;align-items:center;gap:12px;background:var(--code-bg);color:var(--code-fg);border-radius:8px;padding:10px 10px 10px 16px;font:500 .9rem/1.2 "JetBrains Mono","SF Mono",ui-monospace,monospace;max-width:32em;border:1px solid #1f2937}
|
|
125
|
-
.home-install .prompt{color:#7dd3fc;user-select:none;flex:0 0 auto}
|
|
126
|
-
.home-install code{flex:1;background:transparent;border:0;color:var(--code-fg);font:inherit;padding:0;white-space:pre;overflow:hidden;text-overflow:ellipsis}
|
|
127
|
-
.home-install .copy{flex:0 0 auto;background:rgba(255,255,255,.08);color:var(--code-fg);border:1px solid rgba(255,255,255,.16);border-radius:6px;padding:5px 11px;font:500 .72rem/1 "Inter",sans-serif;cursor:pointer;transition:background .15s,border-color .15s}
|
|
128
|
-
.home-install .copy:hover{background:rgba(255,255,255,.16)}
|
|
129
|
-
.home-install .copy.copied{background:var(--accent);border-color:var(--accent);color:#04121d}
|
|
130
|
-
.home-services{display:flex;flex-wrap:wrap;gap:6px;margin:6px 0 18px}
|
|
131
|
-
.home-services span{display:inline-block;padding:3px 9px;border:1px solid var(--line);border-radius:999px;font-size:.78rem;color:var(--muted);background:var(--paper);font-family:"JetBrains Mono","SF Mono",ui-monospace,monospace}
|
|
132
|
-
.doc-grid{display:grid;grid-template-columns:minmax(0,1fr);gap:48px;margin-top:24px}
|
|
133
|
-
.doc-grid-home{margin-top:8px}
|
|
134
|
-
@media(min-width:1180px){.doc-grid{grid-template-columns:minmax(0,72ch) 200px;justify-content:start}.doc-grid-home{grid-template-columns:minmax(0,76ch);justify-content:start}}
|
|
135
|
-
.doc{min-width:0;max-width:72ch;overflow-wrap:break-word}
|
|
136
|
-
.doc-home{max-width:76ch}
|
|
137
|
-
.doc h1{font-size:2.6rem;line-height:1.08;letter-spacing:-.015em;margin:0 0 .4em;font-weight:700;color:var(--ink)}
|
|
138
|
-
body:not(.home) .doc>h1:first-child{display:none}
|
|
139
|
-
.doc h2{font-size:1.45rem;line-height:1.2;margin:2em 0 .5em;font-weight:600;letter-spacing:-.005em;color:var(--ink);position:relative}
|
|
140
|
-
.doc h3{font-size:1.1rem;margin:1.7em 0 .35em;position:relative;font-weight:600;color:var(--ink);letter-spacing:0}
|
|
141
|
-
.doc h4{font-size:.98rem;margin:1.4em 0 .25em;color:var(--ink);position:relative;font-weight:600}
|
|
142
|
-
.doc h2:first-child,.doc h3:first-child,.doc h4:first-child{margin-top:.2em}
|
|
143
|
-
.doc :is(h2,h3,h4) .anchor{position:absolute;left:-1.05em;top:0;color:var(--subtle);opacity:0;text-decoration:none;font-weight:400;padding-right:.3em;transition:opacity .12s,color .12s}
|
|
144
|
-
.doc :is(h2,h3,h4):hover .anchor{opacity:.7}
|
|
145
|
-
.doc :is(h2,h3,h4) .anchor:hover{opacity:1;color:var(--accent);text-decoration:none}
|
|
146
|
-
.doc p{margin:0 0 1.05em}
|
|
147
|
-
.doc ul,.doc ol{padding-left:1.3rem;margin:0 0 1.15em}
|
|
148
|
-
.doc li{margin:.25em 0}
|
|
149
|
-
.doc li>p{margin:0 0 .4em}
|
|
150
|
-
.doc strong{font-weight:600;color:var(--ink)}
|
|
151
|
-
.doc em{font-style:italic}
|
|
152
|
-
.doc code{font-family:"JetBrains Mono","SF Mono",ui-monospace,monospace;font-size:.84em;background:var(--line-soft);border:1px solid var(--line);border-radius:5px;padding:.08em .35em;color:var(--code-inline-fg)}
|
|
153
|
-
.doc pre{position:relative;overflow:auto;background:var(--code-bg);color:var(--code-fg);border-radius:8px;padding:14px 18px;margin:1.3em 0;font-size:.85em;line-height:1.6;scrollbar-width:thin;scrollbar-color:#334155 transparent;border:1px solid #1f2937}
|
|
154
|
-
.doc pre::-webkit-scrollbar{height:8px;width:8px}
|
|
155
|
-
.doc pre::-webkit-scrollbar-thumb{background:#334155;border-radius:8px}
|
|
156
|
-
.doc pre code{display:block;background:transparent;border:0;color:inherit;padding:0;font-size:1em;white-space:pre}
|
|
157
|
-
.doc pre .hl-com{color:#7a8597;font-style:italic}
|
|
158
|
-
.doc pre .hl-str{color:#86efac}
|
|
159
|
-
.doc pre .hl-num{color:#fbbf24}
|
|
160
|
-
.doc pre .hl-kw{color:#c4b5fd;font-weight:500}
|
|
161
|
-
.doc pre .hl-lit{color:#f0abfc}
|
|
162
|
-
.doc pre .hl-flag{color:#7dd3fc}
|
|
163
|
-
.doc pre .hl-var{color:#fca5a5}
|
|
164
|
-
.doc pre .hl-prop{color:#7dd3fc}
|
|
165
|
-
.doc pre .hl-op{color:#94a3b8}
|
|
166
|
-
.doc pre .hl-typ{color:#fde68a}
|
|
167
|
-
.doc pre .copy{position:absolute;top:8px;right:8px;background:rgba(255,255,255,.06);color:var(--code-fg);border:1px solid rgba(255,255,255,.16);border-radius:6px;padding:3px 9px;font:500 .7rem/1 "Inter",sans-serif;cursor:pointer;opacity:0;transition:opacity .15s,background .15s,border-color .15s}
|
|
168
|
-
.doc pre:hover .copy,.doc pre .copy:focus{opacity:1}
|
|
169
|
-
.doc pre .copy:hover{background:rgba(255,255,255,.12)}
|
|
170
|
-
.doc pre .copy.copied{background:var(--accent);border-color:var(--accent);color:#04121d;opacity:1}
|
|
171
|
-
.doc blockquote{margin:1.4em 0;padding:10px 16px;border-left:3px solid var(--accent);background:var(--accent-soft);border-radius:0 8px 8px 0;color:var(--text)}
|
|
172
|
-
.doc blockquote p:last-child{margin-bottom:0}
|
|
173
|
-
.doc table{width:100%;border-collapse:collapse;margin:1.2em 0;font-size:.92em}
|
|
174
|
-
.doc th,.doc td{border-bottom:1px solid var(--line);padding:9px 10px;text-align:left;vertical-align:top}
|
|
175
|
-
.doc th{font-weight:600;color:var(--ink);background:var(--line-soft);border-bottom:1px solid var(--line)}
|
|
176
|
-
.doc hr{border:0;border-top:1px solid var(--line);margin:2.2em 0}
|
|
177
|
-
.toc{position:sticky;top:24px;align-self:start;font-size:.84rem;padding-left:14px;border-left:1px solid var(--line);max-height:calc(100vh - 48px);overflow:auto;scrollbar-width:thin;scrollbar-color:var(--line) transparent}
|
|
178
|
-
.toc::-webkit-scrollbar{width:5px}
|
|
179
|
-
.toc::-webkit-scrollbar-thumb{background:var(--line);border-radius:5px}
|
|
180
|
-
.toc h2{font-size:.66rem;color:var(--muted);text-transform:uppercase;letter-spacing:0;margin:0 0 10px;font-weight:600}
|
|
181
|
-
.toc a{display:block;color:var(--muted);text-decoration:none;padding:4px 0 4px 10px;line-height:1.35;border-left:2px solid transparent;margin-left:-12px;transition:color .12s,border-color .12s}
|
|
182
|
-
.toc a:hover{color:var(--ink);text-decoration:none}
|
|
183
|
-
.toc a.active{color:var(--accent);border-left-color:var(--accent);font-weight:500}
|
|
184
|
-
.toc-l3{padding-left:22px!important;font-size:.94em}
|
|
185
|
-
@media(max-width:1179px){.toc{display:none}}
|
|
186
|
-
.page-nav{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-top:48px;border-top:1px solid var(--line);padding-top:20px}
|
|
187
|
-
.page-nav>a{display:block;border:1px solid var(--line);background:var(--paper);border-radius:9px;padding:13px 16px;text-decoration:none;color:var(--text);transition:border-color .15s,transform .15s,box-shadow .15s,background-color .18s}
|
|
188
|
-
.page-nav>a:hover{border-color:var(--accent);text-decoration:none;color:var(--ink)}
|
|
189
|
-
.page-nav small{display:block;color:var(--muted);font-size:.7rem;text-transform:uppercase;letter-spacing:0;margin-bottom:5px;font-weight:600}
|
|
190
|
-
.page-nav span{display:block;font-weight:600;line-height:1.3;color:var(--ink)}
|
|
191
|
-
.page-nav-prev{text-align:left}
|
|
192
|
-
.page-nav-next{text-align:right;grid-column:2}
|
|
193
|
-
.page-nav-prev:only-child{grid-column:1}
|
|
194
|
-
.nav-toggle{display:none;position:fixed;top:14px;right:14px;top:calc(14px + env(safe-area-inset-top, 0px));right:calc(14px + env(safe-area-inset-right, 0px));z-index:20;width:40px;height:40px;border-radius:9px;background:var(--paper);border:1px solid var(--line);color:var(--ink);cursor:pointer;padding:10px 9px;flex-direction:column;align-items:stretch;justify-content:space-between;box-shadow:var(--shadow-card)}
|
|
195
|
-
.nav-toggle span{display:block;width:100%;height:2px;flex:0 0 2px;background:currentColor;border-radius:2px;transition:transform .2s,opacity .2s}
|
|
196
|
-
.nav-toggle[aria-expanded="true"] span:nth-child(1){transform:translateY(8px) rotate(45deg)}
|
|
197
|
-
.nav-toggle[aria-expanded="true"] span:nth-child(2){opacity:0}
|
|
198
|
-
.nav-toggle[aria-expanded="true"] span:nth-child(3){transform:translateY(-8px) rotate(-45deg)}
|
|
199
|
-
@media(max-width:900px){
|
|
200
|
-
.shell{display:block}
|
|
201
|
-
.sidebar{position:fixed;inset:0 30% 0 0;max-width:320px;height:100vh;z-index:15;transform:translateX(-100%);transition:transform .25s ease,background-color .18s,border-color .18s;box-shadow:0 18px 40px rgba(0,0,0,.18);background:var(--paper);pointer-events:none}
|
|
202
|
-
.sidebar.open{transform:translateX(0);pointer-events:auto}
|
|
203
|
-
.nav-toggle{display:flex}
|
|
204
|
-
main{padding:64px 18px 56px}
|
|
205
|
-
.hero{padding-top:6px}
|
|
206
|
-
.hero h1{font-size:1.8rem}
|
|
207
|
-
.home-hero h1{font-size:2.45rem}
|
|
208
|
-
.doc h1{font-size:2.1rem}
|
|
209
|
-
.hero-meta{width:100%;justify-content:flex-start}
|
|
210
|
-
.home-hero{padding-top:8px}
|
|
211
|
-
.doc{padding:0}
|
|
212
|
-
.doc-grid{margin-top:18px;gap:24px}
|
|
213
|
-
.doc :is(h2,h3,h4) .anchor{display:none}
|
|
214
|
-
}
|
|
215
|
-
@media(max-width:520px){
|
|
216
|
-
main{padding:60px 14px 48px}
|
|
217
|
-
.doc pre{margin-left:-14px;margin-right:-14px;border-radius:0;border-left:0;border-right:0}
|
|
218
|
-
.home-install{flex-wrap:wrap}
|
|
219
|
-
}
|
|
220
|
-
</style>
|
|
221
|
-
</head>
|
|
222
|
-
<body>
|
|
223
|
-
<button class="nav-toggle" type="button" aria-label="Toggle navigation" aria-expanded="false">
|
|
224
|
-
<span aria-hidden="true"></span><span aria-hidden="true"></span><span aria-hidden="true"></span>
|
|
225
|
-
</button>
|
|
226
|
-
<div class="shell">
|
|
227
|
-
<aside class="sidebar">
|
|
228
|
-
<div class="sidebar-head">
|
|
229
|
-
<a class="brand" href="./" aria-label="acpx docs home">
|
|
230
|
-
<span class="mark" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4.8 6.8 10 12l-5.2 5.2" stroke="#7dd3fc" stroke-width="2.7" stroke-linecap="round" stroke-linejoin="round"/><path d="M13.2 7.2h2.9c1.7 0 3.1 1.4 3.1 3.1v.5c0 1.7-1.4 3.1-3.1 3.1h-1.4c-1.7 0-3.1 1.4-3.1 3.1v.5" stroke="#a78bfa" stroke-width="1.8" stroke-linecap="round"/><circle cx="13.2" cy="7.2" r="1.6" fill="#7dd3fc"/><circle cx="19.2" cy="12" r="1.6" fill="#a78bfa"/><rect class="cursor" x="13.2" y="16.2" width="6.6" height="2.5" rx="1.25" fill="#e0e7ff"/></svg></span>
|
|
231
|
-
<span><strong>acpx</strong><small>ACP CLI docs</small></span>
|
|
232
|
-
</a>
|
|
233
|
-
<button class="theme-toggle" type="button" aria-label="Toggle dark mode" aria-pressed="false" data-theme-toggle>
|
|
234
|
-
<svg class="theme-icon-moon" viewBox="0 0 20 20" aria-hidden="true"><path d="M14.6 12.1A6.5 6.5 0 0 1 7.4 2.7a6.5 6.5 0 1 0 7.2 9.4z" fill="currentColor"/></svg>
|
|
235
|
-
<svg class="theme-icon-sun" viewBox="0 0 20 20" aria-hidden="true"><circle cx="10" cy="10" r="3.4" fill="currentColor"/><g stroke="currentColor" stroke-width="1.6" stroke-linecap="round"><line x1="10" y1="2" x2="10" y2="4"/><line x1="10" y1="16" x2="10" y2="18"/><line x1="2" y1="10" x2="4" y2="10"/><line x1="16" y1="10" x2="18" y2="10"/><line x1="4.2" y1="4.2" x2="5.6" y2="5.6"/><line x1="14.4" y1="14.4" x2="15.8" y2="15.8"/><line x1="4.2" y1="15.8" x2="5.6" y2="14.4"/><line x1="14.4" y1="5.6" x2="15.8" y2="4.2"/></g></svg>
|
|
236
|
-
</button>
|
|
237
|
-
</div>
|
|
238
|
-
<label class="search"><span>Search</span><input id="doc-search" type="search" placeholder="sessions, flows, json…"></label>
|
|
239
|
-
<nav><section><h2>Start</h2><a class="nav-link" href="./">Overview</a><a class="nav-link" href="install.html">Install</a><a class="nav-link" href="quickstart.html">Quickstart</a></section><section><h2>Agents</h2><a class="nav-link" href="agents.html">Agents</a><a class="nav-link" href="custom-agents.html">Custom agents</a></section><section><h2>Sessions</h2><a class="nav-link" href="sessions.html">Sessions</a><a class="nav-link" href="prompting.html">Prompting</a><a class="nav-link" href="session-control.html">Session control</a></section><section><h2>Output & Policy</h2><a class="nav-link" href="output-formats.html">Output formats</a><a class="nav-link" href="permissions.html">Permissions</a><a class="nav-link" href="config.html">Config</a></section><section><h2>Flows</h2><a class="nav-link active" href="flows.html">Flows</a></section><section><h2>Reference</h2><a class="nav-link" href="CLI.html">CLI Reference</a><a class="nav-link" href="exit-codes.html">Exit codes</a><a class="nav-link" href="VISION.html">Vision</a></section></nav>
|
|
240
|
-
</aside>
|
|
241
|
-
<main>
|
|
242
|
-
<header class="hero">
|
|
243
|
-
<div class="hero-text">
|
|
244
|
-
<p class="eyebrow">Flows</p>
|
|
245
|
-
<h1>Flows</h1>
|
|
246
|
-
</div>
|
|
247
|
-
<div class="hero-meta">
|
|
248
|
-
<a class="repo" href="https://github.com/openclaw/acpx" rel="noopener">GitHub</a>
|
|
249
|
-
<a class="edit" href="https://github.com/openclaw/acpx/edit/main/docs/flows.md" rel="noopener">Edit page</a>
|
|
250
|
-
</div>
|
|
251
|
-
</header>
|
|
252
|
-
<div class="doc-grid">
|
|
253
|
-
<article class="doc"><p>Flows are how <code>acpx</code> runs multi-step ACP work without turning one giant prompt into the workflow engine. They are TypeScript modules that the <code>acpx/flows</code> runtime executes step by step, persisting state under <code>~/.acpx/flows/runs/</code>.</p>
|
|
254
|
-
<blockquote><p>Flows are an experimental, opt-in surface. The authoring API is in <code>acpx/flows</code>; flows do not change how persistent sessions or <code>prompt</code> / <code>exec</code> work.</p></blockquote>
|
|
255
|
-
<h2 id="when-to-use-flows"><a class="anchor" href="#when-to-use-flows" aria-label="Anchor link">#</a>When to use flows</h2>
|
|
256
|
-
<p>Reach for a flow when one prompt is not enough — typically because:</p>
|
|
257
|
-
<ul>
|
|
258
|
-
<li>you need a deterministic branch (classify, then route)</li>
|
|
259
|
-
<li>one ACP turn should not also run shell commands or call the GitHub API</li>
|
|
260
|
-
<li>you want each step to be inspectable and replayable</li>
|
|
261
|
-
<li>the workflow is the same across runs, but the input changes</li>
|
|
262
|
-
</ul>
|
|
263
|
-
<p>For one-off asks, <code>acpx codex 'do the thing'</code> is the right tool. For "run this 6-step PR triage on every PR matching a query," a flow is the right tool.</p>
|
|
264
|
-
<h2 id="run-a-flow"><a class="anchor" href="#run-a-flow" aria-label="Anchor link">#</a>Run a flow</h2>
|
|
265
|
-
<pre><code class="language-bash">acpx flow run ./my-flow.ts
|
|
266
|
-
acpx flow run ./my-flow.ts <span class="hl-flag">--input-file</span> ./flow-input.json
|
|
267
|
-
acpx flow run ./my-flow.ts <span class="hl-flag">--input-json</span> <span class="hl-str">'{"task":"FIX: …"}'</span>
|
|
268
|
-
acpx flow run ./my-flow.ts <span class="hl-flag">--default-agent</span> claude
|
|
269
|
-
acpx <span class="hl-flag">--timeout</span> <span class="hl-num">1800</span> flow run ./my-flow.ts</code></pre>
|
|
270
|
-
<p>What happens:</p>
|
|
271
|
-
<ul>
|
|
272
|
-
<li>The runtime loads the flow module from disk.</li>
|
|
273
|
-
<li>A run id is generated and a run directory is created at <code>~/.acpx/flows/runs/<runId>/</code>.</li>
|
|
274
|
-
<li>Steps execute in topological order. ACP steps reuse one implicit main session by default.</li>
|
|
275
|
-
<li>Run state (graph, ACP transcripts, artifacts, errors) is persisted as the run progresses.</li>
|
|
276
|
-
<li>The runtime exits when the graph terminates or a checkpoint pauses.</li>
|
|
277
|
-
</ul>
|
|
278
|
-
<p>On POSIX systems, run snapshots, projections, artifacts, and event logs use owner-only file permissions (<code>0600</code>); acpx-owned run directories use <code>0700</code>. Existing custom output-root directories keep their permissions. Snapshot writes publish complete files atomically and clean up failed staging writes. Event logs remain append-only and retain their existing ordering and size behavior.</p>
|
|
279
|
-
<p><code>--input-json</code> and <code>--input-file</code> are mutually exclusive ways to provide flow input. <code>--default-agent</code> supplies the default agent profile for <code>acp</code> nodes that do not pin one.</p>
|
|
280
|
-
<p>The CLI resolves <code>acpx/flows</code> in the entry module and its imported helpers without rewriting source text or creating files beside the flow. Flows can run from read-only directories. Global <code>--system-prompt</code> and <code>--append-system-prompt</code> flags are forwarded to every ACP node, including isolated sessions.</p>
|
|
281
|
-
<h2 id="parsing-json-output"><a class="anchor" href="#parsing-json-output" aria-label="Anchor link">#</a>Parsing JSON output</h2>
|
|
282
|
-
<p><code>extractJsonObject(text)</code> and <code>parseJsonObject(text, { mode: "compat" })</code> try direct JSON, then a fenced JSON block, then balanced objects or arrays embedded in prose. Compatibility recovery parses candidates as it finds them and bounds the total scanning and parsing work relative to the input length. Large output or many separate malformed candidates do not by themselves prevent extraction.</p>
|
|
283
|
-
<p>Repeatedly malformed or ambiguous prefixes can exhaust that recovery budget, including unmatched opening delimiters before a valid object. In that case the helper throws the usual <code>Could not parse JSON</code> error. Prefer direct or fenced JSON when recovery must not depend on surrounding prose; those parsing paths are unaffected by the compatibility recovery budget. Use <code>parseStrictJsonObject(text)</code> to require direct JSON, or <code>mode: "fenced"</code> to accept direct JSON and fenced blocks without embedded recovery.</p>
|
|
284
|
-
<h2 id="node-types"><a class="anchor" href="#node-types" aria-label="Anchor link">#</a>Node types</h2>
|
|
285
|
-
<p>Flows are graphs. Each node is one of:</p>
|
|
286
|
-
<table><thead><tr><th>Node</th><th>Purpose</th></tr></thead><tbody><tr><td><code>acp</code></td><td>A model-shaped step — runs an ACP turn against an agent session.</td></tr><tr><td><code>action</code></td><td>A deterministic runtime-owned step — typically a shell command or HTTP call.</td></tr><tr><td><code>compute</code></td><td>A pure local function — shape inputs, route, format, derive values.</td></tr><tr><td><code>decision</code></td><td>A constrained-choice ACP branch — wraps <code>acp</code> + <code>parse</code> + <code>switch</code> for typed routing.</td></tr><tr><td><code>checkpoint</code></td><td>A pause point that requires something outside the runtime (human review, external trigger).</td></tr></tbody></table>
|
|
287
|
-
<p>Edges connect nodes. <code>decisionEdge()</code> produces typed edges out of a <code>decision()</code> node so the routing is explicit and replayable.</p>
|
|
288
|
-
<p>The runtime owns:</p>
|
|
289
|
-
<ul>
|
|
290
|
-
<li>graph execution and step ordering</li>
|
|
291
|
-
<li>liveness and timeouts</li>
|
|
292
|
-
<li>ACP session lifecycle</li>
|
|
293
|
-
<li>persistence and replay</li>
|
|
294
|
-
<li>routing through <code>decision</code> outcomes</li>
|
|
295
|
-
</ul>
|
|
296
|
-
<p>The agent owns reasoning, summarization, and tool calls inside <code>acp</code> and <code>decision</code> nodes. The flow file does not implement the workflow engine — it declares it.</p>
|
|
297
|
-
<h2 id="authoring-surface"><a class="anchor" href="#authoring-surface" aria-label="Anchor link">#</a>Authoring surface</h2>
|
|
298
|
-
<p>Node IDs and raw switch case keys are exact own string entries, including empty strings and names such as <code>__proto__</code>. Use a computed property such as <code>["__proto__"]</code> when declaring that key in JavaScript. Inherited properties do not declare nodes, cases, or edge routing fields.</p>
|
|
299
|
-
<p>Define a flow with <code>defineFlow</code> from <code>acpx/flows</code>:</p>
|
|
300
|
-
<pre><code class="language-ts"><span class="hl-kw">import</span> { acp, decision, decisionEdge, defineFlow } <span class="hl-kw">from</span> <span class="hl-str">"acpx/flows"</span>;
|
|
301
|
-
|
|
302
|
-
<span class="hl-kw">type</span> <span class="hl-typ">TriageInput</span> = {
|
|
303
|
-
task: string;
|
|
304
|
-
};
|
|
305
|
-
|
|
306
|
-
<span class="hl-kw">const</span> classifyChoices = [<span class="hl-str">"bug"</span>, <span class="hl-str">"feat"</span>, <span class="hl-str">"doc"</span>] <span class="hl-kw">as</span> <span class="hl-kw">const</span>;
|
|
307
|
-
|
|
308
|
-
<span class="hl-kw">export</span> <span class="hl-kw">default</span> defineFlow({
|
|
309
|
-
name: <span class="hl-str">"triage"</span>,
|
|
310
|
-
startAt: <span class="hl-str">"classify"</span>,
|
|
311
|
-
nodes: {
|
|
312
|
-
classify: decision({
|
|
313
|
-
question: ({ input }) => <span class="hl-str">`Classify: ${(input as TriageInput).task}`</span>,
|
|
314
|
-
choices: classifyChoices,
|
|
315
|
-
}),
|
|
316
|
-
fix: acp({
|
|
317
|
-
prompt: ({ input }) => <span class="hl-str">`Implement and verify: ${(input as TriageInput).task}`</span>,
|
|
318
|
-
}),
|
|
319
|
-
write_doc: acp({
|
|
320
|
-
prompt: ({ input }) => <span class="hl-str">`Draft docs entry for: ${(input as TriageInput).task}`</span>,
|
|
321
|
-
}),
|
|
322
|
-
},
|
|
323
|
-
edges: [
|
|
324
|
-
decisionEdge({
|
|
325
|
-
<span class="hl-kw">from</span>: <span class="hl-str">"classify"</span>,
|
|
326
|
-
choices: classifyChoices,
|
|
327
|
-
cases: {
|
|
328
|
-
bug: <span class="hl-str">"fix"</span>,
|
|
329
|
-
feat: <span class="hl-str">"fix"</span>,
|
|
330
|
-
doc: <span class="hl-str">"write_doc"</span>,
|
|
331
|
-
},
|
|
332
|
-
}),
|
|
333
|
-
],
|
|
334
|
-
});</code></pre>
|
|
335
|
-
<p>This flow expects input such as <code>{"task":"Fix the reconnect bug"}</code>. Callbacks receive it through <code>input</code>; the TypeScript assertion does not validate it at runtime. See <code>examples/flows/branch.flow.ts</code> for another small <code>decision()</code> example.</p>
|
|
336
|
-
<h2 id="workspace-isolation"><a class="anchor" href="#workspace-isolation" aria-label="Anchor link">#</a>Workspace isolation</h2>
|
|
337
|
-
<p><code>acp</code> nodes can set a per-step working directory from an earlier node's output:</p>
|
|
338
|
-
<pre><code class="language-ts">acp({
|
|
339
|
-
cwd: ({ outputs }) => (outputs.prepare_workspace <span class="hl-kw">as</span> { workdir: string }).workdir,
|
|
340
|
-
prompt: ({ input }) => <span class="hl-str">`Run inside the prepared workspace: ${(input as { task: string }).task}`</span>,
|
|
341
|
-
});</code></pre>
|
|
342
|
-
<p>This fragment assumes an earlier <code>prepare_workspace</code> node returns <code>{ workdir: string }</code> and an edge connects it to this ACP node. A <code>cwd</code> string is a literal path; use a callback to read prior outputs. <code>examples/flows/workdir.flow.ts</code> shows a shell action creating a temporary directory and an ACP node using it.</p>
|
|
343
|
-
<p>Persistent ACP steps reuse a session when their resolved command, explicit argument vector (when supplied), working directory, and session handle match. Different profile names may share a session when those values match. Argument boundaries and empty arguments are significant. Each step snapshots its resolved arguments, so a custom resolver reusing an array cannot change earlier step metadata.</p>
|
|
344
|
-
<h2 id="permissions"><a class="anchor" href="#permissions" aria-label="Anchor link">#</a>Permissions</h2>
|
|
345
|
-
<p>Flows can declare an explicit permission requirement. If a flow needs <code>approve-all</code> and you forget the flag, <code>acpx</code> fails fast before the first step runs and prints the flag to add:</p>
|
|
346
|
-
<pre><code class="language-bash">acpx flow run examples/flows/pr-triage/pr-triage.flow.ts \
|
|
347
|
-
<span class="hl-flag">--input-json</span> <span class="hl-str">'{"repo":"openclaw/acpx","prNumber":150}'</span>
|
|
348
|
-
<span class="hl-com"># error: this flow requires --approve-all</span></code></pre>
|
|
349
|
-
<pre><code class="language-bash"><span class="hl-com"># correct</span>
|
|
350
|
-
acpx <span class="hl-flag">--approve-all</span> flow run examples/flows/pr-triage/pr-triage.flow.ts \
|
|
351
|
-
<span class="hl-flag">--input-json</span> <span class="hl-str">'{"repo":"openclaw/acpx","prNumber":150}'</span></code></pre>
|
|
352
|
-
<p>This is a guardrail for flows that make real changes — the PR-triage example can comment on or close GitHub PRs against a live repo.</p>
|
|
353
|
-
<h2 id="run-persistence"><a class="anchor" href="#run-persistence" aria-label="Anchor link">#</a>Run persistence</h2>
|
|
354
|
-
<p>Each run produces a bundle under <code>~/.acpx/flows/runs/<runId>/</code>:</p>
|
|
355
|
-
<ul>
|
|
356
|
-
<li>step-by-step graph state with inputs and outputs</li>
|
|
357
|
-
<li>ACP transcripts for every <code>acp</code> and <code>decision</code> step</li>
|
|
358
|
-
<li>artifacts written by <code>action</code> steps (when the step opts in)</li>
|
|
359
|
-
<li>final result or error</li>
|
|
360
|
-
</ul>
|
|
361
|
-
<p>Bundles are immutable once a run terminates. They are the input for the <a href="#replay-viewer">replay viewer</a>.</p>
|
|
362
|
-
<p>When an ACP prompt settles, its pending capture writes finish before the step result is recorded. Capture failures fail the step; if the agent also fails, its original prompt error remains visible and is saved with the run. Admitted heartbeat and session-bundle writes also finish before the next step or terminal snapshot is published. Concurrent runs on one runner keep their pending ACP clients separate.</p>
|
|
363
|
-
<h2 id="timeouts"><a class="anchor" href="#timeouts" aria-label="Anchor link">#</a>Timeouts</h2>
|
|
364
|
-
<p>Every node uses the global <code>--timeout</code> value as its default per-step timeout. If <code>--timeout</code> is not set, flows default to <strong>15 minutes per active step</strong>. Override per step in the flow definition when needed. One deadline covers preparation, execution, parsing, and admitted runtime writes.</p>
|
|
365
|
-
<p>Callbacks receive <code>context.signal</code>, which aborts on timeout or interruption. After cancellation, the runtime denies new adapter launches, ACP requests, and managed shell commands, and waits for already owned work and cleanup before recording the outcome. Persistent ACP reconnection loads the same backend session; a failed load fails the step without creating a replacement session.</p>
|
|
366
|
-
<p>Function actions also receive <code>context.runShell</code> for native commands:</p>
|
|
367
|
-
<pre><code class="language-ts">action({
|
|
368
|
-
run: <span class="hl-kw">async</span> (context) => {
|
|
369
|
-
<span class="hl-kw">const</span> result = <span class="hl-kw">await</span> context.runShell!({
|
|
370
|
-
command: <span class="hl-str">"git"</span>,
|
|
371
|
-
args: [<span class="hl-str">"status"</span>, <span class="hl-str">"--short"</span>],
|
|
372
|
-
timeoutMs: 30_000,
|
|
373
|
-
});
|
|
374
|
-
<span class="hl-kw">return</span> { changedFiles: result.stdout, exitCode: result.exitCode, timedOut: result.timedOut };
|
|
375
|
-
},
|
|
376
|
-
});</code></pre>
|
|
377
|
-
<p><code>runShell</code> waits for complete stdout and stderr, returns ordinary nonzero exits as results, and returns <code>timedOut: true</code> with partial output when its own deadline expires. Cancellation of the enclosing node rejects instead, after process cleanup; catching that error cannot authorize another managed command. The fields are optional on the shared <code>FlowNodeContext</code> type for compatibility with manually constructed contexts, but <code>FlowRunner</code> supplies the signal to every node and <code>runShell</code> to function actions.</p>
|
|
378
|
-
<p>Arbitrary callback JavaScript cannot be forcibly stopped. Check <code>context.signal</code> before starting your own side effects and after awaits, or use <code>runShell</code> for owned native commands. The runner does not wait forever for an uncooperative callback and does not roll back completed external effects. The PR-triage example uses these boundaries for its commands and file writes.</p>
|
|
379
|
-
<p>A shell action's <code>timeoutMs: 0</code> disables its own deadline; an enclosing node deadline still applies. Node and command deadlines must be finite and no greater than 2,147,483,647 milliseconds. Invalid command deadlines or non-string <code>stdin</code> values are rejected before spawning. On expiry or interruption, acpx cancels active shell commands and waits for termination and output-stream cleanup before reporting cancellation. Cleanup failures are reported instead of silently claiming cleanup succeeded. An executor that resolves after its node has timed out or been interrupted cannot launch a new shell process.</p>
|
|
380
|
-
<p>A shell node drains its wrapper's final stdout and stderr after exit, waiting for pipe closure for up to 100 milliseconds. Inherited pipes from a surviving descendant do not keep a completed flow's host alive beyond that drain window. While other work keeps the host running, these pipes continue draining without extending the completed result.</p>
|
|
381
|
-
<p>Set <code>maxBufferBytes</code> on the object returned by <code>shell().exec</code> to limit captured stdout and stderr independently. The value is a non-negative safe integer counting UTF-8 bytes; omission preserves unlimited capture, and zero permits empty output only. Overflow fails the action even with <code>allowNonZeroExit</code>, stops retaining output, and waits for the existing process-tree cleanup before returning the error. A timeout or cancellation already in progress keeps its original result.</p>
|
|
382
|
-
<p>On POSIX, cleanup covers the owned process group and descendants discoverable before it is signalled, including descendants that move to another process group while their wrapper is active. Successful command completion still follows the wrapper's exit. A child that deliberately starts a separate session with independent stdio and is reparented before cancellation can outlive the flow, as before; acpx does not provide persistent supervision of escaped daemons.</p>
|
|
383
|
-
<h2 id="replay-viewer"><a class="anchor" href="#replay-viewer" aria-label="Anchor link">#</a>Replay viewer</h2>
|
|
384
|
-
<p><code>examples/flows/replay-viewer/</code> is a browser app that visualizes saved run bundles:</p>
|
|
385
|
-
<ul>
|
|
386
|
-
<li>React Flow graph with per-node status</li>
|
|
387
|
-
<li>recent-runs picker (live over WebSocket — in-progress runs update without refresh)</li>
|
|
388
|
-
<li>ACP session inspection per step</li>
|
|
389
|
-
<li>rewind/scrub through the run timeline</li>
|
|
390
|
-
</ul>
|
|
391
|
-
<p>Run from the repo root:</p>
|
|
392
|
-
<pre><code class="language-bash">pnpm viewer</code></pre>
|
|
393
|
-
<p>The viewer is read-only. It opens a saved bundle and lets you inspect what happened; it does not re-run the flow.</p>
|
|
394
|
-
<p>Malformed HTTP or WebSocket input is rejected without stopping the viewer. Corrupt bundle metadata is skipped, and transient read failures do not prevent subsequent live updates. Opening or reconnecting another viewer preserves updates for clients that are already subscribed.</p>
|
|
395
|
-
<p>If polling overlaps an atomic replacement of a live projection, the recent-runs list and selected run retain their last readable state until polling succeeds. A missing optional live projection still falls back to the saved run projection.</p>
|
|
396
|
-
<h2 id="example-flows-in-the-source-tree"><a class="anchor" href="#example-flows-in-the-source-tree" aria-label="Anchor link">#</a>Example flows in the source tree</h2>
|
|
397
|
-
<p>Under <code>examples/flows/</code>:</p>
|
|
398
|
-
<ul>
|
|
399
|
-
<li><code>echo.flow.ts</code> — minimal one-step ACP flow that returns a JSON reply</li>
|
|
400
|
-
<li><code>branch.flow.ts</code> — <code>decision()</code> + <code>decisionEdge()</code> constrained-choice classification, then a deterministic branch</li>
|
|
401
|
-
<li><code>shell.flow.ts</code> — one runtime-owned shell <code>action</code> returning structured JSON</li>
|
|
402
|
-
<li><code>workdir.flow.ts</code> — <code>action</code> prepares a temporary workspace, <code>acp</code> runs inside that cwd</li>
|
|
403
|
-
<li><code>two-turn.flow.ts</code> — same-session ACP example that uses tools across multiple steps</li>
|
|
404
|
-
<li><code>pr-triage/pr-triage.flow.ts</code> — larger end-to-end example with a written spec; can comment on or close real GitHub PRs against a live repo</li>
|
|
405
|
-
</ul>
|
|
406
|
-
<p>The PR-triage example declares an explicit <code>approve-all</code> requirement, so it must be run with <code>--approve-all</code>.</p>
|
|
407
|
-
<h2 id="practical-examples"><a class="anchor" href="#practical-examples" aria-label="Anchor link">#</a>Practical examples</h2>
|
|
408
|
-
<pre><code class="language-bash"><span class="hl-com"># Smallest possible run</span>
|
|
409
|
-
acpx flow run examples/flows/echo.flow.ts \
|
|
410
|
-
<span class="hl-flag">--input-json</span> <span class="hl-str">'{"request":"Summarize this repo in one sentence."}'</span>
|
|
411
|
-
|
|
412
|
-
<span class="hl-com"># decision()/decisionEdge() routing</span>
|
|
413
|
-
acpx flow run examples/flows/branch.flow.ts \
|
|
414
|
-
<span class="hl-flag">--input-json</span> <span class="hl-str">'{"task":"FIX: add a regression test for the reconnect bug"}'</span>
|
|
415
|
-
|
|
416
|
-
<span class="hl-com"># Runtime-owned shell action</span>
|
|
417
|
-
acpx flow run examples/flows/shell.flow.ts \
|
|
418
|
-
<span class="hl-flag">--input-json</span> <span class="hl-str">'{"text":"hello from shell"}'</span>
|
|
419
|
-
|
|
420
|
-
<span class="hl-com"># Multi-turn same-session work</span>
|
|
421
|
-
acpx flow run examples/flows/two-turn.flow.ts \
|
|
422
|
-
<span class="hl-flag">--input-json</span> <span class="hl-str">'{"topic":"How should we validate a new ACP adapter?"}'</span>
|
|
423
|
-
|
|
424
|
-
<span class="hl-com"># Live PR triage (declares approve-all)</span>
|
|
425
|
-
acpx <span class="hl-flag">--approve-all</span> flow run examples/flows/pr-triage/pr-triage.flow.ts \
|
|
426
|
-
<span class="hl-flag">--input-json</span> <span class="hl-str">'{"repo":"openclaw/acpx","prNumber":150}'</span></code></pre>
|
|
427
|
-
<h2 id="see-also"><a class="anchor" href="#see-also" aria-label="Anchor link">#</a>See also</h2>
|
|
428
|
-
<ul>
|
|
429
|
-
<li><a href="https://github.com/openclaw/acpx/blob/main/docs/2026-03-25-acpx-flows-architecture.md">Architecture: acpx flows</a> — full design doc.</li>
|
|
430
|
-
<li><a href="https://github.com/openclaw/acpx/blob/main/docs/2026-03-26-acpx-flow-trace-replay.md">Flow trace replay</a> — replay format spec.</li>
|
|
431
|
-
<li><a href="https://github.com/openclaw/acpx/blob/main/docs/2026-03-28-acpx-flow-permission-requirements.md">Flow permission requirements</a> — fail-fast permission gating.</li>
|
|
432
|
-
<li><a href="https://github.com/openclaw/acpx/tree/main/examples/flows"><code>examples/flows/</code> in the source tree</a> — runnable flow examples and a colocated <code>README</code>.</li>
|
|
433
|
-
</ul><nav class="page-nav" aria-label="Pager"><a class="page-nav-prev" href="config.html"><small>Previous</small><span>Config</span></a><a class="page-nav-next" href="CLI.html"><small>Next</small><span>acpx CLI Reference</span></a></nav></article>
|
|
434
|
-
<nav class="toc" aria-label="On this page"><h2>On this page</h2><a class="toc-l2" href="#when-to-use-flows">#When to use flows</a><a class="toc-l2" href="#run-a-flow">#Run a flow</a><a class="toc-l2" href="#parsing-json-output">#Parsing JSON output</a><a class="toc-l2" href="#node-types">#Node types</a><a class="toc-l2" href="#authoring-surface">#Authoring surface</a><a class="toc-l2" href="#workspace-isolation">#Workspace isolation</a><a class="toc-l2" href="#permissions">#Permissions</a><a class="toc-l2" href="#run-persistence">#Run persistence</a><a class="toc-l2" href="#timeouts">#Timeouts</a><a class="toc-l2" href="#replay-viewer">#Replay viewer</a><a class="toc-l2" href="#example-flows-in-the-source-tree">#Example flows in the source tree</a><a class="toc-l2" href="#practical-examples">#Practical examples</a><a class="toc-l2" href="#see-also">#See also</a></nav>
|
|
435
|
-
</div>
|
|
436
|
-
</main>
|
|
437
|
-
</div>
|
|
438
|
-
<script>
|
|
439
|
-
const themeRoot=document.documentElement;
|
|
440
|
-
function applyTheme(mode){themeRoot.dataset.theme=mode;document.querySelectorAll('[data-theme-toggle]').forEach(b=>b.setAttribute('aria-pressed',mode==='dark'?'true':'false'))}
|
|
441
|
-
function storedTheme(){try{return localStorage.getItem('theme')}catch(e){return null}}
|
|
442
|
-
function persistTheme(mode){try{localStorage.setItem('theme',mode)}catch(e){}}
|
|
443
|
-
applyTheme(themeRoot.dataset.theme==='dark'?'dark':'light');
|
|
444
|
-
document.querySelectorAll('[data-theme-toggle]').forEach(btn=>{btn.addEventListener('click',()=>{const next=themeRoot.dataset.theme==='dark'?'light':'dark';applyTheme(next);persistTheme(next)})});
|
|
445
|
-
const systemDark=window.matchMedia&&matchMedia('(prefers-color-scheme: dark)');
|
|
446
|
-
function onSystemChange(e){if(storedTheme())return;applyTheme(e.matches?'dark':'light')}
|
|
447
|
-
if(systemDark){if(systemDark.addEventListener)systemDark.addEventListener('change',onSystemChange);else if(systemDark.addListener)systemDark.addListener(onSystemChange)}
|
|
448
|
-
const sidebar=document.querySelector('.sidebar');
|
|
449
|
-
const toggle=document.querySelector('.nav-toggle');
|
|
450
|
-
const mobileNav=window.matchMedia('(max-width: 900px)');
|
|
451
|
-
const sidebarFocusable='a[href],button,input,select,textarea,[tabindex]';
|
|
452
|
-
function setSidebarFocusable(enabled){
|
|
453
|
-
sidebar?.querySelectorAll(sidebarFocusable).forEach((el)=>{
|
|
454
|
-
if(enabled){
|
|
455
|
-
if(el.dataset.sidebarTabindex!==undefined){
|
|
456
|
-
if(el.dataset.sidebarTabindex)el.setAttribute('tabindex',el.dataset.sidebarTabindex);
|
|
457
|
-
else el.removeAttribute('tabindex');
|
|
458
|
-
delete el.dataset.sidebarTabindex;
|
|
459
|
-
}
|
|
460
|
-
}else if(el.dataset.sidebarTabindex===undefined){
|
|
461
|
-
el.dataset.sidebarTabindex=el.getAttribute('tabindex')??'';
|
|
462
|
-
el.setAttribute('tabindex','-1');
|
|
463
|
-
}
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
function setSidebarOpen(open){
|
|
467
|
-
if(!sidebar||!toggle)return;
|
|
468
|
-
sidebar.classList.toggle('open',open);
|
|
469
|
-
toggle.setAttribute('aria-expanded',open?'true':'false');
|
|
470
|
-
if(mobileNav.matches){
|
|
471
|
-
sidebar.inert=!open;
|
|
472
|
-
if(open)sidebar.removeAttribute('aria-hidden');
|
|
473
|
-
else sidebar.setAttribute('aria-hidden','true');
|
|
474
|
-
setSidebarFocusable(open);
|
|
475
|
-
}else{
|
|
476
|
-
sidebar.inert=false;
|
|
477
|
-
sidebar.removeAttribute('aria-hidden');
|
|
478
|
-
setSidebarFocusable(true);
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
setSidebarOpen(false);
|
|
482
|
-
toggle?.addEventListener('click',()=>setSidebarOpen(!sidebar?.classList.contains('open')));
|
|
483
|
-
document.addEventListener('click',(e)=>{if(!sidebar?.classList.contains('open'))return;if(sidebar.contains(e.target)||toggle?.contains(e.target))return;setSidebarOpen(false)});
|
|
484
|
-
document.addEventListener('keydown',(e)=>{if(e.key==='Escape')setSidebarOpen(false)});
|
|
485
|
-
const syncSidebarForViewport=()=>setSidebarOpen(sidebar?.classList.contains('open')??false);
|
|
486
|
-
if(mobileNav.addEventListener)mobileNav.addEventListener('change',syncSidebarForViewport);
|
|
487
|
-
else mobileNav.addListener?.(syncSidebarForViewport);
|
|
488
|
-
const input=document.getElementById('doc-search');
|
|
489
|
-
input?.addEventListener('input',()=>{const q=input.value.trim().toLowerCase();document.querySelectorAll('nav section').forEach(sec=>{let any=false;sec.querySelectorAll('.nav-link').forEach(a=>{const m=!q||a.textContent.toLowerCase().includes(q);a.style.display=m?'block':'none';if(m)any=true});sec.style.display=any?'block':'none'})});
|
|
490
|
-
function attachCopy(target,getText){const btn=document.createElement('button');btn.type='button';btn.className='copy';btn.textContent='Copy';btn.addEventListener('click',async()=>{try{await navigator.clipboard.writeText(getText());btn.textContent='Copied';btn.classList.add('copied');setTimeout(()=>{btn.textContent='Copy';btn.classList.remove('copied')},1400)}catch{btn.textContent='Failed';setTimeout(()=>{btn.textContent='Copy'},1400)}});target.appendChild(btn)}
|
|
491
|
-
document.querySelectorAll('.doc pre').forEach(pre=>attachCopy(pre,()=>pre.querySelector('code')?.textContent??''));
|
|
492
|
-
document.querySelectorAll('.home-install').forEach(el=>attachCopy(el,()=>el.querySelector('code')?.textContent??''));
|
|
493
|
-
const tocLinks=document.querySelectorAll('.toc a');
|
|
494
|
-
if(tocLinks.length){const map=new Map();tocLinks.forEach(a=>{const id=a.getAttribute('href').slice(1);const el=document.getElementById(id);if(el)map.set(el,a)});const setActive=l=>{tocLinks.forEach(x=>x.classList.remove('active'));l.classList.add('active')};const obs=new IntersectionObserver(entries=>{const visible=entries.filter(e=>e.isIntersecting).sort((a,b)=>a.boundingClientRect.top-b.boundingClientRect.top);if(visible.length){const link=map.get(visible[0].target);if(link)setActive(link)}},{rootMargin:'-15% 0px -65% 0px',threshold:0});map.forEach((_,el)=>obs.observe(el))}
|
|
495
|
-
</script>
|
|
496
|
-
</body>
|
|
497
|
-
</html>
|