@tangle-network/agent-app 0.43.42 → 0.43.44

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 (39) hide show
  1. package/dist/assistant/index.d.ts +2 -1
  2. package/dist/assistant/index.js +3 -2
  3. package/dist/assistant/index.js.map +1 -1
  4. package/dist/chat-routes/index.d.ts +152 -4
  5. package/dist/chat-routes/index.js +134 -20
  6. package/dist/chat-routes/index.js.map +1 -1
  7. package/dist/chat-store/index.d.ts +2 -2
  8. package/dist/chat-store/index.js +7 -1
  9. package/dist/chat-store/index.js.map +1 -1
  10. package/dist/{chunk-5GWXCSLQ.js → chunk-5RJNEEO2.js} +86 -5
  11. package/dist/chunk-5RJNEEO2.js.map +1 -0
  12. package/dist/chunk-6E2XJSCT.js +298 -0
  13. package/dist/chunk-6E2XJSCT.js.map +1 -0
  14. package/dist/chunk-LCNY3DCM.js +84 -0
  15. package/dist/chunk-LCNY3DCM.js.map +1 -0
  16. package/dist/{chunk-ZLHK25C3.js → chunk-Q4EU6MGU.js} +54 -6
  17. package/dist/chunk-Q4EU6MGU.js.map +1 -0
  18. package/dist/{chunk-UMSOSUEU.js → chunk-QYOD3K56.js} +2 -2
  19. package/dist/chunk-QYOD3K56.js.map +1 -0
  20. package/dist/file-index-Bn6sitKb.d.ts +114 -0
  21. package/dist/index.d.ts +2 -2
  22. package/dist/index.js +17 -3
  23. package/dist/object-store/index.d.ts +6 -4
  24. package/dist/object-store/index.js +1 -1
  25. package/dist/parts-1_3y2JmR.d.ts +368 -0
  26. package/dist/sandbox/index.d.ts +111 -2
  27. package/dist/sandbox/index.js +9 -1
  28. package/dist/web-react/index.d.ts +51 -3
  29. package/dist/web-react/index.js +13 -4
  30. package/package.json +1 -1
  31. package/dist/chunk-2EO7CPL3.js +0 -191
  32. package/dist/chunk-2EO7CPL3.js.map +0 -1
  33. package/dist/chunk-5GWXCSLQ.js.map +0 -1
  34. package/dist/chunk-I2ATYB7R.js +0 -78
  35. package/dist/chunk-I2ATYB7R.js.map +0 -1
  36. package/dist/chunk-UMSOSUEU.js.map +0 -1
  37. package/dist/chunk-ZLHK25C3.js.map +0 -1
  38. package/dist/file-index-Bw_IQE_G.d.ts +0 -194
  39. package/dist/parts-DjX0RRTS.d.ts +0 -182
@@ -32,7 +32,7 @@ function createR2ObjectStore({ bucket }) {
32
32
  function assertSafeKeySegment(s) {
33
33
  if (s.length === 0) throw new Error("object-store: empty key segment");
34
34
  if (s.includes("..")) throw new Error(`object-store: unsafe key segment (contains "..") \u2014 ${s}`);
35
- if (s.startsWith("/")) throw new Error(`object-store: unsafe key segment (leading "/") \u2014 ${s}`);
35
+ if (s.includes("/")) throw new Error(`object-store: unsafe key segment (contains "/") \u2014 ${s}`);
36
36
  if (s.includes("\\")) throw new Error(`object-store: unsafe key segment (backslash) \u2014 ${s}`);
37
37
  return s;
38
38
  }
@@ -121,4 +121,4 @@ export {
121
121
  verifyObjectUrl,
122
122
  createProxiedArtifactRoute
123
123
  };
124
- //# sourceMappingURL=chunk-UMSOSUEU.js.map
124
+ //# sourceMappingURL=chunk-QYOD3K56.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/object-store/index.ts"],"sourcesContent":["/**\n * `/object-store` — a portable, secure object store for durable large\n * attachments (uploaded PDFs, images, exports) that are too big to ride a chat\n * turn body or live in KV.\n *\n * SECURITY POSTURE (this module guards a legal privilege wall). Every object key\n * carries an operator segment and a customer segment, and access is by a\n * short-lived HMAC-signed URL whose signature covers the EXACT key (operator +\n * customer + upload id + filename) AND the expiry. A tampered key, a swapped\n * customer segment, or a replayed-after-expiry URL all fail the signature or the\n * expiry check and are refused. The signing secret is a PARAMETER on every call\n * — this module reads NOTHING global (no `process.env`, no ambient config); if a\n * product forgets to bind the secret, {@link verifyObjectUrl} fails closed and\n * {@link signObjectUrl} throws rather than minting an unsigned URL.\n *\n * PURE MECHANISM behind two seams: an {@link ObjectStore} port (the R2 impl maps\n * 1:1 to a bucket held behind the structural {@link R2LikeBucket} — so\n * `@cloudflare/workers-types` never leaks into this package's public `.d.ts`)\n * and the signing `secret`. Reads and writes STREAM: {@link createR2ObjectStore}\n * returns the R2 object's `.body` stream directly and never calls\n * `.text()`/`.arrayBuffer()`, so a 15 MB PDF flows through the worker without\n * buffering the whole file into the isolate's heap.\n *\n * RECONCILIATION with the sandbox `storage` seam (`../sandbox` →\n * `SandboxRuntimeConfig.storage`): that is BYOS3/R2 *snapshot* storage — it\n * checkpoints and restores a sandbox box's filesystem for durable session\n * execution. This is a DIFFERENT concern: a content-addressed store for\n * user-facing attachments gated by a signed-URL privilege wall. They are not\n * interchangeable and must not be merged: one persists agent runtime state, the\n * other serves per-operator/per-customer documents to browsers. Do not route\n * artifact downloads through the snapshot bucket, or vice versa.\n */\n\nimport { constantTimeEqual, hmacSha256Base64Url } from '../crypto/web-token'\n\n// ── The store port + R2 impl ────────────────────────────────────────────────\n\n/** Options for a single {@link ObjectStore.put}. Both fields are optional; a\n * store that needs a fixed content length (e.g. R2 with a `ReadableStream`\n * body) uses `contentLength` when present. */\nexport interface PutObjectOptions {\n /** MIME type recorded with the object (returned by `get`/`head`). Advisory:\n * the proxied download route always serves `application/octet-stream`. */\n contentType?: string\n /** Byte length of `body`, when known. Some backends require it for a\n * streamed body; the R2 impl passes a known length through when supplied. */\n contentLength?: number\n}\n\n/** A retrieved object. `stream()` is the ONLY way to read the bytes — there is\n * deliberately no `text()`/`arrayBuffer()`, so a large object never buffers\n * into the isolate heap. */\nexport interface ObjectBody {\n /** The object's bytes as a `ReadableStream` (backed by R2's `.body`). */\n stream(): ReadableStream\n /** Size in bytes. */\n size: number\n /** Recorded MIME type, if any. */\n contentType?: string\n}\n\n/**\n * Portable object-store port. `get`/`head` return `null` on a miss and NEVER\n * throw for a missing key (a miss is a normal control-flow outcome, not an\n * error); `delete` is idempotent.\n */\nexport interface ObjectStore {\n put(key: string, body: ReadableStream | Uint8Array, opts?: PutObjectOptions): Promise<void>\n /** `null` on a miss — never throws for a missing key. */\n get(key: string): Promise<ObjectBody | null>\n /** `null` on a miss — never throws for a missing key. */\n head(key: string): Promise<{ size: number; contentType?: string } | null>\n delete(key: string): Promise<void>\n}\n\n/** Head/metadata shape of a stored object (structural match of R2's `R2Object`). */\nexport interface R2LikeObjectHead {\n size: number\n httpMetadata?: { contentType?: string }\n}\n\n/** Body shape of a retrieved object (structural match of R2's `R2ObjectBody`).\n * `body` is the streamed content — the impl reads this, never `.text()`. */\nexport interface R2LikeObjectBody extends R2LikeObjectHead {\n body: ReadableStream\n}\n\n/**\n * The minimal slice of Cloudflare's `R2Bucket` this module calls. A real\n * `R2Bucket` satisfies it structurally, so the consumer passes its binding\n * without this package ever importing `@cloudflare/workers-types` (which would\n * otherwise leak into the public `.d.ts`).\n */\nexport interface R2LikeBucket {\n put(\n key: string,\n value: ReadableStream | Uint8Array | ArrayBuffer,\n options?: { httpMetadata?: { contentType?: string } },\n ): Promise<unknown>\n get(key: string): Promise<R2LikeObjectBody | null>\n head(key: string): Promise<R2LikeObjectHead | null>\n delete(key: string): Promise<void>\n}\n\n/**\n * Map the {@link ObjectStore} port onto an R2 bucket 1:1. `get` STREAMS: it\n * returns the R2 object's `.body` behind `ObjectBody.stream()` and never calls\n * `.text()`/`.arrayBuffer()`, so a large file flows through the worker rather\n * than buffering into the isolate.\n */\nexport function createR2ObjectStore({ bucket }: { bucket: R2LikeBucket }): ObjectStore {\n return {\n async put(key, body, opts) {\n const options = opts?.contentType ? { httpMetadata: { contentType: opts.contentType } } : undefined\n await bucket.put(key, body, options)\n },\n async get(key) {\n const obj = await bucket.get(key)\n if (!obj) return null\n return {\n stream: () => obj.body,\n size: obj.size,\n contentType: obj.httpMetadata?.contentType,\n }\n },\n async head(key) {\n const obj = await bucket.head(key)\n if (!obj) return null\n return { size: obj.size, contentType: obj.httpMetadata?.contentType }\n },\n async delete(key) {\n await bucket.delete(key)\n },\n }\n}\n\n// ── Key construction + safety ───────────────────────────────────────────────\n\n/**\n * Assert a single object-key path SEGMENT (an operator id, customer id, or\n * upload id) is safe to interpolate into a key, and return it. Throws on the\n * traversal / injection shapes: `..` anywhere, ANY `/` (a segment must be a\n * single path component — a leading, interior, or trailing slash all widen the\n * key by injecting extra levels), a backslash, or an empty segment. Consumers\n * should call this on caller-supplied identifiers BEFORE any `get`/`put` so an\n * attacker-controlled id can never widen the key beyond its own operator+\n * customer prefix.\n */\nexport function assertSafeKeySegment(s: string): string {\n if (s.length === 0) throw new Error('object-store: empty key segment')\n if (s.includes('..')) throw new Error(`object-store: unsafe key segment (contains \"..\") — ${s}`)\n // Reject ANY '/' — leading, interior, or trailing. A key segment is a single\n // path component; an interior slash (`a/b`) would silently add a key level and\n // widen the operator/customer prefix, so it is refused just like a leading one.\n if (s.includes('/')) throw new Error(`object-store: unsafe key segment (contains \"/\") — ${s}`)\n if (s.includes('\\\\')) throw new Error(`object-store: unsafe key segment (backslash) — ${s}`)\n return s\n}\n\n/** Strip a filename down to a safe leaf: drop any path, keep only\n * `[A-Za-z0-9._-]`, and remove leading dots so a `..`/`.hidden`/dot-only name\n * can neither traverse nor vanish. Never returns an empty string. */\nfunction sanitizeFilename(filename: string): string {\n const leaf = filename.split(/[/\\\\]/).pop() ?? ''\n const cleaned = leaf.replace(/[^A-Za-z0-9._-]/g, '_').replace(/^\\.+/, '')\n return cleaned.length > 0 ? cleaned : 'file'\n}\n\n/** Inputs to {@link objectKey}. `customerId` is optional — an unattributed\n * upload lands under the reserved `_unattributed` customer segment. */\nexport interface ObjectKeyParts {\n operatorId: string\n /** Optional — omitted/undefined groups the upload under `_unattributed`. */\n customerId?: string\n uploadId: string\n filename: string\n}\n\n/**\n * Build the canonical object key: `operator/customer/upload-filename`. The\n * operator, customer, and upload segments are asserted safe (throwing on\n * traversal); the filename is sanitized to a safe leaf. The customer segment\n * falls back to `_unattributed` when no customer is attributed. Because a signed\n * URL binds the EXACT key, the operator and customer segments are part of the\n * privilege wall — a caller cannot later swap them without breaking the\n * signature.\n */\nexport function objectKey({ operatorId, customerId, uploadId, filename }: ObjectKeyParts): string {\n const operator = assertSafeKeySegment(operatorId)\n const customer = customerId == null ? '_unattributed' : assertSafeKeySegment(customerId)\n const upload = assertSafeKeySegment(uploadId)\n return `${operator}/${customer}/${upload}-${sanitizeFilename(filename)}`\n}\n\n/**\n * Decode a key ONCE and assert every `/`-delimited segment is safe. Slash- and\n * percent-encoded forms of the same key canonicalize identically (`a/b` and\n * `a%2Fb` both → `a/b`), so a signature binds the key's MEANING, not its\n * on-the-wire spelling. Throws on malformed percent-encoding or an unsafe\n * segment. Our own keys never contain `%`, so the single decode is idempotent.\n */\nfunction canonicalizeObjectKey(raw: string): string {\n let decoded: string\n try {\n decoded = decodeURIComponent(raw)\n } catch {\n throw new Error('object-store: malformed key encoding')\n }\n for (const segment of decoded.split('/')) assertSafeKeySegment(segment)\n return decoded\n}\n\n// ── Signed URLs ─────────────────────────────────────────────────────────────\n\n/** The exact string the signature covers: a versioned JSON of the canonical key\n * and the expiry. JSON escaping makes it delimiter-injection-proof (a key\n * cannot forge the `exp` field). Both sign and verify build it identically. */\nfunction signingMessage(canonicalKey: string, exp: number): string {\n return JSON.stringify({ v: 1, exp, key: canonicalKey })\n}\n\n/** Arguments to {@link signObjectUrl}. */\nexport interface SignObjectUrlArgs {\n /** The exact object key to authorize (from {@link objectKey}). */\n key: string\n /** Absolute expiry in epoch MILLISECONDS (e.g. `Date.now() + 5 * 60_000` for a\n * ~5-minute TTL — the recommended default; keep it short). */\n exp: number\n /** HMAC signing secret. Must be non-empty — signing fails closed otherwise. */\n secret: string\n}\n\n/**\n * Mint a signed query string (`?key=…&exp=…&sig=…`) authorizing a download of\n * `key` until `exp`. The product appends it to its artifact route path\n * (`` `/artifacts${await signObjectUrl(...)}` ``); {@link createProxiedArtifactRoute}\n * / {@link verifyObjectUrl} read it straight off the request URL, so the route's\n * own mount path never matters.\n *\n * FAIL-CLOSED: throws if `secret` is empty (never mints an unsigned URL) and if\n * `key` is unsafe (traversal). Async because the HMAC primitive is WebCrypto.\n *\n * TTL: `exp` is caller-supplied on purpose (the caller knows the sensitivity);\n * keep it SHORT — ~5 minutes is the recommended default for a privilege-walled\n * document.\n */\nexport async function signObjectUrl({ key, exp, secret }: SignObjectUrlArgs): Promise<string> {\n if (!secret) throw new Error('object-store: signObjectUrl requires a non-empty secret (fail-closed)')\n const canonical = canonicalizeObjectKey(key)\n const sig = await hmacSha256Base64Url(signingMessage(canonical, exp), secret)\n const params = new URLSearchParams({ key: canonical, exp: String(exp), sig })\n return `?${params.toString()}`\n}\n\n/** Result of {@link verifyObjectUrl}: the canonical key on success, nothing\n * distinguishing on failure (so a rejection leaks no detail). */\nexport type VerifyObjectUrlResult = { ok: true; key: string } | { ok: false }\n\n/**\n * Verify a signed download request. Reads `key`/`exp`/`sig` off the request URL,\n * canonicalizes the key identically to the signer, recomputes the HMAC and\n * constant-time-compares it, and checks the expiry. Returns the canonical key on\n * success.\n *\n * FAIL-CLOSED everywhere: an empty `secret`, a missing/ malformed parameter, a\n * non-finite expiry, a signature mismatch, or an expired URL all return\n * `{ ok: false }` — and the mismatch path uses a constant-time compare so a\n * near-correct signature is not distinguishable by timing. Async because the\n * HMAC primitive is WebCrypto.\n */\nexport async function verifyObjectUrl(\n request: Request,\n { secret }: { secret: string },\n): Promise<VerifyObjectUrlResult> {\n if (!secret) return { ok: false }\n const url = new URL(request.url)\n const rawKey = url.searchParams.get('key')\n const expRaw = url.searchParams.get('exp')\n const sig = url.searchParams.get('sig')\n if (!rawKey || !expRaw || !sig) return { ok: false }\n\n let key: string\n try {\n key = canonicalizeObjectKey(rawKey)\n } catch {\n return { ok: false }\n }\n\n const exp = Number(expRaw)\n if (!Number.isFinite(exp)) return { ok: false }\n\n const expected = await hmacSha256Base64Url(signingMessage(key, exp), secret)\n if (!constantTimeEqual(expected, sig)) return { ok: false }\n // Signature is valid; enforce expiry last so the constant-time compare always\n // runs (an expired-but-otherwise-valid URL is refused just the same).\n if (Date.now() > exp) return { ok: false }\n return { ok: true, key }\n}\n\n// ── Proxied download route ──────────────────────────────────────────────────\n\n/**\n * Build a download handler that verifies a signed request and STREAMS the object\n * back with a conservative, non-executable content type. Status contract:\n *\n * - `400` — the `key` is missing or malformed (bad encoding / traversal). This\n * is an unauthenticated client error and leaks NOTHING about object existence.\n * - `403` — the signature is missing, wrong, or expired.\n * - `404` — the signature was valid but no object exists at that key (existence\n * is only ever revealed to a validly-signed request).\n * - `200` — streams the bytes with `Content-Disposition: attachment`,\n * `Content-Type: application/octet-stream`, and `X-Content-Type-Options:\n * nosniff`, so the worker never serves active/inline content.\n */\nexport function createProxiedArtifactRoute({\n store,\n secret,\n}: {\n store: ObjectStore\n secret: string\n}): (request: Request) => Promise<Response> {\n return async (request) => {\n // 1. Malformed/missing key → 400, decided BEFORE auth so it leaks no\n // existence signal (a malformed key can never carry a valid signature).\n const rawKey = new URL(request.url).searchParams.get('key')\n if (!rawKey) return new Response('Missing key', { status: 400 })\n try {\n canonicalizeObjectKey(rawKey)\n } catch {\n return new Response('Malformed key', { status: 400 })\n }\n\n // 2. Bad / expired signature → 403.\n const verified = await verifyObjectUrl(request, { secret })\n if (!verified.ok) return new Response('Forbidden', { status: 403 })\n\n // 3. Fetch by the VERIFIED canonical key. Miss → 404 (only reachable behind\n // a valid signature). Hit → stream with a conservative content type.\n const obj = await store.get(verified.key)\n if (!obj) return new Response('Not found', { status: 404 })\n\n const headers: Record<string, string> = {\n 'Content-Type': 'application/octet-stream',\n 'Content-Disposition': 'attachment',\n 'X-Content-Type-Options': 'nosniff',\n }\n if (Number.isFinite(obj.size) && obj.size >= 0) headers['Content-Length'] = String(obj.size)\n return new Response(obj.stream(), { status: 200, headers })\n }\n}\n"],"mappings":";;;;;;AA8GO,SAAS,oBAAoB,EAAE,OAAO,GAA0C;AACrF,SAAO;AAAA,IACL,MAAM,IAAI,KAAK,MAAM,MAAM;AACzB,YAAM,UAAU,MAAM,cAAc,EAAE,cAAc,EAAE,aAAa,KAAK,YAAY,EAAE,IAAI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-1_3y2JmR.js';
2
+
3
+ /**
4
+ * `createSandboxFileIndexRoute` — server side of `@`-file-mentions
5
+ * (companion to sandbox-ui#184's composer mention primitive). Serves a flat,
6
+ * ignore-filtered listing of the workspace sandbox so `useFileMentions`
7
+ * (`/web-react`) can filter it client-side without a round trip per
8
+ * keystroke.
9
+ *
10
+ * Same seam style as `createUploadRoute`: `authorize({ request })` resolves a
11
+ * structural `{ tree(path, opts) }` handle (the shape of the sandbox SDK's
12
+ * `box.fs.tree`) — no SDK import here. `authorize` also carries the
13
+ * cold-box signal: a sandbox that isn't running yet answers `{ status:
14
+ * 'warming' }` directly, never provisions-and-waits inside this route.
15
+ *
16
+ * A box can also be running with its workspace root not yet materialised, which
17
+ * `authorize` cannot see; the route recognises that one signal off `fs.tree`
18
+ * and answers `warming` too, so every consumer gets the retry-and-wait state
19
+ * instead of a 500. Every other `tree()` failure propagates.
20
+ */
21
+
22
+ /** One entry from a structural `tree()` scan. Mirrors the sandbox SDK's
23
+ * `FileTreeFile` (`path`, `size`, `mtime`) — `mtime` is unused here so it's
24
+ * omitted from the structural match. */
25
+ interface SandboxTreeFile {
26
+ path: string;
27
+ size: number;
28
+ }
29
+ /** Structural match of the sandbox SDK's `box.fs.tree` result shape
30
+ * (`FileTreeResult`). `stats.truncated` is the only stat this route reads;
31
+ * the rest ride through unread on the real SDK type. */
32
+ interface SandboxTreeResult {
33
+ root: string;
34
+ files: SandboxTreeFile[];
35
+ stats: {
36
+ truncated: boolean;
37
+ };
38
+ }
39
+ /** Structural match of the sandbox SDK's `box.fs` tree surface. */
40
+ interface SandboxFileTreeSource {
41
+ tree(path: string, options?: {
42
+ maxDepth?: number;
43
+ }): Promise<SandboxTreeResult>;
44
+ }
45
+ interface FileIndexReadyResponse {
46
+ status: 'ready';
47
+ /** Workspace-relative entries. Same shape as `FileMention` (`./wire`) so a
48
+ * client can hand a response entry straight to `fileMentionsToParts` /
49
+ * `buildMentionPromptBlock` without remapping. */
50
+ files: FileMention[];
51
+ /** True when either the underlying scan truncated (SDK-side cap) or this
52
+ * route's own `maxEntries` cap trimmed the filtered list. The client
53
+ * should show "showing first N files" rather than imply completeness. */
54
+ truncated: boolean;
55
+ generatedAt: string;
56
+ }
57
+ /** Cold-box answer: no provisioning happened, no files were scanned. The
58
+ * client shows a warming state and retries — this route never blocks on a
59
+ * box coming up. Two situations produce it: `authorize` reporting a box that
60
+ * is not running, and a running box whose workspace root does not exist yet
61
+ * (see `isMissingRootError`). */
62
+ interface FileIndexWarmingResponse {
63
+ status: 'warming';
64
+ }
65
+ type FileIndexResponse = FileIndexReadyResponse | FileIndexWarmingResponse;
66
+ /** Short-TTL cache seam so repeat popover opens in the same session don't
67
+ * re-scan the workspace. Host-provided (e.g. a KV binding); `key` is
68
+ * whatever `authorize` returns as `cacheKey` — this route treats it opaquely. */
69
+ interface FileIndexCache {
70
+ get(key: string): Promise<FileIndexReadyResponse | null> | FileIndexReadyResponse | null;
71
+ put(key: string, value: FileIndexReadyResponse, options?: {
72
+ ttlSeconds?: number;
73
+ }): Promise<void> | void;
74
+ }
75
+ type FileIndexAuthorization = {
76
+ status: 'ready';
77
+ /** Structural sandbox `fs` handle, usually `ensureWorkspaceSandbox(...)` → `box.fs`. */
78
+ fs: SandboxFileTreeSource;
79
+ /** Workspace root to index (e.g. `/home/agent`). */
80
+ root: string;
81
+ /** Extra ignore segments for this request, merged with the route's
82
+ * defaults + `CreateSandboxFileIndexRouteOptions.ignore`. */
83
+ ignore?: string[];
84
+ /** Opaque cache key for the optional cache seam. Omit to skip caching
85
+ * for this request (e.g. a workspace the host chooses not to cache). */
86
+ cacheKey?: string;
87
+ } | {
88
+ status: 'warming';
89
+ } | {
90
+ status: 'denied';
91
+ response: Response;
92
+ };
93
+ interface CreateSandboxFileIndexRouteOptions {
94
+ /** Authenticate the caller, resolve the sandbox `fs` handle, and signal a
95
+ * cold box — never provisions or waits. */
96
+ authorize(args: {
97
+ request: Request;
98
+ }): Promise<FileIndexAuthorization>;
99
+ /** Extra ignore segments beyond the route's defaults (node_modules, .git,
100
+ * dotfiles/dot-dirs, common build dirs). Matched as exact path-segment
101
+ * names, same rule as the defaults. */
102
+ ignore?: string[];
103
+ /** Passed to `fs.tree` as `options.maxDepth`. Default 12. */
104
+ maxDepth?: number;
105
+ /** Hard cap on entries returned after filtering. Default 5000. */
106
+ maxEntries?: number;
107
+ /** Optional host-provided cache seam. */
108
+ cache?: FileIndexCache;
109
+ /** Cache TTL in seconds when `cache` is set. Default 20. */
110
+ cacheTtlSeconds?: number;
111
+ }
112
+ declare function createSandboxFileIndexRoute(options: CreateSandboxFileIndexRouteOptions): (request: Request) => Promise<Response>;
113
+
114
+ export { type CreateSandboxFileIndexRouteOptions as C, type FileIndexAuthorization as F, type SandboxFileTreeSource as S, type FileIndexCache as a, type FileIndexReadyResponse as b, type FileIndexResponse as c, type FileIndexWarmingResponse as d, type SandboxTreeFile as e, type SandboxTreeResult as f, createSandboxFileIndexRoute as g };
package/dist/index.d.ts CHANGED
@@ -17,7 +17,7 @@ export { KeyCrypto, KeyProvisioner, PlanLimit, PlatformBalanceInfo, PlatformBala
17
17
  export { HttpHeadProbeConfig, PreflightProbe, PreflightProbeResult, PreflightProbeVerdict, PreflightReport, RouterChatProbeConfig, SandboxAuthProbeConfig, formatPreflightReport, httpHeadProbe, routerChatProbe, runPreflight, sandboxAuthProbe } from './preflight/index.js';
18
18
  export { ObjectBody, ObjectKeyParts, ObjectStore, PutObjectOptions, R2LikeBucket, R2LikeObjectBody, R2LikeObjectHead, SignObjectUrlArgs, VerifyObjectUrlResult, assertSafeKeySegment, createProxiedArtifactRoute, createR2ObjectStore, objectKey, signObjectUrl, verifyObjectUrl } from './object-store/index.js';
19
19
  export { B as BULK_DELETE_MAX_THREADS, C as ChatStoreInputError, t as threadTitleFromMessage } from './core-7qIM7svy.js';
20
- export { C as ChatFilePart, a as ChatImagePart, b as ChatInteractionPart, c as ChatMessagePart, d as ChatNoticePart, e as ChatPartTime, f as ChatPlanPart, g as ChatReasoningPart, h as ChatStepFinishPart, i as ChatStepStartPart, j as ChatSubtaskPart, k as ChatTextPart, l as ChatToolPart, m as ChatToolState, n as ChatToolStatus, o as ChatUsageTokens, S as StorableHarnessPartKind, p as isChatInteractionPart, q as isChatPlanPart, r as isChatStepFinishPart, s as isChatTextPart, t as isChatToolPart, u as toChatMessageParts } from './parts-DjX0RRTS.js';
20
+ export { C as ChatFilePart, a as ChatImagePart, b as ChatInteractionPart, c as ChatMentionKind, d as ChatMentionPart, e as ChatMessagePart, f as ChatNoticePart, g as ChatPartTime, h as ChatPlanPart, i as ChatReasoningPart, j as ChatStepFinishPart, k as ChatStepStartPart, l as ChatSubtaskPart, m as ChatTextPart, n as ChatToolPart, o as ChatToolState, p as ChatToolStatus, q as ChatUsageTokens, S as StorableHarnessPartKind, r as isChatInteractionPart, s as isChatMentionPart, t as isChatPlanPart, u as isChatStepFinishPart, v as isChatTextPart, w as isChatToolPart, x as mentionInputToPart, y as mentionPartsFromMessageParts, z as toChatMessageParts } from './parts-1_3y2JmR.js';
21
21
  export { DeriveKeyOptions, createFieldCrypto, decodeHexKey, decryptAesGcm, decryptBytes, decryptWithKey, deriveKey, encryptAesGcm, encryptBytes, encryptWithKey } from './crypto/index.js';
22
22
  export { BufferedTurnEvent, BufferedTurnOptions, BufferedTurnTap, D1LikeForTurns, JsonRecord, PersistedChatMessageForTurn, PumpBufferedTurnOptions, ReplayTurnEventsOptions, ResolvedChatTurn, StreamEvent, TURN_EVENTS_MIGRATION_SQL, TURN_STATUS_SCOPE_MIGRATION_SQL, TurnEventStore, TurnStatus, asRecord, asString, buildUserTextParts, coalesceChatStreamEvents, coalesceDeltas, createBufferedTurnTap, createD1TurnEventStore, createMemoryTurnEventStore, encodeEvent, finalizeAssistantParts, getPartKey, mergePersistedPart, messageHasTurnId, normalizeClientTurnId, normalizePersistedPart, normalizeTime, normalizeToolEvent, pumpBufferedTurn, replayTurnEvents, resolveChatTurn, resolveToolId, resolveToolName } from './stream/index.js';
23
23
  export { HubExecClient, HubExecClientOptions, HubExecErrorCode, HubExecResult, HubInvokeDeps, HubInvokeInput, HubInvokeOutcome, ParsedIntegrationAction, invokeIntegrationHub, resolveIntegrationAction } from './integrations/index.js';
@@ -27,7 +27,7 @@ export { ChatPlan, ChatPlanPersistedPart, ChatPlanStatus, PLAN_SUBMITTED_EVENT,
27
27
  export { CreateDurableInteractionRoutePersistenceOptions, DurableAnswerIntentJournal, DurableAnswerIntentRecord, DurableAnswerIntentState, DurableChatConflictError, DurableChatError, DurableChatErrorCode, DurableChatEventProjection, DurableChatGoneError, DurableChatScope, DurableChatStateStore, DurableChatUnavailableError, DurableFollowUpReceipt, DurableInteractionAcknowledgement, DurableInteractionGuarantee, DurableInteractionProjection, DurableInteractionProjectionAdapter, DurableInteractionSettlement, DurableInteractionSettlementFactoryOptions, DurableInteractionSettlementOptions, DurablePlanAuthority, DurablePlanAuthorityCurrentResult, DurablePlanAuthorityDecision, DurablePlanAuthorityResult, DurablePlanAuthorization, DurablePlanCommandJournal, DurablePlanCommandKey, DurablePlanCommandRecord, DurablePlanCommandState, DurablePlanDecision, DurablePlanEffectRecord, DurablePlanProjection, DurablePlanRouteAuthorizeArgs, DurablePlanRouteOptions, DurablePlanRoutes, DurablePlanStateStore, DurablePlanStore, InMemoryDurableChatStateStore, InMemoryDurableChatStore, PreparedDurableInteractionAnswer, applyDurableInteractionAnswer, applyDurableInteractionAsk, applyDurableInteractionCancel, createDurableChatEventProjection, createDurableChatScope, createDurableInteractionProjectionAdapter, createDurableInteractionRoutePersistence, createDurableInteractionSettlement, createDurablePlanRoutes, createInMemoryDurableChatStateStore, durableChatScopeKey, durableInteractionIntentKey, normalizePlanDecision, planAuthorityIdempotencyKey, planCommandKey, planEffectKey, recordDurableInteractionAnswer, recordDurableInteractionCancel, stablePlanReceipt, upsertDurableInteractionAsk } from './durable-chat/index.js';
28
28
  export { CompleteMissionInput, CreateMissionInput, DEFAULT_MISSION_STEP_KINDS, InMemoryMissionStore, MISSION_CONTROL_CHANNEL_ID, MissionApprovalsPort, MissionAuditEvent, MissionConcurrencyError, MissionCostLedger, MissionEngine, MissionEngineOptions, MissionEventSink, MissionGateKind, MissionGateOptions, MissionGateProposal, MissionOutcome, MissionPlanRunOptions, MissionProposalResolution, MissionRecord, MissionService, MissionServiceOptions, MissionState, MissionStatus, MissionStep, MissionStepState, MissionStepStatus, MissionStorePort, MissionStreamEvent, MissionStreamStatus, MissionStreamStep, MissionStreamStepStatus, MissionUpdateGuard, MissionUpdatePatch, ParseMissionBlocksOptions, ParsedMission, ParsedMissionStep, PlanOutcome, RetryableStepError, SandboxDispatch, SandboxDispatchDoneResult, SandboxDispatchInProgressResult, SandboxDispatchInput, SandboxDispatchResult, SetStepStatusPatch, StepGateClassification, StepOutcome, applyMissionEvent, asMissionStreamEvent, budgetGateProposalId, buildAgentMissionPlan, createInMemoryMissionStore, createMissionEngine, createMissionService, isMissionStopRequested, isMissionTerminal, mergeMissionState, noopEventSink, parseMissionBlocks, parseSessionStreamEnvelope, reduceMissionEvents, stepGateProposalId, volumeGateProposalId } from './missions/index.js';
29
29
  export { S as StepAgentActivity, W as WithAgentActivity, s as stepAgentActivity } from './agent-activity-C8ZG0F0M.js';
30
- export { AppToolDescriptor, AuthenticatedSandboxUser, BuildAppToolMcpServersOptions, BuildSandboxToolFileMountsOptions, DEFAULT_SANDBOX_RESOURCES, DriveSandboxTurnOptions, ENV_TOTAL_MAX_BYTES, ENV_VALUE_MAX_BYTES, EnsureWorkspaceSandboxOptions, LivenessProbeConfig, MemberSyncSeam, Outcome, PROVISION_PAYLOAD_MAX_BYTES, ProfileComposeOptions, PromptInputPart, ProviderResolutionConfig, ProvisionPayloadSections, ProvisionProfileSection, ResolveSandboxClientCredentialsOptions, ResolvedModel, SandboxApiCredentials, SandboxBuildContext, SandboxClientCredentials, SandboxCredentialEnvironment, SandboxPermissionLevel, SandboxResourceConfig, SandboxRestoreSpec, SandboxRuntimeAuthRefreshError, SandboxRuntimeConfig, SandboxRuntimeConnection, SandboxScope, SandboxStepTransition, SandboxTerminalTokenOptions, SandboxTerminalTokenResult, SandboxTerminalTokenSubject, SandboxTerminalWsMatch, SandboxToolPathOptions, SandboxToolSpec, ScopedTokenResult, SecretStore, StoppedSandboxResumeFailure, StoppedSandboxResumeRecovery, StreamSandboxPromptOptions, TerminalProxyIdentity, WorkspaceSandboxConnectionArgs, WorkspaceSandboxConnectionHandlerOptions, WorkspaceSandboxEnsureContext, WorkspaceSandboxInstanceLike, WorkspaceSandboxManager, WorkspaceSandboxManagerOptions, WorkspaceSandboxRuntimeProxyArgs, WorkspaceSandboxRuntimeProxyHandlerOptions, WorkspaceSandboxTerminalUpgradeHandlerOptions, WriteProfileFilesOptions, assertEnvWithinLimits, assertProvisionPayloadWithinCap, attachReasoningEffort, bearerSubprotocolToken, bearerToken, buildAppToolMcpServers, buildSandboxRuntimeProxyHeaders, buildSandboxToolFileMounts, buildSandboxToolPathSetupScript, classifySeveredStream, createSandboxTerminalToken, createWorkspaceSandboxConnectionHandler, createWorkspaceSandboxManager, createWorkspaceSandboxRuntimeProxyHandler, createWorkspaceSandboxTerminalUpgradeHandler, deferredCorpusHash, deleteSecret, detectInteractiveQuestion, driveSandboxTurn, encodeSandboxRuntimePath, ensureWorkspaceSandbox, flattenHistory, getClient, isSandboxTerminalWsUpgrade, isTerminalPromptEvent, matchSandboxTerminalWsPath, mergeExtraMcp, mergeHistoryIntoParts, mintSandboxScopedToken, mintTerminalProxyToken, readSecret, resetClientCache, resolveModel, resolveSandboxClientCredentials, runSandboxPrompt, runSandboxToolPathSetup, sandboxToolBinDir, sandboxToolPath, sandboxToolRootDir, secretStoreFromClient, splitDeferredProfileFiles, storeSecret, streamSandboxPrompt, syncSandboxMemberAdd, syncSandboxMemberRemove, syncSandboxMemberRole, terminalTokenFromRequest, verifySandboxTerminalToken, verifyTerminalProxyToken, writeProfileFilesToBox } from './sandbox/index.js';
30
+ export { AppToolDescriptor, AuthenticatedSandboxUser, BuildAppToolMcpServersOptions, BuildSandboxToolFileMountsOptions, DEFAULT_SANDBOX_RESOURCES, DriveSandboxTurnOptions, ENV_TOTAL_MAX_BYTES, ENV_VALUE_MAX_BYTES, EnsureWorkspaceSandboxOptions, LivenessProbeConfig, MemberSyncSeam, Outcome, PROVISION_PAYLOAD_MAX_BYTES, PeekWorkspaceSandboxOutcome, ProfileComposeOptions, PromptInputPart, ProviderResolutionConfig, ProvisionPayloadSections, ProvisionProfileSection, ResolveSandboxClientCredentialsOptions, ResolvedModel, SandboxApiCredentials, SandboxBuildContext, SandboxClientCredentials, SandboxCredentialEnvironment, SandboxExecChannel, SandboxExecOptions, SandboxFileBytesOutcome, SandboxFileSizeOutcome, SandboxPermissionLevel, SandboxResourceConfig, SandboxRestoreSpec, SandboxRuntimeAuthRefreshError, SandboxRuntimeConfig, SandboxRuntimeConnection, SandboxScope, SandboxStepTransition, SandboxTerminalTokenOptions, SandboxTerminalTokenResult, SandboxTerminalTokenSubject, SandboxTerminalWsMatch, SandboxToolPathOptions, SandboxToolSpec, ScopedTokenResult, SecretStore, StoppedSandboxResumeFailure, StoppedSandboxResumeRecovery, StreamSandboxPromptOptions, TerminalProxyIdentity, WorkspaceSandboxConnectionArgs, WorkspaceSandboxConnectionHandlerOptions, WorkspaceSandboxEnsureContext, WorkspaceSandboxInstanceLike, WorkspaceSandboxManager, WorkspaceSandboxManagerOptions, WorkspaceSandboxRuntimeProxyArgs, WorkspaceSandboxRuntimeProxyHandlerOptions, WorkspaceSandboxTerminalUpgradeHandlerOptions, WriteProfileFilesOptions, assertEnvWithinLimits, assertProvisionPayloadWithinCap, attachReasoningEffort, bearerSubprotocolToken, bearerToken, buildAppToolMcpServers, buildSandboxRuntimeProxyHeaders, buildSandboxToolFileMounts, buildSandboxToolPathSetupScript, classifySeveredStream, createSandboxTerminalToken, createWorkspaceSandboxConnectionHandler, createWorkspaceSandboxManager, createWorkspaceSandboxRuntimeProxyHandler, createWorkspaceSandboxTerminalUpgradeHandler, deferredCorpusHash, deleteSecret, detectInteractiveQuestion, driveSandboxTurn, encodeSandboxRuntimePath, ensureWorkspaceSandbox, flattenHistory, getClient, isSandboxTerminalWsUpgrade, isTerminalPromptEvent, matchSandboxTerminalWsPath, mergeExtraMcp, mergeHistoryIntoParts, mintSandboxScopedToken, mintTerminalProxyToken, peekWorkspaceSandbox, readSandboxBinaryBytes, readSecret, resetClientCache, resolveModel, resolveSandboxClientCredentials, runSandboxPrompt, runSandboxToolPathSetup, sandboxToolBinDir, sandboxToolPath, sandboxToolRootDir, secretStoreFromClient, shellQuote, splitDeferredProfileFiles, statSandboxFileSize, storeSecret, streamSandboxPrompt, syncSandboxMemberAdd, syncSandboxMemberRemove, syncSandboxMemberRole, terminalTokenFromRequest, verifySandboxTerminalToken, verifyTerminalProxyToken, writeProfileFilesToBox } from './sandbox/index.js';
31
31
  export { CookieOptions, JsonObject, KvLike, RateLimitResult, RequestContext, SecurityHeaderOptions, addSecurityHeaders, assertMediaUrl, checkRateLimit, clearCookieHeader, extractRequestContext, parseJsonObjectBody, readCookieValue, requireString, serializeCookie } from './web/index.js';
32
32
  export { BuildRedactedDocumentOptions, DEFAULT_REDACTION_PATTERNS, RedactForIngestionOptions, RedactedDocSegment, RedactedDocument, RedactionPattern, RedactionSpan, RevealResult, RevealSpanOptions, buildRedactedDocument, detectSpans, maskSpans, redactForIngestion, revealSpan } from './redact/index.js';
33
33
  export { ApprovalEvent, ApprovalEventSchema, AssetContentMap, AssetFormat, AssetSpec, AssetStatus, AssetVariant, BrandTokens, BrandTokensSchema, ConversionMetrics, ConversionMetricsSchema, CopyContent, CopyContentSchema, CopyPlatform, EmailBodySection, EmailContent, EmailContentSchema, EmailCtaSection, EmailDividerSection, EmailFeatureSection, EmailHeroSection, EmailSection, EmailTestimonialSection, ImageBackground, ImageContent, ImageContentSchema, ImageImageLayer, ImageLayer, ImageLayerType, ImageLogoLayer, ImageShapeLayer, ImageSlide, ImageTextLayer, VideoCaption, VideoContent, VideoContentSchema, VideoCountdownScene, VideoImageRevealScene, VideoScene, VideoSlideScene, VideoTextAnimationScene, parseAssetSpec, safeParseAssetSpec } from './assets/index.js';
package/dist/index.js CHANGED
@@ -237,7 +237,7 @@ import {
237
237
  objectKey,
238
238
  signObjectUrl,
239
239
  verifyObjectUrl
240
- } from "./chunk-UMSOSUEU.js";
240
+ } from "./chunk-QYOD3K56.js";
241
241
  import {
242
242
  BULK_DELETE_MAX_THREADS,
243
243
  ChatStoreInputError,
@@ -289,12 +289,15 @@ import {
289
289
  } from "./chunk-HFC4BTWJ.js";
290
290
  import {
291
291
  isChatInteractionPart,
292
+ isChatMentionPart,
292
293
  isChatPlanPart,
293
294
  isChatStepFinishPart,
294
295
  isChatTextPart,
295
296
  isChatToolPart,
297
+ mentionInputToPart,
298
+ mentionPartsFromMessageParts,
296
299
  toChatMessageParts
297
- } from "./chunk-I2ATYB7R.js";
300
+ } from "./chunk-6E2XJSCT.js";
298
301
  import {
299
302
  INTERACTION_CANCEL_EVENT,
300
303
  INTERACTION_EVENT,
@@ -382,6 +385,8 @@ import {
382
385
  mergeHistoryIntoParts,
383
386
  mintSandboxScopedToken,
384
387
  mintTerminalProxyToken,
388
+ peekWorkspaceSandbox,
389
+ readSandboxBinaryBytes,
385
390
  readSecret,
386
391
  resetClientCache,
387
392
  resolveModel,
@@ -392,7 +397,9 @@ import {
392
397
  sandboxToolPath,
393
398
  sandboxToolRootDir,
394
399
  secretStoreFromClient,
400
+ shellQuote,
395
401
  splitDeferredProfileFiles,
402
+ statSandboxFileSize,
396
403
  storeSecret,
397
404
  streamSandboxPrompt,
398
405
  syncSandboxMemberAdd,
@@ -402,7 +409,7 @@ import {
402
409
  verifySandboxTerminalToken,
403
410
  verifyTerminalProxyToken,
404
411
  writeProfileFilesToBox
405
- } from "./chunk-5GWXCSLQ.js";
412
+ } from "./chunk-5RJNEEO2.js";
406
413
  import {
407
414
  DEFAULT_HARNESS,
408
415
  KNOWN_HARNESSES,
@@ -743,6 +750,7 @@ export {
743
750
  invokeIntegrationHub,
744
751
  isAppToolName,
745
752
  isChatInteractionPart,
753
+ isChatMentionPart,
746
754
  isChatPlanPart,
747
755
  isChatStepFinishPart,
748
756
  isChatTextPart,
@@ -767,6 +775,8 @@ export {
767
775
  maskSpans,
768
776
  matchPreset,
769
777
  matchSandboxTerminalWsPath,
778
+ mentionInputToPart,
779
+ mentionPartsFromMessageParts,
770
780
  mergeExtraMcp,
771
781
  mergeHistoryIntoParts,
772
782
  mergeMissionState,
@@ -797,6 +807,7 @@ export {
797
807
  parsePlanSubmittedEvent,
798
808
  parseSequenceOperations,
799
809
  parseSessionStreamEnvelope,
810
+ peekWorkspaceSandbox,
800
811
  persistedPartToInteraction,
801
812
  persistedPartToPlan,
802
813
  planAuthorityIdempotencyKey,
@@ -811,6 +822,7 @@ export {
811
822
  pumpBufferedTurn,
812
823
  questionInteractionContentSignature,
813
824
  readCookieValue,
825
+ readSandboxBinaryBytes,
814
826
  readSecret,
815
827
  readToolArgs,
816
828
  recordDurableInteractionAnswer,
@@ -860,6 +872,7 @@ export {
860
872
  secondsToFrames,
861
873
  secretStoreFromClient,
862
874
  serializeCookie,
875
+ shellQuote,
863
876
  signObjectUrl,
864
877
  snapHarnessToModel,
865
878
  snapModelToHarness,
@@ -867,6 +880,7 @@ export {
867
880
  splitDeferredProfileFiles,
868
881
  stablePlanReceipt,
869
882
  stampInteractionAnswers,
883
+ statSandboxFileSize,
870
884
  stepActivityFlowTrace,
871
885
  stepAgentActivity,
872
886
  stepGateProposalId,
@@ -108,10 +108,12 @@ declare function createR2ObjectStore({ bucket }: {
108
108
  /**
109
109
  * Assert a single object-key path SEGMENT (an operator id, customer id, or
110
110
  * upload id) is safe to interpolate into a key, and return it. Throws on the
111
- * traversal / injection shapes: `..` anywhere, a leading `/`, a backslash, or an
112
- * empty segment. Consumers should call this on caller-supplied identifiers
113
- * BEFORE any `get`/`put` so an attacker-controlled id can never widen the key
114
- * beyond its own operator+customer prefix.
111
+ * traversal / injection shapes: `..` anywhere, ANY `/` (a segment must be a
112
+ * single path component a leading, interior, or trailing slash all widen the
113
+ * key by injecting extra levels), a backslash, or an empty segment. Consumers
114
+ * should call this on caller-supplied identifiers BEFORE any `get`/`put` so an
115
+ * attacker-controlled id can never widen the key beyond its own operator+
116
+ * customer prefix.
115
117
  */
116
118
  declare function assertSafeKeySegment(s: string): string;
117
119
  /** Inputs to {@link objectKey}. `customerId` is optional — an unattributed
@@ -5,7 +5,7 @@ import {
5
5
  objectKey,
6
6
  signObjectUrl,
7
7
  verifyObjectUrl
8
- } from "../chunk-UMSOSUEU.js";
8
+ } from "../chunk-QYOD3K56.js";
9
9
  import "../chunk-S5SRJJQG.js";
10
10
  export {
11
11
  assertSafeKeySegment,