@gitroll/tacitt-cli 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/{agent-setup-CQRWVUWR.mjs → agent-setup-Bpsi-BCv.mjs} +2 -2
  2. package/dist/agent-setup-worker.mjs +5 -5
  3. package/dist/cli.mjs +81 -27
  4. package/dist/codex-title-worker.mjs +1 -1
  5. package/dist/configured-preview-worker.mjs +5 -5
  6. package/dist/configured-session-worker.mjs +5 -5
  7. package/dist/{frame-waS5FnN5.mjs → frame-IeDOLy1o.mjs} +1 -1
  8. package/dist/{heap-BaTNC9kf.mjs → heap-DiOlSa8T.mjs} +6 -6
  9. package/dist/inspection-worker.mjs +4 -4
  10. package/dist/{job-DrcpSL_9.mjs → job-BII94L2c.mjs} +3 -3
  11. package/dist/{locate-U3-nkird.mjs → locate-CBiw-CJK.mjs} +5 -0
  12. package/dist/{model-D7UnGeag.mjs → model-DGTsARtV.mjs} +1 -1
  13. package/dist/operation-executor.mjs +3 -3
  14. package/dist/preview-worker.mjs +1 -1
  15. package/dist/privacy-validator.mjs +1 -1
  16. package/dist/{query-ByD0Rp_o.mjs → query-CVqWNFYf.mjs} +886 -269
  17. package/dist/{run-3UIkr7GZ.mjs → run-BGlf-W0M.mjs} +4 -4
  18. package/dist/{src-DES7hBAP.mjs → src-37kIclGK.mjs} +170 -41
  19. package/dist/{src-DNn7SifS.mjs → src-CBTvOa44.mjs} +46 -3
  20. package/dist/{src-CmP73EcD.mjs → src-D4nrfC2S.mjs} +222 -19
  21. package/dist/store-database-worker.mjs +1 -1
  22. package/dist/web/assets/index-D3g_ATU-.js +69 -0
  23. package/dist/web/assets/{index-Clg6Pfv_.css → index-D5DEG5Ue.css} +1 -1
  24. package/dist/web/index.html +2 -2
  25. package/package.json +1 -1
  26. package/skills/tacitt/SKILL.md +3 -3
  27. package/skills/tacitt/references/INDEX.md +10 -10
  28. package/skills/tacitt/references/commands.md +2 -0
  29. package/skills/tacitt/references/journey.md +3 -3
  30. package/skills/tacitt/references/send.md +38 -12
  31. package/skills/tacitt/scripts/INDEX.md +36 -36
  32. package/skills/tacitt/scripts/journey-card-consolidation.mjs +2 -4
  33. package/skills/tacitt/scripts/journey-state.d.mts +30 -0
  34. package/skills/tacitt/scripts/journey-state.mjs +56 -3
  35. package/skills/tacitt/scripts/journey-tasks.d.mts +8 -0
  36. package/skills/tacitt/scripts/journey-tasks.mjs +4 -1
  37. package/skills/tacitt/scripts/privacy-validator.mjs +2 -0
  38. package/skills/tacitt/scripts/review.mjs +110 -9
  39. package/dist/web/assets/index-BkuUI3Eu.js +0 -67
@@ -1,6 +1,6 @@
1
- import { Bn as validatePlan, Cn as sessionNonce, Dn as entityDictionaryVersion, En as cleanupImplementationVersion, Fn as frameRecords, Gn as detectStatic, H as codePointLength, Hn as defaultLimits, Ht as ApplicationError, In as retainedMainTextNodes, Jn as jsonSpans, Jt as reviewFamilies, Ln as validateProfile, Mn as nativeItems, Nn as nativeText, On as nativeParserVersion, Pn as transformRecords, Qt as sourceSnapshotId, Sn as createReplacementKey, Tn as parseNativeRecord, Un as recordPointerLimits, V as bDigest, Wn as resolveLimits, Wt as safeCode, Xn as createEntityMatcher, Xt as sourceKey, Yn as agentContextLocation, an as withMandatoryCustomTerms, c as textDigest, cn as mainReviewRole, dn as renderNative, fn as createSessionPreparation, gn as createDetectionSummary, in as nativeSourceIdentitySchema, ir as isProcessingCode, j as bDuplicateShift, jn as nativeField, k as bBindingCap, kn as redactionImplementationVersion, ln as reviewRoles, nr as ProcessingError, o as reviewDigest, on as processNativeRecord, pn as bindInspection, qt as familySelected, rr as fail$1, sn as projectNativeReviewInput, tr as defaultDetectionLimits, un as createSentenceContext, vn as walkNativeFields, wn as projectNativeRecord, x as createBAnalysisUnits, zn as buildPlan } from "./locate-U3-nkird.mjs";
2
- import { t as createZstdFrameCheck } from "./frame-waS5FnN5.mjs";
3
- import { An as bContainment, Dt as metadataProcessingVersion, F as withSourceEvidence, I as agentSetupKey, Mr as agentSourceSchema, P as sourceIdentityEvidence, Pn as bWordBounded, ai as sourceChangePolicy, fi as staticCatalogRef, it as defaultAgentSetupInclusion, jn as bExceptionRanges, jr as agentSourcePathSegment, rt as classifyAgentSetup, si as approvedTreatmentSchema, ur as resolveSourceSelection } from "./src-DNn7SifS.mjs";
1
+ import { Bn as validatePlan, Cn as sessionNonce, Dn as entityDictionaryVersion, En as cleanupImplementationVersion, Fn as frameRecords, Gn as detectStatic, H as codePointLength, Hn as defaultLimits, Ht as ApplicationError, In as retainedMainTextNodes, Jn as jsonSpans, Jt as reviewFamilies, Ln as validateProfile, Mn as nativeItems, Nn as nativeText, On as nativeParserVersion, Pn as transformRecords, Qt as sourceSnapshotId, Sn as createReplacementKey, Tn as parseNativeRecord, Un as recordPointerLimits, V as bDigest, Wn as resolveLimits, Wt as safeCode, Xn as createEntityMatcher, Xt as sourceKey, Yn as agentContextLocation, an as withMandatoryCustomTerms, c as textDigest, cn as mainReviewRole, dn as renderNative, fn as createSessionPreparation, gn as createDetectionSummary, in as nativeSourceIdentitySchema, ir as isProcessingCode, j as bDuplicateShift, jn as nativeField, k as bBindingCap, kn as redactionImplementationVersion, ln as reviewRoles, nr as ProcessingError, o as reviewDigest, on as processNativeRecord, pn as bindInspection, qt as familySelected, rr as fail$1, sn as projectNativeReviewInput, tr as defaultDetectionLimits, un as createSentenceContext, vn as walkNativeFields, wn as projectNativeRecord, x as createBAnalysisUnits, zn as buildPlan } from "./locate-CBiw-CJK.mjs";
2
+ import { t as createZstdFrameCheck } from "./frame-IeDOLy1o.mjs";
3
+ import { An as bContainment, Dt as metadataProcessingVersion, F as withSourceEvidence, I as agentSetupKey, Mr as agentSourceSchema, P as sourceIdentityEvidence, Pn as bWordBounded, ai as sourceChangePolicy, fi as staticCatalogRef, it as defaultAgentSetupInclusion, jn as bExceptionRanges, jr as agentSourcePathSegment, rt as classifyAgentSetup, si as approvedTreatmentSchema, ur as resolveSourceSelection } from "./src-CBTvOa44.mjs";
4
4
  import { constants } from "node:fs";
5
5
  import { link, lstat, mkdir, open, readFile, readdir, realpath, rm, rmdir, stat, unlink } from "node:fs/promises";
6
6
  import { execFile, fork, spawn } from "node:child_process";
@@ -15,7 +15,7 @@ import { ERR_UNSUPPORTED_FORMAT, Reader, TextReader, ZipReader, ZipWriter, confi
15
15
  import "node:perf_hooks";
16
16
  import { availableParallelism, platform, tmpdir, totalmem } from "node:os";
17
17
  import { pipeline } from "node:stream/promises";
18
- import { constants as constants$1, createZstdDecompress } from "node:zlib";
18
+ import { constants as constants$1, crc32, createZstdDecompress } from "node:zlib";
19
19
  import { parse } from "@decimalturn/toml-patch";
20
20
  //#region packages/file-privacy/src/windows/descriptor.ts
21
21
  const system = "S-1-5-18";
@@ -3227,21 +3227,23 @@ async function inspectInput(input, part, adapter, signal, overrides, complete =
3227
3227
  const inspector = adapter.source(part);
3228
3228
  const limits = resolveLimits(overrides);
3229
3229
  let records = 0;
3230
+ let identityRecords = 0;
3230
3231
  let readingRecords = true;
3231
3232
  const cleanup = createCleanup();
3232
3233
  try {
3233
3234
  for await (const text of frameRecords(input.chunks, "jsonl", limits.maxRecordBytes, signal)) {
3234
3235
  const root = parseNativeRecord(text, limits, signal);
3235
3236
  inspector.inspect(root);
3236
- observe?.(root);
3237
3237
  const native = inspector.current();
3238
+ observe?.(root, native);
3238
3239
  if (!complete && native.role !== "unknown" && native.sessionId !== null) {
3239
3240
  const identity = inspector.finish();
3240
3241
  checkNativeEvidence(part, identity);
3241
3242
  return identity;
3242
3243
  }
3243
3244
  records += 1;
3244
- if (!complete && records >= 256) break;
3245
+ if (adapter.identityRecord?.(root) !== false) identityRecords += 1;
3246
+ if (!complete && identityRecords >= 256) break;
3245
3247
  }
3246
3248
  readingRecords = false;
3247
3249
  if (complete) await (input.finish ?? fail("ARTIFACT_PROCESSING_FAILED"))();
@@ -3272,20 +3274,24 @@ async function inspectCompleteCapturedSourceIdentity(part, captured, adapter, si
3272
3274
  return inspectInput(await openCapturedConfiguredSource(part, captured, signal), part, adapter, signal, overrides, true, observe);
3273
3275
  }
3274
3276
  /**
3275
- * First launch named by the frozen capture, the same first-known value admission observes;
3276
- * undefined when no record names one or the adapter has no launch port.
3277
+ * Launch on the first identity-bearing record that names a launch, matching admission. Later per-record launch
3278
+ * metadata cannot redefine session admission; absent launch retains legacy behavior.
3277
3279
  */
3278
3280
  async function capturedLaunch(part, captured, adapter, signal, overrides) {
3279
3281
  const launch = adapter.launch;
3280
3282
  if (!launch) return void 0;
3283
+ const inspector = adapter.source(part);
3281
3284
  const limits = resolveLimits(overrides);
3282
3285
  const input = await openCapturedConfiguredSource(part, captured, signal);
3283
3286
  let records = 0;
3284
3287
  const cleanup = createCleanup();
3285
3288
  try {
3286
3289
  for await (const text of frameRecords(input.chunks, "jsonl", limits.maxRecordBytes, signal)) {
3287
- const value = launch(parseNativeRecord(text, limits, signal));
3288
- if (value !== void 0) return value;
3290
+ const root = parseNativeRecord(text, limits, signal);
3291
+ inspector.inspect(root);
3292
+ const identity = inspector.current();
3293
+ const value = launch(root);
3294
+ if (identity.sessionId !== null && adapter.identityRecord?.(root) !== false && value !== void 0) return value;
3289
3295
  records += 1;
3290
3296
  }
3291
3297
  return;
@@ -3974,11 +3980,11 @@ function configuredSelection(selection, treatment) {
3974
3980
  if (modes !== void 0 && !object(modes)) return fail("ARTIFACT_INVALID_APPROVAL");
3975
3981
  const guardians = new Set(selection.diagnostics.filter((diagnostic) => diagnostic.code === "guardian-excluded").map((diagnostic) => diagnostic.nodeId));
3976
3982
  if (cleanup.ref.id === "native-evidence") {
3977
- if (selection.omitRecord && guardians.has(void 0)) return selection;
3983
+ if (selection.omitRecord && (guardians.has(void 0) || selection.diagnostics.some((item) => item.code === "unsupported-native-shape"))) return selection;
3978
3984
  return {
3979
3985
  diagnostics: selection.diagnostics,
3980
3986
  edits: selection.edits.map((edit) => {
3981
- if (guardians.has(edit.nodeId)) return edit;
3987
+ if (guardians.has(edit.nodeId) || edit.alwaysApply && edit.role === "derived") return edit;
3982
3988
  const { replacement: _replacement, retainAs: _retainAs, replacementOrigin, replacementSourceRanges: _replacementSourceRanges, replacementTargetRanges: _replacementTargetRanges, ...original } = edit;
3983
3989
  return {
3984
3990
  ...original,
@@ -13026,10 +13032,11 @@ async function admitConfiguredSources(approval, processing, signal, hooks, isola
13026
13032
  const adapter = processing.adapters[session.harness];
13027
13033
  const launch = adapter.launch;
13028
13034
  let launchKnown = false;
13029
- const observe = launch && ((root) => {
13030
- if (launchKnown) return;
13035
+ const observe = launch && ((root, identity) => {
13036
+ if (launchKnown || identity.sessionId === null || adapter.identityRecord?.(root) === false) return;
13031
13037
  const value = launch(root);
13032
- launchKnown = value !== void 0;
13038
+ if (value === void 0) return;
13039
+ launchKnown = true;
13033
13040
  if (value === "interactive") interactive.add(id);
13034
13041
  if (value === "automation" && assessedOnly.has(session.id)) automated.add(id);
13035
13042
  });
@@ -15409,6 +15416,166 @@ async function openConfiguredUpload(input, signal = new AbortController().signal
15409
15416
  }
15410
15417
  }
15411
15418
  //#endregion
15419
+ //#region packages/artifact/src/configured/output/session-file.ts
15420
+ /** Unlinked private storage survives no crash and never exposes source paths. */
15421
+ async function sessionFile() {
15422
+ const path = join(tmpdir(), `sess-pilot-send-${randomUUID()}.spool`);
15423
+ const handle = await openPrivateFile(path, constants.O_CREAT | constants.O_EXCL | constants.O_RDWR | constants.O_NOFOLLOW, 384);
15424
+ try {
15425
+ await unlink(path);
15426
+ return handle;
15427
+ } catch (error) {
15428
+ const cleanup = createCleanup();
15429
+ cleanup.failed(error);
15430
+ await cleanup.run(() => handle.close(), () => unlink(path));
15431
+ throw error;
15432
+ }
15433
+ }
15434
+ async function sessionFileFacts(file, size, signal) {
15435
+ const digest = createHash("sha256");
15436
+ let crc = 0;
15437
+ const reader = new FileReader(file, size, 262144, true, signal);
15438
+ for await (const bytes of reader.createReadable()) {
15439
+ digest.update(bytes);
15440
+ crc = crc32(bytes, crc);
15441
+ }
15442
+ return {
15443
+ byteLength: size,
15444
+ sha256: digest.digest("hex"),
15445
+ crc32: crc
15446
+ };
15447
+ }
15448
+ /** Verify bounded final redacted bytes before starting a second ZIP codec. */
15449
+ async function sessionPart(entry, expected, signal) {
15450
+ if (expected.byteLength > 268435456 || entry.uncompressedSize !== expected.byteLength) fail("ARTIFACT_PART_LIMIT");
15451
+ const file = await sessionFile();
15452
+ let size = 0;
15453
+ const digest = createHash("sha256");
15454
+ let crc = 0;
15455
+ try {
15456
+ await entry.getData(new WritableStream({ async write(bytes) {
15457
+ signal.throwIfAborted();
15458
+ if (size + bytes.byteLength > expected.byteLength) fail("ARTIFACT_PART_LIMIT");
15459
+ digest.update(bytes);
15460
+ crc = crc32(bytes, crc);
15461
+ let offset = 0;
15462
+ while (offset < bytes.byteLength) {
15463
+ const result = await file.write(bytes, offset, bytes.byteLength - offset, size + offset);
15464
+ if (!result.bytesWritten) fail("ARTIFACT_IO_FAILED");
15465
+ offset += result.bytesWritten;
15466
+ }
15467
+ size += bytes.byteLength;
15468
+ } }), {
15469
+ signal,
15470
+ checkSignature: true
15471
+ });
15472
+ if (size !== expected.byteLength || digest.digest("hex") !== expected.sha256) fail("ARTIFACT_INVALID_ARCHIVE");
15473
+ return {
15474
+ file,
15475
+ crc32: crc
15476
+ };
15477
+ } catch (error) {
15478
+ const cleanup = createCleanup();
15479
+ cleanup.failed(error);
15480
+ await cleanup.run(() => file.close());
15481
+ throw error;
15482
+ }
15483
+ }
15484
+ //#endregion
15485
+ //#region packages/artifact/src/configured/output/sessions.ts
15486
+ /** Each yielded spool stays open until the caller advances or closes this iterator. */
15487
+ async function* configuredSessionUploads(input, identities, signal) {
15488
+ const verified = await checkFrozenOutput(input, signal);
15489
+ const archive = await openCheckedOutput(input, verified.checked, signal);
15490
+ const cleanup = createCleanup();
15491
+ try {
15492
+ if (archive.manifestText !== verified.manifestText) fail("ARTIFACT_PROCESSING_MISMATCH");
15493
+ const descriptions = new Map(verified.manifest.entries.map((entry) => [entry.entryPath, entry]));
15494
+ for (const session of verified.manifest.sessions) {
15495
+ signal.throwIfAborted();
15496
+ const identity = identities.find((item) => item.archiveSessionId === session.id) ?? fail("ARTIFACT_IDENTITY_MISMATCH");
15497
+ const workspace = verified.manifest.sourceWorkspaces.find((item) => item.id === session.workspaceId) ?? fail("ARTIFACT_INVALID_MANIFEST");
15498
+ const entry = archive.entries.get(workspace.metadataPath) ?? fail("ARTIFACT_INVALID_ARCHIVE");
15499
+ const description = descriptions.get(workspace.metadataPath) ?? fail("ARTIFACT_INVALID_ARCHIVE");
15500
+ const text = await readMetadata(entry, signal);
15501
+ if (Buffer.byteLength(text) !== description.byteLength || createHash("sha256").update(text).digest("hex") !== description.sha256) fail("ARTIFACT_INVALID_ARCHIVE");
15502
+ const { version: _, ...facts } = validateConfiguredSourceMetadata(strictJson(text, metadataLimitBytes), workspace);
15503
+ const nativeSessionId = session.parts[0]?.native.sessionId ?? session.sourceSessionId;
15504
+ if (!nativeSessionId?.trim() && !identity.relativePath) fail("ARTIFACT_IDENTITY_MISMATCH");
15505
+ const metadata = {
15506
+ workspace: facts,
15507
+ sourceSessionId: nativeSessionId,
15508
+ harness: session.harness,
15509
+ lastAt: identity.lastAt,
15510
+ parts: []
15511
+ };
15512
+ const file = await sessionFile();
15513
+ const sessionCleanup = createCleanup();
15514
+ try {
15515
+ let size = 0;
15516
+ const sink = fileWriter(file, signal, (bytes) => {
15517
+ if (bytes > 5 * 1024 ** 3) fail("ARTIFACT_ARCHIVE_LIMIT");
15518
+ size = bytes;
15519
+ }, false);
15520
+ const zip = new ZipWriter(sink.writable, {
15521
+ useWebWorkers: false,
15522
+ useCompressionStream: true,
15523
+ bufferedWrite: false,
15524
+ dataDescriptor: true,
15525
+ unixMode: 33152,
15526
+ lastModDate: /* @__PURE__ */ new Date("1980-01-01T00:00:00.000Z"),
15527
+ extendedTimestamp: false
15528
+ });
15529
+ for (const [index, part] of session.parts.entries()) {
15530
+ const source = archive.entries.get(part.dataPath) ?? fail("ARTIFACT_INVALID_ARCHIVE");
15531
+ const expected = descriptions.get(part.dataPath) ?? fail("ARTIFACT_INVALID_ARCHIVE");
15532
+ const prepared = await sessionPart(source, expected, signal);
15533
+ const partCleanup = createCleanup();
15534
+ try {
15535
+ const path = `p${String(index + 1).padStart(6, "0")}.jsonl`;
15536
+ await zip.add(path, new FileReader(prepared.file, expected.byteLength, 262144, true, signal), { signal });
15537
+ metadata.parts.push({
15538
+ path,
15539
+ byteLength: expected.byteLength,
15540
+ sha256: expected.sha256,
15541
+ crc32: prepared.crc32
15542
+ });
15543
+ } catch (error) {
15544
+ partCleanup.failed(error);
15545
+ throw error;
15546
+ } finally {
15547
+ await partCleanup.run(() => prepared.file.close());
15548
+ }
15549
+ }
15550
+ await zip.close();
15551
+ if (zip.warnings?.length) fail("ARTIFACT_INVALID_ARCHIVE");
15552
+ if (size > 5 * 1024 ** 3) fail("ARTIFACT_ARCHIVE_LIMIT");
15553
+ const content = await sessionFileFacts(file, size, signal);
15554
+ await archive.fence();
15555
+ yield {
15556
+ ...content,
15557
+ metadata,
15558
+ nativeSessionId,
15559
+ relativePath: identity.relativePath,
15560
+ harness: session.harness,
15561
+ lastAt: identity.lastAt,
15562
+ stream: () => new FileReader(file, size, 262144, true, signal).createReadable()
15563
+ };
15564
+ } catch (error) {
15565
+ sessionCleanup.failed(error);
15566
+ throw error;
15567
+ } finally {
15568
+ await sessionCleanup.run(() => file.close());
15569
+ }
15570
+ }
15571
+ } catch (error) {
15572
+ cleanup.failed(error);
15573
+ throw error;
15574
+ } finally {
15575
+ await cleanup.run(() => archive.close());
15576
+ }
15577
+ }
15578
+ //#endregion
15412
15579
  //#region packages/artifact/src/configured/output/shard/write.ts
15413
15580
  const zipOptions = {
15414
15581
  useWebWorkers: false,
@@ -15594,6 +15761,7 @@ async function runConfiguredScanJob(job, processing, signal, onSourceProgress, o
15594
15761
  requireCurrentCleanup(job.cleanup);
15595
15762
  const owner = createOwner(request);
15596
15763
  const buffered = [];
15764
+ const toleratedDrift = /* @__PURE__ */ new Map();
15597
15765
  const verified = /* @__PURE__ */ new Map();
15598
15766
  let bufferedUtf16 = 0, mainRecords = 0, emptyEligible = true;
15599
15767
  try {
@@ -15615,6 +15783,12 @@ async function runConfiguredScanJob(job, processing, signal, onSourceProgress, o
15615
15783
  const inspector = adapter.source(source.source);
15616
15784
  const input = await owner.open(source);
15617
15785
  let ordinal = 0;
15786
+ let identitySeen = false;
15787
+ const tolerate = (shape) => {
15788
+ const counts = toleratedDrift.get(source.id) ?? {};
15789
+ counts[shape] = (counts[shape] ?? 0) + 1;
15790
+ toleratedDrift.set(source.id, counts);
15791
+ };
15618
15792
  let reading = true;
15619
15793
  try {
15620
15794
  for await (const record of roots(input, owner.limits, owner.signal)) {
@@ -15624,7 +15798,15 @@ async function runConfiguredScanJob(job, processing, signal, onSourceProgress, o
15624
15798
  const original = retain(root);
15625
15799
  const annotations = adapter.annotations(root, nativeOptions, original);
15626
15800
  prepareOriginals(root, original, annotations, owner.preparation, owner.limits, owner.signal);
15627
- if (adapter.mainProseComplete?.(root, original) !== true || adapter.launch?.(root) === "automation") fail("ARTIFACT_PROCESSING_UNSUPPORTED");
15801
+ if (adapter.mainProseComplete?.(root, original, tolerate) !== true) fail("ARTIFACT_PROCESSING_UNSUPPORTED");
15802
+ const native = inspector.current();
15803
+ const launch = adapter.launch?.(root);
15804
+ const identityRecord = native.sessionId !== null && adapter.identityRecord?.(root) !== false && launch !== void 0;
15805
+ if (launch === "automation") {
15806
+ if (!identitySeen && identityRecord) fail("ARTIFACT_PROCESSING_UNSUPPORTED");
15807
+ tolerate("launch");
15808
+ }
15809
+ identitySeen ||= identityRecord;
15628
15810
  const id = recordId(source.id, capture.facts, ordinal);
15629
15811
  const projection = projectNativeReviewInput({
15630
15812
  root,
@@ -15745,8 +15927,18 @@ async function runConfiguredScanJob(job, processing, signal, onSourceProgress, o
15745
15927
  input: {
15746
15928
  ...metadataRow,
15747
15929
  file: await fields.finish()
15748
- }
15930
+ },
15931
+ toleratedDrift: [...toleratedDrift].map(([sourceId, driftCounts]) => ({
15932
+ sourceId,
15933
+ count: Object.values(driftCounts).reduce((sum, count) => sum + count, 0),
15934
+ driftCounts
15935
+ }))
15749
15936
  };
15937
+ for (const { sourceId, driftCounts } of result.toleratedDrift ?? []) processing.onAnomaly?.({
15938
+ code: "tolerated-harness-drift",
15939
+ sourceId,
15940
+ driftCounts
15941
+ });
15750
15942
  success = true;
15751
15943
  return result;
15752
15944
  } finally {
@@ -15866,6 +16058,17 @@ async function scanPreparedSession(production, sessionId, directory, hooks, canc
15866
16058
  const capture = captures.find((row) => row.partId === source.source.id);
15867
16059
  if (capture && JSON.stringify(actual.facts) !== JSON.stringify(capture.facts)) fail("ARTIFACT_SOURCE_CHANGED");
15868
16060
  }
16061
+ const drift = settled.toleratedDrift ?? [];
16062
+ if (parallel && parallel.size > 1) for (const { sourceId, driftCounts } of drift) production.processing.onAnomaly?.({
16063
+ code: "tolerated-harness-drift",
16064
+ sourceId,
16065
+ driftCounts
16066
+ });
16067
+ hooks.onTiming?.({
16068
+ scope: "preparation",
16069
+ phases: {},
16070
+ volumes: { scanToleratedDrift: drift.reduce((sum, row) => sum + row.count, 0) }
16071
+ });
15869
16072
  return settled;
15870
16073
  } catch (error) {
15871
16074
  const id = error instanceof SessionWorkerError ? error.sourceId : recordSourceId(error);
@@ -16452,7 +16655,7 @@ function createWorkPieces() {
16452
16655
  const occurrences = /* @__PURE__ */ new Map();
16453
16656
  for (const { field, row } of fields) for (const spec of cut(fieldOutline(field), repeated)) {
16454
16657
  if (taken.has(spec.id)) continue;
16455
- const text = field.text.slice(spec.utf16Start, spec.utf16End);
16658
+ const text = Buffer.from(field.text.slice(spec.utf16Start, spec.utf16End), "utf16le").toString("utf16le");
16456
16659
  if (spec.key) {
16457
16660
  texts.set(spec.key, text);
16458
16661
  occurrences.set(spec.key, (occurrences.get(spec.key) ?? 0) + 1);
@@ -16768,4 +16971,4 @@ async function verifyPreparedSessionSources(prepared, input, signal) {
16768
16971
  }
16769
16972
  }
16770
16973
  //#endregion
16771
- export { safeError as $, runConfiguredSessionJob as A, writeLogicalJourneyOutput as B, readConfiguredSearchFields as C, captureLogicalJourneySources as D, prepareCollectionProduction as E, sessionWorkerFailure as F, staticMaskCategory as G, readLogicalJourneyFinalMasks as H, privateCollectionDirectory as I, createConfiguredPreviewStream as J, readWorkspacePair as K, defaultParallelism as L, parseCollectionWorkspaceSummary as M, createSharedSessionPool as N, capturedJourneyScope as O, SessionWorkerError as P, createCleanup as Q, gitSeedsProvider as R, readOriginalSearchFields as S, checkReusableBundle as T, readConfiguredOutputInfo as U, privateJourneyDirectory as V, processJourneyMetadataFields as W, createTemporary as X, createInspectionProcessor as Y, removeNamedTemporarySpools as Z, readStaticSessionMasks as _, scanReviewFields as a, isWindowsAclFailure as at, writePrivateReviewPayload as b, readSessionScanRecords as c, verifyOutputShard as d, exclusiveLock as et, writeOutputShard as f, processJourneyMetadata as g, readCapturedOriginalRows as h, buildWorkScanBatches as i, windowsOwnerOnly as it, readCollectionIndex as j, renderJobDigest as k, scanPreparedSession as l, captureConfiguredSessionJob as m, verifyPreparedSessionSources as n, openPrivateFile as nt, createWorkPieces as o, windowsAclCodes as ot, openConfiguredUpload as p, listAgentSetup as q, prepareSessionScans as r, restrictToOwner as rt, readSessionScanFields as s, preparedScanConfiguration as t, makePrivateDirectory as tt, runConfiguredScanJob as u, staticSessionJobs as v, createCollectionArtifacts as w, readPrivateReviewPayload as x, writeLogicalJourneyBase as y, parallelismLimits as z };
16974
+ export { createCleanup as $, renderJobDigest as A, parallelismLimits as B, readOriginalSearchFields as C, prepareCollectionProduction as D, checkReusableBundle as E, SessionWorkerError as F, processJourneyMetadataFields as G, privateJourneyDirectory as H, sessionWorkerFailure as I, listAgentSetup as J, staticMaskCategory as K, privateCollectionDirectory as L, readCollectionIndex as M, parseCollectionWorkspaceSummary as N, captureLogicalJourneySources as O, createSharedSessionPool as P, removeNamedTemporarySpools as Q, defaultParallelism as R, readPrivateReviewPayload as S, createCollectionArtifacts as T, readLogicalJourneyFinalMasks as U, writeLogicalJourneyOutput as V, readConfiguredOutputInfo as W, createInspectionProcessor as X, createConfiguredPreviewStream as Y, createTemporary as Z, processJourneyMetadata as _, scanReviewFields as a, windowsOwnerOnly as at, writeLogicalJourneyBase as b, readSessionScanRecords as c, verifyOutputShard as d, safeError as et, writeOutputShard as f, readCapturedOriginalRows as g, captureConfiguredSessionJob as h, buildWorkScanBatches as i, restrictToOwner as it, runConfiguredSessionJob as j, capturedJourneyScope as k, scanPreparedSession as l, openConfiguredUpload as m, verifyPreparedSessionSources as n, makePrivateDirectory as nt, createWorkPieces as o, isWindowsAclFailure as ot, configuredSessionUploads as p, readWorkspacePair as q, prepareSessionScans as r, openPrivateFile as rt, readSessionScanFields as s, windowsAclCodes as st, preparedScanConfiguration as t, exclusiveLock as tt, runConfiguredScanJob as u, readStaticSessionMasks as v, readConfiguredSearchFields as w, writePrivateReviewPayload as x, staticSessionJobs as y, gitSeedsProvider as z };
@@ -1,4 +1,4 @@
1
- import { i as createExecutor, t as assertStoreHeap } from "./heap-BaTNC9kf.mjs";
1
+ import { i as createExecutor, t as assertStoreHeap } from "./heap-DiOlSa8T.mjs";
2
2
  import { parentPort } from "node:worker_threads";
3
3
  //#region packages/local-host/src/store/worker/entry.ts
4
4
  if (!parentPort) throw new Error("STORE_WORKER_REQUIRED");