@adecore/agents-react 0.46.3 → 0.48.0

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 (105) hide show
  1. package/dist/agents/accounts.d.ts +9 -1
  2. package/dist/agents/accounts.js +31 -7
  3. package/dist/chat/account-choice.d.ts +5 -4
  4. package/dist/chat/account-choice.js +47 -39
  5. package/dist/chat/index.d.ts +1 -0
  6. package/dist/chat/index.js +1 -0
  7. package/dist/chat/logic/scrubber.js +12 -0
  8. package/dist/chat/logic/timeline-copy.js +2 -0
  9. package/dist/chat/logic/timeline.d.ts +6 -1
  10. package/dist/chat/logic/timeline.js +36 -10
  11. package/dist/chat/preferences.d.ts +2 -2
  12. package/dist/chat/preferences.js +11 -5
  13. package/dist/chat/ui/AccountPill.js +9 -6
  14. package/dist/chat/ui/ChatActivity.d.ts +2 -1
  15. package/dist/chat/ui/ChatActivity.js +295 -61
  16. package/dist/chat/ui/Composer.d.ts +2 -1
  17. package/dist/chat/ui/Composer.js +492 -486
  18. package/dist/chat/ui/LimitState.js +180 -172
  19. package/dist/chat/ui/PromptEditor.js +4 -1
  20. package/dist/chat/ui/ReferenceChip.d.ts +2 -1
  21. package/dist/chat/ui/ReferenceChip.js +135 -100
  22. package/dist/chat/ui/UnifiedDiff.js +22 -19
  23. package/dist/chat/ui/composer/ComposerControls.js +1 -1
  24. package/dist/chat/ui/composer/ComposerMenu.js +17 -11
  25. package/dist/chat/ui/composer/chips.d.ts +3 -0
  26. package/dist/chat/ui/composer/chips.js +14 -10
  27. package/dist/chat/ui/composer/use-chat-controls.js +70 -67
  28. package/dist/chat/ui/diff/EditorEditDiff.d.ts +3 -1
  29. package/dist/chat/ui/diff/EditorEditDiff.js +24 -18
  30. package/dist/chat/ui/diff/EditorPatchDiff.d.ts +3 -1
  31. package/dist/chat/ui/diff/EditorPatchDiff.js +4 -2
  32. package/dist/chat/ui/diff/diff-props.d.ts +2 -0
  33. package/dist/chat/ui/reference-icons.d.ts +3 -0
  34. package/dist/chat/ui/reference-icons.js +15 -2
  35. package/dist/chat/ui/rows/MessageRows.d.ts +6 -1
  36. package/dist/chat/ui/rows/MessageRows.js +166 -10
  37. package/dist/chat/ui/rows/RowContainer.js +21 -22
  38. package/dist/chat/ui/rows/Rows.js +37 -19
  39. package/dist/chat/ui/rows/WorkflowRow.d.ts +2 -1
  40. package/dist/chat/ui/rows/WorkflowRow.js +197 -191
  41. package/dist/chat/ui/rows/row-rhythm.d.ts +1 -0
  42. package/dist/chat/ui/rows/row-rhythm.js +12 -3
  43. package/dist/chat/workflow-list.d.ts +12 -0
  44. package/dist/chat/workflow-list.js +54 -0
  45. package/dist/host-hooks.d.ts +3 -0
  46. package/dist/host-hooks.js +8 -0
  47. package/dist/host.d.ts +11 -1
  48. package/dist/index.d.ts +1 -1
  49. package/dist/locales/en/agent-chat.d.ts +9 -0
  50. package/dist/locales/en/agent-chat.js +9 -0
  51. package/dist/locales/en/agent-providers.d.ts +5 -0
  52. package/dist/locales/en/agent-providers.js +8 -3
  53. package/dist/locales/nl/agent-chat.d.ts +9 -0
  54. package/dist/locales/nl/agent-chat.js +9 -0
  55. package/dist/locales/nl/agent-providers.d.ts +5 -0
  56. package/dist/locales/nl/agent-providers.js +8 -3
  57. package/dist/providers/AccountOrderList.d.ts +10 -0
  58. package/dist/providers/AccountOrderList.js +158 -0
  59. package/dist/providers/CliDetail.js +55 -61
  60. package/dist/providers/account-actions.d.ts +1 -0
  61. package/dist/providers/account-actions.js +39 -0
  62. package/dist/providers/index.d.ts +1 -1
  63. package/dist/providers/index.js +1 -1
  64. package/dist/usage/limit-groups.js +6 -1
  65. package/package.json +8 -8
  66. package/src/agents/accounts.ts +42 -6
  67. package/src/chat/account-choice.ts +31 -10
  68. package/src/chat/index.ts +1 -0
  69. package/src/chat/logic/scrubber.ts +5 -0
  70. package/src/chat/logic/timeline-copy.ts +2 -0
  71. package/src/chat/logic/timeline.ts +33 -2
  72. package/src/chat/preferences.ts +33 -8
  73. package/src/chat/ui/AccountPill.tsx +3 -3
  74. package/src/chat/ui/ChatActivity.tsx +52 -6
  75. package/src/chat/ui/Composer.tsx +19 -3
  76. package/src/chat/ui/LimitState.tsx +4 -2
  77. package/src/chat/ui/PromptEditor.tsx +3 -1
  78. package/src/chat/ui/ReferenceChip.tsx +15 -5
  79. package/src/chat/ui/UnifiedDiff.tsx +12 -1
  80. package/src/chat/ui/composer/ComposerControls.tsx +1 -1
  81. package/src/chat/ui/composer/ComposerMenu.tsx +4 -2
  82. package/src/chat/ui/composer/chips.ts +15 -9
  83. package/src/chat/ui/composer/use-chat-controls.ts +4 -1
  84. package/src/chat/ui/diff/EditorEditDiff.tsx +9 -4
  85. package/src/chat/ui/diff/EditorPatchDiff.tsx +5 -1
  86. package/src/chat/ui/diff/diff-props.ts +3 -0
  87. package/src/chat/ui/reference-icons.ts +13 -1
  88. package/src/chat/ui/rows/MessageRows.tsx +35 -0
  89. package/src/chat/ui/rows/RowContainer.tsx +2 -2
  90. package/src/chat/ui/rows/Rows.tsx +3 -0
  91. package/src/chat/ui/rows/WorkflowRow.tsx +9 -4
  92. package/src/chat/ui/rows/row-rhythm.ts +12 -3
  93. package/src/chat/workflow-list.ts +65 -0
  94. package/src/host-hooks.ts +13 -0
  95. package/src/host.ts +23 -1
  96. package/src/index.ts +1 -0
  97. package/src/locales/en/agent-chat.ts +9 -0
  98. package/src/locales/en/agent-providers.ts +8 -3
  99. package/src/locales/nl/agent-chat.ts +9 -0
  100. package/src/locales/nl/agent-providers.ts +8 -3
  101. package/src/providers/AccountOrderList.tsx +124 -0
  102. package/src/providers/CliDetail.tsx +33 -28
  103. package/src/providers/account-actions.ts +30 -0
  104. package/src/providers/index.ts +11 -1
  105. package/src/usage/limit-groups.ts +8 -1
@@ -91,4 +91,12 @@ export function useHostMapSource(maps, scopeId) {
91
91
  }
92
92
  export function useCommandNames(look, scopeId, chatId) {
93
93
  return look.useNames(scopeId, chatId);
94
+ }
95
+ export function useHostCanReorderAccounts(scopeId) {
96
+ const useCanReorder = useChatHost().useCanReorderAccounts ?? (() => true);
97
+ return useCanReorder(scopeId);
98
+ }
99
+ export function useHostAccountRule(scopeId, chatId) {
100
+ const useRule = useChatHost().useAccountRule ?? (() => null);
101
+ return useRule(scopeId, chatId);
94
102
  }
package/dist/host.d.ts CHANGED
@@ -5,7 +5,8 @@ import type { Highlighter, ThemeRegistration } from 'shiki';
5
5
  import type { LucideIcon } from 'lucide-react';
6
6
  import type { EditorEngine } from '@adecore/editor';
7
7
  import type { AgentKind, ChatAttachment, ChatCheckpointDiff, ChatConfigurePayload, ChatGoalAction, ChatItem, ChatSubagentItem, ChatUiChoicePayload, ChatUiQueryPayload, ChatUiQueryReading, ChatUiLinkPayload, ChatUiLinkReading, ChatVisual, ModelSelection, ProviderPlatform, RuntimeMode } from '@adecore/agent-contracts';
8
- import type { Referables } from './chat/chat-references.js';
8
+ import type { AccountRule } from './agents/accounts.js';
9
+ import type { ReferableKind, Referables } from './chat/chat-references.js';
9
10
  import type { TimelineRow } from './chat/logic/timeline.js';
10
11
  import type { FindReveal } from './chat/ui/find-reveal.js';
11
12
  import type { PromptAction } from './prompts/logic/prompts.js';
@@ -111,6 +112,12 @@ export interface ComposerSlotProps {
111
112
  disabled: boolean;
112
113
  insert(text: string): void;
113
114
  }
115
+ export interface ReferenceIconProps {
116
+ id: string;
117
+ kind: ReferableKind;
118
+ size: number;
119
+ className?: string;
120
+ }
114
121
  export interface ComposerHeaderSlotProps {
115
122
  scopeId: string;
116
123
  chatId: string;
@@ -282,9 +289,12 @@ export interface ChatHost {
282
289
  title: string;
283
290
  }>;
284
291
  useReferables?(scopeId: string, chatId: string): Referables;
292
+ ReferenceIcon?: ComponentType<ReferenceIconProps> | null;
285
293
  openReference?(scopeId: string, id: string): void;
286
294
  openLogin: ((scopeId: string, kind: AgentKind, accountId: string, name: string) => Promise<void>) | null;
287
295
  useLoginBlocked(scopeId: string): string | null;
296
+ useCanReorderAccounts?(scopeId: string): boolean;
297
+ useAccountRule?(scopeId: string, chatId: string): AccountRule | null;
288
298
  runProviderCommand?(scopeId: string, kind: AgentKind, command: string): void;
289
299
  useMachinePlatform?(scopeId: string): ProviderPlatform | null;
290
300
  providerKeyNote?(variable: string): string | null;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { type ChatActions, type FileRef, type ShellCodeBlockContext, type ChatPlace, type SubagentTask, type TimelineFindOptions, type TimelineFind, type ComposerDictationProps, type ComposerHeaderSlotProps, type ComposerSlotProps, type ComposerSendAction, type ComposerSendDraft, type SubagentSlotProps, type ThreadCard, type VisualHost, type HostMenuAction, type ReplyAuthor, type ChatHost, type UiMapSource, type UiModelViewProps, type CommandLook, type CommandLookMatch, type CommandName, ChatHostProvider, useChatHost, type AccentChoice, type ChatToast, type TextareaProps, type ResourceUrl } from './host.js';
1
+ export { type ChatActions, type FileRef, type ShellCodeBlockContext, type ChatPlace, type SubagentTask, type TimelineFindOptions, type TimelineFind, type ComposerDictationProps, type ComposerHeaderSlotProps, type ComposerSlotProps, type ReferenceIconProps, type ComposerSendAction, type ComposerSendDraft, type SubagentSlotProps, type ThreadCard, type VisualHost, type HostMenuAction, type ReplyAuthor, type ChatHost, type UiMapSource, type UiModelViewProps, type CommandLook, type CommandLookMatch, type CommandName, ChatHostProvider, useChatHost, type AccentChoice, type ChatToast, type TextareaProps, type ResourceUrl } from './host.js';
2
2
  export { type ChatScope, ChatScopeContext, useChatScope } from './scope.js';
3
3
  export { type ChatRequestMap, type ChatEventMap, type ChatTransportStatus, type ChatTransport, ChatTransportError, errorCode, isConnectionError } from './transport.js';
4
4
  export { portTransport, type PortTransport } from './port-transport.js';
@@ -120,6 +120,10 @@ declare const _default: {
120
120
  showLess: string;
121
121
  quoteGone: string;
122
122
  };
123
+ message: {
124
+ heading: string;
125
+ unnamed: string;
126
+ };
123
127
  report: {
124
128
  heading: string;
125
129
  };
@@ -416,6 +420,11 @@ declare const _default: {
416
420
  monitors_other: string;
417
421
  pausedUntil: string;
418
422
  progress: string;
423
+ workflow: string;
424
+ workflows_one: string;
425
+ workflows_other: string;
426
+ workflowProgress: string;
427
+ workflowStalled: string;
419
428
  needsYou_one: string;
420
429
  needsYou_other: string;
421
430
  took: {
@@ -120,6 +120,10 @@ export default {
120
120
  showLess: 'Show less',
121
121
  quoteGone: 'Quoted reply no longer in this chat.'
122
122
  },
123
+ message: {
124
+ heading: 'Message from {{name}}',
125
+ unnamed: 'another node'
126
+ },
123
127
  report: {
124
128
  heading: 'Report'
125
129
  },
@@ -416,6 +420,11 @@ export default {
416
420
  monitors_other: '{{count}} monitors',
417
421
  pausedUntil: 'paused until {{time}}',
418
422
  progress: '{{done}} of {{total}} sub-agents done',
423
+ workflow: 'Workflow',
424
+ workflows_one: '{{count}} workflow',
425
+ workflows_other: '{{count}} workflows',
426
+ workflowProgress: '{{name}} · {{done}}/{{total}}',
427
+ workflowStalled: '{{name}} · no progress',
419
428
  needsYou_one: '{{count}} needs you',
420
429
  needsYou_other: '{{count}} need you',
421
430
  took: {
@@ -76,6 +76,7 @@ declare const _default: {
76
76
  defaults: {
77
77
  title: string;
78
78
  description: string;
79
+ descriptionWithAccount: string;
79
80
  account: string;
80
81
  accountFor: string;
81
82
  model: string;
@@ -86,6 +87,9 @@ declare const _default: {
86
87
  legacyModel: string;
87
88
  };
88
89
  accounts: string;
90
+ accountsOrder: string;
91
+ defaultTag: string;
92
+ reorderHandle: string;
89
93
  };
90
94
  account: {
91
95
  kind: string;
@@ -145,6 +149,7 @@ declare const _default: {
145
149
  confirm: string;
146
150
  };
147
151
  saveFailed: string;
152
+ reorderFailed: string;
148
153
  };
149
154
  add: {
150
155
  title: string;
@@ -75,7 +75,8 @@ export default {
75
75
  onlyDefault: '{{provider}} supports only its default account.',
76
76
  defaults: {
77
77
  title: 'Defaults for new chats',
78
- description: 'Picking a model or account in a chat also changes its default here.',
78
+ description: 'Picking a model in a chat also changes its default here.',
79
+ descriptionWithAccount: 'Picking a model or account in a chat also changes its default here.',
79
80
  account: 'Account',
80
81
  accountFor: 'Default account for {{provider}}',
81
82
  model: 'Model',
@@ -85,7 +86,10 @@ export default {
85
86
  providerDefault: 'Provider default',
86
87
  legacyModel: '{{name}} (legacy)'
87
88
  },
88
- accounts: 'Accounts'
89
+ accounts: 'Accounts',
90
+ accountsOrder: 'New chats and agents start on the top account that is on.',
91
+ defaultTag: 'Default',
92
+ reorderHandle: 'Move {{account}}. Alt+Up and Alt+Down move it too.'
89
93
  },
90
94
  account: {
91
95
  kind: '{{provider}} account',
@@ -144,7 +148,8 @@ export default {
144
148
  confirmDescription: 'Its folder and login stay at {{folder}}.',
145
149
  confirm: 'Remove account'
146
150
  },
147
- saveFailed: 'Could not save the account'
151
+ saveFailed: 'Could not save the account',
152
+ reorderFailed: 'Could not change the order of the accounts'
148
153
  },
149
154
  add: {
150
155
  title: 'Add {{provider}} account',
@@ -120,6 +120,10 @@ declare const _default: {
120
120
  showLess: string;
121
121
  quoteGone: string;
122
122
  };
123
+ message: {
124
+ heading: string;
125
+ unnamed: string;
126
+ };
123
127
  report: {
124
128
  heading: string;
125
129
  };
@@ -416,6 +420,11 @@ declare const _default: {
416
420
  monitors_other: string;
417
421
  pausedUntil: string;
418
422
  progress: string;
423
+ workflow: string;
424
+ workflows_one: string;
425
+ workflows_other: string;
426
+ workflowProgress: string;
427
+ workflowStalled: string;
419
428
  needsYou_one: string;
420
429
  needsYou_other: string;
421
430
  took: {
@@ -120,6 +120,10 @@ export default {
120
120
  showLess: 'Minder tonen',
121
121
  quoteGone: 'Geciteerd antwoord staat niet meer in deze chat.'
122
122
  },
123
+ message: {
124
+ heading: 'Bericht van {{name}}',
125
+ unnamed: 'een andere node'
126
+ },
123
127
  report: {
124
128
  heading: 'Rapport'
125
129
  },
@@ -416,6 +420,11 @@ export default {
416
420
  monitors_other: '{{count}} monitors',
417
421
  pausedUntil: 'gepauzeerd tot {{time}}',
418
422
  progress: '{{done}} van {{total}} sub-agents klaar',
423
+ workflow: 'Workflow',
424
+ workflows_one: '{{count}} workflow',
425
+ workflows_other: '{{count}} workflows',
426
+ workflowProgress: '{{name}} · {{done}}/{{total}}',
427
+ workflowStalled: '{{name}} · geen voortgang',
419
428
  needsYou_one: '{{count}} vraagt aandacht',
420
429
  needsYou_other: '{{count}} vragen aandacht',
421
430
  took: {
@@ -76,6 +76,7 @@ declare const _default: {
76
76
  defaults: {
77
77
  title: string;
78
78
  description: string;
79
+ descriptionWithAccount: string;
79
80
  account: string;
80
81
  accountFor: string;
81
82
  model: string;
@@ -86,6 +87,9 @@ declare const _default: {
86
87
  legacyModel: string;
87
88
  };
88
89
  accounts: string;
90
+ accountsOrder: string;
91
+ defaultTag: string;
92
+ reorderHandle: string;
89
93
  };
90
94
  account: {
91
95
  kind: string;
@@ -145,6 +149,7 @@ declare const _default: {
145
149
  confirm: string;
146
150
  };
147
151
  saveFailed: string;
152
+ reorderFailed: string;
148
153
  };
149
154
  add: {
150
155
  title: string;
@@ -75,7 +75,8 @@ export default {
75
75
  onlyDefault: '{{provider}} kent alleen zijn standaardaccount.',
76
76
  defaults: {
77
77
  title: 'Standaarden voor nieuwe chats',
78
- description: 'Een model of account kiezen in een chat verandert hier ook de standaard.',
78
+ description: 'Een model kiezen in een chat verandert hier ook de standaard.',
79
+ descriptionWithAccount: 'Een model of account kiezen in een chat verandert hier ook de standaard.',
79
80
  account: 'Account',
80
81
  accountFor: 'Standaardaccount voor {{provider}}',
81
82
  model: 'Model',
@@ -85,7 +86,10 @@ export default {
85
86
  providerDefault: 'Standaard van de provider',
86
87
  legacyModel: '{{name}} (legacy)'
87
88
  },
88
- accounts: 'Accounts'
89
+ accounts: 'Accounts',
90
+ accountsOrder: 'Nieuwe chats en agents starten op het bovenste account dat aanstaat.',
91
+ defaultTag: 'Standaard',
92
+ reorderHandle: 'Verplaats {{account}}. Alt+Omhoog en Alt+Omlaag verplaatsen het ook.'
89
93
  },
90
94
  account: {
91
95
  kind: '{{provider}}-account',
@@ -144,7 +148,8 @@ export default {
144
148
  confirmDescription: 'De map en de login blijven in {{folder}}.',
145
149
  confirm: 'Account verwijderen'
146
150
  },
147
- saveFailed: 'Kon het account niet opslaan'
151
+ saveFailed: 'Kon het account niet opslaan',
152
+ reorderFailed: 'Kon de volgorde van de accounts niet wijzigen'
148
153
  },
149
154
  add: {
150
155
  title: '{{provider}}-account toevoegen',
@@ -0,0 +1,10 @@
1
+ import { type AccountEntry, type AccountLogin } from '../agents/accounts.js';
2
+ interface AccountOrderListProps {
3
+ entries: readonly AccountEntry[];
4
+ providerName: string;
5
+ login: AccountLogin;
6
+ onReorder: ((ids: string[]) => void) | null;
7
+ onPickAccount(id: string): void;
8
+ }
9
+ export declare function AccountOrderList({ entries, providerName, login, onReorder, onPickAccount }: AccountOrderListProps): import("react").JSX.Element;
10
+ export {};
@@ -0,0 +1,158 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { useState } from 'react';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { ChevronRight, GripVertical } from 'lucide-react';
5
+ import { Icon, Pill, Tooltip } from '@adecore/ui';
6
+ import { AccountDot } from '../agents/AccountDot.js';
7
+ import { ACCOUNT_TONE_CLASSES, accountName, accountStatusLine, movedIds, topAccountEntry } from '../agents/accounts.js';
8
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
9
+ const DRAG_TYPE = 'application/x-adecore-account';
10
+ /* The accounts of one CLI in the person's order, dragged by their handle or moved with Alt+Up and Alt+Down; the top one that is on is tagged as the default. */
11
+ export function AccountOrderList(t0) {
12
+ const $ = _c(13);
13
+ const {
14
+ entries,
15
+ providerName,
16
+ login,
17
+ onReorder,
18
+ onPickAccount
19
+ } = t0;
20
+ const {
21
+ t
22
+ } = useTranslation("agent-providers");
23
+ const [dragged, setDragged] = useState(null);
24
+ const [over, setOver] = useState(null);
25
+ let t1;
26
+ if ($[0] !== dragged || $[1] !== entries || $[2] !== login || $[3] !== onPickAccount || $[4] !== onReorder || $[5] !== over || $[6] !== providerName || $[7] !== t) {
27
+ const ids = entries.map(_temp);
28
+ let t2;
29
+ if ($[9] !== entries) {
30
+ t2 = topAccountEntry(entries);
31
+ $[9] = entries;
32
+ $[10] = t2;
33
+ } else {
34
+ t2 = $[10];
35
+ }
36
+ const top = t2;
37
+ const reorder = entries.length >= 2 ? onReorder : null;
38
+ const move = (id, to) => {
39
+ const next = movedIds(ids, id, to);
40
+ if (reorder !== null && next.some((candidate, index) => candidate !== ids[index])) {
41
+ reorder(next);
42
+ }
43
+ };
44
+ const onKeyDown = (event, id_0, index_0) => {
45
+ if (reorder === null || !event.altKey || event.key !== "ArrowUp" && event.key !== "ArrowDown") {
46
+ return;
47
+ }
48
+ event.preventDefault();
49
+ move(id_0, event.key === "ArrowUp" ? index_0 - 1 : index_0 + 1);
50
+ };
51
+ const placeOf = _temp2;
52
+ const onDrop = (event_1, index_2) => {
53
+ event_1.preventDefault();
54
+ const id_1 = event_1.dataTransfer.getData(DRAG_TYPE);
55
+ const from = ids.indexOf(id_1);
56
+ const place = placeOf(event_1, index_2);
57
+ setDragged(null);
58
+ setOver(null);
59
+ if (from !== -1) {
60
+ move(id_1, place > from ? place - 1 : place);
61
+ }
62
+ };
63
+ t1 = entries.map((entry_0, index_3) => {
64
+ const status = accountStatusLine(entry_0.status, login === "terminal");
65
+ const name = accountName(entry_0, providerName);
66
+ return /*#__PURE__*/_jsxs("div", {
67
+ className: `relative flex w-full min-w-0 items-center first:rounded-t-xl last:rounded-b-xl hover:bg-surface-hover ${dragged === entry_0.id ? "opacity-50" : ""}`,
68
+ onDragOver: event_2 => {
69
+ if (dragged !== null) {
70
+ event_2.preventDefault();
71
+ setOver(placeOf(event_2, index_3));
72
+ }
73
+ },
74
+ onDrop: event_3 => onDrop(event_3, index_3),
75
+ children: [over === index_3 && /*#__PURE__*/_jsx("span", {
76
+ "aria-hidden": true,
77
+ className: "absolute inset-x-3 top-0 h-0.5 rounded-full bg-accent"
78
+ }), over === index_3 + 1 && index_3 === entries.length - 1 && /*#__PURE__*/_jsx("span", {
79
+ "aria-hidden": true,
80
+ className: "absolute inset-x-3 bottom-0 h-0.5 rounded-full bg-accent"
81
+ }), reorder !== null && /*#__PURE__*/_jsx(Tooltip, {
82
+ label: t("cli.reorderHandle", {
83
+ account: name
84
+ }),
85
+ children: /*#__PURE__*/_jsx("span", {
86
+ "aria-hidden": true,
87
+ draggable: true,
88
+ className: "flex shrink-0 cursor-grab items-center self-stretch pl-3 text-text-faint",
89
+ onDragStart: event_4 => {
90
+ event_4.dataTransfer.setData(DRAG_TYPE, entry_0.id);
91
+ event_4.dataTransfer.effectAllowed = "move";
92
+ setDragged(entry_0.id);
93
+ },
94
+ onDragEnd: () => {
95
+ setDragged(null);
96
+ setOver(null);
97
+ },
98
+ children: /*#__PURE__*/_jsx(Icon, {
99
+ icon: GripVertical,
100
+ size: 14
101
+ })
102
+ })
103
+ }), /*#__PURE__*/_jsxs("button", {
104
+ type: "button",
105
+ "aria-keyshortcuts": reorder === null ? undefined : "Alt+ArrowUp Alt+ArrowDown",
106
+ className: `flex min-w-0 grow items-center gap-3 py-3 pr-4.5 text-left ${reorder === null ? "pl-4.5" : "pl-2.5"}`,
107
+ onClick: () => onPickAccount(entry_0.id),
108
+ onKeyDown: event_5 => onKeyDown(event_5, entry_0.id, index_3),
109
+ children: [/*#__PURE__*/_jsx(AccountDot, {
110
+ color: entry_0.account.color
111
+ }), /*#__PURE__*/_jsx("span", {
112
+ className: "min-w-0 truncate text-sm text-text",
113
+ children: name
114
+ }), entries.length >= 2 && entry_0.id === top?.id && /*#__PURE__*/_jsx(Pill, {
115
+ size: "sm",
116
+ children: t("cli.defaultTag")
117
+ }), /*#__PURE__*/_jsx("span", {
118
+ className: `ml-auto shrink-0 text-xs ${ACCOUNT_TONE_CLASSES[status.tone]}`,
119
+ children: status.text
120
+ }), /*#__PURE__*/_jsx(Icon, {
121
+ icon: ChevronRight,
122
+ size: 14,
123
+ className: "shrink-0 text-text-faint"
124
+ })]
125
+ })]
126
+ }, entry_0.id);
127
+ });
128
+ $[0] = dragged;
129
+ $[1] = entries;
130
+ $[2] = login;
131
+ $[3] = onPickAccount;
132
+ $[4] = onReorder;
133
+ $[5] = over;
134
+ $[6] = providerName;
135
+ $[7] = t;
136
+ $[8] = t1;
137
+ } else {
138
+ t1 = $[8];
139
+ }
140
+ let t2;
141
+ if ($[11] !== t1) {
142
+ t2 = /*#__PURE__*/_jsx(_Fragment, {
143
+ children: t1
144
+ });
145
+ $[11] = t1;
146
+ $[12] = t2;
147
+ } else {
148
+ t2 = $[12];
149
+ }
150
+ return t2;
151
+ }
152
+ function _temp2(event_0, index_1) {
153
+ const box = event_0.currentTarget.getBoundingClientRect();
154
+ return event_0.clientY > box.top + box.height / 2 ? index_1 + 1 : index_1;
155
+ }
156
+ function _temp(entry) {
157
+ return entry.id;
158
+ }
@@ -1,18 +1,22 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
2
  import { useTranslation } from 'react-i18next';
3
- import { ChevronRight, Plus } from 'lucide-react';
4
- import { AccountDot } from '../agents/AccountDot.js';
3
+ import { Plus } from 'lucide-react';
5
4
  import { ModelOptionControl } from '../agents/ModelOptionControl.js';
6
5
  import { carryOptions } from '../agents/model-options.js';
7
6
  import { optionWord } from '../agents/option-words.js';
8
- import { ACCOUNT_TONE_CLASSES, accountName, accountStatusLine, offeredAccounts } from '../agents/accounts.js';
7
+ import { AccountDot } from '../agents/AccountDot.js';
8
+ import { accountName, offeredAccounts } from '../agents/accounts.js';
9
9
  import { accountFor, forgetChatSelection, rememberChatAccount, rememberChatSelection, selectionFor, useChatPreferences } from '../chat/preferences.js';
10
+ import { knownAccounts, useProviderAccounts } from '../state/provider-accounts.js';
11
+ import { useChatHost } from '../host.js';
12
+ import { useHostCanReorderAccounts } from '../host-hooks.js';
10
13
  import { useChatScope } from '../scope.js';
14
+ import { reorderAccounts } from './account-actions.js';
15
+ import { AccountOrderList } from './AccountOrderList.js';
11
16
  import { providerAbilities } from './provider-abilities.js';
12
17
  import { DetailHeader, SettingsRow, SettingsSection } from '@adecore/ui/settings';
13
18
  import { Button, Icon, Select } from '@adecore/ui';
14
19
  import { CliTile } from './parts.js';
15
- import { knownAccounts, useProviderAccounts } from '../state/provider-accounts.js';
16
20
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
17
21
  const PROVIDER_DEFAULT = '';
18
22
  /* One row per knob the chosen model exposes; the composer's option picker shows the same descriptors. */
@@ -85,7 +89,7 @@ function ModelOptionRows(t0) {
85
89
  }
86
90
  /* One CLI: what it is, what a new chat of it starts with unless `defaults` is off, and its accounts. */
87
91
  export function CliDetail(t0) {
88
- const $ = _c(49);
92
+ const $ = _c(53);
89
93
  const {
90
94
  provider,
91
95
  entries,
@@ -97,9 +101,9 @@ export function CliDetail(t0) {
97
101
  const {
98
102
  t
99
103
  } = useTranslation("agent-providers");
100
- const {
101
- id: scopeId
102
- } = useChatScope();
104
+ const scope = useChatScope();
105
+ const host = useChatHost();
106
+ const canReorder = useHostCanReorderAccounts(scope.id);
103
107
  const preferences = useChatPreferences();
104
108
  let t1;
105
109
  if ($[0] !== preferences || $[1] !== provider.kind) {
@@ -129,14 +133,14 @@ export function CliDetail(t0) {
129
133
  t2 = $[5];
130
134
  }
131
135
  const model = t2;
136
+ const canAddAccount = login !== null;
137
+ const ordered = canReorder && entries !== null && entries.length >= 2;
132
138
  const machineAccounts = useProviderAccounts(knownAccounts);
133
- let canAddAccount;
134
139
  let t3;
135
140
  let t4;
136
- if ($[8] !== defaults || $[9] !== entries || $[10] !== login || $[11] !== machineAccounts || $[12] !== model || $[13] !== onAddAccount || $[14] !== preferences || $[15] !== provider || $[16] !== scopeId || $[17] !== selection?.options || $[18] !== t) {
137
- const picked = accountFor(preferences, scopeId, provider.kind, machineAccounts) ?? provider.kind;
138
- const choosable = offeredAccounts(entries ?? [], picked);
139
- canAddAccount = login !== null;
141
+ if ($[8] !== canAddAccount || $[9] !== canReorder || $[10] !== defaults || $[11] !== entries || $[12] !== machineAccounts || $[13] !== model || $[14] !== onAddAccount || $[15] !== preferences || $[16] !== provider || $[17] !== scope.id || $[18] !== selection?.options || $[19] !== t) {
142
+ const picked = accountFor(preferences, scope.id, provider.kind, machineAccounts) ?? provider.kind;
143
+ const choosable = canReorder ? [] : offeredAccounts(entries ?? [], picked);
140
144
  let t5;
141
145
  if ($[22] !== provider.kind) {
142
146
  t5 = /*#__PURE__*/_jsx(CliTile, {
@@ -203,7 +207,7 @@ export function CliDetail(t0) {
203
207
  }
204
208
  t4 = defaults && /*#__PURE__*/_jsxs(SettingsSection, {
205
209
  title: t("cli.defaults.title"),
206
- description: t("cli.defaults.description"),
210
+ description: t(canReorder ? "cli.defaults.description" : "cli.defaults.descriptionWithAccount"),
207
211
  children: [choosable.length > 0 && /*#__PURE__*/_jsx(SettingsRow, {
208
212
  searchId: "providers.defaults.account",
209
213
  label: t("cli.defaults.account"),
@@ -221,7 +225,7 @@ export function CliDetail(t0) {
221
225
  className: "size-2"
222
226
  })
223
227
  })),
224
- onValueChange: id => rememberChatAccount(scopeId, provider.kind, id)
228
+ onValueChange: id => rememberChatAccount(scope.id, provider.kind, id)
225
229
  })
226
230
  }), provider.models.length > 0 && /*#__PURE__*/_jsx(SettingsRow, {
227
231
  searchId: "providers.defaults.model",
@@ -258,78 +262,68 @@ export function CliDetail(t0) {
258
262
  label: t("cli.defaults.usesCliDefault")
259
263
  })]
260
264
  });
261
- $[8] = defaults;
262
- $[9] = entries;
263
- $[10] = login;
264
- $[11] = machineAccounts;
265
- $[12] = model;
266
- $[13] = onAddAccount;
267
- $[14] = preferences;
268
- $[15] = provider;
269
- $[16] = scopeId;
270
- $[17] = selection?.options;
271
- $[18] = t;
272
- $[19] = canAddAccount;
265
+ $[8] = canAddAccount;
266
+ $[9] = canReorder;
267
+ $[10] = defaults;
268
+ $[11] = entries;
269
+ $[12] = machineAccounts;
270
+ $[13] = model;
271
+ $[14] = onAddAccount;
272
+ $[15] = preferences;
273
+ $[16] = provider;
274
+ $[17] = scope.id;
275
+ $[18] = selection?.options;
276
+ $[19] = t;
273
277
  $[20] = t3;
274
278
  $[21] = t4;
275
279
  } else {
276
- canAddAccount = $[19];
277
280
  t3 = $[20];
278
281
  t4 = $[21];
279
282
  }
280
283
  let t5;
281
- if ($[38] !== canAddAccount || $[39] !== entries || $[40] !== login || $[41] !== onPickAccount || $[42] !== provider.name || $[43] !== t) {
284
+ if ($[38] !== canAddAccount || $[39] !== entries || $[40] !== host || $[41] !== login || $[42] !== onPickAccount || $[43] !== ordered || $[44] !== provider.kind || $[45] !== provider.name || $[46] !== scope || $[47] !== t) {
282
285
  t5 = entries === null ? /*#__PURE__*/_jsx("p", {
283
286
  className: "text-xs text-text-faint",
284
287
  children: t("list.noAccounts")
285
288
  }) : /*#__PURE__*/_jsx(SettingsSection, {
286
289
  title: t("cli.accounts"),
290
+ description: ordered ? t("cli.accountsOrder") : undefined,
287
291
  footer: canAddAccount ? undefined : t("cli.onlyDefault", {
288
292
  provider: provider.name
289
293
  }),
290
- children: entries.map(entry_3 => {
291
- const status = accountStatusLine(entry_3.status, login === "terminal");
292
- return /*#__PURE__*/_jsxs("button", {
293
- type: "button",
294
- className: "flex w-full min-w-0 items-center gap-3 px-4.5 py-3 text-left first:rounded-t-xl last:rounded-b-xl hover:bg-surface-hover",
295
- onClick: () => onPickAccount(entry_3.id),
296
- children: [/*#__PURE__*/_jsx(AccountDot, {
297
- color: entry_3.account.color
298
- }), /*#__PURE__*/_jsx("span", {
299
- className: "min-w-0 grow truncate text-sm text-text",
300
- children: accountName(entry_3, provider.name)
301
- }), /*#__PURE__*/_jsx("span", {
302
- className: `shrink-0 text-xs ${ACCOUNT_TONE_CLASSES[status.tone]}`,
303
- children: status.text
304
- }), /*#__PURE__*/_jsx(Icon, {
305
- icon: ChevronRight,
306
- size: 14,
307
- className: "shrink-0 text-text-faint"
308
- })]
309
- }, entry_3.id);
294
+ children: /*#__PURE__*/_jsx(AccountOrderList, {
295
+ entries: entries,
296
+ providerName: provider.name,
297
+ login: login,
298
+ onReorder: ordered ? ids => void reorderAccounts(scope, host, provider.kind, ids) : null,
299
+ onPickAccount: onPickAccount
310
300
  })
311
301
  });
312
302
  $[38] = canAddAccount;
313
303
  $[39] = entries;
314
- $[40] = login;
315
- $[41] = onPickAccount;
316
- $[42] = provider.name;
317
- $[43] = t;
318
- $[44] = t5;
304
+ $[40] = host;
305
+ $[41] = login;
306
+ $[42] = onPickAccount;
307
+ $[43] = ordered;
308
+ $[44] = provider.kind;
309
+ $[45] = provider.name;
310
+ $[46] = scope;
311
+ $[47] = t;
312
+ $[48] = t5;
319
313
  } else {
320
- t5 = $[44];
314
+ t5 = $[48];
321
315
  }
322
316
  let t6;
323
- if ($[45] !== t3 || $[46] !== t4 || $[47] !== t5) {
317
+ if ($[49] !== t3 || $[50] !== t4 || $[51] !== t5) {
324
318
  t6 = /*#__PURE__*/_jsxs(_Fragment, {
325
319
  children: [t3, t4, t5]
326
320
  });
327
- $[45] = t3;
328
- $[46] = t4;
329
- $[47] = t5;
330
- $[48] = t6;
321
+ $[49] = t3;
322
+ $[50] = t4;
323
+ $[51] = t5;
324
+ $[52] = t6;
331
325
  } else {
332
- t6 = $[48];
326
+ t6 = $[52];
333
327
  }
334
328
  return t6;
335
329
  }
@@ -4,5 +4,6 @@ import type { ChatScope } from '../scope.js';
4
4
  export declare function saveAccounts(scope: ChatScope, host: Pick<ChatHost, 'notify'>, accounts: ProviderAccountMap): Promise<boolean>;
5
5
  export declare function saveAccount(scope: ChatScope, host: Pick<ChatHost, 'notify'>, id: string, account: ProviderAccount): Promise<boolean>;
6
6
  export declare function removeAccount(scope: ChatScope, host: Pick<ChatHost, 'notify'>, id: string, kind: AgentKind): Promise<void>;
7
+ export declare function reorderAccounts(scope: ChatScope, host: Pick<ChatHost, 'notify'>, kind: AgentKind, ids: readonly string[]): Promise<void>;
7
8
  export declare function createAccount(scope: ChatScope, kind: AgentKind, label: string, color: string): Promise<string>;
8
9
  export declare function linkAccount(scope: ChatScope, id: string, account: ProviderAccount): Promise<void>;