@canonmsg/claude-code-plugin 0.14.17 → 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.
Files changed (2) hide show
  1. package/dist/host.js +27 -2
  2. package/package.json +3 -3
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({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonmsg/claude-code-plugin",
3
- "version": "0.14.17",
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.3.0",
35
- "@canonmsg/core": "^1.6.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": {