@kaitranntt/ccs 7.57.2 → 7.58.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 (126) hide show
  1. package/dist/ccs.js +35 -2
  2. package/dist/ccs.js.map +1 -1
  3. package/dist/channels/official-channels-runtime.d.ts +156 -0
  4. package/dist/channels/official-channels-runtime.d.ts.map +1 -0
  5. package/dist/channels/official-channels-runtime.js +658 -0
  6. package/dist/channels/official-channels-runtime.js.map +1 -0
  7. package/dist/channels/official-channels-store.d.ts +23 -0
  8. package/dist/channels/official-channels-store.d.ts.map +1 -0
  9. package/dist/channels/official-channels-store.js +274 -0
  10. package/dist/channels/official-channels-store.js.map +1 -0
  11. package/dist/cliproxy/accounts/registry.d.ts.map +1 -1
  12. package/dist/cliproxy/accounts/registry.js +160 -87
  13. package/dist/cliproxy/accounts/registry.js.map +1 -1
  14. package/dist/cliproxy/accounts/token-file-ops.d.ts +14 -0
  15. package/dist/cliproxy/accounts/token-file-ops.d.ts.map +1 -1
  16. package/dist/cliproxy/accounts/token-file-ops.js +31 -1
  17. package/dist/cliproxy/accounts/token-file-ops.js.map +1 -1
  18. package/dist/cliproxy/ai-providers/config-store.d.ts +1 -1
  19. package/dist/cliproxy/binary-manager.d.ts +12 -1
  20. package/dist/cliproxy/binary-manager.d.ts.map +1 -1
  21. package/dist/cliproxy/binary-manager.js +15 -9
  22. package/dist/cliproxy/binary-manager.js.map +1 -1
  23. package/dist/cliproxy/codex-plan-compatibility.d.ts +11 -1
  24. package/dist/cliproxy/codex-plan-compatibility.d.ts.map +1 -1
  25. package/dist/cliproxy/codex-plan-compatibility.js +10 -6
  26. package/dist/cliproxy/codex-plan-compatibility.js.map +1 -1
  27. package/dist/commands/api-command/export-command.d.ts +12 -1
  28. package/dist/commands/api-command/export-command.d.ts.map +1 -1
  29. package/dist/commands/api-command/export-command.js +18 -10
  30. package/dist/commands/api-command/export-command.js.map +1 -1
  31. package/dist/commands/cliproxy/resolve-lifecycle-port.d.ts +4 -1
  32. package/dist/commands/cliproxy/resolve-lifecycle-port.d.ts.map +1 -1
  33. package/dist/commands/cliproxy/resolve-lifecycle-port.js +1 -2
  34. package/dist/commands/cliproxy/resolve-lifecycle-port.js.map +1 -1
  35. package/dist/commands/config-channels-command.d.ts +24 -0
  36. package/dist/commands/config-channels-command.d.ts.map +1 -0
  37. package/dist/commands/config-channels-command.js +359 -0
  38. package/dist/commands/config-channels-command.js.map +1 -0
  39. package/dist/commands/config-command-options.d.ts.map +1 -1
  40. package/dist/commands/config-command-options.js +15 -0
  41. package/dist/commands/config-command-options.js.map +1 -1
  42. package/dist/commands/config-command.d.ts +26 -1
  43. package/dist/commands/config-command.d.ts.map +1 -1
  44. package/dist/commands/config-command.js +56 -33
  45. package/dist/commands/config-command.js.map +1 -1
  46. package/dist/commands/help-command.d.ts.map +1 -1
  47. package/dist/commands/help-command.js +26 -1
  48. package/dist/commands/help-command.js.map +1 -1
  49. package/dist/config/unified-config-loader.d.ts +11 -1
  50. package/dist/config/unified-config-loader.d.ts.map +1 -1
  51. package/dist/config/unified-config-loader.js +67 -1
  52. package/dist/config/unified-config-loader.js.map +1 -1
  53. package/dist/config/unified-config-types.d.ts +24 -1
  54. package/dist/config/unified-config-types.d.ts.map +1 -1
  55. package/dist/config/unified-config-types.js +13 -2
  56. package/dist/config/unified-config-types.js.map +1 -1
  57. package/dist/cursor/daemon-process-ownership.d.ts.map +1 -1
  58. package/dist/cursor/daemon-process-ownership.js +19 -6
  59. package/dist/cursor/daemon-process-ownership.js.map +1 -1
  60. package/dist/management/shared-manager.d.ts +1 -1
  61. package/dist/management/shared-manager.d.ts.map +1 -1
  62. package/dist/management/shared-manager.js.map +1 -1
  63. package/dist/ui/assets/{accounts-DD2Lodv2.js → accounts-DhwOlckG.js} +1 -1
  64. package/dist/ui/assets/{alert-dialog-D21M1jKW.js → alert-dialog-fT8u0tgK.js} +1 -1
  65. package/dist/ui/assets/{api-0PqftiRh.js → api-BitgYTMM.js} +1 -1
  66. package/dist/ui/assets/{auth-section-DEfVaTF2.js → auth-section-DpKCQvRx.js} +1 -1
  67. package/dist/ui/assets/{backups-section-7CMRUK1w.js → backups-section-BkJ3lKJW.js} +1 -1
  68. package/dist/ui/assets/channels-BvyQSPqh.js +1 -0
  69. package/dist/ui/assets/{checkbox-qsMNLxyT.js → checkbox-tb_qCjl5.js} +1 -1
  70. package/dist/ui/assets/{claude-extension-QCVnlD5g.js → claude-extension-DuiChqGK.js} +1 -1
  71. package/dist/ui/assets/{cliproxy-B4Ndh1vO.js → cliproxy-Bs_4fnWM.js} +1 -1
  72. package/dist/ui/assets/{cliproxy-ai-providers-D09jj99_.js → cliproxy-ai-providers-M_GEfD5K.js} +1 -1
  73. package/dist/ui/assets/{cliproxy-control-panel-CJZ3OH7x.js → cliproxy-control-panel-DA_wPmGH.js} +1 -1
  74. package/dist/ui/assets/{confirm-dialog-DDPaIGt-.js → confirm-dialog-i_HasZdE.js} +1 -1
  75. package/dist/ui/assets/{copilot-CZ5-TuDW.js → copilot-VdMiiNbo.js} +2 -2
  76. package/dist/ui/assets/{cursor-CLCJ8JwP.js → cursor-ChVclQ9Y.js} +1 -1
  77. package/dist/ui/assets/{droid-C4ndg4ND.js → droid-BxW4BW_B.js} +2 -2
  78. package/dist/ui/assets/{globalenv-section-u25Fhfko.js → globalenv-section-BYoCEvDq.js} +1 -1
  79. package/dist/ui/assets/{health-S3_uVEZI.js → health-DL7I4uEa.js} +1 -1
  80. package/dist/ui/assets/icons-EbXCUruD.js +1 -0
  81. package/dist/ui/assets/{index-BIWNdVva.js → index-BRY2NQqb.js} +12 -12
  82. package/dist/ui/assets/index-CzllrOuG.css +1 -0
  83. package/dist/ui/assets/{index-ainA13O4.js → index-D7MsmHFk.js} +1 -1
  84. package/dist/ui/assets/{index-DjUsD3ce.js → index-DUlJ_g8Y.js} +1 -1
  85. package/dist/ui/assets/{index-DW1sWpmn.js → index-Dp1VYByi.js} +1 -1
  86. package/dist/ui/assets/index-o3dRX4_U.js +1 -0
  87. package/dist/ui/assets/{proxy-status-widget-D65cBYFv.js → proxy-status-widget-BKym_sUO.js} +1 -1
  88. package/dist/ui/assets/{searchable-select-C2HgCDJL.js → searchable-select-Dcnq9qM7.js} +1 -1
  89. package/dist/ui/assets/{separator-BlhCtc9l.js → separator-CYVPjAkH.js} +1 -1
  90. package/dist/ui/assets/{shared-DZkW1mRU.js → shared-B5J2CPHp.js} +1 -1
  91. package/dist/ui/assets/{switch-JdcUdtbh.js → switch-CcS0XD-4.js} +1 -1
  92. package/dist/ui/assets/{updates-DtnC6jcH.js → updates-DPkHXIaq.js} +1 -1
  93. package/dist/ui/index.html +3 -3
  94. package/dist/utils/claude-config-path.d.ts +6 -0
  95. package/dist/utils/claude-config-path.d.ts.map +1 -1
  96. package/dist/utils/claude-config-path.js +11 -2
  97. package/dist/utils/claude-config-path.js.map +1 -1
  98. package/dist/utils/claude-detector.d.ts +15 -1
  99. package/dist/utils/claude-detector.d.ts.map +1 -1
  100. package/dist/utils/claude-detector.js +100 -1
  101. package/dist/utils/claude-detector.js.map +1 -1
  102. package/dist/utils/error-manager.d.ts +1 -1
  103. package/dist/utils/error-manager.d.ts.map +1 -1
  104. package/dist/utils/error-manager.js.map +1 -1
  105. package/dist/utils/websearch/status.d.ts +1 -0
  106. package/dist/utils/websearch/status.d.ts.map +1 -1
  107. package/dist/utils/websearch/status.js +12 -8
  108. package/dist/utils/websearch/status.js.map +1 -1
  109. package/dist/web-server/middleware/auth-middleware.d.ts.map +1 -1
  110. package/dist/web-server/middleware/auth-middleware.js +3 -4
  111. package/dist/web-server/middleware/auth-middleware.js.map +1 -1
  112. package/dist/web-server/routes/channels-routes.d.ts +3 -0
  113. package/dist/web-server/routes/channels-routes.d.ts.map +1 -0
  114. package/dist/web-server/routes/channels-routes.js +164 -0
  115. package/dist/web-server/routes/channels-routes.js.map +1 -0
  116. package/dist/web-server/routes/index.d.ts.map +1 -1
  117. package/dist/web-server/routes/index.js +2 -0
  118. package/dist/web-server/routes/index.js.map +1 -1
  119. package/dist/web-server/usage/cliproxy-usage-syncer.d.ts +5 -2
  120. package/dist/web-server/usage/cliproxy-usage-syncer.d.ts.map +1 -1
  121. package/dist/web-server/usage/cliproxy-usage-syncer.js +5 -5
  122. package/dist/web-server/usage/cliproxy-usage-syncer.js.map +1 -1
  123. package/package.json +1 -1
  124. package/dist/ui/assets/icons-BwsSbo2z.js +0 -1
  125. package/dist/ui/assets/index-Bp4s-Led.css +0 -1
  126. package/dist/ui/assets/index-DgtKMxaq.js +0 -1
@@ -0,0 +1,658 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getOfficialChannelsDocsSummary = exports.getOfficialChannelMacOSHelp = exports.getOfficialChannelClearTokenHelp = exports.getOfficialChannelTokenHelp = exports.getOfficialChannelsLegacyEnableHelp = exports.getOfficialChannelsSetHelp = exports.getOfficialChannelsRuntimeNote = exports.getOfficialChannelsSectionDescription = exports.getOfficialChannelConfiguredPlaceholder = exports.getOfficialChannelDefaultTokenPlaceholder = exports.isOfficialChannelTokenRequired = exports.getTokenValueLabel = exports.getChannelConfigSelectionLabel = exports.getOfficialChannelsSupportedProfiles = exports.resolveLegacyDiscordSelection = exports.isOfficialChannelSelectionValid = exports.getOfficialChannelChoices = exports.expandOfficialChannelSelection = exports.buildOfficialChannelsLaunchPreview = exports.buildOfficialChannelsReadinessSummary = exports.buildOfficialChannelSetupSummary = exports.getOfficialChannelReadyMessage = exports.getOfficialChannelUnavailableReason = exports.getOfficialChannelSummary = exports.getOfficialChannelStateDirEnvKey = exports.getOfficialChannelEnvDir = exports.officialChannelRequiresMacOS = exports.getOfficialChannelEnvKey = exports.getOfficialChannelPluginSpec = exports.getOfficialChannelDisplayName = exports.getOfficialChannelManualSetupCommands = exports.getOfficialChannelTokenIds = exports.resolveOfficialChannelsLaunchPlan = exports.buildOfficialChannelsArgs = exports.getOfficialChannelsEnvironmentStatus = exports.getOfficialChannelsAccountStatusCaveat = exports.getOfficialChannelsSupportMessage = exports.getOfficialChannelsStateScopeMessage = exports.resolveOfficialChannelsAuthSummary = exports.resolveOfficialChannelsVersionSummary = exports.hasExplicitPermissionOverride = exports.hasExplicitChannelsFlag = exports.normalizeOfficialChannelIds = exports.isOfficialChannelId = exports.isDiscordChannelsSessionSupported = exports.isMacOS = exports.isBunAvailable = exports.MINIMUM_OFFICIAL_CHANNELS_CLAUDE_VERSION = exports.OFFICIAL_CHANNEL_IDS = exports.OFFICIAL_CHANNELS = void 0;
4
+ exports.getOfficialChannelsSelectionSummary = exports.getOfficialChannelsPermissionBypassMessage = exports.getOfficialChannelsNoSelectionMessage = exports.getOfficialChannelsCompatibilityMessage = exports.getOfficialChannelsBunMissingMessage = exports.getOfficialChannelTokenMissingMessage = exports.getOfficialChannelsExplicitOverrideMessage = exports.getOfficialChannelSyncSkipReason = exports.getOfficialChannelSyncFailureMessage = void 0;
5
+ const child_process_1 = require("child_process");
6
+ const claude_detector_1 = require("../utils/claude-detector");
7
+ exports.OFFICIAL_CHANNELS = {
8
+ telegram: {
9
+ id: 'telegram',
10
+ displayName: 'Telegram',
11
+ pluginSpec: 'plugin:telegram@claude-plugins-official',
12
+ envKey: 'TELEGRAM_BOT_TOKEN',
13
+ envDir: 'telegram',
14
+ stateDirEnvKey: 'TELEGRAM_STATE_DIR',
15
+ manualSetupCommands: [
16
+ '/plugin install telegram@claude-plugins-official',
17
+ '/telegram:configure <token>',
18
+ '/telegram:access pair <code>',
19
+ '/telegram:access policy allowlist',
20
+ ],
21
+ },
22
+ discord: {
23
+ id: 'discord',
24
+ displayName: 'Discord',
25
+ pluginSpec: 'plugin:discord@claude-plugins-official',
26
+ envKey: 'DISCORD_BOT_TOKEN',
27
+ envDir: 'discord',
28
+ stateDirEnvKey: 'DISCORD_STATE_DIR',
29
+ manualSetupCommands: [
30
+ '/plugin install discord@claude-plugins-official',
31
+ '/discord:configure <token>',
32
+ '/discord:access pair <code>',
33
+ '/discord:access policy allowlist',
34
+ ],
35
+ },
36
+ imessage: {
37
+ id: 'imessage',
38
+ displayName: 'iMessage',
39
+ pluginSpec: 'plugin:imessage@claude-plugins-official',
40
+ envDir: 'imessage',
41
+ stateDirEnvKey: 'IMESSAGE_STATE_DIR',
42
+ requiresMacOS: true,
43
+ manualSetupCommands: [
44
+ '/plugin install imessage@claude-plugins-official',
45
+ '/imessage:access allow +15551234567',
46
+ ],
47
+ },
48
+ };
49
+ exports.OFFICIAL_CHANNEL_IDS = Object.keys(exports.OFFICIAL_CHANNELS);
50
+ exports.MINIMUM_OFFICIAL_CHANNELS_CLAUDE_VERSION = '2.1.80';
51
+ function isBunAvailable() {
52
+ const result = (0, child_process_1.spawnSync)('bun', ['--version'], { stdio: 'ignore' });
53
+ return result.status === 0;
54
+ }
55
+ exports.isBunAvailable = isBunAvailable;
56
+ function isMacOS() {
57
+ return process.platform === 'darwin';
58
+ }
59
+ exports.isMacOS = isMacOS;
60
+ function isDiscordChannelsSessionSupported(target, profileType) {
61
+ return target === 'claude' && (profileType === 'default' || profileType === 'account');
62
+ }
63
+ exports.isDiscordChannelsSessionSupported = isDiscordChannelsSessionSupported;
64
+ function isOfficialChannelId(value) {
65
+ return value in exports.OFFICIAL_CHANNELS;
66
+ }
67
+ exports.isOfficialChannelId = isOfficialChannelId;
68
+ function normalizeOfficialChannelIds(values) {
69
+ const seen = new Set();
70
+ const normalized = [];
71
+ for (const channelId of exports.OFFICIAL_CHANNEL_IDS) {
72
+ if (!values.includes(channelId) || seen.has(channelId)) {
73
+ continue;
74
+ }
75
+ seen.add(channelId);
76
+ normalized.push(channelId);
77
+ }
78
+ return normalized;
79
+ }
80
+ exports.normalizeOfficialChannelIds = normalizeOfficialChannelIds;
81
+ function hasExplicitChannelsFlag(args) {
82
+ return args.some((arg) => arg === '--channels' || arg.startsWith('--channels='));
83
+ }
84
+ exports.hasExplicitChannelsFlag = hasExplicitChannelsFlag;
85
+ function hasExplicitPermissionOverride(args) {
86
+ return args.some((arg) => arg === '--allow-dangerously-skip-permissions' ||
87
+ arg === '--dangerously-skip-permissions' ||
88
+ arg === '--permission-mode' ||
89
+ arg.startsWith('--permission-mode='));
90
+ }
91
+ exports.hasExplicitPermissionOverride = hasExplicitPermissionOverride;
92
+ function isTeamOrEnterpriseSubscription(subscriptionType) {
93
+ const normalized = subscriptionType?.trim().toLowerCase() ?? '';
94
+ return normalized.includes('team') || normalized.includes('enterprise');
95
+ }
96
+ function resolveOfficialChannelsVersionSummary(version) {
97
+ if (!version) {
98
+ return {
99
+ current: null,
100
+ minimum: exports.MINIMUM_OFFICIAL_CHANNELS_CLAUDE_VERSION,
101
+ state: 'unknown',
102
+ message: `Unable to detect Claude Code version. Official Channels require v${exports.MINIMUM_OFFICIAL_CHANNELS_CLAUDE_VERSION}+.`,
103
+ };
104
+ }
105
+ if ((0, claude_detector_1.isClaudeCliVersionAtLeast)(version, exports.MINIMUM_OFFICIAL_CHANNELS_CLAUDE_VERSION)) {
106
+ return {
107
+ current: version,
108
+ minimum: exports.MINIMUM_OFFICIAL_CHANNELS_CLAUDE_VERSION,
109
+ state: 'supported',
110
+ message: `Claude Code v${version}`,
111
+ };
112
+ }
113
+ return {
114
+ current: version,
115
+ minimum: exports.MINIMUM_OFFICIAL_CHANNELS_CLAUDE_VERSION,
116
+ state: 'unsupported',
117
+ message: `Official Channels require Claude Code v${exports.MINIMUM_OFFICIAL_CHANNELS_CLAUDE_VERSION}+ (found v${version}).`,
118
+ };
119
+ }
120
+ exports.resolveOfficialChannelsVersionSummary = resolveOfficialChannelsVersionSummary;
121
+ function resolveOfficialChannelsAuthSummary(authStatus) {
122
+ if (!authStatus) {
123
+ return {
124
+ checked: false,
125
+ loggedIn: false,
126
+ authMethod: null,
127
+ subscriptionType: null,
128
+ state: 'unknown',
129
+ eligible: false,
130
+ message: 'Unable to verify Claude auth status. Official Channels require claude.ai login.',
131
+ };
132
+ }
133
+ if (!authStatus.loggedIn) {
134
+ return {
135
+ checked: true,
136
+ loggedIn: false,
137
+ authMethod: authStatus.authMethod ?? null,
138
+ subscriptionType: authStatus.subscriptionType ?? null,
139
+ state: 'ineligible',
140
+ eligible: false,
141
+ message: 'Official Channels require claude.ai login. Run `claude auth login` first.',
142
+ };
143
+ }
144
+ if (authStatus.authMethod !== 'claude.ai') {
145
+ return {
146
+ checked: true,
147
+ loggedIn: true,
148
+ authMethod: authStatus.authMethod ?? null,
149
+ subscriptionType: authStatus.subscriptionType ?? null,
150
+ state: 'ineligible',
151
+ eligible: false,
152
+ message: `Official Channels require claude.ai login. Current auth method: ${authStatus.authMethod ?? 'unknown'}.`,
153
+ };
154
+ }
155
+ return {
156
+ checked: true,
157
+ loggedIn: true,
158
+ authMethod: authStatus.authMethod,
159
+ subscriptionType: authStatus.subscriptionType ?? null,
160
+ state: 'eligible',
161
+ eligible: true,
162
+ message: 'Authenticated with claude.ai.',
163
+ ...(isTeamOrEnterpriseSubscription(authStatus.subscriptionType ?? null)
164
+ ? {
165
+ orgRequirementMessage: 'Team and Enterprise orgs also need channels enabled by an admin before messages will arrive.',
166
+ }
167
+ : {}),
168
+ };
169
+ }
170
+ exports.resolveOfficialChannelsAuthSummary = resolveOfficialChannelsAuthSummary;
171
+ function getOfficialChannelsStateScopeMessage() {
172
+ return "Telegram and Discord tokens live in Claude's machine-level channel state under ~/.claude/channels/. Native Claude sessions share that state unless you manually override the official *_STATE_DIR variables.";
173
+ }
174
+ exports.getOfficialChannelsStateScopeMessage = getOfficialChannelsStateScopeMessage;
175
+ function getOfficialChannelsSupportMessage() {
176
+ return 'Works only for native Claude default/account sessions. It does not apply to API, OAuth, or Droid targets such as `ccs glm`, `ccs gemini`, `ccs codex`, or `ccs --target droid`.';
177
+ }
178
+ exports.getOfficialChannelsSupportMessage = getOfficialChannelsSupportMessage;
179
+ function getOfficialChannelsAccountStatusCaveat() {
180
+ return 'Dashboard status reflects the base Claude install visible to the current CCS process. Isolated native account sessions can still differ until that account signs in with claude.ai.';
181
+ }
182
+ exports.getOfficialChannelsAccountStatusCaveat = getOfficialChannelsAccountStatusCaveat;
183
+ function getOfficialChannelsEnvironmentStatus(authEnvOverrides) {
184
+ return {
185
+ bunInstalled: isBunAvailable(),
186
+ supportedProfiles: getOfficialChannelsSupportedProfiles(),
187
+ stateScopeMessage: getOfficialChannelsStateScopeMessage(),
188
+ claudeVersion: resolveOfficialChannelsVersionSummary((0, claude_detector_1.getClaudeCliVersion)()),
189
+ auth: resolveOfficialChannelsAuthSummary((0, claude_detector_1.getClaudeAuthStatus)(authEnvOverrides)),
190
+ };
191
+ }
192
+ exports.getOfficialChannelsEnvironmentStatus = getOfficialChannelsEnvironmentStatus;
193
+ function buildOfficialChannelsArgs(args, channels, includePermissionBypass) {
194
+ const nextArgs = [
195
+ ...args,
196
+ '--channels',
197
+ ...channels.map((channel) => exports.OFFICIAL_CHANNELS[channel].pluginSpec),
198
+ ];
199
+ if (includePermissionBypass) {
200
+ nextArgs.push('--dangerously-skip-permissions');
201
+ }
202
+ return nextArgs;
203
+ }
204
+ exports.buildOfficialChannelsArgs = buildOfficialChannelsArgs;
205
+ function resolveOfficialChannelsLaunchPlan(input) {
206
+ const { args, config, target, profileType, environment, channelReadiness } = input;
207
+ const skippedMessages = [];
208
+ if (config.selected.length === 0) {
209
+ return {
210
+ applied: false,
211
+ wantsPermissionBypass: false,
212
+ appliedChannels: [],
213
+ skippedMessages,
214
+ };
215
+ }
216
+ if (!isDiscordChannelsSessionSupported(target, profileType)) {
217
+ return {
218
+ applied: false,
219
+ wantsPermissionBypass: false,
220
+ appliedChannels: [],
221
+ skippedMessages: [getOfficialChannelsCompatibilityMessage()],
222
+ };
223
+ }
224
+ if (hasExplicitChannelsFlag(args)) {
225
+ return {
226
+ applied: false,
227
+ wantsPermissionBypass: false,
228
+ appliedChannels: [],
229
+ skippedMessages,
230
+ };
231
+ }
232
+ if (!environment.bunInstalled) {
233
+ return {
234
+ applied: false,
235
+ wantsPermissionBypass: false,
236
+ appliedChannels: [],
237
+ skippedMessages: ['Official Channels auto-enable skipped because Bun is not installed.'],
238
+ };
239
+ }
240
+ if (environment.claudeVersion.state !== 'supported') {
241
+ return {
242
+ applied: false,
243
+ wantsPermissionBypass: false,
244
+ appliedChannels: [],
245
+ skippedMessages: [environment.claudeVersion.message],
246
+ };
247
+ }
248
+ if (environment.auth.state !== 'eligible') {
249
+ return {
250
+ applied: false,
251
+ wantsPermissionBypass: false,
252
+ appliedChannels: [],
253
+ skippedMessages: [environment.auth.message],
254
+ };
255
+ }
256
+ const appliedChannels = [];
257
+ for (const channelId of normalizeOfficialChannelIds(config.selected)) {
258
+ const channel = exports.OFFICIAL_CHANNELS[channelId];
259
+ if (channel.requiresMacOS && !isMacOS()) {
260
+ skippedMessages.push(`${channel.displayName} auto-enable skipped because it requires macOS.`);
261
+ continue;
262
+ }
263
+ if (!channelReadiness[channelId]) {
264
+ skippedMessages.push(channel.envKey
265
+ ? `${channel.displayName} auto-enable skipped because ${channel.envKey} is not configured.`
266
+ : `${channel.displayName} auto-enable skipped because it is not ready on this machine.`);
267
+ continue;
268
+ }
269
+ appliedChannels.push(channelId);
270
+ }
271
+ return {
272
+ applied: appliedChannels.length > 0,
273
+ wantsPermissionBypass: config.unattended && !hasExplicitPermissionOverride(args),
274
+ appliedChannels,
275
+ skippedMessages,
276
+ };
277
+ }
278
+ exports.resolveOfficialChannelsLaunchPlan = resolveOfficialChannelsLaunchPlan;
279
+ function getOfficialChannelTokenIds() {
280
+ return exports.OFFICIAL_CHANNEL_IDS.filter((channelId) => Boolean(exports.OFFICIAL_CHANNELS[channelId].envKey));
281
+ }
282
+ exports.getOfficialChannelTokenIds = getOfficialChannelTokenIds;
283
+ function getOfficialChannelManualSetupCommands(channelId) {
284
+ return exports.OFFICIAL_CHANNELS[channelId].manualSetupCommands;
285
+ }
286
+ exports.getOfficialChannelManualSetupCommands = getOfficialChannelManualSetupCommands;
287
+ function getOfficialChannelDisplayName(channelId) {
288
+ return exports.OFFICIAL_CHANNELS[channelId].displayName;
289
+ }
290
+ exports.getOfficialChannelDisplayName = getOfficialChannelDisplayName;
291
+ function getOfficialChannelPluginSpec(channelId) {
292
+ return exports.OFFICIAL_CHANNELS[channelId].pluginSpec;
293
+ }
294
+ exports.getOfficialChannelPluginSpec = getOfficialChannelPluginSpec;
295
+ function getOfficialChannelEnvKey(channelId) {
296
+ return exports.OFFICIAL_CHANNELS[channelId].envKey;
297
+ }
298
+ exports.getOfficialChannelEnvKey = getOfficialChannelEnvKey;
299
+ function officialChannelRequiresMacOS(channelId) {
300
+ return Boolean(exports.OFFICIAL_CHANNELS[channelId].requiresMacOS);
301
+ }
302
+ exports.officialChannelRequiresMacOS = officialChannelRequiresMacOS;
303
+ function getOfficialChannelEnvDir(channelId) {
304
+ return exports.OFFICIAL_CHANNELS[channelId].envDir;
305
+ }
306
+ exports.getOfficialChannelEnvDir = getOfficialChannelEnvDir;
307
+ function getOfficialChannelStateDirEnvKey(channelId) {
308
+ return exports.OFFICIAL_CHANNELS[channelId].stateDirEnvKey;
309
+ }
310
+ exports.getOfficialChannelStateDirEnvKey = getOfficialChannelStateDirEnvKey;
311
+ function getOfficialChannelSummary(channelId) {
312
+ if (channelId === 'telegram') {
313
+ return 'Bot token required. Runtime-only while Claude is running; Telegram pairing and access policy still happen in Claude.';
314
+ }
315
+ if (channelId === 'discord') {
316
+ return 'Bot token required. Runtime-only while Claude is running; Discord pairing and access policy still happen in Claude.';
317
+ }
318
+ return 'macOS-only. Runtime-only while Claude is running; plugin install, Full Disk Access, and the first-reply Automation approval are still required.';
319
+ }
320
+ exports.getOfficialChannelSummary = getOfficialChannelSummary;
321
+ function getOfficialChannelUnavailableReason(channelId) {
322
+ if (channelId === 'imessage' && !isMacOS()) {
323
+ return 'Requires macOS.';
324
+ }
325
+ return undefined;
326
+ }
327
+ exports.getOfficialChannelUnavailableReason = getOfficialChannelUnavailableReason;
328
+ function getOfficialChannelReadyMessage(channelId) {
329
+ if (channelId === 'imessage') {
330
+ return isMacOS()
331
+ ? 'Needs Claude-side install plus Full Disk Access and the first-reply Automation prompt.'
332
+ : 'Unavailable on this platform.';
333
+ }
334
+ const envKey = getOfficialChannelEnvKey(channelId);
335
+ return envKey
336
+ ? `${envKey} must be configured before CCS can auto-enable this channel. Claude-side pairing and access policy are still required.`
337
+ : 'Claude-side setup required.';
338
+ }
339
+ exports.getOfficialChannelReadyMessage = getOfficialChannelReadyMessage;
340
+ function buildOfficialChannelSetupSummary(channel) {
341
+ if (!channel.selected) {
342
+ return {
343
+ state: 'not_selected',
344
+ label: 'Not selected',
345
+ detail: 'CCS will not auto-add this channel until you turn it on here.',
346
+ nextStep: 'Turn this channel on if you want CCS to add it on supported native Claude runs.',
347
+ };
348
+ }
349
+ if (channel.unavailableReason) {
350
+ return {
351
+ state: 'unavailable',
352
+ label: channel.unavailableReason,
353
+ detail: `${channel.displayName} is selected, but this machine cannot use it right now.`,
354
+ nextStep: 'Turn it off here, or switch to a supported machine before relying on it.',
355
+ };
356
+ }
357
+ if (channel.id === 'imessage') {
358
+ return {
359
+ state: 'needs_claude_setup',
360
+ label: 'Claude-side setup remaining',
361
+ detail: 'CCS can add iMessage on the next native Claude run, but plugin install, sender allowlist, Full Disk Access, and the first-reply Automation prompt are still local steps.',
362
+ nextStep: 'Complete the one-time Claude and macOS setup below before relying on iMessage.',
363
+ };
364
+ }
365
+ const envKey = getOfficialChannelEnvKey(channel.id);
366
+ if (channel.requiresToken && !channel.tokenAvailable) {
367
+ return {
368
+ state: 'needs_token',
369
+ label: 'Needs token',
370
+ detail: `${envKey} is missing. CCS cannot auto-add ${channel.displayName} until you save it here or provide it in the current CCS process env.`,
371
+ nextStep: `Save ${envKey} below, or export it before launching CCS.`,
372
+ };
373
+ }
374
+ const sourceDetail = channel.savedInClaudeState
375
+ ? `${envKey} is saved in Claude channel state.`
376
+ : `${envKey} is available from the current CCS process env.`;
377
+ return {
378
+ state: 'ready',
379
+ label: channel.savedInClaudeState
380
+ ? 'Ready for next native run'
381
+ : 'Ready from current CCS process env',
382
+ detail: channel.savedInClaudeState
383
+ ? `${sourceDetail}${channel.processEnvAvailable ? ` The current CCS process env also provides ${envKey}.` : ''} CCS can auto-add ${channel.displayName} on the next supported native Claude run. Claude-side pairing and access policy still happen in Claude.`
384
+ : `${sourceDetail} CCS can auto-add ${channel.displayName} on the next supported native Claude run. Claude-side pairing and access policy still happen in Claude.`,
385
+ nextStep: channel.savedInClaudeState
386
+ ? 'Run `ccs` or a native Claude account profile. Claude-side pairing and access policy may still be required.'
387
+ : 'Run CCS from this same env, or save the token here if you want persistent Claude state.',
388
+ };
389
+ }
390
+ exports.buildOfficialChannelSetupSummary = buildOfficialChannelSetupSummary;
391
+ function buildOfficialChannelsReadinessSummary(input) {
392
+ const { config, environment, channels } = input;
393
+ if (config.selected.length === 0) {
394
+ return {
395
+ state: 'needs_setup',
396
+ title: 'No channels selected yet',
397
+ message: 'Choose at least one official channel before CCS can auto-add it on supported native Claude runs.',
398
+ nextStep: 'Turn on Telegram, Discord, and/or iMessage below.',
399
+ blockers: ['Select at least one channel for auto-enable.'],
400
+ };
401
+ }
402
+ const blockers = [];
403
+ if (!environment.bunInstalled) {
404
+ blockers.push('Install Bun to use Anthropic official channel plugins.');
405
+ }
406
+ if (environment.claudeVersion.state !== 'supported') {
407
+ blockers.push(environment.claudeVersion.message);
408
+ }
409
+ if (environment.auth.state !== 'eligible') {
410
+ blockers.push(environment.auth.message);
411
+ }
412
+ const selectedChannels = channels.filter((channel) => channel.selected);
413
+ const missingTokenChannels = selectedChannels.filter((channel) => channel.requiresToken && !channel.tokenAvailable);
414
+ if (missingTokenChannels.length > 0) {
415
+ blockers.push(`Missing bot token for ${missingTokenChannels.map((channel) => channel.displayName).join(', ')}.`);
416
+ }
417
+ if (blockers.length > 0) {
418
+ return {
419
+ state: 'needs_setup',
420
+ title: 'Needs setup before CCS can auto-add these channels',
421
+ message: blockers[0] ?? 'Official Channels still need setup.',
422
+ nextStep: 'Resolve the blockers below, then launch a supported native Claude session again.',
423
+ blockers,
424
+ };
425
+ }
426
+ const limitedNotes = [];
427
+ const unavailableSelectedChannels = selectedChannels.filter((channel) => Boolean(channel.unavailableReason));
428
+ if (unavailableSelectedChannels.length > 0) {
429
+ limitedNotes.push(`${unavailableSelectedChannels.map((channel) => channel.displayName).join(', ')} cannot run on this machine.`);
430
+ }
431
+ if (selectedChannels.some((channel) => channel.id === 'imessage')) {
432
+ limitedNotes.push('iMessage still needs Claude-side install plus local macOS permissions before it is dependable.');
433
+ }
434
+ if (limitedNotes.length > 0) {
435
+ return {
436
+ state: 'limited',
437
+ title: 'Selected, but some channels still need manual setup',
438
+ message: limitedNotes[0] ?? 'Some selected channels still need additional setup.',
439
+ nextStep: 'Review the channel cards below before relying on this from a native Claude run.',
440
+ blockers: limitedNotes,
441
+ };
442
+ }
443
+ const selectedLabels = selectedChannels.map((channel) => channel.displayName).join(', ');
444
+ const envOnlyChannels = selectedChannels.filter((channel) => channel.processEnvAvailable && !channel.savedInClaudeState);
445
+ return {
446
+ state: 'ready',
447
+ title: 'Ready for the next native Claude run',
448
+ message: envOnlyChannels.length === 0
449
+ ? `CCS can auto-add ${selectedLabels} the next time you run \`ccs\` or a native Claude account profile.`
450
+ : envOnlyChannels.length === selectedChannels.length
451
+ ? `CCS can auto-add ${selectedLabels} on the next supported native Claude run from this same CCS process env.`
452
+ : `CCS can auto-add ${selectedLabels} on the next supported native Claude run. ${envOnlyChannels.map((channel) => channel.displayName).join(', ')} currently depends on this same CCS process env.`,
453
+ nextStep: envOnlyChannels.length === 0
454
+ ? 'Claude-side pairing and access policy may still be required inside Claude, but CCS-side prerequisites are ready.'
455
+ : envOnlyChannels.length === selectedChannels.length
456
+ ? 'Run CCS from this same env, or save the token here first if you want persistent Claude channel state.'
457
+ : 'Save env-only tokens here if you want persistent Claude channel state across shells.',
458
+ blockers: [],
459
+ };
460
+ }
461
+ exports.buildOfficialChannelsReadinessSummary = buildOfficialChannelsReadinessSummary;
462
+ function buildOfficialChannelsLaunchPreview(input) {
463
+ const { config, environment, channels } = input;
464
+ if (config.selected.length === 0) {
465
+ return {
466
+ state: 'disabled',
467
+ title: 'Nothing will be auto-added yet',
468
+ detail: 'Turn on at least one channel below before `ccs` can add official channel flags.',
469
+ command: 'ccs',
470
+ appendedArgs: [],
471
+ appliedChannels: [],
472
+ permissionBypassIncluded: false,
473
+ skippedMessages: [],
474
+ };
475
+ }
476
+ const channelReadiness = Object.fromEntries(channels.map((channel) => [
477
+ channel.id,
478
+ !channel.unavailableReason &&
479
+ (channel.id === 'imessage' || !channel.requiresToken || channel.tokenAvailable),
480
+ ]));
481
+ const plan = resolveOfficialChannelsLaunchPlan({
482
+ args: [],
483
+ config,
484
+ target: 'claude',
485
+ profileType: 'default',
486
+ environment,
487
+ channelReadiness,
488
+ });
489
+ const appendedArgs = plan.applied
490
+ ? buildOfficialChannelsArgs([], plan.appliedChannels, plan.wantsPermissionBypass)
491
+ : [];
492
+ if (!plan.applied) {
493
+ return {
494
+ state: 'blocked',
495
+ title: 'Running `ccs` now will not auto-add channels',
496
+ detail: plan.skippedMessages[0] ??
497
+ 'Official Channels are selected, but this machine is not ready to auto-add them yet.',
498
+ command: 'ccs',
499
+ appendedArgs: [],
500
+ appliedChannels: [],
501
+ permissionBypassIncluded: false,
502
+ skippedMessages: plan.skippedMessages,
503
+ };
504
+ }
505
+ const appliedLabels = plan.appliedChannels.map((channelId) => getOfficialChannelDisplayName(channelId));
506
+ if (plan.skippedMessages.length > 0) {
507
+ return {
508
+ state: 'partial',
509
+ title: `CCS will auto-add ${appliedLabels.join(', ')}`,
510
+ detail: 'Some selected channels are still skipped. Review the notes below before relying on the rest.',
511
+ command: 'ccs',
512
+ appendedArgs,
513
+ appliedChannels: plan.appliedChannels,
514
+ permissionBypassIncluded: plan.wantsPermissionBypass,
515
+ skippedMessages: plan.skippedMessages,
516
+ };
517
+ }
518
+ return {
519
+ state: 'ready',
520
+ title: `CCS will auto-add ${appliedLabels.join(', ')}`,
521
+ detail: plan.wantsPermissionBypass
522
+ ? 'Running `ccs` will add the selected official channels and skip permission prompts for that launch.'
523
+ : 'Running `ccs` will add the selected official channels automatically on this machine.',
524
+ command: 'ccs',
525
+ appendedArgs,
526
+ appliedChannels: plan.appliedChannels,
527
+ permissionBypassIncluded: plan.wantsPermissionBypass,
528
+ skippedMessages: [],
529
+ };
530
+ }
531
+ exports.buildOfficialChannelsLaunchPreview = buildOfficialChannelsLaunchPreview;
532
+ function expandOfficialChannelSelection(selection) {
533
+ if (selection.trim().toLowerCase() === 'all') {
534
+ return [...exports.OFFICIAL_CHANNEL_IDS];
535
+ }
536
+ return normalizeOfficialChannelIds(selection
537
+ .split(',')
538
+ .map((value) => value.trim().toLowerCase())
539
+ .filter(Boolean));
540
+ }
541
+ exports.expandOfficialChannelSelection = expandOfficialChannelSelection;
542
+ function getOfficialChannelChoices() {
543
+ return exports.OFFICIAL_CHANNEL_IDS.join(', ');
544
+ }
545
+ exports.getOfficialChannelChoices = getOfficialChannelChoices;
546
+ function isOfficialChannelSelectionValid(selection) {
547
+ const parsed = selection
548
+ .split(',')
549
+ .map((value) => value.trim().toLowerCase())
550
+ .filter(Boolean);
551
+ return (parsed.length > 0 && parsed.every((value) => value === 'all' || isOfficialChannelId(value)));
552
+ }
553
+ exports.isOfficialChannelSelectionValid = isOfficialChannelSelectionValid;
554
+ function resolveLegacyDiscordSelection(enabled) {
555
+ return enabled ? ['discord'] : [];
556
+ }
557
+ exports.resolveLegacyDiscordSelection = resolveLegacyDiscordSelection;
558
+ function getOfficialChannelsSupportedProfiles() {
559
+ return ['default', 'account'];
560
+ }
561
+ exports.getOfficialChannelsSupportedProfiles = getOfficialChannelsSupportedProfiles;
562
+ function getChannelConfigSelectionLabel(selected) {
563
+ if (selected.length === 0) {
564
+ return 'None';
565
+ }
566
+ return selected.map((channelId) => getOfficialChannelDisplayName(channelId)).join(', ');
567
+ }
568
+ exports.getChannelConfigSelectionLabel = getChannelConfigSelectionLabel;
569
+ function getTokenValueLabel(channelId) {
570
+ return getOfficialChannelEnvKey(channelId) ?? '';
571
+ }
572
+ exports.getTokenValueLabel = getTokenValueLabel;
573
+ function isOfficialChannelTokenRequired(channelId) {
574
+ return Boolean(getOfficialChannelEnvKey(channelId));
575
+ }
576
+ exports.isOfficialChannelTokenRequired = isOfficialChannelTokenRequired;
577
+ function getOfficialChannelDefaultTokenPlaceholder(channelId) {
578
+ const envKey = getOfficialChannelEnvKey(channelId);
579
+ return envKey ? `Paste ${envKey}` : '';
580
+ }
581
+ exports.getOfficialChannelDefaultTokenPlaceholder = getOfficialChannelDefaultTokenPlaceholder;
582
+ function getOfficialChannelConfiguredPlaceholder(channelId) {
583
+ const envKey = getOfficialChannelEnvKey(channelId);
584
+ return envKey ? `Configured. Enter a new ${envKey} to replace it.` : '';
585
+ }
586
+ exports.getOfficialChannelConfiguredPlaceholder = getOfficialChannelConfiguredPlaceholder;
587
+ function getOfficialChannelsSectionDescription() {
588
+ return 'Auto-enable Anthropic official channels for compatible Claude sessions. CCS only stores selection in config.yaml; Claude keeps machine-level channel state under ~/.claude/channels/.';
589
+ }
590
+ exports.getOfficialChannelsSectionDescription = getOfficialChannelsSectionDescription;
591
+ function getOfficialChannelsRuntimeNote() {
592
+ return 'CCS does not persist a global Claude channels default. It only injects runtime flags for the current Claude session when prerequisites are met.';
593
+ }
594
+ exports.getOfficialChannelsRuntimeNote = getOfficialChannelsRuntimeNote;
595
+ function getOfficialChannelsSetHelp() {
596
+ return `Set selected channels with --set <csv>. Supported values: ${getOfficialChannelChoices()}, or all.`;
597
+ }
598
+ exports.getOfficialChannelsSetHelp = getOfficialChannelsSetHelp;
599
+ function getOfficialChannelsLegacyEnableHelp() {
600
+ return 'Legacy aliases: --enable adds Discord, --disable removes Discord.';
601
+ }
602
+ exports.getOfficialChannelsLegacyEnableHelp = getOfficialChannelsLegacyEnableHelp;
603
+ function getOfficialChannelTokenHelp() {
604
+ return 'Use --set-token <channel>=<token>. If no channel is provided, Discord is assumed for backward compatibility.';
605
+ }
606
+ exports.getOfficialChannelTokenHelp = getOfficialChannelTokenHelp;
607
+ function getOfficialChannelClearTokenHelp() {
608
+ return 'Use --clear-token to clear all saved bot tokens, or --clear-token <channel> to clear one token.';
609
+ }
610
+ exports.getOfficialChannelClearTokenHelp = getOfficialChannelClearTokenHelp;
611
+ function getOfficialChannelMacOSHelp() {
612
+ return 'iMessage needs macOS Full Disk Access plus the Messages automation prompt on first reply.';
613
+ }
614
+ exports.getOfficialChannelMacOSHelp = getOfficialChannelMacOSHelp;
615
+ function getOfficialChannelsDocsSummary() {
616
+ return 'Supported official channels are Telegram, Discord, and iMessage.';
617
+ }
618
+ exports.getOfficialChannelsDocsSummary = getOfficialChannelsDocsSummary;
619
+ function getOfficialChannelSyncFailureMessage(channelId, targetPath) {
620
+ return `${getOfficialChannelDisplayName(channelId)} auto-enable skipped: failed to sync channel env to ${targetPath}`;
621
+ }
622
+ exports.getOfficialChannelSyncFailureMessage = getOfficialChannelSyncFailureMessage;
623
+ function getOfficialChannelSyncSkipReason(channelId) {
624
+ return `${getOfficialChannelDisplayName(channelId)} auto-enable skipped.`;
625
+ }
626
+ exports.getOfficialChannelSyncSkipReason = getOfficialChannelSyncSkipReason;
627
+ function getOfficialChannelsExplicitOverrideMessage() {
628
+ return undefined;
629
+ }
630
+ exports.getOfficialChannelsExplicitOverrideMessage = getOfficialChannelsExplicitOverrideMessage;
631
+ function getOfficialChannelTokenMissingMessage(channelId) {
632
+ const envKey = getOfficialChannelEnvKey(channelId);
633
+ return envKey
634
+ ? `${getOfficialChannelDisplayName(channelId)} auto-enable skipped because ${envKey} is not configured.`
635
+ : `${getOfficialChannelDisplayName(channelId)} auto-enable skipped because it is not ready.`;
636
+ }
637
+ exports.getOfficialChannelTokenMissingMessage = getOfficialChannelTokenMissingMessage;
638
+ function getOfficialChannelsBunMissingMessage() {
639
+ return 'Official Channels auto-enable skipped because Bun is not installed.';
640
+ }
641
+ exports.getOfficialChannelsBunMissingMessage = getOfficialChannelsBunMissingMessage;
642
+ function getOfficialChannelsCompatibilityMessage() {
643
+ return 'Official Channels auto-enable only works for native Claude default/account sessions. It does not apply to `ccs glm`, other API/OAuth profiles, or Droid targets.';
644
+ }
645
+ exports.getOfficialChannelsCompatibilityMessage = getOfficialChannelsCompatibilityMessage;
646
+ function getOfficialChannelsNoSelectionMessage() {
647
+ return 'No official channels selected.';
648
+ }
649
+ exports.getOfficialChannelsNoSelectionMessage = getOfficialChannelsNoSelectionMessage;
650
+ function getOfficialChannelsPermissionBypassMessage() {
651
+ return '--dangerously-skip-permissions';
652
+ }
653
+ exports.getOfficialChannelsPermissionBypassMessage = getOfficialChannelsPermissionBypassMessage;
654
+ function getOfficialChannelsSelectionSummary(selected) {
655
+ return selected.map((channelId) => getOfficialChannelDisplayName(channelId));
656
+ }
657
+ exports.getOfficialChannelsSelectionSummary = getOfficialChannelsSelectionSummary;
658
+ //# sourceMappingURL=official-channels-runtime.js.map