@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
@@ -3874,21 +3874,145 @@ var init_fetch_documentation = __esm(() => {
3874
3874
  REQUEST_HEADER_ALLOWANCE = 64 * 1024;
3875
3875
  });
3876
3876
 
3877
+ // ../../harness/kernel/log/roles.ts
3878
+ function registerRole(name, role) {
3879
+ roles.set(name, role);
3880
+ }
3881
+ function registerTitle(name, title) {
3882
+ titles.set(name, title);
3883
+ }
3884
+ function isRole(value) {
3885
+ return value !== undefined && roles.has(value);
3886
+ }
3887
+ function lookupRole(name) {
3888
+ return roles.get(name);
3889
+ }
3890
+ function lookupTitle(name) {
3891
+ return roles.get(name)?.title ?? titles.get(name);
3892
+ }
3893
+ var roles, titles;
3894
+ var init_roles = __esm(() => {
3895
+ roles = new Map;
3896
+ titles = new Map;
3897
+ });
3898
+
3899
+ // ../../harness/kernel/log/envelope.ts
3900
+ import { createHash as createHash2 } from "node:crypto";
3901
+ function actorIdFromEnv(role) {
3902
+ return role === undefined || role === "" ? null : role;
3903
+ }
3904
+ function lineageFieldFromEnv(value) {
3905
+ return value === undefined || value === "" ? null : value;
3906
+ }
3907
+ function attemptFromEnv(value) {
3908
+ if (value === undefined || value === "")
3909
+ return null;
3910
+ const n = Number(value);
3911
+ return Number.isInteger(n) ? n : null;
3912
+ }
3913
+ function provenanceFor(input) {
3914
+ if (input.provenance)
3915
+ return input.provenance;
3916
+ if (issueFromTask(input.env.task) === null && (input.branchIssue ?? null) !== null)
3917
+ return "unavailable";
3918
+ if (input.env.role || input.env.task)
3919
+ return "env_correlated";
3920
+ return "unavailable";
3921
+ }
3922
+ function issueFromTask(task) {
3923
+ if (task === undefined || task === "")
3924
+ return null;
3925
+ const n = Number(task);
3926
+ return Number.isInteger(n) ? n : null;
3927
+ }
3928
+ function roundFromEnv(round) {
3929
+ if (round === undefined || round === "")
3930
+ return;
3931
+ const n = Number(round);
3932
+ return Number.isInteger(n) ? n : undefined;
3933
+ }
3934
+ function prFromEnv(pr) {
3935
+ if (pr === undefined || pr === "")
3936
+ return;
3937
+ const n = Number(pr);
3938
+ return Number.isInteger(n) && n > 0 ? n : undefined;
3939
+ }
3940
+ function buildHeader(input) {
3941
+ const role = isRole(input.env.role) ? input.env.role : "unattributed";
3942
+ const round = roundFromEnv(input.env.round);
3943
+ const pr = prFromEnv(input.env.pr);
3944
+ const subject = {
3945
+ issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
3946
+ role,
3947
+ ...round !== undefined ? { round } : {},
3948
+ ...pr !== undefined ? { pr } : {},
3949
+ ...input.subject ?? {}
3950
+ };
3951
+ const issue = subject.issue;
3952
+ return {
3953
+ meta: {
3954
+ schema: 4,
3955
+ ts: input.now.toISOString(),
3956
+ run_id: input.runId,
3957
+ seq: input.seq,
3958
+ repo: input.repo,
3959
+ vinaya: input.vinaya,
3960
+ doctrine: input.doctrine,
3961
+ host: input.host,
3962
+ machine: createHash2("sha256").update(input.hostname).digest("hex"),
3963
+ event_id: input.eventId,
3964
+ process_id: input.processId,
3965
+ actor_id: actorIdFromEnv(input.env.role),
3966
+ lineage: {
3967
+ run: lineageFieldFromEnv(input.env.run),
3968
+ attempt: attemptFromEnv(input.env.attempt),
3969
+ parent: lineageFieldFromEnv(input.env.parent)
3970
+ },
3971
+ input_versions: {
3972
+ manifest_version: input.inputVersions?.manifestVersion ?? null,
3973
+ objectives_version: input.inputVersions?.objectivesVersion ?? null,
3974
+ brief_hash: input.inputVersions?.briefHash ?? null,
3975
+ ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
3976
+ pause_bound_ruling: input.inputVersions?.pauseBoundRuling ?? null,
3977
+ policy_digest: input.inputVersions?.policyDigest ?? null
3978
+ },
3979
+ provenance: provenanceFor(input),
3980
+ work: {
3981
+ ref: lineageFieldFromEnv(input.env.workRef) ?? (issue === null ? null : String(issue)),
3982
+ repo: input.repo,
3983
+ change: pr === undefined ? null : String(pr),
3984
+ revision: input.revision ?? null
3985
+ },
3986
+ flow: {
3987
+ id: lineageFieldFromEnv(input.env.flow) ?? "vinaya",
3988
+ version: lineageFieldFromEnv(input.env.flowVersion)
3989
+ },
3990
+ runtime: lineageFieldFromEnv(input.env.runtime),
3991
+ process: {
3992
+ id: lineageFieldFromEnv(input.env.processId) ?? "vinaya",
3993
+ version: lineageFieldFromEnv(input.env.processVersion),
3994
+ digest: lineageFieldFromEnv(input.env.processDigest)
3995
+ },
3996
+ runner: {
3997
+ id: lineageFieldFromEnv(input.env.runnerId) ?? "standalone",
3998
+ version: lineageFieldFromEnv(input.env.runnerVersion)
3999
+ },
4000
+ source: lineageFieldFromEnv(input.env.source)
4001
+ },
4002
+ subject
4003
+ };
4004
+ }
4005
+ var init_envelope = __esm(() => {
4006
+ init_roles();
4007
+ });
4008
+
3877
4009
  // ../../harness/kernel/log/schema.ts
3878
4010
  import { z as z7 } from "zod";
3879
- 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;
4011
+ 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;
3880
4012
  var init_schema = __esm(() => {
3881
4013
  init_custom();
3882
- ROLE_VALUES = [
3883
- "planner",
3884
- "developer",
3885
- "code-reviewer",
3886
- "security",
3887
- "principal",
3888
- "archivist",
3889
- "architect"
3890
- ];
3891
- RoleSchema = z7.enum(ROLE_VALUES);
4014
+ ROLE_NAME_PATTERN = /^[a-z0-9-]+$/;
4015
+ RoleSchema = z7.string().regex(ROLE_NAME_PATTERN);
3892
4016
  HOST_VALUES = ["hook", "ci", "cli", "loop"];
3893
4017
  HostSchema = z7.enum(HOST_VALUES);
3894
4018
  RUN_ID_PATTERN = /^[A-Za-z0-9_.-]{1,128}$/;
@@ -4470,119 +4594,6 @@ var init_schema = __esm(() => {
4470
4594
  ]);
4471
4595
  });
4472
4596
 
4473
- // ../../harness/kernel/log/envelope.ts
4474
- import { createHash as createHash2 } from "node:crypto";
4475
- function isRole(value) {
4476
- return value !== undefined && ROLE_VALUES.includes(value);
4477
- }
4478
- function actorIdFromEnv(role) {
4479
- return role === undefined || role === "" ? null : role;
4480
- }
4481
- function lineageFieldFromEnv(value) {
4482
- return value === undefined || value === "" ? null : value;
4483
- }
4484
- function attemptFromEnv(value) {
4485
- if (value === undefined || value === "")
4486
- return null;
4487
- const n = Number(value);
4488
- return Number.isInteger(n) ? n : null;
4489
- }
4490
- function provenanceFor(input) {
4491
- if (input.provenance)
4492
- return input.provenance;
4493
- if (issueFromTask(input.env.task) === null && (input.branchIssue ?? null) !== null)
4494
- return "unavailable";
4495
- if (input.env.role || input.env.task)
4496
- return "env_correlated";
4497
- return "unavailable";
4498
- }
4499
- function issueFromTask(task) {
4500
- if (task === undefined || task === "")
4501
- return null;
4502
- const n = Number(task);
4503
- return Number.isInteger(n) ? n : null;
4504
- }
4505
- function roundFromEnv(round) {
4506
- if (round === undefined || round === "")
4507
- return;
4508
- const n = Number(round);
4509
- return Number.isInteger(n) ? n : undefined;
4510
- }
4511
- function prFromEnv(pr) {
4512
- if (pr === undefined || pr === "")
4513
- return;
4514
- const n = Number(pr);
4515
- return Number.isInteger(n) && n > 0 ? n : undefined;
4516
- }
4517
- function buildHeader(input) {
4518
- const role = isRole(input.env.role) ? input.env.role : "unattributed";
4519
- const round = roundFromEnv(input.env.round);
4520
- const pr = prFromEnv(input.env.pr);
4521
- const subject = {
4522
- issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
4523
- role,
4524
- ...round !== undefined ? { round } : {},
4525
- ...pr !== undefined ? { pr } : {},
4526
- ...input.subject ?? {}
4527
- };
4528
- const issue = subject.issue;
4529
- return {
4530
- meta: {
4531
- schema: 4,
4532
- ts: input.now.toISOString(),
4533
- run_id: input.runId,
4534
- seq: input.seq,
4535
- repo: input.repo,
4536
- vinaya: input.vinaya,
4537
- doctrine: input.doctrine,
4538
- host: input.host,
4539
- machine: createHash2("sha256").update(input.hostname).digest("hex"),
4540
- event_id: input.eventId,
4541
- process_id: input.processId,
4542
- actor_id: actorIdFromEnv(input.env.role),
4543
- lineage: {
4544
- run: lineageFieldFromEnv(input.env.run),
4545
- attempt: attemptFromEnv(input.env.attempt),
4546
- parent: lineageFieldFromEnv(input.env.parent)
4547
- },
4548
- input_versions: {
4549
- manifest_version: input.inputVersions?.manifestVersion ?? null,
4550
- objectives_version: input.inputVersions?.objectivesVersion ?? null,
4551
- brief_hash: input.inputVersions?.briefHash ?? null,
4552
- ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
4553
- pause_bound_ruling: input.inputVersions?.pauseBoundRuling ?? null,
4554
- policy_digest: input.inputVersions?.policyDigest ?? null
4555
- },
4556
- provenance: provenanceFor(input),
4557
- work: {
4558
- ref: lineageFieldFromEnv(input.env.workRef) ?? (issue === null ? null : String(issue)),
4559
- repo: input.repo,
4560
- change: pr === undefined ? null : String(pr),
4561
- revision: input.revision ?? null
4562
- },
4563
- flow: {
4564
- id: lineageFieldFromEnv(input.env.flow) ?? "vinaya",
4565
- version: lineageFieldFromEnv(input.env.flowVersion)
4566
- },
4567
- runtime: lineageFieldFromEnv(input.env.runtime),
4568
- process: {
4569
- id: lineageFieldFromEnv(input.env.processId) ?? "vinaya",
4570
- version: lineageFieldFromEnv(input.env.processVersion),
4571
- digest: lineageFieldFromEnv(input.env.processDigest)
4572
- },
4573
- runner: {
4574
- id: lineageFieldFromEnv(input.env.runnerId) ?? "standalone",
4575
- version: lineageFieldFromEnv(input.env.runnerVersion)
4576
- },
4577
- source: lineageFieldFromEnv(input.env.source)
4578
- },
4579
- subject
4580
- };
4581
- }
4582
- var init_envelope = __esm(() => {
4583
- init_schema();
4584
- });
4585
-
4586
4597
  // ../../harness/kernel/log/store.ts
4587
4598
  function metaOf(obj) {
4588
4599
  if (obj === null || typeof obj !== "object")
@@ -4688,7 +4699,8 @@ function code(value) {
4688
4699
  return typeof value === "string" && CODE_TOKEN_PATTERN.test(value) ? value : null;
4689
4700
  }
4690
4701
  function roleSubject(value, sentenceStart = true) {
4691
- const name = typeof value === "string" && ROLE_VALUES.includes(value) ? `the ${value === "security" ? "security reviewer" : value.replace(/-/g, " ")}` : "a role";
4702
+ const known = typeof value === "string" ? lookupRole(value) : undefined;
4703
+ const name = known ? `the ${known.reading}` : "a role";
4692
4704
  return sentenceStart ? `${name[0]?.toUpperCase()}${name.slice(1)}` : name;
4693
4705
  }
4694
4706
  function roundLabel(record) {
@@ -4807,7 +4819,7 @@ function conflictReentry(record) {
4807
4819
  function dispatched(record) {
4808
4820
  const role = text(record.target_role);
4809
4821
  const who = roleSubject(role);
4810
- const reviewing = role === "code-reviewer" || role === "security";
4822
+ const reviewing = role !== null && (lookupRole(role)?.reviews ?? false);
4811
4823
  const round = whole(record.round);
4812
4824
  return {
4813
4825
  kind: "working",
@@ -4866,6 +4878,7 @@ function narrate(record, earlier = []) {
4866
4878
  }
4867
4879
  var REASONS, PAUSE_WITHOUT_CODE;
4868
4880
  var init_narration = __esm(() => {
4881
+ init_roles();
4869
4882
  init_schema();
4870
4883
  REASONS = {
4871
4884
  escalation: { words: "a role escalated a question", person: true },
@@ -4898,13 +4911,7 @@ var init_narration = __esm(() => {
4898
4911
 
4899
4912
  // ../../harness/kernel/adapters/agents/agent-line.ts
4900
4913
  function roleLabel(role) {
4901
- if (role in roleLabels)
4902
- return roleLabels[role];
4903
- if (role === "dev-review-loop")
4904
- return "Loop";
4905
- if (role === "operator")
4906
- return "Operator";
4907
- return role.replace(/-/g, " ").replace(/\b\w/g, (letter) => letter.toUpperCase());
4914
+ return lookupTitle(role) ?? role.replace(/-/g, " ").replace(/\b\w/g, (letter) => letter.toUpperCase());
4908
4915
  }
4909
4916
  function formatLineMeta(meta) {
4910
4917
  if (meta === undefined)
@@ -4918,17 +4925,9 @@ function formatAgentLine(role, words, options = {}) {
4918
4925
  const mark = options.unicode ?? true ? unicodeMarks[options.mark ?? "working"] : asciiMarks[options.mark ?? "working"];
4919
4926
  return `${time} ${mark} ${roleLabel(role)} ${words}`;
4920
4927
  }
4921
- var roleLabels, unicodeMarks, asciiMarks, META_KEY, META_VALUE;
4928
+ var unicodeMarks, asciiMarks, META_KEY, META_VALUE;
4922
4929
  var init_agent_line = __esm(() => {
4923
- roleLabels = {
4924
- planner: "Planner",
4925
- developer: "Developer",
4926
- "code-reviewer": "Code review",
4927
- security: "Security",
4928
- principal: "Principal",
4929
- archivist: "Archivist",
4930
- architect: "Architect"
4931
- };
4930
+ init_roles();
4932
4931
  unicodeMarks = { working: "▸", done: "✓", failed: "✕", waiting: "◌", round: "◆" };
4933
4932
  asciiMarks = { working: ">", done: "+", failed: "x", waiting: "~", round: "#" };
4934
4933
  META_KEY = /^[a-z]+$/;
@@ -6150,6 +6149,28 @@ var init_log_sink = __esm(() => {
6150
6149
  defaultSinkSlot = createDefaultLogSinkSlot(process.env.VINAYA_RUN_ID || randomUUID2());
6151
6150
  });
6152
6151
 
6152
+ // ../../harness/processes/vinaya-strict/integration/log/log-roles.ts
6153
+ function registerVinayaLogRoles() {
6154
+ for (const { name, reading, title, reviews } of VINAYA_LOG_ROLES)
6155
+ registerRole(name, { reading, title, reviews });
6156
+ registerTitle("dev-review-loop", "Loop");
6157
+ }
6158
+ var VINAYA_LOG_ROLES, VINAYA_LOG_ROLE_NAMES;
6159
+ var init_log_roles = __esm(() => {
6160
+ init_roles();
6161
+ VINAYA_LOG_ROLES = [
6162
+ { name: "planner", reading: "planner", title: "Planner", reviews: false },
6163
+ { name: "developer", reading: "developer", title: "Developer", reviews: false },
6164
+ { name: "code-reviewer", reading: "code reviewer", title: "Code review", reviews: true },
6165
+ { name: "security", reading: "security reviewer", title: "Security", reviews: true },
6166
+ { name: "principal", reading: "principal", title: "Principal", reviews: false },
6167
+ { name: "archivist", reading: "archivist", title: "Archivist", reviews: false },
6168
+ { name: "architect", reading: "architect", title: "Architect", reviews: false }
6169
+ ];
6170
+ VINAYA_LOG_ROLE_NAMES = VINAYA_LOG_ROLES.map((role) => role.name);
6171
+ registerVinayaLogRoles();
6172
+ });
6173
+
6153
6174
  // ../../harness/processes/vinaya-strict/integration/log/branch-issue.ts
6154
6175
  import { execFile as execFile5 } from "node:child_process";
6155
6176
  import { promisify as promisify5 } from "node:util";
@@ -6352,6 +6373,7 @@ function installVinayaLogSinkFactory() {
6352
6373
  var init_log_sink_factory = __esm(() => {
6353
6374
  init_log_sink();
6354
6375
  init_package_root();
6376
+ init_log_roles();
6355
6377
  init_branch_issue();
6356
6378
  init_doctrine_version();
6357
6379
  });
@@ -6816,8 +6838,8 @@ var init_protected_paths2 = __esm(() => {
6816
6838
 
6817
6839
  // ../../harness/processes/vinaya-strict/integration/policies/roles.ts
6818
6840
  var GRANTED_ROLES, ROLE_TOOL_GRANTS, VINAYA_TOOL_GRANTS, VINAYA_BROKER_ROLES, VINAYA_BOUNDARY_ROLES, OPERATOR_TOOL_GRANT, VINAYA_ROUTER_ROLES;
6819
- var init_roles = __esm(() => {
6820
- init_schema();
6841
+ var init_roles2 = __esm(() => {
6842
+ init_log_roles();
6821
6843
  GRANTED_ROLES = ["developer", "code-reviewer", "security", "controller"];
6822
6844
  ROLE_TOOL_GRANTS = {
6823
6845
  developer: [
@@ -6836,7 +6858,7 @@ var init_roles = __esm(() => {
6836
6858
  };
6837
6859
  VINAYA_TOOL_GRANTS = { roles: GRANTED_ROLES, grants: ROLE_TOOL_GRANTS };
6838
6860
  VINAYA_BROKER_ROLES = {
6839
- recognizedRoles: ROLE_VALUES,
6861
+ recognizedRoles: VINAYA_LOG_ROLE_NAMES,
6840
6862
  workerRoles: ["developer"],
6841
6863
  surfaceOwner: "the Planner"
6842
6864
  };
@@ -6920,7 +6942,7 @@ function vinayaRouterPolicies() {
6920
6942
  var init_vinaya_policies = __esm(() => {
6921
6943
  init_launch_records();
6922
6944
  init_protected_paths2();
6923
- init_roles();
6945
+ init_roles2();
6924
6946
  init_scratch_names();
6925
6947
  });
6926
6948
 
@@ -7352,6 +7374,14 @@ init_premise_check();
7352
7374
 
7353
7375
  // ../../harness/processes/vinaya-strict/loops/dev-review/standalone/dev-review-loop/gate-reading.ts
7354
7376
  init_round_assess();
7377
+
7378
+ // ../../harness/processes/vinaya-strict/loops/dev-review/v2/git-read-memo.ts
7379
+ var MEMOIZED = new Set(["rev-parse", "merge-base", "show-ref", "for-each-ref", "rev-list"]);
7380
+ var READ_ONLY_UNKEPT = new Set(["ls-remote", "status", "diff", "ls-files", "log", "show", "cat-file", "merge-tree"]);
7381
+ var state = { scopes: 0, turns: 0, entries: new Map, listeners: new Set };
7382
+ var wrapped = new WeakMap;
7383
+
7384
+ // ../../harness/processes/vinaya-strict/loops/dev-review/standalone/dev-review-loop/gate-reading.ts
7355
7385
  var MAX_GH_OUTPUT_BYTES = 64 * 1024 * 1024;
7356
7386
 
7357
7387
  // ../../harness/processes/vinaya-strict/loops/dev-review/standalone/dev-review-loop/developer-dispatch.ts
@@ -201,19 +201,11 @@ var init_custom = __esm(() => {
201
201
 
202
202
  // ../../harness/kernel/log/schema.ts
203
203
  import { z as z2 } from "zod";
204
- 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;
204
+ 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;
205
205
  var init_schema = __esm(() => {
206
206
  init_custom();
207
- ROLE_VALUES = [
208
- "planner",
209
- "developer",
210
- "code-reviewer",
211
- "security",
212
- "principal",
213
- "archivist",
214
- "architect"
215
- ];
216
- RoleSchema = z2.enum(ROLE_VALUES);
207
+ ROLE_NAME_PATTERN = /^[a-z0-9-]+$/;
208
+ RoleSchema = z2.string().regex(ROLE_NAME_PATTERN);
217
209
  HOST_VALUES = ["hook", "ci", "cli", "loop"];
218
210
  HostSchema = z2.enum(HOST_VALUES);
219
211
  RUN_ID_PATTERN = /^[A-Za-z0-9_.-]{1,128}$/;
@@ -1041,11 +1033,30 @@ var init_config_schema = __esm(() => {
1041
1033
  KERNEL_CONFIG_REFINEMENTS = [];
1042
1034
  });
1043
1035
 
1044
- // ../../harness/kernel/log/envelope.ts
1045
- import { createHash as createHash2 } from "node:crypto";
1036
+ // ../../harness/kernel/log/roles.ts
1037
+ function registerRole(name, role) {
1038
+ roles.set(name, role);
1039
+ }
1040
+ function registerTitle(name, title) {
1041
+ titles.set(name, title);
1042
+ }
1046
1043
  function isRole(value) {
1047
- return value !== undefined && ROLE_VALUES.includes(value);
1044
+ return value !== undefined && roles.has(value);
1045
+ }
1046
+ function lookupRole(name) {
1047
+ return roles.get(name);
1048
1048
  }
1049
+ function lookupTitle(name) {
1050
+ return roles.get(name)?.title ?? titles.get(name);
1051
+ }
1052
+ var roles, titles;
1053
+ var init_roles = __esm(() => {
1054
+ roles = new Map;
1055
+ titles = new Map;
1056
+ });
1057
+
1058
+ // ../../harness/kernel/log/envelope.ts
1059
+ import { createHash as createHash2 } from "node:crypto";
1049
1060
  function actorIdFromEnv(role) {
1050
1061
  return role === undefined || role === "" ? null : role;
1051
1062
  }
@@ -1151,7 +1162,7 @@ function buildHeader(input) {
1151
1162
  };
1152
1163
  }
1153
1164
  var init_envelope = __esm(() => {
1154
- init_schema();
1165
+ init_roles();
1155
1166
  });
1156
1167
 
1157
1168
  // ../../harness/kernel/log/deferred-sink-factory.ts
@@ -1534,7 +1545,8 @@ function code(value) {
1534
1545
  return typeof value === "string" && CODE_TOKEN_PATTERN.test(value) ? value : null;
1535
1546
  }
1536
1547
  function roleSubject(value, sentenceStart = true) {
1537
- const name = typeof value === "string" && ROLE_VALUES.includes(value) ? `the ${value === "security" ? "security reviewer" : value.replace(/-/g, " ")}` : "a role";
1548
+ const known = typeof value === "string" ? lookupRole(value) : undefined;
1549
+ const name = known ? `the ${known.reading}` : "a role";
1538
1550
  return sentenceStart ? `${name[0]?.toUpperCase()}${name.slice(1)}` : name;
1539
1551
  }
1540
1552
  function roundLabel(record) {
@@ -1653,7 +1665,7 @@ function conflictReentry(record) {
1653
1665
  function dispatched(record) {
1654
1666
  const role = text(record.target_role);
1655
1667
  const who = roleSubject(role);
1656
- const reviewing = role === "code-reviewer" || role === "security";
1668
+ const reviewing = role !== null && (lookupRole(role)?.reviews ?? false);
1657
1669
  const round = whole(record.round);
1658
1670
  return {
1659
1671
  kind: "working",
@@ -1712,6 +1724,7 @@ function narrate(record, earlier = []) {
1712
1724
  }
1713
1725
  var REASONS, PAUSE_WITHOUT_CODE;
1714
1726
  var init_narration = __esm(() => {
1727
+ init_roles();
1715
1728
  init_schema();
1716
1729
  REASONS = {
1717
1730
  escalation: { words: "a role escalated a question", person: true },
@@ -1744,13 +1757,7 @@ var init_narration = __esm(() => {
1744
1757
 
1745
1758
  // ../../harness/kernel/adapters/agents/agent-line.ts
1746
1759
  function roleLabel(role) {
1747
- if (role in roleLabels)
1748
- return roleLabels[role];
1749
- if (role === "dev-review-loop")
1750
- return "Loop";
1751
- if (role === "operator")
1752
- return "Operator";
1753
- return role.replace(/-/g, " ").replace(/\b\w/g, (letter) => letter.toUpperCase());
1760
+ return lookupTitle(role) ?? role.replace(/-/g, " ").replace(/\b\w/g, (letter) => letter.toUpperCase());
1754
1761
  }
1755
1762
  function formatLineMeta(meta) {
1756
1763
  if (meta === undefined)
@@ -1764,17 +1771,9 @@ function formatAgentLine(role, words, options = {}) {
1764
1771
  const mark = options.unicode ?? true ? unicodeMarks[options.mark ?? "working"] : asciiMarks[options.mark ?? "working"];
1765
1772
  return `${time} ${mark} ${roleLabel(role)} ${words}`;
1766
1773
  }
1767
- var roleLabels, unicodeMarks, asciiMarks, META_KEY, META_VALUE;
1774
+ var unicodeMarks, asciiMarks, META_KEY, META_VALUE;
1768
1775
  var init_agent_line = __esm(() => {
1769
- roleLabels = {
1770
- planner: "Planner",
1771
- developer: "Developer",
1772
- "code-reviewer": "Code review",
1773
- security: "Security",
1774
- principal: "Principal",
1775
- archivist: "Archivist",
1776
- architect: "Architect"
1777
- };
1776
+ init_roles();
1778
1777
  unicodeMarks = { working: "▸", done: "✓", failed: "✕", waiting: "◌", round: "◆" };
1779
1778
  asciiMarks = { working: ">", done: "+", failed: "x", waiting: "~", round: "#" };
1780
1779
  META_KEY = /^[a-z]+$/;
@@ -6036,6 +6035,28 @@ var init_compose = __esm(() => {
6036
6035
  installVinayaConfigProvider();
6037
6036
  });
6038
6037
 
6038
+ // ../../harness/processes/vinaya-strict/integration/log/log-roles.ts
6039
+ function registerVinayaLogRoles() {
6040
+ for (const { name, reading, title, reviews } of VINAYA_LOG_ROLES)
6041
+ registerRole(name, { reading, title, reviews });
6042
+ registerTitle("dev-review-loop", "Loop");
6043
+ }
6044
+ var VINAYA_LOG_ROLES, VINAYA_LOG_ROLE_NAMES;
6045
+ var init_log_roles = __esm(() => {
6046
+ init_roles();
6047
+ VINAYA_LOG_ROLES = [
6048
+ { name: "planner", reading: "planner", title: "Planner", reviews: false },
6049
+ { name: "developer", reading: "developer", title: "Developer", reviews: false },
6050
+ { name: "code-reviewer", reading: "code reviewer", title: "Code review", reviews: true },
6051
+ { name: "security", reading: "security reviewer", title: "Security", reviews: true },
6052
+ { name: "principal", reading: "principal", title: "Principal", reviews: false },
6053
+ { name: "archivist", reading: "archivist", title: "Archivist", reviews: false },
6054
+ { name: "architect", reading: "architect", title: "Architect", reviews: false }
6055
+ ];
6056
+ VINAYA_LOG_ROLE_NAMES = VINAYA_LOG_ROLES.map((role) => role.name);
6057
+ registerVinayaLogRoles();
6058
+ });
6059
+
6039
6060
  // ../../harness/processes/vinaya-strict/integration/log/branch-issue.ts
6040
6061
  import { execFile as execFile5 } from "node:child_process";
6041
6062
  import { promisify as promisify5 } from "node:util";
@@ -6238,6 +6259,7 @@ function installVinayaLogSinkFactory() {
6238
6259
  var init_log_sink_factory = __esm(() => {
6239
6260
  init_log_sink();
6240
6261
  init_package_root();
6262
+ init_log_roles();
6241
6263
  init_branch_issue();
6242
6264
  init_doctrine_version();
6243
6265
  });
@@ -6643,8 +6665,8 @@ var init_protected_paths2 = __esm(() => {
6643
6665
 
6644
6666
  // ../../harness/processes/vinaya-strict/integration/policies/roles.ts
6645
6667
  var GRANTED_ROLES, ROLE_TOOL_GRANTS, VINAYA_TOOL_GRANTS, VINAYA_BROKER_ROLES, VINAYA_BOUNDARY_ROLES, OPERATOR_TOOL_GRANT, VINAYA_ROUTER_ROLES;
6646
- var init_roles = __esm(() => {
6647
- init_schema();
6668
+ var init_roles2 = __esm(() => {
6669
+ init_log_roles();
6648
6670
  GRANTED_ROLES = ["developer", "code-reviewer", "security", "controller"];
6649
6671
  ROLE_TOOL_GRANTS = {
6650
6672
  developer: [
@@ -6663,7 +6685,7 @@ var init_roles = __esm(() => {
6663
6685
  };
6664
6686
  VINAYA_TOOL_GRANTS = { roles: GRANTED_ROLES, grants: ROLE_TOOL_GRANTS };
6665
6687
  VINAYA_BROKER_ROLES = {
6666
- recognizedRoles: ROLE_VALUES,
6688
+ recognizedRoles: VINAYA_LOG_ROLE_NAMES,
6667
6689
  workerRoles: ["developer"],
6668
6690
  surfaceOwner: "the Planner"
6669
6691
  };
@@ -6747,7 +6769,7 @@ function vinayaRouterPolicies() {
6747
6769
  var init_vinaya_policies = __esm(() => {
6748
6770
  init_launch_records();
6749
6771
  init_protected_paths2();
6750
- init_roles();
6772
+ init_roles2();
6751
6773
  init_scratch_names();
6752
6774
  });
6753
6775