@anaralabs/sdk 0.1.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.
@@ -0,0 +1,469 @@
1
+ import { z } from 'zod';
2
+ // Single source of truth for the anara.* surface. Every method's input/output is
3
+ // one zod schema here; the SDK types (z.infer), the OpenAPI document
4
+ // (z.toJSONSchema), and the server-side request validation (.parse) all derive
5
+ // from it, so the published client, the API spec, and the endpoint cannot drift.
6
+ // Inputs are objects (named params) so each method is a clean OpenAPI operation
7
+ // with a JSON-object request body.
8
+ const chatbotType = z
9
+ .enum([
10
+ 'NOTE',
11
+ 'GROUP',
12
+ 'SPREADSHEET',
13
+ 'DOCUMENT',
14
+ 'WEBSITE',
15
+ 'IMAGE',
16
+ 'VIDEO',
17
+ 'AUDIO',
18
+ ])
19
+ .or(z.string());
20
+ export const entityEnvelope = z.object({
21
+ id: z.string(),
22
+ type: chatbotType,
23
+ name: z.string().nullable(),
24
+ groupId: z.string().nullable(),
25
+ organizationId: z.string().nullable().optional(),
26
+ ownerUserId: z.string(),
27
+ isPrivate: z.boolean(),
28
+ isIndexed: z.boolean(),
29
+ createdAt: z.string(),
30
+ updatedAt: z.string(),
31
+ body: z.object({ markdown: z.string() }).optional(),
32
+ });
33
+ const searchHit = z.object({
34
+ chunkId: z.string(),
35
+ documentId: z.string(),
36
+ documentName: z.string().optional(),
37
+ text: z.string(),
38
+ chunkIndex: z.number(),
39
+ pageNumber: z.number().optional(),
40
+ displayPageNumber: z.string().optional(),
41
+ score: z.number().optional(),
42
+ anchor: z.unknown().optional(),
43
+ });
44
+ const passage = z.object({
45
+ passageId: z.string(),
46
+ text: z.string(),
47
+ pageNumber: z.number().optional(),
48
+ displayPageNumber: z.string().optional(),
49
+ });
50
+ const documentPages = z.object({
51
+ documentId: z.string().optional(),
52
+ documentName: z.string().optional(),
53
+ passages: z.array(passage),
54
+ });
55
+ const mapResult = z.object({
56
+ i: z.number(),
57
+ result: z.string(),
58
+ truncated: z.boolean().optional(),
59
+ });
60
+ // ── inputs (one object per method) ────────────────────────────────────────────
61
+ const entitiesQueryInput = z.object({
62
+ type: chatbotType.or(z.array(chatbotType)).optional(),
63
+ groupId: z.string().nullable().optional(),
64
+ nameContains: z.string().optional(),
65
+ limit: z.number().int().min(1).max(200).optional(),
66
+ });
67
+ const entitiesGetInput = z.object({
68
+ id: z.string(),
69
+ withBody: z.boolean().optional(),
70
+ });
71
+ const entitiesCreateInput = z.discriminatedUnion('type', [
72
+ z.object({
73
+ type: z.literal('NOTE'),
74
+ name: z.string(),
75
+ groupId: z.string().nullable().optional(),
76
+ markdown: z.string().optional(),
77
+ }),
78
+ z.object({
79
+ type: z.literal('GROUP'),
80
+ name: z.string(),
81
+ groupId: z.string().nullable().optional(),
82
+ }),
83
+ z.object({
84
+ type: z.literal('SPREADSHEET'),
85
+ name: z.string(),
86
+ groupId: z.string().nullable().optional(),
87
+ sheets: z.array(z.object({
88
+ name: z.string().optional(),
89
+ columns: z.array(z.string()),
90
+ rows: z.array(z.array(z.string())),
91
+ })),
92
+ }),
93
+ ]);
94
+ const entitiesUpdateInput = z.object({
95
+ id: z.string(),
96
+ name: z.string().optional(),
97
+ });
98
+ const entitiesMoveInput = z.object({
99
+ id: z.string(),
100
+ groupId: z.string().nullable(),
101
+ });
102
+ const entitiesDeleteInput = z.object({
103
+ ids: z.string().or(z.array(z.string())),
104
+ dryRun: z.boolean().optional(),
105
+ });
106
+ const searchInput = z.object({
107
+ query: z.string(),
108
+ documentIds: z.array(z.string()).optional(),
109
+ limit: z.number().int().min(1).max(100).optional(),
110
+ });
111
+ const researchInput = z.object({
112
+ // Array form is a decomposable ask — capped at 6 sub-questions like the tool.
113
+ query: z.string().or(z.array(z.string()).min(1).max(6)),
114
+ documentIds: z.array(z.string()).optional(),
115
+ limit: z.number().int().min(1).max(100).optional(),
116
+ readPages: z.number().int().min(0).max(5).optional(),
117
+ });
118
+ const retrievalInput = z.object({
119
+ query: z.string().optional(),
120
+ queries: z.array(z.string()).optional(),
121
+ documentIds: z.array(z.string()).optional(),
122
+ limit: z.number().int().min(1).max(100).optional(),
123
+ });
124
+ const rerankInput = z.object({
125
+ query: z.string(),
126
+ candidates: z.array(searchHit).max(200),
127
+ topK: z.number().int().optional(),
128
+ minRelevanceScore: z.number().optional(),
129
+ });
130
+ const getPagesInput = z.object({
131
+ documentId: z.string(),
132
+ pages: z.array(z.number().int()).optional(),
133
+ });
134
+ const storePutInput = z.object({ value: z.unknown() });
135
+ const storeGetInput = z.object({ handle: z.string() });
136
+ const mapInput = z.object({
137
+ items: z.array(z.unknown()).or(z.string()),
138
+ instruction: z.string(),
139
+ maxSlices: z.number().int().optional(),
140
+ concurrency: z.number().int().optional(),
141
+ maxCharsPerSlice: z.number().int().optional(),
142
+ });
143
+ const askInput = z.object({
144
+ prompt: z.string(),
145
+ instruction: z.string().optional(),
146
+ });
147
+ const askManyInput = z.object({
148
+ tasks: z.array(z
149
+ .string()
150
+ .or(z.object({ prompt: z.string(), instruction: z.string().optional() }))),
151
+ instruction: z.string().optional(),
152
+ concurrency: z.number().int().optional(),
153
+ });
154
+ const researchResult = z.object({
155
+ hits: z.array(searchHit),
156
+ pages: z.array(documentPages),
157
+ });
158
+ // ── extension method inputs (bridged prod tools) ─────────────────────────────
159
+ const expandContextInput = z.object({
160
+ documentId: z.string(),
161
+ chunkIndex: z.number().int().optional(),
162
+ before: z.number().int().optional(),
163
+ after: z.number().int().optional(),
164
+ });
165
+ const readTocInput = z.object({ documentId: z.string() });
166
+ const readMediaInput = z.object({
167
+ documentId: z.string(),
168
+ operation: z
169
+ .enum(['readFull', 'searchTranscript', 'readTranscriptSpan'])
170
+ .optional(),
171
+ query: z.string().optional(),
172
+ startSecond: z.number().optional(),
173
+ endSecond: z.number().optional(),
174
+ });
175
+ const extractInput = z.object({
176
+ documentIds: z.array(z.string()),
177
+ instructions: z.string(),
178
+ fields: z.array(z.object({
179
+ name: z.string(),
180
+ type: z.enum(['string', 'number', 'boolean', 'string[]']),
181
+ description: z.string(),
182
+ optional: z.boolean().optional(),
183
+ })),
184
+ sortBy: z.string().optional(),
185
+ deduplicateBy: z.string().optional(),
186
+ });
187
+ const spreadsheetWhere = z.object({
188
+ column: z.string(),
189
+ op: z.enum([
190
+ 'eq',
191
+ 'neq',
192
+ 'contains',
193
+ 'gt',
194
+ 'gte',
195
+ 'lt',
196
+ 'lte',
197
+ 'empty',
198
+ 'notEmpty',
199
+ ]),
200
+ value: z.string().optional(),
201
+ });
202
+ const spreadsheetQueryInput = z.object({
203
+ documentId: z.string(),
204
+ sheet: z.string().optional(),
205
+ where: z.array(spreadsheetWhere).optional(),
206
+ groupBy: z.string().optional(),
207
+ aggregate: z
208
+ .array(z.object({
209
+ fn: z.enum(['count', 'sum', 'avg', 'min', 'max']),
210
+ column: z.string().optional(),
211
+ }))
212
+ .optional(),
213
+ select: z.array(z.string()).optional(),
214
+ orderBy: z
215
+ .object({ column: z.string(), dir: z.enum(['asc', 'desc']) })
216
+ .optional(),
217
+ limit: z.number().int().optional(),
218
+ });
219
+ const spreadsheetApplyEditsInput = z.object({
220
+ documentId: z.string(),
221
+ sheet: z.string().optional(),
222
+ edits: z.array(z.object({
223
+ op: z.enum([
224
+ 'setCells',
225
+ 'appendRows',
226
+ 'insertRows',
227
+ 'deleteRows',
228
+ 'setHeader',
229
+ ]),
230
+ cells: z
231
+ .array(z.object({ cell: z.string(), value: z.string() }))
232
+ .optional(),
233
+ rows: z.array(z.array(z.string())).optional(),
234
+ beforeRow: z.number().int().optional(),
235
+ startRow: z.number().int().optional(),
236
+ endRow: z.number().int().optional(),
237
+ columns: z.array(z.string()).optional(),
238
+ })),
239
+ });
240
+ const noteReadInput = z.object({
241
+ noteId: z.string(),
242
+ mode: z.enum(['read', 'search']).optional(),
243
+ startLine: z.number().int().optional(),
244
+ endLine: z.number().int().optional(),
245
+ search: z.string().optional(),
246
+ });
247
+ const noteEditInput = z.object({
248
+ noteId: z.string(),
249
+ operation: z.enum(['replace', 'insert', 'delete', 'replaceLines']),
250
+ content: z.string().optional(),
251
+ searchText: z.string().optional(),
252
+ replaceText: z.string().optional(),
253
+ startLine: z.number().int().optional(),
254
+ endLine: z.number().int().optional(),
255
+ });
256
+ const imageCreateInput = z.object({
257
+ prompt: z.string(),
258
+ useAttachedImages: z.boolean().optional(),
259
+ });
260
+ const workspaceQueryInput = z.object({
261
+ intent: z.string().optional(),
262
+ query: z.string().optional(),
263
+ parentFolderId: z.string().optional(),
264
+ documentIds: z.array(z.string()).optional(),
265
+ limit: z.number().int().optional(),
266
+ });
267
+ const chatsSearchInput = z.object({
268
+ query: z.string(),
269
+ dateFrom: z.string().optional(),
270
+ dateTo: z.string().optional(),
271
+ excerptLength: z.number().int().optional(),
272
+ offset: z.number().int().optional(),
273
+ limit: z.number().int().optional(),
274
+ });
275
+ export const ANARA_METHODS = {
276
+ 'entities.query': {
277
+ input: entitiesQueryInput,
278
+ output: z.array(entityEnvelope),
279
+ write: false,
280
+ summary: 'List library entities with simple filters.',
281
+ },
282
+ 'entities.get': {
283
+ input: entitiesGetInput,
284
+ output: entityEnvelope,
285
+ write: false,
286
+ summary: 'Fetch one entity, optionally with its body.',
287
+ },
288
+ 'entities.create': {
289
+ input: entitiesCreateInput,
290
+ output: entityEnvelope,
291
+ write: true,
292
+ summary: 'Create a NOTE, GROUP, or SPREADSHEET.',
293
+ },
294
+ 'entities.update': {
295
+ input: entitiesUpdateInput,
296
+ output: entityEnvelope,
297
+ write: true,
298
+ summary: 'Rename an entity.',
299
+ },
300
+ 'entities.move': {
301
+ input: entitiesMoveInput,
302
+ output: entityEnvelope,
303
+ write: true,
304
+ summary: 'Re-parent an entity into a folder (or to root).',
305
+ },
306
+ 'entities.delete': {
307
+ input: entitiesDeleteInput,
308
+ output: z.object({
309
+ softDeleted: z.array(z.string()),
310
+ skipped: z.array(z.string()),
311
+ wouldDelete: z.array(z.string()).optional(),
312
+ }),
313
+ write: true,
314
+ summary: 'Recoverable soft-delete of one or many entities.',
315
+ },
316
+ search: {
317
+ input: searchInput,
318
+ output: z.array(searchHit),
319
+ write: false,
320
+ summary: 'Tuned semantic library search; returns ranked, citable passages.',
321
+ },
322
+ research: {
323
+ input: researchInput,
324
+ output: researchResult.or(z.array(researchResult)),
325
+ write: false,
326
+ summary: 'Search + read the top winners’ pages in one parallel call.',
327
+ },
328
+ 'retrieval.vectorSearch': {
329
+ input: retrievalInput,
330
+ output: z.array(searchHit),
331
+ write: false,
332
+ summary: 'Raw semantic candidate recall (no rewrite/rerank).',
333
+ },
334
+ 'retrieval.keywordSearch': {
335
+ input: retrievalInput,
336
+ output: z.array(searchHit),
337
+ write: false,
338
+ summary: 'Raw keyword candidate recall.',
339
+ },
340
+ 'retrieval.rerank': {
341
+ input: rerankInput,
342
+ output: z.array(searchHit),
343
+ write: false,
344
+ summary: 'Score a candidate set and return the best with numeric scores.',
345
+ },
346
+ 'documents.getPages': {
347
+ input: getPagesInput,
348
+ output: documentPages,
349
+ write: false,
350
+ summary: 'Read whole pages from a document.',
351
+ },
352
+ 'store.put': {
353
+ input: storePutInput,
354
+ output: z.object({
355
+ handle: z.string(),
356
+ bytes: z.number(),
357
+ preview: z.string(),
358
+ }),
359
+ // Persists a durable artifact to object storage — a write, so it needs an
360
+ // anara:write key (not a read-scoped one).
361
+ write: true,
362
+ summary: 'Stash a big value out of context; get a short handle back.',
363
+ },
364
+ 'store.get': {
365
+ input: storeGetInput,
366
+ output: z.unknown(),
367
+ write: false,
368
+ summary: 'Re-read a stored value by handle.',
369
+ },
370
+ map: {
371
+ input: mapInput,
372
+ output: z.array(mapResult),
373
+ write: false,
374
+ summary: 'Map a cheap sub-LM over slices of a huge payload, in parallel.',
375
+ },
376
+ ask: {
377
+ input: askInput,
378
+ output: z.string(),
379
+ write: false,
380
+ summary: 'One cheap sub-LM call over some text.',
381
+ },
382
+ askMany: {
383
+ input: askManyInput,
384
+ output: z.array(mapResult),
385
+ write: false,
386
+ summary: 'Fire N independent asks in one call so they run in parallel.',
387
+ },
388
+ 'documents.expandContext': {
389
+ input: expandContextInput,
390
+ output: z.object({ passages: z.array(passage) }),
391
+ write: false,
392
+ summary: 'Widen the passages around a search hit.',
393
+ },
394
+ 'documents.readToc': {
395
+ input: readTocInput,
396
+ output: z.object({ toc: z.unknown() }),
397
+ write: false,
398
+ summary: "Read a document's table of contents.",
399
+ },
400
+ 'documents.readMedia': {
401
+ input: readMediaInput,
402
+ output: z.object({
403
+ passages: z.array(z.object({ passageId: z.string(), text: z.string() })),
404
+ }),
405
+ write: false,
406
+ summary: 'Read IMAGE/WEBSITE/VIDEO/AUDIO content (full / transcript).',
407
+ },
408
+ 'documents.extract': {
409
+ input: extractInput,
410
+ output: z.object({
411
+ items: z.array(z.record(z.string(), z.unknown())),
412
+ }),
413
+ write: false,
414
+ summary: 'Exhaustive structured extraction across documents.',
415
+ },
416
+ 'spreadsheets.query': {
417
+ input: spreadsheetQueryInput,
418
+ output: z.unknown(),
419
+ write: false,
420
+ summary: 'Read/aggregate a spreadsheet table.',
421
+ },
422
+ 'spreadsheets.applyEdits': {
423
+ input: spreadsheetApplyEditsInput,
424
+ output: z.unknown(),
425
+ write: true,
426
+ summary: 'Edit spreadsheet cells.',
427
+ },
428
+ 'notes.read': {
429
+ input: noteReadInput,
430
+ output: z.object({
431
+ success: z.boolean().optional(),
432
+ content: z.string().optional(),
433
+ message: z.string().optional(),
434
+ }),
435
+ write: false,
436
+ summary: 'Read a note body (read / by lines / search).',
437
+ },
438
+ 'notes.edit': {
439
+ input: noteEditInput,
440
+ output: z.object({ success: z.boolean() }),
441
+ write: true,
442
+ summary: 'Edit a note body.',
443
+ },
444
+ 'images.create': {
445
+ input: imageCreateInput,
446
+ output: z.object({ url: z.string() }),
447
+ write: true,
448
+ summary: 'Generate an image.',
449
+ },
450
+ 'workspace.queryDb': {
451
+ input: workspaceQueryInput,
452
+ output: z.unknown(),
453
+ write: false,
454
+ summary: 'Folder/file metadata + recency (no document text).',
455
+ },
456
+ 'chats.search': {
457
+ input: chatsSearchInput,
458
+ output: z.unknown(),
459
+ write: false,
460
+ summary: "Recall this workspace's earlier chat turns.",
461
+ },
462
+ };
463
+ export const WRITE_METHODS = new Set(Object.entries(ANARA_METHODS)
464
+ .filter(([, spec]) => spec.write)
465
+ .map(([name]) => name));
466
+ export function isAnaraMethod(name) {
467
+ return Object.prototype.hasOwnProperty.call(ANARA_METHODS, name);
468
+ }
469
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,iFAAiF;AACjF,qEAAqE;AACrE,+EAA+E;AAC/E,iFAAiF;AACjF,gFAAgF;AAChF,mCAAmC;AAEnC,MAAM,WAAW,GAAG,CAAC;KAClB,IAAI,CAAC;IACJ,MAAM;IACN,OAAO;IACP,aAAa;IACb,UAAU;IACV,SAAS;IACT,OAAO;IACP,OAAO;IACP,OAAO;CACR,CAAC;KACD,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;AAElB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAChD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;IACtB,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;IACtB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE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AE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;KAChC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CACzB,CAAC;AAEF,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;AACnE,CAAC"}
@@ -0,0 +1,56 @@
1
+ import type { z } from 'zod';
2
+ import type { ANARA_METHODS, entityEnvelope } from './schemas.js';
3
+ export interface AnaraClientOptions {
4
+ /** Falls back to the `ANARA_API_KEY` environment variable when omitted. */
5
+ apiKey?: string;
6
+ /** Defaults to `https://anara.com`. */
7
+ baseUrl?: string;
8
+ /** Override the `fetch` implementation (defaults to `globalThis.fetch`). */
9
+ fetch?: typeof fetch;
10
+ /** Extra headers merged into every request. */
11
+ headers?: Record<string, string>;
12
+ }
13
+ export interface AnaraUser {
14
+ id: string;
15
+ email?: string | null;
16
+ name?: string | null;
17
+ twoFactorEnabled?: boolean | null;
18
+ }
19
+ export interface AnaraMe {
20
+ user: AnaraUser;
21
+ activeOrganizationId: string | null;
22
+ }
23
+ type Input<M extends keyof typeof ANARA_METHODS> = z.infer<(typeof ANARA_METHODS)[M]['input']>;
24
+ type Output<M extends keyof typeof ANARA_METHODS> = z.infer<(typeof ANARA_METHODS)[M]['output']>;
25
+ export type EntityEnvelope = z.infer<typeof entityEnvelope>;
26
+ export type EntityQuery = Input<'entities.query'>;
27
+ export type CreateEntityInput = Input<'entities.create'>;
28
+ export type UpdateEntityPatch = Omit<Input<'entities.update'>, 'id'>;
29
+ export type DeleteEntitiesOptions = Omit<Input<'entities.delete'>, 'ids'>;
30
+ export type DeleteEntitiesResult = Output<'entities.delete'>;
31
+ export type GetEntityOptions = Omit<Input<'entities.get'>, 'id'>;
32
+ export type SearchInput = Input<'search'>;
33
+ export type SearchHit = Output<'search'>[number];
34
+ export type ResearchInput = Input<'research'>;
35
+ export type ResearchResult = Exclude<Output<'research'>, readonly unknown[]>;
36
+ export type RetrievalInput = Input<'retrieval.vectorSearch'>;
37
+ export type RerankInput = Input<'retrieval.rerank'>;
38
+ export type DocumentPages = Output<'documents.getPages'>;
39
+ export type Passage = DocumentPages['passages'][number];
40
+ export type StorePutResult = Output<'store.put'>;
41
+ export type MapOptions = Omit<Input<'map'>, 'items' | 'instruction'>;
42
+ export type MapResult = Output<'map'>[number];
43
+ export type AskTask = Input<'askMany'>['tasks'][number];
44
+ export type ExpandContextInput = Input<'documents.expandContext'>;
45
+ export type ReadTocInput = Input<'documents.readToc'>;
46
+ export type ReadMediaInput = Input<'documents.readMedia'>;
47
+ export type ExtractInput = Input<'documents.extract'>;
48
+ export type SpreadsheetQueryInput = Input<'spreadsheets.query'>;
49
+ export type SpreadsheetApplyEditsInput = Input<'spreadsheets.applyEdits'>;
50
+ export type NoteReadInput = Input<'notes.read'>;
51
+ export type NoteEditInput = Input<'notes.edit'>;
52
+ export type ImageCreateInput = Input<'images.create'>;
53
+ export type WorkspaceQueryInput = Input<'workspace.queryDb'>;
54
+ export type ChatsSearchInput = Input<'chats.search'>;
55
+ export {};
56
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAElE,MAAM,WAAW,kBAAkB;IACjC,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;A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AC,CAAC;AAC1E,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;AAChD,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;AAChD,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,eAAe,CAAC,CAAC;AACtD,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,mBAAmB,CAAC,CAAC;AAC7D,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@anaralabs/sdk",
3
+ "version": "0.1.0",
4
+ "description": "Official TypeScript SDK for the Anara public API — research, library search, documents, notes, and chat over your authenticated Anara workspace.",
5
+ "keywords": [
6
+ "agent",
7
+ "ai",
8
+ "anara",
9
+ "mcp",
10
+ "rag",
11
+ "research",
12
+ "sdk"
13
+ ],
14
+ "homepage": "https://anara.com",
15
+ "license": "MIT",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/anaralabs/anara.git",
19
+ "directory": "packages/anara-sdk"
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "README.md"
24
+ ],
25
+ "type": "module",
26
+ "sideEffects": false,
27
+ "main": "./dist/index.js",
28
+ "types": "./dist/index.d.ts",
29
+ "exports": {
30
+ ".": {
31
+ "types": "./dist/index.d.ts",
32
+ "import": "./dist/index.js"
33
+ }
34
+ },
35
+ "publishConfig": {
36
+ "access": "public"
37
+ },
38
+ "dependencies": {
39
+ "zod": "^4.3.6"
40
+ },
41
+ "devDependencies": {
42
+ "@types/node": "^24.1.0",
43
+ "@vitest/ui": "4.1.8",
44
+ "oxfmt": "^0.40.0",
45
+ "oxlint": "^1.55.0",
46
+ "typescript": "7.0.1-rc",
47
+ "vitest": "4.1.8",
48
+ "@unriddle/tsconfig": "0.1.0"
49
+ },
50
+ "engines": {
51
+ "node": ">=18"
52
+ },
53
+ "scripts": {
54
+ "build": "tsc -p tsconfig.build.json",
55
+ "clean": "git clean -xdf .cache .turbo dist node_modules",
56
+ "lint": "oxlint --config ../../.oxlintrc.json .",
57
+ "format": "oxfmt --config ../../.oxfmtrc.json --check .",
58
+ "format:fix": "oxfmt --config ../../.oxfmtrc.json .",
59
+ "typecheck": "tsc --noEmit",
60
+ "test": "vitest",
61
+ "test:run": "vitest run"
62
+ }
63
+ }