@openagt/dashboard 0.37.0 → 0.39.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/client.d.ts +1 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +1 -0
- package/dist/client.js.map +1 -1
- package/dist/computer-name.d.ts +3 -0
- package/dist/computer-name.d.ts.map +1 -0
- package/dist/computer-name.js +6 -0
- package/dist/computer-name.js.map +1 -0
- package/dist/daemon-runtime.d.ts.map +1 -1
- package/dist/daemon-runtime.js +64 -7
- package/dist/daemon-runtime.js.map +1 -1
- package/dist/daemon.d.ts.map +1 -1
- package/dist/daemon.js +6 -1
- package/dist/daemon.js.map +1 -1
- package/dist/dashboard/compress.d.ts +23 -0
- package/dist/dashboard/compress.d.ts.map +1 -0
- package/dist/dashboard/compress.js +55 -0
- package/dist/dashboard/compress.js.map +1 -0
- package/dist/dashboard/copied-logins.d.ts +54 -0
- package/dist/dashboard/copied-logins.d.ts.map +1 -0
- package/dist/dashboard/copied-logins.js +60 -0
- package/dist/dashboard/copied-logins.js.map +1 -0
- package/dist/dashboard/copy-logins.d.ts +5 -1
- package/dist/dashboard/copy-logins.d.ts.map +1 -1
- package/dist/dashboard/copy-logins.js +9 -3
- package/dist/dashboard/copy-logins.js.map +1 -1
- package/dist/dashboard/git-hosts.d.ts +2 -0
- package/dist/dashboard/git-hosts.d.ts.map +1 -1
- package/dist/dashboard/git-hosts.js +1 -1
- package/dist/dashboard/git-hosts.js.map +1 -1
- package/dist/dashboard/logins-sync.d.ts +146 -0
- package/dist/dashboard/logins-sync.d.ts.map +1 -0
- package/dist/dashboard/logins-sync.js +344 -0
- package/dist/dashboard/logins-sync.js.map +1 -0
- package/dist/dashboard/machine-runs.d.ts +111 -0
- package/dist/dashboard/machine-runs.d.ts.map +1 -0
- package/dist/dashboard/machine-runs.js +252 -0
- package/dist/dashboard/machine-runs.js.map +1 -0
- package/dist/dashboard/module-agents.d.ts +44 -0
- package/dist/dashboard/module-agents.d.ts.map +1 -0
- package/dist/dashboard/module-agents.js +25 -0
- package/dist/dashboard/module-agents.js.map +1 -0
- package/dist/dashboard/module-serve.d.ts +10 -1
- package/dist/dashboard/module-serve.d.ts.map +1 -1
- package/dist/dashboard/module-serve.js +25 -6
- package/dist/dashboard/module-serve.js.map +1 -1
- package/dist/dashboard/relay-endpoints.d.ts +8 -4
- package/dist/dashboard/relay-endpoints.d.ts.map +1 -1
- package/dist/dashboard/relay-endpoints.js +41 -9
- package/dist/dashboard/relay-endpoints.js.map +1 -1
- package/dist/dashboard/remote-run.d.ts +18 -3
- package/dist/dashboard/remote-run.d.ts.map +1 -1
- package/dist/dashboard/remote-run.js +32 -5
- package/dist/dashboard/remote-run.js.map +1 -1
- package/dist/dashboard/rpc-serve.d.ts +8 -2
- package/dist/dashboard/rpc-serve.d.ts.map +1 -1
- package/dist/dashboard/rpc-serve.js +41 -11
- package/dist/dashboard/rpc-serve.js.map +1 -1
- package/dist/dashboard/runs-watch.d.ts +32 -0
- package/dist/dashboard/runs-watch.d.ts.map +1 -0
- package/dist/dashboard/runs-watch.js +89 -0
- package/dist/dashboard/runs-watch.js.map +1 -0
- package/dist/dashboard/server.d.ts +4 -2
- 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/static.d.ts.map +1 -1
- package/dist/dashboard/static.js +8 -6
- package/dist/dashboard/static.js.map +1 -1
- package/dist/dashboard-bundle/assets/host/module-CUc1n2SP.js +1 -0
- package/dist/dashboard-bundle/assets/host/react-B7Fi4tYT.js +1 -0
- package/dist/dashboard-bundle/assets/host/react-dom-client-owmMVl4T.js +1 -0
- package/dist/dashboard-bundle/assets/host/react-dom-oeGwGKD7.js +1 -0
- package/dist/dashboard-bundle/assets/host/react-jsx-runtime-Dxx08tyw.js +1 -0
- package/dist/dashboard-bundle/assets/main-Cv9CrCec.css +2 -0
- package/dist/dashboard-bundle/assets/main-dejlwmyP.js +149 -0
- package/dist/dashboard-bundle/assets/module-DR2oCWs5.js +14 -0
- package/dist/dashboard-bundle/index.html +10 -9
- package/dist/dashboard-rpc/accounts.d.ts +17 -1
- package/dist/dashboard-rpc/accounts.d.ts.map +1 -1
- package/dist/dashboard-rpc/accounts.js +46 -8
- package/dist/dashboard-rpc/accounts.js.map +1 -1
- package/dist/dashboard-rpc/context.js +1 -1
- package/dist/dashboard-rpc/context.js.map +1 -1
- package/dist/dashboard-rpc/copied-logins.d.ts +49 -0
- package/dist/dashboard-rpc/copied-logins.d.ts.map +1 -0
- package/dist/dashboard-rpc/copied-logins.js +179 -0
- package/dist/dashboard-rpc/copied-logins.js.map +1 -0
- package/dist/dashboard-rpc/index.d.ts +6 -3
- package/dist/dashboard-rpc/index.d.ts.map +1 -1
- package/dist/dashboard-rpc/index.js +10 -4
- package/dist/dashboard-rpc/index.js.map +1 -1
- package/dist/dashboard-rpc/logins.d.ts +18 -0
- package/dist/dashboard-rpc/logins.d.ts.map +1 -1
- package/dist/dashboard-rpc/logins.js +51 -7
- package/dist/dashboard-rpc/logins.js.map +1 -1
- package/dist/dashboard-rpc/machines.d.ts +15 -2
- package/dist/dashboard-rpc/machines.d.ts.map +1 -1
- package/dist/dashboard-rpc/machines.js +32 -8
- package/dist/dashboard-rpc/machines.js.map +1 -1
- package/dist/dashboard-rpc/modules.d.ts +9 -9
- package/dist/dashboard-rpc/modules.d.ts.map +1 -1
- package/dist/dashboard-rpc/modules.js +14 -13
- package/dist/dashboard-rpc/modules.js.map +1 -1
- package/dist/dashboard-rpc/people.d.ts +16 -0
- package/dist/dashboard-rpc/people.d.ts.map +1 -0
- package/dist/dashboard-rpc/people.js +32 -0
- package/dist/dashboard-rpc/people.js.map +1 -0
- package/dist/dashboard-rpc/reads.d.ts +29 -1
- package/dist/dashboard-rpc/reads.d.ts.map +1 -1
- package/dist/dashboard-rpc/reads.js +111 -8
- package/dist/dashboard-rpc/reads.js.map +1 -1
- package/dist/dashboard-rpc/relay-dispatch.d.ts +6 -0
- package/dist/dashboard-rpc/relay-dispatch.d.ts.map +1 -1
- package/dist/dashboard-rpc/relay-dispatch.js +25 -2
- package/dist/dashboard-rpc/relay-dispatch.js.map +1 -1
- package/dist/dashboard-rpc/runs-changed.d.ts +8 -0
- package/dist/dashboard-rpc/runs-changed.d.ts.map +1 -0
- package/dist/dashboard-rpc/runs-changed.js +62 -0
- package/dist/dashboard-rpc/runs-changed.js.map +1 -0
- package/dist/dashboard-rpc/server-logins.d.ts +22 -0
- package/dist/dashboard-rpc/server-logins.d.ts.map +1 -0
- package/dist/dashboard-rpc/server-logins.js +26 -0
- package/dist/dashboard-rpc/server-logins.js.map +1 -0
- package/dist/dashboard-rpc/test-context.js +1 -1
- package/dist/dashboard-rpc/test-context.js.map +1 -1
- package/dist/health.d.ts +20 -0
- package/dist/health.d.ts.map +1 -0
- package/dist/health.js +98 -0
- package/dist/health.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/module-types/dashboard/components/FilterChips.d.ts +12 -0
- package/dist/module-types/dashboard/components/Page.d.ts +12 -0
- package/dist/module-types/dashboard/components/SidebarToggle.d.ts +4 -0
- package/dist/module-types/dashboard/components/StatTile.d.ts +15 -0
- package/dist/module-types/dashboard/components/ui/sheet.d.ts +10 -0
- package/dist/module-types/dashboard/components/ui/sidebar.d.ts +71 -0
- package/dist/module-types/dashboard/lib/use-async.d.ts +24 -6
- package/dist/module-types/dashboard/lib/use-mobile.d.ts +4 -0
- package/dist/module-types/dashboard/lib/use-modules.d.ts +7 -3
- package/dist/module-types/dashboard/module/index.d.ts +42 -15
- package/dist/module-types/src/client.d.ts +1 -0
- package/dist/module-types/src/computer-name.d.ts +2 -0
- package/dist/module-types/src/dashboard/compress.d.ts +22 -0
- package/dist/module-types/src/dashboard/copied-logins.d.ts +53 -0
- package/dist/module-types/src/dashboard/git-hosts.d.ts +2 -0
- package/dist/module-types/src/dashboard/logins-sync.d.ts +145 -0
- package/dist/module-types/src/dashboard/machine-runs.d.ts +110 -0
- package/dist/module-types/src/dashboard/module-agents.d.ts +43 -0
- package/dist/module-types/src/dashboard/module-serve.d.ts +10 -1
- package/dist/module-types/src/dashboard/remote-run.d.ts +18 -3
- package/dist/module-types/src/dashboard/rpc-serve.d.ts +8 -2
- package/dist/module-types/src/dashboard/runs-watch.d.ts +31 -0
- package/dist/module-types/src/dashboard-rpc/accounts.d.ts +17 -1
- package/dist/module-types/src/dashboard-rpc/copied-logins.d.ts +48 -0
- package/dist/module-types/src/dashboard-rpc/index.d.ts +6 -3
- package/dist/module-types/src/dashboard-rpc/logins.d.ts +18 -0
- package/dist/module-types/src/dashboard-rpc/machines.d.ts +15 -2
- package/dist/module-types/src/dashboard-rpc/modules.d.ts +9 -9
- package/dist/module-types/src/dashboard-rpc/people.d.ts +15 -0
- package/dist/module-types/src/dashboard-rpc/reads.d.ts +29 -1
- package/dist/module-types/src/dashboard-rpc/runs-changed.d.ts +7 -0
- package/dist/module-types/src/dashboard-rpc/server-logins.d.ts +21 -0
- package/dist/module-types/src/health.d.ts +19 -0
- package/dist/module-types/src/index.d.ts +1 -0
- package/dist/module-types/src/overview-layout.d.ts +37 -0
- package/dist/module-types/src/project-hooks.d.ts +11 -1
- package/dist/module-types/src/registry.d.ts +14 -0
- package/dist/module-types/src/store/agent-store.d.ts +15 -1
- package/dist/module-types/src/store/branches.d.ts +2 -2
- package/dist/module-types/src/store/git-host.d.ts +8 -2
- package/dist/module-types/src/store/provided.d.ts +5 -4
- package/dist/module-types/src/store/queue.d.ts +3 -2
- package/dist/module-types/src/store/runs.d.ts +6 -3
- package/dist/module-types/src/store/tickets.d.ts +3 -2
- package/dist/module.css +1 -1
- package/dist/overview-layout.d.ts +38 -0
- package/dist/overview-layout.d.ts.map +1 -0
- package/dist/overview-layout.js +61 -0
- package/dist/overview-layout.js.map +1 -0
- package/dist/project-hooks.d.ts +11 -1
- package/dist/project-hooks.d.ts.map +1 -1
- package/dist/project-hooks.js +21 -11
- package/dist/project-hooks.js.map +1 -1
- package/dist/registry.d.ts +14 -0
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +31 -2
- package/dist/registry.js.map +1 -1
- package/dist/store/agent-store.d.ts +15 -1
- package/dist/store/agent-store.d.ts.map +1 -1
- package/dist/store/agent-store.js.map +1 -1
- package/dist/store/branches.d.ts +2 -2
- package/dist/store/branches.d.ts.map +1 -1
- package/dist/store/branches.js +8 -2
- package/dist/store/branches.js.map +1 -1
- package/dist/store/git-host.d.ts +8 -2
- package/dist/store/git-host.d.ts.map +1 -1
- package/dist/store/git-host.js +21 -2
- package/dist/store/git-host.js.map +1 -1
- package/dist/store/provided.d.ts +5 -4
- package/dist/store/provided.d.ts.map +1 -1
- package/dist/store/provided.js +10 -9
- package/dist/store/provided.js.map +1 -1
- package/dist/store/queue.d.ts +3 -2
- package/dist/store/queue.d.ts.map +1 -1
- package/dist/store/queue.js +9 -2
- package/dist/store/queue.js.map +1 -1
- package/dist/store/runs.d.ts +6 -3
- package/dist/store/runs.d.ts.map +1 -1
- package/dist/store/runs.js +10 -3
- package/dist/store/runs.js.map +1 -1
- package/dist/store/tickets.d.ts +3 -2
- package/dist/store/tickets.d.ts.map +1 -1
- package/dist/store/tickets.js +9 -2
- package/dist/store/tickets.js.map +1 -1
- package/package.json +23 -23
- package/dist/dashboard-bundle/assets/main-B_YIbzfX.js +0 -148
- package/dist/dashboard-bundle/assets/main-COZtHuZ-.css +0 -2
- package/dist/dashboard-bundle/assets/module-B_KMN8r0.js +0 -14
- package/dist/dashboard-bundle/host/module.js +0 -1
- package/dist/dashboard-bundle/host/react-dom-client.js +0 -1
- package/dist/dashboard-bundle/host/react-dom.js +0 -1
- package/dist/dashboard-bundle/host/react-jsx-runtime.js +0 -1
- package/dist/dashboard-bundle/host/react.js +0 -1
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import type { Health } from '../../src/health.js';
|
|
2
|
+
import type { CardWidth } from '../../src/overview-layout.js';
|
|
1
3
|
import { type ComponentType } from 'react';
|
|
2
4
|
import type { AgentStatus } from '../../src/index.js';
|
|
5
|
+
import type { ModuleAgent, ModuleAgentsWanted } from '../../src/dashboard/module-agents.js';
|
|
3
6
|
import type { ModuleCommandResult, ModuleReadResult } from '../rpc/modules.js';
|
|
4
|
-
export type { ModuleCommandResult, ModuleReadResult, AgentStatus };
|
|
7
|
+
export type { ModuleCommandResult, ModuleReadResult, AgentStatus, CardWidth, Health, ModuleAgent, ModuleAgentsWanted };
|
|
5
8
|
/** A registered project that has the module's package, as a page gets it. */
|
|
6
9
|
export interface ModuleProject {
|
|
7
10
|
id: string;
|
|
@@ -113,6 +116,12 @@ export interface ModuleCardProps {
|
|
|
113
116
|
export interface ModuleCard {
|
|
114
117
|
/** Which card this is, for the shell's key and its error line; never shown as a title. */
|
|
115
118
|
id: string;
|
|
119
|
+
/** Its name where the person arranges the Overview's cards: what its title says ("Hot tickets"). */
|
|
120
|
+
label: string;
|
|
121
|
+
/** How wide it stands until the person picks: half the Overview when unsaid. */
|
|
122
|
+
width?: CardWidth;
|
|
123
|
+
/** The narrowest it fits: a third of the Overview when unsaid. */
|
|
124
|
+
minWidth?: CardWidth;
|
|
116
125
|
/** Its place among every installed package's cards, lower first; 50 when unsaid, ties by package name. */
|
|
117
126
|
order?: number;
|
|
118
127
|
/** The card itself. */
|
|
@@ -294,18 +303,6 @@ export interface ModuleDefinition {
|
|
|
294
303
|
}
|
|
295
304
|
/** Type the default export: `export default defineModule({ ... })`. */
|
|
296
305
|
export declare function defineModule(definition: ModuleDefinition): ModuleDefinition;
|
|
297
|
-
/** A run of a project as the dashboard knows it (#1774): enough for a page to name one and link to it. */
|
|
298
|
-
export interface ModuleAgent {
|
|
299
|
-
/** The run's id, the one {@link ModuleHost.openAgent} takes. */
|
|
300
|
-
id: string;
|
|
301
|
-
/** The run's branch, the name the agent gave its work, when its record carries one. */
|
|
302
|
-
name?: string;
|
|
303
|
-
/** What the run was asked, as typed or as queued; absent when its record carries none. */
|
|
304
|
-
ask?: string;
|
|
305
|
-
status: AgentStatus;
|
|
306
|
-
/** ISO 8601. */
|
|
307
|
-
startedAt: string;
|
|
308
|
-
}
|
|
309
306
|
/** What starting a run answered: the run's id, or in words why there is none. */
|
|
310
307
|
export type StartRunResult = {
|
|
311
308
|
ok: true;
|
|
@@ -362,6 +359,13 @@ export interface ModuleHost {
|
|
|
362
359
|
openPage(segment: string, path?: string[], projectId?: string): void;
|
|
363
360
|
/** The address of a page a module adds, with the project picked in the dashboard: a link's `href`, for a link that also opens in a new tab. */
|
|
364
361
|
pageHref(segment: string): string;
|
|
362
|
+
/** Open an entry of Settings over the page, by its id: `openSettings('devices')`. */
|
|
363
|
+
openSettings(entry: string): void;
|
|
364
|
+
/**
|
|
365
|
+
* The accounts behind a project's commit emails at its git host, each with its login and picture:
|
|
366
|
+
* an email the host knows nobody for, or a project with no git host, is left out. Kept a day.
|
|
367
|
+
*/
|
|
368
|
+
gitHostPeople(projectId: string, emails: string[]): Promise<ModuleHostPerson[]>;
|
|
365
369
|
/**
|
|
366
370
|
* Start a run in one project with this prompt, with the person's own picks (which tool, which
|
|
367
371
|
* model, where it runs), and land on it, unless `land` is false: then the dashboard stays where
|
|
@@ -372,8 +376,12 @@ export interface ModuleHost {
|
|
|
372
376
|
}): Promise<StartRunResult>;
|
|
373
377
|
/** Open the project's launcher with this prompt drafted in, to set it up before sending: "Configure first, then run". */
|
|
374
378
|
configureRun(projectId: string, prompt: string): void;
|
|
375
|
-
/**
|
|
376
|
-
|
|
379
|
+
/**
|
|
380
|
+
* The project's runs the dashboard knows: the ones running, and the recorded ones when the
|
|
381
|
+
* project records them. `wanted` narrows them to the ones a card shows (those holding a claim,
|
|
382
|
+
* the last 30 days): a project keeps hundreds, and a phone downloads every one asked for.
|
|
383
|
+
*/
|
|
384
|
+
agents(projectId: string, wanted?: ModuleAgentsWanted): Promise<ModuleAgent[]>;
|
|
377
385
|
/**
|
|
378
386
|
* The other computers a run can be sent to, as saved on this one, each with the OpenAgent it
|
|
379
387
|
* runs, beside this computer's own: how a page tells that a machine fell behind this computer.
|
|
@@ -415,6 +423,11 @@ export interface ModuleHost {
|
|
|
415
423
|
* it said is another computer's data, to read as such; `unknown` for a machine that does not say.
|
|
416
424
|
*/
|
|
417
425
|
machinePerson(machineId: string): Promise<ModuleMachinePerson>;
|
|
426
|
+
/**
|
|
427
|
+
* A saved server of the person's uses this computer's logins from now on: each account this
|
|
428
|
+
* computer is logged in to gets a login of the server's own there, as Settings › Accounts says.
|
|
429
|
+
*/
|
|
430
|
+
useLoginsOn(machineId: string): Promise<MachineAdded>;
|
|
418
431
|
/** Take one of that person's devices out at the machine, by its id there; answers as {@link machinePerson} does, after. */
|
|
419
432
|
removeMachineDevice(machineId: string, deviceId: string): Promise<ModuleMachinePerson>;
|
|
420
433
|
/**
|
|
@@ -426,6 +439,13 @@ export interface ModuleHost {
|
|
|
426
439
|
/** Send the live screen of a run what the person did on it, as JSON; whether the screen took it. */
|
|
427
440
|
sendToScreen(projectId: string, agentId: string, input: unknown): Promise<boolean>;
|
|
428
441
|
}
|
|
442
|
+
/** A person of a project, as its git host knows them. */
|
|
443
|
+
export interface ModuleHostPerson {
|
|
444
|
+
email: string;
|
|
445
|
+
login: string;
|
|
446
|
+
/** A picture of them: an https address. */
|
|
447
|
+
avatar?: string;
|
|
448
|
+
}
|
|
429
449
|
/** A saved machine, as a module sees it: never this computer's key there. */
|
|
430
450
|
export interface ModuleMachine {
|
|
431
451
|
/** Where the machine answers, as an origin (`https://203.0.113.5`): what it is known by. */
|
|
@@ -434,6 +454,8 @@ export interface ModuleMachine {
|
|
|
434
454
|
url: string;
|
|
435
455
|
/** The OpenAgent it runs; absent for a machine that does not answer right now. */
|
|
436
456
|
version?: string;
|
|
457
|
+
/** How it stands, as it says: its memory, disk and load; absent for one that does not answer, or does not say. */
|
|
458
|
+
health?: Health;
|
|
437
459
|
/** The id the machine lists this computer under, among the devices that are in there. */
|
|
438
460
|
device?: string;
|
|
439
461
|
/** Whose computer it is, by their GitHub account, when it is another person's shared with everyone on a server. */
|
|
@@ -450,6 +472,8 @@ export interface ModuleMachines {
|
|
|
450
472
|
version: string;
|
|
451
473
|
/** This computer's own name, as another machine lists it: "Suleimans-MacBook-Pro". */
|
|
452
474
|
name?: string;
|
|
475
|
+
/** How this computer stands: its memory, disk and load. */
|
|
476
|
+
health?: Health;
|
|
453
477
|
machines: ModuleMachine[];
|
|
454
478
|
}
|
|
455
479
|
/** How saving a machine went: done, or stopped, with the reason. */
|
|
@@ -547,6 +571,9 @@ export { Tooltip, TooltipTrigger, TooltipContent } from '../components/ui/toolti
|
|
|
547
571
|
export { DropdownMenu, DropdownMenuContent, DropdownMenuCheckboxItem, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from '../components/ui/dropdown-menu.js';
|
|
548
572
|
export { ContextMenu, ContextMenuTrigger } from '../components/ui/context-menu.js';
|
|
549
573
|
export { PaneTitle, PaneActions } from '../components/PaneHeader.js';
|
|
574
|
+
export { Page } from '../components/Page.js';
|
|
575
|
+
export { StatTile } from '../components/StatTile.js';
|
|
576
|
+
export { FilterChips, type FilterChip } from '../components/FilterChips.js';
|
|
550
577
|
export { FileIcon } from '../components/FileIcon.js';
|
|
551
578
|
export { Markdown } from '../components/Markdown.js';
|
|
552
579
|
export { StartAgentButton } from '../components/StartAgentButton.js';
|
|
@@ -17,3 +17,4 @@ export { reachedByLine } from './reached-by-line.js';
|
|
|
17
17
|
export { isLoopbackHost } from './loopback-host.js';
|
|
18
18
|
export { bridgeChoiceRequest } from './dashboard/bridge-question.js';
|
|
19
19
|
export { cloudRunState, cloudRunActive, CLOUD_SESSION_WINDOW_MS, type CloudRunState } from './cloud-run-state.js';
|
|
20
|
+
export { ALL_PROJECTS, CARD_WIDTHS, arrangeCards, widthsFor, type CardPlace, type CardWidth, type LayoutCard, type OverviewLayouts } from './overview-layout.js';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { IncomingMessage, OutgoingHttpHeaders, ServerResponse } from 'node:http';
|
|
2
|
+
/** Whether the caller takes a gzipped answer: every browser says so. */
|
|
3
|
+
export declare function takesGzip(req: IncomingMessage): boolean;
|
|
4
|
+
/** The types worth packing: text. A picture or a font is packed already. */
|
|
5
|
+
export declare function isText(contentType: string): boolean;
|
|
6
|
+
/** A file's version, from its size and when it was last written: a file rebuilt in place gets a new one. */
|
|
7
|
+
export declare function fileVersion(facts: {
|
|
8
|
+
mtimeMs: number;
|
|
9
|
+
size: number;
|
|
10
|
+
}): string;
|
|
11
|
+
/** The tag a file is sent with: its {@link fileVersion}. */
|
|
12
|
+
export declare function fileTag(facts: {
|
|
13
|
+
mtimeMs: number;
|
|
14
|
+
size: number;
|
|
15
|
+
}): string;
|
|
16
|
+
/**
|
|
17
|
+
* Send `body`, gzipped when the caller takes it, it is text and not small. `key` names a body that
|
|
18
|
+
* is the same each time it is sent (a file of the page), so it is packed once. A body sent with an
|
|
19
|
+
* `etag` the browser already holds (it says so in `if-none-match`) is not sent again: a 304 tells
|
|
20
|
+
* it to use its copy, which is what a reopened page does with every file of its code.
|
|
21
|
+
*/
|
|
22
|
+
export declare function sendBody(req: IncomingMessage, res: ServerResponse, status: number, headers: OutgoingHttpHeaders, body: Buffer | string, key?: string): Promise<void>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/** One of an account's usage windows, as a page names it: `5 h`, `week`, `month`, and how much of it is gone. */
|
|
2
|
+
export interface UsageWindow {
|
|
3
|
+
label: string;
|
|
4
|
+
percent: number;
|
|
5
|
+
}
|
|
6
|
+
/** What a copied login is a login of: a coding agent's account, or a git host's. */
|
|
7
|
+
export type CopiedKind = 'claude' | 'codex' | 'git';
|
|
8
|
+
/** One login a computer of the person's handed over, as this server keeps it: never the login itself. */
|
|
9
|
+
export interface CopiedLogin {
|
|
10
|
+
kind: CopiedKind;
|
|
11
|
+
/** A git host's account: the host. */
|
|
12
|
+
host?: string;
|
|
13
|
+
/** Which of the computer's accounts it is: `own` for its own login, else the account's name there, or its login at the git host. */
|
|
14
|
+
source: string;
|
|
15
|
+
/** The name of its row here. */
|
|
16
|
+
name: string;
|
|
17
|
+
/** Who the account is, as the computer said when it handed it over: a switch to another account says another. */
|
|
18
|
+
who: string;
|
|
19
|
+
/** The computer it came from, by its name. */
|
|
20
|
+
from: string;
|
|
21
|
+
/** The computer no longer has it, and the person said to keep it here. */
|
|
22
|
+
kept?: true;
|
|
23
|
+
/** A git host's account the computer's runs use: the server's do too. */
|
|
24
|
+
runs?: true;
|
|
25
|
+
/** How full it is, as the computer last read it. */
|
|
26
|
+
usage?: {
|
|
27
|
+
windows: UsageWindow[];
|
|
28
|
+
at: number;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/** A login handed over: what it is, and the login itself, which goes where its tool reads it. */
|
|
32
|
+
export interface GivenLogin {
|
|
33
|
+
kind: CopiedKind;
|
|
34
|
+
host?: string;
|
|
35
|
+
source: string;
|
|
36
|
+
name: string;
|
|
37
|
+
who: string;
|
|
38
|
+
from: string;
|
|
39
|
+
runs?: boolean;
|
|
40
|
+
}
|
|
41
|
+
/** Where the file is: beside OpenAgent's other files in the person's config folder. */
|
|
42
|
+
export declare function copiedPath(env?: NodeJS.ProcessEnv): string;
|
|
43
|
+
export declare const isKind: (value: unknown) => value is CopiedKind;
|
|
44
|
+
/** A word a computer said: a name, an account, a host. Never long, never a line break. */
|
|
45
|
+
export declare const isWord: (value: unknown, max?: number) => value is string;
|
|
46
|
+
export declare function readUsage(value: unknown): CopiedLogin['usage'] | undefined;
|
|
47
|
+
/** The logins this server keeps from the person's computers. Forgiving: none on a file that does not read. */
|
|
48
|
+
export declare function readCopied(): CopiedLogin[];
|
|
49
|
+
export declare function writeCopied(logins: CopiedLogin[]): void;
|
|
50
|
+
/** The same login of the same computer: its kind, its host, and which of the computer's accounts it is. */
|
|
51
|
+
export declare const same: (a: Pick<CopiedLogin, 'kind' | 'host' | 'source'>, b: Pick<CopiedLogin, 'kind' | 'host' | 'source'>) => boolean;
|
|
52
|
+
/** The copied login of an account row here, by its kind and its name. */
|
|
53
|
+
export declare function copiedOf(kind: CopiedKind, name: string, host?: string): CopiedLogin | undefined;
|
|
@@ -7,6 +7,8 @@ export interface GitHostAccount {
|
|
|
7
7
|
runs: boolean;
|
|
8
8
|
/** Whether the tool could use it when asked. */
|
|
9
9
|
ok: boolean;
|
|
10
|
+
/** On a server: the computer of the person's whose login it is. */
|
|
11
|
+
from?: string;
|
|
10
12
|
}
|
|
11
13
|
/** What a git host's package answers of it. */
|
|
12
14
|
export interface GitHostProvider {
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { type Mint } from '@openagt/agent-driver-claude';
|
|
2
|
+
import { type CodexLogin, type CodexLoginOptions } from '@openagt/agent-driver-codex';
|
|
3
|
+
import { type MachineRecord, type Preferences } from '../registry.js';
|
|
4
|
+
import { type MachineAccess } from './remote-run.js';
|
|
5
|
+
import { type CopiedKind, type UsageWindow } from './copied-logins.js';
|
|
6
|
+
/**
|
|
7
|
+
* A computer's side of a server that uses its logins (`copied-logins.ts` is the server's side).
|
|
8
|
+
* Once the person said so for a server of their own, this computer keeps the server's logins as
|
|
9
|
+
* its own: every account it is logged in to, a coding agent's or a git host's, gets a login of the
|
|
10
|
+
* server's own there, and a login that changes here changes there.
|
|
11
|
+
*
|
|
12
|
+
* A login is never shared by both: each computer renews its own, and a login renewed on one
|
|
13
|
+
* computer would log the other one out. What can go as it is goes as it is, with nothing to
|
|
14
|
+
* press: a git host's token, which its host never renews, and a Claude account added here, which
|
|
15
|
+
* is a login made for a computer nobody sits at already. What cannot is made anew for the server,
|
|
16
|
+
* in this computer's browser, with one press of the person's: their own Claude login (Claude
|
|
17
|
+
* Code's `setup-token`), and any Codex account (a sign-in of its own). Nothing here is logged out.
|
|
18
|
+
*
|
|
19
|
+
* What the person no longer has here stays there until they say: kept, or taken off. A login
|
|
20
|
+
* taken off there is deleted there and ends nothing.
|
|
21
|
+
*
|
|
22
|
+
* The person's settings follow the same way: what they change here is changed there, the next
|
|
23
|
+
* minute. A setting changed on the server's own page stays, until the same one changes here.
|
|
24
|
+
*/
|
|
25
|
+
/** One of this computer's accounts, as a server gets it. */
|
|
26
|
+
export interface LocalLogin {
|
|
27
|
+
kind: CopiedKind;
|
|
28
|
+
host?: string;
|
|
29
|
+
/** Which account it is here: `own` for the agent's own login, else its name here, or its login at the git host. */
|
|
30
|
+
source: string;
|
|
31
|
+
name: string;
|
|
32
|
+
/** Who the account is: another one under the same `source` is a switch. */
|
|
33
|
+
who: string;
|
|
34
|
+
/** A git host's account this computer's runs use. */
|
|
35
|
+
runs?: boolean;
|
|
36
|
+
/** The login as it is, for one that can go as it is; none for one made anew for the server. */
|
|
37
|
+
secret?: () => Promise<string>;
|
|
38
|
+
}
|
|
39
|
+
/** How one of this computer's accounts stands on a server. */
|
|
40
|
+
export interface LoginThere {
|
|
41
|
+
kind: CopiedKind;
|
|
42
|
+
host?: string;
|
|
43
|
+
source: string;
|
|
44
|
+
name: string;
|
|
45
|
+
/**
|
|
46
|
+
* `there`: the server has it. `allow`: it waits for the person's press, which makes the server a
|
|
47
|
+
* login of its own. `switched`: the server has another account of this one's, which the
|
|
48
|
+
* person no longer is here: the press makes this one's. `failed`: it did not get there.
|
|
49
|
+
*/
|
|
50
|
+
state: 'there' | 'allow' | 'switched' | 'failed';
|
|
51
|
+
/** `switched`: the account the server has. */
|
|
52
|
+
was?: string;
|
|
53
|
+
error?: string;
|
|
54
|
+
}
|
|
55
|
+
/** One of this computer's servers, and how its logins stand there. */
|
|
56
|
+
export interface ServerLogins {
|
|
57
|
+
machineId: string;
|
|
58
|
+
label: string;
|
|
59
|
+
/** The person said the server uses this computer's logins. */
|
|
60
|
+
on: boolean;
|
|
61
|
+
/** It answered when last asked. */
|
|
62
|
+
reachable: boolean;
|
|
63
|
+
logins: LoginThere[];
|
|
64
|
+
/** What the server has of this computer's that this computer no longer has: the person keeps it there, or takes it off. */
|
|
65
|
+
left: {
|
|
66
|
+
kind: CopiedKind;
|
|
67
|
+
host?: string;
|
|
68
|
+
source: string;
|
|
69
|
+
name: string;
|
|
70
|
+
}[];
|
|
71
|
+
/** The press under way: the login being made, and the page it signs in at. */
|
|
72
|
+
allowing?: {
|
|
73
|
+
name: string;
|
|
74
|
+
url?: string;
|
|
75
|
+
};
|
|
76
|
+
/** Why the last press stopped. */
|
|
77
|
+
failed?: string;
|
|
78
|
+
}
|
|
79
|
+
/** What the sync reaches for, swapped in tests. */
|
|
80
|
+
export declare const syncWiring: {
|
|
81
|
+
/** The environment the daemon was started with: whose saved machines, whose logins. */
|
|
82
|
+
env: NodeJS.ProcessEnv;
|
|
83
|
+
machines: () => Promise<MachineRecord[]>;
|
|
84
|
+
/** Whether a machine is a server, and answers. */
|
|
85
|
+
facts: (machine: MachineAccess) => Promise<{
|
|
86
|
+
server?: true;
|
|
87
|
+
version?: string;
|
|
88
|
+
}>;
|
|
89
|
+
call: (machine: MachineAccess, fn: string, args: unknown[]) => Promise<{
|
|
90
|
+
ok: true;
|
|
91
|
+
ret: unknown;
|
|
92
|
+
} | {
|
|
93
|
+
ok: false;
|
|
94
|
+
error: string;
|
|
95
|
+
}>;
|
|
96
|
+
/** This computer's own logins. */
|
|
97
|
+
local: () => Promise<LocalLogin[]>;
|
|
98
|
+
/** How full each of this computer's accounts is, as its own page reads it. */
|
|
99
|
+
usage: () => Promise<{
|
|
100
|
+
kind: CopiedKind;
|
|
101
|
+
source: string;
|
|
102
|
+
windows: UsageWindow[];
|
|
103
|
+
at: number;
|
|
104
|
+
}[]>;
|
|
105
|
+
/** This computer's settings. */
|
|
106
|
+
preferences: () => Promise<Preferences>;
|
|
107
|
+
mint: Mint;
|
|
108
|
+
loginCodex: (opts: CodexLoginOptions) => Promise<CodexLogin>;
|
|
109
|
+
computer: () => string;
|
|
110
|
+
};
|
|
111
|
+
/** The person's own Claude login here, as Claude Code keeps who it is: none when it is logged in to no account. */
|
|
112
|
+
export declare function claudeOwnAccount(env?: NodeJS.ProcessEnv): {
|
|
113
|
+
name: string;
|
|
114
|
+
who: string;
|
|
115
|
+
} | undefined;
|
|
116
|
+
/** Every account this computer is logged in to: its coding agents' and its git hosts'. */
|
|
117
|
+
export declare function localLogins(env?: NodeJS.ProcessEnv): Promise<LocalLogin[]>;
|
|
118
|
+
/** Bring every server that uses this computer's logins up to them, and note how each stands; a saved machine that is no server of the person's is left out. */
|
|
119
|
+
export declare function syncLogins(): Promise<ServerLogins[]>;
|
|
120
|
+
/** The servers as last read, with the press under way on each: read anew when none were read yet. */
|
|
121
|
+
export declare function serverLogins(): Promise<ServerLogins[]>;
|
|
122
|
+
/**
|
|
123
|
+
* The person's press for a server: each of this computer's accounts that waits for it gets a
|
|
124
|
+
* login of the server's own, made in this computer's browser, one after the other. Answers at
|
|
125
|
+
* once; how it goes is in {@link serverLogins}.
|
|
126
|
+
*/
|
|
127
|
+
export declare function allowLogins(machineId: string): Promise<{
|
|
128
|
+
ok: true;
|
|
129
|
+
} | {
|
|
130
|
+
ok: false;
|
|
131
|
+
error: string;
|
|
132
|
+
}>;
|
|
133
|
+
/** Keep, or take off, a login the server has of this computer's that this computer no longer has. */
|
|
134
|
+
export declare function settleLeft(machineId: string, which: {
|
|
135
|
+
kind: CopiedKind;
|
|
136
|
+
host?: string;
|
|
137
|
+
source: string;
|
|
138
|
+
}, keep: boolean): Promise<{
|
|
139
|
+
ok: true;
|
|
140
|
+
} | {
|
|
141
|
+
ok: false;
|
|
142
|
+
error: string;
|
|
143
|
+
}>;
|
|
144
|
+
/** Keep every server that uses this computer's logins up to them, from now on: a minute apart, the first a moment after the start. */
|
|
145
|
+
export declare function startLoginsSync(env: NodeJS.ProcessEnv): () => void;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { type AgentMeta } from '../store/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The runs of another computer, as this one lists them: a laptop's on its server, a server's on
|
|
4
|
+
* the laptop. Each computer answers for its own runs only, as they stand right now, over the relay
|
|
5
|
+
* of the saved machine it is ({@link RunChanges}); this computer takes what it says over the
|
|
6
|
+
* records of those runs it holds, which come through a project's shared records and stop at
|
|
7
|
+
* whatever was shared last ({@link withMachineRuns}). So how a computer's runs stand never
|
|
8
|
+
* depends on its records being shared: a computer that does not answer has its runs known by what
|
|
9
|
+
* it said last, or by their records, and none of them going: their status is `unknown`.
|
|
10
|
+
*/
|
|
11
|
+
/** What a computer answers for its own runs of a project. */
|
|
12
|
+
export interface OwnRuns {
|
|
13
|
+
/**
|
|
14
|
+
* What to ask with next time, as `since`: the answer then holds only the runs that changed after
|
|
15
|
+
* this one. The same as `since` when nothing changed.
|
|
16
|
+
*/
|
|
17
|
+
at: string;
|
|
18
|
+
/** Its runs that changed since the `since` it was asked with; every one when there was none, or one it does not know. */
|
|
19
|
+
runs: AgentMeta[];
|
|
20
|
+
/** Every one of its runs of the project, by id: a run the asker holds that is not here is gone. */
|
|
21
|
+
ids: string[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* What a list shows of a run, as one string to compare: what it is, how it stands, and its name.
|
|
25
|
+
* A run's card is written at every step it takes, with a later time and a higher cost, and none
|
|
26
|
+
* of that is a change a person waits on.
|
|
27
|
+
*/
|
|
28
|
+
export declare function shownOf(run: AgentMeta): string;
|
|
29
|
+
/**
|
|
30
|
+
* A computer's own runs, counted as they change, per project: each answer says where it leaves
|
|
31
|
+
* the asker, and the next holds what changed after that. A count from before this OpenAgent
|
|
32
|
+
* started, or from no answer of its, is answered with every run.
|
|
33
|
+
*/
|
|
34
|
+
export declare class RunChanges {
|
|
35
|
+
private readonly started;
|
|
36
|
+
private readonly projects;
|
|
37
|
+
answer(project: string, runs: readonly AgentMeta[], since?: unknown): OwnRuns;
|
|
38
|
+
/** Whether what a list shows of the runs changed after `since`, as of the last answer: a count not of this OpenAgent's says so. */
|
|
39
|
+
shownSince(project: string, since: unknown): boolean;
|
|
40
|
+
private known;
|
|
41
|
+
private countOf;
|
|
42
|
+
}
|
|
43
|
+
/** A saved machine's runs of one project, as this computer last heard them. */
|
|
44
|
+
export interface MachineRuns {
|
|
45
|
+
/** The computer's own name, as the records of its runs carry it. */
|
|
46
|
+
host: string;
|
|
47
|
+
/** Its runs as it said them last, since this OpenAgent started. */
|
|
48
|
+
runs: readonly AgentMeta[];
|
|
49
|
+
/** It answered the last time it was asked. */
|
|
50
|
+
answered: boolean;
|
|
51
|
+
/** When it last answered, ISO, when this computer knows. */
|
|
52
|
+
seenAt?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* A project's runs with what its saved machines said of theirs: a machine's word on a run of its
|
|
56
|
+
* own wins over the run's record, and a run of its own with no record here yet is listed too. A
|
|
57
|
+
* machine's run that is going is going only by its machine's word just now: one whose machine did
|
|
58
|
+
* not answer, or that its machine did not say, reads `unknown`, with when its machine was last
|
|
59
|
+
* seen. The runs of every other computer pass through as recorded.
|
|
60
|
+
*/
|
|
61
|
+
export declare function withMachineRuns(records: AgentMeta[], machines: readonly MachineRuns[]): AgentMeta[];
|
|
62
|
+
/** A saved machine to ask for its runs: where it answers and its computer's own name. */
|
|
63
|
+
export interface AskedMachine {
|
|
64
|
+
url: string;
|
|
65
|
+
host: string;
|
|
66
|
+
/** When it last answered, ISO, as kept with the machine. */
|
|
67
|
+
seenAt?: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* How long a computer holds a call for its runs when nothing a list shows changed since it last
|
|
71
|
+
* answered: it answers at the first such change, else with what else changed once this is up, and
|
|
72
|
+
* is asked again.
|
|
73
|
+
*/
|
|
74
|
+
export declare const RUNS_WAIT_MS = 25000;
|
|
75
|
+
/**
|
|
76
|
+
* What each saved machine says of its runs of a project, followed while a page wants them: one call
|
|
77
|
+
* to each machine is kept open, which the machine answers when its runs change
|
|
78
|
+
* ({@link RUNS_WAIT_MS}), and asked again at once from where the answer left off ({@link OwnRuns}).
|
|
79
|
+
* So what is kept is what the machine says now, and whoever listens to the project's address is
|
|
80
|
+
* told the moment it changes. A page is answered at once with what is known, and waits only for a
|
|
81
|
+
* machine's first answer, and not long.
|
|
82
|
+
*/
|
|
83
|
+
export declare class MachineRunsKept {
|
|
84
|
+
/** Ask the machine for its runs of the project at `address`, since what it answered last: it answers when they change. */
|
|
85
|
+
private readonly ask;
|
|
86
|
+
/** Told each time a machine answered. */
|
|
87
|
+
private readonly seen;
|
|
88
|
+
private readonly now;
|
|
89
|
+
/** Wait before the next ask. */
|
|
90
|
+
private readonly pause;
|
|
91
|
+
private readonly kept;
|
|
92
|
+
private readonly listeners;
|
|
93
|
+
constructor(
|
|
94
|
+
/** Ask the machine for its runs of the project at `address`, since what it answered last: it answers when they change. */
|
|
95
|
+
ask: (machine: AskedMachine, address: string, since: string | undefined) => Promise<unknown>,
|
|
96
|
+
/** Told each time a machine answered. */
|
|
97
|
+
seen?: (machine: AskedMachine, at: string) => void, now?: () => number,
|
|
98
|
+
/** Wait before the next ask. */
|
|
99
|
+
pause?: (ms: number) => Promise<void>);
|
|
100
|
+
/** The machines' runs of the project at `address`, followed from now on for a while: a page reads them every few seconds. */
|
|
101
|
+
of(machines: readonly AskedMachine[], address: string): Promise<MachineRuns[]>;
|
|
102
|
+
/** Follow nothing more: each machine's call is let go once it is answered. */
|
|
103
|
+
stop(): void;
|
|
104
|
+
/** Tell `changed` each time a machine's runs of the project at `address` change, until the answer is called. */
|
|
105
|
+
listen(address: string, changed: () => void): () => void;
|
|
106
|
+
private follow;
|
|
107
|
+
/** Ask once, and keep what the machine said: whether a change a list shows was told, nothing such changed, or it did not answer. */
|
|
108
|
+
private askAgain;
|
|
109
|
+
private tell;
|
|
110
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { AgentMeta, AgentStatus } from '../store/agent-store.js';
|
|
2
|
+
/** One run of a project, as a module sees it: what a page or a card shows of a run, and no more. */
|
|
3
|
+
export interface ModuleAgent {
|
|
4
|
+
/** The run's id, the one `ModuleHost.openAgent` takes. */
|
|
5
|
+
id: string;
|
|
6
|
+
/** The run's branch, the name the agent gave its work, when its record carries one. */
|
|
7
|
+
name?: string;
|
|
8
|
+
/** What the run was asked, as typed or as queued; absent when its record carries none. */
|
|
9
|
+
ask?: string;
|
|
10
|
+
/** How it stands: `unknown` while the computer it runs on does not answer, whatever its record last said. */
|
|
11
|
+
status: AgentStatus;
|
|
12
|
+
/** ISO 8601. */
|
|
13
|
+
startedAt: string;
|
|
14
|
+
/** ISO 8601, once it ended. */
|
|
15
|
+
endedAt?: string;
|
|
16
|
+
/** Its short name, as a list of runs shows it. */
|
|
17
|
+
title?: string;
|
|
18
|
+
/** Whose run it is, by the email its record is kept under. */
|
|
19
|
+
person?: string;
|
|
20
|
+
/** What it cost so far, in US dollars. */
|
|
21
|
+
cost?: number;
|
|
22
|
+
/** The coding agent that runs it (`claude-code`, `codex`, …) and its model. */
|
|
23
|
+
driver?: string;
|
|
24
|
+
model?: string;
|
|
25
|
+
/** The saved machine it runs on, by the name it was given; absent for a run of this computer's. */
|
|
26
|
+
machine?: string;
|
|
27
|
+
/** While its status is `unknown`: when its computer was last seen, ISO, if it was. */
|
|
28
|
+
seenAt?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Which of a project's runs a module asks for, when not all of them: a project keeps every run it
|
|
32
|
+
* ever made, hundreds, and a card shows a few. Both given, a run must be both.
|
|
33
|
+
*/
|
|
34
|
+
export interface ModuleAgentsWanted {
|
|
35
|
+
/** These runs only, by id: the ones holding a claim. */
|
|
36
|
+
ids?: string[];
|
|
37
|
+
/** The runs started at this time or later, ISO 8601: the last 30 days. */
|
|
38
|
+
since?: string;
|
|
39
|
+
}
|
|
40
|
+
/** A run as a module sees it. */
|
|
41
|
+
export declare function moduleAgentOf(agent: AgentMeta): ModuleAgent;
|
|
42
|
+
/** The runs a module asked for, as it sees them. */
|
|
43
|
+
export declare function moduleAgents(agents: readonly AgentMeta[], wanted?: ModuleAgentsWanted): ModuleAgent[];
|
|
@@ -9,11 +9,20 @@ export declare const COMPUTER_MODULES_PREFIX = "/_computer-modules";
|
|
|
9
9
|
export declare function moduleUrl(projectId: string, module: Pick<ProjectModule, 'package' | 'entry'>): string;
|
|
10
10
|
/** The URL the browser part of one of the computer's modules is served at. */
|
|
11
11
|
export declare function computerModuleUrl(module: Pick<ProjectModule, 'package' | 'entry'>): string;
|
|
12
|
+
/**
|
|
13
|
+
* A module's URL with its entry file's version (`?v=`): a browser keeps that file for good, and
|
|
14
|
+
* the next version of the module is another URL. Without the file there to read, the URL as it is.
|
|
15
|
+
*/
|
|
16
|
+
export declare function versionedModuleUrl(url: string, module: Pick<ProjectModule, 'dir' | 'entry'>): Promise<string>;
|
|
12
17
|
/**
|
|
13
18
|
* Serve one module file (#1774): the project must be registered, the package must be a module of
|
|
14
19
|
* that project, and the file must sit inside the module's browser part's own directory. Anything else is a
|
|
15
20
|
* 404, never a fallback: a module URL is asked for by the dashboard's loader, not typed by a person.
|
|
16
|
-
*
|
|
21
|
+
* Asked for with the file's own version ({@link versionedModuleUrl}), it is kept for good: a page
|
|
22
|
+
* opened again does not ask for it at all. Otherwise it is served as `no-cache`, since a module is
|
|
23
|
+
* rebuilt in place under the same name (its stylesheet, a file another of its files imports, a URL
|
|
24
|
+
* naming a version gone since), with a tag of the file's own: a page opened again asks with it and
|
|
25
|
+
* is answered "not changed", with no body. Sent gzipped, a module's code being a page's largest file.
|
|
17
26
|
*/
|
|
18
27
|
export declare function serveModuleFile(req: IncomingMessage, res: ServerResponse, pathname: string, projects?: ProjectsProvider): Promise<void>;
|
|
19
28
|
/** Serve one file of a module that is the computer's: as {@link serveModuleFile}, with no project to be registered. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Health } from '../health.js';
|
|
1
2
|
import { EventStream } from '../event-stream.js';
|
|
2
3
|
import type { OpenAgentEvent } from '../events.js';
|
|
3
4
|
import type { AgentMeta } from '../store/index.js';
|
|
@@ -50,13 +51,15 @@ export type RelayStartResult = StartAgentResult | {
|
|
|
50
51
|
export declare function pingRemote(target: MachineAccess): Promise<boolean>;
|
|
51
52
|
/**
|
|
52
53
|
* What a saved machine says of itself in its ping: the OpenAgent it runs, the computer's own
|
|
53
|
-
* name, which the records of its runs carry,
|
|
54
|
-
* machines it saved. Nothing for a machine that does not answer, or does not say.
|
|
54
|
+
* name, which the records of its runs carry, the ids it is listed under at the doors of the
|
|
55
|
+
* machines it saved, and whether it is a server. Nothing for a machine that does not answer, or does not say.
|
|
55
56
|
*/
|
|
56
57
|
export declare function remoteFacts(target: MachineAccess): Promise<{
|
|
57
58
|
version?: string;
|
|
58
59
|
host?: string;
|
|
59
60
|
listed?: string[];
|
|
61
|
+
server?: true;
|
|
62
|
+
health?: Health;
|
|
60
63
|
}>;
|
|
61
64
|
/** The OpenAgent a saved machine runs, as its ping tells it; nothing for a machine that does not answer, or does not say. */
|
|
62
65
|
export declare function remoteVersion(target: MachineAccess): Promise<string | undefined>;
|
|
@@ -158,7 +161,7 @@ export interface BringProject {
|
|
|
158
161
|
* shape, the same way a failed local read does. A refusal the machine gave a reason for is thrown
|
|
159
162
|
* as a {@link MachineRefusal}, so the reason can be shown in place of that shape's own words.
|
|
160
163
|
*/
|
|
161
|
-
export declare function relayRpc(target: RemoteTarget, fn: string, args: unknown[]): Promise<unknown>;
|
|
164
|
+
export declare function relayRpc(target: RemoteTarget, fn: string, args: unknown[], timeoutMs?: number): Promise<unknown>;
|
|
162
165
|
/**
|
|
163
166
|
* Fetch-stream a remote agent's newline-delimited events into `onEvent` until the remote closes the
|
|
164
167
|
* body, the agent ends, or `cancel()` is called. A 401 (this computer was removed there) ends the stream
|
|
@@ -258,6 +261,18 @@ export declare function remoteAddMachine(machine: MachineAccess, link: string, l
|
|
|
258
261
|
ok: false;
|
|
259
262
|
error: string;
|
|
260
263
|
}>;
|
|
264
|
+
/**
|
|
265
|
+
* Call one of a machine's own machine-wide functions (relay-dispatch.ts), with this computer's key
|
|
266
|
+
* there: through the relay, so a computer reached through a server is asked as a server is. What
|
|
267
|
+
* the machine answers is its own words, to read as data. Why not, when it did not answer.
|
|
268
|
+
*/
|
|
269
|
+
export declare function machineCall(machine: MachineAccess, fn: string, args: unknown[], timeoutMs?: number): Promise<{
|
|
270
|
+
ok: true;
|
|
271
|
+
ret: unknown;
|
|
272
|
+
} | {
|
|
273
|
+
ok: false;
|
|
274
|
+
error: string;
|
|
275
|
+
}>;
|
|
261
276
|
/** The logins this computer's person has on a machine of another person's, as that machine says (machine-logins.ts). */
|
|
262
277
|
export declare function remoteLogins(machine: MachineAccess): Promise<{
|
|
263
278
|
ok: true;
|
|
@@ -8,6 +8,7 @@ import type { ProjectErrorsReader } from '../project-errors.js';
|
|
|
8
8
|
import type { AddProjectResult, RemoveProjectResult, StartAgentOptions, StartAgentResult, StartedInResult } from './types.js';
|
|
9
9
|
import type { AgentMeta } from '../store/index.js';
|
|
10
10
|
import type { RemoteTarget } from './remote-run.js';
|
|
11
|
+
import type { MachineRuns } from './machine-runs.js';
|
|
11
12
|
/** Wired by the daemon so `sendStart` can reach the daemon's own `startAgent` closure. */
|
|
12
13
|
export type StartAgentHandler = (prompt: string, options: StartAgentOptions, projectId?: string) => StartAgentResult | Promise<StartAgentResult>;
|
|
13
14
|
/** Wired by the daemon so `sendAddProject` can install + register a repo (#433). */
|
|
@@ -53,6 +54,10 @@ export interface RemoteAgents {
|
|
|
53
54
|
* it was given and its address. Asked of the machines first, when one has not said its name yet.
|
|
54
55
|
*/
|
|
55
56
|
machineNames(): Promise<(host: string) => SavedMachine | undefined>;
|
|
57
|
+
/** What each saved machine says of its own runs of the project at `projectPath`, followed for a while from now on (machine-runs.ts). */
|
|
58
|
+
machineRuns(projectPath: string): Promise<MachineRuns[]>;
|
|
59
|
+
/** Tell `changed` each time a saved machine's runs of the project at `projectPath` change, until the answer is called. */
|
|
60
|
+
followRuns(projectPath: string, changed: () => void): () => void;
|
|
56
61
|
}
|
|
57
62
|
/**
|
|
58
63
|
* What every RPC acts through.
|
|
@@ -118,8 +123,9 @@ export declare function isExpectedHost(req: IncomingMessage): boolean;
|
|
|
118
123
|
export declare const RPC_PREFIX = "/_rpc";
|
|
119
124
|
/**
|
|
120
125
|
* Mount the dashboard's RPC surface (#405) on the daemon's `node:http` server: `POST /_rpc/<name>`
|
|
121
|
-
* for the calls, `GET /_rpc/events` for the live stream
|
|
122
|
-
* `sendStart` reaches the daemon's own `startAgent`
|
|
126
|
+
* for the calls, `GET /_rpc/events` for the live stream, `GET /_rpc/changes` for when to read the
|
|
127
|
+
* runs again. It runs in the daemon process, so `sendStart` reaches the daemon's own `startAgent`
|
|
128
|
+
* through the wired {@link DashboardContext}.
|
|
123
129
|
*
|
|
124
130
|
* Cross-origin POSTs are rejected (CSRF: a page on evil.com must not steer or start a session), as
|
|
125
131
|
* are requests carrying someone else's `Host` (DNS rebinding: the same page must not reach us by
|