@ryan_nookpi/pi-extension-generative-ui 0.2.2 → 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.
Files changed (2) hide show
  1. package/index.ts +9 -15
  2. 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.Union(
191
- [
192
- Type.Literal("art"),
193
- Type.Literal("mockup"),
194
- Type.Literal("interactive"),
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 content = getGuidelines(params.modules);
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: params.modules },
203
+ details: { modules },
210
204
  };
211
205
  },
212
206
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryan_nookpi/pi-extension-generative-ui",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Generative UI widget extension for pi.",
5
5
  "license": "MIT",
6
6
  "repository": {