@attalabs/vinaya 0.44.1 → 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 (143) hide show
  1. package/README.md +6 -4
  2. package/dist/checks/bin/check-body-bare-digits.js +233 -195
  3. package/dist/checks/bin/check-branch-topology.js +70 -23
  4. package/dist/checks/bin/check-brief-shape.js +233 -195
  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 +128 -34
  8. package/dist/checks/bin/check-coherence.js +336 -245
  9. package/dist/checks/bin/check-dispatch-readiness.js +3623 -463
  10. package/dist/checks/bin/check-doc-claims.js +233 -195
  11. package/dist/checks/bin/check-doc-coverage-push.js +243 -196
  12. package/dist/checks/bin/check-doc-coverage.js +243 -196
  13. package/dist/checks/bin/check-doctrine-no-procedures.js +233 -195
  14. package/dist/checks/bin/check-doctrine-portability.js +233 -195
  15. package/dist/checks/bin/check-evidence-fresh.js +9983 -1995
  16. package/dist/checks/bin/check-exec-bits.js +3 -0
  17. package/dist/checks/bin/check-first-push-dispatch.js +301 -224
  18. package/dist/checks/bin/check-issue-milestone-attach.js +65 -10
  19. package/dist/checks/bin/check-issue-objectives-numbering.js +233 -195
  20. package/dist/checks/bin/check-issue-parts-coverage.js +65 -10
  21. package/dist/checks/bin/check-issue-surface-globs.js +1032 -236
  22. package/dist/checks/bin/check-issue-title-grammar.js +5 -1
  23. package/dist/checks/bin/check-no-disk-state.js +5 -1
  24. package/dist/checks/bin/check-pr-premise-reassert.js +10 -1
  25. package/dist/checks/bin/check-pr-report-density.js +5 -1
  26. package/dist/checks/bin/check-principal-test-plan-wait.js +253 -201
  27. package/dist/checks/bin/check-quoted-command.js +233 -195
  28. package/dist/checks/bin/check-reader-resolvable-prose.js +233 -195
  29. package/dist/checks/bin/check-registry-gates.js +131 -34
  30. package/dist/checks/bin/check-retired-vocabulary.js +233 -195
  31. package/dist/checks/bin/check-review-gate.js +233 -195
  32. package/dist/checks/bin/check-single-plan-pr.js +5 -1
  33. package/dist/checks/bin/check-surface-scope.js +107 -32
  34. package/dist/checks/bin/check-test-plan.js +253 -201
  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 +16617 -7187
  42. package/dist/lib/pre-push-cache-test-run.js +4487 -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 +15612 -7634
  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 +9476 -1820
  60. package/dist/programs/pr-snapshot.js +8916 -1515
  61. package/dist/programs/pr-verify-evidence.js +9481 -1825
  62. package/dist/programs/pr.js +11709 -4033
  63. package/dist/programs/review-post.js +11140 -3496
  64. package/dist/programs/review-status.js +8996 -1533
  65. package/dist/programs/run-engine.js +22031 -18759
  66. package/dist/programs/sync.js +9030 -1629
  67. package/dist/programs/task-brief.js +10185 -1821
  68. package/dist/programs/task-sweep.js +9266 -1621
  69. package/dist/programs/task-tools-serve.js +77118 -16678
  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 +3 -3
  75. package/dist/types/harness/processes/vinaya-strict/tools/task-contract/objectives.d.ts +5 -6
  76. package/dist/vinaya-strict/checks/registry.ts +2 -2
  77. package/dist/vinaya-strict/executing/developer/developer-doctrine-shape.test.ts +8 -0
  78. package/dist/vinaya-strict/executing/developer/developer-turn-result.ts +1 -1
  79. package/dist/vinaya-strict/executing/developer/evals/developer-capability-suite.test.ts +2 -2
  80. package/dist/vinaya-strict/executing/developer/evals/developer-capability-suite.ts +30 -20
  81. package/dist/vinaya-strict/executing/developer/reference.md +5 -3
  82. package/dist/vinaya-strict/integration/config/vinaya-config-section.ts +29 -7
  83. package/dist/vinaya-strict/integration/policies/vinaya-policies.ts +4 -4
  84. package/dist/vinaya-strict/integration/process/process-integration.ts +5 -1
  85. package/dist/vinaya-strict/process.yaml +6 -1
  86. package/dist/vinaya-strict/thinking/plan-reviewer/doctrine.md +68 -0
  87. package/dist/vinaya-strict/thinking/plan-reviewer/grants.yaml +19 -0
  88. package/dist/vinaya-strict/thinking/plan-reviewer/output.schema.json +388 -0
  89. package/dist/vinaya-strict/thinking/planner/doctrine.md +4 -1
  90. package/dist/vinaya-strict/thinking/planner/tools/amend-rationale-deps.test.ts +10 -2
  91. package/dist/vinaya-strict/thinking/planner/tools/amend-rationale-deps.ts +5 -1
  92. package/dist/vinaya-strict/thinking/planner/tools/open-issue.test.ts +198 -34
  93. package/dist/vinaya-strict/thinking/planner/tools/open-issue.ts +120 -193
  94. package/dist/vinaya-strict/thinking/planner/tools/planner-operations.test.ts +629 -15
  95. package/dist/vinaya-strict/thinking/planner/tools/planner-operations.ts +726 -62
  96. package/dist/vinaya-strict/thinking/planner/tools/planner-tools.test.ts +505 -5
  97. package/dist/vinaya-strict/thinking/planner/tools/planner-tools.ts +636 -21
  98. package/package.json +3 -2
  99. package/studio-standalone/apps/vinaya-studio/.next/BUILD_ID +1 -1
  100. package/studio-standalone/apps/vinaya-studio/.next/build-manifest.json +2 -2
  101. package/studio-standalone/apps/vinaya-studio/.next/prerender-manifest.json +3 -3
  102. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  103. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.html +1 -1
  104. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.rsc +1 -1
  105. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  106. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  107. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  108. package/studio-standalone/apps/vinaya-studio/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  109. package/studio-standalone/apps/vinaya-studio/.next/server/app/milestones/page_client-reference-manifest.js +1 -1
  110. package/studio-standalone/apps/vinaya-studio/.next/server/app/page_client-reference-manifest.js +1 -1
  111. package/studio-standalone/apps/vinaya-studio/.next/server/app/tasks/page_client-reference-manifest.js +1 -1
  112. package/studio-standalone/apps/vinaya-studio/.next/server/chunks/209.js +2 -2
  113. package/studio-standalone/apps/vinaya-studio/.next/server/chunks/951.js +1 -1
  114. package/studio-standalone/apps/vinaya-studio/.next/server/middleware-build-manifest.js +1 -1
  115. package/studio-standalone/apps/vinaya-studio/.next/server/pages/500.html +1 -1
  116. package/studio-standalone/apps/vinaya-studio/.next/server/preview-props.json +3 -3
  117. package/studio-standalone/apps/vinaya-studio/.next/server/server-reference-manifest.json +1 -1
  118. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/151-c365f0ef8268ad13.js +1 -0
  119. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/19-aa314f13784dcc58.js +4 -0
  120. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/{layout-dfa2186095e797bd.js → layout-f038e8deecb2bf5f.js} +1 -1
  121. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/milestones/{page-2fffb49104860a15.js → page-12314f4deb06a414.js} +1 -1
  122. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/{page-6ae258f663623b2a.js → page-7a06aa3cdd046fa8.js} +1 -1
  123. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/tasks/{page-2fffb49104860a15.js → page-12314f4deb06a414.js} +1 -1
  124. package/studio-standalone/apps/vinaya-studio/.next/static/css/8eb5ed5b65b9692e.css +1 -0
  125. package/studio-standalone/apps/vinaya-studio/log-follow.mjs +708 -93
  126. package/studio-standalone/apps/vinaya-studio/log-sync-folder-source.mjs +699 -84
  127. package/studio-standalone/apps/vinaya-studio/studio-server.mjs +4692 -3116
  128. package/vinaya-strict/artifacts/templates/brief-template.md +4 -0
  129. package/vinaya-strict/artifacts/templates/issue-rationale-template.md +7 -3
  130. package/vinaya-strict/artifacts/templates/pr-report-template.md +1 -1
  131. package/vinaya-strict/doctrine/contracts/planner-developer.md +2 -1
  132. package/vinaya-strict/doctrine/enforcement.md +4 -4
  133. package/vinaya-strict/doctrine/roles/principal.md +1 -1
  134. package/vinaya-strict/doctrine/state-machine.md +7 -2
  135. package/vinaya-strict/executing/developer/reference.md +5 -3
  136. package/vinaya-strict/thinking/plan-reviewer/doctrine.md +68 -0
  137. package/vinaya-strict/thinking/planner/doctrine.md +4 -1
  138. package/vinaya-strict/thinking/planner/reference.md +29 -8
  139. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/151-23bea4cac9687151.js +0 -1
  140. package/studio-standalone/apps/vinaya-studio/.next/static/chunks/853-1d5548ff3a55a75f.js +0 -4
  141. package/studio-standalone/apps/vinaya-studio/.next/static/css/fb16828fc3128d4c.css +0 -1
  142. /package/studio-standalone/apps/vinaya-studio/.next/static/{3URbt6IPajL5OOhijN1-x → bJrgAp9Kl4JsCUYkeAYez}/_buildManifest.js +0 -0
  143. /package/studio-standalone/apps/vinaya-studio/.next/static/{3URbt6IPajL5OOhijN1-x → 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,51 +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
- var EnvEntrySchema, KERNEL_CHECK_ENTRY_FIELDS, SafeRepoRelPath;
4521
- var init_config_schema = __esm(() => {
4522
- init_zod();
4523
- EnvEntrySchema = unionType([
4524
- literalType(true),
4525
- objectType({ optional: literalType(true) }),
4526
- objectType({ anyOf: arrayType(stringType()).min(2) }),
4527
- stringType()
4528
- ]);
4529
- KERNEL_CHECK_ENTRY_FIELDS = {
4530
- run: stringType(),
4531
- scope: enumType(["diff", "full"]),
4532
- include: arrayType(stringType()).optional(),
4533
- args: arrayType(stringType()).optional(),
4534
- timeoutMs: numberType().optional(),
4535
- env: recordType(stringType(), EnvEntrySchema).optional(),
4536
- requiresOpenPr: booleanType().optional(),
4537
- ownWorkflow: booleanType().optional(),
4538
- validates: enumType(["body", "issue"]).optional(),
4539
- advisory: literalType(true).optional()
4540
- };
4541
- SafeRepoRelPath = stringType().refine(isSafeRepoRelPath, {
4542
- message: "must be a repo-root-relative path with no `..` segment or absolute root"
4543
- });
4544
- });
4545
-
4546
5104
  // ../../harness/kernel/connectors/checkpoint/control-store/records.ts
4547
5105
  var isoTimestamp, taskId, epochNumber, RunRecordSchema, InputRecordSchema, OwnershipRecordSchema, TransitionRecordSchema, ManifestRecordSchema, roundHeadIdentity, LoopBudgetsSchema, LoopStateRecordSchema, EffectRecordSchema, EscalationRecordSchema, ResolutionRecordSchema, ExecutionRoundMirrorRecordSchema;
4548
- var init_records = __esm(() => {
5106
+ var init_records2 = __esm(() => {
4549
5107
  init_zod();
4550
5108
  isoTimestamp = stringType().min(1);
4551
5109
  taskId = numberType().int().positive();
@@ -4705,7 +5263,7 @@ var init_records = __esm(() => {
4705
5263
 
4706
5264
  // ../../harness/kernel/connectors/checkpoint/control-store/local.ts
4707
5265
  var init_local = __esm(() => {
4708
- init_records();
5266
+ init_records2();
4709
5267
  });
4710
5268
 
4711
5269
  // ../../harness/kernel/connectors/checkpoint/control-store/migration.ts
@@ -4714,49 +5272,103 @@ var init_migration = __esm(() => {
4714
5272
  });
4715
5273
  // ../../harness/kernel/connectors/checkpoint/control-store/index.ts
4716
5274
  var init_control_store = __esm(() => {
4717
- init_records();
5275
+ init_records2();
4718
5276
  init_local();
4719
5277
  init_migration();
4720
5278
  });
4721
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
+ var EnvEntrySchema, KERNEL_CHECK_ENTRY_FIELDS, SafeRepoRelPath;
5297
+ var init_config_schema = __esm(() => {
5298
+ init_zod();
5299
+ EnvEntrySchema = unionType([
5300
+ literalType(true),
5301
+ objectType({ optional: literalType(true) }),
5302
+ objectType({ anyOf: arrayType(stringType()).min(2) }),
5303
+ stringType()
5304
+ ]);
5305
+ KERNEL_CHECK_ENTRY_FIELDS = {
5306
+ run: stringType(),
5307
+ scope: enumType(["diff", "full"]),
5308
+ include: arrayType(stringType()).optional(),
5309
+ args: arrayType(stringType()).optional(),
5310
+ timeoutMs: numberType().optional(),
5311
+ env: recordType(stringType(), EnvEntrySchema).optional(),
5312
+ requiresOpenPr: booleanType().optional(),
5313
+ ownWorkflow: booleanType().optional(),
5314
+ validates: enumType(["body", "issue"]).optional(),
5315
+ advisory: literalType(true).optional()
5316
+ };
5317
+ SafeRepoRelPath = stringType().refine(isSafeRepoRelPath, {
5318
+ message: "must be a repo-root-relative path with no `..` segment or absolute root"
5319
+ });
5320
+ });
5321
+
4722
5322
  // ../../harness/kernel/run-paths.ts
4723
5323
  var init_run_paths = __esm(() => {
4724
5324
  init_control_store();
4725
5325
  init_config_schema();
4726
5326
  });
4727
5327
 
5328
+ // ../../harness/kernel/log/local-copy-writer.ts
5329
+ var folderSends;
5330
+ var init_local_copy_writer = __esm(() => {
5331
+ init_src();
5332
+ init_run_paths();
5333
+ folderSends = new Map;
5334
+ });
5335
+
4728
5336
  // ../../harness/kernel/log/log-sink.ts
4729
5337
  import { execFile as execFile2 } from "node:child_process";
4730
5338
  import { randomUUID } from "node:crypto";
4731
5339
  import {
4732
5340
  appendFileSync,
4733
- closeSync,
5341
+ closeSync as closeSync2,
4734
5342
  constants as fsConstants,
4735
- fstatSync,
4736
- mkdirSync,
4737
- lstatSync,
4738
- openSync,
4739
- readFileSync,
5343
+ fstatSync as fstatSync2,
5344
+ mkdirSync as mkdirSync2,
5345
+ lstatSync as lstatSync2,
5346
+ openSync as openSync2,
5347
+ readFileSync as readFileSync2,
4740
5348
  renameSync,
4741
5349
  writeFileSync,
4742
- writeSync
5350
+ writeSync as writeSync2
4743
5351
  } from "node:fs";
4744
- import { dirname, join } from "node:path";
5352
+ import { dirname, join as join2 } from "node:path";
4745
5353
  import { promisify as promisify2 } from "node:util";
4746
5354
  function isUnattributedStreamName(name) {
4747
5355
  return /^none-[a-z0-9]+(?:-[a-z0-9]+)*$/.test(name);
4748
5356
  }
4749
5357
  function withDeadline(work, ms, fallback) {
4750
5358
  return new Promise((resolve) => {
4751
- const timer = setTimeout(() => resolve(fallback), ms);
5359
+ let graceTimer;
5360
+ const timer = setTimeout(() => {
5361
+ graceTimer = setTimeout(() => resolve(fallback), WITH_DEADLINE_GRACE_MS);
5362
+ graceTimer.unref?.();
5363
+ }, ms);
4752
5364
  timer.unref?.();
4753
- work.then((value) => {
5365
+ const settle = (answer) => {
4754
5366
  clearTimeout(timer);
4755
- resolve(value);
4756
- }, () => {
4757
- clearTimeout(timer);
4758
- resolve(fallback);
4759
- });
5367
+ if (graceTimer !== undefined)
5368
+ clearTimeout(graceTimer);
5369
+ resolve(answer);
5370
+ };
5371
+ work.then((value) => settle(value), () => settle(fallback));
4760
5372
  });
4761
5373
  }
4762
5374
  async function safeLoadTrustAnchorConfig() {
@@ -4798,7 +5410,7 @@ function outboxPathFor(deps, repo, issue, unattributedStream) {
4798
5410
  const dirName = repo ? `${repo.owner}-${repo.repo}` : "unresolved";
4799
5411
  const unattributed = unattributedStream !== undefined && isUnattributedStreamName(unattributedStream) ? unattributedStream : "none";
4800
5412
  const fileName = `${issue ?? unattributed}.ndjson`;
4801
- return join(deps.outboxRoot(), dirName, fileName);
5413
+ return join2(deps.outboxRoot(), dirName, fileName);
4802
5414
  }
4803
5415
  function createDefaultLogSinkSlot(runId) {
4804
5416
  let factory;
@@ -4822,17 +5434,19 @@ function createDefaultLogSinkSlot(runId) {
4822
5434
  runId
4823
5435
  };
4824
5436
  }
4825
- 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;
5437
+ 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;
4826
5438
  var init_log_sink = __esm(() => {
4827
5439
  init_resolve_repo();
4828
5440
  init_envelope();
4829
- init_schema();
4830
- init_store();
5441
+ init_schema2();
5442
+ init_store2();
4831
5443
  init_redact();
5444
+ init_local_copy_writer();
4832
5445
  init_config_schema();
4833
5446
  init_run_paths();
4834
5447
  OUTBOX_MAX_BYTES = 8 * 1024 * 1024;
4835
5448
  processTrustAnchorByRepo = createTrustAnchorCache(safeLoadTrustAnchorConfig);
5449
+ defaultBranchSettingsByRepo = new Map;
4836
5450
  branchIssueByCwd = new Map;
4837
5451
  branchIssueSettledByCwd = new Map;
4838
5452
  headShaByCwd = new Map;
@@ -4840,12 +5454,13 @@ var init_log_sink = __esm(() => {
4840
5454
  execFileAsync2 = promisify2(execFile2);
4841
5455
  APPEND_OPEN_FLAGS = fsConstants.O_WRONLY | fsConstants.O_APPEND | fsConstants.O_CREAT | fsConstants.O_NOFOLLOW | fsConstants.O_NONBLOCK;
4842
5456
  defaultSinkSlot = createDefaultLogSinkSlot(process.env.VINAYA_RUN_ID || randomUUID());
5457
+ extraDrains = new Set;
4843
5458
  });
4844
5459
 
4845
5460
  // ../../harness/kernel/log/client/log-sync-folder-source.ts
4846
5461
  import { createHash } from "node:crypto";
4847
- import { constants as fsConstants2, closeSync as closeSync2, fstatSync as fstatSync2, openSync as openSync2, readdirSync, readSync } from "node:fs";
4848
- import { dirname as dirname2, join as join2 } from "node:path";
5462
+ import { constants as fsConstants2, closeSync as closeSync3, fstatSync as fstatSync3, openSync as openSync3, readdirSync as readdirSync2, readSync } from "node:fs";
5463
+ import { dirname as dirname2, join as join3 } from "node:path";
4849
5464
 
4850
5465
  // ../../harness/kernel/log/sync/measured.ts
4851
5466
  function unknownBecause(reason) {
@@ -4889,17 +5504,17 @@ var READ_OPEN_FLAGS = fsConstants2.O_RDONLY | fsConstants2.O_NOFOLLOW | fsConsta
4889
5504
  function regularFileSize(path) {
4890
5505
  let fd;
4891
5506
  try {
4892
- fd = openSync2(path, READ_OPEN_FLAGS);
5507
+ fd = openSync3(path, READ_OPEN_FLAGS);
4893
5508
  } catch {
4894
5509
  return null;
4895
5510
  }
4896
5511
  try {
4897
- const stat = fstatSync2(fd);
5512
+ const stat = fstatSync3(fd);
4898
5513
  return stat.isFile() ? stat.size : null;
4899
5514
  } catch {
4900
5515
  return null;
4901
5516
  } finally {
4902
- closeSync2(fd);
5517
+ closeSync3(fd);
4903
5518
  }
4904
5519
  }
4905
5520
  function readRangeOf(path, from, to) {
@@ -4907,12 +5522,12 @@ function readRangeOf(path, from, to) {
4907
5522
  return Buffer.alloc(0);
4908
5523
  let fd;
4909
5524
  try {
4910
- fd = openSync2(path, READ_OPEN_FLAGS);
5525
+ fd = openSync3(path, READ_OPEN_FLAGS);
4911
5526
  } catch {
4912
5527
  return null;
4913
5528
  }
4914
5529
  try {
4915
- if (!fstatSync2(fd).isFile())
5530
+ if (!fstatSync3(fd).isFile())
4916
5531
  return null;
4917
5532
  const length = to - from;
4918
5533
  const buffer = Buffer.alloc(length);
@@ -4927,7 +5542,7 @@ function readRangeOf(path, from, to) {
4927
5542
  } catch {
4928
5543
  return null;
4929
5544
  } finally {
4930
- closeSync2(fd);
5545
+ closeSync3(fd);
4931
5546
  }
4932
5547
  }
4933
5548
  var NEWLINE_BYTE = 10;
@@ -4969,7 +5584,7 @@ function firstLineFingerprintOf(path) {
4969
5584
  function listLiveStreamNames(repoDir) {
4970
5585
  let entries;
4971
5586
  try {
4972
- entries = readdirSync(repoDir);
5587
+ entries = readdirSync2(repoDir);
4973
5588
  } catch {
4974
5589
  return [];
4975
5590
  }
@@ -4977,17 +5592,17 @@ function listLiveStreamNames(repoDir) {
4977
5592
  for (const entry of entries) {
4978
5593
  if (!entry.endsWith(LIVE_SUFFIX) || entry.endsWith(ROTATED_SUFFIX))
4979
5594
  continue;
4980
- if (regularFileSize(join2(repoDir, entry)) === null)
5595
+ if (regularFileSize(join3(repoDir, entry)) === null)
4981
5596
  continue;
4982
5597
  names.push(entry.slice(0, -LIVE_SUFFIX.length));
4983
5598
  }
4984
5599
  return names;
4985
5600
  }
4986
5601
  function livePathFor(repoDir, name) {
4987
- return join2(repoDir, `${name}${LIVE_SUFFIX}`);
5602
+ return join3(repoDir, `${name}${LIVE_SUFFIX}`);
4988
5603
  }
4989
5604
  function rotatedPathFor(repoDir, name) {
4990
- return join2(repoDir, `${name}${ROTATED_SUFFIX}`);
5605
+ return join3(repoDir, `${name}${ROTATED_SUFFIX}`);
4991
5606
  }
4992
5607
  function createFolderLogSource(deps) {
4993
5608
  const repoDir = repoDirFor(deps);