@agent-os-sdk/client 0.9.8 → 0.9.10

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.
Files changed (77) hide show
  1. package/dist/client/AgentOsClient.d.ts +6 -2
  2. package/dist/client/AgentOsClient.d.ts.map +1 -1
  3. package/dist/client/AgentOsClient.js +10 -3
  4. package/dist/client/HttpRequestBuilder.d.ts +1 -0
  5. package/dist/client/HttpRequestBuilder.d.ts.map +1 -1
  6. package/dist/client/HttpRequestBuilder.js +6 -2
  7. package/dist/client/auth.d.ts +4 -0
  8. package/dist/client/auth.d.ts.map +1 -1
  9. package/dist/client/raw.d.ts +12 -0
  10. package/dist/client/raw.d.ts.map +1 -1
  11. package/dist/client/raw.js +67 -3
  12. package/dist/generated/openapi.d.ts +115 -186
  13. package/dist/generated/openapi.d.ts.map +1 -1
  14. package/dist/index.d.ts +4 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +4 -0
  17. package/dist/modules/agents.d.ts +30 -0
  18. package/dist/modules/agents.d.ts.map +1 -1
  19. package/dist/modules/agents.js +25 -1
  20. package/dist/modules/builder.d.ts +0 -4
  21. package/dist/modules/builder.d.ts.map +1 -1
  22. package/dist/modules/credentials.d.ts +4 -1
  23. package/dist/modules/credentials.d.ts.map +1 -1
  24. package/dist/modules/credentials.js +36 -1
  25. package/dist/modules/datasets.d.ts +80 -0
  26. package/dist/modules/datasets.d.ts.map +1 -0
  27. package/dist/modules/datasets.js +91 -0
  28. package/dist/modules/files.d.ts +34 -13
  29. package/dist/modules/files.d.ts.map +1 -1
  30. package/dist/modules/files.js +86 -19
  31. package/dist/modules/graphs.d.ts +1 -1
  32. package/dist/modules/graphs.d.ts.map +1 -1
  33. package/dist/modules/members.d.ts +0 -6
  34. package/dist/modules/members.d.ts.map +1 -1
  35. package/dist/modules/members.js +0 -6
  36. package/dist/modules/observability.d.ts +19 -0
  37. package/dist/modules/observability.d.ts.map +1 -0
  38. package/dist/modules/observability.js +14 -0
  39. package/dist/modules/roles.d.ts +64 -0
  40. package/dist/modules/roles.d.ts.map +1 -0
  41. package/dist/modules/roles.js +79 -0
  42. package/dist/modules/runs.d.ts +2 -0
  43. package/dist/modules/runs.d.ts.map +1 -1
  44. package/dist/modules/runs.js +2 -2
  45. package/dist/modules/threads.js +2 -2
  46. package/dist/modules/triggers.d.ts +51 -5
  47. package/dist/modules/triggers.d.ts.map +1 -1
  48. package/dist/modules/triggers.js +39 -0
  49. package/dist/modules/usage.d.ts +68 -9
  50. package/dist/modules/usage.d.ts.map +1 -1
  51. package/dist/modules/usage.js +27 -3
  52. package/dist/modules/vectorStores.d.ts +6 -3
  53. package/dist/modules/vectorStores.d.ts.map +1 -1
  54. package/dist/modules/vectorStores.js +86 -14
  55. package/package.json +1 -1
  56. package/src/client/AgentOsClient.ts +10 -3
  57. package/src/client/HttpRequestBuilder.ts +7 -2
  58. package/src/client/auth.ts +4 -0
  59. package/src/client/raw.ts +91 -4
  60. package/src/generated/openapi.ts +115 -186
  61. package/src/generated/swagger.json +96 -180
  62. package/src/index.ts +4 -1
  63. package/src/modules/agents.ts +56 -2
  64. package/src/modules/builder.ts +0 -7
  65. package/src/modules/credentials.ts +44 -2
  66. package/src/modules/datasets.ts +142 -0
  67. package/src/modules/files.ts +125 -29
  68. package/src/modules/graphs.ts +1 -1
  69. package/src/modules/members.ts +0 -7
  70. package/src/modules/observability.ts +28 -0
  71. package/src/modules/roles.ts +112 -0
  72. package/src/modules/runs.ts +4 -2
  73. package/src/modules/threads.ts +2 -2
  74. package/src/modules/triggers.ts +87 -6
  75. package/src/modules/usage.ts +94 -9
  76. package/src/modules/vectorStores.ts +115 -18
  77. package/src/modules/knowledge.ts +0 -147
@@ -1192,6 +1192,9 @@
1192
1192
  }
1193
1193
  }
1194
1194
  }
1195
+ },
1196
+ "500": {
1197
+ "description": "Internal Server Error"
1195
1198
  }
1196
1199
  }
1197
1200
  }
@@ -1354,12 +1357,10 @@
1354
1357
  "tags": [
1355
1358
  "Catalog"
1356
1359
  ],
1357
- "summary": "Get the Node Types Catalog.",
1358
1360
  "parameters": [
1359
1361
  {
1360
1362
  "name": "version",
1361
1363
  "in": "query",
1362
- "description": "API version (default: 1)",
1363
1364
  "schema": {
1364
1365
  "type": "integer",
1365
1366
  "format": "int32",
@@ -1386,12 +1387,10 @@
1386
1387
  "tags": [
1387
1388
  "Catalog"
1388
1389
  ],
1389
- "summary": "Get the Trigger Templates Catalog.",
1390
1390
  "parameters": [
1391
1391
  {
1392
1392
  "name": "version",
1393
1393
  "in": "query",
1394
- "description": "API version (default: 1)",
1395
1394
  "schema": {
1396
1395
  "type": "integer",
1397
1396
  "format": "int32",
@@ -1418,12 +1417,10 @@
1418
1417
  "tags": [
1419
1418
  "Catalog"
1420
1419
  ],
1421
- "summary": "Get the Node Presets Catalog.",
1422
1420
  "parameters": [
1423
1421
  {
1424
1422
  "name": "version",
1425
1423
  "in": "query",
1426
- "description": "API version (default: 1)",
1427
1424
  "schema": {
1428
1425
  "type": "integer",
1429
1426
  "format": "int32",
@@ -3633,125 +3630,12 @@
3633
3630
  }
3634
3631
  }
3635
3632
  },
3636
- "/v1/api/knowledge/datasets": {
3637
- "get": {
3638
- "tags": [
3639
- "Knowledge"
3640
- ],
3641
- "summary": "List datasets (alias for vector stores).",
3642
- "parameters": [
3643
- {
3644
- "name": "limit",
3645
- "in": "query",
3646
- "schema": {
3647
- "type": "integer",
3648
- "format": "int32",
3649
- "default": 20
3650
- }
3651
- },
3652
- {
3653
- "name": "offset",
3654
- "in": "query",
3655
- "schema": {
3656
- "type": "integer",
3657
- "format": "int32",
3658
- "default": 0
3659
- }
3660
- }
3661
- ],
3662
- "responses": {
3663
- "200": {
3664
- "description": "OK"
3665
- }
3666
- }
3667
- }
3668
- },
3669
- "/v1/api/knowledge/datasets/{id}": {
3670
- "get": {
3671
- "tags": [
3672
- "Knowledge"
3673
- ],
3674
- "summary": "Get a specific dataset.",
3675
- "parameters": [
3676
- {
3677
- "name": "id",
3678
- "in": "path",
3679
- "required": true,
3680
- "schema": {
3681
- "type": "string",
3682
- "format": "uuid"
3683
- }
3684
- }
3685
- ],
3686
- "responses": {
3687
- "200": {
3688
- "description": "OK"
3689
- }
3690
- }
3691
- }
3692
- },
3693
- "/v1/api/knowledge/retrieve": {
3694
- "post": {
3695
- "tags": [
3696
- "Knowledge"
3697
- ],
3698
- "summary": "Semantic search across datasets.",
3699
- "requestBody": {
3700
- "content": {
3701
- "application/json": {
3702
- "schema": {
3703
- "$ref": "#/components/schemas/RetrieveRequest"
3704
- }
3705
- },
3706
- "text/json": {
3707
- "schema": {
3708
- "$ref": "#/components/schemas/RetrieveRequest"
3709
- }
3710
- },
3711
- "application/*+json": {
3712
- "schema": {
3713
- "$ref": "#/components/schemas/RetrieveRequest"
3714
- }
3715
- }
3716
- }
3717
- },
3718
- "responses": {
3719
- "200": {
3720
- "description": "OK"
3721
- }
3722
- }
3723
- }
3724
- },
3725
- "/v1/api/knowledge/datasets/{id}/sync": {
3726
- "post": {
3727
- "tags": [
3728
- "Knowledge"
3729
- ],
3730
- "summary": "Trigger dataset sync/reindexing.",
3731
- "parameters": [
3732
- {
3733
- "name": "id",
3734
- "in": "path",
3735
- "required": true,
3736
- "schema": {
3737
- "type": "string",
3738
- "format": "uuid"
3739
- }
3740
- }
3741
- ],
3742
- "responses": {
3743
- "200": {
3744
- "description": "OK"
3745
- }
3746
- }
3747
- }
3748
- },
3749
3633
  "/v1/api/me": {
3750
3634
  "get": {
3751
3635
  "tags": [
3752
3636
  "Me"
3753
3637
  ],
3754
- "summary": "Get current user identity, tenant and workspace context (lightweight, backward compatible).",
3638
+ "summary": "Get current user identity, tenant and workspace context (lightweight).",
3755
3639
  "responses": {
3756
3640
  "200": {
3757
3641
  "description": "OK"
@@ -4755,7 +4639,7 @@
4755
4639
  "Runs"
4756
4640
  ],
4757
4641
  "summary": "Starts a new agent run asynchronously.",
4758
- "description": "Creates a new run and queues it for execution. The run will be processed\nby the data plane and its status can be monitored via polling or SSE.\n\n**Thread Resolution:**\n- If `thread.id` is provided, uses existing thread\n- If `thread` is omitted, creates a new thread automatically\n\n**Idempotency:**\nProvide `Idempotency-Key` header to prevent duplicate runs.\nIf a run with the same key exists and is still valid, returns 200 instead of 201.\n\n**Example Request:**\n```json\n{\n \"agent_id\": \"...\",\n \"input\": { \"messages\": [{ \"role\": \"user\", \"content\": \"Hello\" }] }\n}\n```",
4642
+ "description": "Creates a new run and queues it for execution. The run will be processed\nby the data plane and its status can be monitored via polling or SSE.\n\n**Thread Resolution:**\n- If `thread.id` is provided, uses existing thread\n- If `thread` is omitted, creates a new thread automatically\n\n**Idempotency:**\nProvide `idempotency_key` in request body to prevent duplicate runs.\nIf a run with the same key exists and is still valid, returns 200 instead of 201.\n\n**Example Request:**\n```json\n{\n \"agent_id\": \"...\",\n \"input\": { \"messages\": [{ \"role\": \"user\", \"content\": \"Hello\" }] }\n}\n```",
4759
4643
  "requestBody": {
4760
4644
  "description": "The run request with agent ID and input.",
4761
4645
  "content": {
@@ -4807,6 +4691,16 @@
4807
4691
  }
4808
4692
  }
4809
4693
  },
4694
+ "422": {
4695
+ "description": "Unprocessable Content",
4696
+ "content": {
4697
+ "application/json": {
4698
+ "schema": {
4699
+ "$ref": "#/components/schemas/ProblemDetails"
4700
+ }
4701
+ }
4702
+ }
4703
+ },
4810
4704
  "401": {
4811
4705
  "description": "Authentication required.",
4812
4706
  "content": {
@@ -5072,6 +4966,16 @@
5072
4966
  }
5073
4967
  }
5074
4968
  }
4969
+ },
4970
+ "422": {
4971
+ "description": "Unprocessable Content",
4972
+ "content": {
4973
+ "application/json": {
4974
+ "schema": {
4975
+ "$ref": "#/components/schemas/ProblemDetails"
4976
+ }
4977
+ }
4978
+ }
5075
4979
  }
5076
4980
  }
5077
4981
  }
@@ -5122,6 +5026,16 @@
5122
5026
  }
5123
5027
  }
5124
5028
  }
5029
+ },
5030
+ "422": {
5031
+ "description": "Unprocessable Content",
5032
+ "content": {
5033
+ "application/json": {
5034
+ "schema": {
5035
+ "$ref": "#/components/schemas/ProblemDetails"
5036
+ }
5037
+ }
5038
+ }
5125
5039
  }
5126
5040
  }
5127
5041
  }
@@ -6421,6 +6335,19 @@
6421
6335
  }
6422
6336
  }
6423
6337
  },
6338
+ "/v1/api/credentials/types": {
6339
+ "get": {
6340
+ "tags": [
6341
+ "Tools"
6342
+ ],
6343
+ "summary": "List credential types.",
6344
+ "responses": {
6345
+ "200": {
6346
+ "description": "OK"
6347
+ }
6348
+ }
6349
+ }
6350
+ },
6424
6351
  "/v1/api/credential-types": {
6425
6352
  "get": {
6426
6353
  "tags": [
@@ -6434,6 +6361,29 @@
6434
6361
  }
6435
6362
  }
6436
6363
  },
6364
+ "/v1/api/credentials/types/{name}": {
6365
+ "get": {
6366
+ "tags": [
6367
+ "Tools"
6368
+ ],
6369
+ "summary": "Get a specific credential type.",
6370
+ "parameters": [
6371
+ {
6372
+ "name": "name",
6373
+ "in": "path",
6374
+ "required": true,
6375
+ "schema": {
6376
+ "type": "string"
6377
+ }
6378
+ }
6379
+ ],
6380
+ "responses": {
6381
+ "200": {
6382
+ "description": "OK"
6383
+ }
6384
+ }
6385
+ }
6386
+ },
6437
6387
  "/v1/api/credential-types/{name}": {
6438
6388
  "get": {
6439
6389
  "tags": [
@@ -7383,7 +7333,7 @@
7383
7333
  "tags": [
7384
7334
  "Usage"
7385
7335
  ],
7386
- "summary": "Get usage metrics with real data from usage_events.",
7336
+ "summary": "Get usage metrics with real data from runtime.cost_events.",
7387
7337
  "parameters": [
7388
7338
  {
7389
7339
  "name": "workspaceId",
@@ -8622,7 +8572,7 @@
8622
8572
  },
8623
8573
  "nullable": true
8624
8574
  },
8625
- "scheduled_trigger_ids": {
8575
+ "cron_job_ids": {
8626
8576
  "type": "array",
8627
8577
  "items": {
8628
8578
  "type": "string",
@@ -8965,6 +8915,10 @@
8965
8915
  "format": "uuid",
8966
8916
  "nullable": true
8967
8917
  },
8918
+ "type": {
8919
+ "type": "string",
8920
+ "nullable": true
8921
+ },
8968
8922
  "workspace_id": {
8969
8923
  "type": "string",
8970
8924
  "format": "uuid",
@@ -8983,15 +8937,6 @@
8983
8937
  "type": "string",
8984
8938
  "format": "uuid",
8985
8939
  "nullable": true
8986
- },
8987
- "data": {
8988
- "type": "object",
8989
- "additionalProperties": { },
8990
- "nullable": true
8991
- },
8992
- "type": {
8993
- "type": "string",
8994
- "nullable": true
8995
8940
  }
8996
8941
  },
8997
8942
  "additionalProperties": false
@@ -10321,14 +10266,6 @@
10321
10266
  "PlaygroundRunRequest": {
10322
10267
  "type": "object",
10323
10268
  "properties": {
10324
- "tenant_id": {
10325
- "type": "string",
10326
- "format": "uuid"
10327
- },
10328
- "workspace_id": {
10329
- "type": "string",
10330
- "format": "uuid"
10331
- },
10332
10269
  "agent_id": {
10333
10270
  "type": "string",
10334
10271
  "format": "uuid"
@@ -10343,7 +10280,7 @@
10343
10280
  }
10344
10281
  },
10345
10282
  "additionalProperties": false,
10346
- "description": "Playground request - note: TenantId/WorkspaceId from body are IGNORED,\nwe use IRequestContext for security."
10283
+ "description": "Playground request."
10347
10284
  },
10348
10285
  "PresignedDownloadResponse": {
10349
10286
  "type": "object",
@@ -10467,6 +10404,21 @@
10467
10404
  },
10468
10405
  "set_as_live": {
10469
10406
  "type": "boolean"
10407
+ },
10408
+ "required_tools": {
10409
+ "type": "array",
10410
+ "items": {
10411
+ "type": "string"
10412
+ },
10413
+ "nullable": true
10414
+ },
10415
+ "tool_credential_bindings": {
10416
+ "type": "object",
10417
+ "additionalProperties": {
10418
+ "type": "string",
10419
+ "format": "uuid"
10420
+ },
10421
+ "nullable": true
10470
10422
  }
10471
10423
  },
10472
10424
  "additionalProperties": false
@@ -10599,39 +10551,6 @@
10599
10551
  },
10600
10552
  "additionalProperties": false
10601
10553
  },
10602
- "RetrieveRequest": {
10603
- "type": "object",
10604
- "properties": {
10605
- "workspace_id": {
10606
- "type": "string",
10607
- "format": "uuid",
10608
- "nullable": true
10609
- },
10610
- "vector_store_id": {
10611
- "type": "string",
10612
- "format": "uuid"
10613
- },
10614
- "query": {
10615
- "type": "string",
10616
- "nullable": true
10617
- },
10618
- "top_k": {
10619
- "type": "integer",
10620
- "format": "int32"
10621
- },
10622
- "min_score": {
10623
- "type": "number",
10624
- "format": "float",
10625
- "nullable": true
10626
- },
10627
- "filters": {
10628
- "type": "object",
10629
- "additionalProperties": { },
10630
- "nullable": true
10631
- }
10632
- },
10633
- "additionalProperties": false
10634
- },
10635
10554
  "RevisionDetailResponse": {
10636
10555
  "type": "object",
10637
10556
  "properties": {
@@ -11584,8 +11503,8 @@
11584
11503
  "TriggerTemplateDto": {
11585
11504
  "required": [
11586
11505
  "kind",
11587
- "name",
11588
- "slug"
11506
+ "slug",
11507
+ "title"
11589
11508
  ],
11590
11509
  "type": "object",
11591
11510
  "properties": {
@@ -11597,7 +11516,7 @@
11597
11516
  "type": "string",
11598
11517
  "nullable": true
11599
11518
  },
11600
- "name": {
11519
+ "title": {
11601
11520
  "type": "string",
11602
11521
  "nullable": true
11603
11522
  },
@@ -12305,9 +12224,6 @@
12305
12224
  {
12306
12225
  "name": "GraphSpec"
12307
12226
  },
12308
- {
12309
- "name": "Knowledge"
12310
- },
12311
12227
  {
12312
12228
  "name": "Me"
12313
12229
  },
package/src/index.ts CHANGED
@@ -98,11 +98,14 @@ export * from "./modules/agents.js";
98
98
  export * from "./modules/auth.js";
99
99
  export * from "./modules/chatwoot.js";
100
100
  export * from "./modules/credentials.js";
101
+ export * from "./modules/datasets.js";
101
102
  export * from "./modules/me.js";
102
103
  export * from "./modules/members.js";
104
+ export * from "./modules/observability.js";
103
105
  export * from "./modules/presets.js";
104
106
  export * from "./modules/prompts.js";
107
+ export * from "./modules/roles.js";
105
108
  export * from "./modules/runs.js";
106
109
  export * from "./modules/triggers.js";
110
+ export * from "./modules/usage.js";
107
111
  export * from "./modules/workspaces.js";
108
-
@@ -53,6 +53,21 @@ export interface GraphValidationResponse {
53
53
  warnings?: string[];
54
54
  }
55
55
 
56
+ export interface UpsertAgentCredentialBindingRequest {
57
+ credential_id: string;
58
+ alias: string;
59
+ priority?: number;
60
+ }
61
+
62
+ export interface AgentCredentialBindingUpsertResponse {
63
+ id: string;
64
+ updated: boolean;
65
+ agent_id: string;
66
+ credential_id: string;
67
+ alias: string;
68
+ priority: number;
69
+ }
70
+
56
71
  export type AgentListResponse = PaginatedResponse<Agent>;
57
72
 
58
73
  export class AgentsModule {
@@ -219,6 +234,7 @@ export class AgentsModule {
219
234
  options?: {
220
235
  version_label?: string | null;
221
236
  set_as_live?: boolean;
237
+ required_tools?: string[];
222
238
  /** Idempotency key for safe retries */
223
239
  idempotency_key?: string;
224
240
  }
@@ -233,8 +249,9 @@ export class AgentsModule {
233
249
  body: {
234
250
  graph_spec,
235
251
  version_label: options?.version_label ?? null,
236
- set_as_live: options?.set_as_live ?? true
237
- },
252
+ set_as_live: options?.set_as_live ?? true,
253
+ required_tools: options?.required_tools ?? []
254
+ } as any,
238
255
  headers
239
256
  });
240
257
  }
@@ -257,6 +274,34 @@ export class AgentsModule {
257
274
  });
258
275
  }
259
276
 
277
+ /**
278
+ * Get Mermaid diagram for a specific bundle graph.
279
+ */
280
+ async getBundleMermaid(agentId: string, bundleId: string): Promise<APIResponse<BundleMermaidResponse>> {
281
+ return this.client.GET<BundleMermaidResponse>("/v1/api/agents/{agentId}/bundles/{bundleId}/graph/mermaid", {
282
+ params: { path: { agentId, bundleId } },
283
+ headers: this.headers(),
284
+ });
285
+ }
286
+
287
+ /**
288
+ * Creates or updates an agent credential binding by alias.
289
+ */
290
+ async upsertCredentialBinding(
291
+ agentId: string,
292
+ body: UpsertAgentCredentialBindingRequest
293
+ ): Promise<APIResponse<AgentCredentialBindingUpsertResponse>> {
294
+ return this.client.POST<AgentCredentialBindingUpsertResponse>("/v1/api/agents/{id}/credential-bindings", {
295
+ params: { path: { id: agentId } },
296
+ body: {
297
+ credential_id: body.credential_id,
298
+ alias: body.alias,
299
+ priority: body.priority ?? 0,
300
+ },
301
+ headers: this.headers(),
302
+ });
303
+ }
304
+
260
305
  }
261
306
 
262
307
  // Bundle manifest response type
@@ -272,3 +317,12 @@ export interface BundleManifestResponse {
272
317
  created_at?: string;
273
318
  graph_spec?: Record<string, unknown>;
274
319
  }
320
+
321
+ export interface BundleMermaidResponse {
322
+ bundle_id: string;
323
+ agent_id: string;
324
+ mermaid: string;
325
+ format?: string;
326
+ node_count?: number;
327
+ edge_count?: number;
328
+ }
@@ -118,11 +118,6 @@ export type HintModel = {
118
118
  };
119
119
 
120
120
  export type GraphUpdateAction = {
121
- // Legacy support
122
- action: string;
123
- // ... legacy fields omitted for brevity, keeping strict new protocol
124
- } | {
125
- // New protocol (WAVE-3)
126
121
  graph_spec: Record<string, unknown>;
127
122
  hints?: HintModel[];
128
123
  has_errors?: boolean;
@@ -166,8 +161,6 @@ export type PatchOp = {
166
161
  label?: string;
167
162
  data?: Record<string, unknown>;
168
163
  set?: Record<string, unknown>;
169
- source?: string;
170
- target?: string;
171
164
  from?: string;
172
165
  to?: string;
173
166
  entrypoint?: string;
@@ -29,12 +29,15 @@ export interface CredentialListResponse {
29
29
  export interface CredentialType {
30
30
  id: string;
31
31
  name: string;
32
- schema: Record<string, unknown>;
32
+ display_name?: string;
33
33
  description?: string;
34
+ schema_public_json?: Record<string, unknown> | null;
35
+ schema_secret_json?: Record<string, unknown> | null;
34
36
  }
35
37
 
36
38
  export interface CredentialTypesResponse {
37
39
  items: CredentialType[];
40
+ count?: number;
38
41
  }
39
42
 
40
43
  export interface ValidateCredentialResponse {
@@ -131,9 +134,48 @@ export class CredentialsModule {
131
134
  * List available credential types.
132
135
  */
133
136
  async listTypes(): Promise<APIResponse<CredentialTypesResponse>> {
134
- return this.client.GET<CredentialTypesResponse>("/v1/api/credentials/types", {
137
+ const response = await this.client.GET<unknown>("/v1/api/credential-types", {
135
138
  headers: this.headers(),
136
139
  });
140
+
141
+ if (!response.data || response.error) {
142
+ return response as APIResponse<CredentialTypesResponse>;
143
+ }
144
+
145
+ const raw = response.data as Record<string, unknown>;
146
+ const rawItems = Array.isArray(raw)
147
+ ? raw
148
+ : Array.isArray(raw.items)
149
+ ? raw.items
150
+ : [];
151
+
152
+ const items: CredentialType[] = rawItems
153
+ .filter((item): item is Record<string, unknown> => Boolean(item) && typeof item === "object")
154
+ .map((item) => ({
155
+ id: String(item.id ?? ""),
156
+ name: String(item.name ?? item.key ?? ""),
157
+ display_name: typeof item.display_name === "string"
158
+ ? item.display_name
159
+ : typeof item.displayName === "string"
160
+ ? item.displayName
161
+ : undefined,
162
+ description: typeof item.description === "string" ? item.description : undefined,
163
+ schema_public_json: item.schema_public_json && typeof item.schema_public_json === "object"
164
+ ? item.schema_public_json as Record<string, unknown>
165
+ : null,
166
+ schema_secret_json: item.schema_secret_json && typeof item.schema_secret_json === "object"
167
+ ? item.schema_secret_json as Record<string, unknown>
168
+ : null,
169
+ }))
170
+ .filter((item) => item.id && item.name);
171
+
172
+ return {
173
+ ...response,
174
+ data: {
175
+ items,
176
+ count: typeof raw.count === "number" ? raw.count : items.length,
177
+ },
178
+ };
137
179
  }
138
180
 
139
181
  /**