@letta-ai/letta-client 0.1.170 → 0.1.173
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 +16 -3
- package/api/errors/BadRequestError.d.ts +2 -1
- package/api/errors/BadRequestError.js +2 -1
- package/api/errors/ConflictError.d.ts +2 -1
- package/api/errors/ConflictError.js +2 -1
- package/api/errors/InternalServerError.d.ts +2 -1
- package/api/errors/InternalServerError.js +2 -1
- package/api/errors/NotFoundError.d.ts +2 -1
- package/api/errors/NotFoundError.js +2 -1
- package/api/errors/PaymentRequiredError.d.ts +2 -1
- package/api/errors/PaymentRequiredError.js +2 -1
- package/api/errors/UnprocessableEntityError.d.ts +2 -1
- package/api/errors/UnprocessableEntityError.js +2 -1
- package/api/resources/agents/client/Client.d.ts +20 -10
- package/api/resources/agents/client/Client.js +166 -82
- package/api/resources/agents/client/requests/AgentsListRequest.d.ts +1 -1
- package/api/resources/agents/client/requests/CreateAgentRequest.d.ts +2 -0
- package/api/resources/agents/client/requests/UpdateAgent.d.ts +2 -0
- package/api/resources/agents/resources/blocks/client/Client.d.ts +10 -5
- package/api/resources/agents/resources/blocks/client/Client.js +90 -45
- package/api/resources/agents/resources/context/client/Client.d.ts +2 -1
- package/api/resources/agents/resources/context/client/Client.js +18 -9
- package/api/resources/agents/resources/coreMemory/client/Client.d.ts +2 -1
- package/api/resources/agents/resources/coreMemory/client/Client.js +18 -9
- package/api/resources/agents/resources/files/client/Client.d.ts +6 -3
- package/api/resources/agents/resources/files/client/Client.js +45 -21
- package/api/resources/agents/resources/folders/client/Client.d.ts +6 -3
- package/api/resources/agents/resources/folders/client/Client.js +54 -27
- package/api/resources/agents/resources/groups/client/Client.d.ts +2 -1
- package/api/resources/agents/resources/groups/client/Client.js +19 -10
- package/api/resources/agents/resources/memoryVariables/client/Client.d.ts +2 -1
- package/api/resources/agents/resources/memoryVariables/client/Client.js +18 -9
- package/api/resources/agents/resources/messages/client/Client.d.ts +16 -8
- package/api/resources/agents/resources/messages/client/Client.js +155 -83
- package/api/resources/agents/resources/passages/client/Client.d.ts +8 -4
- package/api/resources/agents/resources/passages/client/Client.js +64 -31
- package/api/resources/agents/resources/passages/client/requests/PassageUpdate.d.ts +2 -2
- package/api/resources/agents/resources/sources/client/Client.d.ts +6 -3
- package/api/resources/agents/resources/sources/client/Client.js +54 -27
- package/api/resources/agents/resources/templates/client/Client.d.ts +6 -3
- package/api/resources/agents/resources/templates/client/Client.js +54 -27
- package/api/resources/agents/resources/tools/client/Client.d.ts +6 -3
- package/api/resources/agents/resources/tools/client/Client.js +54 -27
- package/api/resources/batches/client/Client.d.ts +8 -4
- package/api/resources/batches/client/Client.js +63 -30
- package/api/resources/blocks/client/Client.d.ts +12 -6
- package/api/resources/blocks/client/Client.js +100 -49
- package/api/resources/blocks/resources/agents/client/Client.d.ts +2 -1
- package/api/resources/blocks/resources/agents/client/Client.js +19 -10
- package/api/resources/clientSideAccessTokens/client/Client.d.ts +6 -3
- package/api/resources/clientSideAccessTokens/client/Client.js +46 -22
- package/api/resources/embeddingModels/client/Client.d.ts +2 -1
- package/api/resources/embeddingModels/client/Client.js +18 -9
- package/api/resources/folders/client/Client.d.ts +18 -9
- package/api/resources/folders/client/Client.js +154 -76
- package/api/resources/folders/resources/files/client/Client.d.ts +6 -3
- package/api/resources/folders/resources/files/client/Client.js +48 -24
- package/api/resources/folders/resources/passages/client/Client.d.ts +2 -1
- package/api/resources/folders/resources/passages/client/Client.js +19 -10
- package/api/resources/groups/client/Client.d.ts +12 -6
- package/api/resources/groups/client/Client.js +105 -52
- package/api/resources/groups/resources/messages/client/Client.d.ts +10 -5
- package/api/resources/groups/resources/messages/client/Client.js +91 -49
- package/api/resources/health/client/Client.d.ts +2 -1
- package/api/resources/health/client/Client.js +17 -8
- package/api/resources/identities/client/Client.d.ts +14 -7
- package/api/resources/identities/client/Client.js +123 -61
- package/api/resources/identities/resources/properties/client/Client.d.ts +2 -1
- package/api/resources/identities/resources/properties/client/Client.js +9 -3
- package/api/resources/jobs/client/Client.d.ts +10 -5
- package/api/resources/jobs/client/Client.js +92 -47
- package/api/resources/messages/client/Client.d.ts +2 -1
- package/api/resources/messages/client/Client.js +19 -10
- package/api/resources/models/client/Client.d.ts +2 -1
- package/api/resources/models/client/Client.js +27 -14
- package/api/resources/projects/client/Client.d.ts +2 -1
- package/api/resources/projects/client/Client.js +18 -9
- package/api/resources/providers/client/Client.d.ts +10 -5
- package/api/resources/providers/client/Client.js +77 -36
- package/api/resources/runs/client/Client.d.ts +8 -4
- package/api/resources/runs/client/Client.js +74 -38
- package/api/resources/runs/resources/messages/client/Client.d.ts +2 -1
- package/api/resources/runs/resources/messages/client/Client.js +21 -12
- package/api/resources/runs/resources/steps/client/Client.d.ts +2 -1
- package/api/resources/runs/resources/steps/client/Client.js +19 -10
- package/api/resources/runs/resources/usage/client/Client.d.ts +2 -1
- package/api/resources/runs/resources/usage/client/Client.js +18 -9
- package/api/resources/sources/client/Client.d.ts +20 -10
- package/api/resources/sources/client/Client.js +173 -86
- package/api/resources/sources/resources/files/client/Client.d.ts +6 -3
- package/api/resources/sources/resources/files/client/Client.js +48 -24
- package/api/resources/sources/resources/passages/client/Client.d.ts +2 -1
- package/api/resources/sources/resources/passages/client/Client.js +19 -10
- package/api/resources/steps/client/Client.d.ts +4 -2
- package/api/resources/steps/client/Client.js +41 -21
- package/api/resources/steps/resources/feedback/client/Client.d.ts +2 -1
- package/api/resources/steps/resources/feedback/client/Client.js +23 -12
- package/api/resources/tags/client/Client.d.ts +2 -1
- package/api/resources/tags/client/Client.js +19 -10
- package/api/resources/telemetry/client/Client.d.ts +2 -1
- package/api/resources/telemetry/client/Client.js +18 -9
- package/api/resources/templates/client/Client.d.ts +2 -1
- package/api/resources/templates/client/Client.js +18 -9
- package/api/resources/templates/resources/agents/client/Client.d.ts +2 -1
- package/api/resources/templates/resources/agents/client/Client.js +19 -10
- package/api/resources/tools/client/Client.d.ts +40 -20
- package/api/resources/tools/client/Client.js +356 -182
- package/api/resources/tools/client/requests/ToolRunFromSource.d.ts +2 -0
- package/api/resources/tools/client/requests/ToolUpdate.d.ts +2 -0
- package/api/resources/voice/client/Client.d.ts +2 -1
- package/api/resources/voice/client/Client.js +9 -3
- package/api/types/AgentState.d.ts +2 -0
- package/api/types/EmbeddingConfig.d.ts +1 -11
- package/api/types/LettaStreamingRequest.d.ts +2 -0
- package/api/types/LlmConfig.d.ts +1 -11
- package/api/types/ModalSandboxConfig.d.ts +4 -0
- package/api/types/ModalSandboxConfigLanguage.d.ts +8 -0
- package/api/types/ModalSandboxConfigLanguage.js +10 -0
- package/api/types/NpmRequirement.d.ts +9 -0
- package/api/types/NpmRequirement.js +5 -0
- package/api/types/Passage.d.ts +4 -4
- package/api/types/Tool.d.ts +2 -0
- package/api/types/ToolCreate.d.ts +2 -0
- package/api/types/ToolType.d.ts +2 -1
- package/api/types/ToolType.js +1 -0
- package/api/types/index.d.ts +2 -0
- package/api/types/index.js +2 -0
- package/core/fetcher/APIResponse.d.ts +10 -0
- package/core/fetcher/Fetcher.d.ts +1 -1
- package/core/fetcher/Fetcher.js +11 -3
- package/core/fetcher/Headers.d.ts +2 -0
- package/core/fetcher/Headers.js +84 -0
- package/core/fetcher/HttpResponsePromise.d.ts +58 -0
- package/core/fetcher/HttpResponsePromise.js +103 -0
- package/core/fetcher/RawResponse.d.ts +29 -0
- package/core/fetcher/RawResponse.js +44 -0
- package/core/fetcher/createRequestUrl.d.ts +1 -1
- package/core/fetcher/getRequestBody.js +2 -1
- package/core/fetcher/index.d.ts +3 -0
- package/core/fetcher/index.js +7 -1
- package/core/fetcher/requestWithRetries.js +1 -1
- package/core/form-data-utils/FormDataWrapper.d.ts +3 -0
- package/core/form-data-utils/FormDataWrapper.js +53 -10
- package/core/form-data-utils/encodeAsFormParameter.d.ts +4 -0
- package/core/form-data-utils/encodeAsFormParameter.js +18 -0
- package/core/form-data-utils/index.d.ts +1 -0
- package/core/form-data-utils/index.js +3 -0
- package/core/json.d.ts +15 -0
- package/core/json.js +24 -0
- package/core/schemas/Schema.d.ts +2 -0
- package/core/schemas/Schema.js +2 -0
- package/core/schemas/builders/bigint/bigint.d.ts +1 -1
- package/core/schemas/builders/bigint/bigint.js +21 -17
- package/core/schemas/builders/object/object.js +1 -0
- package/core/schemas/builders/record/record.js +1 -2
- package/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +4 -0
- package/core/schemas/builders/schema-utils/getSchemaUtils.js +64 -0
- package/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +1 -1
- package/dist/api/errors/BadRequestError.d.ts +2 -1
- package/dist/api/errors/BadRequestError.js +2 -1
- package/dist/api/errors/ConflictError.d.ts +2 -1
- package/dist/api/errors/ConflictError.js +2 -1
- package/dist/api/errors/InternalServerError.d.ts +2 -1
- package/dist/api/errors/InternalServerError.js +2 -1
- package/dist/api/errors/NotFoundError.d.ts +2 -1
- package/dist/api/errors/NotFoundError.js +2 -1
- package/dist/api/errors/PaymentRequiredError.d.ts +2 -1
- package/dist/api/errors/PaymentRequiredError.js +2 -1
- package/dist/api/errors/UnprocessableEntityError.d.ts +2 -1
- package/dist/api/errors/UnprocessableEntityError.js +2 -1
- package/dist/api/resources/agents/client/Client.d.ts +20 -10
- package/dist/api/resources/agents/client/Client.js +166 -82
- package/dist/api/resources/agents/client/requests/AgentsListRequest.d.ts +1 -1
- package/dist/api/resources/agents/client/requests/CreateAgentRequest.d.ts +2 -0
- package/dist/api/resources/agents/client/requests/UpdateAgent.d.ts +2 -0
- package/dist/api/resources/agents/resources/blocks/client/Client.d.ts +10 -5
- package/dist/api/resources/agents/resources/blocks/client/Client.js +90 -45
- package/dist/api/resources/agents/resources/context/client/Client.d.ts +2 -1
- package/dist/api/resources/agents/resources/context/client/Client.js +18 -9
- package/dist/api/resources/agents/resources/coreMemory/client/Client.d.ts +2 -1
- package/dist/api/resources/agents/resources/coreMemory/client/Client.js +18 -9
- package/dist/api/resources/agents/resources/files/client/Client.d.ts +6 -3
- package/dist/api/resources/agents/resources/files/client/Client.js +45 -21
- package/dist/api/resources/agents/resources/folders/client/Client.d.ts +6 -3
- package/dist/api/resources/agents/resources/folders/client/Client.js +54 -27
- package/dist/api/resources/agents/resources/groups/client/Client.d.ts +2 -1
- package/dist/api/resources/agents/resources/groups/client/Client.js +19 -10
- package/dist/api/resources/agents/resources/memoryVariables/client/Client.d.ts +2 -1
- package/dist/api/resources/agents/resources/memoryVariables/client/Client.js +18 -9
- package/dist/api/resources/agents/resources/messages/client/Client.d.ts +16 -8
- package/dist/api/resources/agents/resources/messages/client/Client.js +155 -83
- package/dist/api/resources/agents/resources/passages/client/Client.d.ts +8 -4
- package/dist/api/resources/agents/resources/passages/client/Client.js +64 -31
- package/dist/api/resources/agents/resources/passages/client/requests/PassageUpdate.d.ts +2 -2
- package/dist/api/resources/agents/resources/sources/client/Client.d.ts +6 -3
- package/dist/api/resources/agents/resources/sources/client/Client.js +54 -27
- package/dist/api/resources/agents/resources/templates/client/Client.d.ts +6 -3
- package/dist/api/resources/agents/resources/templates/client/Client.js +54 -27
- package/dist/api/resources/agents/resources/tools/client/Client.d.ts +6 -3
- package/dist/api/resources/agents/resources/tools/client/Client.js +54 -27
- package/dist/api/resources/batches/client/Client.d.ts +8 -4
- package/dist/api/resources/batches/client/Client.js +63 -30
- package/dist/api/resources/blocks/client/Client.d.ts +12 -6
- package/dist/api/resources/blocks/client/Client.js +100 -49
- package/dist/api/resources/blocks/resources/agents/client/Client.d.ts +2 -1
- package/dist/api/resources/blocks/resources/agents/client/Client.js +19 -10
- package/dist/api/resources/clientSideAccessTokens/client/Client.d.ts +6 -3
- package/dist/api/resources/clientSideAccessTokens/client/Client.js +46 -22
- package/dist/api/resources/embeddingModels/client/Client.d.ts +2 -1
- package/dist/api/resources/embeddingModels/client/Client.js +18 -9
- package/dist/api/resources/folders/client/Client.d.ts +18 -9
- package/dist/api/resources/folders/client/Client.js +154 -76
- package/dist/api/resources/folders/resources/files/client/Client.d.ts +6 -3
- package/dist/api/resources/folders/resources/files/client/Client.js +48 -24
- package/dist/api/resources/folders/resources/passages/client/Client.d.ts +2 -1
- package/dist/api/resources/folders/resources/passages/client/Client.js +19 -10
- package/dist/api/resources/groups/client/Client.d.ts +12 -6
- package/dist/api/resources/groups/client/Client.js +105 -52
- package/dist/api/resources/groups/resources/messages/client/Client.d.ts +10 -5
- package/dist/api/resources/groups/resources/messages/client/Client.js +91 -49
- package/dist/api/resources/health/client/Client.d.ts +2 -1
- package/dist/api/resources/health/client/Client.js +17 -8
- package/dist/api/resources/identities/client/Client.d.ts +14 -7
- package/dist/api/resources/identities/client/Client.js +123 -61
- package/dist/api/resources/identities/resources/properties/client/Client.d.ts +2 -1
- package/dist/api/resources/identities/resources/properties/client/Client.js +9 -3
- package/dist/api/resources/jobs/client/Client.d.ts +10 -5
- package/dist/api/resources/jobs/client/Client.js +92 -47
- package/dist/api/resources/messages/client/Client.d.ts +2 -1
- package/dist/api/resources/messages/client/Client.js +19 -10
- package/dist/api/resources/models/client/Client.d.ts +2 -1
- package/dist/api/resources/models/client/Client.js +27 -14
- package/dist/api/resources/projects/client/Client.d.ts +2 -1
- package/dist/api/resources/projects/client/Client.js +18 -9
- package/dist/api/resources/providers/client/Client.d.ts +10 -5
- package/dist/api/resources/providers/client/Client.js +77 -36
- package/dist/api/resources/runs/client/Client.d.ts +8 -4
- package/dist/api/resources/runs/client/Client.js +74 -38
- package/dist/api/resources/runs/resources/messages/client/Client.d.ts +2 -1
- package/dist/api/resources/runs/resources/messages/client/Client.js +21 -12
- package/dist/api/resources/runs/resources/steps/client/Client.d.ts +2 -1
- package/dist/api/resources/runs/resources/steps/client/Client.js +19 -10
- package/dist/api/resources/runs/resources/usage/client/Client.d.ts +2 -1
- package/dist/api/resources/runs/resources/usage/client/Client.js +18 -9
- package/dist/api/resources/sources/client/Client.d.ts +20 -10
- package/dist/api/resources/sources/client/Client.js +173 -86
- package/dist/api/resources/sources/resources/files/client/Client.d.ts +6 -3
- package/dist/api/resources/sources/resources/files/client/Client.js +48 -24
- package/dist/api/resources/sources/resources/passages/client/Client.d.ts +2 -1
- package/dist/api/resources/sources/resources/passages/client/Client.js +19 -10
- package/dist/api/resources/steps/client/Client.d.ts +4 -2
- package/dist/api/resources/steps/client/Client.js +41 -21
- package/dist/api/resources/steps/resources/feedback/client/Client.d.ts +2 -1
- package/dist/api/resources/steps/resources/feedback/client/Client.js +23 -12
- package/dist/api/resources/tags/client/Client.d.ts +2 -1
- package/dist/api/resources/tags/client/Client.js +19 -10
- package/dist/api/resources/telemetry/client/Client.d.ts +2 -1
- package/dist/api/resources/telemetry/client/Client.js +18 -9
- package/dist/api/resources/templates/client/Client.d.ts +2 -1
- package/dist/api/resources/templates/client/Client.js +18 -9
- package/dist/api/resources/templates/resources/agents/client/Client.d.ts +2 -1
- package/dist/api/resources/templates/resources/agents/client/Client.js +19 -10
- package/dist/api/resources/tools/client/Client.d.ts +40 -20
- package/dist/api/resources/tools/client/Client.js +356 -182
- package/dist/api/resources/tools/client/requests/ToolRunFromSource.d.ts +2 -0
- package/dist/api/resources/tools/client/requests/ToolUpdate.d.ts +2 -0
- package/dist/api/resources/voice/client/Client.d.ts +2 -1
- package/dist/api/resources/voice/client/Client.js +9 -3
- package/dist/api/types/AgentState.d.ts +2 -0
- package/dist/api/types/EmbeddingConfig.d.ts +1 -11
- package/dist/api/types/LettaStreamingRequest.d.ts +2 -0
- package/dist/api/types/LlmConfig.d.ts +1 -11
- package/dist/api/types/ModalSandboxConfig.d.ts +4 -0
- package/dist/api/types/ModalSandboxConfigLanguage.d.ts +8 -0
- package/dist/api/types/ModalSandboxConfigLanguage.js +10 -0
- package/dist/api/types/NpmRequirement.d.ts +9 -0
- package/dist/api/types/NpmRequirement.js +5 -0
- package/dist/api/types/Passage.d.ts +4 -4
- package/dist/api/types/Tool.d.ts +2 -0
- package/dist/api/types/ToolCreate.d.ts +2 -0
- package/dist/api/types/ToolType.d.ts +2 -1
- package/dist/api/types/ToolType.js +1 -0
- package/dist/api/types/index.d.ts +2 -0
- package/dist/api/types/index.js +2 -0
- package/dist/core/fetcher/APIResponse.d.ts +10 -0
- package/dist/core/fetcher/Fetcher.d.ts +1 -1
- package/dist/core/fetcher/Fetcher.js +11 -3
- package/dist/core/fetcher/Headers.d.ts +2 -0
- package/dist/core/fetcher/Headers.js +84 -0
- package/dist/core/fetcher/HttpResponsePromise.d.ts +58 -0
- package/dist/core/fetcher/HttpResponsePromise.js +103 -0
- package/dist/core/fetcher/RawResponse.d.ts +29 -0
- package/dist/core/fetcher/RawResponse.js +44 -0
- package/dist/core/fetcher/createRequestUrl.d.ts +1 -1
- package/dist/core/fetcher/getRequestBody.js +2 -1
- package/dist/core/fetcher/index.d.ts +3 -0
- package/dist/core/fetcher/index.js +7 -1
- package/dist/core/fetcher/requestWithRetries.js +1 -1
- package/dist/core/form-data-utils/FormDataWrapper.d.ts +3 -0
- package/dist/core/form-data-utils/FormDataWrapper.js +53 -10
- package/dist/core/form-data-utils/encodeAsFormParameter.d.ts +4 -0
- package/dist/core/form-data-utils/encodeAsFormParameter.js +18 -0
- package/dist/core/form-data-utils/index.d.ts +1 -0
- package/dist/core/form-data-utils/index.js +3 -0
- package/dist/core/json.d.ts +15 -0
- package/dist/core/json.js +24 -0
- package/dist/core/schemas/Schema.d.ts +2 -0
- package/dist/core/schemas/Schema.js +2 -0
- package/dist/core/schemas/builders/bigint/bigint.d.ts +1 -1
- package/dist/core/schemas/builders/bigint/bigint.js +21 -17
- package/dist/core/schemas/builders/object/object.js +1 -0
- package/dist/core/schemas/builders/record/record.js +1 -2
- package/dist/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +4 -0
- package/dist/core/schemas/builders/schema-utils/getSchemaUtils.js +64 -0
- package/dist/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +1 -1
- package/dist/errors/LettaError.d.ts +4 -1
- package/dist/errors/LettaError.js +6 -8
- package/dist/serialization/resources/agents/client/requests/CreateAgentRequest.d.ts +1 -0
- package/dist/serialization/resources/agents/client/requests/CreateAgentRequest.js +1 -0
- package/dist/serialization/resources/agents/client/requests/UpdateAgent.d.ts +1 -0
- package/dist/serialization/resources/agents/client/requests/UpdateAgent.js +1 -0
- package/dist/serialization/resources/agents/resources/passages/client/requests/PassageUpdate.d.ts +1 -1
- package/dist/serialization/resources/agents/resources/passages/client/requests/PassageUpdate.js +1 -1
- package/dist/serialization/resources/tools/client/requests/ToolRunFromSource.d.ts +2 -0
- package/dist/serialization/resources/tools/client/requests/ToolRunFromSource.js +2 -0
- package/dist/serialization/resources/tools/client/requests/ToolUpdate.d.ts +2 -0
- package/dist/serialization/resources/tools/client/requests/ToolUpdate.js +2 -0
- package/dist/serialization/types/AgentState.d.ts +1 -0
- package/dist/serialization/types/AgentState.js +1 -0
- package/dist/serialization/types/LettaStreamingRequest.d.ts +1 -0
- package/dist/serialization/types/LettaStreamingRequest.js +1 -0
- package/dist/serialization/types/ModalSandboxConfig.d.ts +3 -0
- package/dist/serialization/types/ModalSandboxConfig.js +3 -0
- package/dist/serialization/types/ModalSandboxConfigLanguage.d.ts +10 -0
- package/dist/serialization/types/ModalSandboxConfigLanguage.js +41 -0
- package/dist/serialization/types/NpmRequirement.d.ts +13 -0
- package/dist/serialization/types/NpmRequirement.js +44 -0
- package/dist/serialization/types/Passage.d.ts +1 -1
- package/dist/serialization/types/Passage.js +1 -1
- package/dist/serialization/types/Tool.d.ts +2 -0
- package/dist/serialization/types/Tool.js +2 -0
- package/dist/serialization/types/ToolCreate.d.ts +2 -0
- package/dist/serialization/types/ToolCreate.js +2 -0
- package/dist/serialization/types/ToolType.d.ts +1 -1
- package/dist/serialization/types/ToolType.js +1 -0
- package/dist/serialization/types/index.d.ts +2 -0
- package/dist/serialization/types/index.js +2 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/errors/LettaError.d.ts +4 -1
- package/errors/LettaError.js +6 -8
- package/package.json +4 -4
- package/serialization/resources/agents/client/requests/CreateAgentRequest.d.ts +1 -0
- package/serialization/resources/agents/client/requests/CreateAgentRequest.js +1 -0
- package/serialization/resources/agents/client/requests/UpdateAgent.d.ts +1 -0
- package/serialization/resources/agents/client/requests/UpdateAgent.js +1 -0
- package/serialization/resources/agents/resources/passages/client/requests/PassageUpdate.d.ts +1 -1
- package/serialization/resources/agents/resources/passages/client/requests/PassageUpdate.js +1 -1
- package/serialization/resources/tools/client/requests/ToolRunFromSource.d.ts +2 -0
- package/serialization/resources/tools/client/requests/ToolRunFromSource.js +2 -0
- package/serialization/resources/tools/client/requests/ToolUpdate.d.ts +2 -0
- package/serialization/resources/tools/client/requests/ToolUpdate.js +2 -0
- package/serialization/types/AgentState.d.ts +1 -0
- package/serialization/types/AgentState.js +1 -0
- package/serialization/types/LettaStreamingRequest.d.ts +1 -0
- package/serialization/types/LettaStreamingRequest.js +1 -0
- package/serialization/types/ModalSandboxConfig.d.ts +3 -0
- package/serialization/types/ModalSandboxConfig.js +3 -0
- package/serialization/types/ModalSandboxConfigLanguage.d.ts +10 -0
- package/serialization/types/ModalSandboxConfigLanguage.js +41 -0
- package/serialization/types/NpmRequirement.d.ts +13 -0
- package/serialization/types/NpmRequirement.js +44 -0
- package/serialization/types/Passage.d.ts +1 -1
- package/serialization/types/Passage.js +1 -1
- package/serialization/types/Tool.d.ts +2 -0
- package/serialization/types/Tool.js +2 -0
- package/serialization/types/ToolCreate.d.ts +2 -0
- package/serialization/types/ToolCreate.js +2 -0
- package/serialization/types/ToolType.d.ts +1 -1
- package/serialization/types/ToolType.js +1 -0
- package/serialization/types/index.d.ts +2 -0
- package/serialization/types/index.js +2 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -28,4 +28,6 @@ export interface ToolRunFromSource {
|
|
|
28
28
|
jsonSchema?: Record<string, unknown>;
|
|
29
29
|
/** Optional list of pip packages required by this tool. */
|
|
30
30
|
pipRequirements?: Letta.PipRequirement[];
|
|
31
|
+
/** Optional list of npm packages required by this tool. */
|
|
32
|
+
npmRequirements?: Letta.NpmRequirement[];
|
|
31
33
|
}
|
|
@@ -23,4 +23,6 @@ export interface ToolUpdate {
|
|
|
23
23
|
returnCharLimit?: number;
|
|
24
24
|
/** Optional list of pip packages required by this tool. */
|
|
25
25
|
pipRequirements?: Letta.PipRequirement[];
|
|
26
|
+
/** Optional list of npm packages required by this tool. */
|
|
27
|
+
npmRequirements?: Letta.NpmRequirement[];
|
|
26
28
|
}
|
|
@@ -44,7 +44,8 @@ export declare class Voice {
|
|
|
44
44
|
* }
|
|
45
45
|
* })
|
|
46
46
|
*/
|
|
47
|
-
createVoiceChatCompletions(agentId: string, request: Letta.CreateVoiceChatCompletionsRequest, requestOptions?: Voice.RequestOptions):
|
|
47
|
+
createVoiceChatCompletions(agentId: string, request: Letta.CreateVoiceChatCompletionsRequest, requestOptions?: Voice.RequestOptions): core.HttpResponsePromise<unknown>;
|
|
48
|
+
private __createVoiceChatCompletions;
|
|
48
49
|
protected _getCustomAuthorizationHeaders(): Promise<{
|
|
49
50
|
Authorization: string;
|
|
50
51
|
}>;
|
|
@@ -74,6 +74,9 @@ class Voice {
|
|
|
74
74
|
* })
|
|
75
75
|
*/
|
|
76
76
|
createVoiceChatCompletions(agentId, request, requestOptions) {
|
|
77
|
+
return core.HttpResponsePromise.fromPromise(this.__createVoiceChatCompletions(agentId, request, requestOptions));
|
|
78
|
+
}
|
|
79
|
+
__createVoiceChatCompletions(agentId, request, requestOptions) {
|
|
77
80
|
return __awaiter(this, void 0, void 0, function* () {
|
|
78
81
|
var _a, _b, _c;
|
|
79
82
|
const { userId, body: _body } = request;
|
|
@@ -82,7 +85,7 @@ class Voice {
|
|
|
82
85
|
method: "POST",
|
|
83
86
|
headers: Object.assign(Object.assign({ "X-Project": (yield core.Supplier.get(this._options.project)) != null
|
|
84
87
|
? yield core.Supplier.get(this._options.project)
|
|
85
|
-
: undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.
|
|
88
|
+
: undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.173", "User-Agent": "@letta-ai/letta-client/0.1.173", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, "user-id": userId != null ? userId : undefined }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
86
89
|
contentType: "application/json",
|
|
87
90
|
requestType: "json",
|
|
88
91
|
body: serializers.voice.createVoiceChatCompletions.Request.jsonOrThrow(_body, {
|
|
@@ -93,7 +96,7 @@ class Voice {
|
|
|
93
96
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
94
97
|
});
|
|
95
98
|
if (_response.ok) {
|
|
96
|
-
return _response.body;
|
|
99
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
97
100
|
}
|
|
98
101
|
if (_response.error.reason === "status-code") {
|
|
99
102
|
switch (_response.error.statusCode) {
|
|
@@ -104,11 +107,12 @@ class Voice {
|
|
|
104
107
|
allowUnrecognizedEnumValues: true,
|
|
105
108
|
skipValidation: true,
|
|
106
109
|
breadcrumbsPrefix: ["response"],
|
|
107
|
-
}));
|
|
110
|
+
}), _response.rawResponse);
|
|
108
111
|
default:
|
|
109
112
|
throw new errors.LettaError({
|
|
110
113
|
statusCode: _response.error.statusCode,
|
|
111
114
|
body: _response.error.body,
|
|
115
|
+
rawResponse: _response.rawResponse,
|
|
112
116
|
});
|
|
113
117
|
}
|
|
114
118
|
}
|
|
@@ -117,12 +121,14 @@ class Voice {
|
|
|
117
121
|
throw new errors.LettaError({
|
|
118
122
|
statusCode: _response.error.statusCode,
|
|
119
123
|
body: _response.error.rawBody,
|
|
124
|
+
rawResponse: _response.rawResponse,
|
|
120
125
|
});
|
|
121
126
|
case "timeout":
|
|
122
127
|
throw new errors.LettaTimeoutError("Timeout exceeded when calling POST /v1/voice-beta/{agent_id}/chat/completions.");
|
|
123
128
|
case "unknown":
|
|
124
129
|
throw new errors.LettaError({
|
|
125
130
|
message: _response.error.errorMessage,
|
|
131
|
+
rawResponse: _response.rawResponse,
|
|
126
132
|
});
|
|
127
133
|
}
|
|
128
134
|
});
|
|
@@ -81,4 +81,6 @@ export interface AgentState {
|
|
|
81
81
|
maxFilesOpen?: number;
|
|
82
82
|
/** The per-file view window character limit for this agent. Setting this too high may exceed the context window, which will break the agent. */
|
|
83
83
|
perFileViewWindowCharLimit?: number;
|
|
84
|
+
/** If set to True, the agent will be hidden. */
|
|
85
|
+
hidden?: boolean;
|
|
84
86
|
}
|
|
@@ -3,17 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as Letta from "../index";
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* Attributes:
|
|
9
|
-
* embedding_endpoint_type (str): The endpoint type for the model.
|
|
10
|
-
* embedding_endpoint (str): The endpoint for the model.
|
|
11
|
-
* embedding_model (str): The model for the embedding.
|
|
12
|
-
* embedding_dim (int): The dimension of the embedding.
|
|
13
|
-
* embedding_chunk_size (int): The chunk size of the embedding.
|
|
14
|
-
* azure_endpoint (:obj:`str`, optional): The Azure endpoint for the model (Azure only).
|
|
15
|
-
* azure_version (str): The Azure version for the model (Azure only).
|
|
16
|
-
* azure_deployment (str): The Azure deployment for the model (Azure only).
|
|
6
|
+
* Configuration for embedding model connection and processing parameters.
|
|
17
7
|
*/
|
|
18
8
|
export interface EmbeddingConfig {
|
|
19
9
|
/** The endpoint type for the model. */
|
|
@@ -19,4 +19,6 @@ export interface LettaStreamingRequest {
|
|
|
19
19
|
enableThinking?: string;
|
|
20
20
|
/** Flag to determine if individual tokens should be streamed. Set to True for token streaming (requires stream_steps = True). */
|
|
21
21
|
streamTokens?: boolean;
|
|
22
|
+
/** Whether to include periodic keepalive ping messages in the stream to prevent connection timeouts. */
|
|
23
|
+
includePings?: boolean;
|
|
22
24
|
}
|
package/api/types/LlmConfig.d.ts
CHANGED
|
@@ -3,17 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as Letta from "../index";
|
|
5
5
|
/**
|
|
6
|
-
* Configuration for
|
|
7
|
-
*
|
|
8
|
-
* Attributes:
|
|
9
|
-
* model (str): The name of the LLM model.
|
|
10
|
-
* model_endpoint_type (str): The endpoint type for the model.
|
|
11
|
-
* model_endpoint (str): The endpoint for the model.
|
|
12
|
-
* model_wrapper (str): The wrapper for the model. This is used to wrap additional text around the input/output of the model. This is useful for text-to-text completions, such as the Completions API in OpenAI.
|
|
13
|
-
* context_window (int): The context window size for the model.
|
|
14
|
-
* put_inner_thoughts_in_kwargs (bool): Puts `inner_thoughts` as a kwarg in the function call if this is set to True. This helps with function calling performance and also the generation of inner thoughts.
|
|
15
|
-
* temperature (float): The temperature to use when generating text with the model. A higher temperature will result in more random text.
|
|
16
|
-
* max_tokens (int): The maximum number of tokens to generate.
|
|
6
|
+
* Configuration for Language Model (LLM) connection and generation parameters.
|
|
17
7
|
*/
|
|
18
8
|
export interface LlmConfig {
|
|
19
9
|
/** LLM model name. */
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
+
import * as Letta from "../index";
|
|
4
5
|
export interface ModalSandboxConfig {
|
|
5
6
|
/** Time limit for the sandbox (in seconds). */
|
|
6
7
|
timeout?: number;
|
|
7
8
|
/** A list of pip packages to install in the Modal sandbox */
|
|
8
9
|
pipRequirements?: string[];
|
|
10
|
+
/** A list of npm packages to install in the Modal sandbox */
|
|
11
|
+
npmRequirements?: string[];
|
|
12
|
+
language?: Letta.ModalSandboxConfigLanguage;
|
|
9
13
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
export type ModalSandboxConfigLanguage = "python" | "typescript";
|
|
5
|
+
export declare const ModalSandboxConfigLanguage: {
|
|
6
|
+
readonly Python: "python";
|
|
7
|
+
readonly Typescript: "typescript";
|
|
8
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ModalSandboxConfigLanguage = void 0;
|
|
7
|
+
exports.ModalSandboxConfigLanguage = {
|
|
8
|
+
Python: "python",
|
|
9
|
+
Typescript: "typescript",
|
|
10
|
+
};
|
package/api/types/Passage.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ import * as Letta from "../index";
|
|
|
10
10
|
* embedding (List[float]): The embedding of the passage.
|
|
11
11
|
* embedding_config (EmbeddingConfig): The embedding configuration used by the passage.
|
|
12
12
|
* created_at (datetime): The creation date of the passage.
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* organization_id (str): The unique identifier of the organization associated with the passage.
|
|
14
|
+
* archive_id (str): The unique identifier of the archive containing this passage.
|
|
15
15
|
* source_id (str): The data source of the passage.
|
|
16
16
|
* file_id (str): The unique identifier of the file associated with the passage.
|
|
17
17
|
*/
|
|
@@ -26,8 +26,8 @@ export interface Passage {
|
|
|
26
26
|
updatedAt?: Date;
|
|
27
27
|
/** Whether this passage is deleted or not. */
|
|
28
28
|
isDeleted?: boolean;
|
|
29
|
-
/** The unique identifier of the
|
|
30
|
-
|
|
29
|
+
/** The unique identifier of the archive containing this passage. */
|
|
30
|
+
archiveId?: string;
|
|
31
31
|
/** The data source of the passage. */
|
|
32
32
|
sourceId?: string;
|
|
33
33
|
/** The unique identifier of the file associated with the passage. */
|
package/api/types/Tool.d.ts
CHANGED
|
@@ -35,6 +35,8 @@ export interface Tool {
|
|
|
35
35
|
returnCharLimit?: number;
|
|
36
36
|
/** Optional list of pip packages required by this tool. */
|
|
37
37
|
pipRequirements?: Letta.PipRequirement[];
|
|
38
|
+
/** Optional list of npm packages required by this tool. */
|
|
39
|
+
npmRequirements?: Letta.NpmRequirement[];
|
|
38
40
|
/** The id of the user that made this Tool. */
|
|
39
41
|
createdById?: string;
|
|
40
42
|
/** The id of the user that made this Tool. */
|
|
@@ -19,4 +19,6 @@ export interface ToolCreate {
|
|
|
19
19
|
returnCharLimit?: number;
|
|
20
20
|
/** Optional list of pip packages required by this tool. */
|
|
21
21
|
pipRequirements?: Letta.PipRequirement[];
|
|
22
|
+
/** Optional list of npm packages required by this tool. */
|
|
23
|
+
npmRequirements?: Letta.NpmRequirement[];
|
|
22
24
|
}
|
package/api/types/ToolType.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
-
export type ToolType = "custom" | "letta_core" | "letta_memory_core" | "letta_multi_agent_core" | "letta_sleeptime_core" | "letta_voice_sleeptime_core" | "letta_builtin" | "letta_files_core" | "external_composio" | "external_mcp";
|
|
4
|
+
export type ToolType = "custom" | "letta_core" | "letta_memory_core" | "letta_multi_agent_core" | "letta_sleeptime_core" | "letta_voice_sleeptime_core" | "letta_builtin" | "letta_files_core" | "external_composio" | "external_langchain" | "external_mcp";
|
|
5
5
|
export declare const ToolType: {
|
|
6
6
|
readonly Custom: "custom";
|
|
7
7
|
readonly LettaCore: "letta_core";
|
|
@@ -12,5 +12,6 @@ export declare const ToolType: {
|
|
|
12
12
|
readonly LettaBuiltin: "letta_builtin";
|
|
13
13
|
readonly LettaFilesCore: "letta_files_core";
|
|
14
14
|
readonly ExternalComposio: "external_composio";
|
|
15
|
+
readonly ExternalLangchain: "external_langchain";
|
|
15
16
|
readonly ExternalMcp: "external_mcp";
|
|
16
17
|
};
|
package/api/types/ToolType.js
CHANGED
package/api/types/index.d.ts
CHANGED
|
@@ -157,7 +157,9 @@ export * from "./MessageCreate";
|
|
|
157
157
|
export * from "./MessageRole";
|
|
158
158
|
export * from "./MessageSchema";
|
|
159
159
|
export * from "./MessageType";
|
|
160
|
+
export * from "./ModalSandboxConfigLanguage";
|
|
160
161
|
export * from "./ModalSandboxConfig";
|
|
162
|
+
export * from "./NpmRequirement";
|
|
161
163
|
export * from "./OmittedReasoningContent";
|
|
162
164
|
export * from "./Organization";
|
|
163
165
|
export * from "./OrganizationCreate";
|
package/api/types/index.js
CHANGED
|
@@ -173,7 +173,9 @@ __exportStar(require("./MessageCreate"), exports);
|
|
|
173
173
|
__exportStar(require("./MessageRole"), exports);
|
|
174
174
|
__exportStar(require("./MessageSchema"), exports);
|
|
175
175
|
__exportStar(require("./MessageType"), exports);
|
|
176
|
+
__exportStar(require("./ModalSandboxConfigLanguage"), exports);
|
|
176
177
|
__exportStar(require("./ModalSandboxConfig"), exports);
|
|
178
|
+
__exportStar(require("./NpmRequirement"), exports);
|
|
177
179
|
__exportStar(require("./OmittedReasoningContent"), exports);
|
|
178
180
|
__exportStar(require("./Organization"), exports);
|
|
179
181
|
__exportStar(require("./OrganizationCreate"), exports);
|
|
@@ -1,10 +1,20 @@
|
|
|
1
|
+
import { RawResponse } from "./RawResponse";
|
|
2
|
+
/**
|
|
3
|
+
* The response of an API call.
|
|
4
|
+
* It is a successful response or a failed response.
|
|
5
|
+
*/
|
|
1
6
|
export type APIResponse<Success, Failure> = SuccessfulResponse<Success> | FailedResponse<Failure>;
|
|
2
7
|
export interface SuccessfulResponse<T> {
|
|
3
8
|
ok: true;
|
|
4
9
|
body: T;
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Use `rawResponse` instead
|
|
12
|
+
*/
|
|
5
13
|
headers?: Record<string, any>;
|
|
14
|
+
rawResponse: RawResponse;
|
|
6
15
|
}
|
|
7
16
|
export interface FailedResponse<T> {
|
|
8
17
|
ok: false;
|
|
9
18
|
error: T;
|
|
19
|
+
rawResponse: RawResponse;
|
|
10
20
|
}
|
|
@@ -6,7 +6,7 @@ export declare namespace Fetcher {
|
|
|
6
6
|
method: string;
|
|
7
7
|
contentType?: string;
|
|
8
8
|
headers?: Record<string, string | undefined>;
|
|
9
|
-
queryParameters?: Record<string, string | string[] | object | object[]>;
|
|
9
|
+
queryParameters?: Record<string, string | string[] | object | object[] | null>;
|
|
10
10
|
body?: unknown;
|
|
11
11
|
timeoutMs?: number;
|
|
12
12
|
maxRetries?: number;
|
package/core/fetcher/Fetcher.js
CHANGED
|
@@ -11,6 +11,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.fetcher = void 0;
|
|
13
13
|
exports.fetcherImpl = fetcherImpl;
|
|
14
|
+
const json_1 = require("../json");
|
|
15
|
+
const RawResponse_1 = require("./RawResponse");
|
|
14
16
|
const createRequestUrl_1 = require("./createRequestUrl");
|
|
15
17
|
const getFetchFn_1 = require("./getFetchFn");
|
|
16
18
|
const getRequestBody_1 = require("./getRequestBody");
|
|
@@ -31,7 +33,7 @@ function fetcherImpl(args) {
|
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
const url = (0, createRequestUrl_1.createRequestUrl)(args.url, args.queryParameters);
|
|
34
|
-
|
|
36
|
+
const requestBody = yield (0, getRequestBody_1.getRequestBody)({
|
|
35
37
|
body: args.body,
|
|
36
38
|
type: args.requestType === "json" ? "json" : "other",
|
|
37
39
|
});
|
|
@@ -40,12 +42,13 @@ function fetcherImpl(args) {
|
|
|
40
42
|
const response = yield (0, requestWithRetries_1.requestWithRetries)(() => __awaiter(this, void 0, void 0, function* () {
|
|
41
43
|
return (0, makeRequest_1.makeRequest)(fetchFn, url, args.method, headers, requestBody, args.timeoutMs, args.abortSignal, args.withCredentials, args.duplex);
|
|
42
44
|
}), args.maxRetries);
|
|
43
|
-
|
|
45
|
+
const responseBody = yield (0, getResponseBody_1.getResponseBody)(response, args.responseType);
|
|
44
46
|
if (response.status >= 200 && response.status < 400) {
|
|
45
47
|
return {
|
|
46
48
|
ok: true,
|
|
47
49
|
body: responseBody,
|
|
48
50
|
headers: response.headers,
|
|
51
|
+
rawResponse: (0, RawResponse_1.toRawResponse)(response),
|
|
49
52
|
};
|
|
50
53
|
}
|
|
51
54
|
else {
|
|
@@ -56,6 +59,7 @@ function fetcherImpl(args) {
|
|
|
56
59
|
statusCode: response.status,
|
|
57
60
|
body: responseBody,
|
|
58
61
|
},
|
|
62
|
+
rawResponse: (0, RawResponse_1.toRawResponse)(response),
|
|
59
63
|
};
|
|
60
64
|
}
|
|
61
65
|
}
|
|
@@ -67,6 +71,7 @@ function fetcherImpl(args) {
|
|
|
67
71
|
reason: "unknown",
|
|
68
72
|
errorMessage: "The user aborted a request",
|
|
69
73
|
},
|
|
74
|
+
rawResponse: RawResponse_1.abortRawResponse,
|
|
70
75
|
};
|
|
71
76
|
}
|
|
72
77
|
else if (error instanceof Error && error.name === "AbortError") {
|
|
@@ -75,6 +80,7 @@ function fetcherImpl(args) {
|
|
|
75
80
|
error: {
|
|
76
81
|
reason: "timeout",
|
|
77
82
|
},
|
|
83
|
+
rawResponse: RawResponse_1.abortRawResponse,
|
|
78
84
|
};
|
|
79
85
|
}
|
|
80
86
|
else if (error instanceof Error) {
|
|
@@ -84,14 +90,16 @@ function fetcherImpl(args) {
|
|
|
84
90
|
reason: "unknown",
|
|
85
91
|
errorMessage: error.message,
|
|
86
92
|
},
|
|
93
|
+
rawResponse: RawResponse_1.unknownRawResponse,
|
|
87
94
|
};
|
|
88
95
|
}
|
|
89
96
|
return {
|
|
90
97
|
ok: false,
|
|
91
98
|
error: {
|
|
92
99
|
reason: "unknown",
|
|
93
|
-
errorMessage:
|
|
100
|
+
errorMessage: (0, json_1.toJson)(error),
|
|
94
101
|
},
|
|
102
|
+
rawResponse: RawResponse_1.unknownRawResponse,
|
|
95
103
|
};
|
|
96
104
|
}
|
|
97
105
|
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Headers = void 0;
|
|
4
|
+
let Headers;
|
|
5
|
+
if (typeof globalThis.Headers !== "undefined") {
|
|
6
|
+
exports.Headers = Headers = globalThis.Headers;
|
|
7
|
+
}
|
|
8
|
+
else {
|
|
9
|
+
exports.Headers = Headers = class Headers {
|
|
10
|
+
constructor(init) {
|
|
11
|
+
this.headers = new Map();
|
|
12
|
+
if (init) {
|
|
13
|
+
if (init instanceof Headers) {
|
|
14
|
+
init.forEach((value, key) => this.append(key, value));
|
|
15
|
+
}
|
|
16
|
+
else if (Array.isArray(init)) {
|
|
17
|
+
for (const [key, value] of init) {
|
|
18
|
+
if (typeof key === "string" && typeof value === "string") {
|
|
19
|
+
this.append(key, value);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
throw new TypeError("Each header entry must be a [string, string] tuple");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
for (const [key, value] of Object.entries(init)) {
|
|
28
|
+
if (typeof value === "string") {
|
|
29
|
+
this.append(key, value);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
throw new TypeError("Header values must be strings");
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
append(name, value) {
|
|
39
|
+
const key = name.toLowerCase();
|
|
40
|
+
const existing = this.headers.get(key) || [];
|
|
41
|
+
this.headers.set(key, [...existing, value]);
|
|
42
|
+
}
|
|
43
|
+
delete(name) {
|
|
44
|
+
const key = name.toLowerCase();
|
|
45
|
+
this.headers.delete(key);
|
|
46
|
+
}
|
|
47
|
+
get(name) {
|
|
48
|
+
const key = name.toLowerCase();
|
|
49
|
+
const values = this.headers.get(key);
|
|
50
|
+
return values ? values.join(", ") : null;
|
|
51
|
+
}
|
|
52
|
+
has(name) {
|
|
53
|
+
const key = name.toLowerCase();
|
|
54
|
+
return this.headers.has(key);
|
|
55
|
+
}
|
|
56
|
+
set(name, value) {
|
|
57
|
+
const key = name.toLowerCase();
|
|
58
|
+
this.headers.set(key, [value]);
|
|
59
|
+
}
|
|
60
|
+
forEach(callbackfn, thisArg) {
|
|
61
|
+
const boundCallback = thisArg ? callbackfn.bind(thisArg) : callbackfn;
|
|
62
|
+
this.headers.forEach((values, key) => boundCallback(values.join(", "), key, this));
|
|
63
|
+
}
|
|
64
|
+
getSetCookie() {
|
|
65
|
+
return this.headers.get("set-cookie") || [];
|
|
66
|
+
}
|
|
67
|
+
*entries() {
|
|
68
|
+
for (const [key, values] of this.headers.entries()) {
|
|
69
|
+
yield [key, values.join(", ")];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
*keys() {
|
|
73
|
+
yield* this.headers.keys();
|
|
74
|
+
}
|
|
75
|
+
*values() {
|
|
76
|
+
for (const values of this.headers.values()) {
|
|
77
|
+
yield values.join(", ");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
[Symbol.iterator]() {
|
|
81
|
+
return this.entries();
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { WithRawResponse } from "./RawResponse";
|
|
2
|
+
/**
|
|
3
|
+
* A promise that returns the parsed response and lets you retrieve the raw response too.
|
|
4
|
+
*/
|
|
5
|
+
export declare class HttpResponsePromise<T> extends Promise<T> {
|
|
6
|
+
private innerPromise;
|
|
7
|
+
private unwrappedPromise;
|
|
8
|
+
private constructor();
|
|
9
|
+
/**
|
|
10
|
+
* Creates an `HttpResponsePromise` from a function that returns a promise.
|
|
11
|
+
*
|
|
12
|
+
* @param fn - A function that returns a promise resolving to a `WithRawResponse` object.
|
|
13
|
+
* @param args - Arguments to pass to the function.
|
|
14
|
+
* @returns An `HttpResponsePromise` instance.
|
|
15
|
+
*/
|
|
16
|
+
static fromFunction<F extends (...args: never[]) => Promise<WithRawResponse<T>>, T>(fn: F, ...args: Parameters<F>): HttpResponsePromise<T>;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a function that returns an `HttpResponsePromise` from a function that returns a promise.
|
|
19
|
+
*
|
|
20
|
+
* @param fn - A function that returns a promise resolving to a `WithRawResponse` object.
|
|
21
|
+
* @returns A function that returns an `HttpResponsePromise` instance.
|
|
22
|
+
*/
|
|
23
|
+
static interceptFunction<F extends (...args: never[]) => Promise<WithRawResponse<T>>, T = Awaited<ReturnType<F>>["data"]>(fn: F): (...args: Parameters<F>) => HttpResponsePromise<T>;
|
|
24
|
+
/**
|
|
25
|
+
* Creates an `HttpResponsePromise` from an existing promise.
|
|
26
|
+
*
|
|
27
|
+
* @param promise - A promise resolving to a `WithRawResponse` object.
|
|
28
|
+
* @returns An `HttpResponsePromise` instance.
|
|
29
|
+
*/
|
|
30
|
+
static fromPromise<T>(promise: Promise<WithRawResponse<T>>): HttpResponsePromise<T>;
|
|
31
|
+
/**
|
|
32
|
+
* Creates an `HttpResponsePromise` from an executor function.
|
|
33
|
+
*
|
|
34
|
+
* @param executor - A function that takes resolve and reject callbacks to create a promise.
|
|
35
|
+
* @returns An `HttpResponsePromise` instance.
|
|
36
|
+
*/
|
|
37
|
+
static fromExecutor<T>(executor: (resolve: (value: WithRawResponse<T>) => void, reject: (reason?: unknown) => void) => void): HttpResponsePromise<T>;
|
|
38
|
+
/**
|
|
39
|
+
* Creates an `HttpResponsePromise` from a resolved result.
|
|
40
|
+
*
|
|
41
|
+
* @param result - A `WithRawResponse` object to resolve immediately.
|
|
42
|
+
* @returns An `HttpResponsePromise` instance.
|
|
43
|
+
*/
|
|
44
|
+
static fromResult<T>(result: WithRawResponse<T>): HttpResponsePromise<T>;
|
|
45
|
+
private unwrap;
|
|
46
|
+
/** @inheritdoc */
|
|
47
|
+
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
48
|
+
/** @inheritdoc */
|
|
49
|
+
catch<TResult = never>(onrejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
|
|
50
|
+
/** @inheritdoc */
|
|
51
|
+
finally(onfinally?: (() => void) | null): Promise<T>;
|
|
52
|
+
/**
|
|
53
|
+
* Retrieves the data and raw response.
|
|
54
|
+
*
|
|
55
|
+
* @returns A promise resolving to a `WithRawResponse` object.
|
|
56
|
+
*/
|
|
57
|
+
withRawResponse(): Promise<WithRawResponse<T>>;
|
|
58
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
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.HttpResponsePromise = void 0;
|
|
13
|
+
/**
|
|
14
|
+
* A promise that returns the parsed response and lets you retrieve the raw response too.
|
|
15
|
+
*/
|
|
16
|
+
class HttpResponsePromise extends Promise {
|
|
17
|
+
constructor(promise) {
|
|
18
|
+
// Initialize with a no-op to avoid premature parsing
|
|
19
|
+
super((resolve) => {
|
|
20
|
+
resolve(undefined);
|
|
21
|
+
});
|
|
22
|
+
this.innerPromise = promise;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Creates an `HttpResponsePromise` from a function that returns a promise.
|
|
26
|
+
*
|
|
27
|
+
* @param fn - A function that returns a promise resolving to a `WithRawResponse` object.
|
|
28
|
+
* @param args - Arguments to pass to the function.
|
|
29
|
+
* @returns An `HttpResponsePromise` instance.
|
|
30
|
+
*/
|
|
31
|
+
static fromFunction(fn, ...args) {
|
|
32
|
+
return new HttpResponsePromise(fn(...args));
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Creates a function that returns an `HttpResponsePromise` from a function that returns a promise.
|
|
36
|
+
*
|
|
37
|
+
* @param fn - A function that returns a promise resolving to a `WithRawResponse` object.
|
|
38
|
+
* @returns A function that returns an `HttpResponsePromise` instance.
|
|
39
|
+
*/
|
|
40
|
+
static interceptFunction(fn) {
|
|
41
|
+
return (...args) => {
|
|
42
|
+
return HttpResponsePromise.fromPromise(fn(...args));
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Creates an `HttpResponsePromise` from an existing promise.
|
|
47
|
+
*
|
|
48
|
+
* @param promise - A promise resolving to a `WithRawResponse` object.
|
|
49
|
+
* @returns An `HttpResponsePromise` instance.
|
|
50
|
+
*/
|
|
51
|
+
static fromPromise(promise) {
|
|
52
|
+
return new HttpResponsePromise(promise);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Creates an `HttpResponsePromise` from an executor function.
|
|
56
|
+
*
|
|
57
|
+
* @param executor - A function that takes resolve and reject callbacks to create a promise.
|
|
58
|
+
* @returns An `HttpResponsePromise` instance.
|
|
59
|
+
*/
|
|
60
|
+
static fromExecutor(executor) {
|
|
61
|
+
const promise = new Promise(executor);
|
|
62
|
+
return new HttpResponsePromise(promise);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Creates an `HttpResponsePromise` from a resolved result.
|
|
66
|
+
*
|
|
67
|
+
* @param result - A `WithRawResponse` object to resolve immediately.
|
|
68
|
+
* @returns An `HttpResponsePromise` instance.
|
|
69
|
+
*/
|
|
70
|
+
static fromResult(result) {
|
|
71
|
+
const promise = Promise.resolve(result);
|
|
72
|
+
return new HttpResponsePromise(promise);
|
|
73
|
+
}
|
|
74
|
+
unwrap() {
|
|
75
|
+
if (!this.unwrappedPromise) {
|
|
76
|
+
this.unwrappedPromise = this.innerPromise.then(({ data }) => data);
|
|
77
|
+
}
|
|
78
|
+
return this.unwrappedPromise;
|
|
79
|
+
}
|
|
80
|
+
/** @inheritdoc */
|
|
81
|
+
then(onfulfilled, onrejected) {
|
|
82
|
+
return this.unwrap().then(onfulfilled, onrejected);
|
|
83
|
+
}
|
|
84
|
+
/** @inheritdoc */
|
|
85
|
+
catch(onrejected) {
|
|
86
|
+
return this.unwrap().catch(onrejected);
|
|
87
|
+
}
|
|
88
|
+
/** @inheritdoc */
|
|
89
|
+
finally(onfinally) {
|
|
90
|
+
return this.unwrap().finally(onfinally);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Retrieves the data and raw response.
|
|
94
|
+
*
|
|
95
|
+
* @returns A promise resolving to a `WithRawResponse` object.
|
|
96
|
+
*/
|
|
97
|
+
withRawResponse() {
|
|
98
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
return yield this.innerPromise;
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
exports.HttpResponsePromise = HttpResponsePromise;
|