@1agents/acp-service 0.3.0 → 0.5.0

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.
Files changed (98) hide show
  1. package/README.md +69 -33
  2. package/dist/bin/acp-service.js +2 -2
  3. package/dist/src/bridge.d.ts +2 -2
  4. package/dist/src/bridge.js +1 -1
  5. package/dist/src/catalog.js +20 -3
  6. package/dist/src/dsh.d.ts +6 -0
  7. package/dist/src/dsh.js +9 -0
  8. package/dist/src/manifest.js +1 -1
  9. package/dist/src/package.d.ts +3 -0
  10. package/dist/src/package.js +3 -0
  11. package/package.json +65 -13
  12. package/vendor/dsh/LICENSE +21 -0
  13. package/vendor/dsh/README.md +101 -0
  14. package/vendor/dsh/adapter.d.ts +82 -0
  15. package/vendor/dsh/adapter.js +449 -0
  16. package/vendor/dsh/client.js +207 -0
  17. package/vendor/dsh/cordis.patch.yml +10 -0
  18. package/vendor/dsh/discovery.d.ts +4 -0
  19. package/vendor/dsh/discovery.js +20 -0
  20. package/vendor/dsh/imports.d.ts +54 -0
  21. package/vendor/dsh/imports.js +133 -0
  22. package/vendor/dsh/index.d.ts +5 -0
  23. package/vendor/dsh/index.js +84 -0
  24. package/vendor/dsh/preset.d.ts +7 -0
  25. package/vendor/dsh/preset.js +10 -0
  26. package/vendor/dsh/service-process.d.ts +10 -0
  27. package/vendor/dsh/service-process.js +150 -0
  28. package/vendor/dsh/service-worker.d.ts +1 -0
  29. package/vendor/dsh/service-worker.js +43 -0
  30. package/vendor/dsh/state.d.ts +22 -0
  31. package/vendor/dsh/state.js +47 -0
  32. package/vendor/dsh/transport.d.ts +18 -0
  33. package/vendor/dsh/transport.js +71 -0
  34. package/vendor/runtime/LICENSE +21 -0
  35. package/vendor/runtime/README.md +115 -0
  36. package/vendor/runtime/dist/agent-registry-CMg8LHKY.js +806 -0
  37. package/vendor/runtime/dist/agent-registry-CMg8LHKY.js.map +1 -0
  38. package/vendor/runtime/dist/agent-registry.d.ts +70 -0
  39. package/vendor/runtime/dist/agent-registry.d.ts.map +1 -0
  40. package/vendor/runtime/dist/agent-registry.js +2 -0
  41. package/vendor/runtime/dist/cli-DUHyAADv.js +182 -0
  42. package/vendor/runtime/dist/cli-DUHyAADv.js.map +1 -0
  43. package/vendor/runtime/dist/cli.d.ts +12 -0
  44. package/vendor/runtime/dist/cli.d.ts.map +1 -0
  45. package/vendor/runtime/dist/cli.js +2632 -0
  46. package/vendor/runtime/dist/cli.js.map +1 -0
  47. package/vendor/runtime/dist/client-DjkWknf7.d.ts +262 -0
  48. package/vendor/runtime/dist/client-DjkWknf7.d.ts.map +1 -0
  49. package/vendor/runtime/dist/docs-site/.nojekyll +0 -0
  50. package/vendor/runtime/dist/docs-site/CLI.html +832 -0
  51. package/vendor/runtime/dist/docs-site/CNAME +1 -0
  52. package/vendor/runtime/dist/docs-site/VISION.html +415 -0
  53. package/vendor/runtime/dist/docs-site/agents.html +391 -0
  54. package/vendor/runtime/dist/docs-site/compare.html +359 -0
  55. package/vendor/runtime/dist/docs-site/config.html +450 -0
  56. package/vendor/runtime/dist/docs-site/custom-agents.html +408 -0
  57. package/vendor/runtime/dist/docs-site/exit-codes.html +347 -0
  58. package/vendor/runtime/dist/docs-site/favicon.svg +21 -0
  59. package/vendor/runtime/dist/docs-site/flows.html +497 -0
  60. package/vendor/runtime/dist/docs-site/index.html +367 -0
  61. package/vendor/runtime/dist/docs-site/install.html +386 -0
  62. package/vendor/runtime/dist/docs-site/llms.txt +35 -0
  63. package/vendor/runtime/dist/docs-site/output-formats.html +403 -0
  64. package/vendor/runtime/dist/docs-site/permissions.html +413 -0
  65. package/vendor/runtime/dist/docs-site/prompting.html +460 -0
  66. package/vendor/runtime/dist/docs-site/proof-2026-07-18-grok-ext-methods/index.html +336 -0
  67. package/vendor/runtime/dist/docs-site/quickstart.html +382 -0
  68. package/vendor/runtime/dist/docs-site/runtime-environment.html +329 -0
  69. package/vendor/runtime/dist/docs-site/runtime-process-lifecycle.html +335 -0
  70. package/vendor/runtime/dist/docs-site/session-control.html +406 -0
  71. package/vendor/runtime/dist/docs-site/session-watch.html +354 -0
  72. package/vendor/runtime/dist/docs-site/sessions.html +486 -0
  73. package/vendor/runtime/dist/docs-site/shared-sessions.html +377 -0
  74. package/vendor/runtime/dist/flows-CiJSCy4D.js +2474 -0
  75. package/vendor/runtime/dist/flows-CiJSCy4D.js.map +1 -0
  76. package/vendor/runtime/dist/flows.d.ts +334 -0
  77. package/vendor/runtime/dist/flows.d.ts.map +1 -0
  78. package/vendor/runtime/dist/flows.js +2 -0
  79. package/vendor/runtime/dist/invocation-options-BlIySxIw.js +345 -0
  80. package/vendor/runtime/dist/invocation-options-BlIySxIw.js.map +1 -0
  81. package/vendor/runtime/dist/ipc-BlljKR2b.js +5336 -0
  82. package/vendor/runtime/dist/ipc-BlljKR2b.js.map +1 -0
  83. package/vendor/runtime/dist/output-BzXQKArM.js +1012 -0
  84. package/vendor/runtime/dist/output-BzXQKArM.js.map +1 -0
  85. package/vendor/runtime/dist/queue-owner-runtime-DSFdsS_y.js +8867 -0
  86. package/vendor/runtime/dist/queue-owner-runtime-DSFdsS_y.js.map +1 -0
  87. package/vendor/runtime/dist/runtime.d.ts +1156 -0
  88. package/vendor/runtime/dist/runtime.d.ts.map +1 -0
  89. package/vendor/runtime/dist/runtime.js +3675 -0
  90. package/vendor/runtime/dist/runtime.js.map +1 -0
  91. package/vendor/runtime/dist/session-options-ORCchZGk.d.ts +426 -0
  92. package/vendor/runtime/dist/session-options-ORCchZGk.d.ts.map +1 -0
  93. package/vendor/runtime/dist/session-watch-BiBTBMz4.js +76 -0
  94. package/vendor/runtime/dist/session-watch-BiBTBMz4.js.map +1 -0
  95. package/vendor/runtime/dist/watch-iYiP-lOo.js +85 -0
  96. package/vendor/runtime/dist/watch-iYiP-lOo.js.map +1 -0
  97. package/vendor/runtime/package.json +46 -0
  98. package/vendor/runtime/skills/acpx/SKILL.md +688 -0
@@ -0,0 +1,377 @@
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>Shared sessions — acpx</title>
7
+ <meta name="description" content="Share one local ACP session owner between an application and acpx CLI processes.">
8
+ <link rel="canonical" href="https://acpx.sh/shared-sessions.html">
9
+ <meta property="og:type" content="website">
10
+ <meta property="og:site_name" content="acpx">
11
+ <meta property="og:title" content="Shared sessions — acpx">
12
+ <meta property="og:description" content="Share one local ACP session owner between an application and acpx CLI processes.">
13
+ <meta property="og:url" content="https://acpx.sh/shared-sessions.html">
14
+ <meta name="twitter:card" content="summary_large_image">
15
+ <meta name="twitter:title" content="Shared sessions — acpx">
16
+ <meta name="twitter:description" content="Share one local ACP session owner between an application and acpx CLI processes.">
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 &amp; 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" 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">Reference</p>
245
+ <h1>Shared sessions</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/shared-sessions.md" rel="noopener">Edit page</a>
250
+ </div>
251
+ </header>
252
+ <div class="doc-grid">
253
+ <article class="doc"><h1 id="shared-sessions">Shared sessions</h1>
254
+ <p><code>createSharedAcpRuntime()</code> connects applications to the same local session store and queue owners used by the CLI. An application and a terminal can submit prompts to one named conversation without starting competing adapter connections.</p>
255
+ <pre><code class="language-ts"><span class="hl-kw">import</span> { createSharedAcpRuntime } <span class="hl-kw">from</span> <span class="hl-str">&quot;acpx/runtime&quot;</span>;
256
+
257
+ <span class="hl-kw">const</span> runtime = createSharedAcpRuntime({
258
+ cwd: process.cwd(),
259
+ permissionMode: <span class="hl-str">&quot;deny-all&quot;</span>,
260
+ });
261
+
262
+ <span class="hl-kw">const</span> handle = <span class="hl-kw">await</span> runtime.ensureSession({
263
+ sessionKey: <span class="hl-str">&quot;reviewer&quot;</span>,
264
+ agent: <span class="hl-str">&quot;pi&quot;</span>,
265
+ mode: <span class="hl-str">&quot;persistent&quot;</span>,
266
+ });
267
+ <span class="hl-kw">const</span> turn = runtime.startTurn({
268
+ handle,
269
+ requestId: crypto.randomUUID(),
270
+ mode: <span class="hl-str">&quot;prompt&quot;</span>,
271
+ text: <span class="hl-str">&quot;Summarize the repository&quot;</span>,
272
+ });
273
+
274
+ <span class="hl-kw">await</span> turn.promptStarted;
275
+ <span class="hl-kw">for</span> <span class="hl-kw">await</span> (<span class="hl-kw">const</span> event <span class="hl-kw">of</span> turn.events) {
276
+ <span class="hl-kw">if</span> (event.<span class="hl-kw">type</span> === <span class="hl-str">&quot;text_delta&quot;</span>) process.stdout.write(event.text);
277
+ }
278
+ console.log(<span class="hl-kw">await</span> turn.result);
279
+ <span class="hl-kw">await</span> runtime.shutdown();</code></pre>
280
+ <p>From a terminal using the same OS user, home directory, working directory, and resolved agent command:</p>
281
+ <pre><code class="language-bash">acpx pi <span class="hl-flag">-s</span> reviewer <span class="hl-str">&#39;Review the previous summary&#39;</span>
282
+ acpx pi cancel <span class="hl-flag">-s</span> reviewer
283
+ acpx pi sessions show reviewer</code></pre>
284
+ <h2 id="identity-and-ownership"><a class="anchor" href="#identity-and-ownership" aria-label="Anchor link">#</a>Identity and ownership</h2>
285
+ <p><code>sessionKey</code> maps to the CLI&#39;s session name. An empty key selects the unnamed default session. Shared lookup uses the exact working directory; it does not walk into parent directories. The scope is the existing <code>(agentCommand, cwd, name)</code> tuple. Concurrent <code>ensureSession()</code> and CLI <code>sessions ensure</code> calls for the same scope select one record.</p>
286
+ <p>Imports participate in that same exact-scope admission. An ensure waiting behind an import reuses its completed record; an import waiting behind a newly created shared session reports the occupied scope.</p>
287
+ <p><code>findSession({ sessionKey, agent, cwd? })</code> looks up an open local session without launching an agent. Handles contain the canonical local record and provider session IDs. Keep shared handles with the shared runtime; the in-process runtime has a different ownership contract.</p>
288
+ <p>New sessions are created using the normal CLI path. Prompt submission starts or joins the existing queue owner, which keeps the live connection for its idle TTL. Shared turns require the saved provider session to resume successfully; an unavailable session produces an error instead of silently creating a different conversation. The agent must support loading or resuming sessions.</p>
289
+ <p>CLI mode, model, and configuration controls update the same retained connection for a shared session, including while the owner is idle. Accepted controls are saved by the owner before success is returned. A prompt starting behind an idle control reads its saved state after that control finishes; an active prompt keeps its control context until pending acknowledgements and checkpoints settle.</p>
290
+ <h2 id="turns-cancellation-and-disconnects"><a class="anchor" href="#turns-cancellation-and-disconnects" aria-label="Anchor link">#</a>Turns, cancellation, and disconnects</h2>
291
+ <p>Use <a href="session-watch.html"><code>runtime.watchSession({ handle, cursor?, signal? })</code></a> to observe another client&#39;s session without submitting work. Watch streams replay retained events and follow new ones, independently of the submitting connection.</p>
292
+ <p>Use a fresh <code>requestId</code> for every turn. The ID is preserved through queueing and local status. Reusing an ID while it is queued or active is rejected; IDs do not provide an idempotent retry API.</p>
293
+ <p><code>turn.promptStarted</code> resolves when the ACP transport accepts the actual prompt, after queue waiting and session preparation. Queue acceptance alone does not resolve it. It rejects when the turn never reaches the agent. <code>turn.result</code> settles after the owner&#39;s normal prompt finalization and checkpoint attempts; it reports <code>completed</code>, <code>cancelled</code>, or <code>failed</code>.</p>
294
+ <p><code>turn.cancel()</code> or the turn&#39;s <code>AbortSignal</code> targets that request. Cancelling a queued turn removes it without cancelling another client&#39;s active turn. <code>runtime.cancel({ handle })</code> intentionally cancels the session&#39;s current active turn, like the CLI command.</p>
295
+ <p>Cancellation also stops remaining retries during backoff or before transport admission. A final adapter response already received keeps its actual outcome while updates drain; cancellation does not replace that completed response.</p>
296
+ <p>A timed-out turn with no final ACP response fails even if it produced partial text. The owner cancels and retires its unfinished connection before dispatching the next prompt, retaining final cancellation output under the original request. The successor resumes the saved provider session on a new connection. If connection cleanup fails, the owner stops accepting work and rejects queued prompts instead of reusing that connection.</p>
297
+ <p><code>turn.closeStream()</code> stops local event delivery while the submitted turn continues. <code>runtime.shutdown()</code> detaches the client and waits for its admitted local operations to settle. It does not kill the shared owner or cancel accepted turns. A detached turn whose result was not received reports a failed local result; the work may still be running.</p>
298
+ <p><code>runtime.close({ handle, reason })</code> explicitly performs the CLI&#39;s soft close: stop the owner and mark the record closed while retaining local history. A later ensure creates a new open session.</p>
299
+ <p>After a submission loses its connection, acpx cannot always know whether the agent ran it. Such uncertain failures are not automatically retried, and the owner is not killed to retry the prompt. Inspect the session before deciding whether to submit new work.</p>
300
+ <p>Updated clients accept complete owner responses without a fixed receive-buffer ceiling, including large events and accumulated session histories from older owners. Each response is assembled and parsed in memory; unfinished responses also have no application-level size bound. The owner&#39;s <a href="CLI.html#prompt-queueing">output backlog limits</a> still apply, and older clients retain their previous receive limit.</p>
301
+ <p>On macOS and Linux, the owner disconnects an output observer whose buffered writes stop progressing, while the admitted turn continues and remains observable through session watching; Windows retains stalled output because named pipes do not report partial write progress reliably enough to disconnect without truncating a reader that is still consuming output.</p>
302
+ <h2 id="configuration-and-compatibility"><a class="anchor" href="#configuration-and-compatibility" aria-label="Anchor link">#</a>Configuration and compatibility</h2>
303
+ <p>Shared runtime options are <code>cwd</code>, optional <code>agentRegistry</code>, required <code>permissionMode</code>, and optional <code>nonInteractivePermissions</code>, <code>permissionPolicy</code>, <code>authCredentials</code>, <code>authPolicy</code>, <code>timeoutMs</code>, and <code>ttlMs</code>. The default registry uses built-in agent commands. Applications with custom commands should pass <code>createAgentRegistry({ overrides: ... })</code> and use the identical command in CLI configuration or <code>--agent</code>.</p>
304
+ <p>Each submitting client supplies its static permission policy. Authentication and the child environment belong to the owner started for that session. Joining a session does not replace the existing owner&#39;s credentials. This is local, same-user IPC; it is not a network service or an isolation boundary between mutually untrusted clients.</p>
305
+ <p>Custom session stores, process lifecycle callbacks, child environment overlays, MCP resolvers, and per-turn permission or elicitation callbacks belong to <code>createAcpRuntime()</code>. They are not serialized or silently ignored by the shared runtime. Shared sessions currently support persistent prompt turns; use the in-process runtime for oneshot sessions and <code>mode: &quot;steer&quot;</code> turns. In-process steer turns queue like prompts; see <a href="prompting.html#steer-turns">Steer turns</a>. <code>startTurn()</code> still rejects a per-turn <code>assertActive</code>, because a shared turn runs inside the owner and cannot consult the submitting client again after admission.</p>
306
+ <h2 id="session-controls"><a class="anchor" href="#session-controls" aria-label="Anchor link">#</a>Session controls</h2>
307
+ <p><code>setMode({ handle, mode })</code>, <code>setModel({ handle, model })</code>, <code>setConfigOption({ handle, key, value })</code>, and <code>getCapabilities({ handle? })</code> work on shared sessions with the same signatures and return shapes as <a href="session-control.html"><code>createAcpRuntime()</code></a>. <code>setConfigOption</code> resolves <code>key</code> against the saved option catalog and returns the adapter&#39;s full <code>configOptions</code> response. <code>getCapabilities()</code> without a handle reports the controls acpx implements; with a handle it adds <code>configOptionKeys</code> from the saved record. Newly advertised keys become available after the owner checkpoints them. Model selections are validated by the owner against its connected session&#39;s model catalog.</p>
308
+ <p>Capability results are independent mutable snapshots. Editing their control or config-key arrays does not affect another result, a saved session, or another runtime instance.</p>
309
+ <p>Shared controls are owner-only. When no queue owner holds the session, a control fails with <code>ACP_BACKEND_UNAVAILABLE</code> instead of opening its own adapter connection. Falling back to a direct connection would contend with the owner for the session, and that path may create a different provider session when the saved one no longer loads — the same trade shared turns already refuse. Submitting a turn starts an owner. The equivalent <code>acpx</code> command is an alternative rather than a way to start one: with no owner it applies the control over a temporary direct connection of its own, so it changes the selection without leaving an owner behind for the next shared control. Once an owner does exist it serves the control on its retained connection, whether or not a prompt is running.</p>
310
+ <p>An owner that advertises <code>persistsControlState</code> saves the accepted selection itself before reporting success, so updated shared clients do not write the record. Race-free persistence requires updated callers and an updated owner. A running v0.17.1 owner still needs caller-side persistence, and older callers may write even with an updated owner. Those whole-record writes can race other callers or owner checkpoints, leaving saved state stale even though the agent keeps what it accepted. Use updated clients and let an older owner expire while idle before resuming work. One shared client always runs its own controls for a session one at a time.</p>
311
+ <p>Controls accept the same optional <code>signal</code> and <code>assertActive</code> fields as the in-process runtime. The shared runtime checks them locally on the way in and again immediately before the request is written to the owner&#39;s socket, so authority withdrawn while the control is still finding the owner or opening its connection means nothing was sent. Authority is never consulted after that write: a control the owner has accepted still settles its response and saved state, and cannot be recalled. The check also covers this client only — it does not gate controls the CLI or another application sends to the same owner.</p>
312
+ <p>An older running owner may lack targeted cancellation and prompt-start notifications. Shared clients detect this before submitting work and report <code>QUEUE_SHARED_RUNTIME_UNSUPPORTED</code>. Allow that owner to expire when idle, or explicitly close the session before ensuring it again. Existing CLI clients can continue using their existing owners.</p>
313
+ <p>The explicit session-wide <code>runtime.cancel()</code> and <code>runtime.close()</code> operations retain their CLI semantics with older owners. The compatibility gate protects shared turn submission and targeted turn cancellation.</p></article>
314
+ <nav class="toc" aria-label="On this page"><h2>On this page</h2><a class="toc-l2" href="#identity-and-ownership">#Identity and ownership</a><a class="toc-l2" href="#turns-cancellation-and-disconnects">#Turns, cancellation, and disconnects</a><a class="toc-l2" href="#configuration-and-compatibility">#Configuration and compatibility</a><a class="toc-l2" href="#session-controls">#Session controls</a></nav>
315
+ </div>
316
+ </main>
317
+ </div>
318
+ <script>
319
+ const themeRoot=document.documentElement;
320
+ function applyTheme(mode){themeRoot.dataset.theme=mode;document.querySelectorAll('[data-theme-toggle]').forEach(b=>b.setAttribute('aria-pressed',mode==='dark'?'true':'false'))}
321
+ function storedTheme(){try{return localStorage.getItem('theme')}catch(e){return null}}
322
+ function persistTheme(mode){try{localStorage.setItem('theme',mode)}catch(e){}}
323
+ applyTheme(themeRoot.dataset.theme==='dark'?'dark':'light');
324
+ document.querySelectorAll('[data-theme-toggle]').forEach(btn=>{btn.addEventListener('click',()=>{const next=themeRoot.dataset.theme==='dark'?'light':'dark';applyTheme(next);persistTheme(next)})});
325
+ const systemDark=window.matchMedia&&matchMedia('(prefers-color-scheme: dark)');
326
+ function onSystemChange(e){if(storedTheme())return;applyTheme(e.matches?'dark':'light')}
327
+ if(systemDark){if(systemDark.addEventListener)systemDark.addEventListener('change',onSystemChange);else if(systemDark.addListener)systemDark.addListener(onSystemChange)}
328
+ const sidebar=document.querySelector('.sidebar');
329
+ const toggle=document.querySelector('.nav-toggle');
330
+ const mobileNav=window.matchMedia('(max-width: 900px)');
331
+ const sidebarFocusable='a[href],button,input,select,textarea,[tabindex]';
332
+ function setSidebarFocusable(enabled){
333
+ sidebar?.querySelectorAll(sidebarFocusable).forEach((el)=>{
334
+ if(enabled){
335
+ if(el.dataset.sidebarTabindex!==undefined){
336
+ if(el.dataset.sidebarTabindex)el.setAttribute('tabindex',el.dataset.sidebarTabindex);
337
+ else el.removeAttribute('tabindex');
338
+ delete el.dataset.sidebarTabindex;
339
+ }
340
+ }else if(el.dataset.sidebarTabindex===undefined){
341
+ el.dataset.sidebarTabindex=el.getAttribute('tabindex')??'';
342
+ el.setAttribute('tabindex','-1');
343
+ }
344
+ });
345
+ }
346
+ function setSidebarOpen(open){
347
+ if(!sidebar||!toggle)return;
348
+ sidebar.classList.toggle('open',open);
349
+ toggle.setAttribute('aria-expanded',open?'true':'false');
350
+ if(mobileNav.matches){
351
+ sidebar.inert=!open;
352
+ if(open)sidebar.removeAttribute('aria-hidden');
353
+ else sidebar.setAttribute('aria-hidden','true');
354
+ setSidebarFocusable(open);
355
+ }else{
356
+ sidebar.inert=false;
357
+ sidebar.removeAttribute('aria-hidden');
358
+ setSidebarFocusable(true);
359
+ }
360
+ }
361
+ setSidebarOpen(false);
362
+ toggle?.addEventListener('click',()=>setSidebarOpen(!sidebar?.classList.contains('open')));
363
+ document.addEventListener('click',(e)=>{if(!sidebar?.classList.contains('open'))return;if(sidebar.contains(e.target)||toggle?.contains(e.target))return;setSidebarOpen(false)});
364
+ document.addEventListener('keydown',(e)=>{if(e.key==='Escape')setSidebarOpen(false)});
365
+ const syncSidebarForViewport=()=>setSidebarOpen(sidebar?.classList.contains('open')??false);
366
+ if(mobileNav.addEventListener)mobileNav.addEventListener('change',syncSidebarForViewport);
367
+ else mobileNav.addListener?.(syncSidebarForViewport);
368
+ const input=document.getElementById('doc-search');
369
+ 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'})});
370
+ 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)}
371
+ document.querySelectorAll('.doc pre').forEach(pre=>attachCopy(pre,()=>pre.querySelector('code')?.textContent??''));
372
+ document.querySelectorAll('.home-install').forEach(el=>attachCopy(el,()=>el.querySelector('code')?.textContent??''));
373
+ const tocLinks=document.querySelectorAll('.toc a');
374
+ 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))}
375
+ </script>
376
+ </body>
377
+ </html>