@tai42/api-client 32.0.0 → 33.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 +78 -50
  32. package/dist/fleet-report.d.ts.map +1 -1
  33. package/dist/fleet-report.js +106 -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 +192 -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 +9 -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
@@ -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;