@proveanything/smartlinks 2.0.26 → 2.0.29

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.
@@ -139,6 +139,17 @@ export interface ResponsesRequest {
139
139
  exclude?: AiToolName[];
140
140
  /** With `server_tools`: cap model round-trips (1–12, default 8). */
141
141
  maxSteps?: number;
142
+ /**
143
+ * With `server_tools`: ALSO offer an installed app's AI-exposed server functions (those declaring
144
+ * `ai.tool: true`) as tools, alongside the built-ins. Their visibility/authority/capabilities are
145
+ * enforced unchanged — the agent is just another caller surface.
146
+ */
147
+ app_functions?: AgentAppFunctionsOption;
148
+ /**
149
+ * Unified toolbelt (preferred over server_tools/app_functions): built-ins + app functions (+ reserved
150
+ * client tools) in one declaration. Providing it opts the request into the agentic loop.
151
+ */
152
+ toolbelt?: AgentToolbelt;
142
153
  }
143
154
  /** Response from the Responses API. */
144
155
  export interface ResponsesResult {
@@ -681,12 +692,124 @@ export interface AgentRunRequest {
681
692
  only?: string[];
682
693
  /** Drop these tool names. */
683
694
  exclude?: string[];
695
+ /** Also offer an installed app's AI-exposed server functions as tools (see AgentAppFunctionsOption). */
696
+ appFunctions?: AgentAppFunctionsOption;
697
+ /** Unified toolbelt (preferred): built-ins + app functions (+ reserved client tools) in one place. */
698
+ toolbelt?: AgentToolbelt;
699
+ }
700
+ /**
701
+ * Include an installed app's AI-exposed server functions (those declaring `ai.tool: true`) in an
702
+ * agent run as callable tools, alongside the built-in tools. The function's
703
+ * visibility/authority/capabilities are enforced unchanged — the agent is just another caller.
704
+ */
705
+ export interface AgentAppFunctionsOption {
706
+ /** The app whose functions to expose (the master app id). */
707
+ appId: string;
708
+ /** Release channel to resolve the app's functions from (default 'stable'; pass 'dev' to test). */
709
+ channel?: string;
710
+ /** Restrict to these function names. */
711
+ only?: string[];
712
+ }
713
+ /**
714
+ * The unified TOOLBELT for an agent run — one declaration spanning every tool KIND:
715
+ * - `builtins` — SmartLinks built-in tools (`true` = all, `[names]` = a subset, omit/`false` = none).
716
+ * - `appFunctions` — one or more installed apps' AI-exposed server functions.
717
+ * - `clientTools` — front-end tools executed in the caller's page (RESERVED — the client-tool bridge
718
+ * is staged; declaring them has no effect until it ships).
719
+ * Precedence on a name clash: a built-in wins, then earlier `appFunctions` sources win over later ones.
720
+ * On the public surface, `builtins: true` is not honoured (built-ins there are an explicit allowlist).
721
+ */
722
+ export interface AgentToolbelt {
723
+ builtins?: boolean | AiToolName[];
724
+ appFunctions?: AgentAppFunctionsOption | AgentAppFunctionsOption[];
725
+ /** RESERVED — front-end/client tools (executed via the client-tool bridge; not yet active). */
726
+ clientTools?: ClientToolDeclaration[];
727
+ }
728
+ /** A front-end/client tool the model may call that the caller's page executes (see ai.runWithClientTools). */
729
+ export interface ClientToolDeclaration {
730
+ name: string;
731
+ description?: string;
732
+ /** JSON Schema for the arguments the model supplies. */
733
+ input?: Record<string, any>;
734
+ }
735
+ /** A pending client-tool invocation the agent loop suspended on — the caller runs it and resubmits. */
736
+ export interface ClientToolCall {
737
+ callId: string;
738
+ name: string;
739
+ args: Record<string, any>;
740
+ }
741
+ /** The suspend response when the model calls a client tool: run each call, then resubmit items+outputs. */
742
+ export interface RequiresActionResult {
743
+ status: 'requires_action';
744
+ client_tool_calls: ClientToolCall[];
745
+ /** The transcript so far — resubmit as `input` with a function_call_output appended per call. */
746
+ items: any[];
747
+ steps?: number;
748
+ toolResults?: AgentToolResult[];
749
+ availableTools?: string[];
750
+ }
751
+ /** A client tool bound to its browser-side handler (build with ai.defineClientTool). */
752
+ export interface ClientTool {
753
+ declaration: ClientToolDeclaration;
754
+ handler: (args: Record<string, any>) => any | Promise<any>;
755
+ }
756
+ /** Options for ai.runWithClientTools — the browser-side loop that resolves client tools automatically. */
757
+ export interface RunWithClientToolsOptions {
758
+ input: string;
759
+ tools: ClientTool[];
760
+ /** Which agent surface to run on: 'admin' (default) or 'public' (consumer). */
761
+ surface?: 'admin' | 'public';
762
+ instructions?: string;
763
+ model?: string;
764
+ maxSteps?: number;
765
+ /** Built-ins + app functions to include alongside the client tools. */
766
+ toolbelt?: AgentToolbelt;
767
+ /** Safety cap on client round-trips (default 8). */
768
+ maxRounds?: number;
769
+ }
770
+ /**
771
+ * Body for the PUBLIC agent loop (`ai.publicClient.agentRun`). The consumer-surface equivalent of
772
+ * AgentRunRequest: the caller is the signed-in consumer (authKit bearer → 'owner') or anonymous
773
+ * ('public'), and tools run at that authority. Its main use is exposing an app's PUBLIC functions.
774
+ * SAFETY: built-in tools are opt-in by EXPLICIT allowlist only — `server_tools` here is an array, not
775
+ * a boolean (there is no "all built-ins" on the public surface).
776
+ */
777
+ export interface PublicAgentRunRequest {
778
+ input?: string;
779
+ prompt?: string;
780
+ instructions?: string;
781
+ model?: string;
782
+ maxSteps?: number;
783
+ /** Built-in tools to allow (explicit list; no `true`=all on the public surface). */
784
+ server_tools?: AiToolName[];
785
+ /** Alias of server_tools[] — restrict built-ins to these names. */
786
+ only?: AiToolName[];
787
+ /** Drop these built-in tool names. */
788
+ exclude?: AiToolName[];
789
+ /** Cap blast radius: only built-ins whose capabilities are all granted. */
790
+ allowCapabilities?: AiToolCapability[];
791
+ /** Include an installed app's PUBLIC AI functions as tools. */
792
+ appFunctions?: AgentAppFunctionsOption;
793
+ /** Unified toolbelt. On the public surface `builtins` is an explicit allowlist (no `true`=all). */
794
+ toolbelt?: AgentToolbelt;
795
+ /** Rate-limit key for anonymous callers (else derived from the bearer/IP). */
796
+ userId?: string;
684
797
  }
685
798
  export interface AgentToolResult {
686
799
  name: string;
687
800
  isError: boolean;
688
801
  result: any;
689
802
  }
803
+ /**
804
+ * Result of a DIRECT single-tool invocation (`ai.tools.run`) — no model in the loop.
805
+ * Mirrors one AgentToolResult but typed to the tool's own result. `result` is the tool's
806
+ * raw output; deterministic tools may still put a tool-level `{ error }` inside it.
807
+ */
808
+ export interface ToolRunResult<T = any> {
809
+ name: string;
810
+ isError: boolean;
811
+ result: T;
812
+ }
690
813
  export interface AgentRunResult {
691
814
  finalText: string | null;
692
815
  steps: number;
@@ -725,7 +848,7 @@ export interface CatalogResponse {
725
848
  /** Capability tags a tool requires; scope a run with `allowCapabilities`. */
726
849
  export type AiToolCapability = 'web:read' | 'ai:vision' | 'ai:image' | 'ai:text' | 'media:image' | 'media:pdf' | 'net:http';
727
850
  /** The names of the built-in server-side agent tools (run via `server_tools`). */
728
- 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' | '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';
729
852
  export interface WebFetchPageArgs {
730
853
  url: string;
731
854
  type?: string;
@@ -817,6 +940,34 @@ export interface PdfFillArgs {
817
940
  export interface PdfMergeArgs {
818
941
  urls: string[];
819
942
  }
943
+ export interface PdfInspectArgs {
944
+ url: string;
945
+ maxPages?: number;
946
+ minTextChars?: number;
947
+ }
948
+ export interface PdfRenderArgs {
949
+ url: string;
950
+ page?: number;
951
+ dpi?: number;
952
+ }
953
+ export interface PdfExtractArgs {
954
+ url: string;
955
+ schema?: Record<string, any>;
956
+ prompt?: string;
957
+ maxPages?: number;
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;
970
+ }
820
971
  export interface HttpRequestArgs {
821
972
  url: string;
822
973
  method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD';
@@ -845,6 +996,11 @@ export interface AiToolArgsMap {
845
996
  'pdf.create': PdfCreateArgs;
846
997
  'pdf.fill': PdfFillArgs;
847
998
  'pdf.merge': PdfMergeArgs;
999
+ 'pdf.inspect': PdfInspectArgs;
1000
+ 'pdf.render': PdfRenderArgs;
1001
+ 'pdf.extract': PdfExtractArgs;
1002
+ 'pdf.decodeBarcodes': PdfDecodeBarcodesArgs;
1003
+ 'pdf.inspectGraphics': PdfInspectGraphicsArgs;
848
1004
  'http.request': HttpRequestArgs;
849
1005
  'translate': TranslateArgs;
850
1006
  }
@@ -905,6 +1061,86 @@ export interface TranslateResult {
905
1061
  translations: Record<string, string>;
906
1062
  sourceLanguage: string;
907
1063
  }
1064
+ /** One page's structure from pdf.inspect. */
1065
+ export interface PdfInspectPage {
1066
+ page: number;
1067
+ width: number;
1068
+ height: number;
1069
+ textChars: number;
1070
+ hasText: boolean;
1071
+ imageCount: number;
1072
+ likelyType: 'text-native' | 'text+raster' | 'raster-only' | 'curve-only';
1073
+ }
1074
+ export interface PdfInspectResult {
1075
+ url: string;
1076
+ pageCount: number;
1077
+ inspectedPages: number;
1078
+ totalTextChars: number;
1079
+ isTextNative: boolean;
1080
+ isCurveOnly: boolean;
1081
+ recommendedPath: 'text' | 'vision';
1082
+ note: string;
1083
+ pages: PdfInspectPage[];
1084
+ }
1085
+ export interface PdfRenderResult {
1086
+ url: string | null;
1087
+ page: number;
1088
+ pageCount: number;
1089
+ dpi: number;
1090
+ width: number;
1091
+ height: number;
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
+ }
1105
+ export interface PdfExtractResult {
1106
+ url: string;
1107
+ method: 'text' | 'vision';
1108
+ pagesRead: number;
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;
1143
+ }
908
1144
  /** The `_agent` trace attached to an agentic Responses result. */
909
1145
  export interface ResponsesAgentTrace {
910
1146
  steps: number;
@@ -271,6 +271,34 @@ export interface AppFunctionDef {
271
271
  apiVersion?: string;
272
272
  /** Exported handler name in the functions bundle. Defaults to `name`. */
273
273
  handler?: string;
274
+ /**
275
+ * Expose this function to the AI agent as a callable tool (an MCP-shaped facade over the function).
276
+ * Only `http`-trigger functions can be exposed. The agent becomes just another caller surface, so
277
+ * the function's visibility/authority/capabilities apply UNCHANGED — nothing new is granted. The
278
+ * agent-supplied arguments arrive as the function's http request `body`. See agent-tools.md.
279
+ */
280
+ agent?: AppFunctionAgentExposure;
281
+ }
282
+ /** Opt-in that turns a server function into an agent-callable tool. See agent-tools.md. */
283
+ export interface AppFunctionAgentExposure {
284
+ /** When true, offer this `http` function to the agent as a tool. */
285
+ tool: boolean;
286
+ /** Short human label for the tool (tool pickers / approval prompts). */
287
+ title?: string;
288
+ /** Model-facing description — when to use the tool (falls back to the function's `description`). */
289
+ description?: string;
290
+ /**
291
+ * JSON Schema (`{ type: 'object', properties: … }`) for the arguments the agent supplies. They
292
+ * arrive as the function's http request body. Strongly recommended — without it the agent is told
293
+ * the tool takes a free-form object.
294
+ */
295
+ input?: Record<string, any>;
296
+ /**
297
+ * `'auto'` (default) = the agent may call it without confirmation. `'require'` = a human must
298
+ * confirm before each call. Until the human-approval UX ships, `'require'` tools are NOT offered to
299
+ * the autonomous server-side loop (they'd otherwise run unconfirmed).
300
+ */
301
+ approval?: 'auto' | 'require';
274
302
  }
275
303
  /** The `functions` block in `app.manifest.json`. Presence means the app ships server functions. */
276
304
  export interface AppManifestFunctions {
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 2.0.26 | Generated: 2026-09-28T11:34:04.010Z
3
+ Version: 2.0.29 | Generated: 2026-09-29T10:33:46.286Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -594,6 +594,8 @@ interface ResponsesRequest {
594
594
  only?: AiToolName[]
595
595
  exclude?: AiToolName[]
596
596
  maxSteps?: number
597
+ app_functions?: AgentAppFunctionsOption
598
+ toolbelt?: AgentToolbelt
597
599
  }
598
600
  ```
599
601
 
@@ -1177,6 +1179,96 @@ interface AgentRunRequest {
1177
1179
  allowCapabilities?: string[]
1178
1180
  only?: string[]
1179
1181
  exclude?: string[]
1182
+ appFunctions?: AgentAppFunctionsOption
1183
+ toolbelt?: AgentToolbelt
1184
+ }
1185
+ ```
1186
+
1187
+ **AgentAppFunctionsOption** (interface)
1188
+ ```typescript
1189
+ interface AgentAppFunctionsOption {
1190
+ appId: string
1191
+ channel?: string
1192
+ only?: string[]
1193
+ }
1194
+ ```
1195
+
1196
+ **AgentToolbelt** (interface)
1197
+ ```typescript
1198
+ interface AgentToolbelt {
1199
+ builtins?: boolean | AiToolName[]
1200
+ appFunctions?: AgentAppFunctionsOption | AgentAppFunctionsOption[]
1201
+ clientTools?: ClientToolDeclaration[]
1202
+ }
1203
+ ```
1204
+
1205
+ **ClientToolDeclaration** (interface)
1206
+ ```typescript
1207
+ interface ClientToolDeclaration {
1208
+ name: string
1209
+ description?: string
1210
+ input?: Record<string, any>
1211
+ }
1212
+ ```
1213
+
1214
+ **ClientToolCall** (interface)
1215
+ ```typescript
1216
+ interface ClientToolCall {
1217
+ callId: string
1218
+ name: string
1219
+ args: Record<string, any>
1220
+ }
1221
+ ```
1222
+
1223
+ **RequiresActionResult** (interface)
1224
+ ```typescript
1225
+ interface RequiresActionResult {
1226
+ status: 'requires_action'
1227
+ client_tool_calls: ClientToolCall[]
1228
+ items: any[]
1229
+ steps?: number
1230
+ toolResults?: AgentToolResult[]
1231
+ availableTools?: string[]
1232
+ }
1233
+ ```
1234
+
1235
+ **ClientTool** (interface)
1236
+ ```typescript
1237
+ interface ClientTool {
1238
+ declaration: ClientToolDeclaration
1239
+ handler: (args: Record<string, any>) => any | Promise<any>
1240
+ }
1241
+ ```
1242
+
1243
+ **RunWithClientToolsOptions** (interface)
1244
+ ```typescript
1245
+ interface RunWithClientToolsOptions {
1246
+ input: string
1247
+ tools: ClientTool[]
1248
+ surface?: 'admin' | 'public'
1249
+ instructions?: string
1250
+ model?: string
1251
+ maxSteps?: number
1252
+ toolbelt?: AgentToolbelt
1253
+ maxRounds?: number
1254
+ }
1255
+ ```
1256
+
1257
+ **PublicAgentRunRequest** (interface)
1258
+ ```typescript
1259
+ interface PublicAgentRunRequest {
1260
+ input?: string
1261
+ prompt?: string
1262
+ instructions?: string
1263
+ model?: string
1264
+ maxSteps?: number
1265
+ server_tools?: AiToolName[]
1266
+ only?: AiToolName[]
1267
+ exclude?: AiToolName[]
1268
+ allowCapabilities?: AiToolCapability[]
1269
+ appFunctions?: AgentAppFunctionsOption
1270
+ toolbelt?: AgentToolbelt
1271
+ userId?: string
1180
1272
  }
1181
1273
  ```
1182
1274
 
@@ -1189,6 +1281,15 @@ interface AgentToolResult {
1189
1281
  }
1190
1282
  ```
1191
1283
 
1284
+ **ToolRunResult<T = any>** (interface)
1285
+ ```typescript
1286
+ interface ToolRunResult<T = any> {
1287
+ name: string
1288
+ isError: boolean
1289
+ result: T
1290
+ }
1291
+ ```
1292
+
1192
1293
  **AgentRunResult** (interface)
1193
1294
  ```typescript
1194
1295
  interface AgentRunResult {
@@ -1367,6 +1468,41 @@ interface PdfMergeArgs {
1367
1468
  }
1368
1469
  ```
1369
1470
 
1471
+ **PdfInspectArgs** (interface)
1472
+ ```typescript
1473
+ interface PdfInspectArgs {
1474
+ url: string; maxPages?: number; minTextChars?: number
1475
+ }
1476
+ ```
1477
+
1478
+ **PdfRenderArgs** (interface)
1479
+ ```typescript
1480
+ interface PdfRenderArgs {
1481
+ url: string; page?: number; dpi?: number
1482
+ }
1483
+ ```
1484
+
1485
+ **PdfExtractArgs** (interface)
1486
+ ```typescript
1487
+ interface PdfExtractArgs {
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
1503
+ }
1504
+ ```
1505
+
1370
1506
  **HttpRequestArgs** (interface)
1371
1507
  ```typescript
1372
1508
  interface HttpRequestArgs {
@@ -1399,6 +1535,11 @@ interface AiToolArgsMap {
1399
1535
  'pdf.create': PdfCreateArgs
1400
1536
  'pdf.fill': PdfFillArgs
1401
1537
  'pdf.merge': PdfMergeArgs
1538
+ 'pdf.inspect': PdfInspectArgs
1539
+ 'pdf.render': PdfRenderArgs
1540
+ 'pdf.extract': PdfExtractArgs
1541
+ 'pdf.decodeBarcodes': PdfDecodeBarcodesArgs
1542
+ 'pdf.inspectGraphics': PdfInspectGraphicsArgs
1402
1543
  'http.request': HttpRequestArgs
1403
1544
  'translate': TranslateArgs
1404
1545
  }
@@ -1467,6 +1608,69 @@ interface TranslateResult {
1467
1608
  }
1468
1609
  ```
1469
1610
 
1611
+ **PdfInspectPage** (interface)
1612
+ ```typescript
1613
+ interface PdfInspectPage {
1614
+ page: number; width: number; height: number; textChars: number; hasText: boolean; imageCount: number; likelyType: 'text-native' | 'text+raster' | 'raster-only' | 'curve-only'
1615
+ }
1616
+ ```
1617
+
1618
+ **PdfInspectResult** (interface)
1619
+ ```typescript
1620
+ interface PdfInspectResult {
1621
+ url: string; pageCount: number; inspectedPages: number; totalTextChars: number; isTextNative: boolean; isCurveOnly: boolean; recommendedPath: 'text' | 'vision'; note: string; pages: PdfInspectPage[]
1622
+ }
1623
+ ```
1624
+
1625
+ **PdfRenderResult** (interface)
1626
+ ```typescript
1627
+ interface PdfRenderResult {
1628
+ url: string | null; page: number; pageCount: number; dpi: number; width: number; height: number
1629
+ }
1630
+ ```
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
+
1639
+ **PdfExtractResult** (interface)
1640
+ ```typescript
1641
+ interface PdfExtractResult {
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
1671
+ }
1672
+ ```
1673
+
1470
1674
  **ResponsesAgentTrace** (interface)
1471
1675
  ```typescript
1472
1676
  interface ResponsesAgentTrace {
@@ -2135,6 +2339,18 @@ interface AppFunctionDef {
2135
2339
  dataScope?: 'collection' | 'global';
2136
2340
  apiVersion?: string;
2137
2341
  handler?: string;
2342
+ agent?: AppFunctionAgentExposure;
2343
+ }
2344
+ ```
2345
+
2346
+ **AppFunctionAgentExposure** (interface)
2347
+ ```typescript
2348
+ interface AppFunctionAgentExposure {
2349
+ tool: boolean;
2350
+ title?: string;
2351
+ description?: string;
2352
+ input?: Record<string, any>;
2353
+ approval?: 'auto' | 'require';
2138
2354
  }
2139
2355
  ```
2140
2356
 
@@ -11250,6 +11466,10 @@ Get the active transfer/status for a proof (owner, collection admin, or the name
11250
11466
  request: PublicChatRequest) → `Promise<PublicChatResponse>`
11251
11467
  Chat with product assistant (RAG)
11252
11468
 
11469
+ **agentRun**(collectionId: string,
11470
+ body: PublicAgentRunRequest) → `Promise<AgentRunResult>`
11471
+ Public agent loop — run the orchestration-neutral tool loop on the consumer surface. Exposes an app's PUBLIC server functions (`agent.tool:true`, `visibility:'public'`) to a consumer assistant; built-in tools are opt-in by explicit `server_tools[]` allowlist only. The caller runs as the signed-in consumer ('owner', send the authKit bearer) or anonymous ('public'). POST /public/collection/:collectionId/ai/agent/run
11472
+
11253
11473
  **getSession**(collectionId: string, sessionId: string) → `Promise<Session>`
11254
11474
  Get session history
11255
11475
 
@@ -11483,6 +11703,22 @@ Reverse lookup by ref via POST (public). `POST /public/collection/:collectionId/
11483
11703
  **renderSource**(collectionId: string,
11484
11704
  body: TemplateRenderSourceRequest) → `Promise<TemplateRenderSourceResponse>`
11485
11705
 
11706
+ ### tools
11707
+
11708
+ **run**(collectionId: string,
11709
+ name: K,
11710
+ args: AiToolArgsMap[K],) → `Promise<ToolRunResult>
11711
+ export async function run<T = any>(
11712
+ collectionId: string,
11713
+ name: string,
11714
+ args?: Record<string, any>,
11715
+ ): Promise<ToolRunResult<T>>
11716
+ export async function run(
11717
+ collectionId: string,
11718
+ name: string,
11719
+ args: Record<string, any> =`
11720
+ Invoke ONE built-in server tool directly — no model in the loop. This is the "direct code" caller of the orchestration-neutral tool registry: the SAME tools the agent loop and the Responses `server_tools` path run, but called as a plain, typed, deterministic API. A front end can use it two ways: (1) call a tool straight as an API (e.g. `pdf.render` / `pdf.extract` behind a PDF UX), or (2) drive its OWN agent loop and execute each model tool-call here. Capability-gated server-side to the caller's grants (same blast-radius rules as the agent loop). POST /admin/collection/:collectionId/ai/tools/:name/run
11721
+
11486
11722
  ### translations
11487
11723
 
11488
11724
  **hashText**(text: string, options?: TranslationHashOptions) → `Promise<string>`
@@ -69,6 +69,34 @@ The platform derives an **MCP tool list** from your manifest and drives the stan
69
69
  → `tools/call` → structured result — with streaming, cancellation, and approval layered on. You don't
70
70
  implement the wire protocol; you declare tools and write handlers. (The live loop is the staged part.)
71
71
 
72
+ ## Client tools (front-end)
73
+
74
+ For genuinely UI-coupled actions — read a field the user is editing, open a picker, update on-page
75
+ state — declare a **client tool**: the model calls it, but it runs in your page, not on the server.
76
+ Build each with `ai.defineClientTool` and drive the loop with `ai.runWithClientTools`, which resolves
77
+ every client call automatically (suspend → run handler → resubmit) until the assistant answers:
78
+
79
+ ```ts
80
+ const pickDate = SL.ai.defineClientTool(
81
+ 'ui.pickDate',
82
+ { description: 'Open the date picker and return the chosen ISO date.',
83
+ input: { type: 'object', properties: { min: { type: 'string' } } } },
84
+ async ({ min }) => ({ date: await openDatePicker({ min }) }) // runs in the browser
85
+ )
86
+
87
+ const result = await SL.ai.runWithClientTools(collectionId, {
88
+ input: 'Book me the earliest slot next week',
89
+ tools: [pickDate],
90
+ toolbelt: { builtins: ['web.search'], appFunctions: [{ appId: 'booking' }] }, // mix all three kinds
91
+ // surface: 'public' // for a consumer assistant
92
+ })
93
+ ```
94
+
95
+ The handler runs with the user's own session (auto-scoped), and only tools you declared can be called
96
+ (a call for anything else throws). A client-tool name can never collide with a built-in or a server
97
+ function — those always win. This is the third tool **kind**, alongside built-in tools and app
98
+ functions, all declared together in one `toolbelt`.
99
+
72
100
  ## Security
73
101
 
74
102
  Identical to server functions — nothing new to reason about: