@gitroll/tacitt-cli 0.6.10 → 0.6.12

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 (63) hide show
  1. package/README.md +47 -4
  2. package/bin/INDEX.md +6 -4
  3. package/bin/tacitt.cjs +1 -0
  4. package/dist/{agent-setup-LPd8WEsN.mjs → agent-setup-B12VbvN_.mjs} +2 -2
  5. package/dist/agent-setup-worker.mjs +5 -5
  6. package/dist/cli.mjs +39 -25
  7. package/dist/codex-title-worker.mjs +2 -2
  8. package/dist/configured-preview-worker.mjs +5 -5
  9. package/dist/configured-session-worker.mjs +27 -27
  10. package/dist/{frame-ByT1xayJ.mjs → frame-B3He21G8.mjs} +1 -1
  11. package/dist/{heap-CM298Yu0.mjs → heap-Blrat--4.mjs} +469 -30
  12. package/dist/inspection-worker.mjs +4 -4
  13. package/dist/{job-BHIwElNF.mjs → job-CBuIMTQ0.mjs} +57 -22
  14. package/dist/{locate-Cwv6WH8n.mjs → locate-D-ZaHpI0.mjs} +184 -18
  15. package/dist/{model-zvn5GUJ9.mjs → model-DR9odhWP.mjs} +1 -1
  16. package/dist/operation-executor.mjs +3 -3
  17. package/dist/preview-worker.mjs +1 -1
  18. package/dist/privacy-validator.mjs +49 -2
  19. package/dist/{query-By41gaKm.mjs → query-BYDcNKy2.mjs} +1869 -716
  20. package/dist/{run-ZQx7p4Rw.mjs → run-DQ9xyKSt.mjs} +4 -4
  21. package/dist/session-process.mjs +20 -0
  22. package/dist/{src-D_DfY--2.mjs → src-CKQlTA2Z.mjs} +297 -207
  23. package/dist/{src-3jvMvSQn.mjs → src-DeNJ8vOD.mjs} +535 -140
  24. package/dist/{src-BqtdFVq7.mjs → src-Do-qzuMn.mjs} +2329 -1786
  25. package/dist/store-database-worker.mjs +1 -1
  26. package/dist/web/assets/index-BgDdPL1c.js +172 -0
  27. package/dist/web/assets/index-DzOozqms.css +1 -0
  28. package/dist/web/index.html +3 -2
  29. package/package.json +2 -1
  30. package/skills/INDEX.md +6 -4
  31. package/skills/tacitt/INDEX.md +7 -6
  32. package/skills/tacitt/SKILL.md +11 -11
  33. package/skills/tacitt/references/INDEX.md +14 -11
  34. package/skills/tacitt/references/b-method.md +4 -4
  35. package/skills/tacitt/references/bootstrap.md +19 -5
  36. package/skills/tacitt/references/classification.md +4 -4
  37. package/skills/tacitt/references/commands.md +51 -34
  38. package/skills/tacitt/references/journey.md +7 -7
  39. package/skills/tacitt/references/parallel-review.md +35 -35
  40. package/skills/tacitt/references/send.md +15 -6
  41. package/skills/tacitt/scripts/INDEX.md +40 -37
  42. package/skills/tacitt/scripts/answer.mjs +91 -15
  43. package/skills/tacitt/scripts/journey-card-consolidation.mjs +1 -1
  44. package/skills/tacitt/scripts/journey-classification-metadata.mjs +75 -26
  45. package/skills/tacitt/scripts/journey-classification-progress.mjs +1 -2
  46. package/skills/tacitt/scripts/journey-classification-tasks.mjs +28 -8
  47. package/skills/tacitt/scripts/journey-classification.mjs +6 -1
  48. package/skills/tacitt/scripts/journey-consolidation.mjs +1 -0
  49. package/skills/tacitt/scripts/journey-panel-host.d.mts +2 -0
  50. package/skills/tacitt/scripts/journey-panel-host.mjs +25 -2
  51. package/skills/tacitt/scripts/journey-scan-timing.d.mts +5 -0
  52. package/skills/tacitt/scripts/journey-scan-timing.mjs +31 -4
  53. package/skills/tacitt/scripts/journey-state.d.mts +9 -1
  54. package/skills/tacitt/scripts/journey-state.mjs +95 -8
  55. package/skills/tacitt/scripts/journey-tasks.d.mts +1 -0
  56. package/skills/tacitt/scripts/journey-tasks.mjs +24 -9
  57. package/skills/tacitt/scripts/journey.d.mts +44 -31
  58. package/skills/tacitt/scripts/journey.mjs +34 -7
  59. package/skills/tacitt/scripts/privacy-validator.mjs +188 -11
  60. package/skills/tacitt/scripts/review.d.mts +7 -6
  61. package/skills/tacitt/scripts/review.mjs +922 -205
  62. package/dist/web/assets/index-B14e6_-z.js +0 -174
  63. package/dist/web/assets/index-CYJBq1px.css +0 -1
@@ -1,7 +1,7 @@
1
- import { X as createInspectionProcessor } from "./src-3jvMvSQn.mjs";
2
- import { Dn as createStaticProcessor } from "./locate-Cwv6WH8n.mjs";
3
- import { l as createNativeAdapters, u as createGitNameSeedProvider } from "./src-D_DfY--2.mjs";
4
- import { G as validateInspectionRequest } from "./src-BqtdFVq7.mjs";
1
+ import { Q as createInspectionProcessor } from "./src-DeNJ8vOD.mjs";
2
+ import { Nn as createStaticProcessor } from "./locate-D-ZaHpI0.mjs";
3
+ import { l as createNativeAdapters, u as createGitNameSeedProvider } from "./src-CKQlTA2Z.mjs";
4
+ import { G as validateInspectionRequest } from "./src-Do-qzuMn.mjs";
5
5
  import "./messages-D3m3bhva.mjs";
6
6
  import { z } from "zod";
7
7
  import { parentPort, workerData } from "node:worker_threads";
@@ -1,7 +1,7 @@
1
- import { A as renderJobDigest, D as prepareCollectionProduction, E as checkReusableBundle, L as privateCollectionDirectory, M as readCollectionIndex, N as parseCollectionWorkspaceSummary, V as writeLogicalJourneyOutput, W as readConfiguredOutputInfo, at as windowsOwnerOnly, b as writeLogicalJourneyBase, d as verifyOutputShard, f as writeOutputShard, nt as makePrivateDirectory, ot as isWindowsAclFailure, rt as openPrivateFile, w as readConfiguredSearchFields, z as gitSeedsProvider } from "./src-3jvMvSQn.mjs";
2
- import { $t as safeField, F as bClassificationKey, Ft as termTypeInfo, H as codePointLength, Ht as journeyProfileAddressActionSchema, K as utf16Offset, Kt as passportAddressSchema, N as bUnitFragments, Qt as safeCode, Ut as journeyProfileLinksActionSchema, V as bDigest, Xt as ApplicationError, b as validateBReview, c as textDigest, h as reviewFindingsDigest, ht as journeyDescribeSchema, jt as reviewTermsInputSchema, l as validateReview, n as compileBFindings, nn as reviewFamilies, r as reviewBatchChunks, s as reviewSubmitSchema, t as locateTerms, z as bAnchorKey, zt as filterInventoryByPeriod } from "./locate-Cwv6WH8n.mjs";
3
- import { $n as reviewRepairInputSchema, An as addHideIndexTokens, C as rebindReviewOverlay, Ct as sendActionSchema, D as staticallyHiddenFindings, Dn as renderedHideValue, Dr as journeyPreviewSchema, Dt as sendStartSchema, E as guardedFindingText, En as readConfirmedHideChange, Er as journeyFindingsSchema, Et as sendRequestSchema, Fr as nativeEventsSchema, Gn as maskedHitsStale, Gt as reviewCompileSchema, H as inspectionStartSchema, Hr as staticSessionResourceSchema, Ir as nativeGetSchema, K as inspectionQuerySchema, Kt as journeyContextQuerySchema, Lr as nativeRespondSchema, Lt as journeyReviewStorageQuerySchema, Nn as packHideIndex, Or as journeyRenderInputSchema, Qn as reviewCandidateResourceSchema, S as rebindReviewAlignment, St as replaceSensitiveTermsSchema, T as reviewBatchReuse, Tr as journeyFindingImpactSchema, Tt as sendPrepareSchema, V as inspectionCancelSchema, Zn as reviewCandidateInputSchema, _i as defaultScopedSettings, _t as manualUploadStartSchema, a as bCrossSegmentReviewSchema, an as journeyPlaceSchema, b as isGenericPublicTerm, bt as maximumTermsFileBytes, c as reconstructBFields, ci as selectionBatchSchema, di as producerVersion, en as journeyPolicyRespondSchema, er as reviewRepairResourceSchema, f as selectedValueMembers, fi as stateSchema, ft as manualUploadActionSchema, gn as sessionReviewQuerySchema, hn as sessionReviewInputSchema, hr as journeyInventoryQuerySchema, ht as manualUploadPrepareSchema, i as validateBCrossSegmentReview, ir as planBRepair, jn as hideKeyId, kn as termHideAdditions, kr as journeyRenderSchema, li as selectionSchema, mt as manualUploadChoiceSchema, n as scanBatchEquivalenceDigest, nn as journeyResourceQuerySchema, nr as bReviewDigest, nt as settingsQuerySchema, o as bRereadDigest, oi as commandSchema, p as splitSelectorValues, pn as sessionRereadInputSchema, r as locateTermEvidence, rt as readWorkspaceOutcomes, s as reconcileBSession, si as packageCommandSchema, sn as reviewAttemptResourceSchema, t as scanBatchContextDigest, tt as settingsBatchSchema, un as sessionReconcileInputSchema, ut as resolveFailureLocation, vi as freezeConfiguration, w as rebindReviewSubmit, wn as confirmedHideAdditions, wr as journeyClassificationSessionsSchema, wt as sendChoiceSchema, x as bReviewScope, yi as selectFrozenConfiguration, yn as sessionUsefulnessInputSchema, zn as confirmedHideGroupIds } from "./src-BqtdFVq7.mjs";
4
- 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, 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-CM298Yu0.mjs";
1
+ import { E as readConfiguredSearchFields, F as parseCollectionWorkspaceSummary, K as readConfiguredOutputInfo, M as renderJobDigest, O as checkReusableBundle, P as readCollectionIndex, S as writeLogicalJourneyBase, U as writeLogicalJourneyOutput, V as gitSeedsProvider, at as makePrivateDirectory, ct as windowsOwnerOnly, k as prepareCollectionProduction, lt as isWindowsAclFailure, m as writeOutputShard, ot as openPrivateFile, p as verifyOutputShard, z as privateCollectionDirectory } from "./src-DeNJ8vOD.mjs";
2
+ import { F as bUnitFragments, Gt as filterInventoryByPeriod, J as utf16Offset, Jt as journeyProfileAddressActionSchema, L as bClassificationKey, Lt as reviewTermsInputSchema, Qt as passportAddressSchema, S as validateBReview, U as bDigest, V as bAnchorKey, Vt as termTypeInfo, W as codePointLength, Yt as journeyProfileLinksActionSchema, _ as reviewFindingsDigest, a as reviewBatchChunks, an as safeField, cn as reviewFamilies, d as validateReview, i as compileBFindings, in as safeCode, l as reviewSubmitSchema, n as matchesReadReceipts, nn as ApplicationError, t as locateTerms, u as textDigest, yt as journeyDescribeSchema } from "./locate-D-ZaHpI0.mjs";
3
+ import { $t as journeyPlaceSchema, Ai as stateSchema, Ar as journeyRenderInputSchema, Br as nativeRespondSchema, C as rebindReviewOverlay, Ct as sendActionSchema, D as staticallyHiddenFindings, Di as selectionSchema, Dr as journeyFindingImpactSchema, Dt as sendStartSchema, E as guardedFindingText, Ei as selectionBatchSchema, Er as journeyClassificationSessionsSchema, Et as sendRequestSchema, Fi as defaultScopedSettings, Gn as confirmedHideAdditions, H as inspectionStartSchema, Hr as retryReviewActionSchema, Ht as journeyContextQuerySchema, Ii as freezeConfiguration, Jn as renderedHideValue, K as inspectionQuerySchema, Li as selectFrozenConfiguration, Nt as journeyReviewStorageQuerySchema, Or as journeyFindingsSchema, Pn as journeyInventoryQuerySchema, Qn as hideKeyId, Rr as nativeEventsSchema, S as rebindReviewAlignment, Sn as planBRepair, St as replaceSensitiveTermsSchema, T as reviewBatchReuse, Ti as packageCommandSchema, Tt as sendPrepareSchema, V as inspectionCancelSchema, Vt as reviewCompileSchema, Xn as termHideAdditions, Xt as journeyResourceQuerySchema, Zn as addHideIndexTokens, _n as reviewRepairInputSchema, _t as manualUploadStartSchema, a as bCrossSegmentReviewSchema, b as isGenericPublicTerm, bn as bReviewDigest, bt as maximumTermsFileBytes, c as reconstructBFields, er as packHideIndex, f as selectedValueMembers, fr as maskedHitsStale, ft as manualUploadActionSchema, gn as reviewCandidateResourceSchema, hn as reviewCandidateInputSchema, ht as manualUploadPrepareSchema, i as validateBCrossSegmentReview, ii as staticSessionResourceSchema, in as sessionReconcileInputSchema, jr as journeyRenderSchema, ki as producerVersion, kr as journeyPreviewSchema, ln as sessionReviewInputSchema, mt as manualUploadChoiceSchema, n as scanBatchEquivalenceDigest, nt as settingsQuerySchema, o as bRereadDigest, or as confirmedHideGroupIds, p as splitSelectorValues, pn as sessionUsefulnessInputSchema, qn as readConfirmedHideChange, qt as journeyPolicyRespondSchema, r as locateTermEvidence, rt as readWorkspaceOutcomes, s as reconcileBSession, sn as sessionRereadInputSchema, t as scanBatchContextDigest, tn as reviewAttemptResourceSchema, tt as settingsBatchSchema, un as sessionReviewQuerySchema, ut as resolveFailureLocation, vn as reviewRepairResourceSchema, w as rebindReviewSubmit, wi as commandSchema, wt as sendChoiceSchema, x as bReviewScope, zr as nativeGetSchema } from "./src-Do-qzuMn.mjs";
4
+ import { $ as validateState, A as resourceSelectionQuerySchema, B as termReuseQuerySchema, C as loadAcceptedReview, D as aggregateUsefulness, E as loadPrivateResource, F as validateUnitCandidate, G as validateBatchBody, H as privateReviewHash, I as reuseQuerySchema, J as ownership, K as requireActiveBatch, L as batchQuery, M as evaluateUnitEvidence, N as sameCandidateRequest, O as sessionUsefulnessRecommendation, P as validateCandidateAttempt, Q as readStoredState, R as isPrivateResourceKind, S as validateSessionBindings, T as loadBatch, U as batchHeader, V as scanAliasRequestKey, W as createJourneyPayloadFiles, X as withDatabase, Y as validateDatabase, Z as readBundleDirectory, _ as loadReconciliation, _t as errorCode, a as decodeError, at as finishReset, b as validatePreparationSelection, c as dropsAnchor, ct as present, d as parseDelivery, dt as recheckPrivatePath, et as checkVersion, f as validateCandidate, ft as stateDirectory, g as loadPreparedBodies, gt as StoreError, h as loadPreparation, ht as withFileCheckTimings, i as createExecutor, it as databaseName, j as inspectionQuerySchema$1, k as sessionQuery, l as replySchema, lt as privatePath, m as loadStatus, mt as withStateSnapshot, n as releaseInheritedHeapFlags, nt as beginReset, o as ProtocolError, ot as hasResetMarker, p as classificationJourneyCommit, pt as syncDirectory, q as initializeAndClaim, r as storeHeapLimits, rt as createDatabaseFile, s as allowedReplies, st as inspectStateFiles, tt as schemaVersion, u as operations, ut as readResetMarker, v as loadRereadBodies, vt as isCoordinationBusy, w as loadAuthenticatedReview, x as validateSessionReconciliation, y as loadSessionBodies, yt as isSqliteCorruption, z as privateResourceHeader } from "./heap-Blrat--4.mjs";
5
5
  import { constants, write } from "node:fs";
6
6
  import { z } from "zod";
7
7
  import { copyFile, link, lstat, mkdir, mkdtemp, open, opendir, readFile, readdir, realpath, rename, rm, unlink, writeFile } from "node:fs/promises";
@@ -20,8 +20,8 @@ import { AsyncLocalStorage } from "node:async_hooks";
20
20
  import { ZipWriter } from "@zip.js/zip.js/index-native.js";
21
21
  import { tmpdir } from "node:os";
22
22
  import { pipeline } from "node:stream/promises";
23
- import { DatabaseSync } from "node:sqlite";
24
23
  import { Worker } from "node:worker_threads";
24
+ import { DatabaseSync } from "node:sqlite";
25
25
  import { quote } from "shell-quote";
26
26
  //#region packages/file-privacy/src/sharing.ts
27
27
  const sharingCodes = /* @__PURE__ */ new Set([
@@ -595,6 +595,9 @@ const operation = z.enum([
595
595
  "journey.current",
596
596
  "journey.resources",
597
597
  "journey.send.load",
598
+ "journey.send.current",
599
+ "journey.send.transfer",
600
+ "journey.send.output",
598
601
  "journey.send.commit",
599
602
  "manual.upload.load",
600
603
  "manual.upload.commit",
@@ -640,6 +643,7 @@ const operation = z.enum([
640
643
  "journey.terms.contexts",
641
644
  "journey.terms.propose.select",
642
645
  "journey.terms.propose.finish",
646
+ "journey.terms.reopen-empty",
643
647
  "journey.terms.select",
644
648
  "journey.terms.finish",
645
649
  "journey.terms.read",
@@ -649,9 +653,13 @@ const operation = z.enum([
649
653
  "journey.commit",
650
654
  "journey.commit.checked",
651
655
  "journey.classification.commit",
656
+ "journey.receipt.revision",
652
657
  "journey.events",
653
658
  "journey.inventory",
654
659
  "journey.preparation.progress",
660
+ "journey.preparation.state",
661
+ "journey.preparation.permission",
662
+ "journey.preparation.update",
655
663
  "journey.unsorted.reviewed",
656
664
  "journey.unsorted.categories",
657
665
  "journey.work.candidates",
@@ -857,8 +865,10 @@ const nativePanelRespondSchema = z.object({
857
865
  kind: z.literal("retry-work"),
858
866
  workId: z.uuid()
859
867
  }).strict(),
868
+ retryReviewActionSchema,
860
869
  journeyProfileAddressActionSchema,
861
- journeyProfileLinksActionSchema
870
+ journeyProfileLinksActionSchema,
871
+ z.object({ kind: z.literal("account-read") }).strict()
862
872
  ])
863
873
  }).strict();
864
874
  function createRouter(application, account, stopping, delivery, nativeInspection, agentPresence) {
@@ -926,7 +936,7 @@ function createRouter(application, account, stopping, delivery, nativeInspection
926
936
  }),
927
937
  send: t.router({
928
938
  request: t.procedure.input(sendRequestSchema).mutation(({ input }) => sending().request(input, "panel")),
929
- get: t.procedure.input(sendAddress.partial({ sendId: true })).query(({ input, signal }) => readThroughContention(() => sending().get(input), signal)),
939
+ get: t.procedure.input(sendAddress.partial({ sendId: true }).extend({ observedRevision: z.number().int().nonnegative().optional() })).query(({ input, signal }) => readThroughContention(() => sending().get(input), signal)),
930
940
  prepare: t.procedure.input(sendPrepareSchema).mutation(({ input, signal }) => sending().prepare(input, signal)),
931
941
  start: t.procedure.input(sendStartSchema).mutation(({ input, signal }) => sending().start(input, signal)),
932
942
  respond: t.procedure.input(sendChoiceSchema).mutation(({ input }) => sending().respond(input)),
@@ -934,6 +944,8 @@ function createRouter(application, account, stopping, delivery, nativeInspection
934
944
  resume: t.procedure.input(sendActionSchema).mutation(({ input }) => sending().resume(input)),
935
945
  withdraw: t.procedure.input(sendActionSchema).mutation(({ input }) => sending().withdraw(input)),
936
946
  advance: t.procedure.input(sendAddress).mutation(({ input }) => sending().advance(input, stopping)),
947
+ uploadAssessments: t.procedure.input(sendAddress).query(({ input }) => sending().uploadAssessments(input)),
948
+ ownedPassport: t.procedure.input(sendAddress).query(({ input, signal }) => sending().ownedPassport(input, signal ?? stopping)),
937
949
  ownerProfile: t.procedure.query(({ signal }) => sending().ownerProfile(signal ?? stopping)),
938
950
  addressTaken: t.procedure.input(z.object({ address: passportAddressSchema }).strict()).query(({ input, signal }) => sending().addressTaken(input, signal ?? stopping)),
939
951
  saveSentProfile: t.procedure.input(z.object({ journeyId: z.uuid() }).strict()).mutation(({ input }) => sending().saveSentProfile(input, stopping))
@@ -4496,13 +4508,13 @@ function aliasTerms(canonical, target, terms) {
4496
4508
  locateTermEvidence([target], result, locateTerms([target], result).located);
4497
4509
  return result;
4498
4510
  }
4499
- const digestId$1 = (digest) => `${digest.slice(0, 8)}-${digest.slice(8, 12)}-4${digest.slice(13, 16)}-8${digest.slice(17, 20)}-${digest.slice(20, 32)}`;
4500
4511
  /** Partial judgments remain durable; only the final accepted pack completes the alias. */
4501
4512
  function createScanAliasResolver(access, files, record) {
4502
4513
  return async (input) => {
4503
4514
  const requests = await access.staged(async (leg, signal) => {
4504
4515
  const selected = await leg.run("journey.terms.select-aliases", input);
4505
- const state = await leg.run("journey.current", input);
4516
+ if (selected.length === 0) return [];
4517
+ const state = await leg.run("journey.preparation.state", input);
4506
4518
  if (!state) throw new ApplicationError("UNKNOWN_ITEM");
4507
4519
  const requests = [];
4508
4520
  for (const item of selected) {
@@ -4515,11 +4527,7 @@ function createScanAliasResolver(access, files, record) {
4515
4527
  const body = termPackBodySchema.parse(await files.read(input.journeyId, "term-pack", reference.idempotencyKey, reference.payload, signal));
4516
4528
  const unit = body.units.find((unit) => unit.batchId === canonical.id);
4517
4529
  if (!unit || unit.batchDigest !== canonical.digest || unit.workId !== canonical.workId || body.journeyId !== input.journeyId || body.packId !== reference.packId || body.idempotencyKey !== reference.idempotencyKey || body.requestHash !== reference.requestHash || receiptHash !== reference.requestHash) throw new ApplicationError("CORRUPTED_STATE");
4518
- const key = digestId$1(textDigest(JSON.stringify([
4519
- "scan-alias-v1",
4520
- alias,
4521
- reference.idempotencyKey
4522
- ])));
4530
+ const key = scanAliasRequestKey(alias, reference.idempotencyKey);
4523
4531
  requests.push({
4524
4532
  journeyId: input.journeyId,
4525
4533
  idempotencyKey: key,
@@ -4547,7 +4555,7 @@ function createScanAliasResolver(access, files, record) {
4547
4555
  * private payload is written, then one transaction records the pack.
4548
4556
  */
4549
4557
  function createStagedTerms(access, files) {
4550
- const recordTerms = (raw) => access.staged(async (leg, signal) => {
4558
+ const recordTerms = (raw, trustedReuse = false) => access.staged(async (leg, signal) => {
4551
4559
  const input = reviewTermsInputSchema.parse(raw);
4552
4560
  const requestHash = textDigest(JSON.stringify(input));
4553
4561
  const before = await leg.run("journey.terms.select", {
@@ -4557,6 +4565,10 @@ function createStagedTerms(access, files) {
4557
4565
  if (before.replay) return before.replay;
4558
4566
  const batches = [];
4559
4567
  for (const stored of before.batches) batches.push(await loadBatch(files, stored, signal));
4568
+ if (input.completeUnits && !trustedReuse) for (const [index, batch] of batches.entries()) {
4569
+ const proof = input.units[index]?.coverage;
4570
+ if (!proof || proof.attemptId !== input.packId || !matchesReadReceipts(batch, input.packId, proof.receipts)) throw new ApplicationError("INVALID_SELECTION", "incompleteReviewCoverage");
4571
+ }
4560
4572
  const admitted = [...input.terms.entries()].filter(([, term]) => !isGenericPublicTerm(term));
4561
4573
  const terms = admitted.map(([, term]) => term);
4562
4574
  const { located, kept, unlocated, unlocatedIndices } = locateTerms(batches, terms);
@@ -4615,7 +4627,7 @@ function createStagedTerms(access, files) {
4615
4627
  confirmedHideDelta
4616
4628
  });
4617
4629
  });
4618
- const resolveScanAliases = createScanAliasResolver(access, files, recordTerms);
4630
+ const resolveScanAliases = createScanAliasResolver(access, files, (input) => recordTerms(input, true));
4619
4631
  return {
4620
4632
  resolveScanAliases,
4621
4633
  async recordTerms(input) {
@@ -4671,7 +4683,7 @@ function createStagedTerms(access, files) {
4671
4683
  completeUnits: true,
4672
4684
  units: slice,
4673
4685
  terms: []
4674
- });
4686
+ }, true);
4675
4687
  }
4676
4688
  }
4677
4689
  };
@@ -4791,7 +4803,7 @@ function createStagedJourney(access, root, databaseId) {
4791
4803
  async putBatch(batch) {
4792
4804
  await access.staged(async (leg, signal) => {
4793
4805
  signal.throwIfAborted();
4794
- const state = await leg.run("journey.current", { journeyId: batch.journeyId });
4806
+ const state = await leg.run("journey.preparation.state", { journeyId: batch.journeyId });
4795
4807
  if (!state) throw new ApplicationError("UNKNOWN_ITEM");
4796
4808
  await putStagedBatch(leg, signal, state, batch, files);
4797
4809
  });
@@ -5058,10 +5070,16 @@ async function openStore(options, backupObsolete) {
5058
5070
  sessionReviewStatus: (input) => stagedJourney.sessionReviewStatus(input),
5059
5071
  reviewAttempts: (input) => access.run("journey.review.attempts", input),
5060
5072
  acknowledgeSessionUsefulness: (input) => stagedJourney.acknowledgeSessionUsefulness(input),
5073
+ readSendOutput: (input) => access.run("journey.send.output", input),
5074
+ preparationState: (journeyId) => access.run("journey.preparation.state", { journeyId }),
5075
+ preparationPermission: (journeyId) => access.run("journey.preparation.permission", { journeyId }),
5076
+ updatePreparation: (input) => access.run("journey.preparation.update", input),
5061
5077
  current: (journeyId) => access.run("journey.current", journeyId ? { journeyId } : {}),
5062
5078
  commit: (input) => stagedJourney.commit(input),
5079
+ receiptRevision: (input) => access.run("journey.receipt.revision", input),
5063
5080
  commitClassification: (input) => stagedJourney.commitClassification(input),
5064
5081
  hideIndexKey: (journeyId) => stagedJourney.hideIndexKey(journeyId),
5082
+ reopenEmpty: (input) => access.run("journey.terms.reopen-empty", input),
5065
5083
  recordTerms: (input) => stagedJourney.recordTerms(input),
5066
5084
  journeyTerms: (input) => stagedJourney.journeyTerms(input),
5067
5085
  events: (journeyId, after, requireCurrent) => access.run("journey.events", {
@@ -5071,11 +5089,18 @@ async function openStore(options, backupObsolete) {
5071
5089
  })
5072
5090
  },
5073
5091
  journeySend: {
5074
- loadSend: (journeyId, sendId) => access.run("journey.send.load", {
5092
+ isCurrentSend: (journeyId, sendId, revision) => access.run("journey.send.current", {
5093
+ journeyId,
5094
+ sendId,
5095
+ revision
5096
+ }),
5097
+ loadSend: (journeyId, sendId, observedRevision) => access.run("journey.send.load", {
5075
5098
  journeyId,
5076
- ...sendId ? { sendId } : {}
5099
+ ...sendId ? { sendId } : {},
5100
+ ...observedRevision !== void 0 ? { observedRevision } : {}
5077
5101
  }),
5078
- commitSend: (input) => access.run("journey.send.commit", input)
5102
+ commitSend: (input) => access.run("journey.send.commit", input),
5103
+ checkpointTransfer: (input) => access.run("journey.send.transfer", input)
5079
5104
  },
5080
5105
  manualUpload: {
5081
5106
  load: (uploadId) => access.run("manual.upload.load", uploadId ? { uploadId } : {}),
@@ -5646,7 +5671,17 @@ async function readRemoteState(stateDir, journeyId) {
5646
5671
  decisions: z.record(z.string(), z.boolean()),
5647
5672
  parents: z.record(z.string(), z.string()),
5648
5673
  copied: z.array(attachment),
5649
- failures: z.array(z.string())
5674
+ failures: z.array(z.string()),
5675
+ sourceFailureCounts: z.partialRecord(z.enum([
5676
+ "source-changed",
5677
+ "source-inaccessible",
5678
+ "source-missing",
5679
+ "compressed-decode",
5680
+ "invalid-json",
5681
+ "record-limit",
5682
+ "invalid-utf8",
5683
+ "other"
5684
+ ]), z.number().int().positive()).optional()
5650
5685
  }).strict().parse(value);
5651
5686
  } catch (error) {
5652
5687
  if (error instanceof Error && "code" in error && error.code === "ENOENT") return null;