swarm-code 0.1.19 → 0.1.20

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.
@@ -18,6 +18,7 @@
18
18
  */
19
19
  import "./env.js";
20
20
  import * as fs from "node:fs";
21
+ import * as os from "node:os";
21
22
  import * as path from "node:path";
22
23
  import { readTextInput } from "./ui/text-input.js";
23
24
  // Dynamic imports — ensures env.js has set process.env BEFORE pi-ai loads
@@ -691,6 +692,25 @@ async function cmdConfigure(config, resolved) {
691
692
  default:
692
693
  logWarn("Invalid option");
693
694
  }
695
+ // Persist config changes to ~/.swarm/config.yaml
696
+ if (choice >= "1" && choice <= "7") {
697
+ try {
698
+ const configDir = path.join(os.homedir(), ".swarm");
699
+ fs.mkdirSync(configDir, { recursive: true });
700
+ const configLines = [
701
+ "# Swarm user preferences (updated by /configure)",
702
+ `# Updated: ${new Date().toISOString()}`,
703
+ "",
704
+ `default_agent: ${config.default_agent}`,
705
+ `default_model: ${config.default_model}`,
706
+ "",
707
+ ];
708
+ fs.writeFileSync(path.join(configDir, "config.yaml"), configLines.join("\n"), "utf-8");
709
+ }
710
+ catch {
711
+ // Non-fatal
712
+ }
713
+ }
694
714
  out.write("\n");
695
715
  }
696
716
  // ── Interactive banner ──────────────────────────────────────────────────────
@@ -842,6 +862,7 @@ export async function runInteractiveSwarm(rawArgs) {
842
862
  // Start Python REPL
843
863
  await repl.start(sessionAc.signal);
844
864
  let currentTaskAc = null;
865
+ let currentRunLog = null;
845
866
  let cleanupCalled = false;
846
867
  async function cleanup() {
847
868
  if (cleanupCalled)
@@ -885,6 +906,17 @@ export async function runInteractiveSwarm(rawArgs) {
885
906
  },
886
907
  files,
887
908
  });
909
+ // Log thread to current run
910
+ currentRunLog?.addThread({
911
+ id: threadId,
912
+ task,
913
+ agent: resolvedAgent,
914
+ model: resolvedModel,
915
+ success: result.success,
916
+ durationMs: result.durationMs,
917
+ filesChanged: result.filesChanged,
918
+ error: result.success ? undefined : result.summary,
919
+ });
888
920
  // Record episode or failure
889
921
  if (result.success) {
890
922
  if (episodicMemory && routeSlot) {
@@ -946,6 +978,7 @@ export async function runInteractiveSwarm(rawArgs) {
946
978
  spinner.start();
947
979
  const startTime = Date.now();
948
980
  const runLog = new RunLogger(query, resolved.model.id, config.default_agent, args.dir, config.max_iterations || 20);
981
+ currentRunLog = runLog;
949
982
  try {
950
983
  // Update episodic memory hints per-task
951
984
  let taskSystemPrompt = systemPrompt;
@@ -1017,6 +1050,7 @@ export async function runInteractiveSwarm(rawArgs) {
1017
1050
  finally {
1018
1051
  sessionAc.signal.removeEventListener("abort", onSessionAbort);
1019
1052
  currentTaskAc = null;
1053
+ currentRunLog = null;
1020
1054
  }
1021
1055
  };
1022
1056
  // Process a line of input
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swarm-code",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "description": "Open-source swarm-native coding agent orchestrator — spawns parallel coding agents in isolated git worktrees, built on RLM (arXiv:2512.24601)",
5
5
  "type": "module",
6
6
  "bin": {