@attalabs/vinaya 0.44.0 → 0.47.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 (144) hide show
  1. package/README.md +6 -4
  2. package/dist/checks/bin/check-body-bare-digits.js +262 -201
  3. package/dist/checks/bin/check-branch-topology.js +70 -23
  4. package/dist/checks/bin/check-brief-shape.js +262 -201
  5. package/dist/checks/bin/check-changeset-coverage.js +94 -16
  6. package/dist/checks/bin/check-ci-shard-coverage.js +3 -0
  7. package/dist/checks/bin/check-closes-n.js +157 -40
  8. package/dist/checks/bin/check-coherence.js +365 -251
  9. package/dist/checks/bin/check-dispatch-readiness.js +3654 -469
  10. package/dist/checks/bin/check-doc-claims.js +262 -201
  11. package/dist/checks/bin/check-doc-coverage-push.js +272 -202
  12. package/dist/checks/bin/check-doc-coverage.js +272 -202
  13. package/dist/checks/bin/check-doctrine-no-procedures.js +262 -201
  14. package/dist/checks/bin/check-doctrine-portability.js +262 -201
  15. package/dist/checks/bin/check-evidence-fresh.js +10138 -2126
  16. package/dist/checks/bin/check-exec-bits.js +3 -0
  17. package/dist/checks/bin/check-first-push-dispatch.js +330 -230
  18. package/dist/checks/bin/check-issue-milestone-attach.js +94 -16
  19. package/dist/checks/bin/check-issue-objectives-numbering.js +262 -201
  20. package/dist/checks/bin/check-issue-parts-coverage.js +94 -16
  21. package/dist/checks/bin/check-issue-surface-globs.js +1062 -242
  22. package/dist/checks/bin/check-issue-title-grammar.js +21 -5
  23. package/dist/checks/bin/check-no-disk-state.js +5 -1
  24. package/dist/checks/bin/check-pr-premise-reassert.js +22 -2
  25. package/dist/checks/bin/check-pr-report-density.js +5 -1
  26. package/dist/checks/bin/check-principal-test-plan-wait.js +282 -207
  27. package/dist/checks/bin/check-quoted-command.js +262 -201
  28. package/dist/checks/bin/check-reader-resolvable-prose.js +262 -201
  29. package/dist/checks/bin/check-registry-gates.js +131 -34
  30. package/dist/checks/bin/check-retired-vocabulary.js +262 -201
  31. package/dist/checks/bin/check-review-gate.js +262 -201
  32. package/dist/checks/bin/check-single-plan-pr.js +5 -1
  33. package/dist/checks/bin/check-surface-scope.js +136 -38
  34. package/dist/checks/bin/check-test-plan.js +282 -207
  35. package/dist/checks/bin/check-token-collection-wired.js +3 -0
  36. package/dist/checks/bin/check-workspace-escape.js +3 -0
  37. package/dist/checks/bin/verify-coherence.js +237 -148
  38. package/dist/checks/bin/verify-dispatch.js +870 -66
  39. package/dist/checks/bin/verify-docs.js +13 -6
  40. package/dist/harness.js +57 -10
  41. package/dist/index.js +16670 -7196
  42. package/dist/lib/pre-push-cache-test-run.js +4488 -2170
  43. package/dist/lib/pre-push-changed-files.js +251 -12
  44. package/dist/lib/pre-push-mode.js +69 -19
  45. package/dist/lib/pre-push-progress-dir.js +10265 -2853
  46. package/dist/lib/pre-push-record-tests.js +67 -19
  47. package/dist/lib/pre-push-select-tests.js +520 -222
  48. package/dist/lib/push-progress-observer.js +9176 -1757
  49. package/dist/process.js +2 -0
  50. package/dist/programs/archive.js +8948 -1547
  51. package/dist/programs/audit.js +9176 -1772
  52. package/dist/programs/check.js +9248 -1845
  53. package/dist/programs/commit-msg.js +8984 -1583
  54. package/dist/programs/dev-review-loop.js +15621 -7626
  55. package/dist/programs/dispatch.js +9977 -2726
  56. package/dist/programs/log-emit.js +9011 -1660
  57. package/dist/programs/log-selftest.js +8908 -1507
  58. package/dist/programs/log-send.js +9081 -1594
  59. package/dist/programs/pr-report.js +9477 -1820
  60. package/dist/programs/pr-snapshot.js +8916 -1515
  61. package/dist/programs/pr-verify-evidence.js +9482 -1825
  62. package/dist/programs/pr.js +11773 -4082
  63. package/dist/programs/review-post.js +11141 -3496
  64. package/dist/programs/review-status.js +8997 -1533
  65. package/dist/programs/run-engine.js +22149 -18798
  66. package/dist/programs/sync.js +9030 -1629
  67. package/dist/programs/task-brief.js +10234 -1827
  68. package/dist/programs/task-sweep.js +9267 -1621
  69. package/dist/programs/task-tools-serve.js +77141 -16659
  70. package/dist/programs/tokens.js +8966 -1565
  71. package/dist/programs/waiver.js +8983 -1582
  72. package/dist/types/harness/kernel/dev-process-socket/loader/load-process.d.ts +1 -1
  73. package/dist/types/harness/processes/vinaya-strict/tools/legacy-markers.d.ts +8 -0
  74. package/dist/types/harness/processes/vinaya-strict/tools/task-contract/brief-validation.d.ts +17 -10
  75. package/dist/types/harness/processes/vinaya-strict/tools/task-contract/objectives.d.ts +5 -6
  76. package/dist/types/harness/processes/vinaya-strict/tools/task-contract/premise-check.d.ts +14 -0
  77. package/dist/vinaya-strict/checks/registry.ts +2 -2
  78. package/dist/vinaya-strict/executing/developer/developer-doctrine-shape.test.ts +8 -0
  79. package/dist/vinaya-strict/executing/developer/developer-turn-result.ts +1 -1
  80. package/dist/vinaya-strict/executing/developer/evals/developer-capability-suite.test.ts +2 -2
  81. package/dist/vinaya-strict/executing/developer/evals/developer-capability-suite.ts +30 -20
  82. package/dist/vinaya-strict/executing/developer/reference.md +5 -3
  83. package/dist/vinaya-strict/integration/config/vinaya-config-section.ts +29 -7
  84. package/dist/vinaya-strict/integration/policies/vinaya-policies.ts +4 -4
  85. package/dist/vinaya-strict/integration/process/process-integration.ts +5 -1
  86. package/dist/vinaya-strict/process.yaml +6 -1
  87. package/dist/vinaya-strict/thinking/plan-reviewer/doctrine.md +68 -0
  88. package/dist/vinaya-strict/thinking/plan-reviewer/grants.yaml +19 -0
  89. package/dist/vinaya-strict/thinking/plan-reviewer/output.schema.json +388 -0
  90. package/dist/vinaya-strict/thinking/planner/doctrine.md +4 -1
  91. package/dist/vinaya-strict/thinking/planner/tools/amend-rationale-deps.test.ts +10 -2
  92. package/dist/vinaya-strict/thinking/planner/tools/amend-rationale-deps.ts +5 -1
  93. package/dist/vinaya-strict/thinking/planner/tools/open-issue.test.ts +198 -34
  94. package/dist/vinaya-strict/thinking/planner/tools/open-issue.ts +120 -193
  95. package/dist/vinaya-strict/thinking/planner/tools/planner-operations.test.ts +629 -15
  96. package/dist/vinaya-strict/thinking/planner/tools/planner-operations.ts +726 -62
  97. package/dist/vinaya-strict/thinking/planner/tools/planner-tools.test.ts +505 -5
  98. package/dist/vinaya-strict/thinking/planner/tools/planner-tools.ts +636 -21
  99. package/package.json +3 -2
  100. package/studio-standalone/apps/vinaya-studio/.next/BUILD_ID +1 -1
  101. package/studio-standalone/apps/vinaya-studio/.next/build-manifest.json +2 -2
  102. package/studio-standalone/apps/vinaya-studio/.next/prerender-manifest.json +3 -3
  103. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  104. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.html +1 -1
  105. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.rsc +1 -1
  106. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  107. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  108. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  109. package/studio-standalone/apps/vinaya-studio/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  110. package/studio-standalone/apps/vinaya-studio/.next/server/app/milestones/page_client-reference-manifest.js +1 -1
  111. package/studio-standalone/apps/vinaya-studio/.next/server/app/page_client-reference-manifest.js +1 -1
  112. package/studio-standalone/apps/vinaya-studio/.next/server/app/tasks/page_client-reference-manifest.js +1 -1
  113. package/studio-standalone/apps/vinaya-studio/.next/server/chunks/209.js +2 -2
  114. package/studio-standalone/apps/vinaya-studio/.next/server/chunks/951.js +1 -1
  115. package/studio-standalone/apps/vinaya-studio/.next/server/middleware-build-manifest.js +1 -1
  116. package/studio-standalone/apps/vinaya-studio/.next/server/pages/500.html +1 -1
  117. package/studio-standalone/apps/vinaya-studio/.next/server/preview-props.json +3 -3
  118. package/studio-standalone/apps/vinaya-studio/.next/server/server-reference-manifest.json +1 -1
  119. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/151-c365f0ef8268ad13.js +1 -0
  120. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/19-aa314f13784dcc58.js +4 -0
  121. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/{layout-dfa2186095e797bd.js → layout-f038e8deecb2bf5f.js} +1 -1
  122. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/milestones/{page-2fffb49104860a15.js → page-12314f4deb06a414.js} +1 -1
  123. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/{page-6ae258f663623b2a.js → page-7a06aa3cdd046fa8.js} +1 -1
  124. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/tasks/{page-2fffb49104860a15.js → page-12314f4deb06a414.js} +1 -1
  125. package/studio-standalone/apps/vinaya-studio/.next/static/css/8eb5ed5b65b9692e.css +1 -0
  126. package/studio-standalone/apps/vinaya-studio/log-follow.mjs +708 -93
  127. package/studio-standalone/apps/vinaya-studio/log-sync-folder-source.mjs +699 -84
  128. package/studio-standalone/apps/vinaya-studio/studio-server.mjs +4692 -3116
  129. package/vinaya-strict/artifacts/templates/brief-template.md +6 -0
  130. package/vinaya-strict/artifacts/templates/issue-rationale-template.md +7 -3
  131. package/vinaya-strict/artifacts/templates/pr-report-template.md +1 -1
  132. package/vinaya-strict/doctrine/contracts/planner-developer.md +4 -3
  133. package/vinaya-strict/doctrine/enforcement.md +4 -4
  134. package/vinaya-strict/doctrine/roles/principal.md +1 -1
  135. package/vinaya-strict/doctrine/state-machine.md +7 -2
  136. package/vinaya-strict/executing/developer/reference.md +5 -3
  137. package/vinaya-strict/thinking/plan-reviewer/doctrine.md +68 -0
  138. package/vinaya-strict/thinking/planner/doctrine.md +4 -1
  139. package/vinaya-strict/thinking/planner/reference.md +30 -9
  140. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/151-23bea4cac9687151.js +0 -1
  141. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/853-1d5548ff3a55a75f.js +0 -4
  142. package/studio-standalone/apps/vinaya-studio/.next/static/css/fb16828fc3128d4c.css +0 -1
  143. /package/studio-standalone/apps/vinaya-studio/.next/static/{_r9iZDxlkoek85d_3oaxL → bJrgAp9Kl4JsCUYkeAYez}/_buildManifest.js +0 -0
  144. /package/studio-standalone/apps/vinaya-studio/.next/static/{_r9iZDxlkoek85d_3oaxL → bJrgAp9Kl4JsCUYkeAYez}/_ssgManifest.js +0 -0
@@ -34,6 +34,299 @@ var init_envelope = __esm(() => {
34
34
  init_roles();
35
35
  });
36
36
 
37
+ // ../../packages/log-sdk/src/contract/catalogue.ts
38
+ var SPAN_NAMES, EVENT_NAMES, ATTRIBUTE_NAMES, FORBIDDEN_CONTENT_ATTRIBUTES, ALL_SPAN_NAMES, ALL_EVENT_NAMES, ALL_ATTRIBUTE_NAMES;
39
+ var init_catalogue = __esm(() => {
40
+ SPAN_NAMES = {
41
+ run: "invoke_workflow",
42
+ round: "vinaya.round",
43
+ phase: "vinaya.phase",
44
+ agent: "invoke_agent",
45
+ step: "execute_tool",
46
+ checks: "vinaya.checks",
47
+ person: "vinaya.person",
48
+ pause: "vinaya.pause"
49
+ };
50
+ EVENT_NAMES = {
51
+ runStarted: "vinaya.run.started",
52
+ roundStarted: "vinaya.round.started",
53
+ agentStarted: "vinaya.agent.started",
54
+ usageRecorded: "vinaya.usage.recorded",
55
+ stepStarted: "vinaya.step.started",
56
+ pauseStarted: "vinaya.pause.started",
57
+ personAsked: "vinaya.person.asked",
58
+ alive: "vinaya.run.alive",
59
+ stageChanged: "vinaya.run.stage_changed",
60
+ cancelled: "vinaya.run.cancelled",
61
+ retried: "vinaya.run.retried",
62
+ stopRuleMet: "vinaya.run.stop_rule_met",
63
+ exited: "vinaya.run.exited",
64
+ confidenceStated: "vinaya.agent.confidence_stated",
65
+ reviewVerdicts: "vinaya.review.verdicts",
66
+ findingsCompared: "vinaya.review.findings_compared",
67
+ checkNotPassed: "vinaya.checks.not_passed",
68
+ checkRead: "vinaya.checks.read",
69
+ forgeValidated: "vinaya.forge.validated",
70
+ forgeRefused: "vinaya.forge.refused",
71
+ forgeWritten: "vinaya.forge.written",
72
+ actionVerified: "vinaya.action.verified",
73
+ commandCompleted: "vinaya.command.completed",
74
+ changeSaved: "vinaya.change.saved",
75
+ changePushed: "vinaya.change.pushed",
76
+ changeOpened: "vinaya.change.opened",
77
+ changeConflicted: "vinaya.change.conflicted",
78
+ changeRecovered: "vinaya.change.recovered",
79
+ changeMerged: "vinaya.change.merged",
80
+ changeReverted: "vinaya.change.reverted",
81
+ changeIncident: "vinaya.change.incident",
82
+ changeClosed: "vinaya.change.closed"
83
+ };
84
+ ATTRIBUTE_NAMES = {
85
+ operationName: "gen_ai.operation.name",
86
+ agentName: "gen_ai.agent.name",
87
+ agentId: "gen_ai.agent.id",
88
+ providerName: "gen_ai.provider.name",
89
+ requestModel: "gen_ai.request.model",
90
+ responseModel: "gen_ai.response.model",
91
+ toolName: "gen_ai.tool.name",
92
+ toolCallId: "gen_ai.tool.call.id",
93
+ usageInputTokens: "gen_ai.usage.input_tokens",
94
+ usageSpanStart: "vinaya.usage.span_start",
95
+ usageOutputTokens: "gen_ai.usage.output_tokens",
96
+ usageCacheReadInputTokens: "gen_ai.usage.cache_read.input_tokens",
97
+ errorType: "error.type",
98
+ serviceName: "service.name",
99
+ serviceVersion: "service.version",
100
+ hostId: "host.id",
101
+ repository: "vinaya.repository",
102
+ sdkVersion: "vinaya.sdk.version",
103
+ semconvVersion: "vinaya.semconv.version",
104
+ osType: "os.type",
105
+ ci: "vinaya.ci",
106
+ runnerName: "vinaya.runner.name",
107
+ runnerVersion: "vinaya.runner.version",
108
+ cliVersion: "vinaya.cli.version",
109
+ flowId: "vinaya.flow.id",
110
+ flowVersion: "vinaya.flow.version",
111
+ processDigest: "vinaya.process.digest",
112
+ settingsDigest: "vinaya.settings.digest",
113
+ seq: "vinaya.seq",
114
+ spanKey: "vinaya.span.key",
115
+ parentSpanId: "vinaya.span.parent_id",
116
+ writerId: "vinaya.writer.id",
117
+ provenance: "vinaya.provenance",
118
+ trust: "vinaya.trust",
119
+ eventId: "vinaya.event.id",
120
+ workRef: "vinaya.work.ref",
121
+ workTitle: "vinaya.work.title",
122
+ workChange: "vinaya.work.change",
123
+ workCommit: "vinaya.work.commit",
124
+ round: "vinaya.round",
125
+ seat: "vinaya.seat",
126
+ inputBrief: "vinaya.input.brief",
127
+ inputObjectives: "vinaya.input.objectives",
128
+ inputRuling: "vinaya.input.ruling",
129
+ inputPolicy: "vinaya.input.policy",
130
+ runId: "vinaya.run.id",
131
+ processName: "vinaya.process.name",
132
+ processVersion: "vinaya.process.version",
133
+ roundLimit: "vinaya.run.round_limit",
134
+ runSeats: "vinaya.run.seats",
135
+ runSeatModels: "vinaya.run.seat_models",
136
+ runRounds: "vinaya.run.rounds",
137
+ runTotalMs: "vinaya.run.total_ms",
138
+ runTimeToGreenMs: "vinaya.run.time_to_green_ms",
139
+ runFilesChanged: "vinaya.run.files_changed",
140
+ runOutcome: "vinaya.run.outcome",
141
+ stageFrom: "vinaya.stage.from",
142
+ stageTo: "vinaya.stage.to",
143
+ pauseWhy: "vinaya.pause.why",
144
+ pauseBy: "vinaya.pause.by",
145
+ actor: "vinaya.actor",
146
+ retryFailed: "vinaya.retry.failed",
147
+ retryTries: "vinaya.retry.tries",
148
+ retryRecovered: "vinaya.retry.recovered",
149
+ rule: "vinaya.rule",
150
+ exitCode: "vinaya.exit.code",
151
+ exitKind: "vinaya.exit.kind",
152
+ roundNumber: "vinaya.round.number",
153
+ roundStartCommit: "vinaya.round.start_commit",
154
+ roundFilesChanged: "vinaya.round.files_changed",
155
+ roundLinesAdded: "vinaya.round.lines_added",
156
+ roundLinesRemoved: "vinaya.round.lines_removed",
157
+ roundOutcome: "vinaya.round.outcome",
158
+ phaseName: "vinaya.phase.name",
159
+ phaseStep: "vinaya.phase.step",
160
+ codingAgent: "vinaya.agent.coding_agent",
161
+ codingAgentVersion: "vinaya.agent.coding_agent_version",
162
+ agentEffort: "vinaya.agent.effort",
163
+ agentOutcome: "vinaya.agent.outcome",
164
+ agentResetAt: "vinaya.agent.reset_at",
165
+ attempt: "vinaya.attempt",
166
+ stepKind: "vinaya.step.kind",
167
+ stepTarget: "vinaya.step.target",
168
+ stepErrorLine: "vinaya.step.error_line",
169
+ confidence: "vinaya.confidence",
170
+ confidenceReason: "vinaya.confidence.reason",
171
+ confidenceAfterExtraTurn: "vinaya.confidence.after_extra_turn",
172
+ usageCost: "vinaya.usage.cost",
173
+ usageCostKind: "vinaya.usage.cost_kind",
174
+ usageUnknownReason: "vinaya.usage.unknown_reason",
175
+ usageCostUnknownReason: "vinaya.usage.cost_unknown_reason",
176
+ seats: "vinaya.review.seats",
177
+ verdicts: "vinaya.review.verdicts",
178
+ blockingCount: "vinaya.review.blocking_count",
179
+ findingIds: "vinaya.review.finding_ids",
180
+ findingSeverities: "vinaya.review.finding_severities",
181
+ findingPlaces: "vinaya.review.finding_places",
182
+ findingBlocking: "vinaya.review.finding_blocking",
183
+ findingsOpen: "vinaya.review.open",
184
+ findingsResolved: "vinaya.review.resolved",
185
+ findingsNew: "vinaya.review.new",
186
+ findingsRecurring: "vinaya.review.recurring",
187
+ checkWhere: "vinaya.checks.where",
188
+ checksRan: "vinaya.checks.ran",
189
+ checksPassed: "vinaya.checks.passed",
190
+ checksFailed: "vinaya.checks.failed",
191
+ checksSkipped: "vinaya.checks.skipped",
192
+ failedNames: "vinaya.checks.failed_names",
193
+ waitMs: "vinaya.checks.wait_ms",
194
+ checkName: "vinaya.checks.name",
195
+ checkVersion: "vinaya.checks.version",
196
+ checksGreen: "vinaya.checks.green",
197
+ rerunFailed: "vinaya.checks.rerun_failed",
198
+ rerunAffected: "vinaya.checks.rerun_affected",
199
+ rerunTotal: "vinaya.checks.rerun_total",
200
+ result: "vinaya.result",
201
+ reason: "vinaya.reason",
202
+ change: "vinaya.change.id",
203
+ branch: "vinaya.change.branch",
204
+ commit: "vinaya.change.commit",
205
+ changeTestsPicked: "vinaya.change.tests_picked",
206
+ changeTestsFailed: "vinaya.change.tests_failed",
207
+ changePushMs: "vinaya.change.push_ms",
208
+ changeReentry: "vinaya.change.reentry",
209
+ changeLink: "vinaya.change.link",
210
+ severity: "vinaya.severity",
211
+ questionKind: "vinaya.person.kind",
212
+ questionKey: "vinaya.person.key",
213
+ personWhy: "vinaya.person.why",
214
+ personDecision: "vinaya.person.decision",
215
+ personHowToAnswer: "vinaya.person.how_to_answer",
216
+ personAnswer: "vinaya.person.answer",
217
+ answeredBy: "vinaya.person.answered_by",
218
+ target: "vinaya.outside.target",
219
+ action: "vinaya.outside.action"
220
+ };
221
+ FORBIDDEN_CONTENT_ATTRIBUTES = [
222
+ "gen_ai.input.messages",
223
+ "gen_ai.output.messages",
224
+ "gen_ai.system_instructions",
225
+ "gen_ai.tool.call.arguments",
226
+ "gen_ai.tool.call.result",
227
+ "gen_ai.tool.definitions"
228
+ ];
229
+ ALL_SPAN_NAMES = Object.values(SPAN_NAMES);
230
+ ALL_EVENT_NAMES = Object.values(EVENT_NAMES);
231
+ ALL_ATTRIBUTE_NAMES = Object.values(ATTRIBUTE_NAMES);
232
+ });
233
+
234
+ // ../../packages/log-sdk/src/contract/check.ts
235
+ var attributeNames, eventNames;
236
+ var init_check = __esm(() => {
237
+ init_catalogue();
238
+ attributeNames = new Set(ALL_ATTRIBUTE_NAMES);
239
+ eventNames = new Set(ALL_EVENT_NAMES);
240
+ });
241
+
242
+ // ../../packages/log-sdk/package.json
243
+ var package_default;
244
+ var init_package = __esm(() => {
245
+ package_default = {
246
+ name: "@attalabs/vinaya-log-sdk",
247
+ version: "0.47.0",
248
+ description: "Record, send, read and narrate workflow events with OpenTelemetry from Node.js or the command line.",
249
+ type: "module",
250
+ license: "FSL-1.1-ALv2",
251
+ author: "Daniel Estevez",
252
+ exports: {
253
+ ".": {
254
+ source: "./src/index.ts",
255
+ bun: "./src/index.ts",
256
+ types: "./dist/index.d.ts",
257
+ import: "./dist/index.js",
258
+ default: "./dist/index.js"
259
+ },
260
+ "./contract": {
261
+ source: "./src/contract-entry.ts",
262
+ bun: "./src/contract-entry.ts",
263
+ workerd: "./src/contract-entry.ts",
264
+ types: "./dist/contract-entry.d.ts",
265
+ import: "./dist/contract-entry.js",
266
+ default: "./dist/contract-entry.js"
267
+ },
268
+ "./package.json": "./package.json"
269
+ },
270
+ types: "./dist/index.d.ts",
271
+ bin: {
272
+ "vinaya-log": "dist/bin/vinaya-log.js"
273
+ },
274
+ files: [
275
+ "dist",
276
+ "src",
277
+ "README.md",
278
+ "LICENSE"
279
+ ],
280
+ publishConfig: {
281
+ access: "public"
282
+ },
283
+ repository: {
284
+ type: "git",
285
+ url: "git+https://github.com/atta-labs/vinaya.git",
286
+ directory: "packages/log-sdk"
287
+ },
288
+ keywords: [
289
+ "vinaya",
290
+ "opentelemetry",
291
+ "otlp",
292
+ "logging",
293
+ "workflow"
294
+ ],
295
+ engines: {
296
+ node: ">=22.13"
297
+ },
298
+ scripts: {
299
+ build: `node -e "require('node:fs').rmSync('dist', { recursive: true, force: true })" && tsc -p tsconfig.build.json`,
300
+ typecheck: "tsc --noEmit",
301
+ test: "bun test --timeout=600000"
302
+ },
303
+ dependencies: {
304
+ "@opentelemetry/api": "~1.9.1",
305
+ "@opentelemetry/api-logs": "0.223.2",
306
+ "@opentelemetry/otlp-transformer": "0.223.2",
307
+ "@opentelemetry/resources": "2.12.1",
308
+ "@opentelemetry/sdk-logs": "0.223.2",
309
+ "@opentelemetry/sdk-trace-base": "2.12.1",
310
+ zod: "3.25.76"
311
+ },
312
+ devDependencies: {
313
+ "@types/bun": "^1.4.4",
314
+ "@types/node": "^26.0.0",
315
+ typescript: "^5.7.0"
316
+ }
317
+ };
318
+ });
319
+
320
+ // ../../packages/log-sdk/src/contract/version.ts
321
+ var SDK_VERSION;
322
+ var init_version = __esm(() => {
323
+ init_package();
324
+ SDK_VERSION = package_default.version;
325
+ });
326
+
327
+ // ../../packages/log-sdk/src/contract/ids.ts
328
+ var init_ids = () => {};
329
+
37
330
  // ../../node_modules/zod/v3/helpers/util.js
38
331
  var util, objectUtil, ZodParsedType, getParsedType = (data) => {
39
332
  const t = typeof data;
@@ -3843,7 +4136,7 @@ var init_zod = __esm(() => {
3843
4136
  init_external();
3844
4137
  });
3845
4138
 
3846
- // ../../harness/kernel/log/custom.ts
4139
+ // ../../packages/log-sdk/src/contract/custom.ts
3847
4140
  var CUSTOM_EVENT_NAME_PATTERN, CUSTOM_EVENT_NAME_MAX_LENGTH = 64, CUSTOM_EVENT_RESERVED_NAMESPACE = "vinaya", CUSTOM_EVENT_MAX_FIELDS = 20, CUSTOM_FIELD_NAME_PATTERN, CUSTOM_FIELD_NAME_MAX_LENGTH = 64, CUSTOM_TEXT_MAX_LENGTH = 500, CUSTOM_WORD_PATTERN, CUSTOM_WORD_MAX_LENGTH = 64, CUSTOM_FIELD_MAX_WORDS = 50, CustomFieldTypeSchema, CustomEventDeclarationsSchema;
3848
4141
  var init_custom = __esm(() => {
3849
4142
  init_zod();
@@ -3897,8 +4190,7 @@ var init_custom = __esm(() => {
3897
4190
  }
3898
4191
  });
3899
4192
  });
3900
-
3901
- // ../../harness/kernel/log/schema.ts
4193
+ // ../../packages/log-sdk/src/contract/schema.ts
3902
4194
  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;
3903
4195
  var init_schema = __esm(() => {
3904
4196
  init_zod();
@@ -4486,13 +4778,321 @@ var init_schema = __esm(() => {
4486
4778
  ]);
4487
4779
  });
4488
4780
 
4489
- // ../../harness/kernel/log/redact.ts
4490
- var init_redact = () => {};
4491
-
4492
- // ../../harness/kernel/log/store.ts
4781
+ // ../../packages/log-sdk/src/contract/store.ts
4493
4782
  var init_store = __esm(() => {
4494
- init_redact();
4495
4783
  init_schema();
4784
+ init_check();
4785
+ init_ids();
4786
+ });
4787
+
4788
+ // ../../packages/log-sdk/src/contract/convert-map.ts
4789
+ var people;
4790
+ var init_convert_map = __esm(() => {
4791
+ init_catalogue();
4792
+ init_ids();
4793
+ init_custom();
4794
+ init_store();
4795
+ people = new Set(["authority", "strategy", "product"]);
4796
+ });
4797
+
4798
+ // ../../packages/log-sdk/src/contract/convert-live.ts
4799
+ var init_convert_live = __esm(() => {
4800
+ init_catalogue();
4801
+ init_version();
4802
+ init_convert_map();
4803
+ init_ids();
4804
+ init_store();
4805
+ });
4806
+
4807
+ // ../../packages/log-sdk/src/contract/convert.ts
4808
+ var init_convert = __esm(() => {
4809
+ init_version();
4810
+ init_convert_live();
4811
+ });
4812
+
4813
+ // ../../packages/log-sdk/src/narration/wording.ts
4814
+ var init_wording = () => {};
4815
+
4816
+ // ../../packages/log-sdk/src/narration/narrate.ts
4817
+ var init_narrate = __esm(() => {
4818
+ init_catalogue();
4819
+ init_wording();
4820
+ });
4821
+
4822
+ // ../../packages/log-sdk/src/reader/records.ts
4823
+ var STARTED_EVENT_NAMES;
4824
+ var init_records = __esm(() => {
4825
+ init_catalogue();
4826
+ STARTED_EVENT_NAMES = new Set([
4827
+ EVENT_NAMES.runStarted,
4828
+ EVENT_NAMES.roundStarted,
4829
+ EVENT_NAMES.agentStarted,
4830
+ EVENT_NAMES.stepStarted,
4831
+ EVENT_NAMES.pauseStarted,
4832
+ EVENT_NAMES.personAsked
4833
+ ]);
4834
+ });
4835
+
4836
+ // ../../packages/log-sdk/src/reader/lines.ts
4837
+ var init_lines = __esm(() => {
4838
+ init_convert_live();
4839
+ init_store();
4840
+ init_records();
4841
+ });
4842
+
4843
+ // ../../packages/log-sdk/src/reader/folder-source.ts
4844
+ var init_folder_source = __esm(() => {
4845
+ init_lines();
4846
+ });
4847
+
4848
+ // ../../packages/log-sdk/src/reader/otlp-source.ts
4849
+ var init_otlp_source = __esm(() => {
4850
+ init_lines();
4851
+ });
4852
+
4853
+ // ../../packages/log-sdk/src/reader/order.ts
4854
+ var init_order = __esm(() => {
4855
+ init_catalogue();
4856
+ init_records();
4857
+ });
4858
+
4859
+ // ../../packages/log-sdk/src/reader/trust.ts
4860
+ var FORBIDDEN;
4861
+ var init_trust = __esm(() => {
4862
+ init_catalogue();
4863
+ FORBIDDEN = new Set(FORBIDDEN_CONTENT_ATTRIBUTES);
4864
+ });
4865
+
4866
+ // ../../packages/log-sdk/src/reader/source.ts
4867
+ var init_source = __esm(() => {
4868
+ init_check();
4869
+ init_order();
4870
+ init_trust();
4871
+ });
4872
+
4873
+ // ../../packages/log-sdk/src/writer/settings.ts
4874
+ import { isAbsolute, join } from "node:path";
4875
+ var absolutePath = (label) => stringType().min(1).refine((v) => isAbsolute(v), { message: `${label}: must be an absolute path` }), keepDaysSchema, logsObject, logsSchema, runtimeDirSchema, logConfigSchema;
4876
+ var init_settings = __esm(() => {
4877
+ init_zod();
4878
+ init_custom();
4879
+ keepDaysSchema = numberType({ invalid_type_error: "must be a whole number of days" }).int({ message: "must be a whole number of days" }).min(1, { message: "must be at least 1" });
4880
+ logsObject = objectType({
4881
+ folder: absolutePath("logs.folder").optional(),
4882
+ url: stringType().url().optional(),
4883
+ otlp: objectType({
4884
+ url: stringType().url().regex(/^https?:\/\//i),
4885
+ headers: recordType(stringType()).optional()
4886
+ }).strict().optional(),
4887
+ headers: recordType(stringType()).optional(),
4888
+ readHeaders: recordType(stringType()).optional(),
4889
+ keepDays: keepDaysSchema.optional(),
4890
+ events: unknownType().optional()
4891
+ }).strict().refine((v) => [v.folder, v.url].filter((x) => x !== undefined).length <= 1, {
4892
+ message: "logs: set at most one of folder/url"
4893
+ }).refine((v) => v.headers === undefined || v.url !== undefined, { message: "logs: headers requires url" }).refine((v) => v.readHeaders === undefined || v.url !== undefined, { message: "logs: readHeaders requires url" });
4894
+ logsSchema = logsObject.or(literalType(false));
4895
+ runtimeDirSchema = absolutePath("runtimeDir");
4896
+ logConfigSchema = objectType({ logs: logsSchema.optional(), runtimeDir: runtimeDirSchema.optional() }).strict();
4897
+ });
4898
+
4899
+ // ../../packages/log-sdk/src/sender/send.ts
4900
+ var retryableClientStatuses;
4901
+ var init_send = __esm(() => {
4902
+ init_check();
4903
+ init_settings();
4904
+ retryableClientStatuses = new Set([401, 403, 404, 408, 429]);
4905
+ });
4906
+
4907
+ // ../../packages/log-sdk/src/local-copy/file-exporters.ts
4908
+ import {
4909
+ closeSync,
4910
+ constants,
4911
+ fstatSync,
4912
+ lstatSync,
4913
+ mkdirSync,
4914
+ openSync,
4915
+ readdirSync,
4916
+ readFileSync,
4917
+ realpathSync,
4918
+ unlinkSync,
4919
+ writeSync
4920
+ } from "node:fs";
4921
+ var MAX_BYTES, APPEND_FLAGS, DAY_MS, cleaned;
4922
+ var init_file_exporters = __esm(() => {
4923
+ init_send();
4924
+ init_settings();
4925
+ MAX_BYTES = 8 * 1024 * 1024;
4926
+ APPEND_FLAGS = constants.O_WRONLY | constants.O_APPEND | constants.O_NOFOLLOW | constants.O_NONBLOCK;
4927
+ DAY_MS = 24 * 60 * 60 * 1000;
4928
+ cleaned = new Set;
4929
+ });
4930
+
4931
+ // ../../packages/log-sdk/src/writer/attributes.ts
4932
+ var init_attributes = __esm(() => {
4933
+ init_catalogue();
4934
+ init_custom();
4935
+ init_ids();
4936
+ });
4937
+
4938
+ // ../../packages/log-sdk/src/writer/agent.ts
4939
+ var init_agent = __esm(() => {
4940
+ init_catalogue();
4941
+ init_attributes();
4942
+ });
4943
+
4944
+ // ../../packages/log-sdk/src/reader/span-start.ts
4945
+ var init_span_start = __esm(() => {
4946
+ init_catalogue();
4947
+ });
4948
+
4949
+ // ../../packages/log-sdk/src/writer/whole-span.ts
4950
+ var init_whole_span = __esm(() => {
4951
+ init_catalogue();
4952
+ init_attributes();
4953
+ });
4954
+
4955
+ // ../../packages/log-sdk/src/writer/carried.ts
4956
+ var init_carried = __esm(() => {
4957
+ init_catalogue();
4958
+ init_ids();
4959
+ init_lines();
4960
+ init_span_start();
4961
+ init_whole_span();
4962
+ });
4963
+
4964
+ // ../../packages/log-sdk/src/writer/change.ts
4965
+ var init_change = __esm(() => {
4966
+ init_catalogue();
4967
+ init_ids();
4968
+ init_attributes();
4969
+ });
4970
+
4971
+ // ../../packages/log-sdk/src/writer/checks.ts
4972
+ var init_checks = __esm(() => {
4973
+ init_catalogue();
4974
+ init_attributes();
4975
+ });
4976
+
4977
+ // ../../packages/log-sdk/src/writer/outside.ts
4978
+ var init_outside = __esm(() => {
4979
+ init_catalogue();
4980
+ init_attributes();
4981
+ });
4982
+
4983
+ // ../../packages/log-sdk/src/writer/custom.ts
4984
+ var init_custom2 = __esm(() => {
4985
+ init_custom();
4986
+ init_attributes();
4987
+ init_outside();
4988
+ });
4989
+
4990
+ // ../../packages/log-sdk/src/writer/person.ts
4991
+ var asks;
4992
+ var init_person = __esm(() => {
4993
+ init_catalogue();
4994
+ init_custom();
4995
+ init_ids();
4996
+ init_span_start();
4997
+ init_attributes();
4998
+ init_carried();
4999
+ init_whole_span();
5000
+ asks = new WeakMap;
5001
+ });
5002
+
5003
+ // ../../packages/log-sdk/src/writer/review.ts
5004
+ var init_review = __esm(() => {
5005
+ init_catalogue();
5006
+ init_attributes();
5007
+ });
5008
+
5009
+ // ../../packages/log-sdk/src/writer/round.ts
5010
+ var init_round = __esm(() => {
5011
+ init_catalogue();
5012
+ init_attributes();
5013
+ init_carried();
5014
+ });
5015
+
5016
+ // ../../packages/log-sdk/src/writer/run.ts
5017
+ var HEARTBEAT_MS;
5018
+ var init_run = __esm(() => {
5019
+ init_catalogue();
5020
+ init_ids();
5021
+ init_attributes();
5022
+ init_carried();
5023
+ init_whole_span();
5024
+ HEARTBEAT_MS = 2 * 60 * 1000;
5025
+ });
5026
+
5027
+ // ../../packages/log-sdk/src/writer/connect.ts
5028
+ var init_connect = __esm(() => {
5029
+ init_catalogue();
5030
+ init_version();
5031
+ init_ids();
5032
+ init_file_exporters();
5033
+ init_agent();
5034
+ init_attributes();
5035
+ init_carried();
5036
+ init_change();
5037
+ init_checks();
5038
+ init_custom2();
5039
+ init_outside();
5040
+ init_person();
5041
+ init_review();
5042
+ init_round();
5043
+ init_run();
5044
+ init_settings();
5045
+ init_whole_span();
5046
+ });
5047
+
5048
+ // ../../packages/log-sdk/src/bin/args.ts
5049
+ var EMIT_USAGE;
5050
+ var init_args = __esm(() => {
5051
+ EMIT_USAGE = `Usage: vinaya-log-emit <event> --json '<json object>' (or pipe the JSON object on standard input)
5052
+ ` + `Use vinaya-log emit <event> --run <id> --json '<json object>' to record from any loop without Vinaya.
5053
+ `;
5054
+ });
5055
+
5056
+ // ../../packages/log-sdk/src/index.ts
5057
+ var init_src = __esm(() => {
5058
+ init_check();
5059
+ init_convert();
5060
+ init_convert_live();
5061
+ init_convert_map();
5062
+ init_narrate();
5063
+ init_wording();
5064
+ init_folder_source();
5065
+ init_lines();
5066
+ init_otlp_source();
5067
+ init_order();
5068
+ init_records();
5069
+ init_source();
5070
+ init_trust();
5071
+ init_send();
5072
+ init_connect();
5073
+ init_args();
5074
+ init_settings();
5075
+ init_whole_span();
5076
+ init_catalogue();
5077
+ init_custom();
5078
+ init_ids();
5079
+ init_schema();
5080
+ init_store();
5081
+ });
5082
+
5083
+ // ../../harness/kernel/log/schema.ts
5084
+ var init_schema2 = __esm(() => {
5085
+ init_src();
5086
+ });
5087
+
5088
+ // ../../harness/kernel/log/store.ts
5089
+ var init_store2 = __esm(() => {
5090
+ init_src();
5091
+ });
5092
+
5093
+ // ../../harness/kernel/log/redact.ts
5094
+ var init_redact = __esm(() => {
5095
+ init_src();
4496
5096
  });
4497
5097
 
4498
5098
  // ../../harness/kernel/log/deferred-sink-factory.ts
@@ -4501,60 +5101,9 @@ function loadDeferredLogSinkFactory() {
4501
5101
  }
4502
5102
  var deferred;
4503
5103
 
4504
- // ../../harness/kernel/config/loader/config-provider.ts
4505
- function configProvider() {
4506
- if (!installed)
4507
- throw new Error(NO_CONFIG_PROVIDER_MESSAGE);
4508
- return installed;
4509
- }
4510
- var installed = null, NO_CONFIG_PROVIDER_MESSAGE = "no configuration provider is installed — a composition root must call installConfigProvider() before any configuration read";
4511
-
4512
- // ../../harness/kernel/config/schema/config-schema.ts
4513
- function isSafeRepoRelPath(p) {
4514
- if (p.length === 0)
4515
- return false;
4516
- if (p.startsWith("/") || /^[a-zA-Z]:[\\/]/.test(p))
4517
- return false;
4518
- return p.split(/[\\/]/).every((seg) => seg !== ".." && seg !== "");
4519
- }
4520
- function resolveLogsHeaderValues(headers, env) {
4521
- if (!headers)
4522
- return;
4523
- const resolved = {};
4524
- for (const [key, value] of Object.entries(headers)) {
4525
- resolved[key] = value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_match, name) => env[name] ?? "");
4526
- }
4527
- return resolved;
4528
- }
4529
- var EnvEntrySchema, KERNEL_CHECK_ENTRY_FIELDS, SafeRepoRelPath;
4530
- var init_config_schema = __esm(() => {
4531
- init_zod();
4532
- EnvEntrySchema = unionType([
4533
- literalType(true),
4534
- objectType({ optional: literalType(true) }),
4535
- objectType({ anyOf: arrayType(stringType()).min(2) }),
4536
- stringType()
4537
- ]);
4538
- KERNEL_CHECK_ENTRY_FIELDS = {
4539
- run: stringType(),
4540
- scope: enumType(["diff", "full"]),
4541
- include: arrayType(stringType()).optional(),
4542
- args: arrayType(stringType()).optional(),
4543
- timeoutMs: numberType().optional(),
4544
- env: recordType(stringType(), EnvEntrySchema).optional(),
4545
- requiresOpenPr: booleanType().optional(),
4546
- ownWorkflow: booleanType().optional(),
4547
- validates: enumType(["body", "issue"]).optional(),
4548
- advisory: literalType(true).optional()
4549
- };
4550
- SafeRepoRelPath = stringType().refine(isSafeRepoRelPath, {
4551
- message: "must be a repo-root-relative path with no `..` segment or absolute root"
4552
- });
4553
- });
4554
-
4555
5104
  // ../../harness/kernel/connectors/checkpoint/control-store/records.ts
4556
5105
  var isoTimestamp, taskId, epochNumber, RunRecordSchema, InputRecordSchema, OwnershipRecordSchema, TransitionRecordSchema, ManifestRecordSchema, roundHeadIdentity, LoopBudgetsSchema, LoopStateRecordSchema, EffectRecordSchema, EscalationRecordSchema, ResolutionRecordSchema, ExecutionRoundMirrorRecordSchema;
4557
- var init_records = __esm(() => {
5106
+ var init_records2 = __esm(() => {
4558
5107
  init_zod();
4559
5108
  isoTimestamp = stringType().min(1);
4560
5109
  taskId = numberType().int().positive();
@@ -4714,7 +5263,7 @@ var init_records = __esm(() => {
4714
5263
 
4715
5264
  // ../../harness/kernel/connectors/checkpoint/control-store/local.ts
4716
5265
  var init_local = __esm(() => {
4717
- init_records();
5266
+ init_records2();
4718
5267
  });
4719
5268
 
4720
5269
  // ../../harness/kernel/connectors/checkpoint/control-store/migration.ts
@@ -4723,49 +5272,112 @@ var init_migration = __esm(() => {
4723
5272
  });
4724
5273
  // ../../harness/kernel/connectors/checkpoint/control-store/index.ts
4725
5274
  var init_control_store = __esm(() => {
4726
- init_records();
5275
+ init_records2();
4727
5276
  init_local();
4728
5277
  init_migration();
4729
5278
  });
4730
5279
 
5280
+ // ../../harness/kernel/config/loader/config-provider.ts
5281
+ function configProvider() {
5282
+ if (!installed)
5283
+ throw new Error(NO_CONFIG_PROVIDER_MESSAGE);
5284
+ return installed;
5285
+ }
5286
+ var installed = null, NO_CONFIG_PROVIDER_MESSAGE = "no configuration provider is installed — a composition root must call installConfigProvider() before any configuration read";
5287
+
5288
+ // ../../harness/kernel/config/schema/config-schema.ts
5289
+ function isSafeRepoRelPath(p) {
5290
+ if (p.length === 0)
5291
+ return false;
5292
+ if (p.startsWith("/") || /^[a-zA-Z]:[\\/]/.test(p))
5293
+ return false;
5294
+ return p.split(/[\\/]/).every((seg) => seg !== ".." && seg !== "");
5295
+ }
5296
+ function resolveLogsHeaderValues(headers, env) {
5297
+ if (!headers)
5298
+ return;
5299
+ const resolved = {};
5300
+ for (const [key, value] of Object.entries(headers)) {
5301
+ resolved[key] = value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_match, name) => env[name] ?? "");
5302
+ }
5303
+ return resolved;
5304
+ }
5305
+ var EnvEntrySchema, KERNEL_CHECK_ENTRY_FIELDS, SafeRepoRelPath;
5306
+ var init_config_schema = __esm(() => {
5307
+ init_zod();
5308
+ EnvEntrySchema = unionType([
5309
+ literalType(true),
5310
+ objectType({ optional: literalType(true) }),
5311
+ objectType({ anyOf: arrayType(stringType()).min(2) }),
5312
+ stringType()
5313
+ ]);
5314
+ KERNEL_CHECK_ENTRY_FIELDS = {
5315
+ run: stringType(),
5316
+ scope: enumType(["diff", "full"]),
5317
+ include: arrayType(stringType()).optional(),
5318
+ args: arrayType(stringType()).optional(),
5319
+ timeoutMs: numberType().optional(),
5320
+ env: recordType(stringType(), EnvEntrySchema).optional(),
5321
+ requiresOpenPr: booleanType().optional(),
5322
+ ownWorkflow: booleanType().optional(),
5323
+ validates: enumType(["body", "issue"]).optional(),
5324
+ advisory: literalType(true).optional()
5325
+ };
5326
+ SafeRepoRelPath = stringType().refine(isSafeRepoRelPath, {
5327
+ message: "must be a repo-root-relative path with no `..` segment or absolute root"
5328
+ });
5329
+ });
5330
+
4731
5331
  // ../../harness/kernel/run-paths.ts
4732
5332
  var init_run_paths = __esm(() => {
4733
5333
  init_control_store();
4734
5334
  init_config_schema();
4735
5335
  });
4736
5336
 
5337
+ // ../../harness/kernel/log/local-copy-writer.ts
5338
+ var folderSends;
5339
+ var init_local_copy_writer = __esm(() => {
5340
+ init_src();
5341
+ init_run_paths();
5342
+ folderSends = new Map;
5343
+ });
5344
+
4737
5345
  // ../../harness/kernel/log/log-sink.ts
4738
5346
  import { execFile as execFile2 } from "node:child_process";
4739
5347
  import { randomUUID } from "node:crypto";
4740
5348
  import {
4741
5349
  appendFileSync,
4742
- closeSync,
5350
+ closeSync as closeSync2,
4743
5351
  constants as fsConstants,
4744
- fstatSync,
4745
- mkdirSync,
4746
- lstatSync,
4747
- openSync,
4748
- readFileSync,
5352
+ fstatSync as fstatSync2,
5353
+ mkdirSync as mkdirSync2,
5354
+ lstatSync as lstatSync2,
5355
+ openSync as openSync2,
5356
+ readFileSync as readFileSync2,
4749
5357
  renameSync,
4750
5358
  writeFileSync,
4751
- writeSync
5359
+ writeSync as writeSync2
4752
5360
  } from "node:fs";
4753
- import { dirname, join } from "node:path";
5361
+ import { dirname, join as join2 } from "node:path";
4754
5362
  import { promisify as promisify2 } from "node:util";
4755
5363
  function isUnattributedStreamName(name) {
4756
5364
  return /^none-[a-z0-9]+(?:-[a-z0-9]+)*$/.test(name);
4757
5365
  }
4758
5366
  function withDeadline(work, ms, fallback) {
4759
5367
  return new Promise((resolve) => {
4760
- const timer = setTimeout(() => resolve(fallback), ms);
5368
+ let graceTimer;
5369
+ const timer = setTimeout(() => {
5370
+ graceTimer = setTimeout(() => resolve(fallback), WITH_DEADLINE_GRACE_MS);
5371
+ graceTimer.unref?.();
5372
+ }, ms);
4761
5373
  timer.unref?.();
4762
- work.then((value) => {
5374
+ const settle = (answer) => {
4763
5375
  clearTimeout(timer);
4764
- resolve(value);
4765
- }, () => {
4766
- clearTimeout(timer);
4767
- resolve(fallback);
4768
- });
5376
+ if (graceTimer !== undefined)
5377
+ clearTimeout(graceTimer);
5378
+ resolve(answer);
5379
+ };
5380
+ work.then((value) => settle(value), () => settle(fallback));
4769
5381
  });
4770
5382
  }
4771
5383
  async function safeLoadTrustAnchorConfig() {
@@ -4807,7 +5419,7 @@ function outboxPathFor(deps, repo, issue, unattributedStream) {
4807
5419
  const dirName = repo ? `${repo.owner}-${repo.repo}` : "unresolved";
4808
5420
  const unattributed = unattributedStream !== undefined && isUnattributedStreamName(unattributedStream) ? unattributedStream : "none";
4809
5421
  const fileName = `${issue ?? unattributed}.ndjson`;
4810
- return join(deps.outboxRoot(), dirName, fileName);
5422
+ return join2(deps.outboxRoot(), dirName, fileName);
4811
5423
  }
4812
5424
  function createDefaultLogSinkSlot(runId) {
4813
5425
  let factory;
@@ -4831,17 +5443,19 @@ function createDefaultLogSinkSlot(runId) {
4831
5443
  runId
4832
5444
  };
4833
5445
  }
4834
- var OUTBOX_MAX_BYTES, LOG_DESTINATION_ANCHOR_DEADLINE_MS = 8000, LOG_DESTINATION_ANCHOR_RETRY_INTERVAL_MS = 30000, LOG_DESTINATION_ANCHOR_MAX_RETRIES = 5, processTrustAnchorByRepo, branchIssueByCwd, branchIssueSettledByCwd, headShaByCwd, headShaSettledByCwd, execFileAsync2, APPEND_OPEN_FLAGS, defaultSinkSlot;
5446
+ var OUTBOX_MAX_BYTES, LOG_DESTINATION_ANCHOR_DEADLINE_MS = 8000, WITH_DEADLINE_GRACE_MS = 100, LOG_DESTINATION_ANCHOR_RETRY_INTERVAL_MS = 30000, LOG_DESTINATION_ANCHOR_MAX_RETRIES = 5, processTrustAnchorByRepo, defaultBranchSettingsByRepo, branchIssueByCwd, branchIssueSettledByCwd, headShaByCwd, headShaSettledByCwd, execFileAsync2, APPEND_OPEN_FLAGS, defaultSinkSlot, extraDrains;
4835
5447
  var init_log_sink = __esm(() => {
4836
5448
  init_resolve_repo();
4837
5449
  init_envelope();
4838
- init_schema();
4839
- init_store();
5450
+ init_schema2();
5451
+ init_store2();
4840
5452
  init_redact();
5453
+ init_local_copy_writer();
4841
5454
  init_config_schema();
4842
5455
  init_run_paths();
4843
5456
  OUTBOX_MAX_BYTES = 8 * 1024 * 1024;
4844
5457
  processTrustAnchorByRepo = createTrustAnchorCache(safeLoadTrustAnchorConfig);
5458
+ defaultBranchSettingsByRepo = new Map;
4845
5459
  branchIssueByCwd = new Map;
4846
5460
  branchIssueSettledByCwd = new Map;
4847
5461
  headShaByCwd = new Map;
@@ -4849,6 +5463,7 @@ var init_log_sink = __esm(() => {
4849
5463
  execFileAsync2 = promisify2(execFile2);
4850
5464
  APPEND_OPEN_FLAGS = fsConstants.O_WRONLY | fsConstants.O_APPEND | fsConstants.O_CREAT | fsConstants.O_NOFOLLOW | fsConstants.O_NONBLOCK;
4851
5465
  defaultSinkSlot = createDefaultLogSinkSlot(process.env.VINAYA_RUN_ID || randomUUID());
5466
+ extraDrains = new Set;
4852
5467
  });
4853
5468
 
4854
5469
  // ../../harness/kernel/log/client/log-follow.ts
@@ -4856,8 +5471,8 @@ import { watch as watchFolder } from "node:fs";
4856
5471
 
4857
5472
  // ../../harness/kernel/log/client/log-sync-folder-source.ts
4858
5473
  import { createHash } from "node:crypto";
4859
- import { constants as fsConstants2, closeSync as closeSync2, fstatSync as fstatSync2, openSync as openSync2, readdirSync, readSync } from "node:fs";
4860
- import { dirname as dirname2, join as join2 } from "node:path";
5474
+ import { constants as fsConstants2, closeSync as closeSync3, fstatSync as fstatSync3, openSync as openSync3, readdirSync as readdirSync2, readSync } from "node:fs";
5475
+ import { dirname as dirname2, join as join3 } from "node:path";
4861
5476
 
4862
5477
  // ../../harness/kernel/log/sync/measured.ts
4863
5478
  function known(value) {
@@ -4904,17 +5519,17 @@ var READ_OPEN_FLAGS = fsConstants2.O_RDONLY | fsConstants2.O_NOFOLLOW | fsConsta
4904
5519
  function regularFileSize(path) {
4905
5520
  let fd;
4906
5521
  try {
4907
- fd = openSync2(path, READ_OPEN_FLAGS);
5522
+ fd = openSync3(path, READ_OPEN_FLAGS);
4908
5523
  } catch {
4909
5524
  return null;
4910
5525
  }
4911
5526
  try {
4912
- const stat = fstatSync2(fd);
5527
+ const stat = fstatSync3(fd);
4913
5528
  return stat.isFile() ? stat.size : null;
4914
5529
  } catch {
4915
5530
  return null;
4916
5531
  } finally {
4917
- closeSync2(fd);
5532
+ closeSync3(fd);
4918
5533
  }
4919
5534
  }
4920
5535
  function readRangeOf(path, from, to) {
@@ -4922,12 +5537,12 @@ function readRangeOf(path, from, to) {
4922
5537
  return Buffer.alloc(0);
4923
5538
  let fd;
4924
5539
  try {
4925
- fd = openSync2(path, READ_OPEN_FLAGS);
5540
+ fd = openSync3(path, READ_OPEN_FLAGS);
4926
5541
  } catch {
4927
5542
  return null;
4928
5543
  }
4929
5544
  try {
4930
- if (!fstatSync2(fd).isFile())
5545
+ if (!fstatSync3(fd).isFile())
4931
5546
  return null;
4932
5547
  const length = to - from;
4933
5548
  const buffer = Buffer.alloc(length);
@@ -4942,7 +5557,7 @@ function readRangeOf(path, from, to) {
4942
5557
  } catch {
4943
5558
  return null;
4944
5559
  } finally {
4945
- closeSync2(fd);
5560
+ closeSync3(fd);
4946
5561
  }
4947
5562
  }
4948
5563
  var NEWLINE_BYTE = 10;
@@ -4984,7 +5599,7 @@ function firstLineFingerprintOf(path) {
4984
5599
  function listLiveStreamNames(repoDir) {
4985
5600
  let entries;
4986
5601
  try {
4987
- entries = readdirSync(repoDir);
5602
+ entries = readdirSync2(repoDir);
4988
5603
  } catch {
4989
5604
  return [];
4990
5605
  }
@@ -4992,17 +5607,17 @@ function listLiveStreamNames(repoDir) {
4992
5607
  for (const entry of entries) {
4993
5608
  if (!entry.endsWith(LIVE_SUFFIX) || entry.endsWith(ROTATED_SUFFIX))
4994
5609
  continue;
4995
- if (regularFileSize(join2(repoDir, entry)) === null)
5610
+ if (regularFileSize(join3(repoDir, entry)) === null)
4996
5611
  continue;
4997
5612
  names.push(entry.slice(0, -LIVE_SUFFIX.length));
4998
5613
  }
4999
5614
  return names;
5000
5615
  }
5001
5616
  function livePathFor(repoDir, name) {
5002
- return join2(repoDir, `${name}${LIVE_SUFFIX}`);
5617
+ return join3(repoDir, `${name}${LIVE_SUFFIX}`);
5003
5618
  }
5004
5619
  function rotatedPathFor(repoDir, name) {
5005
- return join2(repoDir, `${name}${ROTATED_SUFFIX}`);
5620
+ return join3(repoDir, `${name}${ROTATED_SUFFIX}`);
5006
5621
  }
5007
5622
  function createFolderLogSource(deps) {
5008
5623
  const repoDir = repoDirFor(deps);