@canonmsg/claude-code-plugin 0.14.5 → 0.14.7

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 +55 -1
  2. package/package.json +3 -3
package/dist/host.js CHANGED
@@ -26,12 +26,20 @@ import { execFileSync } from 'node:child_process';
26
26
  import { existsSync } from 'node:fs';
27
27
  import { query, } from '@anthropic-ai/claude-agent-sdk';
28
28
  import { isAnthropicImageAttachment, materializeMessageMedia, materializeReplyContextMedia, toAnthropicImageBlock, } from '@canonmsg/agent-sdk';
29
- import { CLAUDE_PERMISSION_MODE_OPTIONS, RUNTIME_NEW_SESSION_ACTION, RUNTIME_STOP_ACTION, RUNTIME_STOP_AND_DROP_ACTION, buildCanonHostPrompt, buildConfiguredWorkspaceOptionsWithRoots, buildConversationEnvironmentKey, buildFirstPartyCodingRuntimeDescriptor, buildHydratedInboundContext, diffCanonMemberIds, buildPlanApprovalRequest, buildQuestionRequest, buildPublicWorkspaceRoots, buildPublicWorkspaceOptions, createConversationMetadataLoader, createRuntimeStatePublisher, EXECUTION_ENVIRONMENT_MODES, CanonClient, CanonStream, DEFAULT_PARTICIPATION_HISTORY_FETCH_LIMIT, DEFAULT_RUNTIME_CAPABILITIES, HOST_ADMISSION_ACTIONS_DISABLED, ApprovalManager, ExecutionEnvironmentError, FINAL_MESSAGE_HANDOFF_MS, buildLocalRuntimeId, getActiveProfileLock, heartbeatLocalRuntimeEntry, normalizeTurnMetadata, prepareConversationEnvironment, resolveCanonAgent, initRTDBAuth, rtdbRead, rtdbWrite, loadHostSessionConfig, loadRuntimeSessionState, markLocalRuntimeStopped, releaseConversationEnvironment, saveRuntimeSessionState, clearRuntimeSessionState, publishHostAgentRuntime, publishHostSessionSnapshots, renderCanonHostInboundContent, resolveHostWorkspaceCwd, upsertLocalRuntimeEntry, } from '@canonmsg/core';
29
+ import { CLAUDE_PERMISSION_MODE_OPTIONS, RUNTIME_NEW_SESSION_ACTION, RUNTIME_STOP_ACTION, RUNTIME_STOP_AND_DROP_ACTION, buildCanonHostPrompt, buildConfiguredWorkspaceOptionsWithRoots, buildConversationEnvironmentKey, buildFirstPartyCodingRuntimeDescriptor, buildHydratedInboundContext, diffCanonMemberIds, buildPlanApprovalRequest, buildQuestionRequest, buildPublicWorkspaceRoots, buildPublicWorkspaceOptions, buildRuntimePresentationPolicy, DEFAULT_FIRST_PARTY_RUNTIME_PRESENTATION, createConversationMetadataLoader, createRuntimeStatePublisher, EXECUTION_ENVIRONMENT_MODES, CanonClient, CanonStream, DEFAULT_PARTICIPATION_HISTORY_FETCH_LIMIT, DEFAULT_RUNTIME_CAPABILITIES, HOST_ADMISSION_ACTIONS_DISABLED, ApprovalManager, ExecutionEnvironmentError, FINAL_MESSAGE_HANDOFF_MS, buildLocalRuntimeId, getActiveProfileLock, heartbeatLocalRuntimeEntry, normalizeTurnMetadata, prepareConversationEnvironment, resolveCanonAgent, initRTDBAuth, rtdbRead, rtdbWrite, loadHostSessionConfig, loadRuntimeSessionState, markLocalRuntimeStopped, releaseConversationEnvironment, saveRuntimeSessionState, clearRuntimeSessionState, publishHostAgentRuntime, publishHostSessionSnapshots, renderCanonHostInboundContent, resolveHostWorkspaceCwd, upsertLocalRuntimeEntry, } from '@canonmsg/core';
30
30
  import { buildInboundContextLines, decideAutoReply, } from './inbound-policy.js';
31
31
  import { createStreamingBuffer } from './streaming-buffer.js';
32
32
  import { runCli } from './cli-entry.js';
33
33
  import { decideClaudeToolPermissionForMode, parseAllowedNonOwnerClaudeTools, } from './tool-policy.js';
34
34
  import { buildClaudeFinalMessageId, createClaudeInputEnvelope, formatClaudeControlError, mergeClaudeModelOptions, resetClaudeCompletedTurnState, shouldDeliverClaudeFinal, } from './session-state.js';
35
+ function parseRuntimeVisibilityPreset(value) {
36
+ return value === 'normal' || value === 'minimal' || value === 'full' ? value : undefined;
37
+ }
38
+ function stringArgs(value) {
39
+ return Array.isArray(value)
40
+ ? value.filter((item) => typeof item === 'string' && item.trim().length > 0)
41
+ : undefined;
42
+ }
35
43
  const HELP = `canon-claude — run a local Claude Code agent host for Canon
36
44
 
37
45
  USAGE
@@ -41,6 +49,12 @@ COMMON FLAGS
41
49
  --cwd <path> Project directory to run Claude Code from
42
50
  --workspace <path> Additional project to expose in Canon
43
51
  --workspace-root <path> Discover projects under an approved root
52
+ --runtime-visibility <normal|minimal|full>
53
+ Detail visibility preset
54
+ --show-runtime-detail <field>
55
+ Override a hidden detail field
56
+ --hide-runtime-detail <field>
57
+ Hide a runtime detail field
44
58
  --help, -h Show this help
45
59
  --version, -V Show package version
46
60
 
@@ -180,6 +194,7 @@ function buildClaudeRuntimeDescriptor(input) {
180
194
  defaultPermissionMode: 'default',
181
195
  streamingTextMode: 'delta',
182
196
  admissionActions: HOST_ADMISSION_ACTIONS_DISABLED,
197
+ presentation: input.presentation,
183
198
  commands,
184
199
  actions: [
185
200
  {
@@ -590,6 +605,7 @@ const FINAL_DELIVERY_RETRY_MS = 2_000;
590
605
  const CLAUDE_RUNTIME_CAPABILITIES = {
591
606
  ...DEFAULT_RUNTIME_CAPABILITIES,
592
607
  supportsInterrupt: true,
608
+ supportsInputInterrupt: true,
593
609
  supportsQueue: true,
594
610
  supportsInterleave: false,
595
611
  supportsRequiresAction: true,
@@ -1415,6 +1431,7 @@ function createSession(conversationId, environment, agentId, client, runtimeStat
1415
1431
  workspaces: buildPublicWorkspaceOptions(workspaceOptions),
1416
1432
  workspaceRoots: workspaceRootMetadata,
1417
1433
  executionModes: config.availableExecutionModes,
1434
+ presentation: config.runtimePresentation,
1418
1435
  }),
1419
1436
  });
1420
1437
  writeState();
@@ -1443,6 +1460,9 @@ export async function main() {
1443
1460
  cwd: { type: 'string' },
1444
1461
  workspace: { type: 'string', multiple: true },
1445
1462
  'workspace-root': { type: 'string', multiple: true },
1463
+ 'runtime-visibility': { type: 'string' },
1464
+ 'show-runtime-detail': { type: 'string', multiple: true },
1465
+ 'hide-runtime-detail': { type: 'string', multiple: true },
1446
1466
  },
1447
1467
  strict: false,
1448
1468
  });
@@ -1522,6 +1542,12 @@ export async function main() {
1522
1542
  const hostAvailableExecutionModes = [
1523
1543
  ...EXECUTION_ENVIRONMENT_MODES,
1524
1544
  ];
1545
+ const runtimePresentation = buildRuntimePresentationPolicy({
1546
+ base: DEFAULT_FIRST_PARTY_RUNTIME_PRESENTATION,
1547
+ preset: parseRuntimeVisibilityPreset(args['runtime-visibility']),
1548
+ show: stringArgs(args['show-runtime-detail']),
1549
+ hide: stringArgs(args['hide-runtime-detail']),
1550
+ });
1525
1551
  let runtimeDescriptor = {
1526
1552
  defaultWorkspaceId: workspaceOptions[0]?.id,
1527
1553
  defaultPermissionMode: 'default',
@@ -1533,6 +1559,7 @@ export async function main() {
1533
1559
  workspaces: buildPublicWorkspaceOptions(workspaceOptions),
1534
1560
  workspaceRoots: workspaceRootMetadata,
1535
1561
  executionModes: hostAvailableExecutionModes,
1562
+ presentation: runtimePresentation,
1536
1563
  }),
1537
1564
  };
1538
1565
  const conversationCache = new Map();
@@ -1630,6 +1657,7 @@ export async function main() {
1630
1657
  workspaces: buildPublicWorkspaceOptions(workspaceOptions),
1631
1658
  workspaceRoots: workspaceRootMetadata,
1632
1659
  executionModes: hostAvailableExecutionModes,
1660
+ presentation: runtimePresentation,
1633
1661
  }),
1634
1662
  };
1635
1663
  }
@@ -1645,6 +1673,7 @@ export async function main() {
1645
1673
  workspaces: buildPublicWorkspaceOptions(workspaceOptions),
1646
1674
  workspaceRoots: workspaceRootMetadata,
1647
1675
  executionModes: hostAvailableExecutionModes,
1676
+ presentation: runtimePresentation,
1648
1677
  }),
1649
1678
  };
1650
1679
  }
@@ -1848,6 +1877,27 @@ export async function main() {
1848
1877
  return client.updateMessageDisposition(conversationId, input.sourceMessageId, 'rejected').catch(() => { });
1849
1878
  }));
1850
1879
  }
1880
+ function removeQueuedInput(conversationId, sourceMessageId) {
1881
+ const session = sessions.get(conversationId);
1882
+ if (!session || session.pendingInputs.length === 0)
1883
+ return;
1884
+ const before = session.pendingInputs.length;
1885
+ session.pendingInputs = session.pendingInputs.filter((input) => input.sourceMessageId !== sourceMessageId);
1886
+ if (session.pendingInputs.length === before)
1887
+ return;
1888
+ runtimeState.writeTurnState(conversationId, {
1889
+ turnId: session.currentTurnId,
1890
+ state: session.turnState,
1891
+ queueDepth: session.pendingInputs.length,
1892
+ currentSpeakerId: agentId,
1893
+ lastAcceptedIntent: session.lastAcceptedIntent,
1894
+ capabilities: CLAUDE_RUNTIME_CAPABILITIES,
1895
+ ...(session.currentTurnOpenedAt ? { openedAt: session.currentTurnOpenedAt } : {}),
1896
+ ...(session.turnState === 'idle' || session.turnState === 'completed' || session.turnState === 'interrupted'
1897
+ ? { completedAt: { '.sv': 'timestamp' } }
1898
+ : {}),
1899
+ }).catch(() => { });
1900
+ }
1851
1901
  function evictOldestIdle() {
1852
1902
  let oldest = null;
1853
1903
  for (const s of sessions.values()) {
@@ -1927,6 +1977,7 @@ export async function main() {
1927
1977
  effort: config?.effort,
1928
1978
  availableModels: runtimeModels,
1929
1979
  availableExecutionModes: hostAvailableExecutionModes,
1980
+ runtimePresentation,
1930
1981
  approvalManager,
1931
1982
  canRequestApproval: () => canRequestCanonApproval(conversationId),
1932
1983
  runtimeId,
@@ -2246,6 +2297,9 @@ export async function main() {
2246
2297
  }
2247
2298
  })();
2248
2299
  },
2300
+ onMessageDeleted: (payload) => {
2301
+ removeQueuedInput(payload.conversationId, payload.messageId);
2302
+ },
2249
2303
  onConversationUpdated: (payload) => {
2250
2304
  handleConversationUpdated(payload);
2251
2305
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonmsg/claude-code-plugin",
3
- "version": "0.14.5",
3
+ "version": "0.14.7",
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.0",
35
- "@canonmsg/core": "^0.19.1",
34
+ "@canonmsg/agent-sdk": "^1.5.2",
35
+ "@canonmsg/core": "^0.19.3",
36
36
  "@modelcontextprotocol/sdk": "^1.12.0"
37
37
  },
38
38
  "engines": {