@tai42/api-client 1.4.0 → 1.6.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
@@ -803,7 +803,7 @@ export const connectionsList = z.object({
803
803
  total: z.number(),
804
804
  // Count of connections whose `auth_health_state` is not healthy across the whole
805
805
  // set (independent of any filter/limit) — the attention-badge count. Optional:
806
- // no UI consumes it this mission, and an older worker mid-rollout omits it.
806
+ // no UI consumes it, and an older worker mid-rollout omits it.
807
807
  unhealthy: z.number().optional(),
808
808
  });
809
809
 
@@ -1007,6 +1007,14 @@ export type ConversationDeliveryStatus = z.infer<typeof conversationDeliveryStat
1007
1007
  export const conversationAnswerStatus = z.enum(['answered', 'error', 'silent']);
1008
1008
  export type ConversationAnswerStatus = z.infer<typeof conversationAnswerStatus>;
1009
1009
 
1010
+ /**
1011
+ * Who authored a record's outgoing side. `client` is the ordinary turn the flow
1012
+ * answered; `operator` is a message a human sent into the thread, whose text
1013
+ * rides `answer` (its `inbound_text` is empty).
1014
+ */
1015
+ export const conversationRecordOrigin = z.enum(['client', 'operator']);
1016
+ export type ConversationRecordOrigin = z.infer<typeof conversationRecordOrigin>;
1017
+
1010
1018
  /** A stored routing row as a read door returns it, its `callback_secret` withheld. */
1011
1019
  export const conversationRoute = z.object({
1012
1020
  route_name: z.string(),
@@ -1075,6 +1083,7 @@ export const conversationMessage = z.object({
1075
1083
  inbound_text: z.string(),
1076
1084
  answer_status: conversationAnswerStatus.nullable(),
1077
1085
  answer: z.string().nullable(),
1086
+ origin: conversationRecordOrigin,
1078
1087
  delivery_status: conversationDeliveryStatus,
1079
1088
  created_at: z.number(),
1080
1089
  updated_at: z.number(),
@@ -1104,6 +1113,27 @@ export const conversationTranscriptPage = z.object({
1104
1113
  });
1105
1114
  export type ConversationTranscriptPage = z.infer<typeof conversationTranscriptPage>;
1106
1115
 
1116
+ /**
1117
+ * Who answers a thread's incoming messages: `agent` lets the flow reply on its
1118
+ * own; `manual` holds the flow back so a human answers. `source` says whether the
1119
+ * setting is the thread's own (`thread`) or inherited from its route (`route`).
1120
+ */
1121
+ export const conversationThreadMode = z.enum(['agent', 'manual']);
1122
+ export type ConversationThreadMode = z.infer<typeof conversationThreadMode>;
1123
+
1124
+ export const conversationThreadModeState = z.object({
1125
+ mode: conversationThreadMode,
1126
+ source: z.enum(['thread', 'route']),
1127
+ });
1128
+ export type ConversationThreadModeState = z.infer<typeof conversationThreadModeState>;
1129
+
1130
+ /** The receipt a thread-message write returns: the stored id and its thread. */
1131
+ export const conversationThreadMessageSent = z.object({
1132
+ message_id: z.string(),
1133
+ thread_id: z.string(),
1134
+ });
1135
+ export type ConversationThreadMessageSent = z.infer<typeof conversationThreadMessageSent>;
1136
+
1107
1137
  // -- channel-web entry gate --------------------------------------------------
1108
1138
  // The web channel's entry gate: a web route can be gated so its chat page is
1109
1139
  // served only to a navigation carrying a live entry code. These four doors are
@@ -1824,26 +1854,52 @@ export type RunTrace = z.infer<typeof runTrace>;
1824
1854
  // -- marketplace -------------------------------------------------------------
1825
1855
 
1826
1856
  /**
1827
- * One contained item of a marketplace plugin (a searchable row): its kind
1828
- * (tool / agent / extension / …), name, description, and free-form tags.
1857
+ * One contained item of a marketplace plugin's published version: its kind
1858
+ * (tool / agent / extension / …), name, description, free-form tags, and the
1859
+ * logical group it belongs to (`null` when ungrouped).
1829
1860
  */
1830
1861
  export const marketplaceItem = z.object({
1831
1862
  kind: z.string(),
1832
1863
  name: z.string(),
1833
1864
  description: z.string(),
1834
1865
  tags: z.array(z.string()),
1866
+ group: z.string().nullable(),
1835
1867
  });
1836
1868
  export type MarketplaceItem = z.infer<typeof marketplaceItem>;
1837
1869
 
1838
1870
  /**
1839
- * One item-level search row (`GET /api/marketplace/search`): the contained item
1840
- * plus the listing it belongs to. `ref` is the "namespace/name" install target
1841
- * (install targets the LISTING), so every row carries enough to group under and
1842
- * link to its plugin. `latest_version` is nullable defensively; the search
1843
- * relation only emits listings with a published version.
1871
+ * One kind summary of a search row: an item kind, how many UNGROUPED items of
1872
+ * that kind the listing's latest published version carries, and their names.
1873
+ * The registry orders the array count DESC then kind ASC, and each entry's
1874
+ * `names` ASC; the UI renders in that order.
1875
+ */
1876
+ export const marketplaceSearchKind = z.object({
1877
+ kind: z.string(),
1878
+ count: z.number(),
1879
+ names: z.array(z.string()),
1880
+ });
1881
+ export type MarketplaceSearchKind = z.infer<typeof marketplaceSearchKind>;
1882
+
1883
+ /**
1884
+ * One logical group of a search row: the group name and how many items the
1885
+ * listing's latest published version places in it. The registry orders the
1886
+ * array count DESC then name ASC; the UI renders in that order.
1887
+ */
1888
+ export const marketplaceSearchGroup = z.object({
1889
+ name: z.string(),
1890
+ count: z.number(),
1891
+ });
1892
+ export type MarketplaceSearchGroup = z.infer<typeof marketplaceSearchGroup>;
1893
+
1894
+ /**
1895
+ * One listing-level search row (`GET /api/marketplace/search`). `ref` is the
1896
+ * "namespace/name" install target, so every row carries enough to link to its
1897
+ * plugin. `latest_version` is nullable defensively; the search relation only
1898
+ * emits listings with a published version. `kinds` summarizes that latest
1899
+ * version's UNGROUPED items; `groups` summarizes its logical groups (`[]` when
1900
+ * none). Both keys are always present.
1844
1901
  */
1845
1902
  export const marketplaceSearchRow = z.object({
1846
- item: marketplaceItem,
1847
1903
  ref: z.string(),
1848
1904
  namespace: z.string(),
1849
1905
  name: z.string(),
@@ -1855,21 +1911,23 @@ export const marketplaceSearchRow = z.object({
1855
1911
  tags: z.array(z.string()),
1856
1912
  trust_tier: z.string(),
1857
1913
  pricing: z.string(),
1858
- // A display-only premium flag (D5: a badge, never a payment surface). Nullable
1914
+ // A display-only premium flag: a badge, never a payment surface. Nullable
1859
1915
  // + optional: an older registry omits it, and it is absent on non-premium rows.
1860
1916
  premium: z.boolean().nullish(),
1861
1917
  latest_version: z.string().nullable(),
1862
1918
  downloads: z.number(),
1863
1919
  updated_at: z.string(),
1920
+ kinds: z.array(marketplaceSearchKind),
1921
+ groups: z.array(marketplaceSearchGroup),
1864
1922
  });
1865
1923
  export type MarketplaceSearchRow = z.infer<typeof marketplaceSearchRow>;
1866
1924
 
1867
1925
  /**
1868
- * One page of search rows. The wire carries no next-page field — has-next is
1926
+ * One page of listing rows. The wire carries no next-page field — has-next is
1869
1927
  * COMPUTED: `page * page_size < total`.
1870
1928
  */
1871
1929
  export const marketplaceSearchPage = z.object({
1872
- items: z.array(marketplaceSearchRow),
1930
+ listings: z.array(marketplaceSearchRow),
1873
1931
  total: z.number(),
1874
1932
  page: z.number(),
1875
1933
  page_size: z.number(),
@@ -1953,14 +2011,14 @@ export const marketplacePluginDetail = z.object({
1953
2011
  license: z.string().nullable(),
1954
2012
  homepage_url: z.string().nullable(),
1955
2013
  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.
2014
+ // The marketplace-stored docs-site URL: the store is the source, the UI a
2015
+ // link. Nullable + optional: absent on a listing with no published docs.
1958
2016
  docs_url: z.string().nullish(),
1959
2017
  categories: z.array(z.string()),
1960
2018
  tags: z.array(z.string()),
1961
2019
  trust_tier: z.string(),
1962
2020
  pricing: z.string(),
1963
- // A display-only premium flag (D5: a badge, never a payment surface).
2021
+ // A display-only premium flag: a badge, never a payment surface.
1964
2022
  premium: z.boolean().nullish(),
1965
2023
  downloads: z.number(),
1966
2024
  latest: marketplaceLatestVersion.nullable(),
@@ -2005,9 +2063,9 @@ export const marketplaceInstalledPlugin = z
2005
2063
  incompatible_newer: z.string().nullable(),
2006
2064
  missing_upstream: z.boolean(),
2007
2065
  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.
2066
+ // The `{kind, name}` of every item this plugin's stored spec provides
2067
+ // (local truth). The McpTab joins the mcp-server item names against the
2068
+ // manifest's mcp-entry titles to render an installer-written entry read-only.
2011
2069
  items: z.array(marketplaceItem.pick({ kind: true, name: true })),
2012
2070
  })
2013
2071
  .strict();