@ycodium-ai/plugin-api 0.2.5634 → 0.2.5751
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -65
- package/dist/_private/ycodium-attachment-kinds/chatAttachmentKinds.d.ts +34 -0
- package/dist/_private/ycodium-attachment-kinds/chatAttachmentKinds.js +70 -0
- package/dist/_private/ycodium-attachment-kinds/mediaKinds.d.ts +23 -0
- package/dist/_private/ycodium-attachment-kinds/mediaKinds.js +73 -0
- package/dist/_private/ycodium-composer-tokens/approvalFileChanges.d.ts +20 -0
- package/dist/_private/ycodium-composer-tokens/approvalFileChanges.js +45 -0
- package/dist/_private/ycodium-composer-tokens/composerFileLink.d.ts +1 -0
- package/dist/_private/ycodium-composer-tokens/composerFileLink.js +20 -0
- package/dist/_private/ycodium-composer-tokens/composerInlineTokens.d.ts +17 -0
- package/dist/_private/ycodium-composer-tokens/composerInlineTokens.js +91 -0
- package/dist/_private/ycodium-composer-tokens/composerLogic.d.ts +30 -0
- package/dist/_private/ycodium-composer-tokens/composerLogic.js +181 -0
- package/dist/_private/ycodium-composer-tokens/composerMentionDrag.d.ts +40 -0
- package/dist/_private/ycodium-composer-tokens/composerMentionDrag.js +60 -0
- package/dist/_private/ycodium-composer-tokens/composerPromptSegments.d.ts +16 -0
- package/dist/_private/ycodium-composer-tokens/composerPromptSegments.js +142 -0
- package/dist/_private/ycodium-composer-tokens/composerTrigger.d.ts +18 -0
- package/dist/_private/ycodium-composer-tokens/composerTrigger.js +44 -0
- package/dist/_private/ycodium-composer-tokens/contextWindowFormat.d.ts +2 -0
- package/dist/_private/ycodium-composer-tokens/contextWindowFormat.js +16 -0
- package/dist/_private/ycodium-composer-tokens/diffCount.d.ts +2 -0
- package/dist/_private/ycodium-composer-tokens/diffCount.js +15 -0
- package/dist/_private/ycodium-composer-tokens/pendingUserInput.d.ts +48 -0
- package/dist/_private/ycodium-composer-tokens/pendingUserInput.js +145 -0
- package/dist/_private/ycodium-composer-tokens/promptContextBlocks.d.ts +58 -0
- package/dist/_private/ycodium-composer-tokens/promptContextBlocks.js +121 -0
- package/dist/_private/ycodium-composer-tokens/proposedPlan.d.ts +21 -0
- package/dist/_private/ycodium-composer-tokens/proposedPlan.js +106 -0
- package/dist/_private/ycodium-composer-tokens/providerSkillSearch.d.ts +3 -0
- package/dist/_private/ycodium-composer-tokens/providerSkillSearch.js +79 -0
- package/dist/_private/ycodium-composer-tokens/providerSkills.d.ts +17 -0
- package/dist/_private/ycodium-composer-tokens/providerSkills.js +57 -0
- package/dist/_private/ycodium-composer-tokens/queueEntry.d.ts +31 -0
- package/dist/_private/ycodium-composer-tokens/queueEntry.js +44 -0
- package/dist/_private/ycodium-composer-tokens/reviewCommentBlocks.d.ts +29 -0
- package/dist/_private/ycodium-composer-tokens/reviewCommentBlocks.js +118 -0
- package/dist/_private/ycodium-composer-tokens/searchRanking.d.ts +27 -0
- package/dist/_private/ycodium-composer-tokens/searchRanking.js +129 -0
- package/dist/_private/ycodium-composer-tokens/skillTokens.d.ts +101 -0
- package/dist/_private/ycodium-composer-tokens/skillTokens.js +148 -0
- package/dist/_private/ycodium-composer-tokens/slashMenu.d.ts +130 -0
- package/dist/_private/ycodium-composer-tokens/slashMenu.js +175 -0
- package/dist/_private/ycodium-composer-tokens/userInputOptionText.d.ts +33 -0
- package/dist/_private/ycodium-composer-tokens/userInputOptionText.js +27 -0
- package/dist/_private/ycodium-credential-account/credentialAccount.d.ts +21 -0
- package/dist/_private/ycodium-credential-account/credentialAccount.js +62 -0
- package/dist/_private/ycodium-credential-account/quotaJson.d.ts +12 -0
- package/dist/_private/ycodium-credential-account/quotaJson.js +14 -0
- package/dist/_private/ycodium-credential-account/quotaRequest.d.ts +32 -0
- package/dist/_private/ycodium-credential-account/quotaRequest.js +60 -0
- package/dist/_private/ycodium-day-format/dayFormat.d.ts +31 -0
- package/dist/_private/ycodium-day-format/dayFormat.js +32 -0
- package/dist/_private/ycodium-day-format/timestampFormat.d.ts +35 -0
- package/dist/_private/ycodium-day-format/timestampFormat.js +119 -0
- package/dist/_private/ycodium-decision-order/decisionOrder.d.ts +19 -0
- package/dist/_private/ycodium-decision-order/decisionOrder.js +38 -0
- package/dist/_private/ycodium-diff-format/diffRendering.d.ts +42 -0
- package/dist/_private/ycodium-diff-format/diffRendering.js +171 -0
- package/dist/_private/ycodium-duration-format/durationFormat.d.ts +20 -0
- package/dist/_private/ycodium-duration-format/durationFormat.js +56 -0
- package/dist/_private/ycodium-fetch-ports/fetchPorts.d.ts +36 -0
- package/dist/_private/ycodium-fetch-ports/fetchPorts.js +69 -0
- package/dist/_private/ycodium-fetch-ports/netFault.d.ts +10 -0
- package/dist/_private/ycodium-fetch-ports/netFault.js +17 -0
- package/dist/_private/ycodium-full-access-mode/fullAccessNativeMode.d.ts +28 -0
- package/dist/_private/ycodium-full-access-mode/fullAccessNativeMode.js +30 -0
- package/dist/_private/ycodium-instance-config/homePath.d.ts +34 -0
- package/dist/_private/ycodium-instance-config/homePath.js +85 -0
- package/dist/_private/ycodium-instance-config/instanceConfig.d.ts +46 -0
- package/dist/_private/ycodium-instance-config/instanceConfig.js +111 -0
- package/dist/_private/ycodium-instance-config/launchArgs.d.ts +5 -0
- package/dist/_private/ycodium-instance-config/launchArgs.js +65 -0
- package/dist/_private/ycodium-instance-config/probeProcess.d.ts +39 -0
- package/dist/_private/ycodium-instance-config/probeProcess.js +55 -0
- package/dist/_private/ycodium-instance-config/programHomeSchema.d.ts +44 -0
- package/dist/_private/ycodium-instance-config/programHomeSchema.js +60 -0
- package/dist/_private/ycodium-instance-config/tomlScalar.d.ts +5 -0
- package/dist/_private/ycodium-instance-config/tomlScalar.js +11 -0
- package/dist/_private/ycodium-jsonl-stream/appendedJsonl.d.ts +47 -0
- package/dist/_private/ycodium-jsonl-stream/appendedJsonl.js +172 -0
- package/dist/_private/ycodium-jsonl-stream/claudeSessions.d.ts +63 -0
- package/dist/_private/ycodium-jsonl-stream/claudeSessions.js +220 -0
- package/dist/_private/ycodium-jsonl-stream/codexSessions.d.ts +41 -0
- package/dist/_private/ycodium-jsonl-stream/codexSessions.js +197 -0
- package/dist/_private/ycodium-jsonl-stream/history.d.ts +6 -0
- package/dist/_private/ycodium-jsonl-stream/history.js +389 -0
- package/dist/_private/ycodium-jsonl-stream/historyErrors.d.ts +6 -0
- package/dist/_private/ycodium-jsonl-stream/historyErrors.js +6 -0
- package/dist/_private/ycodium-jsonl-stream/historyFile.d.ts +19 -0
- package/dist/_private/ycodium-jsonl-stream/historyFile.js +117 -0
- package/dist/_private/ycodium-jsonl-stream/historyRecord.d.ts +31 -0
- package/dist/_private/ycodium-jsonl-stream/historyRecord.js +144 -0
- package/dist/_private/ycodium-jsonl-stream/historyWaiting.d.ts +8 -0
- package/dist/_private/ycodium-jsonl-stream/historyWaiting.js +142 -0
- package/dist/_private/ycodium-jsonl-stream/jsonObjectLine.d.ts +5 -0
- package/dist/_private/ycodium-jsonl-stream/jsonObjectLine.js +18 -0
- package/dist/_private/ycodium-jsonl-stream/jsonlStream.d.ts +79 -0
- package/dist/_private/ycodium-jsonl-stream/jsonlStream.js +603 -0
- package/dist/_private/ycodium-jsonl-stream/scanCache.d.ts +69 -0
- package/dist/_private/ycodium-jsonl-stream/scanCache.js +106 -0
- package/dist/_private/ycodium-jsonl-stream/sessionDirectory.d.ts +5 -0
- package/dist/_private/ycodium-jsonl-stream/sessionDirectory.js +32 -0
- package/dist/_private/ycodium-jsonl-stream/sessionTranscript.d.ts +16 -0
- package/dist/_private/ycodium-jsonl-stream/sessionTranscript.js +112 -0
- package/dist/_private/ycodium-jsonl-stream/usageFields.d.ts +5 -0
- package/dist/_private/ycodium-jsonl-stream/usageFields.js +11 -0
- package/dist/_private/ycodium-markdown-fence/markdownFence.d.ts +6 -0
- package/dist/_private/ycodium-markdown-fence/markdownFence.js +24 -0
- package/dist/_private/ycodium-source-control/pullRequestScope.d.ts +23 -0
- package/dist/_private/ycodium-source-control/pullRequestScope.js +29 -0
- package/dist/_private/ycodium-sse-stream/sseStream.d.ts +37 -0
- package/dist/_private/ycodium-sse-stream/sseStream.js +104 -0
- package/dist/_private/ycodium-system-text/memberInstructions.d.ts +13 -0
- package/dist/_private/ycodium-system-text/memberInstructions.js +9 -0
- package/dist/_private/ycodium-system-text/systemText.d.ts +179 -0
- package/dist/_private/ycodium-system-text/systemText.js +257 -0
- package/dist/_private/ycodium-system-text/threadPreset.d.ts +18 -0
- package/dist/_private/ycodium-system-text/threadPreset.js +21 -0
- package/dist/_private/ycodium-text-generation/branchName.d.ts +6 -0
- package/dist/_private/ycodium-text-generation/branchName.js +26 -0
- package/dist/_private/ycodium-text-generation/prompts.d.ts +70 -0
- package/dist/_private/ycodium-text-generation/prompts.js +266 -0
- package/dist/_private/ycodium-text-generation/sanitize.d.ts +10 -0
- package/dist/_private/ycodium-text-generation/sanitize.js +124 -0
- package/dist/_private/ycodium-text-generation/structuredTextGeneration.d.ts +29 -0
- package/dist/_private/ycodium-text-generation/structuredTextGeneration.js +163 -0
- package/dist/_private/ycodium-tool-label/toolLabel.d.ts +42 -0
- package/dist/_private/ycodium-tool-label/toolLabel.js +249 -0
- package/dist/_private/ycodium-ui-hooks/DiffStatCounts.d.ts +22 -0
- package/dist/_private/ycodium-ui-hooks/DiffStatCounts.js +22 -0
- package/dist/_private/ycodium-ui-hooks/ProviderSignInChallenge.d.ts +29 -0
- package/dist/_private/ycodium-ui-hooks/ProviderSignInChallenge.js +13 -0
- package/dist/_private/ycodium-ui-hooks/RenderErrorBoundary.d.ts +28 -0
- package/dist/_private/ycodium-ui-hooks/RenderErrorBoundary.js +22 -0
- package/dist/_private/ycodium-ui-hooks/RuntimeMaintenanceActions.d.ts +19 -0
- package/dist/_private/ycodium-ui-hooks/RuntimeMaintenanceActions.js +7 -0
- package/dist/_private/ycodium-ui-hooks/SkillInlineText.d.ts +13 -0
- package/dist/_private/ycodium-ui-hooks/SkillInlineText.js +13 -0
- package/dist/_private/ycodium-ui-hooks/bundleStyle.d.ts +4 -0
- package/dist/_private/ycodium-ui-hooks/bundleStyle.js +52 -0
- package/dist/_private/ycodium-ui-hooks/catalogKeys.d.ts +9 -0
- package/dist/_private/ycodium-ui-hooks/catalogKeys.js +1 -0
- package/dist/_private/ycodium-ui-hooks/clipboard.d.ts +22 -0
- package/dist/_private/ycodium-ui-hooks/clipboard.js +149 -0
- package/dist/_private/ycodium-ui-hooks/hostControls.d.ts +24 -0
- package/dist/_private/ycodium-ui-hooks/hostControls.js +25 -0
- package/dist/_private/ycodium-ui-hooks/inlineChips.d.ts +50 -0
- package/dist/_private/ycodium-ui-hooks/inlineChips.js +32 -0
- package/dist/_private/ycodium-ui-hooks/notifyMessages.d.ts +20 -0
- package/dist/_private/ycodium-ui-hooks/notifyMessages.js +26 -0
- package/dist/_private/ycodium-ui-hooks/presenterInputState.d.ts +52 -0
- package/dist/_private/ycodium-ui-hooks/presenterInputState.js +240 -0
- package/dist/_private/ycodium-ui-hooks/processRowHeader.d.ts +6 -0
- package/dist/_private/ycodium-ui-hooks/processRowHeader.js +6 -0
- package/dist/_private/ycodium-ui-hooks/timelineDisclosure.d.ts +5 -0
- package/dist/_private/ycodium-ui-hooks/timelineDisclosure.js +73 -0
- package/dist/_private/ycodium-ui-hooks/useMediaQuery.d.ts +20 -0
- package/dist/_private/ycodium-ui-hooks/useMediaQuery.js +70 -0
- package/dist/_private/ycodium-ui-hooks/workEntryIcons.d.ts +25 -0
- package/dist/_private/ycodium-ui-hooks/workEntryIcons.js +66 -0
- package/dist/_private/ycodium-workspace-path/directoryScope.d.ts +5 -0
- package/dist/_private/ycodium-workspace-path/directoryScope.js +28 -0
- package/dist/_private/ycodium-workspace-path/workspacePath.d.ts +19 -0
- package/dist/_private/ycodium-workspace-path/workspacePath.js +90 -0
- package/dist/cache.d.ts.map +1 -1
- package/dist/cache.js.map +1 -1
- package/dist/capabilityPorts.d.ts.map +1 -1
- package/dist/capabilityPorts.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js.map +1 -1
- package/dist/communication-view.d.ts.map +1 -1
- package/dist/communication-view.js.map +1 -1
- package/dist/communication.d.ts.map +1 -1
- package/dist/communication.js.map +1 -1
- package/dist/composer-control.d.ts.map +1 -1
- package/dist/composer-control.js.map +1 -1
- package/dist/composer.d.ts +22 -0
- package/dist/composer.d.ts.map +1 -0
- package/dist/composer.js +22 -0
- package/dist/composer.js.map +1 -0
- package/dist/conversation-queue.d.ts.map +1 -1
- package/dist/conversation-queue.js.map +1 -1
- package/dist/conversation-view.d.ts.map +1 -1
- package/dist/conversation-view.js.map +1 -1
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js.map +1 -1
- package/dist/conversationAttachments.d.ts.map +1 -1
- package/dist/conversationAttachments.js.map +1 -1
- package/dist/conversationBase.d.ts.map +1 -1
- package/dist/conversationBase.js.map +1 -1
- package/dist/conversationComposerApi.d.ts.map +1 -1
- package/dist/conversationComposerApi.js.map +1 -1
- package/dist/conversationComposerEnvironment.d.ts.map +1 -1
- package/dist/conversationComposerEnvironment.js.map +1 -1
- package/dist/conversationComposerHandle.d.ts.map +1 -1
- package/dist/conversationComposerHandle.js.map +1 -1
- package/dist/conversationComposerParts.d.ts.map +1 -1
- package/dist/conversationComposerParts.js.map +1 -1
- package/dist/conversationDerive.d.ts.map +1 -1
- package/dist/conversationDerive.js.map +1 -1
- package/dist/conversationDrafts.d.ts.map +1 -1
- package/dist/conversationDrafts.js.map +1 -1
- package/dist/conversationForks.d.ts.map +1 -1
- package/dist/conversationForks.js.map +1 -1
- package/dist/conversationHostModels.d.ts.map +1 -1
- package/dist/conversationHostModels.js.map +1 -1
- package/dist/conversationLoadFailure.d.ts.map +1 -1
- package/dist/conversationLoadFailure.js.map +1 -1
- package/dist/conversationMemberMentions.d.ts.map +1 -1
- package/dist/conversationMemberMentions.js.map +1 -1
- package/dist/conversationMessageLinks.d.ts.map +1 -1
- package/dist/conversationMessageLinks.js.map +1 -1
- package/dist/conversationMessageMemory.d.ts.map +1 -1
- package/dist/conversationMessageMemory.js.map +1 -1
- package/dist/conversationPresets.d.ts.map +1 -1
- package/dist/conversationPresets.js.map +1 -1
- package/dist/conversationRows.d.ts.map +1 -1
- package/dist/conversationRows.js.map +1 -1
- package/dist/conversationSessionMessage.d.ts.map +1 -1
- package/dist/conversationSessionMessage.js.map +1 -1
- package/dist/conversationSkills.d.ts.map +1 -1
- package/dist/conversationSkills.js.map +1 -1
- package/dist/conversationTrajectory.d.ts.map +1 -1
- package/dist/conversationTrajectory.js.map +1 -1
- package/dist/conversationTranscript.d.ts.map +1 -1
- package/dist/conversationTranscript.js.map +1 -1
- package/dist/conversationTurnSummaries.d.ts.map +1 -1
- package/dist/conversationTurnSummaries.js.map +1 -1
- package/dist/conversationViewProps.d.ts.map +1 -1
- package/dist/conversationViewProps.js.map +1 -1
- package/dist/conversationWorkEntry.d.ts.map +1 -1
- package/dist/conversationWorkEntry.js.map +1 -1
- package/dist/credential-account.d.ts +4 -0
- package/dist/credential-account.d.ts.map +1 -0
- package/dist/credential-account.js +4 -0
- package/dist/credential-account.js.map +1 -0
- package/dist/dataPorts.gen.d.ts +306 -0
- package/dist/dataPorts.gen.d.ts.map +1 -1
- package/dist/dataPorts.gen.js.map +1 -1
- package/dist/decision-card.d.ts.map +1 -1
- package/dist/decision-card.js.map +1 -1
- package/dist/decisions.d.ts.map +1 -1
- package/dist/decisions.js.map +1 -1
- package/dist/definition.d.ts.map +1 -1
- package/dist/definition.js.map +1 -1
- package/dist/derivedState.d.ts.map +1 -1
- package/dist/derivedState.js.map +1 -1
- package/dist/diagnosticData.d.ts.map +1 -1
- package/dist/diagnosticData.js.map +1 -1
- package/dist/diff-rendering.d.ts +2 -0
- package/dist/diff-rendering.d.ts.map +1 -0
- package/dist/diff-rendering.js +2 -0
- package/dist/diff-rendering.js.map +1 -0
- package/dist/display-format.d.ts +5 -0
- package/dist/display-format.d.ts.map +1 -0
- package/dist/display-format.js +5 -0
- package/dist/display-format.js.map +1 -0
- package/dist/entity-names.d.ts.map +1 -1
- package/dist/entity-names.js.map +1 -1
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js.map +1 -1
- package/dist/executor-mode.d.ts +2 -0
- package/dist/executor-mode.d.ts.map +1 -0
- package/dist/executor-mode.js +2 -0
- package/dist/executor-mode.js.map +1 -0
- package/dist/executor.d.ts +17 -1
- package/dist/executor.d.ts.map +1 -1
- package/dist/executor.js.map +1 -1
- package/dist/executorCapabilities.d.ts.map +1 -1
- package/dist/executorCapabilities.js.map +1 -1
- package/dist/executorCard.d.ts +6 -0
- package/dist/executorCard.d.ts.map +1 -1
- package/dist/executorCard.js.map +1 -1
- package/dist/executorCommandArgv.d.ts.map +1 -1
- package/dist/executorCommandArgv.js.map +1 -1
- package/dist/executorEffective.d.ts.map +1 -1
- package/dist/executorEffective.js.map +1 -1
- package/dist/executorErrors.d.ts.map +1 -1
- package/dist/executorErrors.js.map +1 -1
- package/dist/executorEvents.d.ts.map +1 -1
- package/dist/executorEvents.js.map +1 -1
- package/dist/executorModelOptions.d.ts.map +1 -1
- package/dist/executorModelOptions.js.map +1 -1
- package/dist/executorProcesses.d.ts.map +1 -1
- package/dist/executorProcesses.js.map +1 -1
- package/dist/executorSession.d.ts +8 -2
- package/dist/executorSession.d.ts.map +1 -1
- package/dist/executorSession.js.map +1 -1
- package/dist/executorSpawn.d.ts +5 -4
- package/dist/executorSpawn.d.ts.map +1 -1
- package/dist/executorSpawn.js +20 -7
- package/dist/executorSpawn.js.map +1 -1
- package/dist/fetch-ports.d.ts +2 -0
- package/dist/fetch-ports.d.ts.map +1 -0
- package/dist/fetch-ports.js +2 -0
- package/dist/fetch-ports.js.map +1 -0
- package/dist/file-preview.d.ts.map +1 -1
- package/dist/file-preview.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/inline-tag.d.ts.map +1 -1
- package/dist/inline-tag.js.map +1 -1
- package/dist/instance-config.d.ts +7 -0
- package/dist/instance-config.d.ts.map +1 -0
- package/dist/instance-config.js +7 -0
- package/dist/instance-config.js.map +1 -0
- package/dist/interval.d.ts.map +1 -1
- package/dist/interval.js.map +1 -1
- package/dist/jsonl.d.ts +6 -0
- package/dist/jsonl.d.ts.map +1 -0
- package/dist/jsonl.js +6 -0
- package/dist/jsonl.js.map +1 -0
- package/dist/keyedSubscribers.d.ts.map +1 -1
- package/dist/keyedSubscribers.js.map +1 -1
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js.map +1 -1
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js.map +1 -1
- package/dist/model-picker.d.ts.map +1 -1
- package/dist/model-picker.js.map +1 -1
- package/dist/modelCatalogNotice.d.ts.map +1 -1
- package/dist/modelCatalogNotice.js.map +1 -1
- package/dist/modelChoice.d.ts.map +1 -1
- package/dist/modelChoice.js.map +1 -1
- package/dist/modelChoiceOptions.d.ts.map +1 -1
- package/dist/modelChoiceOptions.js.map +1 -1
- package/dist/modelChoiceTraits.d.ts.map +1 -1
- package/dist/modelChoiceTraits.js.map +1 -1
- package/dist/modelDisplayName.d.ts.map +1 -1
- package/dist/modelDisplayName.js.map +1 -1
- package/dist/pending-requests.d.ts.map +1 -1
- package/dist/pending-requests.js.map +1 -1
- package/dist/plugin-tools.d.ts.map +1 -1
- package/dist/plugin-tools.js.map +1 -1
- package/dist/pluginContextCommands.d.ts.map +1 -1
- package/dist/pluginContextCommands.js.map +1 -1
- package/dist/pluginContextProviders.d.ts.map +1 -1
- package/dist/pluginContextProviders.js.map +1 -1
- package/dist/pluginContextThreads.d.ts.map +1 -1
- package/dist/pluginContextThreads.js.map +1 -1
- package/dist/pluginContextWorkspace.d.ts.map +1 -1
- package/dist/pluginContextWorkspace.js.map +1 -1
- package/dist/process-operation.d.ts.map +1 -1
- package/dist/process-operation.js.map +1 -1
- package/dist/process-socket.d.ts.map +1 -1
- package/dist/process-socket.js.map +1 -1
- package/dist/process-stdin.d.ts.map +1 -1
- package/dist/process-stdin.js.map +1 -1
- package/dist/projects.d.ts.map +1 -1
- package/dist/projects.js.map +1 -1
- package/dist/provider-settings.d.ts.map +1 -1
- package/dist/provider-settings.js.map +1 -1
- package/dist/providerInstanceSelection.d.ts.map +1 -1
- package/dist/providerInstanceSelection.js.map +1 -1
- package/dist/reasoningLevelFallback.d.ts.map +1 -1
- package/dist/reasoningLevelFallback.js.map +1 -1
- package/dist/runtime-maintenance.d.ts.map +1 -1
- package/dist/runtime-maintenance.js.map +1 -1
- package/dist/runtimes.d.ts.map +1 -1
- package/dist/runtimes.js.map +1 -1
- package/dist/selectAllCopy.d.ts.map +1 -1
- package/dist/selectAllCopy.js.map +1 -1
- package/dist/session-history.d.ts +6 -0
- package/dist/session-history.d.ts.map +1 -0
- package/dist/session-history.js +6 -0
- package/dist/session-history.js.map +1 -0
- package/dist/settings-actions.d.ts.map +1 -1
- package/dist/settings-actions.js.map +1 -1
- package/dist/settings-card-shape.d.ts.map +1 -1
- package/dist/settings-card-shape.js.map +1 -1
- package/dist/settings-card.d.ts.map +1 -1
- package/dist/settings-card.js.map +1 -1
- package/dist/settings-ui.d.ts.map +1 -1
- package/dist/settings-ui.js.map +1 -1
- package/dist/sign-in.d.ts.map +1 -1
- package/dist/sign-in.js.map +1 -1
- package/dist/slashCommands.d.ts.map +1 -1
- package/dist/slashCommands.js.map +1 -1
- package/dist/slots.d.ts.map +1 -1
- package/dist/slots.js.map +1 -1
- package/dist/source/_private/ycodium-attachment-kinds/chatAttachmentKinds.ts +105 -0
- package/dist/source/_private/ycodium-attachment-kinds/mediaKinds.ts +83 -0
- package/dist/source/_private/ycodium-composer-tokens/approvalFileChanges.ts +58 -0
- package/dist/source/_private/ycodium-composer-tokens/composerFileLink.ts +23 -0
- package/dist/source/_private/ycodium-composer-tokens/composerInlineTokens.ts +130 -0
- package/dist/source/_private/ycodium-composer-tokens/composerLogic.ts +251 -0
- package/dist/source/_private/ycodium-composer-tokens/composerMentionDrag.ts +98 -0
- package/dist/source/_private/ycodium-composer-tokens/composerPromptSegments.ts +222 -0
- package/dist/source/_private/ycodium-composer-tokens/composerTrigger.ts +64 -0
- package/dist/source/_private/ycodium-composer-tokens/contextWindowFormat.ts +16 -0
- package/dist/source/_private/ycodium-composer-tokens/diffCount.ts +14 -0
- package/dist/source/_private/ycodium-composer-tokens/pendingUserInput.ts +256 -0
- package/dist/source/_private/ycodium-composer-tokens/promptContextBlocks.ts +179 -0
- package/dist/source/_private/ycodium-composer-tokens/proposedPlan.ts +134 -0
- package/dist/source/_private/ycodium-composer-tokens/providerSkillSearch.ts +105 -0
- package/dist/source/_private/ycodium-composer-tokens/providerSkills.ts +86 -0
- package/dist/source/_private/ycodium-composer-tokens/queueEntry.ts +49 -0
- package/dist/source/_private/ycodium-composer-tokens/reviewCommentBlocks.ts +177 -0
- package/dist/source/_private/ycodium-composer-tokens/searchRanking.ts +192 -0
- package/dist/source/_private/ycodium-composer-tokens/skillTokens.ts +192 -0
- package/dist/source/_private/ycodium-composer-tokens/slashMenu.ts +293 -0
- package/dist/source/_private/ycodium-composer-tokens/userInputOptionText.ts +51 -0
- package/dist/source/_private/ycodium-credential-account/credentialAccount.ts +83 -0
- package/dist/source/_private/ycodium-credential-account/quotaJson.ts +25 -0
- package/dist/source/_private/ycodium-credential-account/quotaRequest.ts +79 -0
- package/dist/source/_private/ycodium-day-format/dayFormat.ts +57 -0
- package/dist/source/_private/ycodium-day-format/timestampFormat.ts +165 -0
- package/dist/source/_private/ycodium-decision-order/decisionOrder.ts +54 -0
- package/dist/source/_private/ycodium-diff-format/diffRendering.ts +229 -0
- package/dist/source/_private/ycodium-duration-format/durationFormat.ts +60 -0
- package/dist/source/_private/ycodium-executor-common/catalogModel.ts +40 -0
- package/dist/source/_private/ycodium-executor-common/eventTypes.ts +97 -0
- package/dist/source/_private/ycodium-executor-common/modelSelection.ts +24 -0
- package/dist/source/_private/ycodium-executor-common/nodeStreams.ts +212 -0
- package/dist/source/_private/ycodium-executor-common/raceAbort.ts +25 -0
- package/dist/source/_private/ycodium-executor-common/reasoningLevelFallback.ts +28 -0
- package/dist/source/_private/ycodium-executor-common/stderrTail.ts +27 -0
- package/dist/source/_private/ycodium-executor-common/toolPresentation.ts +268 -0
- package/dist/source/_private/ycodium-fetch-ports/fetchPorts.ts +84 -0
- package/dist/source/_private/ycodium-fetch-ports/netFault.ts +30 -0
- package/dist/source/_private/ycodium-full-access-mode/fullAccessNativeMode.ts +32 -0
- package/dist/source/_private/ycodium-instance-config/homePath.ts +140 -0
- package/dist/source/_private/ycodium-instance-config/instanceConfig.ts +149 -0
- package/dist/source/_private/ycodium-instance-config/launchArgs.ts +60 -0
- package/dist/source/_private/ycodium-instance-config/probeProcess.ts +89 -0
- package/dist/source/_private/ycodium-instance-config/programHomeSchema.ts +74 -0
- package/dist/source/_private/ycodium-instance-config/tomlScalar.ts +10 -0
- package/dist/source/_private/ycodium-jsonl-stream/appendedJsonl.ts +222 -0
- package/dist/source/_private/ycodium-jsonl-stream/claudeSessions.ts +263 -0
- package/dist/source/_private/ycodium-jsonl-stream/codexSessions.ts +254 -0
- package/dist/source/_private/ycodium-jsonl-stream/history.ts +492 -0
- package/dist/source/_private/ycodium-jsonl-stream/historyErrors.ts +6 -0
- package/dist/source/_private/ycodium-jsonl-stream/historyFile.ts +139 -0
- package/dist/source/_private/ycodium-jsonl-stream/historyRecord.ts +180 -0
- package/dist/source/_private/ycodium-jsonl-stream/historyWaiting.ts +140 -0
- package/dist/source/_private/ycodium-jsonl-stream/jsonObjectLine.ts +15 -0
- package/dist/source/_private/ycodium-jsonl-stream/jsonlStream.ts +650 -0
- package/dist/source/_private/ycodium-jsonl-stream/scanCache.ts +163 -0
- package/dist/source/_private/ycodium-jsonl-stream/sessionDirectory.ts +39 -0
- package/dist/source/_private/ycodium-jsonl-stream/sessionTranscript.ts +136 -0
- package/dist/source/_private/ycodium-jsonl-stream/usageFields.ts +13 -0
- package/dist/source/_private/ycodium-markdown-fence/markdownFence.ts +28 -0
- package/dist/source/_private/ycodium-source-control/pullRequestScope.ts +35 -0
- package/dist/source/_private/ycodium-sse-stream/sseStream.ts +118 -0
- package/dist/source/_private/ycodium-system-text/memberInstructions.ts +24 -0
- package/dist/source/_private/ycodium-system-text/systemText.ts +356 -0
- package/dist/source/_private/ycodium-system-text/threadPreset.ts +35 -0
- package/dist/source/_private/ycodium-text-generation/branchName.ts +29 -0
- package/dist/source/_private/ycodium-text-generation/prompts.ts +342 -0
- package/dist/source/_private/ycodium-text-generation/sanitize.ts +125 -0
- package/dist/source/_private/ycodium-text-generation/structuredTextGeneration.ts +237 -0
- package/dist/source/_private/ycodium-tool-label/toolLabel.ts +287 -0
- package/dist/source/_private/ycodium-ui-hooks/DiffStatCounts.tsx +76 -0
- package/dist/source/_private/ycodium-ui-hooks/ProviderSignInChallenge.tsx +115 -0
- package/dist/source/_private/ycodium-ui-hooks/RenderErrorBoundary.tsx +34 -0
- package/dist/source/_private/ycodium-ui-hooks/RuntimeMaintenanceActions.tsx +63 -0
- package/dist/source/_private/ycodium-ui-hooks/SkillInlineText.tsx +28 -0
- package/dist/source/_private/ycodium-ui-hooks/bundleStyle.ts +52 -0
- package/dist/source/_private/ycodium-ui-hooks/catalogKeys.ts +11 -0
- package/dist/source/_private/ycodium-ui-hooks/clipboard.ts +176 -0
- package/dist/source/_private/ycodium-ui-hooks/hostControls.ts +43 -0
- package/dist/source/_private/ycodium-ui-hooks/inlineChips.tsx +114 -0
- package/dist/source/_private/ycodium-ui-hooks/notifyMessages.ts +36 -0
- package/dist/source/_private/ycodium-ui-hooks/presenterInputState.ts +341 -0
- package/dist/source/_private/ycodium-ui-hooks/processRowHeader.ts +7 -0
- package/dist/source/_private/ycodium-ui-hooks/timelineDisclosure.ts +98 -0
- package/dist/source/_private/ycodium-ui-hooks/useMediaQuery.ts +87 -0
- package/dist/source/_private/ycodium-ui-hooks/workEntryIcons.ts +99 -0
- package/dist/source/_private/ycodium-workspace-path/directoryScope.ts +34 -0
- package/dist/source/_private/ycodium-workspace-path/workspacePath.ts +110 -0
- package/dist/source/cache.ts +55 -0
- package/dist/source/capabilityPorts.ts +272 -0
- package/dist/source/cli.ts +69 -0
- package/dist/source/commands.ts +208 -0
- package/dist/source/communication-view.ts +107 -0
- package/dist/source/communication.ts +26 -0
- package/dist/source/composer-control.ts +16 -0
- package/dist/source/composer.ts +108 -0
- package/dist/source/conversation-queue.ts +165 -0
- package/dist/source/conversation-view.ts +49 -0
- package/dist/source/conversation.ts +700 -0
- package/dist/source/conversationAttachments.ts +139 -0
- package/dist/source/conversationBase.ts +128 -0
- package/dist/source/conversationComposerApi.ts +339 -0
- package/dist/source/conversationComposerEnvironment.ts +76 -0
- package/dist/source/conversationComposerHandle.ts +89 -0
- package/dist/source/conversationComposerParts.ts +10 -0
- package/dist/source/conversationDerive.ts +252 -0
- package/dist/source/conversationDrafts.ts +281 -0
- package/dist/source/conversationForks.ts +40 -0
- package/dist/source/conversationHostModels.ts +467 -0
- package/dist/source/conversationLoadFailure.ts +9 -0
- package/dist/source/conversationMemberMentions.ts +63 -0
- package/dist/source/conversationMessageLinks.ts +153 -0
- package/dist/source/conversationMessageMemory.ts +45 -0
- package/dist/source/conversationPresets.ts +15 -0
- package/dist/source/conversationRows.ts +132 -0
- package/dist/source/conversationSessionMessage.ts +18 -0
- package/dist/source/conversationSkills.ts +26 -0
- package/dist/source/conversationTrajectory.ts +116 -0
- package/dist/source/conversationTranscript.ts +33 -0
- package/dist/source/conversationTurnSummaries.ts +57 -0
- package/dist/source/conversationViewProps.ts +486 -0
- package/dist/source/conversationWorkEntry.ts +104 -0
- package/dist/source/credential-account.ts +18 -0
- package/dist/source/dataPorts.gen.ts +2207 -0
- package/dist/source/decision-card.ts +87 -0
- package/dist/source/decisions.ts +43 -0
- package/dist/source/definition.ts +28 -0
- package/dist/source/derivedState.ts +55 -0
- package/dist/source/diagnosticData.ts +238 -0
- package/dist/source/diff-rendering.ts +6 -0
- package/dist/source/display-format.ts +14 -0
- package/dist/source/entity-names.ts +73 -0
- package/dist/source/events.ts +326 -0
- package/dist/source/executor-mode.ts +1 -0
- package/dist/source/executor.ts +623 -0
- package/dist/source/executorCapabilities.ts +89 -0
- package/dist/source/executorCard.ts +426 -0
- package/dist/source/executorCommandArgv.ts +114 -0
- package/dist/source/executorEffective.ts +99 -0
- package/dist/source/executorErrors.ts +73 -0
- package/dist/source/executorEvents.ts +258 -0
- package/dist/source/executorModelOptions.ts +179 -0
- package/dist/source/executorProcesses.ts +43 -0
- package/dist/source/executorSession.ts +508 -0
- package/dist/source/executorSpawn.ts +141 -0
- package/dist/source/fetch-ports.ts +1 -0
- package/dist/source/file-preview.ts +32 -0
- package/dist/source/index.ts +416 -0
- package/dist/source/inline-tag.ts +27 -0
- package/dist/source/instance-config.ts +31 -0
- package/dist/source/interval.ts +32 -0
- package/dist/source/jsonl.ts +21 -0
- package/dist/source/keyedSubscribers.ts +55 -0
- package/dist/source/logger.ts +16 -0
- package/dist/source/messages.ts +27 -0
- package/dist/source/model-picker.ts +82 -0
- package/dist/source/modelCatalogNotice.ts +34 -0
- package/dist/source/modelChoice.ts +371 -0
- package/dist/source/modelChoiceOptions.ts +309 -0
- package/dist/source/modelChoiceTraits.ts +133 -0
- package/dist/source/modelDisplayName.ts +42 -0
- package/dist/source/pending-requests.ts +56 -0
- package/dist/source/plugin-tools.ts +181 -0
- package/dist/source/pluginContextCommands.ts +224 -0
- package/dist/source/pluginContextProviders.ts +136 -0
- package/dist/source/pluginContextThreads.ts +83 -0
- package/dist/source/pluginContextWorkspace.ts +74 -0
- package/dist/source/process-operation.ts +291 -0
- package/dist/source/process-socket.ts +371 -0
- package/dist/source/process-stdin.ts +214 -0
- package/dist/source/projects.ts +31 -0
- package/dist/source/provider-settings.ts +343 -0
- package/dist/source/providerInstanceSelection.ts +72 -0
- package/dist/source/reasoningLevelFallback.ts +13 -0
- package/dist/source/runtime-maintenance.ts +307 -0
- package/dist/source/runtimes.ts +14 -0
- package/dist/source/selectAllCopy.ts +12 -0
- package/dist/source/session-history.ts +45 -0
- package/dist/source/settings-actions.ts +91 -0
- package/dist/source/settings-card-shape.ts +229 -0
- package/dist/source/settings-card.ts +311 -0
- package/dist/source/settings-ui.ts +48 -0
- package/dist/source/sign-in.ts +52 -0
- package/dist/source/slashCommands.ts +36 -0
- package/dist/source/slots.ts +243 -0
- package/dist/source/source-control.ts +5 -0
- package/dist/source/sse.ts +1 -0
- package/dist/source/system-text.ts +18 -0
- package/dist/source/teamView.ts +67 -0
- package/dist/source/testing.ts +203 -0
- package/dist/source/text-generation.ts +5 -0
- package/dist/source/threadAnnotation.ts +12 -0
- package/dist/source/threads.ts +77 -0
- package/dist/source/timeline-process.ts +87 -0
- package/dist/source/timeline-row-error.ts +14 -0
- package/dist/source/tool-display.ts +130 -0
- package/dist/source/traits-picker.ts +84 -0
- package/dist/source/ui-bridge-version.ts +64 -0
- package/dist/source/ui-hooks.ts +26 -0
- package/dist/source/ui-i18n.ts +1 -0
- package/dist/source/ui-media-query.ts +1 -0
- package/dist/source/ui-presenter-state.ts +6 -0
- package/dist/source/ui.ts +671 -0
- package/dist/source/uiHostCapabilities.ts +85 -0
- package/dist/source/uiMachineAdmission.ts +21 -0
- package/dist/source/uiSessionProjections.ts +19 -0
- package/dist/source/usage.ts +225 -0
- package/dist/source/version.ts +30 -0
- package/dist/source/workspace-path.ts +2 -0
- package/dist/source-control.d.ts +3 -0
- package/dist/source-control.d.ts.map +1 -0
- package/dist/source-control.js +3 -0
- package/dist/source-control.js.map +1 -0
- package/dist/sse.d.ts +2 -0
- package/dist/sse.d.ts.map +1 -0
- package/dist/sse.js +2 -0
- package/dist/sse.js.map +1 -0
- package/dist/system-text.d.ts +4 -0
- package/dist/system-text.d.ts.map +1 -0
- package/dist/system-text.js +4 -0
- package/dist/system-text.js.map +1 -0
- package/dist/teamView.d.ts.map +1 -1
- package/dist/teamView.js.map +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js.map +1 -1
- package/dist/text-generation.d.ts +3 -0
- package/dist/text-generation.d.ts.map +1 -0
- package/dist/text-generation.js +3 -0
- package/dist/text-generation.js.map +1 -0
- package/dist/threadAnnotation.d.ts.map +1 -1
- package/dist/threadAnnotation.js.map +1 -1
- package/dist/threads.d.ts.map +1 -1
- package/dist/threads.js.map +1 -1
- package/dist/timeline-process.d.ts +32 -0
- package/dist/timeline-process.d.ts.map +1 -1
- package/dist/timeline-process.js.map +1 -1
- package/dist/timeline-row-error.d.ts.map +1 -1
- package/dist/timeline-row-error.js.map +1 -1
- package/dist/tool-display.d.ts.map +1 -1
- package/dist/tool-display.js.map +1 -1
- package/dist/traits-picker.d.ts.map +1 -1
- package/dist/traits-picker.js.map +1 -1
- package/dist/ui-bridge-version.d.ts.map +1 -1
- package/dist/ui-bridge-version.js.map +1 -1
- package/dist/ui-hooks.d.ts +14 -0
- package/dist/ui-hooks.d.ts.map +1 -0
- package/dist/ui-hooks.js +14 -0
- package/dist/ui-hooks.js.map +1 -0
- package/dist/ui-i18n.d.ts +2 -0
- package/dist/ui-i18n.d.ts.map +1 -0
- package/dist/ui-i18n.js +2 -0
- package/dist/ui-i18n.js.map +1 -0
- package/dist/ui-media-query.d.ts +2 -0
- package/dist/ui-media-query.d.ts.map +1 -0
- package/dist/ui-media-query.js +2 -0
- package/dist/ui-media-query.js.map +1 -0
- package/dist/ui-presenter-state.d.ts +2 -0
- package/dist/ui-presenter-state.d.ts.map +1 -0
- package/dist/ui-presenter-state.js +2 -0
- package/dist/ui-presenter-state.js.map +1 -0
- package/dist/ui.d.ts +2 -2
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js.map +1 -1
- package/dist/uiHostCapabilities.d.ts.map +1 -1
- package/dist/uiHostCapabilities.js.map +1 -1
- package/dist/uiMachineAdmission.d.ts.map +1 -1
- package/dist/uiMachineAdmission.js.map +1 -1
- package/dist/uiSessionProjections.d.ts.map +1 -1
- package/dist/uiSessionProjections.js.map +1 -1
- package/dist/usage.d.ts.map +1 -1
- package/dist/usage.js.map +1 -1
- package/dist/version.d.ts +2 -2
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/workspace-path.d.ts +3 -0
- package/dist/workspace-path.d.ts.map +1 -0
- package/dist/workspace-path.js +3 -0
- package/dist/workspace-path.js.map +1 -0
- package/package.json +114 -3
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 宿主 UI 原语 `ProviderModelPicker`(模型选择器:触发器 + 实例栏 + 型号列表)的 props。插件经
|
|
3
|
+
* `bridge.ui` 取用;宿主的设置页与会话输入框画的是同一个组件。选中、收藏、可选与否的判定都在宿主,
|
|
4
|
+
* 插件只给候选与回调。
|
|
5
|
+
*
|
|
6
|
+
* 三个类型参数只让宿主代入自己更窄的类型(品牌化的实例 id、完整的实例条目与快捷键表);插件用缺省。
|
|
7
|
+
*
|
|
8
|
+
* @module @ycodium-ai/plugin-api/ui
|
|
9
|
+
*/
|
|
10
|
+
import type { ConversationComposerModelStatus } from "./conversationDrafts.ts";
|
|
11
|
+
import type {
|
|
12
|
+
ConversationProviderInstanceEntry,
|
|
13
|
+
ConversationResolvedKeybindingsConfig,
|
|
14
|
+
} from "./conversationHostModels.ts";
|
|
15
|
+
import type { ProviderModelPickerModel } from "./modelDisplayName.ts";
|
|
16
|
+
|
|
17
|
+
// 同属「选型号」的档位选择器(TraitsPicker)的 props。
|
|
18
|
+
export type {
|
|
19
|
+
ConversationTraitsPickerTypes,
|
|
20
|
+
TraitsMenuContentProps,
|
|
21
|
+
TraitsPickerProps,
|
|
22
|
+
TraitsPickerTypes,
|
|
23
|
+
TraitsSource,
|
|
24
|
+
TraitsTarget,
|
|
25
|
+
} from "./traits-picker.ts";
|
|
26
|
+
|
|
27
|
+
export interface ProviderModelPickerProps<
|
|
28
|
+
InstanceId extends string = string,
|
|
29
|
+
Entry = ConversationProviderInstanceEntry,
|
|
30
|
+
Keybindings = ConversationResolvedKeybindingsConfig,
|
|
31
|
+
> {
|
|
32
|
+
/** 当前选中的实例;`null` 是还没选(触发器画 `emptyLabel`,打开时停在第一个可用实例)。 */
|
|
33
|
+
readonly activeInstanceId: InstanceId | null;
|
|
34
|
+
readonly model: string;
|
|
35
|
+
/**
|
|
36
|
+
* 没有型号可画时触发器上的文案:`activeInstanceId` 为 null(设置页「未选择」),或 `modelStatus` 为
|
|
37
|
+
* `missing`(这只手一个型号都没报,触发器就是去选型号的入口)。文案归调用方。
|
|
38
|
+
*/
|
|
39
|
+
readonly emptyLabel?: string | undefined;
|
|
40
|
+
/** 选中的实例已不在 `instanceEntries` 里:保留选中值,并在它后面标这句话。不给就不标。 */
|
|
41
|
+
readonly activeUnavailableLabel?: string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* 这只手现在拿不拿得出型号。`probing` 时触发器说正在获取,`missing` 时画 `emptyLabel`,两者都不画
|
|
44
|
+
* 型号名;`unavailable` 照画并标「不可用」。缺省 `known`。
|
|
45
|
+
*/
|
|
46
|
+
readonly modelStatus?: ConversationComposerModelStatus | undefined;
|
|
47
|
+
/** 模型来源的诊断标记;宿主模型选择器不将它显示为徽标。 */
|
|
48
|
+
readonly modelUnconfirmed?: boolean | undefined;
|
|
49
|
+
/** 锁定到某个 driver(续接中的会话);同 driver 的实例仍可切换。 */
|
|
50
|
+
readonly lockedProvider: string | null;
|
|
51
|
+
readonly lockedContinuationGroupKey?: string | null | undefined;
|
|
52
|
+
/** 实例栏的条目,按显示顺序。 */
|
|
53
|
+
readonly instanceEntries: ReadonlyArray<Entry>;
|
|
54
|
+
/** 这些实例所在的机器。不给就沿用外层声明的机器(会话视图里是会话所在机器)。 */
|
|
55
|
+
readonly environmentId?: string | undefined;
|
|
56
|
+
/** 实例已由别处选定(会话输入框的选手格):不画实例栏。 */
|
|
57
|
+
readonly hideInstanceRail?: boolean | undefined;
|
|
58
|
+
/** 触发器上画不画实例图标;缺省画。 */
|
|
59
|
+
readonly showInstanceOnTrigger?: boolean | undefined;
|
|
60
|
+
readonly keybindings?: Keybindings | undefined;
|
|
61
|
+
readonly modelOptionsByInstance: ReadonlyMap<InstanceId, ReadonlyArray<ProviderModelPickerModel>>;
|
|
62
|
+
readonly activeProviderIconClassName?: string | undefined;
|
|
63
|
+
readonly compact?: boolean | undefined;
|
|
64
|
+
readonly disabled?: boolean | undefined;
|
|
65
|
+
/** 终端开着时型号跳转快捷键按另一套上下文解析。 */
|
|
66
|
+
readonly terminalOpen?: boolean | undefined;
|
|
67
|
+
readonly open?: boolean | undefined;
|
|
68
|
+
readonly triggerVariant?: "ghost" | "outline" | undefined;
|
|
69
|
+
readonly triggerClassName?: string | undefined;
|
|
70
|
+
readonly triggerAriaLabel?: string | undefined;
|
|
71
|
+
readonly onOpenChange?: ((open: boolean) => void) | undefined;
|
|
72
|
+
/** 返回非 null 时这一行灰掉,悬浮说明原因。 */
|
|
73
|
+
readonly getModelDisabledReason?:
|
|
74
|
+
| ((instanceId: InstanceId, model: string) => string | null)
|
|
75
|
+
| undefined;
|
|
76
|
+
/** 被挡下的型号还能换 provider 接着干时,返回那一行的动作文案;null 表示只能灰掉。 */
|
|
77
|
+
readonly getModelContinuationLabel?:
|
|
78
|
+
| ((instanceId: InstanceId, model: string) => string | null)
|
|
79
|
+
| undefined;
|
|
80
|
+
readonly onContinueInModel?: ((instanceId: InstanceId, model: string) => void) | undefined;
|
|
81
|
+
readonly onInstanceModelChange: (instanceId: InstanceId, model: string) => void;
|
|
82
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 选择器实例组头要说的目录状态。只看快照上的 `modelCatalog`:缺席(旧服务端)与已确认都不说,
|
|
3
|
+
* 没有证据的事不替服务端编。web、手机与会话插件共用这一处。
|
|
4
|
+
*/
|
|
5
|
+
export type ModelCatalogNotice =
|
|
6
|
+
/** 从没探测成功过:不点名任何型号,只说在检查。 */
|
|
7
|
+
| { readonly kind: "checking" }
|
|
8
|
+
/** 在用存盘或上一代的清单,本进程还没探到。 */
|
|
9
|
+
| { readonly kind: "stale"; readonly confirmedAt: string | undefined }
|
|
10
|
+
/** 本次探测失败;`hasList` 为真说明列的是上一份成功结果。 */
|
|
11
|
+
| { readonly kind: "failed"; readonly hasList: boolean };
|
|
12
|
+
|
|
13
|
+
export function modelCatalogNoticeOf(provider: {
|
|
14
|
+
readonly models: ReadonlyArray<unknown>;
|
|
15
|
+
readonly modelCatalog?:
|
|
16
|
+
| {
|
|
17
|
+
readonly state: "unknown" | "confirmed" | "stale" | "failed";
|
|
18
|
+
readonly confirmedAt?: string | undefined;
|
|
19
|
+
}
|
|
20
|
+
| undefined;
|
|
21
|
+
}): ModelCatalogNotice | null {
|
|
22
|
+
const catalog = provider.modelCatalog;
|
|
23
|
+
if (catalog === undefined) return null;
|
|
24
|
+
switch (catalog.state) {
|
|
25
|
+
case "confirmed":
|
|
26
|
+
return null;
|
|
27
|
+
case "unknown":
|
|
28
|
+
return { kind: "checking" };
|
|
29
|
+
case "stale":
|
|
30
|
+
return { kind: "stale", confirmedAt: catalog.confirmedAt };
|
|
31
|
+
case "failed":
|
|
32
|
+
return { kind: "failed", hasList: provider.models.length > 0 };
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 模型选择解析器:意图 + 目录 + 偏好 → 选择器列表、当前选中、各档位的有效值、派发值与提示。
|
|
3
|
+
* web、mobile、会话插件、IM、MCP、团队插件与服务端准入都调这一处,不各自推断「清单算不算数」。
|
|
4
|
+
*
|
|
5
|
+
* 约束(对应 0083 的 Q1–Q6):
|
|
6
|
+
* - 意图只读不改:目录状态、隐藏名单、型号下架都不改写用户存的选择。
|
|
7
|
+
* - 目录 `unknown` 不是证据:没有意图就不点名任何型号,有意图就原样保留、照发。
|
|
8
|
+
* - 目录 `stale` / `failed` 当上一份成功结果用,但不据此把意图判成「不存在」;只有 `confirmed`
|
|
9
|
+
* 且清单非空才有「目录里没有」的结论。名片占位(`origin: "card"`)不是清单,任何状态下都不入列。
|
|
10
|
+
* - 已有会话永不替换型号;只有 `create` 在 `confirmed` 目录里找不到意图型号时才换成目录默认。
|
|
11
|
+
* - 「跟随默认」(`model: null`)只在这里解析出结果,不回写意图。
|
|
12
|
+
* - 派发永远按意图,实际型号不改写发出去的型号:目录里的别名由 CLI 解析,读回的是解析后的完整 id,
|
|
13
|
+
* 两者不是同一套写法。选别名就是跟着别名走,想固定版本选完整 id。
|
|
14
|
+
* - 实际型号只用于显示:选择对不上目录(或没有选择)时,显示读回的型号;对得上就显示选择,
|
|
15
|
+
* 档位按该目录条目算。`echo` 没有独立证据,不采用,只标未经确认。
|
|
16
|
+
* 输入用本文件自己的结构类型,字段名与契约对齐,插件 API 不依赖宿主包。
|
|
17
|
+
*/
|
|
18
|
+
import { matchCatalogModel } from "./executor.ts";
|
|
19
|
+
import { resolveModelOptions } from "./modelChoiceOptions.ts";
|
|
20
|
+
import type {
|
|
21
|
+
ModelChoiceHint,
|
|
22
|
+
ModelChoiceOptionDescriptor,
|
|
23
|
+
ModelChoiceOptionSelection,
|
|
24
|
+
ModelChoiceOptionState,
|
|
25
|
+
} from "./modelChoiceOptions.ts";
|
|
26
|
+
|
|
27
|
+
export { nearestEffortLevel, resolveModelOptions } from "./modelChoiceOptions.ts";
|
|
28
|
+
export type {
|
|
29
|
+
ModelChoiceHint,
|
|
30
|
+
ModelChoiceOptionDescriptor,
|
|
31
|
+
ModelChoiceOptionSelection,
|
|
32
|
+
ModelChoiceOptionSource,
|
|
33
|
+
ModelChoiceOptionState,
|
|
34
|
+
ModelChoiceOptionValue,
|
|
35
|
+
ResolvedModelOptions,
|
|
36
|
+
} from "./modelChoiceOptions.ts";
|
|
37
|
+
|
|
38
|
+
export type ModelCatalogState = "unknown" | "confirmed" | "stale" | "failed";
|
|
39
|
+
|
|
40
|
+
/** 目录里一个型号的结构子集;`capabilities: null` / 缺席 = 能力未知,`optionDescriptors: []` = 明确没有档位。 */
|
|
41
|
+
export interface ModelChoiceModel {
|
|
42
|
+
readonly slug: string;
|
|
43
|
+
readonly name: string;
|
|
44
|
+
readonly isDefault?: boolean | undefined;
|
|
45
|
+
readonly hidden?: boolean | undefined;
|
|
46
|
+
readonly origin?: "probe" | "custom" | "card" | undefined;
|
|
47
|
+
readonly capabilities?:
|
|
48
|
+
| {
|
|
49
|
+
readonly optionDescriptors?: ReadonlyArray<ModelChoiceOptionDescriptor> | undefined;
|
|
50
|
+
}
|
|
51
|
+
| null
|
|
52
|
+
| undefined;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface ModelChoiceIntent {
|
|
56
|
+
/** `null` = 跟随默认。 */
|
|
57
|
+
readonly model: string | null;
|
|
58
|
+
/** 没按型号分记的那一份(旧存档与尚未换过型号的草稿)。 */
|
|
59
|
+
readonly options: ReadonlyArray<ModelChoiceOptionSelection>;
|
|
60
|
+
/** 每个型号各记各的档位,键是型号 slug;换回来自动恢复。 */
|
|
61
|
+
readonly optionsByModel?:
|
|
62
|
+
| Readonly<Record<string, ReadonlyArray<ModelChoiceOptionSelection>>>
|
|
63
|
+
| undefined;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface ModelChoiceCatalog<M extends ModelChoiceModel> {
|
|
67
|
+
readonly state: ModelCatalogState;
|
|
68
|
+
readonly models: ReadonlyArray<M>;
|
|
69
|
+
/** 名片 `modelCatalogAuthoritative`:目录即成员清单,目录外的型号 CLI 确实跑不了。 */
|
|
70
|
+
readonly authoritative: boolean;
|
|
71
|
+
/** 名片 `modelSlugAliases`:旧 slug → 现行 slug。 */
|
|
72
|
+
readonly aliases?: Readonly<Record<string, string>> | null | undefined;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface ModelChoicePreferences {
|
|
76
|
+
readonly hidden?: ReadonlyArray<string> | undefined;
|
|
77
|
+
/** 列表里排在前面的型号 slug,其余按目录顺序。 */
|
|
78
|
+
readonly order?: ReadonlyArray<string> | undefined;
|
|
79
|
+
/** 偏好层的默认型号;空 = 跟随目录默认。 */
|
|
80
|
+
readonly defaultModel?: string | null | undefined;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* - `display`:画已有会话的选择器;
|
|
85
|
+
* - `dispatch-existing`:给已有会话发下一轮;
|
|
86
|
+
* - `create`:新建会话(草稿显示与首次派发)。
|
|
87
|
+
*/
|
|
88
|
+
export type ModelChoicePurpose = "display" | "dispatch-existing" | "create";
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* 会话记下的最新实际型号。`requested` 是记录当时的选择快照:当前意图型号和它不同,
|
|
92
|
+
* 说明用户之后改过选择,实际型号不再说明任何事。
|
|
93
|
+
* `reported` 是执行器自己报回来的;`echo` 是读不回、只能回显请求值,未经确认。
|
|
94
|
+
*/
|
|
95
|
+
export interface ModelChoiceActual {
|
|
96
|
+
readonly model: string;
|
|
97
|
+
readonly source: "reported" | "echo";
|
|
98
|
+
readonly requested: { readonly model: string | null };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface ModelChoiceInput<M extends ModelChoiceModel> {
|
|
102
|
+
readonly intent: ModelChoiceIntent | null;
|
|
103
|
+
readonly catalog: ModelChoiceCatalog<M>;
|
|
104
|
+
readonly preferences: ModelChoicePreferences;
|
|
105
|
+
readonly purpose: ModelChoicePurpose;
|
|
106
|
+
/** 会话第一次实际运行时记下的型号;`create` 不看。 */
|
|
107
|
+
readonly actual?: ModelChoiceActual | null | undefined;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface ModelChoiceRow<M extends ModelChoiceModel> {
|
|
111
|
+
readonly slug: string;
|
|
112
|
+
readonly name: string;
|
|
113
|
+
/** 目录里的条目;未列出的选中行没有。 */
|
|
114
|
+
readonly model: M | undefined;
|
|
115
|
+
readonly listed: boolean;
|
|
116
|
+
readonly hidden: boolean;
|
|
117
|
+
readonly selected: boolean;
|
|
118
|
+
readonly isDefault: boolean;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export type ModelChoiceSelected =
|
|
122
|
+
/** 目录没证据、也没有意图:不点名任何型号。 */
|
|
123
|
+
| { readonly kind: "placeholder" }
|
|
124
|
+
| {
|
|
125
|
+
readonly kind: "model";
|
|
126
|
+
readonly slug: string;
|
|
127
|
+
readonly listed: boolean;
|
|
128
|
+
/** 型号不在目录里时档位只读显示。 */
|
|
129
|
+
readonly readOnlyOptions: boolean;
|
|
130
|
+
readonly hidden: boolean;
|
|
131
|
+
readonly from: "intent" | "actual" | "default";
|
|
132
|
+
/** 执行器仅回显所选模型;保留此诊断事实,模型选择器按目录可用性展示。 */
|
|
133
|
+
readonly unconfirmed: boolean;
|
|
134
|
+
}
|
|
135
|
+
/** `authoritative` 目录已确认且不含这个型号:拦发送。 */
|
|
136
|
+
| { readonly kind: "unavailable"; readonly slug: string };
|
|
137
|
+
|
|
138
|
+
export type ModelChoiceDispatch =
|
|
139
|
+
| {
|
|
140
|
+
readonly model: string | null;
|
|
141
|
+
readonly options: ReadonlyArray<ModelChoiceOptionSelection>;
|
|
142
|
+
}
|
|
143
|
+
| { readonly blocked: "unavailable"; readonly model: string };
|
|
144
|
+
|
|
145
|
+
export interface ModelChoiceResult<M extends ModelChoiceModel> {
|
|
146
|
+
readonly list: ReadonlyArray<ModelChoiceRow<M>>;
|
|
147
|
+
readonly selected: ModelChoiceSelected;
|
|
148
|
+
readonly options: ReadonlyArray<ModelChoiceOptionState>;
|
|
149
|
+
readonly dispatch: ModelChoiceDispatch;
|
|
150
|
+
readonly hints: ReadonlyArray<ModelChoiceHint>;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function foldSlug(
|
|
154
|
+
raw: string | null,
|
|
155
|
+
aliases: Readonly<Record<string, string>> | null | undefined,
|
|
156
|
+
): string | null {
|
|
157
|
+
return raw !== null && aliases != null && Object.hasOwn(aliases, raw)
|
|
158
|
+
? (aliases[raw] ?? raw)
|
|
159
|
+
: raw;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function nonEmpty(value: string | null | undefined): string | null {
|
|
163
|
+
const trimmed = value?.trim();
|
|
164
|
+
return trimmed ? trimmed : null;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/** 在目录 slug 里找 `raw`:精确的优先于别名折叠后的,最后才按「最后一段唯一」匹配。 */
|
|
168
|
+
function matchSlug(
|
|
169
|
+
raw: string,
|
|
170
|
+
aliases: Readonly<Record<string, string>> | null | undefined,
|
|
171
|
+
slugs: ReadonlyArray<string>,
|
|
172
|
+
): { readonly matched: string | undefined; readonly folded: string } {
|
|
173
|
+
const folded = foldSlug(raw, aliases) ?? raw;
|
|
174
|
+
const matched = slugs.includes(raw)
|
|
175
|
+
? raw
|
|
176
|
+
: slugs.includes(folded)
|
|
177
|
+
? folded
|
|
178
|
+
: (matchCatalogModel(raw, slugs) ?? matchCatalogModel(folded, slugs));
|
|
179
|
+
return { matched, folded };
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export function resolveModelChoice<M extends ModelChoiceModel>(
|
|
183
|
+
input: ModelChoiceInput<M>,
|
|
184
|
+
): ModelChoiceResult<M> {
|
|
185
|
+
const { catalog, preferences, purpose } = input;
|
|
186
|
+
const { state } = catalog;
|
|
187
|
+
// 名片占位(`origin: "card"`)任何状态下都不是证据:没有探测成功过的清单就不点名任何型号。
|
|
188
|
+
// 未确认的目录里只有用户自己声明的型号算数。
|
|
189
|
+
const evidence = catalog.models.filter(
|
|
190
|
+
(model) => model.origin !== "card" && (state !== "unknown" || model.origin === "custom"),
|
|
191
|
+
);
|
|
192
|
+
// 「目录里没有」的结论要有清单可查:成功但清单为空更可能是探测漏报,不当作每个型号都下架了。
|
|
193
|
+
const canConcludeAbsent = state === "confirmed" && evidence.length > 0;
|
|
194
|
+
const slugs = evidence.map((model) => model.slug);
|
|
195
|
+
const hiddenSlugs = new Set(preferences.hidden ?? []);
|
|
196
|
+
const isHidden = (model: M) => model.hidden === true || hiddenSlugs.has(model.slug);
|
|
197
|
+
|
|
198
|
+
const preferredDefault = nonEmpty(preferences.defaultModel);
|
|
199
|
+
const catalogDefault = (): M | undefined => {
|
|
200
|
+
if (state === "unknown") return undefined;
|
|
201
|
+
if (preferredDefault !== null) {
|
|
202
|
+
const hit = matchSlug(preferredDefault, catalog.aliases, slugs).matched;
|
|
203
|
+
if (hit !== undefined) return evidence.find((model) => model.slug === hit);
|
|
204
|
+
}
|
|
205
|
+
return evidence.find((model) => model.isDefault === true);
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
const hints: ModelChoiceHint[] = [];
|
|
209
|
+
const intentModel = nonEmpty(input.intent?.model);
|
|
210
|
+
// 实际型号只在选择自记录以来没变过时才算数。
|
|
211
|
+
const actual = purpose === "create" ? null : (input.actual ?? null);
|
|
212
|
+
// 比较「选的是不是同一个型号」与选型号走同一条规则:目录里精确存在的 slug 优先于别名。
|
|
213
|
+
const identity = (raw: string | null) => {
|
|
214
|
+
if (raw === null) return null;
|
|
215
|
+
const { matched, folded } = matchSlug(raw, catalog.aliases, slugs);
|
|
216
|
+
return matched ?? folded;
|
|
217
|
+
};
|
|
218
|
+
const unchanged =
|
|
219
|
+
actual !== null && identity(nonEmpty(actual.requested.model)) === identity(intentModel);
|
|
220
|
+
const reportedModel = unchanged && actual.source === "reported" ? nonEmpty(actual.model) : null;
|
|
221
|
+
const intentMatch = intentModel === null ? null : matchSlug(intentModel, catalog.aliases, slugs);
|
|
222
|
+
const shownActual =
|
|
223
|
+
purpose === "display" && intentMatch?.matched === undefined ? reportedModel : null;
|
|
224
|
+
const requested = shownActual ?? intentModel;
|
|
225
|
+
const from: "intent" | "actual" | "default" =
|
|
226
|
+
requested === null ? "default" : requested === intentModel ? "intent" : "actual";
|
|
227
|
+
|
|
228
|
+
let slug: string | null = null;
|
|
229
|
+
let entry: M | undefined;
|
|
230
|
+
let replacedFrom: string | null = null;
|
|
231
|
+
let unavailable = false;
|
|
232
|
+
|
|
233
|
+
if (requested !== null) {
|
|
234
|
+
const { matched, folded } = matchSlug(requested, catalog.aliases, slugs);
|
|
235
|
+
entry = evidence.find((model) => model.slug === matched);
|
|
236
|
+
slug = matched ?? folded;
|
|
237
|
+
if (entry === undefined && canConcludeAbsent) {
|
|
238
|
+
if (purpose === "create") {
|
|
239
|
+
const target = catalogDefault();
|
|
240
|
+
replacedFrom = slug;
|
|
241
|
+
hints.push({ kind: "model-replaced", from: slug, to: target?.slug ?? null });
|
|
242
|
+
entry = target;
|
|
243
|
+
slug = target?.slug ?? null;
|
|
244
|
+
} else if (catalog.authoritative) {
|
|
245
|
+
unavailable = true;
|
|
246
|
+
hints.push({ kind: "model-unavailable", model: slug });
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
} else {
|
|
250
|
+
entry = catalogDefault();
|
|
251
|
+
slug = entry?.slug ?? null;
|
|
252
|
+
if (
|
|
253
|
+
purpose === "create" &&
|
|
254
|
+
canConcludeAbsent &&
|
|
255
|
+
preferredDefault !== null &&
|
|
256
|
+
matchSlug(preferredDefault, catalog.aliases, slugs).matched === undefined
|
|
257
|
+
) {
|
|
258
|
+
hints.push({ kind: "model-replaced", from: preferredDefault, to: slug });
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
const listed = entry !== undefined;
|
|
263
|
+
const selected: ModelChoiceSelected =
|
|
264
|
+
slug === null
|
|
265
|
+
? { kind: "placeholder" }
|
|
266
|
+
: unavailable
|
|
267
|
+
? { kind: "unavailable", slug }
|
|
268
|
+
: {
|
|
269
|
+
kind: "model",
|
|
270
|
+
slug,
|
|
271
|
+
listed,
|
|
272
|
+
readOnlyOptions: !listed,
|
|
273
|
+
hidden: entry !== undefined && isHidden(entry),
|
|
274
|
+
from: replacedFrom !== null ? "default" : from,
|
|
275
|
+
unconfirmed: unchanged && actual.source === "echo",
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
const descriptors = entry?.capabilities?.optionDescriptors ?? null;
|
|
279
|
+
const resolvedOptions = resolveModelOptions({
|
|
280
|
+
model: slug,
|
|
281
|
+
descriptors,
|
|
282
|
+
stored: storedFor(input.intent, [slug, replacedFrom, intentModel, requested]),
|
|
283
|
+
moveEffort: replacedFrom !== null,
|
|
284
|
+
});
|
|
285
|
+
hints.push(...resolvedOptions.hints);
|
|
286
|
+
|
|
287
|
+
const dispatch: ModelChoiceDispatch = unavailable
|
|
288
|
+
? { blocked: "unavailable", model: slug as string }
|
|
289
|
+
: {
|
|
290
|
+
// 显示落在实际型号上时,派发仍是选择本身。
|
|
291
|
+
model: shownActual === null ? slug : (intentMatch?.matched ?? intentMatch?.folded ?? null),
|
|
292
|
+
options: resolvedOptions.dispatch,
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
return {
|
|
296
|
+
list: buildList(evidence, preferences, isHidden, {
|
|
297
|
+
slug,
|
|
298
|
+
entry,
|
|
299
|
+
// 未列出的选中行(含「不可用」)只在有名字可点时出现。
|
|
300
|
+
showUnlisted: slug !== null && entry === undefined,
|
|
301
|
+
}),
|
|
302
|
+
selected,
|
|
303
|
+
options: resolvedOptions.options,
|
|
304
|
+
dispatch,
|
|
305
|
+
hints,
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/** 取按型号分记的那一份(依次试这些键),没有就用没分型号的那一份。 */
|
|
310
|
+
function storedFor(
|
|
311
|
+
intent: ModelChoiceIntent | null,
|
|
312
|
+
keys: ReadonlyArray<string | null>,
|
|
313
|
+
): ReadonlyArray<ModelChoiceOptionSelection> {
|
|
314
|
+
if (intent === null) return [];
|
|
315
|
+
const byModel = intent.optionsByModel;
|
|
316
|
+
if (byModel !== undefined) {
|
|
317
|
+
for (const key of keys) {
|
|
318
|
+
if (key !== null && Object.hasOwn(byModel, key)) return byModel[key] ?? [];
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
return intent.options;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
function buildList<M extends ModelChoiceModel>(
|
|
325
|
+
evidence: ReadonlyArray<M>,
|
|
326
|
+
preferences: ModelChoicePreferences,
|
|
327
|
+
isHidden: (model: M) => boolean,
|
|
328
|
+
picked: {
|
|
329
|
+
readonly slug: string | null;
|
|
330
|
+
readonly entry: M | undefined;
|
|
331
|
+
readonly showUnlisted: boolean;
|
|
332
|
+
},
|
|
333
|
+
): ReadonlyArray<ModelChoiceRow<M>> {
|
|
334
|
+
const order = preferences.order ?? [];
|
|
335
|
+
const rank = (model: M) => {
|
|
336
|
+
const index = order.indexOf(model.slug);
|
|
337
|
+
return index === -1 ? order.length : index;
|
|
338
|
+
};
|
|
339
|
+
const ordered = evidence
|
|
340
|
+
.map((model, index) => ({ model, index }))
|
|
341
|
+
.sort((a, b) => rank(a.model) - rank(b.model) || a.index - b.index)
|
|
342
|
+
.map((item) => item.model);
|
|
343
|
+
|
|
344
|
+
const toRow = (model: M): ModelChoiceRow<M> => ({
|
|
345
|
+
slug: model.slug,
|
|
346
|
+
name: model.name,
|
|
347
|
+
model,
|
|
348
|
+
listed: true,
|
|
349
|
+
hidden: isHidden(model),
|
|
350
|
+
selected: model.slug === picked.slug,
|
|
351
|
+
isDefault: model.isDefault === true,
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
// 隐藏只影响「列给人挑的列表」;当前选中的永远在。
|
|
355
|
+
const rows = ordered.filter((model) => !isHidden(model) || model === picked.entry).map(toRow);
|
|
356
|
+
if (picked.showUnlisted && picked.slug !== null) {
|
|
357
|
+
rows.unshift({
|
|
358
|
+
slug: picked.slug,
|
|
359
|
+
name: picked.slug,
|
|
360
|
+
model: undefined,
|
|
361
|
+
listed: false,
|
|
362
|
+
hidden: false,
|
|
363
|
+
selected: true,
|
|
364
|
+
isDefault: false,
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
// 隐藏不能让列表变空。有默认时默认就是选中行,已在上面;走到这里说明没有默认可点名,留第一条。
|
|
368
|
+
const first = ordered[0];
|
|
369
|
+
if (rows.length === 0 && first !== undefined) rows.push(toRow(first));
|
|
370
|
+
return rows;
|
|
371
|
+
}
|