@openagt/dashboard 0.10.0 → 0.12.0
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 +1 -6
- package/dist/built-in.d.ts +18 -2
- package/dist/built-in.d.ts.map +1 -1
- package/dist/built-in.js +29 -6
- package/dist/built-in.js.map +1 -1
- package/dist/cli.d.ts +4 -10
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +11 -67
- package/dist/cli.js.map +1 -1
- package/dist/client.d.ts +2 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +3 -4
- package/dist/client.js.map +1 -1
- package/dist/clone-project.d.ts +69 -0
- package/dist/clone-project.d.ts.map +1 -0
- package/dist/clone-project.js +124 -0
- package/dist/clone-project.js.map +1 -0
- package/dist/daemon-runtime.d.ts +12 -12
- package/dist/daemon-runtime.d.ts.map +1 -1
- package/dist/daemon-runtime.js +96 -35
- package/dist/daemon-runtime.js.map +1 -1
- package/dist/daemon.d.ts +3 -14
- package/dist/daemon.d.ts.map +1 -1
- package/dist/daemon.js +15 -26
- package/dist/daemon.js.map +1 -1
- package/dist/dashboard/bridge-endpoints.d.ts +5 -5
- package/dist/dashboard/bridge-endpoints.js +5 -5
- package/dist/dashboard/http.d.ts +1 -1
- package/dist/dashboard/http.js +1 -1
- package/dist/dashboard/machine-call.d.ts +10 -0
- package/dist/dashboard/machine-call.d.ts.map +1 -0
- package/dist/dashboard/machine-call.js +86 -0
- package/dist/dashboard/machine-call.js.map +1 -0
- package/dist/dashboard/module-serve.d.ts +6 -0
- package/dist/dashboard/module-serve.d.ts.map +1 -1
- package/dist/dashboard/module-serve.js +24 -8
- package/dist/dashboard/module-serve.js.map +1 -1
- package/dist/dashboard/relay-endpoints.d.ts +26 -17
- package/dist/dashboard/relay-endpoints.d.ts.map +1 -1
- package/dist/dashboard/relay-endpoints.js +70 -27
- package/dist/dashboard/relay-endpoints.js.map +1 -1
- package/dist/dashboard/remote-run.d.ts +77 -32
- package/dist/dashboard/remote-run.d.ts.map +1 -1
- package/dist/dashboard/remote-run.js +120 -42
- package/dist/dashboard/remote-run.js.map +1 -1
- package/dist/dashboard/rpc-serve.d.ts +28 -25
- package/dist/dashboard/rpc-serve.d.ts.map +1 -1
- package/dist/dashboard/rpc-serve.js +26 -22
- package/dist/dashboard/rpc-serve.js.map +1 -1
- package/dist/dashboard/screen.d.ts +53 -0
- package/dist/dashboard/screen.d.ts.map +1 -0
- package/dist/dashboard/screen.js +175 -0
- package/dist/dashboard/screen.js.map +1 -0
- package/dist/dashboard/server.d.ts +18 -19
- package/dist/dashboard/server.d.ts.map +1 -1
- package/dist/dashboard/server.js +57 -84
- package/dist/dashboard/server.js.map +1 -1
- package/dist/dashboard/types.d.ts +11 -16
- package/dist/dashboard/types.d.ts.map +1 -1
- package/dist/dashboard/web-start-endpoints.d.ts +2 -2
- package/dist/dashboard/web-start-endpoints.js +1 -1
- package/dist/dashboard-bundle/assets/main-BHMlP40v.css +2 -0
- package/dist/dashboard-bundle/assets/main-D0qZC1r-.js +140 -0
- package/dist/dashboard-bundle/assets/{module-gKz-ZvkG.js → module-ZjyA5WUg.js} +4 -4
- package/dist/dashboard-bundle/host/module.js +1 -1
- package/dist/dashboard-bundle/index.html +3 -3
- package/dist/dashboard-rpc/context.d.ts +4 -4
- package/dist/dashboard-rpc/context.js +5 -5
- package/dist/dashboard-rpc/context.js.map +1 -1
- package/dist/dashboard-rpc/control.d.ts +1 -1
- package/dist/dashboard-rpc/control.js +7 -7
- package/dist/dashboard-rpc/control.js.map +1 -1
- package/dist/dashboard-rpc/events.d.ts +1 -1
- package/dist/dashboard-rpc/events.js +1 -1
- package/dist/dashboard-rpc/index.d.ts +3 -3
- package/dist/dashboard-rpc/index.d.ts.map +1 -1
- package/dist/dashboard-rpc/index.js +5 -5
- package/dist/dashboard-rpc/index.js.map +1 -1
- package/dist/dashboard-rpc/machines.d.ts +52 -0
- package/dist/dashboard-rpc/machines.d.ts.map +1 -0
- package/dist/dashboard-rpc/machines.js +82 -0
- package/dist/dashboard-rpc/machines.js.map +1 -0
- package/dist/dashboard-rpc/modules.d.ts +12 -4
- package/dist/dashboard-rpc/modules.d.ts.map +1 -1
- package/dist/dashboard-rpc/modules.js +24 -5
- package/dist/dashboard-rpc/modules.js.map +1 -1
- package/dist/dashboard-rpc/projects.d.ts +18 -0
- package/dist/dashboard-rpc/projects.d.ts.map +1 -1
- package/dist/dashboard-rpc/projects.js +27 -5
- package/dist/dashboard-rpc/projects.js.map +1 -1
- package/dist/dashboard-rpc/reads.d.ts +3 -4
- package/dist/dashboard-rpc/reads.d.ts.map +1 -1
- package/dist/dashboard-rpc/reads.js +5 -6
- package/dist/dashboard-rpc/reads.js.map +1 -1
- package/dist/dashboard-rpc/relay-agent.d.ts +3 -3
- package/dist/dashboard-rpc/relay-agent.js +3 -3
- package/dist/dashboard-rpc/relay-dispatch.d.ts +4 -4
- package/dist/dashboard-rpc/relay-dispatch.d.ts.map +1 -1
- package/dist/dashboard-rpc/relay-dispatch.js +7 -7
- package/dist/dashboard-rpc/relay-dispatch.js.map +1 -1
- package/dist/dashboard-rpc/test-context.js +1 -1
- package/dist/dashboard-rpc/test-context.js.map +1 -1
- package/dist/events.d.ts +4 -3
- package/dist/events.d.ts.map +1 -1
- package/dist/loopback-host.d.ts +3 -5
- package/dist/loopback-host.d.ts.map +1 -1
- package/dist/loopback-host.js +3 -5
- package/dist/loopback-host.js.map +1 -1
- package/dist/machine-link.d.ts +21 -0
- package/dist/machine-link.d.ts.map +1 -0
- package/dist/machine-link.js +20 -0
- package/dist/machine-link.js.map +1 -0
- package/dist/module-server.d.ts +1 -1
- package/dist/module-types/dashboard/components/QrCode.d.ts +8 -0
- package/dist/module-types/dashboard/lib/draft-handoff.d.ts +5 -9
- package/dist/module-types/dashboard/module/index.d.ts +56 -4
- package/dist/module-types/dashboard/rpc/modules.d.ts +1 -0
- package/dist/module-types/src/built-in.d.ts +18 -2
- package/dist/module-types/src/client.d.ts +2 -1
- package/dist/module-types/src/clone-project.d.ts +68 -0
- package/dist/module-types/src/dashboard/bridge-endpoints.d.ts +5 -5
- package/dist/module-types/src/dashboard/http.d.ts +1 -1
- package/dist/module-types/src/dashboard/machine-call.d.ts +9 -0
- package/dist/module-types/src/dashboard/module-serve.d.ts +6 -0
- package/dist/module-types/src/dashboard/remote-run.d.ts +77 -32
- package/dist/module-types/src/dashboard/rpc-serve.d.ts +28 -25
- package/dist/module-types/src/dashboard/types.d.ts +11 -16
- package/dist/module-types/src/dashboard-rpc/context.d.ts +4 -4
- package/dist/module-types/src/dashboard-rpc/control.d.ts +1 -1
- package/dist/module-types/src/dashboard-rpc/events.d.ts +1 -1
- package/dist/module-types/src/dashboard-rpc/index.d.ts +3 -3
- package/dist/module-types/src/dashboard-rpc/machines.d.ts +51 -0
- package/dist/module-types/src/dashboard-rpc/modules.d.ts +12 -4
- package/dist/module-types/src/dashboard-rpc/projects.d.ts +18 -0
- package/dist/module-types/src/dashboard-rpc/reads.d.ts +3 -4
- package/dist/module-types/src/dashboard-rpc/relay-agent.d.ts +3 -3
- package/dist/module-types/src/events.d.ts +4 -3
- package/dist/module-types/src/loopback-host.d.ts +3 -5
- package/dist/module-types/src/machine-link.d.ts +20 -0
- package/dist/module-types/src/pick-directory.d.ts +2 -0
- package/dist/module-types/src/project-modules.d.ts +12 -3
- package/dist/module-types/src/registry.d.ts +59 -16
- package/dist/module-types/src/repository-address.d.ts +22 -0
- package/dist/module-types/src/screens.d.ts +13 -0
- package/dist/module-types/src/store/agent-store.d.ts +2 -2
- package/dist/module-types/src/version.d.ts +1 -0
- package/dist/package-services.d.ts +27 -0
- package/dist/package-services.d.ts.map +1 -0
- package/dist/package-services.js +62 -0
- package/dist/package-services.js.map +1 -0
- package/dist/pick-directory.d.ts +2 -0
- package/dist/pick-directory.d.ts.map +1 -1
- package/dist/pick-directory.js +7 -1
- package/dist/pick-directory.js.map +1 -1
- package/dist/project-modules.d.ts +12 -3
- package/dist/project-modules.d.ts.map +1 -1
- package/dist/project-modules.js +20 -2
- package/dist/project-modules.js.map +1 -1
- package/dist/registry.d.ts +59 -16
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +91 -20
- package/dist/registry.js.map +1 -1
- package/dist/repository-address.d.ts +23 -0
- package/dist/repository-address.d.ts.map +1 -0
- package/dist/repository-address.js +38 -0
- package/dist/repository-address.js.map +1 -0
- package/dist/screens.d.ts +14 -0
- package/dist/screens.d.ts.map +1 -0
- package/dist/screens.js +40 -0
- package/dist/screens.js.map +1 -0
- package/dist/store/agent-store.d.ts +2 -2
- package/dist/store/agent-store.d.ts.map +1 -1
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +26 -0
- package/dist/version.js.map +1 -0
- package/package.json +15 -11
- package/dist/dashboard-bundle/assets/main-Q7JMdMJI.css +0 -2
- package/dist/dashboard-bundle/assets/main-fDZWGOub.js +0 -140
- package/dist/dashboard-rpc/devices.d.ts +0 -9
- package/dist/dashboard-rpc/devices.d.ts.map +0 -1
- package/dist/dashboard-rpc/devices.js +0 -12
- package/dist/dashboard-rpc/devices.js.map +0 -1
- package/dist/install.d.ts +0 -31
- package/dist/install.d.ts.map +0 -1
- package/dist/install.js +0 -54
- package/dist/install.js.map +0 -1
- package/dist/module-types/src/dashboard-rpc/devices.d.ts +0 -8
- package/dist/module-types/src/openagent-gitignore.d.ts +0 -11
- package/dist/openagent-gitignore.d.ts +0 -12
- package/dist/openagent-gitignore.d.ts.map +0 -1
- package/dist/openagent-gitignore.js +0 -19
- package/dist/openagent-gitignore.js.map +0 -1
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
2
|
+
import { lstat, mkdir, mkdtemp, rename, rm } from 'node:fs/promises';
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
|
+
import { basename, dirname, join } from 'node:path';
|
|
5
|
+
import { addressOfRemote, repositoryAddress } from './repository-address.js';
|
|
6
|
+
const HOST = /^[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$/i;
|
|
7
|
+
const SEGMENT = /^[a-z0-9_][a-z0-9._~-]*$/i;
|
|
8
|
+
const MAX_TYPED = 512;
|
|
9
|
+
/**
|
|
10
|
+
* Read what a person typed as a repository's address: `github.com/you/shop`, the same with
|
|
11
|
+
* `https://` before it, `ssh://git@github.com/you/shop.git`, or `git@github.com:you/shop.git`.
|
|
12
|
+
* Undefined for anything else: a folder on this disk, another kind of address, a name that could
|
|
13
|
+
* be read as an option or lead out of the folder projects are cloned into.
|
|
14
|
+
*/
|
|
15
|
+
export function cloneTarget(typed, home = homedir()) {
|
|
16
|
+
const said = typed.trim().replace(/\/+$/, '');
|
|
17
|
+
if (!said || said.length > MAX_TYPED || /[\s\x00-\x1f\x7f]/.test(said))
|
|
18
|
+
return undefined;
|
|
19
|
+
const scp = /^([a-z0-9_][a-z0-9._-]*)@([^:/@]+):([^:].*)$/i.exec(said);
|
|
20
|
+
const web = scp ? null : /^(?:(https|ssh):\/\/(?:([a-z0-9_][a-z0-9._-]*)@)?)?([^:/@]+)(?::(\d{1,5}))?\/(.+)$/i.exec(said);
|
|
21
|
+
const [host, rest] = scp ? [scp[2], scp[3]] : web ? [web[3], web[5]] : [];
|
|
22
|
+
if (host === undefined || rest === undefined || !HOST.test(host) || !host.includes('.'))
|
|
23
|
+
return undefined;
|
|
24
|
+
const segments = rest.split('/');
|
|
25
|
+
if (!segments.every(segment => SEGMENT.test(segment)))
|
|
26
|
+
return undefined;
|
|
27
|
+
const name = segments.at(-1).replace(/\.git$/i, '');
|
|
28
|
+
if (!name || !SEGMENT.test(name))
|
|
29
|
+
return undefined;
|
|
30
|
+
const scheme = web?.[1]?.toLowerCase();
|
|
31
|
+
// A user or a port is for SSH; a web address has neither, so no login rides in what was typed.
|
|
32
|
+
if (web && scheme !== 'ssh' && (web[2] !== undefined || web[4] !== undefined))
|
|
33
|
+
return undefined;
|
|
34
|
+
// Written anew from its parts, so git is given the two kinds of address it is allowed, as it spells them.
|
|
35
|
+
const url = scp ? said : scheme === 'ssh' ? `ssh://${web[2] !== undefined ? `${web[2]}@` : ''}${host}${web[4] !== undefined ? `:${web[4]}` : ''}/${rest}` : `https://${host}/${rest}`;
|
|
36
|
+
const address = addressOfRemote(url);
|
|
37
|
+
return address ? { url, address, path: join(home, 'projects', name) } : undefined;
|
|
38
|
+
}
|
|
39
|
+
const nodeCloneRunner = (args, env, timeoutMs) => new Promise(done => {
|
|
40
|
+
execFile('git', [...args], { env, timeout: timeoutMs, maxBuffer: 4 * 1024 * 1024 }, (error, _stdout, stderr) => {
|
|
41
|
+
if (!error)
|
|
42
|
+
return done({ ok: true });
|
|
43
|
+
// Stopped for taking too long, not for saying too much.
|
|
44
|
+
const timedOut = error.killed === true && error.code !== 'ERR_CHILD_PROCESS_STDIO_MAXBUFFER';
|
|
45
|
+
done({ ok: false, said: String(stderr), timedOut });
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
/** The way to SSH a person set for git on this computer, when they set one: which key, which program. */
|
|
49
|
+
const ownSshCommand = (env) => new Promise(done => execFile('git', ['config', '--get', 'core.sshCommand'], { env, cwd: homedir(), timeout: 10_000 }, (error, stdout) => done(error ? undefined : String(stdout).trim() || undefined)));
|
|
50
|
+
/** How long a clone may take: a large repository over a slow line, not a hang. */
|
|
51
|
+
const CLONE_TIMEOUT_MS = 15 * 60_000;
|
|
52
|
+
/** What git says when it has no login that can read a repository, over the web and over SSH. */
|
|
53
|
+
const NO_LOGIN = /could not read Username|Authentication failed|terminal prompts disabled|Permission denied \(publickey|Repository not found/i;
|
|
54
|
+
/** What SSH says of a host this computer has never met: it would ask a person, and nobody is there to answer. */
|
|
55
|
+
const NOT_MET = /Host key verification failed/i;
|
|
56
|
+
/** What git says after every failure, whatever the reason. */
|
|
57
|
+
const SAID_EVERY_TIME = /^(Cloning into |Please make sure you have the correct access rights|and the repository exists)/;
|
|
58
|
+
const NOT_AN_ADDRESS = "is not a repository's address. One looks like github.com/you/project.";
|
|
59
|
+
/** Where what a person typed would be cloned to, before anything is cloned: what the page shows to be confirmed. */
|
|
60
|
+
export function cloneTargetOf(typed, home) {
|
|
61
|
+
const target = cloneTarget(typed, home);
|
|
62
|
+
return target ? { ok: true, address: target.address, path: target.path } : { ok: false, error: `"${typed.trim().slice(0, 80)}" ${NOT_AN_ADDRESS}` };
|
|
63
|
+
}
|
|
64
|
+
/** The clones on their way, by the folder each ends in: a second ask for the same folder waits for the first. */
|
|
65
|
+
const cloning = new Map();
|
|
66
|
+
/**
|
|
67
|
+
* Clone the repository a person typed the address of into `~/projects/<its name>`. A folder that
|
|
68
|
+
* is already there and holds this very repository is taken as it is; one that holds anything
|
|
69
|
+
* else is never written over, and is refused. The clone is made beside that folder and moved
|
|
70
|
+
* there once it is whole: a clone that fails leaves nothing behind, and one on its way is no
|
|
71
|
+
* folder a second ask could take for the project.
|
|
72
|
+
*/
|
|
73
|
+
export function cloneProject(typed, opts = {}) {
|
|
74
|
+
const target = cloneTarget(typed, opts.home);
|
|
75
|
+
if (!target)
|
|
76
|
+
return Promise.resolve({ ok: false, error: `"${typed.trim().slice(0, 80)}" ${NOT_AN_ADDRESS}` });
|
|
77
|
+
const onItsWay = cloning.get(target.path);
|
|
78
|
+
// The same repository asked for twice: one clone, one answer. Another one of the same name is told once the first has landed.
|
|
79
|
+
if (onItsWay)
|
|
80
|
+
return onItsWay.then(() => cloneProject(typed, opts));
|
|
81
|
+
const made = cloneTo(target, opts).finally(() => cloning.delete(target.path));
|
|
82
|
+
cloning.set(target.path, made);
|
|
83
|
+
return made;
|
|
84
|
+
}
|
|
85
|
+
async function cloneTo({ url, address, path }, opts) {
|
|
86
|
+
const there = async () => {
|
|
87
|
+
if (!(await lstat(path).then(() => true, () => false)))
|
|
88
|
+
return undefined;
|
|
89
|
+
if ((await repositoryAddress(path)) === address)
|
|
90
|
+
return { ok: true, path, cloned: false };
|
|
91
|
+
return { ok: false, error: `${path} is already there, and it is not ${address}. Move that folder away first, or add it as it is.` };
|
|
92
|
+
};
|
|
93
|
+
const already = await there();
|
|
94
|
+
if (already)
|
|
95
|
+
return already;
|
|
96
|
+
const projects = dirname(path);
|
|
97
|
+
await mkdir(projects, { recursive: true });
|
|
98
|
+
// A name no repository has: one starts with a letter, a digit or an underscore.
|
|
99
|
+
const making = await mkdtemp(join(projects, `.${basename(path)}.cloning-`));
|
|
100
|
+
const env = opts.env ?? process.env;
|
|
101
|
+
const ssh = env.GIT_SSH_COMMAND ?? (await (opts.sshCommand ?? ownSshCommand)(env)) ?? 'ssh';
|
|
102
|
+
const said = await (opts.run ?? nodeCloneRunner)(
|
|
103
|
+
// Only the two ways in a repository's address names: a clone never runs a program an address could name.
|
|
104
|
+
['-c', 'protocol.allow=never', '-c', 'protocol.https.allow=always', '-c', 'protocol.ssh.allow=always', 'clone', '--', url, making],
|
|
105
|
+
// Never a question to a person, in a terminal or in a window: nobody is there to answer one. The person's own way to SSH is kept, and told the same.
|
|
106
|
+
{ ...env, GIT_TERMINAL_PROMPT: '0', GIT_ASKPASS: '', GIT_SSH_COMMAND: `${ssh} -oBatchMode=yes` }, opts.timeoutMs ?? CLONE_TIMEOUT_MS);
|
|
107
|
+
if (said.ok) {
|
|
108
|
+
// Moved only where nothing is: a folder that came to be there meanwhile is not written over.
|
|
109
|
+
const landed = (await there()) ?? (await rename(making, path).then(() => undefined, (err) => (err instanceof Error ? err.message : String(err))));
|
|
110
|
+
if (landed === undefined)
|
|
111
|
+
return { ok: true, path, cloned: true };
|
|
112
|
+
await rm(making, { recursive: true, force: true });
|
|
113
|
+
return typeof landed === 'string' ? { ok: false, error: `The clone could not be moved to ${path}: ${landed}` } : landed;
|
|
114
|
+
}
|
|
115
|
+
await rm(making, { recursive: true, force: true });
|
|
116
|
+
if (said.timedOut)
|
|
117
|
+
return { ok: false, error: `Cloning ${address} took too long, and was stopped.` };
|
|
118
|
+
const lines = said.said.split('\n').map(line => line.trim().replace(/^(fatal|error): /i, '')).filter(line => line && !SAID_EVERY_TIME.test(line));
|
|
119
|
+
const words = lines.slice(-2).join(' ') || 'git could not clone it.';
|
|
120
|
+
if (NOT_MET.test(said.said))
|
|
121
|
+
return { ok: false, error: `This computer has never met ${address.split('/')[0]} over SSH, so it does not know it is the real one. Use the address that starts with https://, or connect to it once in a terminal. git said: ${words}` };
|
|
122
|
+
return { ok: false, error: NO_LOGIN.test(said.said) ? `This computer has no login that can read ${address}, or there is no such repository: a private one needs a login. git said: ${words}` : words };
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=clone-project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clone-project.js","sourceRoot":"","sources":["../src/clone-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAA;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAuB5E,MAAM,IAAI,GAAG,qCAAqC,CAAA;AAClD,MAAM,OAAO,GAAG,2BAA2B,CAAA;AAC3C,MAAM,SAAS,GAAG,GAAG,CAAA;AAErB;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa,EAAE,IAAI,GAAW,OAAO,EAAE;IACjE,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;IAC7C,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,SAAS,IAAI,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,SAAS,CAAA;IACxF,MAAM,GAAG,GAAG,+CAA+C,CAAC,IAA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,IAAI,EAAE,CAAC,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IACjJ,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,yBAAyB,CAAA;IACpE,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,+BAA+B,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,gJAAgJ,KAAK,EAAE,EAAE,CAAA;IACrQ,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,4CAA4C,OAAO,4EAA4E,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,CAAA;AACxM,CAAC"}
|
package/dist/daemon-runtime.d.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import type { OpenAgentEvent } from './events.js';
|
|
2
2
|
import type { StartAgentOptions, StartAgentResult, AddProjectResult, RemoveProjectResult } from './dashboard/index.js';
|
|
3
3
|
import type { EventsSource, RemoteAgents } from './dashboard/rpc-serve.js';
|
|
4
|
-
/**
|
|
5
|
-
* What the daemon does for a project (#393): start a run, add a project, and relay a run to and
|
|
6
|
-
* from a connected device. Split from daemon.ts so that file reads as the daemon's lifecycle
|
|
7
|
-
* (state file, ports, boot, shutdown). The daemon runs no agent itself (#1774): a Start is the
|
|
8
|
-
* project's own `start` hook line, and the run it begins belongs to whatever tool that line names.
|
|
9
|
-
*/
|
|
10
4
|
/** Inputs to {@link createProjectRuntime}. */
|
|
11
5
|
export interface ProjectRuntimeOptions {
|
|
12
6
|
/** The daemon's home workspace; a run with no project id targets it. */
|
|
@@ -19,18 +13,24 @@ export interface ProjectRuntime {
|
|
|
19
13
|
onStart: (prompt: string, options?: StartAgentOptions, targetProjectId?: string) => Promise<StartAgentResult>;
|
|
20
14
|
onAddProject: (path: string, share: boolean) => Promise<AddProjectResult>;
|
|
21
15
|
onRemoveProject: (projectId: string, files?: boolean) => Promise<RemoveProjectResult>;
|
|
22
|
-
/** The live event stream for an agent this daemon is relaying from a
|
|
16
|
+
/** The live event stream for an agent this daemon is relaying from a machine (#1067), else undefined
|
|
23
17
|
* so `onEvents` falls back to tailing the on-disk log. Wired as the dashboard's events source. */
|
|
24
18
|
remoteEventsSource: EventsSource;
|
|
19
|
+
/** This machine's own id for its project cloned from `address`, the name a relayed call gives a
|
|
20
|
+
* project; undefined when no project here is cloned from it. */
|
|
21
|
+
projectAt: (address: string) => Promise<string | undefined>;
|
|
25
22
|
/** Tail a relay-started agent's on-disk events (#1067): the daemon's `/_relay/events` endpoint uses
|
|
26
23
|
* it to stream one agent back to whichever daemon relayed it here. */
|
|
27
|
-
tailRelayEvents: (agentId: string, onEvent: (event: OpenAgentEvent) => void) => () => void;
|
|
28
|
-
/** The relayed-agent lookup the dashboard's read RPCs consult (#1067 slice 2): which
|
|
24
|
+
tailRelayEvents: (projectId: string, agentId: string, onEvent: (event: OpenAgentEvent) => void) => () => void;
|
|
25
|
+
/** The relayed-agent lookup the dashboard's read RPCs consult (#1067 slice 2): which machine a remote
|
|
29
26
|
* run runs on, so a run-scoped RPC forwards there instead of resolving a local checkout. */
|
|
30
27
|
remoteAgents: RemoteAgents;
|
|
31
|
-
/** The
|
|
32
|
-
* this daemon's own
|
|
33
|
-
onRelayRpc: (fn: string, args: unknown[]) => Promise<unknown>;
|
|
28
|
+
/** The machine side of the relay (#1067 slice 2): run one whitelisted read/steer/handoff RPC against
|
|
29
|
+
* this daemon's own copy of the project, for a daemon that relayed an agent here. */
|
|
30
|
+
onRelayRpc: (projectId: string, fn: string, args: unknown[]) => Promise<unknown>;
|
|
31
|
+
/** Where the live screen of a run on this computer answers, as its diary names it; nothing when
|
|
32
|
+
* the run has none: it opened no screen, closed it, or ended. */
|
|
33
|
+
screenOf: (projectId: string, agentId: string) => Promise<string | undefined>;
|
|
34
34
|
/** Let go of the relayed streams. */
|
|
35
35
|
dispose: () => Promise<void>;
|
|
36
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daemon-runtime.d.ts","sourceRoot":"","sources":["../src/daemon-runtime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"daemon-runtime.d.ts","sourceRoot":"","sources":["../src/daemon-runtime.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AACtH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AA2B1E,8CAA8C;AAC9C,MAAM,WAAW,qBAAqB;IACpC,wEAAwE;IACxE,GAAG,EAAE,MAAM,CAAA;IACX,2CAA2C;IAC3C,GAAG,EAAE,MAAM,CAAC,UAAU,CAAA;CACvB;AAED,uEAAuE;AACvE,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,EAAE,eAAe,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAC7G,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAA;IACzE,eAAe,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAA;IACrF;uGACmG;IACnG,kBAAkB,EAAE,YAAY,CAAA;IAChC;qEACiE;IACjE,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IAC3D;2EACuE;IACvE,eAAe,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,KAAK,MAAM,IAAI,CAAA;IAC7G;iGAC6F;IAC7F,YAAY,EAAE,YAAY,CAAA;IAC1B;0FACsF;IACtF,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IAChF;sEACkE;IAClE,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IAC7E,qCAAqC;IACrC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC7B;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,qBAAqB,GAAG,cAAc,CA8MxF"}
|
package/dist/daemon-runtime.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { resolve } from 'node:path';
|
|
1
|
+
import { basename, join, resolve } from 'node:path';
|
|
2
2
|
import { hostname } from 'node:os';
|
|
3
3
|
import { stat } from 'node:fs/promises';
|
|
4
|
-
import { fromDiaryLine, isPidAlive, projectBranches, readLiveMetas, resolveAgentDiary } from './store/index.js';
|
|
4
|
+
import { findCheckout, fromDiaryLine, isPidAlive, isRunId, projectBranches, readLiveMetas, resolveAgentDiary } from './store/index.js';
|
|
5
|
+
import { OPENAGENT_DIR } from './openagent-dir.js';
|
|
5
6
|
import { RelayedAgents, startRemoteAgent } from './dashboard/remote-run.js';
|
|
7
|
+
import { screenInDiary } from './dashboard/screen.js';
|
|
6
8
|
import { dispatchRelayRpc } from './dashboard-rpc/relay-dispatch.js';
|
|
7
9
|
import { tailAgentEvents } from './dashboard-rpc/events-tail.js';
|
|
8
|
-
import { addProject, listProjects, projectId, removeProject } from './registry.js';
|
|
10
|
+
import { addProject, listMachines, listProjects, projectId, removeProject } from './registry.js';
|
|
11
|
+
import { repositoryAddress } from './repository-address.js';
|
|
9
12
|
import { writeHookLines } from './built-in.js';
|
|
10
13
|
import { fileBranchRepo, installProject, writeSharing } from '@openagt/agent-data';
|
|
11
14
|
import { removeProjectFiles } from './remove-files.js';
|
|
@@ -15,23 +18,33 @@ import { isBranchName } from './branch-name.js';
|
|
|
15
18
|
import { hasRemote } from './has-remote.js';
|
|
16
19
|
import { projectGitHost } from './store/git-host.js';
|
|
17
20
|
import { providedDataChanged } from './store/provided.js';
|
|
21
|
+
/**
|
|
22
|
+
* What the daemon does for a project (#393): start a run, add a project, and relay a run to and
|
|
23
|
+
* from a saved machine. Split from daemon.ts so that file reads as the daemon's lifecycle
|
|
24
|
+
* (state file, ports, boot, shutdown). The daemon runs no agent itself (#1774): a Start is the
|
|
25
|
+
* project's own `start` hook line, and the run it begins belongs to whatever tool that line names.
|
|
26
|
+
*/
|
|
27
|
+
/** How long a project folder's repository address is trusted before git is asked again. */
|
|
28
|
+
const ADDRESS_KEPT_MS = 10_000;
|
|
18
29
|
/**
|
|
19
30
|
* The daemon's per-project runtime (#393). The home `cwd` is the default target: a request with
|
|
20
31
|
* no project id (or the home id) resolves to it without a registry lookup.
|
|
21
32
|
*/
|
|
22
33
|
export function createProjectRuntime({ cwd, env }) {
|
|
23
34
|
const homeId = projectId(resolve(cwd));
|
|
24
|
-
// Runs this daemon is relaying to/from a
|
|
35
|
+
// Runs this daemon is relaying to/from a saved machine (#1067): the local half of a remote agent.
|
|
25
36
|
const relayedAgents = new RelayedAgents();
|
|
26
37
|
// The relayed-agent lookup the dashboard's read RPCs consult (#1067 slice 2): is this agentId remote, and
|
|
27
|
-
// which
|
|
38
|
+
// which machine owns it. Outlives the event stream so a finished remote agent's push/PR still reaches it.
|
|
28
39
|
const remoteAgents = {
|
|
29
40
|
target: agentId => relayedAgents.target(agentId),
|
|
30
41
|
list: projectId => relayedAgents.list(projectId),
|
|
42
|
+
working: url => relayedAgents.working(url),
|
|
43
|
+
rekey: (url, key, pin) => relayedAgents.rekey(url, key, pin),
|
|
31
44
|
};
|
|
32
|
-
// The
|
|
33
|
-
// daemon's own
|
|
34
|
-
const onRelayRpc = (fn, args) => dispatchRelayRpc(
|
|
45
|
+
// The machine side of the relay (#1067 slice 2): run one whitelisted read/steer/handoff RPC against this
|
|
46
|
+
// daemon's own copy of the project the call named, for a daemon that relayed an agent here.
|
|
47
|
+
const onRelayRpc = (project, fn, args) => dispatchRelayRpc(project, fn, args);
|
|
35
48
|
// A project id resolves to its repo path via the registry; the home id (or none)
|
|
36
49
|
// resolves to the daemon's own `cwd` without a lookup.
|
|
37
50
|
const resolveProject = async (id) => {
|
|
@@ -40,37 +53,75 @@ export function createProjectRuntime({ cwd, env }) {
|
|
|
40
53
|
const records = await listProjects(undefined, env).catch(() => []);
|
|
41
54
|
return records.find(record => record.id === id)?.path;
|
|
42
55
|
};
|
|
56
|
+
// The project here that a relayed call names by its repository's address: the first on the list
|
|
57
|
+
// cloned from it, every time, so a run's later calls reach the project it started in. A folder's
|
|
58
|
+
// address is kept for a few seconds, so a run's reads, which poll, do not ask git about every
|
|
59
|
+
// project each time. Only an address is kept: a folder that had none is asked again.
|
|
60
|
+
const addresses = new Map();
|
|
61
|
+
const addressOf = async (path) => {
|
|
62
|
+
const kept = addresses.get(path);
|
|
63
|
+
if (kept && kept.until > Date.now())
|
|
64
|
+
return kept.address;
|
|
65
|
+
const address = await repositoryAddress(path);
|
|
66
|
+
if (address === undefined)
|
|
67
|
+
addresses.delete(path);
|
|
68
|
+
else
|
|
69
|
+
addresses.set(path, { address, until: Date.now() + ADDRESS_KEPT_MS });
|
|
70
|
+
return address;
|
|
71
|
+
};
|
|
72
|
+
const projectAt = async (address) => {
|
|
73
|
+
for (const record of await listProjects(undefined, env).catch(() => [])) {
|
|
74
|
+
if ((await addressOf(record.path)) === address)
|
|
75
|
+
return record.id;
|
|
76
|
+
}
|
|
77
|
+
return undefined;
|
|
78
|
+
};
|
|
43
79
|
// Start (#1774): the project's own `start` hook line, which answers the id of the run it began.
|
|
44
80
|
// The daemon names no tool and holds nothing about the run: no slot, no cap (a person's click is
|
|
45
81
|
// the brake), no process to stop at shutdown. A project without the line cannot start a run here.
|
|
46
82
|
const onStart = async (prompt, options = {}, targetProjectId) => {
|
|
47
|
-
// Run on a connected device (#1067): forward the start to the remote daemon, which runs its own
|
|
48
|
-
// project's hook, and relay the run's events back. `remote` is stripped so the device does not
|
|
49
|
-
// relay onward, and `base` because a branch of this machine names nothing on the device (the device drops it too). The
|
|
50
|
-
// device starts it in its own home project.
|
|
51
|
-
if (options.remote) {
|
|
52
|
-
const { remote, base: _thisMachines, ...forwarded } = options;
|
|
53
|
-
const result = await startRemoteAgent(remote, { prompt, options: forwarded });
|
|
54
|
-
if (result.ok) {
|
|
55
|
-
// A relayed agent has no local checkout or pid, so its list row is a memory-only stub (#1077):
|
|
56
|
-
// registered here so onAgents can show it and a dashboard reload re-opens it. Never written to disk.
|
|
57
|
-
const now = new Date().toISOString();
|
|
58
|
-
const meta = {
|
|
59
|
-
status: 'running',
|
|
60
|
-
id: result.agentId,
|
|
61
|
-
startedAt: now,
|
|
62
|
-
updatedAt: now,
|
|
63
|
-
target: 'remote',
|
|
64
|
-
intent: prompt,
|
|
65
|
-
...(remote.label ? { remoteLabel: remote.label } : {}),
|
|
66
|
-
};
|
|
67
|
-
relayedAgents.register(result.agentId, remote, meta, targetProjectId ?? homeId);
|
|
68
|
-
}
|
|
69
|
-
return result;
|
|
70
|
-
}
|
|
71
83
|
const projectCwd = await resolveProject(targetProjectId);
|
|
72
84
|
if (!projectCwd)
|
|
73
85
|
return { ok: false, error: `unknown project: ${targetProjectId}` };
|
|
86
|
+
// Run on a saved machine (#1067): forward the start to its daemon, which runs the hook of its
|
|
87
|
+
// own copy of this project, and relay the run's events back. The project is named by its
|
|
88
|
+
// repository's address, the one name both machines have for it. `machine` is stripped so the
|
|
89
|
+
// other side does not relay onward, and `base` because a branch of this machine names nothing
|
|
90
|
+
// there (it drops both too).
|
|
91
|
+
if (options.machine !== undefined) {
|
|
92
|
+
const { machine: id, base: _thisMachines, ...forwarded } = options;
|
|
93
|
+
const machine = (await listMachines(undefined, env)).find(saved => saved.id === id);
|
|
94
|
+
if (!machine)
|
|
95
|
+
return { ok: false, error: 'That machine is no longer saved. Pick another place to run.' };
|
|
96
|
+
const project = await repositoryAddress(projectCwd);
|
|
97
|
+
if (!project)
|
|
98
|
+
return { ok: false, error: 'This project has no repository address, so it cannot be sent to another machine.' };
|
|
99
|
+
const target = { url: machine.url, key: machine.key, ...(machine.pin ? { pin: machine.pin } : {}), project };
|
|
100
|
+
const result = await startRemoteAgent(target, { prompt, options: forwarded });
|
|
101
|
+
if (!result.ok) {
|
|
102
|
+
return 'noProject' in result ? { ok: false, error: `${basename(projectCwd)} is not on ${machine.label}. Add it there first.` } : result;
|
|
103
|
+
}
|
|
104
|
+
// The run's id is the machine's word, and from here on every call about that id goes to the
|
|
105
|
+
// machine: what the person reads of the run, and what they click and type in its browser.
|
|
106
|
+
// An id that is no run's, or that is a run of this computer's own, is not taken.
|
|
107
|
+
if (!isRunId(result.agentId) || (await findCheckout(projectCwd, result.agentId, projectBranches))) {
|
|
108
|
+
return { ok: false, error: `${machine.label} answered with a run this computer cannot follow.` };
|
|
109
|
+
}
|
|
110
|
+
// A relayed agent has no local checkout or pid, so its list row is a memory-only stub (#1077):
|
|
111
|
+
// registered here so onAgents can show it and a dashboard reload re-opens it. Never written to disk.
|
|
112
|
+
const now = new Date().toISOString();
|
|
113
|
+
const meta = {
|
|
114
|
+
status: 'running',
|
|
115
|
+
id: result.agentId,
|
|
116
|
+
startedAt: now,
|
|
117
|
+
updatedAt: now,
|
|
118
|
+
target: 'remote',
|
|
119
|
+
intent: prompt,
|
|
120
|
+
remoteLabel: machine.label,
|
|
121
|
+
};
|
|
122
|
+
relayedAgents.register(result.agentId, target, meta, targetProjectId ?? homeId);
|
|
123
|
+
return result;
|
|
124
|
+
}
|
|
74
125
|
// The branch to start from ends up on the line's command line: only a branch name goes there.
|
|
75
126
|
// Refused, not dropped: a run started from the main branch instead would be a silent swap.
|
|
76
127
|
if (options.base !== undefined && !isBranchName(options.base))
|
|
@@ -163,20 +214,30 @@ export function createProjectRuntime({ cwd, env }) {
|
|
|
163
214
|
providedDataChanged(record.path);
|
|
164
215
|
return { ok: true, cleanup };
|
|
165
216
|
};
|
|
166
|
-
// The dashboard's events source (#1067): a stream for an agent this daemon is relaying from a
|
|
217
|
+
// The dashboard's events source (#1067): a stream for an agent this daemon is relaying from a machine,
|
|
167
218
|
// else undefined so `onEvents` tails the on-disk log as usual for an ordinary local agent.
|
|
168
219
|
const remoteEventsSource = (_projectId, agentId) => relayedAgents.get(agentId);
|
|
169
220
|
// Tail a relay-started run's own log (#1067) for the `/_relay/events` endpoint: the diary the
|
|
170
221
|
// run's tool keeps, its lines turned into events. The relocating tail, for the same reason as
|
|
171
222
|
// the dashboard's onEvents: the diary becomes the finished run's when the run ends.
|
|
172
|
-
const tailRelayEvents = (agentId, onEvent) => tailAgentEvents(
|
|
223
|
+
const tailRelayEvents = (project, agentId, onEvent) => tailAgentEvents(async () => {
|
|
224
|
+
const projectCwd = await resolveProject(project);
|
|
225
|
+
return projectCwd ? resolveAgentDiary(projectCwd, agentId) : undefined;
|
|
226
|
+
}, line => {
|
|
173
227
|
const event = fromDiaryLine(line);
|
|
174
228
|
if (event)
|
|
175
229
|
onEvent(event);
|
|
176
230
|
});
|
|
231
|
+
// A screen lives while its run has a checkout: a finished run's diary names none that answers,
|
|
232
|
+
// so it is not read. Asked of the shared list only: a tab open on a run asks every few seconds.
|
|
233
|
+
const screenOf = async (project, agentId) => {
|
|
234
|
+
const projectCwd = await resolveProject(project);
|
|
235
|
+
const checkout = projectCwd ? await findCheckout(projectCwd, agentId, projectBranches, { cached: true }) : undefined;
|
|
236
|
+
return checkout ? screenInDiary(join(checkout.path, OPENAGENT_DIR, `${agentId}.jsonl`)) : undefined;
|
|
237
|
+
};
|
|
177
238
|
const dispose = async () => {
|
|
178
239
|
relayedAgents.dispose();
|
|
179
240
|
};
|
|
180
|
-
return { onStart, onAddProject, onRemoveProject, remoteEventsSource, tailRelayEvents, remoteAgents, onRelayRpc, dispose };
|
|
241
|
+
return { onStart, onAddProject, onRemoveProject, remoteEventsSource, projectAt, tailRelayEvents, remoteAgents, onRelayRpc, screenOf, dispose };
|
|
181
242
|
}
|
|
182
243
|
//# sourceMappingURL=daemon-runtime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daemon-runtime.js","sourceRoot":"","sources":["../src/daemon-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,eAAe,EAAE,aAAa,EAAE,iBAAiB,EAAqC,MAAM,kBAAkB,CAAA;AAIlJ,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,qBA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,CAAC,OAAO,CAAC,CAAA;QAChD,OAAO,UAAU,CAAC,CAAC,CAAC,iBAAiB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IACxE,CAAC,EACD,IAAI,CAAC,EAAE;QACL,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,CAAA;QACjC,IAAI,KAAK;YAAE,OAAO,CAAC,KAAK,CAAC,CAAA;IAC3B,CAAC,CACF,CAAA;IAEH,+FAA+F;IAC/F,gGAAgG;IAChG,MAAM,QAAQ,GAAG,KAAK,EAAE,OAAe,EAAE,OAAe,EAA+B,EAAE;QACvF,MAAM,UAAU,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,CAAA;QAChD,MAAM,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAC,MAAM,YAAY,CAAC,UAAU,EAAE,OAAO,EAAE,eAAe,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;QACpH,OAAO,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,aAAa,EAAE,GAAG,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IACrG,CAAC,CAAA;IAED,MAAM,OAAO,GAAG,KAAK,IAAmB,EAAE;QACxC,aAAa,CAAC,OAAO,EAAE,CAAA;IACzB,CAAC,CAAA;IAED,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,kBAAkB,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAA;AAChJ,CAAC"}
|
package/dist/daemon.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isLoopbackHost } from './loopback-host.js';
|
|
2
1
|
import { type BridgeBrowser, type BridgeBrowserOptions } from './bridge-browser.js';
|
|
2
|
+
import { type PackageServices, type PackageServicesOptions } from './package-services.js';
|
|
3
3
|
/**
|
|
4
4
|
* The dashboard process (#302). It is a pure projection of files: a run's tool keeps the run's
|
|
5
5
|
* card and diary in the run's checkout, and the dashboard *tails* them, pushing each new line to
|
|
@@ -15,14 +15,6 @@ import { type BridgeBrowser, type BridgeBrowserOptions } from './bridge-browser.
|
|
|
15
15
|
*/
|
|
16
16
|
/** The default dashboard port the daemon binds. */
|
|
17
17
|
export declare const DEFAULT_DAEMON_PORT = 4200;
|
|
18
|
-
/** The default bind host (#1051): localhost only, so the daemon is unreachable off the machine. */
|
|
19
|
-
export declare const DEFAULT_DAEMON_HOST = "127.0.0.1";
|
|
20
|
-
/**
|
|
21
|
-
* True when `host` is a loopback address the browser reaches without leaving the machine (#1051).
|
|
22
|
-
* Defined in its own leaf module so the dashboard's RPC mount can share the one definition without
|
|
23
|
-
* importing this one back (a cycle); re-exported here for the callers that already had it.
|
|
24
|
-
*/
|
|
25
|
-
export { isLoopbackHost };
|
|
26
18
|
/** Where the dashboard came up, reported to {@link RunDaemonOptions.onListening}. */
|
|
27
19
|
export interface DaemonState {
|
|
28
20
|
/** The daemon process id. */
|
|
@@ -33,8 +25,6 @@ export interface DaemonState {
|
|
|
33
25
|
url: string;
|
|
34
26
|
/** ISO timestamp the daemon started. */
|
|
35
27
|
startedAt: string;
|
|
36
|
-
/** The host the dashboard is bound to (#1051). */
|
|
37
|
-
host?: string;
|
|
38
28
|
}
|
|
39
29
|
/** True when a process with this id is still running (best-effort, signal 0). The store's
|
|
40
30
|
* {@link isPidAlive} under the daemon's historical public name -- the two were byte-identical. */
|
|
@@ -43,9 +33,6 @@ export { isPidAlive as isProcessAlive } from './store/index.js';
|
|
|
43
33
|
export interface RunDaemonOptions {
|
|
44
34
|
/** Port to bind. Default {@link DEFAULT_DAEMON_PORT}; pass `0` for an ephemeral port. */
|
|
45
35
|
port?: number;
|
|
46
|
-
/** Host to bind (#1051). Default {@link DEFAULT_DAEMON_HOST}; a non-loopback address generates and
|
|
47
|
-
* requires the shared token, and every route is then gated behind it. */
|
|
48
|
-
host?: string;
|
|
49
36
|
/** Shut the daemon down when this aborts (in addition to SIGINT/SIGTERM). For tests. */
|
|
50
37
|
signal?: AbortSignal;
|
|
51
38
|
/** Env the registry is read from. Default `process.env`; injectable for tests. */
|
|
@@ -54,6 +41,8 @@ export interface RunDaemonOptions {
|
|
|
54
41
|
onListening?: (state: DaemonState) => void;
|
|
55
42
|
/** How the bridge browser is launched (#1332); default the real Chrome for Testing. For tests. */
|
|
56
43
|
bridgeBrowser?: (opts: BridgeBrowserOptions) => Promise<BridgeBrowser>;
|
|
44
|
+
/** How the services of OpenAgent's own packages are started; default each as its own process. For tests. */
|
|
45
|
+
packageServices?: (opts: PackageServicesOptions) => PackageServices;
|
|
57
46
|
}
|
|
58
47
|
/**
|
|
59
48
|
* The daemon body, run in the foreground by bare `openagent`. Serves the built dashboard bundle
|
package/dist/daemon.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daemon.d.ts","sourceRoot":"","sources":["../src/daemon.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"daemon.d.ts","sourceRoot":"","sources":["../src/daemon.ts"],"names":[],"mappings":"AAaA,OAAO,EAA4D,KAAK,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAG7I,OAAO,EAAwB,KAAK,eAAe,EAAE,KAAK,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAI/G;;;;;;;;;;;;GAYG;AAEH,mDAAmD;AACnD,eAAO,MAAM,mBAAmB,OAAO,CAAA;AAEvC,qFAAqF;AACrF,MAAM,WAAW,WAAW;IAC1B,6BAA6B;IAC7B,GAAG,EAAE,MAAM,CAAA;IACX,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAA;IACZ,uBAAuB;IACvB,GAAG,EAAE,MAAM,CAAA;IACX,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAA;CAClB;AAOD;kGACkG;AAClG,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAE/D,qCAAqC;AACrC,MAAM,WAAW,gBAAgB;IAC/B,yFAAyF;IACzF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,wFAAwF;IACxF,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,kFAAkF;IAClF,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;IACvB,iGAAiG;IACjG,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAA;IAC1C,kGAAkG;IAClG,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,oBAAoB,KAAK,OAAO,CAAC,aAAa,CAAC,CAAA;IACtE,4GAA4G;IAC5G,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,sBAAsB,KAAK,eAAe,CAAA;CACpE;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,gBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2HvF"}
|
package/dist/daemon.js
CHANGED
|
@@ -8,12 +8,13 @@ import { defaultModelsSource } from './dashboard/models.js';
|
|
|
8
8
|
import { startBackgroundServices } from './daemon-services.js';
|
|
9
9
|
import { projectErrorStore } from './project-errors.js';
|
|
10
10
|
import { resolveDashboardBundle } from './dashboard/bundle.js';
|
|
11
|
-
import {
|
|
12
|
-
import { isLoopbackHost } from './loopback-host.js';
|
|
11
|
+
import { ensureBridgeToken, listProjects, nodeRegistryFs, readPreferences, registryPreferencesStore } from './registry.js';
|
|
13
12
|
import { bridgeSessionsFrom } from './dashboard/bridge-sessions.js';
|
|
14
13
|
import { bridgeQuestions } from './dashboard/bridge-store.js';
|
|
15
14
|
import { bridgeBrowserDir, bridgeBrowserOwner, startBridgeBrowser } from './bridge-browser.js';
|
|
16
15
|
import { runProjectHooks } from './project-hooks.js';
|
|
16
|
+
import { builtInServices } from './built-in.js';
|
|
17
|
+
import { startPackageServices } from './package-services.js';
|
|
17
18
|
import { readAllAgents } from './store/index.js';
|
|
18
19
|
/**
|
|
19
20
|
* The dashboard process (#302). It is a pure projection of files: a run's tool keeps the run's
|
|
@@ -30,14 +31,6 @@ import { readAllAgents } from './store/index.js';
|
|
|
30
31
|
*/
|
|
31
32
|
/** The default dashboard port the daemon binds. */
|
|
32
33
|
export const DEFAULT_DAEMON_PORT = 4200;
|
|
33
|
-
/** The default bind host (#1051): localhost only, so the daemon is unreachable off the machine. */
|
|
34
|
-
export const DEFAULT_DAEMON_HOST = '127.0.0.1';
|
|
35
|
-
/**
|
|
36
|
-
* True when `host` is a loopback address the browser reaches without leaving the machine (#1051).
|
|
37
|
-
* Defined in its own leaf module so the dashboard's RPC mount can share the one definition without
|
|
38
|
-
* importing this one back (a cycle); re-exported here for the callers that already had it.
|
|
39
|
-
*/
|
|
40
|
-
export { isLoopbackHost };
|
|
41
34
|
/** The `.openagent/` directory for a workspace. */
|
|
42
35
|
function daemonDir(cwd) {
|
|
43
36
|
return join(cwd, OPENAGENT_DIR);
|
|
@@ -53,23 +46,16 @@ export { isPidAlive as isProcessAlive } from './store/index.js';
|
|
|
53
46
|
*/
|
|
54
47
|
export async function runDaemon(cwd, opts = {}) {
|
|
55
48
|
const port = opts.port ?? DEFAULT_DAEMON_PORT;
|
|
56
|
-
const host = opts.host ?? DEFAULT_DAEMON_HOST;
|
|
57
49
|
const env = opts.env ?? process.env;
|
|
58
|
-
// #1051: a non-loopback bind reaches the network, where a daemon that spawns processes is RCE for
|
|
59
|
-
// anyone who finds the port, so generate + persist the shared token the request guard requires. A
|
|
60
|
-
// loopback bind needs none, so the local zero-config path stays byte-identical.
|
|
61
|
-
const token = isLoopbackHost(host) ? undefined : await ensureDaemonToken(undefined, env);
|
|
62
50
|
// The browser bridge (#1237). Opt-in, because it opens the daemon's one route reachable from
|
|
63
|
-
// another origin
|
|
64
|
-
// guard the same daemon, so a second secret would be another thing to rotate and leak without
|
|
65
|
-
// narrowing anything. On a loopback bind that secret may not exist yet, hence ensure, not read.
|
|
51
|
+
// another origin, behind a key of its own. The key may not exist yet, hence ensure, not read.
|
|
66
52
|
const bridgeOn = (await readPreferences(undefined, env).catch(() => ({}))).bridge === true;
|
|
67
|
-
const bridgeToken = bridgeOn ? await
|
|
53
|
+
const bridgeToken = bridgeOn ? await ensureBridgeToken(undefined, env) : undefined;
|
|
68
54
|
// The project's own `.openagent/` — where its hooks file sits, and where a run's tool keeps
|
|
69
55
|
// the run's card and diary inside the run's checkout. Created up front so the daemon works as the
|
|
70
56
|
// very first command in a fresh workspace, before any run has made the directory.
|
|
71
57
|
await mkdir(daemonDir(cwd), { recursive: true });
|
|
72
|
-
// Everything the dashboard drives per project (a run's start, project install, the
|
|
58
|
+
// Everything the dashboard drives per project (a run's start, project install, the machine
|
|
73
59
|
// relay) lives in the runtime, so this body stays about the daemon's own lifecycle.
|
|
74
60
|
const runtime = createProjectRuntime({ cwd, env });
|
|
75
61
|
// Known only once the dashboard listens; the bridge browser is told it (#1332).
|
|
@@ -99,7 +85,6 @@ export async function runDaemon(cwd, opts = {}) {
|
|
|
99
85
|
return (opts.bridgeBrowser ?? (o => startBridgeBrowser(o)))({ daemonUrl, token: bridgeToken, dir: bridgeBrowserDir(env), report });
|
|
100
86
|
}, console.log);
|
|
101
87
|
const dashboard = await startDashboard({
|
|
102
|
-
host,
|
|
103
88
|
port,
|
|
104
89
|
quota,
|
|
105
90
|
// Which models each coding agent offers: asked on the menu's first read, then kept.
|
|
@@ -107,12 +92,13 @@ export async function runDaemon(cwd, opts = {}) {
|
|
|
107
92
|
onStart: runtime.onStart,
|
|
108
93
|
onAddProject: runtime.onAddProject,
|
|
109
94
|
onRemoveProject: runtime.onRemoveProject,
|
|
110
|
-
// Relay an agent to/from a
|
|
111
|
-
// is relaying, `remote` lets the read RPCs forward a remote agent's reads/steer/push to its
|
|
95
|
+
// Relay an agent to/from a saved machine (#1067): the events source streams an agent this daemon
|
|
96
|
+
// is relaying, `remote` lets the read RPCs forward a remote agent's reads/steer/push to its machine
|
|
112
97
|
// (slice 2), and the `/_relay/*` endpoints let another daemon run + read + steer a session here.
|
|
113
98
|
eventsSource: runtime.remoteEventsSource,
|
|
114
99
|
remote: runtime.remoteAgents,
|
|
115
|
-
relay: { tailEvents: runtime.tailRelayEvents, rpc: runtime.onRelayRpc },
|
|
100
|
+
relay: { project: runtime.projectAt, tailEvents: runtime.tailRelayEvents, rpc: runtime.onRelayRpc },
|
|
101
|
+
screen: runtime.screenOf,
|
|
116
102
|
// The browser bridge (#1237): absent unless the preference is on, which 404s every route.
|
|
117
103
|
...(bridgeToken ? { bridgeToken, bridgeSessions: () => listBridgeSessions(env) } : {}),
|
|
118
104
|
// The bridge browser follows its switch (#1332): on launches it, off closes it, without a restart.
|
|
@@ -124,13 +110,12 @@ export async function runDaemon(cwd, opts = {}) {
|
|
|
124
110
|
}),
|
|
125
111
|
projectErrors: projectErrors.read,
|
|
126
112
|
bridgeBrowser,
|
|
127
|
-
...(token ? { token } : {}),
|
|
128
113
|
...(clientBundleDir ? { clientBundleDir } : {}),
|
|
129
114
|
});
|
|
130
115
|
daemonUrl = dashboard.url;
|
|
131
116
|
try {
|
|
132
117
|
const actualPort = Number(new URL(dashboard.url).port) || port;
|
|
133
|
-
opts.onListening?.({ pid: process.pid, port: actualPort,
|
|
118
|
+
opts.onListening?.({ pid: process.pid, port: actualPort, url: dashboard.url, startedAt: new Date().toISOString() });
|
|
134
119
|
}
|
|
135
120
|
catch (err) {
|
|
136
121
|
// Startup failed after the port was bound. Tear the server down, or it keeps the event loop
|
|
@@ -149,6 +134,9 @@ export async function runDaemon(cwd, opts = {}) {
|
|
|
149
134
|
for (const record of await listProjects(undefined, env).catch(() => [])) {
|
|
150
135
|
await runProjectHooks(record.path, 'open', { log: console.log });
|
|
151
136
|
}
|
|
137
|
+
// The services of OpenAgent's own packages: each runs for as long as the daemon does, and is
|
|
138
|
+
// told the daemon's address.
|
|
139
|
+
const packageServices = (opts.packageServices ?? startPackageServices)({ commands: await builtInServices().catch(() => []), url: dashboard.url, env, log: console.log });
|
|
152
140
|
// Everything that runs in the background beside serving the dashboard: the data sync and the
|
|
153
141
|
// cloud sweeps.
|
|
154
142
|
const services = startBackgroundServices({
|
|
@@ -157,6 +145,7 @@ export async function runDaemon(cwd, opts = {}) {
|
|
|
157
145
|
log: console.log,
|
|
158
146
|
});
|
|
159
147
|
await waitForShutdown(opts.signal);
|
|
148
|
+
await packageServices.stop();
|
|
160
149
|
await services.quiesce();
|
|
161
150
|
// Each project's close hooks (#1774), the counterpart of the open hooks above. A run in flight
|
|
162
151
|
// is not the daemon's process: it goes on to its end, and the next dashboard shows it.
|