@foxden-app/foxclaw 0.12.0 → 0.13.1

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/CHANGELOG.md +34 -0
  2. package/dist/antigravity/account_ui.d.ts +34 -0
  3. package/dist/antigravity/account_ui.js +354 -0
  4. package/dist/antigravity/adapter.js +1 -1
  5. package/dist/antigravity/auth.d.ts +4 -1
  6. package/dist/antigravity/auth.js +17 -5
  7. package/dist/antigravity/controller.d.ts +3 -108
  8. package/dist/antigravity/controller.js +2 -2129
  9. package/dist/antigravity/conversation_ui.d.ts +56 -0
  10. package/dist/antigravity/conversation_ui.js +509 -0
  11. package/dist/antigravity/ui_callbacks.d.ts +6 -0
  12. package/dist/antigravity/ui_callbacks.js +6 -0
  13. package/dist/bridge/unified_bridge.d.ts +114 -0
  14. package/dist/bridge/unified_bridge.js +1343 -0
  15. package/dist/channels/bridge_messaging_router.d.ts +8 -4
  16. package/dist/channels/bridge_messaging_router.js +15 -4
  17. package/dist/channels/telegram/telegram_messaging_port.d.ts +16 -0
  18. package/dist/channels/telegram/telegram_messaging_port.js +22 -2
  19. package/dist/channels/text_actions.d.ts +14 -0
  20. package/dist/channels/text_actions.js +48 -0
  21. package/dist/channels/weixin/weixin_channel_adapter.d.ts +3 -4
  22. package/dist/channels/weixin/weixin_channel_adapter.js +2 -2
  23. package/dist/channels/weixin/weixin_messaging_port.d.ts +16 -1
  24. package/dist/channels/weixin/weixin_messaging_port.js +34 -7
  25. package/dist/codex_app/activity.d.ts +62 -0
  26. package/dist/codex_app/activity.js +418 -0
  27. package/dist/codex_app/adapter.d.ts +2 -2
  28. package/dist/codex_app/adapter.js +55 -25
  29. package/dist/codex_app/backend_ui.d.ts +4 -0
  30. package/dist/codex_app/backend_ui.js +48 -0
  31. package/dist/codex_app/client.js +0 -12
  32. package/dist/controller/access.d.ts +1 -11
  33. package/dist/controller/access.js +1 -33
  34. package/dist/controller/activity.d.ts +1 -62
  35. package/dist/controller/activity.js +2 -418
  36. package/dist/controller/auth_errors.d.ts +11 -0
  37. package/dist/controller/auth_errors.js +124 -0
  38. package/dist/controller/auth_files.d.ts +13 -0
  39. package/dist/controller/auth_files.js +156 -0
  40. package/dist/controller/auth_presentation.d.ts +77 -0
  41. package/dist/controller/auth_presentation.js +697 -0
  42. package/dist/controller/auth_quota_service.d.ts +27 -0
  43. package/dist/controller/auth_quota_service.js +151 -0
  44. package/dist/controller/controller.d.ts +30 -56
  45. package/dist/controller/controller.js +181 -3497
  46. package/dist/controller/interactions.d.ts +74 -0
  47. package/dist/controller/interactions.js +560 -0
  48. package/dist/controller/local_usage_service.d.ts +19 -0
  49. package/dist/controller/local_usage_service.js +62 -0
  50. package/dist/controller/native_panel_service.d.ts +55 -0
  51. package/dist/controller/native_panel_service.js +214 -0
  52. package/dist/controller/native_panels.d.ts +61 -0
  53. package/dist/controller/native_panels.js +784 -0
  54. package/dist/controller/shared_helpers.d.ts +53 -0
  55. package/dist/controller/shared_helpers.js +399 -0
  56. package/dist/controller/state_types.d.ts +390 -0
  57. package/dist/controller/state_types.js +82 -0
  58. package/dist/controller/turn_rendering.d.ts +22 -0
  59. package/dist/controller/turn_rendering.js +288 -0
  60. package/dist/core/access.d.ts +11 -0
  61. package/dist/core/access.js +33 -0
  62. package/dist/core/attachment_files.d.ts +13 -0
  63. package/dist/core/attachment_files.js +180 -0
  64. package/dist/core/attachment_types.d.ts +22 -0
  65. package/dist/core/attachment_types.js +1 -0
  66. package/dist/core/attachments.d.ts +5 -3
  67. package/dist/core/attachments.js +2 -2
  68. package/dist/core/backend_registry.d.ts +22 -0
  69. package/dist/core/backend_registry.js +50 -0
  70. package/dist/core/backend_ui.d.ts +28 -0
  71. package/dist/core/backend_ui.js +1 -0
  72. package/dist/core/channel_events.d.ts +48 -0
  73. package/dist/core/channel_events.js +1 -0
  74. package/dist/core/channel_port.d.ts +52 -8
  75. package/dist/core/engine_spi.d.ts +19 -4
  76. package/dist/core/listener_scope.d.ts +11 -0
  77. package/dist/core/listener_scope.js +10 -0
  78. package/dist/core/message_text.d.ts +2 -0
  79. package/dist/core/message_text.js +28 -0
  80. package/dist/core/network_errors.d.ts +1 -0
  81. package/dist/core/network_errors.js +23 -0
  82. package/dist/core/orchestrator.d.ts +53 -24
  83. package/dist/core/orchestrator.js +855 -507
  84. package/dist/core/queued_engine_input.d.ts +12 -0
  85. package/dist/core/queued_engine_input.js +16 -0
  86. package/dist/core/runtime_supervisor.d.ts +19 -0
  87. package/dist/core/runtime_supervisor.js +45 -0
  88. package/dist/core/scope_operations.d.ts +7 -0
  89. package/dist/core/scope_operations.js +19 -0
  90. package/dist/core/stream_preview.js +21 -9
  91. package/dist/dsh/adapter.js +18 -5
  92. package/dist/dsh/backend.d.ts +7 -0
  93. package/dist/dsh/backend.js +21 -0
  94. package/dist/dsh/runtime.d.ts +0 -1
  95. package/dist/dsh/runtime.js +4 -13
  96. package/dist/dsh/ui.d.ts +8 -8
  97. package/dist/dsh/ui.js +1 -1
  98. package/dist/main.js +55 -43
  99. package/dist/opencode/adapter.js +28 -9
  100. package/dist/opencode/controller.js +1 -1
  101. package/dist/store/channel_inbox.d.ts +14 -0
  102. package/dist/store/channel_inbox.js +21 -0
  103. package/dist/store/database.d.ts +7 -3
  104. package/dist/store/database.js +7 -2
  105. package/dist/store/task_journal.d.ts +32 -0
  106. package/dist/store/task_journal.js +70 -0
  107. package/dist/telegram/api.d.ts +2 -2
  108. package/dist/telegram/api.js +10 -28
  109. package/dist/telegram/gateway.d.ts +13 -27
  110. package/dist/telegram/gateway.js +86 -43
  111. package/dist/telegram/media.d.ts +2 -34
  112. package/dist/telegram/media.js +1 -180
  113. package/dist/telegram/task_preview.d.ts +13 -0
  114. package/dist/telegram/task_preview.js +92 -0
  115. package/dist/telegram/task_result.d.ts +2 -0
  116. package/dist/telegram/task_result.js +12 -0
  117. package/dist/telegram/text.d.ts +1 -1
  118. package/dist/telegram/text.js +2 -27
  119. package/dist/types.d.ts +1 -1
  120. package/dist/update.d.ts +27 -2
  121. package/dist/update.js +81 -28
  122. package/docs/release.md +13 -11
  123. package/docs/zh/architecture-review.md +106 -0
  124. package/docs/zh/release.md +13 -11
  125. package/docs/zh/telegram-experience.md +40 -0
  126. package/package.json +8 -5
@@ -0,0 +1,390 @@
1
+ import type { CollaborationModeValue, PendingApprovalRecord, RuntimeStatus } from '../types.js';
2
+ import { type AuthSyncClusterAuditResult } from '../auth/cross_node_sync.js';
3
+ import type { SelfUpdateStatus } from '../update.js';
4
+ import { type TurnOutputKind } from './activity.js';
5
+ import { type TelegramRenderRoute } from '../telegram/rendering.js';
6
+ import { type ObservedTurnCursor } from './observer.js';
7
+ import { type SessionLogCursor } from './session_observer.js';
8
+ import type { CodexAuthCandidateState } from '../store/database.js';
9
+ import type { TurnInput } from '../codex_app/client.js';
10
+ export declare const AUTH_DELETE_REASON_NEEDS_REPAIR = "needs_repair";
11
+ export declare const RESTART_PREVIEW_RECOVERY_RETRY_DELAYS_MS: number[];
12
+ export declare const TOOL_ARCHIVE_MAX_LINES = 12;
13
+ export declare const TOOL_ARCHIVE_LINE_LIMIT = 240;
14
+ export type AuthProactiveRefreshStatus = NonNullable<RuntimeStatus['authProactiveRefresh']>;
15
+ export interface CoreCoordinator {
16
+ canSelfUpdate?: () => boolean;
17
+ authCandidateUpdated?: (runtimeId: string, candidateName: string) => Promise<void>;
18
+ authCandidateDeleted?: (runtimeId: string, candidateName: string, reason?: string | null) => Promise<void>;
19
+ recoverAuthCandidate?: (runtimeId: string, candidateName: string, options?: {
20
+ crossNode?: boolean;
21
+ }) => Promise<boolean>;
22
+ acquireAuthRefreshLease?: (reason: string) => Promise<{
23
+ ok: boolean;
24
+ leaseId: string | null;
25
+ reason?: string | null;
26
+ }>;
27
+ releaseAuthRefreshLease?: (leaseId: string | null) => Promise<void>;
28
+ getAuthSyncStatus?: () => RuntimeStatus['authSync'];
29
+ authSyncSafeAll?: () => Promise<{
30
+ localSynced: number;
31
+ localSkipped: number;
32
+ sent: number;
33
+ skipped: number;
34
+ }>;
35
+ authSyncPushAll?: () => Promise<{
36
+ sent: number;
37
+ skipped: number;
38
+ }>;
39
+ authSyncTest?: () => Promise<{
40
+ sent: number;
41
+ replied: number;
42
+ missing: string[];
43
+ }>;
44
+ authSyncAudit?: () => Promise<AuthSyncClusterAuditResult | null>;
45
+ statusUpdated?: (status: RuntimeStatus) => void;
46
+ getServiceStatus?: () => Promise<{
47
+ currentVersion?: string;
48
+ bots: NonNullable<RuntimeStatus['bots']>;
49
+ weixinRuntime?: RuntimeStatus['weixinRuntime'];
50
+ authMirror?: RuntimeStatus['authMirror'];
51
+ authSync?: RuntimeStatus['authSync'];
52
+ authProactiveRefresh?: AuthProactiveRefreshStatus | null;
53
+ lastUpdate?: SelfUpdateStatus | null;
54
+ }>;
55
+ selfUpdateCompleted?: (status: SelfUpdateStatus) => void;
56
+ }
57
+ export type ServiceRuntimeStatus = NonNullable<Awaited<ReturnType<NonNullable<CoreCoordinator['getServiceStatus']>>>>;
58
+ export interface RenderedTelegramMessage {
59
+ messageId: number;
60
+ text: string;
61
+ richHtml?: string | null;
62
+ richFailedForText?: string | null;
63
+ }
64
+ export interface ActiveTurnSegment {
65
+ itemId: string;
66
+ phase: string | null;
67
+ outputKind: TurnOutputKind;
68
+ isPlan: boolean;
69
+ text: string;
70
+ completed: boolean;
71
+ startedAtMs: number;
72
+ completedAtMs: number | null;
73
+ messages: RenderedTelegramMessage[];
74
+ voiceSnippetId: string | null;
75
+ }
76
+ export interface ToolBatchCounts {
77
+ files: number;
78
+ searches: number;
79
+ edits: number;
80
+ commands: number;
81
+ }
82
+ export interface ToolBatchState {
83
+ openCallIds: Set<string>;
84
+ actionKeys: Set<string>;
85
+ actionLines: string[];
86
+ counts: ToolBatchCounts;
87
+ finalizeTimer: NodeJS.Timeout | null;
88
+ }
89
+ export interface ArchivedStatusContent {
90
+ text: string;
91
+ html: string | null;
92
+ }
93
+ export interface SelfUpdateBroadcastSummary {
94
+ state: 'sent' | 'pending' | 'disabled';
95
+ sent: number;
96
+ peers: string[];
97
+ }
98
+ export interface ToolDescriptor {
99
+ kind: keyof ToolBatchCounts;
100
+ key: string;
101
+ line: string;
102
+ }
103
+ export interface ActiveTurn {
104
+ scopeId: string;
105
+ chatId: string;
106
+ chatType: string;
107
+ topicId: number | null;
108
+ renderRoute: TelegramRenderRoute;
109
+ isObserved: boolean;
110
+ threadId: string;
111
+ turnId: string;
112
+ queuedInputId: string | null;
113
+ previewMessageId: number;
114
+ previewActive: boolean;
115
+ draftId: number | null;
116
+ draftText: string | null;
117
+ richDraftDisabled: boolean;
118
+ buffer: string;
119
+ finalText: string | null;
120
+ interruptRequested: boolean;
121
+ authRetry: AuthRetryContext | null;
122
+ collaborationMode: CollaborationModeValue;
123
+ statusMessageText: string | null;
124
+ statusNeedsRebase: boolean;
125
+ segments: ActiveTurnSegment[];
126
+ reasoningActiveCount: number;
127
+ pendingApprovalKinds: Set<PendingApprovalRecord['kind']>;
128
+ toolBatch: ToolBatchState | null;
129
+ pendingArchivedStatus: ArchivedStatusContent | null;
130
+ renderRetryTimer: NodeJS.Timeout | null;
131
+ lastStreamFlushAt: number;
132
+ renderRequested: boolean;
133
+ forceStatusFlush: boolean;
134
+ forceStreamFlush: boolean;
135
+ renderTask: Promise<void> | null;
136
+ completion: Promise<void>;
137
+ archivedMessageIds: number[];
138
+ resolver: () => void;
139
+ }
140
+ export interface ObservedThreadWatcher {
141
+ scopeId: string;
142
+ chatId: string;
143
+ chatType: string;
144
+ topicId: number | null;
145
+ threadId: string;
146
+ mode: 'app_snapshot' | 'session_file';
147
+ timer: NodeJS.Timeout | null;
148
+ cursor: ObservedTurnCursor | null;
149
+ activeTurnId: string | null;
150
+ waitingOnApproval: boolean;
151
+ sessionPath: string | null;
152
+ sessionOffset: number;
153
+ sessionRemainder: string;
154
+ sessionCursor: SessionLogCursor;
155
+ stopped: boolean;
156
+ }
157
+ export interface PendingUserInputOption {
158
+ label: string;
159
+ description: string | null;
160
+ }
161
+ export interface PendingUserInputQuestion {
162
+ id: string;
163
+ header: string | null;
164
+ question: string;
165
+ isOther: boolean;
166
+ isSecret: boolean;
167
+ options: PendingUserInputOption[];
168
+ }
169
+ export type PendingUserInputStatus = 'pending' | 'submitted' | 'resolved' | 'interrupted';
170
+ export type ServerRequestId = string | number;
171
+ export interface PendingUserInputRequest {
172
+ localId: string;
173
+ serverRequestId: ServerRequestId;
174
+ chatId: string;
175
+ threadId: string;
176
+ turnId: string | null;
177
+ itemId: string;
178
+ questions: PendingUserInputQuestion[];
179
+ answers: Map<string, string>;
180
+ messageId: number | null;
181
+ status: PendingUserInputStatus;
182
+ createdAt: number;
183
+ submittedAt: number | null;
184
+ }
185
+ export interface PendingMcpElicitation {
186
+ localId: string;
187
+ serverRequestId: ServerRequestId;
188
+ chatId: string;
189
+ threadId: string;
190
+ turnId: string | null;
191
+ serverName: string;
192
+ mode: 'form' | 'url';
193
+ message: string;
194
+ url: string | null;
195
+ requestedSchema: unknown;
196
+ content: unknown;
197
+ messageId: number | null;
198
+ createdAt: number;
199
+ }
200
+ export interface PendingPlanImplementation {
201
+ localId: string;
202
+ scopeId: string;
203
+ chatId: string;
204
+ chatType: string;
205
+ topicId: number | null;
206
+ threadId: string;
207
+ turnId: string;
208
+ cwd: string | null;
209
+ planMarkdown: string;
210
+ messageId: number | null;
211
+ createdAt: number;
212
+ }
213
+ export interface CodexAuthCandidate {
214
+ name: string;
215
+ path: string;
216
+ isCurrent: boolean;
217
+ disabled: boolean;
218
+ state: CodexAuthCandidateState;
219
+ mtimeMs: number;
220
+ credentialKind: 'chatgpt' | 'api-key' | 'invalid';
221
+ credentialLastRefreshMs: number | null;
222
+ credentialExpiresAtMs: number | null;
223
+ quota: CodexAuthQuotaSnapshot | null;
224
+ }
225
+ export interface CodexAuthQuotaSnapshot {
226
+ capturedAtMs: number;
227
+ accountId?: string | null;
228
+ quotaIdentityId?: string | null;
229
+ planType: string | null;
230
+ primaryWindowDurationMins: number | null;
231
+ primaryRemainingPercent: number | null;
232
+ primaryResetsAt: number | null;
233
+ secondaryWindowDurationMins: number | null;
234
+ secondaryRemainingPercent: number | null;
235
+ secondaryResetsAt: number | null;
236
+ }
237
+ export interface CodexAuthQuotaIdentity {
238
+ accountId: string;
239
+ quotaIdentityId: string;
240
+ }
241
+ export interface CodexAuthState {
242
+ authDir: string;
243
+ authPath: string;
244
+ currentTargetPath: string | null;
245
+ currentLabel: string | null;
246
+ candidates: CodexAuthCandidate[];
247
+ }
248
+ export interface CodexAuthSwitchResult {
249
+ fromLabel: string | null;
250
+ toLabel: string;
251
+ }
252
+ export interface CodexAuthSwitchOutcome extends CodexAuthSwitchResult {
253
+ ok: boolean;
254
+ candidateName: string;
255
+ recovered: boolean;
256
+ error: string | null;
257
+ validationFailureKind: CodexAuthRotationReason | null;
258
+ restoredPrevious: boolean;
259
+ autoDeleted: boolean;
260
+ deleteRestarted: boolean;
261
+ }
262
+ export interface CodexAuthRepairDisposition {
263
+ deleted: boolean;
264
+ restarted: boolean;
265
+ }
266
+ export interface CodexAuthRefreshAllResult {
267
+ refreshed: string[];
268
+ skipped: string[];
269
+ failed: Array<{
270
+ name: string;
271
+ error: string;
272
+ }>;
273
+ }
274
+ export interface CodexAuthClusterAuditOutcome {
275
+ audit: AuthSyncClusterAuditResult;
276
+ refresh: CodexAuthRefreshAllResult;
277
+ push: {
278
+ sent: number;
279
+ skipped: number;
280
+ };
281
+ refreshSkippedReason: string | null;
282
+ }
283
+ export interface CodexAuthSelection {
284
+ candidate: CodexAuthCandidate;
285
+ fromLabel: string | null;
286
+ toLabel: string;
287
+ }
288
+ export type CodexAuthCandidateHealth = 'disabled' | 'needs_repair' | 'ready' | 'low' | 'exhausted' | 'stale' | 'unknown' | 'api-key' | 'invalid';
289
+ export type CodexAuthListFilter = 'all' | 'enabled' | 'attention';
290
+ export interface CodexAuthListView {
291
+ offset: number;
292
+ pageSize: number;
293
+ filter: CodexAuthListFilter;
294
+ searchTerm: string | null;
295
+ }
296
+ export interface PendingAuthChoiceList extends CodexAuthListView {
297
+ localId: string;
298
+ chatId: string;
299
+ messageId: number | null;
300
+ candidates: CodexAuthCandidate[];
301
+ createdAt: number;
302
+ }
303
+ export interface PendingThreadRename {
304
+ scopeId: string;
305
+ threadId: string;
306
+ messageId: number | null;
307
+ createdAt: number;
308
+ }
309
+ export interface PendingThreadNewCwd {
310
+ scopeId: string;
311
+ messageId: number | null;
312
+ cwdToCreate: string | null;
313
+ confirmationMessageId: number | null;
314
+ createdAt: number;
315
+ }
316
+ export interface PendingAuthAdd {
317
+ loginId: string;
318
+ scopeId: string;
319
+ name: string;
320
+ path: string;
321
+ previousTargetPath: string | null;
322
+ mode: 'add' | 'repair';
323
+ createdAt: number;
324
+ }
325
+ export interface AuthRetryContext {
326
+ input: TurnInput[];
327
+ threadId: string;
328
+ cwd: string | null;
329
+ chatId: string;
330
+ chatType: string;
331
+ topicId: number | null;
332
+ collaborationMode: CollaborationModeValue | null | undefined;
333
+ failedAuthTargets: Set<string>;
334
+ }
335
+ export type CodexAuthRotationReason = 'auth_invalid' | 'quota_limited';
336
+ export interface PendingAuthRotation {
337
+ scopeId: string;
338
+ reason: string;
339
+ reasonKind: CodexAuthRotationReason;
340
+ retry: AuthRetryContext | null;
341
+ }
342
+ export interface RemoteControlStatusState {
343
+ status: string;
344
+ installationId: string | null;
345
+ environmentId: string | null;
346
+ }
347
+ export type ApprovalAction = 'accept' | 'session' | 'deny';
348
+ export type McpElicitationAction = 'accept' | 'decline' | 'cancel';
349
+ export declare class UserFacingError extends Error {
350
+ }
351
+ export declare const OBSERVED_THREAD_POLL_MS = 1500;
352
+ export declare const OBSERVED_CLI_USER_LABEL = "codex-cli-user";
353
+ export declare const DEFAULT_COLLABORATION_MODE: CollaborationModeValue;
354
+ export declare const CODEX_LOCAL_USAGE_REFRESH_MS: number;
355
+ export declare const CODEX_LOCAL_USAGE_SNAPSHOT_FILENAME = "codex-local-usage.json";
356
+ export declare const CODEX_AUTH_QUOTA_SNAPSHOT_FILENAME = "codex-auth-quota.json";
357
+ export declare const CODEX_AUTH_LIST_PAGE_SIZE = 8;
358
+ export declare const CODEX_AUTH_LOW_QUOTA_PERCENT = 10;
359
+ export declare const CODEX_AUTH_STALE_CREDENTIAL_DAYS = 8;
360
+ export declare const CODEX_AUTH_PROACTIVE_REFRESH_DAYS = 8;
361
+ export declare const CODEX_AUTH_PROACTIVE_REFRESH_INTERVAL_MS: number;
362
+ export declare const CODEX_AUTH_PROACTIVE_REFRESH_INITIAL_DELAY_MS: number;
363
+ export declare const USER_INPUT_SUBMITTED_NOTICE_MS = 90000;
364
+ export declare const SELF_UPDATE_STATUS_POLL_MS = 1000;
365
+ export declare const ATTACHMENT_BATCH_MERGE_WINDOW_MS = 120000;
366
+ export declare const PLAN_IMPLEMENTATION_CODING_MESSAGE = "Implement the plan.";
367
+ export declare const PLAN_IMPLEMENTATION_CLEAR_CONTEXT_PREFIX = "A previous agent produced the plan below to accomplish the user's task. Implement the plan in a fresh context. Treat the plan as the source of user intent, re-read files as needed, and carry the work through implementation and verification.";
368
+ export interface HelpCommandEntry {
369
+ key: string;
370
+ line: string;
371
+ }
372
+ export declare const PINNED_HELP_COMMANDS: HelpCommandEntry[];
373
+ export declare const DYNAMIC_HELP_COMMANDS: HelpCommandEntry[];
374
+ export interface RichAuthCandidateRow {
375
+ index: string;
376
+ quotaA: string;
377
+ quotaAReset: string;
378
+ quotaB: string;
379
+ quotaBReset: string;
380
+ name: string;
381
+ current: boolean;
382
+ plan: string;
383
+ health: string;
384
+ refresh: string;
385
+ expiry: string;
386
+ risk: string;
387
+ enabled: boolean | null;
388
+ }
389
+ export type AuthSyncRuntimeStatus = NonNullable<RuntimeStatus['authSync']>;
390
+ export type AuthSyncRuntimeEvent = NonNullable<AuthSyncRuntimeStatus['recentEvents']>[number];
@@ -0,0 +1,82 @@
1
+ export const AUTH_DELETE_REASON_NEEDS_REPAIR = 'needs_repair';
2
+ export const RESTART_PREVIEW_RECOVERY_RETRY_DELAYS_MS = [3000, 7000, 15_000, 30_000, 45_000, 60_000, 60_000, 60_000];
3
+ export const TOOL_ARCHIVE_MAX_LINES = 12;
4
+ export const TOOL_ARCHIVE_LINE_LIMIT = 240;
5
+ export class UserFacingError extends Error {
6
+ }
7
+ export const OBSERVED_THREAD_POLL_MS = 1500;
8
+ export const OBSERVED_CLI_USER_LABEL = 'codex-cli-user';
9
+ export const DEFAULT_COLLABORATION_MODE = 'default';
10
+ export const CODEX_LOCAL_USAGE_REFRESH_MS = 30 * 60_000;
11
+ export const CODEX_LOCAL_USAGE_SNAPSHOT_FILENAME = 'codex-local-usage.json';
12
+ export const CODEX_AUTH_QUOTA_SNAPSHOT_FILENAME = 'codex-auth-quota.json';
13
+ export const CODEX_AUTH_LIST_PAGE_SIZE = 8;
14
+ export const CODEX_AUTH_LOW_QUOTA_PERCENT = 10;
15
+ export const CODEX_AUTH_STALE_CREDENTIAL_DAYS = 8;
16
+ export const CODEX_AUTH_PROACTIVE_REFRESH_DAYS = 8;
17
+ export const CODEX_AUTH_PROACTIVE_REFRESH_INTERVAL_MS = 60 * 60_000;
18
+ export const CODEX_AUTH_PROACTIVE_REFRESH_INITIAL_DELAY_MS = 5 * 60_000;
19
+ export const USER_INPUT_SUBMITTED_NOTICE_MS = 90_000;
20
+ export const SELF_UPDATE_STATUS_POLL_MS = 1000;
21
+ export const ATTACHMENT_BATCH_MERGE_WINDOW_MS = 120_000;
22
+ export const PLAN_IMPLEMENTATION_CODING_MESSAGE = 'Implement the plan.';
23
+ export const PLAN_IMPLEMENTATION_CLEAR_CONTEXT_PREFIX = 'A previous agent produced the plan below to accomplish the user\'s task. Implement the plan in a fresh context. Treat the plan as the source of user intent, re-read files as needed, and carry the work through implementation and verification.';
24
+ export const PINNED_HELP_COMMANDS = [
25
+ { key: 'help', line: '/help' },
26
+ { key: 'setup', line: '/setup' },
27
+ { key: 'status', line: '/status' },
28
+ { key: 'threads', line: '/threads [query]' },
29
+ { key: 'auth', line: '/auth' },
30
+ ];
31
+ export const DYNAMIC_HELP_COMMANDS = [
32
+ { key: 'fast', line: '/fast <on|off|toggle>' },
33
+ { key: 'active', line: '/active <steer|queue>' },
34
+ { key: 'rich', line: '/rich' },
35
+ { key: 'account', line: '/account' },
36
+ { key: 'quota', line: '/quota' },
37
+ { key: 'update', line: '/update' },
38
+ { key: 'login_device', line: '/login_device' },
39
+ { key: 'login_cancel', line: '/login_cancel' },
40
+ { key: 'cli', line: '/cli' },
41
+ { key: 'threads_archived', line: '/threads archived [query]' },
42
+ { key: 'open', line: '/open <n>' },
43
+ { key: 'goal', line: '/goal [objective|pause|resume|done|budget <tokens|off>|clear confirm]' },
44
+ { key: 'history', line: '/history [limit]' },
45
+ { key: 'files', line: '/files <query>' },
46
+ { key: 'remote', line: '/remote' },
47
+ { key: 'watch', line: '/watch' },
48
+ { key: 'unwatch', line: '/unwatch' },
49
+ { key: 'steer', line: '/steer <message>' },
50
+ { key: 'takeover', line: '/takeover <message>' },
51
+ { key: 'queue', line: '/queue <message>' },
52
+ { key: 'new', line: '/new [cwd]' },
53
+ { key: 'mode', line: '/mode [default|plan]' },
54
+ { key: 'plan', line: '/plan' },
55
+ { key: 'agent', line: '/agent' },
56
+ { key: 'auth_reload', line: '/auth_reload' },
57
+ { key: 'logout', line: '/logout confirm' },
58
+ { key: 'loaded', line: '/loaded' },
59
+ { key: 'skills', line: '/skills [query]' },
60
+ { key: 'skill', line: '/skill <name>' },
61
+ { key: 'hooks', line: '/hooks' },
62
+ { key: 'plugins', line: '/plugins [query]' },
63
+ { key: 'plugin', line: '/plugin <name>' },
64
+ { key: 'apps', line: '/apps' },
65
+ { key: 'features', line: '/features' },
66
+ { key: 'config', line: '/config' },
67
+ { key: 'requirements', line: '/requirements' },
68
+ { key: 'provider', line: '/provider' },
69
+ { key: 'mcp', line: '/mcp' },
70
+ { key: 'review', line: '/review' },
71
+ { key: 'fork', line: '/fork [name]' },
72
+ { key: 'undo', line: '/undo [n]' },
73
+ { key: 'rename', line: '/rename <name>' },
74
+ { key: 'compact', line: '/compact' },
75
+ { key: 'archive', line: '/archive' },
76
+ { key: 'models', line: '/models' },
77
+ { key: 'permissions', line: '/permissions' },
78
+ { key: 'permissions_arg', line: '/permissions <read-only|default|full-access>' },
79
+ { key: 'reveal', line: '/reveal' },
80
+ { key: 'where', line: '/where' },
81
+ { key: 'interrupt', line: '/interrupt' },
82
+ ];
@@ -0,0 +1,22 @@
1
+ import { type RawExecCommandEvent, type TurnOutputKind } from './activity.js';
2
+ import type { AppLocale } from '../types.js';
3
+ import { ActiveTurn, ActiveTurnSegment, ToolBatchState, ToolBatchCounts, ArchivedStatusContent, ToolDescriptor } from './state_types.js';
4
+ export declare function ensureTurnSegment(active: ActiveTurn, itemId: string, phase?: string | null, outputKind?: TurnOutputKind, isPlan?: boolean): ActiveTurnSegment;
5
+ export declare function renderCollapsedCommentary(locale: AppLocale, segments: ActiveTurnSegment[]): string;
6
+ export declare function formatClockTimestamp(timestampMs: number): string;
7
+ export declare function createToolBatchState(): ToolBatchState;
8
+ export declare function incrementToolBatchCount(counts: ToolBatchCounts, kind: keyof ToolBatchCounts): void;
9
+ export declare function formatToolBatchStatus(locale: AppLocale, counts: ToolBatchCounts, actionLines: string[], inProgress: boolean): string;
10
+ export declare function renderArchivedToolBatchStatus(locale: AppLocale, counts: ToolBatchCounts, actionLines: string[]): ArchivedStatusContent;
11
+ export declare function formatToolBatchHeading(locale: AppLocale, counts: ToolBatchCounts, inProgress: boolean): string;
12
+ export declare function formatToolBatchCountParts(locale: AppLocale, counts: ToolBatchCounts): string[];
13
+ export declare function pluralize(count: number, noun: string): string;
14
+ export declare function describeExecCommand(event: RawExecCommandEvent): ToolDescriptor[];
15
+ export declare function describeParsedCommand(entry: any): ToolDescriptor | null;
16
+ export declare function compactPath(value: unknown): string | null;
17
+ export declare function renderShellCommand(command: string[]): string;
18
+ export declare function truncateInline(value: string, limit: number): string;
19
+ export declare function extractLatestPlanMarkdown(active: ActiveTurn): string | null;
20
+ export declare function extractLatestPlanSegmentMarkdown(active: ActiveTurn): string | null;
21
+ export declare function extractLatestProposedPlanMarkdown(active: ActiveTurn): string | null;
22
+ export declare function extractLatestProposedPlanBlock(text: string): string | null;