c64-debug-mcp 1.0.10 → 1.0.11

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/dist/http.cjs CHANGED
@@ -213,7 +213,7 @@ function parseAddress16(input) {
213
213
  }
214
214
  return parsed;
215
215
  }
216
- var address16Schema = import_zod2.z.preprocess(parseAddress16, import_zod2.z.number().int().min(0).max(65535)).describe("16-bit C64 address: decimal (53248) or hex string with prefix ($D000, 0xD000)");
216
+ var address16Schema = import_zod2.z.union([import_zod2.z.number().int().min(0).max(65535), import_zod2.z.string()]).describe("16-bit C64 address: decimal (53248) or hex string with prefix ($D000, 0xD000)");
217
217
  function parseByte(input) {
218
218
  if (typeof input === "number") {
219
219
  if (!Number.isInteger(input) || input < 0 || input > 255) {
@@ -337,7 +337,7 @@ function parseByte(input) {
337
337
  }
338
338
  ]);
339
339
  }
340
- var byteValueSchema = import_zod2.z.preprocess(parseByte, import_zod2.z.number().int().min(0).max(255)).describe("8-bit byte value: decimal (255), hex with prefix ($FF, 0xFF), or binary with prefix (%11111111, 0b11111111)");
340
+ var byteValueSchema = import_zod2.z.union([import_zod2.z.number().int().min(0).max(255), import_zod2.z.string()]).describe("8-bit byte value: decimal (255), hex with prefix ($FF, 0xFF), or binary with prefix (%11111111, 0b11111111)");
341
341
  var byteArraySchema = import_zod2.z.array(byteValueSchema).describe('Array of byte values in mixed formats: [255, "$FF", "%11111111", 42]');
342
342
  var c64RegisterValueSchema = import_zod2.z.object(
343
343
  Object.fromEntries(
@@ -3656,13 +3656,15 @@ var readMemoryTool = createViceTool({
3656
3656
  let address;
3657
3657
  let length;
3658
3658
  if ("start" in input && "end" in input) {
3659
- if (input.end < input.start) {
3659
+ const start = parseAddress16(input.start);
3660
+ const end = parseAddress16(input.end);
3661
+ if (end < start) {
3660
3662
  throw new Error("End address must be greater than or equal to start address");
3661
3663
  }
3662
- address = input.start;
3663
- length = input.end - input.start + 1;
3664
+ address = start;
3665
+ length = end - start + 1;
3664
3666
  } else if ("address" in input && "length" in input) {
3665
- address = input.address;
3667
+ address = parseAddress16(input.address);
3666
3668
  length = input.length;
3667
3669
  } else {
3668
3670
  throw new Error("Invalid input: must provide either (address, length) or (start, end)");
@@ -3684,16 +3686,20 @@ var writeMemoryTool = createViceTool({
3684
3686
  inputSchema: import_zod4.z.object({
3685
3687
  address: address16Schema.describe("Start address: decimal (53248) or hex string with prefix ($D000, 0xD000)"),
3686
3688
  data: byteArraySchema.min(1).describe("Bytes to write: decimal (255), hex ($FF, 0xFF), or binary (%11111111, 0b11111111). Mixed formats allowed.")
3687
- }).refine((input) => input.address + input.data.length - 1 <= 65535, {
3688
- message: "address + data.length must stay within the 16-bit address space",
3689
- path: ["data"]
3690
3689
  }),
3691
3690
  dataSchema: import_zod4.z.object({
3692
3691
  worked: import_zod4.z.boolean().describe("Whether the write operation completed successfully"),
3693
- address: address16Schema.describe("Start address where the bytes were written"),
3692
+ address: import_zod4.z.number().int().min(0).max(65535).describe("Start address where the bytes were written"),
3694
3693
  length: import_zod4.z.number().int().min(1).describe("Number of bytes written")
3695
3694
  }).extend(debugStateSchema.shape),
3696
- execute: async (input) => await c64Session.writeMemory(input.address, input.data)
3695
+ execute: async (input) => {
3696
+ const address = parseAddress16(input.address);
3697
+ const data = input.data.map((b) => parseByte(b));
3698
+ if (address + data.length - 1 > 65535) {
3699
+ throw new Error("address + data.length must stay within the 16-bit address space");
3700
+ }
3701
+ return await c64Session.writeMemory(address, data);
3702
+ }
3697
3703
  });
3698
3704
  var executeTool = createViceTool({
3699
3705
  id: "execute",
@@ -3770,13 +3776,15 @@ var breakpointSetTool = createViceTool({
3770
3776
  execute: async (input) => {
3771
3777
  let normalizedInput;
3772
3778
  if ("start" in input && "end" in input) {
3773
- if (input.end < input.start) {
3779
+ const start = parseAddress16(input.start);
3780
+ const end = parseAddress16(input.end);
3781
+ if (end < start) {
3774
3782
  throw new Error("End address must be greater than or equal to start address");
3775
3783
  }
3776
3784
  normalizedInput = {
3777
3785
  kind: input.kind,
3778
- address: input.start,
3779
- length: input.end - input.start + 1,
3786
+ address: start,
3787
+ length: end - start + 1,
3780
3788
  condition: input.condition,
3781
3789
  label: input.label,
3782
3790
  temporary: input.temporary,
@@ -3785,7 +3793,7 @@ var breakpointSetTool = createViceTool({
3785
3793
  } else if ("address" in input && "length" in input) {
3786
3794
  normalizedInput = {
3787
3795
  kind: input.kind,
3788
- address: input.address,
3796
+ address: parseAddress16(input.address),
3789
3797
  length: input.length,
3790
3798
  condition: input.condition,
3791
3799
  label: input.label,
package/dist/http.js CHANGED
@@ -190,7 +190,7 @@ function parseAddress16(input) {
190
190
  }
191
191
  return parsed;
192
192
  }
193
- var address16Schema = z2.preprocess(parseAddress16, z2.number().int().min(0).max(65535)).describe("16-bit C64 address: decimal (53248) or hex string with prefix ($D000, 0xD000)");
193
+ var address16Schema = z2.union([z2.number().int().min(0).max(65535), z2.string()]).describe("16-bit C64 address: decimal (53248) or hex string with prefix ($D000, 0xD000)");
194
194
  function parseByte(input) {
195
195
  if (typeof input === "number") {
196
196
  if (!Number.isInteger(input) || input < 0 || input > 255) {
@@ -314,7 +314,7 @@ function parseByte(input) {
314
314
  }
315
315
  ]);
316
316
  }
317
- var byteValueSchema = z2.preprocess(parseByte, z2.number().int().min(0).max(255)).describe("8-bit byte value: decimal (255), hex with prefix ($FF, 0xFF), or binary with prefix (%11111111, 0b11111111)");
317
+ var byteValueSchema = z2.union([z2.number().int().min(0).max(255), z2.string()]).describe("8-bit byte value: decimal (255), hex with prefix ($FF, 0xFF), or binary with prefix (%11111111, 0b11111111)");
318
318
  var byteArraySchema = z2.array(byteValueSchema).describe('Array of byte values in mixed formats: [255, "$FF", "%11111111", 42]');
319
319
  var c64RegisterValueSchema = z2.object(
320
320
  Object.fromEntries(
@@ -3633,13 +3633,15 @@ var readMemoryTool = createViceTool({
3633
3633
  let address;
3634
3634
  let length;
3635
3635
  if ("start" in input && "end" in input) {
3636
- if (input.end < input.start) {
3636
+ const start = parseAddress16(input.start);
3637
+ const end = parseAddress16(input.end);
3638
+ if (end < start) {
3637
3639
  throw new Error("End address must be greater than or equal to start address");
3638
3640
  }
3639
- address = input.start;
3640
- length = input.end - input.start + 1;
3641
+ address = start;
3642
+ length = end - start + 1;
3641
3643
  } else if ("address" in input && "length" in input) {
3642
- address = input.address;
3644
+ address = parseAddress16(input.address);
3643
3645
  length = input.length;
3644
3646
  } else {
3645
3647
  throw new Error("Invalid input: must provide either (address, length) or (start, end)");
@@ -3661,16 +3663,20 @@ var writeMemoryTool = createViceTool({
3661
3663
  inputSchema: z3.object({
3662
3664
  address: address16Schema.describe("Start address: decimal (53248) or hex string with prefix ($D000, 0xD000)"),
3663
3665
  data: byteArraySchema.min(1).describe("Bytes to write: decimal (255), hex ($FF, 0xFF), or binary (%11111111, 0b11111111). Mixed formats allowed.")
3664
- }).refine((input) => input.address + input.data.length - 1 <= 65535, {
3665
- message: "address + data.length must stay within the 16-bit address space",
3666
- path: ["data"]
3667
3666
  }),
3668
3667
  dataSchema: z3.object({
3669
3668
  worked: z3.boolean().describe("Whether the write operation completed successfully"),
3670
- address: address16Schema.describe("Start address where the bytes were written"),
3669
+ address: z3.number().int().min(0).max(65535).describe("Start address where the bytes were written"),
3671
3670
  length: z3.number().int().min(1).describe("Number of bytes written")
3672
3671
  }).extend(debugStateSchema.shape),
3673
- execute: async (input) => await c64Session.writeMemory(input.address, input.data)
3672
+ execute: async (input) => {
3673
+ const address = parseAddress16(input.address);
3674
+ const data = input.data.map((b) => parseByte(b));
3675
+ if (address + data.length - 1 > 65535) {
3676
+ throw new Error("address + data.length must stay within the 16-bit address space");
3677
+ }
3678
+ return await c64Session.writeMemory(address, data);
3679
+ }
3674
3680
  });
3675
3681
  var executeTool = createViceTool({
3676
3682
  id: "execute",
@@ -3747,13 +3753,15 @@ var breakpointSetTool = createViceTool({
3747
3753
  execute: async (input) => {
3748
3754
  let normalizedInput;
3749
3755
  if ("start" in input && "end" in input) {
3750
- if (input.end < input.start) {
3756
+ const start = parseAddress16(input.start);
3757
+ const end = parseAddress16(input.end);
3758
+ if (end < start) {
3751
3759
  throw new Error("End address must be greater than or equal to start address");
3752
3760
  }
3753
3761
  normalizedInput = {
3754
3762
  kind: input.kind,
3755
- address: input.start,
3756
- length: input.end - input.start + 1,
3763
+ address: start,
3764
+ length: end - start + 1,
3757
3765
  condition: input.condition,
3758
3766
  label: input.label,
3759
3767
  temporary: input.temporary,
@@ -3762,7 +3770,7 @@ var breakpointSetTool = createViceTool({
3762
3770
  } else if ("address" in input && "length" in input) {
3763
3771
  normalizedInput = {
3764
3772
  kind: input.kind,
3765
- address: input.address,
3773
+ address: parseAddress16(input.address),
3766
3774
  length: input.length,
3767
3775
  condition: input.condition,
3768
3776
  label: input.label,
package/dist/stdio.cjs CHANGED
@@ -210,7 +210,7 @@ function parseAddress16(input) {
210
210
  }
211
211
  return parsed;
212
212
  }
213
- var address16Schema = import_zod2.z.preprocess(parseAddress16, import_zod2.z.number().int().min(0).max(65535)).describe("16-bit C64 address: decimal (53248) or hex string with prefix ($D000, 0xD000)");
213
+ var address16Schema = import_zod2.z.union([import_zod2.z.number().int().min(0).max(65535), import_zod2.z.string()]).describe("16-bit C64 address: decimal (53248) or hex string with prefix ($D000, 0xD000)");
214
214
  function parseByte(input) {
215
215
  if (typeof input === "number") {
216
216
  if (!Number.isInteger(input) || input < 0 || input > 255) {
@@ -334,7 +334,7 @@ function parseByte(input) {
334
334
  }
335
335
  ]);
336
336
  }
337
- var byteValueSchema = import_zod2.z.preprocess(parseByte, import_zod2.z.number().int().min(0).max(255)).describe("8-bit byte value: decimal (255), hex with prefix ($FF, 0xFF), or binary with prefix (%11111111, 0b11111111)");
337
+ var byteValueSchema = import_zod2.z.union([import_zod2.z.number().int().min(0).max(255), import_zod2.z.string()]).describe("8-bit byte value: decimal (255), hex with prefix ($FF, 0xFF), or binary with prefix (%11111111, 0b11111111)");
338
338
  var byteArraySchema = import_zod2.z.array(byteValueSchema).describe('Array of byte values in mixed formats: [255, "$FF", "%11111111", 42]');
339
339
  var c64RegisterValueSchema = import_zod2.z.object(
340
340
  Object.fromEntries(
@@ -3653,13 +3653,15 @@ var readMemoryTool = createViceTool({
3653
3653
  let address;
3654
3654
  let length;
3655
3655
  if ("start" in input && "end" in input) {
3656
- if (input.end < input.start) {
3656
+ const start = parseAddress16(input.start);
3657
+ const end = parseAddress16(input.end);
3658
+ if (end < start) {
3657
3659
  throw new Error("End address must be greater than or equal to start address");
3658
3660
  }
3659
- address = input.start;
3660
- length = input.end - input.start + 1;
3661
+ address = start;
3662
+ length = end - start + 1;
3661
3663
  } else if ("address" in input && "length" in input) {
3662
- address = input.address;
3664
+ address = parseAddress16(input.address);
3663
3665
  length = input.length;
3664
3666
  } else {
3665
3667
  throw new Error("Invalid input: must provide either (address, length) or (start, end)");
@@ -3681,16 +3683,20 @@ var writeMemoryTool = createViceTool({
3681
3683
  inputSchema: import_zod4.z.object({
3682
3684
  address: address16Schema.describe("Start address: decimal (53248) or hex string with prefix ($D000, 0xD000)"),
3683
3685
  data: byteArraySchema.min(1).describe("Bytes to write: decimal (255), hex ($FF, 0xFF), or binary (%11111111, 0b11111111). Mixed formats allowed.")
3684
- }).refine((input) => input.address + input.data.length - 1 <= 65535, {
3685
- message: "address + data.length must stay within the 16-bit address space",
3686
- path: ["data"]
3687
3686
  }),
3688
3687
  dataSchema: import_zod4.z.object({
3689
3688
  worked: import_zod4.z.boolean().describe("Whether the write operation completed successfully"),
3690
- address: address16Schema.describe("Start address where the bytes were written"),
3689
+ address: import_zod4.z.number().int().min(0).max(65535).describe("Start address where the bytes were written"),
3691
3690
  length: import_zod4.z.number().int().min(1).describe("Number of bytes written")
3692
3691
  }).extend(debugStateSchema.shape),
3693
- execute: async (input) => await c64Session.writeMemory(input.address, input.data)
3692
+ execute: async (input) => {
3693
+ const address = parseAddress16(input.address);
3694
+ const data = input.data.map((b) => parseByte(b));
3695
+ if (address + data.length - 1 > 65535) {
3696
+ throw new Error("address + data.length must stay within the 16-bit address space");
3697
+ }
3698
+ return await c64Session.writeMemory(address, data);
3699
+ }
3694
3700
  });
3695
3701
  var executeTool = createViceTool({
3696
3702
  id: "execute",
@@ -3767,13 +3773,15 @@ var breakpointSetTool = createViceTool({
3767
3773
  execute: async (input) => {
3768
3774
  let normalizedInput;
3769
3775
  if ("start" in input && "end" in input) {
3770
- if (input.end < input.start) {
3776
+ const start = parseAddress16(input.start);
3777
+ const end = parseAddress16(input.end);
3778
+ if (end < start) {
3771
3779
  throw new Error("End address must be greater than or equal to start address");
3772
3780
  }
3773
3781
  normalizedInput = {
3774
3782
  kind: input.kind,
3775
- address: input.start,
3776
- length: input.end - input.start + 1,
3783
+ address: start,
3784
+ length: end - start + 1,
3777
3785
  condition: input.condition,
3778
3786
  label: input.label,
3779
3787
  temporary: input.temporary,
@@ -3782,7 +3790,7 @@ var breakpointSetTool = createViceTool({
3782
3790
  } else if ("address" in input && "length" in input) {
3783
3791
  normalizedInput = {
3784
3792
  kind: input.kind,
3785
- address: input.address,
3793
+ address: parseAddress16(input.address),
3786
3794
  length: input.length,
3787
3795
  condition: input.condition,
3788
3796
  label: input.label,
package/dist/stdio.js CHANGED
@@ -187,7 +187,7 @@ function parseAddress16(input) {
187
187
  }
188
188
  return parsed;
189
189
  }
190
- var address16Schema = z2.preprocess(parseAddress16, z2.number().int().min(0).max(65535)).describe("16-bit C64 address: decimal (53248) or hex string with prefix ($D000, 0xD000)");
190
+ var address16Schema = z2.union([z2.number().int().min(0).max(65535), z2.string()]).describe("16-bit C64 address: decimal (53248) or hex string with prefix ($D000, 0xD000)");
191
191
  function parseByte(input) {
192
192
  if (typeof input === "number") {
193
193
  if (!Number.isInteger(input) || input < 0 || input > 255) {
@@ -311,7 +311,7 @@ function parseByte(input) {
311
311
  }
312
312
  ]);
313
313
  }
314
- var byteValueSchema = z2.preprocess(parseByte, z2.number().int().min(0).max(255)).describe("8-bit byte value: decimal (255), hex with prefix ($FF, 0xFF), or binary with prefix (%11111111, 0b11111111)");
314
+ var byteValueSchema = z2.union([z2.number().int().min(0).max(255), z2.string()]).describe("8-bit byte value: decimal (255), hex with prefix ($FF, 0xFF), or binary with prefix (%11111111, 0b11111111)");
315
315
  var byteArraySchema = z2.array(byteValueSchema).describe('Array of byte values in mixed formats: [255, "$FF", "%11111111", 42]');
316
316
  var c64RegisterValueSchema = z2.object(
317
317
  Object.fromEntries(
@@ -3630,13 +3630,15 @@ var readMemoryTool = createViceTool({
3630
3630
  let address;
3631
3631
  let length;
3632
3632
  if ("start" in input && "end" in input) {
3633
- if (input.end < input.start) {
3633
+ const start = parseAddress16(input.start);
3634
+ const end = parseAddress16(input.end);
3635
+ if (end < start) {
3634
3636
  throw new Error("End address must be greater than or equal to start address");
3635
3637
  }
3636
- address = input.start;
3637
- length = input.end - input.start + 1;
3638
+ address = start;
3639
+ length = end - start + 1;
3638
3640
  } else if ("address" in input && "length" in input) {
3639
- address = input.address;
3641
+ address = parseAddress16(input.address);
3640
3642
  length = input.length;
3641
3643
  } else {
3642
3644
  throw new Error("Invalid input: must provide either (address, length) or (start, end)");
@@ -3658,16 +3660,20 @@ var writeMemoryTool = createViceTool({
3658
3660
  inputSchema: z3.object({
3659
3661
  address: address16Schema.describe("Start address: decimal (53248) or hex string with prefix ($D000, 0xD000)"),
3660
3662
  data: byteArraySchema.min(1).describe("Bytes to write: decimal (255), hex ($FF, 0xFF), or binary (%11111111, 0b11111111). Mixed formats allowed.")
3661
- }).refine((input) => input.address + input.data.length - 1 <= 65535, {
3662
- message: "address + data.length must stay within the 16-bit address space",
3663
- path: ["data"]
3664
3663
  }),
3665
3664
  dataSchema: z3.object({
3666
3665
  worked: z3.boolean().describe("Whether the write operation completed successfully"),
3667
- address: address16Schema.describe("Start address where the bytes were written"),
3666
+ address: z3.number().int().min(0).max(65535).describe("Start address where the bytes were written"),
3668
3667
  length: z3.number().int().min(1).describe("Number of bytes written")
3669
3668
  }).extend(debugStateSchema.shape),
3670
- execute: async (input) => await c64Session.writeMemory(input.address, input.data)
3669
+ execute: async (input) => {
3670
+ const address = parseAddress16(input.address);
3671
+ const data = input.data.map((b) => parseByte(b));
3672
+ if (address + data.length - 1 > 65535) {
3673
+ throw new Error("address + data.length must stay within the 16-bit address space");
3674
+ }
3675
+ return await c64Session.writeMemory(address, data);
3676
+ }
3671
3677
  });
3672
3678
  var executeTool = createViceTool({
3673
3679
  id: "execute",
@@ -3744,13 +3750,15 @@ var breakpointSetTool = createViceTool({
3744
3750
  execute: async (input) => {
3745
3751
  let normalizedInput;
3746
3752
  if ("start" in input && "end" in input) {
3747
- if (input.end < input.start) {
3753
+ const start = parseAddress16(input.start);
3754
+ const end = parseAddress16(input.end);
3755
+ if (end < start) {
3748
3756
  throw new Error("End address must be greater than or equal to start address");
3749
3757
  }
3750
3758
  normalizedInput = {
3751
3759
  kind: input.kind,
3752
- address: input.start,
3753
- length: input.end - input.start + 1,
3760
+ address: start,
3761
+ length: end - start + 1,
3754
3762
  condition: input.condition,
3755
3763
  label: input.label,
3756
3764
  temporary: input.temporary,
@@ -3759,7 +3767,7 @@ var breakpointSetTool = createViceTool({
3759
3767
  } else if ("address" in input && "length" in input) {
3760
3768
  normalizedInput = {
3761
3769
  kind: input.kind,
3762
- address: input.address,
3770
+ address: parseAddress16(input.address),
3763
3771
  length: input.length,
3764
3772
  condition: input.condition,
3765
3773
  label: input.label,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c64-debug-mcp",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "Model Context Protocol server for C64 debugging via VICE emulator",
5
5
  "type": "module",
6
6
  "keywords": [