@deepseek-harness-tui/dsh-tui 0.17.0 → 0.18.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 (186) hide show
  1. package/README.md +10 -8
  2. package/cli/adapters/dsh/index.mjs +2 -2
  3. package/guide/dsh-tui-guide/cli.en.md +1 -1
  4. package/guide/dsh-tui-guide/cli.md +1 -1
  5. package/guide/dsh-tui-guide/configuration.en.md +3 -2
  6. package/guide/dsh-tui-guide/configuration.md +3 -2
  7. package/guide/dsh-tui-guide/getting-started.en.md +6 -2
  8. package/guide/dsh-tui-guide/getting-started.md +4 -1
  9. package/guide/dsh-tui-guide/interaction.en.md +28 -7
  10. package/guide/dsh-tui-guide/interaction.md +17 -5
  11. package/guide/dsh-tui-guide/plugins.en.md +28 -7
  12. package/guide/dsh-tui-guide/plugins.md +18 -5
  13. package/guide/dsh-tui-guide/user-guide.en.md +29 -15
  14. package/guide/dsh-tui-guide/user-guide.md +20 -10
  15. package/lib/settings.json +3 -3
  16. package/lib/types/adapter/channel/ui-policy.d.ts +1 -0
  17. package/lib/types/adapter/channel/ui-policy.d.ts.map +1 -1
  18. package/lib/types/adapter/channel/ui-policy.js +1 -0
  19. package/lib/types/adapter/ports/channel-ui.d.ts +5 -0
  20. package/lib/types/adapter/ports/channel-ui.d.ts.map +1 -1
  21. package/lib/types/adapter/ports/channel-view.d.ts +3 -0
  22. package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
  23. package/lib/types/adapter/standard/grants.d.ts +60 -0
  24. package/lib/types/adapter/standard/grants.d.ts.map +1 -1
  25. package/lib/types/adapter/standard/grants.js +74 -0
  26. package/lib/types/agent/events.d.ts +7 -1
  27. package/lib/types/agent/events.d.ts.map +1 -1
  28. package/lib/types/commands.js +1 -1
  29. package/lib/types/components/GoalTodoPanel.d.ts +71 -6
  30. package/lib/types/components/GoalTodoPanel.d.ts.map +1 -1
  31. package/lib/types/components/GoalTodoPanel.js +165 -17
  32. package/lib/types/components/MessageList.d.ts.map +1 -1
  33. package/lib/types/components/MessageList.js +3 -2
  34. package/lib/types/components/PluginGrantList.d.ts +45 -0
  35. package/lib/types/components/PluginGrantList.d.ts.map +1 -0
  36. package/lib/types/components/PluginGrantList.js +126 -0
  37. package/lib/types/components/PluginInstallPane.d.ts.map +1 -1
  38. package/lib/types/components/PluginInstallPane.js +35 -6
  39. package/lib/types/components/PluginManagePane.d.ts.map +1 -1
  40. package/lib/types/components/PluginManagePane.js +65 -8
  41. package/lib/types/components/PromptInput.js +2 -2
  42. package/lib/types/components/SubagentDashboard.d.ts.map +1 -1
  43. package/lib/types/components/SubagentDashboard.js +10 -0
  44. package/lib/types/components/SubagentDetailScene.d.ts.map +1 -1
  45. package/lib/types/components/SubagentDetailScene.js +12 -0
  46. package/lib/types/components/messages/AssistantToolUseMessage.d.ts +2 -1
  47. package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
  48. package/lib/types/components/messages/AssistantToolUseMessage.js +11 -5
  49. package/lib/types/components/onboardingModel.d.ts +2 -2
  50. package/lib/types/components/onboardingModel.js +3 -3
  51. package/lib/types/components/onboardingProviderPlan.d.ts +110 -0
  52. package/lib/types/components/onboardingProviderPlan.d.ts.map +1 -0
  53. package/lib/types/components/onboardingProviderPlan.js +78 -0
  54. package/lib/types/components/sidePanel/btw/BtwComposer.d.ts +7 -0
  55. package/lib/types/components/sidePanel/btw/BtwComposer.d.ts.map +1 -1
  56. package/lib/types/components/sidePanel/btw/BtwComposer.js +16 -0
  57. package/lib/types/components/sidePanel/btw/BtwPanelAdapter.d.ts.map +1 -1
  58. package/lib/types/components/sidePanel/btw/BtwPanelAdapter.js +8 -1
  59. package/lib/types/components/sidePanel/btw/BtwThreadScene.d.ts +7 -1
  60. package/lib/types/components/sidePanel/btw/BtwThreadScene.d.ts.map +1 -1
  61. package/lib/types/components/sidePanel/btw/BtwThreadScene.js +8 -1
  62. package/lib/types/components/sidePanel/btw/useBtwComposerPaste.d.ts +30 -0
  63. package/lib/types/components/sidePanel/btw/useBtwComposerPaste.d.ts.map +1 -0
  64. package/lib/types/components/sidePanel/btw/useBtwComposerPaste.js +94 -0
  65. package/lib/types/components/sidePanel/builtinPanels.d.ts.map +1 -1
  66. package/lib/types/components/sidePanel/builtinPanels.js +14 -2
  67. package/lib/types/components/sidePanel/types.d.ts +2 -0
  68. package/lib/types/components/sidePanel/types.d.ts.map +1 -1
  69. package/lib/types/components/sidePanel/useSidePanel.d.ts.map +1 -1
  70. package/lib/types/components/sidePanel/useSidePanel.js +15 -1
  71. package/lib/types/dsh-adapter/backend/session.d.ts +7 -1
  72. package/lib/types/dsh-adapter/backend/session.d.ts.map +1 -1
  73. package/lib/types/dsh-adapter/backend/session.js +62 -6
  74. package/lib/types/dsh-adapter/backend/translate.d.ts.map +1 -1
  75. package/lib/types/dsh-adapter/backend/translate.js +9 -5
  76. package/lib/types/dsh-adapter/channel/agent-view-projection.d.ts +1 -1
  77. package/lib/types/dsh-adapter/channel/agent-view-projection.d.ts.map +1 -1
  78. package/lib/types/dsh-adapter/channel/agent-view-projection.js +3 -1
  79. package/lib/types/dsh-adapter/channel/composer-images.d.ts +2 -0
  80. package/lib/types/dsh-adapter/channel/composer-images.d.ts.map +1 -1
  81. package/lib/types/dsh-adapter/channel/composer-images.js +10 -2
  82. package/lib/types/dsh-adapter/channel/composer-mentions.d.ts.map +1 -1
  83. package/lib/types/dsh-adapter/channel/composer-mentions.js +22 -7
  84. package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts +1 -1
  85. package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts.map +1 -1
  86. package/lib/types/dsh-adapter/channel/context-bookkeeping.js +9 -5
  87. package/lib/types/dsh-adapter/channel/core/binding-feed.d.ts +6 -0
  88. package/lib/types/dsh-adapter/channel/core/binding-feed.d.ts.map +1 -1
  89. package/lib/types/dsh-adapter/channel/core/binding-feed.js +35 -1
  90. package/lib/types/dsh-adapter/channel/core/compose.d.ts +1 -1
  91. package/lib/types/dsh-adapter/channel/core/compose.d.ts.map +1 -1
  92. package/lib/types/dsh-adapter/channel/core/compose.js +5 -0
  93. package/lib/types/dsh-adapter/channel/input-actions.d.ts +2 -2
  94. package/lib/types/dsh-adapter/channel/input-actions.d.ts.map +1 -1
  95. package/lib/types/dsh-adapter/channel/input-actions.js +30 -0
  96. package/lib/types/dsh-adapter/channel/input-delivery.d.ts +1 -1
  97. package/lib/types/dsh-adapter/channel/input-delivery.d.ts.map +1 -1
  98. package/lib/types/dsh-adapter/channel/input-delivery.js +8 -4
  99. package/lib/types/dsh-adapter/channel/mentions.d.ts.map +1 -1
  100. package/lib/types/dsh-adapter/channel/mentions.js +21 -7
  101. package/lib/types/dsh-adapter/channel/paths.d.ts.map +1 -1
  102. package/lib/types/dsh-adapter/channel/paths.js +11 -9
  103. package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts +1 -1
  104. package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts.map +1 -1
  105. package/lib/types/dsh-adapter/channel/session-live-adoption.js +6 -1
  106. package/lib/types/dsh-adapter/channel/session-reset.d.ts.map +1 -1
  107. package/lib/types/dsh-adapter/channel/session-reset.js +3 -1
  108. package/lib/types/dsh-adapter/channel/session-resume.d.ts +1 -1
  109. package/lib/types/dsh-adapter/channel/session-resume.d.ts.map +1 -1
  110. package/lib/types/dsh-adapter/channel/session-resume.js +10 -3
  111. package/lib/types/dsh-adapter/channel/session-rewind.d.ts +1 -1
  112. package/lib/types/dsh-adapter/channel/session-rewind.d.ts.map +1 -1
  113. package/lib/types/dsh-adapter/channel/session-rewind.js +3 -1
  114. package/lib/types/dsh-adapter/channel/session-tree-actions.d.ts +1 -1
  115. package/lib/types/dsh-adapter/channel/session-tree-actions.d.ts.map +1 -1
  116. package/lib/types/dsh-adapter/channel/session-tree-actions.js +3 -1
  117. package/lib/types/dsh-adapter/contract.d.ts +4 -3
  118. package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
  119. package/lib/types/dsh-adapter/contract.js +6 -3
  120. package/lib/types/dsh-adapter/entry-slot.d.ts +6 -0
  121. package/lib/types/dsh-adapter/entry-slot.d.ts.map +1 -1
  122. package/lib/types/dsh-adapter/experimental-bundles.d.ts +3 -0
  123. package/lib/types/dsh-adapter/experimental-bundles.d.ts.map +1 -1
  124. package/lib/types/dsh-adapter/experimental-bundles.js +4 -0
  125. package/lib/types/dsh-adapter/grant-file.d.ts +70 -0
  126. package/lib/types/dsh-adapter/grant-file.d.ts.map +1 -0
  127. package/lib/types/dsh-adapter/grant-file.js +178 -0
  128. package/lib/types/dsh-adapter/host-access.d.ts +4 -0
  129. package/lib/types/dsh-adapter/host-access.d.ts.map +1 -1
  130. package/lib/types/dsh-adapter/host-access.js +54 -4
  131. package/lib/types/dsh-adapter/host-contract.d.ts +1 -1
  132. package/lib/types/dsh-adapter/host-contract.js +2 -2
  133. package/lib/types/dsh-adapter/host-dsh.js +3 -3
  134. package/lib/types/dsh-adapter/index.d.ts.map +1 -1
  135. package/lib/types/dsh-adapter/index.js +8 -5
  136. package/lib/types/dsh-adapter/panels.d.ts +7 -1
  137. package/lib/types/dsh-adapter/panels.d.ts.map +1 -1
  138. package/lib/types/dsh-adapter/plugin-declaration.d.ts +28 -0
  139. package/lib/types/dsh-adapter/plugin-declaration.d.ts.map +1 -1
  140. package/lib/types/dsh-adapter/plugin-declaration.js +43 -1
  141. package/lib/types/dsh-adapter/plugin-install.d.ts +28 -1
  142. package/lib/types/dsh-adapter/plugin-install.d.ts.map +1 -1
  143. package/lib/types/dsh-adapter/plugin-install.js +160 -13
  144. package/lib/types/dsh-adapter/plugin-manage.d.ts +53 -10
  145. package/lib/types/dsh-adapter/plugin-manage.d.ts.map +1 -1
  146. package/lib/types/dsh-adapter/plugin-manage.js +240 -51
  147. package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
  148. package/lib/types/dsh-adapter/plugin.js +64 -18
  149. package/lib/types/dsh-adapter/plugins-info.d.ts +6 -7
  150. package/lib/types/dsh-adapter/plugins-info.d.ts.map +1 -1
  151. package/lib/types/dsh-adapter/plugins-info.js +34 -21
  152. package/lib/types/dsh-adapter/presets.d.ts +6 -2
  153. package/lib/types/dsh-adapter/presets.d.ts.map +1 -1
  154. package/lib/types/dsh-adapter/presets.js +23 -5
  155. package/lib/types/dsh-adapter/process-exit.d.ts +1 -1
  156. package/lib/types/dsh-adapter/process-exit.js +1 -1
  157. package/lib/types/dsh-adapter/providerWizard.d.ts +2 -0
  158. package/lib/types/dsh-adapter/providerWizard.d.ts.map +1 -1
  159. package/lib/types/dsh-adapter/providerWizard.js +11 -5
  160. package/lib/types/dsh-adapter/row-attachment.d.ts +30 -0
  161. package/lib/types/dsh-adapter/row-attachment.d.ts.map +1 -0
  162. package/lib/types/dsh-adapter/row-attachment.js +29 -0
  163. package/lib/types/dsh-adapter/worktree-tool.d.ts +27 -0
  164. package/lib/types/dsh-adapter/worktree-tool.d.ts.map +1 -0
  165. package/lib/types/dsh-adapter/worktree-tool.js +87 -0
  166. package/lib/types/heldInputs.d.ts +36 -0
  167. package/lib/types/heldInputs.d.ts.map +1 -0
  168. package/lib/types/heldInputs.js +173 -0
  169. package/lib/types/i18n.d.ts +352 -25
  170. package/lib/types/i18n.d.ts.map +1 -1
  171. package/lib/types/i18n.js +171 -18
  172. package/lib/types/onboardingDraft.d.ts +143 -0
  173. package/lib/types/onboardingDraft.d.ts.map +1 -0
  174. package/lib/types/onboardingDraft.js +71 -0
  175. package/lib/types/screens/Chat.d.ts.map +1 -1
  176. package/lib/types/screens/Chat.js +90 -30
  177. package/lib/types/screens/Onboarding.d.ts +22 -3
  178. package/lib/types/screens/Onboarding.d.ts.map +1 -1
  179. package/lib/types/screens/Onboarding.js +606 -36
  180. package/lib/types/settings/definitions.js +2 -2
  181. package/lib/types/utils/paths.d.ts +15 -0
  182. package/lib/types/utils/paths.d.ts.map +1 -1
  183. package/lib/types/utils/paths.js +25 -0
  184. package/package.json +111 -108
  185. package/tui-profile/feed/README.md +1 -1
  186. package/tui-profile/feed/first-party.json +1 -1
@@ -149,6 +149,7 @@ import instances from '../ink/instances.js';
149
149
  import { useExternalVersion } from '../hooks/useExternalVersion.js';
150
150
  import { TrajectoryScene } from './TrajectoryScene.js';
151
151
  import { markHomeSeen } from '../homePrefs.js';
152
+ import { clearOnboardingDraft } from '../onboardingDraft.js';
152
153
  import { markOnboardingDone } from '../onboardingPrefs.js';
153
154
  import { Launchpad, launchpadVisible } from './Launchpad.js';
154
155
  import { resolveLaunchpadActions } from '../components/launchpadActions.js';
@@ -556,6 +557,77 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
556
557
  return ok;
557
558
  });
558
559
  };
560
+ /**
561
+ * The guide's access step needs two ACTIONS, and both of them already exist
562
+ * as flows Chat owns: the subscription sign-in (`runOAuthLogin` over the
563
+ * shared question panel — the same one `/login` uses on a backend session)
564
+ * and the `/provider` add flow. Chat hands them to the wizard as plain
565
+ * callbacks, so the screen keeps importing no adapter VALUES of its own and
566
+ * the question panel keeps exactly one owner.
567
+ *
568
+ * The catalog tail is the same consistency `/provider` performs: a sign-in
569
+ * flips a provider's credential-gated catalog from empty to full, so the
570
+ * model picker's cache, `models` and `providerInfos` must be re-read.
571
+ */
572
+ const refreshProviderCatalog = React.useCallback(() => {
573
+ channel.invalidateModelCompletion();
574
+ const generation = ++modelCatalogGeneration.current;
575
+ void channel.listModels().then((list) => {
576
+ if (generation === modelCatalogGeneration.current)
577
+ setModels(list);
578
+ }).catch(() => undefined);
579
+ void channel.listProviders().then((list) => {
580
+ if (generation === modelCatalogGeneration.current)
581
+ setProviderInfos(list);
582
+ }).catch(() => {
583
+ if (generation === modelCatalogGeneration.current)
584
+ setProviderInfos([]);
585
+ });
586
+ }, [channel]);
587
+ const onboardingSignIn = React.useCallback((provider) => {
588
+ const oauth = channel.providerSetup()?.oauth;
589
+ if (oauth === undefined) {
590
+ channel.notify(t('provider-oauth-unmounted', { provider }), { color: 'warning', timeoutMs: 8000 });
591
+ return Promise.resolve('failed');
592
+ }
593
+ return runOAuthLogin({
594
+ ask: (request, options) => questionStore.ask(request, options),
595
+ notify: (text, options) => channel.notify(text, options),
596
+ pushLocal: (title, lines) => channel.pushLocal(title, lines),
597
+ }, oauth, provider).then((outcome) => {
598
+ // A sign-out empties that provider's catalog just as a sign-in fills it.
599
+ if (outcome === 'added' || outcome === 'signed-out')
600
+ refreshProviderCatalog();
601
+ return outcome;
602
+ }).catch(() => 'failed');
603
+ }, [channel, questionStore, refreshProviderCatalog]);
604
+ /** `/provider` and the guide's add-provider action: one wizard wiring, one catalog tail. */
605
+ const runProviderSetup = React.useCallback(() => {
606
+ const host = channel.providerSetup();
607
+ if (host === undefined) {
608
+ channel.notify(t('provider-unavailable'), { color: 'warning', timeoutMs: 8000 });
609
+ return Promise.resolve('failed');
610
+ }
611
+ return runProviderWizard({
612
+ host,
613
+ ask: (request, options) => questionStore.ask(request, options),
614
+ notify: (text, options) => channel.notify(text, options),
615
+ pushLocal: (title, lines) => channel.pushLocal(title, lines),
616
+ working: () => channel.working,
617
+ switchModel: (provider, model) => switchModelRecorded(provider, model),
618
+ currentModel: () => channel.model,
619
+ }).then((outcome) => {
620
+ // A catalog-changing outcome invalidates every cached model surface so
621
+ // `/model` (picker + completion) reflects it immediately; the wizard's
622
+ // live-switch branch already dropped the completion cache via
623
+ // switchModelRecorded — this covers keep-current, add, edit, delete and
624
+ // OAuth login/logout.
625
+ if (outcome === 'added' || outcome === 'updated' || outcome === 'deleted' || outcome === 'signed-out') {
626
+ refreshProviderCatalog();
627
+ }
628
+ return outcome;
629
+ }).catch(() => 'failed');
630
+ }, [channel, questionStore, refreshProviderCatalog, switchModelRecorded]);
559
631
  const modelPicker = useModelPicker({
560
632
  channel, models, providers: providerInfos, recents: modelProviderTabs ? modelRecents : undefined, open: overlay.kind === 'model',
561
633
  onCancel: () => dispatchOverlay({ type: 'close-if', kind: 'model' }),
@@ -1621,6 +1693,9 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
1621
1693
  */
1622
1694
  const closeOnboarding = React.useCallback((outcome) => {
1623
1695
  setOnboardingOpen(false);
1696
+ // The guide's in-process progress (step, diff baseline, in-flight action)
1697
+ // is only meaningful while it is on screen; a later `/setup` starts fresh.
1698
+ clearOnboardingDraft();
1624
1699
  if (outcome === 'done') {
1625
1700
  const written = markOnboardingDone();
1626
1701
  setOnboardingPending(false);
@@ -3075,36 +3150,10 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
3075
3150
  // Interactive add-provider wizard (/provider): drives the shared
3076
3151
  // question panel, persists profile + key via the channel's settings/
3077
3152
  // credentials seams. No picker state — AskUserQuestionPanel renders it.
3153
+ // The wizard notifies on every handled failure, and the runner never
3154
+ // rejects.
3078
3155
  setHelpOpen(false);
3079
- const host = channel.providerSetup();
3080
- if (!host) {
3081
- channel.notify(t('provider-unavailable'), { color: 'warning', timeoutMs: 8000 });
3082
- return true;
3083
- }
3084
- void runProviderWizard({
3085
- host,
3086
- ask: (request, options) => questionStore.ask(request, options),
3087
- notify: (text, options) => channel.notify(text, options),
3088
- pushLocal: (title, lines) => channel.pushLocal(title, lines),
3089
- working: () => channel.working,
3090
- switchModel: (provider, model) => switchModelRecorded(provider, model),
3091
- }).then((outcome) => {
3092
- // A catalog-changing outcome invalidates every cached model surface
3093
- // so `/model` (picker + completion) reflects it immediately — the
3094
- // same consistency the picker's per-open refetch provides, minus
3095
- // the stale flash on the next open. The wizard's live-switch branch
3096
- // already dropped the completion cache via switchModelRecorded;
3097
- // this covers keep-current, add, edit, delete and OAuth login/logout.
3098
- if (outcome === 'added' || outcome === 'updated'
3099
- || outcome === 'deleted' || outcome === 'signed-out') {
3100
- channel.invalidateModelCompletion();
3101
- void channel.listModels().then(setModels);
3102
- void channel.listProviders().then(setProviderInfos).catch(() => setProviderInfos([]));
3103
- }
3104
- }).catch(() => {
3105
- // The wizard notifies on every handled failure; this only swallows
3106
- // an unexpected reject so it never surfaces as an unhandled promise.
3107
- });
3156
+ void runProviderSetup();
3108
3157
  return true;
3109
3158
  }
3110
3159
  case 'thinking':
@@ -5233,6 +5282,17 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
5233
5282
  event.stopImmediatePropagation();
5234
5283
  }
5235
5284
  }
5285
+ else if (view.step.kind === 'grant') {
5286
+ // registry 装后补授:Enter 写入清单,Esc 跳过(安装保留,浮层收起)。
5287
+ if (plainReturn) {
5288
+ pluginInstall.run(view.flow.grant());
5289
+ event.stopImmediatePropagation();
5290
+ }
5291
+ else if (key.escape) {
5292
+ pluginInstall.close();
5293
+ event.stopImmediatePropagation();
5294
+ }
5295
+ }
5236
5296
  else if (view.step.kind === 'build-blocked') {
5237
5297
  if (plainReturn) {
5238
5298
  pluginInstall.run(view.flow.approve(view.step.builds));
@@ -6028,7 +6088,7 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
6028
6088
  * the user lands on the launcher.
6029
6089
  */
6030
6090
  if (onboardingOpen) {
6031
- const node = (_jsx(Onboarding, { channel: channel, themeHost: themeHost, onClose: closeOnboarding, onApplyLang: applyLang, onRunCommand: (name) => {
6091
+ const node = (_jsx(Onboarding, { channel: channel, themeHost: themeHost, onClose: closeOnboarding, onApplyLang: applyLang, onProviderSignIn: onboardingSignIn, onProviderAddProvider: runProviderSetup, onRunCommand: (name) => {
6032
6092
  // 与落地页的 onAction 同一条规则:打开整屏界面的命令要先把向导收掉。
6033
6093
  // 走 `closeOnboarding('skipped')` 而不是直接置 false——用户是去试命令、
6034
6094
  // 没答完引导,按 skipped 的口径不记账(下次启动还会问)。
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { type Lang } from '../i18n.js';
3
3
  import type { ChannelUi as Channel } from '../adapter/channel/ui-policy.js';
4
+ import type { ProviderWizardOutcome } from '../dsh-adapter/providerWizard.js';
4
5
  import type { TuiThemeHost } from '../dsh-adapter/themes.js';
5
6
  /**
6
7
  * Onboarding —— 首次运行的引导向导(`~/.dsh-tui/onboarding.json` 走一次性记账)。
@@ -15,8 +16,15 @@ import type { TuiThemeHost } from '../dsh-adapter/themes.js';
15
16
  *
16
17
  * **凭证永远只报"有没有",不报值**:`describeCredential` 回的是不含秘密的
17
18
  * 元数据,界面上也照它的原样画。
19
+ *
20
+ * 第一步(账号与模型接入)会把**动作**交给 Chat 执行:订阅登录与 `/provider`
21
+ * 的 key 流程都要用共享问答面板(设备码、授权 URL、密钥输入),而那套面板
22
+ * 归 Chat 的 `questionStore`。面板挂起时本屏会被卸载、回答后重挂,所以进度
23
+ * 落在 `src/onboardingDraft.ts`(模块级,不是 React state)——挂载时读回,
24
+ * 动作回来时按"动作前的目录基线"做差分:订阅登录按 0/1/N 决定是否问默认模型,
25
+ * 加 key 只报结果(向导已经问过)。
18
26
  */
19
- export declare function Onboarding({ channel, themeHost, onClose, onRunCommand, onApplyLang, initialStep, externalNotice, }: {
27
+ export declare function Onboarding({ channel, themeHost, onClose, onRunCommand, onApplyLang, onProviderSignIn, onProviderAddProvider, initialStep, externalNotice, }: {
20
28
  channel: Channel;
21
29
  themeHost?: TuiThemeHost;
22
30
  /** 跳过 / 完成:把状态交回 Chat(它负责记账与切屏)。 */
@@ -29,8 +37,19 @@ export declare function Onboarding({ channel, themeHost, onClose, onRunCommand,
29
37
  * 优先级(env > cordis.yml > 持久化)只有 Chat 手里那一份。
30
38
  */
31
39
  onApplyLang: (lang: Lang) => void;
32
- /** 测试缝:直接落在某一步(探针不重复走前几步)。 */
33
- initialStep?: number;
40
+ /**
41
+ * 订阅账号登录(第一步的动作行):Chat 用既有的 `runOAuthLogin` +
42
+ * `questionStore` 跑完整个 OAuth 流程,只把结果交回来。返回值口径与
43
+ * `/provider` 的 `ProviderWizardOutcome` 一致。
44
+ */
45
+ onProviderSignIn?: (provider: string) => Promise<ProviderWizardOutcome>;
46
+ /**
47
+ * "添加模型提供方(API key)":Chat 用既有的 `runProviderWizard` 跑
48
+ * `/provider` 的 add 流程(route / 端点 / key / 模型多选 / 回滚都在那里)。
49
+ */
50
+ onProviderAddProvider?: () => Promise<ProviderWizardOutcome>;
51
+ /** 测试缝:直接落在某一步(探针不重复走前几步;不给则从 draft 恢复)。 */
52
+ initialStep?: number | undefined;
34
53
  /** 测试缝:外部注入一句提示(真机不传)。 */
35
54
  externalNotice?: string;
36
55
  }): React.ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"Onboarding.d.ts","sourceRoot":"","sources":["../../../src/screens/Onboarding.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAYzB,OAAO,EAAqB,KAAK,IAAI,EAAE,MAAM,YAAY,CAAA;AAkBzD,OAAO,KAAK,EAAE,SAAS,IAAI,OAAO,EAAE,MAAM,iCAAiC,CAAA;AAG3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAqC5D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,SAAS,EACT,OAAO,EACP,YAAY,EACZ,WAAW,EACX,WAAe,EACf,cAAc,GACf,EAAE;IACD,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,CAAC,EAAE,YAAY,CAAA;IACxB,oCAAoC;IACpC,OAAO,EAAE,CAAC,OAAO,EAAE,SAAS,GAAG,MAAM,KAAK,IAAI,CAAA;IAC9C,0DAA0D;IAC1D,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC;;;;OAIG;IACH,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAA;IACjC,8BAA8B;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,0BAA0B;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,GAAG,KAAK,CAAC,SAAS,CAydlB"}
1
+ {"version":3,"file":"Onboarding.d.ts","sourceRoot":"","sources":["../../../src/screens/Onboarding.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAYzB,OAAO,EAAqB,KAAK,IAAI,EAAE,MAAM,YAAY,CAAA;AAmCzD,OAAO,KAAK,EAAE,SAAS,IAAI,OAAO,EAAE,MAAM,iCAAiC,CAAA;AAI3E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAgG5D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,SAAS,EACT,OAAO,EACP,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,qBAAqB,EACrB,WAAW,EACX,cAAc,GACf,EAAE;IACD,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,CAAC,EAAE,YAAY,CAAA;IACxB,oCAAoC;IACpC,OAAO,EAAE,CAAC,OAAO,EAAE,SAAS,GAAG,MAAM,KAAK,IAAI,CAAA;IAC9C,0DAA0D;IAC1D,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC;;;;OAIG;IACH,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAA;IACjC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAA;IACvE;;;OAGG;IACH,qBAAqB,CAAC,EAAE,MAAM,OAAO,CAAC,qBAAqB,CAAC,CAAA;IAC5D,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,0BAA0B;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,GAAG,KAAK,CAAC,SAAS,CAy+BlB"}