@kortix/ui 0.15.3 → 0.15.4
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/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 +13 -6
- package/dist/i18n/en.js +19 -12
- 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/send-stop-control.d.ts +15 -1
- package/dist/session/composer/send-stop-control.js +30 -5
- 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 +11 -1
- 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 +13 -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
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { createProjectSession, markSessionFresh, platformConfig } from '@kortix/sdk';
|
|
4
|
-
import { qk, upsertCachedProjectSession
|
|
4
|
+
import { qk, upsertCachedProjectSession } from '@kortix/sdk/react';
|
|
5
5
|
import { PhoneIcon } from '@phosphor-icons/react';
|
|
6
6
|
import { useQueryClient } from '@tanstack/react-query';
|
|
7
7
|
import { useTranslations } from '../../i18n/index.js';
|
|
8
8
|
import { useProjectCanRun } from '../../internal/hooks/projects/use-project-can-run.js';
|
|
9
|
-
import { isDesktop } from '../../internal/lib/desktop-detect.js';
|
|
10
9
|
import { useUpgradeDialogStore } from '../../internal/stores/upgrade-dialog-store.js';
|
|
11
10
|
import { randomUUID } from '../../internal/lib/utils/random-uuid.js';
|
|
12
11
|
import { Button } from '../../primitives/button.js';
|
|
13
12
|
import Hint from '../../primitives/hint.js';
|
|
14
13
|
import { errorToast } from '../../primitives/toast.js';
|
|
14
|
+
import { useVoiceCallsEnabled } from './composer-call.js';
|
|
15
15
|
import { useVoiceCallStore } from './voice-call-store.js';
|
|
16
16
|
/**
|
|
17
17
|
* The agent page's Call button (Customize → Agents → <agent>). A call is a session of its own on this agent: the
|
|
18
18
|
* agent answers with its own instructions, tools and memory, and the call's transcript is that session's chat. The
|
|
19
19
|
* page stays: the session is created here, with no navigation and no toast, and the call card (voice-call-card.tsx)
|
|
20
|
-
* rings until its box answers. Only
|
|
21
|
-
*
|
|
20
|
+
* rings until its box answers. Only where `useVoiceCallsEnabled` says so: the project's `voice_call` flag is on, the
|
|
21
|
+
* host mounts the call card, and the page is not the desktop shell (no microphone entitlement yet).
|
|
22
22
|
*/
|
|
23
23
|
export function AgentCallButton({ projectId, agentName }) {
|
|
24
24
|
const t = useTranslations('voiceCall');
|
|
25
|
-
const
|
|
25
|
+
const enabled = useVoiceCallsEnabled(projectId);
|
|
26
26
|
const { canRun, isLoading: billingLoading, accountId } = useProjectCanRun(projectId);
|
|
27
27
|
const openUpgradeDialog = useUpgradeDialogStore((s) => s.openUpgradeDialog);
|
|
28
28
|
const inCall = useVoiceCallStore((s) => !!s.call);
|
|
29
29
|
const queryClient = useQueryClient();
|
|
30
|
-
if (!enabled
|
|
30
|
+
if (!enabled)
|
|
31
31
|
return null;
|
|
32
32
|
const call = async () => {
|
|
33
33
|
// The same gate as Start session: no session the account cannot run.
|
|
@@ -920,6 +920,14 @@ export declare const testUiTranslator: import("use-intl")._Translator<{
|
|
|
920
920
|
historyDescription: string;
|
|
921
921
|
openLedger: string;
|
|
922
922
|
unit: string;
|
|
923
|
+
dailySpend: string;
|
|
924
|
+
heatLess: string;
|
|
925
|
+
heatMore: string;
|
|
926
|
+
busiestDay: string;
|
|
927
|
+
noSpendInRange: string;
|
|
928
|
+
idleWorkspaces: string;
|
|
929
|
+
showIdle: string;
|
|
930
|
+
hideIdle: string;
|
|
923
931
|
};
|
|
924
932
|
tokens: {
|
|
925
933
|
keyRevoked: string;
|
|
@@ -6396,11 +6404,6 @@ export declare const testUiTranslator: import("use-intl")._Translator<{
|
|
|
6396
6404
|
recentThreads: string;
|
|
6397
6405
|
searchChannels: string;
|
|
6398
6406
|
};
|
|
6399
|
-
repositoryAccess: {
|
|
6400
|
-
label: string;
|
|
6401
|
-
enabled: string;
|
|
6402
|
-
disabled: string;
|
|
6403
|
-
};
|
|
6404
6407
|
customProvider: {
|
|
6405
6408
|
intro: string;
|
|
6406
6409
|
add: string;
|
|
@@ -7765,6 +7768,10 @@ export declare const testUiTranslator: import("use-intl")._Translator<{
|
|
|
7765
7768
|
treeYou: string;
|
|
7766
7769
|
treeExpand: string;
|
|
7767
7770
|
treeCollapse: string;
|
|
7771
|
+
emptyWorkspaces: string;
|
|
7772
|
+
storageMoreWorkspaces: string;
|
|
7773
|
+
storageWorkspaceLimit: string;
|
|
7774
|
+
storageShowFewer: string;
|
|
7768
7775
|
};
|
|
7769
7776
|
genui: {
|
|
7770
7777
|
showData: string;
|
|
@@ -9372,6 +9379,7 @@ export declare const testUiTranslator: import("use-intl")._Translator<{
|
|
|
9372
9379
|
call: string;
|
|
9373
9380
|
calling: string;
|
|
9374
9381
|
start: string;
|
|
9382
|
+
inCall: string;
|
|
9375
9383
|
end: string;
|
|
9376
9384
|
connecting: string;
|
|
9377
9385
|
listening: string;
|
|
@@ -9440,7 +9448,6 @@ export declare const testUiTranslator: import("use-intl")._Translator<{
|
|
|
9440
9448
|
agentMounts: {
|
|
9441
9449
|
lead: string;
|
|
9442
9450
|
mount: string;
|
|
9443
|
-
repository: string;
|
|
9444
9451
|
viaAgent: string;
|
|
9445
9452
|
viaProject: string;
|
|
9446
9453
|
from: string;
|
|
@@ -33,17 +33,16 @@ agents:
|
|
|
33
33
|
description: "General-purpose worker: coding, research, writing, ops and data work."
|
|
34
34
|
mode: primary
|
|
35
35
|
permission: allow
|
|
36
|
-
prompt: "
|
|
36
|
+
prompt: "Your session starts with an empty /workspace. Run \`kortix workspaces clone\` to get this repository, then read AGENTS.md or CLAUDE.md when it exists."
|
|
37
37
|
tools: "*"
|
|
38
38
|
skills: "*"
|
|
39
39
|
connectors: "*"
|
|
40
40
|
secrets: "*"
|
|
41
41
|
kortix_permissions: "*"
|
|
42
|
-
workspace: { project_repository: true }
|
|
43
42
|
\`\`\`
|
|
44
43
|
|
|
45
44
|
3. Keep the agent setup this repository already has. Do not move, copy or edit those files.
|
|
46
|
-
- For each \`.claude/agents/<name>.md\`, add an agent \`<name>\` with \`prompt_file: .claude/agents/<name>.md\`, the \`description\` from its frontmatter, \`mode: primary\`, \`tools: "*"\` and \`
|
|
45
|
+
- For each \`.claude/agents/<name>.md\`, add an agent \`<name>\` with \`prompt_file: .claude/agents/<name>.md\`, the \`description\` from its frontmatter, \`mode: primary\`, \`tools: "*"\` and \`kortix_permissions: [workspace.gitops.read]\`, so it can clone the repository.
|
|
47
46
|
- For each folder that holds a \`SKILL.md\` (\`.agents/skills/<name>\`, \`.claude/skills/<name>\`, \`skills/<name>\`), add \`<name>: <folder>\` under \`skills:\`. Skip a name that starts with \`kortix-\`.
|
|
48
47
|
4. Run \`kortix validate\`. Fix every error it prints and run it again until it exits 0.
|
|
49
48
|
5. Commit only \`kortix.yaml\` with the message "chore: add kortix.yaml" and push it to \`${branch}\`.
|
|
@@ -17,6 +17,7 @@ import { SessionWelcome } from '../session/thread/session-welcome.js';
|
|
|
17
17
|
import { QUEUED_BUBBLE_OPACITY_CLASS, QueuedPromptFailure, } from '../session/turn/queued-prompt-bubbles.js';
|
|
18
18
|
import { buildOptimisticPromptTextWithUploads } from '../session/composer/uploaded-file-refs.js';
|
|
19
19
|
import { useInstantSessionSend } from '../session/composer/use-instant-session-send.js';
|
|
20
|
+
import { useSessionComposerCall } from '../session/voice/composer-call.js';
|
|
20
21
|
import { ProjectHomeWelcomeBody } from './home/welcome-body.js';
|
|
21
22
|
import { useUiViewerId } from '../providers/ui-provider.js';
|
|
22
23
|
import { cn } from '../lib/utils.js';
|
|
@@ -91,6 +92,15 @@ export function InstantSessionShell({ projectId, sessionId, stage, boundAgentNam
|
|
|
91
92
|
enabled: !!projectId && !!sessionId,
|
|
92
93
|
}).data;
|
|
93
94
|
const viewerManagesSession = projectSessionRow?.can_manage_lifecycle !== false;
|
|
95
|
+
// Nothing typed: the Send button calls this session while its computer
|
|
96
|
+
// boots, as the real chat's does once it is up (flag `voice_call`). The call
|
|
97
|
+
// card rings until the box answers.
|
|
98
|
+
const call = useSessionComposerCall({
|
|
99
|
+
projectId,
|
|
100
|
+
sessionId,
|
|
101
|
+
agent: boundAgentName ?? projectSessionRow?.agent_name,
|
|
102
|
+
topLevel: !!projectSessionRow && !projectSessionRow.parent_session_id,
|
|
103
|
+
});
|
|
94
104
|
const shellQueue = useMemo(() => projectQueueRows({
|
|
95
105
|
prompts: promptInbox.prompts,
|
|
96
106
|
drafts: extraSends.map((entry) => ({
|
|
@@ -180,7 +190,7 @@ export function InstantSessionShell({ projectId, sessionId, stage, boundAgentNam
|
|
|
180
190
|
}, editing: queueEdit.editing, onCancelEdit: queueEdit.cancel })) : undefined,
|
|
181
191
|
// Editing a queued message: the send saves it back into the queue, so the
|
|
182
192
|
// control says Submit, never the boot-time Stop.
|
|
183
|
-
submitLabel: queueEdit.editing ? tQueue('submitEdit') : null, onArrowUpAtStart: () => queueEdit.takeBack(), autoFocus: true,
|
|
193
|
+
submitLabel: queueEdit.editing ? tQueue('submitEdit') : null, onArrowUpAtStart: () => queueEdit.takeBack(), call: call, autoFocus: true,
|
|
184
194
|
// Hero radius pre-submit (matches the project home); back to the default
|
|
185
195
|
// card radius once docked so the crossfade into SessionChat doesn't pop.
|
|
186
196
|
cardClassName: submitted ? undefined : 'rounded-xl' }));
|
|
@@ -5,7 +5,7 @@ import { ACCOUNT_PANEL_PARAM, hubTarget } from '../../internal/stores/account-pa
|
|
|
5
5
|
import { SplitNoticeBanner } from '../settings/split-notice-banner.js';
|
|
6
6
|
import { useTranslations } from '../../i18n/index.js';
|
|
7
7
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
8
|
-
import { ComposerChatInput } from '../../session/composer/composer-chat-input.js';
|
|
8
|
+
import { ComposerChatInput, } from '../../session/composer/composer-chat-input.js';
|
|
9
9
|
import { ComposerDropZone } from '../../session/composer/composer-drop-zone.js';
|
|
10
10
|
import { SidebarToggle } from '../../internal/layout/sidebar-toggle.js';
|
|
11
11
|
import { PROJECT_ACTIONS } from '../../internal/lib/project-actions.js';
|
|
@@ -24,6 +24,7 @@ import { composerSelectableAgents } from '../../session/composer/composer-agent-
|
|
|
24
24
|
import { FirstChat } from '../home/first-chat.js';
|
|
25
25
|
import { SandboxPicker } from '../home/sandbox-picker.js';
|
|
26
26
|
import { ProjectHomeWallpaper, ProjectHomeWelcomeBody } from '../home/welcome-body.js';
|
|
27
|
+
import { useProjectHomeCall } from './use-project-home-call.js';
|
|
27
28
|
import { useProjectHomeSend } from './use-project-home-send.js';
|
|
28
29
|
// This path is this view's public surface — the instant session shell and the
|
|
29
30
|
// IAM tests already import from here, so the moved pieces keep their address.
|
|
@@ -211,6 +212,27 @@ function ProjectHomeView({ projectId, onSend, busy, beforeSend, onboarding: onbo
|
|
|
211
212
|
}
|
|
212
213
|
return sent;
|
|
213
214
|
}, [metaSelected, selectedSlug, send, onboarding, projectId, queryClient]);
|
|
215
|
+
// Nothing typed: the Send button calls a new session instead (flag
|
|
216
|
+
// `voice_call`, `use-project-home-call.ts`), with the sandbox chosen here as
|
|
217
|
+
// a send gets it. Only with the default send: a host's own `onSend` decides
|
|
218
|
+
// what a new session is, and a call would bypass it. Not in the first chat:
|
|
219
|
+
// it is the onboarding, and its kickoff is a typed message.
|
|
220
|
+
const homeCall = useProjectHomeCall(projectId, { beforeSend });
|
|
221
|
+
const call = useMemo(() => {
|
|
222
|
+
if (!homeCall || onSend || firstChat)
|
|
223
|
+
return undefined;
|
|
224
|
+
return {
|
|
225
|
+
inCall: homeCall.inCall,
|
|
226
|
+
onCall: (options) => homeCall.onCall({
|
|
227
|
+
...options,
|
|
228
|
+
...(metaSelected
|
|
229
|
+
? { sandbox_slug: MY_KORTIX_SANDBOX_SLUG }
|
|
230
|
+
: selectedSlug
|
|
231
|
+
? { sandbox_slug: selectedSlug }
|
|
232
|
+
: {}),
|
|
233
|
+
}),
|
|
234
|
+
};
|
|
235
|
+
}, [homeCall, onSend, firstChat, metaSelected, selectedSlug]);
|
|
214
236
|
const isMobile = useIsMobile();
|
|
215
237
|
const pendingPrefill = useComposerPrefillStore((s) => s.prefillByProject[projectId]);
|
|
216
238
|
const consumePrefill = useComposerPrefillStore((s) => s.consume);
|
|
@@ -275,7 +297,7 @@ function ProjectHomeView({ projectId, onSend, busy, beforeSend, onboarding: onbo
|
|
|
275
297
|
// beneath, the menu above.
|
|
276
298
|
underbarPlacement: firstChat || isMobile ? 'below' : 'inline', slashMenuPlacement: firstChat ? 'above' : 'below', placeholder: firstChat
|
|
277
299
|
? tFirstChat('placeholder')
|
|
278
|
-
: tI18nHardcoded.raw('autoFeaturesCoWorkerProjectLayoutProjectHomeJsxAttrPlaceholder115e6c2d'), prefill: prefill, onAgentSelectionChange: setSelectedAgent, sandboxSlot: sandboxSlot }));
|
|
300
|
+
: tI18nHardcoded.raw('autoFeaturesCoWorkerProjectLayoutProjectHomeJsxAttrPlaceholder115e6c2d'), prefill: prefill, onAgentSelectionChange: setSelectedAgent, sandboxSlot: sandboxSlot, call: call }));
|
|
279
301
|
return (
|
|
280
302
|
// A file dropped anywhere on the page attaches to the composer, as on a
|
|
281
303
|
// session page.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ComposerOptions } from '../../session/composer/composer-chat-input.js';
|
|
2
|
+
/**
|
|
3
|
+
* What the home composer's call carries: its picks (`ComposerOptions`, with the agent it shows: the composer offers
|
|
4
|
+
* a call only once it resolved one) and the sandbox template chosen beside it.
|
|
5
|
+
*/
|
|
6
|
+
export type ProjectHomeCallOptions = ComposerOptions & {
|
|
7
|
+
agent: string;
|
|
8
|
+
sandbox_slug?: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* The project home composer's voice call: with nothing typed, its button calls instead of sending. A call is a new
|
|
12
|
+
* session, as a send is: the same create (agent, sandbox, connectors, secrets, through `useNewProjectSession` with
|
|
13
|
+
* its billing, connector and double-click guards), with no first prompt. The call is placed as the create lands and
|
|
14
|
+
* the session opens, so the conversation fills its chat while the person talks.
|
|
15
|
+
*
|
|
16
|
+
* `beforeSend` is the host's own gate (apps/web checks the account's billing state): it runs first, and a throw
|
|
17
|
+
* places nothing. Undefined while the project's `voice_call` flag is off: the composer keeps the plain Send.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useProjectHomeCall(projectId: string, { beforeSend }?: {
|
|
20
|
+
beforeSend?: () => Promise<void>;
|
|
21
|
+
}): {
|
|
22
|
+
onCall: (options: ProjectHomeCallOptions) => void;
|
|
23
|
+
inCall: boolean;
|
|
24
|
+
} | undefined;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { writeStartStash } from '@kortix/sdk/react';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { useIsCreatingProjectSession } from '../../internal/hooks/projects/new-session-guard.js';
|
|
5
|
+
import { useNewProjectSession } from '../../internal/hooks/projects/use-new-project-session.js';
|
|
6
|
+
import { useVoiceCallsEnabled } from '../../session/voice/composer-call.js';
|
|
7
|
+
import { useVoiceCallStore } from '../../session/voice/voice-call-store.js';
|
|
8
|
+
import { buildNewSessionCreateInput } from './new-session-create.js';
|
|
9
|
+
/**
|
|
10
|
+
* The project home composer's voice call: with nothing typed, its button calls instead of sending. A call is a new
|
|
11
|
+
* session, as a send is: the same create (agent, sandbox, connectors, secrets, through `useNewProjectSession` with
|
|
12
|
+
* its billing, connector and double-click guards), with no first prompt. The call is placed as the create lands and
|
|
13
|
+
* the session opens, so the conversation fills its chat while the person talks.
|
|
14
|
+
*
|
|
15
|
+
* `beforeSend` is the host's own gate (apps/web checks the account's billing state): it runs first, and a throw
|
|
16
|
+
* places nothing. Undefined while the project's `voice_call` flag is off: the composer keeps the plain Send.
|
|
17
|
+
*/
|
|
18
|
+
export function useProjectHomeCall(projectId, { beforeSend } = {}) {
|
|
19
|
+
const enabled = useVoiceCallsEnabled(projectId);
|
|
20
|
+
const startSession = useNewProjectSession(projectId);
|
|
21
|
+
const creating = useIsCreatingProjectSession(projectId);
|
|
22
|
+
const inCall = useVoiceCallStore((s) => !!s.call);
|
|
23
|
+
return useMemo(() => {
|
|
24
|
+
if (!enabled)
|
|
25
|
+
return undefined;
|
|
26
|
+
return {
|
|
27
|
+
// A create in flight holds the button too: the guard would drop a second click anyway.
|
|
28
|
+
inCall: inCall || creating,
|
|
29
|
+
onCall: (options) => {
|
|
30
|
+
void (async () => {
|
|
31
|
+
try {
|
|
32
|
+
await beforeSend?.();
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
startSession({
|
|
38
|
+
create: buildNewSessionCreateInput(options),
|
|
39
|
+
scope: options.scope,
|
|
40
|
+
onNavigate: (sessionId) => {
|
|
41
|
+
// The picks the composer showed, for the session's own composer: a message typed during the call runs
|
|
42
|
+
// on them, as a first send's would (`useProjectHomeSend`).
|
|
43
|
+
writeStartStash(sessionId, {
|
|
44
|
+
prompt: '',
|
|
45
|
+
agent: options.agent,
|
|
46
|
+
model: options.model ?? null,
|
|
47
|
+
variant: options.variant ?? null,
|
|
48
|
+
});
|
|
49
|
+
useVoiceCallStore.getState().place({ projectId, sessionId, agent: options.agent });
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
})();
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}, [enabled, inCall, creating, beforeSend, startSession, projectId]);
|
|
56
|
+
}
|
|
@@ -18,6 +18,19 @@ export type WorkspaceNameResult = {
|
|
|
18
18
|
error: string;
|
|
19
19
|
};
|
|
20
20
|
export declare function validateWorkspaceName(raw: string): WorkspaceNameResult;
|
|
21
|
+
/**
|
|
22
|
+
* The message a workspace-name field renders for `result`, or null.
|
|
23
|
+
*
|
|
24
|
+
* Every error but `required` reports itself live: it can exist only after the
|
|
25
|
+
* user typed a character, and the form model (`isSubmittable`) already
|
|
26
|
+
* disables submit the moment it exists — a disabled button with no visible
|
|
27
|
+
* reason strands the user (KRTX-4627). `required` is also true before the
|
|
28
|
+
* first keystroke, the normal state while typing a name, so it waits for the
|
|
29
|
+
* field to be left once.
|
|
30
|
+
*/
|
|
31
|
+
export declare function workspaceNameMessage(result: WorkspaceNameResult, touched: boolean, t: (key: 'validation.nameRequired' | 'validation.nameCharacters' | 'validation.nameTooLong', vars?: {
|
|
32
|
+
max: number;
|
|
33
|
+
}) => string): string | null;
|
|
21
34
|
/**
|
|
22
35
|
* A ready-to-use project name ("Amber Falcon"), so `/workspaces/new` opens with a valid,
|
|
23
36
|
* friendly name instead of an empty required field. Always passes
|
|
@@ -23,6 +23,26 @@ export function validateWorkspaceName(raw) {
|
|
|
23
23
|
}
|
|
24
24
|
return { ok: true, name };
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* The message a workspace-name field renders for `result`, or null.
|
|
28
|
+
*
|
|
29
|
+
* Every error but `required` reports itself live: it can exist only after the
|
|
30
|
+
* user typed a character, and the form model (`isSubmittable`) already
|
|
31
|
+
* disables submit the moment it exists — a disabled button with no visible
|
|
32
|
+
* reason strands the user (KRTX-4627). `required` is also true before the
|
|
33
|
+
* first keystroke, the normal state while typing a name, so it waits for the
|
|
34
|
+
* field to be left once.
|
|
35
|
+
*/
|
|
36
|
+
export function workspaceNameMessage(result, touched, t) {
|
|
37
|
+
if (result.ok)
|
|
38
|
+
return null;
|
|
39
|
+
if (result.error === 'Name is required')
|
|
40
|
+
return touched ? t('validation.nameRequired') : null;
|
|
41
|
+
if (result.error.startsWith('Name must be')) {
|
|
42
|
+
return t('validation.nameTooLong', { max: WORKSPACE_NAME_MAX_LENGTH });
|
|
43
|
+
}
|
|
44
|
+
return t('validation.nameCharacters');
|
|
45
|
+
}
|
|
26
46
|
const NAME_ADJECTIVES = [
|
|
27
47
|
'Amber',
|
|
28
48
|
'Bright',
|
|
@@ -11,12 +11,15 @@ import { useCallback } from 'react';
|
|
|
11
11
|
function useBalanceWarning(accountId, tI18nComplete) {
|
|
12
12
|
const { data: accountState } = useAccountState({ accountId });
|
|
13
13
|
const openUpgradeDialog = useUpgradeDialogStore((s) => s.openUpgradeDialog);
|
|
14
|
-
//
|
|
15
|
-
// a
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
|
|
14
|
+
// The row is a door into the billing dialog, so it shows only where that
|
|
15
|
+
// dialog has a way out: one-off top-ups, or (since 2026-11-09, when top-ups
|
|
16
|
+
// went Enterprise-only) a live subscription whose monthly tier can be raised.
|
|
17
|
+
// A free account keeps the "Upgrade Plan" button instead. A caller without
|
|
18
|
+
// `billing.write` cannot act either; the session error banner tells them to
|
|
19
|
+
// ask an owner when the wallet actually blocks a run.
|
|
20
|
+
const canTopUp = ((accountState?.tier?.can_purchase_credits ?? false) ||
|
|
21
|
+
(accountState?.has_active_subscription ?? false)) &&
|
|
22
|
+
canManageBilling(accountState);
|
|
20
23
|
const handleClick = useCallback(() => openUpgradeDialog(billingDialogArgs(resolveBillingState(accountState), accountState, accountId, tI18nComplete)), [openUpgradeDialog, accountId, accountState, tI18nComplete]);
|
|
21
24
|
if (!platformConfig().billingEnabled || !accountState || !canTopUp) {
|
|
22
25
|
return { severity: null, handleClick };
|
|
@@ -5,7 +5,7 @@ export declare function SidebarAlertRow({ tone, icon, label, trailing, onClick,
|
|
|
5
5
|
tone: SidebarAlertTone;
|
|
6
6
|
icon: ReactNode;
|
|
7
7
|
label: string;
|
|
8
|
-
/** Optional right-aligned hint naming what the click does ("
|
|
8
|
+
/** Optional right-aligned hint naming what the click does ("Add credits"). */
|
|
9
9
|
trailing?: ReactNode;
|
|
10
10
|
onClick: () => void;
|
|
11
11
|
}): import("react").JSX.Element;
|
|
@@ -13,7 +13,6 @@ import { sessionOversightQueryKey } from '../../../access/iam/session-oversight-
|
|
|
13
13
|
import { ShieldCheckIcon } from '@phosphor-icons/react';
|
|
14
14
|
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
15
15
|
import { useEffect, useState } from 'react';
|
|
16
|
-
import { SessionEmbedSection } from './session-embed-section.js';
|
|
17
16
|
import { sessionAccessSummary, sessionAccessView } from './share-session-access.js';
|
|
18
17
|
import { refreshAfterShare } from './share-session-cache.js';
|
|
19
18
|
/**
|
|
@@ -59,7 +58,7 @@ export function ShareSessionModal({ projectId, session, open, onOpenChange, onSa
|
|
|
59
58
|
// while the dialog is open (a user action), and silently absent on any error
|
|
60
59
|
// — the IAM read never toasts (`showErrors: false`).
|
|
61
60
|
const accountId = session?.account_id ?? null;
|
|
62
|
-
const { accountApiEnabled
|
|
61
|
+
const { accountApiEnabled } = useUiHostConfig();
|
|
63
62
|
const oversightQuery = useQuery({
|
|
64
63
|
queryKey: sessionOversightQueryKey(accountId ?? ''),
|
|
65
64
|
queryFn: () => getSessionOversight(accountId),
|
|
@@ -105,5 +104,5 @@ export function ShareSessionModal({ projectId, session, open, onOpenChange, onSa
|
|
|
105
104
|
// Read-only, not hidden: a person a session was shared with should
|
|
106
105
|
// still be able to see who else is in it. Withholding that is what
|
|
107
106
|
// sent people to the editable dialog in the first place.
|
|
108
|
-
_jsx("p", { className: "text-foreground text-sm", "data-testid": "session-access-summary", children: session ? sessionAccessSummary(session) : null })), oversightOn ? (_jsxs(BannerAlert, { variant: "default", "data-testid": "session-oversight-disclosure", children: [_jsx(BannerAlertMedia, { children: _jsx(ShieldCheckIcon, {}) }), _jsx(BannerAlertDescription, { children: tOversight.raw('shareDisclosure') })] })) : null
|
|
107
|
+
_jsx("p", { className: "text-foreground text-sm", "data-testid": "session-access-summary", children: session ? sessionAccessSummary(session) : null })), oversightOn ? (_jsxs(BannerAlert, { variant: "default", "data-testid": "session-oversight-disclosure", children: [_jsx(BannerAlertMedia, { children: _jsx(ShieldCheckIcon, {}) }), _jsx(BannerAlertDescription, { children: tOversight.raw('shareDisclosure') })] })) : null] }), _jsxs(ModalFooter, { className: "sm:justify-between", children: [_jsx(Button, { variant: "outline-ghost", size: "sm", className: "w-full sm:w-auto", onClick: () => onOpenChange(false), disabled: save.isPending, children: view.canEdit ? 'Cancel' : 'Close' }), view.canEdit && (_jsxs(Button, { size: "sm", onClick: () => save.mutate(), disabled: save.isPending || !isSharingComplete(sharing) || blockedSelection, className: "w-full sm:w-auto", children: [save.isPending && _jsx(Loading, {}), tI18nHardcoded.raw('i18nComplete.text1509f561f241')] }))] })] }) }));
|
|
109
108
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kortix/ui",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.4",
|
|
4
4
|
"description": "Kortix UI: the shared React component library for apps/web, Kortix Apps and SDK hosts. Tailwind v4 classes, themed by CSS variables.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Elastic-2.0",
|
|
@@ -185,10 +185,6 @@
|
|
|
185
185
|
"types": "./dist/customize/agents/agent-apps-grant.d.ts",
|
|
186
186
|
"import": "./dist/customize/agents/agent-apps-grant.js"
|
|
187
187
|
},
|
|
188
|
-
"./customize/agents/agent-detail-aside": {
|
|
189
|
-
"types": "./dist/customize/agents/agent-detail-aside.d.ts",
|
|
190
|
-
"import": "./dist/customize/agents/agent-detail-aside.js"
|
|
191
|
-
},
|
|
192
188
|
"./customize/agents/agent-page": {
|
|
193
189
|
"types": "./dist/customize/agents/agent-page.d.ts",
|
|
194
190
|
"import": "./dist/customize/agents/agent-page.js"
|
|
@@ -1661,6 +1657,10 @@
|
|
|
1661
1657
|
"types": "./dist/session/composer/session-chat-input.d.ts",
|
|
1662
1658
|
"import": "./dist/session/composer/session-chat-input.js"
|
|
1663
1659
|
},
|
|
1660
|
+
"./session/models/ask-owner-for-credits-button": {
|
|
1661
|
+
"types": "./dist/session/models/ask-owner-for-credits-button.d.ts",
|
|
1662
|
+
"import": "./dist/session/models/ask-owner-for-credits-button.js"
|
|
1663
|
+
},
|
|
1664
1664
|
"./session/models/model-grouping": {
|
|
1665
1665
|
"types": "./dist/session/models/model-grouping.d.ts",
|
|
1666
1666
|
"import": "./dist/session/models/model-grouping.js"
|
|
@@ -2197,7 +2197,7 @@
|
|
|
2197
2197
|
"@extend-ai/react-docx": "^0.7.5",
|
|
2198
2198
|
"@extend-ai/react-xlsx": "0.13.4",
|
|
2199
2199
|
"@glideapps/glide-data-grid": "6.0.4-alpha24",
|
|
2200
|
-
"@kortix/llm-catalog": "0.15.
|
|
2200
|
+
"@kortix/llm-catalog": "0.15.4",
|
|
2201
2201
|
"@lezer/highlight": "1.2.3",
|
|
2202
2202
|
"@paper-design/shaders-react": "^0.0.76",
|
|
2203
2203
|
"@phosphor-icons/react": "2.1.10",
|
|
@@ -2296,7 +2296,7 @@
|
|
|
2296
2296
|
"yaml": "^2.8.2"
|
|
2297
2297
|
},
|
|
2298
2298
|
"peerDependencies": {
|
|
2299
|
-
"@kortix/sdk": "^0.15.
|
|
2299
|
+
"@kortix/sdk": "^0.15.4",
|
|
2300
2300
|
"@tanstack/react-query": "^5.75.2",
|
|
2301
2301
|
"@types/react": ">=18",
|
|
2302
2302
|
"react": ">=19",
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Button } from '../../../primitives/button.js';
|
|
4
|
-
import { Label } from '../../../primitives/label.js';
|
|
5
|
-
import { errorToast, successToast } from '../../../primitives/toast.js';
|
|
6
|
-
import { useTranslations } from '../../../i18n/index.js';
|
|
7
|
-
import { CheckIcon, CodeIcon } from '@phosphor-icons/react';
|
|
8
|
-
import { useEffect, useRef, useState } from 'react';
|
|
9
|
-
/**
|
|
10
|
-
* The iframe snippet a host page pastes: the ACTUAL session page
|
|
11
|
-
* (`/projects/:projectId/sessions/:sessionId`), not a separate widget or
|
|
12
|
-
* viewer. Pure, so the test can pin the exact HTML without a browser.
|
|
13
|
-
*
|
|
14
|
-
* The snippet is static HTML by construction: the URL is built from ids, and
|
|
15
|
-
* the `title` attribute is a fixed string. Never interpolate a session title
|
|
16
|
-
* into the attribute — an unescaped quote would break out of it on the HOST
|
|
17
|
-
* page, which does not share this app's CSP.
|
|
18
|
-
*/
|
|
19
|
-
export function sessionEmbedSnippet(projectId, sessionId, origin) {
|
|
20
|
-
if (!projectId || !sessionId || !origin)
|
|
21
|
-
return null;
|
|
22
|
-
const src = `${origin}/workspaces/${encodeURIComponent(projectId)}/sessions/${encodeURIComponent(sessionId)}`;
|
|
23
|
-
return `<iframe src="${src}" style="height:640px;width:100%;border:0;border-radius:12px" title="Kortix session" loading="lazy"></iframe>`;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* "Embed" in the Share dialog: one copy button for the iframe snippet above.
|
|
27
|
-
* Framing the session page is allowed by the CSP `frame-ancestors` rule on
|
|
28
|
-
* that route (next.config.ts); the viewer inside the frame is the app's own
|
|
29
|
-
* auth. Same-site embeds require an existing signed-in session; cross-site
|
|
30
|
-
* embeds cannot sign in inside the frame (SameSite=Lax and /auth's CSP).
|
|
31
|
-
*
|
|
32
|
-
* Mounted inside `ModalContent`, so `window` is read at render time of an open
|
|
33
|
-
* dialog, never during SSR.
|
|
34
|
-
*/
|
|
35
|
-
export function SessionEmbedSection({ projectId, sessionId, }) {
|
|
36
|
-
const t = useTranslations('hardcodedUi.sessionEmbed');
|
|
37
|
-
const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
|
|
38
|
-
const [copied, setCopied] = useState(false);
|
|
39
|
-
const copiedTimer = useRef(null);
|
|
40
|
-
const mounted = useRef(false);
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
mounted.current = true;
|
|
43
|
-
return () => {
|
|
44
|
-
mounted.current = false;
|
|
45
|
-
if (copiedTimer.current)
|
|
46
|
-
clearTimeout(copiedTimer.current);
|
|
47
|
-
};
|
|
48
|
-
}, []);
|
|
49
|
-
const origin = typeof window === 'undefined' ? null : window.location.origin;
|
|
50
|
-
const snippet = origin ? sessionEmbedSnippet(projectId, sessionId, origin) : null;
|
|
51
|
-
const copy = async () => {
|
|
52
|
-
if (!snippet)
|
|
53
|
-
return;
|
|
54
|
-
try {
|
|
55
|
-
await navigator.clipboard.writeText(snippet);
|
|
56
|
-
if (!mounted.current)
|
|
57
|
-
return;
|
|
58
|
-
setCopied(true);
|
|
59
|
-
successToast(t('copied'));
|
|
60
|
-
if (copiedTimer.current)
|
|
61
|
-
clearTimeout(copiedTimer.current);
|
|
62
|
-
copiedTimer.current = setTimeout(() => setCopied(false), 2000);
|
|
63
|
-
}
|
|
64
|
-
catch {
|
|
65
|
-
if (!mounted.current)
|
|
66
|
-
return;
|
|
67
|
-
errorToast(tI18nComplete.raw('text167c96824acb'));
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
return (_jsxs("section", { className: "space-y-2", "data-testid": "session-embed", children: [_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { children: t('sectionTitle') }), _jsx("p", { className: "text-muted-foreground text-xs", children: t('sectionDescription') })] }), _jsxs(Button, { variant: "outline", size: "sm", disabled: !snippet, onClick: copy, children: [copied ? (_jsx(CheckIcon, { className: "text-kortix-green size-4 shrink-0" })) : (_jsx(CodeIcon, { className: "size-4 shrink-0" })), t('copy')] })] }));
|
|
71
|
-
}
|