@bxb1337/windsurf-fast-context 1.0.3 → 1.0.4

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.
@@ -6,7 +6,7 @@ const protobuf_js_1 = require("../protocol/protobuf.js");
6
6
  const TOOL_CALL_PREFIX = '[TOOL_CALLS]';
7
7
  const ARGS_PREFIX = '[ARGS]';
8
8
  const STOP_TOKEN = '</s>';
9
- const EMPTY_TOOL_CALLS_PATTERN = /TOOL_CALLS\d*<\/s>\s*\{\}/g;
9
+ const EMPTY_TOOL_CALLS_PATTERN = /TOOL_CALLS\d*(?:<\/s>)?\s*\{\s*\}/g;
10
10
  function pushText(parts, text) {
11
11
  if (text.length > 0) {
12
12
  parts.push({ type: 'text', text });
@@ -67,6 +67,16 @@ const response_converter_js_1 = require("./response-converter.js");
67
67
  const result = (0, response_converter_js_1.convertResponse)(Buffer.from(input, 'utf8'));
68
68
  (0, vitest_1.expect)(result).toEqual([{ type: 'text', text: 'Hello world ' }]);
69
69
  });
70
+ (0, vitest_1.it)('strips empty TOOL_CALLS markers without stop token', () => {
71
+ const input = 'Hello world TOOL_CALLS1{}';
72
+ const result = (0, response_converter_js_1.convertResponse)(Buffer.from(input, 'utf8'));
73
+ (0, vitest_1.expect)(result).toEqual([{ type: 'text', text: 'Hello world ' }]);
74
+ });
75
+ (0, vitest_1.it)('strips empty TOOL_CALLS markers with whitespace', () => {
76
+ const input = 'Text TOOL_CALLS2{ } more text';
77
+ const result = (0, response_converter_js_1.convertResponse)(Buffer.from(input, 'utf8'));
78
+ (0, vitest_1.expect)(result).toEqual([{ type: 'text', text: 'Text more text' }]);
79
+ });
70
80
  (0, vitest_1.it)('strips standalone stop token', () => {
71
81
  const input = 'Hello world</s>';
72
82
  const result = (0, response_converter_js_1.convertResponse)(Buffer.from(input, 'utf8'));
@@ -3,7 +3,7 @@ import { extractStrings } from '../protocol/protobuf.js';
3
3
  const TOOL_CALL_PREFIX = '[TOOL_CALLS]';
4
4
  const ARGS_PREFIX = '[ARGS]';
5
5
  const STOP_TOKEN = '</s>';
6
- const EMPTY_TOOL_CALLS_PATTERN = /TOOL_CALLS\d*<\/s>\s*\{\}/g;
6
+ const EMPTY_TOOL_CALLS_PATTERN = /TOOL_CALLS\d*(?:<\/s>)?\s*\{\s*\}/g;
7
7
  function pushText(parts, text) {
8
8
  if (text.length > 0) {
9
9
  parts.push({ type: 'text', text });
@@ -65,6 +65,16 @@ describe('convertResponse', () => {
65
65
  const result = convertResponse(Buffer.from(input, 'utf8'));
66
66
  expect(result).toEqual([{ type: 'text', text: 'Hello world ' }]);
67
67
  });
68
+ it('strips empty TOOL_CALLS markers without stop token', () => {
69
+ const input = 'Hello world TOOL_CALLS1{}';
70
+ const result = convertResponse(Buffer.from(input, 'utf8'));
71
+ expect(result).toEqual([{ type: 'text', text: 'Hello world ' }]);
72
+ });
73
+ it('strips empty TOOL_CALLS markers with whitespace', () => {
74
+ const input = 'Text TOOL_CALLS2{ } more text';
75
+ const result = convertResponse(Buffer.from(input, 'utf8'));
76
+ expect(result).toEqual([{ type: 'text', text: 'Text more text' }]);
77
+ });
68
78
  it('strips standalone stop token', () => {
69
79
  const input = 'Hello world</s>';
70
80
  const result = convertResponse(Buffer.from(input, 'utf8'));
package/package.json CHANGED
@@ -1,16 +1,8 @@
1
1
  {
2
2
  "name": "@bxb1337/windsurf-fast-context",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "AI SDK V3 provider for Windsurf's Devstral code search API",
5
5
  "type": "module",
6
- "scripts": {
7
- "test": "vitest --run",
8
- "build:types": "tsc -p tsconfig.types.json",
9
- "build:esm": "tsc -p tsconfig.json",
10
- "build:cjs": "tsc -p tsconfig.cjs.json",
11
- "build": "pnpm -s run build:types && pnpm -s run build:esm && pnpm -s run build:cjs && node ./scripts/postbuild.js",
12
- "typecheck": "tsc -p tsconfig.json --noEmit"
13
- },
14
6
  "keywords": [
15
7
  "windsurf",
16
8
  "devstral",
@@ -47,5 +39,13 @@
47
39
  "dist",
48
40
  "README.md",
49
41
  "LICENSE"
50
- ]
51
- }
42
+ ],
43
+ "scripts": {
44
+ "test": "vitest --run",
45
+ "build:types": "tsc -p tsconfig.types.json",
46
+ "build:esm": "tsc -p tsconfig.json",
47
+ "build:cjs": "tsc -p tsconfig.cjs.json",
48
+ "build": "pnpm -s run build:types && pnpm -s run build:esm && pnpm -s run build:cjs && node ./scripts/postbuild.js",
49
+ "typecheck": "tsc -p tsconfig.json --noEmit"
50
+ }
51
+ }