@ryan_nookpi/pi-extension-generative-ui 0.2.1 → 0.2.3
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/index.ts +9 -15
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { ExtensionAPI, ThemeColor } from "@earendil-works/pi-coding-agent";
|
|
|
4
4
|
import { DynamicBorder } from "@earendil-works/pi-coding-agent";
|
|
5
5
|
import { Key, matchesKey, Text, truncateToWidth } from "@earendil-works/pi-tui";
|
|
6
6
|
import { Type } from "@sinclair/typebox";
|
|
7
|
-
import { getGuidelines } from "./guidelines.js";
|
|
7
|
+
import { AVAILABLE_MODULES, getGuidelines } from "./guidelines.js";
|
|
8
8
|
import { escapeJS, shellHTML, wrapHTML } from "./html-utils.js";
|
|
9
9
|
|
|
10
10
|
interface WidgetHistoryEntry {
|
|
@@ -187,26 +187,20 @@ export default function (pi: ExtensionAPI) {
|
|
|
187
187
|
],
|
|
188
188
|
parameters: Type.Object({
|
|
189
189
|
modules: Type.Array(
|
|
190
|
-
Type.
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
Type.Literal("chart"),
|
|
196
|
-
Type.Literal("diagram"),
|
|
197
|
-
],
|
|
198
|
-
{
|
|
199
|
-
description: "Which module(s) to load. Pick all that fit.",
|
|
200
|
-
},
|
|
201
|
-
),
|
|
190
|
+
Type.Unsafe<string>({
|
|
191
|
+
type: "string",
|
|
192
|
+
enum: AVAILABLE_MODULES,
|
|
193
|
+
description: "Which module(s) to load. Pick all that fit.",
|
|
194
|
+
}),
|
|
202
195
|
),
|
|
203
196
|
}),
|
|
204
197
|
|
|
205
198
|
async execute(_toolCallId, params) {
|
|
206
|
-
const
|
|
199
|
+
const modules = params.modules.filter((module): module is string => typeof module === "string");
|
|
200
|
+
const content = getGuidelines(modules);
|
|
207
201
|
return {
|
|
208
202
|
content: [{ type: "text" as const, text: content }],
|
|
209
|
-
details: { modules
|
|
203
|
+
details: { modules },
|
|
210
204
|
};
|
|
211
205
|
},
|
|
212
206
|
|