@attalabs/vinaya 0.42.1 → 0.43.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 (88) hide show
  1. package/dist/checks/bin/check-evidence-fresh.js +177 -152
  2. package/dist/checks/bin/check-registry-gates.js +10 -3
  3. package/dist/index.js +300 -173
  4. package/dist/lib/pre-push-cache-test-run.js +145 -144
  5. package/dist/lib/pre-push-changed-files.js +10 -3
  6. package/dist/lib/pre-push-progress-dir.js +169 -147
  7. package/dist/lib/pre-push-select-tests.js +16 -4
  8. package/dist/lib/push-progress-observer.js +169 -147
  9. package/dist/programs/archive.js +172 -148
  10. package/dist/programs/audit.js +169 -147
  11. package/dist/programs/check.js +172 -148
  12. package/dist/programs/commit-msg.js +172 -148
  13. package/dist/programs/dev-review-loop.js +300 -176
  14. package/dist/programs/dispatch.js +1905 -1877
  15. package/dist/programs/log-emit.js +172 -148
  16. package/dist/programs/log-selftest.js +172 -148
  17. package/dist/programs/log-send.js +172 -148
  18. package/dist/programs/pr-report.js +177 -152
  19. package/dist/programs/pr-snapshot.js +172 -148
  20. package/dist/programs/pr-verify-evidence.js +177 -152
  21. package/dist/programs/pr.js +172 -148
  22. package/dist/programs/review-post.js +172 -148
  23. package/dist/programs/review-status.js +180 -148
  24. package/dist/programs/run-engine.js +110594 -0
  25. package/dist/programs/supervised-command.js +67 -0
  26. package/dist/programs/sync.js +63 -39
  27. package/dist/programs/task-brief.js +174 -150
  28. package/dist/programs/task-sweep.js +244 -151
  29. package/dist/programs/task-tools-serve.js +260 -163
  30. package/dist/programs/tokens.js +172 -148
  31. package/dist/programs/waiver.js +172 -148
  32. package/dist/vinaya-strict/checks/registry.ts +1085 -0
  33. package/dist/vinaya-strict/executing/code-reviewer/README.md +3 -0
  34. package/dist/vinaya-strict/executing/code-reviewer/doctrine.md +185 -0
  35. package/dist/vinaya-strict/executing/code-reviewer/evals/README.md +1 -0
  36. package/dist/vinaya-strict/executing/code-reviewer/evals/code-reviewer-cases.json +280 -0
  37. package/dist/vinaya-strict/executing/code-reviewer/grants.yaml +22 -0
  38. package/dist/vinaya-strict/executing/code-reviewer/output.schema.json +93 -0
  39. package/dist/vinaya-strict/executing/code-reviewer/review-result.ts +347 -0
  40. package/dist/vinaya-strict/executing/dev-review.flow.yaml +103 -0
  41. package/dist/vinaya-strict/executing/developer/README.md +3 -0
  42. package/dist/vinaya-strict/executing/developer/developer-doctrine-shape.test.ts +69 -0
  43. package/dist/vinaya-strict/executing/developer/developer-turn-result.ts +286 -0
  44. package/dist/vinaya-strict/executing/developer/doctrine.md +111 -0
  45. package/dist/vinaya-strict/executing/developer/evals/README.md +1 -0
  46. package/dist/vinaya-strict/executing/developer/evals/developer-capability-cases.json +6275 -0
  47. package/dist/vinaya-strict/executing/developer/evals/developer-capability-held-out.json +11526 -0
  48. package/dist/vinaya-strict/executing/developer/evals/developer-capability-suite.test.ts +498 -0
  49. package/dist/vinaya-strict/executing/developer/evals/developer-capability-suite.ts +1407 -0
  50. package/dist/vinaya-strict/executing/developer/grants.yaml +25 -0
  51. package/dist/vinaya-strict/executing/developer/output.schema.json +148 -0
  52. package/dist/vinaya-strict/executing/developer/reference.md +376 -0
  53. package/dist/vinaya-strict/executing/operator/doctrine.md +209 -0
  54. package/dist/vinaya-strict/executing/security-reviewer/README.md +3 -0
  55. package/dist/vinaya-strict/executing/security-reviewer/doctrine.md +171 -0
  56. package/dist/vinaya-strict/executing/security-reviewer/evals/README.md +1 -0
  57. package/dist/vinaya-strict/executing/security-reviewer/evals/security-reviewer-cases.json +141 -0
  58. package/dist/vinaya-strict/executing/security-reviewer/grants.yaml +22 -0
  59. package/dist/vinaya-strict/executing/security-reviewer/output.schema.json +93 -0
  60. package/dist/vinaya-strict/integration/config/vinaya-config-section.ts +1278 -0
  61. package/dist/vinaya-strict/integration/policies/vinaya-policies.ts +52 -0
  62. package/dist/vinaya-strict/integration/process/process-integration.ts +57 -0
  63. package/dist/vinaya-strict/loops/dev-review/v2/dev-review-v2.flow.yaml +136 -0
  64. package/dist/vinaya-strict/process.yaml +43 -0
  65. package/dist/vinaya-strict/retrospecting/archivist/doctrine.md +174 -0
  66. package/dist/vinaya-strict/retrospecting/tranche-archivist/doctrine.md +270 -0
  67. package/dist/vinaya-strict/thinking/architect/doctrine.md +110 -0
  68. package/dist/vinaya-strict/thinking/planner/doctrine.md +105 -0
  69. package/dist/vinaya-strict/thinking/planner/tools/amend-rationale-deps.test.ts +128 -0
  70. package/dist/vinaya-strict/thinking/planner/tools/amend-rationale-deps.ts +169 -0
  71. package/dist/vinaya-strict/thinking/planner/tools/open-issue.test.ts +701 -0
  72. package/dist/vinaya-strict/thinking/planner/tools/open-issue.ts +1035 -0
  73. package/dist/vinaya-strict/thinking/planner/tools/planner-operations.test.ts +359 -0
  74. package/dist/vinaya-strict/thinking/planner/tools/planner-operations.ts +815 -0
  75. package/dist/vinaya-strict/thinking/planner/tools/planner-tools.test.ts +200 -0
  76. package/dist/vinaya-strict/thinking/planner/tools/planner-tools.ts +458 -0
  77. package/package.json +4 -2
  78. package/studio-standalone/apps/vinaya-studio/.next/BUILD_ID +1 -1
  79. package/studio-standalone/apps/vinaya-studio/.next/build-manifest.json +2 -2
  80. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.html +1 -1
  81. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.rsc +1 -1
  82. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  83. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  84. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  85. package/studio-standalone/apps/vinaya-studio/.next/server/middleware-build-manifest.js +1 -1
  86. package/studio-standalone/apps/vinaya-studio/.next/server/pages/500.html +1 -1
  87. /package/studio-standalone/apps/vinaya-studio/.next/static/{yFfoujElgbwPk-7KNS-kw → x2q88XfwsihlevulRhIvs}/_buildManifest.js +0 -0
  88. /package/studio-standalone/apps/vinaya-studio/.next/static/{yFfoujElgbwPk-7KNS-kw → x2q88XfwsihlevulRhIvs}/_ssgManifest.js +0 -0
package/dist/index.js CHANGED
@@ -6904,21 +6904,145 @@ var init_resolve_repo = __esm(() => {
6904
6904
  };
6905
6905
  });
6906
6906
 
6907
+ // ../../harness/kernel/log/roles.ts
6908
+ function registerRole(name, role) {
6909
+ roles.set(name, role);
6910
+ }
6911
+ function registerTitle(name, title) {
6912
+ titles.set(name, title);
6913
+ }
6914
+ function isRole(value) {
6915
+ return value !== undefined && roles.has(value);
6916
+ }
6917
+ function lookupRole(name) {
6918
+ return roles.get(name);
6919
+ }
6920
+ function lookupTitle(name) {
6921
+ return roles.get(name)?.title ?? titles.get(name);
6922
+ }
6923
+ var roles, titles;
6924
+ var init_roles = __esm(() => {
6925
+ roles = new Map;
6926
+ titles = new Map;
6927
+ });
6928
+
6929
+ // ../../harness/kernel/log/envelope.ts
6930
+ import { createHash as createHash5 } from "node:crypto";
6931
+ function actorIdFromEnv(role) {
6932
+ return role === undefined || role === "" ? null : role;
6933
+ }
6934
+ function lineageFieldFromEnv(value) {
6935
+ return value === undefined || value === "" ? null : value;
6936
+ }
6937
+ function attemptFromEnv(value) {
6938
+ if (value === undefined || value === "")
6939
+ return null;
6940
+ const n = Number(value);
6941
+ return Number.isInteger(n) ? n : null;
6942
+ }
6943
+ function provenanceFor(input) {
6944
+ if (input.provenance)
6945
+ return input.provenance;
6946
+ if (issueFromTask(input.env.task) === null && (input.branchIssue ?? null) !== null)
6947
+ return "unavailable";
6948
+ if (input.env.role || input.env.task)
6949
+ return "env_correlated";
6950
+ return "unavailable";
6951
+ }
6952
+ function issueFromTask(task) {
6953
+ if (task === undefined || task === "")
6954
+ return null;
6955
+ const n = Number(task);
6956
+ return Number.isInteger(n) ? n : null;
6957
+ }
6958
+ function roundFromEnv(round) {
6959
+ if (round === undefined || round === "")
6960
+ return;
6961
+ const n = Number(round);
6962
+ return Number.isInteger(n) ? n : undefined;
6963
+ }
6964
+ function prFromEnv(pr) {
6965
+ if (pr === undefined || pr === "")
6966
+ return;
6967
+ const n = Number(pr);
6968
+ return Number.isInteger(n) && n > 0 ? n : undefined;
6969
+ }
6970
+ function buildHeader(input) {
6971
+ const role = isRole(input.env.role) ? input.env.role : "unattributed";
6972
+ const round = roundFromEnv(input.env.round);
6973
+ const pr = prFromEnv(input.env.pr);
6974
+ const subject = {
6975
+ issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
6976
+ role,
6977
+ ...round !== undefined ? { round } : {},
6978
+ ...pr !== undefined ? { pr } : {},
6979
+ ...input.subject ?? {}
6980
+ };
6981
+ const issue = subject.issue;
6982
+ return {
6983
+ meta: {
6984
+ schema: 4,
6985
+ ts: input.now.toISOString(),
6986
+ run_id: input.runId,
6987
+ seq: input.seq,
6988
+ repo: input.repo,
6989
+ vinaya: input.vinaya,
6990
+ doctrine: input.doctrine,
6991
+ host: input.host,
6992
+ machine: createHash5("sha256").update(input.hostname).digest("hex"),
6993
+ event_id: input.eventId,
6994
+ process_id: input.processId,
6995
+ actor_id: actorIdFromEnv(input.env.role),
6996
+ lineage: {
6997
+ run: lineageFieldFromEnv(input.env.run),
6998
+ attempt: attemptFromEnv(input.env.attempt),
6999
+ parent: lineageFieldFromEnv(input.env.parent)
7000
+ },
7001
+ input_versions: {
7002
+ manifest_version: input.inputVersions?.manifestVersion ?? null,
7003
+ objectives_version: input.inputVersions?.objectivesVersion ?? null,
7004
+ brief_hash: input.inputVersions?.briefHash ?? null,
7005
+ ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
7006
+ pause_bound_ruling: input.inputVersions?.pauseBoundRuling ?? null,
7007
+ policy_digest: input.inputVersions?.policyDigest ?? null
7008
+ },
7009
+ provenance: provenanceFor(input),
7010
+ work: {
7011
+ ref: lineageFieldFromEnv(input.env.workRef) ?? (issue === null ? null : String(issue)),
7012
+ repo: input.repo,
7013
+ change: pr === undefined ? null : String(pr),
7014
+ revision: input.revision ?? null
7015
+ },
7016
+ flow: {
7017
+ id: lineageFieldFromEnv(input.env.flow) ?? "vinaya",
7018
+ version: lineageFieldFromEnv(input.env.flowVersion)
7019
+ },
7020
+ runtime: lineageFieldFromEnv(input.env.runtime),
7021
+ process: {
7022
+ id: lineageFieldFromEnv(input.env.processId) ?? "vinaya",
7023
+ version: lineageFieldFromEnv(input.env.processVersion),
7024
+ digest: lineageFieldFromEnv(input.env.processDigest)
7025
+ },
7026
+ runner: {
7027
+ id: lineageFieldFromEnv(input.env.runnerId) ?? "standalone",
7028
+ version: lineageFieldFromEnv(input.env.runnerVersion)
7029
+ },
7030
+ source: lineageFieldFromEnv(input.env.source)
7031
+ },
7032
+ subject
7033
+ };
7034
+ }
7035
+ var init_envelope = __esm(() => {
7036
+ init_roles();
7037
+ });
7038
+
6907
7039
  // ../../harness/kernel/log/schema.ts
6908
7040
  import { z as z6 } from "zod";
6909
- var CONFIDENCE_REASON_MAX_LENGTH = 280, REVIEW_FINDING_DESCRIPTION_MAX_LENGTH = 1000, ROLE_VALUES, RoleSchema, HOST_VALUES, HostSchema, RUN_ID_PATTERN, headerMetaCore, HeaderMetaV1Schema, LineageSchema, InputVersionsSchema, ProvenanceSchema, HeaderMetaV2Schema, WorkSchema, FlowSchema, HeaderMetaV3Schema, HeaderMetaV4Schema, HeaderMetaSchema, SubjectSchema, HeaderSchema, envelopeTail, ReviewFindingSchema, DispatchOutcomeSchema, dispatchShared, dispatchUsageField, DispatchEventSchema, CODE_TOKEN_PATTERN, CodeTokenSchema, ReviewerVerdictSchema, loopShared, DevReviewLoopEventSchema, ForgeOpSchema, ForgeWriteTargetSchema, forgeWriteShared, ForgeWriteEventSchema, GateOutcomeSchema, gateShared, GateEventSchema, OperationResultSchema, operationShared, OperationEventSchema, UsageUnitsSchema, usageShared, UsageEventSchema, RoleAttemptOutcomeSchema, roleAttemptShared, RoleAttemptEventSchema, handoffShared, HandoffEventSchema, EffectTargetSchema, effectShared, EffectEventSchema, CustomFieldValueSchema, customShared, CustomEventSchema, LogEventSchema;
7041
+ var CONFIDENCE_REASON_MAX_LENGTH = 280, REVIEW_FINDING_DESCRIPTION_MAX_LENGTH = 1000, ROLE_NAME_PATTERN, RoleSchema, HOST_VALUES, HostSchema, RUN_ID_PATTERN, headerMetaCore, HeaderMetaV1Schema, LineageSchema, InputVersionsSchema, ProvenanceSchema, HeaderMetaV2Schema, WorkSchema, FlowSchema, HeaderMetaV3Schema, HeaderMetaV4Schema, HeaderMetaSchema, SubjectSchema, HeaderSchema, envelopeTail, ReviewFindingSchema, DispatchOutcomeSchema, dispatchShared, dispatchUsageField, DispatchEventSchema, CODE_TOKEN_PATTERN, CodeTokenSchema, ReviewerVerdictSchema, loopShared, DevReviewLoopEventSchema, ForgeOpSchema, ForgeWriteTargetSchema, forgeWriteShared, ForgeWriteEventSchema, GateOutcomeSchema, gateShared, GateEventSchema, OperationResultSchema, operationShared, OperationEventSchema, UsageUnitsSchema, usageShared, UsageEventSchema, RoleAttemptOutcomeSchema, roleAttemptShared, RoleAttemptEventSchema, handoffShared, HandoffEventSchema, EffectTargetSchema, effectShared, EffectEventSchema, CustomFieldValueSchema, customShared, CustomEventSchema, LogEventSchema;
6910
7042
  var init_schema = __esm(() => {
6911
7043
  init_custom();
6912
- ROLE_VALUES = [
6913
- "planner",
6914
- "developer",
6915
- "code-reviewer",
6916
- "security",
6917
- "principal",
6918
- "archivist",
6919
- "architect"
6920
- ];
6921
- RoleSchema = z6.enum(ROLE_VALUES);
7044
+ ROLE_NAME_PATTERN = /^[a-z0-9-]+$/;
7045
+ RoleSchema = z6.string().regex(ROLE_NAME_PATTERN);
6922
7046
  HOST_VALUES = ["hook", "ci", "cli", "loop"];
6923
7047
  HostSchema = z6.enum(HOST_VALUES);
6924
7048
  RUN_ID_PATTERN = /^[A-Za-z0-9_.-]{1,128}$/;
@@ -7500,119 +7624,6 @@ var init_schema = __esm(() => {
7500
7624
  ]);
7501
7625
  });
7502
7626
 
7503
- // ../../harness/kernel/log/envelope.ts
7504
- import { createHash as createHash5 } from "node:crypto";
7505
- function isRole(value) {
7506
- return value !== undefined && ROLE_VALUES.includes(value);
7507
- }
7508
- function actorIdFromEnv(role) {
7509
- return role === undefined || role === "" ? null : role;
7510
- }
7511
- function lineageFieldFromEnv(value) {
7512
- return value === undefined || value === "" ? null : value;
7513
- }
7514
- function attemptFromEnv(value) {
7515
- if (value === undefined || value === "")
7516
- return null;
7517
- const n = Number(value);
7518
- return Number.isInteger(n) ? n : null;
7519
- }
7520
- function provenanceFor(input) {
7521
- if (input.provenance)
7522
- return input.provenance;
7523
- if (issueFromTask(input.env.task) === null && (input.branchIssue ?? null) !== null)
7524
- return "unavailable";
7525
- if (input.env.role || input.env.task)
7526
- return "env_correlated";
7527
- return "unavailable";
7528
- }
7529
- function issueFromTask(task) {
7530
- if (task === undefined || task === "")
7531
- return null;
7532
- const n = Number(task);
7533
- return Number.isInteger(n) ? n : null;
7534
- }
7535
- function roundFromEnv(round) {
7536
- if (round === undefined || round === "")
7537
- return;
7538
- const n = Number(round);
7539
- return Number.isInteger(n) ? n : undefined;
7540
- }
7541
- function prFromEnv(pr) {
7542
- if (pr === undefined || pr === "")
7543
- return;
7544
- const n = Number(pr);
7545
- return Number.isInteger(n) && n > 0 ? n : undefined;
7546
- }
7547
- function buildHeader(input) {
7548
- const role = isRole(input.env.role) ? input.env.role : "unattributed";
7549
- const round = roundFromEnv(input.env.round);
7550
- const pr = prFromEnv(input.env.pr);
7551
- const subject = {
7552
- issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
7553
- role,
7554
- ...round !== undefined ? { round } : {},
7555
- ...pr !== undefined ? { pr } : {},
7556
- ...input.subject ?? {}
7557
- };
7558
- const issue = subject.issue;
7559
- return {
7560
- meta: {
7561
- schema: 4,
7562
- ts: input.now.toISOString(),
7563
- run_id: input.runId,
7564
- seq: input.seq,
7565
- repo: input.repo,
7566
- vinaya: input.vinaya,
7567
- doctrine: input.doctrine,
7568
- host: input.host,
7569
- machine: createHash5("sha256").update(input.hostname).digest("hex"),
7570
- event_id: input.eventId,
7571
- process_id: input.processId,
7572
- actor_id: actorIdFromEnv(input.env.role),
7573
- lineage: {
7574
- run: lineageFieldFromEnv(input.env.run),
7575
- attempt: attemptFromEnv(input.env.attempt),
7576
- parent: lineageFieldFromEnv(input.env.parent)
7577
- },
7578
- input_versions: {
7579
- manifest_version: input.inputVersions?.manifestVersion ?? null,
7580
- objectives_version: input.inputVersions?.objectivesVersion ?? null,
7581
- brief_hash: input.inputVersions?.briefHash ?? null,
7582
- ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
7583
- pause_bound_ruling: input.inputVersions?.pauseBoundRuling ?? null,
7584
- policy_digest: input.inputVersions?.policyDigest ?? null
7585
- },
7586
- provenance: provenanceFor(input),
7587
- work: {
7588
- ref: lineageFieldFromEnv(input.env.workRef) ?? (issue === null ? null : String(issue)),
7589
- repo: input.repo,
7590
- change: pr === undefined ? null : String(pr),
7591
- revision: input.revision ?? null
7592
- },
7593
- flow: {
7594
- id: lineageFieldFromEnv(input.env.flow) ?? "vinaya",
7595
- version: lineageFieldFromEnv(input.env.flowVersion)
7596
- },
7597
- runtime: lineageFieldFromEnv(input.env.runtime),
7598
- process: {
7599
- id: lineageFieldFromEnv(input.env.processId) ?? "vinaya",
7600
- version: lineageFieldFromEnv(input.env.processVersion),
7601
- digest: lineageFieldFromEnv(input.env.processDigest)
7602
- },
7603
- runner: {
7604
- id: lineageFieldFromEnv(input.env.runnerId) ?? "standalone",
7605
- version: lineageFieldFromEnv(input.env.runnerVersion)
7606
- },
7607
- source: lineageFieldFromEnv(input.env.source)
7608
- },
7609
- subject
7610
- };
7611
- }
7612
- var init_envelope = __esm(() => {
7613
- init_schema();
7614
- });
7615
-
7616
7627
  // ../../harness/kernel/log/redact.ts
7617
7628
  function redactString(value, home) {
7618
7629
  let out = value.replace(GITHUB_TOKEN_PATTERN, "<redacted>").replace(CLASSIC_GITHUB_PAT_PATTERN, "$1<redacted>").replace(BEARER_TOKEN_PATTERN, "<redacted>").replace(AWS_ACCESS_KEY_PATTERN, "<redacted>").replace(SLACK_TOKEN_PATTERN, "<redacted>").replace(STRIPE_KEY_PATTERN, "<redacted>").replace(ANTHROPIC_KEY_PATTERN, "<redacted>").replace(OPENAI_KEY_PATTERN, "<redacted>").replace(NPM_TOKEN_PATTERN, "<redacted>").replace(JWT_PATTERN, "<redacted>").replace(PEM_BLOCK_PATTERN, "<redacted>").replace(BASIC_AUTH_URL_PATTERN, "$1<redacted>@").replace(GENERIC_SECRET_ASSIGNMENT_PATTERN, "$1<redacted>");
@@ -8679,7 +8690,8 @@ function code(value) {
8679
8690
  return typeof value === "string" && CODE_TOKEN_PATTERN.test(value) ? value : null;
8680
8691
  }
8681
8692
  function roleSubject(value, sentenceStart = true) {
8682
- const name = typeof value === "string" && ROLE_VALUES.includes(value) ? `the ${value === "security" ? "security reviewer" : value.replace(/-/g, " ")}` : "a role";
8693
+ const known = typeof value === "string" ? lookupRole(value) : undefined;
8694
+ const name = known ? `the ${known.reading}` : "a role";
8683
8695
  return sentenceStart ? `${name[0]?.toUpperCase()}${name.slice(1)}` : name;
8684
8696
  }
8685
8697
  function roundLabel(record) {
@@ -8798,7 +8810,7 @@ function conflictReentry(record) {
8798
8810
  function dispatched(record) {
8799
8811
  const role = text(record.target_role);
8800
8812
  const who = roleSubject(role);
8801
- const reviewing = role === "code-reviewer" || role === "security";
8813
+ const reviewing = role !== null && (lookupRole(role)?.reviews ?? false);
8802
8814
  const round = whole(record.round);
8803
8815
  return {
8804
8816
  kind: "working",
@@ -8857,6 +8869,7 @@ function narrate(record, earlier = []) {
8857
8869
  }
8858
8870
  var REASONS, PAUSE_WITHOUT_CODE;
8859
8871
  var init_narration = __esm(() => {
8872
+ init_roles();
8860
8873
  init_schema();
8861
8874
  REASONS = {
8862
8875
  escalation: { words: "a role escalated a question", person: true },
@@ -8889,13 +8902,7 @@ var init_narration = __esm(() => {
8889
8902
 
8890
8903
  // ../../harness/kernel/adapters/agents/agent-line.ts
8891
8904
  function roleLabel(role) {
8892
- if (role in roleLabels)
8893
- return roleLabels[role];
8894
- if (role === "dev-review-loop")
8895
- return "Loop";
8896
- if (role === "operator")
8897
- return "Operator";
8898
- return role.replace(/-/g, " ").replace(/\b\w/g, (letter) => letter.toUpperCase());
8905
+ return lookupTitle(role) ?? role.replace(/-/g, " ").replace(/\b\w/g, (letter) => letter.toUpperCase());
8899
8906
  }
8900
8907
  function logQuiet(env = process.env) {
8901
8908
  return env.VINAYA_LOG_QUIET === "1" || env.VINAYA_LOG_QUIET === "true";
@@ -8977,17 +8984,9 @@ function renderNarratedUpdate(update) {
8977
8984
  ...call
8978
8985
  };
8979
8986
  }
8980
- var roleLabels, unicodeMarks, asciiMarks, META_KEY, META_VALUE, actionVerbs, resultVerbs;
8987
+ var unicodeMarks, asciiMarks, META_KEY, META_VALUE, actionVerbs, resultVerbs;
8981
8988
  var init_agent_line = __esm(() => {
8982
- roleLabels = {
8983
- planner: "Planner",
8984
- developer: "Developer",
8985
- "code-reviewer": "Code review",
8986
- security: "Security",
8987
- principal: "Principal",
8988
- archivist: "Archivist",
8989
- architect: "Architect"
8990
- };
8989
+ init_roles();
8991
8990
  unicodeMarks = { working: "▸", done: "✓", failed: "✕", waiting: "◌", round: "◆" };
8992
8991
  asciiMarks = { working: ">", done: "+", failed: "x", waiting: "~", round: "#" };
8993
8992
  META_KEY = /^[a-z]+$/;
@@ -10334,6 +10333,28 @@ var init_log_sink = __esm(() => {
10334
10333
  defaultSinkSlot = createDefaultLogSinkSlot(process.env.VINAYA_RUN_ID || randomUUID3());
10335
10334
  });
10336
10335
 
10336
+ // ../../harness/processes/vinaya-strict/integration/log/log-roles.ts
10337
+ function registerVinayaLogRoles() {
10338
+ for (const { name, reading, title, reviews } of VINAYA_LOG_ROLES)
10339
+ registerRole(name, { reading, title, reviews });
10340
+ registerTitle("dev-review-loop", "Loop");
10341
+ }
10342
+ var VINAYA_LOG_ROLES, VINAYA_LOG_ROLE_NAMES;
10343
+ var init_log_roles = __esm(() => {
10344
+ init_roles();
10345
+ VINAYA_LOG_ROLES = [
10346
+ { name: "planner", reading: "planner", title: "Planner", reviews: false },
10347
+ { name: "developer", reading: "developer", title: "Developer", reviews: false },
10348
+ { name: "code-reviewer", reading: "code reviewer", title: "Code review", reviews: true },
10349
+ { name: "security", reading: "security reviewer", title: "Security", reviews: true },
10350
+ { name: "principal", reading: "principal", title: "Principal", reviews: false },
10351
+ { name: "archivist", reading: "archivist", title: "Archivist", reviews: false },
10352
+ { name: "architect", reading: "architect", title: "Architect", reviews: false }
10353
+ ];
10354
+ VINAYA_LOG_ROLE_NAMES = VINAYA_LOG_ROLES.map((role) => role.name);
10355
+ registerVinayaLogRoles();
10356
+ });
10357
+
10337
10358
  // ../../harness/processes/vinaya-strict/integration/log/branch-issue.ts
10338
10359
  import { execFile as execFile5 } from "node:child_process";
10339
10360
  import { promisify as promisify5 } from "node:util";
@@ -10536,6 +10557,7 @@ function installVinayaLogSinkFactory() {
10536
10557
  var init_log_sink_factory = __esm(() => {
10537
10558
  init_log_sink();
10538
10559
  init_package_root();
10560
+ init_log_roles();
10539
10561
  init_branch_issue();
10540
10562
  init_doctrine_version();
10541
10563
  });
@@ -14925,6 +14947,10 @@ function isAgentVendor2(value) {
14925
14947
  function isAgentClass(value) {
14926
14948
  return AGENT_CLASS_VALUES.includes(value);
14927
14949
  }
14950
+ function realCeilingTimer(fire, timeoutMs) {
14951
+ const timer = setTimeout(fire, timeoutMs);
14952
+ return () => clearTimeout(timer);
14953
+ }
14928
14954
  function addCodexWritableDirs(args, extraWritableDirs, resumed, developerFiles = []) {
14929
14955
  const requestedDirs = [...extraWritableDirs, ...developerFiles.map((file) => dirname13(file))];
14930
14956
  if (requestedDirs.length === 0)
@@ -16136,14 +16162,14 @@ function terminateChildWithGrace(pid, graceMs = TERMINATE_GRACE_MS) {
16136
16162
  } catch {}
16137
16163
  }
16138
16164
  }
16139
- function captureSettledChildSnapshot(pid) {
16140
- let snapshot = getProcessSnapshot(pid);
16165
+ function captureSettledChildSnapshot(pid, readSnapshot = getProcessSnapshot) {
16166
+ let snapshot = readSnapshot(pid);
16141
16167
  if (snapshot === null)
16142
16168
  return null;
16143
16169
  const deadline = Date.now() + IDENTITY_SETTLE_BUDGET_MS;
16144
16170
  while (Date.now() < deadline) {
16145
16171
  sleepSyncMs2(IDENTITY_SETTLE_POLL_MS);
16146
- const next = getProcessSnapshot(pid);
16172
+ const next = readSnapshot(pid);
16147
16173
  if (next === null)
16148
16174
  return snapshot;
16149
16175
  if (next.command === snapshot.command)
@@ -17145,7 +17171,7 @@ ${agentControlsError}` : sandboxProbeError !== null ? `[vinaya dispatch ${effect
17145
17171
  const warnTimer = setTimeout(() => {
17146
17172
  writeLifecycle(`[vinaya dispatch ${effectId}] ${role} via ${agent}: approaching timeout — SIGTERM in ~${Math.round(warnLeadMs / 1000)}s unless it finishes first`);
17147
17173
  }, Math.max(timeoutMs - warnLeadMs, 0));
17148
- const timeoutTimer = setTimeout(() => {
17174
+ const disarmCeiling = (opts.armCeiling ?? realCeilingTimer)(() => {
17149
17175
  timedOut = true;
17150
17176
  writeLifecycle(`[vinaya dispatch ${effectId}] ${role} via ${agent}: ceiling reached — sending SIGTERM`);
17151
17177
  child.kill("SIGTERM");
@@ -17181,7 +17207,7 @@ ${agentControlsError}` : sandboxProbeError !== null ? `[vinaya dispatch ${effect
17181
17207
  if (settled)
17182
17208
  return;
17183
17209
  settled = true;
17184
- clearTimeout(timeoutTimer);
17210
+ disarmCeiling();
17185
17211
  if (killTimer)
17186
17212
  clearTimeout(killTimer);
17187
17213
  clearTimeout(firstWaitTimer);
@@ -17608,8 +17634,8 @@ var init_protected_paths2 = __esm(() => {
17608
17634
 
17609
17635
  // ../../harness/processes/vinaya-strict/integration/policies/roles.ts
17610
17636
  var GRANTED_ROLES, ROLE_TOOL_GRANTS, VINAYA_TOOL_GRANTS, VINAYA_BROKER_ROLES, VINAYA_BOUNDARY_ROLES, OPERATOR_TOOL_GRANT, VINAYA_ROUTER_ROLES;
17611
- var init_roles = __esm(() => {
17612
- init_schema();
17637
+ var init_roles2 = __esm(() => {
17638
+ init_log_roles();
17613
17639
  GRANTED_ROLES = ["developer", "code-reviewer", "security", "controller"];
17614
17640
  ROLE_TOOL_GRANTS = {
17615
17641
  developer: [
@@ -17628,7 +17654,7 @@ var init_roles = __esm(() => {
17628
17654
  };
17629
17655
  VINAYA_TOOL_GRANTS = { roles: GRANTED_ROLES, grants: ROLE_TOOL_GRANTS };
17630
17656
  VINAYA_BROKER_ROLES = {
17631
- recognizedRoles: ROLE_VALUES,
17657
+ recognizedRoles: VINAYA_LOG_ROLE_NAMES,
17632
17658
  workerRoles: ["developer"],
17633
17659
  surfaceOwner: "the Planner"
17634
17660
  };
@@ -17907,7 +17933,7 @@ function vinayaRouterPolicies() {
17907
17933
  var init_vinaya_policies = __esm(() => {
17908
17934
  init_launch_records();
17909
17935
  init_protected_paths2();
17910
- init_roles();
17936
+ init_roles2();
17911
17937
  init_scratch_names();
17912
17938
  });
17913
17939
 
@@ -18124,7 +18150,7 @@ var init_commands = __esm(() => {
18124
18150
  }
18125
18151
  ],
18126
18152
  details: [
18127
- "The atta-engine runner starts the workspace Engine script with Bun, streams its output and returns its exit code. A published install without the script 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.",
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.",
18128
18154
  "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.",
18129
18155
  "`--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.",
18130
18156
  "`--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.",
@@ -18904,11 +18930,12 @@ function lookup2(name) {
18904
18930
  throw new Error(`no program named '${name}' — the program table names: ${[...PROGRAMS.keys()].join(", ")}`);
18905
18931
  return found;
18906
18932
  }
18907
- function programFile(name) {
18933
+ function programFile(name, packageRoot = cliPackageRoot(), fromSource = FROM_SOURCE) {
18908
18934
  const entry = lookup2(name);
18909
- const built = join23(cliPackageRoot(), entry.built);
18910
- const source = join23(SOURCE_ROOT, entry.source);
18911
- if (FROM_SOURCE && existsSync17(source))
18935
+ return pickFile(join23(packageRoot, entry.built), join23(SOURCE_ROOT, entry.source), fromSource);
18936
+ }
18937
+ function pickFile(built, source, fromSource) {
18938
+ if (fromSource && existsSync17(source))
18912
18939
  return source;
18913
18940
  return existsSync17(built) ? built : source;
18914
18941
  }
@@ -18985,7 +19012,9 @@ var init_programs = __esm(() => {
18985
19012
  program("log-selftest", `${P}/integration/bin/log-selftest.ts`, "dist/programs/log-selftest.js", [
18986
19013
  words("log", "selftest")
18987
19014
  ]),
18988
- program("sync", `${P}/integration/bin/sync.ts`, "dist/programs/sync.js", [words("sync")])
19015
+ program("sync", `${P}/integration/bin/sync.ts`, "dist/programs/sync.js", [words("sync")]),
19016
+ program("run-engine", `${P}/bin/run-engine.ts`, "dist/programs/run-engine.js"),
19017
+ program("supervised-command", `${P}/loops/dev-review/v2/supervised-command.ts`, "dist/programs/supervised-command.js")
18989
19018
  ]);
18990
19019
  SOURCE_ROOT = join23(dirname15(fileURLToPath3(import.meta.url)), "..", "..", "..", "..");
18991
19020
  FROM_SOURCE = fileURLToPath3(import.meta.url).endsWith(".ts");
@@ -28323,7 +28352,7 @@ var init_config_reference = __esm(() => {
28323
28352
  type: '"standalone" | "atta-engine" (optional)',
28324
28353
  semantics: [
28325
28354
  "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.",
28326
- "atta-engine starts the workspace Engine script as a Bun subprocess with the resolved task, agent and model. When the Engine runner script is absent — a published install carries none — `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.",
28355
+ "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.",
28327
28356
  "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."
28328
28357
  ],
28329
28358
  example: `{ "runner": "atta-engine" }`
@@ -33863,7 +33892,7 @@ var init_pause_resume = __esm(async () => {
33863
33892
  // ../../harness/processes/vinaya-strict/loops/dev-review/run-control/task-run-engine.ts
33864
33893
  import { spawn as spawn5 } from "node:child_process";
33865
33894
  import { existsSync as existsSync39, readFileSync as readFileSync44, renameSync as renameSync8, writeFileSync as writeFileSync24 } from "node:fs";
33866
- import { dirname as dirname24, join as join46, resolve as resolve8 } from "node:path";
33895
+ import { dirname as dirname24, join as join46 } from "node:path";
33867
33896
  function taskRunnerRecordPath(task, root = runtimeDirForThisRepo()) {
33868
33897
  return runPath2(root, task, { area: "task", file: "runner.json" });
33869
33898
  }
@@ -33938,7 +33967,7 @@ function engineContinuationCommand(target) {
33938
33967
  return ["bun", ...engineContinuationArgv(target)].join(" ");
33939
33968
  }
33940
33969
  function engineRunnerScriptPath() {
33941
- return resolve8(cliPackageRoot(), "../..", PROCESS_FOLDER_IN_CHECKOUT, "bin/run-engine.ts");
33970
+ return programFile("run-engine");
33942
33971
  }
33943
33972
  async function runTaskEngine(input, overrides = {}, starting = () => {}) {
33944
33973
  const deps = { ...defaultEngineRunnerDeps, ...overrides };
@@ -33963,7 +33992,7 @@ async function runTaskEngine(input, overrides = {}, starting = () => {}) {
33963
33992
  }
33964
33993
  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";
33965
33994
  var init_task_run_engine = __esm(async () => {
33966
- init_package_root();
33995
+ init_programs();
33967
33996
  init_run_paths();
33968
33997
  await init_pause_resume();
33969
33998
  defaultEngineRunnerDeps = {
@@ -35172,6 +35201,73 @@ var init_premise_reassert_logic = __esm(() => {
35172
35201
  init_ops();
35173
35202
  });
35174
35203
 
35204
+ // ../../harness/processes/vinaya-strict/loops/dev-review/v2/git-read-memo.ts
35205
+ import { resolve as resolve8 } from "node:path";
35206
+ function gitSubcommand(args) {
35207
+ for (let i = 0;i < args.length; i++) {
35208
+ const arg = args[i];
35209
+ if (arg === "-C" || arg === "-c" || arg === "--git-dir" || arg === "--work-tree") {
35210
+ i++;
35211
+ continue;
35212
+ }
35213
+ if (arg.startsWith("-"))
35214
+ continue;
35215
+ return arg;
35216
+ }
35217
+ return;
35218
+ }
35219
+ function gitReadKey(cwd, args) {
35220
+ return [resolve8(cwd ?? process.cwd()), ...args].join("\x00");
35221
+ }
35222
+ function gitReadMemoServing() {
35223
+ return memoEnabled && state.scopes > 0 && state.turns === 0;
35224
+ }
35225
+ function clearGitReadMemo(reason = "cleared") {
35226
+ state.entries.clear();
35227
+ notify({ kind: "clear", reason });
35228
+ }
35229
+ function runGit(cwd, args, run) {
35230
+ const sub = gitSubcommand(args);
35231
+ const key = gitReadKey(cwd, args);
35232
+ const memoizable = sub !== undefined && MEMOIZED.has(sub);
35233
+ if (memoizable && gitReadMemoServing()) {
35234
+ const kept = state.entries.get(key);
35235
+ if (kept !== undefined) {
35236
+ notify({ kind: "hit", key });
35237
+ return kept;
35238
+ }
35239
+ let value;
35240
+ try {
35241
+ value = run();
35242
+ } catch (error) {
35243
+ notify({ kind: "spawn", key, memoizable: true, served: false });
35244
+ throw error;
35245
+ }
35246
+ notify({ kind: "spawn", key, memoizable: true, served: true });
35247
+ if (gitReadMemoServing())
35248
+ state.entries.set(key, value);
35249
+ return value;
35250
+ }
35251
+ notify({ kind: "spawn", key, memoizable, served: false });
35252
+ if (memoizable || sub !== undefined && READ_ONLY_UNKEPT.has(sub))
35253
+ return run();
35254
+ try {
35255
+ return run();
35256
+ } finally {
35257
+ clearGitReadMemo(`git ${sub ?? "(none)"}`);
35258
+ }
35259
+ }
35260
+ var MEMOIZED, READ_ONLY_UNKEPT, state, memoEnabled = true, notify = (event) => {
35261
+ for (const listener of state.listeners)
35262
+ listener(event);
35263
+ }, wrapped;
35264
+ var init_git_read_memo = __esm(() => {
35265
+ MEMOIZED = new Set(["rev-parse", "merge-base", "show-ref", "for-each-ref", "rev-list"]);
35266
+ READ_ONLY_UNKEPT = new Set(["ls-remote", "status", "diff", "ls-files", "log", "show", "cat-file", "merge-tree"]);
35267
+ state = { scopes: 0, turns: 0, entries: new Map, listeners: new Set };
35268
+ wrapped = new WeakMap;
35269
+ });
35270
+
35175
35271
  // ../../harness/processes/vinaya-strict/loops/dev-review/standalone/dev-review-loop/gate-reading.ts
35176
35272
  import { execFileSync as execFileSync26 } from "node:child_process";
35177
35273
  import { existsSync as existsSync42 } from "node:fs";
@@ -35189,11 +35285,12 @@ function sleepSyncMs4(ms) {
35189
35285
  }
35190
35286
  function sh2(cmd, args, options = {}) {
35191
35287
  if (cmd !== "gh") {
35192
- return execFileSync26(cmd, args, {
35288
+ const run = () => execFileSync26(cmd, args, {
35193
35289
  encoding: "utf8",
35194
35290
  stdio: ["ignore", "pipe", "pipe"],
35195
35291
  maxBuffer: MAX_GH_OUTPUT_BYTES2
35196
35292
  }).trim();
35293
+ return cmd === "git" ? runGit(undefined, args, run) : run();
35197
35294
  }
35198
35295
  const attempts = options.attempts ?? shEnvOverride("VINAYA_DEV_REVIEW_LOOP_GH_RETRY_ATTEMPTS", 3);
35199
35296
  const backoffMs = shEnvOverride("VINAYA_DEV_REVIEW_LOOP_GH_RETRY_BACKOFF_MS", 500);
@@ -35464,7 +35561,9 @@ function fetchConflictingFiles(baseBranch, headBranch) {
35464
35561
  execFileSync26("git", ["fetch", "--quiet", "origin", baseBranch, headBranch], {
35465
35562
  stdio: ["ignore", "ignore", "ignore"]
35466
35563
  });
35467
- } catch {}
35564
+ } catch {} finally {
35565
+ clearGitReadMemo("git fetch");
35566
+ }
35468
35567
  try {
35469
35568
  execFileSync26("git", ["merge-tree", "--write-tree", `origin/${baseBranch}`, `origin/${headBranch}`], {
35470
35569
  encoding: "utf8",
@@ -35518,6 +35617,7 @@ var MAX_GH_OUTPUT_BYTES2, NON_CI_WORKFLOW_PATHS, NON_CI_WORKFLOW_NAMES, FAILED_W
35518
35617
  var init_gate_reading = __esm(() => {
35519
35618
  init_premise_reassert_logic();
35520
35619
  init_round_assess();
35620
+ init_git_read_memo();
35521
35621
  MAX_GH_OUTPUT_BYTES2 = 64 * 1024 * 1024;
35522
35622
  NON_CI_WORKFLOW_PATHS = [
35523
35623
  REVIEW_WORKFLOW_PATH,
@@ -38734,8 +38834,10 @@ function defaultGitRevParseOriginMain() {
38734
38834
  }
38735
38835
  function defaultGitIsAncestor(ancestor, descendant) {
38736
38836
  try {
38737
- execFileSync29("git", ["merge-base", "--is-ancestor", ancestor, descendant], {
38738
- stdio: ["ignore", "ignore", "ignore"]
38837
+ const args = ["merge-base", "--is-ancestor", ancestor, descendant];
38838
+ runGit(undefined, args, () => {
38839
+ execFileSync29("git", args, { stdio: ["ignore", "ignore", "ignore"] });
38840
+ return "";
38739
38841
  });
38740
38842
  return true;
38741
38843
  } catch (err) {
@@ -38745,12 +38847,14 @@ function defaultGitIsAncestor(ancestor, descendant) {
38745
38847
  }
38746
38848
  }
38747
38849
  function defaultGitMergeBase(head) {
38748
- return resolveMergeBase(head);
38850
+ return resolveMergeBase(head).finally(() => clearGitReadMemo("merge-base resolution"));
38749
38851
  }
38750
38852
  function defaultGitFetch(sha) {
38751
38853
  try {
38752
38854
  execFileSync29("git", ["fetch", "--quiet", "origin", sha], { stdio: ["ignore", "ignore", "ignore"] });
38753
- } catch {}
38855
+ } catch {} finally {
38856
+ clearGitReadMemo("git fetch");
38857
+ }
38754
38858
  }
38755
38859
  function defaultGitDiffShortstat(base, head) {
38756
38860
  try {
@@ -38826,6 +38930,7 @@ function defaultRunSecurityScanSubprocess(command, scanTargetDir) {
38826
38930
  return { ok: true, output: combined };
38827
38931
  return { ok: false, reason: e.message };
38828
38932
  } finally {
38933
+ clearGitReadMemo("security scan");
38829
38934
  try {
38830
38935
  rmSync14(sandbox, { recursive: true, force: true });
38831
38936
  } catch {}
@@ -38842,7 +38947,11 @@ function defaultResolveTaskSurface(task) {
38842
38947
  }
38843
38948
  }
38844
38949
  function defaultPatchIdOf(sha) {
38845
- return patchIdAt("main", sha);
38950
+ try {
38951
+ return patchIdAt("main", sha);
38952
+ } finally {
38953
+ clearGitReadMemo("patch-id fetch");
38954
+ }
38846
38955
  }
38847
38956
  function assertValidLoopEvent(e) {
38848
38957
  const parsed = DevReviewLoopEventInputSchema.safeParse(e);
@@ -38885,11 +38994,12 @@ function defaultGitWorktreeUntrackedPaths(worktreePath) {
38885
38994
  }
38886
38995
  }
38887
38996
  function gitOk(worktreePath, args) {
38997
+ const full = ["-C", worktreePath, ...args];
38888
38998
  try {
38889
- return execFileSync29("git", ["-C", worktreePath, ...args], {
38999
+ return runGit(undefined, full, () => execFileSync29("git", full, {
38890
39000
  encoding: "utf8",
38891
39001
  stdio: ["ignore", "pipe", "pipe"]
38892
- }).trim();
39002
+ }).trim());
38893
39003
  } catch {
38894
39004
  return null;
38895
39005
  }
@@ -39024,6 +39134,7 @@ function defaultMergeDefaultTip(worktreePath, tip, remoteUrl) {
39024
39134
  env: { ...process.env, GIT_EDITOR: "true" },
39025
39135
  stdio: ["ignore", "pipe", "pipe"]
39026
39136
  });
39137
+ clearGitReadMemo("git merge");
39027
39138
  if (!merged.error && merged.status === 0 && !mergeInProgress2(worktreePath)) {
39028
39139
  const head = gitOk(worktreePath, ["rev-parse", "HEAD"]);
39029
39140
  if (head)
@@ -39071,6 +39182,7 @@ function defaultRebaseOntoDefaultTip(worktreePath, tip, remoteUrl) {
39071
39182
  env: { ...process.env, GIT_EDITOR: "true" },
39072
39183
  stdio: ["ignore", "pipe", "pipe"]
39073
39184
  });
39185
+ clearGitReadMemo("git rebase");
39074
39186
  if (!rebased.error && rebased.status === 0 && !rebaseInProgress(worktreePath)) {
39075
39187
  const head = gitOk(worktreePath, ["rev-parse", "HEAD"]);
39076
39188
  if (head)
@@ -39096,7 +39208,11 @@ function ownChangesRangeBase(worktreePath, pushedBase) {
39096
39208
  if (pushedBase === null)
39097
39209
  return null;
39098
39210
  try {
39099
- execFileSync29("git", ["-C", worktreePath, "merge-base", "--is-ancestor", pushedBase, "HEAD"], { stdio: "ignore" });
39211
+ const args = ["-C", worktreePath, "merge-base", "--is-ancestor", pushedBase, "HEAD"];
39212
+ runGit(undefined, args, () => {
39213
+ execFileSync29("git", args, { stdio: "ignore" });
39214
+ return "";
39215
+ });
39100
39216
  return pushedBase;
39101
39217
  } catch (err) {
39102
39218
  if (err.status !== 1)
@@ -39158,6 +39274,7 @@ function traceHasRefusingHook(trace, names) {
39158
39274
  var SECURITY_SCAN_TIMEOUT_MS = 120000, SECURITY_SCAN_MAX_BUFFER_BYTES, DevReviewLoopEventInputSchema;
39159
39275
  var init_git_defaults = __esm(() => {
39160
39276
  init_gate_reading();
39277
+ init_git_read_memo();
39161
39278
  init_pr_report_engine();
39162
39279
  init_worker_boundary();
39163
39280
  init_issue_validation();
@@ -39618,6 +39735,7 @@ function defaultBuildVendoredCliIfMissing(worktreePath) {
39618
39735
  encoding: "utf8",
39619
39736
  stdio: ["ignore", "pipe", "pipe"]
39620
39737
  });
39738
+ clearGitReadMemo("vendored CLI build");
39621
39739
  if (result.error || result.status !== 0) {
39622
39740
  const output = `${result.stdout ?? ""}
39623
39741
  ${result.stderr ?? ""}`.trim();
@@ -39643,6 +39761,7 @@ function defaultInstallWorktreeDependencies(worktreePath) {
39643
39761
  stdio: ["ignore", "pipe", "pipe"],
39644
39762
  timeout: 10 * 60 * 1000
39645
39763
  });
39764
+ clearGitReadMemo("dependency install");
39646
39765
  if (result.error || result.status !== 0) {
39647
39766
  const output = `${result.stdout ?? ""}
39648
39767
  ${result.stderr ?? ""}`.trim().split(`
@@ -39677,6 +39796,7 @@ ${"stderr" in err ? String(err.stderr ?? "") : ""}`.trim() : String(err);
39677
39796
  }
39678
39797
  throw err;
39679
39798
  } finally {
39799
+ clearGitReadMemo("git commit");
39680
39800
  rmSync16(traceDir, { recursive: true, force: true });
39681
39801
  }
39682
39802
  return { ok: true, sha: sh2("git", ["-C", worktreePath, "rev-parse", "HEAD"]).trim() };
@@ -39722,6 +39842,7 @@ ${String(raw.stderr ?? "")}`.trim();
39722
39842
  const detail = boundedPushOutput(output || (err instanceof Error ? err.message : String(err)), "tail");
39723
39843
  throw new Error(`${exit}: ${detail || "no captured output"}`);
39724
39844
  } finally {
39845
+ clearGitReadMemo("git push");
39725
39846
  rmSync16(traceDir, { recursive: true, force: true });
39726
39847
  }
39727
39848
  }
@@ -39973,6 +40094,7 @@ var init_developer_defaults = __esm(async () => {
39973
40094
  init_live_developer_context();
39974
40095
  init_worker_boundary();
39975
40096
  init_gate_reading();
40097
+ init_git_read_memo();
39976
40098
  init_git_defaults();
39977
40099
  init_driver_tool_guard();
39978
40100
  init_live_developer_context();
@@ -40587,6 +40709,7 @@ function liveRunEnv(callerEnv = process.env) {
40587
40709
  function runFile(file, args, opts) {
40588
40710
  return new Promise((resolve, reject) => {
40589
40711
  execFile11(file, [...args], { cwd: opts.cwd, env: opts.env, timeout: opts.timeoutMs, maxBuffer: 16 * 1024 * 1024 }, (err, _stdout, stderr) => {
40712
+ clearGitReadMemo(`${file} ${args[0] ?? ""}`);
40590
40713
  if (err === null)
40591
40714
  resolve();
40592
40715
  else
@@ -40607,6 +40730,7 @@ async function prepareRealLiveCheckout(repoRoot, head, opts = {}) {
40607
40730
  try {
40608
40731
  execFileSync33("git", ["-C", repoRoot, "worktree", "prune"], { stdio: "ignore" });
40609
40732
  } catch {}
40733
+ clearGitReadMemo("live checkout removed");
40610
40734
  };
40611
40735
  try {
40612
40736
  await runFile("git", ["-C", repoRoot, "-c", "core.hooksPath=/dev/null", "worktree", "add", "--detach", tree, head], {
@@ -40724,6 +40848,7 @@ var LIVE_RUN_TIMEOUT_MS, MAX_KEPT_OUTPUT_CHARS, REAL_SIGN_IN_SOURCES, LIVE_SIGN_
40724
40848
  if (settled)
40725
40849
  return;
40726
40850
  settled = true;
40851
+ clearGitReadMemo("live command");
40727
40852
  clearTimeout(timer);
40728
40853
  if (grace !== undefined)
40729
40854
  clearTimeout(grace);
@@ -40765,6 +40890,7 @@ var init_live_check = __esm(() => {
40765
40890
  init_runner();
40766
40891
  init_dispatch();
40767
40892
  init_pr_facts();
40893
+ init_git_read_memo();
40768
40894
  init_worker_boundary();
40769
40895
  LIVE_RUN_TIMEOUT_MS = 20 * 60000;
40770
40896
  MAX_KEPT_OUTPUT_CHARS = 256 * 1024;
@@ -43506,7 +43632,7 @@ function verdictLogRole(role) {
43506
43632
  }
43507
43633
  function reviewerEntries(state, verdicts) {
43508
43634
  const held = new Map(verdicts.map((v) => [verdictLogRole(v.role), v]));
43509
- const isRole = (value) => ROLE_VALUES.includes(value);
43635
+ const isRole = (value) => VINAYA_LOG_ROLE_NAMES.includes(value);
43510
43636
  const roles = [...new Set([...state.config.reviewers.filter(isRole), ...held.keys()])];
43511
43637
  return roles.map((role) => {
43512
43638
  const v = held.get(role);
@@ -43997,6 +44123,7 @@ function assessRound(state, observations, clock) {
43997
44123
  var VOLATILE_TOKENS;
43998
44124
  var init_assess_round = __esm(() => {
43999
44125
  init_schema();
44126
+ init_log_roles();
44000
44127
  init_review_status();
44001
44128
  init_task_phase_history();
44002
44129
  init_types();