@cadenya/cadenya 0.135.0 → 1.0.0
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 +86 -358
- package/api.md +781 -0
- package/dist/client.d.ts +69 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +97 -0
- package/dist/client.js.map +1 -0
- package/dist/core/error.d.ts +39 -0
- package/dist/core/error.d.ts.map +1 -0
- package/dist/core/error.js +56 -0
- package/dist/core/error.js.map +1 -0
- package/dist/core/http.d.ts +140 -0
- package/dist/core/http.d.ts.map +1 -0
- package/dist/core/http.js +525 -0
- package/dist/core/http.js.map +1 -0
- package/dist/core/pagination.d.ts +12 -0
- package/dist/core/pagination.d.ts.map +1 -0
- package/dist/core/pagination.js +29 -0
- package/dist/core/pagination.js.map +1 -0
- package/dist/core/sse.d.ts +44 -0
- package/dist/core/sse.d.ts.map +1 -0
- package/dist/core/sse.js +350 -0
- package/dist/core/sse.js.map +1 -0
- package/dist/core/webhooks.d.ts +25 -0
- package/dist/core/webhooks.d.ts.map +1 -0
- package/dist/core/webhooks.js +124 -0
- package/dist/core/webhooks.js.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/resources/accounts.d.ts +34 -0
- package/dist/resources/accounts.d.ts.map +1 -0
- package/dist/resources/accounts.js +47 -0
- package/dist/resources/accounts.js.map +1 -0
- package/dist/resources/agent-schedules.d.ts +186 -0
- package/dist/resources/agent-schedules.d.ts.map +1 -0
- package/dist/resources/agent-schedules.js +141 -0
- package/dist/resources/agent-schedules.js.map +1 -0
- package/dist/resources/agent-variations.d.ts +230 -0
- package/dist/resources/agent-variations.d.ts.map +1 -0
- package/dist/resources/agent-variations.js +174 -0
- package/dist/resources/agent-variations.js.map +1 -0
- package/dist/resources/agents.d.ts +318 -0
- package/dist/resources/agents.d.ts.map +1 -0
- package/dist/resources/agents.js +202 -0
- package/dist/resources/agents.js.map +1 -0
- package/dist/resources/ai-provider-keys.d.ts +141 -0
- package/dist/resources/ai-provider-keys.d.ts.map +1 -0
- package/dist/resources/ai-provider-keys.js +93 -0
- package/dist/resources/ai-provider-keys.js.map +1 -0
- package/dist/resources/api-keys.d.ts +222 -0
- package/dist/resources/api-keys.d.ts.map +1 -0
- package/dist/resources/api-keys.js +194 -0
- package/dist/resources/api-keys.js.map +1 -0
- package/dist/resources/memory-entries.d.ts +122 -0
- package/dist/resources/memory-entries.d.ts.map +1 -0
- package/dist/resources/memory-entries.js +93 -0
- package/dist/resources/memory-entries.js.map +1 -0
- package/dist/resources/memory-layers.d.ts +137 -0
- package/dist/resources/memory-layers.d.ts.map +1 -0
- package/dist/resources/memory-layers.js +97 -0
- package/dist/resources/memory-layers.js.map +1 -0
- package/dist/resources/models.d.ts +148 -0
- package/dist/resources/models.d.ts.map +1 -0
- package/dist/resources/models.js +93 -0
- package/dist/resources/models.js.map +1 -0
- package/dist/resources/objectives.d.ts +602 -0
- package/dist/resources/objectives.d.ts.map +1 -0
- package/dist/resources/objectives.js +356 -0
- package/dist/resources/objectives.js.map +1 -0
- package/dist/resources/profiles.d.ts +16 -0
- package/dist/resources/profiles.d.ts.map +1 -0
- package/dist/resources/profiles.js +21 -0
- package/dist/resources/profiles.js.map +1 -0
- package/dist/resources/tenants.d.ts +135 -0
- package/dist/resources/tenants.d.ts.map +1 -0
- package/dist/resources/tenants.js +80 -0
- package/dist/resources/tenants.js.map +1 -0
- package/dist/resources/tool-search.d.ts +27 -0
- package/dist/resources/tool-search.d.ts.map +1 -0
- package/dist/resources/tool-search.js +25 -0
- package/dist/resources/tool-search.js.map +1 -0
- package/dist/resources/tool-set-secrets.d.ts +128 -0
- package/dist/resources/tool-set-secrets.d.ts.map +1 -0
- package/dist/resources/tool-set-secrets.js +93 -0
- package/dist/resources/tool-set-secrets.js.map +1 -0
- package/dist/resources/tool-sets.d.ts +271 -0
- package/dist/resources/tool-sets.d.ts.map +1 -0
- package/dist/resources/tool-sets.js +185 -0
- package/dist/resources/tool-sets.js.map +1 -0
- package/dist/resources/tools.d.ts +178 -0
- package/dist/resources/tools.d.ts.map +1 -0
- package/dist/resources/tools.js +125 -0
- package/dist/resources/tools.js.map +1 -0
- package/dist/resources/uploads.d.ts +43 -0
- package/dist/resources/uploads.d.ts.map +1 -0
- package/dist/resources/uploads.js +41 -0
- package/dist/resources/uploads.js.map +1 -0
- package/dist/resources/widget-sessions.d.ts +168 -0
- package/dist/resources/widget-sessions.d.ts.map +1 -0
- package/dist/resources/widget-sessions.js +110 -0
- package/dist/resources/widget-sessions.js.map +1 -0
- package/dist/resources/widgets.d.ts +166 -0
- package/dist/resources/widgets.d.ts.map +1 -0
- package/dist/resources/widgets.js +125 -0
- package/dist/resources/widgets.js.map +1 -0
- package/dist/resources/workspace-admin.d.ts +214 -0
- package/dist/resources/workspace-admin.d.ts.map +1 -0
- package/dist/resources/workspace-admin.js +154 -0
- package/dist/resources/workspace-admin.js.map +1 -0
- package/dist/resources/workspace-secrets.d.ts +134 -0
- package/dist/resources/workspace-secrets.d.ts.map +1 -0
- package/dist/resources/workspace-secrets.js +93 -0
- package/dist/resources/workspace-secrets.js.map +1 -0
- package/dist/resources/workspaces.d.ts +44 -0
- package/dist/resources/workspaces.d.ts.map +1 -0
- package/dist/resources/workspaces.js +26 -0
- package/dist/resources/workspaces.js.map +1 -0
- package/dist/types.d.ts +4634 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +103 -0
- package/dist/types.js.map +1 -0
- package/dist/webhooks.d.ts +93 -0
- package/dist/webhooks.d.ts.map +1 -0
- package/dist/webhooks.js +21 -0
- package/dist/webhooks.js.map +1 -0
- package/package.json +24 -165
- package/src/client.ts +124 -1532
- package/src/core/error.ts +50 -109
- package/src/core/http.ts +639 -0
- package/src/core/pagination.ts +16 -150
- package/src/core/sse.ts +338 -0
- package/src/core/webhooks.ts +141 -0
- package/src/index.ts +35 -20
- package/src/resources/accounts.ts +50 -0
- package/src/resources/agent-schedules.ts +251 -0
- package/src/resources/agent-variations.ts +312 -0
- package/src/resources/agents.ts +411 -1
- package/src/resources/ai-provider-keys.ts +119 -309
- package/src/resources/api-keys.ts +219 -276
- package/src/resources/memory-entries.ts +163 -0
- package/src/resources/memory-layers.ts +181 -1
- package/src/resources/models.ts +125 -372
- package/src/resources/objectives.ts +764 -1
- package/src/resources/profiles.ts +17 -13
- package/src/resources/tenants.ts +168 -1
- package/src/resources/tool-search.ts +36 -0
- package/src/resources/tool-set-secrets.ts +169 -0
- package/src/resources/tool-sets.ts +355 -1
- package/src/resources/tools.ts +235 -0
- package/src/resources/uploads.ts +42 -127
- package/src/resources/widget-sessions.ts +148 -437
- package/src/resources/widgets.ts +155 -247
- package/src/resources/workspace-admin.ts +281 -1
- package/src/resources/workspace-secrets.ts +121 -159
- package/src/resources/workspaces.ts +32 -75
- package/src/types.ts +5188 -0
- package/src/webhooks.ts +107 -0
- package/CHANGELOG.md +0 -1542
- package/api-promise.d.mts +0 -3
- package/api-promise.d.mts.map +0 -1
- package/api-promise.d.ts +0 -3
- package/api-promise.d.ts.map +0 -1
- package/api-promise.js +0 -6
- package/api-promise.js.map +0 -1
- package/api-promise.mjs +0 -3
- package/api-promise.mjs.map +0 -1
- package/client.d.mts +0 -335
- package/client.d.mts.map +0 -1
- package/client.d.ts +0 -335
- package/client.d.ts.map +0 -1
- package/client.js +0 -630
- package/client.js.map +0 -1
- package/client.mjs +0 -626
- package/client.mjs.map +0 -1
- package/core/api-promise.d.mts +0 -46
- package/core/api-promise.d.mts.map +0 -1
- package/core/api-promise.d.ts +0 -46
- package/core/api-promise.d.ts.map +0 -1
- package/core/api-promise.js +0 -73
- package/core/api-promise.js.map +0 -1
- package/core/api-promise.mjs +0 -69
- package/core/api-promise.mjs.map +0 -1
- package/core/error.d.mts +0 -46
- package/core/error.d.mts.map +0 -1
- package/core/error.d.ts +0 -46
- package/core/error.d.ts.map +0 -1
- package/core/error.js +0 -112
- package/core/error.js.map +0 -1
- package/core/error.mjs +0 -96
- package/core/error.mjs.map +0 -1
- package/core/pagination.d.mts +0 -59
- package/core/pagination.d.mts.map +0 -1
- package/core/pagination.d.ts +0 -59
- package/core/pagination.d.ts.map +0 -1
- package/core/pagination.js +0 -100
- package/core/pagination.js.map +0 -1
- package/core/pagination.mjs +0 -94
- package/core/pagination.mjs.map +0 -1
- package/core/resource.d.mts +0 -6
- package/core/resource.d.mts.map +0 -1
- package/core/resource.d.ts +0 -6
- package/core/resource.d.ts.map +0 -1
- package/core/resource.js +0 -10
- package/core/resource.js.map +0 -1
- package/core/resource.mjs +0 -6
- package/core/resource.mjs.map +0 -1
- package/core/streaming.d.mts +0 -33
- package/core/streaming.d.mts.map +0 -1
- package/core/streaming.d.ts +0 -33
- package/core/streaming.d.ts.map +0 -1
- package/core/streaming.js +0 -268
- package/core/streaming.js.map +0 -1
- package/core/streaming.mjs +0 -263
- package/core/streaming.mjs.map +0 -1
- package/core/uploads.d.mts +0 -3
- package/core/uploads.d.mts.map +0 -1
- package/core/uploads.d.ts +0 -3
- package/core/uploads.d.ts.map +0 -1
- package/core/uploads.js +0 -6
- package/core/uploads.js.map +0 -1
- package/core/uploads.mjs +0 -2
- package/core/uploads.mjs.map +0 -1
- package/error.d.mts +0 -3
- package/error.d.mts.map +0 -1
- package/error.d.ts +0 -3
- package/error.d.ts.map +0 -1
- package/error.js +0 -6
- package/error.js.map +0 -1
- package/error.mjs +0 -3
- package/error.mjs.map +0 -1
- package/index.d.mts +0 -7
- package/index.d.mts.map +0 -1
- package/index.d.ts +0 -7
- package/index.d.ts.map +0 -1
- package/index.js +0 -31
- package/index.js.map +0 -1
- package/index.mjs +0 -7
- package/index.mjs.map +0 -1
- package/internal/builtin-types.d.mts +0 -73
- package/internal/builtin-types.d.mts.map +0 -1
- package/internal/builtin-types.d.ts +0 -73
- package/internal/builtin-types.d.ts.map +0 -1
- package/internal/builtin-types.js +0 -3
- package/internal/builtin-types.js.map +0 -1
- package/internal/builtin-types.mjs +0 -2
- package/internal/builtin-types.mjs.map +0 -1
- package/internal/decoders/line.d.mts +0 -17
- package/internal/decoders/line.d.mts.map +0 -1
- package/internal/decoders/line.d.ts +0 -17
- package/internal/decoders/line.d.ts.map +0 -1
- package/internal/decoders/line.js +0 -113
- package/internal/decoders/line.js.map +0 -1
- package/internal/decoders/line.mjs +0 -108
- package/internal/decoders/line.mjs.map +0 -1
- package/internal/detect-platform.d.mts +0 -15
- package/internal/detect-platform.d.mts.map +0 -1
- package/internal/detect-platform.d.ts +0 -15
- package/internal/detect-platform.d.ts.map +0 -1
- package/internal/detect-platform.js +0 -161
- package/internal/detect-platform.js.map +0 -1
- package/internal/detect-platform.mjs +0 -156
- package/internal/detect-platform.mjs.map +0 -1
- package/internal/errors.d.mts +0 -3
- package/internal/errors.d.mts.map +0 -1
- package/internal/errors.d.ts +0 -3
- package/internal/errors.d.ts.map +0 -1
- package/internal/errors.js +0 -40
- package/internal/errors.js.map +0 -1
- package/internal/errors.mjs +0 -35
- package/internal/errors.mjs.map +0 -1
- package/internal/headers.d.mts +0 -20
- package/internal/headers.d.mts.map +0 -1
- package/internal/headers.d.ts +0 -20
- package/internal/headers.d.ts.map +0 -1
- package/internal/headers.js +0 -78
- package/internal/headers.js.map +0 -1
- package/internal/headers.mjs +0 -73
- package/internal/headers.mjs.map +0 -1
- package/internal/parse.d.mts +0 -12
- package/internal/parse.d.mts.map +0 -1
- package/internal/parse.d.ts +0 -12
- package/internal/parse.d.ts.map +0 -1
- package/internal/parse.js +0 -49
- package/internal/parse.js.map +0 -1
- package/internal/parse.mjs +0 -46
- package/internal/parse.mjs.map +0 -1
- package/internal/qs/formats.d.mts +0 -7
- package/internal/qs/formats.d.mts.map +0 -1
- package/internal/qs/formats.d.ts +0 -7
- package/internal/qs/formats.d.ts.map +0 -1
- package/internal/qs/formats.js +0 -13
- package/internal/qs/formats.js.map +0 -1
- package/internal/qs/formats.mjs +0 -9
- package/internal/qs/formats.mjs.map +0 -1
- package/internal/qs/index.d.mts +0 -10
- package/internal/qs/index.d.mts.map +0 -1
- package/internal/qs/index.d.ts +0 -10
- package/internal/qs/index.d.ts.map +0 -1
- package/internal/qs/index.js +0 -14
- package/internal/qs/index.js.map +0 -1
- package/internal/qs/index.mjs +0 -10
- package/internal/qs/index.mjs.map +0 -1
- package/internal/qs/stringify.d.mts +0 -3
- package/internal/qs/stringify.d.mts.map +0 -1
- package/internal/qs/stringify.d.ts +0 -3
- package/internal/qs/stringify.d.ts.map +0 -1
- package/internal/qs/stringify.js +0 -277
- package/internal/qs/stringify.js.map +0 -1
- package/internal/qs/stringify.mjs +0 -274
- package/internal/qs/stringify.mjs.map +0 -1
- package/internal/qs/types.d.mts +0 -57
- package/internal/qs/types.d.mts.map +0 -1
- package/internal/qs/types.d.ts +0 -57
- package/internal/qs/types.d.ts.map +0 -1
- package/internal/qs/types.js +0 -3
- package/internal/qs/types.js.map +0 -1
- package/internal/qs/types.mjs +0 -2
- package/internal/qs/types.mjs.map +0 -1
- package/internal/qs/utils.d.mts +0 -15
- package/internal/qs/utils.d.mts.map +0 -1
- package/internal/qs/utils.d.ts +0 -15
- package/internal/qs/utils.d.ts.map +0 -1
- package/internal/qs/utils.js +0 -230
- package/internal/qs/utils.js.map +0 -1
- package/internal/qs/utils.mjs +0 -217
- package/internal/qs/utils.mjs.map +0 -1
- package/internal/request-options.d.mts +0 -77
- package/internal/request-options.d.mts.map +0 -1
- package/internal/request-options.d.ts +0 -77
- package/internal/request-options.d.ts.map +0 -1
- package/internal/request-options.js +0 -13
- package/internal/request-options.js.map +0 -1
- package/internal/request-options.mjs +0 -9
- package/internal/request-options.mjs.map +0 -1
- package/internal/shim-types.d.mts +0 -17
- package/internal/shim-types.d.mts.map +0 -1
- package/internal/shim-types.d.ts +0 -17
- package/internal/shim-types.d.ts.map +0 -1
- package/internal/shim-types.js +0 -9
- package/internal/shim-types.js.map +0 -1
- package/internal/shim-types.mjs +0 -8
- package/internal/shim-types.mjs.map +0 -1
- package/internal/shims.d.mts +0 -26
- package/internal/shims.d.mts.map +0 -1
- package/internal/shims.d.ts +0 -26
- package/internal/shims.d.ts.map +0 -1
- package/internal/shims.js +0 -97
- package/internal/shims.js.map +0 -1
- package/internal/shims.mjs +0 -90
- package/internal/shims.mjs.map +0 -1
- package/internal/to-file.d.mts +0 -45
- package/internal/to-file.d.mts.map +0 -1
- package/internal/to-file.d.ts +0 -45
- package/internal/to-file.d.ts.map +0 -1
- package/internal/to-file.js +0 -91
- package/internal/to-file.js.map +0 -1
- package/internal/to-file.mjs +0 -88
- package/internal/to-file.mjs.map +0 -1
- package/internal/tslib.js +0 -81
- package/internal/tslib.mjs +0 -17
- package/internal/types.d.mts +0 -69
- package/internal/types.d.mts.map +0 -1
- package/internal/types.d.ts +0 -69
- package/internal/types.d.ts.map +0 -1
- package/internal/types.js +0 -3
- package/internal/types.js.map +0 -1
- package/internal/types.mjs +0 -2
- package/internal/types.mjs.map +0 -1
- package/internal/uploads.d.mts +0 -42
- package/internal/uploads.d.mts.map +0 -1
- package/internal/uploads.d.ts +0 -42
- package/internal/uploads.d.ts.map +0 -1
- package/internal/uploads.js +0 -141
- package/internal/uploads.js.map +0 -1
- package/internal/uploads.mjs +0 -131
- package/internal/uploads.mjs.map +0 -1
- package/internal/utils/base64.d.mts +0 -3
- package/internal/utils/base64.d.mts.map +0 -1
- package/internal/utils/base64.d.ts +0 -3
- package/internal/utils/base64.d.ts.map +0 -1
- package/internal/utils/base64.js +0 -37
- package/internal/utils/base64.js.map +0 -1
- package/internal/utils/base64.mjs +0 -32
- package/internal/utils/base64.mjs.map +0 -1
- package/internal/utils/bytes.d.mts +0 -4
- package/internal/utils/bytes.d.mts.map +0 -1
- package/internal/utils/bytes.d.ts +0 -4
- package/internal/utils/bytes.d.ts.map +0 -1
- package/internal/utils/bytes.js +0 -31
- package/internal/utils/bytes.js.map +0 -1
- package/internal/utils/bytes.mjs +0 -26
- package/internal/utils/bytes.mjs.map +0 -1
- package/internal/utils/env.d.mts +0 -9
- package/internal/utils/env.d.mts.map +0 -1
- package/internal/utils/env.d.ts +0 -9
- package/internal/utils/env.d.ts.map +0 -1
- package/internal/utils/env.js +0 -21
- package/internal/utils/env.js.map +0 -1
- package/internal/utils/env.mjs +0 -17
- package/internal/utils/env.mjs.map +0 -1
- package/internal/utils/log.d.mts +0 -37
- package/internal/utils/log.d.mts.map +0 -1
- package/internal/utils/log.d.ts +0 -37
- package/internal/utils/log.d.ts.map +0 -1
- package/internal/utils/log.js +0 -86
- package/internal/utils/log.js.map +0 -1
- package/internal/utils/log.mjs +0 -80
- package/internal/utils/log.mjs.map +0 -1
- package/internal/utils/path.d.mts +0 -15
- package/internal/utils/path.d.mts.map +0 -1
- package/internal/utils/path.d.ts +0 -15
- package/internal/utils/path.d.ts.map +0 -1
- package/internal/utils/path.js +0 -79
- package/internal/utils/path.js.map +0 -1
- package/internal/utils/path.mjs +0 -74
- package/internal/utils/path.mjs.map +0 -1
- package/internal/utils/query.d.mts +0 -2
- package/internal/utils/query.d.mts.map +0 -1
- package/internal/utils/query.d.ts +0 -2
- package/internal/utils/query.d.ts.map +0 -1
- package/internal/utils/query.js +0 -9
- package/internal/utils/query.js.map +0 -1
- package/internal/utils/query.mjs +0 -5
- package/internal/utils/query.mjs.map +0 -1
- package/internal/utils/sleep.d.mts +0 -2
- package/internal/utils/sleep.d.mts.map +0 -1
- package/internal/utils/sleep.d.ts +0 -2
- package/internal/utils/sleep.d.ts.map +0 -1
- package/internal/utils/sleep.js +0 -6
- package/internal/utils/sleep.js.map +0 -1
- package/internal/utils/sleep.mjs +0 -2
- package/internal/utils/sleep.mjs.map +0 -1
- package/internal/utils/uuid.d.mts +0 -5
- package/internal/utils/uuid.d.mts.map +0 -1
- package/internal/utils/uuid.d.ts +0 -5
- package/internal/utils/uuid.d.ts.map +0 -1
- package/internal/utils/uuid.js +0 -18
- package/internal/utils/uuid.js.map +0 -1
- package/internal/utils/uuid.mjs +0 -14
- package/internal/utils/uuid.mjs.map +0 -1
- package/internal/utils/values.d.mts +0 -18
- package/internal/utils/values.d.mts.map +0 -1
- package/internal/utils/values.d.ts +0 -18
- package/internal/utils/values.d.ts.map +0 -1
- package/internal/utils/values.js +0 -111
- package/internal/utils/values.js.map +0 -1
- package/internal/utils/values.mjs +0 -93
- package/internal/utils/values.mjs.map +0 -1
- package/internal/utils.d.mts +0 -8
- package/internal/utils.d.mts.map +0 -1
- package/internal/utils.d.ts +0 -8
- package/internal/utils.d.ts.map +0 -1
- package/internal/utils.js +0 -11
- package/internal/utils.js.map +0 -1
- package/internal/utils.mjs +0 -8
- package/internal/utils.mjs.map +0 -1
- package/pagination.d.mts +0 -3
- package/pagination.d.mts.map +0 -1
- package/pagination.d.ts +0 -3
- package/pagination.d.ts.map +0 -1
- package/pagination.js +0 -6
- package/pagination.js.map +0 -1
- package/pagination.mjs +0 -3
- package/pagination.mjs.map +0 -1
- package/resource.d.mts +0 -3
- package/resource.d.mts.map +0 -1
- package/resource.d.ts +0 -3
- package/resource.d.ts.map +0 -1
- package/resource.js +0 -6
- package/resource.js.map +0 -1
- package/resource.mjs +0 -3
- package/resource.mjs.map +0 -1
- package/resources/account.d.mts +0 -124
- package/resources/account.d.mts.map +0 -1
- package/resources/account.d.ts +0 -124
- package/resources/account.d.ts.map +0 -1
- package/resources/account.js +0 -32
- package/resources/account.js.map +0 -1
- package/resources/account.mjs +0 -28
- package/resources/account.mjs.map +0 -1
- package/resources/agents/agents.d.mts +0 -379
- package/resources/agents/agents.d.mts.map +0 -1
- package/resources/agents/agents.d.ts +0 -379
- package/resources/agents/agents.d.ts.map +0 -1
- package/resources/agents/agents.js +0 -191
- package/resources/agents/agents.js.map +0 -1
- package/resources/agents/agents.mjs +0 -186
- package/resources/agents/agents.mjs.map +0 -1
- package/resources/agents/feedback.d.mts +0 -71
- package/resources/agents/feedback.d.mts.map +0 -1
- package/resources/agents/feedback.d.ts +0 -71
- package/resources/agents/feedback.d.ts.map +0 -1
- package/resources/agents/feedback.js +0 -33
- package/resources/agents/feedback.js.map +0 -1
- package/resources/agents/feedback.mjs +0 -29
- package/resources/agents/feedback.mjs.map +0 -1
- package/resources/agents/index.d.mts +0 -6
- package/resources/agents/index.d.mts.map +0 -1
- package/resources/agents/index.d.ts +0 -6
- package/resources/agents/index.d.ts.map +0 -1
- package/resources/agents/index.js +0 -14
- package/resources/agents/index.js.map +0 -1
- package/resources/agents/index.mjs +0 -6
- package/resources/agents/index.mjs.map +0 -1
- package/resources/agents/schedules.d.mts +0 -383
- package/resources/agents/schedules.d.mts.map +0 -1
- package/resources/agents/schedules.d.ts +0 -383
- package/resources/agents/schedules.d.ts.map +0 -1
- package/resources/agents/schedules.js +0 -171
- package/resources/agents/schedules.js.map +0 -1
- package/resources/agents/schedules.mjs +0 -167
- package/resources/agents/schedules.mjs.map +0 -1
- package/resources/agents/variations.d.mts +0 -723
- package/resources/agents/variations.d.mts.map +0 -1
- package/resources/agents/variations.d.ts +0 -723
- package/resources/agents/variations.d.ts.map +0 -1
- package/resources/agents/variations.js +0 -208
- package/resources/agents/variations.js.map +0 -1
- package/resources/agents/variations.mjs +0 -204
- package/resources/agents/variations.mjs.map +0 -1
- package/resources/agents/webhook-deliveries.d.mts +0 -96
- package/resources/agents/webhook-deliveries.d.mts.map +0 -1
- package/resources/agents/webhook-deliveries.d.ts +0 -96
- package/resources/agents/webhook-deliveries.d.ts.map +0 -1
- package/resources/agents/webhook-deliveries.js +0 -31
- package/resources/agents/webhook-deliveries.js.map +0 -1
- package/resources/agents/webhook-deliveries.mjs +0 -27
- package/resources/agents/webhook-deliveries.mjs.map +0 -1
- package/resources/agents.d.mts +0 -2
- package/resources/agents.d.mts.map +0 -1
- package/resources/agents.d.ts +0 -2
- package/resources/agents.d.ts.map +0 -1
- package/resources/agents.js +0 -5
- package/resources/agents.js.map +0 -1
- package/resources/agents.mjs +0 -2
- package/resources/agents.mjs.map +0 -1
- package/resources/ai-provider-keys.d.mts +0 -269
- package/resources/ai-provider-keys.d.mts.map +0 -1
- package/resources/ai-provider-keys.d.ts +0 -269
- package/resources/ai-provider-keys.d.ts.map +0 -1
- package/resources/ai-provider-keys.js +0 -52
- package/resources/ai-provider-keys.js.map +0 -1
- package/resources/ai-provider-keys.mjs +0 -48
- package/resources/ai-provider-keys.mjs.map +0 -1
- package/resources/api-keys.d.mts +0 -268
- package/resources/api-keys.d.mts.map +0 -1
- package/resources/api-keys.d.ts +0 -268
- package/resources/api-keys.d.ts.map +0 -1
- package/resources/api-keys.js +0 -83
- package/resources/api-keys.js.map +0 -1
- package/resources/api-keys.mjs +0 -79
- package/resources/api-keys.mjs.map +0 -1
- package/resources/global-api-key.d.mts +0 -33
- package/resources/global-api-key.d.mts.map +0 -1
- package/resources/global-api-key.d.ts +0 -33
- package/resources/global-api-key.d.ts.map +0 -1
- package/resources/global-api-key.js +0 -42
- package/resources/global-api-key.js.map +0 -1
- package/resources/global-api-key.mjs +0 -38
- package/resources/global-api-key.mjs.map +0 -1
- package/resources/index.d.mts +0 -21
- package/resources/index.d.mts.map +0 -1
- package/resources/index.d.ts +0 -21
- package/resources/index.d.ts.map +0 -1
- package/resources/index.js +0 -44
- package/resources/index.js.map +0 -1
- package/resources/index.mjs +0 -21
- package/resources/index.mjs.map +0 -1
- package/resources/memory-layers/entries.d.mts +0 -257
- package/resources/memory-layers/entries.d.mts.map +0 -1
- package/resources/memory-layers/entries.d.ts +0 -257
- package/resources/memory-layers/entries.d.ts.map +0 -1
- package/resources/memory-layers/entries.js +0 -58
- package/resources/memory-layers/entries.js.map +0 -1
- package/resources/memory-layers/entries.mjs +0 -54
- package/resources/memory-layers/entries.mjs.map +0 -1
- package/resources/memory-layers/index.d.mts +0 -3
- package/resources/memory-layers/index.d.mts.map +0 -1
- package/resources/memory-layers/index.d.ts +0 -3
- package/resources/memory-layers/index.d.ts.map +0 -1
- package/resources/memory-layers/index.js +0 -8
- package/resources/memory-layers/index.js.map +0 -1
- package/resources/memory-layers/index.mjs +0 -3
- package/resources/memory-layers/index.mjs.map +0 -1
- package/resources/memory-layers/memory-layers.d.mts +0 -196
- package/resources/memory-layers/memory-layers.d.mts.map +0 -1
- package/resources/memory-layers/memory-layers.d.ts +0 -196
- package/resources/memory-layers/memory-layers.d.ts.map +0 -1
- package/resources/memory-layers/memory-layers.js +0 -63
- package/resources/memory-layers/memory-layers.js.map +0 -1
- package/resources/memory-layers/memory-layers.mjs +0 -58
- package/resources/memory-layers/memory-layers.mjs.map +0 -1
- package/resources/memory-layers.d.mts +0 -2
- package/resources/memory-layers.d.mts.map +0 -1
- package/resources/memory-layers.d.ts +0 -2
- package/resources/memory-layers.d.ts.map +0 -1
- package/resources/memory-layers.js +0 -5
- package/resources/memory-layers.js.map +0 -1
- package/resources/memory-layers.mjs +0 -2
- package/resources/memory-layers.mjs.map +0 -1
- package/resources/models.d.mts +0 -315
- package/resources/models.d.mts.map +0 -1
- package/resources/models.d.ts +0 -315
- package/resources/models.d.ts.map +0 -1
- package/resources/models.js +0 -59
- package/resources/models.js.map +0 -1
- package/resources/models.mjs +0 -55
- package/resources/models.mjs.map +0 -1
- package/resources/objectives/feedback.d.mts +0 -126
- package/resources/objectives/feedback.d.mts.map +0 -1
- package/resources/objectives/feedback.d.ts +0 -126
- package/resources/objectives/feedback.d.ts.map +0 -1
- package/resources/objectives/feedback.js +0 -52
- package/resources/objectives/feedback.js.map +0 -1
- package/resources/objectives/feedback.mjs +0 -48
- package/resources/objectives/feedback.mjs.map +0 -1
- package/resources/objectives/index.d.mts +0 -6
- package/resources/objectives/index.d.mts.map +0 -1
- package/resources/objectives/index.d.ts +0 -6
- package/resources/objectives/index.d.ts.map +0 -1
- package/resources/objectives/index.js +0 -14
- package/resources/objectives/index.js.map +0 -1
- package/resources/objectives/index.mjs +0 -6
- package/resources/objectives/index.mjs.map +0 -1
- package/resources/objectives/objectives.d.mts +0 -1280
- package/resources/objectives/objectives.d.mts.map +0 -1
- package/resources/objectives/objectives.d.ts +0 -1280
- package/resources/objectives/objectives.d.ts.map +0 -1
- package/resources/objectives/objectives.js +0 -213
- package/resources/objectives/objectives.js.map +0 -1
- package/resources/objectives/objectives.mjs +0 -208
- package/resources/objectives/objectives.mjs.map +0 -1
- package/resources/objectives/tasks.d.mts +0 -88
- package/resources/objectives/tasks.d.mts.map +0 -1
- package/resources/objectives/tasks.d.ts +0 -88
- package/resources/objectives/tasks.d.ts.map +0 -1
- package/resources/objectives/tasks.js +0 -45
- package/resources/objectives/tasks.js.map +0 -1
- package/resources/objectives/tasks.mjs +0 -41
- package/resources/objectives/tasks.mjs.map +0 -1
- package/resources/objectives/tool-calls.d.mts +0 -379
- package/resources/objectives/tool-calls.d.mts.map +0 -1
- package/resources/objectives/tool-calls.d.ts +0 -379
- package/resources/objectives/tool-calls.d.ts.map +0 -1
- package/resources/objectives/tool-calls.js +0 -110
- package/resources/objectives/tool-calls.js.map +0 -1
- package/resources/objectives/tool-calls.mjs +0 -106
- package/resources/objectives/tool-calls.mjs.map +0 -1
- package/resources/objectives/tools.d.mts +0 -53
- package/resources/objectives/tools.d.mts.map +0 -1
- package/resources/objectives/tools.d.ts +0 -53
- package/resources/objectives/tools.d.ts.map +0 -1
- package/resources/objectives/tools.js +0 -28
- package/resources/objectives/tools.js.map +0 -1
- package/resources/objectives/tools.mjs +0 -24
- package/resources/objectives/tools.mjs.map +0 -1
- package/resources/objectives.d.mts +0 -2
- package/resources/objectives.d.mts.map +0 -1
- package/resources/objectives.d.ts +0 -2
- package/resources/objectives.d.ts.map +0 -1
- package/resources/objectives.js +0 -5
- package/resources/objectives.js.map +0 -1
- package/resources/objectives.mjs +0 -2
- package/resources/objectives.mjs.map +0 -1
- package/resources/profiles.d.mts +0 -16
- package/resources/profiles.d.mts.map +0 -1
- package/resources/profiles.d.ts +0 -16
- package/resources/profiles.d.ts.map +0 -1
- package/resources/profiles.js +0 -19
- package/resources/profiles.js.map +0 -1
- package/resources/profiles.mjs +0 -15
- package/resources/profiles.mjs.map +0 -1
- package/resources/search.d.mts +0 -33
- package/resources/search.d.mts.map +0 -1
- package/resources/search.d.ts +0 -33
- package/resources/search.d.ts.map +0 -1
- package/resources/search.js +0 -19
- package/resources/search.js.map +0 -1
- package/resources/search.mjs +0 -15
- package/resources/search.mjs.map +0 -1
- package/resources/shared.d.mts +0 -215
- package/resources/shared.d.mts.map +0 -1
- package/resources/shared.d.ts +0 -215
- package/resources/shared.d.ts.map +0 -1
- package/resources/shared.js +0 -3
- package/resources/shared.js.map +0 -1
- package/resources/shared.mjs +0 -2
- package/resources/shared.mjs.map +0 -1
- package/resources/tenants/index.d.mts +0 -3
- package/resources/tenants/index.d.mts.map +0 -1
- package/resources/tenants/index.d.ts +0 -3
- package/resources/tenants/index.d.ts.map +0 -1
- package/resources/tenants/index.js +0 -8
- package/resources/tenants/index.js.map +0 -1
- package/resources/tenants/index.mjs +0 -3
- package/resources/tenants/index.mjs.map +0 -1
- package/resources/tenants/subjects.d.mts +0 -43
- package/resources/tenants/subjects.d.mts.map +0 -1
- package/resources/tenants/subjects.d.ts +0 -43
- package/resources/tenants/subjects.d.ts.map +0 -1
- package/resources/tenants/subjects.js +0 -26
- package/resources/tenants/subjects.js.map +0 -1
- package/resources/tenants/subjects.mjs +0 -22
- package/resources/tenants/subjects.mjs.map +0 -1
- package/resources/tenants/tenants.d.mts +0 -158
- package/resources/tenants/tenants.d.mts.map +0 -1
- package/resources/tenants/tenants.d.ts +0 -158
- package/resources/tenants/tenants.d.ts.map +0 -1
- package/resources/tenants/tenants.js +0 -57
- package/resources/tenants/tenants.js.map +0 -1
- package/resources/tenants/tenants.mjs +0 -52
- package/resources/tenants/tenants.mjs.map +0 -1
- package/resources/tenants.d.mts +0 -2
- package/resources/tenants.d.mts.map +0 -1
- package/resources/tenants.d.ts +0 -2
- package/resources/tenants.d.ts.map +0 -1
- package/resources/tenants.js +0 -5
- package/resources/tenants.js.map +0 -1
- package/resources/tenants.mjs +0 -2
- package/resources/tenants.mjs.map +0 -1
- package/resources/tool-sets/index.d.mts +0 -4
- package/resources/tool-sets/index.d.mts.map +0 -1
- package/resources/tool-sets/index.d.ts +0 -4
- package/resources/tool-sets/index.d.ts.map +0 -1
- package/resources/tool-sets/index.js +0 -10
- package/resources/tool-sets/index.js.map +0 -1
- package/resources/tool-sets/index.mjs +0 -4
- package/resources/tool-sets/index.mjs.map +0 -1
- package/resources/tool-sets/secrets.d.mts +0 -135
- package/resources/tool-sets/secrets.d.mts.map +0 -1
- package/resources/tool-sets/secrets.d.ts +0 -135
- package/resources/tool-sets/secrets.d.ts.map +0 -1
- package/resources/tool-sets/secrets.js +0 -62
- package/resources/tool-sets/secrets.js.map +0 -1
- package/resources/tool-sets/secrets.mjs +0 -58
- package/resources/tool-sets/secrets.mjs.map +0 -1
- package/resources/tool-sets/tool-sets.d.mts +0 -595
- package/resources/tool-sets/tool-sets.d.mts.map +0 -1
- package/resources/tool-sets/tool-sets.d.ts +0 -595
- package/resources/tool-sets/tool-sets.d.ts.map +0 -1
- package/resources/tool-sets/tool-sets.js +0 -122
- package/resources/tool-sets/tool-sets.js.map +0 -1
- package/resources/tool-sets/tool-sets.mjs +0 -117
- package/resources/tool-sets/tool-sets.mjs.map +0 -1
- package/resources/tool-sets/tools.d.mts +0 -305
- package/resources/tool-sets/tools.d.mts.map +0 -1
- package/resources/tool-sets/tools.d.ts +0 -305
- package/resources/tool-sets/tools.d.ts.map +0 -1
- package/resources/tool-sets/tools.js +0 -84
- package/resources/tool-sets/tools.js.map +0 -1
- package/resources/tool-sets/tools.mjs +0 -80
- package/resources/tool-sets/tools.mjs.map +0 -1
- package/resources/tool-sets.d.mts +0 -2
- package/resources/tool-sets.d.mts.map +0 -1
- package/resources/tool-sets.d.ts +0 -2
- package/resources/tool-sets.d.ts.map +0 -1
- package/resources/tool-sets.js +0 -5
- package/resources/tool-sets.js.map +0 -1
- package/resources/tool-sets.mjs +0 -2
- package/resources/tool-sets.mjs.map +0 -1
- package/resources/uploads.d.mts +0 -107
- package/resources/uploads.d.mts.map +0 -1
- package/resources/uploads.d.ts +0 -107
- package/resources/uploads.d.ts.map +0 -1
- package/resources/uploads.js +0 -30
- package/resources/uploads.js.map +0 -1
- package/resources/uploads.mjs +0 -26
- package/resources/uploads.mjs.map +0 -1
- package/resources/webhooks.d.mts +0 -92
- package/resources/webhooks.d.mts.map +0 -1
- package/resources/webhooks.d.ts +0 -92
- package/resources/webhooks.d.ts.map +0 -1
- package/resources/webhooks.js +0 -22
- package/resources/webhooks.js.map +0 -1
- package/resources/webhooks.mjs +0 -18
- package/resources/webhooks.mjs.map +0 -1
- package/resources/widget-sessions.d.mts +0 -388
- package/resources/widget-sessions.d.mts.map +0 -1
- package/resources/widget-sessions.d.ts +0 -388
- package/resources/widget-sessions.d.ts.map +0 -1
- package/resources/widget-sessions.js +0 -78
- package/resources/widget-sessions.js.map +0 -1
- package/resources/widget-sessions.mjs +0 -74
- package/resources/widget-sessions.mjs.map +0 -1
- package/resources/widgets.d.mts +0 -225
- package/resources/widgets.d.mts.map +0 -1
- package/resources/widgets.d.ts +0 -225
- package/resources/widgets.d.ts.map +0 -1
- package/resources/widgets.js +0 -82
- package/resources/widgets.js.map +0 -1
- package/resources/widgets.mjs +0 -78
- package/resources/widgets.mjs.map +0 -1
- package/resources/workspace-admin/index.d.mts +0 -4
- package/resources/workspace-admin/index.d.mts.map +0 -1
- package/resources/workspace-admin/index.d.ts +0 -4
- package/resources/workspace-admin/index.d.ts.map +0 -1
- package/resources/workspace-admin/index.js +0 -10
- package/resources/workspace-admin/index.js.map +0 -1
- package/resources/workspace-admin/index.mjs +0 -4
- package/resources/workspace-admin/index.mjs.map +0 -1
- package/resources/workspace-admin/members.d.mts +0 -90
- package/resources/workspace-admin/members.d.mts.map +0 -1
- package/resources/workspace-admin/members.d.ts +0 -90
- package/resources/workspace-admin/members.d.ts.map +0 -1
- package/resources/workspace-admin/members.js +0 -73
- package/resources/workspace-admin/members.js.map +0 -1
- package/resources/workspace-admin/members.mjs +0 -69
- package/resources/workspace-admin/members.mjs.map +0 -1
- package/resources/workspace-admin/profiles.d.mts +0 -46
- package/resources/workspace-admin/profiles.d.mts.map +0 -1
- package/resources/workspace-admin/profiles.d.ts +0 -46
- package/resources/workspace-admin/profiles.d.ts.map +0 -1
- package/resources/workspace-admin/profiles.js +0 -35
- package/resources/workspace-admin/profiles.js.map +0 -1
- package/resources/workspace-admin/profiles.mjs +0 -31
- package/resources/workspace-admin/profiles.mjs.map +0 -1
- package/resources/workspace-admin/workspace-admin.d.mts +0 -227
- package/resources/workspace-admin/workspace-admin.d.mts.map +0 -1
- package/resources/workspace-admin/workspace-admin.d.ts +0 -227
- package/resources/workspace-admin/workspace-admin.d.ts.map +0 -1
- package/resources/workspace-admin/workspace-admin.js +0 -111
- package/resources/workspace-admin/workspace-admin.js.map +0 -1
- package/resources/workspace-admin/workspace-admin.mjs +0 -106
- package/resources/workspace-admin/workspace-admin.mjs.map +0 -1
- package/resources/workspace-admin.d.mts +0 -2
- package/resources/workspace-admin.d.mts.map +0 -1
- package/resources/workspace-admin.d.ts +0 -2
- package/resources/workspace-admin.d.ts.map +0 -1
- package/resources/workspace-admin.js +0 -5
- package/resources/workspace-admin.js.map +0 -1
- package/resources/workspace-admin.mjs +0 -2
- package/resources/workspace-admin.mjs.map +0 -1
- package/resources/workspace-secrets.d.mts +0 -134
- package/resources/workspace-secrets.d.mts.map +0 -1
- package/resources/workspace-secrets.d.ts +0 -134
- package/resources/workspace-secrets.d.ts.map +0 -1
- package/resources/workspace-secrets.js +0 -52
- package/resources/workspace-secrets.js.map +0 -1
- package/resources/workspace-secrets.mjs +0 -48
- package/resources/workspace-secrets.mjs.map +0 -1
- package/resources/workspaces.d.mts +0 -70
- package/resources/workspaces.d.mts.map +0 -1
- package/resources/workspaces.d.ts +0 -70
- package/resources/workspaces.d.ts.map +0 -1
- package/resources/workspaces.js +0 -23
- package/resources/workspaces.js.map +0 -1
- package/resources/workspaces.mjs +0 -19
- package/resources/workspaces.mjs.map +0 -1
- package/resources.d.mts +0 -2
- package/resources.d.mts.map +0 -1
- package/resources.d.ts +0 -2
- package/resources.d.ts.map +0 -1
- package/resources.js +0 -5
- package/resources.js.map +0 -1
- package/resources.mjs +0 -2
- package/resources.mjs.map +0 -1
- package/src/api-promise.ts +0 -2
- package/src/core/README.md +0 -3
- package/src/core/api-promise.ts +0 -90
- package/src/core/resource.ts +0 -9
- package/src/core/streaming.ts +0 -319
- package/src/core/uploads.ts +0 -2
- package/src/error.ts +0 -2
- package/src/internal/README.md +0 -3
- package/src/internal/builtin-types.ts +0 -91
- package/src/internal/decoders/line.ts +0 -135
- package/src/internal/detect-platform.ts +0 -194
- package/src/internal/errors.ts +0 -31
- package/src/internal/headers.ts +0 -95
- package/src/internal/parse.ts +0 -68
- package/src/internal/qs/LICENSE.md +0 -13
- package/src/internal/qs/README.md +0 -3
- package/src/internal/qs/formats.ts +0 -10
- package/src/internal/qs/index.ts +0 -13
- package/src/internal/qs/stringify.ts +0 -385
- package/src/internal/qs/types.ts +0 -71
- package/src/internal/qs/utils.ts +0 -265
- package/src/internal/request-options.ts +0 -91
- package/src/internal/shim-types.ts +0 -24
- package/src/internal/shims.ts +0 -105
- package/src/internal/to-file.ts +0 -154
- package/src/internal/types.ts +0 -91
- package/src/internal/uploads.ts +0 -187
- package/src/internal/utils/base64.ts +0 -38
- package/src/internal/utils/bytes.ts +0 -32
- package/src/internal/utils/env.ts +0 -16
- package/src/internal/utils/log.ts +0 -126
- package/src/internal/utils/path.ts +0 -88
- package/src/internal/utils/query.ts +0 -5
- package/src/internal/utils/sleep.ts +0 -1
- package/src/internal/utils/uuid.ts +0 -15
- package/src/internal/utils/values.ts +0 -103
- package/src/internal/utils.ts +0 -7
- package/src/lib/.keep +0 -3
- package/src/pagination.ts +0 -2
- package/src/resource.ts +0 -2
- package/src/resources/account.ts +0 -158
- package/src/resources/agents/agents.ts +0 -616
- package/src/resources/agents/feedback.ts +0 -96
- package/src/resources/agents/index.ts +0 -75
- package/src/resources/agents/schedules.ts +0 -541
- package/src/resources/agents/variations.ts +0 -981
- package/src/resources/agents/webhook-deliveries.ts +0 -176
- package/src/resources/global-api-key.ts +0 -44
- package/src/resources/index.ts +0 -307
- package/src/resources/memory-layers/entries.ts +0 -373
- package/src/resources/memory-layers/index.ts +0 -29
- package/src/resources/memory-layers/memory-layers.ts +0 -314
- package/src/resources/objectives/feedback.ts +0 -171
- package/src/resources/objectives/index.ts +0 -115
- package/src/resources/objectives/objectives.ts +0 -1787
- package/src/resources/objectives/tasks.ts +0 -129
- package/src/resources/objectives/tool-calls.ts +0 -572
- package/src/resources/objectives/tools.ts +0 -74
- package/src/resources/search.ts +0 -52
- package/src/resources/shared.ts +0 -234
- package/src/resources/tenants/index.ts +0 -13
- package/src/resources/tenants/subjects.ts +0 -61
- package/src/resources/tenants/tenants.ts +0 -218
- package/src/resources/tool-sets/index.ts +0 -87
- package/src/resources/tool-sets/secrets.ts +0 -223
- package/src/resources/tool-sets/tool-sets.ts +0 -934
- package/src/resources/tool-sets/tools.ts +0 -456
- package/src/resources/webhooks.ts +0 -122
- package/src/resources/workspace-admin/index.ts +0 -12
- package/src/resources/workspace-admin/members.ts +0 -131
- package/src/resources/workspace-admin/profiles.ts +0 -58
- package/src/resources/workspace-admin/workspace-admin.ts +0 -302
- package/src/resources.ts +0 -1
- package/src/streaming.ts +0 -2
- package/src/tsconfig.json +0 -11
- package/src/uploads.ts +0 -2
- package/src/version.ts +0 -1
- package/streaming.d.mts +0 -3
- package/streaming.d.mts.map +0 -1
- package/streaming.d.ts +0 -3
- package/streaming.d.ts.map +0 -1
- package/streaming.js +0 -6
- package/streaming.js.map +0 -1
- package/streaming.mjs +0 -3
- package/streaming.mjs.map +0 -1
- package/uploads.d.mts +0 -3
- package/uploads.d.mts.map +0 -1
- package/uploads.d.ts +0 -3
- package/uploads.d.ts.map +0 -1
- package/uploads.js +0 -6
- package/uploads.js.map +0 -1
- package/uploads.mjs +0 -3
- package/uploads.mjs.map +0 -1
- package/version.d.mts +0 -2
- package/version.d.mts.map +0 -1
- package/version.d.ts +0 -2
- package/version.d.ts.map +0 -1
- package/version.js +0 -5
- package/version.js.map +0 -1
- package/version.mjs +0 -2
- package/version.mjs.map +0 -1
package/client.js
DELETED
|
@@ -1,630 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _Cadenya_instances, _a, _Cadenya_encoder, _Cadenya_baseURLOverridden;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Cadenya = void 0;
|
|
5
|
-
const tslib_1 = require("./internal/tslib.js");
|
|
6
|
-
const uuid_1 = require("./internal/utils/uuid.js");
|
|
7
|
-
const values_1 = require("./internal/utils/values.js");
|
|
8
|
-
const sleep_1 = require("./internal/utils/sleep.js");
|
|
9
|
-
const errors_1 = require("./internal/errors.js");
|
|
10
|
-
const detect_platform_1 = require("./internal/detect-platform.js");
|
|
11
|
-
const Shims = tslib_1.__importStar(require("./internal/shims.js"));
|
|
12
|
-
const Opts = tslib_1.__importStar(require("./internal/request-options.js"));
|
|
13
|
-
const query_1 = require("./internal/utils/query.js");
|
|
14
|
-
const version_1 = require("./version.js");
|
|
15
|
-
const Errors = tslib_1.__importStar(require("./core/error.js"));
|
|
16
|
-
const Pagination = tslib_1.__importStar(require("./core/pagination.js"));
|
|
17
|
-
const Uploads = tslib_1.__importStar(require("./core/uploads.js"));
|
|
18
|
-
const API = tslib_1.__importStar(require("./resources/index.js"));
|
|
19
|
-
const api_promise_1 = require("./core/api-promise.js");
|
|
20
|
-
const account_1 = require("./resources/account.js");
|
|
21
|
-
const ai_provider_keys_1 = require("./resources/ai-provider-keys.js");
|
|
22
|
-
const api_keys_1 = require("./resources/api-keys.js");
|
|
23
|
-
const global_api_key_1 = require("./resources/global-api-key.js");
|
|
24
|
-
const models_1 = require("./resources/models.js");
|
|
25
|
-
const profiles_1 = require("./resources/profiles.js");
|
|
26
|
-
const search_1 = require("./resources/search.js");
|
|
27
|
-
const uploads_1 = require("./resources/uploads.js");
|
|
28
|
-
const webhooks_1 = require("./resources/webhooks.js");
|
|
29
|
-
const widget_sessions_1 = require("./resources/widget-sessions.js");
|
|
30
|
-
const widgets_1 = require("./resources/widgets.js");
|
|
31
|
-
const workspace_secrets_1 = require("./resources/workspace-secrets.js");
|
|
32
|
-
const workspaces_1 = require("./resources/workspaces.js");
|
|
33
|
-
const agents_1 = require("./resources/agents/agents.js");
|
|
34
|
-
const memory_layers_1 = require("./resources/memory-layers/memory-layers.js");
|
|
35
|
-
const objectives_1 = require("./resources/objectives/objectives.js");
|
|
36
|
-
const tenants_1 = require("./resources/tenants/tenants.js");
|
|
37
|
-
const tool_sets_1 = require("./resources/tool-sets/tool-sets.js");
|
|
38
|
-
const workspace_admin_1 = require("./resources/workspace-admin/workspace-admin.js");
|
|
39
|
-
const headers_1 = require("./internal/headers.js");
|
|
40
|
-
const env_1 = require("./internal/utils/env.js");
|
|
41
|
-
const log_1 = require("./internal/utils/log.js");
|
|
42
|
-
const values_2 = require("./internal/utils/values.js");
|
|
43
|
-
/**
|
|
44
|
-
* API Client for interfacing with the Cadenya API.
|
|
45
|
-
*/
|
|
46
|
-
class Cadenya {
|
|
47
|
-
/**
|
|
48
|
-
* API Client for interfacing with the Cadenya API.
|
|
49
|
-
*
|
|
50
|
-
* @param {string | undefined} [opts.apiKey=process.env['CADENYA_API_KEY'] ?? undefined]
|
|
51
|
-
* @param {string | null | undefined} [opts.webhookKey=process.env['CADENYA_WEBHOOK_KEY'] ?? null]
|
|
52
|
-
* @param {string | null | undefined} [opts.workspaceID=process.env['CADENYA_WORKSPACE_ID'] ?? null]
|
|
53
|
-
* @param {string} [opts.baseURL=process.env['CADENYA_BASE_URL'] ?? https://api.cadenya.com] - Override the default base URL for the API.
|
|
54
|
-
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
55
|
-
* @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
|
|
56
|
-
* @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
57
|
-
* @param {number} [opts.maxRetries=0] - The maximum number of times the client will retry a request.
|
|
58
|
-
* @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API.
|
|
59
|
-
* @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
60
|
-
*/
|
|
61
|
-
constructor({ baseURL = (0, env_1.readEnv)('CADENYA_BASE_URL'), apiKey = (0, env_1.readEnv)('CADENYA_API_KEY'), webhookKey = (0, env_1.readEnv)('CADENYA_WEBHOOK_KEY') ?? null, workspaceID = (0, env_1.readEnv)('CADENYA_WORKSPACE_ID') ?? null, ...opts } = {}) {
|
|
62
|
-
_Cadenya_instances.add(this);
|
|
63
|
-
_Cadenya_encoder.set(this, void 0);
|
|
64
|
-
this.aiProviderKeys = new API.AIProviderKeys(this);
|
|
65
|
-
/**
|
|
66
|
-
* Manage the authenticated account. Accounts are the top-level organizational
|
|
67
|
-
* unit and contain one or more workspaces.
|
|
68
|
-
*/
|
|
69
|
-
this.account = new API.AccountResource(this);
|
|
70
|
-
/**
|
|
71
|
-
* Operations on profiles, the account-level principals (users, API keys,
|
|
72
|
-
* system) that authenticate against the API.
|
|
73
|
-
*/
|
|
74
|
-
this.profiles = new API.Profiles(this);
|
|
75
|
-
/**
|
|
76
|
-
* Manage AI agents within a workspace. Agents define AI behavior and tool access.
|
|
77
|
-
*/
|
|
78
|
-
this.agents = new API.Agents(this);
|
|
79
|
-
this.objectives = new API.Objectives(this);
|
|
80
|
-
/**
|
|
81
|
-
* Manage memory layers and their entries. Layers are named containers that can
|
|
82
|
-
* be composed into an objective's memory cascade; entries are the keyed values
|
|
83
|
-
* within a layer. System-managed layers (e.g., episodic layers created by the
|
|
84
|
-
* runtime) cannot be mutated through this API.
|
|
85
|
-
*/
|
|
86
|
-
this.memoryLayers = new API.MemoryLayers(this);
|
|
87
|
-
/**
|
|
88
|
-
* Issue short-lived presigned URLs for direct client-to-object-storage
|
|
89
|
-
* uploads. Created uploads can be referenced by id when creating or updating
|
|
90
|
-
* resources that accept binary content (e.g., MemoryEntry).
|
|
91
|
-
*/
|
|
92
|
-
this.uploads = new API.Uploads(this);
|
|
93
|
-
/**
|
|
94
|
-
* Manage LLM models available to a workspace. Models represent provider and
|
|
95
|
-
* family pairs (e.g., "anthropic/claude-sonnet-4.6"). Workspaces are seeded
|
|
96
|
-
* with the supported models and you can enable or disable each one.
|
|
97
|
-
*/
|
|
98
|
-
this.models = new API.Models(this);
|
|
99
|
-
this.search = new API.Search(this);
|
|
100
|
-
/**
|
|
101
|
-
* Manage tool sets and the tools they contain. Tool sets group related tools,
|
|
102
|
-
* and tools define specific capabilities available to agents.
|
|
103
|
-
*
|
|
104
|
-
* When a tool set is managed, only API key actors can modify its tools; human
|
|
105
|
-
* (profile) actors cannot.
|
|
106
|
-
*/
|
|
107
|
-
this.toolSets = new API.ToolSets(this);
|
|
108
|
-
/**
|
|
109
|
-
* Issue, rotate, disable, and revoke a workspace's API keys. Every key
|
|
110
|
-
* belongs to exactly one workspace; the system-managed global account key is
|
|
111
|
-
* managed via GlobalAPIKeyService instead.
|
|
112
|
-
*/
|
|
113
|
-
this.apiKeys = new API.APIKeys(this);
|
|
114
|
-
/**
|
|
115
|
-
* Manage the account's system-provisioned global API key. The global key is
|
|
116
|
-
* the only key that spans every workspace; it is created by the system and
|
|
117
|
-
* cannot be deleted, so the surface is retrieve, rotate, and the
|
|
118
|
-
* disable/enable kill switch.
|
|
119
|
-
*/
|
|
120
|
-
this.globalAPIKey = new API.GlobalAPIKey(this);
|
|
121
|
-
this.workspaceSecrets = new API.WorkspaceSecrets(this);
|
|
122
|
-
/**
|
|
123
|
-
* Manage workspaces within an account. Workspaces provide organizational
|
|
124
|
-
* grouping and isolation for resources such as agents, tools, and API keys.
|
|
125
|
-
*
|
|
126
|
-
* This is the workspace-scoped, end-user surface. Administrative operations
|
|
127
|
-
* (create / archive workspaces, manage members) live in WorkspaceAdminService
|
|
128
|
-
* under /v1/account/workspaces and require the admin role.
|
|
129
|
-
*/
|
|
130
|
-
this.workspaces = new API.Workspaces(this);
|
|
131
|
-
/**
|
|
132
|
-
* Administer workspaces across the account: create and archive workspaces and
|
|
133
|
-
* manage their membership. These operations are account-scoped and require the
|
|
134
|
-
* admin role (a token whose profile holds the WorkOS admin role); they live
|
|
135
|
-
* under /v1/account/workspaces rather than the workspace-scoped /v1/workspaces
|
|
136
|
-
* tree so an admin can manage any workspace in the account, including ones they
|
|
137
|
-
* are not themselves a member of.
|
|
138
|
-
*/
|
|
139
|
-
this.workspaceAdmin = new API.WorkspaceAdmin(this);
|
|
140
|
-
this.webhooks = new API.Webhooks(this);
|
|
141
|
-
/**
|
|
142
|
-
* Manage embeddable chat widgets. A widget binds an agent to a globally
|
|
143
|
-
* unique hostname with a per-widget origin allowlist; browsers reach it with
|
|
144
|
-
* session tokens minted via WidgetSessionService.
|
|
145
|
-
*/
|
|
146
|
-
this.widgets = new API.Widgets(this);
|
|
147
|
-
/**
|
|
148
|
-
* Read and erase tenants and the subjects under them. Tenants and subjects are
|
|
149
|
-
* created by assertion — on objective creation or widget session mint — never
|
|
150
|
-
* directly, so this service has no create or update: it exists to enumerate what
|
|
151
|
-
* assertions have produced, and to destroy it on request.
|
|
152
|
-
*/
|
|
153
|
-
this.tenants = new API.Tenants(this);
|
|
154
|
-
/**
|
|
155
|
-
* Mint and manage widget sessions. Session creation is server-to-server only:
|
|
156
|
-
* the customer's backend authenticates its visitor, asserts tenant/subject
|
|
157
|
-
* context, attaches any per-visitor secrets, and receives a short-lived
|
|
158
|
-
* bearer token the browser uses against the widget host.
|
|
159
|
-
*/
|
|
160
|
-
this.widgetSessions = new API.WidgetSessions(this);
|
|
161
|
-
if (apiKey === undefined) {
|
|
162
|
-
throw new Errors.CadenyaError("The CADENYA_API_KEY environment variable is missing or empty; either provide it, or instantiate the Cadenya client with an apiKey option, like new Cadenya({ apiKey: 'My API Key' }).");
|
|
163
|
-
}
|
|
164
|
-
const options = {
|
|
165
|
-
apiKey,
|
|
166
|
-
webhookKey,
|
|
167
|
-
workspaceID,
|
|
168
|
-
...opts,
|
|
169
|
-
baseURL: baseURL || `https://api.cadenya.com`,
|
|
170
|
-
};
|
|
171
|
-
this.baseURL = options.baseURL;
|
|
172
|
-
this.timeout = options.timeout ?? _a.DEFAULT_TIMEOUT /* 1 minute */;
|
|
173
|
-
this.logger = options.logger ?? console;
|
|
174
|
-
const defaultLogLevel = 'warn';
|
|
175
|
-
// Set default logLevel early so that we can log a warning in parseLogLevel.
|
|
176
|
-
this.logLevel = defaultLogLevel;
|
|
177
|
-
this.logLevel =
|
|
178
|
-
(0, log_1.parseLogLevel)(options.logLevel, 'ClientOptions.logLevel', this) ??
|
|
179
|
-
(0, log_1.parseLogLevel)((0, env_1.readEnv)('CADENYA_LOG'), "process.env['CADENYA_LOG']", this) ??
|
|
180
|
-
defaultLogLevel;
|
|
181
|
-
this.fetchOptions = options.fetchOptions;
|
|
182
|
-
this.maxRetries = options.maxRetries ?? 0;
|
|
183
|
-
this.fetch = options.fetch ?? Shims.getDefaultFetch();
|
|
184
|
-
tslib_1.__classPrivateFieldSet(this, _Cadenya_encoder, Opts.FallbackEncoder, "f");
|
|
185
|
-
const customHeadersEnv = (0, env_1.readEnv)('CADENYA_CUSTOM_HEADERS');
|
|
186
|
-
if (customHeadersEnv) {
|
|
187
|
-
const parsed = {};
|
|
188
|
-
for (const line of customHeadersEnv.split('\n')) {
|
|
189
|
-
const colon = line.indexOf(':');
|
|
190
|
-
if (colon >= 0) {
|
|
191
|
-
parsed[line.substring(0, colon).trim()] = line.substring(colon + 1).trim();
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
options.defaultHeaders = { ...parsed, ...options.defaultHeaders };
|
|
195
|
-
}
|
|
196
|
-
this._options = options;
|
|
197
|
-
this.apiKey = apiKey;
|
|
198
|
-
this.webhookKey = webhookKey;
|
|
199
|
-
this.workspaceID = workspaceID;
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Create a new client instance re-using the same options given to the current client with optional overriding.
|
|
203
|
-
*/
|
|
204
|
-
withOptions(options) {
|
|
205
|
-
const client = new this.constructor({
|
|
206
|
-
...this._options,
|
|
207
|
-
baseURL: this.baseURL,
|
|
208
|
-
maxRetries: this.maxRetries,
|
|
209
|
-
timeout: this.timeout,
|
|
210
|
-
logger: this.logger,
|
|
211
|
-
logLevel: this.logLevel,
|
|
212
|
-
fetch: this.fetch,
|
|
213
|
-
fetchOptions: this.fetchOptions,
|
|
214
|
-
apiKey: this.apiKey,
|
|
215
|
-
webhookKey: this.webhookKey,
|
|
216
|
-
workspaceID: this.workspaceID,
|
|
217
|
-
...options,
|
|
218
|
-
});
|
|
219
|
-
return client;
|
|
220
|
-
}
|
|
221
|
-
defaultQuery() {
|
|
222
|
-
return this._options.defaultQuery;
|
|
223
|
-
}
|
|
224
|
-
validateHeaders({ values, nulls }) {
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
async authHeaders(opts) {
|
|
228
|
-
return (0, headers_1.buildHeaders)([{ Authorization: `Bearer ${this.apiKey}` }]);
|
|
229
|
-
}
|
|
230
|
-
stringifyQuery(query) {
|
|
231
|
-
return (0, query_1.stringifyQuery)(query);
|
|
232
|
-
}
|
|
233
|
-
getUserAgent() {
|
|
234
|
-
return `${this.constructor.name}/JS ${version_1.VERSION}`;
|
|
235
|
-
}
|
|
236
|
-
defaultIdempotencyKey() {
|
|
237
|
-
return `cadenya-node-retry-${(0, uuid_1.uuid4)()}`;
|
|
238
|
-
}
|
|
239
|
-
makeStatusError(status, error, message, headers) {
|
|
240
|
-
return Errors.APIError.generate(status, error, message, headers);
|
|
241
|
-
}
|
|
242
|
-
buildURL(path, query, defaultBaseURL) {
|
|
243
|
-
const baseURL = (!tslib_1.__classPrivateFieldGet(this, _Cadenya_instances, "m", _Cadenya_baseURLOverridden).call(this) && defaultBaseURL) || this.baseURL;
|
|
244
|
-
const url = (0, values_1.isAbsoluteURL)(path) ?
|
|
245
|
-
new URL(path)
|
|
246
|
-
: new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
|
|
247
|
-
const defaultQuery = this.defaultQuery();
|
|
248
|
-
const pathQuery = Object.fromEntries(url.searchParams);
|
|
249
|
-
if (!(0, values_2.isEmptyObj)(defaultQuery) || !(0, values_2.isEmptyObj)(pathQuery)) {
|
|
250
|
-
query = { ...pathQuery, ...defaultQuery, ...query };
|
|
251
|
-
}
|
|
252
|
-
if (typeof query === 'object' && query && !Array.isArray(query)) {
|
|
253
|
-
url.search = this.stringifyQuery(query);
|
|
254
|
-
}
|
|
255
|
-
return url.toString();
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* Used as a callback for mutating the given `FinalRequestOptions` object.
|
|
259
|
-
*/
|
|
260
|
-
async prepareOptions(options) { }
|
|
261
|
-
/**
|
|
262
|
-
* Used as a callback for mutating the given `RequestInit` object.
|
|
263
|
-
*
|
|
264
|
-
* This is useful for cases where you want to add certain headers based off of
|
|
265
|
-
* the request properties, e.g. `method` or `url`.
|
|
266
|
-
*/
|
|
267
|
-
async prepareRequest(request, { url, options }) { }
|
|
268
|
-
get(path, opts) {
|
|
269
|
-
return this.methodRequest('get', path, opts);
|
|
270
|
-
}
|
|
271
|
-
post(path, opts) {
|
|
272
|
-
return this.methodRequest('post', path, opts);
|
|
273
|
-
}
|
|
274
|
-
patch(path, opts) {
|
|
275
|
-
return this.methodRequest('patch', path, opts);
|
|
276
|
-
}
|
|
277
|
-
put(path, opts) {
|
|
278
|
-
return this.methodRequest('put', path, opts);
|
|
279
|
-
}
|
|
280
|
-
delete(path, opts) {
|
|
281
|
-
return this.methodRequest('delete', path, opts);
|
|
282
|
-
}
|
|
283
|
-
methodRequest(method, path, opts) {
|
|
284
|
-
return this.request(Promise.resolve(opts).then((opts) => {
|
|
285
|
-
return { method, path, ...opts };
|
|
286
|
-
}));
|
|
287
|
-
}
|
|
288
|
-
request(options, remainingRetries = null) {
|
|
289
|
-
return new api_promise_1.APIPromise(this, this.makeRequest(options, remainingRetries, undefined));
|
|
290
|
-
}
|
|
291
|
-
async makeRequest(optionsInput, retriesRemaining, retryOfRequestLogID) {
|
|
292
|
-
const options = await optionsInput;
|
|
293
|
-
const maxRetries = options.maxRetries ?? this.maxRetries;
|
|
294
|
-
if (retriesRemaining == null) {
|
|
295
|
-
retriesRemaining = maxRetries;
|
|
296
|
-
}
|
|
297
|
-
await this.prepareOptions(options);
|
|
298
|
-
const { req, url, timeout } = await this.buildRequest(options, {
|
|
299
|
-
retryCount: maxRetries - retriesRemaining,
|
|
300
|
-
});
|
|
301
|
-
await this.prepareRequest(req, { url, options });
|
|
302
|
-
/** Not an API request ID, just for correlating local log entries. */
|
|
303
|
-
const requestLogID = 'log_' + ((Math.random() * (1 << 24)) | 0).toString(16).padStart(6, '0');
|
|
304
|
-
const retryLogStr = retryOfRequestLogID === undefined ? '' : `, retryOf: ${retryOfRequestLogID}`;
|
|
305
|
-
const startTime = Date.now();
|
|
306
|
-
(0, log_1.loggerFor)(this).debug(`[${requestLogID}] sending request`, (0, log_1.formatRequestDetails)({
|
|
307
|
-
retryOfRequestLogID,
|
|
308
|
-
method: options.method,
|
|
309
|
-
url,
|
|
310
|
-
options,
|
|
311
|
-
headers: req.headers,
|
|
312
|
-
}));
|
|
313
|
-
if (options.signal?.aborted) {
|
|
314
|
-
throw new Errors.APIUserAbortError();
|
|
315
|
-
}
|
|
316
|
-
const controller = new AbortController();
|
|
317
|
-
const response = await this.fetchWithTimeout(url, req, timeout, controller).catch(errors_1.castToError);
|
|
318
|
-
const headersTime = Date.now();
|
|
319
|
-
if (response instanceof globalThis.Error) {
|
|
320
|
-
const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
|
|
321
|
-
if (options.signal?.aborted) {
|
|
322
|
-
throw new Errors.APIUserAbortError();
|
|
323
|
-
}
|
|
324
|
-
// detect native connection timeout errors
|
|
325
|
-
// deno throws "TypeError: error sending request for url (https://example/): client error (Connect): tcp connect error: Operation timed out (os error 60): Operation timed out (os error 60)"
|
|
326
|
-
// undici throws "TypeError: fetch failed" with cause "ConnectTimeoutError: Connect Timeout Error (attempted address: example:443, timeout: 1ms)"
|
|
327
|
-
// others do not provide enough information to distinguish timeouts from other connection errors
|
|
328
|
-
const isTimeout = (0, errors_1.isAbortError)(response) ||
|
|
329
|
-
/timed? ?out/i.test(String(response) + ('cause' in response ? String(response.cause) : ''));
|
|
330
|
-
if (retriesRemaining) {
|
|
331
|
-
(0, log_1.loggerFor)(this).info(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - ${retryMessage}`);
|
|
332
|
-
(0, log_1.loggerFor)(this).debug(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (${retryMessage})`, (0, log_1.formatRequestDetails)({
|
|
333
|
-
retryOfRequestLogID,
|
|
334
|
-
url,
|
|
335
|
-
durationMs: headersTime - startTime,
|
|
336
|
-
message: response.message,
|
|
337
|
-
}));
|
|
338
|
-
return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID);
|
|
339
|
-
}
|
|
340
|
-
(0, log_1.loggerFor)(this).info(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - error; no more retries left`);
|
|
341
|
-
(0, log_1.loggerFor)(this).debug(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (error; no more retries left)`, (0, log_1.formatRequestDetails)({
|
|
342
|
-
retryOfRequestLogID,
|
|
343
|
-
url,
|
|
344
|
-
durationMs: headersTime - startTime,
|
|
345
|
-
message: response.message,
|
|
346
|
-
}));
|
|
347
|
-
if (isTimeout) {
|
|
348
|
-
throw new Errors.APIConnectionTimeoutError();
|
|
349
|
-
}
|
|
350
|
-
throw new Errors.APIConnectionError({ cause: response });
|
|
351
|
-
}
|
|
352
|
-
const responseInfo = `[${requestLogID}${retryLogStr}] ${req.method} ${url} ${response.ok ? 'succeeded' : 'failed'} with status ${response.status} in ${headersTime - startTime}ms`;
|
|
353
|
-
if (!response.ok) {
|
|
354
|
-
const shouldRetry = await this.shouldRetry(response);
|
|
355
|
-
if (retriesRemaining && shouldRetry) {
|
|
356
|
-
const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
|
|
357
|
-
// We don't need the body of this response.
|
|
358
|
-
await Shims.CancelReadableStream(response.body);
|
|
359
|
-
(0, log_1.loggerFor)(this).info(`${responseInfo} - ${retryMessage}`);
|
|
360
|
-
(0, log_1.loggerFor)(this).debug(`[${requestLogID}] response error (${retryMessage})`, (0, log_1.formatRequestDetails)({
|
|
361
|
-
retryOfRequestLogID,
|
|
362
|
-
url: response.url,
|
|
363
|
-
status: response.status,
|
|
364
|
-
headers: response.headers,
|
|
365
|
-
durationMs: headersTime - startTime,
|
|
366
|
-
}));
|
|
367
|
-
return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID, response.headers);
|
|
368
|
-
}
|
|
369
|
-
const retryMessage = shouldRetry ? `error; no more retries left` : `error; not retryable`;
|
|
370
|
-
(0, log_1.loggerFor)(this).info(`${responseInfo} - ${retryMessage}`);
|
|
371
|
-
const errText = await response.text().catch((err) => (0, errors_1.castToError)(err).message);
|
|
372
|
-
const errJSON = (0, values_1.safeJSON)(errText);
|
|
373
|
-
const errMessage = errJSON ? undefined : errText;
|
|
374
|
-
(0, log_1.loggerFor)(this).debug(`[${requestLogID}] response error (${retryMessage})`, (0, log_1.formatRequestDetails)({
|
|
375
|
-
retryOfRequestLogID,
|
|
376
|
-
url: response.url,
|
|
377
|
-
status: response.status,
|
|
378
|
-
headers: response.headers,
|
|
379
|
-
message: errMessage,
|
|
380
|
-
durationMs: Date.now() - startTime,
|
|
381
|
-
}));
|
|
382
|
-
const err = this.makeStatusError(response.status, errJSON, errMessage, response.headers);
|
|
383
|
-
throw err;
|
|
384
|
-
}
|
|
385
|
-
(0, log_1.loggerFor)(this).info(responseInfo);
|
|
386
|
-
(0, log_1.loggerFor)(this).debug(`[${requestLogID}] response start`, (0, log_1.formatRequestDetails)({
|
|
387
|
-
retryOfRequestLogID,
|
|
388
|
-
url: response.url,
|
|
389
|
-
status: response.status,
|
|
390
|
-
headers: response.headers,
|
|
391
|
-
durationMs: headersTime - startTime,
|
|
392
|
-
}));
|
|
393
|
-
return { response, options, controller, requestLogID, retryOfRequestLogID, startTime };
|
|
394
|
-
}
|
|
395
|
-
getAPIList(path, Page, opts) {
|
|
396
|
-
return this.requestAPIList(Page, opts && 'then' in opts ?
|
|
397
|
-
opts.then((opts) => ({ method: 'get', path, ...opts }))
|
|
398
|
-
: { method: 'get', path, ...opts });
|
|
399
|
-
}
|
|
400
|
-
requestAPIList(Page, options) {
|
|
401
|
-
const request = this.makeRequest(options, null, undefined);
|
|
402
|
-
return new Pagination.PagePromise(this, request, Page);
|
|
403
|
-
}
|
|
404
|
-
async fetchWithTimeout(url, init, ms, controller) {
|
|
405
|
-
const { signal, method, ...options } = init || {};
|
|
406
|
-
const abort = this._makeAbort(controller);
|
|
407
|
-
if (signal)
|
|
408
|
-
signal.addEventListener('abort', abort, { once: true });
|
|
409
|
-
const timeout = setTimeout(abort, ms);
|
|
410
|
-
const isReadableBody = (globalThis.ReadableStream && options.body instanceof globalThis.ReadableStream) ||
|
|
411
|
-
(typeof options.body === 'object' && options.body !== null && Symbol.asyncIterator in options.body);
|
|
412
|
-
const fetchOptions = {
|
|
413
|
-
signal: controller.signal,
|
|
414
|
-
...(isReadableBody ? { duplex: 'half' } : {}),
|
|
415
|
-
method: 'GET',
|
|
416
|
-
...options,
|
|
417
|
-
};
|
|
418
|
-
if (method) {
|
|
419
|
-
// Custom methods like 'patch' need to be uppercased
|
|
420
|
-
// See https://github.com/nodejs/undici/issues/2294
|
|
421
|
-
fetchOptions.method = method.toUpperCase();
|
|
422
|
-
}
|
|
423
|
-
try {
|
|
424
|
-
// use undefined this binding; fetch errors if bound to something else in browser/cloudflare
|
|
425
|
-
return await this.fetch.call(undefined, url, fetchOptions);
|
|
426
|
-
}
|
|
427
|
-
finally {
|
|
428
|
-
clearTimeout(timeout);
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
async shouldRetry(response) {
|
|
432
|
-
// Note this is not a standard header.
|
|
433
|
-
const shouldRetryHeader = response.headers.get('x-should-retry');
|
|
434
|
-
// If the server explicitly says whether or not to retry, obey.
|
|
435
|
-
if (shouldRetryHeader === 'true')
|
|
436
|
-
return true;
|
|
437
|
-
if (shouldRetryHeader === 'false')
|
|
438
|
-
return false;
|
|
439
|
-
// Retry on request timeouts.
|
|
440
|
-
if (response.status === 408)
|
|
441
|
-
return true;
|
|
442
|
-
// Retry on lock timeouts.
|
|
443
|
-
if (response.status === 409)
|
|
444
|
-
return true;
|
|
445
|
-
// Retry on rate limits.
|
|
446
|
-
if (response.status === 429)
|
|
447
|
-
return true;
|
|
448
|
-
// Retry internal errors.
|
|
449
|
-
if (response.status >= 500)
|
|
450
|
-
return true;
|
|
451
|
-
return false;
|
|
452
|
-
}
|
|
453
|
-
async retryRequest(options, retriesRemaining, requestLogID, responseHeaders) {
|
|
454
|
-
let timeoutMillis;
|
|
455
|
-
// Note the `retry-after-ms` header may not be standard, but is a good idea and we'd like proactive support for it.
|
|
456
|
-
const retryAfterMillisHeader = responseHeaders?.get('retry-after-ms');
|
|
457
|
-
if (retryAfterMillisHeader) {
|
|
458
|
-
const timeoutMs = parseFloat(retryAfterMillisHeader);
|
|
459
|
-
if (!Number.isNaN(timeoutMs)) {
|
|
460
|
-
timeoutMillis = timeoutMs;
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
// About the Retry-After header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
|
|
464
|
-
const retryAfterHeader = responseHeaders?.get('retry-after');
|
|
465
|
-
if (retryAfterHeader && !timeoutMillis) {
|
|
466
|
-
const timeoutSeconds = parseFloat(retryAfterHeader);
|
|
467
|
-
if (!Number.isNaN(timeoutSeconds)) {
|
|
468
|
-
timeoutMillis = timeoutSeconds * 1000;
|
|
469
|
-
}
|
|
470
|
-
else {
|
|
471
|
-
timeoutMillis = Date.parse(retryAfterHeader) - Date.now();
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
// If the API asks us to wait a certain amount of time, just do what it
|
|
475
|
-
// says, but otherwise calculate a default
|
|
476
|
-
if (timeoutMillis === undefined) {
|
|
477
|
-
const maxRetries = options.maxRetries ?? this.maxRetries;
|
|
478
|
-
timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
|
|
479
|
-
}
|
|
480
|
-
await (0, sleep_1.sleep)(timeoutMillis);
|
|
481
|
-
return this.makeRequest(options, retriesRemaining - 1, requestLogID);
|
|
482
|
-
}
|
|
483
|
-
calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries) {
|
|
484
|
-
const initialRetryDelay = 0.5;
|
|
485
|
-
const maxRetryDelay = 8.0;
|
|
486
|
-
const numRetries = maxRetries - retriesRemaining;
|
|
487
|
-
// Apply exponential backoff, but not more than the max.
|
|
488
|
-
const sleepSeconds = Math.min(initialRetryDelay * Math.pow(2, numRetries), maxRetryDelay);
|
|
489
|
-
// Apply some jitter, take up to at most 25 percent of the retry time.
|
|
490
|
-
const jitter = 1 - Math.random() * 0.25;
|
|
491
|
-
return sleepSeconds * jitter * 1000;
|
|
492
|
-
}
|
|
493
|
-
async buildRequest(inputOptions, { retryCount = 0 } = {}) {
|
|
494
|
-
const options = { ...inputOptions };
|
|
495
|
-
const { method, path, query, defaultBaseURL } = options;
|
|
496
|
-
const url = this.buildURL(path, query, defaultBaseURL);
|
|
497
|
-
if ('timeout' in options)
|
|
498
|
-
(0, values_1.validatePositiveInteger)('timeout', options.timeout);
|
|
499
|
-
options.timeout = options.timeout ?? this.timeout;
|
|
500
|
-
const { bodyHeaders, body } = this.buildBody({ options });
|
|
501
|
-
const reqHeaders = await this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount });
|
|
502
|
-
const req = {
|
|
503
|
-
method,
|
|
504
|
-
headers: reqHeaders,
|
|
505
|
-
...(options.signal && { signal: options.signal }),
|
|
506
|
-
...(globalThis.ReadableStream &&
|
|
507
|
-
body instanceof globalThis.ReadableStream && { duplex: 'half' }),
|
|
508
|
-
...(body && { body }),
|
|
509
|
-
...(this.fetchOptions ?? {}),
|
|
510
|
-
...(options.fetchOptions ?? {}),
|
|
511
|
-
};
|
|
512
|
-
return { req, url, timeout: options.timeout };
|
|
513
|
-
}
|
|
514
|
-
async buildHeaders({ options, method, bodyHeaders, retryCount, }) {
|
|
515
|
-
let idempotencyHeaders = {};
|
|
516
|
-
if (this.idempotencyHeader && method !== 'get') {
|
|
517
|
-
if (!options.idempotencyKey)
|
|
518
|
-
options.idempotencyKey = this.defaultIdempotencyKey();
|
|
519
|
-
idempotencyHeaders[this.idempotencyHeader] = options.idempotencyKey;
|
|
520
|
-
}
|
|
521
|
-
const headers = (0, headers_1.buildHeaders)([
|
|
522
|
-
idempotencyHeaders,
|
|
523
|
-
{
|
|
524
|
-
Accept: 'application/json',
|
|
525
|
-
'User-Agent': this.getUserAgent(),
|
|
526
|
-
'X-Cadenya-Retry-Count': String(retryCount),
|
|
527
|
-
...(options.timeout ? { 'X-Cadenya-Timeout': String(Math.trunc(options.timeout / 1000)) } : {}),
|
|
528
|
-
...(0, detect_platform_1.getPlatformHeaders)(),
|
|
529
|
-
},
|
|
530
|
-
await this.authHeaders(options),
|
|
531
|
-
this._options.defaultHeaders,
|
|
532
|
-
bodyHeaders,
|
|
533
|
-
options.headers,
|
|
534
|
-
]);
|
|
535
|
-
this.validateHeaders(headers);
|
|
536
|
-
return headers.values;
|
|
537
|
-
}
|
|
538
|
-
_makeAbort(controller) {
|
|
539
|
-
// note: we can't just inline this method inside `fetchWithTimeout()` because then the closure
|
|
540
|
-
// would capture all request options, and cause a memory leak.
|
|
541
|
-
return () => controller.abort();
|
|
542
|
-
}
|
|
543
|
-
buildBody({ options }) {
|
|
544
|
-
const { body, headers: rawHeaders } = options;
|
|
545
|
-
if (!body) {
|
|
546
|
-
// A resource method always passes a `body` key when its operation defines a
|
|
547
|
-
// request body, even if the caller omitted an optional body param. Keep the
|
|
548
|
-
// content-type for those, and only elide it for operations with no body at
|
|
549
|
-
// all (e.g. GET/DELETE).
|
|
550
|
-
if (body == null && 'body' in options) {
|
|
551
|
-
return tslib_1.__classPrivateFieldGet(this, _Cadenya_encoder, "f").call(this, { body, headers: (0, headers_1.buildHeaders)([rawHeaders]) });
|
|
552
|
-
}
|
|
553
|
-
return { bodyHeaders: undefined, body: undefined };
|
|
554
|
-
}
|
|
555
|
-
const headers = (0, headers_1.buildHeaders)([rawHeaders]);
|
|
556
|
-
if (
|
|
557
|
-
// Pass raw type verbatim
|
|
558
|
-
ArrayBuffer.isView(body) ||
|
|
559
|
-
body instanceof ArrayBuffer ||
|
|
560
|
-
body instanceof DataView ||
|
|
561
|
-
(typeof body === 'string' &&
|
|
562
|
-
// Preserve legacy string encoding behavior for now
|
|
563
|
-
headers.values.has('content-type')) ||
|
|
564
|
-
// `Blob` is superset of `File`
|
|
565
|
-
(globalThis.Blob && body instanceof globalThis.Blob) ||
|
|
566
|
-
// `FormData` -> `multipart/form-data`
|
|
567
|
-
body instanceof FormData ||
|
|
568
|
-
// `URLSearchParams` -> `application/x-www-form-urlencoded`
|
|
569
|
-
body instanceof URLSearchParams ||
|
|
570
|
-
// Send chunked stream (each chunk has own `length`)
|
|
571
|
-
(globalThis.ReadableStream && body instanceof globalThis.ReadableStream)) {
|
|
572
|
-
return { bodyHeaders: undefined, body: body };
|
|
573
|
-
}
|
|
574
|
-
else if (typeof body === 'object' &&
|
|
575
|
-
(Symbol.asyncIterator in body ||
|
|
576
|
-
(Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))) {
|
|
577
|
-
return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body) };
|
|
578
|
-
}
|
|
579
|
-
else if (typeof body === 'object' &&
|
|
580
|
-
headers.values.get('content-type') === 'application/x-www-form-urlencoded') {
|
|
581
|
-
return {
|
|
582
|
-
bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
|
|
583
|
-
body: this.stringifyQuery(body),
|
|
584
|
-
};
|
|
585
|
-
}
|
|
586
|
-
else {
|
|
587
|
-
return tslib_1.__classPrivateFieldGet(this, _Cadenya_encoder, "f").call(this, { body, headers });
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
exports.Cadenya = Cadenya;
|
|
592
|
-
_a = Cadenya, _Cadenya_encoder = new WeakMap(), _Cadenya_instances = new WeakSet(), _Cadenya_baseURLOverridden = function _Cadenya_baseURLOverridden() {
|
|
593
|
-
return this.baseURL !== 'https://api.cadenya.com';
|
|
594
|
-
};
|
|
595
|
-
Cadenya.Cadenya = _a;
|
|
596
|
-
Cadenya.DEFAULT_TIMEOUT = 60000; // 1 minute
|
|
597
|
-
Cadenya.CadenyaError = Errors.CadenyaError;
|
|
598
|
-
Cadenya.APIError = Errors.APIError;
|
|
599
|
-
Cadenya.APIConnectionError = Errors.APIConnectionError;
|
|
600
|
-
Cadenya.APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
|
|
601
|
-
Cadenya.APIUserAbortError = Errors.APIUserAbortError;
|
|
602
|
-
Cadenya.NotFoundError = Errors.NotFoundError;
|
|
603
|
-
Cadenya.ConflictError = Errors.ConflictError;
|
|
604
|
-
Cadenya.RateLimitError = Errors.RateLimitError;
|
|
605
|
-
Cadenya.BadRequestError = Errors.BadRequestError;
|
|
606
|
-
Cadenya.AuthenticationError = Errors.AuthenticationError;
|
|
607
|
-
Cadenya.InternalServerError = Errors.InternalServerError;
|
|
608
|
-
Cadenya.PermissionDeniedError = Errors.PermissionDeniedError;
|
|
609
|
-
Cadenya.UnprocessableEntityError = Errors.UnprocessableEntityError;
|
|
610
|
-
Cadenya.toFile = Uploads.toFile;
|
|
611
|
-
Cadenya.AIProviderKeys = ai_provider_keys_1.AIProviderKeys;
|
|
612
|
-
Cadenya.AccountResource = account_1.AccountResource;
|
|
613
|
-
Cadenya.Profiles = profiles_1.Profiles;
|
|
614
|
-
Cadenya.Agents = agents_1.Agents;
|
|
615
|
-
Cadenya.Objectives = objectives_1.Objectives;
|
|
616
|
-
Cadenya.MemoryLayers = memory_layers_1.MemoryLayers;
|
|
617
|
-
Cadenya.Uploads = uploads_1.Uploads;
|
|
618
|
-
Cadenya.Models = models_1.Models;
|
|
619
|
-
Cadenya.Search = search_1.Search;
|
|
620
|
-
Cadenya.ToolSets = tool_sets_1.ToolSets;
|
|
621
|
-
Cadenya.APIKeys = api_keys_1.APIKeys;
|
|
622
|
-
Cadenya.GlobalAPIKey = global_api_key_1.GlobalAPIKey;
|
|
623
|
-
Cadenya.WorkspaceSecrets = workspace_secrets_1.WorkspaceSecrets;
|
|
624
|
-
Cadenya.Workspaces = workspaces_1.Workspaces;
|
|
625
|
-
Cadenya.WorkspaceAdmin = workspace_admin_1.WorkspaceAdmin;
|
|
626
|
-
Cadenya.Webhooks = webhooks_1.Webhooks;
|
|
627
|
-
Cadenya.Widgets = widgets_1.Widgets;
|
|
628
|
-
Cadenya.Tenants = tenants_1.Tenants;
|
|
629
|
-
Cadenya.WidgetSessions = widget_sessions_1.WidgetSessions;
|
|
630
|
-
//# sourceMappingURL=client.js.map
|