@canonmsg/claude-code-plugin 0.32.0 → 0.34.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.
- package/.claude-plugin/plugin.json +1 -1
- package/dist/agent-context-state.d.ts +15 -0
- package/dist/agent-context-state.js +35 -0
- package/dist/canon-user-content.d.ts +3 -3
- package/dist/canon-user-content.js +4 -4
- package/dist/communication-policy.d.ts +2 -0
- package/dist/communication-policy.js +4 -0
- package/dist/host.d.ts +2 -2
- package/dist/host.js +128 -259
- package/dist/inbound-reply-authority.d.ts +42 -0
- package/dist/inbound-reply-authority.js +107 -0
- package/dist/mcp-args.d.ts +3 -0
- package/dist/mcp-args.js +12 -0
- package/dist/register.js +2 -1
- package/dist/server.js +253 -144
- package/dist/session-state.d.ts +6 -46
- package/dist/session-state.js +1 -74
- package/dist/tool-policy.js +2 -7
- package/package.json +6 -6
package/dist/session-state.js
CHANGED
|
@@ -28,9 +28,7 @@ export function createClaudeInputEnvelope(input) {
|
|
|
28
28
|
requestingUserId: input.kind === 'canon' && input.requestingUserId
|
|
29
29
|
? input.requestingUserId
|
|
30
30
|
: null,
|
|
31
|
-
|
|
32
|
-
? { replyContactTarget: input.replyContactTarget }
|
|
33
|
-
: {}),
|
|
31
|
+
replyAuthority: input.kind === 'canon' ? input.replyAuthority ?? null : null,
|
|
34
32
|
turnKey: input.kind === 'canon' && sourceMessageId
|
|
35
33
|
? `canon:${sourceMessageId}`
|
|
36
34
|
: `${input.kind}:${fallbackId}`,
|
|
@@ -1316,74 +1314,3 @@ export async function confirmClaudeInterrupt(input) {
|
|
|
1316
1314
|
return 'defer';
|
|
1317
1315
|
}
|
|
1318
1316
|
}
|
|
1319
|
-
/**
|
|
1320
|
-
* Apply a session-control request to the live Claude session. Mirrors the host's
|
|
1321
|
-
* control semantics (validation, only-if-different checks, error recording,
|
|
1322
|
-
* clear-on-success). Whenever a live op is invoked — on success OR caught
|
|
1323
|
-
* failure — publishSnapshot() is called exactly once so the app-subscribed
|
|
1324
|
-
* /agent-session snapshot converges immediately instead of waiting for the next
|
|
1325
|
-
* heartbeat. If nothing changed, publishSnapshot() is not called.
|
|
1326
|
-
*/
|
|
1327
|
-
export async function applyClaudeSessionControl(control, deps) {
|
|
1328
|
-
const { state } = deps;
|
|
1329
|
-
let liveOpInvoked = false;
|
|
1330
|
-
if (control.model && control.model !== state.model) {
|
|
1331
|
-
liveOpInvoked = true;
|
|
1332
|
-
try {
|
|
1333
|
-
await deps.setModel(control.model);
|
|
1334
|
-
state.model = control.model;
|
|
1335
|
-
deps.clearRuntimeControlError('model');
|
|
1336
|
-
}
|
|
1337
|
-
catch (err) {
|
|
1338
|
-
deps.setRuntimeControlError('model', control.model, err);
|
|
1339
|
-
}
|
|
1340
|
-
}
|
|
1341
|
-
const nextPermissionMode = deps.parsePermissionMode(control.permissionMode);
|
|
1342
|
-
if (control.permissionMode && !nextPermissionMode) {
|
|
1343
|
-
deps.setRuntimeControlError('permissionMode', control.permissionMode, new Error(`Unsupported Claude permission mode: ${control.permissionMode}`));
|
|
1344
|
-
}
|
|
1345
|
-
else if (nextPermissionMode && nextPermissionMode !== state.permissionMode) {
|
|
1346
|
-
liveOpInvoked = true;
|
|
1347
|
-
try {
|
|
1348
|
-
await deps.setPermissionMode(nextPermissionMode);
|
|
1349
|
-
state.permissionMode = nextPermissionMode;
|
|
1350
|
-
deps.clearRuntimeControlError('permissionMode');
|
|
1351
|
-
}
|
|
1352
|
-
catch (err) {
|
|
1353
|
-
deps.setRuntimeControlError('permissionMode', nextPermissionMode, err);
|
|
1354
|
-
}
|
|
1355
|
-
}
|
|
1356
|
-
const nextEffort = deps.normalizeEffort(control.effort);
|
|
1357
|
-
if (nextEffort && nextEffort !== state.effort) {
|
|
1358
|
-
liveOpInvoked = true;
|
|
1359
|
-
try {
|
|
1360
|
-
await deps.applyEffort(nextEffort);
|
|
1361
|
-
state.effort = nextEffort;
|
|
1362
|
-
deps.clearRuntimeControlError('effort');
|
|
1363
|
-
}
|
|
1364
|
-
catch (err) {
|
|
1365
|
-
deps.setRuntimeControlError('effort', nextEffort, err);
|
|
1366
|
-
}
|
|
1367
|
-
}
|
|
1368
|
-
else if (control.effort && !nextEffort) {
|
|
1369
|
-
deps.setRuntimeControlError('effort', String(control.effort), new Error('Unsupported Claude thinking level.'));
|
|
1370
|
-
}
|
|
1371
|
-
const nextUltracode = deps.parseUltracode(control.ultracode);
|
|
1372
|
-
if (control.ultracode && !nextUltracode) {
|
|
1373
|
-
deps.setRuntimeControlError('ultracode', String(control.ultracode), new Error('Unsupported Claude ultracode mode.'));
|
|
1374
|
-
}
|
|
1375
|
-
else if (nextUltracode && nextUltracode !== state.ultracode) {
|
|
1376
|
-
liveOpInvoked = true;
|
|
1377
|
-
try {
|
|
1378
|
-
await deps.applyUltracode(nextUltracode === 'on');
|
|
1379
|
-
state.ultracode = nextUltracode;
|
|
1380
|
-
deps.clearRuntimeControlError('ultracode');
|
|
1381
|
-
}
|
|
1382
|
-
catch (err) {
|
|
1383
|
-
deps.setRuntimeControlError('ultracode', nextUltracode, err);
|
|
1384
|
-
}
|
|
1385
|
-
}
|
|
1386
|
-
if (liveOpInvoked) {
|
|
1387
|
-
deps.publishSnapshot();
|
|
1388
|
-
}
|
|
1389
|
-
}
|
package/dist/tool-policy.js
CHANGED
|
@@ -37,13 +37,9 @@ function normalizeToolName(toolName) {
|
|
|
37
37
|
function isCanonOutboundTool(normalizedToolName) {
|
|
38
38
|
return normalizedToolName.endsWith('__reply')
|
|
39
39
|
|| normalizedToolName.endsWith('__send_message')
|
|
40
|
-
|| normalizedToolName.endsWith('__send_contextual_message')
|
|
41
|
-
|| normalizedToolName.endsWith('__send_to')
|
|
42
40
|
|| normalizedToolName.endsWith('__share_contact')
|
|
43
41
|
|| normalizedToolName === 'reply'
|
|
44
42
|
|| normalizedToolName === 'send_message'
|
|
45
|
-
|| normalizedToolName === 'send_contextual_message'
|
|
46
|
-
|| normalizedToolName === 'send_to'
|
|
47
43
|
|| normalizedToolName === 'share_contact';
|
|
48
44
|
}
|
|
49
45
|
/**
|
|
@@ -61,7 +57,6 @@ const CANON_HITL_OR_READ_VERBS = new Set([
|
|
|
61
57
|
'send_card',
|
|
62
58
|
'request_card',
|
|
63
59
|
'list_contacts',
|
|
64
|
-
'list_contact_requests',
|
|
65
60
|
'list_conversations',
|
|
66
61
|
// Staying quiet posts nothing; an approval card asking permission for
|
|
67
62
|
// silence would gate a no-op behind a human decision.
|
|
@@ -79,7 +74,7 @@ const CANON_INTERACTION_LIFECYCLE_VERBS = new Set([
|
|
|
79
74
|
* Verbs a NON-owner conversation member may trigger: same-conversation HITL
|
|
80
75
|
* and display surfaces, whose responder routing and owner-only escalation
|
|
81
76
|
* (secret/sudo, session rules) are enforced server-side. Cross-conversation
|
|
82
|
-
* verbs (
|
|
77
|
+
* cross-conversation verbs (share_contact) and the reads (contacts, conversation
|
|
83
78
|
* lists — they expose the agent's other relationships to this conversation)
|
|
84
79
|
* stay owner-only until the provenance trigger-token primitive lands.
|
|
85
80
|
*/
|
|
@@ -257,7 +252,7 @@ export async function decideClaudeToolPermissionForMode(input) {
|
|
|
257
252
|
}
|
|
258
253
|
// HITL + read verbs are allowed without an approval card: the HITL verbs
|
|
259
254
|
// themselves render the human-facing card (recursion otherwise), and the
|
|
260
|
-
// reads are side-effect free. Outbound verbs (
|
|
255
|
+
// reads are side-effect free. Outbound verbs (share_contact)
|
|
261
256
|
// fall through to the mode policy — in native-approval mode they gate
|
|
262
257
|
// like any other side effect; in default mode owner turns allow.
|
|
263
258
|
if (CANON_HITL_OR_READ_VERBS.has(canonVerb) && !input.ruleForcedAsk) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonmsg/claude-code-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.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,11 +31,11 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@anthropic-ai/claude-agent-sdk": "0.3.228",
|
|
34
|
-
"@canonmsg/agent-sdk": "^
|
|
35
|
-
"@canonmsg/agent-tools": "^0.
|
|
36
|
-
"@canonmsg/coding-agent-host": "^0.
|
|
37
|
-
"@canonmsg/core": "^
|
|
38
|
-
"@canonmsg/rich-cards": "^0.10.
|
|
34
|
+
"@canonmsg/agent-sdk": "^10.0.0",
|
|
35
|
+
"@canonmsg/agent-tools": "^0.8.0",
|
|
36
|
+
"@canonmsg/coding-agent-host": "^0.7.0",
|
|
37
|
+
"@canonmsg/core": "^12.0.0",
|
|
38
|
+
"@canonmsg/rich-cards": "^0.10.4",
|
|
39
39
|
"@modelcontextprotocol/sdk": "^1.30.0"
|
|
40
40
|
},
|
|
41
41
|
"engines": {
|