@openagt/dashboard 0.10.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/README.md +1 -6
  2. package/dist/built-in.d.ts +18 -2
  3. package/dist/built-in.d.ts.map +1 -1
  4. package/dist/built-in.js +29 -6
  5. package/dist/built-in.js.map +1 -1
  6. package/dist/cli.d.ts +4 -10
  7. package/dist/cli.d.ts.map +1 -1
  8. package/dist/cli.js +11 -67
  9. package/dist/cli.js.map +1 -1
  10. package/dist/client.d.ts +2 -1
  11. package/dist/client.d.ts.map +1 -1
  12. package/dist/client.js +3 -4
  13. package/dist/client.js.map +1 -1
  14. package/dist/clone-project.d.ts +69 -0
  15. package/dist/clone-project.d.ts.map +1 -0
  16. package/dist/clone-project.js +124 -0
  17. package/dist/clone-project.js.map +1 -0
  18. package/dist/daemon-runtime.d.ts +12 -12
  19. package/dist/daemon-runtime.d.ts.map +1 -1
  20. package/dist/daemon-runtime.js +96 -35
  21. package/dist/daemon-runtime.js.map +1 -1
  22. package/dist/daemon.d.ts +3 -14
  23. package/dist/daemon.d.ts.map +1 -1
  24. package/dist/daemon.js +15 -26
  25. package/dist/daemon.js.map +1 -1
  26. package/dist/dashboard/bridge-endpoints.d.ts +5 -5
  27. package/dist/dashboard/bridge-endpoints.js +5 -5
  28. package/dist/dashboard/http.d.ts +1 -1
  29. package/dist/dashboard/http.js +1 -1
  30. package/dist/dashboard/machine-call.d.ts +10 -0
  31. package/dist/dashboard/machine-call.d.ts.map +1 -0
  32. package/dist/dashboard/machine-call.js +86 -0
  33. package/dist/dashboard/machine-call.js.map +1 -0
  34. package/dist/dashboard/module-serve.d.ts +6 -0
  35. package/dist/dashboard/module-serve.d.ts.map +1 -1
  36. package/dist/dashboard/module-serve.js +24 -8
  37. package/dist/dashboard/module-serve.js.map +1 -1
  38. package/dist/dashboard/relay-endpoints.d.ts +26 -17
  39. package/dist/dashboard/relay-endpoints.d.ts.map +1 -1
  40. package/dist/dashboard/relay-endpoints.js +70 -27
  41. package/dist/dashboard/relay-endpoints.js.map +1 -1
  42. package/dist/dashboard/remote-run.d.ts +77 -32
  43. package/dist/dashboard/remote-run.d.ts.map +1 -1
  44. package/dist/dashboard/remote-run.js +120 -42
  45. package/dist/dashboard/remote-run.js.map +1 -1
  46. package/dist/dashboard/rpc-serve.d.ts +28 -25
  47. package/dist/dashboard/rpc-serve.d.ts.map +1 -1
  48. package/dist/dashboard/rpc-serve.js +26 -22
  49. package/dist/dashboard/rpc-serve.js.map +1 -1
  50. package/dist/dashboard/screen.d.ts +53 -0
  51. package/dist/dashboard/screen.d.ts.map +1 -0
  52. package/dist/dashboard/screen.js +175 -0
  53. package/dist/dashboard/screen.js.map +1 -0
  54. package/dist/dashboard/server.d.ts +18 -19
  55. package/dist/dashboard/server.d.ts.map +1 -1
  56. package/dist/dashboard/server.js +57 -84
  57. package/dist/dashboard/server.js.map +1 -1
  58. package/dist/dashboard/types.d.ts +11 -16
  59. package/dist/dashboard/types.d.ts.map +1 -1
  60. package/dist/dashboard/web-start-endpoints.d.ts +2 -2
  61. package/dist/dashboard/web-start-endpoints.js +1 -1
  62. package/dist/dashboard-bundle/assets/main-BHMlP40v.css +2 -0
  63. package/dist/dashboard-bundle/assets/main-D0qZC1r-.js +140 -0
  64. package/dist/dashboard-bundle/assets/{module-gKz-ZvkG.js → module-ZjyA5WUg.js} +4 -4
  65. package/dist/dashboard-bundle/host/module.js +1 -1
  66. package/dist/dashboard-bundle/index.html +3 -3
  67. package/dist/dashboard-rpc/context.d.ts +4 -4
  68. package/dist/dashboard-rpc/context.js +5 -5
  69. package/dist/dashboard-rpc/context.js.map +1 -1
  70. package/dist/dashboard-rpc/control.d.ts +1 -1
  71. package/dist/dashboard-rpc/control.js +7 -7
  72. package/dist/dashboard-rpc/control.js.map +1 -1
  73. package/dist/dashboard-rpc/events.d.ts +1 -1
  74. package/dist/dashboard-rpc/events.js +1 -1
  75. package/dist/dashboard-rpc/index.d.ts +3 -3
  76. package/dist/dashboard-rpc/index.d.ts.map +1 -1
  77. package/dist/dashboard-rpc/index.js +5 -5
  78. package/dist/dashboard-rpc/index.js.map +1 -1
  79. package/dist/dashboard-rpc/machines.d.ts +52 -0
  80. package/dist/dashboard-rpc/machines.d.ts.map +1 -0
  81. package/dist/dashboard-rpc/machines.js +82 -0
  82. package/dist/dashboard-rpc/machines.js.map +1 -0
  83. package/dist/dashboard-rpc/modules.d.ts +12 -4
  84. package/dist/dashboard-rpc/modules.d.ts.map +1 -1
  85. package/dist/dashboard-rpc/modules.js +24 -5
  86. package/dist/dashboard-rpc/modules.js.map +1 -1
  87. package/dist/dashboard-rpc/projects.d.ts +18 -0
  88. package/dist/dashboard-rpc/projects.d.ts.map +1 -1
  89. package/dist/dashboard-rpc/projects.js +27 -5
  90. package/dist/dashboard-rpc/projects.js.map +1 -1
  91. package/dist/dashboard-rpc/reads.d.ts +3 -4
  92. package/dist/dashboard-rpc/reads.d.ts.map +1 -1
  93. package/dist/dashboard-rpc/reads.js +5 -6
  94. package/dist/dashboard-rpc/reads.js.map +1 -1
  95. package/dist/dashboard-rpc/relay-agent.d.ts +3 -3
  96. package/dist/dashboard-rpc/relay-agent.js +3 -3
  97. package/dist/dashboard-rpc/relay-dispatch.d.ts +4 -4
  98. package/dist/dashboard-rpc/relay-dispatch.d.ts.map +1 -1
  99. package/dist/dashboard-rpc/relay-dispatch.js +7 -7
  100. package/dist/dashboard-rpc/relay-dispatch.js.map +1 -1
  101. package/dist/dashboard-rpc/test-context.js +1 -1
  102. package/dist/dashboard-rpc/test-context.js.map +1 -1
  103. package/dist/events.d.ts +4 -3
  104. package/dist/events.d.ts.map +1 -1
  105. package/dist/loopback-host.d.ts +3 -5
  106. package/dist/loopback-host.d.ts.map +1 -1
  107. package/dist/loopback-host.js +3 -5
  108. package/dist/loopback-host.js.map +1 -1
  109. package/dist/machine-link.d.ts +21 -0
  110. package/dist/machine-link.d.ts.map +1 -0
  111. package/dist/machine-link.js +20 -0
  112. package/dist/machine-link.js.map +1 -0
  113. package/dist/module-server.d.ts +1 -1
  114. package/dist/module-types/dashboard/components/QrCode.d.ts +8 -0
  115. package/dist/module-types/dashboard/lib/draft-handoff.d.ts +5 -9
  116. package/dist/module-types/dashboard/module/index.d.ts +56 -4
  117. package/dist/module-types/dashboard/rpc/modules.d.ts +1 -0
  118. package/dist/module-types/src/built-in.d.ts +18 -2
  119. package/dist/module-types/src/client.d.ts +2 -1
  120. package/dist/module-types/src/clone-project.d.ts +68 -0
  121. package/dist/module-types/src/dashboard/bridge-endpoints.d.ts +5 -5
  122. package/dist/module-types/src/dashboard/http.d.ts +1 -1
  123. package/dist/module-types/src/dashboard/machine-call.d.ts +9 -0
  124. package/dist/module-types/src/dashboard/module-serve.d.ts +6 -0
  125. package/dist/module-types/src/dashboard/remote-run.d.ts +77 -32
  126. package/dist/module-types/src/dashboard/rpc-serve.d.ts +28 -25
  127. package/dist/module-types/src/dashboard/types.d.ts +11 -16
  128. package/dist/module-types/src/dashboard-rpc/context.d.ts +4 -4
  129. package/dist/module-types/src/dashboard-rpc/control.d.ts +1 -1
  130. package/dist/module-types/src/dashboard-rpc/events.d.ts +1 -1
  131. package/dist/module-types/src/dashboard-rpc/index.d.ts +3 -3
  132. package/dist/module-types/src/dashboard-rpc/machines.d.ts +51 -0
  133. package/dist/module-types/src/dashboard-rpc/modules.d.ts +12 -4
  134. package/dist/module-types/src/dashboard-rpc/projects.d.ts +18 -0
  135. package/dist/module-types/src/dashboard-rpc/reads.d.ts +3 -4
  136. package/dist/module-types/src/dashboard-rpc/relay-agent.d.ts +3 -3
  137. package/dist/module-types/src/events.d.ts +4 -3
  138. package/dist/module-types/src/loopback-host.d.ts +3 -5
  139. package/dist/module-types/src/machine-link.d.ts +20 -0
  140. package/dist/module-types/src/pick-directory.d.ts +2 -0
  141. package/dist/module-types/src/project-modules.d.ts +12 -3
  142. package/dist/module-types/src/registry.d.ts +59 -16
  143. package/dist/module-types/src/repository-address.d.ts +22 -0
  144. package/dist/module-types/src/screens.d.ts +13 -0
  145. package/dist/module-types/src/store/agent-store.d.ts +2 -2
  146. package/dist/module-types/src/version.d.ts +1 -0
  147. package/dist/package-services.d.ts +27 -0
  148. package/dist/package-services.d.ts.map +1 -0
  149. package/dist/package-services.js +62 -0
  150. package/dist/package-services.js.map +1 -0
  151. package/dist/pick-directory.d.ts +2 -0
  152. package/dist/pick-directory.d.ts.map +1 -1
  153. package/dist/pick-directory.js +7 -1
  154. package/dist/pick-directory.js.map +1 -1
  155. package/dist/project-modules.d.ts +12 -3
  156. package/dist/project-modules.d.ts.map +1 -1
  157. package/dist/project-modules.js +20 -2
  158. package/dist/project-modules.js.map +1 -1
  159. package/dist/registry.d.ts +59 -16
  160. package/dist/registry.d.ts.map +1 -1
  161. package/dist/registry.js +91 -20
  162. package/dist/registry.js.map +1 -1
  163. package/dist/repository-address.d.ts +23 -0
  164. package/dist/repository-address.d.ts.map +1 -0
  165. package/dist/repository-address.js +38 -0
  166. package/dist/repository-address.js.map +1 -0
  167. package/dist/screens.d.ts +14 -0
  168. package/dist/screens.d.ts.map +1 -0
  169. package/dist/screens.js +40 -0
  170. package/dist/screens.js.map +1 -0
  171. package/dist/store/agent-store.d.ts +2 -2
  172. package/dist/store/agent-store.d.ts.map +1 -1
  173. package/dist/version.d.ts +2 -0
  174. package/dist/version.d.ts.map +1 -0
  175. package/dist/version.js +26 -0
  176. package/dist/version.js.map +1 -0
  177. package/package.json +15 -11
  178. package/dist/dashboard-bundle/assets/main-Q7JMdMJI.css +0 -2
  179. package/dist/dashboard-bundle/assets/main-fDZWGOub.js +0 -140
  180. package/dist/dashboard-rpc/devices.d.ts +0 -9
  181. package/dist/dashboard-rpc/devices.d.ts.map +0 -1
  182. package/dist/dashboard-rpc/devices.js +0 -12
  183. package/dist/dashboard-rpc/devices.js.map +0 -1
  184. package/dist/install.d.ts +0 -31
  185. package/dist/install.d.ts.map +0 -1
  186. package/dist/install.js +0 -54
  187. package/dist/install.js.map +0 -1
  188. package/dist/module-types/src/dashboard-rpc/devices.d.ts +0 -8
  189. package/dist/module-types/src/openagent-gitignore.d.ts +0 -11
  190. package/dist/openagent-gitignore.d.ts +0 -12
  191. package/dist/openagent-gitignore.d.ts.map +0 -1
  192. package/dist/openagent-gitignore.js +0 -19
  193. package/dist/openagent-gitignore.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"daemon.js","sourceRoot":"","sources":["../src/daemon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAkB,MAAM,sBAAsB,CAAA;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAC9D,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,wBAAwB,EAAoB,MAAM,eAAe,CAAA;AAC5I,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,kBAAkB,EAAiD,MAAM,qBAAqB,CAAA;AAC7I,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,O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CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;YAC5B,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;YAC1C,cAAc,EAAE,CAAA;QAClB,CAAC,CAAA;QACD,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;QAC5B,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;QAC7B,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;IACzD,CAAC,CAAC,CAAA;AACJ,CAAC;AAED;;;;;GAKG;AACH,KAAK,UAAU,kBAAkB,CAAC,GAAsB;IACtD,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAA;IACnE,MAAM,MAAM,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;IACnG,OAAO,kBAAkB,CAAC,MAAM,EAAE,IAAI,IAAI,EAAE,EAAE,eAAe,EAAE,CAAC,qBAAqB,EAAE,CAAC,CAAA;AAC1F,CAAC"}
@@ -5,11 +5,11 @@ export type { BridgeOption, BridgeQuestion } from './bridge-question.js';
5
5
  * The browser bridge (#1237): the one endpoint an extension running in the user's own Claude
6
6
  * session posts to, so a question a cloud agent is parked on becomes visible in the dashboard.
7
7
  *
8
- * **Why this route carries its own token, unlike every other one.** The #1051 guard in
9
- * `startDashboard` only exists on a non-loopback bind, and what protects a loopback daemon is
10
- * the same-origin check on `/_rpc`: a page on another origin is refused outright. This
11
- * route is the first that is *meant* to be reached from another origin, so neither of those
12
- * protects it, and it demands `Authorization: Bearer <daemonToken>` unconditionally instead.
8
+ * **Why this route carries its own token, unlike every other one.** What protects the daemon,
9
+ * which listens on its own computer only, is the same-origin check on `/_rpc`: a page on another
10
+ * origin is refused outright. This route is the first that is *meant* to be reached from another
11
+ * origin, so that check does not protect it, and it demands `Authorization: Bearer <bridgeToken>`
12
+ * unconditionally instead.
13
13
  *
14
14
  * **No CORS headers, on purpose.** An extension's service worker holding `host_permissions`
15
15
  * fetches without a preflight, so the bridge does not need `Access-Control-Allow-Origin` and
@@ -4,11 +4,11 @@ import { end, readPost, requireGet, sendJson } from './http.js';
4
4
  * The browser bridge (#1237): the one endpoint an extension running in the user's own Claude
5
5
  * session posts to, so a question a cloud agent is parked on becomes visible in the dashboard.
6
6
  *
7
- * **Why this route carries its own token, unlike every other one.** The #1051 guard in
8
- * `startDashboard` only exists on a non-loopback bind, and what protects a loopback daemon is
9
- * the same-origin check on `/_rpc`: a page on another origin is refused outright. This
10
- * route is the first that is *meant* to be reached from another origin, so neither of those
11
- * protects it, and it demands `Authorization: Bearer <daemonToken>` unconditionally instead.
7
+ * **Why this route carries its own token, unlike every other one.** What protects the daemon,
8
+ * which listens on its own computer only, is the same-origin check on `/_rpc`: a page on another
9
+ * origin is refused outright. This route is the first that is *meant* to be reached from another
10
+ * origin, so that check does not protect it, and it demands `Authorization: Bearer <bridgeToken>`
11
+ * unconditionally instead.
12
12
  *
13
13
  * **No CORS headers, on purpose.** An extension's service worker holding `host_permissions`
14
14
  * fetches without a preflight, so the bridge does not need `Access-Control-Allow-Origin` and
@@ -1,7 +1,7 @@
1
1
  import type { IncomingMessage, ServerResponse } from 'node:http';
2
2
  /**
3
3
  * The plumbing every one of the daemon's non-RPC HTTP surfaces shares: the browser bridge
4
- * (`/_bridge`), the web-start queue (`/_web-start`) and the device relay (`/_relay`).
4
+ * (`/_bridge`), the web-start queue (`/_web-start`) and the machine relay (`/_relay`).
5
5
  *
6
6
  * All three answer plain-text statuses, JSON payloads, and read capped JSON request bodies, and
7
7
  * each carried its own copy — two body readers that differed only in which message they rejected
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The plumbing every one of the daemon's non-RPC HTTP surfaces shares: the browser bridge
3
- * (`/_bridge`), the web-start queue (`/_web-start`) and the device relay (`/_relay`).
3
+ * (`/_bridge`), the web-start queue (`/_web-start`) and the machine relay (`/_relay`).
4
4
  *
5
5
  * All three answer plain-text statuses, JSON payloads, and read capped JSON request bodies, and
6
6
  * each carried its own copy — two body readers that differed only in which message they rejected
@@ -0,0 +1,10 @@
1
+ /** What a call says when the machine at the address shows another key than the one it was added with. */
2
+ export declare const NOT_THE_MACHINE = "what answers at this address is not the machine that was added: add the machine again, with a new link";
3
+ export interface MachineCall {
4
+ method?: string;
5
+ headers?: Record<string, string>;
6
+ body?: string;
7
+ signal?: AbortSignal;
8
+ }
9
+ export declare function machineFetch(url: string, pin: string | undefined, init?: MachineCall): Promise<Response>;
10
+ //# sourceMappingURL=machine-call.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"machine-call.d.ts","sourceRoot":"","sources":["../../src/dashboard/machine-call.ts"],"names":[],"mappings":"AAuBA,yGAAyG;AACzG,eAAO,MAAM,eAAe,2GAA2G,CAAA;AAKvI,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAwD5G"}
@@ -0,0 +1,86 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { request } from 'node:https';
3
+ import { isIP } from 'node:net';
4
+ import { Readable } from 'node:stream';
5
+ import { connect } from 'node:tls';
6
+ /**
7
+ * One call to a saved machine. A machine reached over HTTPS whose link carried what its key is
8
+ * known by is known by that key alone: the connection is made, the key the machine shows is
9
+ * compared, and only then is anything sent, so a key and a prompt never reach whoever holds the
10
+ * machine's address next. The key stays when the machine renews its certificate, and a
11
+ * certificate that ran out while its office could not be reached does not cut the machine off.
12
+ *
13
+ * Any other machine (one on the same Wi-Fi, over plain HTTP) is called as it always was. Neither
14
+ * kind of call follows a redirect.
15
+ */
16
+ /** What a key is known by: the SHA-256 of its public half, URL-safe. */
17
+ function fingerprintOf(socket) {
18
+ const shown = socket.getPeerX509Certificate();
19
+ return shown && createHash('sha256').update(shown.publicKey.export({ type: 'spki', format: 'der' })).digest('base64url');
20
+ }
21
+ /** What a call says when the machine at the address shows another key than the one it was added with. */
22
+ export const NOT_THE_MACHINE = 'what answers at this address is not the machine that was added: add the machine again, with a new link';
23
+ /** How long a machine gets to show its key once it took the connection. */
24
+ const HANDSHAKE_MS = 10_000;
25
+ export function machineFetch(url, pin, init = {}) {
26
+ const target = new URL(url);
27
+ if (target.protocol !== 'https:' || pin === undefined)
28
+ return fetch(url, { ...init, redirect: 'error' });
29
+ return new Promise((resolve, reject) => {
30
+ const host = target.hostname.replace(/^\[|\]$/g, '');
31
+ const signal = init.signal;
32
+ const givenUp = () => (signal?.reason instanceof Error ? signal.reason : new Error('the call was given up on'));
33
+ // A call given up on before the machine took the connection ends here: the request itself
34
+ // says nothing until it has a connection.
35
+ signal?.addEventListener('abort', () => reject(givenUp()), { once: true });
36
+ const req = request(target, {
37
+ method: init.method ?? 'GET',
38
+ headers: init.headers ?? {},
39
+ ...(signal ? { signal } : {}),
40
+ // The connection is made here, by no agent, and handed over only once the machine has
41
+ // shown the key it is known by: one connection for one call.
42
+ createConnection: (_options, handOver) => {
43
+ const socket = connect({ host, port: Number(target.port) || 443, ...(isIP(host) ? {} : { servername: host }), rejectUnauthorized: false });
44
+ // The connection goes with the call: one that is given up on, and one a machine takes
45
+ // and then says nothing on, is not left open.
46
+ const drop = () => void socket.destroy(givenUp());
47
+ if (signal?.aborted)
48
+ drop();
49
+ else
50
+ signal?.addEventListener('abort', drop, { once: true });
51
+ socket.once('close', () => signal?.removeEventListener('abort', drop));
52
+ socket.setTimeout(HANDSHAKE_MS, () => socket.destroy(new Error('the machine took the connection and did not go on')));
53
+ socket.once('error', err => handOver(err, socket));
54
+ socket.once('secureConnect', () => {
55
+ socket.setTimeout(0);
56
+ if (fingerprintOf(socket) === pin)
57
+ return handOver(null, socket);
58
+ socket.destroy();
59
+ handOver(new Error(NOT_THE_MACHINE), socket);
60
+ });
61
+ return undefined;
62
+ },
63
+ }, res => {
64
+ const headers = new Headers();
65
+ for (const [name, value] of Object.entries(res.headers))
66
+ for (const one of Array.isArray(value) ? value : value === undefined ? [] : [value])
67
+ headers.append(name, one);
68
+ const status = res.statusCode ?? 502;
69
+ // A status with no body is answered without one: `Response` refuses a body there.
70
+ const empty = status === 204 || status === 205 || status === 304 || init.method === 'HEAD';
71
+ if (empty)
72
+ res.resume();
73
+ try {
74
+ resolve(new Response(empty ? null : Readable.toWeb(res), { status, headers }));
75
+ }
76
+ catch (err) {
77
+ // A status no answer can carry: the machine's fault, told as a failed call.
78
+ res.destroy();
79
+ reject(err);
80
+ }
81
+ });
82
+ req.once('error', reject);
83
+ req.end(init.body);
84
+ });
85
+ }
86
+ //# sourceMappingURL=machine-call.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"machine-call.js","sourceRoot":"","sources":["../../src/dashboard/machine-call.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,OAAO,EAAkB,MAAM,UAAU,CAAA;A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AAO,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAgC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,CAAA;YAChH,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,4EAA4E;gBAC5E,GAAG,CAAC,OAAO,EAAE,CAAA;gBACb,MAAM,CAAC,GAAG,CAAC,CAAA;YACb,CAAC;QACH,CAAC,CACF,CAAA;QACD,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;QACzB,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACpB,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -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,4 +16,6 @@ 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>;
15
21
  //# sourceMappingURL=module-serve.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"module-serve.d.ts","sourceRoot":"","sources":["../../src/dashboard/module-serve.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAEhE,OAAO,EAA2B,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAC9E,OAAO,EAAiC,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAEzF,sGAAsG;AACtG,eAAO,MAAM,cAAc,cAAc,CAAA;AAEzC,qEAAqE;AACrE,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,GAAG,OAAO,CAAC,GAAG,MAAM,CAGrG;AAUD;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,QAAQ,EAAE,MAAM,EAChB,QAAQ,GAAE,gBAA4C,GACrD,OAAO,CAAC,IAAI,CAAC,CAef"}
1
+ {"version":3,"file":"module-serve.d.ts","sourceRoot":"","sources":["../../src/dashboard/module-serve.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAEhE,OAAO,EAA2B,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAC9E,OAAO,EAAqD,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAE7G,sGAAsG;AACtG,eAAO,MAAM,cAAc,cAAc,CAAA;AAEzC,2HAA2H;AAC3H,eAAO,MAAM,uBAAuB,uBAAuB,CAAA;AAI3D,qEAAqE;AACrE,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,GAAG,OAAO,CAAC,GAAG,MAAM,CAErG;AAED,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,GAAG,OAAO,CAAC,GAAG,MAAM,CAE1F;AAUD;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,QAAQ,EAAE,MAAM,EAChB,QAAQ,GAAE,gBAA4C,GACrD,OAAO,CAAC,IAAI,CAAC,CAOf;AAED,uHAAuH;AACvH,wBAAsB,uBAAuB,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAExH"}
@@ -1,13 +1,19 @@
1
1
  import { readFile } from 'node:fs/promises';
2
2
  import { contentTypeFor } from './content-type.js';
3
3
  import { defaultProjectsProvider } from './projects.js';
4
- import { findProjectModule, moduleFile } from '../project-modules.js';
4
+ import { findComputerModule, findProjectModule, moduleFile } from '../project-modules.js';
5
5
  /** Where module files are served: `/_modules/<project id>/<package>/<file>`, each segment encoded. */
6
6
  export const MODULES_PREFIX = '/_modules';
7
+ /** Where the files of the computer's modules are served, which are no project's: `/_computer-modules/<package>/<file>`. */
8
+ export const COMPUTER_MODULES_PREFIX = '/_computer-modules';
9
+ const encoded = (path) => path.split('/').map(encodeURIComponent).join('/');
7
10
  /** The URL a module's browser part is served at from one project. */
8
11
  export function moduleUrl(projectId, module) {
9
- const file = module.entry.split('/').map(encodeURIComponent).join('/');
10
- return `${MODULES_PREFIX}/${encodeURIComponent(projectId)}/${encodeURIComponent(module.package)}/${file}`;
12
+ return `${MODULES_PREFIX}/${encodeURIComponent(projectId)}/${encodeURIComponent(module.package)}/${encoded(module.entry)}`;
13
+ }
14
+ /** The URL the browser part of one of the computer's modules is served at. */
15
+ export function computerModuleUrl(module) {
16
+ return `${COMPUTER_MODULES_PREFIX}/${encodeURIComponent(module.package)}/${encoded(module.entry)}`;
11
17
  }
12
18
  function decode(segment) {
13
19
  try {
@@ -24,17 +30,27 @@ function decode(segment) {
24
30
  * Served as `no-cache`, since a module is rebuilt in place under the same name.
25
31
  */
26
32
  export async function serveModuleFile(req, res, pathname, projects = defaultProjectsProvider()) {
33
+ const [projectSegment, ...rest] = pathname.slice(MODULES_PREFIX.length + 1).split('/');
34
+ const projectId = projectSegment !== undefined ? decode(projectSegment) : undefined;
35
+ return serveFileOf(req, res, rest, async (pkg) => {
36
+ const root = projectId ? await projects.resolvePath(projectId) : undefined;
37
+ return root ? findProjectModule(root, pkg) : undefined;
38
+ });
39
+ }
40
+ /** Serve one file of a module that is the computer's: as {@link serveModuleFile}, with no project to be registered. */
41
+ export async function serveComputerModuleFile(req, res, pathname) {
42
+ return serveFileOf(req, res, pathname.slice(COMPUTER_MODULES_PREFIX.length + 1).split('/'), findComputerModule);
43
+ }
44
+ /** Answer the file `<package>/<file>` names, of the module `find` knows the package as. */
45
+ async function serveFileOf(req, res, [packageSegment, ...rest], find) {
27
46
  const notFound = () => void res.writeHead(404, { 'content-type': 'text/plain' }).end('no such module file');
28
47
  if (req.method !== 'GET' && req.method !== 'HEAD')
29
48
  return void res.writeHead(405, { allow: 'GET, HEAD' }).end();
30
- const [projectSegment, packageSegment, ...rest] = pathname.slice(MODULES_PREFIX.length + 1).split('/');
31
- const projectId = projectSegment !== undefined ? decode(projectSegment) : undefined;
32
49
  const pkg = packageSegment !== undefined ? decode(packageSegment) : undefined;
33
50
  const rel = rest.map(decode);
34
- if (!projectId || !pkg || rel.length === 0 || rel.some(part => part === undefined))
51
+ if (!pkg || rel.length === 0 || rel.some(part => part === undefined))
35
52
  return notFound();
36
- const root = await projects.resolvePath(projectId);
37
- const module = root ? await findProjectModule(root, pkg).catch(() => undefined) : undefined;
53
+ const module = await find(pkg).catch(() => undefined);
38
54
  const file = module ? await moduleFile(module, rel.join('/')) : undefined;
39
55
  const body = file ? await readFile(file).catch(() => undefined) : undefined;
40
56
  if (!file || body === undefined)
@@ -1 +1 @@
1
- {"version":3,"file":"module-serve.js","sourceRoot":"","sources":["../../src/dashboard/module-serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE3C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,uBAAuB,EAAyB,MAAM,eAAe,CAAA;AAC9E,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAsB,MAAM,uBAAuB,CAAA;AAEzF,sGAAsG;AACtG,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAA;AAEzC,qEAAqE;AACrE,MAAM,UAAU,SAAS,CAAC,SAAiB,EAAE,MAAgD;IAC3F,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACtE,OAAO,GAAG,cAAc,IAAI,kBAAkB,CAAC,SAAS,CAAC,IAAI,kBAAkB,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAA;AAC3G,CAAC;AAED,SAAS,MAAM,CAAC,OAAe;IAC7B,IAAI,CAAC;QACH,OAAO,kBAAkB,CAAC,OAAO,CAAC,CAAA;IACpC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,GAAoB,EACpB,GAAmB,EACnB,QAAgB,EAChB,QAAQ,GAAqB,uBAAuB,EAAE;IAEtD,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC,KAAK,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAA;IAC3G,IAAI,GAAG,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,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IACzE,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAC3E,IAAI,CAAC,IAAI,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,QAAQ,EAAE,CAAA;IAClD,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,cAAc,CAAC,IAAI,CAAC,EAAE,eAAe,EAAE,UAAU,EAAE,CAAC,CAAA;IACzF,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;AACnD,CAAC"}
@@ -2,30 +2,39 @@ import type { IncomingMessage, ServerResponse } from 'node:http';
2
2
  import type { OpenAgentEvent } from '../events.js';
3
3
  import type { StartAgentOptions, StartAgentResult } from './types.js';
4
4
  /**
5
- * The device-side of the remote-agent relay (#1067): the two endpoints a daemon exposes so another
6
- * daemon (holding this device's token) can run a session here and watch it. They live under
7
- * `/_relay`, behind the shared-token guard (#1051) in {@link startDashboard}. The guard admits a matching
8
- * `oa_daemon` cookie without the browser-only `?token=` 302, so a daemon-to-daemon call passes with
9
- * a cookie and a token-less caller is already 401'd before it reaches here.
5
+ * The machine-side of the remote-agent relay (#1067): the endpoints through which another
6
+ * machine's daemon runs a session here and watches it. They live under `/_relay`. This daemon
7
+ * listens on its own computer only: a call from another machine reaches them through whatever
8
+ * this computer opened to the network, which lets in only a machine that holds a key of its own
9
+ * and passes its call on as this computer's own would arrive.
10
10
  *
11
- * - `POST /_relay/start` starts an ordinary local agent and returns its {@link StartAgentResult}. It
12
- * runs in this device's own home checkout (slice 1); which project it targets is a later slice.
13
- * - `GET /_relay/events?run=<id>` streams that agent's events as newline-delimited JSON until it
14
- * ends or the caller disconnects.
15
- * - `GET /_relay/ping` (#1072) a cookie-guarded reachability probe: 200 and an empty body, starts
16
- * nothing. The online/offline status the dashboard shows is the local daemon calling this on each
17
- * saved device with its token; a token-less caller is already 401'd by the shared-token guard (#1051) above.
11
+ * - `POST /_relay/start` starts an ordinary local agent and returns its {@link StartAgentResult}.
12
+ * - `GET /_relay/events?run=<id>&project=<address>` streams that agent's events as
13
+ * newline-delimited JSON until it ends or the caller disconnects.
14
+ * - `GET /_relay/ping` (#1072) a reachability probe: 200 and this OpenAgent's version, starts nothing. The
15
+ * online/offline status the dashboard shows is the local daemon calling this on each saved
16
+ * machine with its key there.
18
17
  * - `POST /_relay/rpc` (#1067 slice 2) runs one whitelisted run-scoped RPC (a read/diff/steer/handoff/
19
- * push/PR) against this device's own checkout for the daemon relaying an agent here, answering {result}.
18
+ * push/PR) against this machine's own checkout for the daemon relaying an agent here, answering {result}.
19
+ * - `GET /_relay/screen/stream?run=<id>&project=<address>` and `POST /_relay/screen/input?…` pass
20
+ * one call on to the live screen of a run here (screen.ts), for the daemon whose person watches it.
21
+ *
22
+ * All but the ping name their project by its repository's address, and work in this machine's own
23
+ * project cloned from it. A call that names none, or one this machine does not have, starts and
24
+ * reads nothing: there is no project a call falls back to.
20
25
  */
21
26
  export declare const RELAY_PREFIX = "/_relay";
22
27
  /** What the daemon wires behind the relay endpoints: its own start closure and an events tail. */
23
28
  export interface RelayHandlers {
24
- start: (prompt: string, options: StartAgentOptions, projectId?: string) => StartAgentResult | Promise<StartAgentResult>;
25
- tailEvents: (agentId: string, onEvent: (event: OpenAgentEvent) => void) => () => void;
26
- /** Run one whitelisted read/steer/handoff RPC against THIS device's own checkout, for the daemon
29
+ /** This machine's own id for its project cloned from `address`, or undefined when it has none. */
30
+ project: (address: string) => Promise<string | undefined>;
31
+ start: (prompt: string, options: StartAgentOptions, projectId: string) => StartAgentResult | Promise<StartAgentResult>;
32
+ tailEvents: (projectId: string, agentId: string, onEvent: (event: OpenAgentEvent) => void) => () => void;
33
+ /** Run one whitelisted read/steer/handoff RPC against THIS machine's own checkout, for the daemon
27
34
  * relaying an agent here (#1067 slice 2); the caller wraps the result as {result}. */
28
- rpc?: (fn: string, args: unknown[]) => Promise<unknown>;
35
+ rpc?: (projectId: string, fn: string, args: unknown[]) => Promise<unknown>;
36
+ /** Where the live screen of a run here answers; nothing when the run has none. */
37
+ screen?: (projectId: string, agentId: string) => Promise<string | undefined>;
29
38
  }
30
39
  /** Route a `/_relay/*` request. A host that wired no relay handlers 404s every relay route. */
31
40
  export declare function handleRelayRequest(req: IncomingMessage, res: ServerResponse, pathname: string, handlers: RelayHandlers | undefined): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"relay-endpoints.d.ts","sourceRoot":"","sources":["../../src/dashboard/relay-endpoints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAGrE;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,YAAY,YAAY,CAAA;AAErC,kGAAkG;AAClG,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,SAAS,CAAC,EAAE,MAAM,KAAK,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;IACvH,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,KAAK,MAAM,IAAI,CAAA;IACrF;2FACuF;IACvF,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAA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OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;CAC7E;AAgBD,+FAA+F;AAC/F,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,aAAa,GAAG,SAAS,GAClC,OAAO,CAAC,IAAI,CAAC,CAWf"}
@@ -1,27 +1,39 @@
1
1
  import { end, readJsonBody, requireGet, sendJson } from './http.js';
2
+ import { passToScreen, screenCallOf } from './screen.js';
3
+ import { isRunId } from '../store/index.js';
4
+ import { openagentVersion } from '../version.js';
2
5
  /**
3
- * The device-side of the remote-agent relay (#1067): the two endpoints a daemon exposes so another
4
- * daemon (holding this device's token) can run a session here and watch it. They live under
5
- * `/_relay`, behind the shared-token guard (#1051) in {@link startDashboard}. The guard admits a matching
6
- * `oa_daemon` cookie without the browser-only `?token=` 302, so a daemon-to-daemon call passes with
7
- * a cookie and a token-less caller is already 401'd before it reaches here.
6
+ * The machine-side of the remote-agent relay (#1067): the endpoints through which another
7
+ * machine's daemon runs a session here and watches it. They live under `/_relay`. This daemon
8
+ * listens on its own computer only: a call from another machine reaches them through whatever
9
+ * this computer opened to the network, which lets in only a machine that holds a key of its own
10
+ * and passes its call on as this computer's own would arrive.
8
11
  *
9
- * - `POST /_relay/start` starts an ordinary local agent and returns its {@link StartAgentResult}. It
10
- * runs in this device's own home checkout (slice 1); which project it targets is a later slice.
11
- * - `GET /_relay/events?run=<id>` streams that agent's events as newline-delimited JSON until it
12
- * ends or the caller disconnects.
13
- * - `GET /_relay/ping` (#1072) a cookie-guarded reachability probe: 200 and an empty body, starts
14
- * nothing. The online/offline status the dashboard shows is the local daemon calling this on each
15
- * saved device with its token; a token-less caller is already 401'd by the shared-token guard (#1051) above.
12
+ * - `POST /_relay/start` starts an ordinary local agent and returns its {@link StartAgentResult}.
13
+ * - `GET /_relay/events?run=<id>&project=<address>` streams that agent's events as
14
+ * newline-delimited JSON until it ends or the caller disconnects.
15
+ * - `GET /_relay/ping` (#1072) a reachability probe: 200 and this OpenAgent's version, starts nothing. The
16
+ * online/offline status the dashboard shows is the local daemon calling this on each saved
17
+ * machine with its key there.
16
18
  * - `POST /_relay/rpc` (#1067 slice 2) runs one whitelisted run-scoped RPC (a read/diff/steer/handoff/
17
- * push/PR) against this device's own checkout for the daemon relaying an agent here, answering {result}.
19
+ * push/PR) against this machine's own checkout for the daemon relaying an agent here, answering {result}.
20
+ * - `GET /_relay/screen/stream?run=<id>&project=<address>` and `POST /_relay/screen/input?…` pass
21
+ * one call on to the live screen of a run here (screen.ts), for the daemon whose person watches it.
22
+ *
23
+ * All but the ping name their project by its repository's address, and work in this machine's own
24
+ * project cloned from it. A call that names none, or one this machine does not have, starts and
25
+ * reads nothing: there is no project a call falls back to.
18
26
  */
19
27
  export const RELAY_PREFIX = '/_relay';
28
+ /** This machine's id for the project a call names, or undefined: no address, or no such project here. */
29
+ async function projectNamed(handlers, address) {
30
+ return typeof address === 'string' && address ? handlers.project(address) : undefined;
31
+ }
20
32
  const MAX_START_BODY = 256 * 1024;
21
33
  /** Route a `/_relay/*` request. A host that wired no relay handlers 404s every relay route. */
22
34
  export async function handleRelayRequest(req, res, pathname, handlers) {
23
- // Ping is a pure reachability + auth probe (#1072): it needs no wired handlers and starts nothing,
24
- // so it answers even on a host that enabled no relay. Reaching here means the cookie already passed.
35
+ // Ping is a pure reachability probe (#1072): it needs no wired handlers and starts nothing,
36
+ // so it answers even on a host that enabled no relay.
25
37
  if (pathname === `${RELAY_PREFIX}/ping`)
26
38
  return handlePing(req, res);
27
39
  if (!handlers)
@@ -32,14 +44,31 @@ export async function handleRelayRequest(req, res, pathname, handlers) {
32
44
  return handleEvents(req, res, handlers);
33
45
  if (pathname === `${RELAY_PREFIX}/rpc`)
34
46
  return handleRpc(req, res, handlers);
47
+ const screenCall = screenCallOf(pathname, `${RELAY_PREFIX}/screen`);
48
+ if (screenCall)
49
+ return handleScreen(req, res, handlers, screenCall);
35
50
  end(res, 404, 'not found');
36
51
  }
37
- /** `GET /_relay/ping` (#1072): answer 200 with an empty body. Starts nothing; only proves this
38
- * daemon is reachable and the caller's cookie is valid (the shared-token guard (#1051) already enforced that). */
52
+ /** `/_relay/screen/<call>?run=<id>&project=<address>`: pass the call on to the run's live screen here. */
53
+ async function handleScreen(req, res, handlers, call) {
54
+ if (!handlers.screen)
55
+ return end(res, 404, 'relay screen not enabled');
56
+ const query = new URL(req.url ?? '/', 'http://localhost').searchParams;
57
+ const agentId = query.get('run');
58
+ if (!agentId || !isRunId(agentId))
59
+ return end(res, 400, 'missing run id');
60
+ const projectId = await projectNamed(handlers, query.get('project')).catch(() => undefined);
61
+ if (projectId === undefined)
62
+ return end(res, 404, 'no such project on this machine');
63
+ await passToScreen(req, res, call, await handlers.screen(projectId, agentId).catch(() => undefined));
64
+ }
65
+ /** `GET /_relay/ping` (#1072): answer 200 with this OpenAgent's version. Starts nothing; it proves this
66
+ * daemon is reachable, and to another machine that its key still lets it in, and tells that
67
+ * machine whether this one fell behind it. */
39
68
  function handlePing(req, res) {
40
69
  if (!requireGet(req, res))
41
70
  return;
42
- end(res, 200, '');
71
+ sendJson(res, { version: openagentVersion() });
43
72
  }
44
73
  /** `POST /_relay/start`: read the agent request, start it locally, and answer with the result JSON. */
45
74
  async function handleStart(req, res, handlers) {
@@ -55,26 +84,37 @@ async function handleStart(req, res, handlers) {
55
84
  const prompt = typeof body.prompt === 'string' ? body.prompt : '';
56
85
  const options = (body.options && typeof body.options === 'object' ? body.options : {});
57
86
  // Never relay onward from a relayed agent: strip any nested target before starting it here.
58
- // And a start relayed to a device never names a branch: the caller's branches are not this machine's.
59
- const { remote: _drop, base: _callers, ...local } = options;
87
+ // And a start relayed to a machine never names a branch: the caller's branches are not this machine's.
88
+ const { machine: _drop, base: _callers, ...local } = options;
60
89
  let result;
61
90
  try {
62
- result = await handlers.start(prompt, local, undefined);
91
+ const projectId = await projectNamed(handlers, body.project);
92
+ result =
93
+ projectId === undefined
94
+ ? { ok: false, error: `no project on this machine is cloned from ${String(body.project)}`, noProject: true }
95
+ : await handlers.start(prompt, local, projectId);
63
96
  }
64
97
  catch (err) {
65
98
  result = { ok: false, error: err instanceof Error ? err.message : String(err) };
66
99
  }
67
100
  sendJson(res, result);
68
101
  }
69
- /** `GET /_relay/events?run=<id>`: stream the agent's events as newline-delimited JSON. */
70
- function handleEvents(req, res, handlers) {
102
+ /** `GET /_relay/events?run=<id>&project=<address>`: stream the agent's events as newline-delimited JSON. */
103
+ async function handleEvents(req, res, handlers) {
71
104
  if (!requireGet(req, res))
72
105
  return;
73
- const agentId = new URL(req.url ?? '/', 'http://localhost').searchParams.get('run');
106
+ const query = new URL(req.url ?? '/', 'http://localhost').searchParams;
107
+ const agentId = query.get('run');
74
108
  if (!agentId)
75
109
  return end(res, 400, 'missing run id');
110
+ const projectId = await projectNamed(handlers, query.get('project')).catch(() => undefined);
111
+ if (projectId === undefined)
112
+ return end(res, 404, 'no such project on this machine');
113
+ // The caller went away while the project was looked up: a tail started now would never be stopped.
114
+ if (res.destroyed || req.socket.destroyed)
115
+ return;
76
116
  res.writeHead(200, { 'content-type': 'application/x-ndjson', 'cache-control': 'no-cache' });
77
- const stop = handlers.tailEvents(agentId, event => {
117
+ const stop = handlers.tailEvents(projectId, agentId, event => {
78
118
  // A dropped write (the caller went away mid-line) must not throw out of the tail callback.
79
119
  try {
80
120
  res.write(`${JSON.stringify(event)}\n`);
@@ -88,7 +128,7 @@ function handleEvents(req, res, handlers) {
88
128
  req.on('close', close);
89
129
  }
90
130
  const MAX_RPC_BODY = 256 * 1024;
91
- /** POST /_relay/rpc: run one whitelisted RPC on this device and answer {result}. */
131
+ /** POST /_relay/rpc: run one whitelisted RPC on this machine and answer {result}. */
92
132
  async function handleRpc(req, res, handlers) {
93
133
  if (req.method !== 'POST')
94
134
  return end(res, 405, 'method not allowed', { allow: 'POST' });
@@ -106,7 +146,10 @@ async function handleRpc(req, res, handlers) {
106
146
  if (!fn)
107
147
  return end(res, 400, 'missing rpc name');
108
148
  try {
109
- sendJson(res, { result: await handlers.rpc(fn, args) });
149
+ const projectId = await projectNamed(handlers, body.project);
150
+ if (projectId === undefined)
151
+ return end(res, 404, 'no such project on this machine');
152
+ sendJson(res, { result: await handlers.rpc(projectId, fn, args) });
110
153
  }
111
154
  catch (err) {
112
155
  end(res, 500, err instanceof Error ? err.message : 'rpc failed');
@@ -1 +1 @@
1
- {"version":3,"file":"relay-endpoints.js","sourceRoot":"","sources":["../../src/dashboard/relay-endpoints.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEnE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,SAAS,CAAA;AAiBrC,MAAM,cAAc,GAAG,GAAG,GAAG,IAAI,CAAA;AAEjC,+FAA+F;AAC/F,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,GAAoB,EACpB,GAAmB,EACnB,QAAgB,EAChB,QAAmC;IAEnC,mGAAmG;IACnG,qGAAqG;IACrG,IAAI,QAAQ,KAAK,GAAG,YAAY,OAAO;QAAE,OAAO,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IACpE,IAAI,CAAC,QAAQ;QAAE,OAAO,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,mBAAmB,CAAC,CAAA;IACxD,IAAI,QAAQ,KAAK,GAAG,YAAY,QAAQ;QAAE,OAAO,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAA;IAChF,IAAI,QAAQ,KAAK,GAAG,YAAY,SAAS;QAAE,OAAO,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAA;IAClF,IAAI,QAAQ,KAAK,GAAG,YAAY,MAAM;QAAE,OAAO,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ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