@deepseek-ai/dsh-llm-replay 0.2.1-rc.3 → 0.2.2-alpha.2

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/lib/index.js CHANGED
@@ -18,6 +18,12 @@ const PACKED_CHUNK_ROW_TYPES = new Set([
18
18
  "reasoning-chunks",
19
19
  "tool-call-chunks"
20
20
  ]);
21
+ const BADGE_TONES = [
22
+ "neutral",
23
+ "info",
24
+ "success",
25
+ "warning"
26
+ ];
21
27
  if (sessionFormatCatalog.currentVersion !== SESSION_FORMAT_VERSION) throw new Error(`llm-replay: format catalog v${sessionFormatCatalog.currentVersion} does not match Session v${SESSION_FORMAT_VERSION}`);
22
28
  /**
23
29
  * Parse a projected session `.jsonl` buffer into current events. The first
@@ -578,7 +584,8 @@ var ReplayAdapter = class extends LlmAdapter {
578
584
  id: model.id,
579
585
  name: model.name ?? model.id,
580
586
  ...model.description === void 0 ? {} : { description: model.description },
581
- ...model.inputModalities === void 0 ? {} : { inputModalities: [...model.inputModalities] }
587
+ ...model.inputModalities === void 0 ? {} : { inputModalities: [...model.inputModalities] },
588
+ ...model.badge === void 0 ? {} : { badge: model.badge }
582
589
  })));
583
590
  }
584
591
  resolveModel(provider, model) {
@@ -768,6 +775,13 @@ function installLlmReplay(ctx, config) {
768
775
  }
769
776
  const name = "llm-replay";
770
777
  const inject = ["llm"];
778
+ /** Whether a configured badge has non-blank literal or English-keyed text and a known tone. */
779
+ function displayableBadge(value) {
780
+ if (typeof value !== "object" || value === null) return false;
781
+ const text = Reflect.get(value, "text");
782
+ const texts = typeof text === "object" && text !== null ? Object.values(text) : [text];
783
+ return BADGE_TONES.includes(Reflect.get(value, "tone")) && (typeof text === "string" || typeof text === "object" && text !== null && Object.hasOwn(text, "en")) && texts.every((entry) => typeof entry === "string" && entry.trim() !== "");
784
+ }
771
785
  function validateConfiguredModels(providers) {
772
786
  for (const provider of providers ?? []) for (const model of provider.models ?? []) {
773
787
  const modalities = model.inputModalities;
@@ -779,6 +793,7 @@ function validateConfiguredModels(providers) {
779
793
  if (systemPromptUpdate !== void 0 && systemPromptUpdate !== "in-history") throw new Error(`llm-replay: provider "${provider.id}" model "${model.id}" systemPromptUpdate must be "in-history" when present`);
780
794
  const toolUpdate = model.toolUpdate;
781
795
  if (toolUpdate !== void 0 && toolUpdate !== "in-history" && toolUpdate !== "addition-only") throw new Error(`llm-replay: provider "${provider.id}" model "${model.id}" toolUpdate must be "in-history" or "addition-only" when present`);
796
+ if (model.badge !== void 0 && !displayableBadge(model.badge)) throw new Error(`llm-replay: provider "${provider.id}" model "${model.id}" badge needs non-blank text or translations with an "en" entry, and a neutral, info, success, or warning tone`);
782
797
  }
783
798
  }
784
799
  function apply(ctx, config = {}) {
@@ -9,7 +9,7 @@
9
9
  import type { Context } from '@deepseek-ai/cordis';
10
10
  import { type SessionEvent } from '@deepseek-ai/dsh-session';
11
11
  import type { SessionLogOffset as SessionLogOffsetType } from '@deepseek-ai/dsh-session';
12
- import type { GenerateOptions, ModelModality, RetryPolicyConfig, StreamChunk, SystemPromptUpdate, ToolUpdate } from '@deepseek-ai/dsh-llm';
12
+ import type { GenerateOptions, LlmModelBadge, ModelModality, RetryPolicyConfig, StreamChunk, SystemPromptUpdate, ToolUpdate } from '@deepseek-ai/dsh-llm';
13
13
  /**
14
14
  * One recorded model call. `throw` may replay prefix chunks before failing;
15
15
  * `hang` models cancellation. Derived chunk entries come from ordinary model
@@ -67,6 +67,8 @@ export interface ReplayModelConfig {
67
67
  systemPromptUpdate?: SystemPromptUpdate;
68
68
  /** Optional mid-conversation tool declaration mode for a keyless replay route. */
69
69
  toolUpdate?: ToolUpdate;
70
+ /** Optional selector badge the replay catalog advertises, so keyless Web scenarios render one. */
71
+ badge?: LlmModelBadge;
70
72
  }
71
73
  /** One provider route exposed by the replay adapter. */
72
74
  export interface ReplayProviderConfig {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-llm-replay",
3
3
  "description": "Replay LLM plugin: short-circuits llm/stream with model chunks reconstructed from a recorded session JSONL (keyless snapshot tests)",
4
- "version": "0.2.1-rc.3",
4
+ "version": "0.2.2-alpha.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -27,11 +27,11 @@
27
27
  ],
28
28
  "license": "MIT",
29
29
  "peerDependencies": {
30
- "@deepseek-ai/cordis": "~4.0.5",
31
- "@deepseek-ai/dsh-compaction": "0.2.1-rc.3",
32
- "@deepseek-ai/dsh-deepseek-llm-api-extensions": "0.2.1-rc.3",
33
- "@deepseek-ai/dsh-llm": "0.2.1-rc.3",
34
- "@deepseek-ai/dsh-session": "0.2.1-rc.3"
30
+ "@deepseek-ai/cordis": "~4.0.6-alpha.1",
31
+ "@deepseek-ai/dsh-compaction": "0.2.2-alpha.2",
32
+ "@deepseek-ai/dsh-deepseek-llm-api-extensions": "0.2.2-alpha.2",
33
+ "@deepseek-ai/dsh-llm": "0.2.2-alpha.2",
34
+ "@deepseek-ai/dsh-session": "0.2.2-alpha.2"
35
35
  },
36
36
  "peerDependenciesMeta": {
37
37
  "@deepseek-ai/dsh-deepseek-llm-api-extensions": {
@@ -39,14 +39,14 @@
39
39
  }
40
40
  },
41
41
  "devDependencies": {
42
- "@deepseek-ai/cordis": "~4.0.5",
43
- "@deepseek-ai/dsh-compaction": "0.2.1-rc.3",
44
- "@deepseek-ai/dsh-deepseek-llm-api-extensions": "0.2.1-rc.3",
45
- "@deepseek-ai/dsh-llm": "0.2.1-rc.3",
46
- "@deepseek-ai/dsh-session": "0.2.1-rc.3"
42
+ "@deepseek-ai/cordis": "~4.0.6-alpha.1",
43
+ "@deepseek-ai/dsh-compaction": "0.2.2-alpha.2",
44
+ "@deepseek-ai/dsh-deepseek-llm-api-extensions": "0.2.2-alpha.2",
45
+ "@deepseek-ai/dsh-llm": "0.2.2-alpha.2",
46
+ "@deepseek-ai/dsh-session": "0.2.2-alpha.2"
47
47
  },
48
48
  "dependencies": {
49
- "@deepseek-ai/dsh-session-format-catalog": "0.2.1-rc.3",
50
- "@deepseek-ai/dsh-util-values": "0.2.1-rc.3"
49
+ "@deepseek-ai/dsh-session-format-catalog": "0.2.2-alpha.2",
50
+ "@deepseek-ai/dsh-util-values": "0.2.2-alpha.2"
51
51
  }
52
52
  }