@kortix/ui 0.15.3 → 0.15.5
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/dist/_vendor/kortix-shared.js +87 -29
- package/dist/_vendor/shared/markdown-math.d.ts +6 -0
- package/dist/customize/agents/agent-drives-section.d.ts +1 -3
- package/dist/customize/agents/agent-drives-section.js +3 -4
- package/dist/customize/agents/agent-page.js +2 -2
- package/dist/customize/agents/agent-tabs.d.ts +1 -1
- package/dist/customize/agents/agent-tabs.js +1 -2
- package/dist/customize/connectors/add-mcp/add-mcp-server-dialog.js +7 -2
- package/dist/customize/connectors/add-mcp/add-mcp-server.d.ts +7 -0
- package/dist/customize/connectors/add-mcp/add-mcp-server.js +3 -0
- package/dist/customize/connectors/connectors-page.d.ts +8 -0
- package/dist/customize/connectors/connectors-page.js +34 -1
- package/dist/customize/sections/view/agent-editor-access-fields.js +1 -3
- package/dist/files/project/components/drive-explorer.js +64 -43
- package/dist/files/project/components/drive-upload-tray.d.ts +2 -1
- package/dist/files/project/components/drive-upload-tray.js +9 -4
- package/dist/files/project/drop-tree.d.ts +16 -0
- package/dist/files/project/drop-tree.js +39 -0
- package/dist/files/project/upload-batch.d.ts +15 -0
- package/dist/files/project/upload-batch.js +12 -0
- package/dist/i18n/en.d.ts +16 -6
- package/dist/i18n/en.js +29 -19
- package/dist/internal/billing/use-cost-explorer.d.ts +19 -1
- package/dist/internal/billing/use-cost-explorer.js +27 -1
- package/dist/internal/lib/billing/billing-gate-state.d.ts +5 -6
- package/dist/internal/lib/billing/billing-gate-state.js +10 -11
- package/dist/internal/lib/browser-error-noise.d.ts +1 -1
- package/dist/internal/lib/browser-error-noise.js +1 -1
- package/dist/internal/lib/browser-noise/rules/injected-scripts.d.ts +5 -1
- package/dist/internal/lib/browser-noise/rules/injected-scripts.js +86 -0
- package/dist/internal/lib/mermaid-utils.js +2 -24
- package/dist/primitives/mermaid-render.js +3 -20
- package/dist/session/composer/ComposerCard.d.ts +1 -1
- package/dist/session/composer/ComposerCard.js +2 -2
- package/dist/session/composer/composer-chat-input.d.ts +14 -1
- package/dist/session/composer/composer-chat-input.js +4 -2
- package/dist/session/composer/composer-toolbar.d.ts +4 -1
- package/dist/session/composer/composer-toolbar.js +2 -2
- package/dist/session/composer/composer.d.ts +8 -0
- package/dist/session/composer/queue-projection.d.ts +10 -8
- package/dist/session/composer/queue-projection.js +10 -9
- package/dist/session/composer/send-stop-control.d.ts +15 -1
- package/dist/session/composer/send-stop-control.js +30 -5
- package/dist/session/composer/use-instant-session-send.js +2 -2
- package/dist/session/header/session-embed-menu-item.d.ts +12 -0
- package/dist/session/header/session-embed-menu-item.js +30 -0
- package/dist/{workspace/sidebar/modal/session-embed-section.d.ts → session/header/session-embed-snippet.d.ts} +2 -11
- package/dist/session/header/session-embed-snippet.js +21 -0
- package/dist/session/header/session-site-header.js +9 -2
- package/dist/session/models/ask-owner-for-credits-button.d.ts +7 -1
- package/dist/session/models/ask-owner-for-credits-button.js +3 -2
- package/dist/session/thread/session-chat.js +18 -7
- package/dist/session/voice/composer-call.d.ts +31 -0
- package/dist/session/voice/composer-call.js +46 -0
- package/dist/session/voice/voice-call-card.js +2 -0
- package/dist/session/voice/voice-call-store.d.ts +8 -0
- package/dist/session/voice/voice-call-store.js +5 -0
- package/dist/session/voice/voice-call.d.ts +2 -2
- package/dist/session/voice/voice-call.js +6 -6
- package/dist/test-utils/intl.d.ts +16 -6
- package/dist/workspace/home/existing-repo-setup-prompt.js +2 -3
- package/dist/workspace/instant-session-shell.js +11 -1
- package/dist/workspace/layout/project-home.js +24 -2
- package/dist/workspace/layout/use-project-home-call.d.ts +24 -0
- package/dist/workspace/layout/use-project-home-call.js +56 -0
- package/dist/workspace/new/workspace-name.d.ts +13 -0
- package/dist/workspace/new/workspace-name.js +20 -0
- package/dist/workspace/sidebar/footer/project-balance-warning.js +9 -6
- package/dist/workspace/sidebar/footer/sidebar-alert.d.ts +1 -1
- package/dist/workspace/sidebar/modal/share-session-modal.js +2 -3
- package/package.json +7 -7
- package/dist/workspace/sidebar/modal/session-embed-section.js +0 -71
|
@@ -282,6 +282,91 @@ function isRedeclaredInjectedIdentifierNoise(input) {
|
|
|
282
282
|
return (REDECLARED_IDENTIFIER_MESSAGE.test(stripErrorWrappers(normalizeString(input.message))) &&
|
|
283
283
|
!sourcesOf(input).some((source) => isScriptAssetSource(source) || isFirstPartyResolvedSource(source)));
|
|
284
284
|
}
|
|
285
|
+
// Third-party tracking-pixel `Response.json()` noise. A marketing pixel
|
|
286
|
+
// (observed: Vector, `https://cdn.vector.co/pixel.js`, loaded on the marketing
|
|
287
|
+
// site by the visitor-identification vendor chain,
|
|
288
|
+
// `apps/web/src/components/analytics/visitor-pixel.tsx`) fetches its own API
|
|
289
|
+
// (`https://api.vector.co/pixel/ip-info`) and calls `response.json()` without
|
|
290
|
+
// checking `response.ok`. When the site's bot protection 403s the request with
|
|
291
|
+
// an empty body, `Response.json()` rejects with the canonical DOM
|
|
292
|
+
// `SyntaxError: Failed to execute 'json' on 'Response': Unexpected end of JSON
|
|
293
|
+
// input`. The pixel catches the rejection into a `console.error`, but it still
|
|
294
|
+
// surfaces as an UNCAUGHT unhandled rejection, so Sentry's global handler
|
|
295
|
+
// captures it (`mechanism auto.browser.global_handlers.onunhandledrejection`,
|
|
296
|
+
// `handled:false`) and it pages Better Stack.
|
|
297
|
+
//
|
|
298
|
+
// Better Stack pattern
|
|
299
|
+
// 19329ead41e26241a830a6706a19f206329d24f5a39f133f8963f7b46b69e4af
|
|
300
|
+
// (Kortix Frontend prod, application_id 2346967): 1 occurrence / 0 identified
|
|
301
|
+
// users, first/last 2026-11-10 05:51:06 UTC, request URL `https://kortix.com/`
|
|
302
|
+
// (marketing root), browser Chrome 153 on Windows tagged `browser.type: "bot"`
|
|
303
|
+
// (Naver's Yeti crawler, `Yeti/1.1; +https://naver.me/spd`). Breadcrumbs: the
|
|
304
|
+
// pixel's own fetches to `api.vector.co` both 403'd (bot blocked), then its
|
|
305
|
+
// `console.error` logged the SyntaxError with the raw vendor stack
|
|
306
|
+
// `https://cdn.vector.co/pixel.js`. Stack frames (5, all `in_app:true`, all the
|
|
307
|
+
// vendor script — Sentry's Next.js frame normalization rewrites the
|
|
308
|
+
// cross-origin URL to the `app:///pixel.js` shape, the same normalization the
|
|
309
|
+
// Chromium-extension frames get at beforeSend): `a` → `s` → `Generator.next` →
|
|
310
|
+
// `Generator.<anonymous>` → `e.<anonymous>` (throw site, the `.json()` call).
|
|
311
|
+
// NO first-party `apps/web/src/…` frame.
|
|
312
|
+
//
|
|
313
|
+
// First-party code cannot fix the vendor's missing `response.ok` check, and
|
|
314
|
+
// the empty body only happens when a blocked bot is denied — 0 identified
|
|
315
|
+
// users. A real first-party `response.json()` regression in our own code
|
|
316
|
+
// throws the SAME DOM wording, so matching the message alone would swallow
|
|
317
|
+
// real bugs: require the EXACT message AND the throw site (the innermost
|
|
318
|
+
// resolvable frame) to be a `pixel.js` script that is not a first-party
|
|
319
|
+
// bundle, with a NEGATIVE guard that keeps any de-minified `apps/web/src/…` /
|
|
320
|
+
// `packages/ui/src/…` frame reporting. A frameless capture is unattributable
|
|
321
|
+
// and this wording routinely comes from first-party fetch code — keep
|
|
322
|
+
// reporting (unlike `isGoogletagUndefinedNoise`, whose message class only ever
|
|
323
|
+
// comes from third-party GPT code). Deliberately NOT added to
|
|
324
|
+
// `sentry.client.config.ts`'s `ignoreErrors` list — that gate has no frame
|
|
325
|
+
// context; the frame-aware `beforeSend` hook is the only safe gate.
|
|
326
|
+
// `appliesTo: 'sentry'`: the runtime gate's unhandledrejection capture carries
|
|
327
|
+
// neither frames nor a filename, so it can never confirm the vendor origin.
|
|
328
|
+
const PIXEL_RESPONSE_JSON_NOISE_MESSAGE = /^Failed to execute 'json' on 'Response': Unexpected end of JSON input$/;
|
|
329
|
+
const LINE_TERMINATOR = /[\n\r\u2028\u2029]/;
|
|
330
|
+
/**
|
|
331
|
+
* True when the source's last line names a `pixel.js` script, optionally
|
|
332
|
+
* followed by a query or fragment: the same set `/pixel\.js(?:[?#].*)?$/`
|
|
333
|
+
* matches, in linear time. That unanchored regex backtracks quadratically on a
|
|
334
|
+
* frame filename of many `pixel.js#` repetitions (CodeQL
|
|
335
|
+
* js/polynomial-redos), and frame filenames are page-controlled.
|
|
336
|
+
*/
|
|
337
|
+
function endsWithPixelScript(source) {
|
|
338
|
+
const line = source.split(LINE_TERMINATOR).pop() ?? '';
|
|
339
|
+
for (let i = line.indexOf('pixel.js'); i !== -1; i = line.indexOf('pixel.js', i + 1)) {
|
|
340
|
+
const next = line[i + 'pixel.js'.length];
|
|
341
|
+
if (next === undefined || next === '?' || next === '#')
|
|
342
|
+
return true;
|
|
343
|
+
}
|
|
344
|
+
return false;
|
|
345
|
+
}
|
|
346
|
+
function isTrackingPixelScriptSource(filename) {
|
|
347
|
+
const source = normalizeString(filename);
|
|
348
|
+
return endsWithPixelScript(source) && !isBrowserBundleSource(source);
|
|
349
|
+
}
|
|
350
|
+
export function isTrackingPixelResponseJsonNoise(input) {
|
|
351
|
+
const stripped = stripErrorWrappers(normalizeString(input.message));
|
|
352
|
+
if (!PIXEL_RESPONSE_JSON_NOISE_MESSAGE.test(stripped)) {
|
|
353
|
+
return false;
|
|
354
|
+
}
|
|
355
|
+
const frames = (input.frames ?? []).filter((frame) => Boolean(frame));
|
|
356
|
+
// Negative guard: a resolved first-party source frame means our own code
|
|
357
|
+
// called `response.json()` on a bad body → actionable regression; keep
|
|
358
|
+
// reporting so the call site can be found + fixed.
|
|
359
|
+
if (frames.some((frame) => isFirstPartyResolvedSource(frame.filename))) {
|
|
360
|
+
return false;
|
|
361
|
+
}
|
|
362
|
+
// The throw site decides (the innermost resolvable frame — the `.json()`
|
|
363
|
+
// call), never an outer instrumentation wrapper (the googletag lesson,
|
|
364
|
+
// KRTX-4571).
|
|
365
|
+
const throwSite = [...frames]
|
|
366
|
+
.reverse()
|
|
367
|
+
.find((frame) => isResolvableFrameSource(frame.filename))?.filename;
|
|
368
|
+
return throwSite !== undefined && isTrackingPixelScriptSource(throwSite);
|
|
369
|
+
}
|
|
285
370
|
/** Vercel toolbar frames have a reserved source path outside app bundles. */
|
|
286
371
|
export function isVercelLiveFeedbackNoise(input) {
|
|
287
372
|
const sources = sourcesOf(input);
|
|
@@ -297,6 +382,7 @@ export const INJECTED_SCRIPT_RULES = [
|
|
|
297
382
|
{ id: 'googletag-undefined', appliesTo: 'both', match: isGoogletagUndefinedNoise },
|
|
298
383
|
{ id: 'redeclared-injected-identifier', appliesTo: 'both', match: isRedeclaredInjectedIdentifierNoise },
|
|
299
384
|
{ id: 'vercel-live-feedback', appliesTo: 'both', match: isVercelLiveFeedbackNoise },
|
|
385
|
+
{ id: 'injected-tracking-pixel-response-json', appliesTo: 'sentry', match: isTrackingPixelResponseJsonNoise },
|
|
300
386
|
{
|
|
301
387
|
// KRTX-4387: an injected `tracking_script.js` (no Kortix code, GTM tag or
|
|
302
388
|
// vendor loads it) asks Closure's jsloader for the gapi client. The CSP
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Utility functions for Mermaid diagram detection and processing
|
|
3
3
|
*/
|
|
4
|
-
import { isMermaidCode } from '../../_vendor/kortix-shared.js';
|
|
4
|
+
import { MERMAID_DIAGRAM_STARTERS, isMermaidCode } from '../../_vendor/kortix-shared.js';
|
|
5
5
|
// Shared with apps/mobile, which routes the same fences to its diagram renderer.
|
|
6
6
|
export { isMermaidCode };
|
|
7
7
|
/**
|
|
@@ -22,29 +22,7 @@ export function validateMermaidSyntax(code) {
|
|
|
22
22
|
}
|
|
23
23
|
// Check for basic mermaid structure
|
|
24
24
|
const firstLine = lines[0].toLowerCase();
|
|
25
|
-
const
|
|
26
|
-
'graph',
|
|
27
|
-
'flowchart',
|
|
28
|
-
'sequencediagram',
|
|
29
|
-
'classdiagram',
|
|
30
|
-
'statediagram',
|
|
31
|
-
'erdiagram',
|
|
32
|
-
'journey',
|
|
33
|
-
'gantt',
|
|
34
|
-
'pie',
|
|
35
|
-
'gitgraph',
|
|
36
|
-
'mindmap',
|
|
37
|
-
'timeline',
|
|
38
|
-
'sankey',
|
|
39
|
-
'block',
|
|
40
|
-
'quadrant',
|
|
41
|
-
'requirement',
|
|
42
|
-
'c4context',
|
|
43
|
-
'c4container',
|
|
44
|
-
'c4component',
|
|
45
|
-
'c4dynamic',
|
|
46
|
-
];
|
|
47
|
-
const hasValidStarter = validStarters.some((starter) => firstLine.startsWith(starter) || firstLine.includes(starter));
|
|
25
|
+
const hasValidStarter = MERMAID_DIAGRAM_STARTERS.some((starter) => firstLine.startsWith(starter) || firstLine.includes(starter));
|
|
48
26
|
if (!hasValidStarter) {
|
|
49
27
|
return {
|
|
50
28
|
valid: false,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MERMAID_DIAGRAM_STARTERS } from '../_vendor/kortix-shared.js';
|
|
1
2
|
/**
|
|
2
3
|
* Mermaid configuration and render cleanup, kept apart from the component so
|
|
3
4
|
* the contract is testable without a DOM.
|
|
@@ -74,29 +75,11 @@ export async function renderMermaidSvg(source, onStart) {
|
|
|
74
75
|
// Check for basic Mermaid syntax
|
|
75
76
|
const firstLine = source.split('\n')[0].toLowerCase().trim();
|
|
76
77
|
const validStarters = [
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
'sequencediagram',
|
|
78
|
+
...MERMAID_DIAGRAM_STARTERS,
|
|
79
|
+
// Short aliases only `includes` matching reaches.
|
|
80
80
|
'sequence',
|
|
81
|
-
'classdiagram',
|
|
82
81
|
'class',
|
|
83
|
-
'statediagram',
|
|
84
82
|
'state',
|
|
85
|
-
'erdiagram',
|
|
86
|
-
'journey',
|
|
87
|
-
'gantt',
|
|
88
|
-
'pie',
|
|
89
|
-
'gitgraph',
|
|
90
|
-
'mindmap',
|
|
91
|
-
'timeline',
|
|
92
|
-
'sankey',
|
|
93
|
-
'block',
|
|
94
|
-
'quadrant',
|
|
95
|
-
'requirement',
|
|
96
|
-
'c4context',
|
|
97
|
-
'c4container',
|
|
98
|
-
'c4component',
|
|
99
|
-
'c4dynamic',
|
|
100
83
|
];
|
|
101
84
|
const hasValidStarter = validStarters.some((starter) => firstLine.startsWith(starter) || firstLine.includes(starter));
|
|
102
85
|
if (!hasValidStarter) {
|
|
@@ -77,4 +77,4 @@ export interface ComposerCardDerived {
|
|
|
77
77
|
noModelsConnected: boolean;
|
|
78
78
|
}
|
|
79
79
|
export type ComposerCardProps = SessionChatInputProps & ComposerCardDerived;
|
|
80
|
-
export declare function ComposerCard({ tHardcodedUi, isDragOver, handleDragEnter, handleDragOver, handleDragLeave, handleDropFiles, attachedFiles, promptAttachmentItems, removeAttachedFile, retryAttachedFile, pastes, removePaste, onOpenPastedContent, commandAttachmentPlan, editorDisabled, editorRef, setEditorRef, editorPlaceholder, animatePlaceholder, handleSubmit, handleArrowUpAtStart, handleArrowDownAtEnd, historyPosition, setIsEmpty, handleDocChange, allSessions, slashActions, handleSelectAction, dockId, setMenuOpen, fileInputRef, handleFileSelect, sessionId, handleAttachClick, primaryAgents, availableSelectedModel, agentMenuOpen, setAgentMenuOpen, modelMenuOpen, setModelMenuOpen, reasoningMenuOpen, setReasoningMenuOpen, isEmpty, canSubmit, submitDisabled, attachmentFailed, modelRejectingImages, imagesUnsupportedReason, modelUnavailable, agentUnavailable, noModelsConnected, agents, commands, slashFiles, models, notice, disabled, lockForQuestion, lockForApproval, questionButtonLabel, questionActive, submitLabel, questionCanAct, escCount, isBusy, isSending, onStop, stopDisabled, canStop, modelsLoading, modelRequired, onModelChange, modelDefaultControls, inheritedModel, providers, variants, selectedVariant, onVariantChange, projectId, toolbarSlot, underbarSlot, rewind, selectedAgent, onAgentChange, noAccessibleAgents, agentLocked, onContextClick, messages, underbarPlacement, agentPickerCompact, slashMenuPlacement, cardClassName, }: ComposerCardProps): import("react").JSX.Element;
|
|
80
|
+
export declare function ComposerCard({ tHardcodedUi, isDragOver, handleDragEnter, handleDragOver, handleDragLeave, handleDropFiles, attachedFiles, promptAttachmentItems, removeAttachedFile, retryAttachedFile, pastes, removePaste, onOpenPastedContent, commandAttachmentPlan, editorDisabled, editorRef, setEditorRef, editorPlaceholder, animatePlaceholder, handleSubmit, handleArrowUpAtStart, handleArrowDownAtEnd, historyPosition, setIsEmpty, handleDocChange, allSessions, slashActions, handleSelectAction, dockId, setMenuOpen, fileInputRef, handleFileSelect, sessionId, handleAttachClick, primaryAgents, availableSelectedModel, agentMenuOpen, setAgentMenuOpen, modelMenuOpen, setModelMenuOpen, reasoningMenuOpen, setReasoningMenuOpen, isEmpty, canSubmit, submitDisabled, attachmentFailed, modelRejectingImages, imagesUnsupportedReason, modelUnavailable, agentUnavailable, noModelsConnected, agents, commands, slashFiles, models, notice, disabled, lockForQuestion, lockForApproval, questionButtonLabel, questionActive, submitLabel, questionCanAct, escCount, isBusy, isSending, onStop, stopDisabled, canStop, modelsLoading, modelRequired, onModelChange, modelDefaultControls, inheritedModel, providers, variants, selectedVariant, onVariantChange, projectId, toolbarSlot, underbarSlot, rewind, selectedAgent, onAgentChange, noAccessibleAgents, agentLocked, onContextClick, messages, underbarPlacement, agentPickerCompact, slashMenuPlacement, cardClassName, call, }: ComposerCardProps): import("react").JSX.Element;
|
|
@@ -24,7 +24,7 @@ export function ComposerCard({ tHardcodedUi, isDragOver, handleDragEnter, handle
|
|
|
24
24
|
// Raw props the moved JSX reads; `{...props}` carries the rest. These
|
|
25
25
|
// defaults mirror `ComposerImpl`'s, because the spread passes the raw
|
|
26
26
|
// values, not the component's defaulted locals.
|
|
27
|
-
agents = EMPTY_AGENTS, commands = EMPTY_COMMANDS, slashFiles = EMPTY_SLASH_FILES, models = EMPTY_MODELS, notice = null, disabled = false, lockForQuestion = false, lockForApproval = false, questionButtonLabel = null, questionActive = false, submitLabel = null, questionCanAct = true, escCount = 0, isBusy = false, isSending = false, onStop, stopDisabled = false, canStop = true, modelsLoading = false, modelRequired = false, onModelChange, modelDefaultControls, inheritedModel, providers, variants = EMPTY_VARIANTS, selectedVariant = null, onVariantChange, projectId, toolbarSlot, underbarSlot, rewind, selectedAgent = null, onAgentChange, noAccessibleAgents = false, agentLocked = false, onContextClick, messages, underbarPlacement = 'below', agentPickerCompact = false, slashMenuPlacement = 'above', cardClassName, }) {
|
|
27
|
+
agents = EMPTY_AGENTS, commands = EMPTY_COMMANDS, slashFiles = EMPTY_SLASH_FILES, models = EMPTY_MODELS, notice = null, disabled = false, lockForQuestion = false, lockForApproval = false, questionButtonLabel = null, questionActive = false, submitLabel = null, questionCanAct = true, escCount = 0, isBusy = false, isSending = false, onStop, stopDisabled = false, canStop = true, modelsLoading = false, modelRequired = false, onModelChange, modelDefaultControls, inheritedModel, providers, variants = EMPTY_VARIANTS, selectedVariant = null, onVariantChange, projectId, toolbarSlot, underbarSlot, rewind, selectedAgent = null, onAgentChange, noAccessibleAgents = false, agentLocked = false, onContextClick, messages, underbarPlacement = 'below', agentPickerCompact = false, slashMenuPlacement = 'above', cardClassName, call, }) {
|
|
28
28
|
const cardRef = useRef(null);
|
|
29
29
|
const { attachAccept, modelPickerEnabled } = useUiHostConfig();
|
|
30
30
|
const inlineUnderbar = underbarPlacement === 'inline';
|
|
@@ -124,5 +124,5 @@ agents = EMPTY_AGENTS, commands = EMPTY_COMMANDS, slashFiles = EMPTY_SLASH_FILES
|
|
|
124
124
|
toolbarSlot: inlineUnderbar ? toolbarSlot : undefined, rewind: rewind, isSending: isSending, isBusy: isBusy, onStop: onStop, stopDisabled: stopDisabled, canStop: canStop, escCount: escCount, lockForQuestion: lockForQuestion, questionButtonLabel: questionButtonLabel, submitLabel: submitLabel, questionCanAct: questionCanAct, hasText: !isEmpty, canSubmit: canSubmit, submitDisabled: submitDisabled ||
|
|
125
125
|
attachmentFailed ||
|
|
126
126
|
modelRejectingImages !== null ||
|
|
127
|
-
commandAttachmentPlan.kind === 'refuse', attachmentFailed: attachmentFailed, attachmentUnsupported: imagesUnsupportedReason, disabled: disabled, modelUnavailable: modelUnavailable, agentUnavailable: agentUnavailable, onSubmit: () => handleSubmit() })] })] })] }), _jsx(ImagesUnsupportedBar, { modelName: noModelsConnected ? null : modelRejectingImages }), inlineUnderbar ? null : (_jsx(ComposerUnderbar, { onAttachClick: handleAttachClick, agents: primaryAgents, selectedAgent: selectedAgent, onAgentChange: onAgentChange, agentMenuOpen: agentMenuOpen, onAgentMenuOpenChange: setAgentMenuOpen, noAccessibleAgents: noAccessibleAgents, agentLocked: agentLocked, messages: messages, models: models, selectedModel: availableSelectedModel, onContextClick: onContextClick, toolbarSlot: toolbarSlot, agentsSlot: underbarSlot, chatInput: chatInput })), _jsx(ModelConnectionBar, { show: noModelsConnected }), slashMenuPlacement === 'below' && (_jsx("div", { id: dockId, className: "absolute top-full right-4 left-4 z-99 mt-3.5" }))] }));
|
|
127
|
+
commandAttachmentPlan.kind === 'refuse', attachmentFailed: attachmentFailed, attachmentUnsupported: imagesUnsupportedReason, disabled: disabled, modelUnavailable: modelUnavailable, agentUnavailable: agentUnavailable, call: call, onSubmit: () => handleSubmit() })] })] })] }), _jsx(ImagesUnsupportedBar, { modelName: noModelsConnected ? null : modelRejectingImages }), inlineUnderbar ? null : (_jsx(ComposerUnderbar, { onAttachClick: handleAttachClick, agents: primaryAgents, selectedAgent: selectedAgent, onAgentChange: onAgentChange, agentMenuOpen: agentMenuOpen, onAgentMenuOpenChange: setAgentMenuOpen, noAccessibleAgents: noAccessibleAgents, agentLocked: agentLocked, messages: messages, models: models, selectedModel: availableSelectedModel, onContextClick: onContextClick, toolbarSlot: toolbarSlot, agentsSlot: underbarSlot, chatInput: chatInput })), _jsx(ModelConnectionBar, { show: noModelsConnected }), slashMenuPlacement === 'below' && (_jsx("div", { id: dockId, className: "absolute top-full right-4 left-4 z-99 mt-3.5" }))] }));
|
|
128
128
|
}
|
|
@@ -15,6 +15,17 @@ export interface ComposerOptions {
|
|
|
15
15
|
scope?: SessionScopeCommit;
|
|
16
16
|
providerSecretPools?: Record<string, string[]>;
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* The voice call this composer offers in Send's place while nothing is typed
|
|
20
|
+
* (`SessionChatInputProps.call`). `onCall` gets the composer's picks, as a send
|
|
21
|
+
* does, with the agent it shows: the call is offered only once one resolved.
|
|
22
|
+
*/
|
|
23
|
+
export interface ComposerChatCall {
|
|
24
|
+
onCall: (options: ComposerOptions & {
|
|
25
|
+
agent: string;
|
|
26
|
+
}) => void;
|
|
27
|
+
inCall: boolean;
|
|
28
|
+
}
|
|
18
29
|
/**
|
|
19
30
|
* The canonical "compose a first message" input: {@link SessionChatInput}
|
|
20
31
|
* pre-wired with the model / agent / variant / command selectors (the
|
|
@@ -24,7 +35,7 @@ export interface ComposerOptions {
|
|
|
24
35
|
* The current selections are handed to `onSend` / `onCommand` as `options`, so
|
|
25
36
|
* callers never need their own `useRuntimeLocal`.
|
|
26
37
|
*/
|
|
27
|
-
export declare function ComposerChatInput({ onSend, onCommand, sessionId, projectId, isBusy, sessionWorking, runtimeReady, stopDisabled, isSending, disabled, autoFocus, placeholder, hint, prefill, onPrefillApplied, aboveSlot, inputSlot, toolbarSlot, underbarPlacement, slashMenuPlacement, cardClassName, parentClassName, boundAgentName, lockAgent, defaultAgentName, channelAgentNames, projectSession, clearOnSend, onAgentSelectionChange, sandboxSlot, draftScope, draftActive, promptAttachments, submitLabel, onArrowUpAtStart, }: {
|
|
38
|
+
export declare function ComposerChatInput({ onSend, onCommand, sessionId, projectId, isBusy, sessionWorking, runtimeReady, stopDisabled, isSending, disabled, autoFocus, placeholder, hint, prefill, onPrefillApplied, aboveSlot, inputSlot, toolbarSlot, underbarPlacement, slashMenuPlacement, cardClassName, parentClassName, boundAgentName, lockAgent, defaultAgentName, channelAgentNames, projectSession, clearOnSend, onAgentSelectionChange, sandboxSlot, draftScope, draftActive, promptAttachments, submitLabel, onArrowUpAtStart, call, }: {
|
|
28
39
|
onSend: (text: string, files: AttachedFile[] | undefined, options: ComposerOptions, attachments?: AttachmentSubmission) => void | Promise<void>;
|
|
29
40
|
onCommand?: (command: Command, args: string | undefined, options: ComposerOptions) => void;
|
|
30
41
|
sessionId?: string;
|
|
@@ -99,4 +110,6 @@ export declare function ComposerChatInput({ onSend, onCommand, sessionId, projec
|
|
|
99
110
|
submitLabel?: SessionChatInputProps['submitLabel'];
|
|
100
111
|
/** Up in an empty composer: open the latest queued message for editing. */
|
|
101
112
|
onArrowUpAtStart?: SessionChatInputProps['onArrowUpAtStart'];
|
|
113
|
+
/** A voice call in Send's place while nothing is typed. See `ComposerChatCall`. */
|
|
114
|
+
call?: ComposerChatCall;
|
|
102
115
|
}): import("react").JSX.Element;
|
|
@@ -17,7 +17,7 @@ import { inheritedModelFor } from './chat-input/chat-input-summary.js';
|
|
|
17
17
|
* The current selections are handed to `onSend` / `onCommand` as `options`, so
|
|
18
18
|
* callers never need their own `useRuntimeLocal`.
|
|
19
19
|
*/
|
|
20
|
-
export function ComposerChatInput({ onSend, onCommand, sessionId, projectId, isBusy, sessionWorking, runtimeReady, stopDisabled, isSending, disabled, autoFocus, placeholder, hint, prefill, onPrefillApplied, aboveSlot, inputSlot, toolbarSlot, underbarPlacement, slashMenuPlacement, cardClassName, parentClassName, boundAgentName, lockAgent = false, defaultAgentName, channelAgentNames, projectSession, clearOnSend, onAgentSelectionChange, sandboxSlot, draftScope, draftActive, promptAttachments, submitLabel, onArrowUpAtStart, }) {
|
|
20
|
+
export function ComposerChatInput({ onSend, onCommand, sessionId, projectId, isBusy, sessionWorking, runtimeReady, stopDisabled, isSending, disabled, autoFocus, placeholder, hint, prefill, onPrefillApplied, aboveSlot, inputSlot, toolbarSlot, underbarPlacement, slashMenuPlacement, cardClassName, parentClassName, boundAgentName, lockAgent = false, defaultAgentName, channelAgentNames, projectSession, clearOnSend, onAgentSelectionChange, sandboxSlot, draftScope, draftActive, promptAttachments, submitLabel, onArrowUpAtStart, call, }) {
|
|
21
21
|
const contextAutoFocus = useContext(ComposerAutoFocusContext);
|
|
22
22
|
const { data: rosterAgents } = useRuntimeAgents({ projectId });
|
|
23
23
|
const agents = useMemo(() => withChannelAgents(rosterAgents, channelAgentNames), [rosterAgents, channelAgentNames]);
|
|
@@ -151,5 +151,7 @@ export function ComposerChatInput({ onSend, onCommand, sessionId, projectId, isB
|
|
|
151
151
|
// A thread a space's chat opened by itself does not take the focus (`ComposerAutoFocusContext`).
|
|
152
152
|
autoFocus: autoFocus ?? (contextAutoFocus ? undefined : false), placeholder: placeholder, hint: hint, prefill: deliveredPrefill, onPrefillApplied: onPrefillApplied, aboveSlot: aboveSlot, inputSlot: inputSlot, toolbarSlot: combinedToolbarSlot, underbarPlacement: underbarPlacement, slashMenuPlacement: slashMenuPlacement, cardClassName: cardClassName, parentClassName: parentClassName, sessionId: sessionId, projectId: projectId, providers: providers, agents: local.agent.list, selectedAgent: selectedAgentName, noAccessibleAgents: noAccessibleAgents, agentLocked: agentLocked,
|
|
153
153
|
// A locked agent has nothing to switch to: no handler is the composer's "fixed agent" signal.
|
|
154
|
-
onAgentChange: agentLocked ? undefined : (name) => local.agent.set(name ?? undefined), models: local.model.list, selectedModel: local.model.currentKey ?? null, onModelChange: (m) => local.model.set(m ?? undefined, { recent: true }), inheritedModel: inheritedModelFor(local.model, selectedAgentName), modelRequired: true, modelsLoading: providersLoading, variants: local.model.variant.list, selectedVariant: local.model.variant.current ?? null, onVariantChange: (v) => local.model.variant.set(v ?? undefined), commands: commands || [], commandsResolved: commands !== undefined, draftScope: draftScope, draftActive: draftActive, submitLabel: submitLabel, onArrowUpAtStart: onArrowUpAtStart
|
|
154
|
+
onAgentChange: agentLocked ? undefined : (name) => local.agent.set(name ?? undefined), models: local.model.list, selectedModel: local.model.currentKey ?? null, onModelChange: (m) => local.model.set(m ?? undefined, { recent: true }), inheritedModel: inheritedModelFor(local.model, selectedAgentName), modelRequired: true, modelsLoading: providersLoading, variants: local.model.variant.list, selectedVariant: local.model.variant.current ?? null, onVariantChange: (v) => local.model.variant.set(v ?? undefined), commands: commands || [], commandsResolved: commands !== undefined, draftScope: draftScope, draftActive: draftActive, submitLabel: submitLabel, onArrowUpAtStart: onArrowUpAtStart, call: call && selectedAgentName
|
|
155
|
+
? { inCall: call.inCall, onCall: () => call.onCall({ ...options(), agent: selectedAgentName }) }
|
|
156
|
+
: undefined }));
|
|
155
157
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { FlatModel, ProviderListResponse } from '@kortix/sdk/react';
|
|
2
2
|
import type { ModelDefaultControls } from '../models/model-selector.js';
|
|
3
|
+
import type { ComposerCall } from '../voice/composer-call.js';
|
|
3
4
|
/**
|
|
4
5
|
* The composer's bottom toolbar — the familiar one, scoped to the one control
|
|
5
6
|
* that describes WHAT will answer.
|
|
@@ -116,6 +117,8 @@ export interface ComposerToolbarProps {
|
|
|
116
117
|
attachmentFailed?: boolean;
|
|
117
118
|
/** Why the selected model cannot take the attachments, or null. See `SendStopControl`. */
|
|
118
119
|
attachmentUnsupported?: string | null;
|
|
120
|
+
/** The host's voice call, offered in Send's place on an empty composer. See `SendStopControl`. */
|
|
121
|
+
call?: ComposerCall;
|
|
119
122
|
onSubmit: () => void;
|
|
120
123
|
}
|
|
121
|
-
export declare function ComposerToolbar({ models, modelsLoading, selectedModel, onModelChange, modelDefaultControls, providers, modelRequired, modelMenuOpen, onModelMenuOpenChange, reasoningMenuOpen, onReasoningMenuOpenChange, variants, selectedVariant, onVariantChange, projectId, toolbarSlot, rewind, leading, pickersInChatInput, isSending, isBusy, onStop, stopDisabled, canStop, escCount, lockForQuestion, questionButtonLabel, submitLabel, questionCanAct, hasText, canSubmit, submitDisabled, disabled, modelUnavailable, agentUnavailable, attachmentFailed, attachmentUnsupported, onSubmit, }: ComposerToolbarProps): import("react").JSX.Element;
|
|
124
|
+
export declare function ComposerToolbar({ models, modelsLoading, selectedModel, onModelChange, modelDefaultControls, providers, modelRequired, modelMenuOpen, onModelMenuOpenChange, reasoningMenuOpen, onReasoningMenuOpenChange, variants, selectedVariant, onVariantChange, projectId, toolbarSlot, rewind, leading, pickersInChatInput, isSending, isBusy, onStop, stopDisabled, canStop, escCount, lockForQuestion, questionButtonLabel, submitLabel, questionCanAct, hasText, canSubmit, submitDisabled, disabled, modelUnavailable, agentUnavailable, attachmentFailed, attachmentUnsupported, call, onSubmit, }: ComposerToolbarProps): import("react").JSX.Element;
|
|
@@ -9,7 +9,7 @@ import Loading from '../../primitives/loading.js';
|
|
|
9
9
|
import { ModelSelector } from '../models/model-selector.js';
|
|
10
10
|
import { ReasoningEffortSelector } from './reasoning-effort-selector.js';
|
|
11
11
|
import { SendStopControl } from './send-stop-control.js';
|
|
12
|
-
export function ComposerToolbar({ models, modelsLoading, selectedModel, onModelChange, modelDefaultControls, providers, modelRequired, modelMenuOpen, onModelMenuOpenChange, reasoningMenuOpen, onReasoningMenuOpenChange, variants, selectedVariant, onVariantChange, projectId, toolbarSlot, rewind, leading, pickersInChatInput = false, isSending, isBusy, onStop, stopDisabled, canStop, escCount, lockForQuestion, questionButtonLabel, submitLabel, questionCanAct, hasText, canSubmit, submitDisabled, disabled, modelUnavailable, agentUnavailable = false, attachmentFailed = false, attachmentUnsupported = null, onSubmit, }) {
|
|
12
|
+
export function ComposerToolbar({ models, modelsLoading, selectedModel, onModelChange, modelDefaultControls, providers, modelRequired, modelMenuOpen, onModelMenuOpenChange, reasoningMenuOpen, onReasoningMenuOpenChange, variants, selectedVariant, onVariantChange, projectId, toolbarSlot, rewind, leading, pickersInChatInput = false, isSending, isBusy, onStop, stopDisabled, canStop, escCount, lockForQuestion, questionButtonLabel, submitLabel, questionCanAct, hasText, canSubmit, submitDisabled, disabled, modelUnavailable, agentUnavailable = false, attachmentFailed = false, attachmentUnsupported = null, call, onSubmit, }) {
|
|
13
13
|
const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
|
|
14
14
|
const { modelPickerEnabled } = useUiHostConfig();
|
|
15
15
|
const showModel = !pickersInChatInput && modelPickerEnabled && (models.length > 0 || modelRequired) && !!onModelChange;
|
|
@@ -24,5 +24,5 @@ export function ComposerToolbar({ models, modelsLoading, selectedModel, onModelC
|
|
|
24
24
|
};
|
|
25
25
|
return (_jsxs("div", { className: "kortix-composer-toolbar flex items-center justify-between gap-1 overflow-visible", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-1 overflow-visible", children: [leading, showModel && (_jsx(ModelSelector, { models: models, modelsLoading: modelsLoading, selectedModel: selectedModel, onSelect: onModelChange, providers: providers, defaultControls: modelDefaultControls, triggerLabelClassName: "max-w-[7rem]", projectId: projectId, offerProviderAccounts: true, open: pickerOpen, onOpenChange: onPickerOpenChange, reasoning: { variants, selectedVariant, onVariantChange } })), !showModel && modelPickerEnabled && !pickersInChatInput && _jsx(ReasoningEffortSelector, { variants: variants, selectedVariant: selectedVariant, onVariantChange: onVariantChange, open: reasoningMenuOpen, onOpenChange: onReasoningMenuOpenChange })] }), _jsxs("div", { className: "flex shrink-0 items-center gap-1.5", children: [rewind && (_jsxs(HoverCard, { openDelay: 0, closeDelay: 0, children: [_jsx(HoverCardTrigger, { asChild: true, children: _jsx("span", { className: "inline-flex", children: _jsxs(Button, { type: "button", variant: "ghost", size: "sm", disabled: rewind.pending || rewind.disabled, onClick: rewind.onRestore, className: "text-muted-foreground hover:text-foreground gap-1.5", children: [rewind.pending ? (_jsx(Loading, { className: "size-3.5 shrink-0" })) : (_jsx(ArrowCounterClockwiseIcon, { className: "size-3.5 shrink-0" })), tI18nComplete.raw('texta76e13b98392')] }) }) }), _jsx(HoverCardContent, { className: "px-3 py-2 text-sm text-balance", children: rewind.disabled && !rewind.pending
|
|
26
26
|
? tI18nComplete.raw('text98433e61649a')
|
|
27
|
-
: tI18nComplete.raw('text4c25090df9ea') })] })), toolbarSlot, _jsx(SendStopControl, { isSending: isSending, isBusy: isBusy, onStop: onStop, stopDisabled: stopDisabled, canStop: canStop, escCount: escCount, lockForQuestion: lockForQuestion, questionButtonLabel: questionButtonLabel, submitLabel: submitLabel, questionCanAct: questionCanAct, hasText: hasText, canSubmit: canSubmit, submitDisabled: submitDisabled, disabled: disabled, modelUnavailable: modelUnavailable, agentUnavailable: agentUnavailable, attachmentFailed: attachmentFailed, attachmentUnsupported: attachmentUnsupported, onSubmit: onSubmit })] })] }));
|
|
27
|
+
: tI18nComplete.raw('text4c25090df9ea') })] })), toolbarSlot, _jsx(SendStopControl, { isSending: isSending, isBusy: isBusy, onStop: onStop, stopDisabled: stopDisabled, canStop: canStop, escCount: escCount, lockForQuestion: lockForQuestion, questionButtonLabel: questionButtonLabel, submitLabel: submitLabel, questionCanAct: questionCanAct, hasText: hasText, canSubmit: canSubmit, submitDisabled: submitDisabled, disabled: disabled, modelUnavailable: modelUnavailable, agentUnavailable: agentUnavailable, attachmentFailed: attachmentFailed, attachmentUnsupported: attachmentUnsupported, call: call, onSubmit: onSubmit })] })] }));
|
|
28
28
|
}
|
|
@@ -7,6 +7,7 @@ import { type AttachmentSubmission } from './attachment-submission.js';
|
|
|
7
7
|
import { type QuoteRequest } from './composer-logic.js';
|
|
8
8
|
import type { SlashFile } from './menus/slash-files.js';
|
|
9
9
|
import type { AttachedFile, TrackedMention } from './types.js';
|
|
10
|
+
import type { ComposerCall } from '../voice/composer-call.js';
|
|
10
11
|
export interface SessionChatInputProps {
|
|
11
12
|
onSend: (text: string, files?: AttachedFile[], mentions?: TrackedMention[], attachments?: AttachmentSubmission, placement?: 'transcript' | 'composer') => void | Promise<void>;
|
|
12
13
|
/**
|
|
@@ -286,6 +287,13 @@ export interface SessionChatInputProps {
|
|
|
286
287
|
*/
|
|
287
288
|
slashMenuPlacement?: 'above' | 'below';
|
|
288
289
|
cardClassName?: string;
|
|
290
|
+
/**
|
|
291
|
+
* A voice call, offered in the Send button's place while there is nothing to
|
|
292
|
+
* send (flag `voice_call`; `session/voice/composer-call.ts`). Hosts opt in:
|
|
293
|
+
* project home calls a new session, a session page calls its own session.
|
|
294
|
+
* Omitted, Send is the only action, as before.
|
|
295
|
+
*/
|
|
296
|
+
call?: ComposerCall;
|
|
289
297
|
/**
|
|
290
298
|
* Reply quotes to add — transcript selections the user clicked "Reply" on,
|
|
291
299
|
* oldest first. Id-keyed like `prefill`: each id appends ONE quote to the
|
|
@@ -48,8 +48,7 @@ export interface QueueRow {
|
|
|
48
48
|
steer?: true;
|
|
49
49
|
/** Why a steer prompt waits for the turn to end instead. */
|
|
50
50
|
steerFallback?: SessionPromptSteerFallback;
|
|
51
|
-
/** "
|
|
52
|
-
* not yet on the wire. */
|
|
51
|
+
/** "Send now" can send it next: it is still waiting and not yet on the wire. */
|
|
53
52
|
interruptible: boolean;
|
|
54
53
|
/** A `/` command held in this tab until the session can run it
|
|
55
54
|
* (`held-commands.ts`). Not an inbox row. */
|
|
@@ -91,14 +90,17 @@ export declare function projectQueueRows(input: {
|
|
|
91
90
|
viewer?: SessionPromptViewer;
|
|
92
91
|
}): QueueProjection;
|
|
93
92
|
/**
|
|
94
|
-
* How a composer send reaches the session (
|
|
93
|
+
* How a composer send reaches the session. One mode (2026-11-04):
|
|
95
94
|
*
|
|
96
|
-
* -
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* -
|
|
95
|
+
* - While a turn runs: `steer`. The running turn reads it after its current
|
|
96
|
+
* tool call. It waits in the list above the composer until the transcript
|
|
97
|
+
* has it.
|
|
98
|
+
* - While idle: it starts a turn and paints in the transcript.
|
|
99
|
+
*
|
|
100
|
+
* Enter and Cmd/Ctrl+Enter send the same way; `placement` is ignored. The
|
|
101
|
+
* server delivers every prompt as a steer whatever a client asks for.
|
|
100
102
|
*/
|
|
101
|
-
export declare function composerSendDelivery(
|
|
103
|
+
export declare function composerSendDelivery(_placement: 'transcript' | 'composer', busy: boolean): {
|
|
102
104
|
placement: 'transcript' | 'composer';
|
|
103
105
|
delivery?: SessionPromptDelivery;
|
|
104
106
|
};
|
|
@@ -131,15 +131,16 @@ export function projectQueueRows(input) {
|
|
|
131
131
|
return { rows, heldCount };
|
|
132
132
|
}
|
|
133
133
|
/**
|
|
134
|
-
* How a composer send reaches the session (
|
|
134
|
+
* How a composer send reaches the session. One mode (2026-11-04):
|
|
135
135
|
*
|
|
136
|
-
* -
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
* -
|
|
136
|
+
* - While a turn runs: `steer`. The running turn reads it after its current
|
|
137
|
+
* tool call. It waits in the list above the composer until the transcript
|
|
138
|
+
* has it.
|
|
139
|
+
* - While idle: it starts a turn and paints in the transcript.
|
|
140
|
+
*
|
|
141
|
+
* Enter and Cmd/Ctrl+Enter send the same way; `placement` is ignored. The
|
|
142
|
+
* server delivers every prompt as a steer whatever a client asks for.
|
|
140
143
|
*/
|
|
141
|
-
export function composerSendDelivery(
|
|
142
|
-
|
|
143
|
-
return { placement, delivery: 'queue' };
|
|
144
|
-
return busy ? { placement: 'composer', delivery: 'steer' } : { placement };
|
|
144
|
+
export function composerSendDelivery(_placement, busy) {
|
|
145
|
+
return busy ? { placement: 'composer', delivery: 'steer' } : { placement: 'transcript' };
|
|
145
146
|
}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import type { ComposerCall } from '../voice/composer-call.js';
|
|
2
|
+
/**
|
|
3
|
+
* Does the Send slot offer the host's voice call? Only on an empty composer
|
|
4
|
+
* (no text, file, quote or paste) that could otherwise send: no question
|
|
5
|
+
* holds it, and nothing refuses a send (no agent, no model, a disabled or
|
|
6
|
+
* busy composer). Every other state keeps the control it had.
|
|
7
|
+
*/
|
|
8
|
+
export declare function offersComposerCall({ call, canSubmit, lockForQuestion, disabled, agentUnavailable, modelUnavailable, }: Pick<SendStopControlProps, 'call' | 'canSubmit' | 'lockForQuestion' | 'disabled' | 'agentUnavailable' | 'modelUnavailable'>): boolean;
|
|
1
9
|
export interface SendStopControlProps {
|
|
2
10
|
isSending: boolean;
|
|
3
11
|
isBusy: boolean;
|
|
@@ -34,6 +42,12 @@ export interface SendStopControlProps {
|
|
|
34
42
|
attachmentFailed?: boolean;
|
|
35
43
|
/** Why the selected model cannot take the attachments. Send is refused while set. */
|
|
36
44
|
attachmentUnsupported?: string | null;
|
|
45
|
+
/**
|
|
46
|
+
* The host's voice call (flag `voice_call`). With nothing to send, the Send
|
|
47
|
+
* button calls instead: same place, same shape, a waveform for the arrow
|
|
48
|
+
* (`offersComposerCall`). Absent: Send stays as it was.
|
|
49
|
+
*/
|
|
50
|
+
call?: ComposerCall;
|
|
37
51
|
onSubmit: () => void;
|
|
38
52
|
}
|
|
39
|
-
export declare function SendStopControl({ isSending, isBusy, onStop, stopDisabled, canStop, escCount, lockForQuestion, questionButtonLabel, submitLabel, questionCanAct, hasText, canSubmit, submitDisabled, disabled, modelUnavailable, agentUnavailable, attachmentFailed, attachmentUnsupported, onSubmit, }: SendStopControlProps): import("react").JSX.Element;
|
|
53
|
+
export declare function SendStopControl({ isSending, isBusy, onStop, stopDisabled, canStop, escCount, lockForQuestion, questionButtonLabel, submitLabel, questionCanAct, hasText, canSubmit, submitDisabled, disabled, modelUnavailable, agentUnavailable, attachmentFailed, attachmentUnsupported, call, onSubmit, }: SendStopControlProps): import("react").JSX.Element;
|
|
@@ -5,7 +5,7 @@ import Hint from '../../primitives/hint.js';
|
|
|
5
5
|
import { Kbd } from '../../primitives/kbd.js';
|
|
6
6
|
import Loading from '../../primitives/loading.js';
|
|
7
7
|
import { cn } from '../../lib/utils.js';
|
|
8
|
-
import { ArrowUpIcon as ArrowUp, SquareIcon } from '@phosphor-icons/react';
|
|
8
|
+
import { ArrowUpIcon as ArrowUp, SquareIcon, WaveformIcon } from '@phosphor-icons/react';
|
|
9
9
|
import { AnimatePresence, m } from 'motion/react';
|
|
10
10
|
import { useTranslations } from '../../i18n/index.js';
|
|
11
11
|
import { NO_MODEL_AVAILABLE_ACTION_MESSAGE } from '../models/model-availability.js';
|
|
@@ -22,9 +22,19 @@ const ICON_SWAP = {
|
|
|
22
22
|
exit: { scale: 0.25, opacity: 0, filter: 'blur(4px)' },
|
|
23
23
|
transition: { type: 'spring', duration: 0.3, bounce: 0 },
|
|
24
24
|
};
|
|
25
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Does the Send slot offer the host's voice call? Only on an empty composer
|
|
27
|
+
* (no text, file, quote or paste) that could otherwise send: no question
|
|
28
|
+
* holds it, and nothing refuses a send (no agent, no model, a disabled or
|
|
29
|
+
* busy composer). Every other state keeps the control it had.
|
|
30
|
+
*/
|
|
31
|
+
export function offersComposerCall({ call, canSubmit, lockForQuestion, disabled, agentUnavailable, modelUnavailable, }) {
|
|
32
|
+
return !!call && !canSubmit && !lockForQuestion && !disabled && !agentUnavailable && !modelUnavailable;
|
|
33
|
+
}
|
|
34
|
+
export function SendStopControl({ isSending, isBusy, onStop, stopDisabled, canStop = true, escCount, lockForQuestion, questionButtonLabel, submitLabel = null, questionCanAct, hasText, canSubmit, submitDisabled, disabled, modelUnavailable, agentUnavailable = false, attachmentFailed = false, attachmentUnsupported = null, call, onSubmit, }) {
|
|
26
35
|
const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
|
|
27
36
|
const t = useTranslations('threads');
|
|
37
|
+
const tCall = useTranslations('voiceCall');
|
|
28
38
|
const tDesktop = useTranslations('sessionDesktop');
|
|
29
39
|
const tAttachments = useTranslations('hardcodedUi.composerAttachments');
|
|
30
40
|
// One line, the same one the agent picker's tooltip carries — the two
|
|
@@ -36,9 +46,24 @@ export function SendStopControl({ isSending, isBusy, onStop, stopDisabled, canSt
|
|
|
36
46
|
: attachmentFailed
|
|
37
47
|
? tAttachments('failedBlocksSend')
|
|
38
48
|
: attachmentUnsupported;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
49
|
+
// One button for both: typing turns the waveform into the arrow and
|
|
50
|
+
// clearing turns it back. That swap is keyboard-driven, so it is instant:
|
|
51
|
+
// both glyphs share the `send` key and only busy ⇄ send cross-fades
|
|
52
|
+
// (kortix-brand motion.md, "Never animate a keyboard-initiated action").
|
|
53
|
+
const callOffered = offersComposerCall({
|
|
54
|
+
call,
|
|
55
|
+
canSubmit,
|
|
56
|
+
lockForQuestion,
|
|
57
|
+
disabled,
|
|
58
|
+
agentUnavailable,
|
|
59
|
+
modelUnavailable,
|
|
60
|
+
});
|
|
61
|
+
const callLabel = call?.inCall ? tCall('inCall') : tCall('start');
|
|
62
|
+
const sendButton = (_jsx(Hint, { side: "top", label: callOffered ? callLabel : (refusal ?? t('sendMessage')), children: _jsx("span", { className: "inline-flex", children: _jsx(Button, { size: "icon-base", disabled: callOffered
|
|
63
|
+
? !!call?.inCall
|
|
64
|
+
: lockForQuestion
|
|
65
|
+
? (!canSubmit && !questionCanAct) || disabled
|
|
66
|
+
: !canSubmit || submitDisabled, onClick: callOffered ? () => call?.onCall() : onSubmit, "aria-label": callOffered ? tCall('start') : t('sendMessage'), title: callOffered ? undefined : (refusal ?? undefined), className: ICON_BUTTON, children: _jsx(AnimatePresence, { mode: "popLayout", initial: false, children: _jsx(m.span, { className: "flex items-center", ...ICON_SWAP, children: disabled ? (_jsx(Loading, { className: "size-3.5 shrink-0" })) : callOffered ? (_jsx(WaveformIcon, { weight: "bold", className: "size-4" })) : (_jsx(ArrowUp, { className: "size-4" })) }, disabled ? 'busy' : 'send') }) }) }) }));
|
|
42
67
|
if (isSending && !lockForQuestion) {
|
|
43
68
|
return (_jsx(Button, { size: "icon-base", "aria-label": t('sending'), disabled: true, className: ICON_BUTTON, children: _jsx(AnimatePresence, { mode: "popLayout", initial: false, children: _jsx(m.span, { className: "flex items-center", ...ICON_SWAP, children: _jsx(Loading, { className: "size-4" }) }, "pending") }) }));
|
|
44
69
|
}
|
|
@@ -250,8 +250,8 @@ function planSend({ text, files, options, attachments, projectId, sessionId, sub
|
|
|
250
250
|
// through its delivery chain: a text-only send never overtakes an upload.
|
|
251
251
|
//
|
|
252
252
|
// The first send starts the session. A send typed while the first boots
|
|
253
|
-
// is an inbox row carrying its
|
|
254
|
-
//
|
|
253
|
+
// is an inbox row carrying its placement, drawn as a transcript bubble or
|
|
254
|
+
// a waiting row above the composer until the row lists it.
|
|
255
255
|
//
|
|
256
256
|
// One exception: a first send that is not detached (no uploads, nothing
|
|
257
257
|
// earlier still delivering) paints after its POST. The hero composer that
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "Embed" in the session menu: the snippet for framing the actual session
|
|
3
|
+
* page, with its caveat. The entry point left the Session access dialog
|
|
4
|
+
* (KRTX-4639) — a developer affordance does not belong in a permissions
|
|
5
|
+
* dialog — and this submenu is its one home. The caller gates the mount on
|
|
6
|
+
* the same verdicts the dialog's section used: the viewer may manage sharing
|
|
7
|
+
* (`can_manage_sharing`) and the host serves public shares.
|
|
8
|
+
*/
|
|
9
|
+
export declare function SessionEmbedMenuItem({ projectId, sessionId }: {
|
|
10
|
+
projectId: string;
|
|
11
|
+
sessionId: string;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { DropdownMenuItem, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, } from '../../primitives/dropdown-menu.js';
|
|
4
|
+
import { errorToast, successToast } from '../../primitives/toast.js';
|
|
5
|
+
import { useTranslations } from '../../i18n/index.js';
|
|
6
|
+
import { CodeIcon } from '@phosphor-icons/react';
|
|
7
|
+
import { copyToClipboard } from '../../internal/lib/utils/clipboard.js';
|
|
8
|
+
import { sessionEmbedSnippet } from './session-embed-snippet.js';
|
|
9
|
+
/**
|
|
10
|
+
* "Embed" in the session menu: the snippet for framing the actual session
|
|
11
|
+
* page, with its caveat. The entry point left the Session access dialog
|
|
12
|
+
* (KRTX-4639) — a developer affordance does not belong in a permissions
|
|
13
|
+
* dialog — and this submenu is its one home. The caller gates the mount on
|
|
14
|
+
* the same verdicts the dialog's section used: the viewer may manage sharing
|
|
15
|
+
* (`can_manage_sharing`) and the host serves public shares.
|
|
16
|
+
*/
|
|
17
|
+
export function SessionEmbedMenuItem({ projectId, sessionId }) {
|
|
18
|
+
const t = useTranslations('hardcodedUi.sessionEmbed');
|
|
19
|
+
const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
|
|
20
|
+
const copy = async () => {
|
|
21
|
+
const snippet = sessionEmbedSnippet(projectId, sessionId, window.location.origin);
|
|
22
|
+
if (!snippet)
|
|
23
|
+
return;
|
|
24
|
+
if (await copyToClipboard(snippet))
|
|
25
|
+
successToast(t.raw('copied'));
|
|
26
|
+
else
|
|
27
|
+
errorToast(tI18nComplete.raw('text167c96824acb'));
|
|
28
|
+
};
|
|
29
|
+
return (_jsxs(DropdownMenuSub, { children: [_jsxs(DropdownMenuSubTrigger, { className: "cursor-pointer", children: [_jsx(CodeIcon, {}), t.raw('sectionTitle')] }), _jsxs(DropdownMenuSubContent, { className: "w-64", children: [_jsx("p", { className: "text-muted-foreground px-2 py-1.5 text-xs", children: t.raw('sectionDescription') }), _jsxs(DropdownMenuItem, { className: "cursor-pointer", onClick: () => void copy(), children: [_jsx(CodeIcon, {}), t.raw('copy')] })] })] }));
|
|
30
|
+
}
|
|
@@ -7,19 +7,10 @@
|
|
|
7
7
|
* the `title` attribute is a fixed string. Never interpolate a session title
|
|
8
8
|
* into the attribute — an unescaped quote would break out of it on the HOST
|
|
9
9
|
* page, which does not share this app's CSP.
|
|
10
|
-
|
|
11
|
-
export declare function sessionEmbedSnippet(projectId: string, sessionId: string, origin: string): string | null;
|
|
12
|
-
/**
|
|
13
|
-
* "Embed" in the Share dialog: one copy button for the iframe snippet above.
|
|
10
|
+
*
|
|
14
11
|
* Framing the session page is allowed by the CSP `frame-ancestors` rule on
|
|
15
12
|
* that route (next.config.ts); the viewer inside the frame is the app's own
|
|
16
13
|
* auth. Same-site embeds require an existing signed-in session; cross-site
|
|
17
14
|
* embeds cannot sign in inside the frame (SameSite=Lax and /auth's CSP).
|
|
18
|
-
*
|
|
19
|
-
* Mounted inside `ModalContent`, so `window` is read at render time of an open
|
|
20
|
-
* dialog, never during SSR.
|
|
21
15
|
*/
|
|
22
|
-
export declare function
|
|
23
|
-
projectId: string;
|
|
24
|
-
sessionId: string;
|
|
25
|
-
}): import("react").JSX.Element;
|
|
16
|
+
export declare function sessionEmbedSnippet(projectId: string, sessionId: string, origin: string): string | null;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The iframe snippet a host page pastes: the ACTUAL session page
|
|
3
|
+
* (`/projects/:projectId/sessions/:sessionId`), not a separate widget or
|
|
4
|
+
* viewer. Pure, so the test can pin the exact HTML without a browser.
|
|
5
|
+
*
|
|
6
|
+
* The snippet is static HTML by construction: the URL is built from ids, and
|
|
7
|
+
* the `title` attribute is a fixed string. Never interpolate a session title
|
|
8
|
+
* into the attribute — an unescaped quote would break out of it on the HOST
|
|
9
|
+
* page, which does not share this app's CSP.
|
|
10
|
+
*
|
|
11
|
+
* Framing the session page is allowed by the CSP `frame-ancestors` rule on
|
|
12
|
+
* that route (next.config.ts); the viewer inside the frame is the app's own
|
|
13
|
+
* auth. Same-site embeds require an existing signed-in session; cross-site
|
|
14
|
+
* embeds cannot sign in inside the frame (SameSite=Lax and /auth's CSP).
|
|
15
|
+
*/
|
|
16
|
+
export function sessionEmbedSnippet(projectId, sessionId, origin) {
|
|
17
|
+
if (!projectId || !sessionId || !origin)
|
|
18
|
+
return null;
|
|
19
|
+
const src = `${origin}/workspaces/${encodeURIComponent(projectId)}/sessions/${encodeURIComponent(sessionId)}`;
|
|
20
|
+
return `<iframe src="${src}" style="height:640px;width:100%;border:0;border-radius:12px" title="Kortix session" loading="lazy"></iframe>`;
|
|
21
|
+
}
|