@openagt/dashboard 0.10.0 → 0.11.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 +8 -1
- package/dist/built-in.d.ts.map +1 -1
- package/dist/built-in.js +12 -3
- 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/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/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 +19 -25
- package/dist/dashboard/rpc-serve.d.ts.map +1 -1
- package/dist/dashboard/rpc-serve.js +11 -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 +52 -81
- package/dist/dashboard/server.js.map +1 -1
- package/dist/dashboard/types.d.ts +6 -14
- 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-9Xb8Ao4p.css +2 -0
- package/dist/dashboard-bundle/assets/main-DTyyQ0jM.js +140 -0
- package/dist/dashboard-bundle/assets/{module-gKz-ZvkG.js → module-DKd-4BTU.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 +1 -1
- package/dist/dashboard-rpc/index.d.ts.map +1 -1
- package/dist/dashboard-rpc/index.js +3 -3
- 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 +1 -1
- package/dist/dashboard-rpc/modules.js +2 -2
- package/dist/dashboard-rpc/modules.js.map +1 -1
- package/dist/dashboard-rpc/projects.d.ts +2 -0
- package/dist/dashboard-rpc/projects.d.ts.map +1 -1
- package/dist/dashboard-rpc/projects.js +3 -2
- 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/lib/draft-handoff.d.ts +5 -9
- package/dist/module-types/dashboard/module/index.d.ts +45 -0
- package/dist/module-types/src/built-in.d.ts +8 -1
- package/dist/module-types/src/client.d.ts +2 -1
- 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/remote-run.d.ts +77 -32
- package/dist/module-types/src/dashboard/rpc-serve.d.ts +19 -25
- package/dist/module-types/src/dashboard/types.d.ts +6 -14
- 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 +1 -1
- package/dist/module-types/src/dashboard-rpc/machines.d.ts +51 -0
- package/dist/module-types/src/dashboard-rpc/modules.d.ts +1 -1
- package/dist/module-types/src/dashboard-rpc/projects.d.ts +2 -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/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/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 +13 -10
- 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
package/README.md
CHANGED
|
@@ -14,18 +14,13 @@ cd ~/code/my-repo
|
|
|
14
14
|
openagent # serves the dashboard at http://127.0.0.1:4200
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
## The CLI is
|
|
17
|
+
## The CLI is three options and no verbs
|
|
18
18
|
|
|
19
19
|
```
|
|
20
20
|
openagent Serve the dashboard in the foreground. Ctrl+C closes it; the
|
|
21
21
|
agents it started go on to their own end.
|
|
22
22
|
|
|
23
23
|
--port <n> Dashboard port (default: 4200).
|
|
24
|
-
--host <addr> Bind address (default: 127.0.0.1). A non-loopback address
|
|
25
|
-
exposes the dashboard to your network and generates a shared
|
|
26
|
-
token; the printed URL carries it, and any request without it
|
|
27
|
-
gets 401. Exposing the daemon to the network is a security
|
|
28
|
-
decision.
|
|
29
24
|
-h, --help Show this help.
|
|
30
25
|
-v, --version Print the version.
|
|
31
26
|
```
|
package/dist/built-in.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { type ProjectPackage, type ProvidedCommand, type ProvidedCommandLookup }
|
|
|
9
9
|
* project's own dependencies is not read: OpenAgent's copy, and the rules below for which
|
|
10
10
|
* project has it, are the only ones.
|
|
11
11
|
*/
|
|
12
|
-
/** The packages every project has: an agent cannot start, be shown or be put on a git host without them. */
|
|
12
|
+
/** The packages every project has: an agent cannot start, be shown or be put on a git host without them, and the door to this computer and the servers it installed OpenAgent on are no project's to pick. */
|
|
13
13
|
export declare const BUILT_IN_PACKAGES: readonly string[];
|
|
14
14
|
/**
|
|
15
15
|
* The packages a project has once it picked them (#2023). A skill's package is the project's
|
|
@@ -32,6 +32,13 @@ export declare function builtInPackages(): Promise<ProjectPackage[]>;
|
|
|
32
32
|
export declare function builtInPackagesOf(root: string): Promise<ProjectPackage[]>;
|
|
33
33
|
/** The project's own installed packages, less the names OpenAgent brings itself. */
|
|
34
34
|
export declare function ownPackages(root: string): Promise<ProjectPackage[]>;
|
|
35
|
+
/**
|
|
36
|
+
* The services of the packages every project has: a package declares
|
|
37
|
+
* `"openagent": { "service": "<command>" }`, and `<command> serve` runs for as long as OpenAgent
|
|
38
|
+
* runs (`package-services.ts`). Only those packages: a service is this computer's, and a package
|
|
39
|
+
* a project picked is that project's.
|
|
40
|
+
*/
|
|
41
|
+
export declare function builtInServices(): Promise<ProvidedCommand[]>;
|
|
35
42
|
/** The directories the commands of OpenAgent's packages sit in: what a hook line's PATH gains after the project's own installed tools. */
|
|
36
43
|
export declare function builtInBinDirs(): Promise<string[]>;
|
|
37
44
|
/** What provides `kind` in the project at `root`: a package the project installed for it, else one OpenAgent brings to this project. */
|
package/dist/built-in.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"built-in.d.ts","sourceRoot":"","sources":["../src/built-in.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAGzD,OAAO,EAA6G,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAEtN;;;;;;;;GAQG;AAEH,
|
|
1
|
+
{"version":3,"file":"built-in.d.ts","sourceRoot":"","sources":["../src/built-in.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAGzD,OAAO,EAA6G,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAEtN;;;;;;;;GAQG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13,8 +13,8 @@ import { declaring, lineRuns, lookupProvidedCommand, packageBins, projectPackage
|
|
|
13
13
|
* project's own dependencies is not read: OpenAgent's copy, and the rules below for which
|
|
14
14
|
* project has it, are the only ones.
|
|
15
15
|
*/
|
|
16
|
-
/** The packages every project has: an agent cannot start, be shown or be put on a git host without them. */
|
|
17
|
-
export const BUILT_IN_PACKAGES = ['@openagt/files', '@openagt/skill-branches', '@openagt/skill-github', '@openagt/skill-logs', '@openagt/agent-runner'];
|
|
16
|
+
/** The packages every project has: an agent cannot start, be shown or be put on a git host without them, and the door to this computer and the servers it installed OpenAgent on are no project's to pick. */
|
|
17
|
+
export const BUILT_IN_PACKAGES = ['@openagt/files', '@openagt/remote-access', '@openagt/servers', '@openagt/skill-branches', '@openagt/skill-github', '@openagt/skill-logs', '@openagt/agent-runner'];
|
|
18
18
|
/**
|
|
19
19
|
* The packages a project has once it picked them (#2023). A skill's package is the project's
|
|
20
20
|
* when the project holds the skill's text where the coding agents read it
|
|
@@ -23,7 +23,7 @@ export const BUILT_IN_PACKAGES = ['@openagt/files', '@openagt/skill-branches', '
|
|
|
23
23
|
* tool with no skill text (the scheduler) is the project's when one of the project's hook lines
|
|
24
24
|
* runs it.
|
|
25
25
|
*/
|
|
26
|
-
export const PICKED_PACKAGES = ['@openagt/skill-tickets', '@openagt/skill-queue', '@openagt/skill-orchestration', '@openagt/agent-scheduler'];
|
|
26
|
+
export const PICKED_PACKAGES = ['@openagt/skill-tickets', '@openagt/skill-queue', '@openagt/skill-orchestration', '@openagt/skill-browser', '@openagt/agent-scheduler'];
|
|
27
27
|
/** Every name OpenAgent brings itself. */
|
|
28
28
|
export const OWN_PACKAGE_NAMES = [...BUILT_IN_PACKAGES, ...PICKED_PACKAGES];
|
|
29
29
|
let resolved;
|
|
@@ -91,6 +91,15 @@ function runsOneOf(lines, pkg) {
|
|
|
91
91
|
export async function ownPackages(root) {
|
|
92
92
|
return (await projectPackages(root)).filter(pkg => !OWN_PACKAGE_NAMES.includes(pkg.name));
|
|
93
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* The services of the packages every project has: a package declares
|
|
96
|
+
* `"openagent": { "service": "<command>" }`, and `<command> serve` runs for as long as OpenAgent
|
|
97
|
+
* runs (`package-services.ts`). Only those packages: a service is this computer's, and a package
|
|
98
|
+
* a project picked is that project's.
|
|
99
|
+
*/
|
|
100
|
+
export async function builtInServices() {
|
|
101
|
+
return declaring((await (resolved ??= resolveOwn())).filter(pkg => !pkg.picked), 'service');
|
|
102
|
+
}
|
|
94
103
|
/** The directories the commands of OpenAgent's packages sit in: what a hook line's PATH gains after the project's own installed tools. */
|
|
95
104
|
export async function builtInBinDirs() {
|
|
96
105
|
const dirs = new Set();
|
package/dist/built-in.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"built-in.js","sourceRoot":"","sources":["../src/built-in.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,qBAAqB,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,iBAAiB,EAAyE,MAAM,qBAAqB,CAAA;AAEtN;;;;;;;;GAQG;AAEH,
|
|
1
|
+
{"version":3,"file":"built-in.js","sourceRoot":"","sources":["../src/built-in.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,OAA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SAAS,CAAA;IACpF,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC;QAAE,OAAO,SAAS,CAAA;IACtE,MAAM,MAAM,GAAG,CAAC,KAAc,EAA6C,EAAE,CAC3E,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAQ,KAA4B,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAQ,KAA8B,CAAC,MAAM,KAAK,QAAQ,CAAA;IACrK,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;QAAE,OAAO,SAAS,CAAA;IACzC,OAAO,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAa,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAA;AACrH,CAAC"}
|
package/dist/cli.d.ts
CHANGED
|
@@ -4,26 +4,20 @@ export interface CliIO {
|
|
|
4
4
|
out: (line: string) => void;
|
|
5
5
|
err: (line: string) => void;
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
/** What the CLI itself accepts: four options, no verbs (D4). */
|
|
7
|
+
/** What the CLI itself accepts: three options, no verbs (D4). */
|
|
9
8
|
export interface CliArgs {
|
|
10
9
|
help: boolean;
|
|
11
10
|
version: boolean;
|
|
12
11
|
/** `--port <n>`: the port the dashboard binds. Default {@link DEFAULT_DAEMON_PORT}; `0` is ephemeral. */
|
|
13
12
|
port?: number;
|
|
14
|
-
/**
|
|
15
|
-
* `--host <addr>` (#1051): the dashboard's bind address. Default loopback; a non-loopback
|
|
16
|
-
* address exposes it to the network and gates every route behind the generated shared token.
|
|
17
|
-
*/
|
|
18
|
-
host?: string;
|
|
19
13
|
error?: string;
|
|
20
14
|
}
|
|
21
15
|
/**
|
|
22
16
|
* Parse argv (without the node/script prefix). Pure and testable.
|
|
23
17
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
18
|
+
* Three options and nothing else: `--port` because it is the one thing a browser cannot be asked
|
|
19
|
+
* and a dashboard cannot serve about itself; `--help` and `--version` because a command with
|
|
20
|
+
* options owes the user both. The command runs no agent (#1774): a run is started
|
|
27
21
|
* from the dashboard, by the project's own start hook.
|
|
28
22
|
*/
|
|
29
23
|
export declare function parseArgs(argv: string[]): CliArgs;
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0D,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAK/G,gEAAgE;AAChE,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3B,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAC5B;AAwBD,iEAAiE;AACjE,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,OAAO,CAAA;IAChB,yGAAyG;IACzG,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAyBjD;AAED,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,GAAE,KAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBnF;AA6BD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,GAAE;IAAE,WAAW,CAAC,EAAE,cAAc,CAAA;CAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAaxG"}
|
package/dist/cli.js
CHANGED
|
@@ -1,36 +1,11 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { dirname, join } from 'node:path';
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
1
|
import { checkForUpdate, formatUpdateStatus, nodeVersionFetcher } from './update-check.js';
|
|
5
|
-
import {
|
|
6
|
-
import { ensureDaemonToken } from './registry.js';
|
|
2
|
+
import { runDaemon, DEFAULT_DAEMON_PORT } from './daemon.js';
|
|
7
3
|
import { errorMessage } from './error-message.js';
|
|
4
|
+
import { openagentVersion } from './version.js';
|
|
8
5
|
const defaultIO = {
|
|
9
6
|
out: line => process.stdout.write(line + '\n'),
|
|
10
7
|
err: line => process.stderr.write(line + '\n'),
|
|
11
8
|
};
|
|
12
|
-
/**
|
|
13
|
-
* The CLI version, read from the package's own `package.json` at runtime (#312).
|
|
14
|
-
* The compiled entry lives one level under the package root (`dist/` or
|
|
15
|
-
* `dist-test/`), so its `package.json` is always `../package.json`. Cached after
|
|
16
|
-
* the first read; falls back to `unknown` if the file is somehow unreadable.
|
|
17
|
-
*/
|
|
18
|
-
let cachedVersion;
|
|
19
|
-
export function openagentVersion() {
|
|
20
|
-
if (cachedVersion !== undefined)
|
|
21
|
-
return cachedVersion;
|
|
22
|
-
try {
|
|
23
|
-
const pkgPath = join(dirname(fileURLToPath(import.meta.url)), '..', 'package.json');
|
|
24
|
-
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
|
25
|
-
// `unknown`, not `0.0.0`: the packages are unreleased and legitimately versioned `0.0.0`, so a
|
|
26
|
-
// numeric fallback would make a failed read indistinguishable from a correct one (#312).
|
|
27
|
-
cachedVersion = pkg.version ?? 'unknown';
|
|
28
|
-
}
|
|
29
|
-
catch {
|
|
30
|
-
cachedVersion = 'unknown';
|
|
31
|
-
}
|
|
32
|
-
return cachedVersion;
|
|
33
|
-
}
|
|
34
9
|
const HELP = `OpenAgent — turnkey AI orchestration that wraps a coding agent (Claude Code or Codex).
|
|
35
10
|
|
|
36
11
|
Usage:
|
|
@@ -39,22 +14,20 @@ Usage:
|
|
|
39
14
|
|
|
40
15
|
Options:
|
|
41
16
|
--port <n> Dashboard port (default: 4200).
|
|
42
|
-
--host <addr> Bind address (default: 127.0.0.1, localhost only). A non-loopback
|
|
43
|
-
address (e.g. 0.0.0.0) exposes the dashboard to your network and
|
|
44
|
-
generates a shared token; the printed URL carries it, and any request
|
|
45
|
-
without it gets 401. Exposing a process spawner to the network is a
|
|
46
|
-
security decision (#806).
|
|
47
17
|
-h, --help Show this help.
|
|
48
18
|
-v, --version Print the version.
|
|
49
19
|
|
|
20
|
+
The dashboard listens on this computer only. A phone, or another computer's OpenAgent, gets in
|
|
21
|
+
from its Settings page: Devices.
|
|
22
|
+
|
|
50
23
|
Everything else is the dashboard: it shows a project's runs from their files, and starts one
|
|
51
24
|
through the project's own start hook (.openagent/hooks.yml), which names the tool that runs it.`;
|
|
52
25
|
/**
|
|
53
26
|
* Parse argv (without the node/script prefix). Pure and testable.
|
|
54
27
|
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
28
|
+
* Three options and nothing else: `--port` because it is the one thing a browser cannot be asked
|
|
29
|
+
* and a dashboard cannot serve about itself; `--help` and `--version` because a command with
|
|
30
|
+
* options owes the user both. The command runs no agent (#1774): a run is started
|
|
58
31
|
* from the dashboard, by the project's own start hook.
|
|
59
32
|
*/
|
|
60
33
|
export function parseArgs(argv) {
|
|
@@ -75,19 +48,12 @@ export function parseArgs(argv) {
|
|
|
75
48
|
if (Number.isInteger(n) && n >= 0)
|
|
76
49
|
opts.port = n;
|
|
77
50
|
else
|
|
78
|
-
opts.error
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
case '--host': {
|
|
82
|
-
const value = argv[++i];
|
|
83
|
-
if (value === undefined)
|
|
84
|
-
opts.error = 'invalid --host: missing address';
|
|
85
|
-
else
|
|
86
|
-
opts.host = value;
|
|
51
|
+
opts.error ??= 'invalid --port: must be a non-negative integer';
|
|
87
52
|
break;
|
|
88
53
|
}
|
|
89
54
|
default:
|
|
90
|
-
|
|
55
|
+
// The first thing that could not be read is the one told: what follows an unknown option is its value, not a command.
|
|
56
|
+
opts.error ??= arg.startsWith('-') ? `unknown option: ${arg}` : `unknown command: ${arg}`;
|
|
91
57
|
}
|
|
92
58
|
}
|
|
93
59
|
return opts;
|
|
@@ -118,19 +84,11 @@ export async function runCli(argv, io = defaultIO) {
|
|
|
118
84
|
async function runForegroundDaemonCmd(args, io) {
|
|
119
85
|
const cwd = process.cwd();
|
|
120
86
|
const port = args.port ?? DEFAULT_DAEMON_PORT;
|
|
121
|
-
const host = args.host;
|
|
122
|
-
// #1051: pre-generate the shared token for a non-loopback bind so onListening (sync) can print
|
|
123
|
-
// the reachable URL; runDaemon reuses the same persisted token.
|
|
124
|
-
const token = host !== undefined && !isLoopbackHost(host) ? await ensureDaemonToken() : undefined;
|
|
125
87
|
try {
|
|
126
88
|
await runDaemon(cwd, {
|
|
127
89
|
port,
|
|
128
|
-
...(host !== undefined ? { host } : {}),
|
|
129
90
|
onListening: state => {
|
|
130
91
|
io.out(`◆ dashboard running: ${state.url}`);
|
|
131
|
-
if (!isLoopbackHost(state.host ?? DEFAULT_DAEMON_HOST)) {
|
|
132
|
-
printNonLoopbackAccess(io, state.host ?? DEFAULT_DAEMON_HOST, state.url, token);
|
|
133
|
-
}
|
|
134
92
|
io.out(' Ctrl+C to stop the dashboard. Server logs stream below.');
|
|
135
93
|
// #312 asks bare `openagent` to print the commands + version too. onListening is sync and
|
|
136
94
|
// runDaemon then blocks until signalled, so this is fire-and-forget by necessity: the
|
|
@@ -145,20 +103,6 @@ async function runForegroundDaemonCmd(args, io) {
|
|
|
145
103
|
}
|
|
146
104
|
return 0;
|
|
147
105
|
}
|
|
148
|
-
/**
|
|
149
|
-
* The loud one-line warning and the token-bearing URL printed on any non-loopback daemon bind
|
|
150
|
-
* (#1051). A daemon that spawns processes is code execution for anyone who reaches the port, and
|
|
151
|
-
* the shared token is the only guard, so this says so before the daemon is left running. The bound
|
|
152
|
-
* host is a bind-all like `0.0.0.0`, so the user swaps it for the machine's actual reachable
|
|
153
|
-
* address (a Tailscale/LAN hostname); the token rides the URL for the first hop, then the cookie.
|
|
154
|
-
*/
|
|
155
|
-
function printNonLoopbackAccess(io, host, url, token) {
|
|
156
|
-
io.err(`⚠ SECURITY: bound to ${host} (non-loopback). This exposes code execution to your network; the shared token is the only guard (#1051).`);
|
|
157
|
-
if (!token)
|
|
158
|
-
return;
|
|
159
|
-
io.out(` Open with the token (swap ${host} for this machine's reachable address, e.g. a Tailscale hostname):`);
|
|
160
|
-
io.out(` ${url}/?token=${token}`);
|
|
161
|
-
}
|
|
162
106
|
/**
|
|
163
107
|
* The startup footer every dashboard path prints (#312): where prompts come from, the version,
|
|
164
108
|
* and then — once npm answers — whether that version is the latest.
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,kBAAkB,EAAuB,MAAM,mBAAmB,CAAA;AAC/G,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAQ/C,MAAM,SAAS,GAAU;IACvB,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;IAC9C,GA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AAC,kCAAkC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QAC/D,OAAO,CAAC,CAAA;IACV,CAAC;IACD,OAAO,CAAC,CAAA;AACV,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAAC,EAAS,EAAE,IAAI,GAAqC,EAAE;IACvF,MAAM,OAAO,GAAG,gBAAgB,EAAE,CAAA;IAClC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IACV,EAAE,CAAC,GAAG,CAAC,2DAA2D,CAAC,CAAA;IACnE,EAAE,CAAC,GAAG,CAAC,6CAA6C,CAAC,CAAA;IACrD,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IACV,EAAE,CAAC,GAAG,CAAC,cAAc,OAAO,EAAE,CAAC,CAAA;IAC/B,OAAO,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,IAAI,kBAAkB,EAAE,CAAC;SACrE,IAAI,CAAC,MAAM,CAAC,EAAE;QACb,MAAM,IAAI,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAA;QACvC,IAAI,IAAI;YAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IACxB,CAAC,CAAC;SACD,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;AACpB,CAAC"}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { DRIVERS, DRIVER_LABELS, isDriverName, driverFromImpl, type DriverName } from './driver-names.js';
|
|
2
2
|
export { PUBLISH_LABELS, isPublishPick, offeredPublishPicks, publishPickIn, type PublishPick } from './publish-levels.js';
|
|
3
3
|
export { formatOpenAgentEvent } from './terminal.js';
|
|
4
|
+
export { foldScreenRows } from './screens.js';
|
|
4
5
|
export { formatBytes } from './format-bytes.js';
|
|
5
6
|
export { errorMessage } from './error-message.js';
|
|
6
7
|
export { pickedIds } from './events.js';
|
|
@@ -10,7 +11,7 @@ export { interventionKey, activityKey } from './dashboard/keys.js';
|
|
|
10
11
|
export { SeenTracker } from './dashboard/keyed-watcher.js';
|
|
11
12
|
export type { ProjectionRead } from './dashboard/projects.js';
|
|
12
13
|
export { NOTIFICATION_DEFAULTS, MAX_SPEND_OFFSET, notifies, browserNotifyEnabled, notifyCategoryEnabled, type NotifyCategory } from './preference-defaults.js';
|
|
13
|
-
export {
|
|
14
|
+
export { parseMachineLink } from './machine-link.js';
|
|
14
15
|
export { bridgeChoiceRequest } from './dashboard/bridge-question.js';
|
|
15
16
|
export { cloudRunState, cloudRunActive, CLOUD_SESSION_WINDOW_MS, type CloudRunState } from './cloud-run-state.js';
|
|
16
17
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACzG,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,mBAAmB,EAAE,aAAa,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACzH,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EACL,WAAW,EACX,WAAW,EACX,KAAK,WAAW,EAChB,KAAK,UAAU,GAChB,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAGlD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAIlE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA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mBAAmB,EAAE,MAAM,gCAAgC,CAAA;AAEpE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,uBAAuB,EAAE,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAA"}
|
package/dist/client.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
export { DRIVERS, DRIVER_LABELS, isDriverName, driverFromImpl } from './driver-names.js';
|
|
6
6
|
export { PUBLISH_LABELS, isPublishPick, offeredPublishPicks, publishPickIn } from './publish-levels.js';
|
|
7
7
|
export { formatOpenAgentEvent } from './terminal.js';
|
|
8
|
+
export { foldScreenRows } from './screens.js';
|
|
8
9
|
export { formatBytes } from './format-bytes.js';
|
|
9
10
|
export { errorMessage } from './error-message.js';
|
|
10
11
|
export { pickedIds } from './events.js';
|
|
@@ -19,10 +20,8 @@ export { interventionKey, activityKey } from './dashboard/keys.js';
|
|
|
19
20
|
// git host reach take an empty backlog for a real one. Pure, and its only import is a type.
|
|
20
21
|
export { SeenTracker } from './dashboard/keyed-watcher.js';
|
|
21
22
|
export { NOTIFICATION_DEFAULTS, MAX_SPEND_OFFSET, notifies, browserNotifyEnabled, notifyCategoryEnabled } from './preference-defaults.js';
|
|
22
|
-
//
|
|
23
|
-
|
|
24
|
-
// kept its own looser copy, which answered `false` for every 127.0.0.0/8 address but the first.
|
|
25
|
-
export { isLoopbackHost } from './loopback-host.js';
|
|
23
|
+
// How a pasted machine link is read, so the dialog and the daemon read a paste the same way.
|
|
24
|
+
export { parseMachineLink } from './machine-link.js';
|
|
26
25
|
// A bridged question as the gate panel renders it (#1554): pure, so the client projects it itself.
|
|
27
26
|
export { bridgeChoiceRequest } from './dashboard/bridge-question.js';
|
|
28
27
|
// What a web run's cloud side is doing, from its record (#1668): pure, so every surface derives the same word.
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,wFAAw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AAM,cAAc,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EACL,WAAW,EACX,WAAW,GAGZ,MAAM,iBAAiB,CAAA;AACxB,8FAA8F;AAC9F,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,+FAA+F;AAC/F,8DAA8D;AAC9D,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAClE,oGAAoG;AACpG,qGAAqG;AACrG,4FAA4F;AAC5F,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAE1D,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,QAAQ,EAAE,oBAAoB,EAAE,qBAAqB,EAAuB,MAAM,0BAA0B,CAAA;AAC9J,6FAA6F;AAC7F,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACpD,mGAAmG;AACnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAA;AACpE,+GAA+G;AAC/G,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,uBAAuB,EAAsB,MAAM,sBAAsB,CAAA"}
|
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
|