aurelo.ai 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,157 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and
10
+ distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright
13
+ owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other entities
16
+ that control, are controlled by, or are under common control with that entity.
17
+ For the purposes of this definition, "control" means (i) the power, direct or
18
+ indirect, to cause the direction or management of such entity, whether by
19
+ contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
20
+ outstanding shares, or (iii) beneficial ownership of such entity.
21
+
22
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
23
+ permissions granted by this License.
24
+
25
+ "Source" form shall mean the preferred form for making modifications, including
26
+ but not limited to software source code, documentation source, and configuration
27
+ files.
28
+
29
+ "Object" form shall mean any form resulting from mechanical transformation or
30
+ translation of a Source form, including but not limited to compiled object code,
31
+ generated documentation, and conversions to other media types.
32
+
33
+ "Work" shall mean the work of authorship, whether in Source or Object form,
34
+ made available under the License, as indicated by a copyright notice that is
35
+ included in or attached to the work.
36
+
37
+ "Derivative Works" shall mean any work, whether in Source or Object form, that
38
+ is based on (or derived from) the Work and for which the editorial revisions,
39
+ annotations, elaborations, or other modifications represent, as a whole, an
40
+ original work of authorship. For the purposes of this License, Derivative Works
41
+ shall not include works that remain separable from, or merely link (or bind by
42
+ name) to the interfaces of, the Work and Derivative Works thereof.
43
+
44
+ "Contribution" shall mean any work of authorship, including the original
45
+ version of the Work and any modifications or additions to that Work or
46
+ Derivative Works thereof, that is intentionally submitted to Licensor for
47
+ inclusion in the Work by the copyright owner or by an individual or Legal Entity
48
+ authorized to submit on behalf of the copyright owner. For the purposes of this
49
+ definition, "submitted" means any form of electronic, verbal, or written
50
+ communication sent to the Licensor or its representatives, including but not
51
+ limited to communication on electronic mailing lists, source code control
52
+ systems, and issue tracking systems that are managed by, or on behalf of, the
53
+ Licensor for the purpose of discussing and improving the Work, but excluding
54
+ communication that is conspicuously marked or otherwise designated in writing by
55
+ the copyright owner as "Not a Contribution."
56
+
57
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
58
+ of whom a Contribution has been received by Licensor and subsequently
59
+ incorporated within the Work.
60
+
61
+ 2. Grant of Copyright License. Subject to the terms and conditions of this
62
+ License, each Contributor hereby grants to You a perpetual, worldwide,
63
+ non-exclusive, no-charge, royalty-free, irrevocable copyright license to
64
+ reproduce, prepare Derivative Works of, publicly display, publicly perform,
65
+ sublicense, and distribute the Work and such Derivative Works in Source or
66
+ Object form.
67
+
68
+ 3. Grant of Patent License. Subject to the terms and conditions of this License,
69
+ each Contributor hereby grants to You a perpetual, worldwide, non-exclusive,
70
+ no-charge, royalty-free, irrevocable patent license to make, have made, use,
71
+ offer to sell, sell, import, and otherwise transfer the Work, where such license
72
+ applies only to those patent claims licensable by such Contributor that are
73
+ necessarily infringed by their Contribution alone or by combination of their
74
+ Contribution with the Work to which such Contribution was submitted. If You
75
+ institute patent litigation against any entity alleging that the Work or a
76
+ Contribution incorporated within the Work constitutes direct or contributory
77
+ patent infringement, then any patent licenses granted to You under this License
78
+ for that Work shall terminate as of the date such litigation is filed.
79
+
80
+ 4. Redistribution. You may reproduce and distribute copies of the Work or
81
+ Derivative Works thereof in any medium, with or without modifications, and in
82
+ Source or Object form, provided that You meet the following conditions:
83
+
84
+ (a) You must give any other recipients of the Work or Derivative Works a copy of
85
+ this License; and
86
+
87
+ (b) You must cause any modified files to carry prominent notices stating that
88
+ You changed the files; and
89
+
90
+ (c) You must retain, in the Source form of any Derivative Works that You
91
+ distribute, all copyright, patent, trademark, and attribution notices from the
92
+ Source form of the Work, excluding those notices that do not pertain to any part
93
+ of the Derivative Works; and
94
+
95
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then
96
+ any Derivative Works that You distribute must include a readable copy of the
97
+ attribution notices contained within such NOTICE file, excluding those notices
98
+ that do not pertain to any part of the Derivative Works, in at least one of the
99
+ following places: within a NOTICE text file distributed as part of the
100
+ Derivative Works; within the Source form or documentation, if provided along
101
+ with the Derivative Works; or, within a display generated by the Derivative
102
+ Works, if and wherever such third-party notices normally appear. The contents of
103
+ the NOTICE file are for informational purposes only and do not modify the
104
+ License. You may add Your own attribution notices within Derivative Works that
105
+ You distribute, alongside or as an addendum to the NOTICE text from the Work,
106
+ provided that such additional attribution notices cannot be construed as
107
+ modifying the License.
108
+
109
+ You may add Your own copyright statement to Your modifications and may provide
110
+ additional or different license terms and conditions for use, reproduction, or
111
+ distribution of Your modifications, or for any such Derivative Works as a whole,
112
+ provided Your use, reproduction, and distribution of the Work otherwise complies
113
+ with the conditions stated in this License.
114
+
115
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any
116
+ Contribution intentionally submitted for inclusion in the Work by You to the
117
+ Licensor shall be under the terms and conditions of this License, without any
118
+ additional terms or conditions. Notwithstanding the above, nothing herein shall
119
+ supersede or modify the terms of any separate license agreement you may have
120
+ executed with Licensor regarding such Contributions.
121
+
122
+ 6. Trademarks. This License does not grant permission to use the trade names,
123
+ trademarks, service marks, or product names of the Licensor, except as required
124
+ for reasonable and customary use in describing the origin of the Work and
125
+ reproducing the content of the NOTICE file.
126
+
127
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
128
+ writing, Licensor provides the Work on an "AS IS" BASIS, WITHOUT WARRANTIES OR
129
+ CONDITIONS OF ANY KIND, either express or implied, including, without
130
+ limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT,
131
+ MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely
132
+ responsible for determining the appropriateness of using or redistributing the
133
+ Work and assume any risks associated with Your exercise of permissions under
134
+ this License.
135
+
136
+ 8. Limitation of Liability. In no event and under no legal theory, whether in
137
+ tort (including negligence), contract, or otherwise, unless required by
138
+ applicable law (such as deliberate and grossly negligent acts) or agreed to in
139
+ writing, shall any Contributor be liable to You for damages, including any
140
+ direct, indirect, special, incidental, or consequential damages of any character
141
+ arising as a result of this License or out of the use or inability to use the
142
+ Work, including but not limited to damages for loss of goodwill, work stoppage,
143
+ computer failure or malfunction, or any and all other commercial damages or
144
+ losses, even if such Contributor has been advised of the possibility of such
145
+ damages.
146
+
147
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or
148
+ Derivative Works thereof, You may choose to offer, and charge a fee for,
149
+ acceptance of support, warranty, indemnity, or other liability obligations
150
+ and/or rights consistent with this License. However, in accepting such
151
+ obligations, You may act only on Your own behalf and on Your sole
152
+ responsibility, not on behalf of any other Contributor, and only if You agree to
153
+ indemnify, defend, and hold each Contributor harmless for any liability incurred
154
+ by, or claims asserted against, such Contributor by reason of your accepting any
155
+ such warranty or additional liability.
156
+
157
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,223 @@
1
+ export type AureloJson = null | boolean | number | string | AureloJson[] | {
2
+ [key: string]: AureloJson;
3
+ };
4
+ export interface AureloStorage {
5
+ get(key: string): string | null | Promise<string | null>;
6
+ set(key: string, value: string): void | Promise<void>;
7
+ delete?(key: string): void | Promise<void>;
8
+ }
9
+ export interface AureloSDKOptions {
10
+ apiKey: string;
11
+ baseUrl?: string;
12
+ clientId?: string;
13
+ storage?: AureloStorage;
14
+ fetch?: typeof fetch;
15
+ }
16
+ export interface AureloSessionManagerOptions {
17
+ clientId?: string;
18
+ storage?: AureloStorage;
19
+ }
20
+ export interface AureloSession {
21
+ clientId: string;
22
+ requestId: string;
23
+ sessionId: string;
24
+ model?: string;
25
+ createdAt: number;
26
+ status: 'active' | 'closed' | 'rotation_required';
27
+ rotationReason?: string;
28
+ }
29
+ export interface AureloExposedTool {
30
+ type?: 'function' | 'tools' | 'hosted' | 'custom' | 'extension' | 'http' | string;
31
+ name?: string;
32
+ description?: string;
33
+ inputSchema?: Record<string, unknown>;
34
+ input_schema?: Record<string, unknown>;
35
+ parameters?: Record<string, unknown>;
36
+ function?: {
37
+ name: string;
38
+ description?: string;
39
+ parameters?: Record<string, unknown>;
40
+ };
41
+ server_label?: string;
42
+ server_url?: string;
43
+ server_description?: string;
44
+ allowed_tools?: string[];
45
+ require_approval?: unknown;
46
+ runtime?: {
47
+ kind?: 'extension' | 'tools' | 'http' | 'local' | string;
48
+ clientId?: string;
49
+ serverUrl?: string;
50
+ endpoint?: string;
51
+ url?: string;
52
+ [key: string]: unknown;
53
+ };
54
+ [key: string]: unknown;
55
+ }
56
+ export interface AureloRequestContext {
57
+ tools?: unknown[];
58
+ exposedTools?: AureloExposedTool[];
59
+ toolStackId?: string;
60
+ permissionsVersion?: string | number;
61
+ contextId?: string;
62
+ contextVersion?: string | number;
63
+ [key: string]: unknown;
64
+ }
65
+ export interface AureloResponseRequest {
66
+ model: string;
67
+ input?: unknown;
68
+ latestInput?: unknown;
69
+ sessionStartInput?: unknown;
70
+ fullContextInput?: unknown;
71
+ rotationRetryInput?: unknown;
72
+ stream?: boolean;
73
+ sessionId?: string;
74
+ session_id?: string;
75
+ requestId?: string;
76
+ request_id?: string;
77
+ metadata?: Record<string, unknown>;
78
+ context?: AureloRequestContext;
79
+ [key: string]: unknown;
80
+ }
81
+ export interface AureloReconnectRequest {
82
+ sessionId?: string;
83
+ cursor?: string | number;
84
+ model?: string;
85
+ input?: unknown;
86
+ metadata?: Record<string, unknown>;
87
+ context?: AureloRequestContext;
88
+ signal?: AbortSignal;
89
+ }
90
+ export interface AureloContinueMessageRequest {
91
+ message: string;
92
+ sessionId?: string;
93
+ source?: string;
94
+ requestId?: string;
95
+ publicModel?: string;
96
+ model?: string;
97
+ metadata?: Record<string, unknown>;
98
+ context?: AureloRequestContext;
99
+ signal?: AbortSignal;
100
+ }
101
+ export interface AureloToolResultRequest {
102
+ sessionId?: string;
103
+ requestId?: string;
104
+ call_id?: string;
105
+ callId?: string;
106
+ toolCallId?: string;
107
+ tool_call_id?: string;
108
+ toolCall?: {
109
+ call_id?: string;
110
+ callId?: string;
111
+ id?: string;
112
+ sessionId?: string;
113
+ session_id?: string;
114
+ requestId?: string;
115
+ request_id?: string;
116
+ [key: string]: unknown;
117
+ };
118
+ model?: string;
119
+ publicModel?: string;
120
+ stream?: boolean;
121
+ context?: AureloRequestContext;
122
+ tools?: unknown[];
123
+ output?: unknown;
124
+ result?: unknown;
125
+ error?: unknown;
126
+ metadata?: Record<string, unknown>;
127
+ signal?: AbortSignal;
128
+ }
129
+ export interface AureloStreamEvent {
130
+ type: 'comment' | 'event' | 'done';
131
+ raw: string;
132
+ comment?: string;
133
+ data?: unknown;
134
+ }
135
+ export declare class AureloSDKError extends Error {
136
+ status: number;
137
+ reason: string;
138
+ rotateSession: boolean;
139
+ payload: unknown;
140
+ constructor(message: string, options: {
141
+ status: number;
142
+ reason?: string;
143
+ rotateSession?: boolean;
144
+ payload?: unknown;
145
+ });
146
+ }
147
+ export declare function createAureloClientId(): string;
148
+ export declare function normalizeAureloClientId(value: string): string;
149
+ export declare function getAureloFullClientId(clientId: string): string;
150
+ export declare function createAureloRequestId(): string;
151
+ export declare function createAureloSession(clientId: string, model?: string): AureloSession;
152
+ export declare class AureloSessionManager {
153
+ private readonly storage;
154
+ private clientIdValue;
155
+ private sessionValue;
156
+ constructor(options?: AureloSessionManagerOptions);
157
+ getClientId(): Promise<string>;
158
+ getFullClientId(): Promise<string>;
159
+ private getStoredModelSessions;
160
+ private saveSession;
161
+ getSession(model?: string): Promise<AureloSession>;
162
+ private getStoredActiveSession;
163
+ private getSessionSelection;
164
+ rotateSession(reason?: string, model?: string): Promise<AureloSession>;
165
+ closeSession(reason?: string, model?: string): Promise<void>;
166
+ }
167
+ export declare class AureloSDK {
168
+ private readonly apiKey;
169
+ private readonly baseUrl;
170
+ private readonly fetchImpl;
171
+ private readonly storage;
172
+ private clientIdValue;
173
+ private sessionValue;
174
+ private reconnectCursors;
175
+ private readonly observedStreamResponses;
176
+ private readonly observedStreamResponseSessions;
177
+ private readonly observedSseComments;
178
+ private observedSseCommentOrder;
179
+ constructor(options: AureloSDKOptions);
180
+ getClientId(): Promise<string>;
181
+ getFullClientId(): Promise<string>;
182
+ private getStoredModelSessions;
183
+ private saveSession;
184
+ private findModelForSessionId;
185
+ private findSessionById;
186
+ getSession(model?: string): Promise<AureloSession>;
187
+ private getStoredActiveSession;
188
+ private getSessionSelection;
189
+ rotateSession(reason?: string, model?: string): Promise<AureloSession>;
190
+ closeSession(reason?: string, model?: string): Promise<void>;
191
+ private markSessionClosed;
192
+ private getReconnectCursor;
193
+ private setReconnectCursor;
194
+ private clearReconnectCursor;
195
+ observeSseComment(comment: string): Promise<void>;
196
+ private rememberSseComment;
197
+ continueWithMessage(request: string | AureloContinueMessageRequest): Promise<unknown>;
198
+ createResponse(request: AureloResponseRequest, options?: {
199
+ signal?: AbortSignal;
200
+ }): Promise<Response>;
201
+ private createResponseWithRotationRetry;
202
+ createOrContinueResponse(request: AureloResponseRequest, options?: {
203
+ signal?: AbortSignal;
204
+ }): Promise<Response>;
205
+ streamResponse(request: AureloResponseRequest, options?: {
206
+ signal?: AbortSignal;
207
+ }): AsyncGenerator<AureloStreamEvent>;
208
+ streamReconnect(request?: AureloReconnectRequest): AsyncGenerator<AureloStreamEvent>;
209
+ continueResponse(message: string, request?: Omit<AureloContinueMessageRequest, 'message'> & AureloReconnectRequest): AsyncGenerator<AureloStreamEvent>;
210
+ private hasRequestSessionOverride;
211
+ private resolveOutboundSession;
212
+ private streamEventsFromResponse;
213
+ reconnect(request?: AureloReconnectRequest): Promise<Response>;
214
+ submitToolResult(request: AureloToolResultRequest): Promise<Response | unknown>;
215
+ streamToolResult(request: AureloToolResultRequest): AsyncGenerator<AureloStreamEvent>;
216
+ private observeResponseStream;
217
+ private observeSseTextFragment;
218
+ private handleSseLine;
219
+ private closeSessionForPayloadSession;
220
+ private readErrorPayload;
221
+ private readResponsePayload;
222
+ }
223
+ export default AureloSDK;