@proveanything/smartlinks 2.0.18 → 2.0.20
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 +62 -2
- package/dist/api/ai.js +90 -0
- package/dist/api/functions.d.ts +27 -0
- package/dist/api/functions.js +38 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/docs/API_SUMMARY.md +131 -2
- package/dist/docs/host-dependency-contract.md +12 -3
- package/dist/openapi.yaml +387 -4
- package/dist/testing/index.js +6 -0
- package/dist/types/ai.d.ts +71 -0
- package/dist/types/appManifest.d.ts +7 -1
- package/docs/API_SUMMARY.md +131 -2
- package/docs/host-dependency-contract.md +12 -3
- package/openapi.yaml +387 -4
- package/package.json +1 -1
package/dist/api/ai.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ContentPart, FunctionCall, ToolCall, ChatMessage, ToolDefinition, ResponseTool, ResponseInputItem, ResponsesRequest, ResponsesResult, ResponsesStreamEvent, ChatCompletionRequest, ChatCompletionChoice, ChatCompletionResponse, ChatCompletionChunk, AIModel, AIModelListParams, AIModelListResponse, AgentRunRequest, AgentRunResult, AgentToolsQuery, AgentToolsResponse, SkillsListResponse, CatalogResponse, DocumentChunk, IndexDocumentRequest, IndexDocumentResponse, ConfigureAssistantRequest, ConfigureAssistantResponse, PublicChatRequest, PublicChatResponse, Session, RateLimitStatus, SessionStatistics, VoiceSessionRequest, VoiceSessionResponse, EphemeralTokenRequest, EphemeralTokenResponse, TranscriptionResponse, TTSRequest, GeneratePodcastRequest, PodcastScript, GeneratePodcastResponse, PodcastStatus, AIGenerateContentRequest, AIGenerateContentCandidate, AIGenerateContentResponse, AIGenerateImageRequest, AIGenerateImageResponse, AIGeneratedImage, AISearchPhotosRequest, AISearchPhotosPhoto, AISearchPhotosResponse, AIUploadedFile, AICacheRef } from "../types/ai.js";
|
|
2
|
-
export type { ContentPart, FunctionCall, ToolCall, ChatMessage, ToolDefinition, ResponseTool, ResponseInputItem, ResponsesRequest, ResponsesResult, ResponsesStreamEvent, ChatCompletionRequest, ChatCompletionChoice, ChatCompletionResponse, ChatCompletionChunk, AIModel, AIModelListParams, AIModelListResponse, DocumentChunk, IndexDocumentRequest, IndexDocumentResponse, ConfigureAssistantRequest, ConfigureAssistantResponse, PublicChatRequest, PublicChatResponse, Session, RateLimitStatus, SessionStatistics, VoiceSessionRequest, VoiceSessionResponse, EphemeralTokenRequest, EphemeralTokenResponse, TranscriptionResponse, TTSRequest, GeneratePodcastRequest, PodcastScript, GeneratePodcastResponse, PodcastStatus, AIGenerateContentRequest, AIGenerateContentCandidate, AIGenerateContentResponse, AIGenerateImageRequest, AIGenerateImageResponse, AIGeneratedImage, AISearchPhotosRequest, AISearchPhotosPhoto, AISearchPhotosResponse, AIUploadedFile, AICacheRef, };
|
|
1
|
+
import type { ContentPart, FunctionCall, ToolCall, ChatMessage, ToolDefinition, ResponseTool, ResponseInputItem, ResponsesRequest, ResponsesResult, ResponsesStreamEvent, ChatCompletionRequest, ChatCompletionChoice, ChatCompletionResponse, ChatCompletionChunk, AIModel, AIModelListParams, AIModelListResponse, AgentRunRequest, AgentRunResult, AgentToolsQuery, AgentToolsResponse, SkillsListResponse, CatalogResponse, DocumentChunk, IndexDocumentRequest, IndexDocumentResponse, ConfigureAssistantRequest, ConfigureAssistantResponse, PublicChatRequest, PublicChatResponse, Session, RateLimitStatus, SessionStatistics, AiSession, AiSessionCreate, AiUsageReport, VoiceSessionRequest, VoiceSessionResponse, EphemeralTokenRequest, EphemeralTokenResponse, TranscriptionResponse, TTSRequest, GeneratePodcastRequest, PodcastScript, GeneratePodcastResponse, PodcastStatus, AIGenerateContentRequest, AIGenerateContentCandidate, AIGenerateContentResponse, AIGenerateImageRequest, AIGenerateImageResponse, AIGeneratedImage, AISearchPhotosRequest, AISearchPhotosPhoto, AISearchPhotosResponse, AIUploadedFile, AICacheRef } from "../types/ai.js";
|
|
2
|
+
export type { ContentPart, FunctionCall, ToolCall, ChatMessage, ToolDefinition, ResponseTool, ResponseInputItem, ResponsesRequest, ResponsesResult, ResponsesStreamEvent, ChatCompletionRequest, ChatCompletionChoice, ChatCompletionResponse, ChatCompletionChunk, AIModel, AIModelListParams, AIModelListResponse, DocumentChunk, IndexDocumentRequest, IndexDocumentResponse, ConfigureAssistantRequest, ConfigureAssistantResponse, PublicChatRequest, PublicChatResponse, Session, RateLimitStatus, SessionStatistics, AiSession, AiSessionCreate, AiUsageReport, VoiceSessionRequest, VoiceSessionResponse, EphemeralTokenRequest, EphemeralTokenResponse, TranscriptionResponse, TTSRequest, GeneratePodcastRequest, PodcastScript, GeneratePodcastResponse, PodcastStatus, AIGenerateContentRequest, AIGenerateContentCandidate, AIGenerateContentResponse, AIGenerateImageRequest, AIGenerateImageResponse, AIGeneratedImage, AISearchPhotosRequest, AISearchPhotosPhoto, AISearchPhotosResponse, AIUploadedFile, AICacheRef, };
|
|
3
3
|
declare namespace aiInternal {
|
|
4
4
|
namespace chat {
|
|
5
5
|
namespace responses {
|
|
@@ -70,7 +70,41 @@ declare namespace aiInternal {
|
|
|
70
70
|
* Get session statistics
|
|
71
71
|
*/
|
|
72
72
|
function stats(collectionId: string): Promise<SessionStatistics>;
|
|
73
|
+
/**
|
|
74
|
+
* Persisted AI assistant sessions (admin scope) — durable conversation history for
|
|
75
|
+
* admin/host assistants. Create one, then either append your turns explicitly, OR pass
|
|
76
|
+
* its `id` as `session_id` to `ai.chat.responses.create` and the server threads prior
|
|
77
|
+
* turns into the input and persists the new turn automatically (works with `server_tools`).
|
|
78
|
+
*/
|
|
79
|
+
function create(collectionId: string, body?: AiSessionCreate): Promise<AiSession>;
|
|
80
|
+
/** List sessions, most-recently-active first (optionally filtered by app). */
|
|
81
|
+
function list(collectionId: string, params?: {
|
|
82
|
+
appId?: string;
|
|
83
|
+
limit?: number;
|
|
84
|
+
}): Promise<{
|
|
85
|
+
sessions: AiSession[];
|
|
86
|
+
}>;
|
|
87
|
+
/** Get one session, including its full transcript. */
|
|
88
|
+
function get(collectionId: string, id: string): Promise<AiSession>;
|
|
89
|
+
/** Append Responses items (input/output/tool) to a session — the manual-persistence path. */
|
|
90
|
+
function append(collectionId: string, id: string, items: ResponseInputItem[], opts?: {
|
|
91
|
+
usage?: Record<string, any>;
|
|
92
|
+
}): Promise<AiSession>;
|
|
93
|
+
/** Archive (soft-delete) a session. */
|
|
94
|
+
function clear(collectionId: string, id: string): Promise<{
|
|
95
|
+
ok: boolean;
|
|
96
|
+
id: string;
|
|
97
|
+
}>;
|
|
73
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* AI usage / cost report for a collection, grouped by any of model/serviceTier/appId/feature/mode
|
|
101
|
+
* over an optional date window. `costUnits` are OPAQUE internal units, never provider currency.
|
|
102
|
+
*/
|
|
103
|
+
function usage(collectionId: string, params?: {
|
|
104
|
+
groupBy?: string | string[];
|
|
105
|
+
from?: string;
|
|
106
|
+
to?: string;
|
|
107
|
+
}): Promise<AiUsageReport>;
|
|
74
108
|
namespace rateLimit {
|
|
75
109
|
/**
|
|
76
110
|
* Reset rate limit for a user
|
|
@@ -111,6 +145,32 @@ declare namespace aiInternal {
|
|
|
111
145
|
function clearSession(collectionId: string, sessionId: string): Promise<{
|
|
112
146
|
success: boolean;
|
|
113
147
|
}>;
|
|
148
|
+
/**
|
|
149
|
+
* Persisted consumer AI sessions (durable — the replacement for getSession/clearSession above).
|
|
150
|
+
* `scope: 'owner'` keys the history to the signed-in consumer (send the authKit bearer, and
|
|
151
|
+
* only that consumer can read/append/clear it); `scope: 'public'` (default) is an anonymous
|
|
152
|
+
* session where possession of the id is the capability.
|
|
153
|
+
*/
|
|
154
|
+
namespace sessions {
|
|
155
|
+
function create(collectionId: string, body?: AiSessionCreate & {
|
|
156
|
+
scope?: 'owner' | 'public';
|
|
157
|
+
}): Promise<AiSession>;
|
|
158
|
+
/** List the signed-in consumer's own ('owner') sessions — requires an authKit bearer. */
|
|
159
|
+
function list(collectionId: string, params?: {
|
|
160
|
+
appId?: string;
|
|
161
|
+
limit?: number;
|
|
162
|
+
}): Promise<{
|
|
163
|
+
sessions: AiSession[];
|
|
164
|
+
}>;
|
|
165
|
+
function get(collectionId: string, id: string): Promise<AiSession>;
|
|
166
|
+
function append(collectionId: string, id: string, items: ResponseInputItem[], opts?: {
|
|
167
|
+
usage?: Record<string, any>;
|
|
168
|
+
}): Promise<AiSession>;
|
|
169
|
+
function clear(collectionId: string, id: string): Promise<{
|
|
170
|
+
ok: boolean;
|
|
171
|
+
id: string;
|
|
172
|
+
}>;
|
|
173
|
+
}
|
|
114
174
|
/**
|
|
115
175
|
* Check rate limit status
|
|
116
176
|
*/
|
package/dist/api/ai.js
CHANGED
|
@@ -173,7 +173,59 @@ var aiInternal;
|
|
|
173
173
|
return request(path);
|
|
174
174
|
}
|
|
175
175
|
sessions.stats = stats;
|
|
176
|
+
/**
|
|
177
|
+
* Persisted AI assistant sessions (admin scope) — durable conversation history for
|
|
178
|
+
* admin/host assistants. Create one, then either append your turns explicitly, OR pass
|
|
179
|
+
* its `id` as `session_id` to `ai.chat.responses.create` and the server threads prior
|
|
180
|
+
* turns into the input and persists the new turn automatically (works with `server_tools`).
|
|
181
|
+
*/
|
|
182
|
+
async function create(collectionId, body = {}) {
|
|
183
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/ai/sessions`;
|
|
184
|
+
return post(path, body);
|
|
185
|
+
}
|
|
186
|
+
sessions.create = create;
|
|
187
|
+
/** List sessions, most-recently-active first (optionally filtered by app). */
|
|
188
|
+
async function list(collectionId, params) {
|
|
189
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/ai/sessions${encodeQueryParams({
|
|
190
|
+
appId: params === null || params === void 0 ? void 0 : params.appId,
|
|
191
|
+
limit: (params === null || params === void 0 ? void 0 : params.limit) != null ? String(params.limit) : undefined,
|
|
192
|
+
})}`;
|
|
193
|
+
return request(path);
|
|
194
|
+
}
|
|
195
|
+
sessions.list = list;
|
|
196
|
+
/** Get one session, including its full transcript. */
|
|
197
|
+
async function get(collectionId, id) {
|
|
198
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/ai/sessions/${encodeURIComponent(id)}`;
|
|
199
|
+
return request(path);
|
|
200
|
+
}
|
|
201
|
+
sessions.get = get;
|
|
202
|
+
/** Append Responses items (input/output/tool) to a session — the manual-persistence path. */
|
|
203
|
+
async function append(collectionId, id, items, opts) {
|
|
204
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/ai/sessions/${encodeURIComponent(id)}/append`;
|
|
205
|
+
return post(path, { items, usage: opts === null || opts === void 0 ? void 0 : opts.usage });
|
|
206
|
+
}
|
|
207
|
+
sessions.append = append;
|
|
208
|
+
/** Archive (soft-delete) a session. */
|
|
209
|
+
async function clear(collectionId, id) {
|
|
210
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/ai/sessions/${encodeURIComponent(id)}`;
|
|
211
|
+
return del(path);
|
|
212
|
+
}
|
|
213
|
+
sessions.clear = clear;
|
|
176
214
|
})(sessions = aiInternal.sessions || (aiInternal.sessions = {}));
|
|
215
|
+
/**
|
|
216
|
+
* AI usage / cost report for a collection, grouped by any of model/serviceTier/appId/feature/mode
|
|
217
|
+
* over an optional date window. `costUnits` are OPAQUE internal units, never provider currency.
|
|
218
|
+
*/
|
|
219
|
+
async function usage(collectionId, params) {
|
|
220
|
+
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;
|
|
221
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/ai/usage${encodeQueryParams({
|
|
222
|
+
groupBy,
|
|
223
|
+
from: params === null || params === void 0 ? void 0 : params.from,
|
|
224
|
+
to: params === null || params === void 0 ? void 0 : params.to,
|
|
225
|
+
})}`;
|
|
226
|
+
return request(path);
|
|
227
|
+
}
|
|
228
|
+
aiInternal.usage = usage;
|
|
177
229
|
// ============================================================================
|
|
178
230
|
// Rate Limiting API
|
|
179
231
|
// ============================================================================
|
|
@@ -254,6 +306,44 @@ var aiInternal;
|
|
|
254
306
|
return del(path);
|
|
255
307
|
}
|
|
256
308
|
publicClient.clearSession = clearSession;
|
|
309
|
+
/**
|
|
310
|
+
* Persisted consumer AI sessions (durable — the replacement for getSession/clearSession above).
|
|
311
|
+
* `scope: 'owner'` keys the history to the signed-in consumer (send the authKit bearer, and
|
|
312
|
+
* only that consumer can read/append/clear it); `scope: 'public'` (default) is an anonymous
|
|
313
|
+
* session where possession of the id is the capability.
|
|
314
|
+
*/
|
|
315
|
+
let sessions;
|
|
316
|
+
(function (sessions) {
|
|
317
|
+
async function create(collectionId, body = {}) {
|
|
318
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/ai/sessions`;
|
|
319
|
+
return post(path, body);
|
|
320
|
+
}
|
|
321
|
+
sessions.create = create;
|
|
322
|
+
/** List the signed-in consumer's own ('owner') sessions — requires an authKit bearer. */
|
|
323
|
+
async function list(collectionId, params) {
|
|
324
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/ai/sessions${encodeQueryParams({
|
|
325
|
+
appId: params === null || params === void 0 ? void 0 : params.appId,
|
|
326
|
+
limit: (params === null || params === void 0 ? void 0 : params.limit) != null ? String(params.limit) : undefined,
|
|
327
|
+
})}`;
|
|
328
|
+
return request(path);
|
|
329
|
+
}
|
|
330
|
+
sessions.list = list;
|
|
331
|
+
async function get(collectionId, id) {
|
|
332
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/ai/sessions/${encodeURIComponent(id)}`;
|
|
333
|
+
return request(path);
|
|
334
|
+
}
|
|
335
|
+
sessions.get = get;
|
|
336
|
+
async function append(collectionId, id, items, opts) {
|
|
337
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/ai/sessions/${encodeURIComponent(id)}/append`;
|
|
338
|
+
return post(path, { items, usage: opts === null || opts === void 0 ? void 0 : opts.usage });
|
|
339
|
+
}
|
|
340
|
+
sessions.append = append;
|
|
341
|
+
async function clear(collectionId, id) {
|
|
342
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/ai/sessions/${encodeURIComponent(id)}`;
|
|
343
|
+
return del(path);
|
|
344
|
+
}
|
|
345
|
+
sessions.clear = clear;
|
|
346
|
+
})(sessions = publicClient.sessions || (publicClient.sessions = {}));
|
|
257
347
|
/**
|
|
258
348
|
* Check rate limit status
|
|
259
349
|
*/
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** A server function's returned value — shape is app-defined, so untyped by default. */
|
|
2
|
+
export type FunctionCallResult = any;
|
|
3
|
+
export interface FunctionListEntry {
|
|
4
|
+
name: string;
|
|
5
|
+
visibility?: string;
|
|
6
|
+
trigger?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface FunctionListResponse {
|
|
9
|
+
functions: FunctionListEntry[];
|
|
10
|
+
}
|
|
11
|
+
export declare namespace functions {
|
|
12
|
+
/**
|
|
13
|
+
* Call a PUBLIC app server function inline.
|
|
14
|
+
* `POST /public/collection/:collectionId/functions/:name` — surface `'public'`.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* const { value } = await SL.functions.call<{ value: number }>(collectionId, 'increment')
|
|
18
|
+
*/
|
|
19
|
+
function call<T = FunctionCallResult>(collectionId: string, name: string, body?: Record<string, any>): Promise<T>;
|
|
20
|
+
/**
|
|
21
|
+
* Call an ADMIN app server function (surface `'admin'`; requires an admin session).
|
|
22
|
+
* `POST /admin/collection/:collectionId/functions/:name`.
|
|
23
|
+
*/
|
|
24
|
+
function callAdmin<T = FunctionCallResult>(collectionId: string, name: string, body?: Record<string, any>): Promise<T>;
|
|
25
|
+
/** List the public functions available for a collection (discovery). `GET /public/collection/:c/functions`. */
|
|
26
|
+
function list(collectionId: string): Promise<FunctionListResponse>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Client-side invocation of app SERVER FUNCTIONS.
|
|
2
|
+
//
|
|
3
|
+
// The function itself is authored server-side (one contract: `async (ctx, event) => result`,
|
|
4
|
+
// see docs/server-functions.md). THIS is how a page/UI actually calls one — the missing
|
|
5
|
+
// client half. The PUBLIC route runs a function inline on the caller's own authority (owner if
|
|
6
|
+
// signed in via authKit, else public); the ADMIN route runs on the admin surface (needs an admin
|
|
7
|
+
// session). The returned value is the function's own result (`event.body` is what you pass here).
|
|
8
|
+
import { post, request } from "../http.js";
|
|
9
|
+
export var functions;
|
|
10
|
+
(function (functions) {
|
|
11
|
+
/**
|
|
12
|
+
* Call a PUBLIC app server function inline.
|
|
13
|
+
* `POST /public/collection/:collectionId/functions/:name` — surface `'public'`.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const { value } = await SL.functions.call<{ value: number }>(collectionId, 'increment')
|
|
17
|
+
*/
|
|
18
|
+
async function call(collectionId, name, body = {}) {
|
|
19
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/functions/${encodeURIComponent(name)}`;
|
|
20
|
+
return post(path, body);
|
|
21
|
+
}
|
|
22
|
+
functions.call = call;
|
|
23
|
+
/**
|
|
24
|
+
* Call an ADMIN app server function (surface `'admin'`; requires an admin session).
|
|
25
|
+
* `POST /admin/collection/:collectionId/functions/:name`.
|
|
26
|
+
*/
|
|
27
|
+
async function callAdmin(collectionId, name, body = {}) {
|
|
28
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/functions/${encodeURIComponent(name)}`;
|
|
29
|
+
return post(path, body);
|
|
30
|
+
}
|
|
31
|
+
functions.callAdmin = callAdmin;
|
|
32
|
+
/** List the public functions available for a collection (discovery). `GET /public/collection/:c/functions`. */
|
|
33
|
+
async function list(collectionId) {
|
|
34
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/functions`;
|
|
35
|
+
return request(path);
|
|
36
|
+
}
|
|
37
|
+
functions.list = list;
|
|
38
|
+
})(functions || (functions = {}));
|
package/dist/api/index.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export { qr } from "./qr.js";
|
|
|
28
28
|
export { template } from "./template.js";
|
|
29
29
|
export { interactions } from "./interactions.js";
|
|
30
30
|
export { analytics } from "./analytics.js";
|
|
31
|
+
export { functions } from "./functions.js";
|
|
31
32
|
export { location } from "./location.js";
|
|
32
33
|
export * as realtime from "./realtime.js";
|
|
33
34
|
export { tags } from "./tags.js";
|
package/dist/api/index.js
CHANGED
|
@@ -30,6 +30,7 @@ export { qr } from "./qr.js";
|
|
|
30
30
|
export { template } from "./template.js";
|
|
31
31
|
export { interactions } from "./interactions.js";
|
|
32
32
|
export { analytics } from "./analytics.js";
|
|
33
|
+
export { functions } from "./functions.js";
|
|
33
34
|
export { location } from "./location.js";
|
|
34
35
|
import * as realtime_1 from "./realtime.js";
|
|
35
36
|
export { realtime_1 as realtime };
|
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.20 | Generated: 2026-09-25T11:48:23.950Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -135,6 +135,7 @@ The Smartlinks SDK is organized into the following namespaces:
|
|
|
135
135
|
- **config** - Functions for config operations
|
|
136
136
|
- **containers** - Functions for containers operations
|
|
137
137
|
- **facets** - Functions for facets operations
|
|
138
|
+
- **functions** - Functions for functions operations
|
|
138
139
|
- **http** - Functions for http operations
|
|
139
140
|
- **integrations** - Functions for integrations operations
|
|
140
141
|
- **jobs** - Functions for jobs operations
|
|
@@ -580,6 +581,8 @@ interface ResponsesRequest {
|
|
|
580
581
|
max_concurrent_subagents?: number
|
|
581
582
|
}
|
|
582
583
|
service_tier?: 'auto' | 'standard' | 'flex' | 'priority'
|
|
584
|
+
feature?: string
|
|
585
|
+
session_id?: string
|
|
583
586
|
server_tools?: boolean | AiToolName[]
|
|
584
587
|
allowCapabilities?: AiToolCapability[]
|
|
585
588
|
only?: AiToolName[]
|
|
@@ -857,6 +860,55 @@ interface SessionStatistics {
|
|
|
857
860
|
}
|
|
858
861
|
```
|
|
859
862
|
|
|
863
|
+
**AiSession** (interface)
|
|
864
|
+
```typescript
|
|
865
|
+
interface AiSession {
|
|
866
|
+
id: string
|
|
867
|
+
collectionId: string
|
|
868
|
+
appId?: string | null
|
|
869
|
+
scope: AiSessionScope
|
|
870
|
+
title?: string | null
|
|
871
|
+
status: string
|
|
872
|
+
ownerId?: string | null
|
|
873
|
+
authorId?: string | null
|
|
874
|
+
productId?: string | null
|
|
875
|
+
proofId?: string | null
|
|
876
|
+
feature?: string | null
|
|
877
|
+
items: ResponseInputItem[]
|
|
878
|
+
summary?: Record<string, any>
|
|
879
|
+
usage?: Record<string, any>
|
|
880
|
+
itemCount: number
|
|
881
|
+
lastTurnAt?: string | null
|
|
882
|
+
createdAt: string
|
|
883
|
+
updatedAt: string
|
|
884
|
+
expiresAt?: string | null
|
|
885
|
+
}
|
|
886
|
+
```
|
|
887
|
+
|
|
888
|
+
**AiSessionCreate** (interface)
|
|
889
|
+
```typescript
|
|
890
|
+
interface AiSessionCreate {
|
|
891
|
+
appId?: string
|
|
892
|
+
title?: string
|
|
893
|
+
productId?: string
|
|
894
|
+
proofId?: string
|
|
895
|
+
feature?: string
|
|
896
|
+
ttlMs?: number
|
|
897
|
+
items?: ResponseInputItem[]
|
|
898
|
+
}
|
|
899
|
+
```
|
|
900
|
+
|
|
901
|
+
**AiUsageReport** (interface)
|
|
902
|
+
```typescript
|
|
903
|
+
interface AiUsageReport {
|
|
904
|
+
groupBy: string[]
|
|
905
|
+
from?: string | null
|
|
906
|
+
to?: string | null
|
|
907
|
+
totals: { promptTokens: number; outputTokens: number; totalTokens: number; requests: number; costUnits: number }
|
|
908
|
+
groups: Array<Record<string, any> & { promptTokens: number; outputTokens: number; totalTokens: number; requests: number; costUnits: number }>
|
|
909
|
+
}
|
|
910
|
+
```
|
|
911
|
+
|
|
860
912
|
**VoiceSessionRequest** (interface)
|
|
861
913
|
```typescript
|
|
862
914
|
interface VoiceSessionRequest {
|
|
@@ -1440,6 +1492,8 @@ interface AgentResponseCompletedEvent {
|
|
|
1440
1492
|
}
|
|
1441
1493
|
```
|
|
1442
1494
|
|
|
1495
|
+
**AiSessionScope** = `'admin' | 'owner' | 'public'`
|
|
1496
|
+
|
|
1443
1497
|
**AiToolCapability** = ``
|
|
1444
1498
|
|
|
1445
1499
|
**AiToolName** = ``
|
|
@@ -2102,7 +2156,10 @@ interface ServerFunctionContext {
|
|
|
2102
2156
|
collectionId: string;
|
|
2103
2157
|
appId: string;
|
|
2104
2158
|
sl: any;
|
|
2105
|
-
secrets: {
|
|
2159
|
+
secrets: {
|
|
2160
|
+
get(ref: string): Promise<string | null>;
|
|
2161
|
+
app(ref: string): Promise<string | null>;
|
|
2162
|
+
};
|
|
2106
2163
|
caller: ServerFunctionCaller;
|
|
2107
2164
|
fetch: typeof fetch;
|
|
2108
2165
|
log: (message: string, data?: Record<string, any>) => void;
|
|
@@ -8887,6 +8944,24 @@ type VerifyTokenResponse = {
|
|
|
8887
8944
|
}
|
|
8888
8945
|
```
|
|
8889
8946
|
|
|
8947
|
+
### functions (api)
|
|
8948
|
+
|
|
8949
|
+
**FunctionListEntry** (interface)
|
|
8950
|
+
```typescript
|
|
8951
|
+
interface FunctionListEntry {
|
|
8952
|
+
name: string; visibility?: string; trigger?: string
|
|
8953
|
+
}
|
|
8954
|
+
```
|
|
8955
|
+
|
|
8956
|
+
**FunctionListResponse** (interface)
|
|
8957
|
+
```typescript
|
|
8958
|
+
interface FunctionListResponse {
|
|
8959
|
+
functions: FunctionListEntry[]
|
|
8960
|
+
}
|
|
8961
|
+
```
|
|
8962
|
+
|
|
8963
|
+
**FunctionCallResult** = `any`
|
|
8964
|
+
|
|
8890
8965
|
### sequence (api)
|
|
8891
8966
|
|
|
8892
8967
|
**AllocateSequenceInput** (interface)
|
|
@@ -10379,6 +10454,21 @@ Update a form for a collection (admin only).
|
|
|
10379
10454
|
**remove**(collectionId: string, formId: string) → `Promise<void>`
|
|
10380
10455
|
Delete a form for a collection (admin only).
|
|
10381
10456
|
|
|
10457
|
+
### functions
|
|
10458
|
+
|
|
10459
|
+
**call**(collectionId: string,
|
|
10460
|
+
name: string,
|
|
10461
|
+
body: Record<string, any> = {}) → `Promise<T>`
|
|
10462
|
+
Call a PUBLIC app server function inline. `POST /public/collection/:collectionId/functions/:name` — surface `'public'`. const { value } = await SL.functions.call<{ value: number }>(collectionId, 'increment')
|
|
10463
|
+
|
|
10464
|
+
**callAdmin**(collectionId: string,
|
|
10465
|
+
name: string,
|
|
10466
|
+
body: Record<string, any> = {}) → `Promise<T>`
|
|
10467
|
+
Call an ADMIN app server function (surface `'admin'`; requires an admin session). `POST /admin/collection/:collectionId/functions/:name`.
|
|
10468
|
+
|
|
10469
|
+
**list**(collectionId: string) → `Promise<FunctionListResponse>`
|
|
10470
|
+
List the public functions available for a collection (discovery). `GET /public/collection/:c/functions`.
|
|
10471
|
+
|
|
10382
10472
|
### http
|
|
10383
10473
|
|
|
10384
10474
|
**get**(path: string) → `Promise<T>`
|
|
@@ -11091,6 +11181,27 @@ Check rate limit status
|
|
|
11091
11181
|
request: EphemeralTokenRequest) → `Promise<EphemeralTokenResponse>`
|
|
11092
11182
|
Generate ephemeral token for Gemini Live
|
|
11093
11183
|
|
|
11184
|
+
### publicClient.sessions
|
|
11185
|
+
|
|
11186
|
+
**create**(collectionId: string,
|
|
11187
|
+
body: AiSessionCreate & { scope?: 'owner' | 'public' } = {}) → `Promise<AiSession>`
|
|
11188
|
+
|
|
11189
|
+
**list**(collectionId: string,
|
|
11190
|
+
params?: { appId?: string; limit?: number }) → `Promise<`
|
|
11191
|
+
List the signed-in consumer's own ('owner') sessions — requires an authKit bearer.
|
|
11192
|
+
|
|
11193
|
+
**get**(collectionId: string, id: string) → `Promise<AiSession>`
|
|
11194
|
+
List the signed-in consumer's own ('owner') sessions — requires an authKit bearer.
|
|
11195
|
+
|
|
11196
|
+
**append**(collectionId: string,
|
|
11197
|
+
id: string,
|
|
11198
|
+
items: ResponseInputItem[],
|
|
11199
|
+
opts?: { usage?: Record<string, any> }) → `Promise<AiSession>`
|
|
11200
|
+
List the signed-in consumer's own ('owner') sessions — requires an authKit bearer.
|
|
11201
|
+
|
|
11202
|
+
**clear**(collectionId: string, id: string) → `Promise<`
|
|
11203
|
+
List the signed-in consumer's own ('owner') sessions — requires an authKit bearer.
|
|
11204
|
+
|
|
11094
11205
|
### qr
|
|
11095
11206
|
|
|
11096
11207
|
**lookupShortCode**(shortId: string, code: string) → `Promise<QrShortCodeLookupResponse>`
|
|
@@ -11176,6 +11287,24 @@ Allocate (or return the existing) sequence number for a subject. Idempotent —
|
|
|
11176
11287
|
**stats**(collectionId: string) → `Promise<SessionStatistics>`
|
|
11177
11288
|
Get session statistics
|
|
11178
11289
|
|
|
11290
|
+
**create**(collectionId: string, body: AiSessionCreate = {}) → `Promise<AiSession>`
|
|
11291
|
+
Persisted AI assistant sessions (admin scope) — durable conversation history for admin/host assistants. Create one, then either append your turns explicitly, OR pass its `id` as `session_id` to `ai.chat.responses.create` and the server threads prior turns into the input and persists the new turn automatically (works with `server_tools`).
|
|
11292
|
+
|
|
11293
|
+
**list**(collectionId: string, params?: { appId?: string; limit?: number }) → `Promise<`
|
|
11294
|
+
List sessions, most-recently-active first (optionally filtered by app).
|
|
11295
|
+
|
|
11296
|
+
**get**(collectionId: string, id: string) → `Promise<AiSession>`
|
|
11297
|
+
Get one session, including its full transcript.
|
|
11298
|
+
|
|
11299
|
+
**append**(collectionId: string,
|
|
11300
|
+
id: string,
|
|
11301
|
+
items: ResponseInputItem[],
|
|
11302
|
+
opts?: { usage?: Record<string, any> }) → `Promise<AiSession>`
|
|
11303
|
+
Append Responses items (input/output/tool) to a session — the manual-persistence path.
|
|
11304
|
+
|
|
11305
|
+
**clear**(collectionId: string, id: string) → `Promise<`
|
|
11306
|
+
Archive (soft-delete) a session.
|
|
11307
|
+
|
|
11179
11308
|
### skills
|
|
11180
11309
|
|
|
11181
11310
|
**list**(collectionId: string) → `Promise<SkillsListResponse>`
|
|
@@ -62,12 +62,19 @@ export default defineConfig({
|
|
|
62
62
|
|
|
63
63
|
## Host-provided globals (build against versions ≤ these)
|
|
64
64
|
|
|
65
|
+
> **The SmartLinks packages on the host are always the latest published.** `@proveanything/smartlinks`
|
|
66
|
+
> (and `-utils-ui`, `-auth-ui`) are considered *released* only once Hub and Portal are running them —
|
|
67
|
+
> that's the first place a version lands, by design. So **build against the latest published SmartLinks
|
|
68
|
+
> SDK**; never pin below it. The exact number below is just "current at time of writing" — the rule is
|
|
69
|
+
> *latest*. The third-party framework versions (React, Vite, Router, …) change rarely and are the real
|
|
70
|
+
> compile-time ceiling.
|
|
71
|
+
|
|
65
72
|
| Import | Window global | Host provides (R5) |
|
|
66
73
|
|---|---|---|
|
|
67
74
|
| `react` | `React` | 19.3 (accepts 18.3 builds) |
|
|
68
75
|
| `react-dom` | `ReactDOM` | 19.3 (accepts 18.3 builds) |
|
|
69
76
|
| `react/jsx-runtime` | `jsxRuntime` | 19.3 |
|
|
70
|
-
| `@proveanything/smartlinks` | `SL` | 2.
|
|
77
|
+
| `@proveanything/smartlinks` | `SL` | latest published 2.x (build against latest) |
|
|
71
78
|
| `react-router-dom` | `ReactRouterDOM` | 7.18 (accepts 6.x builds) |
|
|
72
79
|
| `@tanstack/react-query` | `ReactQuery` | 5.103 |
|
|
73
80
|
| `lucide-react` | `LucideReact` | 1.47 |
|
|
@@ -130,10 +137,12 @@ app ships the Tailwind 4 CSS-first layout as the default; see its README.)
|
|
|
130
137
|
## The R5 host stack (reference)
|
|
131
138
|
|
|
132
139
|
React **19.3** · Vite **8.3** · react-router-dom **7.18** · Tailwind **4.3** (CSS-first) ·
|
|
133
|
-
TypeScript **6.0** · ESLint **10.11** ·
|
|
134
|
-
`@proveanything/smartlinks-utils-ui` **1.16.4** · liquidjs **10.29** · marked **12+** ·
|
|
140
|
+
TypeScript **6.0** · ESLint **10.11** · liquidjs **10.29** · marked **12+** ·
|
|
135
141
|
dompurify **3+** · clsx **2+** · tailwind-merge **3+**.
|
|
136
142
|
|
|
143
|
+
The SmartLinks packages (`@proveanything/smartlinks`, `-utils-ui`, `-auth-ui`) are **always the latest
|
|
144
|
+
published 2.x** — see the note above; build against latest, don't pin a specific number here (it rots).
|
|
145
|
+
|
|
137
146
|
> **TypeScript 7** (the native/Go compiler) is **deliberately deferred** — tooling hasn't settled.
|
|
138
147
|
> Target **TS 6** for R5; it compiles existing code with no source changes.
|
|
139
148
|
|