sst 3.9.39 → 3.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
1
  import { ZodSchema, z } from "zod";
2
2
  export declare function ZodValidator<Schema extends ZodSchema>(schema: Schema): (input: z.input<Schema>) => z.output<Schema>;
3
- import { BaseSchema, Input } from "valibot";
4
- export declare function ValibotValidator<T extends BaseSchema>(schema: T): (value: Input<T>) => import("valibot").Output<T>;
3
+ import { BaseSchema, InferInput } from "valibot";
4
+ export declare function ValibotValidator<T extends BaseSchema<any, any, any>>(schema: T): (value: InferInput<T>) => import("valibot").InferOutput<T>;
@@ -1,20 +1,47 @@
1
+ import { z } from "zod";
1
2
  /**
2
- * A list of OpenControl tools provided by SST. Currently, it includes tools that can
3
+ * A list of OpenControl tools provided by SST. Currently, it includes tools that
4
+ * can:
5
+ *
3
6
  * - Lists the resources in your SST app.
4
7
  * - Access the resources in your AWS account.
5
8
  *
6
- * You can add this tool to your OpenControl app by passing it to the `tools` option when
7
- * creating an OpenControl app.
9
+ * You can add this tool to your OpenControl server by passing it to the `tools`
10
+ * option when creating it.
8
11
  *
9
12
  * @example
10
- * ```js title="src/app.ts"
13
+ * ```js title="src/server.ts"
11
14
  * import { create } from "opencontrol";
12
15
  * import { tools } from "sst/opencontrol";
13
16
  *
14
17
  * const app = create({
15
- * key: process.env.OPENCONTROL_KEY,
16
- * tools: [...tools],
18
+ * model: // ...
19
+ * tools: [...tools]
17
20
  * });
18
21
  * ```
19
22
  */
20
- export declare const tools: import("opencontrol/tool").Tool<any>[];
23
+ export declare const tools: (import("opencontrol/tool").Tool<z.ZodObject<{
24
+ client: z.ZodString;
25
+ command: z.ZodString;
26
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
27
+ }, "strip", z.ZodTypeAny, {
28
+ client: string;
29
+ command: string;
30
+ args?: Record<string, any> | undefined;
31
+ }, {
32
+ client: string;
33
+ command: string;
34
+ args?: Record<string, any> | undefined;
35
+ }>> | import("opencontrol/tool").Tool<z.ZodObject<{
36
+ client: z.ZodString;
37
+ command: z.ZodString;
38
+ args: z.ZodArray<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>, "many">;
39
+ }, "strip", z.ZodTypeAny, {
40
+ client: string;
41
+ command: string;
42
+ args: (Record<string, any> | undefined)[];
43
+ }, {
44
+ client: string;
45
+ command: string;
46
+ args: (Record<string, any> | undefined)[];
47
+ }>>)[];
@@ -1,75 +1,94 @@
1
1
  import { tool } from "opencontrol/tool";
2
- import { client } from "./aws/client.js";
3
- import { Resource } from "./resource.js";
4
2
  import { z } from "zod";
5
3
  import AWS from "aws-sdk";
6
4
  /**
7
- * A list of OpenControl tools provided by SST. Currently, it includes tools that can
5
+ * A list of OpenControl tools provided by SST. Currently, it includes tools that
6
+ * can:
7
+ *
8
8
  * - Lists the resources in your SST app.
9
9
  * - Access the resources in your AWS account.
10
10
  *
11
- * You can add this tool to your OpenControl app by passing it to the `tools` option when
12
- * creating an OpenControl app.
11
+ * You can add this tool to your OpenControl server by passing it to the `tools`
12
+ * option when creating it.
13
13
  *
14
14
  * @example
15
- * ```js title="src/app.ts"
15
+ * ```js title="src/server.ts"
16
16
  * import { create } from "opencontrol";
17
17
  * import { tools } from "sst/opencontrol";
18
18
  *
19
19
  * const app = create({
20
- * key: process.env.OPENCONTROL_KEY,
21
- * tools: [...tools],
20
+ * model: // ...
21
+ * tools: [...tools]
22
22
  * });
23
23
  * ```
24
24
  */
25
25
  export const tools = [
26
+ /*
26
27
  tool({
27
- name: "sst",
28
- description: "Get the resources in the current SST app",
29
- async run() {
30
- const c = await client();
31
- const stateBucket = await getStateBucket();
32
- if (!stateBucket)
33
- throw new Error("Failed to find the SST state bucket in user's AWS account. Ask the user to make sure the AWS account has been bootstrapped with SST.");
34
- const state = await getStateFile();
35
- if (!state)
36
- throw new Error("Failed to find the SST state file in user's AWS account.");
37
- const resources = state["checkpoint"]["latest"]["resources"];
38
- return resources
39
- .filter((r) => r.type !== "sst:sst:LinkRef" &&
40
- !r.type.startsWith("pulumi:provider:"))
41
- .map((r) => ({
42
- urn: r.urn,
43
- type: r.type,
44
- id: r.id,
45
- parent: r.parent,
46
- }));
47
- async function getStateBucket() {
48
- const res = await c.fetch(`https://ssm.${c.region}.amazonaws.com/`, {
49
- method: "POST",
50
- headers: {
51
- "X-Amz-Target": "AmazonSSM.GetParameter",
52
- "Content-Type": "application/x-amz-json-1.1",
53
- },
54
- body: JSON.stringify({
55
- Name: "/sst/bootstrap",
56
- }),
57
- });
58
- if (!res.ok)
59
- return;
60
- const data = (await res.json());
61
- return JSON.parse(data.Parameter.Value)["state"];
62
- }
63
- async function getStateFile() {
64
- const res = await c.fetch(`https://${stateBucket}.s3.${c.region}.amazonaws.com/app/${Resource.App.name}/${Resource.App.stage}.json`, {
65
- method: "GET",
66
- });
67
- if (!res.ok)
68
- return;
69
- return (await res.json());
28
+ name: "sst",
29
+ description: "Get the resources in the current SST app",
30
+ async run() {
31
+ const c = await client();
32
+ const stateBucket = await getStateBucket();
33
+ if (!stateBucket)
34
+ throw new Error(
35
+ "Failed to find the SST state bucket in user's AWS account. Ask the user to make sure the AWS account has been bootstrapped with SST."
36
+ );
37
+
38
+ const state = await getStateFile();
39
+ if (!state)
40
+ throw new Error(
41
+ "Failed to find the SST state file in user's AWS account."
42
+ );
43
+
44
+ const resources = state["checkpoint"]["latest"]["resources"];
45
+ return resources
46
+ .filter(
47
+ (r: any) =>
48
+ r.type !== "sst:sst:LinkRef" &&
49
+ !r.type.startsWith("pulumi:provider:")
50
+ )
51
+ .map((r: any) => ({
52
+ urn: r.urn,
53
+ type: r.type,
54
+ id: r.id,
55
+ parent: r.parent,
56
+ }));
57
+
58
+ async function getStateBucket() {
59
+ const res = await c.fetch(`https://ssm.${c.region}.amazonaws.com/`, {
60
+ method: "POST",
61
+ headers: {
62
+ "X-Amz-Target": "AmazonSSM.GetParameter",
63
+ "Content-Type": "application/x-amz-json-1.1",
64
+ },
65
+ body: JSON.stringify({
66
+ Name: "/sst/bootstrap",
67
+ }),
68
+ });
69
+ if (!res.ok) return;
70
+
71
+ const data = (await res.json()) as {
72
+ Parameter: {
73
+ Value: string;
74
+ };
75
+ };
76
+ return JSON.parse(data.Parameter.Value)["state"];
77
+ }
78
+
79
+ async function getStateFile() {
80
+ const res = await c.fetch(
81
+ `https://${stateBucket}.s3.${c.region}.amazonaws.com/app/${Resource.App.name}/${Resource.App.stage}.json`,
82
+ {
83
+ method: "GET",
70
84
  }
71
- },
85
+ );
86
+ if (!res.ok) return;
87
+ return (await res.json()) as any;
88
+ }
89
+ },
72
90
  }),
91
+ */
73
92
  tool({
74
93
  name: "aws",
75
94
  description: "Make a call to the AWS SDK for JavaScript v2",
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "name": "sst",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
- "version": "3.9.39",
6
+ "version": "3.10.0",
7
7
  "main": "./dist/index.js",
8
8
  "repository": {
9
9
  "type": "git",
@@ -30,7 +30,7 @@
30
30
  "@types/node": "22.10.0",
31
31
  "hono": "4.3.9",
32
32
  "typescript": "5.7.2",
33
- "valibot": "0.30.0",
33
+ "valibot": "^1.0.0-rc.3",
34
34
  "zod": "^3.24.2"
35
35
  },
36
36
  "files": [
@@ -41,11 +41,11 @@
41
41
  "sst": "./bin/sst.mjs"
42
42
  },
43
43
  "optionalDependencies": {
44
- "sst-linux-x64": "3.9.39",
45
- "sst-linux-x86": "3.9.39",
46
- "sst-linux-arm64": "3.9.39",
47
- "sst-darwin-x64": "3.9.39",
48
- "sst-darwin-arm64": "3.9.39"
44
+ "sst-linux-x64": "3.10.0",
45
+ "sst-linux-x86": "3.10.0",
46
+ "sst-darwin-x64": "3.10.0",
47
+ "sst-linux-arm64": "3.10.0",
48
+ "sst-darwin-arm64": "3.10.0"
49
49
  },
50
50
  "dependencies": {
51
51
  "aws-sdk": "2.1692.0",