startup-builder 0.2.0 → 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/LICENSE +21 -0
- package/README.md +120 -0
- package/dist/chunk-ZR74VEI2.js +2322 -0
- package/dist/cli.js +338 -188
- package/dist/index.d.ts +660 -430
- package/dist/index.js +77 -17
- package/package.json +23 -16
- package/dist/chunk-NWM7TYW6.js +0 -1004
package/dist/index.d.ts
CHANGED
|
@@ -1,448 +1,678 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { AnyActorRef } from 'xstate';
|
|
1
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
3
2
|
|
|
4
|
-
interface
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
3
|
+
interface Res<T = any> {
|
|
4
|
+
status: number;
|
|
5
|
+
ok: boolean;
|
|
6
|
+
url: string;
|
|
7
|
+
json: T;
|
|
8
|
+
text: string;
|
|
9
|
+
headers: Record<string, string>;
|
|
10
|
+
}
|
|
11
|
+
interface ApiOpts {
|
|
12
|
+
base: string;
|
|
13
|
+
token?: string;
|
|
14
|
+
bind?: string;
|
|
15
|
+
fetch?: typeof fetch;
|
|
16
|
+
userAgent?: string;
|
|
17
|
+
}
|
|
18
|
+
declare class Api {
|
|
19
|
+
readonly base: string;
|
|
20
|
+
readonly token?: string;
|
|
21
|
+
readonly origin: string;
|
|
22
|
+
readonly reads: string[];
|
|
23
|
+
private f;
|
|
24
|
+
private ua;
|
|
25
|
+
constructor(o: ApiOpts);
|
|
26
|
+
url(pathOrUrl: string): string;
|
|
27
|
+
sameOrigin(url: string): boolean;
|
|
28
|
+
private headers;
|
|
29
|
+
get<T = any>(pathOrUrl: string, accept?: string): Promise<Res<T>>;
|
|
30
|
+
post<T = any>(pathOrUrl: string, body: unknown, o?: {
|
|
31
|
+
idempotencyKey?: string;
|
|
32
|
+
prefer?: string;
|
|
33
|
+
}): Promise<Res<T> & {
|
|
34
|
+
idempotencyKey: string;
|
|
35
|
+
}>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface Stored {
|
|
39
|
+
issuer: string;
|
|
40
|
+
client_id: string;
|
|
41
|
+
access_token: string;
|
|
42
|
+
refresh_token?: string;
|
|
43
|
+
expires_at?: number;
|
|
44
|
+
api: string;
|
|
45
|
+
}
|
|
46
|
+
interface AuthDeps {
|
|
47
|
+
api: string;
|
|
48
|
+
file: string;
|
|
49
|
+
issuer?: string;
|
|
50
|
+
fetch?: typeof fetch;
|
|
51
|
+
openBrowser?: (url: string) => boolean;
|
|
52
|
+
log?: (line: string) => void;
|
|
53
|
+
now?: () => number;
|
|
54
|
+
ports?: number[];
|
|
55
|
+
timeoutMs?: number;
|
|
56
|
+
clientId?: string;
|
|
57
|
+
}
|
|
58
|
+
type J$5 = Record<string, any>;
|
|
59
|
+
declare function pkce(verifier?: string): {
|
|
60
|
+
verifier: string;
|
|
61
|
+
challenge: string;
|
|
47
62
|
};
|
|
48
|
-
declare
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}, {
|
|
83
|
-
type: "hasResearchArtifacts";
|
|
84
|
-
params: unknown;
|
|
85
|
-
} | {
|
|
86
|
-
type: "hasCanvasArtifacts";
|
|
87
|
-
params: unknown;
|
|
88
|
-
} | {
|
|
89
|
-
type: "hasPositioningArtifacts";
|
|
90
|
-
params: unknown;
|
|
91
|
-
} | {
|
|
92
|
-
type: "hasMessagingArtifacts";
|
|
93
|
-
params: unknown;
|
|
94
|
-
} | {
|
|
95
|
-
type: "hasServicesComplete";
|
|
96
|
-
params: unknown;
|
|
97
|
-
} | {
|
|
98
|
-
type: "hasTeamArtifacts";
|
|
99
|
-
params: unknown;
|
|
100
|
-
} | {
|
|
101
|
-
type: "hasSiteComplete";
|
|
102
|
-
params: unknown;
|
|
103
|
-
} | {
|
|
104
|
-
type: "isSkipping";
|
|
105
|
-
params: unknown;
|
|
106
|
-
}, never, "complete" | "research" | "canvas" | "positioning" | "messaging" | "services" | "team" | "site" | "sales", string, {
|
|
107
|
-
startupId: string;
|
|
108
|
-
ideaId: string;
|
|
109
|
-
sprintId: string;
|
|
110
|
-
}, xstate.NonReducibleUnknown, xstate.EventObject, xstate.MetaObject, {
|
|
111
|
-
id: "startup-builder";
|
|
112
|
-
states: {
|
|
113
|
-
readonly research: {};
|
|
114
|
-
readonly canvas: {};
|
|
115
|
-
readonly positioning: {};
|
|
116
|
-
readonly messaging: {};
|
|
117
|
-
readonly services: {};
|
|
118
|
-
readonly team: {};
|
|
119
|
-
readonly site: {};
|
|
120
|
-
readonly sales: {};
|
|
121
|
-
readonly complete: {};
|
|
122
|
-
};
|
|
123
|
-
}>;
|
|
63
|
+
declare function unwrapState(s: string | null): string | null;
|
|
64
|
+
declare class Auth {
|
|
65
|
+
readonly api: string;
|
|
66
|
+
readonly file: string;
|
|
67
|
+
readonly issuer: string;
|
|
68
|
+
private f;
|
|
69
|
+
private open;
|
|
70
|
+
private log;
|
|
71
|
+
private now;
|
|
72
|
+
private ports;
|
|
73
|
+
private timeoutMs;
|
|
74
|
+
private fixedClient?;
|
|
75
|
+
constructor(d: AuthDeps);
|
|
76
|
+
stored(): Promise<Stored | undefined>;
|
|
77
|
+
private save;
|
|
78
|
+
clientId(): Promise<string>;
|
|
79
|
+
private token;
|
|
80
|
+
loopback(client: string): Promise<J$5 | undefined>;
|
|
81
|
+
device(client: string): Promise<J$5>;
|
|
82
|
+
current(): Promise<Stored | undefined>;
|
|
83
|
+
login(opts?: {
|
|
84
|
+
device?: boolean;
|
|
85
|
+
force?: boolean;
|
|
86
|
+
}): Promise<{
|
|
87
|
+
stored: Stored;
|
|
88
|
+
fresh: boolean;
|
|
89
|
+
}>;
|
|
90
|
+
logout(): Promise<void>;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
declare const DEFAULT_API = "https://api.sb";
|
|
94
|
+
type Env$1 = Record<string, string | undefined>;
|
|
95
|
+
declare function apiBase(flag?: string, env?: Env$1): string;
|
|
96
|
+
declare function tokenFile(env?: Env$1): string;
|
|
124
97
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
type:
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
reason
|
|
98
|
+
type J$4 = Record<string, any>;
|
|
99
|
+
interface ClosesOn {
|
|
100
|
+
event: string;
|
|
101
|
+
verb: string;
|
|
102
|
+
url: string;
|
|
103
|
+
target?: string;
|
|
104
|
+
via: 'api.sb' | 'preview' | 'derived';
|
|
105
|
+
permission?: {
|
|
106
|
+
needs: string;
|
|
107
|
+
held: boolean;
|
|
108
|
+
heldBy: Record<string, string>;
|
|
109
|
+
assignee?: string;
|
|
110
|
+
why?: string;
|
|
111
|
+
};
|
|
112
|
+
approvalNeeded?: boolean;
|
|
113
|
+
refused?: string;
|
|
114
|
+
blocked?: string;
|
|
115
|
+
says?: string;
|
|
116
|
+
}
|
|
117
|
+
interface Task {
|
|
118
|
+
$id: string;
|
|
119
|
+
type: string;
|
|
120
|
+
name: string;
|
|
121
|
+
status: string;
|
|
122
|
+
reason?: string;
|
|
123
|
+
startup: string;
|
|
124
|
+
worker: string;
|
|
125
|
+
role?: string;
|
|
126
|
+
verb?: string;
|
|
127
|
+
object?: string;
|
|
128
|
+
about?: string;
|
|
129
|
+
conversation?: string;
|
|
130
|
+
due?: string;
|
|
131
|
+
overdue?: number;
|
|
132
|
+
age?: number;
|
|
133
|
+
since?: string;
|
|
134
|
+
priority: number;
|
|
135
|
+
priorityText?: string;
|
|
136
|
+
priorityWhy: string[];
|
|
137
|
+
step: string;
|
|
138
|
+
stepTitle?: string;
|
|
139
|
+
closesOn?: ClosesOn;
|
|
140
|
+
}
|
|
141
|
+
interface RoleDesk {
|
|
142
|
+
name: string;
|
|
143
|
+
$id: string;
|
|
144
|
+
owns?: string;
|
|
145
|
+
summary: string[];
|
|
146
|
+
permissions: string[];
|
|
147
|
+
mandates?: string[];
|
|
148
|
+
limits: {
|
|
149
|
+
name: string;
|
|
150
|
+
limit?: number;
|
|
151
|
+
used?: number;
|
|
152
|
+
text?: string;
|
|
153
|
+
}[];
|
|
154
|
+
tools: string[];
|
|
155
|
+
}
|
|
156
|
+
interface StartupDesk {
|
|
157
|
+
domain: string;
|
|
158
|
+
$id: string;
|
|
159
|
+
real?: string;
|
|
160
|
+
worker?: {
|
|
161
|
+
name: string;
|
|
162
|
+
kind?: string;
|
|
163
|
+
model?: string;
|
|
164
|
+
$id: string;
|
|
165
|
+
skills: string[];
|
|
166
|
+
};
|
|
167
|
+
roles: RoleDesk[];
|
|
168
|
+
open: number;
|
|
169
|
+
glossary?: string;
|
|
170
|
+
glossaryUrl: string;
|
|
171
|
+
}
|
|
172
|
+
interface Cluster {
|
|
173
|
+
worker: string;
|
|
174
|
+
startup: string;
|
|
175
|
+
step: string;
|
|
176
|
+
stepTitle?: string;
|
|
177
|
+
tasks: Task[];
|
|
178
|
+
}
|
|
179
|
+
interface Worklist {
|
|
180
|
+
source: 'api.sb' | 'stub';
|
|
181
|
+
worker: {
|
|
182
|
+
handle: string;
|
|
183
|
+
name: string;
|
|
184
|
+
kind?: string;
|
|
185
|
+
model?: string;
|
|
186
|
+
$id?: string;
|
|
187
|
+
};
|
|
188
|
+
startups: StartupDesk[];
|
|
189
|
+
open: number;
|
|
190
|
+
limit: number;
|
|
191
|
+
limitMax?: number;
|
|
192
|
+
limitAsked?: number;
|
|
193
|
+
page?: number;
|
|
194
|
+
pages?: number;
|
|
195
|
+
more?: number;
|
|
196
|
+
moreText?: string;
|
|
197
|
+
next?: string;
|
|
198
|
+
links?: {
|
|
199
|
+
next?: string;
|
|
200
|
+
prev?: string;
|
|
201
|
+
first?: string;
|
|
202
|
+
last?: string;
|
|
203
|
+
self?: string;
|
|
204
|
+
};
|
|
205
|
+
batch: Cluster[];
|
|
206
|
+
tasks: Task[];
|
|
207
|
+
planned?: J$4[];
|
|
208
|
+
gaps: string[];
|
|
209
|
+
sources: string[];
|
|
210
|
+
priorityBands?: Record<string, string>;
|
|
211
|
+
rules?: string[];
|
|
212
|
+
asOf?: string;
|
|
213
|
+
datesRelativeTo?: 'asOf';
|
|
214
|
+
clock?: string;
|
|
215
|
+
generatedAt: string;
|
|
216
|
+
}
|
|
217
|
+
declare class WorklistError extends Error {
|
|
218
|
+
readonly status: number;
|
|
219
|
+
readonly body: unknown;
|
|
220
|
+
constructor(message: string, status: number, body: unknown);
|
|
221
|
+
}
|
|
222
|
+
interface WorklistOpts {
|
|
223
|
+
worker: string;
|
|
224
|
+
startups: string[];
|
|
225
|
+
limit?: number;
|
|
226
|
+
page?: number;
|
|
227
|
+
all?: boolean;
|
|
228
|
+
today?: string;
|
|
229
|
+
previews?: boolean;
|
|
230
|
+
stubOnly?: boolean;
|
|
231
|
+
}
|
|
232
|
+
declare function worklistPath(worker: string, startups: string[], limit: number, md?: boolean, page?: number): string;
|
|
233
|
+
declare const heldByNames: (h: Record<string, string> | string[] | undefined) => string[];
|
|
234
|
+
declare function fetchWorklistMarkdown(api: Api, o: {
|
|
235
|
+
worker: string;
|
|
236
|
+
startups: string[];
|
|
237
|
+
limit?: number;
|
|
238
|
+
page?: number;
|
|
239
|
+
}): Promise<string>;
|
|
240
|
+
declare function parseWorker(arg?: string): string | undefined;
|
|
241
|
+
declare function derivePriority(t: J$4, today: string): {
|
|
242
|
+
priority: number;
|
|
243
|
+
why: string[];
|
|
150
244
|
};
|
|
151
|
-
declare
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
245
|
+
declare function stepOf(t: J$4, domain: string): string;
|
|
246
|
+
declare function selectBatch(tasks: Task[], limit: number): Cluster[];
|
|
247
|
+
interface StartupGroup {
|
|
248
|
+
startup: string;
|
|
249
|
+
steps: {
|
|
250
|
+
step: string;
|
|
251
|
+
stepTitle?: string;
|
|
252
|
+
tasks: Task[];
|
|
253
|
+
}[];
|
|
254
|
+
}
|
|
255
|
+
declare function groupBatch(batch: Cluster[]): StartupGroup[];
|
|
256
|
+
declare function buildWorklist(api: Api, o: WorklistOpts): Promise<Worklist>;
|
|
257
|
+
|
|
258
|
+
type J$3 = Record<string, any>;
|
|
259
|
+
type Mode = 'try' | 'send' | 'do';
|
|
260
|
+
interface CloseOpts {
|
|
261
|
+
task: string;
|
|
262
|
+
mode?: Mode;
|
|
263
|
+
as?: string;
|
|
264
|
+
input?: J$3;
|
|
265
|
+
idempotencyKey?: string;
|
|
266
|
+
force?: boolean;
|
|
267
|
+
prepare?: (c: ClosesOn) => {
|
|
268
|
+
input?: J$3;
|
|
269
|
+
error?: string;
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
type Outcome = 'Done' | 'Pending' | 'Refused' | 'Replayed' | 'KeyReused' | 'Blocked' | 'NotSent' | 'Error';
|
|
273
|
+
interface CloseResult {
|
|
274
|
+
task: {
|
|
275
|
+
$id: string;
|
|
276
|
+
name: string;
|
|
277
|
+
type: string;
|
|
278
|
+
status?: string;
|
|
279
|
+
startup: string;
|
|
280
|
+
worker: string;
|
|
281
|
+
priorityText?: string;
|
|
282
|
+
stepTitle?: string;
|
|
283
|
+
};
|
|
284
|
+
closesOn: ClosesOn;
|
|
285
|
+
mode: Mode;
|
|
286
|
+
as: string;
|
|
287
|
+
request: {
|
|
288
|
+
method: 'POST';
|
|
289
|
+
url: string;
|
|
290
|
+
prefer: string;
|
|
291
|
+
idempotencyKey: string;
|
|
292
|
+
};
|
|
293
|
+
status: number;
|
|
294
|
+
outcome: Outcome;
|
|
295
|
+
action?: J$3;
|
|
296
|
+
replayed: boolean;
|
|
297
|
+
tried: boolean;
|
|
298
|
+
sink?: string;
|
|
299
|
+
blocked?: {
|
|
300
|
+
code?: string;
|
|
301
|
+
message?: string;
|
|
208
302
|
};
|
|
303
|
+
note?: string;
|
|
304
|
+
body: unknown;
|
|
305
|
+
}
|
|
306
|
+
interface ClosingTask {
|
|
307
|
+
$id: string;
|
|
308
|
+
name: string;
|
|
309
|
+
type: string;
|
|
310
|
+
status?: string;
|
|
311
|
+
startup: string;
|
|
312
|
+
worker: string;
|
|
313
|
+
priorityText?: string;
|
|
314
|
+
stepTitle?: string;
|
|
315
|
+
closesOn: ClosesOn;
|
|
316
|
+
}
|
|
317
|
+
declare function findClosesOn(api: Api, taskRef: string): Promise<{
|
|
318
|
+
task: ClosingTask;
|
|
319
|
+
thing: J$3;
|
|
320
|
+
worklist?: Worklist;
|
|
209
321
|
}>;
|
|
322
|
+
declare function closeTask(api: Api, o: CloseOpts): Promise<CloseResult>;
|
|
323
|
+
declare const closesOf: (a: J$3 | undefined) => string[];
|
|
210
324
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
type: 'DESIGN_APPROVED';
|
|
230
|
-
} | {
|
|
231
|
-
type: 'PUBLISHED';
|
|
232
|
-
} | {
|
|
233
|
-
type: 'ADVANCE';
|
|
234
|
-
} | {
|
|
235
|
-
type: 'SKIP';
|
|
236
|
-
reason: string;
|
|
237
|
-
};
|
|
238
|
-
declare const siteBuilderMachine: xstate.StateMachine<SiteBuilderContext, {
|
|
239
|
-
type: "ARTIFACT_CREATED";
|
|
240
|
-
collection: string;
|
|
241
|
-
count: number;
|
|
242
|
-
} | {
|
|
243
|
-
type: "CONTENT_COMPLETE";
|
|
244
|
-
pagesWithContent: number;
|
|
245
|
-
} | {
|
|
246
|
-
type: "DESIGN_APPROVED";
|
|
247
|
-
} | {
|
|
248
|
-
type: "PUBLISHED";
|
|
249
|
-
} | {
|
|
250
|
-
type: "ADVANCE";
|
|
251
|
-
} | {
|
|
252
|
-
type: "SKIP";
|
|
253
|
-
reason: string;
|
|
254
|
-
}, {}, never, {
|
|
255
|
-
type: "updateArtifactCount";
|
|
256
|
-
params: xstate.NonReducibleUnknown;
|
|
257
|
-
} | {
|
|
258
|
-
type: "setContentComplete";
|
|
259
|
-
params: xstate.NonReducibleUnknown;
|
|
260
|
-
} | {
|
|
261
|
-
type: "setDesignApproved";
|
|
262
|
-
params: xstate.NonReducibleUnknown;
|
|
263
|
-
} | {
|
|
264
|
-
type: "setPublished";
|
|
265
|
-
params: xstate.NonReducibleUnknown;
|
|
266
|
-
}, {
|
|
267
|
-
type: "needsMessaging";
|
|
268
|
-
params: unknown;
|
|
269
|
-
} | {
|
|
270
|
-
type: "needsServices";
|
|
271
|
-
params: unknown;
|
|
272
|
-
} | {
|
|
273
|
-
type: "hasPrerequisites";
|
|
274
|
-
params: unknown;
|
|
275
|
-
} | {
|
|
276
|
-
type: "hasPages";
|
|
277
|
-
params: unknown;
|
|
278
|
-
} | {
|
|
279
|
-
type: "hasContent";
|
|
280
|
-
params: unknown;
|
|
281
|
-
} | {
|
|
282
|
-
type: "hasDesign";
|
|
283
|
-
params: unknown;
|
|
284
|
-
} | {
|
|
285
|
-
type: "hasDomain";
|
|
286
|
-
params: unknown;
|
|
287
|
-
}, never, "complete" | "messaging" | "checkPrerequisites" | "servicesPrereq" | "structure" | "content" | "design" | "publish", string, {
|
|
288
|
-
startupId: string;
|
|
289
|
-
hasStoryBrand: boolean;
|
|
290
|
-
hasServices: boolean;
|
|
291
|
-
}, xstate.NonReducibleUnknown, xstate.EventObject, xstate.MetaObject, {
|
|
292
|
-
id: "site-builder";
|
|
293
|
-
states: {
|
|
294
|
-
readonly checkPrerequisites: {};
|
|
295
|
-
readonly messaging: {};
|
|
296
|
-
readonly servicesPrereq: {};
|
|
297
|
-
readonly structure: {};
|
|
298
|
-
readonly content: {};
|
|
299
|
-
readonly design: {};
|
|
300
|
-
readonly publish: {};
|
|
301
|
-
readonly complete: {};
|
|
325
|
+
declare function batchText(w: Worklist, o?: {
|
|
326
|
+
bin?: string;
|
|
327
|
+
}): string;
|
|
328
|
+
declare function closeText(r: CloseResult): string;
|
|
329
|
+
|
|
330
|
+
declare function renderPrompt(w: Worklist, o?: {
|
|
331
|
+
bin?: string;
|
|
332
|
+
}): string;
|
|
333
|
+
|
|
334
|
+
interface CloudSession {
|
|
335
|
+
startup: string;
|
|
336
|
+
via: 'api.sb' | 'claude-runner' | 'none';
|
|
337
|
+
url?: string;
|
|
338
|
+
status?: number;
|
|
339
|
+
session?: string;
|
|
340
|
+
request: {
|
|
341
|
+
url: string;
|
|
342
|
+
body: Record<string, unknown>;
|
|
302
343
|
};
|
|
303
|
-
|
|
344
|
+
note?: string;
|
|
345
|
+
}
|
|
346
|
+
declare function runCloud(api: Api, w: Worklist, o: {
|
|
347
|
+
runner: string;
|
|
348
|
+
runnerToken?: string;
|
|
349
|
+
dryRun?: boolean;
|
|
350
|
+
bin?: string;
|
|
351
|
+
model?: string;
|
|
352
|
+
fetch?: typeof fetch;
|
|
353
|
+
}): Promise<CloudSession[]>;
|
|
304
354
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
ready: boolean;
|
|
321
|
-
reason?: string;
|
|
322
|
-
};
|
|
323
|
-
blog: {
|
|
324
|
-
ready: boolean;
|
|
325
|
-
};
|
|
355
|
+
type J$2 = Record<string, any>;
|
|
356
|
+
declare function collectionOf(noun: string): string;
|
|
357
|
+
declare function verbPath(spec: string, target: string | undefined, startup: string | undefined): string;
|
|
358
|
+
interface VerbPreview {
|
|
359
|
+
url: string;
|
|
360
|
+
status: number;
|
|
361
|
+
name?: string;
|
|
362
|
+
does?: string;
|
|
363
|
+
event?: string;
|
|
364
|
+
mode?: string;
|
|
365
|
+
state?: string;
|
|
366
|
+
refused?: string;
|
|
367
|
+
permission?: {
|
|
368
|
+
needs: string;
|
|
369
|
+
heldBy: string[];
|
|
326
370
|
};
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
} | {
|
|
343
|
-
type: 'ADVANCE';
|
|
344
|
-
} | {
|
|
345
|
-
type: 'SKIP';
|
|
346
|
-
reason: string;
|
|
347
|
-
};
|
|
348
|
-
declare const salesBuilderMachine: xstate.StateMachine<SalesBuilderContext, {
|
|
349
|
-
type: "ARTIFACT_CREATED";
|
|
350
|
-
collection: string;
|
|
351
|
-
count: number;
|
|
352
|
-
} | {
|
|
353
|
-
type: "EXPERIMENT_CREATED";
|
|
354
|
-
experimentId: string;
|
|
355
|
-
} | {
|
|
356
|
-
type: "METRICS_COLLECTED";
|
|
357
|
-
} | {
|
|
358
|
-
type: "ADVANCE";
|
|
359
|
-
} | {
|
|
360
|
-
type: "SKIP";
|
|
361
|
-
reason: string;
|
|
362
|
-
}, {}, never, {
|
|
363
|
-
type: "updateArtifactCount";
|
|
364
|
-
params: xstate.NonReducibleUnknown;
|
|
365
|
-
} | {
|
|
366
|
-
type: "setExperiment";
|
|
367
|
-
params: xstate.NonReducibleUnknown;
|
|
368
|
-
} | {
|
|
369
|
-
type: "setMetrics";
|
|
370
|
-
params: xstate.NonReducibleUnknown;
|
|
371
|
-
}, {
|
|
372
|
-
type: "needsSite";
|
|
373
|
-
params: unknown;
|
|
374
|
-
} | {
|
|
375
|
-
type: "hasSite";
|
|
376
|
-
params: unknown;
|
|
377
|
-
} | {
|
|
378
|
-
type: "hasActiveChannel";
|
|
379
|
-
params: unknown;
|
|
380
|
-
} | {
|
|
381
|
-
type: "hasMetrics";
|
|
382
|
-
params: unknown;
|
|
383
|
-
}, never, "complete" | "checkPrerequisites" | "sitePrereq" | "launch" | "measure", string, {
|
|
384
|
-
startupId: string;
|
|
385
|
-
hasSite: boolean;
|
|
386
|
-
hasDomain: boolean;
|
|
387
|
-
}, xstate.NonReducibleUnknown, xstate.EventObject, xstate.MetaObject, {
|
|
388
|
-
id: "sales-builder";
|
|
389
|
-
states: {
|
|
390
|
-
readonly checkPrerequisites: {};
|
|
391
|
-
readonly sitePrereq: {};
|
|
392
|
-
readonly launch: {};
|
|
393
|
-
readonly measure: {};
|
|
394
|
-
readonly complete: {};
|
|
371
|
+
approvalNeeded?: boolean;
|
|
372
|
+
inputs: string[];
|
|
373
|
+
error?: string;
|
|
374
|
+
}
|
|
375
|
+
interface DoResult {
|
|
376
|
+
preview: VerbPreview;
|
|
377
|
+
invoked: boolean;
|
|
378
|
+
post?: {
|
|
379
|
+
status: number;
|
|
380
|
+
idempotencyKey: string;
|
|
381
|
+
body: unknown;
|
|
382
|
+
action?: string;
|
|
383
|
+
actionStatus?: string;
|
|
384
|
+
says?: string;
|
|
385
|
+
note?: string;
|
|
395
386
|
};
|
|
396
|
-
}
|
|
387
|
+
}
|
|
388
|
+
declare function doVerb(api: Api, o: {
|
|
389
|
+
spec: string;
|
|
390
|
+
target?: string;
|
|
391
|
+
startup?: string;
|
|
392
|
+
input?: J$2;
|
|
393
|
+
mode?: string;
|
|
394
|
+
as?: string;
|
|
395
|
+
previewOnly?: boolean;
|
|
396
|
+
force?: boolean;
|
|
397
|
+
idempotencyKey?: string;
|
|
398
|
+
}): Promise<DoResult>;
|
|
399
|
+
|
|
400
|
+
type Env = Record<string, string | undefined>;
|
|
401
|
+
interface Lease {
|
|
402
|
+
batch: string;
|
|
403
|
+
worker: string;
|
|
404
|
+
startup: string;
|
|
405
|
+
step: string;
|
|
406
|
+
priority?: number;
|
|
407
|
+
tasks: string[];
|
|
408
|
+
prompt: string;
|
|
409
|
+
until: string;
|
|
410
|
+
token: string;
|
|
411
|
+
session: string;
|
|
412
|
+
claimedAt: string;
|
|
413
|
+
leaseSeconds: number;
|
|
414
|
+
api: string;
|
|
415
|
+
closed: string[];
|
|
416
|
+
held?: 'dispatcher';
|
|
417
|
+
}
|
|
418
|
+
declare function leasesDir(env?: Env): string;
|
|
419
|
+
declare class Leases {
|
|
420
|
+
readonly dir: string;
|
|
421
|
+
private now;
|
|
422
|
+
private env;
|
|
423
|
+
private memory?;
|
|
424
|
+
constructor(dir: string, now?: () => number, env?: Env);
|
|
425
|
+
private ensure;
|
|
426
|
+
private write;
|
|
427
|
+
file(batch: string): string;
|
|
428
|
+
save(l: Lease): Lease;
|
|
429
|
+
adopt(l: Lease): Lease;
|
|
430
|
+
get pin(): string | undefined;
|
|
431
|
+
needsAdoption(): boolean;
|
|
432
|
+
all(): Lease[];
|
|
433
|
+
live(l: Lease): boolean;
|
|
434
|
+
get(ref: string): Lease | undefined;
|
|
435
|
+
current(): Lease | undefined;
|
|
436
|
+
holding(task: string): Lease | undefined;
|
|
437
|
+
update(batch: string, patch: (l: Lease) => void): Lease | undefined;
|
|
438
|
+
markClosed(batch: string, task: string): Lease | undefined;
|
|
439
|
+
remove(batch: string): void;
|
|
440
|
+
remember(kind: 'queue' | 'worklist', ids: string[]): void;
|
|
441
|
+
recall(kind: 'queue' | 'worklist'): string[];
|
|
442
|
+
}
|
|
397
443
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
444
|
+
type J$1 = Record<string, any>;
|
|
445
|
+
interface Out<T = unknown> {
|
|
446
|
+
text: string;
|
|
447
|
+
data: T;
|
|
448
|
+
exit: number;
|
|
449
|
+
}
|
|
450
|
+
interface Batch {
|
|
451
|
+
$id: string;
|
|
452
|
+
worker: string;
|
|
453
|
+
startup: string;
|
|
454
|
+
startups?: string[];
|
|
455
|
+
step: string;
|
|
456
|
+
stepTitle?: string;
|
|
457
|
+
priority: number;
|
|
458
|
+
tasks: string[];
|
|
459
|
+
prompt: string;
|
|
460
|
+
claim: string;
|
|
461
|
+
[k: string]: unknown;
|
|
462
|
+
}
|
|
463
|
+
interface Cred {
|
|
464
|
+
token: string;
|
|
465
|
+
api: string;
|
|
466
|
+
}
|
|
467
|
+
interface SessionDeps {
|
|
468
|
+
base: string;
|
|
469
|
+
leases: Leases;
|
|
470
|
+
token: () => Promise<string | Cred | undefined>;
|
|
471
|
+
login?: () => Promise<string | Cred | undefined>;
|
|
472
|
+
fetch?: typeof fetch;
|
|
473
|
+
userAgent?: string;
|
|
474
|
+
now?: () => number;
|
|
475
|
+
session?: string;
|
|
476
|
+
leaseSeconds?: number;
|
|
477
|
+
env?: Record<string, string | undefined>;
|
|
478
|
+
}
|
|
479
|
+
declare class Session {
|
|
480
|
+
readonly base: string;
|
|
481
|
+
readonly leases: Leases;
|
|
482
|
+
private d;
|
|
483
|
+
constructor(d: SessionDeps);
|
|
484
|
+
api(c?: string | Cred): Api;
|
|
485
|
+
private cred;
|
|
486
|
+
private leaseCred;
|
|
487
|
+
private now;
|
|
488
|
+
private get env();
|
|
489
|
+
private adopting?;
|
|
490
|
+
ensureLease(): Promise<Out<null> | undefined>;
|
|
491
|
+
private adopt;
|
|
492
|
+
private ended;
|
|
493
|
+
short(u: string | undefined): string;
|
|
494
|
+
when(iso: string | undefined): string;
|
|
495
|
+
private baseToken;
|
|
496
|
+
private fail;
|
|
497
|
+
private none;
|
|
498
|
+
resolve(ref: string, o?: {
|
|
499
|
+
kind?: 'task' | 'batch';
|
|
500
|
+
}): string;
|
|
501
|
+
private label;
|
|
502
|
+
private readToken;
|
|
503
|
+
batchLine(b: Batch, i: number, withWorker: boolean): string;
|
|
504
|
+
listQueue(o?: {
|
|
505
|
+
worker?: string;
|
|
506
|
+
limit?: number;
|
|
507
|
+
}): Promise<{
|
|
508
|
+
r: Res;
|
|
509
|
+
batches: Batch[];
|
|
510
|
+
}>;
|
|
511
|
+
queue(o?: {
|
|
512
|
+
worker?: string;
|
|
513
|
+
limit?: number;
|
|
514
|
+
}): Promise<Out<{
|
|
515
|
+
batches: Batch[];
|
|
516
|
+
}>>;
|
|
517
|
+
private batchOf;
|
|
518
|
+
private claimOne;
|
|
519
|
+
claim(o?: {
|
|
520
|
+
ref?: string;
|
|
521
|
+
worker?: string;
|
|
522
|
+
leaseSeconds?: number;
|
|
523
|
+
skip?: Set<string>;
|
|
524
|
+
}): Promise<Out<{
|
|
525
|
+
lease?: Omit<Lease, 'token'>;
|
|
526
|
+
taken: string[];
|
|
527
|
+
}>>;
|
|
528
|
+
private leaseOf;
|
|
529
|
+
private leasePost;
|
|
530
|
+
renew(o?: {
|
|
531
|
+
batch?: string | Lease;
|
|
532
|
+
leaseSeconds?: number;
|
|
533
|
+
notAfter?: number;
|
|
534
|
+
}): Promise<Out<{
|
|
535
|
+
until?: string;
|
|
536
|
+
lost?: boolean;
|
|
537
|
+
dispatcher?: boolean;
|
|
538
|
+
capped?: boolean;
|
|
539
|
+
}>>;
|
|
540
|
+
release(o?: {
|
|
541
|
+
batch?: string | Lease;
|
|
542
|
+
}): Promise<Out<{
|
|
543
|
+
closed: number;
|
|
544
|
+
returned: number;
|
|
545
|
+
already?: boolean;
|
|
546
|
+
dispatcher?: boolean;
|
|
547
|
+
}>>;
|
|
548
|
+
batchPrompt(l: Lease): Promise<Out<{
|
|
549
|
+
url: string;
|
|
550
|
+
}>>;
|
|
551
|
+
prompt(o?: {
|
|
552
|
+
name?: string;
|
|
553
|
+
set?: string;
|
|
554
|
+
}): Promise<Out<J$1>>;
|
|
555
|
+
private isLeaseToken;
|
|
556
|
+
promptSet(o: {
|
|
557
|
+
name: string;
|
|
558
|
+
text: string;
|
|
559
|
+
idempotencyKey?: string;
|
|
560
|
+
}): Promise<Out<J$1>>;
|
|
561
|
+
show(o: {
|
|
562
|
+
ref: string;
|
|
563
|
+
md?: boolean;
|
|
564
|
+
}): Promise<Out<J$1>>;
|
|
565
|
+
thingText(t: J$1): string;
|
|
566
|
+
value(v: unknown, max?: number): string;
|
|
567
|
+
diffText(a: J$1 | undefined): string;
|
|
568
|
+
closeLine(label: string, r: CloseResult, left?: number): string;
|
|
569
|
+
close(o: {
|
|
570
|
+
ref: string;
|
|
571
|
+
body?: unknown;
|
|
572
|
+
mode?: Mode;
|
|
573
|
+
as?: string;
|
|
574
|
+
force?: boolean;
|
|
575
|
+
idempotencyKey?: string;
|
|
576
|
+
}): Promise<Out<CloseResult | null>>;
|
|
577
|
+
closedOf(l: Lease): Promise<string[]>;
|
|
578
|
+
worklistText(w: Worklist): string;
|
|
579
|
+
taskLine(t: Task, n: number): string;
|
|
580
|
+
worklist(o: {
|
|
581
|
+
worker: string;
|
|
582
|
+
startups?: string[];
|
|
583
|
+
limit?: number;
|
|
584
|
+
page?: number;
|
|
585
|
+
}): Promise<Out<Worklist>>;
|
|
586
|
+
versions(o: {
|
|
587
|
+
ref: string;
|
|
588
|
+
limit?: number;
|
|
589
|
+
}): Promise<Out<J$1>>;
|
|
590
|
+
revert(o: {
|
|
591
|
+
ref: string;
|
|
592
|
+
to: string;
|
|
593
|
+
mode?: Mode;
|
|
594
|
+
idempotencyKey?: string;
|
|
595
|
+
}): Promise<Out<J$1>>;
|
|
596
|
+
changes(o?: {
|
|
597
|
+
worker?: string;
|
|
598
|
+
startup?: string;
|
|
599
|
+
limit?: number;
|
|
600
|
+
}): Promise<Out<J$1>>;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
type J = Record<string, any>;
|
|
604
|
+
declare const VERDICTS: readonly ["confirmed", "corrected", "unsure"];
|
|
605
|
+
declare function checkBody(event: string, body: unknown): {
|
|
606
|
+
body?: J;
|
|
607
|
+
errors: string[];
|
|
608
|
+
};
|
|
416
609
|
|
|
417
|
-
interface
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
610
|
+
interface AgentRun {
|
|
611
|
+
prompt: string;
|
|
612
|
+
env: Record<string, string>;
|
|
613
|
+
cwd: string;
|
|
614
|
+
batch: string;
|
|
615
|
+
log: {
|
|
616
|
+
out: (chunk: string) => void;
|
|
617
|
+
err: (chunk: string) => void;
|
|
618
|
+
};
|
|
619
|
+
signal: AbortSignal;
|
|
620
|
+
done: () => Promise<boolean>;
|
|
421
621
|
}
|
|
422
|
-
interface
|
|
622
|
+
interface AgentResult {
|
|
623
|
+
exitCode: number | null;
|
|
624
|
+
note?: string;
|
|
625
|
+
}
|
|
626
|
+
type AgentRunner = (r: AgentRun) => Promise<AgentResult>;
|
|
627
|
+
interface WorkOpts {
|
|
628
|
+
agent: AgentRunner;
|
|
629
|
+
agentName: string;
|
|
630
|
+
worker?: string;
|
|
631
|
+
maxBatches?: number;
|
|
632
|
+
wait?: boolean;
|
|
633
|
+
pollMs?: number;
|
|
634
|
+
renewMs?: number;
|
|
635
|
+
watchMs?: number;
|
|
636
|
+
logDir: string;
|
|
637
|
+
line: (s: string) => void;
|
|
638
|
+
signal: AbortSignal;
|
|
639
|
+
env?: Record<string, string | undefined>;
|
|
640
|
+
selfCli?: string;
|
|
641
|
+
tmpRoot?: string;
|
|
642
|
+
now?: () => number;
|
|
643
|
+
wallMinutes?: number;
|
|
644
|
+
}
|
|
645
|
+
interface WorkSummary {
|
|
646
|
+
batches: number;
|
|
647
|
+
tasks: number;
|
|
648
|
+
closed: number;
|
|
649
|
+
errors: number;
|
|
650
|
+
ms: number;
|
|
651
|
+
stopped: 'empty' | 'max' | 'signal' | 'error';
|
|
652
|
+
}
|
|
653
|
+
declare function agentEnv(base: Record<string, string | undefined>, lease: Lease, api: string, binDir?: string, configHome?: string, workdir?: string): Record<string, string>;
|
|
654
|
+
declare function agentPrompt(md: string, n: number): string;
|
|
655
|
+
declare function work(s: Session, o: WorkOpts): Promise<WorkSummary>;
|
|
656
|
+
|
|
657
|
+
declare function printRunner(o?: {
|
|
658
|
+
out?: (s: string) => void;
|
|
659
|
+
pollMs?: number;
|
|
660
|
+
}): AgentRunner;
|
|
661
|
+
|
|
662
|
+
type A = Record<string, any>;
|
|
663
|
+
interface ToolDef {
|
|
423
664
|
name: string;
|
|
424
|
-
collection: string;
|
|
425
|
-
operation: string;
|
|
426
|
-
command: string;
|
|
427
|
-
schema: Record<string, unknown>;
|
|
428
665
|
description: string;
|
|
666
|
+
inputSchema: {
|
|
667
|
+
type: 'object';
|
|
668
|
+
properties: Record<string, unknown>;
|
|
669
|
+
required?: string[];
|
|
670
|
+
};
|
|
671
|
+
run: (s: Session, a: A) => Promise<Out>;
|
|
429
672
|
}
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
declare function reconcileState(startupId: string, apiBaseUrl: string, apiKey?: string): Promise<{
|
|
435
|
-
currentState: string;
|
|
436
|
-
counts: ArtifactCounts;
|
|
437
|
-
}>;
|
|
438
|
-
/**
|
|
439
|
-
* Return progress entries for every state in the machine.
|
|
440
|
-
*/
|
|
441
|
-
declare function getProgress(currentState: string): ProgressEntry[];
|
|
442
|
-
/**
|
|
443
|
-
* Extract the `meta.commands` from the machine definition for the given state
|
|
444
|
-
* and fill in the startup ID to produce ready-to-run CLI commands.
|
|
445
|
-
*/
|
|
446
|
-
declare function getNextCommands(currentState: string, startupId: string): NextCommand[];
|
|
673
|
+
declare const TOOLS: ToolDef[];
|
|
674
|
+
declare function mcpServer(session: Session, version: string, o?: {
|
|
675
|
+
owner?: boolean;
|
|
676
|
+
}): Server;
|
|
447
677
|
|
|
448
|
-
export { type
|
|
678
|
+
export { type AgentRun, type AgentRunner, Api, Auth, type Batch, type CloseResult, type ClosesOn, type ClosingTask, type Cluster, DEFAULT_API, type Lease, Leases, type Mode, type Out, type Res, Session, type SessionDeps, type Stored, TOOLS, type Task, VERDICTS, type WorkOpts, type WorkSummary, type Worklist, WorklistError, agentEnv, agentPrompt, apiBase, batchText, buildWorklist, checkBody, closeTask, closeText, closesOf, collectionOf, derivePriority, doVerb, fetchWorklistMarkdown, findClosesOn, groupBatch, heldByNames, leasesDir, mcpServer, parseWorker, pkce, printRunner, renderPrompt, runCloud, selectBatch, stepOf, tokenFile, unwrapState, verbPath, work, worklistPath };
|