@gitroll/tacitt-cli 0.4.1 → 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 (37) hide show
  1. package/dist/{agent-setup-Cb_spmGb.mjs → agent-setup-Bpsi-BCv.mjs} +2 -2
  2. package/dist/agent-setup-worker.mjs +5 -5
  3. package/dist/cli.mjs +36 -10
  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-eZTo0VYj.mjs → heap-DiOlSa8T.mjs} +6 -6
  9. package/dist/inspection-worker.mjs +4 -4
  10. package/dist/{job-Bi57uRU-.mjs → job-BII94L2c.mjs} +3 -3
  11. package/dist/{locate-U3-nkird.mjs → locate-CBiw-CJK.mjs} +5 -0
  12. package/dist/{model-BDrntocp.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-7uY266qY.mjs → query-CVqWNFYf.mjs} +822 -244
  17. package/dist/{run-CV6Io7CS.mjs → run-BGlf-W0M.mjs} +4 -4
  18. package/dist/{src-BESjwh7X.mjs → src-37kIclGK.mjs} +5 -4
  19. package/dist/{src-DSDRF7i6.mjs → src-CBTvOa44.mjs} +45 -2
  20. package/dist/{src-DIuh0LHk.mjs → src-D4nrfC2S.mjs} +165 -5
  21. package/dist/store-database-worker.mjs +1 -1
  22. package/dist/web/assets/index-D3g_ATU-.js +69 -0
  23. package/dist/web/index.html +1 -1
  24. package/package.json +1 -1
  25. package/skills/tacitt/SKILL.md +2 -2
  26. package/skills/tacitt/references/INDEX.md +10 -10
  27. package/skills/tacitt/references/journey.md +3 -3
  28. package/skills/tacitt/references/send.md +38 -12
  29. package/skills/tacitt/scripts/INDEX.md +36 -36
  30. package/skills/tacitt/scripts/journey-card-consolidation.mjs +2 -4
  31. package/skills/tacitt/scripts/journey-state.d.mts +30 -0
  32. package/skills/tacitt/scripts/journey-state.mjs +56 -3
  33. package/skills/tacitt/scripts/journey-tasks.d.mts +8 -0
  34. package/skills/tacitt/scripts/journey-tasks.mjs +4 -1
  35. package/skills/tacitt/scripts/privacy-validator.mjs +2 -0
  36. package/skills/tacitt/scripts/review.mjs +36 -5
  37. package/dist/web/assets/index-Dh4iG6x2.js +0 -69
@@ -1,7 +1,7 @@
1
- import { tn as sessionSchema } from "./locate-U3-nkird.mjs";
2
- import { t as createZstdFrameCheck$1 } from "./frame-waS5FnN5.mjs";
3
- import "./src-DSDRF7i6.mjs";
4
- import { a as isRecord } from "./model-BDrntocp.mjs";
1
+ import { tn as sessionSchema } from "./locate-CBiw-CJK.mjs";
2
+ import { t as createZstdFrameCheck$1 } from "./frame-IeDOLy1o.mjs";
3
+ import "./src-CBTvOa44.mjs";
4
+ import { a as isRecord } from "./model-DGTsARtV.mjs";
5
5
  import { constants } from "node:fs";
6
6
  import { z } from "zod";
7
7
  import { lstat, open, stat } from "node:fs/promises";
@@ -1,7 +1,7 @@
1
- import { An as nativeBoolean, Hn as defaultLimits, In as retainedMainTextNodes, Mn as nativeItems, Nn as nativeText, Qt as sourceSnapshotId, Tn as parseNativeRecord, Zt as observeSource, jn as nativeField, nr as ProcessingError, vn as walkNativeFields } from "./locate-U3-nkird.mjs";
2
- import { Ot as nativeAdapterVersions, ni as gitMetadataBudgetBytes, tt as reviewInventory } from "./src-DSDRF7i6.mjs";
3
- import { a as isRecord, i as errorCode, n as checkDiscoveryAbort, o as unresolvedMetadata, r as discoveryBounds, t as DiscoveryWarnings } from "./model-BDrntocp.mjs";
4
- import { c as previewLimits, d as checkOpenSource, f as checkSource, h as openSource, i as pageFits, l as previewSourceVersion, m as noSymlinks, p as fileSnapshot, r as previewHeapLimits, s as previewMessageSchema, u as createZstdFrameCheck } from "./run-CV6Io7CS.mjs";
1
+ import { An as nativeBoolean, Hn as defaultLimits, In as retainedMainTextNodes, Mn as nativeItems, Nn as nativeText, Qt as sourceSnapshotId, Tn as parseNativeRecord, Zt as observeSource, jn as nativeField, nr as ProcessingError, vn as walkNativeFields } from "./locate-CBiw-CJK.mjs";
2
+ import { Ot as nativeAdapterVersions, ni as gitMetadataBudgetBytes, tt as reviewInventory } from "./src-CBTvOa44.mjs";
3
+ import { a as isRecord, i as errorCode, n as checkDiscoveryAbort, o as unresolvedMetadata, r as discoveryBounds, t as DiscoveryWarnings } from "./model-DGTsARtV.mjs";
4
+ import { c as previewLimits, d as checkOpenSource, f as checkSource, h as openSource, i as pageFits, l as previewSourceVersion, m as noSymlinks, p as fileSnapshot, r as previewHeapLimits, s as previewMessageSchema, u as createZstdFrameCheck } from "./run-BGlf-W0M.mjs";
5
5
  import { a as titleHintLimits, n as titleHeapLimits, o as titleInputSchema, r as decodeTitleError, s as titleReplySchema } from "./heap-1FYhGds4.mjs";
6
6
  import { constants } from "node:fs";
7
7
  import { lstat, open, opendir, readFile, readdir, realpath, stat } from "node:fs/promises";
@@ -4869,6 +4869,7 @@ async function scanRoot(path, harness, state, warnings, signal) {
4869
4869
  id: randomUUID(),
4870
4870
  path: child,
4871
4871
  root,
4872
+ harnessRelativePath: `${basename(path)}/${relative(root, child).split(sep).join("/")}`,
4872
4873
  representation: entry.name.endsWith(".zst") ? "jsonl.zst" : "jsonl",
4873
4874
  snapshot
4874
4875
  };
@@ -1,4 +1,4 @@
1
- import { $ as bCountSchema, $n as scalarAfter, $t as fileIdentitySchema, A as bDuplicateMirror, B as bEvidenceReader, Bn as validatePlan, Bt as sessionPeriodSchema, C as validateBUnit, Ct as cardsSubmitSchema, D as uncoveredBObligations, Dn as entityDictionaryVersion, Dt as privacyResolveSchema, E as bLiterals, En as cleanupImplementationVersion, Et as packageConfirmActionSchema, Ft as termTypeInfo, G as subtractBRanges, Gn as detectStatic, H as codePointLength, Ht as ApplicationError, I as bIssue, It as termTypeSchema, J as bRetainedGroupSchema, Jt as reviewFamilies, Kt as familyNeedsReview, L as bOverlaps, Ln as validateProfile, Lt as termTypes, M as bLegacyBindings, Mt as reviewTermsResultSchema, N as bUnitFragments, Nt as termAssessmentSchema, O as indexBRanges, Ot as privacyTermKey, P as bAdoptedObligations, Pt as termOverrideValueSchema, Q as bAnchorSchema, Qt as sourceSnapshotId, R as unownedBObligations, Rn as orderProfile, Rt as deselectOutsidePeriod, S as validateBFields, St as cardsConfirmActionSchema, T as bLiteralTerms, Tt as emptyJourneyPrivacy, U as codePointSlice, Ut as UnfinishedJourneyError, V as bDigest, Vn as copyData, Vt as classificationTitleMaskSchema, W as createCodePointIndex, Wt as safeCode, X as bSessionDecisionSchema, Xn as createEntityMatcher, Xt as sourceKey, Y as bReviewSubmissionSchema, Yt as sourceGraph, Z as bTermSchema, Zt as observeSource, _ as semanticFindingSchema, _n as gapReasons, _t as hideConfirmSchema, a as reviewChunkSchema, at as journeyExceptionSchema, b as validateBReview, bn as staticDefaults, bt as journeyConfigurationSchema, c as textDigest, ct as journeyPreferenceScopeSchema, dt as nativeJourneySchema, en as inventorySchema, er as scalarBefore, et as bIdSchema, f as reviewAlignmentAuditSchema, ft as journeyGuidanceSchema, g as validateReviewAlignment, h as reviewFindingsDigest, hn as inspectionSemanticVersions, ht as journeyDescribeSchema, i as reviewBatchSchema, in as nativeSourceIdentitySchema, it as journeyDigestSchema, jt as reviewTermsInputSchema, l as validateReview, lt as journeyProjectTypeSchema, m as reviewAlignmentSchema, mn as currentDetectorVersion, mt as delegatedDecisionSchema, n as compileBFindings, nn as sourcePartSchema, nt as journeyAccessSchema, o as reviewDigest, ot as journeyIdSchema, p as reviewAlignmentInputSchema, pt as journeyInstructionInputSchema, q as bRepresentationSchema, qn as staticCategories, qt as familySelected, r as reviewBatchChunks, rt as journeyChoiceSchema, s as reviewSubmitSchema, st as journeyKindSchema, tr as defaultDetectionLimits, tt as bMethod, u as findingReferenceKey, ut as journeyWorkTypeSchema, vt as hidePlanInputSchema, w as bLiteralAdmitted, x as createBAnalysisUnits, xn as staticOptions, xt as cardAnswerActionSchema, y as validateBClassification, yn as createStaticProcessor, yt as hidePlanResourceSchema, z as bAnchorKey } from "./locate-U3-nkird.mjs";
1
+ import { $ as bCountSchema, $n as scalarAfter, $t as fileIdentitySchema, A as bDuplicateMirror, B as bEvidenceReader, Bn as validatePlan, Bt as sessionPeriodSchema, C as validateBUnit, Ct as cardsSubmitSchema, D as uncoveredBObligations, Dn as entityDictionaryVersion, Dt as privacyResolveSchema, E as bLiterals, En as cleanupImplementationVersion, Et as packageConfirmActionSchema, Ft as termTypeInfo, G as subtractBRanges, Gn as detectStatic, H as codePointLength, Ht as ApplicationError, I as bIssue, It as termTypeSchema, J as bRetainedGroupSchema, Jt as reviewFamilies, Kt as familyNeedsReview, L as bOverlaps, Ln as validateProfile, Lt as termTypes, M as bLegacyBindings, Mt as reviewTermsResultSchema, N as bUnitFragments, Nt as termAssessmentSchema, O as indexBRanges, Ot as privacyTermKey, P as bAdoptedObligations, Pt as termOverrideValueSchema, Q as bAnchorSchema, Qt as sourceSnapshotId, R as unownedBObligations, Rn as orderProfile, Rt as deselectOutsidePeriod, S as validateBFields, St as cardsConfirmActionSchema, T as bLiteralTerms, Tt as emptyJourneyPrivacy, U as codePointSlice, Ut as UnfinishedJourneyError, V as bDigest, Vn as copyData, Vt as classificationTitleMaskSchema, W as createCodePointIndex, Wt as safeCode, X as bSessionDecisionSchema, Xn as createEntityMatcher, Xt as sourceKey, Y as bReviewSubmissionSchema, Yt as sourceGraph, Z as bTermSchema, Zt as observeSource, _ as semanticFindingSchema, _n as gapReasons, _t as hideConfirmSchema, a as reviewChunkSchema, at as journeyExceptionSchema, b as validateBReview, bn as staticDefaults, bt as journeyConfigurationSchema, c as textDigest, ct as journeyPreferenceScopeSchema, dt as nativeJourneySchema, en as inventorySchema, er as scalarBefore, et as bIdSchema, f as reviewAlignmentAuditSchema, ft as journeyGuidanceSchema, g as validateReviewAlignment, h as reviewFindingsDigest, hn as inspectionSemanticVersions, ht as journeyDescribeSchema, i as reviewBatchSchema, in as nativeSourceIdentitySchema, it as journeyDigestSchema, jt as reviewTermsInputSchema, l as validateReview, lt as journeyProjectTypeSchema, m as reviewAlignmentSchema, mn as currentDetectorVersion, mt as delegatedDecisionSchema, n as compileBFindings, nn as sourcePartSchema, nt as journeyAccessSchema, o as reviewDigest, ot as journeyIdSchema, p as reviewAlignmentInputSchema, pt as journeyInstructionInputSchema, q as bRepresentationSchema, qn as staticCategories, qt as familySelected, r as reviewBatchChunks, rt as journeyChoiceSchema, s as reviewSubmitSchema, st as journeyKindSchema, tr as defaultDetectionLimits, tt as bMethod, u as findingReferenceKey, ut as journeyWorkTypeSchema, vt as hidePlanInputSchema, w as bLiteralAdmitted, x as createBAnalysisUnits, xn as staticOptions, xt as cardAnswerActionSchema, y as validateBClassification, yn as createStaticProcessor, yt as hidePlanResourceSchema, z as bAnchorKey } from "./locate-CBiw-CJK.mjs";
2
2
  import { z } from "zod";
3
3
  import { createHash, createHmac, createSecretKey, randomUUID } from "node:crypto";
4
4
  import { setTimeout as setTimeout$1 } from "node:timers/promises";
@@ -1566,10 +1566,50 @@ const sendItemSchema = z.object({
1566
1566
  /** The receipt whose bytes were PUT but not yet completed: the next step completes it (BL-210). */
1567
1567
  uploadedReceiptId: journeyIdSchema.nullable().optional(),
1568
1568
  /**
1569
+ * Bare `settings_changed` refusals in a row for the uploaded bytes: Passport's scope kept
1570
+ * moving, so the next completion waits longer (ADR 0235). Cleared with the upload marker.
1571
+ */
1572
+ busyRefusals: count$13.positive().optional(),
1573
+ /**
1569
1574
  * Passport answered `bundle_mismatch` to this Work's checksum upload: the rest of this Send
1570
1575
  * uploads through staging (ADR 0231).
1571
1576
  */
1572
1577
  checksumUploadRefused: z.literal(true).optional(),
1578
+ /** Write-ahead upload intent; completion probes recover an unacknowledged blob PUT. */
1579
+ sessionUpload: z.object({
1580
+ key: journeyDigestSchema,
1581
+ sha256: journeyDigestSchema
1582
+ }).strict().nullable().optional(),
1583
+ /** Exact write-ahead membership request; never rebase it after an uncertain PUT. */
1584
+ sessionMembership: z.object({
1585
+ workId: journeyIdSchema,
1586
+ expectedRevision: count$13,
1587
+ keys: z.array(journeyDigestSchema),
1588
+ title: z.string(),
1589
+ access
1590
+ }).strict().optional(),
1591
+ /** Membership readback retained for visible conflict recovery. */
1592
+ membershipConflict: z.object({
1593
+ revision: count$13,
1594
+ keys: z.array(journeyDigestSchema)
1595
+ }).strict().optional(),
1596
+ /** Informational readback for a freshly prepared recovery; never a write fence. */
1597
+ recoveryReview: z.object({
1598
+ previousSendId: journeyIdSchema,
1599
+ revision: count$13,
1600
+ currentAccess: z.enum([
1601
+ "public",
1602
+ "private",
1603
+ "removed"
1604
+ ]).nullable(),
1605
+ currentKeys: z.array(journeyDigestSchema),
1606
+ proposedKeys: z.array(journeyDigestSchema)
1607
+ }).strict().optional(),
1608
+ /** Acknowledged membership revision and later scan identity; never a write-ahead intent. */
1609
+ sessionAssembly: z.object({
1610
+ revision: count$13,
1611
+ scanId: journeyIdSchema.nullable()
1612
+ }).strict().optional(),
1573
1613
  status: z.enum([
1574
1614
  "ready",
1575
1615
  "target",
@@ -1582,6 +1622,8 @@ const sendItemSchema = z.object({
1582
1622
  error: z.string().nullable()
1583
1623
  }).strict();
1584
1624
  const journeySendSchema = z.object({
1625
+ /** Passport advertised parallel-completes when this Send was confirmed (ADR 0235). */
1626
+ parallelCompletes: z.literal(true).optional(),
1585
1627
  id: journeyIdSchema,
1586
1628
  journeyId: journeyIdSchema,
1587
1629
  revision: count$13,
@@ -1616,7 +1658,7 @@ const journeySendSchema = z.object({
1616
1658
  error: z.string().nullable(),
1617
1659
  /**
1618
1660
  * When this Send replaced the owner's earlier Passport Works and how many it retired; a
1619
- * native Send is completed only after this is recorded (ADR 0204).
1661
+ * historical marker is retained for compatibility only (superseded by ADR 0242).
1620
1662
  */
1621
1663
  replaced: z.object({
1622
1664
  at: z.iso.datetime(),
@@ -6993,6 +7035,7 @@ const manualUploadSchema = z.object({
6993
7035
  subject: z.string().nullable(),
6994
7036
  confirmedAt: z.iso.datetime().nullable(),
6995
7037
  status: journeySendSchema.shape.status,
7038
+ parallelCompletes: journeySendSchema.shape.parallelCompletes,
6996
7039
  items: z.array(sendItemSchema),
6997
7040
  /** The result slot holding each item's primary ZIP, keyed by the item's logical Work ID. */
6998
7041
  slots: z.record(journeyIdSchema, count$2),
@@ -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-DSDRF7i6.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";
@@ -15416,6 +15416,166 @@ async function openConfiguredUpload(input, signal = new AbortController().signal
15416
15416
  }
15417
15417
  }
15418
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
15419
15579
  //#region packages/artifact/src/configured/output/shard/write.ts
15420
15580
  const zipOptions = {
15421
15581
  useWebWorkers: false,
@@ -16811,4 +16971,4 @@ async function verifyPreparedSessionSources(prepared, input, signal) {
16811
16971
  }
16812
16972
  }
16813
16973
  //#endregion
16814
- 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-eZTo0VYj.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");