@kdonev/termscape 0.1.2 → 0.1.4
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 +35 -4
- package/dist/agents/polling.d.ts +31 -0
- package/dist/agents/polling.d.ts.map +1 -0
- package/dist/agents/polling.js +65 -0
- package/dist/agents/polling.js.map +1 -0
- package/dist/agents/profiles.d.ts +21 -6
- package/dist/agents/profiles.d.ts.map +1 -1
- package/dist/agents/profiles.js +121 -3
- package/dist/agents/profiles.js.map +1 -1
- package/dist/agents/router.d.ts.map +1 -1
- package/dist/agents/router.js +2 -2
- package/dist/agents/router.js.map +1 -1
- package/dist/agents/shares.d.ts +32 -0
- package/dist/agents/shares.d.ts.map +1 -0
- package/dist/agents/shares.js +46 -0
- package/dist/agents/shares.js.map +1 -0
- package/dist/agents/wiring.d.ts +8 -0
- package/dist/agents/wiring.d.ts.map +1 -1
- package/dist/agents/wiring.js +72 -7
- package/dist/agents/wiring.js.map +1 -1
- package/dist/cli-args.d.ts +61 -0
- package/dist/cli-args.d.ts.map +1 -0
- package/dist/cli-args.js +35 -0
- package/dist/cli-args.js.map +1 -0
- package/dist/cli.js +10 -17
- package/dist/cli.js.map +1 -1
- package/dist/db/migrations.d.ts.map +1 -1
- package/dist/db/migrations.js +69 -0
- package/dist/db/migrations.js.map +1 -1
- package/dist/db/store.d.ts +21 -1
- package/dist/db/store.d.ts.map +1 -1
- package/dist/db/store.js +79 -3
- package/dist/db/store.js.map +1 -1
- package/dist/debug.d.ts +11 -0
- package/dist/debug.d.ts.map +1 -0
- package/dist/debug.js +45 -0
- package/dist/debug.js.map +1 -0
- package/dist/folders.d.ts +33 -0
- package/dist/folders.d.ts.map +1 -0
- package/dist/folders.js +88 -0
- package/dist/folders.js.map +1 -0
- package/dist/hub.d.ts +128 -3
- package/dist/hub.d.ts.map +1 -1
- package/dist/hub.js +498 -44
- package/dist/hub.js.map +1 -1
- package/dist/hub.tgz +0 -0
- package/dist/mcp/server.d.ts +2 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +38 -5
- package/dist/mcp/server.js.map +1 -1
- package/dist/paths.d.ts +9 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +9 -0
- package/dist/paths.js.map +1 -1
- package/dist/protocol/domain.d.ts +74 -0
- package/dist/protocol/domain.d.ts.map +1 -1
- package/dist/protocol/domain.js +58 -0
- package/dist/protocol/domain.js.map +1 -1
- package/dist/protocol/index.d.ts +1 -0
- package/dist/protocol/index.d.ts.map +1 -1
- package/dist/protocol/index.js +1 -0
- package/dist/protocol/index.js.map +1 -1
- package/dist/protocol/inject.d.ts +22 -2
- package/dist/protocol/inject.d.ts.map +1 -1
- package/dist/protocol/inject.js +24 -4
- package/dist/protocol/inject.js.map +1 -1
- package/dist/protocol/mcp-tools.d.ts +4 -0
- package/dist/protocol/mcp-tools.d.ts.map +1 -1
- package/dist/protocol/mcp-tools.js +16 -2
- package/dist/protocol/mcp-tools.js.map +1 -1
- package/dist/protocol/mouse.d.ts +54 -0
- package/dist/protocol/mouse.d.ts.map +1 -0
- package/dist/protocol/mouse.js +187 -0
- package/dist/protocol/mouse.js.map +1 -0
- package/dist/protocol/peer.d.ts +53 -1
- package/dist/protocol/peer.d.ts.map +1 -1
- package/dist/protocol/peer.js +96 -3
- package/dist/protocol/peer.js.map +1 -1
- package/dist/protocol/ws.d.ts +127 -2
- package/dist/protocol/ws.d.ts.map +1 -1
- package/dist/protocol/ws.js +83 -1
- package/dist/protocol/ws.js.map +1 -1
- package/dist/remote/deployer.d.ts.map +1 -1
- package/dist/remote/deployer.js +5 -1
- package/dist/remote/deployer.js.map +1 -1
- package/dist/remote/enroll.d.ts.map +1 -1
- package/dist/remote/enroll.js +25 -11
- package/dist/remote/enroll.js.map +1 -1
- package/dist/remote/join-script.d.ts.map +1 -1
- package/dist/remote/join-script.js +156 -31
- package/dist/remote/join-script.js.map +1 -1
- package/dist/remote/join.d.ts +2 -0
- package/dist/remote/join.d.ts.map +1 -1
- package/dist/remote/join.js +40 -1
- package/dist/remote/join.js.map +1 -1
- package/dist/remote/peer-serve.d.ts +19 -2
- package/dist/remote/peer-serve.d.ts.map +1 -1
- package/dist/remote/peer-serve.js +95 -7
- package/dist/remote/peer-serve.js.map +1 -1
- package/dist/remote/registry.d.ts +10 -0
- package/dist/remote/registry.d.ts.map +1 -1
- package/dist/remote/registry.js +31 -5
- package/dist/remote/registry.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +269 -10
- package/dist/server.js.map +1 -1
- package/dist/session/manager.d.ts +25 -0
- package/dist/session/manager.d.ts.map +1 -1
- package/dist/session/manager.js +42 -0
- package/dist/session/manager.js.map +1 -1
- package/dist/session/pty.d.ts +30 -1
- package/dist/session/pty.d.ts.map +1 -1
- package/dist/session/pty.js +98 -1
- package/dist/session/pty.js.map +1 -1
- package/package.json +1 -1
- package/web/assets/index-Z03Ta4g3.js +111 -0
- package/web/assets/index-u_uCiaPD.css +1 -0
- package/web/index.html +2 -2
- package/web/assets/index-9Z_8xZqk.js +0 -111
- package/web/assets/index-DheUm5dl.css +0 -1
package/README.md
CHANGED
|
@@ -48,10 +48,15 @@ the field, with what you typed still in it.
|
|
|
48
48
|
navigates instead of zooming: in over a terminal maximizes it, out steps
|
|
49
49
|
back to the workspace around it and then to everything. Zooming at any
|
|
50
50
|
ordinary pace is left alone
|
|
51
|
-
-
|
|
51
|
+
- Every window shows its real terminal at every zoom; the text minifies
|
|
52
|
+
rather than being replaced by a card, so a zoomed-out canvas still shows
|
|
53
|
+
the shape of what each agent is doing
|
|
52
54
|
- Clicking an agent in the panel brings the canvas to it
|
|
53
55
|
- Clicking the canvas closes the panel, as does **Escape** — which closes the
|
|
54
56
|
panel first and clears the selection only once it is shut
|
|
57
|
+
- **share** on a window's title bar hands a reviewer a link to that one
|
|
58
|
+
terminal, live, with nothing else on the canvas visible to them — see
|
|
59
|
+
[Security](#security) for what the link actually grants
|
|
55
60
|
|
|
56
61
|
## Requirements
|
|
57
62
|
|
|
@@ -171,6 +176,7 @@ tunnel. Same protocol, opposite direction.
|
|
|
171
176
|
|---|---|
|
|
172
177
|
| `whoami` | your address, workspace and working directory |
|
|
173
178
|
| `list_agents` | everyone on the canvas, across every host, and whether they are busy |
|
|
179
|
+
| `list_hosts` | every machine on the canvas, its workspaces, and the agent CLIs it has |
|
|
174
180
|
| `list_templates` | the saved ways of starting an agent, and what each one runs |
|
|
175
181
|
| `send_message` | type a message into another agent's terminal, right now |
|
|
176
182
|
| `spawn_agent` | start a helper in your workspace, with an optional first task |
|
|
@@ -184,6 +190,12 @@ CLI: its `profile` takes a template id, and this is how an agent finds out
|
|
|
184
190
|
which ids exist. It reports the *names* of the environment variables a template
|
|
185
191
|
sets and never their values, which are credentials more often than not.
|
|
186
192
|
|
|
193
|
+
`list_hosts` is the same idea for `spawn_agent`'s `host`: without it, nothing
|
|
194
|
+
tells an agent what other machines are even on the canvas, let alone which of
|
|
195
|
+
them are reachable or have the CLI it wants to start. An agent started on
|
|
196
|
+
another machine cannot be stopped with `stop_agent` yet — that gap is tracked
|
|
197
|
+
as a follow-up rather than silently left unsaid.
|
|
198
|
+
|
|
187
199
|
`propose_template` is the only one that asks rather than does. A template
|
|
188
200
|
changes how *future* agents are launched, on every machine, with nobody
|
|
189
201
|
necessarily watching — so the canvas shows it to a human, who can edit it
|
|
@@ -197,10 +209,10 @@ text arriving as `[from <address>] ...` is a colleague rather than the human.
|
|
|
197
209
|
## Agent profiles
|
|
198
210
|
|
|
199
211
|
An agent CLI is configuration, not code. Built-ins are `claude`, `codex`,
|
|
200
|
-
`gemini`, `opencode` and `shell`.
|
|
212
|
+
`gemini`, `kilocode`, `opencode` and `shell`.
|
|
201
213
|
|
|
202
214
|
Every one of them except `shell` is wired to the hub's MCP endpoint: each gets an
|
|
203
|
-
address, a brief and the `send_message` tool set. They arrive there by
|
|
215
|
+
address, a brief and the `send_message` tool set. They arrive there by five
|
|
204
216
|
different routes, because no two of these CLIs configure an MCP server the same
|
|
205
217
|
way — and **none of them writes to a file you own**, so there is nothing left
|
|
206
218
|
behind when a session ends or when the hub is killed rather than stopped.
|
|
@@ -208,6 +220,7 @@ behind when a session ends or when the hub is killed rather than stopped.
|
|
|
208
220
|
| agent | how it reaches the hub | brief | resume |
|
|
209
221
|
| --- | --- | --- | --- |
|
|
210
222
|
| `claude` | `--mcp-config` on a generated file | `--append-system-prompt-file` | `--resume <uuid>` |
|
|
223
|
+
| `kilocode` | `KILO_CONFIG` at a generated file, layered under yours | `instructions` in that file | restarts clean |
|
|
211
224
|
| `codex` | `-c mcp_servers.…` overrides, one run only | typed in at startup | restarts clean |
|
|
212
225
|
| `gemini` | `GEMINI_CLI_SYSTEM_SETTINGS_PATH` at a generated file | typed in at startup | restarts clean |
|
|
213
226
|
| `opencode` | `OPENCODE_CONFIG_CONTENT`, no file anywhere | typed in at startup | restarts clean |
|
|
@@ -224,6 +237,15 @@ Two details worth knowing, because both are easy to get wrong:
|
|
|
224
237
|
- **Codex's bearer token goes in the environment, never `-c`.** Config
|
|
225
238
|
overrides land in the command line, where any other user on the machine can
|
|
226
239
|
read them. `bearer_token_env_var` exists precisely for this.
|
|
240
|
+
- **Kilo's config variable is the opposite of opencode's.** They look alike
|
|
241
|
+
and behave inversely: `OPENCODE_CONFIG_CONTENT` merges, `KILO_CONFIG_CONTENT`
|
|
242
|
+
*replaces*, so handing Kilo an MCP section that way would cost the user every
|
|
243
|
+
provider and model they had configured. `KILO_CONFIG` instead names one more
|
|
244
|
+
file, appended last to the list Kilo already layers and deep-merges — your
|
|
245
|
+
`mcp` entries keep their keys beside `termscape`, and your instruction files
|
|
246
|
+
are still loaded alongside the brief. Kilo also has no flag that appends to
|
|
247
|
+
its system prompt, which is why the brief is named under `instructions` in
|
|
248
|
+
that same file rather than on the command line.
|
|
227
249
|
- **opencode is configured entirely from the environment.** Its config is
|
|
228
250
|
handed over as a string, merged with your own rather than replacing it, so
|
|
229
251
|
your models, themes and your own MCP servers survive the session. Note that
|
|
@@ -343,7 +365,7 @@ where the error reads like the hub is broken.
|
|
|
343
365
|
naming the command that was not found — rather than vanishing, which looks
|
|
344
366
|
like the config was ignored.
|
|
345
367
|
- Models are enumerated where the CLI can be asked (`opencode models` returns
|
|
346
|
-
a few hundred) and declared in the profile where it cannot. Claude Code has
|
|
368
|
+
a few hundred, `kilo models` around a hundred) and declared in the profile where it cannot. Claude Code has
|
|
347
369
|
no listing command; its `--help` documents the aliases instead, and it takes
|
|
348
370
|
a full model name as readily as an alias. Codex is declared too, for a
|
|
349
371
|
different reason: `codex debug models` does render the real catalog, but it
|
|
@@ -409,6 +431,15 @@ could be talked into sending an attacker's text to a peer.
|
|
|
409
431
|
machine to death.
|
|
410
432
|
- An agent may only stop agents it spawned.
|
|
411
433
|
- `--dangerously-skip-permissions` is never a default.
|
|
434
|
+
- A share link is a real grant of a keyboard on an agent that can run
|
|
435
|
+
commands, not a read-only view — the dialog says so before you copy one.
|
|
436
|
+
It opens exactly one terminal and nothing else: no canvas, no other agent's
|
|
437
|
+
name, no panel. It is scoped to that one session everywhere the canvas
|
|
438
|
+
token is checked, stored in `state.db` so it survives a hub restart, and
|
|
439
|
+
reachable only on the interfaces the hub bound — a hub started with
|
|
440
|
+
`--listen loopback` has no `lanOrigin` to build one from. **stop sharing**,
|
|
441
|
+
in the same dialog, revokes it and disconnects any tab that already had it
|
|
442
|
+
open — immediately, not on that tab's next reload.
|
|
412
443
|
|
|
413
444
|
## Contributing
|
|
414
445
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Catches an agent watching a screen instead of waiting for a reply.
|
|
3
|
+
*
|
|
4
|
+
* The wording and the brief say waiting means ending your turn, but that only
|
|
5
|
+
* ever reaches a model that reads it before it acts - and one already mid-loop
|
|
6
|
+
* on `read_screen` has nothing left to read. This is what lands *after* the
|
|
7
|
+
* loop has started: `Hub.readScreen` attaches a `note` to the third read of
|
|
8
|
+
* the same screen inside a minute, telling the agent to stop.
|
|
9
|
+
*
|
|
10
|
+
* No hub dependency, so it unit-tests on its own.
|
|
11
|
+
*/
|
|
12
|
+
export declare const POLL_WINDOW_MS = 60000;
|
|
13
|
+
/** Reads of one screen inside the window before a note is attached. */
|
|
14
|
+
export declare const POLL_NUDGE_AFTER = 3;
|
|
15
|
+
export declare class PollWatch {
|
|
16
|
+
/** Last `send_message` from one address to another, keyed `from\0to`. */
|
|
17
|
+
private readonly sent;
|
|
18
|
+
/** Read timestamps, keyed `reader\0target`, newest last. */
|
|
19
|
+
private readonly reads;
|
|
20
|
+
noteMessage(from: string, to: string, at?: number): void;
|
|
21
|
+
/** Records the read and returns the line to attach, or null. */
|
|
22
|
+
noteRead(reader: string, target: string, at?: number): string | null;
|
|
23
|
+
/**
|
|
24
|
+
* Drops anything older than the window and any entry that leaves empty, so
|
|
25
|
+
* neither map grows with a hub that has been up for a week. Run on every
|
|
26
|
+
* touch rather than on a timer: both maps are sized by the number of
|
|
27
|
+
* address pairs actually talking, which stays small.
|
|
28
|
+
*/
|
|
29
|
+
private prune;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=polling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polling.d.ts","sourceRoot":"","sources":["../../src/agents/polling.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,cAAc,QAAS,CAAC;AACrC,uEAAuE;AACvE,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAKlC,qBAAa,SAAS;IACpB,yEAAyE;IACzE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA6B;IAClD,4DAA4D;IAC5D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA+B;IAErD,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,GAAE,MAAmB,GAAG,IAAI;IAKpE,gEAAgE;IAChE,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,GAAE,MAAmB,GAAG,MAAM,GAAG,IAAI;IAmBhF;;;;;OAKG;IACH,OAAO,CAAC,KAAK;CAWd"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Catches an agent watching a screen instead of waiting for a reply.
|
|
3
|
+
*
|
|
4
|
+
* The wording and the brief say waiting means ending your turn, but that only
|
|
5
|
+
* ever reaches a model that reads it before it acts - and one already mid-loop
|
|
6
|
+
* on `read_screen` has nothing left to read. This is what lands *after* the
|
|
7
|
+
* loop has started: `Hub.readScreen` attaches a `note` to the third read of
|
|
8
|
+
* the same screen inside a minute, telling the agent to stop.
|
|
9
|
+
*
|
|
10
|
+
* No hub dependency, so it unit-tests on its own.
|
|
11
|
+
*/
|
|
12
|
+
export const POLL_WINDOW_MS = 60_000;
|
|
13
|
+
/** Reads of one screen inside the window before a note is attached. */
|
|
14
|
+
export const POLL_NUDGE_AFTER = 3;
|
|
15
|
+
const SEP = '\0';
|
|
16
|
+
const keyOf = (a, b) => `${a}${SEP}${b}`;
|
|
17
|
+
export class PollWatch {
|
|
18
|
+
/** Last `send_message` from one address to another, keyed `from\0to`. */
|
|
19
|
+
sent = new Map();
|
|
20
|
+
/** Read timestamps, keyed `reader\0target`, newest last. */
|
|
21
|
+
reads = new Map();
|
|
22
|
+
noteMessage(from, to, at = Date.now()) {
|
|
23
|
+
this.prune(at);
|
|
24
|
+
this.sent.set(keyOf(from, to), at);
|
|
25
|
+
}
|
|
26
|
+
/** Records the read and returns the line to attach, or null. */
|
|
27
|
+
noteRead(reader, target, at = Date.now()) {
|
|
28
|
+
this.prune(at);
|
|
29
|
+
const k = keyOf(reader, target);
|
|
30
|
+
const times = [...(this.reads.get(k) ?? []), at];
|
|
31
|
+
this.reads.set(k, times);
|
|
32
|
+
if (times.length < POLL_NUDGE_AFTER)
|
|
33
|
+
return null;
|
|
34
|
+
const outstanding = this.sent.has(keyOf(reader, target));
|
|
35
|
+
return outstanding
|
|
36
|
+
? `You asked ${target} something and have read their screen ${times.length} times ` +
|
|
37
|
+
'since. Watching does not make an answer arrive — a reply is typed into your ' +
|
|
38
|
+
'terminal and starts your next turn. Stop here and wait.'
|
|
39
|
+
: `You have read this screen ${times.length} times in the last minute. If you are ` +
|
|
40
|
+
'waiting on something, ask for it with send_message and then end your turn; the ' +
|
|
41
|
+
'answer is typed into your terminal. To see only whether an agent is working, ' +
|
|
42
|
+
'list_agents says idle or busy in one call.';
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Drops anything older than the window and any entry that leaves empty, so
|
|
46
|
+
* neither map grows with a hub that has been up for a week. Run on every
|
|
47
|
+
* touch rather than on a timer: both maps are sized by the number of
|
|
48
|
+
* address pairs actually talking, which stays small.
|
|
49
|
+
*/
|
|
50
|
+
prune(at) {
|
|
51
|
+
const cutoff = at - POLL_WINDOW_MS;
|
|
52
|
+
for (const [k, sentAt] of this.sent) {
|
|
53
|
+
if (sentAt <= cutoff)
|
|
54
|
+
this.sent.delete(k);
|
|
55
|
+
}
|
|
56
|
+
for (const [k, times] of this.reads) {
|
|
57
|
+
const kept = times.filter((t) => t > cutoff);
|
|
58
|
+
if (kept.length === 0)
|
|
59
|
+
this.reads.delete(k);
|
|
60
|
+
else
|
|
61
|
+
this.reads.set(k, kept);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=polling.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polling.js","sourceRoot":"","sources":["../../src/agents/polling.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC;AACrC,uEAAuE;AACvE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAElC,MAAM,GAAG,GAAG,IAAI,CAAC;AACjB,MAAM,KAAK,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE,CAAC,GAAG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D,CAAC;IAED;;;;;OAKG;IACK,KAAK,CAAC,EAAU;QACtB,MAAM,MAAM,GAAG,EAAE,GAAG,cAAc,CAAC;QACnC,KAAK,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACpC,IAAI,MAAM,IAAI,MAAM;gBAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC5C,CAAC;QACD,KAAK,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACpC,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC;YAC7C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;gBAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;;gBACvC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;CACF"}
|
|
@@ -19,9 +19,13 @@ export interface AgentProfile {
|
|
|
19
19
|
/**
|
|
20
20
|
* How the brief reaches the agent.
|
|
21
21
|
*
|
|
22
|
-
* `flag` - the
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* `flag` - the brief reaches the system prompt before the first turn, so
|
|
23
|
+
* the agent never sees it as one. Usually that is a flag in the profile's
|
|
24
|
+
* own args pointing at `{{brief_path}}`, the way Claude Code's
|
|
25
|
+
* `--append-system-prompt-file` does; Kilo has no such flag and names the
|
|
26
|
+
* same file under `instructions` in the config the hub generates for it,
|
|
27
|
+
* which arrives at the same place by a different road. What the value
|
|
28
|
+
* promises is the timing, not the mechanism.
|
|
25
29
|
*
|
|
26
30
|
* `typed` - the CLI has no way to *append* to its system prompt, so the
|
|
27
31
|
* brief is typed into the terminal once the CLI is up, ahead of any opening
|
|
@@ -132,10 +136,21 @@ export interface AgentProfile {
|
|
|
132
136
|
* `opencode mcp add` - which does write to the user's file, and ignores
|
|
133
137
|
* `OPENCODE_CONFIG` when it does - and mistaking that command for the only
|
|
134
138
|
* way in.
|
|
139
|
+
* - **Kilo** is an opencode fork whose variable of the same shape means the
|
|
140
|
+
* opposite: `KILO_CONFIG_CONTENT` *replaces* the config rather than merging
|
|
141
|
+
* with it. `KILO_CONFIG` is the one to use - it appends one more file to
|
|
142
|
+
* the list Kilo already layers and deep-merges, so a session adds its
|
|
143
|
+
* server and its brief on top of the user's config without reading it.
|
|
144
|
+
* Verified against @kilocode/cli 7.5.16, which is also how three flags that
|
|
145
|
+
* read like they should exist turned out not to: Kilo has no
|
|
146
|
+
* `--append-system-prompt-file` (the brief goes under `instructions` in
|
|
147
|
+
* that config), and `--variant` and `--session` are `kilo run` options
|
|
148
|
+
* rather than top-level ones. Its parser accepts an unknown top-level flag
|
|
149
|
+
* and exits 0, so each of those would have failed silently.
|
|
135
150
|
*
|
|
136
|
-
* `shell`
|
|
137
|
-
* a way no flag can fix:
|
|
138
|
-
* rather than read.
|
|
151
|
+
* `shell` and `powershell` are the two profiles left that are not agents, and
|
|
152
|
+
* they are not agents in a way no flag can fix: they run a shell, so text
|
|
153
|
+
* typed at one is executed rather than read.
|
|
139
154
|
*/
|
|
140
155
|
export declare const BUILTIN_PROFILES: Record<string, AgentProfile>;
|
|
141
156
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../../src/agents/profiles.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,EAAE,MAAM,CAAC,MAAM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E,MAAM,EAAE,CAAC;IACrB,8CAA8C;IAC9C,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAOD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CA6TzD,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAEpE;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAA+B;gBAEnC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC;IAInD,oEAAoE;IACpE,MAAM,CAAC,IAAI,IAAI,eAAe;IAyC9B,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI;IAIpC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,YAAY;IAMjC,IAAI,IAAI,YAAY,EAAE;IAItB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;CAIjC;AAED,+EAA+E;AAC/E,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAI5E;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,EAAE,CAElF"}
|
package/dist/agents/profiles.js
CHANGED
|
@@ -41,10 +41,21 @@ function defaultShell() {
|
|
|
41
41
|
* `opencode mcp add` - which does write to the user's file, and ignores
|
|
42
42
|
* `OPENCODE_CONFIG` when it does - and mistaking that command for the only
|
|
43
43
|
* way in.
|
|
44
|
+
* - **Kilo** is an opencode fork whose variable of the same shape means the
|
|
45
|
+
* opposite: `KILO_CONFIG_CONTENT` *replaces* the config rather than merging
|
|
46
|
+
* with it. `KILO_CONFIG` is the one to use - it appends one more file to
|
|
47
|
+
* the list Kilo already layers and deep-merges, so a session adds its
|
|
48
|
+
* server and its brief on top of the user's config without reading it.
|
|
49
|
+
* Verified against @kilocode/cli 7.5.16, which is also how three flags that
|
|
50
|
+
* read like they should exist turned out not to: Kilo has no
|
|
51
|
+
* `--append-system-prompt-file` (the brief goes under `instructions` in
|
|
52
|
+
* that config), and `--variant` and `--session` are `kilo run` options
|
|
53
|
+
* rather than top-level ones. Its parser accepts an unknown top-level flag
|
|
54
|
+
* and exits 0, so each of those would have failed silently.
|
|
44
55
|
*
|
|
45
|
-
* `shell`
|
|
46
|
-
* a way no flag can fix:
|
|
47
|
-
* rather than read.
|
|
56
|
+
* `shell` and `powershell` are the two profiles left that are not agents, and
|
|
57
|
+
* they are not agents in a way no flag can fix: they run a shell, so text
|
|
58
|
+
* typed at one is executed rather than read.
|
|
48
59
|
*/
|
|
49
60
|
export const BUILTIN_PROFILES = {
|
|
50
61
|
claude: {
|
|
@@ -132,6 +143,81 @@ export const BUILTIN_PROFILES = {
|
|
|
132
143
|
// and is not a top-level option, so the TUI this profile starts does not
|
|
133
144
|
// take one. A template asking for an effort here is refused at load.
|
|
134
145
|
},
|
|
146
|
+
kilocode: {
|
|
147
|
+
id: 'kilocode',
|
|
148
|
+
description: 'Kilo Code CLI, wired to the hub MCP endpoint',
|
|
149
|
+
command: 'kilo',
|
|
150
|
+
// Bare, which is its default subcommand and starts the TUI. `kilo run` is
|
|
151
|
+
// the one-shot form and is not what a window on the canvas wants.
|
|
152
|
+
args: [],
|
|
153
|
+
/*
|
|
154
|
+
* Kilo is an opencode fork and reaches the hub by a fourth route again,
|
|
155
|
+
* because the variable opencode uses has the opposite meaning here.
|
|
156
|
+
*
|
|
157
|
+
* `KILO_CONFIG` names one more config file, appended *last* to the list
|
|
158
|
+
* Kilo already layers - the project's own kilo.json, then the global
|
|
159
|
+
* ~/.config/kilo/kilo.json - and the layers are deep-merged. So the file
|
|
160
|
+
* this points at adds our MCP server and our brief on top of the user's
|
|
161
|
+
* config without the hub reading or rewriting a byte of it: their `mcp`
|
|
162
|
+
* entries keep their own keys beside `termscape`, their models and themes
|
|
163
|
+
* survive, and their `instructions` list simply gains one entry.
|
|
164
|
+
*
|
|
165
|
+
* The token is not in that file. It goes in the environment, and the file
|
|
166
|
+
* refers to it as `{env:TERMSCAPE_TOKEN}` - Kilo's own substitution
|
|
167
|
+
* syntax, verified resolving against a live `kilo debug config`. Same
|
|
168
|
+
* reasoning as Codex's `bearer_token_env_var`, with one more benefit
|
|
169
|
+
* here: nothing secret is written to disk at all.
|
|
170
|
+
*/
|
|
171
|
+
env: {
|
|
172
|
+
KILO_CONFIG: '{{kilocode_config_path}}',
|
|
173
|
+
TERMSCAPE_TOKEN: '{{token}}',
|
|
174
|
+
},
|
|
175
|
+
/*
|
|
176
|
+
* `KILO_CONFIG_CONTENT` is the other one, and it *replaces* the effective
|
|
177
|
+
* config rather than layering onto it - which is exactly wrong for a
|
|
178
|
+
* session and exactly right for a probe. `kilo --version` and
|
|
179
|
+
* `kilo models` need no config, and this stops Kilo writing a default one
|
|
180
|
+
* on a machine whose owner may never have run it by hand.
|
|
181
|
+
*/
|
|
182
|
+
probeEnv: { KILO_CONFIG_CONTENT: '{}' },
|
|
183
|
+
mcp: true,
|
|
184
|
+
/*
|
|
185
|
+
* `flag` without a flag. Kilo has no `--append-system-prompt-file`; what
|
|
186
|
+
* it has is `instructions` in config, a list of files folded into the
|
|
187
|
+
* system prompt. The brief is named there, in the same generated config
|
|
188
|
+
* that carries the MCP server, so it arrives as context and the agent
|
|
189
|
+
* never sees it as a turn - which is the whole of what `flag` means to
|
|
190
|
+
* the hub.
|
|
191
|
+
*
|
|
192
|
+
* Worth saying why this is not `typed`: Kilo's top-level parser is not
|
|
193
|
+
* strict, so an invented flag is accepted, ignored, and exits 0. An agent
|
|
194
|
+
* briefed by a flag that does not exist launches with no brief and no
|
|
195
|
+
* error, which is the failure this profile is written to avoid.
|
|
196
|
+
*/
|
|
197
|
+
brief: 'flag',
|
|
198
|
+
status: 'heuristic',
|
|
199
|
+
inject: 'bracketed',
|
|
200
|
+
versionArgs: ['--version'],
|
|
201
|
+
// Real enumeration: `kilo models` prints one provider/model per line, 102
|
|
202
|
+
// of them on the machine this was written on - the same plain-text shape
|
|
203
|
+
// opencode answers with, so there is nothing to declare here.
|
|
204
|
+
modelsArgs: ['models'],
|
|
205
|
+
// `-m provider/model` is a top-level option, so it applies to the TUI and
|
|
206
|
+
// not only to `kilo run`. Verified against `kilo --help`.
|
|
207
|
+
modelArgs: ['-m', '{{model}}'],
|
|
208
|
+
/*
|
|
209
|
+
* No effortArgs, for precisely the reason opencode has none: `--variant`
|
|
210
|
+
* is documented under `kilo run` and is not a top-level option, so the
|
|
211
|
+
* TUI this profile starts does not take one. A template asking for an
|
|
212
|
+
* effort here is refused at load rather than dropped at launch.
|
|
213
|
+
*
|
|
214
|
+
* No resumeArgs either. `-s/--session` exists, but it takes an id Kilo
|
|
215
|
+
* mints for itself rather than one the hub could record up front, and
|
|
216
|
+
* `-c/--continue` resolves to "the most recent session in this cwd",
|
|
217
|
+
* which is the wrong agent as soon as a workspace holds two of them.
|
|
218
|
+
* Better to restart clean and say so.
|
|
219
|
+
*/
|
|
220
|
+
},
|
|
135
221
|
codex: {
|
|
136
222
|
id: 'codex',
|
|
137
223
|
description: 'Codex CLI, wired to the hub MCP endpoint',
|
|
@@ -237,6 +323,38 @@ export const BUILTIN_PROFILES = {
|
|
|
237
323
|
* not an id it could resume by.
|
|
238
324
|
*/
|
|
239
325
|
},
|
|
326
|
+
/*
|
|
327
|
+
* PowerShell, named rather than left to `shell`.
|
|
328
|
+
*
|
|
329
|
+
* On Windows `shell` follows COMSPEC, which is cmd.exe - so the shell most
|
|
330
|
+
* Windows work actually happens in was the one thing the picker could not
|
|
331
|
+
* offer. Elsewhere `pwsh` is the cross-platform build, and it stays in the
|
|
332
|
+
* list when it is not installed with "not found on PATH" against it, which
|
|
333
|
+
* is the honest answer for a shell you have to install.
|
|
334
|
+
*
|
|
335
|
+
* Unwired for the same reason `shell` is, and it is not a gap a flag could
|
|
336
|
+
* close: a shell executes what is typed at it, so a brief there is a series
|
|
337
|
+
* of commands rather than context.
|
|
338
|
+
*/
|
|
339
|
+
powershell: {
|
|
340
|
+
id: 'powershell',
|
|
341
|
+
description: 'PowerShell, no agent wiring',
|
|
342
|
+
command: platform === 'win32' ? 'powershell.exe' : 'pwsh',
|
|
343
|
+
// -NoLogo: the banner is three lines of nothing in a window this small.
|
|
344
|
+
args: ['-NoLogo'],
|
|
345
|
+
env: {},
|
|
346
|
+
mcp: false,
|
|
347
|
+
brief: 'none',
|
|
348
|
+
status: 'heuristic',
|
|
349
|
+
// `PS C:\dev>`, and the `>>` of a continuation prompt. Not a bare `>`,
|
|
350
|
+
// which is the last character of half the redirects anyone types.
|
|
351
|
+
readyHint: '(PS [^>]*>|^>>) ?$',
|
|
352
|
+
inject: 'raw',
|
|
353
|
+
// Asked rather than declared: unlike `shell`, which is whatever COMSPEC or
|
|
354
|
+
// SHELL happens to point at, this is one named command that either is on
|
|
355
|
+
// PATH or is not - and its version is worth showing next to it.
|
|
356
|
+
versionArgs: ['-NoLogo', '-NoProfile', '-Command', '$PSVersionTable.PSVersion.ToString()'],
|
|
357
|
+
},
|
|
240
358
|
shell: {
|
|
241
359
|
id: 'shell',
|
|
242
360
|
description: 'Plain terminal, no agent wiring',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiles.js","sourceRoot":"","sources":["../../src/agents/profiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AAE/C,OA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C5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/agents/router.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/agents/router.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,OAAO,EACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAoBD;;;;;;;;;GASG;AACH,qBAAa,aAAa;IAItB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAN5B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;gBAG1B,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,cAAc,EACxB,QAAQ,EAAE,eAAe,EACzB,SAAS,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI;IAGlD,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,cAAc;CAsDrE"}
|
package/dist/agents/router.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import { encodeInjection, formatMessage, MESSAGE_RATE_LIMIT, } from '../protocol/index.js';
|
|
2
|
+
import { encodeInjection, formatMessage, INJECT_SUBMIT, MESSAGE_RATE_LIMIT, } from '../protocol/index.js';
|
|
3
3
|
/** Simple fixed-window counter, per sender address. */
|
|
4
4
|
class RateLimiter {
|
|
5
5
|
hits = new Map();
|
|
@@ -71,7 +71,7 @@ export class MessageRouter {
|
|
|
71
71
|
try {
|
|
72
72
|
// Attribution comes from the hub's own record of who is calling, never
|
|
73
73
|
// from the sender's arguments, so it cannot be spoofed.
|
|
74
|
-
this.sessions.
|
|
74
|
+
this.sessions.inject(target.id, encodeInjection(formatMessage(fromAddr, body), mode), INJECT_SUBMIT);
|
|
75
75
|
pty.markBusy();
|
|
76
76
|
return record('delivered');
|
|
77
77
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.js","sourceRoot":"","sources":["../../src/agents/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,eAAe,EACf,aAAa,EACb,kBAAkB,GAEnB,MAAM,qBAAqB,CAAC;AAW7B,uDAAuD;AACvD,MAAM,WAAW;IACP,IAAI,GAAG,IAAI,GAAG,EAAoB,CAAC;IAE3C,KAAK,CAAC,GAAW;QACf,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,MAAM,MAAM,GAAG,GAAG,GAAG,kBAAkB,CAAC,QAAQ,CAAC;QACjD,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC;QACjE,IAAI,GAAG,CAAC,MAAM,IAAI,kBAAkB,CAAC,GAAG,EAAE,CAAC;YACzC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;YACxB,OAAO,KAAK,CAAC;QACf,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,C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YACF,GAAG,CAAC,QAAQ,EAAE,CAAC;YACf,OAAO,MAAM,CAAC,WAAW,CAAC,CAAC;QAC7B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,MAAM,CAAC,QAAQ,EAAG,GAAa,CAAC,OAAO,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ShareInfo } from '../protocol/index.js';
|
|
2
|
+
import type { Store } from '../db/store.js';
|
|
3
|
+
/**
|
|
4
|
+
* Per-session share tokens: the mechanism behind issue 14's "share this
|
|
5
|
+
* terminal by link".
|
|
6
|
+
*
|
|
7
|
+
* Unlike `TokenRegistry`, this is backed by the store rather than kept in
|
|
8
|
+
* memory - the whole point of the feature is that a link mailed to a
|
|
9
|
+
* reviewer still works after the hub restarts, until someone revokes it. The
|
|
10
|
+
* validity checks that make an FK to `session` impossible (see migration 9)
|
|
11
|
+
* live on `Hub`, not here: this class only knows how to mint, look up and
|
|
12
|
+
* forget a token, exactly as thin a wrapper over the store as `tokens.ts` is
|
|
13
|
+
* over its own map.
|
|
14
|
+
*/
|
|
15
|
+
export declare class Shares {
|
|
16
|
+
private readonly store;
|
|
17
|
+
constructor(store: Store);
|
|
18
|
+
list(): ShareInfo[];
|
|
19
|
+
/** The session a token grants, or null for an unknown or revoked one. */
|
|
20
|
+
resolve(token: string): string | null;
|
|
21
|
+
/**
|
|
22
|
+
* Mint a token for a session, or hand back the one it already has.
|
|
23
|
+
*
|
|
24
|
+
* Idempotent on purpose: clicking "share" again on a session that is
|
|
25
|
+
* already shared must not invalidate a link someone already holds - the
|
|
26
|
+
* unique index on `session_id` is what makes "already shared" a lookup
|
|
27
|
+
* rather than a race.
|
|
28
|
+
*/
|
|
29
|
+
share(sessionId: string): string;
|
|
30
|
+
unshare(sessionId: string): void;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=shares.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shares.d.ts","sourceRoot":"","sources":["../../src/agents/shares.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE5C;;;;;;;;;;;GAWG;AACH,qBAAa,MAAM;IACL,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,KAAK;IAEzC,IAAI,IAAI,SAAS,EAAE;IAInB,yEAAyE;IACzE,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAIrC;;;;;;;OAOG;IACH,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAQhC,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;CAGjC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { randomBytes } from 'node:crypto';
|
|
2
|
+
/**
|
|
3
|
+
* Per-session share tokens: the mechanism behind issue 14's "share this
|
|
4
|
+
* terminal by link".
|
|
5
|
+
*
|
|
6
|
+
* Unlike `TokenRegistry`, this is backed by the store rather than kept in
|
|
7
|
+
* memory - the whole point of the feature is that a link mailed to a
|
|
8
|
+
* reviewer still works after the hub restarts, until someone revokes it. The
|
|
9
|
+
* validity checks that make an FK to `session` impossible (see migration 9)
|
|
10
|
+
* live on `Hub`, not here: this class only knows how to mint, look up and
|
|
11
|
+
* forget a token, exactly as thin a wrapper over the store as `tokens.ts` is
|
|
12
|
+
* over its own map.
|
|
13
|
+
*/
|
|
14
|
+
export class Shares {
|
|
15
|
+
store;
|
|
16
|
+
constructor(store) {
|
|
17
|
+
this.store = store;
|
|
18
|
+
}
|
|
19
|
+
list() {
|
|
20
|
+
return this.store.listShares();
|
|
21
|
+
}
|
|
22
|
+
/** The session a token grants, or null for an unknown or revoked one. */
|
|
23
|
+
resolve(token) {
|
|
24
|
+
return this.store.resolveShare(token);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Mint a token for a session, or hand back the one it already has.
|
|
28
|
+
*
|
|
29
|
+
* Idempotent on purpose: clicking "share" again on a session that is
|
|
30
|
+
* already shared must not invalidate a link someone already holds - the
|
|
31
|
+
* unique index on `session_id` is what makes "already shared" a lookup
|
|
32
|
+
* rather than a race.
|
|
33
|
+
*/
|
|
34
|
+
share(sessionId) {
|
|
35
|
+
const existing = this.store.getShare(sessionId);
|
|
36
|
+
if (existing)
|
|
37
|
+
return existing.token;
|
|
38
|
+
const token = randomBytes(24).toString('base64url');
|
|
39
|
+
this.store.insertShare({ sessionId, token });
|
|
40
|
+
return token;
|
|
41
|
+
}
|
|
42
|
+
unshare(sessionId) {
|
|
43
|
+
this.store.removeShare(sessionId);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=shares.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shares.js","sourceRoot":"","sources":["../../src/agents/shares.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI1C;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,MAAM;IACY;IAA7B,YAA6B,KAAY;QAAZ,UAAK,GAAL,KAAK,CAAO;IAAG,CAAC;IAE7C,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;IACjC,CAAC;IAED,yEAAyE;IACzE,OAAO,CAAC,KAAa;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,SAAiB;QACrB,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAChD,IAAI,QAAQ;YAAE,OAAO,QAAQ,CAAC,KAAK,CAAC;QACpC,MAAM,KAAK,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACpD,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;QAC7C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CAAC,SAAiB;QACvB,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;CACF"}
|
package/dist/agents/wiring.d.ts
CHANGED
|
@@ -37,6 +37,14 @@ export interface WiringOutput {
|
|
|
37
37
|
* it, so their models, themes and their own MCP servers survive the session.
|
|
38
38
|
*/
|
|
39
39
|
opencodeConfig: string;
|
|
40
|
+
/**
|
|
41
|
+
* One more config file for Kilo, named by `KILO_CONFIG` and appended last
|
|
42
|
+
* to the list it already layers - the project's kilo.json, then the global
|
|
43
|
+
* ~/.config/kilo/kilo.json. The layers are deep-merged, so this file holds
|
|
44
|
+
* only what the hub is adding: the MCP server, and the brief under
|
|
45
|
+
* `instructions`. The user's own config is neither read nor rewritten.
|
|
46
|
+
*/
|
|
47
|
+
kilocodeConfigPath: string;
|
|
40
48
|
}
|
|
41
49
|
/**
|
|
42
50
|
* Where a session's brief is written. Exported because an agent with no
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wiring.d.ts","sourceRoot":"","sources":["../../src/agents/wiring.ts"],"names":[],"mappings":"AAGA,OAAO,EAAa,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7D;;;;GAIG;AAEH,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,YAAY,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B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