@gitroll/tacitt-cli 0.4.0 → 0.4.1

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.
@@ -1,5 +1,5 @@
1
1
  import "./locate-U3-nkird.mjs";
2
- import "./src-DNn7SifS.mjs";
2
+ import "./src-DSDRF7i6.mjs";
3
3
  import { z } from "zod";
4
4
  import { Worker } from "node:worker_threads";
5
5
  //#region apps/cli/src/agent-setup/index.ts
@@ -1,8 +1,8 @@
1
- import { q as listAgentSetup } from "./src-CmP73EcD.mjs";
1
+ import { q as listAgentSetup } from "./src-DIuh0LHk.mjs";
2
2
  import { rn as workspaceSchema, tn as sessionSchema, yn as createStaticProcessor } from "./locate-U3-nkird.mjs";
3
- import { l as createNativeAdapters, u as createGitNameSeedProvider } from "./src-DES7hBAP.mjs";
4
- import { at as maximumAgentSetupSessions, ci as effectiveTreatmentSchema } from "./src-DNn7SifS.mjs";
5
- import "./agent-setup-CQRWVUWR.mjs";
3
+ import { l as createNativeAdapters, u as createGitNameSeedProvider } from "./src-BESjwh7X.mjs";
4
+ import { at as maximumAgentSetupSessions, ci as effectiveTreatmentSchema } from "./src-DSDRF7i6.mjs";
5
+ import "./agent-setup-Cb_spmGb.mjs";
6
6
  import { z } from "zod";
7
7
  import { parentPort, workerData } from "node:worker_threads";
8
8
  //#region apps/cli/src/agent-setup/worker.ts
package/dist/cli.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import { _ as createExecutionPort, a as readAgentPresence, d as parseOptions, f as businessCommands, g as readStateDump, h as startupFailure, i as invoke, l as createRenderActivity, m as permissionDiagnostic, n as readOperation, o as createRuntime, p as longCommands, r as waitOperation, s as executorEventSchema, t as cancelOperation, u as helpText, v as startHost, y as traceStartup } from "./query-ByD0Rp_o.mjs";
3
- import { nt as openPrivateFile, tt as makePrivateDirectory } from "./src-CmP73EcD.mjs";
2
+ import { _ as createExecutionPort, a as readAgentPresence, d as parseOptions, f as businessCommands, g as readStateDump, h as startupFailure, i as invoke, l as createRenderActivity, m as permissionDiagnostic, n as readOperation, o as createRuntime, p as longCommands, r as waitOperation, s as executorEventSchema, t as cancelOperation, u as helpText, v as startHost$1, y as traceStartup } from "./query-7uY266qY.mjs";
3
+ import { nt as openPrivateFile, tt as makePrivateDirectory } from "./src-DIuh0LHk.mjs";
4
4
  import { Gt as safeField, Ht as ApplicationError, Wt as safeCode } from "./locate-U3-nkird.mjs";
5
- import { Zn as reviewTransportBytes, et as readWorkspaceOutcomes, ii as stateSchema, st as resolveFailureLocation } from "./src-DNn7SifS.mjs";
6
- import { _t as isCoordinationBusy } from "./heap-BaTNC9kf.mjs";
5
+ import { Zn as reviewTransportBytes, et as readWorkspaceOutcomes, ii as stateSchema, st as resolveFailureLocation } from "./src-DSDRF7i6.mjs";
6
+ import { _t as isCoordinationBusy } from "./heap-eZTo0VYj.mjs";
7
7
  import { constants, createReadStream, write } from "node:fs";
8
8
  import { z } from "zod";
9
9
  import { lstat, mkdir, mkdtemp, open, readFile, readdir, realpath, rename, rm, writeFile } from "node:fs/promises";
@@ -246,7 +246,7 @@ async function serve(options, journeyId) {
246
246
  await runtime.application.getSensitiveTerms();
247
247
  if (journeyId && !await runtime.application.journey?.get({ journeyId })) throw new ApplicationError("INVALID_TRANSITION");
248
248
  traceStartup("host-start");
249
- host = await startHost({
249
+ host = await startHost$1({
250
250
  application: runtime.application,
251
251
  account: runtime.account,
252
252
  nativeInspection: runtime.nativeInspection,
@@ -931,6 +931,10 @@ const readySchema = z.object({
931
931
  journeyId: z.string()
932
932
  })
933
933
  });
934
+ const failureSchema = z.object({
935
+ ok: z.literal(false),
936
+ error: z.object({ code: z.string() })
937
+ });
934
938
  const recordSchema = z.object({
935
939
  url: z.string(),
936
940
  journeyId: z.string(),
@@ -998,18 +1002,36 @@ async function serveDetached(args, stateDir, journeyId) {
998
1002
  recursive: true,
999
1003
  mode: 448
1000
1004
  });
1001
- const existing = await liveHost(directory, journeyId);
1002
- if (existing) {
1003
- process.stdout.write(`${JSON.stringify({
1004
- ok: true,
1005
- event: "ready",
1006
- result: {
1007
- ...existing,
1008
- reused: true
1009
- }
1010
- })}\n`);
1011
- return;
1005
+ let retries = 0;
1006
+ let delay = 500;
1007
+ for (;;) {
1008
+ const existing = await liveHost(directory, journeyId);
1009
+ if (existing) {
1010
+ process.stdout.write(`${JSON.stringify({
1011
+ ok: true,
1012
+ event: "ready",
1013
+ result: {
1014
+ ...existing,
1015
+ reused: true
1016
+ }
1017
+ })}\n`);
1018
+ return;
1019
+ }
1020
+ const result = await startHost(args, directory, journeyId, Date.now() + 6e4);
1021
+ if (!result) return;
1022
+ if (!result.busy || retries >= 5) {
1023
+ process.stderr.write(`The panel host did not start. Its output is in ${result.log}.\n`);
1024
+ process.exitCode = 1;
1025
+ return;
1026
+ }
1027
+ process.stderr.write("COORDINATION_BUSY: retrying panel host startup.\n");
1028
+ retries += 1;
1029
+ await setTimeout$1(delay);
1030
+ delay = Math.min(delay * 2, 4e3);
1012
1031
  }
1032
+ }
1033
+ /** Retry only an exited child's explicit busy refusal; never start two live owners. */
1034
+ async function startHost(args, directory, journeyId, deadline) {
1013
1035
  const id = randomUUID();
1014
1036
  const input = join(directory, `${id}.json`);
1015
1037
  const log = join(directory, `${id}.log`);
@@ -1033,10 +1055,14 @@ async function serveDetached(args, stateDir, journeyId) {
1033
1055
  child.once("exit", (code) => exited = code ?? 1);
1034
1056
  child.unref();
1035
1057
  await output.close();
1036
- for (let waited = 0; waited < 6e4; waited += 100) {
1058
+ let busy = false;
1059
+ while (Date.now() < deadline) {
1037
1060
  const ready = (await readFile(log, "utf8")).split("\n").flatMap((line) => {
1038
1061
  try {
1039
- const value = readySchema.safeParse(JSON.parse(line));
1062
+ const parsed = JSON.parse(line);
1063
+ const failure = failureSchema.safeParse(parsed);
1064
+ if (failure.success) busy = failure.data.error.code === "COORDINATION_BUSY";
1065
+ const value = readySchema.safeParse(parsed);
1040
1066
  return value.success ? [value.data.result] : [];
1041
1067
  } catch {
1042
1068
  return [];
@@ -1062,11 +1088,13 @@ async function serveDetached(args, stateDir, journeyId) {
1062
1088
  return;
1063
1089
  }
1064
1090
  if (exited !== null) break;
1065
- await setTimeout$1(100);
1091
+ await setTimeout$1(Math.min(100, Math.max(0, deadline - Date.now())));
1066
1092
  }
1067
1093
  if (exited === null) child.kill();
1068
- process.stderr.write(`The panel host did not start. Its output is in ${log}.\n`);
1069
- process.exitCode = 1;
1094
+ return {
1095
+ busy: exited !== null && busy,
1096
+ log
1097
+ };
1070
1098
  }
1071
1099
  //#endregion
1072
1100
  //#region apps/cli/src/business-input.ts
@@ -1,4 +1,4 @@
1
- import { i as errorCode } from "./model-D7UnGeag.mjs";
1
+ import { i as errorCode } from "./model-BDrntocp.mjs";
2
2
  import { a as titleHintLimits, i as encodeTitleError, o as titleInputSchema, t as assertTitleHeap } from "./heap-1FYhGds4.mjs";
3
3
  import { stat } from "node:fs/promises";
4
4
  import { isAbsolute, join } from "node:path";
@@ -1,8 +1,8 @@
1
- import { J as createConfiguredPreviewStream } from "./src-CmP73EcD.mjs";
1
+ import { J as createConfiguredPreviewStream } from "./src-DIuh0LHk.mjs";
2
2
  import { rn as workspaceSchema, tn as sessionSchema, yn as createStaticProcessor } from "./locate-U3-nkird.mjs";
3
- import { l as createNativeAdapters, u as createGitNameSeedProvider } from "./src-DES7hBAP.mjs";
4
- import { ci as effectiveTreatmentSchema } from "./src-DNn7SifS.mjs";
5
- import { a as classifyRecord, n as assertPreviewHeap, t as runPreview } from "./run-3UIkr7GZ.mjs";
3
+ import { l as createNativeAdapters, u as createGitNameSeedProvider } from "./src-BESjwh7X.mjs";
4
+ import { ci as effectiveTreatmentSchema } from "./src-DSDRF7i6.mjs";
5
+ import { a as classifyRecord, n as assertPreviewHeap, t as runPreview } from "./run-CV6Io7CS.mjs";
6
6
  import { z } from "zod";
7
7
  import { parentPort, workerData } from "node:worker_threads";
8
8
  //#region apps/cli/src/preview/run.ts
@@ -1,8 +1,8 @@
1
- import { $ as safeError, A as runConfiguredSessionJob, R as gitSeedsProvider, m as captureConfiguredSessionJob, u as runConfiguredScanJob } from "./src-CmP73EcD.mjs";
1
+ import { $ as safeError, A as runConfiguredSessionJob, R as gitSeedsProvider, m as captureConfiguredSessionJob, u as runConfiguredScanJob } from "./src-DIuh0LHk.mjs";
2
2
  import { Wt as safeCode, yn as createStaticProcessor } from "./locate-U3-nkird.mjs";
3
- import { l as createNativeAdapters } from "./src-DES7hBAP.mjs";
4
- import "./src-DNn7SifS.mjs";
5
- import { d as runJourneyBaseJob, i as runJourneyOutputVerifyJob, n as runJourneyOutputJob, r as runJourneyOutputShardJob } from "./job-DrcpSL_9.mjs";
3
+ import { l as createNativeAdapters } from "./src-BESjwh7X.mjs";
4
+ import "./src-DSDRF7i6.mjs";
5
+ import { d as runJourneyBaseJob, i as runJourneyOutputVerifyJob, n as runJourneyOutputJob, r as runJourneyOutputShardJob } from "./job-Bi57uRU-.mjs";
6
6
  import { parentPort } from "node:worker_threads";
7
7
  //#region apps/cli/src/configured-session-worker.ts
8
8
  const port = parentPort;
@@ -1,6 +1,6 @@
1
- import { b as writePrivateReviewPayload, et as exclusiveLock, it as windowsOwnerOnly, nt as openPrivateFile, rt as restrictToOwner, x as readPrivateReviewPayload } from "./src-CmP73EcD.mjs";
1
+ import { b as writePrivateReviewPayload, et as exclusiveLock, it as windowsOwnerOnly, nt as openPrivateFile, rt as restrictToOwner, x as readPrivateReviewPayload } from "./src-DIuh0LHk.mjs";
2
2
  import { $t as fileIdentitySchema, At as journeyTermSchema, Ht as ApplicationError, It as termTypeSchema, Jt as reviewFamilies, Kn as isStaticCategory, Mt as reviewTermsResultSchema, _ as semanticFindingSchema, b as validateBReview, c as textDigest, d as reviewAlignmentAudit, dt as nativeJourneySchema, ft as journeyGuidanceSchema, g as validateReviewAlignment, gn as createDetectionSummary, gt as journeyWorkSuggestionSchema, ht as journeyDescribeSchema, i as reviewBatchSchema, it as journeyDigestSchema, jt as reviewTermsInputSchema, kt as privacyTermSchema, l as validateReview, m as reviewAlignmentSchema, o as reviewDigest, ot as journeyIdSchema, qn as staticCategories, qt as familySelected, r as reviewBatchChunks, s as reviewSubmitSchema, u as findingReferenceKey, v as bContextEvidence } from "./locate-U3-nkird.mjs";
3
- import { $n as mergeBRepair, $t as journeyResourceSchema, At as validateAttemptAppend, B as validateInspectionBatch, Bt as newJourneyWork, Et as obsoleteJourney, Fn as confirmedHideGroupIds, Ft as applyClassificationProposal, G as validateInspectionFence, Gn as workPrivacyDecisions, Gr as withReadingProgress, Gt as hideFinishSchema, Hn as syncTermGroups, Hr as isReadingComplete, Ht as journeyContextQuerySchema, In as confirmedHideKey, It as classificationCommitSchema, J as validateInspectionQuery, Jn as reviewCandidateResourceSchema, Jt as journeySearchSaveSchema, K as validateInspectionHead, Kr as mergePrivacyTerms, Kt as hidePublishSchema, Mn as bMaskedHits, Nt as journeyBatchReadSchema, Pr as journeySendSchema, Pt as journeyReviewStorageQuerySchema, Qn as bReviewDigest, Qt as journeyResourceQuerySchema, Rn as confirmedHideTerms, Un as retireWorkDescription, Ur as isSelectedWork, Ut as journeyContextSchema, V as validateInspectionBatches, Vn as maskedHitsStale, W as validateInspectionClaim, Wn as workDecisionDigest, Wr as selectedWorks, Wt as hideBeginSchema, X as validateDetectionSummary, Xn as reviewRepairResourceSchema, Xt as journeyPolicyRespondSchema, Y as validateInspectionContribution, Yt as searchScopeDigest, Z as inspectionInputs, Zt as projectPreparationProgress, _ as projectJourneyInventory, _n as journeyCommitResultSchema, _r as preparationSettlementSchema, an as reviewAttemptsResultSchema, ar as scanGitSeedsId, b as bReviewScope, c as reconstructBFields, cn as sessionReconciliationResourceSchema, en as journeyIsolateSchema, fn as sessionReviewQuerySchema, fr as journeyInventoryReadSchema, gn as sessionUsefulnessResourceSchema, gr as preparationBeginSchema, h as semanticGroupKey, hn as sessionUsefulnessInputSchema, ht as candidateSortAvailable, ii as stateSchema, in as reviewAttemptsQuerySchema, ir as scanSessionResourceSchema, jt as journeyGuidance, kr as staticSessionId, kt as attemptBudgetCodePoints, l as reviseGroupMembership, lr as validateScanExclusion, m as hideScopeDigest, mn as sessionReviewStatusSchema, mr as journeyPreparationProgressSchema, nn as sortingApplySchema, nr as scanCanonicalResourceSchema, o as bRereadDigest, pn as sessionReviewResourceSchema, pr as journeyInventorySchema, pt as manualUploadSchema, q as validateInspectionInputs, qt as journeySearchResultSchema, rn as reviewAttemptResourceSchema, s as reconcileBSession, sn as sessionReconcileResultSchema, t as scanBatchContextDigest, tn as journeyPlaceSchema, tr as scanAliasResourceSchema, u as resolveGroupSplit, un as sessionRereadResourceSchema, ut as manualUploadBindingSchema, v as preparationScope, vn as journeyCommitSchema, vr as preparationStartSchema, wn as settleConfirmedHides, wt as settleCorrections, xn as confirmedHideDeltaSchema, xr as applyCardAnswers, yn as journeyEventSchema, yr as validatePreparationFacts, zn as dictionaryHides } from "./src-DNn7SifS.mjs";
3
+ import { $n as mergeBRepair, $t as journeyResourceSchema, At as validateAttemptAppend, B as validateInspectionBatch, Bt as newJourneyWork, Et as obsoleteJourney, Fn as confirmedHideGroupIds, Ft as applyClassificationProposal, G as validateInspectionFence, Gn as workPrivacyDecisions, Gr as withReadingProgress, Gt as hideFinishSchema, Hn as syncTermGroups, Hr as isReadingComplete, Ht as journeyContextQuerySchema, In as confirmedHideKey, It as classificationCommitSchema, J as validateInspectionQuery, Jn as reviewCandidateResourceSchema, Jt as journeySearchSaveSchema, K as validateInspectionHead, Kr as mergePrivacyTerms, Kt as hidePublishSchema, Mn as bMaskedHits, Nt as journeyBatchReadSchema, Pr as journeySendSchema, Pt as journeyReviewStorageQuerySchema, Qn as bReviewDigest, Qt as journeyResourceQuerySchema, Rn as confirmedHideTerms, Un as retireWorkDescription, Ur as isSelectedWork, Ut as journeyContextSchema, V as validateInspectionBatches, Vn as maskedHitsStale, W as validateInspectionClaim, Wn as workDecisionDigest, Wr as selectedWorks, Wt as hideBeginSchema, X as validateDetectionSummary, Xn as reviewRepairResourceSchema, Xt as journeyPolicyRespondSchema, Y as validateInspectionContribution, Yt as searchScopeDigest, Z as inspectionInputs, Zt as projectPreparationProgress, _ as projectJourneyInventory, _n as journeyCommitResultSchema, _r as preparationSettlementSchema, an as reviewAttemptsResultSchema, ar as scanGitSeedsId, b as bReviewScope, c as reconstructBFields, cn as sessionReconciliationResourceSchema, en as journeyIsolateSchema, fn as sessionReviewQuerySchema, fr as journeyInventoryReadSchema, gn as sessionUsefulnessResourceSchema, gr as preparationBeginSchema, h as semanticGroupKey, hn as sessionUsefulnessInputSchema, ht as candidateSortAvailable, ii as stateSchema, in as reviewAttemptsQuerySchema, ir as scanSessionResourceSchema, jt as journeyGuidance, kr as staticSessionId, kt as attemptBudgetCodePoints, l as reviseGroupMembership, lr as validateScanExclusion, m as hideScopeDigest, mn as sessionReviewStatusSchema, mr as journeyPreparationProgressSchema, nn as sortingApplySchema, nr as scanCanonicalResourceSchema, o as bRereadDigest, pn as sessionReviewResourceSchema, pr as journeyInventorySchema, pt as manualUploadSchema, q as validateInspectionInputs, qt as journeySearchResultSchema, rn as reviewAttemptResourceSchema, s as reconcileBSession, sn as sessionReconcileResultSchema, t as scanBatchContextDigest, tn as journeyPlaceSchema, tr as scanAliasResourceSchema, u as resolveGroupSplit, un as sessionRereadResourceSchema, ut as manualUploadBindingSchema, v as preparationScope, vn as journeyCommitSchema, vr as preparationStartSchema, wn as settleConfirmedHides, wt as settleCorrections, xn as confirmedHideDeltaSchema, xr as applyCardAnswers, yn as journeyEventSchema, yr as validatePreparationFacts, zn as dictionaryHides } from "./src-DSDRF7i6.mjs";
4
4
  import { constants } from "node:fs";
5
5
  import { z } from "zod";
6
6
  import { copyFile, link, lstat, mkdir, mkdtemp, open, readFile, realpath, rm, unlink } from "node:fs/promises";
@@ -1,7 +1,7 @@
1
- import { Y as createInspectionProcessor } from "./src-CmP73EcD.mjs";
1
+ import { Y as createInspectionProcessor } from "./src-DIuh0LHk.mjs";
2
2
  import { yn as createStaticProcessor } from "./locate-U3-nkird.mjs";
3
- import { l as createNativeAdapters, u as createGitNameSeedProvider } from "./src-DES7hBAP.mjs";
4
- import { H as validateInspectionRequest } from "./src-DNn7SifS.mjs";
3
+ import { l as createNativeAdapters, u as createGitNameSeedProvider } from "./src-BESjwh7X.mjs";
4
+ import { H as validateInspectionRequest } from "./src-DSDRF7i6.mjs";
5
5
  import "./messages-D3m3bhva.mjs";
6
6
  import { z } from "zod";
7
7
  import { parentPort, workerData } from "node:worker_threads";
@@ -1,6 +1,6 @@
1
- import { B as writeLogicalJourneyOutput, C as readConfiguredSearchFields, E as prepareCollectionProduction, R as gitSeedsProvider, U as readConfiguredOutputInfo, d as verifyOutputShard, f as writeOutputShard, k as renderJobDigest, y as writeLogicalJourneyBase } from "./src-CmP73EcD.mjs";
1
+ import { B as writeLogicalJourneyOutput, C as readConfiguredSearchFields, E as prepareCollectionProduction, R as gitSeedsProvider, U as readConfiguredOutputInfo, d as verifyOutputShard, f as writeOutputShard, k as renderJobDigest, y as writeLogicalJourneyBase } from "./src-DIuh0LHk.mjs";
2
2
  import { Ht as ApplicationError, Jt as reviewFamilies, zt as filterInventoryByPeriod } from "./locate-U3-nkird.mjs";
3
- import { Ar as staticSessionResourceSchema, Cn as renderedHideValue, Dn as hideKeyId, En as addHideIndexTokens, di as selectFrozenConfiguration, kn as packHideIndex, li as defaultScopedSettings, ui as freezeConfiguration } from "./src-DNn7SifS.mjs";
3
+ import { Ar as staticSessionResourceSchema, Cn as renderedHideValue, Dn as hideKeyId, En as addHideIndexTokens, di as selectFrozenConfiguration, kn as packHideIndex, li as defaultScopedSettings, ui as freezeConfiguration } from "./src-DSDRF7i6.mjs";
4
4
  import { constants } from "node:fs";
5
5
  import { link, lstat, open, unlink } from "node:fs/promises";
6
6
  import { join } from "node:path";
@@ -1,4 +1,4 @@
1
- import "./src-DNn7SifS.mjs";
1
+ import "./src-DSDRF7i6.mjs";
2
2
  //#region packages/harnesses/src/discovery/model.ts
3
3
  const discoveryBounds = {
4
4
  entries: 1e5,
@@ -1,6 +1,6 @@
1
- import { c as executorRequestSchema, d as parseOptions, h as startupFailure, i as invoke, n as readOperation, o as createRuntime, p as longCommands, r as waitOperation } from "./query-ByD0Rp_o.mjs";
1
+ import { c as executorRequestSchema, d as parseOptions, h as startupFailure, i as invoke, n as readOperation, o as createRuntime, p as longCommands, r as waitOperation } from "./query-7uY266qY.mjs";
2
2
  import { Gt as safeField, Ht as ApplicationError, Wt as safeCode } from "./locate-U3-nkird.mjs";
3
- import "./src-DNn7SifS.mjs";
3
+ import "./src-DSDRF7i6.mjs";
4
4
  import { z } from "zod";
5
5
  import { setTimeout } from "node:timers/promises";
6
6
  //#region apps/cli/src/operation/executor.ts
@@ -1,4 +1,4 @@
1
- import { n as assertPreviewHeap, o as previewInputSchema, t as runPreview } from "./run-3UIkr7GZ.mjs";
1
+ import { n as assertPreviewHeap, o as previewInputSchema, t as runPreview } from "./run-CV6Io7CS.mjs";
2
2
  import { parentPort, workerData } from "node:worker_threads";
3
3
  //#region packages/harnesses/src/preview/worker/index.ts
4
4
  function notify(message) {
@@ -1,10 +1,10 @@
1
- import { A as runConfiguredSessionJob, C as readConfiguredSearchFields, D as captureLogicalJourneySources, F as sessionWorkerFailure, G as staticMaskCategory, H as readLogicalJourneyFinalMasks, I as privateCollectionDirectory, K as readWorkspacePair, L as defaultParallelism, M as parseCollectionWorkspaceSummary, N as createSharedSessionPool, O as capturedJourneyScope, P as SessionWorkerError, Q as createCleanup, R as gitSeedsProvider, S as readOriginalSearchFields, T as checkReusableBundle, U as readConfiguredOutputInfo, V as privateJourneyDirectory, W as processJourneyMetadataFields, X as createTemporary, Z as removeNamedTemporarySpools, _ as readStaticSessionMasks, a as scanReviewFields, at as isWindowsAclFailure, c as readSessionScanRecords, g as processJourneyMetadata, h as readCapturedOriginalRows, i as buildWorkScanBatches, it as windowsOwnerOnly, j as readCollectionIndex, l as scanPreparedSession, n as verifyPreparedSessionSources, nt as openPrivateFile, o as createWorkPieces, ot as windowsAclCodes, p as openConfiguredUpload, r as prepareSessionScans, rt as restrictToOwner, s as readSessionScanFields, t as preparedScanConfiguration, tt as makePrivateDirectory, v as staticSessionJobs, w as createCollectionArtifacts, z as parallelismLimits } from "./src-CmP73EcD.mjs";
1
+ import { A as runConfiguredSessionJob, C as readConfiguredSearchFields, D as captureLogicalJourneySources, F as sessionWorkerFailure, G as staticMaskCategory, H as readLogicalJourneyFinalMasks, I as privateCollectionDirectory, K as readWorkspacePair, L as defaultParallelism, M as parseCollectionWorkspaceSummary, N as createSharedSessionPool, O as capturedJourneyScope, P as SessionWorkerError, Q as createCleanup, R as gitSeedsProvider, S as readOriginalSearchFields, T as checkReusableBundle, U as readConfiguredOutputInfo, V as privateJourneyDirectory, W as processJourneyMetadataFields, X as createTemporary, Z as removeNamedTemporarySpools, _ as readStaticSessionMasks, a as scanReviewFields, at as isWindowsAclFailure, c as readSessionScanRecords, g as processJourneyMetadata, h as readCapturedOriginalRows, i as buildWorkScanBatches, it as windowsOwnerOnly, j as readCollectionIndex, l as scanPreparedSession, n as verifyPreparedSessionSources, nt as openPrivateFile, o as createWorkPieces, ot as windowsAclCodes, p as openConfiguredUpload, r as prepareSessionScans, rt as restrictToOwner, s as readSessionScanFields, t as preparedScanConfiguration, tt as makePrivateDirectory, v as staticSessionJobs, w as createCollectionArtifacts, z as parallelismLimits } from "./src-DIuh0LHk.mjs";
2
2
  import { Bt as sessionPeriodSchema, Dn as entityDictionaryVersion, F as bClassificationKey, Fn as frameRecords, Ft as termTypeInfo, Gt as safeField, H as codePointLength, Ht as ApplicationError, Jt as reviewFamilies, K as utf16Offset, N as bUnitFragments, Ot as privacyTermKey, Qn as admitGitName, T as bLiteralTerms, Ut as UnfinishedJourneyError, V as bDigest, Wt as safeCode, Xn as createEntityMatcher, Zn as admitCustomTerm, Zt as observeSource, b as validateBReview, c as textDigest, h as reviewFindingsDigest, ht as journeyDescribeSchema, jt as reviewTermsInputSchema, l as validateReview, mn as currentDetectorVersion, n as compileBFindings, r as reviewBatchChunks, s as reviewSubmitSchema, t as locateTerms, yn as createStaticProcessor, z as bAnchorKey } from "./locate-U3-nkird.mjs";
3
- import { a as mainTextChunks, c as previewInWorker, i as nearestSortingRepository, l as createNativeAdapters, n as createProjectEvidenceCollector, o as mainTextFields, r as sortingRepositoryId, s as textChunks, t as createHarnesses, u as createGitNameSeedProvider } from "./src-DES7hBAP.mjs";
4
- import { $ as settingsQuerySchema, $r as packageCommandSchema, A as deviceProfileScopeSchema, B as validateInspectionBatch, Bn as journeyConfirmedHides, Br as hasCompleteWorkDescription, Bt as newJourneyWork, C as rebindReviewSubmit, Cr as privacyDecisionDigest, Ct as sendStartSchema, D as createAccount, Dr as hasCurrentStaticReview, E as staticallyHiddenFindings, Er as nativeRespondSchema, Et as obsoleteJourney, Fn as confirmedHideGroupIds, Fr as sendArtifactSchema, Gr as withReadingProgress, Hr as isReadingComplete, Ht as journeyContextQuerySchema, Ir as sendReceiptSchema, Jn as reviewCandidateResourceSchema, Jr as journeyFindingsSchema, Kn as workCorrectionBinding, L as createApplication, Ln as confirmedHideKinds, Lr as sendReplaceResultSchema, Lt as classificationPartition, M as readAccountAvatarUrl, Mr as agentSourceSchema, Mt as applyClassification, N as storedCredentialSchema, Nn as bTermMatcher, Nr as agentSourcesSchema, O as accountProfileSchema, Or as staticReviewDigest, Pr as journeySendSchema, Pt as journeyReviewStorageQuerySchema, Q as settingsBatchSchema, Qn as bReviewDigest, Qr as commandSchema, Qt as journeyResourceQuerySchema, R as inspectionCancelSchema, Rr as sendResolutionSchema, Rt as classificationWorks, S as rebindReviewOverlay, Sn as readConfirmedHideChange, Sr as assertJourneyPrivacyReady, St as sendPrepareSchema, T as guardedFindingText, Tn as termHideAdditions, Tr as nativeGetSchema, Tt as currentJourneyAdapters, U as inspectionQuerySchema, Un as retireWorkDescription, Ur as isSelectedWork, Vn as maskedHitsStale, Vr as isClassifying, Vt as reviewCompileSchema, Wn as workDecisionDigest, Xn as reviewRepairResourceSchema, Xr as journeyRenderInputSchema, Xt as journeyPolicyRespondSchema, Yn as reviewRepairInputSchema, Yr as journeyPreviewSchema, Yt as searchScopeDigest, Zr as journeyRenderSchema, _t as maximumTermsFileBytes, a as bCrossSegmentReviewSchema, ar as scanGitSeedsId, b as bReviewScope, bn as confirmedHideAdditions, br as journeyClassificationSessionsSchema, bt as sendActionSchema, c as reconstructBFields, cr as scanExclusionResourceSchema, ct as validateFailureLocation, d as selectedValueMembers, dn as sessionReviewInputSchema, dr as journeyInventoryQuerySchema, dt as manualUploadChoiceSchema, ei as selectionBatchSchema, er as planBRepair, et as readWorkspaceOutcomes, f as splitSelectorValues, fn as sessionReviewQuerySchema, ft as manualUploadPrepareSchema, g as changeJourney, gt as emptyTermsRevision, hn as sessionUsefulnessInputSchema, hr as emptyPreparationFacts, i as validateBCrossSegmentReview, ii as stateSchema, ir as scanSessionResourceSchema, j as profileUrlMatchesIdentity, k as deviceAuthorizationSchema, ln as sessionRereadInputSchema, lt as manualUploadActionSchema, m as hideScopeDigest, mt as manualUploadStartSchema, n as scanBatchEquivalenceDigest, nt as appendSensitiveTerms, o as bRereadDigest, oi as recommendParallelism, on as sessionReconcileInputSchema, or as scanGitSeedsResource, ot as artifactFailureDetailSchema, p as activeJourneyTerms, pt as manualUploadSchema, qn as reviewCandidateInputSchema, qr as journeyFindingImpactSchema, qt as journeySearchResultSchema, r as locateTermEvidence, ri as producerVersion, rn as reviewAttemptResourceSchema, rr as scanPreparationDigest, s as reconcileBSession, sr as verifiedScanGitSeeds, st as resolveFailureLocation, t as scanBatchContextDigest, ti as selectionSchema, tn as journeyPlaceSchema, vt as normalizeSensitiveTerms, w as reviewBatchReuse, wr as nativeEventsSchema, x as rebindReviewAlignment, xt as sendChoiceSchema, y as isGenericPublicTerm, yt as replaceSensitiveTermsSchema, z as inspectionStartSchema, zr as sendSettingsSchema, zt as retireScanGeneration } from "./src-DNn7SifS.mjs";
5
- import { $ as checkVersion, A as resourceSelectionQuerySchema, B as termReuseQuerySchema, C as loadAcceptedReview, D as aggregateUsefulness, E as loadPrivateResource, F as validateUnitCandidate, G as requireActiveBatch, H as batchHeader, I as reuseQuerySchema, J as validateDatabase, K as initializeAndClaim, L as batchQuery, M as evaluateUnitEvidence, N as sameCandidateRequest, O as sessionUsefulnessRecommendation, P as validateCandidateAttempt, Q as validateState, R as isPrivateResourceKind, S as validateSessionBindings, T as loadBatch, U as createJourneyPayloadFiles, V as privateReviewHash, W as validateBatchBody, X as readBundleDirectory, Y as withDatabase, Z as readStoredState, _ as loadReconciliation, _t as isCoordinationBusy, a as decodeError, at as hasResetMarker, b as validatePreparationSelection, c as dropsAnchor, ct as privatePath, d as parseDelivery, dt as stateDirectory, et as schemaVersion, f as validateCandidate, ft as syncDirectory, g as loadPreparedBodies, gt as errorCode$1, h as loadPreparation, ht as StoreError, i as createExecutor, it as finishReset, j as inspectionQuerySchema$1, k as sessionQuery, l as replySchema, lt as readResetMarker, m as loadStatus, mt as withFileCheckTimings, n as releaseInheritedHeapFlags, nt as createDatabaseFile, o as ProtocolError, ot as inspectStateFiles, p as classificationJourneyCommit, pt as withStateSnapshot, q as ownership, r as storeHeapLimits, rt as databaseName, s as allowedReplies, st as present, tt as beginReset, u as operations, ut as recheckPrivatePath, v as loadRereadBodies, vt as isSqliteCorruption, w as loadAuthenticatedReview, x as validateSessionReconciliation, y as loadSessionBodies, z as privateResourceHeader } from "./heap-BaTNC9kf.mjs";
6
- import { _ as staticBaseProduction, a as writeJourneyOutput, c as mergeHideIndexTokens, f as writeJourneyBase, g as staticBaseInputs, h as staticSessions, l as packRenderHideIndex, m as saveStaticSession, o as createHideIndexTokens, p as readStaticResult, s as hideIndexTexts, t as journeyOutputJob, u as journeyBaseJob, v as prepareSourcePlan, y as workApproval } from "./job-DrcpSL_9.mjs";
7
- import { t as createAgentSetupPort } from "./agent-setup-CQRWVUWR.mjs";
3
+ import { a as mainTextChunks, c as previewInWorker, i as nearestSortingRepository, l as createNativeAdapters, n as createProjectEvidenceCollector, o as mainTextFields, r as sortingRepositoryId, s as textChunks, t as createHarnesses, u as createGitNameSeedProvider } from "./src-BESjwh7X.mjs";
4
+ import { $ as settingsQuerySchema, $r as packageCommandSchema, A as deviceProfileScopeSchema, B as validateInspectionBatch, Bn as journeyConfirmedHides, Br as hasCompleteWorkDescription, Bt as newJourneyWork, C as rebindReviewSubmit, Cr as privacyDecisionDigest, Ct as sendStartSchema, D as createAccount, Dr as hasCurrentStaticReview, E as staticallyHiddenFindings, Er as nativeRespondSchema, Et as obsoleteJourney, Fn as confirmedHideGroupIds, Fr as sendArtifactSchema, Gr as withReadingProgress, Hr as isReadingComplete, Ht as journeyContextQuerySchema, Ir as sendReceiptSchema, Jn as reviewCandidateResourceSchema, Jr as journeyFindingsSchema, Kn as workCorrectionBinding, L as createApplication, Ln as confirmedHideKinds, Lr as sendReplaceResultSchema, Lt as classificationPartition, M as readAccountAvatarUrl, Mr as agentSourceSchema, Mt as applyClassification, N as storedCredentialSchema, Nn as bTermMatcher, Nr as agentSourcesSchema, O as accountProfileSchema, Or as staticReviewDigest, Pr as journeySendSchema, Pt as journeyReviewStorageQuerySchema, Q as settingsBatchSchema, Qn as bReviewDigest, Qr as commandSchema, Qt as journeyResourceQuerySchema, R as inspectionCancelSchema, Rr as sendResolutionSchema, Rt as classificationWorks, S as rebindReviewOverlay, Sn as readConfirmedHideChange, Sr as assertJourneyPrivacyReady, St as sendPrepareSchema, T as guardedFindingText, Tn as termHideAdditions, Tr as nativeGetSchema, Tt as currentJourneyAdapters, U as inspectionQuerySchema, Un as retireWorkDescription, Ur as isSelectedWork, Vn as maskedHitsStale, Vr as isClassifying, Vt as reviewCompileSchema, Wn as workDecisionDigest, Xn as reviewRepairResourceSchema, Xr as journeyRenderInputSchema, Xt as journeyPolicyRespondSchema, Yn as reviewRepairInputSchema, Yr as journeyPreviewSchema, Yt as searchScopeDigest, Zr as journeyRenderSchema, _t as maximumTermsFileBytes, a as bCrossSegmentReviewSchema, ar as scanGitSeedsId, b as bReviewScope, bn as confirmedHideAdditions, br as journeyClassificationSessionsSchema, bt as sendActionSchema, c as reconstructBFields, cr as scanExclusionResourceSchema, ct as validateFailureLocation, d as selectedValueMembers, dn as sessionReviewInputSchema, dr as journeyInventoryQuerySchema, dt as manualUploadChoiceSchema, ei as selectionBatchSchema, er as planBRepair, et as readWorkspaceOutcomes, f as splitSelectorValues, fn as sessionReviewQuerySchema, ft as manualUploadPrepareSchema, g as changeJourney, gt as emptyTermsRevision, hn as sessionUsefulnessInputSchema, hr as emptyPreparationFacts, i as validateBCrossSegmentReview, ii as stateSchema, ir as scanSessionResourceSchema, j as profileUrlMatchesIdentity, k as deviceAuthorizationSchema, ln as sessionRereadInputSchema, lt as manualUploadActionSchema, m as hideScopeDigest, mt as manualUploadStartSchema, n as scanBatchEquivalenceDigest, nt as appendSensitiveTerms, o as bRereadDigest, oi as recommendParallelism, on as sessionReconcileInputSchema, or as scanGitSeedsResource, ot as artifactFailureDetailSchema, p as activeJourneyTerms, pt as manualUploadSchema, qn as reviewCandidateInputSchema, qr as journeyFindingImpactSchema, qt as journeySearchResultSchema, r as locateTermEvidence, ri as producerVersion, rn as reviewAttemptResourceSchema, rr as scanPreparationDigest, s as reconcileBSession, sr as verifiedScanGitSeeds, st as resolveFailureLocation, t as scanBatchContextDigest, ti as selectionSchema, tn as journeyPlaceSchema, vt as normalizeSensitiveTerms, w as reviewBatchReuse, wr as nativeEventsSchema, x as rebindReviewAlignment, xt as sendChoiceSchema, y as isGenericPublicTerm, yt as replaceSensitiveTermsSchema, z as inspectionStartSchema, zr as sendSettingsSchema, zt as retireScanGeneration } from "./src-DSDRF7i6.mjs";
5
+ import { $ as checkVersion, A as resourceSelectionQuerySchema, B as termReuseQuerySchema, C as loadAcceptedReview, D as aggregateUsefulness, E as loadPrivateResource, F as validateUnitCandidate, G as requireActiveBatch, H as batchHeader, I as reuseQuerySchema, J as validateDatabase, K as initializeAndClaim, L as batchQuery, M as evaluateUnitEvidence, N as sameCandidateRequest, O as sessionUsefulnessRecommendation, P as validateCandidateAttempt, Q as validateState, R as isPrivateResourceKind, S as validateSessionBindings, T as loadBatch, U as createJourneyPayloadFiles, V as privateReviewHash, W as validateBatchBody, X as readBundleDirectory, Y as withDatabase, Z as readStoredState, _ as loadReconciliation, _t as isCoordinationBusy, a as decodeError, at as hasResetMarker, b as validatePreparationSelection, c as dropsAnchor, ct as privatePath, d as parseDelivery, dt as stateDirectory, et as schemaVersion, f as validateCandidate, ft as syncDirectory, g as loadPreparedBodies, gt as errorCode$1, h as loadPreparation, ht as StoreError, i as createExecutor, it as finishReset, j as inspectionQuerySchema$1, k as sessionQuery, l as replySchema, lt as readResetMarker, m as loadStatus, mt as withFileCheckTimings, n as releaseInheritedHeapFlags, nt as createDatabaseFile, o as ProtocolError, ot as inspectStateFiles, p as classificationJourneyCommit, pt as withStateSnapshot, q as ownership, r as storeHeapLimits, rt as databaseName, s as allowedReplies, st as present, tt as beginReset, u as operations, ut as recheckPrivatePath, v as loadRereadBodies, vt as isSqliteCorruption, w as loadAuthenticatedReview, x as validateSessionReconciliation, y as loadSessionBodies, z as privateResourceHeader } from "./heap-eZTo0VYj.mjs";
6
+ import { _ as staticBaseProduction, a as writeJourneyOutput, c as mergeHideIndexTokens, f as writeJourneyBase, g as staticBaseInputs, h as staticSessions, l as packRenderHideIndex, m as saveStaticSession, o as createHideIndexTokens, p as readStaticResult, s as hideIndexTexts, t as journeyOutputJob, u as journeyBaseJob, v as prepareSourcePlan, y as workApproval } from "./job-Bi57uRU-.mjs";
7
+ import { t as createAgentSetupPort } from "./agent-setup-Cb_spmGb.mjs";
8
8
  import { t as workerMessageSchema } from "./messages-D3m3bhva.mjs";
9
9
  import { constants, write } from "node:fs";
10
10
  import { z } from "zod";
@@ -925,7 +925,7 @@ function createRouter(application, account, stopping, delivery, nativeInspection
925
925
  })
926
926
  }),
927
927
  send: t.router({
928
- get: t.procedure.input(sendAddress.partial({ sendId: true })).query(({ input }) => sending().get(input)),
928
+ get: t.procedure.input(sendAddress.partial({ sendId: true })).query(({ input, signal }) => readThroughContention(() => sending().get(input), signal)),
929
929
  prepare: t.procedure.input(sendPrepareSchema).mutation(({ input, signal }) => sending().prepare(input, signal)),
930
930
  start: t.procedure.input(sendStartSchema).mutation(({ input, signal }) => sending().start(input, signal)),
931
931
  respond: t.procedure.input(sendChoiceSchema).mutation(({ input }) => sending().respond(input)),
@@ -6660,6 +6660,7 @@ async function prepareScanContext(storage, journeyId, work, selected, processing
6660
6660
  }
6661
6661
  //#endregion
6662
6662
  //#region apps/cli/src/journey/prepare/scan-plan.ts
6663
+ let publication = Promise.resolve();
6663
6664
  /**
6664
6665
  * The second pass of a Work's Track A (ADR 0177): with every session's receipt saved, its
6665
6666
  * authenticated fields files are read in the Work's reading order twice, once to find each
@@ -6667,6 +6668,18 @@ async function prepareScanContext(storage, journeyId, work, selected, processing
6667
6668
  * Only the plan's outlines stay in memory between the reads, never the Work's text.
6668
6669
  */
6669
6670
  async function publishWorkBatches(storage, plan, work, resources, signal) {
6671
+ const previous = publication;
6672
+ const turn = Promise.withResolvers();
6673
+ publication = turn.promise;
6674
+ await previous;
6675
+ try {
6676
+ signal.throwIfAborted();
6677
+ return await publishAdmittedWork(storage, plan, work, resources, signal);
6678
+ } finally {
6679
+ turn.resolve();
6680
+ }
6681
+ }
6682
+ async function publishAdmittedWork(storage, plan, work, resources, signal) {
6670
6683
  const order = new Map(plan.approval.inventory.sessions.map((item, index) => [item.id, index]));
6671
6684
  const workIndex = (resource) => {
6672
6685
  const index = order.get(resource.input.sessionId);
@@ -12428,6 +12441,7 @@ function createJourneySender(dependencies, phases = 3) {
12428
12441
  if (!sameIds(input.confirmedWorkIds, snapshot.send.items.map((item) => item.workId)) || !sameIds(input.confirmedOmittedWorkIds, snapshot.send.omitted.map((item) => item.workId)) || input.scopeDigest !== snapshot.send.scopeDigest || snapshot.send.items.length === 0) throw new ApplicationError("CONFIRMATION_REQUIRED");
12429
12442
  if (snapshot.send.confirmedAt !== null) return saveSend(dependencies, snapshot, snapshot.send, input);
12430
12443
  const connection = await dependencies.auth.connect(signal);
12444
+ if (!connection && !dependencies.auth.configured) throw new ApplicationError("ACCOUNT_NOT_CONFIGURED");
12431
12445
  if (connection && snapshot.send.subject !== null && snapshot.send.subject !== connection.subject) throw new ApplicationError("IDENTITY_REJECTED");
12432
12446
  let profile = {
12433
12447
  status: "sign-in",
@@ -12602,33 +12616,36 @@ function createJourneySendAuth(account, requestFetch) {
12602
12616
  }
12603
12617
  return response;
12604
12618
  };
12605
- return { async connect(signal) {
12606
- let credential = await current();
12607
- if (!credential) return null;
12608
- let verified = await account.identity.readIdentity(credential.accessToken, signal);
12609
- if (!verified) {
12610
- await refuse(credential.accessToken);
12611
- credential = await current();
12619
+ return {
12620
+ configured: account.configuration.clientId !== null,
12621
+ async connect(signal) {
12622
+ let credential = await current();
12612
12623
  if (!credential) return null;
12613
- verified = await account.identity.readIdentity(credential.accessToken, signal);
12624
+ let verified = await account.identity.readIdentity(credential.accessToken, signal);
12614
12625
  if (!verified) {
12615
- await expire(credential.accessToken);
12616
- return null;
12626
+ await refuse(credential.accessToken);
12627
+ credential = await current();
12628
+ if (!credential) return null;
12629
+ verified = await account.identity.readIdentity(credential.accessToken, signal);
12630
+ if (!verified) {
12631
+ await expire(credential.accessToken);
12632
+ return null;
12633
+ }
12617
12634
  }
12635
+ if (verified.identityId !== credential.identityId) throw new ApplicationError("IDENTITY_REJECTED");
12636
+ return createJourneyOwnerClient({
12637
+ apiUrl: account.configuration.passportApiUrl,
12638
+ subject: verified.identityId,
12639
+ fetch: ownerFetch,
12640
+ async authorize() {
12641
+ const latest = await current();
12642
+ if (!latest) throw new ApplicationError("ACCOUNT_SIGNED_OUT");
12643
+ if (latest.identityId !== verified.identityId) throw new ApplicationError("IDENTITY_REJECTED");
12644
+ return latest.accessToken;
12645
+ }
12646
+ });
12618
12647
  }
12619
- if (verified.identityId !== credential.identityId) throw new ApplicationError("IDENTITY_REJECTED");
12620
- return createJourneyOwnerClient({
12621
- apiUrl: account.configuration.passportApiUrl,
12622
- subject: verified.identityId,
12623
- fetch: ownerFetch,
12624
- async authorize() {
12625
- const latest = await current();
12626
- if (!latest) throw new ApplicationError("ACCOUNT_SIGNED_OUT");
12627
- if (latest.identityId !== verified.identityId) throw new ApplicationError("IDENTITY_REJECTED");
12628
- return latest.accessToken;
12629
- }
12630
- });
12631
- } };
12648
+ };
12632
12649
  }
12633
12650
  //#endregion
12634
12651
  //#region apps/cli/src/operation/protocol.ts
@@ -12646,6 +12663,15 @@ const sourceExclusionReasonSchema = z.enum([
12646
12663
  ]);
12647
12664
  const identifier = z.string().regex(/^[A-Za-z0-9_-]{1,128}$/);
12648
12665
  const count = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
12666
+ const driftCountsSchema = z.object({
12667
+ "claude-row": count.optional(),
12668
+ "claude-block": count.optional(),
12669
+ "codex-row": count.optional(),
12670
+ "codex-event": count.optional(),
12671
+ "codex-item": count.optional(),
12672
+ "codex-extension": count.optional(),
12673
+ launch: count.optional()
12674
+ });
12649
12675
  const safeDiagnosticSchema = z.object({
12650
12676
  code: z.string().regex(/^[A-Z][A-Z0-9_]{0,79}$/),
12651
12677
  stage: z.string().regex(/^[a-z][a-z0-9.-]{0,63}$/).default("runtime"),
@@ -12655,6 +12681,7 @@ const safeDiagnosticSchema = z.object({
12655
12681
  at: z.string().datetime().max(64).optional(),
12656
12682
  reason: sourceExclusionReasonSchema.optional(),
12657
12683
  sourceId: z.string().regex(/^src[0-9]{1,12}$/).optional(),
12684
+ driftCounts: driftCountsSchema.optional(),
12658
12685
  counts: z.object({
12659
12686
  workspaces: count,
12660
12687
  sessions: count,
@@ -12722,6 +12749,7 @@ function projectSafeDiagnostic(value) {
12722
12749
  operationId: Reflect.get(value, "operationId"),
12723
12750
  at: Reflect.get(value, "at"),
12724
12751
  counts: Reflect.get(value, "counts"),
12752
+ driftCounts: Reflect.get(value, "driftCounts"),
12725
12753
  location: safeLocation,
12726
12754
  reason: Reflect.get(value, "reason"),
12727
12755
  sourceId: Reflect.get(value, "sourceId")
@@ -12736,11 +12764,22 @@ function createSafeProducerCallbacks(emit, record) {
12736
12764
  code: diagnostic.code,
12737
12765
  stage: diagnostic.stage,
12738
12766
  ...diagnostic.reason ? { reason: diagnostic.reason } : {},
12739
- ...diagnostic.sourceId ? { sourceId: diagnostic.sourceId } : {}
12767
+ ...diagnostic.sourceId ? { sourceId: diagnostic.sourceId } : {},
12768
+ ...diagnostic.driftCounts ? { driftCounts: diagnostic.driftCounts } : {}
12740
12769
  });
12741
12770
  emit(diagnostic);
12742
12771
  }
12743
12772
  function anomaly(stage, event) {
12773
+ if (event.code === "tolerated-harness-drift") {
12774
+ const counts = driftCountsSchema.safeParse(event.driftCounts);
12775
+ publish({
12776
+ code: "HARNESS_DRIFT_TOLERATED",
12777
+ ...counts.success ? { driftCounts: counts.data } : {},
12778
+ stage,
12779
+ .../^src[0-9]{1,12}$/.test(event.sourceId) ? { sourceId: event.sourceId } : {}
12780
+ });
12781
+ return;
12782
+ }
12744
12783
  const reason = sourceExclusionReasonSchema.safeParse(event.code);
12745
12784
  if (!reason.success) return;
12746
12785
  publish({
@@ -1,7 +1,7 @@
1
1
  import { tn as sessionSchema } from "./locate-U3-nkird.mjs";
2
2
  import { t as createZstdFrameCheck$1 } from "./frame-waS5FnN5.mjs";
3
- import "./src-DNn7SifS.mjs";
4
- import { a as isRecord } from "./model-D7UnGeag.mjs";
3
+ import "./src-DSDRF7i6.mjs";
4
+ import { a as isRecord } from "./model-BDrntocp.mjs";
5
5
  import { constants } from "node:fs";
6
6
  import { z } from "zod";
7
7
  import { lstat, open, stat } from "node:fs/promises";