unfazed 0.6.1 → 0.8.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/CHANGELOG.md +88 -0
- package/README.md +201 -52
- package/REFERENCE.md +284 -0
- package/dist/cli/login.d.ts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +1 -1
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +64 -0
- package/dist/errors.js +95 -0
- package/dist/errors.js.map +1 -1
- package/dist/generated/gql.d.ts +78 -2
- package/dist/generated/gql.js +21 -2
- package/dist/generated/gql.js.map +1 -1
- package/dist/generated/graphql.d.ts +505 -6
- package/dist/generated/graphql.js +439 -2
- package/dist/generated/graphql.js.map +1 -1
- package/dist/index.d.ts +13 -4
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/dist/operations.d.ts +116 -5
- package/dist/operations.js +379 -7
- package/dist/operations.js.map +1 -1
- package/dist/reference.d.ts +18 -0
- package/dist/reference.generated.d.ts +2 -0
- package/dist/reference.generated.js +5 -0
- package/dist/reference.generated.js.map +1 -0
- package/dist/reference.js +38 -0
- package/dist/reference.js.map +1 -0
- package/dist/unfazed.d.ts +544 -67
- package/dist/unfazed.js +687 -63
- package/dist/unfazed.js.map +1 -1
- package/dist/wait.d.ts +7 -0
- package/dist/wait.js.map +1 -1
- package/dist/workflow/nitro.js +5 -3
- package/dist/workflow/nitro.js.map +1 -1
- package/package.json +8 -4
- package/schema/SOURCE.json +4 -4
- package/schema/schema.graphqls +1628 -30
package/dist/operations.js
CHANGED
|
@@ -100,19 +100,66 @@ export const ListWorkspacesDocument = graphql(`
|
|
|
100
100
|
/**
|
|
101
101
|
* Deleting a workspace, with the deployment cascade made explicit.
|
|
102
102
|
*
|
|
103
|
-
* `withDeployments`
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
103
|
+
* Without `withDeployments` the server REFUSES while the workspace has any
|
|
104
|
+
* deployment record at all — FAILED ones included — with `workspace %q still
|
|
105
|
+
* has deployments; delete them first`. With it, the delete takes down every
|
|
106
|
+
* app the workspace serves, so `confirmAliases` must name exactly those apps
|
|
107
|
+
* (`Workspace.liveApps`); a missing or extra alias refuses the delete, deletes
|
|
108
|
+
* nothing, and the error lists the live apps. The SDK always sends the flag
|
|
109
|
+
* and never fills in the aliases: the caller names what goes.
|
|
108
110
|
*/
|
|
109
111
|
export const DeleteWorkspaceDocument = graphql(`
|
|
110
|
-
mutation SdkDeleteWorkspace(
|
|
111
|
-
|
|
112
|
+
mutation SdkDeleteWorkspace(
|
|
113
|
+
$workspaceID: ID!
|
|
114
|
+
$withDeployments: Boolean
|
|
115
|
+
$confirmAliases: [String!]
|
|
116
|
+
) {
|
|
117
|
+
deleteWorkspace(
|
|
118
|
+
input: {
|
|
119
|
+
workspaceID: $workspaceID
|
|
120
|
+
withDeployments: $withDeployments
|
|
121
|
+
confirmAliases: $confirmAliases
|
|
122
|
+
}
|
|
123
|
+
) {
|
|
112
124
|
ok
|
|
113
125
|
}
|
|
114
126
|
}
|
|
115
127
|
`);
|
|
128
|
+
/**
|
|
129
|
+
* The apps a workspace serves right now: what `deleteWorkspace` with
|
|
130
|
+
* `withDeployments` takes offline, and exactly the list its `confirmAliases`
|
|
131
|
+
* must name. `workspace` is null when the id is absent or not the caller's.
|
|
132
|
+
*/
|
|
133
|
+
export const WorkspaceLiveAppsDocument = graphql(`
|
|
134
|
+
query SdkWorkspaceLiveApps($id: ID!) {
|
|
135
|
+
workspace(id: $id) {
|
|
136
|
+
id
|
|
137
|
+
liveApps {
|
|
138
|
+
alias
|
|
139
|
+
deploymentID
|
|
140
|
+
domains
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
`);
|
|
145
|
+
/**
|
|
146
|
+
* Deleting ONE app of a workspace: every deployment of the alias there, its
|
|
147
|
+
* App State, app-scoped env and secrets, and integration bindings. The
|
|
148
|
+
* workspace, its files and its other apps keep serving.
|
|
149
|
+
*/
|
|
150
|
+
export const DeleteAppDocument = graphql(`
|
|
151
|
+
mutation SdkDeleteApp($workspaceID: ID!, $alias: String!) {
|
|
152
|
+
deleteApp(input: { workspaceID: $workspaceID, alias: $alias }) {
|
|
153
|
+
ok
|
|
154
|
+
alias
|
|
155
|
+
deployments
|
|
156
|
+
domains
|
|
157
|
+
envEntries
|
|
158
|
+
skippedOnSync
|
|
159
|
+
otherApps
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
`);
|
|
116
163
|
export const WriteTextFileDocument = graphql(`
|
|
117
164
|
mutation SdkWriteTextFile($workspaceID: ID!, $path: String!, $text: String!) {
|
|
118
165
|
writeWorkspaceTextFile(input: { workspaceID: $workspaceID, path: $path, text: $text }) {
|
|
@@ -141,6 +188,307 @@ export const WriteBase64FileDocument = graphql(`
|
|
|
141
188
|
}
|
|
142
189
|
}
|
|
143
190
|
`);
|
|
191
|
+
/** The commit a file write made on an app with platform git (MCP's `commit`). */
|
|
192
|
+
export const FileCommitFieldsFragment = graphql(`
|
|
193
|
+
fragment FileCommitFields on FileCommit {
|
|
194
|
+
sha
|
|
195
|
+
branch
|
|
196
|
+
message
|
|
197
|
+
committed
|
|
198
|
+
waiting
|
|
199
|
+
waitingCount
|
|
200
|
+
deploys
|
|
201
|
+
conflicts
|
|
202
|
+
writeSHA
|
|
203
|
+
paused
|
|
204
|
+
}
|
|
205
|
+
`);
|
|
206
|
+
/**
|
|
207
|
+
* The batch write (MCP `write_workspace_files`): every file in ONE request
|
|
208
|
+
* and, on an app with platform git, ONE commit for the whole call.
|
|
209
|
+
*/
|
|
210
|
+
export const WriteFilesDocument = graphql(`
|
|
211
|
+
mutation SdkWriteFiles(
|
|
212
|
+
$workspaceID: ID!
|
|
213
|
+
$files: [WorkspaceFileWriteInput!]!
|
|
214
|
+
$commitMessage: String
|
|
215
|
+
) {
|
|
216
|
+
writeWorkspaceFiles(
|
|
217
|
+
input: { workspaceID: $workspaceID, files: $files, commitMessage: $commitMessage }
|
|
218
|
+
) {
|
|
219
|
+
workspaceID
|
|
220
|
+
written
|
|
221
|
+
failed
|
|
222
|
+
totalBytes
|
|
223
|
+
files {
|
|
224
|
+
path
|
|
225
|
+
ok
|
|
226
|
+
error
|
|
227
|
+
file {
|
|
228
|
+
path
|
|
229
|
+
sizeBytes
|
|
230
|
+
size
|
|
231
|
+
sha256
|
|
232
|
+
updatedAt
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
commit {
|
|
236
|
+
...FileCommitFields
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
`);
|
|
241
|
+
/** One page of an app's platform git history, newest first (MCP `list_commits`). */
|
|
242
|
+
export const AppCommitsDocument = graphql(`
|
|
243
|
+
query SdkAppCommits($workspaceID: ID!, $limit: Int, $before: String) {
|
|
244
|
+
appCommits(workspaceID: $workspaceID, limit: $limit, before: $before) {
|
|
245
|
+
branch
|
|
246
|
+
head
|
|
247
|
+
nextBefore
|
|
248
|
+
autoDeploy
|
|
249
|
+
waitingCommits
|
|
250
|
+
waitingSince
|
|
251
|
+
commits {
|
|
252
|
+
sha
|
|
253
|
+
message
|
|
254
|
+
authorName
|
|
255
|
+
authorEmail
|
|
256
|
+
authoredAt
|
|
257
|
+
filesChanged
|
|
258
|
+
deployedTo
|
|
259
|
+
}
|
|
260
|
+
deployed {
|
|
261
|
+
alias
|
|
262
|
+
sha
|
|
263
|
+
deploymentID
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
`);
|
|
268
|
+
/** Only what `waitForCommit` reads: whether writes still wait, and the head. */
|
|
269
|
+
export const AppCommitsWaitingDocument = graphql(`
|
|
270
|
+
query SdkAppCommitsWaiting($workspaceID: ID!) {
|
|
271
|
+
appCommits(workspaceID: $workspaceID, limit: 1) {
|
|
272
|
+
branch
|
|
273
|
+
head
|
|
274
|
+
waitingCommits
|
|
275
|
+
waitingSince
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
`);
|
|
279
|
+
/**
|
|
280
|
+
* The app's git link as the last import left it: what `restoreVersion` waits
|
|
281
|
+
* on, since the deploy a restore queues is an import of the branch head.
|
|
282
|
+
*/
|
|
283
|
+
export const WorkspaceGitSourceDocument = graphql(`
|
|
284
|
+
query SdkWorkspaceGitSource($id: ID!) {
|
|
285
|
+
workspace(id: $id) {
|
|
286
|
+
id
|
|
287
|
+
gitSource {
|
|
288
|
+
branch
|
|
289
|
+
autoDeploy
|
|
290
|
+
deployAlias
|
|
291
|
+
lastImportedCommit
|
|
292
|
+
lastImportedAt
|
|
293
|
+
lastImportStatus
|
|
294
|
+
lastImportError
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
`);
|
|
299
|
+
/** One commit with its diff (MCP `get_commit`). */
|
|
300
|
+
export const AppCommitDocument = graphql(`
|
|
301
|
+
query SdkAppCommit($workspaceID: ID!, $sha: String!) {
|
|
302
|
+
appCommit(workspaceID: $workspaceID, sha: $sha) {
|
|
303
|
+
commit {
|
|
304
|
+
sha
|
|
305
|
+
message
|
|
306
|
+
authorName
|
|
307
|
+
authorEmail
|
|
308
|
+
authoredAt
|
|
309
|
+
filesChanged
|
|
310
|
+
deployedTo
|
|
311
|
+
}
|
|
312
|
+
files {
|
|
313
|
+
path
|
|
314
|
+
status
|
|
315
|
+
}
|
|
316
|
+
patch
|
|
317
|
+
truncated
|
|
318
|
+
additions
|
|
319
|
+
deletions
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
`);
|
|
323
|
+
/** Give the app back an earlier commit's files (MCP `restore_version`). */
|
|
324
|
+
export const RestoreVersionDocument = graphql(`
|
|
325
|
+
mutation SdkRestoreVersion(
|
|
326
|
+
$workspaceID: ID!
|
|
327
|
+
$sha: String!
|
|
328
|
+
$expectedHead: String
|
|
329
|
+
$message: String
|
|
330
|
+
) {
|
|
331
|
+
restoreAppVersion(
|
|
332
|
+
input: { workspaceID: $workspaceID, sha: $sha, expectedHead: $expectedHead, message: $message }
|
|
333
|
+
) {
|
|
334
|
+
sha
|
|
335
|
+
committed
|
|
336
|
+
deploys
|
|
337
|
+
message
|
|
338
|
+
branch
|
|
339
|
+
deployAlias
|
|
340
|
+
restoredFrom
|
|
341
|
+
parent
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
`);
|
|
345
|
+
/** A service app's error group, as MCP `list_errors` shows it. */
|
|
346
|
+
export const AppErrorGroupFieldsFragment = graphql(`
|
|
347
|
+
fragment AppErrorGroupFields on AppErrorGroup {
|
|
348
|
+
id
|
|
349
|
+
title
|
|
350
|
+
type
|
|
351
|
+
culprit
|
|
352
|
+
level
|
|
353
|
+
status
|
|
354
|
+
count
|
|
355
|
+
storedEvents
|
|
356
|
+
firstSeen
|
|
357
|
+
lastSeen
|
|
358
|
+
firstDeploymentID
|
|
359
|
+
firstGitCommit
|
|
360
|
+
lastDeploymentID
|
|
361
|
+
lastGitCommit
|
|
362
|
+
resolvedInDeploymentID
|
|
363
|
+
resolvedAt
|
|
364
|
+
mutedAt
|
|
365
|
+
regressedAt
|
|
366
|
+
}
|
|
367
|
+
`);
|
|
368
|
+
export const AppErrorsDocument = graphql(`
|
|
369
|
+
query SdkAppErrors(
|
|
370
|
+
$workspaceID: ID!
|
|
371
|
+
$alias: String!
|
|
372
|
+
$status: String
|
|
373
|
+
$limit: Int
|
|
374
|
+
$cursor: String
|
|
375
|
+
) {
|
|
376
|
+
appErrors(
|
|
377
|
+
workspaceID: $workspaceID
|
|
378
|
+
alias: $alias
|
|
379
|
+
status: $status
|
|
380
|
+
limit: $limit
|
|
381
|
+
cursor: $cursor
|
|
382
|
+
) {
|
|
383
|
+
groups {
|
|
384
|
+
...AppErrorGroupFields
|
|
385
|
+
}
|
|
386
|
+
nextCursor
|
|
387
|
+
note
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
`);
|
|
391
|
+
export const AppErrorGroupDocument = graphql(`
|
|
392
|
+
query SdkAppErrorGroup($workspaceID: ID!, $alias: String!, $groupID: ID!) {
|
|
393
|
+
appErrorGroup(workspaceID: $workspaceID, alias: $alias, groupID: $groupID) {
|
|
394
|
+
group {
|
|
395
|
+
...AppErrorGroupFields
|
|
396
|
+
}
|
|
397
|
+
latestEvent
|
|
398
|
+
firstEvent {
|
|
399
|
+
eventID
|
|
400
|
+
at
|
|
401
|
+
deploymentID
|
|
402
|
+
level
|
|
403
|
+
}
|
|
404
|
+
recentEvents {
|
|
405
|
+
eventID
|
|
406
|
+
at
|
|
407
|
+
deploymentID
|
|
408
|
+
level
|
|
409
|
+
}
|
|
410
|
+
deployments {
|
|
411
|
+
deploymentID
|
|
412
|
+
gitCommit
|
|
413
|
+
current
|
|
414
|
+
count
|
|
415
|
+
firstSeen
|
|
416
|
+
lastSeen
|
|
417
|
+
}
|
|
418
|
+
fatal
|
|
419
|
+
vmID
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
`);
|
|
423
|
+
export const ResolveErrorGroupDocument = graphql(`
|
|
424
|
+
mutation SdkResolveErrorGroup($input: AppErrorGroupInput!) {
|
|
425
|
+
resolveAppErrorGroup(input: $input) {
|
|
426
|
+
...AppErrorGroupFields
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
`);
|
|
430
|
+
export const MuteErrorGroupDocument = graphql(`
|
|
431
|
+
mutation SdkMuteErrorGroup($input: AppErrorGroupInput!) {
|
|
432
|
+
muteAppErrorGroup(input: $input) {
|
|
433
|
+
...AppErrorGroupFields
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
`);
|
|
437
|
+
export const ReopenErrorGroupDocument = graphql(`
|
|
438
|
+
mutation SdkReopenErrorGroup($input: AppErrorGroupInput!) {
|
|
439
|
+
reopenAppErrorGroup(input: $input) {
|
|
440
|
+
...AppErrorGroupFields
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
`);
|
|
444
|
+
/** The event types pollEvents/waitForEvents read (MCP `list_event_types`). */
|
|
445
|
+
export const EventTypesDocument = graphql(`
|
|
446
|
+
query SdkEventTypes {
|
|
447
|
+
platformEventTypes {
|
|
448
|
+
name
|
|
449
|
+
description
|
|
450
|
+
delivery
|
|
451
|
+
inputSchema
|
|
452
|
+
payloadSchema
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
`);
|
|
456
|
+
/** MCP `poll_events`: the same feed, cursors and filters. */
|
|
457
|
+
export const PollEventsDocument = graphql(`
|
|
458
|
+
query SdkPollEvents($input: PlatformEventsInput) {
|
|
459
|
+
pollEvents(input: $input) {
|
|
460
|
+
cursor
|
|
461
|
+
truncated
|
|
462
|
+
hasMore
|
|
463
|
+
nextPollMs
|
|
464
|
+
timedOut
|
|
465
|
+
events {
|
|
466
|
+
eventID
|
|
467
|
+
name
|
|
468
|
+
timestamp
|
|
469
|
+
data
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
`);
|
|
474
|
+
/** MCP `wait_for_events`: pollEvents that blocks server-side (at most 50 s). */
|
|
475
|
+
export const WaitForEventsDocument = graphql(`
|
|
476
|
+
query SdkWaitForEvents($input: PlatformEventsInput, $timeoutSeconds: Int) {
|
|
477
|
+
waitForEvents(input: $input, timeoutSeconds: $timeoutSeconds) {
|
|
478
|
+
cursor
|
|
479
|
+
truncated
|
|
480
|
+
hasMore
|
|
481
|
+
nextPollMs
|
|
482
|
+
timedOut
|
|
483
|
+
events {
|
|
484
|
+
eventID
|
|
485
|
+
name
|
|
486
|
+
timestamp
|
|
487
|
+
data
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
`);
|
|
144
492
|
export const ListFilesDocument = graphql(`
|
|
145
493
|
query SdkListFiles($input: ListWorkspaceFilesInput!) {
|
|
146
494
|
workspaceFilesPage(input: $input) {
|
|
@@ -307,6 +655,11 @@ export const ServiceLogsDocument = graphql(`
|
|
|
307
655
|
}
|
|
308
656
|
}
|
|
309
657
|
`);
|
|
658
|
+
/**
|
|
659
|
+
* Deployment events with their metadata: the timing events
|
|
660
|
+
* (`deployment.phases`, `deployment.build_finished`) carry their phases there
|
|
661
|
+
* as `*_ms` fields, which `parseDeploymentTimings` turns into numbers.
|
|
662
|
+
*/
|
|
310
663
|
export const DeploymentEventsDocument = graphql(`
|
|
311
664
|
query SdkDeploymentEvents($deploymentID: ID!, $limit: Int) {
|
|
312
665
|
deploymentEvents(deploymentID: $deploymentID, limit: $limit) {
|
|
@@ -317,10 +670,29 @@ export const DeploymentEventsDocument = graphql(`
|
|
|
317
670
|
severity
|
|
318
671
|
message
|
|
319
672
|
vmID
|
|
673
|
+
metadata
|
|
320
674
|
createdAt
|
|
321
675
|
}
|
|
322
676
|
}
|
|
323
677
|
`);
|
|
678
|
+
/**
|
|
679
|
+
* The server-side wait (MCP `wait_for_deployment`): the control plane blocks
|
|
680
|
+
* until the deployment leaves BUILDING — woken by the deploy pipeline itself,
|
|
681
|
+
* not a timer — or its budget (at most 50 s) runs out. One round trip after
|
|
682
|
+
* READY instead of a poll interval, and the full deployment in the answer.
|
|
683
|
+
*/
|
|
684
|
+
export const WaitForDeploymentDocument = graphql(`
|
|
685
|
+
query SdkWaitForDeployment($id: ID!, $timeoutSeconds: Int) {
|
|
686
|
+
waitForDeployment(id: $id, timeoutSeconds: $timeoutSeconds) {
|
|
687
|
+
timedOut
|
|
688
|
+
waitedMs
|
|
689
|
+
placement
|
|
690
|
+
deployment {
|
|
691
|
+
...DeploymentFields
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
`);
|
|
324
696
|
export const RestartServiceDocument = graphql(`
|
|
325
697
|
mutation SdkRestartService($deploymentID: ID!) {
|
|
326
698
|
restartService(input: { deploymentID: $deploymentID }) {
|
package/dist/operations.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,OAAO,EAAE,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AAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAC;;;;;;CAMxC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,OAAO,CAAC;;;;;;CAM1C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,OAAO,CAAC;;;;;;;;;CAS/C,CAAC,CAAC","sourcesContent":["/**\n * Every GraphQL document the workflow layer sends.\n *\n * These are wrapped in `graphql(...)` so graphql-codegen validates them\n * against the vendored schema at codegen time and emits exact result/variable\n * types. A field that stops existing server-side turns into a compile error\n * here rather than a runtime surprise in an agent's script.\n *\n * The one document NOT defined here is the batched file write: it has a\n * variable number of aliased root fields, so it is assembled at runtime in\n * `unfazed.ts`. See the comment there.\n */\nimport { graphql } from \"./generated/gql.js\";\n\n/**\n * Deployment fields the SDK returns everywhere.\n *\n * `id` + `aliasRevision` + `aliasHeld` are the rollback compare-and-swap\n * triple; `previewUrl` is the immutable by-id URL you can verify BEFORE the\n * alias moves; `error` carries the build failure text when status is FAILED.\n */\nexport const DeploymentFieldsFragment = graphql(`\n fragment DeploymentFields on Deployment {\n id\n workspaceID\n kind\n runtime\n alias\n serviceMode\n healthPath\n cronSchedule\n cronPath\n url\n previewUrl\n sshCommand\n aliasHeld\n aliasRevision\n status\n error\n filesCount\n sizeBytes\n size\n spaMode\n gitRepo\n gitCommit\n createdAt\n }\n`);\n\nexport const WhoamiDocument = graphql(`\n query SdkWhoami {\n whoami {\n kind\n userID\n name\n agentID\n agentName\n claimed\n claimedBy\n scopes\n expiresAt\n usage {\n month\n requests\n limit\n }\n resources {\n workspaces\n workspaceLimit\n services\n serviceLimit\n }\n }\n }\n`);\n\nexport const CreateWorkspaceDocument = graphql(`\n mutation SdkCreateWorkspace($name: String!) {\n createWorkspace(input: { name: $name }) {\n workspace {\n id\n name\n ownerId\n projectId\n createdAt\n updatedAt\n }\n }\n }\n`);\n\nexport const ListWorkspacesDocument = graphql(`\n query SdkListWorkspaces {\n workspaces {\n id\n name\n ownerId\n projectId\n createdAt\n updatedAt\n }\n }\n`);\n\n/**\n * Deleting a workspace, with the deployment cascade made explicit.\n *\n * `withDeployments` is not decoration: without it the server REFUSES while the\n * workspace has any deployment history at all — including FAILED records —\n * with `workspace %q still has deployments; delete them first`. A workspace\n * that was ever deployed is therefore undeletable through the bare mutation,\n * so the SDK always sends the flag and lets the caller choose the value.\n */\nexport const DeleteWorkspaceDocument = graphql(`\n mutation SdkDeleteWorkspace($workspaceID: ID!, $withDeployments: Boolean) {\n deleteWorkspace(input: { workspaceID: $workspaceID, withDeployments: $withDeployments }) {\n ok\n }\n }\n`);\n\nexport const WriteTextFileDocument = graphql(`\n mutation SdkWriteTextFile($workspaceID: ID!, $path: String!, $text: String!) {\n writeWorkspaceTextFile(input: { workspaceID: $workspaceID, path: $path, text: $text }) {\n file {\n path\n sizeBytes\n size\n sha256\n updatedAt\n }\n }\n }\n`);\n\nexport const WriteBase64FileDocument = graphql(`\n mutation SdkWriteBase64File($workspaceID: ID!, $path: String!, $contentBase64: String!) {\n writeWorkspaceBase64File(\n input: { workspaceID: $workspaceID, path: $path, contentBase64: $contentBase64 }\n ) {\n file {\n path\n sizeBytes\n size\n sha256\n updatedAt\n }\n }\n }\n`);\n\nexport const ListFilesDocument = graphql(`\n query SdkListFiles($input: ListWorkspaceFilesInput!) {\n workspaceFilesPage(input: $input) {\n items {\n path\n sizeBytes\n size\n sha256\n updatedAt\n }\n total\n limit\n offset\n hasMore\n nextOffset\n }\n }\n`);\n\nexport const ReadFileDocument = graphql(`\n query SdkReadFile($input: ReadWorkspaceFileInput!) {\n readWorkspaceFile(input: $input) {\n text\n offset\n limit\n totalBytes\n truncated\n nextOffset\n file {\n path\n sizeBytes\n size\n sha256\n updatedAt\n }\n }\n }\n`);\n\nexport const DeleteFileDocument = graphql(`\n mutation SdkDeleteFile($workspaceID: ID!, $path: String!) {\n deleteWorkspaceFile(input: { workspaceID: $workspaceID, path: $path }) {\n ok\n }\n }\n`);\n\nexport const CreateDeploymentDocument = graphql(`\n mutation SdkCreateDeployment($input: CreateDeploymentInput!) {\n createDeployment(input: $input) {\n deployment {\n ...DeploymentFields\n }\n }\n }\n`);\n\nexport const DeployWorkspaceDocument = graphql(`\n mutation SdkDeployWorkspace($input: DeployWorkspaceInput!) {\n deployWorkspace(input: $input) {\n deployment {\n ...DeploymentFields\n }\n }\n }\n`);\n\nexport const GetDeploymentDocument = graphql(`\n query SdkGetDeployment($id: ID!) {\n deployment(id: $id) {\n ...DeploymentFields\n }\n }\n`);\n\n/**\n * The poll document, deliberately narrow.\n *\n * Waiting can run for minutes at a few seconds per tick; selecting the full\n * fragment every time would cost the server (and an agent's rate limit) far\n * more than the four fields the state machine actually reads.\n */\nexport const PollDeploymentDocument = graphql(`\n query SdkPollDeployment($id: ID!) {\n deployment(id: $id) {\n id\n status\n error\n aliasHeld\n url\n previewUrl\n }\n }\n`);\n\nexport const GetDeploymentByAliasDocument = graphql(`\n query SdkGetDeploymentByAlias($alias: String!) {\n deploymentByAlias(alias: $alias) {\n ...DeploymentFields\n }\n }\n`);\n\nexport const ListDeploymentsDocument = graphql(`\n query SdkListDeployments($input: ListDeploymentsInput) {\n deploymentsPage(input: $input) {\n items {\n ...DeploymentFields\n }\n total\n limit\n offset\n hasMore\n nextOffset\n }\n }\n`);\n\nexport const ListReleasesDocument = graphql(`\n query SdkListReleases($alias: String!) {\n deploymentReleases(alias: $alias) {\n ...DeploymentFields\n }\n }\n`);\n\nexport const RollbackDocument = graphql(`\n mutation SdkRollback(\n $deploymentID: ID!\n $expectedCurrentDeploymentID: ID!\n $expectedCurrentAliasRevision: String!\n ) {\n rollbackDeployment(\n input: {\n deploymentID: $deploymentID\n expectedCurrentDeploymentID: $expectedCurrentDeploymentID\n expectedCurrentAliasRevision: $expectedCurrentAliasRevision\n }\n ) {\n ...DeploymentFields\n }\n }\n`);\n\nexport const ServiceStatusDocument = graphql(`\n query SdkServiceStatus($deploymentID: ID!) {\n serviceStatus(deploymentID: $deploymentID) {\n deploymentID\n alias\n serviceMode\n running\n health\n vmID\n inFlight\n alwaysOn\n memSizeMiB\n startedAt\n lastUsedAt\n lastStoppedAt\n restartCount\n lastError\n }\n }\n`);\n\nexport const ServiceLogsDocument = graphql(`\n query SdkServiceLogs($deploymentID: ID!, $tailBytes: Int) {\n serviceLogs(deploymentID: $deploymentID, tailBytes: $tailBytes) {\n deploymentID\n stdout\n stderr\n truncated\n stdoutBytes\n stderrBytes\n tailBytes\n }\n }\n`);\n\nexport const DeploymentEventsDocument = graphql(`\n query SdkDeploymentEvents($deploymentID: ID!, $limit: Int) {\n deploymentEvents(deploymentID: $deploymentID, limit: $limit) {\n id\n deploymentID\n type\n rawType\n severity\n message\n vmID\n createdAt\n }\n }\n`);\n\nexport const RestartServiceDocument = graphql(`\n mutation SdkRestartService($deploymentID: ID!) {\n restartService(input: { deploymentID: $deploymentID }) {\n deploymentID\n running\n health\n vmID\n restartCount\n lastError\n }\n }\n`);\n\nexport const StopServiceDocument = graphql(`\n mutation SdkStopService($deploymentID: ID!) {\n stopService(input: { deploymentID: $deploymentID }) {\n deploymentID\n running\n health\n vmID\n restartCount\n lastError\n }\n }\n`);\n\nexport const DeleteDeploymentDocument = graphql(`\n mutation SdkDeleteDeployment($deploymentID: ID!) {\n deleteDeployment(input: { deploymentID: $deploymentID }) {\n ok\n }\n }\n`);\n\n/* -------------------------------------------------------------------------\n * Env & secrets\n *\n * Workspace-scoped values are SERVICE defaults for every app in the source;\n * app-scoped values override them for one alias. Both are snapshotted into a\n * release at deploy time, so a change only reaches a running app after a\n * redeploy — the workflow layer's doc comments repeat this where it matters.\n * ---------------------------------------------------------------------- */\n\nexport const SetWorkspaceEnvDocument = graphql(`\n mutation SdkSetWorkspaceEnv($workspaceID: ID!, $name: String!, $value: String!) {\n setWorkspaceEnv(input: { workspaceID: $workspaceID, name: $name, value: $value }) {\n env {\n name\n value\n secret\n alias\n inherited\n masked\n updatedAt\n }\n }\n }\n`);\n\nexport const SetWorkspaceSecretDocument = graphql(`\n mutation SdkSetWorkspaceSecret($workspaceID: ID!, $name: String!, $value: String!) {\n setWorkspaceSecret(input: { workspaceID: $workspaceID, name: $name, value: $value }) {\n env {\n name\n value\n secret\n alias\n inherited\n masked\n updatedAt\n }\n }\n }\n`);\n\nexport const DeleteWorkspaceEnvDocument = graphql(`\n mutation SdkDeleteWorkspaceEnv($workspaceID: ID!, $name: String!) {\n deleteWorkspaceEnv(input: { workspaceID: $workspaceID, name: $name }) {\n ok\n }\n }\n`);\n\nexport const ListWorkspaceEnvDocument = graphql(`\n query SdkListWorkspaceEnv($workspaceID: ID!) {\n workspaceEnv(workspaceID: $workspaceID) {\n name\n value\n secret\n alias\n inherited\n masked\n updatedAt\n }\n }\n`);\n\nexport const SetAppEnvDocument = graphql(`\n mutation SdkSetAppEnv($workspaceID: ID!, $alias: String!, $name: String!, $value: String!) {\n setAppEnv(input: { workspaceID: $workspaceID, alias: $alias, name: $name, value: $value }) {\n env {\n name\n value\n secret\n alias\n inherited\n masked\n updatedAt\n }\n }\n }\n`);\n\nexport const SetAppSecretDocument = graphql(`\n mutation SdkSetAppSecret($workspaceID: ID!, $alias: String!, $name: String!, $value: String!) {\n setAppSecret(input: { workspaceID: $workspaceID, alias: $alias, name: $name, value: $value }) {\n env {\n name\n value\n secret\n alias\n inherited\n masked\n updatedAt\n }\n }\n }\n`);\n\nexport const RemoveAppEnvDocument = graphql(`\n mutation SdkRemoveAppEnv($workspaceID: ID!, $alias: String!, $name: String!) {\n removeAppEnv(input: { workspaceID: $workspaceID, alias: $alias, name: $name }) {\n ok\n }\n }\n`);\n\nexport const InheritAppEnvDocument = graphql(`\n mutation SdkInheritAppEnv($workspaceID: ID!, $alias: String!, $name: String!) {\n inheritAppEnv(input: { workspaceID: $workspaceID, alias: $alias, name: $name }) {\n ok\n }\n }\n`);\n\nexport const ListAppEnvDocument = graphql(`\n query SdkListAppEnv($workspaceID: ID!, $alias: String!) {\n appEnv(workspaceID: $workspaceID, alias: $alias) {\n name\n value\n secret\n alias\n inherited\n masked\n updatedAt\n }\n }\n`);\n\n/* -------------------------------------------------------------------------\n * Agent runs\n *\n * A run is the past-tense counterpart to a deployment: \"boot a fresh VM,\n * hand it a prompt, let a harness work, keep the transcript, record what it\n * cost, reap the VM\". `createRun` returns once the VM has started\n * (RUNNING) or FAILED with `error` when it could not boot — unlike\n * `createDeployment`, a FAILED run is a normal return value, not something\n * that only shows up later in a poll.\n * ---------------------------------------------------------------------- */\n\n/** Run fields the SDK returns everywhere. */\nexport const RunFieldsFragment = graphql(`\n fragment RunFields on Run {\n id\n workspaceID\n ownerId\n status\n rawStatus\n command\n harness\n prompt\n setup\n skills\n verify\n approval\n mode\n access\n alias\n integrations {\n kind\n bindingID\n env\n skills\n mcpServers {\n name\n transport\n readOnly\n }\n }\n parentRunID\n depth\n question {\n id\n text\n options\n askedAt\n }\n memoryMiB\n maxSeconds\n metadata\n error\n exitCode\n result {\n status\n detail\n text\n }\n verifyExitCode\n vmID\n transcriptAvailable\n usage {\n vmSeconds\n memoryMiB\n mibSeconds\n }\n createdAt\n startedAt\n settledAt\n }\n`);\n\nexport const CreateRunDocument = graphql(`\n mutation SdkCreateRun($input: CreateRunInput!) {\n createRun(input: $input) {\n ...RunFields\n }\n }\n`);\n\nexport const GetRunDocument = graphql(`\n query SdkGetRun($id: ID!) {\n run(id: $id) {\n ...RunFields\n }\n }\n`);\n\n/**\n * The poll document, deliberately narrow — see {@link PollDeploymentDocument}\n * for why: this runs every few seconds for potentially up to an hour.\n */\nexport const PollRunDocument = graphql(`\n query SdkPollRun($id: ID!) {\n run(id: $id) {\n id\n status\n error\n exitCode\n }\n }\n`);\n\nexport const ListRunsDocument = graphql(`\n query SdkListRuns($input: ListRunsInput) {\n runs(input: $input) {\n items {\n ...RunFields\n }\n total\n limit\n offset\n hasMore\n nextOffset\n }\n }\n`);\n\nexport const CancelRunDocument = graphql(`\n mutation SdkCancelRun($id: ID!) {\n cancelRun(id: $id) {\n ...RunFields\n }\n }\n`);\n\nexport const RunEventsDocument = graphql(`\n query SdkRunEvents($runID: ID!, $limit: Int) {\n runEvents(runID: $runID, limit: $limit) {\n id\n runID\n type\n severity\n message\n metadata\n createdAt\n }\n }\n`);\n\n/** The live console tail of a RUNNING run. Empty with `running: false` once settled. */\nexport const RunConsoleDocument = graphql(`\n query SdkRunConsole($id: ID!, $tailBytes: Int) {\n runConsole(id: $id, tailBytes: $tailBytes) {\n runID\n running\n text\n }\n }\n`);\n\n/** The bounded end of a finished run's stored transcript. */\nexport const RunTranscriptDocument = graphql(`\n query SdkRunTranscript($id: ID!, $tailBytes: Int) {\n runTranscript(id: $id, tailBytes: $tailBytes) {\n runID\n available\n text\n totalBytes\n truncated\n }\n }\n`);\n\nexport const AnswerRunDocument = graphql(`\n mutation SdkAnswerRun($id: ID!, $answer: String!) {\n answerRun(id: $id, answer: $answer) {\n ...RunFields\n }\n }\n`);\n\nexport const FollowUpRunDocument = graphql(`\n mutation SdkFollowUpRun($input: FollowUpRunInput!) {\n followUpRun(input: $input) {\n ...RunFields\n }\n }\n`);\n\nexport const ListRunHarnessesDocument = graphql(`\n query SdkRunHarnesses {\n runHarnesses {\n name\n title\n summary\n requires\n }\n }\n`);\n"]}
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;CA0B/C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;CAyBrC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,uBAAuB,GAAG,OAAO,CAAC;;;;;;;;;;;;;CAa9C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,sBAAsB,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B,GAAG,OAAO,CAAC;;;;;;CAMxC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAC;;;;;;;;;;;;CAYxC,CAAC,CAAC;AAEH,wFAAwF;AACxF,MAAM,CAAC,MAAM,kBAAkB,GAAG,OAAO,CAAC;;;;;;;;CAQzC,CAAC,CAAC;AAEH,6DAA6D;AAC7D,MAAM,CAAC,MAAM,qBAAqB,GAAG,OAAO,CAAC;;;;;;;;;;CAU5C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAC;;;;;;CAMxC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,OAAO,CAAC;;;;;;CAM1C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,OAAO,CAAC;;;;;;;;;CAS/C,CAAC,CAAC","sourcesContent":["/**\n * Every GraphQL document the workflow layer sends.\n *\n * These are wrapped in `graphql(...)` so graphql-codegen validates them\n * against the vendored schema at codegen time and emits exact result/variable\n * types. A field that stops existing server-side turns into a compile error\n * here rather than a runtime surprise in an agent's script.\n *\n * The one document NOT defined here is the batched file write: it has a\n * variable number of aliased root fields, so it is assembled at runtime in\n * `unfazed.ts`. See the comment there.\n */\nimport { graphql } from \"./generated/gql.js\";\n\n/**\n * Deployment fields the SDK returns everywhere.\n *\n * `id` + `aliasRevision` + `aliasHeld` are the rollback compare-and-swap\n * triple; `previewUrl` is the immutable by-id URL you can verify BEFORE the\n * alias moves; `error` carries the build failure text when status is FAILED.\n */\nexport const DeploymentFieldsFragment = graphql(`\n fragment DeploymentFields on Deployment {\n id\n workspaceID\n kind\n runtime\n alias\n serviceMode\n healthPath\n cronSchedule\n cronPath\n url\n previewUrl\n sshCommand\n aliasHeld\n aliasRevision\n status\n error\n filesCount\n sizeBytes\n size\n spaMode\n gitRepo\n gitCommit\n createdAt\n }\n`);\n\nexport const WhoamiDocument = graphql(`\n query SdkWhoami {\n whoami {\n kind\n userID\n name\n agentID\n agentName\n claimed\n claimedBy\n scopes\n expiresAt\n usage {\n month\n requests\n limit\n }\n resources {\n workspaces\n workspaceLimit\n services\n serviceLimit\n }\n }\n }\n`);\n\nexport const CreateWorkspaceDocument = graphql(`\n mutation SdkCreateWorkspace($name: String!) {\n createWorkspace(input: { name: $name }) {\n workspace {\n id\n name\n ownerId\n projectId\n createdAt\n updatedAt\n }\n }\n }\n`);\n\nexport const ListWorkspacesDocument = graphql(`\n query SdkListWorkspaces {\n workspaces {\n id\n name\n ownerId\n projectId\n createdAt\n updatedAt\n }\n }\n`);\n\n/**\n * Deleting a workspace, with the deployment cascade made explicit.\n *\n * Without `withDeployments` the server REFUSES while the workspace has any\n * deployment record at all — FAILED ones included — with `workspace %q still\n * has deployments; delete them first`. With it, the delete takes down every\n * app the workspace serves, so `confirmAliases` must name exactly those apps\n * (`Workspace.liveApps`); a missing or extra alias refuses the delete, deletes\n * nothing, and the error lists the live apps. The SDK always sends the flag\n * and never fills in the aliases: the caller names what goes.\n */\nexport const DeleteWorkspaceDocument = graphql(`\n mutation SdkDeleteWorkspace(\n $workspaceID: ID!\n $withDeployments: Boolean\n $confirmAliases: [String!]\n ) {\n deleteWorkspace(\n input: {\n workspaceID: $workspaceID\n withDeployments: $withDeployments\n confirmAliases: $confirmAliases\n }\n ) {\n ok\n }\n }\n`);\n\n/**\n * The apps a workspace serves right now: what `deleteWorkspace` with\n * `withDeployments` takes offline, and exactly the list its `confirmAliases`\n * must name. `workspace` is null when the id is absent or not the caller's.\n */\nexport const WorkspaceLiveAppsDocument = graphql(`\n query SdkWorkspaceLiveApps($id: ID!) {\n workspace(id: $id) {\n id\n liveApps {\n alias\n deploymentID\n domains\n }\n }\n }\n`);\n\n/**\n * Deleting ONE app of a workspace: every deployment of the alias there, its\n * App State, app-scoped env and secrets, and integration bindings. The\n * workspace, its files and its other apps keep serving.\n */\nexport const DeleteAppDocument = graphql(`\n mutation SdkDeleteApp($workspaceID: ID!, $alias: String!) {\n deleteApp(input: { workspaceID: $workspaceID, alias: $alias }) {\n ok\n alias\n deployments\n domains\n envEntries\n skippedOnSync\n otherApps\n }\n }\n`);\n\nexport const WriteTextFileDocument = graphql(`\n mutation SdkWriteTextFile($workspaceID: ID!, $path: String!, $text: String!) {\n writeWorkspaceTextFile(input: { workspaceID: $workspaceID, path: $path, text: $text }) {\n file {\n path\n sizeBytes\n size\n sha256\n updatedAt\n }\n }\n }\n`);\n\nexport const WriteBase64FileDocument = graphql(`\n mutation SdkWriteBase64File($workspaceID: ID!, $path: String!, $contentBase64: String!) {\n writeWorkspaceBase64File(\n input: { workspaceID: $workspaceID, path: $path, contentBase64: $contentBase64 }\n ) {\n file {\n path\n sizeBytes\n size\n sha256\n updatedAt\n }\n }\n }\n`);\n\n/** The commit a file write made on an app with platform git (MCP's `commit`). */\nexport const FileCommitFieldsFragment = graphql(`\n fragment FileCommitFields on FileCommit {\n sha\n branch\n message\n committed\n waiting\n waitingCount\n deploys\n conflicts\n writeSHA\n paused\n }\n`);\n\n/**\n * The batch write (MCP `write_workspace_files`): every file in ONE request\n * and, on an app with platform git, ONE commit for the whole call.\n */\nexport const WriteFilesDocument = graphql(`\n mutation SdkWriteFiles(\n $workspaceID: ID!\n $files: [WorkspaceFileWriteInput!]!\n $commitMessage: String\n ) {\n writeWorkspaceFiles(\n input: { workspaceID: $workspaceID, files: $files, commitMessage: $commitMessage }\n ) {\n workspaceID\n written\n failed\n totalBytes\n files {\n path\n ok\n error\n file {\n path\n sizeBytes\n size\n sha256\n updatedAt\n }\n }\n commit {\n ...FileCommitFields\n }\n }\n }\n`);\n\n/** One page of an app's platform git history, newest first (MCP `list_commits`). */\nexport const AppCommitsDocument = graphql(`\n query SdkAppCommits($workspaceID: ID!, $limit: Int, $before: String) {\n appCommits(workspaceID: $workspaceID, limit: $limit, before: $before) {\n branch\n head\n nextBefore\n autoDeploy\n waitingCommits\n waitingSince\n commits {\n sha\n message\n authorName\n authorEmail\n authoredAt\n filesChanged\n deployedTo\n }\n deployed {\n alias\n sha\n deploymentID\n }\n }\n }\n`);\n\n/** Only what `waitForCommit` reads: whether writes still wait, and the head. */\nexport const AppCommitsWaitingDocument = graphql(`\n query SdkAppCommitsWaiting($workspaceID: ID!) {\n appCommits(workspaceID: $workspaceID, limit: 1) {\n branch\n head\n waitingCommits\n waitingSince\n }\n }\n`);\n\n/**\n * The app's git link as the last import left it: what `restoreVersion` waits\n * on, since the deploy a restore queues is an import of the branch head.\n */\nexport const WorkspaceGitSourceDocument = graphql(`\n query SdkWorkspaceGitSource($id: ID!) {\n workspace(id: $id) {\n id\n gitSource {\n branch\n autoDeploy\n deployAlias\n lastImportedCommit\n lastImportedAt\n lastImportStatus\n lastImportError\n }\n }\n }\n`);\n\n/** One commit with its diff (MCP `get_commit`). */\nexport const AppCommitDocument = graphql(`\n query SdkAppCommit($workspaceID: ID!, $sha: String!) {\n appCommit(workspaceID: $workspaceID, sha: $sha) {\n commit {\n sha\n message\n authorName\n authorEmail\n authoredAt\n filesChanged\n deployedTo\n }\n files {\n path\n status\n }\n patch\n truncated\n additions\n deletions\n }\n }\n`);\n\n/** Give the app back an earlier commit's files (MCP `restore_version`). */\nexport const RestoreVersionDocument = graphql(`\n mutation SdkRestoreVersion(\n $workspaceID: ID!\n $sha: String!\n $expectedHead: String\n $message: String\n ) {\n restoreAppVersion(\n input: { workspaceID: $workspaceID, sha: $sha, expectedHead: $expectedHead, message: $message }\n ) {\n sha\n committed\n deploys\n message\n branch\n deployAlias\n restoredFrom\n parent\n }\n }\n`);\n\n/** A service app's error group, as MCP `list_errors` shows it. */\nexport const AppErrorGroupFieldsFragment = graphql(`\n fragment AppErrorGroupFields on AppErrorGroup {\n id\n title\n type\n culprit\n level\n status\n count\n storedEvents\n firstSeen\n lastSeen\n firstDeploymentID\n firstGitCommit\n lastDeploymentID\n lastGitCommit\n resolvedInDeploymentID\n resolvedAt\n mutedAt\n regressedAt\n }\n`);\n\nexport const AppErrorsDocument = graphql(`\n query SdkAppErrors(\n $workspaceID: ID!\n $alias: String!\n $status: String\n $limit: Int\n $cursor: String\n ) {\n appErrors(\n workspaceID: $workspaceID\n alias: $alias\n status: $status\n limit: $limit\n cursor: $cursor\n ) {\n groups {\n ...AppErrorGroupFields\n }\n nextCursor\n note\n }\n }\n`);\n\nexport const AppErrorGroupDocument = graphql(`\n query SdkAppErrorGroup($workspaceID: ID!, $alias: String!, $groupID: ID!) {\n appErrorGroup(workspaceID: $workspaceID, alias: $alias, groupID: $groupID) {\n group {\n ...AppErrorGroupFields\n }\n latestEvent\n firstEvent {\n eventID\n at\n deploymentID\n level\n }\n recentEvents {\n eventID\n at\n deploymentID\n level\n }\n deployments {\n deploymentID\n gitCommit\n current\n count\n firstSeen\n lastSeen\n }\n fatal\n vmID\n }\n }\n`);\n\nexport const ResolveErrorGroupDocument = graphql(`\n mutation SdkResolveErrorGroup($input: AppErrorGroupInput!) {\n resolveAppErrorGroup(input: $input) {\n ...AppErrorGroupFields\n }\n }\n`);\n\nexport const MuteErrorGroupDocument = graphql(`\n mutation SdkMuteErrorGroup($input: AppErrorGroupInput!) {\n muteAppErrorGroup(input: $input) {\n ...AppErrorGroupFields\n }\n }\n`);\n\nexport const ReopenErrorGroupDocument = graphql(`\n mutation SdkReopenErrorGroup($input: AppErrorGroupInput!) {\n reopenAppErrorGroup(input: $input) {\n ...AppErrorGroupFields\n }\n }\n`);\n\n/** The event types pollEvents/waitForEvents read (MCP `list_event_types`). */\nexport const EventTypesDocument = graphql(`\n query SdkEventTypes {\n platformEventTypes {\n name\n description\n delivery\n inputSchema\n payloadSchema\n }\n }\n`);\n\n/** MCP `poll_events`: the same feed, cursors and filters. */\nexport const PollEventsDocument = graphql(`\n query SdkPollEvents($input: PlatformEventsInput) {\n pollEvents(input: $input) {\n cursor\n truncated\n hasMore\n nextPollMs\n timedOut\n events {\n eventID\n name\n timestamp\n data\n }\n }\n }\n`);\n\n/** MCP `wait_for_events`: pollEvents that blocks server-side (at most 50 s). */\nexport const WaitForEventsDocument = graphql(`\n query SdkWaitForEvents($input: PlatformEventsInput, $timeoutSeconds: Int) {\n waitForEvents(input: $input, timeoutSeconds: $timeoutSeconds) {\n cursor\n truncated\n hasMore\n nextPollMs\n timedOut\n events {\n eventID\n name\n timestamp\n data\n }\n }\n }\n`);\n\nexport const ListFilesDocument = graphql(`\n query SdkListFiles($input: ListWorkspaceFilesInput!) {\n workspaceFilesPage(input: $input) {\n items {\n path\n sizeBytes\n size\n sha256\n updatedAt\n }\n total\n limit\n offset\n hasMore\n nextOffset\n }\n }\n`);\n\nexport const ReadFileDocument = graphql(`\n query SdkReadFile($input: ReadWorkspaceFileInput!) {\n readWorkspaceFile(input: $input) {\n text\n offset\n limit\n totalBytes\n truncated\n nextOffset\n file {\n path\n sizeBytes\n size\n sha256\n updatedAt\n }\n }\n }\n`);\n\nexport const DeleteFileDocument = graphql(`\n mutation SdkDeleteFile($workspaceID: ID!, $path: String!) {\n deleteWorkspaceFile(input: { workspaceID: $workspaceID, path: $path }) {\n ok\n }\n }\n`);\n\nexport const CreateDeploymentDocument = graphql(`\n mutation SdkCreateDeployment($input: CreateDeploymentInput!) {\n createDeployment(input: $input) {\n deployment {\n ...DeploymentFields\n }\n }\n }\n`);\n\nexport const DeployWorkspaceDocument = graphql(`\n mutation SdkDeployWorkspace($input: DeployWorkspaceInput!) {\n deployWorkspace(input: $input) {\n deployment {\n ...DeploymentFields\n }\n }\n }\n`);\n\nexport const GetDeploymentDocument = graphql(`\n query SdkGetDeployment($id: ID!) {\n deployment(id: $id) {\n ...DeploymentFields\n }\n }\n`);\n\n/**\n * The poll document, deliberately narrow.\n *\n * Waiting can run for minutes at a few seconds per tick; selecting the full\n * fragment every time would cost the server (and an agent's rate limit) far\n * more than the four fields the state machine actually reads.\n */\nexport const PollDeploymentDocument = graphql(`\n query SdkPollDeployment($id: ID!) {\n deployment(id: $id) {\n id\n status\n error\n aliasHeld\n url\n previewUrl\n }\n }\n`);\n\nexport const GetDeploymentByAliasDocument = graphql(`\n query SdkGetDeploymentByAlias($alias: String!) {\n deploymentByAlias(alias: $alias) {\n ...DeploymentFields\n }\n }\n`);\n\nexport const ListDeploymentsDocument = graphql(`\n query SdkListDeployments($input: ListDeploymentsInput) {\n deploymentsPage(input: $input) {\n items {\n ...DeploymentFields\n }\n total\n limit\n offset\n hasMore\n nextOffset\n }\n }\n`);\n\nexport const ListReleasesDocument = graphql(`\n query SdkListReleases($alias: String!) {\n deploymentReleases(alias: $alias) {\n ...DeploymentFields\n }\n }\n`);\n\nexport const RollbackDocument = graphql(`\n mutation SdkRollback(\n $deploymentID: ID!\n $expectedCurrentDeploymentID: ID!\n $expectedCurrentAliasRevision: String!\n ) {\n rollbackDeployment(\n input: {\n deploymentID: $deploymentID\n expectedCurrentDeploymentID: $expectedCurrentDeploymentID\n expectedCurrentAliasRevision: $expectedCurrentAliasRevision\n }\n ) {\n ...DeploymentFields\n }\n }\n`);\n\nexport const ServiceStatusDocument = graphql(`\n query SdkServiceStatus($deploymentID: ID!) {\n serviceStatus(deploymentID: $deploymentID) {\n deploymentID\n alias\n serviceMode\n running\n health\n vmID\n inFlight\n alwaysOn\n memSizeMiB\n startedAt\n lastUsedAt\n lastStoppedAt\n restartCount\n lastError\n }\n }\n`);\n\nexport const ServiceLogsDocument = graphql(`\n query SdkServiceLogs($deploymentID: ID!, $tailBytes: Int) {\n serviceLogs(deploymentID: $deploymentID, tailBytes: $tailBytes) {\n deploymentID\n stdout\n stderr\n truncated\n stdoutBytes\n stderrBytes\n tailBytes\n }\n }\n`);\n\n/**\n * Deployment events with their metadata: the timing events\n * (`deployment.phases`, `deployment.build_finished`) carry their phases there\n * as `*_ms` fields, which `parseDeploymentTimings` turns into numbers.\n */\nexport const DeploymentEventsDocument = graphql(`\n query SdkDeploymentEvents($deploymentID: ID!, $limit: Int) {\n deploymentEvents(deploymentID: $deploymentID, limit: $limit) {\n id\n deploymentID\n type\n rawType\n severity\n message\n vmID\n metadata\n createdAt\n }\n }\n`);\n\n/**\n * The server-side wait (MCP `wait_for_deployment`): the control plane blocks\n * until the deployment leaves BUILDING — woken by the deploy pipeline itself,\n * not a timer — or its budget (at most 50 s) runs out. One round trip after\n * READY instead of a poll interval, and the full deployment in the answer.\n */\nexport const WaitForDeploymentDocument = graphql(`\n query SdkWaitForDeployment($id: ID!, $timeoutSeconds: Int) {\n waitForDeployment(id: $id, timeoutSeconds: $timeoutSeconds) {\n timedOut\n waitedMs\n placement\n deployment {\n ...DeploymentFields\n }\n }\n }\n`);\n\nexport const RestartServiceDocument = graphql(`\n mutation SdkRestartService($deploymentID: ID!) {\n restartService(input: { deploymentID: $deploymentID }) {\n deploymentID\n running\n health\n vmID\n restartCount\n lastError\n }\n }\n`);\n\nexport const StopServiceDocument = graphql(`\n mutation SdkStopService($deploymentID: ID!) {\n stopService(input: { deploymentID: $deploymentID }) {\n deploymentID\n running\n health\n vmID\n restartCount\n lastError\n }\n }\n`);\n\nexport const DeleteDeploymentDocument = graphql(`\n mutation SdkDeleteDeployment($deploymentID: ID!) {\n deleteDeployment(input: { deploymentID: $deploymentID }) {\n ok\n }\n }\n`);\n\n/* -------------------------------------------------------------------------\n * Env & secrets\n *\n * Workspace-scoped values are SERVICE defaults for every app in the source;\n * app-scoped values override them for one alias. Both are snapshotted into a\n * release at deploy time, so a change only reaches a running app after a\n * redeploy — the workflow layer's doc comments repeat this where it matters.\n * ---------------------------------------------------------------------- */\n\nexport const SetWorkspaceEnvDocument = graphql(`\n mutation SdkSetWorkspaceEnv($workspaceID: ID!, $name: String!, $value: String!) {\n setWorkspaceEnv(input: { workspaceID: $workspaceID, name: $name, value: $value }) {\n env {\n name\n value\n secret\n alias\n inherited\n masked\n updatedAt\n }\n }\n }\n`);\n\nexport const SetWorkspaceSecretDocument = graphql(`\n mutation SdkSetWorkspaceSecret($workspaceID: ID!, $name: String!, $value: String!) {\n setWorkspaceSecret(input: { workspaceID: $workspaceID, name: $name, value: $value }) {\n env {\n name\n value\n secret\n alias\n inherited\n masked\n updatedAt\n }\n }\n }\n`);\n\nexport const DeleteWorkspaceEnvDocument = graphql(`\n mutation SdkDeleteWorkspaceEnv($workspaceID: ID!, $name: String!) {\n deleteWorkspaceEnv(input: { workspaceID: $workspaceID, name: $name }) {\n ok\n }\n }\n`);\n\nexport const ListWorkspaceEnvDocument = graphql(`\n query SdkListWorkspaceEnv($workspaceID: ID!) {\n workspaceEnv(workspaceID: $workspaceID) {\n name\n value\n secret\n alias\n inherited\n masked\n updatedAt\n }\n }\n`);\n\nexport const SetAppEnvDocument = graphql(`\n mutation SdkSetAppEnv($workspaceID: ID!, $alias: String!, $name: String!, $value: String!) {\n setAppEnv(input: { workspaceID: $workspaceID, alias: $alias, name: $name, value: $value }) {\n env {\n name\n value\n secret\n alias\n inherited\n masked\n updatedAt\n }\n }\n }\n`);\n\nexport const SetAppSecretDocument = graphql(`\n mutation SdkSetAppSecret($workspaceID: ID!, $alias: String!, $name: String!, $value: String!) {\n setAppSecret(input: { workspaceID: $workspaceID, alias: $alias, name: $name, value: $value }) {\n env {\n name\n value\n secret\n alias\n inherited\n masked\n updatedAt\n }\n }\n }\n`);\n\nexport const RemoveAppEnvDocument = graphql(`\n mutation SdkRemoveAppEnv($workspaceID: ID!, $alias: String!, $name: String!) {\n removeAppEnv(input: { workspaceID: $workspaceID, alias: $alias, name: $name }) {\n ok\n }\n }\n`);\n\nexport const InheritAppEnvDocument = graphql(`\n mutation SdkInheritAppEnv($workspaceID: ID!, $alias: String!, $name: String!) {\n inheritAppEnv(input: { workspaceID: $workspaceID, alias: $alias, name: $name }) {\n ok\n }\n }\n`);\n\nexport const ListAppEnvDocument = graphql(`\n query SdkListAppEnv($workspaceID: ID!, $alias: String!) {\n appEnv(workspaceID: $workspaceID, alias: $alias) {\n name\n value\n secret\n alias\n inherited\n masked\n updatedAt\n }\n }\n`);\n\n/* -------------------------------------------------------------------------\n * Agent runs\n *\n * A run is the past-tense counterpart to a deployment: \"boot a fresh VM,\n * hand it a prompt, let a harness work, keep the transcript, record what it\n * cost, reap the VM\". `createRun` returns once the VM has started\n * (RUNNING) or FAILED with `error` when it could not boot — unlike\n * `createDeployment`, a FAILED run is a normal return value, not something\n * that only shows up later in a poll.\n * ---------------------------------------------------------------------- */\n\n/** Run fields the SDK returns everywhere. */\nexport const RunFieldsFragment = graphql(`\n fragment RunFields on Run {\n id\n workspaceID\n ownerId\n status\n rawStatus\n command\n harness\n prompt\n setup\n skills\n verify\n approval\n mode\n access\n alias\n integrations {\n kind\n bindingID\n env\n skills\n mcpServers {\n name\n transport\n readOnly\n }\n }\n parentRunID\n depth\n question {\n id\n text\n options\n askedAt\n }\n memoryMiB\n maxSeconds\n metadata\n error\n exitCode\n result {\n status\n detail\n text\n }\n verifyExitCode\n vmID\n transcriptAvailable\n usage {\n vmSeconds\n memoryMiB\n mibSeconds\n }\n createdAt\n startedAt\n settledAt\n }\n`);\n\nexport const CreateRunDocument = graphql(`\n mutation SdkCreateRun($input: CreateRunInput!) {\n createRun(input: $input) {\n ...RunFields\n }\n }\n`);\n\nexport const GetRunDocument = graphql(`\n query SdkGetRun($id: ID!) {\n run(id: $id) {\n ...RunFields\n }\n }\n`);\n\n/**\n * The poll document, deliberately narrow — see {@link PollDeploymentDocument}\n * for why: this runs every few seconds for potentially up to an hour.\n */\nexport const PollRunDocument = graphql(`\n query SdkPollRun($id: ID!) {\n run(id: $id) {\n id\n status\n error\n exitCode\n }\n }\n`);\n\nexport const ListRunsDocument = graphql(`\n query SdkListRuns($input: ListRunsInput) {\n runs(input: $input) {\n items {\n ...RunFields\n }\n total\n limit\n offset\n hasMore\n nextOffset\n }\n }\n`);\n\nexport const CancelRunDocument = graphql(`\n mutation SdkCancelRun($id: ID!) {\n cancelRun(id: $id) {\n ...RunFields\n }\n }\n`);\n\nexport const RunEventsDocument = graphql(`\n query SdkRunEvents($runID: ID!, $limit: Int) {\n runEvents(runID: $runID, limit: $limit) {\n id\n runID\n type\n severity\n message\n metadata\n createdAt\n }\n }\n`);\n\n/** The live console tail of a RUNNING run. Empty with `running: false` once settled. */\nexport const RunConsoleDocument = graphql(`\n query SdkRunConsole($id: ID!, $tailBytes: Int) {\n runConsole(id: $id, tailBytes: $tailBytes) {\n runID\n running\n text\n }\n }\n`);\n\n/** The bounded end of a finished run's stored transcript. */\nexport const RunTranscriptDocument = graphql(`\n query SdkRunTranscript($id: ID!, $tailBytes: Int) {\n runTranscript(id: $id, tailBytes: $tailBytes) {\n runID\n available\n text\n totalBytes\n truncated\n }\n }\n`);\n\nexport const AnswerRunDocument = graphql(`\n mutation SdkAnswerRun($id: ID!, $answer: String!) {\n answerRun(id: $id, answer: $answer) {\n ...RunFields\n }\n }\n`);\n\nexport const FollowUpRunDocument = graphql(`\n mutation SdkFollowUpRun($input: FollowUpRunInput!) {\n followUpRun(input: $input) {\n ...RunFields\n }\n }\n`);\n\nexport const ListRunHarnessesDocument = graphql(`\n query SdkRunHarnesses {\n runHarnesses {\n name\n title\n summary\n requires\n }\n }\n`);\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { REFERENCE } from "./reference.generated.js";
|
|
2
|
+
export { REFERENCE };
|
|
3
|
+
/**
|
|
4
|
+
* The SDK's reference, for a script (or a model) that needs a signature:
|
|
5
|
+
* every method of {@link Unfazed} with its parameters, result and an
|
|
6
|
+
* example, in one page (REFERENCE.md). It describes THIS version, the one
|
|
7
|
+
* the script imported (`VERSION`): exactly what `help()` should answer.
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { help } from "unfazed";
|
|
11
|
+
* export default () => help("writeFiles"); // run_script returns the entry
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* `help()` is the whole page; `help(topic)` the entries whose heading names
|
|
15
|
+
* it (a method like `"restoreVersion"`, or a section like `"Events"`), or the
|
|
16
|
+
* list of methods when nothing matches.
|
|
17
|
+
*/
|
|
18
|
+
export declare function help(topic?: string): string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// GENERATED by scripts/embed-reference.ts from REFERENCE.md. Do not edit:
|
|
2
|
+
// change REFERENCE.md and run `bun run embed-reference`.
|
|
3
|
+
/** The SDK's reference: every method with its signature (REFERENCE.md). */
|
|
4
|
+
export const REFERENCE = "# unfazed SDK reference\n\nEvery method of `Unfazed`, with its signature, in one page. In a script:\n`import { Unfazed, help } from \"unfazed\"; const unfazed = new Unfazed();`\n(run_script injects the credential; elsewhere `UNFZ_API_TOKEN` or\n`npx unfazed login`). `help()` returns this page; `help(\"writeFiles\")` one\nentry. Methods are async and throw an `UnfazedError` subclass on failure.\nEvery method takes an optional last `options` with `signal` (and, for single\nrequests, `timeoutMs`). The names follow the MCP tools: `listCommits` is\n`list_commits`, `waitForEvents` is `wait_for_events`.\n\n```ts\nimport { Unfazed } from \"unfazed\";\n\nexport default async () => {\n const unfazed = new Unfazed();\n const ws = await unfazed.ensureWorkspace(\"hello\");\n const wrote = await unfazed.writeFiles(ws.id, {\n \"server.ts\": `export default { fetch: () => new Response(\"hi\") }`,\n \"package.json\": JSON.stringify({ name: \"hello\" }),\n }, { commitMessage: \"First version\" }); // ONE request, ONE commit\n const app = await unfazed.deployService({ workspaceId: ws.id, alias: \"hello\", wait: true });\n return { url: app.url, commit: wrote.commit?.sha, timings: app.timings };\n};\n```\n\n## Saved, committed, deployed\n\nA file write has three states. **Saved**: the call returned; the app's\nfiles have it and the next deploy uses it. **Committed**: on an app with\nplatform git, `commit.committed && !commit.waiting`; it is in `listCommits`.\n**Deployed**: a deploy of those files went READY (`deployService({ wait:\ntrue })`). A write never deploys by itself, except when `commit.deploys` is\ntrue (the branch head is imported like a push).\n\n`commit.waiting: true` means saved, with the commit queued for the git\nserver: it lands in order, `sha` is null until then, nothing to retry.\n`waitForCommit` (or `writeFiles(…, { waitForCommit: true })`) resolves once\nit landed.\n\n## Workspaces\n\n### `createWorkspace(name: string): Promise<Workspace>`\nA new workspace: files, env, deployments. Names are unique per owner,\ncase-insensitively; prefer `ensureWorkspace` in re-runnable scripts.\n\n### `ensureWorkspace(name: string): Promise<Workspace>`\nThe workspace named `name`, created only when missing. Safe to re-run.\n\n### `listWorkspaces(): Promise<Workspace[]>`\n\n### `liveApps(workspaceId: string): Promise<LiveApp[]>`\nThe apps the workspace serves now: `{ alias, deploymentID, domains }`.\n\n### `deleteWorkspace(workspaceId: string, options?: { withDeployments?: true, confirmAliases: string[], ignoreNotFound?: boolean }): Promise<boolean>`\nDeletes it; with `withDeployments`, every app it serves, which\n`confirmAliases` must name exactly (`liveApps`). Kept 30 days for support.\n\n### `deleteApp(app: { workspaceId, alias }, options?: { ignoreNotFound?: boolean }): Promise<DeleteAppResult>`\nDeletes one app (every deployment of the alias, its App State, env and\nbindings); the workspace and its other apps stay.\n\n### `whoami(): Promise<Whoami>`\nWho the token is, its scopes, usage and limits.\n\n## Files\n\n### `writeFiles(workspaceId: string, files: Record<string, string | { text } | { base64 } | { bytes }>, options?: { commitMessage?: string, waitForCommit?: boolean | WaitOptions, allowPartial?: boolean }): Promise<WriteFilesResult>`\nWrites every file in ONE request, which is ONE commit on an app with\nplatform git (MCP `write_workspace_files`). Result: `{ files: [{ path, ok,\nerror, file }], written, failed, totalBytes, commit, commits, landed? }`;\n`commit` is `{ sha, branch, message, committed, waiting, waitingCount,\ndeploys, conflicts, writeSHA, paused }` or null without platform git. Not\ntransactional: when a file fails it throws `UnfazedWriteError` (`.result`,\n`.failed`) unless `allowPartial`. Up to 100 files and 32 MiB per request; a\nbigger map is several requests, each a commit.\n\n```ts\nconst out = await unfazed.writeFiles(ws.id, { \"a.ts\": a, \"logo.png\": { bytes } }, { commitMessage: \"Logo\" });\nif (out.commit?.conflicts.length) console.log(\"a push changed\", out.commit.conflicts, \"mine:\", out.commit.writeSHA);\n```\n\n### `writeFile(workspaceId: string, path: string, text: string, options?: { commitMessage?, waitForCommit? }): Promise<WorkspaceFile & { commit }>`\nOne text file: `writeFiles` with one entry.\n\n### `writeBinaryFile(workspaceId: string, path: string, content: Uint8Array | ArrayBuffer | { base64: string }, options?): Promise<WorkspaceFile & { commit }>`\n\n### `waitForCommit(workspaceId: string, waitOptions?: WaitOptions): Promise<{ branch, head, waitedMs }>`\nResolves once no write of the app waits for its commit; `head` then has\nevery earlier write. Immediate (`head: null`) without platform git. Default\ntimeout 2 minutes (`UnfazedTimeoutError`; the writes stay saved).\n\n### `readFile(workspaceId: string, path: string, input?: { offset?, limit? }): Promise<{ text, totalBytes, truncated, nextOffset, file } | null>`\n\n### `listFiles(workspaceId: string, input?: { limit?, offset?, order? }): Promise<WorkspaceFilePage>`\n\n### `deleteFile(workspaceId: string, path: string): Promise<boolean>`\n`false` when there was nothing to delete.\n\n## Deploys\n\n### `deployService(options: { workspaceId, alias?, wait?, waitOptions?, timings?, runtime?, serviceMode?, healthPath?, cronSchedule?, cronPath? }): Promise<DeployResult>`\nBuilds and deploys the workspace as an HTTP service (`server.ts` default\nexport, or `unfazed.json`). Returns BUILDING at once; with `wait: true`,\nresolves READY or throws `UnfazedDeployError` (`reason` FAILED with the\nbuild error, or TIMEOUT; default 10 minutes). Every call is a new release;\nthe same `alias` redeploys that app.\n\nWith `wait: true` the result has `timings`:\n`{ client: { createMs, waitMs, totalMs, waitRequests, waitMode },\nplatform: { totalMs, buildMs, promoteMs, phases, buildMode,\nartifactTransport, buildMemoryMiB } }`, both in milliseconds. `platform` is\nwhat the platform measured (created to READY); `client` is what you waited.\nThe wait is server-side, so the two differ by about one round trip.\n\n```ts\nconst app = await unfazed.deployService({ workspaceId: ws.id, alias: \"api\", wait: true });\napp.timings?.platform?.phases; // { vm_install: 900, vm_build: 2600, admission: 40, … }\n```\n\n### `deployStatic(options: { workspaceId, alias?, wait?, spaMode? }): Promise<DeployResult>`\n\n### `deployBox(options: { workspaceId, alias, wait?, resources?: { memMiB?, vcpus?, diskGiB? } }): Promise<DeployResult>`\nA persistent Linux VM over SSH (`sshCommand`). Always pass `alias`.\n\n### `deploy(input: CreateDeploymentInput, options?: { wait?, waitOptions?, timings? }): Promise<DeployResult>`\nAny `createDeployment` input.\n\n### `waitForDeployment(deploymentId: string, waitOptions?: WaitOptions): Promise<Deployment>`\nWaits server-side (MCP `wait_for_deployment`: one request per 45 s at most,\nanswered when the status changes) until READY; throws `UnfazedDeployError`\non FAILED or timeout. A new app's landing on its server is waited for too.\n`waitOptions: { timeoutMs?, signal?, mode?: \"server\" | \"poll\" }`. The\nplatform holds at most 16 waits of one account at once; past that a wait\npolls instead.\n\n### `getDeployment(deploymentId: string): Promise<Deployment | null>`\n\n### `getDeploymentByAlias(alias: string): Promise<Deployment | null>`\n\n### `listDeployments(input?: { workspaceID?, alias?, kind?, limit?, offset? }): Promise<DeploymentPage>`\nNewest first.\n\n### `listReleases(alias: string): Promise<Deployment[]>`\nThe alias's history; `aliasHeld` marks the live one.\n\n### `rollback(options: { alias, to?, expectedCurrentId?, retries? }): Promise<Deployment>`\nPoints the alias back at a prior READY release (default: the one before\nthe live one). A bare `rollback({ alias })` toggles; pin `to` in anything\nre-runnable.\n\n### `deleteDeployment(deploymentId: string, options?: { ignoreNotFound? }): Promise<boolean>`\n\n## Runtime, logs, events, timings\n\n### `getStatus(deploymentId: string): Promise<ServiceStatus>`\n`{ running, health, inFlight, restartCount, memSizeMiB, lastError, … }`.\n\n### `getLogs(deploymentId: string, input?: { tailBytes? }): Promise<{ stdout, stderr, truncated, … }>`\nFilter in the script: `logs.stderr.split(\"\\n\").filter((l) => l.includes(\"ERROR\"))`.\n\n### `getEvents(deploymentId: string, limit?: number): Promise<DeploymentEvent[]>`\nThe latest `limit` (default 20) lifecycle events, oldest first: `{ type,\ntypeEnum, severity, message, vmID, metadata, createdAt }`. `type` is the\nevent's own name, as MCP reports it: `\"deployment.build_finished\"`,\n`\"deployment.phases\"`, `\"service.vm_started\"`. `typeEnum` is the GraphQL\nenum (`UNKNOWN` for names it lacks); match on `type`.\n\n### `getDeploymentTimings(deploymentId: string): Promise<PlatformTimings | null>`\nA deploy's measured phases (ms) from its timing events: `{ totalMs,\nbuildMs, promoteMs, phases, buildMode, artifactTransport, buildMemoryMiB }`.\n`parseDeploymentTimings(events)` does the same for events you already read.\n\n### `restartService(deploymentId: string)` / `stopService(deploymentId: string)`\n\n## Env and secrets\n\nSnapshotted into a release at deploy time: redeploy the alias to apply.\n\n### `setEnv(workspaceId, name, value)` / `setSecret(workspaceId, name, value)`: `Promise<EnvVar>`\nWorkspace defaults. A name is plain or secret, never both.\n\n### `setEnvMany(workspaceId: string, vars: Record<string, string>, options?: { secret?: boolean }): Promise<EnvVar[]>`\n\n### `deleteEnv(workspaceId, name): Promise<boolean>` / `listEnv(workspaceId): Promise<EnvVar[]>`\n\n### `setAppEnv(workspaceId, alias, name, value)` / `setAppSecret(workspaceId, alias, name, value)`: `Promise<EnvVar>`\nOne app's override.\n\n### `removeAppEnv(workspaceId, alias, name): Promise<boolean>`\nBlocks the name for the app (a mask). `inheritAppEnv` clears it.\n\n### `inheritAppEnv(workspaceId, alias, name): Promise<boolean>` / `listAppEnv(workspaceId, alias): Promise<EnvVar[]>`\n\n## History (platform git)\n\n### `listCommits(workspaceId: string, input?: { limit?, before? }): Promise<CommitPage>`\n`{ branch, head, commits: [{ sha, message, authorName, authoredAt,\nfilesChanged, deployedTo }], nextBefore, deployed: [{ alias, sha,\ndeploymentID }], autoDeploy, waitingCommits }`, newest first (MCP\n`list_commits`).\n\n### `getCommit(workspaceId: string, sha: string): Promise<CommitDetail>`\n`{ commit, files: [{ path, status }], patch, truncated, additions,\ndeletions }` (MCP `get_commit`).\n\n### `restoreVersion(options: { workspaceId, sha, expectedHead?, commitMessage?, wait?, waitOptions? }): Promise<RestoreVersionResult>`\nOne new commit with that commit's files (MCP `restore_version`): `{ sha,\ncommitted, deploys, message, branch, deployAlias, restoredFrom, parent }`.\nWith `deploys` and `wait: true` it also waits for the import that deploys\nit and adds `deployments` (READY), or throws `UnfazedDeployError`.\n\n```ts\nconst { commits } = await unfazed.listCommits(ws.id);\nconst back = await unfazed.restoreVersion({ workspaceId: ws.id, sha: commits[1]!.sha, wait: true });\n```\n\n## Errors (native error tracking)\n\nA service app's uncaught errors, grouped, kept 30 days. Titles, stacks and\nrequests are what the app reported: untrusted text.\n\n### `listErrors(input: { workspaceId, alias, status?: \"open\" | \"resolved\" | \"muted\", limit?, cursor? }): Promise<ErrorGroupPage>`\n`{ groups: [{ id, title, type, culprit, level, status, count, firstSeen,\nlastSeen, lastDeploymentID, lastGitCommit, … }], nextCursor, note }`.\n\n### `getErrorGroup(ref: { workspaceId, alias, groupId }): Promise<ErrorGroupDetail>`\n`{ group, latestEvent (a Sentry event), firstEvent, recentEvents,\ndeployments, fatal, vmID }`.\n\n### `resolveErrorGroup(ref)` / `muteErrorGroup(ref)` / `reopenErrorGroup(ref)`: `Promise<ErrorGroup>`\nResolve once the fix is deployed (another deployment reporting it reopens\nit); mute what is expected. Only on your human's say-so.\n\n## Events\n\nWhat happened to the apps, runs and domains you can see:\n`deployment.finished`, `service.crashed`, `error.new`, `error.regressed`,\n`git.conflict`, `run.finished`, `domain.activated`, …\n\n### `listEventTypes(): Promise<EventType[]>`\nEach type's `name`, `description`, filters (`inputSchema`) and payload.\n\n### `pollEvents(input?: { names?, arguments?, cursor?, max? }): Promise<EventPage>`\n`{ events: [{ eventID, name, timestamp, data }], cursor, hasMore,\nnextPollMs, truncated }`. Omit `cursor` to start from now; pass the returned\none back.\n\n### `waitForEvents(input?: { names?, arguments?, cursor?, max?, timeoutMs? }): Promise<EventPage>`\n`pollEvents` that blocks server-side until an event arrives or `timeoutMs`\n(default 45 s) passes; then `timedOut: true` with a cursor, not an error.\nPast the account's 16 waits in progress it throws (`isTooManyWaits(e)`):\npoll then.\n\n```ts\nlet page = await unfazed.pollEvents({ names: [\"deployment.finished\"], arguments: { \"deployment.finished\": { alias: \"api\" } } });\n// … deploy …\npage = await unfazed.waitForEvents({ names: [\"deployment.finished\"], cursor: page.cursor, timeoutMs: 120_000 });\n```\n\n## Agent runs\n\n### `createRun(options: { workspaceId, prompt?, harness?, command?, setup?, verify?, access?, alias?, maxSeconds?, wait? }): Promise<Run>`\nA one-shot agent run in a fresh VM. `wait: true` polls to SUCCEEDED,\nFAILED or CANCELLED (all returned, never thrown).\n\n### `waitForRun(runId: string, waitOptions?: WaitOptions): Promise<Run>`\n\n### `getRun(runId)` / `listRuns(filter?: { workspaceId?, status?, limit?, offset? })` / `cancelRun(runId)`\n\n### `followUpRun(runId: string, options: { prompt, mode?, wait? }): Promise<Run>`\n\n### `answerRun(runId: string, answer: string): Promise<Run>`\nAnswers a BLOCKED run's question.\n\n### `runEvents(runId)` / `runConsole(runId, { tailBytes? })` / `runTranscript(runId, { tailBytes? })`\n\n### `listRunHarnesses(): Promise<RunHarness[]>`\n\n## Anything else\n\n`unfazed.client` is the typed GraphQL transport over the same credential:\n`await unfazed.client.query(document, variables)`. `operations` exports\nevery document the SDK uses.\n";
|
|
5
|
+
//# sourceMappingURL=reference.generated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference.generated.js","sourceRoot":"","sources":["../src/reference.generated.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,yDAAyD;AAEzD,2EAA2E;AAC3E,MAAM,CAAC,MAAM,SAAS,GAAW,k6bAAk6b,CAAC","sourcesContent":["// GENERATED by scripts/embed-reference.ts from REFERENCE.md. Do not edit:\n// change REFERENCE.md and run `bun run embed-reference`.\n\n/** The SDK's reference: every method with its signature (REFERENCE.md). */\nexport const REFERENCE: string = \"# unfazed SDK reference\\n\\nEvery method of `Unfazed`, with its signature, in one page. In a script:\\n`import { Unfazed, help } from \\\"unfazed\\\"; const unfazed = new Unfazed();`\\n(run_script injects the credential; elsewhere `UNFZ_API_TOKEN` or\\n`npx unfazed login`). `help()` returns this page; `help(\\\"writeFiles\\\")` one\\nentry. Methods are async and throw an `UnfazedError` subclass on failure.\\nEvery method takes an optional last `options` with `signal` (and, for single\\nrequests, `timeoutMs`). The names follow the MCP tools: `listCommits` is\\n`list_commits`, `waitForEvents` is `wait_for_events`.\\n\\n```ts\\nimport { Unfazed } from \\\"unfazed\\\";\\n\\nexport default async () => {\\n const unfazed = new Unfazed();\\n const ws = await unfazed.ensureWorkspace(\\\"hello\\\");\\n const wrote = await unfazed.writeFiles(ws.id, {\\n \\\"server.ts\\\": `export default { fetch: () => new Response(\\\"hi\\\") }`,\\n \\\"package.json\\\": JSON.stringify({ name: \\\"hello\\\" }),\\n }, { commitMessage: \\\"First version\\\" }); // ONE request, ONE commit\\n const app = await unfazed.deployService({ workspaceId: ws.id, alias: \\\"hello\\\", wait: true });\\n return { url: app.url, commit: wrote.commit?.sha, timings: app.timings };\\n};\\n```\\n\\n## Saved, committed, deployed\\n\\nA file write has three states. **Saved**: the call returned; the app's\\nfiles have it and the next deploy uses it. **Committed**: on an app with\\nplatform git, `commit.committed && !commit.waiting`; it is in `listCommits`.\\n**Deployed**: a deploy of those files went READY (`deployService({ wait:\\ntrue })`). A write never deploys by itself, except when `commit.deploys` is\\ntrue (the branch head is imported like a push).\\n\\n`commit.waiting: true` means saved, with the commit queued for the git\\nserver: it lands in order, `sha` is null until then, nothing to retry.\\n`waitForCommit` (or `writeFiles(…, { waitForCommit: true })`) resolves once\\nit landed.\\n\\n## Workspaces\\n\\n### `createWorkspace(name: string): Promise<Workspace>`\\nA new workspace: files, env, deployments. Names are unique per owner,\\ncase-insensitively; prefer `ensureWorkspace` in re-runnable scripts.\\n\\n### `ensureWorkspace(name: string): Promise<Workspace>`\\nThe workspace named `name`, created only when missing. Safe to re-run.\\n\\n### `listWorkspaces(): Promise<Workspace[]>`\\n\\n### `liveApps(workspaceId: string): Promise<LiveApp[]>`\\nThe apps the workspace serves now: `{ alias, deploymentID, domains }`.\\n\\n### `deleteWorkspace(workspaceId: string, options?: { withDeployments?: true, confirmAliases: string[], ignoreNotFound?: boolean }): Promise<boolean>`\\nDeletes it; with `withDeployments`, every app it serves, which\\n`confirmAliases` must name exactly (`liveApps`). Kept 30 days for support.\\n\\n### `deleteApp(app: { workspaceId, alias }, options?: { ignoreNotFound?: boolean }): Promise<DeleteAppResult>`\\nDeletes one app (every deployment of the alias, its App State, env and\\nbindings); the workspace and its other apps stay.\\n\\n### `whoami(): Promise<Whoami>`\\nWho the token is, its scopes, usage and limits.\\n\\n## Files\\n\\n### `writeFiles(workspaceId: string, files: Record<string, string | { text } | { base64 } | { bytes }>, options?: { commitMessage?: string, waitForCommit?: boolean | WaitOptions, allowPartial?: boolean }): Promise<WriteFilesResult>`\\nWrites every file in ONE request, which is ONE commit on an app with\\nplatform git (MCP `write_workspace_files`). Result: `{ files: [{ path, ok,\\nerror, file }], written, failed, totalBytes, commit, commits, landed? }`;\\n`commit` is `{ sha, branch, message, committed, waiting, waitingCount,\\ndeploys, conflicts, writeSHA, paused }` or null without platform git. Not\\ntransactional: when a file fails it throws `UnfazedWriteError` (`.result`,\\n`.failed`) unless `allowPartial`. Up to 100 files and 32 MiB per request; a\\nbigger map is several requests, each a commit.\\n\\n```ts\\nconst out = await unfazed.writeFiles(ws.id, { \\\"a.ts\\\": a, \\\"logo.png\\\": { bytes } }, { commitMessage: \\\"Logo\\\" });\\nif (out.commit?.conflicts.length) console.log(\\\"a push changed\\\", out.commit.conflicts, \\\"mine:\\\", out.commit.writeSHA);\\n```\\n\\n### `writeFile(workspaceId: string, path: string, text: string, options?: { commitMessage?, waitForCommit? }): Promise<WorkspaceFile & { commit }>`\\nOne text file: `writeFiles` with one entry.\\n\\n### `writeBinaryFile(workspaceId: string, path: string, content: Uint8Array | ArrayBuffer | { base64: string }, options?): Promise<WorkspaceFile & { commit }>`\\n\\n### `waitForCommit(workspaceId: string, waitOptions?: WaitOptions): Promise<{ branch, head, waitedMs }>`\\nResolves once no write of the app waits for its commit; `head` then has\\nevery earlier write. Immediate (`head: null`) without platform git. Default\\ntimeout 2 minutes (`UnfazedTimeoutError`; the writes stay saved).\\n\\n### `readFile(workspaceId: string, path: string, input?: { offset?, limit? }): Promise<{ text, totalBytes, truncated, nextOffset, file } | null>`\\n\\n### `listFiles(workspaceId: string, input?: { limit?, offset?, order? }): Promise<WorkspaceFilePage>`\\n\\n### `deleteFile(workspaceId: string, path: string): Promise<boolean>`\\n`false` when there was nothing to delete.\\n\\n## Deploys\\n\\n### `deployService(options: { workspaceId, alias?, wait?, waitOptions?, timings?, runtime?, serviceMode?, healthPath?, cronSchedule?, cronPath? }): Promise<DeployResult>`\\nBuilds and deploys the workspace as an HTTP service (`server.ts` default\\nexport, or `unfazed.json`). Returns BUILDING at once; with `wait: true`,\\nresolves READY or throws `UnfazedDeployError` (`reason` FAILED with the\\nbuild error, or TIMEOUT; default 10 minutes). Every call is a new release;\\nthe same `alias` redeploys that app.\\n\\nWith `wait: true` the result has `timings`:\\n`{ client: { createMs, waitMs, totalMs, waitRequests, waitMode },\\nplatform: { totalMs, buildMs, promoteMs, phases, buildMode,\\nartifactTransport, buildMemoryMiB } }`, both in milliseconds. `platform` is\\nwhat the platform measured (created to READY); `client` is what you waited.\\nThe wait is server-side, so the two differ by about one round trip.\\n\\n```ts\\nconst app = await unfazed.deployService({ workspaceId: ws.id, alias: \\\"api\\\", wait: true });\\napp.timings?.platform?.phases; // { vm_install: 900, vm_build: 2600, admission: 40, … }\\n```\\n\\n### `deployStatic(options: { workspaceId, alias?, wait?, spaMode? }): Promise<DeployResult>`\\n\\n### `deployBox(options: { workspaceId, alias, wait?, resources?: { memMiB?, vcpus?, diskGiB? } }): Promise<DeployResult>`\\nA persistent Linux VM over SSH (`sshCommand`). Always pass `alias`.\\n\\n### `deploy(input: CreateDeploymentInput, options?: { wait?, waitOptions?, timings? }): Promise<DeployResult>`\\nAny `createDeployment` input.\\n\\n### `waitForDeployment(deploymentId: string, waitOptions?: WaitOptions): Promise<Deployment>`\\nWaits server-side (MCP `wait_for_deployment`: one request per 45 s at most,\\nanswered when the status changes) until READY; throws `UnfazedDeployError`\\non FAILED or timeout. A new app's landing on its server is waited for too.\\n`waitOptions: { timeoutMs?, signal?, mode?: \\\"server\\\" | \\\"poll\\\" }`. The\\nplatform holds at most 16 waits of one account at once; past that a wait\\npolls instead.\\n\\n### `getDeployment(deploymentId: string): Promise<Deployment | null>`\\n\\n### `getDeploymentByAlias(alias: string): Promise<Deployment | null>`\\n\\n### `listDeployments(input?: { workspaceID?, alias?, kind?, limit?, offset? }): Promise<DeploymentPage>`\\nNewest first.\\n\\n### `listReleases(alias: string): Promise<Deployment[]>`\\nThe alias's history; `aliasHeld` marks the live one.\\n\\n### `rollback(options: { alias, to?, expectedCurrentId?, retries? }): Promise<Deployment>`\\nPoints the alias back at a prior READY release (default: the one before\\nthe live one). A bare `rollback({ alias })` toggles; pin `to` in anything\\nre-runnable.\\n\\n### `deleteDeployment(deploymentId: string, options?: { ignoreNotFound? }): Promise<boolean>`\\n\\n## Runtime, logs, events, timings\\n\\n### `getStatus(deploymentId: string): Promise<ServiceStatus>`\\n`{ running, health, inFlight, restartCount, memSizeMiB, lastError, … }`.\\n\\n### `getLogs(deploymentId: string, input?: { tailBytes? }): Promise<{ stdout, stderr, truncated, … }>`\\nFilter in the script: `logs.stderr.split(\\\"\\\\n\\\").filter((l) => l.includes(\\\"ERROR\\\"))`.\\n\\n### `getEvents(deploymentId: string, limit?: number): Promise<DeploymentEvent[]>`\\nThe latest `limit` (default 20) lifecycle events, oldest first: `{ type,\\ntypeEnum, severity, message, vmID, metadata, createdAt }`. `type` is the\\nevent's own name, as MCP reports it: `\\\"deployment.build_finished\\\"`,\\n`\\\"deployment.phases\\\"`, `\\\"service.vm_started\\\"`. `typeEnum` is the GraphQL\\nenum (`UNKNOWN` for names it lacks); match on `type`.\\n\\n### `getDeploymentTimings(deploymentId: string): Promise<PlatformTimings | null>`\\nA deploy's measured phases (ms) from its timing events: `{ totalMs,\\nbuildMs, promoteMs, phases, buildMode, artifactTransport, buildMemoryMiB }`.\\n`parseDeploymentTimings(events)` does the same for events you already read.\\n\\n### `restartService(deploymentId: string)` / `stopService(deploymentId: string)`\\n\\n## Env and secrets\\n\\nSnapshotted into a release at deploy time: redeploy the alias to apply.\\n\\n### `setEnv(workspaceId, name, value)` / `setSecret(workspaceId, name, value)`: `Promise<EnvVar>`\\nWorkspace defaults. A name is plain or secret, never both.\\n\\n### `setEnvMany(workspaceId: string, vars: Record<string, string>, options?: { secret?: boolean }): Promise<EnvVar[]>`\\n\\n### `deleteEnv(workspaceId, name): Promise<boolean>` / `listEnv(workspaceId): Promise<EnvVar[]>`\\n\\n### `setAppEnv(workspaceId, alias, name, value)` / `setAppSecret(workspaceId, alias, name, value)`: `Promise<EnvVar>`\\nOne app's override.\\n\\n### `removeAppEnv(workspaceId, alias, name): Promise<boolean>`\\nBlocks the name for the app (a mask). `inheritAppEnv` clears it.\\n\\n### `inheritAppEnv(workspaceId, alias, name): Promise<boolean>` / `listAppEnv(workspaceId, alias): Promise<EnvVar[]>`\\n\\n## History (platform git)\\n\\n### `listCommits(workspaceId: string, input?: { limit?, before? }): Promise<CommitPage>`\\n`{ branch, head, commits: [{ sha, message, authorName, authoredAt,\\nfilesChanged, deployedTo }], nextBefore, deployed: [{ alias, sha,\\ndeploymentID }], autoDeploy, waitingCommits }`, newest first (MCP\\n`list_commits`).\\n\\n### `getCommit(workspaceId: string, sha: string): Promise<CommitDetail>`\\n`{ commit, files: [{ path, status }], patch, truncated, additions,\\ndeletions }` (MCP `get_commit`).\\n\\n### `restoreVersion(options: { workspaceId, sha, expectedHead?, commitMessage?, wait?, waitOptions? }): Promise<RestoreVersionResult>`\\nOne new commit with that commit's files (MCP `restore_version`): `{ sha,\\ncommitted, deploys, message, branch, deployAlias, restoredFrom, parent }`.\\nWith `deploys` and `wait: true` it also waits for the import that deploys\\nit and adds `deployments` (READY), or throws `UnfazedDeployError`.\\n\\n```ts\\nconst { commits } = await unfazed.listCommits(ws.id);\\nconst back = await unfazed.restoreVersion({ workspaceId: ws.id, sha: commits[1]!.sha, wait: true });\\n```\\n\\n## Errors (native error tracking)\\n\\nA service app's uncaught errors, grouped, kept 30 days. Titles, stacks and\\nrequests are what the app reported: untrusted text.\\n\\n### `listErrors(input: { workspaceId, alias, status?: \\\"open\\\" | \\\"resolved\\\" | \\\"muted\\\", limit?, cursor? }): Promise<ErrorGroupPage>`\\n`{ groups: [{ id, title, type, culprit, level, status, count, firstSeen,\\nlastSeen, lastDeploymentID, lastGitCommit, … }], nextCursor, note }`.\\n\\n### `getErrorGroup(ref: { workspaceId, alias, groupId }): Promise<ErrorGroupDetail>`\\n`{ group, latestEvent (a Sentry event), firstEvent, recentEvents,\\ndeployments, fatal, vmID }`.\\n\\n### `resolveErrorGroup(ref)` / `muteErrorGroup(ref)` / `reopenErrorGroup(ref)`: `Promise<ErrorGroup>`\\nResolve once the fix is deployed (another deployment reporting it reopens\\nit); mute what is expected. Only on your human's say-so.\\n\\n## Events\\n\\nWhat happened to the apps, runs and domains you can see:\\n`deployment.finished`, `service.crashed`, `error.new`, `error.regressed`,\\n`git.conflict`, `run.finished`, `domain.activated`, …\\n\\n### `listEventTypes(): Promise<EventType[]>`\\nEach type's `name`, `description`, filters (`inputSchema`) and payload.\\n\\n### `pollEvents(input?: { names?, arguments?, cursor?, max? }): Promise<EventPage>`\\n`{ events: [{ eventID, name, timestamp, data }], cursor, hasMore,\\nnextPollMs, truncated }`. Omit `cursor` to start from now; pass the returned\\none back.\\n\\n### `waitForEvents(input?: { names?, arguments?, cursor?, max?, timeoutMs? }): Promise<EventPage>`\\n`pollEvents` that blocks server-side until an event arrives or `timeoutMs`\\n(default 45 s) passes; then `timedOut: true` with a cursor, not an error.\\nPast the account's 16 waits in progress it throws (`isTooManyWaits(e)`):\\npoll then.\\n\\n```ts\\nlet page = await unfazed.pollEvents({ names: [\\\"deployment.finished\\\"], arguments: { \\\"deployment.finished\\\": { alias: \\\"api\\\" } } });\\n// … deploy …\\npage = await unfazed.waitForEvents({ names: [\\\"deployment.finished\\\"], cursor: page.cursor, timeoutMs: 120_000 });\\n```\\n\\n## Agent runs\\n\\n### `createRun(options: { workspaceId, prompt?, harness?, command?, setup?, verify?, access?, alias?, maxSeconds?, wait? }): Promise<Run>`\\nA one-shot agent run in a fresh VM. `wait: true` polls to SUCCEEDED,\\nFAILED or CANCELLED (all returned, never thrown).\\n\\n### `waitForRun(runId: string, waitOptions?: WaitOptions): Promise<Run>`\\n\\n### `getRun(runId)` / `listRuns(filter?: { workspaceId?, status?, limit?, offset? })` / `cancelRun(runId)`\\n\\n### `followUpRun(runId: string, options: { prompt, mode?, wait? }): Promise<Run>`\\n\\n### `answerRun(runId: string, answer: string): Promise<Run>`\\nAnswers a BLOCKED run's question.\\n\\n### `runEvents(runId)` / `runConsole(runId, { tailBytes? })` / `runTranscript(runId, { tailBytes? })`\\n\\n### `listRunHarnesses(): Promise<RunHarness[]>`\\n\\n## Anything else\\n\\n`unfazed.client` is the typed GraphQL transport over the same credential:\\n`await unfazed.client.query(document, variables)`. `operations` exports\\nevery document the SDK uses.\\n\";\n"]}
|