@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.
- package/LICENSE.txt +671 -0
- package/README.md +193 -2
- package/dist/client.d.ts +146 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +178 -0
- package/dist/client.js.map +1 -0
- package/dist/core/config.d.ts +148 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +212 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/errors.d.ts +189 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +187 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/http.d.ts +207 -0
- package/dist/core/http.d.ts.map +1 -0
- package/dist/core/http.js +456 -0
- package/dist/core/http.js.map +1 -0
- package/dist/core/log.d.ts +62 -0
- package/dist/core/log.d.ts.map +1 -0
- package/dist/core/log.js +68 -0
- package/dist/core/log.js.map +1 -0
- package/dist/core/sse.d.ts +38 -0
- package/dist/core/sse.d.ts.map +1 -0
- package/dist/core/sse.js +79 -0
- package/dist/core/sse.js.map +1 -0
- package/dist/core/typing.d.ts +21 -0
- package/dist/core/typing.d.ts.map +1 -0
- package/dist/core/typing.js +13 -0
- package/dist/core/typing.js.map +1 -0
- package/dist/index.d.ts +51 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/models/account.d.ts +112 -0
- package/dist/models/account.d.ts.map +1 -0
- package/dist/models/account.js +55 -0
- package/dist/models/account.js.map +1 -0
- package/dist/models/base.d.ts +99 -0
- package/dist/models/base.d.ts.map +1 -0
- package/dist/models/base.js +111 -0
- package/dist/models/base.js.map +1 -0
- package/dist/models/chat.d.ts +2243 -0
- package/dist/models/chat.d.ts.map +1 -0
- package/dist/models/chat.js +451 -0
- package/dist/models/chat.js.map +1 -0
- package/dist/models/guardrail.d.ts +109 -0
- package/dist/models/guardrail.d.ts.map +1 -0
- package/dist/models/guardrail.js +68 -0
- package/dist/models/guardrail.js.map +1 -0
- package/dist/models/journal.d.ts +159 -0
- package/dist/models/journal.d.ts.map +1 -0
- package/dist/models/journal.js +115 -0
- package/dist/models/journal.js.map +1 -0
- package/dist/models/llmclient.d.ts +183 -0
- package/dist/models/llmclient.d.ts.map +1 -0
- package/dist/models/llmclient.js +105 -0
- package/dist/models/llmclient.js.map +1 -0
- package/dist/models/llmhost.d.ts +121 -0
- package/dist/models/llmhost.d.ts.map +1 -0
- package/dist/models/llmhost.js +79 -0
- package/dist/models/llmhost.js.map +1 -0
- package/dist/models/manifest.d.ts +211 -0
- package/dist/models/manifest.d.ts.map +1 -0
- package/dist/models/manifest.js +290 -0
- package/dist/models/manifest.js.map +1 -0
- package/dist/models/mcpclient.d.ts +99 -0
- package/dist/models/mcpclient.d.ts.map +1 -0
- package/dist/models/mcpclient.js +65 -0
- package/dist/models/mcpclient.js.map +1 -0
- package/dist/models/misc.d.ts +232 -0
- package/dist/models/misc.d.ts.map +1 -0
- package/dist/models/misc.js +110 -0
- package/dist/models/misc.js.map +1 -0
- package/dist/models/platform.d.ts +88 -0
- package/dist/models/platform.d.ts.map +1 -0
- package/dist/models/platform.js +35 -0
- package/dist/models/platform.js.map +1 -0
- package/dist/models/plugin.d.ts +36 -0
- package/dist/models/plugin.d.ts.map +1 -0
- package/dist/models/plugin.js +16 -0
- package/dist/models/plugin.js.map +1 -0
- package/dist/models/react.d.ts +104 -0
- package/dist/models/react.d.ts.map +1 -0
- package/dist/models/react.js +136 -0
- package/dist/models/react.js.map +1 -0
- package/dist/models/sam/account.d.ts +155 -0
- package/dist/models/sam/account.d.ts.map +1 -0
- package/dist/models/sam/account.js +7 -0
- package/dist/models/sam/account.js.map +1 -0
- package/dist/models/sam/apiconnection.d.ts +147 -0
- package/dist/models/sam/apiconnection.d.ts.map +1 -0
- package/dist/models/sam/apiconnection.js +7 -0
- package/dist/models/sam/apiconnection.js.map +1 -0
- package/dist/models/sam/apiplugin.d.ts +278 -0
- package/dist/models/sam/apiplugin.d.ts.map +1 -0
- package/dist/models/sam/apiplugin.js +7 -0
- package/dist/models/sam/apiplugin.js.map +1 -0
- package/dist/models/sam/budget.d.ts +219 -0
- package/dist/models/sam/budget.d.ts.map +1 -0
- package/dist/models/sam/budget.js +7 -0
- package/dist/models/sam/budget.js.map +1 -0
- package/dist/models/sam/customdomain.d.ts +139 -0
- package/dist/models/sam/customdomain.d.ts.map +1 -0
- package/dist/models/sam/customdomain.js +7 -0
- package/dist/models/sam/customdomain.js.map +1 -0
- package/dist/models/sam/guardrail.d.ts +222 -0
- package/dist/models/sam/guardrail.d.ts.map +1 -0
- package/dist/models/sam/guardrail.js +7 -0
- package/dist/models/sam/guardrail.js.map +1 -0
- package/dist/models/sam/imagesearchplugin.d.ts +235 -0
- package/dist/models/sam/imagesearchplugin.d.ts.map +1 -0
- package/dist/models/sam/imagesearchplugin.js +7 -0
- package/dist/models/sam/imagesearchplugin.js.map +1 -0
- package/dist/models/sam/index.d.ts +104 -0
- package/dist/models/sam/index.d.ts.map +1 -0
- package/dist/models/sam/index.js +50 -0
- package/dist/models/sam/index.js.map +1 -0
- package/dist/models/sam/llmclient.d.ts +490 -0
- package/dist/models/sam/llmclient.d.ts.map +1 -0
- package/dist/models/sam/llmclient.js +7 -0
- package/dist/models/sam/llmclient.js.map +1 -0
- package/dist/models/sam/llmhost.d.ts +429 -0
- package/dist/models/sam/llmhost.d.ts.map +1 -0
- package/dist/models/sam/llmhost.js +7 -0
- package/dist/models/sam/llmhost.js.map +1 -0
- package/dist/models/sam/llmhostcompute.d.ts +221 -0
- package/dist/models/sam/llmhostcompute.d.ts.map +1 -0
- package/dist/models/sam/llmhostcompute.js +7 -0
- package/dist/models/sam/llmhostcompute.js.map +1 -0
- package/dist/models/sam/mcpclient.d.ts +195 -0
- package/dist/models/sam/mcpclient.d.ts.map +1 -0
- package/dist/models/sam/mcpclient.js +7 -0
- package/dist/models/sam/mcpclient.js.map +1 -0
- package/dist/models/sam/orchestrator.d.ts +163 -0
- package/dist/models/sam/orchestrator.d.ts.map +1 -0
- package/dist/models/sam/orchestrator.js +7 -0
- package/dist/models/sam/orchestrator.js.map +1 -0
- package/dist/models/sam/plugin.d.ts +163 -0
- package/dist/models/sam/plugin.d.ts.map +1 -0
- package/dist/models/sam/plugin.js +7 -0
- package/dist/models/sam/plugin.js.map +1 -0
- package/dist/models/sam/prompt.d.ts +116 -0
- package/dist/models/sam/prompt.d.ts.map +1 -0
- package/dist/models/sam/prompt.js +7 -0
- package/dist/models/sam/prompt.js.map +1 -0
- package/dist/models/sam/provider.d.ts +195 -0
- package/dist/models/sam/provider.d.ts.map +1 -0
- package/dist/models/sam/provider.js +7 -0
- package/dist/models/sam/provider.js.map +1 -0
- package/dist/models/sam/proxy.d.ts +163 -0
- package/dist/models/sam/proxy.d.ts.map +1 -0
- package/dist/models/sam/proxy.js +7 -0
- package/dist/models/sam/proxy.js.map +1 -0
- package/dist/models/sam/schemas.d.ts +8 -0
- package/dist/models/sam/schemas.d.ts.map +1 -0
- package/dist/models/sam/schemas.js +6059 -0
- package/dist/models/sam/schemas.js.map +1 -0
- package/dist/models/sam/secret.d.ts +123 -0
- package/dist/models/sam/secret.d.ts.map +1 -0
- package/dist/models/sam/secret.js +7 -0
- package/dist/models/sam/secret.js.map +1 -0
- package/dist/models/sam/skillplugin.d.ts +181 -0
- package/dist/models/sam/skillplugin.d.ts.map +1 -0
- package/dist/models/sam/skillplugin.js +7 -0
- package/dist/models/sam/skillplugin.js.map +1 -0
- package/dist/models/sam/smarterauthtoken.d.ts +115 -0
- package/dist/models/sam/smarterauthtoken.d.ts.map +1 -0
- package/dist/models/sam/smarterauthtoken.js +7 -0
- package/dist/models/sam/smarterauthtoken.js.map +1 -0
- package/dist/models/sam/sqlconnection.d.ts +187 -0
- package/dist/models/sam/sqlconnection.d.ts.map +1 -0
- package/dist/models/sam/sqlconnection.js +7 -0
- package/dist/models/sam/sqlconnection.js.map +1 -0
- package/dist/models/sam/sqlplugin.d.ts +232 -0
- package/dist/models/sam/sqlplugin.d.ts.map +1 -0
- package/dist/models/sam/sqlplugin.js +7 -0
- package/dist/models/sam/sqlplugin.js.map +1 -0
- package/dist/models/sam/user.d.ts +135 -0
- package/dist/models/sam/user.d.ts.map +1 -0
- package/dist/models/sam/user.js +7 -0
- package/dist/models/sam/user.js.map +1 -0
- package/dist/models/sam/vectorsearch.d.ts +150 -0
- package/dist/models/sam/vectorsearch.d.ts.map +1 -0
- package/dist/models/sam/vectorsearch.js +7 -0
- package/dist/models/sam/vectorsearch.js.map +1 -0
- package/dist/models/sam/vectorstore.d.ts +291 -0
- package/dist/models/sam/vectorstore.d.ts.map +1 -0
- package/dist/models/sam/vectorstore.js +7 -0
- package/dist/models/sam/vectorstore.js.map +1 -0
- package/dist/models/sam/websearchplugin.d.ts +229 -0
- package/dist/models/sam/websearchplugin.d.ts.map +1 -0
- package/dist/models/sam/websearchplugin.js +7 -0
- package/dist/models/sam/websearchplugin.js.map +1 -0
- package/dist/models/vectorstore.d.ts +165 -0
- package/dist/models/vectorstore.d.ts.map +1 -0
- package/dist/models/vectorstore.js +90 -0
- package/dist/models/vectorstore.js.map +1 -0
- package/dist/resources/accounts.d.ts +107 -0
- package/dist/resources/accounts.d.ts.map +1 -0
- package/dist/resources/accounts.js +84 -0
- package/dist/resources/accounts.js.map +1 -0
- package/dist/resources/base.d.ts +127 -0
- package/dist/resources/base.d.ts.map +1 -0
- package/dist/resources/base.js +139 -0
- package/dist/resources/base.js.map +1 -0
- package/dist/resources/catalog.d.ts +209 -0
- package/dist/resources/catalog.d.ts.map +1 -0
- package/dist/resources/catalog.js +124 -0
- package/dist/resources/catalog.js.map +1 -0
- package/dist/resources/guardrails.d.ts +82 -0
- package/dist/resources/guardrails.d.ts.map +1 -0
- package/dist/resources/guardrails.js +46 -0
- package/dist/resources/guardrails.js.map +1 -0
- package/dist/resources/history.d.ts +97 -0
- package/dist/resources/history.d.ts.map +1 -0
- package/dist/resources/history.js +109 -0
- package/dist/resources/history.js.map +1 -0
- package/dist/resources/llmclients.d.ts +348 -0
- package/dist/resources/llmclients.d.ts.map +1 -0
- package/dist/resources/llmclients.js +367 -0
- package/dist/resources/llmclients.js.map +1 -0
- package/dist/resources/llmhosts.d.ts +146 -0
- package/dist/resources/llmhosts.d.ts.map +1 -0
- package/dist/resources/llmhosts.js +128 -0
- package/dist/resources/llmhosts.js.map +1 -0
- package/dist/resources/manifests.d.ts +153 -0
- package/dist/resources/manifests.d.ts.map +1 -0
- package/dist/resources/manifests.js +203 -0
- package/dist/resources/manifests.js.map +1 -0
- package/dist/resources/mcpclients.d.ts +90 -0
- package/dist/resources/mcpclients.d.ts.map +1 -0
- package/dist/resources/mcpclients.js +57 -0
- package/dist/resources/mcpclients.js.map +1 -0
- package/dist/resources/providers.d.ts +33 -0
- package/dist/resources/providers.d.ts.map +1 -0
- package/dist/resources/providers.js +39 -0
- package/dist/resources/providers.js.map +1 -0
- package/dist/resources/proxies.d.ts +61 -0
- package/dist/resources/proxies.d.ts.map +1 -0
- package/dist/resources/proxies.js +57 -0
- package/dist/resources/proxies.js.map +1 -0
- package/dist/resources/vectorstores.d.ts +194 -0
- package/dist/resources/vectorstores.d.ts.map +1 -0
- package/dist/resources/vectorstores.js +200 -0
- package/dist/resources/vectorstores.js.map +1 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +5 -0
- package/dist/version.js.map +1 -0
- package/package.json +81 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llmhosts.js","sourceRoot":"","sources":["../../src/resources/llmhosts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,OAAO,EACP,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,GAEd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC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AAG,OAAO;YACV,MAAM,EAAE;gBACN,UAAU;gBACV,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,aAAa;gBAC1C,MAAM,EAAE,OAAO,EAAE,MAAM;gBACvB,IAAI,EAAE,OAAO,EAAE,IAAI;gBACnB,WAAW,EAAE,OAAO,EAAE,WAAW;aAClC;SACF,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;CACF"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The manifest api: the brokered, journaled `/api/v1/cli/` endpoints that the `smarter` cli uses.
|
|
3
|
+
*
|
|
4
|
+
* Every resource kind is managed through the same verbs: `apply`, `validate`, `get`, `describe`,
|
|
5
|
+
* `delete`, `deploy`, `undeploy` and `logs`. The kind's broker on the platform validates the manifest
|
|
6
|
+
* with its Pydantic models and applies its business rules, so this is the only way that the SDK
|
|
7
|
+
* writes resources.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { Smarter } from "@smarter.sh/api";
|
|
12
|
+
*
|
|
13
|
+
* const client = new Smarter();
|
|
14
|
+
* await client.manifests.apply("guardrail.yaml");
|
|
15
|
+
* const manifest = await client.manifests.describe("Guardrail", "pii_redactor");
|
|
16
|
+
* await client.manifests.delete("Guardrail", "pii_redactor");
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
import type { RequestOptions } from "../core/http.ts";
|
|
20
|
+
import { JsonObject } from "../core/typing.ts";
|
|
21
|
+
import { SmarterJournaledResponse, SmarterJournalMessage } from "../models/journal.ts";
|
|
22
|
+
import { Manifest, ManifestValidation, type ManifestInput, type ManifestTable } from "../models/manifest.ts";
|
|
23
|
+
import { SmarterAPIResource } from "./base.ts";
|
|
24
|
+
/** The path of the manifest api, relative to the api's base url. */
|
|
25
|
+
export declare const CLI_PATH = "cli/";
|
|
26
|
+
/**
|
|
27
|
+
* A kind as a url path segment.
|
|
28
|
+
*
|
|
29
|
+
* @param kind - The manifest kind, e.g. `LLMClient`.
|
|
30
|
+
* @returns The kind.
|
|
31
|
+
* @throws {@link SmarterValueError} If it is empty or not a single identifier.
|
|
32
|
+
*/
|
|
33
|
+
export declare function kindSegment(kind: string): string;
|
|
34
|
+
/** The options of {@link Manifests.get}, beside the per-request options. */
|
|
35
|
+
export interface ManifestGetOptions extends RequestOptions {
|
|
36
|
+
/**
|
|
37
|
+
* An annotation selector: only the resources whose annotations match every requirement. A
|
|
38
|
+
* requirement has the syntax of a Kubernetes label selector: `key` (has the annotation), `!key`
|
|
39
|
+
* (doesn't have it), `key=value` or `key!=value` (which also matches resources without the key),
|
|
40
|
+
* e.g. `acme.com/crm-account-id=A-10042`. Pass an array for several requirements. An invalid
|
|
41
|
+
* requirement is a {@link BadRequestError}.
|
|
42
|
+
*/
|
|
43
|
+
annotation?: string | readonly string[] | null;
|
|
44
|
+
}
|
|
45
|
+
/** The manifest api: apply, validate, get, describe, delete, deploy, undeploy and logs, for any kind. */
|
|
46
|
+
export declare class Manifests extends SmarterAPIResource {
|
|
47
|
+
#private;
|
|
48
|
+
/**
|
|
49
|
+
* Create or update a resource from its manifest.
|
|
50
|
+
*
|
|
51
|
+
* The platform compares the manifest with the resource's current state and makes the changes that
|
|
52
|
+
* the difference requires.
|
|
53
|
+
*
|
|
54
|
+
* @param manifest - The manifest: a {@link Manifest}, an object, YAML text, or the path of a YAML file.
|
|
55
|
+
* @param options - Per-request options.
|
|
56
|
+
* @returns The platform's response, whose `message` says what was applied.
|
|
57
|
+
* @throws {@link BadRequestError} If the platform rejects the manifest.
|
|
58
|
+
*/
|
|
59
|
+
apply(manifest: ManifestInput, options?: RequestOptions): Promise<SmarterJournalMessage>;
|
|
60
|
+
/**
|
|
61
|
+
* Validate a manifest without applying it.
|
|
62
|
+
*
|
|
63
|
+
* @param manifest - The manifest, in any form that {@link Manifests.apply} accepts.
|
|
64
|
+
* @param options - Per-request options.
|
|
65
|
+
* @returns Whether it is valid, and its errors.
|
|
66
|
+
*/
|
|
67
|
+
validate(manifest: ManifestInput, options?: RequestOptions): Promise<ManifestValidation>;
|
|
68
|
+
/**
|
|
69
|
+
* The resources of one kind, as a table.
|
|
70
|
+
*
|
|
71
|
+
* @param kind - The manifest kind, e.g. `LLMClient`.
|
|
72
|
+
* @param name - Only the resource of this name.
|
|
73
|
+
* @param options - `annotation`: an annotation selector, e.g. `acme.com/crm-account-id=A-10042`, or an array of its requirements. And the per-request options.
|
|
74
|
+
* @returns The table: `data.items` are its rows, and `names` the resources' names.
|
|
75
|
+
* @throws {@link BadRequestError} If the annotation selector is invalid.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* const table = await client.manifests.get("LLMClient", null, {
|
|
80
|
+
* annotation: ["acme.com/crm-account-id=A-10042", "!acme.com/archived"],
|
|
81
|
+
* });
|
|
82
|
+
* console.log(table.names);
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
get(kind: string, name?: string | null, options?: ManifestGetOptions): Promise<ManifestTable>;
|
|
86
|
+
/**
|
|
87
|
+
* A resource's manifest, with its read-only `status`.
|
|
88
|
+
*
|
|
89
|
+
* @param kind - The manifest kind.
|
|
90
|
+
* @param name - The resource's name.
|
|
91
|
+
* @param options - Per-request options.
|
|
92
|
+
* @returns The manifest, which {@link Manifests.apply} accepts as is.
|
|
93
|
+
* @throws {@link NotFoundError} If the resource does not exist.
|
|
94
|
+
*/
|
|
95
|
+
describe(kind: string, name: string, options?: RequestOptions): Promise<Manifest>;
|
|
96
|
+
/**
|
|
97
|
+
* Permanently delete a resource.
|
|
98
|
+
*
|
|
99
|
+
* @param kind - The manifest kind.
|
|
100
|
+
* @param name - The resource's name.
|
|
101
|
+
* @param options - Per-request options.
|
|
102
|
+
* @returns The platform's response.
|
|
103
|
+
* @throws {@link NotFoundError} If the resource does not exist.
|
|
104
|
+
*/
|
|
105
|
+
delete(kind: string, name: string, options?: RequestOptions): Promise<SmarterJournalMessage>;
|
|
106
|
+
/**
|
|
107
|
+
* Deploy a resource, e.g. an LLMClient on its own host name.
|
|
108
|
+
*
|
|
109
|
+
* This creates real infrastructure on the platform's cloud, e.g. DNS records, TLS certificates and
|
|
110
|
+
* Kubernetes ingresses, which may be billable.
|
|
111
|
+
*
|
|
112
|
+
* @param kind - The manifest kind of a deployable resource. See `client.kinds()`.
|
|
113
|
+
* @param name - The resource's name.
|
|
114
|
+
* @param options - Per-request options.
|
|
115
|
+
* @returns The platform's response.
|
|
116
|
+
*/
|
|
117
|
+
deploy(kind: string, name: string, options?: RequestOptions): Promise<SmarterJournalMessage>;
|
|
118
|
+
/**
|
|
119
|
+
* Undo a resource's deployment.
|
|
120
|
+
*
|
|
121
|
+
* @param kind - The manifest kind.
|
|
122
|
+
* @param name - The resource's name.
|
|
123
|
+
* @param options - Per-request options.
|
|
124
|
+
* @returns The platform's response.
|
|
125
|
+
*/
|
|
126
|
+
undeploy(kind: string, name: string, options?: RequestOptions): Promise<SmarterJournalMessage>;
|
|
127
|
+
/**
|
|
128
|
+
* A resource's logs.
|
|
129
|
+
*
|
|
130
|
+
* @param kind - The manifest kind.
|
|
131
|
+
* @param name - The resource's name.
|
|
132
|
+
* @param options - Per-request options.
|
|
133
|
+
* @returns The platform's response: its `message`, and its `data` for the kinds that have logs.
|
|
134
|
+
*/
|
|
135
|
+
logs(kind: string, name: string, options?: RequestOptions): Promise<SmarterJournaledResponse<JsonObject>>;
|
|
136
|
+
/**
|
|
137
|
+
* A valid example manifest of a kind, to start from.
|
|
138
|
+
*
|
|
139
|
+
* @param kind - The manifest kind.
|
|
140
|
+
* @param options - Per-request options.
|
|
141
|
+
* @returns The manifest.
|
|
142
|
+
*/
|
|
143
|
+
exampleManifest(kind: string, options?: RequestOptions): Promise<Manifest>;
|
|
144
|
+
/**
|
|
145
|
+
* The JSON Schema of a kind's manifest, e.g. to validate manifests locally or to generate a form.
|
|
146
|
+
*
|
|
147
|
+
* @param kind - The manifest kind.
|
|
148
|
+
* @param options - Per-request options.
|
|
149
|
+
* @returns The schema (draft 2020-12).
|
|
150
|
+
*/
|
|
151
|
+
jsonSchema(kind: string, options?: RequestOptions): Promise<JsonObject>;
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=manifests.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifests.d.ts","sourceRoot":"","sources":["../../src/resources/manifests.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACvF,OAAO,EACL,QAAQ,EAGR,kBAAkB,EAGlB,KAAK,aAAa,EAClB,KAAK,aAAa,EACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,oEAAoE;AACpE,eAAO,MAAM,QAAQ,SAAS,CAAC;AAE/B;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKhD;AAED,4EAA4E;AAC5E,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,IAAI,CAAC;CAChD;AAED,yGAAyG;AACzG,qBAAa,SAAU,SAAQ,kBAAkB;;IAC/C;;;;;;;;;;OAUG;IACG,KAAK,CAAC,QAAQ,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAO9F;;;;;;OAMG;IACG,QAAQ,CAAC,QAAQ,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAA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: the brokered, journaled `/api/v1/cli/` endpoints that the `smarter` cli uses.
|
|
3
|
+
*
|
|
4
|
+
* Every resource kind is managed through the same verbs: `apply`, `validate`, `get`, `describe`,
|
|
5
|
+
* `delete`, `deploy`, `undeploy` and `logs`. The kind's broker on the platform validates the manifest
|
|
6
|
+
* with its Pydantic models and applies its business rules, so this is the only way that the SDK
|
|
7
|
+
* writes resources.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { Smarter } from "@smarter.sh/api";
|
|
12
|
+
*
|
|
13
|
+
* const client = new Smarter();
|
|
14
|
+
* await client.manifests.apply("guardrail.yaml");
|
|
15
|
+
* const manifest = await client.manifests.describe("Guardrail", "pii_redactor");
|
|
16
|
+
* await client.manifests.delete("Guardrail", "pii_redactor");
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
import { SmarterValueError } from "../core/errors.js";
|
|
20
|
+
import { JsonObject } from "../core/typing.js";
|
|
21
|
+
import { SmarterJournaledResponse, SmarterJournalMessage } from "../models/journal.js";
|
|
22
|
+
import { Manifest, ManifestData, ManifestList, ManifestValidation, toManifest, withNames, } from "../models/manifest.js";
|
|
23
|
+
import { SmarterAPIResource } from "./base.js";
|
|
24
|
+
/** The path of the manifest api, relative to the api's base url. */
|
|
25
|
+
export const CLI_PATH = "cli/";
|
|
26
|
+
/**
|
|
27
|
+
* A kind as a url path segment.
|
|
28
|
+
*
|
|
29
|
+
* @param kind - The manifest kind, e.g. `LLMClient`.
|
|
30
|
+
* @returns The kind.
|
|
31
|
+
* @throws {@link SmarterValueError} If it is empty or not a single identifier.
|
|
32
|
+
*/
|
|
33
|
+
export function kindSegment(kind) {
|
|
34
|
+
const text = kind.trim();
|
|
35
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(text))
|
|
36
|
+
throw new SmarterValueError(`Invalid manifest kind: ${JSON.stringify(kind)}`);
|
|
37
|
+
return text;
|
|
38
|
+
}
|
|
39
|
+
/** The manifest api: apply, validate, get, describe, delete, deploy, undeploy and logs, for any kind. */
|
|
40
|
+
export class Manifests extends SmarterAPIResource {
|
|
41
|
+
/**
|
|
42
|
+
* Create or update a resource from its manifest.
|
|
43
|
+
*
|
|
44
|
+
* The platform compares the manifest with the resource's current state and makes the changes that
|
|
45
|
+
* the difference requires.
|
|
46
|
+
*
|
|
47
|
+
* @param manifest - The manifest: a {@link Manifest}, an object, YAML text, or the path of a YAML file.
|
|
48
|
+
* @param options - Per-request options.
|
|
49
|
+
* @returns The platform's response, whose `message` says what was applied.
|
|
50
|
+
* @throws {@link BadRequestError} If the platform rejects the manifest.
|
|
51
|
+
*/
|
|
52
|
+
async apply(manifest, options) {
|
|
53
|
+
return this.http.request("POST", `${CLI_PATH}apply/`, SmarterJournalMessage, {
|
|
54
|
+
...options,
|
|
55
|
+
json: toManifest(manifest).toApply(),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Validate a manifest without applying it.
|
|
60
|
+
*
|
|
61
|
+
* @param manifest - The manifest, in any form that {@link Manifests.apply} accepts.
|
|
62
|
+
* @param options - Per-request options.
|
|
63
|
+
* @returns Whether it is valid, and its errors.
|
|
64
|
+
*/
|
|
65
|
+
async validate(manifest, options) {
|
|
66
|
+
const response = await this.http.request("POST", `${CLI_PATH}validate/`, SmarterJournaledResponse(ManifestValidation), {
|
|
67
|
+
...options,
|
|
68
|
+
json: toManifest(manifest).toApply(),
|
|
69
|
+
});
|
|
70
|
+
return response.data ?? { valid: false, errors: [] };
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The resources of one kind, as a table.
|
|
74
|
+
*
|
|
75
|
+
* @param kind - The manifest kind, e.g. `LLMClient`.
|
|
76
|
+
* @param name - Only the resource of this name.
|
|
77
|
+
* @param options - `annotation`: an annotation selector, e.g. `acme.com/crm-account-id=A-10042`, or an array of its requirements. And the per-request options.
|
|
78
|
+
* @returns The table: `data.items` are its rows, and `names` the resources' names.
|
|
79
|
+
* @throws {@link BadRequestError} If the annotation selector is invalid.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts
|
|
83
|
+
* const table = await client.manifests.get("LLMClient", null, {
|
|
84
|
+
* annotation: ["acme.com/crm-account-id=A-10042", "!acme.com/archived"],
|
|
85
|
+
* });
|
|
86
|
+
* console.log(table.names);
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
async get(kind, name, options) {
|
|
90
|
+
const { annotation, ...requestOptions } = options ?? {};
|
|
91
|
+
const response = await this.http.request("POST", `${CLI_PATH}get/${kindSegment(kind)}/`, SmarterJournaledResponse(ManifestList), {
|
|
92
|
+
...requestOptions,
|
|
93
|
+
params: { name, annotation },
|
|
94
|
+
});
|
|
95
|
+
const result = response.data ?? ManifestList.parse({ kind });
|
|
96
|
+
if (name !== undefined && name !== null) {
|
|
97
|
+
// the platform's get ignores the name filter for some kinds, so it is applied here too.
|
|
98
|
+
result.data.items = result.data.items.filter((item) => item["name"] === name);
|
|
99
|
+
result.metadata.count = result.data.items.length;
|
|
100
|
+
}
|
|
101
|
+
return withNames(result);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* A resource's manifest, with its read-only `status`.
|
|
105
|
+
*
|
|
106
|
+
* @param kind - The manifest kind.
|
|
107
|
+
* @param name - The resource's name.
|
|
108
|
+
* @param options - Per-request options.
|
|
109
|
+
* @returns The manifest, which {@link Manifests.apply} accepts as is.
|
|
110
|
+
* @throws {@link NotFoundError} If the resource does not exist.
|
|
111
|
+
*/
|
|
112
|
+
async describe(kind, name, options) {
|
|
113
|
+
const response = await this.http.request("POST", `${CLI_PATH}describe/${kindSegment(kind)}/`, SmarterJournaledResponse(ManifestData), {
|
|
114
|
+
...options,
|
|
115
|
+
params: { name },
|
|
116
|
+
});
|
|
117
|
+
if (!response.data)
|
|
118
|
+
throw new SmarterValueError(`The platform returned no manifest for ${kind} ${JSON.stringify(name)}.`);
|
|
119
|
+
return new Manifest(response.data);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Permanently delete a resource.
|
|
123
|
+
*
|
|
124
|
+
* @param kind - The manifest kind.
|
|
125
|
+
* @param name - The resource's name.
|
|
126
|
+
* @param options - Per-request options.
|
|
127
|
+
* @returns The platform's response.
|
|
128
|
+
* @throws {@link NotFoundError} If the resource does not exist.
|
|
129
|
+
*/
|
|
130
|
+
async delete(kind, name, options) {
|
|
131
|
+
return this.#command("delete", kind, name, options);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Deploy a resource, e.g. an LLMClient on its own host name.
|
|
135
|
+
*
|
|
136
|
+
* This creates real infrastructure on the platform's cloud, e.g. DNS records, TLS certificates and
|
|
137
|
+
* Kubernetes ingresses, which may be billable.
|
|
138
|
+
*
|
|
139
|
+
* @param kind - The manifest kind of a deployable resource. See `client.kinds()`.
|
|
140
|
+
* @param name - The resource's name.
|
|
141
|
+
* @param options - Per-request options.
|
|
142
|
+
* @returns The platform's response.
|
|
143
|
+
*/
|
|
144
|
+
async deploy(kind, name, options) {
|
|
145
|
+
return this.#command("deploy", kind, name, options);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Undo a resource's deployment.
|
|
149
|
+
*
|
|
150
|
+
* @param kind - The manifest kind.
|
|
151
|
+
* @param name - The resource's name.
|
|
152
|
+
* @param options - Per-request options.
|
|
153
|
+
* @returns The platform's response.
|
|
154
|
+
*/
|
|
155
|
+
async undeploy(kind, name, options) {
|
|
156
|
+
return this.#command("undeploy", kind, name, options);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* A resource's logs.
|
|
160
|
+
*
|
|
161
|
+
* @param kind - The manifest kind.
|
|
162
|
+
* @param name - The resource's name.
|
|
163
|
+
* @param options - Per-request options.
|
|
164
|
+
* @returns The platform's response: its `message`, and its `data` for the kinds that have logs.
|
|
165
|
+
*/
|
|
166
|
+
async logs(kind, name, options) {
|
|
167
|
+
return this.http.request("POST", `${CLI_PATH}logs/${kindSegment(kind)}/`, SmarterJournaledResponse(JsonObject), {
|
|
168
|
+
...options,
|
|
169
|
+
params: { name },
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* A valid example manifest of a kind, to start from.
|
|
174
|
+
*
|
|
175
|
+
* @param kind - The manifest kind.
|
|
176
|
+
* @param options - Per-request options.
|
|
177
|
+
* @returns The manifest.
|
|
178
|
+
*/
|
|
179
|
+
async exampleManifest(kind, options) {
|
|
180
|
+
const response = await this.http.request("POST", `${CLI_PATH}example-manifest/${kindSegment(kind)}/`, SmarterJournaledResponse(ManifestData), options);
|
|
181
|
+
if (!response.data)
|
|
182
|
+
throw new SmarterValueError(`The platform returned no example manifest for ${kind}.`);
|
|
183
|
+
return new Manifest(response.data);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* The JSON Schema of a kind's manifest, e.g. to validate manifests locally or to generate a form.
|
|
187
|
+
*
|
|
188
|
+
* @param kind - The manifest kind.
|
|
189
|
+
* @param options - Per-request options.
|
|
190
|
+
* @returns The schema (draft 2020-12).
|
|
191
|
+
*/
|
|
192
|
+
async jsonSchema(kind, options) {
|
|
193
|
+
const response = await this.http.request("POST", `${CLI_PATH}json-schema/${kindSegment(kind)}/`, SmarterJournaledResponse(JsonObject), options);
|
|
194
|
+
return response.data ?? {};
|
|
195
|
+
}
|
|
196
|
+
#command(command, kind, name, options) {
|
|
197
|
+
return this.http.request("POST", `${CLI_PATH}${command}/${kindSegment(kind)}/`, SmarterJournalMessage, {
|
|
198
|
+
...options,
|
|
199
|
+
params: { name },
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=manifests.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifests.js","sourceRoot":"","sources":["../../src/resources/manifests.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,iBAAiB,EAAE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ools = await client.mcpClients.tools(1);
|
|
7
|
+
* const result = await client.mcpClients.callTool(1, "aws___search_documentation", { search_phrase: "S3" });
|
|
8
|
+
* console.log(result.content);
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
import type { RequestOptions } from "../core/http.ts";
|
|
12
|
+
import type { JsonValue, SmarterId } from "../core/typing.ts";
|
|
13
|
+
import { MCPClient, MCPClientStatus, MCPClientTools, MCPToolResult } from "../models/mcpclient.ts";
|
|
14
|
+
import { SmarterKindResource } from "./base.ts";
|
|
15
|
+
/** MCPClients: `/api/v1/mcpclients/`, and the manifest api's `MCPClient` kind. */
|
|
16
|
+
export declare class MCPClients extends SmarterKindResource<typeof MCPClient> {
|
|
17
|
+
readonly kind = "MCPClient";
|
|
18
|
+
readonly path = "mcpclients/";
|
|
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
|
+
transport: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
43
|
+
endpointUrl: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
44
|
+
command: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
45
|
+
timeout: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
|
|
46
|
+
authType: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
47
|
+
allowedTools: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
48
|
+
allowedResources: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
49
|
+
includeInstructions: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
50
|
+
cacheTtl: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
|
|
51
|
+
isActive: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
52
|
+
status: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
53
|
+
priority: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
|
|
54
|
+
protocolVersion: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
55
|
+
serverName: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
56
|
+
serverVersion: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
57
|
+
tools: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
58
|
+
lastConnectedAt: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
59
|
+
lastError: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
60
|
+
}, import("zod/v4/core").$loose>;
|
|
61
|
+
/**
|
|
62
|
+
* The tools that an MCPClient allows the LLM to call, from the server's cached catalog.
|
|
63
|
+
*
|
|
64
|
+
* @param id - The MCPClient's id or hashed id.
|
|
65
|
+
* @param options - `refresh`: true to read the catalog from the server now.
|
|
66
|
+
* @returns The connection's state, the server's instructions, and the tools.
|
|
67
|
+
*/
|
|
68
|
+
tools(id: SmarterId, options?: RequestOptions & {
|
|
69
|
+
refresh?: boolean;
|
|
70
|
+
}): Promise<MCPClientTools>;
|
|
71
|
+
/**
|
|
72
|
+
* Reconnect to an MCPClient's server, and reload its catalog. Only the owner may refresh.
|
|
73
|
+
*
|
|
74
|
+
* @param id - The MCPClient's id or hashed id.
|
|
75
|
+
* @param options - Per-request options.
|
|
76
|
+
* @returns The connection's state.
|
|
77
|
+
*/
|
|
78
|
+
refresh(id: SmarterId, options?: RequestOptions): Promise<MCPClientStatus>;
|
|
79
|
+
/**
|
|
80
|
+
* Call one of an MCPClient's tools. Only the owner may call tools.
|
|
81
|
+
*
|
|
82
|
+
* @param id - The MCPClient's id or hashed id.
|
|
83
|
+
* @param tool - The tool's name.
|
|
84
|
+
* @param args - The tool's arguments, as its input schema describes them.
|
|
85
|
+
* @param options - Per-request options.
|
|
86
|
+
* @returns The tool's result. Check `isError`: a tool reports its own failures in its result.
|
|
87
|
+
*/
|
|
88
|
+
callTool(id: SmarterId, tool: string, args?: Record<string, JsonValue>, options?: RequestOptions): Promise<MCPToolResult>;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=mcpclients.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcpclients.d.ts","sourceRoot":"","sources":["../../src/resources/mcpclients.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACnG,OAAO,EAAc,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAE5D,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;;;;;;OAMG;IACG,KAAK,CAAC,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,cAAc,CAAC;IAOrG;;;;;;OAMG;IACG,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IAIhF;;;;;;;;OAQG;IACG,QAAQ,CACZ,EAAE,EAAE,SAAS,EACb,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAM,EACpC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,aAAa,CAAC;CAM1B"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCPClients: the platform's connections to Model Context Protocol servers.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* const tools = await client.mcpClients.tools(1);
|
|
7
|
+
* const result = await client.mcpClients.callTool(1, "aws___search_documentation", { search_phrase: "S3" });
|
|
8
|
+
* console.log(result.content);
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
import { MCPClient, MCPClientStatus, MCPClientTools, MCPToolResult } from "../models/mcpclient.js";
|
|
12
|
+
import { resourceId, SmarterKindResource } from "./base.js";
|
|
13
|
+
/** MCPClients: `/api/v1/mcpclients/`, and the manifest api's `MCPClient` kind. */
|
|
14
|
+
export class MCPClients extends SmarterKindResource {
|
|
15
|
+
kind = "MCPClient";
|
|
16
|
+
path = "mcpclients/";
|
|
17
|
+
model = MCPClient;
|
|
18
|
+
/**
|
|
19
|
+
* The tools that an MCPClient allows the LLM to call, from the server's cached catalog.
|
|
20
|
+
*
|
|
21
|
+
* @param id - The MCPClient's id or hashed id.
|
|
22
|
+
* @param options - `refresh`: true to read the catalog from the server now.
|
|
23
|
+
* @returns The connection's state, the server's instructions, and the tools.
|
|
24
|
+
*/
|
|
25
|
+
async tools(id, options) {
|
|
26
|
+
return this.http.request("GET", `${this.path}${resourceId(id)}/tools/`, MCPClientTools, {
|
|
27
|
+
...options,
|
|
28
|
+
params: { refresh: options?.refresh ? true : undefined },
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Reconnect to an MCPClient's server, and reload its catalog. Only the owner may refresh.
|
|
33
|
+
*
|
|
34
|
+
* @param id - The MCPClient's id or hashed id.
|
|
35
|
+
* @param options - Per-request options.
|
|
36
|
+
* @returns The connection's state.
|
|
37
|
+
*/
|
|
38
|
+
async refresh(id, options) {
|
|
39
|
+
return this.http.request("POST", `${this.path}${resourceId(id)}/refresh/`, MCPClientStatus, options);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Call one of an MCPClient's tools. Only the owner may call tools.
|
|
43
|
+
*
|
|
44
|
+
* @param id - The MCPClient's id or hashed id.
|
|
45
|
+
* @param tool - The tool's name.
|
|
46
|
+
* @param args - The tool's arguments, as its input schema describes them.
|
|
47
|
+
* @param options - Per-request options.
|
|
48
|
+
* @returns The tool's result. Check `isError`: a tool reports its own failures in its result.
|
|
49
|
+
*/
|
|
50
|
+
async callTool(id, tool, args = {}, options) {
|
|
51
|
+
return this.http.request("POST", `${this.path}${resourceId(id)}/tools/${resourceId(tool)}/`, MCPToolResult, {
|
|
52
|
+
...options,
|
|
53
|
+
json: args,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=mcpclients.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcpclients.js","sourceRoot":"","sources":["../../src/resources/mcpclients.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACnG,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAE5D,kFAAkF;AAClF,MAAM,OAAO,UAAW,SAAQ,mBAAqC;IAC1D,IAAI,GAAG,WAAW,CAAC;IACnB,IAAI,GAAG,aAAa,CAAC;IACrB,KAAK,GAAG,SAAS,CAAC;IAE3B;;;;;;OAMG;IACH,KAAK,CAAC,KAAK,CAAC,EAAa,EAAE,OAAgD;QACzE,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,cAAc,EAAE;YACtF,GAAG,OAAO;YACV,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE;SACzD,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,OAAO,CAAC,EAAa,EAAE,OAAwB;QACnD,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,EAAE,CAAC,WAAW,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;IACvG,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,QAAQ,CACZ,EAAa,EACb,IAAY,EACZ,OAAkC,EAAE,EACpC,OAAwB;QAExB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,EAAE,CAAC,UAAU,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,aAAa,EAAE;YAC1G,GAAG,OAAO;YACV,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** LLM providers and their models: `/api/v1/providers/`. */
|
|
2
|
+
import type { RequestOptions } from "../core/http.ts";
|
|
3
|
+
import { Provider, ProviderModel } from "../models/misc.ts";
|
|
4
|
+
import { SmarterAPIResource } from "./base.ts";
|
|
5
|
+
/** The LLM providers that the platform is configured for, e.g. openai or anthropic. */
|
|
6
|
+
export declare class Providers extends SmarterAPIResource {
|
|
7
|
+
/** The providers' endpoint. */
|
|
8
|
+
readonly path = "providers/";
|
|
9
|
+
/**
|
|
10
|
+
* The providers.
|
|
11
|
+
*
|
|
12
|
+
* @param options - Per-request options.
|
|
13
|
+
* @returns The providers.
|
|
14
|
+
*/
|
|
15
|
+
list(options?: RequestOptions): Promise<Provider[]>;
|
|
16
|
+
/**
|
|
17
|
+
* A provider, by name.
|
|
18
|
+
*
|
|
19
|
+
* @param name - The provider's name, e.g. `openai`.
|
|
20
|
+
* @param options - Per-request options.
|
|
21
|
+
* @returns The provider.
|
|
22
|
+
*/
|
|
23
|
+
retrieve(name: string, options?: RequestOptions): Promise<Provider>;
|
|
24
|
+
/**
|
|
25
|
+
* A provider's models.
|
|
26
|
+
*
|
|
27
|
+
* @param name - The provider's name.
|
|
28
|
+
* @param options - Per-request options.
|
|
29
|
+
* @returns The models.
|
|
30
|
+
*/
|
|
31
|
+
models(name: string, options?: RequestOptions): Promise<ProviderModel[]>;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=providers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/resources/providers.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAI5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAc,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE3D,uFAAuF;AACvF,qBAAa,SAAU,SAAQ,kBAAkB;IAC/C,+BAA+B;IAC/B,QAAQ,CAAC,IAAI,gBAAgB;IAE7B;;;;;OAKG;IACG,IAAI,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAIzD;;;;;;OAMG;IACG,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;IAIzE;;;;;;OAMG;IACG,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;CAG/E"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** LLM providers and their models: `/api/v1/providers/`. */
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { Provider, ProviderModel } from "../models/misc.js";
|
|
4
|
+
import { resourceId, SmarterAPIResource } from "./base.js";
|
|
5
|
+
/** The LLM providers that the platform is configured for, e.g. openai or anthropic. */
|
|
6
|
+
export class Providers extends SmarterAPIResource {
|
|
7
|
+
/** The providers' endpoint. */
|
|
8
|
+
path = "providers/";
|
|
9
|
+
/**
|
|
10
|
+
* The providers.
|
|
11
|
+
*
|
|
12
|
+
* @param options - Per-request options.
|
|
13
|
+
* @returns The providers.
|
|
14
|
+
*/
|
|
15
|
+
async list(options) {
|
|
16
|
+
return this.http.request("GET", this.path, z.array(Provider), options);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A provider, by name.
|
|
20
|
+
*
|
|
21
|
+
* @param name - The provider's name, e.g. `openai`.
|
|
22
|
+
* @param options - Per-request options.
|
|
23
|
+
* @returns The provider.
|
|
24
|
+
*/
|
|
25
|
+
async retrieve(name, options) {
|
|
26
|
+
return this.http.request("GET", `${this.path}${resourceId(name)}/`, Provider, options);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A provider's models.
|
|
30
|
+
*
|
|
31
|
+
* @param name - The provider's name.
|
|
32
|
+
* @param options - Per-request options.
|
|
33
|
+
* @returns The models.
|
|
34
|
+
*/
|
|
35
|
+
async models(name, options) {
|
|
36
|
+
return this.http.request("GET", `${this.path}${resourceId(name)}/models/`, z.array(ProviderModel), options);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=providers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.js","sourceRoot":"","sources":["../../src/resources/providers.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAE5D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE3D,uFAAuF;AACvF,MAAM,OAAO,SAAU,SAAQ,kBAAkB;IAC/C,+BAA+B;IACtB,IAAI,GAAG,YAAY,CAAC;IAE7B;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CAAC,OAAwB;QACjC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,QAAQ,CAAC,IAAY,EAAE,OAAwB;QACnD,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACzF,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,CAAC,IAAY,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC,CAAC;IAC9G,CAAC;CACF"}
|