@proveanything/smartlinks 2.0.18 → 2.0.19

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 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
  */
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 2.0.18 | Generated: 2026-09-24T11:49:54.037Z
3
+ Version: 2.0.19 | Generated: 2026-09-24T19:51:28.993Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -580,6 +580,8 @@ interface ResponsesRequest {
580
580
  max_concurrent_subagents?: number
581
581
  }
582
582
  service_tier?: 'auto' | 'standard' | 'flex' | 'priority'
583
+ feature?: string
584
+ session_id?: string
583
585
  server_tools?: boolean | AiToolName[]
584
586
  allowCapabilities?: AiToolCapability[]
585
587
  only?: AiToolName[]
@@ -857,6 +859,55 @@ interface SessionStatistics {
857
859
  }
858
860
  ```
859
861
 
862
+ **AiSession** (interface)
863
+ ```typescript
864
+ interface AiSession {
865
+ id: string
866
+ collectionId: string
867
+ appId?: string | null
868
+ scope: AiSessionScope
869
+ title?: string | null
870
+ status: string
871
+ ownerId?: string | null
872
+ authorId?: string | null
873
+ productId?: string | null
874
+ proofId?: string | null
875
+ feature?: string | null
876
+ items: ResponseInputItem[]
877
+ summary?: Record<string, any>
878
+ usage?: Record<string, any>
879
+ itemCount: number
880
+ lastTurnAt?: string | null
881
+ createdAt: string
882
+ updatedAt: string
883
+ expiresAt?: string | null
884
+ }
885
+ ```
886
+
887
+ **AiSessionCreate** (interface)
888
+ ```typescript
889
+ interface AiSessionCreate {
890
+ appId?: string
891
+ title?: string
892
+ productId?: string
893
+ proofId?: string
894
+ feature?: string
895
+ ttlMs?: number
896
+ items?: ResponseInputItem[]
897
+ }
898
+ ```
899
+
900
+ **AiUsageReport** (interface)
901
+ ```typescript
902
+ interface AiUsageReport {
903
+ groupBy: string[]
904
+ from?: string | null
905
+ to?: string | null
906
+ totals: { promptTokens: number; outputTokens: number; totalTokens: number; requests: number; costUnits: number }
907
+ groups: Array<Record<string, any> & { promptTokens: number; outputTokens: number; totalTokens: number; requests: number; costUnits: number }>
908
+ }
909
+ ```
910
+
860
911
  **VoiceSessionRequest** (interface)
861
912
  ```typescript
862
913
  interface VoiceSessionRequest {
@@ -1440,6 +1491,8 @@ interface AgentResponseCompletedEvent {
1440
1491
  }
1441
1492
  ```
1442
1493
 
1494
+ **AiSessionScope** = `'admin' | 'owner' | 'public'`
1495
+
1443
1496
  **AiToolCapability** = ``
1444
1497
 
1445
1498
  **AiToolName** = ``
@@ -2102,7 +2155,10 @@ interface ServerFunctionContext {
2102
2155
  collectionId: string;
2103
2156
  appId: string;
2104
2157
  sl: any;
2105
- secrets: { get(ref: string): Promise<string | null> };
2158
+ secrets: {
2159
+ get(ref: string): Promise<string | null>;
2160
+ app(ref: string): Promise<string | null>;
2161
+ };
2106
2162
  caller: ServerFunctionCaller;
2107
2163
  fetch: typeof fetch;
2108
2164
  log: (message: string, data?: Record<string, any>) => void;
@@ -11091,6 +11147,27 @@ Check rate limit status
11091
11147
  request: EphemeralTokenRequest) → `Promise<EphemeralTokenResponse>`
11092
11148
  Generate ephemeral token for Gemini Live
11093
11149
 
11150
+ ### publicClient.sessions
11151
+
11152
+ **create**(collectionId: string,
11153
+ body: AiSessionCreate & { scope?: 'owner' | 'public' } = {}) → `Promise<AiSession>`
11154
+
11155
+ **list**(collectionId: string,
11156
+ params?: { appId?: string; limit?: number }) → `Promise<`
11157
+ List the signed-in consumer's own ('owner') sessions — requires an authKit bearer.
11158
+
11159
+ **get**(collectionId: string, id: string) → `Promise<AiSession>`
11160
+ List the signed-in consumer's own ('owner') sessions — requires an authKit bearer.
11161
+
11162
+ **append**(collectionId: string,
11163
+ id: string,
11164
+ items: ResponseInputItem[],
11165
+ opts?: { usage?: Record<string, any> }) → `Promise<AiSession>`
11166
+ List the signed-in consumer's own ('owner') sessions — requires an authKit bearer.
11167
+
11168
+ **clear**(collectionId: string, id: string) → `Promise<`
11169
+ List the signed-in consumer's own ('owner') sessions — requires an authKit bearer.
11170
+
11094
11171
  ### qr
11095
11172
 
11096
11173
  **lookupShortCode**(shortId: string, code: string) → `Promise<QrShortCodeLookupResponse>`
@@ -11176,6 +11253,24 @@ Allocate (or return the existing) sequence number for a subject. Idempotent —
11176
11253
  **stats**(collectionId: string) → `Promise<SessionStatistics>`
11177
11254
  Get session statistics
11178
11255
 
11256
+ **create**(collectionId: string, body: AiSessionCreate = {}) → `Promise<AiSession>`
11257
+ 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`).
11258
+
11259
+ **list**(collectionId: string, params?: { appId?: string; limit?: number }) → `Promise<`
11260
+ List sessions, most-recently-active first (optionally filtered by app).
11261
+
11262
+ **get**(collectionId: string, id: string) → `Promise<AiSession>`
11263
+ Get one session, including its full transcript.
11264
+
11265
+ **append**(collectionId: string,
11266
+ id: string,
11267
+ items: ResponseInputItem[],
11268
+ opts?: { usage?: Record<string, any> }) → `Promise<AiSession>`
11269
+ Append Responses items (input/output/tool) to a session — the manual-persistence path.
11270
+
11271
+ **clear**(collectionId: string, id: string) → `Promise<`
11272
+ Archive (soft-delete) a session.
11273
+
11179
11274
  ### skills
11180
11275
 
11181
11276
  **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.0.5 |
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** · `@proveanything/smartlinks` **2.0.5** ·
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