@pennixrv/trellis 0.7.2-beta.6 → 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.7",
3
+ "description": "修复 daemon PATH 差异和已拒绝请求的幂等键冲突",
4
+ "breaking": false,
5
+ "recommendMigrate": false,
6
+ "changelog": "必需 CodeGraph 由主控解析并核验绝对入口,避免 daemon PATH 不含用户安装目录导致 MCP 缺失;agent 创建幂等键包含实际请求指纹,相同请求保持稳定,经显式核验未创建后修正的请求不再撞旧指纹。",
7
+ "migrations": [],
8
+ "notes": "同步更新 CLI、可选 adapter 和原生项目资产;准备缺项仍阻断 execute,未知创建仍须原生对账,不能自动重试。"
9
+ }
@@ -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
+ }
@@ -6,6 +6,7 @@ import json
6
6
  import os
7
7
  from pathlib import Path
8
8
  import re
9
+ import shutil
9
10
  import subprocess
10
11
  import uuid
11
12
  from typing import NoReturn
@@ -241,9 +242,14 @@ def prepare_agent(root: Path, child_dir: Path, record: dict, path: Path):
241
242
  role = (root / ".trellis/agents/delegated-worktree-primary-agent.md").read_text(encoding="utf8")
242
243
  if role.startswith("---\n"):
243
244
  role = role.split("\n---\n", 1)[1].lstrip("\n")
245
+ codegraph = "codegraph" in record["requirements"].get("required_tools", [])
246
+ tool = shutil.which("codegraph") if codegraph else None
247
+ if codegraph and not tool:
248
+ fail("required CodeGraph executable is unavailable to the controller")
249
+ tool_payload = {"codegraph_command": str(Path(tool).resolve(strict=True))} if tool else {}
244
250
  record["intent"] = "prepare-agent"
245
251
  save(path, record)
246
- agent = adapter(record, "prepare-agent", {"workspace_id": record["workspace_id"], "cwd": record["worktree_path"], "model": record["settings"]["model"], "effort": record["settings"]["effort"], "role": role, "context": str(context), "prompt": f"prepare:读取 {context},只准备并提交 ready.json;当前 agent_id 映射由主控落盘,身份不完整时只报告阻断。", "codegraph": "codegraph" in record["requirements"].get("required_tools", []), "labels": {"trellis.control": record["control_project_id"], "trellis.child": record["binding"]["child_task_id"], "trellis.attempt": record["attempt_id"]}})["agent"]
252
+ agent = adapter(record, "prepare-agent", {"workspace_id": record["workspace_id"], "cwd": record["worktree_path"], "model": record["settings"]["model"], "effort": record["settings"]["effort"], "role": role, "context": str(context), "prompt": f"prepare:读取 {context},只准备并提交 ready.json;当前 agent_id 映射由主控落盘,身份不完整时只报告阻断。", "codegraph": codegraph, **tool_payload, "labels": {"trellis.control": record["control_project_id"], "trellis.child": record["binding"]["child_task_id"], "trellis.attempt": record["attempt_id"]}})["agent"]
247
253
  if not agent or not agent.get("id") or agent.get("workspaceId") != record["workspace_id"]:
248
254
  fail("agent creation outcome unknown; preserve intent")
249
255
  record.update({"agent_id": agent["id"], "status": "running", "intent": None})
@@ -301,6 +307,33 @@ def recover(root: Path, child_dir: Path, record: dict, path: Path, args):
301
307
  return adopted
302
308
 
303
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
+
304
337
  def run(args):
305
338
  from .task_workflow import _task_dir, _task_lock
306
339
  root = get_repo_root().resolve()
@@ -379,13 +412,13 @@ def run(args):
379
412
  save(path, record)
380
413
  assert_worktree(record)
381
414
  prepare_agent(root, child_dir, record, path)
382
- elif operation in {"inspect", "observe", "wait", "interrupt"}:
415
+ elif operation in {"inspect", "observe", "interrupt"}:
383
416
  if operation == "interrupt":
384
417
  if record.get("intent"):
385
418
  fail("resolve prior intent before interrupt; native emergency cancellation remains available")
386
419
  record["intent"] = "interrupt_pending"
387
420
  save(path, record)
388
- 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 {})})
389
422
  if operation == "interrupt":
390
423
  record.setdefault("interrupt_receipts", []).append(observations)
391
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.6",
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.6"
38
+ "@pennixrv/trellis-core": "0.7.2-beta.8"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@eslint/js": "^9.18.0",