clavarium 0.2.24-next.1 → 0.2.24-next.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 +6 -2
- package/deploy/updater.mjs +1 -1
- package/npm-shrinkwrap.json +20 -6
- package/package.json +3 -2
- package/server/api.mjs +23 -4
- package/server/binders.mjs +90 -0
- package/server/door.mjs +4 -2
- package/server/events.mjs +2 -0
- package/server/guide.mjs +12 -5
- package/server/main.mjs +29 -7
- package/server/parley.mjs +2 -0
- package/server/secrets.mjs +88 -16
- package/server/talk.mjs +73 -12
- package/server/voice.mjs +14 -5
- package/web/app.js +192 -17
- package/web/index.html +12 -1
- package/web/links.js +164 -114
- package/web/style.css +38 -33
package/README.md
CHANGED
|
@@ -103,8 +103,12 @@ Built slice by slice; the plan is in `blueprint/architecture.html`, tab
|
|
|
103
103
|
ways: what the tool shows, and what the person attaches to a message (put
|
|
104
104
|
under /work/.parley/files/, the tool given its path). What is wrong with its
|
|
105
105
|
machine, and its restarts, are grey lines in the thread, with what can be
|
|
106
|
-
done; after a restart the tool is told once to read the
|
|
107
|
-
(`parley read --
|
|
106
|
+
done; after a restart the tool is told once to read the end of the thread
|
|
107
|
+
(`parley read --last 100`, or as the owner chose in Settings), and reads
|
|
108
|
+
further back as it needs. The page shows the end of the thread too (the
|
|
109
|
+
last 200 messages, or as each device chose), "Earlier messages" on demand;
|
|
110
|
+
the search looks in the whole thread, and each look brings only what
|
|
111
|
+
changed. Nothing is ever cut or summarised. The server keeps its own copy of the thread, out of
|
|
108
112
|
the machine: a line the tool rewrites or deletes in /work/.parley, the
|
|
109
113
|
owner's too, is shown as it was, and the thread says "History changed
|
|
110
114
|
here". Off by default, per conversation; what the tool
|
package/deploy/updater.mjs
CHANGED
|
@@ -61,7 +61,7 @@ export { ensureTunnel, tunnelUnit, relayOfUnit, TUNNEL_UNIT, TUNNEL_PROGRAM };
|
|
|
61
61
|
export const PATHS = { code: '/opt/clavarium', conf: '/etc/clavarium/update.conf', stateDir: '/var/lib/clavarium/update', data: '/home/clavarium', host: '/usr/local/sbin/clavarium-host', gitRead: '/usr/lib/clavarium/git-read', tunnel: '/usr/local/sbin/clavarium-tunnel' };
|
|
62
62
|
export const NAME = 'clavarium';
|
|
63
63
|
/* Where each package checked here must have been built: its provenance says so. */
|
|
64
|
-
export const REPOS = { clavarium: 'https://github.com/clavarium/clavarium', 'clavarium-parley': 'https://github.com/clavarium/clavarium-parley', 'clavarium-docket': 'https://github.com/clavarium/clavarium-docket' };
|
|
64
|
+
export const REPOS = { clavarium: 'https://github.com/clavarium/clavarium', 'clavarium-parley': 'https://github.com/clavarium/clavarium-parley', 'clavarium-docket': 'https://github.com/clavarium/clavarium-docket', 'clavarium-binder': 'https://github.com/clavarium/clavarium-binder' };
|
|
65
65
|
export const VERSION = /^\d{1,4}\.\d{1,4}\.\d{1,6}(-[0-9A-Za-z.-]{1,40})?$/;
|
|
66
66
|
export const LOCAL = /^local-\d{8}-\d{6}$/;
|
|
67
67
|
export const MODES = ['auto', 'asap', 'ask', 'off'];
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.24-next.
|
|
3
|
+
"version": "0.2.24-next.3",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "clavarium",
|
|
9
|
-
"version": "0.2.24-next.
|
|
9
|
+
"version": "0.2.24-next.3",
|
|
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.0-next.1",
|
|
14
15
|
"clavarium-docket": "0.1.0",
|
|
15
|
-
"clavarium-parley": "0.15.0-next.
|
|
16
|
+
"clavarium-parley": "0.15.0-next.3",
|
|
16
17
|
"mermaid": "11.17.2",
|
|
17
18
|
"node-pty": "^1.1.0",
|
|
18
19
|
"pdfjs-dist": "6.4.299",
|
|
@@ -686,6 +687,19 @@
|
|
|
686
687
|
"node": ">=6"
|
|
687
688
|
}
|
|
688
689
|
},
|
|
690
|
+
"node_modules/clavarium-binder": {
|
|
691
|
+
"version": "0.1.0-next.1",
|
|
692
|
+
"resolved": "https://registry.npmjs.org/clavarium-binder/-/clavarium-binder-0.1.0-next.1.tgz",
|
|
693
|
+
"integrity": "sha512-bwqNIICb23royK8h+qI8NuOmMaZVop3lTSAfOC9cCxY0PmHLLfIMhsFqteL65miL64eTtJdTFJo2yYIZJWQTZQ==",
|
|
694
|
+
"license": "MIT",
|
|
695
|
+
"bin": {
|
|
696
|
+
"binder": "bin/binder.mjs",
|
|
697
|
+
"binder-mcp": "server/binder.mjs"
|
|
698
|
+
},
|
|
699
|
+
"engines": {
|
|
700
|
+
"node": ">=22"
|
|
701
|
+
}
|
|
702
|
+
},
|
|
689
703
|
"node_modules/clavarium-docket": {
|
|
690
704
|
"version": "0.1.0",
|
|
691
705
|
"resolved": "https://registry.npmjs.org/clavarium-docket/-/clavarium-docket-0.1.0.tgz",
|
|
@@ -700,9 +714,9 @@
|
|
|
700
714
|
}
|
|
701
715
|
},
|
|
702
716
|
"node_modules/clavarium-parley": {
|
|
703
|
-
"version": "0.15.0-next.
|
|
704
|
-
"resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.15.0-next.
|
|
705
|
-
"integrity": "sha512-
|
|
717
|
+
"version": "0.15.0-next.3",
|
|
718
|
+
"resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.15.0-next.3.tgz",
|
|
719
|
+
"integrity": "sha512-OxTa1hJlMRLKc/1UIVYvFCRAFcbPIsjD20MTCkStupdn8BzvAx6FfB7nV6lTvXEvVjIStqOBVfhctr8MS4aQ0g==",
|
|
706
720
|
"license": "MIT",
|
|
707
721
|
"bin": {
|
|
708
722
|
"parley": "bin/parley.mjs",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.24-next.
|
|
3
|
+
"version": "0.2.24-next.3",
|
|
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.",
|
|
@@ -44,8 +44,9 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@xterm/addon-fit": "^0.11.0",
|
|
46
46
|
"@xterm/xterm": "^6.0.0",
|
|
47
|
+
"clavarium-binder": "0.1.0-next.1",
|
|
47
48
|
"clavarium-docket": "0.1.0",
|
|
48
|
-
"clavarium-parley": "0.15.0-next.
|
|
49
|
+
"clavarium-parley": "0.15.0-next.3",
|
|
49
50
|
"mermaid": "11.17.2",
|
|
50
51
|
"node-pty": "^1.1.0",
|
|
51
52
|
"pdfjs-dist": "6.4.299",
|
package/server/api.mjs
CHANGED
|
@@ -20,6 +20,11 @@
|
|
|
20
20
|
* POST /api/conversations/<name>/chat-name {name}: the name the chat gives its tool ('' : the neutral word of the dictionary)
|
|
21
21
|
* POST /api/conversations/<name>/voice-mark {on}: what is dictated into its terminal starts with a microphone sign (AI tools only)
|
|
22
22
|
* POST /api/conversations/<name>/talk/file?name=<file name> the body IS a file the person attaches -> {path, name, size}
|
|
23
|
+
* GET /api/conversations/<name>/talk?last=|days=|before=|from=|since= a part of its chat: the newest messages, those of the
|
|
24
|
+
* last days, the page before a message, up to a message found, what changed since a cursor
|
|
25
|
+
* GET /api/conversations/<name>/talk/search?q= its whole chat searched: {matches: [{id, at, from, kind, text}], count}
|
|
26
|
+
* GET /api/talk/window what a tool reads of its chat after a restart: {ai, default, choices}
|
|
27
|
+
* POST /api/talk/window {ai: 'messages:100'|'messages:200'|'messages:500'|'days:1'|'days:3'|'days:7'}
|
|
23
28
|
* GET /api/talk/thread what a chat shows of each kind of event: {levels, defaults, choices}
|
|
24
29
|
* POST /api/talk/thread {levels: {kind: 'needs-you'|'news'|'trace'}}: the owner's choice, whole or partial
|
|
25
30
|
* GET /api/conversations/<name>/guide what its tool is told about where it is: the exact texts, the owner's lines
|
|
@@ -56,6 +61,8 @@
|
|
|
56
61
|
* POST /api/conversations/<c>/git/<name>/auto {branches?, quietSeconds?, perHour?, create?, checks?, sure?}
|
|
57
62
|
* POST /api/git/<name>/refresh fetch the origin into its mirror now
|
|
58
63
|
* POST /api/git/<name>/check {head, target?}: run the checks in the machine
|
|
64
|
+
* GET /api/binder/people who may own a record, or be given a list; and the number of changes so far
|
|
65
|
+
* POST /api/binder {op, args}: the owner's change to the lists (binders.mjs), as Binder's keeper answers it
|
|
59
66
|
* POST /api/resources/<name>/remove only when attached nowhere; content is moved aside
|
|
60
67
|
* POST /api/conversations/<name>/resources {resource, access: read|write|none}
|
|
61
68
|
* POST /api/conversations/<name>/share {rights?} -> {url, minutes, qr}: a one-use pairing code;
|
|
@@ -66,7 +73,8 @@
|
|
|
66
73
|
* GET /api/conversations/<name>/signin {available, configured, host, user, items}
|
|
67
74
|
* POST /api/conversations/<name>/signin {host, port?, user, password}; empty host removes
|
|
68
75
|
* GET /api/secrets names only: a value never comes back
|
|
69
|
-
* POST /api/secrets {name, value} create or replace
|
|
76
|
+
* POST /api/secrets {name, value, expires?} create or replace; expires YYYY-MM-DD
|
|
77
|
+
* POST /api/secrets/<NAME>/replace {value?, expires?}: in place, its name and grants kept; '' removes the expiry
|
|
70
78
|
* POST /api/secrets/<NAME>/remove
|
|
71
79
|
* POST /api/secrets/<NAME>/rename {name}: its value and where it is handed go with it
|
|
72
80
|
* GET /api/conversations/<name>/health-react POST the same {on?, message?, command?}: what it does when its machine is short
|
|
@@ -136,7 +144,7 @@ function readBody(request, max = BODY_MAX) {
|
|
|
136
144
|
}
|
|
137
145
|
|
|
138
146
|
/* Returns true when the request was an API request (answered here). */
|
|
139
|
-
export async function handleApi(request, response, conversations, headers, resources, originOk = sameOrigin, shortcuts, voice, sharing, secrets, network, signin, mailboxes, gitReview, platform, answerer, wakeups, alerts, talk, gitAccess, gitKeeper, shelf, health, setup, repair, guide, capacity, updates, instance, certificate, team, reacting, machinesMove, serverLogs, history, events, bundles, wifi) {
|
|
147
|
+
export async function handleApi(request, response, conversations, headers, resources, originOk = sameOrigin, shortcuts, voice, sharing, secrets, network, signin, mailboxes, gitReview, platform, answerer, wakeups, alerts, talk, gitAccess, gitKeeper, shelf, health, setup, repair, guide, capacity, updates, instance, certificate, team, reacting, machinesMove, serverLogs, history, events, bundles, wifi, binders) {
|
|
140
148
|
const { pathname } = new URL(request.url ?? '/', 'http://local');
|
|
141
149
|
if (!pathname.startsWith('/api/')) return false;
|
|
142
150
|
let send = (status, body) => {
|
|
@@ -272,6 +280,7 @@ export async function handleApi(request, response, conversations, headers, resou
|
|
|
272
280
|
if (pathname === '/api/wifi' && wifi) return send(200, await wifi.status()), true;
|
|
273
281
|
if (pathname === '/api/wifi/scan' && wifi) return send(200, await wifi.scan()), true;
|
|
274
282
|
if (pathname === '/api/operators') return send(200, team ? { operators: team.list(), me: identity } : { local: true }), true;
|
|
283
|
+
if (pathname === '/api/binder/people' && binders) return send(200, { people: binders.people(identity), changes: binders.changes() }), true;
|
|
275
284
|
if (pathname === '/api/certificate' && certificate) return send(200, await certificate.about({ fresh: query.get('fresh') === '1' })), true;
|
|
276
285
|
/* This server's disk and memory (capacity.mjs): everything for Settings; only whether it is high for the list. */
|
|
277
286
|
if (pathname === '/api/server' && capacity) return send(200, await capacity.about()), true;
|
|
@@ -295,10 +304,13 @@ export async function handleApi(request, response, conversations, headers, resou
|
|
|
295
304
|
if (pathname === '/api/talk/words' && talk) return send(200, talk.words(query.get('lang') ?? 'en')), true;
|
|
296
305
|
if (pathname === '/api/talk/settings' && talk) return send(200, talk.settings()), true;
|
|
297
306
|
if (pathname === '/api/talk/thread' && talk) return send(200, talk.thread()), true;
|
|
307
|
+
if (pathname === '/api/talk/window' && talk) return send(200, talk.window()), true;
|
|
308
|
+
const searched = /^\/api\/conversations\/([^/]+)\/talk\/search$/.exec(pathname);
|
|
309
|
+
if (searched && talk) return send(200, talk.search(decodeURIComponent(searched[1]), query.get('q') ?? '')), true;
|
|
298
310
|
const guided = /^\/api\/conversations\/([^/]+)\/guide$/.exec(pathname);
|
|
299
311
|
if (guided && guide) return send(200, guide.about(decodeURIComponent(guided[1]))), true;
|
|
300
312
|
const talked = /^\/api\/conversations\/([^/]+)\/talk$/.exec(pathname);
|
|
301
|
-
if (talked && talk) return send(200, talk.of(decodeURIComponent(talked[1]))), true;
|
|
313
|
+
if (talked && talk) return send(200, talk.of(decodeURIComponent(talked[1]), query)), true;
|
|
302
314
|
/* Its docket: the reminders its tool set, the newest events (dockets.mjs). */
|
|
303
315
|
const docketRead = /^\/api\/conversations\/([^/]+)\/docket$/.exec(pathname);
|
|
304
316
|
if (docketRead && wakeups) return send(200, wakeups.docketOf(decodeURIComponent(docketRead[1]))), true;
|
|
@@ -344,6 +356,8 @@ export async function handleApi(request, response, conversations, headers, resou
|
|
|
344
356
|
/* What was done, once it was done: said in What happened (events.mjs), for those worth saying. */
|
|
345
357
|
if (events) { const answer = send; send = (status, out) => { if (status < 300) { try { events.fromRequest(pathname, body, identity, out); } catch { /* never in the way */ } } answer(status, out); }; }
|
|
346
358
|
if (pathname === '/api/conversations') { await conversations.admit?.(body); return send(201, conversations.create(body)), true; }
|
|
359
|
+
/* The lists: every answer is 200, a refusal said in it ({ ok: false, text }), as the keeper says it to a tool. */
|
|
360
|
+
if (pathname === '/api/binder' && binders) return send(200, binders.act(body.op, body.args, identity)), true;
|
|
347
361
|
/* Who gets what, and a whole setup in one file: see setup.mjs. */
|
|
348
362
|
if (pathname.startsWith('/api/setup/') || pathname === '/api/flows/name') {
|
|
349
363
|
if (!setup) return send(404, { error: 'Not found.' }), true;
|
|
@@ -415,6 +429,9 @@ export async function handleApi(request, response, conversations, headers, resou
|
|
|
415
429
|
}
|
|
416
430
|
const renaming = /^\/api\/secrets\/([A-Z][A-Z0-9_]{0,39})\/rename$/.exec(pathname);
|
|
417
431
|
if (renaming && secrets) return send(200, secrets.rename(renaming[1], String(body.name ?? '').trim())), true;
|
|
432
|
+
/* A new value (never sent back) and/or a new expiry, in place. */
|
|
433
|
+
const replacing = /^\/api\/secrets\/([A-Z][A-Z0-9_]{0,39})\/replace$/.exec(pathname);
|
|
434
|
+
if (replacing && secrets) return send(200, secrets.replace(replacing[1], { value: body.value, expires: body.expires })), true;
|
|
418
435
|
const dropped = /^\/api\/secrets\/([A-Z][A-Z0-9_]{0,39})\/remove$/.exec(pathname);
|
|
419
436
|
if (dropped && secrets) { secrets.remove(dropped[1]); return send(200, { ok: true }), true; }
|
|
420
437
|
if (pathname === '/api/alerts' && alerts) return send(201, alerts.add(body.subscription, body.label)), true;
|
|
@@ -422,6 +439,7 @@ export async function handleApi(request, response, conversations, headers, resou
|
|
|
422
439
|
if (pathname === '/api/alerts/test' && alerts) return send(200, { reached: await alerts.tell({ title: instance?.name() ?? 'Clavarium', body: 'This is what an alert looks like.', url: '/' }) }), true;
|
|
423
440
|
if (pathname === '/api/talk/settings' && talk) return send(200, talk.setWords({ lang: body.lang, own: body.own })), true;
|
|
424
441
|
if (pathname === '/api/talk/thread' && talk) return send(200, talk.setThread({ levels: body.levels })), true;
|
|
442
|
+
if (pathname === '/api/talk/window' && talk) return send(200, talk.setWindow({ ai: body.ai })), true;
|
|
425
443
|
const guiding = /^\/api\/conversations\/([^/]+)\/guide(\/tell)?$/.exec(pathname);
|
|
426
444
|
if (guiding && guide) {
|
|
427
445
|
const conversation = decodeURIComponent(guiding[1]);
|
|
@@ -437,7 +455,8 @@ export async function handleApi(request, response, conversations, headers, resou
|
|
|
437
455
|
if (talking[2] === '/remind') return send(200, await talk.remind(conversation)), true;
|
|
438
456
|
if (talking[2] === '/react') return send(200, await talk.react(conversation, body.to, body.reaction ?? null)), true;
|
|
439
457
|
if (typeof body.on === 'boolean') { const now = await talk.set(conversation, body.on); retell(conversation); return send(200, now), true; }
|
|
440
|
-
|
|
458
|
+
/* What the chat may add to an answer: the choices ticked, the answers of a group, the zone of a picture it is about (Parley checks each). */
|
|
459
|
+
return send(201, await talk.say(conversation, body.text, body.answers, body.files, body.via, { picked: body.picked, replies: body.replies, about: body.about })), true;
|
|
441
460
|
}
|
|
442
461
|
const docketed = /^\/api\/conversations\/([^/]+)\/docket(\/cancel)?$/.exec(pathname);
|
|
443
462
|
if (docketed && wakeups) {
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/* BINDER, AS CLAVARIUM USES IT (clavarium-binder, a project of its own, an
|
|
2
|
+
* npm dependency installed in every machine as Parley and Docket are:
|
|
3
|
+
* toolbox.mjs). Lists of records -- batches, tasks, customers, people --
|
|
4
|
+
* kept together by the owner and the tools of the conversations.
|
|
5
|
+
*
|
|
6
|
+
* THE BINDER IS KEPT HERE, in this server's data (binder/), never in a
|
|
7
|
+
* machine: what a tool could write, it could rewrite. A tool asks through
|
|
8
|
+
* its work folder's .binder (beside .parley and .docket), and is answered
|
|
9
|
+
* there; who asks is said by the folder -- conversation:<name> -- never by
|
|
10
|
+
* the ask. The owner changes it from the page (Lists).
|
|
11
|
+
*
|
|
12
|
+
* A TOOL SEES ONLY THE LISTS IT WAS GIVEN (read, or change), and never
|
|
13
|
+
* approves: a gate (Batches: "Approved") is the owner's tick.
|
|
14
|
+
*
|
|
15
|
+
* ITS DOCKET IS TOLD (dockets.mjs) when the owner gives it a record, approves
|
|
16
|
+
* one it owns, or a record it owns comes due.
|
|
17
|
+
*/
|
|
18
|
+
import { mkdirSync, lstatSync } from 'node:fs';
|
|
19
|
+
import { keeper } from 'clavarium-binder/host';
|
|
20
|
+
|
|
21
|
+
export const FOLDER = '.binder';
|
|
22
|
+
export const PUMP_MS = 1000;
|
|
23
|
+
export const DUE_MS = 30_000;
|
|
24
|
+
const AGENT = 'conversation:';
|
|
25
|
+
|
|
26
|
+
export class Binders {
|
|
27
|
+
#keeper; #resources; #conversations; #dockets; #team; #timers = []; #changes = 0; #ready = new Set();
|
|
28
|
+
|
|
29
|
+
/* `conversations()`: the names of the conversations. `dockets`: Dockets (optional): a tool told.
|
|
30
|
+
`team`: the operators (optional), each a person who may own a record. */
|
|
31
|
+
constructor({ dataDir, resources, conversations, dockets = null, team = null, now = () => Date.now() }) {
|
|
32
|
+
this.#resources = resources; this.#conversations = conversations; this.#dockets = dockets; this.#team = team;
|
|
33
|
+
this.#keeper = keeper(`${dataDir}/binder`, { sides: () => this.#sides(), now });
|
|
34
|
+
this.#keeper.store.onChange((line) => { this.#changes++; this.#heard(line); });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* Each conversation's folder, made when missing; one that is anything but a folder of its own is left out. */
|
|
38
|
+
#sides() {
|
|
39
|
+
const out = [];
|
|
40
|
+
for (const name of this.#conversations()) {
|
|
41
|
+
let dir;
|
|
42
|
+
try { dir = `${this.#resources.workFolder(name)}/${FOLDER}`; } catch { continue; }
|
|
43
|
+
const info = lstatSync(dir, { throwIfNoEntry: false });
|
|
44
|
+
if (info === undefined) { try { mkdirSync(dir); } catch { continue; } }
|
|
45
|
+
else if (!info.isDirectory() || info.isSymbolicLink()) continue;
|
|
46
|
+
out.push({ dir, who: { id: `${AGENT}${name}`, kind: 'agent', name } });
|
|
47
|
+
}
|
|
48
|
+
return out;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* A tool told, through its docket, of what concerns it. */
|
|
52
|
+
#tell(id, text) {
|
|
53
|
+
if (!this.#dockets || !id.startsWith(AGENT)) return;
|
|
54
|
+
const name = id.slice(AGENT.length);
|
|
55
|
+
try { this.#dockets.post(name, { kind: 'binder', text }); } catch { /* its docket may be off */ }
|
|
56
|
+
}
|
|
57
|
+
#heard(line) {
|
|
58
|
+
if (line.by?.kind !== 'person' || !line.record) return;
|
|
59
|
+
let r;
|
|
60
|
+
try { r = this.#keeper.store.record(line.record, line.by).record; } catch { return; }
|
|
61
|
+
if (line.op === 'edit' && Array.isArray(line.change?.owners)) {
|
|
62
|
+
for (const id of line.change.owners) this.#tell(id, `Given to you in Binder: #${r.id} ${r.title} (binder get ${r.id})`);
|
|
63
|
+
}
|
|
64
|
+
if (line.op === 'move' && r.approved) for (const id of r.owners) this.#tell(id, `Approved in Binder: #${r.id} ${r.title}`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
start() {
|
|
68
|
+
this.#timers.push(setInterval(() => { try { this.#keeper.pump(); } catch { /* the next turn */ } }, PUMP_MS));
|
|
69
|
+
this.#timers.push(setInterval(() => {
|
|
70
|
+
try { for (const { record: r } of this.#keeper.due()) for (const id of r.owners) this.#tell(id, `Due in Binder: #${r.id} ${r.title} (${r.due})`); } catch { /* the next turn */ }
|
|
71
|
+
}, DUE_MS));
|
|
72
|
+
for (const t of this.#timers) t.unref?.();
|
|
73
|
+
return () => { for (const t of this.#timers) clearInterval(t); this.#timers = []; };
|
|
74
|
+
}
|
|
75
|
+
pump() { return this.#keeper.pump(); }
|
|
76
|
+
|
|
77
|
+
/* The owner, from the page: `identity` is who signed in ('' on a server without sign-in). */
|
|
78
|
+
act(op, args, identity = '') {
|
|
79
|
+
const who = { id: `person:${identity || 'owner'}`, kind: 'person', name: identity || 'Owner' };
|
|
80
|
+
return this.#keeper.act(String(op ?? ''), args && typeof args === 'object' ? args : {}, who);
|
|
81
|
+
}
|
|
82
|
+
/* Who may own a record, or be given a list. */
|
|
83
|
+
people(identity = '') {
|
|
84
|
+
const persons = (this.#team?.list?.() ?? []).map((o) => ({ id: `person:${String(o.email ?? o.id ?? '').toLowerCase()}`, kind: 'person', name: String(o.email ?? o.id ?? '') })).filter((p) => p.name);
|
|
85
|
+
if (!persons.length) persons.push({ id: `person:${identity || 'owner'}`, kind: 'person', name: identity || 'Owner' });
|
|
86
|
+
return [...persons, ...this.#conversations().map((name) => ({ id: `${AGENT}${name}`, kind: 'agent', name }))];
|
|
87
|
+
}
|
|
88
|
+
/* A number that moves with every change: the page reads again when it moved. */
|
|
89
|
+
changes() { return this.#changes; }
|
|
90
|
+
}
|
package/server/door.mjs
CHANGED
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
* GET .../files/thumb|text POST .../files/save|make|rename|move|remove|taken (see files.mjs)
|
|
21
21
|
* POST /c/api/<pairing>/leave the device removes this pairing itself
|
|
22
22
|
* GET /c/api/<pairing>/talk/words?lang=
|
|
23
|
-
* GET /c/api/<pairing>/conversations/<any>/talk POST the same {text, answers}
|
|
23
|
+
* GET /c/api/<pairing>/conversations/<any>/talk POST the same {text, answers}; ?last= ?days= ?before= ?from= ?since=: a part of it
|
|
24
|
+
* GET /c/api/<pairing>/conversations/<any>/talk/search?q= its whole chat searched
|
|
24
25
|
* POST /c/api/<pairing>/conversations/<any>/talk/remind
|
|
25
26
|
* POST /c/api/<pairing>/conversations/<any>/talk/react {to, reaction}: a reaction to a message of the tool (null: taken back)
|
|
26
27
|
* POST /c/api/<pairing>/conversations/<any>/talk/file?name= a file attached to a message
|
|
@@ -174,7 +175,8 @@ export async function handleDoor(request, response, { devices, conversations, re
|
|
|
174
175
|
if (talk && (route === '/talk/words' || talking)) need(part.chat !== null, 'the chat');
|
|
175
176
|
if (talk && request.method === 'GET' && route === '/talk/words') return send(200, talk.words(url.searchParams.get('lang') ?? 'en'));
|
|
176
177
|
if (talk && talking) {
|
|
177
|
-
if (request.method === 'GET' && !talking[1]) return send(200, talk.of(name));
|
|
178
|
+
if (request.method === 'GET' && !talking[1]) return send(200, talk.of(name, url.searchParams));
|
|
179
|
+
if (request.method === 'GET' && talking[1] === '/search') return send(200, talk.search(name, url.searchParams.get('q') ?? ''));
|
|
178
180
|
/* Reminding the tool and writing to it: a chat given to write in. Nothing else (turning it on, inviting the tool) is a device's. */
|
|
179
181
|
if (request.method === 'POST' && (talking[1] === undefined || talking[1] === '/remind' || talking[1] === '/file' || talking[1] === '/react')) need(part.chat === 'write', 'the chat to write in');
|
|
180
182
|
if (request.method === 'POST' && talking[1] === '/react') { const body = await readJson(request); return send(200, await talk.react(name, body.to, body.reaction ?? null)); }
|
package/server/events.mjs
CHANGED
|
@@ -42,6 +42,8 @@ const SAID = [
|
|
|
42
42
|
[/^\/api\/resources\/([^/]+)\/remove$/, 'asset', (m) => `${clip(decodeURIComponent(m[1]), 40)} removed (its content put aside)`],
|
|
43
43
|
[/^\/api\/secrets$/, 'asset', (m, b) => `Secret ${clip(b.name, 40)} set`],
|
|
44
44
|
[/^\/api\/secrets\/([^/]+)\/remove$/, 'asset', (m) => `Secret ${clip(m[1], 40)} removed`],
|
|
45
|
+
/* Never the value: only that it was replaced, and the expiry. */
|
|
46
|
+
[/^\/api\/secrets\/([^/]+)\/replace$/, 'asset', (m, b) => `Secret ${clip(m[1], 40)}: ${[...(b.value ? ['value replaced'] : []), ...(b.expires === undefined ? [] : [b.expires ? `expires ${clip(b.expires, 10)}` : 'no expiry'])].join(', ') || 'unchanged'}`],
|
|
45
47
|
[/^\/api\/secrets\/([^/]+)\/rename$/, 'asset', (m, b) => `Secret ${clip(m[1], 40)} renamed ${clip(b.name, 40)}`],
|
|
46
48
|
[/^\/api\/git\/([^/]+)\/push$/, 'asset', (m, b) => `${clip(decodeURIComponent(m[1]), 40)}: a commit sent${b.target ? ` to ${clip(b.target, 40)}` : ''}`],
|
|
47
49
|
[/^\/api\/mailboxes$/, 'asset', (m, b) => `Mailbox ${clip(b.name, 40)} added`],
|
package/server/guide.mjs
CHANGED
|
@@ -97,8 +97,9 @@ export function commonText() {
|
|
|
97
97
|
const list = (items) => items.join(', ');
|
|
98
98
|
|
|
99
99
|
/* THE PART OF ONE CONVERSATION, from its facts:
|
|
100
|
-
{ name, tool, workKept, resources: [{ name, access, type, origin }], chat, online, secrets: [names], lines }
|
|
101
|
-
|
|
100
|
+
{ name, tool, workKept, resources: [{ name, access, type, origin }], chat, online, secrets: [names], lines, reread }
|
|
101
|
+
`reread`: the command that reads the end of its chat after a restart (the owner's choice, talk.mjs). */
|
|
102
|
+
export function ownText({ name, tool, workKept, resources = [], chat, online, secrets = [], lines = [], reread }) {
|
|
102
103
|
const out = [`# This conversation: ${plain(name, 40)}`, ''];
|
|
103
104
|
if (tool) out.push(`- Tool running here: ${plain(tool, 40)}.`);
|
|
104
105
|
out.push(workKept ? '- /work is kept by the server: the person sees it in Files, and it outlives the machine.' : '- /work is on this machine\'s own disk: it goes with the machine.');
|
|
@@ -118,8 +119,12 @@ export function ownText({ name, tool, workKept, resources = [], chat, online, se
|
|
|
118
119
|
: '- Chat with the person: on. Parley is installed: run parley guide. When you were given Parley as your own tools (MCP: tell, ask, doing, status...), use them to talk to the person, and say with doing what you do at each new step; the parley command does the same.');
|
|
119
120
|
/* How Parley is used is Parley's to say (parley guide); what is here is this chat's: it renders Markdown. */
|
|
120
121
|
if (chat) out.push('- The chat shows Markdown (lists, tables, "> [!IMPORTANT]") and pictures of /work: .');
|
|
122
|
+
/* The thread is kept whole: after a restart, its end is read, and further back on demand. */
|
|
123
|
+
if (chat && reread) out.push(`- After a restart: ${plain(reread, 60)}, the end of the chat; it says how to read further back.`);
|
|
121
124
|
/* Its docket (dockets.mjs): what wakes it waits there until it says done or failed. */
|
|
122
125
|
if (chat) out.push('- What wakes you (a file arrived, the clock, a call) waits in your docket: when told "run docket", run it, do each, then docket done ID or docket failed ID "why". To be reminded later: docket remind --at "2026-10-23 09:00" (or --in 2h, --cron "0 9 * * 1") "what for". docket --help says all.');
|
|
126
|
+
/* Its lists (binders.mjs): kept on the server, asked for through .binder; a person approves. */
|
|
127
|
+
out.push('- Lists kept with the person (batches, tasks, customers...): binder shows those you were given; add, note, attach, move them; a gate waits for the person\'s tick. binder --help says all.');
|
|
123
128
|
out.push(online === false ? '- Internet: off.' : '- Internet: on.');
|
|
124
129
|
if (secrets.length) out.push(`- Secrets given, by name only: ${list(secrets.map((s) => plain(s, 40)))}.`);
|
|
125
130
|
const own = lines.map((l) => plain(l)).filter(Boolean).slice(0, LINES_MAX);
|
|
@@ -182,10 +187,12 @@ const firstLine = (text) => String(text ?? '').trim().split('\n').filter(Boolean
|
|
|
182
187
|
const sha = (text) => createHash('sha256').update(text, 'utf8').digest('hex');
|
|
183
188
|
|
|
184
189
|
export class Guide {
|
|
185
|
-
#store; #vms; #conversations; #resources; #secrets; #toolbox; #tools; #chat; #say; #written = new Map(); #pointed = new Set();
|
|
190
|
+
#store; #vms; #conversations; #resources; #secrets; #toolbox; #tools; #chat; #say; #reread; #written = new Map(); #pointed = new Set();
|
|
186
191
|
|
|
187
192
|
/* `chat(name)`: is its chat on. `say(name, line)`: types a line in its terminal (wakeups.mjs). */
|
|
188
|
-
|
|
193
|
+
/* `reread()`: the command its tool runs after a restart to read the end of its chat. */
|
|
194
|
+
constructor({ store, vms, conversations, resources, secrets = null, toolbox = null, tools = [], chat = () => false, say = async () => false, reread = () => null }) {
|
|
195
|
+
this.#reread = reread;
|
|
189
196
|
this.#store = store; this.#vms = vms; this.#conversations = conversations; this.#resources = resources; this.#secrets = secrets;
|
|
190
197
|
this.#toolbox = toolbox; this.#tools = tools; this.#chat = chat; this.#say = say;
|
|
191
198
|
}
|
|
@@ -207,7 +214,7 @@ export class Guide {
|
|
|
207
214
|
const type = this.#resources.get(r.name)?.type ?? 'folder';
|
|
208
215
|
return { name: r.name, access: r.access, type, origin: type === 'git' && this.#resources.hasOrigin?.(r.name) ? originFolder(r.name) : undefined };
|
|
209
216
|
});
|
|
210
|
-
return ownText({ name, tool: this.#tool(c)?.label ?? c.tool, workKept: c.work === 'kept', resources, chat: Boolean(this.#chat(name)), online: c.offline !== true, secrets: this.#secrets?.of(name) ?? [], lines: this.lines(name) });
|
|
217
|
+
return ownText({ name, tool: this.#tool(c)?.label ?? c.tool, workKept: c.work === 'kept', resources, chat: Boolean(this.#chat(name)), online: c.offline !== true, secrets: (this.#secrets?.given ?? this.#secrets?.of)?.call(this.#secrets, name) ?? [], lines: this.lines(name), reread: this.#reread() });
|
|
211
218
|
}
|
|
212
219
|
|
|
213
220
|
/* What the page shows: the exact texts, where each is, and the line in the tool's own file. */
|
package/server/main.mjs
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* node server/main.mjs --command "your-tool" --cwd /path/to/work
|
|
13
13
|
* no VM: one tool on this machine, at /?c=<name>. For development.
|
|
14
14
|
*/
|
|
15
|
-
import { readFileSync } from 'node:fs';
|
|
15
|
+
import { readFileSync, readdirSync } from 'node:fs';
|
|
16
16
|
import { createHash } from 'node:crypto';
|
|
17
17
|
import { createServer } from 'node:http';
|
|
18
18
|
import { readFile } from 'node:fs/promises';
|
|
@@ -63,6 +63,7 @@ import { Operators } from './operators.mjs';
|
|
|
63
63
|
import { HealthReact } from './healthreact.mjs';
|
|
64
64
|
import { MachinesMove } from './machinesmove.mjs';
|
|
65
65
|
import { Wifi } from './wifi.mjs';
|
|
66
|
+
import { Binders } from './binders.mjs';
|
|
66
67
|
import { ServerLogs } from './serverlogs.mjs';
|
|
67
68
|
import { History, STEP_MS as HISTORY_STEP_MS } from './history.mjs';
|
|
68
69
|
import { Events } from './events.mjs';
|
|
@@ -99,6 +100,11 @@ export const FILES = {
|
|
|
99
100
|
'/vendor/parley-ui.css': [packageFile(PARLEY, 'ui/parley-ui.css'), 'text/css; charset=utf-8'],
|
|
100
101
|
/* Its icons (Lucide, copied in Parley): the chat's, and this page's own. */
|
|
101
102
|
'/vendor/parley-icons.js': [packageFile(PARLEY, 'ui/parley-icons.js'), 'text/javascript; charset=utf-8'],
|
|
103
|
+
/* Binder's screen: it draws the lists, this page gives it a place (Lists). */
|
|
104
|
+
'/vendor/binder-ui.js': [packageFile('clavarium-binder', 'ui/binder-ui.js'), 'text/javascript; charset=utf-8'],
|
|
105
|
+
'/vendor/binder-ui.css': [packageFile('clavarium-binder', 'ui/binder-ui.css'), 'text/css; charset=utf-8'],
|
|
106
|
+
'/vendor/binder-en.json': [packageFile('clavarium-binder', 'ui/texts/en.json'), 'application/json; charset=utf-8'],
|
|
107
|
+
'/vendor/binder-fr.json': [packageFile('clavarium-binder', 'ui/texts/fr.json'), 'application/json; charset=utf-8'],
|
|
102
108
|
'/vendor/pdf.mjs': [packageFile('pdfjs-dist', 'build/pdf.min.mjs'), 'text/javascript; charset=utf-8'],
|
|
103
109
|
'/vendor/pdf.worker.mjs': [packageFile('pdfjs-dist', 'build/pdf.worker.min.mjs'), 'text/javascript; charset=utf-8'],
|
|
104
110
|
/* Drawings in the chat (```mermaid), at the version package.json fixes: asked for only when one is shown. */
|
|
@@ -107,6 +113,14 @@ export const FILES = {
|
|
|
107
113
|
'/vendor/prism.js': [['web/prism-manual.js', ...['core', 'clike', 'markup', 'css', 'javascript', 'typescript', 'json', 'python', 'bash', 'markup-templating', 'php', 'sql', 'yaml', 'diff', 'markdown', 'ini', 'apacheconf']
|
|
108
114
|
.map((l) => packageFile('prismjs', `components/prism-${l}.min.js`))], 'text/javascript; charset=utf-8'],
|
|
109
115
|
};
|
|
116
|
+
/* Formulas in the chat are drawn by Parley with its own copy of KaTeX, loaded on the first formula
|
|
117
|
+
(the page tells it where: /vendor/katex/katex.mjs): served as Parley ships it, fonts included. */
|
|
118
|
+
try {
|
|
119
|
+
const katex = packageFile(PARLEY, 'ui/vendor/katex');
|
|
120
|
+
FILES['/vendor/katex/katex.mjs'] = [`${katex}/katex.mjs`, 'text/javascript; charset=utf-8'];
|
|
121
|
+
FILES['/vendor/katex/katex.min.css'] = [`${katex}/katex.min.css`, 'text/css; charset=utf-8'];
|
|
122
|
+
for (const font of readdirSync(`${katex}/fonts`)) if (/^[\w.-]+\.woff2$/.test(font)) FILES[`/vendor/katex/fonts/${font}`] = [`${katex}/fonts/${font}`, 'font/woff2'];
|
|
123
|
+
} catch { /* a Parley without it: formulas shown as their text */ }
|
|
110
124
|
/* The device door serves the same files under /c/: that prefix is the only
|
|
111
125
|
one the edge lets through without sign-on. Its page differs; nothing else. */
|
|
112
126
|
const DEVICE_FILES = Object.fromEntries(Object.entries(FILES).filter(([path]) => path !== '/').map(([path, file]) => [`/c${path}`, file]));
|
|
@@ -138,7 +152,7 @@ const withoutTmux = (env) => Object.fromEntries(Object.entries(env).filter(([key
|
|
|
138
152
|
|
|
139
153
|
const REFUSED = 'This Clavarium belongs to someone else: your account is not one of its operators.\n';
|
|
140
154
|
|
|
141
|
-
function serve(port, conversations, resources, { gate = () => 'local', originOk, shortcuts, voice, sharing, door, secrets, network, signin, mailboxes, gitReview, platform, answerer, wakeups, alerts, talk, gitAccess, gitKeeper, shelf, health, setup, guide, repair, capacity, updates, instance = new Instance(), certificate, team, reacting, machinesMove, serverLogs, history, events, bundles, wifi } = {}) {
|
|
155
|
+
function serve(port, conversations, resources, { gate = () => 'local', originOk, shortcuts, voice, sharing, door, secrets, network, signin, mailboxes, gitReview, platform, answerer, wakeups, alerts, talk, gitAccess, gitKeeper, shelf, health, setup, guide, repair, capacity, updates, instance = new Instance(), certificate, team, reacting, machinesMove, serverLogs, history, events, bundles, wifi, binders } = {}) {
|
|
142
156
|
/* Its manifest carries the name of this Clavarium, or the one a device chose (instance.mjs). */
|
|
143
157
|
const sendManifest = (response, url) => response.writeHead(200, { ...HEADERS, 'content-type': 'application/manifest+json' }).end(instance.manifest(new URL(url ?? '/', 'http://local').searchParams.get('name') ?? undefined));
|
|
144
158
|
const sendFile = async (response, file) => {
|
|
@@ -181,7 +195,7 @@ function serve(port, conversations, resources, { gate = () => 'local', originOk,
|
|
|
181
195
|
response.writeHead(403, { ...HEADERS, 'content-type': 'text/plain; charset=utf-8' }).end(REFUSED);
|
|
182
196
|
return;
|
|
183
197
|
}
|
|
184
|
-
if (conversations && await handleApi(request, response, conversations, HEADERS, resources, originOk, shortcuts, voice, sharing, secrets, network, signin, mailboxes, gitReview, platform, answerer, wakeups, alerts, talk, gitAccess, gitKeeper, shelf, health, setup, repair, guide, capacity, updates, instance, certificate, team, reacting, machinesMove, serverLogs, history, events, bundles, wifi)) return;
|
|
198
|
+
if (conversations && await handleApi(request, response, conversations, HEADERS, resources, originOk, shortcuts, voice, sharing, secrets, network, signin, mailboxes, gitReview, platform, answerer, wakeups, alerts, talk, gitAccess, gitKeeper, shelf, health, setup, repair, guide, capacity, updates, instance, certificate, team, reacting, machinesMove, serverLogs, history, events, bundles, wifi, binders)) return;
|
|
185
199
|
if (pathname === '/manifest.webmanifest' && request.method === 'GET') { sendManifest(response, request.url); return; }
|
|
186
200
|
const file = FILES[pathname];
|
|
187
201
|
if (!file || (request.method !== 'GET' && request.method !== 'HEAD')) {
|
|
@@ -276,7 +290,7 @@ export async function startHome({ port, host, dataDir, mntDir = dataDir, gitRese
|
|
|
276
290
|
await bounded(hostSteps, startWaitMs, 'the host program');
|
|
277
291
|
const shortcuts = new Shortcuts(new Store(`${dataDir}/shortcuts.json`));
|
|
278
292
|
/* The engine of dictation: chosen in Settings, else the environment's (voice.mjs). */
|
|
279
|
-
const voice = new Dictation({ file: new JsonFile(`${dataDir}/dictation.json`, {}), env, secret: (name) => secrets.reveal(name) });
|
|
293
|
+
const voice = new Dictation({ file: new JsonFile(`${dataDir}/dictation.json`, {}), env, secret: (name) => secrets.reveal(name), expired: (name) => secrets.isExpired(name) });
|
|
280
294
|
/* Read here already: a device paired before a conversation was shared in
|
|
281
295
|
two parts keeps the chat it reached then (see devices.mjs). */
|
|
282
296
|
const talkStore = new Store(`${dataDir}/talk.json`);
|
|
@@ -292,6 +306,10 @@ export async function startHome({ port, host, dataDir, mntDir = dataDir, gitRese
|
|
|
292
306
|
const secrets = new Secrets({ store: new Store(`${dataDir}/secrets.json`), vault, vms, grants });
|
|
293
307
|
/* A secret renamed: what names it follows (the key of dictation). `voice` is made below. */
|
|
294
308
|
secrets.renamed = (from, to) => voice.secretRenamed(from, to);
|
|
309
|
+
/* Expired: kept, no longer delivered; said once in What happened. */
|
|
310
|
+
secrets.expired = (name, users) => { events.add({ kind: 'asset', text: `Secret ${name} expired: no longer given${users.length ? ` to ${users.join(', ')}` : ''}` }); };
|
|
311
|
+
secrets.check();
|
|
312
|
+
const expiryTimer = setInterval(() => secrets.check(), 10 * 60_000); expiryTimer.unref();
|
|
295
313
|
const signin = new SignInMailboxes({ store: new Store(`${dataDir}/signin.json`), vault, rules: (name) => all.signinRules(name) });
|
|
296
314
|
/* Each opening: the runner and the attached secrets are put in the VM,
|
|
297
315
|
and the tool is started through the runner. */
|
|
@@ -311,11 +329,12 @@ export async function startHome({ port, host, dataDir, mntDir = dataDir, gitRese
|
|
|
311
329
|
its machine at a start and when a setting changes. `talk` and
|
|
312
330
|
`wakeups` are made below; only asked once the server runs. */
|
|
313
331
|
const guide = new Guide({ store: new Store(`${dataDir}/guide.json`), vms, conversations: all, resources: folders, secrets, toolbox, tools,
|
|
314
|
-
chat: (name) => Boolean(talk?.brief(name)), say: (name, line) => wakeups.say(name, line) });
|
|
332
|
+
chat: (name) => Boolean(talk?.brief(name)), say: (name, line) => wakeups.say(name, line), reread: () => talk?.rereadCommand() ?? null });
|
|
315
333
|
/* Why Parley is not in a machine, said once in the log, not at each opening. */
|
|
316
334
|
const parleySaid = new Map();
|
|
317
335
|
all.prepare = async (name, woke) => {
|
|
318
336
|
await hostReady;
|
|
337
|
+
secrets.check();
|
|
319
338
|
const wanted = secrets.signature(name);
|
|
320
339
|
const rules = network.apply();
|
|
321
340
|
if (woke || delivered.get(name) !== wanted) {
|
|
@@ -371,6 +390,9 @@ export async function startHome({ port, host, dataDir, mntDir = dataDir, gitRese
|
|
|
371
390
|
fired: (name, { text }) => talk.event(name, { kind: 'wakeup', text, topic: 'Wake-up' }) });
|
|
372
391
|
const wakeTimer = wakeups.start(wakeEveryMs);
|
|
373
392
|
const docketTimer = dockets.start(wakeEveryMs);
|
|
393
|
+
/* Lists kept with the tools, held here: see binders.mjs. */
|
|
394
|
+
const binders = new Binders({ dataDir, resources: folders, conversations: () => all.list().map((c) => c.name), dockets, team });
|
|
395
|
+
const stopBinders = binders.start();
|
|
374
396
|
/* A repository's origin kept up to date, checks run in the machine, and
|
|
375
397
|
automatic sending to the branches the owner listed: see gitkeeper.mjs. */
|
|
376
398
|
/* What could not be read is told to the agents that write in the repository, where they can act. */
|
|
@@ -466,8 +488,8 @@ export async function startHome({ port, host, dataDir, mntDir = dataDir, gitRese
|
|
|
466
488
|
void team.refresh().catch((error) => console.error(`operators: ${error.message}`));
|
|
467
489
|
const watching = setInterval(() => { void team.watch().catch(() => {}); }, 60_000); watching.unref?.();
|
|
468
490
|
}
|
|
469
|
-
const { server, listening } = serve(port, all, folders, { gate, originOk, shortcuts, voice, sharing, door, secrets, network, signin, mailboxes, gitReview, platform, answerer, wakeups, alerts, talk, gitAccess, gitKeeper, shelf, health, setup, guide, capacity, updates, instance, certificate, team, reacting, machinesMove, serverLogs, history, events, wifi, bundles: new Bundles({ dir: `${dataDir}/imports`, folder: (name) => folders.folder(name) }), repair: (name) => repairTerminal(name) });
|
|
470
|
-
server.on('close', () => { closing = true; clearInterval(historyTimer); history.save(); stopVmWatch(); stopShelf(); stopHealth(); stopUpdates(); stopWatch(); clearInterval(mailTimer); clearInterval(answerTimer); clearInterval(wakeTimer); clearInterval(docketTimer); dockets.stop(); clearInterval(gitTimer); talk.stop(); });
|
|
491
|
+
const { server, listening } = serve(port, all, folders, { gate, originOk, shortcuts, voice, sharing, door, secrets, network, signin, mailboxes, gitReview, platform, answerer, wakeups, alerts, talk, gitAccess, gitKeeper, shelf, health, setup, guide, capacity, updates, instance, certificate, team, reacting, machinesMove, serverLogs, history, events, wifi, binders, bundles: new Bundles({ dir: `${dataDir}/imports`, folder: (name) => folders.folder(name) }), repair: (name) => repairTerminal(name) });
|
|
492
|
+
server.on('close', () => { closing = true; stopBinders(); clearInterval(historyTimer); history.save(); stopVmWatch(); stopShelf(); stopHealth(); stopUpdates(); stopWatch(); clearInterval(mailTimer); clearInterval(expiryTimer); clearInterval(answerTimer); clearInterval(wakeTimer); clearInterval(docketTimer); dockets.stop(); clearInterval(gitTimer); talk.stop(); });
|
|
471
493
|
let closing = false;
|
|
472
494
|
bridge = attachBridge(server, {
|
|
473
495
|
onRejoin: (name) => all.rejoin(name),
|
package/server/parley.mjs
CHANGED
|
@@ -21,12 +21,14 @@ const require = createRequire(import.meta.url);
|
|
|
21
21
|
export const APP = fileURLToPath(new URL('..', import.meta.url));
|
|
22
22
|
export const PARLEY = 'clavarium-parley';
|
|
23
23
|
export const DOCKET = 'clavarium-docket';
|
|
24
|
+
export const BINDER = 'clavarium-binder';
|
|
24
25
|
/* THE TOOLS EVERY MACHINE IS GIVEN, each an npm dependency at an exact version, as Parley is:
|
|
25
26
|
installed by this server in every machine (toolbox.mjs), from its archive here. `usage`
|
|
26
27
|
is what /tools/index.json says of it. Adding one is adding a line here and its dependency. */
|
|
27
28
|
export const MACHINE_TOOLS = Object.freeze([
|
|
28
29
|
{ name: 'parley', pkg: PARLEY, usage: 'Installed in every machine: parley --help. Talk with the person you work for, on their screen, when their chat is on.' },
|
|
29
30
|
{ name: 'docket', pkg: DOCKET, usage: 'Installed in every machine: docket --help. What woke you, waiting until you say done or failed; and reminders you set yourself.' },
|
|
31
|
+
{ name: 'binder', pkg: BINDER, usage: 'Installed in every machine: binder --help. The lists you were given (batches, tasks, customers...): read them, add to them, note and attach; a person approves.' },
|
|
30
32
|
]);
|
|
31
33
|
|
|
32
34
|
/* Where an installed package is, by the lookup Node itself makes from here
|