@defai.digital/ax-cli 0.2.2 → 1.0.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.
- package/README.md +171 -97
- package/dist/agent/grok-agent.js +12 -1
- package/dist/agent/grok-agent.js.map +1 -1
- package/dist/commands/mcp.js +3 -2
- package/dist/commands/mcp.js.map +1 -1
- package/dist/mcp/client.js +5 -1
- package/dist/mcp/client.js.map +1 -1
- package/dist/schemas/api-schemas.d.ts +58 -26
- package/dist/schemas/api-schemas.js +6 -4
- package/dist/schemas/api-schemas.js.map +1 -1
- package/dist/schemas/index.d.ts +26 -14
- package/dist/schemas/index.js +9 -7
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/settings-schemas.d.ts +25 -19
- package/dist/schemas/settings-schemas.js +10 -7
- package/dist/schemas/settings-schemas.js.map +1 -1
- package/dist/utils/confirmation-service.js +24 -0
- package/dist/utils/confirmation-service.js.map +1 -1
- package/dist/utils/model-config.js +2 -1
- package/dist/utils/model-config.js.map +1 -1
- package/dist/utils/settings-manager.js +10 -9
- package/dist/utils/settings-manager.js.map +1 -1
- package/eslint.config.js +3 -0
- package/package.json +2 -2
- package/automatosx.config.json +0 -333
- package/dist/schemas/mcp-schemas.d.ts +0 -171
- package/dist/schemas/mcp-schemas.js +0 -77
- package/dist/schemas/mcp-schemas.js.map +0 -1
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
* Ensures type safety for external API interactions
|
|
4
4
|
*/
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
+
import { __brand } from '@ax-cli/schemas';
|
|
7
|
+
export { __brand };
|
|
6
8
|
export declare const GrokToolCallSchema: z.ZodObject<{
|
|
7
|
-
id: z.ZodString
|
|
9
|
+
id: z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "ToolCallId">, string>;
|
|
8
10
|
type: z.ZodLiteral<"function">;
|
|
9
11
|
function: z.ZodObject<{
|
|
10
12
|
name: z.ZodString;
|
|
@@ -21,7 +23,9 @@ export declare const GrokToolCallSchema: z.ZodObject<{
|
|
|
21
23
|
name: string;
|
|
22
24
|
arguments: string;
|
|
23
25
|
};
|
|
24
|
-
id: string
|
|
26
|
+
id: string & {
|
|
27
|
+
readonly [__brand]: "ToolCallId";
|
|
28
|
+
};
|
|
25
29
|
type: "function";
|
|
26
30
|
}, {
|
|
27
31
|
function: {
|
|
@@ -36,7 +40,7 @@ export declare const GrokMessageSchema: z.ZodObject<{
|
|
|
36
40
|
role: z.ZodEnum<["system", "user", "assistant", "tool"]>;
|
|
37
41
|
content: z.ZodNullable<z.ZodString>;
|
|
38
42
|
tool_calls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
39
|
-
id: z.ZodString
|
|
43
|
+
id: z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "ToolCallId">, string>;
|
|
40
44
|
type: z.ZodLiteral<"function">;
|
|
41
45
|
function: z.ZodObject<{
|
|
42
46
|
name: z.ZodString;
|
|
@@ -53,7 +57,9 @@ export declare const GrokMessageSchema: z.ZodObject<{
|
|
|
53
57
|
name: string;
|
|
54
58
|
arguments: string;
|
|
55
59
|
};
|
|
56
|
-
id: string
|
|
60
|
+
id: string & {
|
|
61
|
+
readonly [__brand]: "ToolCallId";
|
|
62
|
+
};
|
|
57
63
|
type: "function";
|
|
58
64
|
}, {
|
|
59
65
|
function: {
|
|
@@ -63,7 +69,7 @@ export declare const GrokMessageSchema: z.ZodObject<{
|
|
|
63
69
|
id: string;
|
|
64
70
|
type: "function";
|
|
65
71
|
}>, "many">>;
|
|
66
|
-
tool_call_id: z.ZodOptional<z.ZodString
|
|
72
|
+
tool_call_id: z.ZodOptional<z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "ToolCallId">, string>>;
|
|
67
73
|
name: z.ZodOptional<z.ZodString>;
|
|
68
74
|
}, "strip", z.ZodTypeAny, {
|
|
69
75
|
role: "system" | "user" | "assistant" | "tool";
|
|
@@ -74,10 +80,12 @@ export declare const GrokMessageSchema: z.ZodObject<{
|
|
|
74
80
|
name: string;
|
|
75
81
|
arguments: string;
|
|
76
82
|
};
|
|
77
|
-
id: string
|
|
83
|
+
id: string & {
|
|
84
|
+
readonly [__brand]: "ToolCallId";
|
|
85
|
+
};
|
|
78
86
|
type: "function";
|
|
79
87
|
}[] | undefined;
|
|
80
|
-
tool_call_id?: string | undefined;
|
|
88
|
+
tool_call_id?: import("@ax-cli/schemas").Brand<string, "ToolCallId"> | undefined;
|
|
81
89
|
}, {
|
|
82
90
|
role: "system" | "user" | "assistant" | "tool";
|
|
83
91
|
content: string | null;
|
|
@@ -97,14 +105,14 @@ export declare const GrokResponseSchema: z.ZodObject<{
|
|
|
97
105
|
id: z.ZodOptional<z.ZodString>;
|
|
98
106
|
object: z.ZodOptional<z.ZodString>;
|
|
99
107
|
created: z.ZodOptional<z.ZodNumber>;
|
|
100
|
-
model: z.ZodOptional<z.ZodString
|
|
108
|
+
model: z.ZodOptional<z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "ModelId">, string>>;
|
|
101
109
|
choices: z.ZodArray<z.ZodObject<{
|
|
102
110
|
index: z.ZodOptional<z.ZodNumber>;
|
|
103
111
|
message: z.ZodObject<{
|
|
104
112
|
role: z.ZodString;
|
|
105
113
|
content: z.ZodNullable<z.ZodString>;
|
|
106
114
|
tool_calls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
107
|
-
id: z.ZodString
|
|
115
|
+
id: z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "ToolCallId">, string>;
|
|
108
116
|
type: z.ZodLiteral<"function">;
|
|
109
117
|
function: z.ZodObject<{
|
|
110
118
|
name: z.ZodString;
|
|
@@ -121,7 +129,9 @@ export declare const GrokResponseSchema: z.ZodObject<{
|
|
|
121
129
|
name: string;
|
|
122
130
|
arguments: string;
|
|
123
131
|
};
|
|
124
|
-
id: string
|
|
132
|
+
id: string & {
|
|
133
|
+
readonly [__brand]: "ToolCallId";
|
|
134
|
+
};
|
|
125
135
|
type: "function";
|
|
126
136
|
}, {
|
|
127
137
|
function: {
|
|
@@ -139,7 +149,9 @@ export declare const GrokResponseSchema: z.ZodObject<{
|
|
|
139
149
|
name: string;
|
|
140
150
|
arguments: string;
|
|
141
151
|
};
|
|
142
|
-
id: string
|
|
152
|
+
id: string & {
|
|
153
|
+
readonly [__brand]: "ToolCallId";
|
|
154
|
+
};
|
|
143
155
|
type: "function";
|
|
144
156
|
}[] | undefined;
|
|
145
157
|
}, {
|
|
@@ -164,7 +176,9 @@ export declare const GrokResponseSchema: z.ZodObject<{
|
|
|
164
176
|
name: string;
|
|
165
177
|
arguments: string;
|
|
166
178
|
};
|
|
167
|
-
id: string
|
|
179
|
+
id: string & {
|
|
180
|
+
readonly [__brand]: "ToolCallId";
|
|
181
|
+
};
|
|
168
182
|
type: "function";
|
|
169
183
|
}[] | undefined;
|
|
170
184
|
};
|
|
@@ -209,7 +223,9 @@ export declare const GrokResponseSchema: z.ZodObject<{
|
|
|
209
223
|
name: string;
|
|
210
224
|
arguments: string;
|
|
211
225
|
};
|
|
212
|
-
id: string
|
|
226
|
+
id: string & {
|
|
227
|
+
readonly [__brand]: "ToolCallId";
|
|
228
|
+
};
|
|
213
229
|
type: "function";
|
|
214
230
|
}[] | undefined;
|
|
215
231
|
};
|
|
@@ -219,7 +235,7 @@ export declare const GrokResponseSchema: z.ZodObject<{
|
|
|
219
235
|
object?: string | undefined;
|
|
220
236
|
id?: string | undefined;
|
|
221
237
|
created?: number | undefined;
|
|
222
|
-
model?: string | undefined;
|
|
238
|
+
model?: import("@ax-cli/schemas").Brand<string, "ModelId"> | undefined;
|
|
223
239
|
usage?: {
|
|
224
240
|
prompt_tokens: number;
|
|
225
241
|
completion_tokens: number;
|
|
@@ -291,7 +307,7 @@ export declare const StreamingChunkSchema: z.ZodDiscriminatedUnion<"type", [z.Zo
|
|
|
291
307
|
}>, z.ZodObject<{
|
|
292
308
|
type: z.ZodLiteral<"tool_calls">;
|
|
293
309
|
toolCalls: z.ZodArray<z.ZodObject<{
|
|
294
|
-
id: z.ZodString
|
|
310
|
+
id: z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "ToolCallId">, string>;
|
|
295
311
|
type: z.ZodLiteral<"function">;
|
|
296
312
|
function: z.ZodObject<{
|
|
297
313
|
name: z.ZodString;
|
|
@@ -308,7 +324,9 @@ export declare const StreamingChunkSchema: z.ZodDiscriminatedUnion<"type", [z.Zo
|
|
|
308
324
|
name: string;
|
|
309
325
|
arguments: string;
|
|
310
326
|
};
|
|
311
|
-
id: string
|
|
327
|
+
id: string & {
|
|
328
|
+
readonly [__brand]: "ToolCallId";
|
|
329
|
+
};
|
|
312
330
|
type: "function";
|
|
313
331
|
}, {
|
|
314
332
|
function: {
|
|
@@ -325,7 +343,9 @@ export declare const StreamingChunkSchema: z.ZodDiscriminatedUnion<"type", [z.Zo
|
|
|
325
343
|
name: string;
|
|
326
344
|
arguments: string;
|
|
327
345
|
};
|
|
328
|
-
id: string
|
|
346
|
+
id: string & {
|
|
347
|
+
readonly [__brand]: "ToolCallId";
|
|
348
|
+
};
|
|
329
349
|
type: "function";
|
|
330
350
|
}[];
|
|
331
351
|
}, {
|
|
@@ -341,7 +361,7 @@ export declare const StreamingChunkSchema: z.ZodDiscriminatedUnion<"type", [z.Zo
|
|
|
341
361
|
}>, z.ZodObject<{
|
|
342
362
|
type: z.ZodLiteral<"tool_result">;
|
|
343
363
|
toolCall: z.ZodObject<{
|
|
344
|
-
id: z.ZodString
|
|
364
|
+
id: z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "ToolCallId">, string>;
|
|
345
365
|
type: z.ZodLiteral<"function">;
|
|
346
366
|
function: z.ZodObject<{
|
|
347
367
|
name: z.ZodString;
|
|
@@ -358,7 +378,9 @@ export declare const StreamingChunkSchema: z.ZodDiscriminatedUnion<"type", [z.Zo
|
|
|
358
378
|
name: string;
|
|
359
379
|
arguments: string;
|
|
360
380
|
};
|
|
361
|
-
id: string
|
|
381
|
+
id: string & {
|
|
382
|
+
readonly [__brand]: "ToolCallId";
|
|
383
|
+
};
|
|
362
384
|
type: "function";
|
|
363
385
|
}, {
|
|
364
386
|
function: {
|
|
@@ -388,7 +410,9 @@ export declare const StreamingChunkSchema: z.ZodDiscriminatedUnion<"type", [z.Zo
|
|
|
388
410
|
name: string;
|
|
389
411
|
arguments: string;
|
|
390
412
|
};
|
|
391
|
-
id: string
|
|
413
|
+
id: string & {
|
|
414
|
+
readonly [__brand]: "ToolCallId";
|
|
415
|
+
};
|
|
392
416
|
type: "function";
|
|
393
417
|
};
|
|
394
418
|
toolResult: {
|
|
@@ -433,7 +457,7 @@ export declare const ChatEntrySchema: z.ZodObject<{
|
|
|
433
457
|
content: z.ZodString;
|
|
434
458
|
timestamp: z.ZodDate;
|
|
435
459
|
toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
436
|
-
id: z.ZodString
|
|
460
|
+
id: z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "ToolCallId">, string>;
|
|
437
461
|
type: z.ZodLiteral<"function">;
|
|
438
462
|
function: z.ZodObject<{
|
|
439
463
|
name: z.ZodString;
|
|
@@ -450,7 +474,9 @@ export declare const ChatEntrySchema: z.ZodObject<{
|
|
|
450
474
|
name: string;
|
|
451
475
|
arguments: string;
|
|
452
476
|
};
|
|
453
|
-
id: string
|
|
477
|
+
id: string & {
|
|
478
|
+
readonly [__brand]: "ToolCallId";
|
|
479
|
+
};
|
|
454
480
|
type: "function";
|
|
455
481
|
}, {
|
|
456
482
|
function: {
|
|
@@ -461,7 +487,7 @@ export declare const ChatEntrySchema: z.ZodObject<{
|
|
|
461
487
|
type: "function";
|
|
462
488
|
}>, "many">>;
|
|
463
489
|
toolCall: z.ZodOptional<z.ZodObject<{
|
|
464
|
-
id: z.ZodString
|
|
490
|
+
id: z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "ToolCallId">, string>;
|
|
465
491
|
type: z.ZodLiteral<"function">;
|
|
466
492
|
function: z.ZodObject<{
|
|
467
493
|
name: z.ZodString;
|
|
@@ -478,7 +504,9 @@ export declare const ChatEntrySchema: z.ZodObject<{
|
|
|
478
504
|
name: string;
|
|
479
505
|
arguments: string;
|
|
480
506
|
};
|
|
481
|
-
id: string
|
|
507
|
+
id: string & {
|
|
508
|
+
readonly [__brand]: "ToolCallId";
|
|
509
|
+
};
|
|
482
510
|
type: "function";
|
|
483
511
|
}, {
|
|
484
512
|
function: {
|
|
@@ -511,7 +539,9 @@ export declare const ChatEntrySchema: z.ZodObject<{
|
|
|
511
539
|
name: string;
|
|
512
540
|
arguments: string;
|
|
513
541
|
};
|
|
514
|
-
id: string
|
|
542
|
+
id: string & {
|
|
543
|
+
readonly [__brand]: "ToolCallId";
|
|
544
|
+
};
|
|
515
545
|
type: "function";
|
|
516
546
|
}[] | undefined;
|
|
517
547
|
toolCall?: {
|
|
@@ -519,7 +549,9 @@ export declare const ChatEntrySchema: z.ZodObject<{
|
|
|
519
549
|
name: string;
|
|
520
550
|
arguments: string;
|
|
521
551
|
};
|
|
522
|
-
id: string
|
|
552
|
+
id: string & {
|
|
553
|
+
readonly [__brand]: "ToolCallId";
|
|
554
|
+
};
|
|
523
555
|
type: "function";
|
|
524
556
|
} | undefined;
|
|
525
557
|
toolResult?: {
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
* Ensures type safety for external API interactions
|
|
4
4
|
*/
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
-
import { MessageRoleEnum } from '@ax-cli/schemas';
|
|
6
|
+
import { __brand, MessageRoleEnum, ToolCallIdSchema, ModelIdSchema } from '@ax-cli/schemas';
|
|
7
|
+
// Re-export __brand to satisfy TypeScript's type resolution
|
|
8
|
+
export { __brand };
|
|
7
9
|
// Grok Tool Call Schema
|
|
8
10
|
export const GrokToolCallSchema = z.object({
|
|
9
|
-
id:
|
|
11
|
+
id: ToolCallIdSchema,
|
|
10
12
|
type: z.literal('function'),
|
|
11
13
|
function: z.object({
|
|
12
14
|
name: z.string(),
|
|
@@ -18,7 +20,7 @@ export const GrokMessageSchema = z.object({
|
|
|
18
20
|
role: MessageRoleEnum,
|
|
19
21
|
content: z.string().nullable(),
|
|
20
22
|
tool_calls: z.array(GrokToolCallSchema).optional(),
|
|
21
|
-
tool_call_id:
|
|
23
|
+
tool_call_id: ToolCallIdSchema.optional(),
|
|
22
24
|
name: z.string().optional(),
|
|
23
25
|
});
|
|
24
26
|
// Grok Response Schema
|
|
@@ -26,7 +28,7 @@ export const GrokResponseSchema = z.object({
|
|
|
26
28
|
id: z.string().optional(),
|
|
27
29
|
object: z.string().optional(),
|
|
28
30
|
created: z.number().optional(),
|
|
29
|
-
model:
|
|
31
|
+
model: ModelIdSchema.optional(),
|
|
30
32
|
choices: z.array(z.object({
|
|
31
33
|
index: z.number().optional(),
|
|
32
34
|
message: z.object({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-schemas.js","sourceRoot":"","sources":["../../src/schemas/api-schemas.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"api-schemas.js","sourceRoot":"","sources":["../../src/schemas/api-schemas.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE5F,4DAA4D;AAC5D,OAAO,EAAE,OAAO,EAAE,CAAC;AAEnB,wBAAwB;AACxB,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,EAAE,EAAE,gBAAgB;IACpB,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;IAC3B,QAAQ,E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AS,CAAC,IAAI,CAAC,CAAC;IAClD,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;IAC9C,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAa;IAC5C,OAAO,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAa;IAC7C,OAAO,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC"}
|
package/dist/schemas/index.d.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { __brand } from '@ax-cli/schemas';
|
|
3
|
+
export { __brand };
|
|
2
4
|
/**
|
|
3
5
|
* Configuration schemas using Zod for runtime validation
|
|
4
6
|
*/
|
|
5
7
|
export declare const UserSettingsSchema: z.ZodObject<{
|
|
6
8
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
7
9
|
baseURL: z.ZodOptional<z.ZodString>;
|
|
8
|
-
defaultModel: z.ZodOptional<z.ZodString
|
|
9
|
-
models: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
10
|
+
defaultModel: z.ZodOptional<z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "ModelId">, string>>;
|
|
11
|
+
models: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "ModelId">, string>, "many">>;
|
|
10
12
|
}, "strip", z.ZodTypeAny, {
|
|
11
13
|
apiKey?: string | undefined;
|
|
12
14
|
baseURL?: string | undefined;
|
|
13
|
-
defaultModel?: string | undefined;
|
|
14
|
-
models?: string[] | undefined;
|
|
15
|
+
defaultModel?: import("@ax-cli/schemas").Brand<string, "ModelId"> | undefined;
|
|
16
|
+
models?: import("@ax-cli/schemas").Brand<string, "ModelId">[] | undefined;
|
|
15
17
|
}, {
|
|
16
18
|
apiKey?: string | undefined;
|
|
17
19
|
baseURL?: string | undefined;
|
|
@@ -20,16 +22,18 @@ export declare const UserSettingsSchema: z.ZodObject<{
|
|
|
20
22
|
}>;
|
|
21
23
|
export type UserSettings = z.infer<typeof UserSettingsSchema>;
|
|
22
24
|
export declare const ProjectSettingsSchema: z.ZodObject<{
|
|
23
|
-
model: z.ZodOptional<z.ZodString
|
|
25
|
+
model: z.ZodOptional<z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "ModelId">, string>>;
|
|
24
26
|
mcpServers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
25
|
-
name: z.ZodString
|
|
27
|
+
name: z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "MCPServerId">, string>;
|
|
26
28
|
transport: z.ZodEnum<["stdio", "http", "sse"]>;
|
|
27
29
|
command: z.ZodOptional<z.ZodString>;
|
|
28
30
|
args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
29
31
|
url: z.ZodOptional<z.ZodString>;
|
|
30
32
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
31
33
|
}, "strip", z.ZodTypeAny, {
|
|
32
|
-
name: string
|
|
34
|
+
name: string & {
|
|
35
|
+
readonly [__brand]: "MCPServerId";
|
|
36
|
+
};
|
|
33
37
|
transport: "stdio" | "http" | "sse";
|
|
34
38
|
url?: string | undefined;
|
|
35
39
|
env?: Record<string, string> | undefined;
|
|
@@ -44,9 +48,11 @@ export declare const ProjectSettingsSchema: z.ZodObject<{
|
|
|
44
48
|
args?: string[] | undefined;
|
|
45
49
|
}>>>;
|
|
46
50
|
}, "strip", z.ZodTypeAny, {
|
|
47
|
-
model?: string | undefined;
|
|
51
|
+
model?: import("@ax-cli/schemas").Brand<string, "ModelId"> | undefined;
|
|
48
52
|
mcpServers?: Record<string, {
|
|
49
|
-
name: string
|
|
53
|
+
name: string & {
|
|
54
|
+
readonly [__brand]: "MCPServerId";
|
|
55
|
+
};
|
|
50
56
|
transport: "stdio" | "http" | "sse";
|
|
51
57
|
url?: string | undefined;
|
|
52
58
|
env?: Record<string, string> | undefined;
|
|
@@ -66,14 +72,16 @@ export declare const ProjectSettingsSchema: z.ZodObject<{
|
|
|
66
72
|
}>;
|
|
67
73
|
export type ProjectSettings = z.infer<typeof ProjectSettingsSchema>;
|
|
68
74
|
export declare const MCPServerConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
69
|
-
name: z.ZodString
|
|
75
|
+
name: z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "MCPServerId">, string>;
|
|
70
76
|
transport: z.ZodEnum<["stdio", "http", "sse"]>;
|
|
71
77
|
command: z.ZodOptional<z.ZodString>;
|
|
72
78
|
args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
73
79
|
url: z.ZodOptional<z.ZodString>;
|
|
74
80
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
75
81
|
}, "strip", z.ZodTypeAny, {
|
|
76
|
-
name: string
|
|
82
|
+
name: string & {
|
|
83
|
+
readonly [__brand]: "MCPServerId";
|
|
84
|
+
};
|
|
77
85
|
transport: "stdio" | "http" | "sse";
|
|
78
86
|
url?: string | undefined;
|
|
79
87
|
env?: Record<string, string> | undefined;
|
|
@@ -87,7 +95,9 @@ export declare const MCPServerConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
87
95
|
command?: string | undefined;
|
|
88
96
|
args?: string[] | undefined;
|
|
89
97
|
}>, {
|
|
90
|
-
name: string
|
|
98
|
+
name: string & {
|
|
99
|
+
readonly [__brand]: "MCPServerId";
|
|
100
|
+
};
|
|
91
101
|
transport: "stdio" | "http" | "sse";
|
|
92
102
|
url?: string | undefined;
|
|
93
103
|
env?: Record<string, string> | undefined;
|
|
@@ -117,7 +127,7 @@ export declare const APIResponseSchema: z.ZodObject<{
|
|
|
117
127
|
id: z.ZodString;
|
|
118
128
|
object: z.ZodString;
|
|
119
129
|
created: z.ZodNumber;
|
|
120
|
-
model: z.ZodString
|
|
130
|
+
model: z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "ModelId">, string>;
|
|
121
131
|
choices: z.ZodArray<z.ZodObject<{
|
|
122
132
|
index: z.ZodNumber;
|
|
123
133
|
message: z.ZodObject<{
|
|
@@ -223,7 +233,9 @@ export declare const APIResponseSchema: z.ZodObject<{
|
|
|
223
233
|
object: string;
|
|
224
234
|
id: string;
|
|
225
235
|
created: number;
|
|
226
|
-
model: string
|
|
236
|
+
model: string & {
|
|
237
|
+
readonly [__brand]: "ModelId";
|
|
238
|
+
};
|
|
227
239
|
choices: {
|
|
228
240
|
message: {
|
|
229
241
|
role: "system" | "user" | "assistant" | "tool";
|
package/dist/schemas/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { MessageRoleEnum, FinishReasonEnum, TransportEnum } from '@ax-cli/schemas';
|
|
2
|
+
import { __brand, MessageRoleEnum, FinishReasonEnum, TransportEnum, ModelIdSchema, MCPServerIdSchema } from '@ax-cli/schemas';
|
|
3
|
+
// Re-export __brand to satisfy TypeScript's type resolution
|
|
4
|
+
export { __brand };
|
|
3
5
|
/**
|
|
4
6
|
* Configuration schemas using Zod for runtime validation
|
|
5
7
|
*/
|
|
@@ -7,14 +9,14 @@ import { MessageRoleEnum, FinishReasonEnum, TransportEnum } from '@ax-cli/schema
|
|
|
7
9
|
export const UserSettingsSchema = z.object({
|
|
8
10
|
apiKey: z.string().optional(),
|
|
9
11
|
baseURL: z.string().url().optional(),
|
|
10
|
-
defaultModel:
|
|
11
|
-
models: z.array(
|
|
12
|
+
defaultModel: ModelIdSchema.optional(),
|
|
13
|
+
models: z.array(ModelIdSchema).optional(),
|
|
12
14
|
});
|
|
13
15
|
// Project settings schema
|
|
14
16
|
export const ProjectSettingsSchema = z.object({
|
|
15
|
-
model:
|
|
17
|
+
model: ModelIdSchema.optional(),
|
|
16
18
|
mcpServers: z.record(z.string(), z.object({
|
|
17
|
-
name:
|
|
19
|
+
name: MCPServerIdSchema,
|
|
18
20
|
transport: TransportEnum,
|
|
19
21
|
command: z.string().optional(),
|
|
20
22
|
args: z.array(z.string()).optional(),
|
|
@@ -24,7 +26,7 @@ export const ProjectSettingsSchema = z.object({
|
|
|
24
26
|
});
|
|
25
27
|
// MCP Server configuration schema
|
|
26
28
|
export const MCPServerConfigSchema = z.object({
|
|
27
|
-
name:
|
|
29
|
+
name: MCPServerIdSchema,
|
|
28
30
|
transport: TransportEnum,
|
|
29
31
|
command: z.string().optional(),
|
|
30
32
|
args: z.array(z.string()).optional(),
|
|
@@ -51,7 +53,7 @@ export const APIResponseSchema = z.object({
|
|
|
51
53
|
id: z.string(),
|
|
52
54
|
object: z.string(),
|
|
53
55
|
created: z.number(),
|
|
54
|
-
model:
|
|
56
|
+
model: ModelIdSchema,
|
|
55
57
|
choices: z.array(z.object({
|
|
56
58
|
index: z.number(),
|
|
57
59
|
message: z.object({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAE9H,4DAA4D;AAC5D,OAAO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M,MAAM,GAAG,kBAAkB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAClD,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;IAC9C,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,IAAa;IAKvD,MAAM,MAAM,GAAG,qBAAqB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACrD,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;IAC9C,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;AACjD,CAAC"}
|
|
@@ -3,14 +3,16 @@
|
|
|
3
3
|
* Ensures graceful degradation on corrupted config files
|
|
4
4
|
*/
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
+
import { __brand } from '@ax-cli/schemas';
|
|
7
|
+
export { __brand };
|
|
6
8
|
export declare const UserSettingsSchema: z.ZodObject<{
|
|
7
9
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
8
10
|
baseURL: z.ZodOptional<z.ZodString>;
|
|
9
|
-
defaultModel: z.ZodOptional<z.ZodString
|
|
10
|
-
currentModel: z.ZodOptional<z.ZodString
|
|
11
|
+
defaultModel: z.ZodOptional<z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "ModelId">, string>>;
|
|
12
|
+
currentModel: z.ZodOptional<z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "ModelId">, string>>;
|
|
11
13
|
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
12
14
|
temperature: z.ZodOptional<z.ZodNumber>;
|
|
13
|
-
models: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
15
|
+
models: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "ModelId">, string>, "many">>;
|
|
14
16
|
confirmations: z.ZodOptional<z.ZodObject<{
|
|
15
17
|
fileOperations: z.ZodOptional<z.ZodBoolean>;
|
|
16
18
|
bashCommands: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -24,11 +26,11 @@ export declare const UserSettingsSchema: z.ZodObject<{
|
|
|
24
26
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
25
27
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
26
28
|
baseURL: z.ZodOptional<z.ZodString>;
|
|
27
|
-
defaultModel: z.ZodOptional<z.ZodString
|
|
28
|
-
currentModel: z.ZodOptional<z.ZodString
|
|
29
|
+
defaultModel: z.ZodOptional<z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "ModelId">, string>>;
|
|
30
|
+
currentModel: z.ZodOptional<z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "ModelId">, string>>;
|
|
29
31
|
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
30
32
|
temperature: z.ZodOptional<z.ZodNumber>;
|
|
31
|
-
models: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
33
|
+
models: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "ModelId">, string>, "many">>;
|
|
32
34
|
confirmations: z.ZodOptional<z.ZodObject<{
|
|
33
35
|
fileOperations: z.ZodOptional<z.ZodBoolean>;
|
|
34
36
|
bashCommands: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -42,11 +44,11 @@ export declare const UserSettingsSchema: z.ZodObject<{
|
|
|
42
44
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
43
45
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
44
46
|
baseURL: z.ZodOptional<z.ZodString>;
|
|
45
|
-
defaultModel: z.ZodOptional<z.ZodString
|
|
46
|
-
currentModel: z.ZodOptional<z.ZodString
|
|
47
|
+
defaultModel: z.ZodOptional<z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "ModelId">, string>>;
|
|
48
|
+
currentModel: z.ZodOptional<z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "ModelId">, string>>;
|
|
47
49
|
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
48
50
|
temperature: z.ZodOptional<z.ZodNumber>;
|
|
49
|
-
models: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
51
|
+
models: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "ModelId">, string>, "many">>;
|
|
50
52
|
confirmations: z.ZodOptional<z.ZodObject<{
|
|
51
53
|
fileOperations: z.ZodOptional<z.ZodBoolean>;
|
|
52
54
|
bashCommands: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -60,35 +62,37 @@ export declare const UserSettingsSchema: z.ZodObject<{
|
|
|
60
62
|
}, z.ZodTypeAny, "passthrough">>;
|
|
61
63
|
export declare const ProjectSettingsSchema: z.ZodObject<{
|
|
62
64
|
name: z.ZodOptional<z.ZodString>;
|
|
63
|
-
model: z.ZodOptional<z.ZodString
|
|
64
|
-
currentModel: z.ZodOptional<z.ZodString
|
|
65
|
+
model: z.ZodOptional<z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "ModelId">, string>>;
|
|
66
|
+
currentModel: z.ZodOptional<z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "ModelId">, string>>;
|
|
65
67
|
customInstructions: z.ZodOptional<z.ZodString>;
|
|
66
68
|
excludePatterns: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
67
69
|
includePatterns: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
68
70
|
mcpServers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
69
71
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
70
72
|
name: z.ZodOptional<z.ZodString>;
|
|
71
|
-
model: z.ZodOptional<z.ZodString
|
|
72
|
-
currentModel: z.ZodOptional<z.ZodString
|
|
73
|
+
model: z.ZodOptional<z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "ModelId">, string>>;
|
|
74
|
+
currentModel: z.ZodOptional<z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "ModelId">, string>>;
|
|
73
75
|
customInstructions: z.ZodOptional<z.ZodString>;
|
|
74
76
|
excludePatterns: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
75
77
|
includePatterns: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
76
78
|
mcpServers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
77
79
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
78
80
|
name: z.ZodOptional<z.ZodString>;
|
|
79
|
-
model: z.ZodOptional<z.ZodString
|
|
80
|
-
currentModel: z.ZodOptional<z.ZodString
|
|
81
|
+
model: z.ZodOptional<z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "ModelId">, string>>;
|
|
82
|
+
currentModel: z.ZodOptional<z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "ModelId">, string>>;
|
|
81
83
|
customInstructions: z.ZodOptional<z.ZodString>;
|
|
82
84
|
excludePatterns: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
83
85
|
includePatterns: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
84
86
|
mcpServers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
85
87
|
}, z.ZodTypeAny, "passthrough">>;
|
|
86
88
|
export declare const ModelOptionSchema: z.ZodObject<{
|
|
87
|
-
model: z.ZodString
|
|
89
|
+
model: z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "ModelId">, string>;
|
|
88
90
|
description: z.ZodOptional<z.ZodString>;
|
|
89
91
|
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
90
92
|
}, "strip", z.ZodTypeAny, {
|
|
91
|
-
model: string
|
|
93
|
+
model: string & {
|
|
94
|
+
readonly [__brand]: "ModelId";
|
|
95
|
+
};
|
|
92
96
|
maxTokens?: number | undefined;
|
|
93
97
|
description?: string | undefined;
|
|
94
98
|
}, {
|
|
@@ -119,7 +123,7 @@ export declare const MCPTransportConfigSchema: z.ZodObject<{
|
|
|
119
123
|
args?: string[] | undefined;
|
|
120
124
|
}>;
|
|
121
125
|
export declare const MCPServerConfigSchema: z.ZodObject<{
|
|
122
|
-
name: z.ZodString
|
|
126
|
+
name: z.ZodEffects<z.ZodString, import("@ax-cli/schemas").Brand<string, "MCPServerId">, string>;
|
|
123
127
|
transport: z.ZodObject<{
|
|
124
128
|
type: z.ZodEnum<["stdio", "http", "sse", "streamable_http"]>;
|
|
125
129
|
command: z.ZodOptional<z.ZodString>;
|
|
@@ -146,7 +150,9 @@ export declare const MCPServerConfigSchema: z.ZodObject<{
|
|
|
146
150
|
args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
147
151
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
148
152
|
}, "strip", z.ZodTypeAny, {
|
|
149
|
-
name: string
|
|
153
|
+
name: string & {
|
|
154
|
+
readonly [__brand]: "MCPServerId";
|
|
155
|
+
};
|
|
150
156
|
transport: {
|
|
151
157
|
type: "stdio" | "http" | "sse" | "streamable_http";
|
|
152
158
|
headers?: Record<string, string> | undefined;
|
|
@@ -3,15 +3,18 @@
|
|
|
3
3
|
* Ensures graceful degradation on corrupted config files
|
|
4
4
|
*/
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
+
import { __brand, ModelIdSchema, MCPServerIdSchema } from '@ax-cli/schemas';
|
|
7
|
+
// Re-export __brand to satisfy TypeScript's type resolution
|
|
8
|
+
export { __brand };
|
|
6
9
|
// User Settings Schema
|
|
7
10
|
export const UserSettingsSchema = z.object({
|
|
8
11
|
apiKey: z.string().optional(),
|
|
9
12
|
baseURL: z.string().optional(), // Remove .url() to allow any string
|
|
10
|
-
defaultModel:
|
|
11
|
-
currentModel:
|
|
13
|
+
defaultModel: ModelIdSchema.optional(),
|
|
14
|
+
currentModel: ModelIdSchema.optional(),
|
|
12
15
|
maxTokens: z.number().int().positive().optional(),
|
|
13
16
|
temperature: z.number().min(0).max(2).optional(),
|
|
14
|
-
models: z.array(
|
|
17
|
+
models: z.array(ModelIdSchema).optional(),
|
|
15
18
|
confirmations: z.object({
|
|
16
19
|
fileOperations: z.boolean().optional(),
|
|
17
20
|
bashCommands: z.boolean().optional(),
|
|
@@ -20,8 +23,8 @@ export const UserSettingsSchema = z.object({
|
|
|
20
23
|
// Project Settings Schema
|
|
21
24
|
export const ProjectSettingsSchema = z.object({
|
|
22
25
|
name: z.string().optional(),
|
|
23
|
-
model:
|
|
24
|
-
currentModel:
|
|
26
|
+
model: ModelIdSchema.optional(), // Legacy field
|
|
27
|
+
currentModel: ModelIdSchema.optional(),
|
|
25
28
|
customInstructions: z.string().optional(),
|
|
26
29
|
excludePatterns: z.array(z.string()).optional(),
|
|
27
30
|
includePatterns: z.array(z.string()).optional(),
|
|
@@ -29,7 +32,7 @@ export const ProjectSettingsSchema = z.object({
|
|
|
29
32
|
}).passthrough(); // Allow additional properties for backward compatibility
|
|
30
33
|
// Model Option Schema
|
|
31
34
|
export const ModelOptionSchema = z.object({
|
|
32
|
-
model:
|
|
35
|
+
model: ModelIdSchema,
|
|
33
36
|
description: z.string().optional(),
|
|
34
37
|
maxTokens: z.number().int().positive().optional(),
|
|
35
38
|
});
|
|
@@ -43,7 +46,7 @@ export const MCPTransportConfigSchema = z.object({
|
|
|
43
46
|
headers: z.record(z.string()).optional(),
|
|
44
47
|
});
|
|
45
48
|
export const MCPServerConfigSchema = z.object({
|
|
46
|
-
name:
|
|
49
|
+
name: MCPServerIdSchema,
|
|
47
50
|
transport: MCPTransportConfigSchema,
|
|
48
51
|
command: z.string().optional(), // Legacy support
|
|
49
52
|
args: z.array(z.string()).optional(), // Legacy support
|