spacecode 2.14.6 → 2.14.7

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/repl.mjs CHANGED
@@ -105054,7 +105054,7 @@ async function linkDependencyFolders(shell, top, dir) {
105054
105054
  await must(shell, `mkdir -p ${q2(`${dir}/${parent}`)} && { [ -e ${q2(`${dir}/${rel}`)} ] || ln -s ${q2(`${top}/${rel}`)} ${q2(`${dir}/${rel}`)}; }`, `linking ${rel}`);
105055
105055
  }
105056
105056
  }
105057
- async function createTaskWorktree(shell, cwd2, base, runId, taskId, attempt, warn = () => {
105057
+ async function createTaskWorktreeNow(shell, cwd2, base, runId, taskId, attempt, warn = () => {
105058
105058
  }) {
105059
105059
  const top = await must(shell, `cd ${q2(cwd2)} && git rev-parse --show-toplevel`, "finding the repository root");
105060
105060
  const commit = await must(shell, `cd ${q2(top)} && git stash create`, "snapshotting the working tree") || "HEAD";
@@ -105074,7 +105074,12 @@ async function removeTaskWorktree(shell, top, dir) {
105074
105074
  return err instanceof Error ? err.message : String(err);
105075
105075
  }
105076
105076
  }
105077
- var q2, safe, hash;
105077
+ function createTaskWorktree(...args) {
105078
+ const run = creating.then(() => createTaskWorktreeNow(...args));
105079
+ creating = run.catch(() => void 0);
105080
+ return run;
105081
+ }
105082
+ var q2, safe, hash, creating;
105078
105083
  var init_worktree = __esm({
105079
105084
  "src/core/worktree.ts"() {
105080
105085
  "use strict";
@@ -105085,6 +105090,7 @@ var init_worktree = __esm({
105085
105090
  for (let i = 0; i < s.length; i++) h = (h << 5) + h + s.charCodeAt(i) >>> 0;
105086
105091
  return h.toString(16);
105087
105092
  };
105093
+ creating = Promise.resolve();
105088
105094
  }
105089
105095
  });
105090
105096
 
@@ -105226,24 +105232,32 @@ async function runCoreTurn(d, prompt) {
105226
105232
  if (changed.length > 0) say(changed.map((id) => `task ${id}: ${now[id]}`).join(", "));
105227
105233
  cur.known = now;
105228
105234
  if (d.runLocalTask) {
105229
- let ran = false;
105235
+ const runLocalTask = d.runLocalTask;
105236
+ const todo = [];
105230
105237
  for (const id of state.order) {
105231
105238
  const t = state.tasks[id];
105232
105239
  const key = `${id}:${t.attempt ?? 1}`;
105233
105240
  if (t.status !== "assigned" || cur.started.includes(key)) continue;
105234
105241
  cur.started.push(key);
105235
105242
  say(`task ${id}: running on this machine`);
105243
+ todo.push({ id, attempt: t.attempt ?? 1, t });
105244
+ }
105245
+ const fatal = [];
105246
+ await Promise.all(todo.map(async ({ id, attempt, t }) => {
105236
105247
  try {
105237
- await d.runLocalTask({ taskId: id, attempt: t.attempt ?? 1, task: { role: t.role ?? "code", goal: t.goal ?? "", files: t.files ?? [], acceptance: t.acceptance ?? { kind: "none" }, deadlineMs: t.deadlineMs ?? 6e5, budgetTokens: t.budgetTokens ?? 5e4 } });
105248
+ await runLocalTask({ taskId: id, attempt, task: { role: t.role ?? "code", goal: t.goal ?? "", files: t.files ?? [], acceptance: t.acceptance ?? { kind: "none" }, deadlineMs: t.deadlineMs ?? 6e5, budgetTokens: t.budgetTokens ?? 5e4 } });
105238
105249
  } catch (err) {
105239
- if (d.signal.aborted || err instanceof TypeError || err instanceof ReferenceError) throw err;
105250
+ if (d.signal.aborted || err instanceof TypeError || err instanceof ReferenceError) {
105251
+ fatal.push(err);
105252
+ return;
105253
+ }
105240
105254
  const detail = err instanceof Error ? `${err.name}: ${err.message}` : String(err);
105241
- console.error("[core-turn] local task attempt could not run or report", JSON.stringify({ runId, taskId: id, attempt: t.attempt ?? 1, error: detail.slice(0, 300) }));
105255
+ console.error("[core-turn] local task attempt could not run or report", JSON.stringify({ runId, taskId: id, attempt, error: detail.slice(0, 300) }));
105242
105256
  say(`task ${id}: could not run or report locally (${err instanceof Error ? err.message : String(err)}); its deadline will fail it`);
105243
105257
  }
105244
- ran = true;
105245
- }
105246
- if (ran) {
105258
+ }));
105259
+ if (fatal.length > 0) throw fatal[0];
105260
+ if (todo.length > 0) {
105247
105261
  delay = 1e3;
105248
105262
  continue;
105249
105263
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spacecode",
3
- "version": "2.14.6",
3
+ "version": "2.14.7",
4
4
  "description": "SpaceCode - launch cloud dev environments with AI coding agents",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",