@canonmsg/claude-code-plugin 0.14.8 → 0.14.9
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 +19 -7
- package/package.json +3 -3
package/dist/host.js
CHANGED
|
@@ -687,6 +687,8 @@ async function buildCanonUserContent(input) {
|
|
|
687
687
|
// ── Session factory ─────────────────────────────────────────────────
|
|
688
688
|
function createSession(conversationId, environment, agentId, client, runtimeState, onSessionEnd, onRuntimeDescriptorUpdate, config, resumeSessionId) {
|
|
689
689
|
const { cwd } = environment;
|
|
690
|
+
const cardResponseUserId = config.ownerId ?? undefined;
|
|
691
|
+
const cardResponseUser = cardResponseUserId ? { responseUserId: cardResponseUserId } : undefined;
|
|
690
692
|
// Per-session input stream with message queue
|
|
691
693
|
let resolveInput = null;
|
|
692
694
|
let inputDone = false;
|
|
@@ -783,7 +785,7 @@ function createSession(conversationId, environment, agentId, client, runtimeStat
|
|
|
783
785
|
try {
|
|
784
786
|
const questionId = randomUUID();
|
|
785
787
|
const questions = input.questions ?? [];
|
|
786
|
-
const questionCard = buildQuestionRequest(questionId, questions);
|
|
788
|
+
const questionCard = buildQuestionRequest(questionId, questions, cardResponseUser);
|
|
787
789
|
await client.sendMessage(conversationId, questionCard.text, {
|
|
788
790
|
...(session.activeSelfContextId
|
|
789
791
|
? { selfContextId: session.activeSelfContextId }
|
|
@@ -828,9 +830,11 @@ function createSession(conversationId, environment, agentId, client, runtimeStat
|
|
|
828
830
|
: [];
|
|
829
831
|
const planApproval = buildPlanApprovalRequest(planId, 'Plan ready for review.', allowedPrompts.length > 0 ? {
|
|
830
832
|
summary: 'Claude has prepared a plan and is asking permission to continue.',
|
|
833
|
+
...(cardResponseUser ?? {}),
|
|
831
834
|
allowedPrompts,
|
|
832
835
|
} : {
|
|
833
836
|
summary: 'Claude has prepared a plan and is asking permission to continue.',
|
|
837
|
+
...(cardResponseUser ?? {}),
|
|
834
838
|
});
|
|
835
839
|
await client.sendMessage(conversationId, planApproval.text, {
|
|
836
840
|
...(session.activeSelfContextId
|
|
@@ -1494,6 +1498,11 @@ export async function main() {
|
|
|
1494
1498
|
// ── Canon API client + RTDB auth ──
|
|
1495
1499
|
const client = new CanonClient(apiKey, baseUrl);
|
|
1496
1500
|
initRTDBAuth(client);
|
|
1501
|
+
async function markQueuedMessageAcceptedForConversation(conversationId, sourceMessageId, markAccepted) {
|
|
1502
|
+
if (!markAccepted || !sourceMessageId)
|
|
1503
|
+
return;
|
|
1504
|
+
await client.updateMessageDisposition(conversationId, sourceMessageId, 'accepted_now').catch(() => { });
|
|
1505
|
+
}
|
|
1497
1506
|
let agentId;
|
|
1498
1507
|
let ownerId = null;
|
|
1499
1508
|
let ownerName = null;
|
|
@@ -1979,6 +1988,7 @@ export async function main() {
|
|
|
1979
1988
|
approvalManager,
|
|
1980
1989
|
canRequestApproval: () => canRequestCanonApproval(conversationId),
|
|
1981
1990
|
runtimeId,
|
|
1991
|
+
ownerId,
|
|
1982
1992
|
}, resumeId);
|
|
1983
1993
|
sessions.set(conversationId, session);
|
|
1984
1994
|
await Promise.all([
|
|
@@ -2065,6 +2075,9 @@ export async function main() {
|
|
|
2065
2075
|
return;
|
|
2066
2076
|
}
|
|
2067
2077
|
markGroupContextModeUsed(input.conversationId, participantContext.groupContextMode);
|
|
2078
|
+
const turnMetadata = normalizeTurnMetadata(m.metadata);
|
|
2079
|
+
const deliveryIntent = turnMetadata?.deliveryIntent ?? 'queue';
|
|
2080
|
+
const shouldMarkAccepted = turnMetadata?.inboundDisposition === 'queued';
|
|
2068
2081
|
let session;
|
|
2069
2082
|
try {
|
|
2070
2083
|
session = await getOrCreateSession(input.conversationId);
|
|
@@ -2073,6 +2086,7 @@ export async function main() {
|
|
|
2073
2086
|
const message = error instanceof Error ? error.message : String(error);
|
|
2074
2087
|
const userMessage = error instanceof ExecutionEnvironmentError ? error.userMessage : message;
|
|
2075
2088
|
console.error(`[canon-host] [${input.conversationId.slice(0, 8)}] Failed to create recovered session: ${message}`);
|
|
2089
|
+
await markQueuedMessageAcceptedForConversation(input.conversationId, m.id ?? null, shouldMarkAccepted);
|
|
2076
2090
|
await client.sendMessage(input.conversationId, `I couldn't start a coding session for this workspace: ${userMessage}`, {
|
|
2077
2091
|
...(activeSelfContextId ? { selfContextId: activeSelfContextId } : {}),
|
|
2078
2092
|
metadata: {
|
|
@@ -2083,10 +2097,7 @@ export async function main() {
|
|
|
2083
2097
|
}).catch(() => { });
|
|
2084
2098
|
return;
|
|
2085
2099
|
}
|
|
2086
|
-
const turnMetadata = normalizeTurnMetadata(m.metadata);
|
|
2087
2100
|
session.activeSelfContextId = activeSelfContextId;
|
|
2088
|
-
const deliveryIntent = turnMetadata?.deliveryIntent ?? 'queue';
|
|
2089
|
-
const shouldMarkAccepted = turnMetadata?.inboundDisposition === 'queued';
|
|
2090
2101
|
const promptText = buildCanonPrompt({
|
|
2091
2102
|
content,
|
|
2092
2103
|
conversationId: input.conversationId,
|
|
@@ -2243,6 +2254,9 @@ export async function main() {
|
|
|
2243
2254
|
}
|
|
2244
2255
|
markGroupContextModeUsed(convoId, participantContext.groupContextMode);
|
|
2245
2256
|
console.error(`[canon-host] [${convoId.slice(0, 8)}] Message from ${sender}: "${content.slice(0, 80)}" (${autoReply.reason})`);
|
|
2257
|
+
const turnMetadata = normalizeTurnMetadata(m.metadata);
|
|
2258
|
+
const deliveryIntent = turnMetadata?.deliveryIntent ?? 'queue';
|
|
2259
|
+
const shouldMarkAccepted = turnMetadata?.inboundDisposition === 'queued';
|
|
2246
2260
|
let session;
|
|
2247
2261
|
try {
|
|
2248
2262
|
session = await getOrCreateSession(convoId);
|
|
@@ -2251,6 +2265,7 @@ export async function main() {
|
|
|
2251
2265
|
const message = error instanceof Error ? error.message : String(error);
|
|
2252
2266
|
const userMessage = error instanceof ExecutionEnvironmentError ? error.userMessage : message;
|
|
2253
2267
|
console.error(`[canon-host] [${convoId.slice(0, 8)}] Failed to create session: ${message}`);
|
|
2268
|
+
await markQueuedMessageAcceptedForConversation(convoId, m.id ?? null, shouldMarkAccepted);
|
|
2254
2269
|
await client.sendMessage(convoId, `I couldn't start a coding session for this workspace: ${userMessage}`, {
|
|
2255
2270
|
...(activeSelfContextId ? { selfContextId: activeSelfContextId } : {}),
|
|
2256
2271
|
metadata: {
|
|
@@ -2261,10 +2276,7 @@ export async function main() {
|
|
|
2261
2276
|
}).catch(() => { });
|
|
2262
2277
|
return;
|
|
2263
2278
|
}
|
|
2264
|
-
const turnMetadata = normalizeTurnMetadata(m.metadata);
|
|
2265
2279
|
session.activeSelfContextId = activeSelfContextId;
|
|
2266
|
-
const deliveryIntent = turnMetadata?.deliveryIntent ?? 'queue';
|
|
2267
|
-
const shouldMarkAccepted = turnMetadata?.inboundDisposition === 'queued';
|
|
2268
2280
|
const promptText = buildCanonPrompt({
|
|
2269
2281
|
content,
|
|
2270
2282
|
conversationId: convoId,
|
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.9",
|
|
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.101",
|
|
34
|
-
"@canonmsg/agent-sdk": "^1.5.
|
|
35
|
-
"@canonmsg/core": "^0.
|
|
34
|
+
"@canonmsg/agent-sdk": "^1.5.5",
|
|
35
|
+
"@canonmsg/core": "^0.21.0",
|
|
36
36
|
"@modelcontextprotocol/sdk": "^1.12.0"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|