@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,44 @@
|
|
|
1
|
+
// @effect-diagnostics globalDate:off - 纯界面口径:唤醒时间按本地日历写,不跑在 Effect 运行时里。
|
|
2
|
+
/** 排队条目在各界面上共用的读法:能不能改、行内正文取哪一行、唤醒时间怎么写、来源标记读哪个 key。 */
|
|
3
|
+
/**
|
|
4
|
+
* 只有你的消息和定时唤醒能改、能拖;其余来源与没有来源的旧条目只能取消。定时唤醒被宿主并进别的通知后,
|
|
5
|
+
* 服务器不再给修改权,也按只能取消来画。
|
|
6
|
+
*/
|
|
7
|
+
export function isLockedQueueEntry(entry) {
|
|
8
|
+
if (entry.source?.kind === "user")
|
|
9
|
+
return false;
|
|
10
|
+
if (entry.source?.kind === "scheduled-wake")
|
|
11
|
+
return entry.management === undefined;
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
/** 正文的第一行非空文字(去掉两端空白);没有就是空串。 */
|
|
15
|
+
export const firstQueueLine = (text) => (text ?? "")
|
|
16
|
+
.split("\n")
|
|
17
|
+
.map((line) => line.trim())
|
|
18
|
+
.find((line) => line !== "") ?? "";
|
|
19
|
+
/** 同一天只写钟点;别的日子带上日期。`locale` 不给就按运行环境的默认语言。 */
|
|
20
|
+
export function formatQueueWakeTime(iso, locale) {
|
|
21
|
+
const date = new Date(iso);
|
|
22
|
+
if (Number.isNaN(date.getTime()))
|
|
23
|
+
return iso;
|
|
24
|
+
return new Intl.DateTimeFormat(locale, {
|
|
25
|
+
...(date.toDateString() === new Date().toDateString() ? {} : { dateStyle: "short" }),
|
|
26
|
+
timeStyle: "short",
|
|
27
|
+
}).format(date);
|
|
28
|
+
}
|
|
29
|
+
/** 行首类型标记的文案 key,按来源种类;文案表只存 key,各界面经 hook 解析。 */
|
|
30
|
+
export const QUEUE_SOURCE_LABEL_KEY = {
|
|
31
|
+
user: "turnQueue.sourceUser",
|
|
32
|
+
schedule: "turnQueue.sourceSchedule",
|
|
33
|
+
"scheduled-wake": "turnQueue.sourceScheduledWake",
|
|
34
|
+
record: "turnQueue.sourceSession",
|
|
35
|
+
session: "turnQueue.sourceSession",
|
|
36
|
+
reply: "turnQueue.sourceReply",
|
|
37
|
+
"child-report": "turnQueue.sourceChildReport",
|
|
38
|
+
"plugin-wake": "turnQueue.sourcePluginWake",
|
|
39
|
+
"board-dispatch": "turnQueue.sourceBoardDispatch",
|
|
40
|
+
"plugin-notice": "turnQueue.sourcePluginNotice",
|
|
41
|
+
"home-machine": "turnQueue.sourceHomeMachine",
|
|
42
|
+
"restart-resume": "turnQueue.sourceRestartResume",
|
|
43
|
+
"remote-post": "turnQueue.sourceRemotePost",
|
|
44
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 用户消息里 `<review_comment>` 块的读法:拆成文字与评论段、取评论的属性与正文、把只有 hunk 的
|
|
3
|
+
* diff 补成可渲染的 patch。web 写块(`appendReviewCommentsToPrompt`),`conversation` 插件与
|
|
4
|
+
* mobile 读块。块上没给的 sectionTitle / rangeLabel 读成 null,默认文案由展示处决定。
|
|
5
|
+
*/
|
|
6
|
+
export interface ReviewCommentBlock {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly sectionId: string;
|
|
9
|
+
/** sectionTitle / rangeLabel 块上没给时为 null,默认文案由展示处翻译。 */
|
|
10
|
+
readonly sectionTitle: string | null;
|
|
11
|
+
readonly filePath: string;
|
|
12
|
+
readonly startIndex: number;
|
|
13
|
+
readonly endIndex: number;
|
|
14
|
+
readonly rangeLabel: string | null;
|
|
15
|
+
readonly text: string;
|
|
16
|
+
readonly diff: string;
|
|
17
|
+
readonly fenceLanguage?: string | undefined;
|
|
18
|
+
}
|
|
19
|
+
export type ReviewCommentMessageSegment = {
|
|
20
|
+
readonly kind: "text";
|
|
21
|
+
readonly id: string;
|
|
22
|
+
readonly text: string;
|
|
23
|
+
} | {
|
|
24
|
+
readonly kind: "review-comment";
|
|
25
|
+
readonly comment: ReviewCommentBlock;
|
|
26
|
+
};
|
|
27
|
+
export declare function parseReviewCommentMessageSegments(value: string): ReadonlyArray<ReviewCommentMessageSegment>;
|
|
28
|
+
export declare function formatReviewCommentFence(language: string, contents: string): string;
|
|
29
|
+
export declare function buildReviewCommentRenderablePatch(comment: Pick<ReviewCommentBlock, "fenceLanguage" | "diff" | "filePath">): string;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
const REVIEW_COMMENT_BLOCK_PATTERN = /<review_comment\b([^>]*)>\s*([\s\S]*?)<\/review_comment>/g;
|
|
2
|
+
const REVIEW_COMMENT_ATTRIBUTE_PATTERN = /([a-zA-Z][a-zA-Z0-9_-]*)="([^"]*)"/g;
|
|
3
|
+
const REVIEW_COMMENT_FENCE_PATTERN = /(`{3,})([^\s`]*)[^\n]*\n([\s\S]*?)\n\1/g;
|
|
4
|
+
function unescapeReviewCommentAttribute(value) {
|
|
5
|
+
return value
|
|
6
|
+
.replace(/</g, "<")
|
|
7
|
+
.replace(/>/g, ">")
|
|
8
|
+
.replace(/"/g, '"')
|
|
9
|
+
.replace(/&/g, "&");
|
|
10
|
+
}
|
|
11
|
+
function readReviewCommentAttributes(rawAttributes) {
|
|
12
|
+
const attributes = {};
|
|
13
|
+
for (const match of rawAttributes.matchAll(REVIEW_COMMENT_ATTRIBUTE_PATTERN)) {
|
|
14
|
+
attributes[match[1]] = unescapeReviewCommentAttribute(match[2] ?? "");
|
|
15
|
+
}
|
|
16
|
+
return attributes;
|
|
17
|
+
}
|
|
18
|
+
function readNonNegativeInteger(value) {
|
|
19
|
+
if (value === undefined || !/^\d+$/.test(value)) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
return Number(value);
|
|
23
|
+
}
|
|
24
|
+
function extractReviewCommentBody(rawBody) {
|
|
25
|
+
const matches = Array.from(rawBody.matchAll(REVIEW_COMMENT_FENCE_PATTERN));
|
|
26
|
+
const match = matches.at(-1);
|
|
27
|
+
const fenceIndex = match?.index;
|
|
28
|
+
return {
|
|
29
|
+
text: rawBody.slice(0, fenceIndex ?? rawBody.length).trim(),
|
|
30
|
+
language: match?.[2]?.trim() || "diff",
|
|
31
|
+
contents: match?.[3] ?? "",
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function parseReviewCommentContext(rawAttributes, rawBody, index) {
|
|
35
|
+
const attributes = readReviewCommentAttributes(rawAttributes);
|
|
36
|
+
const startIndex = readNonNegativeInteger(attributes.startIndex);
|
|
37
|
+
const endIndex = readNonNegativeInteger(attributes.endIndex);
|
|
38
|
+
const filePath = attributes.filePath?.trim();
|
|
39
|
+
const sectionId = attributes.sectionId?.trim();
|
|
40
|
+
if (!filePath || !sectionId || startIndex === null || endIndex === null) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
const body = extractReviewCommentBody(rawBody);
|
|
44
|
+
return {
|
|
45
|
+
id: `review-comment:${index}:${sectionId}:${filePath}:${startIndex}:${endIndex}`,
|
|
46
|
+
sectionId,
|
|
47
|
+
sectionTitle: attributes.sectionTitle?.trim() || null,
|
|
48
|
+
filePath,
|
|
49
|
+
startIndex: Math.min(startIndex, endIndex),
|
|
50
|
+
endIndex: Math.max(startIndex, endIndex),
|
|
51
|
+
rangeLabel: attributes.rangeLabel?.trim() || null,
|
|
52
|
+
text: body.text,
|
|
53
|
+
diff: body.contents,
|
|
54
|
+
fenceLanguage: body.language,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export function parseReviewCommentMessageSegments(value) {
|
|
58
|
+
const segments = [];
|
|
59
|
+
let cursor = 0;
|
|
60
|
+
let parsedCommentIndex = 0;
|
|
61
|
+
for (const match of value.matchAll(REVIEW_COMMENT_BLOCK_PATTERN)) {
|
|
62
|
+
const matchIndex = match.index ?? 0;
|
|
63
|
+
const beforeText = value.slice(cursor, matchIndex);
|
|
64
|
+
if (beforeText.length > 0) {
|
|
65
|
+
segments.push({
|
|
66
|
+
kind: "text",
|
|
67
|
+
id: `review-comment-text:${cursor}`,
|
|
68
|
+
text: beforeText,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
const comment = parseReviewCommentContext(match[1] ?? "", match[2] ?? "", parsedCommentIndex);
|
|
72
|
+
if (comment) {
|
|
73
|
+
segments.push({ kind: "review-comment", comment });
|
|
74
|
+
parsedCommentIndex += 1;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
segments.push({
|
|
78
|
+
kind: "text",
|
|
79
|
+
id: `review-comment-invalid:${matchIndex}`,
|
|
80
|
+
text: match[0],
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
cursor = matchIndex + match[0].length;
|
|
84
|
+
}
|
|
85
|
+
const rest = value.slice(cursor);
|
|
86
|
+
if (rest.length > 0) {
|
|
87
|
+
segments.push({
|
|
88
|
+
kind: "text",
|
|
89
|
+
id: `review-comment-text:${cursor}`,
|
|
90
|
+
text: rest,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return segments;
|
|
94
|
+
}
|
|
95
|
+
export function formatReviewCommentFence(language, contents) {
|
|
96
|
+
const longestBacktickRun = Math.max(0, ...Array.from(contents.matchAll(/`+/g), (match) => match[0].length));
|
|
97
|
+
const fence = "`".repeat(Math.max(3, longestBacktickRun + 1));
|
|
98
|
+
return [`${fence}${language}`, contents.trimEnd(), fence].join("\n");
|
|
99
|
+
}
|
|
100
|
+
export function buildReviewCommentRenderablePatch(comment) {
|
|
101
|
+
if ((comment.fenceLanguage ?? "diff") !== "diff") {
|
|
102
|
+
return "";
|
|
103
|
+
}
|
|
104
|
+
const diff = comment.diff.trim();
|
|
105
|
+
if (diff.length === 0) {
|
|
106
|
+
return "";
|
|
107
|
+
}
|
|
108
|
+
if (diff.startsWith("diff --git ")) {
|
|
109
|
+
return diff;
|
|
110
|
+
}
|
|
111
|
+
const normalizedPath = comment.filePath.replaceAll("\\", "/");
|
|
112
|
+
return [
|
|
113
|
+
`diff --git a/${normalizedPath} b/${normalizedPath}`,
|
|
114
|
+
`--- a/${normalizedPath}`,
|
|
115
|
+
`+++ b/${normalizedPath}`,
|
|
116
|
+
diff,
|
|
117
|
+
].join("\n");
|
|
118
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type RankedSearchResult<T> = {
|
|
2
|
+
item: T;
|
|
3
|
+
score: number;
|
|
4
|
+
tieBreaker: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function normalizeSearchQuery(input: string, options?: {
|
|
7
|
+
trimLeadingPattern?: RegExp;
|
|
8
|
+
}): string;
|
|
9
|
+
export declare function scoreSubsequenceMatch(value: string, query: string): number | null;
|
|
10
|
+
/**
|
|
11
|
+
* Scores how well `value` matches `query` using tiered match strategies.
|
|
12
|
+
*
|
|
13
|
+
* **Expects pre-normalized inputs**: both `value` and `query` must already be
|
|
14
|
+
* trimmed and lowercased (e.g. via {@link normalizeSearchQuery}).
|
|
15
|
+
*/
|
|
16
|
+
export declare function scoreQueryMatch(input: {
|
|
17
|
+
value: string;
|
|
18
|
+
query: string;
|
|
19
|
+
exactBase: number;
|
|
20
|
+
prefixBase?: number;
|
|
21
|
+
boundaryBase?: number;
|
|
22
|
+
includesBase?: number;
|
|
23
|
+
fuzzyBase?: number;
|
|
24
|
+
boundaryMarkers?: readonly string[];
|
|
25
|
+
}): number | null;
|
|
26
|
+
export declare function compareRankedSearchResults<T>(left: RankedSearchResult<T>, right: RankedSearchResult<T>): number;
|
|
27
|
+
export declare function insertRankedSearchResult<T>(rankedEntries: RankedSearchResult<T>[], candidate: RankedSearchResult<T>, limit: number): void;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
export function normalizeSearchQuery(input, options) {
|
|
2
|
+
const trimmed = input.trim();
|
|
3
|
+
if (!trimmed) {
|
|
4
|
+
return "";
|
|
5
|
+
}
|
|
6
|
+
return options?.trimLeadingPattern
|
|
7
|
+
? trimmed.replace(options.trimLeadingPattern, "").toLowerCase()
|
|
8
|
+
: trimmed.toLowerCase();
|
|
9
|
+
}
|
|
10
|
+
export function scoreSubsequenceMatch(value, query) {
|
|
11
|
+
if (!query)
|
|
12
|
+
return 0;
|
|
13
|
+
let queryIndex = 0;
|
|
14
|
+
let firstMatchIndex = -1;
|
|
15
|
+
let previousMatchIndex = -1;
|
|
16
|
+
let gapPenalty = 0;
|
|
17
|
+
for (let valueIndex = 0; valueIndex < value.length; valueIndex += 1) {
|
|
18
|
+
if (value[valueIndex] !== query[queryIndex]) {
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
if (firstMatchIndex === -1) {
|
|
22
|
+
firstMatchIndex = valueIndex;
|
|
23
|
+
}
|
|
24
|
+
if (previousMatchIndex !== -1) {
|
|
25
|
+
gapPenalty += valueIndex - previousMatchIndex - 1;
|
|
26
|
+
}
|
|
27
|
+
previousMatchIndex = valueIndex;
|
|
28
|
+
queryIndex += 1;
|
|
29
|
+
if (queryIndex === query.length) {
|
|
30
|
+
const spanPenalty = valueIndex - firstMatchIndex + 1 - query.length;
|
|
31
|
+
const lengthPenalty = Math.min(64, value.length - query.length);
|
|
32
|
+
return firstMatchIndex * 2 + gapPenalty * 3 + spanPenalty + lengthPenalty;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
function lengthPenalty(value, query) {
|
|
38
|
+
return Math.min(64, Math.max(0, value.length - query.length));
|
|
39
|
+
}
|
|
40
|
+
function findBoundaryMatchIndex(value, query, boundaryMarkers) {
|
|
41
|
+
let bestIndex = null;
|
|
42
|
+
for (const marker of boundaryMarkers) {
|
|
43
|
+
const index = value.indexOf(`${marker}${query}`);
|
|
44
|
+
if (index === -1) {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
const matchIndex = index + marker.length;
|
|
48
|
+
if (bestIndex === null || matchIndex < bestIndex) {
|
|
49
|
+
bestIndex = matchIndex;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return bestIndex;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Scores how well `value` matches `query` using tiered match strategies.
|
|
56
|
+
*
|
|
57
|
+
* **Expects pre-normalized inputs**: both `value` and `query` must already be
|
|
58
|
+
* trimmed and lowercased (e.g. via {@link normalizeSearchQuery}).
|
|
59
|
+
*/
|
|
60
|
+
export function scoreQueryMatch(input) {
|
|
61
|
+
const { value, query } = input;
|
|
62
|
+
if (!value || !query) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
if (value === query) {
|
|
66
|
+
return input.exactBase;
|
|
67
|
+
}
|
|
68
|
+
if (input.prefixBase !== undefined && value.startsWith(query)) {
|
|
69
|
+
return input.prefixBase + lengthPenalty(value, query);
|
|
70
|
+
}
|
|
71
|
+
if (input.boundaryBase !== undefined) {
|
|
72
|
+
const boundaryIndex = findBoundaryMatchIndex(value, query, input.boundaryMarkers ?? [" ", "-", "_", "/"]);
|
|
73
|
+
if (boundaryIndex !== null) {
|
|
74
|
+
return input.boundaryBase + boundaryIndex * 2 + lengthPenalty(value, query);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (input.includesBase !== undefined) {
|
|
78
|
+
const includesIndex = value.indexOf(query);
|
|
79
|
+
if (includesIndex !== -1) {
|
|
80
|
+
return input.includesBase + includesIndex * 2 + lengthPenalty(value, query);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (input.fuzzyBase !== undefined) {
|
|
84
|
+
const fuzzyScore = scoreSubsequenceMatch(value, query);
|
|
85
|
+
if (fuzzyScore !== null) {
|
|
86
|
+
return input.fuzzyBase + fuzzyScore;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
export function compareRankedSearchResults(left, right) {
|
|
92
|
+
const scoreDelta = left.score - right.score;
|
|
93
|
+
if (scoreDelta !== 0)
|
|
94
|
+
return scoreDelta;
|
|
95
|
+
return left.tieBreaker.localeCompare(right.tieBreaker);
|
|
96
|
+
}
|
|
97
|
+
function findInsertionIndex(rankedEntries, candidate) {
|
|
98
|
+
let low = 0;
|
|
99
|
+
let high = rankedEntries.length;
|
|
100
|
+
while (low < high) {
|
|
101
|
+
const middle = low + Math.floor((high - low) / 2);
|
|
102
|
+
const current = rankedEntries[middle];
|
|
103
|
+
if (!current) {
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
if (compareRankedSearchResults(candidate, current) < 0) {
|
|
107
|
+
high = middle;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
low = middle + 1;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return low;
|
|
114
|
+
}
|
|
115
|
+
export function insertRankedSearchResult(rankedEntries, candidate, limit) {
|
|
116
|
+
if (limit <= 0) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const insertionIndex = findInsertionIndex(rankedEntries, candidate);
|
|
120
|
+
if (rankedEntries.length < limit) {
|
|
121
|
+
rankedEntries.splice(insertionIndex, 0, candidate);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (insertionIndex >= limit) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
rankedEntries.splice(insertionIndex, 0, candidate);
|
|
128
|
+
rankedEntries.pop();
|
|
129
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 技能 token 的写法:`$name` 或 `/name`。输入区菜单与芯片、时间线芯片、宿主的手动调用展开与
|
|
3
|
+
* Claude 的斜杠派发都按这里切,一个 token 在每个入口判成同一个技能。
|
|
4
|
+
*/
|
|
5
|
+
/** 技能 token 的名字(`$` 或 `/` 之后那段)。 */
|
|
6
|
+
export declare const SKILL_TOKEN_NAME_PATTERN = "[a-zA-Z][a-zA-Z0-9:_-]*";
|
|
7
|
+
/** 输入区的基础 token 边界;触发检测与 `/name` 改写默认都用它,编辑器可在此之上扩展。 */
|
|
8
|
+
export declare function isComposerWhitespace(char: string): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* 用户能不能起这个技能:provider 设置里关掉的不会执行,provider 留给 agent 的(Claude 的
|
|
11
|
+
* `user-invocable: false`)拒绝用户调用。其余照常可选,包括 agent 不能自己起的技能:服务端会把
|
|
12
|
+
* 选择改写成 provider 自己的调用形式。输入区菜单、手打改写与发送侧指示行都按它判。
|
|
13
|
+
*/
|
|
14
|
+
export declare function isProviderSkillUserInvocable(skill: {
|
|
15
|
+
readonly enabled: boolean;
|
|
16
|
+
readonly userInvocable?: boolean | undefined;
|
|
17
|
+
}): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Ycodium 会话技能的命名空间:会话技能目录当插件加载时的插件名(CLI 报上来的名字带 `ycodium:` 前缀),
|
|
20
|
+
* 也是菜单里这些技能的 scope。只有它们认 `ycodium:` 前缀写法。
|
|
21
|
+
*/
|
|
22
|
+
export declare const SESSION_SKILL_NAMESPACE = "ycodium";
|
|
23
|
+
export type SkillTokenSigil = "$" | "/";
|
|
24
|
+
export interface SkillToken {
|
|
25
|
+
readonly sigil: SkillTokenSigil;
|
|
26
|
+
readonly name: string;
|
|
27
|
+
/** token 在原文里的范围,含开头的 `$` / `/`。 */
|
|
28
|
+
readonly start: number;
|
|
29
|
+
readonly end: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 行首或空白之后、到空白或结尾为止的整个 `$name` / `/name`。先读完整个 token 再比对名字,
|
|
33
|
+
* `$reviewExtra`、`/review/notes`、`src/review` 都不会按前缀命中。
|
|
34
|
+
*/
|
|
35
|
+
export declare function findSkillTokens(text: string): SkillToken[];
|
|
36
|
+
/** 正好从 `index` 开始的技能 token(规则同 {@link findSkillTokens});不是就 undefined。 */
|
|
37
|
+
export declare function skillTokenAt(text: string, index: number): SkillToken | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* `name` 是不是 `known` 里的技能:原样命中,或去掉 `ycodium:` 前缀后命中(菜单按目录名列会话技能,
|
|
40
|
+
* CLI 报的是带前缀的写法)。是就返回 `known` 里的那个名字。区分大小写,与 CLI 一致。
|
|
41
|
+
*/
|
|
42
|
+
export declare function resolveSkillName(name: string, known: {
|
|
43
|
+
readonly has: (name: string) => boolean;
|
|
44
|
+
}): string | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* token 里的名字对应索引里的哪个技能:原样命中;或带 `ycodium:` 前缀、去掉后命中一个会话技能
|
|
47
|
+
* (scope 为 {@link SESSION_SKILL_NAMESPACE})。普通 provider 技能只按完整名字认:用户自己的 `review`
|
|
48
|
+
* 不认 `/ycodium:review`,跟服务端指示行、Claude 派发按完整名字匹配一致。
|
|
49
|
+
*/
|
|
50
|
+
export declare function lookupSkill<Skill extends {
|
|
51
|
+
readonly name: string;
|
|
52
|
+
readonly scope?: string | undefined;
|
|
53
|
+
}>(name: string, index: ReadonlyMap<string, Skill>): Skill | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* 用户刚在手打的 `/name` 后面敲了一个空白、且 `name` 是索引里的技能(按 {@link lookupSkill} 认):返回把它改写成 `$name` 的
|
|
56
|
+
* 替换(范围含那个空白,替换后光标落在它后面),与从菜单选中同一个结果。只认「这次编辑恰好插入了
|
|
57
|
+
* 一个空白,并由它结束了 token」:粘贴进来的、本来就已结束的 `/name` 保持原样。插入点从前后文字的
|
|
58
|
+
* 差异里取,不要光标:连着的空白里取最左那处,正好紧跟 token。`isBoundary` 与触发检测的
|
|
59
|
+
* `isWhitespaceChar` 是同一条规则(web 的终端上下文占位符也算 token 边界);敲下的那个字符
|
|
60
|
+
* 本身必须是真空白。
|
|
61
|
+
*/
|
|
62
|
+
export declare function typedSlashSkillCompletion(previous: string, next: string, index: ReadonlyMap<string, {
|
|
63
|
+
readonly name: string;
|
|
64
|
+
readonly scope?: string | undefined;
|
|
65
|
+
}>, isBoundary?: (char: string) => boolean): {
|
|
66
|
+
readonly start: number;
|
|
67
|
+
readonly end: number;
|
|
68
|
+
readonly replacement: string;
|
|
69
|
+
} | null;
|
|
70
|
+
/** 技能按名字建的索引;一份清单建一次,同一条消息 / 文档里的各段文字共用。 */
|
|
71
|
+
export declare function skillIndex<Skill extends {
|
|
72
|
+
readonly name: string;
|
|
73
|
+
}>(skills: ReadonlyArray<Skill>): ReadonlyMap<string, Skill>;
|
|
74
|
+
/** 正文里命中索引的技能 token,带上命中的那个技能;不认识的名字(`$HOME`、`/usr`)跳过。 */
|
|
75
|
+
export declare function matchSkillTokens<Skill extends {
|
|
76
|
+
readonly name: string;
|
|
77
|
+
readonly scope?: string | undefined;
|
|
78
|
+
}>(text: string, index: ReadonlyMap<string, Skill>): Array<SkillToken & {
|
|
79
|
+
readonly skill: Skill;
|
|
80
|
+
}>;
|
|
81
|
+
/** 正文按命中的技能 token 切开:文字原样,技能段带原文(`$name` / `/name`)。 */
|
|
82
|
+
export type SkillTextPart<Skill> = {
|
|
83
|
+
readonly kind: "text";
|
|
84
|
+
readonly text: string;
|
|
85
|
+
} | {
|
|
86
|
+
readonly kind: "skill";
|
|
87
|
+
readonly key: string;
|
|
88
|
+
readonly skill: Skill;
|
|
89
|
+
readonly raw: string;
|
|
90
|
+
};
|
|
91
|
+
/** 没有命中任何技能时返回 null,调用方原样渲染整段文字。 */
|
|
92
|
+
export declare function splitTextBySkillTokens<Skill extends {
|
|
93
|
+
readonly name: string;
|
|
94
|
+
readonly scope?: string | undefined;
|
|
95
|
+
}>(text: string, index: ReadonlyMap<string, Skill>): ReadonlyArray<SkillTextPart<Skill>> | null;
|
|
96
|
+
/**
|
|
97
|
+
* 「用户在这条消息里点名了这些技能」指示行:既没有原生入口、也没人展开的技能,靠它让模型知道要起。
|
|
98
|
+
* 属于 provider 协议内容,不进 i18n。宿主给各家都加;名片声明 `handlesSkillInvocations` 的执行器
|
|
99
|
+
* 自己处理技能调用,宿主不加,由执行器只给它没处理的那些技能加。
|
|
100
|
+
*/
|
|
101
|
+
export declare function skillInvocationNotice(names: ReadonlyArray<string>): string;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 技能 token 的写法:`$name` 或 `/name`。输入区菜单与芯片、时间线芯片、宿主的手动调用展开与
|
|
3
|
+
* Claude 的斜杠派发都按这里切,一个 token 在每个入口判成同一个技能。
|
|
4
|
+
*/
|
|
5
|
+
/** 技能 token 的名字(`$` 或 `/` 之后那段)。 */
|
|
6
|
+
export const SKILL_TOKEN_NAME_PATTERN = "[a-zA-Z][a-zA-Z0-9:_-]*";
|
|
7
|
+
/** 输入区的基础 token 边界;触发检测与 `/name` 改写默认都用它,编辑器可在此之上扩展。 */
|
|
8
|
+
export function isComposerWhitespace(char) {
|
|
9
|
+
return char === " " || char === "\n" || char === "\t" || char === "\r";
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 用户能不能起这个技能:provider 设置里关掉的不会执行,provider 留给 agent 的(Claude 的
|
|
13
|
+
* `user-invocable: false`)拒绝用户调用。其余照常可选,包括 agent 不能自己起的技能:服务端会把
|
|
14
|
+
* 选择改写成 provider 自己的调用形式。输入区菜单、手打改写与发送侧指示行都按它判。
|
|
15
|
+
*/
|
|
16
|
+
export function isProviderSkillUserInvocable(skill) {
|
|
17
|
+
return skill.enabled && skill.userInvocable !== false;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Ycodium 会话技能的命名空间:会话技能目录当插件加载时的插件名(CLI 报上来的名字带 `ycodium:` 前缀),
|
|
21
|
+
* 也是菜单里这些技能的 scope。只有它们认 `ycodium:` 前缀写法。
|
|
22
|
+
*/
|
|
23
|
+
export const SESSION_SKILL_NAMESPACE = "ycodium";
|
|
24
|
+
const SESSION_SKILL_PREFIX = `${SESSION_SKILL_NAMESPACE}:`;
|
|
25
|
+
// 不用后行断言:mobile 的 Hermes 也要跑这份。
|
|
26
|
+
const SKILL_TOKEN_REGEX = new RegExp(String.raw `(^|\s)([$/])(${SKILL_TOKEN_NAME_PATTERN})(?=\s|$)`, "g");
|
|
27
|
+
/**
|
|
28
|
+
* 行首或空白之后、到空白或结尾为止的整个 `$name` / `/name`。先读完整个 token 再比对名字,
|
|
29
|
+
* `$reviewExtra`、`/review/notes`、`src/review` 都不会按前缀命中。
|
|
30
|
+
*/
|
|
31
|
+
export function findSkillTokens(text) {
|
|
32
|
+
return [...text.matchAll(SKILL_TOKEN_REGEX)].map((match) => {
|
|
33
|
+
const start = (match.index ?? 0) + (match[1]?.length ?? 0);
|
|
34
|
+
const name = match[3] ?? "";
|
|
35
|
+
return { sigil: match[2], name, start, end: start + name.length + 1 };
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
const SKILL_TOKEN_AT = new RegExp(String.raw `([$/])(${SKILL_TOKEN_NAME_PATTERN})(?=\s|$)`, "y");
|
|
39
|
+
/** 正好从 `index` 开始的技能 token(规则同 {@link findSkillTokens});不是就 undefined。 */
|
|
40
|
+
export function skillTokenAt(text, index) {
|
|
41
|
+
if (index > 0 && !/\s/.test(text.charAt(index - 1)))
|
|
42
|
+
return undefined;
|
|
43
|
+
SKILL_TOKEN_AT.lastIndex = index;
|
|
44
|
+
const match = SKILL_TOKEN_AT.exec(text);
|
|
45
|
+
if (match === null)
|
|
46
|
+
return undefined;
|
|
47
|
+
const name = match[2] ?? "";
|
|
48
|
+
return { sigil: match[1], name, start: index, end: index + name.length + 1 };
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* `name` 是不是 `known` 里的技能:原样命中,或去掉 `ycodium:` 前缀后命中(菜单按目录名列会话技能,
|
|
52
|
+
* CLI 报的是带前缀的写法)。是就返回 `known` 里的那个名字。区分大小写,与 CLI 一致。
|
|
53
|
+
*/
|
|
54
|
+
export function resolveSkillName(name, known) {
|
|
55
|
+
if (known.has(name))
|
|
56
|
+
return name;
|
|
57
|
+
if (!name.startsWith(SESSION_SKILL_PREFIX))
|
|
58
|
+
return undefined;
|
|
59
|
+
const bare = name.slice(SESSION_SKILL_PREFIX.length);
|
|
60
|
+
return known.has(bare) ? bare : undefined;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* token 里的名字对应索引里的哪个技能:原样命中;或带 `ycodium:` 前缀、去掉后命中一个会话技能
|
|
64
|
+
* (scope 为 {@link SESSION_SKILL_NAMESPACE})。普通 provider 技能只按完整名字认:用户自己的 `review`
|
|
65
|
+
* 不认 `/ycodium:review`,跟服务端指示行、Claude 派发按完整名字匹配一致。
|
|
66
|
+
*/
|
|
67
|
+
export function lookupSkill(name, index) {
|
|
68
|
+
const exact = index.get(name);
|
|
69
|
+
if (exact !== undefined)
|
|
70
|
+
return exact;
|
|
71
|
+
if (!name.startsWith(SESSION_SKILL_PREFIX))
|
|
72
|
+
return undefined;
|
|
73
|
+
const session = index.get(name.slice(SESSION_SKILL_PREFIX.length));
|
|
74
|
+
return session?.scope === SESSION_SKILL_NAMESPACE ? session : undefined;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* 用户刚在手打的 `/name` 后面敲了一个空白、且 `name` 是索引里的技能(按 {@link lookupSkill} 认):返回把它改写成 `$name` 的
|
|
78
|
+
* 替换(范围含那个空白,替换后光标落在它后面),与从菜单选中同一个结果。只认「这次编辑恰好插入了
|
|
79
|
+
* 一个空白,并由它结束了 token」:粘贴进来的、本来就已结束的 `/name` 保持原样。插入点从前后文字的
|
|
80
|
+
* 差异里取,不要光标:连着的空白里取最左那处,正好紧跟 token。`isBoundary` 与触发检测的
|
|
81
|
+
* `isWhitespaceChar` 是同一条规则(web 的终端上下文占位符也算 token 边界);敲下的那个字符
|
|
82
|
+
* 本身必须是真空白。
|
|
83
|
+
*/
|
|
84
|
+
export function typedSlashSkillCompletion(previous, next, index, isBoundary = isComposerWhitespace) {
|
|
85
|
+
if (next.length !== previous.length + 1)
|
|
86
|
+
return null;
|
|
87
|
+
let inserted = 0;
|
|
88
|
+
while (inserted < previous.length && previous[inserted] === next[inserted])
|
|
89
|
+
inserted += 1;
|
|
90
|
+
const typed = next.charAt(inserted);
|
|
91
|
+
if (!isComposerWhitespace(typed) ||
|
|
92
|
+
(inserted < previous.length && isBoundary(previous.charAt(inserted))) ||
|
|
93
|
+
next.slice(inserted + 1) !== previous.slice(inserted)) {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
let start = inserted;
|
|
97
|
+
while (start > 0 && !isBoundary(next.charAt(start - 1)))
|
|
98
|
+
start -= 1;
|
|
99
|
+
const match = SLASH_SKILL_TOKEN.exec(next.slice(start, inserted));
|
|
100
|
+
const name = match?.[1];
|
|
101
|
+
if (name === undefined || lookupSkill(name, index) === undefined)
|
|
102
|
+
return null;
|
|
103
|
+
return { start, end: inserted + 1, replacement: `$${name}${typed}` };
|
|
104
|
+
}
|
|
105
|
+
const SLASH_SKILL_TOKEN = new RegExp(String.raw `^/(${SKILL_TOKEN_NAME_PATTERN})$`);
|
|
106
|
+
/** 技能按名字建的索引;一份清单建一次,同一条消息 / 文档里的各段文字共用。 */
|
|
107
|
+
export function skillIndex(skills) {
|
|
108
|
+
return new Map(skills.map((skill) => [skill.name, skill]));
|
|
109
|
+
}
|
|
110
|
+
/** 正文里命中索引的技能 token,带上命中的那个技能;不认识的名字(`$HOME`、`/usr`)跳过。 */
|
|
111
|
+
export function matchSkillTokens(text, index) {
|
|
112
|
+
if (index.size === 0)
|
|
113
|
+
return [];
|
|
114
|
+
return findSkillTokens(text).flatMap((token) => {
|
|
115
|
+
const skill = lookupSkill(token.name, index);
|
|
116
|
+
return skill === undefined ? [] : [{ ...token, skill }];
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
/** 没有命中任何技能时返回 null,调用方原样渲染整段文字。 */
|
|
120
|
+
export function splitTextBySkillTokens(text, index) {
|
|
121
|
+
const parts = [];
|
|
122
|
+
let cursor = 0;
|
|
123
|
+
for (const token of matchSkillTokens(text, index)) {
|
|
124
|
+
if (token.start > cursor)
|
|
125
|
+
parts.push({ kind: "text", text: text.slice(cursor, token.start) });
|
|
126
|
+
parts.push({
|
|
127
|
+
kind: "skill",
|
|
128
|
+
key: `${token.start}:${token.name}`,
|
|
129
|
+
skill: token.skill,
|
|
130
|
+
raw: text.slice(token.start, token.end),
|
|
131
|
+
});
|
|
132
|
+
cursor = token.end;
|
|
133
|
+
}
|
|
134
|
+
if (cursor === 0)
|
|
135
|
+
return null;
|
|
136
|
+
if (cursor < text.length)
|
|
137
|
+
parts.push({ kind: "text", text: text.slice(cursor) });
|
|
138
|
+
return parts;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* 「用户在这条消息里点名了这些技能」指示行:既没有原生入口、也没人展开的技能,靠它让模型知道要起。
|
|
142
|
+
* 属于 provider 协议内容,不进 i18n。宿主给各家都加;名片声明 `handlesSkillInvocations` 的执行器
|
|
143
|
+
* 自己处理技能调用,宿主不加,由执行器只给它没处理的那些技能加。
|
|
144
|
+
*/
|
|
145
|
+
export function skillInvocationNotice(names) {
|
|
146
|
+
return (`The user invoked these skills in this message; run them as requested: ` +
|
|
147
|
+
`${names.map((name) => `$${name}`).join(", ")}.`);
|
|
148
|
+
}
|