@canonmsg/claude-code-plugin 0.14.6 → 0.14.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.
package/dist/host.js CHANGED
@@ -605,6 +605,7 @@ const FINAL_DELIVERY_RETRY_MS = 2_000;
605
605
  const CLAUDE_RUNTIME_CAPABILITIES = {
606
606
  ...DEFAULT_RUNTIME_CAPABILITIES,
607
607
  supportsInterrupt: true,
608
+ supportsInputInterrupt: true,
608
609
  supportsQueue: true,
609
610
  supportsInterleave: false,
610
611
  supportsRequiresAction: true,
@@ -908,6 +909,7 @@ function createSession(conversationId, environment, agentId, client, runtimeStat
908
909
  turnState: 'idle',
909
910
  currentTurnId: null,
910
911
  currentTurnOpenedAt: null,
912
+ currentTurnUpdatedAt: null,
911
913
  activeSelfContextId: null,
912
914
  lastAcceptedIntent: null,
913
915
  lastActivity: Date.now(),
@@ -1129,6 +1131,13 @@ function createSession(conversationId, environment, agentId, client, runtimeStat
1129
1131
  writeState();
1130
1132
  }
1131
1133
  function writeTurn() {
1134
+ const isOpenTurn = session.turnState === 'thinking'
1135
+ || session.turnState === 'streaming'
1136
+ || session.turnState === 'tool'
1137
+ || session.turnState === 'waiting_input';
1138
+ if (isOpenTurn) {
1139
+ session.currentTurnUpdatedAt = Date.now();
1140
+ }
1132
1141
  runtimeState.writeTurnState(conversationId, {
1133
1142
  turnId: session.currentTurnId,
1134
1143
  state: session.turnState,
@@ -1137,6 +1146,7 @@ function createSession(conversationId, environment, agentId, client, runtimeStat
1137
1146
  lastAcceptedIntent: session.lastAcceptedIntent,
1138
1147
  capabilities: CLAUDE_RUNTIME_CAPABILITIES,
1139
1148
  ...(session.currentTurnOpenedAt ? { openedAt: session.currentTurnOpenedAt } : {}),
1149
+ ...(isOpenTurn && session.currentTurnUpdatedAt ? { turnUpdatedAt: session.currentTurnUpdatedAt } : {}),
1140
1150
  ...(session.turnState === 'idle' || session.turnState === 'completed' || session.turnState === 'interrupted'
1141
1151
  ? { completedAt: { '.sv': 'timestamp' } }
1142
1152
  : {}),
@@ -1876,6 +1886,16 @@ export async function main() {
1876
1886
  return client.updateMessageDisposition(conversationId, input.sourceMessageId, 'rejected').catch(() => { });
1877
1887
  }));
1878
1888
  }
1889
+ function removeQueuedInput(conversationId, sourceMessageId) {
1890
+ const session = sessions.get(conversationId);
1891
+ if (!session || session.pendingInputs.length === 0)
1892
+ return;
1893
+ const before = session.pendingInputs.length;
1894
+ session.pendingInputs = session.pendingInputs.filter((input) => input.sourceMessageId !== sourceMessageId);
1895
+ if (session.pendingInputs.length === before)
1896
+ return;
1897
+ session.writeTurn();
1898
+ }
1879
1899
  function evictOldestIdle() {
1880
1900
  let oldest = null;
1881
1901
  for (const s of sessions.values()) {
@@ -2275,6 +2295,9 @@ export async function main() {
2275
2295
  }
2276
2296
  })();
2277
2297
  },
2298
+ onMessageDeleted: (payload) => {
2299
+ removeQueuedInput(payload.conversationId, payload.messageId);
2300
+ },
2278
2301
  onConversationUpdated: (payload) => {
2279
2302
  handleConversationUpdated(payload);
2280
2303
  },
@@ -2432,7 +2455,9 @@ export async function main() {
2432
2455
  const heartbeat = setInterval(() => {
2433
2456
  for (const session of sessions.values()) {
2434
2457
  session.writeState();
2435
- session.writeTurn();
2458
+ if (session.state.state !== 'running' && session.state.state !== 'requires_action') {
2459
+ session.writeTurn();
2460
+ }
2436
2461
  }
2437
2462
  void publishRuntimeHeartbeat();
2438
2463
  }, HEARTBEAT_MS);
@@ -31,6 +31,7 @@ export interface ClaudeCompletedTurnState {
31
31
  turnState: TurnLifecycleState;
32
32
  currentTurnId: string | null;
33
33
  currentTurnOpenedAt: number | null;
34
+ currentTurnUpdatedAt: number | null;
34
35
  lastAcceptedIntent: DeliveryIntent | null;
35
36
  }
36
37
  export declare function createClaudeInputEnvelope(input: {
@@ -36,6 +36,7 @@ export function resetClaudeCompletedTurnState(session) {
36
36
  session.state.state = 'idle';
37
37
  session.currentTurnId = null;
38
38
  session.currentTurnOpenedAt = null;
39
+ session.currentTurnUpdatedAt = null;
39
40
  session.lastAcceptedIntent = null;
40
41
  session.pendingFinalText = null;
41
42
  session.pendingFinalDelivery = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonmsg/claude-code-plugin",
3
- "version": "0.14.6",
3
+ "version": "0.14.8",
4
4
  "description": "Canon channel plugin for Claude Code — messaging where AI agents are first-class citizens",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -31,8 +31,8 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@anthropic-ai/claude-agent-sdk": "^0.2.101",
34
- "@canonmsg/agent-sdk": "^1.5.1",
35
- "@canonmsg/core": "^0.19.2",
34
+ "@canonmsg/agent-sdk": "^1.5.3",
35
+ "@canonmsg/core": "^0.20.0",
36
36
  "@modelcontextprotocol/sdk": "^1.12.0"
37
37
  },
38
38
  "engines": {