@amalgm/chat 0.2.5 → 0.2.6

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.
@@ -649,6 +649,13 @@ class CodexAdapter {
649
649
  complete = true;
650
650
  push(done({ providerSessionId: session.providerSessionId, stopReason: 'cancelled' }));
651
651
  };
652
+ // Subscription can synchronously deliver already-buffered provider
653
+ // notifications. Everything the handler reads must therefore be fixed
654
+ // before `on` opens that door.
655
+ const nativeInput = codexPromptInput(input);
656
+ const compactCommand = nativeInput.length === 1
657
+ && nativeInput[0].type === 'text'
658
+ && isCompactCommand(nativeInput[0].text);
652
659
  const off = session.client.on((msg) => {
653
660
  const p = msg.params || {};
654
661
  if (p.threadId && p.threadId !== session.providerSessionId) return;
@@ -684,10 +691,6 @@ class CodexAdapter {
684
691
  });
685
692
  session.activeTurnId = null;
686
693
  session.activeTurnHadAssistant = false;
687
- const nativeInput = codexPromptInput(input);
688
- const compactCommand = nativeInput.length === 1
689
- && nativeInput[0].type === 'text'
690
- && isCompactCommand(nativeInput[0].text);
691
694
  const startRequest = compactCommand
692
695
  ? session.client.request('thread/compact/start', { threadId: session.providerSessionId })
693
696
  : session.client.request('turn/start', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amalgm/chat",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "A provider-agnostic agent chat SDK with ACP content, prepared execution, normalized streams, and usage.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",