@vendoai/apps 0.4.0

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 (203) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +8 -0
  3. package/dist/adapter-conformance.d.ts +48 -0
  4. package/dist/adapter-conformance.d.ts.map +1 -0
  5. package/dist/adapter-conformance.js +196 -0
  6. package/dist/adapter-conformance.js.map +1 -0
  7. package/dist/agent-tools.d.ts +10 -0
  8. package/dist/agent-tools.d.ts.map +1 -0
  9. package/dist/agent-tools.js +252 -0
  10. package/dist/agent-tools.js.map +1 -0
  11. package/dist/app-data.d.ts +23 -0
  12. package/dist/app-data.d.ts.map +1 -0
  13. package/dist/app-data.js +129 -0
  14. package/dist/app-data.js.map +1 -0
  15. package/dist/app-token.d.ts +24 -0
  16. package/dist/app-token.d.ts.map +1 -0
  17. package/dist/app-token.js +61 -0
  18. package/dist/app-token.js.map +1 -0
  19. package/dist/audit.d.ts +11 -0
  20. package/dist/audit.d.ts.map +1 -0
  21. package/dist/audit.js +19 -0
  22. package/dist/audit.js.map +1 -0
  23. package/dist/automation-plan.d.ts +43 -0
  24. package/dist/automation-plan.d.ts.map +1 -0
  25. package/dist/automation-plan.js +212 -0
  26. package/dist/automation-plan.js.map +1 -0
  27. package/dist/bench/client.d.ts +43 -0
  28. package/dist/bench/client.d.ts.map +1 -0
  29. package/dist/bench/client.js +129 -0
  30. package/dist/bench/client.js.map +1 -0
  31. package/dist/bench/fixtures.d.ts +42 -0
  32. package/dist/bench/fixtures.d.ts.map +1 -0
  33. package/dist/bench/fixtures.js +146 -0
  34. package/dist/bench/fixtures.js.map +1 -0
  35. package/dist/bench/judge.d.ts +9 -0
  36. package/dist/bench/judge.d.ts.map +1 -0
  37. package/dist/bench/judge.js +71 -0
  38. package/dist/bench/judge.js.map +1 -0
  39. package/dist/bench/metrics.d.ts +32 -0
  40. package/dist/bench/metrics.d.ts.map +1 -0
  41. package/dist/bench/metrics.js +172 -0
  42. package/dist/bench/metrics.js.map +1 -0
  43. package/dist/bench/prompts.d.ts +17 -0
  44. package/dist/bench/prompts.d.ts.map +1 -0
  45. package/dist/bench/prompts.js +100 -0
  46. package/dist/bench/prompts.js.map +1 -0
  47. package/dist/bench/report.d.ts +43 -0
  48. package/dist/bench/report.d.ts.map +1 -0
  49. package/dist/bench/report.js +74 -0
  50. package/dist/bench/report.js.map +1 -0
  51. package/dist/bench/runner.d.ts +15 -0
  52. package/dist/bench/runner.d.ts.map +1 -0
  53. package/dist/bench/runner.js +26 -0
  54. package/dist/bench/runner.js.map +1 -0
  55. package/dist/bench/toolfork.d.ts +18 -0
  56. package/dist/bench/toolfork.d.ts.map +1 -0
  57. package/dist/bench/toolfork.js +125 -0
  58. package/dist/bench/toolfork.js.map +1 -0
  59. package/dist/box-agent.d.ts +78 -0
  60. package/dist/box-agent.d.ts.map +1 -0
  61. package/dist/box-agent.js +137 -0
  62. package/dist/box-agent.js.map +1 -0
  63. package/dist/box-env.d.ts +26 -0
  64. package/dist/box-env.d.ts.map +1 -0
  65. package/dist/box-env.js +52 -0
  66. package/dist/box-env.js.map +1 -0
  67. package/dist/call.d.ts +23 -0
  68. package/dist/call.d.ts.map +1 -0
  69. package/dist/call.js +45 -0
  70. package/dist/call.js.map +1 -0
  71. package/dist/cloud.d.ts +4917 -0
  72. package/dist/cloud.d.ts.map +1 -0
  73. package/dist/cloud.js +16 -0
  74. package/dist/cloud.js.map +1 -0
  75. package/dist/e2b/index.d.ts +30 -0
  76. package/dist/e2b/index.d.ts.map +1 -0
  77. package/dist/e2b/index.js +273 -0
  78. package/dist/e2b/index.js.map +1 -0
  79. package/dist/egress-approval.d.ts +73 -0
  80. package/dist/egress-approval.d.ts.map +1 -0
  81. package/dist/egress-approval.js +74 -0
  82. package/dist/egress-approval.js.map +1 -0
  83. package/dist/engine.d.ts +188 -0
  84. package/dist/engine.d.ts.map +1 -0
  85. package/dist/engine.js +1507 -0
  86. package/dist/engine.js.map +1 -0
  87. package/dist/fn.d.ts +22 -0
  88. package/dist/fn.d.ts.map +1 -0
  89. package/dist/fn.js +108 -0
  90. package/dist/fn.js.map +1 -0
  91. package/dist/history.d.ts +21 -0
  92. package/dist/history.d.ts.map +1 -0
  93. package/dist/history.js +158 -0
  94. package/dist/history.js.map +1 -0
  95. package/dist/inclient.d.ts +48 -0
  96. package/dist/inclient.d.ts.map +1 -0
  97. package/dist/inclient.js +68 -0
  98. package/dist/inclient.js.map +1 -0
  99. package/dist/index.d.ts +24 -0
  100. package/dist/index.d.ts.map +1 -0
  101. package/dist/index.js +25 -0
  102. package/dist/index.js.map +1 -0
  103. package/dist/interchange.d.ts +17 -0
  104. package/dist/interchange.d.ts.map +1 -0
  105. package/dist/interchange.js +133 -0
  106. package/dist/interchange.js.map +1 -0
  107. package/dist/machine-lifecycle.d.ts +102 -0
  108. package/dist/machine-lifecycle.d.ts.map +1 -0
  109. package/dist/machine-lifecycle.js +360 -0
  110. package/dist/machine-lifecycle.js.map +1 -0
  111. package/dist/manifest.d.ts +42 -0
  112. package/dist/manifest.d.ts.map +1 -0
  113. package/dist/manifest.js +53 -0
  114. package/dist/manifest.js.map +1 -0
  115. package/dist/open.d.ts +45 -0
  116. package/dist/open.d.ts.map +1 -0
  117. package/dist/open.js +245 -0
  118. package/dist/open.js.map +1 -0
  119. package/dist/parked-action.d.ts +51 -0
  120. package/dist/parked-action.d.ts.map +1 -0
  121. package/dist/parked-action.js +29 -0
  122. package/dist/parked-action.js.map +1 -0
  123. package/dist/persistence.d.ts +41 -0
  124. package/dist/persistence.d.ts.map +1 -0
  125. package/dist/persistence.js +86 -0
  126. package/dist/persistence.js.map +1 -0
  127. package/dist/pins.d.ts +231 -0
  128. package/dist/pins.d.ts.map +1 -0
  129. package/dist/pins.js +213 -0
  130. package/dist/pins.js.map +1 -0
  131. package/dist/pipeline.d.ts +142 -0
  132. package/dist/pipeline.d.ts.map +1 -0
  133. package/dist/pipeline.js +1014 -0
  134. package/dist/pipeline.js.map +1 -0
  135. package/dist/prewired-schema.d.ts +16 -0
  136. package/dist/prewired-schema.d.ts.map +1 -0
  137. package/dist/prewired-schema.js +48 -0
  138. package/dist/prewired-schema.js.map +1 -0
  139. package/dist/redaction.d.ts +13 -0
  140. package/dist/redaction.d.ts.map +1 -0
  141. package/dist/redaction.js +67 -0
  142. package/dist/redaction.js.map +1 -0
  143. package/dist/runtime.d.ts +463 -0
  144. package/dist/runtime.d.ts.map +1 -0
  145. package/dist/runtime.js +1715 -0
  146. package/dist/runtime.js.map +1 -0
  147. package/dist/sandbox.d.ts +90 -0
  148. package/dist/sandbox.d.ts.map +1 -0
  149. package/dist/sandbox.js +2 -0
  150. package/dist/sandbox.js.map +1 -0
  151. package/dist/schedules.d.ts +89 -0
  152. package/dist/schedules.d.ts.map +1 -0
  153. package/dist/schedules.js +334 -0
  154. package/dist/schedules.js.map +1 -0
  155. package/dist/secret-exposure.d.ts +55 -0
  156. package/dist/secret-exposure.d.ts.map +1 -0
  157. package/dist/secret-exposure.js +53 -0
  158. package/dist/secret-exposure.js.map +1 -0
  159. package/dist/ship-diff.d.ts +47 -0
  160. package/dist/ship-diff.d.ts.map +1 -0
  161. package/dist/ship-diff.js +39 -0
  162. package/dist/ship-diff.js.map +1 -0
  163. package/dist/testing/fake-box.d.ts +67 -0
  164. package/dist/testing/fake-box.d.ts.map +1 -0
  165. package/dist/testing/fake-box.js +166 -0
  166. package/dist/testing/fake-box.js.map +1 -0
  167. package/dist/testing/fake-sandbox-v2.d.ts +59 -0
  168. package/dist/testing/fake-sandbox-v2.d.ts.map +1 -0
  169. package/dist/testing/fake-sandbox-v2.js +121 -0
  170. package/dist/testing/fake-sandbox-v2.js.map +1 -0
  171. package/dist/testing/fake-sandbox.d.ts +94 -0
  172. package/dist/testing/fake-sandbox.d.ts.map +1 -0
  173. package/dist/testing/fake-sandbox.js +239 -0
  174. package/dist/testing/fake-sandbox.js.map +1 -0
  175. package/dist/testing/guard-fixture.d.ts +19 -0
  176. package/dist/testing/guard-fixture.d.ts.map +1 -0
  177. package/dist/testing/guard-fixture.js +134 -0
  178. package/dist/testing/guard-fixture.js.map +1 -0
  179. package/dist/testing/index.d.ts +8 -0
  180. package/dist/testing/index.d.ts.map +1 -0
  181. package/dist/testing/index.js +8 -0
  182. package/dist/testing/index.js.map +1 -0
  183. package/dist/testing/memory-store.d.ts +5 -0
  184. package/dist/testing/memory-store.d.ts.map +1 -0
  185. package/dist/testing/memory-store.js +4 -0
  186. package/dist/testing/memory-store.js.map +1 -0
  187. package/dist/testing/scripted-model.d.ts +32 -0
  188. package/dist/testing/scripted-model.d.ts.map +1 -0
  189. package/dist/testing/scripted-model.js +112 -0
  190. package/dist/testing/scripted-model.js.map +1 -0
  191. package/dist/testing/seed-app-row.d.ts +4 -0
  192. package/dist/testing/seed-app-row.d.ts.map +1 -0
  193. package/dist/testing/seed-app-row.js +7 -0
  194. package/dist/testing/seed-app-row.js.map +1 -0
  195. package/dist/unified-diff.d.ts +13 -0
  196. package/dist/unified-diff.d.ts.map +1 -0
  197. package/dist/unified-diff.js +127 -0
  198. package/dist/unified-diff.js.map +1 -0
  199. package/dist/version-hash.d.ts +9 -0
  200. package/dist/version-hash.d.ts.map +1 -0
  201. package/dist/version-hash.js +12 -0
  202. package/dist/version-hash.js.map +1 -0
  203. package/package.json +84 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud.d.ts","sourceRoot":"","sources":["../src/cloud.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,KAAK,EACV,KAAK,WAAW,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,+DAA+D;AAC/D,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,WAAW,CAAC;IACjB,SAAS,EAAE,WAAW,CAAC;CACxB;AAED,yEAAyE;AACzE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;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KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAC9D,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CACjE"}
package/dist/cloud.js ADDED
@@ -0,0 +1,16 @@
1
+ import { appDocumentSchema, appIdSchema, isoDateTimeSchema, } from "@vendoai/core";
2
+ import { z } from "zod";
3
+ /** 06-apps §1 — validated wire representation of a frozen share copy. */
4
+ export const shareSnapshotSchema = z.object({
5
+ id: z.string(),
6
+ doc: appDocumentSchema,
7
+ createdAt: isoDateTimeSchema,
8
+ }).passthrough();
9
+ /** 06-apps §1 — validated wire representation of a publish record. */
10
+ export const publishRecordSchema = z.object({
11
+ id: z.string(),
12
+ appId: appIdSchema,
13
+ version: z.string(),
14
+ createdAt: isoDateTimeSchema,
15
+ }).passthrough();
16
+ //# sourceMappingURL=cloud.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud.js","sourceRoot":"","sources":["../src/cloud.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,iBAAiB,GAIlB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,yEAAyE;AACzE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,GAAG,EAAE,iBAAiB;IACtB,SAAS,EAAE,iBAAiB;CAC7B,CAAC,CAAC,WAAW,EAAqC,CAAC;AAUpD,sEAAsE;AACtE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,KAAK,EAAE,WAAW;IAClB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,SAAS,EAAE,iBAAiB;CAC7B,CAAC,CAAC,WAAW,EAAqC,CAAC"}
@@ -0,0 +1,30 @@
1
+ import type { SandboxAdapter } from "../sandbox.js";
2
+ export interface E2BSandboxOptions {
3
+ /** E2B API key. When omitted, the SDK reads E2B_API_KEY. */
4
+ apiKey?: string;
5
+ /** Provider machine lifetime and reconnect timeout, in milliseconds. */
6
+ timeoutMs?: number;
7
+ }
8
+ /** True when the optional `e2b` SDK resolves from this package, so callers can
9
+ avoid wiring an adapter whose first create() would die on a missing module.
10
+ Runtimes without `import.meta.resolve` (bundlers inline the dependency) are
11
+ treated as available. */
12
+ export declare const e2bInstalled: () => boolean;
13
+ /**
14
+ * execution-v2 — adapt an E2B sandbox to Vendo's provider-neutral seam.
15
+ *
16
+ * Seam mapping: create() boots from an optional E2B template (point-in-time
17
+ * snapshot ids double as templates); request() proxies HTTPS to the box's
18
+ * $PORT host (or an explicit port); snapshot() takes a reusable point-in-time
19
+ * checkpoint while the source keeps running; stop() is E2B's snapshot-
20
+ * preserving pause; destroy() kills the machine (paused or running) for good.
21
+ * allowedDomains rides E2B's provider-native network allowlist plus an
22
+ * all-traffic deny rule; undefined means unrestricted egress.
23
+ *
24
+ * The machine object also carries adapter-private exec/files used for
25
+ * bootstrap, diagnostics, and the dying v1 compat paths — they are NOT part
26
+ * of the public seam (the in-box agent owns the inside of the box).
27
+ * The optional SDK is imported only when create/resume is called.
28
+ */
29
+ export declare const e2bSandbox: (options?: E2BSandboxOptions) => SandboxAdapter;
30
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/e2b/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,eAAe,CAAC;AAUpE,MAAM,WAAW,iBAAiB;IAChC,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAsGD;;;4BAG4B;AAC5B,eAAO,MAAM,YAAY,QAAO,OAQ/B,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,UAAU,GAAI,UAAS,iBAAsB,KAAG,cAuK5D,CAAC"}
@@ -0,0 +1,273 @@
1
+ import { VendoError } from "@vendoai/core";
2
+ const DEFAULT_TIMEOUT_MS = 300_000;
3
+ /** Throttle for sliding the provider deadline on request activity. */
4
+ const TTL_EXTEND_INTERVAL_MS = 60_000;
5
+ const DEFAULT_PORT = 8080;
6
+ const SNAPSHOT_REF_PREFIX = "e2b:v2:";
7
+ /** Refs minted by the retired v1 adapter, still present in persisted app documents. */
8
+ const LEGACY_SNAPSHOT_REF_PREFIX = "e2b:v1:";
9
+ const toArrayBuffer = (value) => value.slice().buffer;
10
+ const responseHeaders = (headers) => Object.fromEntries(headers.entries());
11
+ const parsePort = (env) => {
12
+ const port = Number(env.PORT ?? DEFAULT_PORT);
13
+ return Number.isInteger(port) && port > 0 && port <= 65_535 ? port : DEFAULT_PORT;
14
+ };
15
+ const encodeSnapshotRef = (snapshotId, sourceSandboxId, allowedDomains, port) => `${SNAPSHOT_REF_PREFIX}${Buffer.from(JSON.stringify({
16
+ version: 2,
17
+ snapshotId,
18
+ sourceSandboxId,
19
+ ...(allowedDomains === undefined ? {} : { allowedDomains: [...allowedDomains] }),
20
+ port,
21
+ })).toString("base64url")}`;
22
+ const validPort = (value) => Number.isInteger(value) && value > 0 && value <= 65_535;
23
+ const validDomains = (value) => value === undefined || (Array.isArray(value) && value.every((host) => typeof host === "string"));
24
+ const decodePayload = (payload) => {
25
+ const value = JSON.parse(Buffer.from(payload, "base64url").toString("utf8"));
26
+ if (typeof value !== "object" || value === null)
27
+ throw new Error("not an object");
28
+ return value;
29
+ };
30
+ const decodeSnapshotRef = (snapshotRef) => {
31
+ try {
32
+ if (snapshotRef.startsWith(SNAPSHOT_REF_PREFIX) && snapshotRef.length > SNAPSHOT_REF_PREFIX.length) {
33
+ const state = decodePayload(snapshotRef.slice(SNAPSHOT_REF_PREFIX.length));
34
+ if (state.version !== 2 || typeof state.snapshotId !== "string" || state.snapshotId.length === 0) {
35
+ throw new Error("invalid snapshot id");
36
+ }
37
+ if (!validPort(state.port))
38
+ throw new Error("invalid port");
39
+ if (!validDomains(state.allowedDomains))
40
+ throw new Error("invalid allowedDomains policy");
41
+ if (state.sourceSandboxId !== undefined
42
+ && (typeof state.sourceSandboxId !== "string" || state.sourceSandboxId.length === 0)) {
43
+ throw new Error("invalid source sandbox id");
44
+ }
45
+ return {
46
+ snapshotId: state.snapshotId,
47
+ ...(state.sourceSandboxId === undefined ? {} : { sourceSandboxId: state.sourceSandboxId }),
48
+ ...(state.allowedDomains === undefined ? {} : { allowedDomains: [...state.allowedDomains] }),
49
+ port: state.port,
50
+ };
51
+ }
52
+ if (snapshotRef.startsWith(LEGACY_SNAPSHOT_REF_PREFIX) && snapshotRef.length > LEGACY_SNAPSHOT_REF_PREFIX.length) {
53
+ const state = decodePayload(snapshotRef.slice(LEGACY_SNAPSHOT_REF_PREFIX.length));
54
+ if (state.version !== 1 || typeof state.snapshotId !== "string" || state.snapshotId.length === 0) {
55
+ throw new Error("invalid snapshot id");
56
+ }
57
+ if (!validPort(state.port))
58
+ throw new Error("invalid port");
59
+ if (!validDomains(state.egress))
60
+ throw new Error("invalid egress policy");
61
+ return {
62
+ snapshotId: state.snapshotId,
63
+ ...(state.egress === undefined ? {} : { allowedDomains: [...state.egress] }),
64
+ port: state.port,
65
+ };
66
+ }
67
+ throw new Error("unknown prefix");
68
+ }
69
+ catch {
70
+ throw new VendoError("validation", "E2B snapshot references must start with e2b:v2: (or the retired e2b:v1:) and carry a valid payload");
71
+ }
72
+ };
73
+ const networkOptions = (allowedDomains, allTraffic) => allowedDomains === undefined
74
+ ? { allowInternetAccess: true }
75
+ : { network: { allowOut: [...allowedDomains], denyOut: [allTraffic] } };
76
+ /** True when the optional `e2b` SDK resolves from this package, so callers can
77
+ avoid wiring an adapter whose first create() would die on a missing module.
78
+ Runtimes without `import.meta.resolve` (bundlers inline the dependency) are
79
+ treated as available. */
80
+ export const e2bInstalled = () => {
81
+ if (typeof import.meta.resolve !== "function")
82
+ return true;
83
+ try {
84
+ import.meta.resolve("e2b");
85
+ return true;
86
+ }
87
+ catch {
88
+ return false;
89
+ }
90
+ };
91
+ /**
92
+ * execution-v2 — adapt an E2B sandbox to Vendo's provider-neutral seam.
93
+ *
94
+ * Seam mapping: create() boots from an optional E2B template (point-in-time
95
+ * snapshot ids double as templates); request() proxies HTTPS to the box's
96
+ * $PORT host (or an explicit port); snapshot() takes a reusable point-in-time
97
+ * checkpoint while the source keeps running; stop() is E2B's snapshot-
98
+ * preserving pause; destroy() kills the machine (paused or running) for good.
99
+ * allowedDomains rides E2B's provider-native network allowlist plus an
100
+ * all-traffic deny rule; undefined means unrestricted egress.
101
+ *
102
+ * The machine object also carries adapter-private exec/files used for
103
+ * bootstrap, diagnostics, and the dying v1 compat paths — they are NOT part
104
+ * of the public seam (the in-box agent owns the inside of the box).
105
+ * The optional SDK is imported only when create/resume is called.
106
+ */
107
+ export const e2bSandbox = (options = {}) => {
108
+ const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
109
+ const wrap = (sandbox, state) => {
110
+ const baseUrl = (port) => `https://${sandbox.getHost(port)}`;
111
+ // Seam rule: sleeping or destroying twice is not an error, and destroy is
112
+ // final. The one-shot promises make that hold under concurrency too —
113
+ // each transition is assigned synchronously, so racing callers share one
114
+ // provider call instead of issuing duplicate pause()/kill()s, and a
115
+ // destroy during an in-flight pause serializes after it.
116
+ let sleeping;
117
+ let destroying;
118
+ // E2B's timeoutMs is a HARD deadline fixed at create/resume — proxied
119
+ // traffic does not extend it, so a busy box would be provider-killed
120
+ // mid-session (before the idle lifecycle ever snapshots it). Slide the
121
+ // deadline on activity instead: best-effort and throttled, so the idle
122
+ // auto-sleep — not the provider TTL — decides when the machine stops.
123
+ let ttlExtendedAt = 0;
124
+ const extendTtl = () => {
125
+ const now = Date.now();
126
+ if (now - ttlExtendedAt < TTL_EXTEND_INTERVAL_MS)
127
+ return;
128
+ ttlExtendedAt = now;
129
+ void Promise.resolve(sandbox.setTimeout(timeoutMs)).catch(() => undefined);
130
+ };
131
+ return {
132
+ id: sandbox.sandboxId,
133
+ async request(request) {
134
+ extendTtl();
135
+ const response = await fetch(`${baseUrl(request.port ?? state.port)}${request.path.startsWith("/") ? request.path : `/${request.path}`}`, {
136
+ method: request.method,
137
+ headers: request.headers,
138
+ body: request.body === undefined
139
+ ? undefined
140
+ : typeof request.body === "string"
141
+ ? request.body
142
+ : toArrayBuffer(request.body),
143
+ });
144
+ // The e2b ingress answers 502 for BOTH "app port not open yet" (boot
145
+ // race, retried above the seam) and "sandbox reaped" (TTL, sweep).
146
+ // Only the SDK knows which: a dead sandbox becomes the seam's thrown
147
+ // not-found (the lifecycle evicts the live entry and re-wakes from
148
+ // the durable ref); an inconclusive probe fails open to the plain 502.
149
+ if (response.status === 502) {
150
+ const running = await sandbox.isRunning().catch(() => true);
151
+ if (!running) {
152
+ throw new VendoError("not-found", `e2b sandbox ${sandbox.sandboxId} is gone (reaped by the provider)`);
153
+ }
154
+ }
155
+ return {
156
+ status: response.status,
157
+ headers: responseHeaders(response.headers),
158
+ body: new Uint8Array(await response.arrayBuffer()),
159
+ };
160
+ },
161
+ async url(port) {
162
+ return baseUrl(port ?? state.port);
163
+ },
164
+ async snapshot() {
165
+ const snapshot = await sandbox.createSnapshot();
166
+ return encodeSnapshotRef(snapshot.snapshotId, sandbox.sandboxId, state.allowedDomains, state.port);
167
+ },
168
+ async stop() {
169
+ if (destroying !== undefined) {
170
+ await destroying;
171
+ return;
172
+ }
173
+ sleeping ??= sandbox.pause().then(() => undefined);
174
+ await sleeping;
175
+ },
176
+ async destroy() {
177
+ destroying ??= (sleeping ?? Promise.resolve())
178
+ .catch(() => undefined)
179
+ .then(() => sandbox.kill())
180
+ .then(() => undefined);
181
+ await destroying;
182
+ },
183
+ // ——— adapter-private below this line (bootstrap/diagnostics + v1 compat) ———
184
+ async exec(cmd, execOptions) {
185
+ // Box bootstrap and diagnostics are activity too — a minutes-long
186
+ // command sequence must slide the provider deadline like requests do.
187
+ extendTtl();
188
+ try {
189
+ const result = await sandbox.commands.run(cmd, {
190
+ ...(execOptions?.cwd === undefined ? {} : { cwd: execOptions.cwd }),
191
+ timeoutMs: execOptions?.timeoutMs ?? timeoutMs,
192
+ });
193
+ return { code: result.exitCode, stdout: result.stdout, stderr: result.stderr };
194
+ }
195
+ catch (error) {
196
+ if (typeof error === "object" && error !== null &&
197
+ typeof error.exitCode === "number" &&
198
+ typeof error.stdout === "string" &&
199
+ typeof error.stderr === "string") {
200
+ const result = error;
201
+ return { code: result.exitCode, stdout: result.stdout, stderr: result.stderr };
202
+ }
203
+ throw error;
204
+ }
205
+ },
206
+ files: {
207
+ async read(path) {
208
+ return sandbox.files.read(path, { format: "bytes" });
209
+ },
210
+ async write(path, bytes) {
211
+ await sandbox.files.write(path, typeof bytes === "string" ? bytes : toArrayBuffer(bytes));
212
+ },
213
+ async list(dir) {
214
+ return (await sandbox.files.list(dir)).map((entry) => entry.name);
215
+ },
216
+ },
217
+ };
218
+ };
219
+ return {
220
+ async create(spec) {
221
+ // Optional SDK: keep it a runtime import so hosts without e2b installed
222
+ // don't fail Next's (webpack/Turbopack) bundling of the vendo route.
223
+ const { ALL_TRAFFIC, Sandbox } = await import(/* webpackIgnore: true */ /* turbopackIgnore: true */ "e2b");
224
+ const allowedDomains = spec.allowedDomains;
225
+ const createOptions = {
226
+ ...(options.apiKey === undefined ? {} : { apiKey: options.apiKey }),
227
+ envs: spec.env,
228
+ timeoutMs,
229
+ ...networkOptions(allowedDomains, ALL_TRAFFIC),
230
+ };
231
+ const sandbox = spec.template === undefined
232
+ ? await Sandbox.create(createOptions)
233
+ : await Sandbox.create(spec.template, createOptions);
234
+ return wrap(sandbox, { allowedDomains, port: parsePort(spec.env) });
235
+ },
236
+ async resume(snapshotRef, policy) {
237
+ const state = decodeSnapshotRef(snapshotRef);
238
+ // Lane E — a wake enforces the CURRENT egress policy when the caller
239
+ // passes one; the snapshot-time allowlist applies only to a bare resume.
240
+ const allowedDomains = policy === undefined ? state.allowedDomains : policy.allowedDomains;
241
+ const { ALL_TRAFFIC, Sandbox } = await import(/* webpackIgnore: true */ /* turbopackIgnore: true */ "e2b");
242
+ return wrap(await Sandbox.create(state.snapshotId, {
243
+ ...(options.apiKey === undefined ? {} : { apiKey: options.apiKey }),
244
+ timeoutMs,
245
+ ...networkOptions(allowedDomains, ALL_TRAFFIC),
246
+ }), { ...state, allowedDomains });
247
+ },
248
+ async destroy(snapshotRef) {
249
+ const state = decodeSnapshotRef(snapshotRef);
250
+ const { NotFoundError, Sandbox } = await import(/* webpackIgnore: true */ /* turbopackIgnore: true */ "e2b");
251
+ const apiOptions = options.apiKey === undefined ? {} : { apiKey: options.apiKey };
252
+ // Best-effort reap of the sandbox the sleep flow left paused behind this
253
+ // ref (recorded by v2 refs; absent from retired v1 refs). It is usually
254
+ // already gone — the machine's own destroy() killed it — so any failure
255
+ // here is not this call's problem.
256
+ if (state.sourceSandboxId !== undefined) {
257
+ await Sandbox.kill(state.sourceSandboxId, apiOptions).catch(() => undefined);
258
+ }
259
+ try {
260
+ await Sandbox.deleteSnapshot(state.snapshotId, apiOptions);
261
+ }
262
+ catch (error) {
263
+ // Idempotent by seam contract: already-deleted state is a no-op. The
264
+ // name fallback covers an SDK bump or bundler duplicating the class.
265
+ const notFound = error instanceof NotFoundError
266
+ || (error instanceof Error && error.name === "NotFoundError");
267
+ if (!notFound)
268
+ throw error;
269
+ }
270
+ },
271
+ };
272
+ };
273
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/e2b/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,MAAM,kBAAkB,GAAG,OAAO,CAAC;AACnC,sEAAsE;AAC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ane E — grant-style egress approval
4
+ * (spec "Secrets and egress", docs/superpowers/specs/2026-07-19-execution-v2-design.md).
5
+ *
6
+ * The app's `egress` declaration (mirroring `vendo.json`) is an ASK, not an
7
+ * authority: each declared domain needs a one-time owner approval before a
8
+ * machine may provision or wake with it. The flow reuses the guard's existing
9
+ * critical-approval machinery (the ENG-345 exposure-grant pattern — no new
10
+ * ceremony types): an unapproved declaration parks ONE approval naming the
11
+ * missing domains, and the decision seam commits them onto the app document's
12
+ * `egressApproved` field. This module owns the pure policy math and the store
13
+ * of parked requests; the runtime owns the guard round-trip.
14
+ *
15
+ * Grant hygiene mirrors ENG-345 structurally where it can: parked requests
16
+ * live in their own collection keyed by app id (a copy's fresh id has none),
17
+ * and the doc-stored `egressApproved` field is stripped at every copy mint
18
+ * (fork/share/publish; interchange strips by field whitelist).
19
+ */
20
+ export interface EgressApprovalRequest {
21
+ appId: AppId;
22
+ /** One normalized declared domain awaiting the owner's decision. */
23
+ domain: string;
24
+ /** The app owner's principal subject — the only principal who may approve. */
25
+ owner: string;
26
+ /** The parked guard approval that decides this domain (06-apps §9 model). */
27
+ approvalId: ApprovalId;
28
+ requestedAt: IsoDateTime;
29
+ }
30
+ /** Domains compare case-insensitively; declarations may carry stray spacing. */
31
+ export declare const normalizeEgressDomain: (domain: string) => string;
32
+ /** Declared-but-not-yet-approved domains — what still needs an owner grant. */
33
+ export declare const unapprovedEgress: (app: AppDocument) => string[];
34
+ /**
35
+ * The allowlist a machine boots or wakes with — the ONE place the box's
36
+ * effective egress policy is assembled. Two rules:
37
+ *
38
+ * 1. Declared domains must ALL be approved: any unapproved declaration is a
39
+ * loud VendoError naming the missing domains (a machine never provisions
40
+ * or wakes half-approved), on every path including ctx-less ones like a
41
+ * schedule wake.
42
+ * 2. The implicit skin domains ride every allowlist unconditionally: the
43
+ * inference endpoint, the host-callback surface, and the store surface are
44
+ * the box's OWN boundary (env half of the skin contract) — a box that
45
+ * cannot reach its own skin is broken, so these are never subject to
46
+ * declaration or approval. The host assembles them from the same URLs it
47
+ * injects as VENDO_STORE_URL / VENDO_HOST_URL / VENDO_INFERENCE_URL.
48
+ *
49
+ * An app that declares nothing gets the implicit skin domains only: v2
50
+ * machine egress is deny-by-default at the network layer (the SSRF and
51
+ * exfil answer, including for the BYO-model-key case).
52
+ */
53
+ export declare const boxAllowlist: (app: AppDocument, implicitDomains: readonly string[]) => string[];
54
+ /**
55
+ * Persistence for PARKED egress approvals only. Approved state lives on the
56
+ * app document (`egressApproved`), so a parked record exists exactly while an
57
+ * approval card is undecided; both decisions clear it (approval commits to
58
+ * the doc first, denial just clears — fail closed).
59
+ */
60
+ export interface EgressApprovals {
61
+ /** Parked requests for one app. */
62
+ pending(appId: AppId): Promise<EgressApprovalRequest[]>;
63
+ /** Park one domain on a guard approval (re-parking the same domain overwrites). */
64
+ putPending(request: EgressApprovalRequest): Promise<void>;
65
+ /** Parked requests riding a specific guard approval id. */
66
+ byApproval(approvalId: ApprovalId): Promise<EgressApprovalRequest[]>;
67
+ /** Clear one parked domain (its approval was decided, either way). */
68
+ remove(appId: AppId, domain: string): Promise<void>;
69
+ /** Delete every parked request for one app (app deletion cleanup). */
70
+ clearForApp(appId: AppId): Promise<void>;
71
+ }
72
+ export declare const createEgressApprovals: (store: StoreAdapter) => EgressApprovals;
73
+ //# sourceMappingURL=egress-approval.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"egress-approval.d.ts","sourceRoot":"","sources":["../src/egress-approval.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,KAAK,EACV,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,YAAY,EAElB,MAAM,eAAe,CAAC;AAGvB;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,KAAK,CAAC;IACb,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,EAAE,WAAW,CAAC;CAC1B;AAED,gFAAgF;AAChF,eAAO,MAAM,qBAAqB,GAAI,QAAQ,MAAM,KAAG,MAAqC,CAAC;AAK7F,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,GAAI,KAAK,WAAW,KAAG,MAAM,EAGzD,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,YAAY,GAAI,KAAK,WAAW,EAAE,iBAAiB,SAAS,MAAM,EAAE,KAAG,MAAM,EAUzF,CAAC;AAYF;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,mCAAmC;IACnC,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAAC;IACxD,mFAAmF;IACnF,UAAU,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,2DAA2D;IAC3D,UAAU,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAAC;IACrE,sEAAsE;IACtE,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,sEAAsE;IACtE,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1C;AAED,eAAO,MAAM,qBAAqB,GAAI,OAAO,YAAY,KAAG,eAiC3D,CAAC"}
@@ -0,0 +1,74 @@
1
+ import { VendoError, } from "@vendoai/core";
2
+ import { listAllRecords } from "./persistence.js";
3
+ /** Domains compare case-insensitively; declarations may carry stray spacing. */
4
+ export const normalizeEgressDomain = (domain) => domain.trim().toLowerCase();
5
+ const normalizeList = (domains) => [...new Set((domains ?? []).map(normalizeEgressDomain))].filter((domain) => domain !== "");
6
+ /** Declared-but-not-yet-approved domains — what still needs an owner grant. */
7
+ export const unapprovedEgress = (app) => {
8
+ const approved = new Set(normalizeList(app.egressApproved));
9
+ return normalizeList(app.egress).filter((domain) => !approved.has(domain));
10
+ };
11
+ /**
12
+ * The allowlist a machine boots or wakes with — the ONE place the box's
13
+ * effective egress policy is assembled. Two rules:
14
+ *
15
+ * 1. Declared domains must ALL be approved: any unapproved declaration is a
16
+ * loud VendoError naming the missing domains (a machine never provisions
17
+ * or wakes half-approved), on every path including ctx-less ones like a
18
+ * schedule wake.
19
+ * 2. The implicit skin domains ride every allowlist unconditionally: the
20
+ * inference endpoint, the host-callback surface, and the store surface are
21
+ * the box's OWN boundary (env half of the skin contract) — a box that
22
+ * cannot reach its own skin is broken, so these are never subject to
23
+ * declaration or approval. The host assembles them from the same URLs it
24
+ * injects as VENDO_STORE_URL / VENDO_HOST_URL / VENDO_INFERENCE_URL.
25
+ *
26
+ * An app that declares nothing gets the implicit skin domains only: v2
27
+ * machine egress is deny-by-default at the network layer (the SSRF and
28
+ * exfil answer, including for the BYO-model-key case).
29
+ */
30
+ export const boxAllowlist = (app, implicitDomains) => {
31
+ const unapproved = unapprovedEgress(app);
32
+ if (unapproved.length > 0) {
33
+ throw new VendoError("blocked", `machine egress is not approved for: ${unapproved.join(", ")}`, { unapprovedDomains: unapproved });
34
+ }
35
+ return [...new Set([...normalizeList(app.egress), ...normalizeList(implicitDomains)])];
36
+ };
37
+ /** Deterministic id so re-requesting the same (app, domain) overwrites, never duplicates. */
38
+ const recordId = (appId, domain) => `egr_${appId}__${domain}`;
39
+ const COLLECTION = "vendo_egress_approval";
40
+ const requestData = (record) => record.data;
41
+ const listAll = (store, refs) => listAllRecords(store.records(COLLECTION), { refs });
42
+ export const createEgressApprovals = (store) => {
43
+ const collection = store.records(COLLECTION);
44
+ const refsFor = (request) => ({
45
+ subject: request.owner,
46
+ app_id: request.appId,
47
+ domain: request.domain,
48
+ approval: request.approvalId,
49
+ });
50
+ return {
51
+ async pending(appId) {
52
+ return (await listAll(store, { app_id: appId })).map(requestData);
53
+ },
54
+ async putPending(request) {
55
+ await collection.put({
56
+ id: recordId(request.appId, request.domain),
57
+ data: request,
58
+ refs: refsFor(request),
59
+ });
60
+ },
61
+ async byApproval(approvalId) {
62
+ return (await listAll(store, { approval: approvalId })).map(requestData);
63
+ },
64
+ async remove(appId, domain) {
65
+ await collection.delete(recordId(appId, domain));
66
+ },
67
+ async clearForApp(appId) {
68
+ for (const record of await listAll(store, { app_id: appId })) {
69
+ await collection.delete(record.id);
70
+ }
71
+ },
72
+ };
73
+ };
74
+ //# sourceMappingURL=egress-approval.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"egress-approval.js","sourceRoot":"","sources":["../src/egress-approval.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,GAOX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAgClD,gFAAgF;AAChF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AAE7F,MAAM,aAAa,GAAG,CAAC,OAAsC,EAAY,EAAE,CACzE,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC;AAE7F,+EAA+E;AAC/E,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,GAAgB,EAAY,EAAE;IAC7D,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC;IAC5D,OAAO,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,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