@proveanything/smartlinks 2.0.25 → 2.0.28
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 +3 -0
- package/dist/ai-tools.js +9 -0
- package/dist/api/ai.d.ts +46 -1
- package/dist/api/ai.js +75 -0
- package/dist/docs/API_SUMMARY.md +186 -1
- package/dist/docs/agent-tools.md +28 -0
- package/dist/docs/server-functions.md +90 -0
- package/dist/openapi.yaml +346 -0
- package/dist/types/ai.d.ts +179 -1
- package/dist/types/appManifest.d.ts +28 -0
- package/docs/API_SUMMARY.md +186 -1
- package/docs/agent-tools.md +28 -0
- package/docs/server-functions.md +90 -0
- package/openapi.yaml +346 -0
- package/package.json +1 -1
package/dist/openapi.yaml
CHANGED
|
@@ -16,6 +16,8 @@ tags:
|
|
|
16
16
|
description: Chat completion generation.
|
|
17
17
|
- name: agent
|
|
18
18
|
description: Agent orchestration and tool-calling.
|
|
19
|
+
- name: tools
|
|
20
|
+
description: tools API
|
|
19
21
|
- name: skills
|
|
20
22
|
description: Reusable agent skills.
|
|
21
23
|
- name: models
|
|
@@ -1239,6 +1241,45 @@ paths:
|
|
|
1239
1241
|
description: Unauthorized
|
|
1240
1242
|
404:
|
|
1241
1243
|
description: Not found
|
|
1244
|
+
/admin/collection/{collectionId}/ai/tools/{name}/run:
|
|
1245
|
+
post:
|
|
1246
|
+
tags:
|
|
1247
|
+
- tools
|
|
1248
|
+
summary: tools.run
|
|
1249
|
+
operationId: tools_run
|
|
1250
|
+
security:
|
|
1251
|
+
- bearerAuth: []
|
|
1252
|
+
parameters:
|
|
1253
|
+
- name: collectionId
|
|
1254
|
+
in: path
|
|
1255
|
+
required: true
|
|
1256
|
+
schema:
|
|
1257
|
+
type: string
|
|
1258
|
+
- name: name
|
|
1259
|
+
in: path
|
|
1260
|
+
required: true
|
|
1261
|
+
schema:
|
|
1262
|
+
type: string
|
|
1263
|
+
responses:
|
|
1264
|
+
200:
|
|
1265
|
+
description: Success
|
|
1266
|
+
content:
|
|
1267
|
+
application/json:
|
|
1268
|
+
schema:
|
|
1269
|
+
$ref: "#/components/schemas/ToolRunResult"
|
|
1270
|
+
400:
|
|
1271
|
+
description: Bad request
|
|
1272
|
+
401:
|
|
1273
|
+
description: Unauthorized
|
|
1274
|
+
404:
|
|
1275
|
+
description: Not found
|
|
1276
|
+
requestBody:
|
|
1277
|
+
required: true
|
|
1278
|
+
content:
|
|
1279
|
+
application/json:
|
|
1280
|
+
schema:
|
|
1281
|
+
type: object
|
|
1282
|
+
additionalProperties: true
|
|
1242
1283
|
/admin/collection/{collectionId}/ai/tts:
|
|
1243
1284
|
post:
|
|
1244
1285
|
tags:
|
|
@@ -10390,6 +10431,38 @@ paths:
|
|
|
10390
10431
|
description: Unauthorized
|
|
10391
10432
|
404:
|
|
10392
10433
|
description: Not found
|
|
10434
|
+
/public/collection/{collectionId}/ai/agent/run:
|
|
10435
|
+
post:
|
|
10436
|
+
tags:
|
|
10437
|
+
- publicClient
|
|
10438
|
+
summary: Public agent loop — run the orchestration-neutral tool loop on the consumer surface.
|
|
10439
|
+
operationId: publicClient_agentRun
|
|
10440
|
+
security: []
|
|
10441
|
+
parameters:
|
|
10442
|
+
- name: collectionId
|
|
10443
|
+
in: path
|
|
10444
|
+
required: true
|
|
10445
|
+
schema:
|
|
10446
|
+
type: string
|
|
10447
|
+
responses:
|
|
10448
|
+
200:
|
|
10449
|
+
description: Success
|
|
10450
|
+
content:
|
|
10451
|
+
application/json:
|
|
10452
|
+
schema:
|
|
10453
|
+
$ref: "#/components/schemas/AgentRunResult"
|
|
10454
|
+
400:
|
|
10455
|
+
description: Bad request
|
|
10456
|
+
401:
|
|
10457
|
+
description: Unauthorized
|
|
10458
|
+
404:
|
|
10459
|
+
description: Not found
|
|
10460
|
+
requestBody:
|
|
10461
|
+
required: true
|
|
10462
|
+
content:
|
|
10463
|
+
application/json:
|
|
10464
|
+
schema:
|
|
10465
|
+
$ref: "#/components/schemas/PublicAgentRunRequest"
|
|
10393
10466
|
/public/collection/{collectionId}/ai/chat:
|
|
10394
10467
|
post:
|
|
10395
10468
|
tags:
|
|
@@ -15499,6 +15572,10 @@ components:
|
|
|
15499
15572
|
$ref: "#/components/schemas/AiToolName"
|
|
15500
15573
|
maxSteps:
|
|
15501
15574
|
type: number
|
|
15575
|
+
app_functions:
|
|
15576
|
+
$ref: "#/components/schemas/AgentAppFunctionsOption"
|
|
15577
|
+
toolbelt:
|
|
15578
|
+
$ref: "#/components/schemas/AgentToolbelt"
|
|
15502
15579
|
required:
|
|
15503
15580
|
- enabled
|
|
15504
15581
|
ResponsesResult:
|
|
@@ -16530,6 +16607,162 @@ components:
|
|
|
16530
16607
|
type: array
|
|
16531
16608
|
items:
|
|
16532
16609
|
type: string
|
|
16610
|
+
appFunctions:
|
|
16611
|
+
$ref: "#/components/schemas/AgentAppFunctionsOption"
|
|
16612
|
+
toolbelt:
|
|
16613
|
+
$ref: "#/components/schemas/AgentToolbelt"
|
|
16614
|
+
AgentAppFunctionsOption:
|
|
16615
|
+
type: object
|
|
16616
|
+
properties:
|
|
16617
|
+
appId:
|
|
16618
|
+
type: string
|
|
16619
|
+
channel:
|
|
16620
|
+
type: string
|
|
16621
|
+
only:
|
|
16622
|
+
type: array
|
|
16623
|
+
items:
|
|
16624
|
+
type: string
|
|
16625
|
+
required:
|
|
16626
|
+
- appId
|
|
16627
|
+
AgentToolbelt:
|
|
16628
|
+
type: object
|
|
16629
|
+
properties:
|
|
16630
|
+
builtins:
|
|
16631
|
+
type: array
|
|
16632
|
+
items:
|
|
16633
|
+
type: object
|
|
16634
|
+
additionalProperties: true
|
|
16635
|
+
appFunctions:
|
|
16636
|
+
type: array
|
|
16637
|
+
items:
|
|
16638
|
+
$ref: "#/components/schemas/AgentAppFunctionsOption"
|
|
16639
|
+
clientTools:
|
|
16640
|
+
type: array
|
|
16641
|
+
items:
|
|
16642
|
+
$ref: "#/components/schemas/ClientToolDeclaration"
|
|
16643
|
+
ClientToolDeclaration:
|
|
16644
|
+
type: object
|
|
16645
|
+
properties:
|
|
16646
|
+
name:
|
|
16647
|
+
type: string
|
|
16648
|
+
description:
|
|
16649
|
+
type: string
|
|
16650
|
+
input:
|
|
16651
|
+
type: object
|
|
16652
|
+
additionalProperties: true
|
|
16653
|
+
required:
|
|
16654
|
+
- name
|
|
16655
|
+
ClientToolCall:
|
|
16656
|
+
type: object
|
|
16657
|
+
properties:
|
|
16658
|
+
callId:
|
|
16659
|
+
type: string
|
|
16660
|
+
name:
|
|
16661
|
+
type: string
|
|
16662
|
+
args:
|
|
16663
|
+
type: object
|
|
16664
|
+
additionalProperties: true
|
|
16665
|
+
required:
|
|
16666
|
+
- callId
|
|
16667
|
+
- name
|
|
16668
|
+
- args
|
|
16669
|
+
RequiresActionResult:
|
|
16670
|
+
type: object
|
|
16671
|
+
properties:
|
|
16672
|
+
status:
|
|
16673
|
+
type: string
|
|
16674
|
+
enum:
|
|
16675
|
+
- requires_action
|
|
16676
|
+
client_tool_calls:
|
|
16677
|
+
type: array
|
|
16678
|
+
items:
|
|
16679
|
+
$ref: "#/components/schemas/ClientToolCall"
|
|
16680
|
+
items:
|
|
16681
|
+
type: array
|
|
16682
|
+
items: {}
|
|
16683
|
+
steps:
|
|
16684
|
+
type: number
|
|
16685
|
+
toolResults:
|
|
16686
|
+
type: array
|
|
16687
|
+
items:
|
|
16688
|
+
$ref: "#/components/schemas/AgentToolResult"
|
|
16689
|
+
availableTools:
|
|
16690
|
+
type: array
|
|
16691
|
+
items:
|
|
16692
|
+
type: string
|
|
16693
|
+
required:
|
|
16694
|
+
- status
|
|
16695
|
+
- client_tool_calls
|
|
16696
|
+
- items
|
|
16697
|
+
ClientTool:
|
|
16698
|
+
type: object
|
|
16699
|
+
properties:
|
|
16700
|
+
declaration:
|
|
16701
|
+
$ref: "#/components/schemas/ClientToolDeclaration"
|
|
16702
|
+
required:
|
|
16703
|
+
- declaration
|
|
16704
|
+
RunWithClientToolsOptions:
|
|
16705
|
+
type: object
|
|
16706
|
+
properties:
|
|
16707
|
+
input:
|
|
16708
|
+
type: string
|
|
16709
|
+
tools:
|
|
16710
|
+
type: array
|
|
16711
|
+
items:
|
|
16712
|
+
$ref: "#/components/schemas/ClientTool"
|
|
16713
|
+
surface:
|
|
16714
|
+
type: string
|
|
16715
|
+
enum:
|
|
16716
|
+
- admin
|
|
16717
|
+
- public
|
|
16718
|
+
instructions:
|
|
16719
|
+
type: string
|
|
16720
|
+
model:
|
|
16721
|
+
type: string
|
|
16722
|
+
maxSteps:
|
|
16723
|
+
type: number
|
|
16724
|
+
toolbelt:
|
|
16725
|
+
$ref: "#/components/schemas/AgentToolbelt"
|
|
16726
|
+
maxRounds:
|
|
16727
|
+
type: number
|
|
16728
|
+
required:
|
|
16729
|
+
- input
|
|
16730
|
+
- tools
|
|
16731
|
+
PublicAgentRunRequest:
|
|
16732
|
+
type: object
|
|
16733
|
+
properties:
|
|
16734
|
+
input:
|
|
16735
|
+
type: string
|
|
16736
|
+
prompt:
|
|
16737
|
+
type: string
|
|
16738
|
+
instructions:
|
|
16739
|
+
type: string
|
|
16740
|
+
model:
|
|
16741
|
+
type: string
|
|
16742
|
+
maxSteps:
|
|
16743
|
+
type: number
|
|
16744
|
+
server_tools:
|
|
16745
|
+
type: array
|
|
16746
|
+
items:
|
|
16747
|
+
$ref: "#/components/schemas/AiToolName"
|
|
16748
|
+
only:
|
|
16749
|
+
type: array
|
|
16750
|
+
items:
|
|
16751
|
+
$ref: "#/components/schemas/AiToolName"
|
|
16752
|
+
exclude:
|
|
16753
|
+
type: array
|
|
16754
|
+
items:
|
|
16755
|
+
$ref: "#/components/schemas/AiToolName"
|
|
16756
|
+
allowCapabilities:
|
|
16757
|
+
type: array
|
|
16758
|
+
items:
|
|
16759
|
+
$ref: "#/components/schemas/AiToolCapability"
|
|
16760
|
+
appFunctions:
|
|
16761
|
+
$ref: "#/components/schemas/AgentAppFunctionsOption"
|
|
16762
|
+
toolbelt:
|
|
16763
|
+
$ref: "#/components/schemas/AgentToolbelt"
|
|
16764
|
+
userId:
|
|
16765
|
+
type: string
|
|
16533
16766
|
AgentToolResult:
|
|
16534
16767
|
type: object
|
|
16535
16768
|
properties:
|
|
@@ -16542,6 +16775,20 @@ components:
|
|
|
16542
16775
|
- name
|
|
16543
16776
|
- isError
|
|
16544
16777
|
- result
|
|
16778
|
+
ToolRunResult:
|
|
16779
|
+
type: object
|
|
16780
|
+
properties:
|
|
16781
|
+
name:
|
|
16782
|
+
type: string
|
|
16783
|
+
isError:
|
|
16784
|
+
type: boolean
|
|
16785
|
+
result:
|
|
16786
|
+
type: object
|
|
16787
|
+
additionalProperties: true
|
|
16788
|
+
required:
|
|
16789
|
+
- name
|
|
16790
|
+
- isError
|
|
16791
|
+
- result
|
|
16545
16792
|
AgentRunResult:
|
|
16546
16793
|
type: object
|
|
16547
16794
|
properties:
|
|
@@ -16793,6 +17040,30 @@ components:
|
|
|
16793
17040
|
type: string
|
|
16794
17041
|
required:
|
|
16795
17042
|
- urls
|
|
17043
|
+
PdfInspectArgs:
|
|
17044
|
+
type: object
|
|
17045
|
+
properties:
|
|
17046
|
+
url:
|
|
17047
|
+
type: object
|
|
17048
|
+
additionalProperties: true
|
|
17049
|
+
required:
|
|
17050
|
+
- url
|
|
17051
|
+
PdfRenderArgs:
|
|
17052
|
+
type: object
|
|
17053
|
+
properties:
|
|
17054
|
+
url:
|
|
17055
|
+
type: object
|
|
17056
|
+
additionalProperties: true
|
|
17057
|
+
required:
|
|
17058
|
+
- url
|
|
17059
|
+
PdfExtractArgs:
|
|
17060
|
+
type: object
|
|
17061
|
+
properties:
|
|
17062
|
+
url:
|
|
17063
|
+
type: object
|
|
17064
|
+
additionalProperties: true
|
|
17065
|
+
required:
|
|
17066
|
+
- url
|
|
16796
17067
|
HttpRequestArgs:
|
|
16797
17068
|
type: object
|
|
16798
17069
|
properties:
|
|
@@ -16848,6 +17119,12 @@ components:
|
|
|
16848
17119
|
$ref: "#/components/schemas/PdfFillArgs"
|
|
16849
17120
|
pdf.merge:
|
|
16850
17121
|
$ref: "#/components/schemas/PdfMergeArgs"
|
|
17122
|
+
pdf.inspect:
|
|
17123
|
+
$ref: "#/components/schemas/PdfInspectArgs"
|
|
17124
|
+
pdf.render:
|
|
17125
|
+
$ref: "#/components/schemas/PdfRenderArgs"
|
|
17126
|
+
pdf.extract:
|
|
17127
|
+
$ref: "#/components/schemas/PdfExtractArgs"
|
|
16851
17128
|
http.request:
|
|
16852
17129
|
$ref: "#/components/schemas/HttpRequestArgs"
|
|
16853
17130
|
translate:
|
|
@@ -16868,6 +17145,9 @@ components:
|
|
|
16868
17145
|
- pdf.create
|
|
16869
17146
|
- pdf.fill
|
|
16870
17147
|
- pdf.merge
|
|
17148
|
+
- pdf.inspect
|
|
17149
|
+
- pdf.render
|
|
17150
|
+
- pdf.extract
|
|
16871
17151
|
- http.request
|
|
16872
17152
|
- translate
|
|
16873
17153
|
WebSearchResultItem:
|
|
@@ -16944,6 +17224,48 @@ components:
|
|
|
16944
17224
|
additionalProperties: true
|
|
16945
17225
|
required:
|
|
16946
17226
|
- translations
|
|
17227
|
+
PdfInspectPage:
|
|
17228
|
+
type: object
|
|
17229
|
+
properties:
|
|
17230
|
+
page:
|
|
17231
|
+
type: string
|
|
17232
|
+
enum:
|
|
17233
|
+
- text-native
|
|
17234
|
+
- text+raster
|
|
17235
|
+
- raster-only
|
|
17236
|
+
- curve-only
|
|
17237
|
+
required:
|
|
17238
|
+
- page
|
|
17239
|
+
PdfInspectResult:
|
|
17240
|
+
type: object
|
|
17241
|
+
properties:
|
|
17242
|
+
url:
|
|
17243
|
+
type: array
|
|
17244
|
+
items:
|
|
17245
|
+
type: string
|
|
17246
|
+
enum:
|
|
17247
|
+
- text
|
|
17248
|
+
- vision
|
|
17249
|
+
required:
|
|
17250
|
+
- url
|
|
17251
|
+
PdfRenderResult:
|
|
17252
|
+
type: object
|
|
17253
|
+
properties:
|
|
17254
|
+
url:
|
|
17255
|
+
type: object
|
|
17256
|
+
additionalProperties: true
|
|
17257
|
+
required:
|
|
17258
|
+
- url
|
|
17259
|
+
PdfExtractResult:
|
|
17260
|
+
type: object
|
|
17261
|
+
properties:
|
|
17262
|
+
url:
|
|
17263
|
+
type: string
|
|
17264
|
+
enum:
|
|
17265
|
+
- text
|
|
17266
|
+
- vision
|
|
17267
|
+
required:
|
|
17268
|
+
- url
|
|
16947
17269
|
ResponsesAgentTrace:
|
|
16948
17270
|
type: object
|
|
16949
17271
|
properties:
|
|
@@ -17022,6 +17344,9 @@ components:
|
|
|
17022
17344
|
- pdf.create
|
|
17023
17345
|
- pdf.fill
|
|
17024
17346
|
- pdf.merge
|
|
17347
|
+
- pdf.inspect
|
|
17348
|
+
- pdf.render
|
|
17349
|
+
- pdf.extract
|
|
17025
17350
|
- http.request
|
|
17026
17351
|
- translate
|
|
17027
17352
|
AgentStreamEvent:
|
|
@@ -18264,9 +18589,30 @@ components:
|
|
|
18264
18589
|
type: string
|
|
18265
18590
|
handler:
|
|
18266
18591
|
type: string
|
|
18592
|
+
agent:
|
|
18593
|
+
$ref: "#/components/schemas/AppFunctionAgentExposure"
|
|
18267
18594
|
required:
|
|
18268
18595
|
- name
|
|
18269
18596
|
- trigger
|
|
18597
|
+
AppFunctionAgentExposure:
|
|
18598
|
+
type: object
|
|
18599
|
+
properties:
|
|
18600
|
+
tool:
|
|
18601
|
+
type: boolean
|
|
18602
|
+
title:
|
|
18603
|
+
type: string
|
|
18604
|
+
description:
|
|
18605
|
+
type: string
|
|
18606
|
+
input:
|
|
18607
|
+
type: object
|
|
18608
|
+
additionalProperties: true
|
|
18609
|
+
approval:
|
|
18610
|
+
type: string
|
|
18611
|
+
enum:
|
|
18612
|
+
- auto
|
|
18613
|
+
- require
|
|
18614
|
+
required:
|
|
18615
|
+
- tool
|
|
18270
18616
|
AppManifestFunctions:
|
|
18271
18617
|
type: object
|
|
18272
18618
|
properties:
|
package/dist/types/ai.d.ts
CHANGED
|
@@ -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' | 'http.request' | 'translate';
|
|
729
852
|
export interface WebFetchPageArgs {
|
|
730
853
|
url: string;
|
|
731
854
|
type?: string;
|
|
@@ -817,6 +940,23 @@ 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
|
+
}
|
|
820
960
|
export interface HttpRequestArgs {
|
|
821
961
|
url: string;
|
|
822
962
|
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD';
|
|
@@ -845,6 +985,9 @@ export interface AiToolArgsMap {
|
|
|
845
985
|
'pdf.create': PdfCreateArgs;
|
|
846
986
|
'pdf.fill': PdfFillArgs;
|
|
847
987
|
'pdf.merge': PdfMergeArgs;
|
|
988
|
+
'pdf.inspect': PdfInspectArgs;
|
|
989
|
+
'pdf.render': PdfRenderArgs;
|
|
990
|
+
'pdf.extract': PdfExtractArgs;
|
|
848
991
|
'http.request': HttpRequestArgs;
|
|
849
992
|
'translate': TranslateArgs;
|
|
850
993
|
}
|
|
@@ -905,6 +1048,41 @@ export interface TranslateResult {
|
|
|
905
1048
|
translations: Record<string, string>;
|
|
906
1049
|
sourceLanguage: string;
|
|
907
1050
|
}
|
|
1051
|
+
/** One page's structure from pdf.inspect. */
|
|
1052
|
+
export interface PdfInspectPage {
|
|
1053
|
+
page: number;
|
|
1054
|
+
width: number;
|
|
1055
|
+
height: number;
|
|
1056
|
+
textChars: number;
|
|
1057
|
+
hasText: boolean;
|
|
1058
|
+
imageCount: number;
|
|
1059
|
+
likelyType: 'text-native' | 'text+raster' | 'raster-only' | 'curve-only';
|
|
1060
|
+
}
|
|
1061
|
+
export interface PdfInspectResult {
|
|
1062
|
+
url: string;
|
|
1063
|
+
pageCount: number;
|
|
1064
|
+
inspectedPages: number;
|
|
1065
|
+
totalTextChars: number;
|
|
1066
|
+
isTextNative: boolean;
|
|
1067
|
+
isCurveOnly: boolean;
|
|
1068
|
+
recommendedPath: 'text' | 'vision';
|
|
1069
|
+
note: string;
|
|
1070
|
+
pages: PdfInspectPage[];
|
|
1071
|
+
}
|
|
1072
|
+
export interface PdfRenderResult {
|
|
1073
|
+
url: string | null;
|
|
1074
|
+
page: number;
|
|
1075
|
+
pageCount: number;
|
|
1076
|
+
dpi: number;
|
|
1077
|
+
width: number;
|
|
1078
|
+
height: number;
|
|
1079
|
+
}
|
|
1080
|
+
export interface PdfExtractResult {
|
|
1081
|
+
url: string;
|
|
1082
|
+
method: 'text' | 'vision';
|
|
1083
|
+
pagesRead: number;
|
|
1084
|
+
fields: Record<string, any>;
|
|
1085
|
+
}
|
|
908
1086
|
/** The `_agent` trace attached to an agentic Responses result. */
|
|
909
1087
|
export interface ResponsesAgentTrace {
|
|
910
1088
|
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 {
|