@actana/sdk 0.2.2
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/LICENSE +21 -0
- package/README.md +66 -0
- package/dist/core-client.d.ts +616 -0
- package/dist/core-client.d.ts.map +1 -0
- package/dist/core-client.js +1036 -0
- package/dist/core-client.js.map +1 -0
- package/dist/core-link-cursor-storage.d.ts +32 -0
- package/dist/core-link-cursor-storage.d.ts.map +1 -0
- package/dist/core-link-cursor-storage.js +66 -0
- package/dist/core-link-cursor-storage.js.map +1 -0
- package/dist/core-link-frames.d.ts +1123 -0
- package/dist/core-link-frames.d.ts.map +1 -0
- package/dist/core-link-frames.js +349 -0
- package/dist/core-link-frames.js.map +1 -0
- package/dist/core-link-socket.d.ts +54 -0
- package/dist/core-link-socket.d.ts.map +1 -0
- package/dist/core-link-socket.js +74 -0
- package/dist/core-link-socket.js.map +1 -0
- package/dist/core-link-transport.d.ts +177 -0
- package/dist/core-link-transport.d.ts.map +1 -0
- package/dist/core-link-transport.js +432 -0
- package/dist/core-link-transport.js.map +1 -0
- package/dist/core-registration-blob.d.ts +52 -0
- package/dist/core-registration-blob.d.ts.map +1 -0
- package/dist/core-registration-blob.js +61 -0
- package/dist/core-registration-blob.js.map +1 -0
- package/dist/core-session.d.ts +321 -0
- package/dist/core-session.d.ts.map +1 -0
- package/dist/core-session.js +660 -0
- package/dist/core-session.js.map +1 -0
- package/dist/durable-core-client.d.ts +172 -0
- package/dist/durable-core-client.d.ts.map +1 -0
- package/dist/durable-core-client.js +264 -0
- package/dist/durable-core-client.js.map +1 -0
- package/dist/terminal-screen.d.ts +139 -0
- package/dist/terminal-screen.d.ts.map +1 -0
- package/dist/terminal-screen.js +807 -0
- package/dist/terminal-screen.js.map +1 -0
- package/package.json +51 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-link-frames.d.ts","sourceRoot":"","sources":["../src/core-link-frames.ts"],"names":[],"mappings":"AA+BA,M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BAAmB,GACnB,kBAAkB,GAClB,2BAA2B,GAC3B,qBAAqB,CAAC;AAI1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkJG;AACH,eAAO,MAAM,0BAA0B,WAAW,CAAC;AAEnD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAMvF;AAED;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAC3C,GAAG,EAAE,OAAO,GACX,iCAAiC,GAAG,IAAI,CAI1C;AAuCD,+EAA+E;AAC/E,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,GAAG,IAAI,CAWlF;AAED,+DAA+D;AAC/D,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,CAEzE"}
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
// Core-link frame schema — the generalized protocol for Panel ↔ Core
|
|
2
|
+
// communication.
|
|
3
|
+
//
|
|
4
|
+
// This file is the **one** definition of every frame type in the repository,
|
|
5
|
+
// and it lives in `@actana/sdk` because the protocol ships with the client that
|
|
6
|
+
// speaks it (ADR 0025). The Core is the server answering these frames and
|
|
7
|
+
// imports them from here too — deliberately, so that "the protocol" and "the
|
|
8
|
+
// package a third party installs to speak it" are the same artifact rather
|
|
9
|
+
// than two that have to be kept in step.
|
|
10
|
+
//
|
|
11
|
+
// A single WebSocket (`ws://127.0.0.1`) carries multiplexed frames keyed by
|
|
12
|
+
// `ptyId`/`taskId` where relevant. Loopback-only (trusted) at this stage;
|
|
13
|
+
// mTLS + bearer auth is added in a later issue.
|
|
14
|
+
//
|
|
15
|
+
// Issue 02 generalizes the seed PTY protocol into one that carries task,
|
|
16
|
+
// session, and hook operations alongside PTY ops, and adds a monotonic
|
|
17
|
+
// per-Core event log with `lastEventId` reconnect replay. The frame shapes:
|
|
18
|
+
//
|
|
19
|
+
// - Request/response frames carry a client-generated `reqId` for correlation.
|
|
20
|
+
// - Unsolicited stream frames (`data`, `exit`) carry only `ptyId` — the Panel
|
|
21
|
+
// routes them via its pty-stream-router (demuxed by `ptyId`).
|
|
22
|
+
// - `subscribe` (Panel → Core) carries the Panel's `lastEventId` cursor so
|
|
23
|
+
// the Core can stream the replay tail; `event` frames carry the
|
|
24
|
+
// sequential {@link CoreLinkEvent} envelope for every domain event; the
|
|
25
|
+
// `eventsReplayed` marker signals "caught up, live push resumes".
|
|
26
|
+
//
|
|
27
|
+
// This file is self-contained (no `~/` imports) so it compiles under both the
|
|
28
|
+
// Vite (browser) and the Core's CommonJS tsconfigs.
|
|
29
|
+
/**
|
|
30
|
+
* The kind string appended to the event log when the availability map changes.
|
|
31
|
+
* Payload is the JSON-serialized full {@link CoreLinkHarnessAvailabilityMap}
|
|
32
|
+
* (self-contained; a Panel that misses N intermediate changes and replays only
|
|
33
|
+
* the tail lands on the latest state without stitching).
|
|
34
|
+
*/
|
|
35
|
+
export const HARNESSES_AVAILABILITY_EVENT_KIND = "agents:availabilityChanged";
|
|
36
|
+
/**
|
|
37
|
+
* The kind appended to the event log when an install ends without the Harness
|
|
38
|
+
* becoming available. Payload is `{harness, message}` — the message is written
|
|
39
|
+
* for the operator, in the same register the `dirCreate` / `dirList` failures
|
|
40
|
+
* use. This is the only definitive failure signal: no failure is ever cached in
|
|
41
|
+
* the availability map, so a Panel that missed the event sees a plain `missing`
|
|
42
|
+
* Harness it can try again, never a permanently disabled one.
|
|
43
|
+
*/
|
|
44
|
+
export const HARNESS_INSTALL_FAILED_EVENT_KIND = "harness:installFailed";
|
|
45
|
+
// ─── Session lock (issue 144, ADR 0024 D3–D7, D10) ──────────────────────────
|
|
46
|
+
//
|
|
47
|
+
// One Session, at most one writer, and the writer is the **core-link
|
|
48
|
+
// connection** (D3). The three frames below are the whole of how a connection
|
|
49
|
+
// says so: `claim` takes an unlocked Session, `release` gives it back, and
|
|
50
|
+
// `forceTakeover` takes one whoever holds it. All three are ordinary
|
|
51
|
+
// reqId-correlated requests, and all three name a Session by its `taskId` —
|
|
52
|
+
// the one identifier `tasksMutate` carries directly and `write`/`kill` resolve
|
|
53
|
+
// to from their `ptyId`.
|
|
54
|
+
//
|
|
55
|
+
// A Session starts unlocked and its creator gets no privilege (D5), so the
|
|
56
|
+
// window between a Session starting and its first claim is a real race in which
|
|
57
|
+
// any connection can take it. That is accepted, not a defect: closing it would
|
|
58
|
+
// mean reintroducing creator privilege, which was decided against. An
|
|
59
|
+
// automation claims immediately after starting.
|
|
60
|
+
//
|
|
61
|
+
// Claiming is explicit (D6): no mutation ever acquires the lock. A mutation
|
|
62
|
+
// aimed at a Session **another connection holds** is refused with
|
|
63
|
+
// {@link SESSION_LOCKED_ERROR_CODE}; a mutation aimed at an **unlocked** Session
|
|
64
|
+
// is served, which is what keeps a client that never claims — every client that
|
|
65
|
+
// predates this — working exactly as it does today (D11).
|
|
66
|
+
//
|
|
67
|
+
// There is no idle timeout and there must not be one (D7). A long agent run is
|
|
68
|
+
// idle by definition; the hung-client case is what `forceTakeover` is for.
|
|
69
|
+
//
|
|
70
|
+
// None of this is a security boundary (D10). The Core's only authentication is
|
|
71
|
+
// the bearer in the registration blob, and anyone holding it can open a VM Shell
|
|
72
|
+
// Session and kill the process directly. This is an accident guard.
|
|
73
|
+
/**
|
|
74
|
+
* The `code` on an `error` frame refusing a mutation because another connection
|
|
75
|
+
* holds that Session's lock (ADR 0024 D4/D6).
|
|
76
|
+
*
|
|
77
|
+
* A code rather than a message match, because the client has to tell this apart
|
|
78
|
+
* from the other way a mutation fails to land: "that Session is gone". Those two
|
|
79
|
+
* answers arrive on different frames entirely — a refusal is this `error`, while
|
|
80
|
+
* a Session that no longer exists is the ordinary `writeResult { ok: false }` /
|
|
81
|
+
* `killResult { ok: false }` / `tasksMutateResult { task: null }` the Core has
|
|
82
|
+
* always sent — so a client can distinguish them without parsing prose, and one
|
|
83
|
+
* of them is worth retrying after a claim while the other never is.
|
|
84
|
+
*/
|
|
85
|
+
export const SESSION_LOCKED_ERROR_CODE = "session-locked";
|
|
86
|
+
/**
|
|
87
|
+
* The kind appended to the event log on every Session-lock change (ADR 0024 D8).
|
|
88
|
+
*
|
|
89
|
+
* A **dedicated kind**, following the precedent ADR 0022 set for
|
|
90
|
+
* `project:appearanceChanged` — and for the same reason both ADR 0017 and ADR
|
|
91
|
+
* 0022 rejected the alternative. Widening an existing mutation event to carry
|
|
92
|
+
* lock state would stop the frame documenting what changed: every client would
|
|
93
|
+
* have to refetch on every `task:updated` to find out whether this one was
|
|
94
|
+
* about the lock, and a reconnecting client replaying a tail could not tell a
|
|
95
|
+
* takeover it needs to react to from a title edit it does not.
|
|
96
|
+
*
|
|
97
|
+
* Payload is {@link CoreLinkSessionLockChangedPayload}. It rides the ordinary
|
|
98
|
+
* event log, so it replays by cursor exactly like every other event: a client
|
|
99
|
+
* that was away comes back, sends `subscribe { lastEventId }`, and reads the
|
|
100
|
+
* lock changes it missed in order, distinctly, alongside everything else.
|
|
101
|
+
*/
|
|
102
|
+
export const SESSION_LOCK_CHANGED_EVENT_KIND = "session:lockChanged";
|
|
103
|
+
// ─── Helpers ─────────────────────────────────────────────────────────────────
|
|
104
|
+
/**
|
|
105
|
+
* Protocol version advertised in the `ready` frame. Bumped on breaking changes.
|
|
106
|
+
* Issue 02 adds the event-cursor replay (`subscribe` / `event` /
|
|
107
|
+
* `eventsReplayed`) and the task/session/hook op frames → 0.2.0. Issue 04 adds
|
|
108
|
+
* the mTLS bearer `auth` / `authOk` / `authError` frames → 0.3.0. Issue 06 adds
|
|
109
|
+
* the `shellSession: true` VM-shell spawn mode (no `agent`, no project-root) →
|
|
110
|
+
* 0.4.0. Issue 07 adds the `projectsList` / `projectsListResult` frames for
|
|
111
|
+
* per-Core navigation (additive — same 0.4.0). Issue 04 lands the write path
|
|
112
|
+
* (`projectsMutate` + real `tasksMutate` handlers + real `sessionsList`) and
|
|
113
|
+
* discriminant-typed mutation shapes → 0.5.0. `tasksMutate`'s payload shape
|
|
114
|
+
* changed from a flat `{taskId, projectId?, status?, ...}` to a discriminated
|
|
115
|
+
* `{op: "create"|"update", ...}` union. `parseCoreLinkRequestFrame` only
|
|
116
|
+
* validates the outer `type`, so a stale-shape mutation payload lands at the
|
|
117
|
+
* mutation store's runtime `op` check and comes back as an actionable `error`
|
|
118
|
+
* frame ("unknown task mutation op: undefined"). No shipped Panel yet routes
|
|
119
|
+
* writes through this frame (the loopback API still owns local writes; remote
|
|
120
|
+
* writes were stubbed as `task: null`), so no live caller regresses. Issue 09
|
|
121
|
+
* adds the `icon` field to {@link CoreLinkTaskSnapshot} and the create/update
|
|
122
|
+
* variants of {@link CoreLinkTaskMutation}, plus a dedicated
|
|
123
|
+
* `task:iconChanged` event kind so replays surface icon-only edits distinctly
|
|
124
|
+
* from other task updates → 0.6.0. Issue 11 adds the `agentsAvailabilityList`
|
|
125
|
+
* request/response + the `agents:availabilityChanged` event kind → 0.7.0.
|
|
126
|
+
* Additive on both sides — a Core that has not been upgraded ignores the
|
|
127
|
+
* new request frame (the outer `parseCoreLinkRequestFrame` rejects unknown
|
|
128
|
+
* types), and a Panel hydrating from an older Core sees an empty
|
|
129
|
+
* availability map and falls back to the same "checking…" affordance a fresh
|
|
130
|
+
* boot shows. Issue 10 adds a dedicated `pin` op to
|
|
131
|
+
* {@link CoreLinkProjectMutation} plus the `project:pinnedChanged` /
|
|
132
|
+
* `task:pinnedChanged` event kinds (task pin-only updates now surface
|
|
133
|
+
* distinctly, mirroring the icon-only path from issue 09) → 0.8.0. Web-panel
|
|
134
|
+
* issue 06 adds the `dirList` / `dirCreate` request frames and their results,
|
|
135
|
+
* so the browser's folder picker browses the Core's disk instead of a
|
|
136
|
+
* machine-local dialog that no longer exists → 0.9.0. Additive: a Core that
|
|
137
|
+
* has not been upgraded rejects the unknown request type, which the Panel
|
|
138
|
+
* surfaces as the same actionable error any other failed listing produces.
|
|
139
|
+
* Issue 22 adds a `settings` op to {@link CoreLinkProjectMutation}, the same
|
|
140
|
+
* remembered-settings fields on its `create` variant, those fields on
|
|
141
|
+
* {@link CoreLinkProjectSnapshot}, and the `project:settingsChanged` event
|
|
142
|
+
* kind → 0.10.0. Every column they land in already exists in the shared
|
|
143
|
+
* schema bootstrap, so no migration rides along. Unlike the additive bumps
|
|
144
|
+
* above, there is no partial-compatibility story to describe here and none is
|
|
145
|
+
* wanted: the minor moved, so a Core still speaking 0.9.0 is incompatible by
|
|
146
|
+
* the major.minor rule below and renders as "needs update" (ADR 0005). It
|
|
147
|
+
* never reaches the mutation store's runtime `op` check.
|
|
148
|
+
* Issue 63 adds a `delete` op to {@link CoreLinkTaskMutation} and the
|
|
149
|
+
* `task:deleted` event kind the Core appends for it → 0.11.0. Deleting a
|
|
150
|
+
* Core-owned Session had no operation to carry, so every delete call site fell
|
|
151
|
+
* through to the Panel's own endpoint and 404'd. Same rule as above: the minor
|
|
152
|
+
* moved, so a Core on 0.10.0 is "needs update" rather than a Core that accepts
|
|
153
|
+
* the frame and silently drops the op.
|
|
154
|
+
* Issue 62 adds the `archivedTasksList` / `archivedTasksListResult` frames and
|
|
155
|
+
* an unconditional `archivedCount` on {@link CoreLinkServerFrame}'s
|
|
156
|
+
* `tasksListResult` → 0.12.0 (ADR 0019). Archived rows had no way across the
|
|
157
|
+
* link at all, so the Panel's Archived view was permanently empty for a Core
|
|
158
|
+
* and restore could not be invoked. The count is required rather than
|
|
159
|
+
* optional: a Core on 0.11.0 would answer without it and the Archived tab
|
|
160
|
+
* would silently never appear, which is exactly the bug — so the minor moves
|
|
161
|
+
* and such a Core renders as "needs update".
|
|
162
|
+
* Issue 84 adds `titleManuallySet` and `claudeSessionId` to
|
|
163
|
+
* {@link CoreLinkTaskSnapshot} and to the `update` variant of
|
|
164
|
+
* {@link CoreLinkTaskMutation}, plus `hooksReportTurnStart` on the `spawned`
|
|
165
|
+
* response, and the `harnessPrompt` frame that carries a terminal-captured
|
|
166
|
+
* prompt to the Core that can act on it → 0.13.0 (ADR 0020). The snapshot
|
|
167
|
+
* fields are the load-bearing part: a Core that grew them without this bump
|
|
168
|
+
* would hand a Panel that predates it a snapshot whose rename protection is
|
|
169
|
+
* silently absent, and a Panel that predates the Core would keep synthesizing
|
|
170
|
+
* `false` — both render a Session the generator is free to rename out from
|
|
171
|
+
* under its operator. Same rule as above: the minor moved, so either side on
|
|
172
|
+
* 0.12.0 is "needs update" rather than a partial snapshot nobody notices. No
|
|
173
|
+
* migration rides along — the columns (`title_manually_set`,
|
|
174
|
+
* `claude_session_id`) have been in the shared schema bootstrap since the
|
|
175
|
+
* fork; only the wire and the Core's readers/writers of them are new.
|
|
176
|
+
* Issue 83 adds the `harnessInstall` request frame, its `harnessInstallAck`
|
|
177
|
+
* response, and the `harness:installFailed` event kind → 0.14.0 (ADR 0021).
|
|
178
|
+
* Availability crossed the link Core→Panel only, so a missing CLI was a wall:
|
|
179
|
+
* the picker greyed the row out and told the operator to go run a command on
|
|
180
|
+
* another machine. This is the trigger that was absent — the Core still owns
|
|
181
|
+
* probing and installing, and still publishes availability as the one source of
|
|
182
|
+
* truth. Same rule as the bumps above: the minor moved, so a Core on 0.13.0
|
|
183
|
+
* renders as "needs update" rather than one that silently drops the frame.
|
|
184
|
+
* Issue 98 adds an `appearance` op to {@link CoreLinkProjectMutation} and the
|
|
185
|
+
* `project:appearanceChanged` event kind the Core appends for it → 0.15.0
|
|
186
|
+
* (ADR 0022). A project's icon and icon colour are Core facts that `create`
|
|
187
|
+
* could set and nothing could change afterwards, so the Edit-project dialog
|
|
188
|
+
* PATCHed them at a Panel row a Core-owned project does not have, and 404'd with
|
|
189
|
+
* the rename already applied. Same rule as above: the minor moved, so a Core on
|
|
190
|
+
* 0.14.0 is "needs update" rather than one that takes the frame and drops the
|
|
191
|
+
* op. The columns (`icon`, `icon_color`) have been in the shared schema
|
|
192
|
+
* bootstrap since the fork, so no migration rides along on the Core's side.
|
|
193
|
+
*
|
|
194
|
+
* Issue 142 adds the `ptySubscribe` / `ptyUnsubscribe` frames and their acks —
|
|
195
|
+
* and deliberately **does not move this version** (ADR 0024 D11). Every bump
|
|
196
|
+
* above marks every Core in every fleet needs-update, and multi-connection is a
|
|
197
|
+
* capability a one-Panel fleet never exercises. It is announced on `ready`
|
|
198
|
+
* instead, by #143 below, which also gates the Panel's sends on it, so these
|
|
199
|
+
* frames are never put on the wire to a Core that cannot answer them.
|
|
200
|
+
*
|
|
201
|
+
* Issue 143 adds the optional `multiConnection` capability to the `ready`
|
|
202
|
+
* frame and deliberately does NOT move this version (ADR 0024 D11). It is the
|
|
203
|
+
* first entry in this log that does not: the field is additive and its absence
|
|
204
|
+
* is the single-connection Core that shipped before it, which is exactly
|
|
205
|
+
* today's behaviour rather than a lesser one. Moving the minor would mark every
|
|
206
|
+
* Core in every fleet "needs update" to buy a capability a one-Panel fleet
|
|
207
|
+
* never exercises. A capability that changed what an existing frame means
|
|
208
|
+
* would not qualify, and the minor would move as it does above.
|
|
209
|
+
*
|
|
210
|
+
* Issue 144 adds the Session lock's `claim` / `release` / `forceTakeover`
|
|
211
|
+
* frames, their results, and the optional `code` on `error` — and does NOT move
|
|
212
|
+
* this version either (ADR 0024 D11), for the same reason #142 and #143 did not.
|
|
213
|
+
* The three frames are gated by the `multiConnection` capability, so they are
|
|
214
|
+
* never put on the wire to a Core that has no lock table to address. The gating
|
|
215
|
+
* of `write` / `kill` / `tasksMutate` is additive in the sense the rule
|
|
216
|
+
* requires: it can only refuse a Session that some connection has explicitly
|
|
217
|
+
* claimed, and a client that never claims — every client that predates this —
|
|
218
|
+
* meets an unlocked Session and is served exactly as it is today. `code` is
|
|
219
|
+
* optional and absent from every error frame that shipped before it, so a client
|
|
220
|
+
* that has never heard of it reads the same `message` it always did.
|
|
221
|
+
*
|
|
222
|
+
* Issue 145 publishes that lock state — the optional `lock` on
|
|
223
|
+
* {@link CoreLinkTaskSnapshot} and {@link CoreLinkSessionSnapshot}, and the
|
|
224
|
+
* {@link SESSION_LOCK_CHANGED_EVENT_KIND} event — and does NOT move this version
|
|
225
|
+
* either (ADR 0024 D11), for the fourth time and the same reason. Note that
|
|
226
|
+
* issue 84 *did* bump for snapshot fields, and the difference is the rule
|
|
227
|
+
* itself: a Panel that predated `titleManuallySet` synthesized `false` and
|
|
228
|
+
* rendered a Session its Core's generator could rename out from under the
|
|
229
|
+
* operator — the absence yielded something *lesser* than today. A Panel that
|
|
230
|
+
* predates `lock` ignores an unknown field and renders exactly what it renders
|
|
231
|
+
* today, because read-only rendering is new surface (#147) rather than a
|
|
232
|
+
* protection quietly going missing; a new Panel against a Core that omits the
|
|
233
|
+
* field reads "no lock table here", which is that Core, truthfully. The event
|
|
234
|
+
* kind is additive in the way every kind before it was: a client routes on kinds
|
|
235
|
+
* it knows and ignores the rest.
|
|
236
|
+
*
|
|
237
|
+
* Issue 146 adds the `reclaim` frame and its `reclaimResult` — and does NOT
|
|
238
|
+
* move this version either (ADR 0024 D11), for the fifth time and the same
|
|
239
|
+
* reason. The frame is gated by the `multiConnection` capability, as #142 and
|
|
240
|
+
* #144 are, so it is never put on the wire to a Core with no lock table to
|
|
241
|
+
* transfer out of — and a Core that predates the capability evicts every client
|
|
242
|
+
* but one on connect, which is the reclaim the frame would have asked it for.
|
|
243
|
+
* The client that presents no id — every client that shipped before this — is
|
|
244
|
+
* served exactly as it is today: its lost socket is reaped by the heartbeat 45s
|
|
245
|
+
* later, still the backstop for a client that never comes back. What the frame
|
|
246
|
+
* buys is those 45 seconds for the client that does come back, so its absence
|
|
247
|
+
* is slower rather than lesser, which is the rule. `clientId` is not identity
|
|
248
|
+
* and carries no authority a connection did not already have (D10), so there is
|
|
249
|
+
* nothing here for an older client to be missing.
|
|
250
|
+
*/
|
|
251
|
+
export const CORE_LINK_PROTOCOL_VERSION = "0.15.0";
|
|
252
|
+
/**
|
|
253
|
+
* Does a Core advertising `reported` speak this build's core-link?
|
|
254
|
+
*
|
|
255
|
+
* The rule is major.minor equality, and it is deliberately blunt: ADR 0005 says
|
|
256
|
+
* the Panel carries no feature detection, so there is no "mostly compatible"
|
|
257
|
+
* state to describe. A Core is either speaking this vocabulary or it is a chore
|
|
258
|
+
* — one command on that machine — and the Panel says so rather than degrading.
|
|
259
|
+
* Patch is ignored because the version above only moves on wire changes;
|
|
260
|
+
* reserving the patch segment for fixes that touch no frame keeps a
|
|
261
|
+
* behaviour-only release from grounding a fleet.
|
|
262
|
+
*
|
|
263
|
+
* A missing or unparseable version is incompatible: every Core that speaks
|
|
264
|
+
* a version the Panel could accept says so in its `ready` frame, so silence is
|
|
265
|
+
* evidence of something older than the frame that carries it.
|
|
266
|
+
*/
|
|
267
|
+
export function coreLinkProtocolCompatible(reported) {
|
|
268
|
+
const theirs = parseMajorMinor(reported);
|
|
269
|
+
if (!theirs)
|
|
270
|
+
return false;
|
|
271
|
+
const ours = parseMajorMinor(CORE_LINK_PROTOCOL_VERSION);
|
|
272
|
+
if (!ours)
|
|
273
|
+
return false;
|
|
274
|
+
return theirs.major === ours.major && theirs.minor === ours.minor;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Read the `multiConnection` capability off a raw `ready` frame, or null.
|
|
278
|
+
*
|
|
279
|
+
* Null for every shape that is not exactly `{ version: 1 }` — absent, a
|
|
280
|
+
* non-object, or a version this build does not know. An unrecognised future
|
|
281
|
+
* version reads as absent on purpose: the safe fallback is the single-connection
|
|
282
|
+
* behaviour that predates the capability, never a guess at what a higher version
|
|
283
|
+
* means. Unlike {@link coreLinkProtocolCompatible}, nothing here can mark a Core
|
|
284
|
+
* incompatible — a null answer withholds frames, it does not fail a Core.
|
|
285
|
+
*/
|
|
286
|
+
export function readMultiConnectionCapability(raw) {
|
|
287
|
+
if (!raw || typeof raw !== "object")
|
|
288
|
+
return null;
|
|
289
|
+
const version = raw.version;
|
|
290
|
+
return version === 1 ? { version: 1 } : null;
|
|
291
|
+
}
|
|
292
|
+
function parseMajorMinor(version) {
|
|
293
|
+
if (typeof version !== "string")
|
|
294
|
+
return null;
|
|
295
|
+
const m = /^(\d+)\.(\d+)\.(\d+)$/.exec(version.trim());
|
|
296
|
+
if (!m)
|
|
297
|
+
return null;
|
|
298
|
+
return { major: Number(m[1]), minor: Number(m[2]) };
|
|
299
|
+
}
|
|
300
|
+
const REQUEST_FRAME_TYPES = new Set([
|
|
301
|
+
"spawn",
|
|
302
|
+
"write",
|
|
303
|
+
"resize",
|
|
304
|
+
"kill",
|
|
305
|
+
"killLaunchProcesses",
|
|
306
|
+
"findByTask",
|
|
307
|
+
"replay",
|
|
308
|
+
"subscribe",
|
|
309
|
+
"ptySubscribe",
|
|
310
|
+
"ptyUnsubscribe",
|
|
311
|
+
"claim",
|
|
312
|
+
"release",
|
|
313
|
+
"forceTakeover",
|
|
314
|
+
"reclaim",
|
|
315
|
+
"tasksList",
|
|
316
|
+
"archivedTasksList",
|
|
317
|
+
"tasksMutate",
|
|
318
|
+
"harnessPrompt",
|
|
319
|
+
"projectsList",
|
|
320
|
+
"projectsMutate",
|
|
321
|
+
"sessionsList",
|
|
322
|
+
"hooksOp",
|
|
323
|
+
"auth",
|
|
324
|
+
"agentsAvailabilityList",
|
|
325
|
+
"harnessInstall",
|
|
326
|
+
"dirList",
|
|
327
|
+
"dirCreate",
|
|
328
|
+
]);
|
|
329
|
+
/** Parse and validate a raw WS message into a known request frame, or null. */
|
|
330
|
+
export function parseCoreLinkRequestFrame(raw) {
|
|
331
|
+
let msg;
|
|
332
|
+
try {
|
|
333
|
+
msg = JSON.parse(raw);
|
|
334
|
+
}
|
|
335
|
+
catch {
|
|
336
|
+
return null;
|
|
337
|
+
}
|
|
338
|
+
if (!msg || typeof msg !== "object")
|
|
339
|
+
return null;
|
|
340
|
+
const type = msg.type;
|
|
341
|
+
if (typeof type !== "string")
|
|
342
|
+
return null;
|
|
343
|
+
return REQUEST_FRAME_TYPES.has(type) ? msg : null;
|
|
344
|
+
}
|
|
345
|
+
/** Serialize a server frame for sending over the WebSocket. */
|
|
346
|
+
export function serializeCoreLinkFrame(frame) {
|
|
347
|
+
return JSON.stringify(frame);
|
|
348
|
+
}
|
|
349
|
+
//# sourceMappingURL=core-link-frames.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-link-frames.js","sourceRoot":"","sources":["../src/core-link-frames.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,iBAAiB;AACjB,EAAE;AACF,6EAA6E;AAC7E,gFAAgF;AAChF,0EAA0E;AAC1E,6EAA6E;AAC7E,2EAA2E;AAC3E,yCAAyC;AACzC,EAAE;AACF,4EAA4E;AAC5E,0EAA0E;AAC1E,gDAAgD;AAChD,EAAE;AACF,yEAAyE;AACzE,uEAAuE;AACvE,4EAA4E;AAC5E,EAAE;AACF,8EAA8E;AAC9E,8EAA8E;AAC9E,gEAAgE;AAChE,2EAA2E;AAC3E,kEAAkE;AAClE,0EAA0E;AAC1E,oEAAoE;AACpE,EAAE;AACF,8EAA8E;AAC9E,oDAAoD;AA0TpD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,4BAA4B,CAAC;AAgC9E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,uBAAuB,CAAC;AAgDzE,+EAA+E;AAC/E,EAAE;AACF,qEAAqE;AACrE,8EAA8E;AAC9E,2EAA2E;AAC3E,qEAAqE;AACrE,4EAA4E;AAC5E,+EAA+E;AAC/E,yBAAyB;AACzB,EAAE;AACF,2EAA2E;AAC3E,gFAAgF;AAChF,+EAA+E;AAC/E,sEAAsE;AACtE,gDAAgD;AAChD,EAAE;AACF,4EAA4E;AAC5E,kEAAkE;AAClE,iFAAiF;AACjF,gFAAgF;AAChF,0DAA0D;AAC1D,EAAE;AACF,+EAA+E;AAC/E,2EAA2E;AAC3E,EAAE;AACF,+EAA+E;AAC/E,iFAAiF;AACjF,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AAsB,CAAC,KAA0B;IAC/D,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The socket surface a core link needs. A subset of both the `ws` client and
|
|
3
|
+
* the platform `WebSocket`, plus the two Node-only affordances the heartbeat is
|
|
4
|
+
* built on — see {@link CoreLinkSocket.ping} and
|
|
5
|
+
* {@link CoreLinkSocket.terminate}.
|
|
6
|
+
*/
|
|
7
|
+
export interface CoreLinkSocket {
|
|
8
|
+
/** `0` connecting, `1` open, `2` closing, `3` closed — the WebSocket values. */
|
|
9
|
+
readonly readyState: number;
|
|
10
|
+
send(data: string): void;
|
|
11
|
+
close(): void;
|
|
12
|
+
on(event: "open", cb: () => void): void;
|
|
13
|
+
on(event: "message", cb: (data: unknown) => void): void;
|
|
14
|
+
on(event: "close", cb: () => void): void;
|
|
15
|
+
on(event: "error", cb: (err: Error) => void): void;
|
|
16
|
+
/**
|
|
17
|
+
* Pong frames (Node `ws` only). A transport registers for them
|
|
18
|
+
* unconditionally; an adapter that has no pongs to report simply drops the
|
|
19
|
+
* registration, which is correct — a browser engine answers pings itself and
|
|
20
|
+
* never surfaces them.
|
|
21
|
+
*/
|
|
22
|
+
on(event: "pong", cb: () => void): void;
|
|
23
|
+
/**
|
|
24
|
+
* Send a WS ping frame. Present on the Node (`ws`) transport a Core client
|
|
25
|
+
* dials with; absent on a plain browser WebSocket. **Its presence is what
|
|
26
|
+
* arms the heartbeat** — see {@link CoreLinkTransport}.
|
|
27
|
+
*/
|
|
28
|
+
ping?: () => void;
|
|
29
|
+
/**
|
|
30
|
+
* Destroy the socket immediately, with no close handshake. Used when the
|
|
31
|
+
* heartbeat declares the peer dead: a half-open TCP connection will never
|
|
32
|
+
* complete a graceful close, so waiting for one only extends the outage.
|
|
33
|
+
*/
|
|
34
|
+
terminate?: () => void;
|
|
35
|
+
}
|
|
36
|
+
/** A socket factory. The seam every test and every exotic runtime goes through. */
|
|
37
|
+
export type CoreLinkSocketFactory = (url: string) => CoreLinkSocket;
|
|
38
|
+
/** The PEM material a `wss://` core link is dialed with (ADR 0002). */
|
|
39
|
+
export type CoreLinkTlsMaterial = {
|
|
40
|
+
/** PEM CA cert that signed the Core's server cert. Pinned by the client. */
|
|
41
|
+
ca: string;
|
|
42
|
+
/** PEM client cert presented to the Core in the mTLS handshake. */
|
|
43
|
+
cert: string;
|
|
44
|
+
/** PEM private key for {@link CoreLinkTlsMaterial.cert}. */
|
|
45
|
+
key: string;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Dial a `ws://` or `wss://` core link from a Node process. With `tls` the
|
|
49
|
+
* `wss://` handshake pins the Core's CA and presents the client cert (mTLS);
|
|
50
|
+
* `rejectUnauthorized: true` refuses an unknown CA, so a fake Core presenting
|
|
51
|
+
* any other cert never gets past the handshake.
|
|
52
|
+
*/
|
|
53
|
+
export declare function createNodeCoreLinkSocket(url: string, tls?: CoreLinkTlsMaterial): CoreLinkSocket;
|
|
54
|
+
//# sourceMappingURL=core-link-socket.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-link-socket.d.ts","sourceRoot":"","sources":["../src/core-link-socket.ts"],"names":[],"mappings":"AAsBA;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,gFAAgF;IAChF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,IAAI,IAAI,CAAC;IACd,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IACxC,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI,CAAC;IACxD,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IACzC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,GAAG,IAAI,CAAC;IACnD;;;;;OAKG;IACH,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IACxC;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,IAAI,CAAC;IAClB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,mFAAmF;AACnF,MAAM,MAAM,qBAAqB,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,cAAc,CAAC;AAEpE,uEAAuE;AACvE,MAAM,MAAM,mBAAmB,GAAG;IAChC,4EAA4E;IAC5E,EAAE,EAAE,MAAM,CAAC;IACX,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,4DAA4D;IAC5D,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,mBAAmB,GAAG,cAAc,CAa/F"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// The socket under a core link, and the Node dial that opens one.
|
|
2
|
+
//
|
|
3
|
+
// Extracted from the Panel's `core-link/node-socket.ts` and the `WebSocketLike`
|
|
4
|
+
// interface that lived in its client (issue 153, #129 D1). Both were deleted in
|
|
5
|
+
// #156, when the Panel started dialing with this package instead. The client is
|
|
6
|
+
// transport-agnostic on purpose: {@link CoreLinkSocket} is the whole of what
|
|
7
|
+
// {@link CoreLinkTransport} needs, so one transport drives the real `wss://`
|
|
8
|
+
// dial below, a loopback `ws://`, and an in-memory pair in a test.
|
|
9
|
+
//
|
|
10
|
+
// A Core requires mutual TLS with a pinned client cert + CA (ADR 0002), which
|
|
11
|
+
// no browser WebSocket can present — Chromium uses the OS cert store, not
|
|
12
|
+
// per-connection certs. That is why a Core client is a Node program: it dials
|
|
13
|
+
// with the `ws` package, handing `ca`/`cert`/`key` straight to TLS. The Panel
|
|
14
|
+
// terminates its links in its service for exactly this reason (ADR 0012), and
|
|
15
|
+
// the `actana` CLI is a Node process for the same one.
|
|
16
|
+
//
|
|
17
|
+
// This module is the only place in the SDK that imports `ws`, so a consumer
|
|
18
|
+
// that brings its own socket (a test, a runtime with a different WebSocket)
|
|
19
|
+
// never has to.
|
|
20
|
+
import { WebSocket as NodeWebSocket } from "ws";
|
|
21
|
+
/**
|
|
22
|
+
* Dial a `ws://` or `wss://` core link from a Node process. With `tls` the
|
|
23
|
+
* `wss://` handshake pins the Core's CA and presents the client cert (mTLS);
|
|
24
|
+
* `rejectUnauthorized: true` refuses an unknown CA, so a fake Core presenting
|
|
25
|
+
* any other cert never gets past the handshake.
|
|
26
|
+
*/
|
|
27
|
+
export function createNodeCoreLinkSocket(url, tls) {
|
|
28
|
+
const options = tls
|
|
29
|
+
? { ca: tls.ca, cert: tls.cert, key: tls.key, rejectUnauthorized: true, noDelay: true }
|
|
30
|
+
: { noDelay: true };
|
|
31
|
+
const ws = new NodeWebSocket(url, options);
|
|
32
|
+
return adaptNodeWs(ws);
|
|
33
|
+
}
|
|
34
|
+
function adaptNodeWs(ws) {
|
|
35
|
+
return {
|
|
36
|
+
get readyState() {
|
|
37
|
+
return ws.readyState;
|
|
38
|
+
},
|
|
39
|
+
send: (data) => ws.send(data),
|
|
40
|
+
close: () => ws.close(),
|
|
41
|
+
// The heartbeat surface (see CoreLinkTransport): a remote core link crosses
|
|
42
|
+
// NATs and firewalls that silently reap idle flows, and an agent parked at
|
|
43
|
+
// its prompt is idle for minutes at a time. Ping keeps the flow warm; pong
|
|
44
|
+
// proves liveness; terminate tears down a half-open socket that would never
|
|
45
|
+
// complete a graceful close.
|
|
46
|
+
ping: () => {
|
|
47
|
+
try {
|
|
48
|
+
ws.ping();
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
/* socket already closing — the close handler covers it */
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
terminate: () => ws.terminate(),
|
|
55
|
+
on: (event, cb) => {
|
|
56
|
+
if (event === "open") {
|
|
57
|
+
ws.on("open", () => cb());
|
|
58
|
+
}
|
|
59
|
+
else if (event === "message") {
|
|
60
|
+
ws.on("message", (data) => cb(data));
|
|
61
|
+
}
|
|
62
|
+
else if (event === "close") {
|
|
63
|
+
ws.on("close", () => cb());
|
|
64
|
+
}
|
|
65
|
+
else if (event === "error") {
|
|
66
|
+
ws.on("error", (err) => cb(err));
|
|
67
|
+
}
|
|
68
|
+
else if (event === "pong") {
|
|
69
|
+
ws.on("pong", () => cb());
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=core-link-socket.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-link-socket.js","sourceRoot":"","sources":["../src/core-link-socket.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF,gFAAgF;AAChF,6EAA6E;AAC7E,6EAA6E;AAC7E,mEAAmE;AACnE,EAAE;AACF,8EAA8E;AAC9E,0EAA0E;AAC1E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,uDAAuD;AACvD,EAAE;AACF,4EAA4E;AAC5E,4EAA4E;AAC5E,gBAAgB;AAEhB,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,IAAI,CAAC;AAmDhD;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CAAC,GAAW,EAAE,GAAyB;IAQ7E,MAAM,OAAO,GAAkB,GAAG;QAChC,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,kBAAkB,EAAE,IAAI,EA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