synabun 2.4.5 → 2.4.6

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 (95) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +1 -1
  3. package/docs/whatsapp.md +17 -1
  4. package/hooks/claude-code/session-start.mjs +21 -18
  5. package/lib/claude-global-config.js +214 -0
  6. package/lib/client-config-repair.js +17 -3
  7. package/mcp-server/dist/index.d.ts.map +1 -1
  8. package/mcp-server/dist/index.js +6 -1
  9. package/mcp-server/dist/index.js.map +1 -1
  10. package/mcp-server/dist/services/tool-catalog.js +1 -1
  11. package/mcp-server/dist/services/tool-catalog.js.map +1 -1
  12. package/mcp-server/dist/tools/agents.d.ts +2 -0
  13. package/mcp-server/dist/tools/agents.d.ts.map +1 -1
  14. package/mcp-server/dist/tools/agents.js +11 -5
  15. package/mcp-server/dist/tools/agents.js.map +1 -1
  16. package/mcp-server/dist/tools/skill-tools.d.ts +24 -5
  17. package/mcp-server/dist/tools/skill-tools.d.ts.map +1 -1
  18. package/mcp-server/dist/tools/skill-tools.js +88 -8
  19. package/mcp-server/dist/tools/skill-tools.js.map +1 -1
  20. package/mcp-server/dist/tools/tool-groups.d.ts.map +1 -1
  21. package/mcp-server/dist/tools/tool-groups.js +19 -4
  22. package/mcp-server/dist/tools/tool-groups.js.map +1 -1
  23. package/mcp-server/package-lock.json +2 -2
  24. package/mcp-server/package.json +1 -1
  25. package/mcp-server/src/index.ts +6 -1
  26. package/mcp-server/src/services/tool-catalog.ts +1 -1
  27. package/mcp-server/src/tools/agents.ts +11 -5
  28. package/mcp-server/src/tools/skill-tools.ts +82 -9
  29. package/mcp-server/src/tools/tool-groups.ts +19 -4
  30. package/neural-interface/i18n/en.json +135 -10
  31. package/neural-interface/i18n/pt-BR.json +135 -10
  32. package/neural-interface/lib/antigravity/panel-bridge.js +7 -3
  33. package/neural-interface/lib/assistant-dispatch.js +15 -1
  34. package/neural-interface/lib/assistant-runtime.js +79 -8
  35. package/neural-interface/lib/assistant-user-context.js +7 -3
  36. package/neural-interface/lib/claude-agent-bridge.js +13 -2
  37. package/neural-interface/lib/codex-thread-history.js +144 -7
  38. package/neural-interface/lib/codex-worker-app-server.js +84 -30
  39. package/neural-interface/lib/db.js +26 -0
  40. package/neural-interface/lib/greeting/sources.js +7 -3
  41. package/neural-interface/lib/jsonl-lines.js +10 -11
  42. package/neural-interface/lib/line-buffer.js +88 -0
  43. package/neural-interface/lib/loop-stall.js +15 -1
  44. package/neural-interface/lib/memory-list-read.js +105 -0
  45. package/neural-interface/lib/memory-timers.js +4 -1
  46. package/neural-interface/lib/native-loop-runtime.js +7 -3
  47. package/neural-interface/lib/provider-panel-api-key-auth.js +33 -6
  48. package/neural-interface/lib/skills/api-v2.js +18 -3
  49. package/neural-interface/lib/skills/bundle.js +2 -2
  50. package/neural-interface/lib/skills/deploy.js +169 -34
  51. package/neural-interface/lib/skills/digest.js +57 -3
  52. package/neural-interface/lib/skills/health.js +55 -1
  53. package/neural-interface/lib/skills/known-bridge-digests.json +12 -0
  54. package/neural-interface/lib/skills/runtime-checks.js +7 -4
  55. package/neural-interface/lib/skills/scan-shell.js +56 -7
  56. package/neural-interface/lib/skills/scan.js +13 -12
  57. package/neural-interface/lib/skills/service.js +7 -2
  58. package/neural-interface/lib/skills/telemetry.js +2 -2
  59. package/neural-interface/lib/teams/README.md +12 -5
  60. package/neural-interface/lib/teams/api.js +15 -4
  61. package/neural-interface/lib/teams/index.js +2 -0
  62. package/neural-interface/lib/teams/landing.js +195 -75
  63. package/neural-interface/lib/teams/scheduler.js +31 -32
  64. package/neural-interface/lib/terminal-token-redaction.js +228 -58
  65. package/neural-interface/lib/terminal-tokens.js +18 -0
  66. package/neural-interface/lib/whatsapp/brain.js +21 -0
  67. package/neural-interface/lib/whatsapp/bridge.js +40 -4
  68. package/neural-interface/package-lock.json +2 -2
  69. package/neural-interface/package.json +1 -1
  70. package/neural-interface/public/index.html +117 -37
  71. package/neural-interface/public/shared/agents/studio/ax-api.js +11 -0
  72. package/neural-interface/public/shared/agents/studio/ax-create-view.js +1 -1
  73. package/neural-interface/public/shared/agents/studio/ax-icons.js +1 -0
  74. package/neural-interface/public/shared/agents/studio/ax-library-view.js +3 -2
  75. package/neural-interface/public/shared/agents/studio/ax-main.js +127 -41
  76. package/neural-interface/public/shared/agents/studio/ax-review-view.js +3 -2
  77. package/neural-interface/public/shared/agents/studio/ax-teams-view.js +137 -39
  78. package/neural-interface/public/shared/agents/studio/ax-teams.js +219 -4
  79. package/neural-interface/public/shared/agents/studio/ax-ui.js +31 -0
  80. package/neural-interface/public/shared/agents/studio/ax-views.js +67 -69
  81. package/neural-interface/public/shared/agents/studio/ax-work-answer.js +86 -0
  82. package/neural-interface/public/shared/agents/studio/ax-work-view.js +305 -0
  83. package/neural-interface/public/shared/agents/studio/ax-work.css +74 -0
  84. package/neural-interface/public/shared/agents/studio/ax-work.js +300 -0
  85. package/neural-interface/public/shared/cdx/cdx-deferred.js +90 -0
  86. package/neural-interface/public/shared/cdx/cdx-render.js +18 -7
  87. package/neural-interface/public/shared/cdx/cdx-tabs.js +2 -1
  88. package/neural-interface/public/shared/loading-diagnostic-entry.js +16 -1
  89. package/neural-interface/public/shared/skills/studio/sx-operations-view.js +5 -0
  90. package/neural-interface/public/shared/skills/studio/sx-plan.js +42 -3
  91. package/neural-interface/public/shared/skills/studio/sx-publish-view.js +20 -4
  92. package/neural-interface/server.js +316 -252
  93. package/npm-shrinkwrap.json +2 -2
  94. package/package.json +2 -1
  95. package/skills/skill-forge/SKILL.md +7 -3
@@ -1,4 +1,48 @@
1
1
  // Literal shell dataflow only. Tokens are never expanded or executed.
2
+
3
+ // Word edges of every script. JavaScript's \b knows only [A-Za-z0-9_] as word characters, so it reads "irm" in
4
+ // the Portuguese "irmã", or "node" in "nodeção", as a whole word. unicodeWords(re) keeps re's matches whose
5
+ // every \b (outside a character class, where \b is a backspace) is also an edge over letters, marks, digits and
6
+ // "_" of any script, and drops the others: it never matches where re did not. A letter of a script written
7
+ // without spaces between words, or whose particles attach to a borrowed word, still ends a word: "用curl下载",
8
+ // "curlで", "curl로" and "ใช้curl" name curl, as they did before.
9
+ const SPACELESS = String.raw`\p{scx=Han}\p{scx=Hira}\p{scx=Kana}\p{scx=Bopo}\p{scx=Hang}\p{scx=Thai}\p{scx=Laoo}\p{scx=Khmr}\p{scx=Mymr}`;
10
+ const WORD_CHAR = String.raw`(?:(?![${SPACELESS}])[\p{L}\p{M}\p{N}_])`;
11
+ const WORD_EDGE = `(?:(?<!${WORD_CHAR})(?=${WORD_CHAR})|(?<=${WORD_CHAR})(?!${WORD_CHAR}))`;
12
+ class UnicodeWordRegExp extends RegExp {
13
+ #ascii; #edges;
14
+ static get [Symbol.species]() { return RegExp; }
15
+ constructor(re, source) {
16
+ super(source, `${re.flags}u`);
17
+ this.#ascii = new RegExp(re.source, `${re.flags}g`);
18
+ this.#edges = new RegExp(source, `${re.flags}uy`);
19
+ }
20
+ // The edge pattern is tried only where the ASCII one matches: the cheap scan finds the candidates, and a
21
+ // match of the u-flag pattern alone (its Unicode case folding, a letter after a "/") is never added.
22
+ exec(input) {
23
+ const text = String(input);
24
+ this.#ascii.lastIndex = 0;
25
+ for (let m; (m = this.#ascii.exec(text));) {
26
+ this.#edges.lastIndex = m.index;
27
+ const hit = this.#edges.exec(text);
28
+ if (hit) return hit;
29
+ this.#ascii.lastIndex = m.index + 1;
30
+ }
31
+ return null;
32
+ }
33
+ }
34
+ export function unicodeWords(re) {
35
+ if (/[guyv]/.test(re.flags)) throw new TypeError(`unicodeWords: flags ${re.flags} are not supported`);
36
+ let source = '', inClass = false;
37
+ for (let i = 0; i < re.source.length; i++) {
38
+ const c = re.source[i];
39
+ if (c === '\\') { const next = re.source[++i]; source += !inClass && next === 'b' ? WORD_EDGE : c + next; continue; }
40
+ if (c === '[') inClass = true; else if (c === ']') inClass = false;
41
+ source += c;
42
+ }
43
+ return new UnicodeWordRegExp(re, source);
44
+ }
45
+
2
46
  const runner = /^(?:bash|sh|zsh|dash|ksh|fish|python[23]?|node|perl|ruby|php|lua|pwsh|powershell|deno|bun|osascript|tclsh|Rscript|source|\.)$/;
3
47
  // Arity belongs to the wrapper, never to a shared spelling: e.g. sudo -n
4
48
  // takes no value, while nice/xargs -n do. Optional values must be attached.
@@ -66,8 +110,9 @@ function commands(file, functions) {
66
110
  });
67
111
  return { ...file, text };
68
112
  }
113
+ const dataflowTools = unicodeWords(/\b(?:curl|wget|base64)\b/);
69
114
  export function shellFindings(files) {
70
- if (!files.some((f) => /\b(?:curl|wget|base64)\b/.test(f.text))) return { hits: [], complete: true };
115
+ if (!files.some((f) => dataflowTools.test(f.text))) return { hits: [], complete: true };
71
116
  const functions = new Map(), prepared = files.map((f) => commands(f, functions));
72
117
  const hits = new Map(); let remaining = 100000;
73
118
  function walk(file, outputs, collect, depth = 0, written = new Set()) {
@@ -151,8 +196,9 @@ export function looksLikeShell(text) {
151
196
 
152
197
  const passive = new Set('cp mv ln rm mkdir ls stat file du wc touch shasum sha256sum md5 md5sum open xdg-open qlmanage sips magick convert identify optipng pngcrush cwebp ffmpeg fc-list fc-cache'.split(' '));
153
198
  const readers = new Set(['cat', 'head', 'tail', 'xxd']);
199
+ const installMode = unicodeWords(/(?:-m\s*|--mode[=\s]+)0?7[0-7]{2}\b/);
154
200
  const executableMode = (cmd, raw) => cmd === 'chmod' && /(?:^|\s)(?:[ugoa]*\+[^\s]*x|[0-7]*[1357][0-7]{2})(?:\s|$)/.test(raw)
155
- || cmd === 'install' && /(?:-m\s*|--mode[=\s]+)0?7[0-7]{2}\b/.test(raw);
201
+ || cmd === 'install' && installMode.test(raw);
156
202
  function reviewParts(line) {
157
203
  const parts = []; let current = '', quote = null;
158
204
  for (let i = 0; i < line.length; i++) {
@@ -173,8 +219,11 @@ function reviewParts(line) {
173
219
 
174
220
  // Raw-text catch-alls: no token expansion, quoting or command position can hide these
175
221
  // capabilities. Vocabulary deliberately avoids English verbs such as plain "fetch"/"run".
176
- const downloadText = /\b(?:curl|wget|aria2c|iwr|irm|Invoke-WebRequest|Invoke-RestMethod|uudecode)\b|\bgit\s+clone\b|\b(?:fetch|https?)\s+(?:-[\w-]+\s+)*https?:\/\/|\b(?:fetch|urlopen|URI\.open|requests\.(?:get|request)|https?\.get)\s*\(|\b(?:python[23]?|node|ruby|perl)\b[^\n]*(?:get|request)[^\n]*https?:\/\/|\bbase64\b[^\n]*?(?:--decode\b|-[A-Za-z]*[dD][A-Za-z]*\b)|\bopenssl\s+(?:base64|enc)\b[^\n]*?\s-d\b|\bxxd\s+[^\n]*?-r\b/i;
177
- const runText = /\b(?:bash|sh|zsh|dash|ksh|fish|python[23]?|node|perl|ruby|php|lua|pwsh|powershell|deno|bun|osascript|tclsh|Rscript|npx|eval|Invoke-Expression|iex)\b|\bpnpm\s+dlx\b|\bexec\s+["'`$./\w]|(?:^|[;|&()"'`])\s*(?:(?:env|nohup|command|sudo|exec)\s+(?:-[\w-]+\s+)*)?(?:\.{1,2}\/|\/[\w.-]+\/)[\w./$-]+|\$\{?[A-Za-z_]\w*\}?["']?\s+["'./\w$]|\bchmod\s+[^\n]*?(?:\+\w*x|[0-7]*[1357][0-7]{2})\b|\binstall\s+[^\n]*?(?:-m\s*|--mode[=\s]+)0?7[0-7]{2}\b/i;
222
+ const downloadText = unicodeWords(/\b(?:curl|wget|aria2c|iwr|irm|Invoke-WebRequest|Invoke-RestMethod|uudecode)\b|\bgit\s+clone\b|\b(?:fetch|https?)\s+(?:-[\w-]+\s+)*https?:\/\/|\b(?:fetch|urlopen|URI\.open|requests\.(?:get|request)|https?\.get)\s*\(|\b(?:python[23]?|node|ruby|perl)\b[^\n]*(?:get|request)[^\n]*https?:\/\/|\bbase64\b[^\n]*?(?:--decode\b|-[A-Za-z]*[dD][A-Za-z]*\b)|\bopenssl\s+(?:base64|enc)\b[^\n]*?\s-d\b|\bxxd\s+[^\n]*?-r\b/i);
223
+ const runText = unicodeWords(/\b(?:bash|sh|zsh|dash|ksh|fish|python[23]?|node|perl|ruby|php|lua|pwsh|powershell|deno|bun|osascript|tclsh|Rscript|npx|eval|Invoke-Expression|iex)\b|\bpnpm\s+dlx\b|\bexec\s+["'`$./\w]|(?:^|[;|&()"'`])\s*(?:(?:env|nohup|command|sudo|exec)\s+(?:-[\w-]+\s+)*)?(?:\.{1,2}\/|\/[\w.-]+\/)[\w./$-]+|\$\{?[A-Za-z_]\w*\}?["']?\s+["'./\w$]|\bchmod\s+[^\n]*?(?:\+\w*x|[0-7]*[1357][0-7]{2})\b|\binstall\s+[^\n]*?(?:-m\s*|--mode[=\s]+)0?7[0-7]{2}\b/i);
224
+ const sourceRun = unicodeWords(/\bsource\s+(?:["'`$./]|[\w-]+\.[\w.-]+)/);
225
+ const readerPipe = unicodeWords(/\b(?:cat|head|tail|xxd|tee)\s+[^|]+\|/);
226
+ const readerText = unicodeWords(/\b(?:cat|head|tail|xxd)\b/);
178
227
  // Unlike interpreter names, "make" is common prose. Require command position
179
228
  // in code, or an unfenced command list starting with a known shell program.
180
229
  function makeCommand(line) {
@@ -190,11 +239,11 @@ function makeRun(line, code) {
190
239
  if ([...line.matchAll(/`([^`\n]+)`/g)].some((m) => makeCommand(m[1]))) return true;
191
240
  return /^\s*(?:curl|wget|base64|echo|printf)\s/.test(line) && makeCommand(line);
192
241
  }
193
- const rawRun = (line, code) => runText.test(line) || makeRun(line, code) || /(?:^|[;|&(`])\s*\.\s+(?:["'$./~]|[a-z_][\w.-]*)/.test(line) || /\bsource\s+(?:["'`$./]|[\w-]+\.[\w.-]+)/.test(line)
242
+ const rawRun = (line, code) => runText.test(line) || makeRun(line, code) || /(?:^|[;|&(`])\s*\.\s+(?:["'$./~]|[a-z_][\w.-]*)/.test(line) || sourceRun.test(line)
194
243
  // A substitution in command position runs its result, including $(<file) and
195
244
  // $(cat file). Assignment/echo arguments alone do not run the substituted data.
196
245
  || /(?:^|[;|&(`])\s*(?:[A-Za-z_]\w*=\S+\s+)*(?:(?:env|nohup|command|sudo|exec)\s+(?:(?:-[\w-]+|[A-Za-z_]\w*=\S+)\s+)*)?["']?\$\(/.test(line)
197
- || (downloadText.test(line) || /\b(?:cat|head|tail|xxd|tee)\s+[^|]+\|/.test(line)) && !/^\s*\|.*\|\s*$/.test(line) && [...line.matchAll(/\|\s*([\w$./\\-]+)(?=\s|["'`)]|$)/g)].some((m) => !passive.has(base(m[1])) && !readers.has(base(m[1])) && base(m[1]) !== 'tee');
246
+ || (downloadText.test(line) || readerPipe.test(line)) && !/^\s*\|.*\|\s*$/.test(line) && [...line.matchAll(/\|\s*([\w$./\\-]+)(?=\s|["'`)]|$)/g)].some((m) => !passive.has(base(m[1])) && !readers.has(base(m[1])) && base(m[1]) !== 'tee');
198
247
  const assetText = /(?:[\w$~./-]+|\$\{\w+\})\.(?:png|jpe?g|gif|webp|ico|svg|woff2?|ttf|otf|mp[34]|m4[av]|wav|ogg|flac|webm|mov|avi)(?=$|[^\w.-])/i;
199
248
  const instruction = /^(?:Use|Run|Fetch|Read|See|Open|Copy|Move|Install|Download|Put|Place|Add|Include|Embed|Display|Save|The|This|A|An)\b\s*/i;
200
249
  const article = /^(?:The|This|A|An|the|this|a|an)\b/;
@@ -264,7 +313,7 @@ function assetRun(line, markdown, fenced) {
264
313
  }
265
314
  // A reader redirecting into a program is command evidence even if the program is
266
315
  // unknown. Plain file output and ordinary cat/head/tail/xxd stay passive.
267
- if (/\b(?:cat|head|tail|xxd)\b/.test(candidate) && />\s*(?:>\(|\$\()/.test(candidate)) return true;
316
+ if (readerText.test(candidate) && />\s*(?:>\(|\$\()/.test(candidate)) return true;
268
317
  }
269
318
  return false;
270
319
  }
@@ -1,7 +1,7 @@
1
1
  import { createHash } from 'node:crypto';
2
2
  import { isEditableText } from '../../public/shared/skills/ss-doc.js';
3
3
  import { ASSET_EXT, inspectAsset, assetBudget, scriptMarkers } from './scan-assets.js';
4
- import { shellFindings, shellReviewFindings, looksLikeShell } from './scan-shell.js';
4
+ import { shellFindings, shellReviewFindings, looksLikeShell, unicodeWords } from './scan-shell.js';
5
5
  // ── What a skill can do, read without running anything ──
6
6
  // A local, deterministic look at every file of a skill before it is installed: what it would run and when
7
7
  // (scripts, Claude Code dynamic context, hooks that stay for the session, tool grants), what it reaches (URLs,
@@ -38,9 +38,10 @@ function colourSGR(text, at) {
38
38
  }
39
39
 
40
40
  export const SCAN_ENGINE = 'synabun-static';
41
- export const SCAN_ENGINE_VERSION = '1.7.5';
41
+ export const SCAN_ENGINE_VERSION = '1.7.6';
42
42
  // skills-p1: typosquats of a shipped skill's name (S-13), calibrated on tests/fixtures/skills-scan/corpus.json;
43
43
  // 1.2.0: a name that is exactly a shipped skill's, on something that is not that skill (S-13-shipped-name).
44
+ // 1.7.6: word edges of every script (unicodeWords): "irm" in "irmã" is no download, "node" in "nodeção" no run.
44
45
  export const SCAN_POLICY = 'skills-p5-review-2026-10-27';
45
46
  export const SCAN_LIMITS = Object.freeze({ maxFileChars: 2 * 1024 * 1024, maxTotalChars: 16 * 1024 * 1024, maxLineChars: 20000, maxFindings: 400 });
46
47
 
@@ -60,26 +61,26 @@ const MAGIC = [
60
61
  // Each rule: id, severity, a pattern tested on one line, the message, what to do. Patterns are linear (no nested
61
62
  // quantifiers over overlapping classes) and run on lines cut at maxLineChars.
62
63
  const LINE_RULES = [
63
- { id: 'S-08-remote-pipe', severity: 'high', re: /\b(?:curl|wget|fetch|iwr|irm|Invoke-WebRequest|Invoke-RestMethod)\b[^|\n]{0,400}\|\s*(?:sudo\s+)?(?:ba|z|da|k|fi)?sh\b|\b(?:curl|wget)\b[^|\n]{0,400}\|\s*(?:sudo\s+)?(?:python3?|node|perl|ruby|iex|Invoke-Expression)\b/i,
64
+ { id: 'S-08-remote-pipe', severity: 'high', re: unicodeWords(/\b(?:curl|wget|fetch|iwr|irm|Invoke-WebRequest|Invoke-RestMethod)\b[^|\n]{0,400}\|\s*(?:sudo\s+)?(?:ba|z|da|k|fi)?sh\b|\b(?:curl|wget)\b[^|\n]{0,400}\|\s*(?:sudo\s+)?(?:python3?|node|perl|ruby|iex|Invoke-Expression)\b/i),
64
65
  message: 'Downloads a script and runs it in one step.', remediation: 'Pin what is downloaded (a version, a checksum) and show it before it runs, or drop the step.' },
65
- { id: 'S-08-remote-subshell', severity: 'high', re: /\b(?:ba|z)?sh\s+(?:-c\s+)?["']?\$?\(\s*(?:curl|wget)\b|\bsource\s+<\(\s*(?:curl|wget)\b|\.\s+<\(\s*(?:curl|wget)\b/i,
66
+ { id: 'S-08-remote-subshell', severity: 'high', re: unicodeWords(/\b(?:ba|z)?sh\s+(?:-c\s+)?["']?\$?\(\s*(?:curl|wget)\b|\bsource\s+<\(\s*(?:curl|wget)\b|\.\s+<\(\s*(?:curl|wget)\b/i),
66
67
  message: 'Runs a script fetched from the network.', remediation: 'Ship the script with the skill, or pin and verify it.' },
67
- { id: 'S-08-installer', severity: 'medium', re: /\b(?:npm\s+(?:i|install)\s+(?:-g|--global)\b|npx\s+\S|pnpm\s+dlx\b|pip3?\s+install\b|pipx\s+install\b|brew\s+install\b|gem\s+install\b|cargo\s+install\b|go\s+install\b|apt(?:-get)?\s+install\b)/i,
68
+ { id: 'S-08-installer', severity: 'medium', re: unicodeWords(/\b(?:npm\s+(?:i|install)\s+(?:-g|--global)\b|npx\s+\S|pnpm\s+dlx\b|pip3?\s+install\b|pipx\s+install\b|brew\s+install\b|gem\s+install\b|cargo\s+install\b|go\s+install\b|apt(?:-get)?\s+install\b)/i),
68
69
  message: 'Installs software on the machine that runs it.', remediation: 'Say which package and version, and why; a reviewer decides.' },
69
- { id: 'S-09-decode-exec', severity: 'high', re: /\bbase64\s+(?:-d|--decode|-D)\b[^\n]{0,200}\|\s*(?:sudo\s+)?(?:ba|z)?sh\b|\becho\s+[A-Za-z0-9+/=]{24,}\s*\|\s*base64\b|\b(?:eval|exec)\s*\(\s*(?:atob|Buffer\.from|base64\.b64decode|bytes\.fromhex|codecs\.decode)\b|FromBase64String\s*\([^)]{0,200}\)[^\n]{0,200}(?:Invoke-Expression|iex)\b|powershell(?:\.exe)?\s+[^\n]{0,80}-(?:e|en|enc|encodedcommand)\s+[A-Za-z0-9+/=]{16,}/i,
70
+ { id: 'S-09-decode-exec', severity: 'high', re: unicodeWords(/\bbase64\s+(?:-d|--decode|-D)\b[^\n]{0,200}\|\s*(?:sudo\s+)?(?:ba|z)?sh\b|\becho\s+[A-Za-z0-9+/=]{24,}\s*\|\s*base64\b|\b(?:eval|exec)\s*\(\s*(?:atob|Buffer\.from|base64\.b64decode|bytes\.fromhex|codecs\.decode)\b|FromBase64String\s*\([^)]{0,200}\)[^\n]{0,200}(?:Invoke-Expression|iex)\b|powershell(?:\.exe)?\s+[^\n]{0,80}-(?:e|en|enc|encodedcommand)\s+[A-Za-z0-9+/=]{16,}/i),
70
71
  message: 'Decodes hidden text and runs it.', remediation: 'Write the command out in plain text, or remove it.' },
71
- { id: 'S-09-eval', severity: 'low', re: /\beval\s+["'`$(]|\beval\s*\(/,
72
+ { id: 'S-09-eval', severity: 'low', re: unicodeWords(/\beval\s+["'`$(]|\beval\s*\(/),
72
73
  message: 'Builds a command at run time and evaluates it.', remediation: 'Prefer fixed commands a reader can check.' },
73
- { id: 'S-10-sensitive-path', severity: 'medium', re: /(?:~|\$HOME|%USERPROFILE%|\/Users\/[^/\s]+|\/home\/[^/\s]+)\/(?:\.ssh|\.aws\/credentials|\.netrc|\.gnupg|\.kube\/config|\.docker\/config\.json|\.config\/gcloud|Library\/Keychains|Library\/Cookies|Library\/Application Support\/(?:Google\/Chrome|BraveSoftware|Firefox|Microsoft Edge|com\.apple\.TCC))|\bid_(?:rsa|ed25519|ecdsa)\b|\blogin\.keychain|\bsecurity\s+find-(?:generic|internet)-password\b|\/etc\/(?:shadow|sudoers)\b|\bLogin Data\b/i,
74
+ { id: 'S-10-sensitive-path', severity: 'medium', re: unicodeWords(/(?:~|\$HOME|%USERPROFILE%|\/Users\/[^/\s]+|\/home\/[^/\s]+)\/(?:\.ssh|\.aws\/credentials|\.netrc|\.gnupg|\.kube\/config|\.docker\/config\.json|\.config\/gcloud|Library\/Keychains|Library\/Cookies|Library\/Application Support\/(?:Google\/Chrome|BraveSoftware|Firefox|Microsoft Edge|com\.apple\.TCC))|\bid_(?:rsa|ed25519|ecdsa)\b|\blogin\.keychain|\bsecurity\s+find-(?:generic|internet)-password\b|\/etc\/(?:shadow|sudoers)\b|\bLogin Data\b/i),
74
75
  message: 'Reads credentials or other private data of the user.', remediation: 'Say why it needs them; a reviewer decides.' },
75
- { id: 'S-05-authority-spoof', severity: 'medium', re: /\bignore\s+(?:all\s+)?(?:the\s+)?(?:previous|prior|above|earlier)\s+(?:instructions|rules|prompts?)\b|\byou\s+are\s+now\s+(?:in\s+)?(?:developer|dan|god|jailbreak|unrestricted)\b|<\/?\s*system\s*>|\[\s*system\s*\]\s*:|\bdo\s+not\s+(?:tell|inform|show|mention\s+(?:this\s+)?to)\s+the\s+user\b|\bwithout\s+(?:asking|telling|informing)\s+the\s+user\b|\b(?:disable|bypass|turn\s+off|ignore)\s+(?:the\s+)?(?:safety|security|permission|sandbox|approval)\s+(?:checks?|prompts?|rules?|settings?|mode)\b/i,
76
+ { id: 'S-05-authority-spoof', severity: 'medium', re: unicodeWords(/\bignore\s+(?:all\s+)?(?:the\s+)?(?:previous|prior|above|earlier)\s+(?:instructions|rules|prompts?)\b|\byou\s+are\s+now\s+(?:in\s+)?(?:developer|dan|god|jailbreak|unrestricted)\b|<\/?\s*system\s*>|\[\s*system\s*\]\s*:|\bdo\s+not\s+(?:tell|inform|show|mention\s+(?:this\s+)?to)\s+the\s+user\b|\bwithout\s+(?:asking|telling|informing)\s+the\s+user\b|\b(?:disable|bypass|turn\s+off|ignore)\s+(?:the\s+)?(?:safety|security|permission|sandbox|approval)\s+(?:checks?|prompts?|rules?|settings?|mode)\b/i),
76
77
  message: 'Text that tries to override instructions, hide what it does, or switch off a safeguard.', remediation: 'Remove it, or make sure it is quoted as an example and not an instruction.' },
77
- { id: 'S-07-persistent-write', severity: 'high', re: /(?:>>?\s*|\btee\s+(?:-a\s+)?|\bcp\s+[^\n]{0,200}\s|\bmv\s+[^\n]{0,200}\s|\bwrite(?:File)?\w*\s*\([^)]{0,200})["']?(?:~|\$HOME)?\/?[^\s"']{0,300}(?:\.bashrc|\.zshrc|\.bash_profile|\.profile|\.zprofile|\.config\/fish\/config\.fish|crontab|LaunchAgents\/|\.claude\/settings(?:\.local)?\.json|\.claude\/CLAUDE\.md|CLAUDE\.md|AGENTS\.md|\.codex\/config\.toml|\.mcp\.json|\.gitconfig)\b|\bcrontab\s+-[^l\s]|\blaunchctl\s+(?:load|bootstrap)\b/i,
78
+ { id: 'S-07-persistent-write', severity: 'high', re: unicodeWords(/(?:>>?\s*|\btee\s+(?:-a\s+)?|\bcp\s+[^\n]{0,200}\s|\bmv\s+[^\n]{0,200}\s|\bwrite(?:File)?\w*\s*\([^)]{0,200})["']?(?:~|\$HOME)?\/?[^\s"']{0,300}(?:\.bashrc|\.zshrc|\.bash_profile|\.profile|\.zprofile|\.config\/fish\/config\.fish|crontab|LaunchAgents\/|\.claude\/settings(?:\.local)?\.json|\.claude\/CLAUDE\.md|CLAUDE\.md|AGENTS\.md|\.codex\/config\.toml|\.mcp\.json|\.gitconfig)\b|\bcrontab\s+-[^l\s]|\blaunchctl\s+(?:load|bootstrap)\b/i),
78
79
  message: 'Changes configuration that lasts beyond this task (shell start-up files, scheduled jobs, agent settings or instructions).', remediation: 'Say what it changes and why; a reviewer decides.' },
79
80
  ];
80
81
 
81
- const NETWORK_SINK = /\bcurl\b[^\n]{0,300}\s(?:-d|--data(?:-binary|-raw|-urlencode)?|-F|--form|-T|--upload-file)\b|\bwget\b[^\n]{0,300}--post-(?:data|file)\b|\b(?:nc|ncat|netcat)\s+[^\n]{0,100}\d+|\bscp\s+[^\n]{0,300}@|\brsync\s+[^\n]{0,300}@[^\s:]+:|Invoke-(?:WebRequest|RestMethod)\b[^\n]{0,300}-Method\s+(?:Post|Put)\b|\brequests\.(?:post|put)\s*\(|\bfetch\s*\([^)]{0,300}method\s*:\s*["'](?:POST|PUT)["']/i;
82
- const SECRET_ENV = /\$\{?(?:[A-Z0-9_]*(?:TOKEN|SECRET|PASSWORD|PASSWD|API_?KEY|PRIVATE_?KEY|ACCESS_?KEY|CREDENTIALS?)[A-Z0-9_]*)\}?|\bprocess\.env\.[A-Z0-9_]*(?:TOKEN|SECRET|KEY|PASSWORD)\b|\bos\.environ\b/;
82
+ const NETWORK_SINK = unicodeWords(/\bcurl\b[^\n]{0,300}\s(?:-d|--data(?:-binary|-raw|-urlencode)?|-F|--form|-T|--upload-file)\b|\bwget\b[^\n]{0,300}--post-(?:data|file)\b|\b(?:nc|ncat|netcat)\s+[^\n]{0,100}\d+|\bscp\s+[^\n]{0,300}@|\brsync\s+[^\n]{0,300}@[^\s:]+:|Invoke-(?:WebRequest|RestMethod)\b[^\n]{0,300}-Method\s+(?:Post|Put)\b|\brequests\.(?:post|put)\s*\(|\bfetch\s*\([^)]{0,300}method\s*:\s*["'](?:POST|PUT)["']/i);
83
+ const SECRET_ENV = unicodeWords(/\$\{?(?:[A-Z0-9_]*(?:TOKEN|SECRET|PASSWORD|PASSWD|API_?KEY|PRIVATE_?KEY|ACCESS_?KEY|CREDENTIALS?)[A-Z0-9_]*)\}?|\bprocess\.env\.[A-Z0-9_]*(?:TOKEN|SECRET|KEY|PASSWORD)\b|\bos\.environ\b/);
83
84
  const URL_RE = /\bhttps?:\/\/[^\s<>"'`)\]]{1,300}/gi;
84
85
 
85
86
  // Credentials written into a file: the value is never repeated in a finding.
@@ -48,6 +48,10 @@ export const SERVICE_CAPABILITIES = Object.freeze([
48
48
  // P4: evaluations from the Test tab (/evals, lib/skills/evals.js): task and trigger cases, the description
49
49
  // optimiser, results, history, export and the suite import.
50
50
  'evals', 'usage', 'health', 'discover', 'packages', 'external-scanner-status',
51
+ // 2026-11-28: every committed install is checked statically by itself (discoverable, eligibility per runtime in
52
+ // `state.eligibilityByRuntime`); the skill view's installation rows carry that `state`; owners and agents can run
53
+ // that check again (POST /installations/:id/check; a probe of Codex / OpenCode only when asked).
54
+ 'install-static-check',
51
55
  ]);
52
56
 
53
57
  export const ASSISTANT_RUNTIMES = Object.freeze(['claude', 'codex', 'opencode', 'antigravity']);
@@ -263,7 +267,7 @@ export function createSkillsService({ dataDir, roots, catalog, library, deployer
263
267
  description: latest ? revisionDescription(latest) : draftDescription(skill.pointers.draft),
264
268
  pointers: skill.pointers, revisions: skill.revisions.length,
265
269
  latest: latest ? { integrity: latest.integrity, error: latest.error || null, revisionId: latest.revisionId, contentDigest: latest.contentDigest, createdAt: latest.createdAt, author: latest.author } : null,
266
- installations: installs.map((i) => ({ installationId: i.installationId, runtime: i.target.runtime, scope: i.target.scope, accountId: i.target.accountId, projectPath: i.target.projectPath, destination: i.destination.path, sourceRevisionId: i.sourceRevisionId, updateAvailable: !!upstream && i.sourceRevisionId !== upstream && skill.origin?.kind === 'bundled' })),
270
+ installations: installs.map((i) => ({ installationId: i.installationId, runtime: i.target.runtime, scope: i.target.scope, accountId: i.target.accountId, projectPath: i.target.projectPath, destination: i.destination.path, sourceRevisionId: i.sourceRevisionId, updateAvailable: !!upstream && i.sourceRevisionId !== upstream && skill.origin?.kind === 'bundled', affectedRuntimes: i.destination.affectedRuntimes || [], state: i.state || null })),
267
271
  };
268
272
  }
269
273
 
@@ -506,7 +510,8 @@ export function createSkillsService({ dataDir, roots, catalog, library, deployer
506
510
  let nativeState = 'absent';
507
511
  if (root) {
508
512
  const inspected = ownership.inspect({ destination: join(root.path, name) });
509
- nativeState = inspected.state === 'absent' ? 'absent' : (native && inspected.current.digest === native.export.artifactDigest ? 'native' : (inspected.state === 'owned' ? 'native' : (inspected.state === 'modified' ? 'modified' : 'other')));
513
+ // The installation's own bytes (its executable bits taken from it where files keep none: deploy.js installedDigest).
514
+ nativeState = inspected.state === 'absent' ? 'absent' : (native && deployer.installedDigest(native, inspected.current) === native.export.artifactDigest ? 'native' : (inspected.state === 'owned' ? 'native' : (inspected.state === 'modified' ? 'modified' : 'other')));
510
515
  }
511
516
  out[runtime] = { native: nativeState, installationId: native?.installationId || null, destination: root ? join(root.path, name) : null };
512
517
  }
@@ -1,7 +1,6 @@
1
1
  // Minimal local evidence, from trusted runtime events only. No prompts, commands, paths, or outputs are stored.
2
2
  import { createHash } from 'node:crypto';
3
3
  import { join, resolve, sep } from 'node:path';
4
- import { readManifest } from './digest.js';
5
4
  import { toolCallsOf, initOf } from './eval-trace.js';
6
5
  import { localRecord } from './local-store.js';
7
6
 
@@ -32,7 +31,8 @@ export function createSkillTelemetry({ dataDir, deployer, settings, now = Date.n
32
31
  const events = read();
33
32
  if (events.some((e) => e.key === key)) return;
34
33
  // Only attribute bytes that still match the installed export. Drift is health evidence, not approved usage.
35
- if (readManifest(inst.destination.path).digest !== inst.export.artifactDigest) return;
34
+ // (deploy.js installedDigest: where files keep no executable bit, Windows, the bit is the installation's.)
35
+ if (deployer.installedDigest(inst) !== inst.export.artifactDigest) return;
36
36
  events.push({ key, at: now(), turn: turnOf(run), runRef: hash(String(run.runId)), installationId: inst.installationId,
37
37
  skillId: inst.skillId, revisionId: inst.sourceRevisionId, exportDigest: inst.export.artifactDigest,
38
38
  runtime, kind, method, strength, outcome: null, costUsd: null });
@@ -81,7 +81,7 @@ createTeams({ store, git, runTests, setup, identity, isIgnored, registry, now, l
81
81
  | `isIgnored` | `git check-ignore` | `(worktree, relPath) => boolean` |
82
82
  | `registry` | `lib/worker-confinement.js` | `{ register, unregister }`: where slices are registered for the worker guard |
83
83
 
84
- It returns: `create`, `get`, `plan`, `list`, `inspect`, `startSlice`, `finishSlice`, `integrate`, `integrateAll`, `testIntegration`, `resolveInSlice`, `acceptIntegrationHead`, `land`, `remove`, `prune`, `recover`, `checkWrite`, `verifyOwnership`, `context`, and `modules` (`state`, `worktrees`, `claims`, `integration`, `landing`, `recovery`) for a caller that needs one module's own functions.
84
+ It returns: `create`, `get`, `plan`, `list`, `inspect`, `startSlice`, `finishSlice`, `integrate`, `integrateAll`, `testIntegration`, `resolveInSlice`, `acceptIntegrationHead`, `land`, `landingPreview`, `remove`, `prune`, `recover`, `checkWrite`, `verifyOwnership`, `context`, and `modules` (`state`, `worktrees`, `claims`, `integration`, `landing`, `recovery`) for a caller that needs one module's own functions.
85
85
 
86
86
  ## Worktrees (`worktrees.js`)
87
87
 
@@ -222,17 +222,24 @@ When the last slice is joined the team is `ready` and an `integration.ready` eve
222
222
 
223
223
  ## Landing (`landing.js`)
224
224
 
225
- **`land(teamId, { targetBranch, mode, allowUntested, allowPartial })`** → `{ ok, landed, changed }`
225
+ **`land(teamId, { targetBranch, mode, allowUntested, allowPartial, unmovedOnly, expectedTargetHead, expectedIntegrationHead })`** → `{ ok, landed, changed }`
226
226
 
227
- - `targetBranch`: default, the branch the project was on when the team was created.
227
+ - `targetBranch`: default, the team's recorded base branch (the branch the project was on when the team was created). Never the branch that is checked out when somebody lands: the scheduler passes the same default, and a base branch that is gone is `TARGET_NOT_FOUND`, with no other branch in its place.
228
+ - `unmovedOnly`: land only while the target is at the commit the team was cut from (`OWNER_BRANCH_MOVED` otherwise). The scheduler asks it of an Assistant's landing.
229
+ - `expectedTargetHead`, `expectedIntegrationHead`: the full commit ids the two branches were at when the landing was confirmed (a preview's `targetHead` and `integrationHead`). Compared with git under the landing's own lock, before any other check; one that differs is `LANDING_PREVIEW_STALE`, with the landing as it stands in `preview`.
228
230
  - `mode: 'ff'` (default) moves the target forward to the integration branch. `mode: 'merge'` makes a merge commit of the two (always, also when a fast-forward would do), computed without a checkout (`git merge-tree`, git 2.38 or newer), and moves the target to it.
229
231
  - Where the target is checked out (the user's own checkout, usually), the branch, the index and the files are updated together by a fast-forward of that checkout. Every uncommitted change of a file the landing does not touch comes through unchanged, staged or not; nothing is stashed; no hook runs. Where the target is checked out nowhere, only the branch moves (compare-and-swap on its old commit).
230
232
  - The team is then `merged` (`landed: { targetBranch, mode, from, to, mergeCommit, checkout, files, tested, partial }`) and its claims are given back.
231
233
 
232
- A landing changes nothing, and answers with a `report`, for:
234
+ **`preview(teamId, { targetBranch, mode, unmovedOnly })`** (on the service: `teams.landingPreview`) → `{ targetBranch, targetHead, integrationHead, testCommand, testsPassedOnHead, canLand, code, reason }`. What a landing sent now, with no override, would be told: `canLand` is true exactly when it would be accepted; otherwise `code` is the refusal's and `reason` the first sentence of its message. `targetHead` and `integrationHead` are the two tips as git has them (null: not there). It takes no lock and moves nothing. `land` and `preview` run the same two functions (`admit`: the team, the mode, the target's name; `decide`: everything that needs the two heads), so they cannot disagree; a new check goes into one of those, never into `land` alone. The scheduler puts it into a team's status as `landing.preview`.
235
+
236
+ A landing changes nothing, and answers with a `report`, for the codes below. Once the team's own state and the target's name are accepted, they are asked in this order: `LANDING_PREVIEW_STALE`, `OWNER_BRANCH_MOVED`, `INTEGRATION_MOVED`, `TEAM_NOT_READY`, `TARGET_NOT_FOUND`, `NOTHING_TO_LAND`, `TESTS_NOT_PASSED`, `NOT_FAST_FORWARD` / `MERGE_CONFLICT`, then the checkout's (`CHECKOUT_BUSY`, `CHECKOUT_REFUSED`, `DIRTY_FILES_AFFECTED`).
233
237
 
234
238
  | Code | |
235
239
  |---|---|
240
+ | `LANDING_PREVIEW_STALE` | an expected head is not where the branch is now (`preview`, and in `report`: `expectedTargetHead`, `targetHead`, `expectedIntegrationHead`, `integrationHead`) |
241
+ | `OWNER_BRANCH_MOVED` | `unmovedOnly` and the target is not at the team's base commit (`cutFrom`, `head`) |
242
+ | `NOTHING_TO_LAND` | the target already has everything on the integration branch. Asked before the tests: joins that changed nothing leave nothing to test |
236
243
  | `NOT_FAST_FORWARD` | `mode: 'ff'` and the target has commits the integration branch lacks (`targetOnly`, `integrationOnly`) |
237
244
  | `MERGE_CONFLICT` | `mode: 'merge'` and the two do not merge cleanly (`files`). Never resolved |
238
245
  | `TESTS_NOT_PASSED` | the tests have not passed on the integration head: no test command, not run on this commit, or failed. `allowUntested: true` lands on the caller's word |
@@ -241,7 +248,7 @@ A landing changes nothing, and answers with a `report`, for:
241
248
  | `CHECKOUT_BUSY` | that checkout is in the middle of a merge, rebase, cherry-pick, revert or bisect |
242
249
  | `CHECKOUT_REFUSED` | git would not update that checkout (it checks again as it starts) |
243
250
  | `TARGET_MOVED` | the target moved while the landing was prepared |
244
- | `INTEGRATION_MOVED`, `TARGET_NOT_FOUND`, `TARGET_REQUIRED`, `TARGET_IS_TEAM_BRANCH`, `NOTHING_TO_LAND`, `ALREADY_LANDED`, `INVALID_MODE`, `MERGE_UNAVAILABLE` | |
251
+ | `INTEGRATION_MOVED`, `TARGET_NOT_FOUND`, `TARGET_REQUIRED`, `TARGET_IS_TEAM_BRANCH`, `ALREADY_LANDED`, `INVALID_MODE`, `MERGE_UNAVAILABLE` | |
245
252
 
246
253
  Where it applies, `report.userShouldRun` is what the user can run themselves (`git checkout <target>`, `git merge --ff-only synabun/<team>/integration`).
247
254
 
@@ -53,6 +53,15 @@ export function teamAnswerBody(answer) {
53
53
  }
54
54
 
55
55
  const send = (res, answer) => res.status(teamAnswerStatus(answer)).json(teamAnswerBody(answer));
56
+ /**
57
+ * Where the two branches were when a landing was confirmed (the `landing.preview` the caller read), as a land
58
+ * request names them: `expectedTargetHead`, `expectedIntegrationHead` (the tool: `expected_target_head`,
59
+ * `expected_integration_head`). Optional; the landing answers LANDING_PREVIEW_STALE when one is elsewhere now.
60
+ */
61
+ const expectedHeads = (body) => ({
62
+ expectedTargetHead: body.expectedTargetHead ?? body.expected_target_head ?? null,
63
+ expectedIntegrationHead: body.expectedIntegrationHead ?? body.expected_integration_head ?? null,
64
+ });
56
65
  const fail = (res, error) => {
57
66
  const status = Number.isInteger(error?.status) && error.status >= 400 && error.status < 600 ? error.status : 500;
58
67
  res.status(status).json({ ok: false, code: typeof error?.code === 'string' ? error.code : 'TEAM_FAILED', error: error?.message || String(error) });
@@ -125,13 +134,14 @@ export function registerAssistantTeamRoutes(router, { scheduler, orchestrationGu
125
134
  }));
126
135
  router.get('/teams/:id', orchestrationGuard, run(async (req, res, teams) => {
127
136
  if (refuseOthers(req, res, teams, req.params.id)) return;
128
- send(res, await teams.status(req.params.id));
137
+ // `landing.preview` is the landing as the one who asks would be told (an Assistant never lands on a branch that moved).
138
+ send(res, await teams.status(req.params.id, { by: by(req) }));
129
139
  }));
130
140
  router.post('/teams/:id/integrate', orchestrationGuard, run(async (req, res, teams) => {
131
141
  if (refuseOthers(req, res, teams, req.params.id)) return;
132
142
  if (refusePlanning(req, res, 'send the team back to work')) return;
133
143
  const body = req.body || {};
134
- send(res, await teams.integrate(req.params.id, { sliceId: body.sliceId || body.slice_id || body.slice || null }));
144
+ send(res, await teams.integrate(req.params.id, { sliceId: body.sliceId || body.slice_id || body.slice || null, by: by(req) }));
135
145
  }));
136
146
  router.post('/teams/:id/assign', orchestrationGuard, run(async (req, res, teams) => {
137
147
  if (refuseOthers(req, res, teams, req.params.id) || refusePlanning(req, res, 'assign paths to a slice')) return;
@@ -151,6 +161,7 @@ export function registerAssistantTeamRoutes(router, { scheduler, orchestrationGu
151
161
  const who = by(req);
152
162
  send(res, await teams.land(req.params.id, {
153
163
  targetBranch: body.targetBranch || body.target_branch || null, mode, by: who,
164
+ ...expectedHeads(body),
154
165
  // Landing untested or partial work is the owner's word, never an agent's.
155
166
  allowUntested: who.kind === 'owner' && body.allowUntested === true, allowPartial: who.kind === 'owner' && body.allowPartial === true,
156
167
  }));
@@ -329,7 +340,7 @@ export function registerTeamStudioRoutes({ route, reader, owner, json, scheduler
329
340
  route('get', '/teams/:id', reader, teamReader, idCheck, run(async (req, res, teams) => {
330
341
  const session = sessionOf(req);
331
342
  if (session !== null && teams.get(req.params.id) && !teams.ownedBy(req.params.id, session)) return send(res, { ok: false, code: 'TEAM_FORBIDDEN', message: 'That team belongs to another Assistant session.' });
332
- const answer = await teams.status(req.params.id, { timeline: 100 });
343
+ const answer = await teams.status(req.params.id, { timeline: 100, by: session !== null ? { kind: 'assistant', sessionId: session } : { kind: 'owner' } });
333
344
  if (!answer.ok) return send(res, answer);
334
345
  res.json(teamDetail(answer));
335
346
  }));
@@ -337,7 +348,7 @@ export function registerTeamStudioRoutes({ route, reader, owner, json, scheduler
337
348
  const body = req.body || {};
338
349
  const mode = String(body.mode || 'ff');
339
350
  if (!LANDING_MODES.includes(mode)) return send(res, { ok: false, code: 'INVALID_MODE', message: `mode is one of ${LANDING_MODES.join(', ')}.` });
340
- send(res, await teams.land(req.params.id, { targetBranch: body.targetBranch || body.target_branch || null, mode, by: { kind: 'owner' }, allowUntested: body.allowUntested === true, allowPartial: body.allowPartial === true }));
351
+ send(res, await teams.land(req.params.id, { targetBranch: body.targetBranch || body.target_branch || null, mode, by: { kind: 'owner' }, ...expectedHeads(body), allowUntested: body.allowUntested === true, allowPartial: body.allowPartial === true }));
341
352
  }));
342
353
  route('post', '/teams/:id/discard', json, owner, idCheck, run(async (req, res, teams) => {
343
354
  const body = req.body || {};
@@ -104,6 +104,8 @@ export function createTeams({ store, git = createGitRunner(), runTests = createT
104
104
  resolveInSlice: integration.resolveInSlice,
105
105
  acceptIntegrationHead: integration.acceptIntegrationHead,
106
106
  land: landing.land,
107
+ /** What a landing sent now would be told, without moving anything: the checks of `land` itself. Read only. */
108
+ landingPreview: landing.preview,
107
109
  remove,
108
110
  prune: worktrees.prune,
109
111
  recover: recovery.recover,