@tai42/api-client 1.2.0 → 1.4.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
@@ -490,6 +490,25 @@ export const manifestView = z.object({
490
490
  mcp: z.array(manifestMcpEntry),
491
491
  user_tools: z.array(z.string()),
492
492
  });
493
+
494
+ /**
495
+ * One `!ENV ${VAR[:default]}` marker the manifest's MCP section carries
496
+ * (`GET /api/manifest/mcp-env-refs`) — NAMES and BOOLEANS only, NEVER values.
497
+ * `pointer` is the RFC 6901 json-pointer of the leaf (`/mcp/<i>/config/...`);
498
+ * `has_default` is whether the marker carries a `:default`; `set` is whether the
499
+ * var resolves in the EFFECTIVE env (the resolution truth the install-time
500
+ * dangling refusal reads), so a var supplied by the deployment shows green, never
501
+ * a false red. The checklist derives from THIS alone — no env value is ever fetched.
502
+ */
503
+ export const mcpEnvRef = z.object({
504
+ var: z.string(),
505
+ pointer: z.string(),
506
+ has_default: z.boolean(),
507
+ set: z.boolean(),
508
+ });
509
+ export type McpEnvRef = z.infer<typeof mcpEnvRef>;
510
+ export const mcpEnvRefs = z.array(mcpEnvRef);
511
+ export type McpEnvRefs = z.infer<typeof mcpEnvRefs>;
493
512
  /**
494
513
  * The apply result every config-writer mutation returns (`POST /api/mcp-config`,
495
514
  * `POST /api/config/env`): the serving worker's local reload result (`status` +
@@ -1085,6 +1104,51 @@ export const conversationTranscriptPage = z.object({
1085
1104
  });
1086
1105
  export type ConversationTranscriptPage = z.infer<typeof conversationTranscriptPage>;
1087
1106
 
1107
+ // -- channel-web entry gate --------------------------------------------------
1108
+ // The web channel's entry gate: a web route can be gated so its chat page is
1109
+ // served only to a navigation carrying a live entry code. These four doors are
1110
+ // keyed by the route's `our_identity`. A raw code exists only in flight (the
1111
+ // mint reply); a listed code carries its hash id, never a raw value (none is
1112
+ // stored).
1113
+
1114
+ /** One minted entry code as the gate read door lists it — its hash id, its
1115
+ * optional label, and when it was created / dies. Never a raw code. */
1116
+ export const webEntryCode = z.object({
1117
+ code_id: z.string(),
1118
+ label: z.string().nullable(),
1119
+ created_at: z.string(),
1120
+ expires_at: z.string().nullable(),
1121
+ });
1122
+ export type WebEntryCode = z.infer<typeof webEntryCode>;
1123
+
1124
+ /** `GET /api/channels/web/gates/{identity}` — the gate flag and its live codes. */
1125
+ export const webEntryGate = z.object({
1126
+ enabled: z.boolean(),
1127
+ codes: z.array(webEntryCode),
1128
+ });
1129
+ export type WebEntryGate = z.infer<typeof webEntryGate>;
1130
+
1131
+ /** `PUT /api/channels/web/gates/{identity}` — the gate flag after the write. */
1132
+ export const webEntryGateState = z.object({ enabled: z.boolean() });
1133
+ export type WebEntryGateState = z.infer<typeof webEntryGateState>;
1134
+
1135
+ /**
1136
+ * `POST /api/channels/web/gates/{identity}/codes` — a freshly minted code. The
1137
+ * raw `code` rides this reply ONCE (nothing else stores or lists it — a listed
1138
+ * code's raw value is unrecoverable by design); `code_id` is its hash id and
1139
+ * `expires_at` an ISO-8601 instant, or `null` for a code that never expires.
1140
+ */
1141
+ export const webEntryCodeMinted = z.object({
1142
+ code: z.string(),
1143
+ code_id: z.string(),
1144
+ expires_at: z.string().nullable(),
1145
+ });
1146
+ export type WebEntryCodeMinted = z.infer<typeof webEntryCodeMinted>;
1147
+
1148
+ /** `DELETE /api/channels/web/gates/{identity}/codes/{code_id}` — the revoked code. */
1149
+ export const webEntryCodeRevoked = z.object({ status: z.literal('revoked') });
1150
+ export type WebEntryCodeRevoked = z.infer<typeof webEntryCodeRevoked>;
1151
+
1088
1152
  // -- notifications -----------------------------------------------------------
1089
1153
  // The internal notifications sink: the messages the `notify_user` operation records
1090
1154
  // with no channel, so they land only in the Studio inbox. Each record carries the
@@ -1791,6 +1855,9 @@ export const marketplaceSearchRow = z.object({
1791
1855
  tags: z.array(z.string()),
1792
1856
  trust_tier: z.string(),
1793
1857
  pricing: z.string(),
1858
+ // A display-only premium flag (D5: a badge, never a payment surface). Nullable
1859
+ // + optional: an older registry omits it, and it is absent on non-premium rows.
1860
+ premium: z.boolean().nullish(),
1794
1861
  latest_version: z.string().nullable(),
1795
1862
  downloads: z.number(),
1796
1863
  updated_at: z.string(),
@@ -1824,11 +1891,35 @@ export const marketplaceVersion = z.object({
1824
1891
  export type MarketplaceVersion = z.infer<typeof marketplaceVersion>;
1825
1892
 
1826
1893
  /**
1827
- * The listing's latest published version as embedded in its detail: the version
1828
- * plus the items that version contains.
1894
+ * The listing's latest published version as embedded in its detail: the version,
1895
+ * the items it contains, and a minimal typed passthrough of the published spec.
1896
+ *
1897
+ * `spec` is carried so the install dialog can read an mcp-server item's public
1898
+ * `mcp.env` marker strings (`provides[].mcp.env`) and collect its required `!ENV`
1899
+ * vars before install. Only that path is typed; everything else on the spec is
1900
+ * `.passthrough()`-preserved but unmodelled (zod would otherwise strip the whole
1901
+ * `spec` as an unknown key). Nullable + optional: a listing with nothing published
1902
+ * carries no spec.
1829
1903
  */
1830
1904
  export const marketplaceLatestVersion = marketplaceVersion.extend({
1831
1905
  items: z.array(marketplaceItem),
1906
+ spec: z
1907
+ .object({
1908
+ provides: z.array(
1909
+ z
1910
+ .object({
1911
+ kind: z.string(),
1912
+ name: z.string(),
1913
+ mcp: z
1914
+ .object({ env: z.record(z.string(), z.string()).nullish() })
1915
+ .passthrough()
1916
+ .nullish(),
1917
+ })
1918
+ .passthrough(),
1919
+ ),
1920
+ })
1921
+ .passthrough()
1922
+ .nullish(),
1832
1923
  });
1833
1924
  export type MarketplaceLatestVersion = z.infer<typeof marketplaceLatestVersion>;
1834
1925
 
@@ -1862,10 +1953,15 @@ export const marketplacePluginDetail = z.object({
1862
1953
  license: z.string().nullable(),
1863
1954
  homepage_url: z.string().nullable(),
1864
1955
  repository_url: z.string().nullable(),
1956
+ // The marketplace-stored docs-site URL (R13: the store is the source, the UI a
1957
+ // link). Nullable + optional: absent on a listing with no published docs.
1958
+ docs_url: z.string().nullish(),
1865
1959
  categories: z.array(z.string()),
1866
1960
  tags: z.array(z.string()),
1867
1961
  trust_tier: z.string(),
1868
1962
  pricing: z.string(),
1963
+ // A display-only premium flag (D5: a badge, never a payment surface).
1964
+ premium: z.boolean().nullish(),
1869
1965
  downloads: z.number(),
1870
1966
  latest: marketplaceLatestVersion.nullable(),
1871
1967
  versions: z.array(marketplaceVersion),
@@ -1909,6 +2005,10 @@ export const marketplaceInstalledPlugin = z
1909
2005
  incompatible_newer: z.string().nullable(),
1910
2006
  missing_upstream: z.boolean(),
1911
2007
  compat: marketplaceInstalledCompat,
2008
+ // The `{kind, name}` of every item this plugin's stored spec provides (local
2009
+ // truth). The McpTab joins the mcp-server item names against the manifest's
2010
+ // mcp-entry titles to render an installer-written entry read-only.
2011
+ items: z.array(marketplaceItem.pick({ kind: true, name: true })),
1912
2012
  })
1913
2013
  .strict();
1914
2014
  export type MarketplaceInstalledPlugin = z.infer<typeof marketplaceInstalledPlugin>;