@lanework/contracts 0.4.1 → 0.5.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/agent-notes.d.ts +30 -0
- package/dist/auth.d.ts +205 -0
- package/dist/avatar.d.ts +42 -0
- package/dist/boards.d.ts +809 -0
- package/dist/checkpoints.d.ts +86 -0
- package/dist/common.d.ts +54 -0
- package/dist/endpoints.d.ts +146 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +1540 -0
- package/dist/sync.d.ts +147 -0
- package/dist/tools/board.d.ts +159 -0
- package/dist/tools/control.d.ts +52 -0
- package/dist/tools/index.d.ts +15 -0
- package/dist/tools/instructions.d.ts +12 -0
- package/dist/tools/kit.d.ts +123 -0
- package/dist/tools/outputs.d.ts +21 -0
- package/dist/tools/schema.d.ts +78 -0
- package/package.json +11 -2
- package/src/avatar.ts +191 -0
- package/src/index.ts +1 -0
- package/src/sync.ts +13 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const MCP_URL = "https://mcp.lanework.dev/v1";
|
|
2
|
+
/**
|
|
3
|
+
* The same server with only the tools for working a card (BE-24):
|
|
4
|
+
* list_boards, get_review, set_status, toggle_item, checkpoint.
|
|
5
|
+
*
|
|
6
|
+
* NOTE: Same resource, same token. The server reads `toolset` past its auth
|
|
7
|
+
* gate; the protected-resource metadata and every token's audience stay the
|
|
8
|
+
* bare {@link MCP_URL}. A client must take the OAuth `resource` from that
|
|
9
|
+
* metadata, not from this URL (OpenCode 2.2 sends the URL itself, query and
|
|
10
|
+
* all, and the authorization server refuses it with `invalid_target`).
|
|
11
|
+
*/
|
|
12
|
+
export declare const MCP_WORKER_URL = "https://mcp.lanework.dev/v1?toolset=worker";
|
|
13
|
+
/** The MCP host alone, which any lanework config or note contains. */
|
|
14
|
+
export declare const MCP_HOST = "mcp.lanework.dev";
|
|
15
|
+
/**
|
|
16
|
+
* The board section of a project's AGENTS.md: a pointer, not the rules.
|
|
17
|
+
*
|
|
18
|
+
* The rules ship with the tools, as the MCP server's `instructions`
|
|
19
|
+
* (`BOARD_INSTRUCTIONS`), so every harness gets them on connect and a server
|
|
20
|
+
* update updates them everywhere. This only names the server and what to do
|
|
21
|
+
* without it.
|
|
22
|
+
*/
|
|
23
|
+
export declare const AGENT_NOTES = "## Lanework board\n\nCards for this repo live on Lanework, through the `lanework` MCP server.\nFollow its instructions for finding the board, writing cards and working\nthem. If the server is not connected, say so and stop rather than tracking\nthe work another way.";
|
|
24
|
+
/**
|
|
25
|
+
* Board sections the app wrote before, verbatim, newest first. A project
|
|
26
|
+
* whose AGENTS.md still holds one of them is offered the current
|
|
27
|
+
* {@link AGENT_NOTES} in its place; anything a person reworded is theirs and
|
|
28
|
+
* is never replaced.
|
|
29
|
+
*/
|
|
30
|
+
export declare const AGENT_NOTES_PREVIOUS: readonly string[];
|
package/dist/auth.d.ts
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import type { IsoDate } from "./common";
|
|
2
|
+
/** A coding-agent CLI found on the machine. Unknown providers are ignored. */
|
|
3
|
+
export interface MachineProvider {
|
|
4
|
+
provider: "claude" | "codex";
|
|
5
|
+
version?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* What a client tells the control plane about the machine it enrols.
|
|
9
|
+
*
|
|
10
|
+
* Display data only; the server bounds and trims every field.
|
|
11
|
+
*/
|
|
12
|
+
export interface MachineFacts {
|
|
13
|
+
/** 1-120 characters. Required. */
|
|
14
|
+
name: string;
|
|
15
|
+
/** At most 200 characters. */
|
|
16
|
+
hostname?: string | null;
|
|
17
|
+
/** At most 40 characters, e.g. `darwin`. */
|
|
18
|
+
os?: string | null;
|
|
19
|
+
/** At most 40 characters, e.g. `arm64`. */
|
|
20
|
+
arch?: string | null;
|
|
21
|
+
providers?: MachineProvider[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A machine credential, returned once.
|
|
25
|
+
*
|
|
26
|
+
* Returned by `POST /v1/cli/token` and `POST /v1/machines/register`, both
|
|
27
|
+
* with HTTP 201. Only its hash is stored.
|
|
28
|
+
*/
|
|
29
|
+
export interface MachineCredential {
|
|
30
|
+
machineId: string;
|
|
31
|
+
/** `lw_mch_…`. Sent back as `Authorization: Bearer <secret>`. */
|
|
32
|
+
secret: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The PKCE challenge method: S256 only.
|
|
36
|
+
*
|
|
37
|
+
* `plain` would let anyone who reads the authorize URL forge the proof.
|
|
38
|
+
*/
|
|
39
|
+
export type PkceMethod = "S256";
|
|
40
|
+
interface CliAuthBase extends MachineFacts {
|
|
41
|
+
/** base64url(SHA-256(verifier)), 43 characters. */
|
|
42
|
+
code_challenge: string;
|
|
43
|
+
code_challenge_method: PkceMethod;
|
|
44
|
+
}
|
|
45
|
+
/** Loopback: the browser comes back to a listener on this machine. */
|
|
46
|
+
export interface CliAuthLoopbackRequest extends CliAuthBase {
|
|
47
|
+
/** Absent or anything but `"device"` means loopback. */
|
|
48
|
+
mode?: "loopback";
|
|
49
|
+
/** `http://127.0.0.1:<port>/oauth/callback`, no query, no fragment. */
|
|
50
|
+
redirect_uri: string;
|
|
51
|
+
/** 8-128 url-safe characters, echoed back on the callback. */
|
|
52
|
+
state: string;
|
|
53
|
+
}
|
|
54
|
+
/** Device: a human types a short code on another machine. */
|
|
55
|
+
export interface CliAuthDeviceRequest extends CliAuthBase {
|
|
56
|
+
mode: "device";
|
|
57
|
+
}
|
|
58
|
+
export type CliAuthRequest = CliAuthLoopbackRequest | CliAuthDeviceRequest;
|
|
59
|
+
export interface CliAuthLoopbackResponse {
|
|
60
|
+
id: string;
|
|
61
|
+
/** On the API's own origin: `<api>/cli/authorize?id=<id>`. */
|
|
62
|
+
authorize_url: string;
|
|
63
|
+
/** Seconds the attempt stays alive (600). */
|
|
64
|
+
expires_in: number;
|
|
65
|
+
}
|
|
66
|
+
export interface CliAuthDeviceResponse {
|
|
67
|
+
id: string;
|
|
68
|
+
/** `lw_dev_…`. The redeem secret; never shown to a human. */
|
|
69
|
+
device_code: string;
|
|
70
|
+
/** `XXXX-XXXX` from `ABCDEFGHJKMNPQRSTUVWXYZ23456789`. */
|
|
71
|
+
user_code: string;
|
|
72
|
+
/** `<api>/cli/device`. */
|
|
73
|
+
verification_uri: string;
|
|
74
|
+
/** `<api>/cli/device?code=<user_code>`. */
|
|
75
|
+
verification_uri_complete: string;
|
|
76
|
+
/** Seconds to wait between polls of `/v1/cli/token` (5). */
|
|
77
|
+
interval: number;
|
|
78
|
+
/** Seconds the attempt stays alive (600). */
|
|
79
|
+
expires_in: number;
|
|
80
|
+
}
|
|
81
|
+
export type CliAuthResponse = CliAuthLoopbackResponse | CliAuthDeviceResponse;
|
|
82
|
+
/**
|
|
83
|
+
* Where the loopback flow lands: the API sends the browser to
|
|
84
|
+
* `<redirect_uri>?code=<lw_code_…>&state=<state>`.
|
|
85
|
+
*/
|
|
86
|
+
export declare const LOOPBACK_CALLBACK_PATH = "/oauth/callback";
|
|
87
|
+
export interface LoopbackCallbackQuery {
|
|
88
|
+
/** `lw_code_…`, useless without the PKCE verifier. */
|
|
89
|
+
code: string;
|
|
90
|
+
state: string;
|
|
91
|
+
}
|
|
92
|
+
/** `GET /v1/cli/request?id=…` or `?user_code=…`. */
|
|
93
|
+
export interface CliRequestView {
|
|
94
|
+
id: string;
|
|
95
|
+
mode: "loopback" | "device";
|
|
96
|
+
machineName: string;
|
|
97
|
+
hostname: string | null;
|
|
98
|
+
os: string | null;
|
|
99
|
+
arch: string | null;
|
|
100
|
+
createdAt: IsoDate;
|
|
101
|
+
expiresAt: IsoDate;
|
|
102
|
+
}
|
|
103
|
+
/** `POST /v1/cli/approve`. One of `id` or `user_code` is required. */
|
|
104
|
+
export interface CliApproveRequest {
|
|
105
|
+
id?: string;
|
|
106
|
+
user_code?: string;
|
|
107
|
+
/** Anything but `"deny"` allows. */
|
|
108
|
+
decision?: "allow" | "deny";
|
|
109
|
+
}
|
|
110
|
+
export type CliApproveResponse = {
|
|
111
|
+
decision: "deny";
|
|
112
|
+
}
|
|
113
|
+
/** Loopback approvals carry the URL the browser must follow next. */
|
|
114
|
+
| {
|
|
115
|
+
decision: "allow";
|
|
116
|
+
redirect_to?: string;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* The body of `POST /v1/cli/token`, which is unauthenticated.
|
|
120
|
+
*
|
|
121
|
+
* The code (or device code) plus the PKCE verifier is the authentication.
|
|
122
|
+
* Send `code` for loopback, `device_code` for device.
|
|
123
|
+
*/
|
|
124
|
+
export interface CliTokenRequest {
|
|
125
|
+
code?: string;
|
|
126
|
+
device_code?: string;
|
|
127
|
+
code_verifier: string;
|
|
128
|
+
}
|
|
129
|
+
/** The 201 answer of `POST /v1/cli/token`: the credential. */
|
|
130
|
+
export type CliTokenResponse = MachineCredential;
|
|
131
|
+
/**
|
|
132
|
+
* The device flow's "not yet" answers (HTTP 400), in RFC 8628's vocabulary.
|
|
133
|
+
*
|
|
134
|
+
* `invalid_grant` at HTTP 401 is the one answer for a wrong, unapproved,
|
|
135
|
+
* spent or expired code, or a bad verifier.
|
|
136
|
+
*/
|
|
137
|
+
export type CliTokenErrorCode = "authorization_pending" | "slow_down" | "access_denied" | "expired_token" | "invalid_grant" | "invalid_request";
|
|
138
|
+
export interface CliTokenError {
|
|
139
|
+
error: CliTokenErrorCode;
|
|
140
|
+
/** Present on the device-flow poll answers. */
|
|
141
|
+
interval?: number;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* `POST /v1/machines/register`: trade a registration token for a credential.
|
|
145
|
+
*/
|
|
146
|
+
export interface MachineRegisterRequest extends MachineFacts {
|
|
147
|
+
/** `lw_reg_…`, single use, 15 minutes. */
|
|
148
|
+
token: string;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* The 201 answer of `POST /v1/machines/register`.
|
|
152
|
+
*
|
|
153
|
+
* A 401 is one message for "wrong", "already used" and "expired".
|
|
154
|
+
*/
|
|
155
|
+
export type MachineRegisterResponse = MachineCredential;
|
|
156
|
+
/** The account behind a machine. Each field may be null. */
|
|
157
|
+
export interface MachineOwner {
|
|
158
|
+
name: string | null;
|
|
159
|
+
email: string | null;
|
|
160
|
+
image: string | null;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* `GET /v1/machines/me` (machine credential): who this machine is, and whose.
|
|
164
|
+
*
|
|
165
|
+
* Doubles as the presence ping. 401 means revoked or unknown, alike.
|
|
166
|
+
*/
|
|
167
|
+
export interface MachineMeResponse {
|
|
168
|
+
machineId: string;
|
|
169
|
+
name: string;
|
|
170
|
+
userId: string;
|
|
171
|
+
/** Null when the account row is gone; absent on an older control plane. */
|
|
172
|
+
user: MachineOwner | null;
|
|
173
|
+
}
|
|
174
|
+
/** `DELETE /v1/machines/me` (machine), `DELETE /v1/machines/:id` (session). */
|
|
175
|
+
export interface MachineRevokeResponse {
|
|
176
|
+
revoked: string;
|
|
177
|
+
}
|
|
178
|
+
/** `POST /v1/machines/heartbeat` (machine). */
|
|
179
|
+
export interface MachineHeartbeatResponse {
|
|
180
|
+
ok: true;
|
|
181
|
+
}
|
|
182
|
+
/** One row of `GET /v1/machines` (session). */
|
|
183
|
+
export interface MachineSummary {
|
|
184
|
+
id: string;
|
|
185
|
+
name: string;
|
|
186
|
+
hostname: string | null;
|
|
187
|
+
os: string | null;
|
|
188
|
+
arch: string | null;
|
|
189
|
+
createdAt: IsoDate;
|
|
190
|
+
lastSeenAt: IsoDate | null;
|
|
191
|
+
revokedAt: IsoDate | null;
|
|
192
|
+
/** Derived from `lastSeenAt`: seen within about 7 minutes and not revoked. */
|
|
193
|
+
online: boolean;
|
|
194
|
+
}
|
|
195
|
+
export interface MachineListResponse {
|
|
196
|
+
machines: MachineSummary[];
|
|
197
|
+
}
|
|
198
|
+
/** `POST /v1/tokens/registration` (session): what `/setup` mints. */
|
|
199
|
+
export interface RegistrationTokenResponse {
|
|
200
|
+
/** `lw_reg_…`. */
|
|
201
|
+
token: string;
|
|
202
|
+
expiresAt: IsoDate;
|
|
203
|
+
command: string;
|
|
204
|
+
}
|
|
205
|
+
export {};
|
package/dist/avatar.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Colour ids, never hex: there are no custom colours. Each app draws an id
|
|
3
|
+
* its own way, in light and dark.
|
|
4
|
+
*/
|
|
5
|
+
export declare const PROJECT_AVATAR_COLORS: readonly ["slate", "red", "orange", "amber", "green", "teal", "sky", "blue", "violet", "pink", "sunset", "ocean", "forest", "candy", "dusk", "aurora"];
|
|
6
|
+
export type ProjectAvatarColor = (typeof PROJECT_AVATAR_COLORS)[number];
|
|
7
|
+
/**
|
|
8
|
+
* The icons a project may pick: export names from `@hugeicons/core-free-icons`
|
|
9
|
+
* (checked against 4.3.0). A curated list, not the whole set, so an app only
|
|
10
|
+
* bundles these. Removing a name is a breaking change; adding one is minor.
|
|
11
|
+
*/
|
|
12
|
+
export declare const PROJECT_AVATAR_ICONS: readonly ["Rocket01Icon", "SourceCodeIcon", "ComputerTerminal01Icon", "GitBranchIcon", "Bug01Icon", "Database01Icon", "ServerStack01Icon", "CloudIcon", "Globe02Icon", "Link01Icon", "Layers01Icon", "Package01Icon", "DashboardSquare01Icon", "Settings01Icon", "Wrench01Icon", "Shield01Icon", "LockIcon", "Robot01Icon", "AiBrain01Icon", "SparklesIcon", "MagicWand01Icon", "Briefcase01Icon", "Analytics01Icon", "ChartLineData01Icon", "Wallet01Icon", "CreditCardIcon", "ShoppingCart01Icon", "ShoppingBag01Icon", "Store01Icon", "Target02Icon", "Flag01Icon", "Award01Icon", "Mail01Icon", "BubbleChatIcon", "Notification01Icon", "Calendar03Icon", "Clock01Icon", "Folder01Icon", "File01Icon", "Book02Icon", "School01Icon", "PencilEdit01Icon", "Home01Icon", "UserIcon", "UserGroupIcon", "Location01Icon", "Compass01Icon", "Car01Icon", "Airplane01Icon", "AnchorIcon", "PaintBoardIcon", "ColorsIcon", "Image01Icon", "Camera01Icon", "MusicNote01Icon", "HeadphonesIcon", "GameController01Icon", "PuzzleIcon", "Atom01Icon", "TestTube01Icon", "Idea01Icon", "Sun01Icon", "Moon02Icon", "FlashIcon", "FireIcon", "Leaf01Icon", "Plant01Icon", "Tree01Icon", "Coffee01Icon", "Pizza01Icon", "BirthdayCakeIcon", "GiftIcon", "Diamond01Icon", "CrownIcon", "StarIcon", "FavouriteIcon", "SmileIcon"];
|
|
13
|
+
export type ProjectAvatarIcon = (typeof PROJECT_AVATAR_ICONS)[number];
|
|
14
|
+
/**
|
|
15
|
+
* A project's chosen avatar. On the wire `avatar?: ProjectAvatar | null`:
|
|
16
|
+
* absent leaves it alone, `null` clears it back to the default mark.
|
|
17
|
+
*/
|
|
18
|
+
export type ProjectAvatar =
|
|
19
|
+
/** 1-2 characters (graphemes), e.g. initials. */
|
|
20
|
+
{
|
|
21
|
+
kind: "letter";
|
|
22
|
+
text: string;
|
|
23
|
+
color: ProjectAvatarColor;
|
|
24
|
+
}
|
|
25
|
+
/** Exactly one emoji grapheme. */
|
|
26
|
+
| {
|
|
27
|
+
kind: "emoji";
|
|
28
|
+
emoji: string;
|
|
29
|
+
color: ProjectAvatarColor;
|
|
30
|
+
}
|
|
31
|
+
/** A name from {@link PROJECT_AVATAR_ICONS}. */
|
|
32
|
+
| {
|
|
33
|
+
kind: "icon";
|
|
34
|
+
icon: ProjectAvatarIcon;
|
|
35
|
+
color: ProjectAvatarColor;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Read an avatar from untrusted input, strictly: an unknown kind, colour or
|
|
39
|
+
* icon, letter text that is empty, blank or over 2 characters, or an emoji
|
|
40
|
+
* that is not exactly one emoji grapheme gives null. Extra keys are dropped.
|
|
41
|
+
*/
|
|
42
|
+
export declare function parseProjectAvatar(value: unknown): ProjectAvatar | null;
|