@tai42/api-client 4.0.0 → 5.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/src/schemas.ts CHANGED
@@ -758,7 +758,10 @@ export const providerView = z.object({
758
758
  id: z.string(),
759
759
  display_name: z.string(),
760
760
  description: z.string(),
761
- icon_url: z.string(),
761
+ // Required and a real URL: the contract's `ProviderDescriptor.icon_url` runs
762
+ // `check_web_url(schemes=("https",))`, which rejects an empty/relative value, so
763
+ // an empty or malformed one here is drift and fails the parse loudly.
764
+ icon_url: z.string().url(),
762
765
  kind: z.enum(['oauth', 'none']),
763
766
  origin: z.enum(['system', 'community']),
764
767
  category: z.string(),
@@ -1893,6 +1896,31 @@ export type RunTrace = z.infer<typeof runTrace>;
1893
1896
  export const routeMethod = z.enum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE']);
1894
1897
  export type RouteMethod = z.infer<typeof routeMethod>;
1895
1898
 
1899
+ /**
1900
+ * How the plugin is delivered, derived server-side from whether its spec names a
1901
+ * package: `package` is pip-installed, `descriptor` (marketplace `source` `spec`)
1902
+ * installs nothing but the manifest entry. A CLOSED enum, so a wire value the
1903
+ * server does not derive fails loudly as drift.
1904
+ */
1905
+ export const marketplaceDelivery = z.enum(['package', 'descriptor']);
1906
+ export type MarketplaceDelivery = z.infer<typeof marketplaceDelivery>;
1907
+
1908
+ /**
1909
+ * The install-provenance vocabulary a listing/version resolves from: a pip index
1910
+ * (`pypi`), a git tag (`github`), or a descriptor yml (`spec`). CLOSED, so a wire
1911
+ * value outside it fails as drift.
1912
+ */
1913
+ export const marketplaceSource = z.enum(['pypi', 'github', 'spec']);
1914
+ export type MarketplaceSource = z.infer<typeof marketplaceSource>;
1915
+
1916
+ /**
1917
+ * One env var an item requires before install: its `name` and whether its value is
1918
+ * a `secret` (an OAuth client secret is; a client id or a plain marker var is not).
1919
+ * The install dialog seeds each toggle from `secret` and collects the missing ones.
1920
+ */
1921
+ export const marketplaceRequiredEnvVar = z.object({ name: z.string(), secret: z.boolean() });
1922
+ export type MarketplaceRequiredEnvVar = z.infer<typeof marketplaceRequiredEnvVar>;
1923
+
1896
1924
  /**
1897
1925
  * One HTTP route an item declares in its `tai-plugin.yml`: a `path` relative to
1898
1926
  * the item's mount base, the `methods` it answers, and whether it is served
@@ -1921,6 +1949,12 @@ export type MarketplaceRoutesDecl = z.infer<typeof marketplaceRoutesDecl>;
1921
1949
  * (tool / agent / extension / …), name, description, free-form tags, and the
1922
1950
  * logical group it belongs to (`null` when ungrouped). `routes` is present only
1923
1951
  * on a route-carrying item (a router or channel); absent/null on every other.
1952
+ * `required_env` is the env vars the item needs before install — but the REGISTRY's
1953
+ * plugin-detail body does NOT carry it per item: required-env is server-computed
1954
+ * (`required_env_for_spec`) and rides the install PREVIEW, never the listing detail,
1955
+ * so the registry OMITS it here and it parses as `undefined`. Optional (not
1956
+ * defaulted) so the type mirrors the wire; the authority the install dialog collects
1957
+ * from is the preview's `required_env`/`missing_env`, never this field.
1924
1958
  */
1925
1959
  export const marketplaceItem = z.object({
1926
1960
  kind: z.string(),
@@ -1929,6 +1963,7 @@ export const marketplaceItem = z.object({
1929
1963
  tags: z.array(z.string()),
1930
1964
  group: z.string().nullable(),
1931
1965
  routes: marketplaceRoutesDecl.nullish(),
1966
+ required_env: z.array(marketplaceRequiredEnvVar).optional(),
1932
1967
  });
1933
1968
  export type MarketplaceItem = z.infer<typeof marketplaceItem>;
1934
1969
 
@@ -1970,7 +2005,8 @@ export const marketplaceSearchRow = z.object({
1970
2005
  name: z.string(),
1971
2006
  display_name: z.string().nullable(),
1972
2007
  icon_url: z.string().nullable(),
1973
- package: z.string(),
2008
+ // Null for a descriptor listing (`source` `spec`): it names no package.
2009
+ package: z.string().nullable(),
1974
2010
  description: z.string(),
1975
2011
  categories: z.array(z.string()),
1976
2012
  tags: z.array(z.string()),
@@ -2014,35 +2050,16 @@ export const marketplaceVersion = z.object({
2014
2050
  export type MarketplaceVersion = z.infer<typeof marketplaceVersion>;
2015
2051
 
2016
2052
  /**
2017
- * The listing's latest published version as embedded in its detail: the version,
2018
- * the items it contains, and a minimal typed passthrough of the published spec.
2019
- *
2020
- * `spec` is carried so the install dialog can read an mcp-server item's public
2021
- * `mcp.env` marker strings (`provides[].mcp.env`) and collect its required `!ENV`
2022
- * vars before install. Only that path is typed; everything else on the spec is
2023
- * `.passthrough()`-preserved but unmodelled (zod would otherwise strip the whole
2024
- * `spec` as an unknown key). Nullable + optional: a listing with nothing published
2025
- * carries no spec.
2053
+ * The listing's latest published version as embedded in its detail: the version
2054
+ * (with the `marketplaceVersion` lifecycle fields) and the items it contains. The
2055
+ * registry's detail body carries NO per-version `delivery` field — delivery is
2056
+ * server-computed from whether the spec names a package, and the detail surface
2057
+ * derives it from the listing's `package` (null ⇒ `descriptor`, else `package`).
2058
+ * Env to collect comes from the install preview (`required_env` / `missing_env`),
2059
+ * never from these items.
2026
2060
  */
2027
2061
  export const marketplaceLatestVersion = marketplaceVersion.extend({
2028
2062
  items: z.array(marketplaceItem),
2029
- spec: z
2030
- .object({
2031
- provides: z.array(
2032
- z
2033
- .object({
2034
- kind: z.string(),
2035
- name: z.string(),
2036
- mcp: z
2037
- .object({ env: z.record(z.string(), z.string()).nullish() })
2038
- .passthrough()
2039
- .nullish(),
2040
- })
2041
- .passthrough(),
2042
- ),
2043
- })
2044
- .passthrough()
2045
- .nullish(),
2046
2063
  });
2047
2064
  export type MarketplaceLatestVersion = z.infer<typeof marketplaceLatestVersion>;
2048
2065
 
@@ -2070,7 +2087,11 @@ export const marketplacePluginDetail = z.object({
2070
2087
  name: z.string(),
2071
2088
  display_name: z.string().nullable(),
2072
2089
  icon_url: z.string().nullable(),
2073
- package: z.string(),
2090
+ // Null for a descriptor listing (`source` `spec`): it names no package.
2091
+ package: z.string().nullable(),
2092
+ // The install-provenance vocabulary (`pypi` / `github` / `spec`). Nullish: an
2093
+ // older registry omits it, and a listing with nothing published carries none.
2094
+ source: marketplaceSource.nullish(),
2074
2095
  description: z.string(),
2075
2096
  readme_md: z.string().nullable(),
2076
2097
  license: z.string().nullable(),
@@ -2122,6 +2143,9 @@ export const marketplaceInstalledPlugin = z
2122
2143
  ref: z.string(),
2123
2144
  version: z.string(),
2124
2145
  source: z.string(),
2146
+ // How the row was delivered: `package` for a pip-installed plugin, `descriptor`
2147
+ // for a descriptor-only plugin whose stored spec names no package.
2148
+ delivery: marketplaceDelivery,
2125
2149
  installed_at: z.string(),
2126
2150
  latest: z.string().nullable(),
2127
2151
  update_available: z.boolean(),
@@ -2275,6 +2299,11 @@ export type MarketplacePreviewPublicRoute = z.infer<typeof marketplacePreviewPub
2275
2299
  * live registry, the public routes requiring acceptance, and whether acceptance
2276
2300
  * is required at all. `new_public_routes` narrows to rows not already approved
2277
2301
  * (the update case); on a fresh install it equals `public_routes`.
2302
+ *
2303
+ * `required_env` is every env var the spec requires with its derived secret-ness;
2304
+ * `missing_env` is the bare names not already present in the env store union
2305
+ * process env (server-computed — the ONE authority the dialog collects), and
2306
+ * `delivery` is the one word the surface shows (`package` / `descriptor`).
2278
2307
  */
2279
2308
  export const marketplaceInstallPreview = z.object({
2280
2309
  ref: z.string(),
@@ -2284,6 +2313,9 @@ export const marketplaceInstallPreview = z.object({
2284
2313
  public_routes: z.array(marketplacePreviewPublicRoute),
2285
2314
  new_public_routes: z.array(marketplacePreviewPublicRoute),
2286
2315
  requires_public_acceptance: z.boolean(),
2316
+ required_env: z.array(marketplaceRequiredEnvVar),
2317
+ missing_env: z.array(z.string()),
2318
+ delivery: marketplaceDelivery,
2287
2319
  });
2288
2320
  export type MarketplaceInstallPreview = z.infer<typeof marketplaceInstallPreview>;
2289
2321