@parcha/agentrun-serve 0.1.0-beta.53 → 0.1.0-beta.55

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 (224) hide show
  1. package/CHANGELOG.md +138 -3
  2. package/README.md +346 -99
  3. package/dist/adapters.d.ts +10 -0
  4. package/dist/adapters.js +46 -0
  5. package/dist/agent-package.d.ts +3 -3
  6. package/dist/agent-package.js +7 -14
  7. package/dist/agent-rows.d.ts +1 -1
  8. package/dist/agents-store.js +7 -6
  9. package/dist/api-only.d.ts +17 -6
  10. package/dist/api-only.js +22 -9
  11. package/dist/cli.js +11 -4
  12. package/dist/composio-made.d.ts +26 -1
  13. package/dist/composio-made.js +39 -2
  14. package/dist/composio-preset.d.ts +6 -4
  15. package/dist/composio-preset.js +50 -17
  16. package/dist/computer-held-routes.js +2 -3
  17. package/dist/computer-needs.d.ts +1 -1
  18. package/dist/computer-needs.js +1 -1
  19. package/dist/computer-setting.d.ts +8 -4
  20. package/dist/computer-setting.js +0 -2
  21. package/dist/computers-running.d.ts +8 -0
  22. package/dist/computers-running.js +27 -0
  23. package/dist/computers.d.ts +0 -2
  24. package/dist/computers.js +1 -1
  25. package/dist/console/assets/backend-D5EmB4N3.js +166 -0
  26. package/dist/console/assets/index-DUYLaqiR.js +746 -0
  27. package/dist/console/assets/index-DYhU4adm.css +1 -0
  28. package/dist/console/index.html +2 -2
  29. package/dist/docker-host-addresses.d.ts +23 -3
  30. package/dist/docker-host-addresses.js +90 -18
  31. package/dist/errors.d.ts +4 -0
  32. package/dist/errors.js +7 -0
  33. package/dist/exa-keyless.d.ts +2 -3
  34. package/dist/exa-keyless.js +43 -127
  35. package/dist/firecrawl-keyless.d.ts +41 -0
  36. package/dist/firecrawl-keyless.js +152 -0
  37. package/dist/github-connection.d.ts +50 -1
  38. package/dist/github-connection.js +96 -3
  39. package/dist/github-faux.d.ts +11 -2
  40. package/dist/github-faux.js +138 -7
  41. package/dist/github-pull-request.d.ts +37 -0
  42. package/dist/github-pull-request.js +110 -0
  43. package/dist/handed-secret.d.ts +3 -1
  44. package/dist/handed-secret.js +4 -2
  45. package/dist/harness-keys.d.ts +98 -0
  46. package/dist/harness-keys.js +247 -0
  47. package/dist/harness-recipe-entry.d.ts +14 -9
  48. package/dist/harness-recipe-entry.js +25 -14
  49. package/dist/harness-table.d.ts +16 -1
  50. package/dist/harness-table.js +19 -7
  51. package/dist/harness.d.ts +4 -0
  52. package/dist/harness.js +12 -1
  53. package/dist/host-check.d.ts +2 -0
  54. package/dist/host-check.js +6 -0
  55. package/dist/import-summary.d.ts +1 -1
  56. package/dist/import-summary.js +1 -1
  57. package/dist/import.d.ts +5 -5
  58. package/dist/import.js +54 -67
  59. package/dist/keyless-mcp.d.ts +36 -0
  60. package/dist/keyless-mcp.js +127 -0
  61. package/dist/learn/audit.d.ts +3 -3
  62. package/dist/learn/audit.js +3 -3
  63. package/dist/learn/commit.d.ts +8 -7
  64. package/dist/learn/commit.js +60 -20
  65. package/dist/learn/compile.d.ts +4 -3
  66. package/dist/learn/compile.js +7 -5
  67. package/dist/learn/folder.d.ts +16 -3
  68. package/dist/learn/folder.js +46 -13
  69. package/dist/learn/promote.d.ts +37 -13
  70. package/dist/learn/promote.js +112 -40
  71. package/dist/learn/secrets.js +10 -2
  72. package/dist/learning-routes.d.ts +22 -17
  73. package/dist/learning-routes.js +40 -39
  74. package/dist/learning.js +2 -2
  75. package/dist/live-reach.d.ts +34 -7
  76. package/dist/live-reach.js +76 -11
  77. package/dist/manifest.d.ts +10 -0
  78. package/dist/manifest.js +30 -0
  79. package/dist/mcp-pin-first.d.ts +4 -2
  80. package/dist/mcp-pin-first.js +5 -2
  81. package/dist/mcp-probe.js +2 -2
  82. package/dist/mcp-secret-writes.d.ts +16 -7
  83. package/dist/mcp-secret-writes.js +35 -27
  84. package/dist/mcp-servers-store.d.ts +30 -6
  85. package/dist/mcp-servers-store.js +112 -28
  86. package/dist/mcp-sources.d.ts +10 -2
  87. package/dist/mcp-sources.js +9 -2
  88. package/dist/mcp-store.d.ts +13 -7
  89. package/dist/mcp-store.js +12 -9
  90. package/dist/model-form.d.ts +3 -2
  91. package/dist/model-form.js +11 -7
  92. package/dist/model.d.ts +20 -4
  93. package/dist/model.js +68 -9
  94. package/dist/native/history.d.ts +1 -1
  95. package/dist/native/history.js +2 -2
  96. package/dist/ollama-provider.d.ts +92 -0
  97. package/dist/ollama-provider.js +495 -0
  98. package/dist/openapi/agentrun-v2.openapi.json +2 -2
  99. package/dist/openapi.js +235 -41
  100. package/dist/page.d.ts +11 -3
  101. package/dist/page.js +22 -7
  102. package/dist/place-offers.d.ts +17 -1
  103. package/dist/place-offers.js +46 -5
  104. package/dist/print.js +1 -1
  105. package/dist/purged-workflow.d.ts +35 -7
  106. package/dist/purged-workflow.js +73 -26
  107. package/dist/run-computer.d.ts +2 -0
  108. package/dist/run-computer.js +2 -0
  109. package/dist/run-files.d.ts +4 -0
  110. package/dist/run-files.js +4 -0
  111. package/dist/run-keys.d.ts +2 -4
  112. package/dist/run-keys.js +6 -7
  113. package/dist/run-launch.d.ts +4 -0
  114. package/dist/run-launch.js +4 -0
  115. package/dist/run-reads-over-store.d.ts +3 -2
  116. package/dist/run-reads-over-store.js +66 -2
  117. package/dist/run-secrets.js +5 -2
  118. package/dist/runner/adapter-loop.d.ts +6 -3
  119. package/dist/runner/adapter-loop.js +34 -15
  120. package/dist/runner/adapter-run-spec.d.ts +3 -0
  121. package/dist/runner/adapter-run-spec.js +6 -4
  122. package/dist/runner/audit.js +8 -4
  123. package/dist/runner/beside.d.ts +2 -1
  124. package/dist/runner/beside.js +6 -2
  125. package/dist/runner/claim-secrets.d.ts +5 -8
  126. package/dist/runner/claim-secrets.js +6 -0
  127. package/dist/runner/cli-run-spec.d.ts +1 -1
  128. package/dist/runner/cli-run-spec.js +39 -7
  129. package/dist/runner/harness-loops.d.ts +22 -9
  130. package/dist/runner/harness-loops.js +21 -11
  131. package/dist/runner/held.d.ts +3 -0
  132. package/dist/runner/learning-end.d.ts +1 -1
  133. package/dist/runner/learning-end.js +8 -3
  134. package/dist/runner/loop-contract.d.ts +5 -4
  135. package/dist/runner/main.js +4 -2
  136. package/dist/runner/mcp-claim.d.ts +3 -0
  137. package/dist/runner/mcp-claim.js +26 -2
  138. package/dist/runner/mcp-run.d.ts +3 -0
  139. package/dist/runner/mcp-run.js +2 -1
  140. package/dist/runner/metrics.d.ts +10 -8
  141. package/dist/runner/metrics.js +20 -27
  142. package/dist/runner/model-route.d.ts +3 -0
  143. package/dist/runner/model-route.js +6 -2
  144. package/dist/runner/pr-checkout.d.ts +21 -4
  145. package/dist/runner/pr-checkout.js +103 -4
  146. package/dist/runner/promotion.d.ts +15 -9
  147. package/dist/runner/promotion.js +25 -15
  148. package/dist/runner/run-child-host.js +24 -11
  149. package/dist/runner/run-child.js +3 -1
  150. package/dist/runner/runner-check.d.ts +3 -0
  151. package/dist/runner/runner-check.js +23 -0
  152. package/dist/runner/sdk-loop.js +2 -0
  153. package/dist/runner/workflow-loop.d.ts +2 -2
  154. package/dist/runner/workflow-loop.js +1 -2
  155. package/dist/runner/workflow-spec.d.ts +1 -1
  156. package/dist/runner/workflow-spec.js +6 -6
  157. package/dist/sdk/check.d.ts +4 -1
  158. package/dist/sdk/check.js +2 -1
  159. package/dist/sdk/runs.d.ts +2 -2
  160. package/dist/sdk/runs.js +8 -6
  161. package/dist/secret-cut.js +2 -1
  162. package/dist/secret-writes.d.ts +3 -2
  163. package/dist/secret-writes.js +1 -1
  164. package/dist/server.d.ts +55 -8
  165. package/dist/server.js +363 -118
  166. package/dist/standard-webhooks.d.ts +11 -0
  167. package/dist/standard-webhooks.js +20 -2
  168. package/dist/store/agent-body.d.ts +2 -2
  169. package/dist/store/agent-body.js +2 -2
  170. package/dist/store/index.d.ts +1 -1
  171. package/dist/store/schema.js +5 -2
  172. package/dist/store/sqlite/store.js +90 -34
  173. package/dist/store/store.d.ts +54 -14
  174. package/dist/store-reads/journal.d.ts +7 -2
  175. package/dist/store-reads/journal.js +9 -6
  176. package/dist/store-reads/learning.d.ts +12 -9
  177. package/dist/store-reads/learning.js +18 -24
  178. package/dist/store-view.d.ts +0 -5
  179. package/dist/store-view.js +9 -8
  180. package/dist/suggestions.d.ts +282 -0
  181. package/dist/suggestions.js +919 -0
  182. package/dist/telemetry.d.ts +8 -1
  183. package/dist/telemetry.js +12 -4
  184. package/dist/template-eval.d.ts +49 -4
  185. package/dist/template-eval.js +168 -45
  186. package/dist/template-import.d.ts +17 -0
  187. package/dist/template-import.js +36 -2
  188. package/dist/templates.d.ts +83 -76
  189. package/dist/templates.js +29 -48
  190. package/dist/timeline/labels.d.ts +2 -2
  191. package/dist/timeline/labels.js +2 -2
  192. package/dist/timeline/timeline.d.ts +2 -2
  193. package/dist/timeline/timeline.js +1 -1
  194. package/dist/tool-plane.d.ts +17 -9
  195. package/dist/tool-plane.js +38 -17
  196. package/dist/tools.js +2 -2
  197. package/dist/trigger-launch-hook.d.ts +19 -9
  198. package/dist/trigger-launch-hook.js +35 -25
  199. package/dist/trigger-targets.d.ts +18 -8
  200. package/dist/trigger-targets.js +42 -19
  201. package/dist/triggers.d.ts +85 -23
  202. package/dist/triggers.js +303 -96
  203. package/dist/validate.d.ts +1 -1
  204. package/dist/validate.js +2 -2
  205. package/dist/web-fake.js +3 -3
  206. package/dist/web-fetch-direct.d.ts +4 -0
  207. package/dist/web-fetch-direct.js +8 -1
  208. package/dist/web-fetch.d.ts +12 -3
  209. package/dist/web-fetch.js +47 -14
  210. package/dist/web-search.d.ts +33 -4
  211. package/dist/web-search.js +100 -41
  212. package/dist/webhooks.js +4 -5
  213. package/dist/workspace/synced-folder.d.ts +1 -1
  214. package/dist/workspace/synced-folder.js +11 -14
  215. package/launcher/agentrun-serve +5 -1
  216. package/package.json +17 -13
  217. package/templates/README.md +5 -4
  218. package/templates/agent-scout/agent.md +46 -0
  219. package/templates/agent-scout/skills/scout/SKILL.md +88 -0
  220. package/templates/agent-scout/skills/scout/suggestions.schema.json +112 -0
  221. package/dist/console/assets/index-BFgyZzF_.js +0 -734
  222. package/dist/console/assets/index-DbilxljH.css +0 -1
  223. package/dist/import-sources.d.ts +0 -116
  224. package/dist/import-sources.js +0 -693
@@ -15,7 +15,7 @@ import { defineExtension, ROOT_CONVERSATION_ID, wrapTool } from "@earendil-works
15
15
  import { chargedCost, DecisionProviderError, EffectFailure, inspectWorkflow } from "@parcha/agentrun-dsl";
16
16
  import { modelPortFor } from "@parcha/agentrun-kernel";
17
17
  import { startModelProxy } from "@parcha/agentrun-kernel/host";
18
- import { CapRefused, checkRaise, DecisionPriceUnreadable, DECISION_SESSION, followUpOf, freeCeilingMessage, freeRequestLimitOf, parkOf, runCap } from "@parcha/agentrun-kernel/kernel/cap";
18
+ import { CapRefused, checkRaise, DecisionPriceUnreadable, DECISION_SESSION, followUpOf, freeCeilingMessage, freeRequestLimitOf, maxRequestsOf, parkOf, runCap } from "@parcha/agentrun-kernel/kernel/cap";
19
19
  import { completer } from "../llm.js";
20
20
  // The decision providers' list prices, the catalog's read and the replay check (decision-cap.ts), with holdOf, which the
21
21
  // parity tests hold this cap's figures to.
@@ -43,7 +43,7 @@ import { KINDS, NODE_LOG_SESSION, WORKFLOW_SESSION } from "./journal-kinds.js";
43
43
  import { cutStrings } from "../key-refusal.js";
44
44
  import { CLOSE_MS } from "./loop.js";
45
45
  import { PAUSED_WORDS } from "./workflow-loop.js";
46
- import { heldRedactor, holdClaimed } from "./redact.js";
46
+ import { holdClaimed } from "./redact.js";
47
47
  import { holdStored } from "./store-secrets.js";
48
48
  import { workflowHost } from "./workflow-host.js";
49
49
  import { SUBMIT_TOOL } from "../workflow/host-tools.js";
@@ -140,7 +140,7 @@ export function workflowSpecOf(deps) {
140
140
  const holding = async (opening) => {
141
141
  const opened = await opening;
142
142
  if (run?.redact)
143
- holdClaimed(heldRedactor(run.redact), opened);
143
+ holdClaimed(run.redact, opened);
144
144
  return opened;
145
145
  };
146
146
  const claimed = await readClaim(deps, claim.runId);
@@ -153,7 +153,7 @@ export function workflowSpecOf(deps) {
153
153
  throw new Error(nodeToolUnboundText(unbound));
154
154
  // Every secret the server keeps sealed (store-secrets.ts) held by the runner's one redactor before the workflow runs.
155
155
  if (run?.redact && deps.sealKey)
156
- await holdStored(heldRedactor(run.redact), deps.store, deps.sealKey, deps.data);
156
+ await holdStored(run.redact, deps.store, deps.sealKey, deps.data);
157
157
  const tiers = tiersOf(claimed.workflow);
158
158
  // The run's own keys, as the server's runnable check reads them: each by its name from the runner's environment first,
159
159
  // then the store's sealed value (claim-secrets.ts; the environment wins, rule 4), scoped to what the run needs. Its
@@ -171,7 +171,7 @@ export function workflowSpecOf(deps) {
171
171
  if (keyedAtClaim(runKey))
172
172
  withoutModelKeys(claimedEnv);
173
173
  if (runKey && run?.redact)
174
- holdRunKey(heldRedactor(run.redact), runKey);
174
+ holdRunKey(run.redact, runKey);
175
175
  const providerOf = deps.providerOf ?? routeProviderOf(claimModelEnv(deps.env ?? process.env, claimedEnv, runKey, claim));
176
176
  // Each tier's provider and cap model, resolved once; the proxies start here (before the Harness opens, since the models
177
177
  // catalog the Harness takes points at them), their hooks deferred to the booking wired at harnessReady.
@@ -342,7 +342,7 @@ export function workflowSpecOf(deps) {
342
342
  const writer = await sessions.open(SESSION);
343
343
  // Its model nodes' requests on free models count toward the run's limit of them, capped or not. A step waiting for
344
344
  // room under it (a map's branch, beside its siblings' holds) leaves at the run's stop or park, unsent.
345
- const run = runCap({ sessions: sessions, capUsd: () => effectiveCapUsd, modelOf: capModelOf, freeRequests: freeRequestLimitOf(deps.env ?? process.env, claimed.revision.body.maxRequests), ...(context.abortSignal ? { stopped: context.abortSignal } : {}) });
345
+ const run = runCap({ sessions: sessions, capUsd: () => effectiveCapUsd, modelOf: capModelOf, freeRequests: freeRequestLimitOf(deps.env ?? process.env, claimed.revision.body.maxRequests), ...(maxRequestsOf(claimed.revision.body.maxRequests) === undefined ? {} : { maxRequests: maxRequestsOf(claimed.revision.body.maxRequests) }), ...(context.abortSignal ? { stopped: context.abortSignal } : {}) });
346
346
  booking = await modelPortFor(writer, {
347
347
  key: SESSION,
348
348
  label: SESSION,
@@ -1,4 +1,5 @@
1
1
  import type { Shown } from "../learning.js";
2
+ import { type PromotionDeps } from "../runner/promotion.js";
2
3
  import type { RunLaunch } from "../run-launch.js";
3
4
  import type { Store } from "../store/store.js";
4
5
  import type { SdkInbox } from "./runs.js";
@@ -21,7 +22,8 @@ export type SdkWorkflowCheckEvent = {
21
22
  * the check (sdkCheckTurn: kept until the check holds compile_after rows, the one that makes compile_after deciding on
22
23
  * them all); any other turn is given back (releaseSdkCheck) and the check waits for the next turn; a turn the backend
23
24
  * never completed before its inbox expired is one failed row (sdkCheckDeadline). Exact retries and reclaims compete on
24
- * the reservation. */
25
+ * the reservation. `refused`: what the purge gate refuses of the records, so the promotions trim keeps the champion its
26
+ * readers serve (purged-workflow.ts refusedIn). */
25
27
  export declare function settleSdkCheck(deps: {
26
28
  store: Store;
27
29
  agentId: string;
@@ -29,4 +31,5 @@ export declare function settleSdkCheck(deps: {
29
31
  inbox: SdkInbox;
30
32
  shown: () => Promise<Shown>;
31
33
  log: (line: string) => void;
34
+ refused?: PromotionDeps["refused"];
32
35
  }): Promise<import("../learn/promote.js").Recorded | undefined>;
package/dist/sdk/check.js CHANGED
@@ -25,7 +25,8 @@ function notBaseline(inbox, reported) {
25
25
  * the check (sdkCheckTurn: kept until the check holds compile_after rows, the one that makes compile_after deciding on
26
26
  * them all); any other turn is given back (releaseSdkCheck) and the check waits for the next turn; a turn the backend
27
27
  * never completed before its inbox expired is one failed row (sdkCheckDeadline). Exact retries and reclaims compete on
28
- * the reservation. */
28
+ * the reservation. `refused`: what the purge gate refuses of the records, so the promotions trim keeps the champion its
29
+ * readers serve (purged-workflow.ts refusedIn). */
29
30
  export async function settleSdkCheck(deps) {
30
31
  const { inbox } = deps;
31
32
  const check = inbox.learning_check;
@@ -131,8 +131,8 @@ export declare class SdkRuns {
131
131
  workflows: LearnedWorkflow[];
132
132
  };
133
133
  }>;
134
- /** The purged run (purged-workflow.ts) that wrote a workflow of `pinned`, each read at the learning commit a start took
135
- * its text from. One read-only exec per commit. */
134
+ /** The purged run (purgeGate) that wrote a workflow of `pinned`, each read at the learning commit a start took its
135
+ * text from. One read-only exec per commit. */
136
136
  private purgedPinned;
137
137
  /** The workflows a start delivers and the learning commit each was read at (`commits`: the seed's, or its champion
138
138
  * record's), and the drafts a check may take. */
package/dist/sdk/runs.js CHANGED
@@ -18,7 +18,7 @@ import { secretRedactor } from "../runner/redact.js";
18
18
  import { redactedOutput } from "../key-refusal.js";
19
19
  import { decodedStrings, draftProblems } from "../learn/workflow-draft.js";
20
20
  import { snapshotAt } from "../learn/folder.js";
21
- import { purgedRun, purgedWorkflows } from "../purged-workflow.js";
21
+ import { purgedRun, purgeGate, refusedIn, refusedOf } from "../purged-workflow.js";
22
22
  import { sdkWorkflowManifest, sdkDraftTools } from "./workflows.js";
23
23
  import { promotionOf, promotionsOf, resetAtOf } from "../learn/promote.js";
24
24
  import { championTextOf, releaseSdkCheck, reserveSdkCheck } from "../runner/promotion.js";
@@ -308,7 +308,7 @@ export class SdkRuns {
308
308
  // A turn is a check only when it can be one's baseline: no protected value in its task or policy, and an input the
309
309
  // draft takes (sdkTakes). A prose turn whose input the client cannot resolve is given back (releaseSdkCheck).
310
310
  const takes = (flow) => !redacted && sdkTakes(flow, input, resolveSchemaForWorkflow);
311
- const checkDeps = { store: this.store, agentId: entry.agent.id, log: () => { }, shown: async () => secretsShown(this.secrets(), { local: true }) };
311
+ const checkDeps = { store: this.store, agentId: entry.agent.id, log: () => { }, shown: async () => secretsShown(this.secrets(), { local: true }), refused: refusedIn(() => learningFolderOf(this.data, entry.agent.id), this.store) };
312
312
  const check = learning ? await reserveSdkCheck(checkDeps, { runId, revision: learning.seed, learning: revisionBody.learning, flows: selected.candidates, takes }) : undefined;
313
313
  // A shadow check needs the original agent's own answer, not an answer produced by its existing champion.
314
314
  const workflows = check ? [] : selected.workflows;
@@ -407,15 +407,15 @@ export class SdkRuns {
407
407
  },
408
408
  };
409
409
  }
410
- /** The purged run (purged-workflow.ts) that wrote a workflow of `pinned`, each read at the learning commit a start took
411
- * its text from. One read-only exec per commit. */
410
+ /** The purged run (purgeGate) that wrote a workflow of `pinned`, each read at the learning commit a start took its
411
+ * text from. One read-only exec per commit. */
412
412
  async purgedPinned(agentId, pinned) {
413
413
  if (pinned.length === 0)
414
414
  return undefined;
415
415
  const folder = learningFolderOf(this.data, agentId);
416
416
  try {
417
417
  const reads = new Map();
418
- const at = (commit) => reads.get(commit) ?? reads.set(commit, snapshotAt(folder.workspace, commit).then((snapshot) => purgedWorkflows(snapshot, this.store))).get(commit);
418
+ const at = (commit) => reads.get(commit) ?? reads.set(commit, snapshotAt(folder.workspace, commit).then(async (snapshot) => (await purgeGate(snapshot, this.store)).workflows)).get(commit);
419
419
  for (const [flow, commit] of pinned) {
420
420
  const row = (await at(commit)).get(flow.name);
421
421
  if (row)
@@ -447,8 +447,10 @@ export class SdkRuns {
447
447
  };
448
448
  const workflows = [], candidates = [], commits = {};
449
449
  const atCommit = async (name, commit) => chooseWorkflows(await seedAt(folder.workspace, commit, this.store), secretsShown(this.secrets(), { local: true })).flows.find((one) => one.name === name);
450
+ // The champion skips a record the purge gate refuses at its commit (purged-workflow.ts refusedOf), as a claim's does.
451
+ const refused = async (all, names) => refusedOf(all, names ?? all.map((one) => one.workflow), folder.workspace, this.store);
450
452
  for (const flow of flows) {
451
- const { text: serving, champion } = await championTextOf(records, flow, atCommit);
453
+ const { text: serving, champion } = await championTextOf(records, flow, atCommit, refused);
452
454
  if (serving && compatible(serving)) {
453
455
  workflows.push(serving);
454
456
  commits[serving.name] = serving === flow ? seed.sha : champion.commit;
@@ -2,8 +2,9 @@
2
2
  // cut, for what the importer writes (a transcript can hold a key a tool printed or was given). The import adds the keys
3
3
  // secretlint finds in what it reads (`secretsIn`): keys of a known format, whoever's they are.
4
4
  import { lintSource } from "@secretlint/core";
5
+ // The recommended preset's rules, built into core since secretlint v14 (the preset's own package is deprecated).
6
+ import { recommendedRules as recommended } from "@secretlint/core/builtin";
5
7
  import { secretLintProfiler } from "@secretlint/profiler";
6
- import { rules as recommended } from "@secretlint/secretlint-rule-preset-recommend";
7
8
  // No performance marks: the profiler would leave about 14 a call in the process's global buffer.
8
9
  secretLintProfiler.setEnabled(false);
9
10
  import { keyShaped } from "./secret-name.js";
@@ -63,10 +63,11 @@ export type SecretPredicate = (body: unknown) => boolean;
63
63
  /** What a request is besides its body, for a predicate that must read what is stored: the route's path parameters (in
64
64
  * the order its pattern names them) and the server's one store. `seen`: what the predicate read to let the request
65
65
  * through, which the dispatch hands its operation, so a write allowed against one stored state is refused when that
66
- * state changed before the write lands. */
66
+ * state changed before the write lands. `apiOnly`: the server is API-only (api-only.ts), with no owner to write one. */
67
67
  export type SecretRequest = {
68
68
  readonly params: readonly string[];
69
69
  readonly store: unknown;
70
+ readonly apiOnly?: boolean;
70
71
  seen?: unknown;
71
72
  };
72
73
  /** Whether a request writes a secret by what it would do to what is stored (drop or replace a sealed credential), read
@@ -139,7 +140,7 @@ export declare const SECRET_META_SCHEMA: {
139
140
  readonly name: {
140
141
  readonly type: "string";
141
142
  readonly pattern: "^[a-z][a-z0-9-]*(:[^:]+)+$";
142
- readonly description: "The secret's name, \"<plane>:<id>\": a lowercase plane and the id as the plane keys it, joined with \":\": tool:<KEY_NAME>, model:<KEY_NAME>, mcp:<server> (several of one server: mcp:<server>:<field>), computer:<provider>:<KEY>, workspace:archil, trigger:<id>, webhook:outbound, github:app, source:<adapter>:<field>. An object holding one secret carries it as `secret`, one holding several as `secrets`.";
143
+ readonly description: "The secret's name, \"<plane>:<id>\": a lowercase plane and the id as the plane keys it, joined with \":\": tool:<KEY_NAME>, model:<KEY_NAME>, mcp:<server> (several of one server: mcp:<server>:<field>), computer:<provider>:<KEY>, harness:<harness>:<KEY>, workspace:archil, trigger:<id>, webhook:outbound, github:app, source:<adapter>:<field>. An object holding one secret carries it as `secret`, one holding several as `secrets`.";
143
144
  };
144
145
  readonly set: {
145
146
  readonly type: "boolean";
@@ -160,7 +160,7 @@ export const SECRET_META_SCHEMA = {
160
160
  required: ["name", "set", "source", "changed_at"],
161
161
  description: "What a secret's view says of it: its name, whether it is set, where it came from, and when it last changed. Never a value, a prefix, a length or a hash.",
162
162
  properties: {
163
- name: { type: "string", pattern: "^[a-z][a-z0-9-]*(:[^:]+)+$", description: "The secret's name, \"<plane>:<id>\": a lowercase plane and the id as the plane keys it, joined with \":\": tool:<KEY_NAME>, model:<KEY_NAME>, mcp:<server> (several of one server: mcp:<server>:<field>), computer:<provider>:<KEY>, workspace:archil, trigger:<id>, webhook:outbound, github:app, source:<adapter>:<field>. An object holding one secret carries it as `secret`, one holding several as `secrets`." },
163
+ name: { type: "string", pattern: "^[a-z][a-z0-9-]*(:[^:]+)+$", description: "The secret's name, \"<plane>:<id>\": a lowercase plane and the id as the plane keys it, joined with \":\": tool:<KEY_NAME>, model:<KEY_NAME>, mcp:<server> (several of one server: mcp:<server>:<field>), computer:<provider>:<KEY>, harness:<harness>:<KEY>, workspace:archil, trigger:<id>, webhook:outbound, github:app, source:<adapter>:<field>. An object holding one secret carries it as `secret`, one holding several as `secrets`." },
164
164
  set: { type: "boolean", description: "Whether a value is set." },
165
165
  source: { enum: ["env", "console", "sign-in", null], description: "Where it came from: env, the environment the server starts with (which always wins, by the same name, and greys the console's field); console, pasted in the console by the owner's session; sign-in, obtained by an OAuth sign-in or Connect. null when not set." },
166
166
  changed_at: { type: ["string", "null"], format: "date-time", description: "When the credential itself last changed (pasted, signed in, rotated); null when not set or not known." },
package/dist/server.d.ts CHANGED
@@ -8,9 +8,11 @@ import { type LearningMode } from "./learning.js";
8
8
  import { type Place } from "./place.js";
9
9
  import { type ApiToken } from "./api-token.js";
10
10
  import { type Store } from "./store/index.js";
11
- import { type BoxOffer } from "./place-offers.js";
11
+ import { type BoxOffer, type ContainerFacts } from "./place-offers.js";
12
+ import { type Wait } from "./docker-host-addresses.js";
12
13
  import { type StoredKeys } from "./secrets.js";
13
14
  import { type ComposioControl } from "./composio-preset.js";
15
+ import type { UsageEventName } from "./telemetry.js";
14
16
  import type { TriggerAdapter } from "./trigger-adapter.js";
15
17
  import { type TriggerClock } from "./triggers.js";
16
18
  import type { LaunchHook } from "./trigger-launch-hook.js";
@@ -27,6 +29,9 @@ export type ServeOptions = {
27
29
  /** On Postgres: told when this server's owner lock is lost for good (another server took the schema, or the lock could
28
30
  * not be taken back): every store call is refused from then. The CLI exits 1 on it, so the platform restarts the server. */
29
31
  onStoreLost?: (error: Error) => void;
32
+ /** Told when someone uses a feature the anonymous counts name (telemetry.ts UsageEventName: a suggestions scan, a
33
+ * discard, a suggested agent created). The CLI hands it the counts' `used`; it hears the event's name and nothing else. */
34
+ onUsage?: (event: UsageEventName) => void;
30
35
  /** The owner, signed in with a password (owner.ts): the page asks for it, and the token stays for scripts and the CLI. */
31
36
  accounts?: boolean;
32
37
  /** With accounts: the first visit sets the password with no setup code (a server with no public address). Honored only
@@ -142,6 +147,10 @@ export type ServeOptions = {
142
147
  /** With `faux` only: a module whose default export is the fetch web_search's keyless Exa search sends through, in place
143
148
  * of Exa's MCP endpoint (exa-keyless.ts). */
144
149
  fauxExa?: string;
150
+ /** With `faux` only: the URL of a fake MCP server (a test's, on loopback) that web_search's and web_fetch's keyless
151
+ * Firecrawl ask in place of Firecrawl's endpoint (firecrawl-keyless.ts). A URL, not a module: it is passed as given.
152
+ * Under `faux` with none, keyless Firecrawl is never asked. */
153
+ fauxFirecrawl?: string;
145
154
  /** A module of harness table entries merged over the built-in ones (harness-table.ts HARNESS_TABLE_ENV): a test's
146
155
  * stand-ins for the harnesses. */
147
156
  harnessTable?: string;
@@ -165,6 +174,12 @@ export type ServeOptions = {
165
174
  /** Under `faux`: a file read as this server's /proc/self/mountinfo (box-paths.ts), a container's in a test; absent (and
166
175
  * no FAUX_MOUNTINFO_ENV), a faux server is on a host. */
167
176
  fauxMountinfo?: string;
177
+ /** For tests: whether Docker's start probe takes this server to be in a container (place-offers.ts containerReason),
178
+ * in place of its own marks; a faux server's is a host's. */
179
+ probeContainer?: ContainerFacts;
180
+ /** For tests: the wait before each read again of the Docker host's addresses after the start's failed
181
+ * (docker-host-addresses.ts retryHostAddresses), in place of the backoff's timer. */
182
+ hostReadWait?: Wait;
168
183
  /** Extra `Host` names to accept besides the loopback ones, on any port (host-check.ts). */
169
184
  allowHosts?: string[];
170
185
  /** The console's built files, answered at / (default dist/console beside the server, which this package's build copies
@@ -215,6 +230,9 @@ export type ServeOptions = {
215
230
  githubApi?: string;
216
231
  /** A test's seam: the origin a github_app MCP server may have (default GitHub's hosted MCP: github.ts GITHUB_MCP_ORIGIN). */
217
232
  githubMcpOrigin?: string;
233
+ /** A test's seam: the one origin a Composio key read from the environment is sent to (default Composio's:
234
+ * composio-made.ts COMPOSIO_ORIGIN). */
235
+ composioMcpOrigin?: string;
218
236
  /** A test's seam: how long a hook's body has to arrive, whole (default 30 s: push-handler.ts HOOK_BODY_MS). */
219
237
  hookBodyMs?: number;
220
238
  /** A test's seam: awaited by a message (a person's, or a trigger's firing) once its checks have passed and just before its
@@ -294,10 +312,20 @@ export type Serve = {
294
312
  * it is this process's finding, never a store's, so another runner on a shared store never inherits it. A runner in
295
313
  * its own process takes its own operator's opt-in from its own environment (runner/main.ts runnerLoopback). */
296
314
  localInstall: boolean;
315
+ /** The OLLAMA_HOST its runner beside it asks (ollama-provider.ts ollamaHostOf): this server's own, else the default
316
+ * address where this is one owner's own machine; none on a shared one that names none (runner/beside.ts ollamaHost). */
317
+ ollamaHost: string | undefined;
297
318
  /** This server's own addresses (McpServersOverStore.own): where it listens, and its public address when that is on
298
319
  * loopback. The runner beside it is told them with localInstall (runner/beside.ts mcpOwn), so its runs' loopback reads
299
320
  * never reach this server, as its own reads never do. */
300
321
  own: readonly string[];
322
+ /** With --faux-github: the fake GitHub's API and its repository's site, for a test's own runner alone
323
+ * (test/support.mjs): the runner's GitHub API has one way in, a test runner's option, so neither the CLI's runner nor
324
+ * any setting is ever pointed at it. */
325
+ fauxGitHub?: {
326
+ api: string;
327
+ web?: string;
328
+ };
301
329
  /** What a stop waits on: the runs whose processes still finish their turn, and the longest it waits on them. */
302
330
  stopping(): {
303
331
  runs: number;
@@ -364,11 +392,11 @@ export declare function readingOf(base: NodeJS.ProcessEnv, maxRuns: number, stor
364
392
  run_isolation: "uid" | "process";
365
393
  /** The harnesses a revision may name (`definition.harness`), whether this server runs each, and how many at once. */
366
394
  harnesses: {
395
+ available: boolean;
367
396
  max_concurrent_runs: number;
368
397
  id: string;
369
398
  label: string;
370
399
  promises: import("./harness-table.js").HarnessPromises;
371
- available: boolean;
372
400
  steer: boolean;
373
401
  reason?: string;
374
402
  default_model: string | null;
@@ -596,6 +624,13 @@ export declare function readingOf(base: NodeJS.ProcessEnv, maxRuns: number, stor
596
624
  routes: boolean;
597
625
  at_rest: string;
598
626
  };
627
+ /** GET /settings/harness-keys and PUT/DELETE of one key: a plan-billed recipe's keys, saved for that harness alone
628
+ * (harness-keys.ts); `harnesses` its ids here, so the console offers the page only where there is one. */
629
+ harness_keys: {
630
+ routes: boolean;
631
+ at_rest: string;
632
+ harnesses: string[];
633
+ };
599
634
  /** /settings/mcp-servers: remote MCP servers previewed and saved, each credential sealed under the server's seal key,
600
635
  * which always exists (seal-key.ts), so MCP credentials are always kept sealed. Every harness of the table runs a
601
636
  * grant (runnable.ts takes one on any), a module's among them. */
@@ -692,11 +727,11 @@ export declare function capabilities(env?: NodeJS.ProcessEnv, maxRuns?: number,
692
727
  run_isolation: "uid" | "process";
693
728
  /** The harnesses a revision may name (`definition.harness`), whether this server runs each, and how many at once. */
694
729
  harnesses: {
730
+ available: boolean;
695
731
  max_concurrent_runs: number;
696
732
  id: string;
697
733
  label: string;
698
734
  promises: import("./harness-table.js").HarnessPromises;
699
- available: boolean;
700
735
  steer: boolean;
701
736
  reason?: string;
702
737
  default_model: string | null;
@@ -924,6 +959,13 @@ export declare function capabilities(env?: NodeJS.ProcessEnv, maxRuns?: number,
924
959
  routes: boolean;
925
960
  at_rest: string;
926
961
  };
962
+ /** GET /settings/harness-keys and PUT/DELETE of one key: a plan-billed recipe's keys, saved for that harness alone
963
+ * (harness-keys.ts); `harnesses` its ids here, so the console offers the page only where there is one. */
964
+ harness_keys: {
965
+ routes: boolean;
966
+ at_rest: string;
967
+ harnesses: string[];
968
+ };
927
969
  /** /settings/mcp-servers: remote MCP servers previewed and saved, each credential sealed under the server's seal key,
928
970
  * which always exists (seal-key.ts), so MCP credentials are always kept sealed. Every harness of the table runs a
929
971
  * grant (runnable.ts takes one on any), a module's among them. */
@@ -1012,11 +1054,16 @@ export declare function forCaller<T extends {
1012
1054
  }>(caps: T, ownerSession: boolean): T;
1013
1055
  /** A start with --harness-sign-in on a server that is not one owner's own, on their own machine. */
1014
1056
  export declare const HARNESS_SIGN_IN_NOT_LOCAL = "HARNESS_SIGN_IN_NOT_LOCAL";
1057
+ /** Why `options` on `data` is not one owner's own server on their own machine, each reason in words; none when it is. One
1058
+ * owner's own: it listens on loopback alone, with no public address; its store is the SQLite one in its data directory (no
1059
+ * AGENTRUN_STORE_URL, which servers elsewhere share); its runs run beside it as its own user (`ownUser`:
1060
+ * runIsolationOf's `process`), never under --no-runner or a user of their own; and one person starts them, as Claude
1061
+ * Code's login on this machine asks (claude-login.ts whyNotOneOwner): an owner, and one API token. What --harness-sign-in
1062
+ * starts under (harnessSignInRefusal), and where the Ollama at this machine's default address is a model of the person
1063
+ * who starts runs (ollama-provider.ts ollamaHostOf). */
1064
+ export declare function whyNotOwnMachine(options: Pick<ServeOptions, "host" | "publicUrl" | "runnerApart" | "apiOnly" | "token" | "tokens">, data: string, ownUser: boolean): string[];
1015
1065
  /** Why `options` on `data` may not run a recipe on its owner's own sign-in (--harness-sign-in), in words; undefined when
1016
- * it may. One owner's own server on their own machine: it listens on loopback alone, with no public address; its store
1017
- * is the SQLite one in its data directory (no AGENTRUN_STORE_URL, which servers elsewhere share); its runs run beside
1018
- * it as its own user (`ownUser`: runIsolationOf's `process`), never under --no-runner or a user of their own; and one
1019
- * person starts them, as Claude Code's login on this machine asks (claude-login.ts whyNotOneOwner): an owner, and one
1020
- * API token. A check, a schedule and a shared server run on a key (HARNESS.md#sign-in). */
1066
+ * it may: one owner's own server on their own machine alone (whyNotOwnMachine). A check, a schedule and a shared server
1067
+ * run on a key (HARNESS.md#sign-in). */
1021
1068
  export declare function harnessSignInRefusal(options: Pick<ServeOptions, "host" | "publicUrl" | "runnerApart" | "apiOnly" | "token" | "tokens">, data: string, ownUser: boolean): string | undefined;
1022
1069
  export declare function startServe(options: ServeOptions): Promise<Serve>;