@moinulmoin/eden 0.5.0 → 0.7.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.
@@ -1,5 +1,5 @@
1
- import type { EveRuntimeInputIdentity } from "./eve-runtime-config.js";
2
- export type EvePackagingCode = "ROOT_INVALID" | "UNSUPPORTED_TOOLCHAIN" | "DEPENDENCY_AMBIGUITY" | "SOURCE_RACE" | "EVE_BUILD_FAILED" | "UNSUPPORTED_EVE_OUTPUT" | "RUNTIME_CLOSURE_INCOMPLETE" | "SECRET_EXCLUSION_FAILED" | "DOCKER_PLATFORM_BLOCKED" | "UNSUPPORTED_HOST_REQUIREMENT" | "EVE_HEALTH_FAILED" | "WORLD_MIGRATION_FAILED" | "CLEANUP_UNVERIFIED" | "PACKAGE_VERIFICATION_FAILED";
1
+ import { type EveRuntimeInputIdentity } from "./eve-runtime-config.js";
2
+ export type EvePackagingCode = "ROOT_INVALID" | "UNSUPPORTED_TOOLCHAIN" | "DEPENDENCY_AMBIGUITY" | "SOURCE_RACE" | "EVE_BUILD_FAILED" | "UNSUPPORTED_EVE_OUTPUT" | "RUNTIME_CLOSURE_INCOMPLETE" | "SECRET_EXCLUSION_FAILED" | "DOCKER_PLATFORM_BLOCKED" | "UNSUPPORTED_HOST_REQUIREMENT" | "EVE_HEALTH_FAILED" | "WORLD_MIGRATION_FAILED" | "CLEANUP_UNVERIFIED";
3
3
  export interface EveRuntimeConfigExclusion {
4
4
  /**
5
5
  * This path is opaque. The packaging worker only uses its lexical identity
@@ -101,6 +101,23 @@ export interface EveProjectOutput {
101
101
  readonly outputDigest: string;
102
102
  readonly fileCount: number;
103
103
  }
104
+ /** Snapshot-relative root of Eve's prepared sandbox templates. */
105
+ export declare const EVE_SANDBOX_CACHE_ROOT: ".eve/sandbox-cache";
106
+ /**
107
+ * Evidence for the sandbox templates `eve build` prepared inside the isolated
108
+ * builder. Runtime sandboxes resolve their template at
109
+ * `<appRoot>/.eve/sandbox-cache/<provider>/templates/<key>`, so this tree must
110
+ * ship inside the runtime image or every `bash`/`read_file`/`write_file` call
111
+ * fails with "Sandbox template ... is not provisioned". `null` when this Eve
112
+ * build prepared no sandbox template.
113
+ */
114
+ export interface EveSandboxCacheOutput {
115
+ readonly present: true;
116
+ readonly root: typeof EVE_SANDBOX_CACHE_ROOT;
117
+ readonly outputDigest: string;
118
+ readonly fileCount: number;
119
+ readonly totalBytes: number;
120
+ }
104
121
  export interface EveProjectBuildCandidate {
105
122
  readonly generationId: string;
106
123
  readonly generationRoot: string;
@@ -122,6 +139,7 @@ export interface EveProjectBuildCandidate {
122
139
  readonly sourceDigest: string;
123
140
  readonly snapshotDigest: string;
124
141
  readonly generatedOutput: EveProjectOutput;
142
+ readonly sandboxCache: EveSandboxCacheOutput | null;
125
143
  readonly runtimeConfigInputIdentity?: string;
126
144
  readonly runtimeVariableNames: readonly string[];
127
145
  }
@@ -175,15 +193,6 @@ export interface EveProjectImage {
175
193
  };
176
194
  readonly generatedOutput: EveProjectOutput | null;
177
195
  }
178
- export interface EveProjectRuntime {
179
- readonly listenHost: "0.0.0.0";
180
- readonly listenPort: 8080;
181
- readonly healthMethod: "GET";
182
- readonly healthPath: "/eve/v1/health";
183
- readonly healthStatus: "not-run";
184
- readonly healthVerified: false;
185
- readonly durableLocalFilesystemClaim: false;
186
- }
187
196
  export interface EveProjectSecretsEvidence {
188
197
  readonly runtimeVariableNames: readonly string[];
189
198
  readonly valuesRecorded: false;
@@ -228,9 +237,15 @@ export interface EveProjectPackagingResult {
228
237
  readonly snapshot: EveProjectSnapshot | null;
229
238
  readonly toolchain: EveProjectToolchain | null;
230
239
  readonly image: EveProjectImage | null;
231
- readonly runtime: EveProjectRuntime | null;
232
240
  readonly secrets: EveProjectSecretsEvidence;
233
241
  readonly checks: readonly EvePackagingCheck[];
242
+ /**
243
+ * Outcome of the builder's temporary eve#4440 sandbox-resume patch:
244
+ * `applied` when the shipped just-bash binding carries it, `skipped` when
245
+ * the binding is a version Eden does not know, `absent` when this Eve
246
+ * build has no just-bash binding or packaging never reached the image.
247
+ */
248
+ readonly sandboxResumePatch: EveSandboxResumePatchStatus;
234
249
  readonly candidateImageId: string | null;
235
250
  readonly candidateImageRetainedLocally: boolean;
236
251
  readonly writtenPaths: readonly string[];
@@ -252,6 +267,57 @@ export declare class EvePackagingError extends Error {
252
267
  readonly remediation: string;
253
268
  });
254
269
  }
270
+ /**
271
+ * Eden's temporary fix for upstream https://github.com/vercel/eve/issues/4440
272
+ * (repro: https://github.com/moinulmoin/eve-justbash-resume-repro).
273
+ * Eve's just-bash provider permanently refuses to resume a conversation once
274
+ * the sandbox template changes (skills, `agent/sandbox/workspace/`, or the
275
+ * sandbox definition) and never falls back, so one `eden deploy` update would
276
+ * break every existing conversation's sandbox forever. The isolated builder
277
+ * rewrites one file in the installed Eve copy so an existing session reopens
278
+ * against the current template instead of throwing; user files under
279
+ * `/workspace` always win over the template. The patch applies only when the
280
+ * target file's sha256 equals `EVE_SANDBOX_RESUME_PATCH_KNOWN_SHA256`, and it
281
+ * is removed entirely once upstream ships the fix.
282
+ */
283
+ export declare const EVE_SANDBOX_RESUME_PATCH_KNOWN_SHA256 = "0ba0ac3a237c99af2f67a6028f1675bf7c04b22454b4ebfb4cd9d19e5bf5aaf8";
284
+ /** Marker the patched binding always contains; proves the patch shipped. */
285
+ export declare const EVE_SANDBOX_RESUME_PATCH_SIGNATURE = "edenRefreshJustBashSessionSkills";
286
+ /** The exact `resume()` implementation in eve 0.68.0, 0.71.2, and 0.72.1. */
287
+ export declare const EVE_JUST_BASH_RESUME_ORIGINAL = "async resume(e,n,r){let i=requirePreparedJustBashArtifact(n),a=requireJustBashSessionState(r),o=createSandboxProviderIdentity({artifact:i,version:1}),s=sessionRootPath(e,i);if(a.generation!==o||a.rootPath!==s)throw Error(`just-bash session state is incompatible with this environment.`);if(!await pathExists(a.rootPath))throw Error(`just-bash session root \"${a.rootPath}\" no longer exists.`);return await openHandle(e,a.rootPath,t)}";
288
+ /**
289
+ * The replacement `resume()`: a session whose template generation moved is
290
+ * contained to the same sessions directory and reopened with its authored
291
+ * skills refreshed from the current template. A session folder that is gone
292
+ * (for example a deploy that could not carry it) is recreated from the
293
+ * current template instead of failing every later sandbox call.
294
+ */
295
+ export declare const EVE_SANDBOX_RESUME_PATCHED = "async resume(e,n,r){let i=requirePreparedJustBashArtifact(n),a=requireJustBashSessionState(r),o=createSandboxProviderIdentity({artifact:i,version:1}),s=sessionRootPath(e,i);if((a.generation!==o||a.rootPath!==s)&&dirname(a.rootPath)!==dirname(s))throw Error(`just-bash session state is incompatible with this environment.`);await ensureSessionRoot(i,a.rootPath);if(a.generation!==o)await edenRefreshJustBashSessionSkills(i.templateRootPath,a.rootPath);return await openHandle(e,a.rootPath,t)}";
296
+ /**
297
+ * Helpers appended to the patched binding. They use only identifiers the
298
+ * module already imports (`readdir`, `rm`, `join`, `pathExists`,
299
+ * `copyDirectoryAtomically`). Skills live at `$HOME/.agents/skills` inside a
300
+ * just-bash root, so the session keeps the same path relative to its `fs`
301
+ * directory as the template; the template's `fs` is scanned because `$HOME`
302
+ * is only known inside the sandbox.
303
+ */
304
+ export declare const EVE_SANDBOX_RESUME_PATCH_HELPERS = "async function edenRefreshJustBashSessionSkills(e,t){let n=await edenFindTemplateSkillsRelativePath(join(e,\"fs\"));if(n===void 0)return;let r=join(t,\"fs\",n);await rm(r,{force:!0,recursive:!0}),await copyDirectoryAtomically(join(e,\"fs\",n),r)}\nasync function edenFindTemplateSkillsRelativePath(e){let t=[[\"\",0]];for(;t.length>0;){let n=t.shift(),r=n[0],i=n[1];if(i>3)continue;let a=[];try{a=await readdir(join(e,r),{withFileTypes:!0})}catch{a=[]}for(let o of a){if(!o.isDirectory())continue;let s=r===\"\"?o.name:r+\"/\"+o.name;if(o.name===\".agents\")return await pathExists(join(e,s,\"skills\"))?s+\"/skills\":void 0;t.push([s,i+1])}}return void 0}\n";
305
+ /**
306
+ * The CommonJS patcher the isolated builder runs between the frozen install
307
+ * and `eve build` (and again for the production reinstall). It never touches
308
+ * project files, applies only against the known sha256, verifies the
309
+ * replacement matched exactly once, validates the result with `node --check`,
310
+ * and breaks hardlinks by writing a temp file and renaming it into place.
311
+ */
312
+ export declare const EVE_SANDBOX_RESUME_PATCH_SCRIPT: string;
313
+ /** Outcome of the builder's sandbox-resume patch for the packaged image. */
314
+ export type EveSandboxResumePatchStatus = "applied" | "skipped" | "absent";
315
+ export declare function sha256(value: string | Buffer): string;
316
+ export declare function jsonBytes(value: unknown): Buffer;
317
+ export declare function isWithin(root: string, candidate: string): boolean;
318
+ export declare function safeRelativePath(root: string, candidate: string): string;
319
+ export declare const IMAGE_ID_PATTERN: RegExp;
320
+ export declare function imageReference(nodeImage: EveNodeImage, reason: string, remediation: string): string;
255
321
  /**
256
322
  * The authored Eve project source the runtime stage must carry so `eve start`
257
323
  * can resolve the project context (agent/, agents/ workspaces, flat layouts,
@@ -259,6 +325,7 @@ export declare class EvePackagingError extends Error {
259
325
  * capture-time exclusion still applied; generated roots are never source.
260
326
  */
261
327
  export declare function eveSnapshotSourceEntries(snapshotRoot: string): Promise<readonly string[]>;
328
+ export declare function safeError(error: EvePackagingError): EveProjectPackagingResult["error"];
262
329
  export declare function buildEveProjectSnapshot(options: EveProjectSnapshotOptions): Promise<EveProjectPackagingResult>;
263
330
  export declare function revalidateEveProjectCandidateInputs(candidate: EveProjectBuildCandidate, runtimeConfig?: EveRuntimeConfigExclusion): Promise<void>;
264
331
  export declare function createDockerEveProjectBuilder(options: {