@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
package/src/sync.ts
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
// `/v1/sync/*`: the machine surface for a user's projects. Machine credential
|
|
2
|
+
// only; `/v1/workspaces` is the session twin and refuses a machine with 401.
|
|
3
|
+
// Derived from the server's `routes/sync.ts`.
|
|
4
|
+
|
|
5
|
+
import type { IsoDate } from "./common";
|
|
6
|
+
|
|
7
|
+
export interface SyncProfile {
|
|
8
|
+
name: string | null;
|
|
9
|
+
birthYear: number | null;
|
|
10
|
+
gender: string | null;
|
|
11
|
+
language: string | null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** A project as `GET /v1/sync/state` states it. */
|
|
15
|
+
export interface SyncWorkspace {
|
|
16
|
+
/** The board id. Every `/v1/boards/:workspaceId/…` takes it, not the slug. */
|
|
17
|
+
id: string;
|
|
18
|
+
slug: string;
|
|
19
|
+
name: string;
|
|
20
|
+
color: string | null;
|
|
21
|
+
/** The R2 key of the project's icon, or null. */
|
|
22
|
+
iconKey: string | null;
|
|
23
|
+
laneworkStyle: boolean;
|
|
24
|
+
baseBranch: string | null;
|
|
25
|
+
addedAt: IsoDate;
|
|
26
|
+
/** This machine's checkout, or null when it has none. */
|
|
27
|
+
path: string | null;
|
|
28
|
+
exposed: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface SyncRoleBinding {
|
|
32
|
+
role: string;
|
|
33
|
+
agent: string;
|
|
34
|
+
provider: string;
|
|
35
|
+
model: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* `GET /v1/sync/state`.
|
|
40
|
+
*
|
|
41
|
+
* Projects come ordered by position; archived ones are left out.
|
|
42
|
+
*/
|
|
43
|
+
export interface SyncStateResponse {
|
|
44
|
+
profile: SyncProfile | null;
|
|
45
|
+
workspaces: SyncWorkspace[];
|
|
46
|
+
roles: SyncRoleBinding[];
|
|
47
|
+
/** Null when the projects disagree (then `conflicts` names `autoRoute`). */
|
|
48
|
+
autoRoute: boolean | null;
|
|
49
|
+
/** `role:<name>` or `autoRoute` for values the projects disagree on. */
|
|
50
|
+
conflicts: string[];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** One project as `POST /v1/sync/state` pushes it. */
|
|
54
|
+
export interface SyncPushWorkspace {
|
|
55
|
+
slug: string;
|
|
56
|
+
name: string;
|
|
57
|
+
color?: string | null;
|
|
58
|
+
laneworkStyle?: boolean;
|
|
59
|
+
baseBranch?: string | null;
|
|
60
|
+
addedAt: IsoDate;
|
|
61
|
+
/** This machine's checkout. Required. */
|
|
62
|
+
path: string;
|
|
63
|
+
exposed?: boolean;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* `POST /v1/sync/state`.
|
|
68
|
+
*
|
|
69
|
+
* Upserts up to 500 projects, the profile and the role bindings.
|
|
70
|
+
*/
|
|
71
|
+
export interface SyncStatePushRequest {
|
|
72
|
+
profile?: Partial<SyncProfile>;
|
|
73
|
+
workspaces?: SyncPushWorkspace[];
|
|
74
|
+
roles?: { role: string; agent: string; provider?: string; model?: string }[];
|
|
75
|
+
autoRoute?: boolean;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface SyncStatePushResponse {
|
|
79
|
+
stored: number;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* `POST /v1/sync/state/workspace`: create a project.
|
|
84
|
+
*
|
|
85
|
+
* 409 with {@link SyncWorkspaceSlugTakenError} on a taken slug.
|
|
86
|
+
*/
|
|
87
|
+
export interface SyncWorkspaceCreateRequest {
|
|
88
|
+
/** Lower-case, hyphenated, at most 64 characters. */
|
|
89
|
+
slug: string;
|
|
90
|
+
name: string;
|
|
91
|
+
color?: string | null;
|
|
92
|
+
baseBranch?: string | null;
|
|
93
|
+
laneworkStyle?: boolean;
|
|
94
|
+
autoRoute?: boolean;
|
|
95
|
+
/** This machine's checkout, recorded when sent. */
|
|
96
|
+
path?: string | null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface SyncWorkspaceCreateResponse {
|
|
100
|
+
workspace: {
|
|
101
|
+
id: string;
|
|
102
|
+
slug: string;
|
|
103
|
+
name: string;
|
|
104
|
+
color: string | null;
|
|
105
|
+
baseBranch: string | null;
|
|
106
|
+
path: string | null;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** 409 from `POST /v1/sync/state/workspace`: the project holding that slug. */
|
|
111
|
+
export interface SyncWorkspaceSlugTakenError {
|
|
112
|
+
error: string;
|
|
113
|
+
id: string;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** `PATCH /v1/sync/state/workspace/:id`; the id is a UUID, not a slug. */
|
|
117
|
+
export interface SyncWorkspacePatchRequest {
|
|
118
|
+
name?: string;
|
|
119
|
+
color?: string | null;
|
|
120
|
+
baseBranch?: string | null;
|
|
121
|
+
laneworkStyle?: boolean;
|
|
122
|
+
autoRoute?: boolean;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface SyncWorkspacePatchResponse {
|
|
126
|
+
workspace: {
|
|
127
|
+
id: string;
|
|
128
|
+
slug: string;
|
|
129
|
+
name: string;
|
|
130
|
+
color: string | null;
|
|
131
|
+
baseBranch: string | null;
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** `PUT /v1/sync/state/workspace-order`: distinct ids, all the caller's. */
|
|
136
|
+
export interface SyncWorkspaceOrderRequest {
|
|
137
|
+
ids: string[];
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface SyncWorkspaceOrderResponse {
|
|
141
|
+
ids: string[];
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** `DELETE /v1/sync/state/workspace/:id`. `deleted` is the slug, or null. */
|
|
145
|
+
export interface SyncWorkspaceDeleteResponse {
|
|
146
|
+
deleted: string | null;
|
|
147
|
+
id: string;
|
|
148
|
+
}
|