@kortix/ui 0.16.4 → 0.16.5

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.
Files changed (100) hide show
  1. package/dist/customize/sections/view/review-center-connected.js +64 -71
  2. package/dist/customize/sections/view/secret-delivery.d.ts +11 -20
  3. package/dist/customize/sections/view/secret-delivery.js +20 -29
  4. package/dist/customize/sections/view/secrets-view.js +9 -24
  5. package/dist/i18n/en.d.ts +116 -13
  6. package/dist/i18n/en.js +127 -24
  7. package/dist/i18n/ui-catalog/product-catalog-translation-keys.generated.js +2 -0
  8. package/dist/internal/auth/auth-card-shell.d.ts +24 -3
  9. package/dist/internal/auth/auth-card-shell.js +15 -8
  10. package/dist/internal/auth/auth-primitives.d.ts +15 -2
  11. package/dist/internal/auth/auth-primitives.js +22 -5
  12. package/dist/internal/components/agent-mark.d.ts +2 -1
  13. package/dist/internal/components/agent-mark.js +14 -3
  14. package/dist/internal/hooks/use-review-session-summary.d.ts +1 -1
  15. package/dist/internal/hooks/use-review-session-summary.js +1 -1
  16. package/dist/internal/layout/project-nav-row.d.ts +3 -1
  17. package/dist/internal/layout/project-nav-row.js +2 -2
  18. package/dist/markdown/setup-links/secret-intake-form.d.ts +4 -1
  19. package/dist/markdown/setup-links/secret-intake-form.js +60 -16
  20. package/dist/markdown/setup-links/setup-link-button.js +6 -1
  21. package/dist/session/agents/agent-hover-card.d.ts +26 -0
  22. package/dist/session/agents/agent-hover-card.js +70 -0
  23. package/dist/session/agents/agent-strip.js +33 -7
  24. package/dist/session/agents/agent-surface.d.ts +26 -1
  25. package/dist/session/agents/agent-surface.js +57 -6
  26. package/dist/session/agents/held-messages.js +2 -2
  27. package/dist/session/agents/subagent-dialog-content.js +2 -2
  28. package/dist/session/composer/ComposerCard.js +4 -1
  29. package/dist/session/composer/composer-toolbar.d.ts +8 -1
  30. package/dist/session/composer/composer-toolbar.js +2 -2
  31. package/dist/session/composer/dictation/dictation-control.d.ts +10 -0
  32. package/dist/session/composer/dictation/dictation-control.js +28 -0
  33. package/dist/session/composer/dictation/dictation-state.d.ts +26 -0
  34. package/dist/session/composer/dictation/dictation-state.js +71 -0
  35. package/dist/session/composer/dictation/recorder.d.ts +30 -0
  36. package/dist/session/composer/dictation/recorder.js +129 -0
  37. package/dist/session/composer/dictation/use-composer-dictation.d.ts +25 -0
  38. package/dist/session/composer/dictation/use-composer-dictation.js +218 -0
  39. package/dist/session/composer/queued-prompt-list.js +5 -1
  40. package/dist/session/panel/easy/apps-card.js +3 -10
  41. package/dist/session/panel/easy/background-tasks-card.d.ts +23 -0
  42. package/dist/session/panel/easy/background-tasks-card.js +119 -0
  43. package/dist/session/panel/easy/change-requests-card.js +1 -1
  44. package/dist/session/panel/easy/changes-card.js +4 -6
  45. package/dist/session/panel/easy/context-card.js +8 -9
  46. package/dist/session/panel/easy/context-meter.d.ts +2 -0
  47. package/dist/session/panel/easy/context-meter.js +18 -4
  48. package/dist/session/panel/easy/detail-view.js +4 -2
  49. package/dist/session/panel/easy/easy-panel-logic.d.ts +4 -15
  50. package/dist/session/panel/easy/easy-panel-logic.js +4 -17
  51. package/dist/session/panel/easy/easy-panel.js +5 -4
  52. package/dist/session/panel/easy/outputs-card.d.ts +1 -13
  53. package/dist/session/panel/easy/outputs-card.js +14 -40
  54. package/dist/session/panel/easy/panel-card.d.ts +13 -40
  55. package/dist/session/panel/easy/panel-card.js +17 -55
  56. package/dist/session/panel/easy/plan-card.js +4 -7
  57. package/dist/session/panel/model-switch-event.d.ts +2 -2
  58. package/dist/session/panel/model-switch-event.js +13 -9
  59. package/dist/session/panel/session-panel-provider.d.ts +2 -1
  60. package/dist/session/panel/session-panel-provider.js +3 -3
  61. package/dist/session/panel/shared/derive-panels.js +14 -1
  62. package/dist/session/panel/shared/use-panel-handoffs.d.ts +0 -1
  63. package/dist/session/panel/shared/use-panel-handoffs.js +3 -15
  64. package/dist/session/thread/chat-minimap.js +7 -1
  65. package/dist/session/thread/session-chat.js +59 -15
  66. package/dist/session/tool/shared/infrastructure-contexts.d.ts +2 -0
  67. package/dist/session/tool/shared/infrastructure-contexts.js +2 -0
  68. package/dist/session/tool/shared/infrastructure-row-header.js +4 -1
  69. package/dist/session/tool/shared/infrastructure-rows.js +19 -19
  70. package/dist/session/tool/tool-part-renderer.js +23 -9
  71. package/dist/session/tool/tools/bash-tool.js +3 -2
  72. package/dist/session/tool/tools/codemode-tool.d.ts +15 -0
  73. package/dist/session/tool/tools/codemode-tool.js +54 -2
  74. package/dist/session/tool/tools/kortix-action-tool.d.ts +1 -0
  75. package/dist/session/tool/tools/kortix-action-tool.js +19 -8
  76. package/dist/session/tool/tools/multi-agent-tool-bodies.d.ts +8 -1
  77. package/dist/session/tool/tools/multi-agent-tool-bodies.js +76 -10
  78. package/dist/session/tool/tools/task-tool.js +17 -5
  79. package/dist/session/turn/peer-message-row.d.ts +3 -0
  80. package/dist/session/turn/peer-message-row.js +8 -2
  81. package/dist/session/turn/subagent-notice-row.js +5 -3
  82. package/dist/styles.css +1 -1
  83. package/dist/test-utils/intl.d.ts +116 -13
  84. package/dist/workspace/projects/modal/project-icon-field.d.ts +3 -1
  85. package/dist/workspace/projects/modal/project-icon-field.js +3 -3
  86. package/dist/workspace/review/review-center.d.ts +9 -1
  87. package/dist/workspace/review/review-center.js +107 -14
  88. package/dist/workspace/review/review-detail.d.ts +19 -0
  89. package/dist/workspace/review/review-detail.js +18 -3
  90. package/dist/workspace/review/review-swipe-deck.d.ts +27 -0
  91. package/dist/workspace/review/review-swipe-deck.js +304 -0
  92. package/dist/workspace/review/review-swipe.d.ts +17 -0
  93. package/dist/workspace/review/review-swipe.js +10 -0
  94. package/dist/workspace/sidebar/footer/project-review-nav.d.ts +13 -0
  95. package/dist/workspace/sidebar/footer/project-review-nav.js +29 -0
  96. package/dist/workspace/sidebar/project-nav-items.d.ts +3 -1
  97. package/dist/workspace/sidebar/project-nav-items.js +24 -5
  98. package/dist/workspace/sidebar/project-spaces-nav.js +3 -10
  99. package/dist/workspace/sidebar/sidebar-more-group.js +1 -1
  100. package/package.json +3 -3
@@ -803,10 +803,6 @@ export declare const testUiTranslator: import("use-intl")._Translator<{
803
803
  permission: string;
804
804
  updateFailed: string;
805
805
  flags: {
806
- secrets_egress: {
807
- name: string;
808
- description: string;
809
- };
810
806
  reminders: {
811
807
  name: string;
812
808
  description: string;
@@ -823,10 +819,6 @@ export declare const testUiTranslator: import("use-intl")._Translator<{
823
819
  name: string;
824
820
  description: string;
825
821
  };
826
- workspace_volume: {
827
- name: string;
828
- description: string;
829
- };
830
822
  email_channel: {
831
823
  name: string;
832
824
  description: string;
@@ -839,10 +831,6 @@ export declare const testUiTranslator: import("use-intl")._Translator<{
839
831
  name: string;
840
832
  description: string;
841
833
  };
842
- chrome: {
843
- name: string;
844
- description: string;
845
- };
846
834
  agent_teams: {
847
835
  name: string;
848
836
  description: string;
@@ -883,6 +871,10 @@ export declare const testUiTranslator: import("use-intl")._Translator<{
883
871
  name: string;
884
872
  description: string;
885
873
  };
874
+ review_swipe: {
875
+ name: string;
876
+ description: string;
877
+ };
886
878
  };
887
879
  channelsSwitch: {
888
880
  onTitle: string;
@@ -1638,6 +1630,10 @@ export declare const testUiTranslator: import("use-intl")._Translator<{
1638
1630
  panel: {
1639
1631
  outputNew: string;
1640
1632
  outputUpdated: string;
1633
+ backgroundTasks: string;
1634
+ finished: string;
1635
+ finishedCount: string;
1636
+ running: string;
1641
1637
  resizePane: string;
1642
1638
  };
1643
1639
  };
@@ -1748,6 +1744,7 @@ export declare const testUiTranslator: import("use-intl")._Translator<{
1748
1744
  hintCompact: string;
1749
1745
  myKortixRoutes: string;
1750
1746
  chatInputReset: string;
1747
+ queuedDisconnected: string;
1751
1748
  };
1752
1749
  auth: {
1753
1750
  haveReferralCode: string;
@@ -1944,6 +1941,13 @@ export declare const testUiTranslator: import("use-intl")._Translator<{
1944
1941
  errorBody: string;
1945
1942
  signIn: string;
1946
1943
  };
1944
+ story: {
1945
+ label: string;
1946
+ outcome: string;
1947
+ repo: string;
1948
+ approve: string;
1949
+ worksWith: string;
1950
+ };
1947
1951
  };
1948
1952
  tools: {
1949
1953
  executeCommand: string;
@@ -2179,6 +2183,17 @@ export declare const testUiTranslator: import("use-intl")._Translator<{
2179
2183
  failed: string;
2180
2184
  stopped: string;
2181
2185
  };
2186
+ card: {
2187
+ session: string;
2188
+ copyId: string;
2189
+ openNewTab: string;
2190
+ model: string;
2191
+ runsAs: string;
2192
+ inline: string;
2193
+ };
2194
+ notStarted: string;
2195
+ notStartedSentence: string;
2196
+ policyBlocked: string;
2182
2197
  };
2183
2198
  };
2184
2199
  agentScope: {
@@ -2789,6 +2804,7 @@ export declare const testUiTranslator: import("use-intl")._Translator<{
2789
2804
  noModelAddProviderKey: string;
2790
2805
  noModelUpgradePlan: string;
2791
2806
  text03217276a5f1: string;
2807
+ text041fb4e77d8e: string;
2792
2808
  text0b6a47661327: string;
2793
2809
  text1a9030082a20: string;
2794
2810
  text38e64d6a8162: string;
@@ -2909,6 +2925,7 @@ export declare const testUiTranslator: import("use-intl")._Translator<{
2909
2925
  text0af465ef42c0: string;
2910
2926
  text0b1bdec38bf0: string;
2911
2927
  text0b348466332c: string;
2928
+ text93d50ea93ca0: string;
2912
2929
  textf83916135509: string;
2913
2930
  texta251c18205f1: string;
2914
2931
  text64cd989efc14: string;
@@ -5547,7 +5564,6 @@ export declare const testUiTranslator: import("use-intl")._Translator<{
5547
5564
  texte595f45dc6c9: string;
5548
5565
  texte5974d3936df: string;
5549
5566
  texte5985e84210e: string;
5550
- texte5a718af362a: string;
5551
5567
  texte5c253036018: string;
5552
5568
  texte5dbdffb8816: string;
5553
5569
  texte5ee1e7e84aa: string;
@@ -6441,6 +6457,16 @@ export declare const testUiTranslator: import("use-intl")._Translator<{
6441
6457
  grant: string;
6442
6458
  allowlist: string;
6443
6459
  };
6460
+ secretIntakeLogin: {
6461
+ delivery: string;
6462
+ username: string;
6463
+ password: string;
6464
+ missing: string;
6465
+ savedTitle: string;
6466
+ savedDescription: string;
6467
+ modalTitle: string;
6468
+ modalDescription: string;
6469
+ };
6444
6470
  sessionEmbed: {
6445
6471
  sectionTitle: string;
6446
6472
  sectionDescription: string;
@@ -6484,6 +6510,37 @@ export declare const testUiTranslator: import("use-intl")._Translator<{
6484
6510
  emptyTitle: string;
6485
6511
  emptyDescription: string;
6486
6512
  };
6513
+ reviewDeck: {
6514
+ label: string;
6515
+ remaining: string;
6516
+ merge: string;
6517
+ close: string;
6518
+ approve: string;
6519
+ deny: string;
6520
+ dismiss: string;
6521
+ yes: string;
6522
+ no: string;
6523
+ skip: string;
6524
+ open: string;
6525
+ undo: string;
6526
+ staged: string;
6527
+ needsChoice: string;
6528
+ noVerdict: string;
6529
+ emptyTitle: string;
6530
+ emptyDescription: string;
6531
+ highRisk: string;
6532
+ files: string;
6533
+ conflicts: string;
6534
+ items: string;
6535
+ showCards: string;
6536
+ showList: string;
6537
+ sendBack: string;
6538
+ whatShouldChange: string;
6539
+ sendToAgent: string;
6540
+ cancel: string;
6541
+ reviews: string;
6542
+ questions: string;
6543
+ };
6487
6544
  };
6488
6545
  commandPalette: {
6489
6546
  title: string;
@@ -8495,6 +8552,32 @@ export declare const testUiTranslator: import("use-intl")._Translator<{
8495
8552
  };
8496
8553
  };
8497
8554
  artifacts: {
8555
+ folderIcon: string;
8556
+ docCreateFailed: string;
8557
+ newFolder: string;
8558
+ editFolder: string;
8559
+ folderName: string;
8560
+ folderCreateIn: string;
8561
+ folderSaved: string;
8562
+ folderCreated: string;
8563
+ folderSaveFailed: string;
8564
+ saveFolder: string;
8565
+ createFolder: string;
8566
+ folderActions: string;
8567
+ deleteFolder: string;
8568
+ deleteFolderTitle: string;
8569
+ deleteFolderHint: string;
8570
+ folderDeleted: string;
8571
+ folderDeleteFailed: string;
8572
+ folderNavigation: string;
8573
+ folderPathMore: string;
8574
+ folderUnavailable: string;
8575
+ folderLoadFailed: string;
8576
+ moveToFolder: string;
8577
+ movedToFolder: string;
8578
+ emptyUnfiled: string;
8579
+ emptyFolder: string;
8580
+ folderRoot: string;
8498
8581
  title: string;
8499
8582
  type: {
8500
8583
  doc: string;
@@ -9592,6 +9675,25 @@ export declare const testUiTranslator: import("use-intl")._Translator<{
9592
9675
  turnNote: string;
9593
9676
  close: string;
9594
9677
  };
9678
+ dictation: {
9679
+ start: string;
9680
+ price: string;
9681
+ recording: string;
9682
+ discard: string;
9683
+ finish: string;
9684
+ transcribing: string;
9685
+ nothingHeard: string;
9686
+ retry: string;
9687
+ failed: string;
9688
+ busy: string;
9689
+ unavailable: string;
9690
+ limitReached: string;
9691
+ micDenied: string;
9692
+ micDeniedDesktop: string;
9693
+ micMissing: string;
9694
+ micBusy: string;
9695
+ micUnsupported: string;
9696
+ };
9595
9697
  agentCapabilities: {
9596
9698
  skillsTitle: string;
9597
9699
  skillsDescription: string;
@@ -9777,6 +9879,7 @@ export declare const testUiTranslator: import("use-intl")._Translator<{
9777
9879
  };
9778
9880
  workingFor: string;
9779
9881
  runsAs: string;
9882
+ stateCount: string;
9780
9883
  teamRole: string;
9781
9884
  attention: {
9782
9885
  question: string;
@@ -19,13 +19,15 @@ export type ProjectIconValue = {
19
19
  * popover. Controlled: the host owns the icon so it can send it with its
20
20
  * payload (create) or diff it against the stored project (edit), and reset
21
21
  * it on close/cancel. */
22
- export declare function ProjectIconField({ value, onChange, onGlyphChange, onClear, disabled, triggerClassName, fallbackLabel, align, }: {
22
+ export declare function ProjectIconField({ value, onChange, onGlyphChange, onClear, disabled, triggerClassName, ariaLabel, fallbackLabel, align, }: {
23
23
  /**
24
24
  * Sizing override for the trigger. `/workspaces/new` renders this as the page's own
25
25
  * `size-12` subject above the name field; everywhere else it sits inline
26
26
  * beside a `size="sm"` input and keeps the `size-9` default that matches it.
27
27
  */
28
28
  triggerClassName?: string;
29
+ /** Accessible name when this picker edits an entity other than a workspace. */
30
+ ariaLabel?: string;
29
31
  /**
30
32
  * What the unset face shows instead of the generic smiley: the workspace's
31
33
  * own initial, through `EntityAvatar`, chalk colour and all — the same tile
@@ -59,7 +59,7 @@ function resolveGlyphFace(glyph) {
59
59
  * popover. Controlled: the host owns the icon so it can send it with its
60
60
  * payload (create) or diff it against the stored project (edit), and reset
61
61
  * it on close/cancel. */
62
- export function ProjectIconField({ value, onChange, onGlyphChange, onClear, disabled, triggerClassName, fallbackLabel, align = 'start', }) {
62
+ export function ProjectIconField({ value, onChange, onGlyphChange, onClear, disabled, triggerClassName, ariaLabel, fallbackLabel, align = 'start', }) {
63
63
  const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
64
64
  const [open, setOpen] = useState(false);
65
65
  const reduceMotion = useReducedMotion();
@@ -130,11 +130,11 @@ export function ProjectIconField({ value, onChange, onGlyphChange, onClear, disa
130
130
  variant: "outline", size: "icon",
131
131
  // Never conditioned on `value`. The whole point of the control is
132
132
  // that it stays live after a pick, so you reopen it and switch.
133
- disabled: disabled, "aria-label": emoji
133
+ disabled: disabled, "aria-label": ariaLabel ?? (emoji
134
134
  ? tI18nComplete('text13447731697e', { value0: emoji })
135
135
  : glyphFace
136
136
  ? tI18nComplete('text13447731697e', { value0: glyphFace.name })
137
- : tI18nComplete.raw('text39a1c11af6d3'),
137
+ : tI18nComplete.raw('text39a1c11af6d3')),
138
138
  // size-9 matches the sibling name Input (`size="sm"` => h-9), which is
139
139
  // what the field has to line up with. That is 33.11px, under the 40px
140
140
  // a pointer target wants, so hit-area-1 pads the target out to 40.47
@@ -2,7 +2,15 @@ import type { SessionAsk, ReviewVerdict } from '@kortix/sdk';
2
2
  import { type ReactNode } from 'react';
3
3
  import { type BulkResult } from './review-actions.js';
4
4
  import { type ReviewItem, type ReviewSegment } from './types.js';
5
- export declare function ReviewCenter({ initialItems, segment: segmentProp, onSegmentChange, loadMore, onAct, onBulkAct, onOpenSession, onRecoverChange, recoveringCrId, onRefresh, isLoading, isFetching, isFetched, isError, sessionLabels, verdictAllowed, needsYouDeck, sessionAsks, onSelectAsk, selectedAskId, }?: {
5
+ export type ReviewView = 'list' | 'cards';
6
+ export declare function ReviewCenter({ initialItems, segment: segmentProp, onSegmentChange, loadMore, onAct, onBulkAct, onOpenSession, onRecoverChange, recoveringCrId, onRefresh, isLoading, isFetching, isFetched, isError, sessionLabels, verdictAllowed, needsYouDeck, sessionAsks, onSelectAsk, selectedAskId, defaultView, deckEnabled, }?: {
7
+ /** The `review_swipe` flag: Needs you may show as the swipe deck. Off, it is the list. */
8
+ deckEnabled?: boolean;
9
+ /**
10
+ * How Needs you opens: the list, or the swipe deck (one card at a time).
11
+ * The viewer's own choice, once made, is kept in this browser.
12
+ */
13
+ defaultView?: ReviewView;
6
14
  /**
7
15
  * The asks deck (questions and approvals agents wait on): in the empty
8
16
  * detail pane, or above the list on a narrow inbox. It stays mounted while
@@ -36,7 +36,7 @@ import { cn } from '../../internal/lib/utils.js';
36
36
  import { hasOpenFloatingLayer } from '../../lib/z-stack.js';
37
37
  import { SelectionBar } from '../../internal/selection/selection-bar.js';
38
38
  import { selectRange, toggleId } from '../../internal/selection/selection.js';
39
- import { ChatsIcon as Chats, CheckCircleIcon as CheckCircleSolid, CheckSquareIcon, ClockCountdownIcon as ClockCountdown, DotsThreeIcon as DotsThree, FunnelSimpleIcon as FunnelSimple, MagnifyingGlassIcon as Search, ShapesIcon as Shapes, ShieldCheckIcon as ShieldCheck, TrayIcon as Tray, WarningIcon, XIcon as X, } from '@phosphor-icons/react';
39
+ import { CardsIcon as Cards, ChatsIcon as Chats, CheckCircleIcon as CheckCircleSolid, CheckSquareIcon, ClockCountdownIcon as ClockCountdown, DotsThreeIcon as DotsThree, FunnelSimpleIcon as FunnelSimple, MagnifyingGlassIcon as Search, ShapesIcon as Shapes, ShieldCheckIcon as ShieldCheck, TrayIcon as Tray, RowsIcon as Rows, WarningIcon, XIcon as X, } from '@phosphor-icons/react';
40
40
  import { useUiPathname, useUiRouter, useUiSearchParams } from '../../providers/ui-provider.js';
41
41
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
42
42
  import { statusToVerdict } from './map.js';
@@ -47,6 +47,7 @@ import { approvalIdentity } from '../../markdown/setup-links/approval-decision.j
47
47
  import { ConnectorAppMark } from '../../markdown/setup-links/connector-handshake.js';
48
48
  import { ApprovalDecisionPane, reviewApprovalAsker, reviewApprovalDenyOnly, reviewApprovalDetails, } from './approval-modal.js';
49
49
  import { ClosePaneButton, ReviewDetail } from './review-detail.js';
50
+ import { ReviewSwipeDeck } from './review-swipe-deck.js';
50
51
  import { ROW_MERGED_GLYPH, ROW_STATUS_GLYPH, ROW_TILE, ROW_TILE_NEUTRAL, reviewKindLabel, reviewStatusLabel, } from './review-meta.js';
51
52
  import { bulkSetStatus, decideApprovalAction, filterItems, groupBySession, isPromiseLike, REVIEW_VERDICT_ANNOUNCED, sessionOptions, setStatus, } from './review-reducer.js';
52
53
  import { segmentForStatus, } from './types.js';
@@ -228,10 +229,39 @@ function useContainerWide(ref, min) {
228
229
  }, [ref, min]);
229
230
  return wide;
230
231
  }
231
- export function ReviewCenter({ initialItems, segment: segmentProp, onSegmentChange, loadMore, onAct, onBulkAct, onOpenSession, onRecoverChange, recoveringCrId, onRefresh, isLoading, isFetching, isFetched, isError, sessionLabels, verdictAllowed = EVERY_VERDICT, needsYouDeck, sessionAsks = [], onSelectAsk, selectedAskId, } = {}) {
232
+ const REVIEW_VIEW_KEY = 'kortix.review.view';
233
+ /** The Needs you view, kept per browser. Storage may be absent or throw. */
234
+ function useReviewView(fallback) {
235
+ // The viewer's own choice, else the default (which can change once the
236
+ // project's flags load).
237
+ const [choice, setChoice] = useState(null);
238
+ useEffect(() => {
239
+ try {
240
+ const saved = window.localStorage.getItem(REVIEW_VIEW_KEY);
241
+ if (saved === 'list' || saved === 'cards')
242
+ setChoice(saved);
243
+ }
244
+ catch {
245
+ // No storage: the fallback stands.
246
+ }
247
+ }, []);
248
+ const view = choice ?? fallback;
249
+ const choose = useCallback((next) => {
250
+ setChoice(next);
251
+ try {
252
+ window.localStorage.setItem(REVIEW_VIEW_KEY, next);
253
+ }
254
+ catch {
255
+ // No storage: the choice lasts this visit.
256
+ }
257
+ }, []);
258
+ return [view, choose];
259
+ }
260
+ export function ReviewCenter({ initialItems, segment: segmentProp, onSegmentChange, loadMore, onAct, onBulkAct, onOpenSession, onRecoverChange, recoveringCrId, onRefresh, isLoading, isFetching, isFetched, isError, sessionLabels, verdictAllowed = EVERY_VERDICT, needsYouDeck, sessionAsks = [], onSelectAsk, selectedAskId, defaultView = 'list', deckEnabled = false, } = {}) {
232
261
  const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
233
262
  const tBulk = useTranslations('hardcodedUi.reviewBulk');
234
263
  const tSidebar = useTranslations('sidebar');
264
+ const tDeck = useTranslations('hardcodedUi.reviewDeck');
235
265
  const segments = useMemo(() => localizeUiCatalog(SEGMENTS, tI18nComplete, PRODUCT_CATALOG_TRANSLATION_KEYS), [tI18nComplete]);
236
266
  const kindFilters = useMemo(() => localizeUiCatalog(KIND_FILTERS, tI18nComplete, PRODUCT_CATALOG_TRANSLATION_KEYS), [tI18nComplete]);
237
267
  const localizedMockItems = useMemo(() => getLocalizedMockItems(tI18nComplete), [tI18nComplete]);
@@ -252,6 +282,10 @@ export function ReviewCenter({ initialItems, segment: segmentProp, onSegmentChan
252
282
  // a session's reviews + approvals sit together. Both operate on `sessionId`.
253
283
  const [sessionFilter, setSessionFilter] = useState('all');
254
284
  const [grouped, setGrouped] = useState(false);
285
+ const [view, setView] = useReviewView(defaultView);
286
+ // The deck shows Needs you only: Waiting and Done hold nothing to decide.
287
+ const cards = deckEnabled && view === 'cards' && segment === 'needs_you';
288
+ const [deckTabChoice, setDeckTab] = useState(null);
255
289
  // The open review lives in the URL (`?id=<review item id>`), not in state,
256
290
  // so a refresh or a shared link lands on the same page.
257
291
  const search = useUiSearchParams();
@@ -280,6 +314,10 @@ export function ReviewCenter({ initialItems, segment: segmentProp, onSegmentChan
280
314
  // not clear the spinner, so the row cannot flicker back to "needs you" and a
281
315
  // second verdict cannot go out.
282
316
  const [inFlight, setInFlight] = useState(null);
317
+ // Every verdict still waiting for the server, by item: the swipe deck sends
318
+ // one per Undo window, so several can overlap. A refetch keeps each one's
319
+ // optimistic status until its own request settles.
320
+ const pendingStatusesRef = useRef(new Map());
283
321
  const undoRef = useRef(null);
284
322
  // Query root for scroll-into-view — a container of the [data-idx] rows. It wraps
285
323
  // either the flat <ul> or the grouped <div>, so it's typed to the common base.
@@ -311,6 +349,17 @@ export function ReviewCenter({ initialItems, segment: segmentProp, onSegmentChan
311
349
  }, [idParam, pathname, router, search]);
312
350
  const labelFor = useMemo(() => (id) => sessionLabels?.[id], [sessionLabels]);
313
351
  const visible = useMemo(() => filterItems(items, segment, kindFilter, query, sessionFilter), [items, segment, kindFilter, query, sessionFilter]);
352
+ // Reviews first; questions when no review waits, until the viewer picks.
353
+ // With no questions there is no switch: the deck is the reviews.
354
+ const deckTab = sessionAsks.length === 0
355
+ ? 'reviews'
356
+ : (deckTabChoice ?? (visible.length === 0 ? 'questions' : 'reviews'));
357
+ // The deck shows one card at a time: as it runs low, read the next page.
358
+ const loadNext = loadMore && !loadMore.isLoading && !loadMore.isError ? loadMore.onLoadMore : null;
359
+ useEffect(() => {
360
+ if (cards && loadNext && visible.length < 3)
361
+ loadNext();
362
+ }, [cards, loadNext, visible.length]);
314
363
  /** After a verdict the item leaves its list: open the row that took its
315
364
  * place (the next one, else the one above).
316
365
  * Reads the list as it was before the verdict. */
@@ -445,7 +494,10 @@ export function ReviewCenter({ initialItems, segment: segmentProp, onSegmentChan
445
494
  if (initialItems !== initialItemsSeen) {
446
495
  setInitialItemsSeen(initialItems);
447
496
  if (initialItems) {
448
- setItems(inFlight ? setStatus(initialItems, inFlight.id, inFlight.status) : initialItems);
497
+ let next = inFlight ? setStatus(initialItems, inFlight.id, inFlight.status) : initialItems;
498
+ for (const [id, status] of pendingStatusesRef.current)
499
+ next = setStatus(next, id, status);
500
+ setItems(next);
449
501
  }
450
502
  if (!inFlight) {
451
503
  setPendingId(null);
@@ -505,7 +557,12 @@ export function ReviewCenter({ initialItems, segment: segmentProp, onSegmentChan
505
557
  return;
506
558
  }
507
559
  const before = items;
508
- setItems(next);
560
+ // Functional when it is one item's status: verdicts flushed in the same
561
+ // tick (the deck's unmount) must not overwrite each other's update.
562
+ if (optimistic)
563
+ setItems((current) => setStatus(current, optimistic.id, optimistic.status));
564
+ else
565
+ setItems(next);
509
566
  const result = server?.();
510
567
  const announce = () => (tone === 'info' ? infoToast : successToast)(message);
511
568
  if (!isPromiseLike(result)) {
@@ -514,16 +571,27 @@ export function ReviewCenter({ initialItems, segment: segmentProp, onSegmentChan
514
571
  }
515
572
  // Wait for the server: no "done" toast before it answers, and a refused
516
573
  // verdict puts the item back where it was.
517
- if (optimistic)
574
+ if (optimistic) {
518
575
  setInFlight(optimistic);
576
+ pendingStatusesRef.current.set(optimistic.id, optimistic.status);
577
+ }
519
578
  void Promise.resolve(result)
520
579
  .then((value) => {
521
580
  if (value !== REVIEW_VERDICT_ANNOUNCED)
522
581
  announce();
523
- }, () => setItems(before))
582
+ },
583
+ // A refused verdict puts back only its own item: other verdicts
584
+ // in flight (the deck sends one per Undo window) keep theirs.
585
+ () => setItems((current) => {
586
+ if (!optimistic)
587
+ return before;
588
+ const prior = before.find((i) => i.id === optimistic.id);
589
+ return prior ? current.map((i) => (i.id === prior.id ? prior : i)) : current;
590
+ }))
524
591
  .finally(() => {
525
592
  if (!optimistic)
526
593
  return;
594
+ pendingStatusesRef.current.delete(optimistic.id);
527
595
  setInFlight(null);
528
596
  setPendingId(null);
529
597
  setPendingDecision(null);
@@ -724,6 +792,10 @@ export function ReviewCenter({ initialItems, segment: segmentProp, onSegmentChan
724
792
  dismissIds([openItem.id]);
725
793
  return;
726
794
  }
795
+ // The deck owns its keys; the hidden list's cursor must not decide
796
+ // an item the deck does not show.
797
+ if (cards)
798
+ return;
727
799
  if (visible.length === 0)
728
800
  return;
729
801
  // j/k/x move from the open item's row when one is open, else from the
@@ -920,6 +992,16 @@ export function ReviewCenter({ initialItems, segment: segmentProp, onSegmentChan
920
992
  : segment === 'waiting'
921
993
  ? tI18nComplete.raw('text2c192433a710')
922
994
  : tI18nComplete.raw('text6a00736dae3c') })) : grouped ? (_jsx("div", { ...listProps, className: "space-y-4", children: groups.map((g) => (_jsxs("section", { className: "space-y-1", children: [_jsxs("div", { className: "flex h-7 items-center gap-2 px-2.5", children: [_jsx("h2", { className: "text-muted-foreground truncate text-xs font-medium", children: g.label }), _jsx(CountBadge, { count: g.items.length }), g.sessionId && onOpenSession && (_jsx("button", { type: "button", className: "text-muted-foreground hover:text-foreground duration-fast ml-auto shrink-0 text-xs transition-colors", onClick: () => onOpenSession(g.sessionId), children: tI18nComplete.raw('textb205bb47f81a') }))] }), _jsx("ul", { ...listboxProps, className: LIST_CLASS, children: g.items.map((item) => renderRow(item, visibleIndexById.get(item.id) ?? 0, true)) })] }, g.sessionId ?? '__none__'))) })) : (_jsx("ul", { ...listProps, ...listboxProps, className: LIST_CLASS, children: visible.map((item, idx) => renderRow(item, idx, false)) }));
995
+ const deckBody = (isError || isLoading) && items.length === 0 ? (listBody) : visible.length === 0 && loadMore ? (
996
+ // Nothing on the pages read so far, and more pages exist: never
997
+ // "caught up" (KRTX-1727).
998
+ _jsx("div", { className: "pt-6", children: loadMoreButton })) : (_jsx(ReviewSwipeDeck, { items: visible, allows: verdictAllowed, paused: !!selected || deckTab !== 'reviews', onOpen: (item) => setSelectedId(item.id), onDecide: (item, verdict, feedback) => actions.resolve(item.id, verdict === 'approve'
999
+ ? 'approved'
1000
+ : verdict === 'reject'
1001
+ ? 'rejected'
1002
+ : verdict === 'changes'
1003
+ ? 'changes_requested'
1004
+ : 'dismissed', undefined, feedback) }));
923
1005
  /** Nothing open: a quiet prompt to pick a row. */
924
1006
  const paneEmpty = (_jsx("div", { className: "flex min-h-full flex-1 items-center justify-center px-6 py-8", children: _jsx(EmptyState, { media: _jsx(EmptyArt, { icon: Tray }), size: "sm", title: tPane('emptyTitle'), description: tPane('emptyDescription') }) }));
925
1007
  // The detail pane: the open item, else (Needs you, wide) what the agents
@@ -940,15 +1022,19 @@ export function ReviewCenter({ initialItems, segment: segmentProp, onSegmentChan
940
1022
  // fetched once, so a refresh never flashes the empty pane on the way.
941
1023
  _jsxs("div", { className: "space-y-4 px-6 py-6", children: [_jsx(Skeleton, { className: "h-6 w-2/3" }), _jsx(Skeleton, { className: "h-4 w-1/3" }), _jsx(Skeleton, { className: "h-40 w-full" })] })) : (paneEmpty);
942
1024
  // Wide inbox, Needs you: the asks deck holds the empty pane.
943
- const deckInPane = wide && segment === 'needs_you' && !!needsYouDeck;
1025
+ const deckInPane = wide && segment === 'needs_you' && !!needsYouDeck && !cards;
944
1026
  return (
945
1027
  // Two panes in a named container: the inbox's own width picks the layout,
946
1028
  // not the viewport, since this view also mounts in the narrow settings
947
1029
  // panel. Below `@3xl` one pane shows at a time: the list, or the open item.
948
- _jsxs("div", { ref: rootRef, className: "@container/inbox relative flex h-full min-h-0", children: [_jsxs("div", { className: cn('border-border min-h-0 w-full min-w-0 flex-col @3xl/inbox:flex @3xl/inbox:w-sm @3xl/inbox:shrink-0 @6xl/inbox:w-md @3xl/inbox:border-r', selected ? 'hidden' : 'flex'), children: [_jsxs("div", { className: "border-border flex h-11 shrink-0 items-center gap-1 border-b px-2.5", children: [_jsx(Tabs, { value: segment, onValueChange: (v) => {
1030
+ _jsxs("div", { ref: rootRef, className: "@container/inbox relative flex h-full min-h-0", children: [_jsxs("div", { className: cn('border-border min-h-0 w-full min-w-0 flex-col',
1031
+ // The deck takes the whole inbox: one card, centred, no pane beside it.
1032
+ cards
1033
+ ? selected ? 'hidden' : 'flex'
1034
+ : cn('@3xl/inbox:flex @3xl/inbox:w-sm @3xl/inbox:shrink-0 @6xl/inbox:w-md @3xl/inbox:border-r', selected ? 'hidden' : 'flex')), children: [_jsxs("div", { className: "border-border flex h-11 shrink-0 items-center gap-1 border-b px-2.5", children: [_jsx(Tabs, { value: segment, onValueChange: (v) => {
949
1035
  setSegment(v);
950
1036
  markSeen();
951
- }, className: "min-w-0", children: _jsx(TabsList, { variant: "secondary", size: "sm", children: segments.map((s) => (_jsx(TabsTrigger, { value: s.value, className: "w-fit flex-none px-2.5", children: s.label }, s.value))) }) }), _jsxs("div", { className: "ml-auto flex shrink-0 items-center gap-0.5", children: [_jsx(Hint, { label: _jsxs("span", { className: "flex items-center gap-1.5", children: [tI18nComplete.raw('text49c266baaaa7'), _jsx(Kbd, { children: "/" })] }), children: _jsx(Button, { type: "button", variant: showSearch ? 'secondary' : 'ghost', size: "icon-sm", "aria-label": tI18nComplete.raw('text49c266baaaa7'), "aria-expanded": showSearch, className: cn(!showSearch && 'text-muted-foreground'), onClick: () => {
1037
+ }, className: "min-w-0", children: _jsx(TabsList, { variant: "secondary", size: "sm", children: segments.map((s) => (_jsx(TabsTrigger, { value: s.value, className: "w-fit flex-none px-2.5", children: s.label }, s.value))) }) }), _jsxs("div", { className: "ml-auto flex shrink-0 items-center gap-0.5", children: [deckEnabled && segment === 'needs_you' ? (_jsx(Hint, { label: cards ? tDeck('showList') : tDeck('showCards'), children: _jsx(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": cards ? tDeck('showList') : tDeck('showCards'), "data-testid": "review-view-toggle", className: "text-muted-foreground", onClick: () => setView(cards ? 'list' : 'cards'), children: cards ? _jsx(Rows, { className: "size-4" }) : _jsx(Cards, { className: "size-4" }) }) })) : null, _jsx(Hint, { label: _jsxs("span", { className: "flex items-center gap-1.5", children: [tI18nComplete.raw('text49c266baaaa7'), _jsx(Kbd, { children: "/" })] }), children: _jsx(Button, { type: "button", variant: showSearch ? 'secondary' : 'ghost', size: "icon-sm", "aria-label": tI18nComplete.raw('text49c266baaaa7'), "aria-expanded": showSearch, className: cn(!showSearch && 'text-muted-foreground'), onClick: () => {
952
1038
  if (showSearch && !query) {
953
1039
  setSearchOpen(false);
954
1040
  return;
@@ -964,20 +1050,27 @@ export function ReviewCenter({ initialItems, segment: segmentProp, onSegmentChan
964
1050
  }, onBlur: () => {
965
1051
  if (!query)
966
1052
  setSearchOpen(false);
967
- }, placeholder: tI18nComplete.raw('text49c266baaaa7'), variant: "popover", size: "sm" })] })) : null, filtered ? (_jsxs("div", { className: "flex flex-wrap items-center gap-1.5", children: [activeKind ? (_jsx(FilterChip, { label: activeKind.label, onRemove: () => setKindFilter('all') })) : null, activeSession ? (_jsx(FilterChip, { label: activeSession.label, onRemove: () => setSessionFilter('all') })) : null, grouped ? (_jsx(FilterChip, { label: tI18nComplete.raw('text137f98df3b9b'), onRemove: () => setGrouped(false) })) : null] })) : null] })) : null, _jsxs("div", { className: cn('min-h-0 flex-1 overflow-y-auto p-1.5', selectMode && segment === 'needs_you' && 'pb-20'), children: [segment === 'needs_you' && needsYouDeck && !wide ? (
1053
+ }, placeholder: tI18nComplete.raw('text49c266baaaa7'), variant: "popover", size: "sm" })] })) : null, filtered ? (_jsxs("div", { className: "flex flex-wrap items-center gap-1.5", children: [activeKind ? (_jsx(FilterChip, { label: activeKind.label, onRemove: () => setKindFilter('all') })) : null, activeSession ? (_jsx(FilterChip, { label: activeSession.label, onRemove: () => setSessionFilter('all') })) : null, grouped ? (_jsx(FilterChip, { label: tI18nComplete.raw('text137f98df3b9b'), onRemove: () => setGrouped(false) })) : null] })) : null] })) : null, _jsxs("div", { className: cn('min-h-0 flex-1 overflow-y-auto p-1.5',
1054
+ // The deck fills what the asks above it leave.
1055
+ cards && 'flex flex-col', selectMode && segment === 'needs_you' && 'pb-20'), children: [cards && needsYouDeck && sessionAsks.length > 0 ? (
1056
+ // One stack at a time: the review cards, or the questions agents
1057
+ // ask. Two decks stacked on one screen read as clutter.
1058
+ _jsx("div", { className: "flex shrink-0 justify-center pt-1", children: _jsx(Tabs, { value: deckTab, onValueChange: (v) => setDeckTab(v), children: _jsxs(TabsList, { variant: "secondary", size: "sm", children: [_jsxs(TabsTrigger, { value: "reviews", className: "w-fit flex-none gap-1.5 px-2.5", children: [tDeck('reviews'), _jsx(CountBadge, { count: visible.length })] }), _jsxs(TabsTrigger, { value: "questions", className: "w-fit flex-none gap-1.5 px-2.5", children: [tDeck('questions'), _jsx(CountBadge, { count: sessionAsks.length })] })] }) }) })) : null, segment === 'needs_you' && needsYouDeck && (cards || !wide) ? (
968
1059
  // `peer`: when the deck draws nothing (its Undo window after the
969
- // last card), the list's empty state below shows instead.
970
- _jsx("div", { className: "peer px-1 pt-1 pb-3 empty:hidden", children: needsYouDeck({ paused: !!selected }) })) : null, wide ? visibleAsks.map((ask) => (_jsxs(Button, { "data-testid": "review-ask-row", variant: "ghost", "aria-pressed": !selected && selectedAskId === ask.id, className: cn('h-auto w-full justify-start gap-2 px-2.5 py-3 text-left whitespace-normal', !selected && selectedAskId === ask.id && 'bg-active'), onClick: () => {
1060
+ // last card), the list's empty state below shows instead. In
1061
+ // cards mode the stack not shown stays mounted, paused: switching
1062
+ // must not send what waits in its Undo window.
1063
+ _jsx("div", { className: cn('peer px-1 pt-1 pb-3 empty:hidden', cards && deckTab !== 'questions' && 'hidden'), children: needsYouDeck({ paused: !!selected || (cards && deckTab !== 'questions') }) })) : null, cards ? (_jsx("div", { className: cn('flex min-h-0 flex-1 flex-col', deckTab !== 'reviews' && 'hidden'), children: deckBody })) : null, cards && deckTab === 'reviews' && visible.length > 0 && loadMore?.isError ? (_jsx("div", { className: "flex shrink-0 justify-center pb-2", children: loadMoreButton })) : null, wide && !cards ? visibleAsks.map((ask) => (_jsxs(Button, { "data-testid": "review-ask-row", variant: "ghost", "aria-pressed": !selected && selectedAskId === ask.id, className: cn('h-auto w-full justify-start gap-2 px-2.5 py-3 text-left whitespace-normal', !selected && selectedAskId === ask.id && 'bg-active'), onClick: () => {
971
1064
  setSelectedId(null);
972
1065
  onSelectAsk?.(ask.id);
973
- }, children: [_jsx("span", { className: "flex size-8 shrink-0 items-center justify-center", children: _jsx(Chats, { className: "text-muted-foreground size-4" }) }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: "line-clamp-2 text-sm font-medium", children: ask.title }), ask.session_title ? _jsx("span", { className: "text-muted-foreground block truncate text-xs", children: ask.session_title }) : null] })] }, ask.id))) : null, listBody, visible.length > 0 && loadMore ? _jsx("div", { className: "pt-2", children: loadMoreButton }) : null] }), selectMode && segment === 'needs_you' ? (
1066
+ }, children: [_jsx("span", { className: "flex size-8 shrink-0 items-center justify-center", children: _jsx(Chats, { className: "text-muted-foreground size-4" }) }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: "line-clamp-2 text-sm font-medium", children: ask.title }), ask.session_title ? _jsx("span", { className: "text-muted-foreground block truncate text-xs", children: ask.session_title }) : null] })] }, ask.id))) : null, cards ? null : listBody, visible.length > 0 && loadMore && !cards ? _jsx("div", { className: "pt-2", children: loadMoreButton }) : null] }), selectMode && segment === 'needs_you' ? (
974
1067
  // Pinned to the bottom of the inbox, not to the end of the list
975
1068
  // (`sticky` stops where a short list ends, schedule-view.tsx), and
976
1069
  // across the whole inbox: the list column is too narrow for its verbs.
977
1070
  _jsx("div", { className: "pointer-events-none absolute inset-x-0 bottom-4 z-10 flex justify-center px-4", children: _jsx("div", { className: "pointer-events-auto w-full max-w-xl", children: _jsx(SelectionBar, { selectedCount: selectedItems.length, allSelected: selectableIds.length > 0 &&
978
1071
  selectedItems.length >= Math.min(BULK_MAX, selectableIds.length), canSelectAll: selectableIds.length > 0, onSelectAll: () => setSelectedIds(new Set(selectableIds.slice(0, BULK_MAX))), onClear: () => setSelectedIds(new Set()), onExit: exitSelectMode, actions: bulkActions, progress: bulkProgress, animateIn: selectMode !== 'key', note: selectedItems.length >= BULK_MAX && selectableIds.length > BULK_MAX
979
1072
  ? tBulk('limitNote', { count: BULK_MAX })
980
- : undefined }) }) })) : null] }), _jsxs("div", { className: cn('min-h-0 min-w-0 flex-1 flex-col @3xl/inbox:flex', selected ? 'flex' : 'hidden'), children: [deckInPane && needsYouDeck ? (
1073
+ : undefined }) }) })) : null] }), _jsxs("div", { className: cn('min-h-0 min-w-0 flex-1 flex-col', !cards && '@3xl/inbox:flex', selected ? 'flex' : 'hidden'), children: [deckInPane && needsYouDeck ? (
981
1074
  // Not keyed by the open item and kept mounted while one is open
982
1075
  // (`paused`, hidden): a staged answer keeps its Undo window.
983
1076
  _jsxs("div", { className: cn('min-h-0 flex-1 flex-col overflow-y-auto', selected ? 'hidden' : 'flex'), children: [_jsx("div", { className: "peer mx-auto flex min-h-full w-full max-w-2xl flex-col justify-center px-6 py-8 empty:hidden", children: needsYouDeck({ paused: !!selected }) }), _jsx("div", { className: "hidden min-h-full flex-1 peer-empty:flex", children: paneEmpty })] })) : null, selected || !deckInPane ? (
@@ -23,6 +23,25 @@ export interface ReviewActions {
23
23
  * it refuses does not render. */
24
24
  allows: (item: ReviewItem, verdict: ReviewVerdict) => boolean;
25
25
  }
26
+ /**
27
+ * An agent-supplied link, only when it is http(s). A `javascript:` or `data:`
28
+ * URL in a review item's detail must never become a clickable href.
29
+ */
30
+ export declare function httpUrl(url: string | undefined): string | undefined;
31
+ /**
32
+ * The agent's note, then what it made: the first image, video or sound drawn
33
+ * inline, its text, and every other file as a row. Nothing it made, no section.
34
+ *
35
+ * A `/drives/…` path reads through the item's session: its mounts name the
36
+ * drive behind each path (`SessionDriveFilesScope`), exactly as in the
37
+ * session. A workspace path needs a running box, which the inbox does not
38
+ * have, so it is listed and not opened.
39
+ */
40
+ export declare function OutputBody({ item }: {
41
+ item: Extract<ReviewItem, {
42
+ kind: 'output';
43
+ }>;
44
+ }): import("react").JSX.Element;
26
45
  /**
27
46
  * Leaves the open item. On a narrow inbox it is Back to the list; with both
28
47
  * panes it is Close, which brings the empty pane (and the asks deck) back.
@@ -47,7 +47,7 @@ function ChangeBody({ item, actions, onClose, conflicts, }) {
47
47
  return (_jsxs(_Fragment, { children: [requested.length > 0 && (_jsxs(Item, { variant: "outline", size: "sm", children: [_jsxs(ItemContent, { children: [_jsx(ItemTitle, { children: tI18nComplete.raw('textb0eabce39690') }), _jsx("ul", { className: "text-foreground list-disc space-y-1 pl-5 text-sm", children: requested.map((r) => (_jsx("li", { className: "text-pretty", children: r.text }, r.at ?? r.text))) }), _jsx(ItemDescription, { children: tI18nComplete.raw('texte648ea58ae80') })] }), item.sessionId && actions.openSession ? (_jsx(ItemActions, { children: _jsx(Button, { variant: "ghost", size: "sm", onClick: () => {
48
48
  actions.openSession?.(item.sessionId);
49
49
  onClose();
50
- }, children: tI18nComplete.raw('textd1636c646e66') }) })) : null] })), (whatChanged.length > 0 || d.impact) && (_jsxs("div", { className: "space-y-2", children: [whatChanged.length > 0 && (_jsx("ul", { className: "text-muted-foreground list-disc space-y-1 pl-5 text-sm", children: whatChanged.map((line) => (_jsx("li", { className: "text-pretty", children: line }, line))) })), d.impact && _jsx("p", { className: "text-muted-foreground text-sm text-pretty", children: d.impact })] })), (verification.length > 0 || d.previewUrl) && (_jsxs(Item, { variant: "outline", size: "sm", children: [_jsxs(ItemContent, { children: [_jsx(ItemTitle, { children: tI18nComplete.raw('text7140f4f19dec') }), verification.length > 0 && (_jsx("div", { className: "flex flex-wrap items-center gap-1.5", children: verification.map((v) => (_jsx(Badge, { variant: VERIFICATION_BADGE[v.tone], size: "sm", children: v.label }, v.label))) }))] }), d.previewUrl && (_jsx(ItemActions, { children: _jsx(Button, { variant: "outline", size: "sm", asChild: true, children: _jsx("a", { href: d.previewUrl, target: "_blank", rel: "noopener noreferrer", children: tI18nComplete.raw('textf7afe3dde18c') }) }) }))] })), conflicts.length > 0 && (_jsxs(Item, { variant: "warning", size: "sm", children: [_jsxs(ItemContent, { children: [_jsxs(ItemTitle, { children: [tI18nComplete.raw('text62e2514edc8d'), " ", conflicts.length, ' ', conflicts.length === 1 ? 'file' : 'files'] }), _jsx(ItemDescription, { children: tI18nComplete.raw('text0ffc4db692f7') })] }), actions.allows(item, 'approve') ? (_jsx(ItemActions, { children: _jsxs(Button, { size: "sm", disabled: recovering, onClick: () => {
50
+ }, children: tI18nComplete.raw('textd1636c646e66') }) })) : null] })), (whatChanged.length > 0 || d.impact) && (_jsxs("div", { className: "space-y-2", children: [whatChanged.length > 0 && (_jsx("ul", { className: "text-muted-foreground list-disc space-y-1 pl-5 text-sm", children: whatChanged.map((line) => (_jsx("li", { className: "text-pretty", children: line }, line))) })), d.impact && _jsx("p", { className: "text-muted-foreground text-sm text-pretty", children: d.impact })] })), (verification.length > 0 || httpUrl(d.previewUrl)) && (_jsxs(Item, { variant: "outline", size: "sm", children: [_jsxs(ItemContent, { children: [_jsx(ItemTitle, { children: tI18nComplete.raw('text7140f4f19dec') }), verification.length > 0 && (_jsx("div", { className: "flex flex-wrap items-center gap-1.5", children: verification.map((v) => (_jsx(Badge, { variant: VERIFICATION_BADGE[v.tone], size: "sm", children: v.label }, v.label))) }))] }), httpUrl(d.previewUrl) && (_jsx(ItemActions, { children: _jsx(Button, { variant: "outline", size: "sm", asChild: true, children: _jsx("a", { href: httpUrl(d.previewUrl), target: "_blank", rel: "noopener noreferrer", children: tI18nComplete.raw('textf7afe3dde18c') }) }) }))] })), conflicts.length > 0 && (_jsxs(Item, { variant: "warning", size: "sm", children: [_jsxs(ItemContent, { children: [_jsxs(ItemTitle, { children: [tI18nComplete.raw('text62e2514edc8d'), " ", conflicts.length, ' ', conflicts.length === 1 ? 'file' : 'files'] }), _jsx(ItemDescription, { children: tI18nComplete.raw('text0ffc4db692f7') })] }), actions.allows(item, 'approve') ? (_jsx(ItemActions, { children: _jsxs(Button, { size: "sm", disabled: recovering, onClick: () => {
51
51
  if (actions.recoverChange) {
52
52
  actions.recoverChange(item, conflicts);
53
53
  }
@@ -104,6 +104,21 @@ function ApprovalBody({ item, actions, onResolved, }) {
104
104
  }, children: [busy && actions.pendingDecision === 'approve' ? (_jsx(Loading, { className: "size-3.5 shrink-0" })) : (_jsx(Check, { className: "size-3.5" })), tI18nComplete.raw('textae067b687107')] })] })] }))] }));
105
105
  })() }));
106
106
  }
107
+ /**
108
+ * An agent-supplied link, only when it is http(s). A `javascript:` or `data:`
109
+ * URL in a review item's detail must never become a clickable href.
110
+ */
111
+ export function httpUrl(url) {
112
+ if (!url)
113
+ return undefined;
114
+ try {
115
+ const parsed = new URL(url);
116
+ return parsed.protocol === 'http:' || parsed.protocol === 'https:' ? parsed.href : undefined;
117
+ }
118
+ catch {
119
+ return undefined;
120
+ }
121
+ }
107
122
  // ── output ────────────────────────────────────────────────────────────────
108
123
  /** File kinds an output draws inline. Everything else is a row that opens it. */
109
124
  const INLINE_MEDIA = new Set(['image', 'video', 'audio']);
@@ -123,7 +138,7 @@ function OutputFileRow({ file, readable, }) {
123
138
  * session. A workspace path needs a running box, which the inbox does not
124
139
  * have, so it is listed and not opened.
125
140
  */
126
- function OutputBody({ item }) {
141
+ export function OutputBody({ item }) {
127
142
  const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
128
143
  const projectId = useProjectContext()?.projectId;
129
144
  const sessionId = item.sessionId;
@@ -136,7 +151,7 @@ function OutputBody({ item }) {
136
151
  return (_jsxs(_Fragment, { children: [projectId && sessionId ? (_jsx(SessionDriveFilesScope, { projectId: projectId, sessionId: sessionId })) : null, d.note ? (_jsx("p", { className: "text-foreground text-sm whitespace-pre-wrap text-pretty", children: d.note })) : null, media ? (
137
152
  // A video takes a 16:9 box: the inline card's fixed height bars a
138
153
  // landscape cut top and bottom, worst on a phone.
139
- _jsx("div", { className: cn('overflow-hidden rounded-md border', video && 'aspect-video'), children: _jsx(ShowContentRenderer, { type: "file", path: media.path, fill: video }) })) : null, d.preview ? (_jsxs("section", { children: [_jsx(SectionLabel, { children: tI18nComplete.raw('text526e0087cc3f') }), _jsx("p", { className: "text-foreground text-sm whitespace-pre-wrap text-pretty", children: d.preview })] })) : null, rest.length > 0 ? (_jsxs("section", { children: [_jsx(SectionLabel, { children: tI18nComplete.raw('textabc7e9892806') }), _jsx("ul", { className: "-mx-2 space-y-0.5", children: rest.map((f) => (_jsx(OutputFileRow, { file: f, readable: readable(f.path) }, f.path))) })] })) : null, d.previewUrl ? (_jsx(Button, { variant: "outline", size: "sm", className: "gap-1.5", asChild: true, children: _jsxs("a", { href: d.previewUrl, target: "_blank", rel: "noopener noreferrer", children: [tI18nComplete.raw('textf7afe3dde18c'), _jsx(ArrowUpRight, { className: "size-3.5 shrink-0" })] }) })) : null] }));
154
+ _jsx("div", { className: cn('overflow-hidden rounded-md border', video && 'aspect-video'), children: _jsx(ShowContentRenderer, { type: "file", path: media.path, fill: video }) })) : null, d.preview ? (_jsxs("section", { children: [_jsx(SectionLabel, { children: tI18nComplete.raw('text526e0087cc3f') }), _jsx("p", { className: "text-foreground text-sm whitespace-pre-wrap text-pretty", children: d.preview })] })) : null, rest.length > 0 ? (_jsxs("section", { children: [_jsx(SectionLabel, { children: tI18nComplete.raw('textabc7e9892806') }), _jsx("ul", { className: "-mx-2 space-y-0.5", children: rest.map((f) => (_jsx(OutputFileRow, { file: f, readable: readable(f.path) }, f.path))) })] })) : null, httpUrl(d.previewUrl) ? (_jsx(Button, { variant: "outline", size: "sm", className: "gap-1.5", asChild: true, children: _jsxs("a", { href: httpUrl(d.previewUrl), target: "_blank", rel: "noopener noreferrer", children: [tI18nComplete.raw('textf7afe3dde18c'), _jsx(ArrowUpRight, { className: "size-3.5 shrink-0" })] }) })) : null] }));
140
155
  }
141
156
  // ── decision ──────────────────────────────────────────────────────────────
142
157
  function DecisionBody({ item, actions, onClose, }) {