@openagt/dashboard 0.26.0 → 0.28.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/daemon-runtime.d.ts +4 -1
- package/dist/daemon-runtime.d.ts.map +1 -1
- package/dist/daemon-runtime.js +13 -1
- package/dist/daemon-runtime.js.map +1 -1
- package/dist/daemon.d.ts.map +1 -1
- package/dist/daemon.js +7 -2
- package/dist/daemon.js.map +1 -1
- package/dist/dashboard/copy-logins.d.ts +48 -0
- package/dist/dashboard/copy-logins.d.ts.map +1 -0
- package/dist/dashboard/copy-logins.js +113 -0
- package/dist/dashboard/copy-logins.js.map +1 -0
- package/dist/dashboard/machine-logins.d.ts +58 -0
- package/dist/dashboard/machine-logins.d.ts.map +1 -0
- package/dist/dashboard/machine-logins.js +60 -0
- package/dist/dashboard/machine-logins.js.map +1 -0
- package/dist/dashboard/person.d.ts +12 -0
- package/dist/dashboard/person.d.ts.map +1 -1
- package/dist/dashboard/person.js +21 -0
- package/dist/dashboard/person.js.map +1 -1
- package/dist/dashboard/relay-endpoints.d.ts +15 -0
- package/dist/dashboard/relay-endpoints.d.ts.map +1 -1
- package/dist/dashboard/relay-endpoints.js +36 -0
- package/dist/dashboard/relay-endpoints.js.map +1 -1
- package/dist/dashboard/remote-run.d.ts +75 -0
- package/dist/dashboard/remote-run.d.ts.map +1 -1
- package/dist/dashboard/remote-run.js +125 -1
- package/dist/dashboard/remote-run.js.map +1 -1
- package/dist/dashboard/rpc-serve.d.ts.map +1 -1
- package/dist/dashboard/rpc-serve.js +2 -1
- package/dist/dashboard/rpc-serve.js.map +1 -1
- package/dist/dashboard/server.d.ts +2 -0
- package/dist/dashboard/server.d.ts.map +1 -1
- package/dist/dashboard/server.js +1 -1
- package/dist/dashboard/server.js.map +1 -1
- package/dist/dashboard-bundle/assets/main-BenA3DC-.js +145 -0
- package/dist/dashboard-bundle/assets/main-KUO4ZuZ3.css +2 -0
- package/dist/dashboard-bundle/assets/module-CZzF8pLL.js +14 -0
- 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/machines.d.ts +91 -1
- package/dist/dashboard-rpc/machines.d.ts.map +1 -1
- package/dist/dashboard-rpc/machines.js +131 -8
- package/dist/dashboard-rpc/machines.js.map +1 -1
- package/dist/dashboard-rpc/modules.d.ts +14 -2
- package/dist/dashboard-rpc/modules.d.ts.map +1 -1
- package/dist/dashboard-rpc/modules.js +29 -4
- package/dist/dashboard-rpc/modules.js.map +1 -1
- package/dist/dashboard-rpc/person.d.ts +1 -1
- package/dist/dashboard-rpc/person.d.ts.map +1 -1
- package/dist/dashboard-rpc/person.js +3 -3
- package/dist/dashboard-rpc/person.js.map +1 -1
- package/dist/module-types/dashboard/components/InviteDialog.d.ts +25 -3
- package/dist/module-types/dashboard/lib/machines.d.ts +4 -0
- package/dist/module-types/dashboard/module/index.d.ts +54 -2
- package/dist/module-types/dashboard/rpc/machines.d.ts +9 -1
- package/dist/module-types/dashboard/rpc/modules.d.ts +2 -1
- package/dist/module-types/src/dashboard/machine-logins.d.ts +57 -0
- package/dist/module-types/src/dashboard/person.d.ts +12 -0
- package/dist/module-types/src/dashboard/remote-run.d.ts +75 -0
- package/dist/module-types/src/dashboard-rpc/index.d.ts +2 -2
- package/dist/module-types/src/dashboard-rpc/machines.d.ts +91 -1
- package/dist/module-types/src/dashboard-rpc/modules.d.ts +14 -2
- package/dist/module-types/src/dashboard-rpc/person.d.ts +1 -1
- package/dist/module-types/src/package-services.d.ts +6 -0
- package/dist/module-types/src/project-modules.d.ts +3 -1
- package/dist/module-types/src/registry.d.ts +13 -0
- package/dist/package-services.d.ts +6 -0
- package/dist/package-services.d.ts.map +1 -1
- package/dist/package-services.js +12 -1
- package/dist/package-services.js.map +1 -1
- package/dist/project-modules.d.ts +3 -1
- package/dist/project-modules.d.ts.map +1 -1
- package/dist/project-modules.js +4 -2
- package/dist/project-modules.js.map +1 -1
- package/dist/registry.d.ts +13 -0
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +20 -2
- package/dist/registry.js.map +1 -1
- package/package.json +14 -14
- package/dist/dashboard-bundle/assets/main-CTqah6if.js +0 -145
- package/dist/dashboard-bundle/assets/main-iqtcpdTX.css +0 -2
- package/dist/dashboard-bundle/assets/module-Dy8zK3Qd.js +0 -14
|
@@ -13,10 +13,32 @@ export type InviteAnswer = {
|
|
|
13
13
|
ok: false;
|
|
14
14
|
error: string;
|
|
15
15
|
};
|
|
16
|
-
|
|
16
|
+
/** How the dialog learns and names the computer's owner, for a code made for someone else. */
|
|
17
|
+
export interface InvitePersons {
|
|
18
|
+
/** The owner's GitHub account, once named. */
|
|
19
|
+
owner: string | undefined;
|
|
20
|
+
/** The GitHub account this computer is logged in to: who the owner would be. */
|
|
21
|
+
whoAmI: () => Promise<{
|
|
22
|
+
ok: true;
|
|
23
|
+
account: string;
|
|
24
|
+
} | {
|
|
25
|
+
ok: false;
|
|
26
|
+
error: string;
|
|
27
|
+
}>;
|
|
28
|
+
/** Name the owner, once. */
|
|
29
|
+
nameOwner: (account: string) => Promise<{
|
|
30
|
+
ok: true;
|
|
31
|
+
} | {
|
|
32
|
+
ok: false;
|
|
33
|
+
error: string;
|
|
34
|
+
}>;
|
|
35
|
+
}
|
|
36
|
+
export declare function InviteDialog({ title, ask, persons, scan, note, openHere, joined, onCode, onClose, }: {
|
|
17
37
|
title: string;
|
|
18
|
-
/** Asks for a new code: as the dialog opens, and on each "New code". */
|
|
19
|
-
ask: () => Promise<InviteAnswer>;
|
|
38
|
+
/** Asks for a new code, for `person` when it is for someone else: as the dialog opens (or once it knows who it is for), and on each "New code". */
|
|
39
|
+
ask: (person?: string) => Promise<InviteAnswer>;
|
|
40
|
+
/** Given, the dialog first asks who the code is for. */
|
|
41
|
+
persons?: InvitePersons;
|
|
20
42
|
/** What the person does with the code: "Scan it with the phone's camera…". */
|
|
21
43
|
scan: string;
|
|
22
44
|
/** A line under the link, for what else the link is good for. */
|
|
@@ -4,6 +4,10 @@ export type { Machine };
|
|
|
4
4
|
export declare function refreshMachines(): Promise<void>;
|
|
5
5
|
/** Save the machine a pasted link names; the list is read again once the daemon has it. */
|
|
6
6
|
export declare function addMachine(pasted: string, label?: string): Promise<AddMachineResult>;
|
|
7
|
+
/** Save a computer that keeps a line open to a saved server, reached through it; the list is read again once the daemon has it. */
|
|
8
|
+
export declare function addComputerThrough(machineId: string, computerId: string): Promise<AddMachineResult>;
|
|
9
|
+
/** Say the person was told their logins are copied to another person's computer; the list is read again once the daemon has it. */
|
|
10
|
+
export declare function tellMachine(id: string): Promise<void>;
|
|
7
11
|
/**
|
|
8
12
|
* Take a saved machine off the list, and answer whether the daemon did, with its reason when it
|
|
9
13
|
* did not. The list is read again either way, so a machine the daemon did not remove is still shown.
|
|
@@ -333,6 +333,12 @@ export interface ModuleHost {
|
|
|
333
333
|
* its page reads and changes it with no project added. Refused for any other package.
|
|
334
334
|
*/
|
|
335
335
|
runComputerCommand(args: string[], command?: string): Promise<ModuleCommandResult>;
|
|
336
|
+
/**
|
|
337
|
+
* The same, on a saved machine whose package of the same name is that computer's: what the
|
|
338
|
+
* package keeps over there, read and changed with this computer's key there, as that machine's
|
|
339
|
+
* own page would. Not for a computer reached through a server.
|
|
340
|
+
*/
|
|
341
|
+
runComputerCommandOn(machineId: string, args: string[], command?: string): Promise<ModuleCommandResult>;
|
|
336
342
|
/**
|
|
337
343
|
* Call one of the module's own server reads (its package's `./server`) in one project, with
|
|
338
344
|
* `input`, a JSON object; `input.agentId` names the run the read is about, when it is about one.
|
|
@@ -376,6 +382,21 @@ export interface ModuleHost {
|
|
|
376
382
|
* there stops working. Refused, with the reason, while a run is at work there.
|
|
377
383
|
*/
|
|
378
384
|
removeMachine(id: string): Promise<MachineRemoved>;
|
|
385
|
+
/**
|
|
386
|
+
* The computers that keep a line open to a saved server: computers at home a run can be sent to
|
|
387
|
+
* through the server, and whether each is saved here already. None for a machine that is no server.
|
|
388
|
+
*/
|
|
389
|
+
computersThrough(machineId: string): Promise<ModuleComputersThrough>;
|
|
390
|
+
/** Save one of them as a machine of its own, reached through the server: it is in "Run on" from then on. */
|
|
391
|
+
addComputerThrough(machineId: string, computerId: string): Promise<MachineAdded>;
|
|
392
|
+
/**
|
|
393
|
+
* What a saved machine's door says of the person this computer is in as there, on a computer
|
|
394
|
+
* several people use: their GitHub account, whether they are its owner, and their devices. What
|
|
395
|
+
* it said is another computer's data, to read as such; `unknown` for a machine that does not say.
|
|
396
|
+
*/
|
|
397
|
+
machinePerson(machineId: string): Promise<ModuleMachinePerson>;
|
|
398
|
+
/** Take one of that person's devices out at the machine, by its id there; answers as {@link machinePerson} does, after. */
|
|
399
|
+
removeMachineDevice(machineId: string, deviceId: string): Promise<ModuleMachinePerson>;
|
|
379
400
|
/**
|
|
380
401
|
* What the live screen of a run shows, as the screen's own stream of bytes, until `signal` ends
|
|
381
402
|
* it; nothing when the run has no live screen. OpenAgent asks the computer the run is on, which
|
|
@@ -395,6 +416,8 @@ export interface ModuleMachine {
|
|
|
395
416
|
version?: string;
|
|
396
417
|
/** The id the machine lists this computer under, among the devices that are in there. */
|
|
397
418
|
device?: string;
|
|
419
|
+
/** Whose computer it is, by their GitHub account, when it is another person's shared with everyone on a server. */
|
|
420
|
+
owner?: string;
|
|
398
421
|
}
|
|
399
422
|
/** What {@link ModuleHost.machines} answers. */
|
|
400
423
|
export interface ModuleMachines {
|
|
@@ -409,6 +432,35 @@ export type MachineAdded = {
|
|
|
409
432
|
ok: false;
|
|
410
433
|
error: string;
|
|
411
434
|
};
|
|
435
|
+
/** A computer that keeps a line open to a saved server, as {@link ModuleHost.computersThrough} answers it. */
|
|
436
|
+
export interface ModuleComputerThrough {
|
|
437
|
+
/** The server's id for it. */
|
|
438
|
+
id: string;
|
|
439
|
+
name: string;
|
|
440
|
+
/** Its line is open right now. */
|
|
441
|
+
online: boolean;
|
|
442
|
+
/** It is saved here, through the server. */
|
|
443
|
+
added: boolean;
|
|
444
|
+
/** Whose computer it is, when it is another person's that keeps its line there for everyone. */
|
|
445
|
+
owner?: string;
|
|
446
|
+
}
|
|
447
|
+
/** What {@link ModuleHost.computersThrough} answers. */
|
|
448
|
+
export type ModuleComputersThrough = {
|
|
449
|
+
ok: true;
|
|
450
|
+
computers: ModuleComputerThrough[];
|
|
451
|
+
} | {
|
|
452
|
+
ok: false;
|
|
453
|
+
error: string;
|
|
454
|
+
};
|
|
455
|
+
/** What {@link ModuleHost.machinePerson} answers: what the machine's door said, or why there is nothing. */
|
|
456
|
+
export type ModuleMachinePerson = {
|
|
457
|
+
ok: true;
|
|
458
|
+
said: unknown;
|
|
459
|
+
} | {
|
|
460
|
+
ok: false;
|
|
461
|
+
error: string;
|
|
462
|
+
unknown?: true;
|
|
463
|
+
};
|
|
412
464
|
/** How removing a machine went: done, or refused, with the reason. */
|
|
413
465
|
export type MachineRemoved = {
|
|
414
466
|
ok: true;
|
|
@@ -417,7 +469,7 @@ export type MachineRemoved = {
|
|
|
417
469
|
error: string;
|
|
418
470
|
};
|
|
419
471
|
/** What the dashboard knows about the module it is serving: every service but the commands and the reads, which it binds to the package. */
|
|
420
|
-
export type ModuleHostBase = Omit<ModuleHost, 'runCommand' | 'act' | 'runComputerCommand' | 'read'>;
|
|
472
|
+
export type ModuleHostBase = Omit<ModuleHost, 'runCommand' | 'act' | 'runComputerCommand' | 'runComputerCommandOn' | 'read'>;
|
|
421
473
|
/**
|
|
422
474
|
* The host for one module: the dashboard's services, and its commands bound to the module's own
|
|
423
475
|
* package. `acts` marks every command as an action on the project rather than a page's read: the
|
|
@@ -463,7 +515,7 @@ export { cn } from '../lib/utils.js';
|
|
|
463
515
|
export { SettingsSection, SettingsRow, SettingsSelectRow, type SettingsOption } from '../components/SettingsRows.js';
|
|
464
516
|
export { QrCode } from '../components/QrCode.js';
|
|
465
517
|
export { AddMachineDialog } from '../components/AddMachineDialog.js';
|
|
466
|
-
export { InviteDialog, type InviteCode, type InviteAnswer } from '../components/InviteDialog.js';
|
|
518
|
+
export { InviteDialog, type InviteCode, type InviteAnswer, type InvitePersons } from '../components/InviteDialog.js';
|
|
467
519
|
export { Dialog } from '../components/ui/dialog.js';
|
|
468
520
|
export { reachedByLine } from '../../src/client.js';
|
|
469
521
|
export { useCodingAgents, type CodingAgent } from '../lib/models.js';
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import type * as impl from '../../src/dashboard-rpc/machines.js';
|
|
2
2
|
export type * from '../../src/dashboard-rpc/machines.js';
|
|
3
3
|
export declare const onMachines: () => Promise<impl.Machine[]>;
|
|
4
|
-
export declare const sendAddMachine: (pasted: string, label?: string | undefined) => Promise<impl.AddMachineResult>;
|
|
4
|
+
export declare const sendAddMachine: (pasted: string, label?: string | undefined, owner?: string | undefined) => Promise<impl.AddMachineResult>;
|
|
5
5
|
export declare const sendRemoveMachine: (id: string) => Promise<impl.RemoveMachineResult>;
|
|
6
6
|
export declare const onMachinesReachable: () => Promise<Record<string, boolean>>;
|
|
7
7
|
export declare const onMachineVersions: () => Promise<impl.MachineVersions>;
|
|
8
8
|
export declare const sendProjectToMachine: (projectId: string, machineId: string) => Promise<impl.ProjectOnMachine>;
|
|
9
9
|
export declare const onProjectOnMachine: (projectId: string, machineId: string) => Promise<impl.ProjectOnMachine>;
|
|
10
|
+
export declare const onComputersThrough: (machineId: string) => Promise<impl.ComputersThrough>;
|
|
11
|
+
export declare const sendAddComputerThrough: (machineId: string, computerId: string) => Promise<impl.AddMachineResult>;
|
|
12
|
+
export declare const onMachinePerson: (machineId: string) => Promise<impl.MachinePerson>;
|
|
13
|
+
export declare const sendRemoveMachineDevice: (machineId: string, deviceId: string) => Promise<impl.MachinePerson>;
|
|
14
|
+
export declare const sendMachineTold: (machineId: string) => Promise<{
|
|
15
|
+
ok: boolean;
|
|
16
|
+
}>;
|
|
17
|
+
export declare const onMachineLogins: (machineId: string) => Promise<impl.MachineLoginsResult>;
|
|
@@ -2,5 +2,6 @@ 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
|
+
export declare const runComputerCommand: (pkg: string, args: string[], command?: string | null | undefined, input?: string | null | undefined) => Promise<import("@openagt/agent-data").PackageCommandResult>;
|
|
6
|
+
export declare const runComputerCommandOn: (pkg: string, machineId: string, args: string[], command?: string | null | undefined, input?: string | null | undefined) => Promise<import("@openagt/agent-data").PackageCommandResult>;
|
|
6
7
|
export declare const readModule: (projectId: string, pkg: string, name: string, input: unknown) => Promise<impl.ModuleReadResult>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A person's logins on another person's computer (#2140). That computer gives each person who
|
|
3
|
+
* starts a run on it a user and an OpenAgent of their own, and a run there uses that person's own
|
|
4
|
+
* GitHub and Claude logins. They reach it as copies: the person's own OpenAgent on the server
|
|
5
|
+
* both computers are in at copies its logins there, the first time it starts a run there. A
|
|
6
|
+
* person may make a login of their own there instead, and a copy never takes its place.
|
|
7
|
+
*
|
|
8
|
+
* What a computer says of a login there is only whose it is, where it came from and a mark of it:
|
|
9
|
+
* the start of its SHA-256, by which the copier tells whether the copy is still its own login.
|
|
10
|
+
* The login itself is never said. The marks are the servers package's (`own.ts`), made the same way.
|
|
11
|
+
*/
|
|
12
|
+
/** One login there, as that computer says it. */
|
|
13
|
+
export interface LoginThere {
|
|
14
|
+
/** GitHub: the account. */
|
|
15
|
+
account?: string;
|
|
16
|
+
/** A copy from the person's own OpenAgent on a server, or one the person made there. */
|
|
17
|
+
source: 'copied' | 'made';
|
|
18
|
+
/** For a copy: the server it came from. */
|
|
19
|
+
from?: string;
|
|
20
|
+
mark?: string;
|
|
21
|
+
}
|
|
22
|
+
/** The person's logins on that computer: each one it has. */
|
|
23
|
+
export interface MachineLogins {
|
|
24
|
+
github?: LoginThere;
|
|
25
|
+
claude?: LoginThere;
|
|
26
|
+
}
|
|
27
|
+
/** Logins handed to that computer: each as its own word, with the server they are copies from, when they are. */
|
|
28
|
+
export interface GivenLogins {
|
|
29
|
+
github?: string;
|
|
30
|
+
claude?: string;
|
|
31
|
+
from?: string;
|
|
32
|
+
}
|
|
33
|
+
export declare const isMark: (value: unknown) => value is string;
|
|
34
|
+
/** A server's name as a copied login says where it came from: its host or its address. */
|
|
35
|
+
export declare const isServerName: (value: unknown) => value is string;
|
|
36
|
+
/** A login as it is handed over: letters, digits and the few marks a token is written with, nothing a line could break on. */
|
|
37
|
+
export declare const isLoginWord: (value: unknown) => value is string;
|
|
38
|
+
/** A login's mark: the start of its SHA-256. */
|
|
39
|
+
export declare function markOf(login: string): string;
|
|
40
|
+
/** What another computer said of the logins there, as far as it reads as such: it is another computer's data. */
|
|
41
|
+
export declare function readLogins(value: unknown): MachineLogins;
|
|
42
|
+
/**
|
|
43
|
+
* The servers package's `own` answer of a person's own OpenAgent, as that computer says it: each
|
|
44
|
+
* login that is there, a copy when it names the server it came from.
|
|
45
|
+
*/
|
|
46
|
+
export declare function loginsOfOwn(said: unknown): MachineLogins;
|
|
47
|
+
/**
|
|
48
|
+
* Which of this OpenAgent's own logins go to that computer: one it has none of, and one it has a
|
|
49
|
+
* copy of that is no longer this one. Never one the person made there.
|
|
50
|
+
*/
|
|
51
|
+
export declare function loginsToCopy(own: {
|
|
52
|
+
github?: string;
|
|
53
|
+
claude?: string;
|
|
54
|
+
}, there: MachineLogins): {
|
|
55
|
+
github?: string;
|
|
56
|
+
claude?: string;
|
|
57
|
+
};
|
|
@@ -13,6 +13,18 @@ export interface Person {
|
|
|
13
13
|
/** A picture of them: an https address. */
|
|
14
14
|
avatar?: string;
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Who a call came from, when the door in front of OpenAgent says (remote-access): the GitHub
|
|
18
|
+
* account of the person whose device made it. Said only on a computer several persons use.
|
|
19
|
+
*/
|
|
20
|
+
export declare const PERSON_HEADER = "x-openagent-person";
|
|
21
|
+
/** Run `call` as one a person's device made, by their GitHub account, when the request said one. */
|
|
22
|
+
export declare function asCaller<T>(header: string | string[] | undefined, call: () => Promise<T>): Promise<T>;
|
|
23
|
+
/**
|
|
24
|
+
* The person at the page: the one this computer knows, or, for a call another person's device
|
|
25
|
+
* made, that person by their GitHub account and its picture.
|
|
26
|
+
*/
|
|
27
|
+
export declare function personAtPage(own: Person, account?: string | undefined): Person;
|
|
16
28
|
/** `projects` are the listed projects' folders, in the list's order. */
|
|
17
29
|
export declare function readPerson(deps: {
|
|
18
30
|
projects: () => Promise<string[]>;
|
|
@@ -2,6 +2,7 @@ import { EventStream } from '../event-stream.js';
|
|
|
2
2
|
import type { OpenAgentEvent } from '../events.js';
|
|
3
3
|
import type { AgentMeta } from '../store/index.js';
|
|
4
4
|
import type { StartAgentOptions, StartAgentResult } from './types.js';
|
|
5
|
+
import { type GivenLogins, type MachineLogins } from './machine-logins.js';
|
|
5
6
|
/**
|
|
6
7
|
* The server-side half of "run on a saved machine" (#1067). The local daemon holds this computer's
|
|
7
8
|
* key on the saved machine, so it - not the browser - drives the remote daemon: it POSTs the agent to the
|
|
@@ -87,6 +88,29 @@ export declare function deviceIdOf(key: string): string | undefined;
|
|
|
87
88
|
export declare function leaveRemote(machine: MachineAccess & {
|
|
88
89
|
door: string;
|
|
89
90
|
}): Promise<boolean>;
|
|
91
|
+
/**
|
|
92
|
+
* Where a server's door passes a call down the line of a computer that keeps one open there: a
|
|
93
|
+
* computer at home that nothing on a network reaches is asked at this address, through the
|
|
94
|
+
* server, with this computer's key at the server. To this computer it is one more machine.
|
|
95
|
+
*/
|
|
96
|
+
export declare const THROUGH_PATH = "/_remote-access/via/";
|
|
97
|
+
/** A computer that keeps a line open to a server, as the server's door lists it. */
|
|
98
|
+
export interface ComputerOnServer {
|
|
99
|
+
id: string;
|
|
100
|
+
name: string;
|
|
101
|
+
/** Its line is open right now. */
|
|
102
|
+
online: boolean;
|
|
103
|
+
/** Whose computer it is, when it is another person's that keeps its line there for everyone: their GitHub account. */
|
|
104
|
+
owner?: string;
|
|
105
|
+
}
|
|
106
|
+
/** The computers that keep a line open to a server this computer is in at, or why they could not be asked. */
|
|
107
|
+
export declare function remoteComputers(machine: MachineAccess): Promise<{
|
|
108
|
+
ok: true;
|
|
109
|
+
computers: ComputerOnServer[];
|
|
110
|
+
} | {
|
|
111
|
+
ok: false;
|
|
112
|
+
error: string;
|
|
113
|
+
}>;
|
|
90
114
|
/**
|
|
91
115
|
* Start an agent on the remote daemon, in its project cloned from `target.project`, and return
|
|
92
116
|
* what it answered (with the remote's own run id). A non-2xx or a transport failure surfaces as an
|
|
@@ -209,3 +233,54 @@ export declare class RelayedAgents {
|
|
|
209
233
|
* diary yields: the agent's session id, its cost, its end.
|
|
210
234
|
*/
|
|
211
235
|
export declare function foldRelayedEvent(meta: AgentMeta, event: OpenAgentEvent, at: string): AgentMeta;
|
|
236
|
+
/**
|
|
237
|
+
* Run one of a computer package's own commands on a machine, as that machine's own page runs it:
|
|
238
|
+
* a module on this computer reads and changes what the same package keeps over there. `input` is
|
|
239
|
+
* what the command reads on standard input there; it travels in the call's body, never in an
|
|
240
|
+
* address. The machine answers as its page is answered.
|
|
241
|
+
*/
|
|
242
|
+
export declare function remoteComputerCommand(machine: MachineAccess, pkg: string, args: readonly string[], command?: string, input?: string): Promise<{
|
|
243
|
+
ok: true;
|
|
244
|
+
output: unknown;
|
|
245
|
+
} | {
|
|
246
|
+
ok: false;
|
|
247
|
+
error: string;
|
|
248
|
+
}>;
|
|
249
|
+
/** The logins this computer's person has on a machine of another person's, as that machine says (machine-logins.ts). */
|
|
250
|
+
export declare function remoteLogins(machine: MachineAccess): Promise<{
|
|
251
|
+
ok: true;
|
|
252
|
+
logins: MachineLogins;
|
|
253
|
+
} | {
|
|
254
|
+
ok: false;
|
|
255
|
+
error: string;
|
|
256
|
+
}>;
|
|
257
|
+
/** Hand logins over to this computer's person on a machine of another person's; answers what it says of them after. */
|
|
258
|
+
export declare function giveRemoteLogins(machine: MachineAccess, given: GivenLogins): Promise<{
|
|
259
|
+
ok: true;
|
|
260
|
+
logins: MachineLogins;
|
|
261
|
+
} | {
|
|
262
|
+
ok: false;
|
|
263
|
+
error: string;
|
|
264
|
+
}>;
|
|
265
|
+
/** What a machine's door is asked about this computer's person there: who they are and their devices, one of those devices out, or a link for this computer's line. */
|
|
266
|
+
export type DoorAsk = {
|
|
267
|
+
what: 'me';
|
|
268
|
+
} | {
|
|
269
|
+
what: 'remove';
|
|
270
|
+
id: string;
|
|
271
|
+
} | {
|
|
272
|
+
what: 'line';
|
|
273
|
+
};
|
|
274
|
+
/**
|
|
275
|
+
* Ask a machine's door about the person this computer is in as there: the door answers it
|
|
276
|
+
* itself, from its own file, and passes nothing on to the OpenAgent behind it. Answers what the
|
|
277
|
+
* door said, as it said it: the caller reads it as the data of another computer.
|
|
278
|
+
*/
|
|
279
|
+
export declare function remoteDoor(machine: MachineAccess, ask: DoorAsk): Promise<{
|
|
280
|
+
ok: true;
|
|
281
|
+
said: unknown;
|
|
282
|
+
} | {
|
|
283
|
+
ok: false;
|
|
284
|
+
error: string;
|
|
285
|
+
unknown?: true;
|
|
286
|
+
}>;
|
|
@@ -6,8 +6,8 @@ export { onPreferences, savePreferences, patchPreferences, onProjectPresets, sav
|
|
|
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
|
-
export { onMachines, sendAddMachine, sendRemoveMachine, onMachinesReachable, onMachineVersions, sendProjectToMachine, onProjectOnMachine, type Machine, type AddMachineResult, type MachineVersions, type ProjectOnMachine } from './machines.js';
|
|
10
|
-
export { onModules, runModuleCommand, runComputerCommand, readModule, type DashboardModule, type ModuleCommandResult, type ModuleReadResult } from './modules.js';
|
|
9
|
+
export { onMachines, sendAddMachine, sendRemoveMachine, onMachinesReachable, onMachineVersions, sendProjectToMachine, onProjectOnMachine, onComputersThrough, sendAddComputerThrough, onMachinePerson, sendRemoveMachineDevice, sendMachineLineLink, sendMachineTold, onMachineLogins, sendMachineLogins, type Machine, type MachineLoginsResult, type AddMachineResult, type MachineVersions, type ProjectOnMachine, type ComputersThrough, type MachinePerson } from './machines.js';
|
|
10
|
+
export { onModules, runModuleCommand, runComputerCommand, runComputerCommandOn, readModule, type DashboardModule, type ModuleCommandResult, type ModuleReadResult } from './modules.js';
|
|
11
11
|
export { onProjectSkills, sendChangeSkills, sendProjectSkills, type ProjectSkills, type ProjectSkill, type ChangeSkillsResult } from './skills.js';
|
|
12
12
|
export { onPerson, type Person } from './person.js';
|
|
13
13
|
import { streamAgentEvents } from './events.js';
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import { type MachineLogins } from '../dashboard/machine-logins.js';
|
|
1
2
|
/** A saved machine as the browser sees it: no key. */
|
|
2
3
|
export interface Machine {
|
|
3
4
|
id: string;
|
|
4
5
|
label: string;
|
|
5
6
|
url: string;
|
|
7
|
+
/** Whose computer it is, when it is another person's: a run there uses this person's own logins, copied there. */
|
|
8
|
+
owner?: string;
|
|
9
|
+
/** The person was told so, once. */
|
|
10
|
+
told?: true;
|
|
6
11
|
}
|
|
7
12
|
export type AddMachineResult = {
|
|
8
13
|
ok: true;
|
|
@@ -18,8 +23,11 @@ export declare function onMachines(): Promise<Machine[]>;
|
|
|
18
23
|
* computer is let in there with the link's code, once, and keeps the key it is answered. Adding
|
|
19
24
|
* a machine again, with a new link, replaces its name and the key, and the key it had there
|
|
20
25
|
* before is taken out.
|
|
26
|
+
*
|
|
27
|
+
* `owner` is said for a computer of another person's that keeps a line to this server for
|
|
28
|
+
* everyone: the door says whose it is when it tells this OpenAgent of it.
|
|
21
29
|
*/
|
|
22
|
-
export declare function sendAddMachine(pasted: string, label?: string): Promise<AddMachineResult>;
|
|
30
|
+
export declare function sendAddMachine(pasted: string, label?: string, owner?: string): Promise<AddMachineResult>;
|
|
23
31
|
export type RemoveMachineResult = {
|
|
24
32
|
ok: true;
|
|
25
33
|
} | {
|
|
@@ -33,6 +41,88 @@ export type RemoveMachineResult = {
|
|
|
33
41
|
* removed there, among its devices.
|
|
34
42
|
*/
|
|
35
43
|
export declare function sendRemoveMachine(id: string): Promise<RemoveMachineResult>;
|
|
44
|
+
/** A computer that keeps a line open to a saved server, and whether it is saved here, through that server. */
|
|
45
|
+
export interface ComputerThrough {
|
|
46
|
+
id: string;
|
|
47
|
+
name: string;
|
|
48
|
+
online: boolean;
|
|
49
|
+
added: boolean;
|
|
50
|
+
/** Whose computer it is, when it is another person's that keeps its line there for everyone. */
|
|
51
|
+
owner?: string;
|
|
52
|
+
}
|
|
53
|
+
export type ComputersThrough = {
|
|
54
|
+
ok: true;
|
|
55
|
+
computers: ComputerThrough[];
|
|
56
|
+
} | {
|
|
57
|
+
ok: false;
|
|
58
|
+
error: string;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* The computers that keep a line open to a saved server: computers at home that a run can be
|
|
62
|
+
* sent to through the server, from here, as the server's own page does. None for a machine that
|
|
63
|
+
* is no server, and for one saved through a server.
|
|
64
|
+
*/
|
|
65
|
+
export declare function onComputersThrough(machineId: string): Promise<ComputersThrough>;
|
|
66
|
+
/**
|
|
67
|
+
* Save a computer that keeps a line open to a saved server, as a machine of its own: reached
|
|
68
|
+
* through the server, with this computer's key there. Nothing is entered anywhere: the server
|
|
69
|
+
* already lets this computer in, and passes its calls down the computer's line.
|
|
70
|
+
*/
|
|
71
|
+
export declare function sendAddComputerThrough(machineId: string, computerId: string): Promise<AddMachineResult>;
|
|
72
|
+
/** Write down that the person was told their logins are copied to a saved machine of another person's: the page says it once. */
|
|
73
|
+
export declare function sendMachineTold(machineId: string): Promise<{
|
|
74
|
+
ok: boolean;
|
|
75
|
+
}>;
|
|
76
|
+
export type MachineLoginsResult = {
|
|
77
|
+
ok: true;
|
|
78
|
+
logins: MachineLogins;
|
|
79
|
+
} | {
|
|
80
|
+
ok: false;
|
|
81
|
+
error: string;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* This person's logins on a saved machine of another person's, as that machine says: copied from
|
|
85
|
+
* a server, or made there. Read through the server when the machine is reached through one.
|
|
86
|
+
*/
|
|
87
|
+
export declare function onMachineLogins(machineId: string): Promise<MachineLoginsResult>;
|
|
88
|
+
/**
|
|
89
|
+
* Hand this person's own logins to a saved machine of another person's: the person made them for
|
|
90
|
+
* it, here, so they are no copies, and no server's copy takes their place later.
|
|
91
|
+
*/
|
|
92
|
+
export declare function sendMachineLogins(machineId: string, given: {
|
|
93
|
+
github?: unknown;
|
|
94
|
+
claude?: unknown;
|
|
95
|
+
}): Promise<MachineLoginsResult>;
|
|
96
|
+
/**
|
|
97
|
+
* What a saved machine's door says of the person this computer is in as there: their GitHub
|
|
98
|
+
* account, whether they are that computer's owner, and their devices, as the door lists them. A
|
|
99
|
+
* computer several people use answers it; `unknown` is a machine that does not say (one from
|
|
100
|
+
* before persons, or reached through a server). What it said is another computer's data: the page
|
|
101
|
+
* reads it as such.
|
|
102
|
+
*/
|
|
103
|
+
export type MachinePerson = {
|
|
104
|
+
ok: true;
|
|
105
|
+
said: unknown;
|
|
106
|
+
} | {
|
|
107
|
+
ok: false;
|
|
108
|
+
error: string;
|
|
109
|
+
unknown?: true;
|
|
110
|
+
};
|
|
111
|
+
export declare function onMachinePerson(machineId: string): Promise<MachinePerson>;
|
|
112
|
+
/** Take one of this person's devices out at a saved machine, by its id there; answers what {@link onMachinePerson} does, as it is after. */
|
|
113
|
+
export declare function sendRemoveMachineDevice(machineId: string, deviceId: string): Promise<MachinePerson>;
|
|
114
|
+
/**
|
|
115
|
+
* A link that lets this computer's line in at a saved machine, as this person's: what keeping a
|
|
116
|
+
* line open to a computer several people use starts from, for a person who cannot ask for one
|
|
117
|
+
* over SSH. The link works once, and only for a line.
|
|
118
|
+
*/
|
|
119
|
+
export declare function sendMachineLineLink(machineId: string): Promise<{
|
|
120
|
+
ok: true;
|
|
121
|
+
url: string;
|
|
122
|
+
} | {
|
|
123
|
+
ok: false;
|
|
124
|
+
error: string;
|
|
125
|
+
}>;
|
|
36
126
|
/** Whether each saved machine answers right now, by id: one short call to each, with this computer's key. */
|
|
37
127
|
export declare function onMachinesReachable(): Promise<Record<string, boolean>>;
|
|
38
128
|
/** This computer's OpenAgent, and the one each saved machine runs. */
|
|
@@ -41,9 +41,21 @@ export declare function runModuleCommand(projectId: string, pkg: string, args: s
|
|
|
41
41
|
* Run one of the commands of a package that is this computer's, in no project, and answer its
|
|
42
42
|
* JSON output: how the door's page and the servers' page read and change what they keep, which is
|
|
43
43
|
* in the person's home folder, where the command runs. Refused for any other package: a project's
|
|
44
|
-
* module runs its commands in its project ({@link runModuleCommand}).
|
|
44
|
+
* module runs its commands in its project ({@link runModuleCommand}). `input` is what the command
|
|
45
|
+
* reads on standard input: a login handed over there is on no command line.
|
|
46
|
+
*
|
|
47
|
+
* The command is told which computer this is and where this OpenAgent answers: what it sets up on
|
|
48
|
+
* another machine is listed there as this computer's, and what it asks of a saved machine it asks
|
|
49
|
+
* through this OpenAgent, which holds the keys.
|
|
50
|
+
*/
|
|
51
|
+
export declare function runComputerCommand(pkg: string, args: string[], command?: string | null, input?: string | null): Promise<ModuleCommandResult>;
|
|
52
|
+
/**
|
|
53
|
+
* Run one of the commands of a package that is this computer's on a saved machine, where the
|
|
54
|
+
* same package is that machine's: a module reads and changes what it keeps over there, with this
|
|
55
|
+
* computer's key there, as the machine's own page would. Not for a computer reached through a
|
|
56
|
+
* server: what comes down a line is a machine's calls, not its page's.
|
|
45
57
|
*/
|
|
46
|
-
export declare function
|
|
58
|
+
export declare function runComputerCommandOn(pkg: string, machineId: string, args: string[], command?: string | null, input?: string | null): Promise<ModuleCommandResult>;
|
|
47
59
|
/**
|
|
48
60
|
* Call read `name` of a module's server part in one project: how a module's browser part reads
|
|
49
61
|
* what a command cannot answer fast enough. Refused for an unknown project, a package that is not
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type Person } from '../dashboard/person.js';
|
|
2
2
|
export type { Person } from '../dashboard/person.js';
|
|
3
|
-
/** The person at this dashboard, for the foot of its sidebar (`readPerson`). */
|
|
3
|
+
/** The person at this dashboard, for the foot of its sidebar (`readPerson`): another person's, for a page their device opened. */
|
|
4
4
|
export declare function onPerson(): Promise<Person>;
|
|
@@ -10,6 +10,12 @@ import type { ProvidedCommand } from '@openagt/agent-data';
|
|
|
10
10
|
*/
|
|
11
11
|
/** How a package of this computer is told which computer this is: the name of the word in what it is started with. */
|
|
12
12
|
export declare const COMPUTER_ENV = "OPENAGENT_COMPUTER";
|
|
13
|
+
/** How a package of this computer is told where OpenAgent answers on it. */
|
|
14
|
+
export declare const URL_ENV = "OPENAGENT_URL";
|
|
15
|
+
/** Say where this OpenAgent answers, once it listens: what its packages' commands are told too. */
|
|
16
|
+
export declare function sayOwnUrl(url: string | undefined): void;
|
|
17
|
+
/** Where this OpenAgent answers, as it was said; nothing before it listens. */
|
|
18
|
+
export declare function ownUrlSaid(): string | undefined;
|
|
13
19
|
export interface PackageServicesOptions {
|
|
14
20
|
/** The commands to run, each a package's declared service. */
|
|
15
21
|
commands: readonly ProvidedCommand[];
|
|
@@ -59,4 +59,6 @@ export type ModuleCommandResult = PackageCommandResult;
|
|
|
59
59
|
*/
|
|
60
60
|
export declare function runModuleCommand(root: string, module: ProjectModule, args: readonly string[], command?: string,
|
|
61
61
|
/** What the command is started with, beside what this process itself has. */
|
|
62
|
-
more?: NodeJS.ProcessEnv
|
|
62
|
+
more?: NodeJS.ProcessEnv,
|
|
63
|
+
/** What the command reads on standard input. */
|
|
64
|
+
input?: string): Promise<ModuleCommandResult>;
|
|
@@ -40,7 +40,17 @@ export interface MachineRecord {
|
|
|
40
40
|
* machine that later says another name does not get another computer's runs by it.
|
|
41
41
|
*/
|
|
42
42
|
host?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Whose computer it is, by their GitHub account, when it is another person's: a computer that
|
|
45
|
+
* keeps a line to a server for everyone there. A run started on it uses this person's own logins
|
|
46
|
+
* there, which reach it as copies.
|
|
47
|
+
*/
|
|
48
|
+
owner?: string;
|
|
49
|
+
/** The person was told, once, that their logins are copied to that other person's computer. */
|
|
50
|
+
told?: true;
|
|
43
51
|
}
|
|
52
|
+
/** A GitHub account as a person on a computer is known by: letters, digits and single dashes, at most 39. */
|
|
53
|
+
export declare function isAccount(value: unknown): value is string;
|
|
44
54
|
/**
|
|
45
55
|
* The dashboard's Global options (#410), persisted next to the project list so they
|
|
46
56
|
* survive restarts without localStorage — the daemon reads/writes them, the SPA reads
|
|
@@ -290,6 +300,7 @@ export declare function addMachine(machine: {
|
|
|
290
300
|
door: string;
|
|
291
301
|
pin?: string;
|
|
292
302
|
label?: string;
|
|
303
|
+
owner?: string;
|
|
293
304
|
}, fs?: RegistryFs, env?: NodeJS.ProcessEnv): Promise<{
|
|
294
305
|
record: MachineRecord;
|
|
295
306
|
displaced: MachineRecord[];
|
|
@@ -304,6 +315,8 @@ export declare function nameMachine(machine: {
|
|
|
304
315
|
id: string;
|
|
305
316
|
key: string;
|
|
306
317
|
}, host: string, fs?: RegistryFs, env?: NodeJS.ProcessEnv): Promise<boolean>;
|
|
318
|
+
/** Write down that the person was told their logins are copied to a saved machine of another person's. Answers whether it is saved. */
|
|
319
|
+
export declare function tellMachine(id: string, fs?: RegistryFs, env?: NodeJS.ProcessEnv): Promise<boolean>;
|
|
307
320
|
/** Take a saved machine off the list, by id. Answers the one that was there. */
|
|
308
321
|
export declare function removeMachine(id: string, fs?: RegistryFs, env?: NodeJS.ProcessEnv): Promise<MachineRecord | undefined>;
|
|
309
322
|
/** A {@link PreferencesStore} bound to the real registry file, wired by the daemon so the
|
|
@@ -10,6 +10,12 @@ import type { ProvidedCommand } from '@openagt/agent-data';
|
|
|
10
10
|
*/
|
|
11
11
|
/** How a package of this computer is told which computer this is: the name of the word in what it is started with. */
|
|
12
12
|
export declare const COMPUTER_ENV = "OPENAGENT_COMPUTER";
|
|
13
|
+
/** How a package of this computer is told where OpenAgent answers on it. */
|
|
14
|
+
export declare const URL_ENV = "OPENAGENT_URL";
|
|
15
|
+
/** Say where this OpenAgent answers, once it listens: what its packages' commands are told too. */
|
|
16
|
+
export declare function sayOwnUrl(url: string | undefined): void;
|
|
17
|
+
/** Where this OpenAgent answers, as it was said; nothing before it listens. */
|
|
18
|
+
export declare function ownUrlSaid(): string | undefined;
|
|
13
19
|
export interface PackageServicesOptions {
|
|
14
20
|
/** The commands to run, each a package's declared service. */
|
|
15
21
|
commands: readonly ProvidedCommand[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-services.d.ts","sourceRoot":"","sources":["../src/package-services.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAE1D;;;;;;;GAOG;AAEH,sHAAsH;AACtH,eAAO,MAAM,YAAY,uBAAuB,CAAA;AAEhD,MAAM,WAAW,sBAAsB;IACrC,8DAA8D;IAC9D,QAAQ,EAAE,SAAS,eAAe,EAAE,CAAA;IACpC,gDAAgD;IAChD,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAC,UAAU,CAAA;IACtB,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3B,oEAAoE;IACpE,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,KAAK,YAAY,CAAA;IAC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AE,sBAAsB,GAAG,eAAe,CAwDlF"}
|
package/dist/package-services.js
CHANGED
|
@@ -9,11 +9,22 @@ import { spawn as nodeSpawn } from 'node:child_process';
|
|
|
9
9
|
*/
|
|
10
10
|
/** How a package of this computer is told which computer this is: the name of the word in what it is started with. */
|
|
11
11
|
export const COMPUTER_ENV = 'OPENAGENT_COMPUTER';
|
|
12
|
+
/** How a package of this computer is told where OpenAgent answers on it. */
|
|
13
|
+
export const URL_ENV = 'OPENAGENT_URL';
|
|
14
|
+
let ownUrl;
|
|
15
|
+
/** Say where this OpenAgent answers, once it listens: what its packages' commands are told too. */
|
|
16
|
+
export function sayOwnUrl(url) {
|
|
17
|
+
ownUrl = url;
|
|
18
|
+
}
|
|
19
|
+
/** Where this OpenAgent answers, as it was said; nothing before it listens. */
|
|
20
|
+
export function ownUrlSaid() {
|
|
21
|
+
return ownUrl;
|
|
22
|
+
}
|
|
12
23
|
/** How long a service gets to end by itself once asked, before it is killed. */
|
|
13
24
|
const STOP_GRACE_MS = 3_000;
|
|
14
25
|
export function startPackageServices(opts) {
|
|
15
26
|
const spawn = opts.spawn ?? ((bin, env) => nodeSpawn(process.execPath, [bin, 'serve'], { env, stdio: ['ignore', 'ignore', 'pipe'], detached: true }));
|
|
16
|
-
const env = { ...opts.env,
|
|
27
|
+
const env = { ...opts.env, [URL_ENV]: opts.url };
|
|
17
28
|
let stopping = false;
|
|
18
29
|
const running = new Map();
|
|
19
30
|
const timers = new Set();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-services.js","sourceRoot":"","sources":["../src/package-services.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,SAAS,EAAqB,MAAM,oBAAoB,CAAA;AAG1E;;;;;;;GAOG;AAEH,sHAAsH;AACtH,MAAM,CAAC,MAAM,YAAY,GAAG,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"package-services.js","sourceRoot":"","sources":["../src/package-services.ts"],"names":[],"mappings":"AAAA,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AAI,IAAI,CAAC,QAAQ;QAAE,KAAK,CAAC,OAAO,CAAC,CAAA;IAEnD,OAAO;QACL,KAAK,CAAC,IAAI;YACR,QAAQ,GAAG,IAAI,CAAA;YACf,KAAK,MAAM,KAAK,IAAI,MAAM;gBAAE,YAAY,CAAC,KAAK,CAAC,CAAA;YAC/C,MAAM,CAAC,KAAK,EAAE,CAAA;YACd,MAAM,OAAO,CAAC,GAAG,CACf,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CACvB,KAAK,CAAC,EAAE,CACN,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE;gBAC1B,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,IAAI,KAAK,CAAC,UAAU,KAAK,IAAI;oBAAE,OAAO,OAAO,EAAE,CAAA;gBAC1E,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,aAAa,CAAC,CAAA;gBACnE,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE;oBACtB,YAAY,CAAC,IAAI,CAAC,CAAA;oBAClB,OAAO,EAAE,CAAA;gBACX,CAAC,CAAC,CAAA;gBACF,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE;oBACvB,YAAY,CAAC,IAAI,CAAC,CAAA;oBAClB,OAAO,EAAE,CAAA;gBACX,CAAC,CAAC,CAAA;gBACF,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;YACvB,CAAC,CAAC,CACL,CACF,CAAA;YACD,OAAO,CAAC,KAAK,EAAE,CAAA;QACjB,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -59,5 +59,7 @@ export type ModuleCommandResult = PackageCommandResult;
|
|
|
59
59
|
*/
|
|
60
60
|
export declare function runModuleCommand(root: string, module: ProjectModule, args: readonly string[], command?: string,
|
|
61
61
|
/** What the command is started with, beside what this process itself has. */
|
|
62
|
-
more?: NodeJS.ProcessEnv
|
|
62
|
+
more?: NodeJS.ProcessEnv,
|
|
63
|
+
/** What the command reads on standard input. */
|
|
64
|
+
input?: string): Promise<ModuleCommandResult>;
|
|
63
65
|
//# sourceMappingURL=project-modules.d.ts.map
|