@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
|
@@ -14,7 +14,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
14
14
|
* lists "Your keys for this workspace" and "Service account tokens".
|
|
15
15
|
*/
|
|
16
16
|
import { useRef, useState } from 'react';
|
|
17
|
-
import { createWorkspaceKey, getPatPolicy, listPermissions, listWorkspaceKeys, revokeWorkspaceKey, } from '@kortix/sdk';
|
|
17
|
+
import { createAccountToken, createWorkspaceKey, getPatPolicy, listPermissions, listWorkspaceKeys, revokeWorkspaceKey, } from '@kortix/sdk';
|
|
18
18
|
import { KeyIcon, PlusIcon, ProhibitIcon, RobotIcon, TerminalWindowIcon, TrashIcon, UserIcon } from '@phosphor-icons/react';
|
|
19
19
|
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
20
20
|
import { defaultKeyExpiryOption, keyExpiresAt, keyExpiryOptions } from '../../../access/iam/api-key-expiry.js';
|
|
@@ -154,6 +154,7 @@ function CreateWorkspaceKeyDialog({ workspaceId, accountId, list, open, onOpenCh
|
|
|
154
154
|
const actsAsLabel = useActsAsLabel();
|
|
155
155
|
const [name, setName] = useState('');
|
|
156
156
|
const [draft, setDraft] = useState({ actsAs: 'me', agent: '', bot: '', newBotName: '' });
|
|
157
|
+
const [worksIn, setWorksIn] = useState('all');
|
|
157
158
|
const [access, setAccess] = useState('full');
|
|
158
159
|
const [picked, setPicked] = useState(() => new Set());
|
|
159
160
|
const [expiry, setExpiry] = useState('');
|
|
@@ -186,15 +187,43 @@ function CreateWorkspaceKeyDialog({ workspaceId, accountId, list, open, onOpenCh
|
|
|
186
187
|
}));
|
|
187
188
|
const selectedExpiry = expiryChoices.some((o) => o.value === expiry) ? expiry : defaultKeyExpiryOption(policy, tI18nComplete);
|
|
188
189
|
const principal = actsAsInput(draft);
|
|
189
|
-
|
|
190
|
+
// "All my workspaces" with "You" mints a personal key: the Access select is
|
|
191
|
+
// hidden there and its state is dead, so a leftover Custom (zero picks) must
|
|
192
|
+
// not hold the gate. Only the workspace path reads access/picked.
|
|
193
|
+
const personal = draft.actsAs === 'me' && worksIn === 'all';
|
|
194
|
+
const ready = !!name.trim() && !!principal && !(!personal && access === 'custom' && picked.size === 0);
|
|
190
195
|
const pickedBot = draft.actsAs === 'bot' && draft.bot && draft.bot !== NEW_BOT ? list?.bots.find((b) => b.bot_id === draft.bot) : undefined;
|
|
191
196
|
const mutation = useMutation({
|
|
192
|
-
mutationFn: () =>
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
197
|
+
mutationFn: async () => {
|
|
198
|
+
// "All my workspaces" mints a PERSONAL key (`project_id IS NULL`): it
|
|
199
|
+
// acts as the person in every workspace of theirs, exactly what a CLI
|
|
200
|
+
// login pastes into `kortix login --token`. The API refuses scopes on a
|
|
201
|
+
// personal key (a scope is a workspace concept), so it always carries
|
|
202
|
+
// the person's full role — the Access select below is the workspace
|
|
203
|
+
// path's alone. A personal key lists under Preferences → Personal keys,
|
|
204
|
+
// not in this workspace's list.
|
|
205
|
+
if (personal) {
|
|
206
|
+
const token = await createAccountToken({
|
|
207
|
+
name: name.trim(),
|
|
208
|
+
accountId,
|
|
209
|
+
expiresAt: keyExpiresAt(selectedExpiry),
|
|
210
|
+
});
|
|
211
|
+
return { name: token.name, secret: token.secret_key, personal: true, actsAsLabel: actsAsLabel({ type: 'me', name: null, service_account_id: null }) };
|
|
212
|
+
}
|
|
213
|
+
const key = await createWorkspaceKey(workspaceId, {
|
|
214
|
+
name: name.trim(),
|
|
215
|
+
actsAs: principal,
|
|
216
|
+
scopes: access === 'custom' ? [...picked] : access,
|
|
217
|
+
expiresAt: keyExpiresAt(selectedExpiry),
|
|
218
|
+
});
|
|
219
|
+
// The server's row resolves the principal's name; the draft resolves it here.
|
|
220
|
+
const actsAsLabelOf = draft.actsAs === 'me'
|
|
221
|
+
? actsAsLabel({ type: 'me', name: null, service_account_id: null })
|
|
222
|
+
: draft.actsAs === 'agent'
|
|
223
|
+
? actsAsLabel({ type: 'agent', name: draft.agent, service_account_id: null })
|
|
224
|
+
: actsAsLabel({ type: 'bot', name: pickedBot?.name ?? draft.newBotName, service_account_id: null });
|
|
225
|
+
return { name: key.name, secret: key.secret_key, personal: false, actsAsLabel: actsAsLabelOf };
|
|
226
|
+
},
|
|
198
227
|
onSuccess: (key) => {
|
|
199
228
|
onCreated();
|
|
200
229
|
setCreated(key);
|
|
@@ -209,6 +238,7 @@ function CreateWorkspaceKeyDialog({ workspaceId, accountId, list, open, onOpenCh
|
|
|
209
238
|
setTimeout(() => {
|
|
210
239
|
setName('');
|
|
211
240
|
setDraft({ actsAs: 'me', agent: '', bot: '', newBotName: '' });
|
|
241
|
+
setWorksIn('all');
|
|
212
242
|
setAccess('full');
|
|
213
243
|
setPicked(new Set());
|
|
214
244
|
setExpiry('');
|
|
@@ -223,18 +253,30 @@ function CreateWorkspaceKeyDialog({ workspaceId, accountId, list, open, onOpenCh
|
|
|
223
253
|
close();
|
|
224
254
|
else
|
|
225
255
|
onOpenChange(true);
|
|
226
|
-
}, children: _jsx(ModalContent, { className: "lg:max-w-lg", closeLabel: common('close'), children: created ? (_jsxs(_Fragment, { children: [_jsxs(ModalHeader, { children: [_jsx(ModalTitle, { children: tTokens('copyNow') }), _jsx(ModalDescription, { children:
|
|
256
|
+
}, children: _jsx(ModalContent, { className: "lg:max-w-lg", closeLabel: common('close'), children: created ? (_jsxs(_Fragment, { children: [_jsxs(ModalHeader, { children: [_jsx(ModalTitle, { children: tTokens('copyNow') }), _jsx(ModalDescription, { children: created.personal
|
|
257
|
+
? t('createdPersonalDescription', { name: created.name })
|
|
258
|
+
: t('createdDescription', { name: created.name, actsAs: created.actsAsLabel }) })] }), _jsx(ModalBody, { children: _jsx(CopyRow, { value: created.secret, successMessage: tTokens('keyCopied') }) }), _jsx(ModalFooter, { children: _jsx(Button, { type: "button", size: "sm", onClick: close, children: tTokens('done') }) })] })) : (_jsxs(_Fragment, { children: [_jsxs(ModalHeader, { children: [_jsx(ModalTitle, { children: t('newKey') }), _jsx(ModalDescription, { children: t('description') })] }), _jsxs("form", { onSubmit: (event) => {
|
|
227
259
|
event.preventDefault();
|
|
228
260
|
if (!ready || mutation.isPending || submitInFlight.current)
|
|
229
261
|
return;
|
|
230
262
|
submitInFlight.current = true;
|
|
231
263
|
mutation.mutate();
|
|
232
|
-
}, children: [_jsxs(ModalBody, { className: "space-y-4", children: [_jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { htmlFor: "workspace-key-name", children: tTokens('name') }), _jsx(Input, { id: "workspace-key-name", value: name, onChange: (event) => setName(event.target.value), placeholder: tTokens('namePlaceholder'), disabled: mutation.isPending, maxLength: 128, autoFocus: true, variant: "popover" })] }), _jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { htmlFor: "workspace-key-acts-as", children: t('actsAs') }), _jsxs(Select, { value: draft.actsAs, onValueChange: (value) => setDraft((d) => ({ ...d, actsAs: value })), disabled: mutation.isPending, children: [_jsx(SelectTrigger, { id: "workspace-key-acts-as", size: "md", className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: options.map((option) => (_jsx(SelectItem, { value: option.value, disabled: option.block !== null, description: blockLabel(option.block) ?? undefined, children: option.value === 'me' ? t('actsAsMe') : option.value === 'agent' ? t('actsAsAgent') : t('actsAsBot') }, option.value))) })] }), _jsx("p", { className: "text-muted-foreground text-xs", children: hint })] }), draft.actsAs === 'agent' ? (_jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { htmlFor: "workspace-key-agent", children: t('agent') }), _jsxs(Select, { value: draft.agent, onValueChange: (agent) => setDraft((d) => ({ ...d, agent })), disabled: mutation.isPending, children: [_jsx(SelectTrigger, { id: "workspace-key-agent", size: "md", className: "w-full", children: _jsx(SelectValue, { placeholder: t('agentPlaceholder') }) }), _jsx(SelectContent, { children: (list?.agents ?? []).map((agent) => (_jsx(SelectItem, { value: agent.name, children: agent.name }, agent.name))) })] })] })) : null, draft.actsAs === 'bot' ? (_jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { htmlFor: "workspace-key-bot", children: t('bot') }), _jsxs(Select, { value: draft.bot, onValueChange: (bot) => setDraft((d) => ({ ...d, bot })), disabled: mutation.isPending, children: [_jsx(SelectTrigger, { id: "workspace-key-bot", size: "md", className: "w-full", children: _jsx(SelectValue, { placeholder: t('botPlaceholder') }) }), _jsxs(SelectContent, { children: [(list?.bots ?? []).map((bot) => (_jsx(SelectItem, { value: bot.bot_id, children: bot.name }, bot.bot_id))), (list?.bots.length ?? 0) > 0 ? _jsx(SelectSeparator, {}) : null, _jsx(SelectItem, { value: NEW_BOT, children: t('newBot') })] })] }), draft.bot === NEW_BOT ? (_jsxs(_Fragment, { children: [_jsx(Input, { "aria-label": t('newBotName'), value: draft.newBotName, onChange: (event) => setDraft((d) => ({ ...d, newBotName: event.target.value })), placeholder: t('newBotNamePlaceholder'), maxLength: 128, disabled: mutation.isPending, variant: "popover" }), _jsx("p", { className: "text-muted-foreground text-xs", children: t('newBotHint') })] })) : pickedBot && !pickedBot.has_role ? (_jsx("p", { className: "text-muted-foreground text-xs", children: t('botNoRole') })) : null] })) : null, _jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { htmlFor: "workspace-key-
|
|
264
|
+
}, children: [_jsxs(ModalBody, { className: "space-y-4", children: [_jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { htmlFor: "workspace-key-name", children: tTokens('name') }), _jsx(Input, { id: "workspace-key-name", value: name, onChange: (event) => setName(event.target.value), placeholder: tTokens('namePlaceholder'), disabled: mutation.isPending, maxLength: 128, autoFocus: true, variant: "popover" })] }), _jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { htmlFor: "workspace-key-acts-as", children: t('actsAs') }), _jsxs(Select, { value: draft.actsAs, onValueChange: (value) => setDraft((d) => ({ ...d, actsAs: value })), disabled: mutation.isPending, children: [_jsx(SelectTrigger, { id: "workspace-key-acts-as", size: "md", className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: options.map((option) => (_jsx(SelectItem, { value: option.value, disabled: option.block !== null, description: blockLabel(option.block) ?? undefined, children: option.value === 'me' ? t('actsAsMe') : option.value === 'agent' ? t('actsAsAgent') : t('actsAsBot') }, option.value))) })] }), _jsx("p", { className: "text-muted-foreground text-xs", children: hint })] }), draft.actsAs === 'agent' ? (_jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { htmlFor: "workspace-key-agent", children: t('agent') }), _jsxs(Select, { value: draft.agent, onValueChange: (agent) => setDraft((d) => ({ ...d, agent })), disabled: mutation.isPending, children: [_jsx(SelectTrigger, { id: "workspace-key-agent", size: "md", className: "w-full", children: _jsx(SelectValue, { placeholder: t('agentPlaceholder') }) }), _jsx(SelectContent, { children: (list?.agents ?? []).map((agent) => (_jsx(SelectItem, { value: agent.name, children: agent.name }, agent.name))) })] })] })) : null, draft.actsAs === 'bot' ? (_jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { htmlFor: "workspace-key-bot", children: t('bot') }), _jsxs(Select, { value: draft.bot, onValueChange: (bot) => setDraft((d) => ({ ...d, bot })), disabled: mutation.isPending, children: [_jsx(SelectTrigger, { id: "workspace-key-bot", size: "md", className: "w-full", children: _jsx(SelectValue, { placeholder: t('botPlaceholder') }) }), _jsxs(SelectContent, { children: [(list?.bots ?? []).map((bot) => (_jsx(SelectItem, { value: bot.bot_id, children: bot.name }, bot.bot_id))), (list?.bots.length ?? 0) > 0 ? _jsx(SelectSeparator, {}) : null, _jsx(SelectItem, { value: NEW_BOT, children: t('newBot') })] })] }), draft.bot === NEW_BOT ? (_jsxs(_Fragment, { children: [_jsx(Input, { "aria-label": t('newBotName'), value: draft.newBotName, onChange: (event) => setDraft((d) => ({ ...d, newBotName: event.target.value })), placeholder: t('newBotNamePlaceholder'), maxLength: 128, disabled: mutation.isPending, variant: "popover" }), _jsx("p", { className: "text-muted-foreground text-xs", children: t('newBotHint') })] })) : pickedBot && !pickedBot.has_role ? (_jsx("p", { className: "text-muted-foreground text-xs", children: t('botNoRole') })) : null] })) : null, draft.actsAs === 'me' ? (_jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { htmlFor: "workspace-key-works-in", children: t('worksIn') }), _jsxs(Select, { value: worksIn, onValueChange: (value) => {
|
|
265
|
+
const next = value;
|
|
266
|
+
setWorksIn(next);
|
|
267
|
+
// The Access narrowing is the workspace path's alone;
|
|
268
|
+
// moving to the personal path must not strand a hidden
|
|
269
|
+
// "custom (0 picked)" behind a disabled Create.
|
|
270
|
+
if (next === 'all') {
|
|
271
|
+
setAccess('full');
|
|
272
|
+
setPicked(new Set());
|
|
273
|
+
}
|
|
274
|
+
}, disabled: mutation.isPending, children: [_jsx(SelectTrigger, { id: "workspace-key-works-in", size: "md", className: "w-full", children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "all", children: t('worksInAll') }), _jsx(SelectItem, { value: "workspace", children: t('worksInWorkspace') })] })] }), personal ? (_jsx("p", { className: "text-muted-foreground text-xs", children: t('worksInAllHint') })) : null] })) : null, personal ? null : (_jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { htmlFor: "workspace-key-access", children: tWorkspaces('keyAccess') }), _jsxs(Select, { value: access, onValueChange: (value) => setAccess(value), disabled: mutation.isPending, children: [_jsx(SelectTrigger, { id: "workspace-key-access", size: "md", className: "w-full", children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "full", children: tWorkspaces('keyAccessFull') }), _jsx(SelectItem, { value: "read", children: tWorkspaces('keyAccessRead') }), _jsx(SelectItem, { value: "custom", children: tWorkspaces('keyAccessCustom') })] })] }), _jsx("p", { className: "text-muted-foreground text-xs", children: access === 'read' ? tWorkspaces('keyAccessReadHint') : access === 'custom' ? t('accessCustomHint') : t('accessFullHint') }), access === 'custom' ? (_jsx(PermissionPicker, { query: permissionsQuery, picked: picked, onToggle: (action, on) => setPicked((prev) => {
|
|
233
275
|
const next = new Set(prev);
|
|
234
276
|
if (on)
|
|
235
277
|
next.add(action);
|
|
236
278
|
else
|
|
237
279
|
next.delete(action);
|
|
238
280
|
return next;
|
|
239
|
-
}), disabled: mutation.isPending })) : null] }), _jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { htmlFor: "workspace-key-expiry", children: tTokens('expires') }), _jsxs(Select, { value: selectedExpiry, onValueChange: setExpiry, disabled: mutation.isPending, children: [_jsx(SelectTrigger, { id: "workspace-key-expiry", size: "md", className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: expiryChoices.map((choice) => (_jsx(SelectItem, { value: choice.value, children: choice.label }, choice.value))) })] }), policy?.require_expiry ? _jsx("p", { className: "text-muted-foreground text-xs", children: tTokens('expiryRequired') }) : null] })] }), _jsxs(ModalFooter, { className: "sm:justify-between", children: [_jsx(Button, { type: "button", variant: "outline-ghost", size: "sm", onClick: close, disabled: mutation.isPending, children: tTokens('cancel') }), _jsxs(Button, { type: "submit", size: "sm", disabled: !ready || mutation.isPending, className: "gap-1.5", children: [mutation.isPending ? _jsx(Loading, { className: "size-3.5 shrink-0" }) : null, tTokens('createKey')] })] })] })] })) }) }));
|
|
281
|
+
}), disabled: mutation.isPending })) : null] })), _jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { htmlFor: "workspace-key-expiry", children: tTokens('expires') }), _jsxs(Select, { value: selectedExpiry, onValueChange: setExpiry, disabled: mutation.isPending, children: [_jsx(SelectTrigger, { id: "workspace-key-expiry", size: "md", className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: expiryChoices.map((choice) => (_jsx(SelectItem, { value: choice.value, children: choice.label }, choice.value))) })] }), policy?.require_expiry ? _jsx("p", { className: "text-muted-foreground text-xs", children: tTokens('expiryRequired') }) : null] })] }), _jsxs(ModalFooter, { className: "sm:justify-between", children: [_jsx(Button, { type: "button", variant: "outline-ghost", size: "sm", onClick: close, disabled: mutation.isPending, children: tTokens('cancel') }), _jsxs(Button, { type: "submit", size: "sm", disabled: !ready || mutation.isPending, className: "gap-1.5", children: [mutation.isPending ? _jsx(Loading, { className: "size-3.5 shrink-0" }) : null, tTokens('createKey')] })] })] })] })) }) }));
|
|
240
282
|
}
|
|
@@ -49,7 +49,7 @@ export function FeatureGateScreen({ featureKey, featureName, description, intern
|
|
|
49
49
|
return (_jsxs("div", { className: "bg-popover rounded-md border px-4 py-5", children: [channels ? (_jsx(ChannelsSwitchDialog, { open: confirming, onOpenChange: setConfirming, turningOn: true, projectName: project.data?.name ?? '', onConfirm: () => {
|
|
50
50
|
setConfirming(false);
|
|
51
51
|
enable.mutate();
|
|
52
|
-
} })) : null, _jsxs("div", { className: "flex flex-col gap-5 sm:flex-row sm:items-center sm:justify-between", children: [_jsxs("div", { className: "flex min-w-0 items-start gap-3", children: [_jsx("span", { className: "bg-muted/50 flex size-9 shrink-0 items-center justify-center rounded-sm", children: _jsx(FlagIcon, { className: "text-muted-foreground size-5" }) }), _jsxs("div", { className: "min-w-0 space-y-1", children: [_jsxs("p", { className: "text-foreground text-sm font-medium", children: [featureName, " ", tI18nComplete.raw('text26965989cce5')] }), _jsx("p", { className: "text-muted-foreground max-w-xl text-xs text-pretty", children: description }), internalOnly ? (_jsx("p", { className: "text-muted-foreground max-w-xl text-xs text-pretty", children: tI18nComplete.raw('text1c41abcc2fff') })) : null] })] }), error ? (_jsx("p", { role: "alert", className: "text-destructive text-xs", children: error })) : null, projectId && !internalOnly ? (_jsxs("div", { className: "flex shrink-0 items-center gap-2", children: [_jsx(Button, { size: "sm", disabled:
|
|
52
|
+
} })) : null, _jsxs("div", { className: "flex flex-col gap-5 sm:flex-row sm:items-center sm:justify-between", children: [_jsxs("div", { className: "flex min-w-0 items-start gap-3", children: [_jsx("span", { className: "bg-muted/50 flex size-9 shrink-0 items-center justify-center rounded-sm", children: _jsx(FlagIcon, { className: "text-muted-foreground size-5" }) }), _jsxs("div", { className: "min-w-0 space-y-1", children: [_jsxs("p", { className: "text-foreground text-sm font-medium", children: [featureName, " ", tI18nComplete.raw('text26965989cce5')] }), _jsx("p", { className: "text-muted-foreground max-w-xl text-xs text-pretty", children: description }), internalOnly ? (_jsx("p", { className: "text-muted-foreground max-w-xl text-xs text-pretty", children: tI18nComplete.raw('text1c41abcc2fff') })) : null] })] }), error ? (_jsx("p", { role: "alert", className: "text-destructive text-xs", children: error })) : null, projectId && !internalOnly && !permission.isLoading && permission.allowed === true ? (_jsxs("div", { className: "flex shrink-0 items-center gap-2", children: [_jsx(Button, { size: "sm", disabled: enable.isPending, onClick: () => {
|
|
53
53
|
setError('');
|
|
54
54
|
// Channels changes the sidebar for everyone: it asks first.
|
|
55
55
|
if (channels)
|
|
@@ -11,7 +11,7 @@ import { Button } from '../../../primitives/button.js';
|
|
|
11
11
|
import { Input } from '../../../primitives/input.js';
|
|
12
12
|
import Loading from '../../../primitives/loading.js';
|
|
13
13
|
import { RadioGroup, RadioGroupItem } from '../../../primitives/radio-group.js';
|
|
14
|
-
import { connectorConnectionQueryKeys } from '
|
|
14
|
+
import { connectorConnectionQueryKeys } from '../../../internal/hooks/connectors/invalidate-connections.js';
|
|
15
15
|
import { usePipedreamConnectProject } from '../../../internal/hooks/connectors/use-pipedream-connect-project.js';
|
|
16
16
|
import { useTranslations as useI18nTranslations } from '../../../i18n/index.js';
|
|
17
17
|
import { cn } from '../../../internal/lib/utils.js';
|
|
@@ -259,7 +259,7 @@ export function ScheduleBuilder({ value, onChange, disabled, allowOnce, runAt, o
|
|
|
259
259
|
const cadences = localizeUiCatalog(CADENCES, tI18nComplete, APP_REGISTRY_TRANSLATION_KEYS);
|
|
260
260
|
const weekdayButtons = localizeUiCatalog(WEEKDAY_BUTTONS, tI18nComplete, APP_REGISTRY_TRANSLATION_KEYS);
|
|
261
261
|
const selectedWeekdays = new Set(state.weekdays);
|
|
262
|
-
const intervalUnit = (value) => state.frequency === 'minutes' ? '
|
|
262
|
+
const intervalUnit = (value) => `${state.frequency === 'minutes' ? 'minute' : 'hour'}${value === 1 ? '' : 's'}`;
|
|
263
263
|
return (_jsxs("div", { className: cn('space-y-3', disabled && 'pointer-events-none opacity-60 select-none'), children: [_jsxs("div", { className: "flex flex-wrap items-end gap-3", children: [_jsx(ScheduleField, { label: tI18nComplete.raw('textb6b7a0065808'), className: "w-full sm:w-44", children: _jsxs(Select, { value: onceMode ? 'once' : cadence, onValueChange: (next) => next === 'once' ? selectOnce() : selectCadence(next), disabled: disabled, children: [_jsx(SelectTrigger, { className: "h-9 w-full", children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [cadences.map((option) => (_jsx(SelectItem, { value: option.value, children: option.label }, option.value))), canOnce ? (_jsx(SelectItem, { value: "once", children: tI18nComplete.raw('textd88f6d8372f4') })) : null] })] }) }), onceMode ? (_jsx(ScheduleField, { label: tI18nComplete.raw('text4b4c31294fb5'), className: "w-full sm:w-auto", children: _jsx(Input, { type: "datetime-local", value: runAt ? isoToLocalInput(runAt) : '', min: isoToLocalInput(new Date().toISOString()), onChange: (event) => onRunAtChange?.(localInputToIso(event.target.value)), onBlur: () => {
|
|
264
264
|
if (hasPastRunAt)
|
|
265
265
|
warningToast(tI18nComplete.raw('textabf586cc6ecb'));
|
|
@@ -115,6 +115,10 @@ export function describeCadence(expression) {
|
|
|
115
115
|
return CUSTOM_TIMING_LABEL;
|
|
116
116
|
return n === 1 ? 'Every minute' : `Every ${n} minutes`;
|
|
117
117
|
}
|
|
118
|
+
// Every minute: `*` in the minute field, as `kortix.yaml` often writes it.
|
|
119
|
+
if (minute === '*' && hour === '*' && day === '*' && month === '*' && weekday === '*') {
|
|
120
|
+
return 'Every minute';
|
|
121
|
+
}
|
|
118
122
|
// Every N hours, on a given minute.
|
|
119
123
|
if (hour.startsWith('*/') && day === '*' && weekday === '*') {
|
|
120
124
|
const n = Number(hour.slice(2));
|
|
@@ -156,7 +156,11 @@ function SheetPanel({ projectId, trigger, controls, eventsEnabled, onRun, runnin
|
|
|
156
156
|
? t.raw('textd8d0bd5c5106')
|
|
157
157
|
: event
|
|
158
158
|
? t.raw('textf2f698118cc1')
|
|
159
|
-
: t.raw('text60f85e57e4a7')] })) : null] })] })) : null, controls.canFire ? (_jsxs(Button, { size: "xs", variant: "secondary", className: "gap-1.5 text-xs", onClick: onRun, disabled: running, children: [running ? (_jsx(SessionDotMatrix, { sessionId: trigger.slug, size: 14, className: "shrink-0" })) : (_jsx(PlayIcon, { weight: "fill", className: "size-2.5 shrink-0" })), t.raw('text0991397702fa')] })) : null] })) : null] })] }), _jsxs(SheetBody, { className: "flex-none items-stretch gap-0 space-y-6 !overflow-visible px-4 pt-5 pb-0", children: [trigger.auto_paused_at ? (_jsxs(Alert, { variant: "warning", children: [_jsx(AlertTitle, { children: tAutoPause('
|
|
159
|
+
: t.raw('text60f85e57e4a7')] })) : null] })] })) : null, controls.canFire ? (_jsxs(Button, { size: "xs", variant: "secondary", className: "gap-1.5 text-xs", onClick: onRun, disabled: running, children: [running ? (_jsx(SessionDotMatrix, { sessionId: trigger.slug, size: 14, className: "shrink-0" })) : (_jsx(PlayIcon, { weight: "fill", className: "size-2.5 shrink-0" })), t.raw('text0991397702fa')] })) : null] })) : null] })] }), _jsxs(SheetBody, { className: "flex-none items-stretch gap-0 space-y-6 !overflow-visible px-4 pt-5 pb-0", children: [trigger.auto_paused_at ? (_jsxs(Alert, { variant: "warning", children: [_jsx(AlertTitle, { children: tAutoPause(trigger.auto_paused_code === 'billing' ? 'billingTitle' : trigger.auto_paused_code === 'no_usable_model' ? 'modelTitle' : 'title') }), _jsxs(AlertDescription, { children: [_jsx("p", { children: tAutoPause(trigger.auto_paused_code === 'billing'
|
|
160
|
+
? 'billingDescription'
|
|
161
|
+
: trigger.auto_paused_code === 'no_usable_model'
|
|
162
|
+
? 'modelDescription'
|
|
163
|
+
: 'description') }), !trigger.auto_paused_code && trigger.auto_paused_reason ? (_jsx("p", { children: readableAutoPauseReason(trigger.auto_paused_reason) })) : null] })] })) : null, _jsx(TabsContent, { value: "settings", forceMount: true, className: "data-[state=inactive]:hidden", children: loading ? (_jsxs("div", { className: "space-y-2", children: [_jsx(Skeleton, { className: "h-16 rounded-md" }), _jsx(Skeleton, { className: "h-28 rounded-md" })] })) : (_jsx(SheetForm, { projectId: projectId, trigger: trigger, canWrite: canWrite, eventsEnabled: eventsEnabled, appIndex: appIndex, eventNames: eventNames, agents: agents, savedEventType: savedEventType, savedModel: savedModel, apps: apps, onMutated: onMutated, surface: surface })) }), _jsxs(TabsContent, { value: "runs", className: "space-y-3 pb-8", children: [_jsx(EventCheckTimes, { trigger: trigger }), _jsx(TriggerRunsPanel, { projectId: projectId, trigger: trigger, canFire: controls.canFire, onRun: onRun, running: running })] })] }), controls.canFire ? (_jsx(TriggerTestDialog, { projectId: projectId, trigger: trigger, open: testOpen, onOpenChange: setTestOpen })) : null] }));
|
|
160
164
|
}
|
|
161
165
|
/* ─── The form ──────────────────────────────────────────────────────────── */
|
|
162
166
|
function SheetForm({ projectId, trigger, canWrite, eventsEnabled, appIndex, eventNames, agents, savedEventType, savedModel, apps, onMutated, surface, }) {
|
|
@@ -263,7 +267,7 @@ function SheetForm({ projectId, trigger, canWrite, eventsEnabled, appIndex, even
|
|
|
263
267
|
setServerConfig(null);
|
|
264
268
|
};
|
|
265
269
|
const editEvent = () => whenRef.current?.scrollIntoView({ block: 'start', behavior: 'smooth' });
|
|
266
|
-
return (_jsxs("div", { ref: bodyRef, className: "space-y-6", children: [_jsx(TriggerCallouts, { projectId: projectId, trigger: trigger, canEditEvent: canWrite && (app !== null || (!draft.appSlug && !draft.profile)), eventsEnabled: eventsEnabled, apps: appIndex, onEditEvent: editEvent }), _jsx(EventCheckTimes, { trigger: trigger }), canWrite ? (_jsxs(_Fragment, { children: [_jsxs("section", { ref: whenRef, "data-sheet-block": true, "data-block": "when", className: "space-y-3", children: [_jsx(Label, { children: t.raw('textcf9c7aa24a26') }), draft.kind === 'cron' ? (_jsx(WhenSchedule, { draft: draft, patch: patch, error: blockError('when') })) : draft.kind === 'webhook' ? (_jsx(WhenWebhookAddress, { trigger: trigger, draft: draft, patch: patch, canWrite: true })) : draft.kind === 'app' ? (_jsx(WhenApp, { apps: kortixApps, draft: draft, patch: patch, error: blockError('when') })) : draft.kind === 'change_request' ? (_jsx(WhenChangeRequest, { draft: draft, patch: patch })) : app || (!draft.appSlug && !draft.profile) ? (_jsx(WhenEvent, { projectId: projectId, apps: apps, draft: draft, patch: patch, setDraft: setDraft, configFields: configFields, configErrors: configErrors, canConnect: canConnect, error: blockError('when') })) : (_jsx(WhenEventSummary, { trigger: trigger, apps: appIndex, eventNames: eventNames, loading: apps.isLoading }))] }), _jsxs("section", { "data-sheet-block": true, "data-block": "then", className: "space-y-3", children: [_jsx(Label, { children: t.raw('text0597f441dcca') }), _jsx(ThenFields, { agents: agents, draft: draft, patch: patch, payloadSchema: draft.eventType?.payload_schema, error: blockError('then') })] }), _jsxs("section", { "data-sheet-block": true, "data-block": "name", className: "space-y-3", children: [_jsx(Label, { htmlFor: "trigger-name", children: t.raw('textdcd1d5223f73') }), _jsx(Input, { id: "trigger-name", value: name, onChange: (e) => patch({ nameOverride: e.target.value }), placeholder: t.raw('textc8cf587a3b6c'), maxLength: 64, "aria-invalid": blockError('name') ? true : undefined }), _jsx(InlineError, { message: blockError('name') }), _jsx(PostToField, { projectId: projectId, draft: draft, patch: patch, baseAccess: base.sessionAccess })] }), _jsx("section", { "data-sheet-block": true, "data-block": "options", children: _jsx(TriggerOptions, { edit: true, projectId: projectId, draft: draft, patch: patch, name: name, open: optionsOpen, onOpenChange: setOptionsOpen, error: blockError('options') }) })] })) : (_jsx(TriggerReadOnly, { trigger: trigger, apps: appIndex, eventNames: eventNames, agentLabel: agentDisplayLabel(agents, trigger.agent) })), _jsx("div", { className: "pb-8", children: _jsx(Details, { trigger: trigger }) }), dirty && canWrite ? (
|
|
270
|
+
return (_jsxs("div", { ref: bodyRef, className: "space-y-6", children: [_jsx(TriggerCallouts, { projectId: projectId, trigger: trigger, canEditEvent: canWrite && (app !== null || (!draft.appSlug && !draft.profile)), eventsEnabled: eventsEnabled, apps: appIndex, onEditEvent: editEvent }), _jsx(EventCheckTimes, { trigger: trigger }), canWrite ? (_jsxs(_Fragment, { children: [_jsxs("section", { ref: whenRef, "data-sheet-block": true, "data-block": "when", className: "space-y-3", children: [_jsx(Label, { children: t.raw('textcf9c7aa24a26') }), draft.kind === 'cron' ? (_jsx(WhenSchedule, { draft: draft, patch: patch, error: blockError('when') })) : draft.kind === 'webhook' ? (_jsx(WhenWebhookAddress, { trigger: trigger, draft: draft, patch: patch, canWrite: true })) : draft.kind === 'app' ? (_jsx(WhenApp, { apps: kortixApps, draft: draft, patch: patch, error: blockError('when') })) : draft.kind === 'change_request' ? (_jsx(WhenChangeRequest, { draft: draft, patch: patch })) : app || (!draft.appSlug && !draft.profile) ? (_jsx(WhenEvent, { projectId: projectId, apps: apps, draft: draft, patch: patch, setDraft: setDraft, configFields: configFields, configErrors: configErrors, canConnect: canConnect, error: blockError('when') })) : (_jsx(WhenEventSummary, { trigger: trigger, apps: appIndex, eventNames: eventNames, loading: apps.isLoading }))] }), _jsxs("section", { "data-sheet-block": true, "data-block": "then", className: "space-y-3", children: [_jsx(Label, { children: t.raw('text0597f441dcca') }), _jsx(ThenFields, { projectId: projectId, agents: agents, draft: draft, patch: patch, payloadSchema: draft.eventType?.payload_schema, error: blockError('then') })] }), _jsxs("section", { "data-sheet-block": true, "data-block": "name", className: "space-y-3", children: [_jsx(Label, { htmlFor: "trigger-name", children: t.raw('textdcd1d5223f73') }), _jsx(Input, { id: "trigger-name", value: name, onChange: (e) => patch({ nameOverride: e.target.value }), placeholder: t.raw('textc8cf587a3b6c'), maxLength: 64, "aria-invalid": blockError('name') ? true : undefined }), _jsx(InlineError, { message: blockError('name') }), _jsx(PostToField, { projectId: projectId, draft: draft, patch: patch, baseAccess: base.sessionAccess })] }), _jsx("section", { "data-sheet-block": true, "data-block": "options", children: _jsx(TriggerOptions, { edit: true, projectId: projectId, draft: draft, patch: patch, name: name, open: optionsOpen, onOpenChange: setOptionsOpen, error: blockError('options') }) })] })) : (_jsx(TriggerReadOnly, { trigger: trigger, apps: appIndex, eventNames: eventNames, agentLabel: agentDisplayLabel(agents, trigger.agent) })), _jsx("div", { className: "pb-8", children: _jsx(Details, { trigger: trigger }) }), dirty && canWrite ? (
|
|
267
271
|
/* In the sheet's own scroll container, after the body: it sticks to the
|
|
268
272
|
bottom edge while the form is long, and rests under the form when it is short. */
|
|
269
273
|
_jsx(SaveBar, { surface: surface, pending: save.isPending, onSave: submit, onDiscard: discard })) : null] }));
|
|
@@ -286,7 +290,14 @@ function Details({ trigger }) {
|
|
|
286
290
|
label: t.raw('text512a48218ba2'),
|
|
287
291
|
value: (_jsx("span", { className: "tabular-nums", children: trigger.last_fired_at
|
|
288
292
|
? lastRunFormatter.format(new Date(trigger.last_fired_at))
|
|
289
|
-
:
|
|
293
|
+
: trigger.last_status === 'failed' && trigger.last_attempt_at
|
|
294
|
+
? `${t.raw('text031a8f0f659d')} · ${lastRunFormatter.format(new Date(trigger.last_attempt_at))}`
|
|
295
|
+
: describeLastRun(null) })),
|
|
290
296
|
},
|
|
291
297
|
] }) }) })] }));
|
|
292
298
|
}
|
|
299
|
+
/** `auto-paused: ran at …` → `Ran at …`: the stored reason without its code prefix. */
|
|
300
|
+
function readableAutoPauseReason(reason) {
|
|
301
|
+
const text = reason.replace(/^auto-paused:\s*/i, '').trim();
|
|
302
|
+
return text ? text[0].toUpperCase() + text.slice(1) : reason;
|
|
303
|
+
}
|
|
@@ -2,7 +2,9 @@ import { type Agent } from '@kortix/sdk/react';
|
|
|
2
2
|
import { type PatchDraft } from './composer-parts.js';
|
|
3
3
|
import type { ComposerDraft } from './trigger-composer-logic.js';
|
|
4
4
|
/** Then: what the agent does, which agent, which model. */
|
|
5
|
-
export declare function ThenFields({ agents, draft, patch, payloadSchema, error, }: {
|
|
5
|
+
export declare function ThenFields({ projectId, agents, draft, patch, payloadSchema, error, }: {
|
|
6
|
+
/** The workspace whose servable models the Model picker lists. */
|
|
7
|
+
projectId: string;
|
|
6
8
|
agents: Agent[];
|
|
7
9
|
draft: ComposerDraft;
|
|
8
10
|
patch: PatchDraft;
|
|
@@ -5,15 +5,19 @@ import { Textarea } from '../../../primitives/textarea.js';
|
|
|
5
5
|
import { ModelSelector } from '../../../session/models/model-selector.js';
|
|
6
6
|
import { AgentSelector } from '../../../session/composer/session-chat-input.js';
|
|
7
7
|
import { useTranslations as useI18nTranslations } from '../../../i18n/index.js';
|
|
8
|
-
import { flattenModels, modelProviderMode,
|
|
8
|
+
import { flattenModels, modelProviderMode, projectLlmCatalogToProviderList, useWorkspaceModelPickerCatalog, } from '@kortix/sdk/react';
|
|
9
9
|
import { useMemo, useRef } from 'react';
|
|
10
10
|
import { InlineError } from './composer-parts.js';
|
|
11
11
|
import { PromptVariableHints } from './event-trigger-fields.js';
|
|
12
12
|
/** Then: what the agent does, which agent, which model. */
|
|
13
|
-
export function ThenFields({ agents, draft, patch, payloadSchema, error, }) {
|
|
13
|
+
export function ThenFields({ projectId, agents, draft, patch, payloadSchema, error, }) {
|
|
14
14
|
const tI18nComplete = useI18nTranslations('hardcodedUi.i18nComplete');
|
|
15
15
|
const promptRef = useRef(null);
|
|
16
|
-
|
|
16
|
+
// The workspace's servable catalog (`GET /workspaces/:id/model-picker`), read
|
|
17
|
+
// by id: a trigger runs outside any session, so the session runtime's
|
|
18
|
+
// provider list is not the source.
|
|
19
|
+
const catalog = useWorkspaceModelPickerCatalog(projectId);
|
|
20
|
+
const providers = useMemo(() => (catalog ? projectLlmCatalogToProviderList(catalog) : undefined), [catalog]);
|
|
17
21
|
const models = useMemo(() => flattenModels(providers, { providerMode: modelProviderMode(providers) }), [providers]);
|
|
18
22
|
function insertVariable(token) {
|
|
19
23
|
const el = promptRef.current?.textArea;
|
|
@@ -28,5 +32,5 @@ export function ThenFields({ agents, draft, patch, payloadSchema, error, }) {
|
|
|
28
32
|
el?.setSelectionRange(at + insert.length, at + insert.length);
|
|
29
33
|
});
|
|
30
34
|
}
|
|
31
|
-
return (_jsxs("div", { className: "space-y-3", children: [_jsxs("div", { className: "space-y-2", children: [_jsx(Textarea, { value: draft.instruction, ref: promptRef, onChange: (e) => patch({ instruction: e.target.value }), "aria-label": tI18nComplete.raw('text112f3ccb1b36'), "aria-invalid": error ? true : undefined, placeholder: tI18nComplete.raw('text2438ee64fbf9'), rows: 3, className: "leading-relaxed" }), _jsx(InlineError, { message: error }), draft.kind === 'event' && draft.eventType ? (_jsx(PromptVariableHints, { payloadSchema: payloadSchema, onInsert: insertVariable })) : (_jsx("p", { className: "text-muted-foreground text-xs leading-relaxed text-pretty", children: tI18nComplete.raw('text03956d4b33dc') }))] }), _jsxs("div", { className: "grid gap-3 sm:grid-cols-2", children: [_jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { className: "text-xs", children: tI18nComplete.raw('text11b39c93777e') }), _jsx(AgentSelector, { agents: agents, selectedAgent: draft.agent, appearance: "field", onSelect: (agent) => patch({ agent }) })] }), _jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { className: "text-xs", children: tI18nComplete.raw('text5e2c614c23f0') }), _jsx(ModelSelector, { models: models, providers: providers, selectedModel: draft.model, unsetLabel: tI18nComplete.raw('text57069bbd0d2e'), appearance: "field", onSelect: (model) => patch({ model }) })] })] })] }));
|
|
35
|
+
return (_jsxs("div", { className: "space-y-3", children: [_jsxs("div", { className: "space-y-2", children: [_jsx(Textarea, { value: draft.instruction, ref: promptRef, onChange: (e) => patch({ instruction: e.target.value }), "aria-label": tI18nComplete.raw('text112f3ccb1b36'), "aria-invalid": error ? true : undefined, placeholder: tI18nComplete.raw('text2438ee64fbf9'), rows: 3, className: "leading-relaxed" }), _jsx(InlineError, { message: error }), draft.kind === 'event' && draft.eventType ? (_jsx(PromptVariableHints, { payloadSchema: payloadSchema, onInsert: insertVariable })) : (_jsx("p", { className: "text-muted-foreground text-xs leading-relaxed text-pretty", children: tI18nComplete.raw('text03956d4b33dc') }))] }), _jsxs("div", { className: "grid gap-3 sm:grid-cols-2", children: [_jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { className: "text-xs", children: tI18nComplete.raw('text11b39c93777e') }), _jsx(AgentSelector, { agents: agents, selectedAgent: draft.agent, appearance: "field", onSelect: (agent) => patch({ agent }) })] }), _jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { className: "text-xs", children: tI18nComplete.raw('text5e2c614c23f0') }), _jsx(ModelSelector, { models: models, providers: providers, modelsLoading: !catalog, selectedModel: draft.model, unsetLabel: tI18nComplete.raw('text57069bbd0d2e'), appearance: "field", onSelect: (model) => patch({ model }) })] })] })] }));
|
|
32
36
|
}
|
|
@@ -317,5 +317,5 @@ function ComposerForm({ projectId, onOpenChange, onCreated, initialAgent = null,
|
|
|
317
317
|
const pickKind = (kind) => setDraft((d) => withKind(d, kind));
|
|
318
318
|
return (_jsxs(_Fragment, { children: [_jsxs(ModalHeader, { className: "pr-12 pb-3", children: [_jsx(ModalTitle, { children: tI18nComplete.raw('texta38f4ea67a30') }), _jsx(ModalDescription, { className: "text-pretty", "aria-live": "polite", children: summarize(draft, app, agentDisplayLabel(agents, draft.agent), tI18nComplete) })] }), _jsx(ModalBody, { className: "min-h-0 flex-1 overflow-y-auto px-5 py-4 lg:max-h-[min(calc(100dvh-13rem),44rem)] lg:flex-none", children: _jsxs("div", { ref: bodyRef, className: "space-y-8", children: [_jsxs("section", { "data-block": "when", className: "space-y-3", children: [_jsx(SectionTitle, { children: tI18nComplete.raw('textcf9c7aa24a26') }), _jsxs(Tabs, { value: draft.kind, onValueChange: pickKind, children: [_jsxs(Select, { value: draft.kind, onValueChange: pickKind, children: [_jsx(SelectTrigger, { className: "w-full cursor-pointer text-sm lg:hidden", "aria-label": tI18nComplete.raw('textcf9c7aa24a26'), children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: COMPOSER_KINDS.map((kind) => (_jsx(SelectItem, { value: kind, className: "cursor-pointer", children: _jsxs("span", { className: "flex items-center gap-1.5", children: [tabIcon(kind), kindLabel(kind)] }) }, kind))) })] }), _jsx(TabsList, { className: "hidden w-full lg:flex", children: COMPOSER_KINDS.map((kind) => (_jsxs(TabsTrigger, { value: kind, className: "flex-1 gap-1.5", children: [tabIcon(kind), kindLabel(kind)] }, kind))) }), _jsx(TabsContent, { value: "cron", className: "pt-3", children: _jsx(WhenSchedule, { draft: draft, patch: patch, error: blockError('when') }) }), _jsx(TabsContent, { value: "app", className: "pt-3", children: kortixApps.length > 0 || draft.kortixApp || projectApps.isLoading ? (_jsx(WhenApp, { apps: kortixApps, draft: draft, patch: patch, error: blockError('when') })) : (_jsx(Unavailable, { action: appsHref ? (_jsx(Button, { asChild: true, size: "sm", variant: "outline", children: _jsx(Link, { href: appsHref, children: tComposer('openApps') }) })) : null, children: tComposer.rich('noApps', {
|
|
319
319
|
code: (chunks) => (_jsx("code", { className: "bg-muted text-foreground rounded-sm px-1 py-0.5 font-mono text-xs", children: chunks })),
|
|
320
|
-
}) })) }), _jsx(TabsContent, { value: "event", className: "pt-3", children: eventsOn ? (_jsx(WhenEvent, { projectId: projectId, apps: apps, draft: draft, patch: patch, setDraft: setDraft, configFields: configFields, configErrors: configErrors, canConnect: canConnect, error: blockError('when') })) : (_jsx(Unavailable, { action: _jsx(Button, { asChild: true, size: "sm", variant: "outline", children: _jsx(Link, { href: projectSettingsSectionHref(projectId, 'feature-flags'), children: tI18nComplete.raw('text20a2e59ba129') }) }), children: tComposer('eventsOff') })) }), _jsx(TabsContent, { value: "webhook", className: "pt-3", children: _jsx(WhenWebhook, { draft: draft, patch: patch, error: blockError('when') }) }), _jsx(TabsContent, { value: "change_request", className: "pt-3", children: _jsx(WhenChangeRequest, { draft: draft, patch: patch }) })] })] }), _jsxs("section", { "data-block": "then", className: "space-y-3", children: [_jsx(SectionTitle, { children: tI18nComplete.raw('text0597f441dcca') }), _jsx(ThenFields, { agents: agents, draft: draft, patch: patch, payloadSchema: draft.eventType?.payload_schema, error: blockError('then') })] }), _jsxs("section", { className: "space-y-3", children: [_jsx(SectionTitle, { children: tComposer('details') }), _jsxs("div", { "data-block": "name", className: "space-y-1.5", children: [_jsx(Label, { htmlFor: "trigger-name", className: "text-xs", children: tI18nComplete.raw('textdcd1d5223f73') }), _jsx(Input, { id: "trigger-name", value: name, onChange: (e) => patch({ nameOverride: e.target.value }), placeholder: tI18nComplete.raw('textc8cf587a3b6c'), maxLength: 64, "aria-invalid": blockError('name') || nameError ? true : undefined }), _jsx(InlineError, { message: blockError('name') ?? nameError })] }), _jsx(PostToField, { projectId: projectId, draft: draft, patch: patch, baseAccess: initialDraft({}).sessionAccess }), _jsx("div", { "data-block": "options", children: _jsx(TriggerOptions, { projectId: projectId, draft: draft, patch: patch, name: name, open: optionsOpen, onOpenChange: setOptionsOpen, error: blockError('options') }) })] }), error ? (_jsx("div", { ref: errorRef, children: _jsx(BannerAlert, { variant: "destructive", className: "text-xs", children: _jsx(BannerAlertDescription, { children: error }) }) })) : null] }) }), _jsxs(ModalFooter, { className: "mt-0 shrink-0 flex-row gap-2 border-t px-5 py-3 sm:space-x-0", children: [_jsx(Button, { variant: "ghost", size: "sm", disabled: create.isPending, onClick: () => onOpenChange(false), children: tI18nComplete.raw('text19766ed6ccb2') }), _jsxs(Button, { size: "sm", className: "gap-1.5", onClick: submit, disabled: create.isPending || unavailable, children: [create.isPending ? _jsx(Loading, { className: "size-3.5 shrink-0" }) : null, tI18nComplete.raw('texte18bbdd15a81')] })] })] }));
|
|
320
|
+
}) })) }), _jsx(TabsContent, { value: "event", className: "pt-3", children: eventsOn ? (_jsx(WhenEvent, { projectId: projectId, apps: apps, draft: draft, patch: patch, setDraft: setDraft, configFields: configFields, configErrors: configErrors, canConnect: canConnect, error: blockError('when') })) : (_jsx(Unavailable, { action: _jsx(Button, { asChild: true, size: "sm", variant: "outline", children: _jsx(Link, { href: projectSettingsSectionHref(projectId, 'feature-flags'), children: tI18nComplete.raw('text20a2e59ba129') }) }), children: tComposer('eventsOff') })) }), _jsx(TabsContent, { value: "webhook", className: "pt-3", children: _jsx(WhenWebhook, { draft: draft, patch: patch, error: blockError('when') }) }), _jsx(TabsContent, { value: "change_request", className: "pt-3", children: _jsx(WhenChangeRequest, { draft: draft, patch: patch }) })] })] }), _jsxs("section", { "data-block": "then", className: "space-y-3", children: [_jsx(SectionTitle, { children: tI18nComplete.raw('text0597f441dcca') }), _jsx(ThenFields, { projectId: projectId, agents: agents, draft: draft, patch: patch, payloadSchema: draft.eventType?.payload_schema, error: blockError('then') })] }), _jsxs("section", { className: "space-y-3", children: [_jsx(SectionTitle, { children: tComposer('details') }), _jsxs("div", { "data-block": "name", className: "space-y-1.5", children: [_jsx(Label, { htmlFor: "trigger-name", className: "text-xs", children: tI18nComplete.raw('textdcd1d5223f73') }), _jsx(Input, { id: "trigger-name", value: name, onChange: (e) => patch({ nameOverride: e.target.value }), placeholder: tI18nComplete.raw('textc8cf587a3b6c'), maxLength: 64, "aria-invalid": blockError('name') || nameError ? true : undefined }), _jsx(InlineError, { message: blockError('name') ?? nameError })] }), _jsx(PostToField, { projectId: projectId, draft: draft, patch: patch, baseAccess: initialDraft({}).sessionAccess }), _jsx("div", { "data-block": "options", children: _jsx(TriggerOptions, { projectId: projectId, draft: draft, patch: patch, name: name, open: optionsOpen, onOpenChange: setOptionsOpen, error: blockError('options') }) })] }), error ? (_jsx("div", { ref: errorRef, children: _jsx(BannerAlert, { variant: "destructive", className: "text-xs", children: _jsx(BannerAlertDescription, { children: error }) }) })) : null] }) }), _jsxs(ModalFooter, { className: "mt-0 shrink-0 flex-row gap-2 border-t px-5 py-3 sm:space-x-0", children: [_jsx(Button, { variant: "ghost", size: "sm", disabled: create.isPending, onClick: () => onOpenChange(false), children: tI18nComplete.raw('text19766ed6ccb2') }), _jsxs(Button, { size: "sm", className: "gap-1.5", onClick: submit, disabled: create.isPending || unavailable, children: [create.isPending ? _jsx(Loading, { className: "size-3.5 shrink-0" }) : null, tI18nComplete.raw('texte18bbdd15a81')] })] })] }));
|
|
321
321
|
}
|
|
@@ -2,7 +2,9 @@ import type { UiTranslator } from '../../../i18n/index.js';
|
|
|
2
2
|
import type { ProjectTrigger } from '@kortix/sdk';
|
|
3
3
|
import { type ReactNode } from 'react';
|
|
4
4
|
/** "next in 5 minutes", "next in 3 hours", "next in 2 days"; "On event" for webhooks and app events; "Paused" while paused. */
|
|
5
|
-
export declare function nextRunLabel(trigger: Pick<ProjectTrigger, 'type' | 'enabled' | 'next_fire_at' | 'next_cron_at' | 'auto_paused_at'>, t: UiTranslator, locale: string, now: number
|
|
5
|
+
export declare function nextRunLabel(trigger: Pick<ProjectTrigger, 'type' | 'enabled' | 'next_fire_at' | 'next_cron_at' | 'auto_paused_at' | 'auto_paused_code'>, t: UiTranslator, locale: string, now: number,
|
|
6
|
+
/** The `triggerAutoPause` catalog: names a pause the account state caused. */
|
|
7
|
+
tAutoPause?: (key: 'listBilling' | 'listModel') => string): string;
|
|
6
8
|
export declare function TriggerList({ triggers, groups, eventNames, selectedSlug, runningSlug, onOpen, selection, projectPaused, }: {
|
|
7
9
|
triggers: ProjectTrigger[];
|
|
8
10
|
/** The trigger whose Run now is in flight: its row shows the session busy mark. */
|
|
@@ -16,7 +16,16 @@ import { Fragment } from 'react';
|
|
|
16
16
|
import { describeNextRun, describeWhen, triggerName, triggerSubtitle } from './schedule-copy.js';
|
|
17
17
|
import { TriggerTile } from './trigger-tile.js';
|
|
18
18
|
/** "next in 5 minutes", "next in 3 hours", "next in 2 days"; "On event" for webhooks and app events; "Paused" while paused. */
|
|
19
|
-
export function nextRunLabel(trigger, t, locale, now
|
|
19
|
+
export function nextRunLabel(trigger, t, locale, now,
|
|
20
|
+
/** The `triggerAutoPause` catalog: names a pause the account state caused. */
|
|
21
|
+
tAutoPause) {
|
|
22
|
+
// A pause that ends by itself names its cause: "No credits", "No model".
|
|
23
|
+
if (trigger.enabled && trigger.auto_paused_at && tAutoPause) {
|
|
24
|
+
if (trigger.auto_paused_code === 'billing')
|
|
25
|
+
return tAutoPause('listBilling');
|
|
26
|
+
if (trigger.auto_paused_code === 'no_usable_model')
|
|
27
|
+
return tAutoPause('listModel');
|
|
28
|
+
}
|
|
20
29
|
// An auto-pause (KRTX-1721) is runtime state: the manifest still says enabled.
|
|
21
30
|
if (!trigger.enabled || trigger.auto_paused_at)
|
|
22
31
|
return t.raw('texte159b06187d3');
|
|
@@ -41,17 +50,24 @@ export function TriggerList({ triggers, groups, eventNames, selectedSlug, runnin
|
|
|
41
50
|
}
|
|
42
51
|
function TriggerRow({ trigger, now, eventNames, selected, running, onOpen, checked, onToggle, projectPaused, }) {
|
|
43
52
|
const t = useTranslations('hardcodedUi.i18nComplete');
|
|
53
|
+
const tAutoPause = useTranslations('triggerAutoPause');
|
|
44
54
|
const locale = useLocale();
|
|
45
55
|
const name = triggerName(trigger);
|
|
46
56
|
const subtitle = triggerSubtitle(name, describeWhen(trigger, eventNames), trigger.prompt_template);
|
|
47
57
|
const selecting = checked !== null;
|
|
58
|
+
// Paused by the account state (no credits, no model): the cause shows in the row, the reason on hover.
|
|
59
|
+
const setupPaused = Boolean(trigger.enabled && trigger.auto_paused_at && trigger.auto_paused_code);
|
|
48
60
|
const rowClass = cn('flex h-14 w-full items-center gap-3 rounded-md px-3 text-left outline-none', 'transition-[background-color] duration-(--duration-fast)',
|
|
49
61
|
// One variable paints the row and the clock's dot disc, so the cutout
|
|
50
62
|
// always matches: rest = card, hover = muted at 60% over card, open = muted.
|
|
51
63
|
'bg-(--row-surface) [--row-surface:var(--card)]', selected || checked
|
|
52
64
|
? '[--row-surface:var(--muted)]'
|
|
53
65
|
: 'hover:[--row-surface:color-mix(in_oklab,var(--muted)_60%,var(--card))] focus-visible:[--row-surface:color-mix(in_oklab,var(--muted)_60%,var(--card))]');
|
|
54
|
-
const cells = (_jsxs(_Fragment, { children: [_jsx("span", { className: "flex size-5 shrink-0 items-center justify-center", children: selecting ? (_jsx(Checkbox, { checked: checked, tabIndex: -1, "aria-hidden": true, className: "pointer-events-none" })) : (_jsx(TriggerTile, { trigger: trigger, projectPaused: projectPaused, running: running, surface: "row" })) }), _jsxs("span", { className: "flex min-w-0 flex-1 flex-col", children: [_jsx("span", { title: name, className: "text-foreground truncate text-sm leading-tight font-medium", children: name }), subtitle ? (_jsx("span", { className: "text-muted-foreground truncate text-xs leading-tight", children: subtitle })) : null] }), _jsxs("span", { className: "flex min-w-24 shrink-0 flex-col items-end text-xs tabular-nums", children: [_jsx("span", { title: projectPaused ? undefined :
|
|
66
|
+
const cells = (_jsxs(_Fragment, { children: [_jsx("span", { className: "flex size-5 shrink-0 items-center justify-center", children: selecting ? (_jsx(Checkbox, { checked: checked, tabIndex: -1, "aria-hidden": true, className: "pointer-events-none" })) : (_jsx(TriggerTile, { trigger: trigger, projectPaused: projectPaused, running: running, surface: "row" })) }), _jsxs("span", { className: "flex min-w-0 flex-1 flex-col", children: [_jsx("span", { title: name, className: "text-foreground truncate text-sm leading-tight font-medium", children: name }), subtitle ? (_jsx("span", { className: "text-muted-foreground truncate text-xs leading-tight", children: subtitle })) : null] }), _jsxs("span", { className: "flex min-w-24 shrink-0 flex-col items-end text-xs tabular-nums", children: [_jsx("span", { title: projectPaused ? undefined : setupPaused ? (trigger.auto_paused_reason ?? undefined) : describeNextRun(trigger) ?? undefined, className: cn('whitespace-nowrap',
|
|
67
|
+
// A cause the person must act on reads like a live trigger, not muted like a plain pause.
|
|
68
|
+
(setupPaused || (trigger.enabled && !trigger.auto_paused_at)) && !projectPaused
|
|
69
|
+
? 'text-foreground'
|
|
70
|
+
: 'text-muted-foreground'), children: nextRunLabel(projectPaused ? { ...trigger, enabled: false } : trigger, t, locale, now, tAutoPause) }), running ? (_jsx("span", { className: "flex h-4 items-center", children: _jsx(SessionDotMatrix, { sessionId: trigger.slug, size: 14, className: "shrink-0" }) })) : (_jsx("span", { className: "text-muted-foreground whitespace-nowrap", children: lastRunLabel(trigger, t, locale, now) }))] })] }));
|
|
55
71
|
if (selecting) {
|
|
56
72
|
return (_jsx("li", { role: "option", "aria-selected": checked, tabIndex: 0, onClick: (e) => onToggle(e.shiftKey), onKeyDown: (e) => {
|
|
57
73
|
if (e.key === ' ' || e.key === 'Enter') {
|
|
@@ -44,9 +44,11 @@ export function bucketRuns(runs, count) {
|
|
|
44
44
|
if (timed.length === 0 || count < 1)
|
|
45
45
|
return [];
|
|
46
46
|
const times = timed.map(at);
|
|
47
|
-
const min = Math.min(...times);
|
|
48
47
|
const max = Math.max(...times);
|
|
49
|
-
|
|
48
|
+
// At least one minute per slice, ending at the newest run: runs inside one
|
|
49
|
+
// minute otherwise drew an axis that read "11:58 PM – 11:58 PM" on every tick.
|
|
50
|
+
const min = Math.min(Math.min(...times), max - count * 60_000);
|
|
51
|
+
const size = (max - min) / count;
|
|
50
52
|
const groups = Array.from({ length: count }, () => []);
|
|
51
53
|
for (const run of timed)
|
|
52
54
|
groups[Math.min(count - 1, Math.floor((at(run) - min) / size))].push(run);
|
|
@@ -199,6 +199,9 @@ export function RunRow({ projectId, trigger, run, newDay, replay, initialOpen =
|
|
|
199
199
|
const state = runState(run);
|
|
200
200
|
const error = run.error ?? run.run_error;
|
|
201
201
|
const failed = state === 'failed' || state === 'rejected';
|
|
202
|
+
// A skipped run carries its reason on the line too (a run cap, an overlap):
|
|
203
|
+
// without it the row read only "Skipped" until opened.
|
|
204
|
+
const showsReason = failed || state === 'skipped';
|
|
202
205
|
const source = t.raw(SOURCE_LABEL_KEY[run.source]);
|
|
203
206
|
// An App event run: its event, and the App's log of that event (one row per trigger it reached).
|
|
204
207
|
const appEvent = appEventOf(run.payload);
|
|
@@ -210,7 +213,7 @@ export function RunRow({ projectId, trigger, run, newDay, replay, initialOpen =
|
|
|
210
213
|
return (_jsxs(_Fragment, { children: [newDay ? (_jsx("li", { className: "text-muted-foreground px-3 pt-3.5 pb-1.5 text-xs font-medium", children: fmtDay(run.started_at, locale, (key) => t.raw(key)) })) : null, _jsxs("li", { className: cn('group relative rounded-md', open && 'bg-muted'), children: [_jsxs("button", { type: "button", "aria-expanded": open, onClick: () => setOpen((v) => !v), onKeyDown: (e) => {
|
|
211
214
|
if (e.key === 'Escape' && open)
|
|
212
215
|
setOpen(false);
|
|
213
|
-
}, className: cn('flex h-10 w-full items-center gap-3 rounded-md px-3 text-left text-xs outline-none', 'transition-[background-color] duration-(--duration-normal)', !open && 'hover:bg-muted/60 focus-visible:bg-muted/60'), children: [_jsx("span", { className: LANE.mark, children: state === 'running' || state === 'queued' ? (_jsx(SessionDotMatrix, { sessionId: run.run_id, size: 14, className: "shrink-0" })) : (_jsx("span", { "aria-hidden": true, className: cn('size-2 rounded-full', STATE_DOT[state]) })) }), _jsxs("span", { className: "flex min-w-0 flex-1 items-baseline gap-2.5 overflow-hidden", children: [_jsx("span", { className: "text-foreground max-w-full shrink-0 truncate font-medium", children: t.raw(STATE_LABEL_KEY[state]) }),
|
|
216
|
+
}, className: cn('flex h-10 w-full items-center gap-3 rounded-md px-3 text-left text-xs outline-none', 'transition-[background-color] duration-(--duration-normal)', !open && 'hover:bg-muted/60 focus-visible:bg-muted/60'), children: [_jsx("span", { className: LANE.mark, children: state === 'running' || state === 'queued' ? (_jsx(SessionDotMatrix, { sessionId: run.run_id, size: 14, className: "shrink-0" })) : (_jsx("span", { "aria-hidden": true, className: cn('size-2 rounded-full', STATE_DOT[state]) })) }), _jsxs("span", { className: "flex min-w-0 flex-1 items-baseline gap-2.5 overflow-hidden", children: [_jsx("span", { className: "text-foreground max-w-full shrink-0 truncate font-medium", children: t.raw(STATE_LABEL_KEY[state]) }), showsReason && error ? (_jsx("span", { className: "text-muted-foreground min-w-0 truncate", children: error })) : run.replay_of ? (_jsx(Badge, { variant: "secondary", size: "sm", className: "font-sans normal-case", children: t.raw('textc8dae6371b33') })) : isDefaultSource(trigger.type, run.source) ? null : (_jsx(Badge, { variant: "secondary", size: "sm", className: "font-sans normal-case", children: source })), run.payload_verified ? null : (_jsx(Hint, { label: t.raw('text7f2b8f3a675c'), side: "top", children: _jsx(WarningIcon, { "aria-label": t.raw('text9daf8e05c684'), className: "text-muted-foreground size-3.5 shrink-0 self-center" }) }))] }), _jsx(Hint, { label: absoluteFormatter.format(new Date(run.started_at)), side: "top", children: _jsx("span", { className: cn(LANE.time, 'text-muted-foreground tabular-nums'), children: fmtClock(run.started_at, locale) }) }), _jsx("span", { className: cn(LANE.duration, 'text-foreground tabular-nums'), children: run.duration_ms != null ? formatSessionCostDuration(run.duration_ms / 1000) : null }), _jsx("span", { className: cn(LANE.cost, 'text-foreground tabular-nums'), children: run.cost_usd ? formatSessionCostCredits(run.cost_usd) : null })] }), replay && !open ? (
|
|
214
217
|
// Collapsed failed row: Replay on hover or keyboard focus, over the lanes.
|
|
215
218
|
_jsx("span", { className: "absolute top-1.5 right-2 opacity-0 group-focus-within:opacity-100 group-hover:opacity-100", children: replayButton('bg-background') })) : null, open ? (_jsxs("div", { className: "flex flex-col gap-5 pt-1 pr-3 pb-3.5 pl-8 @2xl/runs:flex-row", children: [_jsxs("div", { className: "flex w-full shrink-0 flex-col gap-2 @2xl/runs:w-72", children: [_jsxs("div", { className: "flex gap-3 text-xs", children: [_jsx("span", { className: "text-muted-foreground w-22 shrink-0", children: t.raw('textecbc89cd37a0') }), _jsxs("span", { className: "text-foreground tabular-nums", children: [fmtClock(run.started_at, locale), " \u00B7 ", source.toLocaleLowerCase(locale)] })] }), run.session_id ? (_jsxs("div", { className: "flex gap-3 text-xs", children: [_jsx("span", { className: "text-muted-foreground w-22 shrink-0", children: t.raw('text6959b4159575') }), _jsx("button", { type: "button", onClick: async () => {
|
|
216
219
|
if (!run.session_id)
|
|
@@ -14,7 +14,8 @@ import { connectApp } from '../../../workspace/projects/onboarding/connect-app.j
|
|
|
14
14
|
import { addMcpServer, } from '../../connectors/add-mcp/add-mcp-server.js';
|
|
15
15
|
import { sdkAddMcpServerDeps } from '../../connectors/add-mcp/add-mcp-server-deps.js';
|
|
16
16
|
import { connectorHref } from '../../connectors/connector-routes.js';
|
|
17
|
-
import { buildEasyConnectConnectorDraft,
|
|
17
|
+
import { buildEasyConnectConnectorDraft, connectorSyncErrorForSlug, } from '../../sections/connector-connection-form.js';
|
|
18
|
+
import { connectorConnectionQueryKeys } from '../../../internal/hooks/connectors/invalidate-connections.js';
|
|
18
19
|
import { runConnectLinkFlow } from '../../../internal/hooks/connectors/use-connect-link.js';
|
|
19
20
|
import { useTranslations } from '../../../i18n/index.js';
|
|
20
21
|
import { PROJECT_ACTIONS } from '../../../internal/lib/project-actions.js';
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { WarningIcon as AlertTriangle } from '@phosphor-icons/react';
|
|
4
4
|
import { useTranslations } from '../../i18n/index.js';
|
|
5
5
|
import { PowerPointViewer } from 'pptx-react-viewer';
|
|
6
|
-
import { useCallback, useEffect,
|
|
6
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
7
7
|
import { I18nextProvider } from 'react-i18next';
|
|
8
8
|
import { Button } from '../../primitives/button.js';
|
|
9
9
|
import { KortixLoader } from '../../primitives/kortix-loader.js';
|
|
@@ -12,6 +12,7 @@ import { cn } from '../../lib/utils.js';
|
|
|
12
12
|
import { getPptxI18n } from './pptx-i18n.js';
|
|
13
13
|
import './pptx-viewer.css';
|
|
14
14
|
import { Download } from '../../internal/icons/download.js';
|
|
15
|
+
import { useStageFitScale } from './shared/use-stage-fit-scale.js';
|
|
15
16
|
/**
|
|
16
17
|
* Maps the viewer's shadcn-style theme tokens onto Kortix's own CSS variables
|
|
17
18
|
* so the embedded PowerPoint viewer follows the app's light/dark theme exactly.
|
|
@@ -56,26 +57,10 @@ const KORTIX_VIEWER_THEME = {
|
|
|
56
57
|
const PPTX_DESKTOP_STAGE_WIDTH = 1040;
|
|
57
58
|
/**
|
|
58
59
|
* Scales the fixed-width desktop stage down to fit a narrower viewport, never
|
|
59
|
-
* up
|
|
60
|
-
*
|
|
61
|
-
* first render, since the viewer only appears once the file bytes finish
|
|
62
|
-
* loading.
|
|
60
|
+
* up — one call into the shared fit-scale hook (the presentation slide's
|
|
61
|
+
* iframe is the other consumer, with upscale allowed).
|
|
63
62
|
*/
|
|
64
|
-
|
|
65
|
-
const [node, setNode] = useState(null);
|
|
66
|
-
const [scale, setScale] = useState(1);
|
|
67
|
-
useLayoutEffect(() => {
|
|
68
|
-
if (!node || typeof ResizeObserver === 'undefined')
|
|
69
|
-
return;
|
|
70
|
-
const observer = new ResizeObserver((entries) => {
|
|
71
|
-
const width = entries[0]?.contentRect.width ?? node.clientWidth;
|
|
72
|
-
setScale(Math.min(1, width / PPTX_DESKTOP_STAGE_WIDTH));
|
|
73
|
-
});
|
|
74
|
-
observer.observe(node);
|
|
75
|
-
return () => observer.disconnect();
|
|
76
|
-
}, [node]);
|
|
77
|
-
return [setNode, scale];
|
|
78
|
-
}
|
|
63
|
+
const usePptxStageScale = () => useStageFitScale(PPTX_DESKTOP_STAGE_WIDTH, undefined, { allowUpscale: false });
|
|
79
64
|
/**
|
|
80
65
|
* PptxRenderer — renders `.pptx`/`.ppt` decks inline with pptx-react-viewer,
|
|
81
66
|
* matching how we render docx/xlsx. Read-only (`canEdit={false}`); a download
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
interface FullScreenPresentationViewerProps {
|
|
3
2
|
isOpen: boolean;
|
|
4
3
|
onClose: () => void;
|
|
@@ -6,5 +5,7 @@ interface FullScreenPresentationViewerProps {
|
|
|
6
5
|
sandboxUrl?: string;
|
|
7
6
|
initialSlide?: number;
|
|
8
7
|
}
|
|
9
|
-
|
|
8
|
+
/** The fullscreen presentation modal. The metadata lifecycle, the slide
|
|
9
|
+
* stage, the keyboard map and the export menu live in their own modules. */
|
|
10
|
+
export declare function FullScreenPresentationViewer({ isOpen, onClose, presentationName, sandboxUrl, initialSlide, }: FullScreenPresentationViewerProps): import("react").JSX.Element | null;
|
|
10
11
|
export {};
|