@proveanything/smartlinks 2.0.36 → 2.0.37
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/api/ai.d.ts +2 -2
- package/dist/api/ai.js +2 -2
- package/dist/context.js +15 -0
- package/dist/docs/API_SUMMARY.md +15 -3
- package/dist/docs/server-functions.md +1 -1
- package/dist/openapi.yaml +25 -5
- package/dist/types/ai.d.ts +12 -15
- package/dist/types/collection.d.ts +1 -1
- package/docs/API_SUMMARY.md +15 -3
- package/docs/server-functions.md +1 -1
- package/openapi.yaml +25 -5
- package/package.json +1 -1
package/dist/api/ai.d.ts
CHANGED
|
@@ -111,8 +111,8 @@ declare namespace aiInternal {
|
|
|
111
111
|
}>;
|
|
112
112
|
}
|
|
113
113
|
/**
|
|
114
|
-
* AI usage
|
|
115
|
-
* over an optional date window.
|
|
114
|
+
* AI usage for a collection (daily totals), grouped by any of model/appId/feature/mode/surface/provider/day
|
|
115
|
+
* over an optional date window (YYYY-MM-DD). Usage only — requests, tokens, images; no cost figures.
|
|
116
116
|
*/
|
|
117
117
|
function usage(collectionId: string, params?: {
|
|
118
118
|
groupBy?: string | string[];
|
package/dist/api/ai.js
CHANGED
|
@@ -224,8 +224,8 @@ var aiInternal;
|
|
|
224
224
|
sessions.clear = clear;
|
|
225
225
|
})(sessions = aiInternal.sessions || (aiInternal.sessions = {}));
|
|
226
226
|
/**
|
|
227
|
-
* AI usage
|
|
228
|
-
* over an optional date window.
|
|
227
|
+
* AI usage for a collection (daily totals), grouped by any of model/appId/feature/mode/surface/provider/day
|
|
228
|
+
* over an optional date window (YYYY-MM-DD). Usage only — requests, tokens, images; no cost figures.
|
|
229
229
|
*/
|
|
230
230
|
async function usage(collectionId, params) {
|
|
231
231
|
const groupBy = Array.isArray(params === null || params === void 0 ? void 0 : params.groupBy) ? params.groupBy.join(',') : params === null || params === void 0 ? void 0 : params.groupBy;
|
package/dist/context.js
CHANGED
|
@@ -40,6 +40,21 @@ export function readContext(overrides) {
|
|
|
40
40
|
if (window.location.search)
|
|
41
41
|
readSearchParamsInto(out, new URLSearchParams(window.location.search));
|
|
42
42
|
}
|
|
43
|
+
// 4. the SITE the page is served as (lowest precedence). When an app runs as a public website at
|
|
44
|
+
// its own hostname (an "app site"), the host page injects window.__SMARTLINKS_SITE__ =
|
|
45
|
+
// { collectionId, appId, channel, host } — so a site knows its collection with no URL params.
|
|
46
|
+
const site = globalThis.__SMARTLINKS_SITE__;
|
|
47
|
+
if (site && typeof site === 'object') {
|
|
48
|
+
const fill = (key, value) => { if (out[key] == null && typeof value === 'string' && value)
|
|
49
|
+
out[key] = value; };
|
|
50
|
+
fill('collectionId', site.collectionId);
|
|
51
|
+
fill('appId', site.appId);
|
|
52
|
+
// A site on a pre-release channel calls that channel's server functions (stable needs no channel).
|
|
53
|
+
if (site.channel && site.channel !== 'stable') {
|
|
54
|
+
fill('appChannel', site.channel);
|
|
55
|
+
fill('appChannelApp', site.appId);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
43
58
|
}
|
|
44
59
|
catch (_a) {
|
|
45
60
|
/* non-browser / bad URL — return what we have */
|
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.37 | Generated: 2026-10-04T09:59:59.885Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -918,8 +918,20 @@ interface AiUsageReport {
|
|
|
918
918
|
groupBy: string[]
|
|
919
919
|
from?: string | null
|
|
920
920
|
to?: string | null
|
|
921
|
-
totals:
|
|
922
|
-
groups: Array<Record<string, any> &
|
|
921
|
+
totals: AiUsageTotals
|
|
922
|
+
groups: Array<Record<string, any> & AiUsageTotals>
|
|
923
|
+
}
|
|
924
|
+
```
|
|
925
|
+
|
|
926
|
+
**AiUsageTotals** (interface)
|
|
927
|
+
```typescript
|
|
928
|
+
interface AiUsageTotals {
|
|
929
|
+
promptTokens: number
|
|
930
|
+
outputTokens: number
|
|
931
|
+
cachedTokens: number
|
|
932
|
+
totalTokens: number
|
|
933
|
+
requests: number
|
|
934
|
+
images: number
|
|
923
935
|
}
|
|
924
936
|
```
|
|
925
937
|
|
|
@@ -275,7 +275,7 @@ await SL.functions.call(collectionId, 'pressCounter', {}, { channel: null }) /
|
|
|
275
275
|
```
|
|
276
276
|
|
|
277
277
|
**Public address on the collection's own site (webhooks, integrations).** Every collection has a
|
|
278
|
-
site host — `<name>.smartlinks.host` once a name is claimed, else `c-<
|
|
278
|
+
site host — `<name>.smartlinks.host` once a name is claimed, else `c-<collectionId>.smartlinks.host` —
|
|
279
279
|
returned as `collection.siteHost`. App functions are reachable there:
|
|
280
280
|
|
|
281
281
|
```
|
package/dist/openapi.yaml
CHANGED
|
@@ -1347,7 +1347,7 @@ paths:
|
|
|
1347
1347
|
get:
|
|
1348
1348
|
tags:
|
|
1349
1349
|
- sessions
|
|
1350
|
-
summary: AI usage
|
|
1350
|
+
summary: AI usage for a collection (daily totals), grouped by any of model/appId/feature/mode/surface/provider/day over an optional date window (YYYY-MM-DD).
|
|
1351
1351
|
operationId: sessions_usage
|
|
1352
1352
|
security:
|
|
1353
1353
|
- bearerAuth: []
|
|
@@ -16327,17 +16327,37 @@ components:
|
|
|
16327
16327
|
to:
|
|
16328
16328
|
type: string
|
|
16329
16329
|
totals:
|
|
16330
|
-
|
|
16331
|
-
additionalProperties: true
|
|
16330
|
+
$ref: "#/components/schemas/AiUsageTotals"
|
|
16332
16331
|
groups:
|
|
16333
16332
|
type: array
|
|
16334
16333
|
items:
|
|
16335
|
-
|
|
16336
|
-
additionalProperties: true
|
|
16334
|
+
$ref: "#/components/schemas/AiUsageTotals"
|
|
16337
16335
|
required:
|
|
16338
16336
|
- groupBy
|
|
16339
16337
|
- totals
|
|
16340
16338
|
- groups
|
|
16339
|
+
AiUsageTotals:
|
|
16340
|
+
type: object
|
|
16341
|
+
properties:
|
|
16342
|
+
promptTokens:
|
|
16343
|
+
type: number
|
|
16344
|
+
outputTokens:
|
|
16345
|
+
type: number
|
|
16346
|
+
cachedTokens:
|
|
16347
|
+
type: number
|
|
16348
|
+
totalTokens:
|
|
16349
|
+
type: number
|
|
16350
|
+
requests:
|
|
16351
|
+
type: number
|
|
16352
|
+
images:
|
|
16353
|
+
type: number
|
|
16354
|
+
required:
|
|
16355
|
+
- promptTokens
|
|
16356
|
+
- outputTokens
|
|
16357
|
+
- cachedTokens
|
|
16358
|
+
- totalTokens
|
|
16359
|
+
- requests
|
|
16360
|
+
- images
|
|
16341
16361
|
VoiceSessionRequest:
|
|
16342
16362
|
type: object
|
|
16343
16363
|
properties:
|
package/dist/types/ai.d.ts
CHANGED
|
@@ -412,25 +412,22 @@ export interface AiSessionCreate {
|
|
|
412
412
|
/** Seed items (e.g. a system/instruction turn). */
|
|
413
413
|
items?: ResponseInputItem[];
|
|
414
414
|
}
|
|
415
|
-
/** Per-collection AI usage
|
|
415
|
+
/** Per-collection AI usage report (daily totals). Usage only — requests, tokens, images; no cost figures. */
|
|
416
416
|
export interface AiUsageReport {
|
|
417
417
|
groupBy: string[];
|
|
418
418
|
from?: string | null;
|
|
419
419
|
to?: string | null;
|
|
420
|
-
totals:
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
requests: number;
|
|
432
|
-
costUnits: number;
|
|
433
|
-
}>;
|
|
420
|
+
totals: AiUsageTotals;
|
|
421
|
+
groups: Array<Record<string, any> & AiUsageTotals>;
|
|
422
|
+
}
|
|
423
|
+
/** Summed usage for a report group (or the whole window). */
|
|
424
|
+
export interface AiUsageTotals {
|
|
425
|
+
promptTokens: number;
|
|
426
|
+
outputTokens: number;
|
|
427
|
+
cachedTokens: number;
|
|
428
|
+
totalTokens: number;
|
|
429
|
+
requests: number;
|
|
430
|
+
images: number;
|
|
434
431
|
}
|
|
435
432
|
/** Voice session request */
|
|
436
433
|
export interface VoiceSessionRequest {
|
|
@@ -48,7 +48,7 @@ export interface Collection {
|
|
|
48
48
|
hubCustomDomain?: string;
|
|
49
49
|
/**
|
|
50
50
|
* The collection's SITE HOST on the tenant domain — computed by the server, never stored:
|
|
51
|
-
* `<hubName>.smartlinks.host` when a name is claimed, else the default `c-<
|
|
51
|
+
* `<hubName>.smartlinks.host` when a name is claimed, else the default `c-<collectionId>.smartlinks.host`.
|
|
52
52
|
* Hub serves it, and app functions are reachable under it at `https://<siteHost>/_fn/…`
|
|
53
53
|
* (see SL.functions.siteUrl).
|
|
54
54
|
*/
|
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.37 | Generated: 2026-10-04T09:59:59.885Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -918,8 +918,20 @@ interface AiUsageReport {
|
|
|
918
918
|
groupBy: string[]
|
|
919
919
|
from?: string | null
|
|
920
920
|
to?: string | null
|
|
921
|
-
totals:
|
|
922
|
-
groups: Array<Record<string, any> &
|
|
921
|
+
totals: AiUsageTotals
|
|
922
|
+
groups: Array<Record<string, any> & AiUsageTotals>
|
|
923
|
+
}
|
|
924
|
+
```
|
|
925
|
+
|
|
926
|
+
**AiUsageTotals** (interface)
|
|
927
|
+
```typescript
|
|
928
|
+
interface AiUsageTotals {
|
|
929
|
+
promptTokens: number
|
|
930
|
+
outputTokens: number
|
|
931
|
+
cachedTokens: number
|
|
932
|
+
totalTokens: number
|
|
933
|
+
requests: number
|
|
934
|
+
images: number
|
|
923
935
|
}
|
|
924
936
|
```
|
|
925
937
|
|
package/docs/server-functions.md
CHANGED
|
@@ -275,7 +275,7 @@ await SL.functions.call(collectionId, 'pressCounter', {}, { channel: null }) /
|
|
|
275
275
|
```
|
|
276
276
|
|
|
277
277
|
**Public address on the collection's own site (webhooks, integrations).** Every collection has a
|
|
278
|
-
site host — `<name>.smartlinks.host` once a name is claimed, else `c-<
|
|
278
|
+
site host — `<name>.smartlinks.host` once a name is claimed, else `c-<collectionId>.smartlinks.host` —
|
|
279
279
|
returned as `collection.siteHost`. App functions are reachable there:
|
|
280
280
|
|
|
281
281
|
```
|
package/openapi.yaml
CHANGED
|
@@ -1347,7 +1347,7 @@ paths:
|
|
|
1347
1347
|
get:
|
|
1348
1348
|
tags:
|
|
1349
1349
|
- sessions
|
|
1350
|
-
summary: AI usage
|
|
1350
|
+
summary: AI usage for a collection (daily totals), grouped by any of model/appId/feature/mode/surface/provider/day over an optional date window (YYYY-MM-DD).
|
|
1351
1351
|
operationId: sessions_usage
|
|
1352
1352
|
security:
|
|
1353
1353
|
- bearerAuth: []
|
|
@@ -16327,17 +16327,37 @@ components:
|
|
|
16327
16327
|
to:
|
|
16328
16328
|
type: string
|
|
16329
16329
|
totals:
|
|
16330
|
-
|
|
16331
|
-
additionalProperties: true
|
|
16330
|
+
$ref: "#/components/schemas/AiUsageTotals"
|
|
16332
16331
|
groups:
|
|
16333
16332
|
type: array
|
|
16334
16333
|
items:
|
|
16335
|
-
|
|
16336
|
-
additionalProperties: true
|
|
16334
|
+
$ref: "#/components/schemas/AiUsageTotals"
|
|
16337
16335
|
required:
|
|
16338
16336
|
- groupBy
|
|
16339
16337
|
- totals
|
|
16340
16338
|
- groups
|
|
16339
|
+
AiUsageTotals:
|
|
16340
|
+
type: object
|
|
16341
|
+
properties:
|
|
16342
|
+
promptTokens:
|
|
16343
|
+
type: number
|
|
16344
|
+
outputTokens:
|
|
16345
|
+
type: number
|
|
16346
|
+
cachedTokens:
|
|
16347
|
+
type: number
|
|
16348
|
+
totalTokens:
|
|
16349
|
+
type: number
|
|
16350
|
+
requests:
|
|
16351
|
+
type: number
|
|
16352
|
+
images:
|
|
16353
|
+
type: number
|
|
16354
|
+
required:
|
|
16355
|
+
- promptTokens
|
|
16356
|
+
- outputTokens
|
|
16357
|
+
- cachedTokens
|
|
16358
|
+
- totalTokens
|
|
16359
|
+
- requests
|
|
16360
|
+
- images
|
|
16341
16361
|
VoiceSessionRequest:
|
|
16342
16362
|
type: object
|
|
16343
16363
|
properties:
|