@cortexkit/pi-magic-context 0.49.66 → 0.49.67

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.
Files changed (2) hide show
  1. package/dist/index.js +15 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3606,7 +3606,7 @@ function startHostStallProfilerSwitch() {
3606
3606
  // package.json
3607
3607
  var package_default = {
3608
3608
  name: "@cortexkit/pi-magic-context",
3609
- version: "0.49.66",
3609
+ version: "0.49.67",
3610
3610
  type: "module",
3611
3611
  description: "Pi and OMP coding agent extension for Magic Context — cross-session memory and context management",
3612
3612
  main: "dist/index.js",
@@ -39176,6 +39176,8 @@ function piToolCallWireId(id, model, source) {
39176
39176
  var dateReminderPlans = new WeakMap;
39177
39177
  var MAX_MESSAGES = 1e5;
39178
39178
  var ORPHAN_NOTE = Symbol("prepared orphan tool result");
39179
+ var ORPHAN_NOTE_ALTERNATIVES = Symbol("prepared orphan tool result variants");
39180
+ var OMP_PROVIDER_ERROR_REPLAY_TEXT = "Tool call was not executed because the provider stream ended with an error before the tool could run.";
39179
39181
  var rowDiagnostics = new WeakMap;
39180
39182
  var preparedSources = new WeakMap;
39181
39183
  var ANTHROPIC_CONTINUE_PAD_TEXT = "Continue.";
@@ -39226,6 +39228,9 @@ function messageStructure(value) {
39226
39228
  if (message.content.length > 32 * 1024 * 1024)
39227
39229
  return;
39228
39230
  row.exactText = message.content;
39231
+ const alternatives = Reflect.get(message, ORPHAN_NOTE_ALTERNATIVES);
39232
+ if (Array.isArray(alternatives))
39233
+ row.exactTextAlternatives = alternatives;
39229
39234
  }
39230
39235
  if (typeof message.timestamp === "number")
39231
39236
  row.timestamp = message.timestamp;
@@ -39456,15 +39461,19 @@ function projectMissingToolResults(messages, model, host = "omp") {
39456
39461
  if (!parts.length)
39457
39462
  continue;
39458
39463
  const error = message.isError ? ' is-error="true"' : "";
39459
- const note = `<stale-tool-result tool="${message.toolName}" id="${message.toolCallId}"${error}>
39460
- ${parts.join(`
39461
- `)}
39464
+ const staleNote = (text) => `<stale-tool-result tool="${message.toolName}" id="${message.toolCallId}"${error}>
39465
+ ${text}
39462
39466
  </stale-tool-result>`;
39467
+ const note = staleNote(parts.join(`
39468
+ `));
39469
+ const details = object11(message.details);
39470
+ const replayNote = details?.__synthetic === true && details.source === "assistant_stop_error" ? staleNote(OMP_PROVIDER_ERROR_REPLAY_TEXT) : undefined;
39463
39471
  projected.push({
39464
39472
  role: "user",
39465
39473
  content: api === "ollama-chat" ? note : new TextDecoder().decode(new TextEncoder().encode(note)),
39466
39474
  timestamp: message.timestamp,
39467
- [ORPHAN_NOTE]: true
39475
+ [ORPHAN_NOTE]: true,
39476
+ ...replayNote !== undefined && replayNote !== note ? { [ORPHAN_NOTE_ALTERNATIVES]: [replayNote] } : {}
39468
39477
  });
39469
39478
  }
39470
39479
  flush();
@@ -40484,7 +40493,7 @@ function preparedStructureMismatch(payload, prepared, onImageTrim, reminders, re
40484
40493
  if (expected.exactText !== undefined || expected.exactImages !== undefined) {
40485
40494
  if (actual.wireRole !== "user")
40486
40495
  return "role";
40487
- if (expected.exactText !== undefined && !matchesUserText(actual.wireContent, expected.exactText, prepared?.api, responses, google || body.inferenceConfig !== undefined) || expected.exactImages !== undefined && !piMatchesChatImages(actual.wireContent, expected.exactImages))
40496
+ if (expected.exactText !== undefined && !matchesUserText(actual.wireContent, expected.exactText, prepared?.api, responses, google || body.inferenceConfig !== undefined) && !expected.exactTextAlternatives?.some((text) => matchesUserText(actual.wireContent, text, prepared?.api, responses, google || body.inferenceConfig !== undefined)) || expected.exactImages !== undefined && !piMatchesChatImages(actual.wireContent, expected.exactImages))
40488
40497
  return "content";
40489
40498
  }
40490
40499
  if (actual.calls.length !== expected.calls.length || actual.results.length !== expected.results.length)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/pi-magic-context",
3
- "version": "0.49.66",
3
+ "version": "0.49.67",
4
4
  "type": "module",
5
5
  "description": "Pi and OMP coding agent extension for Magic Context — cross-session memory and context management",
6
6
  "main": "dist/index.js",