@pennixrv/trellis 0.7.2-beta.17 → 0.7.2-beta.19

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.
Files changed (62) hide show
  1. package/dist/commands/init.d.ts.map +1 -1
  2. package/dist/commands/init.js +3 -1
  3. package/dist/commands/init.js.map +1 -1
  4. package/dist/commands/teamwork/artifact.d.ts +1 -0
  5. package/dist/commands/teamwork/artifact.d.ts.map +1 -1
  6. package/dist/commands/teamwork/artifact.js +1 -1
  7. package/dist/commands/teamwork/artifact.js.map +1 -1
  8. package/dist/commands/teamwork/batch.d.ts +14 -1
  9. package/dist/commands/teamwork/batch.d.ts.map +1 -1
  10. package/dist/commands/teamwork/batch.js +165 -21
  11. package/dist/commands/teamwork/batch.js.map +1 -1
  12. package/dist/commands/teamwork/evidence-references.d.ts +19 -0
  13. package/dist/commands/teamwork/evidence-references.d.ts.map +1 -0
  14. package/dist/commands/teamwork/evidence-references.js +249 -0
  15. package/dist/commands/teamwork/evidence-references.js.map +1 -0
  16. package/dist/commands/teamwork/foreground-wait.d.ts.map +1 -1
  17. package/dist/commands/teamwork/foreground-wait.js +7 -0
  18. package/dist/commands/teamwork/foreground-wait.js.map +1 -1
  19. package/dist/commands/teamwork/index.d.ts.map +1 -1
  20. package/dist/commands/teamwork/index.js +5 -2
  21. package/dist/commands/teamwork/index.js.map +1 -1
  22. package/dist/commands/teamwork/rm.d.ts +27 -4
  23. package/dist/commands/teamwork/rm.d.ts.map +1 -1
  24. package/dist/commands/teamwork/rm.js +155 -51
  25. package/dist/commands/teamwork/rm.js.map +1 -1
  26. package/dist/commands/teamwork/run.d.ts.map +1 -1
  27. package/dist/commands/teamwork/run.js +10 -1
  28. package/dist/commands/teamwork/run.js.map +1 -1
  29. package/dist/commands/teamwork/runtime.d.ts.map +1 -1
  30. package/dist/commands/teamwork/runtime.js +2 -2
  31. package/dist/commands/teamwork/runtime.js.map +1 -1
  32. package/dist/commands/update.d.ts.map +1 -1
  33. package/dist/commands/update.js +32 -1
  34. package/dist/commands/update.js.map +1 -1
  35. package/dist/configurators/workflow.d.ts +2 -0
  36. package/dist/configurators/workflow.d.ts.map +1 -1
  37. package/dist/configurators/workflow.js +71 -18
  38. package/dist/configurators/workflow.js.map +1 -1
  39. package/dist/migrations/manifests/0.7.2-beta.18.json +9 -0
  40. package/dist/migrations/manifests/0.7.2-beta.19.json +11 -0
  41. package/dist/templates/common/bundled-skills/trellis-delivery-review-and-closeout/workflow.md +2 -0
  42. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/spec-system.md +9 -7
  43. package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/SKILL.md +6 -4
  44. package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/references/spec-task-planning.md +5 -9
  45. package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/references/spec-writing.md +2 -0
  46. package/dist/templates/markdown/spec/index.md.txt +4 -3
  47. package/dist/templates/shared-hooks/guard-teamwork-wait.py +11 -3
  48. package/dist/templates/trellis/gitignore.txt +4 -0
  49. package/dist/templates/trellis/index.d.ts +1 -0
  50. package/dist/templates/trellis/index.d.ts.map +1 -1
  51. package/dist/templates/trellis/index.js +2 -0
  52. package/dist/templates/trellis/index.js.map +1 -1
  53. package/dist/templates/trellis/scripts/common/active_task.py +23 -31
  54. package/dist/templates/trellis/scripts/common/session_context.py +25 -50
  55. package/dist/templates/trellis/scripts/common/task_context.py +2 -0
  56. package/dist/templates/trellis/scripts/common/task_continuity.py +31 -9
  57. package/dist/templates/trellis/scripts/common/task_runtime.py +211 -0
  58. package/dist/templates/trellis/scripts/common/task_workflow.py +3 -24
  59. package/dist/templates/trellis/scripts/common/worktree_delegation.py +9 -0
  60. package/dist/templates/trellis/scripts/task.py +6 -0
  61. package/dist/templates/trellis/workflow.md +4 -0
  62. package/package.json +2 -2
@@ -1,5 +1,8 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
+ import { randomUUID } from "node:crypto";
4
+ import { assertSafeManagedPath, lstatIfPresent, } from "../utils/managed-removal.js";
5
+ import { loadSpecRegistryConfig } from "../utils/registry-config.js";
3
6
  import { DIR_NAMES, PATHS } from "../constants/paths.js";
4
7
  import { copyTrellisDir } from "../templates/extract.js";
5
8
  // Import trellis templates (generic, not project-specific)
@@ -57,7 +60,7 @@ export function ensureGitattributes(cwd) {
57
60
  * @param options - Workflow options including project type
58
61
  */
59
62
  export async function createWorkflowStructure(cwd, options) {
60
- const skipSpecTemplates = options?.skipSpecTemplates ?? false;
63
+ const skipSpecTemplates = (options?.skipSpecTemplates ?? false) || specHasExternalSource(cwd);
61
64
  const packages = options?.packages;
62
65
  const remoteSpecPackages = options?.remoteSpecPackages;
63
66
  const workflowMd = options?.workflowMdOverride ?? workflowMdTemplate;
@@ -95,7 +98,7 @@ export async function createWorkflowStructure(cwd, options) {
95
98
  ensureDir(path.join(cwd, PATHS.TASKS));
96
99
  // Create spec templates based on project type
97
100
  // These are NOT dogfooded - they are generic templates for new projects
98
- if (packages && packages.length > 0) {
101
+ if (packages && packages.length > 0 && !skipSpecTemplates) {
99
102
  // Monorepo mode: create per-package spec directories
100
103
  await createSpecTemplates(cwd, packages, remoteSpecPackages);
101
104
  }
@@ -104,22 +107,76 @@ export async function createWorkflowStructure(cwd, options) {
104
107
  await createSpecTemplates(cwd);
105
108
  }
106
109
  }
107
- async function writeSpecIndex(specBase, content = specIndexContent) {
108
- ensureDir(specBase);
109
- const target = path.join(specBase, "index.md");
110
- if (!fs.existsSync(target))
111
- await writeFile(target, content);
110
+ function safeSpecPath(cwd, relativePath) {
111
+ const target = assertSafeManagedPath(cwd, relativePath);
112
+ let current = path.resolve(cwd);
113
+ const parts = relativePath.split("/");
114
+ for (const [index, part] of parts.entries()) {
115
+ current = path.join(current, part);
116
+ const stat = lstatIfPresent(current);
117
+ if (stat &&
118
+ (stat.isSymbolicLink() ||
119
+ (index === parts.length - 1 ? !stat.isFile() : !stat.isDirectory()))) {
120
+ throw new Error(`Unsafe spec path: ${relativePath}`);
121
+ }
122
+ }
123
+ return target;
124
+ }
125
+ function specHasExternalSource(cwd) {
126
+ const config = safeSpecPath(cwd, `${DIR_NAMES.WORKFLOW}/config.yaml`);
127
+ if (!lstatIfPresent(config))
128
+ return false;
129
+ const content = fs.readFileSync(config, "utf8");
130
+ if (loadSpecRegistryConfig(cwd))
131
+ return true;
132
+ // The native registry reader supports block syntax. Unknown declarations
133
+ // must not silently authorize a local replacement.
134
+ if (/^\s*["']?registry["']?\s*:/m.test(content)) {
135
+ throw new Error("Cannot determine spec registry source; no local spec files were created. Check registry.spec in .trellis/config.yaml.");
136
+ }
137
+ return false;
138
+ }
139
+ function writeMissingSpecFile(cwd, relativePath, content) {
140
+ const target = safeSpecPath(cwd, relativePath);
141
+ if (lstatIfPresent(target)) {
142
+ fs.readFileSync(target);
143
+ return "preserved";
144
+ }
145
+ fs.mkdirSync(path.dirname(target), { recursive: true });
146
+ safeSpecPath(cwd, relativePath);
147
+ const temporary = path.join(path.dirname(target), `.${path.basename(target)}.${randomUUID()}.tmp`);
148
+ try {
149
+ fs.writeFileSync(temporary, content, { flag: "wx" });
150
+ try {
151
+ fs.linkSync(temporary, target);
152
+ }
153
+ catch (error) {
154
+ if (!(error instanceof Error) ||
155
+ error.code !== "EEXIST")
156
+ throw error;
157
+ safeSpecPath(cwd, relativePath);
158
+ fs.readFileSync(target);
159
+ return "preserved";
160
+ }
161
+ return "created";
162
+ }
163
+ finally {
164
+ fs.rmSync(temporary, { force: true });
165
+ }
166
+ }
167
+ /** Prepare only the neutral root; existing project topics belong to bootstrap. */
168
+ export function ensureSpecIndex(cwd, content = specIndexContent) {
169
+ if (specHasExternalSource(cwd))
170
+ return "external";
171
+ return writeMissingSpecFile(cwd, `${PATHS.SPEC}/index.md`, content);
112
172
  }
113
173
  async function createSpecTemplates(cwd, packages, remoteSpecPackages) {
114
174
  // Ensure spec directory exists
115
- ensureDir(path.join(cwd, PATHS.SPEC));
116
175
  const navigation = packages
117
176
  ?.map((pkg) => `- [${pkg.name}](./${sanitizePkgName(pkg.name)}/index.md)`)
118
177
  .join("\n");
119
- await writeSpecIndex(path.join(cwd, PATHS.SPEC), specIndexContent + (navigation ? `\n## Packages\n\n${navigation}\n` : ""));
178
+ ensureSpecIndex(cwd, specIndexContent + (navigation ? `\n## Packages\n\n${navigation}\n` : ""));
120
179
  // Guides - always created regardless of mode
121
- const guidesDir = path.join(cwd, `${PATHS.SPEC}/guides`);
122
- ensureDir(guidesDir);
123
180
  const guidesDocs = [
124
181
  { name: "index.md", content: guidesIndexContent },
125
182
  {
@@ -132,9 +189,7 @@ async function createSpecTemplates(cwd, packages, remoteSpecPackages) {
132
189
  },
133
190
  ];
134
191
  for (const doc of guidesDocs) {
135
- const target = path.join(guidesDir, doc.name);
136
- if (!fs.existsSync(target))
137
- await writeFile(target, doc.content);
192
+ writeMissingSpecFile(cwd, `${PATHS.SPEC}/guides/${doc.name}`, doc.content);
138
193
  }
139
194
  if (packages && packages.length > 0) {
140
195
  // Monorepo mode: create spec/<name>/ for each package
@@ -142,14 +197,12 @@ async function createSpecTemplates(cwd, packages, remoteSpecPackages) {
142
197
  const dirName = sanitizePkgName(pkg.name);
143
198
  if (remoteSpecPackages?.has(dirName))
144
199
  continue;
145
- const pkgSpecBase = path.join(cwd, `${PATHS.SPEC}/${dirName}`);
146
- ensureDir(pkgSpecBase);
147
- await writeSpecIndex(pkgSpecBase);
200
+ writeMissingSpecFile(cwd, `${PATHS.SPEC}/${dirName}/index.md`, specIndexContent);
148
201
  }
149
202
  }
150
203
  else {
151
204
  // Single-repo mode
152
- await writeSpecIndex(path.join(cwd, PATHS.SPEC));
205
+ ensureSpecIndex(cwd);
153
206
  }
154
207
  }
155
208
  //# sourceMappingURL=workflow.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflow.js","sourceRoot":"","sources":["../../src/configurators/workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,M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IAC7E,CAAC;IAED,IAAI,QAAQ,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpC,sDAAsD;QACtD,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;YAC3B,MAAM,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC1C,IAAI,kBAAkB,EAAE,GAAG,CAAC,OAAO,CAAC;gBAAE,SAAS;YAC/C,oBAAoB,CAClB,GAAG,EACH,GAAG,KAAK,CAAC,IAAI,IAAI,OAAO,WAAW,EACnC,gBAAgB,CACjB,CAAC;QACJ,CAAC;IACH,CAAC;SAAM,CAAC;QACN,mBAAmB;QACnB,eAAe,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC"}
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": "0.7.2-beta.18",
3
+ "description": "Repair missing generic spec navigation on existing-project init",
4
+ "breaking": false,
5
+ "recommendMigrate": false,
6
+ "changelog": "Ordinary existing-project init prepares a missing local spec root index without recreating topics, guides or package mappings. Preserve existing indexes and external sources; reject unsafe paths and publish new files without replacing concurrent content. Bundled bootstrap distinguishes file preparation from source-backed convention verification.",
7
+ "migrations": [],
8
+ "notes": "Update generated assets through the native CLI. Explicitly rerun ordinary init only when root-index preparation is intended, then use trellis-spec-bootstrap under the current task and authorization to review real content. Ordinary update does not migrate project specs or remove legacy layers; repeating default init also recreates an intentionally deleted root index."
9
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "version": "0.7.2-beta.19",
3
+ "description": "Converge native task runtime and Teamwork lifecycle cleanup",
4
+ "breaking": true,
5
+ "recommendMigrate": true,
6
+ "changelog": "Fixed task layout locks, version-aware update markers, provider-free historical inspection, default-preview exact-digest Teamwork cleanup, accepted-evidence and retained-attempt protection, attempt-local stderr, and preserving private-history ignore updates.",
7
+ "migrationGuide": "Use native trellis update to refresh generated assets. Task runtime cleanup is preview-first and requires an exact current digest. Teamwork rm now previews by default; pass --confirm with its fresh digest to delete. prune --yes also requires --confirm. create --force no longer wipes nonempty sessions. No private task or handoff history is deleted or migrated automatically. Incomplete process proof and unknown references retain their assets.",
8
+ "aiInstructions": "Preserve current task and handoff authority. Inspect native previews, accepted evidence, live processes and recovery obligations before proposing exact cleanup objects. Do not infer expiry from age, delete fixed lock anchors, hand-edit runtime state, or use create --force as a cleanup bypass. Obtain explicit approval for actual historical data deletion.",
9
+ "migrations": [],
10
+ "notes": "Refresh generated assets through native update; preserve custom configuration and spec content. Runtime cleanup and Teamwork deletion require separate specific confirmation."
11
+ }
@@ -53,3 +53,5 @@ flowchart TD
53
53
  ### 与会话交接的边界
54
54
 
55
55
  正式会话交接包仅在用户明确要求时按其独立 Skill 处理。它不改变阶段、路线或任务状态,也不是 `delivery_ready`、`complete` 或 `cancel` 的前置条件。
56
+
57
+ 完成或取消不会删除任务证据。退役的空业务 session、旧提示缓存和旧锁先用 `task.py runtime [<task>]` 预览,核验当前用途、writer 协议和指纹后按精确摘要确认;固定锁、有效控制记录、未知字段和恢复材料保留。Teamwork 证据按其原生命令审查引用与用途;交接包及其生命周期材料按 handoff owner 的独立合同处理。历史引用缺失、空锁或零运行成员都不能单独证明资产可删。
@@ -8,12 +8,8 @@ A common single-repository structure:
8
8
 
9
9
  ```text
10
10
  .trellis/spec/
11
- ├── backend/
12
- │ ├── index.md
13
- │ └── ...
14
- ├── frontend/
15
- │ ├── index.md
16
- │ └── ...
11
+ ├── index.md
12
+ ├── <actual-topic>.md
17
13
  └── guides/
18
14
  ├── index.md
19
15
  └── ...
@@ -23,7 +19,9 @@ A common monorepo structure:
23
19
 
24
20
  ```text
25
21
  .trellis/spec/
22
+ ├── index.md
26
23
  ├── cli/
24
+ │ ├── index.md
27
25
  │ ├── backend/
28
26
  │ │ ├── index.md
29
27
  │ │ └── ...
@@ -39,7 +37,7 @@ A common monorepo structure:
39
37
  └── ...
40
38
  ```
41
39
 
42
- `index.md` is the entry point for each layer. It should list the Pre-Development Checklist and Quality Check. Specific guidelines live in other Markdown files in the same directory.
40
+ The root `index.md` is the common entry, followed by configured package and actual topic/layer indexes. Keep the Pre-Development Checklist and Quality Check. Existing frontend/backend or other layers remain valid when they match the project; the examples do not require those layers.
43
41
 
44
42
  ## Package Configuration
45
43
 
@@ -100,3 +98,7 @@ When the AI learns a new rule during implementation or debugging, it should upda
100
98
  ## Boundaries
101
99
 
102
100
  `.trellis/spec/` is the user's project specification, not a permanent copy of Trellis built-in templates. The AI should encourage the user to update it according to the actual project code instead of treating Trellis default templates as immutable documents.
101
+
102
+ New-project `init` prepares neutral navigation. Ordinary existing-project `init` repairs only a missing local root index, preserving existing files, package mappings and deleted topics/guides. An explicitly repeated default init also recreates a deliberately deleted root index; no deletion intent is stored. External registry sources retain their owner, and unrecognized declarations stop local preparation. Ordinary update and session startup do not trigger this repair or semantic migration.
103
+
104
+ Use the available `trellis-spec-bootstrap` to establish or refresh source-backed conventions within the authorized task. Native file preparation and unchanged fingerprints do not establish semantic readiness. Do not add a second spec state ledger.
@@ -9,11 +9,11 @@ Use this skill to create or refresh `.trellis/spec/` guidelines from the real co
9
9
 
10
10
  ## Workflow
11
11
 
12
- 1. Confirm Trellis is initialized and inspect the current `.trellis/spec/` tree.
12
+ 1. Reuse the current task and authorization. Inspect the current `.trellis/spec/` tree, configured package keys and spec source before changing anything. This skill does not authorize initialization, installation or indexing.
13
13
  2. Analyze the repository architecture with the best available tools: GitNexus, ABCoder, language tooling, and direct source reads.
14
14
  3. Decompose the spec work by package and layer only when that reflects the actual codebase.
15
- 4. Fill or reshape the spec files with concrete patterns, file paths, examples, and anti-patterns from the project.
16
- 5. Verify that the final specs are internally consistent and contain no template placeholders.
15
+ 4. Classify pure placeholders, real conventions mixed into templates, and historical examples. Fill or reshape the authorized files with concrete project evidence; preserve real rules and historical task records.
16
+ 5. Verify root/package navigation, active references, applicable checks and placeholder removal. Report file preparation separately from verified conventions and remaining evidence gaps.
17
17
 
18
18
  ## Reference Routing
19
19
 
@@ -28,7 +28,8 @@ Use this skill to create or refresh `.trellis/spec/` guidelines from the real co
28
28
 
29
29
  - Treat templates as starting points, not contracts. Delete, rename, split, or add spec files when the repository calls for it.
30
30
  - Prefer source-backed rules over generic advice. Every important recommendation should point at a real file or repeated local pattern.
31
- - Keep execution single-owner by default. Optional helper agents are an implementation detail, not a requirement or user-visible dependency.
31
+ - The main session owns this loop. This skill does not dispatch native helper agents or establish a collaboration route.
32
+ - Native `init` prepares missing navigation; it does not prove that spec content is useful. Ordinary existing-project reentry only repairs the missing root index, without recreating topics, guides or package mappings. An authorized source-backed refresh may still be required.
32
33
  - Do not write platform-specific instructions unless the target project already standardizes on that platform.
33
34
  - Do not leave placeholder text, empty headings, or copied boilerplate in `.trellis/spec/`.
34
35
 
@@ -38,4 +39,5 @@ Use this skill to create or refresh `.trellis/spec/` guidelines from the real co
38
39
  - Each relevant package or layer has practical coding guidance with real examples.
39
40
  - Non-applicable template sections are removed.
40
41
  - `index.md` files match the final spec file set.
42
+ - Active task references remain valid; historical records and acceptance evidence retain their original bytes. Record deleted paths and their source commit instead of creating empty compatibility files.
41
43
  - Any required setup or analysis assumptions are documented in the relevant spec or task notes.
@@ -1,6 +1,6 @@
1
1
  # Spec Task Planning
2
2
 
3
- Use a single agent as the default execution model. The agent may create Trellis tasks for traceability, but the skill should not require a specific platform, CLI, or parallel worker model.
3
+ The main session performs this work under the current task's authorization. Reuse that task when applicable; this method does not start another task system or dispatch workers.
4
4
 
5
5
  ## Decomposition
6
6
 
@@ -48,14 +48,10 @@ Summarize the concrete findings from repository analysis.
48
48
  - [ ] Claims are backed by source files, tests, or project docs.
49
49
  ```
50
50
 
51
- ## Optional Helper Agents
51
+ ## Existing Project Refresh
52
52
 
53
- If the host supports subagents, helpers can inspect independent packages or run verification. They are optional. The main agent still owns integration and final quality.
53
+ Inventory the actual files before selecting changes. An old index marked `To fill` does not prove that its topic files are empty. Keep source-backed rules and their conditions, including rules mixed into placeholder headings.
54
54
 
55
- Helper tasks must have clear ownership:
55
+ Use existing package keys, `default_package` and `spec_scope`; do not infer a new map from directory names. Keep valid legacy layers when they fit. Remove pure placeholders only after checking active references and explicit authorization. Preserve archived tasks and receipts; record the source commit and exact removed paths for historical lookup.
56
56
 
57
- - Read-only research tasks may inspect any source needed for the assigned scope.
58
- - Native helper write tasks require explicit project authorization and disjoint spec directories. Trellis Teamwork teammates remain in their research, review, or verification role and return findings in the assigned format; the coordinator applies accepted spec edits.
59
- - Verification tasks should check placeholder removal, broken links, and consistency.
60
-
61
- Do not encode helper-agent names, vendor-specific commands, or platform-specific routing in the skill. Put only the required work and acceptance criteria in the task.
57
+ Verify navigation and real content after edits. Missing analysis tools or source evidence must remain explicit limitations, not invented conventions. A native init/update success alone is not spec completion.
@@ -74,3 +74,5 @@ grep -R "To be filled\\|TODO: fill\\|placeholder" .trellis/spec
74
74
  ```
75
75
 
76
76
  Also check links, index files, and whether any spec still describes a template rather than this repository.
77
+
78
+ Check active task bindings before moving or deleting a topic. Preserve archived examples as history, clearly distinguish them from current instructions, and do not rewrite historical acceptance evidence to make a current link check pass. Report which conventions were verified from which sources and what remains unverified.
@@ -1,14 +1,15 @@
1
1
  # Project Development Guidelines
2
2
 
3
- This index navigates the project's verified engineering conventions. Use
4
- `trellis-spec-bootstrap` to establish relevant topics from source, tests and
3
+ This index is the starting navigation for project engineering conventions;
4
+ its existence does not verify their content. Use `trellis-spec-bootstrap`
5
+ to establish or refresh relevant topics from source, tests and
5
6
  existing project rules. No domain or layer is required by default.
6
7
 
7
8
  ## Pre-Development Checklist
8
9
 
9
10
  Read this index, the applicable package index (when configured), and the topic
10
11
  guidelines for the code you will change. Read the shared `guides/index.md` at
11
- the spec root. Follow existing layer indexes in projects that use them.
12
+ the spec root when present. Follow existing layer indexes in projects that use them.
12
13
 
13
14
  ## Quality Check
14
15
 
@@ -37,7 +37,7 @@ def read_record(file: Path, limit: int) -> dict:
37
37
  return value
38
38
 
39
39
 
40
- def recovery_arguments(command: str) -> tuple[str, str] | None:
40
+ def recovery_arguments(command: str) -> tuple[str, str, bool] | None:
41
41
  if any(character in command for character in "$`;\n\r&|<>"):
42
42
  return None
43
43
  argv = shlex.split(command)
@@ -71,7 +71,7 @@ def recovery_arguments(command: str) -> tuple[str, str] | None:
71
71
  return None
72
72
  if "--execute" in options and not str(options.get("--reason", "")).strip():
73
73
  return None
74
- return plan, task
74
+ return plan, task, "--execute" not in options
75
75
 
76
76
 
77
77
  def decision(payload: dict) -> dict | None:
@@ -133,12 +133,20 @@ def decision(payload: dict) -> dict | None:
133
133
  try:
134
134
  arguments = recovery_arguments(command)
135
135
  if arguments:
136
- plan_path, task_path = (safe_path(value, root) for value in arguments)
136
+ plan_path, task_path = (safe_path(value, root) for value in arguments[:2])
137
137
  task_path.relative_to(root / ".trellis" / "tasks")
138
138
  plan_path.relative_to(task_path)
139
139
  plan = read_record(plan_path, 2097152)
140
140
  if not task_path.is_dir():
141
141
  raise ValueError("missing owning task")
142
+ if arguments[2] and not unsafe_directory:
143
+ session_id, batch_id = plan.get("session_id"), plan.get("batch_id")
144
+ if isinstance(session_id, str) and session_id and isinstance(batch_id, str) and batch_id:
145
+ expected = hashlib.sha256(f"{session_id}:{batch_id}".encode()).hexdigest() + ".json"
146
+ if any(record.name == expected for record in records):
147
+ # Native reconcile independently validates frozen inputs; a corrupt
148
+ # projection must not prevent read-only diagnosis of that same batch.
149
+ return None
142
150
  matches = [state for state in states if state["sessionId"] == plan.get("session_id") and state["batchId"] == plan.get("batch_id") and state["planHash"] == plan.get("plan_hash")]
143
151
  if len(matches) == 1:
144
152
  state = matches[0]
@@ -7,6 +7,9 @@
7
7
  # Session/window scoped runtime state
8
8
  .runtime/
9
9
 
10
+ # Durable local handoff packages contain private conversation history
11
+ session-handoffs/
12
+
10
13
  # Ralph Loop state file
11
14
  .ralph-state.json
12
15
 
@@ -18,6 +21,7 @@
18
21
  # Task directory runtime files
19
22
  .plan-log
20
23
  .task-phase.lock
24
+ tasks/**/provider-stderr.log
21
25
 
22
26
  # Atomic update temp files
23
27
  *.tmp
@@ -36,6 +36,7 @@ export declare const commonGit: string;
36
36
  export declare const commonTypes: string;
37
37
  export declare const commonTasks: string;
38
38
  export declare const commonTaskContext: string;
39
+ export declare const commonTaskRuntime: string;
39
40
  export declare const commonTaskStore: string;
40
41
  export declare const commonTaskWorkflow: string;
41
42
  export declare const commonTaskContinuity: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/trellis/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAcH,eAAO,MAAM,WAAW,QAAsC,CAAC;AAG/D,eAAO,MAAM,UAAU,QAA6C,CAAC;AACrE,eAAO,MAAM,WAAW,QAA0C,CAAC;AACnE,eAAO,MAAM,eAAe,QAA8C,CAAC;AAC3E,eAAO,MAAM,gBAAgB,QAAgD,CAAC;AAC9E,eAAO,MAAM,eAAe,QAA+C,CAAC;AAC5E,eAAO,MAAM,eAAe,QAA+C,CAAC;AAC5E,eAAO,MAAM,gBAAgB,QAAgD,CAAC;AAC9E,eAAO,MAAM,cAAc,QAA8C,CAAC;AAC1E,eAAO,MAAM,gBAAgB,QAAgD,CAAC;AAC9E,eAAO,MAAM,gBAAgB,QAAgD,CAAC;AAC9E,eAAO,MAAM,YAAY,QAA2C,CAAC;AACrE,eAAO,MAAM,QAAQ,QAAuC,CAAC;AAC7D,eAAO,MAAM,SAAS,QAAwC,CAAC;AAC/D,eAAO,MAAM,SAAS,QAAwC,CAAC;AAC/D,eAAO,MAAM,WAAW,QAA0C,CAAC;AACnE,eAAO,MAAM,WAAW,QAA0C,CAAC;AACnE,eAAO,MAAM,iBAAiB,QAAiD,CAAC;AAChF,eAAO,MAAM,eAAe,QAA+C,CAAC;AAC5E,eAAO,MAAM,kBAAkB,QAE9B,CAAC;AACF,eAAO,MAAM,oBAAoB,QAEhC,CAAC;AACF,eAAO,MAAM,oBAAoB,QAEhC,CAAC;AACF,eAAO,MAAM,qBAAqB,QAEjC,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AAM,gBAAgB,QAA+C,CAAC;AAG7E,eAAO,MAAM,kBAAkB,QAA8B,CAAC;AAC9D,eAAO,MAAM,kBAAkB,QAA8B,CAAC;AAC9D,eAAO,MAAM,sBAAsB,QAAgC,CAAC;AACpE,eAAO,MAAM,iBAAiB,QAAgC,CAAC;AAC/D,eAAO,MAAM,qBAAqB,QAAoC,CAAC;AAGvE,eAAO,MAAM,qBAAqB,QAAqC,CAAC;AACxE,eAAO,MAAM,8BAA8B,QAE1C,CAAC;AACF,eAAO,MAAM,wBAAwB,QAEpC,CAAC;AAEF;;GAEG;AACH,wBAAgB,aAAa,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAkDnD;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAelD"}
@@ -46,6 +46,7 @@ export const commonGit = readTemplate("scripts/common/git.py");
46
46
  export const commonTypes = readTemplate("scripts/common/types.py");
47
47
  export const commonTasks = readTemplate("scripts/common/tasks.py");
48
48
  export const commonTaskContext = readTemplate("scripts/common/task_context.py");
49
+ export const commonTaskRuntime = readTemplate("scripts/common/task_runtime.py");
49
50
  export const commonTaskStore = readTemplate("scripts/common/task_store.py");
50
51
  export const commonTaskWorkflow = readTemplate("scripts/common/task_workflow.py");
51
52
  export const commonTaskContinuity = readTemplate("scripts/common/task_continuity.py");
@@ -99,6 +100,7 @@ export function getAllScripts() {
99
100
  scripts.set("common/types.py", commonTypes);
100
101
  scripts.set("common/tasks.py", commonTasks);
101
102
  scripts.set("common/task_context.py", commonTaskContext);
103
+ scripts.set("common/task_runtime.py", commonTaskRuntime);
102
104
  scripts.set("common/task_store.py", commonTaskStore);
103
105
  scripts.set("common/task_workflow.py", commonTaskWorkflow);
104
106
  scripts.set("common/task_continuity.py", commonTaskContinuity);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/trellis/index.ts"],"names":[],"mappings":"AAAA;;;;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IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;;gBAC1D,MAAM,IAAI,KAAK,CAAC,+BAA+B,QAAQ,EAAE,CAAC,CAAC;QAClE,CAAC;IACH,CAAC;IACD,OAAO,CAAC,EAAE,CAAC,CAAC;IACZ,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -548,6 +548,12 @@ def _write_json(path: Path, data: dict[str, Any]) -> bool:
548
548
  truncates the target first, so a crash mid-write would leave a session
549
549
  file that reads back as no active task.
550
550
  """
551
+ if data.get("current_task") in (None, "") and data.get("current_run") is None and all(
552
+ data.get(key) is None or isinstance(data[key], str) for key in ("platform", "last_seen_at")
553
+ ) and set(data) <= {
554
+ "current_task", "current_run", "platform", "last_seen_at",
555
+ }:
556
+ return not path.exists() or _remove_file(path)
551
557
  try:
552
558
  path.parent.mkdir(parents=True, exist_ok=True)
553
559
  except OSError:
@@ -624,32 +630,11 @@ def _context_path(repo_root: Path, context_key: str) -> Path:
624
630
 
625
631
  @contextlib.contextmanager
626
632
  def _session_file_lock(context_path: Path):
627
- """Serialize changes to one session's active-task pointer."""
628
- lock_path = context_path.with_suffix(".lock")
629
- lock_path.parent.mkdir(parents=True, exist_ok=True)
630
- with lock_path.open("a+b") as handle:
631
- if os.name == "nt":
632
- import msvcrt
633
-
634
- handle.seek(0)
635
- if handle.read(1) == b"":
636
- handle.write(b"\0")
637
- handle.flush()
638
- handle.seek(0)
639
- msvcrt.locking(handle.fileno(), msvcrt.LK_LOCK, 1)
640
- try:
641
- yield
642
- finally:
643
- handle.seek(0)
644
- msvcrt.locking(handle.fileno(), msvcrt.LK_UNLCK, 1)
645
- else:
646
- import fcntl
633
+ """Serialize pointer changes with task moves and ownership transactions."""
634
+ from .task_move import layout_lock
647
635
 
648
- fcntl.flock(handle.fileno(), fcntl.LOCK_EX)
649
- try:
650
- yield
651
- finally:
652
- fcntl.flock(handle.fileno(), fcntl.LOCK_UN)
636
+ with layout_lock(context_path.parents[3]):
637
+ yield
653
638
 
654
639
 
655
640
  def resolve_active_task(
@@ -828,7 +813,7 @@ def clear_active_task(
828
813
  platform_input: dict[str, Any] | None = None,
829
814
  platform: str | None = None,
830
815
  ) -> ActiveTask:
831
- """Clear the active task by deleting its resolved session context file."""
816
+ """Clear the task pointer while preserving other session data."""
832
817
  context_key = resolve_context_key(platform_input, platform)
833
818
  if not context_key:
834
819
  return ActiveTask(None, "none")
@@ -844,13 +829,17 @@ def clear_active_task(
844
829
  if not allowed:
845
830
  return ActiveTask(previous.task_path, "session", previous.context_key)
846
831
  with _session_file_lock(context_path):
847
- if context_path.is_file():
848
- _remove_file(context_path)
832
+ context, _ = read_json_checked(context_path)
833
+ if context is not None:
834
+ current = _string_value(context.get("current_task"))
835
+ if _task_refs_match(current, previous.task_path, repo_root):
836
+ context.pop("current_task", None)
837
+ _write_json(context_path, context)
849
838
  return previous
850
839
 
851
840
 
852
841
  def clear_task_from_sessions(task_path: str, repo_root: Path) -> int:
853
- """Delete all session runtime files that point at a task."""
842
+ """Clear matching task pointers, preserving runs and unknown fields."""
854
843
  target = _canonical_task_ref(task_path, repo_root) or normalize_task_ref(task_path)
855
844
  if not target:
856
845
  return 0
@@ -862,14 +851,17 @@ def clear_task_from_sessions(task_path: str, repo_root: Path) -> int:
862
851
 
863
852
  for session_path in sessions_dir.glob("*.json"):
864
853
  with _session_file_lock(session_path):
865
- context = _read_json(session_path) or {}
854
+ context, _ = read_json_checked(session_path)
855
+ if context is None:
856
+ continue
866
857
  current = _string_value(context.get("current_task"))
867
858
  if not current:
868
859
  continue
869
860
  current_ref = _canonical_task_ref(current, repo_root) or normalize_task_ref(current)
870
861
  if current_ref != target:
871
862
  continue
872
- if session_path.is_file() and _remove_file(session_path):
863
+ context.pop("current_task", None)
864
+ if _write_json(session_path, context):
873
865
  cleared += 1
874
866
 
875
867
  return cleared