@parcha/agentrun-serve 0.1.0-beta.39 → 0.1.0-beta.41

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 (173) hide show
  1. package/CHANGELOG.md +114 -0
  2. package/README.md +129 -16
  3. package/dist/api-only.d.ts +3 -1
  4. package/dist/api-only.js +4 -2
  5. package/dist/api-token.d.ts +30 -0
  6. package/dist/api-token.js +89 -0
  7. package/dist/cli.js +19 -5
  8. package/dist/composio-made.d.ts +54 -0
  9. package/dist/composio-made.js +83 -0
  10. package/dist/composio-preset.d.ts +16 -8
  11. package/dist/composio-preset.js +106 -43
  12. package/dist/composio-triggers.d.ts +7 -2
  13. package/dist/composio-triggers.js +13 -7
  14. package/dist/computer-attach.d.ts +29 -11
  15. package/dist/computer-attach.js +141 -47
  16. package/dist/computer-keys.d.ts +4 -0
  17. package/dist/computer-keys.js +5 -0
  18. package/dist/computers.d.ts +11 -1
  19. package/dist/computers.js +21 -12
  20. package/dist/console/assets/index-C3gNPz58.css +1 -0
  21. package/dist/console/assets/index-COGhx_2Z.js +711 -0
  22. package/dist/console/index.html +2 -2
  23. package/dist/decisions.js +9 -2
  24. package/dist/email/account.d.ts +0 -1
  25. package/dist/email/account.js +3 -3
  26. package/dist/email/answer.d.ts +5 -0
  27. package/dist/email/answer.js +35 -0
  28. package/dist/email/mail.js +19 -26
  29. package/dist/email/names.d.ts +30 -0
  30. package/dist/email/names.js +34 -0
  31. package/dist/email/routes.d.ts +1 -0
  32. package/dist/email/routes.js +1 -1
  33. package/dist/email/tools.d.ts +11 -4
  34. package/dist/email/tools.js +91 -46
  35. package/dist/eval-feed.d.ts +26 -0
  36. package/dist/eval-feed.js +68 -0
  37. package/dist/eval-mailbox.d.ts +5 -2
  38. package/dist/eval-mailbox.js +14 -6
  39. package/dist/exa-keyless.d.ts +1 -1
  40. package/dist/exa-keyless.js +1 -1
  41. package/dist/feed/feed-faux.d.ts +62 -0
  42. package/dist/feed/feed-faux.js +123 -0
  43. package/dist/feed/fetch.d.ts +41 -0
  44. package/dist/feed/fetch.js +128 -0
  45. package/dist/feed/parse.d.ts +41 -0
  46. package/dist/feed/parse.js +300 -0
  47. package/dist/learn/check.d.ts +3 -1
  48. package/dist/learn/check.js +57 -2
  49. package/dist/learn/compile.d.ts +3 -2
  50. package/dist/learn/compile.js +7 -6
  51. package/dist/learn/promote.d.ts +25 -14
  52. package/dist/learn/promote.js +32 -14
  53. package/dist/learned-nodes.d.ts +21 -4
  54. package/dist/learned-nodes.js +21 -8
  55. package/dist/learned-workflow.d.ts +3 -3
  56. package/dist/learned-workflow.js +14 -5
  57. package/dist/learning-cost.d.ts +17 -8
  58. package/dist/learning-cost.js +12 -4
  59. package/dist/local-models.d.ts +7 -1
  60. package/dist/local-models.js +11 -5
  61. package/dist/mcp-oauth.d.ts +15 -1
  62. package/dist/mcp-oauth.js +39 -5
  63. package/dist/mcp-pin-first.d.ts +4 -2
  64. package/dist/mcp-pin-first.js +4 -3
  65. package/dist/mcp-servers-store.d.ts +58 -5
  66. package/dist/mcp-servers-store.js +136 -17
  67. package/dist/mcp.d.ts +2 -2
  68. package/dist/mcp.js +2 -2
  69. package/dist/observation/http.d.ts +4 -1
  70. package/dist/observation/http.js +5 -4
  71. package/dist/openapi.d.ts +1 -1
  72. package/dist/openapi.js +63 -27
  73. package/dist/port-models.d.ts +4 -1
  74. package/dist/port-models.js +1 -0
  75. package/dist/print.d.ts +6 -3
  76. package/dist/print.js +4 -2
  77. package/dist/refusal-words.d.ts +3 -0
  78. package/dist/refusal-words.js +3 -0
  79. package/dist/run-labels.d.ts +23 -0
  80. package/dist/run-labels.js +79 -0
  81. package/dist/run-launch.d.ts +2 -0
  82. package/dist/run-launch.js +2 -0
  83. package/dist/run-secrets.js +12 -4
  84. package/dist/run-view.d.ts +3 -4
  85. package/dist/run-view.js +26 -24
  86. package/dist/runner/adapter-loop.d.ts +6 -2
  87. package/dist/runner/adapter-loop.js +136 -22
  88. package/dist/runner/adapter-run-spec.d.ts +5 -0
  89. package/dist/runner/adapter-run-spec.js +75 -32
  90. package/dist/runner/beside.d.ts +6 -3
  91. package/dist/runner/beside.js +9 -7
  92. package/dist/runner/cli-run-spec.js +33 -26
  93. package/dist/runner/conformance/harness.js +69 -14
  94. package/dist/runner/conformance/subject.d.ts +4 -1
  95. package/dist/runner/journal-kinds.d.ts +22 -0
  96. package/dist/runner/journal-kinds.js +39 -0
  97. package/dist/runner/main.d.ts +1 -1
  98. package/dist/runner/main.js +2 -2
  99. package/dist/runner/mcp-claim.d.ts +3 -0
  100. package/dist/runner/mcp-claim.js +1 -1
  101. package/dist/runner/mcp-run.d.ts +4 -0
  102. package/dist/runner/mcp-run.js +5 -3
  103. package/dist/runner/model-route.d.ts +7 -3
  104. package/dist/runner/model-route.js +24 -9
  105. package/dist/runner/promotion.d.ts +16 -8
  106. package/dist/runner/promotion.js +178 -55
  107. package/dist/runner/workflow-first.d.ts +6 -5
  108. package/dist/runner/workflow-first.js +9 -7
  109. package/dist/runs-over-store.js +5 -2
  110. package/dist/sdk/runs.d.ts +7 -1
  111. package/dist/sdk/runs.js +19 -6
  112. package/dist/secret-cut.js +3 -1
  113. package/dist/secrets.js +3 -1
  114. package/dist/server.d.ts +27 -2
  115. package/dist/server.js +181 -56
  116. package/dist/store/dialect.d.ts +6 -0
  117. package/dist/store/dialect.js +2 -0
  118. package/dist/store/index.d.ts +1 -1
  119. package/dist/store/postgres/connection.d.ts +11 -5
  120. package/dist/store/postgres/connection.js +44 -17
  121. package/dist/store/postgres/dialect.js +6 -0
  122. package/dist/store/postgres/migrations/0015_run_labels.sql +5 -0
  123. package/dist/store/postgres/migrations/0016_minted_tokens.sql +21 -0
  124. package/dist/store/postgres/store.d.ts +7 -3
  125. package/dist/store/postgres/store.js +1 -0
  126. package/dist/store/schema.d.ts +9 -0
  127. package/dist/store/schema.js +26 -2
  128. package/dist/store/sqlite/connection.js +80 -8
  129. package/dist/store/sqlite/run-launch.d.ts +11 -0
  130. package/dist/store/sqlite/run-launch.js +8 -0
  131. package/dist/store/sqlite/run-patch.d.ts +2 -1
  132. package/dist/store/sqlite/run-patch.js +3 -2
  133. package/dist/store/sqlite/store.js +101 -26
  134. package/dist/store/sqlite/worker.d.ts +2 -0
  135. package/dist/store/sqlite/worker.js +13 -10
  136. package/dist/store/store.d.ts +53 -1
  137. package/dist/store-reads/journal.js +2 -1
  138. package/dist/store-reads/learning.d.ts +30 -13
  139. package/dist/store-reads/learning.js +130 -51
  140. package/dist/store-reads/runs.d.ts +4 -3
  141. package/dist/store-reads/runs.js +3 -2
  142. package/dist/store-view.js +4 -2
  143. package/dist/template-eval.d.ts +4 -0
  144. package/dist/template-eval.js +127 -50
  145. package/dist/templates.d.ts +24 -1
  146. package/dist/templates.js +129 -21
  147. package/dist/timeline/origin.d.ts +1 -1
  148. package/dist/timeline/origin.js +2 -2
  149. package/dist/tool-gate.d.ts +5 -3
  150. package/dist/tool-gate.js +5 -2
  151. package/dist/tools.d.ts +13 -0
  152. package/dist/tools.js +15 -10
  153. package/dist/trigger-adapter.d.ts +12 -36
  154. package/dist/trigger-adapters.js +2 -1
  155. package/dist/trigger-email.js +30 -77
  156. package/dist/trigger-feed.d.ts +12 -0
  157. package/dist/trigger-feed.js +371 -0
  158. package/dist/triggers.d.ts +27 -14
  159. package/dist/triggers.js +121 -80
  160. package/dist/webhooks.js +9 -5
  161. package/dist/workflow/decision-recovery.js +5 -2
  162. package/dist/workflow/decisions.d.ts +7 -0
  163. package/dist/workspace/computer-deps.d.ts +5 -1
  164. package/dist/workspace/computer-deps.js +2 -2
  165. package/dist/workspace/index.d.ts +1 -0
  166. package/dist/workspace/index.js +2 -0
  167. package/dist/workspace/resolve-computer.d.ts +32 -3
  168. package/dist/workspace/resolve-computer.js +47 -9
  169. package/launcher/agentrun-serve +6 -1
  170. package/package.json +10 -9
  171. package/templates/README.md +27 -2
  172. package/dist/console/assets/index-BNhZs-jp.css +0 -1
  173. package/dist/console/assets/index-BQv5aOGB.js +0 -700
package/dist/server.d.ts CHANGED
@@ -3,6 +3,7 @@ import { type HarnessCapability } from "./harness.js";
3
3
  import { type HarnessInstaller } from "./harness-install.js";
4
4
  import { type LearningMode } from "./learning.js";
5
5
  import { type Place } from "./place.js";
6
+ import { type ApiToken } from "./api-token.js";
6
7
  import { type Store } from "./store/index.js";
7
8
  import { type BoxOffer } from "./place-offers.js";
8
9
  import { type StoredKeys } from "./secrets.js";
@@ -10,7 +11,7 @@ import { type ComposioControl } from "./composio-preset.js";
10
11
  import type { TriggerAdapter } from "./trigger-adapter.js";
11
12
  import { type TriggerClock } from "./triggers.js";
12
13
  import { type ToolSettingsMap } from "./tool-plane.js";
13
- import { AttachHub } from "@parcha/agentrun-computer";
14
+ import { AttachHub, type HostedDial } from "@parcha/agentrun-computer";
14
15
  export declare const CONTRACT = "agentrun.v2/0";
15
16
  export declare const DEFAULT_PORT = 7340;
16
17
  export type ServeOptions = {
@@ -54,8 +55,13 @@ export type ServeOptions = {
54
55
  /** The address to listen on (default 127.0.0.1). On any other address every `Host` name is served and the token is
55
56
  * the only lock: put TLS in front of it. */
56
57
  host?: string;
57
- /** The token to require in place of the one `DIR/.token` keeps: 32 characters or more, no whitespace. */
58
+ /** The token to require in place of the one `DIR/.token` keeps: 32 characters or more, no whitespace. Its id is
59
+ * `default` (api-token.ts). */
58
60
  token?: string;
61
+ /** More API tokens (AGENTRUN_TOKENS, api-token.ts parseTokens), each with an id: every one opens every route the
62
+ * token opens. Given these and no `token`, `DIR/.token` is neither read nor made, and the first is the server's
63
+ * token. Each id names its token in the request log; no line holds a secret. */
64
+ tokens?: readonly ApiToken[];
59
65
  /** Default 7340; 0 is any free port. */
60
66
  port?: number;
61
67
  /** When the port is taken at the listen, the next one that is not, of the 100 from it: the port is found by listening,
@@ -165,6 +171,10 @@ export type ServeOptions = {
165
171
  learningBudget?: number;
166
172
  /** A test's seam: the triggers' clock and timer (triggers.ts), in place of Date.now and setTimeout. */
167
173
  triggerClock?: TriggerClock;
174
+ /** A test's and a template eval's seam: the URL a feed trigger's read of `url` goes to in its place (a fake feed on
175
+ * loopback, feed/feed-faux.ts); null when it serves no feed at `url` (read as unreachable, nothing sent); undefined
176
+ * to read it as it is. The trigger, its payload and its words keep `url`. */
177
+ feedsAt?: (url: string) => string | null | undefined;
168
178
  /** The server's store (store/index.ts), where the triggers and their firings live, with the agents they run as. Without
169
179
  * it the trigger routes answer unavailable and nothing fires. */
170
180
  store?: Pick<Store, "triggers" | "runs" | "agents"> & Partial<Pick<Store, "liveViewers">>;
@@ -191,6 +201,10 @@ export type ServeOptions = {
191
201
  /** Whether the outbound webhook may send to a private network or this machine: off by default, so no caller of the API
192
202
  * can make the server POST inside its own network. The operator's AGENTRUN_WEBHOOK_PRIVATE_TARGETS=1 turns it on. */
193
203
  webhookPrivateTargets?: boolean;
204
+ /** A test's seam: the addresses the outbound webhook's receiver's name resolves to, at a save's check and at each try
205
+ * (webhooks.ts), in place of the system resolver's. A test's server answers its example hosts here, so no CI
206
+ * runner's resolver decides what a test sees. */
207
+ webhookLookup?: (host: string) => Promise<string[]>;
194
208
  };
195
209
  /** The test switches a run's process gets, each module path resolved: empty outside tests. A test's in-process runner
196
210
  * takes the same (test/support.mjs startInProcessRunner). */
@@ -201,11 +215,14 @@ export declare function fauxEnvOf(options: ServeOptions): NodeJS.ProcessEnv;
201
215
  /** `boxesLine`: what the start's banner says of the boxes, in words (place.ts boxesLine). */
202
216
  /** `launchCode`: with no accounts, the code of the console's link this start prints (`/?launch=<code>`), which gives the
203
217
  * browser that opens it a console session (page.ts ConsoleSessions). */
218
+ /** `token` is the first of `tokenIds` (the console's session stands for it); `tokenIds` are the ids of every token the
219
+ * server takes, in order (api-token.ts), never their secrets. */
204
220
  export type Serve = {
205
221
  url: string;
206
222
  baseUrl: string;
207
223
  port: number;
208
224
  token: string;
225
+ tokenIds: readonly string[];
209
226
  tokenFile: string | null;
210
227
  tokenMade: boolean;
211
228
  setupUrl?: string;
@@ -216,10 +233,18 @@ export type Serve = {
216
233
  /** The live sockets of the computers paired with this server (computer-attach.ts): a runner beside the server in this
217
234
  * process takes it (runner/beside.ts), so its runs can use them. */
218
235
  attachHub: AttachHub;
236
+ /** What a dial provider's create takes of this server (HostedProvider's dial): the address its machines dial
237
+ * (AGENTRUN_PUBLIC_URL, absent without one), the tokens it mints for them (computer-attach.ts machineTokens) and the
238
+ * hub their sockets land in. The runner beside the server hands it to its remote providers (runner/beside.ts). */
239
+ dial: HostedDial;
219
240
  /** Whether this server is a local install (listening on loopback, reached at no address off it): the one kind whose own
220
241
  * runner beside it may reach an MCP server's URL on loopback (runner/beside.ts mcpLoopback). Only that runner is told:
221
242
  * it is this process's finding, never a store's, so another host's runner on a shared store never inherits it. */
222
243
  localInstall: boolean;
244
+ /** This server's own addresses (McpServersOverStore.own): where it listens, and its public address when that is on
245
+ * loopback. The runner beside it is told them with localInstall (runner/beside.ts mcpOwn), so its runs' loopback reads
246
+ * never reach this server, as its own reads never do. */
247
+ own: readonly string[];
223
248
  /** What a stop waits on: the runs whose processes still finish their turn, and the longest it waits on them. */
224
249
  stopping(): {
225
250
  runs: number;