@parcha/agentrun-computer 0.1.0-beta.36 → 0.1.0-beta.38

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 (155) hide show
  1. package/NOTICE +2 -0
  2. package/README.md +547 -478
  3. package/box/Dockerfile +18 -1
  4. package/box/README.md +13 -0
  5. package/box/build-agent37.mjs +158 -0
  6. package/box/build-daytona.py +2 -2
  7. package/box/build-e2b.mjs +41 -18
  8. package/box/recipe.mjs +43 -0
  9. package/dist/agent37-ssh.d.ts +89 -0
  10. package/dist/agent37-ssh.js +445 -0
  11. package/dist/agent37.d.ts +104 -0
  12. package/dist/agent37.js +402 -0
  13. package/dist/attach.d.ts +146 -0
  14. package/dist/attach.js +469 -0
  15. package/dist/browserbase.d.ts +2 -10
  16. package/dist/browserbase.js +3 -6
  17. package/dist/client.d.ts +45 -4
  18. package/dist/client.js +92 -4
  19. package/dist/computerd-linux-amd64 +0 -0
  20. package/dist/computerd-linux-arm64 +0 -0
  21. package/dist/computerd.json +4 -0
  22. package/dist/conformance/agent37.d.ts +96 -0
  23. package/dist/conformance/agent37.js +154 -0
  24. package/dist/conformance/cases/apps.d.ts +11 -0
  25. package/dist/conformance/cases/apps.js +173 -73
  26. package/dist/conformance/cases/health.js +14 -0
  27. package/dist/conformance/cases/index.js +2 -0
  28. package/dist/conformance/cases/isolation.d.ts +7 -5
  29. package/dist/conformance/cases/isolation.js +44 -14
  30. package/dist/conformance/cases/mount.js +1 -1
  31. package/dist/conformance/cases/provider.js +27 -1
  32. package/dist/conformance/cases/screen.d.ts +3 -0
  33. package/dist/conformance/cases/screen.js +18 -0
  34. package/dist/conformance/cases/settings.d.ts +29 -23
  35. package/dist/conformance/cases/settings.js +76 -58
  36. package/dist/conformance/cases/touch.js +19 -17
  37. package/dist/conformance/cases/ui.d.ts +2 -0
  38. package/dist/conformance/cases/ui.js +475 -0
  39. package/dist/conformance/cli.d.ts +9 -0
  40. package/dist/conformance/cli.js +94 -9
  41. package/dist/conformance/daytona.d.ts +9 -20
  42. package/dist/conformance/daytona.js +12 -21
  43. package/dist/conformance/e2b.d.ts +6 -0
  44. package/dist/conformance/e2b.js +9 -2
  45. package/dist/conformance/exec-stream.d.ts +45 -0
  46. package/dist/conformance/exec-stream.js +486 -0
  47. package/dist/conformance/fixture.d.ts +1 -1
  48. package/dist/conformance/fixture.js +25 -1
  49. package/dist/conformance/modal.d.ts +17 -13
  50. package/dist/conformance/modal.js +18 -9
  51. package/dist/conformance/orgo.d.ts +3 -3
  52. package/dist/conformance/orgo.js +6 -8
  53. package/dist/conformance/phone-harness.d.ts +6 -2
  54. package/dist/conformance/phone-harness.js +21 -4
  55. package/dist/conformance/report.js +1 -1
  56. package/dist/conformance/runner.js +23 -4
  57. package/dist/conformance/sweep.d.ts +50 -0
  58. package/dist/conformance/sweep.js +187 -0
  59. package/dist/conformance/types.d.ts +13 -5
  60. package/dist/conformance/ui-fixture.d.ts +56 -0
  61. package/dist/conformance/ui-fixture.js +43 -0
  62. package/dist/create-requests.d.ts +51 -0
  63. package/dist/create-requests.js +121 -0
  64. package/dist/daytona.d.ts +20 -133
  65. package/dist/daytona.js +405 -1449
  66. package/dist/descriptor.d.ts +11 -1
  67. package/dist/descriptor.js +9 -0
  68. package/dist/descriptors/agent37.d.ts +41 -0
  69. package/dist/descriptors/agent37.js +28 -0
  70. package/dist/descriptors/daytona.d.ts +6 -5
  71. package/dist/descriptors/daytona.js +9 -5
  72. package/dist/descriptors/index.d.ts +42 -7
  73. package/dist/descriptors/index.js +4 -2
  74. package/dist/descriptors/orgo.d.ts +2 -1
  75. package/dist/descriptors/orgo.js +3 -2
  76. package/dist/descriptors/phone-harness.d.ts +1 -1
  77. package/dist/descriptors/phone-harness.js +2 -2
  78. package/dist/descriptors/shared.d.ts +1 -1
  79. package/dist/descriptors/shared.js +2 -2
  80. package/dist/desktop.d.ts +18 -4
  81. package/dist/desktop.js +89 -9
  82. package/dist/docker.d.ts +7 -10
  83. package/dist/docker.js +272 -34
  84. package/dist/drift.js +4 -4
  85. package/dist/e2b.d.ts +16 -290
  86. package/dist/e2b.js +230 -1393
  87. package/dist/fake-ui-driver.d.ts +97 -0
  88. package/dist/fake-ui-driver.js +717 -0
  89. package/dist/host.d.ts +201 -0
  90. package/dist/host.js +8 -0
  91. package/dist/hosted/process.d.ts +81 -0
  92. package/dist/hosted/process.js +259 -0
  93. package/dist/hosted/provider.d.ts +160 -0
  94. package/dist/hosted/provider.js +1415 -0
  95. package/dist/hosted/rest.d.ts +66 -0
  96. package/dist/hosted/rest.js +121 -0
  97. package/dist/hosted/scripts.d.ts +82 -0
  98. package/dist/{child.js → hosted/scripts.js} +118 -12
  99. package/dist/hosted/values.d.ts +5 -0
  100. package/dist/hosted/values.js +8 -0
  101. package/dist/index.d.ts +7 -3
  102. package/dist/index.js +7 -4
  103. package/dist/kernel.d.ts +2 -10
  104. package/dist/kernel.js +3 -6
  105. package/dist/kinds.d.ts +11 -2
  106. package/dist/kinds.js +20 -4
  107. package/dist/local-chrome.d.ts +2 -10
  108. package/dist/local-chrome.js +3 -6
  109. package/dist/modal.d.ts +22 -257
  110. package/dist/modal.js +183 -1280
  111. package/dist/mount-archil.d.ts +8 -4
  112. package/dist/mount-archil.js +22 -11
  113. package/dist/mount.d.ts +10 -4
  114. package/dist/mount.js +8 -4
  115. package/dist/orgo-channel.d.ts +3 -2
  116. package/dist/orgo-channel.js +5 -2
  117. package/dist/orgo-desktop.d.ts +9 -4
  118. package/dist/orgo-desktop.js +33 -13
  119. package/dist/orgo-workspaces.d.ts +47 -0
  120. package/dist/orgo-workspaces.js +94 -0
  121. package/dist/orgo.d.ts +10 -13
  122. package/dist/orgo.js +32 -21
  123. package/dist/phone-harness.d.ts +31 -28
  124. package/dist/phone-harness.js +510 -702
  125. package/dist/png.d.ts +4 -0
  126. package/dist/png.js +27 -0
  127. package/dist/protocol.d.ts +339 -33
  128. package/dist/protocol.js +97 -3
  129. package/dist/provider.d.ts +36 -8
  130. package/dist/provider.js +16 -0
  131. package/dist/providers.d.ts +11 -12
  132. package/dist/result.d.ts +1 -1
  133. package/dist/screen-watch.js +34 -6
  134. package/dist/surface/api.d.ts +260 -0
  135. package/dist/surface/api.js +1 -0
  136. package/dist/surface/core.d.ts +55 -0
  137. package/dist/surface/core.js +475 -0
  138. package/dist/surface/index.d.ts +5 -0
  139. package/dist/surface/index.js +3 -0
  140. package/dist/surface/outline.d.ts +10 -0
  141. package/dist/surface/outline.js +51 -0
  142. package/dist/surface/script.d.ts +10 -0
  143. package/dist/surface/script.js +94 -0
  144. package/dist/ui-engine.d.ts +114 -0
  145. package/dist/ui-engine.js +814 -0
  146. package/package.json +18 -3
  147. package/dist/child.d.ts +0 -42
  148. package/dist/conformance/daytona-sweep.d.ts +0 -18
  149. package/dist/conformance/daytona-sweep.js +0 -126
  150. package/dist/conformance/e2b-diagnose.d.ts +0 -16
  151. package/dist/conformance/e2b-diagnose.js +0 -61
  152. package/dist/conformance/e2b-sweep.d.ts +0 -18
  153. package/dist/conformance/e2b-sweep.js +0 -132
  154. package/dist/conformance/modal-sweep.d.ts +0 -22
  155. package/dist/conformance/modal-sweep.js +0 -213
@@ -0,0 +1,160 @@
1
+ import { type DesktopOptions } from "../desktop.js";
2
+ import type { Machine, MachineHost } from "../host.js";
3
+ import { type ProviderNote } from "../mount-archil.js";
4
+ import { type AttachedComputer, type AttachContext, type CallContext, type ComputerCapabilities, type ComputerConnection, type ComputerInfo, type ComputerProvider, type ComputerRef, type ComputerSpec, type CreateContext, type CreatedComputer, type NetworkPolicy, type NetworkSpec, type Refusal, type ReleaseContext, type ReleaseHow } from "../provider.js";
5
+ import { type Result } from "../result.js";
6
+ import { type ScreenWatch, type ScreenWatchHandlers, type WatchOptions } from "../screen-watch.js";
7
+ /** The longest each kind of call may take, and the pauses between polls. */
8
+ export interface HostedTimeouts {
9
+ /** One control-plane call: get, delete, a timer, a bridge's start. */
10
+ requestMs: number;
11
+ /** The vendor's create, and the wait until the machine runs. */
12
+ createMs: number;
13
+ /** The daemon's upload. */
14
+ uploadMs: number;
15
+ /** The install command, and init's start. */
16
+ execMs: number;
17
+ /** From a connect's start to the daemon's hello, and each read-back call after it. */
18
+ helloMs: number;
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
+ probeMs: number;
21
+ /** One whole listing, every page; each listed machine's get after it has requestMs. */
22
+ listMs: number;
23
+ /** From a delete to get answering none for the machine. */
24
+ goneMs: number;
25
+ /** The first pause between two reads while release waits; the pauses double up to 5 s. */
26
+ pollMs: number;
27
+ /** How long create waits for the listing to show the new computer. */
28
+ listedMs: number;
29
+ /**
30
+ * The listing's stability window: create's wait ends once the listing has shown the new computer on two consecutive
31
+ * polls, the first of them at least this long before the last, and on every poll between.
32
+ */
33
+ listedStableMs: number;
34
+ /** Each root step of an Archil mount (the preflight, mount or revoke, serve), and its checkin at release. */
35
+ mountMs: number;
36
+ }
37
+ export interface HostedOptions {
38
+ /** desktop: an X server started through the daemon; linux (default): no screen. */
39
+ kind?: "desktop" | "linux";
40
+ /** The display and its X server, for kind desktop. Default Xvfb on :0, 1280x800. */
41
+ desktop?: DesktopOptions;
42
+ /** The longest lifetime check takes; at most facts.maxLifetimeMs, which is its default. */
43
+ maxLifetimeMs?: number;
44
+ /** The daemon binary for the host's arch on this machine. Default this package's dist/computerd-linux-<arch>. */
45
+ daemonPath?: string;
46
+ /**
47
+ * Who the daemon runs as, uid:gid in numbers, never root. Default 2510:2510 (TOOL_USER), a uid no vendor process
48
+ * holds: init refuses to start while another process does.
49
+ */
50
+ daemonUser?: string;
51
+ timeouts?: Partial<HostedTimeouts>;
52
+ /**
53
+ * The addresses the probe tries, to show none of them answers a computer with network none: host:port over TCP, or
54
+ * host:port/udp, a DNS query over UDP.
55
+ */
56
+ probeTargets?: string[];
57
+ /** Told what is no failure of the call it came from: a release that did not let an Archil folder go cleanly. */
58
+ onNote?: ProviderNote;
59
+ /**
60
+ * The egress gateway an Archil computer's archil client reaches Archil through, `<IPv4 gateway>:<mount lane>:<data
61
+ * lane>` such as 192.0.2.40:18100:42050 (archilEgressOf): for a vendor whose machines reach Archil only through it.
62
+ * Given to the helper's mount and revoke. Unset or empty, the client reaches Archil as the machine's network allows.
63
+ */
64
+ archilEgress?: string;
65
+ }
66
+ export declare const NAME_LABEL = "agentrun.computer.name";
67
+ /** The image create was asked for: a vendor may report another name for it (a template's id). */
68
+ export declare const IMAGE_LABEL = "agentrun.computer.image";
69
+ /** The most extend may move the deadline to: create's time plus the cap, by this machine's clock, as init was given. */
70
+ export declare const MAX_LABEL = "agentrun.computer.max-deadline";
71
+ /** The adapter's timeouts, the caller's over its defaults: what a host reads for its own requestMs or pollMs. */
72
+ export declare const timeoutsOf: (timeouts?: Partial<HostedTimeouts>) => HostedTimeouts;
73
+ /** An ISO time a label holds, or undefined when it is missing or not the ISO time create writes. */
74
+ export declare function isoOf(written: string | undefined): Date | undefined;
75
+ /**
76
+ * When a machine ends: its deadline label, as the vendor reads it back. A vendor that keeps no label change reads it
77
+ * as the end its timer moved to (E2B's get), so a restarted provider reads an extend all the same.
78
+ */
79
+ export declare const deadlineOf: (machine: Pick<Machine, "labels">) => Date | undefined;
80
+ /** Only a machine this adapter made counts: its label, a name of its making, and the name asked for when one is. */
81
+ export declare const ours: (labels: Record<string, string> | undefined, name?: string) => boolean;
82
+ type Extend = (ref: ComputerRef, ttlMs: number, context?: CallContext) => Promise<Result<{
83
+ deadline: Date;
84
+ }>>;
85
+ /** The shared adapter's provider: a ComputerProvider whose vendor is host. */
86
+ export declare class HostedProvider implements ComputerProvider {
87
+ #private;
88
+ readonly id: string;
89
+ readonly version: string;
90
+ /** The vendor's machines, for the live sweep (conformance/sweep.ts); nothing else reaches past the provider to them. */
91
+ readonly host: MachineHost;
92
+ readonly extend?: Extend;
93
+ constructor(host: MachineHost, options: HostedOptions);
94
+ /** The computer's facts, from the host's and the adapter's options alone. */
95
+ capabilities(): ComputerCapabilities;
96
+ check(spec: ComputerSpec): Refusal[];
97
+ /**
98
+ * Makes a computer, once per request: context.requestId names it (computerNameFor), and a create of a request already made
99
+ * finds that computer instead of making another. One still starting is waited for (within createMs); one up is
100
+ * returned once its labels and daemon read back as attach reads them, else refused as exists; one that ended (or
101
+ * that this provider gave up on) is refused as exists, in words. A second create of a request still in flight waits
102
+ * for the first and answers what it does.
103
+ */
104
+ create(spec: ComputerSpec, context: CreateContext): Promise<Result<CreatedComputer>>;
105
+ /** The live view: screen.watch on a connection of the watch's own (daemonWatch); a linux computer has no screen. */
106
+ watch(ref: ComputerRef, handlers: ScreenWatchHandlers, options?: WatchOptions): Promise<Result<ScreenWatch>>;
107
+ connect(ref: ComputerRef): Promise<Result<ComputerConnection>>;
108
+ attach(ref: {
109
+ id: string;
110
+ } | {
111
+ labels: Record<string, string>;
112
+ }, { signal }?: AttachContext): Promise<Result<AttachedComputer>>;
113
+ /**
114
+ * Settings' test: one list by the adapter's label, its computers counted as the listing reads them (no get of each),
115
+ * which makes nothing; a refused key is unauthorized, a vendor not reached unreachable, the message never carrying a key.
116
+ */
117
+ testConnection({ signal }?: CallContext): Promise<Result<{
118
+ detail: string;
119
+ }>>;
120
+ /**
121
+ * Every computer this provider made that carries all of these labels, running or stopped: the listing finds them, and
122
+ * a get of each reads its state, labels and end (foundBy). Its network is none, as create made it and the probe reads
123
+ * it from inside.
124
+ */
125
+ list(labels: Record<string, string>, { signal }?: CallContext): Promise<Result<ComputerInfo[]>>;
126
+ /** The probe reads the policy back from inside. A change is refused: the network is fixed at create. */
127
+ network(ref: ComputerRef, policy?: NetworkSpec, { signal }?: CallContext): Promise<Result<NetworkPolicy>>;
128
+ /**
129
+ * delete reads the machine back to check it is this provider's, then deletes it, both never signalled, so a release
130
+ * after an abort, or one aborted during the read, still sends the delete; it is idempotent: one the vendor no longer
131
+ * has is ok. The vendor answers a delete before the machine is gone, so release then waits (#settle) until get
132
+ * answers none (twice running), within goneMs and the caller's signal, the one step the signal ends. A running
133
+ * Archil computer lets go of the run's folder first (archilRelease: the final sync through computerd, then checkin as
134
+ * root); the delete runs whatever that answers. A folder not let go cleanly loses nothing (every call that changed it
135
+ * synced, and the next claim revokes the hold), so it is said through onNote, and the release succeeds once the
136
+ * machine is gone. A computer here is deleted, never stopped: release stop is refused in words.
137
+ */
138
+ release(ref: ComputerRef, how: ReleaseHow, { signal }?: ReleaseContext): Promise<Result<void>>;
139
+ }
140
+ /**
141
+ * The host's listing by labels, bounded by ms: only the machines that carry every one of them, since a vendor's listing
142
+ * may answer more (MachineHost.list).
143
+ */
144
+ export declare function listedBy(host: MachineHost, what: string, labels: Record<string, string>, ms: number, signal?: AbortSignal): Promise<Result<Machine[]>>;
145
+ /**
146
+ * The listing finds, get answers (MachineHost.list): the machines the host's listing by labels names, each read now by
147
+ * readMachine, within requestMs. One the vendor no longer has (not found) is dropped, and so is one whose get carries
148
+ * not every label. A read that fails otherwise fails the whole.
149
+ */
150
+ export declare function foundBy(host: MachineHost, what: string, labels: Record<string, string>, { listMs, requestMs }: Pick<HostedTimeouts, "listMs" | "requestMs">, signal?: AbortSignal): Promise<Result<Machine[]>>;
151
+ /**
152
+ * Waits, through waitUntil, until get answers none for a machine after its delete, twice running: the vendor no longer
153
+ * has it. A machine read gone is still going (a vendor still destroying it), so it holds the wait like any other state.
154
+ * A listing may show a deleted machine for a while (MachineHost.list), so it is not read. Pauses double from pollMs to
155
+ * 5 s, bounded by goneMs and the caller's signal; a failed read ends the wait with that error. Shared with the live sweep.
156
+ */
157
+ export declare function settle(host: MachineHost, ref: ComputerRef, { requestMs, pollMs, goneMs, signal }: Pick<HostedTimeouts, "requestMs" | "pollMs" | "goneMs"> & {
158
+ signal?: AbortSignal;
159
+ }): Promise<Result<void>>;
160
+ export {};