@ogment-ai/cli 0.6.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +21382 -4
- package/dist/cli.js.map +1 -0
- package/package.json +44 -53
- package/README.md +0 -134
- package/dist/cli/commands.d.ts +0 -37
- package/dist/cli/commands.d.ts.map +0 -1
- package/dist/cli/commands.js +0 -56
- package/dist/cli/execute.d.ts +0 -11
- package/dist/cli/execute.d.ts.map +0 -1
- package/dist/cli/execute.js +0 -468
- package/dist/cli/invocations.d.ts +0 -31
- package/dist/cli/invocations.d.ts.map +0 -1
- package/dist/cli/invocations.js +0 -1
- package/dist/cli/parse-errors.d.ts +0 -17
- package/dist/cli/parse-errors.d.ts.map +0 -1
- package/dist/cli/parse-errors.js +0 -184
- package/dist/cli/program.d.ts +0 -10
- package/dist/cli/program.d.ts.map +0 -1
- package/dist/cli/program.js +0 -174
- package/dist/cli/run.d.ts +0 -6
- package/dist/cli/run.d.ts.map +0 -1
- package/dist/cli/run.js +0 -83
- package/dist/cli/runtime.d.ts +0 -21
- package/dist/cli/runtime.d.ts.map +0 -1
- package/dist/cli/runtime.js +0 -80
- package/dist/cli.d.ts +0 -4
- package/dist/cli.d.ts.map +0 -1
- package/dist/commands/auth.d.ts +0 -19
- package/dist/commands/auth.d.ts.map +0 -1
- package/dist/commands/auth.js +0 -21
- package/dist/commands/catalog.d.ts +0 -31
- package/dist/commands/catalog.d.ts.map +0 -1
- package/dist/commands/catalog.js +0 -167
- package/dist/commands/context.d.ts +0 -15
- package/dist/commands/context.d.ts.map +0 -1
- package/dist/commands/context.js +0 -1
- package/dist/commands/invoke.d.ts +0 -17
- package/dist/commands/invoke.d.ts.map +0 -1
- package/dist/commands/invoke.js +0 -173
- package/dist/commands/server-context.d.ts +0 -14
- package/dist/commands/server-context.d.ts.map +0 -1
- package/dist/commands/server-context.js +0 -26
- package/dist/commands/status.d.ts +0 -12
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/status.js +0 -5
- package/dist/index.d.ts +0 -4
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -3
- package/dist/infra/credentials.d.ts +0 -22
- package/dist/infra/credentials.d.ts.map +0 -1
- package/dist/infra/credentials.js +0 -74
- package/dist/infra/env.d.ts +0 -15
- package/dist/infra/env.d.ts.map +0 -1
- package/dist/infra/env.js +0 -100
- package/dist/infra/http.d.ts +0 -16
- package/dist/infra/http.d.ts.map +0 -1
- package/dist/infra/http.js +0 -84
- package/dist/output/envelope.d.ts +0 -22
- package/dist/output/envelope.d.ts.map +0 -1
- package/dist/output/envelope.js +0 -67
- package/dist/output/manager.d.ts +0 -47
- package/dist/output/manager.d.ts.map +0 -1
- package/dist/output/manager.js +0 -120
- package/dist/services/account.d.ts +0 -16
- package/dist/services/account.d.ts.map +0 -1
- package/dist/services/account.js +0 -75
- package/dist/services/auth.d.ts +0 -37
- package/dist/services/auth.d.ts.map +0 -1
- package/dist/services/auth.js +0 -270
- package/dist/services/info.d.ts +0 -24
- package/dist/services/info.d.ts.map +0 -1
- package/dist/services/info.js +0 -316
- package/dist/services/mcp-error-mapping.d.ts +0 -9
- package/dist/services/mcp-error-mapping.d.ts.map +0 -1
- package/dist/services/mcp-error-mapping.js +0 -129
- package/dist/services/mcp.d.ts +0 -39
- package/dist/services/mcp.d.ts.map +0 -1
- package/dist/services/mcp.js +0 -169
- package/dist/shared/constants.d.ts +0 -5
- package/dist/shared/constants.d.ts.map +0 -1
- package/dist/shared/constants.js +0 -6
- package/dist/shared/error-codes.d.ts +0 -31
- package/dist/shared/error-codes.d.ts.map +0 -1
- package/dist/shared/error-codes.js +0 -25
- package/dist/shared/error-presentation.d.ts +0 -17
- package/dist/shared/error-presentation.d.ts.map +0 -1
- package/dist/shared/error-presentation.js +0 -151
- package/dist/shared/errors.d.ts +0 -146
- package/dist/shared/errors.d.ts.map +0 -1
- package/dist/shared/errors.js +0 -233
- package/dist/shared/exit-codes.d.ts +0 -15
- package/dist/shared/exit-codes.d.ts.map +0 -1
- package/dist/shared/exit-codes.js +0 -44
- package/dist/shared/guards.d.ts +0 -11
- package/dist/shared/guards.d.ts.map +0 -1
- package/dist/shared/guards.js +0 -29
- package/dist/shared/recovery.d.ts +0 -5
- package/dist/shared/recovery.d.ts.map +0 -1
- package/dist/shared/recovery.js +0 -123
- package/dist/shared/schema-example.d.ts +0 -3
- package/dist/shared/schema-example.d.ts.map +0 -1
- package/dist/shared/schema-example.js +0 -105
- package/dist/shared/schemas.d.ts +0 -14
- package/dist/shared/schemas.d.ts.map +0 -1
- package/dist/shared/schemas.js +0 -14
- package/dist/shared/types.d.ts +0 -225
- package/dist/shared/types.d.ts.map +0 -1
- package/dist/shared/types.js +0 -1
package/dist/shared/errors.d.ts
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { ERROR_CODE, type ErrorCategory, type ErrorCode } from "./error-codes.js";
|
|
2
|
-
import { type RecoveryOverride } from "./recovery.js";
|
|
3
|
-
import type { CliNextAction, RemoteErrorDiagnostics, RemoteErrorSource } from "./types.js";
|
|
4
|
-
type AuthErrorCode = typeof ERROR_CODE.authDeviceExpired | typeof ERROR_CODE.authDevicePending | typeof ERROR_CODE.authInvalidCredentials | typeof ERROR_CODE.authRequired;
|
|
5
|
-
type RemoteErrorCode = typeof ERROR_CODE.remoteRateLimited | typeof ERROR_CODE.remoteUnavailable | typeof ERROR_CODE.transportRequestFailed | `HTTP_${number}` | `MCP_${number}`;
|
|
6
|
-
type ValidationErrorCode = typeof ERROR_CODE.toolInputSchemaViolation | typeof ERROR_CODE.validationInvalidInput;
|
|
7
|
-
type ContractMismatchErrorCode = typeof ERROR_CODE.contractVersionUnsupported;
|
|
8
|
-
interface BaseAppErrorFields {
|
|
9
|
-
category: ErrorCategory;
|
|
10
|
-
code: ErrorCode;
|
|
11
|
-
recovery: CliNextAction | undefined;
|
|
12
|
-
retryable: boolean;
|
|
13
|
-
}
|
|
14
|
-
declare const ValidationErrorBase: import("better-result").TaggedErrorClass<"ValidationError", {
|
|
15
|
-
details?: string;
|
|
16
|
-
message: string;
|
|
17
|
-
}>;
|
|
18
|
-
interface ValidationErrorPayload {
|
|
19
|
-
code?: ValidationErrorCode;
|
|
20
|
-
details?: string;
|
|
21
|
-
message: string;
|
|
22
|
-
recovery?: RecoveryOverride;
|
|
23
|
-
}
|
|
24
|
-
export declare class ValidationError extends ValidationErrorBase implements BaseAppErrorFields {
|
|
25
|
-
readonly category: "validation";
|
|
26
|
-
readonly code: ValidationErrorCode;
|
|
27
|
-
readonly recovery: CliNextAction | undefined;
|
|
28
|
-
readonly retryable = false;
|
|
29
|
-
constructor(payload: ValidationErrorPayload);
|
|
30
|
-
}
|
|
31
|
-
declare const AuthErrorBase: import("better-result").TaggedErrorClass<"AuthError", {
|
|
32
|
-
details?: string;
|
|
33
|
-
message: string;
|
|
34
|
-
}>;
|
|
35
|
-
interface AuthErrorPayload {
|
|
36
|
-
code?: AuthErrorCode;
|
|
37
|
-
details?: string;
|
|
38
|
-
message: string;
|
|
39
|
-
recovery?: RecoveryOverride;
|
|
40
|
-
retryable?: boolean;
|
|
41
|
-
}
|
|
42
|
-
export declare class AuthError extends AuthErrorBase implements BaseAppErrorFields {
|
|
43
|
-
readonly category: "auth";
|
|
44
|
-
readonly code: AuthErrorCode;
|
|
45
|
-
readonly recovery: CliNextAction | undefined;
|
|
46
|
-
readonly retryable: boolean;
|
|
47
|
-
constructor(payload: AuthErrorPayload);
|
|
48
|
-
}
|
|
49
|
-
declare const NotFoundErrorBase: import("better-result").TaggedErrorClass<"NotFoundError", {
|
|
50
|
-
message: string;
|
|
51
|
-
resource: string;
|
|
52
|
-
}>;
|
|
53
|
-
interface NotFoundErrorPayload {
|
|
54
|
-
code?: typeof ERROR_CODE.toolNotFound;
|
|
55
|
-
message: string;
|
|
56
|
-
recovery?: RecoveryOverride;
|
|
57
|
-
resource: string;
|
|
58
|
-
}
|
|
59
|
-
export declare class NotFoundError extends NotFoundErrorBase implements BaseAppErrorFields {
|
|
60
|
-
readonly category: "not_found";
|
|
61
|
-
readonly code: typeof ERROR_CODE.toolNotFound;
|
|
62
|
-
readonly recovery: CliNextAction | undefined;
|
|
63
|
-
readonly retryable = false;
|
|
64
|
-
constructor(payload: NotFoundErrorPayload);
|
|
65
|
-
}
|
|
66
|
-
declare const RemoteRequestErrorBase: import("better-result").TaggedErrorClass<"RemoteRequestError", {
|
|
67
|
-
body?: string;
|
|
68
|
-
message: string;
|
|
69
|
-
mcpCode?: number;
|
|
70
|
-
mcpData?: unknown;
|
|
71
|
-
operation?: string;
|
|
72
|
-
raw?: unknown;
|
|
73
|
-
source: RemoteErrorSource;
|
|
74
|
-
status?: number;
|
|
75
|
-
}>;
|
|
76
|
-
interface RemoteRequestErrorPayload {
|
|
77
|
-
body?: string;
|
|
78
|
-
code?: RemoteErrorCode;
|
|
79
|
-
diagnostics?: Partial<RemoteErrorDiagnostics>;
|
|
80
|
-
httpStatus?: number;
|
|
81
|
-
mcpCode?: number;
|
|
82
|
-
mcpData?: unknown;
|
|
83
|
-
message: string;
|
|
84
|
-
operation?: string;
|
|
85
|
-
raw?: unknown;
|
|
86
|
-
recovery?: RecoveryOverride;
|
|
87
|
-
retryable?: boolean;
|
|
88
|
-
source?: RemoteErrorSource;
|
|
89
|
-
status?: number;
|
|
90
|
-
}
|
|
91
|
-
export declare class RemoteRequestError extends RemoteRequestErrorBase implements BaseAppErrorFields {
|
|
92
|
-
readonly category: ErrorCategory;
|
|
93
|
-
readonly code: RemoteErrorCode;
|
|
94
|
-
readonly diagnostics: RemoteErrorDiagnostics;
|
|
95
|
-
readonly httpStatus: number | undefined;
|
|
96
|
-
readonly recovery: CliNextAction | undefined;
|
|
97
|
-
readonly retryable: boolean;
|
|
98
|
-
constructor(payload: RemoteRequestErrorPayload);
|
|
99
|
-
}
|
|
100
|
-
declare const ContractMismatchErrorBase: import("better-result").TaggedErrorClass<"ContractMismatchError", {
|
|
101
|
-
details?: string;
|
|
102
|
-
message: string;
|
|
103
|
-
}>;
|
|
104
|
-
interface ContractMismatchErrorPayload {
|
|
105
|
-
code?: ContractMismatchErrorCode;
|
|
106
|
-
details?: string;
|
|
107
|
-
message: string;
|
|
108
|
-
recovery?: RecoveryOverride;
|
|
109
|
-
}
|
|
110
|
-
export declare class ContractMismatchError extends ContractMismatchErrorBase implements BaseAppErrorFields {
|
|
111
|
-
readonly category: "contract_mismatch";
|
|
112
|
-
readonly code: ContractMismatchErrorCode;
|
|
113
|
-
readonly recovery: CliNextAction | undefined;
|
|
114
|
-
readonly retryable = false;
|
|
115
|
-
constructor(payload: ContractMismatchErrorPayload);
|
|
116
|
-
}
|
|
117
|
-
declare const UnexpectedErrorBase: import("better-result").TaggedErrorClass<"UnexpectedError", {
|
|
118
|
-
cause?: unknown;
|
|
119
|
-
message: string;
|
|
120
|
-
}>;
|
|
121
|
-
interface UnexpectedErrorPayload {
|
|
122
|
-
cause?: unknown;
|
|
123
|
-
code?: typeof ERROR_CODE.internalUnexpected;
|
|
124
|
-
message: string;
|
|
125
|
-
recovery?: RecoveryOverride;
|
|
126
|
-
}
|
|
127
|
-
export declare class UnexpectedError extends UnexpectedErrorBase implements BaseAppErrorFields {
|
|
128
|
-
readonly category: "internal";
|
|
129
|
-
readonly code: typeof ERROR_CODE.internalUnexpected;
|
|
130
|
-
readonly recovery: CliNextAction | undefined;
|
|
131
|
-
readonly retryable = false;
|
|
132
|
-
constructor(payload: UnexpectedErrorPayload);
|
|
133
|
-
}
|
|
134
|
-
export type AppError = AuthError | ContractMismatchError | NotFoundError | RemoteRequestError | UnexpectedError | ValidationError;
|
|
135
|
-
export interface AppErrorMeta {
|
|
136
|
-
category: ErrorCategory;
|
|
137
|
-
code: ErrorCode;
|
|
138
|
-
recovery: CliNextAction | undefined;
|
|
139
|
-
retryable: boolean;
|
|
140
|
-
}
|
|
141
|
-
export declare const appErrorMeta: (error: AppError) => AppErrorMeta;
|
|
142
|
-
export declare const appErrorDiagnostics: (error: AppError) => Record<string, unknown>;
|
|
143
|
-
export declare const appErrorTitle: (error: AppError) => string;
|
|
144
|
-
export declare const formatAppError: (error: AppError) => string;
|
|
145
|
-
export {};
|
|
146
|
-
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/shared/errors.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,UAAU,EAAE,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClG,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE3F,KAAK,aAAa,GACd,OAAO,UAAU,CAAC,iBAAiB,GACnC,OAAO,UAAU,CAAC,iBAAiB,GACnC,OAAO,UAAU,CAAC,sBAAsB,GACxC,OAAO,UAAU,CAAC,YAAY,CAAC;AAEnC,KAAK,eAAe,GAChB,OAAO,UAAU,CAAC,iBAAiB,GACnC,OAAO,UAAU,CAAC,iBAAiB,GACnC,OAAO,UAAU,CAAC,sBAAsB,GACxC,QAAQ,MAAM,EAAE,GAChB,OAAO,MAAM,EAAE,CAAC;AAEpB,KAAK,mBAAmB,GACpB,OAAO,UAAU,CAAC,wBAAwB,GAC1C,OAAO,UAAU,CAAC,sBAAsB,CAAC;AAE7C,KAAK,yBAAyB,GAAG,OAAO,UAAU,CAAC,0BAA0B,CAAC;AAE9E,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,aAAa,CAAC;IACxB,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,aAAa,GAAG,SAAS,CAAC;IACpC,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,mBAAmB;cACb,MAAM;aACP,MAAM;EACb,CAAC;AAEL,UAAU,sBAAsB;IAC9B,IAAI,CAAC,EAAE,mBAAmB,CAAC;IA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;AAqBD,eAAO,MAAM,YAAY,GAAI,OAAO,QAAQ,KAAG,YAO9C,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,OAAO,QAAQ,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAsC3E,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,OAAO,QAAQ,KAAG,MAU/C,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,OAAO,QAAQ,KAAG,MAchD,CAAC"}
|
package/dist/shared/errors.js
DELETED
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
import { TaggedError } from "better-result";
|
|
2
|
-
import { ERROR_CATEGORY, ERROR_CODE } from "./error-codes.js";
|
|
3
|
-
import { normalizeRecovery } from "./recovery.js";
|
|
4
|
-
const ValidationErrorBase = TaggedError("ValidationError")();
|
|
5
|
-
export class ValidationError extends ValidationErrorBase {
|
|
6
|
-
category = ERROR_CATEGORY.validation;
|
|
7
|
-
code;
|
|
8
|
-
recovery;
|
|
9
|
-
retryable = false;
|
|
10
|
-
constructor(payload) {
|
|
11
|
-
super({
|
|
12
|
-
message: payload.message,
|
|
13
|
-
...(payload.details === undefined ? {} : { details: payload.details }),
|
|
14
|
-
});
|
|
15
|
-
this.code = payload.code ?? ERROR_CODE.validationInvalidInput;
|
|
16
|
-
this.recovery = normalizeRecovery(this.code, payload.recovery);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
const AuthErrorBase = TaggedError("AuthError")();
|
|
20
|
-
export class AuthError extends AuthErrorBase {
|
|
21
|
-
category = ERROR_CATEGORY.auth;
|
|
22
|
-
code;
|
|
23
|
-
recovery;
|
|
24
|
-
retryable;
|
|
25
|
-
constructor(payload) {
|
|
26
|
-
super({
|
|
27
|
-
message: payload.message,
|
|
28
|
-
...(payload.details === undefined ? {} : { details: payload.details }),
|
|
29
|
-
});
|
|
30
|
-
this.code = payload.code ?? ERROR_CODE.authRequired;
|
|
31
|
-
this.recovery = normalizeRecovery(this.code, payload.recovery);
|
|
32
|
-
this.retryable = payload.retryable ?? this.code === ERROR_CODE.authDeviceExpired;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
const NotFoundErrorBase = TaggedError("NotFoundError")();
|
|
36
|
-
export class NotFoundError extends NotFoundErrorBase {
|
|
37
|
-
category = ERROR_CATEGORY.notFound;
|
|
38
|
-
code;
|
|
39
|
-
recovery;
|
|
40
|
-
retryable = false;
|
|
41
|
-
constructor(payload) {
|
|
42
|
-
super({
|
|
43
|
-
message: payload.message,
|
|
44
|
-
resource: payload.resource,
|
|
45
|
-
});
|
|
46
|
-
this.code = payload.code ?? ERROR_CODE.toolNotFound;
|
|
47
|
-
this.recovery = normalizeRecovery(this.code, payload.recovery);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
const RemoteRequestErrorBase = TaggedError("RemoteRequestError")();
|
|
51
|
-
const parseHttpCode = (code) => {
|
|
52
|
-
if (!code.startsWith("HTTP_")) {
|
|
53
|
-
return undefined;
|
|
54
|
-
}
|
|
55
|
-
const parsed = Number.parseInt(code.slice("HTTP_".length), 10);
|
|
56
|
-
if (!Number.isFinite(parsed)) {
|
|
57
|
-
return undefined;
|
|
58
|
-
}
|
|
59
|
-
return parsed;
|
|
60
|
-
};
|
|
61
|
-
const resolveRemoteErrorCode = (payload, diagnostics) => {
|
|
62
|
-
if (payload.code !== undefined) {
|
|
63
|
-
return payload.code;
|
|
64
|
-
}
|
|
65
|
-
if (typeof diagnostics.httpStatus === "number") {
|
|
66
|
-
return `HTTP_${diagnostics.httpStatus}`;
|
|
67
|
-
}
|
|
68
|
-
if (typeof diagnostics.mcpCode === "number") {
|
|
69
|
-
return `MCP_${diagnostics.mcpCode}`;
|
|
70
|
-
}
|
|
71
|
-
return ERROR_CODE.transportRequestFailed;
|
|
72
|
-
};
|
|
73
|
-
const resolveRemoteDiagnostics = (payload) => {
|
|
74
|
-
const source = payload.source ?? payload.diagnostics?.source ?? "network";
|
|
75
|
-
return {
|
|
76
|
-
httpStatus: payload.httpStatus ?? payload.status ?? payload.diagnostics?.httpStatus,
|
|
77
|
-
mcpCode: payload.mcpCode ?? payload.diagnostics?.mcpCode,
|
|
78
|
-
mcpData: payload.mcpData ?? payload.diagnostics?.mcpData,
|
|
79
|
-
operation: payload.operation ?? payload.diagnostics?.operation,
|
|
80
|
-
raw: payload.raw ?? payload.diagnostics?.raw,
|
|
81
|
-
source,
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
const resolveRetryableRemoteError = (diagnostics, code) => {
|
|
85
|
-
const httpStatus = diagnostics.httpStatus ?? parseHttpCode(code);
|
|
86
|
-
if (typeof httpStatus === "number") {
|
|
87
|
-
return httpStatus === 429 || httpStatus >= 500;
|
|
88
|
-
}
|
|
89
|
-
if (typeof diagnostics.mcpCode === "number") {
|
|
90
|
-
return diagnostics.mcpCode === -32_001;
|
|
91
|
-
}
|
|
92
|
-
return diagnostics.source === "network";
|
|
93
|
-
};
|
|
94
|
-
const resolveRemoteCategory = (code, diagnostics) => {
|
|
95
|
-
const httpStatus = diagnostics.httpStatus ?? parseHttpCode(code);
|
|
96
|
-
if (code === ERROR_CODE.remoteRateLimited || httpStatus === 429) {
|
|
97
|
-
return ERROR_CATEGORY.rateLimit;
|
|
98
|
-
}
|
|
99
|
-
return ERROR_CATEGORY.remote;
|
|
100
|
-
};
|
|
101
|
-
export class RemoteRequestError extends RemoteRequestErrorBase {
|
|
102
|
-
category;
|
|
103
|
-
code;
|
|
104
|
-
diagnostics;
|
|
105
|
-
httpStatus;
|
|
106
|
-
recovery;
|
|
107
|
-
retryable;
|
|
108
|
-
constructor(payload) {
|
|
109
|
-
const diagnostics = resolveRemoteDiagnostics(payload);
|
|
110
|
-
const code = resolveRemoteErrorCode(payload, diagnostics);
|
|
111
|
-
const status = diagnostics.httpStatus;
|
|
112
|
-
super({
|
|
113
|
-
message: payload.message,
|
|
114
|
-
...(payload.body === undefined ? {} : { body: payload.body }),
|
|
115
|
-
...(status === undefined ? {} : { status }),
|
|
116
|
-
source: diagnostics.source,
|
|
117
|
-
...(diagnostics.mcpCode === undefined ? {} : { mcpCode: diagnostics.mcpCode }),
|
|
118
|
-
...(diagnostics.mcpData === undefined ? {} : { mcpData: diagnostics.mcpData }),
|
|
119
|
-
...(diagnostics.operation === undefined ? {} : { operation: diagnostics.operation }),
|
|
120
|
-
...(diagnostics.raw === undefined ? {} : { raw: diagnostics.raw }),
|
|
121
|
-
});
|
|
122
|
-
this.code = code;
|
|
123
|
-
this.category = resolveRemoteCategory(code, diagnostics);
|
|
124
|
-
this.diagnostics = diagnostics;
|
|
125
|
-
this.httpStatus = diagnostics.httpStatus;
|
|
126
|
-
this.recovery = normalizeRecovery(this.code, payload.recovery);
|
|
127
|
-
this.retryable = payload.retryable ?? resolveRetryableRemoteError(diagnostics, code);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
const ContractMismatchErrorBase = TaggedError("ContractMismatchError")();
|
|
131
|
-
export class ContractMismatchError extends ContractMismatchErrorBase {
|
|
132
|
-
category = ERROR_CATEGORY.contractMismatch;
|
|
133
|
-
code;
|
|
134
|
-
recovery;
|
|
135
|
-
retryable = false;
|
|
136
|
-
constructor(payload) {
|
|
137
|
-
super({
|
|
138
|
-
message: payload.message,
|
|
139
|
-
...(payload.details === undefined ? {} : { details: payload.details }),
|
|
140
|
-
});
|
|
141
|
-
this.code = payload.code ?? ERROR_CODE.contractVersionUnsupported;
|
|
142
|
-
this.recovery = normalizeRecovery(this.code, payload.recovery);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
const UnexpectedErrorBase = TaggedError("UnexpectedError")();
|
|
146
|
-
export class UnexpectedError extends UnexpectedErrorBase {
|
|
147
|
-
category = ERROR_CATEGORY.internal;
|
|
148
|
-
code;
|
|
149
|
-
recovery;
|
|
150
|
-
retryable = false;
|
|
151
|
-
constructor(payload) {
|
|
152
|
-
super({
|
|
153
|
-
message: payload.message,
|
|
154
|
-
...(payload.cause === undefined ? {} : { cause: payload.cause }),
|
|
155
|
-
});
|
|
156
|
-
this.code = payload.code ?? ERROR_CODE.internalUnexpected;
|
|
157
|
-
this.recovery = normalizeRecovery(this.code, payload.recovery);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
const withIfDefined = (base, key, value) => {
|
|
161
|
-
if (value === undefined) {
|
|
162
|
-
return base;
|
|
163
|
-
}
|
|
164
|
-
return {
|
|
165
|
-
...base,
|
|
166
|
-
[key]: value,
|
|
167
|
-
};
|
|
168
|
-
};
|
|
169
|
-
const hasDetails = (error) => {
|
|
170
|
-
return error._tag === "AuthError" || error._tag === "ValidationError";
|
|
171
|
-
};
|
|
172
|
-
export const appErrorMeta = (error) => {
|
|
173
|
-
return {
|
|
174
|
-
category: error.category,
|
|
175
|
-
code: error.code,
|
|
176
|
-
recovery: error.recovery,
|
|
177
|
-
retryable: error.retryable,
|
|
178
|
-
};
|
|
179
|
-
};
|
|
180
|
-
export const appErrorDiagnostics = (error) => {
|
|
181
|
-
if (error._tag === "RemoteRequestError") {
|
|
182
|
-
let diagnostics = {
|
|
183
|
-
source: error.source,
|
|
184
|
-
};
|
|
185
|
-
diagnostics = withIfDefined(diagnostics, "httpStatus", error.httpStatus);
|
|
186
|
-
diagnostics = withIfDefined(diagnostics, "mcpCode", error.mcpCode);
|
|
187
|
-
diagnostics = withIfDefined(diagnostics, "mcpData", error.mcpData);
|
|
188
|
-
diagnostics = withIfDefined(diagnostics, "operation", error.operation);
|
|
189
|
-
diagnostics = withIfDefined(diagnostics, "raw", error.raw);
|
|
190
|
-
diagnostics = withIfDefined(diagnostics, "body", error.body);
|
|
191
|
-
return diagnostics;
|
|
192
|
-
}
|
|
193
|
-
if (error._tag === "NotFoundError") {
|
|
194
|
-
return {
|
|
195
|
-
resource: error.resource,
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
if (error._tag === "UnexpectedError") {
|
|
199
|
-
if (error.cause === undefined) {
|
|
200
|
-
return {};
|
|
201
|
-
}
|
|
202
|
-
return {
|
|
203
|
-
cause: error.cause,
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
if (hasDetails(error) && typeof error.details === "string" && error.details.length > 0) {
|
|
207
|
-
return {
|
|
208
|
-
details: error.details,
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
return {};
|
|
212
|
-
};
|
|
213
|
-
export const appErrorTitle = (error) => {
|
|
214
|
-
if (error._tag === "UnexpectedError") {
|
|
215
|
-
return "Unexpected CLI error";
|
|
216
|
-
}
|
|
217
|
-
if (error._tag === "ContractMismatchError") {
|
|
218
|
-
return "Contract version unsupported";
|
|
219
|
-
}
|
|
220
|
-
return error.message;
|
|
221
|
-
};
|
|
222
|
-
export const formatAppError = (error) => {
|
|
223
|
-
if (error._tag === "NotFoundError") {
|
|
224
|
-
return `${error.message} (${error.resource})`;
|
|
225
|
-
}
|
|
226
|
-
if (error._tag === "RemoteRequestError" && typeof error.httpStatus === "number") {
|
|
227
|
-
return `${error.message} (status ${error.httpStatus})`;
|
|
228
|
-
}
|
|
229
|
-
if (hasDetails(error) && typeof error.details === "string" && error.details.length > 0) {
|
|
230
|
-
return `${error.message}: ${error.details}`;
|
|
231
|
-
}
|
|
232
|
-
return error.message;
|
|
233
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { AppError } from "./errors.js";
|
|
2
|
-
export declare const EXIT_CODE: {
|
|
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;
|
|
10
|
-
readonly success: 0;
|
|
11
|
-
readonly validation: 2;
|
|
12
|
-
};
|
|
13
|
-
export type ExitCode = (typeof EXIT_CODE)[keyof typeof EXIT_CODE];
|
|
14
|
-
export declare const exitCodeForError: (error: AppError) => ExitCode;
|
|
15
|
-
//# sourceMappingURL=exit-codes.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,44 +0,0 @@
|
|
|
1
|
-
import { ERROR_CATEGORY, ERROR_CODE } from "./error-codes.js";
|
|
2
|
-
import { appErrorMeta } from "./errors.js";
|
|
3
|
-
export const EXIT_CODE = {
|
|
4
|
-
authFailed: 4,
|
|
5
|
-
authRequired: 3,
|
|
6
|
-
contractMismatch: 8,
|
|
7
|
-
internal: 9,
|
|
8
|
-
notFound: 5,
|
|
9
|
-
rateLimit: 6,
|
|
10
|
-
remote: 7,
|
|
11
|
-
success: 0,
|
|
12
|
-
validation: 2,
|
|
13
|
-
};
|
|
14
|
-
export const exitCodeForError = (error) => {
|
|
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;
|
|
22
|
-
}
|
|
23
|
-
case ERROR_CATEGORY.notFound: {
|
|
24
|
-
return EXIT_CODE.notFound;
|
|
25
|
-
}
|
|
26
|
-
case ERROR_CATEGORY.rateLimit: {
|
|
27
|
-
return EXIT_CODE.rateLimit;
|
|
28
|
-
}
|
|
29
|
-
case ERROR_CATEGORY.remote:
|
|
30
|
-
case ERROR_CATEGORY.transport:
|
|
31
|
-
case ERROR_CATEGORY.authorization: {
|
|
32
|
-
return EXIT_CODE.remote;
|
|
33
|
-
}
|
|
34
|
-
case ERROR_CATEGORY.contractMismatch: {
|
|
35
|
-
return EXIT_CODE.contractMismatch;
|
|
36
|
-
}
|
|
37
|
-
case ERROR_CATEGORY.validation: {
|
|
38
|
-
return EXIT_CODE.validation;
|
|
39
|
-
}
|
|
40
|
-
case ERROR_CATEGORY.internal: {
|
|
41
|
-
return EXIT_CODE.internal;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
};
|
package/dist/shared/guards.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Result as ResultType } from "better-result";
|
|
2
|
-
import type { ZodTypeAny } from "zod";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import { ERROR_CODE } from "./error-codes.js";
|
|
5
|
-
import { ValidationError } from "./errors.js";
|
|
6
|
-
import type { RecoveryOverride } from "./recovery.js";
|
|
7
|
-
export declare const parseWithSchema: <TSchema extends ZodTypeAny>(schema: TSchema, payload: unknown, context: string, options?: {
|
|
8
|
-
code?: typeof ERROR_CODE.toolInputSchemaViolation | typeof ERROR_CODE.validationInvalidInput;
|
|
9
|
-
recovery?: RecoveryOverride;
|
|
10
|
-
}) => ResultType<z.infer<TSchema>, ValidationError>;
|
|
11
|
-
//# sourceMappingURL=guards.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAoBtD,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,QAAQ,CAAC,EAAE,gBAAgB,CAAC;CACxB,KACL,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,eAAe,CAe9C,CAAC"}
|
package/dist/shared/guards.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Result } from "better-result";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import { ERROR_CODE } from "./error-codes.js";
|
|
4
|
-
import { ValidationError } from "./errors.js";
|
|
5
|
-
const formatIssues = (issues) => {
|
|
6
|
-
return issues
|
|
7
|
-
.map((issue) => {
|
|
8
|
-
if (issue.path.length === 0) {
|
|
9
|
-
return issue.message;
|
|
10
|
-
}
|
|
11
|
-
const path = issue.path
|
|
12
|
-
.filter((value) => typeof value === "number" || typeof value === "string")
|
|
13
|
-
.join(".");
|
|
14
|
-
return `${path}: ${issue.message}`;
|
|
15
|
-
})
|
|
16
|
-
.join("; ");
|
|
17
|
-
};
|
|
18
|
-
export const parseWithSchema = (schema, payload, context, options = {}) => {
|
|
19
|
-
const parsed = schema.safeParse(payload);
|
|
20
|
-
if (!parsed.success) {
|
|
21
|
-
return Result.err(new ValidationError({
|
|
22
|
-
details: formatIssues(parsed.error.issues),
|
|
23
|
-
message: `Invalid ${context}`,
|
|
24
|
-
...(options.code === undefined ? {} : { code: options.code }),
|
|
25
|
-
...(options.recovery === undefined ? {} : { recovery: options.recovery }),
|
|
26
|
-
}));
|
|
27
|
-
}
|
|
28
|
-
return Result.ok(parsed.data);
|
|
29
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { type ErrorCode } from "./error-codes.js";
|
|
2
|
-
import type { CliNextAction } from "./types.js";
|
|
3
|
-
export type RecoveryOverride = Partial<CliNextAction>;
|
|
4
|
-
export declare const normalizeRecovery: (code: ErrorCode, override?: RecoveryOverride) => CliNextAction | undefined;
|
|
5
|
-
//# sourceMappingURL=recovery.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"recovery.d.ts","sourceRoot":"","sources":["../../src/shared/recovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,SAAS,EAAwB,MAAM,kBAAkB,CAAC;AACpF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AA0HtD,eAAO,MAAM,iBAAiB,GAC5B,MAAM,SAAS,EACf,WAAW,gBAAgB,KAC1B,aAAa,GAAG,SAkBlB,CAAC"}
|
package/dist/shared/recovery.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { ERROR_CODE } from "./error-codes.js";
|
|
2
|
-
const defaultRecoveryByCode = {
|
|
3
|
-
[ERROR_CODE.authDeviceExpired]: {
|
|
4
|
-
command: "ogment auth login",
|
|
5
|
-
reason: "Device code expired; restart login to continue.",
|
|
6
|
-
title: "Restart login",
|
|
7
|
-
when: "immediate",
|
|
8
|
-
},
|
|
9
|
-
[ERROR_CODE.authDevicePending]: {
|
|
10
|
-
command: "ogment auth status",
|
|
11
|
-
reason: "Authorization is pending; check whether credentials are now available.",
|
|
12
|
-
title: "Check auth status",
|
|
13
|
-
when: "immediate",
|
|
14
|
-
},
|
|
15
|
-
[ERROR_CODE.authInvalidCredentials]: {
|
|
16
|
-
command: "ogment auth logout",
|
|
17
|
-
reason: "Credentials are invalid; clear local state before re-authenticating.",
|
|
18
|
-
title: "Reset auth state",
|
|
19
|
-
when: "immediate",
|
|
20
|
-
},
|
|
21
|
-
[ERROR_CODE.authRequired]: {
|
|
22
|
-
command: "ogment auth login",
|
|
23
|
-
reason: "Authentication is required before catalog or invoke commands can run.",
|
|
24
|
-
title: "Authenticate",
|
|
25
|
-
when: "immediate",
|
|
26
|
-
},
|
|
27
|
-
[ERROR_CODE.contractVersionUnsupported]: {
|
|
28
|
-
command: "ogment --version",
|
|
29
|
-
reason: "Contract mismatch detected; verify CLI version and upgrade before retrying.",
|
|
30
|
-
title: "Inspect CLI version",
|
|
31
|
-
when: "immediate",
|
|
32
|
-
},
|
|
33
|
-
[ERROR_CODE.internalUnexpected]: {
|
|
34
|
-
command: "ogment status",
|
|
35
|
-
reason: "Unexpected failure detected; run diagnostics before retrying the workflow.",
|
|
36
|
-
title: "Inspect diagnostics",
|
|
37
|
-
when: "immediate",
|
|
38
|
-
},
|
|
39
|
-
[ERROR_CODE.remoteRateLimited]: {
|
|
40
|
-
command: "ogment status",
|
|
41
|
-
reason: "Remote rate limit detected; check diagnostics before retrying.",
|
|
42
|
-
title: "Inspect diagnostics",
|
|
43
|
-
when: "immediate",
|
|
44
|
-
},
|
|
45
|
-
[ERROR_CODE.remoteUnavailable]: {
|
|
46
|
-
command: "ogment status",
|
|
47
|
-
reason: "Remote service is unavailable; check connectivity and endpoint health.",
|
|
48
|
-
title: "Inspect diagnostics",
|
|
49
|
-
when: "immediate",
|
|
50
|
-
},
|
|
51
|
-
[ERROR_CODE.toolInputSchemaViolation]: {
|
|
52
|
-
command: "ogment catalog",
|
|
53
|
-
reason: "Tool contract did not validate; inspect available servers and tool metadata.",
|
|
54
|
-
title: "Inspect catalog",
|
|
55
|
-
when: "immediate",
|
|
56
|
-
},
|
|
57
|
-
[ERROR_CODE.toolNotFound]: {
|
|
58
|
-
command: "ogment catalog",
|
|
59
|
-
reason: "Requested tool could not be found; rediscover servers and tools.",
|
|
60
|
-
title: "Rediscover tools",
|
|
61
|
-
when: "immediate",
|
|
62
|
-
},
|
|
63
|
-
[ERROR_CODE.transportRequestFailed]: {
|
|
64
|
-
command: "ogment status",
|
|
65
|
-
reason: "Transport request failed; inspect connectivity diagnostics.",
|
|
66
|
-
title: "Inspect diagnostics",
|
|
67
|
-
when: "immediate",
|
|
68
|
-
},
|
|
69
|
-
[ERROR_CODE.validationInvalidInput]: {
|
|
70
|
-
command: "ogment --help",
|
|
71
|
-
reason: "Input validation failed; inspect canonical command syntax.",
|
|
72
|
-
title: "Show command help",
|
|
73
|
-
when: "immediate",
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
const dynamicRecoveryForCode = (code) => {
|
|
77
|
-
if (code.startsWith("HTTP_")) {
|
|
78
|
-
return {
|
|
79
|
-
command: "ogment status",
|
|
80
|
-
reason: `HTTP error ${code} detected; inspect diagnostics and remote connectivity.`,
|
|
81
|
-
title: "Inspect diagnostics",
|
|
82
|
-
when: "immediate",
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
if (code.startsWith("MCP_")) {
|
|
86
|
-
return {
|
|
87
|
-
command: "ogment status",
|
|
88
|
-
reason: `MCP error ${code} detected; inspect diagnostics and remote server state.`,
|
|
89
|
-
title: "Inspect diagnostics",
|
|
90
|
-
when: "immediate",
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
return undefined;
|
|
94
|
-
};
|
|
95
|
-
const hasPlaceholderTokens = (command) => {
|
|
96
|
-
return command.includes("<") || command.includes(">");
|
|
97
|
-
};
|
|
98
|
-
const sanitizedCommand = (command) => {
|
|
99
|
-
if (typeof command !== "string") {
|
|
100
|
-
return undefined;
|
|
101
|
-
}
|
|
102
|
-
if (hasPlaceholderTokens(command)) {
|
|
103
|
-
return undefined;
|
|
104
|
-
}
|
|
105
|
-
return command;
|
|
106
|
-
};
|
|
107
|
-
export const normalizeRecovery = (code, override) => {
|
|
108
|
-
const fallback = defaultRecoveryByCode[code] ?? dynamicRecoveryForCode(code);
|
|
109
|
-
if (fallback === undefined) {
|
|
110
|
-
return undefined;
|
|
111
|
-
}
|
|
112
|
-
const overrideCommand = sanitizedCommand(override?.command);
|
|
113
|
-
const command = overrideCommand ?? fallback.command;
|
|
114
|
-
const usesCustomCommand = overrideCommand !== undefined && overrideCommand !== fallback.command;
|
|
115
|
-
return {
|
|
116
|
-
command,
|
|
117
|
-
id: override?.id ?? `recover_${code.toLowerCase()}`,
|
|
118
|
-
reason: override?.reason ??
|
|
119
|
-
(usesCustomCommand ? `Suggested recovery for error ${code}.` : fallback.reason),
|
|
120
|
-
title: override?.title ?? (usesCustomCommand ? "Run suggested command" : fallback.title),
|
|
121
|
-
when: override?.when ?? fallback.when,
|
|
122
|
-
};
|
|
123
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema-example.d.ts","sourceRoot":"","sources":["../../src/shared/schema-example.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,mBAAmB,UAAU,CAAC;AA8H3C,eAAO,MAAM,sBAAsB,GAAI,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,OAExE,CAAC"}
|