clavarium 0.2.211-beta.1 → 0.2.213-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/launch/claude-code.sh +5 -2
- package/config/launch/codex.sh +1 -0
- package/config/launch/screen-watch.mjs +79 -5
- package/config/launch/vibe.sh +1 -0
- package/config/tools.json +52 -3
- package/npm-shrinkwrap.json +10 -10
- package/package.json +3 -3
- package/server/api.mjs +16 -3
- package/server/carry.mjs +2 -0
- package/server/conversations.mjs +151 -30
- package/server/dockets.mjs +29 -5
- package/server/guide.mjs +16 -6
- package/server/jobs.mjs +6 -2
- package/server/main.mjs +30 -5
- package/server/settingswords.mjs +2 -2
- package/server/signinhelp.mjs +239 -0
- package/server/talk.mjs +15 -2
- package/server/toolbox.mjs +12 -5
- package/server/tools.mjs +20 -1
- package/server/wakeups.mjs +12 -0
- package/web/app.js +141 -13
- package/web/index.html +10 -3
- package/web/style.css +3 -1
|
@@ -54,11 +54,14 @@ if [ -f "$chat/server.mjs" ]; then
|
|
|
54
54
|
|| echo "launch: the chat will not say when Claude Code works without a word" >&2
|
|
55
55
|
fi
|
|
56
56
|
# WHAT ITS SCREEN ASKS (02-11), read by the generic screen-watch -- Claude Code's own words, here and only
|
|
57
|
-
# here: not signed in, its sign-in started by itself, its link sent to the person's chat, the code they paste
|
|
57
|
+
# here: not signed in (at its start, or signed out on the way: « Login expired », 15-11), its sign-in started by itself, its link sent to the person's chat, the code they paste
|
|
58
58
|
# there typed back (02-11, tried on a real Claude Code); an update installed told to the agent, which restarts
|
|
59
59
|
# when it suits it (never in the middle of its work). A tool that changes its words: only these lines change.
|
|
60
|
+
# Since 15-11 (#362) its sign-in rules are those of config/tools.json ("signin.screen", --tool): the lines
|
|
61
|
+
# below are the fallback of an older server, and its notice. The link may go to another conversation (screen-watch.mjs).
|
|
60
62
|
node "$(dirname "$0")/screen-watch.mjs" \
|
|
61
|
-
|
|
63
|
+
--tool claude-code \
|
|
64
|
+
'type:(Not logged in|Login expired|OAuth token (has )?expired|Invalid API key)[^\n]{0,24}/login=/login' \
|
|
62
65
|
'keys:Select login method:=Enter' \
|
|
63
66
|
'link:https://(claude\.ai|claude\.com|console\.anthropic\.com)/\S*oauth\S*' \
|
|
64
67
|
'code:Paste code here' \
|
package/config/launch/codex.sh
CHANGED
|
@@ -29,6 +29,7 @@ node "$here/toml-block.mjs" .codex/config.toml tools "$block" \
|
|
|
29
29
|
# WHAT ITS SCREEN ASKS, read by the generic screen-watch -- Codex's own words: its sign-in link (and the
|
|
30
30
|
# code beside it) sent to the person's chat; an update told to the agent, which restarts when it suits it.
|
|
31
31
|
node "$here/screen-watch.mjs" \
|
|
32
|
+
--tool codex \
|
|
32
33
|
'link:https://auth\.openai\.com/\S+' \
|
|
33
34
|
'link:https://chatgpt\.com/\S*auth\S*' \
|
|
34
35
|
'notice:update available[^\n]{0,120}=Your tool has an update: when nothing runs, touch /work/.parley/restart-asked to take it up.' \
|
|
@@ -15,9 +15,25 @@
|
|
|
15
15
|
* code:PATTERN the tool waits for a code the person gets after signing in: the next message they write
|
|
16
16
|
* in the chat that looks like one (no space, 10 to 300 signs) is typed there, then Enter.
|
|
17
17
|
* Only the last LINES lines are read: what the tool prints of its own work above never counts.
|
|
18
|
+
*
|
|
19
|
+
* THE RULES FROM THE TOOLS' CONFIGURATION (15-11, #362): `--tool ID` reads the rules of that tool from
|
|
20
|
+
* screen-rules.json beside this file (written by the server from config/tools.json, "signin.screen"); its
|
|
21
|
+
* link/keys/type/code rules then replace those its launcher gave, which stay as the fallback of a launcher
|
|
22
|
+
* or a server older than this. Its notice rules are its launcher's always.
|
|
23
|
+
*
|
|
24
|
+
* A SIGN-IN LINK HANDED TO ANOTHER CONVERSATION (15-11, #362). The link is not told in the chat at once: it is
|
|
25
|
+
* written in the chat folder (signin-ask.json) and the server says where it goes (signin-route.json):
|
|
26
|
+
* companion another conversation, with a browser already signed in, opens it; the person only clicks
|
|
27
|
+
* Authorize there. The code it reads is typed here by the server; nothing is told here.
|
|
28
|
+
* person the link told in the chat, as before (no companion, or it failed, or the person asked).
|
|
29
|
+
* done the server typed the code.
|
|
30
|
+
* No answer within HAND_MS (an older server): told to the person. The link is never written anywhere else.
|
|
18
31
|
*/
|
|
19
32
|
import { spawnSync } from 'node:child_process';
|
|
20
|
-
import {
|
|
33
|
+
import { randomUUID } from 'node:crypto';
|
|
34
|
+
import { existsSync, readFileSync, renameSync, statSync, writeFileSync } from 'node:fs';
|
|
35
|
+
import { dirname, join } from 'node:path';
|
|
36
|
+
import { fileURLToPath } from 'node:url';
|
|
21
37
|
|
|
22
38
|
const LINES = 12; const EVERY_MS = 3000;
|
|
23
39
|
const KEYS = new Set(['Enter', 'Down', 'Up', 'Left', 'Right', 'Escape', 'Tab', 'y', 'n', '1', '2', '3']);
|
|
@@ -31,6 +47,18 @@ export function rulesOf(args) {
|
|
|
31
47
|
try { return [{ kind: m[1], re: new RegExp(pattern, 'i'), value }]; } catch { return []; }
|
|
32
48
|
});
|
|
33
49
|
}
|
|
50
|
+
/* What the person pastes, or the companion gives back, that may be typed as a code: no space, 10 to 300 signs. */
|
|
51
|
+
export const CODE = /^[A-Za-z0-9_#.~+/=-]{10,300}$/;
|
|
52
|
+
export const RULES_FILE = 'screen-rules.json';
|
|
53
|
+
const SIGNIN_KINDS = new Set(['link', 'keys', 'type', 'code']);
|
|
54
|
+
/* The rules of this start: those of the tool's configuration when there are any (`file`: screen-rules.json
|
|
55
|
+
read, { toolId: [rule, ...] }), its launcher's notices kept; else all its launcher gave (15-11). */
|
|
56
|
+
export function rulesFor(args, file = null) {
|
|
57
|
+
const at = args.indexOf('--tool'); const tool = at >= 0 ? args[at + 1] : null;
|
|
58
|
+
const given = rulesOf(at >= 0 ? args.filter((_, i) => i !== at && i !== at + 1) : args);
|
|
59
|
+
const own = tool && file && typeof file === 'object' && Array.isArray(file[tool]) ? rulesOf(file[tool].filter((r) => typeof r === 'string')).filter((r) => SIGNIN_KINDS.has(r.kind)) : [];
|
|
60
|
+
return own.length ? [...own, ...given.filter((r) => r.kind === 'notice')] : given;
|
|
61
|
+
}
|
|
34
62
|
/* -> what to do on this screen: [{ kind, match, value }], each once (seen: a Set kept between looks). */
|
|
35
63
|
export function actionsOn(screen, rules, seen) {
|
|
36
64
|
/* A long link the tool's screen broke over several lines (full lines, no space): put back in one. */
|
|
@@ -56,9 +84,43 @@ export function actionsOn(screen, rules, seen) {
|
|
|
56
84
|
return out;
|
|
57
85
|
}
|
|
58
86
|
|
|
87
|
+
/* Where a sign-in link goes, step by step (15-11, #362): what to do, as a list of effects the caller runs --
|
|
88
|
+
{ do: 'ask', ask } (write signin-ask.json), 'tell-link' { a } (the link in the person's chat), 'arm' (the next
|
|
89
|
+
code the person pastes is typed), 'tell-paste' (say so). `route()`: signin-route.json as read, or null. */
|
|
90
|
+
export const HAND_MS = 20_000;
|
|
91
|
+
export class Relay {
|
|
92
|
+
#ask = null; #now; #id; #route; #chat;
|
|
93
|
+
constructor({ route = () => null, chat = () => true, now = () => Date.now(), id = () => randomUUID() } = {}) { this.#route = route; this.#chat = chat; this.#now = now; this.#id = id; }
|
|
94
|
+
/* Told to the person: the ask says so too (`told`), so that a server that reads it late hands it to nobody. */
|
|
95
|
+
#person() { const a = this.#ask; a.route = 'person'; return [{ do: 'ask', ask: { ...a.file, told: true } }, { do: 'tell-link', a: a.a }, ...(a.codeSeen ? [{ do: 'arm' }, { do: 'tell-paste' }] : [])]; }
|
|
96
|
+
link(a) {
|
|
97
|
+
/* No chat folder: nowhere to hand it over, nobody but the person (and the chat is off anyway). */
|
|
98
|
+
if (!this.#chat()) return [{ do: 'tell-link', a }];
|
|
99
|
+
const id = this.#id(); const at = this.#now();
|
|
100
|
+
this.#ask = { id, at, a, route: null, codeSeen: false, file: { id, at: new Date(at).toISOString(), link: a.match, around: a.around ?? '' } };
|
|
101
|
+
return [{ do: 'ask', ask: this.#ask.file }];
|
|
102
|
+
}
|
|
103
|
+
code() {
|
|
104
|
+
const a = this.#ask;
|
|
105
|
+
if (!a || a.route === 'person') return [{ do: 'arm' }, { do: 'tell-paste' }];
|
|
106
|
+
/* Handed over, or not known yet: the person is not asked to paste, unless it comes back to them. */
|
|
107
|
+
a.codeSeen = true; return [];
|
|
108
|
+
}
|
|
109
|
+
step() {
|
|
110
|
+
const a = this.#ask; if (!a || a.route === 'person') return [];
|
|
111
|
+
const r = this.#route(); const mine = r && r.id === a.id ? r.route : null;
|
|
112
|
+
if (mine === 'done') { this.#ask = null; return []; }
|
|
113
|
+
if (mine === 'person') return this.#person();
|
|
114
|
+
if (mine === 'companion') { a.route = 'companion'; return []; }
|
|
115
|
+
if (a.route === null && this.#now() - a.at > HAND_MS) return this.#person();
|
|
116
|
+
return [];
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
59
120
|
const main = process.argv[1]?.endsWith('screen-watch.mjs');
|
|
60
121
|
if (main) {
|
|
61
|
-
|
|
122
|
+
let file = null; try { file = JSON.parse(readFileSync(join(dirname(fileURLToPath(import.meta.url)), RULES_FILE), 'utf8')); } catch { /* none: its launcher's rules */ }
|
|
123
|
+
const rules = rulesFor(process.argv.slice(2), file);
|
|
62
124
|
const tmux = ['-L', process.env.SCREEN_WATCH_SOCKET ?? 'clavarium'];
|
|
63
125
|
const pane = process.env.SCREEN_WATCH_PANE ?? '=main:';
|
|
64
126
|
const chat = process.env.PARLEY_DIR ?? '/work/.parley';
|
|
@@ -73,23 +135,35 @@ if (main) {
|
|
|
73
135
|
for (const line of text.split('\n').filter(Boolean)) {
|
|
74
136
|
let m; try { m = JSON.parse(line); } catch { continue; }
|
|
75
137
|
const code = String(m?.text ?? '').trim();
|
|
76
|
-
if (
|
|
138
|
+
if (CODE.test(code)) {
|
|
77
139
|
spawnSync('tmux', [...tmux, 'send-keys', '-t', pane, '-l', '--', code], { timeout: 5000 });
|
|
78
140
|
spawnSync('tmux', [...tmux, 'send-keys', '-t', pane, 'Enter'], { timeout: 5000 });
|
|
79
141
|
awaiting = null; return;
|
|
80
142
|
}
|
|
81
143
|
}
|
|
82
144
|
};
|
|
145
|
+
/* The sign-in link's way (Relay): asked in the chat folder, routed by the server. */
|
|
146
|
+
const readRoute = () => { try { return JSON.parse(readFileSync(`${chat}/signin-route.json`, 'utf8')); } catch { return null; } };
|
|
147
|
+
const relay = new Relay({ route: readRoute, chat: () => existsSync(chat) });
|
|
148
|
+
const run = (effects) => {
|
|
149
|
+
for (const e of effects) {
|
|
150
|
+
if (e.do === 'ask') { try { writeFileSync(`${chat}/.signin-ask.json.new`, JSON.stringify(e.ask)); renameSync(`${chat}/.signin-ask.json.new`, `${chat}/signin-ask.json`); } catch { /* not written: no answer comes, told to the person after HAND_MS */ } }
|
|
151
|
+
if (e.do === 'tell-link') spawnSync('parley', ['tell', `Your tool asks you to open this link: ${e.a.match}${e.a.around && e.a.around !== e.a.match ? `\n\n\`\`\`\n${e.a.around}\n\`\`\`` : ''}`, '--dir', chat], { timeout: 10_000 });
|
|
152
|
+
if (e.do === 'arm') awaiting = codeFrom();
|
|
153
|
+
if (e.do === 'tell-paste') spawnSync('parley', ['tell', 'Once signed in, paste here the code the page gives you.', '--dir', chat], { timeout: 10_000 });
|
|
154
|
+
}
|
|
155
|
+
};
|
|
83
156
|
const look = () => {
|
|
84
157
|
typeCode();
|
|
158
|
+
run(relay.step());
|
|
85
159
|
const r = spawnSync('tmux', [...tmux, 'capture-pane', '-p', '-t', pane], { encoding: 'utf8', timeout: 5000 });
|
|
86
160
|
if (r.status !== 0) return;
|
|
87
161
|
for (const a of actionsOn(r.stdout, rules, seen)) {
|
|
88
|
-
if (a.kind === 'link')
|
|
162
|
+
if (a.kind === 'link') run(relay.link(a));
|
|
89
163
|
if (a.kind === 'notice') spawnSync('docket', ['remind', '--in', '1m', a.value, '--dir', process.env.DOCKET_DIR ?? '/work/.docket'], { timeout: 10_000 });
|
|
90
164
|
if (a.kind === 'keys') for (const k of a.value) spawnSync('tmux', [...tmux, 'send-keys', '-t', pane, k], { timeout: 5000 });
|
|
91
165
|
if (a.kind === 'type') { spawnSync('tmux', [...tmux, 'send-keys', '-t', pane, '-l', '--', a.value], { timeout: 5000 }); spawnSync('tmux', [...tmux, 'send-keys', '-t', pane, 'Enter'], { timeout: 5000 }); }
|
|
92
|
-
if (a.kind === 'code')
|
|
166
|
+
if (a.kind === 'code') run(relay.code());
|
|
93
167
|
}
|
|
94
168
|
};
|
|
95
169
|
/* Its life is the tool's: started just before the launcher becomes the tool (exec), it ends with it. */
|
package/config/launch/vibe.sh
CHANGED
|
@@ -34,6 +34,7 @@ node "$here/toml-block.mjs" .vibe/config.toml tools "$block" \
|
|
|
34
34
|
# WHAT ITS SCREEN ASKS, read by the generic screen-watch -- Vibe's own words: an update told to the
|
|
35
35
|
# agent, which restarts when it suits it.
|
|
36
36
|
node "$here/screen-watch.mjs" \
|
|
37
|
+
--tool vibe \
|
|
37
38
|
'notice:(new version|update) (is )?available[^\n]{0,120}=Your tool has an update: when nothing runs, touch /work/.parley/restart-asked to take it up.' \
|
|
38
39
|
</dev/null >/dev/null 2>&1 &
|
|
39
40
|
exec "$@"
|
package/config/tools.json
CHANGED
|
@@ -72,6 +72,12 @@
|
|
|
72
72
|
"claude.ai",
|
|
73
73
|
"claude.com",
|
|
74
74
|
"anthropic.com"
|
|
75
|
+
],
|
|
76
|
+
"screen": [
|
|
77
|
+
"type:(Not logged in|Login expired|OAuth token (has )?expired|Invalid API key)[^\\n]{0,24}/login=/login",
|
|
78
|
+
"keys:Select login method:=Enter",
|
|
79
|
+
"link:https://(claude\\.ai|claude\\.com|console\\.anthropic\\.com)/\\S*oauth\\S*",
|
|
80
|
+
"code:Paste code here"
|
|
75
81
|
]
|
|
76
82
|
}
|
|
77
83
|
},
|
|
@@ -117,7 +123,24 @@
|
|
|
117
123
|
"opencode-ai"
|
|
118
124
|
],
|
|
119
125
|
"npm-writable"
|
|
120
|
-
]
|
|
126
|
+
],
|
|
127
|
+
"signin": {
|
|
128
|
+
"senders": [
|
|
129
|
+
"anthropic.com",
|
|
130
|
+
"claude.com",
|
|
131
|
+
"claude.ai"
|
|
132
|
+
],
|
|
133
|
+
"links": [
|
|
134
|
+
"claude.ai",
|
|
135
|
+
"claude.com",
|
|
136
|
+
"anthropic.com"
|
|
137
|
+
],
|
|
138
|
+
"note": "15-11: screen rules from its Anthropic sign-in plugin (opencode-anthropic-auth 0.0.13: the link, then \"Paste the authorization code here\"); not tried on a real OpenCode screen; OpenCode has no launcher yet, so nothing reads them.",
|
|
139
|
+
"screen": [
|
|
140
|
+
"link:https://(claude\\.ai|console\\.anthropic\\.com)/oauth/authorize\\S*",
|
|
141
|
+
"code:Paste the authorization code here"
|
|
142
|
+
]
|
|
143
|
+
}
|
|
121
144
|
},
|
|
122
145
|
{
|
|
123
146
|
"id": "guichet",
|
|
@@ -210,7 +233,21 @@
|
|
|
210
233
|
],
|
|
211
234
|
"npm-writable"
|
|
212
235
|
],
|
|
213
|
-
"launch": "codex.sh"
|
|
236
|
+
"launch": "codex.sh",
|
|
237
|
+
"signin": {
|
|
238
|
+
"senders": [
|
|
239
|
+
"openai.com"
|
|
240
|
+
],
|
|
241
|
+
"links": [
|
|
242
|
+
"openai.com",
|
|
243
|
+
"chatgpt.com"
|
|
244
|
+
],
|
|
245
|
+
"note": "15-11: the links codex.sh watched (02-11); a device sign-in shows a one-time code beside its link, handed over with it.",
|
|
246
|
+
"screen": [
|
|
247
|
+
"link:https://auth\\.openai\\.com/\\S+",
|
|
248
|
+
"link:https://chatgpt\\.com/\\S*auth\\S*"
|
|
249
|
+
]
|
|
250
|
+
}
|
|
214
251
|
},
|
|
215
252
|
{
|
|
216
253
|
"id": "vibe",
|
|
@@ -271,7 +308,19 @@
|
|
|
271
308
|
"/opt/vibe/bin/vibe",
|
|
272
309
|
"/usr/local/bin/vibe"
|
|
273
310
|
]
|
|
274
|
-
]
|
|
311
|
+
],
|
|
312
|
+
"signin": {
|
|
313
|
+
"senders": [
|
|
314
|
+
"mistral.ai"
|
|
315
|
+
],
|
|
316
|
+
"links": [
|
|
317
|
+
"mistral.ai"
|
|
318
|
+
],
|
|
319
|
+
"note": "15-11: screen rule from mistral-vibe 3.1.2 (browser sign-in at console.mistral.ai, which it then polls: no code to type); its own words on the screen not tried.",
|
|
320
|
+
"screen": [
|
|
321
|
+
"link:https://(console|auth)\\.mistral\\.ai/\\S+"
|
|
322
|
+
]
|
|
323
|
+
}
|
|
275
324
|
},
|
|
276
325
|
{
|
|
277
326
|
"id": "gemini",
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.213-beta.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "clavarium",
|
|
9
|
-
"version": "0.2.
|
|
9
|
+
"version": "0.2.213-beta.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
|
13
13
|
"@xterm/xterm": "^6.0.0",
|
|
14
|
-
"clavarium-binder": "0.1.
|
|
14
|
+
"clavarium-binder": "0.1.63-next.1",
|
|
15
15
|
"clavarium-docket": "0.1.2-next.2",
|
|
16
|
-
"clavarium-parley": "0.17.
|
|
16
|
+
"clavarium-parley": "0.17.95-next.1",
|
|
17
17
|
"clavarium-tether": "0.1.0-next.67",
|
|
18
18
|
"mammoth": "1.13.0",
|
|
19
19
|
"mermaid": "11.17.2",
|
|
@@ -761,9 +761,9 @@
|
|
|
761
761
|
}
|
|
762
762
|
},
|
|
763
763
|
"node_modules/clavarium-binder": {
|
|
764
|
-
"version": "0.1.
|
|
765
|
-
"resolved": "https://registry.npmjs.org/clavarium-binder/-/clavarium-binder-0.1.
|
|
766
|
-
"integrity": "sha512
|
|
764
|
+
"version": "0.1.63-next.1",
|
|
765
|
+
"resolved": "https://registry.npmjs.org/clavarium-binder/-/clavarium-binder-0.1.63-next.1.tgz",
|
|
766
|
+
"integrity": "sha512-+zk4f8JRnF7D3z2g17QkeoUIlBYooQZ5arSDsMNF4MtmyBeLQ429ou97bMb2zslCwCwxv9QgrbIbUQF8AnsSzg==",
|
|
767
767
|
"license": "MIT",
|
|
768
768
|
"bin": {
|
|
769
769
|
"binder": "bin/binder.mjs",
|
|
@@ -787,9 +787,9 @@
|
|
|
787
787
|
}
|
|
788
788
|
},
|
|
789
789
|
"node_modules/clavarium-parley": {
|
|
790
|
-
"version": "0.17.
|
|
791
|
-
"resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.
|
|
792
|
-
"integrity": "sha512-
|
|
790
|
+
"version": "0.17.95-next.1",
|
|
791
|
+
"resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.95-next.1.tgz",
|
|
792
|
+
"integrity": "sha512-O4AOoNf9H6VejHu7ur9e8J4xDZMFDrhtrRjOef9FY/0T1WIyrNW6lOMT3UfxTTfNij+EWbnJCBRQX8iO7ZGUMQ==",
|
|
793
793
|
"license": "MIT",
|
|
794
794
|
"bin": {
|
|
795
795
|
"parley": "bin/parley.mjs",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.213-beta.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "A conversation is a VM with a terminal in it. Everything else is a folder.",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@xterm/addon-fit": "^0.11.0",
|
|
47
47
|
"@xterm/xterm": "^6.0.0",
|
|
48
|
-
"clavarium-binder": "0.1.
|
|
48
|
+
"clavarium-binder": "0.1.63-next.1",
|
|
49
49
|
"clavarium-docket": "0.1.2-next.2",
|
|
50
|
-
"clavarium-parley": "0.17.
|
|
50
|
+
"clavarium-parley": "0.17.95-next.1",
|
|
51
51
|
"clavarium-tether": "0.1.0-next.67",
|
|
52
52
|
"mammoth": "1.13.0",
|
|
53
53
|
"mermaid": "11.17.2",
|
package/server/api.mjs
CHANGED
|
@@ -25,9 +25,13 @@
|
|
|
25
25
|
* POST /api/binder/suggest {id}: at most three quick actions for that card -> {actions: [{key, label, why, on, ask?}]}
|
|
26
26
|
* POST /api/mailboxes/<name>/live {smtp, email?}: that mailbox connected live too (send, move...), its password reused
|
|
27
27
|
* POST /api/conversations/<name>/erase {confirm: <its name>}: deleted for good -- its machine and its work files
|
|
28
|
-
* POST /api/conversations/<name>/into-machine {machine, machineMb?}: moved into a shared machine (#221), its tool's state along (202)
|
|
29
|
-
*
|
|
28
|
+
* POST /api/conversations/<name>/into-machine {machine, machineMb?}: moved into a shared machine (#221), its tool's state along (202);
|
|
29
|
+
* {} (no machine): out of its shared machine, into one of its own (15-11)
|
|
30
|
+
* POST /api/conversations/<name>/copy {title?, machine?, machineMb?, reminders?}: a copy -- its work, its tool's state, its accesses (its reminders and wake-ups when asked); it untouched (202)
|
|
30
31
|
* POST /api/conversations/<name>/rebuild {reset?, confirm?}: built again; reset (confirm: its name) for a working one too
|
|
32
|
+
* POST /api/signin-companion {companion}: the conversation that signs the others' tools in with its browser ('' none; 15-11); {clicks}: it clicks Authorize itself
|
|
33
|
+
* POST /api/conversations/<name>/signin-companion {companion}: its own (a conversation, "none"), or null for the general one; never itself
|
|
34
|
+
* POST /api/conversations/<name>/signin-link its sign-in handed to a companion: shown to the person instead
|
|
31
35
|
* POST /api/conversations/<name>/ask-first {on}: its tool asks before acting (true), or acts without asking in its machine (false, the default), from its next start
|
|
32
36
|
* POST /api/conversations/<name>/resume {on}: its tool takes up its last session when it starts (true), or starts fresh
|
|
33
37
|
* POST /api/conversations/<name>/terminal/repair its terminal does not come though its machine runs: repaired
|
|
@@ -409,6 +413,8 @@ export async function handleApi(request, response, conversations, headers, resou
|
|
|
409
413
|
if (pathname === '/api/git-hosts' && gitAccess) return send(200, gitAccess.hosts()), true;
|
|
410
414
|
if (pathname === '/api/platform' && platform) return send(200, platform), true;
|
|
411
415
|
if (pathname === '/api/instance' && instance) return send(200, instance.about()), true;
|
|
416
|
+
/* The sign-in companions (signinhelp.mjs, 15-11): the general one, each conversation's own, their browsers. */
|
|
417
|
+
if (pathname === '/api/signin-companion' && conversations.signinHelp) return send(200, conversations.signinHelp.view()), true;
|
|
412
418
|
if (pathname === '/api/shelf' && shelf) return send(200, shelf.about()), true;
|
|
413
419
|
/* Settings, Updates (updates.mjs): what runs, what is out, the mode, what happened. */
|
|
414
420
|
if (pathname === '/api/updates' && updates) return send(200, updates.about()), true;
|
|
@@ -999,6 +1005,12 @@ export async function handleApi(request, response, conversations, headers, resou
|
|
|
999
1005
|
}
|
|
1000
1006
|
const later = /^\/api\/conversations\/([^/]+)\/machine\/cancel$/.exec(pathname);
|
|
1001
1007
|
if (later) return send(200, conversations.cancelResize(decodeURIComponent(later[1]))), true;
|
|
1008
|
+
/* DELEGATED SIGN-IN (signinhelp.mjs, 15-11): the companion of all, of one conversation, and the link shown to the person instead. */
|
|
1009
|
+
if (pathname === '/api/signin-companion' && conversations.signinHelp) return send(200, body.clicks !== undefined ? conversations.signinHelp.setClicks(body.clicks) : conversations.signinHelp.setGeneral(body.companion)), true;
|
|
1010
|
+
const companionOf = /^\/api\/conversations\/([^/]+)\/signin-companion$/.exec(pathname);
|
|
1011
|
+
if (companionOf && conversations.signinHelp) return send(200, conversations.signinHelp.setFor(decodeURIComponent(companionOf[1]), body.companion ?? null)), true;
|
|
1012
|
+
const linkOf = /^\/api\/conversations\/([^/]+)\/signin-link$/.exec(pathname);
|
|
1013
|
+
if (linkOf && conversations.signinHelp) return send(200, conversations.signinHelp.showLink(decodeURIComponent(linkOf[1]))), true;
|
|
1002
1014
|
const asking = /^\/api\/conversations\/([^/]+)\/ask-first$/.exec(pathname);
|
|
1003
1015
|
if (asking) return send(200, conversations.setAskFirst(decodeURIComponent(asking[1]), body.on)), true;
|
|
1004
1016
|
const naming = /^\/api\/conversations\/([^/]+)\/chat-name$/.exec(pathname);
|
|
@@ -1031,6 +1043,7 @@ export async function handleApi(request, response, conversations, headers, resou
|
|
|
1031
1043
|
/* Moved into a shared machine (#221): one there already, or a new one of the size given. */
|
|
1032
1044
|
const moving = /^\/api\/conversations\/([^/]+)\/into-machine$/.exec(pathname);
|
|
1033
1045
|
if (moving) {
|
|
1046
|
+
if (body?.machine === undefined) return send(202, await conversations.moveToOwn(decodeURIComponent(moving[1]))), true;
|
|
1034
1047
|
const machineMb = body?.machineMb === undefined ? undefined : Number(body.machineMb);
|
|
1035
1048
|
return send(202, await conversations.moveToShared(decodeURIComponent(moving[1]), { machine: body?.machine, machineMb })), true;
|
|
1036
1049
|
}
|
|
@@ -1039,7 +1052,7 @@ export async function handleApi(request, response, conversations, headers, resou
|
|
|
1039
1052
|
if (copying) {
|
|
1040
1053
|
const machineMb = body?.machineMb === undefined ? undefined : Number(body.machineMb);
|
|
1041
1054
|
const machine = typeof body?.machine === 'string' && body.machine ? body.machine : undefined;
|
|
1042
|
-
return send(202, await conversations.copy(decodeURIComponent(copying[1]), { title: body?.title, machine, machineMb })), true;
|
|
1055
|
+
return send(202, await conversations.copy(decodeURIComponent(copying[1]), { title: body?.title, machine, machineMb, reminders: body?.reminders === true })), true;
|
|
1043
1056
|
}
|
|
1044
1057
|
const again = /^\/api\/conversations\/([^/]+)\/rebuild$/.exec(pathname);
|
|
1045
1058
|
if (again) {
|
package/server/carry.mjs
CHANGED
|
@@ -42,6 +42,8 @@ export function wholeStream(homeTar, workDir, done = () => {}) {
|
|
|
42
42
|
const home = createReadStream(homeTar, { start: 0, end: size - END - 1 });
|
|
43
43
|
home.on('error', end);
|
|
44
44
|
home.on('end', () => {
|
|
45
|
+
/* Its home read whole: its part taken away now, before the file ends (15-11, a test saw it still there). */
|
|
46
|
+
done();
|
|
45
47
|
/* Its work: every file, its carried parts left out; named work/... (a link's target left as it is). */
|
|
46
48
|
child = spawn('tar', ['-cf', '-', '-b', '1', '-C', workDir, `--exclude=./${CARRY}`, '--transform', 's,^\\.,work,S', '.'], { stdio: ['ignore', 'pipe', 'pipe'] });
|
|
47
49
|
child.stdout.pipe(gzip);
|