@attalabs/vinaya 0.43.1 → 0.44.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.
Files changed (42) hide show
  1. package/README.md +1 -1
  2. package/dist/checks/bin/check-token-collection-wired.js +0 -1
  3. package/dist/checks/bin/verify-dispatch.js +0 -1
  4. package/dist/index.js +105 -42
  5. package/dist/programs/dev-review-loop.js +3 -2
  6. package/dist/programs/run-engine.js +59 -33
  7. package/dist/programs/task-brief.js +29 -4
  8. package/dist/programs/task-tools-serve.js +37 -8
  9. package/package.json +1 -1
  10. package/studio-standalone/apps/vinaya-studio/.next/BUILD_ID +1 -1
  11. package/studio-standalone/apps/vinaya-studio/.next/build-manifest.json +2 -2
  12. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  13. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.html +1 -1
  14. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.rsc +1 -1
  15. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  16. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  17. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  18. package/studio-standalone/apps/vinaya-studio/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  19. package/studio-standalone/apps/vinaya-studio/.next/server/app/milestones/page_client-reference-manifest.js +1 -1
  20. package/studio-standalone/apps/vinaya-studio/.next/server/app/page.js +1 -1
  21. package/studio-standalone/apps/vinaya-studio/.next/server/app/page.js.nft.json +1 -1
  22. package/studio-standalone/apps/vinaya-studio/.next/server/app/page_client-reference-manifest.js +1 -1
  23. package/studio-standalone/apps/vinaya-studio/.next/server/app/tasks/page_client-reference-manifest.js +1 -1
  24. package/studio-standalone/apps/vinaya-studio/.next/server/chunks/209.js +2 -2
  25. package/studio-standalone/apps/vinaya-studio/.next/server/chunks/951.js +1 -1
  26. package/studio-standalone/apps/vinaya-studio/.next/server/middleware-build-manifest.js +1 -1
  27. package/studio-standalone/apps/vinaya-studio/.next/server/pages/500.html +1 -1
  28. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/151-23bea4cac9687151.js +1 -0
  29. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/layout-dfa2186095e797bd.js +1 -0
  30. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/milestones/page-2fffb49104860a15.js +1 -0
  31. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/page-6ae258f663623b2a.js +1 -0
  32. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/tasks/page-2fffb49104860a15.js +1 -0
  33. package/studio-standalone/apps/vinaya-studio/log-follow.mjs +5601 -0
  34. package/studio-standalone/apps/vinaya-studio/log-sync-folder-source.mjs +5089 -0
  35. package/studio-standalone/apps/vinaya-studio/package.json +2 -0
  36. package/studio-standalone/apps/vinaya-studio/studio-server.mjs +2574 -2
  37. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/layout-57b790abf8793795.js +0 -1
  38. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/milestones/page-9fbd5991bc7a1eed.js +0 -1
  39. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/page-9fbd5991bc7a1eed.js +0 -1
  40. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/tasks/page-9fbd5991bc7a1eed.js +0 -1
  41. /package/studio-standalone/apps/vinaya-studio/.next/static/{64XwAXRg-jkgQPC54BkEN → _r9iZDxlkoek85d_3oaxL}/_buildManifest.js +0 -0
  42. /package/studio-standalone/apps/vinaya-studio/.next/static/{64XwAXRg-jkgQPC54BkEN → _r9iZDxlkoek85d_3oaxL}/_ssgManifest.js +0 -0
package/README.md CHANGED
@@ -4,7 +4,7 @@ The `vinaya` bin — Vinaya's npm-distributed CLI, published to the public npm r
4
4
 
5
5
  ## Install
6
6
 
7
- The published artifact is a Node-executable bundle — plain Node ≥ 22.13 is enough, through any package manager:
7
+ The published artifact is a Node-executable bundle — plain Node ≥ 22.13 is enough, through any package manager. Running a task (`vinaya task run`) also needs Bun on the PATH: tasks run on the Atta Engine by default, which runs on Bun, and a run that cannot start it is refused unless you choose the standalone runner (`--runner standalone`, or `"runner": "standalone"` in `vinaya.config.json`).
8
8
 
9
9
  ```bash
10
10
  npx @attalabs/vinaya init # or: pnpm dlx / yarn dlx / bunx
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env node
2
- // @bun
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env node
2
- // @bun
3
2
 
4
3
  // ../../harness/processes/vinaya-strict/checks/standalone/verify-dispatch.ts
5
4
  import { execFile as execFile4, execFileSync as execFileSync2, spawnSync } from "child_process";
package/dist/index.js CHANGED
@@ -1565,7 +1565,7 @@ function resolveLogsHeaderValues(headers, env) {
1565
1565
  return resolved;
1566
1566
  }
1567
1567
  function resolveTaskRunner(override, config) {
1568
- const runner = override ?? config?.runner ?? "standalone";
1568
+ const runner = override ?? config?.runner ?? "atta-engine";
1569
1569
  if (runner !== "standalone" && runner !== "atta-engine") {
1570
1570
  throw new Error("runner: expected standalone or atta-engine");
1571
1571
  }
@@ -1812,6 +1812,20 @@ function findLetteredEdgeIds(body) {
1812
1812
  }
1813
1813
  return found;
1814
1814
  }
1815
+ function findPlainTextEdgeLabels(body) {
1816
+ const prose = extractSection(body).replace(/`[^`]*`/g, " ");
1817
+ const found = [];
1818
+ const labelPattern = /(Depends-on|Conflicts-with)\s*:[ \t]*([^.;—(\n]*)/gi;
1819
+ let match = labelPattern.exec(prose);
1820
+ while (match !== null) {
1821
+ const value = (match[2] ?? "").trim();
1822
+ const hasId = value.split(",").some((s) => ID_TOKEN.test(s.trim()));
1823
+ if (hasId)
1824
+ found.push(`${match[1]}: ${value}`);
1825
+ match = labelPattern.exec(prose);
1826
+ }
1827
+ return found;
1828
+ }
1815
1829
  var SECTION_HEADER, NEXT_HEADER, FIELD_LABEL, ID_TOKEN, SLUG_QUALIFIED_ID, LETTERED_EDGE_ID;
1816
1830
  var init_parse_rationale_deps = __esm(() => {
1817
1831
  SECTION_HEADER = /\*\*Dependency rationale\*\*/i;
@@ -3927,6 +3941,15 @@ function checkEdgeIdsWholeNumbers(body) {
3927
3941
  errors: lettered.map((id) => `issue-validation edge id: \`${id}\` in a \`Depends-on\`/\`Conflicts-with\` edge is not a whole number — task ids are whole numbers (\`1\`, \`2\`), never lettered (\`2a\`). \`vinaya task run\` and \`task dispatch\` refuse a non-numeric id, so a plan naming one names a task that cannot be started.`)
3928
3942
  };
3929
3943
  }
3944
+ function checkEdgesInBackticks(body) {
3945
+ const plain = findPlainTextEdgeLabels(body);
3946
+ if (plain.length === 0)
3947
+ return { status: "pass", errors: [] };
3948
+ return {
3949
+ status: "fail",
3950
+ errors: plain.map((label) => `issue-validation edge backticks: \`${label}\` is written outside backticks — an edge is read only inside backticks, as \`Depends-on: #5\`, so this one is silently dropped and the task would start without it. Wrap it in a backtick span.`)
3951
+ };
3952
+ }
3930
3953
  function checkIssueObjectives(body, issueNumber, sinceIssue = OBJECTIVES_SINCE_ISSUE) {
3931
3954
  if (sinceIssue !== null && issueNumber !== null && issueNumber < sinceIssue)
3932
3955
  return { status: "pass", errors: [] };
@@ -18130,7 +18153,7 @@ var init_commands = __esm(() => {
18130
18153
  flags: [
18131
18154
  {
18132
18155
  flag: "--runner <standalone|atta-engine>",
18133
- description: "Override runner config for this invocation; absent uses config, whose default is standalone"
18156
+ description: "Override runner config for this invocation; absent uses config, whose default is atta-engine, which needs Bun on the PATH"
18134
18157
  },
18135
18158
  {
18136
18159
  flag: "--agent <claude|codex>",
@@ -18150,7 +18173,7 @@ var init_commands = __esm(() => {
18150
18173
  }
18151
18174
  ],
18152
18175
  details: [
18153
- "The atta-engine runner starts the Engine runner with Bun, so it needs Bun on the machine, streams its output and returns its exit code. The published package carries the Engine runner as a built program and a checkout starts its source file; a command line without the runner file prints one notice and falls back to standalone. Engine Log events use the local folder only; logs: false disables all Log destinations for both runners.",
18176
+ "The atta-engine runner starts the Engine runner with Bun, so it needs Bun on the PATH, streams its output and returns its exit code; it is the default when config names no runner. The published package carries the Engine runner as a built program and a checkout starts its source file. When the runner file is absent or Bun is not on the PATH, the run is refused with one message naming the cause and exits 3, before it is prepared or a background controller launched, and names `--runner standalone` — or, for a flow other than v1, says that flow needs the Engine; a `--rollback` start makes no such check. Engine Log events use the local folder only; logs: false disables all Log destinations for both runners.",
18154
18177
  "A run's runner is recorded when it starts and never changes: switching `runner` in config changes only the runner of new runs, and a run recorded on `atta-engine` keeps routing to the Engine for `task status`, `task_resume` and `task_cancel`. A start on a pause another runner holds is refused with a typed reason naming the recorded runner and the requested one, and so is a start on another runner's Engine run that is still in flight with no pause held — halted or stopped short of completed or cancelled.",
18155
18178
  "`--rollback` ends the Engine run first: a held pause through the shared cancel `task_cancel` uses, which needs a Principal ruling newer than the pause as any cancel does; a run halted with no pause held has its started effects fenced; a run that already completed or was cancelled is refused, as is a driver still running with no pause held, which is never signalled; and the standalone run never starts while the Engine driver lives, a cancelled run's driver given a bounded wait to release its lock. Every started and uncertain effect is then reconciled by its identity: one the forge carries is recorded verified, one it does not carry is left for the restarted run to complete, and one the forge read cannot settle refuses the restart. Each rehearsal appends a record — task, recorded runner, action, reconciled effect identities, the restarted run's runner and terminal state — to `backend-rollback-rehearsals.jsonl` in the task's runtime directory, whether it completed, was refused or failed at a later step, and nothing removes it.",
18156
18179
  "`--widen-surface` is the Planner's one command for a widen-surface escalation, and refuses before any write when the held pause is not one (no pause, a pause with a pull request — whose continuation is the ruling on that pull request — or a round whose Developer asked for no `widen_surface`), when a driver is still alive for the task, when the escalation's resolution is already consumed (a replay — the Surface is never widened twice), or when the widened body fails the write gate, whose findings name the field to edit first. The escalation packet's permitted next actions name this command with the globs the Developer asked for, and `task_resume` refuses such an escalation naming it.",
@@ -28358,8 +28381,8 @@ var init_config_reference = __esm(() => {
28358
28381
  key: "runner",
28359
28382
  type: '"standalone" | "atta-engine" (optional)',
28360
28383
  semantics: [
28361
- "Selects the task runner. The default is `standalone`: an absent key runs the standalone loop, so a published install never changes runner on its own. Any value other than `standalone` or `atta-engine` is refused at config load. `task run --runner <name>` overrides this setting for one invocation, so `standalone` stays selectable by this key and by that flag.",
28362
- "atta-engine starts the Engine runner as a Bun subprocess with the resolved task, agent and model, so it needs Bun on the machine. The published package carries the Engine runner as a built program, `dist/programs/run-engine.js`, beside a copy of the process files it loads under `dist/vinaya-strict`; a checkout of this repository starts the runner’s source file. When the Engine runner file is absent, `task run` prints one fallback notice, `vinaya task run: Engine runner script is unavailable; falling back to standalone.`, and runs standalone. The Engine Log reaches the same configured destination the standalone loop uses, a server included.",
28384
+ "Selects the task runner. The default is `atta-engine`: an absent key runs the Atta Engine. Any value other than `standalone` or `atta-engine` is refused at config load. `task run --runner <name>` overrides this setting for one invocation, so `standalone` stays selectable by this key and by that flag.",
28385
+ "atta-engine starts the Engine runner as a Bun subprocess with the resolved task, agent and model, so it needs Bun on the PATH. The published package carries the Engine runner as a built program, `dist/programs/run-engine.js`, beside a copy of the process files it loads under `dist/vinaya-strict`; a checkout of this repository starts the runner’s source file. When the Engine runner file is absent or Bun is not on the PATH, the run is refused with one message naming the cause, before the Issue is assigned or a runner recorded: it names `--runner standalone`, or, for a flow other than `v1`, says that flow needs the Engine. No run continues on the standalone runner by itself. The Engine Log reaches the same configured destination the standalone loop uses, a server included.",
28363
28386
  "Each run records the runner it actually used, and status, resume and cancel follow that record rather than this key. A run with no recorded runner, started before runs recorded one, is a standalone run, whatever this key now names."
28364
28387
  ],
28365
28388
  example: `{ "runner": "atta-engine" }`
@@ -29469,6 +29492,7 @@ function validateIssueContent(input) {
29469
29492
  [checkSurfaceGlobsResolve(input.body, input.resolvesToFile).errors, "surfaceGlobsResolve"],
29470
29493
  [checkPartsCiteDefinedObjectives(input.body).errors, "partsCiteObjectives"],
29471
29494
  [checkEdgeIdsWholeNumbers(input.body).errors, "edgeIdsWholeNumbers"],
29495
+ [checkEdgesInBackticks(input.body).errors, "edgesInBackticks"],
29472
29496
  [checkDocsWithinSurface(input.body, input.issueNumber, input.briefSectionsSinceIssue).errors, "docsWithinSurface"],
29473
29497
  [checkSurfaceExcludesBoundDoc(input.body, input.docOwnersContent).errors, "surfaceExcludesBoundDoc"],
29474
29498
  [
@@ -30166,6 +30190,7 @@ var init_forge_write = __esm(() => {
30166
30190
  surfaceGlobsResolve: "Fix the named `## Surface` `in:` glob so it matches at least one real tracked file (a typo, or a directory that does not exist yet), then re-run `{cmd}`.",
30167
30191
  partsCiteObjectives: "Fix the named Part to cite an objective id the `## Objectives` section actually defines, or add the missing objective, then re-run `{cmd}`.",
30168
30192
  edgeIdsWholeNumbers: "Rewrite the named `Depends-on`/`Conflicts-with` edge to a whole-number task id (`1`, `2`), a `#<NNN>` Issue ref, or a `<slug> <n>` cross-tranche reference — task ids are never lettered — then re-run `{cmd}`.",
30193
+ edgesInBackticks: "Wrap the named `Depends-on`/`Conflicts-with` label and its ids in one backtick span (`Depends-on: #5`) — an edge written outside backticks is not read — then re-run `{cmd}`.",
30169
30194
  docsWithinSurface: 'Move the named doc pointer to a path `## Surface`\'s `in:` globs actually cover (never widen the surface just to fit the pointer — that renders an unusable brief), or drop it from "Docs to keep coherent" if this task does not really keep it coherent, then re-run `{cmd}`.',
30170
30195
  surfaceExcludesBoundDoc: "Either move the named `out:` glob so it no longer covers the bound document, or narrow the `in:` glob so it no longer reaches the doc-owners binding — the Issue cannot declare both at once. Then re-run `{cmd}`.",
30171
30196
  rationaleSurfaceCoverage: "Widen the named `## Surface` `in:` directory glob to cover the Boundary path (nearest entry named above) — `## Surface` lists directories, never a file path, so widen the glob rather than adding the file path itself — or correct the path if it was mistyped, then re-run `{cmd}`.",
@@ -33315,7 +33340,8 @@ function noPushResumeArgv(task, branch, agent, model, runner) {
33315
33340
  ...address,
33316
33341
  ...agent ? ["--agent", agent] : [],
33317
33342
  ...model ? ["--model", model] : [],
33318
- ...runner ? ["--runner", runner] : []
33343
+ "--runner",
33344
+ runner ?? "standalone"
33319
33345
  ];
33320
33346
  }
33321
33347
  function shellQuote(token) {
@@ -33898,8 +33924,8 @@ var init_pause_resume = __esm(async () => {
33898
33924
 
33899
33925
  // ../../harness/processes/vinaya-strict/loops/dev-review/run-control/task-run-engine.ts
33900
33926
  import { spawn as spawn5 } from "node:child_process";
33901
- import { existsSync as existsSync39, readFileSync as readFileSync44, renameSync as renameSync8, writeFileSync as writeFileSync24 } from "node:fs";
33902
- import { dirname as dirname24, join as join46 } from "node:path";
33927
+ import { accessSync as accessSync5, constants as constants4, existsSync as existsSync39, readFileSync as readFileSync44, renameSync as renameSync8, statSync as statSync11, writeFileSync as writeFileSync24 } from "node:fs";
33928
+ import { delimiter as delimiter3, dirname as dirname24, join as join46 } from "node:path";
33903
33929
  function taskRunnerRecordPath(task, root = runtimeDirForThisRepo()) {
33904
33930
  return runPath2(root, task, { area: "task", file: "runner.json" });
33905
33931
  }
@@ -33973,18 +33999,33 @@ function engineContinuationArgv(target) {
33973
33999
  function engineContinuationCommand(target) {
33974
34000
  return ["bun", ...engineContinuationArgv(target)].join(" ");
33975
34001
  }
34002
+ function findBunOnPath(path = process.env.PATH) {
34003
+ for (const directory of (path ?? "").split(delimiter3)) {
34004
+ if (directory === "")
34005
+ continue;
34006
+ const candidate = join46(directory, "bun");
34007
+ try {
34008
+ if (!statSync11(candidate).isFile())
34009
+ continue;
34010
+ accessSync5(candidate, constants4.X_OK);
34011
+ return candidate;
34012
+ } catch {}
34013
+ }
34014
+ return null;
34015
+ }
34016
+ function engineStartRefusal(flow = undefined, script = engineRunnerScriptPath(), exists = existsSync39, findBun = () => findBunOnPath()) {
34017
+ const cause = !exists(script) ? `its runner file ${script} is absent` : findBun() === null ? "Bun is not on the PATH, and the Engine runner runs on Bun" : null;
34018
+ if (cause === null)
34019
+ return null;
34020
+ const remedy = flow !== undefined && flow !== "v1" ? `flow ${flow} needs the Engine, so make the Engine startable before starting this flow` : "make the Engine startable, or start this task on the standalone runner with `--runner standalone`";
34021
+ return `the Atta Engine runner cannot start: ${cause}. Nothing was started; ${remedy}.`;
34022
+ }
33976
34023
  function engineRunnerScriptPath() {
33977
34024
  return programFile("run-engine");
33978
34025
  }
33979
34026
  async function runTaskEngine(input, overrides = {}, starting = () => {}) {
33980
34027
  const deps = { ...defaultEngineRunnerDeps, ...overrides };
33981
34028
  const script = deps.scriptPath();
33982
- if (!deps.exists(script)) {
33983
- if (input.flow && input.flow !== "v1")
33984
- throw new Error(`flow ${input.flow} requires the Engine; its runner script is unavailable. Install the workspace runner before starting this flow.`);
33985
- deps.notice(ENGINE_FALLBACK_NOTICE);
33986
- return null;
33987
- }
33988
34029
  starting();
33989
34030
  return deps.spawn([
33990
34031
  "bun",
@@ -33997,7 +34038,7 @@ async function runTaskEngine(input, overrides = {}, starting = () => {}) {
33997
34038
  ...input.flow ? ["--flow", input.flow] : []
33998
34039
  ], { stdio: "inherit" });
33999
34040
  }
34000
- var ENGINE_FALLBACK_NOTICE = "vinaya task run: Engine runner script is unavailable; falling back to standalone.", defaultEngineRunnerDeps, PROCESS_FOLDER_IN_CHECKOUT = "harness/processes/vinaya-strict";
34041
+ var defaultEngineRunnerDeps, PROCESS_FOLDER_IN_CHECKOUT = "harness/processes/vinaya-strict";
34001
34042
  var init_task_run_engine = __esm(async () => {
34002
34043
  init_programs();
34003
34044
  init_run_paths();
@@ -34012,8 +34053,7 @@ var init_task_run_engine = __esm(async () => {
34012
34053
  resolveExit(code ?? (signal === "SIGINT" ? 130 : signal === "SIGTERM" ? 143 : 1));
34013
34054
  });
34014
34055
  }),
34015
- notice: (line) => process.stderr.write(`${line}
34016
- `)
34056
+ findBun: () => findBunOnPath()
34017
34057
  };
34018
34058
  });
34019
34059
 
@@ -40734,7 +40774,7 @@ var init_pr = __esm(async () => {
40734
40774
 
40735
40775
  // ../../harness/processes/vinaya-strict/loops/dev-review/standalone/dev-review-loop/live-check.ts
40736
40776
  import { execFile as execFile11, execFileSync as execFileSync33, spawn as spawn6 } from "node:child_process";
40737
- import { mkdtempSync as mkdtempSync8, rmSync as rmSync17, statSync as statSync11 } from "node:fs";
40777
+ import { mkdtempSync as mkdtempSync8, rmSync as rmSync17, statSync as statSync12 } from "node:fs";
40738
40778
  import { homedir as homedir11, tmpdir as tmpdir11 } from "node:os";
40739
40779
  import { join as join52 } from "node:path";
40740
40780
  function liveVendorsNamed(command) {
@@ -40742,7 +40782,7 @@ function liveVendorsNamed(command) {
40742
40782
  }
40743
40783
  function nonEmptyFileExists(path) {
40744
40784
  try {
40745
- const stat = statSync11(path);
40785
+ const stat = statSync12(path);
40746
40786
  return stat.isFile() && stat.size > 0;
40747
40787
  } catch {
40748
40788
  return false;
@@ -46876,7 +46916,7 @@ var init_detached_launch = __esm(async () => {
46876
46916
 
46877
46917
  // ../../harness/processes/vinaya-strict/tools/follow-view.ts
46878
46918
  import { execFileSync as execFileSync38 } from "node:child_process";
46879
- import { readdirSync as readdirSync16, readFileSync as readFileSync56, statSync as statSync12 } from "node:fs";
46919
+ import { readdirSync as readdirSync16, readFileSync as readFileSync56, statSync as statSync13 } from "node:fs";
46880
46920
  import { homedir as homedir12 } from "node:os";
46881
46921
  import { join as join57 } from "node:path";
46882
46922
  function isStage(value) {
@@ -46994,7 +47034,7 @@ function readStageHistory(root, exceptIssue) {
46994
47034
  const logs = issues.map((issue) => {
46995
47035
  const path = loopLogPathFor(null, issue, root);
46996
47036
  try {
46997
- return { path, mtime: statSync12(path).mtimeMs };
47037
+ return { path, mtime: statSync13(path).mtimeMs };
46998
47038
  } catch {
46999
47039
  return null;
47000
47040
  }
@@ -48490,7 +48530,10 @@ function resumeContinuation(target, runner, program, launcher) {
48490
48530
  if (runner === "atta-engine")
48491
48531
  return { command: "bun", argv: engineContinuationArgv(target) };
48492
48532
  if (target.pr === null)
48493
- return { command: program, argv: noPushResumeArgv(target.issue, target.branch, target.agent, target.model) };
48533
+ return {
48534
+ command: program,
48535
+ argv: noPushResumeArgv(target.issue, target.branch, target.agent, target.model, "standalone")
48536
+ };
48494
48537
  const invocation = programInvocation("dev-review-loop", ["--resume", String(target.pr), "--agent", target.agent]);
48495
48538
  return { command: launcher ?? invocation.command, argv: invocation.argv };
48496
48539
  }
@@ -80381,6 +80424,10 @@ async function runTask(input, deps = defaultRunTaskDeps) {
80381
80424
  await init_run_lifecycle();
80382
80425
  throw new RunTaskError(`runTask: ${taskLabel} was cancelled at ${cancelled.consumedAt} and its Engine checkpoint is kept — a cancelled run is never resumed. To set that checkpoint aside and start the task anew on ${agent}, run \`${taskSwitchCommand(issue, agent)}\`.`);
80383
80426
  }
80427
+ const engine = { ...defaultEngineRunnerDeps, ...deps.engine };
80428
+ const refusal = engineStartRefusal(input.flow, engine.scriptPath(), engine.exists, engine.findBun);
80429
+ if (refusal !== null)
80430
+ throw new RunTaskError(refusal);
80384
80431
  }
80385
80432
  deps.assignIssue(issue);
80386
80433
  if (runner === "atta-engine") {
@@ -80390,11 +80437,7 @@ async function runTask(input, deps = defaultRunTaskDeps) {
80390
80437
  ...resolvedModel ? { model: resolvedModel } : {},
80391
80438
  ...input.flow ? { flow: input.flow } : {}
80392
80439
  }, deps.engine, () => deps.recordRunner?.(issue, "atta-engine"));
80393
- if (exitCode !== null)
80394
- return { exitCode, task: issue, branch, prUrl: null, prNumber: null, finalDecision: null };
80395
- const refusedFallback = heldByAnother("standalone");
80396
- if (refusedFallback !== null)
80397
- throw refusedFallback;
80440
+ return { exitCode, task: issue, branch, prUrl: null, prNumber: null, finalDecision: null };
80398
80441
  }
80399
80442
  deps.recordRunner?.(issue, "standalone");
80400
80443
  const loopResult = await deps.devReviewLoop(shouldResumeFromPause ? { resumePr: existingPr.number, agent, ...resolvedModel ? { model: resolvedModel } : {} } : { task: issue, agent, ...resolvedModel ? { model: resolvedModel } : {} });
@@ -80715,6 +80758,19 @@ function flowOrExit(parsed, runner) {
80715
80758
  process.exit(2);
80716
80759
  }
80717
80760
  }
80761
+ function engineStartRefusalForStart(start, engine = {}) {
80762
+ if (start.rollback || start.runner !== "atta-engine")
80763
+ return null;
80764
+ return engineStartRefusal(start.flow, engine.script, engine.exists, engine.findBun);
80765
+ }
80766
+ function engineStartOrExit(start) {
80767
+ const refusal = engineStartRefusalForStart(start);
80768
+ if (refusal === null)
80769
+ return;
80770
+ process.stderr.write(`Error: ${refusal}
80771
+ `);
80772
+ process.exit(TASK_RUN_FAILURE_EXIT_CODE);
80773
+ }
80718
80774
  function runnerOrExit(parsed) {
80719
80775
  try {
80720
80776
  return runnerForFlags(parsed);
@@ -80765,7 +80821,8 @@ function attachedRunNotice(input, stdinIsTty) {
80765
80821
  return null;
80766
80822
  const address = "tranche" in input ? `${input.tranche} ${input.n}` : `--issue ${input.issue}`;
80767
80823
  const model = input.model ? ` --model ${input.model}` : "";
80768
- return `vinaya task run: this run is attached to this terminal and stops when the terminal closes. To keep it running after the terminal closes, use: vinaya task run ${address} --agent ${input.agent}${model} --background`;
80824
+ const runner = input.runner ? ` --runner ${input.runner}` : "";
80825
+ return `vinaya task run: this run is attached to this terminal and stops when the terminal closes. To keep it running after the terminal closes, use: vinaya task run ${address} --agent ${input.agent}${model}${runner} --background`;
80769
80826
  }
80770
80827
  async function runAndReport(input) {
80771
80828
  const notice = attachedRunNotice(input, process.stdin.isTTY === true);
@@ -80833,6 +80890,7 @@ ${USAGE4}`);
80833
80890
  const runner = runnerOrExit(parsed);
80834
80891
  const flow = flowOrExit(parsed, runner);
80835
80892
  const widen = widenSurfaceOrExit(parsed);
80893
+ engineStartOrExit({ runner, ...flow, ...rollback });
80836
80894
  applyQuiet(parsed);
80837
80895
  if (parsed.background) {
80838
80896
  await runBackgroundAndReport({ issue: issueN, agent, model: parsed.model, runner, ...flow, ...widen });
@@ -80864,6 +80922,7 @@ ${USAGE4}`);
80864
80922
  const runner = runnerOrExit(parsed);
80865
80923
  const flow = flowOrExit(parsed, runner);
80866
80924
  const widen = widenSurfaceOrExit(parsed);
80925
+ engineStartOrExit({ runner, ...flow, ...rollback });
80867
80926
  applyQuiet(parsed);
80868
80927
  if (parsed.background) {
80869
80928
  await runBackgroundAndReport({ tranche: trancheSlug, n, agent, model: parsed.model, runner, ...flow, ...widen });
@@ -80934,7 +80993,7 @@ async function switchTask(input, deps) {
80934
80993
  if (deps.readRunner(task) !== "atta-engine") {
80935
80994
  return {
80936
80995
  kind: "standalone",
80937
- message: `vinaya task switch: task ${task} runs on the standalone runner, which already continues a task on a new --agent by itself; nothing was changed. Run: ${run}`
80996
+ message: `vinaya task switch: task ${task} runs on the standalone runner, which already continues a task on a new --agent by itself; nothing was changed. Run: ${run} --runner standalone`
80938
80997
  };
80939
80998
  }
80940
80999
  const pid = deps.liveDriverPid(task);
@@ -81945,6 +82004,10 @@ import { randomBytes } from "node:crypto";
81945
82004
  import { existsSync as existsSync63, readFileSync as readFileSync63, realpathSync as realpathSync9 } from "node:fs";
81946
82005
  import net2 from "node:net";
81947
82006
  import { dirname as dirname35, join as join64, resolve as resolve11 } from "node:path";
82007
+ function studioBuildArgs(entry, outfile, externals = []) {
82008
+ const flags = externals.map((name) => `--external=${name}`);
82009
+ return ["build", entry, "--target=node", "--format=esm", ...flags, `--outfile=${outfile}`];
82010
+ }
81948
82011
  function resolveStudioTarget(cwd, moduleUrl = import.meta.url) {
81949
82012
  let dir = cwd;
81950
82013
  for (;; ) {
@@ -82088,16 +82151,12 @@ function planLaunch(target, cwd, port, base) {
82088
82151
  env,
82089
82152
  prepare: {
82090
82153
  command: "bun",
82091
- args: [
82092
- "build",
82093
- join64("src", "server", "entry.ts"),
82094
- "--target=node",
82095
- "--format=esm",
82096
- "--external=next",
82097
- "--external=ws",
82098
- `--outfile=${CHECKOUT_HOST_RELPATH}`
82099
- ]
82100
- }
82154
+ args: studioBuildArgs(join64("src", "server", "entry.ts"), CHECKOUT_HOST_RELPATH, ["next", "ws"])
82155
+ },
82156
+ prepareRuntime: STUDIO_LOG_RUNTIME_FILES.map(({ entry, out }) => ({
82157
+ command: "bun",
82158
+ args: studioBuildArgs(join64(target.appDir, "..", "..", ...entry.split("/")), join64(dirname35(CHECKOUT_HOST_RELPATH), out))
82159
+ }))
82101
82160
  };
82102
82161
  }
82103
82162
  return {
@@ -82154,8 +82213,8 @@ async function launchStudio(cwd, args, deps = {}) {
82154
82213
  log(`[studio] port ${ports.primary} is taken — using ${port}`);
82155
82214
  }
82156
82215
  const plan = planLaunch(target, cwd, port, deps.env ?? process.env);
82157
- if (plan.prepare) {
82158
- const prepared = spawnSync8(plan.prepare.command, plan.prepare.args, {
82216
+ for (const step of [...plan.prepare ? [plan.prepare] : [], ...plan.prepareRuntime ?? []]) {
82217
+ const prepared = spawnSync8(step.command, step.args, {
82159
82218
  cwd: plan.cwd,
82160
82219
  env: plan.env,
82161
82220
  stdio: "inherit"
@@ -82222,10 +82281,14 @@ async function runStudio(cwd, args, deps = {}) {
82222
82281
  async function studioCommand(args) {
82223
82282
  process.exitCode = await runStudio(process.cwd(), args);
82224
82283
  }
82225
- var STUDIO_HOST = "127.0.0.1", PRIMARY_PORT = 3008, FALLBACK_PORT = 3108, BOOTSTRAP_ROUTE = "/__studio/bootstrap", CHECKOUT_HOST_RELPATH, GIT_TIMEOUT_MS = 5000, WAIT_FOR_PORT_MS = 120000, POLL_MS = 150, WITHHELD_NAMES;
82284
+ var STUDIO_HOST = "127.0.0.1", PRIMARY_PORT = 3008, FALLBACK_PORT = 3108, BOOTSTRAP_ROUTE = "/__studio/bootstrap", CHECKOUT_HOST_RELPATH, STUDIO_LOG_RUNTIME_FILES, GIT_TIMEOUT_MS = 5000, WAIT_FOR_PORT_MS = 120000, POLL_MS = 150, WITHHELD_NAMES;
82226
82285
  var init_studio = __esm(() => {
82227
82286
  init_studio_bundle();
82228
82287
  CHECKOUT_HOST_RELPATH = join64(".next", "studio-host", "entry.mjs");
82288
+ STUDIO_LOG_RUNTIME_FILES = [
82289
+ { entry: "harness/kernel/log/client/log-follow.ts", out: "log-follow.mjs" },
82290
+ { entry: "harness/kernel/log/client/log-sync-folder-source.ts", out: "log-sync-folder-source.mjs" }
82291
+ ];
82229
82292
  WITHHELD_NAMES = new Set(["VINAYA_LOG_TOKEN", "GH_TOKEN", "GITHUB_TOKEN", "NPM_TOKEN", "NODE_AUTH_TOKEN"]);
82230
82293
  });
82231
82294
 
@@ -20855,7 +20855,8 @@ function noPushResumeArgv(task, branch, agent, model, runner) {
20855
20855
  ...address,
20856
20856
  ...agent ? ["--agent", agent] : [],
20857
20857
  ...model ? ["--model", model] : [],
20858
- ...runner ? ["--runner", runner] : []
20858
+ "--runner",
20859
+ runner ?? "standalone"
20859
20860
  ];
20860
20861
  }
20861
20862
  var SHELL_SAFE_TOKEN = /^[A-Za-z0-9._@%+=:,/-]+$/;
@@ -28534,7 +28535,7 @@ import { join as join40 } from "node:path";
28534
28535
  import { readFileSync as readFileSync37 } from "node:fs";
28535
28536
 
28536
28537
  // ../../harness/processes/vinaya-strict/loops/dev-review/run-control/task-run-engine.ts
28537
- import { existsSync as existsSync34, readFileSync as readFileSync36, renameSync as renameSync9, writeFileSync as writeFileSync19 } from "node:fs";
28538
+ import { accessSync as accessSync4, constants as constants3, existsSync as existsSync34, readFileSync as readFileSync36, renameSync as renameSync9, statSync as statSync11, writeFileSync as writeFileSync19 } from "node:fs";
28538
28539
  init_programs();
28539
28540
  init_run_paths();
28540
28541
  function taskRunnerRecordPath(task, root = runtimeDirForThisRepo()) {