@tangle-network/agent-app 0.43.39 → 0.43.41

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 (35) hide show
  1. package/dist/assistant/index.d.ts +1 -1
  2. package/dist/assistant/index.js +2 -2
  3. package/dist/chat-routes/index.d.ts +2 -2
  4. package/dist/chat-routes/index.js +22 -14
  5. package/dist/chat-routes/index.js.map +1 -1
  6. package/dist/chunk-2EO7CPL3.js +191 -0
  7. package/dist/chunk-2EO7CPL3.js.map +1 -0
  8. package/dist/{chunk-H4WCEZE3.js → chunk-5GWXCSLQ.js} +5 -5
  9. package/dist/{chunk-D4HB72W2.js → chunk-KM766NN3.js} +159 -25
  10. package/dist/chunk-KM766NN3.js.map +1 -0
  11. package/dist/{chunk-3II3AWHY.js → chunk-PJC4NXPA.js} +7 -34
  12. package/dist/chunk-PJC4NXPA.js.map +1 -0
  13. package/dist/chunk-S5SRJJQG.js +36 -0
  14. package/dist/chunk-S5SRJJQG.js.map +1 -0
  15. package/dist/chunk-UMSOSUEU.js +124 -0
  16. package/dist/chunk-UMSOSUEU.js.map +1 -0
  17. package/dist/design-canvas-react/index.js +4 -4
  18. package/dist/file-index-Bw_IQE_G.d.ts +194 -0
  19. package/dist/index.d.ts +1 -0
  20. package/dist/index.js +43 -28
  21. package/dist/object-store/index.d.ts +202 -0
  22. package/dist/object-store/index.js +18 -0
  23. package/dist/object-store/index.js.map +1 -0
  24. package/dist/sandbox/index.js +3 -2
  25. package/dist/teams-react/index.js +3 -3
  26. package/dist/tools/index.js +2 -1
  27. package/dist/web-react/index.d.ts +94 -2
  28. package/dist/web-react/index.js +19 -3
  29. package/package.json +6 -1
  30. package/dist/chunk-3II3AWHY.js.map +0 -1
  31. package/dist/chunk-5SV5PSU7.js +0 -80
  32. package/dist/chunk-5SV5PSU7.js.map +0 -1
  33. package/dist/chunk-D4HB72W2.js.map +0 -1
  34. package/dist/wire-BaUF66AS.d.ts +0 -61
  35. /package/dist/{chunk-H4WCEZE3.js.map → chunk-5GWXCSLQ.js.map} +0 -0
package/dist/index.js CHANGED
@@ -202,11 +202,45 @@ import {
202
202
  runPreflight,
203
203
  sandboxAuthProbe
204
204
  } from "./chunk-Q4TKVF3L.js";
205
+ import {
206
+ assertSafeKeySegment,
207
+ createProxiedArtifactRoute,
208
+ createR2ObjectStore,
209
+ objectKey,
210
+ signObjectUrl,
211
+ verifyObjectUrl
212
+ } from "./chunk-UMSOSUEU.js";
205
213
  import {
206
214
  BULK_DELETE_MAX_THREADS,
207
215
  ChatStoreInputError,
208
216
  threadTitleFromMessage
209
217
  } from "./chunk-5EQCITY3.js";
218
+ import {
219
+ TURN_EVENTS_MIGRATION_SQL,
220
+ TURN_STATUS_SCOPE_MIGRATION_SQL,
221
+ asRecord,
222
+ asString,
223
+ buildUserTextParts,
224
+ coalesceChatStreamEvents,
225
+ coalesceDeltas,
226
+ createBufferedTurnTap,
227
+ createD1TurnEventStore,
228
+ createMemoryTurnEventStore,
229
+ encodeEvent,
230
+ finalizeAssistantParts,
231
+ getPartKey,
232
+ mergePersistedPart,
233
+ messageHasTurnId,
234
+ normalizeClientTurnId,
235
+ normalizePersistedPart,
236
+ normalizeTime,
237
+ normalizeToolEvent,
238
+ pumpBufferedTurn,
239
+ replayTurnEvents,
240
+ resolveChatTurn,
241
+ resolveToolId,
242
+ resolveToolName
243
+ } from "./chunk-XYWCGFII.js";
210
244
  import {
211
245
  createInteractionAnswerRoute,
212
246
  listSessionInteractions,
@@ -266,32 +300,6 @@ import {
266
300
  encryptBytes,
267
301
  encryptWithKey
268
302
  } from "./chunk-TA5Q4I2K.js";
269
- import {
270
- TURN_EVENTS_MIGRATION_SQL,
271
- TURN_STATUS_SCOPE_MIGRATION_SQL,
272
- asRecord,
273
- asString,
274
- buildUserTextParts,
275
- coalesceChatStreamEvents,
276
- coalesceDeltas,
277
- createBufferedTurnTap,
278
- createD1TurnEventStore,
279
- createMemoryTurnEventStore,
280
- encodeEvent,
281
- finalizeAssistantParts,
282
- getPartKey,
283
- mergePersistedPart,
284
- messageHasTurnId,
285
- normalizeClientTurnId,
286
- normalizePersistedPart,
287
- normalizeTime,
288
- normalizeToolEvent,
289
- pumpBufferedTurn,
290
- replayTurnEvents,
291
- resolveChatTurn,
292
- resolveToolId,
293
- resolveToolName
294
- } from "./chunk-XYWCGFII.js";
295
303
  import {
296
304
  createKnowledgeLoop,
297
305
  createReviewerDecider,
@@ -353,7 +361,7 @@ import {
353
361
  verifySandboxTerminalToken,
354
362
  verifyTerminalProxyToken,
355
363
  writeProfileFilesToBox
356
- } from "./chunk-H4WCEZE3.js";
364
+ } from "./chunk-5GWXCSLQ.js";
357
365
  import {
358
366
  DEFAULT_HARNESS,
359
367
  KNOWN_HARNESSES,
@@ -374,7 +382,7 @@ import {
374
382
  restrictTaxonomy,
375
383
  verifyCapabilityToken,
376
384
  verifyExpiringCapabilityToken
377
- } from "./chunk-3II3AWHY.js";
385
+ } from "./chunk-PJC4NXPA.js";
378
386
  import {
379
387
  DEFAULT_APP_TOOL_PATHS,
380
388
  DEFAULT_HEADER_NAMES,
@@ -386,6 +394,7 @@ import {
386
394
  createMcpToolHandler,
387
395
  readToolArgs
388
396
  } from "./chunk-7EVZUIHW.js";
397
+ import "./chunk-S5SRJJQG.js";
389
398
  import {
390
399
  buildConsentUrl,
391
400
  createBrokerTokenProvider
@@ -523,6 +532,7 @@ export {
523
532
  assertMediaUrl,
524
533
  assertPositiveFinite,
525
534
  assertProvisionPayloadWithinCap,
535
+ assertSafeKeySegment,
526
536
  assertSceneMediaSrc,
527
537
  assertSequenceMediaUrl,
528
538
  attachReasoningEffort,
@@ -604,6 +614,8 @@ export {
604
614
  createPresetToolHandlers,
605
615
  createPresetWorkspaceKeyManager,
606
616
  createPresetWorkspaceKeyStore,
617
+ createProxiedArtifactRoute,
618
+ createR2ObjectStore,
607
619
  createReviewerDecider,
608
620
  createSandboxTerminalToken,
609
621
  createSequencesMcpHandler,
@@ -711,6 +723,7 @@ export {
711
723
  normalizeToolEvent,
712
724
  noticePart,
713
725
  noticePartKey,
726
+ objectKey,
714
727
  outcomeStatus,
715
728
  parseAssetSpec,
716
729
  parseInteractionCancel,
@@ -772,6 +785,7 @@ export {
772
785
  secondsToFrames,
773
786
  secretStoreFromClient,
774
787
  serializeCookie,
788
+ signObjectUrl,
775
789
  snapHarnessToModel,
776
790
  snapModelToHarness,
777
791
  snapshotFrame,
@@ -819,6 +833,7 @@ export {
819
833
  verifyCapabilityToken,
820
834
  verifyCompletion,
821
835
  verifyExpiringCapabilityToken,
836
+ verifyObjectUrl,
822
837
  verifySandboxTerminalToken,
823
838
  verifyTerminalProxyToken,
824
839
  volumeGateProposalId,
@@ -0,0 +1,202 @@
1
+ /**
2
+ * `/object-store` — a portable, secure object store for durable large
3
+ * attachments (uploaded PDFs, images, exports) that are too big to ride a chat
4
+ * turn body or live in KV.
5
+ *
6
+ * SECURITY POSTURE (this module guards a legal privilege wall). Every object key
7
+ * carries an operator segment and a customer segment, and access is by a
8
+ * short-lived HMAC-signed URL whose signature covers the EXACT key (operator +
9
+ * customer + upload id + filename) AND the expiry. A tampered key, a swapped
10
+ * customer segment, or a replayed-after-expiry URL all fail the signature or the
11
+ * expiry check and are refused. The signing secret is a PARAMETER on every call
12
+ * — this module reads NOTHING global (no `process.env`, no ambient config); if a
13
+ * product forgets to bind the secret, {@link verifyObjectUrl} fails closed and
14
+ * {@link signObjectUrl} throws rather than minting an unsigned URL.
15
+ *
16
+ * PURE MECHANISM behind two seams: an {@link ObjectStore} port (the R2 impl maps
17
+ * 1:1 to a bucket held behind the structural {@link R2LikeBucket} — so
18
+ * `@cloudflare/workers-types` never leaks into this package's public `.d.ts`)
19
+ * and the signing `secret`. Reads and writes STREAM: {@link createR2ObjectStore}
20
+ * returns the R2 object's `.body` stream directly and never calls
21
+ * `.text()`/`.arrayBuffer()`, so a 15 MB PDF flows through the worker without
22
+ * buffering the whole file into the isolate's heap.
23
+ *
24
+ * RECONCILIATION with the sandbox `storage` seam (`../sandbox` →
25
+ * `SandboxRuntimeConfig.storage`): that is BYOS3/R2 *snapshot* storage — it
26
+ * checkpoints and restores a sandbox box's filesystem for durable session
27
+ * execution. This is a DIFFERENT concern: a content-addressed store for
28
+ * user-facing attachments gated by a signed-URL privilege wall. They are not
29
+ * interchangeable and must not be merged: one persists agent runtime state, the
30
+ * other serves per-operator/per-customer documents to browsers. Do not route
31
+ * artifact downloads through the snapshot bucket, or vice versa.
32
+ */
33
+ /** Options for a single {@link ObjectStore.put}. Both fields are optional; a
34
+ * store that needs a fixed content length (e.g. R2 with a `ReadableStream`
35
+ * body) uses `contentLength` when present. */
36
+ interface PutObjectOptions {
37
+ /** MIME type recorded with the object (returned by `get`/`head`). Advisory:
38
+ * the proxied download route always serves `application/octet-stream`. */
39
+ contentType?: string;
40
+ /** Byte length of `body`, when known. Some backends require it for a
41
+ * streamed body; the R2 impl passes a known length through when supplied. */
42
+ contentLength?: number;
43
+ }
44
+ /** A retrieved object. `stream()` is the ONLY way to read the bytes — there is
45
+ * deliberately no `text()`/`arrayBuffer()`, so a large object never buffers
46
+ * into the isolate heap. */
47
+ interface ObjectBody {
48
+ /** The object's bytes as a `ReadableStream` (backed by R2's `.body`). */
49
+ stream(): ReadableStream;
50
+ /** Size in bytes. */
51
+ size: number;
52
+ /** Recorded MIME type, if any. */
53
+ contentType?: string;
54
+ }
55
+ /**
56
+ * Portable object-store port. `get`/`head` return `null` on a miss and NEVER
57
+ * throw for a missing key (a miss is a normal control-flow outcome, not an
58
+ * error); `delete` is idempotent.
59
+ */
60
+ interface ObjectStore {
61
+ put(key: string, body: ReadableStream | Uint8Array, opts?: PutObjectOptions): Promise<void>;
62
+ /** `null` on a miss — never throws for a missing key. */
63
+ get(key: string): Promise<ObjectBody | null>;
64
+ /** `null` on a miss — never throws for a missing key. */
65
+ head(key: string): Promise<{
66
+ size: number;
67
+ contentType?: string;
68
+ } | null>;
69
+ delete(key: string): Promise<void>;
70
+ }
71
+ /** Head/metadata shape of a stored object (structural match of R2's `R2Object`). */
72
+ interface R2LikeObjectHead {
73
+ size: number;
74
+ httpMetadata?: {
75
+ contentType?: string;
76
+ };
77
+ }
78
+ /** Body shape of a retrieved object (structural match of R2's `R2ObjectBody`).
79
+ * `body` is the streamed content — the impl reads this, never `.text()`. */
80
+ interface R2LikeObjectBody extends R2LikeObjectHead {
81
+ body: ReadableStream;
82
+ }
83
+ /**
84
+ * The minimal slice of Cloudflare's `R2Bucket` this module calls. A real
85
+ * `R2Bucket` satisfies it structurally, so the consumer passes its binding
86
+ * without this package ever importing `@cloudflare/workers-types` (which would
87
+ * otherwise leak into the public `.d.ts`).
88
+ */
89
+ interface R2LikeBucket {
90
+ put(key: string, value: ReadableStream | Uint8Array | ArrayBuffer, options?: {
91
+ httpMetadata?: {
92
+ contentType?: string;
93
+ };
94
+ }): Promise<unknown>;
95
+ get(key: string): Promise<R2LikeObjectBody | null>;
96
+ head(key: string): Promise<R2LikeObjectHead | null>;
97
+ delete(key: string): Promise<void>;
98
+ }
99
+ /**
100
+ * Map the {@link ObjectStore} port onto an R2 bucket 1:1. `get` STREAMS: it
101
+ * returns the R2 object's `.body` behind `ObjectBody.stream()` and never calls
102
+ * `.text()`/`.arrayBuffer()`, so a large file flows through the worker rather
103
+ * than buffering into the isolate.
104
+ */
105
+ declare function createR2ObjectStore({ bucket }: {
106
+ bucket: R2LikeBucket;
107
+ }): ObjectStore;
108
+ /**
109
+ * Assert a single object-key path SEGMENT (an operator id, customer id, or
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.
115
+ */
116
+ declare function assertSafeKeySegment(s: string): string;
117
+ /** Inputs to {@link objectKey}. `customerId` is optional — an unattributed
118
+ * upload lands under the reserved `_unattributed` customer segment. */
119
+ interface ObjectKeyParts {
120
+ operatorId: string;
121
+ /** Optional — omitted/undefined groups the upload under `_unattributed`. */
122
+ customerId?: string;
123
+ uploadId: string;
124
+ filename: string;
125
+ }
126
+ /**
127
+ * Build the canonical object key: `operator/customer/upload-filename`. The
128
+ * operator, customer, and upload segments are asserted safe (throwing on
129
+ * traversal); the filename is sanitized to a safe leaf. The customer segment
130
+ * falls back to `_unattributed` when no customer is attributed. Because a signed
131
+ * URL binds the EXACT key, the operator and customer segments are part of the
132
+ * privilege wall — a caller cannot later swap them without breaking the
133
+ * signature.
134
+ */
135
+ declare function objectKey({ operatorId, customerId, uploadId, filename }: ObjectKeyParts): string;
136
+ /** Arguments to {@link signObjectUrl}. */
137
+ interface SignObjectUrlArgs {
138
+ /** The exact object key to authorize (from {@link objectKey}). */
139
+ key: string;
140
+ /** Absolute expiry in epoch MILLISECONDS (e.g. `Date.now() + 5 * 60_000` for a
141
+ * ~5-minute TTL — the recommended default; keep it short). */
142
+ exp: number;
143
+ /** HMAC signing secret. Must be non-empty — signing fails closed otherwise. */
144
+ secret: string;
145
+ }
146
+ /**
147
+ * Mint a signed query string (`?key=…&exp=…&sig=…`) authorizing a download of
148
+ * `key` until `exp`. The product appends it to its artifact route path
149
+ * (`` `/artifacts${await signObjectUrl(...)}` ``); {@link createProxiedArtifactRoute}
150
+ * / {@link verifyObjectUrl} read it straight off the request URL, so the route's
151
+ * own mount path never matters.
152
+ *
153
+ * FAIL-CLOSED: throws if `secret` is empty (never mints an unsigned URL) and if
154
+ * `key` is unsafe (traversal). Async because the HMAC primitive is WebCrypto.
155
+ *
156
+ * TTL: `exp` is caller-supplied on purpose (the caller knows the sensitivity);
157
+ * keep it SHORT — ~5 minutes is the recommended default for a privilege-walled
158
+ * document.
159
+ */
160
+ declare function signObjectUrl({ key, exp, secret }: SignObjectUrlArgs): Promise<string>;
161
+ /** Result of {@link verifyObjectUrl}: the canonical key on success, nothing
162
+ * distinguishing on failure (so a rejection leaks no detail). */
163
+ type VerifyObjectUrlResult = {
164
+ ok: true;
165
+ key: string;
166
+ } | {
167
+ ok: false;
168
+ };
169
+ /**
170
+ * Verify a signed download request. Reads `key`/`exp`/`sig` off the request URL,
171
+ * canonicalizes the key identically to the signer, recomputes the HMAC and
172
+ * constant-time-compares it, and checks the expiry. Returns the canonical key on
173
+ * success.
174
+ *
175
+ * FAIL-CLOSED everywhere: an empty `secret`, a missing/ malformed parameter, a
176
+ * non-finite expiry, a signature mismatch, or an expired URL all return
177
+ * `{ ok: false }` — and the mismatch path uses a constant-time compare so a
178
+ * near-correct signature is not distinguishable by timing. Async because the
179
+ * HMAC primitive is WebCrypto.
180
+ */
181
+ declare function verifyObjectUrl(request: Request, { secret }: {
182
+ secret: string;
183
+ }): Promise<VerifyObjectUrlResult>;
184
+ /**
185
+ * Build a download handler that verifies a signed request and STREAMS the object
186
+ * back with a conservative, non-executable content type. Status contract:
187
+ *
188
+ * - `400` — the `key` is missing or malformed (bad encoding / traversal). This
189
+ * is an unauthenticated client error and leaks NOTHING about object existence.
190
+ * - `403` — the signature is missing, wrong, or expired.
191
+ * - `404` — the signature was valid but no object exists at that key (existence
192
+ * is only ever revealed to a validly-signed request).
193
+ * - `200` — streams the bytes with `Content-Disposition: attachment`,
194
+ * `Content-Type: application/octet-stream`, and `X-Content-Type-Options:
195
+ * nosniff`, so the worker never serves active/inline content.
196
+ */
197
+ declare function createProxiedArtifactRoute({ store, secret, }: {
198
+ store: ObjectStore;
199
+ secret: string;
200
+ }): (request: Request) => Promise<Response>;
201
+
202
+ export { type ObjectBody, type ObjectKeyParts, type ObjectStore, type PutObjectOptions, type R2LikeBucket, type R2LikeObjectBody, type R2LikeObjectHead, type SignObjectUrlArgs, type VerifyObjectUrlResult, assertSafeKeySegment, createProxiedArtifactRoute, createR2ObjectStore, objectKey, signObjectUrl, verifyObjectUrl };
@@ -0,0 +1,18 @@
1
+ import {
2
+ assertSafeKeySegment,
3
+ createProxiedArtifactRoute,
4
+ createR2ObjectStore,
5
+ objectKey,
6
+ signObjectUrl,
7
+ verifyObjectUrl
8
+ } from "../chunk-UMSOSUEU.js";
9
+ import "../chunk-S5SRJJQG.js";
10
+ export {
11
+ assertSafeKeySegment,
12
+ createProxiedArtifactRoute,
13
+ createR2ObjectStore,
14
+ objectKey,
15
+ signObjectUrl,
16
+ verifyObjectUrl
17
+ };
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -54,10 +54,11 @@ import {
54
54
  verifySandboxTerminalToken,
55
55
  verifyTerminalProxyToken,
56
56
  writeProfileFilesToBox
57
- } from "../chunk-H4WCEZE3.js";
57
+ } from "../chunk-5GWXCSLQ.js";
58
58
  import "../chunk-E7QYOOON.js";
59
- import "../chunk-3II3AWHY.js";
59
+ import "../chunk-PJC4NXPA.js";
60
60
  import "../chunk-7EVZUIHW.js";
61
+ import "../chunk-S5SRJJQG.js";
61
62
  import "../chunk-7W5XSTUF.js";
62
63
  import "../chunk-MFRCM32T.js";
63
64
  export {
@@ -1,12 +1,12 @@
1
+ import {
2
+ MembersPanel
3
+ } from "../chunk-GNL3MG5J.js";
1
4
  import {
2
5
  InvitationsPanel
3
6
  } from "../chunk-7C64WKAH.js";
4
7
  import {
5
8
  InviteAcceptPage
6
9
  } from "../chunk-VCPZ3HTN.js";
7
- import {
8
- MembersPanel
9
- } from "../chunk-GNL3MG5J.js";
10
10
  import "../chunk-63CE7FEZ.js";
11
11
  export {
12
12
  InvitationsPanel,
@@ -6,7 +6,7 @@ import {
6
6
  restrictTaxonomy,
7
7
  verifyCapabilityToken,
8
8
  verifyExpiringCapabilityToken
9
- } from "../chunk-3II3AWHY.js";
9
+ } from "../chunk-PJC4NXPA.js";
10
10
  import {
11
11
  DEFAULT_APP_TOOL_PATHS,
12
12
  DEFAULT_HEADER_NAMES,
@@ -18,6 +18,7 @@ import {
18
18
  createMcpToolHandler,
19
19
  readToolArgs
20
20
  } from "../chunk-7EVZUIHW.js";
21
+ import "../chunk-S5SRJJQG.js";
21
22
  import {
22
23
  APP_TOOL_NAMES,
23
24
  ToolInputError,
@@ -4,12 +4,13 @@ import { C as ChatInteraction, a as ChatInteractionField, b as ChatInteractionSt
4
4
  export { d as ComposerAnswerDelivery, I as INTERACTION_CANCEL_EVENT, e as INTERACTION_EVENT, f as INTERACTION_RESOLVED_EVENT, h as InteractionPersistedPart, N as NoticeKind, j as NoticePersistedPart, P as ParseInteractionResult, k as canTransitionInteractionStatus, l as cancelStatusFor, m as composerAnswerData, n as composerAnswerDeliveries, o as dedupeQuestionInteractionsByContent, p as fieldAcceptsFreeText, q as interactionFromWireRequest, r as interactionPartKey, s as interactionToPersistedPart, t as isRenderableInteractionKind, u as isSafeInteractionFieldKey, v as isTerminalInteractionStatus, w as noticePart, x as noticePartKey, y as parseInteractionCancel, z as parseInteractionRequest, A as persistedPartToInteraction, B as questionInteractionContentSignature } from '../contract-DYbTzEDf.js';
5
5
  import { InteractionData } from '@tangle-network/agent-interface';
6
6
  export { InteractionData, InteractionOutcome, InteractionRequest } from '@tangle-network/agent-interface';
7
+ import { j as FileMention } from '../file-index-Bw_IQE_G.js';
8
+ export { b as ChatTurnFilePartInput, a as ChatTurnPartInput, C as ChatTurnRequestPayload, g as FileIndexReadyResponse, h as FileIndexResponse, i as FileIndexWarmingResponse, o as buildMentionPromptBlock, p as chatTurnRequestInit, r as fileMentionsToParts, s as mediaTypeForMentionPath } from '../file-index-Bw_IQE_G.js';
7
9
  import { S as StepAgentActivity } from '../agent-activity-C8ZG0F0M.js';
8
10
  import { a as FlowTrace } from '../flow-types-Cb_AblZs.js';
9
11
  export { S as SandboxTerminalConnection, a as SandboxTerminalConnectionResponse, U as UseSandboxTerminalConnectionOptions, b as UseSandboxTerminalConnectionResult, t as tabTerminalConnectionId, u as useSandboxTerminalConnection } from '../sandbox-terminal-BIIC__CP.js';
10
12
  import { CatalogModel } from '../catalog/index.js';
11
13
  import { Harness } from '../harness/index.js';
12
- export { b as ChatTurnFilePartInput, a as ChatTurnPartInput, C as ChatTurnRequestPayload, f as chatTurnRequestInit } from '../wire-BaUF66AS.js';
13
14
 
14
15
  /**
15
16
  * Client-side chat-stream consumption — the NDJSON parse loop every agent
@@ -363,6 +364,97 @@ interface UseChatInteractionsResult {
363
364
  }
364
365
  declare function useChatInteractions(): UseChatInteractionsResult;
365
366
 
367
+ /**
368
+ * `useFileMentions` — the glue a host passes straight into `AgentComposer`'s
369
+ * `mention` prop (`@tangle-network/sandbox-ui#184`) to wire up `@`-file
370
+ * mentions against `createSandboxFileIndexRoute` (`/chat-routes`).
371
+ *
372
+ * Fetches the index once per session from `indexUrl`, refreshes it in the
373
+ * background whenever the popover opens (a `fetchItems` call) if the cached
374
+ * copy has aged past `refreshAfterMs`, and answers every keystroke from an
375
+ * in-memory fuzzy filter — no per-keystroke network round trip. The returned
376
+ * `refresh()` lets a caller force a re-fetch immediately instead of waiting
377
+ * on `refreshAfterMs` — e.g. right after the agent creates a file mid-session.
378
+ *
379
+ * `MentionItem`/the `mention` prop shape mirror the FROZEN contract from
380
+ * sandbox-ui#184 structurally (no import: `/web-react` stays dependency-free
381
+ * beyond React, and `@tangle-network/sandbox-ui` is an optional peer).
382
+ */
383
+
384
+ /** Mirrors sandbox-ui#184's `MentionItem` — the atomic pill's payload. For a
385
+ * file mention, `id` is the workspace-relative path (the pill's stable
386
+ * identity and the `@<id>` serialization sandbox-ui uses to round-trip
387
+ * `value`), `label` is the display name, and `detail` carries the full path
388
+ * for the popover row's secondary line. */
389
+ interface MentionItem {
390
+ id: string;
391
+ label: string;
392
+ detail?: string;
393
+ kind?: string;
394
+ }
395
+ /** Mirrors sandbox-ui#184's `AgentComposerProps['mention']` shape — plug the
396
+ * hook's `mention` return value straight into that prop. */
397
+ interface ComposerMentionProp {
398
+ trigger?: string;
399
+ fetchItems(query: string): Promise<MentionItem[]>;
400
+ onMentionsChange?(mentions: MentionItem[]): void;
401
+ renderItem?(item: MentionItem): ReactNode;
402
+ emptyText?: string;
403
+ }
404
+ /**
405
+ * Ranks `files` against `query` (case-insensitive), capped to `limit`:
406
+ * name-prefix matches first, then name-substring, then path-substring.
407
+ * Within a tier, shorter names sort first (the more specific match), then
408
+ * alphabetically by path for a stable order. An empty query returns the
409
+ * first `limit` entries unranked — the popover's default list before typing.
410
+ * Pure and dependency-free (no fuzzy-match library) so it's cheap enough to
411
+ * re-run on every keystroke against a 10k-entry index.
412
+ */
413
+ declare function rankFileMentions(files: readonly FileMention[], query: string, limit: number): FileMention[];
414
+ /** Max popover results per query — enough to show a useful spread of matches
415
+ * without pushing the fuzzy-filtered list past what a popover can usefully
416
+ * render in one screen. */
417
+ declare const DEFAULT_MENTION_LIMIT = 20;
418
+ /** How long a `ready` index is served before a background refetch — long
419
+ * enough that a full session's worth of popover opens don't repeatedly hit
420
+ * the index endpoint, short enough that a stale listing doesn't linger too
421
+ * far past workspace file changes. Callers who need the index current right
422
+ * now (e.g. just after the agent creates a file) call `refresh()` instead of
423
+ * waiting on this window. */
424
+ declare const INDEX_REFRESH_AFTER_MS: number;
425
+ /** Popover empty-state copy for a `ready` index whose query matched nothing.
426
+ * Loading/warming/error states have their own copy — see `emptyTextFor`. */
427
+ declare const DEFAULT_MENTION_EMPTY_TEXT = "No matching files";
428
+ interface UseFileMentionsOptions {
429
+ /** GET endpoint returning `FileIndexResponse` (a `createSandboxFileIndexRoute`). */
430
+ indexUrl: string;
431
+ /** Max popover results per query. Default {@link DEFAULT_MENTION_LIMIT}. */
432
+ limit?: number;
433
+ /** How long a `ready` index is served without a background refetch.
434
+ * Default {@link INDEX_REFRESH_AFTER_MS}. */
435
+ refreshAfterMs?: number;
436
+ /** `fetch` override for tests / non-global-fetch hosts. Default `fetch`. */
437
+ fetchImpl?: typeof fetch;
438
+ /** Text shown in the popover's empty state once the index is loaded and
439
+ * the query matched nothing. Default {@link DEFAULT_MENTION_EMPTY_TEXT}. */
440
+ emptyText?: string;
441
+ }
442
+ interface UseFileMentionsResult {
443
+ /** Spread straight into `AgentComposer`'s `mention` prop. */
444
+ mention: ComposerMentionProp;
445
+ /** The files currently referenced by mentions in the composer's value —
446
+ * the send-body list (map through `fileMentionsToParts`). */
447
+ mentions: FileMention[];
448
+ /** Drop all currently-referenced mentions (e.g. after a successful send). */
449
+ clearMentions: () => void;
450
+ /** Force a re-fetch of the index right now, ignoring `refreshAfterMs` — for
451
+ * example right after the agent creates a file mid-session, so the next
452
+ * popover open sees it. Dedupes against an already-in-flight load rather
453
+ * than firing a second request. */
454
+ refresh: () => Promise<void>;
455
+ }
456
+ declare function useFileMentions(options: UseFileMentionsOptions): UseFileMentionsResult;
457
+
366
458
  /**
367
459
  * Provider brand marks — real logo path data (simple-icons / SVG Logos, both
368
460
  * CC0) inlined so the picker shows actual provider identity instead of
@@ -792,4 +884,4 @@ declare function useThinkingSeconds(active: boolean): number;
792
884
  */
793
885
  declare function ChatMessages({ messages, models, renderMarkdown, renderExtras, userLabel, agentLabel, loading, approval, onToolCallClick, toolRenderers, error, onRetry, renderEmpty, emptyState, header, }: ChatMessagesProps): react.JSX.Element;
794
886
 
795
- export { type ActivityTone, type AgentActivityPage, AgentActivityPanel, type AgentActivityPanelProps, type AgentActivityRecord, AgentSessionControls, type AgentSessionControlsProps, CatalogModel, ChatComposer, type ChatComposerProps, type ChatEmptyDoor, ChatEmptyState, type ChatEmptyStateProps, ChatInteraction, ChatInteractionField, ChatInteractionStatus, type ChatMessageMetrics, type ChatMessageSegment, ChatMessages, type ChatMessagesProps, ChatSelectField, type ChatStreamCallbacks, type ChatStreamToolCall, type ChatStreamToolResult, type ChatToolCallInfo, type ChatUiMessage, type ComposerFile, type ComposerFilePart, type ConsumeChatStreamResult, DEFAULT_EFFORT_LEVELS, type EffortLevel, EffortPicker, type EffortPickerProps, type FieldValues, FlowWaterfall, type FlowWaterfallProps, INTERACTION_SUBMIT_TIMEOUT_MESSAGE, INTERACTION_SUBMIT_TIMEOUT_MS, InteractionActionButton, type InteractionAnswerSubmission, type InteractionAnswerSubmitterOptions, InteractionBadge, type InteractionBadgeVariant, InteractionCancelData, InteractionPlanCard, type InteractionPlanCardProps, InteractionQuestionCard, type InteractionQuestionCardProps, InteractionRequestWire, type InteractionSubmitResult, MissionActivityLane, type MissionActivityLaneProps, ModelPicker, type ModelPickerProps, type ProposalApprovalHandlers, ProviderLogo, type ProviderLogoProps, QuestionOptionList, type QuestionOptionListProps, RunDrillIn, type RunDrillInProps, SeatPaywall, type SeatPaywallProps, type SmoothRevealOptions, type StreamChatOptions, type SubmitInteractionAnswer, type ToolDetailRenderers, type ToolRunRecord, type ToolRunStep, type UseChatInteractionsResult, type WaterfallRow, activityTone, buildAnswerData, cancelChatInteraction, consumeChatStream, createInteractionAnswerSubmitter, dispatchChatStreamLine, fieldAnswer, formatActivityCost, formatActivityDuration, formatModelCost, formatTokensPerSecond, hasSecretField, interactionStatusLabels, interactionTerminalNotes, isLateAnswerableStatus, lateAnswerMessage, mergeActivityPages, nextRevealCount, pendingApprovalOf, resolveChatInteraction, responseErrorMessage, restoreChatInteractions, streamChatTurn, terminalizePendingChatInteractions, upsertChatInteraction, useChatInteractions, usePending, usePopover, useSmoothText, useThinkingSeconds, waterfallLayout };
887
+ export { type ActivityTone, type AgentActivityPage, AgentActivityPanel, type AgentActivityPanelProps, type AgentActivityRecord, AgentSessionControls, type AgentSessionControlsProps, CatalogModel, ChatComposer, type ChatComposerProps, type ChatEmptyDoor, ChatEmptyState, type ChatEmptyStateProps, ChatInteraction, ChatInteractionField, ChatInteractionStatus, type ChatMessageMetrics, type ChatMessageSegment, ChatMessages, type ChatMessagesProps, ChatSelectField, type ChatStreamCallbacks, type ChatStreamToolCall, type ChatStreamToolResult, type ChatToolCallInfo, type ChatUiMessage, type ComposerFile, type ComposerFilePart, type ComposerMentionProp, type ConsumeChatStreamResult, DEFAULT_EFFORT_LEVELS, DEFAULT_MENTION_EMPTY_TEXT, DEFAULT_MENTION_LIMIT, type EffortLevel, EffortPicker, type EffortPickerProps, type FieldValues, FileMention, FlowWaterfall, type FlowWaterfallProps, INDEX_REFRESH_AFTER_MS, INTERACTION_SUBMIT_TIMEOUT_MESSAGE, INTERACTION_SUBMIT_TIMEOUT_MS, InteractionActionButton, type InteractionAnswerSubmission, type InteractionAnswerSubmitterOptions, InteractionBadge, type InteractionBadgeVariant, InteractionCancelData, InteractionPlanCard, type InteractionPlanCardProps, InteractionQuestionCard, type InteractionQuestionCardProps, InteractionRequestWire, type InteractionSubmitResult, type MentionItem, MissionActivityLane, type MissionActivityLaneProps, ModelPicker, type ModelPickerProps, type ProposalApprovalHandlers, ProviderLogo, type ProviderLogoProps, QuestionOptionList, type QuestionOptionListProps, RunDrillIn, type RunDrillInProps, SeatPaywall, type SeatPaywallProps, type SmoothRevealOptions, type StreamChatOptions, type SubmitInteractionAnswer, type ToolDetailRenderers, type ToolRunRecord, type ToolRunStep, type UseChatInteractionsResult, type UseFileMentionsOptions, type UseFileMentionsResult, type WaterfallRow, activityTone, buildAnswerData, cancelChatInteraction, consumeChatStream, createInteractionAnswerSubmitter, dispatchChatStreamLine, fieldAnswer, formatActivityCost, formatActivityDuration, formatModelCost, formatTokensPerSecond, hasSecretField, interactionStatusLabels, interactionTerminalNotes, isLateAnswerableStatus, lateAnswerMessage, mergeActivityPages, nextRevealCount, pendingApprovalOf, rankFileMentions, resolveChatInteraction, responseErrorMessage, restoreChatInteractions, streamChatTurn, terminalizePendingChatInteractions, upsertChatInteraction, useChatInteractions, useFileMentions, usePending, usePopover, useSmoothText, useThinkingSeconds, waterfallLayout };
@@ -5,8 +5,11 @@ import {
5
5
  ChatEmptyState,
6
6
  ChatMessages,
7
7
  DEFAULT_EFFORT_LEVELS,
8
+ DEFAULT_MENTION_EMPTY_TEXT,
9
+ DEFAULT_MENTION_LIMIT,
8
10
  EffortPicker,
9
11
  FlowWaterfall,
12
+ INDEX_REFRESH_AFTER_MS,
10
13
  INTERACTION_SUBMIT_TIMEOUT_MESSAGE,
11
14
  INTERACTION_SUBMIT_TIMEOUT_MS,
12
15
  InteractionActionButton,
@@ -38,6 +41,7 @@ import {
38
41
  mergeActivityPages,
39
42
  nextRevealCount,
40
43
  pendingApprovalOf,
44
+ rankFileMentions,
41
45
  resolveChatInteraction,
42
46
  responseErrorMessage,
43
47
  restoreChatInteractions,
@@ -45,19 +49,23 @@ import {
45
49
  terminalizePendingChatInteractions,
46
50
  upsertChatInteraction,
47
51
  useChatInteractions,
52
+ useFileMentions,
48
53
  usePending,
49
54
  usePopover,
50
55
  useSmoothText,
51
56
  useThinkingSeconds,
52
57
  waterfallLayout
53
- } from "../chunk-D4HB72W2.js";
58
+ } from "../chunk-KM766NN3.js";
54
59
  import {
55
60
  tabTerminalConnectionId,
56
61
  useSandboxTerminalConnection
57
62
  } from "../chunk-65P3HJY3.js";
58
63
  import {
59
- chatTurnRequestInit
60
- } from "../chunk-5SV5PSU7.js";
64
+ buildMentionPromptBlock,
65
+ chatTurnRequestInit,
66
+ fileMentionsToParts,
67
+ mediaTypeForMentionPath
68
+ } from "../chunk-2EO7CPL3.js";
61
69
  import "../chunk-2QI7XV2T.js";
62
70
  import {
63
71
  INTERACTION_CANCEL_EVENT,
@@ -90,8 +98,11 @@ export {
90
98
  ChatEmptyState,
91
99
  ChatMessages,
92
100
  DEFAULT_EFFORT_LEVELS,
101
+ DEFAULT_MENTION_EMPTY_TEXT,
102
+ DEFAULT_MENTION_LIMIT,
93
103
  EffortPicker,
94
104
  FlowWaterfall,
105
+ INDEX_REFRESH_AFTER_MS,
95
106
  INTERACTION_CANCEL_EVENT,
96
107
  INTERACTION_EVENT,
97
108
  INTERACTION_RESOLVED_EVENT,
@@ -109,6 +120,7 @@ export {
109
120
  SeatPaywall,
110
121
  activityTone,
111
122
  buildAnswerData,
123
+ buildMentionPromptBlock,
112
124
  canTransitionInteractionStatus,
113
125
  cancelChatInteraction,
114
126
  cancelStatusFor,
@@ -121,6 +133,7 @@ export {
121
133
  dispatchChatStreamLine,
122
134
  fieldAcceptsFreeText,
123
135
  fieldAnswer,
136
+ fileMentionsToParts,
124
137
  formatActivityCost,
125
138
  formatActivityDuration,
126
139
  formatModelCost,
@@ -136,6 +149,7 @@ export {
136
149
  isSafeInteractionFieldKey,
137
150
  isTerminalInteractionStatus,
138
151
  lateAnswerMessage,
152
+ mediaTypeForMentionPath,
139
153
  mergeActivityPages,
140
154
  nextRevealCount,
141
155
  noticePart,
@@ -145,6 +159,7 @@ export {
145
159
  pendingApprovalOf,
146
160
  persistedPartToInteraction,
147
161
  questionInteractionContentSignature,
162
+ rankFileMentions,
148
163
  resolveChatInteraction,
149
164
  responseErrorMessage,
150
165
  restoreChatInteractions,
@@ -153,6 +168,7 @@ export {
153
168
  terminalizePendingChatInteractions,
154
169
  upsertChatInteraction,
155
170
  useChatInteractions,
171
+ useFileMentions,
156
172
  usePending,
157
173
  usePopover,
158
174
  useSandboxTerminalConnection,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-app",
3
- "version": "0.43.39",
3
+ "version": "0.43.41",
4
4
  "packageManager": "pnpm@10.33.4",
5
5
  "description": "Application-shell framework for Tangle agent products: a bounded tool loop, the structured agent→app tool side channel, integration-hub client, per-workspace billing, and crypto — composed over the Tangle agent substrate through typed seams.",
6
6
  "keywords": [
@@ -147,6 +147,11 @@
147
147
  "import": "./dist/preflight/index.js",
148
148
  "default": "./dist/preflight/index.js"
149
149
  },
150
+ "./object-store": {
151
+ "types": "./dist/object-store/index.d.ts",
152
+ "import": "./dist/object-store/index.js",
153
+ "default": "./dist/object-store/index.js"
154
+ },
150
155
  "./chat-store": {
151
156
  "types": "./dist/chat-store/index.d.ts",
152
157
  "import": "./dist/chat-store/index.js",