@tai42/api-client 2.0.0 → 3.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.
- package/dist/client.d.ts +73 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +8 -0
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/schemas.d.ts +648 -5
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +101 -5
- package/dist/schemas.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +28 -0
- package/src/index.ts +9 -0
- package/src/schemas.ts +119 -5
package/src/schemas.ts
CHANGED
|
@@ -1857,10 +1857,43 @@ export type RunTrace = z.infer<typeof runTrace>;
|
|
|
1857
1857
|
|
|
1858
1858
|
// -- marketplace -------------------------------------------------------------
|
|
1859
1859
|
|
|
1860
|
+
/**
|
|
1861
|
+
* The CLOSED HTTP-method enum fixed by the contract's RouteMethod, the one source
|
|
1862
|
+
* for every route-method field (declaration and install/preview responses alike):
|
|
1863
|
+
* a wire method the contract does not define fails loudly as drift rather than
|
|
1864
|
+
* passing through silently.
|
|
1865
|
+
*/
|
|
1866
|
+
export const routeMethod = z.enum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE']);
|
|
1867
|
+
export type RouteMethod = z.infer<typeof routeMethod>;
|
|
1868
|
+
|
|
1869
|
+
/**
|
|
1870
|
+
* One HTTP route an item declares in its `tai-plugin.yml`: a `path` relative to
|
|
1871
|
+
* the item's mount base, the `methods` it answers, and whether it is served
|
|
1872
|
+
* `public` (without authentication). The absolute path an operator sees is
|
|
1873
|
+
* resolved from the base at install time.
|
|
1874
|
+
*/
|
|
1875
|
+
export const marketplaceRouteDecl = z.object({
|
|
1876
|
+
path: z.string(),
|
|
1877
|
+
methods: z.array(routeMethod),
|
|
1878
|
+
public: z.boolean(),
|
|
1879
|
+
});
|
|
1880
|
+
export type MarketplaceRouteDecl = z.infer<typeof marketplaceRouteDecl>;
|
|
1881
|
+
|
|
1882
|
+
/**
|
|
1883
|
+
* A route-carrying item's declared mount: the default `base` prefix the routes
|
|
1884
|
+
* hang off (an operator may remap it at install) and the `paths` it registers.
|
|
1885
|
+
*/
|
|
1886
|
+
export const marketplaceRoutesDecl = z.object({
|
|
1887
|
+
base: z.string(),
|
|
1888
|
+
paths: z.array(marketplaceRouteDecl),
|
|
1889
|
+
});
|
|
1890
|
+
export type MarketplaceRoutesDecl = z.infer<typeof marketplaceRoutesDecl>;
|
|
1891
|
+
|
|
1860
1892
|
/**
|
|
1861
1893
|
* One contained item of a marketplace plugin's published version: its kind
|
|
1862
1894
|
* (tool / agent / extension / …), name, description, free-form tags, and the
|
|
1863
|
-
* logical group it belongs to (`null` when ungrouped).
|
|
1895
|
+
* logical group it belongs to (`null` when ungrouped). `routes` is present only
|
|
1896
|
+
* on a route-carrying item (a router or channel); absent/null on every other.
|
|
1864
1897
|
*/
|
|
1865
1898
|
export const marketplaceItem = z.object({
|
|
1866
1899
|
kind: z.string(),
|
|
@@ -1868,6 +1901,7 @@ export const marketplaceItem = z.object({
|
|
|
1868
1901
|
description: z.string(),
|
|
1869
1902
|
tags: z.array(z.string()),
|
|
1870
1903
|
group: z.string().nullable(),
|
|
1904
|
+
routes: marketplaceRoutesDecl.nullish(),
|
|
1871
1905
|
});
|
|
1872
1906
|
export type MarketplaceItem = z.infer<typeof marketplaceItem>;
|
|
1873
1907
|
|
|
@@ -2071,6 +2105,10 @@ export const marketplaceInstalledPlugin = z
|
|
|
2071
2105
|
// (local truth). The McpTab joins the mcp-server item names against the
|
|
2072
2106
|
// manifest's mcp-entry titles to render an installer-written entry read-only.
|
|
2073
2107
|
items: z.array(marketplaceItem.pick({ kind: true, name: true })),
|
|
2108
|
+
// The persisted `{item_name: base}` mount this plugin is installed at (local
|
|
2109
|
+
// truth; `{}` means every item at its declared base). Studio seeds the update
|
|
2110
|
+
// flow and renders routes at the ACTUAL mounted base from this.
|
|
2111
|
+
route_mounts: z.record(z.string(), z.string()),
|
|
2074
2112
|
})
|
|
2075
2113
|
.strict();
|
|
2076
2114
|
export type MarketplaceInstalledPlugin = z.infer<typeof marketplaceInstalledPlugin>;
|
|
@@ -2130,22 +2168,98 @@ export const marketplaceCategories = z.array(z.string());
|
|
|
2130
2168
|
/** The registry's controlled item-kind list, proxied through the skeleton. */
|
|
2131
2169
|
export const marketplaceKinds = z.array(z.string());
|
|
2132
2170
|
|
|
2171
|
+
/**
|
|
2172
|
+
* One route the install / update actually mounted: the item that owns it, the
|
|
2173
|
+
* absolute `full_path` it now answers, the `methods`, and whether it is served
|
|
2174
|
+
* `public`. The receipt lists these so the operator sees what was opened where.
|
|
2175
|
+
*/
|
|
2176
|
+
export const marketplaceMountedRoute = z.object({
|
|
2177
|
+
item: z.string(),
|
|
2178
|
+
full_path: z.string(),
|
|
2179
|
+
methods: z.array(routeMethod),
|
|
2180
|
+
public: z.boolean(),
|
|
2181
|
+
});
|
|
2182
|
+
export type MarketplaceMountedRoute = z.infer<typeof marketplaceMountedRoute>;
|
|
2183
|
+
|
|
2133
2184
|
/**
|
|
2134
2185
|
* The receipt of an install / update: what landed and at which version.
|
|
2135
2186
|
* `notes` (env-selected items naming their activating env var) and any
|
|
2136
|
-
* non-critical `advisories` ride BOTH the install and update receipts.
|
|
2137
|
-
*
|
|
2138
|
-
*
|
|
2139
|
-
*
|
|
2187
|
+
* non-critical `advisories` ride BOTH the install and update receipts.
|
|
2188
|
+
* `routes` is the mounted-route list — empty for a plugin that registers none.
|
|
2189
|
+
* The wire also carries `package`, `reload`, and `pip_output`, which the receipt
|
|
2190
|
+
* does not model — zod's default strip drops them; the UI renders the receipt,
|
|
2191
|
+
* not the raw install log.
|
|
2140
2192
|
*/
|
|
2141
2193
|
export const marketplaceInstallResult = z.object({
|
|
2142
2194
|
ref: z.string(),
|
|
2143
2195
|
version: z.string(),
|
|
2144
2196
|
notes: z.array(z.string()),
|
|
2145
2197
|
advisories: z.array(marketplaceAdvisory),
|
|
2198
|
+
routes: z.array(marketplaceMountedRoute),
|
|
2146
2199
|
});
|
|
2147
2200
|
export type MarketplaceInstallResult = z.infer<typeof marketplaceInstallResult>;
|
|
2148
2201
|
|
|
2202
|
+
/** One resolved route in an install preview: the declared `path`, its resolved
|
|
2203
|
+
* absolute `full_path`, the `methods`, and whether it is `public`. */
|
|
2204
|
+
export const marketplacePreviewRoute = z.object({
|
|
2205
|
+
path: z.string(),
|
|
2206
|
+
full_path: z.string(),
|
|
2207
|
+
methods: z.array(routeMethod),
|
|
2208
|
+
public: z.boolean(),
|
|
2209
|
+
});
|
|
2210
|
+
export type MarketplacePreviewRoute = z.infer<typeof marketplacePreviewRoute>;
|
|
2211
|
+
|
|
2212
|
+
/** One route-carrying item in an install preview: its resolved `base` (the
|
|
2213
|
+
* override or the default), the `default_base` it declares, and the routes that
|
|
2214
|
+
* mount under it. */
|
|
2215
|
+
export const marketplacePreviewItem = z.object({
|
|
2216
|
+
item: z.string(),
|
|
2217
|
+
kind: z.string(),
|
|
2218
|
+
base: z.string(),
|
|
2219
|
+
default_base: z.string(),
|
|
2220
|
+
routes: z.array(marketplacePreviewRoute),
|
|
2221
|
+
});
|
|
2222
|
+
export type MarketplacePreviewItem = z.infer<typeof marketplacePreviewItem>;
|
|
2223
|
+
|
|
2224
|
+
/** One collision the preview found: a route whose resolved shape+method clashes
|
|
2225
|
+
* with an already-owned route. `conflict_owner` is `core` or `plugin:<ref>`; the
|
|
2226
|
+
* remedy is to remap the item's base. */
|
|
2227
|
+
export const marketplacePreviewCollision = z.object({
|
|
2228
|
+
item: z.string(),
|
|
2229
|
+
full_path: z.string(),
|
|
2230
|
+
methods: z.array(routeMethod),
|
|
2231
|
+
conflict_owner: z.string(),
|
|
2232
|
+
conflict_path: z.string(),
|
|
2233
|
+
});
|
|
2234
|
+
export type MarketplacePreviewCollision = z.infer<typeof marketplacePreviewCollision>;
|
|
2235
|
+
|
|
2236
|
+
/** One public route the operator is asked to accept: served WITHOUT
|
|
2237
|
+
* authentication once installed. */
|
|
2238
|
+
export const marketplacePreviewPublicRoute = z.object({
|
|
2239
|
+
item: z.string(),
|
|
2240
|
+
full_path: z.string(),
|
|
2241
|
+
methods: z.array(routeMethod),
|
|
2242
|
+
});
|
|
2243
|
+
export type MarketplacePreviewPublicRoute = z.infer<typeof marketplacePreviewPublicRoute>;
|
|
2244
|
+
|
|
2245
|
+
/**
|
|
2246
|
+
* The install preview (`POST /api/marketplace/install/preview`): the resolved
|
|
2247
|
+
* routes per item with any base overrides applied, the collisions against the
|
|
2248
|
+
* live registry, the public routes requiring acceptance, and whether acceptance
|
|
2249
|
+
* is required at all. `new_public_routes` narrows to rows not already approved
|
|
2250
|
+
* (the update case); on a fresh install it equals `public_routes`.
|
|
2251
|
+
*/
|
|
2252
|
+
export const marketplaceInstallPreview = z.object({
|
|
2253
|
+
ref: z.string(),
|
|
2254
|
+
version: z.string(),
|
|
2255
|
+
items: z.array(marketplacePreviewItem),
|
|
2256
|
+
collisions: z.array(marketplacePreviewCollision),
|
|
2257
|
+
public_routes: z.array(marketplacePreviewPublicRoute),
|
|
2258
|
+
new_public_routes: z.array(marketplacePreviewPublicRoute),
|
|
2259
|
+
requires_public_acceptance: z.boolean(),
|
|
2260
|
+
});
|
|
2261
|
+
export type MarketplaceInstallPreview = z.infer<typeof marketplaceInstallPreview>;
|
|
2262
|
+
|
|
2149
2263
|
/**
|
|
2150
2264
|
* The receipt of an uninstall. `notes` carries operator warnings (e.g. a config
|
|
2151
2265
|
* provider still selected by its env var); render them like the install
|