aegis-desktop 0.8.21 → 0.8.22

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.
@@ -95,6 +95,12 @@ const DSML_RE_LEADER = /<\s*\/?\s*|\s*(?:DSML\s*)?|\s*(?:(?:tool|function)[_
95
95
  const DSML_RE_ANY_TAG = /<\s*\/?\s*|\s*(?:DSML\s*)?|\s*[A-Za-z_][A-Za-z0-9_]*[^>]{0,120}>/g;
96
96
  const DSML_RE_SKELETON = /<\s*\/?\s*(?:tool_calls|function_calls|invoke|parameter|param|reasoning)\b[^>]{0,120}>/gi;
97
97
  const DSML_RE_JSON_CALLS = /|[ \t]*(?:tool|function)[_▁ ]*calls?[_▁ ]*begin[ \t]*|([\s\S]*?)|[ \t]*(?:tool|function)[_▁ ]*calls?[_▁ ]*end[ \t]*|/gi;
98
+ // The leader/closer halves of DSML_RE_JSON_CALLS above, split out so the hold
99
+ // logic can detect "the leader arrived but its closer has not" — an arbitrary
100
+ // JSON blob sits between them with no '<' or recognizable structure of its
101
+ // own, so nothing else below would otherwise hold it back.
102
+ const DSML_RE_JSON_CALLS_OPEN = /|[ \t]*(?:tool|function)[_▁ ]*calls?[_▁ ]*begin[ \t]*|/gi;
103
+ const DSML_RE_JSON_CALLS_CLOSE = /|[ \t]*(?:tool|function)[_▁ ]*calls?[_▁ ]*end[ \t]*|/gi;
98
104
  const DSML_RE_ENVELOPE_TOKEN = /|[ \t]?[A-Za-z0-9_▁]*[ \t]?|/g;
99
105
  const DSML_RE_DRIFT_INVOKE = /<\s*|\s*(?:DSML\s*)?|\s*(?:invoke|call|tool_call)\b\s*([^>]*?)\s*>/gi;
100
106
  const DSML_RE_DRIFT_PARAM = /<\s*|\s*(?:DSML\s*)?|\s*(?:parameter|param|arg)\b\s*([^>]*?)\s*>/gi;
@@ -296,6 +302,17 @@ function dsmlUnterminated(s) {
296
302
  function dsmlHoldFrom(buf) {
297
303
  const tagStart = buf.search(/<\s*\/?\s*|/);
298
304
  if (tagStart !== -1) return tagStart;
305
+ // The older JSON-array envelope (DSML_RE_JSON_CALLS): once its leader token
306
+ // has arrived, hold everything until the matching closer token lands. An
307
+ // arbitrary JSON blob sits between them with no '<' and no recognizable
308
+ // per-character structure, so without this check it streams straight
309
+ // through as visible prose the instant the leader's own closing '|'
310
+ // arrives — the hold rule below only looks at ONE pipe token at a time and
311
+ // has no notion of "waiting for a second, different token later on".
312
+ const jsonOpenIdx = buf.search(DSML_RE_JSON_CALLS_OPEN);
313
+ if (jsonOpenIdx !== -1 && buf.slice(jsonOpenIdx).search(DSML_RE_JSON_CALLS_CLOSE) === -1) {
314
+ return jsonOpenIdx;
315
+ }
299
316
  const lt = DSML_RE_TRAILING_LT.exec(buf);
300
317
  if (lt) return lt.index;
301
318
  const openIdx = buf.indexOf('|');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aegis-desktop",
3
3
  "productName": "AEGIS Desktop",
4
- "version": "0.8.21",
4
+ "version": "0.8.22",
5
5
  "description": "Thin Electron host for AEGIS — a local chat UI over the shared client/aegis.js transport. Ships transport + UI only; engine logic stays server-side.",
6
6
  "author": {
7
7
  "name": "AEGIS Code",
package/vendor/aegis.js CHANGED
@@ -100,6 +100,12 @@ const DSML_RE_LEADER = /<\s*\/?\s*|\s*(?:DSML\s*)?|\s*(?:(?:tool|function)[_
100
100
  const DSML_RE_ANY_TAG = /<\s*\/?\s*|\s*(?:DSML\s*)?|\s*[A-Za-z_][A-Za-z0-9_]*[^>]{0,120}>/g;
101
101
  const DSML_RE_SKELETON = /<\s*\/?\s*(?:tool_calls|function_calls|invoke|parameter|param|reasoning)\b[^>]{0,120}>/gi;
102
102
  const DSML_RE_JSON_CALLS = /|[ \t]*(?:tool|function)[_▁ ]*calls?[_▁ ]*begin[ \t]*|([\s\S]*?)|[ \t]*(?:tool|function)[_▁ ]*calls?[_▁ ]*end[ \t]*|/gi;
103
+ // The leader/closer halves of DSML_RE_JSON_CALLS above, split out so the hold
104
+ // logic can detect "the leader arrived but its closer has not" — an arbitrary
105
+ // JSON blob sits between them with no '<' or recognizable structure of its
106
+ // own, so nothing else below would otherwise hold it back.
107
+ const DSML_RE_JSON_CALLS_OPEN = /|[ \t]*(?:tool|function)[_▁ ]*calls?[_▁ ]*begin[ \t]*|/gi;
108
+ const DSML_RE_JSON_CALLS_CLOSE = /|[ \t]*(?:tool|function)[_▁ ]*calls?[_▁ ]*end[ \t]*|/gi;
103
109
  const DSML_RE_ENVELOPE_TOKEN = /|[ \t]?[A-Za-z0-9_▁]*[ \t]?|/g;
104
110
  const DSML_RE_DRIFT_INVOKE = /<\s*|\s*(?:DSML\s*)?|\s*(?:invoke|call|tool_call)\b\s*([^>]*?)\s*>/gi;
105
111
  const DSML_RE_DRIFT_PARAM = /<\s*|\s*(?:DSML\s*)?|\s*(?:parameter|param|arg)\b\s*([^>]*?)\s*>/gi;
@@ -301,6 +307,17 @@ function dsmlUnterminated(s) {
301
307
  function dsmlHoldFrom(buf) {
302
308
  const tagStart = buf.search(/<\s*\/?\s*|/);
303
309
  if (tagStart !== -1) return tagStart;
310
+ // The older JSON-array envelope (DSML_RE_JSON_CALLS): once its leader token
311
+ // has arrived, hold everything until the matching closer token lands. An
312
+ // arbitrary JSON blob sits between them with no '<' and no recognizable
313
+ // per-character structure, so without this check it streams straight
314
+ // through as visible prose the instant the leader's own closing '|'
315
+ // arrives — the hold rule below only looks at ONE pipe token at a time and
316
+ // has no notion of "waiting for a second, different token later on".
317
+ const jsonOpenIdx = buf.search(DSML_RE_JSON_CALLS_OPEN);
318
+ if (jsonOpenIdx !== -1 && buf.slice(jsonOpenIdx).search(DSML_RE_JSON_CALLS_CLOSE) === -1) {
319
+ return jsonOpenIdx;
320
+ }
304
321
  const lt = DSML_RE_TRAILING_LT.exec(buf);
305
322
  if (lt) return lt.index;
306
323
  const openIdx = buf.indexOf('|');