@ragable/sdk 0.0.1 → 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/dist/index.d.mts CHANGED
@@ -1,32 +1,128 @@
1
- interface AgentConfig {
1
+ interface RagableClientOptions {
2
+ apiKey: string;
3
+ baseUrl?: string;
4
+ fetch?: typeof fetch;
5
+ headers?: HeadersInit;
6
+ }
7
+ interface ShiftIndex {
8
+ id: string;
2
9
  name: string;
3
- model?: string;
4
- memory?: boolean;
5
- tools?: any[];
6
- knowledge?: string[];
7
- }
8
- declare class Agent {
9
- private config;
10
- constructor(config: AgentConfig);
11
- deploy(): Promise<{
12
- status: string;
13
- agentId: string;
14
- url: string;
15
- }>;
16
- run(input: string): Promise<{
17
- response: string;
18
- traceId: string;
10
+ description: string | null;
11
+ dimensions: number;
12
+ embeddingModel: string;
13
+ status: string;
14
+ entryCount?: number;
15
+ createdAt: string;
16
+ updatedAt: string;
17
+ }
18
+ interface ShiftEntry {
19
+ id: string;
20
+ content: string;
21
+ metadata: unknown;
22
+ chunkIndex: number;
23
+ createdAt: string;
24
+ }
25
+ interface ShiftSearchResult {
26
+ content: string;
27
+ score: number;
28
+ metadata: unknown;
29
+ }
30
+ interface ShiftCreateIndexParams {
31
+ name: string;
32
+ description?: string;
33
+ dimensions?: number;
34
+ embeddingModel?: string;
35
+ }
36
+ interface ShiftUpdateIndexParams {
37
+ name?: string;
38
+ description?: string;
39
+ }
40
+ interface ShiftAddDocumentParams {
41
+ content: string;
42
+ metadata?: Record<string, unknown>;
43
+ chunkSize?: number;
44
+ chunkOverlap?: number;
45
+ }
46
+ type ShiftUploadableFile = Blob | ArrayBuffer | Uint8Array;
47
+ interface ShiftUploadFileParams {
48
+ file: ShiftUploadableFile;
49
+ fileName?: string;
50
+ contentType?: string;
51
+ metadata?: Record<string, unknown>;
52
+ chunkSize?: number;
53
+ chunkOverlap?: number;
54
+ }
55
+ interface ShiftListEntriesParams {
56
+ take?: number;
57
+ skip?: number;
58
+ }
59
+ interface ShiftSearchParams {
60
+ query: string;
61
+ topK?: number;
62
+ }
63
+ interface ShiftIngestResponse {
64
+ chunksCreated: number;
65
+ entries: string[];
66
+ extractedText?: string;
67
+ message?: string;
68
+ }
69
+ interface ShiftListEntriesResponse {
70
+ entries: ShiftEntry[];
71
+ total: number;
72
+ }
73
+ declare class RagableError extends Error {
74
+ readonly status: number;
75
+ readonly body: unknown;
76
+ constructor(message: string, status: number, body: unknown);
77
+ }
78
+ type RequestOptions = Omit<RequestInit, "body"> & {
79
+ body?: unknown;
80
+ };
81
+ declare class RagableRequestClient {
82
+ private readonly apiKey;
83
+ private readonly baseUrl;
84
+ private readonly fetchImpl;
85
+ private readonly defaultHeaders;
86
+ constructor(options: RagableClientOptions);
87
+ request<T>(path: string, options?: RequestOptions): Promise<T>;
88
+ private toUrl;
89
+ private parseResponseBody;
90
+ }
91
+ declare class ShiftClient {
92
+ private readonly client;
93
+ readonly indexes: {
94
+ list: () => Promise<{
95
+ indexes: ShiftIndex[];
96
+ }>;
97
+ create: (params: ShiftCreateIndexParams) => Promise<ShiftIndex>;
98
+ get: (indexId: string) => Promise<ShiftIndex>;
99
+ update: (indexId: string, params: ShiftUpdateIndexParams) => Promise<ShiftIndex>;
100
+ delete: (indexId: string) => Promise<{
101
+ success: true;
102
+ }>;
103
+ };
104
+ readonly documents: {
105
+ create: (indexId: string, params: ShiftAddDocumentParams) => Promise<ShiftIngestResponse>;
106
+ upload: (indexId: string, params: ShiftUploadFileParams) => Promise<ShiftIngestResponse>;
107
+ };
108
+ readonly entries: {
109
+ list: (indexId: string, params?: ShiftListEntriesParams) => Promise<ShiftListEntriesResponse>;
110
+ delete: (indexId: string, entryId: string) => Promise<{
111
+ success: true;
112
+ }>;
113
+ };
114
+ constructor(client: RagableRequestClient);
115
+ search(indexId: string, params: ShiftSearchParams): Promise<{
116
+ results: ShiftSearchResult[];
19
117
  }>;
20
118
  }
21
- declare class Tool {
22
- static connect(apiKey: string): {
23
- type: string;
24
- connected: boolean;
119
+ declare class Ragable {
120
+ readonly shift: ShiftClient;
121
+ readonly infrastructure: {
122
+ shift: ShiftClient;
25
123
  };
124
+ constructor(options: RagableClientOptions);
26
125
  }
27
- declare const _default: {
28
- Agent: typeof Agent;
29
- Tool: typeof Tool;
30
- };
126
+ declare function createClient(options: RagableClientOptions): Ragable;
31
127
 
32
- export { Agent, type AgentConfig, Tool, _default as default };
128
+ export { Ragable, type RagableClientOptions, RagableError, type ShiftAddDocumentParams, type ShiftCreateIndexParams, type ShiftEntry, type ShiftIndex, type ShiftIngestResponse, type ShiftListEntriesParams, type ShiftListEntriesResponse, type ShiftSearchParams, type ShiftSearchResult, type ShiftUpdateIndexParams, type ShiftUploadFileParams, type ShiftUploadableFile, createClient };
package/dist/index.d.ts CHANGED
@@ -1,32 +1,128 @@
1
- interface AgentConfig {
1
+ interface RagableClientOptions {
2
+ apiKey: string;
3
+ baseUrl?: string;
4
+ fetch?: typeof fetch;
5
+ headers?: HeadersInit;
6
+ }
7
+ interface ShiftIndex {
8
+ id: string;
2
9
  name: string;
3
- model?: string;
4
- memory?: boolean;
5
- tools?: any[];
6
- knowledge?: string[];
7
- }
8
- declare class Agent {
9
- private config;
10
- constructor(config: AgentConfig);
11
- deploy(): Promise<{
12
- status: string;
13
- agentId: string;
14
- url: string;
15
- }>;
16
- run(input: string): Promise<{
17
- response: string;
18
- traceId: string;
10
+ description: string | null;
11
+ dimensions: number;
12
+ embeddingModel: string;
13
+ status: string;
14
+ entryCount?: number;
15
+ createdAt: string;
16
+ updatedAt: string;
17
+ }
18
+ interface ShiftEntry {
19
+ id: string;
20
+ content: string;
21
+ metadata: unknown;
22
+ chunkIndex: number;
23
+ createdAt: string;
24
+ }
25
+ interface ShiftSearchResult {
26
+ content: string;
27
+ score: number;
28
+ metadata: unknown;
29
+ }
30
+ interface ShiftCreateIndexParams {
31
+ name: string;
32
+ description?: string;
33
+ dimensions?: number;
34
+ embeddingModel?: string;
35
+ }
36
+ interface ShiftUpdateIndexParams {
37
+ name?: string;
38
+ description?: string;
39
+ }
40
+ interface ShiftAddDocumentParams {
41
+ content: string;
42
+ metadata?: Record<string, unknown>;
43
+ chunkSize?: number;
44
+ chunkOverlap?: number;
45
+ }
46
+ type ShiftUploadableFile = Blob | ArrayBuffer | Uint8Array;
47
+ interface ShiftUploadFileParams {
48
+ file: ShiftUploadableFile;
49
+ fileName?: string;
50
+ contentType?: string;
51
+ metadata?: Record<string, unknown>;
52
+ chunkSize?: number;
53
+ chunkOverlap?: number;
54
+ }
55
+ interface ShiftListEntriesParams {
56
+ take?: number;
57
+ skip?: number;
58
+ }
59
+ interface ShiftSearchParams {
60
+ query: string;
61
+ topK?: number;
62
+ }
63
+ interface ShiftIngestResponse {
64
+ chunksCreated: number;
65
+ entries: string[];
66
+ extractedText?: string;
67
+ message?: string;
68
+ }
69
+ interface ShiftListEntriesResponse {
70
+ entries: ShiftEntry[];
71
+ total: number;
72
+ }
73
+ declare class RagableError extends Error {
74
+ readonly status: number;
75
+ readonly body: unknown;
76
+ constructor(message: string, status: number, body: unknown);
77
+ }
78
+ type RequestOptions = Omit<RequestInit, "body"> & {
79
+ body?: unknown;
80
+ };
81
+ declare class RagableRequestClient {
82
+ private readonly apiKey;
83
+ private readonly baseUrl;
84
+ private readonly fetchImpl;
85
+ private readonly defaultHeaders;
86
+ constructor(options: RagableClientOptions);
87
+ request<T>(path: string, options?: RequestOptions): Promise<T>;
88
+ private toUrl;
89
+ private parseResponseBody;
90
+ }
91
+ declare class ShiftClient {
92
+ private readonly client;
93
+ readonly indexes: {
94
+ list: () => Promise<{
95
+ indexes: ShiftIndex[];
96
+ }>;
97
+ create: (params: ShiftCreateIndexParams) => Promise<ShiftIndex>;
98
+ get: (indexId: string) => Promise<ShiftIndex>;
99
+ update: (indexId: string, params: ShiftUpdateIndexParams) => Promise<ShiftIndex>;
100
+ delete: (indexId: string) => Promise<{
101
+ success: true;
102
+ }>;
103
+ };
104
+ readonly documents: {
105
+ create: (indexId: string, params: ShiftAddDocumentParams) => Promise<ShiftIngestResponse>;
106
+ upload: (indexId: string, params: ShiftUploadFileParams) => Promise<ShiftIngestResponse>;
107
+ };
108
+ readonly entries: {
109
+ list: (indexId: string, params?: ShiftListEntriesParams) => Promise<ShiftListEntriesResponse>;
110
+ delete: (indexId: string, entryId: string) => Promise<{
111
+ success: true;
112
+ }>;
113
+ };
114
+ constructor(client: RagableRequestClient);
115
+ search(indexId: string, params: ShiftSearchParams): Promise<{
116
+ results: ShiftSearchResult[];
19
117
  }>;
20
118
  }
21
- declare class Tool {
22
- static connect(apiKey: string): {
23
- type: string;
24
- connected: boolean;
119
+ declare class Ragable {
120
+ readonly shift: ShiftClient;
121
+ readonly infrastructure: {
122
+ shift: ShiftClient;
25
123
  };
124
+ constructor(options: RagableClientOptions);
26
125
  }
27
- declare const _default: {
28
- Agent: typeof Agent;
29
- Tool: typeof Tool;
30
- };
126
+ declare function createClient(options: RagableClientOptions): Ragable;
31
127
 
32
- export { Agent, type AgentConfig, Tool, _default as default };
128
+ export { Ragable, type RagableClientOptions, RagableError, type ShiftAddDocumentParams, type ShiftCreateIndexParams, type ShiftEntry, type ShiftIndex, type ShiftIngestResponse, type ShiftListEntriesParams, type ShiftListEntriesResponse, type ShiftSearchParams, type ShiftSearchResult, type ShiftUpdateIndexParams, type ShiftUploadFileParams, type ShiftUploadableFile, createClient };
package/dist/index.js CHANGED
@@ -22,45 +22,240 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
22
22
  // src/index.ts
23
23
  var index_exports = {};
24
24
  __export(index_exports, {
25
- Agent: () => Agent,
26
- Tool: () => Tool,
27
- default: () => index_default
25
+ Ragable: () => Ragable,
26
+ RagableError: () => RagableError,
27
+ createClient: () => createClient
28
28
  });
29
29
  module.exports = __toCommonJS(index_exports);
30
- var Agent = class {
31
- constructor(config) {
32
- __publicField(this, "config");
33
- this.config = config;
34
- }
35
- async deploy() {
36
- console.log(`Deploying agent: ${this.config.name}...`);
37
- return {
38
- status: "deployed",
39
- agentId: "ag_" + Math.random().toString(36).substr(2, 9),
40
- url: `https://api.ragable.com/v1/agents/${this.config.name}`
41
- };
30
+ var RagableError = class extends Error {
31
+ constructor(message, status, body) {
32
+ super(message);
33
+ __publicField(this, "status");
34
+ __publicField(this, "body");
35
+ this.name = "RagableError";
36
+ this.status = status;
37
+ this.body = body;
42
38
  }
43
- async run(input) {
44
- console.log(`Agent ${this.config.name} processing: ${input}`);
45
- return {
46
- response: "This is a mock response from the SDK.",
47
- traceId: "tr_" + Math.random().toString(36).substr(2, 9)
48
- };
39
+ };
40
+ var RagableRequestClient = class {
41
+ constructor(options) {
42
+ __publicField(this, "apiKey");
43
+ __publicField(this, "baseUrl");
44
+ __publicField(this, "fetchImpl");
45
+ __publicField(this, "defaultHeaders");
46
+ this.apiKey = options.apiKey;
47
+ this.baseUrl = options.baseUrl ?? "http://localhost:8080/api";
48
+ this.fetchImpl = options.fetch ?? fetch;
49
+ this.defaultHeaders = options.headers;
50
+ }
51
+ async request(path, options = {}) {
52
+ const headers = new Headers(this.defaultHeaders);
53
+ headers.set("Authorization", `Bearer ${this.apiKey}`);
54
+ let body = options.body;
55
+ if (body !== void 0 && !isBodyInit(body)) {
56
+ headers.set("Content-Type", "application/json");
57
+ body = JSON.stringify(body);
58
+ }
59
+ const response = await this.fetchImpl(this.toUrl(path), {
60
+ ...options,
61
+ headers,
62
+ body
63
+ });
64
+ const payload = await this.parseResponseBody(response);
65
+ if (!response.ok) {
66
+ const message = extractErrorMessage(payload, response.statusText);
67
+ throw new RagableError(message, response.status, payload);
68
+ }
69
+ return payload;
70
+ }
71
+ toUrl(path) {
72
+ const normalizedBase = this.baseUrl.replace(/\/+$/, "");
73
+ const normalizedPath = path.startsWith("/") ? path : `/${path}`;
74
+ return `${normalizedBase}${normalizedPath}`;
75
+ }
76
+ async parseResponseBody(response) {
77
+ if (response.status === 204) {
78
+ return null;
79
+ }
80
+ const contentType = response.headers.get("content-type") ?? "";
81
+ if (contentType.includes("application/json")) {
82
+ return response.json();
83
+ }
84
+ return response.text();
49
85
  }
50
86
  };
51
- var Tool = class {
52
- static connect(apiKey) {
53
- void apiKey;
54
- return { type: "tool", connected: true };
87
+ var ShiftClient = class {
88
+ constructor(client) {
89
+ this.client = client;
90
+ __publicField(this, "indexes");
91
+ __publicField(this, "documents");
92
+ __publicField(this, "entries");
93
+ this.indexes = {
94
+ list: async () => {
95
+ return this.client.request("/v1/shift/indexes");
96
+ },
97
+ create: async (params) => {
98
+ return this.client.request("/v1/shift/indexes", {
99
+ method: "POST",
100
+ body: params
101
+ });
102
+ },
103
+ get: async (indexId) => {
104
+ return this.client.request(`/v1/shift/indexes/${indexId}`);
105
+ },
106
+ update: async (indexId, params) => {
107
+ return this.client.request(`/v1/shift/indexes/${indexId}`, {
108
+ method: "PUT",
109
+ body: params
110
+ });
111
+ },
112
+ delete: async (indexId) => {
113
+ return this.client.request(
114
+ `/v1/shift/indexes/${indexId}`,
115
+ {
116
+ method: "DELETE"
117
+ }
118
+ );
119
+ }
120
+ };
121
+ this.documents = {
122
+ create: async (indexId, params) => {
123
+ return this.client.request(
124
+ `/v1/shift/indexes/${indexId}/documents`,
125
+ {
126
+ method: "POST",
127
+ body: params
128
+ }
129
+ );
130
+ },
131
+ upload: async (indexId, params) => {
132
+ const formData = new FormData();
133
+ const fileName = resolveUploadFileName(params);
134
+ const contentType = resolveUploadContentType(params);
135
+ const file = normalizeUploadFile(params.file, contentType);
136
+ formData.set("file", file, fileName);
137
+ if (params.metadata) {
138
+ formData.set("metadata", JSON.stringify(params.metadata));
139
+ }
140
+ if (typeof params.chunkSize === "number") {
141
+ formData.set("chunkSize", String(params.chunkSize));
142
+ }
143
+ if (typeof params.chunkOverlap === "number") {
144
+ formData.set("chunkOverlap", String(params.chunkOverlap));
145
+ }
146
+ return this.client.request(
147
+ `/v1/shift/indexes/${indexId}/files`,
148
+ {
149
+ method: "POST",
150
+ body: formData
151
+ }
152
+ );
153
+ }
154
+ };
155
+ this.entries = {
156
+ list: async (indexId, params = {}) => {
157
+ const search = new URLSearchParams();
158
+ if (typeof params.take === "number") {
159
+ search.set("take", String(params.take));
160
+ }
161
+ if (typeof params.skip === "number") {
162
+ search.set("skip", String(params.skip));
163
+ }
164
+ const suffix = search.size > 0 ? `?${search.toString()}` : "";
165
+ return this.client.request(
166
+ `/v1/shift/indexes/${indexId}/entries${suffix}`
167
+ );
168
+ },
169
+ delete: async (indexId, entryId) => {
170
+ return this.client.request(
171
+ `/v1/shift/indexes/${indexId}/entries/${entryId}`,
172
+ {
173
+ method: "DELETE"
174
+ }
175
+ );
176
+ }
177
+ };
178
+ }
179
+ async search(indexId, params) {
180
+ return this.client.request(
181
+ `/v1/shift/indexes/${indexId}/search`,
182
+ {
183
+ method: "POST",
184
+ body: params
185
+ }
186
+ );
55
187
  }
56
188
  };
57
- var index_default = {
58
- Agent,
59
- Tool
189
+ var Ragable = class {
190
+ constructor(options) {
191
+ __publicField(this, "shift");
192
+ __publicField(this, "infrastructure");
193
+ const client = new RagableRequestClient(options);
194
+ this.shift = new ShiftClient(client);
195
+ this.infrastructure = {
196
+ shift: this.shift
197
+ };
198
+ }
60
199
  };
200
+ function createClient(options) {
201
+ return new Ragable(options);
202
+ }
203
+ function extractErrorMessage(payload, fallback) {
204
+ if (payload && typeof payload === "object") {
205
+ if ("error" in payload && typeof payload.error === "string") {
206
+ return payload.error;
207
+ }
208
+ if ("message" in payload && typeof payload.message === "string") {
209
+ return payload.message;
210
+ }
211
+ }
212
+ if (typeof payload === "string" && payload.length > 0) {
213
+ return payload;
214
+ }
215
+ return fallback || "Request failed";
216
+ }
217
+ function resolveUploadFileName(params) {
218
+ if (params.fileName) {
219
+ return params.fileName;
220
+ }
221
+ if (isNamedBlob(params.file)) {
222
+ return params.file.name;
223
+ }
224
+ return "upload.bin";
225
+ }
226
+ function resolveUploadContentType(params) {
227
+ if (params.contentType) {
228
+ return params.contentType;
229
+ }
230
+ if (params.file instanceof Blob && params.file.type) {
231
+ return params.file.type;
232
+ }
233
+ return "application/octet-stream";
234
+ }
235
+ function normalizeUploadFile(file, contentType) {
236
+ if (file instanceof Blob) {
237
+ return file;
238
+ }
239
+ if (file instanceof Uint8Array) {
240
+ return new Blob([toArrayBuffer(file)], { type: contentType });
241
+ }
242
+ return new Blob([file], { type: contentType });
243
+ }
244
+ function isNamedBlob(value) {
245
+ return value instanceof Blob && "name" in value && typeof value.name === "string";
246
+ }
247
+ function isBodyInit(value) {
248
+ return typeof value === "string" || value instanceof Blob || value instanceof FormData || value instanceof URLSearchParams || value instanceof ArrayBuffer || ArrayBuffer.isView(value);
249
+ }
250
+ function toArrayBuffer(value) {
251
+ const copy = new Uint8Array(value.byteLength);
252
+ copy.set(value);
253
+ return copy.buffer;
254
+ }
61
255
  // Annotate the CommonJS export names for ESM import in node:
62
256
  0 && (module.exports = {
63
- Agent,
64
- Tool
257
+ Ragable,
258
+ RagableError,
259
+ createClient
65
260
  });
66
261
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export interface AgentConfig {\n name: string;\n model?: string;\n memory?: boolean;\n tools?: any[];\n knowledge?: string[];\n}\n\nexport class Agent {\n private config: AgentConfig;\n\n constructor(config: AgentConfig) {\n this.config = config;\n }\n\n public async deploy() {\n console.log(`Deploying agent: ${this.config.name}...`);\n return {\n status: \"deployed\",\n agentId: \"ag_\" + Math.random().toString(36).substr(2, 9),\n url: `https://api.ragable.com/v1/agents/${this.config.name}`,\n };\n }\n\n public async run(input: string) {\n console.log(`Agent ${this.config.name} processing: ${input}`);\n return {\n response: \"This is a mock response from the SDK.\",\n traceId: \"tr_\" + Math.random().toString(36).substr(2, 9),\n };\n }\n}\n\nexport class Tool {\n static connect(apiKey: string) {\n void apiKey;\n return { type: \"tool\", connected: true };\n }\n}\n\nexport default {\n Agent,\n Tool,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQO,IAAM,QAAN,MAAY;AAAA,EAGjB,YAAY,QAAqB;AAFjC,wBAAQ;AAGN,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,MAAa,SAAS;AACpB,YAAQ,IAAI,oBAAoB,KAAK,OAAO,IAAI,KAAK;AACrD,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,SAAS,QAAQ,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,OAAO,GAAG,CAAC;AAAA,MACvD,KAAK,qCAAqC,KAAK,OAAO,IAAI;AAAA,IAC5D;AAAA,EACF;AAAA,EAEA,MAAa,IAAI,OAAe;AAC9B,YAAQ,IAAI,SAAS,KAAK,OAAO,IAAI,gBAAgB,KAAK,EAAE;AAC5D,WAAO;AAAA,MACL,UAAU;AAAA,MACV,SAAS,QAAQ,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,OAAO,GAAG,CAAC;AAAA,IACzD;AAAA,EACF;AACF;AAEO,IAAM,OAAN,MAAW;AAAA,EAChB,OAAO,QAAQ,QAAgB;AAC7B,SAAK;AACL,WAAO,EAAE,MAAM,QAAQ,WAAW,KAAK;AAAA,EACzC;AACF;AAEA,IAAO,gBAAQ;AAAA,EACb;AAAA,EACA;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export interface RagableClientOptions {\n apiKey: string;\n baseUrl?: string;\n fetch?: typeof fetch;\n headers?: HeadersInit;\n}\n\nexport interface ShiftIndex {\n id: string;\n name: string;\n description: string | null;\n dimensions: number;\n embeddingModel: string;\n status: string;\n entryCount?: number;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface ShiftEntry {\n id: string;\n content: string;\n metadata: unknown;\n chunkIndex: number;\n createdAt: string;\n}\n\nexport interface ShiftSearchResult {\n content: string;\n score: number;\n metadata: unknown;\n}\n\nexport interface ShiftCreateIndexParams {\n name: string;\n description?: string;\n dimensions?: number;\n embeddingModel?: string;\n}\n\nexport interface ShiftUpdateIndexParams {\n name?: string;\n description?: string;\n}\n\nexport interface ShiftAddDocumentParams {\n content: string;\n metadata?: Record<string, unknown>;\n chunkSize?: number;\n chunkOverlap?: number;\n}\n\nexport type ShiftUploadableFile = Blob | ArrayBuffer | Uint8Array;\n\nexport interface ShiftUploadFileParams {\n file: ShiftUploadableFile;\n fileName?: string;\n contentType?: string;\n metadata?: Record<string, unknown>;\n chunkSize?: number;\n chunkOverlap?: number;\n}\n\nexport interface ShiftListEntriesParams {\n take?: number;\n skip?: number;\n}\n\nexport interface ShiftSearchParams {\n query: string;\n topK?: number;\n}\n\nexport interface ShiftIngestResponse {\n chunksCreated: number;\n entries: string[];\n extractedText?: string;\n message?: string;\n}\n\nexport interface ShiftListEntriesResponse {\n entries: ShiftEntry[];\n total: number;\n}\n\nexport class RagableError extends Error {\n readonly status: number;\n readonly body: unknown;\n\n constructor(message: string, status: number, body: unknown) {\n super(message);\n this.name = \"RagableError\";\n this.status = status;\n this.body = body;\n }\n}\n\ntype RequestOptions = Omit<RequestInit, \"body\"> & {\n body?: unknown;\n};\n\nclass RagableRequestClient {\n private readonly apiKey: string;\n private readonly baseUrl: string;\n private readonly fetchImpl: typeof fetch;\n private readonly defaultHeaders: HeadersInit | undefined;\n\n constructor(options: RagableClientOptions) {\n this.apiKey = options.apiKey;\n this.baseUrl = options.baseUrl ?? \"http://localhost:8080/api\";\n this.fetchImpl = options.fetch ?? fetch;\n this.defaultHeaders = options.headers;\n }\n\n async request<T>(path: string, options: RequestOptions = {}): Promise<T> {\n const headers = new Headers(this.defaultHeaders);\n headers.set(\"Authorization\", `Bearer ${this.apiKey}`);\n\n let body = options.body;\n if (body !== undefined && !isBodyInit(body)) {\n headers.set(\"Content-Type\", \"application/json\");\n body = JSON.stringify(body);\n }\n\n const response = await this.fetchImpl(this.toUrl(path), {\n ...options,\n headers,\n body: body as BodyInit | undefined,\n });\n\n const payload = await this.parseResponseBody(response);\n if (!response.ok) {\n const message = extractErrorMessage(payload, response.statusText);\n throw new RagableError(message, response.status, payload);\n }\n\n return payload as T;\n }\n\n private toUrl(path: string) {\n const normalizedBase = this.baseUrl.replace(/\\/+$/, \"\");\n const normalizedPath = path.startsWith(\"/\") ? path : `/${path}`;\n return `${normalizedBase}${normalizedPath}`;\n }\n\n private async parseResponseBody(response: Response): Promise<unknown> {\n if (response.status === 204) {\n return null;\n }\n\n const contentType = response.headers.get(\"content-type\") ?? \"\";\n if (contentType.includes(\"application/json\")) {\n return response.json();\n }\n\n return response.text();\n }\n}\n\nclass ShiftClient {\n readonly indexes: {\n list: () => Promise<{ indexes: ShiftIndex[] }>;\n create: (params: ShiftCreateIndexParams) => Promise<ShiftIndex>;\n get: (indexId: string) => Promise<ShiftIndex>;\n update: (indexId: string, params: ShiftUpdateIndexParams) => Promise<ShiftIndex>;\n delete: (indexId: string) => Promise<{ success: true }>;\n };\n\n readonly documents: {\n create: (\n indexId: string,\n params: ShiftAddDocumentParams,\n ) => Promise<ShiftIngestResponse>;\n upload: (\n indexId: string,\n params: ShiftUploadFileParams,\n ) => Promise<ShiftIngestResponse>;\n };\n\n readonly entries: {\n list: (\n indexId: string,\n params?: ShiftListEntriesParams,\n ) => Promise<ShiftListEntriesResponse>;\n delete: (indexId: string, entryId: string) => Promise<{ success: true }>;\n };\n\n constructor(private readonly client: RagableRequestClient) {\n this.indexes = {\n list: async () => {\n return this.client.request<{ indexes: ShiftIndex[] }>(\"/v1/shift/indexes\");\n },\n create: async (params) => {\n return this.client.request<ShiftIndex>(\"/v1/shift/indexes\", {\n method: \"POST\",\n body: params,\n });\n },\n get: async (indexId) => {\n return this.client.request<ShiftIndex>(`/v1/shift/indexes/${indexId}`);\n },\n update: async (indexId, params) => {\n return this.client.request<ShiftIndex>(`/v1/shift/indexes/${indexId}`, {\n method: \"PUT\",\n body: params,\n });\n },\n delete: async (indexId) => {\n return this.client.request<{ success: true }>(\n `/v1/shift/indexes/${indexId}`,\n {\n method: \"DELETE\",\n },\n );\n },\n };\n\n this.documents = {\n create: async (indexId, params) => {\n return this.client.request<ShiftIngestResponse>(\n `/v1/shift/indexes/${indexId}/documents`,\n {\n method: \"POST\",\n body: params,\n },\n );\n },\n upload: async (indexId, params) => {\n const formData = new FormData();\n const fileName = resolveUploadFileName(params);\n const contentType = resolveUploadContentType(params);\n const file = normalizeUploadFile(params.file, contentType);\n\n formData.set(\"file\", file, fileName);\n\n if (params.metadata) {\n formData.set(\"metadata\", JSON.stringify(params.metadata));\n }\n if (typeof params.chunkSize === \"number\") {\n formData.set(\"chunkSize\", String(params.chunkSize));\n }\n if (typeof params.chunkOverlap === \"number\") {\n formData.set(\"chunkOverlap\", String(params.chunkOverlap));\n }\n\n return this.client.request<ShiftIngestResponse>(\n `/v1/shift/indexes/${indexId}/files`,\n {\n method: \"POST\",\n body: formData,\n },\n );\n },\n };\n\n this.entries = {\n list: async (indexId, params = {}) => {\n const search = new URLSearchParams();\n if (typeof params.take === \"number\") {\n search.set(\"take\", String(params.take));\n }\n if (typeof params.skip === \"number\") {\n search.set(\"skip\", String(params.skip));\n }\n\n const suffix = search.size > 0 ? `?${search.toString()}` : \"\";\n return this.client.request<ShiftListEntriesResponse>(\n `/v1/shift/indexes/${indexId}/entries${suffix}`,\n );\n },\n delete: async (indexId, entryId) => {\n return this.client.request<{ success: true }>(\n `/v1/shift/indexes/${indexId}/entries/${entryId}`,\n {\n method: \"DELETE\",\n },\n );\n },\n };\n }\n\n async search(indexId: string, params: ShiftSearchParams) {\n return this.client.request<{ results: ShiftSearchResult[] }>(\n `/v1/shift/indexes/${indexId}/search`,\n {\n method: \"POST\",\n body: params,\n },\n );\n }\n}\n\nexport class Ragable {\n readonly shift: ShiftClient;\n readonly infrastructure: {\n shift: ShiftClient;\n };\n\n constructor(options: RagableClientOptions) {\n const client = new RagableRequestClient(options);\n this.shift = new ShiftClient(client);\n this.infrastructure = {\n shift: this.shift,\n };\n }\n}\n\nexport function createClient(options: RagableClientOptions) {\n return new Ragable(options);\n}\n\nfunction extractErrorMessage(payload: unknown, fallback: string) {\n if (payload && typeof payload === \"object\") {\n if (\"error\" in payload && typeof payload.error === \"string\") {\n return payload.error;\n }\n if (\"message\" in payload && typeof payload.message === \"string\") {\n return payload.message;\n }\n }\n\n if (typeof payload === \"string\" && payload.length > 0) {\n return payload;\n }\n\n return fallback || \"Request failed\";\n}\n\nfunction resolveUploadFileName(params: ShiftUploadFileParams) {\n if (params.fileName) {\n return params.fileName;\n }\n\n if (isNamedBlob(params.file)) {\n return params.file.name;\n }\n\n return \"upload.bin\";\n}\n\nfunction resolveUploadContentType(params: ShiftUploadFileParams) {\n if (params.contentType) {\n return params.contentType;\n }\n\n if (params.file instanceof Blob && params.file.type) {\n return params.file.type;\n }\n\n return \"application/octet-stream\";\n}\n\nfunction normalizeUploadFile(file: ShiftUploadableFile, contentType: string) {\n if (file instanceof Blob) {\n return file;\n }\n\n if (file instanceof Uint8Array) {\n return new Blob([toArrayBuffer(file)], { type: contentType });\n }\n\n return new Blob([file], { type: contentType });\n}\n\nfunction isNamedBlob(value: ShiftUploadableFile): value is Blob & { name: string } {\n return value instanceof Blob && \"name\" in value && typeof value.name === \"string\";\n}\n\nfunction isBodyInit(value: unknown): value is BodyInit {\n return (\n typeof value === \"string\" ||\n value instanceof Blob ||\n value instanceof FormData ||\n value instanceof URLSearchParams ||\n value instanceof ArrayBuffer ||\n ArrayBuffer.isView(value)\n );\n}\n\nfunction toArrayBuffer(value: Uint8Array) {\n const copy = new Uint8Array(value.byteLength);\n copy.set(value);\n return copy.buffer;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAqFO,IAAM,eAAN,cAA2B,MAAM;AAAA,EAItC,YAAY,SAAiB,QAAgB,MAAe;AAC1D,UAAM,OAAO;AAJf,wBAAS;AACT,wBAAS;AAIP,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,OAAO;AAAA,EACd;AACF;AAMA,IAAM,uBAAN,MA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AC;AAC/C;AAEA,SAAS,YAAY,OAA8D;AACjF,SAAO,iBAAiB,QAAQ,UAAU,SAAS,OAAO,MAAM,SAAS;AAC3E;AAEA,SAAS,WAAW,OAAmC;AACrD,SACE,OAAO,UAAU,YACjB,iBAAiB,QACjB,iBAAiB,YACjB,iBAAiB,mBACjB,iBAAiB,eACjB,YAAY,OAAO,KAAK;AAE5B;AAEA,SAAS,cAAc,OAAmB;AACxC,QAAM,OAAO,IAAI,WAAW,MAAM,UAAU;AAC5C,OAAK,IAAI,KAAK;AACd,SAAO,KAAK;AACd;","names":[]}
package/dist/index.mjs CHANGED
@@ -3,40 +3,234 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
 
5
5
  // src/index.ts
6
- var Agent = class {
7
- constructor(config) {
8
- __publicField(this, "config");
9
- this.config = config;
10
- }
11
- async deploy() {
12
- console.log(`Deploying agent: ${this.config.name}...`);
13
- return {
14
- status: "deployed",
15
- agentId: "ag_" + Math.random().toString(36).substr(2, 9),
16
- url: `https://api.ragable.com/v1/agents/${this.config.name}`
17
- };
6
+ var RagableError = class extends Error {
7
+ constructor(message, status, body) {
8
+ super(message);
9
+ __publicField(this, "status");
10
+ __publicField(this, "body");
11
+ this.name = "RagableError";
12
+ this.status = status;
13
+ this.body = body;
18
14
  }
19
- async run(input) {
20
- console.log(`Agent ${this.config.name} processing: ${input}`);
21
- return {
22
- response: "This is a mock response from the SDK.",
23
- traceId: "tr_" + Math.random().toString(36).substr(2, 9)
24
- };
15
+ };
16
+ var RagableRequestClient = class {
17
+ constructor(options) {
18
+ __publicField(this, "apiKey");
19
+ __publicField(this, "baseUrl");
20
+ __publicField(this, "fetchImpl");
21
+ __publicField(this, "defaultHeaders");
22
+ this.apiKey = options.apiKey;
23
+ this.baseUrl = options.baseUrl ?? "http://localhost:8080/api";
24
+ this.fetchImpl = options.fetch ?? fetch;
25
+ this.defaultHeaders = options.headers;
26
+ }
27
+ async request(path, options = {}) {
28
+ const headers = new Headers(this.defaultHeaders);
29
+ headers.set("Authorization", `Bearer ${this.apiKey}`);
30
+ let body = options.body;
31
+ if (body !== void 0 && !isBodyInit(body)) {
32
+ headers.set("Content-Type", "application/json");
33
+ body = JSON.stringify(body);
34
+ }
35
+ const response = await this.fetchImpl(this.toUrl(path), {
36
+ ...options,
37
+ headers,
38
+ body
39
+ });
40
+ const payload = await this.parseResponseBody(response);
41
+ if (!response.ok) {
42
+ const message = extractErrorMessage(payload, response.statusText);
43
+ throw new RagableError(message, response.status, payload);
44
+ }
45
+ return payload;
46
+ }
47
+ toUrl(path) {
48
+ const normalizedBase = this.baseUrl.replace(/\/+$/, "");
49
+ const normalizedPath = path.startsWith("/") ? path : `/${path}`;
50
+ return `${normalizedBase}${normalizedPath}`;
51
+ }
52
+ async parseResponseBody(response) {
53
+ if (response.status === 204) {
54
+ return null;
55
+ }
56
+ const contentType = response.headers.get("content-type") ?? "";
57
+ if (contentType.includes("application/json")) {
58
+ return response.json();
59
+ }
60
+ return response.text();
25
61
  }
26
62
  };
27
- var Tool = class {
28
- static connect(apiKey) {
29
- void apiKey;
30
- return { type: "tool", connected: true };
63
+ var ShiftClient = class {
64
+ constructor(client) {
65
+ this.client = client;
66
+ __publicField(this, "indexes");
67
+ __publicField(this, "documents");
68
+ __publicField(this, "entries");
69
+ this.indexes = {
70
+ list: async () => {
71
+ return this.client.request("/v1/shift/indexes");
72
+ },
73
+ create: async (params) => {
74
+ return this.client.request("/v1/shift/indexes", {
75
+ method: "POST",
76
+ body: params
77
+ });
78
+ },
79
+ get: async (indexId) => {
80
+ return this.client.request(`/v1/shift/indexes/${indexId}`);
81
+ },
82
+ update: async (indexId, params) => {
83
+ return this.client.request(`/v1/shift/indexes/${indexId}`, {
84
+ method: "PUT",
85
+ body: params
86
+ });
87
+ },
88
+ delete: async (indexId) => {
89
+ return this.client.request(
90
+ `/v1/shift/indexes/${indexId}`,
91
+ {
92
+ method: "DELETE"
93
+ }
94
+ );
95
+ }
96
+ };
97
+ this.documents = {
98
+ create: async (indexId, params) => {
99
+ return this.client.request(
100
+ `/v1/shift/indexes/${indexId}/documents`,
101
+ {
102
+ method: "POST",
103
+ body: params
104
+ }
105
+ );
106
+ },
107
+ upload: async (indexId, params) => {
108
+ const formData = new FormData();
109
+ const fileName = resolveUploadFileName(params);
110
+ const contentType = resolveUploadContentType(params);
111
+ const file = normalizeUploadFile(params.file, contentType);
112
+ formData.set("file", file, fileName);
113
+ if (params.metadata) {
114
+ formData.set("metadata", JSON.stringify(params.metadata));
115
+ }
116
+ if (typeof params.chunkSize === "number") {
117
+ formData.set("chunkSize", String(params.chunkSize));
118
+ }
119
+ if (typeof params.chunkOverlap === "number") {
120
+ formData.set("chunkOverlap", String(params.chunkOverlap));
121
+ }
122
+ return this.client.request(
123
+ `/v1/shift/indexes/${indexId}/files`,
124
+ {
125
+ method: "POST",
126
+ body: formData
127
+ }
128
+ );
129
+ }
130
+ };
131
+ this.entries = {
132
+ list: async (indexId, params = {}) => {
133
+ const search = new URLSearchParams();
134
+ if (typeof params.take === "number") {
135
+ search.set("take", String(params.take));
136
+ }
137
+ if (typeof params.skip === "number") {
138
+ search.set("skip", String(params.skip));
139
+ }
140
+ const suffix = search.size > 0 ? `?${search.toString()}` : "";
141
+ return this.client.request(
142
+ `/v1/shift/indexes/${indexId}/entries${suffix}`
143
+ );
144
+ },
145
+ delete: async (indexId, entryId) => {
146
+ return this.client.request(
147
+ `/v1/shift/indexes/${indexId}/entries/${entryId}`,
148
+ {
149
+ method: "DELETE"
150
+ }
151
+ );
152
+ }
153
+ };
154
+ }
155
+ async search(indexId, params) {
156
+ return this.client.request(
157
+ `/v1/shift/indexes/${indexId}/search`,
158
+ {
159
+ method: "POST",
160
+ body: params
161
+ }
162
+ );
31
163
  }
32
164
  };
33
- var index_default = {
34
- Agent,
35
- Tool
165
+ var Ragable = class {
166
+ constructor(options) {
167
+ __publicField(this, "shift");
168
+ __publicField(this, "infrastructure");
169
+ const client = new RagableRequestClient(options);
170
+ this.shift = new ShiftClient(client);
171
+ this.infrastructure = {
172
+ shift: this.shift
173
+ };
174
+ }
36
175
  };
176
+ function createClient(options) {
177
+ return new Ragable(options);
178
+ }
179
+ function extractErrorMessage(payload, fallback) {
180
+ if (payload && typeof payload === "object") {
181
+ if ("error" in payload && typeof payload.error === "string") {
182
+ return payload.error;
183
+ }
184
+ if ("message" in payload && typeof payload.message === "string") {
185
+ return payload.message;
186
+ }
187
+ }
188
+ if (typeof payload === "string" && payload.length > 0) {
189
+ return payload;
190
+ }
191
+ return fallback || "Request failed";
192
+ }
193
+ function resolveUploadFileName(params) {
194
+ if (params.fileName) {
195
+ return params.fileName;
196
+ }
197
+ if (isNamedBlob(params.file)) {
198
+ return params.file.name;
199
+ }
200
+ return "upload.bin";
201
+ }
202
+ function resolveUploadContentType(params) {
203
+ if (params.contentType) {
204
+ return params.contentType;
205
+ }
206
+ if (params.file instanceof Blob && params.file.type) {
207
+ return params.file.type;
208
+ }
209
+ return "application/octet-stream";
210
+ }
211
+ function normalizeUploadFile(file, contentType) {
212
+ if (file instanceof Blob) {
213
+ return file;
214
+ }
215
+ if (file instanceof Uint8Array) {
216
+ return new Blob([toArrayBuffer(file)], { type: contentType });
217
+ }
218
+ return new Blob([file], { type: contentType });
219
+ }
220
+ function isNamedBlob(value) {
221
+ return value instanceof Blob && "name" in value && typeof value.name === "string";
222
+ }
223
+ function isBodyInit(value) {
224
+ return typeof value === "string" || value instanceof Blob || value instanceof FormData || value instanceof URLSearchParams || value instanceof ArrayBuffer || ArrayBuffer.isView(value);
225
+ }
226
+ function toArrayBuffer(value) {
227
+ const copy = new Uint8Array(value.byteLength);
228
+ copy.set(value);
229
+ return copy.buffer;
230
+ }
37
231
  export {
38
- Agent,
39
- Tool,
40
- index_default as default
232
+ Ragable,
233
+ RagableError,
234
+ createClient
41
235
  };
42
236
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export interface AgentConfig {\n name: string;\n model?: string;\n memory?: boolean;\n tools?: any[];\n knowledge?: string[];\n}\n\nexport class Agent {\n private config: AgentConfig;\n\n constructor(config: AgentConfig) {\n this.config = config;\n }\n\n public async deploy() {\n console.log(`Deploying agent: ${this.config.name}...`);\n return {\n status: \"deployed\",\n agentId: \"ag_\" + Math.random().toString(36).substr(2, 9),\n url: `https://api.ragable.com/v1/agents/${this.config.name}`,\n };\n }\n\n public async run(input: string) {\n console.log(`Agent ${this.config.name} processing: ${input}`);\n return {\n response: \"This is a mock response from the SDK.\",\n traceId: \"tr_\" + Math.random().toString(36).substr(2, 9),\n };\n }\n}\n\nexport class Tool {\n static connect(apiKey: string) {\n void apiKey;\n return { type: \"tool\", connected: true };\n }\n}\n\nexport default {\n Agent,\n Tool,\n};\n"],"mappings":";;;;;AAQO,IAAM,QAAN,MAAY;AAAA,EAGjB,YAAY,QAAqB;AAFjC,wBAAQ;AAGN,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,MAAa,SAAS;AACpB,YAAQ,IAAI,oBAAoB,KAAK,OAAO,IAAI,KAAK;AACrD,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,SAAS,QAAQ,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,OAAO,GAAG,CAAC;AAAA,MACvD,KAAK,qCAAqC,KAAK,OAAO,IAAI;AAAA,IAC5D;AAAA,EACF;AAAA,EAEA,MAAa,IAAI,OAAe;AAC9B,YAAQ,IAAI,SAAS,KAAK,OAAO,IAAI,gBAAgB,KAAK,EAAE;AAC5D,WAAO;AAAA,MACL,UAAU;AAAA,MACV,SAAS,QAAQ,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,OAAO,GAAG,CAAC;AAAA,IACzD;AAAA,EACF;AACF;AAEO,IAAM,OAAN,MAAW;AAAA,EAChB,OAAO,QAAQ,QAAgB;AAC7B,SAAK;AACL,WAAO,EAAE,MAAM,QAAQ,WAAW,KAAK;AAAA,EACzC;AACF;AAEA,IAAO,gBAAQ;AAAA,EACb;AAAA,EACA;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export interface RagableClientOptions {\n apiKey: string;\n baseUrl?: string;\n fetch?: typeof fetch;\n headers?: HeadersInit;\n}\n\nexport interface ShiftIndex {\n id: string;\n name: string;\n description: string | null;\n dimensions: number;\n embeddingModel: string;\n status: string;\n entryCount?: number;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface ShiftEntry {\n id: string;\n content: string;\n metadata: unknown;\n chunkIndex: number;\n createdAt: string;\n}\n\nexport interface ShiftSearchResult {\n content: string;\n score: number;\n metadata: unknown;\n}\n\nexport interface ShiftCreateIndexParams {\n name: string;\n description?: string;\n dimensions?: number;\n embeddingModel?: string;\n}\n\nexport interface ShiftUpdateIndexParams {\n name?: string;\n description?: string;\n}\n\nexport interface ShiftAddDocumentParams {\n content: string;\n metadata?: Record<string, unknown>;\n chunkSize?: number;\n chunkOverlap?: number;\n}\n\nexport type ShiftUploadableFile = Blob | ArrayBuffer | Uint8Array;\n\nexport interface ShiftUploadFileParams {\n file: ShiftUploadableFile;\n fileName?: string;\n contentType?: string;\n metadata?: Record<string, unknown>;\n chunkSize?: number;\n chunkOverlap?: number;\n}\n\nexport interface ShiftListEntriesParams {\n take?: number;\n skip?: number;\n}\n\nexport interface ShiftSearchParams {\n query: string;\n topK?: number;\n}\n\nexport interface ShiftIngestResponse {\n chunksCreated: number;\n entries: string[];\n extractedText?: string;\n message?: string;\n}\n\nexport interface ShiftListEntriesResponse {\n entries: ShiftEntry[];\n total: number;\n}\n\nexport class RagableError extends Error {\n readonly status: number;\n readonly body: unknown;\n\n constructor(message: string, status: number, body: unknown) {\n super(message);\n this.name = \"RagableError\";\n this.status = status;\n this.body = body;\n }\n}\n\ntype RequestOptions = Omit<RequestInit, \"body\"> & {\n body?: unknown;\n};\n\nclass RagableRequestClient {\n private readonly apiKey: string;\n private readonly baseUrl: string;\n private readonly fetchImpl: typeof fetch;\n private readonly defaultHeaders: HeadersInit | undefined;\n\n constructor(options: RagableClientOptions) {\n this.apiKey = options.apiKey;\n this.baseUrl = options.baseUrl ?? \"http://localhost:8080/api\";\n this.fetchImpl = options.fetch ?? fetch;\n this.defaultHeaders = options.headers;\n }\n\n async request<T>(path: string, options: RequestOptions = {}): Promise<T> {\n const headers = new Headers(this.defaultHeaders);\n headers.set(\"Authorization\", `Bearer ${this.apiKey}`);\n\n let body = options.body;\n if (body !== undefined && !isBodyInit(body)) {\n headers.set(\"Content-Type\", \"application/json\");\n body = JSON.stringify(body);\n }\n\n const response = await this.fetchImpl(this.toUrl(path), {\n ...options,\n headers,\n body: body as BodyInit | undefined,\n });\n\n const payload = await this.parseResponseBody(response);\n if (!response.ok) {\n const message = extractErrorMessage(payload, response.statusText);\n throw new RagableError(message, response.status, payload);\n }\n\n return payload as T;\n }\n\n private toUrl(path: string) {\n const normalizedBase = this.baseUrl.replace(/\\/+$/, \"\");\n const normalizedPath = path.startsWith(\"/\") ? path : `/${path}`;\n return `${normalizedBase}${normalizedPath}`;\n }\n\n private async parseResponseBody(response: Response): Promise<unknown> {\n if (response.status === 204) {\n return null;\n }\n\n const contentType = response.headers.get(\"content-type\") ?? \"\";\n if (contentType.includes(\"application/json\")) {\n return response.json();\n }\n\n return response.text();\n }\n}\n\nclass ShiftClient {\n readonly indexes: {\n list: () => Promise<{ indexes: ShiftIndex[] }>;\n create: (params: ShiftCreateIndexParams) => Promise<ShiftIndex>;\n get: (indexId: string) => Promise<ShiftIndex>;\n update: (indexId: string, params: ShiftUpdateIndexParams) => Promise<ShiftIndex>;\n delete: (indexId: string) => Promise<{ success: true }>;\n };\n\n readonly documents: {\n create: (\n indexId: string,\n params: ShiftAddDocumentParams,\n ) => Promise<ShiftIngestResponse>;\n upload: (\n indexId: string,\n params: ShiftUploadFileParams,\n ) => Promise<ShiftIngestResponse>;\n };\n\n readonly entries: {\n list: (\n indexId: string,\n params?: ShiftListEntriesParams,\n ) => Promise<ShiftListEntriesResponse>;\n delete: (indexId: string, entryId: string) => Promise<{ success: true }>;\n };\n\n constructor(private readonly client: RagableRequestClient) {\n this.indexes = {\n list: async () => {\n return this.client.request<{ indexes: ShiftIndex[] }>(\"/v1/shift/indexes\");\n },\n create: async (params) => {\n return this.client.request<ShiftIndex>(\"/v1/shift/indexes\", {\n method: \"POST\",\n body: params,\n });\n },\n get: async (indexId) => {\n return this.client.request<ShiftIndex>(`/v1/shift/indexes/${indexId}`);\n },\n update: async (indexId, params) => {\n return this.client.request<ShiftIndex>(`/v1/shift/indexes/${indexId}`, {\n method: \"PUT\",\n body: params,\n });\n },\n delete: async (indexId) => {\n return this.client.request<{ success: true }>(\n `/v1/shift/indexes/${indexId}`,\n {\n method: \"DELETE\",\n },\n );\n },\n };\n\n this.documents = {\n create: async (indexId, params) => {\n return this.client.request<ShiftIngestResponse>(\n `/v1/shift/indexes/${indexId}/documents`,\n {\n method: \"POST\",\n body: params,\n },\n );\n },\n upload: async (indexId, params) => {\n const formData = new FormData();\n const fileName = resolveUploadFileName(params);\n const contentType = resolveUploadContentType(params);\n const file = normalizeUploadFile(params.file, contentType);\n\n formData.set(\"file\", file, fileName);\n\n if (params.metadata) {\n formData.set(\"metadata\", JSON.stringify(params.metadata));\n }\n if (typeof params.chunkSize === \"number\") {\n formData.set(\"chunkSize\", String(params.chunkSize));\n }\n if (typeof params.chunkOverlap === \"number\") {\n formData.set(\"chunkOverlap\", String(params.chunkOverlap));\n }\n\n return this.client.request<ShiftIngestResponse>(\n `/v1/shift/indexes/${indexId}/files`,\n {\n method: \"POST\",\n body: formData,\n },\n );\n },\n };\n\n this.entries = {\n list: async (indexId, params = {}) => {\n const search = new URLSearchParams();\n if (typeof params.take === \"number\") {\n search.set(\"take\", String(params.take));\n }\n if (typeof params.skip === \"number\") {\n search.set(\"skip\", String(params.skip));\n }\n\n const suffix = search.size > 0 ? `?${search.toString()}` : \"\";\n return this.client.request<ShiftListEntriesResponse>(\n `/v1/shift/indexes/${indexId}/entries${suffix}`,\n );\n },\n delete: async (indexId, entryId) => {\n return this.client.request<{ success: true }>(\n `/v1/shift/indexes/${indexId}/entries/${entryId}`,\n {\n method: \"DELETE\",\n },\n );\n },\n };\n }\n\n async search(indexId: string, params: ShiftSearchParams) {\n return this.client.request<{ results: ShiftSearchResult[] }>(\n `/v1/shift/indexes/${indexId}/search`,\n {\n method: \"POST\",\n body: params,\n },\n );\n }\n}\n\nexport class Ragable {\n readonly shift: ShiftClient;\n readonly infrastructure: {\n shift: ShiftClient;\n };\n\n constructor(options: RagableClientOptions) {\n const client = new RagableRequestClient(options);\n this.shift = new ShiftClient(client);\n this.infrastructure = {\n shift: this.shift,\n };\n }\n}\n\nexport function createClient(options: RagableClientOptions) {\n return new Ragable(options);\n}\n\nfunction extractErrorMessage(payload: unknown, fallback: string) {\n if (payload && typeof payload === \"object\") {\n if (\"error\" in payload && typeof payload.error === \"string\") {\n return payload.error;\n }\n if (\"message\" in payload && typeof payload.message === \"string\") {\n return payload.message;\n }\n }\n\n if (typeof payload === \"string\" && payload.length > 0) {\n return payload;\n }\n\n return fallback || \"Request failed\";\n}\n\nfunction resolveUploadFileName(params: ShiftUploadFileParams) {\n if (params.fileName) {\n return params.fileName;\n }\n\n if (isNamedBlob(params.file)) {\n return params.file.name;\n }\n\n return \"upload.bin\";\n}\n\nfunction resolveUploadContentType(params: ShiftUploadFileParams) {\n if (params.contentType) {\n return params.contentType;\n }\n\n if (params.file instanceof Blob && params.file.type) {\n return params.file.type;\n }\n\n return \"application/octet-stream\";\n}\n\nfunction normalizeUploadFile(file: ShiftUploadableFile, contentType: string) {\n if (file instanceof Blob) {\n return file;\n }\n\n if (file instanceof Uint8Array) {\n return new Blob([toArrayBuffer(file)], { type: contentType });\n }\n\n return new Blob([file], { type: contentType });\n}\n\nfunction isNamedBlob(value: ShiftUploadableFile): value is Blob & { name: string } {\n return value instanceof Blob && \"name\" in value && typeof value.name === \"string\";\n}\n\nfunction isBodyInit(value: unknown): value is BodyInit {\n return (\n typeof value === \"string\" ||\n value instanceof Blob ||\n value instanceof FormData ||\n value instanceof URLSearchParams ||\n value instanceof ArrayBuffer ||\n ArrayBuffer.isView(value)\n );\n}\n\nfunction toArrayBuffer(value: Uint8Array) {\n const copy = new Uint8Array(value.byteLength);\n copy.set(value);\n return copy.buffer;\n}\n"],"mappings":";;;;;AAqFO,IAAM,eAAN,cAA2B,MAAM;AAAA,EAItC,YAAY,SAAiB,QAAgB,MAAe;AAC1D,UAAM,OAAO;AAJf,wBAAS;AACT,wBAAS;AAIP,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,OAAO;AAAA,EACd;AACF;AAMA,IAAM,uBAAN,MAA2B;AAAA,EAMzB,YAAY,SAA+B;AAL3C,wBAAiB;AACjB,wBAAiB;AACjB,wBAAiB;AACjB,wBAAiB;AAGf,SAAK,SAAS,QAAQ;AACtB,SAAK,UAAU,QAAQ,WAAW;AAClC,SAAK,YAAY,QAAQ,SAAS;AAClC,SAAK,iBAAiB,QAAQ;AAAA,EAChC;AAAA,EAEA,MAAM,QAAW,MAAc,UAA0B,CAAC,GAAe;AACvE,UAAM,UAAU,IAAI,QAAQ,KAAK,cAAc;AAC/C,YAAQ,IAAI,iBAAiB,UAAU,KAAK,MAAM,EAAE;AAEpD,QAAI,OAAO,QAAQ;AACnB,QAAI,SAAS,UAAa,CAAC,WAAW,IAAI,GAAG;AAC3C,cAAQ,IAAI,gBAAgB,kBAAkB;AAC9C,aAAO,KAAK,UAAU,IAAI;AAAA,IAC5B;AAEA,UAAM,WAAW,MAAM,KAAK,UAAU,KAAK,MAAM,IAAI,GAAG;AAAA,MACtD,GAAG;AAAA,MACH;AAAA,MACA;AAAA,IACF,CAAC;AAED,UAAM,UAAU,MAAM,KAAK,kBAAkB,QAAQ;AACrD,QAAI,CAAC,SAAS,IAAI;AAChB,YAAM,UAAU,oBAAoB,SAAS,SAAS,UAAU;AAChE,YAAM,IAAI,aAA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AAEA,SAAS,yBAAyB,QAA+B;AAC/D,MAAI,OAAO,aAAa;AACtB,WAAO,OAAO;AAAA,EAChB;AAEA,MAAI,OAAO,gBAAgB,QAAQ,OAAO,KAAK,MAAM;AACnD,WAAO,OAAO,KAAK;AAAA,EACrB;AAEA,SAAO;AACT;AAEA,SAAS,oBAAoB,MAA2B,aAAqB;AAC3E,MAAI,gBAAgB,MAAM;AACxB,WAAO;AAAA,EACT;AAEA,MAAI,gBAAgB,YAAY;AAC9B,WAAO,IAAI,KAAK,CAAC,cAAc,IAAI,CAAC,GAAG,EAAE,MAAM,YAAY,CAAC;AAAA,EAC9D;AAEA,SAAO,IAAI,KAAK,CAAC,IAAI,GAAG,EAAE,MAAM,YAAY,CAAC;AAC/C;AAEA,SAAS,YAAY,OAA8D;AACjF,SAAO,iBAAiB,QAAQ,UAAU,SAAS,OAAO,MAAM,SAAS;AAC3E;AAEA,SAAS,WAAW,OAAmC;AACrD,SACE,OAAO,UAAU,YACjB,iBAAiB,QACjB,iBAAiB,YACjB,iBAAiB,mBACjB,iBAAiB,eACjB,YAAY,OAAO,KAAK;AAE5B;AAEA,SAAS,cAAc,OAAmB;AACxC,QAAM,OAAO,IAAI,WAAW,MAAM,UAAU;AAC5C,OAAK,IAAI,KAAK;AACd,SAAO,KAAK;AACd;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ragable/sdk",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "The official SDK for Ragable - The Operating System for AI Agents",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -19,6 +19,9 @@
19
19
  "build": "tsup",
20
20
  "dev": "tsup --watch",
21
21
  "lint": "tsc",
22
+ "test": "vitest run",
23
+ "example:shift:smoke": "node ./examples/shift-smoke.mjs",
24
+ "example:shift:file": "node ./examples/shift-file-upload.mjs",
22
25
  "prepublishOnly": "npm run build"
23
26
  },
24
27
  "keywords": [
@@ -32,7 +35,8 @@
32
35
  "license": "MIT",
33
36
  "devDependencies": {
34
37
  "tsup": "^8.0.1",
35
- "typescript": "^5.3.3"
38
+ "typescript": "^5.3.3",
39
+ "vitest": "^4.1.0"
36
40
  },
37
41
  "publishConfig": {
38
42
  "access": "public"