polygram 0.45.1 → 0.46.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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://anthropic.com/claude-code/plugin.schema.json",
3
3
  "name": "polygram",
4
- "version": "0.45.1",
4
+ "version": "0.46.0",
5
5
  "description": "Telegram integration for Claude Code that preserves the OpenClaw per-chat session model. Migration target for OpenClaw users. Multi-bot, multi-chat, per-topic isolation; SQLite transcripts; inline-keyboard approvals. Bundles /polygram:status|logs|pair-code|approvals admin commands plus history (transcript queries) and polygram-send (out-of-turn IPC sends with file-upload validation) skills.",
6
6
  "keywords": [
7
7
  "telegram",
@@ -117,7 +117,9 @@
117
117
  },
118
118
 
119
119
  "codex": {
120
- "_comment": "Optional native macOS arm64 or Linux x64 Codex app-server beta. Codex is default-off: a chat/topic must explicitly set codexEnabled:true before pm:'codex' can be selected or dispatched, and exact target-specific startup preflight must succeed; other host targets, including Windows, are rejected. `home` must be a dedicated non-temporary 0700 CODEX_HOME already authenticated with ChatGPT; polygram never copies or reads credential contents. `binary` must be the canonical immutable path to the reviewed target's pinned Codex CLI, not a PATH symlink. On Linux set POLYGRAM_CODEX_TMPDIR to an owner-only 0700 runtime directory; otherwise Codex inherits the daemon TMPDIR after the same safety checks. Every directory containing daemon credentials or control data must be listed in daemonSecretRoots and must not overlap a Codex workspace or CODEX_HOME. Command network and model-native web search are disabled; product MCP tools and interactive approvals are unavailable. Keep long-running commands in the foreground. Detached/background servers are unsupported and may survive hard runtime loss.",
120
+ "_comment": "Optional native macOS arm64 or Linux x64 Codex app-server beta. Codex is default-off: a chat/topic must explicitly set codexEnabled:true before pm:'codex' can be selected or dispatched, and exact target-specific startup preflight must succeed; other host targets, including Windows, are rejected. `home` must be a dedicated non-temporary 0700 CODEX_HOME already authenticated with ChatGPT; polygram never copies or reads ChatGPT credential contents. `binary` must be the canonical immutable path to the reviewed target's pinned Codex CLI, not a PATH symlink. On Linux set POLYGRAM_CODEX_TMPDIR to an owner-only 0700 runtime directory; otherwise Codex inherits the daemon TMPDIR after the same safety checks. Every directory containing daemon credentials or control data must be listed in daemonSecretRoots and must not overlap a Codex workspace or CODEX_HOME. By default command network and model-native web search are disabled; product MCP tools and interactive approvals are unavailable. Keep long-running commands in the foreground. Detached/background servers are unsupported and may survive hard runtime loss.",
121
+ "_comment_access": "Optional trusted deployment; omit access to retain the limited beta policy. Example: {\"mode\":\"trusted\",\"chatIds\":[\"68861949\"],\"commandPath\":\"/home/shumabit/.local/bin:/usr/local/bin:/usr/bin:/bin\"}. This is intersected with scoped codexEnabled and grants service-user filesystem/credential rights, network and live web search. Owned config changes fail on drift; back up and reprovision deliberately.",
122
+ "_comment_proxy": "Optional independently of access. Example: {\"baseUrl\":\"http://127.0.0.1:8318/v1\",\"clientKeyFile\":\"/etc/polygram/shumabit-codex-proxy.key\"}. Only loopback HTTP /v1 Responses is supported. Provision the key privately (owner or root, no group/other permissions). Local ChatGPT authentication/catalog remain required; proxy failures never fall back to native inference.",
121
123
  "_comment_hooks": "Optional deployment-wide protected Codex hooks. Omit `hooks` for the existing hooks-off behavior. After installing a reviewed hook artifact version, add `hooks` with exactly: artifactRoot, enabled, operatorUid, runtimeId, runtimeRoot, runtimeSha256, serviceUid, and version. Polygram then discovers and pins the exact hook inventory before Codex admission; set enabled:false with the same receipt to roll back cleanly.",
122
124
  "home": "/Users/you/.codex-polygram",
123
125
  "binary": "/Users/you/.local/share/codex/versions/0.145.0/codex",
@@ -0,0 +1,91 @@
1
+ 'use strict';
2
+
3
+ const { createHash } = require('node:crypto');
4
+ const { lstatSync, readFileSync } = require('node:fs');
5
+ const path = require('node:path');
6
+
7
+ const TRUSTED_PROFILE_ID = 'polygram-trusted';
8
+
9
+ function invalid(message) {
10
+ const error = new Error(`Codex ${message}.`);
11
+ error.code = 'CODEX_DEPLOYMENT_CONFIG_INVALID';
12
+ error.action = 'Correct the explicit Codex deployment configuration before enabling it.';
13
+ return error;
14
+ }
15
+
16
+ function exactObject(value, keys) {
17
+ return value !== null && typeof value === 'object' && !Array.isArray(value)
18
+ && JSON.stringify(Object.keys(value).sort()) === JSON.stringify([...keys].sort());
19
+ }
20
+
21
+ function validateAccess(access) {
22
+ if (access === undefined) return null;
23
+ if (!exactObject(access, ['mode', 'chatIds', 'commandPath'])
24
+ || access.mode !== 'trusted'
25
+ || !Array.isArray(access.chatIds) || access.chatIds.length === 0
26
+ || access.chatIds.some((id) => typeof id !== 'string' || !/^[1-9][0-9]*$/.test(id))
27
+ || typeof access.commandPath !== 'string' || access.commandPath.length > 4096
28
+ || /[\u0000-\u001f\u007f]/u.test(access.commandPath)
29
+ || access.commandPath.split(':').some((entry) => !path.isAbsolute(entry))) {
30
+ throw invalid('trusted access requires exact positive private chat IDs and an absolute-entry commandPath');
31
+ }
32
+ return { mode: 'trusted', chatIds: [...access.chatIds], commandPath: access.commandPath };
33
+ }
34
+
35
+ function accessAllowsChat(access, chatId) {
36
+ try {
37
+ const trusted = validateAccess(access);
38
+ return trusted === null || trusted.chatIds.includes(String(chatId));
39
+ } catch {
40
+ return false;
41
+ }
42
+ }
43
+
44
+ function readProxy(proxy) {
45
+ if (proxy === undefined) return null;
46
+ let endpoint;
47
+ try { endpoint = new URL(proxy?.baseUrl); } catch {}
48
+ if (!exactObject(proxy, ['baseUrl', 'clientKeyFile'])
49
+ || !endpoint || endpoint.protocol !== 'http:'
50
+ || !['127.0.0.1', '[::1]', 'localhost'].includes(endpoint.hostname)
51
+ || endpoint.username || endpoint.password || endpoint.search || endpoint.hash
52
+ || endpoint.pathname !== '/v1'
53
+ || typeof proxy.clientKeyFile !== 'string' || !path.isAbsolute(proxy.clientKeyFile)
54
+ || /[\u0000-\u001f\u007f]/u.test(proxy.clientKeyFile)) {
55
+ throw invalid('proxy requires a loopback HTTP /v1 endpoint and an absolute private clientKeyFile');
56
+ }
57
+ let stat;
58
+ let key;
59
+ let contents;
60
+ try {
61
+ stat = lstatSync(proxy.clientKeyFile);
62
+ if (!stat.isFile() || stat.isSymbolicLink() || stat.nlink !== 1
63
+ || (stat.mode & 0o077) !== 0
64
+ || ![0, process.getuid?.()].includes(stat.uid)) throw new Error();
65
+ contents = readFileSync(proxy.clientKeyFile, 'utf8');
66
+ key = contents.trim();
67
+ if (!key || key.length > 16384 || /\s/u.test(key)) throw new Error();
68
+ } catch {
69
+ // File errors must never include key contents or provider-supplied text.
70
+ throw invalid('proxy client key is missing, unsafe, or malformed');
71
+ }
72
+ return {
73
+ provider: {
74
+ name: 'CLIProxyAPI',
75
+ base_url: proxy.baseUrl,
76
+ wire_api: 'responses',
77
+ requires_openai_auth: true,
78
+ experimental_bearer_token: key,
79
+ supports_websockets: true,
80
+ },
81
+ identity: {
82
+ baseUrl: proxy.baseUrl,
83
+ clientKeyFile: proxy.clientKeyFile,
84
+ dev: String(stat.dev), ino: String(stat.ino),
85
+ mode: stat.mode, uid: stat.uid,
86
+ sha256: createHash('sha256').update(contents).digest('hex'),
87
+ },
88
+ };
89
+ }
90
+
91
+ module.exports = { TRUSTED_PROFILE_ID, validateAccess, accessAllowsChat, readProxy };
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const { createHash } = require('node:crypto');
4
+ const { validateAccess, readProxy } = require('./deployment-policy');
4
5
 
5
6
  const orchestraDefault = require('@shumkov/orchestra');
6
7
  const { resolvePinnedCodexBinary } = require('./binary');
@@ -17,6 +18,8 @@ const {
17
18
  resolveCodexRuntimeCandidate,
18
19
  resolveCodexRuntimeRequest,
19
20
  resolveRuntimeConfig,
21
+ requireCodexEnabled,
22
+ resolveRuntimeDescriptor,
20
23
  } = require('../runtime-config');
21
24
  const { CODEX_APP_SERVER_NAMESPACE } = require('../db/sessions');
22
25
  const {
@@ -377,12 +380,40 @@ function createCodexRuntimeController({
377
380
  binaryPath: configured.binary ?? processEnv.POLYGRAM_CODEX_BIN,
378
381
  sessionLauncher,
379
382
  hooks: configured.hooks ?? null,
383
+ access: validateAccess(configured.access),
384
+ proxy: configured.proxy,
385
+ proxyIdentity: readProxy(configured.proxy)?.identity ?? null,
386
+ commandEnvironment: {
387
+ HOME: processEnv.HOME,
388
+ TMPDIR: processEnv.TMPDIR,
389
+ POLYGRAM_CODEX_TMPDIR: processEnv.POLYGRAM_CODEX_TMPDIR,
390
+ LANG: processEnv.LANG,
391
+ LC_ALL: processEnv.LC_ALL,
392
+ },
380
393
  daemonSecretRoots: [
381
394
  ...new Set([...defaultDaemonSecretRoots, ...configuredSecretRoots]),
382
395
  ],
383
396
  };
384
397
  }
385
398
 
399
+ function deploymentFingerprint() {
400
+ return digest(deploymentConfig());
401
+ }
402
+
403
+ function assertEntryCurrent(entry) {
404
+ if (typeof runtimeProfileBuilder.reattest === 'function') {
405
+ runtimeProfileBuilder.reattest(entry.expectedStaticProfile);
406
+ }
407
+ requireCodexEnabled(config, entry.chatId, entry.threadId);
408
+ if (entry.deploymentFingerprint !== deploymentFingerprint()) {
409
+ throw controllerError(
410
+ 'Codex deployment configuration changed after preflight.',
411
+ 'CODEX_PREFLIGHT_PROFILE_MISMATCH',
412
+ 'Let admitted work finish, then prepare an idle replacement with the current configuration.',
413
+ );
414
+ }
415
+ }
416
+
386
417
  function initialize() {
387
418
  if (initialization) return initialization;
388
419
  if (initializationError) throw initializationError;
@@ -452,14 +483,19 @@ function createCodexRuntimeController({
452
483
  return state;
453
484
  }
454
485
 
455
- async function prepareCodexRequest({ sessionKey, request, state }) {
486
+ async function prepareCodexRequest({
487
+ sessionKey, request, state, chatId, threadId,
488
+ }) {
456
489
  const configured = deploymentConfig();
457
- const hookConfigFingerprint = digest(configured.hooks);
490
+ requireCodexEnabled(config, chatId, threadId);
491
+ const fingerprint = digest(configured);
458
492
  const existing = receiptsBySession.get(sessionKey);
459
493
  if (existing && sameProfileRequest(
460
494
  existing.receipt.expectedStaticProfile,
461
495
  request,
462
- ) && existing.hookConfigFingerprint === hookConfigFingerprint) {
496
+ ) && existing.deploymentFingerprint === fingerprint
497
+ && existing.chatId === String(chatId)
498
+ && existing.threadId === threadId) {
463
499
  const catalogAgeMs = now() - existing.catalogPreparedAt;
464
500
  let currentCredentialState;
465
501
  try {
@@ -472,7 +508,7 @@ function createCodexRuntimeController({
472
508
  );
473
509
  }
474
510
  runtimeProfileBuilder.reattest(
475
- existing.receipt.expectedStaticProfile,
511
+ existing.expectedStaticProfile,
476
512
  );
477
513
  }
478
514
  const homeAttestation = await attestCodexHome(
@@ -489,6 +525,7 @@ function createCodexRuntimeController({
489
525
  && catalogAgeMs < catalogMaxAgeMs
490
526
  && catalogSupports(existing.catalog, request)
491
527
  ) {
528
+ assertEntryCurrent(existing);
492
529
  return existing;
493
530
  }
494
531
  invalidatePreparedSession(sessionKey, existing);
@@ -500,11 +537,9 @@ function createCodexRuntimeController({
500
537
  const key = digest({
501
538
  sessionKey,
502
539
  request,
503
- codexHome: configured.codexHome,
504
- binaryPath: configured.binaryPath,
505
- sessionLauncher: configured.sessionLauncher,
506
- hooks: configured.hooks,
507
- daemonSecretRoots: configured.daemonSecretRoots,
540
+ fingerprint,
541
+ chatId: String(chatId),
542
+ threadId,
508
543
  });
509
544
  if (preparingByKey.has(key)) return preparingByKey.get(key);
510
545
 
@@ -522,6 +557,8 @@ function createCodexRuntimeController({
522
557
  effort: request.effort,
523
558
  processEnv,
524
559
  sessionLauncher: configured.sessionLauncher,
560
+ ...(configured.access == null ? {} : { access: configured.access }),
561
+ ...(configured.proxy === undefined ? {} : { proxy: configured.proxy }),
525
562
  ...(configured.hooks == null ? {} : { hooks: configured.hooks }),
526
563
  });
527
564
  if (expectedStaticProfile.hookManifest != null) {
@@ -532,6 +569,8 @@ function createCodexRuntimeController({
532
569
  'Discard the profile and restore the hook-aware runtime builder.',
533
570
  );
534
571
  }
572
+ }
573
+ if (typeof runtimeProfileBuilder.reattest === 'function') {
535
574
  runtimeProfileBuilder.reattest(expectedStaticProfile);
536
575
  }
537
576
  const homeAttestation = await attestCodexHome(
@@ -562,16 +601,21 @@ function createCodexRuntimeController({
562
601
  'Choose a model and effort returned by the authenticated Codex catalog.',
563
602
  );
564
603
  }
565
- if (digest(deploymentConfig().hooks) !== hookConfigFingerprint) {
604
+ requireCodexEnabled(config, chatId, threadId);
605
+ if (deploymentFingerprint() !== fingerprint) {
566
606
  throw controllerError(
567
- 'Codex hook configuration changed during preflight.',
607
+ 'Codex deployment configuration changed during preflight.',
568
608
  'CODEX_PREFLIGHT_PROFILE_MISMATCH',
569
609
  'Retry after configuration changes settle.',
570
610
  );
571
611
  }
612
+ if (typeof runtimeProfileBuilder.reattest === 'function') {
613
+ runtimeProfileBuilder.reattest(expectedStaticProfile);
614
+ }
572
615
  const receipt = catalog.spawnProfile;
573
616
  const entry = {
574
617
  receipt,
618
+ expectedStaticProfile,
575
619
  availability: createAvailability(receipt),
576
620
  catalog,
577
621
  catalogCapabilityFingerprint:
@@ -579,7 +623,9 @@ function createCodexRuntimeController({
579
623
  catalogPreparedAt: now(),
580
624
  credentialStateFingerprint: attestedCredentialState,
581
625
  deploymentIdentity,
582
- hookConfigFingerprint,
626
+ deploymentFingerprint: fingerprint,
627
+ chatId: String(chatId),
628
+ threadId,
583
629
  };
584
630
  receiptsBySession.set(sessionKey, entry);
585
631
  return entry;
@@ -599,13 +645,25 @@ function createCodexRuntimeController({
599
645
  } = {}) {
600
646
  boundedString(sessionKey, 'session key');
601
647
  const state = requireAvailableInitialization();
648
+ validateAccess(config.codex?.access);
602
649
  const request = resolveCandidate({
603
650
  config,
604
651
  chatId,
605
652
  threadId,
606
653
  });
607
654
  if (!request) return null;
608
- const entry = await prepareCodexRequest({ sessionKey, request, state });
655
+ const entry = await prepareCodexRequest({
656
+ sessionKey, request, state, chatId, threadId,
657
+ });
658
+ assertEntryCurrent(entry);
659
+ const currentRequest = resolveCandidate({ config, chatId, threadId });
660
+ if (digest(currentRequest) !== digest(request)) {
661
+ throw controllerError(
662
+ 'Codex candidate changed during preflight.',
663
+ 'CODEX_PREFLIGHT_PROFILE_MISMATCH',
664
+ 'Retry after configuration changes settle.',
665
+ );
666
+ }
609
667
  return Object.freeze({
610
668
  request,
611
669
  availability: entry.availability,
@@ -616,6 +674,9 @@ function createCodexRuntimeController({
616
674
  async function prepareSession({ sessionKey, chatId, threadId = null } = {}) {
617
675
  boundedString(sessionKey, 'session key');
618
676
  const state = requireAvailableInitialization();
677
+ if (resolveRuntimeDescriptor({ config, chatId, threadId }).runtime === 'codex') {
678
+ validateAccess(config.codex?.access);
679
+ }
619
680
  const request = resolveRequest({
620
681
  config,
621
682
  chatId,
@@ -623,7 +684,10 @@ function createCodexRuntimeController({
623
684
  defaultPm: 'sdk',
624
685
  });
625
686
  if (!request) return null;
626
- const entry = await prepareCodexRequest({ sessionKey, request, state });
687
+ const entry = await prepareCodexRequest({
688
+ sessionKey, request, state, chatId, threadId,
689
+ });
690
+ assertEntryCurrent(entry);
627
691
  return prepareRuntimeView(entry, request, chatId, threadId);
628
692
  }
629
693
 
@@ -701,6 +765,7 @@ function createCodexRuntimeController({
701
765
  'Run preflight for the exact session runtime profile before spawning.',
702
766
  );
703
767
  }
768
+ assertEntryCurrent(entry);
704
769
  return entry.receipt;
705
770
  }
706
771
 
@@ -718,6 +783,7 @@ function createCodexRuntimeController({
718
783
  'Discard the stale spawn and rerun exact preflight.',
719
784
  );
720
785
  }
786
+ assertEntryCurrent(entry);
721
787
  if (expectedStaticProfile.hookManifest != null) {
722
788
  if (typeof runtimeProfileBuilder.reattest !== 'function') {
723
789
  throw controllerError(
@@ -726,7 +792,7 @@ function createCodexRuntimeController({
726
792
  'Discard the profile and restore the hook-aware runtime builder.',
727
793
  );
728
794
  }
729
- runtimeProfileBuilder.reattest(expectedStaticProfile);
795
+ runtimeProfileBuilder.reattest(entry.expectedStaticProfile);
730
796
  }
731
797
  return new orchestra.CodexAppServerClient({
732
798
  binary: expectedStaticProfile.binary,
@@ -769,6 +835,9 @@ function createCodexRuntimeController({
769
835
  'Do not reuse the process; prepare and register an exact replacement.',
770
836
  );
771
837
  }
838
+ if (entry.deploymentFingerprint !== record.deploymentFingerprint) {
839
+ return 'deployment-config-drift';
840
+ }
772
841
  if (
773
842
  entry.credentialStateFingerprint
774
843
  !== record.credentialStateFingerprint
@@ -824,9 +893,11 @@ function createCodexRuntimeController({
824
893
  'Discard the process and create a fresh generation.',
825
894
  );
826
895
  }
896
+ const entry = receiptsBySession.get(proc.sessionKey);
827
897
  const record = {
828
898
  proc,
829
899
  receipt,
900
+ expectedStaticProfile: entry.expectedStaticProfile,
830
901
  durable: false,
831
902
  durabilityBlocked: false,
832
903
  durabilityError: null,
@@ -837,13 +908,12 @@ function createCodexRuntimeController({
837
908
  retirementWaiters: [],
838
909
  retired: false,
839
910
  expectedProviderGenerationId,
911
+ deploymentFingerprint: entry.deploymentFingerprint,
912
+ chatId: entry.chatId,
913
+ threadId: entry.threadId,
840
914
  strictResumeAttemptId: null,
841
- credentialStateFingerprint: receiptsBySession
842
- .get(proc.sessionKey)
843
- .credentialStateFingerprint,
844
- catalogCapabilityFingerprint: receiptsBySession
845
- .get(proc.sessionKey)
846
- .catalogCapabilityFingerprint,
915
+ credentialStateFingerprint: entry.credentialStateFingerprint,
916
+ catalogCapabilityFingerprint: entry.catalogCapabilityFingerprint,
847
917
  };
848
918
  processesByGeneration.set(proc.generationId, record);
849
919
  currentProcessBySession.set(proc.sessionKey, record);
@@ -933,6 +1003,7 @@ function createCodexRuntimeController({
933
1003
  telegramMessageId,
934
1004
  } = {}) {
935
1005
  const owner = requireCurrentDispatchOwner(sessionKey, generationId);
1006
+ assertEntryCurrent(owner.record);
936
1007
  const exactBotName = deliveryResultString(botName, 'bot name');
937
1008
  const exactChatId = deliveryResultString(
938
1009
  telegramChatId,
@@ -942,6 +1013,13 @@ function createCodexRuntimeController({
942
1013
  telegramMessageId,
943
1014
  'Telegram message ID',
944
1015
  );
1016
+ if (exactChatId !== owner.record.chatId) {
1017
+ throw controllerError(
1018
+ 'Codex dispatch chat differs from its origin.',
1019
+ 'CODEX_DISPATCH_BINDING_MISSING',
1020
+ 'Use the originating chat for dispatch.',
1021
+ );
1022
+ }
945
1023
  const reservationId = codexDispatchReservationId({
946
1024
  botName: exactBotName,
947
1025
  telegramChatId: exactChatId,
@@ -1000,6 +1078,7 @@ function createCodexRuntimeController({
1000
1078
  disposition,
1001
1079
  } = {}) {
1002
1080
  const owner = requireCurrentDispatchOwner(sessionKey, generationId);
1081
+ if (disposition === 'queue-authorized') assertEntryCurrent(owner.record);
1003
1082
  if (!['queue-authorized', 'ambiguous', 'cancelled'].includes(disposition)) {
1004
1083
  throw controllerError(
1005
1084
  'Codex dispatch disposition is invalid.',
@@ -1722,6 +1801,7 @@ function createCodexRuntimeController({
1722
1801
  'Quarantine the generation and inspect its initialization checkpoints.',
1723
1802
  );
1724
1803
  }
1804
+ assertEntryCurrent(record);
1725
1805
  persistPreparedTurnIdentity(record, payload, state);
1726
1806
  } else if (!record.durable) {
1727
1807
  activateWithPreparedCheckpoint(record, payload);
@@ -7,6 +7,8 @@ const {
7
7
  lstatSync,
8
8
  mkdirSync,
9
9
  readFileSync,
10
+ readlinkSync,
11
+ symlinkSync,
10
12
  realpathSync,
11
13
  writeFileSync,
12
14
  } = require('node:fs');
@@ -28,6 +30,12 @@ const {
28
30
  renderTrustTables,
29
31
  } = require('./hook-runtime');
30
32
 
33
+ const {
34
+ TRUSTED_PROFILE_ID,
35
+ validateAccess,
36
+ readProxy,
37
+ } = require('./deployment-policy');
38
+
31
39
  const CODEX_PERMISSION_PROFILE_ID = 'polygram-session';
32
40
  const CONTROLLED_PATH = '/usr/bin:/bin';
33
41
  const MAX_PAGES = 16;
@@ -293,7 +301,11 @@ function buildOwnedConfig({
293
301
  daemonSecretRoots,
294
302
  commandHome,
295
303
  commandTmp,
304
+ access,
305
+ proxy,
296
306
  }) {
307
+ const trusted = access !== null;
308
+ const profileId = trusted ? TRUSTED_PROFILE_ID : CODEX_PERMISSION_PROFILE_ID;
297
309
  const filesystem = {
298
310
  ':minimal': 'read',
299
311
  [codexHome]: 'deny',
@@ -304,11 +316,13 @@ function buildOwnedConfig({
304
316
  filesystem[':workspace_roots'] = { '.': 'write' };
305
317
  return {
306
318
  cli_auth_credentials_store: 'file',
307
- model_provider: 'openai',
308
- default_permissions: CODEX_PERMISSION_PROFILE_ID,
319
+ model_provider: proxy ? 'cliproxyapi' : 'openai',
320
+ ...(proxy ? { model_providers: { cliproxyapi: proxy.provider } } : {}),
321
+ default_permissions: profileId,
309
322
  approval_policy: 'never',
310
323
  approvals_reviewer: 'user',
311
- web_search: 'disabled',
324
+ web_search: trusted ? 'live' : 'disabled',
325
+ ...(trusted ? { memories: { generate_memories: false, use_memories: false } } : {}),
312
326
  allow_login_shell: false,
313
327
  features: {
314
328
  goals: false,
@@ -319,13 +333,13 @@ function buildOwnedConfig({
319
333
  set: {
320
334
  HOME: commandHome,
321
335
  TMPDIR: commandTmp,
322
- PATH: CONTROLLED_PATH,
336
+ PATH: access?.commandPath ?? CONTROLLED_PATH,
323
337
  },
324
338
  },
325
339
  permissions: {
326
- [CODEX_PERMISSION_PROFILE_ID]: {
327
- filesystem,
328
- network: { enabled: false },
340
+ [profileId]: {
341
+ filesystem: trusted ? { ':root': 'write' } : filesystem,
342
+ network: { enabled: trusted },
329
343
  },
330
344
  },
331
345
  projects: {
@@ -340,16 +354,16 @@ function renderOwnedConfig(config, {
340
354
  daemonSecretRoots,
341
355
  }) {
342
356
  const command = config.shell_environment_policy.set;
343
- const filesystem = config.permissions[
344
- CODEX_PERMISSION_PROFILE_ID
345
- ].filesystem;
357
+ const profileId = config.default_permissions;
358
+ const trusted = profileId === TRUSTED_PROFILE_ID;
359
+ const filesystem = config.permissions[profileId].filesystem;
346
360
  const lines = [
347
361
  'cli_auth_credentials_store = "file"',
348
- 'model_provider = "openai"',
349
- `default_permissions = ${tomlString(CODEX_PERMISSION_PROFILE_ID)}`,
362
+ `model_provider = ${tomlString(config.model_provider)}`,
363
+ `default_permissions = ${tomlString(profileId)}`,
350
364
  'approval_policy = "never"',
351
365
  'approvals_reviewer = "user"',
352
- 'web_search = "disabled"',
366
+ `web_search = ${tomlString(config.web_search)}`,
353
367
  'allow_login_shell = false',
354
368
  '',
355
369
  '[features]',
@@ -364,29 +378,43 @@ function renderOwnedConfig(config, {
364
378
  `TMPDIR = ${tomlString(command.TMPDIR)}`,
365
379
  `PATH = ${tomlString(command.PATH)}`,
366
380
  '',
367
- `[permissions.${tomlKey(CODEX_PERMISSION_PROFILE_ID)}.filesystem]`,
368
- `${tomlKey(':minimal')} = "read"`,
369
- `${tomlKey(codexHome)} = "deny"`,
381
+ `[permissions.${tomlKey(profileId)}.filesystem]`,
382
+ ...(trusted ? [`${tomlKey(':root')} = "write"`] : [
383
+ `${tomlKey(':minimal')} = "read"`,
384
+ `${tomlKey(codexHome)} = "deny"`,
385
+ ]),
370
386
  ];
371
- for (const root of [...daemonSecretRoots].sort()) {
387
+ for (const root of trusted ? [] : [...daemonSecretRoots].sort()) {
372
388
  lines.push(`${tomlKey(root)} = "deny"`);
373
389
  }
374
390
  lines.push(
375
- `${tomlKey(':workspace_roots')} = { "." = "write" }`,
391
+ ...(trusted ? [] : [`${tomlKey(':workspace_roots')} = { "." = "write" }`]),
376
392
  '',
377
- `[permissions.${tomlKey(CODEX_PERMISSION_PROFILE_ID)}.network]`,
378
- 'enabled = false',
393
+ `[permissions.${tomlKey(profileId)}.network]`,
394
+ `enabled = ${trusted}`,
379
395
  '',
380
396
  `[projects.${tomlKey(workspace)}]`,
381
397
  'trust_level = "untrusted"',
382
398
  '',
383
399
  );
400
+ if (trusted) {
401
+ lines.push('[memories]', 'generate_memories = false', 'use_memories = false', '');
402
+ }
403
+ if (config.model_providers) {
404
+ lines.push('[model_providers.cliproxyapi]');
405
+ for (const [key, value] of Object.entries(config.model_providers.cliproxyapi)) {
406
+ lines.push(`${key} = ${typeof value === 'boolean' ? value : tomlString(value)}`);
407
+ }
408
+ lines.push('');
409
+ }
384
410
  const hookTables = renderTrustTables(config);
385
411
  if (hookTables) lines.push(...hookTables.split('\n'));
386
412
  if (
387
- filesystem[':minimal'] !== 'read'
388
- || filesystem[codexHome] !== 'deny'
389
- || !isDeepStrictEqual(filesystem[':workspace_roots'], { '.': 'write' })
413
+ !trusted && (
414
+ filesystem[':minimal'] !== 'read'
415
+ || filesystem[codexHome] !== 'deny'
416
+ || !isDeepStrictEqual(filesystem[':workspace_roots'], { '.': 'write' })
417
+ )
390
418
  ) {
391
419
  throw new Error('owned config rendering invariant failed');
392
420
  }
@@ -511,7 +539,76 @@ function assertRootSeparation(codexHome, workspace, daemonSecretRoots) {
511
539
  }
512
540
  }
513
541
 
542
+ function instructionBindingDrift() {
543
+ return fail(
544
+ 'Codex root instruction binding does not match the dedicated home and workspace.',
545
+ 'CODEX_INSTRUCTION_BINDING_DRIFT',
546
+ 'Use the dedicated Polygram home with its exact canonical workspace AGENTS.md symlink and no AGENTS.override.md; inspect conflicts without replacing existing files.',
547
+ );
548
+ }
549
+
550
+ function inspectOptionalPath(target) {
551
+ try { return lstatSync(target); }
552
+ catch (error) {
553
+ if (error.code === 'ENOENT') return null;
554
+ throw instructionBindingDrift();
555
+ }
556
+ }
557
+
558
+ function assertDedicatedInstructionHome(options) {
559
+ const configured = requiredString(options.codexHome, 'credential home');
560
+ const serviceHome = (options.processEnv ?? process.env).HOME;
561
+ const globalHomes = [path.join(os.homedir(), '.codex')];
562
+ if (typeof serviceHome === 'string') globalHomes.push(path.join(serviceHome, '.codex'));
563
+ for (const globalHome of globalHomes) {
564
+ if (path.resolve(configured) === globalHome) throw instructionBindingDrift();
565
+ try {
566
+ if (realpathSync(configured) === realpathSync(globalHome)) throw instructionBindingDrift();
567
+ } catch (error) {
568
+ if (error.code !== 'ENOENT') throw error;
569
+ }
570
+ }
571
+ }
572
+
573
+ function inspectInstructionBinding({ codexHome, workspace, required }, create = false) {
574
+ const root = path.join(workspace, 'AGENTS.md');
575
+ const link = path.join(codexHome, 'AGENTS.md');
576
+ if (inspectOptionalPath(path.join(codexHome, 'AGENTS.override.md'))) {
577
+ throw instructionBindingDrift();
578
+ }
579
+ const source = inspectOptionalPath(root);
580
+ const existing = inspectOptionalPath(link);
581
+ if (!source) {
582
+ if (required || existing) throw instructionBindingDrift();
583
+ return false;
584
+ }
585
+ if (
586
+ !source.isFile() || source.isSymbolicLink() || source.nlink !== 1
587
+ || source.uid !== process.getuid?.() || (source.mode & 0o022) !== 0
588
+ || realpathSync(root) !== root
589
+ ) throw instructionBindingDrift();
590
+ assertSafeParentChain(workspace, 'instruction workspace', {
591
+ code: 'CODEX_INSTRUCTION_BINDING_DRIFT',
592
+ });
593
+ if (!existing && create) {
594
+ try { symlinkSync(root, link); }
595
+ catch { throw instructionBindingDrift(); }
596
+ }
597
+ const actual = inspectOptionalPath(link);
598
+ if (!actual?.isSymbolicLink() || actual.uid !== process.getuid?.()) {
599
+ throw instructionBindingDrift();
600
+ }
601
+ try {
602
+ if (path.resolve(codexHome, readlinkSync(link)) !== root || realpathSync(link) !== root) {
603
+ throw instructionBindingDrift();
604
+ }
605
+ } catch { throw instructionBindingDrift(); }
606
+ return true;
607
+ }
608
+
514
609
  function provisionRuntimeFiles(options, temporaryRoots) {
610
+ const access = validateAccess(options.access);
611
+ const proxy = readProxy(options.proxy);
515
612
  const workspace = canonicalDirectory(options.workspace, 'workspace');
516
613
  const appServerTmp = resolveCodexTempDirectory(
517
614
  options.processEnv ?? process.env,
@@ -565,11 +662,13 @@ function provisionRuntimeFiles(options, temporaryRoots) {
565
662
  assertSafeParentChain(codexHome, 'credential home');
566
663
  assertRootSeparation(codexHome, workspace, daemonSecretRoots);
567
664
 
568
- const commandHome = ensurePrivateDirectory(
569
- path.join(workspace, '.codex-command-home'),
570
- 'CODEX_COMMAND_DIR_UNSAFE',
571
- 'command HOME',
572
- );
665
+ const commandHome = access !== null
666
+ ? canonicalDirectory((options.processEnv ?? process.env).HOME, 'command HOME')
667
+ : ensurePrivateDirectory(
668
+ path.join(workspace, '.codex-command-home'),
669
+ 'CODEX_COMMAND_DIR_UNSAFE',
670
+ 'command HOME',
671
+ );
573
672
  const commandTmp = ensurePrivateDirectory(
574
673
  path.join(workspace, '.codex-command-tmp'),
575
674
  'CODEX_COMMAND_DIR_UNSAFE',
@@ -581,6 +680,8 @@ function provisionRuntimeFiles(options, temporaryRoots) {
581
680
  daemonSecretRoots,
582
681
  commandHome,
583
682
  commandTmp,
683
+ access,
684
+ proxy,
584
685
  });
585
686
  const rawConfig = renderOwnedConfig(ownedConfig, {
586
687
  codexHome,
@@ -628,7 +729,7 @@ function provisionBaseConfig(materialized) {
628
729
  });
629
730
  if (readFileSync(configPath, 'utf8') !== rawConfig) {
630
731
  throw fail(
631
- 'Codex owned config.toml differs from the native-beta policy.',
732
+ 'Codex owned config.toml differs from the configured deployment policy.',
632
733
  'CODEX_OWNED_CONFIG_DRIFT',
633
734
  'Back up config.toml outside CODEX_HOME, then remove or move the original and rerun startup to reprovision the exact owned config; Polygram never migrates or overwrites it automatically.',
634
735
  );
@@ -653,7 +754,7 @@ function expectedFilesystem(materialized) {
653
754
  return {
654
755
  glob_scan_max_depth: null,
655
756
  ...materialized.ownedConfig.permissions[
656
- CODEX_PERMISSION_PROFILE_ID
757
+ materialized.ownedConfig.default_permissions
657
758
  ].filesystem,
658
759
  };
659
760
  }
@@ -681,18 +782,18 @@ function validateProjectedConfig(config, materialized) {
681
782
  JSON.stringify(Object.keys(config).sort()) !== JSON.stringify(allowedKeys)
682
783
  || !SHA256_RE.test(config.sha256)
683
784
  || (config.model !== null && typeof config.model !== 'string')
684
- || config.modelProvider !== 'openai'
685
- || config.defaultPermissions !== CODEX_PERMISSION_PROFILE_ID
785
+ || config.modelProvider !== materialized.ownedConfig.model_provider
786
+ || config.defaultPermissions !== materialized.ownedConfig.default_permissions
686
787
  || config.approvalPolicy !== 'never'
687
788
  || config.approvalsReviewer !== 'user'
688
- || config.webSearch !== 'disabled'
789
+ || config.webSearch !== materialized.ownedConfig.web_search
689
790
  || config.allowLoginShell !== false
690
791
  || config.shellEnvironmentInherit !== 'none'
691
792
  || !isDeepStrictEqual(config.mcpServers, { count: 0, keySha256: [] })
692
793
  || !isDeepStrictEqual(config.plugins, { count: 0, keySha256: [] })
693
794
  || !isDeepStrictEqual(config.modelProviders, {
694
- count: 0,
695
- keySha256: [],
795
+ count: materialized.ownedConfig.model_providers ? 1 : 0,
796
+ keySha256: materialized.ownedConfig.model_providers ? [digest('cliproxyapi')] : [],
696
797
  })
697
798
  || !Array.isArray(config.permissionProfiles)
698
799
  || config.permissionProfiles.length !== 1
@@ -707,9 +808,9 @@ function validateProjectedConfig(config, materialized) {
707
808
  .map(([root, access]) => ({ rootSha256: digest(root), access }))
708
809
  .sort((left, right) => left.rootSha256.localeCompare(right.rootSha256));
709
810
  if (
710
- profile?.id !== CODEX_PERMISSION_PROFILE_ID
811
+ profile?.id !== materialized.ownedConfig.default_permissions
711
812
  || profile.extends !== null
712
- || profile.networkEnabled !== false
813
+ || profile.networkEnabled !== (materialized.ownedConfig.default_permissions === TRUSTED_PROFILE_ID)
713
814
  || profile.filesystemSha256 !== digest(filesystem)
714
815
  || !isDeepStrictEqual(profile.filesystem, rules)
715
816
  ) {
@@ -786,7 +887,7 @@ function validateRequirements(requirements) {
786
887
  }
787
888
  }
788
889
 
789
- async function collectPermissionProfiles(client, workspace) {
890
+ async function collectPermissionProfiles(client, workspace, profileId) {
790
891
  const profiles = [];
791
892
  const ids = new Set();
792
893
  const cursors = new Set();
@@ -837,7 +938,7 @@ async function collectPermissionProfiles(client, workspace) {
837
938
  }
838
939
  }
839
940
  const owned = profiles.filter(
840
- ({ id }) => id === CODEX_PERMISSION_PROFILE_ID,
941
+ ({ id }) => id === profileId,
841
942
  );
842
943
  if (owned.length !== 1 || owned[0].allowed !== true) {
843
944
  throw new Error('owned permission profile is not uniquely allowed');
@@ -990,6 +1091,7 @@ async function characterizeRuntime(materialized, {
990
1091
  const permissionProfiles = await collectPermissionProfiles(
991
1092
  client,
992
1093
  materialized.workspace,
1094
+ materialized.ownedConfig.default_permissions,
993
1095
  );
994
1096
  validateProjectedConfig(configRead?.config, materialized);
995
1097
  validateProjectedLayers(configRead?.layers, materialized);
@@ -1064,6 +1166,7 @@ function createCodexRuntimeProfileBuilder({
1064
1166
  }
1065
1167
 
1066
1168
  const hookProfiles = new WeakMap();
1169
+ const instructionProfiles = new WeakMap();
1067
1170
  const builder = {
1068
1171
  async prepare(options = {}) {
1069
1172
  const targetPin = resolveTargetPin();
@@ -1096,6 +1199,7 @@ function createCodexRuntimeProfileBuilder({
1096
1199
  'Restore the exact root-owned session launcher before enabling Codex.',
1097
1200
  );
1098
1201
  }
1202
+ assertDedicatedInstructionHome(options);
1099
1203
  let materialized = provisionRuntimeFiles(options, temporaryRoots);
1100
1204
  let hookMaterial = null;
1101
1205
  if (options.hooks == null) {
@@ -1140,12 +1244,21 @@ function createCodexRuntimeProfileBuilder({
1140
1244
  hookArtifactsSha256: hookState.hookArtifactsSha256,
1141
1245
  };
1142
1246
  }
1247
+ const instructionBinding = Object.freeze({
1248
+ codexHome: materialized.codexHome,
1249
+ workspace: materialized.workspace,
1250
+ required: materialized.ownedConfig.default_permissions === TRUSTED_PROFILE_ID,
1251
+ });
1252
+ const instructionsPresent = inspectInstructionBinding(instructionBinding, true);
1143
1253
  const characterized = await characterizeRuntime(materialized, {
1144
1254
  binaryReceipt: options.binaryReceipt,
1145
1255
  sessionLauncherReceipt,
1146
1256
  clientFactory,
1147
1257
  hookManifest: materialized.hookManifest ?? null,
1148
1258
  });
1259
+ if (inspectInstructionBinding(instructionBinding) !== instructionsPresent) {
1260
+ throw instructionBindingDrift();
1261
+ }
1149
1262
  const model = requiredString(options.model, 'model');
1150
1263
  const effort = requiredString(options.effort, 'reasoning effort');
1151
1264
  const profile = deepFreeze({
@@ -1167,7 +1280,7 @@ function createCodexRuntimeProfileBuilder({
1167
1280
  expectedOriginsSha256: characterized.originsSha256,
1168
1281
  expectedRequirements: characterized.requirements.requirements,
1169
1282
  expectedPermissionProfiles: characterized.permissionProfiles,
1170
- permissionProfileId: CODEX_PERMISSION_PROFILE_ID,
1283
+ permissionProfileId: materialized.ownedConfig.default_permissions,
1171
1284
  model,
1172
1285
  effort,
1173
1286
  sessionLauncher: sessionLauncherReceipt?.path ?? null,
@@ -1177,6 +1290,7 @@ function createCodexRuntimeProfileBuilder({
1177
1290
  hookArtifactsSha256: materialized.hookArtifactsSha256,
1178
1291
  }),
1179
1292
  });
1293
+ instructionProfiles.set(profile, { ...instructionBinding, present: instructionsPresent });
1180
1294
  if (hookMaterial != null) {
1181
1295
  hookProfiles.set(profile, Object.freeze({
1182
1296
  hookOptions: Object.freeze({ ...options.hooks }),
@@ -1187,6 +1301,12 @@ function createCodexRuntimeProfileBuilder({
1187
1301
  return profile;
1188
1302
  },
1189
1303
  reattest(profile) {
1304
+ const instructions = instructionProfiles.get(profile);
1305
+ if (!instructions || profile.cwd !== instructions.workspace
1306
+ || profile.codexHome !== instructions.codexHome
1307
+ || inspectInstructionBinding(instructions) !== instructions.present) {
1308
+ throw instructionBindingDrift();
1309
+ }
1190
1310
  if (profile?.hookManifest == null) return null;
1191
1311
  const binding = hookProfiles.get(profile);
1192
1312
  if (!binding) {
@@ -19,6 +19,7 @@
19
19
  const MODEL_OPTIONS = ['opus', 'sonnet', 'haiku'];
20
20
  const EFFORT_OPTIONS = ['low', 'medium', 'high', 'xhigh', 'max'];
21
21
  const CODEX_MODEL_OPTIONS = Object.freeze([
22
+ Object.freeze({ model: 'gpt-6-astra', label: 'Astra' }),
22
23
  Object.freeze({ model: 'gpt-5.6-sol', label: 'Sol' }),
23
24
  Object.freeze({ model: 'gpt-5.6-terra', label: 'Terra' }),
24
25
  Object.freeze({ model: 'gpt-5.6-luna', label: 'Luna' }),
package/lib/prompt.js CHANGED
@@ -5,6 +5,8 @@
5
5
  * Telegram payload → polygram DB → unresolvable marker.
6
6
  */
7
7
 
8
+ const { validateAccess } = require('./codex/deployment-policy');
9
+
8
10
  const {
9
11
  requireCodexEnabled,
10
12
  resolveRuntimeDescriptor,
@@ -35,12 +37,15 @@ function resolvePromptBackend({ config, chatId, threadId = null }) {
35
37
  *
36
38
  * @param {{ stickerEmojis?: string[], backend?: 'sdk'|'cli'|'codex' }} [opts]
37
39
  */
38
- function polygramInfo({ stickerEmojis = [], backend = 'sdk' } = {}) {
40
+ function polygramInfo({ stickerEmojis = [], backend = 'sdk', codexAccess } = {}) {
39
41
  const hasStickers = stickerEmojis.length > 0;
42
+ const codexPolicy = backend === 'codex' && validateAccess(codexAccess) !== null
43
+ ? 'This trusted Codex profile has the service user’s filesystem rights, including access to credentials; command network and model-native web search are enabled.'
44
+ : 'This is a native Codex beta: command network and model-native web search are disabled.';
40
45
  const deliveryContract = backend === 'cli'
41
46
  ? `You are connected via a Telegram daemon (polygram) in channels mode. Inline final text is invisible to the Telegram user. For every user-visible response, you MUST call \`mcp__polygram-bridge__reply\` within this turn. Only a successful reply-tool receipt proves delivery. Do not claim something was already sent or posted above based only on the transcript; transcript content is not a delivery receipt. If delivery is uncertain, send it now with the reply tool.`
42
47
  : backend === 'codex'
43
- ? `You are connected to Telegram through polygram's Codex app-server runtime. Reply with inline text — polygram streams and delivers your final response automatically. Do NOT use Telegram MCP tools. This is a native Codex beta: command network and model-native web search are disabled, and product MCP tools and interactive approvals are unavailable. Keep long-running commands in the foreground. Do not start detached or background servers; they are unsupported and may survive hard runtime loss.`
48
+ ? `You are connected to Telegram through polygram's Codex app-server runtime. Reply with inline text — polygram streams and delivers your final response automatically. Do NOT use Telegram MCP tools. ${codexPolicy} Product MCP tools and interactive approvals are unavailable. Keep long-running commands in the foreground. Do not start detached or background servers; they are unsupported and may survive hard runtime loss.`
44
49
  : `You are connected via a Telegram daemon (polygram). Just reply with text — polygram delivers your response automatically. Do NOT use Telegram MCP tools.`;
45
50
  const emojiLine = hasStickers
46
51
  ? `Single emoji reply = auto-converted: ${stickerEmojis.join('')} become your stickers, any other emoji (🔥👍💪❤️) becomes a reaction on the user's message.`
@@ -218,7 +223,7 @@ function buildVoiceTags(attachments) {
218
223
  * @param {Object} params.replyTo - input for buildReplyToBlock (optional)
219
224
  * @param {'sdk'|'cli'|'codex'} params.backend - delivery contract for the selected process backend
220
225
  */
221
- function buildPrompt({ msg, topicName = '', sessionCtx = '', attachments = [], replyTo = null, polygramHistory = '', stickerEmojis = [], backend = 'sdk' }) {
226
+ function buildPrompt({ msg, topicName = '', sessionCtx = '', attachments = [], replyTo = null, polygramHistory = '', stickerEmojis = [], backend = 'sdk', codexAccess }) {
222
227
  const chatId = msg.chat.id.toString();
223
228
  const msgId = msg.message_id.toString();
224
229
  const user = msg.from?.first_name || msg.from?.username || 'Unknown';
@@ -242,7 +247,7 @@ function buildPrompt({ msg, topicName = '', sessionCtx = '', attachments = [], r
242
247
  if (polygramHistory) {
243
248
  prompt += polygramHistory + '\n\n';
244
249
  }
245
- prompt += `<polygram-info>${polygramInfo({ stickerEmojis, backend })}</polygram-info>\n\n`;
250
+ prompt += `<polygram-info>${polygramInfo({ stickerEmojis, backend, codexAccess })}</polygram-info>\n\n`;
246
251
 
247
252
  const replyBlock = buildReplyToBlock(replyTo);
248
253
  const attachmentTags = buildAttachmentTags(attachments);
@@ -13,6 +13,7 @@
13
13
  const { createHash } = require('crypto');
14
14
  const { pickBackend } = require('@shumkov/orchestra');
15
15
  const { resolveBoolOverride } = require('./config-override');
16
+ const { accessAllowsChat } = require('./codex/deployment-policy');
16
17
 
17
18
  const PM_DESCRIPTORS = Object.freeze({
18
19
  sdk: Object.freeze({
@@ -95,7 +96,7 @@ class RuntimeConfigError extends Error {
95
96
  }
96
97
 
97
98
  function resolveCodexEnabled(config, chatId, threadId = null) {
98
- return resolveBoolOverride(
99
+ return accessAllowsChat(config?.codex?.access, chatId) && resolveBoolOverride(
99
100
  config,
100
101
  'codexEnabled',
101
102
  chatId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polygram",
3
- "version": "0.45.1",
3
+ "version": "0.46.0",
4
4
  "description": "Telegram daemon for Claude Code that preserves the OpenClaw per-chat session model. Migration path for OpenClaw users moving to Claude Code.",
5
5
  "main": "lib/ipc/client.js",
6
6
  "bin": {
@@ -71,7 +71,7 @@
71
71
  "dependencies": {
72
72
  "@anthropic-ai/claude-agent-sdk": "0.3.283",
73
73
  "@modelcontextprotocol/sdk": "^1.29.0",
74
- "@shumkov/orchestra": "0.11.3",
74
+ "@shumkov/orchestra": "0.12.0",
75
75
  "acorn": "8.18.0",
76
76
  "better-sqlite3": "^12.9.0",
77
77
  "grammy": "^1.42.0",
package/polygram.js CHANGED
@@ -623,6 +623,7 @@ function formatPrompt(msg, sessionCtx, attachments = [], { sessionKey = null } =
623
623
  replyTo: resolveReplyTo(msg),
624
624
  polygramHistory: polygramHistory + (notificationService?.context(sessionKey, msg.reply_to_message?.message_id) || '') + (notificationService?.instructions(sessionKey) || '') + (mailboxService?.instructions(sessionKey) || ''),
625
625
  backend: resolvePromptBackend({ config, chatId, threadId }),
626
+ codexAccess: config.codex?.access,
626
627
  // Only advertise stickers this bot actually has — empty for a bot with no
627
628
  // sticker set, so its prompt never mentions stickers.
628
629
  stickerEmojis: Object.keys(emojiToSticker),