@gitroll/tacitt-cli 0.6.1 → 0.6.3

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 (42) hide show
  1. package/dist/{agent-setup-Dv_mQ38P.mjs → agent-setup-Cze03fCL.mjs} +2 -2
  2. package/dist/agent-setup-worker.mjs +5 -5
  3. package/dist/cli.mjs +9 -180
  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-DGun31Uc.mjs → frame-BGFmADbg.mjs} +1 -1
  8. package/dist/{heap-BR8WjR25.mjs → heap-CApARI9x.mjs} +18 -55
  9. package/dist/inspection-worker.mjs +4 -4
  10. package/dist/job-Bc0SmQC9.mjs +6284 -0
  11. package/dist/{locate-JYtFmKu-.mjs → locate-CNU4z9G1.mjs} +4 -0
  12. package/dist/{model-C1VzgKLi.mjs → model-CYweY9fR.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-BlisHJtP.mjs → query-CztBNjXI.mjs} +1533 -5557
  17. package/dist/{run-hQ_W2p_Y.mjs → run-CnI7NSET.mjs} +4 -4
  18. package/dist/{src-JoT3L94j.mjs → src-BlP4urDH.mjs} +3 -3
  19. package/dist/{src--Ln5GHdz.mjs → src-Bz2CXuiR.mjs} +128 -13
  20. package/dist/{src-CGFwLUd6.mjs → src-vTFLdYlS.mjs} +4 -4
  21. package/dist/store-database-worker.mjs +1 -1
  22. package/dist/web/assets/index-CndETc8f.js +169 -0
  23. package/dist/web/index.html +1 -1
  24. package/package.json +1 -1
  25. package/skills/tacitt/INDEX.md +1 -1
  26. package/skills/tacitt/SKILL.md +4 -2
  27. package/skills/tacitt/references/INDEX.md +2 -2
  28. package/skills/tacitt/references/commands.md +2 -0
  29. package/skills/tacitt/references/journey.md +3 -1
  30. package/skills/tacitt/references/remote-workers.md +6 -0
  31. package/skills/tacitt/references/send.md +3 -2
  32. package/skills/tacitt/scripts/INDEX.md +36 -36
  33. package/skills/tacitt/scripts/answer.mjs +41 -11
  34. package/skills/tacitt/scripts/journey-card-consolidation.d.mts +2 -0
  35. package/skills/tacitt/scripts/journey-card-consolidation.mjs +80 -5
  36. package/skills/tacitt/scripts/journey-card-values.d.mts +4 -0
  37. package/skills/tacitt/scripts/journey-card-values.mjs +21 -7
  38. package/skills/tacitt/scripts/journey-tasks.d.mts +1 -0
  39. package/skills/tacitt/scripts/journey-tasks.mjs +28 -12
  40. package/skills/tacitt/scripts/journey.mjs +3 -2
  41. package/dist/job-CYsjL4AT.mjs +0 -990
  42. package/dist/web/assets/index-C9LcK9ls.js +0 -169
@@ -1,7 +1,7 @@
1
- import { ln as sessionSchema } from "./locate-JYtFmKu-.mjs";
2
- import { t as createZstdFrameCheck$1 } from "./frame-DGun31Uc.mjs";
3
- import "./src--Ln5GHdz.mjs";
4
- import { a as isRecord } from "./model-C1VzgKLi.mjs";
1
+ import { ln as sessionSchema } from "./locate-CNU4z9G1.mjs";
2
+ import { t as createZstdFrameCheck$1 } from "./frame-BGFmADbg.mjs";
3
+ import "./src-Bz2CXuiR.mjs";
4
+ import { a as isRecord } from "./model-CYweY9fR.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,6 +1,6 @@
1
- import { $n as detectStatic, An as createReplacementKey, Bn as nativeItems, En as walkNativeFields, Fn as entityDictionaryVersion, Gn as validateProfile, H as codePointLength, Hn as transformRecords, In as nativeParserVersion, Jn as validatePlan, Ln as redactionImplementationVersion, Mn as projectNativeRecord, Nn as parseNativeRecord, Pn as cleanupImplementationVersion, Qn as resolveLimits, Qt as safeCode, Un as frameRecords, V as bDigest, Vn as nativeText, Wn as retainedMainTextNodes, Xn as defaultLimits, Xt as ApplicationError, Zn as recordPointerLimits, _n as reviewRoles, bn as createSessionPreparation, c as textDigest, dr as fail$1, fn as nativeSourceIdentitySchema, fr as isProcessingCode, gn as mainReviewRole, hn as projectNativeReviewInput, in as sourceKey, ir as createEntityMatcher, j as bDuplicateShift, jn as sessionNonce, k as bBindingCap, lr as defaultDetectionLimits, mn as processNativeRecord, nn as reviewFamilies, nr as jsonSpans, o as reviewDigest, on as sourceSnapshotId, pn as withMandatoryCustomTerms, qn as buildPlan, rr as agentContextLocation, tn as familySelected, ur as ProcessingError, vn as createSentenceContext, wn as createDetectionSummary, x as createBAnalysisUnits, xn as bindInspection, yn as renderNative, zn as nativeField } from "./locate-JYtFmKu-.mjs";
2
- import { t as createZstdFrameCheck } from "./frame-DGun31Uc.mjs";
3
- import { An as bContainment, Dt as metadataProcessingVersion, F as withSourceEvidence, I as agentSetupKey, Mr as agentSourceSchema, P as sourceIdentityEvidence, Pn as bWordBounded, it as defaultAgentSetupInclusion, jn as bExceptionRanges, jr as agentSourcePathSegment, li as approvedTreatmentSchema, mi as staticCatalogRef, rt as classifyAgentSetup, si as sourceChangePolicy, ur as resolveSourceSelection } from "./src--Ln5GHdz.mjs";
1
+ import { $n as detectStatic, An as createReplacementKey, Bn as nativeItems, En as walkNativeFields, Fn as entityDictionaryVersion, Gn as validateProfile, H as codePointLength, Hn as transformRecords, In as nativeParserVersion, Jn as validatePlan, Ln as redactionImplementationVersion, Mn as projectNativeRecord, Nn as parseNativeRecord, Pn as cleanupImplementationVersion, Qn as resolveLimits, Qt as safeCode, Un as frameRecords, V as bDigest, Vn as nativeText, Wn as retainedMainTextNodes, Xn as defaultLimits, Xt as ApplicationError, Zn as recordPointerLimits, _n as reviewRoles, bn as createSessionPreparation, c as textDigest, dr as fail$1, fn as nativeSourceIdentitySchema, fr as isProcessingCode, gn as mainReviewRole, hn as projectNativeReviewInput, in as sourceKey, ir as createEntityMatcher, j as bDuplicateShift, jn as sessionNonce, k as bBindingCap, lr as defaultDetectionLimits, mn as processNativeRecord, nn as reviewFamilies, nr as jsonSpans, o as reviewDigest, on as sourceSnapshotId, pn as withMandatoryCustomTerms, qn as buildPlan, rr as agentContextLocation, tn as familySelected, ur as ProcessingError, vn as createSentenceContext, wn as createDetectionSummary, x as createBAnalysisUnits, xn as bindInspection, yn as renderNative, zn as nativeField } from "./locate-CNU4z9G1.mjs";
2
+ import { t as createZstdFrameCheck } from "./frame-BGFmADbg.mjs";
3
+ import { F as sourceIdentityEvidence, I as withSourceEvidence, In as bWordBounded, L as agentSetupKey, Mn as bContainment, Nn as bExceptionRanges, Nr as agentSourcePathSegment, Pr as agentSourceSchema, at as defaultAgentSetupInclusion, di as approvedTreatmentSchema, fr as resolveSourceSelection, gi as staticCatalogRef, it as classifyAgentSetup, kt as metadataProcessingVersion, li as sourceChangePolicy } from "./src-Bz2CXuiR.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";
@@ -1,4 +1,4 @@
1
- import { $ as bCountSchema, $n as detectStatic, A as bDuplicateMirror, B as bEvidenceReader, Bt as sessionPeriodSchema, C as validateBUnit, Cn as inspectionSemanticVersions, Ct as cardsSubmitSchema, D as uncoveredBObligations, Dn as createStaticProcessor, Dt as privacyResolveSchema, E as bLiterals, Et as packageConfirmActionSchema, Fn as entityDictionaryVersion, Ft as termTypeInfo, G as subtractBRanges, Gn as validateProfile, H as codePointLength, Ht as journeyProfileAddressActionSchema, I as bIssue, It as termTypeSchema, J as bRetainedGroupSchema, Jn as validatePlan, Jt as respondProfileLinks, Kn as orderProfile, L as bOverlaps, Lt as termTypes, M as bLegacyBindings, Mt as reviewTermsResultSchema, N as bUnitFragments, Nt as termAssessmentSchema, O as indexBRanges, On as staticDefaults, Ot as privacyTermKey, P as bAdoptedObligations, Pn as cleanupImplementationVersion, Pt as termOverrideValueSchema, Q as bAnchorSchema, Qt as safeCode, R as unownedBObligations, Rt as deselectOutsidePeriod, S as validateBFields, Sn as currentDetectorVersion, St as cardsConfirmActionSchema, T as bLiteralTerms, Tn as gapReasons, Tt as emptyJourneyPrivacy, U as codePointSlice, Ut as journeyProfileLinksActionSchema, V as bDigest, Vt as emptyJourneyProfile, W as createCodePointIndex, X as bSessionDecisionSchema, Xt as ApplicationError, Y as bReviewSubmissionSchema, Yn as copyData, Yt as classificationTitleMaskSchema, Z as bTermSchema, Zt as UnfinishedJourneyError, _ as semanticFindingSchema, _t as hideConfirmSchema, a as reviewChunkSchema, an as observeSource, at as journeyExceptionSchema, b as validateBReview, bt as journeyConfigurationSchema, c as textDigest, cn as inventorySchema, cr as scalarBefore, ct as journeyPreferenceScopeSchema, dt as nativeJourneySchema, en as familyNeedsReview, et as bIdSchema, f as reviewAlignmentAuditSchema, fn as nativeSourceIdentitySchema, ft as journeyGuidanceSchema, g as validateReviewAlignment, h as reviewFindingsDigest, ht as journeyDescribeSchema, i as reviewBatchSchema, in as sourceKey, ir as createEntityMatcher, it as journeyDigestSchema, jt as reviewTermsInputSchema, kn as staticOptions, l as validateReview, lr as defaultDetectionLimits, lt as journeyProjectTypeSchema, m as reviewAlignmentSchema, mt as delegatedDecisionSchema, n as compileBFindings, nn as reviewFamilies, nt as journeyAccessSchema, o as reviewDigest, on as sourceSnapshotId, ot as journeyIdSchema, p as reviewAlignmentInputSchema, pt as journeyInstructionInputSchema, q as bRepresentationSchema, r as reviewBatchChunks, rn as sourceGraph, rt as journeyChoiceSchema, s as reviewSubmitSchema, sn as fileIdentitySchema, sr as scalarAfter, st as journeyKindSchema, tn as familySelected, tr as staticCategories, tt as bMethod, u as findingReferenceKey, un as sourcePartSchema, ut as journeyWorkTypeSchema, vt as hidePlanInputSchema, w as bLiteralAdmitted, x as createBAnalysisUnits, xt as cardAnswerActionSchema, y as validateBClassification, yt as hidePlanResourceSchema, z as bAnchorKey } from "./locate-JYtFmKu-.mjs";
1
+ import { $ as bCountSchema, $n as detectStatic, A as bDuplicateMirror, B as bEvidenceReader, Bt as sessionPeriodSchema, C as validateBUnit, Cn as inspectionSemanticVersions, Ct as cardsSubmitSchema, D as uncoveredBObligations, Dn as createStaticProcessor, Dt as privacyResolveSchema, E as bLiterals, Et as packageConfirmActionSchema, Fn as entityDictionaryVersion, Ft as termTypeInfo, G as subtractBRanges, Gn as validateProfile, H as codePointLength, Ht as journeyProfileAddressActionSchema, I as bIssue, It as termTypeSchema, J as bRetainedGroupSchema, Jn as validatePlan, Jt as respondProfileLinks, Kn as orderProfile, L as bOverlaps, Lt as termTypes, M as bLegacyBindings, Mt as reviewTermsResultSchema, N as bUnitFragments, Nt as termAssessmentSchema, O as indexBRanges, On as staticDefaults, Ot as privacyTermKey, P as bAdoptedObligations, Pn as cleanupImplementationVersion, Pt as termOverrideValueSchema, Q as bAnchorSchema, Qt as safeCode, R as unownedBObligations, Rt as deselectOutsidePeriod, S as validateBFields, Sn as currentDetectorVersion, St as cardsConfirmActionSchema, T as bLiteralTerms, Tn as gapReasons, Tt as emptyJourneyPrivacy, U as codePointSlice, Ut as journeyProfileLinksActionSchema, V as bDigest, Vt as emptyJourneyProfile, W as createCodePointIndex, X as bSessionDecisionSchema, Xt as ApplicationError, Y as bReviewSubmissionSchema, Yn as copyData, Yt as classificationTitleMaskSchema, Z as bTermSchema, Zt as UnfinishedJourneyError, _ as semanticFindingSchema, _t as hideConfirmSchema, a as reviewChunkSchema, an as observeSource, at as journeyExceptionSchema, b as validateBReview, bt as journeyConfigurationSchema, c as textDigest, cn as inventorySchema, cr as scalarBefore, ct as journeyPreferenceScopeSchema, dt as nativeJourneySchema, en as familyNeedsReview, et as bIdSchema, f as reviewAlignmentAuditSchema, fn as nativeSourceIdentitySchema, ft as journeyGuidanceSchema, g as validateReviewAlignment, h as reviewFindingsDigest, ht as journeyDescribeSchema, i as reviewBatchSchema, in as sourceKey, ir as createEntityMatcher, it as journeyDigestSchema, jt as reviewTermsInputSchema, kn as staticOptions, l as validateReview, lr as defaultDetectionLimits, lt as journeyProjectTypeSchema, m as reviewAlignmentSchema, mt as delegatedDecisionSchema, n as compileBFindings, nn as reviewFamilies, nt as journeyAccessSchema, o as reviewDigest, on as sourceSnapshotId, ot as journeyIdSchema, p as reviewAlignmentInputSchema, pt as journeyInstructionInputSchema, q as bRepresentationSchema, r as reviewBatchChunks, rn as sourceGraph, rt as journeyChoiceSchema, s as reviewSubmitSchema, sn as fileIdentitySchema, sr as scalarAfter, st as journeyKindSchema, tn as familySelected, tr as staticCategories, tt as bMethod, u as findingReferenceKey, un as sourcePartSchema, ut as journeyWorkTypeSchema, vt as hidePlanInputSchema, w as bLiteralAdmitted, x as createBAnalysisUnits, xt as cardAnswerActionSchema, y as validateBClassification, yt as hidePlanResourceSchema, z as bAnchorKey } from "./locate-CNU4z9G1.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";
@@ -1591,7 +1591,16 @@ const sendItemSchema = z.object({
1591
1591
  /** Write-ahead upload intent; completion probes recover an unacknowledged blob PUT. */
1592
1592
  sessionUpload: z.object({
1593
1593
  key: journeyDigestSchema,
1594
- sha256: journeyDigestSchema
1594
+ sha256: journeyDigestSchema,
1595
+ /** Byte-started transport/server failures charged to this Send. */
1596
+ attempt: count$13.optional(),
1597
+ /** Transient failures used only to schedule capped zero-byte retries. */
1598
+ retryCount: count$13.optional(),
1599
+ bytesAttempted: count$13.optional(),
1600
+ bytesAcknowledged: count$13.optional(),
1601
+ contentLength: count$13.optional(),
1602
+ bytesSent: count$13.optional(),
1603
+ nextAttemptAt: z.iso.datetime().optional()
1595
1604
  }).strict().nullable().optional(),
1596
1605
  /** Exact write-ahead membership request; never rebase it after an uncertain PUT. */
1597
1606
  sessionMembership: z.object({
@@ -1635,6 +1644,24 @@ const sendItemSchema = z.object({
1635
1644
  error: z.string().nullable()
1636
1645
  }).strict();
1637
1646
  const journeySendSchema = z.object({
1647
+ /** Safe identity of conflicting session and Works. */
1648
+ contentConflict: z.object({
1649
+ workIds: z.array(journeyIdSchema).min(1),
1650
+ sessionKey: journeyDigestSchema
1651
+ }).strict().optional(),
1652
+ /** The Send click authorization before artifact-bound confirmation. */
1653
+ request: z.object({
1654
+ requestedAt: z.iso.datetime(),
1655
+ hostId: journeyIdSchema,
1656
+ subject: z.string().nullable(),
1657
+ source: z.enum(["conversation", "panel"]),
1658
+ scopeDigest: journeyDigestSchema,
1659
+ included: z.array(z.object({
1660
+ workId: journeyIdSchema,
1661
+ access: z.string()
1662
+ }).strict()),
1663
+ omittedWorkIds: z.array(journeyIdSchema)
1664
+ }).strict().optional(),
1638
1665
  /** Passport advertised parallel-completes when this Send was confirmed (ADR 0235). */
1639
1666
  parallelCompletes: z.literal(true).optional(),
1640
1667
  id: journeyIdSchema,
@@ -1644,6 +1671,7 @@ const journeySendSchema = z.object({
1644
1671
  subject: z.string().nullable(),
1645
1672
  confirmedAt: z.iso.datetime().nullable(),
1646
1673
  status: z.enum([
1674
+ "awaiting-packaging",
1647
1675
  "prepared",
1648
1676
  "sign-in",
1649
1677
  "review",
@@ -2122,6 +2150,16 @@ function assertJourneyPrivacyReady(state, packaging = false) {
2122
2150
  function assertCardsAllowed(state) {
2123
2151
  if (!state.consent || state.scope.status !== "confirmed") throw new ApplicationError("SCOPE_NOT_READY");
2124
2152
  }
2153
+ const identityValue = (value) => value.normalize("NFC").trim().toLowerCase();
2154
+ /**
2155
+ * ADR 0251: the person's own values, journey-wide: every active own-identity term and every
2156
+ * own-identity value rule, compared by NFC, trimmed and lowercased. A people value in this set
2157
+ * belongs with the person's own identity. Card settlement (`ownIdentityValues` in the Skill's
2158
+ * journey-card-values.mjs) mirrors this rule on the agent view; a parity test pins both.
2159
+ */
2160
+ function ownIdentityValues(state) {
2161
+ return new Set([...activePrivacyTerms(state), ...state.valueOverrides ?? []].filter((term) => term.type === "own-identity").map((term) => identityValue(term.value)));
2162
+ }
2125
2163
  /**
2126
2164
  * D3: a batch covers only Pending values no card covers yet. Values added to an existing card
2127
2165
  * take its answer at once when the person already answered it.
@@ -2134,17 +2172,28 @@ function appendDecisionCards(state, input) {
2134
2172
  const extend = input.extend ?? [];
2135
2173
  const covered = [...input.cards.flatMap((card) => card.termKeys), ...extend.flatMap((item) => item.termKeys)];
2136
2174
  if (!covered.length || state.privacy.cards.length + input.cards.length > 20 || new Set(input.cards.map((card) => card.id)).size !== input.cards.length || input.cards.some((card) => existing.has(card.id)) || new Set(extend.map((item) => item.cardId)).size !== extend.length || extend.some((item) => !existing.has(item.cardId)) || new Set(covered).size !== covered.length || covered.some((key) => !open.has(key))) throw new ApplicationError("INVALID_SELECTION");
2175
+ const terms = new Map(state.privacy.terms.map((term) => [privacyTermKey(term), term]));
2176
+ const ownValues = ownIdentityValues(state);
2177
+ for (const extension of extend) {
2178
+ const ownCard = !!state.privacy.cards.find((item) => item.id === extension.cardId)?.termKeys.some((key) => terms.get(key)?.type === "own-identity");
2179
+ if (extension.termKeys.some((key) => {
2180
+ const term = terms.get(key);
2181
+ return term?.type === "own-identity" ? !ownCard : term?.type === "people" && ownCard && !ownValues.has(identityValue(term.value));
2182
+ })) throw new ApplicationError("INVALID_SELECTION");
2183
+ }
2137
2184
  const additions = new Map(extend.map((item) => [item.cardId, item.termKeys]));
2185
+ const inherited = new Map(extend.flatMap((item) => item.termKeys.map((key) => [key, item.cardId])));
2138
2186
  return applyCardAnswers({
2139
2187
  ...retirePrivacyArtifacts(state),
2140
2188
  privacy: {
2141
2189
  ...state.privacy,
2142
2190
  cards: [...state.privacy.cards.map((card) => {
2143
2191
  const added = additions.get(card.id);
2144
- return added ? {
2192
+ if (!added) return card;
2193
+ return {
2145
2194
  ...card,
2146
2195
  termKeys: [...card.termKeys, ...added]
2147
- } : card;
2196
+ };
2148
2197
  }), ...input.cards.map((card) => ({
2149
2198
  ...card,
2150
2199
  answer: null
@@ -2152,7 +2201,7 @@ function appendDecisionCards(state, input) {
2152
2201
  confirmedAnswersRevision: input.cards.length ? null : state.privacy.confirmedAnswersRevision,
2153
2202
  packageApproval: null
2154
2203
  }
2155
- });
2204
+ }, inherited);
2156
2205
  }
2157
2206
  function publishDecisionCards(state, input) {
2158
2207
  if (input.mode === "append") return appendDecisionCards(state, input);
@@ -2249,7 +2298,7 @@ function normalizeValues(state, input) {
2249
2298
  const disposition = forcedHidden ? "hidden" : override ? override.choice === "hide" ? "hidden" : "keep" : ownKeep ? "keep" : hideCard || same.some((term) => term.disposition === "hidden") ? "hidden" : "keep";
2250
2299
  if (new Set(same.map((term) => term.disposition)).size > 1 || forcedHidden || override || same.some((term) => term.disposition !== disposition)) for (const term of same) normalized.set(privacyTermKey(term), {
2251
2300
  disposition,
2252
- reason: disposition === "hidden" && term.disposition !== "hidden" ? hideCard && !same.some((item) => item.disposition === "hidden") ? "A Hide card answer covering this value takes precedence over Keep." : "A Hidden judgment for this NFC keyword takes precedence across term types." : ownKeep && term.disposition !== "keep" ? OWN_PROJECT_KEEP_REASON : term.reason
2301
+ reason: override && !forcedHidden ? `Your value rule takes precedence: ${override.choice === "hide" ? "Hide" : "Keep"}.` : disposition === "hidden" && term.disposition !== "hidden" ? hideCard && !same.some((item) => item.disposition === "hidden") ? "A Hide card answer covering this value takes precedence over Keep." : "A Hidden judgment for this NFC keyword takes precedence across term types." : ownKeep && term.disposition !== "keep" ? OWN_PROJECT_KEEP_REASON : term.reason
2253
2302
  });
2254
2303
  }
2255
2304
  return input.map((term) => {
@@ -2264,21 +2313,22 @@ function normalizeValues(state, input) {
2264
2313
  * The CLI applies card answers itself (D3): Hide makes every covered value Hidden and Keep keeps
2265
2314
  * it, an unticked value takes the other option, then one value gets one outcome.
2266
2315
  */
2267
- function applyCardAnswers(state) {
2316
+ function applyCardAnswers(state, inherited) {
2268
2317
  if (!state.privacy.cards.some((card) => card.answer)) return state;
2269
2318
  const hide = answeredKeys(state, "hide");
2270
2319
  const keep = answeredKeys(state, "keep");
2271
2320
  const terms = state.privacy.terms.map((term) => {
2272
2321
  const key = privacyTermKey(term);
2322
+ const cardId = inherited?.get(key);
2273
2323
  if (hide.has(key) && term.disposition !== "hidden") return {
2274
2324
  ...term,
2275
2325
  disposition: "hidden",
2276
- reason: "Hidden by your decision card answer."
2326
+ reason: cardId ? `Inherited from decision card ${cardId}: Hide.` : "Hidden by your decision card answer."
2277
2327
  };
2278
2328
  if (keep.has(key) && !hide.has(key) && term.disposition !== "keep") return {
2279
2329
  ...term,
2280
2330
  disposition: "keep",
2281
- reason: "Kept by your decision card answer."
2331
+ reason: cardId ? `Inherited from decision card ${cardId}: Keep.` : "Kept by your decision card answer."
2282
2332
  };
2283
2333
  return term;
2284
2334
  });
@@ -6926,12 +6976,21 @@ const sendChoiceSchema = sendActionSchema.extend({
6926
6976
  scopeVersion: version$1
6927
6977
  }).strict()])
6928
6978
  }).strict();
6979
+ /** Explicit human Send authorization, recorded before any output exists. */
6980
+ const sendRequestSchema = sendPrepareSchema.extend({
6981
+ included: z.array(z.object({
6982
+ workId: journeyIdSchema,
6983
+ access: z.string()
6984
+ }).strict()).min(1),
6985
+ omittedWorkIds: z.array(journeyIdSchema)
6986
+ }).strict();
6929
6987
  //#endregion
6930
6988
  //#region packages/application/src/journey/send/service.ts
6931
6989
  /** Public snapshots omit local source candidates and private scoped exception values. */
6932
6990
  function safeJourneySender(sender, now) {
6933
6991
  const safe = (result) => ({
6934
6992
  ...withoutSnapshot(result),
6993
+ ...sender.scopeValid ? { scopeValid: sender.scopeValid(result) } : {},
6935
6994
  journey: journeyView(result.journey, now()),
6936
6995
  send: result.send && {
6937
6996
  ...result.send,
@@ -6953,6 +7012,9 @@ function safeJourneySender(sender, now) {
6953
7012
  });
6954
7013
  return result ? safe(result) : null;
6955
7014
  },
7015
+ async request(input, source = "conversation") {
7016
+ return safe(await sender.request(input, source));
7017
+ },
6956
7018
  async prepare(input, signal = new AbortController().signal) {
6957
7019
  return safe(await sender.prepare(input, signal));
6958
7020
  },
@@ -12507,8 +12569,11 @@ function semanticGroupKey(kind, group, condition) {
12507
12569
  }
12508
12570
  //#endregion
12509
12571
  //#region packages/application/src/journey/configuration.ts
12510
- /** Null deliberately selects the initial configuration frozen in the source plan. */
12511
- async function activeJourneyTerms(storage, state) {
12572
+ /**
12573
+ * Null deliberately selects the initial configuration frozen in the source plan. A caller that
12574
+ * already holds that immutable plan passes it; the pending-Hide fence still applies.
12575
+ */
12576
+ async function activeJourneyTerms(storage, state, loadedPlan) {
12512
12577
  if (state.pendingHideId) throw new ApplicationError("SCOPE_NOT_READY");
12513
12578
  if (state.configurationId) {
12514
12579
  const configuration = (await storage.resources({
@@ -12519,7 +12584,7 @@ async function activeJourneyTerms(storage, state) {
12519
12584
  if (configuration?.kind !== "configuration") throw new ApplicationError("CORRUPTED_STATE");
12520
12585
  return configuration.sensitiveTerms;
12521
12586
  }
12522
- const plan = (await storage.resources({
12587
+ const plan = loadedPlan ?? (await storage.resources({
12523
12588
  journeyId: state.journeyId,
12524
12589
  kind: "plan"
12525
12590
  }))[0];
@@ -12679,6 +12744,56 @@ function reviseGroupMembership(state, action, members, preferenceScope) {
12679
12744
  };
12680
12745
  }
12681
12746
  //#endregion
12747
+ //#region packages/application/src/journey/placement/evidence.ts
12748
+ /** The denominator includes unresolved observations; missing evidence cannot increase confidence. */
12749
+ function dominant(value, signal) {
12750
+ if (!Number.isSafeInteger(value.total) || value.total < 0) throw new ApplicationError("INVALID_ARGUMENTS");
12751
+ const ids = /* @__PURE__ */ new Set();
12752
+ let accounted = 0;
12753
+ for (const item of value.repositories) {
12754
+ if (!item.id || ids.has(item.id) || !Number.isSafeInteger(item.count) || item.count <= 0) throw new ApplicationError("INVALID_ARGUMENTS");
12755
+ ids.add(item.id);
12756
+ accounted += item.count;
12757
+ }
12758
+ if (accounted > value.total) throw new ApplicationError("INVALID_ARGUMENTS");
12759
+ if (!value.complete) return null;
12760
+ const sorted = value.repositories.toSorted((a, b) => b.count - a.count || a.id.localeCompare(b.id));
12761
+ const first = sorted[0], second = sorted[1];
12762
+ if (!first || !value.total || first.count === second?.count) return null;
12763
+ const share = first.count / value.total;
12764
+ if (share < .3) return null;
12765
+ return {
12766
+ repositoryId: first.id,
12767
+ signal,
12768
+ confidence: share >= .6 ? "high" : "medium",
12769
+ matched: first.count,
12770
+ total: value.total,
12771
+ otherRepositoryIds: sorted.slice(1).map((item) => item.id)
12772
+ };
12773
+ }
12774
+ /** Ray section 3: stop at the first deciding signal, then leave semantic fallback to the agent. */
12775
+ function chooseCheapPlacement(signals) {
12776
+ const paths = dominant(signals.paths, "paths");
12777
+ if (paths) return paths;
12778
+ const commands = dominant(signals.commands, "cwd");
12779
+ if (commands) return commands;
12780
+ for (const signal of ["git", "name"]) {
12781
+ const candidates = [...new Set(signal === "git" ? signals.git : signals.names)];
12782
+ if (candidates.length !== 1) continue;
12783
+ const repositoryId = candidates[0];
12784
+ if (!repositoryId) throw new ApplicationError("INVALID_ARGUMENTS");
12785
+ return {
12786
+ repositoryId,
12787
+ signal: signal === "git" ? "git" : "name",
12788
+ confidence: "high",
12789
+ matched: 1,
12790
+ total: 1,
12791
+ otherRepositoryIds: []
12792
+ };
12793
+ }
12794
+ return null;
12795
+ }
12796
+ //#endregion
12682
12797
  //#region packages/application/src/journey/b/reconstruct.ts
12683
12798
  function reconstructBFields(inputs) {
12684
12799
  const units = inputs.map(validateBUnit).sort((left, right) => left.ordinal - right.ordinal);
@@ -13295,4 +13410,4 @@ function equivalenceDuplicates(batch) {
13295
13410
  return bindings.sort();
13296
13411
  }
13297
13412
  //#endregion
13298
- export { settingsQuerySchema as $, mergeBRepair as $n, journeyRenderSchema as $r, journeyResourceSchema as $t, deviceProfileScopeSchema as A, bContainment as An, staticSessionResourceSchema as Ar, validateAttemptAppend as At, validateInspectionBatch as B, journeyConfirmedHides as Bn, hasCompleteWorkDescription as Br, newJourneyWork as Bt, rebindReviewSubmit as C, renderedHideValue as Cn, privacyDecisionDigest as Cr, sendStartSchema as Ct, createAccount as D, hideKeyId as Dn, hasCurrentStaticReview as Dr, metadataProcessingVersion as Dt, staticallyHiddenFindings as E, addHideIndexTokens as En, nativeRespondSchema as Er, obsoleteJourney as Et, withSourceEvidence as F, confirmedHideGroupIds as Fn, sendArtifactSchema as Fr, applyClassificationProposal as Ft, validateInspectionFence as G, workPrivacyDecisions as Gn, isSkippedWork as Gr, hideFinishSchema as Gt, validateInspectionRequest as H, syncTermGroups as Hn, isIncludedWork as Hr, journeyContextQuerySchema as Ht, agentSetupKey as I, confirmedHideKey as In, sendReceiptSchema as Ir, classificationCommitSchema as It, validateInspectionQuery as J, reviewCandidateResourceSchema as Jn, mergePrivacyTerms as Jr, journeySearchSaveSchema as Jt, validateInspectionHead as K, workCorrectionBinding as Kn, selectedWorks as Kr, hidePublishSchema as Kt, createApplication as L, confirmedHideKinds as Ln, sendReplaceResultSchema as Lr, classificationPartition as Lt, readAccountAvatarUrl as M, bMaskedHits as Mn, agentSourceSchema as Mr, applyClassification as Mt, storedCredentialSchema as N, bTermMatcher as Nn, agentSourcesSchema as Nr, journeyBatchReadSchema as Nt, accountProfileSchema as O, maximumHideIndexTokens as On, staticReviewDigest as Or, nativeAdapterVersions as Ot, sourceIdentityEvidence as P, bWordBounded as Pn, journeySendSchema as Pr, journeyReviewStorageQuerySchema as Pt, settingsBatchSchema as Q, bReviewDigest as Qn, journeyRenderInputSchema as Qr, journeyResourceQuerySchema as Qt, inspectionCancelSchema as R, confirmedHideTerms as Rn, sendResolutionSchema as Rr, classificationWorks as Rt, rebindReviewOverlay as S, readConfirmedHideChange as Sn, assertJourneyPrivacyReady as Sr, sendPrepareSchema as St, guardedFindingText as T, termHideAdditions as Tn, nativeGetSchema as Tr, currentJourneyAdapters as Tt, inspectionQuerySchema as U, retireWorkDescription as Un, isReadingComplete as Ur, journeyContextSchema as Ut, validateInspectionBatches as V, maskedHitsStale as Vn, isClassifying as Vr, reviewCompileSchema as Vt, validateInspectionClaim as W, workDecisionDigest as Wn, isSelectedWork as Wr, hideBeginSchema as Wt, validateDetectionSummary as X, reviewRepairResourceSchema as Xn, journeyFindingsSchema as Xr, journeyPolicyRespondSchema as Xt, validateInspectionContribution as Y, reviewRepairInputSchema as Yn, journeyFindingImpactSchema as Yr, searchScopeDigest as Yt, inspectionInputs as Z, reviewTransportBytes as Zn, journeyPreviewSchema as Zr, projectPreparationProgress as Zt, projectJourneyInventory as _, journeyCommitResultSchema as _n, preparationSettlementSchema as _r, maximumTermsFileBytes as _t, bCrossSegmentReviewSchema as a, producerVersion as ai, reviewAttemptsResultSchema as an, scanGitSeedsId as ar, maximumAgentSetupSessions as at, bReviewScope as b, confirmedHideAdditions as bn, journeyClassificationSessionsSchema as br, sendActionSchema as bt, reconstructBFields as c, recommendParallelism as ci, sessionReconciliationResourceSchema as cn, scanExclusionResourceSchema as cr, validateFailureLocation as ct, selectedValueMembers as d, defaultScopedSettings as di, sessionReviewInputSchema as dn, journeyInventoryQuerySchema as dr, manualUploadChoiceSchema as dt, commandSchema as ei, journeyIsolateSchema as en, planBRepair as er, readWorkspaceOutcomes as et, splitSelectorValues as f, freezeConfiguration as fi, sessionReviewQuerySchema as fn, journeyInventoryReadSchema as fr, manualUploadPrepareSchema as ft, changeJourney as g, sessionUsefulnessResourceSchema as gn, preparationBeginSchema as gr, emptyTermsRevision as gt, semanticGroupKey as h, sessionUsefulnessInputSchema as hn, emptyPreparationFacts as hr, candidateSortAvailable as ht, validateBCrossSegmentReview as i, gitMetadataBudgetBytes as ii, reviewAttemptsQuerySchema as in, scanSessionResourceSchema as ir, defaultAgentSetupInclusion as it, profileUrlMatchesIdentity as j, bExceptionRanges as jn, agentSourcePathSegment as jr, journeyGuidance as jt, deviceAuthorizationSchema as k, packHideIndex as kn, staticSessionId as kr, attemptBudgetCodePoints as kt, reviseGroupMembership as l, approvedTreatmentSchema as li, sessionRereadInputSchema as ln, validateScanExclusion as lr, manualUploadActionSchema as lt, hideScopeDigest as m, staticCatalogRef as mi, sessionReviewStatusSchema as mn, journeyPreparationProgressSchema as mr, manualUploadStartSchema as mt, scanBatchEquivalenceDigest as n, selectionBatchSchema as ni, sortingApplySchema as nn, scanCanonicalResourceSchema as nr, appendSensitiveTerms as nt, bRereadDigest as o, stateSchema as oi, sessionReconcileInputSchema as on, scanGitSeedsResource as or, artifactFailureDetailSchema as ot, activeJourneyTerms as p, selectFrozenConfiguration as pi, sessionReviewResourceSchema as pn, journeyInventorySchema as pr, manualUploadSchema as pt, validateInspectionInputs as q, reviewCandidateInputSchema as qn, withReadingProgress as qr, journeySearchResultSchema as qt, locateTermEvidence as r, selectionSchema as ri, reviewAttemptResourceSchema as rn, scanPreparationDigest as rr, classifyAgentSetup as rt, reconcileBSession as s, sourceChangePolicy as si, sessionReconcileResultSchema as sn, verifiedScanGitSeeds as sr, resolveFailureLocation as st, scanBatchContextDigest as t, packageCommandSchema as ti, journeyPlaceSchema as tn, scanAliasResourceSchema as tr, reviewInventory as tt, resolveGroupSplit as u, effectiveTreatmentSchema as ui, sessionRereadResourceSchema as un, resolveSourceSelection as ur, manualUploadBindingSchema as ut, preparationScope as v, journeyCommitSchema as vn, preparationStartSchema as vr, normalizeSensitiveTerms as vt, reviewBatchReuse as w, settleConfirmedHides as wn, nativeEventsSchema as wr, settleCorrections as wt, rebindReviewAlignment as x, confirmedHideDeltaSchema as xn, applyCardAnswers as xr, sendChoiceSchema as xt, isGenericPublicTerm as y, journeyEventSchema as yn, validatePreparationFacts as yr, replaceSensitiveTermsSchema as yt, inspectionStartSchema as z, dictionaryHides as zn, sendSettingsSchema as zr, retireScanGeneration as zt };
13413
+ export { settingsBatchSchema as $, reviewTransportBytes as $n, journeyPreviewSchema as $r, projectPreparationProgress as $t, deviceAuthorizationSchema as A, maximumHideIndexTokens as An, staticReviewDigest as Ar, nativeAdapterVersions as At, inspectionStartSchema as B, confirmedHideTerms as Bn, sendResolutionSchema as Br, classificationWorks as Bt, rebindReviewOverlay as C, confirmedHideDeltaSchema as Cn, applyCardAnswers as Cr, sendPrepareSchema as Ct, staticallyHiddenFindings as D, termHideAdditions as Dn, nativeGetSchema as Dr, currentJourneyAdapters as Dt, guardedFindingText as E, settleConfirmedHides as En, nativeEventsSchema as Er, settleCorrections as Et, sourceIdentityEvidence as F, bTermMatcher as Fn, agentSourcesSchema as Fr, journeyBatchReadSchema as Ft, validateInspectionClaim as G, retireWorkDescription as Gn, isReadingComplete as Gr, journeyContextSchema as Gt, validateInspectionBatches as H, journeyConfirmedHides as Hn, hasCompleteWorkDescription as Hr, newJourneyWork as Ht, withSourceEvidence as I, bWordBounded as In, journeySendSchema as Ir, journeyReviewStorageQuerySchema as It, validateInspectionInputs as J, workCorrectionBinding as Jn, selectedWorks as Jr, hidePublishSchema as Jt, validateInspectionFence as K, workDecisionDigest as Kn, isSelectedWork as Kr, hideBeginSchema as Kt, agentSetupKey as L, confirmedHideGroupIds as Ln, sendArtifactSchema as Lr, applyClassificationProposal as Lt, profileUrlMatchesIdentity as M, bContainment as Mn, staticSessionResourceSchema as Mr, validateAttemptAppend as Mt, readAccountAvatarUrl as N, bExceptionRanges as Nn, agentSourcePathSegment as Nr, journeyGuidance as Nt, createAccount as O, addHideIndexTokens as On, nativeRespondSchema as Or, obsoleteJourney as Ot, storedCredentialSchema as P, bMaskedHits as Pn, agentSourceSchema as Pr, applyClassification as Pt, inspectionInputs as Q, reviewRepairResourceSchema as Qn, journeyFindingsSchema as Qr, journeyPolicyRespondSchema as Qt, createApplication as R, confirmedHideKey as Rn, sendReceiptSchema as Rr, classificationCommitSchema as Rt, rebindReviewAlignment as S, confirmedHideAdditions as Sn, journeyClassificationSessionsSchema as Sr, sendChoiceSchema as St, reviewBatchReuse as T, renderedHideValue as Tn, privacyDecisionDigest as Tr, sendStartSchema as Tt, validateInspectionRequest as U, maskedHitsStale as Un, isClassifying as Ur, reviewCompileSchema as Ut, validateInspectionBatch as V, dictionaryHides as Vn, sendSettingsSchema as Vr, retireScanGeneration as Vt, inspectionQuerySchema as W, syncTermGroups as Wn, isIncludedWork as Wr, journeyContextQuerySchema as Wt, validateInspectionContribution as X, reviewCandidateResourceSchema as Xn, mergePrivacyTerms as Xr, journeySearchSaveSchema as Xt, validateInspectionQuery as Y, reviewCandidateInputSchema as Yn, withReadingProgress as Yr, journeySearchResultSchema as Yt, validateDetectionSummary as Z, reviewRepairInputSchema as Zn, journeyFindingImpactSchema as Zr, searchScopeDigest as Zt, changeJourney as _, sessionUsefulnessInputSchema as _n, emptyPreparationFacts as _r, emptyTermsRevision as _t, bCrossSegmentReviewSchema as a, selectionSchema as ai, reviewAttemptResourceSchema as an, scanPreparationDigest as ar, defaultAgentSetupInclusion as at, isGenericPublicTerm as b, journeyCommitSchema as bn, preparationStartSchema as br, replaceSensitiveTermsSchema as bt, reconstructBFields as c, stateSchema as ci, sessionReconcileInputSchema as cn, scanGitSeedsResource as cr, resolveFailureLocation as ct, resolveGroupSplit as d, approvedTreatmentSchema as di, sessionRereadInputSchema as dn, validateScanExclusion as dr, manualUploadBindingSchema as dt, journeyRenderInputSchema as ei, journeyResourceQuerySchema as en, bReviewDigest as er, settingsQuerySchema as et, selectedValueMembers as f, effectiveTreatmentSchema as fi, sessionRereadResourceSchema as fn, resolveSourceSelection as fr, manualUploadChoiceSchema as ft, semanticGroupKey as g, staticCatalogRef as gi, sessionReviewStatusSchema as gn, journeyPreparationProgressSchema as gr, candidateSortAvailable as gt, hideScopeDigest as h, selectFrozenConfiguration as hi, sessionReviewResourceSchema as hn, journeyInventorySchema as hr, manualUploadStartSchema as ht, validateBCrossSegmentReview as i, selectionBatchSchema as ii, sortingApplySchema as in, scanCanonicalResourceSchema as ir, classifyAgentSetup as it, deviceProfileScopeSchema as j, packHideIndex as jn, staticSessionId as jr, attemptBudgetCodePoints as jt, accountProfileSchema as k, hideKeyId as kn, hasCurrentStaticReview as kr, metadataProcessingVersion as kt, chooseCheapPlacement as l, sourceChangePolicy as li, sessionReconcileResultSchema as ln, verifiedScanGitSeeds as lr, validateFailureLocation as lt, activeJourneyTerms as m, freezeConfiguration as mi, sessionReviewQuerySchema as mn, journeyInventoryReadSchema as mr, manualUploadSchema as mt, scanBatchEquivalenceDigest as n, commandSchema as ni, journeyIsolateSchema as nn, planBRepair as nr, reviewInventory as nt, bRereadDigest as o, gitMetadataBudgetBytes as oi, reviewAttemptsQuerySchema as on, scanSessionResourceSchema as or, maximumAgentSetupSessions as ot, splitSelectorValues as p, defaultScopedSettings as pi, sessionReviewInputSchema as pn, journeyInventoryQuerySchema as pr, manualUploadPrepareSchema as pt, validateInspectionHead as q, workPrivacyDecisions as qn, isSkippedWork as qr, hideFinishSchema as qt, locateTermEvidence as r, packageCommandSchema as ri, journeyPlaceSchema as rn, scanAliasResourceSchema as rr, appendSensitiveTerms as rt, reconcileBSession as s, producerVersion as si, reviewAttemptsResultSchema as sn, scanGitSeedsId as sr, artifactFailureDetailSchema as st, scanBatchContextDigest as t, journeyRenderSchema as ti, journeyResourceSchema as tn, mergeBRepair as tr, readWorkspaceOutcomes as tt, reviseGroupMembership as u, recommendParallelism as ui, sessionReconciliationResourceSchema as un, scanExclusionResourceSchema as ur, manualUploadActionSchema as ut, projectJourneyInventory as v, sessionUsefulnessResourceSchema as vn, preparationBeginSchema as vr, maximumTermsFileBytes as vt, rebindReviewSubmit as w, readConfirmedHideChange as wn, assertJourneyPrivacyReady as wr, sendRequestSchema as wt, bReviewScope as x, journeyEventSchema as xn, validatePreparationFacts as xr, sendActionSchema as xt, preparationScope as y, journeyCommitResultSchema as yn, preparationSettlementSchema as yr, normalizeSensitiveTerms as yt, inspectionCancelSchema as z, confirmedHideKinds as zn, sendReplaceResultSchema as zr, classificationPartition as zt };
@@ -1,7 +1,7 @@
1
- import { Bn as nativeItems, En as walkNativeFields, Nn as parseNativeRecord, Rn as nativeBoolean, Vn as nativeText, Wn as retainedMainTextNodes, Xn as defaultLimits, an as observeSource, on as sourceSnapshotId, ur as ProcessingError, zn as nativeField } from "./locate-JYtFmKu-.mjs";
2
- import { Ot as nativeAdapterVersions, ii as gitMetadataBudgetBytes, tt as reviewInventory } from "./src--Ln5GHdz.mjs";
3
- import { a as isRecord, i as errorCode, n as checkDiscoveryAbort, o as unresolvedMetadata, r as discoveryBounds, t as DiscoveryWarnings } from "./model-C1VzgKLi.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-hQ_W2p_Y.mjs";
1
+ import { Bn as nativeItems, En as walkNativeFields, Nn as parseNativeRecord, Rn as nativeBoolean, Vn as nativeText, Wn as retainedMainTextNodes, Xn as defaultLimits, an as observeSource, on as sourceSnapshotId, ur as ProcessingError, zn as nativeField } from "./locate-CNU4z9G1.mjs";
2
+ import { At as nativeAdapterVersions, nt as reviewInventory, oi as gitMetadataBudgetBytes } from "./src-Bz2CXuiR.mjs";
3
+ import { a as isRecord, i as errorCode, n as checkDiscoveryAbort, o as unresolvedMetadata, r as discoveryBounds, t as DiscoveryWarnings } from "./model-CYweY9fR.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-CnI7NSET.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";
@@ -1,4 +1,4 @@
1
- import { i as createExecutor, t as assertStoreHeap } from "./heap-BR8WjR25.mjs";
1
+ import { i as createExecutor, t as assertStoreHeap } from "./heap-CApARI9x.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");