@canonmsg/claude-code-plugin 0.14.16 → 0.14.18

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
@@ -26,7 +26,7 @@ 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_EFFORT_OPTIONS, 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, createTurnOutputController, createRuntimeStatePublisher, createTypingStatusPublisher, 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, sendMessageWithRetry, loadHostSessionConfig, loadRuntimeSessionState, markLocalRuntimeStopped, releaseConversationEnvironment, saveRuntimeSessionState, clearRuntimeSessionState, publishHostAgentRuntime, publishHostSessionSnapshots, renderCanonHostInboundContent, resolveHostWorkspaceCwd, upsertLocalRuntimeEntry, } from '@canonmsg/core';
29
+ import { CLAUDE_EFFORT_OPTIONS, CLAUDE_PERMISSION_MODE_OPTIONS, RUNTIME_NEW_SESSION_ACTION, RUNTIME_STOP_ACTION, RUNTIME_STOP_AND_DROP_ACTION, buildCanonHostPrompt, buildCanonTurnEnvelopeV1, buildConfiguredWorkspaceOptionsWithRoots, buildConversationEnvironmentKey, buildFirstPartyCodingRuntimeDescriptor, buildHydratedInboundContext, diffCanonMemberIds, buildPlanApprovalRequest, buildQuestionRequest, buildPublicWorkspaceRoots, buildPublicWorkspaceOptions, buildRuntimePresentationPolicy, DEFAULT_FIRST_PARTY_RUNTIME_PRESENTATION, createConversationMetadataLoader, createTurnOutputController, createRuntimeStatePublisher, createTypingStatusPublisher, 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, sendMessageWithRetry, loadHostSessionConfig, loadRuntimeSessionState, markLocalRuntimeStopped, releaseConversationEnvironment, saveRuntimeSessionState, clearRuntimeSessionState, publishHostAgentRuntime, publishHostSessionSnapshots, renderCanonHostInboundContent, renderCanonTurnEnvelopePrompt, resolveCanonHostPromptMode, resolveHostWorkspaceCwd, upsertLocalRuntimeEntry, } from '@canonmsg/core';
30
30
  import { buildInboundContextLines, decideAutoReply, } from './inbound-policy.js';
31
31
  import { runCli } from './cli-entry.js';
32
32
  import { decideClaudeToolPermissionForMode, parseAllowedNonOwnerClaudeTools, } from './tool-policy.js';
@@ -535,16 +535,33 @@ const CLAUDE_RUNTIME_CAPABILITIES = {
535
535
  supportsRequiresAction: true,
536
536
  supportsNonFinalPermanentMessages: false,
537
537
  };
538
+ const HOST_PROMPT_MODE = resolveCanonHostPromptMode(process.env.CANON_HOST_PROMPT_MODE);
538
539
  function controlPollDelayMs(hasActiveWork) {
539
540
  const base = hasActiveWork ? CONTROL_POLL_MS : IDLE_CONTROL_POLL_MS;
540
541
  return base + Math.floor(Math.random() * CONTROL_POLL_JITTER_MS);
541
542
  }
542
543
  function buildCanonPrompt(input) {
543
544
  const { session, ...promptInput } = input;
545
+ const sessionContextLines = session ? buildClaudeSessionContextLines(session) : undefined;
546
+ if (HOST_PROMPT_MODE === 'envelope') {
547
+ return renderCanonTurnEnvelopePrompt(buildCanonTurnEnvelopeV1({
548
+ content: input.content,
549
+ conversationId: input.conversationId,
550
+ participantContext: input.participantContext,
551
+ behavior: input.behavior,
552
+ selfContexts: input.selfContexts,
553
+ activeSelfContextId: input.activeSelfContextId,
554
+ provenance: input.provenance,
555
+ replyContext: input.replyContext,
556
+ sessionContextLines,
557
+ message: input.message,
558
+ hydratedFromPage: input.hydratedFromPage,
559
+ }));
560
+ }
544
561
  return buildCanonHostPrompt({
545
562
  hostLabel: 'Claude Code',
546
563
  buildInboundContextLines,
547
- sessionContextLines: session ? buildClaudeSessionContextLines(session) : undefined,
564
+ sessionContextLines,
548
565
  ...promptInput,
549
566
  });
550
567
  }
@@ -2067,7 +2084,11 @@ export async function main() {
2067
2084
  participantContext,
2068
2085
  behavior,
2069
2086
  selfContexts,
2087
+ activeSelfContextId,
2088
+ provenance: hydrated.provenance,
2070
2089
  replyContext,
2090
+ message: m,
2091
+ hydratedFromPage: hydrated.hydratedFromPage,
2071
2092
  session,
2072
2093
  });
2073
2094
  const messageContent = await buildCanonUserContent({
@@ -2245,7 +2266,11 @@ export async function main() {
2245
2266
  participantContext,
2246
2267
  behavior,
2247
2268
  selfContexts,
2269
+ activeSelfContextId,
2270
+ provenance: hydrated.provenance,
2248
2271
  replyContext,
2272
+ message: m,
2273
+ hydratedFromPage: hydrated.hydratedFromPage,
2249
2274
  session,
2250
2275
  });
2251
2276
  const messageContent = await buildCanonUserContent({
@@ -6,7 +6,7 @@ export type McpParseResult<T> = {
6
6
  ok: false;
7
7
  error: string;
8
8
  };
9
- type ContentType = 'text' | 'image' | 'audio' | 'file';
9
+ type ContentType = 'text' | 'image' | 'audio' | 'video' | 'file';
10
10
  export interface ReplyArgs {
11
11
  conversationId: string;
12
12
  text: string;
@@ -18,6 +18,7 @@ export interface SendMessageArgs {
18
18
  contentType: ContentType;
19
19
  imageUrl?: string;
20
20
  audioUrl?: string;
21
+ videoUrl?: string;
21
22
  fileUrl?: string;
22
23
  mediaPath?: string;
23
24
  fileName?: string;
package/dist/mcp-args.js CHANGED
@@ -31,7 +31,7 @@ function optionalNumber(record, key) {
31
31
  function parseContentType(value) {
32
32
  if (value == null)
33
33
  return { ok: true, value: 'text' };
34
- if (value === 'text' || value === 'image' || value === 'audio' || value === 'file') {
34
+ if (value === 'text' || value === 'image' || value === 'audio' || value === 'video' || value === 'file') {
35
35
  return { ok: true, value };
36
36
  }
37
37
  return { ok: false, error: 'Invalid content_type' };
@@ -64,6 +64,7 @@ export function parseSendMessageArgs(value) {
64
64
  return contentType;
65
65
  const imageUrl = optionalString(value, 'image_url', 4096);
66
66
  const audioUrl = optionalString(value, 'audio_url', 4096);
67
+ const videoUrl = optionalString(value, 'video_url', 4096);
67
68
  const fileUrl = optionalString(value, 'file_url', 4096);
68
69
  const mediaPath = optionalString(value, 'media_path', 4096);
69
70
  const fileName = optionalString(value, 'file_name', 512);
@@ -77,6 +78,7 @@ export function parseSendMessageArgs(value) {
77
78
  contentType: contentType.value,
78
79
  ...(imageUrl ? { imageUrl } : {}),
79
80
  ...(audioUrl ? { audioUrl } : {}),
81
+ ...(videoUrl ? { videoUrl } : {}),
80
82
  ...(fileUrl ? { fileUrl } : {}),
81
83
  ...(mediaPath ? { mediaPath } : {}),
82
84
  ...(fileName ? { fileName } : {}),
package/dist/server.js CHANGED
@@ -84,7 +84,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
84
84
  },
85
85
  {
86
86
  name: 'send_message',
87
- description: 'Send a message to a Canon conversation (supports text, images, audio, files)',
87
+ description: 'Send a message to a Canon conversation (supports text, images, audio, video, files)',
88
88
  inputSchema: {
89
89
  type: 'object',
90
90
  properties: {
@@ -98,7 +98,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
98
98
  },
99
99
  content_type: {
100
100
  type: 'string',
101
- enum: ['text', 'image', 'audio', 'file'],
101
+ enum: ['text', 'image', 'audio', 'video', 'file'],
102
102
  description: 'Content type (default: text)',
103
103
  },
104
104
  image_url: {
@@ -109,13 +109,17 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
109
109
  type: 'string',
110
110
  description: 'Audio URL (when content_type is audio)',
111
111
  },
112
+ video_url: {
113
+ type: 'string',
114
+ description: 'Video URL (when content_type is video)',
115
+ },
112
116
  file_url: {
113
117
  type: 'string',
114
118
  description: 'File URL (when content_type is file)',
115
119
  },
116
120
  media_path: {
117
121
  type: 'string',
118
- description: 'Local image/audio/file path to upload and send',
122
+ description: 'Local image/audio/video/file path to upload and send',
119
123
  },
120
124
  file_name: {
121
125
  type: 'string',
@@ -244,7 +248,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
244
248
  const parsed = parseSendMessageArgs(args);
245
249
  if (!parsed.ok)
246
250
  return toolArgumentError(parsed.error);
247
- const { conversationId, text, contentType, imageUrl, audioUrl, fileUrl, mediaPath, fileName, mimeType, durationMs, } = parsed.value;
251
+ const { conversationId, text, contentType, imageUrl, audioUrl, videoUrl, fileUrl, mediaPath, fileName, mimeType, durationMs, } = parsed.value;
248
252
  const opts = {};
249
253
  const metadata = TURN_COMPLETE_METADATA;
250
254
  if (mediaPath) {
@@ -276,6 +280,15 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
276
280
  ...(mimeType ? { mimeType } : {}),
277
281
  }];
278
282
  }
283
+ else if (contentType === 'video' && videoUrl) {
284
+ opts.contentType = 'video';
285
+ opts.attachments = [{
286
+ kind: 'video',
287
+ url: videoUrl,
288
+ ...(mimeType ? { mimeType } : {}),
289
+ ...(durationMs != null ? { durationMs } : {}),
290
+ }];
291
+ }
279
292
  else if (contentType === 'file' || fileUrl) {
280
293
  opts.contentType = 'file';
281
294
  if (fileUrl) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonmsg/claude-code-plugin",
3
- "version": "0.14.16",
3
+ "version": "0.14.18",
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.141",
34
- "@canonmsg/agent-sdk": "^2.1.1",
35
- "@canonmsg/core": "^1.3.0",
34
+ "@canonmsg/agent-sdk": "^2.4.0",
35
+ "@canonmsg/core": "^1.7.0",
36
36
  "@modelcontextprotocol/sdk": "^1.29.0"
37
37
  },
38
38
  "engines": {