@kingsoftcloud/agentkit-harness-node 0.0.24 → 0.0.26

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/index.mjs CHANGED
@@ -2264,9 +2264,10 @@ function mergeChatUsage(previous, reported, policy, finalized = false) {
2264
2264
  var markerHeads = ["<", "</"].flatMap((start) => ["|", "||"].flatMap((left) => ["||", "|"].map((right) => `${start}${left}DSML${right}`)));
2265
2265
  var maxHeadLength = Math.max(...markerHeads.map((head) => head.length));
2266
2266
  var tagNames = ["calls", "tool_calls", "function_calls", "invoke", "parameter"];
2267
- var tagPrefix = /^(calls|tool_calls|function_calls|invoke|parameter)(?=[\t />])/u;
2267
+ var tagPrefix = new RegExp(`^(${tagNames.join("|")})(?=[\\t />])`, "u");
2268
+ var deepSeekModelId = /(?:^|[-/.:_@])deepseek[-/._](?:v(?:3[._-]2|4)|chat|reasoner)(?=$|[-/.:_@])/iu;
2268
2269
  function createDeepSeekContentProjector(binding) {
2269
- if (!/(?:^|[/.:])deepseek[-_.]v(?:3[._-]2|4)(?=$|[._:-])/iu.test(binding?.model ?? "")) {
2270
+ if (!deepSeekModelId.test(binding?.model ?? "")) {
2270
2271
  return { push: (text) => text, seal: () => "" };
2271
2272
  }
2272
2273
  let pending = "";
@@ -2301,7 +2302,7 @@ function createDeepSeekContentProjector(binding) {
2301
2302
  }
2302
2303
  if (!codeDelimiter) {
2303
2304
  const prefix = pending.slice(0, maxHeadLength).replaceAll("\uFF5C", "|");
2304
- if (markerHeads.some((head2) => head2.startsWith(prefix))) {
2305
+ if (markerHeads.some((head2) => head2.length > prefix.length && head2.startsWith(prefix))) {
2305
2306
  if (!sealed) break;
2306
2307
  if (prefix.endsWith("DSML")) {
2307
2308
  pending = "";
@@ -2768,9 +2769,9 @@ function createOpenAIStreamTurn(profile, binding) {
2768
2769
  this.finish = finish;
2769
2770
  if (reported) this.usageAtFinish = true;
2770
2771
  }
2771
- const wireText = dsml.push(content);
2772
- this.text += wireText;
2773
- const publicContent = projector.push(wireText);
2772
+ const visibleText = dsml.push(content);
2773
+ this.text += visibleText;
2774
+ const publicContent = projector.push(visibleText);
2774
2775
  if (publicContent) emit({ kind: "text", text: publicContent });
2775
2776
  if (reasoning && emitThinking) emit({ kind: "thinking", text: reasoning });
2776
2777
  try {
@@ -2275,9 +2275,10 @@ function mergeChatUsage(previous, reported, policy, finalized = false) {
2275
2275
  var markerHeads = ["<", "</"].flatMap((start) => ["|", "||"].flatMap((left) => ["||", "|"].map((right) => `${start}${left}DSML${right}`)));
2276
2276
  var maxHeadLength = Math.max(...markerHeads.map((head) => head.length));
2277
2277
  var tagNames = ["calls", "tool_calls", "function_calls", "invoke", "parameter"];
2278
- var tagPrefix = /^(calls|tool_calls|function_calls|invoke|parameter)(?=[\t />])/u;
2278
+ var tagPrefix = new RegExp(`^(${tagNames.join("|")})(?=[\\t />])`, "u");
2279
+ var deepSeekModelId = /(?:^|[-/.:_@])deepseek[-/._](?:v(?:3[._-]2|4)|chat|reasoner)(?=$|[-/.:_@])/iu;
2279
2280
  function createDeepSeekContentProjector(binding) {
2280
- if (!/(?:^|[/.:])deepseek[-_.]v(?:3[._-]2|4)(?=$|[._:-])/iu.test(binding?.model ?? "")) {
2281
+ if (!deepSeekModelId.test(binding?.model ?? "")) {
2281
2282
  return { push: (text) => text, seal: () => "" };
2282
2283
  }
2283
2284
  let pending = "";
@@ -2312,7 +2313,7 @@ function createDeepSeekContentProjector(binding) {
2312
2313
  }
2313
2314
  if (!codeDelimiter) {
2314
2315
  const prefix = pending.slice(0, maxHeadLength).replaceAll("\uFF5C", "|");
2315
- if (markerHeads.some((head2) => head2.startsWith(prefix))) {
2316
+ if (markerHeads.some((head2) => head2.length > prefix.length && head2.startsWith(prefix))) {
2316
2317
  if (!sealed) break;
2317
2318
  if (prefix.endsWith("DSML")) {
2318
2319
  pending = "";
@@ -2779,9 +2780,9 @@ function createOpenAIStreamTurn(profile, binding) {
2779
2780
  this.finish = finish;
2780
2781
  if (reported) this.usageAtFinish = true;
2781
2782
  }
2782
- const wireText = dsml.push(content);
2783
- this.text += wireText;
2784
- const publicContent = projector.push(wireText);
2783
+ const visibleText = dsml.push(content);
2784
+ this.text += visibleText;
2785
+ const publicContent = projector.push(visibleText);
2785
2786
  if (publicContent) emit({ kind: "text", text: publicContent });
2786
2787
  if (reasoning && emitThinking) emit({ kind: "thinking", text: reasoning });
2787
2788
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kingsoftcloud/agentkit-harness-node",
3
- "version": "0.0.24",
3
+ "version": "0.0.26",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Standalone Native Harness Node adapters: a durable SQLite run store, a one-request model HTTP port, and a minimal versioned JSON-RPC 2.0 over NDJSON process entry. Reuses the shared Native adapter implementations and externalizes @kingsoftcloud/agentkit-harness-core; depends on no Studio/DSH code at runtime.",
@@ -154,7 +154,7 @@
154
154
  "src/package-integrity.mjs"
155
155
  ],
156
156
  "dependencies": {
157
- "@kingsoftcloud/agentkit-harness-core": "0.0.24",
157
+ "@kingsoftcloud/agentkit-harness-core": "0.0.26",
158
158
  "@astral-sh/ruff-wasm-nodejs": "0.16.8",
159
159
  "parse5": "7.3.0",
160
160
  "playwright-core": "1.58.2",
@@ -2,12 +2,12 @@ const markerHeads = ['<', '</'].flatMap(start => ['|', '||'].flatMap(left =>
2
2
  ['||', '|'].map(right => `${start}${left}DSML${right}`)));
3
3
  const maxHeadLength = Math.max(...markerHeads.map(head => head.length));
4
4
  const tagNames = ['calls', 'tool_calls', 'function_calls', 'invoke', 'parameter'];
5
- const tagPrefix = /^(calls|tool_calls|function_calls|invoke|parameter)(?=[\t />])/u;
5
+ const tagPrefix = new RegExp(`^(${tagNames.join('|')})(?=[\\t />])`, 'u');
6
+ const deepSeekModelId = /(?:^|[-/.:_@])deepseek[-/._](?:v(?:3[._-]2|4)|chat|reasoner)(?=$|[-/.:_@])/iu;
6
7
 
7
8
  export function createDeepSeekContentProjector(binding) {
8
- // Gate on the model ID so DeepSeek behind an OpenAI-compatible proxy behaves
9
- // the same as a direct connection, and other models keep their wire content.
10
- if (!/(?:^|[/.:])deepseek[-_.]v(?:3[._-]2|4)(?=$|[._:-])/iu.test(binding?.model ?? '')) {
9
+ // Recognize versioned and standard DeepSeek IDs inside proxy model aliases.
10
+ if (!deepSeekModelId.test(binding?.model ?? '')) {
11
11
  return { push: text => text, seal: () => '' };
12
12
  }
13
13
  let pending = '';
@@ -46,7 +46,7 @@ export function createDeepSeekContentProjector(binding) {
46
46
 
47
47
  if (!codeDelimiter) {
48
48
  const prefix = pending.slice(0, maxHeadLength).replaceAll('|', '|');
49
- if (markerHeads.some(head => head.startsWith(prefix))) {
49
+ if (markerHeads.some(head => head.length > prefix.length && head.startsWith(prefix))) {
50
50
  if (!sealed) break;
51
51
  if (prefix.endsWith('DSML')) {
52
52
  pending = '';
@@ -448,9 +448,9 @@ export function createOpenAIStreamTurn(profile, binding) {
448
448
  this.finish = finish;
449
449
  if (reported) this.usageAtFinish = true;
450
450
  }
451
- const wireText = dsml.push(content);
452
- this.text += wireText;
453
- const publicContent = projector.push(wireText);
451
+ const visibleText = dsml.push(content);
452
+ this.text += visibleText;
453
+ const publicContent = projector.push(visibleText);
454
454
  if (publicContent) emit({ kind: 'text', text: publicContent });
455
455
  if (reasoning && emitThinking) emit({ kind: 'thinking', text: reasoning });
456
456
  try {