@tai42/api-client 32.0.0 → 34.0.0

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 (100) hide show
  1. package/dist/client/backend-client.d.ts +27 -0
  2. package/dist/client/backend-client.d.ts.map +1 -1
  3. package/dist/client/backup-client.d.ts +4 -0
  4. package/dist/client/backup-client.d.ts.map +1 -1
  5. package/dist/client/config-client.d.ts +31 -0
  6. package/dist/client/config-client.d.ts.map +1 -1
  7. package/dist/client/index.d.ts +148 -1
  8. package/dist/client/index.d.ts.map +1 -1
  9. package/dist/client/index.js +5 -0
  10. package/dist/client/index.js.map +1 -1
  11. package/dist/client/manifest-client.d.ts +33 -1
  12. package/dist/client/manifest-client.d.ts.map +1 -1
  13. package/dist/client/manifest-client.js +3 -3
  14. package/dist/client/manifest-client.js.map +1 -1
  15. package/dist/client/marketplace-client.d.ts +40 -0
  16. package/dist/client/marketplace-client.d.ts.map +1 -1
  17. package/dist/client/profiles-client.d.ts +4 -0
  18. package/dist/client/profiles-client.d.ts.map +1 -1
  19. package/dist/client/tool-extensions-client.d.ts +4 -0
  20. package/dist/client/tool-extensions-client.d.ts.map +1 -1
  21. package/dist/client/tools-client.d.ts +1 -0
  22. package/dist/client/tools-client.d.ts.map +1 -1
  23. package/dist/failed-mcp-roster.d.ts +30 -0
  24. package/dist/failed-mcp-roster.d.ts.map +1 -0
  25. package/dist/failed-mcp-roster.js +56 -0
  26. package/dist/failed-mcp-roster.js.map +1 -0
  27. package/dist/failed-reply-roll.d.ts +22 -0
  28. package/dist/failed-reply-roll.d.ts.map +1 -0
  29. package/dist/failed-reply-roll.js +46 -0
  30. package/dist/failed-reply-roll.js.map +1 -0
  31. package/dist/fleet-report.d.ts +122 -50
  32. package/dist/fleet-report.d.ts.map +1 -1
  33. package/dist/fleet-report.js +168 -89
  34. package/dist/fleet-report.js.map +1 -1
  35. package/dist/generated/api-routes.d.ts +4 -4
  36. package/dist/generated/api-routes.js +1 -1
  37. package/dist/generated/api-routes.js.map +1 -1
  38. package/dist/generated/openapi-schemas.d.ts +303 -30
  39. package/dist/generated/openapi-schemas.d.ts.map +1 -1
  40. package/dist/generated/openapi-schemas.js +14 -13
  41. package/dist/generated/openapi-schemas.js.map +1 -1
  42. package/dist/generated/served-schemas.d.ts +1 -1
  43. package/dist/generated/served-schemas.js +1 -1
  44. package/dist/generated/served-schemas.js.map +1 -1
  45. package/dist/http.d.ts.map +1 -1
  46. package/dist/http.js +5 -2
  47. package/dist/http.js.map +1 -1
  48. package/dist/index.d.ts +8 -3
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +4 -1
  51. package/dist/index.js.map +1 -1
  52. package/dist/mcp-failure.d.ts +18 -0
  53. package/dist/mcp-failure.d.ts.map +1 -0
  54. package/dist/mcp-failure.js +39 -0
  55. package/dist/mcp-failure.js.map +1 -0
  56. package/dist/schemas/backup.d.ts +8 -0
  57. package/dist/schemas/backup.d.ts.map +1 -1
  58. package/dist/schemas/fleet.d.ts +49 -10
  59. package/dist/schemas/fleet.d.ts.map +1 -1
  60. package/dist/schemas/fleet.js +20 -11
  61. package/dist/schemas/fleet.js.map +1 -1
  62. package/dist/schemas/manifest-mcp.d.ts +9 -6
  63. package/dist/schemas/manifest-mcp.d.ts.map +1 -1
  64. package/dist/schemas/manifest-mcp.js +4 -3
  65. package/dist/schemas/manifest-mcp.js.map +1 -1
  66. package/dist/schemas/marketplace.d.ts +44 -2
  67. package/dist/schemas/marketplace.d.ts.map +1 -1
  68. package/dist/schemas/marketplace.js +8 -2
  69. package/dist/schemas/marketplace.js.map +1 -1
  70. package/dist/schemas/profiles.d.ts +13 -7
  71. package/dist/schemas/profiles.d.ts.map +1 -1
  72. package/dist/schemas/profiles.js +9 -7
  73. package/dist/schemas/profiles.js.map +1 -1
  74. package/dist/schemas/served.d.ts +1 -1
  75. package/dist/schemas/system-kinds.d.ts +4 -0
  76. package/dist/schemas/system-kinds.d.ts.map +1 -1
  77. package/dist/schemas/system-kinds.js +5 -4
  78. package/dist/schemas/system-kinds.js.map +1 -1
  79. package/dist/schemas/tools.d.ts +5 -1
  80. package/dist/schemas/tools.d.ts.map +1 -1
  81. package/dist/schemas/tools.js +3 -1
  82. package/dist/schemas/tools.js.map +1 -1
  83. package/package.json +1 -1
  84. package/src/client/index.ts +5 -0
  85. package/src/client/manifest-client.ts +4 -4
  86. package/src/failed-mcp-roster.ts +70 -0
  87. package/src/failed-reply-roll.ts +71 -0
  88. package/src/fleet-report.ts +306 -118
  89. package/src/generated/api-routes.ts +1 -1
  90. package/src/generated/openapi-schemas.ts +16 -13
  91. package/src/generated/served-schemas.ts +1 -1
  92. package/src/http.ts +5 -2
  93. package/src/index.ts +13 -2
  94. package/src/mcp-failure.ts +46 -0
  95. package/src/schemas/fleet.ts +20 -11
  96. package/src/schemas/manifest-mcp.ts +4 -3
  97. package/src/schemas/marketplace.ts +8 -2
  98. package/src/schemas/profiles.ts +9 -7
  99. package/src/schemas/system-kinds.ts +5 -4
  100. package/src/schemas/tools.ts +3 -1
@@ -181,16 +181,16 @@ export type FanoutSummary = z.infer<typeof fanoutSummary>;
181
181
  export const freshLife = z.object({ "generation": z.number().int(), "kind": z.string(), "name": z.string() });
182
182
  export type FreshLife = z.infer<typeof freshLife>;
183
183
 
184
- export const recycleEntry = z.object({ "detail": z.string().nullable().default(null), "generation_before": z.number().int(), "kind": z.string(), "name": z.string(), "status": z.string() });
184
+ export const recycleEntry = z.object({ "detail": z.string().nullable().default(null), "generation_before": z.number().int(), "keys": z.array(z.string()), "kind": z.string(), "name": z.string(), "status": z.string() });
185
185
  export type RecycleEntry = z.infer<typeof recycleEntry>;
186
186
 
187
187
  export const recycleStop = z.object({ "detail": z.string(), "kind": z.string(), "name": z.string().nullable() });
188
188
  export type RecycleStop = z.infer<typeof recycleStop>;
189
189
 
190
- export const recycleRoll = z.object({ "fresh": z.array(freshLife), "recycle": z.array(recycleEntry), "recycle_stopped": recycleStop.nullable().default(null) });
190
+ export const recycleRoll = z.object({ "fresh": z.array(freshLife), "recycle": z.array(recycleEntry), "recycle_stopped": recycleStop.nullable().default(null), "skipped": z.array(z.string()) });
191
191
  export type RecycleRoll = z.infer<typeof recycleRoll>;
192
192
 
193
- export const applyResponse = z.object({ "awaiting_respawn": z.array(awaitingWorker).default([]), "env_keys": z.number().int(), "fanout": fanoutSummary, "recycle": recycleRoll.nullable().default(null), "span_release_error": z.string().nullable().default(null), "status": z.string() });
193
+ export const applyResponse = z.object({ "awaiting_respawn": z.array(awaitingWorker).default([]), "env_keys": z.number().int(), "fanout": fanoutSummary, "recycle": recycleRoll.nullable().default(null), "roll_deferred": z.boolean().default(false), "roll_deferred_to": z.string().nullable().default(null), "span_release_error": z.string().nullable().default(null), "status": z.string() });
194
194
  export type ApplyResponse = z.infer<typeof applyResponse>;
195
195
 
196
196
  export const applyResult = z.object({ "applied": z.boolean(), "data": z.record(z.string(), z.unknown()).nullable().default(null), "seq": z.number().nullable().default(null), "skipped": z.array(z.record(z.string(), z.unknown())).default([]) }).strict();
@@ -238,7 +238,7 @@ export type BackupExportDocument = z.infer<typeof backupExportDocument>;
238
238
  export const backupImport = z.object({ "document": z.record(z.string(), z.unknown()), "mode": z.enum(["skip","overwrite"]).default("skip"), "sections": z.array(z.string()) });
239
239
  export type BackupImport = z.infer<typeof backupImport>;
240
240
 
241
- export const backupSectionReport = z.object({ "awaiting_respawn": z.array(awaitingWorker).default([]), "created": z.number().int().default(0), "details": z.record(z.string(), z.unknown()).default({}), "errors": z.array(z.string()).default([]), "fanout": fanoutSummary.nullable().default(null), "recycle": recycleRoll.nullable().default(null), "skipped": z.number().int().default(0), "span_release_error": z.string().nullable().default(null), "updated": z.number().int().default(0) }).strict();
241
+ export const backupSectionReport = z.object({ "awaiting_respawn": z.array(awaitingWorker).default([]), "created": z.number().int().default(0), "details": z.record(z.string(), z.unknown()).default({}), "errors": z.array(z.string()).default([]), "fanout": fanoutSummary.nullable().default(null), "recycle": recycleRoll.nullable().default(null), "roll_deferred": z.boolean().default(false), "roll_deferred_to": z.string().nullable().default(null), "skipped": z.number().int().default(0), "span_release_error": z.string().nullable().default(null), "updated": z.number().int().default(0) }).strict();
242
242
  export type BackupSectionReport = z.infer<typeof backupSectionReport>;
243
243
 
244
244
  export const backupImportResult = z.object({ "ok": z.boolean(), "sections": z.record(z.string(), backupSectionReport) });
@@ -424,6 +424,9 @@ export type OpOutcome = z.infer<typeof opOutcome>;
424
424
  export const workerResult = z.object({ "detail": z.string().nullable().default(null), "error": z.string().nullable().default(null), "name": z.string(), "outcome": opOutcome, "payload": z.unknown().nullable().default(null) });
425
425
  export type WorkerResult = z.infer<typeof workerResult>;
426
426
 
427
+ export const fleetReloadResponse = z.object({ "awaiting_respawn": z.array(awaitingWorker).default([]), "error": z.string().nullable().default(null), "local_only": z.boolean().default(false), "ok": z.boolean().readonly(), "op": z.string(), "reachable": z.boolean().default(true), "recycle": recycleRoll.nullable().default(null), "results": z.array(workerResult).default([]), "roll_deferred": z.boolean().default(false), "roll_deferred_to": z.string().nullable().default(null) });
428
+ export type FleetReloadResponse = z.infer<typeof fleetReloadResponse>;
429
+
427
430
  export const fleetResult = z.object({ "error": z.string().nullable().default(null), "local_only": z.boolean().default(false), "ok": z.boolean().readonly(), "op": z.string(), "reachable": z.boolean().default(true), "results": z.array(workerResult).default([]) });
428
431
  export type FleetResult = z.infer<typeof fleetResult>;
429
432
 
@@ -568,7 +571,7 @@ export type LoginMethodsListing = z.infer<typeof loginMethodsListing>;
568
571
  export const logoutResult = z.object({ "end_session_url": z.string().nullable().default(null), "revoked": z.boolean() });
569
572
  export type LogoutResult = z.infer<typeof logoutResult>;
570
573
 
571
- export const mCPConfig = z.object({ "args": z.array(z.string()).default([]), "command": z.string().nullable().default(null), "env": z.record(z.string(), z.string()).default({}), "headers": z.record(z.string(), z.string()).default({}), "type": z.string().nullable().default(null), "uds": z.string().nullable().default(null), "url": z.string().nullable().default(null) }).strict();
574
+ export const mCPConfig = z.object({ "args": z.array(z.string()).default([]), "command": z.string().nullable().default(null), "env": z.record(z.string(), z.string()).default({}), "headers": z.record(z.string(), z.string()).default({}), "type": z.enum(["http","uds","stdio"]).nullable().default(null), "uds": z.string().nullable().default(null), "url": z.string().nullable().default(null) }).strict();
572
575
  export type MCPConfig = z.infer<typeof mCPConfig>;
573
576
 
574
577
  export const manifestExtensionMap = z.object({ "extensions": z.record(z.string(), z.array(z.array(z.union([z.string(), z.record(z.string(), z.unknown())])))), "title": z.string() });
@@ -592,7 +595,7 @@ export type MarketplaceUninstall = z.infer<typeof marketplaceUninstall>;
592
595
  export const marketplaceUpdate = z.object({ "accept_public_routes": z.boolean().default(false), "env": z.record(z.string(), z.string()).nullable().default(null), "ref": z.string(), "route_mounts": z.record(z.string(), z.string()).nullable().default(null), "secret_keys": z.array(z.string()).nullable().default(null), "version": z.string().nullable().default(null) });
593
596
  export type MarketplaceUpdate = z.infer<typeof marketplaceUpdate>;
594
597
 
595
- export const mcpAdvertisedTool = z.object({ "bound": z.boolean(), "description": z.string().nullable(), "name": z.string(), "selected": z.boolean(), "title": z.string().nullable(), "unbound_reason": z.enum(["server_failed","not_loaded","preset_conflict","unusable_schema","not_listed_at_bind"]).nullable() });
598
+ export const mcpAdvertisedTool = z.object({ "bound": z.boolean(), "description": z.string().nullable(), "name": z.string(), "selected": z.boolean(), "title": z.string().nullable(), "unbound_reason": z.enum(["preset_conflict","unusable_schema","pending_bind"]).nullable() });
596
599
  export type McpAdvertisedTool = z.infer<typeof mcpAdvertisedTool>;
597
600
 
598
601
  export const mcpAdvertisedTools = z.object({ "exclude": z.array(z.string()), "include": z.array(z.string()), "title": z.string(), "tools": z.array(mcpAdvertisedTool), "unadvertised": z.array(z.string()) });
@@ -814,7 +817,7 @@ export type PrincipalRef = z.infer<typeof principalRef>;
814
817
  export const principalUpdate = z.object({ "disabled": z.boolean().nullable().default(null), "display_name": z.string().min(1).nullable().default(null) });
815
818
  export type PrincipalUpdate = z.infer<typeof principalUpdate>;
816
819
 
817
- export const profileApplyResponse = z.object({ "awaiting_respawn": z.array(awaitingWorker).default([]), "fanout": fanoutSummary, "fresh": z.array(freshLife), "hot": z.array(z.string()), "recycle": z.array(recycleEntry), "recycle_stopped": recycleStop.nullable().default(null), "refused": z.array(z.string()), "span_release_error": z.string().nullable().default(null) });
820
+ export const profileApplyResponse = z.object({ "awaiting_respawn": z.array(awaitingWorker).default([]), "fanout": fanoutSummary, "fresh": z.array(freshLife), "hot": z.array(z.string()), "recycle": z.array(recycleEntry), "recycle_stopped": recycleStop.nullable().default(null), "refused": z.array(z.string()), "roll_deferred": z.boolean().default(false), "roll_deferred_to": z.string().nullable().default(null), "skipped": z.array(z.string()), "span_release_error": z.string().nullable().default(null) });
818
821
  export type ProfileApplyResponse = z.infer<typeof profileApplyResponse>;
819
822
 
820
823
  export const profileDiffChange = z.object({ "key": z.string(), "new": z.string(), "old": z.string() });
@@ -1318,7 +1321,7 @@ export type ToolRunView = z.infer<typeof toolRunView>;
1318
1321
  export const toolSchemaView = z.object({ "description": z.string().nullable(), "input": z.record(z.string(), jsonValue), "output": z.record(z.string(), jsonValue).nullable() });
1319
1322
  export type ToolSchemaView = z.infer<typeof toolSchemaView>;
1320
1323
 
1321
- export const toolTagRow = z.object({ "badges": z.array(z.string()), "hidden": z.boolean(), "name": z.string(), "schedulable": z.boolean(), "tags": z.array(z.string()) });
1324
+ export const toolTagRow = z.object({ "badges": z.array(z.string()), "description": z.string().nullable(), "hidden": z.boolean(), "name": z.string(), "schedulable": z.boolean(), "tags": z.array(z.string()) });
1322
1325
  export type ToolTagRow = z.infer<typeof toolTagRow>;
1323
1326
 
1324
1327
  export const toolTagListResponse = z.array(toolTagRow);
@@ -1354,13 +1357,13 @@ export type TriggerLinkView = z.infer<typeof triggerLinkView>;
1354
1357
  export const triggerLinkListView = z.object({ "items": z.array(triggerLinkView), "total": z.number().int() });
1355
1358
  export type TriggerLinkListView = z.infer<typeof triggerLinkListView>;
1356
1359
 
1357
- export const uninstallResult = z.object({ "notes": z.array(z.string()), "ref": z.string(), "reload": applyResponse.nullable(), "uninstalled": z.boolean() });
1360
+ export const uninstallResult = z.object({ "manifest_written": z.boolean(), "notes": z.array(z.string()), "ref": z.string(), "reload": applyResponse.nullable(), "uninstalled": z.boolean() });
1358
1361
  export type UninstallResult = z.infer<typeof uninstallResult>;
1359
1362
 
1360
1363
  export const upgradeRow = z.object({ "detail": z.string(), "outcome": z.enum(["upgraded","up-to-date","no-compatible-version","failed"]), "ref": z.string(), "span_release_error": z.string().nullable() });
1361
1364
  export type UpgradeRow = z.infer<typeof upgradeRow>;
1362
1365
 
1363
- export const upgradeAllResult = z.object({ "results": z.array(upgradeRow) });
1366
+ export const upgradeAllResult = z.object({ "awaiting_respawn": z.array(awaitingWorker).default([]), "recycle": recycleRoll.nullable().default(null), "results": z.array(upgradeRow), "roll_deferred": z.boolean().default(false), "roll_deferred_to": z.string().nullable().default(null) });
1364
1367
  export type UpgradeAllResult = z.infer<typeof upgradeAllResult>;
1365
1368
 
1366
1369
  export const urlAck = z.object({ "url": z.string() });
@@ -1480,6 +1483,7 @@ export const responseSchemas = {
1480
1483
  get_api_mcp_config_schema: opaqueJson,
1481
1484
  get_api_mcp_status: mcpStatusSnapshot,
1482
1485
  get_api_mcp_status_failed: fleetResult,
1486
+ get_api_mcp_status_title_advertised_tools: mcpAdvertisedTools,
1483
1487
  get_api_notifications: notificationListing,
1484
1488
  get_api_observability_capabilities: observabilityCapabilities,
1485
1489
  get_api_observability_metrics: metricsResult,
@@ -1554,7 +1558,7 @@ export const responseSchemas = {
1554
1558
  post_api_config_profiles_name_apply: profileApplyResponse,
1555
1559
  post_api_config_profiles_name_diff: profileDiff,
1556
1560
  post_api_config_profiles_name_rollback: profileWriteResult,
1557
- post_api_config_reload: fleetResult,
1561
+ post_api_config_reload: fleetReloadResponse,
1558
1562
  post_api_connectors_connections_connection_id_reconnect: startConnectResponse,
1559
1563
  post_api_connectors_connections_start: startConnectOutcome,
1560
1564
  post_api_connectors_oauth_complete: oAuthCompletionResult,
@@ -1567,7 +1571,7 @@ export const responseSchemas = {
1567
1571
  post_api_conversations_route_name_thread_messages: threadMessageAck,
1568
1572
  post_api_delete_template: templateDeleteResult,
1569
1573
  post_api_delete_template_dir: templateDeleteResult,
1570
- post_api_fleet_reload_config: fleetResult,
1574
+ post_api_fleet_reload_config: fleetReloadResponse,
1571
1575
  post_api_hook_runs_id_retry: hookRunView,
1572
1576
  post_api_hooks: hookRegisterResult,
1573
1577
  post_api_hooks_trigger_links: triggerLinkCreated,
@@ -1587,7 +1591,6 @@ export const responseSchemas = {
1587
1591
  post_api_mcp_config_entries: applyResponse,
1588
1592
  post_api_mcp_config_secret_env: applyResponse,
1589
1593
  post_api_mcp_status_reload_failed: fleetResult,
1590
- post_api_mcp_status_title_advertised_tools: mcpAdvertisedTools,
1591
1594
  post_api_mcp_status_title_deregister: fleetResult,
1592
1595
  post_api_mcp_status_title_reload: fleetResult,
1593
1596
  post_api_notifications: notifyResult,
@@ -5876,7 +5876,7 @@ export const servedDocumentsJson = {
5876
5876
  }
5877
5877
  },
5878
5878
  "additionalProperties": false,
5879
- "description": "One row of the schedule listing: no arguments, no kwargs.",
5879
+ "description": "One row of the schedule listing: no arguments, no kwargs.\n\n``next_run_at_ts`` is the next run's POSIX timestamp, ``None`` when the schedule has no next\nrun (``0.0`` is a timestamp like any other). ``next_run_at_iso`` is derived from it, the UTC\nISO-8601 form or ``None``: a row is built without it, and a given value that disagrees with\nthe timestamp is refused.",
5880
5880
  "properties": {
5881
5881
  "cadence": {
5882
5882
  "discriminator": {
package/src/http.ts CHANGED
@@ -10,6 +10,7 @@
10
10
  import type { z } from 'zod';
11
11
 
12
12
  import { ApiConflictError, ApiError, ApiSchemaError, ApiUnauthorizedError } from './errors';
13
+ import { checkFailedReplyRoll } from './failed-reply-roll';
13
14
  import { API_KEY_HEADER } from './headers';
14
15
 
15
16
  /** Supplies the current API key (in-memory or sessionStorage-backed) + base URL. */
@@ -109,8 +110,9 @@ function retryAfterSeconds(header: string | null): number | undefined {
109
110
  * Read the JSON body of a request response, applying the transport's error
110
111
  * policy: a non-2xx status throws (a 409 as `ApiConflictError` carrying the
111
112
  * parsed body, every other as `ApiError` with the server message/code and the
112
- * named `Retry-After` delay), and a body that is not JSON throws `ApiSchemaError`
113
- * on a 2xx or `ApiError` otherwise. Returns the parsed payload only for a 2xx.
113
+ * named `Retry-After` delay), a non-2xx whose recycle roll does not match its schema
114
+ * throws `ApiSchemaError`, and a body that is not JSON throws `ApiSchemaError` on a
115
+ * 2xx or `ApiError` otherwise. Returns the parsed payload only for a 2xx.
114
116
  */
115
117
  async function readJsonPayload(
116
118
  response: Response,
@@ -131,6 +133,7 @@ async function readJsonPayload(
131
133
  }
132
134
 
133
135
  if (!response.ok) {
136
+ checkFailedReplyRoll(path, payload);
134
137
  const { message, code } = extractError(payload);
135
138
  const text = message ?? (response.statusText || 'request failed');
136
139
  // The parsed body rides the error so a caller can key a follow-up on its structured
package/src/index.ts CHANGED
@@ -62,18 +62,27 @@ export {
62
62
  ApiSetupFailedError,
63
63
  ApiUnauthorizedError,
64
64
  } from './errors';
65
+ export type { FailedMcpEntry } from './failed-mcp-roster';
66
+ export { failedMcpsFromReport } from './failed-mcp-roster';
67
+ export type { FailedReplyRoll } from './failed-reply-roll';
68
+ export { failedReplyRoll } from './failed-reply-roll';
65
69
  export type {
66
- FailedMcpEntry,
70
+ AwaitingRestartReading,
67
71
  FleetFailureOutcome,
72
+ FleetFanoutReply,
73
+ FleetReloadNamedWorker,
74
+ FleetReloadReach,
75
+ FleetReloadSummary,
76
+ FleetReloadWorkerStatement,
68
77
  FleetReportStatus,
69
78
  FleetReportSummary,
70
79
  FleetWorkerAwaitingRespawn,
71
80
  FleetWorkerFailure,
72
81
  } from './fleet-report';
73
82
  export {
74
- failedMcpsFromReport,
75
83
  isFleetReportFailure,
76
84
  summarizeFleetFanout,
85
+ summarizeFleetReload,
77
86
  summarizeFleetResult,
78
87
  } from './fleet-report';
79
88
  export type { ApiOperationId, ApiPathPrefix, ApiPathTemplate } from './generated/api-routes';
@@ -81,6 +90,7 @@ export { apiPathPrefixes, apiRoutes, buildPath } from './generated/api-routes';
81
90
  export { API_KEY_HEADER } from './headers';
82
91
  export type { ApiConfig, RequestOptions } from './http';
83
92
  export { apiDownload, apiRequest, apiText } from './http';
93
+ export { isMcpStarting } from './mcp-failure';
84
94
  export type {
85
95
  AnswerFormat,
86
96
  AnswerPageWording,
@@ -91,6 +101,7 @@ export type {
91
101
  AttachmentMediaKind,
92
102
  AuthCapabilities,
93
103
  AuthRoute,
104
+ AwaitingWorker,
94
105
  BackendInfo,
95
106
  BackupDocument,
96
107
  BackupExportDocument,
@@ -0,0 +1,46 @@
1
+ /**
2
+ * What the platform says about an MCP server that has no tool listing on the answering
3
+ * worker. The failed-MCP list (`GET /api/mcp-status` `failed`, and each worker's roster from
4
+ * `GET /api/mcp-status/failed`) holds every server whose tools are not bound, each with a
5
+ * coarse `category`. Every category but `starting` is a failure; `starting` is a start still
6
+ * in progress: the record goes away when the start binds its tools, or turns into a failure
7
+ * category when the start fails.
8
+ *
9
+ * A call that must read a server's held listing (the advertised-tools read, and the check of
10
+ * a write that changes a tool selection) is refused when the worker holds none: a start in
11
+ * progress is a retriable `503` whose envelope carries the code `mcp-server-starting`, a
12
+ * server the worker has not loaded is a `503` with the code `mcp-server-not-loaded`, and a
13
+ * failed start or bind is a `502` whose message carries the recorded cause.
14
+ */
15
+ import { ApiError } from './errors';
16
+
17
+ /** The category of a record whose server start is still in progress. */
18
+ const STARTING_CATEGORY = 'starting';
19
+
20
+ /** The envelope `code` of a call refused because a server start is still in progress. */
21
+ const STARTING_CODE = 'mcp-server-starting';
22
+
23
+ /** The envelope `code` of a call refused because the worker has not loaded the server. */
24
+ const NOT_LOADED_CODE = 'mcp-server-not-loaded';
25
+
26
+ /** Whether a failed-MCP record is a server start still in progress rather than a failure. */
27
+ export function isMcpStarting(record: { readonly category?: string | undefined }): boolean {
28
+ return record.category === STARTING_CATEGORY;
29
+ }
30
+
31
+ /**
32
+ * Whether `error` is a call refused because the server it had to list is still starting:
33
+ * an `ApiError` whose envelope carries the code `mcp-server-starting`. Any other error,
34
+ * an `ApiError` with another code included, answers `false`.
35
+ */
36
+ export const isMcpStartingError = (error: unknown): boolean =>
37
+ error instanceof ApiError && error.code === STARTING_CODE;
38
+
39
+ /**
40
+ * Whether `error` is a call refused because the answering worker has not loaded the server it
41
+ * had to list (a reload binds it): an `ApiError` whose envelope carries the code
42
+ * `mcp-server-not-loaded`. Any other error, an `ApiError` with another code included, answers
43
+ * `false`.
44
+ */
45
+ export const isMcpNotLoadedError = (error: unknown): boolean =>
46
+ error instanceof ApiError && error.code === NOT_LOADED_CODE;
@@ -77,20 +77,24 @@ export type FleetWorkerResult = z.infer<typeof fleetWorkerResult>;
77
77
  * sibling is a visible `failed`/`missing`/`departed`/`timed_out`/`resyncing`/`recycling`/
78
78
  * `stale` entry, never a silent stale worker. Bus-unreachable (`reachable: false`): the
79
79
  * transport failed before any worker could reply, so `results` is empty and only `error`
80
- * is carried. This is the bare body of `POST /api/fleet/reload-config` and the single-MCP
81
- * reload; it is also the body the mode-wrapped {@link fleetReportFanout} carries under its
80
+ * is carried. This is the bare body of the single-MCP reload, deregister and tool
81
+ * reload/remove; it is also the body the mode-wrapped {@link fleetReportFanout} carries under its
82
82
  * `fleet` / `unreachable` modes.
83
83
  */
84
84
  export const fleetResult = openapi.fleetResult;
85
85
  export type FleetResult = z.infer<typeof fleetResult>;
86
86
 
87
87
  /**
88
- * `POST /api/fleet/reload-config` — soft-restart the fleet and report per-worker. The
89
- * serving worker applies its own reload first, then broadcasts; the returned report
90
- * names every worker's outcome. A failed local apply does not abort the broadcast, so
91
- * the report is embedded even on the convergence-failure path.
88
+ * `POST /api/fleet/reload-config` and `POST /api/config/reload` — soft-restart the fleet,
89
+ * then restart the workers whose env needs a restart. The serving worker applies its own
90
+ * reload first, then broadcasts; the reply carries the per-worker {@link fleetResult}
91
+ * fields, `recycle` (the recycle roll the reload ran, `null` when it had no worker to
92
+ * visit), `awaiting_respawn` (the operation's verdict: the workers still awaiting a
93
+ * respawn after the roll), and `roll_deferred` / `roll_deferred_to` (set, naming the bus
94
+ * member, when the roll is carried out after the reply). A failed local apply does not
95
+ * abort the broadcast, so the report is embedded even on the convergence-failure path.
92
96
  */
93
- export const fleetReloadResult = fleetResult;
97
+ export const fleetReloadResult = openapi.fleetReloadResponse;
94
98
  export type FleetReloadResult = z.infer<typeof fleetReloadResult>;
95
99
 
96
100
  /**
@@ -120,8 +124,12 @@ export type FleetReportFanout = z.infer<typeof fleetReportFanout>;
120
124
  /**
121
125
  * One worker line of a fleet recycle roll. `status` is `recycled` (confirmed on
122
126
  * reality), `timed-out` or `failed` (the target the roll stopped at — `detail` names
123
- * why), or `self-deferred` (the worker that took the change recycles itself after
124
- * replying). `generation_before` is the life that was recycled.
127
+ * why), `self-deferred` (a restart the roll cannot confirm: the writer's own post-reply
128
+ * self-exit, or a target whose exit waits on its own in-flight change), or `withheld` (a
129
+ * worker whose reload was refused at its epoch build, left running on its current
130
+ * config). `keys` are the recycle-class keys that worker reported moved — the reason it
131
+ * was restarted, or for a `withheld` worker the keys it still awaits.
132
+ * `generation_before` is the life the line started from.
125
133
  */
126
134
  export const recycleEntry = openapi.recycleEntry;
127
135
  export type RecycleEntry = z.infer<typeof recycleEntry>;
@@ -138,8 +146,9 @@ export const recycleStop = openapi.recycleStop;
138
146
  export type RecycleStop = z.infer<typeof recycleStop>;
139
147
 
140
148
  /**
141
- * The report of a fleet recycle roll an env change carrying a recycle-class key ran:
142
- * the worker lines, the fresh lives, and where the roll stopped (`null` when it ran to
149
+ * The report of a fleet recycle roll a reload ran for the workers that needed a restart:
150
+ * the worker lines, `skipped` (the workers whose reload confirmed no moved recycle-class
151
+ * key, left running), the fresh lives, and where the roll stopped (`null` when it ran to
143
152
  * its end). Names only — never an env value.
144
153
  */
145
154
  export const recycleRoll = openapi.recycleRoll;
@@ -80,9 +80,10 @@ export const reloadConfigResult = openapi.applyResponse.extend({ fanout: fleetRe
80
80
  export type ReloadConfigResult = z.infer<typeof reloadConfigResult>;
81
81
 
82
82
  /**
83
- * `POST /api/mcp-status/{title}/advertised-tools` — every tool the server advertises
84
- * (before the entry's include/exclude filter), each with whether it is selected and
85
- * bound, and why not (`unbound_reason`, or `null` when bound or unselected).
83
+ * `GET /api/mcp-status/{title}/advertised-tools` — every tool the server advertised at its
84
+ * bind on the answering worker (before the entry's include/exclude filter), each with
85
+ * whether it is selected and bound, and why not (`unbound_reason`, or `null` when bound or
86
+ * unselected).
86
87
  */
87
88
  export const mcpAdvertisedTools = openapi.mcpAdvertisedTools;
88
89
  export type McpAdvertisedTools = z.infer<typeof mcpAdvertisedTools>;
@@ -266,12 +266,18 @@ export type MarketplaceInstalled = z.infer<typeof marketplaceInstalled>;
266
266
  /**
267
267
  * One per-plugin outcome of `POST /api/marketplace/upgrade-all`: `upgraded`,
268
268
  * already `up-to-date`, `no-compatible-version` in the registry, or `failed`;
269
- * `detail` always carries the human-readable specifics.
269
+ * `detail` always carries the human-readable specifics; `span_release_error` the store's
270
+ * errors releasing its write span after the ref's config writes, or `null` when it released.
270
271
  */
271
272
  export const marketplaceUpgradeAllRow = openapi.upgradeRow;
272
273
  export type MarketplaceUpgradeAllRow = z.infer<typeof marketplaceUpgradeAllRow>;
273
274
 
274
- /** The whole upgrade-all readout: one outcome row per installed plugin. */
275
+ /**
276
+ * The whole upgrade-all reply: one outcome row per installed plugin, the one recycle roll
277
+ * the batch settled (`recycle`, `null` when it had no worker to visit), the workers still
278
+ * awaiting a respawn after it, and `roll_deferred` / `roll_deferred_to` (set, naming the
279
+ * worker, when the roll is carried out after the reply).
280
+ */
275
281
  export const marketplaceUpgradeAllResult = openapi.upgradeAllResult;
276
282
  export type MarketplaceUpgradeAllResult = z.infer<typeof marketplaceUpgradeAllResult>;
277
283
 
@@ -52,18 +52,20 @@ export type SettingsProfileDiff = z.infer<typeof settingsProfileDiff>;
52
52
  /**
53
53
  * `POST /api/config/profiles/{name}/apply` — the dedicated `profile_apply_response`
54
54
  * (action=fenced, destructive). NAMES-ONLY (no env value in any
55
- * section): `hot` is the hot-swapped key names; `recycle` is the orchestrator's
56
- * per-worker section — one `{name, kind, status, generation_before}` row per recycled
57
- * target, `generation_before` the life that was recycled, the applier's OWN row carrying
58
- * the `self-deferred` status literal when the diff has serve-affecting recycle keys;
59
- * `fresh` is the per-kind list of NEW ready lives observed since the pre-apply snapshot
55
+ * section): `hot` is the hot-swapped key names; `recycle` is the roll's worker lines —
56
+ * one `{name, kind, status, generation_before, keys, detail}` line per worker the roll
57
+ * reached (`RecycleEntry` names the statuses), the applier's OWN line carrying the
58
+ * `self-deferred` status when its own restart is armed; `skipped` names the workers whose
59
+ * reload confirmed no moved recycle-class key, left running; `fresh` is the per-kind list of NEW ready lives observed since the pre-apply snapshot
60
60
  * (each `{name, kind, generation}`), evidence of fresh capacity and never claimed as any
61
61
  * target's successor; `refused` is `[]` on success by construction (the refused key
62
62
  * names only on a refusal), the populated refusal surfaces being the diff preview and
63
63
  * the refusal error report; `recycle_stopped` names the target a stopped recycle roll
64
64
  * halted at, or is `null` when the roll ran to its end; `awaiting_respawn` names the
65
- * workers (name + keys) still awaiting a respawn after the apply (empty when the roll
66
- * converged). `fanout` is the mode-wrapped fleet broadcast, parsed EXPLICITLY so a failed
65
+ * workers (name + keys) still awaiting a respawn after the apply — when the roll
66
+ * converged, only the workers whose reload was refused at their epoch build, left running
67
+ * on their current config; `roll_deferred` is `true` when the roll is not judged in this
68
+ * reply, `roll_deferred_to` then naming the worker that carries it out. `fanout` is the mode-wrapped fleet broadcast, parsed EXPLICITLY so a failed
67
69
  * propagation reaches the shared fleet-report handler. A drift throws `ApiSchemaError`.
68
70
  */
69
71
  // The fan-out is hand-typed: the spec publishes it as one object with optional fields.
@@ -30,10 +30,11 @@ export const toolExtensionsApplyResult = reloadConfigResult;
30
30
  export type ToolExtensionsApplyResult = z.infer<typeof toolExtensionsApplyResult>;
31
31
  // `GET /api/mcp-status` — the bound-server map, the servers the viability check
32
32
  // skipped, and each server's health record. Each failed entry carries the coarse,
33
- // credential-free failure detail the platform records: `category` (`auth` for a 401/403,
34
- // `unreachable` for a transport error or timeout, `error` otherwise), the redacted
35
- // `message`, and the `http_status` the failure carried (`null` for a pure transport
36
- // failure).
33
+ // credential-free detail the platform records: `category` (`preset_store` when the preset
34
+ // store could not be read, `auth` for a 401/403, `unreachable` for a transport error or a
35
+ // start that outran the start budget, `starting` for a start still in progress — not a
36
+ // failure, read through `isMcpStarting` — and `error` otherwise), the redacted `message`,
37
+ // and the `http_status` the failure carried (`null` for a pure transport failure).
37
38
  export const mcpStatus = openapi.mcpStatusSnapshot;
38
39
 
39
40
  /**
@@ -83,7 +83,9 @@ export type ToolMediaResult = z.infer<typeof toolMediaResult>;
83
83
  * `badges` are the tool's plugin-DECLARED capability labels — purely INFORMATIONAL
84
84
  * (e.g. `network`, `filesystem`), never a gate the server enforces. The overlay's
85
85
  * own badges are merged on top client-side; this read exposes only the declaration.
86
- * `schedulable` is whether the tool can be scheduled.
86
+ * `schedulable` is whether the tool can be scheduled. `description` is the tool's own
87
+ * declared description, `null` when it declares none; tool pickers draw it under the
88
+ * tool's option and search it with the tool's label.
87
89
  */
88
90
  export const toolTagEntry = openapi.toolTagRow;
89
91
  export const toolTags = openapi.toolTagListResponse;