@qawolf/api-contracts 0.22.0 → 0.25.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.
Files changed (47) hide show
  1. package/dist/v1/environment/find.d.ts +2 -0
  2. package/dist/v1/environment/find.d.ts.map +1 -1
  3. package/dist/v1/environment/find.js +1 -0
  4. package/dist/v1/environment/find.js.map +1 -1
  5. package/dist/v1/environment/index.d.ts +3 -1
  6. package/dist/v1/environment/index.d.ts.map +1 -1
  7. package/dist/v1/environment/index.js +1 -1
  8. package/dist/v1/environment/index.js.map +1 -1
  9. package/dist/v1/environment/resource.d.ts +1 -0
  10. package/dist/v1/environment/resource.d.ts.map +1 -1
  11. package/dist/v1/environment/resource.js +3 -0
  12. package/dist/v1/environment/resource.js.map +1 -1
  13. package/dist/v1/environment/update.d.ts +1 -0
  14. package/dist/v1/environment/update.d.ts.map +1 -1
  15. package/dist/v1/ids.d.ts +3 -2
  16. package/dist/v1/ids.d.ts.map +1 -1
  17. package/dist/v1/ids.js +1 -0
  18. package/dist/v1/ids.js.map +1 -1
  19. package/dist/v1/index.d.ts +293 -3
  20. package/dist/v1/index.d.ts.map +1 -1
  21. package/dist/v1/index.js +6 -0
  22. package/dist/v1/index.js.map +1 -1
  23. package/dist/v1/run/get.d.ts +63 -1
  24. package/dist/v1/run/get.d.ts.map +1 -1
  25. package/dist/v1/run/get.js +86 -0
  26. package/dist/v1/run/get.js.map +1 -1
  27. package/dist/v1/run/index.d.ts +3 -1
  28. package/dist/v1/run/index.d.ts.map +1 -1
  29. package/dist/v1/run/index.js +3 -0
  30. package/dist/v1/run/index.js.map +1 -1
  31. package/dist/v1/runner/browserAction.d.ts +39 -0
  32. package/dist/v1/runner/browserAction.d.ts.map +1 -0
  33. package/dist/v1/runner/browserAction.js +82 -0
  34. package/dist/v1/runner/browserAction.js.map +1 -0
  35. package/dist/v1/runner/performAction.d.ts +61 -0
  36. package/dist/v1/runner/performAction.d.ts.map +1 -0
  37. package/dist/v1/runner/performAction.js +38 -0
  38. package/dist/v1/runner/performAction.js.map +1 -0
  39. package/dist/v1/runner/screen.d.ts +14 -0
  40. package/dist/v1/runner/screen.d.ts.map +1 -0
  41. package/dist/v1/runner/screen.js +16 -0
  42. package/dist/v1/runner/screen.js.map +1 -0
  43. package/dist/v1/runner/takeScreenshot.d.ts +22 -0
  44. package/dist/v1/runner/takeScreenshot.d.ts.map +1 -0
  45. package/dist/v1/runner/takeScreenshot.js +34 -0
  46. package/dist/v1/runner/takeScreenshot.js.map +1 -0
  47. package/package.json +1 -1
@@ -5,6 +5,89 @@ export const makeGetRunContract = (ids) => {
5
5
  const input = z.object({
6
6
  runId: ids.run,
7
7
  });
8
+ // Artifact URLs are signed without checking storage, so a fetch can return
9
+ // 404 when the attempt never produced that artifact. For example, only
10
+ // Playwright flows produce traces, and manual Wolf Browser attempts store
11
+ // no artifacts at all.
12
+ const artifactUrls = {
13
+ logsUrl: z
14
+ .url()
15
+ .optional()
16
+ .describe("Signed URL for the attempt's execution logs."),
17
+ traceUrl: z
18
+ .url()
19
+ .optional()
20
+ .describe("Signed URL for the attempt's Playwright trace (a trace.zip; open it with `npx playwright show-trace`)."),
21
+ videoUrl: z
22
+ .url()
23
+ .optional()
24
+ .describe("Signed URL for the attempt's screen recording."),
25
+ };
26
+ const automatedKind = z
27
+ .literal("automated")
28
+ .describe("The attempt ran on a QA Wolf runner.");
29
+ // A discriminated union like the flow entry itself. An attempt with a
30
+ // verdict always carries its completion time. A terminated attempt never
31
+ // carries artifact links. Manual Wolf Browser attempts always pass and
32
+ // never carry artifact links. The contract therefore cannot emit a record
33
+ // that contradicts its own status or kind.
34
+ const automatedAttempt = z.discriminatedUnion("status", [
35
+ z.object({
36
+ ...artifactUrls,
37
+ completedAt: z.iso.datetime(),
38
+ kind: automatedKind,
39
+ startedAt: z.iso.datetime(),
40
+ status: z.literal("passed"),
41
+ }),
42
+ z.object({
43
+ ...artifactUrls,
44
+ completedAt: z.iso.datetime(),
45
+ kind: automatedKind,
46
+ startedAt: z.iso
47
+ .datetime()
48
+ .optional()
49
+ .describe("Absent when the attempt failed before it could start."),
50
+ status: z.literal("failed"),
51
+ }),
52
+ z.object({
53
+ completedAt: z.iso.datetime().optional(),
54
+ kind: automatedKind,
55
+ startedAt: z.iso.datetime().optional(),
56
+ status: z
57
+ .literal("canceled")
58
+ .describe("The attempt was terminated without reaching a verdict."),
59
+ }),
60
+ ]);
61
+ const manualAttempt = z.object({
62
+ completedAt: z.iso.datetime(),
63
+ kind: z
64
+ .literal("manual")
65
+ .describe("The attempt ran by hand in the Wolf Browser."),
66
+ startedAt: z.iso.datetime(),
67
+ status: z.literal("passed"),
68
+ });
69
+ const attempt = z.union([automatedAttempt, manualAttempt]);
70
+ const attempts = z
71
+ .array(attempt)
72
+ .optional()
73
+ .describe("The flow's finished execution attempts, oldest first, including " +
74
+ "manual Wolf Browser attempts. Present once at least one attempt has " +
75
+ "finished, so a flow that passed after retries also lists its failed " +
76
+ "attempts. Artifact URLs appear only on automated attempts that " +
77
+ "reached a verdict, stay valid for at least a day (call run.get " +
78
+ "again for fresh ones), and can return 404 when the attempt did not " +
79
+ "produce that artifact.");
80
+ const diagnosis = z
81
+ .object({
82
+ issueId: ids.issue,
83
+ type: z.enum(["bug", "maintenance"]),
84
+ })
85
+ .optional()
86
+ .describe("QA Wolf's investigation verdict for the failure: `bug` means the " +
87
+ "application is broken, `maintenance` means the test needed an " +
88
+ "update and the failure does not indicate an application problem. " +
89
+ "Absent until the investigation reaches a verdict. Pass issueId to " +
90
+ "issue.get for details.");
8
91
  // We return one flat entry per flow, each carrying its own status, rather
9
92
  // than status-keyed buckets (`{ passed: [...], failed: [...] }`). A flat list
10
93
  // is a superset — the caller can group by status — and gives each flow a
@@ -19,7 +102,9 @@ export const makeGetRunContract = (ids) => {
19
102
  // "failed ⇔ failure present" instead of defensively checking, and we can't
20
103
  // accidentally emit a contradictory record.
21
104
  const failedFlow = z.object({
105
+ attempts,
22
106
  failure: z.object({
107
+ diagnosis,
23
108
  // The raw error from the run itself, available the moment the flow fails.
24
109
  // Chosen over QA Wolf's analyzed error (`RunAnalysisDto`): the analysis is
25
110
  // produced only after investigation and is usually absent while an agent
@@ -33,6 +118,7 @@ export const makeGetRunContract = (ids) => {
33
118
  status: z.literal("failed"),
34
119
  });
35
120
  const nonFailedFlow = z.object({
121
+ attempts,
36
122
  flowId: ids.flow,
37
123
  name: z.string(),
38
124
  status: z.enum(["queued", "running", "passed", "canceled"]),
@@ -1 +1 @@
1
- {"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/v1/run/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAGhC,GAID,EAAE,EAAE;IACH,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC;QACrB,KAAK,EAAE,GAAG,CAAC,GAAG;KACf,CAAC,CAAC;IAEH,0EAA0E;IAC1E,8EAA8E;IAC9E,yEAAyE;IACzE,0EAA0E;IAC1E,4EAA4E;IAC5E,sEAAsE;IACtE,4BAA4B;IAC5B,0EAA0E;IAC1E,8EAA8E;IAC9E,4EAA4E;IAC5E,iEAAiE;IACjE,2EAA2E;IAC3E,4CAA4C;IAC5C,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;QAC1B,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC;YAChB,0EAA0E;YAC1E,2EAA2E;YAC3E,yEAAyE;YACzE,+DAA+D;YAC/D,oEAAoE;YACpE,oDAAoD;YACpD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;SAClB,CAAC;QACF,MAAM,EAAE,GAAG,CAAC,IAAI;QAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,MAAM,E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CAAC;IAEF,OAAO;QACL,WAAW,EAAE,kDAAkD;QAC/D,KAAK;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,SAAS;QACf,MAAM;KAMP,CAAC;AACJ,CAAC,CAAC"}
@@ -2,13 +2,15 @@ import { z } from "zod";
2
2
  import type { PublicIdSchema } from "../ids.js";
3
3
  import { makeFlowSelectionSchema } from "./flowSelection.js";
4
4
  export { makeFlowSelectionSchema };
5
- export declare const makeCreateRunContract: <FlowId extends PublicIdSchema, RunId extends PublicIdSchema>(ids: {
5
+ export declare const makeCreateRunContract: <AiTaskId extends PublicIdSchema, FlowId extends PublicIdSchema, RunId extends PublicIdSchema>(ids: {
6
+ aiTask: AiTaskId;
6
7
  environmentRef: PublicIdSchema;
7
8
  flow: FlowId;
8
9
  run: RunId;
9
10
  }) => {
10
11
  readonly description: "Create a run for the selected flows and/or tags in an environment.";
11
12
  readonly input: z.ZodIntersection<z.ZodObject<{
13
+ aiTaskId: z.ZodOptional<AiTaskId>;
12
14
  environmentId: PublicIdSchema;
13
15
  environmentVariables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
14
16
  ignoreRules: z.ZodDefault<z.ZodBoolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/v1/run/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAGhD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,OAAO,EAAE,uBAAuB,EAAE,CAAC;AAEnC,eAAO,MAAM,qBAAqB,GAChC,MAAM,SAAS,cAAc,EAC7B,KAAK,SAAS,cAAc,EAC5B,KAAK;IACL,cAAc,EAAE,cAAc,CAAC;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,KAAK,CAAC;CACZ;;;;;;;;;;;;;;;;;;CAyCA,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/v1/run/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAGhD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,OAAO,EAAE,uBAAuB,EAAE,CAAC;AAEnC,eAAO,MAAM,qBAAqB,GAChC,QAAQ,SAAS,cAAc,EAC/B,MAAM,SAAS,cAAc,EAC7B,KAAK,SAAS,cAAc,EAC5B,KAAK;IACL,MAAM,EAAE,QAAQ,CAAC;IACjB,cAAc,EAAE,cAAc,CAAC;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,KAAK,CAAC;CACZ;;;;;;;;;;;;;;;;;;;CA8CA,CAAC"}
@@ -5,6 +5,9 @@ export { makeFlowSelectionSchema };
5
5
  export const makeCreateRunContract = (ids) => {
6
6
  const input = z
7
7
  .object({
8
+ aiTaskId: ids.aiTask
9
+ .describe("The AI task whose conversation should receive run status updates.")
10
+ .optional(),
8
11
  environmentId: ids.environmentRef,
9
12
  environmentVariables: z.record(z.string(), z.string()).optional(),
10
13
  ignoreRules: z.boolean().default(false),
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/v1/run/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,OAAO,EAAE,uBAAuB,EAAE,CAAC;AAEnC,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAGnC,GAID,EAAE,EAAE;IACH,MAAM,KAAK,GAAG,CAAC;SACZ,MAAM,CAAC;QACN,aAAa,EAAE,GAAG,CAAC,c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AAQ,EAAE,GAAG,CAAC,MAAM;aACjB,QAAQ,CACP,mEAAmE,CACpE;aACA,QAAQ,EAAE;QACb,aAAa,EAAE,GAAG,CAAC,cAAc;QACjC,oBAAoB,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;QACjE,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;QACvC,+DAA+D;QAC/D,wEAAwE;QACxE,gEAAgE;QAChE,+BAA+B;QAC/B,iBAAiB,EAAE,CAAC;aACjB,MAAM,EAAE;aACR,GAAG,EAAE;aACL,QAAQ,EAAE;aACV,QAAQ,CAAC,2DAA2D,CAAC;aACrE,QAAQ,EAAE;QACb,UAAU,EAAE,CAAC;aACV,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CAAC,oDAAoD,CAAC;aAC9D,QAAQ,EAAE;KACd,CAAC;SACD,GAAG,CAAC,uBAAuB,CAAC,GAAG,CAAC,CAAC,CAAC;IACrC,MAAM,MAAM,GAAG,QAAQ,CACrB,EAAE,KAAK,EAAE,GAAG,CAAC,GAAG,EAAE,EAClB,EAAE,mBAAmB,EAAE,+BAA+B,EAAE,CACzD,CAAC;IAEF,OAAO;QACL,WAAW,EACT,oEAAoE;QACtE,KAAK;QACL,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,YAAY;QAClB,MAAM;KAMP,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { z } from "zod";
2
+ /** The action shapes, bounded. Strict: a bound rejects rather than truncates. */
3
+ export declare const browserActionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
4
+ button: z.ZodLiteral<"left" | "right" | "wheel" | "back" | "forward">;
5
+ type: z.ZodLiteral<"click">;
6
+ x: z.ZodInt;
7
+ y: z.ZodInt;
8
+ }, z.core.$strict>, z.ZodObject<{
9
+ type: z.ZodLiteral<"double_click">;
10
+ x: z.ZodInt;
11
+ y: z.ZodInt;
12
+ }, z.core.$strict>, z.ZodObject<{
13
+ scroll_x: z.ZodInt;
14
+ scroll_y: z.ZodInt;
15
+ type: z.ZodLiteral<"scroll">;
16
+ x: z.ZodInt;
17
+ y: z.ZodInt;
18
+ }, z.core.$strict>, z.ZodObject<{
19
+ type: z.ZodLiteral<"move">;
20
+ x: z.ZodInt;
21
+ y: z.ZodInt;
22
+ }, z.core.$strict>, z.ZodObject<{
23
+ path: z.ZodArray<z.ZodObject<{
24
+ x: z.ZodInt;
25
+ y: z.ZodInt;
26
+ }, z.core.$strict>>;
27
+ type: z.ZodLiteral<"drag">;
28
+ }, z.core.$strict>, z.ZodObject<{
29
+ keys: z.ZodArray<z.ZodString>;
30
+ type: z.ZodLiteral<"keypress">;
31
+ }, z.core.$strict>, z.ZodObject<{
32
+ type: z.ZodLiteral<"navigate">;
33
+ url: z.ZodURL;
34
+ }, z.core.$strict>, z.ZodObject<{
35
+ text: z.ZodString;
36
+ type: z.ZodLiteral<"type">;
37
+ }, z.core.$strict>], "type">;
38
+ export type BrowserAction = z.infer<typeof browserActionSchema>;
39
+ //# sourceMappingURL=browserAction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browserAction.d.ts","sourceRoot":"","sources":["../../../src/v1/runner/browserAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA4CxB,iFAAiF;AACjF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BA+C9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
@@ -0,0 +1,82 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * The input of `runner.performAction`, validated with the same schema by apex and
4
+ * the runner. Only ever tighten a bound: pods deploy separately, so a widened
5
+ * bound forwards actions an older pod rejects.
6
+ *
7
+ * `snake_case` on purpose: these are the computer-use tool names.
8
+ */
9
+ /** A whole pixel on the runner's virtual desktop. */
10
+ const maxScreenCoordinate = 20_000;
11
+ const screenCoordinateSchema = z.int().min(0).max(maxScreenCoordinate);
12
+ const screenPointSchema = z.strictObject({
13
+ x: screenCoordinateSchema,
14
+ y: screenCoordinateSchema,
15
+ });
16
+ /** A signed wheel delta in whole pixels. A full page is a few hundred. */
17
+ const maxScrollDelta = 5_000;
18
+ const scrollDeltaSchema = z.int().min(-maxScrollDelta).max(maxScrollDelta);
19
+ /** The keyboard is held for 50 ms per character, so 200 of them is ten seconds. */
20
+ const maxTypedTextLength = 200;
21
+ /** A chord is modifiers plus a key, and names are like `ArrowDown` or `a`. */
22
+ const maxKeypressKeys = 10;
23
+ const maxKeyNameLength = 32;
24
+ /** A sampled path, each point a pointer event. Fewer than two is not a drag. */
25
+ const minDragPathPoints = 2;
26
+ const maxDragPathPoints = 100;
27
+ /** The de-facto ceiling browsers honour. */
28
+ const maxNavigateUrlLength = 2048;
29
+ /** Only the two schemes a browser navigation means, matched on the parsed scheme. */
30
+ const navigableUrlSchema = z
31
+ .url({ protocol: /^https?$/ })
32
+ .max(maxNavigateUrlLength);
33
+ /** The action shapes, bounded. Strict: a bound rejects rather than truncates. */
34
+ export const browserActionSchema = z.discriminatedUnion("type", [
35
+ z.strictObject({
36
+ button: z.literal(["left", "right", "wheel", "back", "forward"]),
37
+ type: z.literal("click"),
38
+ x: screenCoordinateSchema,
39
+ y: screenCoordinateSchema,
40
+ }),
41
+ z.strictObject({
42
+ type: z.literal("double_click"),
43
+ x: screenCoordinateSchema,
44
+ y: screenCoordinateSchema,
45
+ }),
46
+ z.strictObject({
47
+ scroll_x: scrollDeltaSchema,
48
+ scroll_y: scrollDeltaSchema,
49
+ type: z.literal("scroll"),
50
+ x: screenCoordinateSchema,
51
+ y: screenCoordinateSchema,
52
+ }),
53
+ z.strictObject({
54
+ type: z.literal("move"),
55
+ x: screenCoordinateSchema,
56
+ y: screenCoordinateSchema,
57
+ }),
58
+ z.strictObject({
59
+ path: z
60
+ .array(screenPointSchema)
61
+ .min(minDragPathPoints)
62
+ .max(maxDragPathPoints),
63
+ type: z.literal("drag"),
64
+ }),
65
+ z.strictObject({
66
+ keys: z
67
+ .array(z.string().min(1).max(maxKeyNameLength))
68
+ .min(1)
69
+ .max(maxKeypressKeys),
70
+ type: z.literal("keypress"),
71
+ }),
72
+ /** The one action not performed on the screen: it goes to the last active page. */
73
+ z.strictObject({
74
+ type: z.literal("navigate"),
75
+ url: navigableUrlSchema,
76
+ }),
77
+ z.strictObject({
78
+ text: z.string().min(1).max(maxTypedTextLength),
79
+ type: z.literal("type"),
80
+ }),
81
+ ]);
82
+ //# sourceMappingURL=browserAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browserAction.js","sourceRoot":"","sources":["../../../src/v1/runner/browserAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;GAMG;AAEH,qDAAqD;AACrD,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAEnC,MAAM,sBAAsB,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAEvE,MAAM,iBAAiB,GAAG,CAAC,CAAC,YAAY,CAAC;IACvC,CAAC,EAAE,sBAAsB;IACzB,CAAC,EAAE,sBAAsB;CAC1B,CAAC,CAAC;AAEH,0EAA0E;AAC1E,MAAM,cAAc,GAAG,KAAK,CAAC;AAE7B,MAAM,iBAAiB,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AAE3E,mFAAmF;AACnF,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAE/B,8EAA8E;AAC9E,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAA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;aACJ,KAAK,CAAC,iBAAiB,CAAC;aACxB,GAAG,CAAC,iBAAiB,CAAC;aACtB,GAAG,CAAC,iBAAiB,CAAC;QACzB,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;KACxB,CAAC;IACF,CAAC,CAAC,YAAY,CAAC;QACb,IAAI,EAAE,CAAC;aACJ,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;aAC9C,GAAG,CAAC,CAAC,CAAC;aACN,GAAG,CAAC,eAAe,CAAC;QACvB,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;KAC5B,CAAC;IACF,mFAAmF;IACnF,CAAC,CAAC,YAAY,CAAC;QACb,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;QAC3B,GAAG,EAAE,kBAAkB;KACxB,CAAC;IACF,CAAC,CAAC,YAAY,CAAC;QACb,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC;QAC/C,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;KACxB,CAAC;CACH,CAAC,CAAC"}
@@ -0,0 +1,61 @@
1
+ import { z } from "zod";
2
+ /** How much of a failure reason this API passes on. */
3
+ export declare const maxActionErrorMessageLength = 1000;
4
+ export declare const makePerformActionOnRunnerContract: () => {
5
+ 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). `performed` if the action took effect. `action-failed`, with a reason, if it reached the runner and did not take effect. `screen-needs-a-run` if the runner has not run anything yet, so its virtual desktop has never started. Waiting will not change this and retrying is pointless — call `runner.runFlow` on the runner, then ask for the screen again. 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. A `navigate` does not go through the screen, so a screen that is not ready does not stop it — but it still needs the runner to have run something, and until then it answers `action-failed` rather than `screen-needs-a-run`. `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 `node20WithPlaywright` 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 have stopped answering mid-action. This does not mean the action was not performed — take a screenshot before repeating it.";
6
+ readonly input: z.ZodObject<{
7
+ action: z.ZodDiscriminatedUnion<[z.ZodObject<{
8
+ button: z.ZodLiteral<"left" | "right" | "wheel" | "back" | "forward">;
9
+ type: z.ZodLiteral<"click">;
10
+ x: z.ZodInt;
11
+ y: z.ZodInt;
12
+ }, z.core.$strict>, z.ZodObject<{
13
+ type: z.ZodLiteral<"double_click">;
14
+ x: z.ZodInt;
15
+ y: z.ZodInt;
16
+ }, z.core.$strict>, z.ZodObject<{
17
+ scroll_x: z.ZodInt;
18
+ scroll_y: z.ZodInt;
19
+ type: z.ZodLiteral<"scroll">;
20
+ x: z.ZodInt;
21
+ y: z.ZodInt;
22
+ }, z.core.$strict>, z.ZodObject<{
23
+ type: z.ZodLiteral<"move">;
24
+ x: z.ZodInt;
25
+ y: z.ZodInt;
26
+ }, z.core.$strict>, z.ZodObject<{
27
+ path: z.ZodArray<z.ZodObject<{
28
+ x: z.ZodInt;
29
+ y: z.ZodInt;
30
+ }, z.core.$strict>>;
31
+ type: z.ZodLiteral<"drag">;
32
+ }, z.core.$strict>, z.ZodObject<{
33
+ keys: z.ZodArray<z.ZodString>;
34
+ type: z.ZodLiteral<"keypress">;
35
+ }, z.core.$strict>, z.ZodObject<{
36
+ type: z.ZodLiteral<"navigate">;
37
+ url: z.ZodURL;
38
+ }, z.core.$strict>, z.ZodObject<{
39
+ text: z.ZodString;
40
+ type: z.ZodLiteral<"type">;
41
+ }, z.core.$strict>], "type">;
42
+ id: z.ZodString;
43
+ }, z.core.$strip>;
44
+ readonly kind: "write";
45
+ readonly name: "runner.performAction";
46
+ readonly output: z.ZodDiscriminatedUnion<[z.ZodObject<{
47
+ outcome: z.ZodLiteral<"performed">;
48
+ }, z.core.$strip>, z.ZodObject<{
49
+ errorMessage: z.ZodString;
50
+ outcome: z.ZodLiteral<"action-failed">;
51
+ }, z.core.$strip>, z.ZodObject<{
52
+ outcome: z.ZodLiteral<"screen-needs-a-run">;
53
+ }, z.core.$strip>, z.ZodObject<{
54
+ outcome: z.ZodLiteral<"screen-not-ready">;
55
+ }, z.core.$strip>, z.ZodObject<{
56
+ outcome: z.ZodLiteral<"runner-has-no-screen">;
57
+ }, z.core.$strip>, z.ZodObject<{
58
+ outcome: z.ZodLiteral<"runner-unreachable">;
59
+ }, z.core.$strip>], "outcome">;
60
+ };
61
+ //# sourceMappingURL=performAction.d.ts.map
@@ -0,0 +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;AAqBxB,uDAAuD;AACvD,eAAO,MAAM,2BAA2B,OAAQ,CAAC;AAEjD,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmC7C,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { z } from "zod";
2
+ import { browserActionSchema } from "./browserAction.js";
3
+ import { runnerIdSchema } from "./identity.js";
4
+ import { runnerHasNoScreenDescription, runnerHasNoScreenSchema, runnerScreenNeedsARunSchema, runnerScreenNotReadySchema, screenNeedsARunDescription, screenNotReadyDescription, } from "./screen.js";
5
+ import { runnerUnreachableSchema } from "./unreachable.js";
6
+ // Not the shared retryable wording: the action may have taken effect before its
7
+ // answer was lost.
8
+ 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.";
9
+ /** How much of a failure reason this API passes on. */
10
+ export const maxActionErrorMessageLength = 1_000;
11
+ export const makePerformActionOnRunnerContract = () => {
12
+ const input = z.object({
13
+ action: browserActionSchema.describe("The action to perform. Coordinates are pixels on the screenshot's own coordinate space."),
14
+ id: runnerIdSchema.describe("Id of the runner to act on."),
15
+ });
16
+ const output = z.discriminatedUnion("outcome", [
17
+ z.object({ outcome: z.literal("performed") }),
18
+ z.object({
19
+ errorMessage: z
20
+ .string()
21
+ .max(maxActionErrorMessageLength)
22
+ .describe("What stopped the action from taking effect."),
23
+ outcome: z.literal("action-failed"),
24
+ }),
25
+ runnerScreenNeedsARunSchema,
26
+ runnerScreenNotReadySchema,
27
+ runnerHasNoScreenSchema,
28
+ runnerUnreachableSchema,
29
+ ]);
30
+ return {
31
+ 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). \`performed\` if the action took effect. \`action-failed\`, with a reason, if it reached the runner and did not take effect. ${screenNeedsARunDescription} ${screenNotReadyDescription} A \`navigate\` does not go through the screen, so a screen that is not ready does not stop it — but it still needs the runner to have run something, and until then it answers \`action-failed\` rather than \`screen-needs-a-run\`. ${runnerHasNoScreenDescription} ${unreachableDescription}`,
32
+ input,
33
+ kind: "write",
34
+ name: "runner.performAction",
35
+ output,
36
+ };
37
+ };
38
+ //# sourceMappingURL=performAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"performAction.js","sourceRoot":"","sources":["../../../src/v1/runner/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yBAAyB,yOAAyO,4BAA4B,IAAI,sBAAsB,EAAE;QACr6B,KAAK;QACL,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,sBAAsB;QAC5B,MAAM;KAMP,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { z } from "zod";
2
+ export declare const runnerScreenNotReadySchema: z.ZodObject<{
3
+ outcome: z.ZodLiteral<"screen-not-ready">;
4
+ }, z.core.$strip>;
5
+ 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.";
6
+ export declare const runnerScreenNeedsARunSchema: z.ZodObject<{
7
+ outcome: z.ZodLiteral<"screen-needs-a-run">;
8
+ }, z.core.$strip>;
9
+ export declare const screenNeedsARunDescription = "`screen-needs-a-run` if the runner has not run anything yet, so its virtual desktop has never started. Waiting will not change this and retrying is pointless \u2014 call `runner.runFlow` on the runner, then ask for the screen again. Evaluating a snippet does not start the desktop.";
10
+ export declare const runnerHasNoScreenSchema: z.ZodObject<{
11
+ outcome: z.ZodLiteral<"runner-has-no-screen">;
12
+ }, z.core.$strip>;
13
+ 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 `node20WithPlaywright` runner instead.";
14
+ //# sourceMappingURL=screen.d.ts.map
@@ -0,0 +1 @@
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,0BAA0B;;iBAErC,CAAC;AAEH,eAAO,MAAM,yBAAyB,yXAC6U,CAAC;AAIpX,eAAO,MAAM,2BAA2B;;iBAEtC,CAAC;AAEH,eAAO,MAAM,0BAA0B,8RACiP,CAAC;AAEzR,eAAO,MAAM,uBAAuB;;iBAElC,CAAC;AAEH,eAAO,MAAM,4BAA4B,2NAC4K,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ export const runnerScreenNotReadySchema = z.object({
3
+ outcome: z.literal("screen-not-ready"),
4
+ });
5
+ export 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 — a run may restart the display and discard what is on it.";
6
+ // Its own outcome, not a sentence inside `screen-not-ready`: the callers here are
7
+ // models, and an instruction that only exists in prose is one they may not follow.
8
+ export const runnerScreenNeedsARunSchema = z.object({
9
+ outcome: z.literal("screen-needs-a-run"),
10
+ });
11
+ export const screenNeedsARunDescription = "`screen-needs-a-run` if the runner has not run anything yet, so its virtual desktop has never started. Waiting will not change this and retrying is pointless — call `runner.runFlow` on the runner, then ask for the screen again. Evaluating a snippet does not start the desktop.";
12
+ export const runnerHasNoScreenSchema = z.object({
13
+ outcome: z.literal("runner-has-no-screen"),
14
+ });
15
+ 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 `node20WithPlaywright` runner instead.";
16
+ //# sourceMappingURL=screen.js.map
@@ -0,0 +1 @@
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,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC;CACvC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GACpC,iXAAiX,CAAC;AAEpX,kFAAkF;AAClF,mFAAmF;AACnF,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC;CACzC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,0BAA0B,GACrC,sRAAsR,CAAC;AAEzR,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC;CAC3C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,4BAA4B,GACvC,mNAAmN,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { z } from "zod";
2
+ export declare const makeTakeScreenshotOnRunnerContract: () => {
3
+ readonly description: "Take one screenshot of an interactive runner's screen. The image is the runner's whole virtual desktop, browser window and all. `screen-needs-a-run` if the runner has not run anything yet, so its virtual desktop has never started. Waiting will not change this and retrying is pointless — call `runner.runFlow` on the runner, then ask for the screen again. 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 `node20WithPlaywright` 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
+ readonly input: z.ZodObject<{
5
+ id: z.ZodString;
6
+ }, z.core.$strip>;
7
+ readonly kind: "read";
8
+ readonly name: "runner.takeScreenshot";
9
+ readonly output: z.ZodDiscriminatedUnion<[z.ZodObject<{
10
+ imageJpegBase64: z.ZodString;
11
+ outcome: z.ZodLiteral<"captured">;
12
+ }, z.core.$strip>, z.ZodObject<{
13
+ outcome: z.ZodLiteral<"screen-needs-a-run">;
14
+ }, z.core.$strip>, z.ZodObject<{
15
+ outcome: z.ZodLiteral<"screen-not-ready">;
16
+ }, z.core.$strip>, z.ZodObject<{
17
+ outcome: z.ZodLiteral<"runner-has-no-screen">;
18
+ }, z.core.$strip>, z.ZodObject<{
19
+ outcome: z.ZodLiteral<"runner-unreachable">;
20
+ }, z.core.$strip>], "outcome">;
21
+ };
22
+ //# sourceMappingURL=takeScreenshot.d.ts.map
@@ -0,0 +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;AAkBxB,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;CAqC9C,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { z } from "zod";
2
+ import { runnerIdSchema } from "./identity.js";
3
+ import { runnerHasNoScreenDescription, runnerHasNoScreenSchema, runnerScreenNeedsARunSchema, runnerScreenNotReadySchema, screenNeedsARunDescription, screenNotReadyDescription, } from "./screen.js";
4
+ import { retryableRunnerUnreachableDescription, runnerUnreachableSchema, } from "./unreachable.js";
5
+ export const makeTakeScreenshotOnRunnerContract = () => {
6
+ const input = z.object({
7
+ id: runnerIdSchema.describe("Id of the runner to take a screenshot of."),
8
+ });
9
+ const output = z.discriminatedUnion("outcome", [
10
+ z.object({
11
+ // Not `z.base64()`: its regex runs against every multi-megabyte frame,
12
+ // on the server and in every client that parses with this schema
13
+ // (https://github.com/colinhacks/zod/issues/4283), and the value comes
14
+ // from our own encoder.
15
+ imageJpegBase64: z
16
+ .string()
17
+ .min(1)
18
+ .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."),
19
+ outcome: z.literal("captured"),
20
+ }),
21
+ runnerScreenNeedsARunSchema,
22
+ runnerScreenNotReadySchema,
23
+ runnerHasNoScreenSchema,
24
+ runnerUnreachableSchema,
25
+ ]);
26
+ return {
27
+ description: `Take one screenshot of an interactive runner's screen. The image is the runner's whole virtual desktop, browser window and all. ${screenNeedsARunDescription} ${screenNotReadyDescription} ${runnerHasNoScreenDescription} ${retryableRunnerUnreachableDescription}`,
28
+ input,
29
+ kind: "read",
30
+ name: "runner.takeScreenshot",
31
+ output,
32
+ };
33
+ };
34
+ //# sourceMappingURL=takeScreenshot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"takeScreenshot.js","sourceRoot":"","sources":["../../../src/v1/runner/takeScreenshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EACL,4BAA4B,EAC5B,uBAAuB,EACvB,2BAA2B,EAC3B,0BAA0B,EAC1B,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,qCAAqC,EACrC,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,CAAC,MAAM,kCAAkC,GAAG,GAAG,EAAE;IACrD,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC;QACrB,EAAE,EAAE,cAAc,CAAC,QAAQ,CAAC,2CAA2C,CAAC;KACzE,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,CAAC,CAAC,kBAAkB,CAAC,SAAS,EAAE;QAC7C,CAAC,CAAC,MAAM,CAAC;YACP,uEAAuE;YACvE,iEAAiE;YACjE,uEAAuE;YACvE,wBAAwB;YACxB,eAAe,EAAE,CAAC;iBACf,MAAM,EAAE;iBACR,GAAG,CAAC,CAAC,CAAC;iBACN,QAAQ,CACP,8KAA8K,CAC/K;YACH,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;SAC/B,CAAC;QACF,2BAA2B;QAC3B,0BAA0B;QAC1B,uBAAuB;QACvB,uBAAuB;KACxB,CAAC,CAAC;IAEH,OAAO;QACL,WAAW,EAAE,mIAAmI,0BAA0B,IAAI,yBAAyB,IAAI,4BAA4B,IAAI,qCAAqC,EAAE;QAClR,KAAK;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,uBAAuB;QAC7B,MAAM;KAMP,CAAC;AACJ,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qawolf/api-contracts",
3
- "version": "0.22.0",
3
+ "version": "0.25.0",
4
4
  "private": false,
5
5
  "description": "Versioned contracts for the QA Wolf public API",
6
6
  "repository": {