@smarter.sh/api 0.0.0-stage → 1.0.2-alpha.1

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 (251) hide show
  1. package/LICENSE.txt +671 -0
  2. package/README.md +193 -2
  3. package/dist/client.d.ts +146 -0
  4. package/dist/client.d.ts.map +1 -0
  5. package/dist/client.js +178 -0
  6. package/dist/client.js.map +1 -0
  7. package/dist/core/config.d.ts +148 -0
  8. package/dist/core/config.d.ts.map +1 -0
  9. package/dist/core/config.js +212 -0
  10. package/dist/core/config.js.map +1 -0
  11. package/dist/core/errors.d.ts +189 -0
  12. package/dist/core/errors.d.ts.map +1 -0
  13. package/dist/core/errors.js +187 -0
  14. package/dist/core/errors.js.map +1 -0
  15. package/dist/core/http.d.ts +207 -0
  16. package/dist/core/http.d.ts.map +1 -0
  17. package/dist/core/http.js +456 -0
  18. package/dist/core/http.js.map +1 -0
  19. package/dist/core/log.d.ts +62 -0
  20. package/dist/core/log.d.ts.map +1 -0
  21. package/dist/core/log.js +68 -0
  22. package/dist/core/log.js.map +1 -0
  23. package/dist/core/sse.d.ts +38 -0
  24. package/dist/core/sse.d.ts.map +1 -0
  25. package/dist/core/sse.js +79 -0
  26. package/dist/core/sse.js.map +1 -0
  27. package/dist/core/typing.d.ts +21 -0
  28. package/dist/core/typing.d.ts.map +1 -0
  29. package/dist/core/typing.js +13 -0
  30. package/dist/core/typing.js.map +1 -0
  31. package/dist/index.d.ts +51 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +51 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/models/account.d.ts +112 -0
  36. package/dist/models/account.d.ts.map +1 -0
  37. package/dist/models/account.js +55 -0
  38. package/dist/models/account.js.map +1 -0
  39. package/dist/models/base.d.ts +99 -0
  40. package/dist/models/base.d.ts.map +1 -0
  41. package/dist/models/base.js +111 -0
  42. package/dist/models/base.js.map +1 -0
  43. package/dist/models/chat.d.ts +2243 -0
  44. package/dist/models/chat.d.ts.map +1 -0
  45. package/dist/models/chat.js +451 -0
  46. package/dist/models/chat.js.map +1 -0
  47. package/dist/models/guardrail.d.ts +109 -0
  48. package/dist/models/guardrail.d.ts.map +1 -0
  49. package/dist/models/guardrail.js +68 -0
  50. package/dist/models/guardrail.js.map +1 -0
  51. package/dist/models/journal.d.ts +159 -0
  52. package/dist/models/journal.d.ts.map +1 -0
  53. package/dist/models/journal.js +115 -0
  54. package/dist/models/journal.js.map +1 -0
  55. package/dist/models/llmclient.d.ts +183 -0
  56. package/dist/models/llmclient.d.ts.map +1 -0
  57. package/dist/models/llmclient.js +105 -0
  58. package/dist/models/llmclient.js.map +1 -0
  59. package/dist/models/llmhost.d.ts +121 -0
  60. package/dist/models/llmhost.d.ts.map +1 -0
  61. package/dist/models/llmhost.js +79 -0
  62. package/dist/models/llmhost.js.map +1 -0
  63. package/dist/models/manifest.d.ts +211 -0
  64. package/dist/models/manifest.d.ts.map +1 -0
  65. package/dist/models/manifest.js +290 -0
  66. package/dist/models/manifest.js.map +1 -0
  67. package/dist/models/mcpclient.d.ts +99 -0
  68. package/dist/models/mcpclient.d.ts.map +1 -0
  69. package/dist/models/mcpclient.js +65 -0
  70. package/dist/models/mcpclient.js.map +1 -0
  71. package/dist/models/misc.d.ts +232 -0
  72. package/dist/models/misc.d.ts.map +1 -0
  73. package/dist/models/misc.js +110 -0
  74. package/dist/models/misc.js.map +1 -0
  75. package/dist/models/platform.d.ts +88 -0
  76. package/dist/models/platform.d.ts.map +1 -0
  77. package/dist/models/platform.js +35 -0
  78. package/dist/models/platform.js.map +1 -0
  79. package/dist/models/plugin.d.ts +36 -0
  80. package/dist/models/plugin.d.ts.map +1 -0
  81. package/dist/models/plugin.js +16 -0
  82. package/dist/models/plugin.js.map +1 -0
  83. package/dist/models/react.d.ts +104 -0
  84. package/dist/models/react.d.ts.map +1 -0
  85. package/dist/models/react.js +136 -0
  86. package/dist/models/react.js.map +1 -0
  87. package/dist/models/sam/account.d.ts +155 -0
  88. package/dist/models/sam/account.d.ts.map +1 -0
  89. package/dist/models/sam/account.js +7 -0
  90. package/dist/models/sam/account.js.map +1 -0
  91. package/dist/models/sam/apiconnection.d.ts +147 -0
  92. package/dist/models/sam/apiconnection.d.ts.map +1 -0
  93. package/dist/models/sam/apiconnection.js +7 -0
  94. package/dist/models/sam/apiconnection.js.map +1 -0
  95. package/dist/models/sam/apiplugin.d.ts +278 -0
  96. package/dist/models/sam/apiplugin.d.ts.map +1 -0
  97. package/dist/models/sam/apiplugin.js +7 -0
  98. package/dist/models/sam/apiplugin.js.map +1 -0
  99. package/dist/models/sam/budget.d.ts +219 -0
  100. package/dist/models/sam/budget.d.ts.map +1 -0
  101. package/dist/models/sam/budget.js +7 -0
  102. package/dist/models/sam/budget.js.map +1 -0
  103. package/dist/models/sam/customdomain.d.ts +139 -0
  104. package/dist/models/sam/customdomain.d.ts.map +1 -0
  105. package/dist/models/sam/customdomain.js +7 -0
  106. package/dist/models/sam/customdomain.js.map +1 -0
  107. package/dist/models/sam/guardrail.d.ts +222 -0
  108. package/dist/models/sam/guardrail.d.ts.map +1 -0
  109. package/dist/models/sam/guardrail.js +7 -0
  110. package/dist/models/sam/guardrail.js.map +1 -0
  111. package/dist/models/sam/imagesearchplugin.d.ts +235 -0
  112. package/dist/models/sam/imagesearchplugin.d.ts.map +1 -0
  113. package/dist/models/sam/imagesearchplugin.js +7 -0
  114. package/dist/models/sam/imagesearchplugin.js.map +1 -0
  115. package/dist/models/sam/index.d.ts +104 -0
  116. package/dist/models/sam/index.d.ts.map +1 -0
  117. package/dist/models/sam/index.js +50 -0
  118. package/dist/models/sam/index.js.map +1 -0
  119. package/dist/models/sam/llmclient.d.ts +490 -0
  120. package/dist/models/sam/llmclient.d.ts.map +1 -0
  121. package/dist/models/sam/llmclient.js +7 -0
  122. package/dist/models/sam/llmclient.js.map +1 -0
  123. package/dist/models/sam/llmhost.d.ts +429 -0
  124. package/dist/models/sam/llmhost.d.ts.map +1 -0
  125. package/dist/models/sam/llmhost.js +7 -0
  126. package/dist/models/sam/llmhost.js.map +1 -0
  127. package/dist/models/sam/llmhostcompute.d.ts +221 -0
  128. package/dist/models/sam/llmhostcompute.d.ts.map +1 -0
  129. package/dist/models/sam/llmhostcompute.js +7 -0
  130. package/dist/models/sam/llmhostcompute.js.map +1 -0
  131. package/dist/models/sam/mcpclient.d.ts +195 -0
  132. package/dist/models/sam/mcpclient.d.ts.map +1 -0
  133. package/dist/models/sam/mcpclient.js +7 -0
  134. package/dist/models/sam/mcpclient.js.map +1 -0
  135. package/dist/models/sam/orchestrator.d.ts +163 -0
  136. package/dist/models/sam/orchestrator.d.ts.map +1 -0
  137. package/dist/models/sam/orchestrator.js +7 -0
  138. package/dist/models/sam/orchestrator.js.map +1 -0
  139. package/dist/models/sam/plugin.d.ts +163 -0
  140. package/dist/models/sam/plugin.d.ts.map +1 -0
  141. package/dist/models/sam/plugin.js +7 -0
  142. package/dist/models/sam/plugin.js.map +1 -0
  143. package/dist/models/sam/prompt.d.ts +116 -0
  144. package/dist/models/sam/prompt.d.ts.map +1 -0
  145. package/dist/models/sam/prompt.js +7 -0
  146. package/dist/models/sam/prompt.js.map +1 -0
  147. package/dist/models/sam/provider.d.ts +195 -0
  148. package/dist/models/sam/provider.d.ts.map +1 -0
  149. package/dist/models/sam/provider.js +7 -0
  150. package/dist/models/sam/provider.js.map +1 -0
  151. package/dist/models/sam/proxy.d.ts +163 -0
  152. package/dist/models/sam/proxy.d.ts.map +1 -0
  153. package/dist/models/sam/proxy.js +7 -0
  154. package/dist/models/sam/proxy.js.map +1 -0
  155. package/dist/models/sam/schemas.d.ts +8 -0
  156. package/dist/models/sam/schemas.d.ts.map +1 -0
  157. package/dist/models/sam/schemas.js +6059 -0
  158. package/dist/models/sam/schemas.js.map +1 -0
  159. package/dist/models/sam/secret.d.ts +123 -0
  160. package/dist/models/sam/secret.d.ts.map +1 -0
  161. package/dist/models/sam/secret.js +7 -0
  162. package/dist/models/sam/secret.js.map +1 -0
  163. package/dist/models/sam/skillplugin.d.ts +181 -0
  164. package/dist/models/sam/skillplugin.d.ts.map +1 -0
  165. package/dist/models/sam/skillplugin.js +7 -0
  166. package/dist/models/sam/skillplugin.js.map +1 -0
  167. package/dist/models/sam/smarterauthtoken.d.ts +115 -0
  168. package/dist/models/sam/smarterauthtoken.d.ts.map +1 -0
  169. package/dist/models/sam/smarterauthtoken.js +7 -0
  170. package/dist/models/sam/smarterauthtoken.js.map +1 -0
  171. package/dist/models/sam/sqlconnection.d.ts +187 -0
  172. package/dist/models/sam/sqlconnection.d.ts.map +1 -0
  173. package/dist/models/sam/sqlconnection.js +7 -0
  174. package/dist/models/sam/sqlconnection.js.map +1 -0
  175. package/dist/models/sam/sqlplugin.d.ts +232 -0
  176. package/dist/models/sam/sqlplugin.d.ts.map +1 -0
  177. package/dist/models/sam/sqlplugin.js +7 -0
  178. package/dist/models/sam/sqlplugin.js.map +1 -0
  179. package/dist/models/sam/user.d.ts +135 -0
  180. package/dist/models/sam/user.d.ts.map +1 -0
  181. package/dist/models/sam/user.js +7 -0
  182. package/dist/models/sam/user.js.map +1 -0
  183. package/dist/models/sam/vectorsearch.d.ts +150 -0
  184. package/dist/models/sam/vectorsearch.d.ts.map +1 -0
  185. package/dist/models/sam/vectorsearch.js +7 -0
  186. package/dist/models/sam/vectorsearch.js.map +1 -0
  187. package/dist/models/sam/vectorstore.d.ts +291 -0
  188. package/dist/models/sam/vectorstore.d.ts.map +1 -0
  189. package/dist/models/sam/vectorstore.js +7 -0
  190. package/dist/models/sam/vectorstore.js.map +1 -0
  191. package/dist/models/sam/websearchplugin.d.ts +229 -0
  192. package/dist/models/sam/websearchplugin.d.ts.map +1 -0
  193. package/dist/models/sam/websearchplugin.js +7 -0
  194. package/dist/models/sam/websearchplugin.js.map +1 -0
  195. package/dist/models/vectorstore.d.ts +165 -0
  196. package/dist/models/vectorstore.d.ts.map +1 -0
  197. package/dist/models/vectorstore.js +90 -0
  198. package/dist/models/vectorstore.js.map +1 -0
  199. package/dist/resources/accounts.d.ts +107 -0
  200. package/dist/resources/accounts.d.ts.map +1 -0
  201. package/dist/resources/accounts.js +84 -0
  202. package/dist/resources/accounts.js.map +1 -0
  203. package/dist/resources/base.d.ts +127 -0
  204. package/dist/resources/base.d.ts.map +1 -0
  205. package/dist/resources/base.js +139 -0
  206. package/dist/resources/base.js.map +1 -0
  207. package/dist/resources/catalog.d.ts +209 -0
  208. package/dist/resources/catalog.d.ts.map +1 -0
  209. package/dist/resources/catalog.js +124 -0
  210. package/dist/resources/catalog.js.map +1 -0
  211. package/dist/resources/guardrails.d.ts +82 -0
  212. package/dist/resources/guardrails.d.ts.map +1 -0
  213. package/dist/resources/guardrails.js +46 -0
  214. package/dist/resources/guardrails.js.map +1 -0
  215. package/dist/resources/history.d.ts +97 -0
  216. package/dist/resources/history.d.ts.map +1 -0
  217. package/dist/resources/history.js +109 -0
  218. package/dist/resources/history.js.map +1 -0
  219. package/dist/resources/llmclients.d.ts +348 -0
  220. package/dist/resources/llmclients.d.ts.map +1 -0
  221. package/dist/resources/llmclients.js +367 -0
  222. package/dist/resources/llmclients.js.map +1 -0
  223. package/dist/resources/llmhosts.d.ts +146 -0
  224. package/dist/resources/llmhosts.d.ts.map +1 -0
  225. package/dist/resources/llmhosts.js +128 -0
  226. package/dist/resources/llmhosts.js.map +1 -0
  227. package/dist/resources/manifests.d.ts +153 -0
  228. package/dist/resources/manifests.d.ts.map +1 -0
  229. package/dist/resources/manifests.js +203 -0
  230. package/dist/resources/manifests.js.map +1 -0
  231. package/dist/resources/mcpclients.d.ts +90 -0
  232. package/dist/resources/mcpclients.d.ts.map +1 -0
  233. package/dist/resources/mcpclients.js +57 -0
  234. package/dist/resources/mcpclients.js.map +1 -0
  235. package/dist/resources/providers.d.ts +33 -0
  236. package/dist/resources/providers.d.ts.map +1 -0
  237. package/dist/resources/providers.js +39 -0
  238. package/dist/resources/providers.js.map +1 -0
  239. package/dist/resources/proxies.d.ts +61 -0
  240. package/dist/resources/proxies.d.ts.map +1 -0
  241. package/dist/resources/proxies.js +57 -0
  242. package/dist/resources/proxies.js.map +1 -0
  243. package/dist/resources/vectorstores.d.ts +194 -0
  244. package/dist/resources/vectorstores.d.ts.map +1 -0
  245. package/dist/resources/vectorstores.js +200 -0
  246. package/dist/resources/vectorstores.js.map +1 -0
  247. package/dist/version.d.ts +3 -0
  248. package/dist/version.d.ts.map +1 -0
  249. package/dist/version.js +5 -0
  250. package/dist/version.js.map +1 -0
  251. package/package.json +81 -4
@@ -0,0 +1,139 @@
1
+ /**
2
+ * The base classes of the SDK's api resources.
3
+ *
4
+ * Each resource family (LLMClients, Guardrails, ...) is a class whose methods send requests through
5
+ * the client's {@link SmarterHttpClient}. Writes go through the manifest api, exactly as the
6
+ * `smarter` cli sends them, so that the platform validates them and applies its business rules. The
7
+ * REST endpoints are used to read resources, and for actions that the manifest api has no verb for,
8
+ * such as evaluating a Guardrail or calling an MCP tool (ADR-003).
9
+ */
10
+ import { z } from "zod";
11
+ import { ResourceNotFoundError, SmarterValueError } from "../core/errors.js";
12
+ import { toManifest } from "../models/manifest.js";
13
+ /**
14
+ * A resource id as a url path segment.
15
+ *
16
+ * @param value - The resource's integer id, or its hashed id.
17
+ * @returns The id, as text.
18
+ * @throws {@link SmarterValueError} If the id is empty, or contains a slash.
19
+ */
20
+ export function resourceId(value) {
21
+ const text = String(value).trim();
22
+ if (!text || text.includes("/"))
23
+ throw new SmarterValueError(`Invalid resource id: ${JSON.stringify(value)}`);
24
+ return encodeURIComponent(text);
25
+ }
26
+ /** A group of api operations. */
27
+ export class SmarterAPIResource {
28
+ client;
29
+ /**
30
+ * @param client - The client whose requests the operations send.
31
+ */
32
+ constructor(client) {
33
+ this.client = client;
34
+ }
35
+ /** The client's http transport. */
36
+ get http() {
37
+ return this.client.http;
38
+ }
39
+ }
40
+ /**
41
+ * The operations of one resource kind, e.g. Guardrail.
42
+ *
43
+ * Subclasses set {@link SmarterKindResource.kind}, the manifest kind, {@link SmarterKindResource.path},
44
+ * the REST list endpoint, and {@link SmarterKindResource.model}, the schema of a resource. They get:
45
+ *
46
+ * - `list()`, `retrieve()` and `find()`, from the REST api, and
47
+ * - `apply()`, `describe()`, `delete()`, `exampleManifest()` and `jsonSchema()`, from the manifest api.
48
+ */
49
+ export class SmarterKindResource extends SmarterAPIResource {
50
+ /**
51
+ * Every resource of this kind that the api key's user may read.
52
+ *
53
+ * @param options - Per-request options.
54
+ * @returns The resources.
55
+ */
56
+ async list(options) {
57
+ return this.http.request("GET", this.path, z.array(this.model), options);
58
+ }
59
+ /**
60
+ * One resource, by its id or hashed id.
61
+ *
62
+ * @param id - The resource's integer id, or its hashed id.
63
+ * @param options - Per-request options.
64
+ * @returns The resource.
65
+ * @throws {@link NotFoundError} If it does not exist, or the user may not read it.
66
+ */
67
+ async retrieve(id, options) {
68
+ return this.http.request("GET", `${this.path}${resourceId(id)}/`, this.model, options);
69
+ }
70
+ /**
71
+ * One resource, by its name.
72
+ *
73
+ * @param name - The resource's name.
74
+ * @param options - Per-request options.
75
+ * @returns The first resource of that name that the user may read.
76
+ * @throws {@link ResourceNotFoundError} If there is none.
77
+ */
78
+ async find(name, options) {
79
+ for (const item of await this.list(options)) {
80
+ if (item.name === name)
81
+ return item;
82
+ }
83
+ throw new ResourceNotFoundError(`${this.kind} ${JSON.stringify(name)} not found.`);
84
+ }
85
+ /**
86
+ * Create or update a resource of this kind from its manifest.
87
+ *
88
+ * @param manifest - The manifest.
89
+ * @param options - Per-request options.
90
+ * @returns The platform's response, whose `message` says what was applied.
91
+ * @throws {@link SmarterValueError} If the manifest is of another kind.
92
+ */
93
+ async apply(manifest, options) {
94
+ const parsed = toManifest(manifest);
95
+ if (parsed.kind !== this.kind) {
96
+ throw new SmarterValueError(`Expected a ${this.kind} manifest, not ${parsed.kind}.`);
97
+ }
98
+ return this.client.manifests.apply(parsed, options);
99
+ }
100
+ /**
101
+ * A resource's manifest, with its read-only `status`.
102
+ *
103
+ * @param name - The resource's name.
104
+ * @param options - Per-request options.
105
+ * @returns The manifest.
106
+ */
107
+ async describe(name, options) {
108
+ return this.client.manifests.describe(this.kind, name, options);
109
+ }
110
+ /**
111
+ * Permanently delete a resource.
112
+ *
113
+ * @param name - The resource's name.
114
+ * @param options - Per-request options.
115
+ * @returns The platform's response.
116
+ */
117
+ async delete(name, options) {
118
+ return this.client.manifests.delete(this.kind, name, options);
119
+ }
120
+ /**
121
+ * A valid example manifest of this kind, to start from.
122
+ *
123
+ * @param options - Per-request options.
124
+ * @returns The manifest.
125
+ */
126
+ async exampleManifest(options) {
127
+ return this.client.manifests.exampleManifest(this.kind, options);
128
+ }
129
+ /**
130
+ * The JSON Schema of this kind's manifest.
131
+ *
132
+ * @param options - Per-request options.
133
+ * @returns The schema.
134
+ */
135
+ async jsonSchema(options) {
136
+ return this.client.manifests.jsonSchema(this.kind, options);
137
+ }
138
+ }
139
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/resources/base.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAI7E,OAAO,EAAE,UAAU,EAAqC,MAAM,uBAAuB,CAAC;AAWtF;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,KAAgB;IACzC,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;IAClC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,MAAM,IAAI,iBAAiB,CAAC,wBAAwB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC9G,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC;AAED,iCAAiC;AACjC,MAAM,OAAO,kBAAkB;I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MAAM,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;YAC9B,MAAM,IAAI,iBAAiB,CAAC,cAAc,IAAI,CAAC,IAAI,kBAAkB,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC;QACvF,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,QAAQ,CAAC,IAAY,EAAE,OAAwB;QACnD,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,CAAC,IAAY,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,eAAe,CAAC,OAAwB;QAC5C,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,UAAU,CAAC,OAAwB;QACvC,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;CACF"}
@@ -0,0 +1,209 @@
1
+ /** Secrets, plugins, orchestrators and vectorsearches: the kinds whose REST api only lists and reads them. */
2
+ import type { RequestOptions } from "../core/http.ts";
3
+ import type { SmarterId } from "../core/typing.ts";
4
+ import type { SmarterJournalMessage } from "../models/journal.ts";
5
+ import { Manifest, type ManifestInput } from "../models/manifest.ts";
6
+ import { Orchestrator, Secret, Vectorsearch } from "../models/misc.ts";
7
+ import { Plugin } from "../models/plugin.ts";
8
+ import { SmarterKindResource } from "./base.ts";
9
+ /** The manifest kinds of plugins. */
10
+ export declare const PLUGIN_KINDS: readonly string[];
11
+ /**
12
+ * Secrets: `/api/v1/secrets/`, and the manifest api's `Secret` kind.
13
+ *
14
+ * The api never returns a secret's value. Create and rotate secrets with {@link Secrets.apply}.
15
+ */
16
+ export declare class Secrets extends SmarterKindResource<typeof Secret> {
17
+ readonly kind = "Secret";
18
+ readonly path = "secrets/";
19
+ readonly model: import("zod").ZodObject<{
20
+ id: import("zod").ZodNumber;
21
+ hashedId: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
22
+ name: import("zod").ZodString;
23
+ description: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
24
+ version: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
25
+ tags: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
26
+ annotations: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodPreprocess<import("zod").ZodNullable<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>, unknown>>>;
27
+ createdAt: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
28
+ updatedAt: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
29
+ userProfile: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
30
+ user: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
31
+ username: import("zod").ZodString;
32
+ email: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
33
+ }, import("zod/v4/core").$loose>>>;
34
+ account: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
35
+ accountNumber: import("zod").ZodString;
36
+ }, import("zod/v4/core").$loose>>>;
37
+ }, import("zod/v4/core").$loose>>>;
38
+ canDelete: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
39
+ manifestUrl: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
40
+ detailUrl: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
41
+ ready: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
42
+ expiresAt: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
43
+ lastAccessed: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
44
+ }, import("zod/v4/core").$loose>;
45
+ }
46
+ /**
47
+ * Plugins: `/api/v1/plugins/`, and the manifest api's plugin kinds.
48
+ *
49
+ * A plugin's manifest kind is its class, e.g. `ApiPlugin` or `SqlPlugin`. {@link Plugins.apply}
50
+ * accepts any of them, and {@link Plugins.describe} and {@link Plugins.delete} look the kind up by name.
51
+ */
52
+ export declare class Plugins extends SmarterKindResource<typeof Plugin> {
53
+ readonly kind = "Plugin";
54
+ readonly path = "plugins/";
55
+ readonly model: import("zod").ZodObject<{
56
+ id: import("zod").ZodNumber;
57
+ hashedId: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
58
+ name: import("zod").ZodString;
59
+ description: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
60
+ version: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
61
+ tags: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
62
+ annotations: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodPreprocess<import("zod").ZodNullable<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>, unknown>>>;
63
+ createdAt: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
64
+ updatedAt: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
65
+ userProfile: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
66
+ user: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
67
+ username: import("zod").ZodString;
68
+ email: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
69
+ }, import("zod/v4/core").$loose>>>;
70
+ account: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
71
+ accountNumber: import("zod").ZodString;
72
+ }, import("zod/v4/core").$loose>>>;
73
+ }, import("zod/v4/core").$loose>>>;
74
+ canDelete: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
75
+ manifestUrl: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
76
+ detailUrl: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
77
+ ready: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
78
+ pluginClass: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
79
+ kind: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
80
+ }, import("zod/v4/core").$loose>;
81
+ /**
82
+ * Create or update a plugin from its manifest, of any plugin kind.
83
+ *
84
+ * @param manifest - The manifest.
85
+ * @param options - Per-request options.
86
+ * @returns The platform's response.
87
+ * @throws {@link SmarterValueError} If the manifest is not a plugin's.
88
+ */
89
+ apply(manifest: ManifestInput, options?: RequestOptions): Promise<SmarterJournalMessage>;
90
+ /**
91
+ * A plugin's manifest kind.
92
+ *
93
+ * @param name - The plugin's name.
94
+ * @param options - Per-request options.
95
+ * @returns e.g. `SqlPlugin`.
96
+ */
97
+ kindOf(name: string, options?: RequestOptions): Promise<string>;
98
+ /**
99
+ * A plugin's manifest, with its read-only `status`.
100
+ *
101
+ * @param name - The plugin's name.
102
+ * @param options - Per-request options.
103
+ * @returns The manifest.
104
+ */
105
+ describe(name: string, options?: RequestOptions): Promise<Manifest>;
106
+ /**
107
+ * Permanently delete a plugin.
108
+ *
109
+ * @param name - The plugin's name.
110
+ * @param options - Per-request options.
111
+ * @returns The platform's response.
112
+ */
113
+ delete(name: string, options?: RequestOptions): Promise<SmarterJournalMessage>;
114
+ /**
115
+ * One plugin, by its id, from the list.
116
+ *
117
+ * The platform's `plugins/<id>/` returns a plugin's manifest, not the plugin, so this reads the
118
+ * list. See {@link Plugins.retrieveManifest} for the manifest.
119
+ *
120
+ * @param id - The plugin's integer id.
121
+ * @param options - Per-request options.
122
+ * @returns The plugin.
123
+ * @throws {@link ResourceNotFoundError} If the user may read no plugin of that id.
124
+ */
125
+ retrieve(id: SmarterId, options?: RequestOptions): Promise<Plugin>;
126
+ /**
127
+ * One plugin's manifest, by the plugin's id: what the Python SDK's `plugins.retrieve()` returns.
128
+ *
129
+ * The platform serves this only when its `ALLOW_API_GET` waffle switch is on. Otherwise it answers
130
+ * 405: use {@link Plugins.find} or {@link Plugins.describe} instead.
131
+ *
132
+ * @param id - The plugin's id.
133
+ * @param options - Per-request options.
134
+ * @returns The plugin's manifest, whose `kind` is the plugin's, e.g. `SqlPlugin`.
135
+ */
136
+ retrieveManifest(id: SmarterId, options?: RequestOptions): Promise<Manifest>;
137
+ }
138
+ /** Orchestrators: `/api/v1/orchestrators/`, and the manifest api's `Orchestrator` kind. */
139
+ export declare class Orchestrators extends SmarterKindResource<typeof Orchestrator> {
140
+ readonly kind = "Orchestrator";
141
+ readonly path = "orchestrators/";
142
+ readonly model: import("zod").ZodObject<{
143
+ id: import("zod").ZodNumber;
144
+ hashedId: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
145
+ name: import("zod").ZodString;
146
+ description: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
147
+ version: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
148
+ tags: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
149
+ annotations: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodPreprocess<import("zod").ZodNullable<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>, unknown>>>;
150
+ createdAt: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
151
+ updatedAt: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
152
+ userProfile: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
153
+ user: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
154
+ username: import("zod").ZodString;
155
+ email: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
156
+ }, import("zod/v4/core").$loose>>>;
157
+ account: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
158
+ accountNumber: import("zod").ZodString;
159
+ }, import("zod/v4/core").$loose>>>;
160
+ }, import("zod/v4/core").$loose>>>;
161
+ canDelete: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
162
+ manifestUrl: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
163
+ detailUrl: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
164
+ ready: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
165
+ strategy: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
166
+ maxIterations: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
167
+ isActive: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
168
+ llmclients: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodNumber>>;
169
+ }, import("zod/v4/core").$loose>;
170
+ }
171
+ /** Vectorsearches: `/api/v1/vectorsearches/`, and the manifest api's `Vectorsearch` kind. */
172
+ export declare class Vectorsearches extends SmarterKindResource<typeof Vectorsearch> {
173
+ readonly kind = "Vectorsearch";
174
+ readonly path = "vectorsearches/";
175
+ readonly model: import("zod").ZodObject<{
176
+ id: import("zod").ZodNumber;
177
+ hashedId: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
178
+ name: import("zod").ZodString;
179
+ description: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
180
+ version: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
181
+ tags: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
182
+ annotations: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodPreprocess<import("zod").ZodNullable<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>, unknown>>>;
183
+ createdAt: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
184
+ updatedAt: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
185
+ userProfile: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
186
+ user: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
187
+ username: import("zod").ZodString;
188
+ email: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
189
+ }, import("zod/v4/core").$loose>>>;
190
+ account: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
191
+ accountNumber: import("zod").ZodString;
192
+ }, import("zod/v4/core").$loose>>>;
193
+ }, import("zod/v4/core").$loose>>>;
194
+ canDelete: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
195
+ manifestUrl: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
196
+ detailUrl: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
197
+ ready: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
198
+ searchType: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
199
+ k: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
200
+ scoreThreshold: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
201
+ fetchK: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
202
+ lambdaMult: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
203
+ metadataFilter: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodType<import("../core/typing.ts").JsonValue, unknown, import("zod/v4/core").$ZodTypeInternals<import("../core/typing.ts").JsonValue, unknown>>>>;
204
+ isEnabled: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
205
+ vectorstore: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
206
+ authSecret: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
207
+ }, import("zod/v4/core").$loose>;
208
+ }
209
+ //# sourceMappingURL=catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/resources/catalog.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAG9G,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAA4B,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC/F,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAc,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAE5D,qCAAqC;AACrC,eAAO,MAAM,YAAY,EAAE,SAAS,MAAM,EAOzC,CAAC;AAEF;;;;GAIG;AACH,qBAAa,OAAQ,SAAQ,mBAAmB,CAAC,OAAO,MAAM,CAAC;IAC7D,QAAQ,CAAC,IAAI,YAAY;IACzB,QAAQ,CAAC,IAAI,cAAc;IAC3B,QAAQ,CAAC,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;qCAAU;CACzB;AAED;;;;;GAKG;AACH,qBAAa,OAAQ,SAAQ,mBAAmB,CAAC,OAAO,MAAM,CAAC;IAC7D,QAAQ,CAAC,IAAI,Y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qCAAgB;CAC/B"}
@@ -0,0 +1,124 @@
1
+ /** Secrets, plugins, orchestrators and vectorsearches: the kinds whose REST api only lists and reads them. */
2
+ import { ResourceNotFoundError, SmarterValueError } from "../core/errors.js";
3
+ import { Manifest, ManifestData, toManifest } from "../models/manifest.js";
4
+ import { Orchestrator, Secret, Vectorsearch } from "../models/misc.js";
5
+ import { Plugin } from "../models/plugin.js";
6
+ import { resourceId, SmarterKindResource } from "./base.js";
7
+ /** The manifest kinds of plugins. */
8
+ export const PLUGIN_KINDS = [
9
+ "Plugin",
10
+ "ApiPlugin",
11
+ "SkillPlugin",
12
+ "SqlPlugin",
13
+ "WebsearchPlugin",
14
+ "ImageSearchPlugin",
15
+ ];
16
+ /**
17
+ * Secrets: `/api/v1/secrets/`, and the manifest api's `Secret` kind.
18
+ *
19
+ * The api never returns a secret's value. Create and rotate secrets with {@link Secrets.apply}.
20
+ */
21
+ export class Secrets extends SmarterKindResource {
22
+ kind = "Secret";
23
+ path = "secrets/";
24
+ model = Secret;
25
+ }
26
+ /**
27
+ * Plugins: `/api/v1/plugins/`, and the manifest api's plugin kinds.
28
+ *
29
+ * A plugin's manifest kind is its class, e.g. `ApiPlugin` or `SqlPlugin`. {@link Plugins.apply}
30
+ * accepts any of them, and {@link Plugins.describe} and {@link Plugins.delete} look the kind up by name.
31
+ */
32
+ export class Plugins extends SmarterKindResource {
33
+ kind = "Plugin";
34
+ path = "plugins/";
35
+ model = Plugin;
36
+ /**
37
+ * Create or update a plugin from its manifest, of any plugin kind.
38
+ *
39
+ * @param manifest - The manifest.
40
+ * @param options - Per-request options.
41
+ * @returns The platform's response.
42
+ * @throws {@link SmarterValueError} If the manifest is not a plugin's.
43
+ */
44
+ async apply(manifest, options) {
45
+ const parsed = toManifest(manifest);
46
+ if (!PLUGIN_KINDS.includes(parsed.kind)) {
47
+ throw new SmarterValueError(`Expected a plugin manifest (${PLUGIN_KINDS.join(", ")}), not ${parsed.kind}.`);
48
+ }
49
+ return this.client.manifests.apply(parsed, options);
50
+ }
51
+ /**
52
+ * A plugin's manifest kind.
53
+ *
54
+ * @param name - The plugin's name.
55
+ * @param options - Per-request options.
56
+ * @returns e.g. `SqlPlugin`.
57
+ */
58
+ async kindOf(name, options) {
59
+ return (await this.find(name, options)).kind || this.kind;
60
+ }
61
+ /**
62
+ * A plugin's manifest, with its read-only `status`.
63
+ *
64
+ * @param name - The plugin's name.
65
+ * @param options - Per-request options.
66
+ * @returns The manifest.
67
+ */
68
+ async describe(name, options) {
69
+ return this.client.manifests.describe(await this.kindOf(name, options), name, options);
70
+ }
71
+ /**
72
+ * Permanently delete a plugin.
73
+ *
74
+ * @param name - The plugin's name.
75
+ * @param options - Per-request options.
76
+ * @returns The platform's response.
77
+ */
78
+ async delete(name, options) {
79
+ return this.client.manifests.delete(await this.kindOf(name, options), name, options);
80
+ }
81
+ /**
82
+ * One plugin, by its id, from the list.
83
+ *
84
+ * The platform's `plugins/<id>/` returns a plugin's manifest, not the plugin, so this reads the
85
+ * list. See {@link Plugins.retrieveManifest} for the manifest.
86
+ *
87
+ * @param id - The plugin's integer id.
88
+ * @param options - Per-request options.
89
+ * @returns The plugin.
90
+ * @throws {@link ResourceNotFoundError} If the user may read no plugin of that id.
91
+ */
92
+ async retrieve(id, options) {
93
+ const plugin = (await this.list(options)).find((item) => String(item.id) === String(id));
94
+ if (plugin === undefined)
95
+ throw new ResourceNotFoundError(`Plugin ${String(id)} not found.`);
96
+ return plugin;
97
+ }
98
+ /**
99
+ * One plugin's manifest, by the plugin's id: what the Python SDK's `plugins.retrieve()` returns.
100
+ *
101
+ * The platform serves this only when its `ALLOW_API_GET` waffle switch is on. Otherwise it answers
102
+ * 405: use {@link Plugins.find} or {@link Plugins.describe} instead.
103
+ *
104
+ * @param id - The plugin's id.
105
+ * @param options - Per-request options.
106
+ * @returns The plugin's manifest, whose `kind` is the plugin's, e.g. `SqlPlugin`.
107
+ */
108
+ async retrieveManifest(id, options) {
109
+ return new Manifest(await this.http.request("GET", `${this.path}${resourceId(id)}/`, ManifestData, options));
110
+ }
111
+ }
112
+ /** Orchestrators: `/api/v1/orchestrators/`, and the manifest api's `Orchestrator` kind. */
113
+ export class Orchestrators extends SmarterKindResource {
114
+ kind = "Orchestrator";
115
+ path = "orchestrators/";
116
+ model = Orchestrator;
117
+ }
118
+ /** Vectorsearches: `/api/v1/vectorsearches/`, and the manifest api's `Vectorsearch` kind. */
119
+ export class Vectorsearches extends SmarterKindResource {
120
+ kind = "Vectorsearch";
121
+ path = "vectorsearches/";
122
+ model = Vectorsearch;
123
+ }
124
+ //# sourceMappingURL=catalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/resources/catalog.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAE9G,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAI7E,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAsB,MAAM,uBAAuB,CAAC;AAC/F,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAE5D,qCAAqC;AACrC,MAAM,CAAC,MAAM,YAAY,GAAsB;IAC7C,QAAQ;IACR,WAAW;IACX,aAAa;IACb,WAAW;IACX,iBAAiB;IACjB,mBAAmB;CACpB,CAAC;AAEF;;;;GAIG;AACH,MAAM,OAAO,OAAQ,SAAQ,mBAAkC;IACpD,IAAI,GAAG,QAAQ,CAAC;IAChB,IAAI,GAAG,UAAU,CAAC;IAClB,KAAK,GAAG,MAAM,CAAC;CACzB;AAED;;;;;GAKG;AACH,MAAM,OAAO,OAAQ,SAAQ,mBAAkC;IACpD,IAAI,GAAG,QAAQ,CAAC;IAChB,IAAI,GAAG,UAAU,CAAC;IAClB,KAA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AC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QACzF,IAAI,MAAM,KAAK,SAAS;YAAE,MAAM,IAAI,qBAAqB,CAAC,UAAU,MAAM,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC;QAC7F,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,gBAAgB,CAAC,EAAa,EAAE,OAAwB;QAC5D,OAAO,IAAI,QAAQ,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC;IAC/G,CAAC;CACF;AAED,2FAA2F;AAC3F,MAAM,OAAO,aAAc,SAAQ,mBAAwC;IAChE,IAAI,GAAG,cAAc,CAAC;IACtB,IAAI,GAAG,gBAAgB,CAAC;IACxB,KAAK,GAAG,YAAY,CAAC;CAC/B;AAED,6FAA6F;AAC7F,MAAM,OAAO,cAAe,SAAQ,mBAAwC;IACjE,IAAI,GAAG,cAAc,CAAC;IACtB,IAAI,GAAG,iBAAiB,CAAC;IACzB,KAAK,GAAG,YAAY,CAAC;CAC/B"}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Guardrails: checks that the platform runs on prompts and on the LLM's replies.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * const result = await client.guardrails.evaluate(17, "My card is 4111 1111 1111 1111");
7
+ * if (result.triggered) console.log(result.disposition, result.text);
8
+ * ```
9
+ */
10
+ import type { RequestOptions } from "../core/http.ts";
11
+ import type { SmarterId } from "../core/typing.ts";
12
+ import { Guardrail, GuardrailEvaluation, GuardrailEvents } from "../models/guardrail.ts";
13
+ import { SmarterKindResource } from "./base.ts";
14
+ /** The stage of a prompt that a Guardrail runs on: the prompt (`input`) or the LLM's reply (`output`). */
15
+ export type GuardrailStage = "input" | "output";
16
+ /** Guardrails: `/api/v1/guardrails/`, and the manifest api's `Guardrail` kind. */
17
+ export declare class Guardrails extends SmarterKindResource<typeof Guardrail> {
18
+ readonly kind = "Guardrail";
19
+ readonly path = "guardrails/";
20
+ readonly model: import("zod").ZodObject<{
21
+ id: import("zod").ZodNumber;
22
+ hashedId: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
23
+ name: import("zod").ZodString;
24
+ description: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
25
+ version: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
26
+ tags: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
27
+ annotations: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodPreprocess<import("zod").ZodNullable<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>, unknown>>>;
28
+ createdAt: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
29
+ updatedAt: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
30
+ userProfile: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
31
+ user: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
32
+ username: import("zod").ZodString;
33
+ email: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
34
+ }, import("zod/v4/core").$loose>>>;
35
+ account: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
36
+ accountNumber: import("zod").ZodString;
37
+ }, import("zod/v4/core").$loose>>>;
38
+ }, import("zod/v4/core").$loose>>>;
39
+ canDelete: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
40
+ manifestUrl: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
41
+ detailUrl: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
42
+ ready: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
43
+ stage: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
44
+ category: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
45
+ strategy: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
46
+ pattern: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
47
+ config: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodType<import("../core/typing.ts").JsonObject, unknown, import("zod/v4/core").$ZodTypeInternals<import("../core/typing.ts").JsonObject, unknown>>>>;
48
+ threshold: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
49
+ action: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
50
+ replacement: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
51
+ message: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
52
+ severity: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
53
+ mode: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
54
+ failClosed: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
55
+ priority: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
56
+ isActive: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
57
+ }, import("zod/v4/core").$loose>;
58
+ /**
59
+ * Dry-run a Guardrail on a text, without saving an event.
60
+ *
61
+ * @param id - The Guardrail's id or hashed id.
62
+ * @param text - The text, e.g. a prompt (`input`) or an LLM's reply (`output`).
63
+ * @param options - `stage`: the stage to evaluate the text as, `input` by default. The Guardrail must run on it.
64
+ * @returns Whether it triggered, its disposition, and the text after its action.
65
+ * @throws {@link BadRequestError} If the text is empty or too long, or the Guardrail does not run on the stage.
66
+ */
67
+ evaluate(id: SmarterId, text: string, options?: RequestOptions & {
68
+ stage?: GuardrailStage;
69
+ }): Promise<GuardrailEvaluation>;
70
+ /**
71
+ * The latest events of a Guardrail that the user owns.
72
+ *
73
+ * @param id - The Guardrail's id or hashed id.
74
+ * @param options - `reviewed`: only reviewed (true) or unreviewed (false) events. `disposition`: only events of this disposition, e.g. `blocked`.
75
+ * @returns The events, newest first.
76
+ */
77
+ events(id: SmarterId, options?: RequestOptions & {
78
+ reviewed?: boolean | null;
79
+ disposition?: string | null;
80
+ }): Promise<GuardrailEvents>;
81
+ }
82
+ //# sourceMappingURL=guardrails.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guardrails.d.ts","sourceRoot":"","sources":["../../src/resources/guardrails.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzF,OAAO,EAAc,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAE5D,0GAA0G;AAC1G,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEhD,kFAAkF;AAClF,qBAAa,UAAW,SAAQ,mBAAmB,CAAC,OAAO,SAAS,CAAC;IACnE,QAAQ,CAAC,IAAI,eAAe;IAC5B,QAAQ,CAAC,IAAI,iBAAiB;IAC9B,QAAQ,CAAC,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qCAAa;IAE3B;;;;;;;;OAQG;IACG,QAAQ,CACZ,EAAE,EAAE,SAAS,EACb,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,cAAc,GAAG;QAAE,KAAK,CAAC,EAAE,cAAc,CAAA;KAAE,GACpD,OAAO,CAAC,mBAAmB,CAAC;IAO/B;;;;;;OAMG;IACG,MAAM,CACV,EAAE,EAAE,SAAS,EACb,OAAO,CAAC,EAAE,cAAc,GAAG;QAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GACpF,OAAO,CAAC,eAAe,CAAC;CAM5B"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Guardrails: checks that the platform runs on prompts and on the LLM's replies.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * const result = await client.guardrails.evaluate(17, "My card is 4111 1111 1111 1111");
7
+ * if (result.triggered) console.log(result.disposition, result.text);
8
+ * ```
9
+ */
10
+ import { Guardrail, GuardrailEvaluation, GuardrailEvents } from "../models/guardrail.js";
11
+ import { resourceId, SmarterKindResource } from "./base.js";
12
+ /** Guardrails: `/api/v1/guardrails/`, and the manifest api's `Guardrail` kind. */
13
+ export class Guardrails extends SmarterKindResource {
14
+ kind = "Guardrail";
15
+ path = "guardrails/";
16
+ model = Guardrail;
17
+ /**
18
+ * Dry-run a Guardrail on a text, without saving an event.
19
+ *
20
+ * @param id - The Guardrail's id or hashed id.
21
+ * @param text - The text, e.g. a prompt (`input`) or an LLM's reply (`output`).
22
+ * @param options - `stage`: the stage to evaluate the text as, `input` by default. The Guardrail must run on it.
23
+ * @returns Whether it triggered, its disposition, and the text after its action.
24
+ * @throws {@link BadRequestError} If the text is empty or too long, or the Guardrail does not run on the stage.
25
+ */
26
+ async evaluate(id, text, options) {
27
+ return this.http.request("POST", `${this.path}${resourceId(id)}/evaluate/`, GuardrailEvaluation, {
28
+ ...options,
29
+ json: { text, stage: options?.stage ?? "input" },
30
+ });
31
+ }
32
+ /**
33
+ * The latest events of a Guardrail that the user owns.
34
+ *
35
+ * @param id - The Guardrail's id or hashed id.
36
+ * @param options - `reviewed`: only reviewed (true) or unreviewed (false) events. `disposition`: only events of this disposition, e.g. `blocked`.
37
+ * @returns The events, newest first.
38
+ */
39
+ async events(id, options) {
40
+ return this.http.request("GET", `${this.path}${resourceId(id)}/events/`, GuardrailEvents, {
41
+ ...options,
42
+ params: { reviewed: options?.reviewed, disposition: options?.disposition },
43
+ });
44
+ }
45
+ }
46
+ //# sourceMappingURL=guardrails.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guardrails.js","sourceRoot":"","sources":["../../src/resources/guardrails.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzF,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAK5D,kFAAkF;AAClF,MAAM,OAAO,UAAW,SAAQ,mBAAqC;IAC1D,IAAI,GAAG,WAAW,CAAC;IACnB,IAAI,GAAG,aAAa,CAAC;IACrB,KAAK,GAAG,SAAS,CAAC;IAE3B;;;;;;;;OAQG;IACH,KAAK,CAAC,QAAQ,CACZ,EAAa,EACb,IAAY,EACZ,OAAqD;QAErD,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,EAAE,CAAC,YAAY,EAAE,mBAAmB,EAAE;YAC/F,GAAG,OAAO;YACV,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE;SACjD,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,CACV,EAAa,EACb,OAAqF;QAErF,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,eAAe,EAAE;YACxF,GAAG,OAAO;YACV,MAAM,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE;SAC3E,CAAC,CAAC;IACL,CAAC;CACF"}