@canonmsg/codex-plugin 0.11.5 → 0.11.7

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 +40 -1
  2. package/package.json +3 -3
package/dist/host.js CHANGED
@@ -4,7 +4,7 @@ import { randomUUID } from 'node:crypto';
4
4
  import { dirname } from 'node:path';
5
5
  import { parseArgs } from 'node:util';
6
6
  import { getCodexImagePath, materializeMessageMedia, materializeReplyContextMedia, } from '@canonmsg/agent-sdk';
7
- import { RUNTIME_NEW_SESSION_ACTION, RUNTIME_STOP_ACTION, RUNTIME_STOP_AND_DROP_ACTION, buildCanonHostPrompt, buildConfiguredWorkspaceOptionsWithRoots, buildFirstPartyCodingRuntimeDescriptor, buildHydratedInboundContext, diffCanonMemberIds, buildPublicWorkspaceRoots, buildPublicWorkspaceOptions, createConversationMetadataLoader, createRuntimeStatePublisher, 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, normalizeTurnState, prepareConversationEnvironment, loadHostSessionConfig, releaseConversationEnvironment, resolveCanonAgent, rtdbRead, rtdbWrite, shouldTriggerAgentTurn, saveRuntimeSessionState, publishHostAgentRuntime, publishHostSessionSnapshots, renderCanonHostInboundContent, resolveHostWorkspaceCwd, upsertLocalRuntimeEntry, } from '@canonmsg/core';
7
+ import { RUNTIME_NEW_SESSION_ACTION, RUNTIME_STOP_ACTION, RUNTIME_STOP_AND_DROP_ACTION, buildCanonHostPrompt, buildConfiguredWorkspaceOptionsWithRoots, buildFirstPartyCodingRuntimeDescriptor, buildHydratedInboundContext, diffCanonMemberIds, buildPublicWorkspaceRoots, buildPublicWorkspaceOptions, buildRuntimePresentationPolicy, DEFAULT_FIRST_PARTY_RUNTIME_PRESENTATION, createConversationMetadataLoader, createRuntimeStatePublisher, 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, normalizeTurnState, prepareConversationEnvironment, loadHostSessionConfig, releaseConversationEnvironment, resolveCanonAgent, rtdbRead, rtdbWrite, shouldTriggerAgentTurn, saveRuntimeSessionState, publishHostAgentRuntime, publishHostSessionSnapshots, renderCanonHostInboundContent, resolveHostWorkspaceCwd, upsertLocalRuntimeEntry, } from '@canonmsg/core';
8
8
  import { buildInboundContextLines, decideAutoReply, } from './inbound-policy.js';
9
9
  import { CodexConversationAdapter, } from './adapter.js';
10
10
  import { clearStoredThreadId, buildCodexThreadPolicyFingerprint, loadStoredThreadId, saveStoredThreadId, } from './session-store.js';
@@ -27,6 +27,10 @@ COMMON FLAGS
27
27
  --full-auto Allow non-interactive write access
28
28
  --codex-bin <path> Codex CLI binary to run
29
29
  --config <key=value> Forward config to Codex CLI
30
+ --runtime-visibility <normal|minimal|full>
31
+ Detail visibility preset
32
+ --show-runtime-detail <field> Override a hidden detail field
33
+ --hide-runtime-detail <field> Hide a runtime detail field
30
34
  --help, -h Show this help
31
35
  --version, -V Show package version
32
36
 
@@ -50,6 +54,7 @@ const CONTROL_POLL_MS = 2_000;
50
54
  const CODEX_RUNTIME_CAPABILITIES = {
51
55
  ...DEFAULT_RUNTIME_CAPABILITIES,
52
56
  supportsInterrupt: true,
57
+ supportsInputInterrupt: true,
53
58
  supportsQueue: true,
54
59
  supportsNonFinalPermanentMessages: false,
55
60
  };
@@ -83,6 +88,7 @@ function buildCodexRuntimeDescriptor(input) {
83
88
  executionModes: input.executionModes,
84
89
  permissionModes: input.permissionModes,
85
90
  defaultPermissionMode: input.defaultPermissionMode,
91
+ presentation: input.presentation,
86
92
  streamingTextMode: 'snapshot',
87
93
  commands,
88
94
  actions: [
@@ -230,6 +236,14 @@ function sleep(ms) {
230
236
  function uniqueStrings(values) {
231
237
  return Array.from(new Set(values.filter((value) => value.trim().length > 0)));
232
238
  }
239
+ function parseRuntimeVisibilityPreset(value) {
240
+ return value === 'normal' || value === 'minimal' || value === 'full' ? value : undefined;
241
+ }
242
+ function stringArgs(value) {
243
+ return Array.isArray(value)
244
+ ? value.filter((item) => typeof item === 'string' && item.trim().length > 0)
245
+ : undefined;
246
+ }
233
247
  export async function main() {
234
248
  setDefaultResultOrder('ipv4first');
235
249
  const { values: args } = parseArgs({
@@ -244,6 +258,9 @@ export async function main() {
244
258
  'workspace-root': { type: 'string', multiple: true },
245
259
  config: { type: 'string', multiple: true },
246
260
  'codex-bin': { type: 'string' },
261
+ 'runtime-visibility': { type: 'string' },
262
+ 'show-runtime-detail': { type: 'string', multiple: true },
263
+ 'hide-runtime-detail': { type: 'string', multiple: true },
247
264
  'full-auto': { type: 'boolean' },
248
265
  'dangerously-bypass-approvals-and-sandbox': { type: 'boolean' },
249
266
  },
@@ -480,6 +497,16 @@ export async function main() {
480
497
  return client.updateMessageDisposition(conversationId, prompt.sourceMessageId, 'rejected').catch(() => { });
481
498
  }));
482
499
  }
500
+ function removeQueuedPrompt(conversationId, sourceMessageId) {
501
+ const session = sessions.get(conversationId);
502
+ if (!session || session.queue.length === 0)
503
+ return;
504
+ const before = session.queue.length;
505
+ session.queue = session.queue.filter((prompt) => prompt.sourceMessageId !== sourceMessageId);
506
+ if (session.queue.length !== before) {
507
+ writeTurn(session);
508
+ }
509
+ }
483
510
  function clearStreaming(conversationId) {
484
511
  runtimeState.clearStreaming(conversationId).catch(() => { });
485
512
  }
@@ -939,6 +966,12 @@ export async function main() {
939
966
  ];
940
967
  const codexPermissionEnvelope = deriveCodexPermissionEnvelope(args);
941
968
  const codexModelOptions = buildCodexModelOptions(args.model);
969
+ const runtimePresentation = buildRuntimePresentationPolicy({
970
+ base: DEFAULT_FIRST_PARTY_RUNTIME_PRESENTATION,
971
+ preset: parseRuntimeVisibilityPreset(args['runtime-visibility']),
972
+ show: stringArgs(args['show-runtime-detail']),
973
+ hide: stringArgs(args['hide-runtime-detail']),
974
+ });
942
975
  let runtimeDescriptor = {
943
976
  defaultWorkspaceId: workspaceOptions[0]?.id,
944
977
  ...(typeof args.model === 'string' ? { defaultModel: args.model } : {}),
@@ -955,6 +988,7 @@ export async function main() {
955
988
  executionModes: hostAvailableExecutionModes,
956
989
  permissionModes: [...codexPermissionEnvelope.availablePermissionModes],
957
990
  defaultPermissionMode: codexPermissionEnvelope.defaultPermissionMode,
991
+ presentation: runtimePresentation,
958
992
  }),
959
993
  };
960
994
  async function baselineControlSignal(conversationId) {
@@ -1109,6 +1143,9 @@ export async function main() {
1109
1143
  });
1110
1144
  }
1111
1145
  },
1146
+ onMessageDeleted: (payload) => {
1147
+ removeQueuedPrompt(payload.conversationId, payload.messageId);
1148
+ },
1112
1149
  onConversationUpdated: (payload) => {
1113
1150
  handleConversationUpdated(payload);
1114
1151
  },
@@ -1142,6 +1179,7 @@ export async function main() {
1142
1179
  executionModes: hostAvailableExecutionModes,
1143
1180
  permissionModes: [...codexPermissionEnvelope.availablePermissionModes],
1144
1181
  defaultPermissionMode: codexPermissionEnvelope.defaultPermissionMode,
1182
+ presentation: runtimePresentation,
1145
1183
  }),
1146
1184
  };
1147
1185
  }
@@ -1161,6 +1199,7 @@ export async function main() {
1161
1199
  executionModes: hostAvailableExecutionModes,
1162
1200
  permissionModes: [...codexPermissionEnvelope.availablePermissionModes],
1163
1201
  defaultPermissionMode: codexPermissionEnvelope.defaultPermissionMode,
1202
+ presentation: runtimePresentation,
1164
1203
  }),
1165
1204
  };
1166
1205
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonmsg/codex-plugin",
3
- "version": "0.11.5",
3
+ "version": "0.11.7",
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": "^1.5.0",
33
- "@canonmsg/core": "^0.19.1"
32
+ "@canonmsg/agent-sdk": "^1.5.2",
33
+ "@canonmsg/core": "^0.19.3"
34
34
  },
35
35
  "engines": {
36
36
  "node": ">=18.0.0"