@reminix/sdk 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +45 -0
- package/README.md +53 -6
- package/client.d.mts +20 -11
- package/client.d.mts.map +1 -1
- package/client.d.ts +20 -11
- package/client.d.ts.map +1 -1
- package/client.js +18 -6
- package/client.js.map +1 -1
- package/client.mjs +18 -6
- package/client.mjs.map +1 -1
- package/core/pagination.d.mts +57 -0
- package/core/pagination.d.mts.map +1 -0
- package/core/pagination.d.ts +57 -0
- package/core/pagination.d.ts.map +1 -0
- package/core/pagination.js +108 -0
- package/core/pagination.js.map +1 -0
- package/core/pagination.mjs +102 -0
- package/core/pagination.mjs.map +1 -0
- package/index.d.mts +1 -0
- package/index.d.mts.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/index.mjs +1 -0
- package/index.mjs.map +1 -1
- package/package.json +11 -1
- package/pagination.d.mts +2 -0
- package/pagination.d.mts.map +1 -0
- package/pagination.d.ts +2 -0
- package/pagination.d.ts.map +1 -0
- package/pagination.js +6 -0
- package/pagination.js.map +1 -0
- package/pagination.mjs +2 -0
- package/pagination.mjs.map +1 -0
- package/resources/agents.d.mts +273 -148
- package/resources/agents.d.mts.map +1 -1
- package/resources/agents.d.ts +273 -148
- package/resources/agents.d.ts.map +1 -1
- package/resources/agents.js +29 -3
- package/resources/agents.js.map +1 -1
- package/resources/agents.mjs +29 -3
- package/resources/agents.mjs.map +1 -1
- package/resources/conversations.d.mts +107 -0
- package/resources/conversations.d.mts.map +1 -0
- package/resources/conversations.d.ts +107 -0
- package/resources/conversations.d.ts.map +1 -0
- package/resources/conversations.js +41 -0
- package/resources/conversations.js.map +1 -0
- package/resources/conversations.mjs +37 -0
- package/resources/conversations.mjs.map +1 -0
- package/resources/execution-logs.d.mts +93 -0
- package/resources/execution-logs.d.mts.map +1 -0
- package/resources/execution-logs.d.ts +93 -0
- package/resources/execution-logs.d.ts.map +1 -0
- package/resources/execution-logs.js +33 -0
- package/resources/execution-logs.js.map +1 -0
- package/resources/execution-logs.mjs +29 -0
- package/resources/execution-logs.mjs.map +1 -0
- package/resources/index.d.mts +5 -4
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +5 -4
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +7 -5
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +3 -2
- package/resources/index.mjs.map +1 -1
- package/resources/projects.d.mts +5 -5
- package/resources/projects.d.mts.map +1 -1
- package/resources/projects.d.ts +5 -5
- package/resources/projects.d.ts.map +1 -1
- package/resources/tools.d.mts +152 -0
- package/resources/tools.d.mts.map +1 -0
- package/resources/tools.d.ts +152 -0
- package/resources/tools.d.ts.map +1 -0
- package/resources/tools.js +59 -0
- package/resources/tools.js.map +1 -0
- package/resources/tools.mjs +55 -0
- package/resources/tools.mjs.map +1 -0
- package/src/client.ts +96 -22
- package/src/core/pagination.ts +165 -0
- package/src/index.ts +1 -0
- package/src/pagination.ts +2 -0
- package/src/resources/agents.ts +336 -165
- package/src/resources/conversations.ts +146 -0
- package/src/resources/execution-logs.ts +125 -0
- package/src/resources/index.ts +31 -8
- package/src/resources/projects.ts +5 -5
- package/src/resources/tools.ts +192 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.mts.map +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
- package/resources/deployments.d.mts +0 -4
- package/resources/deployments.d.mts.map +0 -1
- package/resources/deployments.d.ts +0 -4
- package/resources/deployments.d.ts.map +0 -1
- package/resources/deployments.js +0 -9
- package/resources/deployments.js.map +0 -1
- package/resources/deployments.mjs +0 -5
- package/resources/deployments.mjs.map +0 -1
- package/resources/secrets.d.mts +0 -4
- package/resources/secrets.d.mts.map +0 -1
- package/resources/secrets.d.ts +0 -4
- package/resources/secrets.d.ts.map +0 -1
- package/resources/secrets.js +0 -9
- package/resources/secrets.js.map +0 -1
- package/resources/secrets.mjs +0 -5
- package/resources/secrets.mjs.map +0 -1
- package/src/resources/deployments.ts +0 -5
- package/src/resources/secrets.ts +0 -5
package/src/client.ts
CHANGED
|
@@ -13,26 +13,51 @@ import * as Shims from './internal/shims';
|
|
|
13
13
|
import * as Opts from './internal/request-options';
|
|
14
14
|
import { VERSION } from './version';
|
|
15
15
|
import * as Errors from './core/error';
|
|
16
|
+
import * as Pagination from './core/pagination';
|
|
17
|
+
import { AbstractPage, type CursorParams, CursorResponse } from './core/pagination';
|
|
16
18
|
import * as Uploads from './core/uploads';
|
|
17
19
|
import * as API from './resources/index';
|
|
18
20
|
import { APIPromise } from './core/api-promise';
|
|
19
21
|
import {
|
|
22
|
+
Agent,
|
|
20
23
|
AgentChatParams,
|
|
21
24
|
AgentChatParamsNonStreaming,
|
|
22
25
|
AgentChatParamsStreaming,
|
|
23
26
|
AgentChatResponse,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
AgentConfig,
|
|
28
|
+
AgentExecuteParams,
|
|
29
|
+
AgentExecuteParamsNonStreaming,
|
|
30
|
+
AgentExecuteParamsStreaming,
|
|
31
|
+
AgentExecuteResponse,
|
|
32
|
+
AgentListParams,
|
|
28
33
|
Agents,
|
|
29
|
-
|
|
34
|
+
AgentsCursor,
|
|
35
|
+
ChatMessage,
|
|
30
36
|
StreamChunk,
|
|
31
37
|
} from './resources/agents';
|
|
32
38
|
import { ClientTokenCreateParams, ClientTokenCreateResponse, ClientTokens } from './resources/client-tokens';
|
|
33
|
-
import {
|
|
34
|
-
|
|
35
|
-
|
|
39
|
+
import {
|
|
40
|
+
Conversation,
|
|
41
|
+
ConversationListParams,
|
|
42
|
+
ConversationRetrieveResponse,
|
|
43
|
+
Conversations,
|
|
44
|
+
ConversationsCursor,
|
|
45
|
+
} from './resources/conversations';
|
|
46
|
+
import {
|
|
47
|
+
ExecutionLog,
|
|
48
|
+
ExecutionLogListParams,
|
|
49
|
+
ExecutionLogs,
|
|
50
|
+
ExecutionLogsCursor,
|
|
51
|
+
} from './resources/execution-logs';
|
|
52
|
+
import { Project, Projects } from './resources/projects';
|
|
53
|
+
import {
|
|
54
|
+
Tool,
|
|
55
|
+
ToolExecuteParams,
|
|
56
|
+
ToolExecuteResponse,
|
|
57
|
+
ToolListParams,
|
|
58
|
+
Tools,
|
|
59
|
+
ToolsCursor,
|
|
60
|
+
} from './resources/tools';
|
|
36
61
|
import { type Fetch } from './internal/builtin-types';
|
|
37
62
|
import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
|
|
38
63
|
import { FinalRequestOptions, RequestOptions } from './internal/request-options';
|
|
@@ -48,7 +73,7 @@ import { isEmptyObj } from './internal/utils/values';
|
|
|
48
73
|
|
|
49
74
|
export interface ClientOptions {
|
|
50
75
|
/**
|
|
51
|
-
*
|
|
76
|
+
* API Key or Personal Access Token (PAT). When using PAT, include X-Project header.
|
|
52
77
|
*/
|
|
53
78
|
apiKey?: string | undefined;
|
|
54
79
|
|
|
@@ -498,6 +523,25 @@ export class Reminix {
|
|
|
498
523
|
return { response, options, controller, requestLogID, retryOfRequestLogID, startTime };
|
|
499
524
|
}
|
|
500
525
|
|
|
526
|
+
getAPIList<Item, PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>>(
|
|
527
|
+
path: string,
|
|
528
|
+
Page: new (...args: any[]) => PageClass,
|
|
529
|
+
opts?: RequestOptions,
|
|
530
|
+
): Pagination.PagePromise<PageClass, Item> {
|
|
531
|
+
return this.requestAPIList(Page, { method: 'get', path, ...opts });
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
requestAPIList<
|
|
535
|
+
Item = unknown,
|
|
536
|
+
PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>,
|
|
537
|
+
>(
|
|
538
|
+
Page: new (...args: ConstructorParameters<typeof Pagination.AbstractPage>) => PageClass,
|
|
539
|
+
options: FinalRequestOptions,
|
|
540
|
+
): Pagination.PagePromise<PageClass, Item> {
|
|
541
|
+
const request = this.makeRequest(options, null, undefined);
|
|
542
|
+
return new Pagination.PagePromise<PageClass, Item>(this as any as Reminix, request, Page);
|
|
543
|
+
}
|
|
544
|
+
|
|
501
545
|
async fetchWithTimeout(
|
|
502
546
|
url: RequestInfo,
|
|
503
547
|
init: RequestInit | undefined,
|
|
@@ -662,6 +706,7 @@ export class Reminix {
|
|
|
662
706
|
'X-Stainless-Retry-Count': String(retryCount),
|
|
663
707
|
...(options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {}),
|
|
664
708
|
...getPlatformHeaders(),
|
|
709
|
+
'X-Reminix-Source': 'sdk',
|
|
665
710
|
},
|
|
666
711
|
await this.authHeaders(options),
|
|
667
712
|
this._options.defaultHeaders,
|
|
@@ -732,43 +777,72 @@ export class Reminix {
|
|
|
732
777
|
|
|
733
778
|
projects: API.Projects = new API.Projects(this);
|
|
734
779
|
agents: API.Agents = new API.Agents(this);
|
|
735
|
-
|
|
736
|
-
deployments: API.Deployments = new API.Deployments(this);
|
|
780
|
+
tools: API.Tools = new API.Tools(this);
|
|
737
781
|
clientTokens: API.ClientTokens = new API.ClientTokens(this);
|
|
782
|
+
executionLogs: API.ExecutionLogs = new API.ExecutionLogs(this);
|
|
783
|
+
conversations: API.Conversations = new API.Conversations(this);
|
|
738
784
|
}
|
|
739
785
|
|
|
740
786
|
Reminix.Projects = Projects;
|
|
741
787
|
Reminix.Agents = Agents;
|
|
742
|
-
Reminix.
|
|
743
|
-
Reminix.Deployments = Deployments;
|
|
788
|
+
Reminix.Tools = Tools;
|
|
744
789
|
Reminix.ClientTokens = ClientTokens;
|
|
790
|
+
Reminix.ExecutionLogs = ExecutionLogs;
|
|
791
|
+
Reminix.Conversations = Conversations;
|
|
745
792
|
|
|
746
793
|
export declare namespace Reminix {
|
|
747
794
|
export type RequestOptions = Opts.RequestOptions;
|
|
748
795
|
|
|
749
|
-
export
|
|
796
|
+
export import Cursor = Pagination.Cursor;
|
|
797
|
+
export { type CursorParams as CursorParams, type CursorResponse as CursorResponse };
|
|
798
|
+
|
|
799
|
+
export { Projects as Projects, type Project as Project };
|
|
750
800
|
|
|
751
801
|
export {
|
|
752
802
|
Agents as Agents,
|
|
753
|
-
type
|
|
803
|
+
type Agent as Agent,
|
|
804
|
+
type AgentConfig as AgentConfig,
|
|
805
|
+
type ChatMessage as ChatMessage,
|
|
754
806
|
type StreamChunk as StreamChunk,
|
|
755
807
|
type AgentChatResponse as AgentChatResponse,
|
|
756
|
-
type
|
|
808
|
+
type AgentExecuteResponse as AgentExecuteResponse,
|
|
809
|
+
type AgentsCursor as AgentsCursor,
|
|
810
|
+
type AgentListParams as AgentListParams,
|
|
757
811
|
type AgentChatParams as AgentChatParams,
|
|
758
812
|
type AgentChatParamsNonStreaming as AgentChatParamsNonStreaming,
|
|
759
813
|
type AgentChatParamsStreaming as AgentChatParamsStreaming,
|
|
760
|
-
type
|
|
761
|
-
type
|
|
762
|
-
type
|
|
814
|
+
type AgentExecuteParams as AgentExecuteParams,
|
|
815
|
+
type AgentExecuteParamsNonStreaming as AgentExecuteParamsNonStreaming,
|
|
816
|
+
type AgentExecuteParamsStreaming as AgentExecuteParamsStreaming,
|
|
763
817
|
};
|
|
764
818
|
|
|
765
|
-
export {
|
|
766
|
-
|
|
767
|
-
|
|
819
|
+
export {
|
|
820
|
+
Tools as Tools,
|
|
821
|
+
type Tool as Tool,
|
|
822
|
+
type ToolExecuteResponse as ToolExecuteResponse,
|
|
823
|
+
type ToolsCursor as ToolsCursor,
|
|
824
|
+
type ToolListParams as ToolListParams,
|
|
825
|
+
type ToolExecuteParams as ToolExecuteParams,
|
|
826
|
+
};
|
|
768
827
|
|
|
769
828
|
export {
|
|
770
829
|
ClientTokens as ClientTokens,
|
|
771
830
|
type ClientTokenCreateResponse as ClientTokenCreateResponse,
|
|
772
831
|
type ClientTokenCreateParams as ClientTokenCreateParams,
|
|
773
832
|
};
|
|
833
|
+
|
|
834
|
+
export {
|
|
835
|
+
ExecutionLogs as ExecutionLogs,
|
|
836
|
+
type ExecutionLog as ExecutionLog,
|
|
837
|
+
type ExecutionLogsCursor as ExecutionLogsCursor,
|
|
838
|
+
type ExecutionLogListParams as ExecutionLogListParams,
|
|
839
|
+
};
|
|
840
|
+
|
|
841
|
+
export {
|
|
842
|
+
Conversations as Conversations,
|
|
843
|
+
type Conversation as Conversation,
|
|
844
|
+
type ConversationRetrieveResponse as ConversationRetrieveResponse,
|
|
845
|
+
type ConversationsCursor as ConversationsCursor,
|
|
846
|
+
type ConversationListParams as ConversationListParams,
|
|
847
|
+
};
|
|
774
848
|
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { ReminixError } from './error';
|
|
4
|
+
import { FinalRequestOptions } from '../internal/request-options';
|
|
5
|
+
import { defaultParseResponse } from '../internal/parse';
|
|
6
|
+
import { type Reminix } from '../client';
|
|
7
|
+
import { APIPromise } from './api-promise';
|
|
8
|
+
import { type APIResponseProps } from '../internal/parse';
|
|
9
|
+
import { maybeObj } from '../internal/utils/values';
|
|
10
|
+
|
|
11
|
+
export type PageRequestOptions = Pick<FinalRequestOptions, 'query' | 'headers' | 'body' | 'path' | 'method'>;
|
|
12
|
+
|
|
13
|
+
export abstract class AbstractPage<Item> implements AsyncIterable<Item> {
|
|
14
|
+
#client: Reminix;
|
|
15
|
+
protected options: FinalRequestOptions;
|
|
16
|
+
|
|
17
|
+
protected response: Response;
|
|
18
|
+
protected body: unknown;
|
|
19
|
+
|
|
20
|
+
constructor(client: Reminix, response: Response, body: unknown, options: FinalRequestOptions) {
|
|
21
|
+
this.#client = client;
|
|
22
|
+
this.options = options;
|
|
23
|
+
this.response = response;
|
|
24
|
+
this.body = body;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
abstract nextPageRequestOptions(): PageRequestOptions | null;
|
|
28
|
+
|
|
29
|
+
abstract getPaginatedItems(): Item[];
|
|
30
|
+
|
|
31
|
+
hasNextPage(): boolean {
|
|
32
|
+
const items = this.getPaginatedItems();
|
|
33
|
+
if (!items.length) return false;
|
|
34
|
+
return this.nextPageRequestOptions() != null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async getNextPage(): Promise<this> {
|
|
38
|
+
const nextOptions = this.nextPageRequestOptions();
|
|
39
|
+
if (!nextOptions) {
|
|
40
|
+
throw new ReminixError(
|
|
41
|
+
'No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.',
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return await this.#client.requestAPIList(this.constructor as any, nextOptions);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async *iterPages(): AsyncGenerator<this> {
|
|
49
|
+
let page: this = this;
|
|
50
|
+
yield page;
|
|
51
|
+
while (page.hasNextPage()) {
|
|
52
|
+
page = await page.getNextPage();
|
|
53
|
+
yield page;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async *[Symbol.asyncIterator](): AsyncGenerator<Item> {
|
|
58
|
+
for await (const page of this.iterPages()) {
|
|
59
|
+
for (const item of page.getPaginatedItems()) {
|
|
60
|
+
yield item;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* This subclass of Promise will resolve to an instantiated Page once the request completes.
|
|
68
|
+
*
|
|
69
|
+
* It also implements AsyncIterable to allow auto-paginating iteration on an unawaited list call, eg:
|
|
70
|
+
*
|
|
71
|
+
* for await (const item of client.items.list()) {
|
|
72
|
+
* console.log(item)
|
|
73
|
+
* }
|
|
74
|
+
*/
|
|
75
|
+
export class PagePromise<
|
|
76
|
+
PageClass extends AbstractPage<Item>,
|
|
77
|
+
Item = ReturnType<PageClass['getPaginatedItems']>[number],
|
|
78
|
+
>
|
|
79
|
+
extends APIPromise<PageClass>
|
|
80
|
+
implements AsyncIterable<Item>
|
|
81
|
+
{
|
|
82
|
+
constructor(
|
|
83
|
+
client: Reminix,
|
|
84
|
+
request: Promise<APIResponseProps>,
|
|
85
|
+
Page: new (...args: ConstructorParameters<typeof AbstractPage>) => PageClass,
|
|
86
|
+
) {
|
|
87
|
+
super(
|
|
88
|
+
client,
|
|
89
|
+
request,
|
|
90
|
+
async (client, props) =>
|
|
91
|
+
new Page(client, props.response, await defaultParseResponse(client, props), props.options),
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Allow auto-paginating iteration on an unawaited list call, eg:
|
|
97
|
+
*
|
|
98
|
+
* for await (const item of client.items.list()) {
|
|
99
|
+
* console.log(item)
|
|
100
|
+
* }
|
|
101
|
+
*/
|
|
102
|
+
async *[Symbol.asyncIterator](): AsyncGenerator<Item> {
|
|
103
|
+
const page = await this;
|
|
104
|
+
for await (const item of page) {
|
|
105
|
+
yield item;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface CursorResponse<Item> {
|
|
111
|
+
data: Array<Item>;
|
|
112
|
+
|
|
113
|
+
nextCursor: string | null;
|
|
114
|
+
|
|
115
|
+
hasMore: boolean;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface CursorParams {
|
|
119
|
+
cursor?: string;
|
|
120
|
+
|
|
121
|
+
limit?: number;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export class Cursor<Item> extends AbstractPage<Item> implements CursorResponse<Item> {
|
|
125
|
+
data: Array<Item>;
|
|
126
|
+
|
|
127
|
+
nextCursor: string | null;
|
|
128
|
+
|
|
129
|
+
hasMore: boolean;
|
|
130
|
+
|
|
131
|
+
constructor(client: Reminix, response: Response, body: CursorResponse<Item>, options: FinalRequestOptions) {
|
|
132
|
+
super(client, response, body, options);
|
|
133
|
+
|
|
134
|
+
this.data = body.data || [];
|
|
135
|
+
this.nextCursor = body.nextCursor || null;
|
|
136
|
+
this.hasMore = body.hasMore || false;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
getPaginatedItems(): Item[] {
|
|
140
|
+
return this.data ?? [];
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
override hasNextPage(): boolean {
|
|
144
|
+
if (this.hasMore === false) {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return super.hasNextPage();
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
nextPageRequestOptions(): PageRequestOptions | null {
|
|
152
|
+
const cursor = this.nextCursor;
|
|
153
|
+
if (!cursor) {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return {
|
|
158
|
+
...this.options,
|
|
159
|
+
query: {
|
|
160
|
+
...maybeObj(this.options.query),
|
|
161
|
+
cursor,
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { Reminix as default } from './client';
|
|
|
5
5
|
export { type Uploadable, toFile } from './core/uploads';
|
|
6
6
|
export { APIPromise } from './core/api-promise';
|
|
7
7
|
export { Reminix, type ClientOptions } from './client';
|
|
8
|
+
export { PagePromise } from './core/pagination';
|
|
8
9
|
export {
|
|
9
10
|
ReminixError,
|
|
10
11
|
APIError,
|