@ogment-ai/cli 0.3.5 → 0.4.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 +88 -74
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +512 -247
- package/dist/commands/auth.d.ts +22 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +29 -0
- package/dist/commands/catalog.d.ts +29 -0
- package/dist/commands/catalog.d.ts.map +1 -0
- package/dist/commands/catalog.js +151 -0
- package/dist/commands/invoke.d.ts +17 -0
- package/dist/commands/invoke.d.ts.map +1 -0
- package/dist/commands/invoke.js +123 -0
- package/dist/commands/{info.d.ts → status.d.ts} +4 -4
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/{info.js → status.js} +1 -1
- package/dist/output/envelope.d.ts +19 -0
- package/dist/output/envelope.d.ts.map +1 -0
- package/dist/output/envelope.js +51 -0
- package/dist/output/manager.d.ts +16 -3
- package/dist/output/manager.d.ts.map +1 -1
- package/dist/output/manager.js +27 -29
- package/dist/services/account.d.ts.map +1 -1
- package/dist/services/account.js +18 -2
- package/dist/services/auth.d.ts +14 -3
- package/dist/services/auth.d.ts.map +1 -1
- package/dist/services/auth.js +119 -15
- package/dist/services/info.d.ts.map +1 -1
- package/dist/services/info.js +11 -10
- package/dist/services/mcp.d.ts.map +1 -1
- package/dist/services/mcp.js +24 -23
- package/dist/shared/constants.d.ts +0 -1
- package/dist/shared/constants.d.ts.map +1 -1
- package/dist/shared/constants.js +0 -1
- package/dist/shared/error-codes.d.ts +28 -0
- package/dist/shared/error-codes.d.ts.map +1 -0
- package/dist/shared/error-codes.js +25 -0
- package/dist/shared/errors.d.ts +100 -9
- package/dist/shared/errors.d.ts.map +1 -1
- package/dist/shared/errors.js +103 -0
- package/dist/shared/exit-codes.d.ts +8 -5
- package/dist/shared/exit-codes.d.ts.map +1 -1
- package/dist/shared/exit-codes.js +31 -14
- package/dist/shared/guards.d.ts +5 -1
- package/dist/shared/guards.d.ts.map +1 -1
- package/dist/shared/guards.js +6 -1
- package/dist/shared/retry.d.ts +17 -0
- package/dist/shared/retry.d.ts.map +1 -0
- package/dist/shared/retry.js +27 -0
- package/dist/shared/schema-example.d.ts +2 -0
- package/dist/shared/schema-example.d.ts.map +1 -0
- package/dist/shared/schema-example.js +128 -0
- package/dist/shared/schemas.d.ts +0 -42
- package/dist/shared/schemas.d.ts.map +1 -1
- package/dist/shared/schemas.js +0 -21
- package/dist/shared/types.d.ts +84 -12
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/shared/types.js +1 -1
- package/package.json +5 -7
- package/dist/commands/call.d.ts +0 -14
- package/dist/commands/call.d.ts.map +0 -1
- package/dist/commands/call.js +0 -51
- package/dist/commands/describe.d.ts +0 -4
- package/dist/commands/describe.d.ts.map +0 -1
- package/dist/commands/describe.js +0 -109
- package/dist/commands/info.d.ts.map +0 -1
- package/dist/commands/servers.d.ts +0 -13
- package/dist/commands/servers.d.ts.map +0 -1
- package/dist/commands/servers.js +0 -29
- package/dist/postinstall.d.ts +0 -2
- package/dist/postinstall.d.ts.map +0 -1
- package/dist/postinstall.js +0 -12
package/dist/shared/errors.d.ts
CHANGED
|
@@ -1,35 +1,126 @@
|
|
|
1
|
+
import { ERROR_CODE, type ErrorCategory, type ErrorCode } from "./error-codes.js";
|
|
2
|
+
type AuthErrorCode = typeof ERROR_CODE.authDeviceExpired | typeof ERROR_CODE.authDevicePending | typeof ERROR_CODE.authInvalidCredentials | typeof ERROR_CODE.authRequired;
|
|
3
|
+
type RemoteErrorCode = typeof ERROR_CODE.remoteRateLimited | typeof ERROR_CODE.remoteUnavailable | typeof ERROR_CODE.transportRequestFailed;
|
|
4
|
+
type ValidationErrorCode = typeof ERROR_CODE.toolInputSchemaViolation | typeof ERROR_CODE.validationInvalidInput;
|
|
5
|
+
type ContractMismatchErrorCode = typeof ERROR_CODE.contractVersionUnsupported;
|
|
6
|
+
interface BaseAppErrorFields {
|
|
7
|
+
category: ErrorCategory;
|
|
8
|
+
code: ErrorCode;
|
|
9
|
+
retryable: boolean;
|
|
10
|
+
suggestedCommand: string | undefined;
|
|
11
|
+
}
|
|
1
12
|
declare const ValidationErrorBase: import("better-result").TaggedErrorClass<"ValidationError", {
|
|
2
|
-
message: string;
|
|
3
13
|
details?: string;
|
|
14
|
+
message: string;
|
|
4
15
|
}>;
|
|
5
|
-
|
|
16
|
+
interface ValidationErrorPayload {
|
|
17
|
+
code?: ValidationErrorCode;
|
|
18
|
+
details?: string;
|
|
19
|
+
message: string;
|
|
20
|
+
suggestedCommand?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare class ValidationError extends ValidationErrorBase implements BaseAppErrorFields {
|
|
23
|
+
readonly category: "validation";
|
|
24
|
+
readonly code: ValidationErrorCode;
|
|
25
|
+
readonly retryable = false;
|
|
26
|
+
readonly suggestedCommand: string | undefined;
|
|
27
|
+
constructor(payload: ValidationErrorPayload);
|
|
6
28
|
}
|
|
7
29
|
declare const AuthErrorBase: import("better-result").TaggedErrorClass<"AuthError", {
|
|
8
|
-
message: string;
|
|
9
30
|
details?: string;
|
|
31
|
+
message: string;
|
|
10
32
|
}>;
|
|
11
|
-
|
|
33
|
+
interface AuthErrorPayload {
|
|
34
|
+
code?: AuthErrorCode;
|
|
35
|
+
details?: string;
|
|
36
|
+
message: string;
|
|
37
|
+
retryable?: boolean;
|
|
38
|
+
suggestedCommand?: string;
|
|
39
|
+
}
|
|
40
|
+
export declare class AuthError extends AuthErrorBase implements BaseAppErrorFields {
|
|
41
|
+
readonly category: "auth";
|
|
42
|
+
readonly code: AuthErrorCode;
|
|
43
|
+
readonly retryable: boolean;
|
|
44
|
+
readonly suggestedCommand: string | undefined;
|
|
45
|
+
constructor(payload: AuthErrorPayload);
|
|
12
46
|
}
|
|
13
47
|
declare const NotFoundErrorBase: import("better-result").TaggedErrorClass<"NotFoundError", {
|
|
14
48
|
message: string;
|
|
15
49
|
resource: string;
|
|
16
50
|
}>;
|
|
17
|
-
|
|
51
|
+
interface NotFoundErrorPayload {
|
|
52
|
+
code?: typeof ERROR_CODE.toolNotFound;
|
|
53
|
+
message: string;
|
|
54
|
+
resource: string;
|
|
55
|
+
suggestedCommand?: string;
|
|
56
|
+
}
|
|
57
|
+
export declare class NotFoundError extends NotFoundErrorBase implements BaseAppErrorFields {
|
|
58
|
+
readonly category: "not_found";
|
|
59
|
+
readonly code: typeof ERROR_CODE.toolNotFound;
|
|
60
|
+
readonly retryable = false;
|
|
61
|
+
readonly suggestedCommand: string | undefined;
|
|
62
|
+
constructor(payload: NotFoundErrorPayload);
|
|
18
63
|
}
|
|
19
64
|
declare const RemoteRequestErrorBase: import("better-result").TaggedErrorClass<"RemoteRequestError", {
|
|
65
|
+
body?: string;
|
|
20
66
|
message: string;
|
|
21
67
|
status?: number;
|
|
68
|
+
}>;
|
|
69
|
+
interface RemoteRequestErrorPayload {
|
|
22
70
|
body?: string;
|
|
71
|
+
code?: RemoteErrorCode;
|
|
72
|
+
message: string;
|
|
73
|
+
status?: number;
|
|
74
|
+
suggestedCommand?: string;
|
|
75
|
+
}
|
|
76
|
+
export declare class RemoteRequestError extends RemoteRequestErrorBase implements BaseAppErrorFields {
|
|
77
|
+
readonly category: ErrorCategory;
|
|
78
|
+
readonly code: RemoteErrorCode;
|
|
79
|
+
readonly retryable: boolean;
|
|
80
|
+
readonly suggestedCommand: string | undefined;
|
|
81
|
+
constructor(payload: RemoteRequestErrorPayload);
|
|
82
|
+
}
|
|
83
|
+
declare const ContractMismatchErrorBase: import("better-result").TaggedErrorClass<"ContractMismatchError", {
|
|
84
|
+
details?: string;
|
|
85
|
+
message: string;
|
|
23
86
|
}>;
|
|
24
|
-
|
|
87
|
+
interface ContractMismatchErrorPayload {
|
|
88
|
+
code?: ContractMismatchErrorCode;
|
|
89
|
+
details?: string;
|
|
90
|
+
message: string;
|
|
91
|
+
suggestedCommand?: string;
|
|
92
|
+
}
|
|
93
|
+
export declare class ContractMismatchError extends ContractMismatchErrorBase implements BaseAppErrorFields {
|
|
94
|
+
readonly category: "contract_mismatch";
|
|
95
|
+
readonly code: ContractMismatchErrorCode;
|
|
96
|
+
readonly retryable = false;
|
|
97
|
+
readonly suggestedCommand: string | undefined;
|
|
98
|
+
constructor(payload: ContractMismatchErrorPayload);
|
|
25
99
|
}
|
|
26
100
|
declare const UnexpectedErrorBase: import("better-result").TaggedErrorClass<"UnexpectedError", {
|
|
27
|
-
message: string;
|
|
28
101
|
cause?: unknown;
|
|
102
|
+
message: string;
|
|
29
103
|
}>;
|
|
30
|
-
|
|
104
|
+
interface UnexpectedErrorPayload {
|
|
105
|
+
cause?: unknown;
|
|
106
|
+
code?: typeof ERROR_CODE.internalUnexpected;
|
|
107
|
+
message: string;
|
|
108
|
+
}
|
|
109
|
+
export declare class UnexpectedError extends UnexpectedErrorBase implements BaseAppErrorFields {
|
|
110
|
+
readonly category: "internal";
|
|
111
|
+
readonly code: typeof ERROR_CODE.internalUnexpected;
|
|
112
|
+
readonly retryable = false;
|
|
113
|
+
readonly suggestedCommand: undefined;
|
|
114
|
+
constructor(payload: UnexpectedErrorPayload);
|
|
115
|
+
}
|
|
116
|
+
export type AppError = AuthError | ContractMismatchError | NotFoundError | RemoteRequestError | UnexpectedError | ValidationError;
|
|
117
|
+
export interface AppErrorMeta {
|
|
118
|
+
category: ErrorCategory;
|
|
119
|
+
code: ErrorCode;
|
|
120
|
+
retryable: boolean;
|
|
121
|
+
suggestedCommand: string | undefined;
|
|
31
122
|
}
|
|
32
|
-
export
|
|
123
|
+
export declare const appErrorMeta: (error: AppError) => AppErrorMeta;
|
|
33
124
|
export declare const formatAppError: (error: AppError) => string;
|
|
34
125
|
export {};
|
|
35
126
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/shared/errors.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,mBAAmB;
|
|
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AAS,SAAS;IAC3B,QAAQ,CAAC,gBAAgB,YAAa;gBAEnB,OAAO,EAAE,sBAAsB;CAQnD;AAED,MAAM,MAAM,QAAQ,GAChB,SAAS,GACT,qBAAqB,GACrB,aAAa,GACb,kBAAkB,GAClB,eAAe,GACf,eAAe,CAAC;AAEpB,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,aAAa,CAAC;IACxB,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC;AAMD,eAAO,MAAM,YAAY,GAAI,OAAO,QAAQ,KAAG,YAO9C,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,OAAO,QAAQ,KAAG,MAchD,CAAC"}
|
package/dist/shared/errors.js
CHANGED
|
@@ -1,22 +1,125 @@
|
|
|
1
1
|
import { TaggedError } from "better-result";
|
|
2
|
+
import { ERROR_CATEGORY, ERROR_CODE } from "./error-codes.js";
|
|
2
3
|
const ValidationErrorBase = TaggedError("ValidationError")();
|
|
3
4
|
export class ValidationError extends ValidationErrorBase {
|
|
5
|
+
category = ERROR_CATEGORY.validation;
|
|
6
|
+
code;
|
|
7
|
+
retryable = false;
|
|
8
|
+
suggestedCommand;
|
|
9
|
+
constructor(payload) {
|
|
10
|
+
super({
|
|
11
|
+
message: payload.message,
|
|
12
|
+
...(payload.details === undefined ? {} : { details: payload.details }),
|
|
13
|
+
});
|
|
14
|
+
this.code = payload.code ?? ERROR_CODE.validationInvalidInput;
|
|
15
|
+
this.suggestedCommand = payload.suggestedCommand;
|
|
16
|
+
}
|
|
4
17
|
}
|
|
5
18
|
const AuthErrorBase = TaggedError("AuthError")();
|
|
6
19
|
export class AuthError extends AuthErrorBase {
|
|
20
|
+
category = ERROR_CATEGORY.auth;
|
|
21
|
+
code;
|
|
22
|
+
retryable;
|
|
23
|
+
suggestedCommand;
|
|
24
|
+
constructor(payload) {
|
|
25
|
+
super({
|
|
26
|
+
message: payload.message,
|
|
27
|
+
...(payload.details === undefined ? {} : { details: payload.details }),
|
|
28
|
+
});
|
|
29
|
+
this.code = payload.code ?? ERROR_CODE.authRequired;
|
|
30
|
+
this.retryable = payload.retryable ?? this.code === ERROR_CODE.authDeviceExpired;
|
|
31
|
+
this.suggestedCommand = payload.suggestedCommand;
|
|
32
|
+
}
|
|
7
33
|
}
|
|
8
34
|
const NotFoundErrorBase = TaggedError("NotFoundError")();
|
|
9
35
|
export class NotFoundError extends NotFoundErrorBase {
|
|
36
|
+
category = ERROR_CATEGORY.notFound;
|
|
37
|
+
code;
|
|
38
|
+
retryable = false;
|
|
39
|
+
suggestedCommand;
|
|
40
|
+
constructor(payload) {
|
|
41
|
+
super({
|
|
42
|
+
message: payload.message,
|
|
43
|
+
resource: payload.resource,
|
|
44
|
+
});
|
|
45
|
+
this.code = payload.code ?? ERROR_CODE.toolNotFound;
|
|
46
|
+
this.suggestedCommand = payload.suggestedCommand;
|
|
47
|
+
}
|
|
10
48
|
}
|
|
11
49
|
const RemoteRequestErrorBase = TaggedError("RemoteRequestError")();
|
|
50
|
+
const resolveRemoteErrorCode = (payload) => {
|
|
51
|
+
if (payload.code !== undefined) {
|
|
52
|
+
return payload.code;
|
|
53
|
+
}
|
|
54
|
+
if (payload.status === 429) {
|
|
55
|
+
return ERROR_CODE.remoteRateLimited;
|
|
56
|
+
}
|
|
57
|
+
if (payload.status !== undefined && payload.status >= 500) {
|
|
58
|
+
return ERROR_CODE.remoteUnavailable;
|
|
59
|
+
}
|
|
60
|
+
return ERROR_CODE.transportRequestFailed;
|
|
61
|
+
};
|
|
12
62
|
export class RemoteRequestError extends RemoteRequestErrorBase {
|
|
63
|
+
category;
|
|
64
|
+
code;
|
|
65
|
+
retryable;
|
|
66
|
+
suggestedCommand;
|
|
67
|
+
constructor(payload) {
|
|
68
|
+
super({
|
|
69
|
+
message: payload.message,
|
|
70
|
+
...(payload.body === undefined ? {} : { body: payload.body }),
|
|
71
|
+
...(payload.status === undefined ? {} : { status: payload.status }),
|
|
72
|
+
});
|
|
73
|
+
this.code = resolveRemoteErrorCode(payload);
|
|
74
|
+
this.category =
|
|
75
|
+
this.code === ERROR_CODE.remoteRateLimited ? ERROR_CATEGORY.rateLimit : ERROR_CATEGORY.remote;
|
|
76
|
+
this.retryable =
|
|
77
|
+
this.code === ERROR_CODE.remoteRateLimited ||
|
|
78
|
+
this.code === ERROR_CODE.remoteUnavailable ||
|
|
79
|
+
this.code === ERROR_CODE.transportRequestFailed;
|
|
80
|
+
this.suggestedCommand = payload.suggestedCommand;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const ContractMismatchErrorBase = TaggedError("ContractMismatchError")();
|
|
84
|
+
export class ContractMismatchError extends ContractMismatchErrorBase {
|
|
85
|
+
category = ERROR_CATEGORY.contractMismatch;
|
|
86
|
+
code;
|
|
87
|
+
retryable = false;
|
|
88
|
+
suggestedCommand;
|
|
89
|
+
constructor(payload) {
|
|
90
|
+
super({
|
|
91
|
+
message: payload.message,
|
|
92
|
+
...(payload.details === undefined ? {} : { details: payload.details }),
|
|
93
|
+
});
|
|
94
|
+
this.code = payload.code ?? ERROR_CODE.contractVersionUnsupported;
|
|
95
|
+
this.suggestedCommand = payload.suggestedCommand;
|
|
96
|
+
}
|
|
13
97
|
}
|
|
14
98
|
const UnexpectedErrorBase = TaggedError("UnexpectedError")();
|
|
15
99
|
export class UnexpectedError extends UnexpectedErrorBase {
|
|
100
|
+
category = ERROR_CATEGORY.internal;
|
|
101
|
+
code;
|
|
102
|
+
retryable = false;
|
|
103
|
+
suggestedCommand = undefined;
|
|
104
|
+
constructor(payload) {
|
|
105
|
+
super({
|
|
106
|
+
message: payload.message,
|
|
107
|
+
...(payload.cause === undefined ? {} : { cause: payload.cause }),
|
|
108
|
+
});
|
|
109
|
+
this.code = payload.code ?? ERROR_CODE.internalUnexpected;
|
|
110
|
+
}
|
|
16
111
|
}
|
|
17
112
|
const hasDetails = (error) => {
|
|
18
113
|
return error._tag === "AuthError" || error._tag === "ValidationError";
|
|
19
114
|
};
|
|
115
|
+
export const appErrorMeta = (error) => {
|
|
116
|
+
return {
|
|
117
|
+
category: error.category,
|
|
118
|
+
code: error.code,
|
|
119
|
+
retryable: error.retryable,
|
|
120
|
+
suggestedCommand: error.suggestedCommand,
|
|
121
|
+
};
|
|
122
|
+
};
|
|
20
123
|
export const formatAppError = (error) => {
|
|
21
124
|
if (error._tag === "NotFoundError") {
|
|
22
125
|
return `${error.message} (${error.resource})`;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { AppError } from "./errors.js";
|
|
2
2
|
export declare const EXIT_CODE: {
|
|
3
|
-
readonly
|
|
4
|
-
readonly
|
|
5
|
-
readonly
|
|
3
|
+
readonly authFailed: 4;
|
|
4
|
+
readonly authRequired: 3;
|
|
5
|
+
readonly contractMismatch: 8;
|
|
6
|
+
readonly internal: 9;
|
|
7
|
+
readonly notFound: 5;
|
|
8
|
+
readonly rateLimit: 6;
|
|
9
|
+
readonly remote: 7;
|
|
6
10
|
readonly success: 0;
|
|
7
|
-
readonly
|
|
8
|
-
readonly validation: 10;
|
|
11
|
+
readonly validation: 2;
|
|
9
12
|
};
|
|
10
13
|
export type ExitCode = (typeof EXIT_CODE)[keyof typeof EXIT_CODE];
|
|
11
14
|
export declare const exitCodeForError: (error: AppError) => ExitCode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exit-codes.d.ts","sourceRoot":"","sources":["../../src/shared/exit-codes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"exit-codes.d.ts","sourceRoot":"","sources":["../../src/shared/exit-codes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI5C,eAAO,MAAM,SAAS;;;;;;;;;;CAUZ,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAElE,eAAO,MAAM,gBAAgB,GAAI,OAAO,QAAQ,KAAG,QA+BlD,CAAC"}
|
|
@@ -1,27 +1,44 @@
|
|
|
1
|
+
import { ERROR_CATEGORY, ERROR_CODE } from "./error-codes.js";
|
|
2
|
+
import { appErrorMeta } from "./errors.js";
|
|
1
3
|
export const EXIT_CODE = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
authFailed: 4,
|
|
5
|
+
authRequired: 3,
|
|
6
|
+
contractMismatch: 8,
|
|
7
|
+
internal: 9,
|
|
8
|
+
notFound: 5,
|
|
9
|
+
rateLimit: 6,
|
|
10
|
+
remote: 7,
|
|
5
11
|
success: 0,
|
|
6
|
-
|
|
7
|
-
validation: 10,
|
|
12
|
+
validation: 2,
|
|
8
13
|
};
|
|
9
14
|
export const exitCodeForError = (error) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
const { category, code } = appErrorMeta(error);
|
|
16
|
+
switch (category) {
|
|
17
|
+
case ERROR_CATEGORY.auth: {
|
|
18
|
+
if (code === ERROR_CODE.authRequired) {
|
|
19
|
+
return EXIT_CODE.authRequired;
|
|
20
|
+
}
|
|
21
|
+
return EXIT_CODE.authFailed;
|
|
13
22
|
}
|
|
14
|
-
case
|
|
23
|
+
case ERROR_CATEGORY.notFound: {
|
|
15
24
|
return EXIT_CODE.notFound;
|
|
16
25
|
}
|
|
17
|
-
case
|
|
18
|
-
return EXIT_CODE.
|
|
26
|
+
case ERROR_CATEGORY.rateLimit: {
|
|
27
|
+
return EXIT_CODE.rateLimit;
|
|
19
28
|
}
|
|
20
|
-
case
|
|
21
|
-
|
|
29
|
+
case ERROR_CATEGORY.remote:
|
|
30
|
+
case ERROR_CATEGORY.transport:
|
|
31
|
+
case ERROR_CATEGORY.authorization: {
|
|
32
|
+
return EXIT_CODE.remote;
|
|
22
33
|
}
|
|
23
|
-
case
|
|
34
|
+
case ERROR_CATEGORY.contractMismatch: {
|
|
35
|
+
return EXIT_CODE.contractMismatch;
|
|
36
|
+
}
|
|
37
|
+
case ERROR_CATEGORY.validation: {
|
|
24
38
|
return EXIT_CODE.validation;
|
|
25
39
|
}
|
|
40
|
+
case ERROR_CATEGORY.internal: {
|
|
41
|
+
return EXIT_CODE.internal;
|
|
42
|
+
}
|
|
26
43
|
}
|
|
27
44
|
};
|
package/dist/shared/guards.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { Result as ResultType } from "better-result";
|
|
2
2
|
import type { ZodTypeAny } from "zod";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
+
import { ERROR_CODE } from "./error-codes.js";
|
|
4
5
|
import { ValidationError } from "./errors.js";
|
|
5
|
-
export declare const parseWithSchema: <TSchema extends ZodTypeAny>(schema: TSchema, payload: unknown, context: string
|
|
6
|
+
export declare const parseWithSchema: <TSchema extends ZodTypeAny>(schema: TSchema, payload: unknown, context: string, options?: {
|
|
7
|
+
code?: typeof ERROR_CODE.toolInputSchemaViolation | typeof ERROR_CODE.validationInvalidInput;
|
|
8
|
+
suggestedCommand?: string;
|
|
9
|
+
}) => ResultType<z.infer<TSchema>, ValidationError>;
|
|
6
10
|
//# sourceMappingURL=guards.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../src/shared/guards.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAoB9C,eAAO,MAAM,eAAe,GAAI,OAAO,SAAS,UAAU,EACxD,QAAQ,OAAO,EACf,SAAS,OAAO,EAChB,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../src/shared/guards.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAoB9C,eAAO,MAAM,eAAe,GAAI,OAAO,SAAS,UAAU,EACxD,QAAQ,OAAO,EACf,SAAS,OAAO,EAChB,SAAS,MAAM,EACf,UAAS;IACP,IAAI,CAAC,EAAE,OAAO,UAAU,CAAC,wBAAwB,GAAG,OAAO,UAAU,CAAC,sBAAsB,CAAC;IAC7F,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACtB,KACL,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,eAAe,CAiB9C,CAAC"}
|
package/dist/shared/guards.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Result } from "better-result";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
+
import { ERROR_CODE } from "./error-codes.js";
|
|
3
4
|
import { ValidationError } from "./errors.js";
|
|
4
5
|
const formatIssues = (issues) => {
|
|
5
6
|
return issues
|
|
@@ -14,12 +15,16 @@ const formatIssues = (issues) => {
|
|
|
14
15
|
})
|
|
15
16
|
.join("; ");
|
|
16
17
|
};
|
|
17
|
-
export const parseWithSchema = (schema, payload, context) => {
|
|
18
|
+
export const parseWithSchema = (schema, payload, context, options = {}) => {
|
|
18
19
|
const parsed = schema.safeParse(payload);
|
|
19
20
|
if (!parsed.success) {
|
|
20
21
|
return Result.err(new ValidationError({
|
|
21
22
|
details: formatIssues(parsed.error.issues),
|
|
22
23
|
message: `Invalid ${context}`,
|
|
24
|
+
...(options.code === undefined ? {} : { code: options.code }),
|
|
25
|
+
...(options.suggestedCommand === undefined
|
|
26
|
+
? {}
|
|
27
|
+
: { suggestedCommand: options.suggestedCommand }),
|
|
23
28
|
}));
|
|
24
29
|
}
|
|
25
30
|
return Result.ok(parsed.data);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface RetryableErrorLike {
|
|
2
|
+
_tag?: string;
|
|
3
|
+
retryable?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare const REMOTE_RETRY_DELAY_MS: number;
|
|
6
|
+
export declare const REMOTE_RETRY_TIMES = 2;
|
|
7
|
+
export declare const isRetryableRemoteError: (error: RetryableErrorLike) => boolean;
|
|
8
|
+
export declare const remoteRetryConfig: () => {
|
|
9
|
+
retry: {
|
|
10
|
+
backoff: "exponential";
|
|
11
|
+
delayMs: number;
|
|
12
|
+
shouldRetry: (error: RetryableErrorLike) => boolean;
|
|
13
|
+
times: number;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=retry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../src/shared/retry.ts"],"names":[],"mappings":"AAAA,UAAU,kBAAkB;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAkBD,eAAO,MAAM,qBAAqB,QAAqD,CAAC;AACxF,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAEpC,eAAO,MAAM,sBAAsB,GAAI,OAAO,kBAAkB,KAAG,OAElE,CAAC;AAEF,eAAO,MAAM,iBAAiB,QAAO;IACnC,KAAK,EAAE;QACL,OAAO,EAAE,aAAa,CAAC;QACvB,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,OAAO,CAAC;QACpD,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CAUH,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const RETRY_DELAY_ENV_NAME = "OGMENT_REMOTE_RETRY_DELAY_MS";
|
|
2
|
+
const REMOTE_RETRY_DELAY_DEFAULT_MS = 10_000;
|
|
3
|
+
const parseRetryDelay = (value) => {
|
|
4
|
+
if (value === undefined) {
|
|
5
|
+
return REMOTE_RETRY_DELAY_DEFAULT_MS;
|
|
6
|
+
}
|
|
7
|
+
const parsed = Number.parseInt(value, 10);
|
|
8
|
+
if (!Number.isFinite(parsed) || parsed < 0) {
|
|
9
|
+
return REMOTE_RETRY_DELAY_DEFAULT_MS;
|
|
10
|
+
}
|
|
11
|
+
return parsed;
|
|
12
|
+
};
|
|
13
|
+
export const REMOTE_RETRY_DELAY_MS = parseRetryDelay(process.env[RETRY_DELAY_ENV_NAME]);
|
|
14
|
+
export const REMOTE_RETRY_TIMES = 2;
|
|
15
|
+
export const isRetryableRemoteError = (error) => {
|
|
16
|
+
return error._tag === "RemoteRequestError" && error.retryable === true;
|
|
17
|
+
};
|
|
18
|
+
export const remoteRetryConfig = () => {
|
|
19
|
+
return {
|
|
20
|
+
retry: {
|
|
21
|
+
backoff: "exponential",
|
|
22
|
+
delayMs: REMOTE_RETRY_DELAY_MS,
|
|
23
|
+
shouldRetry: isRetryableRemoteError,
|
|
24
|
+
times: REMOTE_RETRY_TIMES,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-example.d.ts","sourceRoot":"","sources":["../../src/shared/schema-example.ts"],"names":[],"mappings":"AAyJA,eAAO,MAAM,sBAAsB,GAAI,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,OAExE,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
const MAX_EXAMPLE_DEPTH = 6;
|
|
2
|
+
const isRecord = (value) => {
|
|
3
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4
|
+
};
|
|
5
|
+
const asStringArray = (value) => {
|
|
6
|
+
if (!Array.isArray(value)) {
|
|
7
|
+
return [];
|
|
8
|
+
}
|
|
9
|
+
return value.filter((item) => typeof item === "string");
|
|
10
|
+
};
|
|
11
|
+
const firstKnown = (value) => {
|
|
12
|
+
if (Array.isArray(value) && value.length > 0) {
|
|
13
|
+
return value[0];
|
|
14
|
+
}
|
|
15
|
+
return undefined;
|
|
16
|
+
};
|
|
17
|
+
const deriveType = (schema) => {
|
|
18
|
+
const typeValue = schema["type"];
|
|
19
|
+
if (typeof typeValue === "string") {
|
|
20
|
+
return typeValue;
|
|
21
|
+
}
|
|
22
|
+
if (Array.isArray(typeValue)) {
|
|
23
|
+
const firstType = typeValue.find((entry) => typeof entry === "string");
|
|
24
|
+
return firstType;
|
|
25
|
+
}
|
|
26
|
+
if (isRecord(schema["properties"])) {
|
|
27
|
+
return "object";
|
|
28
|
+
}
|
|
29
|
+
if (schema["items"] !== undefined) {
|
|
30
|
+
return "array";
|
|
31
|
+
}
|
|
32
|
+
return undefined;
|
|
33
|
+
};
|
|
34
|
+
const baseScalarExample = (typeName, schema) => {
|
|
35
|
+
switch (typeName) {
|
|
36
|
+
case "string": {
|
|
37
|
+
const format = schema["format"];
|
|
38
|
+
if (format === "email") {
|
|
39
|
+
return "agent@example.com";
|
|
40
|
+
}
|
|
41
|
+
if (format === "uri" || format === "url") {
|
|
42
|
+
return "https://example.com";
|
|
43
|
+
}
|
|
44
|
+
if (format === "date-time") {
|
|
45
|
+
return "2026-01-01T00:00:00Z";
|
|
46
|
+
}
|
|
47
|
+
if (format === "uuid") {
|
|
48
|
+
return "00000000-0000-0000-0000-000000000000";
|
|
49
|
+
}
|
|
50
|
+
return "string";
|
|
51
|
+
}
|
|
52
|
+
case "integer": {
|
|
53
|
+
return 0;
|
|
54
|
+
}
|
|
55
|
+
case "number": {
|
|
56
|
+
return 0;
|
|
57
|
+
}
|
|
58
|
+
case "boolean": {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
case "null": {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
default: {
|
|
65
|
+
return {};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const buildExample = (value, depth) => {
|
|
70
|
+
if (!isRecord(value)) {
|
|
71
|
+
return {};
|
|
72
|
+
}
|
|
73
|
+
if (depth > MAX_EXAMPLE_DEPTH) {
|
|
74
|
+
return {};
|
|
75
|
+
}
|
|
76
|
+
if (value["default"] !== undefined) {
|
|
77
|
+
return value["default"];
|
|
78
|
+
}
|
|
79
|
+
if (value["const"] !== undefined) {
|
|
80
|
+
return value["const"];
|
|
81
|
+
}
|
|
82
|
+
const enumValue = firstKnown(value["enum"]);
|
|
83
|
+
if (enumValue !== undefined) {
|
|
84
|
+
return enumValue;
|
|
85
|
+
}
|
|
86
|
+
const examplesValue = firstKnown(value["examples"]);
|
|
87
|
+
if (examplesValue !== undefined) {
|
|
88
|
+
return examplesValue;
|
|
89
|
+
}
|
|
90
|
+
const oneOfCandidate = firstKnown(value["oneOf"]);
|
|
91
|
+
if (oneOfCandidate !== undefined) {
|
|
92
|
+
return buildExample(oneOfCandidate, depth + 1);
|
|
93
|
+
}
|
|
94
|
+
const anyOfCandidate = firstKnown(value["anyOf"]);
|
|
95
|
+
if (anyOfCandidate !== undefined) {
|
|
96
|
+
return buildExample(anyOfCandidate, depth + 1);
|
|
97
|
+
}
|
|
98
|
+
const allOfCandidate = firstKnown(value["allOf"]);
|
|
99
|
+
if (allOfCandidate !== undefined) {
|
|
100
|
+
return buildExample(allOfCandidate, depth + 1);
|
|
101
|
+
}
|
|
102
|
+
const typeName = deriveType(value);
|
|
103
|
+
if (typeName === "object") {
|
|
104
|
+
const result = {};
|
|
105
|
+
const properties = isRecord(value["properties"]) ? value["properties"] : {};
|
|
106
|
+
const required = asStringArray(value["required"]);
|
|
107
|
+
for (const propertyName of required) {
|
|
108
|
+
const propertySchema = properties[propertyName];
|
|
109
|
+
if (propertySchema !== undefined) {
|
|
110
|
+
result[propertyName] = buildExample(propertySchema, depth + 1);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (required.length === 0 && isRecord(value["additionalProperties"])) {
|
|
114
|
+
result["example"] = buildExample(value["additionalProperties"], depth + 1);
|
|
115
|
+
}
|
|
116
|
+
return result;
|
|
117
|
+
}
|
|
118
|
+
if (typeName === "array") {
|
|
119
|
+
return [buildExample(value["items"], depth + 1)];
|
|
120
|
+
}
|
|
121
|
+
if (typeName === undefined) {
|
|
122
|
+
return {};
|
|
123
|
+
}
|
|
124
|
+
return baseScalarExample(typeName, value);
|
|
125
|
+
};
|
|
126
|
+
export const buildJsonSchemaExample = (schema) => {
|
|
127
|
+
return buildExample(schema, 0);
|
|
128
|
+
};
|
package/dist/shared/schemas.d.ts
CHANGED
|
@@ -1,57 +1,15 @@
|
|
|
1
1
|
import { accountMeSchema, browserAgentCallbackSchema, cliExchangeErrorSchema, cliExchangeRequestSchema, cliExchangeSuccessSchema, deviceCodeStartSchema, deviceTokenApprovedSchema, oauthClientRegistrationSchema, oauthTokenSchema, orgServerSchema, organizationSchema } from "@ogment-ai/cli-contract/v1";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
export { accountMeSchema, browserAgentCallbackSchema, cliExchangeErrorSchema, cliExchangeRequestSchema, cliExchangeSuccessSchema, deviceCodeStartSchema, deviceTokenApprovedSchema, oauthClientRegistrationSchema, oauthTokenSchema, orgServerSchema, organizationSchema, };
|
|
4
|
-
export type OrgServerSchemaData = z.infer<typeof orgServerSchema>;
|
|
5
|
-
export type OrganizationSchemaData = z.infer<typeof organizationSchema>;
|
|
6
|
-
export type AccountMeData = z.infer<typeof accountMeSchema>["data"];
|
|
7
|
-
export type AccountMeResponse = z.infer<typeof accountMeSchema>;
|
|
8
|
-
export type DeviceCodeStartData = z.infer<typeof deviceCodeStartSchema>["data"];
|
|
9
|
-
export type DeviceCodeStartResponse = z.infer<typeof deviceCodeStartSchema>;
|
|
10
|
-
export type DeviceTokenApprovedData = z.infer<typeof deviceTokenApprovedSchema>["data"];
|
|
11
|
-
export type DeviceTokenApprovedResponse = z.infer<typeof deviceTokenApprovedSchema>;
|
|
12
|
-
export type OauthClientRegistrationResponse = z.infer<typeof oauthClientRegistrationSchema>;
|
|
13
|
-
export type OauthTokenResponse = z.infer<typeof oauthTokenSchema>;
|
|
14
4
|
export declare const credentialsFileSchema: z.ZodObject<{
|
|
15
5
|
accessToken: z.ZodOptional<z.ZodString>;
|
|
16
6
|
agentName: z.ZodOptional<z.ZodString>;
|
|
17
7
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
18
8
|
}, z.core.$strip>;
|
|
19
|
-
export type CredentialsFile = z.infer<typeof credentialsFileSchema>;
|
|
20
9
|
export declare const toolDefinitionSchema: z.ZodObject<{
|
|
21
10
|
description: z.ZodOptional<z.ZodString>;
|
|
22
11
|
inputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
23
12
|
name: z.ZodString;
|
|
24
13
|
outputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
25
14
|
}, z.core.$strip>;
|
|
26
|
-
export type ToolDefinitionData = z.infer<typeof toolDefinitionSchema>;
|
|
27
|
-
export declare const describeToolSchema: z.ZodObject<{
|
|
28
|
-
description: z.ZodString;
|
|
29
|
-
name: z.ZodString;
|
|
30
|
-
outputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
31
|
-
parameters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
32
|
-
}, z.core.$strip>;
|
|
33
|
-
export type DescribeTool = z.infer<typeof describeToolSchema>;
|
|
34
|
-
export declare const describePayloadSchema: z.ZodObject<{
|
|
35
|
-
tools: z.ZodArray<z.ZodObject<{
|
|
36
|
-
description: z.ZodString;
|
|
37
|
-
name: z.ZodString;
|
|
38
|
-
outputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
39
|
-
parameters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
40
|
-
}, z.core.$strip>>;
|
|
41
|
-
}, z.core.$strip>;
|
|
42
|
-
export type DescribePayload = z.infer<typeof describePayloadSchema>;
|
|
43
|
-
export declare const cliJsonSuccessSchema: z.ZodObject<{
|
|
44
|
-
data: z.ZodUnknown;
|
|
45
|
-
status: z.ZodLiteral<"success">;
|
|
46
|
-
}, z.core.$strip>;
|
|
47
|
-
export type CliJsonSuccess = z.infer<typeof cliJsonSuccessSchema>;
|
|
48
|
-
export declare const cliJsonErrorSchema: z.ZodObject<{
|
|
49
|
-
error: z.ZodObject<{
|
|
50
|
-
details: z.ZodOptional<z.ZodString>;
|
|
51
|
-
message: z.ZodString;
|
|
52
|
-
type: z.ZodString;
|
|
53
|
-
}, z.core.$strip>;
|
|
54
|
-
status: z.ZodLiteral<"error">;
|
|
55
|
-
}, z.core.$strip>;
|
|
56
|
-
export type CliJsonError = z.infer<typeof cliJsonErrorSchema>;
|
|
57
15
|
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/shared/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,EACrB,yBAAyB,EACzB,6BAA6B,EAC7B,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EACnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,eAAe,EACf,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,EACrB,yBAAyB,EACzB,6BAA6B,EAC7B,gBAAgB,EAChB,eAAe,EACf,kBAAkB,GACnB,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/shared/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,EACrB,yBAAyB,EACzB,6BAA6B,EAC7B,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EACnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,eAAe,EACf,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,EACrB,yBAAyB,EACzB,6BAA6B,EAC7B,gBAAgB,EAChB,eAAe,EACf,kBAAkB,GACnB,CAAC;AAIF,eAAO,MAAM,qBAAqB;;;;iBAIhC,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;iBAK/B,CAAC"}
|