@lilbox/contracts 0.0.0-stage → 0.0.2
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/LICENSE +21 -0
- package/README.md +66 -2
- package/dist/account.d.ts +175 -0
- package/dist/account.js +156 -0
- package/dist/app.d.ts +860 -0
- package/dist/app.js +169 -0
- package/dist/billing.d.ts +396 -0
- package/dist/billing.js +215 -0
- package/dist/common.d.ts +43 -0
- package/dist/common.js +59 -0
- package/dist/define.d.ts +29 -0
- package/dist/define.js +16 -0
- package/dist/deployment.d.ts +1495 -0
- package/dist/deployment.js +297 -0
- package/dist/errors.d.ts +141 -0
- package/dist/errors.js +58 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +20 -0
- package/dist/manifest.d.ts +101 -0
- package/dist/manifest.js +78 -0
- package/dist/mcp-tools.json +7748 -0
- package/dist/openapi.d.ts +60 -0
- package/dist/openapi.js +156 -0
- package/dist/openapi.json +5349 -0
- package/dist/registry.d.ts +2393 -0
- package/dist/registry.js +49 -0
- package/dist/runtime.d.ts +277 -0
- package/dist/runtime.js +144 -0
- package/dist/schemas/app.schema.json +256 -0
- package/dist/security.d.ts +127 -0
- package/dist/security.js +64 -0
- package/package.json +29 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 lilbox
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,67 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @lilbox/contracts
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The lilbox API's shapes, defined once as [zod](https://zod.dev) schemas: every REST operation and MCP tool,
|
|
4
|
+
the error shape, and `app.yaml`. The lilbox API, MCP server, dashboard and CLI are all built from them.
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
npm install @lilbox/contracts zod
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import { Manifest, operations, ERROR_CODES } from "@lilbox/contracts";
|
|
12
|
+
|
|
13
|
+
const manifest = Manifest.parse(yaml.load(source)); // validate an app.yaml
|
|
14
|
+
operations.create_deployment.input; // a tool's input schema
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Also shipped: `@lilbox/contracts/openapi.json` (the REST API, OpenAPI 3.1) and
|
|
18
|
+
`@lilbox/contracts/schemas/app.schema.json` (`app.yaml` as JSON Schema, for editors).
|
|
19
|
+
|
|
20
|
+
For a typed HTTP client, use `@lilbox/client`.
|
|
21
|
+
|
|
22
|
+
<!-- Everything below is for lilbox contributors. The domain model is docs/architecture/00-ontology.md (repo only). -->
|
|
23
|
+
|
|
24
|
+
## What's in it
|
|
25
|
+
|
|
26
|
+
One file per group, each holding that group's entities and tools.
|
|
27
|
+
|
|
28
|
+
| File | Contents |
|
|
29
|
+
|---|---|
|
|
30
|
+
| `src/account.ts` | 1. Account: User, scopes, connected agents, API keys, `whoami` and the dashboard-only credential operations |
|
|
31
|
+
| `src/app.ts` | 2. Application: App, AppConfig, app and config tools |
|
|
32
|
+
| `src/deployment.ts` | 3. Deployment: Deployment, sources, check, deployment tools |
|
|
33
|
+
| `src/manifest.ts` | `app.yaml` (part of Deployment: it travels with the source), capability codes |
|
|
34
|
+
| `src/security.ts` | 5. Security & Safety: activity events, `list_activity`, suspension reasons |
|
|
35
|
+
| `src/runtime.ts` | 4. Runtime: status, health, app logs, and what tenant apps see (env vars, signed cron calls) |
|
|
36
|
+
| `src/billing.ts` | 6. Billing: Plan, Subscription, Billing period, Bonus, their tools |
|
|
37
|
+
| `src/common.ts` | IDs (`usr_`, `app_`, `dep_`, `evt_`, `key_`, `agt_`, `bpr_`), names, timestamps, pagination, shared enums |
|
|
38
|
+
| `src/errors.ts` | The error shape and every error code |
|
|
39
|
+
| `src/define.ts`, `src/registry.ts` | How an API operation is defined, and the list of them |
|
|
40
|
+
| `src/openapi.ts` | Builds `openapi.json` and the MCP tool list from the registry |
|
|
41
|
+
|
|
42
|
+
## Rules for changing it
|
|
43
|
+
|
|
44
|
+
- **Adding** an operation, an optional input field, an output field, an error code or an enum value is fine.
|
|
45
|
+
- **Changing or removing** anything here breaks agents, the dashboard and the CLI. Don't, without a new
|
|
46
|
+
operation name or API version.
|
|
47
|
+
- MCP tool descriptions are prompts for agents: say when to call the tool and what to call next.
|
|
48
|
+
- `npm test` guards the rules that can be checked (unique routes, path params, JSON Schema conversion,
|
|
49
|
+
OpenAPI refs, the documented `app.yaml` example).
|
|
50
|
+
|
|
51
|
+
## Build
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
npm run contracts:build # from the repo root
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Writes `dist/` (JS + types) and the generated files:
|
|
58
|
+
|
|
59
|
+
| File | Used by |
|
|
60
|
+
|---|---|
|
|
61
|
+
| `dist/openapi.json` | `@lilbox/client` generation, the API reference on docs.lilbox.ai |
|
|
62
|
+
| `dist/mcp-tools.json` | Review of the tool list; offline clients |
|
|
63
|
+
| `dist/schemas/app.schema.json` | Editors, `lilbox://schema/app.yaml` |
|
|
64
|
+
|
|
65
|
+
Published to public npm as `@lilbox/contracts` (MIT). Only `dist/`, this README,
|
|
66
|
+
`LICENSE` and `package.json` are published; the tests stay in the repo. Check with
|
|
67
|
+
`npm pack --dry-run` before publishing.
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const Scope: z.ZodEnum<{
|
|
3
|
+
"apps:read": "apps:read";
|
|
4
|
+
"apps:write": "apps:write";
|
|
5
|
+
deploy: "deploy";
|
|
6
|
+
"billing:read": "billing:read";
|
|
7
|
+
}>;
|
|
8
|
+
export declare const ALL_SCOPES: ("apps:read" | "apps:write" | "deploy" | "billing:read")[];
|
|
9
|
+
export declare const User: z.ZodObject<{
|
|
10
|
+
id: z.ZodString;
|
|
11
|
+
email: z.ZodEmail;
|
|
12
|
+
name: z.ZodOptional<z.ZodString>;
|
|
13
|
+
sign_in_methods: z.ZodArray<z.ZodEnum<{
|
|
14
|
+
email: "email";
|
|
15
|
+
github: "github";
|
|
16
|
+
google: "google";
|
|
17
|
+
}>>;
|
|
18
|
+
created_at: z.ZodISODateTime;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export declare const Whoami: z.ZodObject<{
|
|
21
|
+
user: z.ZodObject<{
|
|
22
|
+
id: z.ZodString;
|
|
23
|
+
email: z.ZodEmail;
|
|
24
|
+
name: z.ZodOptional<z.ZodString>;
|
|
25
|
+
sign_in_methods: z.ZodArray<z.ZodEnum<{
|
|
26
|
+
email: "email";
|
|
27
|
+
github: "github";
|
|
28
|
+
google: "google";
|
|
29
|
+
}>>;
|
|
30
|
+
created_at: z.ZodISODateTime;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
credential: z.ZodObject<{
|
|
33
|
+
kind: z.ZodEnum<{
|
|
34
|
+
agent: "agent";
|
|
35
|
+
session: "session";
|
|
36
|
+
api_key: "api_key";
|
|
37
|
+
}>;
|
|
38
|
+
scopes: z.ZodArray<z.ZodEnum<{
|
|
39
|
+
"apps:read": "apps:read";
|
|
40
|
+
"apps:write": "apps:write";
|
|
41
|
+
deploy: "deploy";
|
|
42
|
+
"billing:read": "billing:read";
|
|
43
|
+
}>>;
|
|
44
|
+
expires_at: z.ZodNullable<z.ZodISODateTime>;
|
|
45
|
+
}, z.core.$strip>;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
export declare const ConnectedAgent: z.ZodObject<{
|
|
48
|
+
id: z.ZodString;
|
|
49
|
+
client_name: z.ZodString;
|
|
50
|
+
client_uri: z.ZodOptional<z.ZodURL>;
|
|
51
|
+
scopes: z.ZodArray<z.ZodEnum<{
|
|
52
|
+
"apps:read": "apps:read";
|
|
53
|
+
"apps:write": "apps:write";
|
|
54
|
+
deploy: "deploy";
|
|
55
|
+
"billing:read": "billing:read";
|
|
56
|
+
}>>;
|
|
57
|
+
connected_at: z.ZodISODateTime;
|
|
58
|
+
last_used_at: z.ZodNullable<z.ZodISODateTime>;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
export declare const ApiKey: z.ZodObject<{
|
|
61
|
+
id: z.ZodString;
|
|
62
|
+
name: z.ZodString;
|
|
63
|
+
prefix: z.ZodString;
|
|
64
|
+
scopes: z.ZodArray<z.ZodEnum<{
|
|
65
|
+
"apps:read": "apps:read";
|
|
66
|
+
"apps:write": "apps:write";
|
|
67
|
+
deploy: "deploy";
|
|
68
|
+
"billing:read": "billing:read";
|
|
69
|
+
}>>;
|
|
70
|
+
expires_at: z.ZodNullable<z.ZodISODateTime>;
|
|
71
|
+
created_at: z.ZodISODateTime;
|
|
72
|
+
last_used_at: z.ZodNullable<z.ZodISODateTime>;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
export declare const whoami: import("./define.js").OperationDef<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
|
|
75
|
+
user: z.ZodObject<{
|
|
76
|
+
id: z.ZodString;
|
|
77
|
+
email: z.ZodEmail;
|
|
78
|
+
name: z.ZodOptional<z.ZodString>;
|
|
79
|
+
sign_in_methods: z.ZodArray<z.ZodEnum<{
|
|
80
|
+
email: "email";
|
|
81
|
+
github: "github";
|
|
82
|
+
google: "google";
|
|
83
|
+
}>>;
|
|
84
|
+
created_at: z.ZodISODateTime;
|
|
85
|
+
}, z.core.$strip>;
|
|
86
|
+
credential: z.ZodObject<{
|
|
87
|
+
kind: z.ZodEnum<{
|
|
88
|
+
agent: "agent";
|
|
89
|
+
session: "session";
|
|
90
|
+
api_key: "api_key";
|
|
91
|
+
}>;
|
|
92
|
+
scopes: z.ZodArray<z.ZodEnum<{
|
|
93
|
+
"apps:read": "apps:read";
|
|
94
|
+
"apps:write": "apps:write";
|
|
95
|
+
deploy: "deploy";
|
|
96
|
+
"billing:read": "billing:read";
|
|
97
|
+
}>>;
|
|
98
|
+
expires_at: z.ZodNullable<z.ZodISODateTime>;
|
|
99
|
+
}, z.core.$strip>;
|
|
100
|
+
}, z.core.$strip>>;
|
|
101
|
+
export declare const list_connected_agents: import("./define.js").OperationDef<z.ZodObject<{
|
|
102
|
+
limit: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
103
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
104
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
105
|
+
agents: z.ZodArray<z.ZodObject<{
|
|
106
|
+
id: z.ZodString;
|
|
107
|
+
client_name: z.ZodString;
|
|
108
|
+
client_uri: z.ZodOptional<z.ZodURL>;
|
|
109
|
+
scopes: z.ZodArray<z.ZodEnum<{
|
|
110
|
+
"apps:read": "apps:read";
|
|
111
|
+
"apps:write": "apps:write";
|
|
112
|
+
deploy: "deploy";
|
|
113
|
+
"billing:read": "billing:read";
|
|
114
|
+
}>>;
|
|
115
|
+
connected_at: z.ZodISODateTime;
|
|
116
|
+
last_used_at: z.ZodNullable<z.ZodISODateTime>;
|
|
117
|
+
}, z.core.$strip>>;
|
|
118
|
+
next_cursor: z.ZodOptional<z.ZodString>;
|
|
119
|
+
}, z.core.$strip>>;
|
|
120
|
+
export declare const revoke_connected_agent: import("./define.js").OperationDef<z.ZodObject<{
|
|
121
|
+
agent_id: z.ZodString;
|
|
122
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
123
|
+
revoked: z.ZodLiteral<true>;
|
|
124
|
+
}, z.core.$strip>>;
|
|
125
|
+
export declare const list_api_keys: import("./define.js").OperationDef<z.ZodObject<{
|
|
126
|
+
limit: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
127
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
128
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
129
|
+
api_keys: z.ZodArray<z.ZodObject<{
|
|
130
|
+
id: z.ZodString;
|
|
131
|
+
name: z.ZodString;
|
|
132
|
+
prefix: z.ZodString;
|
|
133
|
+
scopes: z.ZodArray<z.ZodEnum<{
|
|
134
|
+
"apps:read": "apps:read";
|
|
135
|
+
"apps:write": "apps:write";
|
|
136
|
+
deploy: "deploy";
|
|
137
|
+
"billing:read": "billing:read";
|
|
138
|
+
}>>;
|
|
139
|
+
expires_at: z.ZodNullable<z.ZodISODateTime>;
|
|
140
|
+
created_at: z.ZodISODateTime;
|
|
141
|
+
last_used_at: z.ZodNullable<z.ZodISODateTime>;
|
|
142
|
+
}, z.core.$strip>>;
|
|
143
|
+
next_cursor: z.ZodOptional<z.ZodString>;
|
|
144
|
+
}, z.core.$strip>>;
|
|
145
|
+
export declare const create_api_key: import("./define.js").OperationDef<z.ZodObject<{
|
|
146
|
+
name: z.ZodString;
|
|
147
|
+
scopes: z.ZodArray<z.ZodEnum<{
|
|
148
|
+
"apps:read": "apps:read";
|
|
149
|
+
"apps:write": "apps:write";
|
|
150
|
+
deploy: "deploy";
|
|
151
|
+
"billing:read": "billing:read";
|
|
152
|
+
}>>;
|
|
153
|
+
expires_in_days: z.ZodOptional<z.ZodNumber>;
|
|
154
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
155
|
+
api_key: z.ZodObject<{
|
|
156
|
+
id: z.ZodString;
|
|
157
|
+
name: z.ZodString;
|
|
158
|
+
prefix: z.ZodString;
|
|
159
|
+
scopes: z.ZodArray<z.ZodEnum<{
|
|
160
|
+
"apps:read": "apps:read";
|
|
161
|
+
"apps:write": "apps:write";
|
|
162
|
+
deploy: "deploy";
|
|
163
|
+
"billing:read": "billing:read";
|
|
164
|
+
}>>;
|
|
165
|
+
expires_at: z.ZodNullable<z.ZodISODateTime>;
|
|
166
|
+
created_at: z.ZodISODateTime;
|
|
167
|
+
last_used_at: z.ZodNullable<z.ZodISODateTime>;
|
|
168
|
+
}, z.core.$strip>;
|
|
169
|
+
value: z.ZodString;
|
|
170
|
+
}, z.core.$strip>>;
|
|
171
|
+
export declare const revoke_api_key: import("./define.js").OperationDef<z.ZodObject<{
|
|
172
|
+
key_id: z.ZodString;
|
|
173
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
174
|
+
revoked: z.ZodLiteral<true>;
|
|
175
|
+
}, z.core.$strip>>;
|
package/dist/account.js
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
// Group 1: Account. Who is calling, and what may they do?
|
|
2
|
+
//
|
|
3
|
+
// The user is the account: they own their apps and their subscription directly. No orgs in phase 1.
|
|
4
|
+
// Teams later: create an org and move apps into it (stored records use owner_id, which can then hold an
|
|
5
|
+
// org's ID).
|
|
6
|
+
//
|
|
7
|
+
// Credentials:
|
|
8
|
+
// session the dashboard's cookie on .lilbox.ai (30 days, sliding)
|
|
9
|
+
// connected agent an OAuth grant: an MCP client or the CLI, connected through browser consent; revocable
|
|
10
|
+
// API key lbx_…, for CI and scripts; created by a human in the dashboard
|
|
11
|
+
// The OAuth endpoints (authorize, token, device flow, client registration) are standard protocol, served by
|
|
12
|
+
// oidc-provider, and not part of these contracts.
|
|
13
|
+
//
|
|
14
|
+
// Credentials are managed only from the dashboard (audience: human): an agent can never create its own
|
|
15
|
+
// credentials or widen its own access.
|
|
16
|
+
import { z } from "zod";
|
|
17
|
+
import { AgentGrantId, ApiKeyId, NextCursor, PageInput, Timestamp, UserId } from "./common.js";
|
|
18
|
+
import { defineOperation } from "./define.js";
|
|
19
|
+
// -----------------------------------------------------------------------------------------------------------
|
|
20
|
+
// Entities
|
|
21
|
+
// -----------------------------------------------------------------------------------------------------------
|
|
22
|
+
export const Scope = z.enum([
|
|
23
|
+
"apps:read", // list and get apps, status, logs, deployments, config (never secret values)
|
|
24
|
+
"apps:write", // create and delete apps, change config and secrets
|
|
25
|
+
"deploy", // check, create, cancel and roll back deployments
|
|
26
|
+
"billing:read", // subscription, usage, billing periods, referral; request an upgrade (a human completes it)
|
|
27
|
+
]);
|
|
28
|
+
export const ALL_SCOPES = Scope.options;
|
|
29
|
+
export const User = z
|
|
30
|
+
.object({
|
|
31
|
+
id: UserId,
|
|
32
|
+
email: z.email(),
|
|
33
|
+
name: z.string().optional(),
|
|
34
|
+
sign_in_methods: z.array(z.enum(["github", "google", "email"])),
|
|
35
|
+
created_at: Timestamp,
|
|
36
|
+
})
|
|
37
|
+
.meta({ id: "User" });
|
|
38
|
+
export const Whoami = z
|
|
39
|
+
.object({
|
|
40
|
+
user: User,
|
|
41
|
+
credential: z.object({
|
|
42
|
+
kind: z.enum(["session", "agent", "api_key"]),
|
|
43
|
+
scopes: z.array(Scope),
|
|
44
|
+
expires_at: Timestamp.nullable(),
|
|
45
|
+
}),
|
|
46
|
+
})
|
|
47
|
+
.meta({ id: "Whoami" });
|
|
48
|
+
export const ConnectedAgent = z
|
|
49
|
+
.object({
|
|
50
|
+
id: AgentGrantId,
|
|
51
|
+
client_name: z.string().meta({ description: 'As the client registered itself, e.g. "Claude Code".' }),
|
|
52
|
+
client_uri: z.url().optional(),
|
|
53
|
+
scopes: z.array(Scope),
|
|
54
|
+
connected_at: Timestamp,
|
|
55
|
+
last_used_at: Timestamp.nullable(),
|
|
56
|
+
})
|
|
57
|
+
.meta({ id: "ConnectedAgent" });
|
|
58
|
+
export const ApiKey = z
|
|
59
|
+
.object({
|
|
60
|
+
id: ApiKeyId,
|
|
61
|
+
name: z.string(),
|
|
62
|
+
prefix: z.string().meta({ description: 'The first characters, to recognise it: "lbx_ab12".' }),
|
|
63
|
+
scopes: z.array(Scope),
|
|
64
|
+
expires_at: Timestamp.nullable(),
|
|
65
|
+
created_at: Timestamp,
|
|
66
|
+
last_used_at: Timestamp.nullable(),
|
|
67
|
+
})
|
|
68
|
+
.meta({ id: "ApiKey" });
|
|
69
|
+
// -----------------------------------------------------------------------------------------------------------
|
|
70
|
+
// Agent tools
|
|
71
|
+
// -----------------------------------------------------------------------------------------------------------
|
|
72
|
+
export const whoami = defineOperation({
|
|
73
|
+
name: "whoami",
|
|
74
|
+
title: "Who am I",
|
|
75
|
+
description: "Returns the signed-in user and this credential's scopes. Call it first in a session to know what you're " +
|
|
76
|
+
"allowed to do. For the plan and trial, use get_subscription.",
|
|
77
|
+
http: { method: "GET", path: "/v1/whoami" },
|
|
78
|
+
scopes: [],
|
|
79
|
+
mutating: false,
|
|
80
|
+
phase: 1,
|
|
81
|
+
audience: "agent",
|
|
82
|
+
input: z.object({}),
|
|
83
|
+
output: Whoami,
|
|
84
|
+
hints: { readOnly: true },
|
|
85
|
+
});
|
|
86
|
+
// -----------------------------------------------------------------------------------------------------------
|
|
87
|
+
// Dashboard only (audience: human)
|
|
88
|
+
// -----------------------------------------------------------------------------------------------------------
|
|
89
|
+
export const list_connected_agents = defineOperation({
|
|
90
|
+
name: "list_connected_agents",
|
|
91
|
+
title: "List connected agents",
|
|
92
|
+
description: "Lists the MCP clients and CLIs connected to the account, with their scopes and last use.",
|
|
93
|
+
http: { method: "GET", path: "/v1/account/agents" },
|
|
94
|
+
scopes: [],
|
|
95
|
+
mutating: false,
|
|
96
|
+
phase: 1,
|
|
97
|
+
audience: "human",
|
|
98
|
+
input: z.object({ ...PageInput }),
|
|
99
|
+
output: z.object({ agents: z.array(ConnectedAgent), next_cursor: NextCursor }),
|
|
100
|
+
hints: { readOnly: true },
|
|
101
|
+
});
|
|
102
|
+
export const revoke_connected_agent = defineOperation({
|
|
103
|
+
name: "revoke_connected_agent",
|
|
104
|
+
title: "Disconnect an agent",
|
|
105
|
+
description: "Revokes a connected agent's tokens. It must go through the connect flow again to get access back.",
|
|
106
|
+
http: { method: "DELETE", path: "/v1/account/agents/{agent_id}" },
|
|
107
|
+
scopes: [],
|
|
108
|
+
mutating: true,
|
|
109
|
+
phase: 1,
|
|
110
|
+
audience: "human",
|
|
111
|
+
input: z.object({ agent_id: AgentGrantId }),
|
|
112
|
+
output: z.object({ revoked: z.literal(true) }),
|
|
113
|
+
hints: { destructive: true, idempotent: true },
|
|
114
|
+
});
|
|
115
|
+
export const list_api_keys = defineOperation({
|
|
116
|
+
name: "list_api_keys",
|
|
117
|
+
title: "List API keys",
|
|
118
|
+
description: "Lists the account's API keys. Key values are shown only once, at creation.",
|
|
119
|
+
http: { method: "GET", path: "/v1/account/api-keys" },
|
|
120
|
+
scopes: [],
|
|
121
|
+
mutating: false,
|
|
122
|
+
phase: 1,
|
|
123
|
+
audience: "human",
|
|
124
|
+
input: z.object({ ...PageInput }),
|
|
125
|
+
output: z.object({ api_keys: z.array(ApiKey), next_cursor: NextCursor }),
|
|
126
|
+
hints: { readOnly: true },
|
|
127
|
+
});
|
|
128
|
+
export const create_api_key = defineOperation({
|
|
129
|
+
name: "create_api_key",
|
|
130
|
+
title: "Create an API key",
|
|
131
|
+
description: "Creates an lbx_ API key for CI or scripts. The value is returned once; only a hash is stored.",
|
|
132
|
+
http: { method: "POST", path: "/v1/account/api-keys" },
|
|
133
|
+
scopes: [],
|
|
134
|
+
mutating: true,
|
|
135
|
+
phase: 1,
|
|
136
|
+
audience: "human",
|
|
137
|
+
input: z.object({
|
|
138
|
+
name: z.string().min(1).max(64),
|
|
139
|
+
scopes: z.array(Scope).min(1),
|
|
140
|
+
expires_in_days: z.number().int().min(1).max(365).optional().meta({ description: "Omitted: never expires." }),
|
|
141
|
+
}),
|
|
142
|
+
output: z.object({ api_key: ApiKey, value: z.string().meta({ description: "lbx_…, shown only now." }) }),
|
|
143
|
+
});
|
|
144
|
+
export const revoke_api_key = defineOperation({
|
|
145
|
+
name: "revoke_api_key",
|
|
146
|
+
title: "Revoke an API key",
|
|
147
|
+
description: "Revokes an API key. Calls using it fail with unauthenticated from then on.",
|
|
148
|
+
http: { method: "DELETE", path: "/v1/account/api-keys/{key_id}" },
|
|
149
|
+
scopes: [],
|
|
150
|
+
mutating: true,
|
|
151
|
+
phase: 1,
|
|
152
|
+
audience: "human",
|
|
153
|
+
input: z.object({ key_id: ApiKeyId }),
|
|
154
|
+
output: z.object({ revoked: z.literal(true) }),
|
|
155
|
+
hints: { destructive: true, idempotent: true },
|
|
156
|
+
});
|