stratagate-dsh 0.3.22 → 0.3.23

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/plugin.js CHANGED
@@ -16033,7 +16033,8 @@ async function overview(runtime, cachedEntries) {
16033
16033
  title: block2.source.l0Title ?? null,
16034
16034
  threadId: block2.threadId,
16035
16035
  turnRange: block2.turnRange,
16036
- shouldExtract: block2.source.shouldExtract ?? null
16036
+ shouldExtract: block2.source.shouldExtract ?? null,
16037
+ rawAvailable: block2.messages.some(({ content }) => Boolean(content.trim()))
16037
16038
  }));
16038
16039
  }
16039
16040
  const block = snapshot.blocks.find(({ id }) => id === blockId);
@@ -16044,7 +16045,8 @@ async function overview(runtime, cachedEntries) {
16044
16045
  title: block.l0Title ?? null,
16045
16046
  threadId: block.threadId ?? null,
16046
16047
  turnRange: [block.startTurn, block.endTurn],
16047
- shouldExtract: block.shouldExtract ?? null
16048
+ shouldExtract: block.shouldExtract ?? null,
16049
+ rawAvailable: block.l5Raw.some(({ content }) => Boolean(content.trim()))
16048
16050
  }] : [];
16049
16051
  });
16050
16052
  const describeBlockJob = (kind, job) => {
@@ -16141,6 +16143,13 @@ async function overview(runtime, cachedEntries) {
16141
16143
  ...snapshot.graphNodes.map(({ updatedAt }) => updatedAt),
16142
16144
  ...snapshot.usageReceipts.map(({ createdAt }) => createdAt)
16143
16145
  ].sort();
16146
+ let topicDirectoryRevision = null;
16147
+ let topicDirectoryReadError = false;
16148
+ try {
16149
+ topicDirectoryRevision = topicDirectoryProjection(snapshot, runtime.adminAgentMemoryRetrievalWeight?.() ?? 1).data.revision;
16150
+ } catch {
16151
+ topicDirectoryReadError = true;
16152
+ }
16144
16153
  rows.push({
16145
16154
  namespace,
16146
16155
  duplicateRepair: runtime.adminDuplicateRepairStatus?.(namespace) ?? null,
@@ -16163,7 +16172,11 @@ async function overview(runtime, cachedEntries) {
16163
16172
  graphProjection: graphStatus,
16164
16173
  topicProjection: topicStatus
16165
16174
  },
16175
+ topicDirectoryRevision,
16176
+ topicDirectoryReadError,
16166
16177
  graphMigration: graphWork.migration,
16178
+ // Only a live source Block in this namespace establishes a retrieval gap.
16179
+ longTermExtractionGap: snapshot.extractionJobs.some((job) => derivationJobState(job, job.status === "succeeded" || job.status === "skipped") === "terminal-failed" && snapshot.blocks.some((block) => block.id === job.blockId && block.shouldExtract === true)),
16167
16180
  usageReceipts: snapshot.usageReceipts.length,
16168
16181
  memoryUseCount: snapshot.usageReceipts.filter((receipt) => receipt.eventIds.length > 0 || receipt.elementIds.length > 0).length,
16169
16182
  failedJobs,
@@ -16426,6 +16439,9 @@ function recoverSnapshotView(snapshot) {
16426
16439
  messages.push(item.message);
16427
16440
  groups.set(item.threadId, messages);
16428
16441
  }
16442
+ if (groups.size === 0 && snapshot.summaryJobs.some((job) => job.blockId === source.id && derivationJobState(job, job.status === "succeeded") === "terminal-failed")) {
16443
+ groups.set(source.threadId?.trim() || LEGACY_THREAD_ID, []);
16444
+ }
16429
16445
  const entries = [...groups];
16430
16446
  for (const [threadId, messages] of entries) {
16431
16447
  const virtual = !source.threadId && (entries.length > 1 || threadId !== LEGACY_THREAD_ID);
@@ -16571,10 +16587,12 @@ async function memories(runtime, url) {
16571
16587
  const eventIds = new Set(relatedEvents.map(({ id }) => id));
16572
16588
  const projections = snapshot.graphProjectionJobs.filter(({ sourceEventIds }) => sourceEventIds.some((id) => eventIds.has(id)));
16573
16589
  const relatedNodes = snapshot.graphNodes.filter(({ sourceEventIds }) => sourceEventIds.some((id) => eventIds.has(id))).map(({ id, name: name2, type }) => ({ id, name: name2, type }));
16574
- const failedProjection = projections.find(({ status: status2 }) => status2 === "failed");
16575
- const pendingProjection = projections.some(({ status: status2 }) => status2 === "pending" || status2 === "running");
16590
+ const failedProjection = projections.find((job) => derivationJobState(job, job.status === "completed") === "terminal-failed");
16591
+ const pendingProjection = projections.some(graphProjectionIsProcessing);
16576
16592
  const needsExtraction = source.shouldExtract === true;
16577
- const status = summary?.status === "failed" ? "failed" : summary?.status === "pending" || summary?.status === "running" || !summary && source.processingStatus === "pending" ? "processing" : extraction?.status === "failed" || failedProjection ? "failed" : extraction?.status === "succeeded" || extraction?.status === "skipped" ? pendingProjection ? "processing" : "organized" : needsExtraction ? "waiting" : "organized";
16593
+ const summaryState = summary ? derivationJobState(summary, summary.status === "succeeded") : null;
16594
+ const extractionState = extraction ? derivationJobState(extraction, extraction.status === "succeeded" || extraction.status === "skipped") : null;
16595
+ const status = summaryState === "terminal-failed" ? "failed" : summaryState === "processing" || summaryState === "retryable" || !summary && source.processingStatus === "pending" ? "processing" : extractionState === "terminal-failed" || failedProjection ? "failed" : extractionState === "processing" || extractionState === "retryable" ? "processing" : extraction?.status === "succeeded" || extraction?.status === "skipped" ? pendingProjection ? "processing" : "organized" : needsExtraction ? "waiting" : "organized";
16578
16596
  const blockPosition = scopedBlocks.findIndex(({ id }) => id === block.id) + 1;
16579
16597
  const latestBlockPosition = scopedBlocks.length;
16580
16598
  const currentLevel = getDecayedBlockLevel(
@@ -16607,8 +16625,10 @@ async function memories(runtime, url) {
16607
16625
  sourceMessages: block.messages.length,
16608
16626
  createdAt: source.createdAt,
16609
16627
  virtual: block.virtual,
16628
+ rawAvailable: sourceMessages(snapshot, blockMessageIds).some(({ content }) => Boolean(content.trim())),
16610
16629
  processingStatus: source.processingStatus,
16611
16630
  summaryJob: summary ? {
16631
+ state: derivationJobState(summary, summary.status === "succeeded"),
16612
16632
  status: summary.status,
16613
16633
  attempts: summary.attempts,
16614
16634
  nextRetryAt: summary.nextRetryAt,