@canonmsg/claude-code-plugin 0.14.14 → 0.14.15
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 +11 -14
- package/package.json +2 -2
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_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, 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_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, 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 { runCli } from './cli-entry.js';
|
|
32
32
|
import { decideClaudeToolPermissionForMode, parseAllowedNonOwnerClaudeTools, } from './tool-policy.js';
|
|
@@ -167,11 +167,7 @@ function buildClaudeRuntimeDescriptor(input) {
|
|
|
167
167
|
label: 'Level',
|
|
168
168
|
kind: 'enum',
|
|
169
169
|
required: true,
|
|
170
|
-
choices: [
|
|
171
|
-
{ value: 'low', label: 'Low' },
|
|
172
|
-
{ value: 'medium', label: 'Medium' },
|
|
173
|
-
{ value: 'high', label: 'High' },
|
|
174
|
-
],
|
|
170
|
+
choices: [...CLAUDE_EFFORT_OPTIONS],
|
|
175
171
|
}],
|
|
176
172
|
dispatch: {
|
|
177
173
|
kind: 'control',
|
|
@@ -199,6 +195,7 @@ function buildClaudeRuntimeDescriptor(input) {
|
|
|
199
195
|
commands,
|
|
200
196
|
});
|
|
201
197
|
}
|
|
198
|
+
const CLAUDE_EFFORT_VALUES = new Set(CLAUDE_EFFORT_OPTIONS.map((option) => option.value));
|
|
202
199
|
function parseClaudePermissionMode(value) {
|
|
203
200
|
if (value === 'acceptEdits'
|
|
204
201
|
|| value === 'auto'
|
|
@@ -211,10 +208,13 @@ function parseClaudePermissionMode(value) {
|
|
|
211
208
|
return null;
|
|
212
209
|
}
|
|
213
210
|
function normalizeClaudeEffortLevel(value) {
|
|
214
|
-
return
|
|
211
|
+
return typeof value === 'string' && CLAUDE_EFFORT_VALUES.has(value)
|
|
215
212
|
? value
|
|
216
213
|
: undefined;
|
|
217
214
|
}
|
|
215
|
+
async function applyClaudeEffortLevel(q, effort) {
|
|
216
|
+
await q.applyFlagSettings({ effortLevel: effort });
|
|
217
|
+
}
|
|
218
218
|
let cachedClaudeCliPath;
|
|
219
219
|
// The SDK bundles a Bun-compiled `claude` Mach-O binary next to
|
|
220
220
|
// claude-agent-sdk-darwin-arm64. On some macOS setups that exact binary gets
|
|
@@ -550,11 +550,7 @@ function optionLabel(value, options) {
|
|
|
550
550
|
function buildClaudeSessionContextLines(session) {
|
|
551
551
|
const workspace = workspaceOptions.find((option) => option.cwd === session.environment.baseCwd);
|
|
552
552
|
const permissionMode = optionLabel(session.state.permissionMode, CLAUDE_PERMISSION_MODE_OPTIONS);
|
|
553
|
-
const effort = optionLabel(session.state.effort,
|
|
554
|
-
{ value: 'low', label: 'Low' },
|
|
555
|
-
{ value: 'medium', label: 'Medium' },
|
|
556
|
-
{ value: 'high', label: 'High' },
|
|
557
|
-
]);
|
|
553
|
+
const effort = optionLabel(session.state.effort, CLAUDE_EFFORT_OPTIONS);
|
|
558
554
|
const model = optionLabel(session.state.model, session.availableModels);
|
|
559
555
|
return [
|
|
560
556
|
model ? `Selected model: ${model}` : null,
|
|
@@ -692,6 +688,7 @@ function createSession(conversationId, environment, agentId, client, runtimeStat
|
|
|
692
688
|
cwd,
|
|
693
689
|
includePartialMessages: true,
|
|
694
690
|
maxTurns: 200,
|
|
691
|
+
...(config.effort ? { effort: config.effort } : {}),
|
|
695
692
|
settings: { forceLoginMethod: 'claudeai' },
|
|
696
693
|
settingSources: ['project', 'local'],
|
|
697
694
|
...(claudeCliPath ? { pathToClaudeCodeExecutable: claudeCliPath } : {}),
|
|
@@ -1345,7 +1342,7 @@ function createSession(conversationId, environment, agentId, client, runtimeStat
|
|
|
1345
1342
|
}
|
|
1346
1343
|
if (config.effort) {
|
|
1347
1344
|
try {
|
|
1348
|
-
await q
|
|
1345
|
+
await applyClaudeEffortLevel(q, config.effort);
|
|
1349
1346
|
session.state.effort = config.effort;
|
|
1350
1347
|
}
|
|
1351
1348
|
catch (err) {
|
|
@@ -2317,7 +2314,7 @@ export async function main() {
|
|
|
2317
2314
|
const nextEffort = normalizeClaudeEffortLevel(ctrl.effort);
|
|
2318
2315
|
if (nextEffort && nextEffort !== session.state.effort) {
|
|
2319
2316
|
try {
|
|
2320
|
-
await session.query
|
|
2317
|
+
await applyClaudeEffortLevel(session.query, nextEffort);
|
|
2321
2318
|
session.state.effort = nextEffort;
|
|
2322
2319
|
session.clearRuntimeControlError('effort');
|
|
2323
2320
|
console.error(`[canon-host] [${convoId.slice(0, 8)}] Effort → ${nextEffort}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonmsg/claude-code-plugin",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.15",
|
|
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",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@anthropic-ai/claude-agent-sdk": "^0.2.141",
|
|
34
34
|
"@canonmsg/agent-sdk": "^2.0.0",
|
|
35
|
-
"@canonmsg/core": "^1.
|
|
35
|
+
"@canonmsg/core": "^1.1.0",
|
|
36
36
|
"@modelcontextprotocol/sdk": "^1.29.0"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|