@treestructuredplanning/gateway 0.1.1 → 0.1.3
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 +49 -29
- package/dist/cli.js +79 -49
- package/dist/gateway-schema.json +117 -10
- package/dist/{shared-3OFEPCJI.js → shared-RM5C4AZN.js} +3008 -983
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
# TSP gateway
|
|
2
2
|
|
|
3
3
|
The TSP gateway lets the [Tree-Structured Planning](https://treestructuredplanning.com)
|
|
4
|
-
(TSP) canvas start, stop and resume Claude Code and
|
|
4
|
+
(TSP) canvas start, stop and resume Claude Code, Codex and Cursor sessions on your computer, in the
|
|
5
5
|
repository folders you register. It runs in the background under your own user account and
|
|
6
6
|
only connects outward to TSP.
|
|
7
7
|
|
|
8
8
|
## Requirements
|
|
9
9
|
|
|
10
10
|
- Node.js **22 or newer**.
|
|
11
|
-
- Claude Code,
|
|
12
|
-
own login (`codex login` for Codex
|
|
11
|
+
- Claude Code, Codex **0.162.1 or newer**, or the Cursor CLI **2026.10.19 or newer**,
|
|
12
|
+
installed separately and signed in with its own login (`codex login` for Codex,
|
|
13
|
+
`agent login` for Cursor). The gateway never signs in for you.
|
|
13
14
|
- Each folder you register must be a local clone with a GitHub remote, and the harness must
|
|
14
|
-
trust it: run `claude` or `
|
|
15
|
-
sessions never start in a folder
|
|
15
|
+
trust it: run `claude`, `codex` or `agent` in the folder once and accept its trust prompt.
|
|
16
|
+
Codex and Cursor sessions never start in a folder they have not trusted, and trusting a parent folder does not
|
|
16
17
|
count for a repository inside it.
|
|
17
18
|
- On Linux, a running Secret Service such as GNOME Keyring or KWallet. The gateway will not
|
|
18
19
|
run without an OS credential store.
|
|
19
20
|
- Build must be available for your TSP account.
|
|
20
21
|
|
|
21
|
-
`connect` and `tsp-gateway status`
|
|
22
|
-
installing or signing in to a harness or accepting its trust prompt.
|
|
22
|
+
`connect` and `tsp-gateway status` say which harnesses can build in each folder and what is left to
|
|
23
|
+
you: installing or signing in to a harness, or accepting its trust prompt. Once one harness is ready
|
|
24
|
+
in a folder, steps for your other harnesses are optional.
|
|
23
25
|
|
|
24
26
|
## Connect this computer
|
|
25
27
|
|
|
@@ -39,8 +41,9 @@ it again is safe:
|
|
|
39
41
|
kept.
|
|
40
42
|
3. It registers the folder.
|
|
41
43
|
4. It installs a login item that starts the gateway when you log in.
|
|
42
|
-
5. It prints
|
|
43
|
-
harness, sign in, or run
|
|
44
|
+
5. It prints a short summary: which harnesses are ready in each folder, and the steps only you can
|
|
45
|
+
take (install a harness, sign in, or run it there once to accept its trust prompt). They are
|
|
46
|
+
required until one harness is ready, and optional after that.
|
|
44
47
|
|
|
45
48
|
Run outside any clone, `connect` keeps the folders already registered and repairs the rest,
|
|
46
49
|
so it also fixes a stopped, outdated or revoked gateway. If TSP cannot be reached, nothing
|
|
@@ -71,19 +74,20 @@ With a global install (`npm install --global @treestructuredplanning/gateway@lat
|
|
|
71
74
|
command is `tsp-gateway`; with `npx`, use `npx -y @treestructuredplanning/gateway@latest`
|
|
72
75
|
in its place.
|
|
73
76
|
|
|
74
|
-
| Command
|
|
75
|
-
|
|
|
76
|
-
| `connect [folder]`
|
|
77
|
-
| `disconnect`
|
|
78
|
-
| `pair`
|
|
79
|
-
| `add <folder>`
|
|
80
|
-
| `remove <owner/name>`
|
|
81
|
-
| `configure-launch '<json>'`
|
|
82
|
-
| `
|
|
83
|
-
| `
|
|
84
|
-
| `
|
|
85
|
-
| `
|
|
86
|
-
| `
|
|
77
|
+
| Command | What it does |
|
|
78
|
+
| ----------------------------- | ------------------------------------------------------------------------------- |
|
|
79
|
+
| `connect [folder]` | Pair if needed, register the folder, install the login item, print a summary. |
|
|
80
|
+
| `disconnect` | Remove the login item, then unpair. |
|
|
81
|
+
| `pair` | Pair this computer with your TSP account (replaces any existing pairing). |
|
|
82
|
+
| `add <folder>` | Register a repository folder. |
|
|
83
|
+
| `remove <owner/name>` | Unregister a repository. |
|
|
84
|
+
| `configure-launch '<json>'` | Set how sessions get your shell environment (see below). |
|
|
85
|
+
| `configure-reporting <level>` | `activity` (default) or `off`: whether session activity is sent to TSP. |
|
|
86
|
+
| `status [--json]` | Show pairing, connection and each folder's next steps; `--json` is for scripts. |
|
|
87
|
+
| `start` | Run the gateway in the foreground. Ctrl-C stops it, not your sessions. |
|
|
88
|
+
| `install` | Install or refresh the login item. Run it again after upgrading the gateway. |
|
|
89
|
+
| `uninstall` | Remove the login item; keep the pairing and folders. |
|
|
90
|
+
| `unpair` | Revoke this computer's pairing in TSP and delete the stored credential. |
|
|
87
91
|
|
|
88
92
|
Registering or removing a folder takes effect in the running gateway without a restart.
|
|
89
93
|
|
|
@@ -91,7 +95,7 @@ Registering or removing a folder takes effect in the running gateway without a r
|
|
|
91
95
|
|
|
92
96
|
TSP can ask the gateway for exactly four things, and only in folders you registered:
|
|
93
97
|
|
|
94
|
-
- **Launch** a Claude Code or
|
|
98
|
+
- **Launch** a Claude Code, Codex or Cursor session, with a prompt describing the TSP work you
|
|
95
99
|
started from the canvas.
|
|
96
100
|
- **Stop** that session.
|
|
97
101
|
- **Resume** that session, with the text you typed. With no text, a stopped session gets the
|
|
@@ -100,17 +104,20 @@ TSP can ask the gateway for exactly four things, and only in folders you registe
|
|
|
100
104
|
- **Report status**: which harnesses are installed, signed in and trust each registered
|
|
101
105
|
folder, and how each launched session is doing.
|
|
102
106
|
|
|
103
|
-
Only your own clicks in TSP send a prompt.
|
|
107
|
+
Only your own clicks in TSP send a prompt. Claude Code and Codex sessions keep running if the
|
|
108
|
+
gateway stops; a Cursor session ends with the gateway, and Resume reopens its chat. A
|
|
104
109
|
session that finishes does not mean TSP has reviewed or accepted its work. Keep the
|
|
105
110
|
[TSP plugin](https://github.com/WebifyServices/tsp-plugin) installed so launched sessions
|
|
106
111
|
have TSP's tools.
|
|
107
112
|
|
|
108
113
|
The gateway never:
|
|
109
114
|
|
|
110
|
-
- changes your Claude Code or
|
|
115
|
+
- changes your Claude Code, Codex or Cursor settings, permissions or configuration, or passes any
|
|
111
116
|
flag that bypasses them. Your own settings govern every session.
|
|
112
117
|
- answers an approval prompt or question inside a session. When a session needs you, TSP
|
|
113
|
-
shows the command to open it yourself (`claude attach <id>` or `codex resume <id>`).
|
|
118
|
+
shows the command to open it yourself (`claude attach <id>` or `codex resume <id>`). A Cursor
|
|
119
|
+
session waiting on a prompt stays waiting until you Stop it, which answers the prompt
|
|
120
|
+
"cancelled"; the gateway never selects an option.
|
|
114
121
|
- signs in, accepts a trust prompt, or approves pairing for you.
|
|
115
122
|
- accepts a shell command, program, folder, file path or environment variable from TSP.
|
|
116
123
|
- runs anything in a folder you have not registered, or starts Codex in a folder Codex does
|
|
@@ -119,12 +126,23 @@ The gateway never:
|
|
|
119
126
|
For Codex, sessions run in Codex's own background service, which the gateway starts when
|
|
120
127
|
needed and never stops.
|
|
121
128
|
|
|
129
|
+
For Cursor, the gateway runs `agent --version` and `agent status` to read the installed version
|
|
130
|
+
and whether you are signed in, and `agent acp` (Cursor's Agent Client Protocol mode) as its own
|
|
131
|
+
child process for each running turn. It sends no mode, model, permission or sign-in request.
|
|
132
|
+
Cursor applies your own settings and permission rules, and the gateway starts a session only in a
|
|
133
|
+
folder you have already trusted.
|
|
134
|
+
|
|
122
135
|
## What leaves your computer
|
|
123
136
|
|
|
124
137
|
The gateway sends TSP only repository names (`owner/name`), which harnesses are available,
|
|
125
138
|
signed in and trusted per folder, and session status, including any waiting message with
|
|
126
|
-
folder paths removed.
|
|
127
|
-
|
|
139
|
+
folder paths removed. For each launched session it also sends what the session is doing
|
|
140
|
+
(reading, editing, running a command), when it was last active, and counts of files edited
|
|
141
|
+
and commands run; never file names or commands. When a Cursor turn finishes it also sends what
|
|
142
|
+
Cursor last said, trimmed to 240 characters with folder paths removed, so TSP can show it; no
|
|
143
|
+
other transcript text is sent. Folder paths, environment variables, command lines, transcripts
|
|
144
|
+
and raw error output stay on your computer. Run
|
|
145
|
+
`tsp-gateway configure-reporting off` to stop sending activity (`activity` turns it back on).
|
|
128
146
|
|
|
129
147
|
The gateway only connects outward, to TSP, and accepts no inbound connections. The only
|
|
130
148
|
exception is pairing: while you approve in the browser, it listens briefly on `127.0.0.1`
|
|
@@ -143,7 +161,9 @@ Supported shells are bash, zsh, ksh, fish, csh, tcsh and sh. With any other shel
|
|
|
143
161
|
the gateway falls back to `/bin/sh`, then to starting the harness directly. On Windows the
|
|
144
162
|
harness always starts directly and PowerShell or cmd profiles are not loaded. Your shell
|
|
145
163
|
startup must finish quickly, must not wait for input, and must not redirect its own output to
|
|
146
|
-
a file or terminal.
|
|
164
|
+
a file or terminal. If it takes longer than 10 seconds, for example on a busy computer, the
|
|
165
|
+
session starts with the environment your shell gave the gateway last time; the first time, the
|
|
166
|
+
gateway waits up to 30 seconds before it gives up.
|
|
147
167
|
|
|
148
168
|
Change this with `configure-launch`, which sets the `launch` section of the gateway's config
|
|
149
169
|
file. Omitted settings use defaults:
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
|
+
ActivityReporter,
|
|
4
5
|
Commands,
|
|
5
6
|
GATEWAY_CLOSE_DISPOSITION,
|
|
6
7
|
GatewayStatus,
|
|
@@ -11,12 +12,15 @@ import {
|
|
|
11
12
|
awaitDaemonConnection,
|
|
12
13
|
builtinHarnesses,
|
|
13
14
|
connect,
|
|
15
|
+
connectLines,
|
|
14
16
|
daemonConnection,
|
|
15
17
|
daemonLock,
|
|
16
18
|
decodeLaunchConfig,
|
|
19
|
+
decodeReporting,
|
|
17
20
|
disconnect,
|
|
18
21
|
execute,
|
|
19
22
|
field,
|
|
23
|
+
folderSetups,
|
|
20
24
|
installLoginItem,
|
|
21
25
|
isObject,
|
|
22
26
|
keychain,
|
|
@@ -26,15 +30,15 @@ import {
|
|
|
26
30
|
privateDirectory,
|
|
27
31
|
readConfig,
|
|
28
32
|
readLaunchObservation,
|
|
29
|
-
remainingSteps,
|
|
30
33
|
removeLoginItem,
|
|
31
34
|
runDaemon,
|
|
32
35
|
saveConfig,
|
|
36
|
+
statusLines,
|
|
33
37
|
unpairMachine,
|
|
34
38
|
validSlug,
|
|
35
39
|
validateOrigin,
|
|
36
40
|
watchConfig
|
|
37
|
-
} from "./shared-
|
|
41
|
+
} from "./shared-RM5C4AZN.js";
|
|
38
42
|
|
|
39
43
|
// src/cli.ts
|
|
40
44
|
import { readFile } from "node:fs/promises";
|
|
@@ -46,7 +50,7 @@ import { parseArgs } from "node:util";
|
|
|
46
50
|
// package.json
|
|
47
51
|
var package_default = {
|
|
48
52
|
name: "@treestructuredplanning/gateway",
|
|
49
|
-
version: "0.1.
|
|
53
|
+
version: "0.1.3",
|
|
50
54
|
description: "Outbound local harness gateway for Tree-Structured Planning",
|
|
51
55
|
type: "module",
|
|
52
56
|
engines: {
|
|
@@ -105,6 +109,7 @@ async function runLocal(loginPath, paths, config, version) {
|
|
|
105
109
|
const stop = () => abort.abort();
|
|
106
110
|
process.once("SIGINT", stop);
|
|
107
111
|
process.once("SIGTERM", stop);
|
|
112
|
+
let drivers;
|
|
108
113
|
try {
|
|
109
114
|
const journal = new Journal(join(paths.state, `${pairing.machine_id}-receipts.jsonl`));
|
|
110
115
|
await journal.load();
|
|
@@ -120,15 +125,19 @@ async function runLocal(loginPath, paths, config, version) {
|
|
|
120
125
|
}
|
|
121
126
|
});
|
|
122
127
|
const status = new GatewayStatus(join(paths.state, "status.json"), executor);
|
|
123
|
-
|
|
124
|
-
|
|
128
|
+
drivers = builtinHarnesses(environment, executor, join(paths.state, "acp-groups.json"));
|
|
129
|
+
await drivers.reap();
|
|
130
|
+
const registry = drivers;
|
|
131
|
+
const commands = new Commands(journal, registry, repositories, {
|
|
132
|
+
activity: new ActivityReporter(async () => (await readConfig(paths.config)).reporting)
|
|
133
|
+
});
|
|
125
134
|
await runDaemon({
|
|
126
135
|
pairing,
|
|
127
136
|
version,
|
|
128
|
-
drivers,
|
|
137
|
+
drivers: registry,
|
|
129
138
|
commands,
|
|
130
139
|
tokens: new OAuthTokens(pairing, keychain(pairing.origin)),
|
|
131
|
-
repositories: async () =>
|
|
140
|
+
repositories: async () => registry.repositories(await repositories()),
|
|
132
141
|
watchFacts: (changed) => watchConfig(paths.config, () => {
|
|
133
142
|
executor.invalidate();
|
|
134
143
|
changed();
|
|
@@ -140,10 +149,11 @@ async function runLocal(loginPath, paths, config, version) {
|
|
|
140
149
|
} finally {
|
|
141
150
|
process.removeListener("SIGINT", stop);
|
|
142
151
|
process.removeListener("SIGTERM", stop);
|
|
152
|
+
await drivers?.dispose();
|
|
143
153
|
await release();
|
|
144
154
|
}
|
|
145
155
|
}
|
|
146
|
-
async function
|
|
156
|
+
async function readStatus(paths, config, drivers, executor, idle = "Not running") {
|
|
147
157
|
const connection = await daemonConnection(join(paths.state, "status.json")) ?? idle;
|
|
148
158
|
let daemonLaunch = null;
|
|
149
159
|
let lastMessage = null;
|
|
@@ -161,25 +171,42 @@ async function printStatus(paths, config, drivers, executor, idle = "Not running
|
|
|
161
171
|
lastMessage = field(status, "message");
|
|
162
172
|
} catch {
|
|
163
173
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
174
|
+
return {
|
|
175
|
+
paired: config.pairing !== null,
|
|
176
|
+
machine_id: config.pairing?.machine_id ?? null,
|
|
177
|
+
connection,
|
|
178
|
+
last_message: lastMessage,
|
|
179
|
+
close_code: closeCode,
|
|
180
|
+
close_disposition: closeDisposition,
|
|
181
|
+
harnesses: await drivers.detect(),
|
|
182
|
+
launch: await executor.status(),
|
|
183
|
+
launch_source: "status-probe",
|
|
184
|
+
last_daemon_launch: daemonLaunch,
|
|
185
|
+
repositories: Object.keys(config.repositories),
|
|
186
|
+
reporting: config.reporting
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
function harnessName(drivers) {
|
|
190
|
+
return (harness) => drivers.get(harness).displayName;
|
|
191
|
+
}
|
|
192
|
+
async function printStatus(paths, config, drivers, executor, json) {
|
|
193
|
+
const status = await readStatus(paths, config, drivers, executor);
|
|
194
|
+
if (json) {
|
|
195
|
+
console.log(JSON.stringify(status, null, 2));
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
const view = machineView(status);
|
|
199
|
+
const setups = await folderSetups(drivers, config, null);
|
|
200
|
+
for (const line of statusLines(view, setups, harnessName(drivers))) console.log(line);
|
|
201
|
+
}
|
|
202
|
+
function machineView(status) {
|
|
203
|
+
return {
|
|
204
|
+
machineId: status.machine_id,
|
|
205
|
+
connection: status.connection,
|
|
206
|
+
lastMessage: status.last_message,
|
|
207
|
+
launch: status.launch,
|
|
208
|
+
reporting: status.reporting
|
|
209
|
+
};
|
|
183
210
|
}
|
|
184
211
|
function startupOptions(args, version) {
|
|
185
212
|
const options = args[0] === "start" ? parseArgs({
|
|
@@ -220,37 +247,30 @@ async function configureLaunch(args, config, path) {
|
|
|
220
247
|
await saveConfig(path, config);
|
|
221
248
|
console.log("Launch settings saved. The running gateway picks up the change automatically.");
|
|
222
249
|
}
|
|
223
|
-
function
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
outcome.loginItem === "current" ? `The login item already runs tsp-gateway ${version}.` : `Installed tsp-gateway ${version} as a login item.`
|
|
231
|
-
];
|
|
250
|
+
async function configureReporting(args, config, path) {
|
|
251
|
+
if (args.length !== 2) throw new Error("Usage: tsp-gateway configure-reporting <activity|off>");
|
|
252
|
+
config.reporting = decodeReporting(args[1]);
|
|
253
|
+
await saveConfig(path, config);
|
|
254
|
+
console.log(
|
|
255
|
+
config.reporting === "off" ? "Reporting off: TSP shows your sessions' state only. The running gateway picks up the change automatically." : "Reporting activity: TSP shows what your sessions are doing, without file names, commands or text. The running gateway picks up the change automatically."
|
|
256
|
+
);
|
|
232
257
|
}
|
|
233
258
|
var VERBS = {
|
|
234
|
-
connect: async ({ args, argument, config,
|
|
259
|
+
connect: async ({ args, argument, config, host, paths, drivers, executor }) => {
|
|
235
260
|
if (args.length > 2) throw new Error("Usage: tsp-gateway connect [folder]");
|
|
236
261
|
const since = Date.now();
|
|
237
262
|
const outcome = await connect(host, config, argument);
|
|
238
|
-
for (const line of connectSummary(outcome, config, version)) console.log(line);
|
|
239
263
|
const reported = outcome.loginItem === "installed" ? await awaitDaemonConnection(join(paths.state, "status.json"), since) : null;
|
|
240
|
-
await
|
|
264
|
+
const status = await readStatus(
|
|
241
265
|
paths,
|
|
242
266
|
config,
|
|
243
267
|
drivers,
|
|
244
268
|
executor,
|
|
245
269
|
outcome.loginItem === "installed" && reported === null ? "Starting" : void 0
|
|
246
270
|
);
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
remaining.length === 1 ? "Remaining step:" : "Remaining steps:",
|
|
251
|
-
...remaining
|
|
252
|
-
].join("\n") : "Connected. Nothing left to do on this computer."
|
|
253
|
-
);
|
|
271
|
+
const setups = await folderSetups(drivers, config, outcome.repository);
|
|
272
|
+
for (const line of connectLines(machineView(status), setups, harnessName(drivers)))
|
|
273
|
+
console.log(line);
|
|
254
274
|
},
|
|
255
275
|
disconnect: async ({ args, host, config }) => {
|
|
256
276
|
if (args.length !== 1) throw new Error("Usage: tsp-gateway disconnect");
|
|
@@ -278,7 +298,13 @@ var VERBS = {
|
|
|
278
298
|
console.log("Repository removed. The running gateway picks up the change automatically.");
|
|
279
299
|
},
|
|
280
300
|
"configure-launch": ({ args, config, paths }) => configureLaunch(args, config, paths.config),
|
|
281
|
-
|
|
301
|
+
"configure-reporting": ({ args, config, paths }) => configureReporting(args, config, paths.config),
|
|
302
|
+
status: ({ args, paths, config, drivers, executor }) => {
|
|
303
|
+
const json = args[1] === "--json";
|
|
304
|
+
if (args.length > 2 || args.length === 2 && !json)
|
|
305
|
+
throw new Error("Usage: tsp-gateway status [--json]");
|
|
306
|
+
return printStatus(paths, config, drivers, executor, json);
|
|
307
|
+
},
|
|
282
308
|
install: async ({ host, config, version }) => {
|
|
283
309
|
await installLoginItem(host, config);
|
|
284
310
|
console.log(`Installed tsp-gateway ${version} as a login item.`);
|
|
@@ -304,7 +330,7 @@ async function main(args) {
|
|
|
304
330
|
const verb = verbNamed(command);
|
|
305
331
|
if (!verb) {
|
|
306
332
|
console.log(
|
|
307
|
-
"Usage: tsp-gateway connect [folder] | disconnect | pair | add <folder> | remove <slug> | configure-launch <json> | status | start | install | uninstall | unpair"
|
|
333
|
+
"Usage: tsp-gateway connect [folder] | disconnect | pair | add <folder> | remove <slug> | configure-launch <json> | configure-reporting <activity|off> | status [--json] | start | install | uninstall | unpair"
|
|
308
334
|
);
|
|
309
335
|
return;
|
|
310
336
|
}
|
|
@@ -312,7 +338,11 @@ async function main(args) {
|
|
|
312
338
|
const { paths, loginPath } = startupOptions(args, version);
|
|
313
339
|
const config = await readConfig(paths.config);
|
|
314
340
|
const environment = { ...process.env, PATH: config.loginPath ?? process.env["PATH"] };
|
|
315
|
-
const executor = new HarnessExecutor(environment, {
|
|
341
|
+
const executor = new HarnessExecutor(environment, {
|
|
342
|
+
config: async () => config.launch,
|
|
343
|
+
log: () => {
|
|
344
|
+
}
|
|
345
|
+
});
|
|
316
346
|
await verb({
|
|
317
347
|
args,
|
|
318
348
|
argument,
|
package/dist/gateway-schema.json
CHANGED
|
@@ -102,7 +102,8 @@
|
|
|
102
102
|
"type": "string",
|
|
103
103
|
"enum": [
|
|
104
104
|
"claude_code",
|
|
105
|
-
"codex"
|
|
105
|
+
"codex",
|
|
106
|
+
"cursor"
|
|
106
107
|
],
|
|
107
108
|
"title": "HarnessKind"
|
|
108
109
|
},
|
|
@@ -137,18 +138,26 @@
|
|
|
137
138
|
"type": "string"
|
|
138
139
|
},
|
|
139
140
|
"session_ref": {
|
|
140
|
-
"
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
141
|
+
"anyOf": [
|
|
142
|
+
{
|
|
143
|
+
"maxLength": 128,
|
|
144
|
+
"minLength": 1,
|
|
145
|
+
"pattern": "^[A-Za-z0-9][A-Za-z0-9_-]*$",
|
|
146
|
+
"type": "string"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"type": "null"
|
|
150
|
+
}
|
|
151
|
+
],
|
|
152
|
+
"default": null,
|
|
153
|
+
"description": "The observed session to stop. None while the gateway is still starting the action's launch or resume: it withdraws that start, or stops the session it produced. Sent only to a gateway whose harness advertises stop_starting.",
|
|
154
|
+
"title": "Session Ref"
|
|
145
155
|
}
|
|
146
156
|
},
|
|
147
157
|
"required": [
|
|
148
158
|
"ttl_ms",
|
|
149
159
|
"command_id",
|
|
150
|
-
"action_id"
|
|
151
|
-
"session_ref"
|
|
160
|
+
"action_id"
|
|
152
161
|
],
|
|
153
162
|
"title": "GatewayStopOffer",
|
|
154
163
|
"type": "object"
|
|
@@ -388,6 +397,11 @@
|
|
|
388
397
|
"requester_mismatch",
|
|
389
398
|
"protocol_outdated",
|
|
390
399
|
"start_failed",
|
|
400
|
+
"shell_startup_timeout",
|
|
401
|
+
"shell_startup_failed",
|
|
402
|
+
"repository_folder_unavailable",
|
|
403
|
+
"harness_exited",
|
|
404
|
+
"start_uncertain",
|
|
391
405
|
"stop_failed",
|
|
392
406
|
"session_not_found",
|
|
393
407
|
"machine_offline",
|
|
@@ -401,11 +415,12 @@
|
|
|
401
415
|
"control_expired",
|
|
402
416
|
"control_withdrawn"
|
|
403
417
|
],
|
|
404
|
-
"title": "LaunchRefusalReason"
|
|
418
|
+
"title": "LaunchRefusalReason",
|
|
419
|
+
"description": "Why a gateway or the server refused a launch, stop or resume.\n\nThe start failures a gateway can prove are named for what went wrong:\n``shell_startup_timeout`` (the login shell was too slow to start and the\ngateway had no earlier environment to use instead), ``shell_startup_failed``\n(the login shell exited before running the harness),\n``repository_folder_unavailable`` (the registered folder could not be\nentered), ``harness_exited`` (the harness exited with an error while\nstarting) and ``start_uncertain`` (a retried attempt could not tell whether\nan earlier one started a session, so it did not start a second).\n``start_failed`` is what gateways before 0.1.2 send for all of these."
|
|
405
420
|
},
|
|
406
421
|
"GatewayRetire": {
|
|
407
422
|
"additionalProperties": false,
|
|
408
|
-
"description": "Forget local tracking for an action no longer
|
|
423
|
+
"description": "Forget local tracking for an action TSP has released or no longer resolves.\n\nIt ends tracking only: the gateway leaves any running session alone.",
|
|
409
424
|
"properties": {
|
|
410
425
|
"protocol_version": {
|
|
411
426
|
"const": 1,
|
|
@@ -581,6 +596,12 @@
|
|
|
581
596
|
"answer_input": {
|
|
582
597
|
"type": "boolean",
|
|
583
598
|
"title": "Answer Input"
|
|
599
|
+
},
|
|
600
|
+
"stop_starting": {
|
|
601
|
+
"type": "boolean",
|
|
602
|
+
"title": "Stop Starting",
|
|
603
|
+
"description": "Stop reaches a launch or resume the gateway is still starting: it withdraws it before any prompt is sent, or stops the session it produced. Gateways before 0.1.3 omit it and are stopped only once a session is observed.",
|
|
604
|
+
"default": false
|
|
584
605
|
}
|
|
585
606
|
},
|
|
586
607
|
"additionalProperties": false,
|
|
@@ -766,6 +787,21 @@
|
|
|
766
787
|
"default": null,
|
|
767
788
|
"title": "Waiting For"
|
|
768
789
|
},
|
|
790
|
+
"last_message": {
|
|
791
|
+
"anyOf": [
|
|
792
|
+
{
|
|
793
|
+
"maxLength": 240,
|
|
794
|
+
"minLength": 1,
|
|
795
|
+
"type": "string"
|
|
796
|
+
},
|
|
797
|
+
{
|
|
798
|
+
"type": "null"
|
|
799
|
+
}
|
|
800
|
+
],
|
|
801
|
+
"default": null,
|
|
802
|
+
"description": "What the agent last said when its turn finished, trimmed and with folder paths removed; absent from gateways that predate it and when its reporting level is off.",
|
|
803
|
+
"title": "Last Message"
|
|
804
|
+
},
|
|
769
805
|
"attach_hint": {
|
|
770
806
|
"anyOf": [
|
|
771
807
|
{
|
|
@@ -791,6 +827,18 @@
|
|
|
791
827
|
],
|
|
792
828
|
"default": null,
|
|
793
829
|
"title": "Resumed As"
|
|
830
|
+
},
|
|
831
|
+
"activity": {
|
|
832
|
+
"anyOf": [
|
|
833
|
+
{
|
|
834
|
+
"$ref": "#/components/schemas/GatewaySessionActivity"
|
|
835
|
+
},
|
|
836
|
+
{
|
|
837
|
+
"type": "null"
|
|
838
|
+
}
|
|
839
|
+
],
|
|
840
|
+
"default": null,
|
|
841
|
+
"description": "Coarse, content-free activity the gateway derived locally; absent from gateways before 0.1.2 and when its reporting level is off."
|
|
794
842
|
}
|
|
795
843
|
},
|
|
796
844
|
"required": [
|
|
@@ -837,6 +885,65 @@
|
|
|
837
885
|
"title": "AttachHint",
|
|
838
886
|
"description": "Path-free session identity; command rendering belongs to the consumer."
|
|
839
887
|
},
|
|
888
|
+
"GatewaySessionActivity": {
|
|
889
|
+
"additionalProperties": false,
|
|
890
|
+
"description": "The snapshot as the gateway sends it, relative to its own send time.",
|
|
891
|
+
"properties": {
|
|
892
|
+
"kind": {
|
|
893
|
+
"anyOf": [
|
|
894
|
+
{
|
|
895
|
+
"$ref": "#/components/schemas/SessionActivityKind"
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
"type": "null"
|
|
899
|
+
}
|
|
900
|
+
],
|
|
901
|
+
"description": "What the session is doing now; null unless it is working."
|
|
902
|
+
},
|
|
903
|
+
"files_edited": {
|
|
904
|
+
"description": "Distinct files the session edited successfully.",
|
|
905
|
+
"maximum": 1000000,
|
|
906
|
+
"minimum": 0,
|
|
907
|
+
"title": "Files Edited",
|
|
908
|
+
"type": "integer"
|
|
909
|
+
},
|
|
910
|
+
"commands_run": {
|
|
911
|
+
"description": "Commands the session ran, reads excluded.",
|
|
912
|
+
"maximum": 1000000,
|
|
913
|
+
"minimum": 0,
|
|
914
|
+
"title": "Commands Run",
|
|
915
|
+
"type": "integer"
|
|
916
|
+
},
|
|
917
|
+
"idle_ms": {
|
|
918
|
+
"description": "Milliseconds since the session was last active, measured by the gateway when it sent the frame, so no clock skew reaches TSP.",
|
|
919
|
+
"minimum": 0,
|
|
920
|
+
"title": "Idle Ms",
|
|
921
|
+
"type": "integer"
|
|
922
|
+
}
|
|
923
|
+
},
|
|
924
|
+
"required": [
|
|
925
|
+
"kind",
|
|
926
|
+
"files_edited",
|
|
927
|
+
"commands_run",
|
|
928
|
+
"idle_ms"
|
|
929
|
+
],
|
|
930
|
+
"title": "GatewaySessionActivity",
|
|
931
|
+
"type": "object"
|
|
932
|
+
},
|
|
933
|
+
"SessionActivityKind": {
|
|
934
|
+
"type": "string",
|
|
935
|
+
"enum": [
|
|
936
|
+
"thinking",
|
|
937
|
+
"reading",
|
|
938
|
+
"editing",
|
|
939
|
+
"running_command",
|
|
940
|
+
"using_plan",
|
|
941
|
+
"delegating",
|
|
942
|
+
"using_tool"
|
|
943
|
+
],
|
|
944
|
+
"title": "SessionActivityKind",
|
|
945
|
+
"description": "What a working session is doing right now, as its harness shows it.\n\nReported only while the session is working. Waiting on the person is the\nsession's ``needs_input`` state, not a kind."
|
|
946
|
+
},
|
|
840
947
|
"GatewayPong": {
|
|
841
948
|
"additionalProperties": false,
|
|
842
949
|
"properties": {
|