@ycodium-ai/plugin-api 0.2.5634 → 0.2.5763
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 +57 -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 +4 -9
- 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 +2 -0
- package/dist/conversationRows.d.ts.map +1 -1
- package/dist/conversationRows.js.map +1 -1
- package/dist/conversationSessionMessage.d.ts.map +1 -1
- package/dist/conversationSessionMessage.js.map +1 -1
- package/dist/conversationSkills.d.ts.map +1 -1
- package/dist/conversationSkills.js.map +1 -1
- package/dist/conversationTrajectory.d.ts.map +1 -1
- package/dist/conversationTrajectory.js.map +1 -1
- package/dist/conversationTranscript.d.ts.map +1 -1
- package/dist/conversationTranscript.js.map +1 -1
- package/dist/conversationTurnSummaries.d.ts.map +1 -1
- package/dist/conversationTurnSummaries.js.map +1 -1
- package/dist/conversationViewProps.d.ts.map +1 -1
- package/dist/conversationViewProps.js.map +1 -1
- package/dist/conversationWorkEntry.d.ts.map +1 -1
- package/dist/conversationWorkEntry.js.map +1 -1
- package/dist/credential-account.d.ts +4 -0
- package/dist/credential-account.d.ts.map +1 -0
- package/dist/credential-account.js +4 -0
- package/dist/credential-account.js.map +1 -0
- package/dist/dataPorts.gen.d.ts +306 -0
- package/dist/dataPorts.gen.d.ts.map +1 -1
- package/dist/dataPorts.gen.js.map +1 -1
- package/dist/decision-card.d.ts.map +1 -1
- package/dist/decision-card.js.map +1 -1
- package/dist/decisions.d.ts.map +1 -1
- package/dist/decisions.js.map +1 -1
- package/dist/definition.d.ts.map +1 -1
- package/dist/definition.js.map +1 -1
- package/dist/derivedState.d.ts.map +1 -1
- package/dist/derivedState.js.map +1 -1
- package/dist/diagnosticData.d.ts.map +1 -1
- package/dist/diagnosticData.js.map +1 -1
- package/dist/diff-rendering.d.ts +2 -0
- package/dist/diff-rendering.d.ts.map +1 -0
- package/dist/diff-rendering.js +2 -0
- package/dist/diff-rendering.js.map +1 -0
- package/dist/display-format.d.ts +5 -0
- package/dist/display-format.d.ts.map +1 -0
- package/dist/display-format.js +5 -0
- package/dist/display-format.js.map +1 -0
- package/dist/entity-names.d.ts.map +1 -1
- package/dist/entity-names.js.map +1 -1
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js.map +1 -1
- package/dist/executor-mode.d.ts +2 -0
- package/dist/executor-mode.d.ts.map +1 -0
- package/dist/executor-mode.js +2 -0
- package/dist/executor-mode.js.map +1 -0
- package/dist/executor.d.ts +17 -1
- package/dist/executor.d.ts.map +1 -1
- package/dist/executor.js.map +1 -1
- package/dist/executorCapabilities.d.ts.map +1 -1
- package/dist/executorCapabilities.js.map +1 -1
- package/dist/executorCard.d.ts +6 -0
- package/dist/executorCard.d.ts.map +1 -1
- package/dist/executorCard.js.map +1 -1
- package/dist/executorCommandArgv.d.ts.map +1 -1
- package/dist/executorCommandArgv.js.map +1 -1
- package/dist/executorEffective.d.ts.map +1 -1
- package/dist/executorEffective.js.map +1 -1
- package/dist/executorErrors.d.ts.map +1 -1
- package/dist/executorErrors.js.map +1 -1
- package/dist/executorEvents.d.ts.map +1 -1
- package/dist/executorEvents.js.map +1 -1
- package/dist/executorModelOptions.d.ts.map +1 -1
- package/dist/executorModelOptions.js.map +1 -1
- package/dist/executorProcesses.d.ts.map +1 -1
- package/dist/executorProcesses.js.map +1 -1
- package/dist/executorSession.d.ts +8 -2
- package/dist/executorSession.d.ts.map +1 -1
- package/dist/executorSession.js.map +1 -1
- package/dist/executorSpawn.d.ts +5 -4
- package/dist/executorSpawn.d.ts.map +1 -1
- package/dist/executorSpawn.js +20 -7
- package/dist/executorSpawn.js.map +1 -1
- package/dist/fetch-ports.d.ts +2 -0
- package/dist/fetch-ports.d.ts.map +1 -0
- package/dist/fetch-ports.js +2 -0
- package/dist/fetch-ports.js.map +1 -0
- package/dist/file-preview.d.ts.map +1 -1
- package/dist/file-preview.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/inline-tag.d.ts.map +1 -1
- package/dist/inline-tag.js.map +1 -1
- package/dist/instance-config.d.ts +7 -0
- package/dist/instance-config.d.ts.map +1 -0
- package/dist/instance-config.js +7 -0
- package/dist/instance-config.js.map +1 -0
- package/dist/interval.d.ts.map +1 -1
- package/dist/interval.js.map +1 -1
- package/dist/jsonl.d.ts +6 -0
- package/dist/jsonl.d.ts.map +1 -0
- package/dist/jsonl.js +6 -0
- package/dist/jsonl.js.map +1 -0
- package/dist/keyedSubscribers.d.ts.map +1 -1
- package/dist/keyedSubscribers.js.map +1 -1
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js.map +1 -1
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js.map +1 -1
- package/dist/model-picker.d.ts.map +1 -1
- package/dist/model-picker.js.map +1 -1
- package/dist/modelCatalogNotice.d.ts.map +1 -1
- package/dist/modelCatalogNotice.js.map +1 -1
- package/dist/modelChoice.d.ts.map +1 -1
- package/dist/modelChoice.js.map +1 -1
- package/dist/modelChoiceOptions.d.ts.map +1 -1
- package/dist/modelChoiceOptions.js.map +1 -1
- package/dist/modelChoiceTraits.d.ts.map +1 -1
- package/dist/modelChoiceTraits.js.map +1 -1
- package/dist/modelDisplayName.d.ts.map +1 -1
- package/dist/modelDisplayName.js.map +1 -1
- package/dist/pending-requests.d.ts.map +1 -1
- package/dist/pending-requests.js.map +1 -1
- package/dist/plugin-tools.d.ts.map +1 -1
- package/dist/plugin-tools.js.map +1 -1
- package/dist/pluginContextCommands.d.ts.map +1 -1
- package/dist/pluginContextCommands.js.map +1 -1
- package/dist/pluginContextProviders.d.ts.map +1 -1
- package/dist/pluginContextProviders.js.map +1 -1
- package/dist/pluginContextThreads.d.ts.map +1 -1
- package/dist/pluginContextThreads.js.map +1 -1
- package/dist/pluginContextWorkspace.d.ts.map +1 -1
- package/dist/pluginContextWorkspace.js.map +1 -1
- package/dist/process-operation.d.ts.map +1 -1
- package/dist/process-operation.js.map +1 -1
- package/dist/process-socket.d.ts.map +1 -1
- package/dist/process-socket.js.map +1 -1
- package/dist/process-stdin.d.ts.map +1 -1
- package/dist/process-stdin.js.map +1 -1
- package/dist/projects.d.ts.map +1 -1
- package/dist/projects.js.map +1 -1
- package/dist/provider-settings.d.ts.map +1 -1
- package/dist/provider-settings.js.map +1 -1
- package/dist/providerInstanceSelection.d.ts.map +1 -1
- package/dist/providerInstanceSelection.js.map +1 -1
- package/dist/reasoningLevelFallback.d.ts.map +1 -1
- package/dist/reasoningLevelFallback.js.map +1 -1
- package/dist/runtime-maintenance.d.ts.map +1 -1
- package/dist/runtime-maintenance.js.map +1 -1
- package/dist/runtimes.d.ts.map +1 -1
- package/dist/runtimes.js.map +1 -1
- package/dist/selectAllCopy.d.ts.map +1 -1
- package/dist/selectAllCopy.js.map +1 -1
- package/dist/session-history.d.ts +6 -0
- package/dist/session-history.d.ts.map +1 -0
- package/dist/session-history.js +6 -0
- package/dist/session-history.js.map +1 -0
- package/dist/settings-actions.d.ts.map +1 -1
- package/dist/settings-actions.js.map +1 -1
- package/dist/settings-card-shape.d.ts.map +1 -1
- package/dist/settings-card-shape.js.map +1 -1
- package/dist/settings-card.d.ts.map +1 -1
- package/dist/settings-card.js.map +1 -1
- package/dist/settings-ui.d.ts.map +1 -1
- package/dist/settings-ui.js.map +1 -1
- package/dist/sign-in.d.ts.map +1 -1
- package/dist/sign-in.js.map +1 -1
- package/dist/slashCommands.d.ts.map +1 -1
- package/dist/slashCommands.js.map +1 -1
- package/dist/slots.d.ts.map +1 -1
- package/dist/slots.js.map +1 -1
- package/dist/source/_private/ycodium-attachment-kinds/chatAttachmentKinds.ts +105 -0
- package/dist/source/_private/ycodium-attachment-kinds/mediaKinds.ts +83 -0
- package/dist/source/_private/ycodium-composer-tokens/approvalFileChanges.ts +58 -0
- package/dist/source/_private/ycodium-composer-tokens/composerFileLink.ts +23 -0
- package/dist/source/_private/ycodium-composer-tokens/composerInlineTokens.ts +130 -0
- package/dist/source/_private/ycodium-composer-tokens/composerLogic.ts +251 -0
- package/dist/source/_private/ycodium-composer-tokens/composerMentionDrag.ts +98 -0
- package/dist/source/_private/ycodium-composer-tokens/composerPromptSegments.ts +222 -0
- package/dist/source/_private/ycodium-composer-tokens/composerTrigger.ts +64 -0
- package/dist/source/_private/ycodium-composer-tokens/contextWindowFormat.ts +16 -0
- package/dist/source/_private/ycodium-composer-tokens/diffCount.ts +14 -0
- package/dist/source/_private/ycodium-composer-tokens/pendingUserInput.ts +256 -0
- package/dist/source/_private/ycodium-composer-tokens/promptContextBlocks.ts +179 -0
- package/dist/source/_private/ycodium-composer-tokens/proposedPlan.ts +134 -0
- package/dist/source/_private/ycodium-composer-tokens/providerSkillSearch.ts +105 -0
- package/dist/source/_private/ycodium-composer-tokens/providerSkills.ts +86 -0
- package/dist/source/_private/ycodium-composer-tokens/queueEntry.ts +49 -0
- package/dist/source/_private/ycodium-composer-tokens/reviewCommentBlocks.ts +177 -0
- package/dist/source/_private/ycodium-composer-tokens/searchRanking.ts +192 -0
- package/dist/source/_private/ycodium-composer-tokens/skillTokens.ts +192 -0
- package/dist/source/_private/ycodium-composer-tokens/slashMenu.ts +293 -0
- package/dist/source/_private/ycodium-composer-tokens/userInputOptionText.ts +51 -0
- package/dist/source/_private/ycodium-credential-account/credentialAccount.ts +83 -0
- package/dist/source/_private/ycodium-credential-account/quotaJson.ts +25 -0
- package/dist/source/_private/ycodium-credential-account/quotaRequest.ts +79 -0
- package/dist/source/_private/ycodium-day-format/dayFormat.ts +57 -0
- package/dist/source/_private/ycodium-day-format/timestampFormat.ts +165 -0
- package/dist/source/_private/ycodium-decision-order/decisionOrder.ts +54 -0
- package/dist/source/_private/ycodium-diff-format/diffRendering.ts +229 -0
- package/dist/source/_private/ycodium-duration-format/durationFormat.ts +60 -0
- package/dist/source/_private/ycodium-executor-common/catalogModel.ts +40 -0
- package/dist/source/_private/ycodium-executor-common/eventTypes.ts +97 -0
- package/dist/source/_private/ycodium-executor-common/modelSelection.ts +24 -0
- package/dist/source/_private/ycodium-executor-common/nodeStreams.ts +212 -0
- package/dist/source/_private/ycodium-executor-common/raceAbort.ts +25 -0
- package/dist/source/_private/ycodium-executor-common/reasoningLevelFallback.ts +28 -0
- package/dist/source/_private/ycodium-executor-common/stderrTail.ts +27 -0
- package/dist/source/_private/ycodium-executor-common/toolPresentation.ts +268 -0
- package/dist/source/_private/ycodium-fetch-ports/fetchPorts.ts +84 -0
- package/dist/source/_private/ycodium-fetch-ports/netFault.ts +30 -0
- package/dist/source/_private/ycodium-full-access-mode/fullAccessNativeMode.ts +32 -0
- package/dist/source/_private/ycodium-instance-config/homePath.ts +140 -0
- package/dist/source/_private/ycodium-instance-config/instanceConfig.ts +149 -0
- package/dist/source/_private/ycodium-instance-config/launchArgs.ts +60 -0
- package/dist/source/_private/ycodium-instance-config/probeProcess.ts +89 -0
- package/dist/source/_private/ycodium-instance-config/programHomeSchema.ts +74 -0
- package/dist/source/_private/ycodium-instance-config/tomlScalar.ts +10 -0
- package/dist/source/_private/ycodium-jsonl-stream/appendedJsonl.ts +222 -0
- package/dist/source/_private/ycodium-jsonl-stream/claudeSessions.ts +263 -0
- package/dist/source/_private/ycodium-jsonl-stream/codexSessions.ts +254 -0
- package/dist/source/_private/ycodium-jsonl-stream/history.ts +492 -0
- package/dist/source/_private/ycodium-jsonl-stream/historyErrors.ts +6 -0
- package/dist/source/_private/ycodium-jsonl-stream/historyFile.ts +139 -0
- package/dist/source/_private/ycodium-jsonl-stream/historyRecord.ts +180 -0
- package/dist/source/_private/ycodium-jsonl-stream/historyWaiting.ts +140 -0
- package/dist/source/_private/ycodium-jsonl-stream/jsonObjectLine.ts +15 -0
- package/dist/source/_private/ycodium-jsonl-stream/jsonlStream.ts +650 -0
- package/dist/source/_private/ycodium-jsonl-stream/scanCache.ts +163 -0
- package/dist/source/_private/ycodium-jsonl-stream/sessionDirectory.ts +39 -0
- package/dist/source/_private/ycodium-jsonl-stream/sessionTranscript.ts +136 -0
- package/dist/source/_private/ycodium-jsonl-stream/usageFields.ts +13 -0
- package/dist/source/_private/ycodium-markdown-fence/markdownFence.ts +28 -0
- package/dist/source/_private/ycodium-source-control/pullRequestScope.ts +35 -0
- package/dist/source/_private/ycodium-sse-stream/sseStream.ts +118 -0
- package/dist/source/_private/ycodium-system-text/memberInstructions.ts +24 -0
- package/dist/source/_private/ycodium-system-text/systemText.ts +356 -0
- package/dist/source/_private/ycodium-system-text/threadPreset.ts +35 -0
- package/dist/source/_private/ycodium-text-generation/branchName.ts +29 -0
- package/dist/source/_private/ycodium-text-generation/prompts.ts +342 -0
- package/dist/source/_private/ycodium-text-generation/sanitize.ts +125 -0
- package/dist/source/_private/ycodium-text-generation/structuredTextGeneration.ts +237 -0
- package/dist/source/_private/ycodium-tool-label/toolLabel.ts +287 -0
- package/dist/source/_private/ycodium-ui-hooks/DiffStatCounts.tsx +76 -0
- package/dist/source/_private/ycodium-ui-hooks/ProviderSignInChallenge.tsx +115 -0
- package/dist/source/_private/ycodium-ui-hooks/RenderErrorBoundary.tsx +34 -0
- package/dist/source/_private/ycodium-ui-hooks/RuntimeMaintenanceActions.tsx +63 -0
- package/dist/source/_private/ycodium-ui-hooks/SkillInlineText.tsx +28 -0
- package/dist/source/_private/ycodium-ui-hooks/bundleStyle.ts +52 -0
- package/dist/source/_private/ycodium-ui-hooks/catalogKeys.ts +11 -0
- package/dist/source/_private/ycodium-ui-hooks/clipboard.ts +176 -0
- package/dist/source/_private/ycodium-ui-hooks/hostControls.ts +43 -0
- package/dist/source/_private/ycodium-ui-hooks/inlineChips.tsx +114 -0
- package/dist/source/_private/ycodium-ui-hooks/notifyMessages.ts +36 -0
- package/dist/source/_private/ycodium-ui-hooks/presenterInputState.ts +341 -0
- package/dist/source/_private/ycodium-ui-hooks/processRowHeader.ts +7 -0
- package/dist/source/_private/ycodium-ui-hooks/timelineDisclosure.ts +98 -0
- package/dist/source/_private/ycodium-ui-hooks/useMediaQuery.ts +87 -0
- package/dist/source/_private/ycodium-ui-hooks/workEntryIcons.ts +99 -0
- package/dist/source/_private/ycodium-workspace-path/directoryScope.ts +34 -0
- package/dist/source/_private/ycodium-workspace-path/workspacePath.ts +110 -0
- package/dist/source/cache.ts +55 -0
- package/dist/source/capabilityPorts.ts +272 -0
- package/dist/source/cli.ts +69 -0
- package/dist/source/commands.ts +208 -0
- package/dist/source/communication-view.ts +107 -0
- package/dist/source/communication.ts +26 -0
- package/dist/source/composer-control.ts +16 -0
- package/dist/source/composer.ts +108 -0
- package/dist/source/conversation-queue.ts +165 -0
- package/dist/source/conversation-view.ts +49 -0
- package/dist/source/conversation.ts +695 -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 +134 -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 +31 -0
- package/dist/source/workspace-path.ts +2 -0
- package/dist/source-control.d.ts +3 -0
- package/dist/source-control.d.ts.map +1 -0
- package/dist/source-control.js +3 -0
- package/dist/source-control.js.map +1 -0
- package/dist/sse.d.ts +2 -0
- package/dist/sse.d.ts.map +1 -0
- package/dist/sse.js +2 -0
- package/dist/sse.js.map +1 -0
- package/dist/system-text.d.ts +4 -0
- package/dist/system-text.d.ts.map +1 -0
- package/dist/system-text.js +4 -0
- package/dist/system-text.js.map +1 -0
- package/dist/teamView.d.ts.map +1 -1
- package/dist/teamView.js.map +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js.map +1 -1
- package/dist/text-generation.d.ts +3 -0
- package/dist/text-generation.d.ts.map +1 -0
- package/dist/text-generation.js +3 -0
- package/dist/text-generation.js.map +1 -0
- package/dist/threadAnnotation.d.ts.map +1 -1
- package/dist/threadAnnotation.js.map +1 -1
- package/dist/threads.d.ts.map +1 -1
- package/dist/threads.js.map +1 -1
- package/dist/timeline-process.d.ts +32 -0
- package/dist/timeline-process.d.ts.map +1 -1
- package/dist/timeline-process.js.map +1 -1
- package/dist/timeline-row-error.d.ts.map +1 -1
- package/dist/timeline-row-error.js.map +1 -1
- package/dist/tool-display.d.ts.map +1 -1
- package/dist/tool-display.js.map +1 -1
- package/dist/traits-picker.d.ts.map +1 -1
- package/dist/traits-picker.js.map +1 -1
- package/dist/ui-bridge-version.d.ts.map +1 -1
- package/dist/ui-bridge-version.js.map +1 -1
- package/dist/ui-hooks.d.ts +14 -0
- package/dist/ui-hooks.d.ts.map +1 -0
- package/dist/ui-hooks.js +14 -0
- package/dist/ui-hooks.js.map +1 -0
- package/dist/ui-i18n.d.ts +2 -0
- package/dist/ui-i18n.d.ts.map +1 -0
- package/dist/ui-i18n.js +2 -0
- package/dist/ui-i18n.js.map +1 -0
- package/dist/ui-media-query.d.ts +2 -0
- package/dist/ui-media-query.d.ts.map +1 -0
- package/dist/ui-media-query.js +2 -0
- package/dist/ui-media-query.js.map +1 -0
- package/dist/ui-presenter-state.d.ts +2 -0
- package/dist/ui-presenter-state.d.ts.map +1 -0
- package/dist/ui-presenter-state.js +2 -0
- package/dist/ui-presenter-state.js.map +1 -0
- package/dist/ui.d.ts +2 -2
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js.map +1 -1
- package/dist/uiHostCapabilities.d.ts.map +1 -1
- package/dist/uiHostCapabilities.js.map +1 -1
- package/dist/uiMachineAdmission.d.ts.map +1 -1
- package/dist/uiMachineAdmission.js.map +1 -1
- package/dist/uiSessionProjections.d.ts.map +1 -1
- package/dist/uiSessionProjections.js.map +1 -1
- package/dist/usage.d.ts.map +1 -1
- package/dist/usage.js.map +1 -1
- package/dist/version.d.ts +2 -2
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/workspace-path.d.ts +3 -0
- package/dist/workspace-path.d.ts.map +1 -0
- package/dist/workspace-path.js +3 -0
- package/dist/workspace-path.js.map +1 -0
- package/package.json +114 -3
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 系统消息的信封与文字规则。系统消息是 user 角色消息,文字包在 `<ycodium-system>…</ycodium-system>` 里,
|
|
3
|
+
* 里面一个内层块;块里夹着的外部文字(agent、插件、用户写的话)只是文字,不能添出标签或属性。
|
|
4
|
+
* contracts(各写手与读法)、web、mobile、server 与会话插件共用这一份,插件由 esbuild 打进自己的 bundle,
|
|
5
|
+
* 不在插件里留镜像。
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** 系统消息的包裹标记;客户端据此把这条 user 消息渲染成系统条而不是用户气泡。 */
|
|
9
|
+
export const SYSTEM_NOTIFICATION_OPEN_TAG = "<ycodium-system>";
|
|
10
|
+
export const SYSTEM_NOTIFICATION_CLOSE_TAG = "</ycodium-system>";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 这条 user 消息带不带系统信封:只看开头,消息的头几个字符就够判断。这是数据事实,
|
|
14
|
+
* 写手照它判断信封;取用户正文用 `userSpokenText`,界面上怎么显示另见 `rendersAsSystemMessage`。
|
|
15
|
+
*/
|
|
16
|
+
export const isSystemNotificationText = (text: string): boolean =>
|
|
17
|
+
text.startsWith(SYSTEM_NOTIFICATION_OPEN_TAG);
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 界面上把这条 user 消息显示成系统条与卡片(而不是用户气泡)吗。带系统信封的都是,一个例外:贴了 preset 前缀、
|
|
21
|
+
* 前缀与用户的话却拆不开的那种(前缀作者自己写出了块的闭标签),整条照普通用户消息显示——用户自己打的字不能
|
|
22
|
+
* 因为前缀写坏了就从时间线上消失,多露出一段前缀原文可以接受。它照样不会被认成任何卡片,也过不了照通知办事
|
|
23
|
+
* 的读法(那要整条消息恰好是通知块)。只给显示用;判断信封用 `isSystemNotificationText`,取用户正文用 `userSpokenText`。
|
|
24
|
+
*
|
|
25
|
+
* 例外只在文字里真有前缀的闭合序列时成立:侧栏预览这类路径只拿到截断的头,头里没有闭合序列,拆不开是因为
|
|
26
|
+
* 截断而不是前缀写坏了,照信封算。
|
|
27
|
+
*/
|
|
28
|
+
export const rendersAsSystemMessage = (text: string): boolean =>
|
|
29
|
+
isSystemNotificationText(text) &&
|
|
30
|
+
!(
|
|
31
|
+
isPresetPrefixMessage(text) &&
|
|
32
|
+
text.includes(PRESET_PREFIX_CLOSE) &&
|
|
33
|
+
parsePresetPrefixText(text) === null
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 渲染用的读法只认消息的第一个块:前面可以有信封的开标签,不能有别的。preset 前缀不转义,它里面写的块在消息
|
|
38
|
+
* 中间,不会被认成卡片。这是正则源码片段,各块的读法接在它后面。界面先问 `rendersAsSystemMessage` 再分支,
|
|
39
|
+
* 走不到把整条预设消息喂给卡片读法这一步;这里给直接调读法的地方兜底。
|
|
40
|
+
*/
|
|
41
|
+
export const FIRST_BLOCK_START = `^(?:${SYSTEM_NOTIFICATION_OPEN_TAG}\\n)?`;
|
|
42
|
+
|
|
43
|
+
const SYSTEM_NOTIFICATION_BLOCK_PATTERN = /<ycodium-system>[\s\S]*?<\/ycodium-system>/g;
|
|
44
|
+
|
|
45
|
+
/** 文字里的全部完整系统块,没有就是空;要求「整条消息就是这些块」的读法自己再核对。 */
|
|
46
|
+
export const matchSystemNotificationBlocks = (text: string): ReadonlyArray<string> =>
|
|
47
|
+
text.match(SYSTEM_NOTIFICATION_BLOCK_PATTERN) ?? [];
|
|
48
|
+
|
|
49
|
+
/** 转录轮廓必须至少读到这段开头,才能把预设消息留作候选。 */
|
|
50
|
+
export const PRESET_PREFIX_MESSAGE_START = `${SYSTEM_NOTIFICATION_OPEN_TAG}\n<preset-prefix `;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* 首条用户消息前面贴了 preset 前缀的那种消息(`prependPresetPrefixText`)。前缀不转义,里面可以写着任何块,
|
|
54
|
+
* 所以这种消息整条看待:不拆块,前缀与用户的话只由 `parsePresetPrefixText` 分开。
|
|
55
|
+
*/
|
|
56
|
+
export const isPresetPrefixMessage = (text: string): boolean =>
|
|
57
|
+
text.startsWith(PRESET_PREFIX_MESSAGE_START);
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* 系统消息可以拼接多个完整块,必须分别渲染以保留每段正文。贴了 preset 前缀的消息不拆,整条是一块:前缀里写的
|
|
61
|
+
* 块只是前缀的一部分,拆开了会被当成别的卡片。界面路径到不了这一支(拆得开的走预设分支,拆不开的不算系统
|
|
62
|
+
* 消息),留给直接拆块的调用方兜底。
|
|
63
|
+
*/
|
|
64
|
+
export const splitSystemNotificationBlocks = (text: string): ReadonlyArray<string> => {
|
|
65
|
+
if (isPresetPrefixMessage(text)) return [text];
|
|
66
|
+
const blocks = matchSystemNotificationBlocks(text);
|
|
67
|
+
return blocks.length > 0 ? blocks : [text];
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* 外部文字一律转义后才放进块里。正文只转 `&` 与 `<`:没有 `<` 就起不了标签,`>`、引号留着原样,agent 读到的
|
|
72
|
+
* `->`、`=>`、引用块不会变成满篇实体。属性值再转 `>`、`"` 与换行(开标签因此总在一行上,属性也添不出来)。
|
|
73
|
+
*
|
|
74
|
+
* 开标签末尾的 `esc="1"` 标明这一块转义过;没有它的是改之前落盘的旧正文,原样读——旧正文里字面的
|
|
75
|
+
* `<` 不能被还原成 `<`。这个标记只是文字,不是凭证:照系统消息办事的读法要自己核对整条消息的结构,
|
|
76
|
+
* 不能在消息里搜到一个带标记的块就信它。
|
|
77
|
+
*/
|
|
78
|
+
export const SYSTEM_TEXT_ESCAPED_ATTRIBUTE = 'esc="1"';
|
|
79
|
+
|
|
80
|
+
export const escapeSystemText = (text: string): string =>
|
|
81
|
+
text.replace(/&/g, "&").replace(/</g, "<");
|
|
82
|
+
|
|
83
|
+
/** `escapeSystemText` 让一个码元最多变成几个(`&` → `&`);按转义后长度截前缀的读者据此留余量。 */
|
|
84
|
+
export const SYSTEM_TEXT_MAX_ESCAPE_GROWTH = "&".length;
|
|
85
|
+
|
|
86
|
+
export const escapeSystemAttribute = (text: string): string =>
|
|
87
|
+
escapeSystemText(text)
|
|
88
|
+
.replace(/>/g, ">")
|
|
89
|
+
.replace(/"/g, """)
|
|
90
|
+
.replace(/\r/g, " ")
|
|
91
|
+
.replace(/\n/g, " ");
|
|
92
|
+
|
|
93
|
+
/** 两种转义的逆;`&` 必须最后还原,否则 `&lt;` 会被还原两次。 */
|
|
94
|
+
export const unescapeSystemText = (text: string): string =>
|
|
95
|
+
text
|
|
96
|
+
.replace(/ /g, "\n")
|
|
97
|
+
.replace(/ /g, "\r")
|
|
98
|
+
.replace(/"/g, '"')
|
|
99
|
+
.replace(/</g, "<")
|
|
100
|
+
.replace(/>/g, ">")
|
|
101
|
+
.replace(/&/g, "&");
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* 记录号在通知正文里的写法(投递提货单与回信叫醒用它)。
|
|
105
|
+
*
|
|
106
|
+
* 它是 agent 调 `check_inbox` 对账用的句柄,不是给人读的,所以 `systemNotificationBodyText`
|
|
107
|
+
* 上屏前会把它摘掉——写法与摘法必须一起改,只放这一处。
|
|
108
|
+
*/
|
|
109
|
+
export const systemRecordReference = (recordId: string): string => `(record ${recordId})`;
|
|
110
|
+
|
|
111
|
+
/** `systemRecordReference` 的逆;连前面的空格一起吃掉,免得摘完留下双空格。 */
|
|
112
|
+
const RECORD_REFERENCE_PATTERN = /[ \t]*\(record [^\s()]+\)/g;
|
|
113
|
+
|
|
114
|
+
/** 整行只有一个标签的那种行;正文行一律留下。 */
|
|
115
|
+
const TAG_ONLY_LINE_PATTERN = /^<\/?[a-z][a-z-]*(?:\s[^>]*)?>$/;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* 写出时转义外部文字的那几种块:写手只能用这几个名字开带标记的块(`escapedBlockOpenTag`),上屏的正文也只为
|
|
119
|
+
* 它们还原。加一种转义块就加在这里。
|
|
120
|
+
*/
|
|
121
|
+
const ESCAPED_BLOCK_NAMES = [
|
|
122
|
+
"thread-response",
|
|
123
|
+
"thread-handover",
|
|
124
|
+
"scheduled-wake",
|
|
125
|
+
"plugin-wake",
|
|
126
|
+
] as const;
|
|
127
|
+
type EscapedBlockName = (typeof ESCAPED_BLOCK_NAMES)[number];
|
|
128
|
+
|
|
129
|
+
/** 带转义标记的开标签。属性值在这里统一转义,写手不必各自记得。 */
|
|
130
|
+
export const escapedBlockOpenTag = (
|
|
131
|
+
name: EscapedBlockName,
|
|
132
|
+
attributes: ReadonlyArray<readonly [string, string]>,
|
|
133
|
+
): string =>
|
|
134
|
+
`<${name} ${[
|
|
135
|
+
...attributes.map(([key, value]) => `${key}="${escapeSystemAttribute(value)}"`),
|
|
136
|
+
SYSTEM_TEXT_ESCAPED_ATTRIBUTE,
|
|
137
|
+
].join(" ")}>`;
|
|
138
|
+
|
|
139
|
+
/** 带转义标记的、上面那几种块的开标签行。 */
|
|
140
|
+
const ESCAPED_OPEN_LINE_PATTERN = new RegExp(
|
|
141
|
+
`^<(?:${ESCAPED_BLOCK_NAMES.join("|")})(?:\\s[^>]*)? ${SYSTEM_TEXT_ESCAPED_ATTRIBUTE}>$`,
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
/** 按开标签上有没有转义标记选读法:有就还原,没有(改之前落盘的旧正文)原样读。 */
|
|
145
|
+
export const systemTextReader = (marker: string | undefined): ((value: string) => string) =>
|
|
146
|
+
marker === undefined ? (value) => value : unescapeSystemText;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* 系统通知里给人读的那一段。
|
|
150
|
+
*
|
|
151
|
+
* 信封(`<ycodium-system>` 与内层标签)和记录号都是内部信物:标签给客户端认消息种类,
|
|
152
|
+
* 记录号给 agent 对账。两样都不该出现在用户眼前,所以凡是把这条消息**摆到屏幕上**的
|
|
153
|
+
* 地方(搜索片段、侧栏预览、排队清单)都读这一份,不各自解析字符串。
|
|
154
|
+
*
|
|
155
|
+
* 开标签带转义标记的那几种块(`ESCAPED_BLOCK_NAMES`),正文行上屏前还原;遇到任何闭标签行就恢复原样读,
|
|
156
|
+
* 所以标记只管它那一块。
|
|
157
|
+
* 不显示成系统消息的(`rendersAsSystemMessage`)原样返回。要**原样回传**的地方(编辑一条排队消息)读的是原始
|
|
158
|
+
* text,不是这个——剥过的正文发回去,信封就没了。
|
|
159
|
+
*/
|
|
160
|
+
export const systemNotificationBodyText = (text: string): string => {
|
|
161
|
+
if (!rendersAsSystemMessage(text)) return text;
|
|
162
|
+
let escaped = false;
|
|
163
|
+
const body: Array<string> = [];
|
|
164
|
+
for (const line of text.split("\n")) {
|
|
165
|
+
const trimmed = line.trim();
|
|
166
|
+
if (!TAG_ONLY_LINE_PATTERN.test(trimmed)) {
|
|
167
|
+
body.push(escaped ? unescapeSystemText(line) : line);
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
escaped = !trimmed.startsWith("</") && ESCAPED_OPEN_LINE_PATTERN.test(trimmed);
|
|
171
|
+
}
|
|
172
|
+
return body.join("\n").replace(RECORD_REFERENCE_PATTERN, "");
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export interface PresetPrefixInput {
|
|
176
|
+
readonly presetId: string;
|
|
177
|
+
/** preset 的 `promptPrefix` 原文。 */
|
|
178
|
+
readonly prefix: string;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Thread preset 的固定前缀块。包在 `<ycodium-system>` 里,客户端据此渲染成系统条。
|
|
183
|
+
*
|
|
184
|
+
* 前缀原样写进去,不转义:它的作者是用户自己或他装的插件,本来就能直接给模型下任何指令,转义防不住什么,
|
|
185
|
+
* 只会把他写给模型的原话(常带 `<rules>` 这类结构)改成实体——与插件给模型的系统提示块同一个道理。代价只在
|
|
186
|
+
* 界面:前缀里自己写出块的闭标签时,拆分认不出(`parsePresetPrefixText` 返回 null),整条照普通用户消息显示
|
|
187
|
+
* (`rendersAsSystemMessage`);通知块、交接的读法只认消息的第一个块,前缀里写的块不会被认成别的卡片。
|
|
188
|
+
*/
|
|
189
|
+
export const formatPresetPrefixText = (input: PresetPrefixInput): string =>
|
|
190
|
+
[
|
|
191
|
+
SYSTEM_NOTIFICATION_OPEN_TAG,
|
|
192
|
+
`<preset-prefix id="${input.presetId}">`,
|
|
193
|
+
input.prefix,
|
|
194
|
+
"</preset-prefix>",
|
|
195
|
+
SYSTEM_NOTIFICATION_CLOSE_TAG,
|
|
196
|
+
].join("\n");
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* 把 preset 前缀贴到首条用户消息前面。
|
|
200
|
+
*
|
|
201
|
+
* 约束:正文本身已经是系统块(交接、团队任务、子 thread 通知)时原样返回——
|
|
202
|
+
* 两个块串起来解析不出来,只会把原始标签露给用户。前缀是空白也一样跳过。
|
|
203
|
+
*/
|
|
204
|
+
export const prependPresetPrefixText = (
|
|
205
|
+
input: PresetPrefixInput & { readonly text: string },
|
|
206
|
+
): string =>
|
|
207
|
+
input.prefix.trim().length === 0 || isSystemNotificationText(input.text)
|
|
208
|
+
? input.text
|
|
209
|
+
: `${formatPresetPrefixText(input)}\n\n${input.text}`;
|
|
210
|
+
|
|
211
|
+
export interface ParsedPresetPrefix {
|
|
212
|
+
readonly presetId: string;
|
|
213
|
+
readonly prefix: string;
|
|
214
|
+
/** 前缀块后面用户自己写的那半,可能为空;用户的话,从不还原。 */
|
|
215
|
+
readonly body: string;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const PRESET_PREFIX_CLOSE = `\n</preset-prefix>\n${SYSTEM_NOTIFICATION_CLOSE_TAG}`;
|
|
219
|
+
const PRESET_PREFIX_PATTERN = new RegExp(
|
|
220
|
+
`^${SYSTEM_NOTIFICATION_OPEN_TAG}\\n<preset-prefix id="([^"]*)">\\n([\\s\\S]*?)\\n</preset-prefix>\\n${SYSTEM_NOTIFICATION_CLOSE_TAG}(?:\\n\\n([\\s\\S]*))?$`,
|
|
221
|
+
);
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* 把 `formatPresetPrefixText` 贴在首条用户消息前面的前缀与用户真正写的字分开,调用方才能一半渲染成系统条、
|
|
225
|
+
* 一半渲染成用户气泡。前缀没转义:它里面自己写出块的闭标签(整条消息里那串闭标签不止一处)时分不清哪里是
|
|
226
|
+
* 前缀的结尾,返回 null;被截断、id 为空也返回 null。返回 null 时怎么显示由 `rendersAsSystemMessage` 定。
|
|
227
|
+
*/
|
|
228
|
+
export const parsePresetPrefixText = (text: string): ParsedPresetPrefix | null => {
|
|
229
|
+
if (text.split(PRESET_PREFIX_CLOSE).length !== 2) return null;
|
|
230
|
+
const match = PRESET_PREFIX_PATTERN.exec(text);
|
|
231
|
+
if (match === null) return null;
|
|
232
|
+
const [, presetId, prefix, body] = match;
|
|
233
|
+
if (!presetId) return null;
|
|
234
|
+
return { presetId, prefix: prefix ?? "", body: body ?? "" };
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* 只取 user 消息里用户自己写的字:预设前缀拆得开就取 body,空 body 与其它系统通知返回 null;
|
|
239
|
+
* 拆不开时沿用界面的回退,整条保留。空白由调用方处理,用户的正文不还原转义。
|
|
240
|
+
*/
|
|
241
|
+
export const userSpokenText = (text: string): string | null => {
|
|
242
|
+
if (!rendersAsSystemMessage(text)) return text;
|
|
243
|
+
return parsePresetPrefixText(text)?.body || null;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* 插件起轮叫醒会话时给 agent 的话是哪一类。闭集,界面按它挑一句换语言的摘要;读到不认识的值按 `notice` 显示。
|
|
248
|
+
* `work`:某个工作项要这条会话动手(派活、解阻塞、核收、评论);`check-in`:提醒约下一次巡查;
|
|
249
|
+
* `instructions`:开工说明、试跑说明这类长指令;`notice`:其余通知;`continue`:轮次续跑,一轮结束后插件
|
|
250
|
+
* 看了结果让 agent 接着干,只由宿主写(带第几次、上限几次)。
|
|
251
|
+
*/
|
|
252
|
+
const PLUGIN_WAKE_REASONS = ["work", "check-in", "instructions", "notice", "continue"] as const;
|
|
253
|
+
export type PluginWakeReason = (typeof PLUGIN_WAKE_REASONS)[number];
|
|
254
|
+
|
|
255
|
+
export interface PluginWakeInput {
|
|
256
|
+
readonly pluginId: string;
|
|
257
|
+
readonly reason: PluginWakeReason;
|
|
258
|
+
/** 给人看的工作项短号(如 `W3`);没有就不写。 */
|
|
259
|
+
readonly item?: string | undefined;
|
|
260
|
+
/** 续跑的第几次、上限几次;只有 `continue` 带。 */
|
|
261
|
+
readonly round?: { readonly round: number; readonly limit: number } | undefined;
|
|
262
|
+
/** 给 agent 读的原文。 */
|
|
263
|
+
readonly text: string;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* 插件经 `threads.turns.start` 叫醒会话时用的正文:原文包进系统信封,客户端据此画成系统行、不当成人说的话,
|
|
268
|
+
* 群摘要与置顶也照信封把它排除。原文只转义 `&` 与 `<`,agent 读到的仍是原话。
|
|
269
|
+
*/
|
|
270
|
+
export const formatPluginWakeText = (input: PluginWakeInput): string =>
|
|
271
|
+
[
|
|
272
|
+
SYSTEM_NOTIFICATION_OPEN_TAG,
|
|
273
|
+
escapedBlockOpenTag("plugin-wake", [
|
|
274
|
+
["plugin", input.pluginId],
|
|
275
|
+
["reason", input.reason],
|
|
276
|
+
...(input.item ? [["item", input.item] as const] : []),
|
|
277
|
+
...(input.round
|
|
278
|
+
? ([
|
|
279
|
+
["round", String(input.round.round)],
|
|
280
|
+
["limit", String(input.round.limit)],
|
|
281
|
+
] as const)
|
|
282
|
+
: []),
|
|
283
|
+
]),
|
|
284
|
+
escapeSystemText(input.text),
|
|
285
|
+
"</plugin-wake>",
|
|
286
|
+
SYSTEM_NOTIFICATION_CLOSE_TAG,
|
|
287
|
+
].join("\n");
|
|
288
|
+
|
|
289
|
+
export interface ParsedPluginWake {
|
|
290
|
+
readonly pluginId: string;
|
|
291
|
+
readonly reason: PluginWakeReason;
|
|
292
|
+
readonly item?: string;
|
|
293
|
+
/** 续跑才有:第几次、上限几次,与插件交给 agent 的原话(人可以展开看)。 */
|
|
294
|
+
readonly continuation?: { readonly round: number; readonly limit: number; readonly body: string };
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
const PLUGIN_WAKE_PATTERN = new RegExp(
|
|
298
|
+
`${FIRST_BLOCK_START}<plugin-wake plugin="([^"]+)" reason="([^"]+)"(?: item="([^"]+)")?(?: round="(\\d+)" limit="(\\d+)")? ${SYSTEM_TEXT_ESCAPED_ATTRIBUTE}>\\n([\\s\\S]*?)\\n</plugin-wake>`,
|
|
299
|
+
);
|
|
300
|
+
|
|
301
|
+
/** 渲染侧读法:只认消息的第一个块;原文只在续跑时带出来(人可以展开看插件让 agent 做什么)。对不上返回 null。 */
|
|
302
|
+
export const parsePluginWakeText = (text: string): ParsedPluginWake | null => {
|
|
303
|
+
const match = PLUGIN_WAKE_PATTERN.exec(text);
|
|
304
|
+
if (match === null) return null;
|
|
305
|
+
const [, pluginId, reason, item, round, limit, body] = match;
|
|
306
|
+
if (!pluginId || !reason) return null;
|
|
307
|
+
const known = PLUGIN_WAKE_REASONS.find((value) => value === unescapeSystemText(reason));
|
|
308
|
+
return {
|
|
309
|
+
pluginId: unescapeSystemText(pluginId),
|
|
310
|
+
reason: known ?? "notice",
|
|
311
|
+
...(item ? { item: unescapeSystemText(item) } : {}),
|
|
312
|
+
...(known === "continue" && round && limit
|
|
313
|
+
? {
|
|
314
|
+
continuation: {
|
|
315
|
+
round: Number(round),
|
|
316
|
+
limit: Number(limit),
|
|
317
|
+
body: unescapeSystemText(body ?? ""),
|
|
318
|
+
},
|
|
319
|
+
}
|
|
320
|
+
: {}),
|
|
321
|
+
};
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
/** 系统行摘要用哪一句:各端文案表里 `pluginWake.<这个名字>` 的叶子名。 */
|
|
325
|
+
type PluginWakeSummaryKey =
|
|
326
|
+
| "work"
|
|
327
|
+
| "workItem"
|
|
328
|
+
| "checkIn"
|
|
329
|
+
| "instructions"
|
|
330
|
+
| "notice"
|
|
331
|
+
| "continue";
|
|
332
|
+
|
|
333
|
+
/** 系统行摘要选哪一句、带什么参数;各端只把叶子名映射到自己文案表的键再经 hook 解析。 */
|
|
334
|
+
export const pluginWakeSummary = (
|
|
335
|
+
wake: ParsedPluginWake,
|
|
336
|
+
): {
|
|
337
|
+
readonly key: PluginWakeSummaryKey;
|
|
338
|
+
readonly item?: string;
|
|
339
|
+
readonly round?: number;
|
|
340
|
+
readonly limit?: number;
|
|
341
|
+
} => {
|
|
342
|
+
switch (wake.reason) {
|
|
343
|
+
case "work":
|
|
344
|
+
return wake.item === undefined ? { key: "work" } : { key: "workItem", item: wake.item };
|
|
345
|
+
case "check-in":
|
|
346
|
+
return { key: "checkIn" };
|
|
347
|
+
case "instructions":
|
|
348
|
+
return { key: "instructions" };
|
|
349
|
+
case "notice":
|
|
350
|
+
return { key: "notice" };
|
|
351
|
+
case "continue":
|
|
352
|
+
return wake.continuation === undefined
|
|
353
|
+
? { key: "notice" }
|
|
354
|
+
: { key: "continue", round: wake.continuation.round, limit: wake.continuation.limit };
|
|
355
|
+
}
|
|
356
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { prependPresetPrefixText } from "./systemText.ts";
|
|
2
|
+
|
|
3
|
+
interface PresetFields {
|
|
4
|
+
readonly presetId: string;
|
|
5
|
+
readonly promptPrefix?: string | undefined;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function findPreset<Preset extends PresetFields>(
|
|
9
|
+
presets: ReadonlyArray<Preset>,
|
|
10
|
+
presetId: string | null | undefined,
|
|
11
|
+
): Preset | undefined {
|
|
12
|
+
return presetId == null ? undefined : presets.find((preset) => preset.presetId === presetId);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 建 thread 那一发要真正发出去的正文。
|
|
17
|
+
*
|
|
18
|
+
* 约束:只在建 thread 时调用一次——presetId 落进 `thread.created` 之后,后续 turn
|
|
19
|
+
* 再贴一遍前缀就是重复输入。选中的 preset 没有 `promptPrefix`、或者磁盘上已经
|
|
20
|
+
* 没有这个 preset 了,正文原样返回。
|
|
21
|
+
*/
|
|
22
|
+
export function applyPresetPromptPrefix(input: {
|
|
23
|
+
readonly presets: ReadonlyArray<PresetFields>;
|
|
24
|
+
readonly presetId: string | null;
|
|
25
|
+
readonly text: string;
|
|
26
|
+
}): string {
|
|
27
|
+
const preset = findPreset(input.presets, input.presetId);
|
|
28
|
+
return preset?.promptPrefix
|
|
29
|
+
? prependPresetPrefixText({
|
|
30
|
+
presetId: preset.presetId,
|
|
31
|
+
prefix: preset.promptPrefix,
|
|
32
|
+
text: input.text,
|
|
33
|
+
})
|
|
34
|
+
: input.text;
|
|
35
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 把任意文本整理成合法的小写 git 分支片段:去引号、合并分隔符、最长 64 字符。
|
|
3
|
+
*/
|
|
4
|
+
export function sanitizeBranchFragment(raw: string): string {
|
|
5
|
+
const normalized = raw
|
|
6
|
+
.trim()
|
|
7
|
+
.toLowerCase()
|
|
8
|
+
.replace(/['"`]/g, "")
|
|
9
|
+
.replace(/^[./\s_-]+|[./\s_-]+$/g, "");
|
|
10
|
+
|
|
11
|
+
const branchFragment = normalized
|
|
12
|
+
.replace(/[^a-z0-9/_-]+/g, "-")
|
|
13
|
+
.replace(/\/+/g, "/")
|
|
14
|
+
.replace(/-+/g, "-")
|
|
15
|
+
.replace(/^[./_-]+|[./_-]+$/g, "")
|
|
16
|
+
.slice(0, 64)
|
|
17
|
+
.replace(/[./_-]+$/g, "");
|
|
18
|
+
|
|
19
|
+
return branchFragment.length > 0 ? branchFragment : "update";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** 整理成 `feature/…` 分支名;已有 `feature/` 前缀或带斜杠的命名空间时保留。 */
|
|
23
|
+
export function sanitizeFeatureBranchName(raw: string): string {
|
|
24
|
+
const sanitized = sanitizeBranchFragment(raw);
|
|
25
|
+
if (sanitized.includes("/")) {
|
|
26
|
+
return sanitized.startsWith("feature/") ? sanitized : `feature/${sanitized}`;
|
|
27
|
+
}
|
|
28
|
+
return `feature/${sanitized}`;
|
|
29
|
+
}
|