@ycodium-ai/plugin-api 0.2.5634 → 0.2.5751
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -65
- package/dist/_private/ycodium-attachment-kinds/chatAttachmentKinds.d.ts +34 -0
- package/dist/_private/ycodium-attachment-kinds/chatAttachmentKinds.js +70 -0
- package/dist/_private/ycodium-attachment-kinds/mediaKinds.d.ts +23 -0
- package/dist/_private/ycodium-attachment-kinds/mediaKinds.js +73 -0
- package/dist/_private/ycodium-composer-tokens/approvalFileChanges.d.ts +20 -0
- package/dist/_private/ycodium-composer-tokens/approvalFileChanges.js +45 -0
- package/dist/_private/ycodium-composer-tokens/composerFileLink.d.ts +1 -0
- package/dist/_private/ycodium-composer-tokens/composerFileLink.js +20 -0
- package/dist/_private/ycodium-composer-tokens/composerInlineTokens.d.ts +17 -0
- package/dist/_private/ycodium-composer-tokens/composerInlineTokens.js +91 -0
- package/dist/_private/ycodium-composer-tokens/composerLogic.d.ts +30 -0
- package/dist/_private/ycodium-composer-tokens/composerLogic.js +181 -0
- package/dist/_private/ycodium-composer-tokens/composerMentionDrag.d.ts +40 -0
- package/dist/_private/ycodium-composer-tokens/composerMentionDrag.js +60 -0
- package/dist/_private/ycodium-composer-tokens/composerPromptSegments.d.ts +16 -0
- package/dist/_private/ycodium-composer-tokens/composerPromptSegments.js +142 -0
- package/dist/_private/ycodium-composer-tokens/composerTrigger.d.ts +18 -0
- package/dist/_private/ycodium-composer-tokens/composerTrigger.js +44 -0
- package/dist/_private/ycodium-composer-tokens/contextWindowFormat.d.ts +2 -0
- package/dist/_private/ycodium-composer-tokens/contextWindowFormat.js +16 -0
- package/dist/_private/ycodium-composer-tokens/diffCount.d.ts +2 -0
- package/dist/_private/ycodium-composer-tokens/diffCount.js +15 -0
- package/dist/_private/ycodium-composer-tokens/pendingUserInput.d.ts +48 -0
- package/dist/_private/ycodium-composer-tokens/pendingUserInput.js +145 -0
- package/dist/_private/ycodium-composer-tokens/promptContextBlocks.d.ts +58 -0
- package/dist/_private/ycodium-composer-tokens/promptContextBlocks.js +121 -0
- package/dist/_private/ycodium-composer-tokens/proposedPlan.d.ts +21 -0
- package/dist/_private/ycodium-composer-tokens/proposedPlan.js +106 -0
- package/dist/_private/ycodium-composer-tokens/providerSkillSearch.d.ts +3 -0
- package/dist/_private/ycodium-composer-tokens/providerSkillSearch.js +79 -0
- package/dist/_private/ycodium-composer-tokens/providerSkills.d.ts +17 -0
- package/dist/_private/ycodium-composer-tokens/providerSkills.js +57 -0
- package/dist/_private/ycodium-composer-tokens/queueEntry.d.ts +31 -0
- package/dist/_private/ycodium-composer-tokens/queueEntry.js +44 -0
- package/dist/_private/ycodium-composer-tokens/reviewCommentBlocks.d.ts +29 -0
- package/dist/_private/ycodium-composer-tokens/reviewCommentBlocks.js +118 -0
- package/dist/_private/ycodium-composer-tokens/searchRanking.d.ts +27 -0
- package/dist/_private/ycodium-composer-tokens/searchRanking.js +129 -0
- package/dist/_private/ycodium-composer-tokens/skillTokens.d.ts +101 -0
- package/dist/_private/ycodium-composer-tokens/skillTokens.js +148 -0
- package/dist/_private/ycodium-composer-tokens/slashMenu.d.ts +130 -0
- package/dist/_private/ycodium-composer-tokens/slashMenu.js +175 -0
- package/dist/_private/ycodium-composer-tokens/userInputOptionText.d.ts +33 -0
- package/dist/_private/ycodium-composer-tokens/userInputOptionText.js +27 -0
- package/dist/_private/ycodium-credential-account/credentialAccount.d.ts +21 -0
- package/dist/_private/ycodium-credential-account/credentialAccount.js +62 -0
- package/dist/_private/ycodium-credential-account/quotaJson.d.ts +12 -0
- package/dist/_private/ycodium-credential-account/quotaJson.js +14 -0
- package/dist/_private/ycodium-credential-account/quotaRequest.d.ts +32 -0
- package/dist/_private/ycodium-credential-account/quotaRequest.js +60 -0
- package/dist/_private/ycodium-day-format/dayFormat.d.ts +31 -0
- package/dist/_private/ycodium-day-format/dayFormat.js +32 -0
- package/dist/_private/ycodium-day-format/timestampFormat.d.ts +35 -0
- package/dist/_private/ycodium-day-format/timestampFormat.js +119 -0
- package/dist/_private/ycodium-decision-order/decisionOrder.d.ts +19 -0
- package/dist/_private/ycodium-decision-order/decisionOrder.js +38 -0
- package/dist/_private/ycodium-diff-format/diffRendering.d.ts +42 -0
- package/dist/_private/ycodium-diff-format/diffRendering.js +171 -0
- package/dist/_private/ycodium-duration-format/durationFormat.d.ts +20 -0
- package/dist/_private/ycodium-duration-format/durationFormat.js +56 -0
- package/dist/_private/ycodium-fetch-ports/fetchPorts.d.ts +36 -0
- package/dist/_private/ycodium-fetch-ports/fetchPorts.js +69 -0
- package/dist/_private/ycodium-fetch-ports/netFault.d.ts +10 -0
- package/dist/_private/ycodium-fetch-ports/netFault.js +17 -0
- package/dist/_private/ycodium-full-access-mode/fullAccessNativeMode.d.ts +28 -0
- package/dist/_private/ycodium-full-access-mode/fullAccessNativeMode.js +30 -0
- package/dist/_private/ycodium-instance-config/homePath.d.ts +34 -0
- package/dist/_private/ycodium-instance-config/homePath.js +85 -0
- package/dist/_private/ycodium-instance-config/instanceConfig.d.ts +46 -0
- package/dist/_private/ycodium-instance-config/instanceConfig.js +111 -0
- package/dist/_private/ycodium-instance-config/launchArgs.d.ts +5 -0
- package/dist/_private/ycodium-instance-config/launchArgs.js +65 -0
- package/dist/_private/ycodium-instance-config/probeProcess.d.ts +39 -0
- package/dist/_private/ycodium-instance-config/probeProcess.js +55 -0
- package/dist/_private/ycodium-instance-config/programHomeSchema.d.ts +44 -0
- package/dist/_private/ycodium-instance-config/programHomeSchema.js +60 -0
- package/dist/_private/ycodium-instance-config/tomlScalar.d.ts +5 -0
- package/dist/_private/ycodium-instance-config/tomlScalar.js +11 -0
- package/dist/_private/ycodium-jsonl-stream/appendedJsonl.d.ts +47 -0
- package/dist/_private/ycodium-jsonl-stream/appendedJsonl.js +172 -0
- package/dist/_private/ycodium-jsonl-stream/claudeSessions.d.ts +63 -0
- package/dist/_private/ycodium-jsonl-stream/claudeSessions.js +220 -0
- package/dist/_private/ycodium-jsonl-stream/codexSessions.d.ts +41 -0
- package/dist/_private/ycodium-jsonl-stream/codexSessions.js +197 -0
- package/dist/_private/ycodium-jsonl-stream/history.d.ts +6 -0
- package/dist/_private/ycodium-jsonl-stream/history.js +389 -0
- package/dist/_private/ycodium-jsonl-stream/historyErrors.d.ts +6 -0
- package/dist/_private/ycodium-jsonl-stream/historyErrors.js +6 -0
- package/dist/_private/ycodium-jsonl-stream/historyFile.d.ts +19 -0
- package/dist/_private/ycodium-jsonl-stream/historyFile.js +117 -0
- package/dist/_private/ycodium-jsonl-stream/historyRecord.d.ts +31 -0
- package/dist/_private/ycodium-jsonl-stream/historyRecord.js +144 -0
- package/dist/_private/ycodium-jsonl-stream/historyWaiting.d.ts +8 -0
- package/dist/_private/ycodium-jsonl-stream/historyWaiting.js +142 -0
- package/dist/_private/ycodium-jsonl-stream/jsonObjectLine.d.ts +5 -0
- package/dist/_private/ycodium-jsonl-stream/jsonObjectLine.js +18 -0
- package/dist/_private/ycodium-jsonl-stream/jsonlStream.d.ts +79 -0
- package/dist/_private/ycodium-jsonl-stream/jsonlStream.js +603 -0
- package/dist/_private/ycodium-jsonl-stream/scanCache.d.ts +69 -0
- package/dist/_private/ycodium-jsonl-stream/scanCache.js +106 -0
- package/dist/_private/ycodium-jsonl-stream/sessionDirectory.d.ts +5 -0
- package/dist/_private/ycodium-jsonl-stream/sessionDirectory.js +32 -0
- package/dist/_private/ycodium-jsonl-stream/sessionTranscript.d.ts +16 -0
- package/dist/_private/ycodium-jsonl-stream/sessionTranscript.js +112 -0
- package/dist/_private/ycodium-jsonl-stream/usageFields.d.ts +5 -0
- package/dist/_private/ycodium-jsonl-stream/usageFields.js +11 -0
- package/dist/_private/ycodium-markdown-fence/markdownFence.d.ts +6 -0
- package/dist/_private/ycodium-markdown-fence/markdownFence.js +24 -0
- package/dist/_private/ycodium-source-control/pullRequestScope.d.ts +23 -0
- package/dist/_private/ycodium-source-control/pullRequestScope.js +29 -0
- package/dist/_private/ycodium-sse-stream/sseStream.d.ts +37 -0
- package/dist/_private/ycodium-sse-stream/sseStream.js +104 -0
- package/dist/_private/ycodium-system-text/memberInstructions.d.ts +13 -0
- package/dist/_private/ycodium-system-text/memberInstructions.js +9 -0
- package/dist/_private/ycodium-system-text/systemText.d.ts +179 -0
- package/dist/_private/ycodium-system-text/systemText.js +257 -0
- package/dist/_private/ycodium-system-text/threadPreset.d.ts +18 -0
- package/dist/_private/ycodium-system-text/threadPreset.js +21 -0
- package/dist/_private/ycodium-text-generation/branchName.d.ts +6 -0
- package/dist/_private/ycodium-text-generation/branchName.js +26 -0
- package/dist/_private/ycodium-text-generation/prompts.d.ts +70 -0
- package/dist/_private/ycodium-text-generation/prompts.js +266 -0
- package/dist/_private/ycodium-text-generation/sanitize.d.ts +10 -0
- package/dist/_private/ycodium-text-generation/sanitize.js +124 -0
- package/dist/_private/ycodium-text-generation/structuredTextGeneration.d.ts +29 -0
- package/dist/_private/ycodium-text-generation/structuredTextGeneration.js +163 -0
- package/dist/_private/ycodium-tool-label/toolLabel.d.ts +42 -0
- package/dist/_private/ycodium-tool-label/toolLabel.js +249 -0
- package/dist/_private/ycodium-ui-hooks/DiffStatCounts.d.ts +22 -0
- package/dist/_private/ycodium-ui-hooks/DiffStatCounts.js +22 -0
- package/dist/_private/ycodium-ui-hooks/ProviderSignInChallenge.d.ts +29 -0
- package/dist/_private/ycodium-ui-hooks/ProviderSignInChallenge.js +13 -0
- package/dist/_private/ycodium-ui-hooks/RenderErrorBoundary.d.ts +28 -0
- package/dist/_private/ycodium-ui-hooks/RenderErrorBoundary.js +22 -0
- package/dist/_private/ycodium-ui-hooks/RuntimeMaintenanceActions.d.ts +19 -0
- package/dist/_private/ycodium-ui-hooks/RuntimeMaintenanceActions.js +7 -0
- package/dist/_private/ycodium-ui-hooks/SkillInlineText.d.ts +13 -0
- package/dist/_private/ycodium-ui-hooks/SkillInlineText.js +13 -0
- package/dist/_private/ycodium-ui-hooks/bundleStyle.d.ts +4 -0
- package/dist/_private/ycodium-ui-hooks/bundleStyle.js +52 -0
- package/dist/_private/ycodium-ui-hooks/catalogKeys.d.ts +9 -0
- package/dist/_private/ycodium-ui-hooks/catalogKeys.js +1 -0
- package/dist/_private/ycodium-ui-hooks/clipboard.d.ts +22 -0
- package/dist/_private/ycodium-ui-hooks/clipboard.js +149 -0
- package/dist/_private/ycodium-ui-hooks/hostControls.d.ts +24 -0
- package/dist/_private/ycodium-ui-hooks/hostControls.js +25 -0
- package/dist/_private/ycodium-ui-hooks/inlineChips.d.ts +50 -0
- package/dist/_private/ycodium-ui-hooks/inlineChips.js +32 -0
- package/dist/_private/ycodium-ui-hooks/notifyMessages.d.ts +20 -0
- package/dist/_private/ycodium-ui-hooks/notifyMessages.js +26 -0
- package/dist/_private/ycodium-ui-hooks/presenterInputState.d.ts +52 -0
- package/dist/_private/ycodium-ui-hooks/presenterInputState.js +240 -0
- package/dist/_private/ycodium-ui-hooks/processRowHeader.d.ts +6 -0
- package/dist/_private/ycodium-ui-hooks/processRowHeader.js +6 -0
- package/dist/_private/ycodium-ui-hooks/timelineDisclosure.d.ts +5 -0
- package/dist/_private/ycodium-ui-hooks/timelineDisclosure.js +73 -0
- package/dist/_private/ycodium-ui-hooks/useMediaQuery.d.ts +20 -0
- package/dist/_private/ycodium-ui-hooks/useMediaQuery.js +70 -0
- package/dist/_private/ycodium-ui-hooks/workEntryIcons.d.ts +25 -0
- package/dist/_private/ycodium-ui-hooks/workEntryIcons.js +66 -0
- package/dist/_private/ycodium-workspace-path/directoryScope.d.ts +5 -0
- package/dist/_private/ycodium-workspace-path/directoryScope.js +28 -0
- package/dist/_private/ycodium-workspace-path/workspacePath.d.ts +19 -0
- package/dist/_private/ycodium-workspace-path/workspacePath.js +90 -0
- package/dist/cache.d.ts.map +1 -1
- package/dist/cache.js.map +1 -1
- package/dist/capabilityPorts.d.ts.map +1 -1
- package/dist/capabilityPorts.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js.map +1 -1
- package/dist/communication-view.d.ts.map +1 -1
- package/dist/communication-view.js.map +1 -1
- package/dist/communication.d.ts.map +1 -1
- package/dist/communication.js.map +1 -1
- package/dist/composer-control.d.ts.map +1 -1
- package/dist/composer-control.js.map +1 -1
- package/dist/composer.d.ts +22 -0
- package/dist/composer.d.ts.map +1 -0
- package/dist/composer.js +22 -0
- package/dist/composer.js.map +1 -0
- package/dist/conversation-queue.d.ts.map +1 -1
- package/dist/conversation-queue.js.map +1 -1
- package/dist/conversation-view.d.ts.map +1 -1
- package/dist/conversation-view.js.map +1 -1
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js.map +1 -1
- package/dist/conversationAttachments.d.ts.map +1 -1
- package/dist/conversationAttachments.js.map +1 -1
- package/dist/conversationBase.d.ts.map +1 -1
- package/dist/conversationBase.js.map +1 -1
- package/dist/conversationComposerApi.d.ts.map +1 -1
- package/dist/conversationComposerApi.js.map +1 -1
- package/dist/conversationComposerEnvironment.d.ts.map +1 -1
- package/dist/conversationComposerEnvironment.js.map +1 -1
- package/dist/conversationComposerHandle.d.ts.map +1 -1
- package/dist/conversationComposerHandle.js.map +1 -1
- package/dist/conversationComposerParts.d.ts.map +1 -1
- package/dist/conversationComposerParts.js.map +1 -1
- package/dist/conversationDerive.d.ts.map +1 -1
- package/dist/conversationDerive.js.map +1 -1
- package/dist/conversationDrafts.d.ts.map +1 -1
- package/dist/conversationDrafts.js.map +1 -1
- package/dist/conversationForks.d.ts.map +1 -1
- package/dist/conversationForks.js.map +1 -1
- package/dist/conversationHostModels.d.ts.map +1 -1
- package/dist/conversationHostModels.js.map +1 -1
- package/dist/conversationLoadFailure.d.ts.map +1 -1
- package/dist/conversationLoadFailure.js.map +1 -1
- package/dist/conversationMemberMentions.d.ts.map +1 -1
- package/dist/conversationMemberMentions.js.map +1 -1
- package/dist/conversationMessageLinks.d.ts.map +1 -1
- package/dist/conversationMessageLinks.js.map +1 -1
- package/dist/conversationMessageMemory.d.ts.map +1 -1
- package/dist/conversationMessageMemory.js.map +1 -1
- package/dist/conversationPresets.d.ts.map +1 -1
- package/dist/conversationPresets.js.map +1 -1
- package/dist/conversationRows.d.ts.map +1 -1
- package/dist/conversationRows.js.map +1 -1
- package/dist/conversationSessionMessage.d.ts.map +1 -1
- package/dist/conversationSessionMessage.js.map +1 -1
- package/dist/conversationSkills.d.ts.map +1 -1
- package/dist/conversationSkills.js.map +1 -1
- package/dist/conversationTrajectory.d.ts.map +1 -1
- package/dist/conversationTrajectory.js.map +1 -1
- package/dist/conversationTranscript.d.ts.map +1 -1
- package/dist/conversationTranscript.js.map +1 -1
- package/dist/conversationTurnSummaries.d.ts.map +1 -1
- package/dist/conversationTurnSummaries.js.map +1 -1
- package/dist/conversationViewProps.d.ts.map +1 -1
- package/dist/conversationViewProps.js.map +1 -1
- package/dist/conversationWorkEntry.d.ts.map +1 -1
- package/dist/conversationWorkEntry.js.map +1 -1
- package/dist/credential-account.d.ts +4 -0
- package/dist/credential-account.d.ts.map +1 -0
- package/dist/credential-account.js +4 -0
- package/dist/credential-account.js.map +1 -0
- package/dist/dataPorts.gen.d.ts +306 -0
- package/dist/dataPorts.gen.d.ts.map +1 -1
- package/dist/dataPorts.gen.js.map +1 -1
- package/dist/decision-card.d.ts.map +1 -1
- package/dist/decision-card.js.map +1 -1
- package/dist/decisions.d.ts.map +1 -1
- package/dist/decisions.js.map +1 -1
- package/dist/definition.d.ts.map +1 -1
- package/dist/definition.js.map +1 -1
- package/dist/derivedState.d.ts.map +1 -1
- package/dist/derivedState.js.map +1 -1
- package/dist/diagnosticData.d.ts.map +1 -1
- package/dist/diagnosticData.js.map +1 -1
- package/dist/diff-rendering.d.ts +2 -0
- package/dist/diff-rendering.d.ts.map +1 -0
- package/dist/diff-rendering.js +2 -0
- package/dist/diff-rendering.js.map +1 -0
- package/dist/display-format.d.ts +5 -0
- package/dist/display-format.d.ts.map +1 -0
- package/dist/display-format.js +5 -0
- package/dist/display-format.js.map +1 -0
- package/dist/entity-names.d.ts.map +1 -1
- package/dist/entity-names.js.map +1 -1
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js.map +1 -1
- package/dist/executor-mode.d.ts +2 -0
- package/dist/executor-mode.d.ts.map +1 -0
- package/dist/executor-mode.js +2 -0
- package/dist/executor-mode.js.map +1 -0
- package/dist/executor.d.ts +17 -1
- package/dist/executor.d.ts.map +1 -1
- package/dist/executor.js.map +1 -1
- package/dist/executorCapabilities.d.ts.map +1 -1
- package/dist/executorCapabilities.js.map +1 -1
- package/dist/executorCard.d.ts +6 -0
- package/dist/executorCard.d.ts.map +1 -1
- package/dist/executorCard.js.map +1 -1
- package/dist/executorCommandArgv.d.ts.map +1 -1
- package/dist/executorCommandArgv.js.map +1 -1
- package/dist/executorEffective.d.ts.map +1 -1
- package/dist/executorEffective.js.map +1 -1
- package/dist/executorErrors.d.ts.map +1 -1
- package/dist/executorErrors.js.map +1 -1
- package/dist/executorEvents.d.ts.map +1 -1
- package/dist/executorEvents.js.map +1 -1
- package/dist/executorModelOptions.d.ts.map +1 -1
- package/dist/executorModelOptions.js.map +1 -1
- package/dist/executorProcesses.d.ts.map +1 -1
- package/dist/executorProcesses.js.map +1 -1
- package/dist/executorSession.d.ts +8 -2
- package/dist/executorSession.d.ts.map +1 -1
- package/dist/executorSession.js.map +1 -1
- package/dist/executorSpawn.d.ts +5 -4
- package/dist/executorSpawn.d.ts.map +1 -1
- package/dist/executorSpawn.js +20 -7
- package/dist/executorSpawn.js.map +1 -1
- package/dist/fetch-ports.d.ts +2 -0
- package/dist/fetch-ports.d.ts.map +1 -0
- package/dist/fetch-ports.js +2 -0
- package/dist/fetch-ports.js.map +1 -0
- package/dist/file-preview.d.ts.map +1 -1
- package/dist/file-preview.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/inline-tag.d.ts.map +1 -1
- package/dist/inline-tag.js.map +1 -1
- package/dist/instance-config.d.ts +7 -0
- package/dist/instance-config.d.ts.map +1 -0
- package/dist/instance-config.js +7 -0
- package/dist/instance-config.js.map +1 -0
- package/dist/interval.d.ts.map +1 -1
- package/dist/interval.js.map +1 -1
- package/dist/jsonl.d.ts +6 -0
- package/dist/jsonl.d.ts.map +1 -0
- package/dist/jsonl.js +6 -0
- package/dist/jsonl.js.map +1 -0
- package/dist/keyedSubscribers.d.ts.map +1 -1
- package/dist/keyedSubscribers.js.map +1 -1
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js.map +1 -1
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js.map +1 -1
- package/dist/model-picker.d.ts.map +1 -1
- package/dist/model-picker.js.map +1 -1
- package/dist/modelCatalogNotice.d.ts.map +1 -1
- package/dist/modelCatalogNotice.js.map +1 -1
- package/dist/modelChoice.d.ts.map +1 -1
- package/dist/modelChoice.js.map +1 -1
- package/dist/modelChoiceOptions.d.ts.map +1 -1
- package/dist/modelChoiceOptions.js.map +1 -1
- package/dist/modelChoiceTraits.d.ts.map +1 -1
- package/dist/modelChoiceTraits.js.map +1 -1
- package/dist/modelDisplayName.d.ts.map +1 -1
- package/dist/modelDisplayName.js.map +1 -1
- package/dist/pending-requests.d.ts.map +1 -1
- package/dist/pending-requests.js.map +1 -1
- package/dist/plugin-tools.d.ts.map +1 -1
- package/dist/plugin-tools.js.map +1 -1
- package/dist/pluginContextCommands.d.ts.map +1 -1
- package/dist/pluginContextCommands.js.map +1 -1
- package/dist/pluginContextProviders.d.ts.map +1 -1
- package/dist/pluginContextProviders.js.map +1 -1
- package/dist/pluginContextThreads.d.ts.map +1 -1
- package/dist/pluginContextThreads.js.map +1 -1
- package/dist/pluginContextWorkspace.d.ts.map +1 -1
- package/dist/pluginContextWorkspace.js.map +1 -1
- package/dist/process-operation.d.ts.map +1 -1
- package/dist/process-operation.js.map +1 -1
- package/dist/process-socket.d.ts.map +1 -1
- package/dist/process-socket.js.map +1 -1
- package/dist/process-stdin.d.ts.map +1 -1
- package/dist/process-stdin.js.map +1 -1
- package/dist/projects.d.ts.map +1 -1
- package/dist/projects.js.map +1 -1
- package/dist/provider-settings.d.ts.map +1 -1
- package/dist/provider-settings.js.map +1 -1
- package/dist/providerInstanceSelection.d.ts.map +1 -1
- package/dist/providerInstanceSelection.js.map +1 -1
- package/dist/reasoningLevelFallback.d.ts.map +1 -1
- package/dist/reasoningLevelFallback.js.map +1 -1
- package/dist/runtime-maintenance.d.ts.map +1 -1
- package/dist/runtime-maintenance.js.map +1 -1
- package/dist/runtimes.d.ts.map +1 -1
- package/dist/runtimes.js.map +1 -1
- package/dist/selectAllCopy.d.ts.map +1 -1
- package/dist/selectAllCopy.js.map +1 -1
- package/dist/session-history.d.ts +6 -0
- package/dist/session-history.d.ts.map +1 -0
- package/dist/session-history.js +6 -0
- package/dist/session-history.js.map +1 -0
- package/dist/settings-actions.d.ts.map +1 -1
- package/dist/settings-actions.js.map +1 -1
- package/dist/settings-card-shape.d.ts.map +1 -1
- package/dist/settings-card-shape.js.map +1 -1
- package/dist/settings-card.d.ts.map +1 -1
- package/dist/settings-card.js.map +1 -1
- package/dist/settings-ui.d.ts.map +1 -1
- package/dist/settings-ui.js.map +1 -1
- package/dist/sign-in.d.ts.map +1 -1
- package/dist/sign-in.js.map +1 -1
- package/dist/slashCommands.d.ts.map +1 -1
- package/dist/slashCommands.js.map +1 -1
- package/dist/slots.d.ts.map +1 -1
- package/dist/slots.js.map +1 -1
- package/dist/source/_private/ycodium-attachment-kinds/chatAttachmentKinds.ts +105 -0
- package/dist/source/_private/ycodium-attachment-kinds/mediaKinds.ts +83 -0
- package/dist/source/_private/ycodium-composer-tokens/approvalFileChanges.ts +58 -0
- package/dist/source/_private/ycodium-composer-tokens/composerFileLink.ts +23 -0
- package/dist/source/_private/ycodium-composer-tokens/composerInlineTokens.ts +130 -0
- package/dist/source/_private/ycodium-composer-tokens/composerLogic.ts +251 -0
- package/dist/source/_private/ycodium-composer-tokens/composerMentionDrag.ts +98 -0
- package/dist/source/_private/ycodium-composer-tokens/composerPromptSegments.ts +222 -0
- package/dist/source/_private/ycodium-composer-tokens/composerTrigger.ts +64 -0
- package/dist/source/_private/ycodium-composer-tokens/contextWindowFormat.ts +16 -0
- package/dist/source/_private/ycodium-composer-tokens/diffCount.ts +14 -0
- package/dist/source/_private/ycodium-composer-tokens/pendingUserInput.ts +256 -0
- package/dist/source/_private/ycodium-composer-tokens/promptContextBlocks.ts +179 -0
- package/dist/source/_private/ycodium-composer-tokens/proposedPlan.ts +134 -0
- package/dist/source/_private/ycodium-composer-tokens/providerSkillSearch.ts +105 -0
- package/dist/source/_private/ycodium-composer-tokens/providerSkills.ts +86 -0
- package/dist/source/_private/ycodium-composer-tokens/queueEntry.ts +49 -0
- package/dist/source/_private/ycodium-composer-tokens/reviewCommentBlocks.ts +177 -0
- package/dist/source/_private/ycodium-composer-tokens/searchRanking.ts +192 -0
- package/dist/source/_private/ycodium-composer-tokens/skillTokens.ts +192 -0
- package/dist/source/_private/ycodium-composer-tokens/slashMenu.ts +293 -0
- package/dist/source/_private/ycodium-composer-tokens/userInputOptionText.ts +51 -0
- package/dist/source/_private/ycodium-credential-account/credentialAccount.ts +83 -0
- package/dist/source/_private/ycodium-credential-account/quotaJson.ts +25 -0
- package/dist/source/_private/ycodium-credential-account/quotaRequest.ts +79 -0
- package/dist/source/_private/ycodium-day-format/dayFormat.ts +57 -0
- package/dist/source/_private/ycodium-day-format/timestampFormat.ts +165 -0
- package/dist/source/_private/ycodium-decision-order/decisionOrder.ts +54 -0
- package/dist/source/_private/ycodium-diff-format/diffRendering.ts +229 -0
- package/dist/source/_private/ycodium-duration-format/durationFormat.ts +60 -0
- package/dist/source/_private/ycodium-executor-common/catalogModel.ts +40 -0
- package/dist/source/_private/ycodium-executor-common/eventTypes.ts +97 -0
- package/dist/source/_private/ycodium-executor-common/modelSelection.ts +24 -0
- package/dist/source/_private/ycodium-executor-common/nodeStreams.ts +212 -0
- package/dist/source/_private/ycodium-executor-common/raceAbort.ts +25 -0
- package/dist/source/_private/ycodium-executor-common/reasoningLevelFallback.ts +28 -0
- package/dist/source/_private/ycodium-executor-common/stderrTail.ts +27 -0
- package/dist/source/_private/ycodium-executor-common/toolPresentation.ts +268 -0
- package/dist/source/_private/ycodium-fetch-ports/fetchPorts.ts +84 -0
- package/dist/source/_private/ycodium-fetch-ports/netFault.ts +30 -0
- package/dist/source/_private/ycodium-full-access-mode/fullAccessNativeMode.ts +32 -0
- package/dist/source/_private/ycodium-instance-config/homePath.ts +140 -0
- package/dist/source/_private/ycodium-instance-config/instanceConfig.ts +149 -0
- package/dist/source/_private/ycodium-instance-config/launchArgs.ts +60 -0
- package/dist/source/_private/ycodium-instance-config/probeProcess.ts +89 -0
- package/dist/source/_private/ycodium-instance-config/programHomeSchema.ts +74 -0
- package/dist/source/_private/ycodium-instance-config/tomlScalar.ts +10 -0
- package/dist/source/_private/ycodium-jsonl-stream/appendedJsonl.ts +222 -0
- package/dist/source/_private/ycodium-jsonl-stream/claudeSessions.ts +263 -0
- package/dist/source/_private/ycodium-jsonl-stream/codexSessions.ts +254 -0
- package/dist/source/_private/ycodium-jsonl-stream/history.ts +492 -0
- package/dist/source/_private/ycodium-jsonl-stream/historyErrors.ts +6 -0
- package/dist/source/_private/ycodium-jsonl-stream/historyFile.ts +139 -0
- package/dist/source/_private/ycodium-jsonl-stream/historyRecord.ts +180 -0
- package/dist/source/_private/ycodium-jsonl-stream/historyWaiting.ts +140 -0
- package/dist/source/_private/ycodium-jsonl-stream/jsonObjectLine.ts +15 -0
- package/dist/source/_private/ycodium-jsonl-stream/jsonlStream.ts +650 -0
- package/dist/source/_private/ycodium-jsonl-stream/scanCache.ts +163 -0
- package/dist/source/_private/ycodium-jsonl-stream/sessionDirectory.ts +39 -0
- package/dist/source/_private/ycodium-jsonl-stream/sessionTranscript.ts +136 -0
- package/dist/source/_private/ycodium-jsonl-stream/usageFields.ts +13 -0
- package/dist/source/_private/ycodium-markdown-fence/markdownFence.ts +28 -0
- package/dist/source/_private/ycodium-source-control/pullRequestScope.ts +35 -0
- package/dist/source/_private/ycodium-sse-stream/sseStream.ts +118 -0
- package/dist/source/_private/ycodium-system-text/memberInstructions.ts +24 -0
- package/dist/source/_private/ycodium-system-text/systemText.ts +356 -0
- package/dist/source/_private/ycodium-system-text/threadPreset.ts +35 -0
- package/dist/source/_private/ycodium-text-generation/branchName.ts +29 -0
- package/dist/source/_private/ycodium-text-generation/prompts.ts +342 -0
- package/dist/source/_private/ycodium-text-generation/sanitize.ts +125 -0
- package/dist/source/_private/ycodium-text-generation/structuredTextGeneration.ts +237 -0
- package/dist/source/_private/ycodium-tool-label/toolLabel.ts +287 -0
- package/dist/source/_private/ycodium-ui-hooks/DiffStatCounts.tsx +76 -0
- package/dist/source/_private/ycodium-ui-hooks/ProviderSignInChallenge.tsx +115 -0
- package/dist/source/_private/ycodium-ui-hooks/RenderErrorBoundary.tsx +34 -0
- package/dist/source/_private/ycodium-ui-hooks/RuntimeMaintenanceActions.tsx +63 -0
- package/dist/source/_private/ycodium-ui-hooks/SkillInlineText.tsx +28 -0
- package/dist/source/_private/ycodium-ui-hooks/bundleStyle.ts +52 -0
- package/dist/source/_private/ycodium-ui-hooks/catalogKeys.ts +11 -0
- package/dist/source/_private/ycodium-ui-hooks/clipboard.ts +176 -0
- package/dist/source/_private/ycodium-ui-hooks/hostControls.ts +43 -0
- package/dist/source/_private/ycodium-ui-hooks/inlineChips.tsx +114 -0
- package/dist/source/_private/ycodium-ui-hooks/notifyMessages.ts +36 -0
- package/dist/source/_private/ycodium-ui-hooks/presenterInputState.ts +341 -0
- package/dist/source/_private/ycodium-ui-hooks/processRowHeader.ts +7 -0
- package/dist/source/_private/ycodium-ui-hooks/timelineDisclosure.ts +98 -0
- package/dist/source/_private/ycodium-ui-hooks/useMediaQuery.ts +87 -0
- package/dist/source/_private/ycodium-ui-hooks/workEntryIcons.ts +99 -0
- package/dist/source/_private/ycodium-workspace-path/directoryScope.ts +34 -0
- package/dist/source/_private/ycodium-workspace-path/workspacePath.ts +110 -0
- package/dist/source/cache.ts +55 -0
- package/dist/source/capabilityPorts.ts +272 -0
- package/dist/source/cli.ts +69 -0
- package/dist/source/commands.ts +208 -0
- package/dist/source/communication-view.ts +107 -0
- package/dist/source/communication.ts +26 -0
- package/dist/source/composer-control.ts +16 -0
- package/dist/source/composer.ts +108 -0
- package/dist/source/conversation-queue.ts +165 -0
- package/dist/source/conversation-view.ts +49 -0
- package/dist/source/conversation.ts +700 -0
- package/dist/source/conversationAttachments.ts +139 -0
- package/dist/source/conversationBase.ts +128 -0
- package/dist/source/conversationComposerApi.ts +339 -0
- package/dist/source/conversationComposerEnvironment.ts +76 -0
- package/dist/source/conversationComposerHandle.ts +89 -0
- package/dist/source/conversationComposerParts.ts +10 -0
- package/dist/source/conversationDerive.ts +252 -0
- package/dist/source/conversationDrafts.ts +281 -0
- package/dist/source/conversationForks.ts +40 -0
- package/dist/source/conversationHostModels.ts +467 -0
- package/dist/source/conversationLoadFailure.ts +9 -0
- package/dist/source/conversationMemberMentions.ts +63 -0
- package/dist/source/conversationMessageLinks.ts +153 -0
- package/dist/source/conversationMessageMemory.ts +45 -0
- package/dist/source/conversationPresets.ts +15 -0
- package/dist/source/conversationRows.ts +132 -0
- package/dist/source/conversationSessionMessage.ts +18 -0
- package/dist/source/conversationSkills.ts +26 -0
- package/dist/source/conversationTrajectory.ts +116 -0
- package/dist/source/conversationTranscript.ts +33 -0
- package/dist/source/conversationTurnSummaries.ts +57 -0
- package/dist/source/conversationViewProps.ts +486 -0
- package/dist/source/conversationWorkEntry.ts +104 -0
- package/dist/source/credential-account.ts +18 -0
- package/dist/source/dataPorts.gen.ts +2207 -0
- package/dist/source/decision-card.ts +87 -0
- package/dist/source/decisions.ts +43 -0
- package/dist/source/definition.ts +28 -0
- package/dist/source/derivedState.ts +55 -0
- package/dist/source/diagnosticData.ts +238 -0
- package/dist/source/diff-rendering.ts +6 -0
- package/dist/source/display-format.ts +14 -0
- package/dist/source/entity-names.ts +73 -0
- package/dist/source/events.ts +326 -0
- package/dist/source/executor-mode.ts +1 -0
- package/dist/source/executor.ts +623 -0
- package/dist/source/executorCapabilities.ts +89 -0
- package/dist/source/executorCard.ts +426 -0
- package/dist/source/executorCommandArgv.ts +114 -0
- package/dist/source/executorEffective.ts +99 -0
- package/dist/source/executorErrors.ts +73 -0
- package/dist/source/executorEvents.ts +258 -0
- package/dist/source/executorModelOptions.ts +179 -0
- package/dist/source/executorProcesses.ts +43 -0
- package/dist/source/executorSession.ts +508 -0
- package/dist/source/executorSpawn.ts +141 -0
- package/dist/source/fetch-ports.ts +1 -0
- package/dist/source/file-preview.ts +32 -0
- package/dist/source/index.ts +416 -0
- package/dist/source/inline-tag.ts +27 -0
- package/dist/source/instance-config.ts +31 -0
- package/dist/source/interval.ts +32 -0
- package/dist/source/jsonl.ts +21 -0
- package/dist/source/keyedSubscribers.ts +55 -0
- package/dist/source/logger.ts +16 -0
- package/dist/source/messages.ts +27 -0
- package/dist/source/model-picker.ts +82 -0
- package/dist/source/modelCatalogNotice.ts +34 -0
- package/dist/source/modelChoice.ts +371 -0
- package/dist/source/modelChoiceOptions.ts +309 -0
- package/dist/source/modelChoiceTraits.ts +133 -0
- package/dist/source/modelDisplayName.ts +42 -0
- package/dist/source/pending-requests.ts +56 -0
- package/dist/source/plugin-tools.ts +181 -0
- package/dist/source/pluginContextCommands.ts +224 -0
- package/dist/source/pluginContextProviders.ts +136 -0
- package/dist/source/pluginContextThreads.ts +83 -0
- package/dist/source/pluginContextWorkspace.ts +74 -0
- package/dist/source/process-operation.ts +291 -0
- package/dist/source/process-socket.ts +371 -0
- package/dist/source/process-stdin.ts +214 -0
- package/dist/source/projects.ts +31 -0
- package/dist/source/provider-settings.ts +343 -0
- package/dist/source/providerInstanceSelection.ts +72 -0
- package/dist/source/reasoningLevelFallback.ts +13 -0
- package/dist/source/runtime-maintenance.ts +307 -0
- package/dist/source/runtimes.ts +14 -0
- package/dist/source/selectAllCopy.ts +12 -0
- package/dist/source/session-history.ts +45 -0
- package/dist/source/settings-actions.ts +91 -0
- package/dist/source/settings-card-shape.ts +229 -0
- package/dist/source/settings-card.ts +311 -0
- package/dist/source/settings-ui.ts +48 -0
- package/dist/source/sign-in.ts +52 -0
- package/dist/source/slashCommands.ts +36 -0
- package/dist/source/slots.ts +243 -0
- package/dist/source/source-control.ts +5 -0
- package/dist/source/sse.ts +1 -0
- package/dist/source/system-text.ts +18 -0
- package/dist/source/teamView.ts +67 -0
- package/dist/source/testing.ts +203 -0
- package/dist/source/text-generation.ts +5 -0
- package/dist/source/threadAnnotation.ts +12 -0
- package/dist/source/threads.ts +77 -0
- package/dist/source/timeline-process.ts +87 -0
- package/dist/source/timeline-row-error.ts +14 -0
- package/dist/source/tool-display.ts +130 -0
- package/dist/source/traits-picker.ts +84 -0
- package/dist/source/ui-bridge-version.ts +64 -0
- package/dist/source/ui-hooks.ts +26 -0
- package/dist/source/ui-i18n.ts +1 -0
- package/dist/source/ui-media-query.ts +1 -0
- package/dist/source/ui-presenter-state.ts +6 -0
- package/dist/source/ui.ts +671 -0
- package/dist/source/uiHostCapabilities.ts +85 -0
- package/dist/source/uiMachineAdmission.ts +21 -0
- package/dist/source/uiSessionProjections.ts +19 -0
- package/dist/source/usage.ts +225 -0
- package/dist/source/version.ts +30 -0
- package/dist/source/workspace-path.ts +2 -0
- package/dist/source-control.d.ts +3 -0
- package/dist/source-control.d.ts.map +1 -0
- package/dist/source-control.js +3 -0
- package/dist/source-control.js.map +1 -0
- package/dist/sse.d.ts +2 -0
- package/dist/sse.d.ts.map +1 -0
- package/dist/sse.js +2 -0
- package/dist/sse.js.map +1 -0
- package/dist/system-text.d.ts +4 -0
- package/dist/system-text.d.ts.map +1 -0
- package/dist/system-text.js +4 -0
- package/dist/system-text.js.map +1 -0
- package/dist/teamView.d.ts.map +1 -1
- package/dist/teamView.js.map +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js.map +1 -1
- package/dist/text-generation.d.ts +3 -0
- package/dist/text-generation.d.ts.map +1 -0
- package/dist/text-generation.js +3 -0
- package/dist/text-generation.js.map +1 -0
- package/dist/threadAnnotation.d.ts.map +1 -1
- package/dist/threadAnnotation.js.map +1 -1
- package/dist/threads.d.ts.map +1 -1
- package/dist/threads.js.map +1 -1
- package/dist/timeline-process.d.ts +32 -0
- package/dist/timeline-process.d.ts.map +1 -1
- package/dist/timeline-process.js.map +1 -1
- package/dist/timeline-row-error.d.ts.map +1 -1
- package/dist/timeline-row-error.js.map +1 -1
- package/dist/tool-display.d.ts.map +1 -1
- package/dist/tool-display.js.map +1 -1
- package/dist/traits-picker.d.ts.map +1 -1
- package/dist/traits-picker.js.map +1 -1
- package/dist/ui-bridge-version.d.ts.map +1 -1
- package/dist/ui-bridge-version.js.map +1 -1
- package/dist/ui-hooks.d.ts +14 -0
- package/dist/ui-hooks.d.ts.map +1 -0
- package/dist/ui-hooks.js +14 -0
- package/dist/ui-hooks.js.map +1 -0
- package/dist/ui-i18n.d.ts +2 -0
- package/dist/ui-i18n.d.ts.map +1 -0
- package/dist/ui-i18n.js +2 -0
- package/dist/ui-i18n.js.map +1 -0
- package/dist/ui-media-query.d.ts +2 -0
- package/dist/ui-media-query.d.ts.map +1 -0
- package/dist/ui-media-query.js +2 -0
- package/dist/ui-media-query.js.map +1 -0
- package/dist/ui-presenter-state.d.ts +2 -0
- package/dist/ui-presenter-state.d.ts.map +1 -0
- package/dist/ui-presenter-state.js +2 -0
- package/dist/ui-presenter-state.js.map +1 -0
- package/dist/ui.d.ts +2 -2
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js.map +1 -1
- package/dist/uiHostCapabilities.d.ts.map +1 -1
- package/dist/uiHostCapabilities.js.map +1 -1
- package/dist/uiMachineAdmission.d.ts.map +1 -1
- package/dist/uiMachineAdmission.js.map +1 -1
- package/dist/uiSessionProjections.d.ts.map +1 -1
- package/dist/uiSessionProjections.js.map +1 -1
- package/dist/usage.d.ts.map +1 -1
- package/dist/usage.js.map +1 -1
- package/dist/version.d.ts +2 -2
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/workspace-path.d.ts +3 -0
- package/dist/workspace-path.d.ts.map +1 -0
- package/dist/workspace-path.js +3 -0
- package/dist/workspace-path.js.map +1 -0
- package/package.json +114 -3
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
export function pendingUserInputOptionValue(option) {
|
|
2
|
+
return option.id ?? option.label;
|
|
3
|
+
}
|
|
4
|
+
/** 原生 ID 不做 trim;只有旧 provider 的显示标签允许输入空白归一化。 */
|
|
5
|
+
export function selectedPendingUserInputOptionValues(question, selected) {
|
|
6
|
+
return Array.from(new Set((selected ?? []).flatMap((value) => {
|
|
7
|
+
const option = question.options.find((candidate) => candidate.id !== undefined ? candidate.id === value : candidate.label === value.trim());
|
|
8
|
+
return option ? [pendingUserInputOptionValue(option)] : [];
|
|
9
|
+
})));
|
|
10
|
+
}
|
|
11
|
+
const DISPLACED_ANSWER_SEPARATOR = "\n\n";
|
|
12
|
+
/**
|
|
13
|
+
* 选项顶替自由作答时,作答里已打的字挪回会话草稿:草稿为空直接用它,否则接在草稿后面
|
|
14
|
+
* 隔一空行;去掉首尾空白,空作答不动草稿。
|
|
15
|
+
*/
|
|
16
|
+
export function carryDisplacedCustomAnswerIntoPrompt(prompt, customAnswer) {
|
|
17
|
+
const displaced = customAnswer?.trim() ?? "";
|
|
18
|
+
if (displaced.length === 0)
|
|
19
|
+
return prompt;
|
|
20
|
+
if (prompt.trim().length === 0)
|
|
21
|
+
return displaced;
|
|
22
|
+
return `${prompt.trimEnd()}${DISPLACED_ANSWER_SEPARATOR}${displaced}`;
|
|
23
|
+
}
|
|
24
|
+
function normalizeDraftAnswer(value) {
|
|
25
|
+
if (typeof value !== "string") {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
const trimmed = value.trim();
|
|
29
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
30
|
+
}
|
|
31
|
+
export function resolvePendingUserInputAnswer(question, draft) {
|
|
32
|
+
if (draft?.attachmentsBlocked)
|
|
33
|
+
return null;
|
|
34
|
+
const customAnswer = normalizeDraftAnswer(draft?.customAnswer);
|
|
35
|
+
if (question.allowFreeform !== false && customAnswer) {
|
|
36
|
+
return customAnswer;
|
|
37
|
+
}
|
|
38
|
+
const selectedOptionLabels = selectedPendingUserInputOptionValues(question, draft?.selectedOptionLabels);
|
|
39
|
+
// 只带附件、没有文字也没选项:答案是空串,文件路径由服务器追加进去。
|
|
40
|
+
const attachmentOnly = question.allowFreeform !== false && (draft?.attachmentCount ?? 0) > 0;
|
|
41
|
+
if (question.multiSelect) {
|
|
42
|
+
return selectedOptionLabels.length > 0 ? selectedOptionLabels : attachmentOnly ? "" : null;
|
|
43
|
+
}
|
|
44
|
+
return selectedOptionLabels[0] ?? (attachmentOnly ? "" : null);
|
|
45
|
+
}
|
|
46
|
+
export function setPendingUserInputCustomAnswer(draft, customAnswer) {
|
|
47
|
+
const selectedOptionLabels = customAnswer.trim().length > 0 ? undefined : draft?.selectedOptionLabels;
|
|
48
|
+
return {
|
|
49
|
+
customAnswer,
|
|
50
|
+
...(selectedOptionLabels && selectedOptionLabels.length > 0 ? { selectedOptionLabels } : {}),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function normalizeSelectedOptionLabels(value) {
|
|
54
|
+
if (!Array.isArray(value))
|
|
55
|
+
return [];
|
|
56
|
+
return Array.from(new Set(value.map((entry) => entry.trim()).filter(Boolean)));
|
|
57
|
+
}
|
|
58
|
+
export function isPendingUserInputOptionSelected(draft, option, allowFreeform = true) {
|
|
59
|
+
if (allowFreeform && normalizeDraftAnswer(draft?.customAnswer))
|
|
60
|
+
return false;
|
|
61
|
+
if (typeof option !== "string" && option.id !== undefined)
|
|
62
|
+
return draft?.selectedOptionLabels?.includes(option.id) ?? false;
|
|
63
|
+
const label = typeof option === "string" ? option : option.label;
|
|
64
|
+
return normalizeSelectedOptionLabels(draft?.selectedOptionLabels).includes(label.trim());
|
|
65
|
+
}
|
|
66
|
+
export function togglePendingUserInputOptionSelection(question, draft, optionLabel) {
|
|
67
|
+
const optionValue = selectedPendingUserInputOptionValues(question, [optionLabel])[0];
|
|
68
|
+
if (optionValue === undefined)
|
|
69
|
+
return draft ?? {};
|
|
70
|
+
if (question.multiSelect) {
|
|
71
|
+
const selectedOptionLabels = selectedPendingUserInputOptionValues(question, draft?.selectedOptionLabels);
|
|
72
|
+
const nextSelectedOptionLabels = selectedOptionLabels.includes(optionValue)
|
|
73
|
+
? selectedOptionLabels.filter((label) => label !== optionValue)
|
|
74
|
+
: [...selectedOptionLabels, optionValue];
|
|
75
|
+
return {
|
|
76
|
+
customAnswer: "",
|
|
77
|
+
...(nextSelectedOptionLabels.length > 0
|
|
78
|
+
? { selectedOptionLabels: nextSelectedOptionLabels }
|
|
79
|
+
: {}),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
customAnswer: "",
|
|
84
|
+
selectedOptionLabels: [optionValue],
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/** 选项顶替自由作答时,把用户已输入的字移回会话草稿。 */
|
|
88
|
+
export function selectPendingUserInputDraftOption(input) {
|
|
89
|
+
const draft = togglePendingUserInputOptionSelection(input.question, input.draft, input.optionValue);
|
|
90
|
+
const displaced = input.draft?.customAnswer;
|
|
91
|
+
return {
|
|
92
|
+
draft,
|
|
93
|
+
composerText: displaced !== undefined && displaced.trim().length > 0 && draft.customAnswer === ""
|
|
94
|
+
? carryDisplacedCustomAnswerIntoPrompt(input.composerText, displaced)
|
|
95
|
+
: input.composerText,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export function buildPendingUserInputAnswers(questions, draftAnswers) {
|
|
99
|
+
const answers = {};
|
|
100
|
+
for (const question of questions) {
|
|
101
|
+
const answer = resolvePendingUserInputAnswer(question, draftAnswers[question.id]);
|
|
102
|
+
if (answer === null) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
answers[question.id] = answer;
|
|
106
|
+
}
|
|
107
|
+
return answers;
|
|
108
|
+
}
|
|
109
|
+
export function countAnsweredPendingUserInputQuestions(questions, draftAnswers) {
|
|
110
|
+
return questions.reduce((count, question) => {
|
|
111
|
+
return resolvePendingUserInputAnswer(question, draftAnswers[question.id]) !== null
|
|
112
|
+
? count + 1
|
|
113
|
+
: count;
|
|
114
|
+
}, 0);
|
|
115
|
+
}
|
|
116
|
+
export function findFirstUnansweredPendingUserInputQuestionIndex(questions, draftAnswers) {
|
|
117
|
+
const unansweredIndex = questions.findIndex((question) => resolvePendingUserInputAnswer(question, draftAnswers[question.id]) === null);
|
|
118
|
+
return unansweredIndex === -1 ? Math.max(questions.length - 1, 0) : unansweredIndex;
|
|
119
|
+
}
|
|
120
|
+
export function derivePendingUserInputProgress(questions, draftAnswers, questionIndex) {
|
|
121
|
+
const normalizedQuestionIndex = questions.length === 0 ? 0 : Math.max(0, Math.min(questionIndex, questions.length - 1));
|
|
122
|
+
const activeQuestion = questions[normalizedQuestionIndex] ?? null;
|
|
123
|
+
const activeDraft = activeQuestion ? draftAnswers[activeQuestion.id] : undefined;
|
|
124
|
+
const resolvedAnswer = activeQuestion
|
|
125
|
+
? resolvePendingUserInputAnswer(activeQuestion, activeDraft)
|
|
126
|
+
: null;
|
|
127
|
+
const customAnswer = activeQuestion?.allowFreeform === false ? "" : (activeDraft?.customAnswer ?? "");
|
|
128
|
+
const answeredQuestionCount = countAnsweredPendingUserInputQuestions(questions, draftAnswers);
|
|
129
|
+
const isLastQuestion = questions.length === 0 ? true : normalizedQuestionIndex >= questions.length - 1;
|
|
130
|
+
return {
|
|
131
|
+
questionIndex: normalizedQuestionIndex,
|
|
132
|
+
activeQuestion,
|
|
133
|
+
activeDraft,
|
|
134
|
+
selectedOptionLabels: activeQuestion
|
|
135
|
+
? selectedPendingUserInputOptionValues(activeQuestion, activeDraft?.selectedOptionLabels)
|
|
136
|
+
: [],
|
|
137
|
+
customAnswer,
|
|
138
|
+
resolvedAnswer,
|
|
139
|
+
usingCustomAnswer: customAnswer.trim().length > 0,
|
|
140
|
+
answeredQuestionCount,
|
|
141
|
+
isLastQuestion,
|
|
142
|
+
isComplete: buildPendingUserInputAnswers(questions, draftAnswers) !== null,
|
|
143
|
+
canAdvance: resolvedAnswer !== null,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 发送时接在用户消息末尾的上下文块的读法:`<terminal_context>`、`<element_context>` 与
|
|
3
|
+
* `<browser_annotation>`。web 写块,web 与 `conversation` 插件的消息行读块并把它们从正文里剥掉。
|
|
4
|
+
*/
|
|
5
|
+
/** 块里的一条:`- 标题:` 一行,下面缩进两格的正文。 */
|
|
6
|
+
export interface ParsedContextEntry {
|
|
7
|
+
header: string;
|
|
8
|
+
body: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ExtractedElementContexts {
|
|
11
|
+
promptText: string;
|
|
12
|
+
contextCount: number;
|
|
13
|
+
contexts: ParsedContextEntry[];
|
|
14
|
+
}
|
|
15
|
+
export interface ExtractedTerminalContexts {
|
|
16
|
+
promptText: string;
|
|
17
|
+
contextCount: number;
|
|
18
|
+
previewTitle: string | null;
|
|
19
|
+
contexts: ParsedContextEntry[];
|
|
20
|
+
}
|
|
21
|
+
export interface DisplayedUserMessageState {
|
|
22
|
+
visibleText: string;
|
|
23
|
+
copyText: string;
|
|
24
|
+
contextCount: number;
|
|
25
|
+
previewTitle: string | null;
|
|
26
|
+
contexts: ParsedContextEntry[];
|
|
27
|
+
/** 末尾 `<element_context>` 块剥出的条目;不进 visibleText。 */
|
|
28
|
+
elementContexts: ParsedContextEntry[];
|
|
29
|
+
}
|
|
30
|
+
export interface ParsedBrowserAnnotation {
|
|
31
|
+
id: string;
|
|
32
|
+
title: string;
|
|
33
|
+
comment: string;
|
|
34
|
+
targetSummary: string;
|
|
35
|
+
styleChanges: string[];
|
|
36
|
+
hasScreenshot: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface ExtractedBrowserAnnotation {
|
|
39
|
+
promptText: string;
|
|
40
|
+
annotation: ParsedBrowserAnnotation | null;
|
|
41
|
+
}
|
|
42
|
+
export declare function normalizeTerminalContextText(text: string): string;
|
|
43
|
+
export declare function hasTerminalContextText(context: {
|
|
44
|
+
text: string;
|
|
45
|
+
}): boolean;
|
|
46
|
+
export declare function isTerminalContextExpired(context: {
|
|
47
|
+
text: string;
|
|
48
|
+
}): boolean;
|
|
49
|
+
/** 正文里的终端引用写法:`@终端名:行` 或 `@终端名:起-止`。 */
|
|
50
|
+
export declare function formatInlineTerminalContextLabel(selection: {
|
|
51
|
+
terminalLabel: string;
|
|
52
|
+
lineStart: number;
|
|
53
|
+
lineEnd: number;
|
|
54
|
+
}): string;
|
|
55
|
+
export declare function extractTrailingElementContexts(prompt: string): ExtractedElementContexts;
|
|
56
|
+
export declare function extractTrailingTerminalContexts(prompt: string): ExtractedTerminalContexts;
|
|
57
|
+
export declare function deriveDisplayedUserMessageState(prompt: string): DisplayedUserMessageState;
|
|
58
|
+
export declare function extractTrailingBrowserAnnotation(prompt: string): ExtractedBrowserAnnotation;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 发送时接在用户消息末尾的上下文块的读法:`<terminal_context>`、`<element_context>` 与
|
|
3
|
+
* `<browser_annotation>`。web 写块,web 与 `conversation` 插件的消息行读块并把它们从正文里剥掉。
|
|
4
|
+
*/
|
|
5
|
+
const TRAILING_TERMINAL_CONTEXT_BLOCK_PATTERN = /\n*<terminal_context>\n([\s\S]*?)\n<\/terminal_context>\s*$/;
|
|
6
|
+
const TRAILING_ELEMENT_CONTEXT_BLOCK_PATTERN = /\n*<element_context>\n([\s\S]*?)\n<\/element_context>\s*$/;
|
|
7
|
+
const TRAILING_BROWSER_ANNOTATION_BLOCK_PATTERN = /\n*<browser_annotation>\n((?:(?!<browser_annotation>)[\s\S])*)\n<\/browser_annotation>\s*$/;
|
|
8
|
+
function parseContextEntries(block) {
|
|
9
|
+
const entries = [];
|
|
10
|
+
let current = null;
|
|
11
|
+
const commit = () => {
|
|
12
|
+
if (!current)
|
|
13
|
+
return;
|
|
14
|
+
entries.push({ header: current.header, body: current.bodyLines.join("\n").trimEnd() });
|
|
15
|
+
current = null;
|
|
16
|
+
};
|
|
17
|
+
for (const line of block.split("\n")) {
|
|
18
|
+
const headerMatch = /^- (.+):$/.exec(line);
|
|
19
|
+
if (headerMatch) {
|
|
20
|
+
commit();
|
|
21
|
+
current = { header: headerMatch[1], bodyLines: [] };
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
if (!current)
|
|
25
|
+
continue;
|
|
26
|
+
if (line.startsWith(" "))
|
|
27
|
+
current.bodyLines.push(line.slice(2));
|
|
28
|
+
else if (line.length === 0)
|
|
29
|
+
current.bodyLines.push("");
|
|
30
|
+
}
|
|
31
|
+
commit();
|
|
32
|
+
return entries;
|
|
33
|
+
}
|
|
34
|
+
export function normalizeTerminalContextText(text) {
|
|
35
|
+
return text.replace(/\r\n/g, "\n").replace(/^\n+|\n+$/g, "");
|
|
36
|
+
}
|
|
37
|
+
export function hasTerminalContextText(context) {
|
|
38
|
+
return normalizeTerminalContextText(context.text).length > 0;
|
|
39
|
+
}
|
|
40
|
+
export function isTerminalContextExpired(context) {
|
|
41
|
+
return !hasTerminalContextText(context);
|
|
42
|
+
}
|
|
43
|
+
/** 正文里的终端引用写法:`@终端名:行` 或 `@终端名:起-止`。 */
|
|
44
|
+
export function formatInlineTerminalContextLabel(selection) {
|
|
45
|
+
const terminalLabel = selection.terminalLabel.trim().toLowerCase().replace(/\s+/g, "-");
|
|
46
|
+
const range = selection.lineStart === selection.lineEnd
|
|
47
|
+
? `${selection.lineStart}`
|
|
48
|
+
: `${selection.lineStart}-${selection.lineEnd}`;
|
|
49
|
+
return `@${terminalLabel}:${range}`;
|
|
50
|
+
}
|
|
51
|
+
export function extractTrailingElementContexts(prompt) {
|
|
52
|
+
const match = TRAILING_ELEMENT_CONTEXT_BLOCK_PATTERN.exec(prompt);
|
|
53
|
+
if (!match) {
|
|
54
|
+
return { promptText: prompt, contextCount: 0, contexts: [] };
|
|
55
|
+
}
|
|
56
|
+
const promptText = prompt.slice(0, match.index).replace(/\n+$/, "");
|
|
57
|
+
const contexts = parseContextEntries(match[1] ?? "");
|
|
58
|
+
return { promptText, contextCount: contexts.length, contexts };
|
|
59
|
+
}
|
|
60
|
+
export function extractTrailingTerminalContexts(prompt) {
|
|
61
|
+
const match = TRAILING_TERMINAL_CONTEXT_BLOCK_PATTERN.exec(prompt);
|
|
62
|
+
if (!match) {
|
|
63
|
+
return { promptText: prompt, contextCount: 0, previewTitle: null, contexts: [] };
|
|
64
|
+
}
|
|
65
|
+
const promptText = prompt.slice(0, match.index).replace(/\n+$/, "");
|
|
66
|
+
const contexts = parseContextEntries(match[1] ?? "");
|
|
67
|
+
return {
|
|
68
|
+
promptText,
|
|
69
|
+
contextCount: contexts.length,
|
|
70
|
+
previewTitle: contexts.length > 0
|
|
71
|
+
? contexts
|
|
72
|
+
.map(({ header, body }) => (body.length > 0 ? `${header}\n${body}` : header))
|
|
73
|
+
.join("\n\n")
|
|
74
|
+
: null,
|
|
75
|
+
contexts,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export function deriveDisplayedUserMessageState(prompt) {
|
|
79
|
+
// 发送时先接 `<terminal_context>`,最后接 `<element_context>`:先剥元素块,终端块才落到末尾。
|
|
80
|
+
const extractedElement = extractTrailingElementContexts(prompt);
|
|
81
|
+
const extractedTerminal = extractTrailingTerminalContexts(extractedElement.promptText);
|
|
82
|
+
return {
|
|
83
|
+
visibleText: extractedTerminal.promptText,
|
|
84
|
+
copyText: prompt,
|
|
85
|
+
contextCount: extractedTerminal.contextCount,
|
|
86
|
+
previewTitle: extractedTerminal.previewTitle,
|
|
87
|
+
contexts: extractedTerminal.contexts,
|
|
88
|
+
elementContexts: extractedElement.contexts,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
export function extractTrailingBrowserAnnotation(prompt) {
|
|
92
|
+
const match = TRAILING_BROWSER_ANNOTATION_BLOCK_PATTERN.exec(prompt);
|
|
93
|
+
if (!match)
|
|
94
|
+
return { promptText: prompt, annotation: null };
|
|
95
|
+
const body = match[1] ?? "";
|
|
96
|
+
const lines = body.split("\n");
|
|
97
|
+
const pageLine = lines.find((line) => line.startsWith("Page: "));
|
|
98
|
+
const idLine = lines.find((line) => line.startsWith("Id: "));
|
|
99
|
+
const commentLine = lines.find((line) => line.startsWith("Comment: "));
|
|
100
|
+
const targetsLine = lines.find((line) => line.startsWith("Targets: "));
|
|
101
|
+
const styleHeadingIndex = lines.indexOf("Requested visual changes:");
|
|
102
|
+
const linesAfterStyleHeading = lines.slice(styleHeadingIndex + 1);
|
|
103
|
+
const elementContextIndex = linesAfterStyleHeading.indexOf("<element_context>");
|
|
104
|
+
const styleChanges = styleHeadingIndex < 0
|
|
105
|
+
? []
|
|
106
|
+
: linesAfterStyleHeading
|
|
107
|
+
.slice(0, elementContextIndex < 0 ? undefined : elementContextIndex)
|
|
108
|
+
.filter((line) => line.startsWith("- "))
|
|
109
|
+
.map((line) => line.slice(2));
|
|
110
|
+
return {
|
|
111
|
+
promptText: prompt.slice(0, match.index).replace(/\n+$/, ""),
|
|
112
|
+
annotation: {
|
|
113
|
+
id: idLine?.slice("Id: ".length).trim() || `${match.index}`,
|
|
114
|
+
title: pageLine?.slice("Page: ".length).trim() || "Browser annotation",
|
|
115
|
+
comment: commentLine?.slice("Comment: ".length).trim() || "",
|
|
116
|
+
targetSummary: targetsLine?.slice("Targets: ".length).trim() || "",
|
|
117
|
+
styleChanges,
|
|
118
|
+
hasScreenshot: body.includes("The attached screenshot is the annotated browser crop."),
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* agent 提的计划(markdown)怎么显示与导出:标题、去掉重复标题后的正文、折叠预览、文件名与下载,
|
|
3
|
+
* 以及按计划起新会话时的提示与标题。web 与 `conversation` 插件共用。
|
|
4
|
+
*/
|
|
5
|
+
export declare function proposedPlanTitle(planMarkdown: string): string | null;
|
|
6
|
+
export declare function stripDisplayedPlanMarkdown(planMarkdown: string): string;
|
|
7
|
+
export declare function buildCollapsedProposedPlanPreviewMarkdown(planMarkdown: string, t: (key: "proposedPlan.previewUnavailable") => string, options?: {
|
|
8
|
+
maxLines?: number;
|
|
9
|
+
}): string;
|
|
10
|
+
export declare function buildPlanImplementationPrompt(planMarkdown: string): string;
|
|
11
|
+
export declare function resolvePlanFollowUpSubmission(input: {
|
|
12
|
+
draftText: string;
|
|
13
|
+
planMarkdown: string;
|
|
14
|
+
}): {
|
|
15
|
+
text: string;
|
|
16
|
+
interactionMode: "default" | "plan";
|
|
17
|
+
};
|
|
18
|
+
export declare function buildPlanImplementationThreadTitle(planMarkdown: string): string;
|
|
19
|
+
export declare function buildProposedPlanMarkdownFilename(planMarkdown: string): string;
|
|
20
|
+
export declare function normalizePlanMarkdownForExport(planMarkdown: string): string;
|
|
21
|
+
export declare function downloadPlanAsTextFile(filename: string, contents: string): void;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// @effect-diagnostics globalTimers:off - 浏览器下载链接用完即撤,不跑在 Effect 运行时里。
|
|
2
|
+
/**
|
|
3
|
+
* agent 提的计划(markdown)怎么显示与导出:标题、去掉重复标题后的正文、折叠预览、文件名与下载,
|
|
4
|
+
* 以及按计划起新会话时的提示与标题。web 与 `conversation` 插件共用。
|
|
5
|
+
*/
|
|
6
|
+
export function proposedPlanTitle(planMarkdown) {
|
|
7
|
+
const heading = planMarkdown.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();
|
|
8
|
+
return heading && heading.length > 0 ? heading : null;
|
|
9
|
+
}
|
|
10
|
+
export function stripDisplayedPlanMarkdown(planMarkdown) {
|
|
11
|
+
const lines = planMarkdown.trimEnd().split(/\r?\n/);
|
|
12
|
+
const sourceLines = lines[0] && /^\s{0,3}#{1,6}\s+/.test(lines[0]) ? lines.slice(1) : [...lines];
|
|
13
|
+
while (sourceLines[0]?.trim().length === 0) {
|
|
14
|
+
sourceLines.shift();
|
|
15
|
+
}
|
|
16
|
+
const firstHeadingMatch = sourceLines[0]?.match(/^\s{0,3}#{1,6}\s+(.+)$/);
|
|
17
|
+
if (firstHeadingMatch?.[1]?.trim().toLowerCase() === "summary") {
|
|
18
|
+
sourceLines.shift();
|
|
19
|
+
while (sourceLines[0]?.trim().length === 0) {
|
|
20
|
+
sourceLines.shift();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return sourceLines.join("\n");
|
|
24
|
+
}
|
|
25
|
+
export function buildCollapsedProposedPlanPreviewMarkdown(planMarkdown, t, options) {
|
|
26
|
+
const maxLines = options?.maxLines ?? 8;
|
|
27
|
+
const lines = stripDisplayedPlanMarkdown(planMarkdown)
|
|
28
|
+
.trimEnd()
|
|
29
|
+
.split(/\r?\n/)
|
|
30
|
+
.map((line) => line.trimEnd());
|
|
31
|
+
const previewLines = [];
|
|
32
|
+
let visibleLineCount = 0;
|
|
33
|
+
let hasMoreContent = false;
|
|
34
|
+
for (const line of lines) {
|
|
35
|
+
const isVisibleLine = line.trim().length > 0;
|
|
36
|
+
if (isVisibleLine && visibleLineCount >= maxLines) {
|
|
37
|
+
hasMoreContent = true;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
previewLines.push(line);
|
|
41
|
+
if (isVisibleLine) {
|
|
42
|
+
visibleLineCount += 1;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
while (previewLines.length > 0 && previewLines.at(-1)?.trim().length === 0) {
|
|
46
|
+
previewLines.pop();
|
|
47
|
+
}
|
|
48
|
+
if (previewLines.length === 0) {
|
|
49
|
+
return proposedPlanTitle(planMarkdown) ?? t("proposedPlan.previewUnavailable");
|
|
50
|
+
}
|
|
51
|
+
if (hasMoreContent) {
|
|
52
|
+
previewLines.push("", "...");
|
|
53
|
+
}
|
|
54
|
+
return previewLines.join("\n");
|
|
55
|
+
}
|
|
56
|
+
function sanitizePlanFileSegment(input) {
|
|
57
|
+
const sanitized = input
|
|
58
|
+
.toLowerCase()
|
|
59
|
+
.replace(/[`'".,!?()[\]{}]+/g, "")
|
|
60
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
61
|
+
.replace(/^-+|-+$/g, "");
|
|
62
|
+
return sanitized.length > 0 ? sanitized : "plan";
|
|
63
|
+
}
|
|
64
|
+
export function buildPlanImplementationPrompt(planMarkdown) {
|
|
65
|
+
return `PLEASE IMPLEMENT THIS PLAN:\n${planMarkdown.trim()}`;
|
|
66
|
+
}
|
|
67
|
+
export function resolvePlanFollowUpSubmission(input) {
|
|
68
|
+
const trimmedDraftText = input.draftText.trim();
|
|
69
|
+
if (trimmedDraftText.length > 0) {
|
|
70
|
+
return {
|
|
71
|
+
text: trimmedDraftText,
|
|
72
|
+
interactionMode: "plan",
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
text: buildPlanImplementationPrompt(input.planMarkdown),
|
|
77
|
+
interactionMode: "default",
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
export function buildPlanImplementationThreadTitle(planMarkdown) {
|
|
81
|
+
const title = proposedPlanTitle(planMarkdown);
|
|
82
|
+
if (!title) {
|
|
83
|
+
return "Implement plan";
|
|
84
|
+
}
|
|
85
|
+
return `Implement ${title}`;
|
|
86
|
+
}
|
|
87
|
+
export function buildProposedPlanMarkdownFilename(planMarkdown) {
|
|
88
|
+
const title = proposedPlanTitle(planMarkdown);
|
|
89
|
+
return `${sanitizePlanFileSegment(title ?? "plan")}.md`;
|
|
90
|
+
}
|
|
91
|
+
export function normalizePlanMarkdownForExport(planMarkdown) {
|
|
92
|
+
return `${planMarkdown.trimEnd()}\n`;
|
|
93
|
+
}
|
|
94
|
+
export function downloadPlanAsTextFile(filename, contents) {
|
|
95
|
+
// The shared composer also typechecks in hosts that compile without DOM declarations.
|
|
96
|
+
const { document } = globalThis;
|
|
97
|
+
const blob = new Blob([contents], { type: "text/markdown;charset=utf-8" });
|
|
98
|
+
const url = URL.createObjectURL(blob);
|
|
99
|
+
const anchor = document.createElement("a");
|
|
100
|
+
anchor.href = url;
|
|
101
|
+
anchor.download = filename;
|
|
102
|
+
anchor.click();
|
|
103
|
+
globalThis.setTimeout(() => {
|
|
104
|
+
URL.revokeObjectURL(url);
|
|
105
|
+
}, 0);
|
|
106
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/** `$` 技能菜单的打分与排序:只列用户能起的技能,按名字、显示名、说明、scope 分档。 */
|
|
2
|
+
import { formatProviderSkillDisplayName } from "./providerSkills.js";
|
|
3
|
+
import { insertRankedSearchResult, normalizeSearchQuery, scoreQueryMatch, } from "./searchRanking.js";
|
|
4
|
+
import { isProviderSkillUserInvocable } from "./skillTokens.js";
|
|
5
|
+
function scoreProviderSkill(skill, query) {
|
|
6
|
+
const normalizedName = skill.name.toLowerCase();
|
|
7
|
+
const normalizedLabel = formatProviderSkillDisplayName(skill).toLowerCase();
|
|
8
|
+
const normalizedShortDescription = skill.shortDescription?.toLowerCase() ?? "";
|
|
9
|
+
const normalizedDescription = skill.description?.toLowerCase() ?? "";
|
|
10
|
+
const normalizedScope = skill.scope?.toLowerCase() ?? "";
|
|
11
|
+
const scores = [
|
|
12
|
+
scoreQueryMatch({
|
|
13
|
+
value: normalizedName,
|
|
14
|
+
query,
|
|
15
|
+
exactBase: 0,
|
|
16
|
+
prefixBase: 2,
|
|
17
|
+
boundaryBase: 4,
|
|
18
|
+
includesBase: 6,
|
|
19
|
+
fuzzyBase: 100,
|
|
20
|
+
boundaryMarkers: ["-", "_", "/"],
|
|
21
|
+
}),
|
|
22
|
+
scoreQueryMatch({
|
|
23
|
+
value: normalizedLabel,
|
|
24
|
+
query,
|
|
25
|
+
exactBase: 1,
|
|
26
|
+
prefixBase: 3,
|
|
27
|
+
boundaryBase: 5,
|
|
28
|
+
includesBase: 7,
|
|
29
|
+
fuzzyBase: 110,
|
|
30
|
+
}),
|
|
31
|
+
scoreQueryMatch({
|
|
32
|
+
value: normalizedShortDescription,
|
|
33
|
+
query,
|
|
34
|
+
exactBase: 20,
|
|
35
|
+
prefixBase: 22,
|
|
36
|
+
boundaryBase: 24,
|
|
37
|
+
includesBase: 26,
|
|
38
|
+
}),
|
|
39
|
+
scoreQueryMatch({
|
|
40
|
+
value: normalizedDescription,
|
|
41
|
+
query,
|
|
42
|
+
exactBase: 30,
|
|
43
|
+
prefixBase: 32,
|
|
44
|
+
boundaryBase: 34,
|
|
45
|
+
includesBase: 36,
|
|
46
|
+
}),
|
|
47
|
+
scoreQueryMatch({
|
|
48
|
+
value: normalizedScope,
|
|
49
|
+
query,
|
|
50
|
+
exactBase: 40,
|
|
51
|
+
prefixBase: 42,
|
|
52
|
+
includesBase: 44,
|
|
53
|
+
}),
|
|
54
|
+
].filter((score) => score !== null);
|
|
55
|
+
if (scores.length === 0) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
return Math.min(...scores);
|
|
59
|
+
}
|
|
60
|
+
export function searchProviderSkills(skills, query, limit = Number.POSITIVE_INFINITY) {
|
|
61
|
+
const enabledSkills = skills.filter(isProviderSkillUserInvocable);
|
|
62
|
+
const normalizedQuery = normalizeSearchQuery(query, { trimLeadingPattern: /^\$+/ });
|
|
63
|
+
if (!normalizedQuery) {
|
|
64
|
+
return enabledSkills;
|
|
65
|
+
}
|
|
66
|
+
const ranked = [];
|
|
67
|
+
for (const skill of enabledSkills) {
|
|
68
|
+
const score = scoreProviderSkill(skill, normalizedQuery);
|
|
69
|
+
if (score === null) {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
insertRankedSearchResult(ranked, {
|
|
73
|
+
item: skill,
|
|
74
|
+
score,
|
|
75
|
+
tieBreaker: `${formatProviderSkillDisplayName(skill).toLowerCase()}\0${skill.name}`,
|
|
76
|
+
}, limit);
|
|
77
|
+
}
|
|
78
|
+
return ranked.map((entry) => entry.item);
|
|
79
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface ProviderSkillFields {
|
|
2
|
+
readonly name: string;
|
|
3
|
+
readonly displayName?: string | undefined;
|
|
4
|
+
readonly shortDescription?: string | undefined;
|
|
5
|
+
readonly description?: string | undefined;
|
|
6
|
+
readonly path: string;
|
|
7
|
+
readonly scope?: string | undefined;
|
|
8
|
+
readonly enabled: boolean;
|
|
9
|
+
readonly userInvocable?: boolean | undefined;
|
|
10
|
+
}
|
|
11
|
+
export type ProviderSkillSourceKind = "app" | "repo" | "project" | "personal" | "system" | "other";
|
|
12
|
+
export declare function formatProviderSkillDisplayName(skill: Pick<ProviderSkillFields, "name" | "displayName">): string;
|
|
13
|
+
export declare function getProviderSkillsForSlashMenu<S extends ProviderSkillFields>(skills: ReadonlyArray<S>, showSkillsInSlashMenu: boolean): S[];
|
|
14
|
+
export declare function getProviderSlashCommandsForSlashMenu<C extends {
|
|
15
|
+
readonly name: string;
|
|
16
|
+
}>(slashCommands: ReadonlyArray<C>, visibleSkills: ReadonlyArray<Pick<ProviderSkillFields, "name">>): C[];
|
|
17
|
+
export declare function resolveProviderSkillSourceKind(skill: Pick<ProviderSkillFields, "path" | "scope">): ProviderSkillSourceKind;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* provider 技能在输入区菜单里的写法:显示名、斜杠菜单的取舍、来源分类。web、mobile 与
|
|
3
|
+
* `conversation` 插件共用;技能只按这里列出的字段读,contracts 与插件 API 的技能类型都满足。
|
|
4
|
+
*/
|
|
5
|
+
import { isProviderSkillUserInvocable } from "./skillTokens.js";
|
|
6
|
+
function titleCaseWords(value) {
|
|
7
|
+
const words = [];
|
|
8
|
+
for (const segment of value.split(/[\s:_-]+/)) {
|
|
9
|
+
if (segment.length === 0)
|
|
10
|
+
continue;
|
|
11
|
+
words.push(segment.charAt(0).toUpperCase() + segment.slice(1));
|
|
12
|
+
}
|
|
13
|
+
return words.join(" ");
|
|
14
|
+
}
|
|
15
|
+
function normalizePathSeparators(pathValue) {
|
|
16
|
+
return pathValue.replaceAll("\\", "/");
|
|
17
|
+
}
|
|
18
|
+
export function formatProviderSkillDisplayName(skill) {
|
|
19
|
+
const displayName = skill.displayName?.trim();
|
|
20
|
+
if (displayName) {
|
|
21
|
+
return displayName;
|
|
22
|
+
}
|
|
23
|
+
return titleCaseWords(skill.name);
|
|
24
|
+
}
|
|
25
|
+
export function getProviderSkillsForSlashMenu(skills, showSkillsInSlashMenu) {
|
|
26
|
+
return showSkillsInSlashMenu ? skills.filter(isProviderSkillUserInvocable) : [];
|
|
27
|
+
}
|
|
28
|
+
export function getProviderSlashCommandsForSlashMenu(slashCommands, visibleSkills) {
|
|
29
|
+
const skillNames = new Set(visibleSkills.map((skill) => skill.name.trim().toLowerCase()));
|
|
30
|
+
return slashCommands.filter((command) => !skillNames.has(command.name.trim().toLowerCase()));
|
|
31
|
+
}
|
|
32
|
+
export function resolveProviderSkillSourceKind(skill) {
|
|
33
|
+
const normalizedPath = normalizePathSeparators(skill.path);
|
|
34
|
+
if (normalizedPath.includes("/.codex/plugins/") || normalizedPath.includes("/.agents/plugins/")) {
|
|
35
|
+
return "app";
|
|
36
|
+
}
|
|
37
|
+
const normalizedScope = skill.scope?.trim().toLowerCase();
|
|
38
|
+
switch (normalizedScope) {
|
|
39
|
+
case "repo":
|
|
40
|
+
case "repository":
|
|
41
|
+
return "repo";
|
|
42
|
+
case "project":
|
|
43
|
+
case "workspace":
|
|
44
|
+
case "local":
|
|
45
|
+
return "project";
|
|
46
|
+
case "user":
|
|
47
|
+
case "personal":
|
|
48
|
+
return "personal";
|
|
49
|
+
case "system":
|
|
50
|
+
return "system";
|
|
51
|
+
case undefined:
|
|
52
|
+
case "":
|
|
53
|
+
return "other";
|
|
54
|
+
default:
|
|
55
|
+
return "other";
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** 排队条目在各界面上共用的读法:能不能改、行内正文取哪一行、唤醒时间怎么写、来源标记读哪个 key。 */
|
|
2
|
+
/**
|
|
3
|
+
* 只有你的消息和定时唤醒能改、能拖;其余来源与没有来源的旧条目只能取消。定时唤醒被宿主并进别的通知后,
|
|
4
|
+
* 服务器不再给修改权,也按只能取消来画。
|
|
5
|
+
*/
|
|
6
|
+
export declare function isLockedQueueEntry(entry: {
|
|
7
|
+
readonly source?: {
|
|
8
|
+
readonly kind: string;
|
|
9
|
+
} | undefined;
|
|
10
|
+
readonly management?: unknown;
|
|
11
|
+
}): boolean;
|
|
12
|
+
/** 正文的第一行非空文字(去掉两端空白);没有就是空串。 */
|
|
13
|
+
export declare const firstQueueLine: (text: string | null) => string;
|
|
14
|
+
/** 同一天只写钟点;别的日子带上日期。`locale` 不给就按运行环境的默认语言。 */
|
|
15
|
+
export declare function formatQueueWakeTime(iso: string, locale?: string): string;
|
|
16
|
+
/** 行首类型标记的文案 key,按来源种类;文案表只存 key,各界面经 hook 解析。 */
|
|
17
|
+
export declare const QUEUE_SOURCE_LABEL_KEY: {
|
|
18
|
+
readonly user: "turnQueue.sourceUser";
|
|
19
|
+
readonly schedule: "turnQueue.sourceSchedule";
|
|
20
|
+
readonly "scheduled-wake": "turnQueue.sourceScheduledWake";
|
|
21
|
+
readonly record: "turnQueue.sourceSession";
|
|
22
|
+
readonly session: "turnQueue.sourceSession";
|
|
23
|
+
readonly reply: "turnQueue.sourceReply";
|
|
24
|
+
readonly "child-report": "turnQueue.sourceChildReport";
|
|
25
|
+
readonly "plugin-wake": "turnQueue.sourcePluginWake";
|
|
26
|
+
readonly "board-dispatch": "turnQueue.sourceBoardDispatch";
|
|
27
|
+
readonly "plugin-notice": "turnQueue.sourcePluginNotice";
|
|
28
|
+
readonly "home-machine": "turnQueue.sourceHomeMachine";
|
|
29
|
+
readonly "restart-resume": "turnQueue.sourceRestartResume";
|
|
30
|
+
readonly "remote-post": "turnQueue.sourceRemotePost";
|
|
31
|
+
};
|