@camerontaylor/paseo-protocol 0.8.0-fork.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 (118) hide show
  1. package/README.md +12 -0
  2. package/dist/agent-attention-notification.d.ts +43 -0
  3. package/dist/agent-attention-notification.js +141 -0
  4. package/dist/agent-deep-link.d.ts +8 -0
  5. package/dist/agent-deep-link.js +49 -0
  6. package/dist/agent-labels.d.ts +10 -0
  7. package/dist/agent-labels.js +21 -0
  8. package/dist/agent-lifecycle.d.ts +3 -0
  9. package/dist/agent-lifecycle.js +8 -0
  10. package/dist/agent-state-bucket.d.ts +14 -0
  11. package/dist/agent-state-bucket.js +41 -0
  12. package/dist/agent-title-limits.d.ts +2 -0
  13. package/dist/agent-title-limits.js +2 -0
  14. package/dist/agent-types.d.ts +478 -0
  15. package/dist/agent-types.js +22 -0
  16. package/dist/binary-frames/demux.d.ts +11 -0
  17. package/dist/binary-frames/demux.js +23 -0
  18. package/dist/binary-frames/file-transfer.d.ts +51 -0
  19. package/dist/binary-frames/file-transfer.js +108 -0
  20. package/dist/binary-frames/index.d.ts +4 -0
  21. package/dist/binary-frames/index.js +4 -0
  22. package/dist/binary-frames/terminal.d.ts +35 -0
  23. package/dist/binary-frames/terminal.js +100 -0
  24. package/dist/branch-slug.d.ts +14 -0
  25. package/dist/branch-slug.js +49 -0
  26. package/dist/browser-automation/capabilities.d.ts +7 -0
  27. package/dist/browser-automation/capabilities.js +31 -0
  28. package/dist/browser-automation/rpc-schemas.d.ts +1112 -0
  29. package/dist/browser-automation/rpc-schemas.js +462 -0
  30. package/dist/chat/rpc-schemas.d.ts +158 -0
  31. package/dist/chat/rpc-schemas.js +104 -0
  32. package/dist/chat/types.d.ts +30 -0
  33. package/dist/chat/types.js +23 -0
  34. package/dist/check-traits.d.ts +11 -0
  35. package/dist/check-traits.js +10 -0
  36. package/dist/client-capabilities.d.ts +20 -0
  37. package/dist/client-capabilities.js +47 -0
  38. package/dist/connection-offer.d.ts +36 -0
  39. package/dist/connection-offer.js +53 -0
  40. package/dist/daemon-endpoints.d.ts +47 -0
  41. package/dist/daemon-endpoints.js +201 -0
  42. package/dist/error-utils.d.ts +11 -0
  43. package/dist/error-utils.js +27 -0
  44. package/dist/forge-manifest.d.ts +66 -0
  45. package/dist/forge-manifest.js +92 -0
  46. package/dist/generated/validation/ws-outbound.aot.d.ts +2 -0
  47. package/dist/generated/validation/ws-outbound.aot.js +98097 -0
  48. package/dist/git-remote.d.ts +33 -0
  49. package/dist/git-remote.js +94 -0
  50. package/dist/gitea-status.d.ts +10 -0
  51. package/dist/gitea-status.js +23 -0
  52. package/dist/gitlab-pipeline.d.ts +10 -0
  53. package/dist/gitlab-pipeline.js +17 -0
  54. package/dist/host-connection-schema.d.ts +11 -0
  55. package/dist/host-connection-schema.js +9 -0
  56. package/dist/literal-union.d.ts +2 -0
  57. package/dist/literal-union.js +2 -0
  58. package/dist/loop/rpc-schemas.d.ts +636 -0
  59. package/dist/loop/rpc-schemas.js +164 -0
  60. package/dist/messages.d.ts +60742 -0
  61. package/dist/messages.js +6152 -0
  62. package/dist/paseo-config-schema.d.ts +138 -0
  63. package/dist/paseo-config-schema.js +98 -0
  64. package/dist/paseo-tool-call-detail.d.ts +15 -0
  65. package/dist/paseo-tool-call-detail.js +305 -0
  66. package/dist/path-utils.d.ts +2 -0
  67. package/dist/path-utils.js +16 -0
  68. package/dist/plugin-requirements.d.ts +11 -0
  69. package/dist/plugin-requirements.js +26 -0
  70. package/dist/plugin-source-reference.d.ts +7 -0
  71. package/dist/plugin-source-reference.js +41 -0
  72. package/dist/provider-config.d.ts +139 -0
  73. package/dist/provider-config.js +115 -0
  74. package/dist/provider-icon-names.d.ts +5 -0
  75. package/dist/provider-icon-names.js +54 -0
  76. package/dist/provider-manifest.d.ts +37 -0
  77. package/dist/provider-manifest.js +261 -0
  78. package/dist/provider-snapshot-codec.d.ts +18 -0
  79. package/dist/provider-snapshot-codec.js +71 -0
  80. package/dist/schedule/cadence.d.ts +6 -0
  81. package/dist/schedule/cadence.js +28 -0
  82. package/dist/schedule/cron-expression.d.ts +13 -0
  83. package/dist/schedule/cron-expression.js +97 -0
  84. package/dist/schedule/rpc-schemas.d.ts +568 -0
  85. package/dist/schedule/rpc-schemas.js +155 -0
  86. package/dist/schedule/types.d.ts +201 -0
  87. package/dist/schedule/types.js +68 -0
  88. package/dist/search/text-match.d.ts +71 -0
  89. package/dist/search/text-match.js +291 -0
  90. package/dist/ssh-transport.d.ts +11 -0
  91. package/dist/ssh-transport.js +72 -0
  92. package/dist/terminal-activity.d.ts +21 -0
  93. package/dist/terminal-activity.js +25 -0
  94. package/dist/terminal-input-mode.d.ts +30 -0
  95. package/dist/terminal-input-mode.js +180 -0
  96. package/dist/terminal-key-input.d.ts +13 -0
  97. package/dist/terminal-key-input.js +210 -0
  98. package/dist/terminal-profiles.d.ts +41 -0
  99. package/dist/terminal-profiles.js +270 -0
  100. package/dist/terminal-snapshot.d.ts +3 -0
  101. package/dist/terminal-snapshot.js +184 -0
  102. package/dist/terminal-stream-protocol.d.ts +2 -0
  103. package/dist/terminal-stream-protocol.js +2 -0
  104. package/dist/terminal-subscription-key.d.ts +2 -0
  105. package/dist/terminal-subscription-key.js +9 -0
  106. package/dist/timeline-identity.d.ts +3 -0
  107. package/dist/timeline-identity.js +8 -0
  108. package/dist/tool-call-display.d.ts +11 -0
  109. package/dist/tool-call-display.js +136 -0
  110. package/dist/tool-name-normalization.d.ts +9 -0
  111. package/dist/tool-name-normalization.js +82 -0
  112. package/dist/validation/ws-outbound-schema-metadata.d.ts +11418 -0
  113. package/dist/validation/ws-outbound-schema-metadata.js +3 -0
  114. package/dist/validation/ws-outbound.d.ts +12 -0
  115. package/dist/validation/ws-outbound.js +8 -0
  116. package/dist/workspace-labels.d.ts +9 -0
  117. package/dist/workspace-labels.js +19 -0
  118. package/package.json +44 -0
@@ -0,0 +1,210 @@
1
+ const WIN32_LEFT_ALT_PRESSED = 0x0002;
2
+ const WIN32_LEFT_CTRL_PRESSED = 0x0008;
3
+ const WIN32_SHIFT_PRESSED = 0x0010;
4
+ function modifierParam(input) {
5
+ let value = 1;
6
+ if (input.shift)
7
+ value += 1;
8
+ if (input.alt)
9
+ value += 2;
10
+ if (input.ctrl)
11
+ value += 4;
12
+ if (input.meta)
13
+ value += 8;
14
+ return value;
15
+ }
16
+ function win32ControlKeyState(input) {
17
+ let value = 0;
18
+ if (input.shift)
19
+ value += WIN32_SHIFT_PRESSED;
20
+ if (input.ctrl)
21
+ value += WIN32_LEFT_CTRL_PRESSED;
22
+ if (input.alt)
23
+ value += WIN32_LEFT_ALT_PRESSED;
24
+ return value;
25
+ }
26
+ function shouldUseWin32InputMode(input, options) {
27
+ if (!options.inputMode?.win32InputMode) {
28
+ return false;
29
+ }
30
+ return Boolean(input.shift || input.ctrl || input.alt);
31
+ }
32
+ function shouldUseKittyKeyboardMode(input, options) {
33
+ if ((options.inputMode?.kittyKeyboardFlags ?? 0) <= 0) {
34
+ return false;
35
+ }
36
+ return Boolean(input.shift || input.ctrl || input.alt || input.meta);
37
+ }
38
+ function encodeWin32EnterKeyInput(input) {
39
+ const controlKeyState = win32ControlKeyState(input);
40
+ // ConPTY Win32 input mode: CSI Vk;Sc;Uc;Kd;Cs;Rc _
41
+ return `\x1b[13;28;13;1;${controlKeyState};1_`;
42
+ }
43
+ function applyAltLikePrefix(sequence, input) {
44
+ return input.alt ? `\x1b${sequence}` : sequence;
45
+ }
46
+ function ctrlSymbolCode(char) {
47
+ switch (char) {
48
+ case " ":
49
+ case "@":
50
+ case "2":
51
+ return "\x00";
52
+ case "[":
53
+ case "3":
54
+ return "\x1b";
55
+ case "\\":
56
+ case "4":
57
+ return "\x1c";
58
+ case "]":
59
+ case "5":
60
+ return "\x1d";
61
+ case "^":
62
+ case "6":
63
+ return "\x1e";
64
+ case "_":
65
+ case "/":
66
+ case "7":
67
+ return "\x1f";
68
+ case "8":
69
+ case "?":
70
+ return "\x7f";
71
+ default:
72
+ return null;
73
+ }
74
+ }
75
+ function encodeCtrlChar(char, input) {
76
+ const upper = char.toUpperCase();
77
+ if (upper.length === 1 && upper >= "A" && upper <= "Z") {
78
+ return applyAltLikePrefix(String.fromCharCode(upper.charCodeAt(0) - 64), input);
79
+ }
80
+ const symbol = ctrlSymbolCode(char);
81
+ if (symbol !== null) {
82
+ return applyAltLikePrefix(symbol, input);
83
+ }
84
+ if (char.length === 1) {
85
+ const code = char.charCodeAt(0) & 0x1f;
86
+ return applyAltLikePrefix(String.fromCharCode(code), input);
87
+ }
88
+ return applyAltLikePrefix(char, input);
89
+ }
90
+ function encodePrintableKey(input) {
91
+ const raw = input.key;
92
+ const char = input.shift ? raw.toUpperCase() : raw;
93
+ if (input.ctrl) {
94
+ return encodeCtrlChar(char, input);
95
+ }
96
+ return applyAltLikePrefix(char, input);
97
+ }
98
+ function csiWithModifier(finalByte, input) {
99
+ const mod = modifierParam(input);
100
+ return mod === 1 ? `\x1b[${finalByte}` : `\x1b[1;${mod}${finalByte}`;
101
+ }
102
+ function ss3WithModifier(finalByte, input) {
103
+ return modifierParam(input) === 1 ? `\x1bO${finalByte}` : csiWithModifier(finalByte, input);
104
+ }
105
+ function csiTilde(base, input) {
106
+ const mod = modifierParam(input);
107
+ return mod === 1 ? `\x1b[${base}~` : `\x1b[${base};${mod}~`;
108
+ }
109
+ function encodeFunctionKey(key, input) {
110
+ switch (key) {
111
+ case "F1":
112
+ return modifierParam(input) === 1 ? "\x1bOP" : csiWithModifier("P", input);
113
+ case "F2":
114
+ return modifierParam(input) === 1 ? "\x1bOQ" : csiWithModifier("Q", input);
115
+ case "F3":
116
+ return modifierParam(input) === 1 ? "\x1bOR" : csiWithModifier("R", input);
117
+ case "F4":
118
+ return modifierParam(input) === 1 ? "\x1bOS" : csiWithModifier("S", input);
119
+ case "F5":
120
+ return csiTilde(15, input);
121
+ case "F6":
122
+ return csiTilde(17, input);
123
+ case "F7":
124
+ return csiTilde(18, input);
125
+ case "F8":
126
+ return csiTilde(19, input);
127
+ case "F9":
128
+ return csiTilde(20, input);
129
+ case "F10":
130
+ return csiTilde(21, input);
131
+ case "F11":
132
+ return csiTilde(23, input);
133
+ case "F12":
134
+ return csiTilde(24, input);
135
+ default:
136
+ return null;
137
+ }
138
+ }
139
+ function encodeArrowKey(finalByte, input, options) {
140
+ if (options.inputMode?.applicationCursorKeys) {
141
+ return ss3WithModifier(finalByte, input);
142
+ }
143
+ return csiWithModifier(finalByte, input);
144
+ }
145
+ function encodeNavigationKey(key, input, options) {
146
+ switch (key) {
147
+ case "ArrowUp":
148
+ return encodeArrowKey("A", input, options);
149
+ case "ArrowDown":
150
+ return encodeArrowKey("B", input, options);
151
+ case "ArrowRight":
152
+ return encodeArrowKey("C", input, options);
153
+ case "ArrowLeft":
154
+ return encodeArrowKey("D", input, options);
155
+ case "Home":
156
+ return csiWithModifier("H", input);
157
+ case "End":
158
+ return csiWithModifier("F", input);
159
+ case "Insert":
160
+ return csiTilde(2, input);
161
+ case "Delete":
162
+ return csiTilde(3, input);
163
+ case "PageUp":
164
+ return csiTilde(5, input);
165
+ case "PageDown":
166
+ return csiTilde(6, input);
167
+ default:
168
+ return null;
169
+ }
170
+ }
171
+ export function encodeTerminalKeyInput(input, options = {}) {
172
+ const key = input.key;
173
+ if (!key) {
174
+ return "";
175
+ }
176
+ if (key.length === 1) {
177
+ return encodePrintableKey(input);
178
+ }
179
+ switch (key) {
180
+ case "Enter": {
181
+ const mod = modifierParam(input);
182
+ if (mod > 1 && shouldUseWin32InputMode(input, options)) {
183
+ return encodeWin32EnterKeyInput(input);
184
+ }
185
+ if (mod > 1 && shouldUseKittyKeyboardMode(input, options)) {
186
+ return `\x1b[13;${mod}u`;
187
+ }
188
+ return "\r";
189
+ }
190
+ case "Tab":
191
+ if (input.shift && !input.ctrl && !input.alt && !input.meta) {
192
+ return "\x1b[Z";
193
+ }
194
+ return applyAltLikePrefix("\t", input);
195
+ case "Backspace":
196
+ return applyAltLikePrefix("\x7f", input);
197
+ case "Escape":
198
+ return "\x1b";
199
+ default:
200
+ break;
201
+ }
202
+ const nav = encodeNavigationKey(key, input, options);
203
+ if (nav !== null)
204
+ return nav;
205
+ const fn = encodeFunctionKey(key, input);
206
+ if (fn !== null)
207
+ return fn;
208
+ return "";
209
+ }
210
+ //# sourceMappingURL=terminal-key-input.js.map
@@ -0,0 +1,41 @@
1
+ import type { TerminalProfile } from "./messages.js";
2
+ /**
3
+ * Marks where a typed prompt goes inside a profile's `command` or `args`. A
4
+ * profile carrying it accepts a prompt; one without it launches as-is.
5
+ *
6
+ * Substitution happens client-side before `create_terminal_request` is sent, so
7
+ * this is profile-format vocabulary rather than anything on the wire. It lives
8
+ * here because this module owns what a `TerminalProfile` means.
9
+ */
10
+ export declare const PROMPT_SENTINEL = "{{{prompt}}}";
11
+ export declare const DEFAULT_TERMINAL_PROFILES: readonly TerminalProfile[];
12
+ export interface SubstitutableCommand {
13
+ command: string;
14
+ args?: string[];
15
+ }
16
+ export interface ResolvedCommand {
17
+ command: string;
18
+ args: string[];
19
+ }
20
+ /** True when the sentinel appears anywhere in `command` or an `args` entry. */
21
+ export declare function profileTakesPrompt(profile: SubstitutableCommand): boolean;
22
+ /** Replaces every sentinel occurrence with `prompt`, dropping prompt-only args when there is none. */
23
+ export declare function substitutePrompt(profile: SubstitutableCommand, prompt: string): ResolvedCommand;
24
+ /** Human-readable preview of the resolved command, for read-only display. */
25
+ export declare function formatResolvedCommand(resolved: ResolvedCommand): string;
26
+ export interface TerminalProfileLaunch {
27
+ name: string;
28
+ command: string;
29
+ args: string[];
30
+ }
31
+ /**
32
+ * What to spawn for a profile. Every launcher goes through here, so no caller
33
+ * can forward a raw `profile.args` still carrying the sentinel: launchers with
34
+ * nowhere to type (pinned targets, the workspace terminal menu) pass an empty
35
+ * prompt and get the bare command back.
36
+ */
37
+ export declare function resolveTerminalProfileLaunch(profile: TerminalProfile, prompt: string): TerminalProfileLaunch;
38
+ export declare function guessTerminalProfileIcon(command: string): string | undefined;
39
+ export declare function getTerminalProfileIcon(profile: TerminalProfile): string | undefined;
40
+ export declare function resolveTerminalProfiles(terminalProfiles: TerminalProfile[] | undefined): readonly TerminalProfile[];
41
+ //# sourceMappingURL=terminal-profiles.d.ts.map
@@ -0,0 +1,270 @@
1
+ import { KNOWN_PROVIDER_ICON_NAMES } from "./provider-icon-names.js";
2
+ /**
3
+ * Marks where a typed prompt goes inside a profile's `command` or `args`. A
4
+ * profile carrying it accepts a prompt; one without it launches as-is.
5
+ *
6
+ * Substitution happens client-side before `create_terminal_request` is sent, so
7
+ * this is profile-format vocabulary rather than anything on the wire. It lives
8
+ * here because this module owns what a `TerminalProfile` means.
9
+ */
10
+ export const PROMPT_SENTINEL = "{{{prompt}}}";
11
+ // Prompt forms are taken from each CLI's own `--help`. claude, codex, and pi
12
+ // take the prompt as a trailing positional. opencode's positional is the
13
+ // project directory, so its prompt goes through `--prompt`, written in the
14
+ // `--flag=value` form to keep it one argv entry that can be dropped whole when
15
+ // no prompt is typed.
16
+ export const DEFAULT_TERMINAL_PROFILES = [
17
+ { id: "claude", name: "Claude Code", command: "claude", args: [PROMPT_SENTINEL], icon: "claude" },
18
+ { id: "codex", name: "Codex", command: "codex", args: [PROMPT_SENTINEL], icon: "codex" },
19
+ {
20
+ id: "opencode",
21
+ name: "OpenCode",
22
+ command: "opencode",
23
+ args: [`--prompt=${PROMPT_SENTINEL}`],
24
+ icon: "opencode",
25
+ },
26
+ { id: "pi", name: "Pi", command: "pi", args: [PROMPT_SENTINEL], icon: "pi" },
27
+ ];
28
+ function containsSentinel(value) {
29
+ return value.includes(PROMPT_SENTINEL);
30
+ }
31
+ /** True when the sentinel appears anywhere in `command` or an `args` entry. */
32
+ export function profileTakesPrompt(profile) {
33
+ return containsSentinel(profile.command) || (profile.args ?? []).some(containsSentinel);
34
+ }
35
+ function replaceSentinel(value, prompt) {
36
+ return value.split(PROMPT_SENTINEL).join(prompt);
37
+ }
38
+ /**
39
+ * An arg that exists only to carry a prompt: the sentinel alone
40
+ * (`{{{prompt}}}`), or as the whole value of an option assignment
41
+ * (`--prompt={{{prompt}}}`). Both are dropped when there is no prompt, because
42
+ * an empty positional and a valueless `--prompt=` are not the same as omitting
43
+ * them. A sentinel embedded in larger text (`echo {{{prompt}}}`) is not
44
+ * prompt-only and still substitutes to empty.
45
+ *
46
+ * This is why an option and its value belong in one entry. Split across two,
47
+ * the option would survive with nothing to carry.
48
+ */
49
+ function isPromptOnlyArg(arg) {
50
+ if (arg === PROMPT_SENTINEL) {
51
+ return true;
52
+ }
53
+ const separator = arg.indexOf("=");
54
+ return separator > 0 && arg.slice(separator + 1) === PROMPT_SENTINEL;
55
+ }
56
+ /** Replaces every sentinel occurrence with `prompt`, dropping prompt-only args when there is none. */
57
+ export function substitutePrompt(profile, prompt) {
58
+ return {
59
+ command: replaceSentinel(profile.command, prompt),
60
+ args: (profile.args ?? []).flatMap((arg) => prompt === "" && isPromptOnlyArg(arg) ? [] : [replaceSentinel(arg, prompt)]),
61
+ };
62
+ }
63
+ /** Human-readable preview of the resolved command, for read-only display. */
64
+ export function formatResolvedCommand(resolved) {
65
+ return [resolved.command, ...resolved.args].join(" ");
66
+ }
67
+ /**
68
+ * What to spawn for a profile. Every launcher goes through here, so no caller
69
+ * can forward a raw `profile.args` still carrying the sentinel: launchers with
70
+ * nowhere to type (pinned targets, the workspace terminal menu) pass an empty
71
+ * prompt and get the bare command back.
72
+ */
73
+ export function resolveTerminalProfileLaunch(profile, prompt) {
74
+ return { name: profile.name, ...substitutePrompt(profile, prompt) };
75
+ }
76
+ const WELL_KNOWN_COMMAND_ICONS = new Map(KNOWN_PROVIDER_ICON_NAMES.map((name) => [name, name]));
77
+ function getCommandBaseName(command) {
78
+ const lastSlash = command.lastIndexOf("/");
79
+ const lastBackslash = command.lastIndexOf("\\");
80
+ const start = Math.max(lastSlash, lastBackslash) + 1;
81
+ const base = command.slice(start).toLowerCase();
82
+ const dotIndex = base.indexOf(".");
83
+ return dotIndex > 0 ? base.slice(0, dotIndex) : base;
84
+ }
85
+ export function guessTerminalProfileIcon(command) {
86
+ return WELL_KNOWN_COMMAND_ICONS.get(getCommandBaseName(command));
87
+ }
88
+ export function getTerminalProfileIcon(profile) {
89
+ return profile.icon ?? guessTerminalProfileIcon(profile.command);
90
+ }
91
+ // Base command name to the sentinel-bearing args that command wants, derived
92
+ // from the shipped defaults rather than written out again, so adding a default
93
+ // profile later cannot silently miss the adoption below or get the wrong form.
94
+ const PROMPT_ARGS_BY_COMMAND = new Map(DEFAULT_TERMINAL_PROFILES.map((profile) => [
95
+ getCommandBaseName(profile.command),
96
+ (profile.args ?? []).filter(containsSentinel),
97
+ ]));
98
+ // Adoption applies only to the interactive, prompt-taking form of each CLI.
99
+ // These are the global options whose values would otherwise look positional
100
+ // while walking argv. Unknown options stay conservative: a following bare arg
101
+ // blocks adoption rather than risking a second prompt or changing a subcommand.
102
+ const GLOBAL_OPTIONS_WITH_VALUES_BY_COMMAND = new Map([
103
+ [
104
+ "claude",
105
+ new Set([
106
+ "--add-dir",
107
+ "--agent",
108
+ "--agents",
109
+ "--allowed-tools",
110
+ "--allowedTools",
111
+ "--append-system-prompt",
112
+ "--betas",
113
+ "--debug-file",
114
+ "--disallowed-tools",
115
+ "--disallowedTools",
116
+ "--effort",
117
+ "--fallback-model",
118
+ "--file",
119
+ "--input-format",
120
+ "--json-schema",
121
+ "--max-budget-usd",
122
+ "--mcp-config",
123
+ "--model",
124
+ "--name",
125
+ "--output-format",
126
+ "--permission-mode",
127
+ "--plugin-dir",
128
+ "--plugin-url",
129
+ "--remote-control-session-name-prefix",
130
+ "--settings",
131
+ "--system-prompt",
132
+ "--system-prompt-file",
133
+ "--tools",
134
+ "-n",
135
+ ]),
136
+ ],
137
+ [
138
+ "codex",
139
+ new Set([
140
+ "--add-dir",
141
+ "--ask-for-approval",
142
+ "--cd",
143
+ "--config",
144
+ "--disable",
145
+ "--enable",
146
+ "--image",
147
+ "--local-provider",
148
+ "--model",
149
+ "--profile",
150
+ "--remote",
151
+ "--remote-auth-token-env",
152
+ "--sandbox",
153
+ "-C",
154
+ "-a",
155
+ "-c",
156
+ "-i",
157
+ "-m",
158
+ "-p",
159
+ "-s",
160
+ ]),
161
+ ],
162
+ [
163
+ "opencode",
164
+ new Set([
165
+ "--agent",
166
+ "--cors",
167
+ "--hostname",
168
+ "--log-level",
169
+ "--mdns-domain",
170
+ "--model",
171
+ "--port",
172
+ "--prompt",
173
+ "--replay-limit",
174
+ "--session",
175
+ "-m",
176
+ "-s",
177
+ ]),
178
+ ],
179
+ [
180
+ "pi",
181
+ new Set([
182
+ "--api-key",
183
+ "--append-system-prompt",
184
+ "--exclude-tools",
185
+ "--export",
186
+ "--extension",
187
+ "--fork",
188
+ "--mode",
189
+ "--model",
190
+ "--models",
191
+ "--name",
192
+ "--prompt-template",
193
+ "--provider",
194
+ "--session",
195
+ "--session-dir",
196
+ "--session-id",
197
+ "--skill",
198
+ "--system-prompt",
199
+ "--theme",
200
+ "--thinking",
201
+ "--tools",
202
+ "-e",
203
+ "-n",
204
+ "-t",
205
+ "-xt",
206
+ ]),
207
+ ],
208
+ ]);
209
+ // Profiles predating the sentinel got materialized into user config the first
210
+ // time anyone touched the profile list (host-page.tsx patches the whole list on
211
+ // any add, edit, or reorder). Those users would otherwise be stuck with
212
+ // launch-only versions of the agents we ship, while a fresh install gets prompt
213
+ // support, so a profile still pointing at one of those agents adopts the
214
+ // trailing sentinel on read.
215
+ //
216
+ // Keyed on the command's base name, not the profile id: profiles created
217
+ // through the settings UI get generated ids (`profile_<timestamp>_<random>`),
218
+ // so a real user's Codex profile is never id `codex`. The base name also
219
+ // normalizes `/usr/local/bin/codex` and `codex.cmd` onto the same agent.
220
+ //
221
+ // User args are preserved: `codex --yolo` becomes `codex --yolo {{{prompt}}}`.
222
+ // The appended form comes from the shipped default for that command, so
223
+ // opencode gets `--prompt=` rather than a trailing positional, which it would
224
+ // read as a project directory. A profile that already carries the sentinel
225
+ // anywhere is left alone, and so is one pointing at any other command. Nothing
226
+ // is written back, so this stays a read-time adoption with no version stamp and
227
+ // no daemon-start hook.
228
+ // Any positional means this is not the bare interactive form we can safely
229
+ // adopt. It may be a subcommand (`codex --profile work login`) or an existing
230
+ // prompt/project argument. Option assignments carry their value inline; known
231
+ // split options consume the next argv entry before positional detection.
232
+ function hasPositionalArg(command, args) {
233
+ const optionsWithValues = GLOBAL_OPTIONS_WITH_VALUES_BY_COMMAND.get(command) ?? new Set();
234
+ let expectsOptionValue = false;
235
+ for (const arg of args) {
236
+ if (expectsOptionValue) {
237
+ expectsOptionValue = false;
238
+ continue;
239
+ }
240
+ if (arg === "--") {
241
+ return true;
242
+ }
243
+ if (!arg.startsWith("-")) {
244
+ return true;
245
+ }
246
+ const separator = arg.indexOf("=");
247
+ const option = separator === -1 ? arg : arg.slice(0, separator);
248
+ expectsOptionValue = separator === -1 && optionsWithValues.has(option);
249
+ }
250
+ return false;
251
+ }
252
+ function adoptPromptSentinel(profile) {
253
+ const command = getCommandBaseName(profile.command);
254
+ const promptArgs = PROMPT_ARGS_BY_COMMAND.get(command);
255
+ if (!promptArgs || promptArgs.length === 0) {
256
+ return profile;
257
+ }
258
+ const args = profile.args ?? [];
259
+ if (profileTakesPrompt(profile) || hasPositionalArg(command, args)) {
260
+ return profile;
261
+ }
262
+ return { ...profile, args: [...args, ...promptArgs] };
263
+ }
264
+ export function resolveTerminalProfiles(terminalProfiles) {
265
+ if (terminalProfiles === undefined) {
266
+ return DEFAULT_TERMINAL_PROFILES;
267
+ }
268
+ return terminalProfiles.map(adoptPromptSentinel);
269
+ }
270
+ //# sourceMappingURL=terminal-profiles.js.map
@@ -0,0 +1,3 @@
1
+ import type { TerminalState } from "./messages.js";
2
+ export declare function renderTerminalSnapshotToAnsi(state: TerminalState): string;
3
+ //# sourceMappingURL=terminal-snapshot.d.ts.map