@canonmsg/codex-plugin 0.27.0 → 0.29.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/dist/register.js CHANGED
@@ -12,6 +12,7 @@ REQUIRED
12
12
 
13
13
  FLAGS
14
14
  --profile <name> Local profile name in ~/.canon/agents.json
15
+ --agent-id <id> Reconnect this exact transferred agent identity
15
16
  --environment <id> Canon environment ID (or CANON_ENVIRONMENT_ID; default: canon-prod-v1)
16
17
  --base-url <url> Canon API base URL override
17
18
  --stream-url <url> Canon stream URL override
@@ -23,12 +24,12 @@ FLAGS
23
24
  EXAMPLES
24
25
  canon-codex-register --name "My Codex" --description "Local coding agent" --phone "+15551234567"
25
26
  canon-codex-register --name "Frontend" --description "React work" --phone "+15551234567" --profile frontend
27
+ canon-codex-register --name "Sold Agent" --description "Existing agent" --phone "+15551234567" --agent-id <id>
26
28
 
27
29
  After approval, start it with CANON_AGENT=<profile> canon-codex --cwd /path/to/project.`;
28
30
  const OPTIONS = {
29
31
  moduleUrl: import.meta.url,
30
32
  clientType: 'codex',
31
- sessionSetupPolicy: 'runtime_descriptor_required',
32
33
  cliName: 'canon-codex-register',
33
34
  hostBinName: 'canon-codex',
34
35
  developerInfo: 'Codex host plugin',
@@ -1,4 +1,5 @@
1
1
  import { type ExecutionEnvironmentMode } from '@canonmsg/core';
2
+ export declare const CODEX_LOCAL_POLICY_FINGERPRINT_FORMAT: "local-v1";
2
3
  export declare function buildCodexThreadPolicyFingerprint(input: {
3
4
  baseCwd: string;
4
5
  executionMode?: ExecutionEnvironmentMode;
@@ -10,6 +11,9 @@ export declare function buildCodexThreadPolicyFingerprint(input: {
10
11
  fullAuto?: boolean;
11
12
  bypassApprovalsAndSandbox?: boolean;
12
13
  }): string;
13
- export declare function loadStoredThreadId(runtimeId: string, conversationId: string, baseCwd: string, executionMode?: ExecutionEnvironmentMode, policyFingerprint?: string): string | null;
14
+ export declare function loadStoredThreadId(runtimeId: string, conversationId: string, baseCwd: string, executionMode?: ExecutionEnvironmentMode, policyFingerprint?: string, options?: {
15
+ workspaceId?: string;
16
+ allowLegacyPolicyMigration?: boolean;
17
+ }): string | null;
14
18
  export declare function saveStoredThreadId(runtimeId: string, conversationId: string, baseCwd: string, threadId: string, executionMode?: ExecutionEnvironmentMode, policyFingerprint?: string): void;
15
19
  export declare function clearStoredThreadId(runtimeId: string, conversationId: string, baseCwd?: string, executionMode?: ExecutionEnvironmentMode): void;
@@ -1,5 +1,6 @@
1
1
  import { createHash } from 'node:crypto';
2
2
  import { clearRuntimeSessionState, loadRuntimeSessionState, saveRuntimeSessionState, } from '@canonmsg/core';
3
+ export const CODEX_LOCAL_POLICY_FINGERPRINT_FORMAT = 'local-v1';
3
4
  export function buildCodexThreadPolicyFingerprint(input) {
4
5
  return createHash('sha256').update(JSON.stringify({
5
6
  version: 2,
@@ -20,18 +21,24 @@ export function buildCodexThreadPolicyFingerprint(input) {
20
21
  bypassApprovalsAndSandbox: input.bypassApprovalsAndSandbox === true,
21
22
  })).digest('hex').slice(0, 24);
22
23
  }
23
- export function loadStoredThreadId(runtimeId, conversationId, baseCwd, executionMode, policyFingerprint) {
24
+ export function loadStoredThreadId(runtimeId, conversationId, baseCwd, executionMode, policyFingerprint, options = {}) {
24
25
  const state = loadRuntimeSessionState(runtimeId, {
25
26
  conversationId,
26
27
  baseCwd,
27
28
  executionMode,
29
+ workspaceId: options.workspaceId,
28
30
  });
29
31
  if (state?.threadId) {
30
32
  if (policyFingerprint && state.codexPolicyFingerprint !== policyFingerprint) {
33
+ if (options.allowLegacyPolicyMigration === true
34
+ && state.codexPolicyFingerprintFormat === undefined) {
35
+ return state.threadId;
36
+ }
31
37
  clearRuntimeSessionState(runtimeId, {
32
38
  conversationId,
33
39
  baseCwd,
34
40
  executionMode,
41
+ workspaceId: options.workspaceId,
35
42
  });
36
43
  return null;
37
44
  }
@@ -45,7 +52,12 @@ export function saveStoredThreadId(runtimeId, conversationId, baseCwd, threadId,
45
52
  baseCwd,
46
53
  executionMode,
47
54
  threadId,
48
- ...(policyFingerprint ? { codexPolicyFingerprint: policyFingerprint } : {}),
55
+ ...(policyFingerprint
56
+ ? {
57
+ codexPolicyFingerprint: policyFingerprint,
58
+ codexPolicyFingerprintFormat: CODEX_LOCAL_POLICY_FINGERPRINT_FORMAT,
59
+ }
60
+ : {}),
49
61
  });
50
62
  }
51
63
  export function clearStoredThreadId(runtimeId, conversationId, baseCwd, executionMode) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonmsg/codex-plugin",
3
- "version": "0.27.0",
3
+ "version": "0.29.0",
4
4
  "description": "Canon host integration for Codex CLI",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -29,11 +29,11 @@
29
29
  "prepack": "npm run build"
30
30
  },
31
31
  "dependencies": {
32
- "@canonmsg/agent-sdk": "^8.9.0",
33
- "@canonmsg/agent-tools": "^0.6.0",
34
- "@canonmsg/coding-agent-host": "^0.6.0",
35
- "@canonmsg/core": "^10.7.0",
36
- "@canonmsg/rich-cards": "^0.10.0"
32
+ "@canonmsg/agent-sdk": "^10.0.0",
33
+ "@canonmsg/agent-tools": "^0.8.0",
34
+ "@canonmsg/coding-agent-host": "^0.7.0",
35
+ "@canonmsg/core": "^12.0.0",
36
+ "@canonmsg/rich-cards": "^0.10.4"
37
37
  },
38
38
  "engines": {
39
39
  "node": ">=18.0.0"