@proveanything/smartlinks 2.0.28 → 2.0.30
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/ai-tools.d.ts +2 -0
- package/dist/ai-tools.js +7 -1
- package/dist/api/collection.d.ts +32 -1
- package/dist/api/collection.js +50 -0
- package/dist/docs/API_SUMMARY.md +89 -3
- package/dist/docs/ai.md +29 -4
- package/dist/docs/server-functions.md +6 -0
- package/dist/openapi.yaml +168 -0
- package/dist/types/ai.d.ts +59 -1
- package/dist/types/collection.d.ts +30 -0
- package/docs/API_SUMMARY.md +89 -3
- package/docs/ai.md +29 -4
- package/docs/server-functions.md +6 -0
- package/openapi.yaml +168 -0
- package/package.json +1 -1
package/dist/ai-tools.d.ts
CHANGED
|
@@ -29,6 +29,8 @@ export declare const AI_TOOL_NAMES: {
|
|
|
29
29
|
readonly PDF_INSPECT: "pdf.inspect";
|
|
30
30
|
readonly PDF_RENDER: "pdf.render";
|
|
31
31
|
readonly PDF_EXTRACT: "pdf.extract";
|
|
32
|
+
readonly PDF_DECODE_BARCODES: "pdf.decodeBarcodes";
|
|
33
|
+
readonly PDF_INSPECT_GRAPHICS: "pdf.inspectGraphics";
|
|
32
34
|
readonly HTTP_REQUEST: "http.request";
|
|
33
35
|
readonly TRANSLATE: "translate";
|
|
34
36
|
};
|
package/dist/ai-tools.js
CHANGED
|
@@ -26,6 +26,8 @@ export const AI_TOOL_NAMES = {
|
|
|
26
26
|
PDF_INSPECT: 'pdf.inspect',
|
|
27
27
|
PDF_RENDER: 'pdf.render',
|
|
28
28
|
PDF_EXTRACT: 'pdf.extract',
|
|
29
|
+
PDF_DECODE_BARCODES: 'pdf.decodeBarcodes',
|
|
30
|
+
PDF_INSPECT_GRAPHICS: 'pdf.inspectGraphics',
|
|
29
31
|
HTTP_REQUEST: 'http.request',
|
|
30
32
|
TRANSLATE: 'translate',
|
|
31
33
|
};
|
|
@@ -66,7 +68,11 @@ export const BUILTIN_AI_TOOLS = [
|
|
|
66
68
|
{ name: 'pdf.render', group: 'media', capabilities: ['web:read'],
|
|
67
69
|
description: 'Rasterize a single PDF page to a PNG at a controllable DPI (e.g. 300 for small print) and return a hosted image URL — feed to a vision call or screenshot a page.' },
|
|
68
70
|
{ name: 'pdf.extract', group: 'media', capabilities: ['web:read', 'ai:vision'],
|
|
69
|
-
description: 'Extract typed JSON from a PDF in one call given a schema and/or prompt. Auto-routes: text-layer pages use cheap text extraction; curve-only/raster pages are rendered and read with vision.' },
|
|
71
|
+
description: 'Extract typed JSON from a PDF in one call given a schema and/or prompt. Auto-routes: text-layer pages use cheap text extraction; curve-only/raster pages are rendered and read with vision. Optional per-field confidence/source (includeConfidence) and bounding boxes (includeBoxes).' },
|
|
72
|
+
{ name: 'pdf.decodeBarcodes', group: 'media', capabilities: ['web:read'],
|
|
73
|
+
description: 'Deterministically decode 1D/2D barcodes (EAN/UPC/QR/Code128/DataMatrix/…) on a PDF page by rasterizing and running a WASM decoder — reliable barcode/QR values where vision hallucinates. Returns value, symbology, page, bbox, confidence. No AI.' },
|
|
74
|
+
{ name: 'pdf.inspectGraphics', group: 'media', capabilities: ['web:read'],
|
|
75
|
+
description: 'Prepress structural inspection: per-page vector-path/image/outlined-text counts + colour spaces used, plus document-level named SPOT colours (e.g. "PANTONE 871 C"). Answers whether spot/foil plates survived. Deterministic, no AI.' },
|
|
70
76
|
{ name: 'http.request', group: 'net', capabilities: ['net:http'],
|
|
71
77
|
description: 'SSRF-guarded outbound HTTP(S) request to a public URL; returns status/headers/body.' },
|
|
72
78
|
{ name: 'translate', group: 'text', capabilities: ['ai:text'],
|
package/dist/api/collection.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CollectionResponse, CollectionCreateRequest, CollectionUpdateRequest, AppsConfigResponse, DomainTarget, HubAvailabilityResponse } from "../types/collection.js";
|
|
1
|
+
import { CollectionResponse, CollectionCreateRequest, CollectionUpdateRequest, AppsConfigResponse, DomainTarget, HubAvailabilityResponse, CollectionUser, CollectionAccessLevel, InviteUserInput } from "../types/collection.js";
|
|
2
2
|
export declare namespace collection {
|
|
3
3
|
/**
|
|
4
4
|
* Retrieves a single Collection by its ID.
|
|
@@ -170,4 +170,35 @@ export declare namespace collection {
|
|
|
170
170
|
* @throws ErrorResponse if the request fails
|
|
171
171
|
*/
|
|
172
172
|
function assignSN(collectionId: string, codeId: string, value: any): Promise<any>;
|
|
173
|
+
/**
|
|
174
|
+
* List the users with access to a collection, each with their access level (admin only). Access is
|
|
175
|
+
* stored in the collection's `roles` map (userId → level); this resolves each to name/email.
|
|
176
|
+
* GET /admin/collection/:collectionId/getUsers
|
|
177
|
+
* @param collectionId - Identifier of the collection
|
|
178
|
+
* @returns Promise resolving to the collection's users
|
|
179
|
+
*/
|
|
180
|
+
function getUsers(collectionId: string): Promise<CollectionUser[]>;
|
|
181
|
+
/**
|
|
182
|
+
* Grant, change, or remove a user's access level on a collection (admin only). Pass `null` or
|
|
183
|
+
* `'None'` to remove access. The server enforces privilege-escalation rules — you cannot grant an
|
|
184
|
+
* access level above your own, nor change a user whose level is above yours.
|
|
185
|
+
* POST /admin/collection/:collectionId/updateUserAccess
|
|
186
|
+
* @param collectionId - Identifier of the collection
|
|
187
|
+
* @param userId - The user (auth uid) whose access to change
|
|
188
|
+
* @param access - The new access level, or `null` to remove access
|
|
189
|
+
*/
|
|
190
|
+
function setUserAccess(collectionId: string, userId: string, access: CollectionAccessLevel | null): Promise<void>;
|
|
191
|
+
/**
|
|
192
|
+
* Invite a user to a collection by email (admin only). Creates or links their account in the login /
|
|
193
|
+
* auth-kit collection (`loginCollectionId`, default `'global'`) and emails them an invite (new account)
|
|
194
|
+
* or an added-to-collection notice (existing account); returns their `uid`. This does NOT grant access
|
|
195
|
+
* on its own — follow with {@link setUserAccess} to set their level (this mirrors the console flow).
|
|
196
|
+
* POST /user/inviteUser
|
|
197
|
+
* @param collectionId - The collection the user is being added to (the invite's target)
|
|
198
|
+
* @param input - Invite details (email, optional name, access level, login collection, origin)
|
|
199
|
+
* @returns Promise resolving to the invited user's `{ uid }`
|
|
200
|
+
*/
|
|
201
|
+
function inviteUser(collectionId: string, input: InviteUserInput): Promise<{
|
|
202
|
+
uid: string;
|
|
203
|
+
}>;
|
|
173
204
|
}
|
package/dist/api/collection.js
CHANGED
|
@@ -253,4 +253,54 @@ export var collection;
|
|
|
253
253
|
return post(path, { value });
|
|
254
254
|
}
|
|
255
255
|
collection.assignSN = assignSN;
|
|
256
|
+
/**
|
|
257
|
+
* List the users with access to a collection, each with their access level (admin only). Access is
|
|
258
|
+
* stored in the collection's `roles` map (userId → level); this resolves each to name/email.
|
|
259
|
+
* GET /admin/collection/:collectionId/getUsers
|
|
260
|
+
* @param collectionId - Identifier of the collection
|
|
261
|
+
* @returns Promise resolving to the collection's users
|
|
262
|
+
*/
|
|
263
|
+
async function getUsers(collectionId) {
|
|
264
|
+
return request(`/admin/collection/${encodeURIComponent(collectionId)}/getUsers`);
|
|
265
|
+
}
|
|
266
|
+
collection.getUsers = getUsers;
|
|
267
|
+
/**
|
|
268
|
+
* Grant, change, or remove a user's access level on a collection (admin only). Pass `null` or
|
|
269
|
+
* `'None'` to remove access. The server enforces privilege-escalation rules — you cannot grant an
|
|
270
|
+
* access level above your own, nor change a user whose level is above yours.
|
|
271
|
+
* POST /admin/collection/:collectionId/updateUserAccess
|
|
272
|
+
* @param collectionId - Identifier of the collection
|
|
273
|
+
* @param userId - The user (auth uid) whose access to change
|
|
274
|
+
* @param access - The new access level, or `null` to remove access
|
|
275
|
+
*/
|
|
276
|
+
async function setUserAccess(collectionId, userId, access) {
|
|
277
|
+
await post(`/admin/collection/${encodeURIComponent(collectionId)}/updateUserAccess`, {
|
|
278
|
+
userId,
|
|
279
|
+
access: access !== null && access !== void 0 ? access : 'None'
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
collection.setUserAccess = setUserAccess;
|
|
283
|
+
/**
|
|
284
|
+
* Invite a user to a collection by email (admin only). Creates or links their account in the login /
|
|
285
|
+
* auth-kit collection (`loginCollectionId`, default `'global'`) and emails them an invite (new account)
|
|
286
|
+
* or an added-to-collection notice (existing account); returns their `uid`. This does NOT grant access
|
|
287
|
+
* on its own — follow with {@link setUserAccess} to set their level (this mirrors the console flow).
|
|
288
|
+
* POST /user/inviteUser
|
|
289
|
+
* @param collectionId - The collection the user is being added to (the invite's target)
|
|
290
|
+
* @param input - Invite details (email, optional name, access level, login collection, origin)
|
|
291
|
+
* @returns Promise resolving to the invited user's `{ uid }`
|
|
292
|
+
*/
|
|
293
|
+
async function inviteUser(collectionId, input) {
|
|
294
|
+
var _a, _b;
|
|
295
|
+
const consoleOrigin = (_a = input.consoleOrigin) !== null && _a !== void 0 ? _a : (typeof window !== 'undefined' ? window.location.origin : undefined);
|
|
296
|
+
return post(`/user/inviteUser`, {
|
|
297
|
+
email: input.email.trim(),
|
|
298
|
+
name: input.name,
|
|
299
|
+
collectionId: (_b = input.loginCollectionId) !== null && _b !== void 0 ? _b : 'global',
|
|
300
|
+
targetCollectionId: collectionId,
|
|
301
|
+
accessLevel: input.access,
|
|
302
|
+
consoleOrigin
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
collection.inviteUser = inviteUser;
|
|
256
306
|
})(collection || (collection = {}));
|
package/dist/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.30 | Generated: 2026-09-29T17:13:26.956Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -1485,7 +1485,21 @@ interface PdfRenderArgs {
|
|
|
1485
1485
|
**PdfExtractArgs** (interface)
|
|
1486
1486
|
```typescript
|
|
1487
1487
|
interface PdfExtractArgs {
|
|
1488
|
-
url: string; schema?: Record<string, any>; prompt?: string; maxPages?: number; dpi?: number
|
|
1488
|
+
url: string; schema?: Record<string, any>; prompt?: string; maxPages?: number; dpi?: number; includeConfidence?: boolean; includeBoxes?: boolean
|
|
1489
|
+
}
|
|
1490
|
+
```
|
|
1491
|
+
|
|
1492
|
+
**PdfDecodeBarcodesArgs** (interface)
|
|
1493
|
+
```typescript
|
|
1494
|
+
interface PdfDecodeBarcodesArgs {
|
|
1495
|
+
url: string; page?: number; dpi?: number
|
|
1496
|
+
}
|
|
1497
|
+
```
|
|
1498
|
+
|
|
1499
|
+
**PdfInspectGraphicsArgs** (interface)
|
|
1500
|
+
```typescript
|
|
1501
|
+
interface PdfInspectGraphicsArgs {
|
|
1502
|
+
url: string; page?: number
|
|
1489
1503
|
}
|
|
1490
1504
|
```
|
|
1491
1505
|
|
|
@@ -1524,6 +1538,8 @@ interface AiToolArgsMap {
|
|
|
1524
1538
|
'pdf.inspect': PdfInspectArgs
|
|
1525
1539
|
'pdf.render': PdfRenderArgs
|
|
1526
1540
|
'pdf.extract': PdfExtractArgs
|
|
1541
|
+
'pdf.decodeBarcodes': PdfDecodeBarcodesArgs
|
|
1542
|
+
'pdf.inspectGraphics': PdfInspectGraphicsArgs
|
|
1527
1543
|
'http.request': HttpRequestArgs
|
|
1528
1544
|
'translate': TranslateArgs
|
|
1529
1545
|
}
|
|
@@ -1613,10 +1629,45 @@ interface PdfRenderResult {
|
|
|
1613
1629
|
}
|
|
1614
1630
|
```
|
|
1615
1631
|
|
|
1632
|
+
**PdfFieldMeta** (interface)
|
|
1633
|
+
```typescript
|
|
1634
|
+
interface PdfFieldMeta {
|
|
1635
|
+
confidence?: number | null; source?: 'text' | 'vision' | 'inferred'; bbox?: { x: number; y: number; w: number; h: number; page: number }
|
|
1636
|
+
}
|
|
1637
|
+
```
|
|
1638
|
+
|
|
1616
1639
|
**PdfExtractResult** (interface)
|
|
1617
1640
|
```typescript
|
|
1618
1641
|
interface PdfExtractResult {
|
|
1619
|
-
url: string; method: 'text' | 'vision'; pagesRead: number; fields: Record<string, any>
|
|
1642
|
+
url: string; method: 'text' | 'vision'; pagesRead: number; fields: Record<string, any>; fieldsMeta?: Record<string, PdfFieldMeta>
|
|
1643
|
+
}
|
|
1644
|
+
```
|
|
1645
|
+
|
|
1646
|
+
**PdfBarcode** (interface)
|
|
1647
|
+
```typescript
|
|
1648
|
+
interface PdfBarcode {
|
|
1649
|
+
type: string; format: string; value: string; page: number; bbox?: { x: number; y: number; w: number; h: number }; confidence: number
|
|
1650
|
+
}
|
|
1651
|
+
```
|
|
1652
|
+
|
|
1653
|
+
**PdfDecodeBarcodesResult** (interface)
|
|
1654
|
+
```typescript
|
|
1655
|
+
interface PdfDecodeBarcodesResult {
|
|
1656
|
+
url: string; pagesScanned: number; codes: PdfBarcode[]
|
|
1657
|
+
}
|
|
1658
|
+
```
|
|
1659
|
+
|
|
1660
|
+
**PdfGraphicsPage** (interface)
|
|
1661
|
+
```typescript
|
|
1662
|
+
interface PdfGraphicsPage {
|
|
1663
|
+
page: number; paths: number; images: number; textRuns: number; colourSpaces: string[]
|
|
1664
|
+
}
|
|
1665
|
+
```
|
|
1666
|
+
|
|
1667
|
+
**PdfInspectGraphicsResult** (interface)
|
|
1668
|
+
```typescript
|
|
1669
|
+
interface PdfInspectGraphicsResult {
|
|
1670
|
+
url: string; pages: PdfGraphicsPage[]; spotColours: string[]; note: string
|
|
1620
1671
|
}
|
|
1621
1672
|
```
|
|
1622
1673
|
|
|
@@ -4660,6 +4711,27 @@ interface AppConfig {
|
|
|
4660
4711
|
}
|
|
4661
4712
|
```
|
|
4662
4713
|
|
|
4714
|
+
**CollectionUser** (interface)
|
|
4715
|
+
```typescript
|
|
4716
|
+
interface CollectionUser {
|
|
4717
|
+
uid: string
|
|
4718
|
+
access: CollectionAccessLevel | string
|
|
4719
|
+
name?: string
|
|
4720
|
+
email?: string
|
|
4721
|
+
}
|
|
4722
|
+
```
|
|
4723
|
+
|
|
4724
|
+
**InviteUserInput** (interface)
|
|
4725
|
+
```typescript
|
|
4726
|
+
interface InviteUserInput {
|
|
4727
|
+
email: string
|
|
4728
|
+
name?: string
|
|
4729
|
+
access: CollectionAccessLevel | string
|
|
4730
|
+
loginCollectionId?: string
|
|
4731
|
+
consoleOrigin?: string
|
|
4732
|
+
}
|
|
4733
|
+
```
|
|
4734
|
+
|
|
4663
4735
|
**CollectionResponse** = `Collection`
|
|
4664
4736
|
|
|
4665
4737
|
**CollectionCreateRequest** = `Omit<Collection, 'id' | 'shortId'>`
|
|
@@ -4668,6 +4740,8 @@ interface AppConfig {
|
|
|
4668
4740
|
|
|
4669
4741
|
**DomainTarget** = `"smartlinks" | "hub"`
|
|
4670
4742
|
|
|
4743
|
+
**CollectionAccessLevel** = `'Owner' | 'Admin' | 'Assigner' | 'Reporter' | 'User' | 'None'`
|
|
4744
|
+
|
|
4671
4745
|
### common
|
|
4672
4746
|
|
|
4673
4747
|
**IdField** = `'userId' | 'contactId'`
|
|
@@ -10382,6 +10456,18 @@ Look up a serial number by code for a collection (admin only).
|
|
|
10382
10456
|
value: any) → `Promise<any>`
|
|
10383
10457
|
Assign a value to a serial number for a collection (admin only).
|
|
10384
10458
|
|
|
10459
|
+
**getUsers**(collectionId: string) → `Promise<CollectionUser[]>`
|
|
10460
|
+
List the users with access to a collection, each with their access level (admin only). Access is stored in the collection's `roles` map (userId → level); this resolves each to name/email. GET /admin/collection/:collectionId/getUsers
|
|
10461
|
+
|
|
10462
|
+
**setUserAccess**(collectionId: string,
|
|
10463
|
+
userId: string,
|
|
10464
|
+
access: CollectionAccessLevel | null) → `Promise<void>`
|
|
10465
|
+
Grant, change, or remove a user's access level on a collection (admin only). Pass `null` or `'None'` to remove access. The server enforces privilege-escalation rules — you cannot grant an access level above your own, nor change a user whose level is above yours. POST /admin/collection/:collectionId/updateUserAccess
|
|
10466
|
+
|
|
10467
|
+
**inviteUser**(collectionId: string,
|
|
10468
|
+
input: InviteUserInput) → `Promise<`
|
|
10469
|
+
Invite a user to a collection by email (admin only). Creates or links their account in the login / auth-kit collection (`loginCollectionId`, default `'global'`) and emails them an invite (new account) or an added-to-collection notice (existing account); returns their `uid`. This does NOT grant access on its own — follow with {@link setUserAccess} to set their level (this mirrors the console flow). POST /user/inviteUser
|
|
10470
|
+
|
|
10385
10471
|
### comms
|
|
10386
10472
|
|
|
10387
10473
|
**getPushVapidPublicKey**(collectionId: string) → `Promise<import("../types/comms").PushVapidResponse>`
|
package/dist/docs/ai.md
CHANGED
|
@@ -324,15 +324,40 @@ in `input`.
|
|
|
324
324
|
| `image.searchStock` | Search real stock photos (Unsplash). |
|
|
325
325
|
| `image.transform` | Resize / crop / rotate / grayscale / format-convert / compress → hosted URL. |
|
|
326
326
|
| `pdf.create` | Render HTML → PDF → hosted URL. |
|
|
327
|
-
| `pdf.fill` | Fill an AcroForm PDF's fields → hosted URL. |
|
|
328
|
-
| `pdf.merge` | Merge several PDFs into one → hosted URL. |
|
|
327
|
+
| `pdf.fill` | Fill an AcroForm PDF's fields (`{ field: value }`) → hosted URL. |
|
|
328
|
+
| `pdf.merge` | Merge several PDFs into one, in order → hosted URL. |
|
|
329
|
+
| `pdf.inspect` | Cheap, no-AI introspection: page count/sizes, which pages have a real text layer, raster present, and a routing hint (`text` vs `vision`). |
|
|
330
|
+
| `pdf.render` | Rasterize one page to a PNG at a chosen DPI → hosted image URL (feed to vision, or screenshot a page). |
|
|
331
|
+
| `pdf.extract` | PDF → typed JSON in one call (schema and/or prompt). Auto-routes text vs vision. Optional per-field `confidence`/`source` (`includeConfidence`) and `bbox` (`includeBoxes`) in `fieldsMeta`. |
|
|
332
|
+
| `pdf.decodeBarcodes` | Deterministically decode barcodes/QR on a page (WASM, no AI) → value + symbology + page + bbox + confidence. Use this for barcode digits, never vision. |
|
|
333
|
+
| `pdf.inspectGraphics` | Prepress inspection: per-page path/image/outlined-text counts + colour spaces, plus named SPOT colours (e.g. "PANTONE 871 C"). No AI. |
|
|
329
334
|
| `http.request` | SSRF-guarded outbound HTTP(S) to a public URL (call a REST API). |
|
|
330
335
|
| `translate` | Translate text into one or more languages (generic, model-based). |
|
|
331
336
|
|
|
337
|
+
**Working with PDFs.** The PDF tools split into *read/analyse* and *produce*:
|
|
338
|
+
|
|
339
|
+
- **Read a whole PDF as text** → `document.read` (Firecrawl; good for prose/decks).
|
|
340
|
+
- **Turn a PDF into structured fields** → `pdf.extract` (give it a JSON schema and/or a prompt; it
|
|
341
|
+
returns typed JSON). It routes itself, but you can drive the route yourself: call `pdf.inspect`
|
|
342
|
+
first (deterministic, no AI) to see whether each page has a real text layer, then `pdf.extract`
|
|
343
|
+
(cheap text path) or `pdf.render` → `image.describe`/vision for curve-only or raster artwork.
|
|
344
|
+
- **Zoom in on small print** (INCI/allergen lists) → `pdf.render` at a high DPI (e.g. 300), then read
|
|
345
|
+
the PNG with vision.
|
|
346
|
+
- **Barcodes / QR** → `pdf.decodeBarcodes` (deterministic WASM decode) — never trust vision for barcode
|
|
347
|
+
digits; it hallucinates them.
|
|
348
|
+
- **Prepress / print QA** (spot colours, colour spaces, vector vs raster) → `pdf.inspectGraphics`.
|
|
349
|
+
- **A review UI that flags guessed fields** → `pdf.extract` with `includeConfidence` (per-field
|
|
350
|
+
confidence + source) and `includeBoxes` (per-field bbox on text-native pages) in `fieldsMeta`.
|
|
351
|
+
- **Produce a PDF** → `pdf.create` (HTML → PDF), `pdf.fill` (populate an AcroForm's fields),
|
|
352
|
+
`pdf.merge` (combine several). These return a hosted `hostedUrl`.
|
|
353
|
+
|
|
354
|
+
Every tool is also directly callable without the model loop via `ai.tools.run(collectionId, name,
|
|
355
|
+
args)` — e.g. render a page or extract fields straight from a UI, no agent round-trip.
|
|
356
|
+
|
|
332
357
|
Discover tools two ways:
|
|
333
358
|
- **Design time (typed):** import `BUILTIN_AI_TOOLS`, `AI_TOOL_NAMES`, and the per-tool arg types
|
|
334
|
-
(`WebSearchArgs`, `DataExtractArgs`, …) from the SDK. This is the core set —
|
|
335
|
-
documented here.
|
|
359
|
+
(`WebSearchArgs`, `DataExtractArgs`, `PdfExtractArgs`, …) from the SDK. This is the core set —
|
|
360
|
+
stable, versioned, documented here.
|
|
336
361
|
- **Runtime (live):** `await ai.catalog(collectionId)` returns the registry as the server sees it,
|
|
337
362
|
including any future app-contributed tools. The built-in set above is always present.
|
|
338
363
|
|
|
@@ -400,6 +400,12 @@ Prefer the platform primitives above over a dependency; when you do need one, pi
|
|
|
400
400
|
| Schema validation of inputs | no | `zod` |
|
|
401
401
|
| JWT (sign/verify for a third-party API) | Web Crypto can, verbosely | `jose` |
|
|
402
402
|
| Hash / HMAC / encrypt | **native** — `crypto.subtle` | — |
|
|
403
|
+
| PDF **text** extraction (cheap first-pass, no AI) | no | `unpdf` — a serverless/WASM pdf.js build with no Node deps; `import { extractText } from 'unpdf'`. Text only. |
|
|
404
|
+
|
|
405
|
+
> **PDFs in a server function:** for a cheap text-layer check use `unpdf` (edge-safe, WASM). For
|
|
406
|
+
> anything heavier — rendering pages, vision extraction, **barcode/QR decode**, or prepress/spot-colour
|
|
407
|
+
> inspection — call the platform tools `pdf.render` / `pdf.extract` / `pdf.decodeBarcodes` /
|
|
408
|
+
> `pdf.inspectGraphics` via `ai.tools.run`; those run in the full platform runtime, not the sandbox.
|
|
403
409
|
|
|
404
410
|
**The common actions, and how to do each:**
|
|
405
411
|
|
package/dist/openapi.yaml
CHANGED
|
@@ -4334,6 +4334,35 @@ paths:
|
|
|
4334
4334
|
description: Unauthorized
|
|
4335
4335
|
404:
|
|
4336
4336
|
description: Not found
|
|
4337
|
+
/admin/collection/{collectionId}/getUsers:
|
|
4338
|
+
get:
|
|
4339
|
+
tags:
|
|
4340
|
+
- collection
|
|
4341
|
+
summary: List the users with access to a collection, each with their access level (admin only).
|
|
4342
|
+
operationId: collection_getUsers
|
|
4343
|
+
security:
|
|
4344
|
+
- bearerAuth: []
|
|
4345
|
+
parameters:
|
|
4346
|
+
- name: collectionId
|
|
4347
|
+
in: path
|
|
4348
|
+
required: true
|
|
4349
|
+
schema:
|
|
4350
|
+
type: string
|
|
4351
|
+
responses:
|
|
4352
|
+
200:
|
|
4353
|
+
description: Success
|
|
4354
|
+
content:
|
|
4355
|
+
application/json:
|
|
4356
|
+
schema:
|
|
4357
|
+
type: array
|
|
4358
|
+
items:
|
|
4359
|
+
$ref: "#/components/schemas/CollectionUser"
|
|
4360
|
+
400:
|
|
4361
|
+
description: Bad request
|
|
4362
|
+
401:
|
|
4363
|
+
description: Unauthorized
|
|
4364
|
+
404:
|
|
4365
|
+
description: Not found
|
|
4337
4366
|
/admin/collection/{collectionId}/hub:
|
|
4338
4367
|
post:
|
|
4339
4368
|
tags:
|
|
@@ -8694,6 +8723,38 @@ paths:
|
|
|
8694
8723
|
application/json:
|
|
8695
8724
|
schema:
|
|
8696
8725
|
$ref: "#/components/schemas/TranslationUpdateRequest"
|
|
8726
|
+
/admin/collection/{collectionId}/updateUserAccess:
|
|
8727
|
+
post:
|
|
8728
|
+
tags:
|
|
8729
|
+
- collection
|
|
8730
|
+
summary: "Grant, change, or remove a user's access level on a collection (admin only)."
|
|
8731
|
+
operationId: collection_setUserAccess
|
|
8732
|
+
security:
|
|
8733
|
+
- bearerAuth: []
|
|
8734
|
+
parameters:
|
|
8735
|
+
- name: collectionId
|
|
8736
|
+
in: path
|
|
8737
|
+
required: true
|
|
8738
|
+
schema:
|
|
8739
|
+
type: string
|
|
8740
|
+
responses:
|
|
8741
|
+
200:
|
|
8742
|
+
description: Success
|
|
8743
|
+
content:
|
|
8744
|
+
application/json:
|
|
8745
|
+
schema: {}
|
|
8746
|
+
400:
|
|
8747
|
+
description: Bad request
|
|
8748
|
+
401:
|
|
8749
|
+
description: Unauthorized
|
|
8750
|
+
404:
|
|
8751
|
+
description: Not found
|
|
8752
|
+
requestBody:
|
|
8753
|
+
required: true
|
|
8754
|
+
content:
|
|
8755
|
+
application/json:
|
|
8756
|
+
schema:
|
|
8757
|
+
$ref: "#/components/schemas/CollectionAccessLevel"
|
|
8697
8758
|
/admin/collection/{encodedCollectionId}/comm/send:
|
|
8698
8759
|
post:
|
|
8699
8760
|
tags:
|
|
@@ -17064,6 +17125,22 @@ components:
|
|
|
17064
17125
|
additionalProperties: true
|
|
17065
17126
|
required:
|
|
17066
17127
|
- url
|
|
17128
|
+
PdfDecodeBarcodesArgs:
|
|
17129
|
+
type: object
|
|
17130
|
+
properties:
|
|
17131
|
+
url:
|
|
17132
|
+
type: object
|
|
17133
|
+
additionalProperties: true
|
|
17134
|
+
required:
|
|
17135
|
+
- url
|
|
17136
|
+
PdfInspectGraphicsArgs:
|
|
17137
|
+
type: object
|
|
17138
|
+
properties:
|
|
17139
|
+
url:
|
|
17140
|
+
type: object
|
|
17141
|
+
additionalProperties: true
|
|
17142
|
+
required:
|
|
17143
|
+
- url
|
|
17067
17144
|
HttpRequestArgs:
|
|
17068
17145
|
type: object
|
|
17069
17146
|
properties:
|
|
@@ -17125,6 +17202,10 @@ components:
|
|
|
17125
17202
|
$ref: "#/components/schemas/PdfRenderArgs"
|
|
17126
17203
|
pdf.extract:
|
|
17127
17204
|
$ref: "#/components/schemas/PdfExtractArgs"
|
|
17205
|
+
pdf.decodeBarcodes:
|
|
17206
|
+
$ref: "#/components/schemas/PdfDecodeBarcodesArgs"
|
|
17207
|
+
pdf.inspectGraphics:
|
|
17208
|
+
$ref: "#/components/schemas/PdfInspectGraphicsArgs"
|
|
17128
17209
|
http.request:
|
|
17129
17210
|
$ref: "#/components/schemas/HttpRequestArgs"
|
|
17130
17211
|
translate:
|
|
@@ -17148,6 +17229,8 @@ components:
|
|
|
17148
17229
|
- pdf.inspect
|
|
17149
17230
|
- pdf.render
|
|
17150
17231
|
- pdf.extract
|
|
17232
|
+
- pdf.decodeBarcodes
|
|
17233
|
+
- pdf.inspectGraphics
|
|
17151
17234
|
- http.request
|
|
17152
17235
|
- translate
|
|
17153
17236
|
WebSearchResultItem:
|
|
@@ -17256,6 +17339,12 @@ components:
|
|
|
17256
17339
|
additionalProperties: true
|
|
17257
17340
|
required:
|
|
17258
17341
|
- url
|
|
17342
|
+
PdfFieldMeta:
|
|
17343
|
+
type: object
|
|
17344
|
+
properties:
|
|
17345
|
+
confidence:
|
|
17346
|
+
type: object
|
|
17347
|
+
additionalProperties: true
|
|
17259
17348
|
PdfExtractResult:
|
|
17260
17349
|
type: object
|
|
17261
17350
|
properties:
|
|
@@ -17266,6 +17355,42 @@ components:
|
|
|
17266
17355
|
- vision
|
|
17267
17356
|
required:
|
|
17268
17357
|
- url
|
|
17358
|
+
PdfBarcode:
|
|
17359
|
+
type: object
|
|
17360
|
+
properties:
|
|
17361
|
+
type:
|
|
17362
|
+
type: object
|
|
17363
|
+
additionalProperties: true
|
|
17364
|
+
required:
|
|
17365
|
+
- type
|
|
17366
|
+
PdfDecodeBarcodesResult:
|
|
17367
|
+
type: object
|
|
17368
|
+
properties:
|
|
17369
|
+
url:
|
|
17370
|
+
type: array
|
|
17371
|
+
items:
|
|
17372
|
+
type: object
|
|
17373
|
+
additionalProperties: true
|
|
17374
|
+
required:
|
|
17375
|
+
- url
|
|
17376
|
+
PdfGraphicsPage:
|
|
17377
|
+
type: object
|
|
17378
|
+
properties:
|
|
17379
|
+
page:
|
|
17380
|
+
type: array
|
|
17381
|
+
items:
|
|
17382
|
+
type: object
|
|
17383
|
+
additionalProperties: true
|
|
17384
|
+
required:
|
|
17385
|
+
- page
|
|
17386
|
+
PdfInspectGraphicsResult:
|
|
17387
|
+
type: object
|
|
17388
|
+
properties:
|
|
17389
|
+
url:
|
|
17390
|
+
type: object
|
|
17391
|
+
additionalProperties: true
|
|
17392
|
+
required:
|
|
17393
|
+
- url
|
|
17269
17394
|
ResponsesAgentTrace:
|
|
17270
17395
|
type: object
|
|
17271
17396
|
properties:
|
|
@@ -17347,6 +17472,8 @@ components:
|
|
|
17347
17472
|
- pdf.inspect
|
|
17348
17473
|
- pdf.render
|
|
17349
17474
|
- pdf.extract
|
|
17475
|
+
- pdf.decodeBarcodes
|
|
17476
|
+
- pdf.inspectGraphics
|
|
17350
17477
|
- http.request
|
|
17351
17478
|
- translate
|
|
17352
17479
|
AgentStreamEvent:
|
|
@@ -22643,6 +22770,38 @@ components:
|
|
|
22643
22770
|
$ref: "#/components/schemas/AppConfig"
|
|
22644
22771
|
required:
|
|
22645
22772
|
- apps
|
|
22773
|
+
CollectionUser:
|
|
22774
|
+
type: object
|
|
22775
|
+
properties:
|
|
22776
|
+
uid:
|
|
22777
|
+
type: string
|
|
22778
|
+
access:
|
|
22779
|
+
type: object
|
|
22780
|
+
additionalProperties: true
|
|
22781
|
+
name:
|
|
22782
|
+
type: string
|
|
22783
|
+
email:
|
|
22784
|
+
type: string
|
|
22785
|
+
required:
|
|
22786
|
+
- uid
|
|
22787
|
+
- access
|
|
22788
|
+
InviteUserInput:
|
|
22789
|
+
type: object
|
|
22790
|
+
properties:
|
|
22791
|
+
email:
|
|
22792
|
+
type: string
|
|
22793
|
+
name:
|
|
22794
|
+
type: string
|
|
22795
|
+
access:
|
|
22796
|
+
type: object
|
|
22797
|
+
additionalProperties: true
|
|
22798
|
+
loginCollectionId:
|
|
22799
|
+
type: string
|
|
22800
|
+
consoleOrigin:
|
|
22801
|
+
type: string
|
|
22802
|
+
required:
|
|
22803
|
+
- email
|
|
22804
|
+
- access
|
|
22646
22805
|
CollectionResponse:
|
|
22647
22806
|
$ref: "#/components/schemas/Collection"
|
|
22648
22807
|
CollectionCreateRequest:
|
|
@@ -22652,6 +22811,15 @@ components:
|
|
|
22652
22811
|
DomainTarget:
|
|
22653
22812
|
type: object
|
|
22654
22813
|
additionalProperties: true
|
|
22814
|
+
CollectionAccessLevel:
|
|
22815
|
+
type: string
|
|
22816
|
+
enum:
|
|
22817
|
+
- Owner
|
|
22818
|
+
- Admin
|
|
22819
|
+
- Assigner
|
|
22820
|
+
- Reporter
|
|
22821
|
+
- User
|
|
22822
|
+
- None
|
|
22655
22823
|
IdField:
|
|
22656
22824
|
type: string
|
|
22657
22825
|
enum:
|
package/dist/types/ai.d.ts
CHANGED
|
@@ -848,7 +848,7 @@ export interface CatalogResponse {
|
|
|
848
848
|
/** Capability tags a tool requires; scope a run with `allowCapabilities`. */
|
|
849
849
|
export type AiToolCapability = 'web:read' | 'ai:vision' | 'ai:image' | 'ai:text' | 'media:image' | 'media:pdf' | 'net:http';
|
|
850
850
|
/** The names of the built-in server-side agent tools (run via `server_tools`). */
|
|
851
|
-
export type AiToolName = 'web.fetchPage' | 'web.extractSchema' | 'web.screenshot' | 'web.search' | 'brand.assets' | 'document.read' | 'data.extract' | 'image.describe' | 'image.generate' | 'image.fromReference' | 'image.searchStock' | 'image.transform' | 'pdf.create' | 'pdf.fill' | 'pdf.merge' | 'pdf.inspect' | 'pdf.render' | 'pdf.extract' | 'http.request' | 'translate';
|
|
851
|
+
export type AiToolName = 'web.fetchPage' | 'web.extractSchema' | 'web.screenshot' | 'web.search' | 'brand.assets' | 'document.read' | 'data.extract' | 'image.describe' | 'image.generate' | 'image.fromReference' | 'image.searchStock' | 'image.transform' | 'pdf.create' | 'pdf.fill' | 'pdf.merge' | 'pdf.inspect' | 'pdf.render' | 'pdf.extract' | 'pdf.decodeBarcodes' | 'pdf.inspectGraphics' | 'http.request' | 'translate';
|
|
852
852
|
export interface WebFetchPageArgs {
|
|
853
853
|
url: string;
|
|
854
854
|
type?: string;
|
|
@@ -956,6 +956,17 @@ export interface PdfExtractArgs {
|
|
|
956
956
|
prompt?: string;
|
|
957
957
|
maxPages?: number;
|
|
958
958
|
dpi?: number;
|
|
959
|
+
includeConfidence?: boolean;
|
|
960
|
+
includeBoxes?: boolean;
|
|
961
|
+
}
|
|
962
|
+
export interface PdfDecodeBarcodesArgs {
|
|
963
|
+
url: string;
|
|
964
|
+
page?: number;
|
|
965
|
+
dpi?: number;
|
|
966
|
+
}
|
|
967
|
+
export interface PdfInspectGraphicsArgs {
|
|
968
|
+
url: string;
|
|
969
|
+
page?: number;
|
|
959
970
|
}
|
|
960
971
|
export interface HttpRequestArgs {
|
|
961
972
|
url: string;
|
|
@@ -988,6 +999,8 @@ export interface AiToolArgsMap {
|
|
|
988
999
|
'pdf.inspect': PdfInspectArgs;
|
|
989
1000
|
'pdf.render': PdfRenderArgs;
|
|
990
1001
|
'pdf.extract': PdfExtractArgs;
|
|
1002
|
+
'pdf.decodeBarcodes': PdfDecodeBarcodesArgs;
|
|
1003
|
+
'pdf.inspectGraphics': PdfInspectGraphicsArgs;
|
|
991
1004
|
'http.request': HttpRequestArgs;
|
|
992
1005
|
'translate': TranslateArgs;
|
|
993
1006
|
}
|
|
@@ -1077,11 +1090,56 @@ export interface PdfRenderResult {
|
|
|
1077
1090
|
width: number;
|
|
1078
1091
|
height: number;
|
|
1079
1092
|
}
|
|
1093
|
+
/** Per-field metadata from pdf.extract when includeConfidence / includeBoxes is set. */
|
|
1094
|
+
export interface PdfFieldMeta {
|
|
1095
|
+
confidence?: number | null;
|
|
1096
|
+
source?: 'text' | 'vision' | 'inferred';
|
|
1097
|
+
bbox?: {
|
|
1098
|
+
x: number;
|
|
1099
|
+
y: number;
|
|
1100
|
+
w: number;
|
|
1101
|
+
h: number;
|
|
1102
|
+
page: number;
|
|
1103
|
+
};
|
|
1104
|
+
}
|
|
1080
1105
|
export interface PdfExtractResult {
|
|
1081
1106
|
url: string;
|
|
1082
1107
|
method: 'text' | 'vision';
|
|
1083
1108
|
pagesRead: number;
|
|
1084
1109
|
fields: Record<string, any>;
|
|
1110
|
+
fieldsMeta?: Record<string, PdfFieldMeta>;
|
|
1111
|
+
}
|
|
1112
|
+
/** One decoded barcode/QR from pdf.decodeBarcodes. bbox is in PDF points (top-left origin). */
|
|
1113
|
+
export interface PdfBarcode {
|
|
1114
|
+
type: string;
|
|
1115
|
+
format: string;
|
|
1116
|
+
value: string;
|
|
1117
|
+
page: number;
|
|
1118
|
+
bbox?: {
|
|
1119
|
+
x: number;
|
|
1120
|
+
y: number;
|
|
1121
|
+
w: number;
|
|
1122
|
+
h: number;
|
|
1123
|
+
};
|
|
1124
|
+
confidence: number;
|
|
1125
|
+
}
|
|
1126
|
+
export interface PdfDecodeBarcodesResult {
|
|
1127
|
+
url: string;
|
|
1128
|
+
pagesScanned: number;
|
|
1129
|
+
codes: PdfBarcode[];
|
|
1130
|
+
}
|
|
1131
|
+
export interface PdfGraphicsPage {
|
|
1132
|
+
page: number;
|
|
1133
|
+
paths: number;
|
|
1134
|
+
images: number;
|
|
1135
|
+
textRuns: number;
|
|
1136
|
+
colourSpaces: string[];
|
|
1137
|
+
}
|
|
1138
|
+
export interface PdfInspectGraphicsResult {
|
|
1139
|
+
url: string;
|
|
1140
|
+
pages: PdfGraphicsPage[];
|
|
1141
|
+
spotColours: string[];
|
|
1142
|
+
note: string;
|
|
1085
1143
|
}
|
|
1086
1144
|
/** The `_agent` trace attached to an agentic Responses result. */
|
|
1087
1145
|
export interface ResponsesAgentTrace {
|
|
@@ -153,3 +153,33 @@ export interface AppsConfigResponse extends Omit<AppConfigSettings, 'id' | 'apps
|
|
|
153
153
|
/** Array of app catalog definitions for this collection. */
|
|
154
154
|
apps: AppConfig[];
|
|
155
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* A user's access level on a collection. Access is stored in the collection's `roles` map
|
|
158
|
+
* (userId → level). Server-enforced tiers are `User` < `Admin` < `Owner`; `Reporter` / `Assigner`
|
|
159
|
+
* are legacy values still accepted but not part of the enforced hierarchy. `None` removes access.
|
|
160
|
+
*/
|
|
161
|
+
export type CollectionAccessLevel = 'Owner' | 'Admin' | 'Assigner' | 'Reporter' | 'User' | 'None';
|
|
162
|
+
/** A user who has access to a collection (as returned by {@link collection.getUsers}). */
|
|
163
|
+
export interface CollectionUser {
|
|
164
|
+
/** The user's id (auth uid). */
|
|
165
|
+
uid: string;
|
|
166
|
+
/** The user's access level on this collection. */
|
|
167
|
+
access: CollectionAccessLevel | string;
|
|
168
|
+
/** Display name, if known. */
|
|
169
|
+
name?: string;
|
|
170
|
+
/** Email address, if known. */
|
|
171
|
+
email?: string;
|
|
172
|
+
}
|
|
173
|
+
/** Input for {@link collection.inviteUser}. */
|
|
174
|
+
export interface InviteUserInput {
|
|
175
|
+
/** Email address to invite. */
|
|
176
|
+
email: string;
|
|
177
|
+
/** Optional display name (used when creating a brand-new account). */
|
|
178
|
+
name?: string;
|
|
179
|
+
/** Access level to grant on the collection. Apply it with {@link collection.setUserAccess} after inviting. */
|
|
180
|
+
access: CollectionAccessLevel | string;
|
|
181
|
+
/** The login / auth-kit collection the account lives in (for branding + where the login is created). Default `'global'`. */
|
|
182
|
+
loginCollectionId?: string;
|
|
183
|
+
/** Origin used to build the branded invite link. Defaults to `window.location.origin` in the browser. */
|
|
184
|
+
consoleOrigin?: string;
|
|
185
|
+
}
|
package/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.30 | Generated: 2026-09-29T17:13:26.956Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -1485,7 +1485,21 @@ interface PdfRenderArgs {
|
|
|
1485
1485
|
**PdfExtractArgs** (interface)
|
|
1486
1486
|
```typescript
|
|
1487
1487
|
interface PdfExtractArgs {
|
|
1488
|
-
url: string; schema?: Record<string, any>; prompt?: string; maxPages?: number; dpi?: number
|
|
1488
|
+
url: string; schema?: Record<string, any>; prompt?: string; maxPages?: number; dpi?: number; includeConfidence?: boolean; includeBoxes?: boolean
|
|
1489
|
+
}
|
|
1490
|
+
```
|
|
1491
|
+
|
|
1492
|
+
**PdfDecodeBarcodesArgs** (interface)
|
|
1493
|
+
```typescript
|
|
1494
|
+
interface PdfDecodeBarcodesArgs {
|
|
1495
|
+
url: string; page?: number; dpi?: number
|
|
1496
|
+
}
|
|
1497
|
+
```
|
|
1498
|
+
|
|
1499
|
+
**PdfInspectGraphicsArgs** (interface)
|
|
1500
|
+
```typescript
|
|
1501
|
+
interface PdfInspectGraphicsArgs {
|
|
1502
|
+
url: string; page?: number
|
|
1489
1503
|
}
|
|
1490
1504
|
```
|
|
1491
1505
|
|
|
@@ -1524,6 +1538,8 @@ interface AiToolArgsMap {
|
|
|
1524
1538
|
'pdf.inspect': PdfInspectArgs
|
|
1525
1539
|
'pdf.render': PdfRenderArgs
|
|
1526
1540
|
'pdf.extract': PdfExtractArgs
|
|
1541
|
+
'pdf.decodeBarcodes': PdfDecodeBarcodesArgs
|
|
1542
|
+
'pdf.inspectGraphics': PdfInspectGraphicsArgs
|
|
1527
1543
|
'http.request': HttpRequestArgs
|
|
1528
1544
|
'translate': TranslateArgs
|
|
1529
1545
|
}
|
|
@@ -1613,10 +1629,45 @@ interface PdfRenderResult {
|
|
|
1613
1629
|
}
|
|
1614
1630
|
```
|
|
1615
1631
|
|
|
1632
|
+
**PdfFieldMeta** (interface)
|
|
1633
|
+
```typescript
|
|
1634
|
+
interface PdfFieldMeta {
|
|
1635
|
+
confidence?: number | null; source?: 'text' | 'vision' | 'inferred'; bbox?: { x: number; y: number; w: number; h: number; page: number }
|
|
1636
|
+
}
|
|
1637
|
+
```
|
|
1638
|
+
|
|
1616
1639
|
**PdfExtractResult** (interface)
|
|
1617
1640
|
```typescript
|
|
1618
1641
|
interface PdfExtractResult {
|
|
1619
|
-
url: string; method: 'text' | 'vision'; pagesRead: number; fields: Record<string, any>
|
|
1642
|
+
url: string; method: 'text' | 'vision'; pagesRead: number; fields: Record<string, any>; fieldsMeta?: Record<string, PdfFieldMeta>
|
|
1643
|
+
}
|
|
1644
|
+
```
|
|
1645
|
+
|
|
1646
|
+
**PdfBarcode** (interface)
|
|
1647
|
+
```typescript
|
|
1648
|
+
interface PdfBarcode {
|
|
1649
|
+
type: string; format: string; value: string; page: number; bbox?: { x: number; y: number; w: number; h: number }; confidence: number
|
|
1650
|
+
}
|
|
1651
|
+
```
|
|
1652
|
+
|
|
1653
|
+
**PdfDecodeBarcodesResult** (interface)
|
|
1654
|
+
```typescript
|
|
1655
|
+
interface PdfDecodeBarcodesResult {
|
|
1656
|
+
url: string; pagesScanned: number; codes: PdfBarcode[]
|
|
1657
|
+
}
|
|
1658
|
+
```
|
|
1659
|
+
|
|
1660
|
+
**PdfGraphicsPage** (interface)
|
|
1661
|
+
```typescript
|
|
1662
|
+
interface PdfGraphicsPage {
|
|
1663
|
+
page: number; paths: number; images: number; textRuns: number; colourSpaces: string[]
|
|
1664
|
+
}
|
|
1665
|
+
```
|
|
1666
|
+
|
|
1667
|
+
**PdfInspectGraphicsResult** (interface)
|
|
1668
|
+
```typescript
|
|
1669
|
+
interface PdfInspectGraphicsResult {
|
|
1670
|
+
url: string; pages: PdfGraphicsPage[]; spotColours: string[]; note: string
|
|
1620
1671
|
}
|
|
1621
1672
|
```
|
|
1622
1673
|
|
|
@@ -4660,6 +4711,27 @@ interface AppConfig {
|
|
|
4660
4711
|
}
|
|
4661
4712
|
```
|
|
4662
4713
|
|
|
4714
|
+
**CollectionUser** (interface)
|
|
4715
|
+
```typescript
|
|
4716
|
+
interface CollectionUser {
|
|
4717
|
+
uid: string
|
|
4718
|
+
access: CollectionAccessLevel | string
|
|
4719
|
+
name?: string
|
|
4720
|
+
email?: string
|
|
4721
|
+
}
|
|
4722
|
+
```
|
|
4723
|
+
|
|
4724
|
+
**InviteUserInput** (interface)
|
|
4725
|
+
```typescript
|
|
4726
|
+
interface InviteUserInput {
|
|
4727
|
+
email: string
|
|
4728
|
+
name?: string
|
|
4729
|
+
access: CollectionAccessLevel | string
|
|
4730
|
+
loginCollectionId?: string
|
|
4731
|
+
consoleOrigin?: string
|
|
4732
|
+
}
|
|
4733
|
+
```
|
|
4734
|
+
|
|
4663
4735
|
**CollectionResponse** = `Collection`
|
|
4664
4736
|
|
|
4665
4737
|
**CollectionCreateRequest** = `Omit<Collection, 'id' | 'shortId'>`
|
|
@@ -4668,6 +4740,8 @@ interface AppConfig {
|
|
|
4668
4740
|
|
|
4669
4741
|
**DomainTarget** = `"smartlinks" | "hub"`
|
|
4670
4742
|
|
|
4743
|
+
**CollectionAccessLevel** = `'Owner' | 'Admin' | 'Assigner' | 'Reporter' | 'User' | 'None'`
|
|
4744
|
+
|
|
4671
4745
|
### common
|
|
4672
4746
|
|
|
4673
4747
|
**IdField** = `'userId' | 'contactId'`
|
|
@@ -10382,6 +10456,18 @@ Look up a serial number by code for a collection (admin only).
|
|
|
10382
10456
|
value: any) → `Promise<any>`
|
|
10383
10457
|
Assign a value to a serial number for a collection (admin only).
|
|
10384
10458
|
|
|
10459
|
+
**getUsers**(collectionId: string) → `Promise<CollectionUser[]>`
|
|
10460
|
+
List the users with access to a collection, each with their access level (admin only). Access is stored in the collection's `roles` map (userId → level); this resolves each to name/email. GET /admin/collection/:collectionId/getUsers
|
|
10461
|
+
|
|
10462
|
+
**setUserAccess**(collectionId: string,
|
|
10463
|
+
userId: string,
|
|
10464
|
+
access: CollectionAccessLevel | null) → `Promise<void>`
|
|
10465
|
+
Grant, change, or remove a user's access level on a collection (admin only). Pass `null` or `'None'` to remove access. The server enforces privilege-escalation rules — you cannot grant an access level above your own, nor change a user whose level is above yours. POST /admin/collection/:collectionId/updateUserAccess
|
|
10466
|
+
|
|
10467
|
+
**inviteUser**(collectionId: string,
|
|
10468
|
+
input: InviteUserInput) → `Promise<`
|
|
10469
|
+
Invite a user to a collection by email (admin only). Creates or links their account in the login / auth-kit collection (`loginCollectionId`, default `'global'`) and emails them an invite (new account) or an added-to-collection notice (existing account); returns their `uid`. This does NOT grant access on its own — follow with {@link setUserAccess} to set their level (this mirrors the console flow). POST /user/inviteUser
|
|
10470
|
+
|
|
10385
10471
|
### comms
|
|
10386
10472
|
|
|
10387
10473
|
**getPushVapidPublicKey**(collectionId: string) → `Promise<import("../types/comms").PushVapidResponse>`
|
package/docs/ai.md
CHANGED
|
@@ -324,15 +324,40 @@ in `input`.
|
|
|
324
324
|
| `image.searchStock` | Search real stock photos (Unsplash). |
|
|
325
325
|
| `image.transform` | Resize / crop / rotate / grayscale / format-convert / compress → hosted URL. |
|
|
326
326
|
| `pdf.create` | Render HTML → PDF → hosted URL. |
|
|
327
|
-
| `pdf.fill` | Fill an AcroForm PDF's fields → hosted URL. |
|
|
328
|
-
| `pdf.merge` | Merge several PDFs into one → hosted URL. |
|
|
327
|
+
| `pdf.fill` | Fill an AcroForm PDF's fields (`{ field: value }`) → hosted URL. |
|
|
328
|
+
| `pdf.merge` | Merge several PDFs into one, in order → hosted URL. |
|
|
329
|
+
| `pdf.inspect` | Cheap, no-AI introspection: page count/sizes, which pages have a real text layer, raster present, and a routing hint (`text` vs `vision`). |
|
|
330
|
+
| `pdf.render` | Rasterize one page to a PNG at a chosen DPI → hosted image URL (feed to vision, or screenshot a page). |
|
|
331
|
+
| `pdf.extract` | PDF → typed JSON in one call (schema and/or prompt). Auto-routes text vs vision. Optional per-field `confidence`/`source` (`includeConfidence`) and `bbox` (`includeBoxes`) in `fieldsMeta`. |
|
|
332
|
+
| `pdf.decodeBarcodes` | Deterministically decode barcodes/QR on a page (WASM, no AI) → value + symbology + page + bbox + confidence. Use this for barcode digits, never vision. |
|
|
333
|
+
| `pdf.inspectGraphics` | Prepress inspection: per-page path/image/outlined-text counts + colour spaces, plus named SPOT colours (e.g. "PANTONE 871 C"). No AI. |
|
|
329
334
|
| `http.request` | SSRF-guarded outbound HTTP(S) to a public URL (call a REST API). |
|
|
330
335
|
| `translate` | Translate text into one or more languages (generic, model-based). |
|
|
331
336
|
|
|
337
|
+
**Working with PDFs.** The PDF tools split into *read/analyse* and *produce*:
|
|
338
|
+
|
|
339
|
+
- **Read a whole PDF as text** → `document.read` (Firecrawl; good for prose/decks).
|
|
340
|
+
- **Turn a PDF into structured fields** → `pdf.extract` (give it a JSON schema and/or a prompt; it
|
|
341
|
+
returns typed JSON). It routes itself, but you can drive the route yourself: call `pdf.inspect`
|
|
342
|
+
first (deterministic, no AI) to see whether each page has a real text layer, then `pdf.extract`
|
|
343
|
+
(cheap text path) or `pdf.render` → `image.describe`/vision for curve-only or raster artwork.
|
|
344
|
+
- **Zoom in on small print** (INCI/allergen lists) → `pdf.render` at a high DPI (e.g. 300), then read
|
|
345
|
+
the PNG with vision.
|
|
346
|
+
- **Barcodes / QR** → `pdf.decodeBarcodes` (deterministic WASM decode) — never trust vision for barcode
|
|
347
|
+
digits; it hallucinates them.
|
|
348
|
+
- **Prepress / print QA** (spot colours, colour spaces, vector vs raster) → `pdf.inspectGraphics`.
|
|
349
|
+
- **A review UI that flags guessed fields** → `pdf.extract` with `includeConfidence` (per-field
|
|
350
|
+
confidence + source) and `includeBoxes` (per-field bbox on text-native pages) in `fieldsMeta`.
|
|
351
|
+
- **Produce a PDF** → `pdf.create` (HTML → PDF), `pdf.fill` (populate an AcroForm's fields),
|
|
352
|
+
`pdf.merge` (combine several). These return a hosted `hostedUrl`.
|
|
353
|
+
|
|
354
|
+
Every tool is also directly callable without the model loop via `ai.tools.run(collectionId, name,
|
|
355
|
+
args)` — e.g. render a page or extract fields straight from a UI, no agent round-trip.
|
|
356
|
+
|
|
332
357
|
Discover tools two ways:
|
|
333
358
|
- **Design time (typed):** import `BUILTIN_AI_TOOLS`, `AI_TOOL_NAMES`, and the per-tool arg types
|
|
334
|
-
(`WebSearchArgs`, `DataExtractArgs`, …) from the SDK. This is the core set —
|
|
335
|
-
documented here.
|
|
359
|
+
(`WebSearchArgs`, `DataExtractArgs`, `PdfExtractArgs`, …) from the SDK. This is the core set —
|
|
360
|
+
stable, versioned, documented here.
|
|
336
361
|
- **Runtime (live):** `await ai.catalog(collectionId)` returns the registry as the server sees it,
|
|
337
362
|
including any future app-contributed tools. The built-in set above is always present.
|
|
338
363
|
|
package/docs/server-functions.md
CHANGED
|
@@ -400,6 +400,12 @@ Prefer the platform primitives above over a dependency; when you do need one, pi
|
|
|
400
400
|
| Schema validation of inputs | no | `zod` |
|
|
401
401
|
| JWT (sign/verify for a third-party API) | Web Crypto can, verbosely | `jose` |
|
|
402
402
|
| Hash / HMAC / encrypt | **native** — `crypto.subtle` | — |
|
|
403
|
+
| PDF **text** extraction (cheap first-pass, no AI) | no | `unpdf` — a serverless/WASM pdf.js build with no Node deps; `import { extractText } from 'unpdf'`. Text only. |
|
|
404
|
+
|
|
405
|
+
> **PDFs in a server function:** for a cheap text-layer check use `unpdf` (edge-safe, WASM). For
|
|
406
|
+
> anything heavier — rendering pages, vision extraction, **barcode/QR decode**, or prepress/spot-colour
|
|
407
|
+
> inspection — call the platform tools `pdf.render` / `pdf.extract` / `pdf.decodeBarcodes` /
|
|
408
|
+
> `pdf.inspectGraphics` via `ai.tools.run`; those run in the full platform runtime, not the sandbox.
|
|
403
409
|
|
|
404
410
|
**The common actions, and how to do each:**
|
|
405
411
|
|
package/openapi.yaml
CHANGED
|
@@ -4334,6 +4334,35 @@ paths:
|
|
|
4334
4334
|
description: Unauthorized
|
|
4335
4335
|
404:
|
|
4336
4336
|
description: Not found
|
|
4337
|
+
/admin/collection/{collectionId}/getUsers:
|
|
4338
|
+
get:
|
|
4339
|
+
tags:
|
|
4340
|
+
- collection
|
|
4341
|
+
summary: List the users with access to a collection, each with their access level (admin only).
|
|
4342
|
+
operationId: collection_getUsers
|
|
4343
|
+
security:
|
|
4344
|
+
- bearerAuth: []
|
|
4345
|
+
parameters:
|
|
4346
|
+
- name: collectionId
|
|
4347
|
+
in: path
|
|
4348
|
+
required: true
|
|
4349
|
+
schema:
|
|
4350
|
+
type: string
|
|
4351
|
+
responses:
|
|
4352
|
+
200:
|
|
4353
|
+
description: Success
|
|
4354
|
+
content:
|
|
4355
|
+
application/json:
|
|
4356
|
+
schema:
|
|
4357
|
+
type: array
|
|
4358
|
+
items:
|
|
4359
|
+
$ref: "#/components/schemas/CollectionUser"
|
|
4360
|
+
400:
|
|
4361
|
+
description: Bad request
|
|
4362
|
+
401:
|
|
4363
|
+
description: Unauthorized
|
|
4364
|
+
404:
|
|
4365
|
+
description: Not found
|
|
4337
4366
|
/admin/collection/{collectionId}/hub:
|
|
4338
4367
|
post:
|
|
4339
4368
|
tags:
|
|
@@ -8694,6 +8723,38 @@ paths:
|
|
|
8694
8723
|
application/json:
|
|
8695
8724
|
schema:
|
|
8696
8725
|
$ref: "#/components/schemas/TranslationUpdateRequest"
|
|
8726
|
+
/admin/collection/{collectionId}/updateUserAccess:
|
|
8727
|
+
post:
|
|
8728
|
+
tags:
|
|
8729
|
+
- collection
|
|
8730
|
+
summary: "Grant, change, or remove a user's access level on a collection (admin only)."
|
|
8731
|
+
operationId: collection_setUserAccess
|
|
8732
|
+
security:
|
|
8733
|
+
- bearerAuth: []
|
|
8734
|
+
parameters:
|
|
8735
|
+
- name: collectionId
|
|
8736
|
+
in: path
|
|
8737
|
+
required: true
|
|
8738
|
+
schema:
|
|
8739
|
+
type: string
|
|
8740
|
+
responses:
|
|
8741
|
+
200:
|
|
8742
|
+
description: Success
|
|
8743
|
+
content:
|
|
8744
|
+
application/json:
|
|
8745
|
+
schema: {}
|
|
8746
|
+
400:
|
|
8747
|
+
description: Bad request
|
|
8748
|
+
401:
|
|
8749
|
+
description: Unauthorized
|
|
8750
|
+
404:
|
|
8751
|
+
description: Not found
|
|
8752
|
+
requestBody:
|
|
8753
|
+
required: true
|
|
8754
|
+
content:
|
|
8755
|
+
application/json:
|
|
8756
|
+
schema:
|
|
8757
|
+
$ref: "#/components/schemas/CollectionAccessLevel"
|
|
8697
8758
|
/admin/collection/{encodedCollectionId}/comm/send:
|
|
8698
8759
|
post:
|
|
8699
8760
|
tags:
|
|
@@ -17064,6 +17125,22 @@ components:
|
|
|
17064
17125
|
additionalProperties: true
|
|
17065
17126
|
required:
|
|
17066
17127
|
- url
|
|
17128
|
+
PdfDecodeBarcodesArgs:
|
|
17129
|
+
type: object
|
|
17130
|
+
properties:
|
|
17131
|
+
url:
|
|
17132
|
+
type: object
|
|
17133
|
+
additionalProperties: true
|
|
17134
|
+
required:
|
|
17135
|
+
- url
|
|
17136
|
+
PdfInspectGraphicsArgs:
|
|
17137
|
+
type: object
|
|
17138
|
+
properties:
|
|
17139
|
+
url:
|
|
17140
|
+
type: object
|
|
17141
|
+
additionalProperties: true
|
|
17142
|
+
required:
|
|
17143
|
+
- url
|
|
17067
17144
|
HttpRequestArgs:
|
|
17068
17145
|
type: object
|
|
17069
17146
|
properties:
|
|
@@ -17125,6 +17202,10 @@ components:
|
|
|
17125
17202
|
$ref: "#/components/schemas/PdfRenderArgs"
|
|
17126
17203
|
pdf.extract:
|
|
17127
17204
|
$ref: "#/components/schemas/PdfExtractArgs"
|
|
17205
|
+
pdf.decodeBarcodes:
|
|
17206
|
+
$ref: "#/components/schemas/PdfDecodeBarcodesArgs"
|
|
17207
|
+
pdf.inspectGraphics:
|
|
17208
|
+
$ref: "#/components/schemas/PdfInspectGraphicsArgs"
|
|
17128
17209
|
http.request:
|
|
17129
17210
|
$ref: "#/components/schemas/HttpRequestArgs"
|
|
17130
17211
|
translate:
|
|
@@ -17148,6 +17229,8 @@ components:
|
|
|
17148
17229
|
- pdf.inspect
|
|
17149
17230
|
- pdf.render
|
|
17150
17231
|
- pdf.extract
|
|
17232
|
+
- pdf.decodeBarcodes
|
|
17233
|
+
- pdf.inspectGraphics
|
|
17151
17234
|
- http.request
|
|
17152
17235
|
- translate
|
|
17153
17236
|
WebSearchResultItem:
|
|
@@ -17256,6 +17339,12 @@ components:
|
|
|
17256
17339
|
additionalProperties: true
|
|
17257
17340
|
required:
|
|
17258
17341
|
- url
|
|
17342
|
+
PdfFieldMeta:
|
|
17343
|
+
type: object
|
|
17344
|
+
properties:
|
|
17345
|
+
confidence:
|
|
17346
|
+
type: object
|
|
17347
|
+
additionalProperties: true
|
|
17259
17348
|
PdfExtractResult:
|
|
17260
17349
|
type: object
|
|
17261
17350
|
properties:
|
|
@@ -17266,6 +17355,42 @@ components:
|
|
|
17266
17355
|
- vision
|
|
17267
17356
|
required:
|
|
17268
17357
|
- url
|
|
17358
|
+
PdfBarcode:
|
|
17359
|
+
type: object
|
|
17360
|
+
properties:
|
|
17361
|
+
type:
|
|
17362
|
+
type: object
|
|
17363
|
+
additionalProperties: true
|
|
17364
|
+
required:
|
|
17365
|
+
- type
|
|
17366
|
+
PdfDecodeBarcodesResult:
|
|
17367
|
+
type: object
|
|
17368
|
+
properties:
|
|
17369
|
+
url:
|
|
17370
|
+
type: array
|
|
17371
|
+
items:
|
|
17372
|
+
type: object
|
|
17373
|
+
additionalProperties: true
|
|
17374
|
+
required:
|
|
17375
|
+
- url
|
|
17376
|
+
PdfGraphicsPage:
|
|
17377
|
+
type: object
|
|
17378
|
+
properties:
|
|
17379
|
+
page:
|
|
17380
|
+
type: array
|
|
17381
|
+
items:
|
|
17382
|
+
type: object
|
|
17383
|
+
additionalProperties: true
|
|
17384
|
+
required:
|
|
17385
|
+
- page
|
|
17386
|
+
PdfInspectGraphicsResult:
|
|
17387
|
+
type: object
|
|
17388
|
+
properties:
|
|
17389
|
+
url:
|
|
17390
|
+
type: object
|
|
17391
|
+
additionalProperties: true
|
|
17392
|
+
required:
|
|
17393
|
+
- url
|
|
17269
17394
|
ResponsesAgentTrace:
|
|
17270
17395
|
type: object
|
|
17271
17396
|
properties:
|
|
@@ -17347,6 +17472,8 @@ components:
|
|
|
17347
17472
|
- pdf.inspect
|
|
17348
17473
|
- pdf.render
|
|
17349
17474
|
- pdf.extract
|
|
17475
|
+
- pdf.decodeBarcodes
|
|
17476
|
+
- pdf.inspectGraphics
|
|
17350
17477
|
- http.request
|
|
17351
17478
|
- translate
|
|
17352
17479
|
AgentStreamEvent:
|
|
@@ -22643,6 +22770,38 @@ components:
|
|
|
22643
22770
|
$ref: "#/components/schemas/AppConfig"
|
|
22644
22771
|
required:
|
|
22645
22772
|
- apps
|
|
22773
|
+
CollectionUser:
|
|
22774
|
+
type: object
|
|
22775
|
+
properties:
|
|
22776
|
+
uid:
|
|
22777
|
+
type: string
|
|
22778
|
+
access:
|
|
22779
|
+
type: object
|
|
22780
|
+
additionalProperties: true
|
|
22781
|
+
name:
|
|
22782
|
+
type: string
|
|
22783
|
+
email:
|
|
22784
|
+
type: string
|
|
22785
|
+
required:
|
|
22786
|
+
- uid
|
|
22787
|
+
- access
|
|
22788
|
+
InviteUserInput:
|
|
22789
|
+
type: object
|
|
22790
|
+
properties:
|
|
22791
|
+
email:
|
|
22792
|
+
type: string
|
|
22793
|
+
name:
|
|
22794
|
+
type: string
|
|
22795
|
+
access:
|
|
22796
|
+
type: object
|
|
22797
|
+
additionalProperties: true
|
|
22798
|
+
loginCollectionId:
|
|
22799
|
+
type: string
|
|
22800
|
+
consoleOrigin:
|
|
22801
|
+
type: string
|
|
22802
|
+
required:
|
|
22803
|
+
- email
|
|
22804
|
+
- access
|
|
22646
22805
|
CollectionResponse:
|
|
22647
22806
|
$ref: "#/components/schemas/Collection"
|
|
22648
22807
|
CollectionCreateRequest:
|
|
@@ -22652,6 +22811,15 @@ components:
|
|
|
22652
22811
|
DomainTarget:
|
|
22653
22812
|
type: object
|
|
22654
22813
|
additionalProperties: true
|
|
22814
|
+
CollectionAccessLevel:
|
|
22815
|
+
type: string
|
|
22816
|
+
enum:
|
|
22817
|
+
- Owner
|
|
22818
|
+
- Admin
|
|
22819
|
+
- Assigner
|
|
22820
|
+
- Reporter
|
|
22821
|
+
- User
|
|
22822
|
+
- None
|
|
22655
22823
|
IdField:
|
|
22656
22824
|
type: string
|
|
22657
22825
|
enum:
|