@pennixrv/trellis 0.7.2-beta.7 → 0.7.2-beta.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.
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": "0.7.2-beta.8",
3
+ "description": "原生委派长等待不再阻塞主控操作",
4
+ "breaking": false,
5
+ "recommendMigrate": false,
6
+ "changelog": "delegate-wait 只在等待前后持有布局和任务锁;原生等待期间主控可检查其他工作包或中断当前节点。返回后重新核对当前授权、绑定、attempt与原生映射,拒绝已替换或核销的陈旧观察。",
7
+ "migrations": [],
8
+ "notes": "更新CLI并通过原生trellis update刷新task.py和委派模块;adapter协议及固定角色不变。"
9
+ }
@@ -307,6 +307,33 @@ def recover(root: Path, child_dir: Path, record: dict, path: Path, args):
307
307
  return adopted
308
308
 
309
309
 
310
+ def wait_for_node(args):
311
+ from .task_workflow import _task_dir, _task_lock
312
+ from .task_move import layout_lock, require_settled_layout
313
+ root = get_repo_root().resolve()
314
+ with layout_lock(root):
315
+ require_settled_layout(root)
316
+ child_dir = _task_dir(args.child_task)
317
+ with _task_lock(child_dir):
318
+ task_inputs(child_dir)
319
+ record, _ = current(root, child_dir)
320
+ if not record.get("agent_id") or record["status"] == "retired":
321
+ fail("wait requires a current mapped agent")
322
+ # Long native waits must leave the controller free to inspect or interrupt.
323
+ observations = adapter(record, "wait", {"agent_id": record["agent_id"], "cwd": record["worktree_path"], "timeout_ms": args.timeout_ms})
324
+ with layout_lock(root):
325
+ require_settled_layout(root)
326
+ child_dir = _task_dir(args.child_task)
327
+ with _task_lock(child_dir):
328
+ task_inputs(child_dir)
329
+ latest, _ = current(root, child_dir)
330
+ if any(latest.get(k) != record.get(k) for k in ["binding", "attempt_id", "agent_id", "workspace_id", "worktree_path"]) or latest["status"] == "retired":
331
+ fail("wait target changed; inspect current binding instead of using stale observations")
332
+ reports = {name: candidate(latest, name, current_head=False) for name in ["ready", "result", "blocked"]}
333
+ print(json.dumps({"record": latest, "observations": observations, "candidates": reports}, ensure_ascii=False))
334
+ return 0
335
+
336
+
310
337
  def run(args):
311
338
  from .task_workflow import _task_dir, _task_lock
312
339
  root = get_repo_root().resolve()
@@ -385,13 +412,13 @@ def run(args):
385
412
  save(path, record)
386
413
  assert_worktree(record)
387
414
  prepare_agent(root, child_dir, record, path)
388
- elif operation in {"inspect", "observe", "wait", "interrupt"}:
415
+ elif operation in {"inspect", "observe", "interrupt"}:
389
416
  if operation == "interrupt":
390
417
  if record.get("intent"):
391
418
  fail("resolve prior intent before interrupt; native emergency cancellation remains available")
392
419
  record["intent"] = "interrupt_pending"
393
420
  save(path, record)
394
- observations = adapter(record, "wait" if operation == "wait" else "interrupt" if operation == "interrupt" else "observe" if record.get("agent_id") else "inspect", {"agent_id": record["agent_id"], "cwd": record["worktree_path"], **({"timeout_ms": args.timeout_ms} if operation == "wait" else {})} if record.get("agent_id") else {"target": b["target_locator"], **({"workspace_id": record["workspace_id"]} if record.get("workspace_id") else {})})
421
+ observations = adapter(record, "interrupt" if operation == "interrupt" else "observe" if record.get("agent_id") else "inspect", {"agent_id": record["agent_id"], "cwd": record["worktree_path"]} if record.get("agent_id") else {"target": b["target_locator"], **({"workspace_id": record["workspace_id"]} if record.get("workspace_id") else {})})
395
422
  if operation == "interrupt":
396
423
  record.setdefault("interrupt_receipts", []).append(observations)
397
424
  record["intent"] = None
@@ -940,6 +940,9 @@ def main() -> int:
940
940
  }
941
941
 
942
942
  try:
943
+ if args.command == "delegate-wait":
944
+ from common.worktree_delegation import wait_for_node
945
+ return wait_for_node(args)
943
946
  with layout_lock(get_repo_root()):
944
947
  if args.command != "migrate-layout":
945
948
  require_settled_layout(get_repo_root())
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pennixrv/trellis",
3
- "version": "0.7.2-beta.7",
3
+ "version": "0.7.2-beta.8",
4
4
  "description": "AI capabilities grow like ivy — Trellis provides the structure to guide them along a disciplined path",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -35,7 +35,7 @@
35
35
  "inquirer": "^9.3.7",
36
36
  "undici": "^6.21.0",
37
37
  "zod": "^4.4.2",
38
- "@pennixrv/trellis-core": "0.7.2-beta.7"
38
+ "@pennixrv/trellis-core": "0.7.2-beta.8"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@eslint/js": "^9.18.0",