@openagt/dashboard 0.11.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/dist/built-in.d.ts +15 -6
- package/dist/built-in.d.ts.map +1 -1
- package/dist/built-in.js +25 -11
- package/dist/built-in.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/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/rpc-serve.d.ts +9 -0
- package/dist/dashboard/rpc-serve.d.ts.map +1 -1
- package/dist/dashboard/rpc-serve.js +15 -0
- package/dist/dashboard/rpc-serve.js.map +1 -1
- package/dist/dashboard/server.d.ts.map +1 -1
- package/dist/dashboard/server.js +5 -3
- package/dist/dashboard/server.js.map +1 -1
- package/dist/dashboard/types.d.ts +5 -2
- package/dist/dashboard/types.d.ts.map +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-DKd-4BTU.js → module-ZjyA5WUg.js} +2 -2
- package/dist/dashboard-bundle/host/module.js +1 -1
- package/dist/dashboard-bundle/index.html +3 -3
- package/dist/dashboard-rpc/index.d.ts +2 -2
- package/dist/dashboard-rpc/index.d.ts.map +1 -1
- package/dist/dashboard-rpc/index.js +2 -2
- package/dist/dashboard-rpc/index.js.map +1 -1
- package/dist/dashboard-rpc/modules.d.ts +11 -3
- package/dist/dashboard-rpc/modules.d.ts.map +1 -1
- package/dist/dashboard-rpc/modules.js +22 -3
- package/dist/dashboard-rpc/modules.js.map +1 -1
- package/dist/dashboard-rpc/projects.d.ts +16 -0
- package/dist/dashboard-rpc/projects.d.ts.map +1 -1
- package/dist/dashboard-rpc/projects.js +24 -3
- package/dist/dashboard-rpc/projects.js.map +1 -1
- package/dist/module-types/dashboard/components/QrCode.d.ts +8 -0
- package/dist/module-types/dashboard/module/index.d.ts +11 -4
- package/dist/module-types/dashboard/rpc/modules.d.ts +1 -0
- package/dist/module-types/src/built-in.d.ts +15 -6
- package/dist/module-types/src/clone-project.d.ts +68 -0
- package/dist/module-types/src/dashboard/module-serve.d.ts +6 -0
- package/dist/module-types/src/dashboard/rpc-serve.d.ts +9 -0
- package/dist/module-types/src/dashboard/types.d.ts +5 -2
- package/dist/module-types/src/dashboard-rpc/index.d.ts +2 -2
- package/dist/module-types/src/dashboard-rpc/modules.d.ts +11 -3
- package/dist/module-types/src/dashboard-rpc/projects.d.ts +16 -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/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/package.json +13 -12
- package/dist/dashboard-bundle/assets/main-9Xb8Ao4p.css +0 -2
- package/dist/dashboard-bundle/assets/main-DTyyQ0jM.js +0 -140
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import { homedir } from 'node:os';
|
|
1
2
|
import { contextProjects, resolveProjectPath } from './context.js';
|
|
2
|
-
import { findProjectModule, readProjectModules, runModuleCommand as runCommand } from '../project-modules.js';
|
|
3
|
-
import { moduleUrl } from '../dashboard/module-serve.js';
|
|
3
|
+
import { findComputerModule, findProjectModule, readComputerModules, readProjectModules, runModuleCommand as runCommand } from '../project-modules.js';
|
|
4
|
+
import { computerModuleUrl, moduleUrl } from '../dashboard/module-serve.js';
|
|
4
5
|
import { providedDataChanged } from '../store/provided.js';
|
|
5
6
|
import { callModuleRead, serverHost } from '../dashboard/module-host.js';
|
|
6
7
|
import { relayOr } from './relay-agent.js';
|
|
7
8
|
import { DATA_BRANCH, pullFileBranch } from '@openagt/agent-data';
|
|
8
9
|
/**
|
|
9
|
-
* Every module
|
|
10
|
+
* Every module the dashboard loads (#1774), one per package. First the computer's, which are
|
|
11
|
+
* there with no project added. Then every module any registered project brings, with the projects
|
|
10
12
|
* that have it: with no project picked the sidebar and the pages are every project's, and the
|
|
11
13
|
* dashboard narrows them itself to a picked project's. A package several projects install is loaded once, from
|
|
12
14
|
* the first of them in the registry's order; its page then reads each project through that
|
|
@@ -14,6 +16,9 @@ import { DATA_BRANCH, pullFileBranch } from '@openagt/agent-data';
|
|
|
14
16
|
*/
|
|
15
17
|
export async function onModules() {
|
|
16
18
|
const byPackage = new Map();
|
|
19
|
+
for (const module of await readComputerModules().catch(() => [])) {
|
|
20
|
+
byPackage.set(module.package, { package: module.package, url: computerModuleUrl(module), projects: [] });
|
|
21
|
+
}
|
|
17
22
|
for (const project of await contextProjects().list()) {
|
|
18
23
|
const modules = await readProjectModules(project.path).catch(() => []);
|
|
19
24
|
for (const module of modules) {
|
|
@@ -55,6 +60,20 @@ export async function runModuleCommand(projectId, pkg, args, command, acts = fal
|
|
|
55
60
|
providedDataChanged(root);
|
|
56
61
|
return result;
|
|
57
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Run one of the commands of a package that is this computer's, in no project, and answer its
|
|
65
|
+
* JSON output: how the door's page and the servers' page read and change what they keep, which is
|
|
66
|
+
* in the person's home folder, where the command runs. Refused for any other package: a project's
|
|
67
|
+
* module runs its commands in its project ({@link runModuleCommand}).
|
|
68
|
+
*/
|
|
69
|
+
export async function runComputerCommand(pkg, args, command) {
|
|
70
|
+
if (!Array.isArray(args))
|
|
71
|
+
return { ok: false, error: 'arguments must be a list' };
|
|
72
|
+
const module = await findComputerModule(pkg);
|
|
73
|
+
if (!module)
|
|
74
|
+
return { ok: false, error: `${pkg} is not this computer's` };
|
|
75
|
+
return runCommand(homedir(), module, args, command);
|
|
76
|
+
}
|
|
58
77
|
/**
|
|
59
78
|
* Call read `name` of a module's server part in one project: how a module's browser part reads
|
|
60
79
|
* what a command cannot answer fast enough. Refused for an unknown project, a package that is not
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modules.js","sourceRoot":"","sources":["../../src/dashboard-rpc/modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAClE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,gBAAgB,IAAI,UAAU,EAA4B,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"modules.js","sourceRoot":"","sources":["../../src/dashboard-rpc/modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAClE,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,gBAAgB,IAAI,UAAU,EAA4B,MAAM,uBAAuB,CAAA;AAChL,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,UAAU,EAAyB,MAAM,6BAA6B,CAAA;AAC/F,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAejE;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS;IAC7B,MAAM,SAAS,GAAG,IAAI,GAAG,EAA2B,CAAA;IACpD,KAAK,MAAM,MAAM,IAAI,MAAM,mBAAmB,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAA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E,GAAW,EAAE,IAAY,EAAE,KAAc;IAC3F,MAAM,OAAO,GAAG,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAQ,KAA+B,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAE,KAA6B,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAA;IACvK,OAAO,OAAO,CAAmB,OAAO,EAAE,YAAY,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,KAAK,IAAI,EAAE;QAChG,MAAM,IAAI,GAAG,MAAM,kBAAkB,CAAC,SAAS,CAAC,CAAA;QAChD,IAAI,CAAC,IAAI;YAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAA;QACzD,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;QACxE,IAAI,CAAC,MAAM;YAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,GAAG,+BAA+B,EAAE,CAAA;QAC/E,IAAI,CAAC,MAAM,CAAC,MAAM;YAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,GAAG,qBAAqB,EAAE,CAAA;QAC5E,OAAO,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAA;IACrE,CAAC,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,8CAA8C,EAAE,CAAC,CAAA;AAC1E,CAAC"}
|
|
@@ -15,6 +15,22 @@ export declare function onProjects(): Promise<ProjectSummary[]>;
|
|
|
15
15
|
* repository's remote. Nothing is pushed for a project added with `false`.
|
|
16
16
|
*/
|
|
17
17
|
export declare function sendAddProject(path: string, share: boolean): Promise<AddProjectResult>;
|
|
18
|
+
/** Where the repository a person typed the address of would be cloned to on this computer, or why what was typed is no address: asked before anything is cloned. */
|
|
19
|
+
export declare function onCloneTarget(address: string): Promise<{
|
|
20
|
+
ok: true;
|
|
21
|
+
address: string;
|
|
22
|
+
path: string;
|
|
23
|
+
} | {
|
|
24
|
+
ok: false;
|
|
25
|
+
error: string;
|
|
26
|
+
}>;
|
|
27
|
+
/**
|
|
28
|
+
* Add a project by its repository's address, for a computer that does not have its folder: the
|
|
29
|
+
* repository is cloned into `~/projects/<its name>` with the logins this computer has, and the
|
|
30
|
+
* folder is then added as {@link sendAddProject} adds one. A folder already there with this
|
|
31
|
+
* repository in it is added as it is. The answer says where the project is.
|
|
32
|
+
*/
|
|
33
|
+
export declare function sendAddProjectFromAddress(address: string, share: boolean): Promise<AddProjectResult>;
|
|
18
34
|
/**
|
|
19
35
|
* Remove a project from the dashboard: it leaves the Projects list. Nothing in its folder is
|
|
20
36
|
* deleted unless `files` is true: then what OpenAgent left there is removed too, and the answer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../src/dashboard-rpc/projects.ts"],"names":[],"mappings":"AACA,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACjF,OAAO,EAA+E,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACnI,OAAO,EAAsD,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../src/dashboard-rpc/projects.ts"],"names":[],"mappings":"AACA,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACjF,OAAO,EAA+E,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACnI,OAAO,EAAsD,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAQ7G,OAAO,EAAmC,KAAK,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAEh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AmB,CAAC,CAE7E;AAED;;;GAGG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAKlE;AAED,0GAA0G;AAC1G,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,cAAc,EAAE,CAAA;IAC1B,iGAAiG;IACjG,SAAS,EAAE,OAAO,CAAA;IAClB,qJAAqJ;IACrJ,OAAO,EAAE,OAAO,CAAA;IAChB,8IAA8I;IAC9I,MAAM,EAAE,OAAO,CAAA;IACf,sJAAsJ;IACtJ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;OAKG;IACH,SAAS,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;CAC5C;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAanF;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAMrG"}
|
|
@@ -6,7 +6,9 @@ import { hasRemote } from '../has-remote.js';
|
|
|
6
6
|
import { repositoryAddress } from '../repository-address.js';
|
|
7
7
|
import { currentBranch } from '../dashboard/git-status.js';
|
|
8
8
|
import { waitingSkills } from '../dashboard/start-branch.js';
|
|
9
|
-
import {
|
|
9
|
+
import { homedir } from 'node:os';
|
|
10
|
+
import { cloneProject, cloneTargetOf } from '../clone-project.js';
|
|
11
|
+
import { canPickDirectory, pickDirectory } from '../pick-directory.js';
|
|
10
12
|
import { projectGitHost } from '../store/git-host.js';
|
|
11
13
|
// The Projects sidebar behind the new dashboard (#405): the global registry (#390) the
|
|
12
14
|
// daemon and CLI write — id, path, name, activated, last activity. The per-agent
|
|
@@ -42,6 +44,24 @@ export async function sendAddProject(path, share) {
|
|
|
42
44
|
return { ok: false, error: 'a project path is required' };
|
|
43
45
|
return addProject(trimmed, share === true);
|
|
44
46
|
}
|
|
47
|
+
/** Where the repository a person typed the address of would be cloned to on this computer, or why what was typed is no address: asked before anything is cloned. */
|
|
48
|
+
export async function onCloneTarget(address) {
|
|
49
|
+
return cloneTargetOf(typeof address === 'string' ? address : '');
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Add a project by its repository's address, for a computer that does not have its folder: the
|
|
53
|
+
* repository is cloned into `~/projects/<its name>` with the logins this computer has, and the
|
|
54
|
+
* folder is then added as {@link sendAddProject} adds one. A folder already there with this
|
|
55
|
+
* repository in it is added as it is. The answer says where the project is.
|
|
56
|
+
*/
|
|
57
|
+
export async function sendAddProjectFromAddress(address, share) {
|
|
58
|
+
const addProject = contextAddProject();
|
|
59
|
+
const cloned = await cloneProject(typeof address === 'string' ? address : '');
|
|
60
|
+
if (!cloned.ok)
|
|
61
|
+
return cloned;
|
|
62
|
+
const added = await addProject(cloned.path, share === true);
|
|
63
|
+
return added.ok ? { ...added, path: cloned.path } : added;
|
|
64
|
+
}
|
|
45
65
|
/**
|
|
46
66
|
* Remove a project from the dashboard: it leaves the Projects list. Nothing in its folder is
|
|
47
67
|
* deleted unless `files` is true: then what OpenAgent left there is removed too, and the answer
|
|
@@ -95,9 +115,10 @@ export async function sendPickProjectDirectory() {
|
|
|
95
115
|
* so the first step can offer "Add {cwd} as project" without the user typing a path.
|
|
96
116
|
*/
|
|
97
117
|
export async function onOnboarding() {
|
|
98
|
-
|
|
118
|
+
// A service runs in its user's home folder, as OpenAgent does on a server: no project to offer.
|
|
119
|
+
const cwd = process.cwd() === homedir() ? null : process.cwd();
|
|
99
120
|
const registered = await contextProjects().list();
|
|
100
|
-
return { cwd, cwdProjectId: registered.find(p => p.path === cwd)?.id
|
|
121
|
+
return { cwd, cwdProjectId: (cwd !== null && registered.find(p => p.path === cwd)?.id) || null, canPickFolder: canPickDirectory() };
|
|
101
122
|
}
|
|
102
123
|
/**
|
|
103
124
|
* The project's commands (#1774), read off its skills folders, whether it has a start hook, whether
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projects.js","sourceRoot":"","sources":["../../src/dashboard-rpc/projects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,eAAe,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACjI,OAAO,EAAE,mBAAmB,EAAuB,MAAM,wBAAwB,CAAA;AACjF,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,mBAAmB,EAAE,cAAc,EAAE,YAAY,EAAoB,MAAM,qBAAqB,CAAA;AACnI,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,kBAAkB,EAAuB,MAAM,qBAAqB,CAAA;AAE7G,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAC5D,OAAO,EAAE,aAAa,EAA4B,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"projects.js","sourceRoot":"","sources":["../../src/dashboard-rpc/projects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,eAAe,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACjI,OAAO,EAAE,mBAAmB,EAAuB,MAAM,wBAAwB,CAAA;AACjF,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,mBAAmB,EAAE,cAAc,EAAE,YAAY,EAAoB,MAAM,qBAAqB,CAAA;AACnI,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,kBAAkB,EAAuB,MAAM,qBAAqB,CAAA;AAE7G,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC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E,MAAe;IACnE,MAAM,GAAG,GAAG,MAAM,kBAAkB,CAAC,SAAS,CAAC,CAAA;IAC/C,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAA;IACrB,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,GAAG,EAAE,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;IAC/E,IAAI,OAAO,CAAC,EAAE;QAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAA;IACjF,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAA;AAC5E,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A link as a QR code. Always dark on white, whatever the page's theme: a phone's camera reads
|
|
3
|
+
* the contrast, not the colours of the page around it.
|
|
4
|
+
*/
|
|
5
|
+
export declare function QrCode({ text, label }: {
|
|
6
|
+
text: string;
|
|
7
|
+
label: string;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
@@ -104,13 +104,13 @@ export interface ModuleCard {
|
|
|
104
104
|
}
|
|
105
105
|
/** What a Settings section is rendered with: the projects that have its package. */
|
|
106
106
|
export interface ModuleSettingsProps {
|
|
107
|
-
/** The registered projects whose dependencies include the module's package, in the registry's order. */
|
|
107
|
+
/** The registered projects whose dependencies include the module's package, in the registry's order; none for a package that is the computer's. */
|
|
108
108
|
projects: ModuleProject[];
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
111
111
|
* A section a module adds to the Settings page: the package's own settings, read and written
|
|
112
|
-
* through its own command, drawn after the dashboard's own sections. A package with no
|
|
113
|
-
* registered shows none.
|
|
112
|
+
* through its own command, drawn after the dashboard's own sections. A project's package with no
|
|
113
|
+
* project registered shows none; a package that is the computer's shows its own with no project.
|
|
114
114
|
*/
|
|
115
115
|
export interface ModuleSettings {
|
|
116
116
|
/** Which section this is, for the shell's key and its error line; the section draws its own title. */
|
|
@@ -273,6 +273,12 @@ export interface ModuleHost {
|
|
|
273
273
|
* change shows at once instead of at the next sync. A link action's host runs every command so.
|
|
274
274
|
*/
|
|
275
275
|
act(projectId: string, args: string[], command?: string): Promise<ModuleCommandResult>;
|
|
276
|
+
/**
|
|
277
|
+
* Run one of the module package's own commands in no project, for a package that is this
|
|
278
|
+
* computer's (the door to it, its servers): what such a package keeps is the computer's, so
|
|
279
|
+
* its page reads and changes it with no project added. Refused for any other package.
|
|
280
|
+
*/
|
|
281
|
+
runComputerCommand(args: string[], command?: string): Promise<ModuleCommandResult>;
|
|
276
282
|
/**
|
|
277
283
|
* Call one of the module's own server reads (its package's `./server`) in one project, with
|
|
278
284
|
* `input`, a JSON object; `input.agentId` names the run the read is about, when it is about one.
|
|
@@ -337,7 +343,7 @@ export type MachineAdded = {
|
|
|
337
343
|
error: string;
|
|
338
344
|
};
|
|
339
345
|
/** What the dashboard knows about the module it is serving: every service but the commands and the reads, which it binds to the package. */
|
|
340
|
-
export type ModuleHostBase = Omit<ModuleHost, 'runCommand' | 'act' | 'read'>;
|
|
346
|
+
export type ModuleHostBase = Omit<ModuleHost, 'runCommand' | 'act' | 'runComputerCommand' | 'read'>;
|
|
341
347
|
/**
|
|
342
348
|
* The host for one module: the dashboard's services, and its commands bound to the module's own
|
|
343
349
|
* package. `acts` marks every command as an action on the project rather than a page's read: the
|
|
@@ -374,6 +380,7 @@ export { StartAgentButton } from '../components/StartAgentButton.js';
|
|
|
374
380
|
export { LinkActions, type ProjectLinks, type LinkTargets } from '../components/LinkActions.js';
|
|
375
381
|
export { cn } from '../lib/utils.js';
|
|
376
382
|
export { SettingsSection, SettingsRow, SettingsSelectRow, type SettingsOption } from '../components/SettingsRows.js';
|
|
383
|
+
export { QrCode } from '../components/QrCode.js';
|
|
377
384
|
export { useCodingAgents, type CodingAgent } from '../lib/models.js';
|
|
378
385
|
export { MAX_SPEND_OFFSET } from '../../src/preference-defaults.js';
|
|
379
386
|
export { formatRelative, formatDateTime, formatDuration, formatAge } from '../lib/format-date.js';
|
|
@@ -2,4 +2,5 @@ import type * as impl from '../../src/dashboard-rpc/modules.js';
|
|
|
2
2
|
export type * from '../../src/dashboard-rpc/modules.js';
|
|
3
3
|
export declare const onModules: () => Promise<impl.DashboardModule[]>;
|
|
4
4
|
export declare const runModuleCommand: (projectId: string, pkg: string, args: string[], command?: string | undefined, acts?: boolean | undefined) => Promise<import("@openagt/agent-data").PackageCommandResult>;
|
|
5
|
+
export declare const runComputerCommand: (pkg: string, args: string[], command?: string | undefined) => Promise<import("@openagt/agent-data").PackageCommandResult>;
|
|
5
6
|
export declare const readModule: (projectId: string, pkg: string, name: string, input: unknown) => Promise<impl.ModuleReadResult>;
|
|
@@ -5,12 +5,18 @@ import { type ProjectPackage, type ProvidedCommand, type ProvidedCommandLookup }
|
|
|
5
5
|
* own install, so a project installs nothing for them and an empty folder starts an agent and
|
|
6
6
|
* shows it. Each comes through the same contract as any package: a module by its `./dashboard`
|
|
7
7
|
* export, a provider of a kind of data and the writer of its hook lines by its `openagent` key.
|
|
8
|
-
* These
|
|
8
|
+
* These three lists are the one place OpenAgent names a package. One of these names among a
|
|
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. */
|
|
13
13
|
export declare const BUILT_IN_PACKAGES: readonly string[];
|
|
14
|
+
/**
|
|
15
|
+
* The packages that are this computer's and no project's: the door to it, and the servers it
|
|
16
|
+
* installed OpenAgent on. Their pages show and their commands run with no project added, and
|
|
17
|
+
* what one keeps is in the person's home folder.
|
|
18
|
+
*/
|
|
19
|
+
export declare const COMPUTER_PACKAGES: readonly string[];
|
|
14
20
|
/**
|
|
15
21
|
* The packages a project has once it picked them (#2023). A skill's package is the project's
|
|
16
22
|
* when the project holds the skill's text where the coding agents read it
|
|
@@ -27,16 +33,19 @@ export declare function builtInPackages(): Promise<ProjectPackage[]>;
|
|
|
27
33
|
/**
|
|
28
34
|
* The packages OpenAgent brings to the project at `root`: the ones every project has, and
|
|
29
35
|
* each picked one the project has by its rule (see {@link PICKED_PACKAGES}). Read off the
|
|
30
|
-
* project's files each time, so a skill written or deleted a moment ago counts at once.
|
|
36
|
+
* project's files each time, so a skill written or deleted a moment ago counts at once. None of
|
|
37
|
+
* the computer's: no project has those.
|
|
31
38
|
*/
|
|
32
39
|
export declare function builtInPackagesOf(root: string): Promise<ProjectPackage[]>;
|
|
33
40
|
/** The project's own installed packages, less the names OpenAgent brings itself. */
|
|
34
41
|
export declare function ownPackages(root: string): Promise<ProjectPackage[]>;
|
|
42
|
+
/** The packages that are this computer's: see {@link COMPUTER_PACKAGES}. */
|
|
43
|
+
export declare function computerPackages(): Promise<ProjectPackage[]>;
|
|
35
44
|
/**
|
|
36
|
-
* The services of the packages
|
|
45
|
+
* The services of the computer's packages: a package declares
|
|
37
46
|
* `"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
|
|
39
|
-
*
|
|
47
|
+
* runs (`package-services.ts`). Only those packages: a service is this computer's, and any
|
|
48
|
+
* other package is a project's.
|
|
40
49
|
*/
|
|
41
50
|
export declare function builtInServices(): Promise<ProvidedCommand[]>;
|
|
42
51
|
/** The directories the commands of OpenAgent's packages sit in: what a hook line's PATH gains after the project's own installed tools. */
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A project added by its repository's address, for a computer that does not have its folder: a
|
|
3
|
+
* server that was just connected has no screen to pick a folder on and no folder to pick. The
|
|
4
|
+
* repository is cloned into `~/projects/<its name>`, in the home of the user OpenAgent runs as,
|
|
5
|
+
* and that folder is then added like any other. Nothing is asked about where: the page says
|
|
6
|
+
* where it went.
|
|
7
|
+
*
|
|
8
|
+
* git clones with the logins this computer has (its credential helper, its SSH keys) and is
|
|
9
|
+
* never let ask a person for one: a repository it cannot read is refused in words.
|
|
10
|
+
*/
|
|
11
|
+
/** Where a repository is cloned from and to. */
|
|
12
|
+
export interface CloneTarget {
|
|
13
|
+
/** What git is given. */
|
|
14
|
+
url: string;
|
|
15
|
+
/** The repository's one name on every machine: see `addressOfRemote`. */
|
|
16
|
+
address: string;
|
|
17
|
+
/** The folder it is cloned into. */
|
|
18
|
+
path: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Read what a person typed as a repository's address: `github.com/you/shop`, the same with
|
|
22
|
+
* `https://` before it, `ssh://git@github.com/you/shop.git`, or `git@github.com:you/shop.git`.
|
|
23
|
+
* Undefined for anything else: a folder on this disk, another kind of address, a name that could
|
|
24
|
+
* be read as an option or lead out of the folder projects are cloned into.
|
|
25
|
+
*/
|
|
26
|
+
export declare function cloneTarget(typed: string, home?: string): CloneTarget | undefined;
|
|
27
|
+
/** How a clone went: the folder the project is in, and whether it was cloned now or was already there. */
|
|
28
|
+
export type Cloned = {
|
|
29
|
+
ok: true;
|
|
30
|
+
path: string;
|
|
31
|
+
cloned: boolean;
|
|
32
|
+
} | {
|
|
33
|
+
ok: false;
|
|
34
|
+
error: string;
|
|
35
|
+
};
|
|
36
|
+
/** Run git and answer how it ended, with what it said on its error side. */
|
|
37
|
+
export type CloneRunner = (args: readonly string[], env: NodeJS.ProcessEnv, timeoutMs: number) => Promise<{
|
|
38
|
+
ok: true;
|
|
39
|
+
} | {
|
|
40
|
+
ok: false;
|
|
41
|
+
said: string;
|
|
42
|
+
timedOut: boolean;
|
|
43
|
+
}>;
|
|
44
|
+
/** Where what a person typed would be cloned to, before anything is cloned: what the page shows to be confirmed. */
|
|
45
|
+
export declare function cloneTargetOf(typed: string, home?: string): {
|
|
46
|
+
ok: true;
|
|
47
|
+
address: string;
|
|
48
|
+
path: string;
|
|
49
|
+
} | {
|
|
50
|
+
ok: false;
|
|
51
|
+
error: string;
|
|
52
|
+
};
|
|
53
|
+
export interface CloneOptions {
|
|
54
|
+
home?: string;
|
|
55
|
+
run?: CloneRunner;
|
|
56
|
+
env?: NodeJS.ProcessEnv;
|
|
57
|
+
timeoutMs?: number;
|
|
58
|
+
/** The person's own way to SSH for git, when they set one; read off git's settings when unsaid. */
|
|
59
|
+
sshCommand?: (env: NodeJS.ProcessEnv) => Promise<string | undefined>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Clone the repository a person typed the address of into `~/projects/<its name>`. A folder that
|
|
63
|
+
* is already there and holds this very repository is taken as it is; one that holds anything
|
|
64
|
+
* else is never written over, and is refused. The clone is made beside that folder and moved
|
|
65
|
+
* there once it is whole: a clone that fails leaves nothing behind, and one on its way is no
|
|
66
|
+
* folder a second ask could take for the project.
|
|
67
|
+
*/
|
|
68
|
+
export declare function cloneProject(typed: string, opts?: CloneOptions): Promise<Cloned>;
|
|
@@ -3,8 +3,12 @@ import { type ProjectsProvider } from './projects.js';
|
|
|
3
3
|
import { type ProjectModule } from '../project-modules.js';
|
|
4
4
|
/** Where module files are served: `/_modules/<project id>/<package>/<file>`, each segment encoded. */
|
|
5
5
|
export declare const MODULES_PREFIX = "/_modules";
|
|
6
|
+
/** Where the files of the computer's modules are served, which are no project's: `/_computer-modules/<package>/<file>`. */
|
|
7
|
+
export declare const COMPUTER_MODULES_PREFIX = "/_computer-modules";
|
|
6
8
|
/** The URL a module's browser part is served at from one project. */
|
|
7
9
|
export declare function moduleUrl(projectId: string, module: Pick<ProjectModule, 'package' | 'entry'>): string;
|
|
10
|
+
/** The URL the browser part of one of the computer's modules is served at. */
|
|
11
|
+
export declare function computerModuleUrl(module: Pick<ProjectModule, 'package' | 'entry'>): string;
|
|
8
12
|
/**
|
|
9
13
|
* Serve one module file (#1774): the project must be registered, the package must be a module of
|
|
10
14
|
* that project, and the file must sit inside the module's browser part's own directory. Anything else is a
|
|
@@ -12,3 +16,5 @@ export declare function moduleUrl(projectId: string, module: Pick<ProjectModule,
|
|
|
12
16
|
* Served as `no-cache`, since a module is rebuilt in place under the same name.
|
|
13
17
|
*/
|
|
14
18
|
export declare function serveModuleFile(req: IncomingMessage, res: ServerResponse, pathname: string, projects?: ProjectsProvider): Promise<void>;
|
|
19
|
+
/** Serve one file of a module that is the computer's: as {@link serveModuleFile}, with no project to be registered. */
|
|
20
|
+
export declare function serveComputerModuleFile(req: IncomingMessage, res: ServerResponse, pathname: string): Promise<void>;
|
|
@@ -67,6 +67,15 @@ export interface DashboardContext {
|
|
|
67
67
|
* the mount, its only caller.
|
|
68
68
|
*/
|
|
69
69
|
export declare function isSameOriginRequest(req: IncomingMessage): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* The third guard: a call says its body is JSON. {@link isSameOriginRequest} lets every loopback
|
|
72
|
+
* origin pass, whatever its port, so a page another program serves on this computer (an app an
|
|
73
|
+
* agent previews, a dev server) is let through it. A browser sends such a page's POST without
|
|
74
|
+
* asking only while its content type is one a plain form can have, and JSON is none of them:
|
|
75
|
+
* with JSON it asks first, this server never says yes, and the call is not sent. So a call that
|
|
76
|
+
* is not JSON is refused, and no page of another origin can make one, not even blind.
|
|
77
|
+
*/
|
|
78
|
+
export declare function isJsonRequest(req: IncomingMessage): boolean;
|
|
70
79
|
/**
|
|
71
80
|
* DNS-rebinding guard, the other half of the CSRF check above. A page on `evil.com` whose DNS
|
|
72
81
|
* re-answers as `127.0.0.1` is *same-origin* with this server as far as the browser is concerned,
|
|
@@ -22,7 +22,8 @@ export type DeleteAgentResult = {
|
|
|
22
22
|
export type AddProjectResult = {
|
|
23
23
|
ok: true;
|
|
24
24
|
alreadyActivated: boolean;
|
|
25
|
-
noRemote?: true;
|
|
25
|
+
noRemote?: true; /** For a project added by its repository's address: the folder it is in. */
|
|
26
|
+
path?: string;
|
|
26
27
|
} | {
|
|
27
28
|
ok: false;
|
|
28
29
|
error: string;
|
|
@@ -56,10 +57,12 @@ export type RemoveProjectResult = {
|
|
|
56
57
|
* never discloses its filesystem layout.
|
|
57
58
|
*/
|
|
58
59
|
export interface OnboardingSuggestion {
|
|
59
|
-
/** The server's working directory, or null when it cannot be offered. */
|
|
60
|
+
/** The server's working directory, or null when it cannot be offered: the home folder is where a service runs, not a project. */
|
|
60
61
|
cwd: string | null;
|
|
61
62
|
/** The project id for {@link cwd} when it is already registered, else null. */
|
|
62
63
|
cwdProjectId: string | null;
|
|
64
|
+
/** Whether this computer can show a window to pick a folder in: one with no screen, as a server, cannot. */
|
|
65
|
+
canPickFolder: boolean;
|
|
63
66
|
}
|
|
64
67
|
/**
|
|
65
68
|
* What a Start carries besides its prompt (#1774): the person's picks, handed to the project's
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export { onAgents, onAgent, onAgentsDoing, onDocs, onQueue, onOverview, onRecentAgents, onInterventions, onOpenQuestions, onActivity, onDashboard, onGitHostHome, onRepositoryOffer, onGitStatus, onProjectFiles, onRetainedWorktrees, onAgentWorktree, onAgentHandoff, onBridgeQuestion, onBridgeStatus, onBridgeToken, onBridgeEvents, onBridgeAnswer, onBridgeBrowser } from './reads.js';
|
|
2
2
|
export { sendStop, sendChoice, sendBridgeAnswer, sendBridgeAnswerCancel, sendBridgeBrowser, sendMessage, sendStart, sendOpenInApp, sendRemoveWorktree, sendDeleteAgent, sendOpenPullRequest, sendPush, sendMergeBranch, sendMerge, sendCreateRepository } from './control.js';
|
|
3
3
|
export { streamAgentEvents, type LiveFeedEvent, type PartialMessage, type StreamSync } from './events.js';
|
|
4
|
-
export { onProjects, sendAddProject, sendRemoveProject, onRecordsReach, sendShareRecords, sendPickProjectDirectory, onOnboarding, onCommands, onStartCheck, type ProjectLauncher } from './projects.js';
|
|
4
|
+
export { onProjects, sendAddProject, onCloneTarget, sendAddProjectFromAddress, sendRemoveProject, onRecordsReach, sendShareRecords, sendPickProjectDirectory, onOnboarding, onCommands, onStartCheck, type ProjectLauncher } from './projects.js';
|
|
5
5
|
export { onPreferences, savePreferences, patchPreferences, onProjectPresets, saveProjectPresets, onEditors, type SavePreferencesResult, type PatchPreferencesResult, } from './preferences.js';
|
|
6
6
|
export { type EditorInfo } from '../dashboard/open-in-app.js';
|
|
7
7
|
export { onQuota } from './quota.js';
|
|
8
8
|
export { onModels } from './models.js';
|
|
9
9
|
export { onMachines, sendAddMachine, sendRemoveMachine, onMachinesReachable, onMachineVersions, type Machine, type AddMachineResult, type MachineVersions } from './machines.js';
|
|
10
|
-
export { onModules, runModuleCommand, readModule, type DashboardModule, type ModuleCommandResult, type ModuleReadResult } from './modules.js';
|
|
10
|
+
export { onModules, runModuleCommand, runComputerCommand, readModule, type DashboardModule, type ModuleCommandResult, type ModuleReadResult } from './modules.js';
|
|
11
11
|
export { onProjectSkills, sendChangeSkills, sendCommitSkills, type ProjectSkills, type ProjectSkill, type ChangeSkillsResult } from './skills.js';
|
|
12
12
|
import { streamAgentEvents } from './events.js';
|
|
13
13
|
/** One RPC: called with whatever the browser sent, answering with whatever JSON.stringify keeps. */
|
|
@@ -6,13 +6,14 @@ export type { ModuleReadResult } from '../dashboard/module-host.js';
|
|
|
6
6
|
export interface DashboardModule {
|
|
7
7
|
/** The package that brings it. */
|
|
8
8
|
package: string;
|
|
9
|
-
/** The URL of its browser module, served from the first project that has it. */
|
|
9
|
+
/** The URL of its browser module, served from the first project that has it, or from OpenAgent's own copy for one of the computer's. */
|
|
10
10
|
url: string;
|
|
11
|
-
/** The registered projects whose packages include it, in the registry's order. */
|
|
11
|
+
/** The registered projects whose packages include it, in the registry's order; none for one of the computer's, whose commands run in no project. */
|
|
12
12
|
projects: string[];
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
* Every module
|
|
15
|
+
* Every module the dashboard loads (#1774), one per package. First the computer's, which are
|
|
16
|
+
* there with no project added. Then every module any registered project brings, with the projects
|
|
16
17
|
* that have it: with no project picked the sidebar and the pages are every project's, and the
|
|
17
18
|
* dashboard narrows them itself to a picked project's. A package several projects install is loaded once, from
|
|
18
19
|
* the first of them in the registry's order; its page then reads each project through that
|
|
@@ -34,6 +35,13 @@ export declare function onModules(): Promise<DashboardModule[]>;
|
|
|
34
35
|
* write only at the next sync.
|
|
35
36
|
*/
|
|
36
37
|
export declare function runModuleCommand(projectId: string, pkg: string, args: string[], command?: string, acts?: boolean): Promise<ModuleCommandResult>;
|
|
38
|
+
/**
|
|
39
|
+
* Run one of the commands of a package that is this computer's, in no project, and answer its
|
|
40
|
+
* JSON output: how the door's page and the servers' page read and change what they keep, which is
|
|
41
|
+
* in the person's home folder, where the command runs. Refused for any other package: a project's
|
|
42
|
+
* module runs its commands in its project ({@link runModuleCommand}).
|
|
43
|
+
*/
|
|
44
|
+
export declare function runComputerCommand(pkg: string, args: string[], command?: string): Promise<ModuleCommandResult>;
|
|
37
45
|
/**
|
|
38
46
|
* Call read `name` of a module's server part in one project: how a module's browser part reads
|
|
39
47
|
* what a command cannot answer fast enough. Refused for an unknown project, a package that is not
|
|
@@ -15,6 +15,22 @@ export declare function onProjects(): Promise<ProjectSummary[]>;
|
|
|
15
15
|
* repository's remote. Nothing is pushed for a project added with `false`.
|
|
16
16
|
*/
|
|
17
17
|
export declare function sendAddProject(path: string, share: boolean): Promise<AddProjectResult>;
|
|
18
|
+
/** Where the repository a person typed the address of would be cloned to on this computer, or why what was typed is no address: asked before anything is cloned. */
|
|
19
|
+
export declare function onCloneTarget(address: string): Promise<{
|
|
20
|
+
ok: true;
|
|
21
|
+
address: string;
|
|
22
|
+
path: string;
|
|
23
|
+
} | {
|
|
24
|
+
ok: false;
|
|
25
|
+
error: string;
|
|
26
|
+
}>;
|
|
27
|
+
/**
|
|
28
|
+
* Add a project by its repository's address, for a computer that does not have its folder: the
|
|
29
|
+
* repository is cloned into `~/projects/<its name>` with the logins this computer has, and the
|
|
30
|
+
* folder is then added as {@link sendAddProject} adds one. A folder already there with this
|
|
31
|
+
* repository in it is added as it is. The answer says where the project is.
|
|
32
|
+
*/
|
|
33
|
+
export declare function sendAddProjectFromAddress(address: string, share: boolean): Promise<AddProjectResult>;
|
|
18
34
|
/**
|
|
19
35
|
* Remove a project from the dashboard: it leaves the Projects list. Nothing in its folder is
|
|
20
36
|
* deleted unless `files` is true: then what OpenAgent left there is removed too, and the answer
|
|
@@ -19,6 +19,8 @@ export type DialogRun = {
|
|
|
19
19
|
};
|
|
20
20
|
/** Injectable seam so tests never open a real dialog. */
|
|
21
21
|
export type DialogRunner = (command: string, args: string[]) => Promise<DialogRun>;
|
|
22
|
+
/** Whether this computer has a screen a folder dialog can open on: asked before one is offered. */
|
|
23
|
+
export declare function canPickDirectory(platform?: NodeJS.Platform, env?: NodeJS.ProcessEnv): boolean;
|
|
22
24
|
/**
|
|
23
25
|
* Open the OS folder picker and wait for the user's choice.
|
|
24
26
|
*
|
|
@@ -4,7 +4,8 @@ import { type PackageCommandResult } from '@openagt/agent-data';
|
|
|
4
4
|
* `exports["./dashboard"]`, and optionally its server part, named by `exports["./server"]`.
|
|
5
5
|
* Any dependency of the project that exports `./dashboard` is a module, whoever wrote it, and the
|
|
6
6
|
* packages OpenAgent brings itself come the same way, for the projects that have them
|
|
7
|
-
* (`built-in.ts`).
|
|
7
|
+
* (`built-in.ts`). A package that is this computer's is a module of no project: see
|
|
8
|
+
* {@link readComputerModules}.
|
|
8
9
|
*/
|
|
9
10
|
export interface ProjectModule {
|
|
10
11
|
/** The package's name. */
|
|
@@ -15,7 +16,7 @@ export interface ProjectModule {
|
|
|
15
16
|
dir: string;
|
|
16
17
|
/** The module's browser part's file name inside {@link dir}. */
|
|
17
18
|
entry: string;
|
|
18
|
-
/** The package's commands, by name, as absolute paths: what the module may run in this project. */
|
|
19
|
+
/** The package's commands, by name, as absolute paths: what the module may run, in this project or, for one of the computer's, in none. */
|
|
19
20
|
bins: Record<string, string>;
|
|
20
21
|
/** The module's server part, an absolute path inside the package, when it has one. */
|
|
21
22
|
server?: string;
|
|
@@ -29,6 +30,13 @@ export interface ProjectModule {
|
|
|
29
30
|
export declare function readProjectModules(root: string): Promise<ProjectModule[]>;
|
|
30
31
|
/** The one module of this project that `name` names, or undefined. */
|
|
31
32
|
export declare function findProjectModule(root: string, name: string): Promise<ProjectModule | undefined>;
|
|
33
|
+
/**
|
|
34
|
+
* The modules that are this computer's and no project's: the ones among the packages OpenAgent
|
|
35
|
+
* brings for the computer (`built-in.ts`). They are there with no project added. Sorted by name.
|
|
36
|
+
*/
|
|
37
|
+
export declare function readComputerModules(): Promise<ProjectModule[]>;
|
|
38
|
+
/** The one module of this computer's that `name` names, or undefined. */
|
|
39
|
+
export declare function findComputerModule(name: string): Promise<ProjectModule | undefined>;
|
|
32
40
|
/**
|
|
33
41
|
* The file a module serves at `rel`, a path relative to its module's directory: its module, its
|
|
34
42
|
* stylesheet, a chunk. `undefined` for a path that leaves that directory (symlinks resolved) or
|
|
@@ -43,7 +51,8 @@ export type ModuleCommandResult = PackageCommandResult;
|
|
|
43
51
|
* (`npx @openagt/skill-logs@0.1`), so the module and the agent see the same thing and OpenAgent knows neither.
|
|
44
52
|
*
|
|
45
53
|
* `command` picks one of the package's commands; a package with exactly one needs none. The
|
|
46
|
-
* command runs with Node (a package's commands are Node scripts), in the project
|
|
54
|
+
* command runs with Node (a package's commands are Node scripts), in `root` (the project's, or
|
|
55
|
+
* the person's home folder for a module of the computer's), never
|
|
47
56
|
* through a shell, bounded in time and output. Refused: a command the package does not have, too
|
|
48
57
|
* many or too long arguments. A command that exits non-zero answers its last stderr line; one that
|
|
49
58
|
* prints no JSON says so.
|
package/dist/pick-directory.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ export type DialogRun = {
|
|
|
19
19
|
};
|
|
20
20
|
/** Injectable seam so tests never open a real dialog. */
|
|
21
21
|
export type DialogRunner = (command: string, args: string[]) => Promise<DialogRun>;
|
|
22
|
+
/** Whether this computer has a screen a folder dialog can open on: asked before one is offered. */
|
|
23
|
+
export declare function canPickDirectory(platform?: NodeJS.Platform, env?: NodeJS.ProcessEnv): boolean;
|
|
22
24
|
/**
|
|
23
25
|
* Open the OS folder picker and wait for the user's choice.
|
|
24
26
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pick-directory.d.ts","sourceRoot":"","sources":["../src/pick-directory.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,kIAAkI;AAClI,MAAM,MAAM,mBAAmB,GAC3B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GACjC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAEhC,wDAAwD;AACxD,MAAM,MAAM,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAExE,yDAAyD;AACzD,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,SAAS,CAAC,CAAA;AA2ElF;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,QAAQ,GAAE,MAAM,CAAC,QAA2B,EAC5C,GAAG,GAAE,YAA+B,EACpC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,OAAO,CAAC,mBAAmB,CAAC,CAW9B"}
|
|
1
|
+
{"version":3,"file":"pick-directory.d.ts","sourceRoot":"","sources":["../src/pick-directory.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,kIAAkI;AAClI,MAAM,MAAM,mBAAmB,GAC3B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GACjC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAEhC,wDAAwD;AACxD,MAAM,MAAM,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAExE,yDAAyD;AACzD,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,SAAS,CAAC,CAAA;AA2ElF,mGAAmG;AACnG,wBAAgB,gBAAgB,CAAC,QAAQ,GAAE,MAAM,CAAC,QAA2B,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAG5H;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,QAAQ,GAAE,MAAM,CAAC,QAA2B,EAC5C,GAAG,GAAE,YAA+B,EACpC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,OAAO,CAAC,mBAAmB,CAAC,CAW9B"}
|
package/dist/pick-directory.js
CHANGED
|
@@ -61,6 +61,12 @@ const nodeDialogRunner = (command, args) => new Promise(done => {
|
|
|
61
61
|
done({ code: error ? exitCode(error) : 0, stdout: String(stdout), stderr: String(stderr) });
|
|
62
62
|
});
|
|
63
63
|
});
|
|
64
|
+
/** Whether this computer has a screen a folder dialog can open on: asked before one is offered. */
|
|
65
|
+
export function canPickDirectory(platform = process.platform, env = process.env) {
|
|
66
|
+
if (platform === 'darwin' || platform === 'win32')
|
|
67
|
+
return true;
|
|
68
|
+
return platform === 'linux' && Boolean(env.DISPLAY || env.WAYLAND_DISPLAY);
|
|
69
|
+
}
|
|
64
70
|
/**
|
|
65
71
|
* Open the OS folder picker and wait for the user's choice.
|
|
66
72
|
*
|
|
@@ -76,7 +82,7 @@ export async function pickDirectory(platform = process.platform, run = nodeDialo
|
|
|
76
82
|
if (platform === 'linux') {
|
|
77
83
|
// A dialog needs a screen to appear on, and a daemon started over SSH or inside a container has
|
|
78
84
|
// none — saying so beats spawning a helper that can only fail.
|
|
79
|
-
if (!
|
|
85
|
+
if (!canPickDirectory(platform, env))
|
|
80
86
|
return { ok: false, error: 'The machine running OpenAgent has no desktop session, so no folder dialog can open there.' };
|
|
81
87
|
return openDialog(linuxDialogs(env.HOME ?? '.'), run);
|
|
82
88
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pick-directory.js","sourceRoot":"","sources":["../src/pick-directory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA0B,MAAM,oBAAoB,CAAA;AAmBrE,gHAAgH;AAChH,MAAM,aAAa,GAAG,GAAG,CAAA;AAEzB,0HAA0H;AAC1H,MAAM,iBAAiB,GAAG,CAAC,CAAA;AAE3B,4DAA4D;AAC5D,MAAM,MAAM,GAAG,6CAA6C,CAAA;AAK5D,qFAAqF;AACrF,MAAM,SAAS,GAAW;IACxB,OAAO,EAAE,WAAW;IACpB,IAAI,EAAE,CAAC,IAAI,EAAE,6CAA6C,MAAM,IAAI,CAAC;IACrE,qGAAqG;IACrG,SAAS,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;CAC9C,CAAA;AAED;;;;GAIG;AACH,MAAM,aAAa,GAAW;IAC5B,OAAO,EAAE,gBAAgB;IACzB,IAAI,EAAE;QACJ,YAAY;QACZ,MAAM;QACN,UAAU;QACV;YACE,6CAA6C;YAC7C,+DAA+D;YAC/D,0BAA0B,MAAM,GAAG;YACnC,sCAAsC;YACtC,8GAA8G,iBAAiB,IAAI;SACpI,CAAC,IAAI,CAAC,IAAI,CAAC;KACb;IACD,SAAS,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,iBAAiB;CACjD,CAAA;AAED;;;;;;;;;GASG;AACH,SAAS,YAAY,CAAC,IAAY;IAChC,MAAM,SAAS,GAAG,CAAC,GAAc,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,CAAA;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