@gitroll/tacitt-cli 0.6.11 → 0.6.13
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.
- package/README.md +4 -0
- package/bin/INDEX.md +6 -4
- package/bin/tacitt.cjs +1 -0
- package/dist/{agent-setup-DdfF3zch.mjs → agent-setup-Doy_AnPY.mjs} +2 -2
- package/dist/agent-setup-worker.mjs +5 -5
- package/dist/cli.mjs +32 -32
- package/dist/codex-title-worker.mjs +2 -2
- package/dist/configured-preview-worker.mjs +5 -5
- package/dist/configured-session-worker.mjs +23 -25
- package/dist/{frame-Bq2zRh-i.mjs → frame-BPbypzmt.mjs} +1 -1
- package/dist/{heap-CV8Eca8V.mjs → heap-DCS_WXIA.mjs} +264 -23
- package/dist/inspection-worker.mjs +4 -4
- package/dist/{job-BKsifhyv.mjs → job--zxwgaPy.mjs} +155 -41
- package/dist/{locate-Cx52Zqxv.mjs → locate-PLEyLYW-.mjs} +292 -236
- package/dist/{model-C1UXkHh9.mjs → model-CyXvsWLz.mjs} +1 -1
- package/dist/operation-executor.mjs +3 -3
- package/dist/preview-worker.mjs +1 -1
- package/dist/privacy-validator.mjs +28 -8
- package/dist/{query-AMZerUh8.mjs → query-BC7MIaWc.mjs} +1914 -759
- package/dist/{run-CaPktPhH.mjs → run-Dod7Vykp.mjs} +6 -6
- package/dist/session-process.mjs +20 -0
- package/dist/{src-DlVbGB32.mjs → src-CP-K2PBv.mjs} +2100 -1649
- package/dist/{src-D1iONla3.mjs → src-CttNuxOn.mjs} +925 -630
- package/dist/{src-wZx_v0Ih.mjs → src-dL6y2mcu.mjs} +180 -30
- package/dist/store-database-worker.mjs +1 -1
- package/dist/web/assets/index-BgDdPL1c.js +172 -0
- package/dist/web/index.html +2 -1
- package/package.json +2 -1
- package/skills/INDEX.md +6 -4
- package/skills/tacitt/INDEX.md +7 -6
- package/skills/tacitt/SKILL.md +7 -7
- package/skills/tacitt/references/INDEX.md +14 -11
- package/skills/tacitt/references/b-method.md +6 -4
- package/skills/tacitt/references/bootstrap.md +18 -4
- package/skills/tacitt/references/classification.md +1 -1
- package/skills/tacitt/references/commands.md +34 -10
- package/skills/tacitt/references/journey.md +7 -7
- package/skills/tacitt/references/parallel-review.md +31 -12
- package/skills/tacitt/references/remote-workers.md +6 -2
- package/skills/tacitt/references/send.md +7 -3
- package/skills/tacitt/scripts/INDEX.md +40 -37
- package/skills/tacitt/scripts/answer.mjs +31 -2
- package/skills/tacitt/scripts/describe.mjs +3 -2
- package/skills/tacitt/scripts/journey-card-consolidation.mjs +1 -1
- package/skills/tacitt/scripts/journey-classification-tasks.mjs +28 -8
- package/skills/tacitt/scripts/journey-classification.mjs +1 -0
- package/skills/tacitt/scripts/journey-panel-host.d.mts +2 -0
- package/skills/tacitt/scripts/journey-panel-host.mjs +25 -2
- package/skills/tacitt/scripts/journey-scan-timing.d.mts +4 -0
- package/skills/tacitt/scripts/journey-scan-timing.mjs +15 -2
- package/skills/tacitt/scripts/journey-state.mjs +11 -0
- package/skills/tacitt/scripts/journey-tasks.mjs +12 -5
- package/skills/tacitt/scripts/journey.mjs +11 -3
- package/skills/tacitt/scripts/privacy-validator.mjs +112 -40
- package/skills/tacitt/scripts/review.d.mts +1 -0
- package/skills/tacitt/scripts/review.mjs +680 -119
- package/dist/web/assets/index-CYl7eDUu.js +0 -172
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { $
|
|
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-
|
|
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, ct as openPrivateFile, dt as isWindowsAclFailure, k as prepareCollectionProduction, m as writeOutputShard, p as verifyOutputShard, st as makePrivateDirectory, ut as windowsOwnerOnly, z as privateCollectionDirectory } from "./src-CP-K2PBv.mjs";
|
|
2
|
+
import { C as validateBReview, J as bAnchorKey, Ut as termTypeInfo, X as bDigest, Xt as journeyProfileAddressActionSchema, Z as codePointLength, Zt as journeyProfileLinksActionSchema, d as reviewSubmitSchema, en as passportAddressSchema, f as textDigest, i as matchesReadReceipts, in as ApplicationError, j as bUnitFragments, n as runOccurrences, o as compileBFindings, on as safeCode, p as validateReview, qt as filterInventoryByPeriod, r as termSearchRuns, s as reviewBatchChunks, sn as safeField, t as locateTerms, tt as utf16Offset, un as reviewFamilies, xt as journeyDescribeSchema, y as reviewFindingsDigest, z as bClassificationKey, zt as reviewTermsInputSchema } from "./locate-PLEyLYW-.mjs";
|
|
3
|
+
import { $t as journeyPlaceSchema, Ar as retryReviewActionSchema, C as rebindReviewOverlay, Ct as sendActionSchema, D as staticallyHiddenFindings, Di as packageCommandSchema, Dr as nativeGetSchema, Dt as sendStartSchema, E as guardedFindingText, Ei as commandSchema, Er as nativeEventsSchema, Et as sendRequestSchema, Gn as confirmedHideAdditions, H as inspectionStartSchema, Ht as journeyContextQuerySchema, Jn as renderedHideValue, K as inspectionQuerySchema, Kr as staticSessionResourceSchema, Li as defaultScopedSettings, Mi as stateSchema, Nt as journeyReviewStorageQuerySchema, Oi as selectionBatchSchema, Or as nativeRespondSchema, Pn as journeyInventoryQuerySchema, Qn as hideKeyId, Ri as freezeConfiguration, S as rebindReviewAlignment, Sn as planBRepair, St as replaceSensitiveTermsSchema, T as reviewBatchReuse, Tt as sendPrepareSchema, V as inspectionCancelSchema, Vt as reviewCompileSchema, Xn as termHideAdditions, Xt as journeyResourceQuerySchema, Zn as addHideIndexTokens, _n as reviewRepairInputSchema, _r as journeyRenderInputSchema, _t as manualUploadStartSchema, a as bCrossSegmentReviewSchema, b as isGenericPublicTerm, bn as bReviewDigest, bt as maximumTermsFileBytes, c as reconstructBFields, di as withReadingProgress, er as packHideIndex, f as selectedValueMembers, fi as confirmedHideGroupIds, ft as manualUploadActionSchema, gn as reviewCandidateResourceSchema, gr as journeyPreviewSchema, hn as reviewCandidateInputSchema, hr as journeyFindingsSchema, ht as manualUploadPrepareSchema, i as validateBCrossSegmentReview, in as sessionReconcileInputSchema, ji as producerVersion, ki as selectionSchema, ln as sessionReviewInputSchema, mr as journeyFindingImpactSchema, mt as manualUploadChoiceSchema, n as scanBatchEquivalenceDigest, nt as settingsQuerySchema, o as bRereadDigest, p as splitSelectorValues, pn as sessionUsefulnessInputSchema, pr as journeyClassificationSessionsSchema, qn as readConfirmedHideChange, qt as journeyPolicyRespondSchema, r as locateTermEvidence, rt as readWorkspaceOutcomes, s as reconcileBSession, si as isSelectedWork, sn as sessionRereadInputSchema, t as scanBatchContextDigest, tn as reviewAttemptResourceSchema, tt as settingsBatchSchema, un as sessionReviewQuerySchema, ut as resolveFailureLocation, vi as maskedHitsStale, vn as reviewRepairResourceSchema, vr as journeyRenderSchema, w as rebindReviewSubmit, wt as sendChoiceSchema, x as bReviewScope, zi as selectFrozenConfiguration } from "./src-CttNuxOn.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-DCS_WXIA.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",
|
|
@@ -650,6 +653,7 @@ const operation = z.enum([
|
|
|
650
653
|
"journey.commit",
|
|
651
654
|
"journey.commit.checked",
|
|
652
655
|
"journey.classification.commit",
|
|
656
|
+
"journey.receipt.revision",
|
|
653
657
|
"journey.events",
|
|
654
658
|
"journey.inventory",
|
|
655
659
|
"journey.preparation.progress",
|
|
@@ -932,7 +936,7 @@ function createRouter(application, account, stopping, delivery, nativeInspection
|
|
|
932
936
|
}),
|
|
933
937
|
send: t.router({
|
|
934
938
|
request: t.procedure.input(sendRequestSchema).mutation(({ input }) => sending().request(input, "panel")),
|
|
935
|
-
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)),
|
|
936
940
|
prepare: t.procedure.input(sendPrepareSchema).mutation(({ input, signal }) => sending().prepare(input, signal)),
|
|
937
941
|
start: t.procedure.input(sendStartSchema).mutation(({ input, signal }) => sending().start(input, signal)),
|
|
938
942
|
respond: t.procedure.input(sendChoiceSchema).mutation(({ input }) => sending().respond(input)),
|
|
@@ -940,6 +944,8 @@ function createRouter(application, account, stopping, delivery, nativeInspection
|
|
|
940
944
|
resume: t.procedure.input(sendActionSchema).mutation(({ input }) => sending().resume(input)),
|
|
941
945
|
withdraw: t.procedure.input(sendActionSchema).mutation(({ input }) => sending().withdraw(input)),
|
|
942
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)),
|
|
943
949
|
ownerProfile: t.procedure.query(({ signal }) => sending().ownerProfile(signal ?? stopping)),
|
|
944
950
|
addressTaken: t.procedure.input(z.object({ address: passportAddressSchema }).strict()).query(({ input, signal }) => sending().addressTaken(input, signal ?? stopping)),
|
|
945
951
|
saveSentProfile: t.procedure.input(z.object({ journeyId: z.uuid() }).strict()).mutation(({ input }) => sending().saveSentProfile(input, stopping))
|
|
@@ -4610,7 +4616,7 @@ function createStagedTerms(access, files) {
|
|
|
4610
4616
|
return leg.run("journey.terms.finish", {
|
|
4611
4617
|
before,
|
|
4612
4618
|
located,
|
|
4613
|
-
occurrences: batches.flatMap((batch) => locateTerms([batch], terms).located.map((term) => ({
|
|
4619
|
+
occurrences: batches.flatMap((batch) => locateTerms([batch], terms).located.filter((term) => term.count > 0).map((term) => ({
|
|
4614
4620
|
...term,
|
|
4615
4621
|
batchId: batch.id
|
|
4616
4622
|
}))),
|
|
@@ -4684,34 +4690,12 @@ function createStagedTerms(access, files) {
|
|
|
4684
4690
|
}
|
|
4685
4691
|
/** A UUID named by a digest, so a replayed carry-over reuses its request key. */
|
|
4686
4692
|
const digestId = (digest) => `${digest.slice(0, 8)}-${digest.slice(8, 12)}-4${digest.slice(13, 16)}-8${digest.slice(17, 20)}-${digest.slice(20, 32)}`;
|
|
4687
|
-
/** Locate provenance over the same
|
|
4693
|
+
/** Locate provenance over the same field runs and core-overlapping occurrence as locateTerms. */
|
|
4688
4694
|
function findingSources(batches) {
|
|
4689
|
-
const
|
|
4690
|
-
|
|
4691
|
-
const
|
|
4692
|
-
|
|
4693
|
-
let chunks = [];
|
|
4694
|
-
let end = -1;
|
|
4695
|
-
const flush = () => {
|
|
4696
|
-
if (chunks.length) fields.push({
|
|
4697
|
-
batch,
|
|
4698
|
-
chunks,
|
|
4699
|
-
text: chunks.map((chunk) => chunk.text).join("").normalize("NFC")
|
|
4700
|
-
});
|
|
4701
|
-
};
|
|
4702
|
-
for (const chunk of group.toSorted((a, b) => a.offset - b.offset)) {
|
|
4703
|
-
if (chunk.offset !== end) {
|
|
4704
|
-
flush();
|
|
4705
|
-
chunks = [];
|
|
4706
|
-
}
|
|
4707
|
-
chunks.push(chunk);
|
|
4708
|
-
end = chunk.offset + chunk.text.length;
|
|
4709
|
-
}
|
|
4710
|
-
flush();
|
|
4711
|
-
}
|
|
4712
|
-
}
|
|
4713
|
-
return (value) => fields.flatMap(({ batch, chunks, text }) => {
|
|
4714
|
-
const at = text.indexOf(value);
|
|
4695
|
+
const runs = [...termSearchRuns(batches)];
|
|
4696
|
+
return (value) => runs.flatMap((run) => {
|
|
4697
|
+
const { batch, chunks } = run;
|
|
4698
|
+
const at = runOccurrences(run, value).first;
|
|
4715
4699
|
if (at < 0) return [];
|
|
4716
4700
|
let offset = 0;
|
|
4717
4701
|
return chunks.flatMap((chunk) => {
|
|
@@ -5064,11 +5048,13 @@ async function openStore(options, backupObsolete) {
|
|
|
5064
5048
|
sessionReviewStatus: (input) => stagedJourney.sessionReviewStatus(input),
|
|
5065
5049
|
reviewAttempts: (input) => access.run("journey.review.attempts", input),
|
|
5066
5050
|
acknowledgeSessionUsefulness: (input) => stagedJourney.acknowledgeSessionUsefulness(input),
|
|
5051
|
+
readSendOutput: (input) => access.run("journey.send.output", input),
|
|
5067
5052
|
preparationState: (journeyId) => access.run("journey.preparation.state", { journeyId }),
|
|
5068
5053
|
preparationPermission: (journeyId) => access.run("journey.preparation.permission", { journeyId }),
|
|
5069
5054
|
updatePreparation: (input) => access.run("journey.preparation.update", input),
|
|
5070
5055
|
current: (journeyId) => access.run("journey.current", journeyId ? { journeyId } : {}),
|
|
5071
5056
|
commit: (input) => stagedJourney.commit(input),
|
|
5057
|
+
receiptRevision: (input) => access.run("journey.receipt.revision", input),
|
|
5072
5058
|
commitClassification: (input) => stagedJourney.commitClassification(input),
|
|
5073
5059
|
hideIndexKey: (journeyId) => stagedJourney.hideIndexKey(journeyId),
|
|
5074
5060
|
reopenEmpty: (input) => access.run("journey.terms.reopen-empty", input),
|
|
@@ -5081,11 +5067,18 @@ async function openStore(options, backupObsolete) {
|
|
|
5081
5067
|
})
|
|
5082
5068
|
},
|
|
5083
5069
|
journeySend: {
|
|
5084
|
-
|
|
5070
|
+
isCurrentSend: (journeyId, sendId, revision) => access.run("journey.send.current", {
|
|
5085
5071
|
journeyId,
|
|
5086
|
-
|
|
5072
|
+
sendId,
|
|
5073
|
+
revision
|
|
5087
5074
|
}),
|
|
5088
|
-
|
|
5075
|
+
loadSend: (journeyId, sendId, observedRevision) => access.run("journey.send.load", {
|
|
5076
|
+
journeyId,
|
|
5077
|
+
...sendId ? { sendId } : {},
|
|
5078
|
+
...observedRevision !== void 0 ? { observedRevision } : {}
|
|
5079
|
+
}),
|
|
5080
|
+
commitSend: (input) => access.run("journey.send.commit", input),
|
|
5081
|
+
checkpointTransfer: (input) => access.run("journey.send.transfer", input)
|
|
5089
5082
|
},
|
|
5090
5083
|
manualUpload: {
|
|
5091
5084
|
load: (uploadId) => access.run("manual.upload.load", uploadId ? { uploadId } : {}),
|
|
@@ -5543,7 +5536,17 @@ async function collectRemoteWorkers(dispatches, confirmations, home, transport =
|
|
|
5543
5536
|
const copied = [];
|
|
5544
5537
|
const failures = /* @__PURE__ */ new Set();
|
|
5545
5538
|
const seen = /* @__PURE__ */ new Set();
|
|
5546
|
-
|
|
5539
|
+
const resolved = dispatches.flatMap((window) => window.harness === "unknown" ? [{
|
|
5540
|
+
...window,
|
|
5541
|
+
harness: "codex"
|
|
5542
|
+
}, {
|
|
5543
|
+
...window,
|
|
5544
|
+
harness: "claude"
|
|
5545
|
+
}] : [{
|
|
5546
|
+
...window,
|
|
5547
|
+
harness: window.harness
|
|
5548
|
+
}]);
|
|
5549
|
+
for (const window of resolved) {
|
|
5547
5550
|
if (confirmations[window.host] !== true || failures.has(window.host)) continue;
|
|
5548
5551
|
let temporary;
|
|
5549
5552
|
try {
|
|
@@ -5646,7 +5649,11 @@ async function readRemoteState(stateDir, journeyId) {
|
|
|
5646
5649
|
return z.object({
|
|
5647
5650
|
windows: z.array(z.object({
|
|
5648
5651
|
host: z.string(),
|
|
5649
|
-
harness: z.enum([
|
|
5652
|
+
harness: z.enum([
|
|
5653
|
+
"codex",
|
|
5654
|
+
"claude",
|
|
5655
|
+
"unknown"
|
|
5656
|
+
]),
|
|
5650
5657
|
transport: z.enum(["ssh", "gcloud"]),
|
|
5651
5658
|
args: z.array(z.string()),
|
|
5652
5659
|
sourceSessionId: z.string(),
|
|
@@ -5808,6 +5815,92 @@ function workApproval(approval, rootIds) {
|
|
|
5808
5815
|
};
|
|
5809
5816
|
}
|
|
5810
5817
|
//#endregion
|
|
5818
|
+
//#region apps/cli/src/journey/prepare/update.ts
|
|
5819
|
+
/** Preparation owns only the changed Work rows, progress and package invalidation. */
|
|
5820
|
+
async function changePreparation(storage, journeyId, kind, change, attempts = Number.POSITIVE_INFINITY, clearPackageApproval = false) {
|
|
5821
|
+
for (let attempt = 0; attempt < attempts; attempt++) {
|
|
5822
|
+
const before = await storage.preparationState(journeyId);
|
|
5823
|
+
if (!before?.consent) throw new ApplicationError("CONFIRMATION_REQUIRED");
|
|
5824
|
+
const after = change(before);
|
|
5825
|
+
if (after === before) return before;
|
|
5826
|
+
const previous = new Map(before.works.map((work) => [work.id, work]));
|
|
5827
|
+
const result = await storage.updatePreparation({
|
|
5828
|
+
journeyId,
|
|
5829
|
+
expectedRevision: before.revision,
|
|
5830
|
+
requestKey: randomUUID(),
|
|
5831
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5832
|
+
kind,
|
|
5833
|
+
works: after.works.filter((work) => work !== previous.get(work.id)),
|
|
5834
|
+
phase: after.phase,
|
|
5835
|
+
readingComplete: after.readingComplete,
|
|
5836
|
+
readingStartedAt: after.readingStartedAt,
|
|
5837
|
+
clearPackageApproval: clearPackageApproval && before !== after
|
|
5838
|
+
});
|
|
5839
|
+
if (result.status !== "stale") return result.state;
|
|
5840
|
+
}
|
|
5841
|
+
throw new ApplicationError("REVISION_CONFLICT");
|
|
5842
|
+
}
|
|
5843
|
+
//#endregion
|
|
5844
|
+
//#region apps/cli/src/journey/prepare/isolation.ts
|
|
5845
|
+
/** A Work-level refusal caused by identified roots, each with its own public-safe code. */
|
|
5846
|
+
var RootPreparationFailure = class extends ApplicationError {
|
|
5847
|
+
roots;
|
|
5848
|
+
constructor(code, roots, options) {
|
|
5849
|
+
super(code, void 0, options);
|
|
5850
|
+
this.roots = roots;
|
|
5851
|
+
}
|
|
5852
|
+
};
|
|
5853
|
+
/** The distinct public-safe codes of the identified failing roots, else the Work-level code. */
|
|
5854
|
+
function blockedCodes(error, code) {
|
|
5855
|
+
return error instanceof RootPreparationFailure && error.roots.size ? [...new Set(error.roots.values())] : [code];
|
|
5856
|
+
}
|
|
5857
|
+
/**
|
|
5858
|
+
* ADR 0188 (restoring ADR 0059 D06): moves the failing roots of a multi-root Work into its
|
|
5859
|
+
* stable blocked "<title> – couldn't prepare" Work so the rest can be prepared again. False
|
|
5860
|
+
* when the failure names no root or every root, or the Work changed. Track B may
|
|
5861
|
+
* reopen its still-current reading/review generation before the pending-only store call.
|
|
5862
|
+
*/
|
|
5863
|
+
async function isolateFailingRoots(storage, journeyId, work, error, afterRead = false) {
|
|
5864
|
+
if (!(error instanceof RootPreparationFailure)) return false;
|
|
5865
|
+
if ([
|
|
5866
|
+
error.code,
|
|
5867
|
+
...error.roots.values(),
|
|
5868
|
+
...work.blockedCodes
|
|
5869
|
+
].includes("PRIVACY_CHANGE_PENDING")) return false;
|
|
5870
|
+
const roots = work.rootSessionIds.flatMap((sessionId) => {
|
|
5871
|
+
const code = error.roots.get(sessionId);
|
|
5872
|
+
return code ? [{
|
|
5873
|
+
sessionId,
|
|
5874
|
+
code
|
|
5875
|
+
}] : [];
|
|
5876
|
+
});
|
|
5877
|
+
if (roots.length === 0 || roots.length === work.rootSessionIds.length) return false;
|
|
5878
|
+
if (afterRead) await changePreparation(storage, journeyId, "snapshot", (state) => {
|
|
5879
|
+
const current = state.works.find((item) => item.id === work.id);
|
|
5880
|
+
if (state.phase === "paused" || state.phase === "sending" || state.phase === "completed" || state.scope.status !== "confirmed" || state.pendingHideId || current?.inputRevision !== work.inputRevision || !isSelectedWork(current) || current.blockedCodes.includes("PRIVACY_CHANGE_PENDING") || !["reading", "review"].includes(current.status)) return state;
|
|
5881
|
+
return withReadingProgress({
|
|
5882
|
+
...state,
|
|
5883
|
+
works: state.works.map((item) => item.id === work.id ? {
|
|
5884
|
+
...item,
|
|
5885
|
+
status: "pending"
|
|
5886
|
+
} : item)
|
|
5887
|
+
});
|
|
5888
|
+
}, 100, true);
|
|
5889
|
+
for (;;) {
|
|
5890
|
+
const state = await storage.preparationState(journeyId);
|
|
5891
|
+
const current = state?.works.find((item) => item.id === work.id);
|
|
5892
|
+
if (!state || state.phase === "paused" || state.phase === "sending" || state.phase === "completed" || state.scope.status !== "confirmed" || state.pendingHideId || current?.inputRevision !== work.inputRevision || current.blockedCodes.includes("PRIVACY_CHANGE_PENDING") || current.status !== "pending") return false;
|
|
5893
|
+
if ((await storage.isolateRoots({
|
|
5894
|
+
journeyId,
|
|
5895
|
+
workId: work.id,
|
|
5896
|
+
inputRevision: work.inputRevision,
|
|
5897
|
+
roots,
|
|
5898
|
+
expectedRevision: state.revision,
|
|
5899
|
+
idempotencyKey: randomUUID()
|
|
5900
|
+
})).status !== "stale") return true;
|
|
5901
|
+
}
|
|
5902
|
+
}
|
|
5903
|
+
//#endregion
|
|
5811
5904
|
//#region apps/cli/src/journey/captures.ts
|
|
5812
5905
|
/** Bound each store reply to selected source IDs, including for a large single Work. */
|
|
5813
5906
|
async function readSelectedCaptures(storage, journeyId, partIds) {
|
|
@@ -5884,8 +5977,29 @@ async function staticBaseFromInputs(inputs, processing, hooks) {
|
|
|
5884
5977
|
captures: inputs.captures,
|
|
5885
5978
|
everyAdmissionRefusal: true
|
|
5886
5979
|
}, hooks);
|
|
5887
|
-
if (production.kind !== "configured"
|
|
5980
|
+
if (production.kind !== "configured") throw new ApplicationError("SCOPE_NOT_READY");
|
|
5888
5981
|
const families = reviewFamilies(approval.inventory);
|
|
5982
|
+
if (production.workspaceFailures.length) {
|
|
5983
|
+
const failures = /* @__PURE__ */ new Map();
|
|
5984
|
+
let unattributed = false;
|
|
5985
|
+
for (const failure of production.workspaceFailures) {
|
|
5986
|
+
let attributed = false;
|
|
5987
|
+
for (const session of approval.inventory.sessions) {
|
|
5988
|
+
if (session.workspaceId !== failure.workspaceId) continue;
|
|
5989
|
+
if (failure.location.sessionId && session.id !== failure.location.sessionId) continue;
|
|
5990
|
+
const root = families.owners.get(session.id);
|
|
5991
|
+
if (!root || !roots.includes(root.id)) unattributed = true;
|
|
5992
|
+
else {
|
|
5993
|
+
failures.set(root.id, failure.code);
|
|
5994
|
+
attributed = true;
|
|
5995
|
+
}
|
|
5996
|
+
}
|
|
5997
|
+
if (!attributed) unattributed = true;
|
|
5998
|
+
}
|
|
5999
|
+
const cause = new AggregateError(production.workspaceFailures.map((failure) => failure.cause), "SCOPE_NOT_READY");
|
|
6000
|
+
if (unattributed) throw new ApplicationError("SCOPE_NOT_READY", void 0, { cause });
|
|
6001
|
+
throw new RootPreparationFailure("SCOPE_NOT_READY", failures, { cause });
|
|
6002
|
+
}
|
|
5889
6003
|
const admitted = new Set(production.selection.sessions.map((item) => item.session.id));
|
|
5890
6004
|
return {
|
|
5891
6005
|
production,
|
|
@@ -6335,4 +6449,4 @@ async function runJourneyOutputJob(job, live, signal, onPath) {
|
|
|
6335
6449
|
};
|
|
6336
6450
|
}
|
|
6337
6451
|
//#endregion
|
|
6338
|
-
export {
|
|
6452
|
+
export { exportDelivery as A, inBackgroundStatusPoll as B, prepareSourcePlan as C, saveRemoteState as D, readRemoteState as E, startHost as F, isBackgroundStatusPoll as H, withStateMutex as I, createDeliveryService as L, createStore as M, readStateDump as N, journeyDirectory as O, createExecutionPort as P, preflight as R, changePreparation as S, isRemoteImport as T, retrySharingViolation as U, inBackgroundStoreLane as V, staticBaseProduction as _, writeJourneyOutput as a, blockedCodes as b, mergeHideIndexTokens as c, runJourneyBaseJob as d, writeJourneyBase as f, staticBaseInputs as g, staticSessions as h, runJourneyOutputVerifyJob as i, createPackagingProgressPort as j, collectRemoteWorkers as k, packRenderHideIndex as l, saveStaticSession as m, runJourneyOutputJob as n, createHideIndexTokens as o, readStaticResult as p, runJourneyOutputShardJob as r, hideIndexTexts as s, journeyOutputJob as t, journeyBaseJob as u, readSelectedCaptures as v, workApproval as w, isolateFailingRoots as x, RootPreparationFailure as y, loadDeliveryResults as z };
|