@innominatum/agentforge-cli 1.0.7 → 1.0.8

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
@@ -619,6 +619,39 @@ pullCmd
619
619
  }
620
620
  await fs_extra_1.default.remove(contextDir);
621
621
  }
622
+ // Reconstruir ficheiros de memória a partir de JSONL
623
+ const memoryDir = path_1.default.join(agentPath, "memory");
624
+ if (await fs_extra_1.default.pathExists(memoryDir)) {
625
+ const processJsonl = async (filePath) => {
626
+ if (!(await fs_extra_1.default.pathExists(filePath)))
627
+ return;
628
+ const content = await fs_extra_1.default.readFile(filePath, 'utf8');
629
+ const lines = content.split('\n').filter(l => l.trim());
630
+ for (const line of lines) {
631
+ try {
632
+ const entry = JSON.parse(line);
633
+ if (entry.path && entry.content) {
634
+ const targetPath = path_1.default.join(agentPath, entry.path);
635
+ await fs_extra_1.default.ensureDir(path_1.default.dirname(targetPath));
636
+ await fs_extra_1.default.writeFile(targetPath, entry.content);
637
+ }
638
+ }
639
+ catch (e) { }
640
+ }
641
+ await fs_extra_1.default.remove(filePath);
642
+ };
643
+ await processJsonl(path_1.default.join(memoryDir, "global.jsonl"));
644
+ const usersDir = path_1.default.join(memoryDir, "users");
645
+ if (await fs_extra_1.default.pathExists(usersDir)) {
646
+ const userFiles = await fs_extra_1.default.readdir(usersDir);
647
+ for (const uf of userFiles) {
648
+ if (uf.endsWith(".jsonl")) {
649
+ await processJsonl(path_1.default.join(usersDir, uf));
650
+ }
651
+ }
652
+ await fs_extra_1.default.remove(usersDir);
653
+ }
654
+ }
622
655
  }
623
656
  finally {
624
657
  if (await fs_extra_1.default.pathExists(tempTarPath)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@innominatum/agentforge-cli",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "A powerful command-line interface to scaffold, manage, build, and deploy AI Agents and Skills for the GoClaw platform.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
package/src/index.ts CHANGED
@@ -677,6 +677,39 @@ pullCmd
677
677
  }
678
678
  await fs.remove(contextDir);
679
679
  }
680
+
681
+ // Reconstruir ficheiros de memória a partir de JSONL
682
+ const memoryDir = path.join(agentPath, "memory");
683
+ if (await fs.pathExists(memoryDir)) {
684
+ const processJsonl = async (filePath: string) => {
685
+ if (!(await fs.pathExists(filePath))) return;
686
+ const content = await fs.readFile(filePath, 'utf8');
687
+ const lines = content.split('\n').filter(l => l.trim());
688
+ for (const line of lines) {
689
+ try {
690
+ const entry = JSON.parse(line);
691
+ if (entry.path && entry.content) {
692
+ const targetPath = path.join(agentPath, entry.path);
693
+ await fs.ensureDir(path.dirname(targetPath));
694
+ await fs.writeFile(targetPath, entry.content);
695
+ }
696
+ } catch (e) {}
697
+ }
698
+ await fs.remove(filePath);
699
+ };
700
+
701
+ await processJsonl(path.join(memoryDir, "global.jsonl"));
702
+ const usersDir = path.join(memoryDir, "users");
703
+ if (await fs.pathExists(usersDir)) {
704
+ const userFiles = await fs.readdir(usersDir);
705
+ for (const uf of userFiles) {
706
+ if (uf.endsWith(".jsonl")) {
707
+ await processJsonl(path.join(usersDir, uf));
708
+ }
709
+ }
710
+ await fs.remove(usersDir);
711
+ }
712
+ }
680
713
  } finally {
681
714
  if (await fs.pathExists(tempTarPath)) {
682
715
  await fs.remove(tempTarPath);