unfazed 0.6.1 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +124 -0
- package/README.md +201 -52
- package/REFERENCE.md +298 -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 +90 -2
- package/dist/generated/gql.js +24 -2
- package/dist/generated/gql.js.map +1 -1
- package/dist/generated/graphql.d.ts +586 -6
- package/dist/generated/graphql.js +526 -3
- 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 +144 -5
- package/dist/operations.js +448 -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 +599 -68
- package/dist/unfazed.js +842 -64
- 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 +1704 -30
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,MAAM,oBAAoB,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,OAAO,CAAC;;;;;;;;;;;;;;;;;;;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O,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,GAAG,OAAO,CAAC;;;;;;;;;;;CAW7C,CAAC,CAAC;AAEH;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,O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AAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CAAC;;;;;;;;;CAStC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAC;;;;;;;;;;;;;CAavC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iBAAiB,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 workspaceID\n branch\n deployAlias\n restoredFrom\n parent\n waitAfter\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/** A deploy's measured timeline in milliseconds, as the platform parsed it. */\nexport const DeploymentTimingsFieldsFragment = graphql(`\n fragment DeploymentTimingsFields on DeploymentTimings {\n totalMs\n buildMs\n promoteMs\n phases\n buildMode\n artifactTransport\n buildMemoryMiB\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` strings and, parsed by the platform, as `timings`, which\n * `parseDeploymentTimings` prefers.\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 timings {\n ...DeploymentTimingsFields\n }\n createdAt\n }\n }\n`);\n\n/**\n * A deployment's timeline as the platform reads it from ALL its events (the\n * latest of each timing event), not just a page of them.\n */\nexport const DeploymentTimingsDocument = graphql(`\n query SdkDeploymentTimings($id: ID!) {\n deployment(id: $id) {\n id\n timings {\n ...DeploymentTimingsFields\n }\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 *\n * By id it asks only for what every platform with the wait answers, so a\n * deploy's wait works on one from before the wait by commit too.\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\n/**\n * The same wait for the deploy a git import makes of a commit, which has no\n * id yet when a restore, push or sync answers: `deployment` is null until the\n * import made it (`status` IMPORTING), and stays null with `status` FAILED\n * and `importError` once the import failed on the commit. `after` counts only\n * deployments begun after that point of the platform's deployment order\n * (RestoreAppVersionPayload.waitAfter).\n */\nexport const WaitForCommitDeploymentDocument = graphql(`\n query SdkWaitForCommitDeployment(\n $workspaceID: ID!\n $gitCommit: String!\n $alias: String\n $after: Int\n $timeoutSeconds: Int\n ) {\n waitForDeployment(\n workspaceID: $workspaceID\n gitCommit: $gitCommit\n alias: $alias\n after: $after\n timeoutSeconds: $timeoutSeconds\n ) {\n status\n importStatus\n importError\n timedOut\n waitedMs\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(target: string | { workspaceId, gitCommit, alias?, after? }, 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\nby id polls instead.\n\nInstead of an id, name the deploy a git import makes of a commit (a\nrestore, a push or a sync deploys before any id exists): `{ workspaceId,\ngitCommit, alias?, after? }`. The wait covers the import too, and a failed\nimport throws `UnfazedDeployError` with its error. `alias` is required when\nseveral apps (`apps[]`) deployed the commit; `after` (a restore's\n`waitAfter`) counts only deployments begun after it.\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, timings, createdAt }`. `type`\nis the event'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`. A timing event's\n`timings` is what it measured, parsed by the platform; null otherwise.\n\n### `getDeploymentTimings(deploymentId: string): Promise<PlatformTimings | null>`\nA deploy's measured phases (ms), as the platform reads them from all its\ntiming events: `{ totalMs, buildMs, promoteMs, phases, buildMode,\nartifactTransport, buildMemoryMiB }`. `parseDeploymentTimings(events)` does\nthe same for events you already read, preferring each event's `timings`;\ndurations are whole, non-negative milliseconds (anything else is dropped).\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, workspaceID, branch, deployAlias,\nrestoredFrom, parent, waitAfter }`. With `deploys` and `wait: true` it also\nwaits for its deploy by commit (`waitForDeployment({ workspaceId, gitCommit:\nsha, alias: deployAlias, after: waitAfter })`) and adds `deployments`\n(READY), or throws `UnfazedDeployError` with the build's or the import's\nerror. A link with `apps[]` (no `deployAlias`) deploys once per app; then\nit follows the import until every deployment it made is done.\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,+3dAA+3d,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(target: string | { workspaceId, gitCommit, alias?, after? }, 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\\nby id polls instead.\\n\\nInstead of an id, name the deploy a git import makes of a commit (a\\nrestore, a push or a sync deploys before any id exists): `{ workspaceId,\\ngitCommit, alias?, after? }`. The wait covers the import too, and a failed\\nimport throws `UnfazedDeployError` with its error. `alias` is required when\\nseveral apps (`apps[]`) deployed the commit; `after` (a restore's\\n`waitAfter`) counts only deployments begun after it.\\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, timings, createdAt }`. `type`\\nis the event'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`. A timing event's\\n`timings` is what it measured, parsed by the platform; null otherwise.\\n\\n### `getDeploymentTimings(deploymentId: string): Promise<PlatformTimings | null>`\\nA deploy's measured phases (ms), as the platform reads them from all its\\ntiming events: `{ totalMs, buildMs, promoteMs, phases, buildMode,\\nartifactTransport, buildMemoryMiB }`. `parseDeploymentTimings(events)` does\\nthe same for events you already read, preferring each event's `timings`;\\ndurations are whole, non-negative milliseconds (anything else is dropped).\\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, workspaceID, branch, deployAlias,\\nrestoredFrom, parent, waitAfter }`. With `deploys` and `wait: true` it also\\nwaits for its deploy by commit (`waitForDeployment({ workspaceId, gitCommit:\\nsha, alias: deployAlias, after: waitAfter })`) and adds `deployments`\\n(READY), or throws `UnfazedDeployError` with the build's or the import's\\nerror. A link with `apps[]` (no `deployAlias`) deploys once per app; then\\nit follows the import until every deployment it made is done.\\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"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
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 function help(topic) {
|
|
19
|
+
if (!topic)
|
|
20
|
+
return REFERENCE;
|
|
21
|
+
const wanted = topic.trim().replace(/\(\)$/, "").toLowerCase();
|
|
22
|
+
const firstLine = (block) => block.split("\n", 1)[0].toLowerCase();
|
|
23
|
+
// A section ("Events", "Files"): the whole of it.
|
|
24
|
+
const section = REFERENCE.split(/\n(?=## )/).find((block) => firstLine(block) === `## ${wanted}`);
|
|
25
|
+
if (section)
|
|
26
|
+
return section.trim() + "\n";
|
|
27
|
+
// A method: every entry whose heading names it.
|
|
28
|
+
const method = new RegExp(`\`${escape(wanted)}\\(|[ /]${escape(wanted)}\\(`);
|
|
29
|
+
const matches = REFERENCE.split(/\n(?=#{2,3} )/).filter((block) => block.startsWith("### ") && method.test(firstLine(block)));
|
|
30
|
+
if (matches.length > 0)
|
|
31
|
+
return matches.map((block) => block.trim()).join("\n\n") + "\n";
|
|
32
|
+
const names = [...REFERENCE.matchAll(/^### `(\w+)\(/gm)].map((m) => m[1]);
|
|
33
|
+
return `No entry for "${topic}". Methods: ${names.join(", ")}. help() returns the whole reference.\n`;
|
|
34
|
+
}
|
|
35
|
+
function escape(text) {
|
|
36
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=reference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference.js","sourceRoot":"","sources":["../src/reference.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,OAAO,EAAE,SAAS,EAAE,CAAC;AAErB;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,IAAI,CAAC,KAAc;IACjC,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IAC/D,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAE,CAAC,WAAW,EAAE,CAAC;IAC5E,kDAAkD;IAClD,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,MAAM,MAAM,EAAE,CAAC,CAAC;IAClG,IAAI,OAAO;QAAE,OAAO,OAAO,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC;IAC1C,gDAAgD;IAChD,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,WAAW,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7E,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,MAAM,CACrD,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CACrE,CAAC;IACF,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IACxF,MAAM,KAAK,GAAG,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1E,OAAO,iBAAiB,KAAK,eAAe,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,yCAAyC,CAAC;AACxG,CAAC;AAED,SAAS,MAAM,CAAC,IAAY;IAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AACrD,CAAC","sourcesContent":["import { REFERENCE } from \"./reference.generated.js\";\n\nexport { REFERENCE };\n\n/**\n * The SDK's reference, for a script (or a model) that needs a signature:\n * every method of {@link Unfazed} with its parameters, result and an\n * example, in one page (REFERENCE.md). It describes THIS version, the one\n * the script imported (`VERSION`): exactly what `help()` should answer.\n *\n * ```ts\n * import { help } from \"unfazed\";\n * export default () => help(\"writeFiles\"); // run_script returns the entry\n * ```\n *\n * `help()` is the whole page; `help(topic)` the entries whose heading names\n * it (a method like `\"restoreVersion\"`, or a section like `\"Events\"`), or the\n * list of methods when nothing matches.\n */\nexport function help(topic?: string): string {\n if (!topic) return REFERENCE;\n const wanted = topic.trim().replace(/\\(\\)$/, \"\").toLowerCase();\n const firstLine = (block: string) => block.split(\"\\n\", 1)[0]!.toLowerCase();\n // A section (\"Events\", \"Files\"): the whole of it.\n const section = REFERENCE.split(/\\n(?=## )/).find((block) => firstLine(block) === `## ${wanted}`);\n if (section) return section.trim() + \"\\n\";\n // A method: every entry whose heading names it.\n const method = new RegExp(`\\`${escape(wanted)}\\\\(|[ /]${escape(wanted)}\\\\(`);\n const matches = REFERENCE.split(/\\n(?=#{2,3} )/).filter(\n (block) => block.startsWith(\"### \") && method.test(firstLine(block)),\n );\n if (matches.length > 0) return matches.map((block) => block.trim()).join(\"\\n\\n\") + \"\\n\";\n const names = [...REFERENCE.matchAll(/^### `(\\w+)\\(/gm)].map((m) => m[1]);\n return `No entry for \"${topic}\". Methods: ${names.join(\", \")}. help() returns the whole reference.\\n`;\n}\n\nfunction escape(text: string): string {\n return text.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n"]}
|