@agent-os-sdk/client 0.3.0 → 0.3.2
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/client/AgentOsClient.d.ts +2 -0
- package/dist/client/AgentOsClient.d.ts.map +1 -1
- package/dist/client/AgentOsClient.js +6 -3
- package/dist/client/raw.d.ts +25 -0
- package/dist/client/raw.d.ts.map +1 -1
- package/dist/client/raw.js +61 -0
- package/dist/generated/openapi.d.ts +156 -26
- package/dist/generated/openapi.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/modules/builder.d.ts +19 -4
- package/dist/modules/builder.d.ts.map +1 -1
- package/dist/modules/builder.js +21 -30
- package/dist/modules/catalog.d.ts +104 -0
- package/dist/modules/catalog.d.ts.map +1 -0
- package/dist/modules/catalog.js +92 -0
- package/dist/modules/graphs.d.ts +7 -0
- package/dist/modules/graphs.d.ts.map +1 -1
- package/dist/modules/graphs.js +1 -0
- package/dist/modules/metrics.d.ts +7 -3
- package/dist/modules/metrics.d.ts.map +1 -1
- package/dist/modules/metrics.js +10 -7
- package/dist/modules/runs.d.ts +1 -3
- package/dist/modules/runs.d.ts.map +1 -1
- package/dist/modules/runs.js +12 -28
- package/dist/sse/client.d.ts +26 -1
- package/dist/sse/client.d.ts.map +1 -1
- package/dist/sse/client.js +36 -11
- package/package.json +51 -50
- package/src/client/AgentOsClient.ts +6 -3
- package/src/client/raw.ts +74 -0
- package/src/generated/openapi.ts +156 -26
- package/src/generated/swagger.json +144 -82
- package/src/index.ts +1 -0
- package/src/modules/builder.ts +35 -32
- package/src/modules/catalog.ts +155 -0
- package/src/modules/graphs.ts +7 -0
- package/src/modules/metrics.ts +10 -3
- package/src/modules/runs.ts +12 -28
- package/src/sse/client.ts +43 -14
|
@@ -1222,6 +1222,50 @@
|
|
|
1222
1222
|
}
|
|
1223
1223
|
}
|
|
1224
1224
|
},
|
|
1225
|
+
"/v1/api/catalog/nodes": {
|
|
1226
|
+
"get": {
|
|
1227
|
+
"tags": [
|
|
1228
|
+
"Catalog"
|
|
1229
|
+
],
|
|
1230
|
+
"summary": "Get the Node Catalog (v1).",
|
|
1231
|
+
"parameters": [
|
|
1232
|
+
{
|
|
1233
|
+
"name": "version",
|
|
1234
|
+
"in": "query",
|
|
1235
|
+
"schema": {
|
|
1236
|
+
"type": "string"
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
],
|
|
1240
|
+
"responses": {
|
|
1241
|
+
"200": {
|
|
1242
|
+
"description": "OK"
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
},
|
|
1247
|
+
"/v1/api/triggers/templates": {
|
|
1248
|
+
"get": {
|
|
1249
|
+
"tags": [
|
|
1250
|
+
"Catalog"
|
|
1251
|
+
],
|
|
1252
|
+
"summary": "Get the Trigger Templates Catalog (v1).",
|
|
1253
|
+
"parameters": [
|
|
1254
|
+
{
|
|
1255
|
+
"name": "version",
|
|
1256
|
+
"in": "query",
|
|
1257
|
+
"schema": {
|
|
1258
|
+
"type": "string"
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
],
|
|
1262
|
+
"responses": {
|
|
1263
|
+
"200": {
|
|
1264
|
+
"description": "OK"
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
},
|
|
1225
1269
|
"/v1/api/workspaces/{workspaceId}/runs/{runId}/checkpoints": {
|
|
1226
1270
|
"get": {
|
|
1227
1271
|
"tags": [
|
|
@@ -5233,7 +5277,17 @@
|
|
|
5233
5277
|
"tags": [
|
|
5234
5278
|
"Tools"
|
|
5235
5279
|
],
|
|
5236
|
-
"summary": "List all tool definitions.",
|
|
5280
|
+
"summary": "List all tool definitions.\nSupports ?version=1 for canonical ToolCatalog format.",
|
|
5281
|
+
"parameters": [
|
|
5282
|
+
{
|
|
5283
|
+
"name": "version",
|
|
5284
|
+
"in": "query",
|
|
5285
|
+
"schema": {
|
|
5286
|
+
"type": "string",
|
|
5287
|
+
"default": "1"
|
|
5288
|
+
}
|
|
5289
|
+
}
|
|
5290
|
+
],
|
|
5237
5291
|
"responses": {
|
|
5238
5292
|
"200": {
|
|
5239
5293
|
"description": "OK"
|
|
@@ -5246,7 +5300,17 @@
|
|
|
5246
5300
|
"tags": [
|
|
5247
5301
|
"Tools"
|
|
5248
5302
|
],
|
|
5249
|
-
"summary": "List all tool definitions.",
|
|
5303
|
+
"summary": "List all tool definitions.\nSupports ?version=1 for canonical ToolCatalog format.",
|
|
5304
|
+
"parameters": [
|
|
5305
|
+
{
|
|
5306
|
+
"name": "version",
|
|
5307
|
+
"in": "query",
|
|
5308
|
+
"schema": {
|
|
5309
|
+
"type": "string",
|
|
5310
|
+
"default": "1"
|
|
5311
|
+
}
|
|
5312
|
+
}
|
|
5313
|
+
],
|
|
5250
5314
|
"responses": {
|
|
5251
5315
|
"200": {
|
|
5252
5316
|
"description": "OK"
|
|
@@ -5826,25 +5890,13 @@
|
|
|
5826
5890
|
}
|
|
5827
5891
|
}
|
|
5828
5892
|
},
|
|
5829
|
-
"/v1/api/
|
|
5893
|
+
"/v1/api/vector-stores": {
|
|
5830
5894
|
"post": {
|
|
5831
5895
|
"tags": [
|
|
5832
5896
|
"VectorStores"
|
|
5833
5897
|
],
|
|
5834
5898
|
"summary": "Creates a new vector store for semantic document search.",
|
|
5835
5899
|
"description": "Creates a vector store with the specified embedding configuration.\nThe store is ready to accept file attachments immediately after creation.\n\n**Default Configuration:**\n- Provider: `openai`\n- Model: `text-embedding-3-small`\n- Dimension: `1536`",
|
|
5836
|
-
"parameters": [
|
|
5837
|
-
{
|
|
5838
|
-
"name": "workspaceId",
|
|
5839
|
-
"in": "path",
|
|
5840
|
-
"description": "The workspace to create the vector store in.",
|
|
5841
|
-
"required": true,
|
|
5842
|
-
"schema": {
|
|
5843
|
-
"type": "string",
|
|
5844
|
-
"format": "uuid"
|
|
5845
|
-
}
|
|
5846
|
-
}
|
|
5847
|
-
],
|
|
5848
5900
|
"requestBody": {
|
|
5849
5901
|
"description": "Vector store configuration.",
|
|
5850
5902
|
"content": {
|
|
@@ -5876,6 +5928,16 @@
|
|
|
5876
5928
|
}
|
|
5877
5929
|
}
|
|
5878
5930
|
},
|
|
5931
|
+
"401": {
|
|
5932
|
+
"description": "Authentication or Workspace context required.",
|
|
5933
|
+
"content": {
|
|
5934
|
+
"application/json": {
|
|
5935
|
+
"schema": {
|
|
5936
|
+
"$ref": "#/components/schemas/ProblemDetails"
|
|
5937
|
+
}
|
|
5938
|
+
}
|
|
5939
|
+
}
|
|
5940
|
+
},
|
|
5879
5941
|
"404": {
|
|
5880
5942
|
"description": "Workspace not found.",
|
|
5881
5943
|
"content": {
|
|
@@ -5894,15 +5956,6 @@
|
|
|
5894
5956
|
],
|
|
5895
5957
|
"summary": "List vector stores in a workspace.",
|
|
5896
5958
|
"parameters": [
|
|
5897
|
-
{
|
|
5898
|
-
"name": "workspaceId",
|
|
5899
|
-
"in": "path",
|
|
5900
|
-
"required": true,
|
|
5901
|
-
"schema": {
|
|
5902
|
-
"type": "string",
|
|
5903
|
-
"format": "uuid"
|
|
5904
|
-
}
|
|
5905
|
-
},
|
|
5906
5959
|
{
|
|
5907
5960
|
"name": "limit",
|
|
5908
5961
|
"in": "query",
|
|
@@ -5935,26 +5988,27 @@
|
|
|
5935
5988
|
}
|
|
5936
5989
|
}
|
|
5937
5990
|
}
|
|
5991
|
+
},
|
|
5992
|
+
"401": {
|
|
5993
|
+
"description": "Unauthorized",
|
|
5994
|
+
"content": {
|
|
5995
|
+
"application/json": {
|
|
5996
|
+
"schema": {
|
|
5997
|
+
"$ref": "#/components/schemas/ProblemDetails"
|
|
5998
|
+
}
|
|
5999
|
+
}
|
|
6000
|
+
}
|
|
5938
6001
|
}
|
|
5939
6002
|
}
|
|
5940
6003
|
}
|
|
5941
6004
|
},
|
|
5942
|
-
"/v1/api/
|
|
6005
|
+
"/v1/api/vector-stores/{vectorStoreId}": {
|
|
5943
6006
|
"get": {
|
|
5944
6007
|
"tags": [
|
|
5945
6008
|
"VectorStores"
|
|
5946
6009
|
],
|
|
5947
6010
|
"summary": "Get a vector store by ID.",
|
|
5948
6011
|
"parameters": [
|
|
5949
|
-
{
|
|
5950
|
-
"name": "workspaceId",
|
|
5951
|
-
"in": "path",
|
|
5952
|
-
"required": true,
|
|
5953
|
-
"schema": {
|
|
5954
|
-
"type": "string",
|
|
5955
|
-
"format": "uuid"
|
|
5956
|
-
}
|
|
5957
|
-
},
|
|
5958
6012
|
{
|
|
5959
6013
|
"name": "vectorStoreId",
|
|
5960
6014
|
"in": "path",
|
|
@@ -5976,6 +6030,16 @@
|
|
|
5976
6030
|
}
|
|
5977
6031
|
}
|
|
5978
6032
|
},
|
|
6033
|
+
"401": {
|
|
6034
|
+
"description": "Unauthorized",
|
|
6035
|
+
"content": {
|
|
6036
|
+
"application/json": {
|
|
6037
|
+
"schema": {
|
|
6038
|
+
"$ref": "#/components/schemas/ProblemDetails"
|
|
6039
|
+
}
|
|
6040
|
+
}
|
|
6041
|
+
}
|
|
6042
|
+
},
|
|
5979
6043
|
"404": {
|
|
5980
6044
|
"description": "Not Found",
|
|
5981
6045
|
"content": {
|
|
@@ -5994,15 +6058,6 @@
|
|
|
5994
6058
|
],
|
|
5995
6059
|
"summary": "Delete a vector store.",
|
|
5996
6060
|
"parameters": [
|
|
5997
|
-
{
|
|
5998
|
-
"name": "workspaceId",
|
|
5999
|
-
"in": "path",
|
|
6000
|
-
"required": true,
|
|
6001
|
-
"schema": {
|
|
6002
|
-
"type": "string",
|
|
6003
|
-
"format": "uuid"
|
|
6004
|
-
}
|
|
6005
|
-
},
|
|
6006
6061
|
{
|
|
6007
6062
|
"name": "vectorStoreId",
|
|
6008
6063
|
"in": "path",
|
|
@@ -6017,6 +6072,16 @@
|
|
|
6017
6072
|
"204": {
|
|
6018
6073
|
"description": "No Content"
|
|
6019
6074
|
},
|
|
6075
|
+
"401": {
|
|
6076
|
+
"description": "Unauthorized",
|
|
6077
|
+
"content": {
|
|
6078
|
+
"application/json": {
|
|
6079
|
+
"schema": {
|
|
6080
|
+
"$ref": "#/components/schemas/ProblemDetails"
|
|
6081
|
+
}
|
|
6082
|
+
}
|
|
6083
|
+
}
|
|
6084
|
+
},
|
|
6020
6085
|
"404": {
|
|
6021
6086
|
"description": "Not Found",
|
|
6022
6087
|
"content": {
|
|
@@ -6030,22 +6095,13 @@
|
|
|
6030
6095
|
}
|
|
6031
6096
|
}
|
|
6032
6097
|
},
|
|
6033
|
-
"/v1/api/
|
|
6098
|
+
"/v1/api/vector-stores/{vectorStoreId}/files": {
|
|
6034
6099
|
"post": {
|
|
6035
6100
|
"tags": [
|
|
6036
6101
|
"VectorStores"
|
|
6037
6102
|
],
|
|
6038
6103
|
"summary": "Attach a file to a vector store for embedding.",
|
|
6039
6104
|
"parameters": [
|
|
6040
|
-
{
|
|
6041
|
-
"name": "workspaceId",
|
|
6042
|
-
"in": "path",
|
|
6043
|
-
"required": true,
|
|
6044
|
-
"schema": {
|
|
6045
|
-
"type": "string",
|
|
6046
|
-
"format": "uuid"
|
|
6047
|
-
}
|
|
6048
|
-
},
|
|
6049
6105
|
{
|
|
6050
6106
|
"name": "vectorStoreId",
|
|
6051
6107
|
"in": "path",
|
|
@@ -6086,6 +6142,16 @@
|
|
|
6086
6142
|
}
|
|
6087
6143
|
}
|
|
6088
6144
|
},
|
|
6145
|
+
"401": {
|
|
6146
|
+
"description": "Unauthorized",
|
|
6147
|
+
"content": {
|
|
6148
|
+
"application/json": {
|
|
6149
|
+
"schema": {
|
|
6150
|
+
"$ref": "#/components/schemas/ProblemDetails"
|
|
6151
|
+
}
|
|
6152
|
+
}
|
|
6153
|
+
}
|
|
6154
|
+
},
|
|
6089
6155
|
"404": {
|
|
6090
6156
|
"description": "Not Found",
|
|
6091
6157
|
"content": {
|
|
@@ -6099,7 +6165,7 @@
|
|
|
6099
6165
|
}
|
|
6100
6166
|
}
|
|
6101
6167
|
},
|
|
6102
|
-
"/v1/api/
|
|
6168
|
+
"/v1/api/vector-stores/{vectorStoreId}/query": {
|
|
6103
6169
|
"post": {
|
|
6104
6170
|
"tags": [
|
|
6105
6171
|
"VectorStores"
|
|
@@ -6107,16 +6173,6 @@
|
|
|
6107
6173
|
"summary": "Performs semantic similarity search against the vector store.",
|
|
6108
6174
|
"description": "Executes a cosine similarity search to find document chunks most relevant\nto the query. Results are ranked by similarity score.\n\n**Note:** The query is automatically embedded using the store's configured\nembedding provider before search.\n\n**Example Request:**\n```json\n{\n \"query\": \"How do I configure authentication?\",\n \"top_k\": 5,\n \"min_score\": 0.7\n}\n```",
|
|
6109
6175
|
"parameters": [
|
|
6110
|
-
{
|
|
6111
|
-
"name": "workspaceId",
|
|
6112
|
-
"in": "path",
|
|
6113
|
-
"description": "The workspace containing the vector store.",
|
|
6114
|
-
"required": true,
|
|
6115
|
-
"schema": {
|
|
6116
|
-
"type": "string",
|
|
6117
|
-
"format": "uuid"
|
|
6118
|
-
}
|
|
6119
|
-
},
|
|
6120
6176
|
{
|
|
6121
6177
|
"name": "vectorStoreId",
|
|
6122
6178
|
"in": "path",
|
|
@@ -6159,6 +6215,16 @@
|
|
|
6159
6215
|
}
|
|
6160
6216
|
}
|
|
6161
6217
|
},
|
|
6218
|
+
"401": {
|
|
6219
|
+
"description": "Authentication or Workspace context required.",
|
|
6220
|
+
"content": {
|
|
6221
|
+
"application/json": {
|
|
6222
|
+
"schema": {
|
|
6223
|
+
"$ref": "#/components/schemas/ProblemDetails"
|
|
6224
|
+
}
|
|
6225
|
+
}
|
|
6226
|
+
}
|
|
6227
|
+
},
|
|
6162
6228
|
"404": {
|
|
6163
6229
|
"description": "Vector store not found.",
|
|
6164
6230
|
"content": {
|
|
@@ -6172,22 +6238,13 @@
|
|
|
6172
6238
|
}
|
|
6173
6239
|
}
|
|
6174
6240
|
},
|
|
6175
|
-
"/v1/api/
|
|
6241
|
+
"/v1/api/vector-stores/{vectorStoreId}/bind-agent": {
|
|
6176
6242
|
"post": {
|
|
6177
6243
|
"tags": [
|
|
6178
6244
|
"VectorStores"
|
|
6179
6245
|
],
|
|
6180
6246
|
"summary": "Bind a vector store to an agent.",
|
|
6181
6247
|
"parameters": [
|
|
6182
|
-
{
|
|
6183
|
-
"name": "workspaceId",
|
|
6184
|
-
"in": "path",
|
|
6185
|
-
"required": true,
|
|
6186
|
-
"schema": {
|
|
6187
|
-
"type": "string",
|
|
6188
|
-
"format": "uuid"
|
|
6189
|
-
}
|
|
6190
|
-
},
|
|
6191
6248
|
{
|
|
6192
6249
|
"name": "vectorStoreId",
|
|
6193
6250
|
"in": "path",
|
|
@@ -6221,6 +6278,16 @@
|
|
|
6221
6278
|
"204": {
|
|
6222
6279
|
"description": "No Content"
|
|
6223
6280
|
},
|
|
6281
|
+
"401": {
|
|
6282
|
+
"description": "Unauthorized",
|
|
6283
|
+
"content": {
|
|
6284
|
+
"application/json": {
|
|
6285
|
+
"schema": {
|
|
6286
|
+
"$ref": "#/components/schemas/ProblemDetails"
|
|
6287
|
+
}
|
|
6288
|
+
}
|
|
6289
|
+
}
|
|
6290
|
+
},
|
|
6224
6291
|
"404": {
|
|
6225
6292
|
"description": "Not Found",
|
|
6226
6293
|
"content": {
|
|
@@ -6934,14 +7001,6 @@
|
|
|
6934
7001
|
"CreateAgentRequest": {
|
|
6935
7002
|
"type": "object",
|
|
6936
7003
|
"properties": {
|
|
6937
|
-
"tenant_id": {
|
|
6938
|
-
"type": "string",
|
|
6939
|
-
"format": "uuid"
|
|
6940
|
-
},
|
|
6941
|
-
"workspace_id": {
|
|
6942
|
-
"type": "string",
|
|
6943
|
-
"format": "uuid"
|
|
6944
|
-
},
|
|
6945
7004
|
"name": {
|
|
6946
7005
|
"type": "string",
|
|
6947
7006
|
"nullable": true
|
|
@@ -8716,6 +8775,9 @@
|
|
|
8716
8775
|
{
|
|
8717
8776
|
"name": "Builder"
|
|
8718
8777
|
},
|
|
8778
|
+
{
|
|
8779
|
+
"name": "Catalog"
|
|
8780
|
+
},
|
|
8719
8781
|
{
|
|
8720
8782
|
"name": "Checkpoints"
|
|
8721
8783
|
},
|
package/src/index.ts
CHANGED
|
@@ -115,6 +115,7 @@ export { MeModule, type MeResponse } from "./modules/me.js";
|
|
|
115
115
|
export { InfoModule, type ServerInfo } from "./modules/info.js";
|
|
116
116
|
export { MetricsModule, type MetricsResponse } from "./modules/metrics.js";
|
|
117
117
|
export { GraphsModule, type GraphValidationResult, type GraphIntrospectionResult } from "./modules/graphs.js";
|
|
118
|
+
export { CatalogModule, type CatalogVersions, type NodeCatalogResponse, type ToolCatalogResponse, type TriggerCatalogResponse, type NodeDefinition, type ToolDefinition, type TriggerTemplate } from "./modules/catalog.js";
|
|
118
119
|
|
|
119
120
|
// FUTURE modules - All return 501 Not Implemented. When backend is ready, implement real calls.
|
|
120
121
|
export { HandoffModule, type HandoffOptions, type HandoffResult, type ForkOptions, type ForkResult, type RunChain, type RunChainNode, type HandoffMode, type HandoffConstraints } from "./modules/handoff.js";
|
package/src/modules/builder.ts
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Flow: Frontend → CP:5000/v1/api/builder/{agentId}/chat → DP:8001/v1/internal/builder/{agentId}/chat
|
|
9
9
|
*
|
|
10
|
+
* ALL HTTP goes through rawClient - no direct fetch calls.
|
|
11
|
+
*
|
|
10
12
|
* @example
|
|
11
13
|
* ```ts
|
|
12
14
|
* const client = new AgentOsClient({ ... })
|
|
@@ -25,12 +27,23 @@
|
|
|
25
27
|
* ```
|
|
26
28
|
*/
|
|
27
29
|
|
|
28
|
-
import {
|
|
30
|
+
import type { RawClient, APIResponse } from "../client/raw.js";
|
|
31
|
+
import type { SSEOptions } from "../sse/client.js";
|
|
32
|
+
|
|
33
|
+
export type CatalogVersions = {
|
|
34
|
+
nodes: string;
|
|
35
|
+
tools: string;
|
|
36
|
+
triggers: string;
|
|
37
|
+
};
|
|
29
38
|
|
|
30
39
|
export type BuilderChatRequest = {
|
|
31
40
|
message: string;
|
|
32
41
|
current_graph_spec?: Record<string, unknown>;
|
|
33
42
|
thread_id?: string;
|
|
43
|
+
/** Catalog versions to use for validation */
|
|
44
|
+
catalog_versions?: CatalogVersions;
|
|
45
|
+
/** Combined hash of all catalogs for integrity */
|
|
46
|
+
catalog_ref?: string;
|
|
34
47
|
};
|
|
35
48
|
|
|
36
49
|
export type GraphUpdateAction = {
|
|
@@ -55,36 +68,29 @@ export type BuilderChatResponse = {
|
|
|
55
68
|
};
|
|
56
69
|
|
|
57
70
|
export class BuilderModule {
|
|
58
|
-
constructor(
|
|
59
|
-
private baseUrl: string,
|
|
60
|
-
private headers: () => Record<string, string>
|
|
61
|
-
) { }
|
|
71
|
+
constructor(private client: RawClient) { }
|
|
62
72
|
|
|
63
73
|
/**
|
|
64
74
|
* Stream chat with meta-agent (SSE).
|
|
65
75
|
* Returns async generator of events.
|
|
76
|
+
*
|
|
77
|
+
* Uses rawClient.streamPost() - headers resolved asynchronously.
|
|
66
78
|
*/
|
|
67
79
|
async *chat(
|
|
68
80
|
agentId: string,
|
|
69
81
|
request: BuilderChatRequest,
|
|
70
82
|
options?: SSEOptions
|
|
71
83
|
): AsyncGenerator<BuilderStreamEvent> {
|
|
72
|
-
// Use
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
method: "POST",
|
|
77
|
-
headers: {
|
|
78
|
-
"Content-Type": "application/json",
|
|
79
|
-
Accept: "text/event-stream",
|
|
80
|
-
...this.headers(),
|
|
81
|
-
},
|
|
82
|
-
body: JSON.stringify(request),
|
|
84
|
+
// Use rawClient.streamPost() - ALL auth headers resolved automatically
|
|
85
|
+
const response = await this.client.streamPost("/v1/api/builder/{agentId}/chat", {
|
|
86
|
+
params: { path: { agentId } },
|
|
87
|
+
body: request,
|
|
83
88
|
signal: options?.signal,
|
|
84
89
|
});
|
|
85
90
|
|
|
86
91
|
if (!response.ok) {
|
|
87
|
-
|
|
92
|
+
const errorText = await response.text();
|
|
93
|
+
throw new Error(`Builder chat failed: ${response.status} - ${errorText}`);
|
|
88
94
|
}
|
|
89
95
|
|
|
90
96
|
if (!response.body) {
|
|
@@ -133,29 +139,26 @@ export class BuilderModule {
|
|
|
133
139
|
|
|
134
140
|
/**
|
|
135
141
|
* Sync chat with meta-agent (no streaming).
|
|
142
|
+
*
|
|
143
|
+
* Uses rawClient.POST() - headers resolved asynchronously.
|
|
136
144
|
*/
|
|
137
145
|
async chatSync(
|
|
138
146
|
agentId: string,
|
|
139
147
|
request: BuilderChatRequest
|
|
140
148
|
): Promise<BuilderChatResponse> {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
...this.headers(),
|
|
149
|
-
},
|
|
150
|
-
body: JSON.stringify(request),
|
|
151
|
-
});
|
|
149
|
+
const { data, error } = await this.client.POST<BuilderChatResponse>(
|
|
150
|
+
"/v1/api/builder/{agentId}/chat/sync",
|
|
151
|
+
{
|
|
152
|
+
params: { path: { agentId } },
|
|
153
|
+
body: request,
|
|
154
|
+
}
|
|
155
|
+
);
|
|
152
156
|
|
|
153
|
-
if (
|
|
154
|
-
|
|
155
|
-
throw new Error(`Builder chat failed: ${response.status} - ${error}`);
|
|
157
|
+
if (error) {
|
|
158
|
+
throw new Error(`Builder chat failed: ${error.code} - ${error.message}`);
|
|
156
159
|
}
|
|
157
160
|
|
|
158
|
-
return
|
|
161
|
+
return data!;
|
|
159
162
|
}
|
|
160
163
|
|
|
161
164
|
/**
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Catalog Module - Canonical Catalog Access
|
|
3
|
+
*
|
|
4
|
+
* Provides access to versioned catalogs:
|
|
5
|
+
* - Node Catalog (node types, config schemas)
|
|
6
|
+
* - Tool Catalog (tool definitions)
|
|
7
|
+
* - Trigger Templates (trigger configurations)
|
|
8
|
+
*
|
|
9
|
+
* All responses include:
|
|
10
|
+
* - ETag header for caching
|
|
11
|
+
* - X-Content-Hash header for integrity verification
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const client = new AgentOsClient({ ... })
|
|
16
|
+
*
|
|
17
|
+
* // Get all catalogs
|
|
18
|
+
* const nodes = await unwrap(client.catalog.getNodes())
|
|
19
|
+
* const tools = await unwrap(client.catalog.getTools())
|
|
20
|
+
* const triggers = await unwrap(client.catalog.getTriggers())
|
|
21
|
+
*
|
|
22
|
+
* // Use returned metadata for caching
|
|
23
|
+
* console.log(nodes.etag, nodes.contentHash)
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import type { RawClient, APIResponse } from "../client/raw.js";
|
|
28
|
+
|
|
29
|
+
export interface CatalogVersions {
|
|
30
|
+
nodes: string;
|
|
31
|
+
tools: string;
|
|
32
|
+
triggers: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface CatalogMetadata {
|
|
36
|
+
version: string;
|
|
37
|
+
etag?: string;
|
|
38
|
+
contentHash?: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface NodeCatalogResponse extends CatalogMetadata {
|
|
42
|
+
nodes: Record<string, NodeDefinition>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface NodeDefinition {
|
|
46
|
+
kind: string;
|
|
47
|
+
category: string;
|
|
48
|
+
description: string;
|
|
49
|
+
config_schema?: Record<string, unknown>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface ToolCatalogResponse extends CatalogMetadata {
|
|
53
|
+
tools: ToolDefinition[];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface ToolDefinition {
|
|
57
|
+
slug: string;
|
|
58
|
+
name: string;
|
|
59
|
+
description?: string;
|
|
60
|
+
type: string;
|
|
61
|
+
version?: number;
|
|
62
|
+
input_schema?: Record<string, unknown>;
|
|
63
|
+
output_schema?: Record<string, unknown>;
|
|
64
|
+
credential_requirements?: unknown[];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface TriggerCatalogResponse extends CatalogMetadata {
|
|
68
|
+
triggers: TriggerTemplate[];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface TriggerTemplate {
|
|
72
|
+
slug: string;
|
|
73
|
+
kind: string;
|
|
74
|
+
description?: string;
|
|
75
|
+
run_input_schema?: Record<string, unknown>;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export class CatalogModule {
|
|
79
|
+
constructor(private client: RawClient) { }
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Get the Node Catalog.
|
|
83
|
+
* Returns node types with their configuration schemas.
|
|
84
|
+
*/
|
|
85
|
+
async getNodes(version: string = "1"): Promise<APIResponse<NodeCatalogResponse>> {
|
|
86
|
+
const response = await this.client.GET<NodeCatalogResponse>("/v1/api/catalog/nodes", {
|
|
87
|
+
params: { query: { version } },
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// Extract headers for metadata (if available from raw response)
|
|
91
|
+
return response;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Get the Tool Catalog.
|
|
96
|
+
* Returns tool definitions with input/output schemas.
|
|
97
|
+
*/
|
|
98
|
+
async getTools(version: string = "1"): Promise<APIResponse<ToolCatalogResponse>> {
|
|
99
|
+
const response = await this.client.GET<ToolCatalogResponse>("/v1/api/tools/definitions", {
|
|
100
|
+
params: { query: { version } },
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
return response;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Get the Trigger Templates Catalog.
|
|
108
|
+
* Returns trigger configurations and input schemas.
|
|
109
|
+
*/
|
|
110
|
+
async getTriggers(version: string = "1"): Promise<APIResponse<TriggerCatalogResponse>> {
|
|
111
|
+
const response = await this.client.GET<TriggerCatalogResponse>("/v1/api/triggers/templates", {
|
|
112
|
+
params: { query: { version } },
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
return response;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Get all catalogs at once for convenience.
|
|
120
|
+
* Returns combined catalog data with versions.
|
|
121
|
+
*/
|
|
122
|
+
async getAll(version: string = "1"): Promise<{
|
|
123
|
+
data?: {
|
|
124
|
+
nodes: NodeCatalogResponse;
|
|
125
|
+
tools: ToolCatalogResponse;
|
|
126
|
+
triggers: TriggerCatalogResponse;
|
|
127
|
+
catalog_versions: CatalogVersions;
|
|
128
|
+
};
|
|
129
|
+
error?: { code: string; message: string; details?: unknown };
|
|
130
|
+
}> {
|
|
131
|
+
const [nodesRes, toolsRes, triggersRes] = await Promise.all([
|
|
132
|
+
this.getNodes(version),
|
|
133
|
+
this.getTools(version),
|
|
134
|
+
this.getTriggers(version),
|
|
135
|
+
]);
|
|
136
|
+
|
|
137
|
+
if (nodesRes.error) return { data: undefined, error: nodesRes.error };
|
|
138
|
+
if (toolsRes.error) return { data: undefined, error: toolsRes.error };
|
|
139
|
+
if (triggersRes.error) return { data: undefined, error: triggersRes.error };
|
|
140
|
+
|
|
141
|
+
return {
|
|
142
|
+
data: {
|
|
143
|
+
nodes: nodesRes.data!,
|
|
144
|
+
tools: toolsRes.data!,
|
|
145
|
+
triggers: triggersRes.data!,
|
|
146
|
+
catalog_versions: {
|
|
147
|
+
nodes: version,
|
|
148
|
+
tools: version,
|
|
149
|
+
triggers: version,
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
error: undefined,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
}
|
package/src/modules/graphs.ts
CHANGED
|
@@ -21,6 +21,7 @@ export class GraphsModule {
|
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Validate a graph specification.
|
|
24
|
+
* Uses canonical GraphValidator for deep validation.
|
|
24
25
|
*/
|
|
25
26
|
async validate(body: {
|
|
26
27
|
graph_spec: {
|
|
@@ -28,6 +29,12 @@ export class GraphsModule {
|
|
|
28
29
|
nodes: Array<{ id: string; type: string; label?: string }>;
|
|
29
30
|
edges: Array<{ from: string; to: string }>;
|
|
30
31
|
};
|
|
32
|
+
/** Catalog versions for referential integrity checks */
|
|
33
|
+
catalog_versions?: {
|
|
34
|
+
nodes: string;
|
|
35
|
+
tools: string;
|
|
36
|
+
triggers: string;
|
|
37
|
+
};
|
|
31
38
|
}): Promise<APIResponse<GraphValidationResult>> {
|
|
32
39
|
return this.client.POST<GraphValidationResult>("/v1/api/graphs/validate", {
|
|
33
40
|
body,
|