@lanework/contracts 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +39 -2
- package/package.json +32 -4
- package/src/agent-notes.ts +69 -0
- package/src/auth.ts +251 -0
- package/src/boards.ts +932 -0
- package/src/checkpoints.ts +96 -0
- package/src/common.ts +85 -0
- package/src/endpoints.ts +435 -0
- package/src/index.ts +18 -0
- package/src/sync.ts +148 -0
- package/src/tools/board.ts +590 -0
- package/src/tools/control.ts +519 -0
- package/src/tools/index.ts +41 -0
- package/src/tools/instructions.ts +153 -0
- package/src/tools/kit.ts +233 -0
- package/src/tools/outputs.ts +279 -0
- package/src/tools/schema.ts +149 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// Checkpoints: where an agent stopped on a card, so a different agent can
|
|
2
|
+
// pick it up. Written by the Stop hook and the MCP `checkpoint` tool; read by
|
|
3
|
+
// `get_review` and the desktop. Derived from the server's
|
|
4
|
+
// `board/checkpoint.ts` and the two routes in `routes/boards.ts`.
|
|
5
|
+
//
|
|
6
|
+
// Both routes take the card as its uuid or its task id (`BE-17`).
|
|
7
|
+
|
|
8
|
+
import type { IsoDate } from "./common";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* How many checkpoints a card keeps, newest first.
|
|
12
|
+
*
|
|
13
|
+
* Finishing or archiving the card clears them all.
|
|
14
|
+
*/
|
|
15
|
+
export const CHECKPOINTS_KEPT = 5;
|
|
16
|
+
|
|
17
|
+
/** The most a checkpoint's content may weigh, serialized as JSON. */
|
|
18
|
+
export const CHECKPOINT_MAX_BYTES = 16 * 1024;
|
|
19
|
+
|
|
20
|
+
export interface CheckpointCommand {
|
|
21
|
+
command: string;
|
|
22
|
+
/** Null when the outcome is unknown. */
|
|
23
|
+
ok: boolean | null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface CheckpointGit {
|
|
27
|
+
branch: string | null;
|
|
28
|
+
head: string | null;
|
|
29
|
+
/** `refs/lanework/wip/<task-id>` when the uncommitted work was pushed. */
|
|
30
|
+
wipRef: string | null;
|
|
31
|
+
wipSha: string | null;
|
|
32
|
+
diffStat: string | null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* `POST /v1/boards/:workspaceId/items/:ref/checkpoints`, answered with 201.
|
|
37
|
+
*
|
|
38
|
+
* Lenient about length: over-long fields are cut, and lists keep their newest
|
|
39
|
+
* entries (100 files, 30 commands). Strict about shape and the 16 KiB total.
|
|
40
|
+
* 409 on a finished or archived card.
|
|
41
|
+
*/
|
|
42
|
+
export interface CheckpointRequest {
|
|
43
|
+
/** Required, up to 6000 characters. */
|
|
44
|
+
summary: string;
|
|
45
|
+
/** What the agent was asked, in the user's words. Up to 2000 characters. */
|
|
46
|
+
request?: string | null;
|
|
47
|
+
/** The one thing the next agent should do first. Up to 1000 characters. */
|
|
48
|
+
nextStep?: string | null;
|
|
49
|
+
/** Repo-relative paths changed. */
|
|
50
|
+
files?: string[];
|
|
51
|
+
commands?: { command: string; ok?: boolean | null }[];
|
|
52
|
+
host?: string | null;
|
|
53
|
+
session?: string | null;
|
|
54
|
+
git?: Partial<CheckpointGit> | null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** What the server stores, after trimming and bounding. */
|
|
58
|
+
export interface CheckpointContent {
|
|
59
|
+
request: string | null;
|
|
60
|
+
summary: string;
|
|
61
|
+
nextStep: string | null;
|
|
62
|
+
files: string[];
|
|
63
|
+
commands: CheckpointCommand[];
|
|
64
|
+
host: string | null;
|
|
65
|
+
session: string | null;
|
|
66
|
+
git: CheckpointGit | null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** A checkpoint as the wire carries it. */
|
|
70
|
+
export interface Checkpoint extends CheckpointContent {
|
|
71
|
+
id: string;
|
|
72
|
+
/** The writer's agent slug (`x-lanework-agent`), or `agent`. */
|
|
73
|
+
agent: string;
|
|
74
|
+
userId: string;
|
|
75
|
+
machineId: string | null;
|
|
76
|
+
createdAt: IsoDate;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface CheckpointCreateResponse {
|
|
80
|
+
checkpoint: Checkpoint;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The newest checkpoint, with `nextStep` carried forward from an older one.
|
|
85
|
+
*
|
|
86
|
+
* Carried only when the newest has none; `nextStepFrom` names that older row.
|
|
87
|
+
*/
|
|
88
|
+
export interface LatestCheckpoint extends Checkpoint {
|
|
89
|
+
nextStepFrom: { id: string; agent: string; createdAt: IsoDate } | null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** `GET /v1/boards/:workspaceId/items/:ref/checkpoints`, newest first. */
|
|
93
|
+
export interface CheckpointListResponse {
|
|
94
|
+
checkpoints: Checkpoint[];
|
|
95
|
+
latest: LatestCheckpoint | null;
|
|
96
|
+
}
|
package/src/common.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// Shapes every part of the API shares.
|
|
2
|
+
|
|
3
|
+
/** An ISO-8601 instant as the API writes it (`Date#toISOString()`). */
|
|
4
|
+
export type IsoDate = string;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The body of every refusal: 4xx and 5xx alike.
|
|
8
|
+
*
|
|
9
|
+
* A 500 always says `"internal error"` and nothing else. The cause is logged
|
|
10
|
+
* on the server, never returned.
|
|
11
|
+
*/
|
|
12
|
+
export interface ErrorResponse {
|
|
13
|
+
error: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** The default origin of the hosted control plane. */
|
|
17
|
+
export const DEFAULT_API_ORIGIN = "https://api.lanework.dev";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The request header an agent caller names itself with (`claude`, `codex`).
|
|
21
|
+
*
|
|
22
|
+
* Display only: it attributes checkpoints and audit rows, and grants nothing.
|
|
23
|
+
*/
|
|
24
|
+
export const AGENT_HEADER = "x-lanework-agent";
|
|
25
|
+
|
|
26
|
+
/** `Authorization: Bearer <machine secret>`: the credential a machine holds. */
|
|
27
|
+
export type BearerAuthorization = `Bearer ${string}`;
|
|
28
|
+
|
|
29
|
+
/** Prefixes of the tokens the API mints. A token is opaque past its prefix. */
|
|
30
|
+
export const TOKEN_PREFIXES = {
|
|
31
|
+
registration: "lw_reg_",
|
|
32
|
+
machine: "lw_mch_",
|
|
33
|
+
device: "lw_dev_",
|
|
34
|
+
code: "lw_code_",
|
|
35
|
+
} as const;
|
|
36
|
+
|
|
37
|
+
export type TokenKind = keyof typeof TOKEN_PREFIXES;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The shape of a well-formed machine secret: the prefix, then 16 to 190
|
|
41
|
+
* URL-safe characters.
|
|
42
|
+
*
|
|
43
|
+
* A secret goes into an `Authorization` header and into files the hook
|
|
44
|
+
* writes, so anything else (a quote, a newline, a space) is refused rather
|
|
45
|
+
* than stored (FE-78/D1).
|
|
46
|
+
*/
|
|
47
|
+
export const MACHINE_SECRET_PATTERN = new RegExp(
|
|
48
|
+
`^${TOKEN_PREFIXES.machine}[A-Za-z0-9_-]{16,190}$`,
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
/** Whether `value` is a well-formed machine secret; see the pattern above. */
|
|
52
|
+
export function isMachineSecret(value: unknown): value is string {
|
|
53
|
+
return typeof value === "string" && MACHINE_SECRET_PATTERN.test(value);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* A git remote with any `user:token@` taken out of it.
|
|
58
|
+
*
|
|
59
|
+
* `git remote get-url origin` prints a credential when one was cloned in
|
|
60
|
+
* (`https://u:ghp_x@github.com/o/r`). The board lookup sends the remote in a
|
|
61
|
+
* query string, where proxies and servers log it, so every remote is passed
|
|
62
|
+
* through this before it leaves the machine (FE-127). scp-like `git@host:o/r`
|
|
63
|
+
* has no secret in it and is left as is.
|
|
64
|
+
*/
|
|
65
|
+
export function stripUserinfo(remote: string): string {
|
|
66
|
+
const value = remote.trim();
|
|
67
|
+
if (!/^[a-z][a-z0-9+.-]*:\/\//i.test(value)) return value;
|
|
68
|
+
try {
|
|
69
|
+
const url = new URL(value);
|
|
70
|
+
// Untouched when there is nothing to strip: the same spelling as ever.
|
|
71
|
+
if (!url.username && !url.password) return value;
|
|
72
|
+
url.username = "";
|
|
73
|
+
url.password = "";
|
|
74
|
+
return url.toString();
|
|
75
|
+
} catch {
|
|
76
|
+
// Not a URL after all: cut what sits between `://` and the last `@`
|
|
77
|
+
// before the host.
|
|
78
|
+
return value.replace(/^([a-z][a-z0-9+.-]*:\/\/)[^/]*@/i, "$1");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** `GET /v1/health`. Unauthenticated. */
|
|
83
|
+
export interface HealthResponse {
|
|
84
|
+
ok: true;
|
|
85
|
+
}
|
package/src/endpoints.ts
ADDED
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
// Every endpoint the desktop app and the checkpoint hook call, as a path
|
|
2
|
+
// builder plus one map from `"METHOD /path"` to its request and response. The
|
|
3
|
+
// map is types only: it lets a client name an endpoint and get both halves of
|
|
4
|
+
// the contract from one key.
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
CliAuthRequest,
|
|
8
|
+
CliAuthResponse,
|
|
9
|
+
CliTokenRequest,
|
|
10
|
+
CliTokenResponse,
|
|
11
|
+
MachineHeartbeatResponse,
|
|
12
|
+
MachineMeResponse,
|
|
13
|
+
MachineRegisterRequest,
|
|
14
|
+
MachineRegisterResponse,
|
|
15
|
+
MachineRevokeResponse,
|
|
16
|
+
} from "./auth";
|
|
17
|
+
import type {
|
|
18
|
+
ActivityResponse,
|
|
19
|
+
AttachmentDeleteResponse,
|
|
20
|
+
AttachmentRequest,
|
|
21
|
+
AttachmentResponse,
|
|
22
|
+
AuditResponse,
|
|
23
|
+
BoardChangesResponse,
|
|
24
|
+
BoardConfigPutResponse,
|
|
25
|
+
BoardConfigRequest,
|
|
26
|
+
BoardConfigResponse,
|
|
27
|
+
BoardPresenceResponse,
|
|
28
|
+
BoardRepoRequest,
|
|
29
|
+
BoardRepoResponse,
|
|
30
|
+
BoardStatsResponse,
|
|
31
|
+
BoardsForRepoResponse,
|
|
32
|
+
CardArchiveResponse,
|
|
33
|
+
CardCreateRequest,
|
|
34
|
+
CardCreateResponse,
|
|
35
|
+
CardLinkRequest,
|
|
36
|
+
CardLinkResponse,
|
|
37
|
+
CardListResponse,
|
|
38
|
+
CardLookupResponse,
|
|
39
|
+
CardMoveRequest,
|
|
40
|
+
CardPatchRequest,
|
|
41
|
+
CardResponse,
|
|
42
|
+
CardRestoreResponse,
|
|
43
|
+
CardUnlinkResponse,
|
|
44
|
+
ChecklistItemPatchRequest,
|
|
45
|
+
ChecklistReplaceRequest,
|
|
46
|
+
CommentCreateResponse,
|
|
47
|
+
CommentDeleteResponse,
|
|
48
|
+
CommentListResponse,
|
|
49
|
+
CommentPatchResponse,
|
|
50
|
+
CommentRequest,
|
|
51
|
+
FavoriteResponse,
|
|
52
|
+
ImportRequest,
|
|
53
|
+
ImportResponse,
|
|
54
|
+
MigratedRequest,
|
|
55
|
+
MigratedResponse,
|
|
56
|
+
PurgeRequest,
|
|
57
|
+
PurgeResponse,
|
|
58
|
+
SubscriptionResponse,
|
|
59
|
+
} from "./boards";
|
|
60
|
+
import type {
|
|
61
|
+
CheckpointCreateResponse,
|
|
62
|
+
CheckpointListResponse,
|
|
63
|
+
CheckpointRequest,
|
|
64
|
+
} from "./checkpoints";
|
|
65
|
+
import { type HealthResponse, stripUserinfo } from "./common";
|
|
66
|
+
import type {
|
|
67
|
+
SyncStatePushRequest,
|
|
68
|
+
SyncStatePushResponse,
|
|
69
|
+
SyncStateResponse,
|
|
70
|
+
SyncWorkspaceCreateRequest,
|
|
71
|
+
SyncWorkspaceCreateResponse,
|
|
72
|
+
SyncWorkspaceDeleteResponse,
|
|
73
|
+
SyncWorkspaceOrderRequest,
|
|
74
|
+
SyncWorkspaceOrderResponse,
|
|
75
|
+
SyncWorkspacePatchRequest,
|
|
76
|
+
SyncWorkspacePatchResponse,
|
|
77
|
+
} from "./sync";
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* One URI-encoded path segment.
|
|
81
|
+
*
|
|
82
|
+
* `encodeURIComponent` leaves `.` alone, so `"."` and `".."` would reach the
|
|
83
|
+
* URL as dot segments and a URL parser would collapse them: `items/..` names
|
|
84
|
+
* the parent collection, not an item. An empty segment collapses the same
|
|
85
|
+
* way. All three are refused rather than sent (FE-78/D7).
|
|
86
|
+
*
|
|
87
|
+
* @throws When the segment is empty, `.` or `..`.
|
|
88
|
+
*/
|
|
89
|
+
export function seg(value: string): string {
|
|
90
|
+
if (value === "" || value === "." || value === "..")
|
|
91
|
+
throw new Error(`Refusing the path segment ${JSON.stringify(value)}.`);
|
|
92
|
+
return encodeURIComponent(value);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Paths, relative to the API origin.
|
|
97
|
+
*
|
|
98
|
+
* Every dynamic segment is URI-encoded here, so a caller never builds one by
|
|
99
|
+
* hand.
|
|
100
|
+
*/
|
|
101
|
+
export const paths = {
|
|
102
|
+
health: () => "/v1/health",
|
|
103
|
+
|
|
104
|
+
cliAuth: () => "/v1/cli/auth",
|
|
105
|
+
cliToken: () => "/v1/cli/token",
|
|
106
|
+
|
|
107
|
+
machinesRegister: () => "/v1/machines/register",
|
|
108
|
+
machinesMe: () => "/v1/machines/me",
|
|
109
|
+
machinesHeartbeat: () => "/v1/machines/heartbeat",
|
|
110
|
+
|
|
111
|
+
syncState: () => "/v1/sync/state",
|
|
112
|
+
syncWorkspace: () => "/v1/sync/state/workspace",
|
|
113
|
+
syncWorkspaceById: (id: string) => `/v1/sync/state/workspace/${seg(id)}`,
|
|
114
|
+
syncWorkspaceOrder: () => "/v1/sync/state/workspace-order",
|
|
115
|
+
|
|
116
|
+
// Never a credential in a query string: see `stripUserinfo`.
|
|
117
|
+
boardsForRepo: (remote: string) =>
|
|
118
|
+
`/v1/boards?repo=${seg(stripUserinfo(remote))}`,
|
|
119
|
+
boardRepo: (workspaceId: string) => `/v1/boards/${seg(workspaceId)}/repo`,
|
|
120
|
+
boardConfig: (workspaceId: string) => `/v1/boards/${seg(workspaceId)}/config`,
|
|
121
|
+
boardIcon: (workspaceId: string) => `/v1/boards/${seg(workspaceId)}/icon`,
|
|
122
|
+
boardPresence: (workspaceId: string) =>
|
|
123
|
+
`/v1/boards/${seg(workspaceId)}/presence`,
|
|
124
|
+
boardStats: (workspaceId: string, query?: Query) =>
|
|
125
|
+
withQuery(`/v1/boards/${seg(workspaceId)}/stats`, query),
|
|
126
|
+
boardChanges: (workspaceId: string, since: number, limit?: number) =>
|
|
127
|
+
`/v1/boards/${seg(workspaceId)}/changes?since=${since}${
|
|
128
|
+
limit === undefined ? "" : `&limit=${limit}`
|
|
129
|
+
}`,
|
|
130
|
+
boardLookup: (
|
|
131
|
+
workspaceId: string,
|
|
132
|
+
by: { taskId: string } | { source: string },
|
|
133
|
+
) =>
|
|
134
|
+
`/v1/boards/${seg(workspaceId)}/lookup?${
|
|
135
|
+
"taskId" in by ? `taskId=${seg(by.taskId)}` : `source=${seg(by.source)}`
|
|
136
|
+
}`,
|
|
137
|
+
boardImport: (workspaceId: string) => `/v1/boards/${seg(workspaceId)}/import`,
|
|
138
|
+
boardMigrated: (workspaceId: string) =>
|
|
139
|
+
`/v1/boards/${seg(workspaceId)}/migrated`,
|
|
140
|
+
boardPurge: (workspaceId: string) => `/v1/boards/${seg(workspaceId)}/purge`,
|
|
141
|
+
|
|
142
|
+
items: (workspaceId: string, query?: Query) =>
|
|
143
|
+
withQuery(`/v1/boards/${seg(workspaceId)}/items`, query),
|
|
144
|
+
item: (workspaceId: string, itemId: string) =>
|
|
145
|
+
`/v1/boards/${seg(workspaceId)}/items/${seg(itemId)}`,
|
|
146
|
+
itemMove: (workspaceId: string, itemId: string) =>
|
|
147
|
+
`${paths.item(workspaceId, itemId)}/move`,
|
|
148
|
+
itemRestore: (workspaceId: string, itemId: string) =>
|
|
149
|
+
`${paths.item(workspaceId, itemId)}/restore`,
|
|
150
|
+
itemChecklist: (workspaceId: string, itemId: string) =>
|
|
151
|
+
`${paths.item(workspaceId, itemId)}/checklist`,
|
|
152
|
+
itemChecklistItem: (workspaceId: string, itemId: string, key: string) =>
|
|
153
|
+
`${paths.item(workspaceId, itemId)}/checklist/${seg(key)}`,
|
|
154
|
+
itemLinks: (workspaceId: string, itemId: string) =>
|
|
155
|
+
`${paths.item(workspaceId, itemId)}/links`,
|
|
156
|
+
itemLink: (workspaceId: string, itemId: string, linkId: string) =>
|
|
157
|
+
`${paths.item(workspaceId, itemId)}/links/${seg(linkId)}`,
|
|
158
|
+
itemComments: (workspaceId: string, itemId: string) =>
|
|
159
|
+
`${paths.item(workspaceId, itemId)}/comments`,
|
|
160
|
+
itemComment: (workspaceId: string, itemId: string, commentId: string) =>
|
|
161
|
+
`${paths.item(workspaceId, itemId)}/comments/${seg(commentId)}`,
|
|
162
|
+
itemSubscription: (workspaceId: string, itemId: string) =>
|
|
163
|
+
`${paths.item(workspaceId, itemId)}/subscription`,
|
|
164
|
+
itemFavorite: (workspaceId: string, itemId: string) =>
|
|
165
|
+
`${paths.item(workspaceId, itemId)}/favorite`,
|
|
166
|
+
itemAttachments: (workspaceId: string, itemId: string) =>
|
|
167
|
+
`${paths.item(workspaceId, itemId)}/attachments`,
|
|
168
|
+
itemAttachment: (workspaceId: string, itemId: string, attachmentId: string) =>
|
|
169
|
+
`${paths.item(workspaceId, itemId)}/attachments/${seg(attachmentId)}`,
|
|
170
|
+
itemAudit: (workspaceId: string, itemId: string) =>
|
|
171
|
+
`${paths.item(workspaceId, itemId)}/audit`,
|
|
172
|
+
itemActivity: (workspaceId: string, itemId: string, query?: Query) =>
|
|
173
|
+
withQuery(`${paths.item(workspaceId, itemId)}/activity`, query),
|
|
174
|
+
/** `ref` is the card's uuid or its task id (`BE-17`). */
|
|
175
|
+
itemCheckpoints: (workspaceId: string, ref: string) =>
|
|
176
|
+
`/v1/boards/${seg(workspaceId)}/items/${seg(ref)}/checkpoints`,
|
|
177
|
+
} as const;
|
|
178
|
+
|
|
179
|
+
/** A query string, or anything that stringifies to one (`URLSearchParams`). */
|
|
180
|
+
export type Query = string | { toString(): string };
|
|
181
|
+
|
|
182
|
+
function withQuery(path: string, query?: Query): string {
|
|
183
|
+
const text = query === undefined ? "" : String(query);
|
|
184
|
+
return text ? `${path}?${text}` : path;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** The authentication an endpoint takes. */
|
|
188
|
+
export type EndpointAuth =
|
|
189
|
+
/** None: the body is the proof (PKCE, a registration token), or public. */
|
|
190
|
+
| "none"
|
|
191
|
+
/** `Authorization: Bearer <machine secret>` only. */
|
|
192
|
+
| "machine"
|
|
193
|
+
/** A machine credential or a browser session (`actorAuth`). */
|
|
194
|
+
| "actor";
|
|
195
|
+
|
|
196
|
+
interface Endpoint<Req, Res, A extends EndpointAuth> {
|
|
197
|
+
request: Req;
|
|
198
|
+
response: Res;
|
|
199
|
+
auth: A;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Every endpoint, by `"METHOD /path"`.
|
|
204
|
+
*
|
|
205
|
+
* A `void` request has no body. Query parameters are in the path builders.
|
|
206
|
+
*/
|
|
207
|
+
export interface Endpoints {
|
|
208
|
+
"GET /v1/health": Endpoint<void, HealthResponse, "none">;
|
|
209
|
+
|
|
210
|
+
"POST /v1/cli/auth": Endpoint<CliAuthRequest, CliAuthResponse, "none">;
|
|
211
|
+
"POST /v1/cli/token": Endpoint<CliTokenRequest, CliTokenResponse, "none">;
|
|
212
|
+
|
|
213
|
+
"POST /v1/machines/register": Endpoint<
|
|
214
|
+
MachineRegisterRequest,
|
|
215
|
+
MachineRegisterResponse,
|
|
216
|
+
"none"
|
|
217
|
+
>;
|
|
218
|
+
"GET /v1/machines/me": Endpoint<void, MachineMeResponse, "machine">;
|
|
219
|
+
"DELETE /v1/machines/me": Endpoint<void, MachineRevokeResponse, "machine">;
|
|
220
|
+
"POST /v1/machines/heartbeat": Endpoint<
|
|
221
|
+
void,
|
|
222
|
+
MachineHeartbeatResponse,
|
|
223
|
+
"machine"
|
|
224
|
+
>;
|
|
225
|
+
|
|
226
|
+
"GET /v1/sync/state": Endpoint<void, SyncStateResponse, "machine">;
|
|
227
|
+
"POST /v1/sync/state": Endpoint<
|
|
228
|
+
SyncStatePushRequest,
|
|
229
|
+
SyncStatePushResponse,
|
|
230
|
+
"machine"
|
|
231
|
+
>;
|
|
232
|
+
"POST /v1/sync/state/workspace": Endpoint<
|
|
233
|
+
SyncWorkspaceCreateRequest,
|
|
234
|
+
SyncWorkspaceCreateResponse,
|
|
235
|
+
"machine"
|
|
236
|
+
>;
|
|
237
|
+
"PATCH /v1/sync/state/workspace/:id": Endpoint<
|
|
238
|
+
SyncWorkspacePatchRequest,
|
|
239
|
+
SyncWorkspacePatchResponse,
|
|
240
|
+
"machine"
|
|
241
|
+
>;
|
|
242
|
+
"DELETE /v1/sync/state/workspace/:id": Endpoint<
|
|
243
|
+
void,
|
|
244
|
+
SyncWorkspaceDeleteResponse,
|
|
245
|
+
"machine"
|
|
246
|
+
>;
|
|
247
|
+
"PUT /v1/sync/state/workspace-order": Endpoint<
|
|
248
|
+
SyncWorkspaceOrderRequest,
|
|
249
|
+
SyncWorkspaceOrderResponse,
|
|
250
|
+
"machine"
|
|
251
|
+
>;
|
|
252
|
+
|
|
253
|
+
"GET /v1/boards": Endpoint<void, BoardsForRepoResponse, "actor">;
|
|
254
|
+
"PUT /v1/boards/:workspaceId/repo": Endpoint<
|
|
255
|
+
BoardRepoRequest,
|
|
256
|
+
BoardRepoResponse,
|
|
257
|
+
"actor"
|
|
258
|
+
>;
|
|
259
|
+
"GET /v1/boards/:workspaceId/config": Endpoint<
|
|
260
|
+
void,
|
|
261
|
+
BoardConfigResponse,
|
|
262
|
+
"actor"
|
|
263
|
+
>;
|
|
264
|
+
"PUT /v1/boards/:workspaceId/config": Endpoint<
|
|
265
|
+
BoardConfigRequest,
|
|
266
|
+
BoardConfigPutResponse,
|
|
267
|
+
"actor"
|
|
268
|
+
>;
|
|
269
|
+
/** Image bytes, not JSON. */
|
|
270
|
+
"GET /v1/boards/:workspaceId/icon": Endpoint<void, ArrayBuffer, "actor">;
|
|
271
|
+
"GET /v1/boards/:workspaceId/presence": Endpoint<
|
|
272
|
+
void,
|
|
273
|
+
BoardPresenceResponse,
|
|
274
|
+
"actor"
|
|
275
|
+
>;
|
|
276
|
+
"GET /v1/boards/:workspaceId/stats": Endpoint<
|
|
277
|
+
void,
|
|
278
|
+
BoardStatsResponse,
|
|
279
|
+
"actor"
|
|
280
|
+
>;
|
|
281
|
+
"GET /v1/boards/:workspaceId/changes": Endpoint<
|
|
282
|
+
void,
|
|
283
|
+
BoardChangesResponse,
|
|
284
|
+
"actor"
|
|
285
|
+
>;
|
|
286
|
+
"GET /v1/boards/:workspaceId/lookup": Endpoint<
|
|
287
|
+
void,
|
|
288
|
+
CardLookupResponse,
|
|
289
|
+
"actor"
|
|
290
|
+
>;
|
|
291
|
+
"GET /v1/boards/:workspaceId/items": Endpoint<
|
|
292
|
+
void,
|
|
293
|
+
CardListResponse,
|
|
294
|
+
"actor"
|
|
295
|
+
>;
|
|
296
|
+
"POST /v1/boards/:workspaceId/items": Endpoint<
|
|
297
|
+
CardCreateRequest,
|
|
298
|
+
CardCreateResponse,
|
|
299
|
+
"actor"
|
|
300
|
+
>;
|
|
301
|
+
"GET /v1/boards/:workspaceId/items/:itemId": Endpoint<
|
|
302
|
+
void,
|
|
303
|
+
CardResponse,
|
|
304
|
+
"actor"
|
|
305
|
+
>;
|
|
306
|
+
"PATCH /v1/boards/:workspaceId/items/:itemId": Endpoint<
|
|
307
|
+
CardPatchRequest,
|
|
308
|
+
CardResponse,
|
|
309
|
+
"actor"
|
|
310
|
+
>;
|
|
311
|
+
"DELETE /v1/boards/:workspaceId/items/:itemId": Endpoint<
|
|
312
|
+
void,
|
|
313
|
+
CardArchiveResponse,
|
|
314
|
+
"actor"
|
|
315
|
+
>;
|
|
316
|
+
"POST /v1/boards/:workspaceId/items/:itemId/restore": Endpoint<
|
|
317
|
+
void,
|
|
318
|
+
CardRestoreResponse,
|
|
319
|
+
"actor"
|
|
320
|
+
>;
|
|
321
|
+
"POST /v1/boards/:workspaceId/items/:itemId/move": Endpoint<
|
|
322
|
+
CardMoveRequest,
|
|
323
|
+
CardResponse,
|
|
324
|
+
"actor"
|
|
325
|
+
>;
|
|
326
|
+
"PUT /v1/boards/:workspaceId/items/:itemId/checklist": Endpoint<
|
|
327
|
+
ChecklistReplaceRequest,
|
|
328
|
+
CardResponse,
|
|
329
|
+
"actor"
|
|
330
|
+
>;
|
|
331
|
+
"PATCH /v1/boards/:workspaceId/items/:itemId/checklist/:key": Endpoint<
|
|
332
|
+
ChecklistItemPatchRequest,
|
|
333
|
+
CardResponse,
|
|
334
|
+
"actor"
|
|
335
|
+
>;
|
|
336
|
+
"POST /v1/boards/:workspaceId/items/:itemId/links": Endpoint<
|
|
337
|
+
CardLinkRequest,
|
|
338
|
+
CardLinkResponse,
|
|
339
|
+
"actor"
|
|
340
|
+
>;
|
|
341
|
+
"DELETE /v1/boards/:workspaceId/items/:itemId/links/:linkId": Endpoint<
|
|
342
|
+
void,
|
|
343
|
+
CardUnlinkResponse,
|
|
344
|
+
"actor"
|
|
345
|
+
>;
|
|
346
|
+
"GET /v1/boards/:workspaceId/items/:itemId/comments": Endpoint<
|
|
347
|
+
void,
|
|
348
|
+
CommentListResponse,
|
|
349
|
+
"actor"
|
|
350
|
+
>;
|
|
351
|
+
"POST /v1/boards/:workspaceId/items/:itemId/comments": Endpoint<
|
|
352
|
+
CommentRequest,
|
|
353
|
+
CommentCreateResponse,
|
|
354
|
+
"actor"
|
|
355
|
+
>;
|
|
356
|
+
"PATCH /v1/boards/:workspaceId/items/:itemId/comments/:commentId": Endpoint<
|
|
357
|
+
CommentRequest,
|
|
358
|
+
CommentPatchResponse,
|
|
359
|
+
"actor"
|
|
360
|
+
>;
|
|
361
|
+
"DELETE /v1/boards/:workspaceId/items/:itemId/comments/:commentId": Endpoint<
|
|
362
|
+
void,
|
|
363
|
+
CommentDeleteResponse,
|
|
364
|
+
"actor"
|
|
365
|
+
>;
|
|
366
|
+
"PUT /v1/boards/:workspaceId/items/:itemId/subscription": Endpoint<
|
|
367
|
+
void,
|
|
368
|
+
SubscriptionResponse,
|
|
369
|
+
"actor"
|
|
370
|
+
>;
|
|
371
|
+
"DELETE /v1/boards/:workspaceId/items/:itemId/subscription": Endpoint<
|
|
372
|
+
void,
|
|
373
|
+
SubscriptionResponse,
|
|
374
|
+
"actor"
|
|
375
|
+
>;
|
|
376
|
+
"PUT /v1/boards/:workspaceId/items/:itemId/favorite": Endpoint<
|
|
377
|
+
void,
|
|
378
|
+
FavoriteResponse,
|
|
379
|
+
"actor"
|
|
380
|
+
>;
|
|
381
|
+
"DELETE /v1/boards/:workspaceId/items/:itemId/favorite": Endpoint<
|
|
382
|
+
void,
|
|
383
|
+
FavoriteResponse,
|
|
384
|
+
"actor"
|
|
385
|
+
>;
|
|
386
|
+
"POST /v1/boards/:workspaceId/items/:itemId/attachments": Endpoint<
|
|
387
|
+
AttachmentRequest,
|
|
388
|
+
AttachmentResponse,
|
|
389
|
+
"actor"
|
|
390
|
+
>;
|
|
391
|
+
"DELETE /v1/boards/:workspaceId/items/:itemId/attachments/:attachmentId": Endpoint<
|
|
392
|
+
void,
|
|
393
|
+
AttachmentDeleteResponse,
|
|
394
|
+
"actor"
|
|
395
|
+
>;
|
|
396
|
+
"GET /v1/boards/:workspaceId/items/:itemId/audit": Endpoint<
|
|
397
|
+
void,
|
|
398
|
+
AuditResponse,
|
|
399
|
+
"actor"
|
|
400
|
+
>;
|
|
401
|
+
"GET /v1/boards/:workspaceId/items/:itemId/activity": Endpoint<
|
|
402
|
+
void,
|
|
403
|
+
ActivityResponse,
|
|
404
|
+
"actor"
|
|
405
|
+
>;
|
|
406
|
+
"POST /v1/boards/:workspaceId/items/:ref/checkpoints": Endpoint<
|
|
407
|
+
CheckpointRequest,
|
|
408
|
+
CheckpointCreateResponse,
|
|
409
|
+
"actor"
|
|
410
|
+
>;
|
|
411
|
+
"GET /v1/boards/:workspaceId/items/:ref/checkpoints": Endpoint<
|
|
412
|
+
void,
|
|
413
|
+
CheckpointListResponse,
|
|
414
|
+
"actor"
|
|
415
|
+
>;
|
|
416
|
+
"POST /v1/boards/:workspaceId/import": Endpoint<
|
|
417
|
+
ImportRequest,
|
|
418
|
+
ImportResponse,
|
|
419
|
+
"actor"
|
|
420
|
+
>;
|
|
421
|
+
"POST /v1/boards/:workspaceId/migrated": Endpoint<
|
|
422
|
+
MigratedRequest,
|
|
423
|
+
MigratedResponse,
|
|
424
|
+
"actor"
|
|
425
|
+
>;
|
|
426
|
+
"POST /v1/boards/:workspaceId/purge": Endpoint<
|
|
427
|
+
PurgeRequest,
|
|
428
|
+
PurgeResponse,
|
|
429
|
+
"actor"
|
|
430
|
+
>;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
export type EndpointKey = keyof Endpoints;
|
|
434
|
+
export type RequestOf<K extends EndpointKey> = Endpoints[K]["request"];
|
|
435
|
+
export type ResponseOf<K extends EndpointKey> = Endpoints[K]["response"];
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// @lanework/contracts: the HTTP contract between the Lanework desktop app (and
|
|
2
|
+
// its checkpoint hook) and the Lanework API (MIT).
|
|
3
|
+
//
|
|
4
|
+
// NOTE: Types, path builders and the tool contract (`./tools`: data plus a
|
|
5
|
+
// pure JSON Schema builder) only. Nothing here may import from `apps/` or
|
|
6
|
+
// `packages/db`: this package ships with the open-source desktop, and the
|
|
7
|
+
// server that implements it does not. When a route or a tool changes shape,
|
|
8
|
+
// change it here in the same commit.
|
|
9
|
+
|
|
10
|
+
export * from "./agent-notes";
|
|
11
|
+
export * from "./auth";
|
|
12
|
+
export * from "./boards";
|
|
13
|
+
export * from "./checkpoints";
|
|
14
|
+
export * from "./common";
|
|
15
|
+
export * from "./endpoints";
|
|
16
|
+
export * from "./sync";
|
|
17
|
+
export * from "./tools/control";
|
|
18
|
+
export * from "./tools/index";
|