@gpt-platform/client 0.10.5 → 0.11.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/dist/_internal/client/client.gen.d.ts +3 -0
- package/dist/_internal/client/client.gen.d.ts.map +1 -0
- package/dist/_internal/client/index.d.ts +9 -0
- package/dist/_internal/client/index.d.ts.map +1 -0
- package/dist/_internal/client/types.gen.d.ts +118 -0
- package/dist/_internal/client/types.gen.d.ts.map +1 -0
- package/dist/_internal/client/utils.gen.d.ts +34 -0
- package/dist/_internal/client/utils.gen.d.ts.map +1 -0
- package/dist/_internal/client.gen.d.ts +13 -0
- package/dist/_internal/client.gen.d.ts.map +1 -0
- package/dist/_internal/core/auth.gen.d.ts +19 -0
- package/dist/_internal/core/auth.gen.d.ts.map +1 -0
- package/dist/_internal/core/bodySerializer.gen.d.ts +26 -0
- package/dist/_internal/core/bodySerializer.gen.d.ts.map +1 -0
- package/dist/_internal/core/params.gen.d.ts +44 -0
- package/dist/_internal/core/params.gen.d.ts.map +1 -0
- package/dist/_internal/core/pathSerializer.gen.d.ts +34 -0
- package/dist/_internal/core/pathSerializer.gen.d.ts.map +1 -0
- package/dist/_internal/core/queryKeySerializer.gen.d.ts +19 -0
- package/dist/_internal/core/queryKeySerializer.gen.d.ts.map +1 -0
- package/dist/_internal/core/serverSentEvents.gen.d.ts +72 -0
- package/dist/_internal/core/serverSentEvents.gen.d.ts.map +1 -0
- package/dist/_internal/core/types.gen.d.ts +79 -0
- package/dist/_internal/core/types.gen.d.ts.map +1 -0
- package/dist/_internal/core/utils.gen.d.ts +20 -0
- package/dist/_internal/core/utils.gen.d.ts.map +1 -0
- package/dist/_internal/index.d.ts +3 -0
- package/dist/_internal/index.d.ts.map +1 -0
- package/dist/_internal/sdk.gen.d.ts +7053 -0
- package/dist/_internal/sdk.gen.d.ts.map +1 -0
- package/dist/_internal/types.gen.d.ts +146633 -0
- package/dist/_internal/types.gen.d.ts.map +1 -0
- package/dist/base-client.d.ts +199 -0
- package/dist/base-client.d.ts.map +1 -0
- package/dist/errors/index.d.ts +128 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/events.d.ts +69 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/execution-events.d.ts +95 -0
- package/dist/execution-events.d.ts.map +1 -0
- package/dist/gpt-client.d.ts +2175 -0
- package/dist/gpt-client.d.ts.map +1 -0
- package/dist/index.d.ts +51 -30734
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +318 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +318 -9
- package/dist/index.mjs.map +1 -1
- package/dist/json-api.d.ts +26 -0
- package/dist/json-api.d.ts.map +1 -0
- package/dist/logging.d.ts +22 -0
- package/dist/logging.d.ts.map +1 -0
- package/dist/namespace-types.d.ts +79 -0
- package/dist/namespace-types.d.ts.map +1 -0
- package/dist/namespaces/access-grants.d.ts +71 -0
- package/dist/namespaces/access-grants.d.ts.map +1 -0
- package/dist/namespaces/agents.d.ts +1406 -0
- package/dist/namespaces/agents.d.ts.map +1 -0
- package/dist/namespaces/ai.d.ts +407 -0
- package/dist/namespaces/ai.d.ts.map +1 -0
- package/dist/namespaces/audit.d.ts +83 -0
- package/dist/namespaces/audit.d.ts.map +1 -0
- package/dist/namespaces/billing.d.ts +854 -0
- package/dist/namespaces/billing.d.ts.map +1 -0
- package/dist/namespaces/campaigns.d.ts +973 -0
- package/dist/namespaces/campaigns.d.ts.map +1 -0
- package/dist/namespaces/catalog.d.ts +964 -0
- package/dist/namespaces/catalog.d.ts.map +1 -0
- package/dist/namespaces/channels.d.ts +162 -0
- package/dist/namespaces/channels.d.ts.map +1 -0
- package/dist/namespaces/clinical.d.ts +2443 -0
- package/dist/namespaces/clinical.d.ts.map +1 -0
- package/dist/namespaces/communication.d.ts +439 -0
- package/dist/namespaces/communication.d.ts.map +1 -0
- package/dist/namespaces/compliance.d.ts +2310 -0
- package/dist/namespaces/compliance.d.ts.map +1 -0
- package/dist/namespaces/connectors.d.ts +1368 -0
- package/dist/namespaces/connectors.d.ts.map +1 -0
- package/dist/namespaces/content.d.ts +188 -0
- package/dist/namespaces/content.d.ts.map +1 -0
- package/dist/namespaces/crawler.d.ts +408 -0
- package/dist/namespaces/crawler.d.ts.map +1 -0
- package/dist/namespaces/crm-clusters.d.ts +31 -0
- package/dist/namespaces/crm-clusters.d.ts.map +1 -0
- package/dist/namespaces/crm.d.ts +1539 -0
- package/dist/namespaces/crm.d.ts.map +1 -0
- package/dist/namespaces/documents.d.ts +136 -0
- package/dist/namespaces/documents.d.ts.map +1 -0
- package/dist/namespaces/email.d.ts +550 -0
- package/dist/namespaces/email.d.ts.map +1 -0
- package/dist/namespaces/extraction.d.ts +1249 -0
- package/dist/namespaces/extraction.d.ts.map +1 -0
- package/dist/namespaces/identity.d.ts +411 -0
- package/dist/namespaces/identity.d.ts.map +1 -0
- package/dist/namespaces/imports.d.ts +177 -0
- package/dist/namespaces/imports.d.ts.map +1 -0
- package/dist/namespaces/index.d.ts +119 -0
- package/dist/namespaces/index.d.ts.map +1 -0
- package/dist/namespaces/memory.d.ts +105 -0
- package/dist/namespaces/memory.d.ts.map +1 -0
- package/dist/namespaces/models.d.ts +75 -0
- package/dist/namespaces/models.d.ts.map +1 -0
- package/dist/namespaces/permissions.d.ts +75 -0
- package/dist/namespaces/permissions.d.ts.map +1 -0
- package/dist/namespaces/pipeline-executions.d.ts +130 -0
- package/dist/namespaces/pipeline-executions.d.ts.map +1 -0
- package/dist/namespaces/pipelines.d.ts +120 -0
- package/dist/namespaces/pipelines.d.ts.map +1 -0
- package/dist/namespaces/platform.d.ts +1430 -0
- package/dist/namespaces/platform.d.ts.map +1 -0
- package/dist/namespaces/portal.d.ts +198 -0
- package/dist/namespaces/portal.d.ts.map +1 -0
- package/dist/namespaces/projects.d.ts +553 -0
- package/dist/namespaces/projects.d.ts.map +1 -0
- package/dist/namespaces/roles.d.ts +65 -0
- package/dist/namespaces/roles.d.ts.map +1 -0
- package/dist/namespaces/scheduling.d.ts +944 -0
- package/dist/namespaces/scheduling.d.ts.map +1 -0
- package/dist/namespaces/search.d.ts +224 -0
- package/dist/namespaces/search.d.ts.map +1 -0
- package/dist/namespaces/session-notes.d.ts +67 -0
- package/dist/namespaces/session-notes.d.ts.map +1 -0
- package/dist/namespaces/social.d.ts +330 -0
- package/dist/namespaces/social.d.ts.map +1 -0
- package/dist/namespaces/storage.d.ts +378 -0
- package/dist/namespaces/storage.d.ts.map +1 -0
- package/dist/namespaces/support.d.ts +427 -0
- package/dist/namespaces/support.d.ts.map +1 -0
- package/dist/namespaces/threads.d.ts +596 -0
- package/dist/namespaces/threads.d.ts.map +1 -0
- package/dist/namespaces/training.d.ts +358 -0
- package/dist/namespaces/training.d.ts.map +1 -0
- package/dist/namespaces/voice.d.ts +752 -0
- package/dist/namespaces/voice.d.ts.map +1 -0
- package/dist/namespaces/watcher.d.ts +425 -0
- package/dist/namespaces/watcher.d.ts.map +1 -0
- package/dist/namespaces/webhooks-ns.d.ts +3 -0
- package/dist/namespaces/webhooks-ns.d.ts.map +1 -0
- package/dist/pagination.d.ts +57 -0
- package/dist/pagination.d.ts.map +1 -0
- package/dist/request-builder.d.ts +95 -0
- package/dist/request-builder.d.ts.map +1 -0
- package/dist/security.d.ts +32 -0
- package/dist/security.d.ts.map +1 -0
- package/dist/streaming.d.ts +135 -0
- package/dist/streaming.d.ts.map +1 -0
- package/dist/utils/retry.d.ts +63 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/version.d.ts +5 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/webhook-signature.d.ts +109 -0
- package/dist/webhook-signature.d.ts.map +1 -0
- package/llms.txt +7 -1
- package/package.json +286 -36
- package/dist/index.d.mts +0 -30734
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for streaming requests
|
|
3
|
+
*/
|
|
4
|
+
export interface StreamOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Signal to abort the stream
|
|
7
|
+
*/
|
|
8
|
+
signal?: AbortSignal;
|
|
9
|
+
/**
|
|
10
|
+
* Callback for handling errors
|
|
11
|
+
*/
|
|
12
|
+
onError?: (error: Error) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Maximum stream duration in milliseconds (default: 5 minutes)
|
|
15
|
+
* Prevents DoS via infinite streams
|
|
16
|
+
*/
|
|
17
|
+
timeout?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Maximum number of chunks to process (default: 10000)
|
|
20
|
+
* Prevents memory exhaustion via malicious streams
|
|
21
|
+
*/
|
|
22
|
+
maxChunks?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Maximum buffer size in bytes (default: 10MB)
|
|
25
|
+
* Prevents unbounded memory growth
|
|
26
|
+
*/
|
|
27
|
+
maxBufferSize?: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Parse Server-Sent Events (SSE) stream into typed chunks
|
|
31
|
+
* Security: Enforces timeout, chunk count, and buffer size limits to prevent DoS
|
|
32
|
+
*/
|
|
33
|
+
export declare function streamSSE<T = unknown>(response: Response, options?: StreamOptions): AsyncIterableIterator<T>;
|
|
34
|
+
/**
|
|
35
|
+
* Events emitted by thread message streaming.
|
|
36
|
+
*
|
|
37
|
+
* For threads backed by an agent, the stream emits the full execution event
|
|
38
|
+
* lifecycle including tool calls and results. For RAG threads (no agent),
|
|
39
|
+
* only `content`/`token`, `done`, and `error` events are emitted.
|
|
40
|
+
*
|
|
41
|
+
* The `type` field is a discriminant — use a `switch` statement to narrow.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* const stream = await client.threads.messages.stream(threadId, { content: 'Hello' });
|
|
46
|
+
* for await (const event of stream) {
|
|
47
|
+
* switch (event.type) {
|
|
48
|
+
* case "token":
|
|
49
|
+
* process.stdout.write(event.content ?? '');
|
|
50
|
+
* break;
|
|
51
|
+
* case "tool_call":
|
|
52
|
+
* console.log(`Calling: ${event.data?.name}`);
|
|
53
|
+
* break;
|
|
54
|
+
* case "tool_result":
|
|
55
|
+
* console.log(`Result: ${event.data?.summary}`);
|
|
56
|
+
* break;
|
|
57
|
+
* case "done":
|
|
58
|
+
* console.log('Complete', event.metadata);
|
|
59
|
+
* break;
|
|
60
|
+
* }
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export type StreamMessageChunk = StreamTokenEvent | StreamToolCallEvent | StreamToolResultEvent | StreamIterationCompleteEvent | StreamApprovalRequiredEvent | StreamDoneEvent | StreamErrorEvent;
|
|
65
|
+
/**
|
|
66
|
+
* Incremental token from LLM streaming output.
|
|
67
|
+
* `type: "content"` is a backward-compatible alias — new consumers should match on `"token"`.
|
|
68
|
+
*/
|
|
69
|
+
export interface StreamTokenEvent {
|
|
70
|
+
type: "token" | "content";
|
|
71
|
+
content?: string;
|
|
72
|
+
}
|
|
73
|
+
/** Tool invocation started (agent-backed threads only). */
|
|
74
|
+
export interface StreamToolCallEvent {
|
|
75
|
+
type: "tool_call";
|
|
76
|
+
data: {
|
|
77
|
+
name: string;
|
|
78
|
+
arguments: Record<string, unknown>;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/** Tool invocation completed (agent-backed threads only). */
|
|
82
|
+
export interface StreamToolResultEvent {
|
|
83
|
+
type: "tool_result";
|
|
84
|
+
data: {
|
|
85
|
+
name: string;
|
|
86
|
+
summary: string;
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/** LLM loop iteration completed (agent-backed threads only). */
|
|
90
|
+
export interface StreamIterationCompleteEvent {
|
|
91
|
+
type: "iteration_complete";
|
|
92
|
+
data: {
|
|
93
|
+
iteration: number;
|
|
94
|
+
tokens: number;
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/** Human-in-the-loop approval required (agent-backed threads only). */
|
|
98
|
+
export interface StreamApprovalRequiredEvent {
|
|
99
|
+
type: "approval_required";
|
|
100
|
+
data: {
|
|
101
|
+
tool_name: string;
|
|
102
|
+
arguments: Record<string, unknown>;
|
|
103
|
+
classification: string;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/** Metadata included with stream completion events. */
|
|
107
|
+
export interface StreamDoneMetadata {
|
|
108
|
+
thread_id?: string;
|
|
109
|
+
execution_id?: string;
|
|
110
|
+
total_tokens?: number;
|
|
111
|
+
[key: string]: unknown;
|
|
112
|
+
}
|
|
113
|
+
/** Stream completed successfully. */
|
|
114
|
+
export interface StreamDoneEvent {
|
|
115
|
+
type: "done";
|
|
116
|
+
content?: string;
|
|
117
|
+
error?: string;
|
|
118
|
+
metadata?: StreamDoneMetadata;
|
|
119
|
+
}
|
|
120
|
+
/** Stream error. */
|
|
121
|
+
export interface StreamErrorEvent {
|
|
122
|
+
type: "error";
|
|
123
|
+
content?: string;
|
|
124
|
+
error?: string;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Parse streaming message response — stops on terminal events.
|
|
128
|
+
*/
|
|
129
|
+
export declare function streamMessage(response: Response, options?: StreamOptions): AsyncIterableIterator<StreamMessageChunk>;
|
|
130
|
+
/**
|
|
131
|
+
* Collect full message from stream chunks.
|
|
132
|
+
* Handles both `type: "token"` (agent-backed) and `type: "content"` (RAG) events.
|
|
133
|
+
*/
|
|
134
|
+
export declare function collectStreamedMessage(stream: AsyncIterableIterator<StreamMessageChunk>): Promise<string>;
|
|
135
|
+
//# sourceMappingURL=streaming.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streaming.d.ts","sourceRoot":"","sources":["../src/streaming.ts"],"names":[],"mappings":"AASA;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEjC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAuB,SAAS,CAAC,CAAC,GAAG,OAAO,EAC1C,QAAQ,EAAE,QAAQ,EAClB,OAAO,GAAE,aAAkB,GAC1B,qBAAqB,CAAC,CAAC,CAAC,CAiG1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,MAAM,kBAAkB,GAC1B,gBAAgB,GAChB,mBAAmB,GACnB,qBAAqB,GACrB,4BAA4B,GAC5B,2BAA2B,GAC3B,eAAe,GACf,gBAAgB,CAAC;AAErB;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,2DAA2D;AAC3D,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC;CAC5D;AAED,6DAA6D;AAC7D,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CACzC;AAED,gEAAgE;AAChE,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,oBAAoB,CAAC;IAC3B,IAAI,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7C;AAED,uEAAuE;AACvE,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,mBAAmB,CAAC;IAC1B,IAAI,EAAE;QACJ,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACnC,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;CACH;AAED,uDAAuD;AACvD,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,qCAAqC;AACrC,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,kBAAkB,CAAC;CAC/B;AAED,oBAAoB;AACpB,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,wBAAuB,aAAa,CAClC,QAAQ,EAAE,QAAQ,EAClB,OAAO,GAAE,aAAkB,GAC1B,qBAAqB,CAAC,kBAAkB,CAAC,CAS3C;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,qBAAqB,CAAC,kBAAkB,CAAC,GAChD,OAAO,CAAC,MAAM,CAAC,CA2BjB"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { GptCoreError } from "../errors/index";
|
|
2
|
+
/**
|
|
3
|
+
* Retry configuration
|
|
4
|
+
*/
|
|
5
|
+
export interface RetryConfig {
|
|
6
|
+
/** Maximum number of retry attempts (default: 3) */
|
|
7
|
+
maxRetries: number;
|
|
8
|
+
/** Initial delay in milliseconds before first retry (default: 1000) */
|
|
9
|
+
initialDelay: number;
|
|
10
|
+
/** Maximum delay in milliseconds between retries (default: 32000) */
|
|
11
|
+
maxDelay: number;
|
|
12
|
+
/** HTTP status codes that trigger retry (default: [429, 500, 502, 503, 504]) */
|
|
13
|
+
retryableStatusCodes: number[];
|
|
14
|
+
/**
|
|
15
|
+
* Total timeout in milliseconds across all retry attempts.
|
|
16
|
+
* Prevents infinite retry loops from malicious Retry-After headers.
|
|
17
|
+
* Default: 300000 (5 minutes)
|
|
18
|
+
*/
|
|
19
|
+
totalTimeout?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Maximum value for Retry-After header in seconds.
|
|
22
|
+
* Prevents DoS via excessive server-requested delays.
|
|
23
|
+
* Default: 60 seconds
|
|
24
|
+
*/
|
|
25
|
+
maxRetryAfter?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Optional AbortSignal to cancel retry attempts.
|
|
28
|
+
* When aborted, the retry loop immediately throws an error.
|
|
29
|
+
*/
|
|
30
|
+
signal?: AbortSignal;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Default retry configuration
|
|
34
|
+
*/
|
|
35
|
+
export declare const DEFAULT_RETRY_CONFIG: RetryConfig;
|
|
36
|
+
/**
|
|
37
|
+
* Check if an error is retryable
|
|
38
|
+
*/
|
|
39
|
+
export declare function isRetryableError(error: unknown, retryableStatusCodes: number[]): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Calculate exponential backoff delay with security limits
|
|
42
|
+
*/
|
|
43
|
+
export declare function calculateBackoff(attempt: number, initialDelay: number, maxDelay: number, retryAfter?: number, maxRetryAfter?: number): number;
|
|
44
|
+
/**
|
|
45
|
+
* Sleep for specified milliseconds with optional abort signal
|
|
46
|
+
*/
|
|
47
|
+
export declare function sleep(ms: number, signal?: AbortSignal): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Error thrown when retry total timeout is exceeded
|
|
50
|
+
*/
|
|
51
|
+
export declare class RetryTimeoutError extends GptCoreError {
|
|
52
|
+
readonly lastError?: unknown;
|
|
53
|
+
constructor(message: string, lastError?: unknown);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Retry a function with exponential backoff and circuit breaker
|
|
57
|
+
*/
|
|
58
|
+
export declare function retryWithBackoff<T>(fn: () => Promise<T>, config?: RetryConfig): Promise<T>;
|
|
59
|
+
/**
|
|
60
|
+
* Create a retry wrapper for a client method
|
|
61
|
+
*/
|
|
62
|
+
export declare function withRetry<TArgs extends unknown[], TReturn>(fn: (...args: TArgs) => Promise<TReturn>, config?: Partial<RetryConfig>): (...args: TArgs) => Promise<TReturn>;
|
|
63
|
+
//# sourceMappingURL=retry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../src/utils/retry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,oDAAoD;IACpD,UAAU,EAAE,MAAM,CAAC;IACnB,uEAAuE;IACvE,YAAY,EAAE,MAAM,CAAC;IACrB,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC;IACjB,gFAAgF;IAChF,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAOlC,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,EACd,oBAAoB,EAAE,MAAM,EAAE,GAC7B,OAAO,CAcT;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,EACnB,aAAa,GAAE,MAAW,GACzB,MAAM,CAcR;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAqBrE;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,YAAY;IACjD,SAAgB,SAAS,CAAC,EAAE,OAAO,CAAC;gBAExB,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO;CAIjD;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,EACtC,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,MAAM,GAAE,WAAkC,GACzC,OAAO,CAAC,CAAC,CAAC,CA+EZ;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,SAAS,OAAO,EAAE,EAAE,OAAO,EACxD,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,EACxC,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAC5B,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,CAMtC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** SDK version — updated automatically by mix update.sdks */
|
|
2
|
+
export declare const SDK_VERSION = "0.11.1";
|
|
3
|
+
/** Default API version sent in every request — updated automatically by mix update.sdks */
|
|
4
|
+
export declare const DEFAULT_API_VERSION = "2026-03-23";
|
|
5
|
+
//# sourceMappingURL=version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,eAAO,MAAM,WAAW,WAAW,CAAC;AAEpC,2FAA2F;AAC3F,eAAO,MAAM,mBAAmB,eAAe,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Webhook signature verification for GPT Core webhooks.
|
|
3
|
+
*
|
|
4
|
+
* Verifies that incoming webhook payloads are authentic by checking
|
|
5
|
+
* the HMAC-SHA256 signature in the `X-GptCore-Signature` header.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { Webhooks } from '@gpt-platform/client';
|
|
10
|
+
*
|
|
11
|
+
* const webhooks = new Webhooks('whsec_your_secret_here');
|
|
12
|
+
*
|
|
13
|
+
* // In your webhook handler:
|
|
14
|
+
* const isValid = await webhooks.verify(requestBody, signatureHeader);
|
|
15
|
+
*
|
|
16
|
+
* // Or construct and verify manually:
|
|
17
|
+
* const isValid = await Webhooks.verify(requestBody, signatureHeader, 'whsec_your_secret');
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Error thrown when webhook signature verification fails.
|
|
22
|
+
*/
|
|
23
|
+
export declare class WebhookSignatureError extends Error {
|
|
24
|
+
constructor(message: string);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Clear the internal CryptoKey cache.
|
|
28
|
+
* Useful for testing or when secrets are rotated.
|
|
29
|
+
*/
|
|
30
|
+
export declare function clearKeyCache(): void;
|
|
31
|
+
export interface WebhookVerifyOptions {
|
|
32
|
+
/**
|
|
33
|
+
* Tolerance in seconds for timestamp verification.
|
|
34
|
+
* Rejects signatures older than this.
|
|
35
|
+
* Default: 300 (5 minutes)
|
|
36
|
+
*/
|
|
37
|
+
tolerance?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Current timestamp in seconds (for testing).
|
|
40
|
+
* Default: Date.now() / 1000
|
|
41
|
+
*/
|
|
42
|
+
currentTimestamp?: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Webhook signature verification utility.
|
|
46
|
+
*
|
|
47
|
+
* Create an instance with your webhook secret, then use `.verify()`
|
|
48
|
+
* to validate incoming webhook payloads.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* const wh = new Webhooks('whsec_your_secret');
|
|
53
|
+
*
|
|
54
|
+
* app.post('/webhooks', async (req, res) => {
|
|
55
|
+
* const signature = req.headers['x-gptcore-signature'];
|
|
56
|
+
* const body = req.body; // raw string body
|
|
57
|
+
*
|
|
58
|
+
* try {
|
|
59
|
+
* await wh.verify(body, signature);
|
|
60
|
+
* // Process the webhook...
|
|
61
|
+
* res.status(200).send('OK');
|
|
62
|
+
* } catch (err) {
|
|
63
|
+
* res.status(400).send('Invalid signature');
|
|
64
|
+
* }
|
|
65
|
+
* });
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare class Webhooks {
|
|
69
|
+
private secret;
|
|
70
|
+
constructor(secret: string);
|
|
71
|
+
/**
|
|
72
|
+
* Verify a webhook payload signature.
|
|
73
|
+
*
|
|
74
|
+
* @param payload - The raw request body string
|
|
75
|
+
* @param signatureHeader - The `X-GptCore-Signature` header value
|
|
76
|
+
* @param options - Optional verification parameters
|
|
77
|
+
* @throws {WebhookSignatureError} If verification fails
|
|
78
|
+
*/
|
|
79
|
+
verify(payload: string, signatureHeader: string, options?: WebhookVerifyOptions): Promise<true>;
|
|
80
|
+
/**
|
|
81
|
+
* Verify a webhook payload signature — returns `false` instead of throwing.
|
|
82
|
+
*
|
|
83
|
+
* Use this when you prefer a boolean check over try/catch:
|
|
84
|
+
* ```typescript
|
|
85
|
+
* if (await wh.safeVerify(body, signature)) {
|
|
86
|
+
* // valid
|
|
87
|
+
* } else {
|
|
88
|
+
* // invalid — reject
|
|
89
|
+
* }
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
safeVerify(payload: string, signatureHeader: string, options?: WebhookVerifyOptions): Promise<boolean>;
|
|
93
|
+
/**
|
|
94
|
+
* Static verification method.
|
|
95
|
+
* The secret should be the raw secret (whsec_ prefix is stripped automatically).
|
|
96
|
+
*
|
|
97
|
+
* @param payload - The raw request body string
|
|
98
|
+
* @param signatureHeader - The `X-GptCore-Signature` header value
|
|
99
|
+
* @param secret - The webhook signing secret
|
|
100
|
+
* @param options - Optional verification parameters
|
|
101
|
+
* @throws {WebhookSignatureError} If verification fails
|
|
102
|
+
*/
|
|
103
|
+
static verify(payload: string, signatureHeader: string, secret: string, options?: WebhookVerifyOptions): Promise<true>;
|
|
104
|
+
/**
|
|
105
|
+
* Static safe verification — returns `false` instead of throwing.
|
|
106
|
+
*/
|
|
107
|
+
static safeVerify(payload: string, signatureHeader: string, secret: string, options?: WebhookVerifyOptions): Promise<boolean>;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=webhook-signature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook-signature.d.ts","sourceRoot":"","sources":["../src/webhook-signature.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,OAAO,EAAE,MAAM;CAI5B;AA4ED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAEpC;AAqDD,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,MAAM;IAO1B;;;;;;;OAOG;IACG,MAAM,CACV,OAAO,EAAE,MAAM,EACf,eAAe,EAAE,MAAM,EACvB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,IAAI,CAAC;IAIhB;;;;;;;;;;;OAWG;IACG,UAAU,CACd,OAAO,EAAE,MAAM,EACf,eAAe,EAAE,MAAM,EACvB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,OAAO,CAAC;IAInB;;;;;;;;;OASG;WACU,MAAM,CACjB,OAAO,EAAE,MAAM,EACf,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,IAAI,CAAC;IA2ChB;;OAEG;WACU,UAAU,CACrB,OAAO,EAAE,MAAM,EACf,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,OAAO,CAAC;CAQpB"}
|
package/llms.txt
CHANGED
|
@@ -142,7 +142,7 @@ metadata, and configuration
|
|
|
142
142
|
- `getApplicationsCurrent()` - Get the current application based on x-application-key header context
|
|
143
143
|
- `postApplications()` - Register a new ISV application on the platform
|
|
144
144
|
- `patchApplicationsById()` - Update application configuration including branding, email settings, capability
|
|
145
|
-
flags, workspace mode, and
|
|
145
|
+
flags, workspace mode, execution limits, and compliance tags
|
|
146
146
|
- `patchApplicationsByIdAllocate-credits()` - Allocate credits to the account associated with this Application
|
|
147
147
|
- `patchApplicationsByIdCompliance-tags()` - Update the compliance tags for an application (GDPR, HIPAA, SOC2, PCI-DSS, etc.)
|
|
148
148
|
- `patchApplicationsByIdGrant-credits()` - Allocates promotional credits to a specific tenant on behalf of the application
|
|
@@ -608,9 +608,15 @@ flags, workspace mode, and execution limits
|
|
|
608
608
|
|
|
609
609
|
- `getConnectors()` - /connectors operation on connector-instance resource
|
|
610
610
|
- `getConnectorsById()` - /connectors/:id operation on connector-instance resource
|
|
611
|
+
- `getConnectorsByIdHealthieStatus()` - Get Healthie connector sync status
|
|
611
612
|
- `postConnectors()` - Install a new connector instance in a workspace
|
|
612
613
|
- `postConnectorsByIdEdamamRecipesGet()` - Get full details for a single recipe by Edamam recipe ID
|
|
613
614
|
- `postConnectorsByIdEdamamRecipesSearch()` - Search for recipes using the Edamam Recipe API
|
|
615
|
+
- `postConnectorsByIdHealthieAppointmentsList()` - List appointments from Healthie connector
|
|
616
|
+
- `postConnectorsByIdHealthieAppointmentsSync()` - Sync appointments from Healthie connector to platform
|
|
617
|
+
- `postConnectorsByIdHealthiePatientsList()` - List patients from Healthie connector
|
|
618
|
+
- `postConnectorsByIdHealthiePatientsSync()` - Sync patients from Healthie connector to platform
|
|
619
|
+
- `postConnectorsByIdHealthieSync-all()` - Sync all Healthie data (patients + appointments)
|
|
614
620
|
- `postConnectorsByIdPractice-betterPush-note()` - Push an AI-generated clinical note to Practice Better for a linked contact
|
|
615
621
|
- `postConnectorsByIdSync()` - Execute an action on an external connector
|
|
616
622
|
- `postConnectorsFullscriptCheck-patient()` - Check if a patient exists in Fullscript by email
|