@canonmsg/codex-plugin 0.11.7 → 0.11.8

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/host.js +32 -2
  2. package/package.json +3 -3
package/dist/host.js CHANGED
@@ -122,7 +122,12 @@ function buildCodexModelOptions(model) {
122
122
  function normalizeRuntimeTurnState(value) {
123
123
  const normalizedTurn = normalizeTurnState(value);
124
124
  if (normalizedTurn) {
125
- return { state: normalizedTurn.state };
125
+ return {
126
+ state: normalizedTurn.state,
127
+ ...(normalizedTurn.openedAt !== undefined ? { openedAt: normalizedTurn.openedAt } : {}),
128
+ ...(normalizedTurn.updatedAt !== undefined ? { updatedAt: normalizedTurn.updatedAt } : {}),
129
+ ...(normalizedTurn.turnUpdatedAt !== undefined ? { turnUpdatedAt: normalizedTurn.turnUpdatedAt } : {}),
130
+ };
126
131
  }
127
132
  return null;
128
133
  }
@@ -472,6 +477,10 @@ export async function main() {
472
477
  }).catch(() => { });
473
478
  }
474
479
  function writeTurn(session) {
480
+ const isOpenTurn = session.turnState === 'thinking'
481
+ || session.turnState === 'streaming'
482
+ || session.turnState === 'tool'
483
+ || session.turnState === 'waiting_input';
475
484
  runtimeState.writeTurnState(session.conversationId, {
476
485
  turnId: session.currentTurnId,
477
486
  state: session.turnState,
@@ -480,11 +489,15 @@ export async function main() {
480
489
  lastAcceptedIntent: session.lastAcceptedIntent,
481
490
  capabilities: CODEX_RUNTIME_CAPABILITIES,
482
491
  ...(session.currentTurnOpenedAt ? { openedAt: session.currentTurnOpenedAt } : {}),
492
+ ...(isOpenTurn && session.currentTurnUpdatedAt ? { turnUpdatedAt: session.currentTurnUpdatedAt } : {}),
483
493
  ...(session.turnState === 'idle' || session.turnState === 'completed' || session.turnState === 'interrupted'
484
494
  ? { completedAt: { '.sv': 'timestamp' } }
485
495
  : {}),
486
496
  }).catch(() => { });
487
497
  }
498
+ function markTurnProgress(session) {
499
+ session.currentTurnUpdatedAt = Date.now();
500
+ }
488
501
  async function markQueuedMessageAccepted(conversationId, sourceMessageId, markAccepted) {
489
502
  if (!markAccepted || !sourceMessageId)
490
503
  return;
@@ -566,6 +579,7 @@ export async function main() {
566
579
  session.turnState = 'idle';
567
580
  session.currentTurnId = null;
568
581
  session.currentTurnOpenedAt = null;
582
+ session.currentTurnUpdatedAt = null;
569
583
  session.lastAcceptedIntent = null;
570
584
  session.resetRequested = false;
571
585
  }
@@ -652,6 +666,7 @@ export async function main() {
652
666
  turnState: 'idle',
653
667
  currentTurnId: null,
654
668
  currentTurnOpenedAt: null,
669
+ currentTurnUpdatedAt: null,
655
670
  activeSelfContextId: null,
656
671
  lastAcceptedIntent: null,
657
672
  resetRequested: false,
@@ -793,6 +808,7 @@ export async function main() {
793
808
  session.state.state = 'running';
794
809
  session.currentTurnId = randomUUID();
795
810
  session.currentTurnOpenedAt = Date.now();
811
+ session.currentTurnUpdatedAt = session.currentTurnOpenedAt;
796
812
  session.lastAcceptedIntent = nextTurn.intent;
797
813
  session.turnState = 'thinking';
798
814
  session.lastActivity = Date.now();
@@ -823,6 +839,7 @@ export async function main() {
823
839
  }
824
840
  if (event.type === 'message') {
825
841
  session.turnState = 'streaming';
842
+ markTurnProgress(session);
826
843
  writeTurn(session);
827
844
  stopVisibleWorkSignal(session);
828
845
  client.setTyping(session.conversationId, false).catch(() => { });
@@ -834,6 +851,7 @@ export async function main() {
834
851
  }
835
852
  if (event.type === 'command.started') {
836
853
  session.turnState = 'tool';
854
+ markTurnProgress(session);
837
855
  writeTurn(session);
838
856
  startVisibleWorkSignal(session);
839
857
  runtimeState.writeStreaming(session.conversationId, {
@@ -842,6 +860,15 @@ export async function main() {
842
860
  }).catch(() => { });
843
861
  return;
844
862
  }
863
+ if (event.type === 'command.completed') {
864
+ if (session.turnState === 'tool') {
865
+ session.turnState = 'thinking';
866
+ markTurnProgress(session);
867
+ writeTurn(session);
868
+ startVisibleWorkSignal(session);
869
+ }
870
+ return;
871
+ }
845
872
  if (event.type === 'turn.completed') {
846
873
  writeState(session);
847
874
  }
@@ -947,6 +974,7 @@ export async function main() {
947
974
  session.turnState = 'idle';
948
975
  session.currentTurnId = null;
949
976
  session.currentTurnOpenedAt = null;
977
+ session.currentTurnUpdatedAt = null;
950
978
  session.lastAcceptedIntent = null;
951
979
  session.resetRequested = false;
952
980
  session.lastActivity = Date.now();
@@ -1351,7 +1379,9 @@ export async function main() {
1351
1379
  const heartbeat = setInterval(() => {
1352
1380
  for (const session of sessions.values()) {
1353
1381
  writeState(session);
1354
- writeTurn(session);
1382
+ if (!session.running) {
1383
+ writeTurn(session);
1384
+ }
1355
1385
  }
1356
1386
  void publishRuntimeHeartbeat();
1357
1387
  }, HEARTBEAT_MS);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonmsg/codex-plugin",
3
- "version": "0.11.7",
3
+ "version": "0.11.8",
4
4
  "description": "Canon host integration for Codex CLI",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -29,8 +29,8 @@
29
29
  "prepack": "npm run build"
30
30
  },
31
31
  "dependencies": {
32
- "@canonmsg/agent-sdk": "^1.5.2",
33
- "@canonmsg/core": "^0.19.3"
32
+ "@canonmsg/agent-sdk": "^1.5.3",
33
+ "@canonmsg/core": "^0.20.0"
34
34
  },
35
35
  "engines": {
36
36
  "node": ">=18.0.0"