@canonmsg/codex-plugin 0.13.3 → 0.14.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 +13 -23
  2. package/package.json +4 -4
package/dist/host.js CHANGED
@@ -5,8 +5,8 @@ import { spawnSync } from 'node:child_process';
5
5
  import { dirname } from 'node:path';
6
6
  import { parseArgs } from 'node:util';
7
7
  import { getCodexImagePath, materializeMessageMedia, materializeReplyContextMedia, } from '@canonmsg/agent-sdk';
8
- import { RUNTIME_NEW_SESSION_ACTION, RUNTIME_STOP_ACTION, RUNTIME_STOP_AND_DROP_ACTION, buildRuntimeCardOutcome, buildPlanApprovalRequest, buildCanonHostPrompt, buildCanonTurnEnvelopeV1, buildConfiguredWorkspaceOptionsWithRoots, buildFirstPartyCodingRuntimeDescriptor, buildHydratedInboundContext, diffCanonMemberIds, buildPublicWorkspaceRoots, buildPublicWorkspaceOptions, buildRuntimePresentationPolicy, DEFAULT_FIRST_PARTY_RUNTIME_PRESENTATION, createConversationMetadataLoader, createRuntimeStatePublisher, createTypingStatusPublisher, EXECUTION_ENVIRONMENT_MODES, ExecutionEnvironmentError, CanonClient, CanonStream, DEFAULT_PARTICIPATION_HISTORY_FETCH_LIMIT, DEFAULT_RUNTIME_CAPABILITIES, FINAL_MESSAGE_HANDOFF_MS, getActiveProfileLock, initRTDBAuth, buildLocalRuntimeId, heartbeatLocalRuntimeEntry, loadRuntimeSessionState, markLocalRuntimeStopped, normalizeTurnMetadata, parseRuntimeCardV1, prepareConversationEnvironment, loadHostSessionConfig, releaseConversationEnvironment, resolveCanonAgent, rtdbRead, rtdbWrite, CanonApiError, sendMessageWithRetry, sendMessageWithRetryChunked, shouldTriggerAgentTurn, saveRuntimeSessionState, buildBoundedTurnTrail, publishHostAgentRuntime, publishHostSessionSnapshots, renderCanonHostInboundContent, renderCanonTurnEnvelopePrompt, resolveCanonHostPromptMode, resolveHostWorkspaceCwd, upsertLocalRuntimeEntry, } from '@canonmsg/core';
9
- import { buildInboundContextLines, decideAutoReply, } from './inbound-policy.js';
8
+ import { RUNTIME_NEW_SESSION_ACTION, RUNTIME_STOP_ACTION, RUNTIME_STOP_AND_DROP_ACTION, buildRuntimeCardOutcome, buildPlanApprovalRequest, buildCanonTurnContextV2, buildConfiguredWorkspaceOptionsWithRoots, buildFirstPartyCodingRuntimeDescriptor, buildHydratedInboundContext, diffCanonMemberIds, buildPublicWorkspaceRoots, buildPublicWorkspaceOptions, buildRuntimePresentationPolicy, DEFAULT_FIRST_PARTY_RUNTIME_PRESENTATION, createConversationMetadataLoader, createRuntimeStatePublisher, createTypingStatusPublisher, EXECUTION_ENVIRONMENT_MODES, ExecutionEnvironmentError, CanonClient, CanonStream, DEFAULT_PARTICIPATION_HISTORY_FETCH_LIMIT, DEFAULT_RUNTIME_CAPABILITIES, FINAL_MESSAGE_HANDOFF_MS, getActiveProfileLock, initRTDBAuth, buildLocalRuntimeId, heartbeatLocalRuntimeEntry, loadRuntimeSessionState, markLocalRuntimeStopped, normalizeTurnMetadata, parseRuntimeCardV1, prepareConversationEnvironment, loadHostSessionConfig, releaseConversationEnvironment, resolveCanonAgent, rtdbRead, rtdbWrite, CanonApiError, sendMessageWithRetry, sendMessageWithRetryChunked, shouldTriggerAgentTurn, saveRuntimeSessionState, buildBoundedTurnTrail, publishHostAgentRuntime, publishHostSessionSnapshots, renderCanonHostInboundContent, renderCanonTurnBriefPrompt, resolveHostWorkspaceCwd, upsertLocalRuntimeEntry, } from '@canonmsg/core';
9
+ import { decideAutoReply, } from './inbound-policy.js';
10
10
  import { CodexConversationAdapter, } from './adapter.js';
11
11
  import { CodexAppServerAdapter } from './app-server-adapter.js';
12
12
  import { mapCanonApprovalResultToCodexDecision, mapCodexAppServerApprovalRequest, } from './app-server-approval.js';
@@ -50,7 +50,6 @@ Keep this terminal open while you want Canon to reach the agent. Closing it,
50
50
  logging out, rebooting, or sleeping long enough to stop the process takes the
51
51
  local agent offline until you revive it. Docs:
52
52
  https://canonmail.com/agents/integrations`;
53
- const HOST_PROMPT_MODE = resolveCanonHostPromptMode(process.env.CANON_HOST_PROMPT_MODE);
54
53
  const MAX_SESSIONS = 12;
55
54
  const IDLE_TIMEOUT_MS = 30 * 60 * 1000;
56
55
  const HEARTBEAT_MS = 30_000;
@@ -229,25 +228,17 @@ function resolveCodexEffectiveRuntimePolicy(input) {
229
228
  };
230
229
  }
231
230
  function buildCanonPrompt(input) {
232
- if (HOST_PROMPT_MODE === 'envelope') {
233
- return renderCanonTurnEnvelopePrompt(buildCanonTurnEnvelopeV1({
234
- content: input.content,
235
- conversationId: input.conversationId,
236
- participantContext: input.participantContext,
237
- behavior: input.behavior,
238
- selfContexts: input.selfContexts,
239
- activeSelfContextId: input.activeSelfContextId,
240
- provenance: input.provenance,
241
- replyContext: input.replyContext,
242
- message: input.message,
243
- hydratedFromPage: input.hydratedFromPage,
244
- }));
245
- }
246
- return buildCanonHostPrompt({
247
- hostLabel: 'Codex',
248
- buildInboundContextLines,
249
- ...input,
250
- });
231
+ return renderCanonTurnBriefPrompt(buildCanonTurnContextV2({
232
+ content: input.content,
233
+ conversationId: input.conversationId,
234
+ participantContext: input.participantContext,
235
+ behavior: input.behavior,
236
+ selfContexts: input.selfContexts,
237
+ activeSelfContextId: input.activeSelfContextId,
238
+ provenance: input.provenance,
239
+ replyContext: input.replyContext,
240
+ message: input.message,
241
+ }));
251
242
  }
252
243
  function renderInboundContent(message, materialized) {
253
244
  return renderCanonHostInboundContent(message, materialized);
@@ -1252,7 +1243,6 @@ export async function main() {
1252
1243
  provenance: hydrated.provenance,
1253
1244
  replyContext,
1254
1245
  message: input.message,
1255
- hydratedFromPage: hydrated.hydratedFromPage,
1256
1246
  });
1257
1247
  if (session.running && deliveryIntent === 'interrupt') {
1258
1248
  enqueuePrompt(session, prompt, deliveryIntent, true, input.message.id, shouldMarkAccepted, imagePaths, mediaAddDirs, planCommand.planMode);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonmsg/codex-plugin",
3
- "version": "0.13.3",
3
+ "version": "0.14.0",
4
4
  "description": "Canon host integration for Codex CLI",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -29,8 +29,8 @@
29
29
  "prepack": "npm run build"
30
30
  },
31
31
  "dependencies": {
32
- "@canonmsg/agent-sdk": "^2.4.0",
33
- "@canonmsg/core": "^1.7.0"
32
+ "@canonmsg/agent-sdk": "^3.0.0",
33
+ "@canonmsg/core": "^2.0.0"
34
34
  },
35
35
  "engines": {
36
36
  "node": ">=18.0.0"
@@ -54,7 +54,7 @@
54
54
  "devDependencies": {
55
55
  "@types/node": "^22.0.0",
56
56
  "typescript": "~5.7.0",
57
- "vitest": "^3.0.0"
57
+ "vitest": "^4.1.8"
58
58
  },
59
59
  "license": "MIT"
60
60
  }