@w6w/sdk 0.9.16 → 0.9.23
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/README.md +1 -1
- package/dist/mod.d.ts +11 -0
- package/dist/mod.d.ts.map +1 -1
- package/dist/mod.js +6 -0
- package/dist/mod.js.map +1 -1
- package/dist/src/agents.d.ts +33 -0
- package/dist/src/agents.d.ts.map +1 -0
- package/dist/src/agents.js +73 -0
- package/dist/src/agents.js.map +1 -0
- package/dist/src/assets.d.ts +56 -0
- package/dist/src/assets.d.ts.map +1 -0
- package/dist/src/assets.js +143 -0
- package/dist/src/assets.js.map +1 -0
- package/dist/src/client.d.ts +21 -0
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/client.js +29 -0
- package/dist/src/client.js.map +1 -1
- package/dist/src/connections.d.ts +8 -3
- package/dist/src/connections.d.ts.map +1 -1
- package/dist/src/connections.js +6 -2
- package/dist/src/connections.js.map +1 -1
- package/dist/src/console/apps.d.ts +13 -0
- package/dist/src/console/apps.d.ts.map +1 -1
- package/dist/src/console/apps.js +3 -0
- package/dist/src/console/apps.js.map +1 -1
- package/dist/src/console/connections.d.ts +71 -11
- package/dist/src/console/connections.d.ts.map +1 -1
- package/dist/src/console/connections.js +27 -6
- package/dist/src/console/connections.js.map +1 -1
- package/dist/src/console/credentials.d.ts +183 -0
- package/dist/src/console/credentials.d.ts.map +1 -0
- package/dist/src/console/credentials.js +186 -0
- package/dist/src/console/credentials.js.map +1 -0
- package/dist/src/console/mod.d.ts +17 -2
- package/dist/src/console/mod.d.ts.map +1 -1
- package/dist/src/console/mod.js +15 -0
- package/dist/src/console/mod.js.map +1 -1
- package/dist/src/console/models.d.ts +208 -0
- package/dist/src/console/models.d.ts.map +1 -0
- package/dist/src/console/models.js +186 -0
- package/dist/src/console/models.js.map +1 -0
- package/dist/src/console/storage.d.ts +221 -0
- package/dist/src/console/storage.d.ts.map +1 -0
- package/dist/src/console/storage.js +198 -0
- package/dist/src/console/storage.js.map +1 -0
- package/dist/src/console/tokens.d.ts +53 -3
- package/dist/src/console/tokens.d.ts.map +1 -1
- package/dist/src/console/tokens.js +35 -4
- package/dist/src/console/tokens.js.map +1 -1
- package/dist/src/console/vault.d.ts +2 -2
- package/dist/src/console/vault.d.ts.map +1 -1
- package/dist/src/console/vault.js +1 -1
- package/dist/src/context.d.ts +68 -0
- package/dist/src/context.d.ts.map +1 -0
- package/dist/src/context.js +195 -0
- package/dist/src/context.js.map +1 -0
- package/dist/src/http.d.ts +19 -1
- package/dist/src/http.d.ts.map +1 -1
- package/dist/src/http.js +21 -3
- package/dist/src/http.js.map +1 -1
- package/dist/src/models.d.ts +141 -0
- package/dist/src/models.d.ts.map +1 -0
- package/dist/src/models.js +128 -0
- package/dist/src/models.js.map +1 -0
- package/dist/src/skills.d.ts +29 -0
- package/dist/src/skills.d.ts.map +1 -0
- package/dist/src/skills.js +55 -0
- package/dist/src/skills.js.map +1 -0
- package/dist/src/types.d.ts +415 -8
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +1 -1
- package/dist/src/types.js.map +1 -1
- package/dist/src/vars.d.ts +2 -2
- package/dist/src/vars.d.ts.map +1 -1
- package/dist/src/vars.js +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/workflows.d.ts +6 -6
- package/dist/src/workflows.d.ts.map +1 -1
- package/dist/src/workflows.js +7 -5
- package/dist/src/workflows.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `client.models.*`, `client.modelRoutes.*` and `client.modelUsage.*` — the model
|
|
3
|
+
* registry: the catalog, named routes, and the completion gateway.
|
|
4
|
+
*
|
|
5
|
+
* Six operations, one HTTP call each (`endpoints.json`). The rest of the model surface (catalog edits, rates,
|
|
6
|
+
* budgets, route writes) lives in the unstable `client.console.models` group.
|
|
7
|
+
*
|
|
8
|
+
* **`modelRoutes.complete` returns the flat gateway envelope as-is** —
|
|
9
|
+
* `invocationId`, `status` and `key` included — and never unwraps it to
|
|
10
|
+
* `output` (DC-5/G-W4). Routes and usage are project-scoped: `?project=` is
|
|
11
|
+
* resolved per call, then from the client default.
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
import type { ResolvedConfig } from "./config.ts";
|
|
16
|
+
import { type CallOptions, type HttpResponse, type RequestOptions } from "./http.ts";
|
|
17
|
+
/** The slice of `W6WClient` these namespaces need. */
|
|
18
|
+
export interface ModelsHost {
|
|
19
|
+
/** The resolved configuration; only `project` is read. */
|
|
20
|
+
readonly config: ResolvedConfig;
|
|
21
|
+
/** Perform one request. */
|
|
22
|
+
request<T>(options: RequestOptions): Promise<HttpResponse<T>>;
|
|
23
|
+
}
|
|
24
|
+
/** The wire dialect a completion is spoken in. */
|
|
25
|
+
export type ModelDialect = "bridge" | "openai" | "anthropic" | "ollama";
|
|
26
|
+
/** How much of the gateway response a completion returns. */
|
|
27
|
+
export type ModelResponseMode = "both" | "output" | "raw";
|
|
28
|
+
/** One catalog entry. Fields beyond `id` are server-defined and may grow. */
|
|
29
|
+
export interface Model {
|
|
30
|
+
id: string;
|
|
31
|
+
provider?: string;
|
|
32
|
+
status?: string;
|
|
33
|
+
[field: string]: unknown;
|
|
34
|
+
}
|
|
35
|
+
/** One named model route. */
|
|
36
|
+
export interface ModelRoute {
|
|
37
|
+
name: string;
|
|
38
|
+
[field: string]: unknown;
|
|
39
|
+
}
|
|
40
|
+
/** A keyset-paged catalog page. */
|
|
41
|
+
export interface ModelPage {
|
|
42
|
+
models: Model[];
|
|
43
|
+
nextCursor: string | null;
|
|
44
|
+
}
|
|
45
|
+
/** Where a `usageSummary`'s counts came from. */
|
|
46
|
+
export type ModelUsageSource = "reported" | "partial" | "estimated" | "unknown" | "legacy";
|
|
47
|
+
/** Provider-neutral token counts; each is `null` when the provider did not report it. */
|
|
48
|
+
export interface ModelUsageSummary {
|
|
49
|
+
inclusiveInputTokens: number | null;
|
|
50
|
+
freshInputTokens: number | null;
|
|
51
|
+
cacheReadTokens: number | null;
|
|
52
|
+
cacheWriteTokens: number | null;
|
|
53
|
+
outputTokens: number | null;
|
|
54
|
+
reasoningTokens: number | null;
|
|
55
|
+
totalTokens: number | null;
|
|
56
|
+
source: ModelUsageSource;
|
|
57
|
+
}
|
|
58
|
+
/** The flat completion envelope, returned without unwrapping. */
|
|
59
|
+
export interface ModelCompletion {
|
|
60
|
+
invocationId: string;
|
|
61
|
+
status: string;
|
|
62
|
+
contractVersion?: 1;
|
|
63
|
+
/** The requested route name; `null` on the direct-model path. */
|
|
64
|
+
route?: string | null;
|
|
65
|
+
key?: string;
|
|
66
|
+
usageSummary?: ModelUsageSummary;
|
|
67
|
+
meta?: {
|
|
68
|
+
usageRecorded?: boolean;
|
|
69
|
+
[field: string]: unknown;
|
|
70
|
+
};
|
|
71
|
+
output?: unknown;
|
|
72
|
+
raw?: unknown;
|
|
73
|
+
[field: string]: unknown;
|
|
74
|
+
}
|
|
75
|
+
/** The result of `modelUsage.query`. */
|
|
76
|
+
export interface ModelUsageReport {
|
|
77
|
+
totals: Record<string, unknown>;
|
|
78
|
+
/**
|
|
79
|
+
* `true` when the server stopped folding the ledger at its aggregate row cap,
|
|
80
|
+
* so `totals` and `groups` cover only part of the filtered window.
|
|
81
|
+
*/
|
|
82
|
+
totalsTruncated: boolean;
|
|
83
|
+
groups?: Record<string, unknown>[];
|
|
84
|
+
items: Record<string, unknown>[];
|
|
85
|
+
nextCursor: string | null;
|
|
86
|
+
}
|
|
87
|
+
/** `models.list` options. */
|
|
88
|
+
export interface ModelListOptions extends CallOptions {
|
|
89
|
+
provider?: string;
|
|
90
|
+
status?: string;
|
|
91
|
+
limit?: number;
|
|
92
|
+
cursor?: string;
|
|
93
|
+
}
|
|
94
|
+
/** Project-scoped call options. */
|
|
95
|
+
export interface ModelRouteOptions extends CallOptions {
|
|
96
|
+
/** Project id to scope this call to. */
|
|
97
|
+
project?: string;
|
|
98
|
+
}
|
|
99
|
+
/** `modelRoutes.complete` options. */
|
|
100
|
+
export interface ModelCompleteOptions extends ModelRouteOptions {
|
|
101
|
+
dialect?: ModelDialect;
|
|
102
|
+
response?: ModelResponseMode;
|
|
103
|
+
}
|
|
104
|
+
/** `modelUsage.query` options. */
|
|
105
|
+
export interface ModelUsageOptions extends ModelRouteOptions {
|
|
106
|
+
groupBy?: "route" | "model" | "day";
|
|
107
|
+
from?: string;
|
|
108
|
+
to?: string;
|
|
109
|
+
route?: string;
|
|
110
|
+
model?: string;
|
|
111
|
+
limit?: number;
|
|
112
|
+
cursor?: string;
|
|
113
|
+
}
|
|
114
|
+
/** `client.models` — the catalog. */
|
|
115
|
+
export declare class ModelsApi {
|
|
116
|
+
#private;
|
|
117
|
+
constructor(host: ModelsHost);
|
|
118
|
+
/** List the catalog; returns the whole page `{models, nextCursor}`. */
|
|
119
|
+
list(options?: ModelListOptions): Promise<ModelPage>;
|
|
120
|
+
/** Read one catalog entry by its catalog id (`mdl_…`), not a provider-native model id. */
|
|
121
|
+
get(id: string, options?: CallOptions): Promise<Model>;
|
|
122
|
+
}
|
|
123
|
+
/** `client.modelRoutes` — named routes and the completion gateway. */
|
|
124
|
+
export declare class ModelRoutesApi {
|
|
125
|
+
#private;
|
|
126
|
+
constructor(host: ModelsHost);
|
|
127
|
+
/** List the project's routes. */
|
|
128
|
+
list(options?: ModelRouteOptions): Promise<ModelRoute[]>;
|
|
129
|
+
/** Read one route by name. */
|
|
130
|
+
get(name: string, options?: ModelRouteOptions): Promise<ModelRoute>;
|
|
131
|
+
/** POST `input` to `/model-routes/{name}/complete`; the flat envelope, not unwrapped. */
|
|
132
|
+
complete(name: string, input: Record<string, unknown>, options?: ModelCompleteOptions): Promise<ModelCompletion>;
|
|
133
|
+
}
|
|
134
|
+
/** `client.modelUsage` — recorded usage. */
|
|
135
|
+
export declare class ModelUsageApi {
|
|
136
|
+
#private;
|
|
137
|
+
constructor(host: ModelsHost);
|
|
138
|
+
/** Query usage; returns `{totals, groups?, items, nextCursor}` as sent. */
|
|
139
|
+
query(options?: ModelUsageOptions): Promise<ModelUsageReport>;
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAQ,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3F,sDAAsD;AACtD,MAAM,WAAW,UAAU;IACzB,0DAA0D;IAC1D,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,2BAA2B;IAC3B,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;CAC/D;AAED,kDAAkD;AAClD,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,QAAQ,CAAC;AACxE,6DAA6D;AAC7D,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE1D,6EAA6E;AAC7E,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAED,6BAA6B;AAC7B,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAED,mCAAmC;AACnC,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B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IAQ5B,iCAAiC;IAC3B,IAAI,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAU9D,8BAA8B;IACxB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC;IAUzE,yFAAyF;IACnF,QAAQ,CACZ,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,eAAe,CAAC;CAc5B;AAED,4CAA4C;AAC5C,qBAAa,aAAa;;gBAGZ,IAAI,EAAE,UAAU;IAI5B,2EAA2E;IACrE,KAAK,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAkBpE"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `client.models.*`, `client.modelRoutes.*` and `client.modelUsage.*` — the model
|
|
3
|
+
* registry: the catalog, named routes, and the completion gateway.
|
|
4
|
+
*
|
|
5
|
+
* Six operations, one HTTP call each (`endpoints.json`). The rest of the model surface (catalog edits, rates,
|
|
6
|
+
* budgets, route writes) lives in the unstable `client.console.models` group.
|
|
7
|
+
*
|
|
8
|
+
* **`modelRoutes.complete` returns the flat gateway envelope as-is** —
|
|
9
|
+
* `invocationId`, `status` and `key` included — and never unwraps it to
|
|
10
|
+
* `output` (DC-5/G-W4). Routes and usage are project-scoped: `?project=` is
|
|
11
|
+
* resolved per call, then from the client default.
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
import { path } from "./http.js";
|
|
16
|
+
/** Strip a single-key envelope if present, else take the body as sent. */
|
|
17
|
+
function pick(res, key) {
|
|
18
|
+
const b = res.body;
|
|
19
|
+
if (typeof b === "object" && b !== null && !Array.isArray(b)) {
|
|
20
|
+
const v = b[key];
|
|
21
|
+
if (v !== undefined && v !== null)
|
|
22
|
+
return v;
|
|
23
|
+
}
|
|
24
|
+
return b;
|
|
25
|
+
}
|
|
26
|
+
/** `client.models` — the catalog. */
|
|
27
|
+
export class ModelsApi {
|
|
28
|
+
#host;
|
|
29
|
+
constructor(host) {
|
|
30
|
+
this.#host = host;
|
|
31
|
+
}
|
|
32
|
+
/** List the catalog; returns the whole page `{models, nextCursor}`. */
|
|
33
|
+
async list(options) {
|
|
34
|
+
const res = await this.#host.request({
|
|
35
|
+
method: "GET",
|
|
36
|
+
path: "/models",
|
|
37
|
+
query: {
|
|
38
|
+
provider: options?.provider,
|
|
39
|
+
status: options?.status,
|
|
40
|
+
limit: options?.limit,
|
|
41
|
+
cursor: options?.cursor,
|
|
42
|
+
},
|
|
43
|
+
signal: options?.signal,
|
|
44
|
+
});
|
|
45
|
+
return res.body;
|
|
46
|
+
}
|
|
47
|
+
/** Read one catalog entry by its catalog id (`mdl_…`), not a provider-native model id. */
|
|
48
|
+
async get(id, options) {
|
|
49
|
+
const res = await this.#host.request({
|
|
50
|
+
method: "GET",
|
|
51
|
+
path: path `/models/${id}`,
|
|
52
|
+
signal: options?.signal,
|
|
53
|
+
});
|
|
54
|
+
return pick(res, "model");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/** `client.modelRoutes` — named routes and the completion gateway. */
|
|
58
|
+
export class ModelRoutesApi {
|
|
59
|
+
#host;
|
|
60
|
+
constructor(host) {
|
|
61
|
+
this.#host = host;
|
|
62
|
+
}
|
|
63
|
+
#project(options) {
|
|
64
|
+
return options?.project ?? this.#host.config.project ?? undefined;
|
|
65
|
+
}
|
|
66
|
+
/** List the project's routes. */
|
|
67
|
+
async list(options) {
|
|
68
|
+
const res = await this.#host.request({
|
|
69
|
+
method: "GET",
|
|
70
|
+
path: "/model-routes",
|
|
71
|
+
query: { project: this.#project(options) },
|
|
72
|
+
signal: options?.signal,
|
|
73
|
+
});
|
|
74
|
+
return pick(res, "routes");
|
|
75
|
+
}
|
|
76
|
+
/** Read one route by name. */
|
|
77
|
+
async get(name, options) {
|
|
78
|
+
const res = await this.#host.request({
|
|
79
|
+
method: "GET",
|
|
80
|
+
path: path `/model-routes/${name}`,
|
|
81
|
+
query: { project: this.#project(options) },
|
|
82
|
+
signal: options?.signal,
|
|
83
|
+
});
|
|
84
|
+
return pick(res, "route");
|
|
85
|
+
}
|
|
86
|
+
/** POST `input` to `/model-routes/{name}/complete`; the flat envelope, not unwrapped. */
|
|
87
|
+
async complete(name, input, options) {
|
|
88
|
+
const res = await this.#host.request({
|
|
89
|
+
method: "POST",
|
|
90
|
+
path: path `/model-routes/${name}/complete`,
|
|
91
|
+
query: {
|
|
92
|
+
project: this.#project(options),
|
|
93
|
+
dialect: options?.dialect,
|
|
94
|
+
response: options?.response,
|
|
95
|
+
},
|
|
96
|
+
body: input,
|
|
97
|
+
signal: options?.signal,
|
|
98
|
+
});
|
|
99
|
+
return res.body;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/** `client.modelUsage` — recorded usage. */
|
|
103
|
+
export class ModelUsageApi {
|
|
104
|
+
#host;
|
|
105
|
+
constructor(host) {
|
|
106
|
+
this.#host = host;
|
|
107
|
+
}
|
|
108
|
+
/** Query usage; returns `{totals, groups?, items, nextCursor}` as sent. */
|
|
109
|
+
async query(options) {
|
|
110
|
+
const res = await this.#host.request({
|
|
111
|
+
method: "GET",
|
|
112
|
+
path: "/model-usage",
|
|
113
|
+
query: {
|
|
114
|
+
project: options?.project ?? this.#host.config.project ?? undefined,
|
|
115
|
+
groupBy: options?.groupBy,
|
|
116
|
+
from: options?.from,
|
|
117
|
+
to: options?.to,
|
|
118
|
+
route: options?.route,
|
|
119
|
+
model: options?.model,
|
|
120
|
+
limit: options?.limit,
|
|
121
|
+
cursor: options?.cursor,
|
|
122
|
+
},
|
|
123
|
+
signal: options?.signal,
|
|
124
|
+
});
|
|
125
|
+
return res.body;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
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,MAAM,EAAE,OAAO,EAAE,MAAM;aACxB;YACD,MAAM,EAAE,OAAO,EAAE,MAAM;SACxB,CAAC,CAAC;QACH,OAAO,GAAG,CAAC,IAAwB,CAAC;IACtC,CAAC;CACF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `client.skills.*` — read and archive skills (contract 0.11.0).
|
|
3
|
+
*
|
|
4
|
+
* There is no `create`: a skill is uploaded with `assets.uploads` and
|
|
5
|
+
* `purpose: "skill"`.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import { type CallOptions, type HttpResponse, type RequestOptions } from "./http.ts";
|
|
10
|
+
import { type ListPagedOptions, type Skill, type SkillsApi as SkillsApiShape, type SkillVersion } from "./types.ts";
|
|
11
|
+
/** The slice of `W6WClient` this namespace needs: the transport and nothing else. */
|
|
12
|
+
export interface SkillsHost {
|
|
13
|
+
/** Perform one request. */
|
|
14
|
+
request<T>(options: RequestOptions): Promise<HttpResponse<T>>;
|
|
15
|
+
}
|
|
16
|
+
/** `client.skills` — see the module doc. */
|
|
17
|
+
export declare class SkillsApi implements SkillsApiShape {
|
|
18
|
+
#private;
|
|
19
|
+
constructor(host: SkillsHost);
|
|
20
|
+
/** List skills visible to the caller. */
|
|
21
|
+
list(opts?: ListPagedOptions): Promise<Skill[]>;
|
|
22
|
+
/** Fetch one skill. */
|
|
23
|
+
get(id: string, opts?: CallOptions): Promise<Skill>;
|
|
24
|
+
/** List a skill's immutable versions. */
|
|
25
|
+
versions(id: string, opts?: CallOptions): Promise<SkillVersion[]>;
|
|
26
|
+
/** Archive a skill; returns the archived row. */
|
|
27
|
+
archive(id: string, opts?: CallOptions): Promise<Skill>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=skills.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/skills.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAQ,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3F,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,KAAK,EACV,KAAK,SAAS,IAAI,cAAc,EAChC,KAAK,YAAY,EAElB,MAAM,YAAY,CAAC;AAEpB,qFAAqF;AACrF,MAAM,WAAW,UAAU;IACzB,2BAA2B;IAC3B,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;CAC/D;AAED,4CAA4C;AAC5C,qBAAa,SAAU,YAAW,cAAc;;gBAGlC,IAAI,EAAE,UAAU;IAI5B,yCAAyC;IACnC,IAAI,CAAC,IAAI,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAUrD,uBAAuB;IACjB,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC;IASzD,yCAAyC;IACnC,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IASvE,iDAAiD;IAC3C,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC;CAQ9D"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `client.skills.*` — read and archive skills (contract 0.11.0).
|
|
3
|
+
*
|
|
4
|
+
* There is no `create`: a skill is uploaded with `assets.uploads` and
|
|
5
|
+
* `purpose: "skill"`.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import { path } from "./http.js";
|
|
10
|
+
import { unwrap, } from "./types.js";
|
|
11
|
+
/** `client.skills` — see the module doc. */
|
|
12
|
+
export class SkillsApi {
|
|
13
|
+
#host;
|
|
14
|
+
constructor(host) {
|
|
15
|
+
this.#host = host;
|
|
16
|
+
}
|
|
17
|
+
/** List skills visible to the caller. */
|
|
18
|
+
async list(opts) {
|
|
19
|
+
const res = await this.#host.request({
|
|
20
|
+
method: "GET",
|
|
21
|
+
path: "/skills",
|
|
22
|
+
query: { includeArchived: opts?.includeArchived, limit: opts?.limit },
|
|
23
|
+
signal: opts?.signal,
|
|
24
|
+
});
|
|
25
|
+
return unwrap(res, "skills");
|
|
26
|
+
}
|
|
27
|
+
/** Fetch one skill. */
|
|
28
|
+
async get(id, opts) {
|
|
29
|
+
const res = await this.#host.request({
|
|
30
|
+
method: "GET",
|
|
31
|
+
path: path `/skills/${id}`,
|
|
32
|
+
signal: opts?.signal,
|
|
33
|
+
});
|
|
34
|
+
return unwrap(res, "skill");
|
|
35
|
+
}
|
|
36
|
+
/** List a skill's immutable versions. */
|
|
37
|
+
async versions(id, opts) {
|
|
38
|
+
const res = await this.#host.request({
|
|
39
|
+
method: "GET",
|
|
40
|
+
path: path `/skills/${id}/versions`,
|
|
41
|
+
signal: opts?.signal,
|
|
42
|
+
});
|
|
43
|
+
return unwrap(res, "versions");
|
|
44
|
+
}
|
|
45
|
+
/** Archive a skill; returns the archived row. */
|
|
46
|
+
async archive(id, opts) {
|
|
47
|
+
const res = await this.#host.request({
|
|
48
|
+
method: "POST",
|
|
49
|
+
path: path `/skills/${id}/archive`,
|
|
50
|
+
signal: opts?.signal,
|
|
51
|
+
});
|
|
52
|
+
return unwrap(res, "skill");
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=skills.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skills.js","sourceRoot":"","sources":["../../src/skills.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAuC,IAAI,EAAuB,MAAM,WAAW,CAAC;AAC3F,OAAO,EAKL,MAAM,GACP,MAAM,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