@tangle-network/agent-app 0.44.29 → 0.44.31

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 (45) hide show
  1. package/dist/assistant/index.d.ts +8 -6
  2. package/dist/assistant/index.js +6 -3
  3. package/dist/assistant/index.js.map +1 -1
  4. package/dist/{attachment-validation-Dvc_Livy.d.ts → attachment-validation-CNkH91Gs.d.ts} +1 -1
  5. package/dist/chat-react/index.d.ts +192 -0
  6. package/dist/chat-react/index.js +179 -0
  7. package/dist/chat-react/index.js.map +1 -0
  8. package/dist/chat-routes/index.d.ts +7 -6
  9. package/dist/chat-routes/index.js +12 -8
  10. package/dist/chat-routes/index.js.map +1 -1
  11. package/dist/chat-store/index.d.ts +6 -5
  12. package/dist/chat-store/index.js +2 -1
  13. package/dist/chat-store/index.js.map +1 -1
  14. package/dist/chunk-4OO7P3ZF.js +292 -0
  15. package/dist/chunk-4OO7P3ZF.js.map +1 -0
  16. package/dist/chunk-4PUMUTLU.js +158 -0
  17. package/dist/chunk-4PUMUTLU.js.map +1 -0
  18. package/dist/{chunk-PRKSYTMQ.js → chunk-GCH3BUAZ.js} +31 -317
  19. package/dist/chunk-GCH3BUAZ.js.map +1 -0
  20. package/dist/{chunk-BI6NKSO4.js → chunk-IYLJS6VW.js} +3 -84
  21. package/dist/chunk-IYLJS6VW.js.map +1 -0
  22. package/dist/chunk-QY4BRKRJ.js +84 -0
  23. package/dist/chunk-QY4BRKRJ.js.map +1 -0
  24. package/dist/{chunk-C3SRFZGL.js → chunk-QYAQGCHF.js} +2 -154
  25. package/dist/chunk-QYAQGCHF.js.map +1 -0
  26. package/dist/{contract-CEewO6DI.d.ts → contract-CQNvv5th.d.ts} +1 -1
  27. package/dist/interactions/index.d.ts +2 -2
  28. package/dist/{parts-fyPPdDdK.d.ts → parts-7fbe2rj8.d.ts} +4 -274
  29. package/dist/{queue-vRI0Qx3X.d.ts → queue-VTBA5ONX.d.ts} +1 -1
  30. package/dist/stream/index.d.ts +3 -3
  31. package/dist/{stream-normalizer-DnuqkZvw.d.ts → stream-normalizer-CnPnMaTp.d.ts} +1 -1
  32. package/dist/teams/index.js +5 -5
  33. package/dist/teams/invitations-api.js +4 -4
  34. package/dist/teams-react/index.js +3 -3
  35. package/dist/{types-DB82fktc.d.ts → types-CCeYywdS.d.ts} +1 -1
  36. package/dist/use-file-mentions-E6a7_cbH.d.ts +98 -0
  37. package/dist/web-react/index.d.ts +13 -104
  38. package/dist/web-react/index.js +17 -12
  39. package/dist/wire-DSp4LzEE.d.ts +272 -0
  40. package/dist/work-product/index.d.ts +3 -3
  41. package/dist/work-product-react/index.d.ts +1 -1
  42. package/package.json +6 -1
  43. package/dist/chunk-BI6NKSO4.js.map +0 -1
  44. package/dist/chunk-C3SRFZGL.js.map +0 -1
  45. package/dist/chunk-PRKSYTMQ.js.map +0 -1
@@ -1,278 +1,8 @@
1
1
  import { Part } from '@tangle-network/agent-interface';
2
- import { a as ChatInteractionField, C as ChatInteractionStatus, I as InteractionAnswers, N as NoticeKind } from './contract-CEewO6DI.js';
3
- import { c as WorkProductPersistedPart } from './types-DB82fktc.js';
2
+ import { C as ChatInteractionField, a as ChatInteractionStatus, I as InteractionAnswers, N as NoticeKind } from './contract-CQNvv5th.js';
3
+ import { W as WorkProductPersistedPart } from './types-CCeYywdS.js';
4
4
  import { ChatPlanPersistedPart } from './plans/index.js';
5
-
6
- /**
7
- * Wire contract between the chat client (composer + `streamChatTurn`) and the
8
- * assembled server vertical (`createChatTurnRoutes`). Import-free on purpose:
9
- * `/web-react` re-exports these types into browser bundles, so nothing here may
10
- * reach a Node builtin or an engine package.
11
- *
12
- * The client part shape permits an absolute file path until the server converts
13
- * it to the URL required by the sandbox SDK. It is derived here, not imported,
14
- * so the client bundle never touches the SDK.
15
- */
16
- interface ChatTurnTextPartInput {
17
- type: 'text';
18
- text: string;
19
- }
20
- /** A non-text prompt part the upload route hands back and the client echoes
21
- * on send. `url` carries an inline `data:` URI for small files; `path` is a
22
- * sandbox workspace reference for large ones (the >1 MiB gateway body cap
23
- * makes the two-step upload mandatory). */
24
- interface ChatTurnFilePartInput {
25
- type: 'image' | 'file';
26
- filename?: string;
27
- mediaType?: string;
28
- url?: string;
29
- path?: string;
30
- }
31
- /** Resolve input as either a text part or a file part of a chat turn */
32
- type ChatTurnPartInput = ChatTurnTextPartInput | ChatTurnFilePartInput;
33
- /** Represent a text event produced by a source with a fixed type and associated text content */
34
- interface ProducerTextEvent {
35
- type: 'text';
36
- text: string;
37
- }
38
- /** Define an event representing reasoning output with a fixed type and associated text */
39
- interface ProducerReasoningEvent {
40
- type: 'reasoning';
41
- text: string;
42
- }
43
- /** Represent an event triggered by a producer tool call with its identifier, name, and arguments */
44
- interface ProducerToolCallEvent {
45
- type: 'tool_call';
46
- call: {
47
- toolCallId: string;
48
- toolName: string;
49
- args: Record<string, unknown>;
50
- };
51
- }
52
- /** Describe the structure of an event representing the result of a producer tool call */
53
- interface ProducerToolResultEvent {
54
- type: 'tool_result';
55
- toolCallId: string;
56
- toolName: string;
57
- outcome: {
58
- ok: boolean;
59
- result?: unknown;
60
- message?: string;
61
- };
62
- }
63
- /** Describe usage event with prompt and completion token counts for a producer */
64
- interface ProducerUsageEvent {
65
- type: 'usage';
66
- usage: {
67
- promptTokens: number;
68
- completionTokens: number;
69
- };
70
- }
71
- /** Define the structure for a producer notice event with type, id, kind, and text fields */
72
- interface ProducerNoticeEvent {
73
- type: 'notice';
74
- id: string;
75
- /** Kept inline with `/interactions`' `NoticeKind` so this file stays import-free. */
76
- noticeKind: 'warning' | 'auto-declined';
77
- text: string;
78
- }
79
- /** Represent an error event emitted by a producer containing message, code, and optional details */
80
- interface ProducerErrorEvent {
81
- type: 'error';
82
- data: {
83
- message: string;
84
- code?: string;
85
- details?: Record<string, unknown>;
86
- };
87
- }
88
- /** Stable raw lifecycle/interaction/plan/route events forwarded unchanged. */
89
- type ProducerPassthroughEventType = 'turn' | 'metadata' | 'interaction' | 'interaction.cancel' | 'plan.submitted' | 'done' | 'warning' | 'session.run.started' | 'session.run.completed' | 'session.run.failed' | 'turn_status';
90
- /** Define an event carrying passthrough data with flexible properties for producer communication */
91
- interface ProducerPassthroughEvent {
92
- type: ProducerPassthroughEventType;
93
- data?: Record<string, unknown>;
94
- /** Route markers and raw passthroughs may carry `turnId`, `status`, `seq`, etc. */
95
- [key: string]: unknown;
96
- }
97
- /** Represent events emitted by a producer during its operation for processing and handling */
98
- type ProducerWireEvent = ProducerTextEvent | ProducerReasoningEvent | ProducerToolCallEvent | ProducerToolResultEvent | ProducerUsageEvent | ProducerNoticeEvent | ProducerErrorEvent | ProducerPassthroughEvent;
99
- /** The image/file split an attachment is rendered and persisted under — the
100
- * same discriminant as {@link ChatMentionKind}, but a distinct name because an
101
- * attachment carries content the product uploaded (`ChatAttachmentInput`)
102
- * while a mention points at a file the box already has. Defined HERE (the
103
- * import-free layer) so `ChatAttachmentInput` can reference it and the client
104
- * composer imports it without pulling the persisted-part vocabulary;
105
- * `/chat-store`'s parts module re-exports it alongside the attachment helpers. */
106
- type ChatAttachmentKind = 'image' | 'file';
107
- /** `POST` turn-body entry describing a file already uploaded to the product's
108
- * store (vault/object-store) — distinct from an inline {@link
109
- * ChatTurnFilePartInput} (which carries bytes) and from a {@link FileMention}
110
- * (a sandbox path the box already holds). The route resolves this field with
111
- * {@link resolveChatAttachments}: every path is re-validated and every size is
112
- * re-derived from the stored body, so nothing here is trusted as sent. */
113
- interface ChatAttachmentInput {
114
- path: string;
115
- name: string;
116
- size: number;
117
- mediaType: string;
118
- kind: ChatAttachmentKind;
119
- }
120
- /** POST body for the turn route. `content` may be empty when `parts` carry the
121
- * message (an image-only send). Product routing fields (workspaceId etc.) ride
122
- * alongside and are read by the product's `authorize` seam. */
123
- interface ChatTurnRequestPayload {
124
- threadId: string;
125
- content?: string;
126
- /** Non-text parts from the upload route, echoed back verbatim. */
127
- parts?: ChatTurnFilePartInput[];
128
- /** `@`-picked file mentions for this turn — path references into the
129
- * workspace sandbox, NOT uploads, so they travel in their own field rather
130
- * than as `parts` entries. A product whose `parts` field is already spoken
131
- * for (an attachment sentinel) can still send mentions, and mentions
132
- * persist as their own `ChatMentionPart`s so a retry rebuilds them. The
133
- * route validates this field with {@link parseFileMentions} and replaces it
134
- * on the payload with the validated, deduped list. */
135
- mentions?: FileMention[];
136
- /** Files uploaded to the product's store ahead of the turn — path
137
- * references, NOT inline bytes (those ride `parts`). Validated and
138
- * size-re-derived by {@link resolveChatAttachments} into persistable
139
- * attachment parts; a product whose `parts` field is spoken for by inline
140
- * uploads still sends store-backed files here. */
141
- attachments?: ChatAttachmentInput[];
142
- model?: string;
143
- effort?: 'auto' | 'low' | 'medium' | 'high';
144
- harness?: string;
145
- /** Client-generated idempotency key for the logical turn (retry-safe). */
146
- turnId?: string;
147
- [key: string]: unknown;
148
- }
149
- /** `fetch` init for the turn route — the one place the client wire shape is
150
- * serialized, so composer glue and products never drift from the server's
151
- * parser. */
152
- declare function chatTurnRequestInit(payload: ChatTurnRequestPayload): RequestInit;
153
- /** Define the maximum byte size allowed for inline parts in data processing */
154
- declare const INLINE_PARTS_MAX_BYTES = 950000;
155
- /** Hard cap on the whole `/prompt` request body as it crosses the sandbox
156
- * proxy — smaller in practice than a raw-file write cap because a dispatch
157
- * carries several inline parts plus the flattened history in one request. */
158
- declare const DISPATCH_REQUEST_MAX_BYTES: number;
159
- /** Bytes reserved off the top of {@link DISPATCH_REQUEST_MAX_BYTES} for the
160
- * JSON structure around the parts array (keys, delimiters, per-part
161
- * `type`/`filename`/`mediaType` fields) that {@link base64WireLen} does not
162
- * account for — keeps the inline budget off the exact proxy cap where one
163
- * stray byte trips the 413. */
164
- declare const DISPATCH_STRUCTURAL_RESERVE_BYTES: number;
165
- /** Sidecar's hard cap on the `parts` array of one prompt request — a dispatch
166
- * must never assemble more parts than this or the whole turn 400s. */
167
- declare const DISPATCH_MAX_PARTS = 64;
168
- /** Product-side cap on media parts per dispatch (current turn + carried
169
- * history), well under {@link DISPATCH_MAX_PARTS}. History trimming that keeps
170
- * a transcript's native media under this is a PRODUCT concern (the pointer
171
- * block keeps trimmed media reachable); `buildDispatchParts` enforces only the
172
- * total {@link DISPATCH_MAX_PARTS} cap. */
173
- declare const DISPATCH_MAX_MEDIA_PARTS = 24;
174
- /** Size a base64-encoded string occupies on the wire given the raw
175
- * (pre-encoding) byte length: base64 packs 3 raw bytes into 4 output
176
- * characters, rounded up to the next multiple of 4. */
177
- declare function base64WireLen(byteLen: number): number;
178
- /**
179
- * Render a raw byte count as a human-readable size (`512B`, `3KB`, `12MB
180
- * 500KB`). Ported EXACTLY from gtm-agent's `attachment-limits.ts` — byte-
181
- * identical implementation, not a reinterpretation — so `resolve-attachments`'s
182
- * and `promote-file-part`'s error strings match gtm's wording verbatim. Lives
183
- * in the import-free wire layer (not `resolve-attachments.ts` alone) because
184
- * BOTH the aggregate-cap message here and the per-file oversize message in
185
- * `promote-file-part.ts` need it; a browser composer wanting the same
186
- * formatting for a client-side pre-check can also import it with no engine
187
- * pulled in.
188
- */
189
- declare function formatBytes(bytes: number): string;
190
- /** Represent errors for invalid chat turn inputs with status and code properties */
191
- declare class ChatTurnInputError extends Error {
192
- readonly status: number;
193
- readonly code: string;
194
- constructor(message: string, status?: number, code?: string);
195
- }
196
- /** Calculate the total byte size of an array of chat turn parts */
197
- declare function promptPartsByteSize(parts: ChatTurnPartInput[]): number;
198
- /** Throws `ChatTurnInputError` (413) when the parts' inline payload would blow
199
- * the gateway cap. Path-ref parts are tiny by construction and always pass. */
200
- declare function assertPromptPartsWithinCap(parts: ChatTurnPartInput[], maxBytes?: number): void;
201
- /** A file mention resolved from the composer's `@`-picker: the
202
- * workspace-relative path plus enough metadata to build a prompt part and
203
- * pointer text. `path` is the canonical identity — the mention pill's
204
- * `MentionItem.id` for the file kind (`/web-react`'s `useFileMentions`). */
205
- interface FileMention {
206
- path: string;
207
- name: string;
208
- size?: number;
209
- }
210
- /** The `image/*` mime for a mention path by extension, or `undefined` for
211
- * anything not in the known image set (dispatched as `type: 'file'`). */
212
- declare function mediaTypeForMentionPath(path: string): string | undefined;
213
- /** The image/file split a mention is rendered and persisted under — the
214
- * composer pill's icon, the dispatched part's `type`, and
215
- * `ChatMentionPart.mentionKind` are all this one value. */
216
- type ChatMentionKind = 'image' | 'file';
217
- /** `image` when the path's extension is in the known image set (the same table
218
- * {@link mediaTypeForMentionPath} reads), `file` otherwise. Exported so a
219
- * client that needs only the discriminant — a pill icon, a persisted part's
220
- * `mentionKind` — never re-declares the extension table; two frozen copies of
221
- * one mime table is how one gains a format and the other doesn't. */
222
- declare function mentionKindForPath(path: string): ChatMentionKind;
223
- /** Define options to resolve mention paths when converting file mentions to parts */
224
- interface FileMentionsToPartsOptions {
225
- /** Resolve a mention's workspace-relative path to the absolute path the
226
- * dispatched part should carry (e.g. a host prefixing the in-box vault
227
- * root). Default: identity — the path travels unchanged. */
228
- resolvePath?: (path: string) => string;
229
- }
230
- /** Maps resolved file mentions to path-only `ChatTurnFilePartInput`s —
231
- * `image` vs `file` by extension, and always a `path`, never a `url` (the
232
- * url/path XOR invariant: a mention is a sandbox path reference, never
233
- * inline bytes). */
234
- declare function fileMentionsToParts(mentions: readonly FileMention[], opts?: FileMentionsToPartsOptions): ChatTurnFilePartInput[];
235
- /** The agent-facing pointer block appended to the dispatched prompt — never
236
- * persisted in message `content`. Empty array → `''` so callers can append
237
- * unconditionally. This is the sole producer of that text: the current
238
- * turn's dispatch and any history projection built from the same mention
239
- * list both route through here, so the two can't drift apart. */
240
- declare function buildMentionPromptBlock(mentions: readonly Pick<FileMention, 'name' | 'path'>[]): string;
241
- /** Hard cap on mentions per turn. Bounds the prompt pointer block, the
242
- * persisted parts, and whatever media budget a dispatch draws from them. */
243
- declare const MENTION_MAX_COUNT = 16;
244
- /** Represent the result of a sandbox mention path check indicating success or failure with an error message */
245
- type SandboxMentionPathCheck = {
246
- succeeded: true;
247
- } | {
248
- succeeded: false;
249
- error: string;
250
- };
251
- /**
252
- * Validate a workspace-relative sandbox mention path. Rejects traversal (a
253
- * `..` path segment), absolute paths (leading `/`), backslashes, and null
254
- * bytes — the four ways a path picked in a client can escape the root the
255
- * index route scanned.
256
- *
257
- * Spaces and unicode are deliberately ALLOWED: in-box filenames are arbitrary,
258
- * and an ASCII-only charset would silently drop real files from a feature
259
- * whose whole job is naming them.
260
- */
261
- declare function validateSandboxMentionPath(path: unknown): SandboxMentionPathCheck;
262
- /**
263
- * Validates the untyped `mentions` array off the wire, mirroring
264
- * {@link parseChatTurnParts}: the typed list, or `ChatTurnInputError` (400)
265
- * naming the offending entry. Never sanitizes-and-continues — a traversal path
266
- * is a rejected request, not a trimmed one.
267
- *
268
- * A path repeated within one turn is deduped to its first occurrence rather
269
- * than rejected: mentioning the same file twice is plausible user input, not
270
- * an attack.
271
- */
272
- declare function parseFileMentions(raw: unknown): FileMention[];
273
- /** Validates the untyped `parts` array off the wire. Returns the typed parts
274
- * or throws `ChatTurnInputError` (400) naming the offending entry. */
275
- declare function parseChatTurnParts(raw: unknown): ChatTurnFilePartInput[];
5
+ import { C as ChatMentionKind, a as ChatAttachmentKind, b as ChatAttachmentInput, F as FileMention } from './wire-DSp4LzEE.js';
276
6
 
277
7
  /**
278
8
  * The stored shape of `message.parts` — one typed vocabulary for every part a
@@ -606,4 +336,4 @@ declare function historyContentWithAttachments(message: {
606
336
  parts?: ReadonlyArray<Record<string, unknown>> | null;
607
337
  }, header?: string): string;
608
338
 
609
- export { type ProducerErrorEvent as $, isChatInteractionPart as A, isChatMentionPart as B, type ChatMessagePart as C, DEFAULT_ATTACHMENT_PROMPT_HEADER as D, isChatPlanPart as E, isChatStepFinishPart as F, isChatTextPart as G, isChatToolPart as H, isChatWorkProductPart as I, mentionInputToPart as J, mentionPartsFromMessageParts as K, toChatMessageParts as L, type FileMention as M, type ChatTurnRequestPayload as N, type ChatTurnPartInput as O, type ChatTurnFilePartInput as P, type ChatAttachmentInput as Q, ChatTurnInputError as R, type StorableHarnessPartKind as S, type ChatTurnTextPartInput as T, DISPATCH_MAX_MEDIA_PARTS as U, DISPATCH_MAX_PARTS as V, DISPATCH_REQUEST_MAX_BYTES as W, DISPATCH_STRUCTURAL_RESERVE_BYTES as X, type FileMentionsToPartsOptions as Y, INLINE_PARTS_MAX_BYTES as Z, MENTION_MAX_COUNT as _, type ChatAttachmentKind as a, type ProducerNoticeEvent as a0, type ProducerPassthroughEvent as a1, type ProducerPassthroughEventType as a2, type ProducerReasoningEvent as a3, type ProducerTextEvent as a4, type ProducerToolCallEvent as a5, type ProducerToolResultEvent as a6, type ProducerUsageEvent as a7, type ProducerWireEvent as a8, type SandboxMentionPathCheck as a9, assertPromptPartsWithinCap as aa, base64WireLen as ab, buildMentionPromptBlock as ac, chatTurnRequestInit as ad, fileMentionsToParts as ae, formatBytes as af, mediaTypeForMentionPath as ag, mentionKindForPath as ah, parseChatTurnParts as ai, parseFileMentions as aj, promptPartsByteSize as ak, validateSandboxMentionPath as al, type ChatAttachmentPart as b, type ChatFilePart as c, type ChatImagePart as d, type ChatInteractionPart as e, type ChatMentionKind as f, type ChatMentionPart as g, type ChatNoticePart as h, type ChatPartTime as i, type ChatPlanPart as j, type ChatReasoningPart as k, type ChatStepFinishPart as l, type ChatStepStartPart as m, type ChatSubtaskPart as n, type ChatTextPart as o, type ChatToolPart as p, type ChatToolState as q, type ChatToolStatus as r, type ChatUsageTokens as s, type ChatWorkProductPart as t, attachmentInputToPart as u, attachmentKindForMime as v, attachmentPartsFromMessageParts as w, buildAttachmentPromptBlock as x, historyContentWithAttachments as y, isChatAttachmentPart as z };
339
+ export { isChatPlanPart as A, isChatStepFinishPart as B, type ChatMessagePart as C, DEFAULT_ATTACHMENT_PROMPT_HEADER as D, isChatTextPart as E, isChatToolPart as F, isChatWorkProductPart as G, mentionInputToPart as H, mentionPartsFromMessageParts as I, toChatMessageParts as J, type StorableHarnessPartKind as S, type ChatAttachmentPart as a, type ChatFilePart as b, type ChatImagePart as c, type ChatInteractionPart as d, type ChatMentionPart as e, type ChatNoticePart as f, type ChatPartTime as g, type ChatPlanPart as h, type ChatReasoningPart as i, type ChatStepFinishPart as j, type ChatStepStartPart as k, type ChatSubtaskPart as l, type ChatTextPart as m, type ChatToolPart as n, type ChatToolState as o, type ChatToolStatus as p, type ChatUsageTokens as q, type ChatWorkProductPart as r, attachmentInputToPart as s, attachmentKindForMime as t, attachmentPartsFromMessageParts as u, buildAttachmentPromptBlock as v, historyContentWithAttachments as w, isChatAttachmentPart as x, isChatInteractionPart as y, isChatMentionPart as z };
@@ -1,4 +1,4 @@
1
- import { W as WorkProductRef, a as WorkProductProvenance, b as WorkProductRecord } from './types-DB82fktc.js';
1
+ import { a as WorkProductRef, b as WorkProductProvenance, c as WorkProductRecord } from './types-CCeYywdS.js';
2
2
 
3
3
  /**
4
4
  * The review queue is a PROJECTION, not a store — a client-safe pure fold of
@@ -1,7 +1,7 @@
1
- import { J as JsonRecord } from '../stream-normalizer-DnuqkZvw.js';
2
- export { M as MISSING_TOOL_TERMINAL_ERROR, b as MISSING_TOOL_TERMINAL_REASON, S as StreamEvent, c as asRecord, d as asString, a as attachmentPartKey, e as collapseRedundantTextParts, f as draftAssistantParts, g as encodeEvent, h as finalizeAssistantParts, i as finalizePendingInteractionParts, j as getPartKey, m as mergePersistedPart, n as normalizePersistedPart, k as normalizeTime, l as normalizeToolEvent, r as resolveToolId, o as resolveToolName, t as terminalizeDanglingAssistantToolUpdates, p as terminalizeDanglingToolPart, q as terminalizeDanglingToolParts } from '../stream-normalizer-DnuqkZvw.js';
1
+ import { J as JsonRecord } from '../stream-normalizer-CnPnMaTp.js';
2
+ export { M as MISSING_TOOL_TERMINAL_ERROR, b as MISSING_TOOL_TERMINAL_REASON, S as StreamEvent, c as asRecord, d as asString, a as attachmentPartKey, e as collapseRedundantTextParts, f as draftAssistantParts, g as encodeEvent, h as finalizeAssistantParts, i as finalizePendingInteractionParts, j as getPartKey, m as mergePersistedPart, n as normalizePersistedPart, k as normalizeTime, l as normalizeToolEvent, r as resolveToolId, o as resolveToolName, t as terminalizeDanglingAssistantToolUpdates, p as terminalizeDanglingToolPart, q as terminalizeDanglingToolParts } from '../stream-normalizer-CnPnMaTp.js';
3
3
  export { B as BufferedTurnEvent, a as BufferedTurnOptions, b as BufferedTurnTap, D as D1LikeForTurns, P as PumpBufferedTurnOptions, R as ReplayTurnEventsOptions, c as TURN_EVENTS_MIGRATION_SQL, d as TURN_STATUS_SCOPE_MIGRATION_SQL, T as TurnEventStore, e as TurnStatus, f as coalesceChatStreamEvents, g as coalesceDeltas, h as createBufferedTurnTap, i as createD1TurnEventStore, j as createMemoryTurnEventStore, p as pumpBufferedTurn, r as replayTurnEvents, s as stampReplaySeq } from '../turn-buffer-BcPfhr1_.js';
4
- import '../contract-CEewO6DI.js';
4
+ import '../contract-CQNvv5th.js';
5
5
  import '@tangle-network/agent-interface';
6
6
 
7
7
  /** Define the structure of a chat message stored for a specific conversation turn */
@@ -1,4 +1,4 @@
1
- import { C as ChatInteractionStatus } from './contract-CEewO6DI.js';
1
+ import { a as ChatInteractionStatus } from './contract-CQNvv5th.js';
2
2
 
3
3
  /** Represent a JSON-compatible object with string keys and values of any type */
4
4
  type JsonRecord = Record<string, unknown>;
@@ -1,3 +1,8 @@
1
+ import {
2
+ generateInviteToken,
3
+ isInviteTokenShape,
4
+ validateInviteToken
5
+ } from "../chunk-DJ4VJIH5.js";
1
6
  import {
2
7
  INVITATION_EXPIRY_DAYS,
3
8
  generateInvitationToken,
@@ -7,11 +12,6 @@ import {
7
12
  parseInvitationPermission,
8
13
  renderInvitationEmail
9
14
  } from "../chunk-2DRYTJHI.js";
10
- import {
11
- generateInviteToken,
12
- isInviteTokenShape,
13
- validateInviteToken
14
- } from "../chunk-DJ4VJIH5.js";
15
15
  import {
16
16
  ASSIGNABLE_WORKSPACE_ROLES,
17
17
  ORGANIZATION_ROLES,
@@ -1,3 +1,7 @@
1
+ import {
2
+ SeatLimitError
3
+ } from "../chunk-MEUNTJL5.js";
4
+ import "../chunk-DJ4VJIH5.js";
1
5
  import {
2
6
  generateInvitationToken,
3
7
  getInvitationExpiresAt,
@@ -5,10 +9,6 @@ import {
5
9
  normalizeInvitationEmail,
6
10
  parseInvitationPermission
7
11
  } from "../chunk-2DRYTJHI.js";
8
- import {
9
- SeatLimitError
10
- } from "../chunk-MEUNTJL5.js";
11
- import "../chunk-DJ4VJIH5.js";
12
12
  import {
13
13
  hasWorkspaceRole
14
14
  } from "../chunk-6XIAPIW6.js";
@@ -1,12 +1,12 @@
1
+ import {
2
+ InvitationsPanel
3
+ } from "../chunk-5SXS3YAB.js";
1
4
  import {
2
5
  InviteAcceptPage
3
6
  } from "../chunk-VCPZ3HTN.js";
4
7
  import {
5
8
  MembersPanel
6
9
  } from "../chunk-S564OFTL.js";
7
- import {
8
- InvitationsPanel
9
- } from "../chunk-5SXS3YAB.js";
10
10
  import "../chunk-6XIAPIW6.js";
11
11
  export {
12
12
  InvitationsPanel,
@@ -297,4 +297,4 @@ declare function workProductToPersistedPart(record: WorkProductRecord): WorkProd
297
297
  /** Re-validate a stored/wire part into the typed anchor; null for junk. */
298
298
  declare function persistedPartToWorkProduct(part: Record<string, unknown>): WorkProductPersistedPart | null;
299
299
 
300
- export { type AgentCheckInput as A, type EvidenceEntry as E, type ProfileBacktestSummary as P, type QualityCheck as Q, type WorkProductRef as W, type WorkProductProvenance as a, type WorkProductRecord as b, type WorkProductPersistedPart as c, type WorkProductStorePort as d, type WorkProductAuditEvent as e, type WorkProductArtifact as f, type ExceptionEntry as g, type WorkProductStatus as h, type EvidenceLocator as i, type EvidenceSpan as j, type ExceptionSeverity as k, type QuoteBasis as l, type WorkProductParseResult as m, type WorkProductPatch as n, type WorkProductUpdateGuard as o, type WorkProductVersionEntry as p, isWorkProductStatus as q, parseAgentCheckInput as r, parseArtifactInput as s, parseEvidenceInput as t, parseExceptionInput as u, persistedPartToWorkProduct as v, unresolvedBlockingExceptions as w, workProductToPersistedPart as x };
300
+ export { type AgentCheckInput as A, type EvidenceEntry as E, type ProfileBacktestSummary as P, type QualityCheck as Q, type WorkProductPersistedPart as W, type WorkProductRef as a, type WorkProductProvenance as b, type WorkProductRecord as c, type WorkProductStorePort as d, type WorkProductAuditEvent as e, type WorkProductArtifact as f, type ExceptionEntry as g, type WorkProductStatus as h, type EvidenceLocator as i, type EvidenceSpan as j, type ExceptionSeverity as k, type QuoteBasis as l, type WorkProductParseResult as m, type WorkProductPatch as n, type WorkProductUpdateGuard as o, type WorkProductVersionEntry as p, isWorkProductStatus as q, parseAgentCheckInput as r, parseArtifactInput as s, parseEvidenceInput as t, parseExceptionInput as u, persistedPartToWorkProduct as v, unresolvedBlockingExceptions as w, workProductToPersistedPart as x };
@@ -0,0 +1,98 @@
1
+ import { ReactNode } from 'react';
2
+ import { F as FileMention } from './wire-DSp4LzEE.js';
3
+
4
+ /**
5
+ * `useFileMentions` — the glue a host passes straight into `AgentComposer`'s
6
+ * `mention` prop (`@tangle-network/sandbox-ui#184`) to wire up `@`-file
7
+ * mentions against `createSandboxFileIndexRoute` (`/chat-routes`).
8
+ *
9
+ * Fetches the index once per session from `indexUrl`, refreshes it in the
10
+ * background whenever the popover opens (a `fetchItems` call) if the cached
11
+ * copy has aged past `refreshAfterMs`, and answers every keystroke from an
12
+ * in-memory fuzzy filter — no per-keystroke network round trip. The returned
13
+ * `refresh()` lets a caller force a re-fetch immediately instead of waiting
14
+ * on `refreshAfterMs` — e.g. right after the agent creates a file mid-session.
15
+ *
16
+ * `MentionItem`/the `mention` prop shape mirror the FROZEN contract from
17
+ * sandbox-ui#184 structurally (no import: `/web-react` stays dependency-free
18
+ * beyond React, and `@tangle-network/sandbox-ui` is an optional peer).
19
+ */
20
+
21
+ /** Mirrors sandbox-ui#184's `MentionItem` — the atomic pill's payload. For a
22
+ * file mention, `id` is the workspace-relative path (the pill's stable
23
+ * identity and the `@<id>` serialization sandbox-ui uses to round-trip
24
+ * `value`), `label` is the display name, and `detail` carries the full path
25
+ * for the popover row's secondary line. */
26
+ interface MentionItem {
27
+ id: string;
28
+ label: string;
29
+ detail?: string;
30
+ kind?: string;
31
+ }
32
+ /** Mirrors sandbox-ui#184's `AgentComposerProps['mention']` shape — plug the
33
+ * hook's `mention` return value straight into that prop. */
34
+ interface ComposerMentionProp {
35
+ trigger?: string;
36
+ fetchItems(query: string): Promise<MentionItem[]>;
37
+ onMentionsChange?(mentions: MentionItem[]): void;
38
+ renderItem?(item: MentionItem): ReactNode;
39
+ emptyText?: string;
40
+ }
41
+ /**
42
+ * Ranks `files` against `query` (case-insensitive), capped to `limit`:
43
+ * name-prefix matches first, then name-substring, then path-substring.
44
+ * Within a tier, shorter names sort first (the more specific match), then
45
+ * alphabetically by path for a stable order. An empty query returns the
46
+ * first `limit` entries unranked — the popover's default list before typing.
47
+ * Pure and dependency-free (no fuzzy-match library) so it's cheap enough to
48
+ * re-run on every keystroke against a 10k-entry index.
49
+ */
50
+ declare function rankFileMentions(files: readonly FileMention[], query: string, limit: number): FileMention[];
51
+ /** Max popover results per query — enough to show a useful spread of matches
52
+ * without pushing the fuzzy-filtered list past what a popover can usefully
53
+ * render in one screen. */
54
+ declare const DEFAULT_MENTION_LIMIT = 20;
55
+ /** How long a `ready` index is served before a background refetch — long
56
+ * enough that a full session's worth of popover opens don't repeatedly hit
57
+ * the index endpoint, short enough that a stale listing doesn't linger too
58
+ * far past workspace file changes. Callers who need the index current right
59
+ * now (e.g. just after the agent creates a file) call `refresh()` instead of
60
+ * waiting on this window. */
61
+ declare const INDEX_REFRESH_AFTER_MS: number;
62
+ /** Popover empty-state copy for a `ready` index whose query matched nothing.
63
+ * Loading/warming/error states have their own copy — see `emptyTextFor`. */
64
+ declare const DEFAULT_MENTION_EMPTY_TEXT = "No matching files";
65
+ /** Define options for configuring file mention fetching, caching, and display behavior */
66
+ interface UseFileMentionsOptions {
67
+ /** GET endpoint returning `FileIndexResponse` (a `createSandboxFileIndexRoute`). */
68
+ indexUrl: string;
69
+ /** Max popover results per query. Default {@link DEFAULT_MENTION_LIMIT}. */
70
+ limit?: number;
71
+ /** How long a `ready` index is served without a background refetch.
72
+ * Default {@link INDEX_REFRESH_AFTER_MS}. */
73
+ refreshAfterMs?: number;
74
+ /** `fetch` override for tests / non-global-fetch hosts. Default `fetch`. */
75
+ fetchImpl?: typeof fetch;
76
+ /** Text shown in the popover's empty state once the index is loaded and
77
+ * the query matched nothing. Default {@link DEFAULT_MENTION_EMPTY_TEXT}. */
78
+ emptyText?: string;
79
+ }
80
+ /** Provide properties and methods to manage and refresh file mentions in a composer interface */
81
+ interface UseFileMentionsResult {
82
+ /** Spread straight into `AgentComposer`'s `mention` prop. */
83
+ mention: ComposerMentionProp;
84
+ /** The files currently referenced by mentions in the composer's value —
85
+ * the send-body list (map through `fileMentionsToParts`). */
86
+ mentions: FileMention[];
87
+ /** Drop all currently-referenced mentions (e.g. after a successful send). */
88
+ clearMentions: () => void;
89
+ /** Force a re-fetch of the index right now, ignoring `refreshAfterMs` — for
90
+ * example right after the agent creates a file mid-session, so the next
91
+ * popover open sees it. Dedupes against an already-in-flight load rather
92
+ * than firing a second request. */
93
+ refresh: () => Promise<void>;
94
+ }
95
+ /** Resolve and manage file mention data with configurable fetching and state handling */
96
+ declare function useFileMentions(options: UseFileMentionsOptions): UseFileMentionsResult;
97
+
98
+ export { type ComposerMentionProp as C, DEFAULT_MENTION_EMPTY_TEXT as D, INDEX_REFRESH_AFTER_MS as I, type MentionItem as M, type UseFileMentionsResult as U, DEFAULT_MENTION_LIMIT as a, type UseFileMentionsOptions as b, rankFileMentions as r, useFileMentions as u };