@lingya-ai/agents-sdk 0.1.2
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/LICENSE +21 -0
- package/README.md +45 -0
- package/dist/apis/ChatApi.d.ts +182 -0
- package/dist/apis/ChatApi.js +411 -0
- package/dist/apis/ConfigurationApi.d.ts +62 -0
- package/dist/apis/ConfigurationApi.js +148 -0
- package/dist/apis/ConversationsApi.d.ts +403 -0
- package/dist/apis/ConversationsApi.js +914 -0
- package/dist/apis/EventsApi.d.ts +70 -0
- package/dist/apis/EventsApi.js +161 -0
- package/dist/apis/FilesApi.d.ts +174 -0
- package/dist/apis/FilesApi.js +409 -0
- package/dist/apis/InteractionsApi.d.ts +122 -0
- package/dist/apis/InteractionsApi.js +286 -0
- package/dist/apis/KnowledgeApi.d.ts +70 -0
- package/dist/apis/KnowledgeApi.js +157 -0
- package/dist/apis/MessagesApi.d.ts +236 -0
- package/dist/apis/MessagesApi.js +413 -0
- package/dist/apis/SQLApi.d.ts +126 -0
- package/dist/apis/SQLApi.js +246 -0
- package/dist/apis/WorkspaceApi.d.ts +115 -0
- package/dist/apis/WorkspaceApi.js +194 -0
- package/dist/apis/index.d.ts +10 -0
- package/dist/apis/index.js +28 -0
- package/dist/client.d.ts +116 -0
- package/dist/client.js +201 -0
- package/dist/esm/apis/ChatApi.d.ts +182 -0
- package/dist/esm/apis/ChatApi.js +407 -0
- package/dist/esm/apis/ConfigurationApi.d.ts +62 -0
- package/dist/esm/apis/ConfigurationApi.js +144 -0
- package/dist/esm/apis/ConversationsApi.d.ts +403 -0
- package/dist/esm/apis/ConversationsApi.js +910 -0
- package/dist/esm/apis/EventsApi.d.ts +70 -0
- package/dist/esm/apis/EventsApi.js +157 -0
- package/dist/esm/apis/FilesApi.d.ts +174 -0
- package/dist/esm/apis/FilesApi.js +405 -0
- package/dist/esm/apis/InteractionsApi.d.ts +122 -0
- package/dist/esm/apis/InteractionsApi.js +282 -0
- package/dist/esm/apis/KnowledgeApi.d.ts +70 -0
- package/dist/esm/apis/KnowledgeApi.js +153 -0
- package/dist/esm/apis/MessagesApi.d.ts +236 -0
- package/dist/esm/apis/MessagesApi.js +409 -0
- package/dist/esm/apis/SQLApi.d.ts +126 -0
- package/dist/esm/apis/SQLApi.js +242 -0
- package/dist/esm/apis/WorkspaceApi.d.ts +115 -0
- package/dist/esm/apis/WorkspaceApi.js +190 -0
- package/dist/esm/apis/index.d.ts +10 -0
- package/dist/esm/apis/index.js +12 -0
- package/dist/esm/client.d.ts +116 -0
- package/dist/esm/client.js +195 -0
- package/dist/esm/events.d.ts +21 -0
- package/dist/esm/events.js +33 -0
- package/dist/esm/hmac.d.ts +25 -0
- package/dist/esm/hmac.js +63 -0
- package/dist/esm/index.d.ts +7 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/models/AgentFile.d.ts +50 -0
- package/dist/esm/models/AgentFile.js +64 -0
- package/dist/esm/models/AgentsConfig.d.ts +40 -0
- package/dist/esm/models/AgentsConfig.js +53 -0
- package/dist/esm/models/AiChatAwaitingInputBriefEvent.d.ts +74 -0
- package/dist/esm/models/AiChatAwaitingInputBriefEvent.js +87 -0
- package/dist/esm/models/AiChatBriefEvent.d.ts +66 -0
- package/dist/esm/models/AiChatBriefEvent.js +112 -0
- package/dist/esm/models/AiChatBriefEventList.d.ts +31 -0
- package/dist/esm/models/AiChatBriefEventList.js +44 -0
- package/dist/esm/models/AiChatCompactorWarningBriefEvent.d.ts +45 -0
- package/dist/esm/models/AiChatCompactorWarningBriefEvent.js +59 -0
- package/dist/esm/models/AiChatCompressorContextEndBriefEvent.d.ts +37 -0
- package/dist/esm/models/AiChatCompressorContextEndBriefEvent.js +51 -0
- package/dist/esm/models/AiChatCompressorContextStartBriefEvent.d.ts +37 -0
- package/dist/esm/models/AiChatCompressorContextStartBriefEvent.js +51 -0
- package/dist/esm/models/AiChatEndBriefEvent.d.ts +65 -0
- package/dist/esm/models/AiChatEndBriefEvent.js +75 -0
- package/dist/esm/models/AiChatErrorBriefEvent.d.ts +41 -0
- package/dist/esm/models/AiChatErrorBriefEvent.js +55 -0
- package/dist/esm/models/AiChatEventsBatch.d.ts +36 -0
- package/dist/esm/models/AiChatEventsBatch.js +49 -0
- package/dist/esm/models/AiChatEventsBatchInput.d.ts +34 -0
- package/dist/esm/models/AiChatEventsBatchInput.js +47 -0
- package/dist/esm/models/AiChatEventsBatchSkipped.d.ts +34 -0
- package/dist/esm/models/AiChatEventsBatchSkipped.js +47 -0
- package/dist/esm/models/AiChatFileRef.d.ts +34 -0
- package/dist/esm/models/AiChatFileRef.js +45 -0
- package/dist/esm/models/AiChatInput.d.ts +44 -0
- package/dist/esm/models/AiChatInput.js +51 -0
- package/dist/esm/models/AiChatManualInterruptBriefEvent.d.ts +37 -0
- package/dist/esm/models/AiChatManualInterruptBriefEvent.js +51 -0
- package/dist/esm/models/AiChatMessageBriefEvent.d.ts +41 -0
- package/dist/esm/models/AiChatMessageBriefEvent.js +55 -0
- package/dist/esm/models/AiChatMessageEvent.d.ts +35 -0
- package/dist/esm/models/AiChatMessageEvent.js +48 -0
- package/dist/esm/models/AiChatRequestBriefEvent.d.ts +47 -0
- package/dist/esm/models/AiChatRequestBriefEvent.js +59 -0
- package/dist/esm/models/AiChatResponseBriefEvent.d.ts +47 -0
- package/dist/esm/models/AiChatResponseBriefEvent.js +61 -0
- package/dist/esm/models/AiChatStartBriefEvent.d.ts +37 -0
- package/dist/esm/models/AiChatStartBriefEvent.js +51 -0
- package/dist/esm/models/AiChatStreamInput.d.ts +30 -0
- package/dist/esm/models/AiChatStreamInput.js +43 -0
- package/dist/esm/models/AiChatSubAgentCallBriefEvent.d.ts +53 -0
- package/dist/esm/models/AiChatSubAgentCallBriefEvent.js +67 -0
- package/dist/esm/models/AiChatSubmission.d.ts +42 -0
- package/dist/esm/models/AiChatSubmission.js +55 -0
- package/dist/esm/models/AiChatThinkBriefEvent.d.ts +41 -0
- package/dist/esm/models/AiChatThinkBriefEvent.js +55 -0
- package/dist/esm/models/AiChatToolExecutionBriefEvent.d.ts +62 -0
- package/dist/esm/models/AiChatToolExecutionBriefEvent.js +72 -0
- package/dist/esm/models/AiChatUserQueryBriefEvent.d.ts +46 -0
- package/dist/esm/models/AiChatUserQueryBriefEvent.js +58 -0
- package/dist/esm/models/ArtifactInfo.d.ts +58 -0
- package/dist/esm/models/ArtifactInfo.js +69 -0
- package/dist/esm/models/AskUserQuestionExtensionContent.d.ts +34 -0
- package/dist/esm/models/AskUserQuestionExtensionContent.js +45 -0
- package/dist/esm/models/AskUserQuestionExtensionToolExtension.d.ts +46 -0
- package/dist/esm/models/AskUserQuestionExtensionToolExtension.js +60 -0
- package/dist/esm/models/AskUserQuestionOption.d.ts +34 -0
- package/dist/esm/models/AskUserQuestionOption.js +47 -0
- package/dist/esm/models/AssistantChatMessage.d.ts +54 -0
- package/dist/esm/models/AssistantChatMessage.js +62 -0
- package/dist/esm/models/AsyncTask.d.ts +126 -0
- package/dist/esm/models/AsyncTask.js +120 -0
- package/dist/esm/models/AsyncTaskPage.d.ts +36 -0
- package/dist/esm/models/AsyncTaskPage.js +49 -0
- package/dist/esm/models/AttachmentExtension.d.ts +34 -0
- package/dist/esm/models/AttachmentExtension.js +47 -0
- package/dist/esm/models/BooleanChartColumn.d.ts +45 -0
- package/dist/esm/models/BooleanChartColumn.js +59 -0
- package/dist/esm/models/ChartColumnData.d.ts +50 -0
- package/dist/esm/models/ChartColumnData.js +86 -0
- package/dist/esm/models/ChartNumberFormat.d.ts +42 -0
- package/dist/esm/models/ChartNumberFormat.js +51 -0
- package/dist/esm/models/ChartQualitySummary.d.ts +38 -0
- package/dist/esm/models/ChartQualitySummary.js +51 -0
- package/dist/esm/models/ChartSeries.d.ts +68 -0
- package/dist/esm/models/ChartSeries.js +77 -0
- package/dist/esm/models/ChartSpec.d.ts +115 -0
- package/dist/esm/models/ChartSpec.js +121 -0
- package/dist/esm/models/ChartTimeContext.d.ts +34 -0
- package/dist/esm/models/ChartTimeContext.js +48 -0
- package/dist/esm/models/ChatMessage.d.ts +33 -0
- package/dist/esm/models/ChatMessage.js +57 -0
- package/dist/esm/models/ChatModelConfig.d.ts +62 -0
- package/dist/esm/models/ChatModelConfig.js +75 -0
- package/dist/esm/models/ChatModelSpec.d.ts +66 -0
- package/dist/esm/models/ChatModelSpec.js +63 -0
- package/dist/esm/models/ChatOptions.d.ts +54 -0
- package/dist/esm/models/ChatOptions.js +53 -0
- package/dist/esm/models/ChatStreamProbeEvent.d.ts +38 -0
- package/dist/esm/models/ChatStreamProbeEvent.js +51 -0
- package/dist/esm/models/ChatStreamProbeInput.d.ts +30 -0
- package/dist/esm/models/ChatStreamProbeInput.js +43 -0
- package/dist/esm/models/CitationMetadata.d.ts +42 -0
- package/dist/esm/models/CitationMetadata.js +51 -0
- package/dist/esm/models/CitationMetadataList.d.ts +31 -0
- package/dist/esm/models/CitationMetadataList.js +44 -0
- package/dist/esm/models/CodeMessage.d.ts +34 -0
- package/dist/esm/models/CodeMessage.js +47 -0
- package/dist/esm/models/ConfirmUploadInput.d.ts +34 -0
- package/dist/esm/models/ConfirmUploadInput.js +47 -0
- package/dist/esm/models/ConversationActivity.d.ts +62 -0
- package/dist/esm/models/ConversationActivity.js +66 -0
- package/dist/esm/models/ConversationActivityBatchInput.d.ts +30 -0
- package/dist/esm/models/ConversationActivityBatchInput.js +43 -0
- package/dist/esm/models/ConversationActivityList.d.ts +31 -0
- package/dist/esm/models/ConversationActivityList.js +44 -0
- package/dist/esm/models/ConversationConfig.d.ts +31 -0
- package/dist/esm/models/ConversationConfig.js +42 -0
- package/dist/esm/models/ConversationContextUsage.d.ts +74 -0
- package/dist/esm/models/ConversationContextUsage.js +83 -0
- package/dist/esm/models/ConversationIds.d.ts +30 -0
- package/dist/esm/models/ConversationIds.js +43 -0
- package/dist/esm/models/ConversationMessage.d.ts +84 -0
- package/dist/esm/models/ConversationMessage.js +96 -0
- package/dist/esm/models/ConversationMessagePage.d.ts +36 -0
- package/dist/esm/models/ConversationMessagePage.js +49 -0
- package/dist/esm/models/ConversationReadReceipt.d.ts +58 -0
- package/dist/esm/models/ConversationReadReceipt.js +62 -0
- package/dist/esm/models/ConversationReadReceiptInput.d.ts +30 -0
- package/dist/esm/models/ConversationReadReceiptInput.js +43 -0
- package/dist/esm/models/ConversationShareCreated.d.ts +46 -0
- package/dist/esm/models/ConversationShareCreated.js +58 -0
- package/dist/esm/models/ConversationShareInput.d.ts +34 -0
- package/dist/esm/models/ConversationShareInput.js +44 -0
- package/dist/esm/models/ConversationShareList.d.ts +31 -0
- package/dist/esm/models/ConversationShareList.js +44 -0
- package/dist/esm/models/ConversationShareRecord.d.ts +58 -0
- package/dist/esm/models/ConversationShareRecord.js +70 -0
- package/dist/esm/models/ConversationShareRevoked.d.ts +30 -0
- package/dist/esm/models/ConversationShareRevoked.js +43 -0
- package/dist/esm/models/ConversationStats.d.ts +50 -0
- package/dist/esm/models/ConversationStats.js +63 -0
- package/dist/esm/models/ConversationStatusInput.d.ts +30 -0
- package/dist/esm/models/ConversationStatusInput.js +43 -0
- package/dist/esm/models/ConversationSummary.d.ts +75 -0
- package/dist/esm/models/ConversationSummary.js +87 -0
- package/dist/esm/models/ConversationSummaryList.d.ts +31 -0
- package/dist/esm/models/ConversationSummaryList.js +44 -0
- package/dist/esm/models/ConversationTitle.d.ts +38 -0
- package/dist/esm/models/ConversationTitle.js +49 -0
- package/dist/esm/models/ConversationTitleInput.d.ts +30 -0
- package/dist/esm/models/ConversationTitleInput.js +43 -0
- package/dist/esm/models/ConversationUserMessage.d.ts +59 -0
- package/dist/esm/models/ConversationUserMessage.js +67 -0
- package/dist/esm/models/CreateFileInput.d.ts +34 -0
- package/dist/esm/models/CreateFileInput.js +47 -0
- package/dist/esm/models/DecimalChartColumn.d.ts +45 -0
- package/dist/esm/models/DecimalChartColumn.js +59 -0
- package/dist/esm/models/DefaultModel.d.ts +34 -0
- package/dist/esm/models/DefaultModel.js +47 -0
- package/dist/esm/models/DoubleChartColumn.d.ts +45 -0
- package/dist/esm/models/DoubleChartColumn.js +59 -0
- package/dist/esm/models/FieldError.d.ts +34 -0
- package/dist/esm/models/FieldError.js +47 -0
- package/dist/esm/models/FileExists.d.ts +30 -0
- package/dist/esm/models/FileExists.js +43 -0
- package/dist/esm/models/GeneratePreSignedUrlInput.d.ts +49 -0
- package/dist/esm/models/GeneratePreSignedUrlInput.js +61 -0
- package/dist/esm/models/GeneratePreSignedUrlOutput.d.ts +38 -0
- package/dist/esm/models/GeneratePreSignedUrlOutput.js +47 -0
- package/dist/esm/models/ImageGenerationExtensionContent.d.ts +30 -0
- package/dist/esm/models/ImageGenerationExtensionContent.js +43 -0
- package/dist/esm/models/ImageGenerationExtensionToolExtension.d.ts +46 -0
- package/dist/esm/models/ImageGenerationExtensionToolExtension.js +60 -0
- package/dist/esm/models/InputTokenBreakdown.d.ts +42 -0
- package/dist/esm/models/InputTokenBreakdown.js +53 -0
- package/dist/esm/models/InstantChartColumn.d.ts +45 -0
- package/dist/esm/models/InstantChartColumn.js +59 -0
- package/dist/esm/models/IntegerChartColumn.d.ts +46 -0
- package/dist/esm/models/IntegerChartColumn.js +58 -0
- package/dist/esm/models/JsRunScriptExtensionContent.d.ts +30 -0
- package/dist/esm/models/JsRunScriptExtensionContent.js +43 -0
- package/dist/esm/models/JsRunScriptExtensionToolExtension.d.ts +46 -0
- package/dist/esm/models/JsRunScriptExtensionToolExtension.js +60 -0
- package/dist/esm/models/JsRunScriptResultExtensionContent.d.ts +34 -0
- package/dist/esm/models/JsRunScriptResultExtensionContent.js +45 -0
- package/dist/esm/models/JsRunScriptResultExtensionToolExtension.d.ts +46 -0
- package/dist/esm/models/JsRunScriptResultExtensionToolExtension.js +60 -0
- package/dist/esm/models/LocalDateChartColumn.d.ts +45 -0
- package/dist/esm/models/LocalDateChartColumn.js +59 -0
- package/dist/esm/models/LocalDateTimeChartColumn.d.ts +45 -0
- package/dist/esm/models/LocalDateTimeChartColumn.js +59 -0
- package/dist/esm/models/LocalTimeChartColumn.d.ts +45 -0
- package/dist/esm/models/LocalTimeChartColumn.js +59 -0
- package/dist/esm/models/MathFormulaExtensionContent.d.ts +35 -0
- package/dist/esm/models/MathFormulaExtensionContent.js +46 -0
- package/dist/esm/models/MathFormulaExtensionToolExtension.d.ts +46 -0
- package/dist/esm/models/MathFormulaExtensionToolExtension.js +60 -0
- package/dist/esm/models/MathResultExtensionContent.d.ts +30 -0
- package/dist/esm/models/MathResultExtensionContent.js +43 -0
- package/dist/esm/models/MathResultExtensionToolExtension.d.ts +46 -0
- package/dist/esm/models/MathResultExtensionToolExtension.js +60 -0
- package/dist/esm/models/MediaAttachment.d.ts +46 -0
- package/dist/esm/models/MediaAttachment.js +59 -0
- package/dist/esm/models/ModelConfig.d.ts +36 -0
- package/dist/esm/models/ModelConfig.js +49 -0
- package/dist/esm/models/ModelKeyGroup.d.ts +39 -0
- package/dist/esm/models/ModelKeyGroup.js +52 -0
- package/dist/esm/models/MultimodalMediaAttachment.d.ts +38 -0
- package/dist/esm/models/MultimodalMediaAttachment.js +51 -0
- package/dist/esm/models/OperationResult.d.ts +34 -0
- package/dist/esm/models/OperationResult.js +45 -0
- package/dist/esm/models/PageInfo.d.ts +38 -0
- package/dist/esm/models/PageInfo.js +51 -0
- package/dist/esm/models/PlanApprovalExtensionContent.d.ts +38 -0
- package/dist/esm/models/PlanApprovalExtensionContent.js +52 -0
- package/dist/esm/models/PlanApprovalExtensionToolExtension.d.ts +46 -0
- package/dist/esm/models/PlanApprovalExtensionToolExtension.js +60 -0
- package/dist/esm/models/PlanApprovalInput.d.ts +42 -0
- package/dist/esm/models/PlanApprovalInput.js +53 -0
- package/dist/esm/models/PlanStatus.d.ts +34 -0
- package/dist/esm/models/PlanStatus.js +47 -0
- package/dist/esm/models/PreSignedReadUrl.d.ts +30 -0
- package/dist/esm/models/PreSignedReadUrl.js +43 -0
- package/dist/esm/models/ReturnedReference.d.ts +34 -0
- package/dist/esm/models/ReturnedReference.js +47 -0
- package/dist/esm/models/SkillResourceExtensionContent.d.ts +34 -0
- package/dist/esm/models/SkillResourceExtensionContent.js +47 -0
- package/dist/esm/models/SkillResourceExtensionToolExtension.d.ts +46 -0
- package/dist/esm/models/SkillResourceExtensionToolExtension.js +60 -0
- package/dist/esm/models/SqlChartDataset.d.ts +44 -0
- package/dist/esm/models/SqlChartDataset.js +57 -0
- package/dist/esm/models/SqlChartResultExtensionContent.d.ts +62 -0
- package/dist/esm/models/SqlChartResultExtensionContent.js +75 -0
- package/dist/esm/models/SqlChartResultExtensionToolExtension.d.ts +46 -0
- package/dist/esm/models/SqlChartResultExtensionToolExtension.js +60 -0
- package/dist/esm/models/SqlQueryExtensionContent.d.ts +30 -0
- package/dist/esm/models/SqlQueryExtensionContent.js +43 -0
- package/dist/esm/models/SqlQueryExtensionToolExtension.d.ts +46 -0
- package/dist/esm/models/SqlQueryExtensionToolExtension.js +60 -0
- package/dist/esm/models/SqlQueryResultExtensionContent.d.ts +59 -0
- package/dist/esm/models/SqlQueryResultExtensionContent.js +72 -0
- package/dist/esm/models/SqlQueryResultExtensionToolExtension.d.ts +46 -0
- package/dist/esm/models/SqlQueryResultExtensionToolExtension.js +60 -0
- package/dist/esm/models/SqlQueryResultPage.d.ts +63 -0
- package/dist/esm/models/SqlQueryResultPage.js +76 -0
- package/dist/esm/models/SqlQueryResultRow.d.ts +30 -0
- package/dist/esm/models/SqlQueryResultRow.js +43 -0
- package/dist/esm/models/SqlResultColumnSchema.d.ts +46 -0
- package/dist/esm/models/SqlResultColumnSchema.js +55 -0
- package/dist/esm/models/StringChartColumn.d.ts +45 -0
- package/dist/esm/models/StringChartColumn.js +59 -0
- package/dist/esm/models/SystemChatMessage.d.ts +45 -0
- package/dist/esm/models/SystemChatMessage.js +57 -0
- package/dist/esm/models/TaskProgressExtensionContent.d.ts +67 -0
- package/dist/esm/models/TaskProgressExtensionContent.js +76 -0
- package/dist/esm/models/TaskProgressExtensionToolExtension.d.ts +46 -0
- package/dist/esm/models/TaskProgressExtensionToolExtension.js +60 -0
- package/dist/esm/models/TaskSummary.d.ts +50 -0
- package/dist/esm/models/TaskSummary.js +61 -0
- package/dist/esm/models/ToolCall.d.ts +42 -0
- package/dist/esm/models/ToolCall.js +55 -0
- package/dist/esm/models/ToolExtension.d.ts +57 -0
- package/dist/esm/models/ToolExtension.js +97 -0
- package/dist/esm/models/ToolResponse.d.ts +46 -0
- package/dist/esm/models/ToolResponse.js +59 -0
- package/dist/esm/models/ToolResponseChatMessage.d.ts +46 -0
- package/dist/esm/models/ToolResponseChatMessage.js +58 -0
- package/dist/esm/models/UnknownAiChatBriefEvent.d.ts +34 -0
- package/dist/esm/models/UnknownAiChatBriefEvent.js +47 -0
- package/dist/esm/models/UnknownToolExtension.d.ts +34 -0
- package/dist/esm/models/UnknownToolExtension.js +47 -0
- package/dist/esm/models/Usage.d.ts +55 -0
- package/dist/esm/models/Usage.js +57 -0
- package/dist/esm/models/UserChatMessage.d.ts +55 -0
- package/dist/esm/models/UserChatMessage.js +63 -0
- package/dist/esm/models/UserInputAnswerInput.d.ts +46 -0
- package/dist/esm/models/UserInputAnswerInput.js +57 -0
- package/dist/esm/models/UserInputStatus.d.ts +46 -0
- package/dist/esm/models/UserInputStatus.js +51 -0
- package/dist/esm/models/ValidationError.d.ts +39 -0
- package/dist/esm/models/ValidationError.js +52 -0
- package/dist/esm/models/VariableBinding.d.ts +34 -0
- package/dist/esm/models/VariableBinding.js +47 -0
- package/dist/esm/models/WorkspaceArtifactList.d.ts +36 -0
- package/dist/esm/models/WorkspaceArtifactList.js +49 -0
- package/dist/esm/models/WorkspaceFile.d.ts +46 -0
- package/dist/esm/models/WorkspaceFile.js +60 -0
- package/dist/esm/models/WorkspaceFilePage.d.ts +36 -0
- package/dist/esm/models/WorkspaceFilePage.js +49 -0
- package/dist/esm/models/WorkspaceNonFileArtifact.d.ts +50 -0
- package/dist/esm/models/WorkspaceNonFileArtifact.js +60 -0
- package/dist/esm/models/index.d.ts +3519 -0
- package/dist/esm/models/index.js +307 -0
- package/dist/esm/runtime.d.ts +197 -0
- package/dist/esm/runtime.js +365 -0
- package/dist/esm/sse.d.ts +8 -0
- package/dist/esm/sse.js +57 -0
- package/dist/events.d.ts +21 -0
- package/dist/events.js +37 -0
- package/dist/hmac.d.ts +25 -0
- package/dist/hmac.js +67 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +25 -0
- package/dist/models/AgentFile.d.ts +50 -0
- package/dist/models/AgentFile.js +71 -0
- package/dist/models/AgentsConfig.d.ts +40 -0
- package/dist/models/AgentsConfig.js +60 -0
- package/dist/models/AiChatAwaitingInputBriefEvent.d.ts +74 -0
- package/dist/models/AiChatAwaitingInputBriefEvent.js +95 -0
- package/dist/models/AiChatBriefEvent.d.ts +66 -0
- package/dist/models/AiChatBriefEvent.js +118 -0
- package/dist/models/AiChatBriefEventList.d.ts +31 -0
- package/dist/models/AiChatBriefEventList.js +51 -0
- package/dist/models/AiChatCompactorWarningBriefEvent.d.ts +45 -0
- package/dist/models/AiChatCompactorWarningBriefEvent.js +67 -0
- package/dist/models/AiChatCompressorContextEndBriefEvent.d.ts +37 -0
- package/dist/models/AiChatCompressorContextEndBriefEvent.js +59 -0
- package/dist/models/AiChatCompressorContextStartBriefEvent.d.ts +37 -0
- package/dist/models/AiChatCompressorContextStartBriefEvent.js +59 -0
- package/dist/models/AiChatEndBriefEvent.d.ts +65 -0
- package/dist/models/AiChatEndBriefEvent.js +83 -0
- package/dist/models/AiChatErrorBriefEvent.d.ts +41 -0
- package/dist/models/AiChatErrorBriefEvent.js +63 -0
- package/dist/models/AiChatEventsBatch.d.ts +36 -0
- package/dist/models/AiChatEventsBatch.js +56 -0
- package/dist/models/AiChatEventsBatchInput.d.ts +34 -0
- package/dist/models/AiChatEventsBatchInput.js +54 -0
- package/dist/models/AiChatEventsBatchSkipped.d.ts +34 -0
- package/dist/models/AiChatEventsBatchSkipped.js +54 -0
- package/dist/models/AiChatFileRef.d.ts +34 -0
- package/dist/models/AiChatFileRef.js +52 -0
- package/dist/models/AiChatInput.d.ts +44 -0
- package/dist/models/AiChatInput.js +58 -0
- package/dist/models/AiChatManualInterruptBriefEvent.d.ts +37 -0
- package/dist/models/AiChatManualInterruptBriefEvent.js +59 -0
- package/dist/models/AiChatMessageBriefEvent.d.ts +41 -0
- package/dist/models/AiChatMessageBriefEvent.js +63 -0
- package/dist/models/AiChatMessageEvent.d.ts +35 -0
- package/dist/models/AiChatMessageEvent.js +55 -0
- package/dist/models/AiChatRequestBriefEvent.d.ts +47 -0
- package/dist/models/AiChatRequestBriefEvent.js +67 -0
- package/dist/models/AiChatResponseBriefEvent.d.ts +47 -0
- package/dist/models/AiChatResponseBriefEvent.js +69 -0
- package/dist/models/AiChatStartBriefEvent.d.ts +37 -0
- package/dist/models/AiChatStartBriefEvent.js +59 -0
- package/dist/models/AiChatStreamInput.d.ts +30 -0
- package/dist/models/AiChatStreamInput.js +50 -0
- package/dist/models/AiChatSubAgentCallBriefEvent.d.ts +53 -0
- package/dist/models/AiChatSubAgentCallBriefEvent.js +75 -0
- package/dist/models/AiChatSubmission.d.ts +42 -0
- package/dist/models/AiChatSubmission.js +62 -0
- package/dist/models/AiChatThinkBriefEvent.d.ts +41 -0
- package/dist/models/AiChatThinkBriefEvent.js +63 -0
- package/dist/models/AiChatToolExecutionBriefEvent.d.ts +62 -0
- package/dist/models/AiChatToolExecutionBriefEvent.js +80 -0
- package/dist/models/AiChatUserQueryBriefEvent.d.ts +46 -0
- package/dist/models/AiChatUserQueryBriefEvent.js +66 -0
- package/dist/models/ArtifactInfo.d.ts +58 -0
- package/dist/models/ArtifactInfo.js +76 -0
- package/dist/models/AskUserQuestionExtensionContent.d.ts +34 -0
- package/dist/models/AskUserQuestionExtensionContent.js +52 -0
- package/dist/models/AskUserQuestionExtensionToolExtension.d.ts +46 -0
- package/dist/models/AskUserQuestionExtensionToolExtension.js +68 -0
- package/dist/models/AskUserQuestionOption.d.ts +34 -0
- package/dist/models/AskUserQuestionOption.js +54 -0
- package/dist/models/AssistantChatMessage.d.ts +54 -0
- package/dist/models/AssistantChatMessage.js +70 -0
- package/dist/models/AsyncTask.d.ts +126 -0
- package/dist/models/AsyncTask.js +127 -0
- package/dist/models/AsyncTaskPage.d.ts +36 -0
- package/dist/models/AsyncTaskPage.js +56 -0
- package/dist/models/AttachmentExtension.d.ts +34 -0
- package/dist/models/AttachmentExtension.js +54 -0
- package/dist/models/BooleanChartColumn.d.ts +45 -0
- package/dist/models/BooleanChartColumn.js +67 -0
- package/dist/models/ChartColumnData.d.ts +50 -0
- package/dist/models/ChartColumnData.js +92 -0
- package/dist/models/ChartNumberFormat.d.ts +42 -0
- package/dist/models/ChartNumberFormat.js +58 -0
- package/dist/models/ChartQualitySummary.d.ts +38 -0
- package/dist/models/ChartQualitySummary.js +58 -0
- package/dist/models/ChartSeries.d.ts +68 -0
- package/dist/models/ChartSeries.js +85 -0
- package/dist/models/ChartSpec.d.ts +115 -0
- package/dist/models/ChartSpec.js +129 -0
- package/dist/models/ChartTimeContext.d.ts +34 -0
- package/dist/models/ChartTimeContext.js +55 -0
- package/dist/models/ChatMessage.d.ts +33 -0
- package/dist/models/ChatMessage.js +63 -0
- package/dist/models/ChatModelConfig.d.ts +62 -0
- package/dist/models/ChatModelConfig.js +82 -0
- package/dist/models/ChatModelSpec.d.ts +66 -0
- package/dist/models/ChatModelSpec.js +70 -0
- package/dist/models/ChatOptions.d.ts +54 -0
- package/dist/models/ChatOptions.js +60 -0
- package/dist/models/ChatStreamProbeEvent.d.ts +38 -0
- package/dist/models/ChatStreamProbeEvent.js +58 -0
- package/dist/models/ChatStreamProbeInput.d.ts +30 -0
- package/dist/models/ChatStreamProbeInput.js +50 -0
- package/dist/models/CitationMetadata.d.ts +42 -0
- package/dist/models/CitationMetadata.js +58 -0
- package/dist/models/CitationMetadataList.d.ts +31 -0
- package/dist/models/CitationMetadataList.js +51 -0
- package/dist/models/CodeMessage.d.ts +34 -0
- package/dist/models/CodeMessage.js +54 -0
- package/dist/models/ConfirmUploadInput.d.ts +34 -0
- package/dist/models/ConfirmUploadInput.js +54 -0
- package/dist/models/ConversationActivity.d.ts +62 -0
- package/dist/models/ConversationActivity.js +73 -0
- package/dist/models/ConversationActivityBatchInput.d.ts +30 -0
- package/dist/models/ConversationActivityBatchInput.js +50 -0
- package/dist/models/ConversationActivityList.d.ts +31 -0
- package/dist/models/ConversationActivityList.js +51 -0
- package/dist/models/ConversationConfig.d.ts +31 -0
- package/dist/models/ConversationConfig.js +49 -0
- package/dist/models/ConversationContextUsage.d.ts +74 -0
- package/dist/models/ConversationContextUsage.js +90 -0
- package/dist/models/ConversationIds.d.ts +30 -0
- package/dist/models/ConversationIds.js +50 -0
- package/dist/models/ConversationMessage.d.ts +84 -0
- package/dist/models/ConversationMessage.js +103 -0
- package/dist/models/ConversationMessagePage.d.ts +36 -0
- package/dist/models/ConversationMessagePage.js +56 -0
- package/dist/models/ConversationReadReceipt.d.ts +58 -0
- package/dist/models/ConversationReadReceipt.js +69 -0
- package/dist/models/ConversationReadReceiptInput.d.ts +30 -0
- package/dist/models/ConversationReadReceiptInput.js +50 -0
- package/dist/models/ConversationShareCreated.d.ts +46 -0
- package/dist/models/ConversationShareCreated.js +65 -0
- package/dist/models/ConversationShareInput.d.ts +34 -0
- package/dist/models/ConversationShareInput.js +51 -0
- package/dist/models/ConversationShareList.d.ts +31 -0
- package/dist/models/ConversationShareList.js +51 -0
- package/dist/models/ConversationShareRecord.d.ts +58 -0
- package/dist/models/ConversationShareRecord.js +77 -0
- package/dist/models/ConversationShareRevoked.d.ts +30 -0
- package/dist/models/ConversationShareRevoked.js +50 -0
- package/dist/models/ConversationStats.d.ts +50 -0
- package/dist/models/ConversationStats.js +70 -0
- package/dist/models/ConversationStatusInput.d.ts +30 -0
- package/dist/models/ConversationStatusInput.js +50 -0
- package/dist/models/ConversationSummary.d.ts +75 -0
- package/dist/models/ConversationSummary.js +94 -0
- package/dist/models/ConversationSummaryList.d.ts +31 -0
- package/dist/models/ConversationSummaryList.js +51 -0
- package/dist/models/ConversationTitle.d.ts +38 -0
- package/dist/models/ConversationTitle.js +56 -0
- package/dist/models/ConversationTitleInput.d.ts +30 -0
- package/dist/models/ConversationTitleInput.js +50 -0
- package/dist/models/ConversationUserMessage.d.ts +59 -0
- package/dist/models/ConversationUserMessage.js +75 -0
- package/dist/models/CreateFileInput.d.ts +34 -0
- package/dist/models/CreateFileInput.js +54 -0
- package/dist/models/DecimalChartColumn.d.ts +45 -0
- package/dist/models/DecimalChartColumn.js +67 -0
- package/dist/models/DefaultModel.d.ts +34 -0
- package/dist/models/DefaultModel.js +54 -0
- package/dist/models/DoubleChartColumn.d.ts +45 -0
- package/dist/models/DoubleChartColumn.js +67 -0
- package/dist/models/FieldError.d.ts +34 -0
- package/dist/models/FieldError.js +54 -0
- package/dist/models/FileExists.d.ts +30 -0
- package/dist/models/FileExists.js +50 -0
- package/dist/models/GeneratePreSignedUrlInput.d.ts +49 -0
- package/dist/models/GeneratePreSignedUrlInput.js +69 -0
- package/dist/models/GeneratePreSignedUrlOutput.d.ts +38 -0
- package/dist/models/GeneratePreSignedUrlOutput.js +54 -0
- package/dist/models/ImageGenerationExtensionContent.d.ts +30 -0
- package/dist/models/ImageGenerationExtensionContent.js +50 -0
- package/dist/models/ImageGenerationExtensionToolExtension.d.ts +46 -0
- package/dist/models/ImageGenerationExtensionToolExtension.js +68 -0
- package/dist/models/InputTokenBreakdown.d.ts +42 -0
- package/dist/models/InputTokenBreakdown.js +60 -0
- package/dist/models/InstantChartColumn.d.ts +45 -0
- package/dist/models/InstantChartColumn.js +67 -0
- package/dist/models/IntegerChartColumn.d.ts +46 -0
- package/dist/models/IntegerChartColumn.js +66 -0
- package/dist/models/JsRunScriptExtensionContent.d.ts +30 -0
- package/dist/models/JsRunScriptExtensionContent.js +50 -0
- package/dist/models/JsRunScriptExtensionToolExtension.d.ts +46 -0
- package/dist/models/JsRunScriptExtensionToolExtension.js +68 -0
- package/dist/models/JsRunScriptResultExtensionContent.d.ts +34 -0
- package/dist/models/JsRunScriptResultExtensionContent.js +52 -0
- package/dist/models/JsRunScriptResultExtensionToolExtension.d.ts +46 -0
- package/dist/models/JsRunScriptResultExtensionToolExtension.js +68 -0
- package/dist/models/LocalDateChartColumn.d.ts +45 -0
- package/dist/models/LocalDateChartColumn.js +67 -0
- package/dist/models/LocalDateTimeChartColumn.d.ts +45 -0
- package/dist/models/LocalDateTimeChartColumn.js +67 -0
- package/dist/models/LocalTimeChartColumn.d.ts +45 -0
- package/dist/models/LocalTimeChartColumn.js +67 -0
- package/dist/models/MathFormulaExtensionContent.d.ts +35 -0
- package/dist/models/MathFormulaExtensionContent.js +53 -0
- package/dist/models/MathFormulaExtensionToolExtension.d.ts +46 -0
- package/dist/models/MathFormulaExtensionToolExtension.js +68 -0
- package/dist/models/MathResultExtensionContent.d.ts +30 -0
- package/dist/models/MathResultExtensionContent.js +50 -0
- package/dist/models/MathResultExtensionToolExtension.d.ts +46 -0
- package/dist/models/MathResultExtensionToolExtension.js +68 -0
- package/dist/models/MediaAttachment.d.ts +46 -0
- package/dist/models/MediaAttachment.js +66 -0
- package/dist/models/ModelConfig.d.ts +36 -0
- package/dist/models/ModelConfig.js +56 -0
- package/dist/models/ModelKeyGroup.d.ts +39 -0
- package/dist/models/ModelKeyGroup.js +59 -0
- package/dist/models/MultimodalMediaAttachment.d.ts +38 -0
- package/dist/models/MultimodalMediaAttachment.js +58 -0
- package/dist/models/OperationResult.d.ts +34 -0
- package/dist/models/OperationResult.js +52 -0
- package/dist/models/PageInfo.d.ts +38 -0
- package/dist/models/PageInfo.js +58 -0
- package/dist/models/PlanApprovalExtensionContent.d.ts +38 -0
- package/dist/models/PlanApprovalExtensionContent.js +59 -0
- package/dist/models/PlanApprovalExtensionToolExtension.d.ts +46 -0
- package/dist/models/PlanApprovalExtensionToolExtension.js +68 -0
- package/dist/models/PlanApprovalInput.d.ts +42 -0
- package/dist/models/PlanApprovalInput.js +60 -0
- package/dist/models/PlanStatus.d.ts +34 -0
- package/dist/models/PlanStatus.js +54 -0
- package/dist/models/PreSignedReadUrl.d.ts +30 -0
- package/dist/models/PreSignedReadUrl.js +50 -0
- package/dist/models/ReturnedReference.d.ts +34 -0
- package/dist/models/ReturnedReference.js +54 -0
- package/dist/models/SkillResourceExtensionContent.d.ts +34 -0
- package/dist/models/SkillResourceExtensionContent.js +54 -0
- package/dist/models/SkillResourceExtensionToolExtension.d.ts +46 -0
- package/dist/models/SkillResourceExtensionToolExtension.js +68 -0
- package/dist/models/SqlChartDataset.d.ts +44 -0
- package/dist/models/SqlChartDataset.js +64 -0
- package/dist/models/SqlChartResultExtensionContent.d.ts +62 -0
- package/dist/models/SqlChartResultExtensionContent.js +82 -0
- package/dist/models/SqlChartResultExtensionToolExtension.d.ts +46 -0
- package/dist/models/SqlChartResultExtensionToolExtension.js +68 -0
- package/dist/models/SqlQueryExtensionContent.d.ts +30 -0
- package/dist/models/SqlQueryExtensionContent.js +50 -0
- package/dist/models/SqlQueryExtensionToolExtension.d.ts +46 -0
- package/dist/models/SqlQueryExtensionToolExtension.js +68 -0
- package/dist/models/SqlQueryResultExtensionContent.d.ts +59 -0
- package/dist/models/SqlQueryResultExtensionContent.js +79 -0
- package/dist/models/SqlQueryResultExtensionToolExtension.d.ts +46 -0
- package/dist/models/SqlQueryResultExtensionToolExtension.js +68 -0
- package/dist/models/SqlQueryResultPage.d.ts +63 -0
- package/dist/models/SqlQueryResultPage.js +83 -0
- package/dist/models/SqlQueryResultRow.d.ts +30 -0
- package/dist/models/SqlQueryResultRow.js +50 -0
- package/dist/models/SqlResultColumnSchema.d.ts +46 -0
- package/dist/models/SqlResultColumnSchema.js +62 -0
- package/dist/models/StringChartColumn.d.ts +45 -0
- package/dist/models/StringChartColumn.js +67 -0
- package/dist/models/SystemChatMessage.d.ts +45 -0
- package/dist/models/SystemChatMessage.js +65 -0
- package/dist/models/TaskProgressExtensionContent.d.ts +67 -0
- package/dist/models/TaskProgressExtensionContent.js +83 -0
- package/dist/models/TaskProgressExtensionToolExtension.d.ts +46 -0
- package/dist/models/TaskProgressExtensionToolExtension.js +68 -0
- package/dist/models/TaskSummary.d.ts +50 -0
- package/dist/models/TaskSummary.js +68 -0
- package/dist/models/ToolCall.d.ts +42 -0
- package/dist/models/ToolCall.js +62 -0
- package/dist/models/ToolExtension.d.ts +57 -0
- package/dist/models/ToolExtension.js +103 -0
- package/dist/models/ToolResponse.d.ts +46 -0
- package/dist/models/ToolResponse.js +66 -0
- package/dist/models/ToolResponseChatMessage.d.ts +46 -0
- package/dist/models/ToolResponseChatMessage.js +66 -0
- package/dist/models/UnknownAiChatBriefEvent.d.ts +34 -0
- package/dist/models/UnknownAiChatBriefEvent.js +54 -0
- package/dist/models/UnknownToolExtension.d.ts +34 -0
- package/dist/models/UnknownToolExtension.js +54 -0
- package/dist/models/Usage.d.ts +55 -0
- package/dist/models/Usage.js +64 -0
- package/dist/models/UserChatMessage.d.ts +55 -0
- package/dist/models/UserChatMessage.js +71 -0
- package/dist/models/UserInputAnswerInput.d.ts +46 -0
- package/dist/models/UserInputAnswerInput.js +64 -0
- package/dist/models/UserInputStatus.d.ts +46 -0
- package/dist/models/UserInputStatus.js +58 -0
- package/dist/models/ValidationError.d.ts +39 -0
- package/dist/models/ValidationError.js +59 -0
- package/dist/models/VariableBinding.d.ts +34 -0
- package/dist/models/VariableBinding.js +54 -0
- package/dist/models/WorkspaceArtifactList.d.ts +36 -0
- package/dist/models/WorkspaceArtifactList.js +56 -0
- package/dist/models/WorkspaceFile.d.ts +46 -0
- package/dist/models/WorkspaceFile.js +67 -0
- package/dist/models/WorkspaceFilePage.d.ts +36 -0
- package/dist/models/WorkspaceFilePage.js +56 -0
- package/dist/models/WorkspaceNonFileArtifact.d.ts +50 -0
- package/dist/models/WorkspaceNonFileArtifact.js +67 -0
- package/dist/models/index.d.ts +3519 -0
- package/dist/models/index.js +310 -0
- package/dist/runtime.d.ts +197 -0
- package/dist/runtime.js +385 -0
- package/dist/sse.d.ts +8 -0
- package/dist/sse.js +60 -0
- package/package.json +60 -0
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Lingya Agents OpenAPI
|
|
5
|
+
* Public, tenant-scoped Agent channel API authenticated with OPENAPI-HMAC-SHA256-V1. Studio administration endpoints are not part of this contract.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 0.1.2
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
export const BASE_PATH = "https://tenant.example.com".replace(/\/+$/, "");
|
|
24
|
+
export class Configuration {
|
|
25
|
+
constructor(configuration = {}) {
|
|
26
|
+
this.configuration = configuration;
|
|
27
|
+
}
|
|
28
|
+
set config(configuration) {
|
|
29
|
+
this.configuration = configuration;
|
|
30
|
+
}
|
|
31
|
+
get basePath() {
|
|
32
|
+
return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH;
|
|
33
|
+
}
|
|
34
|
+
get fetchApi() {
|
|
35
|
+
return this.configuration.fetchApi;
|
|
36
|
+
}
|
|
37
|
+
get middleware() {
|
|
38
|
+
return this.configuration.middleware || [];
|
|
39
|
+
}
|
|
40
|
+
get queryParamsStringify() {
|
|
41
|
+
return this.configuration.queryParamsStringify || querystring;
|
|
42
|
+
}
|
|
43
|
+
get username() {
|
|
44
|
+
return this.configuration.username;
|
|
45
|
+
}
|
|
46
|
+
get password() {
|
|
47
|
+
return this.configuration.password;
|
|
48
|
+
}
|
|
49
|
+
get apiKey() {
|
|
50
|
+
const apiKey = this.configuration.apiKey;
|
|
51
|
+
if (apiKey) {
|
|
52
|
+
return typeof apiKey === 'function' ? apiKey : () => apiKey;
|
|
53
|
+
}
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
get accessToken() {
|
|
57
|
+
const accessToken = this.configuration.accessToken;
|
|
58
|
+
if (accessToken) {
|
|
59
|
+
return typeof accessToken === 'function' ? accessToken : () => __awaiter(this, void 0, void 0, function* () { return accessToken; });
|
|
60
|
+
}
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
get headers() {
|
|
64
|
+
return this.configuration.headers;
|
|
65
|
+
}
|
|
66
|
+
get credentials() {
|
|
67
|
+
return this.configuration.credentials;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export const DefaultConfig = new Configuration();
|
|
71
|
+
/**
|
|
72
|
+
* This is the base class for all generated API classes.
|
|
73
|
+
*/
|
|
74
|
+
export class BaseAPI {
|
|
75
|
+
constructor(configuration = DefaultConfig) {
|
|
76
|
+
this.configuration = configuration;
|
|
77
|
+
this.fetchApi = (url, init) => __awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
let fetchParams = { url, init };
|
|
79
|
+
for (const middleware of this.middleware) {
|
|
80
|
+
if (middleware.pre) {
|
|
81
|
+
fetchParams = (yield middleware.pre(Object.assign({ fetch: this.fetchApi }, fetchParams))) || fetchParams;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
let response = undefined;
|
|
85
|
+
try {
|
|
86
|
+
response = yield (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
|
|
87
|
+
}
|
|
88
|
+
catch (e) {
|
|
89
|
+
for (const middleware of this.middleware) {
|
|
90
|
+
if (middleware.onError) {
|
|
91
|
+
response = (yield middleware.onError({
|
|
92
|
+
fetch: this.fetchApi,
|
|
93
|
+
url: fetchParams.url,
|
|
94
|
+
init: fetchParams.init,
|
|
95
|
+
error: e,
|
|
96
|
+
response: response ? response.clone() : undefined,
|
|
97
|
+
})) || response;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (response === undefined) {
|
|
101
|
+
if (e instanceof Error) {
|
|
102
|
+
throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response');
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
throw e;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
for (const middleware of this.middleware) {
|
|
110
|
+
if (middleware.post) {
|
|
111
|
+
response = (yield middleware.post({
|
|
112
|
+
fetch: this.fetchApi,
|
|
113
|
+
url: fetchParams.url,
|
|
114
|
+
init: fetchParams.init,
|
|
115
|
+
response: response.clone(),
|
|
116
|
+
})) || response;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return response;
|
|
120
|
+
});
|
|
121
|
+
this.middleware = configuration.middleware;
|
|
122
|
+
}
|
|
123
|
+
withMiddleware(...middlewares) {
|
|
124
|
+
const next = this.clone();
|
|
125
|
+
next.middleware = next.middleware.concat(...middlewares);
|
|
126
|
+
return next;
|
|
127
|
+
}
|
|
128
|
+
withPreMiddleware(...preMiddlewares) {
|
|
129
|
+
const middlewares = preMiddlewares.map((pre) => ({ pre }));
|
|
130
|
+
return this.withMiddleware(...middlewares);
|
|
131
|
+
}
|
|
132
|
+
withPostMiddleware(...postMiddlewares) {
|
|
133
|
+
const middlewares = postMiddlewares.map((post) => ({ post }));
|
|
134
|
+
return this.withMiddleware(...middlewares);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Check if the given MIME is a JSON MIME.
|
|
138
|
+
* JSON MIME examples:
|
|
139
|
+
* application/json
|
|
140
|
+
* application/json; charset=UTF8
|
|
141
|
+
* APPLICATION/JSON
|
|
142
|
+
* application/vnd.company+json
|
|
143
|
+
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
144
|
+
* @return True if the given MIME is JSON, false otherwise.
|
|
145
|
+
*/
|
|
146
|
+
isJsonMime(mime) {
|
|
147
|
+
if (!mime) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
return BaseAPI.jsonRegex.test(mime);
|
|
151
|
+
}
|
|
152
|
+
request(context, initOverrides) {
|
|
153
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
154
|
+
const { url, init } = yield this.createFetchParams(context, initOverrides);
|
|
155
|
+
const response = yield this.fetchApi(url, init);
|
|
156
|
+
if (response && (response.status >= 200 && response.status < 300)) {
|
|
157
|
+
return response;
|
|
158
|
+
}
|
|
159
|
+
throw new ResponseError(response, 'Response returned an error code');
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
createFetchParams(context, initOverrides) {
|
|
163
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
164
|
+
let url = this.configuration.basePath + context.path;
|
|
165
|
+
if (context.query !== undefined && Object.keys(context.query).length !== 0) {
|
|
166
|
+
// only add the querystring to the URL if there are query parameters.
|
|
167
|
+
// this is done to avoid urls ending with a "?" character which buggy webservers
|
|
168
|
+
// do not handle correctly sometimes.
|
|
169
|
+
url += '?' + this.configuration.queryParamsStringify(context.query);
|
|
170
|
+
}
|
|
171
|
+
const headers = Object.assign({}, this.configuration.headers, context.headers);
|
|
172
|
+
Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {});
|
|
173
|
+
const initOverrideFn = typeof initOverrides === "function"
|
|
174
|
+
? initOverrides
|
|
175
|
+
: () => __awaiter(this, void 0, void 0, function* () { return initOverrides; });
|
|
176
|
+
const initParams = {
|
|
177
|
+
method: context.method,
|
|
178
|
+
headers,
|
|
179
|
+
body: context.body,
|
|
180
|
+
credentials: this.configuration.credentials,
|
|
181
|
+
};
|
|
182
|
+
const overriddenInit = Object.assign(Object.assign({}, initParams), (yield initOverrideFn({
|
|
183
|
+
init: initParams,
|
|
184
|
+
context,
|
|
185
|
+
})));
|
|
186
|
+
let body;
|
|
187
|
+
if (isFormData(overriddenInit.body)
|
|
188
|
+
|| (overriddenInit.body instanceof URLSearchParams)
|
|
189
|
+
|| isBlob(overriddenInit.body)) {
|
|
190
|
+
body = overriddenInit.body;
|
|
191
|
+
}
|
|
192
|
+
else if (this.isJsonMime(headers['Content-Type'])) {
|
|
193
|
+
body = JSON.stringify(overriddenInit.body);
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
body = overriddenInit.body;
|
|
197
|
+
}
|
|
198
|
+
const init = Object.assign(Object.assign({}, overriddenInit), { body });
|
|
199
|
+
return { url, init };
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Create a shallow clone of `this` by constructing a new instance
|
|
204
|
+
* and then shallow cloning data members.
|
|
205
|
+
*/
|
|
206
|
+
clone() {
|
|
207
|
+
const constructor = this.constructor;
|
|
208
|
+
const next = new constructor(this.configuration);
|
|
209
|
+
next.middleware = this.middleware.slice();
|
|
210
|
+
return next;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
BaseAPI.jsonRegex = /^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$/i;
|
|
214
|
+
;
|
|
215
|
+
function isBlob(value) {
|
|
216
|
+
return typeof Blob !== 'undefined' && value instanceof Blob;
|
|
217
|
+
}
|
|
218
|
+
function isFormData(value) {
|
|
219
|
+
return typeof FormData !== "undefined" && value instanceof FormData;
|
|
220
|
+
}
|
|
221
|
+
export class ResponseError extends Error {
|
|
222
|
+
constructor(response, msg) {
|
|
223
|
+
super(msg);
|
|
224
|
+
this.response = response;
|
|
225
|
+
this.name = "ResponseError";
|
|
226
|
+
// restore prototype chain
|
|
227
|
+
const actualProto = new.target.prototype;
|
|
228
|
+
if (Object.setPrototypeOf) {
|
|
229
|
+
Object.setPrototypeOf(this, actualProto);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
export class FetchError extends Error {
|
|
234
|
+
constructor(cause, msg) {
|
|
235
|
+
super(msg);
|
|
236
|
+
this.cause = cause;
|
|
237
|
+
this.name = "FetchError";
|
|
238
|
+
// restore prototype chain
|
|
239
|
+
const actualProto = new.target.prototype;
|
|
240
|
+
if (Object.setPrototypeOf) {
|
|
241
|
+
Object.setPrototypeOf(this, actualProto);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
export class RequiredError extends Error {
|
|
246
|
+
constructor(field, msg) {
|
|
247
|
+
super(msg);
|
|
248
|
+
this.field = field;
|
|
249
|
+
this.name = "RequiredError";
|
|
250
|
+
// restore prototype chain
|
|
251
|
+
const actualProto = new.target.prototype;
|
|
252
|
+
if (Object.setPrototypeOf) {
|
|
253
|
+
Object.setPrototypeOf(this, actualProto);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
export const COLLECTION_FORMATS = {
|
|
258
|
+
csv: ",",
|
|
259
|
+
ssv: " ",
|
|
260
|
+
tsv: "\t",
|
|
261
|
+
pipes: "|",
|
|
262
|
+
};
|
|
263
|
+
export function querystring(params, prefix = '') {
|
|
264
|
+
return Object.keys(params)
|
|
265
|
+
.map(key => querystringSingleKey(key, params[key], prefix))
|
|
266
|
+
.filter(part => part.length > 0)
|
|
267
|
+
.join('&');
|
|
268
|
+
}
|
|
269
|
+
function querystringSingleKey(key, value, keyPrefix = '') {
|
|
270
|
+
const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
|
|
271
|
+
if (value instanceof Array) {
|
|
272
|
+
const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue)))
|
|
273
|
+
.join(`&${encodeURIComponent(fullKey)}=`);
|
|
274
|
+
return `${encodeURIComponent(fullKey)}=${multiValue}`;
|
|
275
|
+
}
|
|
276
|
+
if (value instanceof Set) {
|
|
277
|
+
const valueAsArray = Array.from(value);
|
|
278
|
+
return querystringSingleKey(key, valueAsArray, keyPrefix);
|
|
279
|
+
}
|
|
280
|
+
if (value instanceof Date) {
|
|
281
|
+
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(serializeDateTime(value))}`;
|
|
282
|
+
}
|
|
283
|
+
if (value instanceof Object) {
|
|
284
|
+
return querystring(value, fullKey);
|
|
285
|
+
}
|
|
286
|
+
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
|
|
287
|
+
}
|
|
288
|
+
export function exists(json, key) {
|
|
289
|
+
const value = json[key];
|
|
290
|
+
return value !== null && value !== undefined;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Every generated date call site routes through these.
|
|
294
|
+
*
|
|
295
|
+
* `format: date` is a calendar date, with no time and no offset, so it is converted
|
|
296
|
+
* against the local calendar on both ends: they have to agree or the date shifts by
|
|
297
|
+
* a day. `format: date-time` is an instant and uses UTC.
|
|
298
|
+
*/
|
|
299
|
+
export function serializeDateTime(value) {
|
|
300
|
+
return value.toISOString();
|
|
301
|
+
}
|
|
302
|
+
export function parseDate(value) {
|
|
303
|
+
return new Date(`${value}T00:00:00`);
|
|
304
|
+
}
|
|
305
|
+
export function parseDateTime(value) {
|
|
306
|
+
return new Date(value);
|
|
307
|
+
}
|
|
308
|
+
export function serializeDate(value) {
|
|
309
|
+
return `${value.getFullYear().toString().padStart(4, '0')}-${(value.getMonth() + 1).toString().padStart(2, '0')}-${value.getDate().toString().padStart(2, '0')}`;
|
|
310
|
+
}
|
|
311
|
+
export function mapValues(data, fn) {
|
|
312
|
+
return Object.keys(data).reduce((result, key) => (Object.assign(Object.assign({}, result), { [key]: fn(data[key]) })), {});
|
|
313
|
+
}
|
|
314
|
+
export function canConsumeForm(consumes) {
|
|
315
|
+
var _a;
|
|
316
|
+
for (const consume of consumes) {
|
|
317
|
+
if (((_a = consume.contentType) === null || _a === void 0 ? void 0 : _a.startsWith('multipart/form-data')) == true) {
|
|
318
|
+
return true;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
return false;
|
|
322
|
+
}
|
|
323
|
+
export class JSONApiResponse {
|
|
324
|
+
constructor(raw, transformer = (jsonValue) => jsonValue) {
|
|
325
|
+
this.raw = raw;
|
|
326
|
+
this.transformer = transformer;
|
|
327
|
+
}
|
|
328
|
+
value() {
|
|
329
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
330
|
+
return this.transformer(yield this.raw.json());
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
export class VoidApiResponse {
|
|
335
|
+
constructor(raw) {
|
|
336
|
+
this.raw = raw;
|
|
337
|
+
}
|
|
338
|
+
value() {
|
|
339
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
340
|
+
return undefined;
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
export class BlobApiResponse {
|
|
345
|
+
constructor(raw) {
|
|
346
|
+
this.raw = raw;
|
|
347
|
+
}
|
|
348
|
+
value() {
|
|
349
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
350
|
+
return yield this.raw.blob();
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
;
|
|
354
|
+
}
|
|
355
|
+
export class TextApiResponse {
|
|
356
|
+
constructor(raw) {
|
|
357
|
+
this.raw = raw;
|
|
358
|
+
}
|
|
359
|
+
value() {
|
|
360
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
361
|
+
return yield this.raw.text();
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
;
|
|
365
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 按 SSE 规范解码分片、多行 data 与心跳。 / Decodes chunked, multiline SSE data while ignoring heartbeats.
|
|
3
|
+
*
|
|
4
|
+
* @param response - Content-Type 为 `text/event-stream` 且 body 未被读取的成功响应。
|
|
5
|
+
* @returns 每个完整事件合并后的 data 字符串;关闭迭代器会取消后续读取。
|
|
6
|
+
* @throws Error 当响应没有可读 body。
|
|
7
|
+
*/
|
|
8
|
+
export declare function decodeSse(response: Response): AsyncGenerator<string>;
|
package/dist/esm/sse.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
2
|
+
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
3
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
4
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
5
|
+
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
6
|
+
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
|
7
|
+
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
|
8
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
9
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
10
|
+
function fulfill(value) { resume("next", value); }
|
|
11
|
+
function reject(value) { resume("throw", value); }
|
|
12
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* 按 SSE 规范解码分片、多行 data 与心跳。 / Decodes chunked, multiline SSE data while ignoring heartbeats.
|
|
16
|
+
*
|
|
17
|
+
* @param response - Content-Type 为 `text/event-stream` 且 body 未被读取的成功响应。
|
|
18
|
+
* @returns 每个完整事件合并后的 data 字符串;关闭迭代器会取消后续读取。
|
|
19
|
+
* @throws Error 当响应没有可读 body。
|
|
20
|
+
*/
|
|
21
|
+
export function decodeSse(response) {
|
|
22
|
+
return __asyncGenerator(this, arguments, function* decodeSse_1() {
|
|
23
|
+
var _a, _b;
|
|
24
|
+
if (response.body === null)
|
|
25
|
+
throw new Error('SSE response has no body');
|
|
26
|
+
const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
27
|
+
let buffer = '';
|
|
28
|
+
let data = [];
|
|
29
|
+
try {
|
|
30
|
+
for (;;) {
|
|
31
|
+
const chunk = yield __await(reader.read());
|
|
32
|
+
buffer += (_a = chunk.value) !== null && _a !== void 0 ? _a : '';
|
|
33
|
+
const lines = buffer.split(/\r?\n/);
|
|
34
|
+
buffer = (_b = lines.pop()) !== null && _b !== void 0 ? _b : '';
|
|
35
|
+
for (const line of lines) {
|
|
36
|
+
if (line === '') {
|
|
37
|
+
if (data.length > 0)
|
|
38
|
+
yield yield __await(data.join('\n'));
|
|
39
|
+
data = [];
|
|
40
|
+
}
|
|
41
|
+
else if (line.startsWith('data:')) {
|
|
42
|
+
data.push(line.slice(5).replace(/^ /, ''));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (chunk.done)
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
if (buffer.startsWith('data:'))
|
|
49
|
+
data.push(buffer.slice(5).replace(/^ /, ''));
|
|
50
|
+
if (data.length > 0)
|
|
51
|
+
yield yield __await(data.join('\n'));
|
|
52
|
+
}
|
|
53
|
+
finally {
|
|
54
|
+
reader.releaseLock();
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AiChatBriefEvent, ToolExtension, UnknownAiChatBriefEvent, UnknownToolExtension } from './models';
|
|
2
|
+
/** 包含全部已知事件以及携带原始 JSON 的未知事件。 / All known events plus a raw-JSON fallback for future event types. */
|
|
3
|
+
export type LingyaAiChatBriefEvent = AiChatBriefEvent | UnknownAiChatBriefEvent;
|
|
4
|
+
/** 包含全部已知工具扩展以及携带原始 JSON 的未知扩展。 / All known tool extensions plus a raw-JSON fallback. */
|
|
5
|
+
export type LingyaToolExtension = ToolExtension | UnknownToolExtension;
|
|
6
|
+
/**
|
|
7
|
+
* 按 type 判别事件;未知值只暴露 type 与 rawJson。 / Decodes by type with an exact JSON fallback.
|
|
8
|
+
*
|
|
9
|
+
* @param rawJson - 一个完整 SSE data 对象的原始 JSON。
|
|
10
|
+
* @returns 已知事件联合,或保存输入原文的未知事件。
|
|
11
|
+
* @throws SyntaxError 当输入不是有效 JSON。
|
|
12
|
+
*/
|
|
13
|
+
export declare function decodeAiChatBriefEvent(rawJson: string): LingyaAiChatBriefEvent;
|
|
14
|
+
/**
|
|
15
|
+
* 按 category 判别工具扩展。 / Decodes a tool extension by category.
|
|
16
|
+
*
|
|
17
|
+
* @param rawJson - 一个完整工具扩展对象的原始 JSON。
|
|
18
|
+
* @returns 12 种已知扩展之一,或保存输入原文的未知扩展。
|
|
19
|
+
* @throws SyntaxError 当输入不是有效 JSON。
|
|
20
|
+
*/
|
|
21
|
+
export declare function decodeToolExtension(rawJson: string): LingyaToolExtension;
|
package/dist/events.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.decodeAiChatBriefEvent = decodeAiChatBriefEvent;
|
|
4
|
+
exports.decodeToolExtension = decodeToolExtension;
|
|
5
|
+
const knownEventTypes = new Set([
|
|
6
|
+
'user-query', 'compressor-context-start', 'compressor-context-end', 'compactor-warning', 'manual-interrupt',
|
|
7
|
+
'error', 'start', 'think', 'chat-client-request', 'chat-client-response', 'message', 'tool-execution',
|
|
8
|
+
'tool-execution-sub-agent-call', 'tool-execution-awaiting-user-input', 'end',
|
|
9
|
+
]);
|
|
10
|
+
const knownToolCategories = new Set([
|
|
11
|
+
'planApproval', 'askUserQuestion', 'imageGeneration', 'sqlQuery', 'sqlQueryResult', 'sqlChartResult',
|
|
12
|
+
'mathFormula', 'mathResult', 'jsRunScript', 'jsRunScriptResult', 'skillResource', 'taskProgress',
|
|
13
|
+
]);
|
|
14
|
+
/**
|
|
15
|
+
* 按 type 判别事件;未知值只暴露 type 与 rawJson。 / Decodes by type with an exact JSON fallback.
|
|
16
|
+
*
|
|
17
|
+
* @param rawJson - 一个完整 SSE data 对象的原始 JSON。
|
|
18
|
+
* @returns 已知事件联合,或保存输入原文的未知事件。
|
|
19
|
+
* @throws SyntaxError 当输入不是有效 JSON。
|
|
20
|
+
*/
|
|
21
|
+
function decodeAiChatBriefEvent(rawJson) {
|
|
22
|
+
const parsed = JSON.parse(rawJson);
|
|
23
|
+
const type = typeof parsed.type === 'string' ? parsed.type : 'unknown';
|
|
24
|
+
return knownEventTypes.has(type) ? parsed : { type, rawJson };
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 按 category 判别工具扩展。 / Decodes a tool extension by category.
|
|
28
|
+
*
|
|
29
|
+
* @param rawJson - 一个完整工具扩展对象的原始 JSON。
|
|
30
|
+
* @returns 12 种已知扩展之一,或保存输入原文的未知扩展。
|
|
31
|
+
* @throws SyntaxError 当输入不是有效 JSON。
|
|
32
|
+
*/
|
|
33
|
+
function decodeToolExtension(rawJson) {
|
|
34
|
+
const parsed = JSON.parse(rawJson);
|
|
35
|
+
const category = typeof parsed.category === 'string' ? parsed.category : 'unknown';
|
|
36
|
+
return knownToolCategories.has(category) ? parsed : { category, rawJson };
|
|
37
|
+
}
|
package/dist/hmac.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** 服务端 OpenAPI 凭证。Secret 不会被发送或写入异常。 / Trusted-server credentials; the secret is never transmitted. */
|
|
2
|
+
export interface OpenApiCredentials {
|
|
3
|
+
/** 访问密钥标识。 / Access-key identifier. */
|
|
4
|
+
accessKey: string;
|
|
5
|
+
/** HMAC 密钥。 / HMAC secret. */
|
|
6
|
+
secretKey: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 构造已签名 fetch;每次调用都会重新生成 timestamp、nonce 和签名。 / Creates a fetch that signs every attempt independently.
|
|
10
|
+
*
|
|
11
|
+
* 签名在 Fetch Request 完全确定后计算,避免 URL 或 body 在签名后再次编码。
|
|
12
|
+
*
|
|
13
|
+
* @param credentials - channel 的访问密钥与 HMAC secret。
|
|
14
|
+
* @param externalUserId - UTF-8 编码后为 1..256 字节且不含 NUL 的外部用户 ID。
|
|
15
|
+
* @returns 与原生 fetch 兼容的签名 transport。
|
|
16
|
+
*/
|
|
17
|
+
export declare function createSignedFetch(credentials: OpenApiCredentials, externalUserId: string): typeof fetch;
|
|
18
|
+
/**
|
|
19
|
+
* 对固定 canonical string 计算 HMAC。 / Computes HMAC for a fixed canonical string.
|
|
20
|
+
*
|
|
21
|
+
* @param secretKey - HMAC-SHA256 secret。
|
|
22
|
+
* @param canonical - 已按协议顺序拼接的规范字符串。
|
|
23
|
+
* @returns 小写十六进制签名。
|
|
24
|
+
*/
|
|
25
|
+
export declare function signCanonical(secretKey: string, canonical: string): string;
|
package/dist/hmac.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.createSignedFetch = createSignedFetch;
|
|
13
|
+
exports.signCanonical = signCanonical;
|
|
14
|
+
const node_crypto_1 = require("node:crypto");
|
|
15
|
+
/**
|
|
16
|
+
* 构造已签名 fetch;每次调用都会重新生成 timestamp、nonce 和签名。 / Creates a fetch that signs every attempt independently.
|
|
17
|
+
*
|
|
18
|
+
* 签名在 Fetch Request 完全确定后计算,避免 URL 或 body 在签名后再次编码。
|
|
19
|
+
*
|
|
20
|
+
* @param credentials - channel 的访问密钥与 HMAC secret。
|
|
21
|
+
* @param externalUserId - UTF-8 编码后为 1..256 字节且不含 NUL 的外部用户 ID。
|
|
22
|
+
* @returns 与原生 fetch 兼容的签名 transport。
|
|
23
|
+
*/
|
|
24
|
+
function createSignedFetch(credentials, externalUserId) {
|
|
25
|
+
const userBytes = Buffer.from(externalUserId, 'utf8');
|
|
26
|
+
if (userBytes.length < 1 || userBytes.length > 256 || userBytes.includes(0)) {
|
|
27
|
+
throw new Error('externalUserId must contain 1 to 256 UTF-8 bytes and no NUL');
|
|
28
|
+
}
|
|
29
|
+
const encodedUser = userBytes.toString('base64url');
|
|
30
|
+
return (input, init) => __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
var _a;
|
|
32
|
+
const request = new Request(input, init);
|
|
33
|
+
if (request.headers.has('Content-Encoding')) {
|
|
34
|
+
throw new Error('Content-Encoding is not supported for signed requests');
|
|
35
|
+
}
|
|
36
|
+
const body = request.body === null ? new Uint8Array() : new Uint8Array(yield request.clone().arrayBuffer());
|
|
37
|
+
if (body.byteLength > 2 * 1024 * 1024) {
|
|
38
|
+
throw new Error('request body exceeds the 2 MiB signing limit');
|
|
39
|
+
}
|
|
40
|
+
const url = new URL(request.url);
|
|
41
|
+
const timestamp = Math.floor(Date.now() / 1000).toString();
|
|
42
|
+
const nonce = (0, node_crypto_1.randomBytes)(16).toString('base64url');
|
|
43
|
+
const contentType = (_a = request.headers.get('Content-Type')) !== null && _a !== void 0 ? _a : '';
|
|
44
|
+
const canonical = [
|
|
45
|
+
'OPENAPI-HMAC-SHA256-V1', credentials.accessKey, timestamp, nonce,
|
|
46
|
+
request.method.toUpperCase(), url.pathname, url.search.slice(1), encodedUser, contentType,
|
|
47
|
+
(0, node_crypto_1.createHash)('sha256').update(body).digest('hex'),
|
|
48
|
+
].join('\n');
|
|
49
|
+
const headers = new Headers(request.headers);
|
|
50
|
+
headers.set('X-OpenAPI-AK', credentials.accessKey);
|
|
51
|
+
headers.set('X-OpenAPI-Timestamp', timestamp);
|
|
52
|
+
headers.set('X-OpenAPI-Nonce', nonce);
|
|
53
|
+
headers.set('X-OpenAPI-User', encodedUser);
|
|
54
|
+
headers.set('X-OpenAPI-Signature', (0, node_crypto_1.createHmac)('sha256', credentials.secretKey).update(canonical).digest('hex'));
|
|
55
|
+
return fetch(new Request(request, { headers }));
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* 对固定 canonical string 计算 HMAC。 / Computes HMAC for a fixed canonical string.
|
|
60
|
+
*
|
|
61
|
+
* @param secretKey - HMAC-SHA256 secret。
|
|
62
|
+
* @param canonical - 已按协议顺序拼接的规范字符串。
|
|
63
|
+
* @returns 小写十六进制签名。
|
|
64
|
+
*/
|
|
65
|
+
function signCanonical(secretKey, canonical) {
|
|
66
|
+
return (0, node_crypto_1.createHmac)('sha256', secretKey).update(canonical).digest('hex');
|
|
67
|
+
}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/* tslint:disable */
|
|
18
|
+
/* eslint-disable */
|
|
19
|
+
__exportStar(require("./runtime"), exports);
|
|
20
|
+
__exportStar(require("./apis/index"), exports);
|
|
21
|
+
__exportStar(require("./models/index"), exports);
|
|
22
|
+
__exportStar(require("./client"), exports);
|
|
23
|
+
__exportStar(require("./hmac"), exports);
|
|
24
|
+
__exportStar(require("./sse"), exports);
|
|
25
|
+
__exportStar(require("./events"), exports);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lingya Agents OpenAPI
|
|
3
|
+
* Public, tenant-scoped Agent channel API authenticated with OPENAPI-HMAC-SHA256-V1. Studio administration endpoints are not part of this contract.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.1.2
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* AgentFile 的公开协议结构。 / Public contract for agent file.
|
|
14
|
+
* @export
|
|
15
|
+
* @interface AgentFile
|
|
16
|
+
*/
|
|
17
|
+
export interface AgentFile {
|
|
18
|
+
/**
|
|
19
|
+
* 字段 id / id field。
|
|
20
|
+
*/
|
|
21
|
+
id: number;
|
|
22
|
+
/**
|
|
23
|
+
* 文件名 / file name。
|
|
24
|
+
*/
|
|
25
|
+
fileName: string;
|
|
26
|
+
/**
|
|
27
|
+
* 字段 contentMd5 / content md5 field。
|
|
28
|
+
*/
|
|
29
|
+
contentMd5: string;
|
|
30
|
+
/**
|
|
31
|
+
* 大小(字节)或分页容量 / byte size or page size。
|
|
32
|
+
*/
|
|
33
|
+
size: number;
|
|
34
|
+
/**
|
|
35
|
+
* 创建时间 / creation time。
|
|
36
|
+
*/
|
|
37
|
+
createdTime: Date;
|
|
38
|
+
/**
|
|
39
|
+
* 最后更新时间 / last update time。
|
|
40
|
+
*/
|
|
41
|
+
lastUpdateTime: Date;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Check if a given object implements the AgentFile interface.
|
|
45
|
+
*/
|
|
46
|
+
export declare function instanceOfAgentFile(value: object): value is AgentFile;
|
|
47
|
+
export declare function AgentFileFromJSON(json: any): AgentFile;
|
|
48
|
+
export declare function AgentFileFromJSONTyped(json: any, ignoreDiscriminator: boolean): AgentFile;
|
|
49
|
+
export declare function AgentFileToJSON(json: any): AgentFile;
|
|
50
|
+
export declare function AgentFileToJSONTyped(value?: AgentFile | null, ignoreDiscriminator?: boolean): any;
|