@macro-inc/sdk 0.0.1
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 +177 -0
- package/dist/chunk-5HAKQN23.js +1263 -0
- package/dist/chunk-77EI4LSQ.js +2492 -0
- package/dist/chunk-CTKR64MY.js +1436 -0
- package/dist/chunk-JXIQT5TH.js +1467 -0
- package/dist/chunk-P4DTO6VD.js +830 -0
- package/dist/chunk-PAAFJYGO.js +967 -0
- package/dist/chunk-QNUS5BC5.js +913 -0
- package/dist/chunk-SGAHIERJ.js +1235 -0
- package/dist/chunk-V45LUJDI.js +838 -0
- package/dist/chunk-YRUXFEZM.js +1044 -0
- package/dist/generated/agent-harness/client/client.gen.d.ts +2 -0
- package/dist/generated/agent-harness/client/index.d.ts +10 -0
- package/dist/generated/agent-harness/client/types.gen.d.ts +120 -0
- package/dist/generated/agent-harness/client/utils.gen.d.ts +37 -0
- package/dist/generated/agent-harness/client.gen.d.ts +12 -0
- package/dist/generated/agent-harness/core/auth.gen.d.ts +25 -0
- package/dist/generated/agent-harness/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/agent-harness/core/params.gen.d.ts +43 -0
- package/dist/generated/agent-harness/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/agent-harness/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/agent-harness/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/agent-harness/core/types.gen.d.ts +83 -0
- package/dist/generated/agent-harness/core/utils.gen.d.ts +19 -0
- package/dist/generated/agent-harness/index.d.ts +2 -0
- package/dist/generated/agent-harness/index.js +6 -0
- package/dist/generated/agent-harness/sdk.gen.d.ts +84 -0
- package/dist/generated/agent-harness/types.gen.d.ts +539 -0
- package/dist/generated/auth/client/client.gen.d.ts +2 -0
- package/dist/generated/auth/client/index.d.ts +10 -0
- package/dist/generated/auth/client/types.gen.d.ts +120 -0
- package/dist/generated/auth/client/utils.gen.d.ts +37 -0
- package/dist/generated/auth/client.gen.d.ts +12 -0
- package/dist/generated/auth/core/auth.gen.d.ts +25 -0
- package/dist/generated/auth/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/auth/core/params.gen.d.ts +43 -0
- package/dist/generated/auth/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/auth/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/auth/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/auth/core/types.gen.d.ts +83 -0
- package/dist/generated/auth/core/utils.gen.d.ts +19 -0
- package/dist/generated/auth/index.d.ts +2 -0
- package/dist/generated/auth/index.js +6 -0
- package/dist/generated/auth/sdk.gen.d.ts +383 -0
- package/dist/generated/auth/types.gen.d.ts +2175 -0
- package/dist/generated/cognition/client/client.gen.d.ts +2 -0
- package/dist/generated/cognition/client/index.d.ts +10 -0
- package/dist/generated/cognition/client/types.gen.d.ts +120 -0
- package/dist/generated/cognition/client/utils.gen.d.ts +37 -0
- package/dist/generated/cognition/client.gen.d.ts +12 -0
- package/dist/generated/cognition/core/auth.gen.d.ts +25 -0
- package/dist/generated/cognition/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/cognition/core/params.gen.d.ts +43 -0
- package/dist/generated/cognition/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/cognition/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/cognition/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/cognition/core/types.gen.d.ts +83 -0
- package/dist/generated/cognition/core/utils.gen.d.ts +19 -0
- package/dist/generated/cognition/index.d.ts +2 -0
- package/dist/generated/cognition/index.js +6 -0
- package/dist/generated/cognition/sdk.gen.d.ts +224 -0
- package/dist/generated/cognition/types.gen.d.ts +2484 -0
- package/dist/generated/connection/client/client.gen.d.ts +2 -0
- package/dist/generated/connection/client/index.d.ts +10 -0
- package/dist/generated/connection/client/types.gen.d.ts +120 -0
- package/dist/generated/connection/client/utils.gen.d.ts +37 -0
- package/dist/generated/connection/client.gen.d.ts +12 -0
- package/dist/generated/connection/core/auth.gen.d.ts +25 -0
- package/dist/generated/connection/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/connection/core/params.gen.d.ts +43 -0
- package/dist/generated/connection/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/connection/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/connection/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/connection/core/types.gen.d.ts +83 -0
- package/dist/generated/connection/core/utils.gen.d.ts +19 -0
- package/dist/generated/connection/index.d.ts +2 -0
- package/dist/generated/connection/index.js +839 -0
- package/dist/generated/connection/sdk.gen.d.ts +38 -0
- package/dist/generated/connection/types.gen.d.ts +235 -0
- package/dist/generated/contacts/client/client.gen.d.ts +2 -0
- package/dist/generated/contacts/client/index.d.ts +10 -0
- package/dist/generated/contacts/client/types.gen.d.ts +120 -0
- package/dist/generated/contacts/client/utils.gen.d.ts +37 -0
- package/dist/generated/contacts/client.gen.d.ts +12 -0
- package/dist/generated/contacts/core/auth.gen.d.ts +25 -0
- package/dist/generated/contacts/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/contacts/core/params.gen.d.ts +43 -0
- package/dist/generated/contacts/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/contacts/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/contacts/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/contacts/core/types.gen.d.ts +83 -0
- package/dist/generated/contacts/core/utils.gen.d.ts +19 -0
- package/dist/generated/contacts/index.d.ts +2 -0
- package/dist/generated/contacts/index.js +6 -0
- package/dist/generated/contacts/sdk.gen.d.ts +43 -0
- package/dist/generated/contacts/types.gen.d.ts +52 -0
- package/dist/generated/email/client/client.gen.d.ts +2 -0
- package/dist/generated/email/client/index.d.ts +10 -0
- package/dist/generated/email/client/types.gen.d.ts +120 -0
- package/dist/generated/email/client/utils.gen.d.ts +37 -0
- package/dist/generated/email/client.gen.d.ts +12 -0
- package/dist/generated/email/core/auth.gen.d.ts +25 -0
- package/dist/generated/email/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/email/core/params.gen.d.ts +43 -0
- package/dist/generated/email/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/email/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/email/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/email/core/types.gen.d.ts +83 -0
- package/dist/generated/email/core/utils.gen.d.ts +19 -0
- package/dist/generated/email/index.d.ts +2 -0
- package/dist/generated/email/index.js +6 -0
- package/dist/generated/email/sdk.gen.d.ts +254 -0
- package/dist/generated/email/types.gen.d.ts +2614 -0
- package/dist/generated/notification/client/client.gen.d.ts +2 -0
- package/dist/generated/notification/client/index.d.ts +10 -0
- package/dist/generated/notification/client/types.gen.d.ts +120 -0
- package/dist/generated/notification/client/utils.gen.d.ts +37 -0
- package/dist/generated/notification/client.gen.d.ts +12 -0
- package/dist/generated/notification/core/auth.gen.d.ts +25 -0
- package/dist/generated/notification/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/notification/core/params.gen.d.ts +43 -0
- package/dist/generated/notification/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/notification/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/notification/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/notification/core/types.gen.d.ts +83 -0
- package/dist/generated/notification/core/utils.gen.d.ts +19 -0
- package/dist/generated/notification/index.d.ts +2 -0
- package/dist/generated/notification/index.js +6 -0
- package/dist/generated/notification/sdk.gen.d.ts +118 -0
- package/dist/generated/notification/types.gen.d.ts +1352 -0
- package/dist/generated/properties/client/client.gen.d.ts +2 -0
- package/dist/generated/properties/client/index.d.ts +10 -0
- package/dist/generated/properties/client/types.gen.d.ts +120 -0
- package/dist/generated/properties/client/utils.gen.d.ts +37 -0
- package/dist/generated/properties/client.gen.d.ts +12 -0
- package/dist/generated/properties/core/auth.gen.d.ts +25 -0
- package/dist/generated/properties/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/properties/core/params.gen.d.ts +43 -0
- package/dist/generated/properties/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/properties/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/properties/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/properties/core/types.gen.d.ts +83 -0
- package/dist/generated/properties/core/utils.gen.d.ts +19 -0
- package/dist/generated/properties/index.d.ts +2 -0
- package/dist/generated/properties/index.js +6 -0
- package/dist/generated/properties/sdk.gen.d.ts +158 -0
- package/dist/generated/properties/types.gen.d.ts +1288 -0
- package/dist/generated/scheduled-action/client/client.gen.d.ts +2 -0
- package/dist/generated/scheduled-action/client/index.d.ts +10 -0
- package/dist/generated/scheduled-action/client/types.gen.d.ts +120 -0
- package/dist/generated/scheduled-action/client/utils.gen.d.ts +37 -0
- package/dist/generated/scheduled-action/client.gen.d.ts +12 -0
- package/dist/generated/scheduled-action/core/auth.gen.d.ts +25 -0
- package/dist/generated/scheduled-action/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/scheduled-action/core/params.gen.d.ts +43 -0
- package/dist/generated/scheduled-action/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/scheduled-action/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/scheduled-action/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/scheduled-action/core/types.gen.d.ts +83 -0
- package/dist/generated/scheduled-action/core/utils.gen.d.ts +19 -0
- package/dist/generated/scheduled-action/index.d.ts +2 -0
- package/dist/generated/scheduled-action/index.js +845 -0
- package/dist/generated/scheduled-action/sdk.gen.d.ts +42 -0
- package/dist/generated/scheduled-action/types.gen.d.ts +241 -0
- package/dist/generated/search/client/client.gen.d.ts +2 -0
- package/dist/generated/search/client/index.d.ts +10 -0
- package/dist/generated/search/client/types.gen.d.ts +120 -0
- package/dist/generated/search/client/utils.gen.d.ts +37 -0
- package/dist/generated/search/client.gen.d.ts +12 -0
- package/dist/generated/search/core/auth.gen.d.ts +25 -0
- package/dist/generated/search/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/search/core/params.gen.d.ts +43 -0
- package/dist/generated/search/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/search/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/search/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/search/core/types.gen.d.ts +83 -0
- package/dist/generated/search/core/utils.gen.d.ts +19 -0
- package/dist/generated/search/index.d.ts +2 -0
- package/dist/generated/search/index.js +6 -0
- package/dist/generated/search/sdk.gen.d.ts +44 -0
- package/dist/generated/search/types.gen.d.ts +2194 -0
- package/dist/generated/static-files/client/client.gen.d.ts +2 -0
- package/dist/generated/static-files/client/index.d.ts +10 -0
- package/dist/generated/static-files/client/types.gen.d.ts +120 -0
- package/dist/generated/static-files/client/utils.gen.d.ts +37 -0
- package/dist/generated/static-files/client.gen.d.ts +12 -0
- package/dist/generated/static-files/core/auth.gen.d.ts +25 -0
- package/dist/generated/static-files/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/static-files/core/params.gen.d.ts +43 -0
- package/dist/generated/static-files/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/static-files/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/static-files/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/static-files/core/types.gen.d.ts +83 -0
- package/dist/generated/static-files/core/utils.gen.d.ts +19 -0
- package/dist/generated/static-files/index.d.ts +2 -0
- package/dist/generated/static-files/index.js +842 -0
- package/dist/generated/static-files/sdk.gen.d.ts +43 -0
- package/dist/generated/static-files/types.gen.d.ts +214 -0
- package/dist/generated/storage/client/client.gen.d.ts +2 -0
- package/dist/generated/storage/client/index.d.ts +10 -0
- package/dist/generated/storage/client/types.gen.d.ts +120 -0
- package/dist/generated/storage/client/utils.gen.d.ts +37 -0
- package/dist/generated/storage/client.gen.d.ts +12 -0
- package/dist/generated/storage/core/auth.gen.d.ts +25 -0
- package/dist/generated/storage/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/storage/core/params.gen.d.ts +43 -0
- package/dist/generated/storage/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/storage/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/storage/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/storage/core/types.gen.d.ts +83 -0
- package/dist/generated/storage/core/utils.gen.d.ts +19 -0
- package/dist/generated/storage/index.d.ts +2 -0
- package/dist/generated/storage/index.js +6 -0
- package/dist/generated/storage/sdk.gen.d.ts +858 -0
- package/dist/generated/storage/types.gen.d.ts +12105 -0
- package/dist/generated/unfurl/client/client.gen.d.ts +2 -0
- package/dist/generated/unfurl/client/index.d.ts +10 -0
- package/dist/generated/unfurl/client/types.gen.d.ts +120 -0
- package/dist/generated/unfurl/client/utils.gen.d.ts +37 -0
- package/dist/generated/unfurl/client.gen.d.ts +12 -0
- package/dist/generated/unfurl/core/auth.gen.d.ts +25 -0
- package/dist/generated/unfurl/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/unfurl/core/params.gen.d.ts +43 -0
- package/dist/generated/unfurl/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/unfurl/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/unfurl/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/unfurl/core/types.gen.d.ts +83 -0
- package/dist/generated/unfurl/core/utils.gen.d.ts +19 -0
- package/dist/generated/unfurl/index.d.ts +2 -0
- package/dist/generated/unfurl/index.js +835 -0
- package/dist/generated/unfurl/sdk.gen.d.ts +47 -0
- package/dist/generated/unfurl/types.gen.d.ts +125 -0
- package/dist/src/config.d.ts +51 -0
- package/dist/src/entities/agent-sessions/agent-session.d.ts +45 -0
- package/dist/src/entities/agent-sessions/namespace.d.ts +18 -0
- package/dist/src/entities/bots/namespace.d.ts +25 -0
- package/dist/src/entities/calls/call-record.d.ts +55 -0
- package/dist/src/entities/calls/namespace.d.ts +9 -0
- package/dist/src/entities/channels/channel.d.ts +88 -0
- package/dist/src/entities/channels/message.d.ts +64 -0
- package/dist/src/entities/channels/namespace.d.ts +30 -0
- package/dist/src/entities/channels/post.d.ts +20 -0
- package/dist/src/entities/channels/thread.d.ts +30 -0
- package/dist/src/entities/chats/chat.d.ts +55 -0
- package/dist/src/entities/chats/namespace.d.ts +14 -0
- package/dist/src/entities/crm/comment.d.ts +43 -0
- package/dist/src/entities/crm/company.d.ts +70 -0
- package/dist/src/entities/crm/contact.d.ts +48 -0
- package/dist/src/entities/crm/namespace.d.ts +22 -0
- package/dist/src/entities/documents/comment.d.ts +41 -0
- package/dist/src/entities/documents/document.d.ts +130 -0
- package/dist/src/entities/documents/namespace.d.ts +43 -0
- package/dist/src/entities/documents/system-skill.d.ts +16 -0
- package/dist/src/entities/email/attachment.d.ts +36 -0
- package/dist/src/entities/email/label.d.ts +31 -0
- package/dist/src/entities/email/link.d.ts +29 -0
- package/dist/src/entities/email/message.d.ts +58 -0
- package/dist/src/entities/email/namespace.d.ts +49 -0
- package/dist/src/entities/email/thread.d.ts +88 -0
- package/dist/src/entities/entity.d.ts +101 -0
- package/dist/src/entities/favorites/namespace.d.ts +19 -0
- package/dist/src/entities/foreign/foreign-entity.d.ts +30 -0
- package/dist/src/entities/foreign/namespace.d.ts +7 -0
- package/dist/src/entities/notifications/namespace.d.ts +29 -0
- package/dist/src/entities/notifications/notification.d.ts +50 -0
- package/dist/src/entities/pins/namespace.d.ts +19 -0
- package/dist/src/entities/projects/namespace.d.ts +13 -0
- package/dist/src/entities/projects/project.d.ts +42 -0
- package/dist/src/entities/properties/namespace.d.ts +47 -0
- package/dist/src/entities/properties/property-definition.d.ts +45 -0
- package/dist/src/entities/properties/property-option.d.ts +32 -0
- package/dist/src/entities/search.d.ts +23 -0
- package/dist/src/entities/tasks/namespace.d.ts +21 -0
- package/dist/src/entities/tasks/task.d.ts +34 -0
- package/dist/src/entities/teams/namespace.d.ts +12 -0
- package/dist/src/entities/teams/team.d.ts +40 -0
- package/dist/src/entities/users/namespace.d.ts +10 -0
- package/dist/src/entities/users/user.d.ts +43 -0
- package/dist/src/entities/webhooks/namespace.d.ts +31 -0
- package/dist/src/entities/webhooks/webhook.d.ts +88 -0
- package/dist/src/events/hydrate/channel.d.ts +85 -0
- package/dist/src/events/hydrate/document.d.ts +54 -0
- package/dist/src/events/receiver.d.ts +51 -0
- package/dist/src/events/types.d.ts +40 -0
- package/dist/src/events/verify.d.ts +13 -0
- package/dist/src/local-portmap.d.ts +8 -0
- package/dist/src/macro.d.ts +62 -0
- package/dist/src/macro.js +4215 -0
- package/dist/src/mentions.d.ts +37 -0
- package/dist/src/raw.d.ts +12 -0
- package/dist/src/utils/client.d.ts +53 -0
- package/dist/src/utils/index.d.ts +4 -0
- package/dist/src/utils/lazy.d.ts +18 -0
- package/dist/src/utils/pagination.d.ts +7 -0
- package/dist/src/utils/unwrap.d.ts +23 -0
- package/package.json +49 -0
|
@@ -0,0 +1,1235 @@
|
|
|
1
|
+
// generated/cognition/core/bodySerializer.gen.ts
|
|
2
|
+
var jsonBodySerializer = {
|
|
3
|
+
bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value)
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
// generated/cognition/core/serverSentEvents.gen.ts
|
|
7
|
+
function createSseClient({
|
|
8
|
+
onRequest,
|
|
9
|
+
onSseError,
|
|
10
|
+
onSseEvent,
|
|
11
|
+
responseTransformer,
|
|
12
|
+
responseValidator,
|
|
13
|
+
sseDefaultRetryDelay,
|
|
14
|
+
sseMaxRetryAttempts,
|
|
15
|
+
sseMaxRetryDelay,
|
|
16
|
+
sseSleepFn,
|
|
17
|
+
url,
|
|
18
|
+
...options
|
|
19
|
+
}) {
|
|
20
|
+
let lastEventId;
|
|
21
|
+
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
22
|
+
const createStream = async function* () {
|
|
23
|
+
let retryDelay = sseDefaultRetryDelay ?? 3e3;
|
|
24
|
+
let attempt = 0;
|
|
25
|
+
const signal = options.signal ?? new AbortController().signal;
|
|
26
|
+
while (true) {
|
|
27
|
+
if (signal.aborted) break;
|
|
28
|
+
attempt++;
|
|
29
|
+
const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
|
|
30
|
+
if (lastEventId !== void 0) {
|
|
31
|
+
headers.set("Last-Event-ID", lastEventId);
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
const requestInit = {
|
|
35
|
+
redirect: "follow",
|
|
36
|
+
...options,
|
|
37
|
+
body: options.serializedBody,
|
|
38
|
+
headers,
|
|
39
|
+
signal
|
|
40
|
+
};
|
|
41
|
+
let request = new Request(url, requestInit);
|
|
42
|
+
if (onRequest) {
|
|
43
|
+
request = await onRequest(url, requestInit);
|
|
44
|
+
}
|
|
45
|
+
const _fetch = options.fetch ?? globalThis.fetch;
|
|
46
|
+
const response = await _fetch(request);
|
|
47
|
+
if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
|
|
48
|
+
if (!response.body) throw new Error("No body in SSE response");
|
|
49
|
+
const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
50
|
+
let buffer = "";
|
|
51
|
+
const abortHandler = () => {
|
|
52
|
+
try {
|
|
53
|
+
reader.cancel();
|
|
54
|
+
} catch {
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
signal.addEventListener("abort", abortHandler);
|
|
58
|
+
try {
|
|
59
|
+
while (true) {
|
|
60
|
+
const { done, value } = await reader.read();
|
|
61
|
+
if (done) break;
|
|
62
|
+
buffer += value;
|
|
63
|
+
buffer = buffer.replace(/\r\n?/g, "\n");
|
|
64
|
+
const chunks = buffer.split("\n\n");
|
|
65
|
+
buffer = chunks.pop() ?? "";
|
|
66
|
+
for (const chunk of chunks) {
|
|
67
|
+
const lines = chunk.split("\n");
|
|
68
|
+
const dataLines = [];
|
|
69
|
+
let eventName;
|
|
70
|
+
for (const line of lines) {
|
|
71
|
+
if (line.startsWith("data:")) {
|
|
72
|
+
dataLines.push(line.replace(/^data:\s*/, ""));
|
|
73
|
+
} else if (line.startsWith("event:")) {
|
|
74
|
+
eventName = line.replace(/^event:\s*/, "");
|
|
75
|
+
} else if (line.startsWith("id:")) {
|
|
76
|
+
lastEventId = line.replace(/^id:\s*/, "");
|
|
77
|
+
} else if (line.startsWith("retry:")) {
|
|
78
|
+
const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
|
|
79
|
+
if (!Number.isNaN(parsed)) {
|
|
80
|
+
retryDelay = parsed;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
let data;
|
|
85
|
+
let parsedJson = false;
|
|
86
|
+
if (dataLines.length) {
|
|
87
|
+
const rawData = dataLines.join("\n");
|
|
88
|
+
try {
|
|
89
|
+
data = JSON.parse(rawData);
|
|
90
|
+
parsedJson = true;
|
|
91
|
+
} catch {
|
|
92
|
+
data = rawData;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (parsedJson) {
|
|
96
|
+
if (responseValidator) {
|
|
97
|
+
await responseValidator(data);
|
|
98
|
+
}
|
|
99
|
+
if (responseTransformer) {
|
|
100
|
+
data = await responseTransformer(data);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
onSseEvent?.({
|
|
104
|
+
data,
|
|
105
|
+
event: eventName,
|
|
106
|
+
id: lastEventId,
|
|
107
|
+
retry: retryDelay
|
|
108
|
+
});
|
|
109
|
+
if (dataLines.length) {
|
|
110
|
+
yield data;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
} finally {
|
|
115
|
+
signal.removeEventListener("abort", abortHandler);
|
|
116
|
+
reader.releaseLock();
|
|
117
|
+
}
|
|
118
|
+
break;
|
|
119
|
+
} catch (error) {
|
|
120
|
+
onSseError?.(error);
|
|
121
|
+
if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
|
|
125
|
+
await sleep(backoff);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
const stream = createStream();
|
|
130
|
+
return { stream };
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// generated/cognition/core/pathSerializer.gen.ts
|
|
134
|
+
var separatorArrayExplode = (style) => {
|
|
135
|
+
switch (style) {
|
|
136
|
+
case "label":
|
|
137
|
+
return ".";
|
|
138
|
+
case "matrix":
|
|
139
|
+
return ";";
|
|
140
|
+
case "simple":
|
|
141
|
+
return ",";
|
|
142
|
+
default:
|
|
143
|
+
return "&";
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
var separatorArrayNoExplode = (style) => {
|
|
147
|
+
switch (style) {
|
|
148
|
+
case "form":
|
|
149
|
+
return ",";
|
|
150
|
+
case "pipeDelimited":
|
|
151
|
+
return "|";
|
|
152
|
+
case "spaceDelimited":
|
|
153
|
+
return "%20";
|
|
154
|
+
default:
|
|
155
|
+
return ",";
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
var separatorObjectExplode = (style) => {
|
|
159
|
+
switch (style) {
|
|
160
|
+
case "label":
|
|
161
|
+
return ".";
|
|
162
|
+
case "matrix":
|
|
163
|
+
return ";";
|
|
164
|
+
case "simple":
|
|
165
|
+
return ",";
|
|
166
|
+
default:
|
|
167
|
+
return "&";
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
var serializeArrayParam = ({
|
|
171
|
+
allowReserved,
|
|
172
|
+
explode,
|
|
173
|
+
name,
|
|
174
|
+
style,
|
|
175
|
+
value
|
|
176
|
+
}) => {
|
|
177
|
+
if (!explode) {
|
|
178
|
+
const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
|
|
179
|
+
switch (style) {
|
|
180
|
+
case "label":
|
|
181
|
+
return `.${joinedValues2}`;
|
|
182
|
+
case "matrix":
|
|
183
|
+
return `;${name}=${joinedValues2}`;
|
|
184
|
+
case "simple":
|
|
185
|
+
return joinedValues2;
|
|
186
|
+
default:
|
|
187
|
+
return `${name}=${joinedValues2}`;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
const separator = separatorArrayExplode(style);
|
|
191
|
+
const joinedValues = value.map((v) => {
|
|
192
|
+
if (style === "label" || style === "simple") {
|
|
193
|
+
return allowReserved ? v : encodeURIComponent(v);
|
|
194
|
+
}
|
|
195
|
+
return serializePrimitiveParam({
|
|
196
|
+
allowReserved,
|
|
197
|
+
name,
|
|
198
|
+
value: v
|
|
199
|
+
});
|
|
200
|
+
}).join(separator);
|
|
201
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
202
|
+
};
|
|
203
|
+
var serializePrimitiveParam = ({
|
|
204
|
+
allowReserved,
|
|
205
|
+
name,
|
|
206
|
+
value
|
|
207
|
+
}) => {
|
|
208
|
+
if (value === void 0 || value === null) {
|
|
209
|
+
return "";
|
|
210
|
+
}
|
|
211
|
+
if (typeof value === "object") {
|
|
212
|
+
throw new Error(
|
|
213
|
+
"Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
|
|
217
|
+
};
|
|
218
|
+
var serializeObjectParam = ({
|
|
219
|
+
allowReserved,
|
|
220
|
+
explode,
|
|
221
|
+
name,
|
|
222
|
+
style,
|
|
223
|
+
value,
|
|
224
|
+
valueOnly
|
|
225
|
+
}) => {
|
|
226
|
+
if (value instanceof Date) {
|
|
227
|
+
return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
|
|
228
|
+
}
|
|
229
|
+
if (style !== "deepObject" && !explode) {
|
|
230
|
+
let values = [];
|
|
231
|
+
Object.entries(value).forEach(([key, v]) => {
|
|
232
|
+
values = [...values, key, allowReserved ? v : encodeURIComponent(v)];
|
|
233
|
+
});
|
|
234
|
+
const joinedValues2 = values.join(",");
|
|
235
|
+
switch (style) {
|
|
236
|
+
case "form":
|
|
237
|
+
return `${name}=${joinedValues2}`;
|
|
238
|
+
case "label":
|
|
239
|
+
return `.${joinedValues2}`;
|
|
240
|
+
case "matrix":
|
|
241
|
+
return `;${name}=${joinedValues2}`;
|
|
242
|
+
default:
|
|
243
|
+
return joinedValues2;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
const separator = separatorObjectExplode(style);
|
|
247
|
+
const joinedValues = Object.entries(value).map(
|
|
248
|
+
([key, v]) => serializePrimitiveParam({
|
|
249
|
+
allowReserved,
|
|
250
|
+
name: style === "deepObject" ? `${name}[${key}]` : key,
|
|
251
|
+
value: v
|
|
252
|
+
})
|
|
253
|
+
).join(separator);
|
|
254
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
// generated/cognition/core/utils.gen.ts
|
|
258
|
+
var PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
259
|
+
var defaultPathSerializer = ({ path, url: _url }) => {
|
|
260
|
+
let url = _url;
|
|
261
|
+
const matches = _url.match(PATH_PARAM_RE);
|
|
262
|
+
if (matches) {
|
|
263
|
+
for (const match of matches) {
|
|
264
|
+
let explode = false;
|
|
265
|
+
let name = match.substring(1, match.length - 1);
|
|
266
|
+
let style = "simple";
|
|
267
|
+
if (name.endsWith("*")) {
|
|
268
|
+
explode = true;
|
|
269
|
+
name = name.substring(0, name.length - 1);
|
|
270
|
+
}
|
|
271
|
+
if (name.startsWith(".")) {
|
|
272
|
+
name = name.substring(1);
|
|
273
|
+
style = "label";
|
|
274
|
+
} else if (name.startsWith(";")) {
|
|
275
|
+
name = name.substring(1);
|
|
276
|
+
style = "matrix";
|
|
277
|
+
}
|
|
278
|
+
const value = path[name];
|
|
279
|
+
if (value === void 0 || value === null) {
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
282
|
+
if (Array.isArray(value)) {
|
|
283
|
+
url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
if (typeof value === "object") {
|
|
287
|
+
url = url.replace(
|
|
288
|
+
match,
|
|
289
|
+
serializeObjectParam({
|
|
290
|
+
explode,
|
|
291
|
+
name,
|
|
292
|
+
style,
|
|
293
|
+
value,
|
|
294
|
+
valueOnly: true
|
|
295
|
+
})
|
|
296
|
+
);
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
if (style === "matrix") {
|
|
300
|
+
url = url.replace(
|
|
301
|
+
match,
|
|
302
|
+
`;${serializePrimitiveParam({
|
|
303
|
+
name,
|
|
304
|
+
value
|
|
305
|
+
})}`
|
|
306
|
+
);
|
|
307
|
+
continue;
|
|
308
|
+
}
|
|
309
|
+
const replaceValue = encodeURIComponent(
|
|
310
|
+
style === "label" ? `.${value}` : value
|
|
311
|
+
);
|
|
312
|
+
url = url.replace(match, replaceValue);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
return url;
|
|
316
|
+
};
|
|
317
|
+
var getUrl = ({
|
|
318
|
+
baseUrl,
|
|
319
|
+
path,
|
|
320
|
+
query,
|
|
321
|
+
querySerializer,
|
|
322
|
+
url: _url
|
|
323
|
+
}) => {
|
|
324
|
+
const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
|
|
325
|
+
let url = (baseUrl ?? "") + pathUrl;
|
|
326
|
+
if (path) {
|
|
327
|
+
url = defaultPathSerializer({ path, url });
|
|
328
|
+
}
|
|
329
|
+
let search = query ? querySerializer(query) : "";
|
|
330
|
+
if (search.startsWith("?")) {
|
|
331
|
+
search = search.substring(1);
|
|
332
|
+
}
|
|
333
|
+
if (search) {
|
|
334
|
+
url += `?${search}`;
|
|
335
|
+
}
|
|
336
|
+
return url;
|
|
337
|
+
};
|
|
338
|
+
function getValidRequestBody(options) {
|
|
339
|
+
const hasBody = options.body !== void 0;
|
|
340
|
+
const isSerializedBody = hasBody && options.bodySerializer;
|
|
341
|
+
if (isSerializedBody) {
|
|
342
|
+
if ("serializedBody" in options) {
|
|
343
|
+
const hasSerializedBody = options.serializedBody !== void 0 && options.serializedBody !== "";
|
|
344
|
+
return hasSerializedBody ? options.serializedBody : null;
|
|
345
|
+
}
|
|
346
|
+
return options.body !== "" ? options.body : null;
|
|
347
|
+
}
|
|
348
|
+
if (hasBody) {
|
|
349
|
+
return options.body;
|
|
350
|
+
}
|
|
351
|
+
return void 0;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// generated/cognition/core/auth.gen.ts
|
|
355
|
+
var getAuthToken = async (auth, callback) => {
|
|
356
|
+
const token = typeof callback === "function" ? await callback(auth) : callback;
|
|
357
|
+
if (!token) {
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
if (auth.scheme === "bearer") {
|
|
361
|
+
return `Bearer ${token}`;
|
|
362
|
+
}
|
|
363
|
+
if (auth.scheme === "basic") {
|
|
364
|
+
return `Basic ${btoa(token)}`;
|
|
365
|
+
}
|
|
366
|
+
return token;
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
// generated/cognition/client/utils.gen.ts
|
|
370
|
+
var createQuerySerializer = ({
|
|
371
|
+
parameters = {},
|
|
372
|
+
...args
|
|
373
|
+
} = {}) => {
|
|
374
|
+
const querySerializer = (queryParams) => {
|
|
375
|
+
const search = [];
|
|
376
|
+
if (queryParams && typeof queryParams === "object") {
|
|
377
|
+
for (const name in queryParams) {
|
|
378
|
+
const value = queryParams[name];
|
|
379
|
+
if (value === void 0 || value === null) {
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
const options = parameters[name] || args;
|
|
383
|
+
if (Array.isArray(value)) {
|
|
384
|
+
const serializedArray = serializeArrayParam({
|
|
385
|
+
allowReserved: options.allowReserved,
|
|
386
|
+
explode: true,
|
|
387
|
+
name,
|
|
388
|
+
style: "form",
|
|
389
|
+
value,
|
|
390
|
+
...options.array
|
|
391
|
+
});
|
|
392
|
+
if (serializedArray) search.push(serializedArray);
|
|
393
|
+
} else if (typeof value === "object") {
|
|
394
|
+
const serializedObject = serializeObjectParam({
|
|
395
|
+
allowReserved: options.allowReserved,
|
|
396
|
+
explode: true,
|
|
397
|
+
name,
|
|
398
|
+
style: "deepObject",
|
|
399
|
+
value,
|
|
400
|
+
...options.object
|
|
401
|
+
});
|
|
402
|
+
if (serializedObject) search.push(serializedObject);
|
|
403
|
+
} else {
|
|
404
|
+
const serializedPrimitive = serializePrimitiveParam({
|
|
405
|
+
allowReserved: options.allowReserved,
|
|
406
|
+
name,
|
|
407
|
+
value
|
|
408
|
+
});
|
|
409
|
+
if (serializedPrimitive) search.push(serializedPrimitive);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
return search.join("&");
|
|
414
|
+
};
|
|
415
|
+
return querySerializer;
|
|
416
|
+
};
|
|
417
|
+
var getParseAs = (contentType) => {
|
|
418
|
+
if (!contentType) {
|
|
419
|
+
return "stream";
|
|
420
|
+
}
|
|
421
|
+
const cleanContent = contentType.split(";")[0]?.trim();
|
|
422
|
+
if (!cleanContent) {
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
|
|
426
|
+
return "json";
|
|
427
|
+
}
|
|
428
|
+
if (cleanContent === "multipart/form-data") {
|
|
429
|
+
return "formData";
|
|
430
|
+
}
|
|
431
|
+
if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
|
|
432
|
+
return "blob";
|
|
433
|
+
}
|
|
434
|
+
if (cleanContent.startsWith("text/")) {
|
|
435
|
+
return "text";
|
|
436
|
+
}
|
|
437
|
+
return;
|
|
438
|
+
};
|
|
439
|
+
var checkForExistence = (options, name) => {
|
|
440
|
+
if (!name) {
|
|
441
|
+
return false;
|
|
442
|
+
}
|
|
443
|
+
if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
|
|
444
|
+
return true;
|
|
445
|
+
}
|
|
446
|
+
return false;
|
|
447
|
+
};
|
|
448
|
+
async function setAuthParams(options) {
|
|
449
|
+
for (const auth of options.security ?? []) {
|
|
450
|
+
if (checkForExistence(options, auth.name)) {
|
|
451
|
+
continue;
|
|
452
|
+
}
|
|
453
|
+
const token = await getAuthToken(auth, options.auth);
|
|
454
|
+
if (!token) {
|
|
455
|
+
continue;
|
|
456
|
+
}
|
|
457
|
+
const name = auth.name ?? "Authorization";
|
|
458
|
+
switch (auth.in) {
|
|
459
|
+
case "query":
|
|
460
|
+
if (!options.query) {
|
|
461
|
+
options.query = {};
|
|
462
|
+
}
|
|
463
|
+
options.query[name] = token;
|
|
464
|
+
break;
|
|
465
|
+
case "cookie":
|
|
466
|
+
options.headers.append("Cookie", `${name}=${token}`);
|
|
467
|
+
break;
|
|
468
|
+
case "header":
|
|
469
|
+
default:
|
|
470
|
+
options.headers.set(name, token);
|
|
471
|
+
break;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
var buildUrl = (options) => getUrl({
|
|
476
|
+
baseUrl: options.baseUrl,
|
|
477
|
+
path: options.path,
|
|
478
|
+
query: options.query,
|
|
479
|
+
querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
|
|
480
|
+
url: options.url
|
|
481
|
+
});
|
|
482
|
+
var mergeConfigs = (a, b) => {
|
|
483
|
+
const config = { ...a, ...b };
|
|
484
|
+
if (config.baseUrl?.endsWith("/")) {
|
|
485
|
+
config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
|
|
486
|
+
}
|
|
487
|
+
config.headers = mergeHeaders(a.headers, b.headers);
|
|
488
|
+
return config;
|
|
489
|
+
};
|
|
490
|
+
var headersEntries = (headers) => {
|
|
491
|
+
const entries = [];
|
|
492
|
+
headers.forEach((value, key) => {
|
|
493
|
+
entries.push([key, value]);
|
|
494
|
+
});
|
|
495
|
+
return entries;
|
|
496
|
+
};
|
|
497
|
+
var mergeHeaders = (...headers) => {
|
|
498
|
+
const mergedHeaders = new Headers();
|
|
499
|
+
for (const header of headers) {
|
|
500
|
+
if (!header) {
|
|
501
|
+
continue;
|
|
502
|
+
}
|
|
503
|
+
const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
|
|
504
|
+
for (const [key, value] of iterator) {
|
|
505
|
+
if (value === null) {
|
|
506
|
+
mergedHeaders.delete(key);
|
|
507
|
+
} else if (Array.isArray(value)) {
|
|
508
|
+
for (const v of value) {
|
|
509
|
+
mergedHeaders.append(key, v);
|
|
510
|
+
}
|
|
511
|
+
} else if (value !== void 0) {
|
|
512
|
+
mergedHeaders.set(
|
|
513
|
+
key,
|
|
514
|
+
typeof value === "object" ? JSON.stringify(value) : value
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
return mergedHeaders;
|
|
520
|
+
};
|
|
521
|
+
var Interceptors = class {
|
|
522
|
+
fns = [];
|
|
523
|
+
clear() {
|
|
524
|
+
this.fns = [];
|
|
525
|
+
}
|
|
526
|
+
eject(id) {
|
|
527
|
+
const index = this.getInterceptorIndex(id);
|
|
528
|
+
if (this.fns[index]) {
|
|
529
|
+
this.fns[index] = null;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
exists(id) {
|
|
533
|
+
const index = this.getInterceptorIndex(id);
|
|
534
|
+
return Boolean(this.fns[index]);
|
|
535
|
+
}
|
|
536
|
+
getInterceptorIndex(id) {
|
|
537
|
+
if (typeof id === "number") {
|
|
538
|
+
return this.fns[id] ? id : -1;
|
|
539
|
+
}
|
|
540
|
+
return this.fns.indexOf(id);
|
|
541
|
+
}
|
|
542
|
+
update(id, fn) {
|
|
543
|
+
const index = this.getInterceptorIndex(id);
|
|
544
|
+
if (this.fns[index]) {
|
|
545
|
+
this.fns[index] = fn;
|
|
546
|
+
return id;
|
|
547
|
+
}
|
|
548
|
+
return false;
|
|
549
|
+
}
|
|
550
|
+
use(fn) {
|
|
551
|
+
this.fns.push(fn);
|
|
552
|
+
return this.fns.length - 1;
|
|
553
|
+
}
|
|
554
|
+
};
|
|
555
|
+
var createInterceptors = () => ({
|
|
556
|
+
error: new Interceptors(),
|
|
557
|
+
request: new Interceptors(),
|
|
558
|
+
response: new Interceptors()
|
|
559
|
+
});
|
|
560
|
+
var defaultQuerySerializer = createQuerySerializer({
|
|
561
|
+
allowReserved: false,
|
|
562
|
+
array: {
|
|
563
|
+
explode: true,
|
|
564
|
+
style: "form"
|
|
565
|
+
},
|
|
566
|
+
object: {
|
|
567
|
+
explode: true,
|
|
568
|
+
style: "deepObject"
|
|
569
|
+
}
|
|
570
|
+
});
|
|
571
|
+
var defaultHeaders = {
|
|
572
|
+
"Content-Type": "application/json"
|
|
573
|
+
};
|
|
574
|
+
var createConfig = (override = {}) => ({
|
|
575
|
+
...jsonBodySerializer,
|
|
576
|
+
headers: defaultHeaders,
|
|
577
|
+
parseAs: "auto",
|
|
578
|
+
querySerializer: defaultQuerySerializer,
|
|
579
|
+
...override
|
|
580
|
+
});
|
|
581
|
+
|
|
582
|
+
// generated/cognition/client/client.gen.ts
|
|
583
|
+
var createClient = (config = {}) => {
|
|
584
|
+
let _config = mergeConfigs(createConfig(), config);
|
|
585
|
+
const getConfig = () => ({ ..._config });
|
|
586
|
+
const setConfig = (config2) => {
|
|
587
|
+
_config = mergeConfigs(_config, config2);
|
|
588
|
+
return getConfig();
|
|
589
|
+
};
|
|
590
|
+
const interceptors = createInterceptors();
|
|
591
|
+
const beforeRequest = async (options) => {
|
|
592
|
+
const opts = {
|
|
593
|
+
..._config,
|
|
594
|
+
...options,
|
|
595
|
+
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
596
|
+
headers: mergeHeaders(_config.headers, options.headers),
|
|
597
|
+
serializedBody: void 0
|
|
598
|
+
};
|
|
599
|
+
if (opts.security) {
|
|
600
|
+
await setAuthParams(opts);
|
|
601
|
+
}
|
|
602
|
+
if (opts.requestValidator) {
|
|
603
|
+
await opts.requestValidator(opts);
|
|
604
|
+
}
|
|
605
|
+
if (opts.body !== void 0 && opts.bodySerializer) {
|
|
606
|
+
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
607
|
+
}
|
|
608
|
+
if (opts.body === void 0 || opts.serializedBody === "") {
|
|
609
|
+
opts.headers.delete("Content-Type");
|
|
610
|
+
}
|
|
611
|
+
const resolvedOpts = opts;
|
|
612
|
+
const url = buildUrl(resolvedOpts);
|
|
613
|
+
return { opts: resolvedOpts, url };
|
|
614
|
+
};
|
|
615
|
+
const request = async (options) => {
|
|
616
|
+
const throwOnError = options.throwOnError ?? _config.throwOnError;
|
|
617
|
+
const responseStyle = options.responseStyle ?? _config.responseStyle;
|
|
618
|
+
let request2;
|
|
619
|
+
let response;
|
|
620
|
+
try {
|
|
621
|
+
const { opts, url } = await beforeRequest(options);
|
|
622
|
+
const requestInit = {
|
|
623
|
+
redirect: "follow",
|
|
624
|
+
...opts,
|
|
625
|
+
body: getValidRequestBody(opts)
|
|
626
|
+
};
|
|
627
|
+
request2 = new Request(url, requestInit);
|
|
628
|
+
for (const fn of interceptors.request.fns) {
|
|
629
|
+
if (fn) {
|
|
630
|
+
request2 = await fn(request2, opts);
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
const _fetch = opts.fetch;
|
|
634
|
+
response = await _fetch(request2);
|
|
635
|
+
for (const fn of interceptors.response.fns) {
|
|
636
|
+
if (fn) {
|
|
637
|
+
response = await fn(response, request2, opts);
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
const result = {
|
|
641
|
+
request: request2,
|
|
642
|
+
response
|
|
643
|
+
};
|
|
644
|
+
if (response.ok) {
|
|
645
|
+
const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
|
|
646
|
+
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
|
647
|
+
let emptyData;
|
|
648
|
+
switch (parseAs) {
|
|
649
|
+
case "arrayBuffer":
|
|
650
|
+
case "blob":
|
|
651
|
+
case "text":
|
|
652
|
+
emptyData = await response[parseAs]();
|
|
653
|
+
break;
|
|
654
|
+
case "formData":
|
|
655
|
+
emptyData = new FormData();
|
|
656
|
+
break;
|
|
657
|
+
case "stream":
|
|
658
|
+
emptyData = response.body;
|
|
659
|
+
break;
|
|
660
|
+
case "json":
|
|
661
|
+
default:
|
|
662
|
+
emptyData = {};
|
|
663
|
+
break;
|
|
664
|
+
}
|
|
665
|
+
return opts.responseStyle === "data" ? emptyData : {
|
|
666
|
+
data: emptyData,
|
|
667
|
+
...result
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
let data;
|
|
671
|
+
switch (parseAs) {
|
|
672
|
+
case "arrayBuffer":
|
|
673
|
+
case "blob":
|
|
674
|
+
case "formData":
|
|
675
|
+
case "text":
|
|
676
|
+
data = await response[parseAs]();
|
|
677
|
+
break;
|
|
678
|
+
case "json": {
|
|
679
|
+
const text = await response.text();
|
|
680
|
+
data = text ? JSON.parse(text) : {};
|
|
681
|
+
break;
|
|
682
|
+
}
|
|
683
|
+
case "stream":
|
|
684
|
+
return opts.responseStyle === "data" ? response.body : {
|
|
685
|
+
data: response.body,
|
|
686
|
+
...result
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
if (parseAs === "json") {
|
|
690
|
+
if (opts.responseValidator) {
|
|
691
|
+
await opts.responseValidator(data);
|
|
692
|
+
}
|
|
693
|
+
if (opts.responseTransformer) {
|
|
694
|
+
data = await opts.responseTransformer(data);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
return opts.responseStyle === "data" ? data : {
|
|
698
|
+
data,
|
|
699
|
+
...result
|
|
700
|
+
};
|
|
701
|
+
}
|
|
702
|
+
const textError = await response.text();
|
|
703
|
+
let jsonError;
|
|
704
|
+
try {
|
|
705
|
+
jsonError = JSON.parse(textError);
|
|
706
|
+
} catch {
|
|
707
|
+
}
|
|
708
|
+
throw jsonError ?? textError;
|
|
709
|
+
} catch (error) {
|
|
710
|
+
let finalError = error;
|
|
711
|
+
for (const fn of interceptors.error.fns) {
|
|
712
|
+
if (fn) {
|
|
713
|
+
finalError = await fn(finalError, response, request2, options);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
finalError = finalError || {};
|
|
717
|
+
if (throwOnError) {
|
|
718
|
+
throw finalError;
|
|
719
|
+
}
|
|
720
|
+
return responseStyle === "data" ? void 0 : {
|
|
721
|
+
error: finalError,
|
|
722
|
+
request: request2,
|
|
723
|
+
response
|
|
724
|
+
};
|
|
725
|
+
}
|
|
726
|
+
};
|
|
727
|
+
const makeMethodFn = (method) => (options) => request({ ...options, method });
|
|
728
|
+
const makeSseFn = (method) => async (options) => {
|
|
729
|
+
const { opts, url } = await beforeRequest(options);
|
|
730
|
+
return createSseClient({
|
|
731
|
+
...opts,
|
|
732
|
+
body: opts.body,
|
|
733
|
+
method,
|
|
734
|
+
onRequest: async (url2, init) => {
|
|
735
|
+
let request2 = new Request(url2, init);
|
|
736
|
+
for (const fn of interceptors.request.fns) {
|
|
737
|
+
if (fn) {
|
|
738
|
+
request2 = await fn(request2, opts);
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
return request2;
|
|
742
|
+
},
|
|
743
|
+
serializedBody: getValidRequestBody(opts),
|
|
744
|
+
url
|
|
745
|
+
});
|
|
746
|
+
};
|
|
747
|
+
const _buildUrl = (options) => buildUrl({ ..._config, ...options });
|
|
748
|
+
return {
|
|
749
|
+
buildUrl: _buildUrl,
|
|
750
|
+
connect: makeMethodFn("CONNECT"),
|
|
751
|
+
delete: makeMethodFn("DELETE"),
|
|
752
|
+
get: makeMethodFn("GET"),
|
|
753
|
+
getConfig,
|
|
754
|
+
head: makeMethodFn("HEAD"),
|
|
755
|
+
interceptors,
|
|
756
|
+
options: makeMethodFn("OPTIONS"),
|
|
757
|
+
patch: makeMethodFn("PATCH"),
|
|
758
|
+
post: makeMethodFn("POST"),
|
|
759
|
+
put: makeMethodFn("PUT"),
|
|
760
|
+
request,
|
|
761
|
+
setConfig,
|
|
762
|
+
sse: {
|
|
763
|
+
connect: makeSseFn("CONNECT"),
|
|
764
|
+
delete: makeSseFn("DELETE"),
|
|
765
|
+
get: makeSseFn("GET"),
|
|
766
|
+
head: makeSseFn("HEAD"),
|
|
767
|
+
options: makeSseFn("OPTIONS"),
|
|
768
|
+
patch: makeSseFn("PATCH"),
|
|
769
|
+
post: makeSseFn("POST"),
|
|
770
|
+
put: makeSseFn("PUT"),
|
|
771
|
+
trace: makeSseFn("TRACE")
|
|
772
|
+
},
|
|
773
|
+
trace: makeMethodFn("TRACE")
|
|
774
|
+
};
|
|
775
|
+
};
|
|
776
|
+
|
|
777
|
+
// generated/cognition/client.gen.ts
|
|
778
|
+
var client = createClient(createConfig());
|
|
779
|
+
|
|
780
|
+
// generated/cognition/sdk.gen.ts
|
|
781
|
+
var HeyApiClient = class {
|
|
782
|
+
client;
|
|
783
|
+
constructor(args) {
|
|
784
|
+
this.client = args?.client ?? client;
|
|
785
|
+
}
|
|
786
|
+
};
|
|
787
|
+
var HeyApiRegistry = class {
|
|
788
|
+
defaultKey = "default";
|
|
789
|
+
instances = /* @__PURE__ */ new Map();
|
|
790
|
+
get(key) {
|
|
791
|
+
const instance = this.instances.get(key ?? this.defaultKey);
|
|
792
|
+
if (!instance) {
|
|
793
|
+
throw new Error(`No SDK client found. Create one with "new Sdk()" to fix this error.`);
|
|
794
|
+
}
|
|
795
|
+
return instance;
|
|
796
|
+
}
|
|
797
|
+
set(value, key) {
|
|
798
|
+
this.instances.set(key ?? this.defaultKey, value);
|
|
799
|
+
}
|
|
800
|
+
};
|
|
801
|
+
var Sdk = class _Sdk extends HeyApiClient {
|
|
802
|
+
static __registry = new HeyApiRegistry();
|
|
803
|
+
constructor(args) {
|
|
804
|
+
super(args);
|
|
805
|
+
_Sdk.__registry.set(this, args?.key);
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* Set the pricing for a model and recompute its recorded rows. Admin only.
|
|
809
|
+
*/
|
|
810
|
+
setPricingHandler(options) {
|
|
811
|
+
return (options.client ?? this.client).post({
|
|
812
|
+
url: "/ai-cost/pricing",
|
|
813
|
+
...options,
|
|
814
|
+
headers: {
|
|
815
|
+
"Content-Type": "application/json",
|
|
816
|
+
...options.headers
|
|
817
|
+
}
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
/**
|
|
821
|
+
* Query recorded AI usage. Admin only.
|
|
822
|
+
*/
|
|
823
|
+
getUsageHandler(options) {
|
|
824
|
+
return (options.client ?? this.client).post({
|
|
825
|
+
url: "/ai-cost/usage",
|
|
826
|
+
...options,
|
|
827
|
+
headers: {
|
|
828
|
+
"Content-Type": "application/json",
|
|
829
|
+
...options.headers
|
|
830
|
+
}
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* Gets or creates an ai projection and the requesting user's instance,
|
|
835
|
+
* triggering (or awaiting) materialization when needed.
|
|
836
|
+
*/
|
|
837
|
+
upsertAiProjection(options) {
|
|
838
|
+
return (options.client ?? this.client).post({
|
|
839
|
+
url: "/ai-projections",
|
|
840
|
+
...options,
|
|
841
|
+
headers: {
|
|
842
|
+
"Content-Type": "application/json",
|
|
843
|
+
...options.headers
|
|
844
|
+
}
|
|
845
|
+
});
|
|
846
|
+
}
|
|
847
|
+
getChatsForAttachmentHandler(options) {
|
|
848
|
+
return (options.client ?? this.client).get({ url: "/attachments/{attachment_id}/chats", ...options });
|
|
849
|
+
}
|
|
850
|
+
/**
|
|
851
|
+
* Soft-delete a chat.
|
|
852
|
+
*/
|
|
853
|
+
deleteChat(options) {
|
|
854
|
+
return (options.client ?? this.client).delete({ url: "/chat/{chat_id}", ...options });
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* Patch a chat's name, project, or share permissions.
|
|
858
|
+
*/
|
|
859
|
+
patchChat(options) {
|
|
860
|
+
return (options.client ?? this.client).patch({
|
|
861
|
+
url: "/chat/{chat_id}",
|
|
862
|
+
...options,
|
|
863
|
+
headers: {
|
|
864
|
+
"Content-Type": "application/json",
|
|
865
|
+
...options.headers
|
|
866
|
+
}
|
|
867
|
+
});
|
|
868
|
+
}
|
|
869
|
+
/**
|
|
870
|
+
* Permanently delete a chat and all associated data.
|
|
871
|
+
*/
|
|
872
|
+
permanentlyDeleteChat(options) {
|
|
873
|
+
return (options.client ?? this.client).delete({ url: "/chat/{chat_id}/permanent", ...options });
|
|
874
|
+
}
|
|
875
|
+
/**
|
|
876
|
+
* Create a new chat.
|
|
877
|
+
*/
|
|
878
|
+
createChat(options) {
|
|
879
|
+
return (options.client ?? this.client).post({
|
|
880
|
+
url: "/chats",
|
|
881
|
+
...options,
|
|
882
|
+
headers: {
|
|
883
|
+
"Content-Type": "application/json",
|
|
884
|
+
...options.headers
|
|
885
|
+
}
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
889
|
+
* Retrieves chat history for a specific chat ID
|
|
890
|
+
*/
|
|
891
|
+
getChatHistoryHandler(options) {
|
|
892
|
+
return (options.client ?? this.client).get({ url: "/chats/history/{chat_id}", ...options });
|
|
893
|
+
}
|
|
894
|
+
/**
|
|
895
|
+
* Retrieves chat history for multiple message IDs
|
|
896
|
+
*/
|
|
897
|
+
getChatHistoryBatchMessagesHandler(options) {
|
|
898
|
+
return (options.client ?? this.client).post({
|
|
899
|
+
url: "/chats/history_batch_messages",
|
|
900
|
+
...options,
|
|
901
|
+
headers: {
|
|
902
|
+
"Content-Type": "application/json",
|
|
903
|
+
...options.headers
|
|
904
|
+
}
|
|
905
|
+
});
|
|
906
|
+
}
|
|
907
|
+
/**
|
|
908
|
+
* Get a chat by ID with messages and web citations.
|
|
909
|
+
*/
|
|
910
|
+
getChat(options) {
|
|
911
|
+
return (options.client ?? this.client).get({ url: "/chats/{chat_id}", ...options });
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* Copy a chat and its messages into a new chat.
|
|
915
|
+
*/
|
|
916
|
+
copyChat(options) {
|
|
917
|
+
return (options.client ?? this.client).post({ url: "/chats/{chat_id}/copy", ...options });
|
|
918
|
+
}
|
|
919
|
+
/**
|
|
920
|
+
* Get the share permissions for a chat.
|
|
921
|
+
*/
|
|
922
|
+
getChatPermissions(options) {
|
|
923
|
+
return (options.client ?? this.client).get({ url: "/chats/{chat_id}/permissions", ...options });
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
* Revert a soft-deleted chat.
|
|
927
|
+
*/
|
|
928
|
+
revertDeleteChat(options) {
|
|
929
|
+
return (options.client ?? this.client).put({ url: "/chats/{chat_id}/revert_delete", ...options });
|
|
930
|
+
}
|
|
931
|
+
/**
|
|
932
|
+
* Execute a pending tool call, optionally with updated arguments.
|
|
933
|
+
*/
|
|
934
|
+
callTool(options) {
|
|
935
|
+
return (options.client ?? this.client).post({
|
|
936
|
+
url: "/chats/{chat_id}/tool/call",
|
|
937
|
+
...options,
|
|
938
|
+
headers: {
|
|
939
|
+
"Content-Type": "application/json",
|
|
940
|
+
...options.headers
|
|
941
|
+
}
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* Reject a pending tool call.
|
|
946
|
+
*/
|
|
947
|
+
rejectToolCall(options) {
|
|
948
|
+
return (options.client ?? this.client).post({
|
|
949
|
+
url: "/chats/{chat_id}/tool/reject",
|
|
950
|
+
...options,
|
|
951
|
+
headers: {
|
|
952
|
+
"Content-Type": "application/json",
|
|
953
|
+
...options.headers
|
|
954
|
+
}
|
|
955
|
+
});
|
|
956
|
+
}
|
|
957
|
+
/**
|
|
958
|
+
* Update a tool response.
|
|
959
|
+
*/
|
|
960
|
+
updateToolResponse(options) {
|
|
961
|
+
return (options.client ?? this.client).post({
|
|
962
|
+
url: "/chats/{chat_id}/tool/response/update",
|
|
963
|
+
...options,
|
|
964
|
+
headers: {
|
|
965
|
+
"Content-Type": "application/json",
|
|
966
|
+
...options.headers
|
|
967
|
+
}
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
/**
|
|
971
|
+
* Update a tool call's arguments after validation.
|
|
972
|
+
*/
|
|
973
|
+
updateToolCall(options) {
|
|
974
|
+
return (options.client ?? this.client).post({
|
|
975
|
+
url: "/chats/{chat_id}/tool/update",
|
|
976
|
+
...options,
|
|
977
|
+
headers: {
|
|
978
|
+
"Content-Type": "application/json",
|
|
979
|
+
...options.headers
|
|
980
|
+
}
|
|
981
|
+
});
|
|
982
|
+
}
|
|
983
|
+
getCitationHandler(options) {
|
|
984
|
+
return (options.client ?? this.client).get({ url: "/citations/{id}", ...options });
|
|
985
|
+
}
|
|
986
|
+
/**
|
|
987
|
+
* Health check
|
|
988
|
+
*/
|
|
989
|
+
healthHandler(options) {
|
|
990
|
+
return (options?.client ?? this.client).get({ url: "/health", ...options });
|
|
991
|
+
}
|
|
992
|
+
/**
|
|
993
|
+
* Accept staged imports (starts import jobs) and/or discard staged rows.
|
|
994
|
+
*/
|
|
995
|
+
runImportHandler(options) {
|
|
996
|
+
return (options.client ?? this.client).post({
|
|
997
|
+
url: "/import/run",
|
|
998
|
+
...options,
|
|
999
|
+
headers: {
|
|
1000
|
+
"Content-Type": "application/json",
|
|
1001
|
+
...options.headers
|
|
1002
|
+
}
|
|
1003
|
+
});
|
|
1004
|
+
}
|
|
1005
|
+
/**
|
|
1006
|
+
* Dismiss one source's import section.
|
|
1007
|
+
*/
|
|
1008
|
+
dismissRunHandler(options) {
|
|
1009
|
+
return (options.client ?? this.client).post({ url: "/import/runs/{source}/dismiss", ...options });
|
|
1010
|
+
}
|
|
1011
|
+
/**
|
|
1012
|
+
* Restart a failed (or dismissed) gather run for one source.
|
|
1013
|
+
*/
|
|
1014
|
+
retryGatherHandler(options) {
|
|
1015
|
+
return (options.client ?? this.client).post({ url: "/import/runs/{source}/retry", ...options });
|
|
1016
|
+
}
|
|
1017
|
+
/**
|
|
1018
|
+
* Get the authenticated user's import state: gather runs plus visible
|
|
1019
|
+
* ledger rows.
|
|
1020
|
+
*/
|
|
1021
|
+
getStateHandler(options) {
|
|
1022
|
+
return (options?.client ?? this.client).get({ url: "/import/state", ...options });
|
|
1023
|
+
}
|
|
1024
|
+
/**
|
|
1025
|
+
* Delete an MCP server by URL.
|
|
1026
|
+
*/
|
|
1027
|
+
deleteMcpServer(options) {
|
|
1028
|
+
return (options.client ?? this.client).delete({ url: "/mcp/servers", ...options });
|
|
1029
|
+
}
|
|
1030
|
+
/**
|
|
1031
|
+
* List all MCP servers configured for the authenticated user.
|
|
1032
|
+
*/
|
|
1033
|
+
listMcpServers(options) {
|
|
1034
|
+
return (options?.client ?? this.client).get({ url: "/mcp/servers", ...options });
|
|
1035
|
+
}
|
|
1036
|
+
/**
|
|
1037
|
+
* Add a new MCP server for the authenticated user.
|
|
1038
|
+
*/
|
|
1039
|
+
addMcpServer(options) {
|
|
1040
|
+
return (options.client ?? this.client).post({
|
|
1041
|
+
url: "/mcp/servers",
|
|
1042
|
+
...options,
|
|
1043
|
+
headers: {
|
|
1044
|
+
"Content-Type": "application/json",
|
|
1045
|
+
...options.headers
|
|
1046
|
+
}
|
|
1047
|
+
});
|
|
1048
|
+
}
|
|
1049
|
+
/**
|
|
1050
|
+
* Update an existing MCP server's name or enabled status.
|
|
1051
|
+
*/
|
|
1052
|
+
updateMcpServer(options) {
|
|
1053
|
+
return (options.client ?? this.client).put({
|
|
1054
|
+
url: "/mcp/servers",
|
|
1055
|
+
...options,
|
|
1056
|
+
headers: {
|
|
1057
|
+
"Content-Type": "application/json",
|
|
1058
|
+
...options.headers
|
|
1059
|
+
}
|
|
1060
|
+
});
|
|
1061
|
+
}
|
|
1062
|
+
/**
|
|
1063
|
+
* OAuth callback endpoint — receives code and state, or an error, from the
|
|
1064
|
+
* authorization server.
|
|
1065
|
+
*/
|
|
1066
|
+
mcpAuthCallback(options) {
|
|
1067
|
+
return (options?.client ?? this.client).get({ url: "/mcp/servers/auth/callback", ...options });
|
|
1068
|
+
}
|
|
1069
|
+
/**
|
|
1070
|
+
* Return Macro's public OAuth Client ID Metadata Document.
|
|
1071
|
+
*/
|
|
1072
|
+
mcpOauthClientMetadata(options) {
|
|
1073
|
+
return (options?.client ?? this.client).get({ url: "/mcp/servers/auth/client-metadata", ...options });
|
|
1074
|
+
}
|
|
1075
|
+
/**
|
|
1076
|
+
* Start the OAuth authorization flow for an MCP server.
|
|
1077
|
+
*/
|
|
1078
|
+
startMcpAuth(options) {
|
|
1079
|
+
return (options.client ?? this.client).post({
|
|
1080
|
+
url: "/mcp/servers/auth/start",
|
|
1081
|
+
...options,
|
|
1082
|
+
headers: {
|
|
1083
|
+
"Content-Type": "application/json",
|
|
1084
|
+
...options.headers
|
|
1085
|
+
}
|
|
1086
|
+
});
|
|
1087
|
+
}
|
|
1088
|
+
/**
|
|
1089
|
+
* Get the authenticated user's latest memory.
|
|
1090
|
+
*
|
|
1091
|
+
* Returns the current memory if one exists. If the memory is stale or missing,
|
|
1092
|
+
* a background generation is triggered and the endpoint returns the stale
|
|
1093
|
+
* memory (200) or 404 if none exists yet.
|
|
1094
|
+
*/
|
|
1095
|
+
getMemoryHandler(options) {
|
|
1096
|
+
return (options?.client ?? this.client).get({ url: "/memory", ...options });
|
|
1097
|
+
}
|
|
1098
|
+
/**
|
|
1099
|
+
* Get the authenticated user's onboarding state. While the flow is active
|
|
1100
|
+
* this also starts any gather runs that are due, so polling this endpoint
|
|
1101
|
+
* is what keeps onboarding moving.
|
|
1102
|
+
*/
|
|
1103
|
+
getStateHandler2(options) {
|
|
1104
|
+
return (options?.client ?? this.client).get({ url: "/onboarding", ...options });
|
|
1105
|
+
}
|
|
1106
|
+
/**
|
|
1107
|
+
* Complete (or skip) onboarding. Unreserved leftover onboarding-staged
|
|
1108
|
+
* import candidates are deleted.
|
|
1109
|
+
*/
|
|
1110
|
+
completeHandler(options) {
|
|
1111
|
+
return (options.client ?? this.client).post({
|
|
1112
|
+
url: "/onboarding/complete",
|
|
1113
|
+
...options,
|
|
1114
|
+
headers: {
|
|
1115
|
+
"Content-Type": "application/json",
|
|
1116
|
+
...options.headers
|
|
1117
|
+
}
|
|
1118
|
+
});
|
|
1119
|
+
}
|
|
1120
|
+
/**
|
|
1121
|
+
* Browse or search the catalog of connectable apps.
|
|
1122
|
+
*
|
|
1123
|
+
* Results come from Pipedream's app directory, most popular first.
|
|
1124
|
+
*/
|
|
1125
|
+
browsePipedreamMcpCatalog(options) {
|
|
1126
|
+
return (options?.client ?? this.client).get({ url: "/pipedream/mcp/catalog", ...options });
|
|
1127
|
+
}
|
|
1128
|
+
/**
|
|
1129
|
+
* Register a connected account reported by the Pipedream Connect UI.
|
|
1130
|
+
*
|
|
1131
|
+
* Verifies with Pipedream that the account exists and was connected for
|
|
1132
|
+
* the authenticated user before persisting anything.
|
|
1133
|
+
*/
|
|
1134
|
+
completePipedreamMcpConnection(options) {
|
|
1135
|
+
return (options.client ?? this.client).post({
|
|
1136
|
+
url: "/pipedream/mcp/complete",
|
|
1137
|
+
...options,
|
|
1138
|
+
headers: {
|
|
1139
|
+
"Content-Type": "application/json",
|
|
1140
|
+
...options.headers
|
|
1141
|
+
}
|
|
1142
|
+
});
|
|
1143
|
+
}
|
|
1144
|
+
/**
|
|
1145
|
+
* Disconnect an app, revoking its Pipedream account.
|
|
1146
|
+
*/
|
|
1147
|
+
deletePipedreamMcpConnection(options) {
|
|
1148
|
+
return (options.client ?? this.client).delete({ url: "/pipedream/mcp/connections", ...options });
|
|
1149
|
+
}
|
|
1150
|
+
/**
|
|
1151
|
+
* List the MCP apps connected by the authenticated user.
|
|
1152
|
+
*/
|
|
1153
|
+
listPipedreamMcpConnections(options) {
|
|
1154
|
+
return (options?.client ?? this.client).get({ url: "/pipedream/mcp/connections", ...options });
|
|
1155
|
+
}
|
|
1156
|
+
/**
|
|
1157
|
+
* Rename or enable/disable a connected app.
|
|
1158
|
+
*/
|
|
1159
|
+
updatePipedreamMcpConnection(options) {
|
|
1160
|
+
return (options.client ?? this.client).put({
|
|
1161
|
+
url: "/pipedream/mcp/connections",
|
|
1162
|
+
...options,
|
|
1163
|
+
headers: {
|
|
1164
|
+
"Content-Type": "application/json",
|
|
1165
|
+
...options.headers
|
|
1166
|
+
}
|
|
1167
|
+
});
|
|
1168
|
+
}
|
|
1169
|
+
/**
|
|
1170
|
+
* Create a short-lived Pipedream Connect token for the authenticated user.
|
|
1171
|
+
*
|
|
1172
|
+
* The frontend opens Pipedream's hosted Connect UI with this token; the
|
|
1173
|
+
* user picks (or is deep-linked into) an app and authorizes it there.
|
|
1174
|
+
*/
|
|
1175
|
+
createPipedreamMcpToken(options) {
|
|
1176
|
+
return (options?.client ?? this.client).post({ url: "/pipedream/mcp/token", ...options });
|
|
1177
|
+
}
|
|
1178
|
+
getBatchPreview(options) {
|
|
1179
|
+
return (options.client ?? this.client).post({
|
|
1180
|
+
url: "/preview",
|
|
1181
|
+
...options,
|
|
1182
|
+
headers: {
|
|
1183
|
+
"Content-Type": "application/json",
|
|
1184
|
+
...options.headers
|
|
1185
|
+
}
|
|
1186
|
+
});
|
|
1187
|
+
}
|
|
1188
|
+
/**
|
|
1189
|
+
* Send a new chat message and stream the AI response.
|
|
1190
|
+
*
|
|
1191
|
+
* This endpoint initiates a chat message and streams the response via the stream service.
|
|
1192
|
+
* The client should subscribe to the returned stream_id via connection_gateway to receive chunks.
|
|
1193
|
+
*/
|
|
1194
|
+
sendChatMessage(options) {
|
|
1195
|
+
return (options.client ?? this.client).post({
|
|
1196
|
+
url: "/stream/chat/message",
|
|
1197
|
+
...options,
|
|
1198
|
+
headers: {
|
|
1199
|
+
"Content-Type": "application/json",
|
|
1200
|
+
...options.headers
|
|
1201
|
+
}
|
|
1202
|
+
});
|
|
1203
|
+
}
|
|
1204
|
+
/**
|
|
1205
|
+
* Stop an in-flight AI chat stream.
|
|
1206
|
+
*
|
|
1207
|
+
* Cancels the streaming task associated with the given `stream_id`, causing
|
|
1208
|
+
* it to persist whatever has been generated so far and emit `StreamEnd`.
|
|
1209
|
+
* The caller must have at least `Edit` access to the chat.
|
|
1210
|
+
*/
|
|
1211
|
+
stopChatStream(options) {
|
|
1212
|
+
return (options.client ?? this.client).post({
|
|
1213
|
+
url: "/stream/chat/message/stop",
|
|
1214
|
+
...options,
|
|
1215
|
+
headers: {
|
|
1216
|
+
"Content-Type": "application/json",
|
|
1217
|
+
...options.headers
|
|
1218
|
+
}
|
|
1219
|
+
});
|
|
1220
|
+
}
|
|
1221
|
+
structuredCompletion(options) {
|
|
1222
|
+
return (options.client ?? this.client).post({
|
|
1223
|
+
url: "/structured-completion",
|
|
1224
|
+
...options,
|
|
1225
|
+
headers: {
|
|
1226
|
+
"Content-Type": "application/json",
|
|
1227
|
+
...options.headers
|
|
1228
|
+
}
|
|
1229
|
+
});
|
|
1230
|
+
}
|
|
1231
|
+
};
|
|
1232
|
+
|
|
1233
|
+
export {
|
|
1234
|
+
Sdk
|
|
1235
|
+
};
|