humanish 0.116.0 → 0.117.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 (52) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/actors/codex/restricted-participant-policy.d.ts +0 -2
  3. package/dist/actors/codex/restricted-participant-policy.js +4 -32
  4. package/dist/actors/codex/restricted-participant.d.ts +5 -0
  5. package/dist/actors/codex/restricted-participant.js +3 -2
  6. package/dist/actors/computer-use/actor.d.ts +4 -0
  7. package/dist/actors/computer-use/actor.js +2 -0
  8. package/dist/actors/computer-use/loop/actions.d.ts +4 -4
  9. package/dist/actors/computer-use/loop/actions.js +25 -18
  10. package/dist/actors/computer-use/loop/session.d.ts +3 -0
  11. package/dist/actors/computer-use/loop/session.js +9 -1
  12. package/dist/actors/computer-use/loop/trace.js +1 -0
  13. package/dist/actors/computer-use/loop/types.d.ts +16 -14
  14. package/dist/actors/computer-use/loop.d.ts +1 -1
  15. package/dist/actors/computer-use/loop.js +1 -1
  16. package/dist/actors/computer-use/wait.d.ts +74 -0
  17. package/dist/actors/computer-use/wait.js +100 -0
  18. package/dist/actors/contract.d.ts +14 -0
  19. package/dist/browser-control/protocol.d.ts +86 -6
  20. package/dist/browser-control/protocol.js +13 -6
  21. package/dist/guest/desktop-executor.js +3 -1
  22. package/dist/observer-app.html +7 -7
  23. package/dist/routes/computer-use/e2b-desktop/prepare.js +40 -31
  24. package/dist/routes/computer-use/local-vm.js +5 -2
  25. package/dist/routes/computer-use/participant-model.js +9 -0
  26. package/dist/routes/computer-use/plan.js +4 -2
  27. package/dist/routes/computer-use/types.d.ts +1 -1
  28. package/dist/routes/shared-world/plan.js +2 -1
  29. package/dist/routes/terminal/live-sandbox.d.ts +1 -1
  30. package/dist/routes/terminal/live-sandbox.js +14 -11
  31. package/dist/routes/terminal/sandbox.d.ts +4 -3
  32. package/dist/routes/terminal/sandbox.js +5 -5
  33. package/dist/study/config.js +4 -1
  34. package/dist/study/keys.d.ts +2 -0
  35. package/dist/study/keys.js +2 -0
  36. package/dist/study/migrate/v2.js +2 -1
  37. package/dist/study/parse/actors.js +8 -0
  38. package/dist/study/plan-participants.d.ts +4 -0
  39. package/dist/study/plan-participants.js +4 -0
  40. package/dist/study/types.d.ts +14 -0
  41. package/dist/study/validation.d.ts +5 -0
  42. package/dist/study/validation.js +8 -0
  43. package/dist/study/warnings.js +12 -0
  44. package/dist/subject/serve.d.ts +3 -0
  45. package/dist/subject/serve.js +4 -1
  46. package/dist/substrates/detached.js +14 -7
  47. package/dist/substrates/e2b/desktop-executor.d.ts +0 -2
  48. package/dist/substrates/e2b/desktop-executor.js +3 -3
  49. package/dist/tui-app.js +117 -116
  50. package/docs/architecture/browser-control.md +10 -4
  51. package/docs/contracts/schemas.md +19 -11
  52. package/package.json +2 -2
@@ -26,7 +26,7 @@ export interface BrowserControlIdentity {
26
26
  challenge: string;
27
27
  runtimeRevision: string;
28
28
  }
29
- export declare const browserOnlyControlActionSchema: z.ZodDiscriminatedUnion<readonly [z.ZodObject<{
29
+ export declare const participantActionSchema: z.ZodPipe<z.ZodDiscriminatedUnion<readonly [z.ZodObject<{
30
30
  x: z.ZodNumber;
31
31
  y: z.ZodNumber;
32
32
  kind: z.ZodLiteral<"click">;
@@ -66,8 +66,88 @@ export declare const browserOnlyControlActionSchema: z.ZodDiscriminatedUnion<rea
66
66
  ms: z.ZodOptional<z.ZodNumber>;
67
67
  }, z.core.$strict>, z.ZodObject<{
68
68
  kind: z.ZodLiteral<"screenshot">;
69
- }, z.core.$strict>], "kind">;
70
- export declare const browserControlActionSchema: z.ZodPipe<z.ZodDiscriminatedUnion<[z.ZodObject<{
69
+ }, z.core.$strict>], "kind">, z.ZodTransform<{
70
+ kind: "click";
71
+ x: number;
72
+ y: number;
73
+ button?: "left" | "right" | "middle";
74
+ heldKeys?: string[];
75
+ } | {
76
+ kind: "double_click";
77
+ x: number;
78
+ y: number;
79
+ heldKeys?: string[];
80
+ } | {
81
+ kind: "move";
82
+ x: number;
83
+ y: number;
84
+ heldKeys?: string[];
85
+ } | {
86
+ kind: "scroll";
87
+ x: number;
88
+ y: number;
89
+ dx: number;
90
+ dy: number;
91
+ heldKeys?: string[];
92
+ } | {
93
+ kind: "type";
94
+ text: string;
95
+ } | {
96
+ kind: "keypress";
97
+ keys: string[];
98
+ } | {
99
+ kind: "drag";
100
+ path: Array<{
101
+ x: number;
102
+ y: number;
103
+ }>;
104
+ heldKeys?: string[];
105
+ } | {
106
+ kind: "wait";
107
+ ms?: number;
108
+ } | {
109
+ kind: "speak";
110
+ text: string;
111
+ } | {
112
+ kind: "screenshot";
113
+ }, {
114
+ kind: "type";
115
+ text: string;
116
+ } | {
117
+ kind: "keypress";
118
+ keys: string[];
119
+ } | {
120
+ kind: "screenshot";
121
+ } | {
122
+ x: number;
123
+ y: number;
124
+ kind: "click";
125
+ button?: "left" | "middle" | "right" | undefined;
126
+ } | {
127
+ x: number;
128
+ y: number;
129
+ kind: "double_click";
130
+ } | {
131
+ x: number;
132
+ y: number;
133
+ kind: "move";
134
+ } | {
135
+ x: number;
136
+ y: number;
137
+ kind: "scroll";
138
+ dx: number;
139
+ dy: number;
140
+ } | {
141
+ kind: "drag";
142
+ path: {
143
+ x: number;
144
+ y: number;
145
+ }[];
146
+ } | {
147
+ kind: "wait";
148
+ ms?: number | undefined;
149
+ }>>;
150
+ export declare const participantSpeechActionSchema: z.ZodPipe<z.ZodDiscriminatedUnion<[z.ZodObject<{
71
151
  x: z.ZodNumber;
72
152
  y: z.ZodNumber;
73
153
  kind: z.ZodLiteral<"click">;
@@ -160,9 +240,6 @@ export declare const browserControlActionSchema: z.ZodPipe<z.ZodDiscriminatedUni
160
240
  } | {
161
241
  kind: "keypress";
162
242
  keys: string[];
163
- } | {
164
- kind: "wait";
165
- ms?: number | undefined;
166
243
  } | {
167
244
  kind: "screenshot";
168
245
  } | {
@@ -193,6 +270,9 @@ export declare const browserControlActionSchema: z.ZodPipe<z.ZodDiscriminatedUni
193
270
  x: number;
194
271
  y: number;
195
272
  }[];
273
+ } | {
274
+ kind: "wait";
275
+ ms?: number | undefined;
196
276
  }>>;
197
277
  declare const observationSchema: z.ZodObject<{
198
278
  png: z.ZodString;
@@ -64,13 +64,18 @@ const dragAction = z.strictObject({
64
64
  });
65
65
  const typeAction = z.strictObject({ kind: z.literal("type"), text });
66
66
  const keypressAction = z.strictObject({ kind: z.literal("keypress"), keys: chord });
67
+ const waitMs = z.number().finite().min(0);
68
+ // One request carries one wait, so the wire bounds it by the request deadline.
67
69
  const waitAction = z.strictObject({
68
70
  kind: z.literal("wait"),
69
- ms: z.number().finite().min(0).max(BROWSER_CONTROL_LIMITS.waitMs).optional(),
71
+ ms: waitMs.max(BROWSER_CONTROL_LIMITS.waitMs).optional(),
70
72
  });
73
+ // A participant may ask for any wait: the loop shortens it to the study's longest and sends it in
74
+ // steps the wire accepts.
75
+ const participantWaitAction = z.strictObject({ kind: z.literal("wait"), ms: waitMs.optional() });
71
76
  const screenshotAction = z.strictObject({ kind: z.literal("screenshot") });
72
77
  const speakAction = z.strictObject({ kind: z.literal("speak"), text: speechText });
73
- const browserActionSchemas = [
78
+ const participantActionSchemas = [
74
79
  clickAction,
75
80
  doubleClickAction,
76
81
  moveAction,
@@ -78,13 +83,15 @@ const browserActionSchemas = [
78
83
  typeAction,
79
84
  keypressAction,
80
85
  dragAction,
81
- waitAction,
86
+ participantWaitAction,
82
87
  screenshotAction,
83
88
  ];
84
89
  // The Codex participant's tool schema: no held keys, so its tool surface stays as published.
85
- export const browserOnlyControlActionSchema = z.discriminatedUnion("kind", browserActionSchemas);
86
- export const browserControlActionSchema = z
87
- .discriminatedUnion("kind", [...browserActionSchemas, speakAction])
90
+ export const participantActionSchema = z
91
+ .discriminatedUnion("kind", participantActionSchemas)
92
+ .transform(toCuaAction);
93
+ export const participantSpeechActionSchema = z
94
+ .discriminatedUnion("kind", [...participantActionSchemas, speakAction])
88
95
  .transform(toCuaAction);
89
96
  // What crosses the host-guest wire: the participant actions plus held keys on pointer actions,
90
97
  // which the OpenAI provider maps from its computer tool.
@@ -1,5 +1,6 @@
1
1
  import { perceptualSignature } from "../evidence/frame-signature.js";
2
2
  import { setTimeout as delay } from "node:timers/promises";
3
+ import { CUA_WAIT_LIMITS } from "../actors/computer-use/wait.js";
3
4
  import { BROWSER_CONTROL_LIMITS, validateBrowserControlAction, validateBrowserControlPng, } from "../browser-control/protocol.js";
4
5
  import { ComputerUseExecutorError, isComputerUseExecutorError, } from "../actors/computer-use/executor-error.js";
5
6
  import { xdotoolChord, xdotoolHeldModifiers } from "./desktop-keys.js";
@@ -104,8 +105,9 @@ async function executeAction(context, state, value, callerSignal) {
104
105
  throw error;
105
106
  }
106
107
  }
108
+ // The loop sends every wait with its length; planWait owns the lengths.
107
109
  if (action.kind === "wait")
108
- await delay(action.ms ?? 250, undefined, { signal });
110
+ await delay(action.ms ?? CUA_WAIT_LIMITS.settleMs, undefined, { signal });
109
111
  for (const command of commands) {
110
112
  assertOpen(state, signal, progress.dispatched);
111
113
  // No await between authority check and the native port invocation.