@parcha/agentrun-computer 0.1.0-beta.37 → 0.1.0-beta.39

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 (124) hide show
  1. package/README.md +341 -260
  2. package/box/Dockerfile +18 -1
  3. package/box/README.md +14 -0
  4. package/box/build-daytona.py +2 -2
  5. package/box/build-e2b.mjs +41 -18
  6. package/box/recipe.d.mts +5 -0
  7. package/box/recipe.mjs +43 -0
  8. package/dist/agent37.d.ts +18 -66
  9. package/dist/agent37.js +187 -464
  10. package/dist/box-image.d.ts +14 -0
  11. package/dist/box-image.js +24 -0
  12. package/dist/browserbase.d.ts +0 -6
  13. package/dist/browserbase.js +1 -5
  14. package/dist/client.d.ts +12 -3
  15. package/dist/client.js +39 -4
  16. package/dist/computerd-linux-amd64 +0 -0
  17. package/dist/computerd-linux-arm64 +0 -0
  18. package/dist/computerd.json +4 -0
  19. package/dist/conformance/agent37.d.ts +9 -4
  20. package/dist/conformance/agent37.js +23 -11
  21. package/dist/conformance/browserbase.js +3 -3
  22. package/dist/conformance/cases/apps.d.ts +6 -0
  23. package/dist/conformance/cases/apps.js +18 -5
  24. package/dist/conformance/cases/isolation.d.ts +22 -5
  25. package/dist/conformance/cases/isolation.js +97 -16
  26. package/dist/conformance/cases/mount.js +5 -3
  27. package/dist/conformance/cases/provider.js +41 -0
  28. package/dist/conformance/cli.js +72 -11
  29. package/dist/conformance/daytona.d.ts +9 -20
  30. package/dist/conformance/daytona.js +12 -21
  31. package/dist/conformance/e2b.js +9 -4
  32. package/dist/conformance/exec-stream.d.ts +52 -0
  33. package/dist/conformance/exec-stream.js +493 -0
  34. package/dist/conformance/kernel.js +2 -2
  35. package/dist/conformance/modal.js +1 -1
  36. package/dist/conformance/orgo.js +2 -2
  37. package/dist/conformance/sweep.js +8 -8
  38. package/dist/conformance/types.d.ts +2 -2
  39. package/dist/create-requests.d.ts +1 -1
  40. package/dist/daytona.d.ts +17 -133
  41. package/dist/daytona.js +396 -1452
  42. package/dist/descriptor.d.ts +11 -4
  43. package/dist/descriptor.js +7 -0
  44. package/dist/descriptors/agent37.d.ts +3 -11
  45. package/dist/descriptors/agent37.js +9 -10
  46. package/dist/descriptors/daytona.d.ts +7 -6
  47. package/dist/descriptors/daytona.js +14 -7
  48. package/dist/descriptors/docker.d.ts +13 -1
  49. package/dist/descriptors/docker.js +3 -1
  50. package/dist/descriptors/e2b.d.ts +2 -9
  51. package/dist/descriptors/e2b.js +8 -8
  52. package/dist/descriptors/index.d.ts +25 -24
  53. package/dist/descriptors/index.js +1 -3
  54. package/dist/descriptors/modal.d.ts +2 -6
  55. package/dist/descriptors/modal.js +8 -6
  56. package/dist/descriptors/orgo.js +2 -1
  57. package/dist/descriptors/shared.d.ts +1 -1
  58. package/dist/descriptors/shared.js +2 -2
  59. package/dist/desktop.d.ts +18 -4
  60. package/dist/desktop.js +89 -9
  61. package/dist/docker/egress-main.js +23 -15
  62. package/dist/docker/egress.d.ts +6 -4
  63. package/dist/docker/egress.js +24 -16
  64. package/dist/docker/inspect.d.ts +2 -2
  65. package/dist/docker/inspect.js +5 -5
  66. package/dist/docker.d.ts +6 -11
  67. package/dist/docker.js +13 -16
  68. package/dist/drift.js +4 -4
  69. package/dist/e2b.d.ts +22 -130
  70. package/dist/e2b.js +163 -243
  71. package/dist/host.d.ts +136 -104
  72. package/dist/host.js +8 -1
  73. package/dist/hosted/network.d.ts +23 -0
  74. package/dist/hosted/network.js +77 -0
  75. package/dist/hosted/process.d.ts +24 -8
  76. package/dist/hosted/process.js +80 -44
  77. package/dist/hosted/provider.d.ts +38 -22
  78. package/dist/hosted/provider.js +500 -341
  79. package/dist/hosted/rest.d.ts +74 -0
  80. package/dist/hosted/rest.js +126 -0
  81. package/dist/hosted/scripts.d.ts +21 -3
  82. package/dist/hosted/scripts.js +76 -14
  83. package/dist/hosted/ssh-exec.d.ts +99 -0
  84. package/dist/hosted/ssh-exec.js +464 -0
  85. package/dist/hosted/values.d.ts +26 -0
  86. package/dist/hosted/values.js +63 -0
  87. package/dist/index.d.ts +2 -2
  88. package/dist/index.js +2 -2
  89. package/dist/isolation.d.ts +0 -2
  90. package/dist/isolation.js +3 -4
  91. package/dist/kernel.d.ts +0 -6
  92. package/dist/kernel.js +1 -5
  93. package/dist/kinds.d.ts +3 -1
  94. package/dist/local-chrome.d.ts +0 -6
  95. package/dist/local-chrome.js +1 -5
  96. package/dist/modal.d.ts +15 -86
  97. package/dist/modal.js +67 -185
  98. package/dist/mount-archil.d.ts +13 -8
  99. package/dist/mount-archil.js +27 -17
  100. package/dist/mount.d.ts +10 -4
  101. package/dist/mount.js +8 -4
  102. package/dist/orgo.d.ts +0 -9
  103. package/dist/orgo.js +8 -13
  104. package/dist/phone-harness.d.ts +0 -6
  105. package/dist/phone-harness.js +0 -4
  106. package/dist/protocol.d.ts +4 -1
  107. package/dist/protocol.js +1 -0
  108. package/dist/provider.d.ts +2 -2
  109. package/dist/providers.d.ts +15 -13
  110. package/dist/screen-watch.js +34 -6
  111. package/dist/surface/api.d.ts +14 -11
  112. package/dist/surface/core.d.ts +23 -5
  113. package/dist/surface/core.js +105 -15
  114. package/dist/surface/index.d.ts +1 -1
  115. package/dist/surface/index.js +1 -1
  116. package/dist/surface/outline.d.ts +2 -0
  117. package/dist/surface/outline.js +2 -1
  118. package/dist/surface/script.d.ts +4 -0
  119. package/dist/surface/script.js +11 -3
  120. package/dist/ui-engine.js +19 -3
  121. package/package.json +2 -3
  122. package/box/build-agent37.mjs +0 -177
  123. package/dist/conformance/daytona-sweep.d.ts +0 -18
  124. package/dist/conformance/daytona-sweep.js +0 -126
@@ -3,7 +3,8 @@
3
3
  // daemon's wire over one exec'd process.
4
4
  import { PassThrough, Writable } from "node:stream";
5
5
  import { DaemonClient } from "../client.js";
6
- import { errorOf, ok } from "../result.js";
6
+ import { HostError } from "../host.js";
7
+ import { failFor, ok } from "../result.js";
7
8
  /** What a call's race adds to the bound it gives the vendor's own call, so the vendor's timeout, not the race, reports a slow call. */
8
9
  export const CALL_SLACK_MS = 5_000;
9
10
  export const seconds = (ms) => `${ms / 1000} s`;
@@ -13,6 +14,11 @@ export const words = (error) => {
13
14
  const message = error instanceof Error ? error.message : String(error);
14
15
  return `${typeof name === "string" && name !== "Error" ? `${name}: ` : ""}${message}`.replace(/\s+/g, " ").slice(0, 300);
15
16
  };
17
+ /** text with every secret in it written [redacted], the longest first; an empty or missing secret is skipped. */
18
+ export const redact = (text, secrets) => secrets
19
+ .filter((secret) => !!secret)
20
+ .sort((a, b) => b.length - a.length)
21
+ .reduce((said, secret) => said.replaceAll(secret, "[redacted]"), text);
16
22
  /** A pause that ends early when signal aborts; never rejects. */
17
23
  export const pause = (ms, signal) => new Promise((done) => {
18
24
  const timer = setTimeout(finish, ms);
@@ -28,14 +34,54 @@ export const pause = (ms, signal) => new Promise((done) => {
28
34
  });
29
35
  /** A signal that aborts with the caller's, or once ms pass. */
30
36
  export const bounded = (ms, signal) => (signal ? AbortSignal.any([signal, AbortSignal.timeout(ms)]) : AbortSignal.timeout(ms));
31
- /** The failures of one host: an error of code vendor names it. */
32
- export const failOf = (host) => (code, message) => ({ ok: false, error: errorOf(code, message, host.id) });
33
37
  /**
34
- * Settles with the promise's result, or a timeout or abort in words once ms pass or signal aborts. A host call that
35
- * answers a Result is passed on as it answers; one that throws is read through the host's errorCode.
38
+ * A promise that rejects with an AbortError (the caller's signal aborted) or a TimeoutError (ms passed), and clear to
39
+ * stop listening when the work finished first.
40
+ */
41
+ export function boundOf(ms, signal, what) {
42
+ const bound = bounded(ms, signal);
43
+ let onAbort = () => { };
44
+ const promise = new Promise((_, reject) => {
45
+ onAbort = () => {
46
+ const timedOut = !signal?.aborted;
47
+ const error = new Error(timedOut ? `${what} did not answer within ${seconds(ms)}` : `${what} was aborted`);
48
+ error.name = timedOut ? "TimeoutError" : "AbortError";
49
+ reject(error);
50
+ };
51
+ if (bound.aborted)
52
+ onAbort();
53
+ else
54
+ bound.addEventListener("abort", onAbort, { once: true });
55
+ });
56
+ promise.catch(() => { });
57
+ return { promise, clear: () => bound.removeEventListener("abort", onAbort) };
58
+ }
59
+ /**
60
+ * The code of an error a host threw: a HostError's own, AbortError and TimeoutError by name, else the host's errorCode,
61
+ * else "vendor".
62
+ */
63
+ export function codeOfError(host, error) {
64
+ if (error instanceof HostError)
65
+ return error.code;
66
+ const name = error?.name;
67
+ if (name === "AbortError")
68
+ return "aborted";
69
+ if (name === "TimeoutError")
70
+ return "timeout";
71
+ return host.errorCode?.(error) ?? "vendor";
72
+ }
73
+ /** A Result's value, or a HostError in its words: for a host whose own client answers Results (hosted/rest.ts). */
74
+ export function orThrow(result) {
75
+ if (result.ok)
76
+ return result.value;
77
+ throw new HostError(result.error.code, result.error.message);
78
+ }
79
+ /**
80
+ * Settles with the promise's value, or a timeout or abort in words once ms pass or signal aborts. A host call that
81
+ * throws is read through codeOfError.
36
82
  */
37
83
  export function race(host, promise, what, ms, signal) {
38
- const fail = failOf(host);
84
+ const fail = failFor(host.descriptor.id);
39
85
  if (signal?.aborted) {
40
86
  promise.catch(() => { });
41
87
  return Promise.resolve(fail("aborted", `${what} was aborted`));
@@ -53,15 +99,16 @@ export function race(host, promise, what, ms, signal) {
53
99
  signal?.removeEventListener("abort", onAbort);
54
100
  settle(result);
55
101
  }
56
- promise.then((value) => done(ok(value)), (error) => done(signal?.aborted ? fail("aborted", `${what} was aborted`) : fail(host.errorCode(error), `${what} failed: ${words(error)}`)));
102
+ promise.then((value) => done(ok(value)), (error) => done(signal?.aborted ? fail("aborted", `${what} was aborted`) : fail(codeOfError(host, error), `${what} failed: ${words(error)}`)));
57
103
  });
58
104
  }
59
105
  /**
60
106
  * One host call, bounded: ctx.timeoutMs is the vendor's own bound, and the race gives it CALL_SLACK_MS more. A call
61
- * that throws at once is an error like one that rejects; a Result the host answers keeps its own words, prefixed.
107
+ * that throws at once is an error like one that rejects. A call given up on (timeout or abort), by the race or by the
108
+ * host's own client (a HostError timeout), hands onLate what it answers: its value, or its failure, once it settles.
62
109
  */
63
- export async function hostCall(host, what, run, ms, signal) {
64
- const fail = failOf(host);
110
+ export async function hostCall(host, what, run, ms, signal, onLate) {
111
+ const fail = failFor(host.descriptor.id);
65
112
  if (signal?.aborted)
66
113
  return fail("aborted", `${what} was aborted before it was called`);
67
114
  let promise;
@@ -69,15 +116,13 @@ export async function hostCall(host, what, run, ms, signal) {
69
116
  promise = Promise.resolve(run({ timeoutMs: ms, ...(signal ? { signal } : {}) }));
70
117
  }
71
118
  catch (error) {
72
- return fail(host.errorCode(error), `${what} failed: ${words(error)}`);
119
+ return fail(codeOfError(host, error), `${what} failed: ${words(error)}`);
73
120
  }
74
121
  const raced = await race(host, promise, what, ms + CALL_SLACK_MS, signal);
75
- if (!raced.ok)
76
- return raced;
77
- const answered = raced.value;
78
- if (answered.ok)
79
- return answered;
80
- return { ok: false, error: { ...answered.error, message: `${what} failed: ${answered.error.message}` } };
122
+ if (!raced.ok && onLate && (raced.error.code === "timeout" || raced.error.code === "aborted")) {
123
+ promise.then((value) => onLate(ok(value)), (error) => onLate(fail(codeOfError(host, error), `${what} failed: ${words(error)}`)));
124
+ }
125
+ return raced;
81
126
  }
82
127
  /** Reads every chunk of a stream into one buffer, at most `max` bytes kept (the last ones). */
83
128
  async function drain(stream, max) {
@@ -101,16 +146,21 @@ const OUTPUT_MAX = 64 * 1024;
101
146
  * A non-zero exit is a result, not an error.
102
147
  */
103
148
  export async function runToExit(host, id, argv, { stdin, ms, signal, what }) {
104
- const fail = failOf(host);
105
- const started = await hostCall(host, what, (ctx) => host.exec(id, argv, { stdin: stdin !== undefined }, ctx), ms, signal);
149
+ const fail = failFor(host.descriptor.id);
150
+ const started = await hostCall(host, what, (ctx) => host.exec(id, argv, ctx), ms, signal);
106
151
  if (!started.ok)
107
152
  return started;
108
153
  const proc = started.value;
109
154
  const out = drain(proc.stdout, OUTPUT_MAX);
110
155
  const err = drain(proc.stderr, OUTPUT_MAX);
111
156
  const ran = (async () => {
112
- if (stdin !== undefined) {
113
- // In pieces, so a vendor whose stdin takes one request at a time (E2B's sendStdin) is never handed a whole binary.
157
+ // In pieces, so a vendor whose stdin takes one request at a time (E2B's sendStdin) is never handed a whole binary;
158
+ // with none to give, stdin ends at once, so the process reads end of file (one that ended already has no stdin). Not
159
+ // awaited: a vendor's close that stalls (E2B's closeStdin is a request of its own) never holds up a command that
160
+ // reads no input.
161
+ if (stdin === undefined)
162
+ Promise.resolve().then(() => proc.end()).catch(() => { });
163
+ else {
114
164
  for (let at = 0; at < stdin.length; at += STDIN_CHUNK)
115
165
  await proc.write(stdin.subarray(at, at + STDIN_CHUNK));
116
166
  await proc.end();
@@ -134,7 +184,7 @@ export async function uploadThroughExec(host, id, path, bytes, ms, signal) {
134
184
  const ran = await runToExit(host, id, ["sh", "-c", 'umask 077 && cat > "$1"', "sh", path], { stdin: bytes, ms, ...(signal ? { signal } : {}), what: `the upload to ${path}` });
135
185
  if (!ran.ok)
136
186
  return ran;
137
- return ran.value.exitCode === 0 ? ok(undefined) : failOf(host)("vendor", `the upload to ${path} exited with ${ran.value.exitCode}: ${`${ran.value.stdout} ${ran.value.stderr}`.trim().slice(0, 300)}`);
187
+ return ran.value.exitCode === 0 ? ok(undefined) : failFor(host.descriptor.id)("vendor", `the upload to ${path} exited with ${ran.value.exitCode}: ${`${ran.value.stdout} ${ran.value.stderr}`.trim().slice(0, 300)}`);
138
188
  }
139
189
  /**
140
190
  * The root channel into a machine (for the shared Archil steps): argv as root through exec, stdin (one line, then
@@ -155,29 +205,15 @@ export function rootOf(host, id, name) {
155
205
  * daemon to reach, is notListening.
156
206
  */
157
207
  export async function openBridge(host, id, { argv, name, version, requestMs, helloMs, signal }) {
158
- const fail = failOf(host);
159
- const what = `starting the daemon's stdio bridge in ${name}`;
160
- if (signal?.aborted)
161
- return fail("aborted", `${what} was aborted before it was called`);
162
- let starting;
163
- try {
164
- starting = Promise.resolve(host.exec(id, argv, { stdin: true }, { timeoutMs: requestMs }));
208
+ const fail = failFor(host.descriptor.id);
209
+ // Never signalled, only raced: the bridge lives on after this call. It has no command timeout, so one the vendor
210
+ // starts after this was given up on is killed as it lands.
211
+ const started = await hostCall(host, `starting the daemon's stdio bridge in ${name}`, (ctx) => host.exec(id, argv, { timeoutMs: ctx.timeoutMs }), requestMs, signal, (late) => late.ok && late.value.kill());
212
+ if (!started.ok) {
213
+ const { code, message } = started.error;
214
+ return code === "timeout" || code === "aborted" ? fail(code, `${message}; a bridge that starts after this is killed`) : started;
165
215
  }
166
- catch (error) {
167
- return fail(host.errorCode(error), `${what} failed: ${words(error)}`);
168
- }
169
- const raced = await race(host, starting, what, requestMs + CALL_SLACK_MS, signal);
170
- if (!raced.ok) {
171
- // The bridge has no command timeout: one the vendor starts after this was given up on is killed as it lands.
172
- if (raced.error.code === "timeout" || raced.error.code === "aborted") {
173
- starting.then((late) => (late.ok ? late.value.kill() : undefined), () => { });
174
- return fail(raced.error.code, `${raced.error.message}; a bridge that starts after this is killed`);
175
- }
176
- return raced;
177
- }
178
- if (!raced.value.ok)
179
- return fail(raced.value.error.code, `${what} failed: ${raced.value.error.message}`);
180
- const proc = raced.value.value;
216
+ const proc = started.value;
181
217
  const readable = new PassThrough();
182
218
  let stderr = "";
183
219
  void (async () => {
@@ -18,9 +18,9 @@ export interface HostedTimeouts {
18
18
  helloMs: number;
19
19
  /** The probe, run through the daemon: it takes at most 20 s (10 s to connect, 10 s to answer, every target at once). */
20
20
  probeMs: number;
21
- /** One whole list, every page and every machine's read-back. */
21
+ /** One whole listing, every page; each listed machine's get after it has requestMs. */
22
22
  listMs: number;
23
- /** From a delete to a machine the vendor no longer has and no longer lists. */
23
+ /** From a delete to get answering none for the machine. */
24
24
  goneMs: number;
25
25
  /** The first pause between two reads while release waits; the pauses double up to 5 s. */
26
26
  pollMs: number;
@@ -35,8 +35,6 @@ export interface HostedTimeouts {
35
35
  mountMs: number;
36
36
  }
37
37
  export interface HostedOptions {
38
- /** The vendor's name in words ("E2B"), for refusals and Settings' test. */
39
- label: string;
40
38
  /** desktop: an X server started through the daemon; linux (default): no screen. */
41
39
  kind?: "desktop" | "linux";
42
40
  /** The display and its X server, for kind desktop. Default Xvfb on :0, 1280x800. */
@@ -70,17 +68,23 @@ export declare const NAME_LABEL = "agentrun.computer.name";
70
68
  export declare const IMAGE_LABEL = "agentrun.computer.image";
71
69
  /** The most extend may move the deadline to: create's time plus the cap, by this machine's clock, as init was given. */
72
70
  export declare const MAX_LABEL = "agentrun.computer.max-deadline";
71
+ /** A GPU computer's GPUs, type:count: a retry and attach read them here, so no vendor need read them back. */
72
+ export declare const GPU_LABEL = "agentrun.computer.gpu";
73
+ /** The adapter's timeouts, the caller's over its defaults: what a host reads for its own requestMs or pollMs. */
74
+ export declare const timeoutsOf: (timeouts?: Partial<HostedTimeouts>) => HostedTimeouts;
75
+ /** An ISO time a label holds, or undefined when it is missing or not the ISO time create writes. */
76
+ export declare function isoOf(written: string | undefined): Date | undefined;
73
77
  /**
74
- * When a machine ends: the deadline create wrote; or, once an extend moved the vendor's own timer past where create set
75
- * it (the vendor keeps no label change), that end, up to the most the computer may live, which is what init was given.
78
+ * When a machine ends: its deadline label, as the vendor reads it back. A vendor that keeps no label change reads it
79
+ * as the end its timer moved to (E2B's get), so a restarted provider reads an extend all the same.
76
80
  */
77
- export declare function deadlineOf(machine: Pick<Machine, "labels" | "endsAt" | "timerMoved">): Date | undefined;
81
+ export declare const deadlineOf: (machine: Pick<Machine, "labels">) => Date | undefined;
78
82
  /** Only a machine this adapter made counts: its label, a name of its making, and the name asked for when one is. */
79
83
  export declare const ours: (labels: Record<string, string> | undefined, name?: string) => boolean;
80
84
  type Extend = (ref: ComputerRef, ttlMs: number, context?: CallContext) => Promise<Result<{
81
85
  deadline: Date;
82
86
  }>>;
83
- /** hostedProvider's provider: a ComputerProvider whose vendor is host. */
87
+ /** The shared adapter's provider: a ComputerProvider whose vendor is host. */
84
88
  export declare class HostedProvider implements ComputerProvider {
85
89
  #private;
86
90
  readonly id: string;
@@ -89,7 +93,7 @@ export declare class HostedProvider implements ComputerProvider {
89
93
  readonly host: MachineHost;
90
94
  readonly extend?: Extend;
91
95
  constructor(host: MachineHost, options: HostedOptions);
92
- /** The computer's facts, from the host's and the adapter's options alone. */
96
+ /** The computer's facts, from the descriptor, the host's facts and the adapter's options alone. */
93
97
  capabilities(): ComputerCapabilities;
94
98
  check(spec: ComputerSpec): Refusal[];
95
99
  /**
@@ -109,38 +113,50 @@ export declare class HostedProvider implements ComputerProvider {
109
113
  labels: Record<string, string>;
110
114
  }, { signal }?: AttachContext): Promise<Result<AttachedComputer>>;
111
115
  /**
112
- * Settings' test: the host's own, or one list by the adapter's label, counted, which makes nothing; a refused key is
113
- * unauthorized, a vendor not reached unreachable, the message never carrying a key.
116
+ * Settings' test: one list by the adapter's label, its computers counted as the listing reads them (no get of each),
117
+ * which makes nothing; a refused key is unauthorized, a vendor not reached unreachable, the message never carrying a key.
114
118
  */
115
119
  testConnection({ signal }?: CallContext): Promise<Result<{
116
120
  detail: string;
117
121
  }>>;
118
122
  /**
119
- * Every computer this provider made that carries all of these labels, running or stopped, each one's network read
120
- * back. One deadline, listMs from the call, bounds every page and every read-back.
123
+ * Every computer this provider made that carries all of these labels, running or stopped: the listing finds them, and
124
+ * a get of each reads its state, labels and end (foundBy). Its network is the one its label records, as create made
125
+ * it (none without one); attach and network() read it from inside.
121
126
  */
122
127
  list(labels: Record<string, string>, { signal }?: CallContext): Promise<Result<ComputerInfo[]>>;
123
- /** The vendor reads the policy back (or the probe stands for it). A change is refused: the network is fixed at create. */
128
+ /** The probe and the proxy's policy read the network back from inside. A change is refused: it is fixed at create. */
124
129
  network(ref: ComputerRef, policy?: NetworkSpec, { signal }?: CallContext): Promise<Result<NetworkPolicy>>;
125
130
  /**
126
131
  * delete reads the machine back to check it is this provider's, then deletes it, both never signalled, so a release
127
132
  * after an abort, or one aborted during the read, still sends the delete; it is idempotent: one the vendor no longer
128
- * has is ok. The vendor answers a delete before the machine is gone, so release then waits (#settle) until the vendor
129
- * reads it gone and no longer lists it, within goneMs and the caller's signal, the one step the signal ends. A running
133
+ * has is ok. The vendor answers a delete before the machine is gone, so release then waits (#settle) until get
134
+ * answers none (twice running), within goneMs and the caller's signal, the one step the signal ends. A running
130
135
  * Archil computer lets go of the run's folder first (archilRelease: the final sync through computerd, then checkin as
131
136
  * root); the delete runs whatever that answers. A folder not let go cleanly loses nothing (every call that changed it
132
137
  * synced, and the next claim revokes the hold), so it is said through onNote, and the release succeeds once the
133
- * machine is gone. stop, where the host declares it, stops the machine and keeps it.
138
+ * machine is gone. A computer here is deleted, never stopped: release stop is refused in words.
134
139
  */
135
140
  release(ref: ComputerRef, how: ReleaseHow, { signal }?: ReleaseContext): Promise<Result<void>>;
136
141
  }
137
142
  /**
138
- * Waits until the host reads a machine gone and no longer lists it under its name, twice running (see #settle). Shared
139
- * with the live sweep, which waits the same way.
143
+ * The host's listing by labels, bounded by ms: only the machines that carry every one of them, since a vendor's listing
144
+ * may answer more (MachineHost.list).
140
145
  */
141
- export declare function settleGone(host: MachineHost, ref: ComputerRef, { requestMs, listMs, pollMs, goneMs, signal }: Pick<HostedTimeouts, "requestMs" | "listMs" | "pollMs" | "goneMs"> & {
146
+ export declare function listedBy(host: MachineHost, what: string, labels: Record<string, string>, ms: number, signal?: AbortSignal): Promise<Result<Machine[]>>;
147
+ /**
148
+ * The listing finds, get answers (MachineHost.list): the machines the host's listing by labels names, each read now by
149
+ * readMachine, within requestMs. One the vendor no longer has (not found) is dropped, and so is one whose get carries
150
+ * not every label. A read that fails otherwise fails the whole.
151
+ */
152
+ export declare function foundBy(host: MachineHost, what: string, labels: Record<string, string>, { listMs, requestMs }: Pick<HostedTimeouts, "listMs" | "requestMs">, signal?: AbortSignal): Promise<Result<Machine[]>>;
153
+ /**
154
+ * Waits, through waitUntil, until get answers none for a machine after its delete, twice running: the vendor no longer
155
+ * has it. A machine read gone is still going (a vendor still destroying it), so it holds the wait like any other state.
156
+ * A listing may show a deleted machine for a while (MachineHost.list), so it is not read. Pauses double from pollMs to
157
+ * 5 s, bounded by goneMs and the caller's signal; a failed read ends the wait with that error. Shared with the live sweep.
158
+ */
159
+ export declare function settle(host: MachineHost, ref: ComputerRef, { requestMs, pollMs, goneMs, signal }: Pick<HostedTimeouts, "requestMs" | "pollMs" | "goneMs"> & {
142
160
  signal?: AbortSignal;
143
161
  }): Promise<Result<void>>;
144
- /** The shared machine-host adapter: host's machines as a ComputerProvider (see HostedProvider). */
145
- export declare function hostedProvider(host: MachineHost, options: HostedOptions): HostedProvider;
146
162
  export {};