@akagilnc/pi-workflow-roles 0.1.4422 → 0.1.4444

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.
@@ -2669,21 +2669,6 @@ function projectTicketProvenanceSessions(value) {
2669
2669
  }
2670
2670
  return sessions;
2671
2671
  }
2672
- function projectTicketProvenanceAmendments(value) {
2673
- if (!Array.isArray(value)) return [];
2674
- const out = [];
2675
- for (const raw of value) {
2676
- if (!isRecord2(raw)) continue;
2677
- const s = nonNegativeInteger(raw.s);
2678
- const line2 = positiveInteger(raw.line);
2679
- const speaker = projectSpeaker(raw.speaker);
2680
- const text = raw.text;
2681
- if (s === void 0 || line2 === void 0 || speaker === void 0) continue;
2682
- if (typeof text !== "string") continue;
2683
- out.push({ s, line: line2, speaker, text });
2684
- }
2685
- return out;
2686
- }
2687
2672
  function projectTicketProvenanceHeader(value) {
2688
2673
  if (!isRecord2(value)) return void 0;
2689
2674
  const ticket = positiveInteger(value.ticket);
@@ -2708,12 +2693,14 @@ function projectTicketProvenanceLine(value) {
2708
2693
  const s = nonNegativeInteger(value.s);
2709
2694
  if (speaker === void 0 || s === void 0) return void 0;
2710
2695
  if (typeof value.text !== "string") return void 0;
2711
- const line2 = positiveInteger(value.line);
2696
+ const sourcePosition = nonNegativeInteger(value.sourcePosition);
2697
+ const sourceIdentity = typeof value.sourceIdentity === "string" && value.sourceIdentity !== "" ? value.sourceIdentity : void 0;
2712
2698
  const id = typeof value.id === "string" && value.id !== "" ? value.id : void 0;
2713
2699
  return {
2714
2700
  speaker,
2715
2701
  s,
2716
- ...line2 === void 0 ? {} : { line: line2 },
2702
+ ...sourcePosition === void 0 ? {} : { sourcePosition },
2703
+ ...sourceIdentity === void 0 ? {} : { sourceIdentity },
2717
2704
  ...id === void 0 ? {} : { id },
2718
2705
  text: value.text
2719
2706
  };
@@ -2805,11 +2792,6 @@ function projectDiaristSessions(value) {
2805
2792
  if (raw === void 0) return [];
2806
2793
  return projectTicketProvenanceSessions(raw);
2807
2794
  }
2808
- function projectDiaristAmendments(value) {
2809
- const raw = value?.amendments;
2810
- if (raw === void 0) return [];
2811
- return projectTicketProvenanceAmendments(raw);
2812
- }
2813
2795
  var DIARIST_OUTPUT_TOOL_NAME, DIARIST_ACCEPTED_TEXT;
2814
2796
  var init_diarist_contracts = __esm({
2815
2797
  "src/diarist-contracts.ts"() {
@@ -16418,6 +16400,20 @@ function resolveTicketProvenanceVolume(ticketNumber, cwd, home) {
16418
16400
  );
16419
16401
  return { recordFile: path.recordFile, volumeDir: path.sessionDir };
16420
16402
  }
16403
+ function projectTicketProvenanceRaw(value) {
16404
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
16405
+ const raw = value;
16406
+ if (typeof raw.raw !== "string" || !Number.isInteger(raw.s) || raw.s < 0 || !Number.isInteger(raw.sourcePosition) || raw.sourcePosition < 0) {
16407
+ return void 0;
16408
+ }
16409
+ const sourceIdentity = typeof raw.sourceIdentity === "string" && raw.sourceIdentity !== "" ? raw.sourceIdentity : void 0;
16410
+ return {
16411
+ raw: raw.raw,
16412
+ s: raw.s,
16413
+ sourcePosition: raw.sourcePosition,
16414
+ ...sourceIdentity === void 0 ? {} : { sourceIdentity }
16415
+ };
16416
+ }
16421
16417
  function projectTicketProvenanceCommit(value) {
16422
16418
  if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
16423
16419
  const record4 = value;
@@ -16432,9 +16428,18 @@ function projectTicketProvenanceCommit(value) {
16432
16428
  if (sessions === void 0 || !Array.isArray(body.lines)) return void 0;
16433
16429
  const lines = [];
16434
16430
  for (const raw of body.lines) {
16431
+ if (typeof raw === "string") {
16432
+ lines.push(raw);
16433
+ continue;
16434
+ }
16435
16435
  const line2 = projectTicketProvenanceLine(raw);
16436
- if (line2 === void 0) return void 0;
16437
- lines.push(line2);
16436
+ if (line2 !== void 0) {
16437
+ lines.push(line2);
16438
+ continue;
16439
+ }
16440
+ const preserved = projectTicketProvenanceRaw(raw);
16441
+ if (preserved === void 0) return void 0;
16442
+ lines.push(preserved);
16438
16443
  }
16439
16444
  return { timestamp: record4.timestamp, sessions, lines };
16440
16445
  }
@@ -16445,7 +16450,14 @@ async function readTicketProvenance(ticketNumber, cwd, home) {
16445
16450
  text = await readFile18(recordFile, "utf8");
16446
16451
  } catch (error) {
16447
16452
  if (error.code === "ENOENT") {
16448
- return { header: void 0, lines: [], unprojectedRaw: [], recordFile };
16453
+ return {
16454
+ header: void 0,
16455
+ lines: [],
16456
+ unprojectedRaw: [],
16457
+ recordFile,
16458
+ sourceIdentities: /* @__PURE__ */ new Map(),
16459
+ legacySourcePositions: /* @__PURE__ */ new Map()
16460
+ };
16449
16461
  }
16450
16462
  throw error;
16451
16463
  }
@@ -16453,6 +16465,31 @@ async function readTicketProvenance(ticketNumber, cwd, home) {
16453
16465
  let header;
16454
16466
  const lines = [];
16455
16467
  const unprojectedRaw = [];
16468
+ const sourceIdentities = /* @__PURE__ */ new Map();
16469
+ const legacySourcePositions = /* @__PURE__ */ new Map();
16470
+ const rememberIdentity = (s, identity) => {
16471
+ const seen = sourceIdentities.get(s) ?? /* @__PURE__ */ new Set();
16472
+ const fresh = !seen.has(identity);
16473
+ seen.add(identity);
16474
+ sourceIdentities.set(s, seen);
16475
+ return fresh;
16476
+ };
16477
+ const rememberLegacyPosition = (s, position) => {
16478
+ const seen = legacySourcePositions.get(s) ?? /* @__PURE__ */ new Set();
16479
+ seen.add(position);
16480
+ legacySourcePositions.set(s, seen);
16481
+ };
16482
+ const remapCoverage = (coverage, priorIndexes) => {
16483
+ const normalized = /* @__PURE__ */ new Map();
16484
+ for (const [s, values] of coverage) {
16485
+ const target = priorIndexes[s] ?? s;
16486
+ const union = normalized.get(target) ?? /* @__PURE__ */ new Set();
16487
+ for (const value of values) union.add(value);
16488
+ normalized.set(target, union);
16489
+ }
16490
+ coverage.clear();
16491
+ for (const [s, values] of normalized) coverage.set(s, values);
16492
+ };
16456
16493
  let sawFirst = false;
16457
16494
  for (let index = 0; index < physical.length; index += 1) {
16458
16495
  const raw = physical[index];
@@ -16477,10 +16514,30 @@ async function readTicketProvenance(ticketNumber, cwd, home) {
16477
16514
  const commit = projectTicketProvenanceCommit(parsed);
16478
16515
  if (commit !== void 0) {
16479
16516
  const merged = mergeSessionBounds(header?.sessions, commit.sessions);
16480
- const remapped = commit.lines.map((entry) => ({
16481
- ...entry,
16482
- s: merged.incomingIndexes[entry.s] ?? entry.s
16483
- }));
16517
+ remapCoverage(sourceIdentities, merged.priorIndexes);
16518
+ remapCoverage(legacySourcePositions, merged.priorIndexes);
16519
+ const remapped = [];
16520
+ for (const entry of commit.lines) {
16521
+ if (typeof entry === "string") {
16522
+ unprojectedRaw.push(entry);
16523
+ continue;
16524
+ }
16525
+ const s = merged.incomingIndexes[entry.s] ?? merged.priorIndexes[entry.s] ?? entry.s;
16526
+ if ("raw" in entry) {
16527
+ if (entry.sourceIdentity !== void 0) {
16528
+ if (rememberIdentity(s, entry.sourceIdentity)) unprojectedRaw.push(entry.raw);
16529
+ } else {
16530
+ rememberLegacyPosition(s, entry.sourcePosition);
16531
+ unprojectedRaw.push(entry.raw);
16532
+ }
16533
+ continue;
16534
+ }
16535
+ remapped.push({ ...entry, s });
16536
+ if (entry.id === void 0) {
16537
+ if (entry.sourceIdentity !== void 0) rememberIdentity(s, entry.sourceIdentity);
16538
+ else if (entry.sourcePosition !== void 0) rememberLegacyPosition(s, entry.sourcePosition);
16539
+ }
16540
+ }
16484
16541
  const now = commit.timestamp;
16485
16542
  header = {
16486
16543
  repo: header?.repo ?? resolveBookKeyFromGit(cwd),
@@ -16498,7 +16555,19 @@ async function readTicketProvenance(ticketNumber, cwd, home) {
16498
16555
  }
16499
16556
  unprojectedRaw.push(raw);
16500
16557
  }
16501
- return { header, lines, unprojectedRaw, recordFile };
16558
+ for (const line2 of lines) {
16559
+ if (line2.id !== void 0) continue;
16560
+ if (line2.sourceIdentity !== void 0) rememberIdentity(line2.s, line2.sourceIdentity);
16561
+ else if (line2.sourcePosition !== void 0) rememberLegacyPosition(line2.s, line2.sourcePosition);
16562
+ }
16563
+ return {
16564
+ header,
16565
+ lines,
16566
+ unprojectedRaw,
16567
+ recordFile,
16568
+ sourceIdentities,
16569
+ legacySourcePositions
16570
+ };
16502
16571
  }
16503
16572
  function resolveBoundIndex(bound, sessionLines) {
16504
16573
  if (typeof bound.id === "string" && bound.id !== "") {
@@ -16517,8 +16586,8 @@ function resolveBoundIndex(bound, sessionLines) {
16517
16586
  }
16518
16587
  return void 0;
16519
16588
  }
16520
- function amendmentKey(s, line2) {
16521
- return `${s}:${line2}`;
16589
+ function dialogueIdentity(s, id) {
16590
+ return `${s}\0${id}`;
16522
16591
  }
16523
16592
  function rangeDeclarationKey(range) {
16524
16593
  return JSON.stringify({
@@ -16569,7 +16638,8 @@ function undeclaredSessionRanges(prior, merged) {
16569
16638
  const out = [];
16570
16639
  for (let s = 0; s < merged.length; s += 1) {
16571
16640
  const session = merged[s];
16572
- const declared = priorKeys.get(physicalPathIdentity(session.path)) ?? /* @__PURE__ */ new Set();
16641
+ const identity = physicalPathIdentity(session.path);
16642
+ const declared = priorKeys.get(identity) ?? /* @__PURE__ */ new Set();
16573
16643
  const fresh = session.ranges.filter(
16574
16644
  (range) => !declared.has(rangeDeclarationKey(range))
16575
16645
  );
@@ -16587,36 +16657,61 @@ function undeclaredSessionRanges(prior, merged) {
16587
16657
  }
16588
16658
  return out;
16589
16659
  }
16590
- function compareLinePosition(left, right) {
16591
- if (left.s !== right.s) return left.s - right.s;
16592
- const leftLine = left.line ?? Number.MAX_SAFE_INTEGER;
16593
- const rightLine = right.line ?? Number.MAX_SAFE_INTEGER;
16594
- return leftLine - rightLine;
16595
- }
16596
16660
  function mergeFreshIntoCarried(carried, fresh) {
16597
- const seenIds = /* @__PURE__ */ new Set();
16598
- const seenPositions = /* @__PURE__ */ new Set();
16599
- const out = [];
16600
- for (const line2 of carried) {
16601
- if (line2.id !== void 0) seenIds.add(line2.id);
16602
- if (line2.line !== void 0)
16603
- seenPositions.add(amendmentKey(line2.s, line2.line));
16604
- out.push(line2);
16605
- }
16606
- for (const line2 of fresh) {
16607
- if (line2.id !== void 0) {
16608
- if (seenIds.has(line2.id)) continue;
16609
- seenIds.add(line2.id);
16661
+ const seenSources = /* @__PURE__ */ new Map();
16662
+ const bySession = /* @__PURE__ */ new Map();
16663
+ const absorb = (lines) => {
16664
+ for (const line2 of lines) {
16665
+ const sourceIdentity = line2.id === void 0 ? line2.sourceIdentity : `id\0${line2.id}`;
16666
+ const identity = sourceIdentity === void 0 ? void 0 : `${line2.s}\0${sourceIdentity}`;
16667
+ const seen = identity === void 0 ? void 0 : seenSources.get(identity);
16668
+ if (seen !== void 0) {
16669
+ if (line2.sourcePosition !== void 0) {
16670
+ Object.assign(seen, { sourcePosition: line2.sourcePosition });
16671
+ }
16672
+ continue;
16673
+ }
16674
+ const bucket = bySession.get(line2.s) ?? [];
16675
+ bucket.push({ ...line2 });
16676
+ if (identity !== void 0) seenSources.set(identity, bucket.at(-1));
16677
+ bySession.set(line2.s, bucket);
16678
+ }
16679
+ };
16680
+ absorb(carried);
16681
+ absorb(fresh);
16682
+ return [...bySession.entries()].sort(([left], [right]) => left - right).flatMap(([, lines]) => lines.map((line2, archiveIndex) => ({ line: line2, archiveIndex })).sort((left, right) => {
16683
+ const leftPosition = left.line.sourcePosition;
16684
+ const rightPosition = right.line.sourcePosition;
16685
+ if (leftPosition === void 0 && rightPosition === void 0) {
16686
+ return left.archiveIndex - right.archiveIndex;
16687
+ }
16688
+ if (leftPosition === void 0) return 1;
16689
+ if (rightPosition === void 0) return -1;
16690
+ return leftPosition - rightPosition || left.archiveIndex - right.archiveIndex;
16691
+ }).map(({ line: line2 }) => line2));
16692
+ }
16693
+ function stableSourceFacts(sessionLines) {
16694
+ const positionByIdentity = /* @__PURE__ */ new Map();
16695
+ const facts = [];
16696
+ let precedingId = "<start>";
16697
+ let idlessOffset = 0;
16698
+ for (const entry of sessionLines) {
16699
+ const id = entry.row === void 0 ? void 0 : nativeEventId(entry.row);
16700
+ if (id !== void 0) {
16701
+ precedingId = id;
16702
+ idlessOffset = 0;
16703
+ } else {
16704
+ idlessOffset += 1;
16610
16705
  }
16611
- if (line2.line !== void 0) {
16612
- const position = amendmentKey(line2.s, line2.line);
16613
- if (seenPositions.has(position)) continue;
16614
- seenPositions.add(position);
16706
+ const identity = id === void 0 ? `after\0${precedingId}\0${idlessOffset}` : `id\0${id}`;
16707
+ let position = positionByIdentity.get(identity);
16708
+ if (position === void 0) {
16709
+ position = positionByIdentity.size;
16710
+ positionByIdentity.set(identity, position);
16615
16711
  }
16616
- out.push(line2);
16712
+ facts.push({ position, identity });
16617
16713
  }
16618
- out.sort(compareLinePosition);
16619
- return out;
16714
+ return facts;
16620
16715
  }
16621
16716
  function normalizeResolvedRanges(ranges, sessionLines, sessionPath) {
16622
16717
  const resolved = [];
@@ -16668,9 +16763,14 @@ async function projectSessionRanges(input) {
16668
16763
  }
16669
16764
  const rows = sessionLines.map((entry) => entry.row);
16670
16765
  const dialogue = adaptSessionDialogue(rows);
16766
+ const sourceFacts = stableSourceFacts(sessionLines);
16767
+ const sourcePositionByIdentity = /* @__PURE__ */ new Map();
16768
+ for (const fact of sourceFacts) {
16769
+ sourcePositionByIdentity.set(fact.identity, fact.position);
16770
+ }
16671
16771
  const seenIds = input.seenIds;
16672
16772
  const lines = [];
16673
- const unparsable = [];
16773
+ const raw = [];
16674
16774
  const ranges = normalizeResolvedRanges(
16675
16775
  input.session.ranges,
16676
16776
  sessionLines,
@@ -16678,38 +16778,30 @@ async function projectSessionRanges(input) {
16678
16778
  );
16679
16779
  for (const range of ranges) {
16680
16780
  for (let index = range.fromIndex; index <= range.toIndex; index += 1) {
16781
+ const { position: sourcePosition, identity: sourceIdentity } = sourceFacts[index];
16782
+ if (input.coveredSourceIdentities.has(sourceIdentity) || input.legacyCoveredSourcePositions.has(sourcePosition)) continue;
16681
16783
  const entry = sessionLines[index];
16682
16784
  if (entry.row === void 0) {
16683
- const key = amendmentKey(input.s, entry.line);
16684
- const amendment = input.amendmentsByKey.get(key);
16685
- if (amendment !== void 0) {
16686
- lines.push({
16687
- speaker: amendment.speaker,
16688
- s: input.s,
16689
- line: entry.line,
16690
- text: amendment.text
16691
- });
16692
- } else {
16693
- unparsable.push({ s: input.s, line: entry.line, raw: entry.raw });
16694
- }
16785
+ raw.push({ raw: entry.raw, s: input.s, sourcePosition, sourceIdentity });
16695
16786
  continue;
16696
16787
  }
16697
16788
  for (const event of dialogue[index] ?? []) {
16698
16789
  if (event.id !== void 0) {
16699
- if (seenIds.has(event.id)) continue;
16700
- seenIds.add(event.id);
16790
+ const identity = dialogueIdentity(input.s, event.id);
16791
+ if (seenIds.has(identity)) continue;
16792
+ seenIds.add(identity);
16701
16793
  }
16702
16794
  lines.push({
16703
16795
  speaker: event.speaker,
16704
16796
  s: input.s,
16705
- line: entry.line,
16706
- ...event.id === void 0 ? {} : { id: event.id },
16797
+ sourcePosition,
16798
+ ...event.id === void 0 ? { sourceIdentity } : { id: event.id },
16707
16799
  text: event.text
16708
16800
  });
16709
16801
  }
16710
16802
  }
16711
16803
  }
16712
- return { lines, unparsable };
16804
+ return { lines, raw, sourcePositionByIdentity };
16713
16805
  }
16714
16806
  async function reprojectTicketProvenance(input) {
16715
16807
  const prior = await readTicketProvenance(input.ticketNumber, input.cwd, input.home);
@@ -16724,8 +16816,7 @@ async function reprojectTicketProvenance(input) {
16724
16816
  updatedAt: now2,
16725
16817
  sessions: []
16726
16818
  },
16727
- lines: prior.lines,
16728
- unparsable: []
16819
+ lines: prior.lines
16729
16820
  };
16730
16821
  }
16731
16822
  const merged = mergeSessionBounds(prior.header?.sessions, input.sessions);
@@ -16741,34 +16832,34 @@ async function reprojectTicketProvenance(input) {
16741
16832
  updatedAt: now2,
16742
16833
  sessions: merged.sessions
16743
16834
  },
16744
- lines: prior.lines,
16745
- unparsable: []
16835
+ lines: prior.lines
16746
16836
  };
16747
16837
  }
16748
- const amendmentsByKey = /* @__PURE__ */ new Map();
16749
- for (const amendment of input.amendments ?? []) {
16750
- const cumulativeIndex = merged.incomingIndexes[amendment.s];
16751
- if (cumulativeIndex === void 0) continue;
16752
- amendmentsByKey.set(amendmentKey(cumulativeIndex, amendment.line), {
16753
- ...amendment,
16754
- s: cumulativeIndex
16755
- });
16756
- }
16757
16838
  const seenIds = new Set(
16758
- prior.lines.flatMap((line2) => line2.id === void 0 ? [] : [line2.id])
16839
+ prior.lines.flatMap(
16840
+ (line2) => line2.id === void 0 ? [] : [dialogueIdentity(line2.s, line2.id)]
16841
+ )
16759
16842
  );
16760
16843
  const fresh = [];
16761
- const unparsable = [];
16844
+ const raw = [];
16762
16845
  for (const delta of deltas) {
16763
16846
  const projected = await projectSessionRanges({
16764
16847
  s: delta.s,
16765
16848
  session: delta.session,
16766
- amendmentsByKey,
16767
16849
  seenIds,
16850
+ coveredSourceIdentities: prior.sourceIdentities.get(delta.s) ?? /* @__PURE__ */ new Set(),
16851
+ legacyCoveredSourcePositions: prior.legacySourcePositions.get(delta.s) ?? /* @__PURE__ */ new Set(),
16768
16852
  ...input.home === void 0 ? {} : { home: input.home }
16769
16853
  });
16854
+ fresh.push(...prior.lines.flatMap((line2) => {
16855
+ if (line2.s !== delta.s) return [];
16856
+ const sourceIdentity = line2.id === void 0 ? line2.sourceIdentity : `id\0${line2.id}`;
16857
+ if (sourceIdentity === void 0) return [];
16858
+ const sourcePosition = projected.sourcePositionByIdentity.get(sourceIdentity);
16859
+ return sourcePosition === void 0 ? [] : [{ ...line2, sourcePosition }];
16860
+ }));
16770
16861
  fresh.push(...projected.lines);
16771
- unparsable.push(...projected.unparsable);
16862
+ raw.push(...projected.raw);
16772
16863
  }
16773
16864
  const lines = mergeFreshIntoCarried(prior.lines, fresh);
16774
16865
  const now = (/* @__PURE__ */ new Date()).toISOString();
@@ -16779,9 +16870,6 @@ async function reprojectTicketProvenance(input) {
16779
16870
  updatedAt: now,
16780
16871
  sessions: merged.sessions
16781
16872
  };
16782
- if (unparsable.length > 0) {
16783
- return { recordFile: prior.recordFile, header, lines, unparsable };
16784
- }
16785
16873
  const identityMaterial = JSON.stringify({
16786
16874
  ticket: input.ticketNumber,
16787
16875
  deltas: deltas.map(({ s, session }) => ({
@@ -16789,7 +16877,7 @@ async function reprojectTicketProvenance(input) {
16789
16877
  path: physicalPathIdentity(session.path),
16790
16878
  ranges: session.ranges
16791
16879
  })),
16792
- lines: fresh
16880
+ lines: [...fresh, ...raw]
16793
16881
  });
16794
16882
  const identity = `ticket-provenance:${createHash7("sha256").update(identityMaterial).digest("hex")}`;
16795
16883
  const pointer = appendSitianRecord({
@@ -16798,15 +16886,14 @@ async function reprojectTicketProvenance(input) {
16798
16886
  payload: {
16799
16887
  type: "ticket-provenance-append",
16800
16888
  sessions: merged.sessions,
16801
- lines: fresh
16889
+ lines: [...fresh, ...raw]
16802
16890
  }
16803
16891
  });
16804
16892
  const folded = await readTicketProvenance(input.ticketNumber, input.cwd, input.home);
16805
16893
  return {
16806
16894
  recordFile: pointer.recordFile,
16807
16895
  header: folded.header ?? header,
16808
- lines: folded.lines,
16809
- unparsable: []
16896
+ lines: folded.lines
16810
16897
  };
16811
16898
  }
16812
16899
  var TicketProvenanceInputError;
@@ -23489,33 +23576,6 @@ var diaristOutputSchema = withTerminatingOutputDeclarations(
23489
23576
  description: "\u672C\u7968\u5BF9\u8BDD\u8FB9\u754C\uFF1B\u7A7A\u5217\u8868\uFF1D\u672C\u8F6E\u65E0\u5BF9\u8BDD\u53EF\u5212\u3002\u7AEF\u70B9\u65E0\u6CD5\u6307\u540D\u65F6\u8D70 reask\uFF0C\u4E0D\u4E2D\u6B62\u3002"
23490
23577
  }
23491
23578
  )
23492
- ),
23493
- amendments: Type21.Optional(
23494
- Type21.Array(
23495
- Type21.Object(
23496
- {
23497
- s: Type21.Optional(
23498
- Type21.Unknown({ description: "\u5377\u4E0B\u6807\uFF08sessions \u4F4D\u7F6E\uFF09" })
23499
- ),
23500
- line: Type21.Optional(
23501
- Type21.Unknown({ description: "\u6E90\u5377 1-based \u884C\u53F7" })
23502
- ),
23503
- speaker: Type21.Optional(
23504
- Type21.String({ description: "owner | runner" })
23505
- ),
23506
- text: Type21.Optional(
23507
- Type21.String({ description: "\u8865\u5199\u6B63\u6587\uFF08\u539F\u8BDD\uFF09" })
23508
- )
23509
- },
23510
- {
23511
- additionalProperties: true,
23512
- description: "\u4E00\u6761\u574F\u884C\u8865\u5199\uFF1B\u7F3A\u5B57\u6BB5\u7684\u6210\u5458\u673A\u68B0\u8DF3\u8FC7"
23513
- }
23514
- ),
23515
- {
23516
- description: "\u53EF\u9009\uFF1B\u673A\u68B0\u89E3\u6790\u4E0D\u4E86\u7684\u884C\u4EA4\u6B64\u8865\u5199\u3002\u7F3A\u672C\u5B57\u6BB5\uFF1D\u65E0\u8865\u5199\uFF0C\u4E0D\u62D2\u6536\u3002"
23517
- }
23518
- )
23519
23579
  )
23520
23580
  })
23521
23581
  )
@@ -23523,8 +23583,8 @@ var diaristOutputSchema = withTerminatingOutputDeclarations(
23523
23583
  var DIARIST_TOOL_SPEC = {
23524
23584
  name: DIARIST_OUTPUT_TOOL_NAME,
23525
23585
  label: "\u8D77\u5C45\u90CE\u8F93\u51FA",
23526
- description: "\u8D77\u5C45\u90CE\u4EA4\u672C\u7968\u5BF9\u8BDD\u8FB9\u754C\uFF08sessions\uFF09\u4E0E\u53EF\u9009\u574F\u884C\u8865\u5199\uFF08amendments\uFF09\uFF1B\u8BA4\u4E0D\u51FA\u672C\u5EAD\u5BF9\u8C61\u5219 escalate\u3002",
23527
- promptSnippet: "\u8D77\u5C45\u90CE\u4EA4\u8FB9\u754C\u4E0E\u53EF\u9009\u8865\u5199",
23586
+ description: "\u8D77\u5C45\u90CE\u4EA4\u672C\u7968\u5BF9\u8BDD\u8FB9\u754C\uFF08sessions\uFF09\uFF1B\u8BA4\u4E0D\u51FA\u672C\u5EAD\u5BF9\u8C61\u5219 escalate\u3002",
23587
+ promptSnippet: "\u8D77\u5C45\u90CE\u4EA4\u8FB9\u754C",
23528
23588
  parameters: diaristOutputSchema
23529
23589
  };
23530
23590
 
@@ -23652,14 +23712,12 @@ async function commitDiaristProjection(input) {
23652
23712
  ticketNumber: input.ticketNumber,
23653
23713
  cwd: input.cwd,
23654
23714
  ...input.home === void 0 ? {} : { home: input.home },
23655
- sessions: input.sessions,
23656
- ...input.amendments === void 0 ? {} : { amendments: input.amendments }
23715
+ sessions: input.sessions
23657
23716
  });
23658
23717
  return {
23659
23718
  ticketNumber: input.ticketNumber,
23660
23719
  volumeRecordFile: result.recordFile,
23661
- lineCount: result.lines.length,
23662
- unparsable: result.unparsable
23720
+ lineCount: result.lines.length
23663
23721
  };
23664
23722
  }
23665
23723
 
@@ -24998,17 +25056,6 @@ function readDiaristRunCoordinates(ctx) {
24998
25056
  };
24999
25057
  }
25000
25058
  var DIARIST_BOUNDS_REASK = "\u8FB9\u754C\u65E0\u6CD5\u4F7F\u7528\u3002\u8BF7\u91CD\u4EA4 sessions\uFF1A\u6BCF\u5377 path + ranges\uFF0C\u6BCF\u7AEF\u4EE5\u539F\u751F id \u6216\u672C\u8F6E\u884C\u53F7\u4E8C\u9009\u4E00\u6307\u540D\u3002";
25001
- function diaristUnparsableReask(rows) {
25002
- const payload = rows.map((row) => ({
25003
- s: row.s,
25004
- line: row.line,
25005
- raw: row.raw
25006
- }));
25007
- return [
25008
- "\u4E0B\u5217\u6E90\u884C\u672A\u80FD\u5F55\u5165\uFF0C\u8BF7\u7ECF amendments \u8865\u5199\uFF08\u6BCF\u6761 s + line + speaker + text\uFF09\uFF1B\u5176\u4F59\u8FB9\u754C\u53EF\u4FDD\u6301\u4E0D\u53D8\u3002",
25009
- JSON.stringify(payload)
25010
- ].join("\n");
25011
- }
25012
25059
  function createDiaristRoleRuntime(roleHost, dependencies) {
25013
25060
  return createFiledOfficerRuntime(
25014
25061
  roleHost,
@@ -25030,15 +25077,13 @@ function createDiaristRoleRuntime(roleHost, dependencies) {
25030
25077
  if (sessions === void 0) {
25031
25078
  throw new ParentQueueReaskError(DIARIST_BOUNDS_REASK);
25032
25079
  }
25033
- const amendments = projectDiaristAmendments(parameters);
25034
25080
  let facts;
25035
25081
  try {
25036
25082
  facts = await commitDiaristProjection({
25037
25083
  ticketNumber,
25038
25084
  cwd: coords.projectRoot,
25039
25085
  home: coords.home,
25040
- sessions,
25041
- amendments
25086
+ sessions
25042
25087
  });
25043
25088
  } catch (error) {
25044
25089
  if (error instanceof ParentQueueReaskError) throw error;
@@ -25050,9 +25095,6 @@ ${error.message}`
25050
25095
  }
25051
25096
  throw error;
25052
25097
  }
25053
- if (facts.unparsable.length > 0) {
25054
- throw new ParentQueueReaskError(diaristUnparsableReask(facts.unparsable));
25055
- }
25056
25098
  }
25057
25099
  return parameters;
25058
25100
  }
@@ -78,29 +78,6 @@ export function projectTicketProvenanceSessions(value) {
78
78
  }
79
79
  return sessions;
80
80
  }
81
- /**
82
- * 投影补写集合。缺该字段=无补写(不拒收);成员形状不成立的整条跳过——
83
- * 它没有绑定位置,放不回去。
84
- */
85
- export function projectTicketProvenanceAmendments(value) {
86
- if (!Array.isArray(value))
87
- return [];
88
- const out = [];
89
- for (const raw of value) {
90
- if (!isRecord(raw))
91
- continue;
92
- const s = nonNegativeInteger(raw.s);
93
- const line = positiveInteger(raw.line);
94
- const speaker = projectSpeaker(raw.speaker);
95
- const text = raw.text;
96
- if (s === undefined || line === undefined || speaker === undefined)
97
- continue;
98
- if (typeof text !== "string")
99
- continue;
100
- out.push({ s, line, speaker, text });
101
- }
102
- return out;
103
- }
104
81
  /** 读回册子头(文件第一行)。形状不成立即 undefined——按无册处理,不猜。 */
105
82
  export function projectTicketProvenanceHeader(value) {
106
83
  if (!isRecord(value))
@@ -135,12 +112,16 @@ export function projectTicketProvenanceLine(value) {
135
112
  return undefined;
136
113
  if (typeof value.text !== "string")
137
114
  return undefined;
138
- const line = positiveInteger(value.line);
115
+ const sourcePosition = nonNegativeInteger(value.sourcePosition);
116
+ const sourceIdentity = typeof value.sourceIdentity === "string" && value.sourceIdentity !== ""
117
+ ? value.sourceIdentity
118
+ : undefined;
139
119
  const id = typeof value.id === "string" && value.id !== "" ? value.id : undefined;
140
120
  return {
141
121
  speaker,
142
122
  s,
143
- ...(line === undefined ? {} : { line }),
123
+ ...(sourcePosition === undefined ? {} : { sourcePosition }),
124
+ ...(sourceIdentity === undefined ? {} : { sourceIdentity }),
144
125
  ...(id === undefined ? {} : { id }),
145
126
  text: value.text,
146
127
  };