stratagate-dsh 0.3.22 → 0.3.24

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