@parcha/agentrun-serve 0.1.0-beta.29 → 0.1.0-beta.30

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 (152) hide show
  1. package/CHANGELOG.md +188 -0
  2. package/README.md +564 -97
  3. package/dist/adapters.d.ts +35 -6
  4. package/dist/adapters.js +152 -26
  5. package/dist/agents.d.ts +11 -5
  6. package/dist/agents.js +16 -10
  7. package/dist/app.js +80 -20
  8. package/dist/background.d.ts +28 -0
  9. package/dist/background.js +376 -0
  10. package/dist/box-egress.d.ts +98 -0
  11. package/dist/box-egress.js +259 -0
  12. package/dist/box-image.d.ts +1 -1
  13. package/dist/box-image.js +9 -7
  14. package/dist/box-relay-vm.d.ts +80 -0
  15. package/dist/box-relay-vm.js +389 -0
  16. package/dist/box-relay.d.ts +8 -5
  17. package/dist/box-relay.js +14 -9
  18. package/dist/boxes.d.ts +21 -3
  19. package/dist/boxes.js +14 -7
  20. package/dist/browser-cost.d.ts +41 -0
  21. package/dist/browser-cost.js +158 -0
  22. package/dist/cap.d.ts +129 -21
  23. package/dist/cap.js +338 -67
  24. package/dist/coding-tools.d.ts +7 -3
  25. package/dist/coding-tools.js +16 -10
  26. package/dist/console/THIRD-PARTY-NOTICES.txt +580 -0
  27. package/dist/console/assets/index-34jfpIbQ.js +481 -0
  28. package/dist/console/assets/index-DUHbWcIP.css +1 -0
  29. package/dist/console/index.html +2 -2
  30. package/dist/content-filter.d.ts +7 -0
  31. package/dist/content-filter.js +23 -0
  32. package/dist/decision-rows.d.ts +11 -3
  33. package/dist/decision-rows.js +18 -11
  34. package/dist/errors.d.ts +2 -0
  35. package/dist/errors.js +5 -2
  36. package/dist/files.d.ts +6 -1
  37. package/dist/files.js +7 -2
  38. package/dist/grade.d.ts +7 -10
  39. package/dist/grade.js +31 -51
  40. package/dist/graph-served.d.ts +23 -0
  41. package/dist/graph-served.js +75 -0
  42. package/dist/graph-view.d.ts +7 -5
  43. package/dist/graph-view.js +10 -3
  44. package/dist/harness-app.d.ts +4 -2
  45. package/dist/harness-app.js +101 -19
  46. package/dist/harness-opencode/adapter.d.ts +45 -0
  47. package/dist/harness-opencode/adapter.js +272 -0
  48. package/dist/harness-opencode/binary.d.ts +18 -0
  49. package/dist/harness-opencode/binary.js +87 -0
  50. package/dist/harness-opencode/config.d.ts +24 -0
  51. package/dist/harness-opencode/config.js +61 -0
  52. package/dist/harness-opencode/harness.d.ts +77 -0
  53. package/dist/harness-opencode/harness.js +620 -0
  54. package/dist/harness-opencode/host/mcp.d.ts +40 -0
  55. package/dist/harness-opencode/host/mcp.js +208 -0
  56. package/dist/harness-opencode/host/policy.d.ts +71 -0
  57. package/dist/harness-opencode/host/policy.js +419 -0
  58. package/dist/harness-opencode/host/server.d.ts +55 -0
  59. package/dist/harness-opencode/host/server.js +165 -0
  60. package/dist/harness-opencode/index.d.ts +9 -0
  61. package/dist/harness-opencode/index.js +6 -0
  62. package/dist/harness-opencode/verify.d.ts +32 -0
  63. package/dist/harness-opencode/verify.js +75 -0
  64. package/dist/harness-opencode/versions.d.ts +33 -0
  65. package/dist/harness-opencode/versions.js +64 -0
  66. package/dist/harness.d.ts +4 -1
  67. package/dist/harness.js +5 -2
  68. package/dist/host-tools.d.ts +12 -2
  69. package/dist/host-tools.js +26 -12
  70. package/dist/host.js +6 -2
  71. package/dist/hosted-search.js +5 -1
  72. package/dist/import.d.ts +2 -2
  73. package/dist/import.js +4 -3
  74. package/dist/key-check.d.ts +3 -2
  75. package/dist/key-check.js +7 -3
  76. package/dist/key-refusal.js +8 -4
  77. package/dist/learn/check.d.ts +10 -1
  78. package/dist/learn/check.js +19 -1
  79. package/dist/learn/grade.d.ts +3 -2
  80. package/dist/learn/grade.js +25 -13
  81. package/dist/learn/index.d.ts +2 -2
  82. package/dist/learn/index.js +2 -2
  83. package/dist/learn/notes.js +2 -1
  84. package/dist/learn/reflect.d.ts +2 -2
  85. package/dist/learn/reflect.js +51 -5
  86. package/dist/learn/secrets.js +28 -8
  87. package/dist/learn/skills.d.ts +17 -4
  88. package/dist/learn/skills.js +79 -6
  89. package/dist/learned-workflow.d.ts +59 -0
  90. package/dist/learned-workflow.js +191 -0
  91. package/dist/learning-run.d.ts +7 -5
  92. package/dist/learning-run.js +45 -23
  93. package/dist/learning-words.d.ts +6 -3
  94. package/dist/learning-words.js +8 -5
  95. package/dist/learning.d.ts +44 -3
  96. package/dist/learning.js +148 -3
  97. package/dist/mcp-servers.d.ts +7 -4
  98. package/dist/mcp-servers.js +5 -0
  99. package/dist/mcp.js +5 -5
  100. package/dist/model.d.ts +13 -11
  101. package/dist/model.js +11 -10
  102. package/dist/openapi/agentrun-v2.openapi.json +1 -0
  103. package/dist/openapi.js +358 -48
  104. package/dist/paid-calls.d.ts +5 -1
  105. package/dist/paid-calls.js +1 -1
  106. package/dist/pause.d.ts +2 -0
  107. package/dist/place.d.ts +27 -4
  108. package/dist/place.js +42 -10
  109. package/dist/propose.d.ts +2 -0
  110. package/dist/propose.js +38 -8
  111. package/dist/request-start.d.ts +12 -4
  112. package/dist/request-start.js +139 -15
  113. package/dist/run-box.d.ts +56 -4
  114. package/dist/run-box.js +173 -23
  115. package/dist/runnable.d.ts +5 -2
  116. package/dist/runnable.js +12 -4
  117. package/dist/runs.d.ts +258 -36
  118. package/dist/runs.js +830 -89
  119. package/dist/secrets.d.ts +12 -0
  120. package/dist/secrets.js +18 -0
  121. package/dist/server.d.ts +131 -35
  122. package/dist/server.js +467 -105
  123. package/dist/sign-ins.d.ts +99 -0
  124. package/dist/sign-ins.js +288 -0
  125. package/dist/skills.d.ts +16 -4
  126. package/dist/skills.js +35 -7
  127. package/dist/stats.d.ts +7 -2
  128. package/dist/stats.js +28 -7
  129. package/dist/tool-gate.d.ts +266 -0
  130. package/dist/tool-gate.js +554 -0
  131. package/dist/tool-keys.d.ts +46 -10
  132. package/dist/tool-keys.js +44 -2
  133. package/dist/tool-plane.d.ts +112 -27
  134. package/dist/tool-plane.js +205 -47
  135. package/dist/tools.d.ts +69 -14
  136. package/dist/tools.js +143 -24
  137. package/dist/trigger-secrets.d.ts +32 -0
  138. package/dist/trigger-secrets.js +143 -0
  139. package/dist/triggers.d.ts +439 -0
  140. package/dist/triggers.js +863 -0
  141. package/dist/turn-end.d.ts +3 -2
  142. package/dist/turn-end.js +3 -2
  143. package/dist/usage-lines.d.ts +26 -0
  144. package/dist/usage-lines.js +28 -0
  145. package/dist/validate.d.ts +2 -0
  146. package/dist/validate.js +11 -2
  147. package/dist/webhooks.d.ts +11 -4
  148. package/dist/webhooks.js +17 -1
  149. package/launcher/agentrun-serve +1 -1
  150. package/package.json +19 -13
  151. package/dist/console/assets/index-BN7oVcO4.js +0 -445
  152. package/dist/console/assets/index-By-jkqki.css +0 -1
@@ -1,10 +1,13 @@
1
1
  import type { Context } from "@earendil-works/chord";
2
2
  import { type Extension, type ToolRegistration } from "@earendil-works/pi-durable";
3
+ import { SHELL_TOOLS } from "./background.js";
3
4
  import { type Place } from "./place.js";
4
5
  /** pi's coding tools on the runner, without bash, each refusal of a path outside the workspace named by the path the
5
6
  * call gave (`asGivenRefusals`): the model reads that refusal, and the run's timeline shows it. */
6
7
  export declare const CodingTools: Extension;
7
- /** The tools a box runs: pi's, by name. */
8
+ /** The tools that run a command in the box, never on this machine: bash, and the background tools (background.ts). */
9
+ export { SHELL_TOOLS };
10
+ /** The tools a box runs, by name: pi's four and the background tools. */
8
11
  export declare const BOXED_TOOLS: readonly string[];
9
12
  /** A run's coding tools and the extension a conversation selects for them. */
10
13
  export type CodingSource = {
@@ -26,6 +29,7 @@ export type BoxedEnv = {
26
29
  * path. */
27
30
  export declare function boxPath(path: string, hostWork?: string): string | undefined;
28
31
  /** A run's coding tools by its place: on the runner, CodingTools (no bash); in a box, pi's read, write, edit and bash,
29
- * each with its arguments, output and replay as pi ships it and its environment the box's. A file tool's path stays in
30
- * the box's work dir; bash's command is the box's own. */
32
+ * each with its arguments, output and replay as pi ships it and its environment the box's, and the background tools
33
+ * (background.ts), each call a command in the box. A file tool's path stays in the box's work dir; bash's command is
34
+ * the box's own. */
31
35
  export declare function codingSource(place: Place, box?: BoxedEnv): CodingSource;
@@ -4,19 +4,20 @@
4
4
  // wrapped so a refusal names the path the call gave (asGivenRefusals), and the extension keeps everything else pi's
5
5
  // carries (its name, so a conversation selects it as before).
6
6
  //
7
- // A run whose place is a box gets codingSource's instead: pi's own read, write, edit and bash, each call made on the
8
- // box's environment (run-box.ts), so the shell exists only in the box. One source feeds pi's tool table (tools.ts,
7
+ // A run whose place is a box gets codingSource's instead: pi's own read, write, edit and bash, and the background tools
8
+ // (background.ts), each call made on the box's environment (run-box.ts), so the shell exists only in the box. One source feeds pi's tool table (tools.ts,
9
9
  // app.ts) and another harness's host tools (host-tools.ts).
10
10
  //
11
11
  // Where the box binds the run's work/ from this machine and the confinement holds directory handles (Docker on Linux),
12
12
  // read, write and edit run on this machine instead, on the bind's source (bound-files.ts): a command in the box costs
13
- // far more than a file read. bash always runs in the box, and every tool of any other box (or of any host that reaches
14
- // directories by path) does too.
13
+ // far more than a file read. bash and the background tools always run in the box, and every tool of any other box (or of
14
+ // any host that reaches directories by path) does too.
15
15
  import { posix } from "node:path";
16
16
  import { ROOT_CONVERSATION_ID } from "@earendil-works/pi-durable";
17
17
  import { FileError } from "@earendil-works/pi-durable/env";
18
18
  import { HOST_PHASE } from "@parcha/pi-durable-agent/timeline";
19
19
  import { ArchilCodingTools } from "@parcha/pi-durable-disk";
20
+ import { BACKGROUND_TOOLS, backgroundTools, SHELL_TOOLS } from "./background.js";
20
21
  import { boundFiles } from "./bound-files.js";
21
22
  import { BOX_WORK } from "./place.js";
22
23
  import { asGivenRefusals, refuseOutsideWorkspace } from "./workspace-paths.js";
@@ -27,8 +28,12 @@ const pis = ArchilCodingTools;
27
28
  /** pi's coding tools on the runner, without bash, each refusal of a path outside the workspace named by the path the
28
29
  * call gave (`asGivenRefusals`): the model reads that refusal, and the run's timeline shows it. */
29
30
  export const CodingTools = { ...pis, tools: asGivenRefusals((pis.tools ?? []).filter((tool) => tool.name !== "bash")) };
30
- /** The tools a box runs: pi's, by name. */
31
- export const BOXED_TOOLS = ["read", "write", "edit", "bash"];
31
+ /** pi's tools a box runs, by name. */
32
+ const PI_BOXED = ["read", "write", "edit", "bash"];
33
+ /** The tools that run a command in the box, never on this machine: bash, and the background tools (background.ts). */
34
+ export { SHELL_TOOLS };
35
+ /** The tools a box runs, by name: pi's four and the background tools. */
36
+ export const BOXED_TOOLS = [...PI_BOXED, ...BACKGROUND_TOOLS];
32
37
  /** A failed call's error with what the file environment said, where pi's message gives only its code (edit's "Error
33
38
  * code: permission_denied."), so the model reads why and what it can do. */
34
39
  const withCause = (error) => {
@@ -47,15 +52,16 @@ export function boxPath(path, hostWork) {
47
52
  return at === BOX_WORK || at.startsWith(`${BOX_WORK}/`) ? named : undefined;
48
53
  }
49
54
  /** A run's coding tools by its place: on the runner, CodingTools (no bash); in a box, pi's read, write, edit and bash,
50
- * each with its arguments, output and replay as pi ships it and its environment the box's. A file tool's path stays in
51
- * the box's work dir; bash's command is the box's own. */
55
+ * each with its arguments, output and replay as pi ships it and its environment the box's, and the background tools
56
+ * (background.ts), each call a command in the box. A file tool's path stays in the box's work dir; bash's command is
57
+ * the box's own. */
52
58
  export function codingSource(place, box) {
53
59
  if (place.mode === "runner")
54
60
  return { extension: CodingTools, tools: CodingTools.tools ?? [] };
55
61
  if (!box)
56
62
  throw new Error("a run whose place is a box needs its box for its coding tools");
57
63
  const here = box.hostWork && writesHeld() ? boundFiles(box.hostWork) : undefined;
58
- const tools = asGivenRefusals((pis.tools ?? []).filter((tool) => BOXED_TOOLS.includes(tool.name)).map((tool) => ({
64
+ const tools = asGivenRefusals([...(pis.tools ?? []).filter((tool) => PI_BOXED.includes(tool.name)), ...backgroundTools()].map((tool) => ({
59
65
  ...tool,
60
66
  execute: async (args, api, context) => {
61
67
  // A file tool's path in the box's words, or refused as the confined tools refuse (refuseOutsideWorkspace): named
@@ -67,7 +73,7 @@ export function codingSource(place, box) {
67
73
  const given = inBox === undefined ? args : { ...args, path: inBox };
68
74
  // read, write and edit on this machine's work/, where the box binds it; no box is made for them. A box an earlier
69
75
  // process left has its left commands killed first, so none of them changes work/ under these tools.
70
- if (here && tool.name !== "bash" && (await box.bound?.()) === true) {
76
+ if (here && !SHELL_TOOLS.includes(tool.name) && (await box.bound?.()) === true) {
71
77
  await box.leftEnded?.(context);
72
78
  return tool.execute(given, { ...api, env: here }, context).catch((error) => Promise.reject(withCause(error)));
73
79
  }