@ogment-ai/cli-contract 0.3.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 +5 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/v1/account.d.ts +33 -0
- package/dist/v1/account.d.ts.map +1 -0
- package/dist/v1/account.js +18 -0
- package/dist/v1/auth.d.ts +60 -0
- package/dist/v1/auth.d.ts.map +1 -0
- package/dist/v1/auth.js +47 -0
- package/dist/v1/common.d.ts +8 -0
- package/dist/v1/common.d.ts.map +1 -0
- package/dist/v1/common.js +6 -0
- package/dist/v1/endpoints.d.ts +13 -0
- package/dist/v1/endpoints.d.ts.map +1 -0
- package/dist/v1/endpoints.js +11 -0
- package/dist/v1/errors.d.ts +10 -0
- package/dist/v1/errors.d.ts.map +1 -0
- package/dist/v1/errors.js +8 -0
- package/dist/v1/index.d.ts +6 -0
- package/dist/v1/index.d.ts.map +1 -0
- package/dist/v1/index.js +5 -0
- package/package.json +45 -0
package/README.md
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./v1/index.js";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const orgServerSchema: z.ZodObject<{
|
|
3
|
+
description: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
4
|
+
enabled: z.ZodBoolean;
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
path: z.ZodString;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export declare const organizationSchema: z.ZodObject<{
|
|
9
|
+
orgSlug: z.ZodString;
|
|
10
|
+
servers: z.ZodArray<z.ZodObject<{
|
|
11
|
+
description: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
12
|
+
enabled: z.ZodBoolean;
|
|
13
|
+
name: z.ZodString;
|
|
14
|
+
path: z.ZodString;
|
|
15
|
+
}, z.core.$strip>>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
export declare const accountMeSchema: z.ZodObject<{
|
|
18
|
+
data: z.ZodObject<{
|
|
19
|
+
email: z.ZodNullable<z.ZodString>;
|
|
20
|
+
name: z.ZodNullable<z.ZodString>;
|
|
21
|
+
orgs: z.ZodArray<z.ZodObject<{
|
|
22
|
+
orgSlug: z.ZodString;
|
|
23
|
+
servers: z.ZodArray<z.ZodObject<{
|
|
24
|
+
description: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
25
|
+
enabled: z.ZodBoolean;
|
|
26
|
+
name: z.ZodString;
|
|
27
|
+
path: z.ZodString;
|
|
28
|
+
}, z.core.$strip>>;
|
|
29
|
+
}, z.core.$strip>>;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
export type AccountMeResponse = z.infer<typeof accountMeSchema>;
|
|
33
|
+
//# sourceMappingURL=account.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/v1/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,eAAe;;;;;iBAK1B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;iBAG7B,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;iBAM1B,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const orgServerSchema = z.object({
|
|
3
|
+
description: z.string().nullable().optional().default(null),
|
|
4
|
+
enabled: z.boolean(),
|
|
5
|
+
name: z.string(),
|
|
6
|
+
path: z.string(),
|
|
7
|
+
});
|
|
8
|
+
export const organizationSchema = z.object({
|
|
9
|
+
orgSlug: z.string(),
|
|
10
|
+
servers: z.array(orgServerSchema),
|
|
11
|
+
});
|
|
12
|
+
export const accountMeSchema = z.object({
|
|
13
|
+
data: z.object({
|
|
14
|
+
email: z.string().nullable(),
|
|
15
|
+
name: z.string().nullable(),
|
|
16
|
+
orgs: z.array(organizationSchema),
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const deviceCodeStartSchema: z.ZodObject<{
|
|
3
|
+
data: z.ZodObject<{
|
|
4
|
+
device_code: z.ZodString;
|
|
5
|
+
expires_in: z.ZodNumber;
|
|
6
|
+
interval: z.ZodNumber;
|
|
7
|
+
user_code: z.ZodString;
|
|
8
|
+
verification_uri: z.ZodString;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export declare const deviceTokenApprovedSchema: z.ZodObject<{
|
|
12
|
+
data: z.ZodObject<{
|
|
13
|
+
agent_name: z.ZodNullable<z.ZodString>;
|
|
14
|
+
api_key: z.ZodString;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
export declare const oauthClientRegistrationSchema: z.ZodObject<{
|
|
18
|
+
client_id: z.ZodString;
|
|
19
|
+
client_name: z.ZodString;
|
|
20
|
+
client_secret: z.ZodOptional<z.ZodString>;
|
|
21
|
+
redirect_uris: z.ZodArray<z.ZodString>;
|
|
22
|
+
scope: z.ZodString;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export declare const oauthTokenSchema: z.ZodObject<{
|
|
25
|
+
access_token: z.ZodString;
|
|
26
|
+
expires_in: z.ZodNumber;
|
|
27
|
+
scope: z.ZodString;
|
|
28
|
+
token_type: z.ZodString;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
export declare const browserAgentCallbackSchema: z.ZodObject<{
|
|
31
|
+
agent_name: z.ZodOptional<z.ZodString>;
|
|
32
|
+
exchange_code: z.ZodString;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
export declare const cliExchangeRequestSchema: z.ZodObject<{
|
|
35
|
+
exchange_code: z.ZodString;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
export declare const cliExchangeSuccessSchema: z.ZodObject<{
|
|
38
|
+
data: z.ZodObject<{
|
|
39
|
+
apiKey: z.ZodString;
|
|
40
|
+
name: z.ZodString;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
export declare const cliExchangeErrorSchema: z.ZodObject<{
|
|
44
|
+
error: z.ZodEnum<{
|
|
45
|
+
authorization_pending: "authorization_pending";
|
|
46
|
+
expired_exchange_code: "expired_exchange_code";
|
|
47
|
+
internal_error: "internal_error";
|
|
48
|
+
invalid_exchange_code: "invalid_exchange_code";
|
|
49
|
+
missing_exchange_code: "missing_exchange_code";
|
|
50
|
+
}>;
|
|
51
|
+
message: z.ZodOptional<z.ZodString>;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
export type BrowserAgentCallback = z.infer<typeof browserAgentCallbackSchema>;
|
|
54
|
+
export type CliExchangeErrorResponse = z.infer<typeof cliExchangeErrorSchema>;
|
|
55
|
+
export type CliExchangeSuccessResponse = z.infer<typeof cliExchangeSuccessSchema>;
|
|
56
|
+
export type DeviceCodeStartResponse = z.infer<typeof deviceCodeStartSchema>;
|
|
57
|
+
export type DeviceTokenApprovedResponse = z.infer<typeof deviceTokenApprovedSchema>;
|
|
58
|
+
export type OauthClientRegistrationResponse = z.infer<typeof oauthClientRegistrationSchema>;
|
|
59
|
+
export type OauthTokenResponse = z.infer<typeof oauthTokenSchema>;
|
|
60
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/v1/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,qBAAqB;;;;;;;;iBAQhC,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;iBAKpC,CAAC;AAEH,eAAO,MAAM,6BAA6B;;;;;;iBAMxC,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;iBAK3B,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;iBAGrC,CAAC;AAEH,eAAO,MAAM,wBAAwB;;iBAEnC,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;iBAKnC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;iBAGjC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAC9E,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAClF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAC5E,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AACpF,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAC5F,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
package/dist/v1/auth.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { cliExchangeErrorCodeSchema } from "./errors.js";
|
|
3
|
+
export const deviceCodeStartSchema = z.object({
|
|
4
|
+
data: z.object({
|
|
5
|
+
device_code: z.string().min(1),
|
|
6
|
+
expires_in: z.number().int().positive(),
|
|
7
|
+
interval: z.number().int().positive(),
|
|
8
|
+
user_code: z.string().min(1),
|
|
9
|
+
verification_uri: z.string().url(),
|
|
10
|
+
}),
|
|
11
|
+
});
|
|
12
|
+
export const deviceTokenApprovedSchema = z.object({
|
|
13
|
+
data: z.object({
|
|
14
|
+
agent_name: z.string().nullable(),
|
|
15
|
+
api_key: z.string().min(1),
|
|
16
|
+
}),
|
|
17
|
+
});
|
|
18
|
+
export const oauthClientRegistrationSchema = z.object({
|
|
19
|
+
client_id: z.string().min(1),
|
|
20
|
+
client_name: z.string().min(1),
|
|
21
|
+
client_secret: z.string().optional(),
|
|
22
|
+
redirect_uris: z.array(z.string().min(1)),
|
|
23
|
+
scope: z.string().min(1),
|
|
24
|
+
});
|
|
25
|
+
export const oauthTokenSchema = z.object({
|
|
26
|
+
access_token: z.string().min(1),
|
|
27
|
+
expires_in: z.number().int().positive(),
|
|
28
|
+
scope: z.string().min(1),
|
|
29
|
+
token_type: z.string().min(1),
|
|
30
|
+
});
|
|
31
|
+
export const browserAgentCallbackSchema = z.object({
|
|
32
|
+
agent_name: z.string().optional(),
|
|
33
|
+
exchange_code: z.string().min(1),
|
|
34
|
+
});
|
|
35
|
+
export const cliExchangeRequestSchema = z.object({
|
|
36
|
+
exchange_code: z.string().min(1),
|
|
37
|
+
});
|
|
38
|
+
export const cliExchangeSuccessSchema = z.object({
|
|
39
|
+
data: z.object({
|
|
40
|
+
apiKey: z.string().min(1),
|
|
41
|
+
name: z.string().min(1),
|
|
42
|
+
}),
|
|
43
|
+
});
|
|
44
|
+
export const cliExchangeErrorSchema = z.object({
|
|
45
|
+
error: cliExchangeErrorCodeSchema,
|
|
46
|
+
message: z.string().optional(),
|
|
47
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const jsonObjectSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
3
|
+
export declare const stringErrorEnvelopeSchema: z.ZodObject<{
|
|
4
|
+
error: z.ZodString;
|
|
5
|
+
message: z.ZodOptional<z.ZodString>;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export type StringErrorEnvelope = z.infer<typeof stringErrorEnvelopeSchema>;
|
|
8
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/v1/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAAgB,wCAAoC,CAAC;AAElE,eAAO,MAAM,yBAAyB;;;iBAGpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const cliV1Endpoints: {
|
|
2
|
+
readonly accountMe: "/api/v1/mcp-auth/me";
|
|
3
|
+
readonly agentSelect: "/cli/agent-select";
|
|
4
|
+
readonly cliExchange: "/api/v1/mcp-auth/cli/exchange";
|
|
5
|
+
readonly cliRevokeSelf: "/api/v1/mcp-auth/cli/revoke-self";
|
|
6
|
+
readonly deviceCode: "/api/v1/mcp-auth/device/code";
|
|
7
|
+
readonly deviceToken: "/api/v1/mcp-auth/device/token";
|
|
8
|
+
readonly oauthAuthorize: "/api/v1/mcp-auth/authorize";
|
|
9
|
+
readonly oauthRegister: "/api/v1/mcp-auth/register";
|
|
10
|
+
readonly oauthToken: "/api/v1/mcp-auth/token";
|
|
11
|
+
};
|
|
12
|
+
export type CliV1EndpointName = keyof typeof cliV1Endpoints;
|
|
13
|
+
//# sourceMappingURL=endpoints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../src/v1/endpoints.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc;;;;;;;;;;CAUjB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,MAAM,OAAO,cAAc,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const cliV1Endpoints = {
|
|
2
|
+
accountMe: "/api/v1/mcp-auth/me",
|
|
3
|
+
agentSelect: "/cli/agent-select",
|
|
4
|
+
cliExchange: "/api/v1/mcp-auth/cli/exchange",
|
|
5
|
+
cliRevokeSelf: "/api/v1/mcp-auth/cli/revoke-self",
|
|
6
|
+
deviceCode: "/api/v1/mcp-auth/device/code",
|
|
7
|
+
deviceToken: "/api/v1/mcp-auth/device/token",
|
|
8
|
+
oauthAuthorize: "/api/v1/mcp-auth/authorize",
|
|
9
|
+
oauthRegister: "/api/v1/mcp-auth/register",
|
|
10
|
+
oauthToken: "/api/v1/mcp-auth/token",
|
|
11
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const cliExchangeErrorCodeSchema: z.ZodEnum<{
|
|
3
|
+
authorization_pending: "authorization_pending";
|
|
4
|
+
expired_exchange_code: "expired_exchange_code";
|
|
5
|
+
internal_error: "internal_error";
|
|
6
|
+
invalid_exchange_code: "invalid_exchange_code";
|
|
7
|
+
missing_exchange_code: "missing_exchange_code";
|
|
8
|
+
}>;
|
|
9
|
+
export type CliExchangeErrorCode = z.infer<typeof cliExchangeErrorCodeSchema>;
|
|
10
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/v1/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,0BAA0B;;;;;;EAMrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC"}
|
package/dist/v1/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ogment-ai/cli-contract",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Shared API contracts for Ogment CLI and backend",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"default": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"./v1": {
|
|
12
|
+
"types": "./dist/v1/index.d.ts",
|
|
13
|
+
"default": "./dist/v1/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"clean": "node -e \"import { rmSync } from 'node:fs'; rmSync('dist', { recursive: true, force: true });\"",
|
|
21
|
+
"build": "npm run clean && tsc -p tsconfig.build.json",
|
|
22
|
+
"check-types": "tsc -p tsconfig.json --noEmit",
|
|
23
|
+
"lint": "oxlint --type-aware --type-check --tsconfig tsconfig.json src",
|
|
24
|
+
"lint:fix": "npm run lint -- --fix",
|
|
25
|
+
"format": "oxfmt --write src test",
|
|
26
|
+
"format:check": "oxfmt --check src test",
|
|
27
|
+
"test": "vitest -c vitest.config.ts",
|
|
28
|
+
"test:run": "vitest run -c vitest.config.ts",
|
|
29
|
+
"test:coverage": "npm run test:run -- --coverage",
|
|
30
|
+
"qa": "npm run lint && npm run check-types && npm run test:run",
|
|
31
|
+
"prepublishOnly": "npm run build"
|
|
32
|
+
},
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"zod": "^4.3.6"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/node": "^22.18.12",
|
|
39
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
40
|
+
"oxfmt": "^0.34.0",
|
|
41
|
+
"oxlint": "^1.49.0",
|
|
42
|
+
"typescript": "^5.9.3",
|
|
43
|
+
"vitest": "^4.0.18"
|
|
44
|
+
}
|
|
45
|
+
}
|