@vantageos/mosaic-blocks 0.5.10-alpha → 0.5.13-alpha
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.
- package/README.md +13 -10
- package/dist/index.cjs +349 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +437 -2
- package/dist/index.d.ts +437 -2
- package/dist/index.js +347 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -20,7 +20,7 @@ import { Switch } from '@base-ui/react/switch';
|
|
|
20
20
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
21
21
|
export { Tooltip } from '@base-ui/react/tooltip';
|
|
22
22
|
|
|
23
|
-
declare const version = "0.5.
|
|
23
|
+
declare const version = "0.5.13-alpha";
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Placeholder component — infra scaffold only.
|
|
@@ -6178,4 +6178,439 @@ declare const toolToggleListRowVariants: (props?: ({
|
|
|
6178
6178
|
enabled?: boolean | null | undefined;
|
|
6179
6179
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
6180
6180
|
|
|
6181
|
-
|
|
6181
|
+
/**
|
|
6182
|
+
* MosaicApiKeyPanel — presentational "bring your own key" (BYOK) panel.
|
|
6183
|
+
*
|
|
6184
|
+
* Presentational atom. Renders per-provider tabs (data-driven — the host
|
|
6185
|
+
* supplies the provider list, never a hardcoded set), a masked
|
|
6186
|
+
* (`type="password"`) key input, a validate button, and one of four
|
|
6187
|
+
* host-controlled statuses: at rest (idle), validating, valid (with a
|
|
6188
|
+
* masked hint of the last 4 characters of an already-saved key), or
|
|
6189
|
+
* invalid (with a host-supplied error message). The component never
|
|
6190
|
+
* contacts any server or SDK: submitting the form calls the host callback
|
|
6191
|
+
* `onValidate(providerId, key)` — the host owns how the key is checked
|
|
6192
|
+
* against its provider (Vercel AI Gateway, OpenRouter, or anything else it
|
|
6193
|
+
* lists) and how long it takes.
|
|
6194
|
+
*
|
|
6195
|
+
* Security (non-negotiable, see JSDoc on each prop below): the raw key is
|
|
6196
|
+
* never logged, never written to storage by this library, and never
|
|
6197
|
+
* placed in any DOM attribute other than the password input's own
|
|
6198
|
+
* `value` (the same place any host-controlled `<input type="password">`
|
|
6199
|
+
* necessarily holds it while the user types). No `console.*` call touches
|
|
6200
|
+
* the key. Only the last 4 characters of an *already-saved* key are ever
|
|
6201
|
+
* displayed, and only because the host explicitly supplies them via
|
|
6202
|
+
* `savedKeyLastFour` on the "valid" branch — this component computes
|
|
6203
|
+
* nothing from a live key itself.
|
|
6204
|
+
*
|
|
6205
|
+
* Pattern: MosaicUrlScraper.tsx (data-slot, inline cn, React 19 ref prop,
|
|
6206
|
+
* displayName, JSDoc, pure variants module, host-controlled status union
|
|
6207
|
+
* as a discriminated prop type, per-branch required props).
|
|
6208
|
+
* No "use client" — prepend-use-client.mjs adds it to dist.
|
|
6209
|
+
* Design tokens: --foreground, --muted-foreground, --border, --destructive,
|
|
6210
|
+
* --ring, --accent, --card, --background.
|
|
6211
|
+
* No icon library.
|
|
6212
|
+
* a11y: the provider selector is a `role="radiogroup"` with a required
|
|
6213
|
+
* `tabsAriaLabel`; each tab is a `role="radio"` with `aria-checked`; the
|
|
6214
|
+
* key input has a required accessible name; the validating region uses
|
|
6215
|
+
* `role="status"`.
|
|
6216
|
+
* Bilingual: every user-facing string (tab labels/tabs aria-label/input
|
|
6217
|
+
* aria-label/validate button label/validating label/saved-key hint
|
|
6218
|
+
* label/remove button label/error message) is a required caller-supplied
|
|
6219
|
+
* prop — zero hardcoded copy, zero default.
|
|
6220
|
+
*
|
|
6221
|
+
* Ported from any-debate-ai (Eve) apps/web/src/lib/components/
|
|
6222
|
+
* ApiKeyDialog.svelte + apiKey.svelte.ts (rewritten from scratch — no
|
|
6223
|
+
* shared code, no license carried over): dropped the modal-dialog chrome,
|
|
6224
|
+
* the localStorage persistence (`modelKey` store — presentational
|
|
6225
|
+
* libraries never own storage, the host does), the hardcoded gateway/
|
|
6226
|
+
* openrouter provider table (now host-supplied `providers` data), and the
|
|
6227
|
+
* direct Convex `action` call (now the `onValidate` callback — this
|
|
6228
|
+
* library talks to no server). Kept: per-provider tab toggle, masked
|
|
6229
|
+
* input, validate/checking/error states, and the "last 4 characters of a
|
|
6230
|
+
* saved key" hint pattern.
|
|
6231
|
+
*
|
|
6232
|
+
* Props are pushed into the `MosaicApiKeyPanelState` discriminated union
|
|
6233
|
+
* exactly where they are read — no prop is required in a status branch
|
|
6234
|
+
* that never renders it (e.g. `validatingLabel` only exists on the
|
|
6235
|
+
* "validating" variant; `savedKeyLastFour`/`savedKeyHintLabel`/
|
|
6236
|
+
* `removeButtonLabel`/`onRemove` only on "valid"; `errorMessage` only on
|
|
6237
|
+
* "invalid").
|
|
6238
|
+
*
|
|
6239
|
+
* @example
|
|
6240
|
+
* // idle
|
|
6241
|
+
* <MosaicApiKeyPanel
|
|
6242
|
+
* status="idle"
|
|
6243
|
+
* providers={[
|
|
6244
|
+
* { id: "gateway", label: "Vercel AI Gateway", placeholder: "vck_…" },
|
|
6245
|
+
* { id: "openrouter", label: "OpenRouter", placeholder: "sk-or-v1-…" },
|
|
6246
|
+
* ]}
|
|
6247
|
+
* activeProviderId="gateway"
|
|
6248
|
+
* onProviderChange={setActiveProviderId}
|
|
6249
|
+
* tabsAriaLabel="Fournisseur de clé"
|
|
6250
|
+
* keyValue={draft}
|
|
6251
|
+
* onKeyChange={setDraft}
|
|
6252
|
+
* onValidate={(providerId, key) => validate(providerId, key)}
|
|
6253
|
+
* inputAriaLabel="Clé API"
|
|
6254
|
+
* validateButtonLabel="Valider et entrer"
|
|
6255
|
+
* />
|
|
6256
|
+
*
|
|
6257
|
+
* @example
|
|
6258
|
+
* // valid (a key is already saved)
|
|
6259
|
+
* <MosaicApiKeyPanel
|
|
6260
|
+
* {...baseProps}
|
|
6261
|
+
* status="valid"
|
|
6262
|
+
* savedKeyLastFour="a1b2"
|
|
6263
|
+
* savedKeyHintLabel={(lastFour) => `Une clé se terminant par …${lastFour} est enregistrée.`}
|
|
6264
|
+
* removeButtonLabel="Retirer"
|
|
6265
|
+
* onRemove={() => removeKey()}
|
|
6266
|
+
* />
|
|
6267
|
+
*/
|
|
6268
|
+
|
|
6269
|
+
/** Host-supplied model-key provider (tab), e.g. Vercel AI Gateway / OpenRouter. */
|
|
6270
|
+
interface MosaicApiKeyPanelProvider {
|
|
6271
|
+
/** Stable provider identifier, e.g. "gateway" / "openrouter". */
|
|
6272
|
+
id: string;
|
|
6273
|
+
/** Tab label, displayed as-is. */
|
|
6274
|
+
label: string;
|
|
6275
|
+
/** Placeholder for the key input when this provider is active. */
|
|
6276
|
+
placeholder: string;
|
|
6277
|
+
}
|
|
6278
|
+
/**
|
|
6279
|
+
* Base props required in EVERY status — read unconditionally by the
|
|
6280
|
+
* component regardless of `status` (provider tabs + key input + submit
|
|
6281
|
+
* row, all reachable from "idle").
|
|
6282
|
+
*/
|
|
6283
|
+
type MosaicApiKeyPanelBaseProps = {
|
|
6284
|
+
/** Host-supplied provider list. Data, never a hardcoded set. */
|
|
6285
|
+
providers: MosaicApiKeyPanelProvider[];
|
|
6286
|
+
/** `id` of the currently-selected provider (must match a `providers[].id`). */
|
|
6287
|
+
activeProviderId: string;
|
|
6288
|
+
/** Called with the provider `id` when a tab is activated. */
|
|
6289
|
+
onProviderChange: (providerId: string) => void;
|
|
6290
|
+
/** Accessible name for the provider tab group (`aria-label`). Required, no default. */
|
|
6291
|
+
tabsAriaLabel: string;
|
|
6292
|
+
/**
|
|
6293
|
+
* Host-controlled current key input value. Never persisted by this
|
|
6294
|
+
* library (no localStorage) — the host owns where, if anywhere, this
|
|
6295
|
+
* value is kept.
|
|
6296
|
+
*/
|
|
6297
|
+
keyValue: string;
|
|
6298
|
+
/** Called with the raw input value on every keystroke. */
|
|
6299
|
+
onKeyChange: (key: string) => void;
|
|
6300
|
+
/**
|
|
6301
|
+
* Called with the active provider id and the trimmed key on submit.
|
|
6302
|
+
* The component performs no validation itself — the host decides how
|
|
6303
|
+
* the key is checked and how `status`/`errorMessage` are updated
|
|
6304
|
+
* afterward. Never call this with an empty key.
|
|
6305
|
+
*/
|
|
6306
|
+
onValidate: (providerId: string, key: string) => void;
|
|
6307
|
+
/** Accessible name for the key input (`aria-label`). Required, no default. */
|
|
6308
|
+
inputAriaLabel: string;
|
|
6309
|
+
/** Label for the submit button when idle/ready. Required, no default. */
|
|
6310
|
+
validateButtonLabel: string;
|
|
6311
|
+
/** Additional Tailwind classes on the root element. */
|
|
6312
|
+
className?: string;
|
|
6313
|
+
/** React 19 ref prop — forwarded to the root element. */
|
|
6314
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
6315
|
+
};
|
|
6316
|
+
/**
|
|
6317
|
+
* Host-controlled key-validation status. Every prop that is only ever
|
|
6318
|
+
* rendered in ONE status branch lives on that branch's variant — not on
|
|
6319
|
+
* the base props — so the type contract matches exactly what the
|
|
6320
|
+
* component reads.
|
|
6321
|
+
*/
|
|
6322
|
+
type MosaicApiKeyPanelState = {
|
|
6323
|
+
status: "idle";
|
|
6324
|
+
} | {
|
|
6325
|
+
status: "validating";
|
|
6326
|
+
/** Message/label shown while status === "validating". Required, no default. */
|
|
6327
|
+
validatingLabel: string;
|
|
6328
|
+
} | {
|
|
6329
|
+
status: "valid";
|
|
6330
|
+
/**
|
|
6331
|
+
* Last 4 characters of an already-saved key, supplied by the host
|
|
6332
|
+
* (this library never derives this from a live key value itself —
|
|
6333
|
+
* it only ever displays what the host explicitly hands it).
|
|
6334
|
+
*/
|
|
6335
|
+
savedKeyLastFour: string;
|
|
6336
|
+
/**
|
|
6337
|
+
* Host-localized hint text, e.g.
|
|
6338
|
+
* `(lastFour) => \`Key ending in …${lastFour} is saved.\``.
|
|
6339
|
+
* Required — no hardcoded string.
|
|
6340
|
+
*/
|
|
6341
|
+
savedKeyHintLabel: (lastFour: string) => string;
|
|
6342
|
+
/** Label for the "remove saved key" button. Required, no default. */
|
|
6343
|
+
removeButtonLabel: string;
|
|
6344
|
+
/** Called when the "remove saved key" button is activated. */
|
|
6345
|
+
onRemove: () => void;
|
|
6346
|
+
} | {
|
|
6347
|
+
status: "invalid";
|
|
6348
|
+
/**
|
|
6349
|
+
* Host-provided, host-localized error message. The library never
|
|
6350
|
+
* generates its own error strings, and never derives one from the
|
|
6351
|
+
* rejected key — every occurrence is a distinct required value
|
|
6352
|
+
* supplied by the caller.
|
|
6353
|
+
*/
|
|
6354
|
+
errorMessage: string;
|
|
6355
|
+
};
|
|
6356
|
+
type MosaicApiKeyPanelProps = MosaicApiKeyPanelBaseProps & MosaicApiKeyPanelState;
|
|
6357
|
+
/**
|
|
6358
|
+
* MosaicApiKeyPanel — production BYOK ("bring your own key") atom for
|
|
6359
|
+
* @vantageos/mosaic-blocks.
|
|
6360
|
+
*
|
|
6361
|
+
* Purely presentational: renders provider tabs, a masked key input, and
|
|
6362
|
+
* the current status (idle/validating/valid/invalid), and reports a
|
|
6363
|
+
* provider change / validate request / remove request via callbacks. No
|
|
6364
|
+
* network call, no storage, no key logging.
|
|
6365
|
+
*/
|
|
6366
|
+
declare function MosaicApiKeyPanel(props: MosaicApiKeyPanelProps): React.JSX.Element;
|
|
6367
|
+
declare namespace MosaicApiKeyPanel {
|
|
6368
|
+
var displayName: string;
|
|
6369
|
+
}
|
|
6370
|
+
|
|
6371
|
+
/**
|
|
6372
|
+
* MosaicAgentChat — presentational session harness: MVP-8, the last MVP
|
|
6373
|
+
* piece, wiring MosaicChatThread + MosaicChatMessage + MosaicChatComposer +
|
|
6374
|
+
* MosaicApprovalPrompt into one send/resume/respond harness.
|
|
6375
|
+
*
|
|
6376
|
+
* Presentational only: no network call, no SDK, no stored client. The
|
|
6377
|
+
* message thread is NEVER accumulated as local state — `messages` is a
|
|
6378
|
+
* required, host-controlled prop recomputed by the host from its own event
|
|
6379
|
+
* journal on every render (this is what lets the thread survive a page
|
|
6380
|
+
* reload or a server restart: nothing here owns durable state). The three
|
|
6381
|
+
* things this harness actually owns are ephemeral UI-only concerns:
|
|
6382
|
+
* - which approval requests have already been answered IN THIS MOUNT
|
|
6383
|
+
* (`decisions` — cleared implicitly once the host's `messages` replaces
|
|
6384
|
+
* the underlying tool part with a real `output-available` / `output-denied`
|
|
6385
|
+
* / `output-error` state);
|
|
6386
|
+
* - a one-shot guard so `onResumeSession` fires exactly once per `sessionId`
|
|
6387
|
+
* value, never once per render;
|
|
6388
|
+
* - forwarding the composer's controlled `value`.
|
|
6389
|
+
*
|
|
6390
|
+
* Three extension seams, matching the eve/react send-turn contract:
|
|
6391
|
+
* - `onSubmit(text)` — send a new turn (idle branch of the composer state).
|
|
6392
|
+
* - `onResumeSession(sessionId)` — fired once when a host passes a
|
|
6393
|
+
* `sessionId` prop, standing in for `agent.resume(sessionId)`.
|
|
6394
|
+
* - `onApprovalResponse({ requestId, optionId?, text? })` — the payload
|
|
6395
|
+
* shape mirrors `SendTurnPayload.inputResponses` exactly (eve/react
|
|
6396
|
+
* `client/types.ts`); this is the wire that lets an approval decision made
|
|
6397
|
+
* in `MosaicApprovalPrompt` travel back to the agent runtime.
|
|
6398
|
+
*
|
|
6399
|
+
* Pattern: MosaicUrlScraper.tsx (data-slot, inline cn, React 19 ref prop,
|
|
6400
|
+
* displayName, JSDoc, pure variants module, host-controlled discriminated
|
|
6401
|
+
* union). Composes MosaicChatThread (MVP-1), MosaicChatMessage (MVP-2),
|
|
6402
|
+
* MosaicApprovalPrompt (MVP-3), and MosaicChatComposer (T10) — none of
|
|
6403
|
+
* these are reimplemented here.
|
|
6404
|
+
* No "use client" — prepend-use-client.mjs adds it to dist.
|
|
6405
|
+
* Design tokens: --border, --card (root only — the composed children carry
|
|
6406
|
+
* their own tokens).
|
|
6407
|
+
* a11y: delegated entirely to the composed children (MosaicChatThread's
|
|
6408
|
+
* `role="log"`, MosaicChatComposer's labelled textarea/button,
|
|
6409
|
+
* MosaicApprovalPrompt's `fieldset`/`legend`) — this harness adds no new
|
|
6410
|
+
* interactive surface of its own beyond wiring props through.
|
|
6411
|
+
* Bilingual: every user-facing string this component reads directly
|
|
6412
|
+
* (`scrollToBottomLabel`, `textareaAriaLabel`, `placeholder`,
|
|
6413
|
+
* `sendButtonAriaLabel`/`stopButtonAriaLabel`, `reasoningLabel`,
|
|
6414
|
+
* `reasoningStreamingLabel`, `toolStatusLabels`, and every
|
|
6415
|
+
* `MosaicAgentChatApprovalLabels` field) is a required caller-supplied
|
|
6416
|
+
* prop — zero hardcoded copy, zero default.
|
|
6417
|
+
*
|
|
6418
|
+
* Props are pushed into the `MosaicAgentChatState` discriminated union
|
|
6419
|
+
* exactly where they are read: `onSubmit`/`sendButtonAriaLabel` only exist
|
|
6420
|
+
* on the "idle" branch (forwarded to the composer's own "idle" branch);
|
|
6421
|
+
* `onStop`/`stopButtonAriaLabel` only exist on the "responding" branch.
|
|
6422
|
+
* Likewise `MosaicAgentChatToolPartState`'s `approval` field is required
|
|
6423
|
+
* ONLY on the `"approval-requested"` member, mirroring
|
|
6424
|
+
* `MosaicChatMessageToolState`'s own per-branch contract.
|
|
6425
|
+
*
|
|
6426
|
+
* Ported from eve-tpl app/_components/agent-chat.tsx (rewritten from
|
|
6427
|
+
* scratch — no shared code, no license carried over): kept the
|
|
6428
|
+
* `agent.send({ inputResponses })` payload shape
|
|
6429
|
+
* (`{ requestId; optionId?; text? }`, client/types.ts:140-143) and the
|
|
6430
|
+
* "send a turn" / "respond to a pending input request" duality, dropped
|
|
6431
|
+
* every app-specific concern (sign-in gating, rate limiting, Convex
|
|
6432
|
+
* persistence, connection authorization, pending-message optimistic UI) —
|
|
6433
|
+
* all out of scope for a presentational harness.
|
|
6434
|
+
*
|
|
6435
|
+
* @example
|
|
6436
|
+
* // idle — can submit a new turn, resuming session "sess_42"
|
|
6437
|
+
* <MosaicAgentChat
|
|
6438
|
+
* status="idle"
|
|
6439
|
+
* messages={messagesFromEventLog}
|
|
6440
|
+
* sessionId="sess_42"
|
|
6441
|
+
* onResumeSession={(id) => resumeAgentSession(id)}
|
|
6442
|
+
* onSubmit={(text) => sendTurn(text)}
|
|
6443
|
+
* sendButtonAriaLabel="Envoyer le message"
|
|
6444
|
+
* composerValue={draft}
|
|
6445
|
+
* onComposerValueChange={setDraft}
|
|
6446
|
+
* textareaAriaLabel="Message à eve"
|
|
6447
|
+
* placeholder="Demandez ce que vous voulez à eve..."
|
|
6448
|
+
* scrollToBottomLabel="Revenir au dernier message"
|
|
6449
|
+
* reasoningLabel="Raisonnement"
|
|
6450
|
+
* reasoningStreamingLabel="Réflexion en cours…"
|
|
6451
|
+
* toolStatusLabels={{ running: "En cours", completed: "Terminé", denied: "Refusé", error: "Erreur" }}
|
|
6452
|
+
* renderText={(text) => text}
|
|
6453
|
+
* onApprovalResponse={(payload) => agent.send({ inputResponses: [payload] })}
|
|
6454
|
+
* />
|
|
6455
|
+
*/
|
|
6456
|
+
|
|
6457
|
+
/** The exact payload sent back to the agent runtime for one approval decision. */
|
|
6458
|
+
interface MosaicAgentChatApprovalResponsePayload {
|
|
6459
|
+
/** Identifies which pending input request this response answers. */
|
|
6460
|
+
requestId: string;
|
|
6461
|
+
/** Which choice was made — mirrors eve/react's `optionId` field. */
|
|
6462
|
+
optionId?: string;
|
|
6463
|
+
/** Free-text response, when the pending request expects one. */
|
|
6464
|
+
text?: string;
|
|
6465
|
+
}
|
|
6466
|
+
/** Host-owned copy for one approval request. Required, no default. */
|
|
6467
|
+
interface MosaicAgentChatApprovalLabels {
|
|
6468
|
+
promptTitle: string;
|
|
6469
|
+
toolNameLabel: string;
|
|
6470
|
+
approveButtonLabel: string;
|
|
6471
|
+
denyButtonLabel: string;
|
|
6472
|
+
approvedMessage: string;
|
|
6473
|
+
deniedMessage: string;
|
|
6474
|
+
}
|
|
6475
|
+
/**
|
|
6476
|
+
* Everything needed to render + resolve a pending approval, decoupled from
|
|
6477
|
+
* the tool part's own `toolCallId` (a request can outlive a specific tool
|
|
6478
|
+
* call id in some agent runtimes, so the two are kept distinct on the wire).
|
|
6479
|
+
*/
|
|
6480
|
+
interface MosaicAgentChatApprovalRequest {
|
|
6481
|
+
/** Sent back as `requestId` in `MosaicAgentChatApprovalResponsePayload`. */
|
|
6482
|
+
requestId: string;
|
|
6483
|
+
/** `optionId` sent back when the host approves. */
|
|
6484
|
+
approveOptionId: string;
|
|
6485
|
+
/** `optionId` sent back when the host denies. */
|
|
6486
|
+
denyOptionId: string;
|
|
6487
|
+
approvalLabels: MosaicAgentChatApprovalLabels;
|
|
6488
|
+
}
|
|
6489
|
+
type MosaicAgentChatToolPartBase = {
|
|
6490
|
+
type: "tool";
|
|
6491
|
+
/** Stable identifier for this tool call, used as the React key. */
|
|
6492
|
+
toolCallId: string;
|
|
6493
|
+
/** Tool name, displayed as-is. */
|
|
6494
|
+
toolName: string;
|
|
6495
|
+
/** Tool call input payload, shown (JSON-stringified) when present. */
|
|
6496
|
+
input?: unknown;
|
|
6497
|
+
};
|
|
6498
|
+
/**
|
|
6499
|
+
* Tool-call lifecycle, mirroring `MosaicChatMessageToolState` — each
|
|
6500
|
+
* member's own required field lives on that member alone. `approval` is
|
|
6501
|
+
* required EXACTLY on `"approval-requested"`, the only branch that needs to
|
|
6502
|
+
* build a `MosaicApprovalPrompt` and respond on the wire.
|
|
6503
|
+
*/
|
|
6504
|
+
type MosaicAgentChatToolPartState = {
|
|
6505
|
+
state: "input-streaming";
|
|
6506
|
+
} | {
|
|
6507
|
+
state: "approval-requested";
|
|
6508
|
+
/** Everything needed to render + resolve this pending approval. */
|
|
6509
|
+
approval: MosaicAgentChatApprovalRequest;
|
|
6510
|
+
} | {
|
|
6511
|
+
state: "output-available";
|
|
6512
|
+
output: unknown;
|
|
6513
|
+
} | {
|
|
6514
|
+
state: "output-denied";
|
|
6515
|
+
} | {
|
|
6516
|
+
state: "output-error";
|
|
6517
|
+
errorText: string;
|
|
6518
|
+
};
|
|
6519
|
+
type MosaicAgentChatToolPart = MosaicAgentChatToolPartBase & MosaicAgentChatToolPartState;
|
|
6520
|
+
type MosaicAgentChatMessagePart = {
|
|
6521
|
+
type: "text";
|
|
6522
|
+
text: string;
|
|
6523
|
+
} | {
|
|
6524
|
+
type: "reasoning";
|
|
6525
|
+
text: string;
|
|
6526
|
+
isStreaming?: boolean;
|
|
6527
|
+
} | MosaicAgentChatToolPart;
|
|
6528
|
+
/** One message in the thread, recomputed by the host from its event journal. */
|
|
6529
|
+
interface MosaicAgentChatMessage {
|
|
6530
|
+
/** Stable identifier, used as the React key. */
|
|
6531
|
+
id: string;
|
|
6532
|
+
messageRole: MosaicChatMessageSenderRole;
|
|
6533
|
+
parts: MosaicAgentChatMessagePart[];
|
|
6534
|
+
}
|
|
6535
|
+
/**
|
|
6536
|
+
* Base props required in EVERY status — read unconditionally by the
|
|
6537
|
+
* component regardless of `status`.
|
|
6538
|
+
*/
|
|
6539
|
+
type MosaicAgentChatBaseProps = {
|
|
6540
|
+
/** The full thread, recomputed by the host from its own event journal. */
|
|
6541
|
+
messages: MosaicAgentChatMessage[];
|
|
6542
|
+
/** Renders a text/reasoning part's raw string (e.g. MosaicMarkdown). */
|
|
6543
|
+
renderText: (text: string) => React.ReactNode;
|
|
6544
|
+
reasoningLabel: string;
|
|
6545
|
+
reasoningStreamingLabel: string;
|
|
6546
|
+
toolStatusLabels: MosaicChatMessageToolStatusLabels;
|
|
6547
|
+
/** Accessible name for the thread's "scroll to bottom" button. */
|
|
6548
|
+
scrollToBottomLabel: string;
|
|
6549
|
+
/** Host-controlled current composer text. */
|
|
6550
|
+
composerValue: string;
|
|
6551
|
+
onComposerValueChange: (value: string) => void;
|
|
6552
|
+
textareaAriaLabel: string;
|
|
6553
|
+
placeholder: string;
|
|
6554
|
+
/**
|
|
6555
|
+
* Sends one approval decision back to the agent runtime. Mirrors
|
|
6556
|
+
* `agent.send({ inputResponses: [payload] })` — this harness never calls
|
|
6557
|
+
* a transport itself, it only builds and forwards the payload.
|
|
6558
|
+
*/
|
|
6559
|
+
onApprovalResponse: (payload: MosaicAgentChatApprovalResponsePayload) => void;
|
|
6560
|
+
/**
|
|
6561
|
+
* When set, this harness is resuming an existing session rather than
|
|
6562
|
+
* starting a new one — `onResumeSession` fires exactly once per distinct
|
|
6563
|
+
* `sessionId` value, standing in for `agent.resume(sessionId)`.
|
|
6564
|
+
*/
|
|
6565
|
+
sessionId?: string;
|
|
6566
|
+
onResumeSession?: (sessionId: string) => void;
|
|
6567
|
+
/** Disables the composer (e.g. host-level connectivity loss). */
|
|
6568
|
+
disabled?: boolean;
|
|
6569
|
+
className?: string;
|
|
6570
|
+
/** React 19 ref prop — forwarded to the root element. */
|
|
6571
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
6572
|
+
};
|
|
6573
|
+
/**
|
|
6574
|
+
* Host-controlled turn status, forwarded to `MosaicChatComposer`'s own
|
|
6575
|
+
* status union. `onSubmit`/`sendButtonAriaLabel` only exist on "idle";
|
|
6576
|
+
* `onStop`/`stopButtonAriaLabel` only exist on "responding".
|
|
6577
|
+
*/
|
|
6578
|
+
type MosaicAgentChatState = {
|
|
6579
|
+
status: "idle";
|
|
6580
|
+
/** Sends a new turn — the trimmed composer text. */
|
|
6581
|
+
onSubmit: (text: string) => void;
|
|
6582
|
+
sendButtonAriaLabel: string;
|
|
6583
|
+
} | {
|
|
6584
|
+
status: "responding";
|
|
6585
|
+
/** Cancels the in-flight agent response. */
|
|
6586
|
+
onStop: () => void;
|
|
6587
|
+
stopButtonAriaLabel: string;
|
|
6588
|
+
};
|
|
6589
|
+
type MosaicAgentChatProps = MosaicAgentChatBaseProps & MosaicAgentChatState;
|
|
6590
|
+
/**
|
|
6591
|
+
* MosaicAgentChat — production session-harness atom for
|
|
6592
|
+
* @vantageos/mosaic-blocks.
|
|
6593
|
+
*
|
|
6594
|
+
* Purely presentational: composes MosaicChatThread + MosaicChatMessage +
|
|
6595
|
+
* MosaicApprovalPrompt + MosaicChatComposer, sends a turn, resumes a
|
|
6596
|
+
* session once, and forwards approval decisions on the exact
|
|
6597
|
+
* `{ requestId; optionId?; text? }` wire shape. No network call, no SDK,
|
|
6598
|
+
* no stored thread.
|
|
6599
|
+
*/
|
|
6600
|
+
declare function MosaicAgentChat(props: MosaicAgentChatProps): React.JSX.Element;
|
|
6601
|
+
declare namespace MosaicAgentChat {
|
|
6602
|
+
var displayName: string;
|
|
6603
|
+
}
|
|
6604
|
+
|
|
6605
|
+
/**
|
|
6606
|
+
* agentChatVariants — pure CVA variant functions for MosaicAgentChat.
|
|
6607
|
+
*
|
|
6608
|
+
* Isolated in its own module so it can be re-exported from the
|
|
6609
|
+
* `@vantageos/mosaic-blocks/server` subpath without pulling in React.
|
|
6610
|
+
*
|
|
6611
|
+
* Zero browser / React runtime dependencies — safe in RSC / Node.js.
|
|
6612
|
+
*/
|
|
6613
|
+
/** Root harness container — thread above, composer pinned below. */
|
|
6614
|
+
declare const agentChatRootVariants: (props?: class_variance_authority_types.ClassProp | undefined) => string;
|
|
6615
|
+
|
|
6616
|
+
export { type Breakpoint, type DeviceContextValue, type Feature3ColItem, type FeatureItem, type FooterColumn, type FooterLink, type HeroCta, type LogoItem, MosaicAccordion, MosaicAccordionItem, type MosaicAccordionItemProps, MosaicAccordionPanel, type MosaicAccordionPanelProps, type MosaicAccordionProps, MosaicAccordionTrigger, type MosaicAccordionTriggerProps, type MosaicActionAccent, type MosaicActivity, MosaicActivityFeed, type MosaicActivityFeedProps, MosaicActivityItem, type MosaicActivityItemProps, type MosaicActivityStatus, MosaicAdaptiveGrid, type MosaicAdaptiveGridProps, MosaicAdaptiveModal, type MosaicAdaptiveModalProps, MosaicAdaptiveNavigation, type MosaicAdaptiveNavigationProps, MosaicAgentCard, type MosaicAgentCardProps, MosaicAgentChat, type MosaicAgentChatApprovalLabels, type MosaicAgentChatApprovalRequest, type MosaicAgentChatApprovalResponsePayload, type MosaicAgentChatMessage, type MosaicAgentChatMessagePart, type MosaicAgentChatProps, type MosaicAgentChatState, type MosaicAgentChatToolPart, type MosaicAgentChatToolPartState, MosaicAgentComposer, MosaicAgentComposerDesktop, MosaicAgentComposerMobile, type MosaicAgentComposerMobileProps, type MosaicAgentComposerProps, type MosaicAgentData, MosaicAgentList, AgentListDesktop as MosaicAgentListDesktop, AgentListMobile as MosaicAgentListMobile, type MosaicAgentListProps, type MosaicAgentPreset, MosaicAgentTeamPreview, type MosaicAgentTeamPreviewProps, MosaicAnimatedList, type MosaicAnimatedListProps, MosaicApiKeyPanel, type MosaicApiKeyPanelProps, type MosaicApiKeyPanelProvider, type MosaicApiKeyPanelState, MosaicAppSidebar, type MosaicAppSidebarProps, MosaicApprovalPrompt, type MosaicApprovalPromptProps, type MosaicApprovalPromptState, MosaicAvatar, type MosaicAvatarProps, MosaicBadge, type MosaicBadgeProps, MosaicBlurredOrb, type MosaicBlurredOrbProps, type MosaicBreadcrumb, MosaicButton, type MosaicButtonProps, MosaicCard, MosaicCardContent, type MosaicCardContentProps, MosaicCardDescription, type MosaicCardDescriptionProps, MosaicCardFooter, type MosaicCardFooterProps, MosaicCardHeader, type MosaicCardHeaderProps, type MosaicCardProps, MosaicCardTitle, type MosaicCardTitleProps, MosaicChatComposer, type MosaicChatComposerProps, type MosaicChatComposerState, MosaicChatMessage, type MosaicChatMessagePart, type MosaicChatMessageProps, type MosaicChatMessageReasoningPart, type MosaicChatMessageSenderRole, type MosaicChatMessageTextPart, type MosaicChatMessageToolPart, type MosaicChatMessageToolState, type MosaicChatMessageToolStatusLabels, MosaicChatThread, type MosaicChatThreadProps, MosaicCheckbox, type MosaicCheckboxProps, type MosaicClerkMembership, MosaicClerkOrgSwitcher, type MosaicClerkOrgSwitcherProps, type MosaicClerkOrganization, MosaicClerkWebhookHandler, type MosaicClerkWebhookHandlerOptions, MosaicCollapsible, MosaicCollapsiblePanel, type MosaicCollapsiblePanelProps, type MosaicCollapsibleProps, MosaicCollapsibleTrigger, type MosaicCollapsibleTriggerProps, MosaicCombobox, type MosaicComboboxItem, type MosaicComboboxProps, type MosaicComposerModel, type MosaicComposerModule, MosaicCounter, type MosaicCounterProps, MosaicCreateOrgDialog, type MosaicCreateOrgDialogProps, MosaicDashboardContent, type MosaicDashboardContentProps, MosaicDashboardHeader, type MosaicDashboardHeaderProps, MosaicDashboardLayout, type MosaicDashboardLayoutProps, type MosaicDashboardView, MosaicDataTable, type MosaicDataTableColumn, type MosaicDataTablePagination, type MosaicDataTableProps, MosaicDeleteConfirmationDialog, type MosaicDeleteConfirmationDialogProps, MosaicDeviceProvider, type MosaicDeviceProviderProps, MosaicDocumentUpload, type MosaicDocumentUploadFile, type MosaicDocumentUploadFileStatus, type MosaicDocumentUploadProps, MosaicDropdownMenu, type MosaicDropdownMenuItem, type MosaicDropdownMenuProps, MosaicEmptyState, type MosaicEmptyStateProps, MosaicFallingPattern, type MosaicFallingPatternProps, MosaicFeature3Col, type MosaicFeature3ColProps, MosaicFeatureCenteredMedia, type MosaicFeatureCenteredMediaProps, MosaicField, MosaicFieldControl, type MosaicFieldControlProps, MosaicFieldDescription, type MosaicFieldDescriptionProps, MosaicFieldError, type MosaicFieldErrorProps, MosaicFieldLabel, type MosaicFieldLabelProps, type MosaicFieldProps, MosaicFilterBar, type MosaicFilterBarProps, type MosaicFilterOption, MosaicFilterSidebar, type MosaicFilterSidebarProps, MosaicFooterSimple, type MosaicFooterSimpleProps, MosaicHeroSplit, type MosaicHeroSplitProps, MosaicInput, MosaicInputGroup, type MosaicInputGroupProps, type MosaicInputProps, MosaicIntegrationsBadge, type MosaicIntegrationsBadgeProps, MosaicInviteMemberDialog, type MosaicInviteMemberDialogProps, MosaicKanbanBoard, type MosaicKanbanBoardProps, MosaicKanbanColumn, type MosaicKanbanColumnProps, MosaicLogosGrid, type MosaicLogosGridProps, MosaicMainNav, type MosaicMainNavProps, MosaicMarkdown, type MosaicMarkdownProps, type MosaicMarketplaceItem, MosaicMarketplaceList, MarketplaceListDesktop as MosaicMarketplaceListDesktop, MarketplaceListMobile as MosaicMarketplaceListMobile, type MosaicMarketplaceListProps, MosaicMemberList, type MosaicMemberListProps, MosaicMemoryCard, type MosaicMemoryCardProps, type MosaicMemoryData, type MosaicMemoryScope, type MosaicMemorySource, type MosaicMessage, MosaicMessageCard, type MosaicMessageCardProps, MosaicMessageList, MessageListDesktop as MosaicMessageListDesktop, MessageListMobile as MosaicMessageListMobile, type MosaicMessageListProps, type MosaicMessageReactions, type MosaicMessageSender, type MosaicMessageSenderType, MosaicModuleCard, type MosaicModuleCardProps, type MosaicModuleData, MosaicModuleForm, type MosaicModuleFormField, type MosaicModuleFormProps, type MosaicModuleItem, MosaicModuleLibrary, type MosaicModuleLibraryProps, type MosaicModuleType, MosaicMultiOrgIndicator, type MosaicMultiOrgIndicatorProps, MosaicMultiTenantProvider, type MosaicMultiTenantProviderProps, type MosaicNavItem, MosaicNavbar, type MosaicNavbarProps, type MosaicNavigationItem, type MosaicOrg, type MosaicOrgInfo, type MosaicOrgMember, MosaicOrgPanel, type MosaicOrgPanelProps, type MosaicOrgPanelTab, MosaicOrgProfilePage, type MosaicOrgProfilePageProps, type MosaicOrgRole, MosaicOrgRoleBadge, type MosaicOrgRoleBadgeProps, type MosaicOrgStats, MosaicOrgSwitcher, type MosaicOrgSwitcherProps, type MosaicSelectItem as MosaicPrefSelectItem, type MosaicPreference, type MosaicPreferenceGroup, MosaicPreferencesPanel, type MosaicPreferencesPanelProps, MosaicPricingCard, type MosaicPricingCardProps, type MosaicProfileField, MosaicProfilePanel, type MosaicProfilePanelProps, MosaicProgress, type MosaicProgressProps, type MosaicQuickAction$1 as MosaicQuickAction, MosaicQuickActionCard, type MosaicQuickActionCardProps, MosaicQuickActionsMenu, type MosaicQuickAction as MosaicQuickActionsMenuItem, type MosaicQuickActionsMenuProps, type MosaicQuickAgent, MosaicQuickAgentSelector, type MosaicQuickAgentSelectorProps, MosaicQuickStartPanel, type MosaicQuickStartPanelProps, MosaicRadioGroup, MosaicRadioGroupItem, type MosaicRadioGroupItemProps, type MosaicRadioGroupProps, type MosaicScenario, MosaicScrollArea, type MosaicScrollAreaProps, MosaicSelect, type MosaicSelectItem$1 as MosaicSelectItem, type MosaicSelectProps, type MosaicSelectorCategory, type MosaicSelectorItem, MosaicSelectorModal, type MosaicSelectorModalProps, MosaicSeparator, type MosaicSeparatorProps, type MosaicSidebarFooterStatus, type MosaicSidebarNavItem, type MosaicSidebarQuickAction, type MosaicSidebarRecentItem, MosaicSignInLayout, type MosaicSignInLayoutProps, MosaicSignUpLayout, type MosaicSignUpLayoutProps, MosaicSkeleton, type MosaicSkeletonProps, MosaicSlider, type MosaicSliderProps, type MosaicStatItem, MosaicStatsGrid, type MosaicStatsGridProps, type MosaicStep, MosaicStepPipeline, type MosaicStepPipelineDotsProps, type MosaicStepPipelineProps, type MosaicStepPipelineSegmentsProps, type MosaicStepStatus, MosaicSwitch, type MosaicSwitchProps, MosaicTabs, MosaicTabsList, type MosaicTabsListProps, MosaicTabsPanel, type MosaicTabsPanelProps, type MosaicTabsProps, MosaicTabsTrigger, type MosaicTabsTriggerProps, type MosaicTemplate, type MosaicTemplateAgent, MosaicTemplateCard, type MosaicTemplateCardProps, MosaicTemplateGallery, type MosaicTemplateGalleryProps, type MosaicTemplateMetadata, MosaicTemplatePreview, type MosaicTemplatePreviewProps, MosaicTestimonialsGrid, type MosaicTestimonialsGridProps, MosaicTextarea, type MosaicTextareaProps, MosaicThemeProvider, type MosaicThemeProviderProps, MosaicThemeToggle, type MosaicThemeToggleProps, MosaicToolToggleList, type MosaicToolToggleListApprovalLevel, type MosaicToolToggleListProps, type MosaicToolToggleListSection, type MosaicToolToggleListTool, MosaicTooltip, MosaicTooltipContent, type MosaicTooltipContentProps, type MosaicTooltipProps, MosaicTooltipProvider, type MosaicTooltipProviderProps, MosaicTooltipRoot, type MosaicTooltipRootProps, MosaicTooltipTrigger, type MosaicTooltipTriggerProps, MosaicUrlScraper, type MosaicUrlScraperContent, type MosaicUrlScraperProps, type MosaicUrlScraperState, MosaicUserButton, type MosaicUserButtonProps, type MosaicWorkspaceContext, type NavCta, type NavLink, type OrbPosition, type Orientation, Placeholder, type PricingCta, type SocialLink, type StatItem, type TestimonialItem, type Theme, agentChatRootVariants, badgeVariants, buttonVariants, chatMessageBubbleVariants, chatMessageContainerVariants, chatMessageToolStatusVariants, skeletonVariants, toolToggleListRowVariants, toolToggleListSectionVariants, useBreakpoint, useDevice, useMosaicWorkspace as useEffectiveWorkspaceId, useIsDesktop, useIsMobile, useIsTablet, useMediaQuery, useMosaicWorkspace, useOrientation, useViewport, version };
|