sst 3.9.31 → 3.9.32

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,7 +1,10 @@
1
1
  /**
2
- * Creates an OpenControl tool that lists the resources in the current SST app. You can add
3
- * this tool to your OpenControl app by passing it to the `tools` option when creating an
4
- * OpenControl app.
2
+ * A list of OpenControl tools provided by SST. Currently, it includes tools that can
3
+ * - Lists the resources in your SST app.
4
+ * - Access the resources in your AWS account.
5
+ *
6
+ * You can add this tool to your OpenControl app by passing it to the `tools` option when
7
+ * creating an OpenControl app.
5
8
  *
6
9
  * @example
7
10
  * ```js title="src/app.ts"
@@ -1,10 +1,15 @@
1
1
  import { tool } from "opencontrol/tool";
2
2
  import { client } from "./aws/client.js";
3
3
  import { Resource } from "./resource.js";
4
+ import { z } from "zod";
5
+ import AWS from "aws-sdk";
4
6
  /**
5
- * Creates an OpenControl tool that lists the resources in the current SST app. You can add
6
- * this tool to your OpenControl app by passing it to the `tools` option when creating an
7
- * OpenControl app.
7
+ * A list of OpenControl tools provided by SST. Currently, it includes tools that can
8
+ * - Lists the resources in your SST app.
9
+ * - Access the resources in your AWS account.
10
+ *
11
+ * You can add this tool to your OpenControl app by passing it to the `tools` option when
12
+ * creating an OpenControl app.
8
13
  *
9
14
  * @example
10
15
  * ```js title="src/app.ts"
@@ -25,14 +30,10 @@ export const tools = [
25
30
  const c = await client();
26
31
  const stateBucket = await getStateBucket();
27
32
  if (!stateBucket)
28
- return {
29
- 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.",
30
- };
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.");
31
34
  const state = await getStateFile();
32
35
  if (!state)
33
- return {
34
- error: "Failed to find the SST state file in user's AWS account.",
35
- };
36
+ throw new Error("Failed to find the SST state file in user's AWS account.");
36
37
  const resources = state["checkpoint"]["latest"]["resources"];
37
38
  return resources
38
39
  .filter((r) => r.type !== "sst:sst:LinkRef" &&
@@ -69,4 +70,40 @@ export const tools = [
69
70
  }
70
71
  },
71
72
  }),
73
+ tool({
74
+ name: "aws",
75
+ description: "Make a call to the AWS SDK for JavaScript v2",
76
+ args: z.object({
77
+ client: z.string().describe("Class name of the client to use"),
78
+ command: z.string().describe("Command to call on the client"),
79
+ args: z
80
+ .record(z.string(), z.any())
81
+ .optional()
82
+ .describe("Arguments to pass to the command"),
83
+ }),
84
+ async run(input) {
85
+ // @ts-ignore
86
+ const client = new AWS[input.client]();
87
+ return await client[input.command](input.args).promise();
88
+ },
89
+ }),
90
+ tool({
91
+ name: "aws_batch",
92
+ description: "Make multiple calls to the AWS SDK for JavaScript v2 with the same command but different arguments. This tools takes an array of arguments, and will call the command with each argument in the array in parallel. Use this over the aws tool when you need to call the same command multiple times with different arguments.",
93
+ args: z.object({
94
+ client: z.string().describe("Class name of the client to use"),
95
+ command: z.string().describe("Command to call on the client"),
96
+ args: z
97
+ .array(z
98
+ .record(z.string(), z.any())
99
+ .optional()
100
+ .describe("Arguments to pass to the command"))
101
+ .describe("An array of arguments. Each argument will be passed to the command in parallel."),
102
+ }),
103
+ async run(input) {
104
+ // @ts-ignore
105
+ const client = new AWS[input.client]();
106
+ return await Promise.all(input.args.map((arg) => client[input.command](arg).promise()));
107
+ },
108
+ }),
72
109
  ];
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "name": "sst",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
- "version": "3.9.31",
6
+ "version": "3.9.32",
7
7
  "main": "./dist/index.js",
8
8
  "repository": {
9
9
  "type": "git",
@@ -31,7 +31,7 @@
31
31
  "hono": "4.3.9",
32
32
  "typescript": "5.7.2",
33
33
  "valibot": "0.30.0",
34
- "zod": "3.23.8"
34
+ "zod": "^3.24.2"
35
35
  },
36
36
  "files": [
37
37
  "dist",
@@ -41,14 +41,15 @@
41
41
  "sst": "./bin/sst.mjs"
42
42
  },
43
43
  "optionalDependencies": {
44
- "sst-linux-x64": "3.9.31",
45
- "sst-linux-x86": "3.9.31",
46
- "sst-linux-arm64": "3.9.31",
47
- "sst-darwin-x64": "3.9.31",
48
- "sst-darwin-arm64": "3.9.31"
44
+ "sst-linux-x64": "3.9.32",
45
+ "sst-linux-x86": "3.9.32",
46
+ "sst-darwin-x64": "3.9.32",
47
+ "sst-linux-arm64": "3.9.32",
48
+ "sst-darwin-arm64": "3.9.32"
49
49
  },
50
50
  "dependencies": {
51
- "aws4fetch": "^1.0.18",
51
+ "aws-sdk": "2.1692.0",
52
+ "aws4fetch": "1.0.18",
52
53
  "jose": "5.2.3",
53
54
  "opencontrol": "0.0.6",
54
55
  "openid-client": "5.6.4"