@wayai/cli 0.3.362 → 0.3.363

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/dist/index.js CHANGED
@@ -17522,10 +17522,10 @@ var init_chunk_TRK5L5I5 = __esm({
17522
17522
  }
17523
17523
  });
17524
17524
 
17525
- // ../../packages/core/dist/chunk-K6O2P77D.js
17525
+ // ../../packages/core/dist/chunk-64HCHXKB.js
17526
17526
  var CASE_CHECK_CSV_MAX_BYTES, CASE_DECISIONS_CSV_PATH, CASE_CONFIDENTIAL_DECISIONS_CSV_PATH, caseChecksQuery;
17527
- var init_chunk_K6O2P77D = __esm({
17528
- "../../packages/core/dist/chunk-K6O2P77D.js"() {
17527
+ var init_chunk_64HCHXKB = __esm({
17528
+ "../../packages/core/dist/chunk-64HCHXKB.js"() {
17529
17529
  "use strict";
17530
17530
  init_chunk_YR7QALGP();
17531
17531
  init_chunk_HZ6CADSY();
@@ -17539,14 +17539,14 @@ var init_chunk_K6O2P77D = __esm({
17539
17539
  }
17540
17540
  });
17541
17541
 
17542
- // ../../packages/core/dist/chunk-NUJ5GZHA.js
17542
+ // ../../packages/core/dist/chunk-JQDFPWWJ.js
17543
17543
  var CASE_REVIEW_DECISIONS, CASE_ISSUED_FORMATS, CASE_REVIEW_COMMENT_MAX_LENGTH, CASE_REVIEW_JUSTIFICATION_MAX_LENGTH, text2, caseSubmissionParam, decideCaseSubmissionBody, caseIssuedQuery, CASE_APPROVALS_STATES, caseApprovalsQuery, caseCompareDefaultQuery, caseApprovalsAgendaQuery;
17544
- var init_chunk_NUJ5GZHA = __esm({
17545
- "../../packages/core/dist/chunk-NUJ5GZHA.js"() {
17544
+ var init_chunk_JQDFPWWJ = __esm({
17545
+ "../../packages/core/dist/chunk-JQDFPWWJ.js"() {
17546
17546
  "use strict";
17547
17547
  init_chunk_72TNUJVF();
17548
17548
  init_chunk_TRK5L5I5();
17549
- init_chunk_K6O2P77D();
17549
+ init_chunk_64HCHXKB();
17550
17550
  init_chunk_YR7QALGP();
17551
17551
  init_chunk_MQQRYOE6();
17552
17552
  init_chunk_YFUYMQR2();
@@ -18143,10 +18143,10 @@ var init_chunk_27IZMIGG = __esm({
18143
18143
  }
18144
18144
  });
18145
18145
 
18146
- // ../../packages/core/dist/chunk-JAR3LH7D.js
18146
+ // ../../packages/core/dist/chunk-FQQYUXJK.js
18147
18147
  var CASE_VERSION_DECISION_REASON_MAX_LENGTH, CASE_VERSION_DECISIONS, caseVersionDecisionReason, reason, lineNumber2, recordCaseReferenceBody, CASE_PASSAGE_REVERSED_REASON, citeCasePassageBody, decideCaseVersionBody, CASE_PASSAGE_LINK_REQUIRED_REASON, CASE_PASSAGE_LINK_CHANGED_REASON, CASE_PASSAGE_NO_TEXT_REASON, CASE_PASSAGE_TEXT_TOO_LARGE_REASON, CASE_PASSAGE_NOT_TEXT_REASON, CASE_PASSAGE_OUT_OF_RANGE_REASON;
18148
- var init_chunk_JAR3LH7D = __esm({
18149
- "../../packages/core/dist/chunk-JAR3LH7D.js"() {
18148
+ var init_chunk_FQQYUXJK = __esm({
18149
+ "../../packages/core/dist/chunk-FQQYUXJK.js"() {
18150
18150
  "use strict";
18151
18151
  init_chunk_27IZMIGG();
18152
18152
  init_chunk_HZ6CADSY();
@@ -18187,13 +18187,13 @@ var init_chunk_JAR3LH7D = __esm({
18187
18187
  }
18188
18188
  });
18189
18189
 
18190
- // ../../packages/core/dist/chunk-N4CTQNZE.js
18190
+ // ../../packages/core/dist/chunk-HQ4ZTSJ3.js
18191
18191
  var caseInputLinkParam, caseCollectionDocumentOfCaseParam, linkCaseCollectionInputBody, linkCasePreviousOutputInputBody, linkCaseReceivedInputBody, linkCaseInputBody, CASE_LINK_OFFICIAL_VERSION_UNKNOWN_REASON, CASE_LINK_OUTPUT_NOT_PRIOR_REASON, CASE_LINK_RECEIVED_UNKNOWN_REASON, CASE_LINK_DOCUMENT_TYPE_MISMATCH_REASON, CASE_LINK_VERSION_NOT_CURRENT_REASON, CASE_COLLECTION_CASES_PAGE_MAX, caseCollectionCasesQuery, CASE_REFERENCES_PAGE_MAX, caseReferencesQuery;
18192
- var init_chunk_N4CTQNZE = __esm({
18193
- "../../packages/core/dist/chunk-N4CTQNZE.js"() {
18192
+ var init_chunk_HQ4ZTSJ3 = __esm({
18193
+ "../../packages/core/dist/chunk-HQ4ZTSJ3.js"() {
18194
18194
  "use strict";
18195
18195
  init_chunk_7Y3IO67N();
18196
- init_chunk_JAR3LH7D();
18196
+ init_chunk_FQQYUXJK();
18197
18197
  init_chunk_YFUYMQR2();
18198
18198
  init_chunk_CLGTGGVN();
18199
18199
  init_chunk_HZ6CADSY();
@@ -18207,7 +18207,11 @@ var init_chunk_N4CTQNZE = __esm({
18207
18207
  /** Why an earlier version is kept: a version decision. Unread when `version_id` is the current one. */
18208
18208
  reason: caseVersionDecisionReason.optional()
18209
18209
  }).strict();
18210
- linkCasePreviousOutputInputBody = external_exports.object({ official_version_id: uuidSchema }).strict();
18210
+ linkCasePreviousOutputInputBody = external_exports.object({
18211
+ official_version_id: uuidSchema,
18212
+ /** Why an earlier version is kept: a version decision. Unread when `official_version_id` is the current one. */
18213
+ reason: caseVersionDecisionReason.optional()
18214
+ }).strict();
18211
18215
  linkCaseReceivedInputBody = external_exports.object({ received_id: uuidSchema }).strict();
18212
18216
  linkCaseInputBody = external_exports.union([linkCaseCollectionInputBody, linkCasePreviousOutputInputBody, linkCaseReceivedInputBody]);
18213
18217
  CASE_LINK_OFFICIAL_VERSION_UNKNOWN_REASON = "official_version_unknown";
@@ -18298,12 +18302,12 @@ var init_chunk_26PIYACX = __esm({
18298
18302
  }
18299
18303
  });
18300
18304
 
18301
- // ../../packages/core/dist/chunk-NCOSWD3P.js
18305
+ // ../../packages/core/dist/chunk-43LK6AAU.js
18302
18306
  var lines, ordered, citeCaseOfficialVersionPassageBody, citeCaseReceivedPassageBody, citeCaseSourcePassageBody, citeCaseInputPassageBody, caseSourceRefSchema;
18303
- var init_chunk_NCOSWD3P = __esm({
18304
- "../../packages/core/dist/chunk-NCOSWD3P.js"() {
18307
+ var init_chunk_43LK6AAU = __esm({
18308
+ "../../packages/core/dist/chunk-43LK6AAU.js"() {
18305
18309
  "use strict";
18306
- init_chunk_JAR3LH7D();
18310
+ init_chunk_FQQYUXJK();
18307
18311
  init_chunk_27IZMIGG();
18308
18312
  init_chunk_HZ6CADSY();
18309
18313
  init_zod();
@@ -19552,7 +19556,7 @@ var init_contracts = __esm({
19552
19556
  init_chunk_5YZ3R7KF();
19553
19557
  init_chunk_2YEGUQR7();
19554
19558
  init_chunk_AHISKXHA();
19555
- init_chunk_NUJ5GZHA();
19559
+ init_chunk_JQDFPWWJ();
19556
19560
  init_chunk_K3PD6AOF();
19557
19561
  init_chunk_JNZVVHKO();
19558
19562
  init_chunk_KY3ZNL3E();
@@ -19562,18 +19566,18 @@ var init_contracts = __esm({
19562
19566
  init_chunk_72TNUJVF();
19563
19567
  init_chunk_TRK5L5I5();
19564
19568
  init_chunk_TRBCWOW2();
19565
- init_chunk_N4CTQNZE();
19569
+ init_chunk_HQ4ZTSJ3();
19566
19570
  init_chunk_7Y3IO67N();
19567
19571
  init_chunk_3SZD2H6D();
19568
19572
  init_chunk_A5TJEV6T();
19569
19573
  init_chunk_DFKHVG4Q();
19570
19574
  init_chunk_26PIYACX();
19571
- init_chunk_NCOSWD3P();
19575
+ init_chunk_43LK6AAU();
19572
19576
  init_chunk_5PKKFSSF();
19573
19577
  init_chunk_AF2RCYPB();
19574
19578
  init_chunk_6TYCOJ5O();
19575
19579
  init_chunk_G5S7KI42();
19576
- init_chunk_JAR3LH7D();
19580
+ init_chunk_FQQYUXJK();
19577
19581
  init_chunk_UEJOG2Q7();
19578
19582
  init_chunk_KEN2DASI();
19579
19583
  init_chunk_JQRL355P();
@@ -19617,7 +19621,7 @@ var init_contracts = __esm({
19617
19621
  init_chunk_MIWZOSPI();
19618
19622
  init_chunk_2ISUBJG7();
19619
19623
  init_chunk_C2UEA2KW();
19620
- init_chunk_K6O2P77D();
19624
+ init_chunk_64HCHXKB();
19621
19625
  init_chunk_YR7QALGP();
19622
19626
  init_chunk_27IZMIGG();
19623
19627
  init_chunk_6GSDWCB5();
@@ -42895,7 +42899,7 @@ var init_case_comments = __esm({
42895
42899
  var init_case_collection_citations = __esm({
42896
42900
  "../../packages/core/dist/contracts/case-collection-citations.js"() {
42897
42901
  "use strict";
42898
- init_chunk_JAR3LH7D();
42902
+ init_chunk_FQQYUXJK();
42899
42903
  init_chunk_27IZMIGG();
42900
42904
  init_chunk_6GSDWCB5();
42901
42905
  init_chunk_MQQRYOE6();
@@ -42919,11 +42923,11 @@ var init_case_collection_citations = __esm({
42919
42923
  var init_case_collection_links = __esm({
42920
42924
  "../../packages/core/dist/contracts/case-collection-links.js"() {
42921
42925
  "use strict";
42922
- init_chunk_N4CTQNZE();
42926
+ init_chunk_HQ4ZTSJ3();
42923
42927
  init_chunk_7Y3IO67N();
42924
42928
  init_chunk_3SZD2H6D();
42925
42929
  init_chunk_A5TJEV6T();
42926
- init_chunk_JAR3LH7D();
42930
+ init_chunk_FQQYUXJK();
42927
42931
  init_chunk_27IZMIGG();
42928
42932
  init_chunk_6GSDWCB5();
42929
42933
  init_chunk_MQQRYOE6();
@@ -44234,7 +44238,7 @@ function inputLinkState(input) {
44234
44238
  document_title: link2.document_title,
44235
44239
  version_title: link2.version_title
44236
44240
  };
44237
- return link2.pending_version_id ? { state: "undecided", linked_at: link2.linked_at, source: source2, current_id: link2.pending_version_id } : { state: "linked", linked_at: link2.linked_at, source: source2 };
44241
+ return link2.pending_version_id ? { state: "undecided", linked_at: link2.linked_at, source: source2, current_id: link2.pending_version_id, awaits: "decision" } : { state: "linked", linked_at: link2.linked_at, source: source2 };
44238
44242
  }
44239
44243
  const link = input.source_link;
44240
44244
  if (link === void 0) return input.dispensation ? { state: "dispensed" } : { state: "unknown" };
@@ -44254,7 +44258,26 @@ function inputLinkState(input) {
44254
44258
  phase_id: link.phase_id,
44255
44259
  version: link.version
44256
44260
  };
44257
- return link.current_version_id === link.official_version_id ? { state: "linked", linked_at: link.linked_at, source } : { state: "undecided", linked_at: link.linked_at, source, current_id: link.current_version_id };
44261
+ const at = { linked_at: link.linked_at, source };
44262
+ if (link.current_version_id === link.official_version_id) return { state: "linked", ...at };
44263
+ if (link.pending_version_id === void 0) return { state: "undecided", ...at, current_id: link.current_version_id, awaits: "relink" };
44264
+ if (link.pending_version_id !== null) return { state: "undecided", ...at, current_id: link.pending_version_id, awaits: "decision" };
44265
+ return link.current_version_id === null ? { state: "undecided", ...at, current_id: null, awaits: "decision" } : { state: "kept", ...at, current_id: link.current_version_id };
44266
+ }
44267
+ function decisionPending(input, label3, folders) {
44268
+ const state = inputLinkState(input);
44269
+ if (state.state === "kept") {
44270
+ return `The ${label3} is ${keptWords(state, folders)}: relinking it would undo that, so link writes and lists nothing for it. A person adopts the current one, in the web app.`;
44271
+ }
44272
+ if (state.state === "undecided" && state.awaits === "decision") {
44273
+ return `The ${label3} ${decisionWords(state, folders)}. A relink would take that decision: link writes and lists nothing for it.`;
44274
+ }
44275
+ return null;
44276
+ }
44277
+ function keptJustification(view, state) {
44278
+ if (view?.readable !== true || view.kind !== "official_version") return null;
44279
+ const linked = state.source.official_version_id;
44280
+ return (view.decisions ?? []).find((d) => d.decision === "keep" && d.previous_version_id === linked && d.new_version_id === state.current_id) ?? null;
44258
44281
  }
44259
44282
  function linkCommand(key, folder, origin, id) {
44260
44283
  const [flag, placeholder] = origin === "previous_output" ? ["--official-version", "<official_version_id>"] : ["--received", "<received_id>"];
@@ -44283,11 +44306,14 @@ function linkHint(key, folder, origin, linkable, folders = /* @__PURE__ */ new M
44283
44306
  if (linkable.length === 0) return NONE_LINKABLE;
44284
44307
  return `link it to one of the official versions it may link ${WHICH_LINKABLE}:${candidateBlock(linkable, key, folder, folders, indent)}`;
44285
44308
  }
44309
+ function decisionWords(link, folders) {
44310
+ const linked = sourceWords(link.source, folders);
44311
+ if (link.source.kind === "collection") return `links ${linked}, and a newer version awaits a decision: a person decides on it, in the web app`;
44312
+ return link.current_id === null ? `links ${linked}, which a correction superseded by a version not readable here: ${KEEP_OR_ADOPT}, unless one has (not told here)` : `links ${linked}, which a correction superseded by official version ${link.current_id}: ${KEEP_OR_ADOPT}`;
44313
+ }
44286
44314
  function undecidedWords(input, folder, link, folders) {
44315
+ if (link.awaits === "decision") return { text: decisionWords(link, folders), agent: false };
44287
44316
  const linked = sourceWords(link.source, folders);
44288
- if (link.source.kind === "collection") {
44289
- return { text: `links ${linked}, and a newer version awaits a decision: a person decides on it, in the web app`, agent: false };
44290
- }
44291
44317
  if (link.current_id === null) {
44292
44318
  return { text: `links ${linked}, which a correction superseded by a version not readable here: a person who reads it relinks it`, agent: false };
44293
44319
  }
@@ -44296,12 +44322,18 @@ function undecidedWords(input, folder, link, folders) {
44296
44322
  agent: true
44297
44323
  };
44298
44324
  }
44299
- function inputLine(input, folder, folders, linkable) {
44325
+ function keptWords(link, folders, decision) {
44326
+ const head = `linked to ${sourceWords(link.source, folders)}, kept by a person over the current official version ${link.current_id}`;
44327
+ return decision?.reason ? `${head}, justified: "${one2(decision.reason)}" (${one2(decision.created_at)})` : `${head} (its justification is in the web app)`;
44328
+ }
44329
+ function inputLine(input, folder, folders, linkable, kept) {
44300
44330
  const head = `${one2(input.key)} (${one2(input.name)}), ${input.origin.replaceAll("_", " ")}${input.required ? ", required" : ""}`;
44301
44331
  const state = inputLinkState(input);
44302
44332
  switch (state.state) {
44303
44333
  case "linked":
44304
44334
  return `${head}: linked to ${sourceWords(state.source, folders)}`;
44335
+ case "kept":
44336
+ return `${head}: ${keptWords(state, folders, kept)}`;
44305
44337
  case "undecided":
44306
44338
  return `${head}: ${undecidedWords(input, folder, state, folders).text}`;
44307
44339
  case "unreadable":
@@ -44398,7 +44430,7 @@ function passageSource(input, label3) {
44398
44430
  const state = inputLinkState(input);
44399
44431
  if (state.state === "unreadable") throw expected(`The ${label3} links a source not readable here: no passage of it can be cited with this authorization.`);
44400
44432
  if (state.state === "unknown") throw expected(`This server does not say what the ${label3} links: no passage can be cited from here.`);
44401
- if (state.state !== "linked" && state.state !== "undecided") throw expected(`The ${label3} is not linked: link it first.`);
44433
+ if (state.state !== "linked" && state.state !== "kept" && state.state !== "undecided") throw expected(`The ${label3} is not linked: link it first.`);
44402
44434
  const { source } = state;
44403
44435
  if (source.kind === "collection") return { document_id: source.document_id, version_id: source.version_id };
44404
44436
  return source.kind === "official_version" ? { official_version_id: source.official_version_id } : { received_id: source.received_id };
@@ -44424,7 +44456,7 @@ function citeFailure(err, session, named) {
44424
44456
  if (err.status === 403) return expected(`Your access to case ${session.connection.code} does not cite passages: that takes Edit level.`);
44425
44457
  return caseCallFailure(err, session.connection, `The ${named.label} was not found`);
44426
44458
  }
44427
- var one2, linkPrefix, candidateLines, candidateBlock, NONE_LINKABLE, noneLinkable, WHICH_LINKABLE, agentLinks, sourceWords;
44459
+ var one2, linkPrefix, candidateLines, candidateBlock, NONE_LINKABLE, noneLinkable, WHICH_LINKABLE, agentLinks, sourceWords, KEEP_OR_ADOPT;
44428
44460
  var init_case_inputs = __esm({
44429
44461
  "src/cases/case-inputs.ts"() {
44430
44462
  "use strict";
@@ -44458,6 +44490,7 @@ ${line}`).join("");
44458
44490
  return `received document "${one2(source.title)}" (${one2(source.type)}), registered in ${folder(source.phase_id)} [${source.received_id}]`;
44459
44491
  }
44460
44492
  };
44493
+ KEEP_OR_ADOPT = "a person decides, in the web app, whether to keep it (with a justification) or adopt the current one";
44461
44494
  }
44462
44495
  });
44463
44496
 
@@ -44465,8 +44498,8 @@ ${line}`).join("");
44465
44498
  var init_case_input_sources = __esm({
44466
44499
  "../../packages/core/dist/contracts/case-input-sources.js"() {
44467
44500
  "use strict";
44468
- init_chunk_NCOSWD3P();
44469
- init_chunk_JAR3LH7D();
44501
+ init_chunk_43LK6AAU();
44502
+ init_chunk_FQQYUXJK();
44470
44503
  init_chunk_27IZMIGG();
44471
44504
  init_chunk_6GSDWCB5();
44472
44505
  init_chunk_MQQRYOE6();
@@ -44511,7 +44544,7 @@ var init_case_notes = __esm({
44511
44544
  var init_case_checks = __esm({
44512
44545
  "../../packages/core/dist/contracts/case-checks.js"() {
44513
44546
  "use strict";
44514
- init_chunk_K6O2P77D();
44547
+ init_chunk_64HCHXKB();
44515
44548
  init_chunk_YR7QALGP();
44516
44549
  init_chunk_HZ6CADSY();
44517
44550
  }
@@ -44564,7 +44597,8 @@ function blockerLine(b, names) {
44564
44597
  }
44565
44598
  async function namesFor(session, detail, phaseIds, opts = {}) {
44566
44599
  const names = new CaseNames(session, detail);
44567
- if (readsWork(detail)) for (const id of phaseIds) await names.readPhase(id, opts.agenda ?? true, opts.linkableFor);
44600
+ const kept = opts.kept === true && !detail.access.capabilities.includes("read_confidential");
44601
+ if (readsWork(detail)) for (const id of phaseIds) await names.readPhase(id, { agenda: opts.agenda ?? true, linkableFor: opts.linkableFor, kept });
44568
44602
  return names;
44569
44603
  }
44570
44604
  function printPhasesView(detail, state) {
@@ -44637,7 +44671,7 @@ async function caseExplain(session, opts) {
44637
44671
  return;
44638
44672
  }
44639
44673
  if (opts.json) {
44640
- const names2 = asked && readsWork(detail) ? await namesFor(session, detail, [asked.phase_id], { agenda: false }) : null;
44674
+ const names2 = asked && readsWork(detail) ? await namesFor(session, detail, [asked.phase_id], { agenda: false, kept: true }) : null;
44641
44675
  const inputs2 = names2 ? (names2.phaseInputs.get(asked.phase_id) ?? []).map((i) => inputJson(i, names2)) : null;
44642
44676
  console.log(JSON.stringify({ case: detail, state, ...inputs2 ? { inputs: inputs2 } : {} }, null, 2));
44643
44677
  return;
@@ -44653,7 +44687,7 @@ async function caseExplain(session, opts) {
44653
44687
  console.log(`Phase ${phaseLabel(asked)}: ${st ? statusWords(st.status) : "not shown"}. Nothing holds it.`);
44654
44688
  return;
44655
44689
  }
44656
- const names = await namesFor(session, detail, named, asked ? {} : { linkableFor: pendingInputs([...phases, ...state.tasks]) });
44690
+ const names = await namesFor(session, detail, named, asked ? { kept: true } : { linkableFor: pendingInputs([...phases, ...state.tasks]) });
44657
44691
  if (phases.length === 0) console.log(`Every phase of ${detail.code} is delivered or dispensed.`);
44658
44692
  const fullyNamed = new Set(named);
44659
44693
  for (const p of phases) {
@@ -44674,7 +44708,7 @@ async function caseExplain(session, opts) {
44674
44708
  if (inputs.length) {
44675
44709
  console.log(`Inputs of ${asked.folder}:`);
44676
44710
  const folders = names.folders();
44677
- for (const i of inputs) console.log(` ${inputLine(i, asked.folder, folders, names.linkable(i.id))}`);
44711
+ for (const i of inputs) console.log(` ${inputLine(i, asked.folder, folders, names.linkable(i.id), names.kept(i.id))}`);
44678
44712
  }
44679
44713
  }
44680
44714
  function agentWork(b, names) {
@@ -44903,13 +44937,15 @@ async function caseLink(session, inputName, opts) {
44903
44937
  const { detail, phase, input, label: label3 } = await locateInput(session, inputName, opts.phase);
44904
44938
  const mismatch = linkMismatch(input, label3, target);
44905
44939
  if (mismatch) throw expected(mismatch);
44940
+ const folders = phaseFolders(detail);
44941
+ const decided = decisionPending(input, label3, folders);
44942
+ if (decided) throw expected(decided);
44906
44943
  let ref;
44907
44944
  if (target.kind === "source") {
44908
44945
  ref = target.ref;
44909
44946
  } else {
44910
44947
  const listed3 = await readLinkable(session, input.id);
44911
44948
  if (listed3 === null) throw expected("This server lists no official version an input may link: name the one to link by its id (--official-version <id>).");
44912
- const folders = phaseFolders(detail);
44913
44949
  const named = { label: label3, key: input.key, folder: phase.folder };
44914
44950
  if (target.kind === "list") {
44915
44951
  for (const line of linkableLines(listed3, named, folders)) console.log(line);
@@ -45100,14 +45136,17 @@ var init_case_work = __esm({
45100
45136
  groups = /* @__PURE__ */ new Map();
45101
45137
  /** The official versions each unlinked input of origin `previous_output` read may link (`./case-inputs.ts` `Linkable`). */
45102
45138
  linkableOf = /* @__PURE__ */ new Map();
45139
+ /** The decision that kept each kept input read for it (`./case-inputs.ts` `keptJustification`). */
45140
+ keptOf = /* @__PURE__ */ new Map();
45103
45141
  folderOf;
45104
45142
  /** Each phase read's inputs, in their order. */
45105
45143
  phaseInputs = /* @__PURE__ */ new Map();
45106
45144
  /**
45107
- * Read one phase's outputs and inputs, and (unless `agenda` is false) its agenda groups, to name them; and what each
45108
- * unlinked input of origin `previous_output` may link, of those `linkableFor` holds (all of them when it is undefined).
45145
+ * Read one phase's outputs and inputs, and (unless `agenda` is false) its agenda groups, to name them; what each
45146
+ * unlinked input of origin `previous_output` may link, of those `linkableFor` holds (all of them when it is undefined);
45147
+ * and, when `kept`, the decision that kept each kept input.
45109
45148
  */
45110
- async readPhase(phaseId, agenda = true, linkableFor) {
45149
+ async readPhase(phaseId, { agenda, linkableFor, kept }) {
45111
45150
  const s = this.session;
45112
45151
  const work = (await call2(s, () => s.api.getCasePhaseWork(s.connection, phaseId))).data;
45113
45152
  for (const o of work.outputs) this.outputs.set(o.id, `${one3(o.code)} (${one3(o.document_type)})`);
@@ -45124,9 +45163,20 @@ var init_case_work = __esm({
45124
45163
  cursor = next_cursor;
45125
45164
  }
45126
45165
  };
45127
- await Promise.all([groups(), ...unlinked.map(async (i) => {
45128
- this.linkableOf.set(i.id, await readLinkable(s, i.id));
45129
- })]);
45166
+ const keeps = kept ? work.inputs.flatMap((i) => {
45167
+ const state = inputLinkState(i);
45168
+ return state.state === "kept" ? [{ id: i.id, state }] : [];
45169
+ }) : [];
45170
+ await Promise.all([
45171
+ groups(),
45172
+ ...unlinked.map(async (i) => {
45173
+ this.linkableOf.set(i.id, await readLinkable(s, i.id));
45174
+ }),
45175
+ ...keeps.map(async ({ id, state }) => {
45176
+ const view = (await call2(s, () => s.api.getCaseInputSourceLink(s.connection, id))).data;
45177
+ this.keptOf.set(id, keptJustification(view, state));
45178
+ })
45179
+ ]);
45130
45180
  }
45131
45181
  // Each name with its noun: `output memo (Technical memo)`, or `an output` for one not read.
45132
45182
  phase(id) {
@@ -45162,6 +45212,10 @@ var init_case_work = __esm({
45162
45212
  linkable(id) {
45163
45213
  return this.linkableOf.get(id);
45164
45214
  }
45215
+ /** The decision that kept a kept input, as read: undefined when not read, null when the read names none. */
45216
+ kept(id) {
45217
+ return this.keptOf.get(id);
45218
+ }
45165
45219
  /** Each phase's folder, by phase id. */
45166
45220
  folders() {
45167
45221
  return this.folderOf;
@@ -45182,7 +45236,16 @@ var init_case_work = __esm({
45182
45236
  noteLine = (n) => `${n.kind === "pending" ? "pending" : "next step"}: ${one3(n.text)} [${n.note_id}]`;
45183
45237
  inputJson = (i, names) => {
45184
45238
  const linkable = names.linkable(i.id);
45185
- return { input_id: i.id, key: i.key, origin: i.origin, required: i.required, link: inputLinkState(i), ...linkable !== void 0 ? { linkable } : {} };
45239
+ const kept = names.kept(i.id);
45240
+ return {
45241
+ input_id: i.id,
45242
+ key: i.key,
45243
+ origin: i.origin,
45244
+ required: i.required,
45245
+ link: inputLinkState(i),
45246
+ ...linkable !== void 0 ? { linkable } : {},
45247
+ ...kept !== void 0 ? { kept_by: kept } : {}
45248
+ };
45186
45249
  };
45187
45250
  blockerKey = (b) => {
45188
45251
  switch (b.reason) {
@@ -46500,10 +46563,11 @@ brief The case at a glance: status, phases under way, deadlines, open
46500
46563
  tasks, open pending items and next steps.
46501
46564
  next What to do next on the phases under way, then what waits on
46502
46565
  someone else: an input to link (with the command that links it),
46503
- and a linked one whose version a newer one replaced.
46566
+ and a linked one whose newer version awaits a person's decision,
46567
+ in the web app. A version a person kept is settled.
46504
46568
  explain Why each phase and task is not done, and who can move it. --phase
46505
46569
  names everything holding one phase, and each of its inputs'
46506
- links.
46570
+ links (a kept version with its justification).
46507
46571
  check A delivery's checks over the case's files as WayAI holds them:
46508
46572
  a joint phase's, or one output's (--output). Inside a clone, it
46509
46573
  also compares the case's package in the mirror with the published
@@ -46541,7 +46605,8 @@ link Link an input of one phase (its key, as explain --phase names it):
46541
46605
  phase's received/). --list lists the official versions an input
46542
46606
  of origin previous_output may link, each with the command that
46543
46607
  links it, and links nothing. A collection input is linked in the
46544
- web app.
46608
+ web app. An input whose version a person kept, or one awaiting
46609
+ their decision, is neither linked nor listed: that is theirs.
46545
46610
  cite Cite a passage of what an input links now, by its lines (as
46546
46611
  12-18, numbered as the mirror's inputs/ texts number them): the
46547
46612
  case hashes them. Any origin.