atris 3.64.0 → 3.66.0

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,115 @@
1
+ 'use strict';
2
+
3
+ // Member agents build in temporary copies of the repo
4
+ // (<arena>/.agent-worktrees/<project>/<name>, older ones under
5
+ // <arena>/agent-work-trees/...) and record their proof check pointed at that
6
+ // copy: "cd <arena>/.agent-worktrees/<project>/x && node scripts/t.mjs".
7
+ // The landing gate only runs checks relative to the main checkout, so it
8
+ // refused 201 of 218 finished items in project-obelisk every hour. Rewrite
9
+ // such a check relative to the main checkout so the landing pass reruns it
10
+ // there, and say in plain words when it cannot (the file it runs only exists
11
+ // on the agent's branch).
12
+
13
+ const fs = require('fs');
14
+ const path = require('path');
15
+
16
+ function escapeRegex(text) {
17
+ return String(text).replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
18
+ }
19
+
20
+ function arenaDirFor(root) {
21
+ let cursor = root;
22
+ while (cursor && cursor !== path.dirname(cursor)) {
23
+ if (path.basename(cursor) === 'arena') return cursor;
24
+ cursor = path.dirname(cursor);
25
+ }
26
+ return path.dirname(root);
27
+ }
28
+
29
+ function copyRootPattern(root) {
30
+ const arena = escapeRegex(arenaDirFor(root));
31
+ const project = escapeRegex(path.basename(root));
32
+ const name = '[A-Za-z0-9._-]+';
33
+ return `(?:${[
34
+ `${arena}/\\.agent-worktrees/${project}/${name}`,
35
+ `${arena}/agent-work-trees/${project}/${name}`,
36
+ `\\.\\./\\.agent-worktrees/${project}/${name}`,
37
+ escapeRegex(root),
38
+ ].join('|')})(?![A-Za-z0-9._-])`;
39
+ }
40
+
41
+ function stripQuotes(token) {
42
+ return token.replace(/^'(.*)'$/, '$1').replace(/^"(.*)"$/, '$1');
43
+ }
44
+
45
+ // Returns { command, rewritten, from }. `rewritten` is true only when the
46
+ // command named an agent copy (or the main checkout by absolute path) and
47
+ // now runs relative to the main checkout. A command that still names an
48
+ // agent copy after the rewrite is returned untouched with rewritten:false.
49
+ function rewriteWorktreeVerify(command, workspaceRoot) {
50
+ const original = String(command || '').trim();
51
+ const unchanged = { command: original, rewritten: false, from: null };
52
+ if (!original || !workspaceRoot) return unchanged;
53
+ const root = path.resolve(workspaceRoot);
54
+ const anyRoot = copyRootPattern(root);
55
+ if (!new RegExp(anyRoot).test(original)) return unchanged;
56
+
57
+ let cmd = original;
58
+ // ( cd X && cmd ) -> cd X && cmd
59
+ const paren = /^\((.*)\)$/s.exec(cmd);
60
+ if (paren) cmd = paren[1].trim();
61
+ // cd '<copy>[/sub]' && rest -> [cd sub && ]rest
62
+ const cd = new RegExp(`^cd\\s+(['"]?)${anyRoot}(/[^'"\\s]*)?\\1\\s+&&\\s+(.+)$`, 's').exec(cmd);
63
+ if (cd) {
64
+ const sub = (cd[2] || '').replace(/^\/+|\/+$/g, '');
65
+ cmd = sub ? `cd ${sub} && ${cd[3]}` : cd[3];
66
+ }
67
+ // npm --prefix <copy> run x -> npm run x
68
+ cmd = cmd.replace(new RegExp(`\\bnpm\\s+--prefix\\s+(['"]?)${anyRoot}/?\\1\\s+`, 'g'), 'npm ');
69
+ // '<copy>/a/b' -> a/b ; bare '<copy>' -> .
70
+ cmd = cmd.replace(new RegExp(`(['"]?)${anyRoot}/([^'"\\s]+)\\1`, 'g'), (_m, _q, rest) => rest);
71
+ cmd = cmd.replace(new RegExp(`(['"]?)${anyRoot}/?\\1(?=\\s|$)`, 'g'), '.');
72
+ // Only plain path quoting is stripped; quoted text with spaces stays put.
73
+ cmd = cmd.split(/(\s+)/).map((part) => (/^\s+$/.test(part) ? part : stripQuotes(part))).join('').trim();
74
+ if (new RegExp(anyRoot).test(cmd) || /\.agent-worktrees|agent-work-trees/.test(cmd)) return unchanged;
75
+ return { command: cmd, rewritten: true, from: original };
76
+ }
77
+
78
+ // Files a parsed check step reads by relative path: its folder, the script
79
+ // it runs, the file it tests. Used to tell "this check cannot run on main
80
+ // because its file only exists on the agent's branch" from a real failure.
81
+ function stepReferencedPaths(step) {
82
+ const argv = Array.isArray(step?.argv) ? step.argv : [];
83
+ const paths = [];
84
+ if (step?.cwd) paths.push({ path: step.cwd, kind: 'dir' });
85
+ const [bin, first, second] = argv;
86
+ const looksLikePath = (token) => Boolean(token) && !String(token).startsWith('-') && /[/.]/.test(String(token));
87
+ if (bin === 'node' && first === '--check' && looksLikePath(second)) paths.push({ path: second, kind: 'file' });
88
+ else if (bin === 'node' && first === '--test') {
89
+ for (const token of argv.slice(2)) {
90
+ if (looksLikePath(token) && !String(token).includes('*') && /\.[cm]?[jt]s$/.test(token)) paths.push({ path: token, kind: 'file' });
91
+ }
92
+ } else if (bin === 'node' && looksLikePath(first)) paths.push({ path: first, kind: 'file' });
93
+ if ((bin === 'python' || bin === 'python3' || /venv\/bin\/python3?$/.test(String(bin || ''))) && looksLikePath(first) && first !== '-m') {
94
+ paths.push({ path: first, kind: 'file' });
95
+ }
96
+ if (bin === 'test' && (first === '-f' || first === '-s') && looksLikePath(second)) paths.push({ path: second, kind: 'file' });
97
+ return paths;
98
+ }
99
+
100
+ // First referenced path missing from the main checkout, or null.
101
+ function missingOnMain(steps, workspaceRoot) {
102
+ const root = path.resolve(workspaceRoot || process.cwd());
103
+ for (const step of steps || []) {
104
+ const base = step?.cwd ? path.resolve(root, step.cwd) : root;
105
+ for (const ref of stepReferencedPaths(step)) {
106
+ const target = ref.kind === 'dir' ? path.resolve(root, ref.path) : path.resolve(base, ref.path);
107
+ if (!fs.existsSync(target)) {
108
+ return path.relative(root, target) || ref.path;
109
+ }
110
+ }
111
+ }
112
+ return null;
113
+ }
114
+
115
+ module.exports = { rewriteWorktreeVerify, missingOnMain, stepReferencedPaths };
package/lib/voice-gate.js CHANGED
@@ -255,6 +255,8 @@ const LANDING_REASON_SENTENCES = {
255
255
  verifier_is_builder: 'the re-check actor built this row, another actor must re-check',
256
256
  verify_command_not_allowed: 'its recorded check is not on the list this machine may run alone, run it yourself to unblock',
257
257
  verify_failed: 'its check command failed on re-run, fix the failure and re-certify',
258
+ verify_failed_on_main: 'its check was recorded in an agent copy and fails when rerun from main, so its work is likely still on the agent branch',
259
+ verify_only_on_agent_branch: 'its check runs a file that only exists on the agent branch, not on main yet, so that branch has to land first',
258
260
  verify_passed: 'its check command passed on re-run',
259
261
  verify_unrunnable: 'its check command could not even start, fix the command and re-certify',
260
262
  verify_workdir_missing: 'the folder its check was recorded in is gone, re-run the check from a real folder',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atris",
3
- "version": "3.64.0",
3
+ "version": "3.66.0",
4
4
  "description": "you say what you want in plain words. atris builds it, checks it, and shows you proof.",
5
5
  "main": "bin/atris.js",
6
6
  "bin": {
@@ -373,7 +373,7 @@ run_grok() {
373
373
  }
374
374
 
375
375
  run_haiku() {
376
- run_with_timeout 240 claude -p "$PROMPT" --model "${1:-claude-haiku-4-5}"
376
+ run_with_timeout 240 claude -p "$PROMPT" --model "${1:-claude-haiku-5-5}"
377
377
  }
378
378
 
379
379
  # Gemini Flash through the Antigravity CLI (agy). On an 85-minute transcript it