stratagate-dsh 0.2.64 → 0.2.65

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
@@ -7710,7 +7710,7 @@ function clusterKnowledgeGraph(rawNodes, rawEdges) {
7710
7710
  }
7711
7711
 
7712
7712
  // src/web.ts
7713
- var STRATAGATE_DSH_VERSION = "0.2.64";
7713
+ var STRATAGATE_DSH_VERSION = "0.2.65";
7714
7714
  var LEGACY_THREAD_ID = "__legacy__";
7715
7715
  var nodeRequire2 = createRequire2(import.meta.url);
7716
7716
  function installedPackageVersion(names) {
@@ -7853,80 +7853,80 @@ async function overview(runtime, cachedEntries) {
7853
7853
  const rows = [];
7854
7854
  for (const { namespace, snapshot } of entries) {
7855
7855
  if (!snapshot) continue;
7856
+ const recovered = recoverSnapshotView(snapshot);
7857
+ const blockDetails = (blockIds) => [...new Set(blockIds)].flatMap((blockId) => {
7858
+ const displayBlocks = recovered.blocks.filter(({ source, threadId }) => source.id === blockId && threadId !== LEGACY_THREAD_ID);
7859
+ if (displayBlocks.length > 0) {
7860
+ return displayBlocks.map((block2) => ({
7861
+ id: block2.id,
7862
+ sourceId: block2.source.id,
7863
+ sequence: block2.source.sequence,
7864
+ title: block2.source.l0Title ?? null,
7865
+ threadId: block2.threadId,
7866
+ turnRange: block2.turnRange,
7867
+ shouldExtract: block2.source.shouldExtract ?? null
7868
+ }));
7869
+ }
7870
+ const block = snapshot.blocks.find(({ id }) => id === blockId);
7871
+ return block ? [{
7872
+ id: block.id,
7873
+ sourceId: block.id,
7874
+ sequence: block.sequence,
7875
+ title: block.l0Title ?? null,
7876
+ threadId: block.threadId ?? null,
7877
+ turnRange: [block.startTurn, block.endTurn],
7878
+ shouldExtract: block.shouldExtract ?? null
7879
+ }] : [];
7880
+ });
7881
+ const describeBlockJob = (kind, job) => {
7882
+ const details = blockDetails([job.blockId]);
7883
+ return {
7884
+ id: job.blockId,
7885
+ kind,
7886
+ status: job.status,
7887
+ attempts: job.attempts,
7888
+ nextRetryAt: job.nextRetryAt,
7889
+ lastError: job.lastError?.slice(0, 500) ?? null,
7890
+ lastErrorFull: job.lastError,
7891
+ updatedAt: job.updatedAt,
7892
+ threadId: details[0]?.threadId ?? null,
7893
+ blockIds: [job.blockId],
7894
+ threadIds: [...new Set(details.flatMap(({ threadId }) => threadId ?? []))],
7895
+ blockDetails: details,
7896
+ sequence: details[0]?.sequence ?? null,
7897
+ turnRange: details[0]?.turnRange ?? null
7898
+ };
7899
+ };
7900
+ const describeGraphJob = (job) => {
7901
+ const blockIds = [...new Set(job.sourceEventIds.flatMap((eventId) => snapshot.events.find(({ id }) => id === eventId)?.sourceBlockId ?? []))];
7902
+ const details = blockDetails(blockIds);
7903
+ return {
7904
+ id: job.id,
7905
+ kind: "graph-projection",
7906
+ status: job.status,
7907
+ attempts: job.attempts,
7908
+ nextRetryAt: null,
7909
+ lastError: job.lastError?.slice(0, 500) ?? null,
7910
+ lastErrorFull: job.lastError,
7911
+ updatedAt: job.updatedAt,
7912
+ blockIds,
7913
+ threadIds: [...new Set(details.flatMap(({ threadId }) => threadId ?? []))],
7914
+ blockDetails: details,
7915
+ sequences: details.map(({ sequence }) => sequence),
7916
+ sourceEventIds: job.sourceEventIds
7917
+ };
7918
+ };
7856
7919
  const failedJobs = snapshot.summaryJobs.filter(({ status }) => status === "failed").length + snapshot.extractionJobs.filter(({ status }) => status === "failed").length + snapshot.graphProjectionJobs.filter(({ status }) => status === "failed").length;
7857
7920
  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(({ status }) => status === "pending" || status === "running").length;
7858
7921
  const failedJobDetails = [
7859
- ...snapshot.summaryJobs.filter(({ status }) => status === "failed").map((job) => {
7860
- const block = snapshot.blocks.find(({ id }) => id === job.blockId);
7861
- return {
7862
- id: job.blockId,
7863
- kind: "block-summary",
7864
- attempts: job.attempts,
7865
- nextRetryAt: job.nextRetryAt,
7866
- lastError: job.lastError?.slice(0, 500) ?? null,
7867
- lastErrorFull: job.lastError,
7868
- updatedAt: job.updatedAt,
7869
- threadId: block?.threadId ?? null,
7870
- blockIds: [job.blockId],
7871
- threadIds: block?.threadId ? [block.threadId] : [],
7872
- blockDetails: block ? [{
7873
- id: block.id,
7874
- sequence: block.sequence,
7875
- title: block.l0Title ?? null,
7876
- threadId: block.threadId ?? null,
7877
- turnRange: [block.startTurn, block.endTurn]
7878
- }] : [],
7879
- sequence: block?.sequence ?? null,
7880
- turnRange: block ? [block.startTurn, block.endTurn] : null
7881
- };
7882
- }),
7883
- ...snapshot.extractionJobs.filter(({ status }) => status === "failed").map((job) => {
7884
- const block = snapshot.blocks.find(({ id }) => id === job.blockId);
7885
- return {
7886
- id: job.blockId,
7887
- kind: "event-extraction",
7888
- attempts: job.attempts,
7889
- nextRetryAt: job.nextRetryAt,
7890
- lastError: job.lastError?.slice(0, 500) ?? null,
7891
- lastErrorFull: job.lastError,
7892
- updatedAt: job.updatedAt,
7893
- blockIds: [job.blockId],
7894
- threadIds: block?.threadId ? [block.threadId] : [],
7895
- blockDetails: block ? [{
7896
- id: block.id,
7897
- sequence: block.sequence,
7898
- title: block.l0Title ?? null,
7899
- threadId: block.threadId ?? null,
7900
- turnRange: [block.startTurn, block.endTurn]
7901
- }] : [],
7902
- sequence: block?.sequence ?? null,
7903
- turnRange: block ? [block.startTurn, block.endTurn] : null
7904
- };
7905
- }),
7906
- ...snapshot.graphProjectionJobs.filter(({ status }) => status === "failed").map((job) => {
7907
- const blockIds = [...new Set(job.sourceEventIds.flatMap((eventId) => snapshot.events.find(({ id }) => id === eventId)?.sourceBlockId ?? []))];
7908
- const blocks = blockIds.flatMap((blockId) => snapshot.blocks.find(({ id }) => id === blockId) ?? []);
7909
- return {
7910
- id: job.id,
7911
- kind: "graph-projection",
7912
- attempts: job.attempts,
7913
- nextRetryAt: null,
7914
- lastError: job.lastError?.slice(0, 500) ?? null,
7915
- lastErrorFull: job.lastError,
7916
- updatedAt: job.updatedAt,
7917
- blockIds,
7918
- threadIds: [...new Set(blocks.flatMap(({ threadId }) => threadId ?? []))],
7919
- blockDetails: blocks.map((block) => ({
7920
- id: block.id,
7921
- sequence: block.sequence,
7922
- title: block.l0Title ?? null,
7923
- threadId: block.threadId ?? null,
7924
- turnRange: [block.startTurn, block.endTurn]
7925
- })),
7926
- sequences: blocks.map(({ sequence }) => sequence),
7927
- sourceEventIds: job.sourceEventIds
7928
- };
7929
- })
7922
+ ...snapshot.summaryJobs.filter(({ status }) => status === "failed").map((job) => describeBlockJob("block-summary", job)),
7923
+ ...snapshot.extractionJobs.filter(({ status }) => status === "failed").map((job) => describeBlockJob("event-extraction", job)),
7924
+ ...snapshot.graphProjectionJobs.filter(({ status }) => status === "failed").map(describeGraphJob)
7925
+ ];
7926
+ const processingJobDetails = [
7927
+ ...snapshot.summaryJobs.filter(({ status, nextRetryAt }) => status === "pending" || status === "running" || status === "failed" && nextRetryAt !== null).map((job) => describeBlockJob("block-summary", job)),
7928
+ ...snapshot.extractionJobs.filter(({ status, nextRetryAt }) => status === "running" || status === "failed" && nextRetryAt !== null).map((job) => describeBlockJob("event-extraction", job)),
7929
+ ...snapshot.graphProjectionJobs.filter(({ status }) => status === "pending" || status === "running").map(describeGraphJob)
7930
7930
  ];
7931
7931
  const timestamps = [
7932
7932
  ...snapshot.blocks.map(({ createdAt }) => createdAt),
@@ -7961,6 +7961,7 @@ async function overview(runtime, cachedEntries) {
7961
7961
  failedJobs,
7962
7962
  processingJobs,
7963
7963
  failedJobDetails,
7964
+ processingJobDetails,
7964
7965
  successfulModelResponses: snapshot.successfulModelResponses ?? [],
7965
7966
  lastActivityAt: timestamps.at(-1) ?? null
7966
7967
  });
@@ -8539,7 +8540,7 @@ async function dashboard(runtime, url, ifNoneMatch) {
8539
8540
  const selected = entries.find(({ namespace }) => namespace === requestedNamespace) ?? entries[0];
8540
8541
  const threadId = url.searchParams.get("threadId")?.trim() ?? "";
8541
8542
  const revisionKey = entries.map(({ namespace, revision }) => `${namespace}:${revision}`).join("|");
8542
- const etag = `"${createHash2("sha256").update(`${revisionKey}\0${selected?.namespace ?? ""}\0${threadId}`).digest("base64url").slice(0, 24)}"`;
8543
+ const etag = `"${createHash2("sha256").update(`${STRATAGATE_DSH_VERSION}\0${revisionKey}\0${selected?.namespace ?? ""}\0${threadId}`).digest("base64url").slice(0, 24)}"`;
8543
8544
  if (ifNoneMatch.split(",").map((value) => value.trim()).includes(etag)) return { etag, notModified: true };
8544
8545
  const overviewValue = await overview(runtime, entries);
8545
8546
  if (!selected) {