@elyracode/anna 0.9.56 → 0.9.58
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/extensions/index.ts +51 -36
- package/package.json +1 -1
package/extensions/index.ts
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import { execSync } from "node:child_process";
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
-
import type { ExtensionAPI } from "@elyracode/coding-agent";
|
|
4
|
+
import type { AgentToolResult, ExtensionAPI } from "@elyracode/coding-agent";
|
|
5
5
|
import { Type } from "typebox";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/** Details reported by preview_presentation. */
|
|
8
|
+
interface PreviewDetails {
|
|
9
|
+
file?: string;
|
|
10
|
+
port?: number;
|
|
11
|
+
}
|
|
8
12
|
|
|
13
|
+
/** Details reported by build_presentation. */
|
|
14
|
+
interface BuildDetails {
|
|
15
|
+
output?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default function (elyra: ExtensionAPI): void {
|
|
9
19
|
// ── Tool: generate_presentation ──
|
|
10
20
|
elyra.registerTool({
|
|
11
21
|
name: "generate_presentation",
|
|
@@ -17,17 +27,17 @@ export default function (elyra: ExtensionAPI): void {
|
|
|
17
27
|
"The presentation can be previewed with `anna serve`.",
|
|
18
28
|
parameters: Type.Object({
|
|
19
29
|
topic: Type.String({
|
|
20
|
-
description:
|
|
30
|
+
description:
|
|
31
|
+
"Topic or description for the presentation (e.g., 'Project architecture overview', 'API onboarding guide')",
|
|
21
32
|
}),
|
|
22
|
-
output: Type.Optional(
|
|
23
|
-
Type.String({ description: "Output file path (default: slides.md)" }),
|
|
24
|
-
),
|
|
33
|
+
output: Type.Optional(Type.String({ description: "Output file path (default: slides.md)" })),
|
|
25
34
|
theme: Type.Optional(
|
|
26
|
-
Type.String({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
35
|
+
Type.String({
|
|
36
|
+
description:
|
|
37
|
+
"Theme: league, moon, night, black, blood, white, beige, sky, serif, simple, solarized (default: moon)",
|
|
38
|
+
}),
|
|
30
39
|
),
|
|
40
|
+
slides: Type.Optional(Type.Number({ description: "Approximate number of slides (default: 10)" })),
|
|
31
41
|
features: Type.Optional(
|
|
32
42
|
Type.Array(Type.String(), {
|
|
33
43
|
description: "Features to include: terminal, playground, mermaid, fragments, components (default: all)",
|
|
@@ -70,7 +80,9 @@ export default function (elyra: ExtensionAPI): void {
|
|
|
70
80
|
instructions.push("8. Include ````mermaid` blocks for architecture/flow diagrams");
|
|
71
81
|
}
|
|
72
82
|
if (features.includes("components")) {
|
|
73
|
-
instructions.push(
|
|
83
|
+
instructions.push(
|
|
84
|
+
"9. Use layout components (`<!-- @columns -->`, `<!-- @stats -->`, `<!-- @timeline -->`) for visual variety",
|
|
85
|
+
);
|
|
74
86
|
}
|
|
75
87
|
|
|
76
88
|
instructions.push(
|
|
@@ -96,21 +108,22 @@ export default function (elyra: ExtensionAPI): void {
|
|
|
96
108
|
"Opens the presentation with live reload -- edits to the .md file update instantly. " +
|
|
97
109
|
"Requires @kwhorne/anna.js to be installed globally.",
|
|
98
110
|
parameters: Type.Object({
|
|
99
|
-
file: Type.Optional(
|
|
100
|
-
|
|
101
|
-
),
|
|
102
|
-
port: Type.Optional(
|
|
103
|
-
Type.Number({ description: "Server port (default: 3000)" }),
|
|
104
|
-
),
|
|
111
|
+
file: Type.Optional(Type.String({ description: "Markdown file to preview (default: slides.md)" })),
|
|
112
|
+
port: Type.Optional(Type.Number({ description: "Server port (default: 3000)" })),
|
|
105
113
|
}),
|
|
106
|
-
execute: async (_toolCallId, params) => {
|
|
114
|
+
execute: async (_toolCallId, params): Promise<AgentToolResult<PreviewDetails>> => {
|
|
107
115
|
const file = params.file ?? "slides.md";
|
|
108
116
|
const port = params.port ?? 3000;
|
|
109
117
|
const cwd = process.cwd();
|
|
110
118
|
|
|
111
119
|
if (!existsSync(join(cwd, file))) {
|
|
112
120
|
return {
|
|
113
|
-
content: [
|
|
121
|
+
content: [
|
|
122
|
+
{
|
|
123
|
+
type: "text",
|
|
124
|
+
text: `File not found: ${file}. Generate a presentation first with generate_presentation.`,
|
|
125
|
+
},
|
|
126
|
+
],
|
|
114
127
|
details: {},
|
|
115
128
|
};
|
|
116
129
|
}
|
|
@@ -118,10 +131,12 @@ export default function (elyra: ExtensionAPI): void {
|
|
|
118
131
|
// Check if anna is installed
|
|
119
132
|
if (!isAnnaInstalled()) {
|
|
120
133
|
return {
|
|
121
|
-
content: [
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
134
|
+
content: [
|
|
135
|
+
{
|
|
136
|
+
type: "text",
|
|
137
|
+
text: "Anna.js CLI not found. Install it with:\n\nnpm install -g @kwhorne/anna.js\n\nThen try again.",
|
|
138
|
+
},
|
|
139
|
+
],
|
|
125
140
|
details: {},
|
|
126
141
|
};
|
|
127
142
|
}
|
|
@@ -138,10 +153,12 @@ export default function (elyra: ExtensionAPI): void {
|
|
|
138
153
|
}
|
|
139
154
|
|
|
140
155
|
return {
|
|
141
|
-
content: [
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
156
|
+
content: [
|
|
157
|
+
{
|
|
158
|
+
type: "text",
|
|
159
|
+
text: `Presentation server started at http://localhost:${port}\nFile: ${file}\nLive reload enabled -- edit the .md file to see changes instantly.`,
|
|
160
|
+
},
|
|
161
|
+
],
|
|
145
162
|
details: { file, port },
|
|
146
163
|
};
|
|
147
164
|
},
|
|
@@ -156,17 +173,13 @@ export default function (elyra: ExtensionAPI): void {
|
|
|
156
173
|
"Creates a self-contained HTML file that can be opened directly in a browser. " +
|
|
157
174
|
"Use --offline for bundled Mermaid, --pwa for installable offline app.",
|
|
158
175
|
parameters: Type.Object({
|
|
159
|
-
file: Type.Optional(
|
|
160
|
-
Type.String({ description: "Markdown file to build (default: slides.md)" }),
|
|
161
|
-
),
|
|
176
|
+
file: Type.Optional(Type.String({ description: "Markdown file to build (default: slides.md)" })),
|
|
162
177
|
offline: Type.Optional(
|
|
163
178
|
Type.Boolean({ description: "Bundle Mermaid locally for offline use (default: false)" }),
|
|
164
179
|
),
|
|
165
|
-
pwa: Type.Optional(
|
|
166
|
-
Type.Boolean({ description: "Generate PWA manifest and service worker (default: false)" }),
|
|
167
|
-
),
|
|
180
|
+
pwa: Type.Optional(Type.Boolean({ description: "Generate PWA manifest and service worker (default: false)" })),
|
|
168
181
|
}),
|
|
169
|
-
execute: async (_toolCallId, params) => {
|
|
182
|
+
execute: async (_toolCallId, params): Promise<AgentToolResult<BuildDetails>> => {
|
|
170
183
|
const file = params.file ?? "slides.md";
|
|
171
184
|
const cwd = process.cwd();
|
|
172
185
|
|
|
@@ -179,7 +192,9 @@ export default function (elyra: ExtensionAPI): void {
|
|
|
179
192
|
|
|
180
193
|
if (!isAnnaInstalled()) {
|
|
181
194
|
return {
|
|
182
|
-
content: [
|
|
195
|
+
content: [
|
|
196
|
+
{ type: "text", text: "Anna.js CLI not found. Install with: npm install -g @kwhorne/anna.js" },
|
|
197
|
+
],
|
|
183
198
|
details: {},
|
|
184
199
|
};
|
|
185
200
|
}
|
|
@@ -218,7 +233,7 @@ export default function (elyra: ExtensionAPI): void {
|
|
|
218
233
|
if (!args.trim()) {
|
|
219
234
|
elyra.sendUserMessage(
|
|
220
235
|
"I want to create a presentation. Ask me what topic or project area to present, " +
|
|
221
|
-
|
|
236
|
+
"how many slides, and which features to include (terminal demos, live code, diagrams).",
|
|
222
237
|
);
|
|
223
238
|
return;
|
|
224
239
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elyracode/anna",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.58",
|
|
4
4
|
"description": "Elyra extension for Anna.js -- generate, preview, and edit Markdown presentations with terminal animations, live code, and Mermaid diagrams",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|