c64bridge 0.5.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.
- package/.github/prompts/README.md +6 -0
- package/.github/prompts/assembly-routine-session.prompt.md +13 -0
- package/.github/prompts/basic-program-session.prompt.md +13 -0
- package/.github/prompts/drive-management-session.prompt.md +13 -0
- package/.github/prompts/petscii-art-session.prompt.md +13 -0
- package/.github/prompts/play-classic-game.prompt.md +13 -0
- package/.github/prompts/sid-music-session.prompt.md +13 -0
- package/AGENTS.md +173 -0
- package/LICENSE +339 -0
- package/README.md +582 -0
- package/data/README.md +16 -0
- package/data/api/basic-api-spec.md +154 -0
- package/data/api/kernal-api-spec.md +68 -0
- package/data/assembly/assembly-spec.md +196 -0
- package/data/assembly/examples/effects/sinewave.asm +5 -0
- package/data/assembly/examples/graphics/sprite/mover.asm +15 -0
- package/data/assembly/examples/sid-file-structure.md +8 -0
- package/data/assembly/examples/sid-overview.md +11 -0
- package/data/audio/examples/Biosphere.sid +0 -0
- package/data/audio/sid-file-structure.md +91 -0
- package/data/audio/sid-programming-best-practices.md +198 -0
- package/data/audio/sid-spec.md +166 -0
- package/data/audio/sidwave.md +131 -0
- package/data/audio/sidwave.schema.json +64 -0
- package/data/basic/basic-spec.md +230 -0
- package/data/basic/examples/audio/alle-meine-entchen-expressive.bas +41 -0
- package/data/basic/examples/audio/c-major-scale-pleasant.bas +29 -0
- package/data/basic/examples/io/joystick.bas +5 -0
- package/data/basic/examples/video/bounce.bas +8 -0
- package/data/basic/examples/video/entchen-petscii.bas +16 -0
- package/data/basic/examples/video/hello-world.bas +4 -0
- package/data/basic/examples/video/wave.bas +7 -0
- package/data/context/bootstrap.md +148 -0
- package/data/context/chat.md +36 -0
- package/data/drive/drive-spec.md +215 -0
- package/data/embeddings_asm.json +1 -0
- package/data/embeddings_basic.json +1 -0
- package/data/embeddings_hardware.json +1 -0
- package/data/embeddings_mixed.json +1 -0
- package/data/embeddings_other.json +1 -0
- package/data/io/cia-spec.md +115 -0
- package/data/io/io-spec.md +124 -0
- package/data/memory/kernal-memory-map.md +227 -0
- package/data/memory/low-memory-map.md +133 -0
- package/data/memory/memory-map.md +186 -0
- package/data/printer/printer-commodore-bitmap.md +31 -0
- package/data/printer/printer-commodore.md +28 -0
- package/data/printer/printer-epson-bitmap.md +29 -0
- package/data/printer/printer-epson.md +30 -0
- package/data/printer/printer-prompts.md +29 -0
- package/data/printer/printer-spec.md +180 -0
- package/data/video/character-set.csv +257 -0
- package/data/video/vic-spec.md +276 -0
- package/dist/assemblyConverter.js +1299 -0
- package/dist/audio/record_and_analyze_audio.js +292 -0
- package/dist/basicConverter.js +193 -0
- package/dist/bootstrap/stdio-logger.js +32 -0
- package/dist/c64Client.js +1052 -0
- package/dist/chargen.js +197 -0
- package/dist/config.js +142 -0
- package/dist/context.js +157 -0
- package/dist/device.js +413 -0
- package/dist/index.js +7 -0
- package/dist/knowledge.js +454 -0
- package/dist/logger.js +182 -0
- package/dist/loggingHttpClient.js +88 -0
- package/dist/mcp-server.js +426 -0
- package/dist/petscii.js +135 -0
- package/dist/petsciiArt.js +356 -0
- package/dist/platform.js +82 -0
- package/dist/prompts/registry.js +560 -0
- package/dist/rag/discover.config.json +41 -0
- package/dist/rag/discover.js +401 -0
- package/dist/rag/embeddings.js +60 -0
- package/dist/rag/externalFetcher.js +934 -0
- package/dist/rag/indexer.js +770 -0
- package/dist/rag/init.js +139 -0
- package/dist/rag/knowledgeIndex.js +361 -0
- package/dist/rag/loggingRetriever.js +46 -0
- package/dist/rag/rateLimiter.js +127 -0
- package/dist/rag/retriever.js +74 -0
- package/dist/rag/sources.csv +31 -0
- package/dist/rag/types.js +5 -0
- package/dist/rag/urlUtils.js +38 -0
- package/dist/sidplayRunner.js +240 -0
- package/dist/sidwave.js +101 -0
- package/dist/sidwaveCompiler.js +329 -0
- package/dist/tools/audio.js +944 -0
- package/dist/tools/developer.js +515 -0
- package/dist/tools/errors.js +59 -0
- package/dist/tools/graphics.js +469 -0
- package/dist/tools/machineControl.js +267 -0
- package/dist/tools/memory.js +224 -0
- package/dist/tools/printer.js +482 -0
- package/dist/tools/programRunners.js +315 -0
- package/dist/tools/rag.js +153 -0
- package/dist/tools/registry.js +58 -0
- package/dist/tools/responses.js +36 -0
- package/dist/tools/schema.js +304 -0
- package/dist/tools/storage.js +740 -0
- package/dist/tools/streaming.js +132 -0
- package/dist/tools/types.js +99 -0
- package/dist/viceRunner.js +239 -0
- package/doc/MCP_SETUP.md +153 -0
- package/doc/README.md +7 -0
- package/doc/developer.md +312 -0
- package/doc/img/logo.png +0 -0
- package/doc/img/prompts/duck_petscii.png +0 -0
- package/doc/img/prompts/duck_song.png +0 -0
- package/doc/img/vscode/vscode-copilot-c64-chat-mode.png +0 -0
- package/doc/img/vscode/vscode-copilot-hello-world.png +0 -0
- package/doc/prompts/README.md +96 -0
- package/doc/prompts/user-prompt-ideas.md +147 -0
- package/doc/rest/c64-openapi.yaml +979 -0
- package/doc/rest/c64-rest-api.md +106 -0
- package/doc/troubleshooting-mcp.md +177 -0
- package/generated/c64/index.js +857 -0
- package/mcp.json +106 -0
- package/package.json +79 -0
- package/scripts/c64-cli.mjs +142 -0
- package/scripts/c64-tool.sh +83 -0
- package/scripts/check-package.mjs +89 -0
- package/scripts/cli.js +61 -0
- package/scripts/fetch-external-sources.mjs +67 -0
- package/scripts/generate-changelog.mjs +131 -0
- package/scripts/postbuild.mjs +101 -0
- package/scripts/prepare-release.mjs +58 -0
- package/scripts/rag-rebuild.mjs +53 -0
- package/scripts/register-ts-node.mjs +6 -0
- package/scripts/run-mcp-check.sh +104 -0
- package/scripts/run-tests.mjs +195 -0
- package/scripts/sid2wav.sh +94 -0
- package/scripts/smoke-run.sh +65 -0
- package/scripts/start-mock-c64.mjs +51 -0
- package/scripts/start-mock.mjs +31 -0
- package/scripts/start.mjs +72 -0
- package/scripts/update-readme.ts +164 -0
- package/scripts/verify-package.mjs +147 -0
|
@@ -0,0 +1,560 @@
|
|
|
1
|
+
import { listKnowledgeResources } from "../rag/knowledgeIndex.js";
|
|
2
|
+
import { toolRegistry } from "../tools/registry.js";
|
|
3
|
+
const BASE_SEGMENTS = {
|
|
4
|
+
"intro/core": {
|
|
5
|
+
id: "intro/core",
|
|
6
|
+
role: "assistant",
|
|
7
|
+
content: [
|
|
8
|
+
"You operate the Commodore 64 Ultimate hardware through MCP tools and documented workflows.",
|
|
9
|
+
"Consult the listed knowledge resources before generating code or issuing device commands.",
|
|
10
|
+
"State each intended MCP tool invocation explicitly and explain why it is required before running it.",
|
|
11
|
+
].join("\n"),
|
|
12
|
+
},
|
|
13
|
+
"safety/reset": {
|
|
14
|
+
id: "safety/reset",
|
|
15
|
+
role: "assistant",
|
|
16
|
+
content: [
|
|
17
|
+
"Safety guardrails:",
|
|
18
|
+
"- Ask the user before resets, power cycles, disk swaps, or destructive writes.",
|
|
19
|
+
"- Offer an undo or recovery path (reload prior program, remount image, or restore settings).",
|
|
20
|
+
"- Highlight side effects that could halt running software or corrupt data.",
|
|
21
|
+
].join("\n"),
|
|
22
|
+
},
|
|
23
|
+
"workflow/basic-verify": {
|
|
24
|
+
id: "workflow/basic-verify",
|
|
25
|
+
role: "assistant",
|
|
26
|
+
content: [
|
|
27
|
+
"Verification for BASIC programs:",
|
|
28
|
+
"- After uploading, run `read_screen` to capture PETSCII output and confirm `READY.` appears when expected.",
|
|
29
|
+
"- Use `read_memory` around the BASIC program area when verifying that lines tokenised correctly.",
|
|
30
|
+
"- Call out newline and quotation handling quirks so the user can interpret the output accurately.",
|
|
31
|
+
].join("\n"),
|
|
32
|
+
},
|
|
33
|
+
"workflow/asm-irq": {
|
|
34
|
+
id: "workflow/asm-irq",
|
|
35
|
+
role: "assistant",
|
|
36
|
+
content: [
|
|
37
|
+
"IRQ discipline:",
|
|
38
|
+
"- Wrap installation in `SEI`/`CLI`, set vectors, and configure `$D01A` masks explicitly.",
|
|
39
|
+
"- Acknowledge interrupts via `$D019` before returning, and document any timing assumptions.",
|
|
40
|
+
"- Describe zero-page and workspace usage so other routines can coexist safely.",
|
|
41
|
+
].join("\n"),
|
|
42
|
+
},
|
|
43
|
+
"workflow/sid-iterate": {
|
|
44
|
+
id: "workflow/sid-iterate",
|
|
45
|
+
role: "assistant",
|
|
46
|
+
content: [
|
|
47
|
+
"SID feedback loop:",
|
|
48
|
+
"- Compose the sequence, waveform, ADSR, and modulation plan referencing SID register names.",
|
|
49
|
+
"- Explain how to play it (e.g., `music_generate`, `sid_note_on`, or uploading executable code).",
|
|
50
|
+
"- After playback, run `analyze_audio` and describe how to adjust envelope, tuning, or rhythm.",
|
|
51
|
+
].join("\n"),
|
|
52
|
+
},
|
|
53
|
+
"workflow/graphics-verify": {
|
|
54
|
+
id: "workflow/graphics-verify",
|
|
55
|
+
role: "assistant",
|
|
56
|
+
content: [
|
|
57
|
+
"Graphics verification:",
|
|
58
|
+
"- List register writes for mode setup, colour RAM, and sprite pointers.",
|
|
59
|
+
"- Suggest capturing output with `read_screen` or noting expected border/background colours.",
|
|
60
|
+
"- Include timing checks (raster lines, badline windows) when applicable.",
|
|
61
|
+
].join("\n"),
|
|
62
|
+
},
|
|
63
|
+
"workflow/printer": {
|
|
64
|
+
id: "workflow/printer",
|
|
65
|
+
role: "assistant",
|
|
66
|
+
content: [
|
|
67
|
+
"Printer workflow:",
|
|
68
|
+
"- Confirm printer type and device number before printing.",
|
|
69
|
+
"- Include channel open/write/close steps and eject the page with `CHR$(12)` when appropriate.",
|
|
70
|
+
"- Recommend checking printer status or repeating `print_text` if paper alignment is uncertain.",
|
|
71
|
+
].join("\n"),
|
|
72
|
+
},
|
|
73
|
+
"workflow/memory-snapshot": {
|
|
74
|
+
id: "workflow/memory-snapshot",
|
|
75
|
+
role: "assistant",
|
|
76
|
+
content: [
|
|
77
|
+
"Memory safety:",
|
|
78
|
+
"- Pause running code before writes, capture the target range with `read_memory`, then resume when safe.",
|
|
79
|
+
"- Explain how to revert the change (rewriting original bytes or power-cycling if needed).",
|
|
80
|
+
"- Document address ranges, register dependencies, and any expected side effects.",
|
|
81
|
+
].join("\n"),
|
|
82
|
+
},
|
|
83
|
+
"workflow/drive": {
|
|
84
|
+
id: "workflow/drive",
|
|
85
|
+
role: "assistant",
|
|
86
|
+
content: [
|
|
87
|
+
"Drive management protocol:",
|
|
88
|
+
"- List currently mounted images before altering drives to avoid disrupting active workflows.",
|
|
89
|
+
"- Warn if IEC bus operations could interfere with running programs or disk writes.",
|
|
90
|
+
"- Verify results with `drives_list` or relevant status tools after each action.",
|
|
91
|
+
].join("\n"),
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
const BASIC_CORE_SEGMENT = {
|
|
95
|
+
id: "family/basic-core",
|
|
96
|
+
role: "assistant",
|
|
97
|
+
content: [
|
|
98
|
+
"BASIC workflow:",
|
|
99
|
+
"- Restate the request and outline a short plan citing `c64://specs/basic` for syntax or device usage.",
|
|
100
|
+
"- Generate a numbered BASIC listing with inline remarks when clarity is required.",
|
|
101
|
+
"- Describe how `upload_and_run_basic` loads the program and what output to inspect.",
|
|
102
|
+
"- Suggest follow-up diagnostics (screen capture, memory snapshot, or tool reruns).",
|
|
103
|
+
].join("\n"),
|
|
104
|
+
};
|
|
105
|
+
function assemblyCoreSegment(hardware) {
|
|
106
|
+
const focus = (() => {
|
|
107
|
+
switch (hardware) {
|
|
108
|
+
case "sid":
|
|
109
|
+
return "- Emphasise SID register usage, voice mixing, and timing derived from `c64://specs/sid`.";
|
|
110
|
+
case "vic":
|
|
111
|
+
return "- Highlight VIC-II raster, sprite, or bitmap setup drawing from `c64://specs/vic`.";
|
|
112
|
+
case "cia":
|
|
113
|
+
return "- Cover CIA timer/port configuration and interrupt hand-offs carefully.";
|
|
114
|
+
case "multi":
|
|
115
|
+
return "- Coordinate SID, VIC-II, and CIA interactions; call out contention risks.";
|
|
116
|
+
default:
|
|
117
|
+
return "- Declare which hardware blocks (SID, VIC-II, CIA) you will touch and why.";
|
|
118
|
+
}
|
|
119
|
+
})();
|
|
120
|
+
return {
|
|
121
|
+
id: "family/assembly-core",
|
|
122
|
+
role: "assistant",
|
|
123
|
+
content: [
|
|
124
|
+
"Assembly workflow:",
|
|
125
|
+
focus,
|
|
126
|
+
"- Provide memory layout, zero-page usage, and register effects for the routine.",
|
|
127
|
+
"- Explain how to build and deploy via `upload_and_run_asm` or targeted `write_memory` calls.",
|
|
128
|
+
"- Include verification steps using `read_memory`, `read_screen`, or hardware-specific checks.",
|
|
129
|
+
].join("\n"),
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
const SID_CORE_SEGMENT = {
|
|
133
|
+
id: "family/sid-core",
|
|
134
|
+
role: "assistant",
|
|
135
|
+
content: [
|
|
136
|
+
"SID composition workflow:",
|
|
137
|
+
"- Summarise the musical goal, tempo, and character before presenting notes or SIDWAVE data.",
|
|
138
|
+
"- Reference `c64://specs/sid` and `c64://specs/sidwave` when detailing registers and data formats.",
|
|
139
|
+
"- Provide a playback plan (tool calls, SID register writes, or PRG execution) and note required buffers.",
|
|
140
|
+
].join("\n"),
|
|
141
|
+
};
|
|
142
|
+
function graphicsCoreSegment(mode) {
|
|
143
|
+
const intro = (() => {
|
|
144
|
+
switch (mode) {
|
|
145
|
+
case "text":
|
|
146
|
+
return "- Focus on PETSCII screen composition and character set considerations.";
|
|
147
|
+
case "multicolour":
|
|
148
|
+
return "- Detail multicolour bitmap setup, shared colour registers, and memory banking.";
|
|
149
|
+
case "bitmap":
|
|
150
|
+
return "- Lay out bitmap memory, screen RAM, and colour RAM usage explicitly.";
|
|
151
|
+
case "sprite":
|
|
152
|
+
return "- Describe sprite data, pointer tables, and multiplexing or animation timing.";
|
|
153
|
+
default:
|
|
154
|
+
return "- State which VIC-II mode or technique you will use and justify the choice.";
|
|
155
|
+
}
|
|
156
|
+
})();
|
|
157
|
+
return {
|
|
158
|
+
id: "family/graphics-core",
|
|
159
|
+
role: "assistant",
|
|
160
|
+
content: [
|
|
161
|
+
"Graphics workflow:",
|
|
162
|
+
intro,
|
|
163
|
+
"- Summarise VIC-II register writes, memory banking, and colour usage with references to `c64://specs/vic`.",
|
|
164
|
+
"- Explain how to deploy the routine (BASIC loader vs assembly) and required assets.",
|
|
165
|
+
"- Include clean-up or teardown steps so the user can restore the display state.",
|
|
166
|
+
].join("\n"),
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
function printerCoreSegment(printerType) {
|
|
170
|
+
const detail = (() => {
|
|
171
|
+
switch (printerType) {
|
|
172
|
+
case "commodore":
|
|
173
|
+
return "- Reference Commodore device 4 character codes and PETSCII control sequences.";
|
|
174
|
+
case "epson":
|
|
175
|
+
return "- Reference Epson ESC/P control codes, especially for fonts and bit-image modes.";
|
|
176
|
+
default:
|
|
177
|
+
return "- Clarify whether the target is Commodore MPS or Epson FX to select correct control codes.";
|
|
178
|
+
}
|
|
179
|
+
})();
|
|
180
|
+
return {
|
|
181
|
+
id: "family/printer-core",
|
|
182
|
+
role: "assistant",
|
|
183
|
+
content: [
|
|
184
|
+
"Printer workflow:",
|
|
185
|
+
detail,
|
|
186
|
+
"- Outline data preparation, channel open/write/close, and any required delays.",
|
|
187
|
+
"- Mention how to recover if paper jams or alignment differs from expectations.",
|
|
188
|
+
].join("\n"),
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
const MEMORY_CORE_SEGMENT = {
|
|
192
|
+
id: "family/memory-core",
|
|
193
|
+
role: "assistant",
|
|
194
|
+
content: [
|
|
195
|
+
"Memory debugging workflow:",
|
|
196
|
+
"- Restate the target address ranges and relate them to symbols from `c64://specs/assembly` or the memory map.",
|
|
197
|
+
"- Plan safe inspection or patching steps using `read_memory`, `write_memory`, `pause`, and `resume`.",
|
|
198
|
+
"- Encourage logging or diffing memory before and after changes for auditability.",
|
|
199
|
+
].join("\n"),
|
|
200
|
+
};
|
|
201
|
+
const DRIVE_CORE_SEGMENT = {
|
|
202
|
+
id: "family/drive-core",
|
|
203
|
+
role: "assistant",
|
|
204
|
+
content: [
|
|
205
|
+
"Drive management workflow:",
|
|
206
|
+
"- Summarise desired drive state and confirm affected slots before issuing commands.",
|
|
207
|
+
"- Use `drives_list` to baseline the system and to verify outcomes after each operation.",
|
|
208
|
+
"- Provide contingency steps if mounting or power commands fail.",
|
|
209
|
+
].join("\n"),
|
|
210
|
+
};
|
|
211
|
+
function mergeUniqueStrings(base, extras) {
|
|
212
|
+
if (!extras || extras.length === 0) {
|
|
213
|
+
return [...base];
|
|
214
|
+
}
|
|
215
|
+
const seen = new Set(base);
|
|
216
|
+
const combined = [...base];
|
|
217
|
+
for (const value of extras) {
|
|
218
|
+
if (!seen.has(value)) {
|
|
219
|
+
seen.add(value);
|
|
220
|
+
combined.push(value);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return combined;
|
|
224
|
+
}
|
|
225
|
+
function prepareAssemblyArgs(args) {
|
|
226
|
+
const hardware = args.hardware;
|
|
227
|
+
if (hardware === undefined || hardware === null) {
|
|
228
|
+
return {};
|
|
229
|
+
}
|
|
230
|
+
if (typeof hardware !== "string") {
|
|
231
|
+
throw new Error("assembly-program prompt argument \"hardware\" must be a string");
|
|
232
|
+
}
|
|
233
|
+
const normalised = hardware.trim().toLowerCase();
|
|
234
|
+
const allowed = ["sid", "vic", "cia", "multi"];
|
|
235
|
+
if (!allowed.includes(normalised)) {
|
|
236
|
+
throw new Error(`assembly-program prompt does not support hardware "${hardware}". Expected one of: ${allowed.join(", ")}`);
|
|
237
|
+
}
|
|
238
|
+
return { hardware: normalised };
|
|
239
|
+
}
|
|
240
|
+
function prepareGraphicsArgs(args) {
|
|
241
|
+
const mode = args.mode;
|
|
242
|
+
if (mode === undefined || mode === null) {
|
|
243
|
+
return {};
|
|
244
|
+
}
|
|
245
|
+
if (typeof mode !== "string") {
|
|
246
|
+
throw new Error("graphics-demo prompt argument \"mode\" must be a string");
|
|
247
|
+
}
|
|
248
|
+
const normalised = mode.trim().toLowerCase();
|
|
249
|
+
const allowed = ["text", "multicolour", "bitmap", "sprite"];
|
|
250
|
+
if (!allowed.includes(normalised)) {
|
|
251
|
+
throw new Error(`graphics-demo prompt does not support mode "${mode}". Expected one of: ${allowed.join(", ")}`);
|
|
252
|
+
}
|
|
253
|
+
return { mode: normalised };
|
|
254
|
+
}
|
|
255
|
+
function preparePrinterArgs(args) {
|
|
256
|
+
const printerType = args.printerType;
|
|
257
|
+
if (printerType === undefined || printerType === null) {
|
|
258
|
+
return {};
|
|
259
|
+
}
|
|
260
|
+
if (typeof printerType !== "string") {
|
|
261
|
+
throw new Error("printer-job prompt argument \"printerType\" must be a string");
|
|
262
|
+
}
|
|
263
|
+
const normalised = printerType.trim().toLowerCase();
|
|
264
|
+
const allowed = ["commodore", "epson"];
|
|
265
|
+
if (!allowed.includes(normalised)) {
|
|
266
|
+
throw new Error(`printer-job prompt does not support printerType "${printerType}". Expected one of: ${allowed.join(", ")}`);
|
|
267
|
+
}
|
|
268
|
+
return { printerType: normalised };
|
|
269
|
+
}
|
|
270
|
+
export function createPromptRegistry() {
|
|
271
|
+
const knowledgeByUri = new Map(listKnowledgeResources().map((resource) => [resource.uri, resource]));
|
|
272
|
+
const toolByName = new Map(toolRegistry.list().map((tool) => [tool.name, tool]));
|
|
273
|
+
const definitions = [
|
|
274
|
+
{
|
|
275
|
+
descriptor: {
|
|
276
|
+
name: "basic-program",
|
|
277
|
+
title: "BASIC Program Workflow",
|
|
278
|
+
description: "Plan, implement, and verify Commodore BASIC v2 programs safely.",
|
|
279
|
+
requiredResources: [
|
|
280
|
+
"c64://specs/basic",
|
|
281
|
+
"c64://context/bootstrap",
|
|
282
|
+
"c64://docs/index",
|
|
283
|
+
],
|
|
284
|
+
optionalResources: [],
|
|
285
|
+
tools: ["upload_and_run_basic", "read_screen", "read_memory"],
|
|
286
|
+
tags: ["basic", "program"],
|
|
287
|
+
},
|
|
288
|
+
buildMessages: () => [
|
|
289
|
+
BASE_SEGMENTS["intro/core"],
|
|
290
|
+
BASE_SEGMENTS["safety/reset"],
|
|
291
|
+
BASIC_CORE_SEGMENT,
|
|
292
|
+
BASE_SEGMENTS["workflow/basic-verify"],
|
|
293
|
+
],
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
descriptor: {
|
|
297
|
+
name: "assembly-program",
|
|
298
|
+
title: "Assembly Program Workflow",
|
|
299
|
+
description: "Author 6502/6510 assembly routines with precise hardware guidance.",
|
|
300
|
+
requiredResources: [
|
|
301
|
+
"c64://specs/assembly",
|
|
302
|
+
"c64://specs/vic",
|
|
303
|
+
"c64://specs/sid",
|
|
304
|
+
"c64://context/bootstrap",
|
|
305
|
+
],
|
|
306
|
+
optionalResources: [],
|
|
307
|
+
tools: ["upload_and_run_asm", "write_memory", "read_memory", "read_screen"],
|
|
308
|
+
tags: ["assembly", "program"],
|
|
309
|
+
},
|
|
310
|
+
arguments: [
|
|
311
|
+
{
|
|
312
|
+
name: "hardware",
|
|
313
|
+
description: "Optional focus area for the routine (sid, vic, cia, or multi for combined work).",
|
|
314
|
+
options: ["sid", "vic", "cia", "multi"],
|
|
315
|
+
},
|
|
316
|
+
],
|
|
317
|
+
prepareArgs: prepareAssemblyArgs,
|
|
318
|
+
buildMessages: (args) => {
|
|
319
|
+
const hardware = args.hardware;
|
|
320
|
+
return [
|
|
321
|
+
BASE_SEGMENTS["intro/core"],
|
|
322
|
+
BASE_SEGMENTS["safety/reset"],
|
|
323
|
+
assemblyCoreSegment(hardware),
|
|
324
|
+
BASE_SEGMENTS["workflow/asm-irq"],
|
|
325
|
+
BASE_SEGMENTS["workflow/memory-snapshot"],
|
|
326
|
+
];
|
|
327
|
+
},
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
descriptor: {
|
|
331
|
+
name: "sid-music",
|
|
332
|
+
title: "SID Composition Workflow",
|
|
333
|
+
description: "Compose SID music with expressive phrasing and iterative audio verification.",
|
|
334
|
+
requiredResources: [
|
|
335
|
+
"c64://specs/sid",
|
|
336
|
+
"c64://specs/sidwave",
|
|
337
|
+
"c64://docs/sid/file-structure",
|
|
338
|
+
],
|
|
339
|
+
optionalResources: [],
|
|
340
|
+
tools: ["music_generate", "analyze_audio", "sid_note_on", "sid_volume", "sidplay_file"],
|
|
341
|
+
tags: ["sid", "music"],
|
|
342
|
+
},
|
|
343
|
+
buildMessages: () => [
|
|
344
|
+
BASE_SEGMENTS["intro/core"],
|
|
345
|
+
SID_CORE_SEGMENT,
|
|
346
|
+
BASE_SEGMENTS["workflow/sid-iterate"],
|
|
347
|
+
BASE_SEGMENTS["safety/reset"],
|
|
348
|
+
],
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
descriptor: {
|
|
352
|
+
name: "graphics-demo",
|
|
353
|
+
title: "Graphics Demo Workflow",
|
|
354
|
+
description: "Create VIC-II graphics demos with safe setup and validation steps.",
|
|
355
|
+
requiredResources: [
|
|
356
|
+
"c64://specs/vic",
|
|
357
|
+
"c64://context/bootstrap",
|
|
358
|
+
],
|
|
359
|
+
optionalResources: ["c64://specs/assembly"],
|
|
360
|
+
tools: ["upload_and_run_basic", "upload_and_run_asm", "render_petscii_screen"],
|
|
361
|
+
tags: ["graphics", "vic"],
|
|
362
|
+
},
|
|
363
|
+
arguments: [
|
|
364
|
+
{
|
|
365
|
+
name: "mode",
|
|
366
|
+
description: "Target VIC-II technique (text, multicolour, bitmap, or sprite).",
|
|
367
|
+
options: ["text", "multicolour", "bitmap", "sprite"],
|
|
368
|
+
},
|
|
369
|
+
],
|
|
370
|
+
prepareArgs: prepareGraphicsArgs,
|
|
371
|
+
selectTools: (args) => {
|
|
372
|
+
const mode = args.mode;
|
|
373
|
+
if (mode === "sprite") {
|
|
374
|
+
return ["generate_sprite_prg", "write_memory", "read_memory"];
|
|
375
|
+
}
|
|
376
|
+
if (mode === "bitmap" || mode === "multicolour") {
|
|
377
|
+
return ["write_memory", "read_memory"];
|
|
378
|
+
}
|
|
379
|
+
if (mode === "text") {
|
|
380
|
+
return ["create_petscii_image", "read_screen"];
|
|
381
|
+
}
|
|
382
|
+
return ["read_screen"];
|
|
383
|
+
},
|
|
384
|
+
buildMessages: (args) => {
|
|
385
|
+
const mode = args.mode;
|
|
386
|
+
return [
|
|
387
|
+
BASE_SEGMENTS["intro/core"],
|
|
388
|
+
BASE_SEGMENTS["safety/reset"],
|
|
389
|
+
graphicsCoreSegment(mode),
|
|
390
|
+
BASE_SEGMENTS["workflow/graphics-verify"],
|
|
391
|
+
];
|
|
392
|
+
},
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
descriptor: {
|
|
396
|
+
name: "printer-job",
|
|
397
|
+
title: "Printer Job Workflow",
|
|
398
|
+
description: "Send formatted output to Commodore or Epson printers with safe teardown steps.",
|
|
399
|
+
requiredResources: [
|
|
400
|
+
"c64://specs/printer",
|
|
401
|
+
"c64://docs/printer/guide",
|
|
402
|
+
"c64://docs/printer/prompts",
|
|
403
|
+
],
|
|
404
|
+
optionalResources: [
|
|
405
|
+
"c64://docs/printer/commodore-text",
|
|
406
|
+
"c64://docs/printer/commodore-bitmap",
|
|
407
|
+
"c64://docs/printer/epson-text",
|
|
408
|
+
"c64://docs/printer/epson-bitmap",
|
|
409
|
+
],
|
|
410
|
+
tools: ["print_text"],
|
|
411
|
+
tags: ["printer"],
|
|
412
|
+
},
|
|
413
|
+
arguments: [
|
|
414
|
+
{
|
|
415
|
+
name: "printerType",
|
|
416
|
+
description: "Select Commodore (device 4) or Epson FX workflow helpers.",
|
|
417
|
+
options: ["commodore", "epson"],
|
|
418
|
+
},
|
|
419
|
+
],
|
|
420
|
+
prepareArgs: preparePrinterArgs,
|
|
421
|
+
selectOptionalResources: (args) => {
|
|
422
|
+
const printerType = args.printerType;
|
|
423
|
+
if (printerType === "commodore") {
|
|
424
|
+
return ["c64://docs/printer/commodore-text", "c64://docs/printer/commodore-bitmap"];
|
|
425
|
+
}
|
|
426
|
+
if (printerType === "epson") {
|
|
427
|
+
return ["c64://docs/printer/epson-text", "c64://docs/printer/epson-bitmap"];
|
|
428
|
+
}
|
|
429
|
+
return [];
|
|
430
|
+
},
|
|
431
|
+
selectTools: (args) => {
|
|
432
|
+
const printerType = args.printerType;
|
|
433
|
+
if (printerType === "commodore") {
|
|
434
|
+
return ["print_text", "print_bitmap_commodore", "define_printer_chars"];
|
|
435
|
+
}
|
|
436
|
+
if (printerType === "epson") {
|
|
437
|
+
return ["print_text", "print_bitmap_epson"];
|
|
438
|
+
}
|
|
439
|
+
return ["print_text", "print_bitmap_commodore", "print_bitmap_epson", "define_printer_chars"];
|
|
440
|
+
},
|
|
441
|
+
buildMessages: (args) => {
|
|
442
|
+
const printerType = args.printerType;
|
|
443
|
+
return [
|
|
444
|
+
BASE_SEGMENTS["intro/core"],
|
|
445
|
+
printerCoreSegment(printerType),
|
|
446
|
+
BASE_SEGMENTS["workflow/printer"],
|
|
447
|
+
BASE_SEGMENTS["safety/reset"],
|
|
448
|
+
];
|
|
449
|
+
},
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
descriptor: {
|
|
453
|
+
name: "memory-debug",
|
|
454
|
+
title: "Memory Debug Workflow",
|
|
455
|
+
description: "Inspect or patch memory ranges with reversible steps and logging.",
|
|
456
|
+
requiredResources: [
|
|
457
|
+
"c64://context/bootstrap",
|
|
458
|
+
"c64://specs/assembly",
|
|
459
|
+
"c64://docs/index",
|
|
460
|
+
],
|
|
461
|
+
optionalResources: [],
|
|
462
|
+
tools: ["read_memory", "write_memory", "pause", "resume", "read_screen"],
|
|
463
|
+
tags: ["memory", "debug"],
|
|
464
|
+
},
|
|
465
|
+
buildMessages: () => [
|
|
466
|
+
BASE_SEGMENTS["intro/core"],
|
|
467
|
+
BASE_SEGMENTS["safety/reset"],
|
|
468
|
+
MEMORY_CORE_SEGMENT,
|
|
469
|
+
BASE_SEGMENTS["workflow/memory-snapshot"],
|
|
470
|
+
],
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
descriptor: {
|
|
474
|
+
name: "drive-manager",
|
|
475
|
+
title: "Drive Manager Workflow",
|
|
476
|
+
description: "Mount, create, or power drives while preserving running workloads.",
|
|
477
|
+
requiredResources: ["c64://context/bootstrap"],
|
|
478
|
+
optionalResources: [],
|
|
479
|
+
tools: [
|
|
480
|
+
"drives_list",
|
|
481
|
+
"drive_mount",
|
|
482
|
+
"drive_remove",
|
|
483
|
+
"drive_reset",
|
|
484
|
+
"drive_on",
|
|
485
|
+
"drive_off",
|
|
486
|
+
"create_d64",
|
|
487
|
+
"create_d71",
|
|
488
|
+
"create_d81",
|
|
489
|
+
"create_dnp",
|
|
490
|
+
"file_info",
|
|
491
|
+
],
|
|
492
|
+
tags: ["drive", "storage"],
|
|
493
|
+
},
|
|
494
|
+
buildMessages: () => [
|
|
495
|
+
BASE_SEGMENTS["intro/core"],
|
|
496
|
+
BASE_SEGMENTS["safety/reset"],
|
|
497
|
+
DRIVE_CORE_SEGMENT,
|
|
498
|
+
BASE_SEGMENTS["workflow/drive"],
|
|
499
|
+
],
|
|
500
|
+
},
|
|
501
|
+
];
|
|
502
|
+
const definitionByName = new Map(definitions.map((def) => [def.descriptor.name, def]));
|
|
503
|
+
return {
|
|
504
|
+
list() {
|
|
505
|
+
return definitions.map((definition) => ({
|
|
506
|
+
descriptor: definition.descriptor,
|
|
507
|
+
arguments: definition.arguments,
|
|
508
|
+
}));
|
|
509
|
+
},
|
|
510
|
+
resolve(name, args) {
|
|
511
|
+
const definition = definitionByName.get(name);
|
|
512
|
+
if (!definition) {
|
|
513
|
+
throw new Error(`Unknown prompt: ${name}`);
|
|
514
|
+
}
|
|
515
|
+
const rawArgs = args ?? {};
|
|
516
|
+
const prepared = definition.prepareArgs ? definition.prepareArgs(rawArgs) : {};
|
|
517
|
+
const argumentValues = Object.keys(prepared).length > 0 ? prepared : undefined;
|
|
518
|
+
const requiredResourceUris = definition.descriptor.requiredResources;
|
|
519
|
+
const optionalBase = definition.descriptor.optionalResources ?? [];
|
|
520
|
+
const optionalExtra = definition.selectOptionalResources
|
|
521
|
+
? definition.selectOptionalResources(prepared)
|
|
522
|
+
: [];
|
|
523
|
+
const optionalUris = mergeUniqueStrings(optionalBase, optionalExtra);
|
|
524
|
+
const resourceUris = mergeUniqueStrings(requiredResourceUris, optionalUris);
|
|
525
|
+
const resources = resourceUris
|
|
526
|
+
.map((uri) => {
|
|
527
|
+
const resource = knowledgeByUri.get(uri);
|
|
528
|
+
if (!resource) {
|
|
529
|
+
if (requiredResourceUris.includes(uri)) {
|
|
530
|
+
throw new Error(`Prompt ${name} references unknown knowledge resource: ${uri}`);
|
|
531
|
+
}
|
|
532
|
+
return undefined;
|
|
533
|
+
}
|
|
534
|
+
return resource;
|
|
535
|
+
})
|
|
536
|
+
.filter((value) => Boolean(value));
|
|
537
|
+
if (resources.length < requiredResourceUris.length) {
|
|
538
|
+
throw new Error(`Prompt ${name} missing required knowledge resources after resolution`);
|
|
539
|
+
}
|
|
540
|
+
const toolNames = mergeUniqueStrings(definition.descriptor.tools, definition.selectTools ? definition.selectTools(prepared) : undefined);
|
|
541
|
+
const tools = toolNames
|
|
542
|
+
.map((toolName) => {
|
|
543
|
+
const tool = toolByName.get(toolName);
|
|
544
|
+
if (!tool) {
|
|
545
|
+
throw new Error(`Prompt ${name} references unknown tool: ${toolName}`);
|
|
546
|
+
}
|
|
547
|
+
return tool;
|
|
548
|
+
});
|
|
549
|
+
const messages = definition.buildMessages(prepared);
|
|
550
|
+
return {
|
|
551
|
+
name: definition.descriptor.name,
|
|
552
|
+
description: definition.descriptor.description,
|
|
553
|
+
arguments: argumentValues,
|
|
554
|
+
messages,
|
|
555
|
+
resources,
|
|
556
|
+
tools,
|
|
557
|
+
};
|
|
558
|
+
},
|
|
559
|
+
};
|
|
560
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"keywords": [
|
|
3
|
+
"C64",
|
|
4
|
+
"Commodore 64",
|
|
5
|
+
"C64 BASIC",
|
|
6
|
+
"C64 Assembly",
|
|
7
|
+
"C64 SID",
|
|
8
|
+
"C64 Demo",
|
|
9
|
+
"Commodore64",
|
|
10
|
+
"C64 Game",
|
|
11
|
+
"C64 Tool",
|
|
12
|
+
"6502",
|
|
13
|
+
"6510",
|
|
14
|
+
"Retrocomputing",
|
|
15
|
+
"SID player",
|
|
16
|
+
"PRG file",
|
|
17
|
+
"D64",
|
|
18
|
+
"VICE emulator"
|
|
19
|
+
],
|
|
20
|
+
"fileExtensions": [
|
|
21
|
+
".a",
|
|
22
|
+
".a65",
|
|
23
|
+
".acme",
|
|
24
|
+
".asm",
|
|
25
|
+
".bas",
|
|
26
|
+
".dasm",
|
|
27
|
+
".inc",
|
|
28
|
+
".kick",
|
|
29
|
+
".lst",
|
|
30
|
+
".mac",
|
|
31
|
+
".pal",
|
|
32
|
+
".s",
|
|
33
|
+
".seq",
|
|
34
|
+
".src",
|
|
35
|
+
".txt",
|
|
36
|
+
".x65"
|
|
37
|
+
],
|
|
38
|
+
"minStars": 3,
|
|
39
|
+
"maxRepos": 200,
|
|
40
|
+
"defaultDepth": 2
|
|
41
|
+
}
|