@canonmsg/claude-code-plugin 0.14.18 → 0.15.0

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 +14 -27
  2. package/package.json +4 -4
package/dist/host.js CHANGED
@@ -26,8 +26,8 @@ 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, 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
- import { buildInboundContextLines, decideAutoReply, } from './inbound-policy.js';
29
+ import { CLAUDE_EFFORT_OPTIONS, CLAUDE_PERMISSION_MODE_OPTIONS, RUNTIME_NEW_SESSION_ACTION, RUNTIME_STOP_ACTION, RUNTIME_STOP_AND_DROP_ACTION, buildCanonTurnContextV2, 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, renderCanonTurnBriefPrompt, resolveHostWorkspaceCwd, upsertLocalRuntimeEntry, } from '@canonmsg/core';
30
+ import { decideAutoReply, } from './inbound-policy.js';
31
31
  import { runCli } from './cli-entry.js';
32
32
  import { decideClaudeToolPermissionForMode, parseAllowedNonOwnerClaudeTools, } from './tool-policy.js';
33
33
  import { buildClaudeFinalMessageId, createClaudeInputEnvelope, formatClaudeControlError, mergeClaudeModelOptions, resetClaudeCompletedTurnState, shouldDeliverClaudeFinal, } from './session-state.js';
@@ -535,35 +535,24 @@ 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);
539
538
  function controlPollDelayMs(hasActiveWork) {
540
539
  const base = hasActiveWork ? CONTROL_POLL_MS : IDLE_CONTROL_POLL_MS;
541
540
  return base + Math.floor(Math.random() * CONTROL_POLL_JITTER_MS);
542
541
  }
543
542
  function buildCanonPrompt(input) {
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
- }
561
- return buildCanonHostPrompt({
562
- hostLabel: 'Claude Code',
563
- buildInboundContextLines,
543
+ const sessionContextLines = input.session ? buildClaudeSessionContextLines(input.session) : undefined;
544
+ return renderCanonTurnBriefPrompt(buildCanonTurnContextV2({
545
+ content: input.content,
546
+ conversationId: input.conversationId,
547
+ participantContext: input.participantContext,
548
+ behavior: input.behavior,
549
+ selfContexts: input.selfContexts,
550
+ activeSelfContextId: input.activeSelfContextId,
551
+ provenance: input.provenance,
552
+ replyContext: input.replyContext,
564
553
  sessionContextLines,
565
- ...promptInput,
566
- });
554
+ message: input.message,
555
+ }));
567
556
  }
568
557
  function optionLabel(value, options) {
569
558
  if (!value)
@@ -2088,7 +2077,6 @@ export async function main() {
2088
2077
  provenance: hydrated.provenance,
2089
2078
  replyContext,
2090
2079
  message: m,
2091
- hydratedFromPage: hydrated.hydratedFromPage,
2092
2080
  session,
2093
2081
  });
2094
2082
  const messageContent = await buildCanonUserContent({
@@ -2270,7 +2258,6 @@ export async function main() {
2270
2258
  provenance: hydrated.provenance,
2271
2259
  replyContext,
2272
2260
  message: m,
2273
- hydratedFromPage: hydrated.hydratedFromPage,
2274
2261
  session,
2275
2262
  });
2276
2263
  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.18",
3
+ "version": "0.15.0",
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.4.0",
35
- "@canonmsg/core": "^1.7.0",
34
+ "@canonmsg/agent-sdk": "^3.0.0",
35
+ "@canonmsg/core": "^2.0.0",
36
36
  "@modelcontextprotocol/sdk": "^1.29.0"
37
37
  },
38
38
  "engines": {
@@ -58,7 +58,7 @@
58
58
  "devDependencies": {
59
59
  "@types/node": "^22.0.0",
60
60
  "typescript": "~5.7.0",
61
- "vitest": "^3.0.0"
61
+ "vitest": "^4.1.8"
62
62
  },
63
63
  "license": "MIT"
64
64
  }