@volter/supercode-orchestrator 0.5.213 → 0.5.214

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.
@@ -1027,7 +1027,9 @@ const ACTIONS = {
1027
1027
  if (task.current_run_id) throw new Error('End the current run before moving its card.');
1028
1028
  if ((value ?? null) === task.machine) return;
1029
1029
  if (task.workspace_kind !== 'scratch' && (!task.workspace_anchor || isWorkspacePath(task.workspace_anchor))) throw new Error('declare the repository and branch with workflow specify --workspace before moving a legacy path card');
1030
- if ((value ?? null) !== task.machine) run(ctx.db, 'UPDATE tasks SET workspace_path=NULL WHERE id=?', ctx.id);
1030
+ ACTIONS.forget_session(ctx, '*');
1031
+ run(ctx.db, 'UPDATE tasks SET workspace_path=NULL WHERE id=?', ctx.id);
1032
+ cardField(ctx, 'workspace_root', null);
1031
1033
  cardField(ctx, 'machine', value ?? null);
1032
1034
  return;
1033
1035
  }
@@ -78,8 +78,11 @@ export async function declareWorkspace(kind, value, machine, branch = null) {
78
78
  const info = await workspaceDoor(machine, 'inspect', value);
79
79
  if (kind === 'worktree' && info.linked) throw new Error('worktree workspace already names a linked worktree; name its repository for a solo worktree');
80
80
  if (kind === 'dir' && !info.branch && !branch) throw new Error('a detached checkout has no portable branch identity; name the repository and a solo worktree branch');
81
+ if (kind === 'dir' && info.linked && branch && branch !== info.branch) throw new Error(`worktree ${value} is on branch ${info.branch ?? '(detached)'}, not ${branch}`);
81
82
  const row = await workspaceDoor(machine, 'register', value);
82
- return { repository: row.repository, branch: branch ?? (kind === 'dir' ? row.branch : null), path: kind === 'dir' ? row.path : null };
83
+ // A primary path plus another branch names that repository's checkout of the branch. A matching explicit
84
+ // checkout stays pinned to the path the manager supplied, even when another clone has the same branch mapped.
85
+ return { repository: row.repository, branch: branch ?? (kind === 'dir' ? row.branch : null), path: kind === 'dir' && (!branch || branch === row.branch) ? row.path : null };
83
86
  }
84
87
  /** The checkouts this machine keeps of any repository on `branch`: where an arc changing several repositories
85
88
  * keeps its work in each of them (its own worktree aside). Another machine's map is not read from here. */
@@ -110,6 +113,14 @@ export async function resolveWorkspace(task, create = false) {
110
113
  if (info.linked) throw new Error('worktree declaration is already a linked worktree; name its repository instead');
111
114
  throw new Error('legacy worktree path needs registration and a repository declaration before launch');
112
115
  }
116
+ if (task.workspace_kind === 'dir' && task.workspace_path) {
117
+ const cached = await workspaceDoor(task.machine, 'inspect', task.workspace_path);
118
+ if (cached.repository !== repositoryId(declared) || (task.branch_name && cached.branch !== task.branch_name)) {
119
+ throw new Error(`card checkout ${task.workspace_path} does not match ${declared}, branch ${task.branch_name ?? '(primary)'}; retarget its workspace explicitly`);
120
+ }
121
+ if (create) await workspaceDoor(task.machine, 'register', cached.root);
122
+ return cached;
123
+ }
113
124
  // A primary checkout can change when another clone is registered. That does
114
125
  // not move an already allocated card worktree. Machine moves and workspace
115
126
  // retargets clear this runtime receipt; never borrow an arbitrary checkout.
@@ -119,6 +130,7 @@ export async function resolveWorkspace(task, create = false) {
119
130
  const cached = await workspaceDoor(task.machine, 'inspect', task.workspace_path);
120
131
  if (cached.linked && basename(cached.path) === worktreeFolder(task) && basename(dirname(cached.path)) === '.worktrees' &&
121
132
  cached.repository === repositoryId(declared) && cached.branch === worktreeBranch(task)) {
133
+ if (create) await workspaceDoor(task.machine, 'register', cached.root);
122
134
  return { ...cached, root: dirname(dirname(cached.path)) };
123
135
  }
124
136
  throw new Error(`card worktree ${task.workspace_path} does not match ${declared}, branch ${worktreeBranch(task)}; retarget its workspace explicitly`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-orchestrator",
3
- "version": "0.5.213",
3
+ "version": "0.5.214",
4
4
  "type": "module",
5
5
  "description": "The orchestrator runtime over the Volter Harness ontology: one typed operational model whose folder is its serialization, read and written through the harness orchestration doors (docs/ORCHESTRATOR-IR.md)",
6
6
  "exports": {
@@ -32,7 +32,7 @@
32
32
  "check-types": "node scripts/generate-types.mjs --check"
33
33
  },
34
34
  "dependencies": {
35
- "@volter/supercode-teams": "^0.3.344",
35
+ "@volter/supercode-teams": "^0.3.349",
36
36
  "@volter/supercode-terminal": "^0.3.10",
37
37
  "@volter/supercode-harness-sdk": "^0.3.104",
38
38
  "@volter/teams": "0.2.99",
@@ -62,5 +62,5 @@
62
62
  "apply",
63
63
  "README.md"
64
64
  ],
65
- "gitHead": "d017029f1b1d9293e295839a496be94a641b1ac0"
65
+ "gitHead": "2455341d186426df67c39d16ad03fdb021e2fe8e"
66
66
  }