@qawolf/api-contracts 0.47.0 → 0.51.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/dist/v1/agent/get.d.ts +1 -1
- package/dist/v1/agent/get.d.ts.map +1 -1
- package/dist/v1/agent/get.js +4 -2
- package/dist/v1/agent/get.js.map +1 -1
- package/dist/v1/agent/send.d.ts +1 -1
- package/dist/v1/agent/send.d.ts.map +1 -1
- package/dist/v1/agent/send.js +4 -2
- package/dist/v1/agent/send.js.map +1 -1
- package/dist/v1/email/listAddresses.d.ts.map +1 -1
- package/dist/v1/email/listAddresses.js +2 -10
- package/dist/v1/email/listAddresses.js.map +1 -1
- package/dist/v1/email/registerAddress.d.ts +19 -0
- package/dist/v1/email/registerAddress.d.ts.map +1 -0
- package/dist/v1/email/registerAddress.js +30 -0
- package/dist/v1/email/registerAddress.js.map +1 -0
- package/dist/v1/email/resource.d.ts +5 -0
- package/dist/v1/email/resource.d.ts.map +1 -1
- package/dist/v1/email/resource.js +10 -0
- package/dist/v1/email/resource.js.map +1 -1
- package/dist/v1/index.d.ts +110 -10
- package/dist/v1/index.d.ts.map +1 -1
- package/dist/v1/index.js +18 -14
- package/dist/v1/index.js.map +1 -1
- package/dist/v1/run/stop.d.ts +22 -0
- package/dist/v1/run/stop.d.ts.map +1 -0
- package/dist/v1/run/stop.js +19 -0
- package/dist/v1/run/stop.js.map +1 -0
- package/dist/v1/runner/evaluateSnippet.d.ts +5 -1
- package/dist/v1/runner/evaluateSnippet.d.ts.map +1 -1
- package/dist/v1/runner/evaluateSnippet.js +5 -2
- package/dist/v1/runner/evaluateSnippet.js.map +1 -1
- package/dist/v1/runner/get.d.ts +5 -1
- package/dist/v1/runner/get.d.ts.map +1 -1
- package/dist/v1/runner/get.js +5 -2
- package/dist/v1/runner/get.js.map +1 -1
- package/dist/v1/runner/highlightSelector.d.ts +5 -1
- package/dist/v1/runner/highlightSelector.d.ts.map +1 -1
- package/dist/v1/runner/highlightSelector.js +5 -2
- package/dist/v1/runner/highlightSelector.js.map +1 -1
- package/dist/v1/runner/identity.d.ts +2 -0
- package/dist/v1/runner/identity.d.ts.map +1 -1
- package/dist/v1/runner/identity.js +2 -0
- package/dist/v1/runner/identity.js.map +1 -1
- package/dist/v1/runner/importPackage.d.ts +5 -1
- package/dist/v1/runner/importPackage.d.ts.map +1 -1
- package/dist/v1/runner/importPackage.js +5 -2
- package/dist/v1/runner/importPackage.js.map +1 -1
- package/dist/v1/runner/index.d.ts +9 -2
- package/dist/v1/runner/index.d.ts.map +1 -1
- package/dist/v1/runner/index.js +9 -3
- package/dist/v1/runner/index.js.map +1 -1
- package/dist/v1/runner/inspect.d.ts +5 -1
- package/dist/v1/runner/inspect.d.ts.map +1 -1
- package/dist/v1/runner/inspect.js +5 -2
- package/dist/v1/runner/inspect.js.map +1 -1
- package/dist/v1/runner/inspectMobile.d.ts +5 -1
- package/dist/v1/runner/inspectMobile.d.ts.map +1 -1
- package/dist/v1/runner/inspectMobile.js +5 -2
- package/dist/v1/runner/inspectMobile.js.map +1 -1
- package/dist/v1/runner/journal.d.ts +5 -1
- package/dist/v1/runner/journal.d.ts.map +1 -1
- package/dist/v1/runner/journal.js.map +1 -1
- package/dist/v1/runner/list.d.ts +8 -3
- package/dist/v1/runner/list.d.ts.map +1 -1
- package/dist/v1/runner/list.js +8 -4
- package/dist/v1/runner/list.js.map +1 -1
- package/dist/v1/runner/performAction.d.ts +9 -2
- package/dist/v1/runner/performAction.d.ts.map +1 -1
- package/dist/v1/runner/performAction.js +18 -5
- package/dist/v1/runner/performAction.js.map +1 -1
- package/dist/v1/runner/promoteSnapshot.d.ts +5 -1
- package/dist/v1/runner/promoteSnapshot.d.ts.map +1 -1
- package/dist/v1/runner/promoteSnapshot.js +5 -2
- package/dist/v1/runner/promoteSnapshot.js.map +1 -1
- package/dist/v1/runner/readJournal.d.ts +5 -1
- package/dist/v1/runner/readJournal.d.ts.map +1 -1
- package/dist/v1/runner/readJournal.js +5 -2
- package/dist/v1/runner/readJournal.js.map +1 -1
- package/dist/v1/runner/runFlow.d.ts +3 -1
- package/dist/v1/runner/runFlow.d.ts.map +1 -1
- package/dist/v1/runner/runFlow.js +4 -1
- package/dist/v1/runner/runFlow.js.map +1 -1
- package/dist/v1/runner/screen.d.ts +8 -0
- package/dist/v1/runner/screen.d.ts.map +1 -1
- package/dist/v1/runner/screen.js +11 -0
- package/dist/v1/runner/screen.js.map +1 -1
- package/dist/v1/runner/stopRun.d.ts +5 -1
- package/dist/v1/runner/stopRun.d.ts.map +1 -1
- package/dist/v1/runner/stopRun.js +5 -2
- package/dist/v1/runner/stopRun.js.map +1 -1
- package/dist/v1/runner/takeScreenshot.d.ts +5 -1
- package/dist/v1/runner/takeScreenshot.d.ts.map +1 -1
- package/dist/v1/runner/takeScreenshot.js +7 -11
- package/dist/v1/runner/takeScreenshot.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import type { PublicIdSchema } from "../ids.js";
|
|
2
3
|
/** How much of a failure reason this API passes on. */
|
|
3
4
|
export declare const maxActionErrorMessageLength = 1000;
|
|
4
|
-
export declare const makePerformActionOnRunnerContract: (
|
|
5
|
-
|
|
5
|
+
export declare const makePerformActionOnRunnerContract: <WorkspaceId extends PublicIdSchema>(ids: {
|
|
6
|
+
workspace: WorkspaceId;
|
|
7
|
+
}) => {
|
|
8
|
+
readonly description: "Perform one raw browser action on an interactive runner: click, double_click, move, drag, scroll, keypress, type, or navigate. Coordinates are whole pixels on the runner's virtual desktop, in the same space as `runner.takeScreenshot`. One action per request, and the runner serves one at a time. The action shapes follow the computer-use vocabulary, minus `screenshot` (use `runner.takeScreenshot`) and `wait` (delay on the caller's side). A success means the action took effect. `action-failed`, with a reason, if it reached the runner and did not take effect. On a runner image with a browser, the first action on a runner that has never run anything starts its browser and waits for it, so it can take up to a minute to answer — no `runner.runFlow` is needed before acting; if the browser is still starting when the wait runs out, the answer is `screen-not-ready` and retrying converges. On a mobile runner, the same `screen-needs-a-run` and `screen-not-ready` outcomes mean no Appium session has started yet, or it did not answer this instant; `runner.runFlow` is what starts one, same as a browser. `screen-needs-a-run` if the browser could not be started that way — usually a runner whose runs all finished without starting its desktop; call `runner.runFlow` with a flow that opens a browser. `screen-not-ready` if the runner has a screen that cannot serve this instant. Retry in a second or two: the desktop restarts when a run changes the display size, and it serves one see-or-act request at a time, so a screenshot or action already in flight is the usual reason. Do not submit a run to clear this — a run may restart the display and discard what is on it. A `navigate` does not go through the screen, so a screen that is not ready does not stop it. `runner-has-no-screen` if this runner is not one that runs a browser on a virtual desktop. Nothing about it can be seen or driven, and retrying will never help — launch a `playwright` runner instead. `action-not-supported-on-mobile` if the runner is a mobile device and this action has no touchscreen equivalent: `double_click`, `scroll`, `move`, `keypress` and `navigate`, and a `click` whose `button` is not `left`, are all pointer-device concepts a touchscreen has nothing to offer for. `click` taps, `drag` swipes between its path's first and last point, and `type` types into whatever the last tap focused. With `withScreenshot: true`, the answer also carries `imageJpegBase64`: a screenshot taken after the action, once the screen has changed from just before it or half a second has passed, whichever comes first. One call instead of `runner.performAction` followed by `runner.takeScreenshot`, with no fixed wait in between. Anything animating on the page counts as a change. The action itself is performed exactly as without the option; if the screen could serve no frame after it — a display restart, or a `navigate` on a desktop that is still starting — the action's result comes back without `imageJpegBase64`, so take a screenshot separately rather than repeating the action. On a mobile runner the screenshot is the device's own, taken right after a performed action. `runner-unreachable` if the runner could not be reached: it may still be starting, it may have terminated after inactivity, or it may have stopped answering mid-action. This does not mean the action was not performed — take a screenshot before repeating it.";
|
|
6
9
|
readonly input: z.ZodObject<{
|
|
7
10
|
action: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
8
11
|
button: z.ZodLiteral<"left" | "right" | "wheel" | "back" | "forward">;
|
|
@@ -40,14 +43,18 @@ export declare const makePerformActionOnRunnerContract: () => {
|
|
|
40
43
|
type: z.ZodLiteral<"type">;
|
|
41
44
|
}, z.core.$strict>], "type">;
|
|
42
45
|
id: z.ZodString;
|
|
46
|
+
withScreenshot: z.ZodOptional<z.ZodBoolean>;
|
|
47
|
+
workspaceId: z.ZodOptional<WorkspaceId>;
|
|
43
48
|
}, z.core.$strip>;
|
|
44
49
|
readonly kind: "write";
|
|
45
50
|
readonly name: "runner.performAction";
|
|
46
51
|
readonly output: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
52
|
+
imageJpegBase64: z.ZodOptional<z.ZodString>;
|
|
47
53
|
outcome: z.ZodLiteral<"success">;
|
|
48
54
|
}, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
49
55
|
errorMessage: z.ZodString;
|
|
50
56
|
failureReason: z.ZodLiteral<"action-failed">;
|
|
57
|
+
imageJpegBase64: z.ZodOptional<z.ZodString>;
|
|
51
58
|
outcome: z.ZodLiteral<"failure">;
|
|
52
59
|
}, z.core.$strip>, z.ZodObject<{
|
|
53
60
|
failureReason: z.ZodEnum<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"performAction.d.ts","sourceRoot":"","sources":["../../../src/v1/runner/performAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"performAction.d.ts","sourceRoot":"","sources":["../../../src/v1/runner/performAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAwBhD,uDAAuD;AACvD,eAAO,MAAM,2BAA2B,OAAQ,CAAC;AAEjD,eAAO,MAAM,iCAAiC,GAC5C,WAAW,SAAS,cAAc,EAClC,KAAK;IACL,SAAS,EAAE,WAAW,CAAC;CACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0DA,CAAC"}
|
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { browserActionSchema } from "./browserAction.js";
|
|
3
|
-
import { runnerIdSchema } from "./identity.js";
|
|
3
|
+
import { runnerIdSchema, runnerWorkspaceIdDescription } from "./identity.js";
|
|
4
4
|
import { makeRunnerFailureSchema } from "./outcome.js";
|
|
5
|
-
import { runnerHasNoScreenDescription, screenFailureReasons, screenNotReadyDescription, } from "./screen.js";
|
|
5
|
+
import { runnerHasNoScreenDescription, screenFailureReasons, screenNotReadyDescription, screenshotImageSchema, } from "./screen.js";
|
|
6
6
|
import { runnerUnreachableFailureReason } from "./unreachable.js";
|
|
7
7
|
// Not the shared retryable wording: the action may have taken effect before its
|
|
8
8
|
// answer was lost.
|
|
9
9
|
const unreachableDescription = "`runner-unreachable` if the runner could not be reached: it may still be starting, it may have terminated after inactivity, or it may have stopped answering mid-action. This does not mean the action was not performed — take a screenshot before repeating it.";
|
|
10
10
|
const notSupportedOnMobileDescription = "`action-not-supported-on-mobile` if the runner is a mobile device and this action has no touchscreen equivalent: `double_click`, `scroll`, `move`, `keypress` and `navigate`, and a `click` whose `button` is not `left`, are all pointer-device concepts a touchscreen has nothing to offer for. `click` taps, `drag` swipes between its path's first and last point, and `type` types into whatever the last tap focused.";
|
|
11
|
+
const withScreenshotDescription = "With `withScreenshot: true`, the answer also carries `imageJpegBase64`: a screenshot taken after the action, once the screen has changed from just before it or half a second has passed, whichever comes first. One call instead of `runner.performAction` followed by `runner.takeScreenshot`, with no fixed wait in between. Anything animating on the page counts as a change. The action itself is performed exactly as without the option; if the screen could serve no frame after it — a display restart, or a `navigate` on a desktop that is still starting — the action's result comes back without `imageJpegBase64`, so take a screenshot separately rather than repeating the action. On a mobile runner the screenshot is the device's own, taken right after a performed action.";
|
|
11
12
|
/** How much of a failure reason this API passes on. */
|
|
12
13
|
export const maxActionErrorMessageLength = 1_000;
|
|
13
|
-
export const makePerformActionOnRunnerContract = () => {
|
|
14
|
+
export const makePerformActionOnRunnerContract = (ids) => {
|
|
14
15
|
const input = z.object({
|
|
15
16
|
action: browserActionSchema.describe("The action to perform. Coordinates are pixels on the screenshot's own coordinate space."),
|
|
16
17
|
id: runnerIdSchema.describe("Id of the runner to act on."),
|
|
18
|
+
withScreenshot: z
|
|
19
|
+
.boolean()
|
|
20
|
+
.optional()
|
|
21
|
+
.describe("Also answer with a screenshot taken after the action, once the screen has changed or half a second has passed. Saves the separate `runner.takeScreenshot` call and its fixed wait."),
|
|
22
|
+
workspaceId: ids.workspace
|
|
23
|
+
.optional()
|
|
24
|
+
.describe(runnerWorkspaceIdDescription),
|
|
17
25
|
});
|
|
26
|
+
const screenshotAfterAction = screenshotImageSchema.optional();
|
|
18
27
|
// `action-failed` is the one reason that carries a message, so it is an arm of
|
|
19
28
|
// its own and the other reasons share theirs.
|
|
20
29
|
const failure = z.discriminatedUnion("failureReason", [
|
|
@@ -24,6 +33,7 @@ export const makePerformActionOnRunnerContract = () => {
|
|
|
24
33
|
.max(maxActionErrorMessageLength)
|
|
25
34
|
.describe("What stopped the action from taking effect."),
|
|
26
35
|
failureReason: z.literal("action-failed"),
|
|
36
|
+
imageJpegBase64: screenshotAfterAction,
|
|
27
37
|
outcome: z.literal("failure"),
|
|
28
38
|
}),
|
|
29
39
|
makeRunnerFailureSchema([
|
|
@@ -33,11 +43,14 @@ export const makePerformActionOnRunnerContract = () => {
|
|
|
33
43
|
]),
|
|
34
44
|
]);
|
|
35
45
|
const output = z.discriminatedUnion("outcome", [
|
|
36
|
-
z.object({
|
|
46
|
+
z.object({
|
|
47
|
+
imageJpegBase64: screenshotAfterAction,
|
|
48
|
+
outcome: z.literal("success"),
|
|
49
|
+
}),
|
|
37
50
|
failure,
|
|
38
51
|
]);
|
|
39
52
|
return {
|
|
40
|
-
description: `Perform one raw browser action on an interactive runner: click, double_click, move, drag, scroll, keypress, type, or navigate. Coordinates are whole pixels on the runner's virtual desktop, in the same space as \`runner.takeScreenshot\`. One action per request, and the runner serves one at a time. The action shapes follow the computer-use vocabulary, minus \`screenshot\` (use \`runner.takeScreenshot\`) and \`wait\` (delay on the caller's side). A success means the action took effect. \`action-failed\`, with a reason, if it reached the runner and did not take effect. On a runner image with a browser, the first action on a runner that has never run anything starts its browser and waits for it, so it can take up to a minute to answer — no \`runner.runFlow\` is needed before acting; if the browser is still starting when the wait runs out, the answer is \`screen-not-ready\` and retrying converges. On a mobile runner, the same \`screen-needs-a-run\` and \`screen-not-ready\` outcomes mean no Appium session has started yet, or it did not answer this instant; \`runner.runFlow\` is what starts one, same as a browser. \`screen-needs-a-run\` if the browser could not be started that way — usually a runner whose runs all finished without starting its desktop; call \`runner.runFlow\` with a flow that opens a browser. ${screenNotReadyDescription} A \`navigate\` does not go through the screen, so a screen that is not ready does not stop it. ${runnerHasNoScreenDescription} ${notSupportedOnMobileDescription} ${unreachableDescription}`,
|
|
53
|
+
description: `Perform one raw browser action on an interactive runner: click, double_click, move, drag, scroll, keypress, type, or navigate. Coordinates are whole pixels on the runner's virtual desktop, in the same space as \`runner.takeScreenshot\`. One action per request, and the runner serves one at a time. The action shapes follow the computer-use vocabulary, minus \`screenshot\` (use \`runner.takeScreenshot\`) and \`wait\` (delay on the caller's side). A success means the action took effect. \`action-failed\`, with a reason, if it reached the runner and did not take effect. On a runner image with a browser, the first action on a runner that has never run anything starts its browser and waits for it, so it can take up to a minute to answer — no \`runner.runFlow\` is needed before acting; if the browser is still starting when the wait runs out, the answer is \`screen-not-ready\` and retrying converges. On a mobile runner, the same \`screen-needs-a-run\` and \`screen-not-ready\` outcomes mean no Appium session has started yet, or it did not answer this instant; \`runner.runFlow\` is what starts one, same as a browser. \`screen-needs-a-run\` if the browser could not be started that way — usually a runner whose runs all finished without starting its desktop; call \`runner.runFlow\` with a flow that opens a browser. ${screenNotReadyDescription} A \`navigate\` does not go through the screen, so a screen that is not ready does not stop it. ${runnerHasNoScreenDescription} ${notSupportedOnMobileDescription} ${withScreenshotDescription} ${unreachableDescription}`,
|
|
41
54
|
input,
|
|
42
55
|
kind: "write",
|
|
43
56
|
name: "runner.performAction",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"performAction.js","sourceRoot":"","sources":["../../../src/v1/runner/performAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"performAction.js","sourceRoot":"","sources":["../../../src/v1/runner/performAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EACL,4BAA4B,EAC5B,oBAAoB,EACpB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAC;AAElE,gFAAgF;AAChF,mBAAmB;AACnB,MAAM,sBAAsB,GAC1B,mQAAmQ,CAAC;AAEtQ,MAAM,+BAA+B,GACnC,6ZAA6Z,CAAC;AAEha,MAAM,yBAAyB,GAC7B,kwBAAkwB,CAAC;AAErwB,uDAAuD;AACvD,MAAM,CAAC,MAAM,2BAA2B,GAAG,KAAK,CAAC;AAEjD,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAE/C,GAED,EAAE,EAAE;IACH,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC;QACrB,MAAM,EAAE,mBAAmB,CAAC,QAAQ,CAClC,yFAAyF,CAC1F;QACD,EAAE,EAAE,cAAc,CAAC,QAAQ,CAAC,6BAA6B,CAAC;QAC1D,cAAc,EAAE,CAAC;aACd,OAAO,EAAE;aACT,QAAQ,EAAE;aACV,QAAQ,CACP,oLAAoL,CACrL;QACH,WAAW,EAAE,GAAG,CAAC,SAAS;aACvB,QAAQ,EAAE;aACV,QAAQ,CAAC,4BAA4B,CAAC;KAC1C,CAAC,CAAC;IAEH,MAAM,qBAAqB,GAAG,qBAAqB,CAAC,QAAQ,EAAE,CAAC;IAE/D,+EAA+E;IAC/E,8CAA8C;IAC9C,MAAM,OAAO,GAAG,CAAC,CAAC,kBAAkB,CAAC,eAAe,EAAE;QACpD,CAAC,CAAC,MAAM,CAAC;YACP,YAAY,EAAE,CAAC;iBACZ,MAAM,EAAE;iBACR,GAAG,CAAC,2BAA2B,CAAC;iBAChC,QAAQ,CAAC,6CAA6C,CAAC;YAC1D,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC;YACzC,eAAe,EAAE,qBAAqB;YACtC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;SAC9B,CAAC;QACF,uBAAuB,CAAC;YACtB,GAAG,oBAAoB;YACvB,gCAAgC;YAChC,8BAA8B;SAC/B,CAAC;KACH,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,CAAC,CAAC,kBAAkB,CAAC,SAAS,EAAE;QAC7C,CAAC,CAAC,MAAM,CAAC;YACP,eAAe,EAAE,qBAAqB;YACtC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;SAC9B,CAAC;QACF,OAAO;KACR,CAAC,CAAC;IAEH,OAAO;QACL,WAAW,EAAE,8yCAA8yC,yBAAyB,mGAAmG,4BAA4B,IAAI,+BAA+B,IAAI,yBAAyB,IAAI,sBAAsB,EAAE;QAC/iD,KAAK;QACL,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,sBAAsB;QAC5B,MAAM;KAMP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import type { PublicIdSchema } from "../ids.js";
|
|
2
3
|
/** A path within the run's own screenshot storage, not a filesystem path. */
|
|
3
4
|
export declare const maxSnapshotPathLength = 1024;
|
|
4
|
-
export declare const makePromoteSnapshotOnRunnerContract: (
|
|
5
|
+
export declare const makePromoteSnapshotOnRunnerContract: <WorkspaceId extends PublicIdSchema>(ids: {
|
|
6
|
+
workspace: WorkspaceId;
|
|
7
|
+
}) => {
|
|
5
8
|
readonly description: "Accept a run's screenshot as the new baseline for an image diff, on the runner that produced it. The two paths are the ones the diff reported, which reach a caller as an `image-diff-artifact` entry on the runner's `run-events` journal stream. `snapshot-not-found` if the run wrote no screenshot at that path, which usually means the paths were not taken from a diff this run produced; nothing is changed, so correcting the path and repeating is safe. `runner-cannot-promote-snapshots` on a runner that stores no screenshots. `runner-unreachable` if the runner could not be reached: it may still be starting, or it may have terminated after inactivity. A promotion that lands is not undone by promoting again, so a retry after an unreachable answer is safe.";
|
|
6
9
|
readonly input: z.ZodObject<{
|
|
7
10
|
baselinePath: z.ZodString;
|
|
8
11
|
id: z.ZodString;
|
|
9
12
|
screenshotPath: z.ZodString;
|
|
13
|
+
workspaceId: z.ZodOptional<WorkspaceId>;
|
|
10
14
|
}, z.core.$strip>;
|
|
11
15
|
readonly kind: "write";
|
|
12
16
|
readonly name: "runner.promoteSnapshot";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promoteSnapshot.d.ts","sourceRoot":"","sources":["../../../src/v1/runner/promoteSnapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"promoteSnapshot.d.ts","sourceRoot":"","sources":["../../../src/v1/runner/promoteSnapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAIhD,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB,OAAQ,CAAC;AAE3C,eAAO,MAAM,mCAAmC,GAC9C,WAAW,SAAS,cAAc,EAClC,KAAK;IACL,SAAS,EAAE,WAAW,CAAC;CACxB;;;;;;;;;;;;;;;;;;;;CA2CA,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { runnerIdSchema } from "./identity.js";
|
|
2
|
+
import { runnerIdSchema, runnerWorkspaceIdDescription } from "./identity.js";
|
|
3
3
|
/** A path within the run's own screenshot storage, not a filesystem path. */
|
|
4
4
|
export const maxSnapshotPathLength = 1_024;
|
|
5
|
-
export const makePromoteSnapshotOnRunnerContract = () => {
|
|
5
|
+
export const makePromoteSnapshotOnRunnerContract = (ids) => {
|
|
6
6
|
const input = z.object({
|
|
7
7
|
baselinePath: z
|
|
8
8
|
.string()
|
|
@@ -15,6 +15,9 @@ export const makePromoteSnapshotOnRunnerContract = () => {
|
|
|
15
15
|
.min(1)
|
|
16
16
|
.max(maxSnapshotPathLength)
|
|
17
17
|
.describe("The screenshot to promote, as named in the image diff."),
|
|
18
|
+
workspaceId: ids.workspace
|
|
19
|
+
.optional()
|
|
20
|
+
.describe(runnerWorkspaceIdDescription),
|
|
18
21
|
});
|
|
19
22
|
const output = z.discriminatedUnion("outcome", [
|
|
20
23
|
z.object({ outcome: z.literal("success") }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promoteSnapshot.js","sourceRoot":"","sources":["../../../src/v1/runner/promoteSnapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"promoteSnapshot.js","sourceRoot":"","sources":["../../../src/v1/runner/promoteSnapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,cAAc,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAE7E,6EAA6E;AAC7E,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,CAAC;AAE3C,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAEjD,GAED,EAAE,EAAE;IACH,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC;QACrB,YAAY,EAAE,CAAC;aACZ,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,GAAG,CAAC,qBAAqB,CAAC;aAC1B,QAAQ,CAAC,sDAAsD,CAAC;QACnE,EAAE,EAAE,cAAc,CAAC,QAAQ,CAAC,0CAA0C,CAAC;QACvE,cAAc,EAAE,CAAC;aACd,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,GAAG,CAAC,qBAAqB,CAAC;aAC1B,QAAQ,CAAC,wDAAwD,CAAC;QACrE,WAAW,EAAE,GAAG,CAAC,SAAS;aACvB,QAAQ,EAAE;aACV,QAAQ,CAAC,4BAA4B,CAAC;KAC1C,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,CAAC,CAAC,kBAAkB,CAAC,SAAS,EAAE;QAC7C,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QAC3C,CAAC,CAAC,MAAM,CAAC;YACP,aAAa,EAAE,CAAC,CAAC,IAAI,CAAC;gBACpB,iCAAiC;gBACjC,oBAAoB;gBACpB,oBAAoB;aACrB,CAAC;YACF,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;SAC9B,CAAC;KACH,CAAC,CAAC;IAEH,OAAO;QACL,WAAW,EACT,svBAAsvB;QACxvB,KAAK;QACL,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,wBAAwB;QAC9B,MAAM;KAMP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
2
|
+
import type { PublicIdSchema } from "../ids.js";
|
|
3
|
+
export declare const makeReadRunnerJournalContract: <WorkspaceId extends PublicIdSchema>(ids: {
|
|
4
|
+
workspace: WorkspaceId;
|
|
5
|
+
}) => {
|
|
3
6
|
readonly description: "Read a window of one of an interactive runner's journal streams — the newest few, everything after a cursor, or everything belonging to one run. This is how a flow run's outcome and output are followed: `run-status` settles it, `run-logs` and `run-events` carry what it produced, and `recorder` carries the browser actions the runner recorded. A read counts as activity, so working through history does not get the runner reaped underneath you. `runner-unreachable` if the runner could not be reached: it may still be starting, it may have terminated after inactivity, or it may be too busy to answer. Nothing was changed, so retrying is safe; if it persists, launch the runner again.";
|
|
4
7
|
readonly input: z.ZodObject<{
|
|
5
8
|
runId: z.ZodOptional<z.ZodString>;
|
|
@@ -7,6 +10,7 @@ export declare const makeReadRunnerJournalContract: () => {
|
|
|
7
10
|
tail: z.ZodOptional<z.ZodNumber>;
|
|
8
11
|
id: z.ZodString;
|
|
9
12
|
stream: z.ZodString;
|
|
13
|
+
workspaceId: z.ZodOptional<WorkspaceId>;
|
|
10
14
|
}, z.core.$strip>;
|
|
11
15
|
readonly kind: "read";
|
|
12
16
|
readonly name: "runner.readJournal";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readJournal.d.ts","sourceRoot":"","sources":["../../../src/v1/runner/readJournal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"readJournal.d.ts","sourceRoot":"","sources":["../../../src/v1/runner/readJournal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAehD,eAAO,MAAM,6BAA6B,GACxC,WAAW,SAAS,cAAc,EAClC,KAAK;IACL,SAAS,EAAE,WAAW,CAAC;CACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BA,CAAC"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { runnerIdSchema } from "./identity.js";
|
|
2
|
+
import { runnerIdSchema, runnerWorkspaceIdDescription } from "./identity.js";
|
|
3
3
|
import { journalStreamSchema, knownJournalStreams, readJournalRequestSchema, readJournalResponseSchema, } from "./journal.js";
|
|
4
4
|
import { makeRunnerFailureSchema } from "./outcome.js";
|
|
5
5
|
import { retryableRunnerUnreachableDescription, runnerUnreachableFailureReason, } from "./unreachable.js";
|
|
6
|
-
export const makeReadRunnerJournalContract = () => {
|
|
6
|
+
export const makeReadRunnerJournalContract = (ids) => {
|
|
7
7
|
const input = readJournalRequestSchema.extend({
|
|
8
8
|
id: runnerIdSchema.describe("Id of the runner to read the journal of."),
|
|
9
9
|
stream: journalStreamSchema.describe(`The stream to read. QA Wolf writes ${knownJournalStreams.join(", ")}; an unwritten stream reads as empty rather than as an error.`),
|
|
10
|
+
workspaceId: ids.workspace
|
|
11
|
+
.optional()
|
|
12
|
+
.describe(runnerWorkspaceIdDescription),
|
|
10
13
|
});
|
|
11
14
|
const output = z.discriminatedUnion("outcome", [
|
|
12
15
|
readJournalResponseSchema.extend({ outcome: z.literal("success") }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readJournal.js","sourceRoot":"","sources":["../../../src/v1/runner/readJournal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"readJournal.js","sourceRoot":"","sources":["../../../src/v1/runner/readJournal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,cAAc,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EACL,qCAAqC,EACrC,8BAA8B,GAC/B,MAAM,kBAAkB,CAAC;AAE1B,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAE3C,GAED,EAAE,EAAE;IACH,MAAM,KAAK,GAAG,wBAAwB,CAAC,MAAM,CAAC;QAC5C,EAAE,EAAE,cAAc,CAAC,QAAQ,CAAC,0CAA0C,CAAC;QACvE,MAAM,EAAE,mBAAmB,CAAC,QAAQ,CAClC,sCAAsC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,+DAA+D,CACpI;QACD,WAAW,EAAE,GAAG,CAAC,SAAS;aACvB,QAAQ,EAAE;aACV,QAAQ,CAAC,4BAA4B,CAAC;KAC1C,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,CAAC,CAAC,kBAAkB,CAAC,SAAS,EAAE;QAC7C,yBAAyB,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QACnE,uBAAuB,CAAC,CAAC,8BAA8B,CAAC,CAAC;KAC1D,CAAC,CAAC;IAEH,OAAO;QACL,WAAW,EAAE,wcAAwc,qCAAqC,EAAE;QAC5f,KAAK;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,oBAAoB;QAC1B,MAAM;KAMP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { PublicIdSchema } from "../ids.js";
|
|
3
|
-
export declare const makeRunFlowOnRunnerContract: (ids: {
|
|
3
|
+
export declare const makeRunFlowOnRunnerContract: <WorkspaceId extends PublicIdSchema>(ids: {
|
|
4
4
|
environmentRef: PublicIdSchema;
|
|
5
|
+
workspace: WorkspaceId;
|
|
5
6
|
}) => {
|
|
6
7
|
readonly description: "Run a flow on an interactive runner. When `selection` is given the lines run against the browser as it stands, so nothing is re-navigated and nothing is signed in again; without it the whole entry point runs from a fresh browser. A runner with no live browser starts one before a selection and says so with `bootstrappedRunner`, which means those lines ran against a fresh page rather than the one an earlier run left. A selection produces no `runStarted` event, so follow it by its run id on `run-status` like any other run. Send `unchangedFiles` to ship only what changed since an earlier run on this runner; a `needs-full-sync` failure names the paths it does not hold, and the way to recover is the same run again with every file in `files`. Answers as soon as the run is accepted, with the id to follow it by — nothing waits for the run to finish. Which browser or device the run needs is read from the flow file's own execution target, so it is not supplied here; when it does not match what the runner is, the call fails with `runner-target-mismatch` rather than failing partway through the run. `runner-unreachable` means the answer did not arrive, which is NOT the same as the run not having started: the runner may have accepted it and been too slow to say so, and resubmitting would start a second run that is billed and journalled alongside the first. Read the runner's `run-status` journal stream before resubmitting, and use the newest run id there if one appeared.";
|
|
7
8
|
readonly input: z.ZodObject<{
|
|
@@ -16,6 +17,7 @@ export declare const makeRunFlowOnRunnerContract: (ids: {
|
|
|
16
17
|
startLine: z.ZodInt;
|
|
17
18
|
}, z.core.$strip>>;
|
|
18
19
|
unchangedFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
20
|
+
workspaceId: z.ZodOptional<WorkspaceId>;
|
|
19
21
|
}, z.core.$strip>;
|
|
20
22
|
readonly kind: "write";
|
|
21
23
|
readonly name: "runner.runFlow";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runFlow.d.ts","sourceRoot":"","sources":["../../../src/v1/runner/runFlow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"runFlow.d.ts","sourceRoot":"","sources":["../../../src/v1/runner/runFlow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AA8BhD,eAAO,MAAM,2BAA2B,GACtC,WAAW,SAAS,cAAc,EAClC,KAAK;IACL,cAAc,EAAE,cAAc,CAAC;IAC/B,SAAS,EAAE,WAAW,CAAC;CACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkIA,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { runEnvironmentSchema } from "./environment.js";
|
|
3
3
|
import { isShippableRunFilePath, runFilePathRefusal, runFilePathSchema, runPackageJsonPath, } from "./files.js";
|
|
4
|
-
import { runnerIdSchema, runnerNameSchema } from "./identity.js";
|
|
4
|
+
import { runnerIdSchema, runnerNameSchema, runnerWorkspaceIdDescription, } from "./identity.js";
|
|
5
5
|
import { runFilesSchema } from "./payloadSize.js";
|
|
6
6
|
import { runSelectionSchema } from "./runSelection.js";
|
|
7
7
|
const unchangedFilesSchema = z
|
|
@@ -35,6 +35,9 @@ export const makeRunFlowOnRunnerContract = (ids) => {
|
|
|
35
35
|
unchangedFiles: unchangedFilesSchema
|
|
36
36
|
.optional()
|
|
37
37
|
.describe("Files this runner already holds from an earlier run, keyed by path with a hex SHA-256 of the content it should hold. Send this to make `files` only what changed. The runner refuses with `needs-full-sync` if it holds none of a referenced path, so it never runs something other than what was asked for. Omit it to send every file."),
|
|
38
|
+
workspaceId: ids.workspace
|
|
39
|
+
.optional()
|
|
40
|
+
.describe(runnerWorkspaceIdDescription),
|
|
38
41
|
})
|
|
39
42
|
// Both would need a merge order, and the two surfaces that carry an
|
|
40
43
|
// environment and caller variables today do not agree on one.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runFlow.js","sourceRoot":"","sources":["../../../src/v1/runner/runFlow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,YAAY,CAAC;AACpB,OAAO,
|
|
1
|
+
{"version":3,"file":"runFlow.js","sourceRoot":"","sources":["../../../src/v1/runner/runFlow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,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AqT,CACtT;YACH,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;YAC7B,KAAK,EAAE,CAAC;iBACL,MAAM,EAAE;iBACR,QAAQ,CACP,uJAAuJ,CACxJ;SACJ,CAAC;QACF,OAAO;KACR,CAAC,CAAC;IAEH,OAAO;QACL,WAAW,EACT,y8CAAy8C;QAC38C,KAAK;QACL,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,gBAAgB;QACtB,MAAM;KAMP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
1
2
|
export declare const screenFailureReasons: readonly ["runner-has-no-screen", "screen-needs-a-run", "screen-not-ready"];
|
|
2
3
|
export declare const screenNotReadyDescription = "`screen-not-ready` if the runner has a screen that cannot serve this instant. Retry in a second or two: the desktop restarts when a run changes the display size, and it serves one see-or-act request at a time, so a screenshot or action already in flight is the usual reason. Do not submit a run to clear this \u2014 a run may restart the display and discard what is on it.";
|
|
3
4
|
export declare const screenNeedsARunDescription = "`screen-needs-a-run` if the runner's virtual desktop has never started. Waiting will not change this and retrying is pointless \u2014 call `runner.runFlow` with a flow that opens a browser, then ask for the screen again. On a runner image with a browser that has never run anything, any `runner.performAction` also starts the browser itself. Evaluating a snippet does not start the desktop.";
|
|
4
5
|
export declare const runnerHasNoScreenDescription = "`runner-has-no-screen` if this runner is not one that runs a browser on a virtual desktop. Nothing about it can be seen or driven, and retrying will never help \u2014 launch a `playwright` runner instead.";
|
|
6
|
+
/**
|
|
7
|
+
* A screenshot as the API carries it. Not `z.base64()`: its regex runs against
|
|
8
|
+
* every multi-megabyte frame, on the server and in every client that parses with
|
|
9
|
+
* this schema (https://github.com/colinhacks/zod/issues/4283), and the value comes
|
|
10
|
+
* from our own encoder.
|
|
11
|
+
*/
|
|
12
|
+
export declare const screenshotImageSchema: z.ZodString;
|
|
5
13
|
//# sourceMappingURL=screen.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screen.d.ts","sourceRoot":"","sources":["../../../src/v1/runner/screen.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,6EAIvB,CAAC;AAEX,eAAO,MAAM,yBAAyB,yXAC6U,CAAC;AAIpX,eAAO,MAAM,0BAA0B,2YAC8V,CAAC;AAEtY,eAAO,MAAM,4BAA4B,iNACkK,CAAC"}
|
|
1
|
+
{"version":3,"file":"screen.d.ts","sourceRoot":"","sources":["../../../src/v1/runner/screen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,oBAAoB,6EAIvB,CAAC;AAEX,eAAO,MAAM,yBAAyB,yXAC6U,CAAC;AAIpX,eAAO,MAAM,0BAA0B,2YAC8V,CAAC;AAEtY,eAAO,MAAM,4BAA4B,iNACkK,CAAC;AAE5M;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,aAK/B,CAAC"}
|
package/dist/v1/runner/screen.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
1
2
|
export const screenFailureReasons = [
|
|
2
3
|
"runner-has-no-screen",
|
|
3
4
|
"screen-needs-a-run",
|
|
@@ -8,4 +9,14 @@ export const screenNotReadyDescription = "`screen-not-ready` if the runner has a
|
|
|
8
9
|
// models, and an instruction that only exists in prose is one they may not follow.
|
|
9
10
|
export const screenNeedsARunDescription = "`screen-needs-a-run` if the runner's virtual desktop has never started. Waiting will not change this and retrying is pointless — call `runner.runFlow` with a flow that opens a browser, then ask for the screen again. On a runner image with a browser that has never run anything, any `runner.performAction` also starts the browser itself. Evaluating a snippet does not start the desktop.";
|
|
10
11
|
export const runnerHasNoScreenDescription = "`runner-has-no-screen` if this runner is not one that runs a browser on a virtual desktop. Nothing about it can be seen or driven, and retrying will never help — launch a `playwright` runner instead.";
|
|
12
|
+
/**
|
|
13
|
+
* A screenshot as the API carries it. Not `z.base64()`: its regex runs against
|
|
14
|
+
* every multi-megabyte frame, on the server and in every client that parses with
|
|
15
|
+
* this schema (https://github.com/colinhacks/zod/issues/4283), and the value comes
|
|
16
|
+
* from our own encoder.
|
|
17
|
+
*/
|
|
18
|
+
export const screenshotImageSchema = z
|
|
19
|
+
.string()
|
|
20
|
+
.min(1)
|
|
21
|
+
.describe("The screenshot, as a base64-encoded JPEG. Decode it and write the bytes to a `.jpg` file — writing this string to the file leaves you with base64 text rather than an image.");
|
|
11
22
|
//# sourceMappingURL=screen.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screen.js","sourceRoot":"","sources":["../../../src/v1/runner/screen.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,sBAAsB;IACtB,oBAAoB;IACpB,kBAAkB;CACV,CAAC;AAEX,MAAM,CAAC,MAAM,yBAAyB,GACpC,iXAAiX,CAAC;AAEpX,iFAAiF;AACjF,mFAAmF;AACnF,MAAM,CAAC,MAAM,0BAA0B,GACrC,mYAAmY,CAAC;AAEtY,MAAM,CAAC,MAAM,4BAA4B,GACvC,yMAAyM,CAAC"}
|
|
1
|
+
{"version":3,"file":"screen.js","sourceRoot":"","sources":["../../../src/v1/runner/screen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,sBAAsB;IACtB,oBAAoB;IACpB,kBAAkB;CACV,CAAC;AAEX,MAAM,CAAC,MAAM,yBAAyB,GACpC,iXAAiX,CAAC;AAEpX,iFAAiF;AACjF,mFAAmF;AACnF,MAAM,CAAC,MAAM,0BAA0B,GACrC,mYAAmY,CAAC;AAEtY,MAAM,CAAC,MAAM,4BAA4B,GACvC,yMAAyM,CAAC;AAE5M;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC;KACnC,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,QAAQ,CACP,8KAA8K,CAC/K,CAAC"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
2
|
+
import type { PublicIdSchema } from "../ids.js";
|
|
3
|
+
export declare const makeStopRunOnRunnerContract: <WorkspaceId extends PublicIdSchema>(ids: {
|
|
4
|
+
workspace: WorkspaceId;
|
|
5
|
+
}) => {
|
|
3
6
|
readonly description: "Stop what a runner is currently executing, leaving the runner up and its browser on whatever page the run reached. Succeeds whether or not anything was running, and `wasRunning` says which. This is the counterpart of `runner.terminate`, which ends the runner itself. The run stops where it is, so the journal's `run-status` settles it as stopped rather than passed or failed. `runner-unreachable` if the runner could not be reached: it may still be starting, it may have terminated after inactivity, or it may be too busy to answer. The stop may still have landed, but stopping a runner that is already idle does nothing, so retrying is safe.";
|
|
4
7
|
readonly input: z.ZodObject<{
|
|
5
8
|
id: z.ZodString;
|
|
9
|
+
workspaceId: z.ZodOptional<WorkspaceId>;
|
|
6
10
|
}, z.core.$strip>;
|
|
7
11
|
readonly kind: "write";
|
|
8
12
|
readonly name: "runner.stopRun";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stopRun.d.ts","sourceRoot":"","sources":["../../../src/v1/runner/stopRun.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"stopRun.d.ts","sourceRoot":"","sources":["../../../src/v1/runner/stopRun.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAMhD,eAAO,MAAM,2BAA2B,GACtC,WAAW,SAAS,cAAc,EAClC,KAAK;IACL,SAAS,EAAE,WAAW,CAAC;CACxB;;;;;;;;;;;;;;;;;CAiCA,CAAC"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { runnerIdSchema } from "./identity.js";
|
|
2
|
+
import { runnerIdSchema, runnerWorkspaceIdDescription } from "./identity.js";
|
|
3
3
|
import { makeRunnerFailureSchema } from "./outcome.js";
|
|
4
4
|
import { runnerUnreachableFailureReason } from "./unreachable.js";
|
|
5
|
-
export const makeStopRunOnRunnerContract = () => {
|
|
5
|
+
export const makeStopRunOnRunnerContract = (ids) => {
|
|
6
6
|
const input = z.object({
|
|
7
7
|
id: runnerIdSchema.describe("Id of the runner to stop the run on."),
|
|
8
|
+
workspaceId: ids.workspace
|
|
9
|
+
.optional()
|
|
10
|
+
.describe(runnerWorkspaceIdDescription),
|
|
8
11
|
});
|
|
9
12
|
const output = z.discriminatedUnion("outcome", [
|
|
10
13
|
z.object({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stopRun.js","sourceRoot":"","sources":["../../../src/v1/runner/stopRun.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"stopRun.js","sourceRoot":"","sources":["../../../src/v1/runner/stopRun.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,cAAc,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAC;AAElE,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAEzC,GAED,EAAE,EAAE;IACH,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC;QACrB,EAAE,EAAE,cAAc,CAAC,QAAQ,CAAC,sCAAsC,CAAC;QACnE,WAAW,EAAE,GAAG,CAAC,SAAS;aACvB,QAAQ,EAAE;aACV,QAAQ,CAAC,4BAA4B,CAAC;KAC1C,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,CAAC,CAAC,kBAAkB,CAAC,SAAS,EAAE;QAC7C,CAAC,CAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;YAC7B,UAAU,EAAE,CAAC;iBACV,OAAO,EAAE;iBACT,QAAQ,CACP,oHAAoH,CACrH;SACJ,CAAC;QACF,uBAAuB,CAAC,CAAC,8BAA8B,CAAC,CAAC;KAC1D,CAAC,CAAC;IAEH,OAAO;QACL,WAAW,EACT,ooBAAooB;QACtoB,KAAK;QACL,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,gBAAgB;QACtB,MAAM;KAMP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
2
|
+
import type { PublicIdSchema } from "../ids.js";
|
|
3
|
+
export declare const makeTakeScreenshotOnRunnerContract: <WorkspaceId extends PublicIdSchema>(ids: {
|
|
4
|
+
workspace: WorkspaceId;
|
|
5
|
+
}) => {
|
|
3
6
|
readonly description: "Take one screenshot of an interactive runner's screen. On a runner with a browser the image is the whole virtual desktop, browser window and all. On a mobile runner it is the device's own screen, re-encoded to JPEG on the pod so this contract reads one image format regardless of runner family. `screen-needs-a-run` if the runner's virtual desktop has never started. Waiting will not change this and retrying is pointless — call `runner.runFlow` with a flow that opens a browser, then ask for the screen again. On a runner image with a browser that has never run anything, any `runner.performAction` also starts the browser itself. Evaluating a snippet does not start the desktop. `screen-not-ready` if the runner has a screen that cannot serve this instant. Retry in a second or two: the desktop restarts when a run changes the display size, and it serves one see-or-act request at a time, so a screenshot or action already in flight is the usual reason. Do not submit a run to clear this — a run may restart the display and discard what is on it. `runner-has-no-screen` if this runner is not one that runs a browser on a virtual desktop. Nothing about it can be seen or driven, and retrying will never help — launch a `playwright` runner instead. `runner-unreachable` if the runner could not be reached: it may still be starting, it may have terminated after inactivity, or it may be too busy to answer. Nothing was changed, so retrying is safe; if it persists, launch the runner again.";
|
|
4
7
|
readonly input: z.ZodObject<{
|
|
5
8
|
id: z.ZodString;
|
|
9
|
+
workspaceId: z.ZodOptional<WorkspaceId>;
|
|
6
10
|
}, z.core.$strip>;
|
|
7
11
|
readonly kind: "read";
|
|
8
12
|
readonly name: "runner.takeScreenshot";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"takeScreenshot.d.ts","sourceRoot":"","sources":["../../../src/v1/runner/takeScreenshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"takeScreenshot.d.ts","sourceRoot":"","sources":["../../../src/v1/runner/takeScreenshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAgBhD,eAAO,MAAM,kCAAkC,GAC7C,WAAW,SAAS,cAAc,EAClC,KAAK;IACL,SAAS,EAAE,WAAW,CAAC;CACxB;;;;;;;;;;;;;;;;;;;;CA+BA,CAAC"}
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { runnerIdSchema } from "./identity.js";
|
|
2
|
+
import { runnerIdSchema, runnerWorkspaceIdDescription } from "./identity.js";
|
|
3
3
|
import { makeRunnerFailureSchema } from "./outcome.js";
|
|
4
|
-
import { runnerHasNoScreenDescription, screenFailureReasons, screenNeedsARunDescription, screenNotReadyDescription, } from "./screen.js";
|
|
4
|
+
import { runnerHasNoScreenDescription, screenFailureReasons, screenNeedsARunDescription, screenNotReadyDescription, screenshotImageSchema, } from "./screen.js";
|
|
5
5
|
import { retryableRunnerUnreachableDescription, runnerUnreachableFailureReason, } from "./unreachable.js";
|
|
6
|
-
export const makeTakeScreenshotOnRunnerContract = () => {
|
|
6
|
+
export const makeTakeScreenshotOnRunnerContract = (ids) => {
|
|
7
7
|
const input = z.object({
|
|
8
8
|
id: runnerIdSchema.describe("Id of the runner to take a screenshot of."),
|
|
9
|
+
workspaceId: ids.workspace
|
|
10
|
+
.optional()
|
|
11
|
+
.describe(runnerWorkspaceIdDescription),
|
|
9
12
|
});
|
|
10
13
|
const output = z.discriminatedUnion("outcome", [
|
|
11
14
|
z.object({
|
|
12
|
-
|
|
13
|
-
// on the server and in every client that parses with this schema
|
|
14
|
-
// (https://github.com/colinhacks/zod/issues/4283), and the value comes
|
|
15
|
-
// from our own encoder.
|
|
16
|
-
imageJpegBase64: z
|
|
17
|
-
.string()
|
|
18
|
-
.min(1)
|
|
19
|
-
.describe("The screenshot, as a base64-encoded JPEG. Decode it and write the bytes to a `.jpg` file — writing this string to the file leaves you with base64 text rather than an image."),
|
|
15
|
+
imageJpegBase64: screenshotImageSchema,
|
|
20
16
|
outcome: z.literal("success"),
|
|
21
17
|
}),
|
|
22
18
|
makeRunnerFailureSchema([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"takeScreenshot.js","sourceRoot":"","sources":["../../../src/v1/runner/takeScreenshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"takeScreenshot.js","sourceRoot":"","sources":["../../../src/v1/runner/takeScreenshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,cAAc,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EACL,4BAA4B,EAC5B,oBAAoB,EACpB,0BAA0B,EAC1B,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,qCAAqC,EACrC,8BAA8B,GAC/B,MAAM,kBAAkB,CAAC;AAE1B,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAEhD,GAED,EAAE,EAAE;IACH,MAAM,KAAK,GAAG,CAAC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