@polka-codes/core 0.9.48 → 0.9.50

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/index.js CHANGED
@@ -455,30 +455,64 @@ var fetchUrl_default = {
455
455
  handler: handler3
456
456
  };
457
457
 
458
- // src/tools/listFiles.ts
458
+ // src/tools/getTodoItem.ts
459
459
  import { z as z5 } from "zod";
460
460
  var toolInfo4 = {
461
+ name: "getTodoItem",
462
+ description: "Get a to-do item by its ID.",
463
+ parameters: z5.object({
464
+ id: z5.string().describe("The ID of the to-do item.")
465
+ })
466
+ };
467
+ var handler4 = async (provider, args) => {
468
+ if (!provider.getTodoItem) {
469
+ return {
470
+ type: "Error" /* Error */,
471
+ message: {
472
+ type: "error-text",
473
+ value: "Not possible to get a to-do item."
474
+ }
475
+ };
476
+ }
477
+ const { id } = toolInfo4.parameters.parse(args);
478
+ const item = await provider.getTodoItem(id);
479
+ return {
480
+ type: "Reply" /* Reply */,
481
+ message: {
482
+ type: "json",
483
+ value: item ?? null
484
+ }
485
+ };
486
+ };
487
+ var getTodoItem_default = {
488
+ ...toolInfo4,
489
+ handler: handler4
490
+ };
491
+
492
+ // src/tools/listFiles.ts
493
+ import { z as z6 } from "zod";
494
+ var toolInfo5 = {
461
495
  name: "listFiles",
462
496
  description: "Request to list files and directories within the specified directory. If recursive is true, it will list all files and directories recursively. If recursive is false or not provided, it will only list the top-level contents. Do not use this tool to confirm the existence of files you may have created, as the user will let you know if the files were created successfully or not.",
463
- parameters: z5.object({
464
- path: z5.string().describe("The path of the directory to list contents for (relative to the current working directory)").meta({ usageValue: "Directory path here" }),
465
- maxCount: z5.coerce.number().optional().default(2e3).describe("The maximum number of files to list. Default to 2000").meta({ usageValue: "Maximum number of files to list (optional)" }),
466
- recursive: z5.preprocess((val) => {
497
+ parameters: z6.object({
498
+ path: z6.string().describe("The path of the directory to list contents for (relative to the current working directory)").meta({ usageValue: "Directory path here" }),
499
+ maxCount: z6.coerce.number().optional().default(2e3).describe("The maximum number of files to list. Default to 2000").meta({ usageValue: "Maximum number of files to list (optional)" }),
500
+ recursive: z6.preprocess((val) => {
467
501
  if (typeof val === "string") {
468
502
  const lower = val.toLowerCase();
469
503
  if (lower === "false") return false;
470
504
  if (lower === "true") return true;
471
505
  }
472
506
  return val;
473
- }, z5.boolean().optional().default(true)).describe("Whether to list files recursively. Use true for recursive listing, false or omit for top-level only.").meta({ usageValue: "true or false (optional)" }),
474
- includeIgnored: z5.preprocess((val) => {
507
+ }, z6.boolean().optional().default(true)).describe("Whether to list files recursively. Use true for recursive listing, false or omit for top-level only.").meta({ usageValue: "true or false (optional)" }),
508
+ includeIgnored: z6.preprocess((val) => {
475
509
  if (typeof val === "string") {
476
510
  const lower = val.toLowerCase();
477
511
  if (lower === "false") return false;
478
512
  if (lower === "true") return true;
479
513
  }
480
514
  return val;
481
- }, z5.boolean().optional().default(false)).describe("Whether to include ignored files. Use true to include files ignored by .gitignore.").meta({ usageValue: "true or false (optional)" })
515
+ }, z6.boolean().optional().default(false)).describe("Whether to include ignored files. Use true to include files ignored by .gitignore.").meta({ usageValue: "true or false (optional)" })
482
516
  }).meta({
483
517
  examples: [
484
518
  {
@@ -491,7 +525,7 @@ var toolInfo4 = {
491
525
  ]
492
526
  })
493
527
  };
494
- var handler4 = async (provider, args) => {
528
+ var handler5 = async (provider, args) => {
495
529
  if (!provider.listFiles) {
496
530
  return {
497
531
  type: "Error" /* Error */,
@@ -501,7 +535,7 @@ var handler4 = async (provider, args) => {
501
535
  }
502
536
  };
503
537
  }
504
- const { path, maxCount, recursive, includeIgnored } = toolInfo4.parameters.parse(args);
538
+ const { path, maxCount, recursive, includeIgnored } = toolInfo5.parameters.parse(args);
505
539
  const [files, limitReached] = await provider.listFiles(path, recursive, maxCount, includeIgnored);
506
540
  return {
507
541
  type: "Reply" /* Reply */,
@@ -516,18 +550,18 @@ ${files.join("\n")}
516
550
  };
517
551
  };
518
552
  var listFiles_default = {
519
- ...toolInfo4,
520
- handler: handler4
553
+ ...toolInfo5,
554
+ handler: handler5
521
555
  };
522
556
 
523
557
  // src/tools/listMemoryTopics.ts
524
- import { z as z6 } from "zod";
525
- var toolInfo5 = {
558
+ import { z as z7 } from "zod";
559
+ var toolInfo6 = {
526
560
  name: "listMemoryTopics",
527
- description: "Lists all topics in memory.",
528
- parameters: z6.object({})
561
+ description: "Lists all topics in memory. Use this to see what information has been stored and which topics are available to read from.",
562
+ parameters: z7.object({})
529
563
  };
530
- var handler5 = async (provider, _args) => {
564
+ var handler6 = async (provider, _args) => {
531
565
  const topics = await provider.listMemoryTopics();
532
566
  if (!topics.length) {
533
567
  return { type: "Reply" /* Reply */, message: { type: "text", value: "No topics found." } };
@@ -542,12 +576,109 @@ ${topics.join("\n")}`
542
576
  };
543
577
  };
544
578
  var listMemoryTopics_default = {
545
- ...toolInfo5,
546
- handler: handler5
579
+ ...toolInfo6,
580
+ handler: handler6
581
+ };
582
+
583
+ // src/tools/listTodoItems.ts
584
+ import { z as z9 } from "zod";
585
+
586
+ // src/tools/todo.ts
587
+ import { z as z8 } from "zod";
588
+ var TodoStatus = z8.enum(["open", "completed", "closed"]);
589
+ var TodoItemSchema = z8.object({
590
+ id: z8.string(),
591
+ title: z8.string(),
592
+ description: z8.string(),
593
+ status: TodoStatus
594
+ });
595
+ var UpdateTodoItemInputSchema = z8.object({
596
+ operation: z8.enum(["add", "update"]),
597
+ id: z8.string().nullish(),
598
+ parentId: z8.string().nullish(),
599
+ title: z8.string().nullish(),
600
+ description: z8.string().nullish(),
601
+ status: TodoStatus.nullish()
602
+ }).superRefine((data, ctx) => {
603
+ if (data.operation === "add") {
604
+ if (!data.title) {
605
+ ctx.addIssue({
606
+ code: "custom",
607
+ message: 'Title is required for "add" operation',
608
+ path: ["title"]
609
+ });
610
+ }
611
+ } else if (data.operation === "update") {
612
+ if (!data.id) {
613
+ ctx.addIssue({
614
+ code: "custom",
615
+ message: 'ID is required for "update" operation',
616
+ path: ["id"]
617
+ });
618
+ }
619
+ }
620
+ });
621
+ var UpdateTodoItemOutputSchema = z8.object({
622
+ id: z8.string()
623
+ });
624
+
625
+ // src/tools/listTodoItems.ts
626
+ var toolInfo7 = {
627
+ name: "listTodoItems",
628
+ description: "List all to-do items, sorted by id. If an id is provided, it lists all sub-items for that id. Can be filtered by status.",
629
+ parameters: z9.object({
630
+ id: z9.string().nullish(),
631
+ status: TodoStatus.nullish()
632
+ })
633
+ };
634
+ var handler7 = async (provider, args) => {
635
+ if (!provider.listTodoItems) {
636
+ return {
637
+ type: "Error" /* Error */,
638
+ message: {
639
+ type: "error-text",
640
+ value: "Not possible to list to-do items."
641
+ }
642
+ };
643
+ }
644
+ const { id, status } = toolInfo7.parameters.parse(args);
645
+ const items = await provider.listTodoItems(id, status);
646
+ return {
647
+ type: "Reply" /* Reply */,
648
+ message: {
649
+ type: "json",
650
+ value: items
651
+ }
652
+ };
653
+ };
654
+ var listTodoItems_default = {
655
+ ...toolInfo7,
656
+ handler: handler7
547
657
  };
548
658
 
549
659
  // src/tools/provider.ts
550
660
  var MockProvider = class {
661
+ async listTodoItems(id, _status) {
662
+ if (id) {
663
+ return [{ id: `${id}-1`, title: "mock sub item", status: "open", description: "" }];
664
+ }
665
+ return [{ id: "1", title: "mock item", status: "open", description: "" }];
666
+ }
667
+ async getTodoItem(id) {
668
+ return {
669
+ id,
670
+ title: "mock item",
671
+ description: "mock desc",
672
+ status: "open",
673
+ subItems: []
674
+ };
675
+ }
676
+ async updateTodoItem(input) {
677
+ if (input.operation === "add") {
678
+ return { id: "2" };
679
+ }
680
+ return { id: input.id };
681
+ }
551
682
  async readFile(_path, _includeIgnored) {
552
683
  return "mock content";
553
684
  }
@@ -584,15 +715,15 @@ var MockProvider = class {
584
715
  };
585
716
 
586
717
  // src/tools/readBinaryFile.ts
587
- import { z as z7 } from "zod";
588
- var toolInfo6 = {
718
+ import { z as z10 } from "zod";
719
+ var toolInfo8 = {
589
720
  name: "readBinaryFile",
590
721
  description: "Read a binary file from a URL or local path. Use file:// prefix to access local files. This can be used to access non-text files such as PDFs or images.",
591
- parameters: z7.object({
592
- url: z7.string().describe("The URL or local path of the file to read.")
722
+ parameters: z10.object({
723
+ url: z10.string().describe("The URL or local path of the file to read.")
593
724
  })
594
725
  };
595
- var handler6 = async (provider, args) => {
726
+ var handler8 = async (provider, args) => {
596
727
  if (!provider.readBinaryFile) {
597
728
  return {
598
729
  type: "Error" /* Error */,
@@ -602,7 +733,7 @@ var handler6 = async (provider, args) => {
602
733
  }
603
734
  };
604
735
  }
605
- const { url } = toolInfo6.parameters.parse(args);
736
+ const { url } = toolInfo8.parameters.parse(args);
606
737
  try {
607
738
  const filePart = await provider.readBinaryFile(url);
608
739
  return {
@@ -631,29 +762,29 @@ var handler6 = async (provider, args) => {
631
762
  }
632
763
  };
633
764
  var readBinaryFile_default = {
634
- ...toolInfo6,
635
- handler: handler6
765
+ ...toolInfo8,
766
+ handler: handler8
636
767
  };
637
768
 
638
769
  // src/tools/readFile.ts
639
- import { z as z8 } from "zod";
640
- var toolInfo7 = {
770
+ import { z as z11 } from "zod";
771
+ var toolInfo9 = {
641
772
  name: "readFile",
642
773
  description: "Request to read the contents of one or multiple files at the specified paths. Use comma separated paths to read multiple files. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. May not be suitable for other types of binary files, as it returns the raw content as a string. Try to list all the potential files are relevent to the task, and then use this tool to read all the relevant files.",
643
- parameters: z8.object({
644
- path: z8.preprocess((val) => {
774
+ parameters: z11.object({
775
+ path: z11.preprocess((val) => {
645
776
  if (!val) return [];
646
777
  const values = Array.isArray(val) ? val : [val];
647
778
  return values.flatMap((i) => typeof i === "string" ? i.split(",") : []).filter((s) => s.length > 0);
648
- }, z8.array(z8.string())).describe("The path of the file to read").meta({ usageValue: "Comma separated paths here" }),
649
- includeIgnored: z8.preprocess((val) => {
779
+ }, z11.array(z11.string())).describe("The path of the file to read").meta({ usageValue: "Comma separated paths here" }),
780
+ includeIgnored: z11.preprocess((val) => {
650
781
  if (typeof val === "string") {
651
782
  const lower = val.toLowerCase();
652
783
  if (lower === "false") return false;
653
784
  if (lower === "true") return true;
654
785
  }
655
786
  return val;
656
- }, z8.boolean().optional().default(false)).describe("Whether to include ignored files. Use true to include files ignored by .gitignore.").meta({ usageValue: "true or false (optional)" })
787
+ }, z11.boolean().optional().default(false)).describe("Whether to include ignored files. Use true to include files ignored by .gitignore.").meta({ usageValue: "true or false (optional)" })
657
788
  }).meta({
658
789
  examples: [
659
790
  {
@@ -671,7 +802,7 @@ var toolInfo7 = {
671
802
  ]
672
803
  })
673
804
  };
674
- var handler7 = async (provider, args) => {
805
+ var handler9 = async (provider, args) => {
675
806
  if (!provider.readFile) {
676
807
  return {
677
808
  type: "Error" /* Error */,
@@ -681,7 +812,7 @@ var handler7 = async (provider, args) => {
681
812
  }
682
813
  };
683
814
  }
684
- const { path: paths, includeIgnored } = toolInfo7.parameters.parse(args);
815
+ const { path: paths, includeIgnored } = toolInfo9.parameters.parse(args);
685
816
  const resp = [];
686
817
  for (const path of paths) {
687
818
  const fileContent = await provider.readFile(path, includeIgnored);
@@ -705,21 +836,21 @@ var handler7 = async (provider, args) => {
705
836
  };
706
837
  };
707
838
  var readFile_default = {
708
- ...toolInfo7,
709
- handler: handler7
839
+ ...toolInfo9,
840
+ handler: handler9
710
841
  };
711
842
 
712
843
  // src/tools/readMemory.ts
713
- import { z as z9 } from "zod";
714
- var toolInfo8 = {
844
+ import { z as z12 } from "zod";
845
+ var toolInfo10 = {
715
846
  name: "readMemory",
716
- description: "Reads content from a memory topic.",
717
- parameters: z9.object({
718
- topic: z9.string().optional().describe('The topic to read from memory. Defaults to ":default:".')
847
+ description: "Reads content from a memory topic. Use this to retrieve information stored in previous steps. If no topic is specified, reads from the default topic.",
848
+ parameters: z12.object({
849
+ topic: z12.string().optional().describe('The topic to read from memory. Defaults to ":default:".')
719
850
  })
720
851
  };
721
- var handler8 = async (provider, args) => {
722
- const { topic } = toolInfo8.parameters.parse(args);
852
+ var handler10 = async (provider, args) => {
853
+ const { topic } = toolInfo10.parameters.parse(args);
723
854
  const content = await provider.readMemory(topic);
724
855
  if (content) {
725
856
  return {
@@ -741,17 +872,17 @@ ${content}
741
872
  };
742
873
  };
743
874
  var readMemory_default = {
744
- ...toolInfo8,
745
- handler: handler8
875
+ ...toolInfo10,
876
+ handler: handler10
746
877
  };
747
878
 
748
879
  // src/tools/removeFile.ts
749
- import { z as z10 } from "zod";
750
- var toolInfo9 = {
880
+ import { z as z13 } from "zod";
881
+ var toolInfo11 = {
751
882
  name: "removeFile",
752
883
  description: "Request to remove a file at the specified path.",
753
- parameters: z10.object({
754
- path: z10.string().describe("The path of the file to remove").meta({ usageValue: "File path here" })
884
+ parameters: z13.object({
885
+ path: z13.string().describe("The path of the file to remove").meta({ usageValue: "File path here" })
755
886
  }).meta({
756
887
  examples: [
757
888
  {
@@ -763,7 +894,7 @@ var toolInfo9 = {
763
894
  ]
764
895
  })
765
896
  };
766
- var handler9 = async (provider, args) => {
897
+ var handler11 = async (provider, args) => {
767
898
  if (!provider.removeFile) {
768
899
  return {
769
900
  type: "Error" /* Error */,
@@ -773,7 +904,7 @@ var handler9 = async (provider, args) => {
773
904
  }
774
905
  };
775
906
  }
776
- const parsed = toolInfo9.parameters.safeParse(args);
907
+ const parsed = toolInfo11.parameters.safeParse(args);
777
908
  if (!parsed.success) {
778
909
  return {
779
910
  type: "Error" /* Error */,
@@ -794,18 +925,18 @@ var handler9 = async (provider, args) => {
794
925
  };
795
926
  };
796
927
  var removeFile_default = {
797
- ...toolInfo9,
798
- handler: handler9
928
+ ...toolInfo11,
929
+ handler: handler11
799
930
  };
800
931
 
801
932
  // src/tools/renameFile.ts
802
- import { z as z11 } from "zod";
803
- var toolInfo10 = {
933
+ import { z as z14 } from "zod";
934
+ var toolInfo12 = {
804
935
  name: "renameFile",
805
936
  description: "Request to rename a file from source path to target path.",
806
- parameters: z11.object({
807
- source_path: z11.string().describe("The current path of the file").meta({ usageValue: "Source file path here" }),
808
- target_path: z11.string().describe("The new path for the file").meta({ usageValue: "Target file path here" })
937
+ parameters: z14.object({
938
+ source_path: z14.string().describe("The current path of the file").meta({ usageValue: "Source file path here" }),
939
+ target_path: z14.string().describe("The new path for the file").meta({ usageValue: "Target file path here" })
809
940
  }).meta({
810
941
  examples: [
811
942
  {
@@ -818,7 +949,7 @@ var toolInfo10 = {
818
949
  ]
819
950
  })
820
951
  };
821
- var handler10 = async (provider, args) => {
952
+ var handler12 = async (provider, args) => {
822
953
  if (!provider.renameFile) {
823
954
  return {
824
955
  type: "Error" /* Error */,
@@ -828,7 +959,7 @@ var handler10 = async (provider, args) => {
828
959
  }
829
960
  };
830
961
  }
831
- const { source_path, target_path } = toolInfo10.parameters.parse(args);
962
+ const { source_path, target_path } = toolInfo12.parameters.parse(args);
832
963
  await provider.renameFile(source_path, target_path);
833
964
  return {
834
965
  type: "Reply" /* Reply */,
@@ -839,16 +970,16 @@ var handler10 = async (provider, args) => {
839
970
  };
840
971
  };
841
972
  var renameFile_default = {
842
- ...toolInfo10,
843
- handler: handler10
973
+ ...toolInfo12,
974
+ handler: handler12
844
975
  };
845
976
 
846
977
  // src/tools/replaceInFile.ts
847
- import { z as z12 } from "zod";
978
+ import { z as z15 } from "zod";
848
979
 
849
980
  // src/tools/utils/replaceInFile.ts
850
981
  var replaceInFile = (fileContent, diff) => {
851
- const blockPattern = /<<<<<+ SEARCH>?\s*\r?\n([\s\S]*?)\r?\n=======[ \t]*\r?\n([\s\S]*?)\r?\n?>>>>>+ REPLACE/g;
982
+ const blockPattern = /^\s*<<<<<+\s*SEARCH>?\s*\r?\n([\s\S]*?)\r?\n=======[ \t]*\r?\n([\s\S]*?)\r?\n?>>>>>+\s*REPLACE\s*$/gm;
852
983
  const blocks = [];
853
984
  for (let match = blockPattern.exec(diff); match !== null; match = blockPattern.exec(diff)) {
854
985
  blocks.push({ search: match[1], replace: match[2] });
@@ -921,12 +1052,12 @@ var replaceInFile = (fileContent, diff) => {
921
1052
  };
922
1053
 
923
1054
  // src/tools/replaceInFile.ts
924
- var toolInfo11 = {
1055
+ var toolInfo13 = {
925
1056
  name: "replaceInFile",
926
1057
  description: "Request to replace sections of content in an existing file using SEARCH/REPLACE blocks that define exact changes to specific parts of the file. This tool should be used when you need to make targeted changes to specific parts of a file.",
927
- parameters: z12.object({
928
- path: z12.string().describe("The path of the file to modify").meta({ usageValue: "File path here" }),
929
- diff: z12.string().describe(
1058
+ parameters: z15.object({
1059
+ path: z15.string().describe("The path of the file to modify").meta({ usageValue: "File path here" }),
1060
+ diff: z15.string().describe(
930
1061
  `One or more SEARCH/REPLACE blocks following this exact format:
931
1062
  \`\`\`
932
1063
  <<<<<<< SEARCH
@@ -1033,7 +1164,7 @@ function oldFeature() {
1033
1164
  ]
1034
1165
  })
1035
1166
  };
1036
- var handler11 = async (provider, args) => {
1167
+ var handler13 = async (provider, args) => {
1037
1168
  if (!provider.readFile || !provider.writeFile) {
1038
1169
  return {
1039
1170
  type: "Error" /* Error */,
@@ -1043,7 +1174,7 @@ var handler11 = async (provider, args) => {
1043
1174
  }
1044
1175
  };
1045
1176
  }
1046
- const parsed = toolInfo11.parameters.safeParse(args);
1177
+ const parsed = toolInfo13.parameters.safeParse(args);
1047
1178
  if (!parsed.success) {
1048
1179
  return {
1049
1180
  type: "Error" /* Error */,
@@ -1107,23 +1238,23 @@ var handler11 = async (provider, args) => {
1107
1238
  }
1108
1239
  };
1109
1240
  var replaceInFile_default = {
1110
- ...toolInfo11,
1111
- handler: handler11
1241
+ ...toolInfo13,
1242
+ handler: handler13
1112
1243
  };
1113
1244
 
1114
1245
  // src/tools/searchFiles.ts
1115
- import { z as z13 } from "zod";
1116
- var toolInfo12 = {
1246
+ import { z as z16 } from "zod";
1247
+ var toolInfo14 = {
1117
1248
  name: "searchFiles",
1118
1249
  description: "Request to perform a regex search across files in a specified directory, outputting context-rich results that include surrounding lines. This tool searches for patterns or specific content across multiple files, displaying each match with encapsulating context.",
1119
- parameters: z13.object({
1120
- path: z13.string().describe(
1250
+ parameters: z16.object({
1251
+ path: z16.string().describe(
1121
1252
  "The path of the directory to search in (relative to the current working directory). This directory will be recursively searched."
1122
1253
  ).meta({ usageValue: "Directory path here" }),
1123
- regex: z13.string().describe("The regular expression pattern to search for. Uses Rust regex syntax.").meta({
1254
+ regex: z16.string().describe("The regular expression pattern to search for. Uses Rust regex syntax.").meta({
1124
1255
  usageValue: "Your regex pattern here"
1125
1256
  }),
1126
- filePattern: z13.string().optional().describe(
1257
+ filePattern: z16.string().optional().describe(
1127
1258
  'Comma-separated glob pattern to filter files (e.g., "*.ts" for TypeScript files or "*.ts,*.js" for both TypeScript and JavaScript files). If not provided, it will search all files (*).'
1128
1259
  ).meta({
1129
1260
  usageValue: "file pattern here (optional)"
@@ -1141,7 +1272,7 @@ var toolInfo12 = {
1141
1272
  ]
1142
1273
  })
1143
1274
  };
1144
- var handler12 = async (provider, args) => {
1275
+ var handler14 = async (provider, args) => {
1145
1276
  if (!provider.searchFiles) {
1146
1277
  return {
1147
1278
  type: "Error" /* Error */,
@@ -1151,7 +1282,7 @@ var handler12 = async (provider, args) => {
1151
1282
  }
1152
1283
  };
1153
1284
  }
1154
- const parsed = toolInfo12.parameters.safeParse(args);
1285
+ const parsed = toolInfo14.parameters.safeParse(args);
1155
1286
  if (!parsed.success) {
1156
1287
  return {
1157
1288
  type: "Error" /* Error */,
@@ -1188,19 +1319,19 @@ ${files.join("\n")}
1188
1319
  }
1189
1320
  };
1190
1321
  var searchFiles_default = {
1191
- ...toolInfo12,
1192
- handler: handler12
1322
+ ...toolInfo14,
1323
+ handler: handler14
1193
1324
  };
1194
1325
 
1195
1326
  // src/tools/updateMemory.ts
1196
- import { z as z14 } from "zod";
1197
- var toolInfo13 = {
1327
+ import { z as z17 } from "zod";
1328
+ var toolInfo15 = {
1198
1329
  name: "updateMemory",
1199
- description: "Appends, replaces, or removes content from a memory topic.",
1200
- parameters: z14.object({
1201
- operation: z14.enum(["append", "replace", "remove"]).describe("The operation to perform."),
1202
- topic: z14.string().nullish().describe('The topic to update in memory. Defaults to ":default:".'),
1203
- content: z14.string().optional().describe("The content for append or replace operations. Must be omitted for remove operation.")
1330
+ description: 'Appends, replaces, or removes content from a memory topic. Use "append" to add to existing content, "replace" to overwrite entirely, or "remove" to delete a topic. Memory persists across tool calls within a workflow.',
1331
+ parameters: z17.object({
1332
+ operation: z17.enum(["append", "replace", "remove"]).describe("The operation to perform."),
1333
+ topic: z17.string().nullish().describe('The topic to update in memory. Defaults to ":default:".'),
1334
+ content: z17.string().optional().describe("The content for append or replace operations. Must be omitted for remove operation.")
1204
1335
  }).superRefine((data, ctx) => {
1205
1336
  if (data.operation === "append" || data.operation === "replace") {
1206
1337
  if (data.content === void 0) {
@@ -1221,7 +1352,7 @@ var toolInfo13 = {
1221
1352
  }
1222
1353
  })
1223
1354
  };
1224
- var handler13 = async (provider, args) => {
1355
+ var handler15 = async (provider, args) => {
1225
1356
  if (!provider.updateMemory) {
1226
1357
  return {
1227
1358
  type: "Error" /* Error */,
@@ -1231,7 +1362,7 @@ var handler13 = async (provider, args) => {
1231
1362
  }
1232
1363
  };
1233
1364
  }
1234
- const params = toolInfo13.parameters.parse(args);
1365
+ const params = toolInfo15.parameters.parse(args);
1235
1366
  await provider.updateMemory(params.operation, params.topic ?? void 0, "content" in params ? params.content : void 0);
1236
1367
  switch (params.operation) {
1237
1368
  case "append":
@@ -1261,18 +1392,49 @@ var handler13 = async (provider, args) => {
1261
1392
  }
1262
1393
  };
1263
1394
  var updateMemory_default = {
1264
- ...toolInfo13,
1265
- handler: handler13
1395
+ ...toolInfo15,
1396
+ handler: handler15
1397
+ };
1398
+
1399
+ // src/tools/updateTodoItem.ts
1400
+ var toolInfo16 = {
1401
+ name: "updateTodoItem",
1402
+ description: "Add or update a to-do item.",
1403
+ parameters: UpdateTodoItemInputSchema
1404
+ };
1405
+ var handler16 = async (provider, args) => {
1406
+ if (!provider.updateTodoItem) {
1407
+ return {
1408
+ type: "Error" /* Error */,
1409
+ message: {
1410
+ type: "error-text",
1411
+ value: "Not possible to update a to-do item."
1412
+ }
1413
+ };
1414
+ }
1415
+ const input = toolInfo16.parameters.parse(args);
1416
+ const result = await provider.updateTodoItem(input);
1417
+ return {
1418
+ type: "Reply" /* Reply */,
1419
+ message: {
1420
+ type: "json",
1421
+ value: result
1422
+ }
1423
+ };
1424
+ };
1425
+ var updateTodoItem_default = {
1426
+ ...toolInfo16,
1427
+ handler: handler16
1266
1428
  };
1267
1429
 
1268
1430
  // src/tools/writeToFile.ts
1269
- import { z as z15 } from "zod";
1270
- var toolInfo14 = {
1431
+ import { z as z18 } from "zod";
1432
+ var toolInfo17 = {
1271
1433
  name: "writeToFile",
1272
1434
  description: "Request to write content to a file at the specified path. If the file exists, it will be overwritten with the provided content. If the file doesn't exist, it will be created. This tool will automatically create any directories needed to write the file. Ensure that the output content does not include incorrect escaped character patterns such as `&lt;`, `&gt;`, or `&amp;`. Also ensure there is no unwanted CDATA tags in the content.",
1273
- parameters: z15.object({
1274
- path: z15.string().describe("The path of the file to write to").meta({ usageValue: "File path here" }),
1275
- content: z15.string().describe(
1435
+ parameters: z18.object({
1436
+ path: z18.string().describe("The path of the file to write to").meta({ usageValue: "File path here" }),
1437
+ content: z18.string().describe(
1276
1438
  "The content to write to the file. ALWAYS provide the COMPLETE intended content of the file, without any truncation or omissions. You MUST include ALL parts of the file, even if they haven't been modified."
1277
1439
  ).meta({ usageValue: "Your file content here" })
1278
1440
  }).meta({
@@ -1298,7 +1460,7 @@ export default App;
1298
1460
  ]
1299
1461
  })
1300
1462
  };
1301
- var handler14 = async (provider, args) => {
1463
+ var handler17 = async (provider, args) => {
1302
1464
  if (!provider.writeFile) {
1303
1465
  return {
1304
1466
  type: "Error" /* Error */,
@@ -1308,7 +1470,7 @@ var handler14 = async (provider, args) => {
1308
1470
  }
1309
1471
  };
1310
1472
  }
1311
- const parsed = toolInfo14.parameters.safeParse(args);
1473
+ const parsed = toolInfo17.parameters.safeParse(args);
1312
1474
  if (!parsed.success) {
1313
1475
  return {
1314
1476
  type: "Error" /* Error */,
@@ -1331,8 +1493,8 @@ var handler14 = async (provider, args) => {
1331
1493
  };
1332
1494
  };
1333
1495
  var writeToFile_default = {
1334
- ...toolInfo14,
1335
- handler: handler14
1496
+ ...toolInfo17,
1497
+ handler: handler17
1336
1498
  };
1337
1499
 
1338
1500
  // src/UsageMeter.ts
@@ -1484,15 +1646,21 @@ var UsageMeter = class {
1484
1646
  };
1485
1647
  export {
1486
1648
  MockProvider,
1649
+ TodoItemSchema,
1650
+ TodoStatus,
1487
1651
  ToolResponseType,
1652
+ UpdateTodoItemInputSchema,
1653
+ UpdateTodoItemOutputSchema,
1488
1654
  UsageMeter,
1489
1655
  askFollowupQuestion_default as askFollowupQuestion,
1490
1656
  computeRateLimitBackoffSeconds,
1491
1657
  configSchema,
1492
1658
  executeCommand_default as executeCommand,
1493
1659
  fetchUrl_default as fetchUrl,
1660
+ getTodoItem_default as getTodoItem,
1494
1661
  listFiles_default as listFiles,
1495
1662
  listMemoryTopics_default as listMemoryTopics,
1663
+ listTodoItems_default as listTodoItems,
1496
1664
  parseJsonFromMarkdown,
1497
1665
  readBinaryFile_default as readBinaryFile,
1498
1666
  readFile_default as readFile,
@@ -1504,5 +1672,6 @@ export {
1504
1672
  responsePrompts,
1505
1673
  searchFiles_default as searchFiles,
1506
1674
  updateMemory_default as updateMemory,
1675
+ updateTodoItem_default as updateTodoItem,
1507
1676
  writeToFile_default as writeToFile
1508
1677
  };