@kortix/ui 0.15.8 → 0.15.9
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 +4 -1
- 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/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 +27 -7
- 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/providers/provider-accordion.js +5 -4
- package/dist/customize/providers/provider-connect.js +3 -1
- package/dist/customize/providers/provider-sheet.js +9 -4
- package/dist/customize/sections/component/email-connect-form.js +4 -2
- 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/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/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/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 +48 -0
- package/dist/i18n/en.js +51 -3
- 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/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/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/lib/z-stack.d.ts +5 -1
- package/dist/lib/z-stack.js +12 -2
- package/dist/session/models/model-connection-gate.js +16 -3
- package/dist/session/models/model-picker-panel.js +6 -2
- 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/prompts/session-connect-prompt.d.ts +40 -0
- package/dist/session/prompts/session-connect-prompt.js +126 -0
- package/dist/session/status/session-error-banner.d.ts +1 -1
- package/dist/session/status/session-error-banner.js +12 -4
- package/dist/session/thread/session-chat.js +7 -2
- package/dist/session/thread/transcript.js +31 -7
- package/dist/test-utils/intl.d.ts +48 -0
- package/package.json +3 -3
|
@@ -404,14 +404,26 @@ function SecretDialog({ open, onOpenChange, projectId, row, connectors, connecto
|
|
|
404
404
|
*/
|
|
405
405
|
const [pickedExposure, setPickedExposure] = useState(null);
|
|
406
406
|
const exposure = pickedExposure ?? defaultSecretExposure(row, classification);
|
|
407
|
-
|
|
407
|
+
/**
|
|
408
|
+
* A connector-only row that no connector resolves (a value typed into a
|
|
409
|
+
* connector-scoped setup link, never bound) has no owning flow: its owner
|
|
410
|
+
* may move it to environment delivery. Unknown while connectors load.
|
|
411
|
+
*/
|
|
412
|
+
const connectorBound = row?.consumer !== 'connector' ||
|
|
413
|
+
connectorsLoading ||
|
|
414
|
+
connectors.some((connector) => connector.secretIdentifier === row?.identifier);
|
|
415
|
+
const unboundConnectorRow = row?.consumer === 'connector' && !connectorBound;
|
|
416
|
+
const usageContext = { connectorBound, picked: pickedExposure !== null };
|
|
417
|
+
const { strategy, consumer: nextConsumer } = secretDeliveryTarget(exposure, row, usageContext);
|
|
408
418
|
/**
|
|
409
419
|
* The LLM gateway, a connector, or the git connection owns this row's
|
|
410
420
|
* usage, so the picker must not be shown at all. It writes three
|
|
411
421
|
* `(strategy, consumer)` pairs and none of them is the one this row has;
|
|
412
422
|
* rendering it would silently disconnect whatever assigned it.
|
|
413
423
|
*/
|
|
414
|
-
const usageAssigned = secretUsageIsAssigned(row?.consumer);
|
|
424
|
+
const usageAssigned = secretUsageIsAssigned(row?.consumer, usageContext);
|
|
425
|
+
/** The picker's value: an unbound connector row reads as Connector until moved. */
|
|
426
|
+
const pickerValue = unboundConnectorRow && pickedExposure === null ? 'connector' : exposure;
|
|
415
427
|
const [selectedConnectorSlugs, setSelectedConnectorSlugs] = useState(null);
|
|
416
428
|
const effectiveSelectedConnectorSlugs = selectedConnectorSlugs ??
|
|
417
429
|
connectors
|
|
@@ -452,7 +464,8 @@ function SecretDialog({ open, onOpenChange, projectId, row, connectors, connecto
|
|
|
452
464
|
const prepareSavePlan = () => {
|
|
453
465
|
const finalKey = (row?.key ?? key).trim().toUpperCase();
|
|
454
466
|
const finalIdentifier = (row?.identifier ?? identifier).trim() || finalKey;
|
|
455
|
-
const
|
|
467
|
+
const keepsConnector = row?.consumer === 'connector' && nextConsumer === 'connector';
|
|
468
|
+
const nextConnectorSlugs = keepsConnector ? effectiveSelectedConnectorSlugs : [];
|
|
456
469
|
const bindingChanges = connectorBindingChanges(connectors, finalIdentifier, nextConnectorSlugs);
|
|
457
470
|
if (!SECRET_NAME_REGEX.test(finalKey)) {
|
|
458
471
|
throw new Error('Key: use A-Z, 0-9, _ only. Must start with a letter or _. Max 64 chars.');
|
|
@@ -472,7 +485,9 @@ function SecretDialog({ open, onOpenChange, projectId, row, connectors, connecto
|
|
|
472
485
|
if (needsHosts && !enforcedPolicy) {
|
|
473
486
|
throw new Error('Add at least one exact HTTPS host.');
|
|
474
487
|
}
|
|
475
|
-
|
|
488
|
+
// An unbound connector row may be saved unbound (a new value); a bound one
|
|
489
|
+
// keeps at least one connector.
|
|
490
|
+
if (keepsConnector && connectorBound && nextConnectorSlugs.length === 0) {
|
|
476
491
|
throw new Error('Select at least one connector.');
|
|
477
492
|
}
|
|
478
493
|
if (!nextSharedWith) {
|
|
@@ -651,6 +666,7 @@ function SecretDialog({ open, onOpenChange, projectId, row, connectors, connecto
|
|
|
651
666
|
? `Edit ${row.identifier}`
|
|
652
667
|
: `Set ${row.identifier}`;
|
|
653
668
|
const selectedDelivery = secretDeliveryPresentation(strategy, nextConsumer, { tI18nComplete });
|
|
669
|
+
const connectorOnlyDelivery = secretDeliveryPresentation('broker', 'connector', { tI18nComplete });
|
|
654
670
|
const bindingIdentifier = (row?.identifier ?? identifier).trim() || key.trim().toUpperCase();
|
|
655
671
|
const connectorOptions = connectorBindingOptions(connectors, bindingIdentifier, tI18nComplete);
|
|
656
672
|
// Offer "Enforce at the network" only when the experimental flag is on, or
|
|
@@ -703,7 +719,7 @@ function SecretDialog({ open, onOpenChange, projectId, row, connectors, connecto
|
|
|
703
719
|
/* Read-only, because another flow assigned it. Same treatment
|
|
704
720
|
the git-connection secret always had, now covering the LLM
|
|
705
721
|
gateway and connector rows it was always true of. */
|
|
706
|
-
_jsxs("div", { id: "secret-dialog-delivery", className: "border-border bg-sidebar rounded-md border p-3", children: [_jsx(Badge, { variant: selectedDelivery.tone, size: "sm", children: selectedDelivery.label }), _jsxs("p", { className: "text-muted-foreground mt-2 text-xs text-pretty", children: [selectedDelivery.description, " ", tI18nComplete.raw('text5740535823f9')] })] })) : (_jsxs(Select, { value:
|
|
722
|
+
_jsxs("div", { id: "secret-dialog-delivery", className: "border-border bg-sidebar rounded-md border p-3", children: [_jsx(Badge, { variant: selectedDelivery.tone, size: "sm", children: selectedDelivery.label }), _jsxs("p", { className: "text-muted-foreground mt-2 text-xs text-pretty", children: [selectedDelivery.description, " ", tI18nComplete.raw('text5740535823f9')] })] })) : (_jsxs(Select, { value: pickerValue, onValueChange: (next) => setPickedExposure(next === 'connector' ? null : next), disabled: save.isPending, children: [_jsx(SelectTrigger, { id: "secret-dialog-delivery", className: "min-h-10 w-full", children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [unboundConnectorRow && (_jsx(SelectItem, { value: "connector", description: connectorOnlyDelivery.description, children: connectorOnlyDelivery.label })), exposureOptions.map((option) => (_jsx(SelectItem, { value: option.exposure, description: option.description, children: option.label }, option.exposure)))] })] })), !usageAssigned && (_jsx(FieldDescription, { children: selectedDelivery.description }))] }), strategy === 'runtime' && (_jsxs(Alert, { variant: "warning", children: [_jsx(AlertTitle, { children: tI18nComplete.raw('text4fb8319405f3') }), _jsx(AlertDescription, { children: tI18nComplete.raw('textdb71b63b5778') })] })), grantNotice && (_jsxs(BannerAlert, { variant: "warning", className: "[&_[data-slot=alert-content]]:min-w-0", children: [_jsx(BannerAlertMedia, { children: _jsx(DangerTriangleSolid, { weight: "fill" }) }), _jsx(BannerAlertTitle, { children: grantNotice.title }), _jsxs(BannerAlertDescription, { children: [_jsx("span", { className: "block text-pretty", children: grantNotice.body }), grantPlan.candidates.length > 0 && (_jsxs("div", { className: "mt-3 flex flex-wrap items-center gap-2", children: [grantPlan.candidates.length > 1 && (_jsxs(Select, { value: selectedGrantAgent ?? '', onValueChange: setGrantAgent, disabled: grant.isPending, children: [_jsx(SelectTrigger, { "aria-label": tI18nComplete.raw('text33e745179bcb'), className: "h-8 w-48", children: _jsx(SelectValue, { placeholder: tI18nComplete.raw('textb6890bc23a9c') }) }), _jsx(SelectContent, { children: grantPlan.candidates.map((candidate) => (_jsx(SelectItem, { value: candidate.name, description: agentGrantCandidateHint(candidate) ?? undefined, children: candidate.name }, candidate.name))) })] })), _jsxs(Button, { type: "button", size: "sm", onClick: startGrant, disabled: !selectedGrantAgent || grant.isPending, children: [grant.isPending ? _jsx(Loading, { className: "size-3.5 shrink-0" }) : null, agentGrantActionLabel(grantPlan, selectedGrantAgent)] })] })), grantPlan.candidates.length === 0 && (_jsx("span", { className: "text-muted-foreground mt-2 block text-xs text-pretty", children: tI18nComplete.raw('textf23c70160b5b') })), selectedGrantHint && (_jsx("span", { className: "text-muted-foreground mt-2 block text-xs text-pretty", children: selectedGrantHint })), grant.error && (_jsx("span", { className: "text-kortix-red mt-2 block text-xs text-pretty", children: agentGrantErrorMessage(grant.error) })), _jsx("pre", { className: "border-border bg-muted mt-2 overflow-x-auto rounded-sm border p-2 font-mono text-xs leading-relaxed", children: grantManifest })] })] })), needsHosts && (_jsxs("div", { className: "border-border bg-sidebar space-y-4 rounded-md border p-3", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-sm font-medium", children: tI18nComplete.raw('textd3297c00f7a2') }), _jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: tI18nComplete.raw('text76f48924ee10') })] }), _jsxs(BannerAlert, { variant: "default", className: "[&_[data-slot=alert-content]]:min-w-0", children: [_jsx(BannerAlertTitle, { children: echoNotice.title }), _jsxs(BannerAlertDescription, { children: [_jsx("span", { className: "block text-pretty", children: echoNotice.body }), _jsx("pre", { className: "border-border bg-muted mt-2 overflow-x-auto rounded-sm border p-2 font-mono text-xs leading-relaxed", children: echoNotice.probe }), _jsx(Link, { href: echoNotice.docsHref, target: "_blank", rel: "noreferrer", className: "text-muted-foreground hover:text-foreground mt-2 inline-block text-xs underline underline-offset-2", children: echoNotice.docsLabel })] })] }), _jsxs(Field, { children: [_jsx(FieldLabel, { htmlFor: "secret-dialog-hosts", children: tI18nComplete.raw('textbba9af131107') }), _jsx(Textarea, { id: "secret-dialog-hosts", value: hosts, onChange: (event) => setEditedHosts(event.target.value), placeholder: tI18nComplete.raw('text07de8e6e567f'), minHeight: 56, maxHeight: 112, variant: "outline", className: "font-mono text-xs", disabled: save.isPending }), _jsx(FieldDescription, { children: tI18nComplete.raw('text80befc2e0620') })] }), legacyDetail && (_jsxs("div", { className: "border-border bg-popover space-y-2 rounded-md border p-3", children: [_jsx("p", { className: "text-sm font-medium", children: legacyDetail.title }), _jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: legacyDetail.body }), _jsx("dl", { className: "text-muted-foreground space-y-0.5 font-mono text-xs", children: legacyDetail.lines.map((line) => (_jsx("dd", { children: line }, line))) }), _jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => setLegacyInject(null), disabled: save.isPending, children: tI18nComplete.raw('text4a72652fb7e7') })] }))] })), row?.consumer === 'connector' && nextConsumer === 'connector' && (_jsx("div", { className: "border-border bg-sidebar space-y-4 rounded-md border p-3", children: _jsxs(Field, { children: [_jsx(FieldLabel, { children: tI18nComplete.raw('textc3d2e79ebdd0') }), connectorsLoading ? (_jsxs("div", { className: "space-y-2", children: [_jsx(Skeleton, { className: "h-12 rounded-md" }), _jsx(Skeleton, { className: "h-12 rounded-md" })] })) : connectorOptions.length === 0 ? (_jsxs(BannerAlert, { variant: "default", children: [_jsx(BannerAlertTitle, { children: tI18nComplete.raw('text10798ef769fd') }), _jsx(BannerAlertDescription, { children: tI18nComplete.raw('text0b834e60371f') })] })) : (_jsx("div", { className: "bg-popover overflow-hidden rounded-md border", children: connectorOptions.map((option, index) => (_jsxs("label", { className: cn('flex min-h-12 items-center gap-3 px-3 py-2', index > 0 && 'border-t', option.disabled ? 'cursor-not-allowed opacity-60' : 'cursor-pointer'), children: [_jsx(Checkbox, { checked: effectiveSelectedConnectorSlugSet.has(option.slug), disabled: option.disabled || save.isPending, onCheckedChange: (checked) => {
|
|
707
723
|
setSelectedConnectorSlugs((current) => checked
|
|
708
724
|
? [
|
|
709
725
|
...new Set([
|
|
@@ -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)
|
|
@@ -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 {};
|