@codeworksh/harness 0.0.1-dev.20260907151726 → 0.0.1-dev.20260917115353

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,4 +1,4 @@
1
- import { g as Module, h as Driver, y as Registration } from "./sandbox-DnL9UPzZ.mjs";
1
+ import { a as driver_d_exports, g as Module, h as Driver, y as Registration } from "./sandbox-DX9mliQs.mjs";
2
2
  import { Schema } from "effect";
3
3
  //#region src/sandboxes/daytona/index.d.ts
4
4
  declare const Options: Schema.Struct<{
@@ -72,4 +72,4 @@ declare const config: (value: CreateConfig) => {
72
72
  };
73
73
  //#endregion
74
74
  export { RuntimeConfig as a, sandbox as c, ResourcesConfig as i, CreateConfig as n, config as o, Options as r, make as s, ClientOptions as t };
75
- //# sourceMappingURL=index-CTm6Qzer.d.mts.map
75
+ //# sourceMappingURL=index-5Ur9C_De.d.mts.map
@@ -1,4 +1,4 @@
1
- import { g as Module, h as Driver, y as Registration } from "./sandbox-DnL9UPzZ.mjs";
1
+ import { a as driver_d_exports, g as Module, h as Driver, y as Registration } from "./sandbox-DX9mliQs.mjs";
2
2
  import { Schema } from "effect";
3
3
  //#region src/sandboxes/vercel/index.d.ts
4
4
  declare const Options: Schema.Struct<{
@@ -78,4 +78,4 @@ declare const config: (value: CreateConfig) => {
78
78
  };
79
79
  //#endregion
80
80
  export { Source as a, sandbox as c, RuntimeConfig as i, CreateConfig as n, config as o, Options as r, make as s, ClientOptions as t };
81
- //# sourceMappingURL=index-D5gDWEaM.d.mts.map
81
+ //# sourceMappingURL=index-B72Qlv0L.d.mts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeworksh/harness",
3
- "version": "0.0.1-dev.20260907151726",
3
+ "version": "0.0.1-dev.20260917115353",
4
4
  "description": "AI agent harness — agent loop, tools, and code execution sandbox.",
5
5
  "keywords": [
6
6
  "agent",
@@ -68,14 +68,16 @@
68
68
  },
69
69
  "dependencies": {
70
70
  "@codeworksh/aikit": "0.8.0",
71
- "@effect/platform-node": "4.0.0-beta.107",
72
- "@effect/sql-sqlite-node": "4.0.0-beta.107",
71
+ "@effect/platform-node": "4.0.0-rc.115",
72
+ "@effect/platform-node-shared": "4.0.0-rc.115",
73
+ "@effect/sql-sqlite-node": "4.0.0-rc.115",
73
74
  "@platformatic/vfs": "^0.4.0",
74
- "effect": "4.0.0-beta.107",
75
- "just-bash": "^2.14.5",
75
+ "effect": "4.0.0-rc.115",
76
+ "just-bash": "^3.4.2",
77
+ "npm-package-arg": "^14.0.0",
76
78
  "tslib": "^2.8.1",
77
- "typebox": "^1.3.10",
78
- "uuid": "^14.0.1",
79
+ "typebox": "^1.3.30",
80
+ "uuid": "^14.0.2",
79
81
  "uuidv7": "^1.2.1"
80
82
  },
81
83
  "peerDependencies": {
@@ -1,3 +1,4 @@
1
+ import "node:module";
1
2
  //#region \0rolldown/runtime.js
2
3
  var __defProp = Object.defineProperty;
3
4
  var __exportAll = (all, no_symbols) => {
@@ -1,134 +1,6 @@
1
1
  import { Context, Effect, Layer, Option, Schema, Stream } from "effect";
2
- //#region src/sandbox/errors.d.ts
3
- declare const SandboxNotFoundError_base: Schema.Class<SandboxNotFoundError, Schema.TaggedStruct<"SandboxNotFoundError", {
4
- readonly id: Schema.brand<Schema.String, "SandboxInstance.ID"> & {
5
- local: string & import("effect/Brand").Brand<"SandboxInstance.ID">;
6
- create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
7
- };
8
- }>, import("effect/Cause").YieldableError>;
9
- /**
10
- * Lifecycle errors are confined to the control plane. Once a mount succeeds,
11
- * consumers continue to see only FileSystemError and ShellError.
12
- */
13
- declare class SandboxNotFoundError extends SandboxNotFoundError_base {}
14
- declare const SandboxDriverNotRegisteredError_base: Schema.Class<SandboxDriverNotRegisteredError, Schema.TaggedStruct<"SandboxDriverNotRegisteredError", {
15
- readonly driver: Schema.String;
16
- readonly registered: Schema.optional<Schema.$Array<Schema.String>>;
17
- }>, import("effect/Cause").YieldableError>;
18
- declare class SandboxDriverNotRegisteredError extends SandboxDriverNotRegisteredError_base {}
19
- declare const SandboxDriverRegistrationError_base: Schema.Class<SandboxDriverRegistrationError, Schema.TaggedStruct<"SandboxDriverRegistrationError", {
20
- readonly driver: Schema.String;
21
- readonly reason: Schema.String;
22
- }>, import("effect/Cause").YieldableError>;
23
- declare class SandboxDriverRegistrationError extends SandboxDriverRegistrationError_base {}
24
- declare const SandboxDriverLoadError_base: Schema.Class<SandboxDriverLoadError, Schema.TaggedStruct<"SandboxDriverLoadError", {
25
- readonly specifier: Schema.String;
26
- readonly phase: Schema.Literals<readonly ["resolve", "import", "module", "api-version", "options", "factory", "registration"]>;
27
- readonly driver: Schema.optional<Schema.String>;
28
- readonly reason: Schema.String;
29
- }>, import("effect/Cause").YieldableError>;
30
- declare class SandboxDriverLoadError extends SandboxDriverLoadError_base {}
31
- declare const SandboxBusyError_base: Schema.Class<SandboxBusyError, Schema.TaggedStruct<"SandboxBusyError", {
32
- readonly id: Schema.brand<Schema.String, "SandboxInstance.ID"> & {
33
- local: string & import("effect/Brand").Brand<"SandboxInstance.ID">;
34
- create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
35
- };
36
- readonly refCount: Schema.Int;
37
- }>, import("effect/Cause").YieldableError>;
38
- declare class SandboxBusyError extends SandboxBusyError_base {}
39
- declare const SandboxMustBeStoppedError_base: Schema.Class<SandboxMustBeStoppedError, Schema.TaggedStruct<"SandboxMustBeStoppedError", {
40
- readonly id: Schema.brand<Schema.String, "SandboxInstance.ID"> & {
41
- local: string & import("effect/Brand").Brand<"SandboxInstance.ID">;
42
- create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
43
- };
44
- readonly status: Schema.Literals<readonly ["provisioning", "online", "offline", "suspending", "removing", "removed", "unavail", "faulted"]>;
45
- }>, import("effect/Cause").YieldableError>;
46
- declare class SandboxMustBeStoppedError extends SandboxMustBeStoppedError_base {}
47
- declare const SandboxRemovedError_base: Schema.Class<SandboxRemovedError, Schema.TaggedStruct<"SandboxRemovedError", {
48
- readonly id: Schema.brand<Schema.String, "SandboxInstance.ID"> & {
49
- local: string & import("effect/Brand").Brand<"SandboxInstance.ID">;
50
- create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
51
- };
52
- readonly removedAt: Schema.optional<Schema.DateTimeUtc>;
53
- }>, import("effect/Cause").YieldableError>;
54
- declare class SandboxRemovedError extends SandboxRemovedError_base {}
55
- declare const SandboxUnavailError_base: Schema.Class<SandboxUnavailError, Schema.TaggedStruct<"SandboxUnavailError", {
56
- readonly id: Schema.brand<Schema.String, "SandboxInstance.ID"> & {
57
- local: string & import("effect/Brand").Brand<"SandboxInstance.ID">;
58
- create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
59
- };
60
- readonly reason: Schema.String;
61
- }>, import("effect/Cause").YieldableError>;
62
- declare class SandboxUnavailError extends SandboxUnavailError_base {}
63
- declare const SandboxUnsupportedError_base: Schema.Class<SandboxUnsupportedError, Schema.TaggedStruct<"SandboxUnsupportedError", {
64
- readonly id: Schema.optional<Schema.brand<Schema.String, "SandboxInstance.ID"> & {
65
- local: string & import("effect/Brand").Brand<"SandboxInstance.ID">;
66
- create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
67
- }>;
68
- readonly driver: Schema.String;
69
- readonly operation: Schema.String;
70
- }>, import("effect/Cause").YieldableError>;
71
- declare class SandboxUnsupportedError extends SandboxUnsupportedError_base {}
72
- declare const SandboxTransitionConflictError_base: Schema.Class<SandboxTransitionConflictError, Schema.TaggedStruct<"SandboxTransitionConflictError", {
73
- readonly id: Schema.brand<Schema.String, "SandboxInstance.ID"> & {
74
- local: string & import("effect/Brand").Brand<"SandboxInstance.ID">;
75
- create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
76
- };
77
- readonly expected: Schema.$Array<Schema.Literals<readonly ["provisioning", "online", "offline", "suspending", "removing", "removed", "unavail", "faulted"]>>;
78
- readonly actual: Schema.Literals<readonly ["provisioning", "online", "offline", "suspending", "removing", "removed", "unavail", "faulted"]>;
79
- }>, import("effect/Cause").YieldableError>;
80
- declare class SandboxTransitionConflictError extends SandboxTransitionConflictError_base {}
81
- declare const SandboxProviderError_base: Schema.Class<SandboxProviderError, Schema.TaggedStruct<"SandboxProviderError", {
82
- readonly driver: Schema.String;
83
- readonly operation: Schema.String;
84
- readonly sanitized: Schema.Struct<{
85
- readonly name: Schema.String;
86
- readonly message: Schema.String;
87
- readonly code: Schema.optional<Schema.String>;
88
- }>;
89
- }>, import("effect/Cause").YieldableError>;
90
- /**
91
- * A lifecycle failure safe to serialize, persist, or log.
92
- *
93
- * The raw SDK defect is deliberately absent from the schema. It is retained on
94
- * a non-enumerable symbol by {@link providerError}, so Effect's default
95
- * formatting and JSON serialization cannot expose credentials nested in it.
96
- */
97
- declare class SandboxProviderError extends SandboxProviderError_base {}
98
- declare const providerErrorCause: (error: SandboxProviderError) => unknown;
99
- declare const providerErrorIsNotFound: (error: SandboxProviderError) => boolean;
100
- type Redactor = (value: string) => string;
101
- /**
102
- * Conservative text redaction shared by every driver sanitizer.
103
- *
104
- * Disclaimer: This can really leak. Its never safe
105
- *
106
- * Configured secrets are removed exactly. Common authorization/header and URL
107
- * query shapes are masked as a second line of defence for values the caller did
108
- * not explicitly seed.
109
- *
110
- * Note: add support for diff regex as needed.
111
- */
112
- declare const makeRedactor: (secrets?: Iterable<string>) => Redactor;
113
- declare const sanitizeError: (cause: unknown, redact?: Redactor) => PersistedError;
114
- declare const providerError: (input: {
115
- readonly driver: string;
116
- readonly operation: string;
117
- readonly cause: unknown;
118
- readonly redact?: Redactor;
119
- readonly sanitize?: (cause: unknown, redact: Redactor) => PersistedError;
120
- readonly notFound?: boolean;
121
- }) => SandboxProviderError;
122
- type SandboxMountError = SandboxNotFoundError | SandboxDriverNotRegisteredError | SandboxUnavailError | SandboxRemovedError | SandboxProviderError;
123
- type SandboxCreateError = SandboxDriverNotRegisteredError | SandboxDriverRegistrationError | SandboxProviderError;
124
- type SandboxRegisterError = SandboxDriverNotRegisteredError | SandboxDriverRegistrationError | SandboxUnsupportedError | SandboxProviderError;
125
- type SandboxReadError = never;
126
- type SandboxRefreshError = SandboxNotFoundError | SandboxDriverNotRegisteredError | SandboxUnavailError | SandboxUnsupportedError | SandboxProviderError;
127
- type SandboxWakeError = SandboxRefreshError | SandboxRemovedError;
128
- type SandboxStopError = SandboxWakeError | SandboxBusyError | SandboxTransitionConflictError;
129
- type SandboxDestroyError = SandboxStopError | SandboxMustBeStoppedError;
130
2
  declare namespace filesystem_d_exports {
131
- export { FileStat, FileSystemError, Interface, OperationUnsupportedError, Provider, RmOptions, filesystem_d_exports as SandboxFileSystem, Service$1 as Service, fromProvider, isNotFoundError, validateRmOptions, withCwd };
3
+ export { FileStat, FileSystemError, Interface, OperationUnsupportedError, Provider, RmOptions, filesystem_d_exports as SandboxFileSystem, Service$1 as Service, fromProvider, isNotFoundError, realpathScripts, validateRmOptions, withCwd };
132
4
  }
133
5
  declare const OperationUnsupportedError_base: Schema.Class<OperationUnsupportedError, Schema.TaggedStruct<"OperationUnsupportedError", {
134
6
  readonly operation: Schema.String;
@@ -184,6 +56,13 @@ interface RmOptions {
184
56
  }
185
57
  /** Whether a provider failure means the path itself is definitively absent. */
186
58
  declare const isNotFoundError: (cause: unknown) => boolean;
59
+ /**
60
+ * Shell forms of `realpath` for backends that only expose a process API.
61
+ * `pwd -P` is the portable primitive: directories resolve directly, anything
62
+ * else resolves its parent and keeps the final name as given. Run as
63
+ * `sh -c <script> _ <path>`; try the first, fall back to the second.
64
+ */
65
+ declare const realpathScripts: readonly ['cd -- "$1" && pwd -P', 'cd -- "$(dirname -- "$1")" && printf \'%s/%s\' "$(pwd -P)" "$(basename -- "$1")"'];
187
66
  /**
188
67
  * The backend-facing contract. Backends author plain promises and let them
189
68
  * reject; {@link fromProvider} turns rejections into typed failures.
@@ -203,6 +82,8 @@ interface Provider {
203
82
  recursive?: boolean;
204
83
  }) => Promise<void>;
205
84
  readonly rm: (path: string, options?: RmOptions) => Promise<void>;
85
+ /** Canonical absolute path with symlinks resolved; rejects when the path does not exist. */
86
+ readonly realpath: (path: string) => Promise<string>;
206
87
  /**
207
88
  * Metadata for the directory entry itself rather than a symlink's target.
208
89
  * Optional: a backend whose `stat` has mixed symlink semantics implements it
@@ -228,6 +109,8 @@ interface Interface {
228
109
  recursive?: boolean;
229
110
  }) => Effect.Effect<void, FileSystemError>;
230
111
  readonly rm: (path: string, options?: RmOptions) => Effect.Effect<void, FileSystemError | OperationUnsupportedError>;
112
+ /** Canonical absolute path with symlinks resolved; fails when the path does not exist. */
113
+ readonly realpath: (path: string) => Effect.Effect<string, FileSystemError>;
231
114
  readonly lstat?: (path: string) => Effect.Effect<FileStat, FileSystemError>;
232
115
  }
233
116
  declare const Service_base$1: Context.ServiceClass<Service$1, "@codeworksh/harness/sandbox/fs/filesystem/Service", Interface>;
@@ -285,7 +168,7 @@ interface ShellOptions {
285
168
  /**
286
169
  * A streamed chunk of command output, terminated by a single `exit` carrying the
287
170
  * exit code. (A backend-level mirror of the tool layer's event; kept here so
288
- * `sandbox/` does not depend on `tools/`.)
171
+ * `sandbox/` does not depend on `tool/`.)
289
172
  */
290
173
  type ExecChunk = {
291
174
  readonly _tag: "stdout";
@@ -342,8 +225,141 @@ declare const fromExec: (backend: Omit<ISandboxExe, "execArgv">) => ISandboxExe;
342
225
  declare const Shell_base: Context.ServiceClass<Shell$1, "@codeworksh/harness/sandbox/shell/shell", ISandboxExe>;
343
226
  /** Execution service — the live {@link ISandboxExe} for the active sandbox. */
344
227
  declare class Shell$1 extends Shell_base {}
345
- //#endregion
346
- //#region src/sandbox/io.d.ts
228
+ declare namespace errors_d_exports {
229
+ export { Redactor, SandboxBusyError, SandboxCreateError, SandboxDestroyError, SandboxDriverLoadError, SandboxDriverLoadPhase, SandboxDriverNotRegisteredError, SandboxDriverRegistrationError, errors_d_exports as SandboxError, SandboxMountError, SandboxMustBeStoppedError, SandboxNotFoundError, SandboxProviderError, SandboxReadError, SandboxRefreshError, SandboxRegisterError, SandboxRemovedError, SandboxStopError, SandboxTransitionConflictError, SandboxUnavailError, SandboxUnsupportedError, SandboxWakeError, makeRedactor, providerError, providerErrorCause, providerErrorIsNotFound, sanitizeError };
230
+ }
231
+ declare const SandboxNotFoundError_base: Schema.Class<SandboxNotFoundError, Schema.TaggedStruct<"SandboxNotFoundError", {
232
+ readonly id: Schema.brand<Schema.String, "SandboxInstance.ID"> & {
233
+ local: string & import("effect/Brand").Brand<"SandboxInstance.ID">;
234
+ create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
235
+ };
236
+ }>, import("effect/Cause").YieldableError>;
237
+ /**
238
+ * Lifecycle errors are confined to the control plane. Once a mount succeeds,
239
+ * consumers continue to see only FileSystemError and ShellError.
240
+ */
241
+ declare class SandboxNotFoundError extends SandboxNotFoundError_base {}
242
+ declare const SandboxDriverNotRegisteredError_base: Schema.Class<SandboxDriverNotRegisteredError, Schema.TaggedStruct<"SandboxDriverNotRegisteredError", {
243
+ readonly driver: Schema.String;
244
+ readonly registered: Schema.optional<Schema.$Array<Schema.String>>;
245
+ }>, import("effect/Cause").YieldableError>;
246
+ declare class SandboxDriverNotRegisteredError extends SandboxDriverNotRegisteredError_base {}
247
+ declare const SandboxDriverRegistrationError_base: Schema.Class<SandboxDriverRegistrationError, Schema.TaggedStruct<"SandboxDriverRegistrationError", {
248
+ readonly driver: Schema.String;
249
+ readonly reason: Schema.String;
250
+ }>, import("effect/Cause").YieldableError>;
251
+ declare class SandboxDriverRegistrationError extends SandboxDriverRegistrationError_base {}
252
+ declare const SandboxDriverLoadPhase: Schema.Literals<readonly ["resolve", "import", "module", "api-version", "options", "factory", "registration"]>;
253
+ type SandboxDriverLoadPhase = typeof SandboxDriverLoadPhase.Type;
254
+ declare const SandboxDriverLoadError_base: Schema.Class<SandboxDriverLoadError, Schema.TaggedStruct<"SandboxDriverLoadError", {
255
+ readonly specifier: Schema.String;
256
+ readonly phase: Schema.Literals<readonly ["resolve", "import", "module", "api-version", "options", "factory", "registration"]>;
257
+ readonly driver: Schema.optional<Schema.String>;
258
+ readonly reason: Schema.String;
259
+ }>, import("effect/Cause").YieldableError>;
260
+ declare class SandboxDriverLoadError extends SandboxDriverLoadError_base {}
261
+ declare const SandboxBusyError_base: Schema.Class<SandboxBusyError, Schema.TaggedStruct<"SandboxBusyError", {
262
+ readonly id: Schema.brand<Schema.String, "SandboxInstance.ID"> & {
263
+ local: string & import("effect/Brand").Brand<"SandboxInstance.ID">;
264
+ create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
265
+ };
266
+ readonly refCount: Schema.Int;
267
+ }>, import("effect/Cause").YieldableError>;
268
+ declare class SandboxBusyError extends SandboxBusyError_base {}
269
+ declare const SandboxMustBeStoppedError_base: Schema.Class<SandboxMustBeStoppedError, Schema.TaggedStruct<"SandboxMustBeStoppedError", {
270
+ readonly id: Schema.brand<Schema.String, "SandboxInstance.ID"> & {
271
+ local: string & import("effect/Brand").Brand<"SandboxInstance.ID">;
272
+ create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
273
+ };
274
+ readonly status: Schema.Literals<readonly ["provisioning", "online", "offline", "suspending", "removing", "removed", "unavail", "faulted"]>;
275
+ }>, import("effect/Cause").YieldableError>;
276
+ declare class SandboxMustBeStoppedError extends SandboxMustBeStoppedError_base {}
277
+ declare const SandboxRemovedError_base: Schema.Class<SandboxRemovedError, Schema.TaggedStruct<"SandboxRemovedError", {
278
+ readonly id: Schema.brand<Schema.String, "SandboxInstance.ID"> & {
279
+ local: string & import("effect/Brand").Brand<"SandboxInstance.ID">;
280
+ create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
281
+ };
282
+ readonly removedAt: Schema.optional<Schema.DateTimeUtc>;
283
+ }>, import("effect/Cause").YieldableError>;
284
+ declare class SandboxRemovedError extends SandboxRemovedError_base {}
285
+ declare const SandboxUnavailError_base: Schema.Class<SandboxUnavailError, Schema.TaggedStruct<"SandboxUnavailError", {
286
+ readonly id: Schema.brand<Schema.String, "SandboxInstance.ID"> & {
287
+ local: string & import("effect/Brand").Brand<"SandboxInstance.ID">;
288
+ create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
289
+ };
290
+ readonly reason: Schema.String;
291
+ }>, import("effect/Cause").YieldableError>;
292
+ declare class SandboxUnavailError extends SandboxUnavailError_base {}
293
+ declare const SandboxUnsupportedError_base: Schema.Class<SandboxUnsupportedError, Schema.TaggedStruct<"SandboxUnsupportedError", {
294
+ readonly id: Schema.optional<Schema.brand<Schema.String, "SandboxInstance.ID"> & {
295
+ local: string & import("effect/Brand").Brand<"SandboxInstance.ID">;
296
+ create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
297
+ }>;
298
+ readonly driver: Schema.String;
299
+ readonly operation: Schema.String;
300
+ }>, import("effect/Cause").YieldableError>;
301
+ declare class SandboxUnsupportedError extends SandboxUnsupportedError_base {}
302
+ declare const SandboxTransitionConflictError_base: Schema.Class<SandboxTransitionConflictError, Schema.TaggedStruct<"SandboxTransitionConflictError", {
303
+ readonly id: Schema.brand<Schema.String, "SandboxInstance.ID"> & {
304
+ local: string & import("effect/Brand").Brand<"SandboxInstance.ID">;
305
+ create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
306
+ };
307
+ readonly expected: Schema.$Array<Schema.Literals<readonly ["provisioning", "online", "offline", "suspending", "removing", "removed", "unavail", "faulted"]>>;
308
+ readonly actual: Schema.Literals<readonly ["provisioning", "online", "offline", "suspending", "removing", "removed", "unavail", "faulted"]>;
309
+ }>, import("effect/Cause").YieldableError>;
310
+ declare class SandboxTransitionConflictError extends SandboxTransitionConflictError_base {}
311
+ declare const SandboxProviderError_base: Schema.Class<SandboxProviderError, Schema.TaggedStruct<"SandboxProviderError", {
312
+ readonly driver: Schema.String;
313
+ readonly operation: Schema.String;
314
+ readonly sanitized: Schema.Struct<{
315
+ readonly name: Schema.String;
316
+ readonly message: Schema.String;
317
+ readonly code: Schema.optional<Schema.String>;
318
+ }>;
319
+ }>, import("effect/Cause").YieldableError>;
320
+ /**
321
+ * A lifecycle failure safe to serialize, persist, or log.
322
+ *
323
+ * The raw SDK defect is deliberately absent from the schema. It is retained on
324
+ * a non-enumerable symbol by {@link providerError}, so Effect's default
325
+ * formatting and JSON serialization cannot expose credentials nested in it.
326
+ */
327
+ declare class SandboxProviderError extends SandboxProviderError_base {}
328
+ declare const providerErrorCause: (error: SandboxProviderError) => unknown;
329
+ declare const providerErrorIsNotFound: (error: SandboxProviderError) => boolean;
330
+ type Redactor = (value: string) => string;
331
+ /**
332
+ * Conservative text redaction shared by every driver sanitizer.
333
+ *
334
+ * Disclaimer: This can really leak. Its never safe
335
+ *
336
+ * Configured secrets are removed exactly. Common authorization/header and URL
337
+ * query shapes are masked as a second line of defence for values the caller did
338
+ * not explicitly seed.
339
+ *
340
+ * Note: add support for diff regex as needed.
341
+ */
342
+ declare const makeRedactor: (secrets?: Iterable<string>) => Redactor;
343
+ declare const sanitizeError: (cause: unknown, redact?: Redactor) => PersistedError;
344
+ declare const providerError: (input: {
345
+ readonly driver: string;
346
+ readonly operation: string;
347
+ readonly cause: unknown;
348
+ readonly redact?: Redactor;
349
+ readonly sanitize?: (cause: unknown, redact: Redactor) => PersistedError;
350
+ readonly notFound?: boolean;
351
+ }) => SandboxProviderError;
352
+ type SandboxMountError = SandboxNotFoundError | SandboxDriverNotRegisteredError | SandboxUnavailError | SandboxRemovedError | SandboxProviderError;
353
+ type SandboxCreateError = SandboxDriverNotRegisteredError | SandboxDriverRegistrationError | SandboxProviderError;
354
+ type SandboxRegisterError = SandboxDriverNotRegisteredError | SandboxDriverRegistrationError | SandboxUnsupportedError | SandboxProviderError;
355
+ type SandboxReadError = never;
356
+ type SandboxRefreshError = SandboxNotFoundError | SandboxDriverNotRegisteredError | SandboxUnavailError | SandboxUnsupportedError | SandboxProviderError;
357
+ type SandboxWakeError = SandboxRefreshError | SandboxRemovedError;
358
+ type SandboxStopError = SandboxWakeError | SandboxBusyError | SandboxTransitionConflictError;
359
+ type SandboxDestroyError = SandboxStopError | SandboxMustBeStoppedError;
360
+ declare namespace io_d_exports$1 {
361
+ export { Current, FileSystem$1 as FileSystem, Identity, Layer$1 as Layer, Provides, io_d_exports$1 as SandboxIO, Shell, host, hostLayer, identityLayer, mount, remote, resolveMountCwd, virtual };
362
+ }
347
363
  /**
348
364
  * `SandboxIO` is a **mount**: a filesystem, a shell, and the identity and
349
365
  * working directory they act on.
@@ -394,8 +410,79 @@ declare class Current extends Current_base {}
394
410
  type Provides = Current | Service$1 | Shell$1;
395
411
  /** A built mount. */
396
412
  type Layer$1<E = never, RIn = never> = Layer.Layer<Provides, E, RIn>;
397
- //#endregion
398
- //#region src/sandbox/driver.d.ts
413
+ /**
414
+ * Resolve a mount's cwd without consulting ambient process state.
415
+ *
416
+ * The default is supplied by the namespace adapter:
417
+ * provider metadata remotely, `/` for a virtual filesystem, and `process.cwd()` for the host adapter.
418
+ * An explicit absolute cwd replaces it; a relative cwd is resolved inside it. The
419
+ * result is therefore always the one concrete absolute path `Current` requires.
420
+ *
421
+ * A non-absolute default throws rather than failing typed. It is the one
422
+ * defect-level guard in this module, and deliberately so:
423
+ * Adapters reading a value from a provider call this inside their own error channel,
424
+ * where the throw becomes their typed failure (see `EnvDaytona.mountCwd`).
425
+ */
426
+ declare const resolveMountCwd: (defaultCwd: string, cwd?: string) => string;
427
+ /**
428
+ * Bind a cwd-neutral transport to one mount.
429
+ *
430
+ * The transport underneath is shared between
431
+ * mounts and stays rooted at the namespace root, and everything directory-shaped
432
+ * happens here, once per mount. Two mounts of one namespace at different working
433
+ * directories therefore coexist without seeing or moving each other's.
434
+ *
435
+ * It consumes the same two tags it provides — the transport is supplied by the
436
+ * layer this is composed over, not by itself.
437
+ */
438
+ declare const mount: (identity: Identity) => Layer.Layer<Provides, never, Service$1 | Shell$1>;
439
+ /**
440
+ * Just the identity tag, with no filesystem or shell beneath it. For consumers
441
+ * assembled from stubs — a test that runs `Project` over a fake filesystem still
442
+ * needs to know which namespace it is in.
443
+ */
444
+ declare const identityLayer: (identity: Identity) => Layer.Layer<Current, never, never>;
445
+ /** The host identity alone. See {@link identityLayer}. */
446
+ declare const hostLayer: (cwd?: string) => Layer.Layer<Current, never, never>;
447
+ /**
448
+ * The host, rooted at `cwd`. Always `SandboxInstance.ID.local`: the working
449
+ * directory selects where relative paths resolve, it does not make a second host
450
+ * namespace — two mounts rooted at different directories still agree on absolute
451
+ * paths.
452
+ *
453
+ * The host adapter defaults to `process.cwd()`, matching the OS process it wraps.
454
+ * This is the one namespace where that coordinate is intrinsically valid; remote
455
+ * and virtual adapters must never inherit it.
456
+ */
457
+ declare const host: (cwd?: string) => Identity;
458
+ /**
459
+ * A VFS-backed namespace. The id is minted per call unless one is named, because
460
+ * building one of these builds a fresh VFS: N unnamed calls are N distinct
461
+ * namespaces, none of which outlives the process. A file-backed store is the
462
+ * exception — its file is the state, so whoever knows the file supplies the id
463
+ * it was registered under.
464
+ */
465
+ declare const virtual: (input: {
466
+ readonly driver: string;
467
+ readonly id?: ID;
468
+ readonly defaultCwd?: string;
469
+ readonly cwd?: string;
470
+ }) => Identity;
471
+ /**
472
+ * A provider-hosted namespace. The id is always supplied: a remote resource's
473
+ * durable identity is minted and recorded by whoever provisioned it, never
474
+ * derived here from the provider's own locator.
475
+ */
476
+ declare const remote: (input: {
477
+ readonly driver: string;
478
+ readonly id: ID;
479
+ /** Namespace-intrinsic default supplied or discovered by the driver. */
480
+ readonly defaultCwd: string;
481
+ readonly cwd?: string;
482
+ }) => Identity;
483
+ declare namespace driver_d_exports$1 {
484
+ export { AbsolutePath, ApiVersion, Capabilities, Definition, Driver, Module, ModuleDefinition, Name, Observed, Provisioned, Registered, Registration, RuntimeConfigBase, RuntimeInput, driver_d_exports$1 as SandboxDriver, Source, apiVersion, driver, erase, defineModule as module, withSource };
485
+ }
399
486
  /** Version of the loadable sandbox-driver module ABI. */
400
487
  declare const apiVersion: 1;
401
488
  type ApiVersion = typeof apiVersion;
@@ -475,6 +562,7 @@ interface Registered {
475
562
  readonly stop?: (input: RuntimeInput<RuntimeConfigBase>) => Effect.Effect<Observed, SandboxProviderError>;
476
563
  readonly destroy?: (input: RuntimeInput<RuntimeConfigBase>) => Effect.Effect<void, SandboxProviderError>;
477
564
  }
565
+ declare const erase: <CreateConfig, RuntimeConfig extends RuntimeConfigBase>(value: Driver<CreateConfig, RuntimeConfig>) => Registered;
478
566
  type Source = "core" | "builtin" | "package" | "file";
479
567
  interface Registration {
480
568
  readonly registered: Registered;
@@ -497,6 +585,8 @@ interface ModuleDefinition<Options> {
497
585
  declare const defineModule: <Options>(value: ModuleDefinition<Options>) => Module<Options>;
498
586
  /** Construct a driver and its registry contribution. */
499
587
  declare const driver: <CreateConfig, RuntimeConfig extends RuntimeConfigBase>(value: Driver<CreateConfig, RuntimeConfig>) => Driver<CreateConfig, RuntimeConfig> & Registration;
588
+ /** Attach trusted origin metadata without changing the driver implementation. */
589
+ declare const withSource: (registration: Registration, source: Source) => Registration;
500
590
  declare namespace instance_d_exports {
501
591
  export { ID, Info, Kind, Ownership, PersistedError, instance_d_exports as SandboxInstance, Status, Usage, fromColumn, fromField, isMountable, mountable, toColumn, toField };
502
592
  }
@@ -664,5 +754,5 @@ declare namespace shell_d_exports {
664
754
  export { ExecChunk, ExecResult, ISandboxExe, Shell$1 as Shell, ShellError, ShellOptions, fromExec, quote, quoteArgv };
665
755
  }
666
756
  //#endregion
667
- export { SandboxDriverNotRegisteredError as A, Layer$1 as C, SandboxCreateError as D, filesystem_d_exports as E, SandboxRegisterError as F, SandboxStopError as I, SandboxWakeError as L, SandboxMountError as M, SandboxReadError as N, SandboxDestroyError as O, SandboxRefreshError as P, Identity as S, FileSystemError as T, Name as _, driver_d_exports as a, RuntimeConfigBase as b, Status as c, AbsolutePath as d, ApiVersion as f, Module as g, Driver as h, io_d_exports as i, SandboxDriverRegistrationError as j, SandboxDriverLoadError as k, Usage as l, Definition as m, resource_d_exports as n, ID as o, Capabilities as p, error_d_exports as r, Info as s, shell_d_exports as t, instance_d_exports as u, Registered as v, Provides as w, Source as x, Registration as y };
668
- //# sourceMappingURL=sandbox-DnL9UPzZ.d.mts.map
757
+ export { SandboxDriverLoadError as A, errors_d_exports as B, Current as C, io_d_exports$1 as D, Provides as E, SandboxReadError as F, FileSystemError as H, SandboxRefreshError as I, SandboxRegisterError as L, SandboxDriverRegistrationError as M, SandboxMountError as N, SandboxCreateError as O, SandboxNotFoundError as P, SandboxStopError as R, driver_d_exports$1 as S, Layer$1 as T, Service$1 as U, Shell$1 as V, filesystem_d_exports as W, Name as _, driver_d_exports as a, RuntimeConfigBase as b, Status as c, AbsolutePath as d, ApiVersion as f, Module as g, Driver as h, io_d_exports as i, SandboxDriverNotRegisteredError as j, SandboxDestroyError as k, Usage as l, Definition as m, resource_d_exports as n, ID as o, Capabilities as p, error_d_exports as r, Info as s, shell_d_exports as t, instance_d_exports as u, Registered as v, Identity as w, Source as x, Registration as y, SandboxWakeError as z };
758
+ //# sourceMappingURL=sandbox-DX9mliQs.d.mts.map
@@ -1,5 +1,5 @@
1
- import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
- import { Context, DateTime, Effect, Option, Path, Schema, SchemaGetter } from "effect";
1
+ import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
+ import { Context, DateTime, Effect, Layer, Option, Path, Schema, SchemaGetter } from "effect";
3
3
  import { uuidv7 } from "uuidv7";
4
4
  import { Message } from "@codeworksh/aikit";
5
5
  import TypeBoxSchema from "typebox/schema";
@@ -40,7 +40,6 @@ const NonNegativeInt = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));
40
40
  * Cost greater than or equal with finite value
41
41
  */
42
42
  const NonNegativeCost = Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0));
43
- Schema.String.pipe(Schema.brand("RelativePath"));
44
43
  /**
45
44
  * Absolute file path (e.g., `/home/user/projects/myapp/src/main.ts`).
46
45
  */
@@ -49,7 +48,7 @@ const AbsolutePath$1 = Schema.String.pipe(Schema.brand("AbsolutePath"));
49
48
  * Optional public JSON field that can hold explicit `undefined` on the type
50
49
  * side but encodes it as an omitted key, matching legacy `JSON.stringify`.
51
50
  */
52
- const optional = (schema) => Schema.optionalKey(schema).pipe(Schema.decodeTo(Schema.optional(schema), {
51
+ const optional = (schema) => Schema.optionalKey(schema).pipe(Schema.decodeTo(Schema.optional(Schema.toType(schema)), {
53
52
  decode: SchemaGetter.passthrough({ strict: false }),
54
53
  encode: SchemaGetter.transformOptional(Option.filter((value) => value !== void 0))
55
54
  }));
@@ -219,6 +218,7 @@ var filesystem_exports = /* @__PURE__ */ __exportAll({
219
218
  Service: () => Service$1,
220
219
  fromProvider: () => fromProvider,
221
220
  isNotFoundError: () => isNotFoundError,
221
+ realpathScripts: () => realpathScripts,
222
222
  validateRmOptions: () => validateRmOptions,
223
223
  withCwd: () => withCwd$1
224
224
  });
@@ -266,6 +266,13 @@ const isNotFoundError = (cause) => {
266
266
  const code = cause?.code;
267
267
  return code === "ENOENT" || code === "ENOTDIR";
268
268
  };
269
+ /**
270
+ * Shell forms of `realpath` for backends that only expose a process API.
271
+ * `pwd -P` is the portable primitive: directories resolve directly, anything
272
+ * else resolves its parent and keeps the final name as given. Run as
273
+ * `sh -c <script> _ <path>`; try the first, fall back to the second.
274
+ */
275
+ const realpathScripts = ["cd -- \"$1\" && pwd -P", "cd -- \"$(dirname -- \"$1\")\" && printf '%s/%s' \"$(pwd -P)\" \"$(basename -- \"$1\")\""];
269
276
  /** The runtime filesystem service — the live {@link Interface} for the active sandbox. */
270
277
  var Service$1 = class extends Context.Service()("@codeworksh/harness/sandbox/fs/filesystem/Service") {};
271
278
  /**
@@ -311,7 +318,8 @@ const fromProvider = (provider) => {
311
318
  readdir: Effect.fn("SandboxFileSystem.readdir")((path) => attempt("readdir", path, () => provider.readdir(path))),
312
319
  exists: Effect.fn("SandboxFileSystem.exists")((path) => attempt("exists", path, () => provider.exists(path))),
313
320
  mkdir: Effect.fn("SandboxFileSystem.mkdir")((path, options) => attempt("mkdir", path, () => provider.mkdir(path, options))),
314
- rm: Effect.fn("SandboxFileSystem.rm")((path, options) => validateRmOptions(options).pipe(Effect.andThen(attempt("rm", path, () => provider.rm(path, options)))))
321
+ rm: Effect.fn("SandboxFileSystem.rm")((path, options) => validateRmOptions(options).pipe(Effect.andThen(attempt("rm", path, () => provider.rm(path, options))))),
322
+ realpath: Effect.fn("SandboxFileSystem.realpath")((path) => attempt("realpath", path, () => provider.realpath(path)))
315
323
  };
316
324
  };
317
325
  /**
@@ -333,6 +341,7 @@ const withCwd$1 = (fs, cwd) => {
333
341
  exists: (path) => fs.exists(at(path)),
334
342
  mkdir: (path, options) => fs.mkdir(at(path), options),
335
343
  rm: (path, options) => fs.rm(at(path), options),
344
+ realpath: (path) => fs.realpath(at(path)),
336
345
  ...fs.lstat === void 0 ? {} : { lstat: (path) => fs.lstat(at(path)) }
337
346
  };
338
347
  };
@@ -470,6 +479,34 @@ const resolveMountCwd = (defaultCwd, cwd) => {
470
479
  if (cwd === void 0) return posix.resolve(defaultCwd);
471
480
  return posix.isAbsolute(cwd) ? posix.resolve(cwd) : posix.resolve(defaultCwd, cwd);
472
481
  };
482
+ /**
483
+ * Bind a cwd-neutral transport to one mount.
484
+ *
485
+ * The transport underneath is shared between
486
+ * mounts and stays rooted at the namespace root, and everything directory-shaped
487
+ * happens here, once per mount. Two mounts of one namespace at different working
488
+ * directories therefore coexist without seeing or moving each other's.
489
+ *
490
+ * It consumes the same two tags it provides — the transport is supplied by the
491
+ * layer this is composed over, not by itself.
492
+ */
493
+ const mount = (identity) => Layer.mergeAll(Layer.succeed(Current, identity), Layer.effect(Service$1, Effect.map(Service$1, (fs) => withCwd$1(fs, identity.cwd))), Layer.effect(Shell$1, Effect.map(Shell$1, (shell) => withCwd(shell, identity.cwd))));
494
+ /**
495
+ * The host, rooted at `cwd`. Always `SandboxInstance.ID.local`: the working
496
+ * directory selects where relative paths resolve, it does not make a second host
497
+ * namespace — two mounts rooted at different directories still agree on absolute
498
+ * paths.
499
+ *
500
+ * The host adapter defaults to `process.cwd()`, matching the OS process it wraps.
501
+ * This is the one namespace where that coordinate is intrinsically valid; remote
502
+ * and virtual adapters must never inherit it.
503
+ */
504
+ const host = (cwd) => ({
505
+ id: ID.local,
506
+ driver: "local",
507
+ kind: "local",
508
+ cwd: resolveMountCwd(process.cwd(), cwd)
509
+ });
473
510
  /** Open driver identity. Adding a driver never extends a union in core. */
474
511
  const Name = Schema.String.check(Schema.isNonEmpty()).pipe(Schema.brand("SandboxDriver.Name"));
475
512
  /** A path whose coordinate system is the mounted namespace. */
@@ -513,6 +550,26 @@ const withSource = (registration, source) => ({
513
550
  });
514
551
  //#endregion
515
552
  //#region src/sandbox/errors.ts
553
+ var errors_exports = /* @__PURE__ */ __exportAll({
554
+ SandboxBusyError: () => SandboxBusyError,
555
+ SandboxDriverLoadError: () => SandboxDriverLoadError,
556
+ SandboxDriverLoadPhase: () => SandboxDriverLoadPhase,
557
+ SandboxDriverNotRegisteredError: () => SandboxDriverNotRegisteredError,
558
+ SandboxDriverRegistrationError: () => SandboxDriverRegistrationError,
559
+ SandboxError: () => errors_exports,
560
+ SandboxMustBeStoppedError: () => SandboxMustBeStoppedError,
561
+ SandboxNotFoundError: () => SandboxNotFoundError,
562
+ SandboxProviderError: () => SandboxProviderError,
563
+ SandboxRemovedError: () => SandboxRemovedError,
564
+ SandboxTransitionConflictError: () => SandboxTransitionConflictError,
565
+ SandboxUnavailError: () => SandboxUnavailError,
566
+ SandboxUnsupportedError: () => SandboxUnsupportedError,
567
+ makeRedactor: () => makeRedactor,
568
+ providerError: () => providerError,
569
+ providerErrorCause: () => providerErrorCause,
570
+ providerErrorIsNotFound: () => providerErrorIsNotFound,
571
+ sanitizeError: () => sanitizeError
572
+ });
516
573
  /**
517
574
  * Lifecycle errors are confined to the control plane. Once a mount succeeds,
518
575
  * consumers continue to see only FileSystemError and ShellError.
@@ -708,6 +765,6 @@ var shell_exports = /* @__PURE__ */ __exportAll({
708
765
  quoteArgv: () => quoteArgv
709
766
  });
710
767
  //#endregion
711
- export { isMountable as $, FileSystem$1 as A, withCwd as B, Name as C, erase as D, driver as E, fromExec as F, withCwd$1 as G, filesystem_exports as H, perMount as I, Ownership as J, ID as K, quote as L, resolveMountCwd as M, Shell$1 as N, withSource as O, ShellError as P, instance_exports as Q, quoteArgv as R, AbsolutePath as S, defineModule as T, fromProvider as U, Service$1 as V, isNotFoundError as W, Status as X, PersistedError as Y, fromField as Z, SandboxUnsupportedError as _, io_exports as a, NonNegativeCost as at, providerErrorIsNotFound as b, SandboxDriverLoadError as c, isAikitToolCallTerminalPart as ct, SandboxMustBeStoppedError as d, validateAikitMessage as dt, toColumn as et, SandboxNotFoundError as f, validateAikitToolCallTerminalPart as ft, SandboxUnavailError as g, SandboxTransitionConflictError as h, error_exports as i, DateTimeUtcFromMillis as it, Shell as j, Current as k, SandboxDriverNotRegisteredError as l, optional as lt, SandboxRemovedError as m, withStatics as mt, Service as n, posix as nt, driver_exports as o, NonNegativeInt as ot, SandboxProviderError as p, validateAikitUserMessage as pt, Kind as q, resource_exports as r, AbsolutePath$1 as rt, SandboxBusyError as s, isAikitAssistantMessage as st, shell_exports as t, toField as tt, SandboxDriverRegistrationError as u, validateAikitAssistantMessage as ut, makeRedactor as v, RuntimeConfigBase as w, sanitizeError as x, providerError as y, resolveCwd as z };
768
+ export { PersistedError as $, Current as A, quote as B, AbsolutePath as C, driver as D, defineModule as E, resolveMountCwd as F, filesystem_exports as G, resolveCwd as H, Shell$1 as I, realpathScripts as J, fromProvider as K, ShellError as L, Shell as M, host as N, erase as O, mount as P, Ownership as Q, fromExec as R, sanitizeError as S, RuntimeConfigBase as T, withCwd as U, quoteArgv as V, Service$1 as W, ID as X, withCwd$1 as Y, Kind as Z, SandboxUnsupportedError as _, validateAikitUserMessage as _t, io_exports as a, toField as at, providerError as b, SandboxDriverLoadError as c, DateTimeUtcFromMillis as ct, SandboxMustBeStoppedError as d, isAikitAssistantMessage as dt, Status as et, SandboxNotFoundError as f, isAikitToolCallTerminalPart as ft, SandboxUnavailError as g, validateAikitToolCallTerminalPart as gt, SandboxTransitionConflictError as h, validateAikitMessage as ht, error_exports as i, toColumn as it, FileSystem$1 as j, withSource as k, SandboxDriverNotRegisteredError as l, NonNegativeCost as lt, SandboxRemovedError as m, validateAikitAssistantMessage as mt, Service as n, instance_exports as nt, driver_exports as o, posix as ot, SandboxProviderError as p, optional as pt, isNotFoundError as q, resource_exports as r, isMountable as rt, SandboxBusyError as s, AbsolutePath$1 as st, shell_exports as t, fromField as tt, SandboxDriverRegistrationError as u, NonNegativeInt as ut, errors_exports as v, withStatics as vt, Name as w, providerErrorIsNotFound as x, makeRedactor as y, perMount as z };
712
769
 
713
- //# sourceMappingURL=sandbox-QCmZ3UhD.mjs.map
770
+ //# sourceMappingURL=sandbox-Dlz9cGeD.mjs.map