@attalabs/vinaya 0.42.1 → 0.42.2

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 (41) hide show
  1. package/dist/checks/bin/check-evidence-fresh.js +169 -147
  2. package/dist/checks/bin/check-registry-gates.js +10 -3
  3. package/dist/index.js +292 -168
  4. package/dist/lib/pre-push-cache-test-run.js +142 -143
  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 +169 -147
  10. package/dist/programs/audit.js +169 -147
  11. package/dist/programs/check.js +169 -147
  12. package/dist/programs/commit-msg.js +169 -147
  13. package/dist/programs/dev-review-loop.js +291 -170
  14. package/dist/programs/dispatch.js +1902 -1876
  15. package/dist/programs/log-emit.js +169 -147
  16. package/dist/programs/log-selftest.js +169 -147
  17. package/dist/programs/log-send.js +169 -147
  18. package/dist/programs/pr-report.js +169 -147
  19. package/dist/programs/pr-snapshot.js +169 -147
  20. package/dist/programs/pr-verify-evidence.js +169 -147
  21. package/dist/programs/pr.js +169 -147
  22. package/dist/programs/review-post.js +169 -147
  23. package/dist/programs/review-status.js +177 -147
  24. package/dist/programs/sync.js +60 -38
  25. package/dist/programs/task-brief.js +169 -147
  26. package/dist/programs/task-sweep.js +241 -150
  27. package/dist/programs/task-tools-serve.js +249 -154
  28. package/dist/programs/tokens.js +169 -147
  29. package/dist/programs/waiver.js +169 -147
  30. package/package.json +1 -1
  31. package/studio-standalone/apps/vinaya-studio/.next/BUILD_ID +1 -1
  32. package/studio-standalone/apps/vinaya-studio/.next/build-manifest.json +2 -2
  33. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.html +1 -1
  34. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.rsc +1 -1
  35. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  36. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  37. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  38. package/studio-standalone/apps/vinaya-studio/.next/server/middleware-build-manifest.js +1 -1
  39. package/studio-standalone/apps/vinaya-studio/.next/server/pages/500.html +1 -1
  40. /package/studio-standalone/apps/vinaya-studio/.next/static/{yFfoujElgbwPk-7KNS-kw → Q_xjhiWztjosXWbMSJ0Yp}/_buildManifest.js +0 -0
  41. /package/studio-standalone/apps/vinaya-studio/.next/static/{yFfoujElgbwPk-7KNS-kw → Q_xjhiWztjosXWbMSJ0Yp}/_ssgManifest.js +0 -0
@@ -7555,21 +7555,145 @@ var init_fetch_documentation = __esm(() => {
7555
7555
  REQUEST_HEADER_ALLOWANCE = 64 * 1024;
7556
7556
  });
7557
7557
 
7558
+ // ../../harness/kernel/log/roles.ts
7559
+ function registerRole(name, role) {
7560
+ roles.set(name, role);
7561
+ }
7562
+ function registerTitle(name, title) {
7563
+ titles.set(name, title);
7564
+ }
7565
+ function isRole(value) {
7566
+ return value !== undefined && roles.has(value);
7567
+ }
7568
+ function lookupRole(name) {
7569
+ return roles.get(name);
7570
+ }
7571
+ function lookupTitle(name) {
7572
+ return roles.get(name)?.title ?? titles.get(name);
7573
+ }
7574
+ var roles, titles;
7575
+ var init_roles = __esm(() => {
7576
+ roles = new Map;
7577
+ titles = new Map;
7578
+ });
7579
+
7580
+ // ../../harness/kernel/log/envelope.ts
7581
+ import { createHash as createHash6 } from "node:crypto";
7582
+ function actorIdFromEnv(role) {
7583
+ return role === undefined || role === "" ? null : role;
7584
+ }
7585
+ function lineageFieldFromEnv(value) {
7586
+ return value === undefined || value === "" ? null : value;
7587
+ }
7588
+ function attemptFromEnv(value) {
7589
+ if (value === undefined || value === "")
7590
+ return null;
7591
+ const n = Number(value);
7592
+ return Number.isInteger(n) ? n : null;
7593
+ }
7594
+ function provenanceFor(input) {
7595
+ if (input.provenance)
7596
+ return input.provenance;
7597
+ if (issueFromTask(input.env.task) === null && (input.branchIssue ?? null) !== null)
7598
+ return "unavailable";
7599
+ if (input.env.role || input.env.task)
7600
+ return "env_correlated";
7601
+ return "unavailable";
7602
+ }
7603
+ function issueFromTask(task) {
7604
+ if (task === undefined || task === "")
7605
+ return null;
7606
+ const n = Number(task);
7607
+ return Number.isInteger(n) ? n : null;
7608
+ }
7609
+ function roundFromEnv(round) {
7610
+ if (round === undefined || round === "")
7611
+ return;
7612
+ const n = Number(round);
7613
+ return Number.isInteger(n) ? n : undefined;
7614
+ }
7615
+ function prFromEnv(pr) {
7616
+ if (pr === undefined || pr === "")
7617
+ return;
7618
+ const n = Number(pr);
7619
+ return Number.isInteger(n) && n > 0 ? n : undefined;
7620
+ }
7621
+ function buildHeader(input) {
7622
+ const role = isRole(input.env.role) ? input.env.role : "unattributed";
7623
+ const round = roundFromEnv(input.env.round);
7624
+ const pr = prFromEnv(input.env.pr);
7625
+ const subject = {
7626
+ issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
7627
+ role,
7628
+ ...round !== undefined ? { round } : {},
7629
+ ...pr !== undefined ? { pr } : {},
7630
+ ...input.subject ?? {}
7631
+ };
7632
+ const issue = subject.issue;
7633
+ return {
7634
+ meta: {
7635
+ schema: 4,
7636
+ ts: input.now.toISOString(),
7637
+ run_id: input.runId,
7638
+ seq: input.seq,
7639
+ repo: input.repo,
7640
+ vinaya: input.vinaya,
7641
+ doctrine: input.doctrine,
7642
+ host: input.host,
7643
+ machine: createHash6("sha256").update(input.hostname).digest("hex"),
7644
+ event_id: input.eventId,
7645
+ process_id: input.processId,
7646
+ actor_id: actorIdFromEnv(input.env.role),
7647
+ lineage: {
7648
+ run: lineageFieldFromEnv(input.env.run),
7649
+ attempt: attemptFromEnv(input.env.attempt),
7650
+ parent: lineageFieldFromEnv(input.env.parent)
7651
+ },
7652
+ input_versions: {
7653
+ manifest_version: input.inputVersions?.manifestVersion ?? null,
7654
+ objectives_version: input.inputVersions?.objectivesVersion ?? null,
7655
+ brief_hash: input.inputVersions?.briefHash ?? null,
7656
+ ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
7657
+ pause_bound_ruling: input.inputVersions?.pauseBoundRuling ?? null,
7658
+ policy_digest: input.inputVersions?.policyDigest ?? null
7659
+ },
7660
+ provenance: provenanceFor(input),
7661
+ work: {
7662
+ ref: lineageFieldFromEnv(input.env.workRef) ?? (issue === null ? null : String(issue)),
7663
+ repo: input.repo,
7664
+ change: pr === undefined ? null : String(pr),
7665
+ revision: input.revision ?? null
7666
+ },
7667
+ flow: {
7668
+ id: lineageFieldFromEnv(input.env.flow) ?? "vinaya",
7669
+ version: lineageFieldFromEnv(input.env.flowVersion)
7670
+ },
7671
+ runtime: lineageFieldFromEnv(input.env.runtime),
7672
+ process: {
7673
+ id: lineageFieldFromEnv(input.env.processId) ?? "vinaya",
7674
+ version: lineageFieldFromEnv(input.env.processVersion),
7675
+ digest: lineageFieldFromEnv(input.env.processDigest)
7676
+ },
7677
+ runner: {
7678
+ id: lineageFieldFromEnv(input.env.runnerId) ?? "standalone",
7679
+ version: lineageFieldFromEnv(input.env.runnerVersion)
7680
+ },
7681
+ source: lineageFieldFromEnv(input.env.source)
7682
+ },
7683
+ subject
7684
+ };
7685
+ }
7686
+ var init_envelope = __esm(() => {
7687
+ init_roles();
7688
+ });
7689
+
7558
7690
  // ../../harness/kernel/log/schema.ts
7559
7691
  import { z as z8 } from "zod";
7560
- 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;
7692
+ 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;
7561
7693
  var init_schema = __esm(() => {
7562
7694
  init_custom();
7563
- ROLE_VALUES = [
7564
- "planner",
7565
- "developer",
7566
- "code-reviewer",
7567
- "security",
7568
- "principal",
7569
- "archivist",
7570
- "architect"
7571
- ];
7572
- RoleSchema = z8.enum(ROLE_VALUES);
7695
+ ROLE_NAME_PATTERN = /^[a-z0-9-]+$/;
7696
+ RoleSchema = z8.string().regex(ROLE_NAME_PATTERN);
7573
7697
  HOST_VALUES = ["hook", "ci", "cli", "loop"];
7574
7698
  HostSchema = z8.enum(HOST_VALUES);
7575
7699
  RUN_ID_PATTERN = /^[A-Za-z0-9_.-]{1,128}$/;
@@ -8151,119 +8275,6 @@ var init_schema = __esm(() => {
8151
8275
  ]);
8152
8276
  });
8153
8277
 
8154
- // ../../harness/kernel/log/envelope.ts
8155
- import { createHash as createHash6 } from "node:crypto";
8156
- function isRole(value) {
8157
- return value !== undefined && ROLE_VALUES.includes(value);
8158
- }
8159
- function actorIdFromEnv(role) {
8160
- return role === undefined || role === "" ? null : role;
8161
- }
8162
- function lineageFieldFromEnv(value) {
8163
- return value === undefined || value === "" ? null : value;
8164
- }
8165
- function attemptFromEnv(value) {
8166
- if (value === undefined || value === "")
8167
- return null;
8168
- const n = Number(value);
8169
- return Number.isInteger(n) ? n : null;
8170
- }
8171
- function provenanceFor(input) {
8172
- if (input.provenance)
8173
- return input.provenance;
8174
- if (issueFromTask(input.env.task) === null && (input.branchIssue ?? null) !== null)
8175
- return "unavailable";
8176
- if (input.env.role || input.env.task)
8177
- return "env_correlated";
8178
- return "unavailable";
8179
- }
8180
- function issueFromTask(task) {
8181
- if (task === undefined || task === "")
8182
- return null;
8183
- const n = Number(task);
8184
- return Number.isInteger(n) ? n : null;
8185
- }
8186
- function roundFromEnv(round) {
8187
- if (round === undefined || round === "")
8188
- return;
8189
- const n = Number(round);
8190
- return Number.isInteger(n) ? n : undefined;
8191
- }
8192
- function prFromEnv(pr) {
8193
- if (pr === undefined || pr === "")
8194
- return;
8195
- const n = Number(pr);
8196
- return Number.isInteger(n) && n > 0 ? n : undefined;
8197
- }
8198
- function buildHeader(input) {
8199
- const role = isRole(input.env.role) ? input.env.role : "unattributed";
8200
- const round = roundFromEnv(input.env.round);
8201
- const pr = prFromEnv(input.env.pr);
8202
- const subject = {
8203
- issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
8204
- role,
8205
- ...round !== undefined ? { round } : {},
8206
- ...pr !== undefined ? { pr } : {},
8207
- ...input.subject ?? {}
8208
- };
8209
- const issue = subject.issue;
8210
- return {
8211
- meta: {
8212
- schema: 4,
8213
- ts: input.now.toISOString(),
8214
- run_id: input.runId,
8215
- seq: input.seq,
8216
- repo: input.repo,
8217
- vinaya: input.vinaya,
8218
- doctrine: input.doctrine,
8219
- host: input.host,
8220
- machine: createHash6("sha256").update(input.hostname).digest("hex"),
8221
- event_id: input.eventId,
8222
- process_id: input.processId,
8223
- actor_id: actorIdFromEnv(input.env.role),
8224
- lineage: {
8225
- run: lineageFieldFromEnv(input.env.run),
8226
- attempt: attemptFromEnv(input.env.attempt),
8227
- parent: lineageFieldFromEnv(input.env.parent)
8228
- },
8229
- input_versions: {
8230
- manifest_version: input.inputVersions?.manifestVersion ?? null,
8231
- objectives_version: input.inputVersions?.objectivesVersion ?? null,
8232
- brief_hash: input.inputVersions?.briefHash ?? null,
8233
- ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
8234
- pause_bound_ruling: input.inputVersions?.pauseBoundRuling ?? null,
8235
- policy_digest: input.inputVersions?.policyDigest ?? null
8236
- },
8237
- provenance: provenanceFor(input),
8238
- work: {
8239
- ref: lineageFieldFromEnv(input.env.workRef) ?? (issue === null ? null : String(issue)),
8240
- repo: input.repo,
8241
- change: pr === undefined ? null : String(pr),
8242
- revision: input.revision ?? null
8243
- },
8244
- flow: {
8245
- id: lineageFieldFromEnv(input.env.flow) ?? "vinaya",
8246
- version: lineageFieldFromEnv(input.env.flowVersion)
8247
- },
8248
- runtime: lineageFieldFromEnv(input.env.runtime),
8249
- process: {
8250
- id: lineageFieldFromEnv(input.env.processId) ?? "vinaya",
8251
- version: lineageFieldFromEnv(input.env.processVersion),
8252
- digest: lineageFieldFromEnv(input.env.processDigest)
8253
- },
8254
- runner: {
8255
- id: lineageFieldFromEnv(input.env.runnerId) ?? "standalone",
8256
- version: lineageFieldFromEnv(input.env.runnerVersion)
8257
- },
8258
- source: lineageFieldFromEnv(input.env.source)
8259
- },
8260
- subject
8261
- };
8262
- }
8263
- var init_envelope = __esm(() => {
8264
- init_schema();
8265
- });
8266
-
8267
8278
  // ../../harness/kernel/log/store.ts
8268
8279
  function metaOf(obj) {
8269
8280
  if (obj === null || typeof obj !== "object")
@@ -8369,7 +8380,8 @@ function code(value) {
8369
8380
  return typeof value === "string" && CODE_TOKEN_PATTERN.test(value) ? value : null;
8370
8381
  }
8371
8382
  function roleSubject(value, sentenceStart = true) {
8372
- const name = typeof value === "string" && ROLE_VALUES.includes(value) ? `the ${value === "security" ? "security reviewer" : value.replace(/-/g, " ")}` : "a role";
8383
+ const known = typeof value === "string" ? lookupRole(value) : undefined;
8384
+ const name = known ? `the ${known.reading}` : "a role";
8373
8385
  return sentenceStart ? `${name[0]?.toUpperCase()}${name.slice(1)}` : name;
8374
8386
  }
8375
8387
  function roundLabel(record) {
@@ -8488,7 +8500,7 @@ function conflictReentry(record) {
8488
8500
  function dispatched(record) {
8489
8501
  const role = text(record.target_role);
8490
8502
  const who = roleSubject(role);
8491
- const reviewing = role === "code-reviewer" || role === "security";
8503
+ const reviewing = role !== null && (lookupRole(role)?.reviews ?? false);
8492
8504
  const round = whole(record.round);
8493
8505
  return {
8494
8506
  kind: "working",
@@ -8547,6 +8559,7 @@ function narrate(record, earlier = []) {
8547
8559
  }
8548
8560
  var REASONS, PAUSE_WITHOUT_CODE;
8549
8561
  var init_narration = __esm(() => {
8562
+ init_roles();
8550
8563
  init_schema();
8551
8564
  REASONS = {
8552
8565
  escalation: { words: "a role escalated a question", person: true },
@@ -8579,13 +8592,7 @@ var init_narration = __esm(() => {
8579
8592
 
8580
8593
  // ../../harness/kernel/adapters/agents/agent-line.ts
8581
8594
  function roleLabel(role) {
8582
- if (role in roleLabels)
8583
- return roleLabels[role];
8584
- if (role === "dev-review-loop")
8585
- return "Loop";
8586
- if (role === "operator")
8587
- return "Operator";
8588
- return role.replace(/-/g, " ").replace(/\b\w/g, (letter) => letter.toUpperCase());
8595
+ return lookupTitle(role) ?? role.replace(/-/g, " ").replace(/\b\w/g, (letter) => letter.toUpperCase());
8589
8596
  }
8590
8597
  function formatLineMeta(meta) {
8591
8598
  if (meta === undefined)
@@ -8613,17 +8620,9 @@ function formatAgentLine(role, words, options = {}) {
8613
8620
  const mark = options.unicode ?? true ? unicodeMarks[options.mark ?? "working"] : asciiMarks[options.mark ?? "working"];
8614
8621
  return `${time} ${mark} ${roleLabel(role)} ${words}`;
8615
8622
  }
8616
- var roleLabels, unicodeMarks, asciiMarks, META_KEY, META_VALUE;
8623
+ var unicodeMarks, asciiMarks, META_KEY, META_VALUE;
8617
8624
  var init_agent_line = __esm(() => {
8618
- roleLabels = {
8619
- planner: "Planner",
8620
- developer: "Developer",
8621
- "code-reviewer": "Code review",
8622
- security: "Security",
8623
- principal: "Principal",
8624
- archivist: "Archivist",
8625
- architect: "Architect"
8626
- };
8625
+ init_roles();
8627
8626
  unicodeMarks = { working: "▸", done: "✓", failed: "✕", waiting: "◌", round: "◆" };
8628
8627
  asciiMarks = { working: ">", done: "+", failed: "x", waiting: "~", round: "#" };
8629
8628
  META_KEY = /^[a-z]+$/;
@@ -9854,6 +9853,28 @@ var init_log_sink = __esm(() => {
9854
9853
  defaultSinkSlot = createDefaultLogSinkSlot(process.env.VINAYA_RUN_ID || randomUUID3());
9855
9854
  });
9856
9855
 
9856
+ // ../../harness/processes/vinaya-strict/integration/log/log-roles.ts
9857
+ function registerVinayaLogRoles() {
9858
+ for (const { name, reading, title, reviews } of VINAYA_LOG_ROLES)
9859
+ registerRole(name, { reading, title, reviews });
9860
+ registerTitle("dev-review-loop", "Loop");
9861
+ }
9862
+ var VINAYA_LOG_ROLES, VINAYA_LOG_ROLE_NAMES;
9863
+ var init_log_roles = __esm(() => {
9864
+ init_roles();
9865
+ VINAYA_LOG_ROLES = [
9866
+ { name: "planner", reading: "planner", title: "Planner", reviews: false },
9867
+ { name: "developer", reading: "developer", title: "Developer", reviews: false },
9868
+ { name: "code-reviewer", reading: "code reviewer", title: "Code review", reviews: true },
9869
+ { name: "security", reading: "security reviewer", title: "Security", reviews: true },
9870
+ { name: "principal", reading: "principal", title: "Principal", reviews: false },
9871
+ { name: "archivist", reading: "archivist", title: "Archivist", reviews: false },
9872
+ { name: "architect", reading: "architect", title: "Architect", reviews: false }
9873
+ ];
9874
+ VINAYA_LOG_ROLE_NAMES = VINAYA_LOG_ROLES.map((role) => role.name);
9875
+ registerVinayaLogRoles();
9876
+ });
9877
+
9857
9878
  // ../../harness/processes/vinaya-strict/integration/log/branch-issue.ts
9858
9879
  import { execFile as execFile5 } from "node:child_process";
9859
9880
  import { promisify as promisify5 } from "node:util";
@@ -10056,6 +10077,7 @@ function installVinayaLogSinkFactory() {
10056
10077
  var init_log_sink_factory = __esm(() => {
10057
10078
  init_log_sink();
10058
10079
  init_package_root();
10080
+ init_log_roles();
10059
10081
  init_branch_issue();
10060
10082
  init_doctrine_version();
10061
10083
  });
@@ -11188,14 +11210,14 @@ function terminateChildWithGrace(pid, graceMs = TERMINATE_GRACE_MS) {
11188
11210
  } catch {}
11189
11211
  }
11190
11212
  }
11191
- function captureSettledChildSnapshot(pid) {
11192
- let snapshot = getProcessSnapshot(pid);
11213
+ function captureSettledChildSnapshot(pid, readSnapshot = getProcessSnapshot) {
11214
+ let snapshot = readSnapshot(pid);
11193
11215
  if (snapshot === null)
11194
11216
  return null;
11195
11217
  const deadline = Date.now() + IDENTITY_SETTLE_BUDGET_MS;
11196
11218
  while (Date.now() < deadline) {
11197
11219
  sleepSyncMs(IDENTITY_SETTLE_POLL_MS);
11198
- const next = getProcessSnapshot(pid);
11220
+ const next = readSnapshot(pid);
11199
11221
  if (next === null)
11200
11222
  return snapshot;
11201
11223
  if (next.command === snapshot.command)
@@ -17852,8 +17874,8 @@ var init_protected_paths2 = __esm(() => {
17852
17874
 
17853
17875
  // ../../harness/processes/vinaya-strict/integration/policies/roles.ts
17854
17876
  var GRANTED_ROLES, ROLE_TOOL_GRANTS, VINAYA_TOOL_GRANTS, VINAYA_BROKER_ROLES, VINAYA_BOUNDARY_ROLES, OPERATOR_TOOL_GRANT, PLANNER_TOOL_GRANT, VINAYA_PLANNER_ROUTER_ROLES, ARCHITECT_TOOL_GRANT, TRANCHE_ARCHIVIST_TOOL_GRANT, VINAYA_ARCHITECT_ROUTER_ROLES, VINAYA_TRANCHE_ARCHIVIST_ROUTER_ROLES, VINAYA_ROUTER_ROLES;
17855
- var init_roles = __esm(() => {
17856
- init_schema();
17877
+ var init_roles2 = __esm(() => {
17878
+ init_log_roles();
17857
17879
  GRANTED_ROLES = ["developer", "code-reviewer", "security", "controller"];
17858
17880
  ROLE_TOOL_GRANTS = {
17859
17881
  developer: [
@@ -17872,7 +17894,7 @@ var init_roles = __esm(() => {
17872
17894
  };
17873
17895
  VINAYA_TOOL_GRANTS = { roles: GRANTED_ROLES, grants: ROLE_TOOL_GRANTS };
17874
17896
  VINAYA_BROKER_ROLES = {
17875
- recognizedRoles: ROLE_VALUES,
17897
+ recognizedRoles: VINAYA_LOG_ROLE_NAMES,
17876
17898
  workerRoles: ["developer"],
17877
17899
  surfaceOwner: "the Planner"
17878
17900
  };
@@ -18034,7 +18056,7 @@ function vinayaRouterPolicies() {
18034
18056
  var init_vinaya_policies = __esm(() => {
18035
18057
  init_launch_records();
18036
18058
  init_protected_paths2();
18037
- init_roles();
18059
+ init_roles2();
18038
18060
  init_scratch_names();
18039
18061
  });
18040
18062
 
@@ -19787,6 +19809,73 @@ var init_premise_reassert_logic = __esm(() => {
19787
19809
  init_ops();
19788
19810
  });
19789
19811
 
19812
+ // ../../harness/processes/vinaya-strict/loops/dev-review/v2/git-read-memo.ts
19813
+ import { resolve as resolve6 } from "node:path";
19814
+ function gitSubcommand(args) {
19815
+ for (let i = 0;i < args.length; i++) {
19816
+ const arg = args[i];
19817
+ if (arg === "-C" || arg === "-c" || arg === "--git-dir" || arg === "--work-tree") {
19818
+ i++;
19819
+ continue;
19820
+ }
19821
+ if (arg.startsWith("-"))
19822
+ continue;
19823
+ return arg;
19824
+ }
19825
+ return;
19826
+ }
19827
+ function gitReadKey(cwd, args) {
19828
+ return [resolve6(cwd ?? process.cwd()), ...args].join("\x00");
19829
+ }
19830
+ function gitReadMemoServing() {
19831
+ return memoEnabled && state.scopes > 0 && state.turns === 0;
19832
+ }
19833
+ function clearGitReadMemo(reason = "cleared") {
19834
+ state.entries.clear();
19835
+ notify({ kind: "clear", reason });
19836
+ }
19837
+ function runGit(cwd, args, run) {
19838
+ const sub = gitSubcommand(args);
19839
+ const key = gitReadKey(cwd, args);
19840
+ const memoizable = sub !== undefined && MEMOIZED.has(sub);
19841
+ if (memoizable && gitReadMemoServing()) {
19842
+ const kept = state.entries.get(key);
19843
+ if (kept !== undefined) {
19844
+ notify({ kind: "hit", key });
19845
+ return kept;
19846
+ }
19847
+ let value;
19848
+ try {
19849
+ value = run();
19850
+ } catch (error) {
19851
+ notify({ kind: "spawn", key, memoizable: true, served: false });
19852
+ throw error;
19853
+ }
19854
+ notify({ kind: "spawn", key, memoizable: true, served: true });
19855
+ if (gitReadMemoServing())
19856
+ state.entries.set(key, value);
19857
+ return value;
19858
+ }
19859
+ notify({ kind: "spawn", key, memoizable, served: false });
19860
+ if (memoizable || sub !== undefined && READ_ONLY_UNKEPT.has(sub))
19861
+ return run();
19862
+ try {
19863
+ return run();
19864
+ } finally {
19865
+ clearGitReadMemo(`git ${sub ?? "(none)"}`);
19866
+ }
19867
+ }
19868
+ var MEMOIZED, READ_ONLY_UNKEPT, state, memoEnabled = true, notify = (event) => {
19869
+ for (const listener of state.listeners)
19870
+ listener(event);
19871
+ }, wrapped;
19872
+ var init_git_read_memo = __esm(() => {
19873
+ MEMOIZED = new Set(["rev-parse", "merge-base", "show-ref", "for-each-ref", "rev-list"]);
19874
+ READ_ONLY_UNKEPT = new Set(["ls-remote", "status", "diff", "ls-files", "log", "show", "cat-file", "merge-tree"]);
19875
+ state = { scopes: 0, turns: 0, entries: new Map, listeners: new Set };
19876
+ wrapped = new WeakMap;
19877
+ });
19878
+
19790
19879
  // ../../harness/processes/vinaya-strict/loops/dev-review/standalone/dev-review-loop/gate-reading.ts
19791
19880
  import { execFileSync as execFileSync14 } from "node:child_process";
19792
19881
  function shEnvOverride(name, fallback) {
@@ -19803,11 +19892,12 @@ function sleepSyncMs2(ms) {
19803
19892
  }
19804
19893
  function sh(cmd, args, options = {}) {
19805
19894
  if (cmd !== "gh") {
19806
- return execFileSync14(cmd, args, {
19895
+ const run = () => execFileSync14(cmd, args, {
19807
19896
  encoding: "utf8",
19808
19897
  stdio: ["ignore", "pipe", "pipe"],
19809
19898
  maxBuffer: MAX_GH_OUTPUT_BYTES
19810
19899
  }).trim();
19900
+ return cmd === "git" ? runGit(undefined, args, run) : run();
19811
19901
  }
19812
19902
  const attempts = options.attempts ?? shEnvOverride("VINAYA_DEV_REVIEW_LOOP_GH_RETRY_ATTEMPTS", 3);
19813
19903
  const backoffMs = shEnvOverride("VINAYA_DEV_REVIEW_LOOP_GH_RETRY_BACKOFF_MS", 500);
@@ -19858,6 +19948,7 @@ var MAX_GH_OUTPUT_BYTES, NON_CI_WORKFLOW_PATHS, NON_CI_WORKFLOW_NAMES, FAILED_WO
19858
19948
  var init_gate_reading = __esm(() => {
19859
19949
  init_premise_reassert_logic();
19860
19950
  init_round_assess();
19951
+ init_git_read_memo();
19861
19952
  MAX_GH_OUTPUT_BYTES = 64 * 1024 * 1024;
19862
19953
  NON_CI_WORKFLOW_PATHS = [
19863
19954
  REVIEW_WORKFLOW_PATH,
@@ -20897,6 +20988,7 @@ import { z as z11 } from "zod";
20897
20988
  var SECURITY_SCAN_MAX_BUFFER_BYTES, DevReviewLoopEventInputSchema;
20898
20989
  var init_git_defaults = __esm(() => {
20899
20990
  init_gate_reading();
20991
+ init_git_read_memo();
20900
20992
  init_pr_report_engine();
20901
20993
  init_worker_boundary();
20902
20994
  init_issue_validation();
@@ -20997,6 +21089,7 @@ var init_developer_defaults = __esm(async () => {
20997
21089
  init_live_developer_context();
20998
21090
  init_worker_boundary();
20999
21091
  init_gate_reading();
21092
+ init_git_read_memo();
21000
21093
  init_git_defaults();
21001
21094
  init_driver_tool_guard();
21002
21095
  init_live_developer_context();
@@ -21545,6 +21638,7 @@ var init_live_check = __esm(() => {
21545
21638
  init_runner();
21546
21639
  init_dispatch();
21547
21640
  init_pr_facts();
21641
+ init_git_read_memo();
21548
21642
  init_worker_boundary();
21549
21643
  LIVE_RUN_TIMEOUT_MS = 20 * 60000;
21550
21644
  MAX_KEPT_OUTPUT_CHARS = 256 * 1024;
@@ -21573,7 +21667,7 @@ var init_task_sweep = __esm(async () => {
21573
21667
 
21574
21668
  // ../../harness/processes/vinaya-strict/loops/dev-review/run-control/task-run-engine.ts
21575
21669
  import { existsSync as existsSync19, readFileSync as readFileSync19, renameSync as renameSync4, writeFileSync as writeFileSync13 } from "node:fs";
21576
- import { dirname as dirname14, join as join23, resolve as resolve6 } from "node:path";
21670
+ import { dirname as dirname14, join as join23, resolve as resolve7 } from "node:path";
21577
21671
  function taskRunnerRecordPath(task, root = runtimeDirForThisRepo()) {
21578
21672
  return runPath2(root, task, { area: "task", file: "runner.json" });
21579
21673
  }
@@ -21610,7 +21704,7 @@ function engineContinuationCommand(target) {
21610
21704
  return ["bun", ...engineContinuationArgv(target)].join(" ");
21611
21705
  }
21612
21706
  function engineRunnerScriptPath() {
21613
- return resolve6(cliPackageRoot(), "../..", PROCESS_FOLDER_IN_CHECKOUT, "bin/run-engine.ts");
21707
+ return resolve7(cliPackageRoot(), "../..", PROCESS_FOLDER_IN_CHECKOUT, "bin/run-engine.ts");
21614
21708
  }
21615
21709
  var PROCESS_FOLDER_IN_CHECKOUT = "harness/processes/vinaya-strict";
21616
21710
  var init_task_run_engine = __esm(async () => {
@@ -22086,6 +22180,7 @@ var init_turn_confinement = __esm(async () => {
22086
22180
  // ../../harness/processes/vinaya-strict/tools/dev-review-policy/assess-round.ts
22087
22181
  var init_assess_round = __esm(() => {
22088
22182
  init_schema();
22183
+ init_log_roles();
22089
22184
  init_review_status();
22090
22185
  init_task_phase_history();
22091
22186
  init_types();
@@ -25516,7 +25611,7 @@ function taskPrReadHandler(input, forge = defaultPrReadForge) {
25516
25611
  // ../../harness/processes/vinaya-strict/integration/server.ts
25517
25612
  init_router();
25518
25613
  init_vinaya_policies();
25519
- init_roles();
25614
+ init_roles2();
25520
25615
 
25521
25616
  // ../../harness/processes/vinaya-strict/thinking/architect/tools/architect-tools.ts
25522
25617
  import { z as z13 } from "zod";