stratagate-dsh 0.2.73 → 0.2.74

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
@@ -8145,8 +8145,31 @@ function currentPluginVersion() {
8145
8145
  }
8146
8146
  var STRATAGATE_DSH_VERSION = currentPluginVersion();
8147
8147
  function graphProjectionIsProcessing(job) {
8148
- if (job.status === "running") return true;
8149
- return job.attempts < DERIVATION_MAX_ATTEMPTS && (job.status === "pending" || job.status === "failed" && job.nextRetryAt !== null);
8148
+ return derivationJobState(job, false) === "processing" || derivationJobState(job, false) === "retryable";
8149
+ }
8150
+ function derivationJobState(job, completed) {
8151
+ if (completed || job.status === "succeeded" || job.status === "skipped" || job.status === "completed") return "completed";
8152
+ if (job.status === "running") return "processing";
8153
+ if (job.status === "pending") return job.attempts < DERIVATION_MAX_ATTEMPTS ? "processing" : "blocked";
8154
+ if (job.status === "failed") {
8155
+ const retryable = job.attempts < DERIVATION_MAX_ATTEMPTS && job.nextRetryAt !== null && Number.isFinite(Date.parse(job.nextRetryAt));
8156
+ return retryable ? "retryable" : "terminal-failed";
8157
+ }
8158
+ return "blocked";
8159
+ }
8160
+ function summarizeDerivationJobs(jobs, completed) {
8161
+ const result = { processing: 0, retryable: 0, terminalFailed: 0, completed: 0, blocked: 0 };
8162
+ for (const job of jobs) {
8163
+ const state = derivationJobState(job, completed(job));
8164
+ if (state === "processing") result.processing += 1;
8165
+ else if (state === "retryable") {
8166
+ result.retryable += 1;
8167
+ result.processing += 1;
8168
+ } else if (state === "terminal-failed") result.terminalFailed += 1;
8169
+ else if (state === "completed") result.completed += 1;
8170
+ else result.blocked += 1;
8171
+ }
8172
+ return result;
8150
8173
  }
8151
8174
  function installedPackageVersion(names) {
8152
8175
  for (const name2 of names) {
@@ -8441,10 +8464,12 @@ async function overview(runtime, cachedEntries) {
8441
8464
  }] : [];
8442
8465
  });
8443
8466
  const describeBlockJob = (kind, job) => {
8467
+ const state = derivationJobState(job, kind === "block-summary" ? job.status === "succeeded" : job.status === "succeeded" || job.status === "skipped");
8444
8468
  const details = blockDetails([job.blockId]);
8445
8469
  return {
8446
8470
  id: job.blockId,
8447
8471
  kind,
8472
+ state,
8448
8473
  status: job.status,
8449
8474
  attempts: job.attempts,
8450
8475
  nextRetryAt: job.nextRetryAt,
@@ -8460,11 +8485,13 @@ async function overview(runtime, cachedEntries) {
8460
8485
  };
8461
8486
  };
8462
8487
  const describeGraphJob = (job) => {
8488
+ const state = derivationJobState(job, job.status === "completed");
8463
8489
  const blockIds = [...new Set(job.sourceEventIds.flatMap((eventId) => snapshot.events.find(({ id }) => id === eventId)?.sourceBlockId ?? []))];
8464
8490
  const details = blockDetails(blockIds);
8465
8491
  return {
8466
8492
  id: job.id,
8467
8493
  kind: "graph-projection",
8494
+ state,
8468
8495
  status: job.status,
8469
8496
  attempts: job.attempts,
8470
8497
  nextRetryAt: job.nextRetryAt,
@@ -8478,16 +8505,19 @@ async function overview(runtime, cachedEntries) {
8478
8505
  sourceEventIds: job.sourceEventIds
8479
8506
  };
8480
8507
  };
8481
- const failedJobs = snapshot.summaryJobs.filter(({ status }) => status === "failed").length + snapshot.extractionJobs.filter(({ status }) => status === "failed").length + snapshot.graphProjectionJobs.filter(({ status }) => status === "failed").length;
8482
- const processingJobs = snapshot.summaryJobs.filter(({ status, nextRetryAt }) => status === "pending" || status === "running" || status === "failed" && nextRetryAt !== null).length + snapshot.extractionJobs.filter(({ status, nextRetryAt }) => status === "running" || status === "failed" && nextRetryAt !== null).length + snapshot.graphProjectionJobs.filter(graphProjectionIsProcessing).length;
8508
+ const summaryStatus = summarizeDerivationJobs(snapshot.summaryJobs, (job) => job.status === "succeeded");
8509
+ const extractionStatus = summarizeDerivationJobs(snapshot.extractionJobs, (job) => job.status === "succeeded" || job.status === "skipped");
8510
+ const graphStatus = summarizeDerivationJobs(snapshot.graphProjectionJobs, (job) => job.status === "completed");
8511
+ const failedJobs = summaryStatus.terminalFailed + extractionStatus.terminalFailed + graphStatus.terminalFailed;
8512
+ const processingJobs = summaryStatus.processing + extractionStatus.processing + graphStatus.processing;
8483
8513
  const failedJobDetails = [
8484
8514
  ...snapshot.summaryJobs.filter(({ status }) => status === "failed").map((job) => describeBlockJob("block-summary", job)),
8485
8515
  ...snapshot.extractionJobs.filter(({ status }) => status === "failed").map((job) => describeBlockJob("event-extraction", job)),
8486
8516
  ...snapshot.graphProjectionJobs.filter(({ status }) => status === "failed").map(describeGraphJob)
8487
8517
  ];
8488
8518
  const processingJobDetails = [
8489
- ...snapshot.summaryJobs.filter(({ status, nextRetryAt }) => status === "pending" || status === "running" || status === "failed" && nextRetryAt !== null).map((job) => describeBlockJob("block-summary", job)),
8490
- ...snapshot.extractionJobs.filter(({ status, nextRetryAt }) => status === "running" || status === "failed" && nextRetryAt !== null).map((job) => describeBlockJob("event-extraction", job)),
8519
+ ...snapshot.summaryJobs.filter((job) => derivationJobState(job, job.status === "succeeded") === "processing" || derivationJobState(job, job.status === "succeeded") === "retryable").map((job) => describeBlockJob("block-summary", job)),
8520
+ ...snapshot.extractionJobs.filter((job) => derivationJobState(job, job.status === "succeeded" || job.status === "skipped") === "processing" || derivationJobState(job, job.status === "succeeded" || job.status === "skipped") === "retryable").map((job) => describeBlockJob("event-extraction", job)),
8491
8521
  ...snapshot.graphProjectionJobs.filter(graphProjectionIsProcessing).map(describeGraphJob)
8492
8522
  ];
8493
8523
  const timestamps = [
@@ -8511,12 +8541,27 @@ async function overview(runtime, cachedEntries) {
8511
8541
  elements: snapshot.elements.length,
8512
8542
  graphNodes: snapshot.graphNodes.length,
8513
8543
  graphEdges: snapshot.graphEdges.length,
8544
+ taskStatus: {
8545
+ blockSummary: summaryStatus,
8546
+ eventExtraction: extractionStatus,
8547
+ graphProjection: graphStatus
8548
+ },
8514
8549
  graphMigration: (() => {
8515
8550
  const projected = new Set(snapshot.graphProjectionJobs.filter(({ status, projectorVersion }) => status === "completed" && projectorVersion === KNOWLEDGE_GRAPH_PROJECTOR_VERSION).flatMap(({ sourceEventIds }) => sourceEventIds)).size;
8516
- const failed = snapshot.graphProjectionJobs.filter(({ status }) => status === "failed").length;
8517
- const running = snapshot.graphProjectionJobs.filter(({ status }) => status === "running").length;
8518
8551
  const total = snapshot.events.filter(({ status }) => status !== "forgotten" && status !== "archived").length;
8519
- return { projected, total, failed, running, complete: projected >= total };
8552
+ const complete = projected >= total;
8553
+ const state = complete ? "complete" : graphStatus.processing > 0 ? "processing" : graphStatus.terminalFailed > 0 ? "failed" : "incomplete";
8554
+ return {
8555
+ projected,
8556
+ total,
8557
+ pending: snapshot.graphProjectionJobs.filter(({ status }) => status === "pending").length,
8558
+ running: snapshot.graphProjectionJobs.filter(({ status }) => status === "running").length,
8559
+ failed: graphStatus.terminalFailed,
8560
+ retryable: graphStatus.retryable,
8561
+ processing: graphStatus.processing,
8562
+ state,
8563
+ complete
8564
+ };
8520
8565
  })(),
8521
8566
  usageReceipts: snapshot.usageReceipts.length,
8522
8567
  memoryUseCount: snapshot.usageReceipts.filter((receipt) => receipt.eventIds.length > 0 || receipt.elementIds.length > 0).length,
@@ -8855,13 +8900,19 @@ async function memories(runtime, url) {
8855
8900
  clusters: clusterKnowledgeGraph(snapshot.graphNodes, snapshot.graphEdges),
8856
8901
  migration: (() => {
8857
8902
  const projected = new Set(snapshot.graphProjectionJobs.filter(({ status, projectorVersion }) => status === "completed" && projectorVersion === KNOWLEDGE_GRAPH_PROJECTOR_VERSION).flatMap(({ sourceEventIds }) => sourceEventIds)).size;
8903
+ const graphStatus = summarizeDerivationJobs(snapshot.graphProjectionJobs, (job) => job.status === "completed");
8904
+ const total = snapshot.events.filter(({ status }) => status !== "forgotten" && status !== "archived").length;
8905
+ const complete = projected >= total;
8858
8906
  return {
8859
8907
  projected,
8860
- total: snapshot.events.filter(({ status }) => status !== "forgotten" && status !== "archived").length,
8908
+ total,
8861
8909
  pending: snapshot.graphProjectionJobs.filter(({ status }) => status === "pending").length,
8862
8910
  running: snapshot.graphProjectionJobs.filter(({ status }) => status === "running").length,
8863
- failed: snapshot.graphProjectionJobs.filter(({ status }) => status === "failed").length,
8864
- complete: projected >= snapshot.events.filter(({ status }) => status !== "forgotten" && status !== "archived").length
8911
+ failed: graphStatus.terminalFailed,
8912
+ retryable: graphStatus.retryable,
8913
+ processing: graphStatus.processing,
8914
+ state: complete ? "complete" : graphStatus.processing > 0 ? "processing" : graphStatus.terminalFailed > 0 ? "failed" : "incomplete",
8915
+ complete
8865
8916
  };
8866
8917
  })()
8867
8918
  };