auto-chrome-mcp-shared 1.1.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.
@@ -0,0 +1,802 @@
1
+ import { Tool } from '@modelcontextprotocol/sdk/types.js';
2
+
3
+ declare const DEFAULT_SERVER_PORT = 12320;
4
+ declare const HOST_NAME = "com.chromemcpscalemaker.nativehost";
5
+
6
+ declare enum NativeMessageType {
7
+ START = "start",
8
+ STARTED = "started",
9
+ STOP = "stop",
10
+ STOPPED = "stopped",
11
+ PING = "ping",
12
+ PONG = "pong",
13
+ ERROR = "error",
14
+ PROCESS_DATA = "process_data",
15
+ PROCESS_DATA_RESPONSE = "process_data_response",
16
+ CALL_TOOL = "call_tool",
17
+ CALL_TOOL_RESPONSE = "call_tool_response",
18
+ SERVER_STARTED = "server_started",
19
+ SERVER_STOPPED = "server_stopped",
20
+ ERROR_FROM_NATIVE_HOST = "error_from_native_host",
21
+ CONNECT_NATIVE = "connectNative",
22
+ ENSURE_NATIVE = "ensure_native",
23
+ PING_NATIVE = "ping_native",
24
+ DISCONNECT_NATIVE = "disconnect_native",
25
+ PORT_CONFLICT = "port_conflict"
26
+ }
27
+ interface NativeMessage<P = any, E = any> {
28
+ type?: NativeMessageType;
29
+ responseToRequestId?: string;
30
+ payload?: P;
31
+ error?: E;
32
+ }
33
+ /**
34
+ * A single element selection request from the AI.
35
+ */
36
+ interface ElementPickerRequest {
37
+ /**
38
+ * Optional stable request id. If omitted, the extension will generate one.
39
+ */
40
+ id?: string;
41
+ /**
42
+ * Short label shown to the user (e.g., "Login button").
43
+ */
44
+ name: string;
45
+ /**
46
+ * Optional longer instruction shown to the user.
47
+ */
48
+ description?: string;
49
+ }
50
+ /**
51
+ * Bounding rectangle of a picked element.
52
+ */
53
+ interface PickedElementRect {
54
+ x: number;
55
+ y: number;
56
+ width: number;
57
+ height: number;
58
+ }
59
+ /**
60
+ * Center point of a picked element.
61
+ */
62
+ interface PickedElementPoint {
63
+ x: number;
64
+ y: number;
65
+ }
66
+ /**
67
+ * A picked element that can be used with other tools (click, fill, etc.).
68
+ */
69
+ interface PickedElement {
70
+ /**
71
+ * Element ref written into window.__claudeElementMap (frame-local).
72
+ * Can be used directly with chrome_click_element, chrome_fill_or_select, etc.
73
+ */
74
+ ref: string;
75
+ /**
76
+ * Best-effort stable CSS selector.
77
+ */
78
+ selector: string;
79
+ /**
80
+ * Selector type (currently CSS only).
81
+ */
82
+ selectorType: 'css';
83
+ /**
84
+ * Bounding rect in the element's frame viewport coordinates.
85
+ */
86
+ rect: PickedElementRect;
87
+ /**
88
+ * Center point in the element's frame viewport coordinates.
89
+ * Can be used as coordinates for chrome_computer.
90
+ */
91
+ center: PickedElementPoint;
92
+ /**
93
+ * Optional text snippet to help verify the selection.
94
+ */
95
+ text?: string;
96
+ /**
97
+ * Lowercased tag name.
98
+ */
99
+ tagName?: string;
100
+ /**
101
+ * Chrome frameId for iframe targeting.
102
+ * Pass this to chrome_click_element/chrome_fill_or_select for cross-frame support.
103
+ */
104
+ frameId: number;
105
+ }
106
+ /**
107
+ * Result for a single element selection request.
108
+ */
109
+ interface ElementPickerResultItem {
110
+ /**
111
+ * The request id (matches the input request).
112
+ */
113
+ id: string;
114
+ /**
115
+ * The request name (for reference).
116
+ */
117
+ name: string;
118
+ /**
119
+ * The picked element, or null if not selected.
120
+ */
121
+ element: PickedElement | null;
122
+ /**
123
+ * Error message if selection failed for this request.
124
+ */
125
+ error?: string;
126
+ }
127
+ /**
128
+ * Result of the chrome_request_element_selection tool.
129
+ */
130
+ interface ElementPickerResult {
131
+ /**
132
+ * True if the user confirmed all selections.
133
+ */
134
+ success: boolean;
135
+ /**
136
+ * Session identifier for this picker session.
137
+ */
138
+ sessionId: string;
139
+ /**
140
+ * Timeout value used for this session.
141
+ */
142
+ timeoutMs: number;
143
+ /**
144
+ * True if the user cancelled the selection.
145
+ */
146
+ cancelled?: boolean;
147
+ /**
148
+ * True if the selection timed out.
149
+ */
150
+ timedOut?: boolean;
151
+ /**
152
+ * List of request IDs that were not selected (for debugging).
153
+ */
154
+ missingRequestIds?: string[];
155
+ /**
156
+ * Results for each requested element.
157
+ */
158
+ results: ElementPickerResultItem[];
159
+ }
160
+
161
+ declare const TOOL_NAMES: {
162
+ BROWSER: {
163
+ GET_WINDOWS_AND_TABS: string;
164
+ SEARCH_TABS_CONTENT: string;
165
+ NAVIGATE: string;
166
+ SCREENSHOT: string;
167
+ CLOSE_TABS: string;
168
+ SWITCH_TAB: string;
169
+ WEB_FETCHER: string;
170
+ CLICK: string;
171
+ FILL: string;
172
+ REQUEST_ELEMENT_SELECTION: string;
173
+ GET_INTERACTIVE_ELEMENTS: string;
174
+ NETWORK_CAPTURE: string;
175
+ NETWORK_CAPTURE_START: string;
176
+ NETWORK_CAPTURE_STOP: string;
177
+ NETWORK_REQUEST: string;
178
+ NETWORK_DEBUGGER_START: string;
179
+ NETWORK_DEBUGGER_STOP: string;
180
+ KEYBOARD: string;
181
+ HISTORY: string;
182
+ BOOKMARK_SEARCH: string;
183
+ BOOKMARK_ADD: string;
184
+ BOOKMARK_DELETE: string;
185
+ INJECT_SCRIPT: string;
186
+ SEND_COMMAND_TO_INJECT_SCRIPT: string;
187
+ JAVASCRIPT: string;
188
+ CONSOLE: string;
189
+ FILE_UPLOAD: string;
190
+ READ_PAGE: string;
191
+ COMPUTER: string;
192
+ HANDLE_DIALOG: string;
193
+ HANDLE_DOWNLOAD: string;
194
+ REQUEST_USER_CONSENT: string;
195
+ USERSCRIPT: string;
196
+ PERFORMANCE_START_TRACE: string;
197
+ PERFORMANCE_STOP_TRACE: string;
198
+ PERFORMANCE_ANALYZE_INSIGHT: string;
199
+ GIF_RECORDER: string;
200
+ BATCH: string;
201
+ };
202
+ RECORD_REPLAY: {
203
+ FLOW_RUN: string;
204
+ LIST_PUBLISHED: string;
205
+ };
206
+ };
207
+ declare const TOOL_SCHEMAS: Tool[];
208
+
209
+ declare const EDGE_LABELS: {
210
+ readonly DEFAULT: "default";
211
+ readonly TRUE: "true";
212
+ readonly FALSE: "false";
213
+ readonly ON_ERROR: "onError";
214
+ };
215
+ type EdgeLabel = (typeof EDGE_LABELS)[keyof typeof EDGE_LABELS];
216
+
217
+ interface RRNode {
218
+ id: string;
219
+ type: string;
220
+ config?: Record<string, unknown>;
221
+ }
222
+ interface RREdge {
223
+ id: string;
224
+ from: string;
225
+ to: string;
226
+ label?: EdgeLabel;
227
+ }
228
+ declare const RR_STEP_TYPES: {
229
+ readonly CLICK: "click";
230
+ readonly DBLCLICK: "dblclick";
231
+ readonly FILL: "fill";
232
+ readonly DRAG: "drag";
233
+ readonly KEY: "key";
234
+ readonly WAIT: "wait";
235
+ readonly ASSERT: "assert";
236
+ readonly IF: "if";
237
+ readonly FOREACH: "foreach";
238
+ readonly WHILE: "while";
239
+ readonly NAVIGATE: "navigate";
240
+ readonly SCRIPT: "script";
241
+ readonly HTTP: "http";
242
+ readonly EXTRACT: "extract";
243
+ readonly SCREENSHOT: "screenshot";
244
+ readonly SCROLL: "scroll";
245
+ readonly TRIGGER_EVENT: "triggerEvent";
246
+ readonly SET_ATTRIBUTE: "setAttribute";
247
+ readonly LOOP_ELEMENTS: "loopElements";
248
+ readonly SWITCH_FRAME: "switchFrame";
249
+ readonly OPEN_TAB: "openTab";
250
+ readonly SWITCH_TAB: "switchTab";
251
+ readonly CLOSE_TAB: "closeTab";
252
+ readonly EXECUTE_FLOW: "executeFlow";
253
+ readonly HANDLE_DOWNLOAD: "handleDownload";
254
+ readonly DELAY: "delay";
255
+ };
256
+ type RRStepType = (typeof RR_STEP_TYPES)[keyof typeof RR_STEP_TYPES];
257
+ declare function topoOrder<T extends RRNode>(nodes: T[], edges: RREdge[]): T[];
258
+ declare function mapNodeToStep(node: RRNode): any;
259
+ declare function nodesToSteps(nodes: RRNode[], edges: RREdge[]): any[];
260
+ declare function mapStepToNodeConfig(step: unknown): Record<string, unknown>;
261
+ declare function stepsToNodes(steps: ReadonlyArray<unknown>): RRNode[];
262
+ /**
263
+ * Convert linear steps array to DAG format (nodes + edges).
264
+ * Generates sequential edges connecting nodes in order.
265
+ */
266
+ declare function stepsToDAG(steps: ReadonlyArray<unknown>): {
267
+ nodes: RRNode[];
268
+ edges: RREdge[];
269
+ };
270
+
271
+ declare const STEP_TYPES: {
272
+ readonly CLICK: "click";
273
+ readonly DBLCLICK: "dblclick";
274
+ readonly FILL: "fill";
275
+ readonly TRIGGER_EVENT: "triggerEvent";
276
+ readonly SET_ATTRIBUTE: "setAttribute";
277
+ readonly SCREENSHOT: "screenshot";
278
+ readonly SWITCH_FRAME: "switchFrame";
279
+ readonly LOOP_ELEMENTS: "loopElements";
280
+ readonly KEY: "key";
281
+ readonly SCROLL: "scroll";
282
+ readonly DRAG: "drag";
283
+ readonly WAIT: "wait";
284
+ readonly ASSERT: "assert";
285
+ readonly SCRIPT: "script";
286
+ readonly IF: "if";
287
+ readonly FOREACH: "foreach";
288
+ readonly WHILE: "while";
289
+ readonly NAVIGATE: "navigate";
290
+ readonly HTTP: "http";
291
+ readonly EXTRACT: "extract";
292
+ readonly OPEN_TAB: "openTab";
293
+ readonly SWITCH_TAB: "switchTab";
294
+ readonly CLOSE_TAB: "closeTab";
295
+ readonly HANDLE_DOWNLOAD: "handleDownload";
296
+ readonly EXECUTE_FLOW: "executeFlow";
297
+ readonly TRIGGER: "trigger";
298
+ readonly DELAY: "delay";
299
+ };
300
+ type StepTypeConst = (typeof STEP_TYPES)[keyof typeof STEP_TYPES];
301
+
302
+ type FieldType = 'string' | 'number' | 'boolean' | 'select' | 'object' | 'array' | 'json';
303
+ interface FieldSpecBase {
304
+ key: string;
305
+ label: string;
306
+ type: FieldType;
307
+ required?: boolean;
308
+ placeholder?: string;
309
+ help?: string;
310
+ widget?: string;
311
+ uiProps?: Record<string, any>;
312
+ }
313
+ interface FieldString extends FieldSpecBase {
314
+ type: 'string';
315
+ default?: string;
316
+ }
317
+ interface FieldNumber extends FieldSpecBase {
318
+ type: 'number';
319
+ min?: number;
320
+ max?: number;
321
+ step?: number;
322
+ default?: number;
323
+ }
324
+ interface FieldBoolean extends FieldSpecBase {
325
+ type: 'boolean';
326
+ default?: boolean;
327
+ }
328
+ interface FieldSelect extends FieldSpecBase {
329
+ type: 'select';
330
+ options: Array<{
331
+ label: string;
332
+ value: string | number | boolean;
333
+ }>;
334
+ default?: string | number | boolean;
335
+ }
336
+ interface FieldObject extends FieldSpecBase {
337
+ type: 'object';
338
+ fields: FieldSpec[];
339
+ default?: Record<string, any>;
340
+ }
341
+ interface FieldArray extends FieldSpecBase {
342
+ type: 'array';
343
+ item: FieldString | FieldNumber | FieldBoolean | FieldSelect | FieldObject | FieldJson;
344
+ default?: any[];
345
+ }
346
+ interface FieldJson extends FieldSpecBase {
347
+ type: 'json';
348
+ default?: any;
349
+ }
350
+ type FieldSpec = FieldString | FieldNumber | FieldBoolean | FieldSelect | FieldObject | FieldArray | FieldJson;
351
+ type NodeCategory = 'Flow' | 'Actions' | 'Logic' | 'Tools' | 'Tabs' | 'Page';
352
+ interface NodeSpecDisplay {
353
+ label: string;
354
+ iconClass: string;
355
+ category: NodeCategory;
356
+ docUrl?: string;
357
+ }
358
+ interface NodeSpec {
359
+ type: string;
360
+ version: number;
361
+ display: NodeSpecDisplay;
362
+ ports: {
363
+ inputs: number | 'any';
364
+ outputs: Array<{
365
+ label?: string;
366
+ }> | 'any';
367
+ };
368
+ schema: FieldSpec[];
369
+ defaults: Record<string, any>;
370
+ validate?: (config: any) => string[];
371
+ }
372
+
373
+ declare function registerNodeSpec(spec: NodeSpec): void;
374
+ declare function getNodeSpec(type: string): NodeSpec | undefined;
375
+ declare function listNodeSpecs(): NodeSpec[];
376
+
377
+ declare function registerBuiltinSpecs(): void;
378
+
379
+ /**
380
+ * Agent-side shared data contracts.
381
+ * These types are shared between native-server and chrome-extension to ensure consistency.
382
+ *
383
+ * English is used for technical contracts; Chinese comments explain design choices.
384
+ */
385
+ type AgentRole = 'user' | 'assistant' | 'tool' | 'system';
386
+ interface AgentMessage {
387
+ id: string;
388
+ sessionId: string;
389
+ role: AgentRole;
390
+ content: string;
391
+ messageType: 'chat' | 'tool_use' | 'tool_result' | 'status';
392
+ cliSource?: string;
393
+ requestId?: string;
394
+ isStreaming?: boolean;
395
+ isFinal?: boolean;
396
+ createdAt: string;
397
+ metadata?: Record<string, unknown>;
398
+ }
399
+ type StreamTransport = 'sse' | 'websocket';
400
+ interface AgentStatusEvent {
401
+ sessionId: string;
402
+ status: 'starting' | 'ready' | 'running' | 'completed' | 'error' | 'cancelled';
403
+ message?: string;
404
+ requestId?: string;
405
+ }
406
+ interface AgentConnectedEvent {
407
+ sessionId: string;
408
+ transport: StreamTransport;
409
+ timestamp: string;
410
+ }
411
+ interface AgentHeartbeatEvent {
412
+ timestamp: string;
413
+ }
414
+ /** Usage statistics for a request */
415
+ interface AgentUsageStats {
416
+ sessionId: string;
417
+ requestId?: string;
418
+ inputTokens: number;
419
+ outputTokens: number;
420
+ cacheReadInputTokens?: number;
421
+ cacheCreationInputTokens?: number;
422
+ totalCostUsd: number;
423
+ durationMs: number;
424
+ numTurns: number;
425
+ }
426
+ type RealtimeEvent = {
427
+ type: 'message';
428
+ data: AgentMessage;
429
+ } | {
430
+ type: 'status';
431
+ data: AgentStatusEvent;
432
+ } | {
433
+ type: 'error';
434
+ error: string;
435
+ data?: {
436
+ sessionId?: string;
437
+ requestId?: string;
438
+ };
439
+ } | {
440
+ type: 'connected';
441
+ data: AgentConnectedEvent;
442
+ } | {
443
+ type: 'heartbeat';
444
+ data: AgentHeartbeatEvent;
445
+ } | {
446
+ type: 'usage';
447
+ data: AgentUsageStats;
448
+ };
449
+ interface AgentAttachment {
450
+ type: 'file' | 'image';
451
+ name: string;
452
+ mimeType: string;
453
+ dataBase64: string;
454
+ }
455
+ type AgentCliPreference = 'claude' | 'codex' | 'cursor' | 'qwen' | 'glm';
456
+ interface AgentActRequest {
457
+ instruction: string;
458
+ cliPreference?: AgentCliPreference;
459
+ model?: string;
460
+ attachments?: AgentAttachment[];
461
+ /**
462
+ * Optional logical project identifier. When provided, the backend
463
+ * can resolve a stable workspace configuration instead of relying
464
+ * solely on ad-hoc paths.
465
+ */
466
+ projectId?: string;
467
+ /**
468
+ * Optional database session ID (sessions.id). When provided, the backend
469
+ * will load session-level configuration (engine, model, permission mode,
470
+ * resume ids, etc.) from the sessions table.
471
+ */
472
+ dbSessionId?: string;
473
+ /**
474
+ * Optional project root / workspace directory on the local filesystem
475
+ * that the engine should use as its working directory.
476
+ */
477
+ projectRoot?: string;
478
+ /**
479
+ * Optional request id from client; server will generate one if missing.
480
+ */
481
+ requestId?: string;
482
+ /**
483
+ * Optional client metadata to store with the user message.
484
+ * For extension-specific context that should be preserved.
485
+ */
486
+ clientMeta?: Record<string, unknown>;
487
+ /**
488
+ * Optional display text override for the instruction.
489
+ * When set, UI should display this instead of raw instruction.
490
+ */
491
+ displayText?: string;
492
+ }
493
+ interface AgentActResponse {
494
+ requestId: string;
495
+ sessionId: string;
496
+ status: 'accepted';
497
+ }
498
+ interface AgentProject {
499
+ id: string;
500
+ name: string;
501
+ description?: string;
502
+ /**
503
+ * Absolute filesystem path for this project workspace.
504
+ */
505
+ rootPath: string;
506
+ preferredCli?: AgentCliPreference;
507
+ selectedModel?: string;
508
+ /**
509
+ * Active Claude session ID (UUID format) for session resumption.
510
+ * Captured from SDK's system/init message and used for the 'resume' parameter.
511
+ */
512
+ activeClaudeSessionId?: string;
513
+ /**
514
+ * Whether to use Claude Code Router (CCR) for this project.
515
+ * When enabled, the engine will auto-detect CCR configuration.
516
+ */
517
+ useCcr?: boolean;
518
+ /**
519
+ * Whether to enable Chrome MCP integration for this project.
520
+ * Default: true
521
+ */
522
+ enableChromeMcp?: boolean;
523
+ createdAt: string;
524
+ updatedAt: string;
525
+ lastActiveAt?: string;
526
+ }
527
+ interface AgentEngineInfo {
528
+ name: string;
529
+ supportsMcp?: boolean;
530
+ }
531
+ /**
532
+ * System prompt configuration for a session.
533
+ */
534
+ type AgentSystemPromptConfig = {
535
+ type: 'custom';
536
+ text: string;
537
+ } | {
538
+ type: 'preset';
539
+ preset: 'claude_code';
540
+ append?: string;
541
+ };
542
+ /**
543
+ * Tools configuration - can be a list of tool names or a preset.
544
+ */
545
+ type AgentToolsConfig = string[] | {
546
+ type: 'preset';
547
+ preset: 'claude_code';
548
+ };
549
+ /**
550
+ * Session options configuration.
551
+ */
552
+ interface AgentSessionOptionsConfig {
553
+ settingSources?: string[];
554
+ allowedTools?: string[];
555
+ disallowedTools?: string[];
556
+ tools?: AgentToolsConfig;
557
+ betas?: string[];
558
+ maxThinkingTokens?: number;
559
+ maxTurns?: number;
560
+ maxBudgetUsd?: number;
561
+ mcpServers?: Record<string, unknown>;
562
+ outputFormat?: Record<string, unknown>;
563
+ enableFileCheckpointing?: boolean;
564
+ sandbox?: Record<string, unknown>;
565
+ env?: Record<string, string>;
566
+ /**
567
+ * Optional Codex-specific configuration overrides.
568
+ * Only applicable when using CodexEngine.
569
+ */
570
+ codexConfig?: Partial<CodexEngineConfig>;
571
+ }
572
+ /**
573
+ * Cached management information from Claude SDK.
574
+ */
575
+ interface AgentManagementInfo {
576
+ tools?: string[];
577
+ agents?: string[];
578
+ plugins?: Array<{
579
+ name: string;
580
+ path?: string;
581
+ }>;
582
+ skills?: string[];
583
+ mcpServers?: Array<{
584
+ name: string;
585
+ status: string;
586
+ }>;
587
+ slashCommands?: string[];
588
+ model?: string;
589
+ permissionMode?: string;
590
+ cwd?: string;
591
+ outputStyle?: string;
592
+ betas?: string[];
593
+ claudeCodeVersion?: string;
594
+ apiKeySource?: string;
595
+ lastUpdated?: string;
596
+ }
597
+ /**
598
+ * Agent session - represents an independent conversation within a project.
599
+ */
600
+ interface AgentSession {
601
+ id: string;
602
+ projectId: string;
603
+ engineName: AgentCliPreference;
604
+ engineSessionId?: string;
605
+ name?: string;
606
+ /** Preview text from first user message, for display in session list */
607
+ preview?: string;
608
+ model?: string;
609
+ permissionMode: string;
610
+ allowDangerouslySkipPermissions: boolean;
611
+ systemPromptConfig?: AgentSystemPromptConfig;
612
+ optionsConfig?: AgentSessionOptionsConfig;
613
+ managementInfo?: AgentManagementInfo;
614
+ createdAt: string;
615
+ updatedAt: string;
616
+ }
617
+ /**
618
+ * Options for creating a new session.
619
+ */
620
+ interface CreateAgentSessionInput {
621
+ engineName: AgentCliPreference;
622
+ name?: string;
623
+ model?: string;
624
+ permissionMode?: string;
625
+ allowDangerouslySkipPermissions?: boolean;
626
+ systemPromptConfig?: AgentSystemPromptConfig;
627
+ optionsConfig?: AgentSessionOptionsConfig;
628
+ }
629
+ /**
630
+ * Options for updating a session.
631
+ */
632
+ interface UpdateAgentSessionInput {
633
+ name?: string | null;
634
+ model?: string | null;
635
+ permissionMode?: string | null;
636
+ allowDangerouslySkipPermissions?: boolean | null;
637
+ systemPromptConfig?: AgentSystemPromptConfig | null;
638
+ optionsConfig?: AgentSessionOptionsConfig | null;
639
+ }
640
+ interface AgentStoredMessage {
641
+ id: string;
642
+ projectId: string;
643
+ sessionId: string;
644
+ conversationId?: string | null;
645
+ role: AgentRole;
646
+ content: string;
647
+ messageType: AgentMessage['messageType'];
648
+ metadata?: Record<string, unknown>;
649
+ cliSource?: string | null;
650
+ createdAt?: string;
651
+ requestId?: string;
652
+ }
653
+ /**
654
+ * Sandbox mode for Codex CLI execution.
655
+ */
656
+ type CodexSandboxMode = 'read-only' | 'workspace-write' | 'danger-full-access';
657
+ /**
658
+ * Reasoning effort for Codex models.
659
+ * - low/medium/high: supported by all models
660
+ * - xhigh: only supported by gpt-5.2 and gpt-5.1-codex-max
661
+ */
662
+ type CodexReasoningEffort = 'low' | 'medium' | 'high' | 'xhigh';
663
+ /**
664
+ * Configuration options for Codex Engine.
665
+ * These can be overridden per-session via session settings.
666
+ */
667
+ interface CodexEngineConfig {
668
+ /** Enable apply_patch tool for file modifications. Default: true */
669
+ includeApplyPatchTool: boolean;
670
+ /** Enable plan tool for task planning. Default: true */
671
+ includePlanTool: boolean;
672
+ /** Enable web search capability. Default: true */
673
+ enableWebSearch: boolean;
674
+ /** Use experimental streamable shell tool. Default: true */
675
+ useStreamableShell: boolean;
676
+ /** Sandbox mode for command execution. Default: 'danger-full-access' */
677
+ sandboxMode: CodexSandboxMode;
678
+ /** Maximum number of turns. Default: 20 */
679
+ maxTurns: number;
680
+ /** Maximum thinking tokens. Default: 4096 */
681
+ maxThinkingTokens: number;
682
+ /** Reasoning effort for supported models. Default: 'medium' */
683
+ reasoningEffort: CodexReasoningEffort;
684
+ /** Auto instructions for autonomous behavior. Default: AUTO_INSTRUCTIONS */
685
+ autoInstructions: string;
686
+ /** Append project context (file listing) to prompt. Default: true */
687
+ appendProjectContext: boolean;
688
+ }
689
+ /**
690
+ * Default auto instructions for Codex to act autonomously.
691
+ * Aligned with other/cweb implementation.
692
+ */
693
+ declare const CODEX_AUTO_INSTRUCTIONS = "Act autonomously without asking for confirmations.\nUse apply_patch to create and modify files directly in the current working directory (do not create subdirectories unless the user explicitly requests it).\nUse exec_command to run, build, and test as needed.\nYou have full permissions. Keep taking concrete actions until the task is complete.\nRespect the existing project structure when creating or modifying files.\nPrefer concise status updates over questions.";
694
+ /**
695
+ * Default configuration for Codex Engine.
696
+ * Aligned with other/cweb implementation for feature parity.
697
+ */
698
+ declare const DEFAULT_CODEX_CONFIG: CodexEngineConfig;
699
+ /**
700
+ * Metadata for a persisted attachment file.
701
+ */
702
+ interface AttachmentMetadata {
703
+ /** Schema version for forward compatibility */
704
+ version: number;
705
+ /** Kind of attachment (e.g., 'image', 'file') */
706
+ kind: string;
707
+ /** Project ID this attachment belongs to */
708
+ projectId: string;
709
+ /** Message ID this attachment is associated with */
710
+ messageId: string;
711
+ /** Index of this attachment in the message */
712
+ index: number;
713
+ /** Persisted filename under project dir */
714
+ filename: string;
715
+ /** URL path to access this attachment */
716
+ urlPath: string;
717
+ /** MIME type of the attachment */
718
+ mimeType: string;
719
+ /** File size in bytes */
720
+ sizeBytes: number;
721
+ /** Original filename from upload */
722
+ originalName: string;
723
+ /** Timestamp when attachment was created */
724
+ createdAt: string;
725
+ }
726
+ /**
727
+ * Statistics for attachments in a single project.
728
+ */
729
+ interface AttachmentProjectStats {
730
+ projectId: string;
731
+ /** Directory path for this project's attachments */
732
+ dirPath: string;
733
+ /** Whether the directory exists */
734
+ exists: boolean;
735
+ fileCount: number;
736
+ totalBytes: number;
737
+ /** Last modification timestamp (only when exists is true) */
738
+ lastModifiedAt?: string;
739
+ }
740
+ /**
741
+ * Cleanup result for a single project.
742
+ */
743
+ interface CleanupProjectResult {
744
+ projectId: string;
745
+ dirPath: string;
746
+ existed: boolean;
747
+ removedFiles: number;
748
+ removedBytes: number;
749
+ }
750
+ /**
751
+ * Response for attachment statistics endpoint.
752
+ */
753
+ interface AttachmentStatsResponse {
754
+ success: boolean;
755
+ rootDir: string;
756
+ totalFiles: number;
757
+ totalBytes: number;
758
+ projects: Array<AttachmentProjectStats & {
759
+ projectName?: string;
760
+ existsInDb: boolean;
761
+ }>;
762
+ orphanProjectIds: string[];
763
+ }
764
+ /**
765
+ * Request body for attachment cleanup endpoint.
766
+ */
767
+ interface AttachmentCleanupRequest {
768
+ /** If provided, cleanup only these projects. Otherwise cleanup all. */
769
+ projectIds?: string[];
770
+ }
771
+ /**
772
+ * Response for attachment cleanup endpoint.
773
+ */
774
+ interface AttachmentCleanupResponse {
775
+ success: boolean;
776
+ scope: 'project' | 'selected' | 'all';
777
+ removedFiles: number;
778
+ removedBytes: number;
779
+ results: CleanupProjectResult[];
780
+ }
781
+ /**
782
+ * Target application for opening a project directory.
783
+ */
784
+ type OpenProjectTarget = 'vscode' | 'terminal';
785
+ /**
786
+ * Request body for open-project endpoint.
787
+ */
788
+ interface OpenProjectRequest {
789
+ /** Target application to open the project in */
790
+ target: OpenProjectTarget;
791
+ }
792
+ /**
793
+ * Response for open-project endpoint.
794
+ */
795
+ type OpenProjectResponse = {
796
+ success: true;
797
+ } | {
798
+ success: false;
799
+ error: string;
800
+ };
801
+
802
+ export { type AgentActRequest, type AgentActResponse, type AgentAttachment, type AgentCliPreference, type AgentConnectedEvent, type AgentEngineInfo, type AgentHeartbeatEvent, type AgentManagementInfo, type AgentMessage, type AgentProject, type AgentRole, type AgentSession, type AgentSessionOptionsConfig, type AgentStatusEvent, type AgentStoredMessage, type AgentSystemPromptConfig, type AgentToolsConfig, type AgentUsageStats, type AttachmentCleanupRequest, type AttachmentCleanupResponse, type AttachmentMetadata, type AttachmentProjectStats, type AttachmentStatsResponse, CODEX_AUTO_INSTRUCTIONS, type CleanupProjectResult, type CodexEngineConfig, type CodexReasoningEffort, type CodexSandboxMode, type CreateAgentSessionInput, DEFAULT_CODEX_CONFIG, DEFAULT_SERVER_PORT, EDGE_LABELS, type EdgeLabel, type ElementPickerRequest, type ElementPickerResult, type ElementPickerResultItem, type FieldArray, type FieldBoolean, type FieldJson, type FieldNumber, type FieldObject, type FieldSelect, type FieldSpec, type FieldSpecBase, type FieldString, type FieldType, HOST_NAME, type NativeMessage, NativeMessageType, type NodeCategory, type NodeSpec, type NodeSpecDisplay, type OpenProjectRequest, type OpenProjectResponse, type OpenProjectTarget, type PickedElement, type PickedElementPoint, type PickedElementRect, type RREdge, type RRNode, type RRStepType, RR_STEP_TYPES, type RealtimeEvent, STEP_TYPES, type StepTypeConst, type StreamTransport, TOOL_NAMES, TOOL_SCHEMAS, type UpdateAgentSessionInput, getNodeSpec, listNodeSpecs, mapNodeToStep, mapStepToNodeConfig, nodesToSteps, registerBuiltinSpecs, registerNodeSpec, stepsToDAG, stepsToNodes, topoOrder };