@getpaseo/protocol 0.3.0-beta.2 → 0.3.0-beta.3
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.
- package/dist/agent-types.d.ts +2 -0
- package/dist/generated/validation/ws-outbound.aot.js +4369 -4284
- package/dist/host-connection-schema.d.ts +1 -0
- package/dist/host-connection-schema.js +1 -0
- package/dist/messages.d.ts +48 -0
- package/dist/messages.js +2 -0
- package/dist/provider-manifest.js +7 -0
- package/dist/terminal-profiles.d.ts +35 -0
- package/dist/terminal-profiles.js +246 -4
- package/dist/validation/ws-outbound-schema-metadata.d.ts +10 -0
- package/package.json +1 -1
|
@@ -5,6 +5,7 @@ export declare const DirectTcpHostConnectionSchema: z.ZodObject<{
|
|
|
5
5
|
endpoint: z.ZodString;
|
|
6
6
|
useTls: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
7
7
|
password: z.ZodOptional<z.ZodString>;
|
|
8
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
8
9
|
}, z.core.$strip>;
|
|
9
10
|
export type DirectTcpHostConnection = z.input<typeof DirectTcpHostConnectionSchema>;
|
|
10
11
|
export type NormalizedDirectTcpHostConnection = z.output<typeof DirectTcpHostConnectionSchema>;
|
|
@@ -5,5 +5,6 @@ export const DirectTcpHostConnectionSchema = z.object({
|
|
|
5
5
|
endpoint: z.string(),
|
|
6
6
|
useTls: z.boolean().optional().default(false),
|
|
7
7
|
password: z.string().optional(),
|
|
8
|
+
headers: z.record(z.string(), z.string()).optional(),
|
|
8
9
|
});
|
|
9
10
|
//# sourceMappingURL=host-connection-schema.js.map
|
package/dist/messages.d.ts
CHANGED
|
@@ -158,6 +158,8 @@ export declare const ProviderSnapshotEntrySchema: z.ZodObject<{
|
|
|
158
158
|
models: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
159
159
|
provider: z.ZodString;
|
|
160
160
|
id: z.ZodString;
|
|
161
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
162
|
+
isSelectable: z.ZodOptional<z.ZodBoolean>;
|
|
161
163
|
label: z.ZodString;
|
|
162
164
|
description: z.ZodOptional<z.ZodString>;
|
|
163
165
|
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -184,6 +186,8 @@ export declare const CompactProviderSnapshotModelSchema: z.ZodObject<{
|
|
|
184
186
|
id: z.ZodString;
|
|
185
187
|
label: z.ZodString;
|
|
186
188
|
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
189
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
190
|
+
isSelectable: z.ZodOptional<z.ZodBoolean>;
|
|
187
191
|
contextWindowMaxTokens: z.ZodOptional<z.ZodNumber>;
|
|
188
192
|
defaultThinkingOptionId: z.ZodOptional<z.ZodString>;
|
|
189
193
|
thinkingSet: z.ZodOptional<z.ZodNumber>;
|
|
@@ -218,6 +222,8 @@ export declare const CompactProviderSnapshotEntrySchema: z.ZodObject<{
|
|
|
218
222
|
id: z.ZodString;
|
|
219
223
|
label: z.ZodString;
|
|
220
224
|
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
225
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
226
|
+
isSelectable: z.ZodOptional<z.ZodBoolean>;
|
|
221
227
|
contextWindowMaxTokens: z.ZodOptional<z.ZodNumber>;
|
|
222
228
|
defaultThinkingOptionId: z.ZodOptional<z.ZodString>;
|
|
223
229
|
thinkingSet: z.ZodOptional<z.ZodNumber>;
|
|
@@ -244,6 +250,8 @@ export declare const CompactProviderSnapshotSchema: z.ZodObject<{
|
|
|
244
250
|
id: z.ZodString;
|
|
245
251
|
label: z.ZodString;
|
|
246
252
|
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
253
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
254
|
+
isSelectable: z.ZodOptional<z.ZodBoolean>;
|
|
247
255
|
contextWindowMaxTokens: z.ZodOptional<z.ZodNumber>;
|
|
248
256
|
defaultThinkingOptionId: z.ZodOptional<z.ZodString>;
|
|
249
257
|
thinkingSet: z.ZodOptional<z.ZodNumber>;
|
|
@@ -12361,6 +12369,8 @@ export declare const ListProviderModelsResponseMessageSchema: z.ZodObject<{
|
|
|
12361
12369
|
models: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
12362
12370
|
provider: z.ZodString;
|
|
12363
12371
|
id: z.ZodString;
|
|
12372
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
12373
|
+
isSelectable: z.ZodOptional<z.ZodBoolean>;
|
|
12364
12374
|
label: z.ZodString;
|
|
12365
12375
|
description: z.ZodOptional<z.ZodString>;
|
|
12366
12376
|
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -12451,6 +12461,8 @@ export declare const GetProvidersSnapshotResponseMessageSchema: z.ZodObject<{
|
|
|
12451
12461
|
models: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
12452
12462
|
provider: z.ZodString;
|
|
12453
12463
|
id: z.ZodString;
|
|
12464
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
12465
|
+
isSelectable: z.ZodOptional<z.ZodBoolean>;
|
|
12454
12466
|
label: z.ZodString;
|
|
12455
12467
|
description: z.ZodOptional<z.ZodString>;
|
|
12456
12468
|
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -12492,6 +12504,8 @@ export declare const GetProvidersSnapshotResponseMessageSchema: z.ZodObject<{
|
|
|
12492
12504
|
id: z.ZodString;
|
|
12493
12505
|
label: z.ZodString;
|
|
12494
12506
|
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
12507
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
12508
|
+
isSelectable: z.ZodOptional<z.ZodBoolean>;
|
|
12495
12509
|
contextWindowMaxTokens: z.ZodOptional<z.ZodNumber>;
|
|
12496
12510
|
defaultThinkingOptionId: z.ZodOptional<z.ZodString>;
|
|
12497
12511
|
thinkingSet: z.ZodOptional<z.ZodNumber>;
|
|
@@ -12530,6 +12544,8 @@ export declare const ProvidersSnapshotUpdateMessageSchema: z.ZodObject<{
|
|
|
12530
12544
|
models: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
12531
12545
|
provider: z.ZodString;
|
|
12532
12546
|
id: z.ZodString;
|
|
12547
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
12548
|
+
isSelectable: z.ZodOptional<z.ZodBoolean>;
|
|
12533
12549
|
label: z.ZodString;
|
|
12534
12550
|
description: z.ZodOptional<z.ZodString>;
|
|
12535
12551
|
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -12571,6 +12587,8 @@ export declare const ProvidersSnapshotUpdateMessageSchema: z.ZodObject<{
|
|
|
12571
12587
|
id: z.ZodString;
|
|
12572
12588
|
label: z.ZodString;
|
|
12573
12589
|
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
12590
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
12591
|
+
isSelectable: z.ZodOptional<z.ZodBoolean>;
|
|
12574
12592
|
contextWindowMaxTokens: z.ZodOptional<z.ZodNumber>;
|
|
12575
12593
|
defaultThinkingOptionId: z.ZodOptional<z.ZodString>;
|
|
12576
12594
|
thinkingSet: z.ZodOptional<z.ZodNumber>;
|
|
@@ -19618,6 +19636,8 @@ export declare const SessionOutboundMessageSchema: z.ZodDiscriminatedUnion<[z.Zo
|
|
|
19618
19636
|
models: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
19619
19637
|
provider: z.ZodString;
|
|
19620
19638
|
id: z.ZodString;
|
|
19639
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
19640
|
+
isSelectable: z.ZodOptional<z.ZodBoolean>;
|
|
19621
19641
|
label: z.ZodString;
|
|
19622
19642
|
description: z.ZodOptional<z.ZodString>;
|
|
19623
19643
|
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -19704,6 +19724,8 @@ export declare const SessionOutboundMessageSchema: z.ZodDiscriminatedUnion<[z.Zo
|
|
|
19704
19724
|
models: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
19705
19725
|
provider: z.ZodString;
|
|
19706
19726
|
id: z.ZodString;
|
|
19727
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
19728
|
+
isSelectable: z.ZodOptional<z.ZodBoolean>;
|
|
19707
19729
|
label: z.ZodString;
|
|
19708
19730
|
description: z.ZodOptional<z.ZodString>;
|
|
19709
19731
|
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -19745,6 +19767,8 @@ export declare const SessionOutboundMessageSchema: z.ZodDiscriminatedUnion<[z.Zo
|
|
|
19745
19767
|
id: z.ZodString;
|
|
19746
19768
|
label: z.ZodString;
|
|
19747
19769
|
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
19770
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
19771
|
+
isSelectable: z.ZodOptional<z.ZodBoolean>;
|
|
19748
19772
|
contextWindowMaxTokens: z.ZodOptional<z.ZodNumber>;
|
|
19749
19773
|
defaultThinkingOptionId: z.ZodOptional<z.ZodString>;
|
|
19750
19774
|
thinkingSet: z.ZodOptional<z.ZodNumber>;
|
|
@@ -19782,6 +19806,8 @@ export declare const SessionOutboundMessageSchema: z.ZodDiscriminatedUnion<[z.Zo
|
|
|
19782
19806
|
models: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
19783
19807
|
provider: z.ZodString;
|
|
19784
19808
|
id: z.ZodString;
|
|
19809
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
19810
|
+
isSelectable: z.ZodOptional<z.ZodBoolean>;
|
|
19785
19811
|
label: z.ZodString;
|
|
19786
19812
|
description: z.ZodOptional<z.ZodString>;
|
|
19787
19813
|
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -19823,6 +19849,8 @@ export declare const SessionOutboundMessageSchema: z.ZodDiscriminatedUnion<[z.Zo
|
|
|
19823
19849
|
id: z.ZodString;
|
|
19824
19850
|
label: z.ZodString;
|
|
19825
19851
|
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
19852
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
19853
|
+
isSelectable: z.ZodOptional<z.ZodBoolean>;
|
|
19826
19854
|
contextWindowMaxTokens: z.ZodOptional<z.ZodNumber>;
|
|
19827
19855
|
defaultThinkingOptionId: z.ZodOptional<z.ZodString>;
|
|
19828
19856
|
thinkingSet: z.ZodOptional<z.ZodNumber>;
|
|
@@ -29515,6 +29543,8 @@ export declare const WSSessionOutboundSchema: z.ZodObject<{
|
|
|
29515
29543
|
models: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
29516
29544
|
provider: z.ZodString;
|
|
29517
29545
|
id: z.ZodString;
|
|
29546
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
29547
|
+
isSelectable: z.ZodOptional<z.ZodBoolean>;
|
|
29518
29548
|
label: z.ZodString;
|
|
29519
29549
|
description: z.ZodOptional<z.ZodString>;
|
|
29520
29550
|
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -29601,6 +29631,8 @@ export declare const WSSessionOutboundSchema: z.ZodObject<{
|
|
|
29601
29631
|
models: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
29602
29632
|
provider: z.ZodString;
|
|
29603
29633
|
id: z.ZodString;
|
|
29634
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
29635
|
+
isSelectable: z.ZodOptional<z.ZodBoolean>;
|
|
29604
29636
|
label: z.ZodString;
|
|
29605
29637
|
description: z.ZodOptional<z.ZodString>;
|
|
29606
29638
|
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -29642,6 +29674,8 @@ export declare const WSSessionOutboundSchema: z.ZodObject<{
|
|
|
29642
29674
|
id: z.ZodString;
|
|
29643
29675
|
label: z.ZodString;
|
|
29644
29676
|
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
29677
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
29678
|
+
isSelectable: z.ZodOptional<z.ZodBoolean>;
|
|
29645
29679
|
contextWindowMaxTokens: z.ZodOptional<z.ZodNumber>;
|
|
29646
29680
|
defaultThinkingOptionId: z.ZodOptional<z.ZodString>;
|
|
29647
29681
|
thinkingSet: z.ZodOptional<z.ZodNumber>;
|
|
@@ -29679,6 +29713,8 @@ export declare const WSSessionOutboundSchema: z.ZodObject<{
|
|
|
29679
29713
|
models: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
29680
29714
|
provider: z.ZodString;
|
|
29681
29715
|
id: z.ZodString;
|
|
29716
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
29717
|
+
isSelectable: z.ZodOptional<z.ZodBoolean>;
|
|
29682
29718
|
label: z.ZodString;
|
|
29683
29719
|
description: z.ZodOptional<z.ZodString>;
|
|
29684
29720
|
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -29720,6 +29756,8 @@ export declare const WSSessionOutboundSchema: z.ZodObject<{
|
|
|
29720
29756
|
id: z.ZodString;
|
|
29721
29757
|
label: z.ZodString;
|
|
29722
29758
|
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
29759
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
29760
|
+
isSelectable: z.ZodOptional<z.ZodBoolean>;
|
|
29723
29761
|
contextWindowMaxTokens: z.ZodOptional<z.ZodNumber>;
|
|
29724
29762
|
defaultThinkingOptionId: z.ZodOptional<z.ZodString>;
|
|
29725
29763
|
thinkingSet: z.ZodOptional<z.ZodNumber>;
|
|
@@ -39076,6 +39114,8 @@ export declare const WSOutboundMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
39076
39114
|
models: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
39077
39115
|
provider: z.ZodString;
|
|
39078
39116
|
id: z.ZodString;
|
|
39117
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
39118
|
+
isSelectable: z.ZodOptional<z.ZodBoolean>;
|
|
39079
39119
|
label: z.ZodString;
|
|
39080
39120
|
description: z.ZodOptional<z.ZodString>;
|
|
39081
39121
|
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -39162,6 +39202,8 @@ export declare const WSOutboundMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
39162
39202
|
models: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
39163
39203
|
provider: z.ZodString;
|
|
39164
39204
|
id: z.ZodString;
|
|
39205
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
39206
|
+
isSelectable: z.ZodOptional<z.ZodBoolean>;
|
|
39165
39207
|
label: z.ZodString;
|
|
39166
39208
|
description: z.ZodOptional<z.ZodString>;
|
|
39167
39209
|
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -39203,6 +39245,8 @@ export declare const WSOutboundMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
39203
39245
|
id: z.ZodString;
|
|
39204
39246
|
label: z.ZodString;
|
|
39205
39247
|
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
39248
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
39249
|
+
isSelectable: z.ZodOptional<z.ZodBoolean>;
|
|
39206
39250
|
contextWindowMaxTokens: z.ZodOptional<z.ZodNumber>;
|
|
39207
39251
|
defaultThinkingOptionId: z.ZodOptional<z.ZodString>;
|
|
39208
39252
|
thinkingSet: z.ZodOptional<z.ZodNumber>;
|
|
@@ -39240,6 +39284,8 @@ export declare const WSOutboundMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
39240
39284
|
models: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
39241
39285
|
provider: z.ZodString;
|
|
39242
39286
|
id: z.ZodString;
|
|
39287
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
39288
|
+
isSelectable: z.ZodOptional<z.ZodBoolean>;
|
|
39243
39289
|
label: z.ZodString;
|
|
39244
39290
|
description: z.ZodOptional<z.ZodString>;
|
|
39245
39291
|
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -39281,6 +39327,8 @@ export declare const WSOutboundMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
39281
39327
|
id: z.ZodString;
|
|
39282
39328
|
label: z.ZodString;
|
|
39283
39329
|
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
39330
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
39331
|
+
isSelectable: z.ZodOptional<z.ZodBoolean>;
|
|
39284
39332
|
contextWindowMaxTokens: z.ZodOptional<z.ZodNumber>;
|
|
39285
39333
|
defaultThinkingOptionId: z.ZodOptional<z.ZodString>;
|
|
39286
39334
|
thinkingSet: z.ZodOptional<z.ZodNumber>;
|
package/dist/messages.js
CHANGED
|
@@ -147,6 +147,8 @@ export const AgentFeatureSchema = z.discriminatedUnion("type", [
|
|
|
147
147
|
const AgentModelDefinitionSchema = z.object({
|
|
148
148
|
provider: AgentProviderSchema,
|
|
149
149
|
id: z.string(),
|
|
150
|
+
aliases: z.array(z.string()).optional(),
|
|
151
|
+
isSelectable: z.boolean().optional(),
|
|
150
152
|
label: z.string(),
|
|
151
153
|
description: z.string().optional(),
|
|
152
154
|
isDefault: z.boolean().optional(),
|
|
@@ -133,6 +133,13 @@ const MOCK_LOAD_TEST_MODES = [
|
|
|
133
133
|
icon: "ShieldOff",
|
|
134
134
|
colorTier: "dangerous",
|
|
135
135
|
},
|
|
136
|
+
{
|
|
137
|
+
id: "approval-test",
|
|
138
|
+
label: "Approval Test",
|
|
139
|
+
description: "Alternate development-only permission mode for preference tests",
|
|
140
|
+
icon: "ShieldCheck",
|
|
141
|
+
colorTier: "safe",
|
|
142
|
+
},
|
|
136
143
|
];
|
|
137
144
|
const MOCK_SLOW_MODES = [
|
|
138
145
|
{
|
|
@@ -1,5 +1,40 @@
|
|
|
1
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}}}";
|
|
2
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;
|
|
3
38
|
export declare function guessTerminalProfileIcon(command: string): string | undefined;
|
|
4
39
|
export declare function getTerminalProfileIcon(profile: TerminalProfile): string | undefined;
|
|
5
40
|
export declare function resolveTerminalProfiles(terminalProfiles: TerminalProfile[] | undefined): readonly TerminalProfile[];
|
|
@@ -1,9 +1,78 @@
|
|
|
1
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.
|
|
2
16
|
export const DEFAULT_TERMINAL_PROFILES = [
|
|
3
|
-
{ id: "claude", name: "Claude Code", command: "claude", icon: "claude" },
|
|
4
|
-
{ id: "codex", name: "Codex", command: "codex", icon: "codex" },
|
|
5
|
-
{
|
|
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" },
|
|
6
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
|
+
}
|
|
7
76
|
const WELL_KNOWN_COMMAND_ICONS = new Map(KNOWN_PROVIDER_ICON_NAMES.map((name) => [name, name]));
|
|
8
77
|
function getCommandBaseName(command) {
|
|
9
78
|
const lastSlash = command.lastIndexOf("/");
|
|
@@ -19,10 +88,183 @@ export function guessTerminalProfileIcon(command) {
|
|
|
19
88
|
export function getTerminalProfileIcon(profile) {
|
|
20
89
|
return profile.icon ?? guessTerminalProfileIcon(profile.command);
|
|
21
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
|
+
}
|
|
22
264
|
export function resolveTerminalProfiles(terminalProfiles) {
|
|
23
265
|
if (terminalProfiles === undefined) {
|
|
24
266
|
return DEFAULT_TERMINAL_PROFILES;
|
|
25
267
|
}
|
|
26
|
-
return terminalProfiles;
|
|
268
|
+
return terminalProfiles.map(adoptPromptSentinel);
|
|
27
269
|
}
|
|
28
270
|
//# sourceMappingURL=terminal-profiles.js.map
|
|
@@ -6112,6 +6112,8 @@ export declare const WSOutboundMessageSchema: {
|
|
|
6112
6112
|
models: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
6113
6113
|
provider: import("zod").ZodString;
|
|
6114
6114
|
id: import("zod").ZodString;
|
|
6115
|
+
aliases: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
6116
|
+
isSelectable: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
6115
6117
|
label: import("zod").ZodString;
|
|
6116
6118
|
description: import("zod").ZodOptional<import("zod").ZodString>;
|
|
6117
6119
|
isDefault: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
@@ -6198,6 +6200,8 @@ export declare const WSOutboundMessageSchema: {
|
|
|
6198
6200
|
models: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
6199
6201
|
provider: import("zod").ZodString;
|
|
6200
6202
|
id: import("zod").ZodString;
|
|
6203
|
+
aliases: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
6204
|
+
isSelectable: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
6201
6205
|
label: import("zod").ZodString;
|
|
6202
6206
|
description: import("zod").ZodOptional<import("zod").ZodString>;
|
|
6203
6207
|
isDefault: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
@@ -6239,6 +6243,8 @@ export declare const WSOutboundMessageSchema: {
|
|
|
6239
6243
|
id: import("zod").ZodString;
|
|
6240
6244
|
label: import("zod").ZodString;
|
|
6241
6245
|
isDefault: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
6246
|
+
aliases: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
6247
|
+
isSelectable: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
6242
6248
|
contextWindowMaxTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
6243
6249
|
defaultThinkingOptionId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
6244
6250
|
thinkingSet: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
@@ -6276,6 +6282,8 @@ export declare const WSOutboundMessageSchema: {
|
|
|
6276
6282
|
models: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
6277
6283
|
provider: import("zod").ZodString;
|
|
6278
6284
|
id: import("zod").ZodString;
|
|
6285
|
+
aliases: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
6286
|
+
isSelectable: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
6279
6287
|
label: import("zod").ZodString;
|
|
6280
6288
|
description: import("zod").ZodOptional<import("zod").ZodString>;
|
|
6281
6289
|
isDefault: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
@@ -6317,6 +6325,8 @@ export declare const WSOutboundMessageSchema: {
|
|
|
6317
6325
|
id: import("zod").ZodString;
|
|
6318
6326
|
label: import("zod").ZodString;
|
|
6319
6327
|
isDefault: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
6328
|
+
aliases: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
6329
|
+
isSelectable: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
6320
6330
|
contextWindowMaxTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
6321
6331
|
defaultThinkingOptionId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
6322
6332
|
thinkingSet: import("zod").ZodOptional<import("zod").ZodNumber>;
|