@kortix/ui 0.15.8 → 0.15.10
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 +75 -1
- package/dist/_vendor/shared/index.d.ts +1 -0
- package/dist/_vendor/shared/session/attachment-tile.d.ts +32 -0
- package/dist/_vendor/shared/session/stop-refusal.d.ts +15 -0
- package/dist/_vendor/shared/session/tool-row-text.d.ts +58 -0
- package/dist/_vendor/shared/session-delivery.d.ts +2 -0
- package/dist/access/access/access-dialog-share.js +12 -6
- package/dist/access/access/share-selection.d.ts +9 -0
- package/dist/access/access/share-selection.js +64 -0
- package/dist/customize/connectors/connector-identity.js +3 -3
- package/dist/customize/connectors/connectors-page.js +1 -1
- package/dist/customize/connectors/detail/app-page.js +2 -2
- package/dist/customize/connectors/detail/connector-accounts.d.ts +3 -1
- package/dist/customize/connectors/detail/connector-accounts.js +2 -2
- package/dist/customize/connectors/detail/connector-notice-view.d.ts +4 -0
- package/dist/customize/connectors/detail/connector-notice-view.js +4 -0
- package/dist/customize/connectors/detail/connector-notice.d.ts +31 -4
- package/dist/customize/connectors/detail/connector-notice.js +23 -4
- package/dist/customize/connectors/detail/connector-page.js +35 -10
- package/dist/customize/connectors/detail/connector-status.d.ts +12 -1
- package/dist/customize/connectors/detail/connector-status.js +11 -0
- package/dist/customize/connectors/detail/status-badge.d.ts +3 -3
- package/dist/customize/connectors/detail/status-badge.js +2 -1
- package/dist/customize/connectors/detail/use-connector-detail.js +10 -2
- package/dist/customize/connectors/detail/use-mcp-oauth-sign-in.d.ts +13 -0
- package/dist/customize/connectors/detail/use-mcp-oauth-sign-in.js +29 -0
- package/dist/customize/connectors/install/use-install.js +1 -1
- package/dist/customize/providers/provider-accordion.js +9 -8
- package/dist/customize/providers/provider-connect.d.ts +3 -3
- package/dist/customize/providers/provider-connect.js +10 -16
- package/dist/customize/providers/provider-sheet.js +13 -8
- package/dist/customize/sections/component/email-connect-form.js +4 -2
- package/dist/customize/sections/connector-connection-form.d.ts +0 -1
- package/dist/customize/sections/connector-connection-form.js +0 -9
- package/dist/customize/sections/connectors-view.d.ts +4 -1
- package/dist/customize/sections/connectors-view.js +42 -7
- package/dist/customize/sections/view/account-secret-resources-panel.d.ts +15 -0
- package/dist/customize/sections/view/account-secret-resources-panel.js +44 -5
- package/dist/customize/sections/view/review-center-connected.js +7 -3
- package/dist/customize/sections/view/secret-delivery.d.ts +9 -2
- package/dist/customize/sections/view/secret-delivery.js +14 -4
- package/dist/customize/sections/view/secrets-view.js +21 -5
- package/dist/customize/settings/tabs/workspace-keys.js +53 -11
- package/dist/customize/shared/feature-gate-screen.js +1 -1
- package/dist/customize/triggers/schedule/event-account-picker.js +1 -1
- package/dist/customize/triggers/schedule/schedule-builder.js +1 -1
- package/dist/customize/triggers/schedule/schedule-copy.js +4 -0
- package/dist/customize/triggers/schedule/schedule-detail-sheet.js +14 -3
- package/dist/customize/triggers/schedule/then-fields.d.ts +3 -1
- package/dist/customize/triggers/schedule/then-fields.js +8 -4
- package/dist/customize/triggers/schedule/trigger-composer.js +1 -1
- package/dist/customize/triggers/schedule/trigger-list.d.ts +3 -1
- package/dist/customize/triggers/schedule/trigger-list.js +18 -2
- package/dist/customize/triggers/schedule/trigger-runs-logic.js +4 -2
- package/dist/customize/triggers/schedule/trigger-runs-panel.js +4 -1
- package/dist/customize/triggers/schedule/use-event-app-connect.js +2 -1
- package/dist/files/renderers/pptx-renderer.js +5 -20
- package/dist/files/renderers/presentation/FullScreenPresentationViewer.d.ts +3 -2
- package/dist/files/renderers/presentation/FullScreenPresentationViewer.js +23 -304
- package/dist/files/renderers/presentation/presentation-export-menu.d.ts +14 -0
- package/dist/files/renderers/presentation/presentation-export-menu.js +44 -0
- package/dist/files/renderers/presentation/presentation-utils.d.ts +1 -0
- package/dist/files/renderers/presentation/presentation-utils.js +4 -0
- package/dist/files/renderers/presentation/slide-iframe.d.ts +23 -0
- package/dist/files/renderers/presentation/slide-iframe.js +61 -0
- package/dist/files/renderers/presentation/use-presentation-metadata.d.ts +39 -0
- package/dist/files/renderers/presentation/use-presentation-metadata.js +137 -0
- package/dist/files/renderers/presentation/use-slide-navigation.d.ts +17 -0
- package/dist/files/renderers/presentation/use-slide-navigation.js +82 -0
- package/dist/files/renderers/shared/use-stage-fit-scale.d.ts +19 -0
- package/dist/files/renderers/shared/use-stage-fit-scale.js +41 -0
- package/dist/files/renderers/show-content-renderer.js +16 -11
- package/dist/files/renderers/xlsx/xlsx-renderer.d.ts +4 -13
- package/dist/files/renderers/xlsx/xlsx-renderer.js +6 -63
- package/dist/files/renderers/xlsx/xlsx-viewer.d.ts +4 -2
- package/dist/files/renderers/xlsx/xlsx-viewer.js +28 -34
- package/dist/files/viewer/file-content-renderer.js +1 -4
- package/dist/files/viewer/use-file-content-state.js +10 -9
- package/dist/i18n/en.d.ts +55 -7
- package/dist/i18n/en.js +59 -11
- package/dist/internal/billing/compute-pricing.d.ts +7 -1
- package/dist/internal/billing/compute-pricing.js +7 -1
- package/dist/internal/chrome/use-chrome-offered.d.ts +2 -1
- package/dist/internal/chrome/use-chrome-offered.js +4 -2
- package/dist/internal/hooks/connectors/invalidate-connections.d.ts +10 -0
- package/dist/internal/hooks/connectors/invalidate-connections.js +18 -0
- package/dist/internal/hooks/connectors/use-finish-sign-in.d.ts +13 -0
- package/dist/internal/hooks/connectors/use-finish-sign-in.js +33 -0
- package/dist/internal/hooks/connectors/use-pipedream-connect-member.js +6 -1
- package/dist/internal/hooks/connectors/use-pipedream-connect-project.js +6 -1
- package/dist/internal/hooks/projects/use-new-project-session.d.ts +2 -0
- package/dist/internal/hooks/projects/use-new-project-session.js +4 -1
- package/dist/internal/hooks/use-review-session-summary.d.ts +1 -1
- package/dist/internal/hooks/use-review-session-summary.js +1 -1
- package/dist/internal/lib/browser-noise/rules/injected-scripts.js +2 -2
- package/dist/internal/lib/error-handler.js +33 -0
- package/dist/internal/lib/trigger-clock.d.ts +7 -2
- package/dist/internal/lib/trigger-clock.js +17 -3
- package/dist/internal/notifications/notification-inbox.d.ts +4 -10
- package/dist/internal/notifications/notification-inbox.js +8 -9
- package/dist/internal/stores/connector-gate-store.d.ts +3 -1
- package/dist/internal/stores/connector-gate-store.js +13 -3
- package/dist/internal/stores/upgrade-dialog-store.d.ts +4 -0
- package/dist/internal/stores/upgrade-dialog-store.js +2 -0
- package/dist/lib/routes.d.ts +4 -11
- package/dist/lib/routes.js +3 -5
- package/dist/lib/z-stack.d.ts +5 -1
- package/dist/lib/z-stack.js +12 -2
- package/dist/markdown/unified-markdown-utils.d.ts +7 -0
- package/dist/markdown/unified-markdown-utils.js +19 -0
- package/dist/markdown/unified-markdown.js +16 -3
- package/dist/primitives/alert-dialog.js +1 -1
- package/dist/primitives/dialog.js +3 -1
- package/dist/primitives/drawer.js +1 -1
- package/dist/primitives/modal.js +1 -1
- package/dist/primitives/preview-image.js +1 -1
- package/dist/primitives/sheet.js +1 -1
- package/dist/session/composer/ComposerCard.js +4 -2
- package/dist/session/composer/attachment-tile.d.ts +2 -26
- package/dist/session/composer/attachment-tile.js +3 -47
- package/dist/session/composer/composer-chat-input.d.ts +2 -1
- package/dist/session/composer/composer-chat-input.js +2 -2
- package/dist/session/composer/composer.d.ts +2 -0
- package/dist/session/composer/composer.js +5 -8
- package/dist/session/composer/draft/home-composer-focus-handoff.d.ts +7 -0
- package/dist/session/composer/draft/home-composer-focus-handoff.js +94 -0
- package/dist/session/composer/draft/use-composer-draft.d.ts +3 -1
- package/dist/session/composer/draft/use-composer-draft.js +22 -2
- package/dist/session/composer/editor/composer-editor.d.ts +4 -2
- package/dist/session/composer/editor/composer-editor.js +7 -3
- package/dist/session/composer/hooks/use-composer-focus.js +4 -2
- package/dist/session/index.d.ts +1 -0
- package/dist/session/index.js +1 -0
- package/dist/session/models/chatgpt-connection-button.js +5 -9
- package/dist/session/models/model-connection-gate.d.ts +2 -1
- package/dist/session/models/model-connection-gate.js +21 -5
- package/dist/session/models/model-connection-layout.d.ts +2 -0
- package/dist/session/models/model-connection-layout.js +4 -0
- package/dist/session/models/model-picker-panel.js +6 -2
- package/dist/session/models/model-selector.d.ts +1 -1
- package/dist/session/models/model-selector.js +9 -6
- package/dist/session/models/provider-key-action.d.ts +10 -0
- package/dist/session/models/provider-key-action.js +35 -0
- package/dist/session/models/provider-key-slot.d.ts +9 -0
- package/dist/session/models/provider-key-slot.js +19 -0
- package/dist/session/models/subscription-offer.d.ts +4 -0
- package/dist/session/models/subscription-offer.js +11 -3
- package/dist/session/overrides/session-overrides-toolbar.js +2 -4
- package/dist/session/prompts/ask-deck.d.ts +5 -1
- package/dist/session/prompts/ask-deck.js +15 -3
- package/dist/session/prompts/question-labels.d.ts +16 -0
- package/dist/session/prompts/question-labels.js +34 -0
- package/dist/session/prompts/question-prompt.js +6 -6
- package/dist/session/prompts/session-connect-prompt.d.ts +40 -0
- package/dist/session/prompts/session-connect-prompt.js +126 -0
- package/dist/session/status/provisioning-failure.d.ts +23 -2
- package/dist/session/status/provisioning-failure.js +53 -3
- package/dist/session/status/session-error-banner.d.ts +1 -1
- package/dist/session/status/session-error-banner.js +12 -4
- package/dist/session/status/stop-refusal.d.ts +6 -12
- package/dist/session/status/stop-refusal.js +6 -19
- package/dist/session/thread/agent-run-props.d.ts +19 -0
- package/dist/session/thread/agent-run-props.js +54 -0
- package/dist/session/thread/session-chat.js +34 -6
- package/dist/session/thread/transcript.d.ts +17 -1
- package/dist/session/thread/transcript.js +104 -16
- package/dist/session/tool/tools/bash-tool.d.ts +3 -52
- package/dist/session/tool/tools/bash-tool.js +3 -86
- package/dist/session/turn/answer-streaming.d.ts +21 -0
- package/dist/session/turn/answer-streaming.js +34 -0
- package/dist/session/turn/queued-prompt-bubbles.d.ts +5 -0
- package/dist/session/turn/queued-prompt-bubbles.js +12 -0
- package/dist/session/turn/turn-work-accordion.d.ts +3 -1
- package/dist/session/turn/turn-work-accordion.js +2 -2
- package/dist/styles.css +1 -1
- package/dist/test-utils/intl.d.ts +55 -7
- package/dist/workspace/home/first-chat.d.ts +7 -1
- package/dist/workspace/home/first-chat.js +12 -5
- package/dist/workspace/inbox/workspace-inbox.d.ts +6 -16
- package/dist/workspace/inbox/workspace-inbox.js +9 -51
- package/dist/workspace/layout/project-home.js +5 -11
- package/dist/workspace/layout/use-project-home-send.d.ts +2 -0
- package/dist/workspace/layout/use-project-home-send.js +29 -15
- package/dist/workspace/new/advanced-fields.d.ts +4 -1
- package/dist/workspace/new/advanced-fields.js +2 -2
- package/dist/workspace/new/workspace-name.d.ts +9 -0
- package/dist/workspace/new/workspace-name.js +20 -0
- package/dist/workspace/projects/session-starter.d.ts +6 -4
- package/dist/workspace/projects/session-starter.js +8 -14
- package/dist/workspace/review/review-center.d.ts +6 -2
- package/dist/workspace/review/review-center.js +45 -25
- package/dist/workspace/sidebar/workspace-menu-model.d.ts +3 -5
- package/dist/workspace/sidebar/workspace-menu-model.js +1 -1
- package/package.json +3 -7
- package/skills/kortix-ui/references/modules.md +1 -1
- package/dist/customize/connectors/invalidate-connections.d.ts +0 -2
- package/dist/customize/connectors/invalidate-connections.js +0 -4
- package/dist/internal/notifications/use-inbox-summary.d.ts +0 -17
- package/dist/internal/notifications/use-inbox-summary.js +0 -28
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { readStartStash } from '@kortix/sdk/react';
|
|
1
|
+
import { isOptimisticSessionPrompt, readStartStash } from '@kortix/sdk/react';
|
|
2
|
+
import { isFirstPromptRow } from '../composer/queue-projection.js';
|
|
2
3
|
/** Build stable error-card copy from API-owned sandbox failure metadata. */
|
|
3
4
|
export function provisioningFailurePresentation(metadata, sandboxLabel, tI18nComplete) {
|
|
4
5
|
const resolvedSandboxLabel = sandboxLabel ?? 'session';
|
|
@@ -70,6 +71,35 @@ export function pendingSessionPromptFromMetadata(metadata) {
|
|
|
70
71
|
attachment_names: attachmentNames,
|
|
71
72
|
};
|
|
72
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* The session's own prompt in its server inbox, oldest first.
|
|
76
|
+
*
|
|
77
|
+
* The create stores the first prompt as a `session_lifecycle_commands` row and
|
|
78
|
+
* strips its text from `metadata.pending_prompt` (`pending-prompt.ts`). When
|
|
79
|
+
* the box never boots, that row is the ONLY copy of the prompt: it stays
|
|
80
|
+
* `queued`, then goes `dead_lettered` (listed as `failed`) once its delivery
|
|
81
|
+
* attempts are spent. The first-prompt row wins; any other person-written row
|
|
82
|
+
* is next. Optimistic rows have no server id to retry, so they never count.
|
|
83
|
+
*/
|
|
84
|
+
function inboxPromptForRecovery(prompts) {
|
|
85
|
+
const candidates = prompts.filter((prompt) => !isOptimisticSessionPrompt(prompt) && !prompt.synthetic && !!prompt.prompt_id);
|
|
86
|
+
const row = candidates.find(isFirstPromptRow) ?? candidates[0];
|
|
87
|
+
if (!row)
|
|
88
|
+
return null;
|
|
89
|
+
const text = row.full_text || row.text || '';
|
|
90
|
+
const attachmentNames = (row.attachments ?? []).map((file) => file.filename);
|
|
91
|
+
if (text.trim().length === 0 && attachmentNames.length === 0)
|
|
92
|
+
return null;
|
|
93
|
+
return {
|
|
94
|
+
text,
|
|
95
|
+
agent: null,
|
|
96
|
+
model: null,
|
|
97
|
+
variant: null,
|
|
98
|
+
attachment_names: attachmentNames,
|
|
99
|
+
redeliveredOnRestart: true,
|
|
100
|
+
inboxPrompt: { promptId: row.prompt_id, failed: row.state === 'failed' },
|
|
101
|
+
};
|
|
102
|
+
}
|
|
73
103
|
/**
|
|
74
104
|
* The recovery copy, from the server when it has one and from this tab's start
|
|
75
105
|
* stash otherwise. Never consumes either.
|
|
@@ -83,11 +113,19 @@ export function pendingSessionPromptFromMetadata(metadata) {
|
|
|
83
113
|
* created has neither: its first prompt is `metadata.initial_prompt`. That
|
|
84
114
|
* prompt is shown only while `runtimeSessionId` is empty, which is the same
|
|
85
115
|
* condition under which the restart re-delivers it.
|
|
116
|
+
*
|
|
117
|
+
* `inboxPrompts` is `GET .../prompts`. A session the current API created keeps
|
|
118
|
+
* its first prompt ONLY there, so it answers before the start stash: the stash
|
|
119
|
+
* is a client-delivered copy, and posting it beside the server's own row sent
|
|
120
|
+
* the prompt twice.
|
|
86
121
|
*/
|
|
87
|
-
export function pendingSessionPromptForRecovery(sessionId, metadata, runtimeSessionId) {
|
|
122
|
+
export function pendingSessionPromptForRecovery(sessionId, metadata, runtimeSessionId, inboxPrompts = []) {
|
|
88
123
|
const fromMetadata = pendingSessionPromptFromMetadata(metadata);
|
|
89
124
|
if (fromMetadata)
|
|
90
125
|
return { ...fromMetadata, redeliveredOnRestart: false };
|
|
126
|
+
const fromInbox = inboxPromptForRecovery(inboxPrompts);
|
|
127
|
+
if (fromInbox)
|
|
128
|
+
return fromInbox;
|
|
91
129
|
const stash = readStartStash(sessionId);
|
|
92
130
|
if (stash && stash.prompt.trim().length > 0) {
|
|
93
131
|
return {
|
|
@@ -119,6 +157,18 @@ export function pendingSessionPromptForRecovery(sessionId, metadata, runtimeSess
|
|
|
119
157
|
export function recoveryPromptToSendOnRetry(prompt) {
|
|
120
158
|
if (!prompt || prompt.redeliveredOnRestart)
|
|
121
159
|
return null;
|
|
122
|
-
const { redeliveredOnRestart: _redeliveredOnRestart, ...toSend } = prompt;
|
|
160
|
+
const { redeliveredOnRestart: _redeliveredOnRestart, inboxPrompt: _inboxPrompt, ...toSend } = prompt;
|
|
123
161
|
return toSend;
|
|
124
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* The inbox row Retry must re-queue, or null, read when the restarted box is
|
|
165
|
+
* ready. Retry remembers the row id; its state is checked then, not at the
|
|
166
|
+
* click, because a row still queued at the click can dead-letter while the box
|
|
167
|
+
* restarts. A `failed` row is never claimed again on its own. A queued row is
|
|
168
|
+
* delivered by the drain, so re-queueing it would only reorder it.
|
|
169
|
+
*/
|
|
170
|
+
export function inboxPromptToRequeue(promptId, prompts) {
|
|
171
|
+
if (!promptId)
|
|
172
|
+
return null;
|
|
173
|
+
return prompts.some((row) => row.prompt_id === promptId && row.state === 'failed') ? promptId : null;
|
|
174
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type GatewayErrorDetails } from '@kortix/sdk';
|
|
2
2
|
import { type KortixSendError } from '@kortix/sdk/react';
|
|
3
|
-
type TurnErrorGatewayDetails = Pick<GatewayErrorDetails, 'provider' | 'code' | 'suggestion' | 'requestId' | 'attemptFailures' | 'requestedModel' | 'resolvedModel'>;
|
|
3
|
+
type TurnErrorGatewayDetails = Pick<GatewayErrorDetails, 'provider' | 'code' | 'suggestion' | 'requestId' | 'attemptFailures' | 'requestedModel' | 'resolvedModel' | 'upstreamStatus'>;
|
|
4
4
|
/**
|
|
5
5
|
* Which row a plain-text turn error renders, and whether it opens. The one
|
|
6
6
|
* decision `TurnErrorDisplay` makes for `errorText`, exported so the debug page
|
|
@@ -7,6 +7,8 @@ import { chatGptConnectionAction } from '../models/chatgpt-connection-action.js'
|
|
|
7
7
|
import { ChatGptConnectionSlot } from '../models/chatgpt-connection-button.js';
|
|
8
8
|
import { ClaudeConnectionSlot, claudeConnectionAction } from '../models/claude-connection-slot.js';
|
|
9
9
|
import { AskOwnerForCreditsButton } from '../models/ask-owner-for-credits-button.js';
|
|
10
|
+
import { providerKeyFix } from '../models/provider-key-action.js';
|
|
11
|
+
import { ProviderKeySlot } from '../models/provider-key-slot.js';
|
|
10
12
|
import { Button } from '../../primitives/button.js';
|
|
11
13
|
import { ChainOfThoughtStep } from '../../primitives/chain-of-thought.js';
|
|
12
14
|
import { DisclosureContent, DisclosureTrigger } from '../../primitives/disclosure.js';
|
|
@@ -162,7 +164,7 @@ function GatewayAttemptFailureList({ details }) {
|
|
|
162
164
|
* a billing card through `error.kind`; that path is not described here.)
|
|
163
165
|
*/
|
|
164
166
|
export function describeTurnErrorRow({ text, gateway, raw, }) {
|
|
165
|
-
if (isInsufficientCreditsError(text) || isUsageLimitError(text)) {
|
|
167
|
+
if (!providerKeyFix(gateway) && (isInsufficientCreditsError(text) || isUsageLimitError(text))) {
|
|
166
168
|
return { kind: 'billing-card', expandable: false };
|
|
167
169
|
}
|
|
168
170
|
const hasMeta = Boolean(gateway?.provider || gateway?.code || gateway?.requestId);
|
|
@@ -252,14 +254,19 @@ export function TurnErrorDisplay({ errorText, errorDetails, errorRaw, defaultDet
|
|
|
252
254
|
}
|
|
253
255
|
return _jsx(InsufficientCreditsCard, { errorText: text, className: className });
|
|
254
256
|
}
|
|
257
|
+
// A provider key the person fixes in Models (none, refused, expired, or a
|
|
258
|
+
// provider account with no funds). Decided before the credits sniff: an
|
|
259
|
+
// OpenRouter "Insufficient credits" is the provider's account, not Kortix
|
|
260
|
+
// credits, and the Kortix top-up card would not fix it.
|
|
261
|
+
const providerFix = providerKeyFix(gateway);
|
|
255
262
|
// Insufficient credits → actionable card with buy/auto-topup buttons.
|
|
256
263
|
// Also covers turn-level errors passed as plain `errorText`, which never
|
|
257
264
|
// go through `classifySendError`.
|
|
258
|
-
if (isInsufficientCreditsError(text)) {
|
|
265
|
+
if (!providerFix && isInsufficientCreditsError(text)) {
|
|
259
266
|
return _jsx(InsufficientCreditsCard, { errorText: text, className: className });
|
|
260
267
|
}
|
|
261
268
|
// Free-tier / subscription / budget limit → actionable upgrade card
|
|
262
|
-
if (isUsageLimitError(text)) {
|
|
269
|
+
if (!providerFix && isUsageLimitError(text)) {
|
|
263
270
|
return _jsx(UsageLimitCard, { errorText: text, className: className });
|
|
264
271
|
}
|
|
265
272
|
// A member's own ChatGPT login expired or is missing: the fix is theirs to
|
|
@@ -268,7 +275,8 @@ export function TurnErrorDisplay({ errorText, errorDetails, errorRaw, defaultDet
|
|
|
268
275
|
// The same for the member's own Claude subscription (Claude models run on it).
|
|
269
276
|
const claude = chatGpt ? null : claudeConnectionAction(text);
|
|
270
277
|
// Real errors → a checkpoint row in the activity lane, not a boxed alert.
|
|
271
|
-
return (_jsx(TurnErrorCheckpoint, { text: text, gateway: gateway, raw: errorRaw, defaultOpen: defaultDetailsOpen, action: chatGpt ? _jsx(ChatGptConnectionSlot, { action: chatGpt }) : claude ? _jsx(ClaudeConnectionSlot, { action: claude })
|
|
278
|
+
return (_jsx(TurnErrorCheckpoint, { text: text, gateway: gateway, raw: errorRaw, defaultOpen: defaultDetailsOpen, action: chatGpt ? _jsx(ChatGptConnectionSlot, { action: chatGpt }) : claude ? _jsx(ClaudeConnectionSlot, { action: claude })
|
|
279
|
+
: providerFix ? _jsx(ProviderKeySlot, { providerId: providerFix.providerId }) : undefined, modelOptions: modelOptions, className: className }));
|
|
272
280
|
}
|
|
273
281
|
export function SessionRetryDisplay({ message, attempt, secondsLeft, details, className, }) {
|
|
274
282
|
if (!message)
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* The composer hides Stop when `useSession().canStop` says no, so a refusal
|
|
3
|
+
* only reaches here when that answer was stale. The server's own words are
|
|
4
|
+
* what the toast says.
|
|
5
|
+
*
|
|
6
|
+
* The guard lives once in `@kortix/shared/session/stop-refusal`.
|
|
6
7
|
*/
|
|
7
|
-
export
|
|
8
|
-
/**
|
|
9
|
-
* The server's message when it refused a stop, or null for any other failure.
|
|
10
|
-
* A REST stop (the hold, "Stop and send") is an `ApiError` carrying the code.
|
|
11
|
-
* The runtime abort answers through the sandbox proxy, whose error keeps the
|
|
12
|
-
* status and the message but not the code, so a 403 counts there too.
|
|
13
|
-
*/
|
|
14
|
-
export declare function stopRefusalMessage(error: unknown): string | null;
|
|
8
|
+
export { NOT_TURN_PROMPTER, stopRefusalMessage } from '../../_vendor/shared/session/stop-refusal.js';
|
|
@@ -1,21 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* The composer hides Stop when `useSession().canStop` says no, so a refusal
|
|
3
|
+
* only reaches here when that answer was stale. The server's own words are
|
|
4
|
+
* what the toast says.
|
|
5
|
+
*
|
|
6
|
+
* The guard lives once in `@kortix/shared/session/stop-refusal`.
|
|
6
7
|
*/
|
|
7
|
-
export
|
|
8
|
-
/**
|
|
9
|
-
* The server's message when it refused a stop, or null for any other failure.
|
|
10
|
-
* A REST stop (the hold, "Stop and send") is an `ApiError` carrying the code.
|
|
11
|
-
* The runtime abort answers through the sandbox proxy, whose error keeps the
|
|
12
|
-
* status and the message but not the code, so a 403 counts there too.
|
|
13
|
-
*/
|
|
14
|
-
export function stopRefusalMessage(error) {
|
|
15
|
-
if (!error || typeof error !== 'object')
|
|
16
|
-
return null;
|
|
17
|
-
const { status, code, message } = error;
|
|
18
|
-
if (code !== NOT_TURN_PROMPTER && status !== 403)
|
|
19
|
-
return null;
|
|
20
|
-
return typeof message === 'string' && message ? message : null;
|
|
21
|
-
}
|
|
8
|
+
export { NOT_TURN_PROMPTER, stopRefusalMessage } from '../../_vendor/kortix-shared.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type SessionLogAgentRun, type SessionLogTurn } from '@kortix/sdk';
|
|
2
|
+
/** What one transcript row receives from its agent run (KRTX-4732). */
|
|
3
|
+
export interface AgentRunRowProps {
|
|
4
|
+
agentRun?: SessionLogAgentRun;
|
|
5
|
+
runTurns?: readonly SessionLogTurn[];
|
|
6
|
+
foldStartedWork?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface AgentRunLayout {
|
|
9
|
+
/** The turns the transcript draws no row for: they fold into their run's anchor. */
|
|
10
|
+
absorbed: ReadonlySet<string>;
|
|
11
|
+
/** A row's run props; the same object while nothing about the run changed. */
|
|
12
|
+
propsOf: (turnId: string) => AgentRunRowProps;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The agent runs of a transcript (`sessionLogAgentRuns`), as row props. A stream delta remakes
|
|
16
|
+
* the turn list; a row whose run did not change keeps its props object, so its memoized row
|
|
17
|
+
* still bails out. `disabled` (a messages-only thread): no runs.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useAgentRunLayout(turns: readonly SessionLogTurn[], disabled: boolean): AgentRunLayout;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { sessionLogAgentRuns } from '@kortix/sdk';
|
|
3
|
+
import { useMemo, useState } from 'react';
|
|
4
|
+
const NONE = Object.freeze({});
|
|
5
|
+
const EMPTY = { absorbed: new Set(), propsOf: () => NONE };
|
|
6
|
+
const sameRun = (a, b) => a.anchor === b.anchor &&
|
|
7
|
+
a.agents === b.agents &&
|
|
8
|
+
a.started === b.started &&
|
|
9
|
+
a.reported === b.reported &&
|
|
10
|
+
a.durationMs === b.durationMs &&
|
|
11
|
+
a.live === b.live &&
|
|
12
|
+
a.stopped === b.stopped &&
|
|
13
|
+
a.turns.length === b.turns.length &&
|
|
14
|
+
a.turns.every((id, i) => id === b.turns[i]);
|
|
15
|
+
const sameTurns = (a, b) => a === b || (!!a && !!b && a.length === b.length && a.every((turn, i) => turn === b[i]));
|
|
16
|
+
/**
|
|
17
|
+
* The agent runs of a transcript (`sessionLogAgentRuns`), as row props. A stream delta remakes
|
|
18
|
+
* the turn list; a row whose run did not change keeps its props object, so its memoized row
|
|
19
|
+
* still bails out. `disabled` (a messages-only thread): no runs.
|
|
20
|
+
*/
|
|
21
|
+
export function useAgentRunLayout(turns, disabled) {
|
|
22
|
+
// The props each row got last time. A cache, not state: writing it never renders.
|
|
23
|
+
const [previous] = useState(() => new Map());
|
|
24
|
+
return useMemo(() => {
|
|
25
|
+
if (disabled)
|
|
26
|
+
return EMPTY;
|
|
27
|
+
const layout = sessionLogAgentRuns(turns);
|
|
28
|
+
if (layout.runs.size === 0 && layout.settledLaunches.size === 0) {
|
|
29
|
+
previous.clear();
|
|
30
|
+
return EMPTY;
|
|
31
|
+
}
|
|
32
|
+
const byId = new Map(turns.map((turn) => [turn.id, turn]));
|
|
33
|
+
const next = new Map();
|
|
34
|
+
const ids = new Set([...layout.runs.keys(), ...layout.settledLaunches]);
|
|
35
|
+
for (const id of ids) {
|
|
36
|
+
const run = layout.runs.get(id);
|
|
37
|
+
const runTurns = run?.turns.slice(0, -1).map((turnId) => byId.get(turnId));
|
|
38
|
+
const fresh = {
|
|
39
|
+
...(run ? { agentRun: run, runTurns } : {}),
|
|
40
|
+
...(layout.settledLaunches.has(id) ? { foldStartedWork: true } : {}),
|
|
41
|
+
};
|
|
42
|
+
const old = previous.get(id);
|
|
43
|
+
const unchanged = old &&
|
|
44
|
+
!!old.foldStartedWork === !!fresh.foldStartedWork &&
|
|
45
|
+
(old.agentRun && fresh.agentRun ? sameRun(old.agentRun, fresh.agentRun) : old.agentRun === fresh.agentRun) &&
|
|
46
|
+
sameTurns(old.runTurns, fresh.runTurns);
|
|
47
|
+
next.set(id, unchanged ? old : fresh);
|
|
48
|
+
}
|
|
49
|
+
previous.clear();
|
|
50
|
+
for (const [id, props] of next)
|
|
51
|
+
previous.set(id, props);
|
|
52
|
+
return { absorbed: layout.absorbed, propsOf: (turnId) => next.get(turnId) ?? NONE };
|
|
53
|
+
}, [turns, disabled, previous]);
|
|
54
|
+
}
|
|
@@ -5,6 +5,7 @@ import { uiRoutes } from '../../lib/routes.js';
|
|
|
5
5
|
import { isQuestionTool } from '@kortix/sdk';
|
|
6
6
|
import { SessionAccessPrompt } from '../prompts/session-access-prompt.js';
|
|
7
7
|
import { SessionApprovalPrompt } from '../prompts/session-approval-prompt.js';
|
|
8
|
+
import { SessionConnectPrompt } from '../prompts/session-connect-prompt.js';
|
|
8
9
|
import { childSessionHref } from '../tool/tools/session-spawn-urls.js';
|
|
9
10
|
import { SessionPermissionPrompt } from '../prompts/session-permission-prompt.js';
|
|
10
11
|
import { useSessionWallpaperLayer } from '../panel/session-wallpaper-layer.js';
|
|
@@ -117,6 +118,7 @@ import { HELD_COMMAND_ROW_PREFIX, canReleaseHeldCommand, heldCommandRows, } from
|
|
|
117
118
|
import { useSessionHistoryViewStore } from '../../internal/stores/session-history-view-store.js';
|
|
118
119
|
import { downloadBlob } from '../../internal/lib/utils/download.js';
|
|
119
120
|
import { RestoreNotice, hasOutOfContext } from './session-history.js';
|
|
121
|
+
import { useAgentRunLayout } from './agent-run-props.js';
|
|
120
122
|
import { TranscriptTurnRow, isAgentNoticeTurn, strandedPromptIds, optimisticAnswersCache, promptTexts, resolveTurnError, } from './transcript.js';
|
|
121
123
|
export { SessionReportCard, deriveTurnErrorAbortState, deriveTurnErrorPresentation } from './transcript.js';
|
|
122
124
|
// ============================================================================
|
|
@@ -1256,7 +1258,9 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
1256
1258
|
const messageCount = messages?.length ?? 0;
|
|
1257
1259
|
const { scrollRef, contentRef, spacerElRef, showScrollButton, scrollToBottom, smoothScrollToAbsoluteBottom, anchorTurn, startAtTop, } = useAutoScroll({
|
|
1258
1260
|
hasContent: messageCount > 0,
|
|
1259
|
-
|
|
1261
|
+
// Pin the newest prompt while it runs. Settled history needs only the
|
|
1262
|
+
// bottom gap, so short conversations reveal their earlier turns.
|
|
1263
|
+
room: !transcriptRows && effectiveBusy,
|
|
1260
1264
|
});
|
|
1261
1265
|
// Cmd/Ctrl+P prints the WHOLE conversation. The shortcut is intercepted
|
|
1262
1266
|
// because neither half of what printing needs can be done in CSS: the
|
|
@@ -1496,6 +1500,8 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
1496
1500
|
const [approvalDocked, setApprovalDocked] = useState(false);
|
|
1497
1501
|
// My Kortix asking to give a colleague access docks the same way.
|
|
1498
1502
|
const [accessDocked, setAccessDocked] = useState(false);
|
|
1503
|
+
// A connector sign-in the agent started docks the same way (`SessionConnectPrompt`).
|
|
1504
|
+
const [connectDocked, setConnectDocked] = useState(false);
|
|
1499
1505
|
const questionPromptTimerRef = useRef(null);
|
|
1500
1506
|
useEffect(() => {
|
|
1501
1507
|
const nextQuestion = activePendingQuestion;
|
|
@@ -1984,6 +1990,10 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
1984
1990
|
// Turns whose prompt is another agent's notice: the work continues across
|
|
1985
1991
|
// them, so they sit a continuation's distance below the turn above.
|
|
1986
1992
|
const agentNoticeTurnIds = useMemo(() => new Set(turns.filter((turn) => isAgentNoticeTurn(turn)).map((turn) => turn.id)), [turns]);
|
|
1993
|
+
// A person's agents report back as one unit: the reports and work of a run fold into one row
|
|
1994
|
+
// on its last turn, and every answer stays in view under it (KRTX-4732). The main transcript
|
|
1995
|
+
// only: a messages-only thread already hides notices.
|
|
1996
|
+
const agentRunLayout = useAgentRunLayout(turns, transcriptRows);
|
|
1987
1997
|
const turnRenderKeys = useMemo(() => {
|
|
1988
1998
|
const keys = new Map();
|
|
1989
1999
|
const used = new Set();
|
|
@@ -2482,8 +2492,11 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
2482
2492
|
const inboxRowExists = async () => {
|
|
2483
2493
|
if (!projectId || !projectSessionId)
|
|
2484
2494
|
return false;
|
|
2485
|
-
const { prompts } = await listSessionPrompts(projectId, projectSessionId);
|
|
2486
|
-
|
|
2495
|
+
const { prompts, sent } = await listSessionPrompts(projectId, projectSessionId);
|
|
2496
|
+
// A delivered prompt leaves `prompts` and is listed in `sent` until the
|
|
2497
|
+
// session log holds it, under the wire id this send minted.
|
|
2498
|
+
const delivered = (sent ?? []).some((row) => row.message_id === messageID || row.wire_message_id === messageID);
|
|
2499
|
+
return delivered || inboxHoldsLivePrompt(prompts, clientMessageId);
|
|
2487
2500
|
};
|
|
2488
2501
|
const deliver = async (detached) => {
|
|
2489
2502
|
// A detached send (uploads, or an earlier send of this session still
|
|
@@ -2690,6 +2703,16 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
2690
2703
|
return { ok: true };
|
|
2691
2704
|
}
|
|
2692
2705
|
catch (cause) {
|
|
2706
|
+
// A lost ACK does not refuse a prompt the inbox already holds.
|
|
2707
|
+
// Resolve that verdict before the composer can restore its draft:
|
|
2708
|
+
// recoverFromSendFailure checks asynchronously and returns an error now.
|
|
2709
|
+
if (!keepsPainted && (await inboxRowExists().catch(() => false))) {
|
|
2710
|
+
acceptSendReceipt(messageID);
|
|
2711
|
+
attachments?.release();
|
|
2712
|
+
if (!paintTranscript)
|
|
2713
|
+
useQueuedDraftStore.getState().markPosted(sessionId, clientMessageId);
|
|
2714
|
+
return { ok: true };
|
|
2715
|
+
}
|
|
2693
2716
|
// A kept send is settled below: its painted message stays.
|
|
2694
2717
|
if (keepsPainted)
|
|
2695
2718
|
return { ok: false, cause, error: null };
|
|
@@ -3458,11 +3481,13 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
3458
3481
|
effectiveBusy,
|
|
3459
3482
|
canStop,
|
|
3460
3483
|
]);
|
|
3461
|
-
const chatInputSlot = useMemo(() => (_jsxs(_Fragment, { children: [_jsx(SessionApprovalPrompt, { onDockedChange: setApprovalDocked }), _jsx(SessionAccessPrompt, { projectId: projectId ?? '', asks: accessAsks, onDockedChange: setAccessDocked }), _jsx(SessionPermissionPrompt, { sessionId: sessionId, agentName: sessionScopeAgentName, permissions: pendingPermissions, onReply: handlePermissionReply }), renderedQuestion ? (_jsx("div", { className: cn('w-full overflow-hidden transition-[max-height,opacity,transform] ease-in-out', questionPromptVisible
|
|
3484
|
+
const chatInputSlot = useMemo(() => (_jsxs(_Fragment, { children: [_jsx(SessionApprovalPrompt, { onDockedChange: setApprovalDocked }), _jsx(SessionAccessPrompt, { projectId: projectId ?? '', asks: accessAsks, onDockedChange: setAccessDocked }), projectId && projectSessionId ? (_jsx(SessionConnectPrompt, { projectId: projectId, sessionId: projectSessionId, busy: effectiveBusy, onDockedChange: setConnectDocked })) : null, _jsx(SessionPermissionPrompt, { sessionId: sessionId, agentName: sessionScopeAgentName, permissions: pendingPermissions, onReply: handlePermissionReply }), renderedQuestion ? (_jsx("div", { className: cn('w-full overflow-hidden transition-[max-height,opacity,transform] ease-in-out', questionPromptVisible
|
|
3462
3485
|
? 'duration-slow max-h-130 translate-y-0 opacity-100'
|
|
3463
3486
|
: 'duration-slow pointer-events-none max-h-0 -translate-y-1 opacity-0'), children: _jsx(QuestionPrompt, { ref: questionPromptRef, request: renderedQuestion, onReply: handleQuestionReply, onReject: handleQuestionReject, onActionChange: handleQuestionActionChange }, renderedQuestion.id) })) : null] })), [
|
|
3464
3487
|
projectId,
|
|
3465
3488
|
accessAsks,
|
|
3489
|
+
effectiveBusy,
|
|
3490
|
+
projectSessionId,
|
|
3466
3491
|
sessionId,
|
|
3467
3492
|
sessionScopeAgentName,
|
|
3468
3493
|
pendingPermissions,
|
|
@@ -3848,7 +3873,10 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
3848
3873
|
// re-minted echo id re-renders this node instead
|
|
3849
3874
|
// of mounting a new one (opacity keeps animating,
|
|
3850
3875
|
// hover state survives, nothing jumps).
|
|
3851
|
-
, { turnId: turn.id, modelOptions: modelOptions,
|
|
3876
|
+
, { turnId: turn.id, modelOptions: modelOptions,
|
|
3877
|
+
// An absorbed run turn keeps its viewport (keys, scroll
|
|
3878
|
+
// anchors) and draws nothing: its anchor folds it.
|
|
3879
|
+
suppressed: suppressedFailedCompaction || agentRunLayout.absorbed.has(turn.id), ...agentRunLayout.propsOf(turn.id), continuedWith: harnessSwitches.get(turn.id)?.harness, fullTextState: loaded.state[turn.id] ?? 'idle', onLoadFullText: loadFullTexts, showBusyRow: showFallbackBusyRow &&
|
|
3852
3880
|
fallbackBusyRowTurnId === turn.id,
|
|
3853
3881
|
// Queued bubbles STACK: a pending turn right after
|
|
3854
3882
|
// another pending turn sits close to it, like a
|
|
@@ -3999,7 +4027,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
3999
4027
|
// Same dead-prompt guard as questions: only lock while the agent is
|
|
4000
4028
|
// actually paused on the decision (isBusy), so a stale card can't
|
|
4001
4029
|
// swallow the composer on an idle session.
|
|
4002
|
-
lockForApproval: runtimePermissionLocksComposer(livePermissions.length, isBusy), onCustomAnswer: handleCustomAnswer, questionButtonLabel: renderedQuestion ? questionAction.label : null, questionActive: !!renderedQuestion || approvalDocked || accessDocked, questionCanAct: questionAction.canAct, onQuestionAction: handleQuestionAction, aboveSlot: chatAboveSlot, inputSlot: chatInputSlot, toolbarSlot: chatToolbarSlot, underbarSlot: chatUnderbarSlot,
|
|
4030
|
+
lockForApproval: runtimePermissionLocksComposer(livePermissions.length, isBusy), onCustomAnswer: handleCustomAnswer, questionButtonLabel: renderedQuestion ? questionAction.label : null, questionActive: !!renderedQuestion || approvalDocked || accessDocked || connectDocked, questionCanAct: questionAction.canAct, onQuestionAction: handleQuestionAction, aboveSlot: chatAboveSlot, inputSlot: chatInputSlot, toolbarSlot: chatToolbarSlot, underbarSlot: chatUnderbarSlot,
|
|
4003
4031
|
// The shell can now render on a cached transcript alone, i.e. before
|
|
4004
4032
|
// the sandbox answers — so sending has to be gated separately from
|
|
4005
4033
|
// reading. See sessionComposerReadiness.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useTranslations } from '../../i18n/index.js';
|
|
2
|
-
import { type SessionLogBlock, type SessionLogMessage, type SessionLogSegment, type SessionLogTurn, type SessionMessageAuthor, type SessionPrompt, type SessionPromptViewer, type TextBlock, type ToolCallBlock, type SessionLogReferencedText } from '@kortix/sdk';
|
|
2
|
+
import { type SessionLogBlock, type SessionLogMessage, type SessionLogSegment, type SessionLogAgentRun, type SessionLogTurn, type SessionMessageAuthor, type SessionPrompt, type SessionPromptViewer, type TextBlock, type ToolCallBlock, type SessionLogReferencedText } from '@kortix/sdk';
|
|
3
3
|
import type { AttachmentUploadStatus, NormalizedAttachment } from '../turn/user-message.js';
|
|
4
4
|
import type { TurnServedModel } from '../turn/served-model.js';
|
|
5
5
|
import { type ConversationDensity } from '../../internal/stores/user-preferences-store.js';
|
|
@@ -202,6 +202,22 @@ interface SessionTurnProps {
|
|
|
202
202
|
onEditCancel?: () => void;
|
|
203
203
|
/** Commit the edit: rewind the session at `messageId`, send `text` and the `kept` attachments. */
|
|
204
204
|
onEditSend?: (messageId: string, text: string, kept: NormalizedAttachment[]) => void;
|
|
205
|
+
/**
|
|
206
|
+
* This turn answers an agent run (`sessionLogAgentRuns`, KRTX-4732): its "Worked for" row is
|
|
207
|
+
* the run's row ("Worked for 5m · 3 agents") and folds the run's reports and work. Every answer
|
|
208
|
+
* of the run stays in view under the row, in order: an agent may give the full answer before
|
|
209
|
+
* the last report arrives, so no answer is folded away.
|
|
210
|
+
*/
|
|
211
|
+
agentRun?: SessionLogAgentRun;
|
|
212
|
+
/** The run's other turns, in order: the host draws no row for them. Keep its identity stable. */
|
|
213
|
+
runTurns?: readonly SessionLogTurn[];
|
|
214
|
+
/** Every agent this turn started has reported (`settledLaunches`): its agent rows fold too. */
|
|
215
|
+
foldStartedWork?: boolean;
|
|
216
|
+
/**
|
|
217
|
+
* A run's other turn, drawn by its anchor: `work` is its notice and work, inside the run fold;
|
|
218
|
+
* `answer` is its answer and footer, under the run row.
|
|
219
|
+
*/
|
|
220
|
+
runMember?: 'work' | 'answer';
|
|
205
221
|
}
|
|
206
222
|
/**
|
|
207
223
|
* The worker-run result row shown above a turn — an entity row in the design
|