@ycodium-ai/plugin-api 0.2.5557 → 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 +61 -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 +312 -2
- 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 +33 -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 +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 +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 +44 -0
- package/dist/provider-settings.d.ts.map +1 -1
- package/dist/provider-settings.js +10 -2
- 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 +50 -0
- package/dist/runtime-maintenance.d.ts.map +1 -0
- package/dist/runtime-maintenance.js +246 -0
- package/dist/runtime-maintenance.js.map +1 -0
- 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 +118 -3
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type Dispatch,
|
|
3
|
+
type MutableRefObject,
|
|
4
|
+
type SetStateAction,
|
|
5
|
+
useCallback,
|
|
6
|
+
useEffect,
|
|
7
|
+
useMemo,
|
|
8
|
+
useReducer,
|
|
9
|
+
useRef,
|
|
10
|
+
useSyncExternalStore,
|
|
11
|
+
} from "react";
|
|
12
|
+
|
|
13
|
+
const PRESENTER_MEMENTO_LIMIT = 100;
|
|
14
|
+
|
|
15
|
+
function initialValue<T>(value: T | (() => T)): T {
|
|
16
|
+
return typeof value === "function" ? (value as () => T)() : value;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function applyState<T>(current: T, update: SetStateAction<T>): T {
|
|
20
|
+
return typeof update === "function" ? (update as (value: T) => T)(current) : update;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface PresenterInputStateOptions<T> {
|
|
24
|
+
/** 同一字段在所有物理 presenter 间共享的稳定名字。 */
|
|
25
|
+
readonly namespace: string;
|
|
26
|
+
/** 重型派生快照用更小上限;轻量 UI memento 默认保留 100 份。 */
|
|
27
|
+
readonly limit?: number;
|
|
28
|
+
/** 只在 memento 被 LRU 回收或整个测试 store 重置时释放本地资源。 */
|
|
29
|
+
readonly dispose?: (value: T) => void;
|
|
30
|
+
/** 进行中的操作不能因 LRU 超限被回收;操作完成后返回 false 即可恢复回收。 */
|
|
31
|
+
readonly retain?: (value: T) => boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface PresenterInputRefOptions<T> {
|
|
35
|
+
readonly namespace: string;
|
|
36
|
+
readonly limit?: number;
|
|
37
|
+
readonly dispose?: (ref: MutableRefObject<T>) => void;
|
|
38
|
+
readonly retain?: (ref: MutableRefObject<T>) => boolean;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface SharedCell<T> {
|
|
42
|
+
value: T;
|
|
43
|
+
readonly subscribers: Set<() => void>;
|
|
44
|
+
leases: number;
|
|
45
|
+
alive: boolean;
|
|
46
|
+
committed: boolean;
|
|
47
|
+
dispose: ((value: T) => void) | undefined;
|
|
48
|
+
retain: ((value: T) => boolean) | undefined;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface SharedFamily<T> {
|
|
52
|
+
readonly values: Map<string, SharedCell<T>>;
|
|
53
|
+
limit: number;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const sharedStateFamilies = new Map<string, SharedFamily<unknown>>();
|
|
57
|
+
const sharedRefFamilies = new Map<string, SharedFamily<MutableRefObject<unknown>>>();
|
|
58
|
+
|
|
59
|
+
function familyFor<T>(
|
|
60
|
+
families: Map<string, SharedFamily<unknown>>,
|
|
61
|
+
namespace: string,
|
|
62
|
+
limit: number,
|
|
63
|
+
): SharedFamily<T> {
|
|
64
|
+
let family = families.get(namespace) as SharedFamily<T> | undefined;
|
|
65
|
+
if (family === undefined) {
|
|
66
|
+
family = { values: new Map(), limit: Math.max(1, limit) };
|
|
67
|
+
families.set(namespace, family as SharedFamily<unknown>);
|
|
68
|
+
}
|
|
69
|
+
return family;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function refFamilyFor<T>(namespace: string, limit: number): SharedFamily<MutableRefObject<T>> {
|
|
73
|
+
let family = sharedRefFamilies.get(namespace) as SharedFamily<MutableRefObject<T>> | undefined;
|
|
74
|
+
if (family === undefined) {
|
|
75
|
+
family = { values: new Map(), limit: Math.max(1, limit) };
|
|
76
|
+
sharedRefFamilies.set(namespace, family as unknown as SharedFamily<MutableRefObject<unknown>>);
|
|
77
|
+
}
|
|
78
|
+
return family;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function disposeCell<T>(cell: SharedCell<T>): void {
|
|
82
|
+
if (!cell.alive) return;
|
|
83
|
+
cell.alive = false;
|
|
84
|
+
cell.dispose?.(cell.value);
|
|
85
|
+
cell.subscribers.clear();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function pruneFamily<T>(family: SharedFamily<T>, protectedCell?: SharedCell<T>): void {
|
|
89
|
+
if (family.values.size <= family.limit) return;
|
|
90
|
+
// 并发 render 创建但没有提交的候选不能挤掉已提交 model。
|
|
91
|
+
for (const [key, cell] of family.values) {
|
|
92
|
+
if (family.values.size <= family.limit) break;
|
|
93
|
+
if (cell === protectedCell || cell.committed || cell.leases > 0) continue;
|
|
94
|
+
if (family.values.get(key) !== cell) continue;
|
|
95
|
+
family.values.delete(key);
|
|
96
|
+
disposeCell(cell);
|
|
97
|
+
}
|
|
98
|
+
for (const [key, cell] of family.values) {
|
|
99
|
+
if (family.values.size <= family.limit) break;
|
|
100
|
+
if (cell === protectedCell || cell.leases > 0 || cell.retain?.(cell.value) === true) continue;
|
|
101
|
+
if (family.values.get(key) !== cell) continue;
|
|
102
|
+
family.values.delete(key);
|
|
103
|
+
disposeCell(cell);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function touchCell<T>(family: SharedFamily<T>, key: string, cell: SharedCell<T>): void {
|
|
108
|
+
if (family.values.get(key) !== cell) return;
|
|
109
|
+
family.values.delete(key);
|
|
110
|
+
family.values.set(key, cell);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function schedulePrune<T>(family: SharedFamily<T>): void {
|
|
114
|
+
queueMicrotask(() => pruneFamily(family));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function sharedCell<T>(
|
|
118
|
+
family: SharedFamily<T>,
|
|
119
|
+
inputKey: string,
|
|
120
|
+
initial: T | (() => T),
|
|
121
|
+
options: PresenterInputStateOptions<T>,
|
|
122
|
+
): SharedCell<T> {
|
|
123
|
+
let cell = family.values.get(inputKey);
|
|
124
|
+
if (cell === undefined) {
|
|
125
|
+
cell = {
|
|
126
|
+
value: initialValue(initial),
|
|
127
|
+
subscribers: new Set(),
|
|
128
|
+
leases: 0,
|
|
129
|
+
alive: true,
|
|
130
|
+
committed: false,
|
|
131
|
+
dispose: options.dispose,
|
|
132
|
+
retain: options.retain,
|
|
133
|
+
};
|
|
134
|
+
family.values.set(inputKey, cell);
|
|
135
|
+
}
|
|
136
|
+
return cell;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Model 级的 thread-keyed state。物理 presenter 卸载(例如 group 最大化)不清它;
|
|
141
|
+
* 旧 input 的异步 setter 绑定旧 cell 身份,回收后不会写进同 key 的新 cell。
|
|
142
|
+
*/
|
|
143
|
+
export function usePresenterInputState<T>(
|
|
144
|
+
inputKey: string,
|
|
145
|
+
initial: T | (() => T),
|
|
146
|
+
options: PresenterInputStateOptions<T>,
|
|
147
|
+
): [T, Dispatch<SetStateAction<T>>] {
|
|
148
|
+
"use no memo";
|
|
149
|
+
// 外部 store 的可变 cell 按身份捕获;相同 value 的不同 input 不能共用读取闭包。
|
|
150
|
+
const { cell, subscribe, setValue } = useSharedCell(inputKey, initial, options);
|
|
151
|
+
const getSnapshot = useCallback(() => cell.value, [cell]);
|
|
152
|
+
const value = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
153
|
+
return [value, setValue];
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* 只订格子的一个派生值:派生值没变,格子怎么变都不叫醒调用方。`select` 要返回原始值或
|
|
158
|
+
* 稳定引用,每次新建对象会让订阅每次都判成变了。
|
|
159
|
+
*/
|
|
160
|
+
export function usePresenterInputSelector<T, S>(
|
|
161
|
+
inputKey: string,
|
|
162
|
+
initial: T | (() => T),
|
|
163
|
+
options: PresenterInputStateOptions<T>,
|
|
164
|
+
select: (value: T) => S,
|
|
165
|
+
): S {
|
|
166
|
+
"use no memo";
|
|
167
|
+
const { cell, subscribe } = useSharedCell(inputKey, initial, options);
|
|
168
|
+
const getSnapshot = () => select(cell.value);
|
|
169
|
+
return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* 只写不订:拿住格子的租约(不被回收),读写都在调用时。写照常通知订阅它的组件,
|
|
174
|
+
* 调用方自己不因格子变化重渲染。返回的对象按格子身份稳定。
|
|
175
|
+
*/
|
|
176
|
+
export function usePresenterInputWriter<T>(
|
|
177
|
+
inputKey: string,
|
|
178
|
+
initial: T | (() => T),
|
|
179
|
+
options: PresenterInputStateOptions<T>,
|
|
180
|
+
): { readonly read: () => T; readonly set: Dispatch<SetStateAction<T>> } {
|
|
181
|
+
const { cell, subscribe, setValue } = useSharedCell(inputKey, initial, options);
|
|
182
|
+
useEffect(() => subscribe(noop), [subscribe]);
|
|
183
|
+
return useMemo(() => ({ read: () => cell.value, set: setValue }), [cell, setValue]);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function noop() {}
|
|
187
|
+
|
|
188
|
+
function useSharedCell<T>(
|
|
189
|
+
inputKey: string,
|
|
190
|
+
initial: T | (() => T),
|
|
191
|
+
options: PresenterInputStateOptions<T>,
|
|
192
|
+
) {
|
|
193
|
+
const family = familyFor<T>(
|
|
194
|
+
sharedStateFamilies,
|
|
195
|
+
options.namespace,
|
|
196
|
+
options.limit ?? PRESENTER_MEMENTO_LIMIT,
|
|
197
|
+
);
|
|
198
|
+
const cell = sharedCell(family, inputKey, initial, options);
|
|
199
|
+
const limit = Math.max(1, options.limit ?? PRESENTER_MEMENTO_LIMIT);
|
|
200
|
+
const subscribe = useCallback(
|
|
201
|
+
(listener: () => void) => {
|
|
202
|
+
if (!cell.alive) return () => {};
|
|
203
|
+
family.limit = limit;
|
|
204
|
+
cell.committed = true;
|
|
205
|
+
cell.dispose = options.dispose;
|
|
206
|
+
cell.retain = options.retain;
|
|
207
|
+
touchCell(family, inputKey, cell);
|
|
208
|
+
cell.leases += 1;
|
|
209
|
+
cell.subscribers.add(listener);
|
|
210
|
+
schedulePrune(family);
|
|
211
|
+
return () => {
|
|
212
|
+
cell.subscribers.delete(listener);
|
|
213
|
+
cell.leases = Math.max(0, cell.leases - 1);
|
|
214
|
+
schedulePrune(family);
|
|
215
|
+
};
|
|
216
|
+
},
|
|
217
|
+
[cell, family, inputKey, limit, options.dispose, options.retain],
|
|
218
|
+
);
|
|
219
|
+
const setValue = useCallback<Dispatch<SetStateAction<T>>>(
|
|
220
|
+
(update) => {
|
|
221
|
+
if (!cell.alive || family.values.get(inputKey) !== cell) return;
|
|
222
|
+
const current = cell.value;
|
|
223
|
+
const next = applyState(current, update);
|
|
224
|
+
if (Object.is(current, next)) return;
|
|
225
|
+
cell.value = next;
|
|
226
|
+
touchCell(family, inputKey, cell);
|
|
227
|
+
for (const listener of cell.subscribers) listener();
|
|
228
|
+
schedulePrune(family);
|
|
229
|
+
},
|
|
230
|
+
[cell, family, inputKey],
|
|
231
|
+
);
|
|
232
|
+
return { cell, subscribe, setValue };
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/** Presenter 级的 input-local ephemeral state;重新进入同一 input 也从初值开始。 */
|
|
236
|
+
export function usePresenterInputResetState<T>(
|
|
237
|
+
inputKey: string,
|
|
238
|
+
initial: T | (() => T),
|
|
239
|
+
): [T, Dispatch<SetStateAction<T>>] {
|
|
240
|
+
const cellRef = useRef<{ key: string; value: T } | null>(null);
|
|
241
|
+
if (cellRef.current === null || cellRef.current.key !== inputKey) {
|
|
242
|
+
cellRef.current = { key: inputKey, value: initialValue(initial) };
|
|
243
|
+
}
|
|
244
|
+
const [, rerender] = useReducer((epoch: number) => epoch + 1, 0);
|
|
245
|
+
const setValue = useCallback<Dispatch<SetStateAction<T>>>(
|
|
246
|
+
(update) => {
|
|
247
|
+
const cell = cellRef.current;
|
|
248
|
+
if (cell === null || cell.key !== inputKey) return;
|
|
249
|
+
const next = applyState(cell.value, update);
|
|
250
|
+
if (Object.is(cell.value, next)) return;
|
|
251
|
+
cell.value = next;
|
|
252
|
+
rerender();
|
|
253
|
+
},
|
|
254
|
+
[inputKey],
|
|
255
|
+
);
|
|
256
|
+
return [cellRef.current.value, setValue];
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/** Model 级 ref memento;DOM handle 与 timer 仍应使用 usePresenterInputResetRef。 */
|
|
260
|
+
export function usePresenterInputRef<T>(
|
|
261
|
+
inputKey: string,
|
|
262
|
+
initial: T | (() => T),
|
|
263
|
+
options: PresenterInputRefOptions<T>,
|
|
264
|
+
): MutableRefObject<T> {
|
|
265
|
+
const limit = Math.max(1, options.limit ?? PRESENTER_MEMENTO_LIMIT);
|
|
266
|
+
const family = refFamilyFor<T>(options.namespace, limit);
|
|
267
|
+
const cell = sharedCell<MutableRefObject<T>>(
|
|
268
|
+
family,
|
|
269
|
+
inputKey,
|
|
270
|
+
() => ({ current: initialValue(initial) }),
|
|
271
|
+
options,
|
|
272
|
+
);
|
|
273
|
+
useEffect(() => {
|
|
274
|
+
if (!cell.alive || family.values.get(inputKey) !== cell) return;
|
|
275
|
+
family.limit = limit;
|
|
276
|
+
cell.committed = true;
|
|
277
|
+
cell.dispose = options.dispose;
|
|
278
|
+
cell.retain = options.retain;
|
|
279
|
+
touchCell(family, inputKey, cell);
|
|
280
|
+
cell.leases += 1;
|
|
281
|
+
schedulePrune(family);
|
|
282
|
+
return () => {
|
|
283
|
+
cell.leases = Math.max(0, cell.leases - 1);
|
|
284
|
+
schedulePrune(family);
|
|
285
|
+
};
|
|
286
|
+
}, [cell, family, inputKey, limit, options.dispose, options.retain]);
|
|
287
|
+
return cell.value;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/** Input-local ref; late callbacks keep their old object and cannot mutate the new input. */
|
|
291
|
+
export function usePresenterInputResetRef<T>(
|
|
292
|
+
inputKey: string,
|
|
293
|
+
initial: T | (() => T),
|
|
294
|
+
): MutableRefObject<T> {
|
|
295
|
+
const cellRef = useRef<{ key: string; ref: MutableRefObject<T> } | null>(null);
|
|
296
|
+
if (cellRef.current === null || cellRef.current.key !== inputKey) {
|
|
297
|
+
cellRef.current = { key: inputKey, ref: { current: initialValue(initial) } };
|
|
298
|
+
}
|
|
299
|
+
return cellRef.current.ref;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* 不挂组件地读写一份共享格子。发送路径要在还有提问没答完时折成「下一题/提交」,
|
|
304
|
+
* 而草稿答案与问题序号只存在这些格子里——读它不订阅,写它会通知已订阅的组件。
|
|
305
|
+
* 格子不存在时读到的是缺省值,不会因此建出一份。
|
|
306
|
+
*/
|
|
307
|
+
export function accessPresenterInputCell<T>(
|
|
308
|
+
namespace: string,
|
|
309
|
+
inputKey: string,
|
|
310
|
+
fallback: T,
|
|
311
|
+
): { readonly value: T; set: (update: SetStateAction<T>) => void } {
|
|
312
|
+
const family = sharedStateFamilies.get(namespace) as SharedFamily<T> | undefined;
|
|
313
|
+
const cell = family?.values.get(inputKey);
|
|
314
|
+
return {
|
|
315
|
+
// 格子里存的 null 是真值(例如「不选分支」),只有格子不存在才给缺省值。
|
|
316
|
+
value: cell === undefined ? fallback : cell.value,
|
|
317
|
+
set: (update) => {
|
|
318
|
+
if (cell === undefined || !cell.alive || family?.values.get(inputKey) !== cell) return;
|
|
319
|
+
const next = applyState(cell.value, update);
|
|
320
|
+
if (Object.is(cell.value, next)) return;
|
|
321
|
+
cell.value = next;
|
|
322
|
+
touchCell(family, inputKey, cell);
|
|
323
|
+
for (const listener of cell.subscribers) listener();
|
|
324
|
+
schedulePrune(family);
|
|
325
|
+
},
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/** 仅供隔离测试;生产 store 随页面进程存活并由各字段自己的 LRU 回收。 */
|
|
330
|
+
export function resetPresenterInputStateForTests(): void {
|
|
331
|
+
for (const family of sharedStateFamilies.values()) {
|
|
332
|
+
for (const cell of family.values.values()) disposeCell(cell);
|
|
333
|
+
family.values.clear();
|
|
334
|
+
}
|
|
335
|
+
for (const family of sharedRefFamilies.values()) {
|
|
336
|
+
for (const cell of family.values.values()) disposeCell(cell);
|
|
337
|
+
family.values.clear();
|
|
338
|
+
}
|
|
339
|
+
sharedStateFamilies.clear();
|
|
340
|
+
sharedRefFamilies.clear();
|
|
341
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 折叠态过程行共用的头部布局:宿主的工作行与 `conversation` 插件的工具组、折叠回复用同一串类。
|
|
3
|
+
* 左边缘由「8 内边距 + 8 状态点 + 6 + 16 图标 + 6」定死,思考、工具组、压缩、折叠回复的正文起点在同一条竖线上。
|
|
4
|
+
* 类名只写在这里:宿主与插件的样式表都用 `@source` 扫本包源码目录,各自编出这些工具类。
|
|
5
|
+
*/
|
|
6
|
+
export const PROCESS_ROW_HEADER_CLASS =
|
|
7
|
+
"chat-process-row flex w-full min-w-0 select-none items-center gap-1.5 px-2 text-left";
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { useCallback, useSyncExternalStore } from "react";
|
|
2
|
+
|
|
3
|
+
type DisclosureValue = boolean | number | string;
|
|
4
|
+
|
|
5
|
+
type ThreadDisclosureState = {
|
|
6
|
+
values: Map<string, DisclosureValue>;
|
|
7
|
+
listeners: Set<() => void>;
|
|
8
|
+
stringLength: number;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// 只保存最近访问线程的界面意图;虚拟行卸载不等于用户收起。
|
|
12
|
+
const threads = new Map<string, ThreadDisclosureState>();
|
|
13
|
+
const MAX_THREADS = 24;
|
|
14
|
+
const MAX_VALUES_PER_THREAD = 4_000;
|
|
15
|
+
const MAX_STRING_LENGTH = 1024;
|
|
16
|
+
const MAX_STRING_LENGTH_PER_THREAD = 16_384;
|
|
17
|
+
|
|
18
|
+
function threadState(threadKey: string): ThreadDisclosureState {
|
|
19
|
+
const existing = threads.get(threadKey);
|
|
20
|
+
if (existing) return existing;
|
|
21
|
+
const state: ThreadDisclosureState = { values: new Map(), listeners: new Set(), stringLength: 0 };
|
|
22
|
+
threads.set(threadKey, state);
|
|
23
|
+
if (threads.size > MAX_THREADS) {
|
|
24
|
+
for (const [key, candidate] of threads) {
|
|
25
|
+
if (candidate.listeners.size === 0 && key !== threadKey) {
|
|
26
|
+
threads.delete(key);
|
|
27
|
+
if (threads.size <= MAX_THREADS) break;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return state;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function readTimelineDisclosure<T extends DisclosureValue>(
|
|
35
|
+
threadKey: string,
|
|
36
|
+
key: string,
|
|
37
|
+
fallback: T,
|
|
38
|
+
): T {
|
|
39
|
+
return (threadState(threadKey).values.get(key) as T | undefined) ?? fallback;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function writeTimelineDisclosure(
|
|
43
|
+
threadKey: string,
|
|
44
|
+
key: string,
|
|
45
|
+
value: DisclosureValue,
|
|
46
|
+
notify = true,
|
|
47
|
+
): void {
|
|
48
|
+
const state = threadState(threadKey);
|
|
49
|
+
if (typeof value === "string") value = value.slice(0, MAX_STRING_LENGTH);
|
|
50
|
+
if (state.values.get(key) === value) return;
|
|
51
|
+
const previous = state.values.get(key);
|
|
52
|
+
if (typeof previous === "string") state.stringLength -= previous.length;
|
|
53
|
+
state.values.delete(key);
|
|
54
|
+
state.values.set(key, value);
|
|
55
|
+
if (typeof value === "string") state.stringLength += value.length;
|
|
56
|
+
if (state.stringLength > MAX_STRING_LENGTH_PER_THREAD) {
|
|
57
|
+
for (const [previousKey, previousValue] of state.values) {
|
|
58
|
+
if (typeof previousValue !== "string" || previousKey === key) continue;
|
|
59
|
+
state.values.delete(previousKey);
|
|
60
|
+
state.stringLength -= previousValue.length;
|
|
61
|
+
if (state.stringLength <= MAX_STRING_LENGTH_PER_THREAD) break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (state.values.size > MAX_VALUES_PER_THREAD) {
|
|
65
|
+
const firstKey = state.values.keys().next().value;
|
|
66
|
+
if (firstKey !== undefined) {
|
|
67
|
+
const removed = state.values.get(firstKey);
|
|
68
|
+
if (typeof removed === "string") state.stringLength -= removed.length;
|
|
69
|
+
state.values.delete(firstKey);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (notify) state.listeners.forEach((listener) => listener());
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function useTimelineDisclosure<T extends DisclosureValue>(
|
|
76
|
+
threadKey: string,
|
|
77
|
+
key: string,
|
|
78
|
+
fallback: T,
|
|
79
|
+
): readonly [T, (next: T) => void] {
|
|
80
|
+
const subscribe = useCallback(
|
|
81
|
+
(listener: () => void) => {
|
|
82
|
+
const state = threadState(threadKey);
|
|
83
|
+
state.listeners.add(listener);
|
|
84
|
+
return () => state.listeners.delete(listener);
|
|
85
|
+
},
|
|
86
|
+
[threadKey],
|
|
87
|
+
);
|
|
88
|
+
const getSnapshot = useCallback(
|
|
89
|
+
() => readTimelineDisclosure(threadKey, key, fallback),
|
|
90
|
+
[threadKey, key, fallback],
|
|
91
|
+
);
|
|
92
|
+
const value = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
93
|
+
const setValue = useCallback(
|
|
94
|
+
(next: T) => writeTimelineDisclosure(threadKey, key, next),
|
|
95
|
+
[threadKey, key],
|
|
96
|
+
);
|
|
97
|
+
return [value, setValue];
|
|
98
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { useCallback, useSyncExternalStore } from "react";
|
|
2
|
+
|
|
3
|
+
const BREAKPOINTS = {
|
|
4
|
+
"2xl": 1536,
|
|
5
|
+
"3xl": 1600,
|
|
6
|
+
"4xl": 2000,
|
|
7
|
+
lg: 1024,
|
|
8
|
+
md: 768,
|
|
9
|
+
sm: 640,
|
|
10
|
+
xl: 1280,
|
|
11
|
+
} as const;
|
|
12
|
+
|
|
13
|
+
type Breakpoint = keyof typeof BREAKPOINTS;
|
|
14
|
+
|
|
15
|
+
type BreakpointQuery = Breakpoint | `max-${Breakpoint}` | `${Breakpoint}:max-${Breakpoint}`;
|
|
16
|
+
|
|
17
|
+
function resolveMin(value: Breakpoint | number): string {
|
|
18
|
+
const px = typeof value === "number" ? value : BREAKPOINTS[value];
|
|
19
|
+
return `(min-width: ${px}px)`;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function resolveMax(value: Breakpoint | number): string {
|
|
23
|
+
const px = typeof value === "number" ? value : BREAKPOINTS[value];
|
|
24
|
+
return `(max-width: ${px - 1}px)`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function parseQuery(query: BreakpointQuery | MediaQueryInput | (string & {})): string {
|
|
28
|
+
if (typeof query !== "string") {
|
|
29
|
+
const parts: string[] = [];
|
|
30
|
+
if (query.min != null) parts.push(resolveMin(query.min));
|
|
31
|
+
if (query.max != null) parts.push(resolveMax(query.max));
|
|
32
|
+
if (query.pointer === "coarse") parts.push("(pointer: coarse)");
|
|
33
|
+
if (query.pointer === "fine") parts.push("(pointer: fine)");
|
|
34
|
+
if (parts.length === 0) return "(min-width: 0px)";
|
|
35
|
+
return parts.join(" and ");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (query.startsWith("(")) return query;
|
|
39
|
+
|
|
40
|
+
const parts: string[] = [];
|
|
41
|
+
for (const segment of query.split(":")) {
|
|
42
|
+
if (segment.startsWith("max-")) {
|
|
43
|
+
const bp = segment.slice(4);
|
|
44
|
+
if (bp in BREAKPOINTS) parts.push(resolveMax(bp as Breakpoint));
|
|
45
|
+
} else if (segment in BREAKPOINTS) {
|
|
46
|
+
parts.push(resolveMin(segment as Breakpoint));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return parts.length > 0 ? parts.join(" and ") : query;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function getServerSnapshot(): boolean {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export type MediaQueryInput = {
|
|
58
|
+
min?: Breakpoint | number;
|
|
59
|
+
max?: Breakpoint | number;
|
|
60
|
+
/** Touch-like input (finger). Use "fine" for mouse/trackpad. */
|
|
61
|
+
pointer?: "coarse" | "fine";
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export function useMediaQuery(query: BreakpointQuery | MediaQueryInput | (string & {})): boolean {
|
|
65
|
+
const mediaQuery = parseQuery(query);
|
|
66
|
+
|
|
67
|
+
const subscribe = useCallback(
|
|
68
|
+
(callback: () => void) => {
|
|
69
|
+
if (typeof window === "undefined") return () => {};
|
|
70
|
+
const mql = window.matchMedia(mediaQuery);
|
|
71
|
+
mql.addEventListener("change", callback);
|
|
72
|
+
return () => mql.removeEventListener("change", callback);
|
|
73
|
+
},
|
|
74
|
+
[mediaQuery],
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const getSnapshot = useCallback(() => {
|
|
78
|
+
if (typeof window === "undefined") return false;
|
|
79
|
+
return window.matchMedia(mediaQuery).matches;
|
|
80
|
+
}, [mediaQuery]);
|
|
81
|
+
|
|
82
|
+
return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function useIsMobile(): boolean {
|
|
86
|
+
return useMediaQuery("max-md");
|
|
87
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 时间线工作行的图标与过程态规则:工具组按动作取图标、计数,过程行按工具状态取三态。
|
|
3
|
+
* web 的工作行与 `conversation` 插件的工具组共用;图标与外壳本身由宿主画(插件经 `bridge.ui` 借用)。
|
|
4
|
+
*/
|
|
5
|
+
import type {
|
|
6
|
+
ConversationToolGroupAction,
|
|
7
|
+
ConversationWorkEntryStatus,
|
|
8
|
+
} from "@ycodium-ai/plugin-api/conversation";
|
|
9
|
+
import type { TimelineProcessState, WorkEntryIconName } from "@ycodium-ai/plugin-api/ui";
|
|
10
|
+
|
|
11
|
+
/** 工具行的状态直接映射成外壳状态;失败优先于进行中。 */
|
|
12
|
+
export function processStateFromWorkStatus(
|
|
13
|
+
status: ConversationWorkEntryStatus | undefined,
|
|
14
|
+
): TimelineProcessState {
|
|
15
|
+
if (status === "failed") return "failed";
|
|
16
|
+
if (status === "running") return "running";
|
|
17
|
+
return "idle";
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** 一组里任一条失败就整组失败,其次是还有在跑的。 */
|
|
21
|
+
export function aggregateProcessState(
|
|
22
|
+
states: ReadonlyArray<TimelineProcessState>,
|
|
23
|
+
): TimelineProcessState {
|
|
24
|
+
if (states.includes("failed")) return "failed";
|
|
25
|
+
if (states.includes("running")) return "running";
|
|
26
|
+
return "idle";
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
type ToolGroupSummaryIconKind =
|
|
30
|
+
| ConversationToolGroupAction
|
|
31
|
+
| "dynamic-tool"
|
|
32
|
+
| "agent-tool"
|
|
33
|
+
| "tone-tool"
|
|
34
|
+
| "mixed"
|
|
35
|
+
| null;
|
|
36
|
+
|
|
37
|
+
export function toolGroupSummaryIconName(kind: ToolGroupSummaryIconKind): WorkEntryIconName {
|
|
38
|
+
switch (kind) {
|
|
39
|
+
case "read":
|
|
40
|
+
return "eye";
|
|
41
|
+
case "edit":
|
|
42
|
+
return "square-pen";
|
|
43
|
+
case "command":
|
|
44
|
+
return "terminal";
|
|
45
|
+
case "search":
|
|
46
|
+
return "globe";
|
|
47
|
+
case "code-search":
|
|
48
|
+
return "search";
|
|
49
|
+
case "other":
|
|
50
|
+
return "wrench";
|
|
51
|
+
case "dynamic-tool":
|
|
52
|
+
return "hammer";
|
|
53
|
+
case "agent-tool":
|
|
54
|
+
return "bot";
|
|
55
|
+
case "tone-tool":
|
|
56
|
+
return "zap";
|
|
57
|
+
case "mixed":
|
|
58
|
+
case null:
|
|
59
|
+
return "hammer";
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface ToolGroupActionTally {
|
|
64
|
+
readonly action: ConversationToolGroupAction;
|
|
65
|
+
readonly icon: WorkEntryIconName;
|
|
66
|
+
readonly count: number;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* 一组工具调用按动作分类计数,按首次出现的顺序返回。折叠态用它画一排「图标+数字」:
|
|
71
|
+
* 一组里混着读和改时,选哪个都在撒谎,把两种都画出来反而不用选。动作判定由调用方给。
|
|
72
|
+
*/
|
|
73
|
+
export function tallyToolGroupActions<Entry>(
|
|
74
|
+
entries: ReadonlyArray<Entry>,
|
|
75
|
+
toolGroupAction: (entry: Entry) => ConversationToolGroupAction,
|
|
76
|
+
): ToolGroupActionTally[] {
|
|
77
|
+
const counts = new Map<ConversationToolGroupAction, number>();
|
|
78
|
+
for (const entry of entries) {
|
|
79
|
+
const action = toolGroupAction(entry);
|
|
80
|
+
counts.set(action, (counts.get(action) ?? 0) + 1);
|
|
81
|
+
}
|
|
82
|
+
return Array.from(counts, ([action, count]) => ({
|
|
83
|
+
action,
|
|
84
|
+
icon: toolGroupSummaryIconName(action),
|
|
85
|
+
count,
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** 一个图标槽只画得下一类动作,取数量最多的那一类(并列时取先出现的)。 */
|
|
90
|
+
export function dominantToolGroupIcon<Entry>(
|
|
91
|
+
entries: ReadonlyArray<Entry>,
|
|
92
|
+
toolGroupAction: (entry: Entry) => ConversationToolGroupAction,
|
|
93
|
+
): WorkEntryIconName {
|
|
94
|
+
let best: ToolGroupActionTally | undefined;
|
|
95
|
+
for (const tally of tallyToolGroupActions(entries, toolGroupAction)) {
|
|
96
|
+
if (!best || tally.count > best.count) best = tally;
|
|
97
|
+
}
|
|
98
|
+
return best?.icon ?? "wrench";
|
|
99
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 范围判定:一个路径算不算落在某个根目录之下。认 Windows 扩展长度前缀、UNC 与两种分隔符;
|
|
3
|
+
* 大小写是否敏感由调用方按根所在的文件系统给出。
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const EXTENDED_LENGTH_UNC = "//?/UNC/";
|
|
7
|
+
const EXTENDED_LENGTH = "//?/";
|
|
8
|
+
|
|
9
|
+
function normalize(value: string, caseInsensitive: boolean): string {
|
|
10
|
+
let unified = value.trim().replace(/\\/gu, "/");
|
|
11
|
+
const upper = unified.toUpperCase();
|
|
12
|
+
if (upper.startsWith(EXTENDED_LENGTH_UNC)) {
|
|
13
|
+
unified = `//${unified.slice(EXTENDED_LENGTH_UNC.length)}`;
|
|
14
|
+
} else if (upper.startsWith(EXTENDED_LENGTH)) {
|
|
15
|
+
unified = unified.slice(EXTENDED_LENGTH.length);
|
|
16
|
+
}
|
|
17
|
+
const isUnc = unified.startsWith("//");
|
|
18
|
+
unified = unified.replace(/\/+/gu, "/").replace(/\/+$/u, "");
|
|
19
|
+
if (isUnc) unified = `/${unified}`;
|
|
20
|
+
return caseInsensitive ? unified.toLowerCase() : unified;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function isWithinDirectory(
|
|
24
|
+
candidate: string,
|
|
25
|
+
root: string,
|
|
26
|
+
caseInsensitive: boolean,
|
|
27
|
+
): boolean {
|
|
28
|
+
const normalizedRoot = normalize(root, caseInsensitive);
|
|
29
|
+
if (normalizedRoot.length === 0 || normalizedRoot === "/") return false;
|
|
30
|
+
const normalizedCandidate = normalize(candidate, caseInsensitive);
|
|
31
|
+
return (
|
|
32
|
+
normalizedCandidate === normalizedRoot || normalizedCandidate.startsWith(`${normalizedRoot}/`)
|
|
33
|
+
);
|
|
34
|
+
}
|