@openagt/dashboard 0.11.0 → 0.13.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.
Files changed (88) hide show
  1. package/dist/built-in.d.ts +15 -6
  2. package/dist/built-in.d.ts.map +1 -1
  3. package/dist/built-in.js +25 -11
  4. package/dist/built-in.js.map +1 -1
  5. package/dist/clone-project.d.ts +69 -0
  6. package/dist/clone-project.d.ts.map +1 -0
  7. package/dist/clone-project.js +124 -0
  8. package/dist/clone-project.js.map +1 -0
  9. package/dist/daemon-runtime.d.ts +11 -1
  10. package/dist/daemon-runtime.d.ts.map +1 -1
  11. package/dist/daemon-runtime.js +56 -3
  12. package/dist/daemon-runtime.js.map +1 -1
  13. package/dist/daemon.js +1 -1
  14. package/dist/daemon.js.map +1 -1
  15. package/dist/dashboard/module-serve.d.ts +6 -0
  16. package/dist/dashboard/module-serve.d.ts.map +1 -1
  17. package/dist/dashboard/module-serve.js +24 -8
  18. package/dist/dashboard/module-serve.js.map +1 -1
  19. package/dist/dashboard/relay-endpoints.d.ts +8 -1
  20. package/dist/dashboard/relay-endpoints.d.ts.map +1 -1
  21. package/dist/dashboard/relay-endpoints.js +48 -1
  22. package/dist/dashboard/relay-endpoints.js.map +1 -1
  23. package/dist/dashboard/remote-run.d.ts +31 -0
  24. package/dist/dashboard/remote-run.d.ts.map +1 -1
  25. package/dist/dashboard/remote-run.js +33 -0
  26. package/dist/dashboard/remote-run.js.map +1 -1
  27. package/dist/dashboard/rpc-serve.d.ts +9 -0
  28. package/dist/dashboard/rpc-serve.d.ts.map +1 -1
  29. package/dist/dashboard/rpc-serve.js +15 -0
  30. package/dist/dashboard/rpc-serve.js.map +1 -1
  31. package/dist/dashboard/server.d.ts +5 -1
  32. package/dist/dashboard/server.d.ts.map +1 -1
  33. package/dist/dashboard/server.js +14 -5
  34. package/dist/dashboard/server.js.map +1 -1
  35. package/dist/dashboard/types.d.ts +11 -3
  36. package/dist/dashboard/types.d.ts.map +1 -1
  37. package/dist/dashboard-bundle/assets/main-Co_A_Ebn.js +140 -0
  38. package/dist/dashboard-bundle/assets/main-DD99HRP9.css +2 -0
  39. package/dist/dashboard-bundle/assets/{module-DKd-4BTU.js → module-ZjyA5WUg.js} +2 -2
  40. package/dist/dashboard-bundle/host/module.js +1 -1
  41. package/dist/dashboard-bundle/index.html +3 -3
  42. package/dist/dashboard-rpc/index.d.ts +3 -3
  43. package/dist/dashboard-rpc/index.d.ts.map +1 -1
  44. package/dist/dashboard-rpc/index.js +3 -3
  45. package/dist/dashboard-rpc/index.js.map +1 -1
  46. package/dist/dashboard-rpc/machines.d.ts +17 -0
  47. package/dist/dashboard-rpc/machines.d.ts.map +1 -1
  48. package/dist/dashboard-rpc/machines.js +47 -2
  49. package/dist/dashboard-rpc/machines.js.map +1 -1
  50. package/dist/dashboard-rpc/modules.d.ts +11 -3
  51. package/dist/dashboard-rpc/modules.d.ts.map +1 -1
  52. package/dist/dashboard-rpc/modules.js +22 -3
  53. package/dist/dashboard-rpc/modules.js.map +1 -1
  54. package/dist/dashboard-rpc/projects.d.ts +16 -0
  55. package/dist/dashboard-rpc/projects.d.ts.map +1 -1
  56. package/dist/dashboard-rpc/projects.js +24 -3
  57. package/dist/dashboard-rpc/projects.js.map +1 -1
  58. package/dist/module-types/dashboard/components/QrCode.d.ts +8 -0
  59. package/dist/module-types/dashboard/module/index.d.ts +11 -4
  60. package/dist/module-types/dashboard/rpc/modules.d.ts +1 -0
  61. package/dist/module-types/src/built-in.d.ts +15 -6
  62. package/dist/module-types/src/clone-project.d.ts +68 -0
  63. package/dist/module-types/src/dashboard/module-serve.d.ts +6 -0
  64. package/dist/module-types/src/dashboard/remote-run.d.ts +31 -0
  65. package/dist/module-types/src/dashboard/rpc-serve.d.ts +9 -0
  66. package/dist/module-types/src/dashboard/types.d.ts +11 -3
  67. package/dist/module-types/src/dashboard-rpc/index.d.ts +3 -3
  68. package/dist/module-types/src/dashboard-rpc/machines.d.ts +17 -0
  69. package/dist/module-types/src/dashboard-rpc/modules.d.ts +11 -3
  70. package/dist/module-types/src/dashboard-rpc/projects.d.ts +16 -0
  71. package/dist/module-types/src/pick-directory.d.ts +2 -0
  72. package/dist/module-types/src/project-modules.d.ts +12 -3
  73. package/dist/module-types/src/repository-address.d.ts +8 -0
  74. package/dist/pick-directory.d.ts +2 -0
  75. package/dist/pick-directory.d.ts.map +1 -1
  76. package/dist/pick-directory.js +7 -1
  77. package/dist/pick-directory.js.map +1 -1
  78. package/dist/project-modules.d.ts +12 -3
  79. package/dist/project-modules.d.ts.map +1 -1
  80. package/dist/project-modules.js +20 -2
  81. package/dist/project-modules.js.map +1 -1
  82. package/dist/repository-address.d.ts +8 -0
  83. package/dist/repository-address.d.ts.map +1 -1
  84. package/dist/repository-address.js +14 -2
  85. package/dist/repository-address.js.map +1 -1
  86. package/package.json +12 -11
  87. package/dist/dashboard-bundle/assets/main-9Xb8Ao4p.css +0 -2
  88. package/dist/dashboard-bundle/assets/main-DTyyQ0jM.js +0 -140
@@ -0,0 +1,68 @@
1
+ /**
2
+ * A project added by its repository's address, for a computer that does not have its folder: a
3
+ * server that was just connected has no screen to pick a folder on and no folder to pick. The
4
+ * repository is cloned into `~/projects/<its name>`, in the home of the user OpenAgent runs as,
5
+ * and that folder is then added like any other. Nothing is asked about where: the page says
6
+ * where it went.
7
+ *
8
+ * git clones with the logins this computer has (its credential helper, its SSH keys) and is
9
+ * never let ask a person for one: a repository it cannot read is refused in words.
10
+ */
11
+ /** Where a repository is cloned from and to. */
12
+ export interface CloneTarget {
13
+ /** What git is given. */
14
+ url: string;
15
+ /** The repository's one name on every machine: see `addressOfRemote`. */
16
+ address: string;
17
+ /** The folder it is cloned into. */
18
+ path: string;
19
+ }
20
+ /**
21
+ * Read what a person typed as a repository's address: `github.com/you/shop`, the same with
22
+ * `https://` before it, `ssh://git@github.com/you/shop.git`, or `git@github.com:you/shop.git`.
23
+ * Undefined for anything else: a folder on this disk, another kind of address, a name that could
24
+ * be read as an option or lead out of the folder projects are cloned into.
25
+ */
26
+ export declare function cloneTarget(typed: string, home?: string): CloneTarget | undefined;
27
+ /** How a clone went: the folder the project is in, and whether it was cloned now or was already there. */
28
+ export type Cloned = {
29
+ ok: true;
30
+ path: string;
31
+ cloned: boolean;
32
+ } | {
33
+ ok: false;
34
+ error: string;
35
+ };
36
+ /** Run git and answer how it ended, with what it said on its error side. */
37
+ export type CloneRunner = (args: readonly string[], env: NodeJS.ProcessEnv, timeoutMs: number) => Promise<{
38
+ ok: true;
39
+ } | {
40
+ ok: false;
41
+ said: string;
42
+ timedOut: boolean;
43
+ }>;
44
+ /** Where what a person typed would be cloned to, before anything is cloned: what the page shows to be confirmed. */
45
+ export declare function cloneTargetOf(typed: string, home?: string): {
46
+ ok: true;
47
+ address: string;
48
+ path: string;
49
+ } | {
50
+ ok: false;
51
+ error: string;
52
+ };
53
+ export interface CloneOptions {
54
+ home?: string;
55
+ run?: CloneRunner;
56
+ env?: NodeJS.ProcessEnv;
57
+ timeoutMs?: number;
58
+ /** The person's own way to SSH for git, when they set one; read off git's settings when unsaid. */
59
+ sshCommand?: (env: NodeJS.ProcessEnv) => Promise<string | undefined>;
60
+ }
61
+ /**
62
+ * Clone the repository a person typed the address of into `~/projects/<its name>`. A folder that
63
+ * is already there and holds this very repository is taken as it is; one that holds anything
64
+ * else is never written over, and is refused. The clone is made beside that folder and moved
65
+ * there once it is whole: a clone that fails leaves nothing behind, and one on its way is no
66
+ * folder a second ask could take for the project.
67
+ */
68
+ export declare function cloneProject(typed: string, opts?: CloneOptions): Promise<Cloned>;
@@ -3,8 +3,12 @@ import { type ProjectsProvider } from './projects.js';
3
3
  import { type ProjectModule } from '../project-modules.js';
4
4
  /** Where module files are served: `/_modules/<project id>/<package>/<file>`, each segment encoded. */
5
5
  export declare const MODULES_PREFIX = "/_modules";
6
+ /** Where the files of the computer's modules are served, which are no project's: `/_computer-modules/<package>/<file>`. */
7
+ export declare const COMPUTER_MODULES_PREFIX = "/_computer-modules";
6
8
  /** The URL a module's browser part is served at from one project. */
7
9
  export declare function moduleUrl(projectId: string, module: Pick<ProjectModule, 'package' | 'entry'>): string;
10
+ /** The URL the browser part of one of the computer's modules is served at. */
11
+ export declare function computerModuleUrl(module: Pick<ProjectModule, 'package' | 'entry'>): string;
8
12
  /**
9
13
  * Serve one module file (#1774): the project must be registered, the package must be a module of
10
14
  * that project, and the file must sit inside the module's browser part's own directory. Anything else is a
@@ -12,3 +16,5 @@ export declare function moduleUrl(projectId: string, module: Pick<ProjectModule,
12
16
  * Served as `no-cache`, since a module is rebuilt in place under the same name.
13
17
  */
14
18
  export declare function serveModuleFile(req: IncomingMessage, res: ServerResponse, pathname: string, projects?: ProjectsProvider): Promise<void>;
19
+ /** Serve one file of a module that is the computer's: as {@link serveModuleFile}, with no project to be registered. */
20
+ export declare function serveComputerModuleFile(req: IncomingMessage, res: ServerResponse, pathname: string): Promise<void>;
@@ -76,6 +76,37 @@ export declare function leaveRemote(machine: MachineAccess & {
76
76
  * not special-case remote errors.
77
77
  */
78
78
  export declare function startRemoteAgent(target: RemoteTarget, body: RelayStartBody): Promise<RelayStartResult>;
79
+ /**
80
+ * Where a project a machine was asked for stands there: `there` once it is among its projects,
81
+ * `coming` while the machine clones it, `failed` with the machine's words when the clone or the
82
+ * add did not go through, and `missing` when the machine has no such project and is not at work
83
+ * on one.
84
+ */
85
+ export type RelayProject = {
86
+ state: 'there' | 'coming' | 'missing';
87
+ } | {
88
+ state: 'failed';
89
+ error: string;
90
+ };
91
+ /**
92
+ * Ask a machine about its copy of the project `target` names, and with `bring` have it clone the
93
+ * project when it has none: the machine answers at once and clones on its own, so this is asked
94
+ * again until it says `there`. `share` is this computer's own answer on the agents' records for
95
+ * the project, which the machine's copy takes, and `from` the address in the letters this
96
+ * computer's copy was cloned with. A machine that could not be asked is `unasked`, in this
97
+ * computer's words; `failed` carries the machine's own.
98
+ */
99
+ export declare function remoteProject(target: RemoteTarget, bring?: BringProject): Promise<RelayProject | {
100
+ state: 'unasked';
101
+ error: string;
102
+ }>;
103
+ /** What a machine is given to clone a project it does not have. */
104
+ export interface BringProject {
105
+ /** This computer's answer on the agents' records for the project: whether they may go to the repository's remote. */
106
+ share: boolean;
107
+ /** The address in the letters this computer's copy was cloned with; the machine clones from it when it reads as the project's. */
108
+ from?: string;
109
+ }
79
110
  /**
80
111
  * Relay one run-scoped RPC to the machine that owns a remote agent (#1067 slice 2). The local daemon
81
112
  * holds this computer's key there, so a read/diff/handoff/push/PR for a relayed agent runs ON the machine: POST
@@ -67,6 +67,15 @@ export interface DashboardContext {
67
67
  * the mount, its only caller.
68
68
  */
69
69
  export declare function isSameOriginRequest(req: IncomingMessage): boolean;
70
+ /**
71
+ * The third guard: a call says its body is JSON. {@link isSameOriginRequest} lets every loopback
72
+ * origin pass, whatever its port, so a page another program serves on this computer (an app an
73
+ * agent previews, a dev server) is let through it. A browser sends such a page's POST without
74
+ * asking only while its content type is one a plain form can have, and JSON is none of them:
75
+ * with JSON it asks first, this server never says yes, and the call is not sent. So a call that
76
+ * is not JSON is refused, and no page of another origin can make one, not even blind.
77
+ */
78
+ export declare function isJsonRequest(req: IncomingMessage): boolean;
70
79
  /**
71
80
  * DNS-rebinding guard, the other half of the CSRF check above. A page on `evil.com` whose DNS
72
81
  * re-answers as `127.0.0.1` is *same-origin* with this server as far as the browser is concerned,
@@ -22,7 +22,8 @@ export type DeleteAgentResult = {
22
22
  export type AddProjectResult = {
23
23
  ok: true;
24
24
  alreadyActivated: boolean;
25
- noRemote?: true;
25
+ noRemote?: true; /** For a project added by its repository's address: the folder it is in. */
26
+ path?: string;
26
27
  } | {
27
28
  ok: false;
28
29
  error: string;
@@ -56,10 +57,12 @@ export type RemoveProjectResult = {
56
57
  * never discloses its filesystem layout.
57
58
  */
58
59
  export interface OnboardingSuggestion {
59
- /** The server's working directory, or null when it cannot be offered. */
60
+ /** The server's working directory, or null when it cannot be offered: the home folder is where a service runs, not a project. */
60
61
  cwd: string | null;
61
62
  /** The project id for {@link cwd} when it is already registered, else null. */
62
63
  cwdProjectId: string | null;
64
+ /** Whether this computer can show a window to pick a folder in: one with no screen, as a server, cannot. */
65
+ canPickFolder: boolean;
63
66
  }
64
67
  /**
65
68
  * What a Start carries besides its prompt (#1774): the person's picks, handed to the project's
@@ -91,13 +94,18 @@ export interface StartAgentOptions {
91
94
  */
92
95
  machine?: string;
93
96
  }
94
- /** The outcome of a Start attempt (#345): the id of the run the project's start hook began, or why there is none. */
97
+ /**
98
+ * The outcome of a Start attempt (#345): the id of the run the project's start hook began, or why
99
+ * there is none. `notThere` marks the one refusal a page can do something about: the machine the
100
+ * run was sent to does not have the project yet, and can clone it.
101
+ */
95
102
  export type StartAgentResult = {
96
103
  ok: true;
97
104
  agentId: string;
98
105
  } | {
99
106
  ok: false;
100
107
  error: string;
108
+ notThere?: true;
101
109
  };
102
110
  /**
103
111
  * Where a session is working (#798): its checkout, its branch, and what it is holding. Read by
@@ -1,13 +1,13 @@
1
1
  export { onAgents, onAgent, onAgentsDoing, onDocs, onQueue, onOverview, onRecentAgents, onInterventions, onOpenQuestions, onActivity, onDashboard, onGitHostHome, onRepositoryOffer, onGitStatus, onProjectFiles, onRetainedWorktrees, onAgentWorktree, onAgentHandoff, onBridgeQuestion, onBridgeStatus, onBridgeToken, onBridgeEvents, onBridgeAnswer, onBridgeBrowser } from './reads.js';
2
2
  export { sendStop, sendChoice, sendBridgeAnswer, sendBridgeAnswerCancel, sendBridgeBrowser, sendMessage, sendStart, sendOpenInApp, sendRemoveWorktree, sendDeleteAgent, sendOpenPullRequest, sendPush, sendMergeBranch, sendMerge, sendCreateRepository } from './control.js';
3
3
  export { streamAgentEvents, type LiveFeedEvent, type PartialMessage, type StreamSync } from './events.js';
4
- export { onProjects, sendAddProject, sendRemoveProject, onRecordsReach, sendShareRecords, sendPickProjectDirectory, onOnboarding, onCommands, onStartCheck, type ProjectLauncher } from './projects.js';
4
+ export { onProjects, sendAddProject, onCloneTarget, sendAddProjectFromAddress, sendRemoveProject, onRecordsReach, sendShareRecords, sendPickProjectDirectory, onOnboarding, onCommands, onStartCheck, type ProjectLauncher } from './projects.js';
5
5
  export { onPreferences, savePreferences, patchPreferences, onProjectPresets, saveProjectPresets, onEditors, type SavePreferencesResult, type PatchPreferencesResult, } from './preferences.js';
6
6
  export { type EditorInfo } from '../dashboard/open-in-app.js';
7
7
  export { onQuota } from './quota.js';
8
8
  export { onModels } from './models.js';
9
- export { onMachines, sendAddMachine, sendRemoveMachine, onMachinesReachable, onMachineVersions, type Machine, type AddMachineResult, type MachineVersions } from './machines.js';
10
- export { onModules, runModuleCommand, readModule, type DashboardModule, type ModuleCommandResult, type ModuleReadResult } from './modules.js';
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';
11
11
  export { onProjectSkills, sendChangeSkills, sendCommitSkills, type ProjectSkills, type ProjectSkill, type ChangeSkillsResult } from './skills.js';
12
12
  import { streamAgentEvents } from './events.js';
13
13
  /** One RPC: called with whatever the browser sent, answering with whatever JSON.stringify keeps. */
@@ -49,3 +49,20 @@ export interface MachineVersions {
49
49
  * that a machine fell behind this computer. One short call to each, with this computer's key.
50
50
  */
51
51
  export declare function onMachineVersions(): Promise<MachineVersions>;
52
+ /** Whether a saved machine has a project of this computer's: `there` is false while the machine clones it. */
53
+ export type ProjectOnMachine = {
54
+ ok: true;
55
+ there: boolean;
56
+ } | {
57
+ ok: false;
58
+ error: string;
59
+ };
60
+ /**
61
+ * Have a saved machine clone a project of this computer's that it does not have, from the
62
+ * project's repository address and with the machine's own logins: what a run sent there waits
63
+ * for, the first time. The machine clones on its own; {@link onProjectOnMachine} says when the
64
+ * project is there. Nothing happens on a machine that has it, or is cloning it already.
65
+ */
66
+ export declare function sendProjectToMachine(projectId: string, machineId: string): Promise<ProjectOnMachine>;
67
+ /** Whether a saved machine has the project by now, or why it will not: asked while the machine clones it. */
68
+ export declare function onProjectOnMachine(projectId: string, machineId: string): Promise<ProjectOnMachine>;
@@ -6,13 +6,14 @@ export type { ModuleReadResult } from '../dashboard/module-host.js';
6
6
  export interface DashboardModule {
7
7
  /** The package that brings it. */
8
8
  package: string;
9
- /** The URL of its browser module, served from the first project that has it. */
9
+ /** The URL of its browser module, served from the first project that has it, or from OpenAgent's own copy for one of the computer's. */
10
10
  url: string;
11
- /** The registered projects whose packages include it, in the registry's order. */
11
+ /** The registered projects whose packages include it, in the registry's order; none for one of the computer's, whose commands run in no project. */
12
12
  projects: string[];
13
13
  }
14
14
  /**
15
- * Every module any registered project brings (#1774), one per package, with the projects
15
+ * Every module the dashboard loads (#1774), one per package. First the computer's, which are
16
+ * there with no project added. Then every module any registered project brings, with the projects
16
17
  * that have it: with no project picked the sidebar and the pages are every project's, and the
17
18
  * dashboard narrows them itself to a picked project's. A package several projects install is loaded once, from
18
19
  * the first of them in the registry's order; its page then reads each project through that
@@ -34,6 +35,13 @@ export declare function onModules(): Promise<DashboardModule[]>;
34
35
  * write only at the next sync.
35
36
  */
36
37
  export declare function runModuleCommand(projectId: string, pkg: string, args: string[], command?: string, acts?: boolean): Promise<ModuleCommandResult>;
38
+ /**
39
+ * Run one of the commands of a package that is this computer's, in no project, and answer its
40
+ * JSON output: how the door's page and the servers' page read and change what they keep, which is
41
+ * in the person's home folder, where the command runs. Refused for any other package: a project's
42
+ * module runs its commands in its project ({@link runModuleCommand}).
43
+ */
44
+ export declare function runComputerCommand(pkg: string, args: string[], command?: string): Promise<ModuleCommandResult>;
37
45
  /**
38
46
  * Call read `name` of a module's server part in one project: how a module's browser part reads
39
47
  * what a command cannot answer fast enough. Refused for an unknown project, a package that is not
@@ -15,6 +15,22 @@ export declare function onProjects(): Promise<ProjectSummary[]>;
15
15
  * repository's remote. Nothing is pushed for a project added with `false`.
16
16
  */
17
17
  export declare function sendAddProject(path: string, share: boolean): Promise<AddProjectResult>;
18
+ /** Where the repository a person typed the address of would be cloned to on this computer, or why what was typed is no address: asked before anything is cloned. */
19
+ export declare function onCloneTarget(address: string): Promise<{
20
+ ok: true;
21
+ address: string;
22
+ path: string;
23
+ } | {
24
+ ok: false;
25
+ error: string;
26
+ }>;
27
+ /**
28
+ * Add a project by its repository's address, for a computer that does not have its folder: the
29
+ * repository is cloned into `~/projects/<its name>` with the logins this computer has, and the
30
+ * folder is then added as {@link sendAddProject} adds one. A folder already there with this
31
+ * repository in it is added as it is. The answer says where the project is.
32
+ */
33
+ export declare function sendAddProjectFromAddress(address: string, share: boolean): Promise<AddProjectResult>;
18
34
  /**
19
35
  * Remove a project from the dashboard: it leaves the Projects list. Nothing in its folder is
20
36
  * deleted unless `files` is true: then what OpenAgent left there is removed too, and the answer
@@ -19,6 +19,8 @@ export type DialogRun = {
19
19
  };
20
20
  /** Injectable seam so tests never open a real dialog. */
21
21
  export type DialogRunner = (command: string, args: string[]) => Promise<DialogRun>;
22
+ /** Whether this computer has a screen a folder dialog can open on: asked before one is offered. */
23
+ export declare function canPickDirectory(platform?: NodeJS.Platform, env?: NodeJS.ProcessEnv): boolean;
22
24
  /**
23
25
  * Open the OS folder picker and wait for the user's choice.
24
26
  *
@@ -4,7 +4,8 @@ import { type PackageCommandResult } from '@openagt/agent-data';
4
4
  * `exports["./dashboard"]`, and optionally its server part, named by `exports["./server"]`.
5
5
  * Any dependency of the project that exports `./dashboard` is a module, whoever wrote it, and the
6
6
  * packages OpenAgent brings itself come the same way, for the projects that have them
7
- * (`built-in.ts`).
7
+ * (`built-in.ts`). A package that is this computer's is a module of no project: see
8
+ * {@link readComputerModules}.
8
9
  */
9
10
  export interface ProjectModule {
10
11
  /** The package's name. */
@@ -15,7 +16,7 @@ export interface ProjectModule {
15
16
  dir: string;
16
17
  /** The module's browser part's file name inside {@link dir}. */
17
18
  entry: string;
18
- /** The package's commands, by name, as absolute paths: what the module may run in this project. */
19
+ /** The package's commands, by name, as absolute paths: what the module may run, in this project or, for one of the computer's, in none. */
19
20
  bins: Record<string, string>;
20
21
  /** The module's server part, an absolute path inside the package, when it has one. */
21
22
  server?: string;
@@ -29,6 +30,13 @@ export interface ProjectModule {
29
30
  export declare function readProjectModules(root: string): Promise<ProjectModule[]>;
30
31
  /** The one module of this project that `name` names, or undefined. */
31
32
  export declare function findProjectModule(root: string, name: string): Promise<ProjectModule | undefined>;
33
+ /**
34
+ * The modules that are this computer's and no project's: the ones among the packages OpenAgent
35
+ * brings for the computer (`built-in.ts`). They are there with no project added. Sorted by name.
36
+ */
37
+ export declare function readComputerModules(): Promise<ProjectModule[]>;
38
+ /** The one module of this computer's that `name` names, or undefined. */
39
+ export declare function findComputerModule(name: string): Promise<ProjectModule | undefined>;
32
40
  /**
33
41
  * The file a module serves at `rel`, a path relative to its module's directory: its module, its
34
42
  * stylesheet, a chunk. `undefined` for a path that leaves that directory (symlinks resolved) or
@@ -43,7 +51,8 @@ export type ModuleCommandResult = PackageCommandResult;
43
51
  * (`npx @openagt/skill-logs@0.1`), so the module and the agent see the same thing and OpenAgent knows neither.
44
52
  *
45
53
  * `command` picks one of the package's commands; a package with exactly one needs none. The
46
- * command runs with Node (a package's commands are Node scripts), in the project root, never
54
+ * command runs with Node (a package's commands are Node scripts), in `root` (the project's, or
55
+ * the person's home folder for a module of the computer's), never
47
56
  * through a shell, bounded in time and output. Refused: a command the package does not have, too
48
57
  * many or too long arguments. A command that exits non-zero answers its last stderr line; one that
49
58
  * prints no JSON says so.
@@ -14,9 +14,17 @@ import { type GitRunner } from '@openagt/agent-data';
14
14
  * does not have it.
15
15
  */
16
16
  export declare function addressOfRemote(remote: string): string | undefined;
17
+ /**
18
+ * A remote's `host/path` in the letters it was written with: what another machine is given to
19
+ * clone the repository from, since not every host matches names without regard to case. Undefined
20
+ * wherever {@link addressOfRemote} is.
21
+ */
22
+ export declare function spellingOfRemote(remote: string): string | undefined;
17
23
  /**
18
24
  * The address of the repository at `cwd`: its `origin` remote, the one every push goes to. A
19
25
  * project with no `origin`, or one that is a folder on this disk, has none and runs on this
20
26
  * machine only.
21
27
  */
22
28
  export declare function repositoryAddress(cwd: string, git?: GitRunner): Promise<string | undefined>;
29
+ /** The same address in the letters the `origin` remote is written with: see {@link spellingOfRemote}. */
30
+ export declare function repositorySpelling(cwd: string, git?: GitRunner): Promise<string | undefined>;
@@ -19,6 +19,8 @@ export type DialogRun = {
19
19
  };
20
20
  /** Injectable seam so tests never open a real dialog. */
21
21
  export type DialogRunner = (command: string, args: string[]) => Promise<DialogRun>;
22
+ /** Whether this computer has a screen a folder dialog can open on: asked before one is offered. */
23
+ export declare function canPickDirectory(platform?: NodeJS.Platform, env?: NodeJS.ProcessEnv): boolean;
22
24
  /**
23
25
  * Open the OS folder picker and wait for the user's choice.
24
26
  *
@@ -1 +1 @@
1
- {"version":3,"file":"pick-directory.d.ts","sourceRoot":"","sources":["../src/pick-directory.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,kIAAkI;AAClI,MAAM,MAAM,mBAAmB,GAC3B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GACjC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAEhC,wDAAwD;AACxD,MAAM,MAAM,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAExE,yDAAyD;AACzD,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,SAAS,CAAC,CAAA;AA2ElF;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,QAAQ,GAAE,MAAM,CAAC,QAA2B,EAC5C,GAAG,GAAE,YAA+B,EACpC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,OAAO,CAAC,mBAAmB,CAAC,CAW9B"}
1
+ {"version":3,"file":"pick-directory.d.ts","sourceRoot":"","sources":["../src/pick-directory.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,kIAAkI;AAClI,MAAM,MAAM,mBAAmB,GAC3B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GACjC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAEhC,wDAAwD;AACxD,MAAM,MAAM,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAExE,yDAAyD;AACzD,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,SAAS,CAAC,CAAA;AA2ElF,mGAAmG;AACnG,wBAAgB,gBAAgB,CAAC,QAAQ,GAAE,MAAM,CAAC,QAA2B,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAG5H;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,QAAQ,GAAE,MAAM,CAAC,QAA2B,EAC5C,GAAG,GAAE,YAA+B,EACpC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,OAAO,CAAC,mBAAmB,CAAC,CAW9B"}
@@ -61,6 +61,12 @@ const nodeDialogRunner = (command, args) => new Promise(done => {
61
61
  done({ code: error ? exitCode(error) : 0, stdout: String(stdout), stderr: String(stderr) });
62
62
  });
63
63
  });
64
+ /** Whether this computer has a screen a folder dialog can open on: asked before one is offered. */
65
+ export function canPickDirectory(platform = process.platform, env = process.env) {
66
+ if (platform === 'darwin' || platform === 'win32')
67
+ return true;
68
+ return platform === 'linux' && Boolean(env.DISPLAY || env.WAYLAND_DISPLAY);
69
+ }
64
70
  /**
65
71
  * Open the OS folder picker and wait for the user's choice.
66
72
  *
@@ -76,7 +82,7 @@ export async function pickDirectory(platform = process.platform, run = nodeDialo
76
82
  if (platform === 'linux') {
77
83
  // A dialog needs a screen to appear on, and a daemon started over SSH or inside a container has
78
84
  // none — saying so beats spawning a helper that can only fail.
79
- if (!env.DISPLAY && !env.WAYLAND_DISPLAY)
85
+ if (!canPickDirectory(platform, env))
80
86
  return { ok: false, error: 'The machine running OpenAgent has no desktop session, so no folder dialog can open there.' };
81
87
  return openDialog(linuxDialogs(env.HOME ?? '.'), run);
82
88
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pick-directory.js","sourceRoot":"","sources":["../src/pick-directory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA0B,MAAM,oBAAoB,CAAA;AAmBrE,gHAAgH;AAChH,MAAM,aAAa,GAAG,GAAG,CAAA;AAEzB,0HAA0H;AAC1H,MAAM,iBAAiB,GAAG,CAAC,CAAA;AAE3B,4DAA4D;AAC5D,MAAM,MAAM,GAAG,6CAA6C,CAAA;AAK5D,qFAAqF;AACrF,MAAM,SAAS,GAAW;IACxB,OAAO,EAAE,WAAW;IACpB,IAAI,EAAE,CAAC,IAAI,EAAE,6CAA6C,MAAM,IAAI,CAAC;IACrE,qGAAqG;IACrG,SAAS,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;CAC9C,CAAA;AAED;;;;GAIG;AACH,MAAM,aAAa,GAAW;IAC5B,OAAO,EAAE,gBAAgB;IACzB,IAAI,EAAE;QACJ,YAAY;QACZ,MAAM;QACN,UAAU;QACV;YACE,6CAA6C;YAC7C,+DAA+D;YAC/D,0BAA0B,MAAM,GAAG;YACnC,sCAAsC;YACtC,8GAA8G,iBAAiB,IAAI;SACpI,CAAC,IAAI,CAAC,IAAI,CAAC;KACb;IACD,SAAS,EAAE,GAAG,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CAAA;AAC1F,CAAC;AAED,uGAAuG;AACvG,KAAK,UAAU,UAAU,CAAC,OAAiB,EAAE,GAAiB;IAC5D,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;QACrD,IAAI,MAAM,CAAC,IAAI,KAAK,aAAa;YAAE,SAAQ;QAC3C,IAAI,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC;YAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;QAC7D,IAAI,MAAM,CAAC,IAAI,KAAK,CAAC;YAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,wCAAwC,EAAE,CAAA;QACpH,4FAA4F;QAC5F,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;QACzD,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,qCAAqC,EAAE,CAAA;IAChG,CAAC;IACD,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAChE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,2BAA2B,KAAK,gEAAgE,EAAE,CAAA;AAC/H,CAAC"}
@@ -4,7 +4,8 @@ import { type PackageCommandResult } from '@openagt/agent-data';
4
4
  * `exports["./dashboard"]`, and optionally its server part, named by `exports["./server"]`.
5
5
  * Any dependency of the project that exports `./dashboard` is a module, whoever wrote it, and the
6
6
  * packages OpenAgent brings itself come the same way, for the projects that have them
7
- * (`built-in.ts`).
7
+ * (`built-in.ts`). A package that is this computer's is a module of no project: see
8
+ * {@link readComputerModules}.
8
9
  */
9
10
  export interface ProjectModule {
10
11
  /** The package's name. */
@@ -15,7 +16,7 @@ export interface ProjectModule {
15
16
  dir: string;
16
17
  /** The module's browser part's file name inside {@link dir}. */
17
18
  entry: string;
18
- /** The package's commands, by name, as absolute paths: what the module may run in this project. */
19
+ /** The package's commands, by name, as absolute paths: what the module may run, in this project or, for one of the computer's, in none. */
19
20
  bins: Record<string, string>;
20
21
  /** The module's server part, an absolute path inside the package, when it has one. */
21
22
  server?: string;
@@ -29,6 +30,13 @@ export interface ProjectModule {
29
30
  export declare function readProjectModules(root: string): Promise<ProjectModule[]>;
30
31
  /** The one module of this project that `name` names, or undefined. */
31
32
  export declare function findProjectModule(root: string, name: string): Promise<ProjectModule | undefined>;
33
+ /**
34
+ * The modules that are this computer's and no project's: the ones among the packages OpenAgent
35
+ * brings for the computer (`built-in.ts`). They are there with no project added. Sorted by name.
36
+ */
37
+ export declare function readComputerModules(): Promise<ProjectModule[]>;
38
+ /** The one module of this computer's that `name` names, or undefined. */
39
+ export declare function findComputerModule(name: string): Promise<ProjectModule | undefined>;
32
40
  /**
33
41
  * The file a module serves at `rel`, a path relative to its module's directory: its module, its
34
42
  * stylesheet, a chunk. `undefined` for a path that leaves that directory (symlinks resolved) or
@@ -43,7 +51,8 @@ export type ModuleCommandResult = PackageCommandResult;
43
51
  * (`npx @openagt/skill-logs@0.1`), so the module and the agent see the same thing and OpenAgent knows neither.
44
52
  *
45
53
  * `command` picks one of the package's commands; a package with exactly one needs none. The
46
- * command runs with Node (a package's commands are Node scripts), in the project root, never
54
+ * command runs with Node (a package's commands are Node scripts), in `root` (the project's, or
55
+ * the person's home folder for a module of the computer's), never
47
56
  * through a shell, bounded in time and output. Refused: a command the package does not have, too
48
57
  * many or too long arguments. A command that exits non-zero answers its last stderr line; one that
49
58
  * prints no JSON says so.
@@ -1 +1 @@
1
- {"version":3,"file":"project-modules.d.ts","sourceRoot":"","sources":["../src/project-modules.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkC,KAAK,oBAAoB,EAAuB,MAAM,qBAAqB,CAAA;AAGpH;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,0BAA0B;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,4GAA4G;IAC5G,GAAG,EAAE,MAAM,CAAA;IACX,gEAAgE;IAChE,KAAK,EAAE,MAAM,CAAA;IACb,mGAAmG;IACnG,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5B,sFAAsF;IACtF,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AA4BD;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAO/E;AAgBD,sEAAsE;AACtE,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAEtG;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAKhG;AAED,+EAA+E;AAC/E,MAAM,MAAM,mBAAmB,GAAG,oBAAoB,CAAA;AAMtD;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,mBAAmB,CAAC,CAS9B"}
1
+ {"version":3,"file":"project-modules.d.ts","sourceRoot":"","sources":["../src/project-modules.ts"],"names":[],"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BAAmB,CAAC,CAS9B"}
@@ -1,7 +1,7 @@
1
1
  import { realpath, stat } from 'node:fs/promises';
2
2
  import { dirname, join, normalize, sep } from 'node:path';
3
3
  import { packageBins, runPackageCommand } from '@openagt/agent-data';
4
- import { builtInPackagesOf, ownPackages } from './built-in.js';
4
+ import { builtInPackagesOf, computerPackages, ownPackages } from './built-in.js';
5
5
  /** The file an `exports[key]` entry names: a plain path, or the first of `conditions` it has. */
6
6
  function exportedFile(exports, key, conditions) {
7
7
  if (!exports || typeof exports !== 'object' || Array.isArray(exports))
@@ -64,6 +64,23 @@ async function readModule({ name, dir: pkgDir, manifest: pkg }) {
64
64
  export async function findProjectModule(root, name) {
65
65
  return (await readProjectModules(root)).find(module => module.package === name);
66
66
  }
67
+ /**
68
+ * The modules that are this computer's and no project's: the ones among the packages OpenAgent
69
+ * brings for the computer (`built-in.ts`). They are there with no project added. Sorted by name.
70
+ */
71
+ export async function readComputerModules() {
72
+ const modules = [];
73
+ for (const pkg of await computerPackages()) {
74
+ const module = await readModule(pkg);
75
+ if (module)
76
+ modules.push(module);
77
+ }
78
+ return modules.sort((a, b) => a.package.localeCompare(b.package));
79
+ }
80
+ /** The one module of this computer's that `name` names, or undefined. */
81
+ export async function findComputerModule(name) {
82
+ return (await readComputerModules()).find(module => module.package === name);
83
+ }
67
84
  /**
68
85
  * The file a module serves at `rel`, a path relative to its module's directory: its module, its
69
86
  * stylesheet, a chunk. `undefined` for a path that leaves that directory (symlinks resolved) or
@@ -86,7 +103,8 @@ const MAX_ARG_LENGTH = 4096;
86
103
  * (`npx @openagt/skill-logs@0.1`), so the module and the agent see the same thing and OpenAgent knows neither.
87
104
  *
88
105
  * `command` picks one of the package's commands; a package with exactly one needs none. The
89
- * command runs with Node (a package's commands are Node scripts), in the project root, never
106
+ * command runs with Node (a package's commands are Node scripts), in `root` (the project's, or
107
+ * the person's home folder for a module of the computer's), never
90
108
  * through a shell, bounded in time and output. Refused: a command the package does not have, too
91
109
  * many or too long arguments. A command that exits non-zero answers its last stderr line; one that
92
110
  * prints no JSON says so.
@@ -1 +1 @@
1
- {"version":3,"file":"project-modules.js","sourceRoot":"","sources":["../src/project-modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAkD,MAAM,qBAAqB,CAAA;AACpH,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAwB9D,iGAAiG;AACjG,SAAS,YAAY,CAAC,OAAgB,EAAE,GAAW,EAAE,UAA6B;IAChF,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QAAE,OAAO,SAAS,CAAA;IACvF,MAAM,KAAK,GAAI,OAAmC,CAAC,GAAG,CAAC,CAAA;IACvD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IAC3C,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAA;IACjF,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,MAAM,MAAM,GAAI,KAAiC,CAAC,SAAS,CAAC,CAAA;QAC5D,IAAI,OAAO,MAAM,KAAK,QAAQ;YAAE,OAAO,MAAM,CAAA;IAC/C,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,4EAA4E;AAC5E,SAAS,MAAM,CAAC,GAAW,EAAE,IAAY;IACvC,OAAO,IAAI,KAAK,GAAG,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,GAAG,GAAG,CAAC,CAAA;AACnD,CAAC;AAED,qHAAqH;AACrH,KAAK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AA;IAClM,IAAI,IAAI,CAAC,MAAM,GAAG,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM,GAAG,cAAc,CAAC;QACpG,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,gCAAgC,EAAE,CAAA;IAC/D,OAAO,iBAAiB,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,IAAK,EAAE,GAAG,EAAE,EAAE,IAAI,CAAC,CAAA;AAC5D,CAAC"}
@@ -14,10 +14,18 @@ import { type GitRunner } from '@openagt/agent-data';
14
14
  * does not have it.
15
15
  */
16
16
  export declare function addressOfRemote(remote: string): string | undefined;
17
+ /**
18
+ * A remote's `host/path` in the letters it was written with: what another machine is given to
19
+ * clone the repository from, since not every host matches names without regard to case. Undefined
20
+ * wherever {@link addressOfRemote} is.
21
+ */
22
+ export declare function spellingOfRemote(remote: string): string | undefined;
17
23
  /**
18
24
  * The address of the repository at `cwd`: its `origin` remote, the one every push goes to. A
19
25
  * project with no `origin`, or one that is a folder on this disk, has none and runs on this
20
26
  * machine only.
21
27
  */
22
28
  export declare function repositoryAddress(cwd: string, git?: GitRunner): Promise<string | undefined>;
29
+ /** The same address in the letters the `origin` remote is written with: see {@link spellingOfRemote}. */
30
+ export declare function repositorySpelling(cwd: string, git?: GitRunner): Promise<string | undefined>;
23
31
  //# sourceMappingURL=repository-address.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"repository-address.d.ts","sourceRoot":"","sources":["../src/repository-address.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAEnE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAWlE;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,GAAE,SAA2B,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAElH"}
1
+ {"version":3,"file":"repository-address.d.ts","sourceRoot":"","sources":["../src/repository-address.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAEnE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAElE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAWnE;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,GAAE,SAA2B,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAElH;AAED,yGAAyG;AACzG,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,GAAE,SAA2B,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAEnH"}
@@ -14,6 +14,14 @@ import { nodeGitRunner } from '@openagt/agent-data';
14
14
  * does not have it.
15
15
  */
16
16
  export function addressOfRemote(remote) {
17
+ return spellingOfRemote(remote)?.toLowerCase();
18
+ }
19
+ /**
20
+ * A remote's `host/path` in the letters it was written with: what another machine is given to
21
+ * clone the repository from, since not every host matches names without regard to case. Undefined
22
+ * wherever {@link addressOfRemote} is.
23
+ */
24
+ export function spellingOfRemote(remote) {
17
25
  const url = remote.trim().replace(/[?#].*$/, '');
18
26
  // `git@host:path`, the scp-like form: no scheme, a colon before the path.
19
27
  const scp = /^(?:[^/\s]*@)?([^:/\s@]+):(?!\/\/)(.+)$/.exec(url);
@@ -24,8 +32,8 @@ export function addressOfRemote(remote) {
24
32
  // One letter before a colon is a drive (`C:\repo`), a folder on this disk.
25
33
  if (host === undefined || rest === undefined || host.length < 2)
26
34
  return undefined;
27
- const path = rest.replace(/\/+$/, '').replace(/\.git$/i, '').replace(/^\/+|\/+$/g, '').toLowerCase();
28
- return path ? `${host.toLowerCase()}/${path}` : undefined;
35
+ const path = rest.replace(/\/+$/, '').replace(/\.git$/i, '').replace(/^\/+|\/+$/g, '');
36
+ return path ? `${host}/${path}` : undefined;
29
37
  }
30
38
  /**
31
39
  * The address of the repository at `cwd`: its `origin` remote, the one every push goes to. A
@@ -35,4 +43,8 @@ export function addressOfRemote(remote) {
35
43
  export async function repositoryAddress(cwd, git = nodeGitRunner()) {
36
44
  return git(['remote', 'get-url', 'origin'], cwd).then(addressOfRemote, () => undefined);
37
45
  }
46
+ /** The same address in the letters the `origin` remote is written with: see {@link spellingOfRemote}. */
47
+ export async function repositorySpelling(cwd, git = nodeGitRunner()) {
48
+ return git(['remote', 'get-url', 'origin'], cwd).then(spellingOfRemote, () => undefined);
49
+ }
38
50
  //# sourceMappingURL=repository-address.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"repository-address.js","sourceRoot":"","sources":["../src/repository-address.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAkB,MAAM,qBAAqB,CAAA;AAEnE;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAA;IAChD,0EAA0E;IAC1E,MAAM,GAAG,GAAG,yCAAyC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAC/D,MAAM,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,oEAAoE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACvG,IAAI,GAAG,EAAE,CAAC,CAAC,CAAE,CAAC,WAAW,EAAE,KAAK,MAAM;QAAE,OAAO,SAAS,CAAA;IACxD,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAA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