@anaralabs/sdk 0.2.0 → 0.4.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/README.md +16 -12
- package/dist/agent-guide.d.ts +1 -1
- package/dist/agent-guide.d.ts.map +1 -1
- package/dist/agent-guide.js +12 -9
- package/dist/agent-guide.js.map +1 -1
- package/dist/client.d.ts +57 -10
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +125 -19
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/openapi.d.ts.map +1 -1
- package/dist/openapi.js +7 -3
- package/dist/openapi.js.map +1 -1
- package/dist/schemas.d.ts +263 -141
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +283 -93
- package/dist/schemas.js.map +1 -1
- package/dist/types.d.ts +52 -9
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Official TypeScript SDK for the [Anara](https://anara.com) API. It mirrors
|
|
4
4
|
Anara's in-product code-agent SDK — the full `anara.*` surface (library search,
|
|
5
|
-
research, entities, documents, spreadsheets, notes, images
|
|
5
|
+
research, entities, documents, spreadsheets, notes, images) — as a
|
|
6
6
|
typed HTTP client. Give a coding agent (Claude Code, Codex, …) the same tools
|
|
7
7
|
the Anara agent has, over a single API key.
|
|
8
8
|
|
|
@@ -37,15 +37,22 @@ import { createAnaraClient } from '@anaralabs/sdk';
|
|
|
37
37
|
// `apiKey` defaults to the ANARA_API_KEY environment variable.
|
|
38
38
|
const anara = createAnaraClient();
|
|
39
39
|
|
|
40
|
-
// Retrieval —
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
query:
|
|
46
|
-
|
|
40
|
+
// Retrieval — compose it from the raw primitives: recall, rerank, read.
|
|
41
|
+
const candidates = await anara.retrieval.vectorSearch({
|
|
42
|
+
queries: ['wooden pallet recycling drop-off', 'where to recycle pallets'],
|
|
43
|
+
});
|
|
44
|
+
const winners = await anara.retrieval.rerank({
|
|
45
|
+
query: 'wooden pallet recycling drop-off',
|
|
46
|
+
candidates,
|
|
47
|
+
topK: 6,
|
|
47
48
|
});
|
|
48
49
|
|
|
50
|
+
// Read a winner's full page when snippets aren't enough.
|
|
51
|
+
const page = await anara.documents.getPages(
|
|
52
|
+
winners[0].documentId,
|
|
53
|
+
winners[0].pageNumber != null ? [winners[0].pageNumber] : undefined,
|
|
54
|
+
);
|
|
55
|
+
|
|
49
56
|
// Library entities (CRUD). Writes need an `anara:write` key.
|
|
50
57
|
const drafts = await anara.entities.query({
|
|
51
58
|
type: 'NOTE',
|
|
@@ -53,9 +60,6 @@ const drafts = await anara.entities.query({
|
|
|
53
60
|
});
|
|
54
61
|
const folder = await anara.entities.create({ type: 'GROUP', name: 'Drafts' });
|
|
55
62
|
for (const d of drafts) await anara.entities.move(d.id, folder.id);
|
|
56
|
-
|
|
57
|
-
// Fan a cheap sub-LM over big data (RLM).
|
|
58
|
-
const labels = await anara.map(reviews, 'Reply POSITIVE or NEGATIVE.');
|
|
59
63
|
```
|
|
60
64
|
|
|
61
65
|
## How it works
|
|
@@ -70,7 +74,7 @@ is no Anara logic in the package itself — just typed calls over your key.
|
|
|
70
74
|
`entities.query/get/create/update/move/delete` · `search` · `research` ·
|
|
71
75
|
`retrieval.vectorSearch/keywordSearch/rerank` ·
|
|
72
76
|
`documents.getPages/expandContext/readToc/readMedia/extract` ·
|
|
73
|
-
`store.put/get` ·
|
|
77
|
+
`store.put/get` ·
|
|
74
78
|
`spreadsheets.query/applyEdits` · `notes.read/edit` · `images.create` ·
|
|
75
79
|
`chats.search` · `workspace.queryDb` · `me`.
|
|
76
80
|
|
package/dist/agent-guide.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const ANARA_AGENT_GUIDE = "# Anara SDK \u2014 agent guide\n\nYou have an `anara` client (`@anaralabs/sdk`) authenticated to a research workspace.\nIt mirrors Anara's code-agent SDK: every call hits the Anara API over your key.\n\n## Retrieval (the common job)\n- `anara.
|
|
1
|
+
export declare const ANARA_AGENT_GUIDE = "# Anara SDK \u2014 agent guide\n\nYou have an `anara` client (`@anaralabs/sdk`) authenticated to a research workspace.\nIt mirrors Anara's code-agent SDK: every call hits the Anara API over your key.\n\n## Retrieval (the common job)\nCompose retrieval from the raw primitives \u2014 recall wide, rerank, read narrow:\n- `anara.retrieval.vectorSearch({ queries })` (semantic) and/or `anara.retrieval.keywordSearch({ queries })` (exact terms) to gather candidates. Pass several phrasings as `queries` \u2014 they run in parallel and come back merged + deduped.\n- `anara.retrieval.rerank({ query, candidates, topK })` to score the merged set against the original question; keep the few winners (filter on `.score`).\n- `anara.documents.getPages(documentId, [page])` to read the winners' full pages when snippets aren't enough.\n- Multi-part question? Fan out up to 6 sub-queries, rerank each, and read at most 5 winners' pages. STOP once you have a plausible answer \u2014 re-verifying is the #1 cost.\n\n## Library entities (CRUD)\n- `anara.entities.query({ type?, nameContains?, groupId?, limit?, scope? })`, `anara.entities.get(id, { withBody })`. `scope` defaults to `'organization'` (the targeted workspace only); pass `'accessible'` to also list your private items in other workspaces.\n- `anara.entities.create({ type: 'NOTE'|'GROUP'|'SPREADSHEET', ... })`, `update(id, { name })`, `move(id, groupId)`, `delete(ids, { dryRun })`.\n- Bulk delete? `delete(ids, { dryRun: true })` FIRST. Writes need an `anara:write` key.\n\n\n## Adding files\n- Local file? `anara.documents.uploadFile({ filename, bytes })` \u2014 presigns, PUTs straight to storage, finalizes. Not bound by the API request-body limit, so it handles real-world PDFs.\n- Already at a URL? `anara.documents.import({ url })` \u2014 the server fetches it, nothing to upload.\n- `documents.upload` (base64) still works but pushes the bytes through the API, so keep it for small files.\n\n## How to use it well\n- Prefer library retrieval (`anara.retrieval.*`) over scraping; gather, rerank, then read the winners.\n- One decisive call per step \u2014 round-trips are the cost.\n- Treat results as evidence to cite, not ground truth.\n";
|
|
2
2
|
//# sourceMappingURL=agent-guide.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-guide.d.ts","sourceRoot":"","sources":["../src/agent-guide.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"agent-guide.d.ts","sourceRoot":"","sources":["../src/agent-guide.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,2pEA2B7B,CAAC"}
|
package/dist/agent-guide.js
CHANGED
|
@@ -7,22 +7,25 @@ You have an \`anara\` client (\`@anaralabs/sdk\`) authenticated to a research wo
|
|
|
7
7
|
It mirrors Anara's code-agent SDK: every call hits the Anara API over your key.
|
|
8
8
|
|
|
9
9
|
## Retrieval (the common job)
|
|
10
|
-
|
|
11
|
-
- \`anara.
|
|
12
|
-
- \`anara.retrieval.
|
|
13
|
-
- \`anara.documents.getPages(documentId, [page])\` to read full pages.
|
|
10
|
+
Compose retrieval from the raw primitives — recall wide, rerank, read narrow:
|
|
11
|
+
- \`anara.retrieval.vectorSearch({ queries })\` (semantic) and/or \`anara.retrieval.keywordSearch({ queries })\` (exact terms) to gather candidates. Pass several phrasings as \`queries\` — they run in parallel and come back merged + deduped.
|
|
12
|
+
- \`anara.retrieval.rerank({ query, candidates, topK })\` to score the merged set against the original question; keep the few winners (filter on \`.score\`).
|
|
13
|
+
- \`anara.documents.getPages(documentId, [page])\` to read the winners' full pages when snippets aren't enough.
|
|
14
|
+
- Multi-part question? Fan out up to 6 sub-queries, rerank each, and read at most 5 winners' pages. STOP once you have a plausible answer — re-verifying is the #1 cost.
|
|
14
15
|
|
|
15
16
|
## Library entities (CRUD)
|
|
16
|
-
- \`anara.entities.query({ type?, nameContains?, groupId?, limit? })\`, \`anara.entities.get(id, { withBody })\`.
|
|
17
|
+
- \`anara.entities.query({ type?, nameContains?, groupId?, limit?, scope? })\`, \`anara.entities.get(id, { withBody })\`. \`scope\` defaults to \`'organization'\` (the targeted workspace only); pass \`'accessible'\` to also list your private items in other workspaces.
|
|
17
18
|
- \`anara.entities.create({ type: 'NOTE'|'GROUP'|'SPREADSHEET', ... })\`, \`update(id, { name })\`, \`move(id, groupId)\`, \`delete(ids, { dryRun })\`.
|
|
18
19
|
- Bulk delete? \`delete(ids, { dryRun: true })\` FIRST. Writes need an \`anara:write\` key.
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- \`anara.
|
|
21
|
+
|
|
22
|
+
## Adding files
|
|
23
|
+
- Local file? \`anara.documents.uploadFile({ filename, bytes })\` — presigns, PUTs straight to storage, finalizes. Not bound by the API request-body limit, so it handles real-world PDFs.
|
|
24
|
+
- Already at a URL? \`anara.documents.import({ url })\` — the server fetches it, nothing to upload.
|
|
25
|
+
- \`documents.upload\` (base64) still works but pushes the bytes through the API, so keep it for small files.
|
|
23
26
|
|
|
24
27
|
## How to use it well
|
|
25
|
-
- Prefer \`anara.
|
|
28
|
+
- Prefer library retrieval (\`anara.retrieval.*\`) over scraping; gather, rerank, then read the winners.
|
|
26
29
|
- One decisive call per step — round-trips are the cost.
|
|
27
30
|
- Treat results as evidence to cite, not ground truth.
|
|
28
31
|
`;
|
package/dist/agent-guide.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-guide.js","sourceRoot":"","sources":["../src/agent-guide.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,8EAA8E;AAC9E,+BAA+B;AAC/B,MAAM,CAAC,MAAM,iBAAiB,GAAG
|
|
1
|
+
{"version":3,"file":"agent-guide.js","sourceRoot":"","sources":["../src/agent-guide.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,8EAA8E;AAC9E,+BAA+B;AAC/B,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BhC,CAAC"}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AnaraClientOptions, AnaraMe,
|
|
1
|
+
import type { AnaraClientOptions, AnaraMe, ChatsSearchInput, CreateEntityInput, DeleteEntitiesOptions, DeleteEntitiesResult, DocumentBatchOptions, DocumentImportAllResult, DocumentImportInput, DocumentImportResult, DocumentPages, DocumentUploadAllResult, DocumentCreateUploadInput, DocumentCreateUploadResult, DocumentUploadInput, DocumentUploadResult, EntityEnvelope, EntityQuery, ExpandContextInput, ExtractInput, GetEntityOptions, ImageCreateInput, NoteEditInput, NoteReadInput, Organization, Passage, ReadMediaInput, ReadTocInput, RerankInput, RetrievalInput, SandboxAttachFilesInput, SandboxAttachFilesResult, SandboxCreateInput, SandboxCreateResult, SandboxEditFileInput, SandboxEditFileResult, SandboxFetchDocumentInput, SandboxFetchDocumentResult, SandboxListDirInput, SandboxListDirResult, SandboxReadFileInput, SandboxReadFileResult, SandboxRunShellInput, SandboxRunShellResult, SandboxStopInput, SandboxStopResult, SandboxWriteFileInput, SandboxWriteFileResult, SearchHit, SpreadsheetApplyEditsInput, SpreadsheetExportInput, SpreadsheetExportOutput, SpreadsheetQueryInput, UpdateEntityPatch, WorkspaceQueryInput } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Typed client for the Anara API. Mirrors the in-product `anara.*` SDK: every
|
|
4
4
|
* method is a `POST /api/v1/sdk/{method}` call whose JSON body is the method's
|
|
@@ -7,7 +7,7 @@ import type { AnaraClientOptions, AnaraMe, AskTask, ChatsSearchInput, CreateEnti
|
|
|
7
7
|
* ```ts
|
|
8
8
|
* const anara = createAnaraClient();
|
|
9
9
|
* const notes = await anara.entities.query({ type: 'NOTE', limit: 50 });
|
|
10
|
-
* const hits = await anara.
|
|
10
|
+
* const hits = await anara.retrieval.vectorSearch({ query: 'wooden pallet recycling' });
|
|
11
11
|
* ```
|
|
12
12
|
*/
|
|
13
13
|
export declare class AnaraClient {
|
|
@@ -27,8 +27,6 @@ export declare class AnaraClient {
|
|
|
27
27
|
move: (id: string, groupId: string | null) => Promise<EntityEnvelope>;
|
|
28
28
|
delete: (ids: string | string[], options?: DeleteEntitiesOptions) => Promise<DeleteEntitiesResult>;
|
|
29
29
|
};
|
|
30
|
-
search(input: SearchInput): Promise<SearchHit[]>;
|
|
31
|
-
research(input: ResearchInput): Promise<ResearchResult | ResearchResult[]>;
|
|
32
30
|
readonly retrieval: {
|
|
33
31
|
vectorSearch: (input: RetrievalInput) => Promise<SearchHit[]>;
|
|
34
32
|
keywordSearch: (input: RetrievalInput) => Promise<SearchHit[]>;
|
|
@@ -51,9 +49,49 @@ export declare class AnaraClient {
|
|
|
51
49
|
extract: (input: ExtractInput) => Promise<{
|
|
52
50
|
items: Array<Record<string, unknown>>;
|
|
53
51
|
}>;
|
|
52
|
+
/** Ingest a remote URL (PDF or web page) into the library. */
|
|
53
|
+
import: (input: DocumentImportInput) => Promise<DocumentImportResult>;
|
|
54
|
+
/** Ingest raw file bytes (base64 PDF) into the library. */
|
|
55
|
+
upload: (input: DocumentUploadInput) => Promise<DocumentUploadResult>;
|
|
56
|
+
/** Start a direct-to-S3 upload. Prefer `uploadFile`, which also sends the bytes. */
|
|
57
|
+
createUpload: (input: DocumentCreateUploadInput) => Promise<DocumentCreateUploadResult>;
|
|
58
|
+
/**
|
|
59
|
+
* Upload a local file: presign, then PUT the bytes straight to storage. The
|
|
60
|
+
* bytes never pass through the Anara API, so this is not bound by its
|
|
61
|
+
* request-body limit the way `upload` is. Ingestion starts on its own — the
|
|
62
|
+
* object-create event drives it, exactly as it does for a browser upload.
|
|
63
|
+
*/
|
|
64
|
+
uploadFile: (input: {
|
|
65
|
+
filename: string;
|
|
66
|
+
bytes: Uint8Array | ArrayBuffer;
|
|
67
|
+
folderId?: string;
|
|
68
|
+
}) => Promise<DocumentUploadResult>;
|
|
69
|
+
/**
|
|
70
|
+
* Upload a whole folder's worth of files in one call. The caller enumerates
|
|
71
|
+
* the directory (the SDK never touches the filesystem) and passes the read
|
|
72
|
+
* files; uploads fan out with bounded concurrency and settle per-item, so one
|
|
73
|
+
* bad file is reported in its result instead of failing the batch.
|
|
74
|
+
*
|
|
75
|
+
* In Node, build `files` by reading the directory with `node:fs` —
|
|
76
|
+
* `readdirSync(dir)`, keep the `.pdf` entries, map each to
|
|
77
|
+
* `{ filename, contentBase64: readFileSync(path).toString('base64') }` — then:
|
|
78
|
+
*
|
|
79
|
+
* ```ts
|
|
80
|
+
* const results = await anara.documents.uploadAll(files, { folderId });
|
|
81
|
+
* const failed = results.filter((r) => !r.ok);
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
uploadAll: (files: DocumentUploadInput[], options?: DocumentBatchOptions & {
|
|
85
|
+
folderId?: string;
|
|
86
|
+
}) => Promise<DocumentUploadAllResult[]>;
|
|
87
|
+
/** Import many remote URLs into the library in one call (see uploadAll). */
|
|
88
|
+
importAll: (items: DocumentImportInput[], options?: DocumentBatchOptions & {
|
|
89
|
+
folderId?: string;
|
|
90
|
+
}) => Promise<DocumentImportAllResult[]>;
|
|
54
91
|
};
|
|
55
92
|
readonly spreadsheets: {
|
|
56
93
|
query: (input: SpreadsheetQueryInput) => Promise<unknown>;
|
|
94
|
+
export: (input: SpreadsheetExportInput) => Promise<SpreadsheetExportOutput>;
|
|
57
95
|
applyEdits: (input: SpreadsheetApplyEditsInput) => Promise<unknown>;
|
|
58
96
|
};
|
|
59
97
|
readonly notes: {
|
|
@@ -81,13 +119,22 @@ export declare class AnaraClient {
|
|
|
81
119
|
/** Workspaces this key can target via `forOrganization` / `organizationId`. */
|
|
82
120
|
list: () => Promise<Organization[]>;
|
|
83
121
|
};
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
122
|
+
/**
|
|
123
|
+
* The Daytona code sandbox — a code-interpreter over your library. Requires an
|
|
124
|
+
* API key minted with the opt-in `sandbox` scope. Keyed per `sandboxId`; the
|
|
125
|
+
* server isolates it to your user + workspace.
|
|
126
|
+
*/
|
|
127
|
+
readonly sandbox: {
|
|
128
|
+
create: (input: SandboxCreateInput) => Promise<SandboxCreateResult>;
|
|
129
|
+
runShell: (input: SandboxRunShellInput) => Promise<SandboxRunShellResult>;
|
|
130
|
+
writeFile: (input: SandboxWriteFileInput) => Promise<SandboxWriteFileResult>;
|
|
131
|
+
editFile: (input: SandboxEditFileInput) => Promise<SandboxEditFileResult>;
|
|
132
|
+
readFile: (input: SandboxReadFileInput) => Promise<SandboxReadFileResult>;
|
|
133
|
+
listDir: (input: SandboxListDirInput) => Promise<SandboxListDirResult>;
|
|
134
|
+
attachFiles: (input: SandboxAttachFilesInput) => Promise<SandboxAttachFilesResult>;
|
|
135
|
+
fetchDocument: (input: SandboxFetchDocumentInput) => Promise<SandboxFetchDocumentResult>;
|
|
136
|
+
stop: (input: SandboxStopInput) => Promise<SandboxStopResult>;
|
|
87
137
|
};
|
|
88
|
-
map(items: unknown[] | string, instruction: string, options?: MapOptions): Promise<MapResult[]>;
|
|
89
|
-
ask(prompt: string, instruction?: string): Promise<string>;
|
|
90
|
-
askMany(tasks: AskTask[], instruction?: string): Promise<MapResult[]>;
|
|
91
138
|
}
|
|
92
139
|
export declare function createAnaraClient(options?: AnaraClientOptions): AnaraClient;
|
|
93
140
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,kBAAkB,EAClB,OAAO,EACP,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,kBAAkB,EAClB,OAAO,EACP,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,EACb,uBAAuB,EACvB,yBAAyB,EACzB,0BAA0B,EAC1B,mBAA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,MAAM,UAAU,gBAAgB,KAAG,OAAO,CAAC,OAAO,CAAC;MAEnD;IAEF,QAAQ,CAAC,aAAa;QACpB,+EAA+E;QAC/E,IAAI,QAAM,OAAO,CAAC,YAAY,EAAE,CAAC;MACjC;IAEF;;;;OAIG;IACH,QAAQ,CAAC,OAAO;QACd,MAAM,UAAU,kBAAkB,KAAG,OAAO,CAAC,mBAAmB,CAAC;QAEjE,QAAQ,UAAU,oBAAoB,KAAG,OAAO,CAAC,qBAAqB,CAAC;QAEvE,SAAS,UACA,qBAAqB,KAC3B,OAAO,CAAC,sBAAsB,CAAC;QAElC,QAAQ,UAAU,oBAAoB,KAAG,OAAO,CAAC,qBAAqB,CAAC;QAEvE,QAAQ,UAAU,oBAAoB,KAAG,OAAO,CAAC,qBAAqB,CAAC;QAEvE,OAAO,UAAU,mBAAmB,KAAG,OAAO,CAAC,oBAAoB,CAAC;QAEpE,WAAW,UACF,uBAAuB,KAC7B,OAAO,CAAC,wBAAwB,CAAC;QAEpC,aAAa,UACJ,yBAAyB,KAC/B,OAAO,CAAC,0BAA0B,CAAC;QAEtC,IAAI,UAAU,gBAAgB,KAAG,OAAO,CAAC,iBAAiB,CAAC;MAE3D;CACH;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,GAAE,kBAAuB,GAC/B,WAAW,CAEb"}
|
package/dist/client.js
CHANGED
|
@@ -12,6 +12,25 @@ function compact(body) {
|
|
|
12
12
|
}
|
|
13
13
|
return body;
|
|
14
14
|
}
|
|
15
|
+
function errorMessage(error) {
|
|
16
|
+
return error instanceof Error ? error.message : String(error);
|
|
17
|
+
}
|
|
18
|
+
// Runs `fn` over `items` with at most `concurrency` in flight, preserving input
|
|
19
|
+
// order. `fn` settles each item itself, so the batch never rejects on one failure.
|
|
20
|
+
async function mapSettled(items, concurrency, fn) {
|
|
21
|
+
const results = [];
|
|
22
|
+
// Guard a bad concurrency (NaN from `Number(unsetEnv)`, 0, negative, fractional):
|
|
23
|
+
// `Array.from({ length: NaN })` would spawn zero workers and silently return [].
|
|
24
|
+
const width = Math.max(1, Math.min(Math.floor(concurrency) || 1, items.length || 1));
|
|
25
|
+
let cursor = 0;
|
|
26
|
+
const worker = async () => {
|
|
27
|
+
for (let i = cursor++; i < items.length; i = cursor++) {
|
|
28
|
+
results[i] = await fn(items[i], i);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
await Promise.all(Array.from({ length: width }, () => worker()));
|
|
32
|
+
return results;
|
|
33
|
+
}
|
|
15
34
|
/**
|
|
16
35
|
* Typed client for the Anara API. Mirrors the in-product `anara.*` SDK: every
|
|
17
36
|
* method is a `POST /api/v1/sdk/{method}` call whose JSON body is the method's
|
|
@@ -20,7 +39,7 @@ function compact(body) {
|
|
|
20
39
|
* ```ts
|
|
21
40
|
* const anara = createAnaraClient();
|
|
22
41
|
* const notes = await anara.entities.query({ type: 'NOTE', limit: 50 });
|
|
23
|
-
* const hits = await anara.
|
|
42
|
+
* const hits = await anara.retrieval.vectorSearch({ query: 'wooden pallet recycling' });
|
|
24
43
|
* ```
|
|
25
44
|
*/
|
|
26
45
|
export class AnaraClient {
|
|
@@ -68,12 +87,6 @@ export class AnaraClient {
|
|
|
68
87
|
move: (id, groupId) => this.invoke('entities.move', { id, groupId }),
|
|
69
88
|
delete: (ids, options) => this.invoke('entities.delete', compact({ ids, ...options })),
|
|
70
89
|
};
|
|
71
|
-
search(input) {
|
|
72
|
-
return this.invoke('search', { ...input });
|
|
73
|
-
}
|
|
74
|
-
research(input) {
|
|
75
|
-
return this.invoke('research', { ...input });
|
|
76
|
-
}
|
|
77
90
|
retrieval = {
|
|
78
91
|
vectorSearch: (input) => this.invoke('retrieval.vectorSearch', { ...input }),
|
|
79
92
|
keywordSearch: (input) => this.invoke('retrieval.keywordSearch', { ...input }),
|
|
@@ -85,9 +98,99 @@ export class AnaraClient {
|
|
|
85
98
|
readToc: (input) => this.invoke('documents.readToc', { ...input }),
|
|
86
99
|
readMedia: (input) => this.invoke('documents.readMedia', { ...input }),
|
|
87
100
|
extract: (input) => this.invoke('documents.extract', { ...input }),
|
|
101
|
+
/** Ingest a remote URL (PDF or web page) into the library. */
|
|
102
|
+
import: (input) => this.invoke('documents.import', compact({ ...input })),
|
|
103
|
+
/** Ingest raw file bytes (base64 PDF) into the library. */
|
|
104
|
+
upload: (input) => this.invoke('documents.upload', compact({ ...input })),
|
|
105
|
+
/** Start a direct-to-S3 upload. Prefer `uploadFile`, which also sends the bytes. */
|
|
106
|
+
createUpload: (input) => this.invoke('documents.createUpload', compact({ ...input })),
|
|
107
|
+
/**
|
|
108
|
+
* Upload a local file: presign, then PUT the bytes straight to storage. The
|
|
109
|
+
* bytes never pass through the Anara API, so this is not bound by its
|
|
110
|
+
* request-body limit the way `upload` is. Ingestion starts on its own — the
|
|
111
|
+
* object-create event drives it, exactly as it does for a browser upload.
|
|
112
|
+
*/
|
|
113
|
+
uploadFile: async (input) => {
|
|
114
|
+
const body = input.bytes instanceof Uint8Array
|
|
115
|
+
? input.bytes
|
|
116
|
+
: new Uint8Array(input.bytes);
|
|
117
|
+
const started = await this.documents.createUpload(compact({
|
|
118
|
+
filename: input.filename,
|
|
119
|
+
contentLength: body.byteLength,
|
|
120
|
+
folderId: input.folderId,
|
|
121
|
+
}));
|
|
122
|
+
// Mirrors the browser upload: the accelerate edge blips, so retry it before
|
|
123
|
+
// falling back to the direct endpoint rather than failing the whole upload.
|
|
124
|
+
const endpoints = [started.uploadUrl, started.fallbackUrl].filter((u) => Boolean(u));
|
|
125
|
+
let lastError = '';
|
|
126
|
+
for (const endpoint of endpoints) {
|
|
127
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
128
|
+
const put = await fetch(endpoint, {
|
|
129
|
+
method: 'PUT',
|
|
130
|
+
// Content-Type only — the signed metadata rides in the URL itself.
|
|
131
|
+
headers: started.headers,
|
|
132
|
+
body: body,
|
|
133
|
+
}).catch((error) => error);
|
|
134
|
+
if (put instanceof Error) {
|
|
135
|
+
lastError = put.message;
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
if (put.ok)
|
|
139
|
+
return { documentId: started.documentId };
|
|
140
|
+
lastError = `${put.status} ${(await put.text()).slice(0, 200)}`;
|
|
141
|
+
// Stop retrying a 4xx on THIS endpoint, but still let the fallback try:
|
|
142
|
+
// accelerate may be the only one rejecting (it 400s when acceleration is
|
|
143
|
+
// disabled for the bucket, where the regional endpoint succeeds).
|
|
144
|
+
if (put.status < 500 && put.status !== 429 && put.status !== 408)
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
throw new Error(`Upload failed: ${lastError}`);
|
|
149
|
+
},
|
|
150
|
+
/**
|
|
151
|
+
* Upload a whole folder's worth of files in one call. The caller enumerates
|
|
152
|
+
* the directory (the SDK never touches the filesystem) and passes the read
|
|
153
|
+
* files; uploads fan out with bounded concurrency and settle per-item, so one
|
|
154
|
+
* bad file is reported in its result instead of failing the batch.
|
|
155
|
+
*
|
|
156
|
+
* In Node, build `files` by reading the directory with `node:fs` —
|
|
157
|
+
* `readdirSync(dir)`, keep the `.pdf` entries, map each to
|
|
158
|
+
* `{ filename, contentBase64: readFileSync(path).toString('base64') }` — then:
|
|
159
|
+
*
|
|
160
|
+
* ```ts
|
|
161
|
+
* const results = await anara.documents.uploadAll(files, { folderId });
|
|
162
|
+
* const failed = results.filter((r) => !r.ok);
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
uploadAll: (files, options) => mapSettled(files, options?.concurrency ?? 4, async (file) => {
|
|
166
|
+
const folderId = file.folderId ?? options?.folderId;
|
|
167
|
+
try {
|
|
168
|
+
const { documentId } = await this.documents.upload(compact({ ...file, folderId }));
|
|
169
|
+
return { ok: true, filename: file.filename, documentId };
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
return {
|
|
173
|
+
ok: false,
|
|
174
|
+
filename: file.filename,
|
|
175
|
+
error: errorMessage(error),
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
}),
|
|
179
|
+
/** Import many remote URLs into the library in one call (see uploadAll). */
|
|
180
|
+
importAll: (items, options) => mapSettled(items, options?.concurrency ?? 4, async (item) => {
|
|
181
|
+
const folderId = item.folderId ?? options?.folderId;
|
|
182
|
+
try {
|
|
183
|
+
const { documentId } = await this.documents.import(compact({ ...item, folderId }));
|
|
184
|
+
return { ok: true, url: item.url, documentId };
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
return { ok: false, url: item.url, error: errorMessage(error) };
|
|
188
|
+
}
|
|
189
|
+
}),
|
|
88
190
|
};
|
|
89
191
|
spreadsheets = {
|
|
90
192
|
query: (input) => this.invoke('spreadsheets.query', { ...input }),
|
|
193
|
+
export: (input) => this.invoke('spreadsheets.export', { ...input }),
|
|
91
194
|
applyEdits: (input) => this.invoke('spreadsheets.applyEdits', { ...input }),
|
|
92
195
|
};
|
|
93
196
|
notes = {
|
|
@@ -107,19 +210,22 @@ export class AnaraClient {
|
|
|
107
210
|
/** Workspaces this key can target via `forOrganization` / `organizationId`. */
|
|
108
211
|
list: () => this.invoke('organizations.list', {}),
|
|
109
212
|
};
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
213
|
+
/**
|
|
214
|
+
* The Daytona code sandbox — a code-interpreter over your library. Requires an
|
|
215
|
+
* API key minted with the opt-in `sandbox` scope. Keyed per `sandboxId`; the
|
|
216
|
+
* server isolates it to your user + workspace.
|
|
217
|
+
*/
|
|
218
|
+
sandbox = {
|
|
219
|
+
create: (input) => this.invoke('sandbox.create', compact({ ...input })),
|
|
220
|
+
runShell: (input) => this.invoke('sandbox.runShell', compact({ ...input })),
|
|
221
|
+
writeFile: (input) => this.invoke('sandbox.writeFile', compact({ ...input })),
|
|
222
|
+
editFile: (input) => this.invoke('sandbox.editFile', { ...input }),
|
|
223
|
+
readFile: (input) => this.invoke('sandbox.readFile', compact({ ...input })),
|
|
224
|
+
listDir: (input) => this.invoke('sandbox.listDir', compact({ ...input })),
|
|
225
|
+
attachFiles: (input) => this.invoke('sandbox.attachFiles', { ...input }),
|
|
226
|
+
fetchDocument: (input) => this.invoke('sandbox.fetchDocument', compact({ ...input })),
|
|
227
|
+
stop: (input) => this.invoke('sandbox.stop', { ...input }),
|
|
113
228
|
};
|
|
114
|
-
map(items, instruction, options) {
|
|
115
|
-
return this.invoke('map', compact({ items, instruction, ...options }));
|
|
116
|
-
}
|
|
117
|
-
ask(prompt, instruction) {
|
|
118
|
-
return this.invoke('ask', compact({ prompt, instruction }));
|
|
119
|
-
}
|
|
120
|
-
askMany(tasks, instruction) {
|
|
121
|
-
return this.invoke('askMany', compact({ tasks, instruction }));
|
|
122
|
-
}
|
|
123
229
|
}
|
|
124
230
|
export function createAnaraClient(options = {}) {
|
|
125
231
|
return new AnaraClient(options);
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAmB,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAmB,MAAM,WAAW,CAAC;AA2D3E,MAAM,gBAAgB,GAAG,mBAAmB,CAAC;AAE7C,SAAS,SAAS;IAChB,MAAM,GAAG,GACP,UACD,CAAC,OAAO,EAAE,GAAG,CAAC;IACf,OAAO,GAAG,EAAE,aAAa,CAAC;AAC5B,CAAC;AAED,SAAS,OAAO,CAAoC,IAAO;IACzD,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACpC,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,SAAS;YAAE,OAAO,IAAI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AO,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;QACxD,OAAO,EAAE,CAAC,KAA0B,EAAiC,EAAE,CACrE,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,OAAO,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;QACvD,WAAW,EAAE,CACX,KAA8B,EACK,EAAE,CACrC,IAAI,CAAC,MAAM,CAAC,qBAAqB,EAAE,EAAE,GAAG,KAAK,EAAE,CAAC;QAClD,aAAa,EAAE,CACb,KAAgC,EACK,EAAE,CACvC,IAAI,CAAC,MAAM,CAAC,uBAAuB,EAAE,OAAO,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;QAC7D,IAAI,EAAE,CAAC,KAAuB,EAA8B,EAAE,CAC5D,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,EAAE,GAAG,KAAK,EAAE,CAAC;KAC5C,CAAC;CACH;AAED,MAAM,UAAU,iBAAiB,CAC/B,OAAO,GAAuB,EAAE;IAEhC,OAAO,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { AnaraClient, createAnaraClient } from './client.js';
|
|
2
2
|
export { AnaraError, AnaraApiError, isAnaraError, isAnaraApiError, type AnaraErrorCode, } from './errors.js';
|
|
3
3
|
export { ANARA_AGENT_GUIDE } from './agent-guide.js';
|
|
4
|
-
export { ANARA_METHODS, WRITE_METHODS, isAnaraMethod, entityEnvelope, organizationSummary, type AnaraMethodName, type MethodSpec, } from './schemas.js';
|
|
4
|
+
export { ANARA_METHODS, WRITE_METHODS, SANDBOX_METHODS, scopeForMethod, scopesForMethod, isAnaraMethod, entityEnvelope, organizationSummary, type AnaraMethodName, type MethodSpec, } from './schemas.js';
|
|
5
5
|
export { buildOpenApiDocument, type OpenApiOptions } from './openapi.js';
|
|
6
|
-
export type { AnaraClientOptions, AnaraUser, AnaraMe, Organization, EntityEnvelope, EntityQuery, GetEntityOptions, CreateEntityInput, UpdateEntityPatch, DeleteEntitiesOptions, DeleteEntitiesResult,
|
|
6
|
+
export type { AnaraClientOptions, AnaraUser, AnaraMe, Organization, EntityEnvelope, EntityQuery, GetEntityOptions, CreateEntityInput, UpdateEntityPatch, DeleteEntitiesOptions, DeleteEntitiesResult, SearchHit, Passage, DocumentPages, RetrievalInput, RerankInput, ExpandContextInput, ReadTocInput, ReadMediaInput, ExtractInput, DocumentImportInput, DocumentImportResult, DocumentUploadInput, DocumentUploadResult, DocumentBatchOptions, DocumentUploadAllResult, DocumentImportAllResult, SpreadsheetQueryInput, SpreadsheetExportInput, SpreadsheetExportOutput, SpreadsheetApplyEditsInput, NoteReadInput, NoteEditInput, ImageCreateInput, WorkspaceQueryInput, ChatsSearchInput, SandboxCreateInput, SandboxCreateResult, SandboxRunShellInput, SandboxRunShellResult, SandboxFile, SandboxWriteFileInput, SandboxWriteFileResult, SandboxEditFileInput, SandboxEditFileResult, SandboxReadFileInput, SandboxReadFileResult, SandboxListDirInput, SandboxListDirResult, SandboxAttachFilesInput, SandboxAttachFilesResult, SandboxFetchDocumentInput, SandboxFetchDocumentResult, SandboxStopInput, SandboxStopResult, } from './types.js';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EACL,UAAU,EACV,aAAa,EACb,YAAY,EACZ,eAAe,EACf,KAAK,cAAc,GACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EACL,aAAa,EACb,aAAa,EACb,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,KAAK,eAAe,EACpB,KAAK,UAAU,GAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,oBAAoB,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AACzE,YAAY,EACV,kBAAkB,EAClB,SAAS,EACT,OAAO,EACP,YAAY,EACZ,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EACL,UAAU,EACV,aAAa,EACb,YAAY,EACZ,eAAe,EACf,KAAK,cAAc,GACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EACL,aAAa,EACb,aAAa,EACb,eAAe,EACf,cAAc,EACd,eAAe,EACf,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,KAAK,eAAe,EACpB,KAAK,UAAU,GAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,oBAAoB,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AACzE,YAAY,EACV,kBAAkB,EAClB,SAAS,EACT,OAAO,EACP,YAAY,EACZ,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,SAAS,EACT,OAAO,EACP,aAAa,EACb,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,0BAA0B,EAC1B,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,WAAW,EACX,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,0BAA0B,EAC1B,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { AnaraClient, createAnaraClient } from './client.js';
|
|
2
2
|
export { AnaraError, AnaraApiError, isAnaraError, isAnaraApiError, } from './errors.js';
|
|
3
3
|
export { ANARA_AGENT_GUIDE } from './agent-guide.js';
|
|
4
|
-
export { ANARA_METHODS, WRITE_METHODS, isAnaraMethod, entityEnvelope, organizationSummary, } from './schemas.js';
|
|
4
|
+
export { ANARA_METHODS, WRITE_METHODS, SANDBOX_METHODS, scopeForMethod, scopesForMethod, isAnaraMethod, entityEnvelope, organizationSummary, } from './schemas.js';
|
|
5
5
|
export { buildOpenApiDocument } from './openapi.js';
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EACL,UAAU,EACV,aAAa,EACb,YAAY,EACZ,eAAe,GAEhB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EACL,aAAa,EACb,aAAa,EACb,aAAa,EACb,cAAc,EACd,mBAAmB,GAGpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,oBAAoB,EAAuB,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EACL,UAAU,EACV,aAAa,EACb,YAAY,EACZ,eAAe,GAEhB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EACL,aAAa,EACb,aAAa,EACb,eAAe,EACf,cAAc,EACd,eAAe,EACf,aAAa,EACb,cAAc,EACd,mBAAmB,GAGpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,oBAAoB,EAAuB,MAAM,cAAc,CAAC"}
|
package/dist/openapi.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../src/openapi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../src/openapi.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAMD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,cAAmB;;;QAkD3D,KAAK;QACL,OAAO;QACP,WAAW;;;;;;QAKX,eAAe;YACb,UAAU;gBAAI,IAAI;gBAAY,EAAE;gBAAY,IAAI;;;QAElD,UAAU;YACR,cAAc;gBACZ,IAAI;gBACJ,EAAE;gBACF,QAAQ;gBACR,WAAW;gBAEX,MAAM;oBAAI,IAAI;;;;;;;;;EAOvB"}
|
package/dist/openapi.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ANARA_METHODS } from './schemas.js';
|
|
2
|
+
import { ANARA_METHODS, scopeForMethod, scopesForMethod, } from './schemas.js';
|
|
3
3
|
function jsonSchema(schema) {
|
|
4
4
|
return z.toJSONSchema(schema, { target: 'draft-2020-12', io: 'input' });
|
|
5
5
|
}
|
|
@@ -17,7 +17,11 @@ export function buildOpenApiDocument(options = {}) {
|
|
|
17
17
|
post: {
|
|
18
18
|
operationId: name.replace(/\./g, '_'),
|
|
19
19
|
summary: spec.summary,
|
|
20
|
-
|
|
20
|
+
// Primary scope plus EVERY scope the caller must also hold (AND), so a
|
|
21
|
+
// method like sandbox.fetchDocument that needs both `anara:sandbox` and
|
|
22
|
+
// `anara:read` advertises the full requirement in the contract.
|
|
23
|
+
'x-anara-scope': scopeForMethod(name),
|
|
24
|
+
'x-anara-scopes': scopesForMethod(name),
|
|
21
25
|
security: [{ ApiKeyAuth: [] }],
|
|
22
26
|
// Discovery is cross-workspace; it ignores the targeting header server-side.
|
|
23
27
|
...(name === 'organizations.list'
|
|
@@ -56,7 +60,7 @@ export function buildOpenApiDocument(options = {}) {
|
|
|
56
60
|
info: {
|
|
57
61
|
title: options.title ?? 'Anara API',
|
|
58
62
|
version: options.version ?? '0.2.0',
|
|
59
|
-
description: 'The anara.* SDK surface — library
|
|
63
|
+
description: 'The anara.* SDK surface — library retrieval, entities, and documents — over an API key.',
|
|
60
64
|
},
|
|
61
65
|
...(options.serverUrl ? { servers: [{ url: options.serverUrl }] } : {}),
|
|
62
66
|
components: {
|
package/dist/openapi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi.js","sourceRoot":"","sources":["../src/openapi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"openapi.js","sourceRoot":"","sources":["../src/openapi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,aAAa,EACb,cAAc,EACd,eAAe,G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