@windyroad/architect 1.1.1-preview.1385 → 1.1.1-preview.1387

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.
@@ -5,7 +5,7 @@ import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameS
5
5
  import { dirname, join } from "node:path";
6
6
  import { spawnSync } from "node:child_process";
7
7
  import { fileURLToPath } from "node:url";
8
- import { CLOSE_TOOLS, SPAWN_TOOLS, WAIT_TOOLS, completionTarget, response, reviewerDispatch, reviewerInstructionsMatch } from "./lib/codex-completion-input.mjs";
8
+ import { CLOSE_TOOLS, SPAWN_TOOLS, WAIT_TOOLS, completionTarget, response, reviewerDispatch, reviewerInstructionsMatch, clearGeneralReview } from "./lib/codex-completion-input.mjs";
9
9
 
10
10
  const hookDir = dirname(fileURLToPath(import.meta.url));
11
11
  const role = "wr-architect:agent";
@@ -116,14 +116,18 @@ function rememberNative(input) {
116
116
 
117
117
  function remember(input) {
118
118
  const dispatch = reviewerDispatch(input, reviewerInstructions);
119
- if (!dispatch) return;
120
- if (!dispatch.reviewerTransport && existsSync(nativePath(input.session_id))) return;
121
119
  reapTransport();
122
120
  const result = response(input);
123
121
  const target = normalizeTarget(result.agent_id ?? result.task_name);
124
122
  if (!target) return;
123
+ if (!dispatch?.reviewerTransport && existsSync(nativePath(input.session_id))) {
124
+ clearGeneralReview(input, role, target, { state: statePath(input.session_id, target),
125
+ registration: registrationPath(input.session_id, target), receipt: receiptPath(input.session_id, target) });
126
+ return;
127
+ }
125
128
  mkdirSync(riskDir(input.session_id), { recursive: true });
126
129
  clear(input.session_id, target);
130
+ if (!dispatch) return;
127
131
  const bound = checkout(input.cwd || process.cwd());
128
132
  const hash = bound && policyHash(bound.root);
129
133
  if (!bound || !hash) return diagnostic(bound ? "policy-hash-failed" : "invalid-spawn-checkout", input);
@@ -1,4 +1,4 @@
1
- import { readdirSync, readFileSync } from "node:fs";
1
+ import { readdirSync, readFileSync, rmSync } from "node:fs";
2
2
  import { createHash } from "node:crypto";
3
3
  import { resolve } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
@@ -39,6 +39,22 @@ export function reviewerInstructionsMatch(registered, loadInstructions) {
39
39
  } catch { return false; }
40
40
  }
41
41
 
42
+ // Native replay claims share a target key with legacy receipts. In native mode
43
+ // invalidate only a demonstrably owned general registration, never its claims.
44
+ export function clearGeneralReview(input, role, target, paths) {
45
+ const owned = value => value.reviewerTransport === "general" && value.role === role &&
46
+ value.parentSession === input.session_id && value.target === target;
47
+ try {
48
+ if (!owned(JSON.parse(readFileSync(paths.registration, "utf8")))) return false;
49
+ } catch { return false; }
50
+ rmSync(paths.state, { force: true });
51
+ rmSync(paths.registration, { force: true });
52
+ try {
53
+ if (owned(JSON.parse(readFileSync(paths.receipt, "utf8")))) rmSync(paths.receipt, { force: true });
54
+ } catch { /* No pending general receipt to invalidate. */ }
55
+ return true;
56
+ }
57
+
42
58
  // Resolve only this session's state files, including completed claims so an
43
59
  // ambiguous short name cannot consume a different reviewer after delivery.
44
60
  export function completionTarget(rawTarget, directory, prefix, rolePrefix = "") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windyroad/architect",
3
- "version": "1.1.1-preview.1385",
3
+ "version": "1.1.1-preview.1387",
4
4
  "description": "Architecture decision enforcement for AI coding agents",
5
5
  "bin": {
6
6
  "windyroad-architect": "./bin/install.mjs"