@qawolf/api-contracts 0.22.0 → 0.24.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/ids.d.ts CHANGED
@@ -9,7 +9,8 @@ export type PublicIdSchema = z.ZodType<string, string>;
9
9
  * injected schema types (TypeScript resolves the indexed access to its
10
10
  * constraint inside the factory body).
11
11
  */
12
- export type PublicIdSchemasOf<EnvironmentId extends PublicIdSchema, FlowId extends PublicIdSchema, RunId extends PublicIdSchema, AutomationId extends PublicIdSchema = PublicIdSchema, IssueId extends PublicIdSchema = PublicIdSchema, WorkspaceId extends PublicIdSchema = PublicIdSchema> = {
12
+ export type PublicIdSchemasOf<EnvironmentId extends PublicIdSchema, FlowId extends PublicIdSchema, RunId extends PublicIdSchema, AutomationId extends PublicIdSchema = PublicIdSchema, IssueId extends PublicIdSchema = PublicIdSchema, WorkspaceId extends PublicIdSchema = PublicIdSchema, AiTaskId extends PublicIdSchema = PublicIdSchema> = {
13
+ aiTask: AiTaskId;
13
14
  automation: AutomationId;
14
15
  environment: EnvironmentId;
15
16
  /**
@@ -23,7 +24,7 @@ export type PublicIdSchemasOf<EnvironmentId extends PublicIdSchema, FlowId exten
23
24
  run: RunId;
24
25
  workspace: WorkspaceId;
25
26
  };
26
- export type PublicIdSchemas = PublicIdSchemasOf<PublicIdSchema, PublicIdSchema, PublicIdSchema, PublicIdSchema, PublicIdSchema, PublicIdSchema>;
27
+ export type PublicIdSchemas = PublicIdSchemasOf<PublicIdSchema, PublicIdSchema, PublicIdSchema, PublicIdSchema, PublicIdSchema, PublicIdSchema, PublicIdSchema>;
27
28
  /**
28
29
  * The default schemas validate loosely: the server is the source of truth
29
30
  * for id formats (including legacy formats), and encoding those rules here
@@ -1 +1 @@
1
- {"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../src/v1/ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,M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Q,CAAC;IACjB,UAAU,EAAE,YAAY,CAAC;IACzB,WAAW,EAAE,aAAa,CAAC;IAC3B;;;;OAIG;IACH,cAAc,EAAE,cAAc,CAAC;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,KAAK,CAAC;IACX,SAAS,EAAE,WAAW,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,iBAAiB,CAC7C,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,CACf,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,eAc9B,CAAC"}
package/dist/v1/ids.js CHANGED
@@ -6,6 +6,7 @@ import { z } from "zod";
6
6
  * schemas instead.
7
7
  */
8
8
  export const defaultIdSchemas = {
9
+ aiTask: z.string().min(1).describe("The id of the AI task."),
9
10
  automation: z.string().min(1).describe("The id of the automation."),
10
11
  environment: z.string().min(1).describe("The id of the environment."),
11
12
  environmentRef: z
@@ -1 +1 @@
1
- {"version":3,"file":"ids.js","sourceRoot":"","sources":["../../src/v1/ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA4CxB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAoB;IAC/C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,2BAA2B,CAAC;IACnE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,4BAA4B,CAAC;IACrE,cAAc,EAAE,CAAC;SACd,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACP,qEAAqE,CACtE;IACH,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAA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C,CAAC,CAAC,QAAQ,CAAC,oBAAoB,CAAC;IACrD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,0BAA0B,CAAC;CAClE,CAAC"}
@@ -3,11 +3,13 @@ export type { AnyPublicApiContract, PublicApiContract, PublicApiContractKind, }
3
3
  export { type IdentityResponse, identityResponse } from "./identity/index.js";
4
4
  export { type PublicIdSchema, type PublicIdSchemas, defaultIdSchemas, } from "./ids.js";
5
5
  export { makeFlowSelectionSchema } from "./run/index.js";
6
+ export { type BrowserAction, browserActionSchema, } from "./runner/browserAction.js";
6
7
  export { runEnvironmentSchema } from "./runner/environment.js";
7
8
  export { isShippableRunFilePath, runFilePathSchema, runPackageJsonPath, shippableRunFileExtensions, } from "./runner/files.js";
8
9
  export { type RunnerNameForPublicApi, makeRunnerSchema, runnerIdSchema, runnerNameSchema, } from "./runner/identity.js";
9
10
  export { type JournalEntry, type JournalStream, type KnownJournalStream, type ReadJournalRequest, type ReadJournalResponse, journalEntrySchema, journalStreamSchema, knownJournalStreams, maxJournalStreamNameLength, readJournalRequestSchema, readJournalResponseSchema, } from "./runner/journal.js";
10
11
  export { type RunFiles, maxRunFilesByteLength, maxRunnerRequestEncodedByteLength, runFilesByteLength, runFilesSchema, } from "./runner/payloadSize.js";
12
+ export { maxActionErrorMessageLength } from "./runner/performAction.js";
11
13
  import type { AnyPublicApiContract } from "./definition.js";
12
14
  import { type PublicIdSchema, type PublicIdSchemasOf } from "./ids.js";
13
15
  export type PublicApiInput<Api extends AnyPublicApiContract> = z.input<Api["input"]>;
@@ -19,7 +21,7 @@ export type PublicApiOutput<Api extends AnyPublicApiContract> = z.infer<Api["out
19
21
  * the same factory with its own strict id schemas, so the contract shape can
20
22
  * never drift between the two while validation strictness stays server-owned.
21
23
  */
22
- export declare const makeContractsV1: <EnvironmentId extends PublicIdSchema, FlowId extends PublicIdSchema, RunId extends PublicIdSchema, AutomationId extends PublicIdSchema = PublicIdSchema, IssueId extends PublicIdSchema = PublicIdSchema, WorkspaceId extends PublicIdSchema = PublicIdSchema>(ids: PublicIdSchemasOf<EnvironmentId, FlowId, RunId, AutomationId, IssueId, WorkspaceId>) => {
24
+ export declare const makeContractsV1: <EnvironmentId extends PublicIdSchema, FlowId extends PublicIdSchema, RunId extends PublicIdSchema, AutomationId extends PublicIdSchema = PublicIdSchema, IssueId extends PublicIdSchema = PublicIdSchema, WorkspaceId extends PublicIdSchema = PublicIdSchema, AiTaskId extends PublicIdSchema = PublicIdSchema>(ids: PublicIdSchemasOf<EnvironmentId, FlowId, RunId, AutomationId, IssueId, WorkspaceId, AiTaskId>) => {
23
25
  automate: {
24
26
  readonly description: "Request automation for draft flows. First create a named local .flow.ts draft for every requested journey that does not already have a matching draft; never reuse a generic starter or placeholder. Each new draft must start with a JSDoc Goal: description, import flow from @qawolf/flows/web, and use export default flow(...); a comment-only file or direct test(...) call is not a valid draft. Commit and push all changes with Git to publish them, then list remote drafts to resolve every selected ID. Do not use patch to create or rename a selected flow. Finally make one automation request containing all requested flow IDs.";
25
27
  readonly input: z.ZodObject<{
@@ -540,6 +542,7 @@ export declare const makeContractsV1: <EnvironmentId extends PublicIdSchema, Flo
540
542
  create: {
541
543
  readonly description: "Create a run for the selected flows and/or tags in an environment.";
542
544
  readonly input: z.ZodIntersection<z.ZodObject<{
545
+ aiTaskId: z.ZodOptional<AiTaskId>;
543
546
  environmentId: PublicIdSchema;
544
547
  environmentVariables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
545
548
  ignoreRules: z.ZodDefault<z.ZodBoolean>;
@@ -685,6 +688,63 @@ export declare const makeContractsV1: <EnvironmentId extends PublicIdSchema, Flo
685
688
  }>;
686
689
  }, z.core.$strip>;
687
690
  };
691
+ performAction: {
692
+ 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.";
693
+ readonly input: z.ZodObject<{
694
+ action: z.ZodDiscriminatedUnion<[z.ZodObject<{
695
+ button: z.ZodLiteral<"left" | "right" | "wheel" | "back" | "forward">;
696
+ type: z.ZodLiteral<"click">;
697
+ x: z.ZodInt;
698
+ y: z.ZodInt;
699
+ }, z.core.$strict>, z.ZodObject<{
700
+ type: z.ZodLiteral<"double_click">;
701
+ x: z.ZodInt;
702
+ y: z.ZodInt;
703
+ }, z.core.$strict>, z.ZodObject<{
704
+ scroll_x: z.ZodInt;
705
+ scroll_y: z.ZodInt;
706
+ type: z.ZodLiteral<"scroll">;
707
+ x: z.ZodInt;
708
+ y: z.ZodInt;
709
+ }, z.core.$strict>, z.ZodObject<{
710
+ type: z.ZodLiteral<"move">;
711
+ x: z.ZodInt;
712
+ y: z.ZodInt;
713
+ }, z.core.$strict>, z.ZodObject<{
714
+ path: z.ZodArray<z.ZodObject<{
715
+ x: z.ZodInt;
716
+ y: z.ZodInt;
717
+ }, z.core.$strict>>;
718
+ type: z.ZodLiteral<"drag">;
719
+ }, z.core.$strict>, z.ZodObject<{
720
+ keys: z.ZodArray<z.ZodString>;
721
+ type: z.ZodLiteral<"keypress">;
722
+ }, z.core.$strict>, z.ZodObject<{
723
+ type: z.ZodLiteral<"navigate">;
724
+ url: z.ZodURL;
725
+ }, z.core.$strict>, z.ZodObject<{
726
+ text: z.ZodString;
727
+ type: z.ZodLiteral<"type">;
728
+ }, z.core.$strict>], "type">;
729
+ id: z.ZodString;
730
+ }, z.core.$strip>;
731
+ readonly kind: "write";
732
+ readonly name: "runner.performAction";
733
+ readonly output: z.ZodDiscriminatedUnion<[z.ZodObject<{
734
+ outcome: z.ZodLiteral<"performed">;
735
+ }, z.core.$strip>, z.ZodObject<{
736
+ errorMessage: z.ZodString;
737
+ outcome: z.ZodLiteral<"action-failed">;
738
+ }, z.core.$strip>, z.ZodObject<{
739
+ outcome: z.ZodLiteral<"screen-needs-a-run">;
740
+ }, z.core.$strip>, z.ZodObject<{
741
+ outcome: z.ZodLiteral<"screen-not-ready">;
742
+ }, z.core.$strip>, z.ZodObject<{
743
+ outcome: z.ZodLiteral<"runner-has-no-screen">;
744
+ }, z.core.$strip>, z.ZodObject<{
745
+ outcome: z.ZodLiteral<"runner-unreachable">;
746
+ }, z.core.$strip>], "outcome">;
747
+ };
688
748
  readJournal: {
689
749
  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.";
690
750
  readonly input: z.ZodObject<{
@@ -760,6 +820,26 @@ export declare const makeContractsV1: <EnvironmentId extends PublicIdSchema, Flo
760
820
  }>;
761
821
  }, z.core.$strip>;
762
822
  };
823
+ takeScreenshot: {
824
+ 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.";
825
+ readonly input: z.ZodObject<{
826
+ id: z.ZodString;
827
+ }, z.core.$strip>;
828
+ readonly kind: "read";
829
+ readonly name: "runner.takeScreenshot";
830
+ readonly output: z.ZodDiscriminatedUnion<[z.ZodObject<{
831
+ imageJpegBase64: z.ZodString;
832
+ outcome: z.ZodLiteral<"captured">;
833
+ }, z.core.$strip>, z.ZodObject<{
834
+ outcome: z.ZodLiteral<"screen-needs-a-run">;
835
+ }, z.core.$strip>, z.ZodObject<{
836
+ outcome: z.ZodLiteral<"screen-not-ready">;
837
+ }, z.core.$strip>, z.ZodObject<{
838
+ outcome: z.ZodLiteral<"runner-has-no-screen">;
839
+ }, z.core.$strip>, z.ZodObject<{
840
+ outcome: z.ZodLiteral<"runner-unreachable">;
841
+ }, z.core.$strip>], "outcome">;
842
+ };
763
843
  };
764
844
  tag: {
765
845
  create: {
@@ -1318,6 +1398,7 @@ export declare const publicContractsV1: {
1318
1398
  create: {
1319
1399
  readonly description: "Create a run for the selected flows and/or tags in an environment.";
1320
1400
  readonly input: z.ZodIntersection<z.ZodObject<{
1401
+ aiTaskId: z.ZodOptional<PublicIdSchema>;
1321
1402
  environmentId: PublicIdSchema;
1322
1403
  environmentVariables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1323
1404
  ignoreRules: z.ZodDefault<z.ZodBoolean>;
@@ -1463,6 +1544,63 @@ export declare const publicContractsV1: {
1463
1544
  }>;
1464
1545
  }, z.core.$strip>;
1465
1546
  };
1547
+ performAction: {
1548
+ 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.";
1549
+ readonly input: z.ZodObject<{
1550
+ action: z.ZodDiscriminatedUnion<[z.ZodObject<{
1551
+ button: z.ZodLiteral<"left" | "right" | "wheel" | "back" | "forward">;
1552
+ type: z.ZodLiteral<"click">;
1553
+ x: z.ZodInt;
1554
+ y: z.ZodInt;
1555
+ }, z.core.$strict>, z.ZodObject<{
1556
+ type: z.ZodLiteral<"double_click">;
1557
+ x: z.ZodInt;
1558
+ y: z.ZodInt;
1559
+ }, z.core.$strict>, z.ZodObject<{
1560
+ scroll_x: z.ZodInt;
1561
+ scroll_y: z.ZodInt;
1562
+ type: z.ZodLiteral<"scroll">;
1563
+ x: z.ZodInt;
1564
+ y: z.ZodInt;
1565
+ }, z.core.$strict>, z.ZodObject<{
1566
+ type: z.ZodLiteral<"move">;
1567
+ x: z.ZodInt;
1568
+ y: z.ZodInt;
1569
+ }, z.core.$strict>, z.ZodObject<{
1570
+ path: z.ZodArray<z.ZodObject<{
1571
+ x: z.ZodInt;
1572
+ y: z.ZodInt;
1573
+ }, z.core.$strict>>;
1574
+ type: z.ZodLiteral<"drag">;
1575
+ }, z.core.$strict>, z.ZodObject<{
1576
+ keys: z.ZodArray<z.ZodString>;
1577
+ type: z.ZodLiteral<"keypress">;
1578
+ }, z.core.$strict>, z.ZodObject<{
1579
+ type: z.ZodLiteral<"navigate">;
1580
+ url: z.ZodURL;
1581
+ }, z.core.$strict>, z.ZodObject<{
1582
+ text: z.ZodString;
1583
+ type: z.ZodLiteral<"type">;
1584
+ }, z.core.$strict>], "type">;
1585
+ id: z.ZodString;
1586
+ }, z.core.$strip>;
1587
+ readonly kind: "write";
1588
+ readonly name: "runner.performAction";
1589
+ readonly output: z.ZodDiscriminatedUnion<[z.ZodObject<{
1590
+ outcome: z.ZodLiteral<"performed">;
1591
+ }, z.core.$strip>, z.ZodObject<{
1592
+ errorMessage: z.ZodString;
1593
+ outcome: z.ZodLiteral<"action-failed">;
1594
+ }, z.core.$strip>, z.ZodObject<{
1595
+ outcome: z.ZodLiteral<"screen-needs-a-run">;
1596
+ }, z.core.$strip>, z.ZodObject<{
1597
+ outcome: z.ZodLiteral<"screen-not-ready">;
1598
+ }, z.core.$strip>, z.ZodObject<{
1599
+ outcome: z.ZodLiteral<"runner-has-no-screen">;
1600
+ }, z.core.$strip>, z.ZodObject<{
1601
+ outcome: z.ZodLiteral<"runner-unreachable">;
1602
+ }, z.core.$strip>], "outcome">;
1603
+ };
1466
1604
  readJournal: {
1467
1605
  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.";
1468
1606
  readonly input: z.ZodObject<{
@@ -1538,6 +1676,26 @@ export declare const publicContractsV1: {
1538
1676
  }>;
1539
1677
  }, z.core.$strip>;
1540
1678
  };
1679
+ takeScreenshot: {
1680
+ 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.";
1681
+ readonly input: z.ZodObject<{
1682
+ id: z.ZodString;
1683
+ }, z.core.$strip>;
1684
+ readonly kind: "read";
1685
+ readonly name: "runner.takeScreenshot";
1686
+ readonly output: z.ZodDiscriminatedUnion<[z.ZodObject<{
1687
+ imageJpegBase64: z.ZodString;
1688
+ outcome: z.ZodLiteral<"captured">;
1689
+ }, z.core.$strip>, z.ZodObject<{
1690
+ outcome: z.ZodLiteral<"screen-needs-a-run">;
1691
+ }, z.core.$strip>, z.ZodObject<{
1692
+ outcome: z.ZodLiteral<"screen-not-ready">;
1693
+ }, z.core.$strip>, z.ZodObject<{
1694
+ outcome: z.ZodLiteral<"runner-has-no-screen">;
1695
+ }, z.core.$strip>, z.ZodObject<{
1696
+ outcome: z.ZodLiteral<"runner-unreachable">;
1697
+ }, z.core.$strip>], "outcome">;
1698
+ };
1541
1699
  };
1542
1700
  tag: {
1543
1701
  create: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,YAAY,EACV,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,gBAAgB,GACjB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAIzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAK/D,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,0BAA0B,GAC3B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,KAAK,sBAAsB,EAC3B,gBAAgB,EAChB,cAAc,EACd,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,QAAQ,EACb,qBAAqB,EACrB,iCAAiC,EACjC,kBAAkB,EAClB,cAAc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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAoC,CAAC"}
package/dist/v1/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export { identityResponse } from "./identity/index.js";
2
2
  export { defaultIdSchemas, } from "./ids.js";
3
3
  export { makeFlowSelectionSchema } from "./run/index.js";
4
+ export { browserActionSchema, } from "./runner/browserAction.js";
4
5
  // Carries the reservation of QA Wolf's own variable names, which the server
5
6
  // validates with rather than restating — a second copy of that rule is how the
6
7
  // reservation comes to differ from what is actually stamped.
@@ -15,6 +16,7 @@ export { makeRunnerSchema, runnerIdSchema, runnerNameSchema, } from "./runner/id
15
16
  // published here and the private journal package imports them from here.
16
17
  export { journalEntrySchema, journalStreamSchema, knownJournalStreams, maxJournalStreamNameLength, readJournalRequestSchema, readJournalResponseSchema, } from "./runner/journal.js";
17
18
  export { maxRunFilesByteLength, maxRunnerRequestEncodedByteLength, runFilesByteLength, runFilesSchema, } from "./runner/payloadSize.js";
19
+ export { maxActionErrorMessageLength } from "./runner/performAction.js";
18
20
  import { makeAutomateContract } from "./automate/index.js";
19
21
  import { makeDeleteEnvironmentVariableContract } from "./environment/deleteVariable.js";
20
22
  import { makeFindEnvironmentsContract } from "./environment/find.js";
@@ -33,8 +35,10 @@ import { makeGetRunContract } from "./run/get.js";
33
35
  import { makeCreateRunContract } from "./run/index.js";
34
36
  import { makeEvaluateSnippetOnRunnerContract } from "./runner/evaluateSnippet.js";
35
37
  import { makeLaunchRunnerContract, makeStopRunnerContract, } from "./runner/index.js";
38
+ import { makePerformActionOnRunnerContract } from "./runner/performAction.js";
36
39
  import { makeReadRunnerJournalContract } from "./runner/readJournal.js";
37
40
  import { makeRunFlowOnRunnerContract } from "./runner/runFlow.js";
41
+ import { makeTakeScreenshotOnRunnerContract } from "./runner/takeScreenshot.js";
38
42
  import { makeCreateTagContract } from "./tag/index.js";
39
43
  import { makeListTagsContract } from "./tag/list.js";
40
44
  /**
@@ -79,9 +83,11 @@ export const makeContractsV1 = (ids) => {
79
83
  runner: {
80
84
  evaluateSnippet: makeEvaluateSnippetOnRunnerContract(),
81
85
  launch: makeLaunchRunnerContract(),
86
+ performAction: makePerformActionOnRunnerContract(),
82
87
  readJournal: makeReadRunnerJournalContract(),
83
88
  runFlow: makeRunFlowOnRunnerContract(),
84
89
  stop: makeStopRunnerContract(),
90
+ takeScreenshot: makeTakeScreenshotOnRunnerContract(),
85
91
  },
86
92
  tag: {
87
93
  create: makeCreateTagContract(),
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAyB,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAGL,gBAAgB,GACjB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzD,4EAA4E;AAC5E,+EAA+E;AAC/E,6DAA6D;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,iFAAiF;AACjF,iFAAiF;AACjF,+EAA+E;AAC/E,gFAAgF;AAChF,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,0BAA0B,GAC3B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEL,gBAAgB,EAChB,cAAc,EACd,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5C,IAAI,EAAE,sBAAsB,CAAC,WAAW,CAAC;YACzC,GAAG,EAAE,oBAAoB,CAAC,WAAW,CAAC;YACtC,MAAM,EAAE,uBAAuB,CAAC,WAAW,CAAC;SAC7C;QACD,GAAG,EAAE;YACH,MAAM,EAAE,qBAAqB,CAAC,WAAW,CAAC;YAC1C,IAAI,EAAE,oBAAoB,CAAC,WAAW,CAAC;YACvC,GAAG,EAAE,kBAAkB,CAAC,WAAW,CAAC;SACrC;QACD,MAAM,EAAE;YACN,eAAe,EAAE,mCAAmC,EAAE;YACtD,MAAM,EAAE,wBAAwB,EAAE;YAClC,aAAa,EAAE,iCAAiC,EAAE;YAClD,WAAW,EAAE,6BAA6B,EAAE;YAC5C,OAAO,EAAE,2BAA2B,EAAE;YACtC,IAAI,EAAE,sBAAsB,EAAE;YAC9B,cAAc,EAAE,kCAAkC,EAAE;SACrD;QACD,GAAG,EAAE;YACH,MAAM,EAAE,qBAAqB,EAAE;YAC/B,IAAI,EAAE,oBAAoB,CAAC,WAAW,CAAC;SACxC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,eAAe,CAAC,gBAAgB,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,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,E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AAC;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;;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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/performAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,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,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,gFAAgF;AAChF,mBAAmB;AACnB,MAAM,sBAAsB,GAC1B,mQAAmQ,CAAC;AAEtQ,uDAAuD;AACvD,MAAM,CAAC,MAAM,2BAA2B,GAAG,KAAK,CAAC;AAEjD,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAAG,EAAE;IACpD,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;KAC3D,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,CAAC,CAAC,kBAAkB,CAAC,SAAS,EAAE;QAC7C,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;QAC7C,CAAC,CAAC,MAAM,CAAC;YACP,YAAY,EAAE,CAAC;iBACZ,MAAM,EAAE;iBACR,GAAG,CAAC,2BAA2B,CAAC;iBAChC,QAAQ,CAAC,6CAA6C,CAAC;YAC1D,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC;SACpC,CAAC;QACF,2BAA2B;QAC3B,0BAA0B;QAC1B,uBAAuB;QACvB,uBAAuB;KACxB,CAAC,CAAC;IAEH,OAAO;QACL,WAAW,EAAE,gkBAAgkB,0BAA0B,IAAI,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.24.0",
4
4
  "private": false,
5
5
  "description": "Versioned contracts for the QA Wolf public API",
6
6
  "repository": {