@kortix/ui 0.15.9 → 0.15.11
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 +467 -2
- package/dist/_vendor/shared/app-config.d.ts +6 -30
- package/dist/_vendor/shared/channel-descriptors.d.ts +0 -34
- package/dist/_vendor/shared/channel-header.d.ts +2 -1
- package/dist/_vendor/shared/connector-sections.d.ts +0 -25
- package/dist/_vendor/shared/file-tags.d.ts +2 -1
- package/dist/_vendor/shared/index.d.ts +1 -0
- package/dist/_vendor/shared/pasted-content.d.ts +0 -4
- package/dist/_vendor/shared/pixel-mark.d.ts +0 -17
- package/dist/_vendor/shared/project-glyphs.d.ts +0 -1
- 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/customize/agents/agent-model-view.d.ts +11 -1
- package/dist/customize/agents/agent-model-view.js +12 -1
- package/dist/customize/agents/agent-page.js +19 -6
- package/dist/customize/agents/agent-tabs.d.ts +2 -0
- package/dist/customize/agents/agent-tabs.js +2 -0
- package/dist/customize/connectors/connectors-page.js +1 -1
- package/dist/customize/connectors/detail/connector-page.js +9 -4
- package/dist/customize/connectors/detail/connector-triggers.js +1 -1
- package/dist/customize/connectors/install/use-install.js +1 -1
- package/dist/customize/connectors/use-agent-access.d.ts +1 -0
- package/dist/customize/providers/provider-accordion.js +5 -5
- package/dist/customize/providers/provider-connect.d.ts +3 -3
- package/dist/customize/providers/provider-connect.js +8 -16
- package/dist/customize/providers/provider-sheet.js +4 -4
- package/dist/customize/sections/component/teams-byo-wizard.js +4 -1
- 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/view/review-center-connected.js +7 -3
- package/dist/customize/settings/tabs/workspace-keys.js +53 -11
- package/dist/customize/shared/feature-gate-screen.js +1 -1
- package/dist/customize/triggers/runtime-triggers.js +13 -2
- package/dist/customize/triggers/schedule/event-account-picker.js +1 -1
- package/dist/customize/triggers/schedule/event-trigger-copy.js +1 -1
- package/dist/customize/triggers/schedule/schedule-detail-sheet.js +5 -4
- package/dist/customize/triggers/schedule/then-fields.d.ts +5 -1
- package/dist/customize/triggers/schedule/then-fields.js +23 -3
- package/dist/customize/triggers/schedule/trigger-callouts.js +1 -1
- package/dist/customize/triggers/schedule/trigger-composer-logic.d.ts +27 -0
- package/dist/customize/triggers/schedule/trigger-composer-logic.js +51 -5
- package/dist/customize/triggers/schedule/trigger-composer.js +19 -13
- package/dist/customize/triggers/schedule/trigger-edit-logic.js +25 -5
- package/dist/customize/triggers/schedule/trigger-filter.d.ts +10 -3
- package/dist/customize/triggers/schedule/trigger-filter.js +7 -6
- package/dist/customize/triggers/schedule/trigger-readonly.js +1 -1
- package/dist/customize/triggers/schedule/trigger-runs-panel.js +1 -1
- package/dist/customize/triggers/schedule/use-event-app-connect.js +2 -1
- package/dist/customize/triggers/schedule/when-event.js +1 -1
- package/dist/customize/triggers/schedule/when-schedule.d.ts +5 -1
- package/dist/customize/triggers/schedule/when-schedule.js +16 -1
- package/dist/customize/triggers/schedule-view.js +4 -2
- package/dist/i18n/en.d.ts +56 -7
- package/dist/i18n/en.js +65 -16
- package/dist/internal/billing/compute-pricing.d.ts +7 -1
- package/dist/internal/billing/compute-pricing.js +7 -1
- 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.js +1 -1
- package/dist/internal/hooks/connectors/use-pipedream-connect-member.js +1 -1
- package/dist/internal/hooks/connectors/use-pipedream-connect-project.js +1 -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/layout/project-settings-nav.d.ts +17 -0
- package/dist/internal/layout/project-settings-nav.js +24 -0
- package/dist/internal/lib/browser-noise/rules/injected-scripts.js +2 -2
- package/dist/internal/lib/capability-tab-routes.d.ts +8 -0
- package/dist/internal/lib/capability-tab-routes.js +11 -0
- package/dist/internal/notifications/notification-inbox.d.ts +4 -10
- package/dist/internal/notifications/notification-inbox.js +8 -9
- package/dist/internal/stores/composer-prefill-store.d.ts +7 -0
- package/dist/internal/stores/composer-prefill-store.js +1 -0
- 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/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/actions/session-label.js +2 -2
- package/dist/session/agents/agent-strip.d.ts +10 -5
- package/dist/session/agents/agent-strip.js +40 -12
- package/dist/session/agents/held-messages.d.ts +6 -2
- package/dist/session/agents/held-messages.js +6 -3
- package/dist/session/composer/ComposerCard.js +8 -3
- package/dist/session/composer/agent-selector.d.ts +2 -0
- package/dist/session/composer/agent-selector.js +5 -0
- 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 +3 -1
- package/dist/session/composer/composer-chat-input.js +2 -2
- package/dist/session/composer/composer-logic.d.ts +7 -0
- package/dist/session/composer/composer-logic.js +18 -0
- package/dist/session/composer/composer-reset.d.ts +8 -14
- package/dist/session/composer/composer-toolbar.d.ts +3 -1
- package/dist/session/composer/composer-toolbar.js +3 -3
- package/dist/session/composer/composer.d.ts +9 -0
- package/dist/session/composer/composer.js +22 -11
- 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 +13 -7
- package/dist/session/composer/hooks/use-composer-focus.js +4 -2
- package/dist/session/header/session-site-header.d.ts +3 -1
- package/dist/session/header/session-site-header.js +3 -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/connect-model-step.d.ts +29 -0
- package/dist/session/models/connect-model-step.js +50 -0
- package/dist/session/models/model-connection-gate.d.ts +2 -1
- package/dist/session/models/model-connection-gate.js +6 -3
- 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-selector.d.ts +1 -1
- package/dist/session/models/model-selector.js +9 -6
- package/dist/session/models/subscription-offer.d.ts +4 -0
- package/dist/session/models/subscription-offer.js +11 -3
- package/dist/session/models/use-workspace-model-gate.d.ts +11 -0
- package/dist/session/models/use-workspace-model-gate.js +62 -0
- package/dist/session/models/workspace-model-gate.d.ts +46 -0
- package/dist/session/models/workspace-model-gate.js +66 -0
- 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-card.d.ts +63 -0
- package/dist/session/prompts/{session-connect-prompt.js → session-connect-card.js} +53 -42
- package/dist/session/status/provisioning-failure.d.ts +23 -2
- package/dist/session/status/provisioning-failure.js +53 -3
- 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 +317 -298
- package/dist/session/thread/transcript.d.ts +19 -2
- package/dist/session/thread/transcript.js +93 -25
- package/dist/session/tool/tool-part-renderer.js +7 -2
- package/dist/session/tool/tools/bash-tool.d.ts +3 -52
- package/dist/session/tool/tools/bash-tool.js +3 -86
- package/dist/session/tool/tools/kortix-action-tool.js +10 -2
- 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-viewport.d.ts +66 -10
- package/dist/session/turn/turn-viewport.js +92 -12
- package/dist/session/turn/turn-work-accordion.d.ts +3 -1
- package/dist/session/turn/turn-work-accordion.js +2 -2
- package/dist/session/turn/user-message.js +7 -5
- package/dist/styles.css +1 -1
- package/dist/test-utils/intl.d.ts +56 -7
- package/dist/workspace/admin/project-admin-dashboard.js +2 -4
- package/dist/workspace/home/existing-repo-setup-prompt.d.ts +5 -8
- package/dist/workspace/home/existing-repo-setup-prompt.js +16 -42
- package/dist/workspace/home/first-chat.d.ts +7 -1
- package/dist/workspace/home/first-chat.js +12 -5
- package/dist/workspace/home/no-agent-home.d.ts +3 -1
- package/dist/workspace/home/no-agent-home.js +2 -2
- 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 +17 -16
- 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/session-grouping.d.ts +1 -1
- package/dist/workspace/sidebar/session-grouping.js +1 -1
- package/dist/workspace/sidebar/workspace-menu-model.d.ts +3 -5
- package/dist/workspace/sidebar/workspace-menu-model.js +1 -1
- package/dist/workspace/spaces/space-details-panel.js +2 -2
- package/dist/workspace/spaces/space-triggers.js +2 -2
- package/dist/workspace/spaces/space-view.js +11 -5
- package/package.json +15 -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
- package/dist/session/prompts/session-connect-prompt.d.ts +0 -40
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { newSessionHref } from '../../lib/routes.js';
|
|
4
|
+
import { UiLink } from '../../providers/ui-provider.js';
|
|
3
5
|
import { Button } from '../../primitives/button.js';
|
|
6
|
+
import { ButtonGroup } from '../../primitives/button-group.js';
|
|
4
7
|
import { InlineMeta } from '../../primitives/inline-meta.js';
|
|
5
8
|
import { useTranslations } from '../../i18n/index.js';
|
|
6
9
|
/** Pending text stays legible while the active turn continues above it. */
|
|
@@ -25,3 +28,12 @@ export function QueuedPromptFailure({ lastError, onRetry, onRemove, }) {
|
|
|
25
28
|
const common = useTranslations('common');
|
|
26
29
|
return (_jsx(InlineMeta, { children: _jsxs("span", { "data-queued-status": "failed", className: "flex items-center gap-1", children: [_jsxs("span", { className: "text-kortix-red", role: "status", title: lastError ?? undefined, children: [copy.raw('textcd5f943d5863'), lastError ? ` — ${lastError}` : ''] }), onRetry && (_jsx(Button, { type: "button", variant: "ghost", size: "xs", onClick: onRetry, children: copy.raw('text942087cc2d41') })), onRemove && (_jsx(Button, { type: "button", variant: "ghost", size: "xs", onClick: onRemove, children: common('remove') }))] }) }));
|
|
27
30
|
}
|
|
31
|
+
/** A failed callback path requires a new computer, not a retry on the old one. */
|
|
32
|
+
export function QueuedPromptRecovery({ projectId, onRemove }) {
|
|
33
|
+
const sidebar = useTranslations('sidebar');
|
|
34
|
+
const turn = useTranslations('sessionUi.turn');
|
|
35
|
+
const common = useTranslations('common');
|
|
36
|
+
const newSession = projectId ? (_jsx(Button, { variant: "ghost", size: "xs", asChild: true, children: _jsx(UiLink, { href: newSessionHref(projectId), children: sidebar('newSession') }) })) : null;
|
|
37
|
+
const remove = onRemove ? (_jsx(Button, { type: "button", variant: "ghost", size: "xs", onClick: onRemove, children: common('remove') })) : null;
|
|
38
|
+
return (_jsxs("div", { "data-queued-status": "failed", className: "flex flex-col items-end gap-1", children: [_jsx("span", { role: "status", className: "text-kortix-red text-xs", children: turn('computerDisconnected') }), newSession && remove ? _jsxs(ButtonGroup, { children: [newSession, remove] }) : newSession ?? remove] }));
|
|
39
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Containment for a turn wrapper — and the
|
|
2
|
+
* Containment for a turn wrapper — and the four rules that make it safe.
|
|
3
3
|
*
|
|
4
4
|
* `content-visibility: auto` lets the browser skip layout and paint for a turn
|
|
5
5
|
* that is off screen. That is a real saving here: the transcript grows by a
|
|
@@ -21,9 +21,6 @@
|
|
|
21
21
|
* while I scroll back"). So the stand-in is the turn's own measured height,
|
|
22
22
|
* written per turn, and no turn is contained before it has one.
|
|
23
23
|
*
|
|
24
|
-
* RULE 3 — no containment below `TURN_MIN_CONTAIN_PX`. See its own comment:
|
|
25
|
-
* a turn skipped at a near-zero stand-in can never come back.
|
|
26
|
-
*
|
|
27
24
|
* RULE 2 — no containment for an EMPTY turn, ever. A zero-height element can
|
|
28
25
|
* never intersect the viewport, so `content-visibility: auto` classifies it as
|
|
29
26
|
* "not relevant" and SKIPS it — permanently — and a skipped element stands in
|
|
@@ -37,6 +34,42 @@
|
|
|
37
34
|
* because ANY empty turn reproduces it.) An empty turn also drops the spacing
|
|
38
35
|
* its caller gave it, so a run of invisible turns contributes 0px, not a
|
|
39
36
|
* stack of 48px margins.
|
|
37
|
+
*
|
|
38
|
+
* RULE 3 — no containment below `TURN_MIN_CONTAIN_PX`. See its own comment:
|
|
39
|
+
* a turn skipped at a near-zero stand-in can never come back.
|
|
40
|
+
*
|
|
41
|
+
* RULE 4 — containment is only ever ADDED while the turn is off screen.
|
|
42
|
+
* Chrome resolves `content-visibility: auto` relevance after the frame that
|
|
43
|
+
* adds the property, so a turn contained while the reader looks at it is
|
|
44
|
+
* skipped for that frame: its bubble and avatar report a `previousRect` of
|
|
45
|
+
* 0x0 and the turn box a stale one, and the frame is scored as a layout shift.
|
|
46
|
+
* Measured on a plain send (F-022, 2026-11-13): 0.026-0.046 per new turn,
|
|
47
|
+
* 900ms after it mounted (`TURN_SETTLE_MS` plus the measure frames), with an
|
|
48
|
+
* rAF probe that saw the turn's box never move. Forcing `content-visibility:
|
|
49
|
+
* visible` on the same build removed every turn shift. The queued turns of a
|
|
50
|
+
* burst each paid it in turn, which is where the audit's 0.107-0.141 shifts
|
|
51
|
+
* came from. Containment only saves work on a turn that is off screen, so
|
|
52
|
+
* holding it until the turn is out of view costs nothing: the turn is
|
|
53
|
+
* contained out of sight, where no shift is scored and none is seen. "Was off
|
|
54
|
+
* screen once" is not enough: a queued turn mounts below the fold, the
|
|
55
|
+
* auto-scroll brings it up, and its height settles 500ms later in full view
|
|
56
|
+
* (measured: 0.072 for one queued turn). So the decision is taken while the
|
|
57
|
+
* turn is out of view, and then held: once contained, `content-visibility:
|
|
58
|
+
* auto` tracks relevance by itself. Losing its stand-in (RULE 2/3) drops the
|
|
59
|
+
* hold, so containment comes back only out of view again.
|
|
60
|
+
*
|
|
61
|
+
* And it is granted only at the height the turn has AT THAT MOMENT. A turn
|
|
62
|
+
* contained for the first time out of view has no last-remembered size, so it
|
|
63
|
+
* stands in at the published height, and a turn that just grew has not
|
|
64
|
+
* published its new one yet (`TURN_SETTLE_MS`). Measured: a queued turn whose
|
|
65
|
+
* answer took it from 130px to 206px was scrolled off and contained at 130px
|
|
66
|
+
* in the same second, pulling everything under it up 76px (0.097). A height
|
|
67
|
+
* still settling waits for its publish, and the grant is checked again then.
|
|
68
|
+
*
|
|
69
|
+
* "Out of view" is read from layout at the moment of the grant, never from the
|
|
70
|
+
* observer's last report: that report is a frame late, and an auto-scroll can
|
|
71
|
+
* bring the turn on screen inside that frame. The observer only says WHEN to
|
|
72
|
+
* look again.
|
|
40
73
|
*/
|
|
41
74
|
export type TurnMeasureState = 'unmeasured' | 'empty' | 'measured';
|
|
42
75
|
/**
|
|
@@ -66,7 +99,26 @@ export declare const TURN_MIN_CONTAIN_PX = 48;
|
|
|
66
99
|
* short to be a credible box, which is the case a stand-in can never recover
|
|
67
100
|
* from.
|
|
68
101
|
*/
|
|
69
|
-
export declare function turnIntrinsicSize(state: TurnMeasureState, measuredHeight: number): string | undefined;
|
|
102
|
+
export declare function turnIntrinsicSize(state: TurnMeasureState, measuredHeight: number, containedOffscreen: boolean): string | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* RULE 4's hold, as one pure step. Dropped the moment the turn has no stand-in
|
|
105
|
+
* (RULE 2/3); kept once granted; granted only while the turn is out of view AND
|
|
106
|
+
* its current layout height is the published one.
|
|
107
|
+
*/
|
|
108
|
+
export declare function nextContainHold(input: {
|
|
109
|
+
held: boolean;
|
|
110
|
+
hasStandIn: boolean;
|
|
111
|
+
outOfView: boolean;
|
|
112
|
+
heightSettled: boolean;
|
|
113
|
+
}): boolean;
|
|
114
|
+
/** RULE 4's geometry: no pixel of the turn is inside the visible band. */
|
|
115
|
+
export declare function turnOutOfView(turn: {
|
|
116
|
+
top: number;
|
|
117
|
+
bottom: number;
|
|
118
|
+
}, visible: {
|
|
119
|
+
top: number;
|
|
120
|
+
bottom: number;
|
|
121
|
+
}): boolean;
|
|
70
122
|
/**
|
|
71
123
|
* The wrapper's full class list. Pure and DOM-free so every rule above has a
|
|
72
124
|
* test that can fail:
|
|
@@ -75,12 +127,14 @@ export declare function turnIntrinsicSize(state: TurnMeasureState, measuredHeigh
|
|
|
75
127
|
* - `empty` → no containment (RULE 2), and `mt-0` AFTER the caller's
|
|
76
128
|
* classes so tailwind-merge drops the caller's `mt-*`.
|
|
77
129
|
* - `measured` → containment, but ONLY when it has a stand-in to be skipped
|
|
78
|
-
* at (RULE 3)
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
130
|
+
* at (RULE 3) and the hold was granted out of view, at
|
|
131
|
+
* its current height (RULE 4). The size itself is an
|
|
132
|
+
* inline style, so the class is driven by
|
|
133
|
+
* `turnIntrinsicSize` rather than by the state: that is
|
|
134
|
+
* what makes "contained" and "has a stand-in" the same fact
|
|
135
|
+
* instead of two that can disagree.
|
|
82
136
|
*/
|
|
83
|
-
export declare function turnViewportClassName(state: TurnMeasureState, className?: string, measuredHeight?: number): string;
|
|
137
|
+
export declare function turnViewportClassName(state: TurnMeasureState, className?: string, measuredHeight?: number, containedOffscreen?: boolean): string;
|
|
84
138
|
/**
|
|
85
139
|
* How long a turn's height must hold still before it is allowed to skip.
|
|
86
140
|
*
|
|
@@ -132,6 +186,8 @@ export declare function turnLayoutHeight(el: HTMLElement): number;
|
|
|
132
186
|
export declare function useTurnMeasure(ref: React.RefObject<HTMLDivElement | null>): {
|
|
133
187
|
state: TurnMeasureState;
|
|
134
188
|
height: number;
|
|
189
|
+
/** RULE 4: containment was granted while the turn was out of view. */
|
|
190
|
+
containedOffscreen: boolean;
|
|
135
191
|
};
|
|
136
192
|
/**
|
|
137
193
|
* One turn's wrapper: the scroll anchor (`data-turn-id`) plus the containment
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { cn } from '../../lib/utils.js';
|
|
4
|
-
import { useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
5
5
|
/**
|
|
6
6
|
* The smallest stand-in a turn may be skipped at — RULE 3.
|
|
7
7
|
*
|
|
@@ -29,13 +29,51 @@ export const TURN_MIN_CONTAIN_PX = 48;
|
|
|
29
29
|
* short to be a credible box, which is the case a stand-in can never recover
|
|
30
30
|
* from.
|
|
31
31
|
*/
|
|
32
|
-
export function turnIntrinsicSize(state, measuredHeight) {
|
|
32
|
+
export function turnIntrinsicSize(state, measuredHeight, containedOffscreen) {
|
|
33
33
|
if (state !== 'measured')
|
|
34
34
|
return undefined;
|
|
35
|
+
if (!containedOffscreen)
|
|
36
|
+
return undefined; // RULE 4
|
|
35
37
|
if (!(measuredHeight >= TURN_MIN_CONTAIN_PX))
|
|
36
38
|
return undefined;
|
|
37
39
|
return `auto ${measuredHeight}px`;
|
|
38
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* RULE 4's hold, as one pure step. Dropped the moment the turn has no stand-in
|
|
43
|
+
* (RULE 2/3); kept once granted; granted only while the turn is out of view AND
|
|
44
|
+
* its current layout height is the published one.
|
|
45
|
+
*/
|
|
46
|
+
export function nextContainHold(input) {
|
|
47
|
+
if (!input.hasStandIn)
|
|
48
|
+
return false;
|
|
49
|
+
if (input.held)
|
|
50
|
+
return true;
|
|
51
|
+
return input.outOfView && input.heightSettled;
|
|
52
|
+
}
|
|
53
|
+
/** RULE 4's geometry: no pixel of the turn is inside the visible band. */
|
|
54
|
+
export function turnOutOfView(turn, visible) {
|
|
55
|
+
return turn.bottom <= visible.top || turn.top >= visible.bottom;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The band a turn can be seen in: its nearest clipping ancestor's box, clipped
|
|
59
|
+
* to the window. A clip wrapper inside the scroller only narrows the band, so
|
|
60
|
+
* the error is always "in view" (left uncontained), never a visible turn
|
|
61
|
+
* contained.
|
|
62
|
+
*/
|
|
63
|
+
function visibleBand(el) {
|
|
64
|
+
let top = 0;
|
|
65
|
+
let bottom = window.innerHeight;
|
|
66
|
+
for (let a = el.parentElement; a; a = a.parentElement) {
|
|
67
|
+
const overflowY = getComputedStyle(a).overflowY;
|
|
68
|
+
if (overflowY === 'auto' || overflowY === 'scroll' || overflowY === 'hidden') {
|
|
69
|
+
const r = a.getBoundingClientRect();
|
|
70
|
+
top = Math.max(top, r.top);
|
|
71
|
+
bottom = Math.min(bottom, r.bottom);
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return { top, bottom };
|
|
76
|
+
}
|
|
39
77
|
/**
|
|
40
78
|
* The wrapper's full class list. Pure and DOM-free so every rule above has a
|
|
41
79
|
* test that can fail:
|
|
@@ -44,13 +82,15 @@ export function turnIntrinsicSize(state, measuredHeight) {
|
|
|
44
82
|
* - `empty` → no containment (RULE 2), and `mt-0` AFTER the caller's
|
|
45
83
|
* classes so tailwind-merge drops the caller's `mt-*`.
|
|
46
84
|
* - `measured` → containment, but ONLY when it has a stand-in to be skipped
|
|
47
|
-
* at (RULE 3)
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
85
|
+
* at (RULE 3) and the hold was granted out of view, at
|
|
86
|
+
* its current height (RULE 4). The size itself is an
|
|
87
|
+
* inline style, so the class is driven by
|
|
88
|
+
* `turnIntrinsicSize` rather than by the state: that is
|
|
89
|
+
* what makes "contained" and "has a stand-in" the same fact
|
|
90
|
+
* instead of two that can disagree.
|
|
51
91
|
*/
|
|
52
|
-
export function turnViewportClassName(state, className, measuredHeight = 0) {
|
|
53
|
-
return cn(turnIntrinsicSize(state, measuredHeight) !== undefined && '[content-visibility:auto]', className, state === 'empty' && 'mt-0');
|
|
92
|
+
export function turnViewportClassName(state, className, measuredHeight = 0, containedOffscreen = false) {
|
|
93
|
+
return cn(turnIntrinsicSize(state, measuredHeight, containedOffscreen) !== undefined && '[content-visibility:auto]', className, state === 'empty' && 'mt-0');
|
|
54
94
|
}
|
|
55
95
|
/**
|
|
56
96
|
* How long a turn's height must hold still before it is allowed to skip.
|
|
@@ -103,6 +143,24 @@ export function turnLayoutHeight(el) {
|
|
|
103
143
|
* value.
|
|
104
144
|
*/
|
|
105
145
|
export function useTurnMeasure(ref) {
|
|
146
|
+
// RULE 4. Whether the turn is in view right now. The scroll container clips
|
|
147
|
+
// the turn, so a root-less observer sees it leave. Starts as "in view": a
|
|
148
|
+
// turn is never contained before the observer has reported once.
|
|
149
|
+
const [inView, setInView] = useState(true);
|
|
150
|
+
const [containedOffscreen, setContainedOffscreen] = useState(false);
|
|
151
|
+
useEffect(() => {
|
|
152
|
+
const el = ref.current;
|
|
153
|
+
// Held: `content-visibility: auto` tracks relevance now; stop observing.
|
|
154
|
+
if (!el || containedOffscreen || typeof IntersectionObserver === 'undefined')
|
|
155
|
+
return;
|
|
156
|
+
const io = new IntersectionObserver((entries) => {
|
|
157
|
+
const entry = entries[entries.length - 1];
|
|
158
|
+
if (entry)
|
|
159
|
+
setInView(entry.isIntersecting);
|
|
160
|
+
});
|
|
161
|
+
io.observe(el);
|
|
162
|
+
return () => io.disconnect();
|
|
163
|
+
}, [ref, containedOffscreen]);
|
|
106
164
|
const [measure, setMeasure] = useState({
|
|
107
165
|
state: 'unmeasured',
|
|
108
166
|
height: 0,
|
|
@@ -151,7 +209,29 @@ export function useTurnMeasure(ref) {
|
|
|
151
209
|
ro?.disconnect();
|
|
152
210
|
};
|
|
153
211
|
}, [ref]);
|
|
154
|
-
|
|
212
|
+
// The hold (`nextContainHold`). Dropping it needs no layout read: a guarded
|
|
213
|
+
// render-phase update, so the class goes in the commit that loses the
|
|
214
|
+
// stand-in. Granting reads layout, so it is a layout effect: the geometry
|
|
215
|
+
// check and the class land in the same frame.
|
|
216
|
+
const hasStandIn = turnIntrinsicSize(measure.state, measure.height, true) !== undefined;
|
|
217
|
+
if (!hasStandIn && containedOffscreen)
|
|
218
|
+
setContainedOffscreen(false);
|
|
219
|
+
useLayoutEffect(() => {
|
|
220
|
+
const el = ref.current;
|
|
221
|
+
if (!el || containedOffscreen || !hasStandIn || inView)
|
|
222
|
+
return;
|
|
223
|
+
const box = el.getBoundingClientRect();
|
|
224
|
+
const grant = nextContainHold({
|
|
225
|
+
held: false,
|
|
226
|
+
hasStandIn,
|
|
227
|
+
outOfView: turnOutOfView(box, visibleBand(el)),
|
|
228
|
+
// Still settling: the publish re-runs this with the height it settles at.
|
|
229
|
+
heightSettled: box.height === measure.height,
|
|
230
|
+
});
|
|
231
|
+
if (grant)
|
|
232
|
+
setContainedOffscreen(true);
|
|
233
|
+
}, [ref, measure.height, hasStandIn, inView, containedOffscreen]);
|
|
234
|
+
return { ...measure, containedOffscreen };
|
|
155
235
|
}
|
|
156
236
|
/**
|
|
157
237
|
* One turn's wrapper: the scroll anchor (`data-turn-id`) plus the containment
|
|
@@ -159,7 +239,7 @@ export function useTurnMeasure(ref) {
|
|
|
159
239
|
*/
|
|
160
240
|
export function TurnViewport({ turnId, className, continues, children, }) {
|
|
161
241
|
const ref = useRef(null);
|
|
162
|
-
const { state, height } = useTurnMeasure(ref);
|
|
163
|
-
const containIntrinsicSize = turnIntrinsicSize(state, height);
|
|
164
|
-
return (_jsx("div", { ref: ref, "data-turn-id": turnId, "data-turn-continues": continues || undefined, className: turnViewportClassName(state, className, height), style: containIntrinsicSize ? { containIntrinsicSize } : undefined, children: children }));
|
|
242
|
+
const { state, height, containedOffscreen } = useTurnMeasure(ref);
|
|
243
|
+
const containIntrinsicSize = turnIntrinsicSize(state, height, containedOffscreen);
|
|
244
|
+
return (_jsx("div", { ref: ref, "data-turn-id": turnId, "data-turn-continues": continues || undefined, className: turnViewportClassName(state, className, height, containedOffscreen), style: containIntrinsicSize ? { containIntrinsicSize } : undefined, children: children }));
|
|
165
245
|
}
|
|
@@ -9,7 +9,9 @@ export declare const WorkFoldContext: import("react").Context<boolean>;
|
|
|
9
9
|
* the reader touched while it worked settles with its row open.
|
|
10
10
|
*/
|
|
11
11
|
export declare const WorkTouchContext: import("react").Context<(() => void) | null>;
|
|
12
|
-
export declare function TurnWorkAccordion({ durationMs, open, onToggle, contentId, }: {
|
|
12
|
+
export declare function TurnWorkAccordion({ label, durationMs, open, onToggle, contentId, }: {
|
|
13
|
+
/** The row's words in place of "Worked for …": an agent run's (`sessionLogAgentRunLabel`). */
|
|
14
|
+
label?: string;
|
|
13
15
|
/** `sessionTurnDurationMs(turn)`; `null` reads "Worked". */
|
|
14
16
|
durationMs: number | null;
|
|
15
17
|
open: boolean;
|
|
@@ -27,6 +27,6 @@ export const WorkFoldContext = createContext(false);
|
|
|
27
27
|
* the reader touched while it worked settles with its row open.
|
|
28
28
|
*/
|
|
29
29
|
export const WorkTouchContext = createContext(null);
|
|
30
|
-
export function TurnWorkAccordion({ durationMs, open, onToggle, contentId, }) {
|
|
31
|
-
return (_jsx("div", { className: cn('flex items-center', open && 'border-border/60 border-b pb-2'), children: _jsxs("button", { type: "button", "aria-expanded": open, "aria-controls": open ? contentId : undefined, onClick: onToggle, className: cn('group/work text-muted-foreground/70 hover:text-muted-foreground flex min-w-0 cursor-pointer items-center gap-2', 'focus-visible:ring-ring/50 rounded-sm text-left text-sm transition-colors select-none focus-visible:ring-2 focus-visible:outline-none'), children: [_jsx("span", { className: "min-w-0 truncate tabular-nums", children: workedForLabel(durationMs) }), _jsx(CaretRightIcon, { "aria-hidden": true, className: cn('text-muted-foreground/40 group-hover/work:text-muted-foreground/70 size-3.5 flex-none transition-[transform,color]', open && 'rotate-90') })] }) }));
|
|
30
|
+
export function TurnWorkAccordion({ label, durationMs, open, onToggle, contentId, }) {
|
|
31
|
+
return (_jsx("div", { className: cn('flex items-center', open && 'border-border/60 border-b pb-2'), children: _jsxs("button", { type: "button", "aria-expanded": open, "aria-controls": open ? contentId : undefined, onClick: onToggle, className: cn('group/work text-muted-foreground/70 hover:text-muted-foreground flex min-w-0 cursor-pointer items-center gap-2', 'focus-visible:ring-ring/50 rounded-sm text-left text-sm transition-colors select-none focus-visible:ring-2 focus-visible:outline-none'), children: [_jsx("span", { className: "min-w-0 truncate tabular-nums", children: label ?? workedForLabel(durationMs) }), _jsx(CaretRightIcon, { "aria-hidden": true, className: cn('text-muted-foreground/40 group-hover/work:text-muted-foreground/70 size-3.5 flex-none transition-[transform,color]', open && 'rotate-90') })] }) }));
|
|
32
32
|
}
|
|
@@ -3,7 +3,8 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import { attachmentMime } from '../../internal/lib/attachment-mime.js';
|
|
4
4
|
import { AttachmentPreview } from './attachment-preview.js';
|
|
5
5
|
import { getFileCategory } from '../../files/viewer/preview-policy.js';
|
|
6
|
-
import {
|
|
6
|
+
import { triggerHref } from '../../internal/lib/capability-tab-routes.js';
|
|
7
|
+
import { useTriggersPageOpen } from '../../internal/layout/project-settings-nav.js';
|
|
7
8
|
import { MessageSenderAbove } from '../participants/session-participants.js';
|
|
8
9
|
import { MessageAuthorLabel } from './message-author-label.js';
|
|
9
10
|
import { MESSAGE_TEXT_CLASS, RowToolbar } from './message-row.js';
|
|
@@ -127,8 +128,8 @@ function PlatformPromptMessage({ pill, text, actions, ...data }) {
|
|
|
127
128
|
}
|
|
128
129
|
/**
|
|
129
130
|
* A loop fire (`[REMINDER reminder.<id> …]`, the wire name). The pill says
|
|
130
|
-
* Loop and whether it repeats; its card carries the id and a link to
|
|
131
|
-
*
|
|
131
|
+
* Loop and whether it repeats; its card carries the id and a Manage link to
|
|
132
|
+
* the loop's own row on the Triggers page (`?id=<reminder id>`).
|
|
132
133
|
*/
|
|
133
134
|
/**
|
|
134
135
|
* A voice call's turn the voice answered itself (voice-turn.ts): the caller's words as their own bubble under a Call
|
|
@@ -141,8 +142,9 @@ function VoiceTurnMessage({ info, actions }) {
|
|
|
141
142
|
function ReminderMessage({ info, actions }) {
|
|
142
143
|
const t = useTranslations('reminders');
|
|
143
144
|
const ids = useSessionIds();
|
|
144
|
-
|
|
145
|
-
const
|
|
145
|
+
// The loop's own row on the Triggers page, shown only to a caller that page lets in.
|
|
146
|
+
const canOpenTriggers = useTriggersPageOpen(ids.projectId ?? undefined);
|
|
147
|
+
const manageHref = ids.projectId && canOpenTriggers ? triggerHref(ids.projectId, info.id) : null;
|
|
146
148
|
return (_jsx(PlatformPromptMessage, { "data-testid": "reminder-turn", "data-reminder-id": info.id, text: info.prompt, actions: actions, pill: _jsx(SourcePill, { mark: _jsx(AlarmIcon, { className: "size-3 shrink-0", "aria-hidden": true }), source: t('cardLabel'), sender: info.recurring ? t('cardRecurring') : t('cardOneTime'), card: _jsx(SourceCard, { mark: _jsx(AlarmIcon, { className: "size-3.5 shrink-0", "aria-hidden": true }), title: t('cardLabel'), footer: _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("span", { className: "text-muted-foreground truncate font-mono", children: info.id }), manageHref && (_jsx(HoverPrefetchLink, { href: manageHref, className: "text-foreground shrink-0 font-medium underline-offset-2 hover:underline", children: t('cardManage') }))] }) }) }) }));
|
|
147
149
|
}
|
|
148
150
|
/** A trigger fire (`<trigger_event>{…}</trigger_event>`): the trigger's name in the pill, the prompt in the bubble. */
|