@parcha/agentrun-computer 0.1.0-beta.57 → 0.1.0-beta.59

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 (131) hide show
  1. package/README.md +187 -62
  2. package/box/Dockerfile +4 -3
  3. package/box/install.sh +57 -11
  4. package/dist/agent37.js +6 -9
  5. package/dist/attach.d.ts +24 -4
  6. package/dist/attach.js +50 -19
  7. package/dist/boxd.js +22 -9
  8. package/dist/browserbase.d.ts +6 -2
  9. package/dist/browserbase.js +50 -7
  10. package/dist/child-env.d.ts +11 -0
  11. package/dist/child-env.js +22 -0
  12. package/dist/chrome.d.ts +5 -2
  13. package/dist/chrome.js +5 -2
  14. package/dist/cloudflare.d.ts +2 -0
  15. package/dist/cloudflare.js +5 -3
  16. package/dist/computerd-linux-amd64 +0 -0
  17. package/dist/computerd-linux-arm64 +0 -0
  18. package/dist/computerd.json +1 -1
  19. package/dist/conformance/agent37.d.ts +10 -38
  20. package/dist/conformance/agent37.js +25 -113
  21. package/dist/conformance/archil.d.ts +13 -3
  22. package/dist/conformance/archil.js +22 -17
  23. package/dist/conformance/boxd.d.ts +8 -31
  24. package/dist/conformance/boxd.js +19 -74
  25. package/dist/conformance/browserbase.d.ts +3 -6
  26. package/dist/conformance/browserbase.js +6 -17
  27. package/dist/conformance/cases/health.js +6 -3
  28. package/dist/conformance/cli.d.ts +3 -1
  29. package/dist/conformance/cli.js +69 -9
  30. package/dist/conformance/cloudflare.d.ts +3 -6
  31. package/dist/conformance/cloudflare.js +7 -15
  32. package/dist/conformance/daytona.d.ts +6 -20
  33. package/dist/conformance/daytona.js +22 -57
  34. package/dist/conformance/dial-only.d.ts +4 -3
  35. package/dist/conformance/dial-only.js +3 -3
  36. package/dist/conformance/docker.d.ts +4 -5
  37. package/dist/conformance/docker.js +8 -14
  38. package/dist/conformance/e2b.d.ts +10 -36
  39. package/dist/conformance/e2b.js +27 -84
  40. package/dist/conformance/fly.d.ts +3 -6
  41. package/dist/conformance/fly.js +2 -6
  42. package/dist/conformance/groundbox.d.ts +7 -23
  43. package/dist/conformance/groundbox.js +16 -56
  44. package/dist/conformance/index.d.ts +1 -0
  45. package/dist/conformance/index.js +1 -0
  46. package/dist/conformance/kernel.d.ts +3 -6
  47. package/dist/conformance/kernel.js +5 -15
  48. package/dist/conformance/kind.d.ts +0 -6
  49. package/dist/conformance/kind.js +0 -4
  50. package/dist/conformance/local-chrome.d.ts +5 -7
  51. package/dist/conformance/local-chrome.js +7 -11
  52. package/dist/conformance/modal.d.ts +10 -38
  53. package/dist/conformance/modal.js +27 -74
  54. package/dist/conformance/module-kit.d.ts +87 -0
  55. package/dist/conformance/module-kit.js +88 -0
  56. package/dist/conformance/morph.d.ts +7 -23
  57. package/dist/conformance/morph.js +20 -66
  58. package/dist/conformance/orgo.d.ts +5 -10
  59. package/dist/conformance/orgo.js +15 -27
  60. package/dist/conformance/phone-harness.d.ts +3 -5
  61. package/dist/conformance/phone-harness.js +3 -11
  62. package/dist/conformance/runner.d.ts +13 -3
  63. package/dist/conformance/runner.js +32 -11
  64. package/dist/conformance/smolcloud.d.ts +7 -23
  65. package/dist/conformance/smolcloud.js +16 -49
  66. package/dist/conformance/sweep.d.ts +10 -5
  67. package/dist/conformance/sweep.js +91 -38
  68. package/dist/conformance/tti.d.ts +69 -0
  69. package/dist/conformance/tti.js +205 -0
  70. package/dist/conformance/types.d.ts +9 -2
  71. package/dist/daytona.js +60 -20
  72. package/dist/descriptor.d.ts +10 -0
  73. package/dist/descriptor.js +7 -0
  74. package/dist/descriptors/browserbase.d.ts +3 -0
  75. package/dist/descriptors/browserbase.js +4 -0
  76. package/dist/descriptors/docker.d.ts +1 -0
  77. package/dist/descriptors/docker.js +3 -0
  78. package/dist/descriptors/env-names.d.ts +32 -0
  79. package/dist/descriptors/env-names.js +60 -0
  80. package/dist/descriptors/index.d.ts +9 -2
  81. package/dist/descriptors/kernel.d.ts +3 -0
  82. package/dist/descriptors/kernel.js +2 -0
  83. package/dist/descriptors/local-chrome.d.ts +1 -1
  84. package/dist/descriptors/local-chrome.js +5 -3
  85. package/dist/descriptors/phone-harness.d.ts +1 -1
  86. package/dist/descriptors/phone-harness.js +4 -2
  87. package/dist/docker/egress.d.ts +7 -0
  88. package/dist/docker/egress.js +8 -0
  89. package/dist/docker/image.d.ts +5 -1
  90. package/dist/docker/image.js +12 -8
  91. package/dist/docker.d.ts +63 -15
  92. package/dist/docker.js +181 -98
  93. package/dist/drift.js +6 -6
  94. package/dist/e2b.d.ts +2 -2
  95. package/dist/e2b.js +2 -3
  96. package/dist/groundbox.js +6 -6
  97. package/dist/host.d.ts +23 -0
  98. package/dist/hosted/download.d.ts +23 -0
  99. package/dist/hosted/download.js +144 -0
  100. package/dist/hosted/process.d.ts +5 -0
  101. package/dist/hosted/process.js +20 -0
  102. package/dist/hosted/provider.js +120 -48
  103. package/dist/hosted/rest.d.ts +19 -8
  104. package/dist/hosted/rest.js +47 -14
  105. package/dist/hosted/scripts.d.ts +10 -0
  106. package/dist/hosted/scripts.js +23 -2
  107. package/dist/index.d.ts +3 -1
  108. package/dist/index.js +3 -1
  109. package/dist/janitor.d.ts +7 -1
  110. package/dist/janitor.js +2 -2
  111. package/dist/kernel.js +1 -1
  112. package/dist/local-chrome.d.ts +5 -2
  113. package/dist/local-chrome.js +4 -2
  114. package/dist/local-supervisor.js +1 -0
  115. package/dist/modal.d.ts +6 -5
  116. package/dist/modal.js +7 -7
  117. package/dist/morph.js +5 -8
  118. package/dist/orgo-channel.d.ts +3 -2
  119. package/dist/orgo-channel.js +3 -3
  120. package/dist/orgo-desktop.js +2 -4
  121. package/dist/orgo.js +2 -4
  122. package/dist/phone-harness.d.ts +7 -5
  123. package/dist/phone-harness.js +60 -61
  124. package/dist/protocol.d.ts +10 -0
  125. package/dist/protocol.js +17 -0
  126. package/dist/provider.d.ts +6 -2
  127. package/dist/screen-watch.d.ts +6 -1
  128. package/dist/screen-watch.js +166 -12
  129. package/dist/vendor-sdk.d.ts +9 -0
  130. package/dist/vendor-sdk.js +26 -0
  131. package/package.json +8 -1
package/dist/docker.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { type DesktopOptions } from "./desktop.js";
2
2
  import { type DockerHost } from "./docker/inspect.js";
3
+ import { type HostEnv } from "./child-env.js";
3
4
  import { type EnsureImageOptions, type ImageSource } from "./docker/image.js";
4
5
  import { type AttachedComputer, type CallContext, type CreateContext, type ComputerCapabilities, type ComputerConnection, type ComputerInfo, type ComputerProvider, type ComputerRef, type ComputerSpec, type NetworkPolicy, type NetworkSpec, type Refusal, type ReleaseHow } from "./provider.js";
5
6
  import { type Result } from "./result.js";
@@ -65,6 +66,22 @@ export interface DockerProviderOptions {
65
66
  name: string;
66
67
  root: string;
67
68
  };
69
+ /** The host's environment variables, of which every docker CLI call holds the names docker reads (DOCKER_ENV_NAMES:
70
+ * where the daemon is, its config and credential helpers, PATH and HOME) and nothing else, so no key the host holds
71
+ * reaches docker or what it starts. The provider reads no environment: without env, docker starts with none. */
72
+ env?: HostEnv;
73
+ /**
74
+ * For tests: the bound, in ms, on the clean-up after a create that failed or was cut off, and on waiting for a removal
75
+ * Docker says is already under way (a release's, a stop's, a sweep's): past it, the container still there is the
76
+ * failure, in words naming this bound. Default 10 s. A test of a removal that never ends sets it short.
77
+ */
78
+ settleMs?: number;
79
+ /**
80
+ * For tests: how long, in ms, the looks after a docker run cut off before its own exit must find nothing in a row
81
+ * before what it may have made counts as gone, so a create Docker finishes a moment after the abort is still seen.
82
+ * Default 3 s. One as long as settleMs leaves nothing confirmed gone: that create's answer then says so.
83
+ */
84
+ settleQuietMs?: number;
68
85
  }
69
86
  /** What create() takes: the provider's options, the daemon optional. */
70
87
  export interface DockerCreateOptions extends Partial<DockerProviderOptions> {
@@ -73,28 +90,48 @@ export interface DockerCreateOptions extends Partial<DockerProviderOptions> {
73
90
  }
74
91
  /**
75
92
  * Docker's architecture as `docker version` reports it (amd64, arm64), within timeoutMs, or an error in words. The docker
76
- * CLI runs with this process's environment, as every call of the provider does, so it asks the Docker the provider uses.
93
+ * CLI runs with the names of `env` docker reads (dockerEnv), as every call of the provider does, so it asks the Docker the
94
+ * provider uses.
77
95
  */
78
- export declare function dockerArch({ docker, timeoutMs }?: Pick<DockerCreateOptions, "docker" | "timeoutMs">): Promise<string>;
96
+ export declare function dockerArch({ docker, timeoutMs, env }?: Pick<DockerCreateOptions, "docker" | "timeoutMs" | "env">): Promise<string>;
97
+ /**
98
+ * The daemon a Docker computer binds for Docker's architecture `arch` (dockerArch): computerd-linux-<arch> in `dir`,
99
+ * default this package's own build, and, when no such file is there, why, with the command that builds it. create()
100
+ * takes its daemon here, and so does a server's start check of Docker, so the two can't disagree.
101
+ */
102
+ export declare function dockerDaemonOf(arch: string, dir?: string): {
103
+ path: string;
104
+ missing?: string;
105
+ };
79
106
  /**
80
107
  * A DockerProvider from its options alone; it reads no environment. Without options.daemonPath it asks Docker its
81
- * architecture and takes this package's daemon for it, and says when that daemon is not built. The image is an option
82
- * too (default the provider's own recipe): no image name is read from the environment.
108
+ * architecture and takes this package's daemon for it (dockerDaemonOf), and says when that daemon is not built. The image
109
+ * is an option too (default the provider's own recipe): no image name is read from the environment.
83
110
  */
84
111
  export declare function create(options?: DockerCreateOptions): Promise<DockerProvider>;
85
112
  /** The conformance CLI's module for Docker: the drifted twin. */
86
113
  export declare const conformance: () => Promise<typeof import("./conformance/docker.js")>;
114
+ /** After a docker run cut off before its own exit: how long, at most, the leftovers are removed and looked for again,
115
+ * how often, and for how long in a row the looks must find none of them before they count as gone (#settle). */
116
+ export declare const SETTLE_MS = 10000;
117
+ export declare const SETTLE_QUIET_MS = 3000;
118
+ /** The bounds of #settle: its whole bound and its quiet window, in ms (the settleMs and settleQuietMs options). */
119
+ export interface SettleBounds {
120
+ settleMs: number;
121
+ quietMs: number;
122
+ }
87
123
  /**
88
- * Why #settle could not show its leftovers gone within SETTLE_MS, in words that always name them: `there`, what its
89
- * last look still found; or, when the last look found none but the quiet window was not complete, every name it
90
- * checked (`checked`), which could not be confirmed gone. Exported for its test.
124
+ * Why #settle could not show its leftovers gone within its bound (`bounds`, the defaults unless the provider was given
125
+ * its own), in words that always name them: `there`, what its last look still found; or, when the last look found none
126
+ * but the quiet window was not complete, every name it checked (`checked`), which could not be confirmed gone. Exported
127
+ * for its test.
91
128
  */
92
- export declare function settleWords(checked: readonly string[], there: readonly string[]): string;
129
+ export declare function settleWords(checked: readonly string[], there: readonly string[], bounds?: SettleBounds): string;
93
130
  export declare class DockerProvider implements ComputerProvider {
94
131
  #private;
95
132
  readonly id = "docker";
96
133
  readonly version: string;
97
- constructor({ daemonPath, daemonCache, docker, user, desktop, egress, image, volume }: DockerProviderOptions);
134
+ constructor({ daemonPath, daemonCache, docker, user, desktop, egress, image, volume, env, settleMs, settleQuietMs }: DockerProviderOptions);
98
135
  /** The uid:gid a computer runs as when its spec names no user: the user a bound run folder must be writable by. */
99
136
  get user(): string;
100
137
  capabilities(): ComputerCapabilities;
@@ -135,16 +172,21 @@ export declare class DockerProvider implements ComputerProvider {
135
172
  list(labels: Record<string, string>, { signal }?: CallContext): Promise<Result<ComputerInfo[]>>;
136
173
  /**
137
174
  * The janitor's second pass (sweep calls it after the computers): every egress proxy container and egress volume
138
- * labelled EGRESS_LABEL, and with all of `labels`, whose deadline label has passed (or is missing or unreadable, fail
139
- * closed), or whose computer is gone and that is older than a create could take (#leftoverGraceMs: one under way has
140
- * made its proxy before its computer, and pulled both images before either, so no pull happens in between). Each is
141
- * removed by what its label found, a proxy before its volume, never by a name alone. Returns the names removed, a
142
- * volume's as "<name> (volume)".
175
+ * labelled EGRESS_LABEL, and with all of `labels`, whose computer is not there, read by its name right before that
176
+ * part's removal, and that is past its deadline label (or the label is missing or unreadable, fail closed) or older
177
+ * than a create could take (#leftoverGraceMs). Per part, in this order: its labels and age; then `mine`, when given
178
+ * (serve's: a run of its own store that no claim holds); then its computer, by name (there, or a read that fails,
179
+ * keeps the part); then its removal by what its label found, a proxy before its volume, never by a name alone.
180
+ * `mine` comes before the computer so a create under the caller's claim that finishes between the two reads is seen:
181
+ * once the caller says no claim holds the run, nothing at that claim makes the computer, and a later claim's computer
182
+ * has another name. A part with an owner label is never removed: Docker makes no agent's computer (no persistence),
183
+ * so that label is a caller's, never a run's leftover. Returns the names removed, a volume's as "<name> (volume)".
143
184
  */
144
- sweepLeftovers({ labels, now, signal }?: {
185
+ sweepLeftovers({ labels, now, signal, mine }?: {
145
186
  labels?: Record<string, string>;
146
187
  now?: Date;
147
188
  signal?: AbortSignal;
189
+ mine?: (labels: Record<string, string>) => boolean | Promise<boolean>;
148
190
  }): Promise<Result<string[]>>;
149
191
  network(ref: ComputerRef, policy?: NetworkSpec, { signal }?: CallContext): Promise<Result<NetworkPolicy>>;
150
192
  /**
@@ -154,3 +196,9 @@ export declare class DockerProvider implements ComputerProvider {
154
196
  */
155
197
  release(ref: ComputerRef, how: ReleaseHow): Promise<Result<void>>;
156
198
  }
199
+ /**
200
+ * The settleMs and settleQuietMs options as #settle's bounds, with their defaults (SETTLE_MS, SETTLE_QUIET_MS), or a throw
201
+ * in words: each is a whole number of milliseconds above 0 that a timer can hold. The one place the defaults are applied:
202
+ * the constructor and settleWords both read it. Exported for its test, which reads the defaults instead of waiting them out.
203
+ */
204
+ export declare function settleBoundsOf({ settleMs, settleQuietMs }: Pick<DockerProviderOptions, "settleMs" | "settleQuietMs">): SettleBounds;