humanish 0.0.1 → 0.15.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 (196) hide show
  1. package/AGENTS.md +77 -0
  2. package/CONTRIBUTING.md +39 -0
  3. package/LICENSE +21 -0
  4. package/README.md +435 -8
  5. package/SECURITY.md +34 -0
  6. package/dist/actor-contract.d.ts +107 -0
  7. package/dist/actor-contract.js +286 -0
  8. package/dist/actor-contract.js.map +1 -0
  9. package/dist/actor-registry.d.ts +73 -0
  10. package/dist/actor-registry.js +93 -0
  11. package/dist/actor-registry.js.map +1 -0
  12. package/dist/adapter-extension.d.ts +54 -0
  13. package/dist/adapter-extension.js +214 -0
  14. package/dist/adapter-extension.js.map +1 -0
  15. package/dist/argv.d.ts +1 -0
  16. package/dist/argv.js +8 -0
  17. package/dist/argv.js.map +1 -0
  18. package/dist/artifact-reference.d.ts +22 -0
  19. package/dist/artifact-reference.js +47 -0
  20. package/dist/artifact-reference.js.map +1 -0
  21. package/dist/browser-evidence-hygiene.d.ts +7 -0
  22. package/dist/browser-evidence-hygiene.js +40 -0
  23. package/dist/browser-evidence-hygiene.js.map +1 -0
  24. package/dist/claude-agent-sdk.d.ts +94 -0
  25. package/dist/claude-agent-sdk.js +356 -0
  26. package/dist/claude-agent-sdk.js.map +1 -0
  27. package/dist/cli.d.ts +2 -0
  28. package/dist/cli.js +5 -0
  29. package/dist/cli.js.map +1 -0
  30. package/dist/codex-app-server-ui.d.ts +39 -0
  31. package/dist/codex-app-server-ui.js +327 -0
  32. package/dist/codex-app-server-ui.js.map +1 -0
  33. package/dist/codex-app-server.d.ts +141 -0
  34. package/dist/codex-app-server.js +747 -0
  35. package/dist/codex-app-server.js.map +1 -0
  36. package/dist/command-failure.d.ts +29 -0
  37. package/dist/command-failure.js +54 -0
  38. package/dist/command-failure.js.map +1 -0
  39. package/dist/computer-use-actor.d.ts +52 -0
  40. package/dist/computer-use-actor.js +48 -0
  41. package/dist/computer-use-actor.js.map +1 -0
  42. package/dist/computer-use.d.ts +232 -0
  43. package/dist/computer-use.js +615 -0
  44. package/dist/computer-use.js.map +1 -0
  45. package/dist/concurrency.d.ts +1 -0
  46. package/dist/concurrency.js +27 -0
  47. package/dist/concurrency.js.map +1 -0
  48. package/dist/concurrent-shared-world-lab.d.ts +115 -0
  49. package/dist/concurrent-shared-world-lab.js +1092 -0
  50. package/dist/concurrent-shared-world-lab.js.map +1 -0
  51. package/dist/core/git-state.d.ts +31 -0
  52. package/dist/core/git-state.js +142 -0
  53. package/dist/core/git-state.js.map +1 -0
  54. package/dist/core/index.d.ts +4 -0
  55. package/dist/core/index.js +3 -0
  56. package/dist/core/index.js.map +1 -0
  57. package/dist/core/run-primitives.d.ts +66 -0
  58. package/dist/core/run-primitives.js +120 -0
  59. package/dist/core/run-primitives.js.map +1 -0
  60. package/dist/cua-actor-lab.d.ts +620 -0
  61. package/dist/cua-actor-lab.js +2834 -0
  62. package/dist/cua-actor-lab.js.map +1 -0
  63. package/dist/device-presets.d.ts +67 -0
  64. package/dist/device-presets.js +50 -0
  65. package/dist/device-presets.js.map +1 -0
  66. package/dist/e2b-desktop-executor.d.ts +101 -0
  67. package/dist/e2b-desktop-executor.js +309 -0
  68. package/dist/e2b-desktop-executor.js.map +1 -0
  69. package/dist/e2b-desktop-launch.d.ts +144 -0
  70. package/dist/e2b-desktop-launch.js +59 -0
  71. package/dist/e2b-desktop-launch.js.map +1 -0
  72. package/dist/e2b-detached.d.ts +53 -0
  73. package/dist/e2b-detached.js +130 -0
  74. package/dist/e2b-detached.js.map +1 -0
  75. package/dist/e2b-terminal-lab.d.ts +345 -0
  76. package/dist/e2b-terminal-lab.js +1467 -0
  77. package/dist/e2b-terminal-lab.js.map +1 -0
  78. package/dist/env-file.d.ts +14 -0
  79. package/dist/env-file.js +108 -0
  80. package/dist/env-file.js.map +1 -0
  81. package/dist/feedback.d.ts +51 -0
  82. package/dist/feedback.js +313 -0
  83. package/dist/feedback.js.map +1 -0
  84. package/dist/image-evidence.d.ts +2 -0
  85. package/dist/image-evidence.js +33 -0
  86. package/dist/image-evidence.js.map +1 -0
  87. package/dist/index.d.ts +63 -0
  88. package/dist/index.js +33 -0
  89. package/dist/index.js.map +1 -0
  90. package/dist/init-templates.d.ts +12 -0
  91. package/dist/init-templates.js +369 -0
  92. package/dist/init-templates.js.map +1 -0
  93. package/dist/init.d.ts +26 -0
  94. package/dist/init.js +343 -0
  95. package/dist/init.js.map +1 -0
  96. package/dist/lab-app-runner.d.ts +78 -0
  97. package/dist/lab-app-runner.js +403 -0
  98. package/dist/lab-app-runner.js.map +1 -0
  99. package/dist/lab-config.d.ts +578 -0
  100. package/dist/lab-config.js +1751 -0
  101. package/dist/lab-config.js.map +1 -0
  102. package/dist/lab-engine.d.ts +77 -0
  103. package/dist/lab-engine.js +216 -0
  104. package/dist/lab-engine.js.map +1 -0
  105. package/dist/lab-preflight.d.ts +67 -0
  106. package/dist/lab-preflight.js +385 -0
  107. package/dist/lab-preflight.js.map +1 -0
  108. package/dist/labs.d.ts +53 -0
  109. package/dist/labs.js +176 -0
  110. package/dist/labs.js.map +1 -0
  111. package/dist/observer-assets.d.ts +2 -0
  112. package/dist/observer-assets.js +2630 -0
  113. package/dist/observer-assets.js.map +1 -0
  114. package/dist/observer-data.d.ts +63 -0
  115. package/dist/observer-data.js +145 -0
  116. package/dist/observer-data.js.map +1 -0
  117. package/dist/observer-static.d.ts +39 -0
  118. package/dist/observer-static.js +192 -0
  119. package/dist/observer-static.js.map +1 -0
  120. package/dist/observer.d.ts +46 -0
  121. package/dist/observer.js +353 -0
  122. package/dist/observer.js.map +1 -0
  123. package/dist/openai-responses-cu.d.ts +113 -0
  124. package/dist/openai-responses-cu.js +531 -0
  125. package/dist/openai-responses-cu.js.map +1 -0
  126. package/dist/oss-lab.d.ts +52 -0
  127. package/dist/oss-lab.js +299 -0
  128. package/dist/oss-lab.js.map +1 -0
  129. package/dist/oss-meta-lab-scoring.d.ts +15 -0
  130. package/dist/oss-meta-lab-scoring.js +145 -0
  131. package/dist/oss-meta-lab-scoring.js.map +1 -0
  132. package/dist/oss-meta-lab.d.ts +279 -0
  133. package/dist/oss-meta-lab.js +4889 -0
  134. package/dist/oss-meta-lab.js.map +1 -0
  135. package/dist/oss-remote-telemetry.d.ts +77 -0
  136. package/dist/oss-remote-telemetry.js +403 -0
  137. package/dist/oss-remote-telemetry.js.map +1 -0
  138. package/dist/persona.d.ts +35 -0
  139. package/dist/persona.js +133 -0
  140. package/dist/persona.js.map +1 -0
  141. package/dist/pi-agent-core.d.ts +77 -0
  142. package/dist/pi-agent-core.js +203 -0
  143. package/dist/pi-agent-core.js.map +1 -0
  144. package/dist/program.d.ts +54 -0
  145. package/dist/program.js +2347 -0
  146. package/dist/program.js.map +1 -0
  147. package/dist/redaction.d.ts +90 -0
  148. package/dist/redaction.js +292 -0
  149. package/dist/redaction.js.map +1 -0
  150. package/dist/run.d.ts +784 -0
  151. package/dist/run.js +4555 -0
  152. package/dist/run.js.map +1 -0
  153. package/dist/scripted-browser-actor.d.ts +294 -0
  154. package/dist/scripted-browser-actor.js +1286 -0
  155. package/dist/scripted-browser-actor.js.map +1 -0
  156. package/dist/scripted-browser-lab.d.ts +107 -0
  157. package/dist/scripted-browser-lab.js +738 -0
  158. package/dist/scripted-browser-lab.js.map +1 -0
  159. package/dist/shared-world-lab.d.ts +208 -0
  160. package/dist/shared-world-lab.js +1048 -0
  161. package/dist/shared-world-lab.js.map +1 -0
  162. package/dist/source-archive.d.ts +82 -0
  163. package/dist/source-archive.js +365 -0
  164. package/dist/source-archive.js.map +1 -0
  165. package/dist/stop-conditions.d.ts +26 -0
  166. package/dist/stop-conditions.js +66 -0
  167. package/dist/stop-conditions.js.map +1 -0
  168. package/dist/terminal-agent-actor.d.ts +36 -0
  169. package/dist/terminal-agent-actor.js +23 -0
  170. package/dist/terminal-agent-actor.js.map +1 -0
  171. package/docs/architecture/actor-contract.md +431 -0
  172. package/docs/architecture/github-feedback-loop.md +189 -0
  173. package/docs/architecture/local-codex-tui-actor.md +213 -0
  174. package/docs/architecture/observer.md +118 -0
  175. package/docs/architecture/oss-lab-poc.md +242 -0
  176. package/docs/architecture/project-layout.md +166 -0
  177. package/docs/architecture/state-driven-executor.md +203 -0
  178. package/docs/architecture/terminal-product-lane.md +148 -0
  179. package/docs/contracts/adapter-fixtures.md +80 -0
  180. package/docs/contracts/core.md +71 -0
  181. package/docs/contracts/feedback.md +145 -0
  182. package/docs/contracts/policy.md +305 -0
  183. package/docs/contracts/run-bundle.md +358 -0
  184. package/docs/contracts/schemas.md +984 -0
  185. package/docs/goals/current.md +409 -0
  186. package/docs/principles/invariants-and-defaults.md +135 -0
  187. package/docs/principles/self-driving-harness.md +129 -0
  188. package/docs/product/open-source-install-experience.md +229 -0
  189. package/docs/ramp/README.md +200 -0
  190. package/docs/release/open-source-readiness.md +208 -0
  191. package/docs/release/public-readiness-standard.md +205 -0
  192. package/docs/roadmap/world-class-open-source-v0.md +311 -0
  193. package/package.json +102 -8
  194. package/skills/humanish/SKILL.md +244 -0
  195. package/skills/humanish/agents/openai.yaml +7 -0
  196. package/index.js +0 -1
@@ -0,0 +1,531 @@
1
+ import { mkdir, writeFile } from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { redactText } from "./redaction.js";
4
+ // A public-safe re-derivation of the OpenAI Responses API computer-use provider,
5
+ // behind the CuaProvider port from src/computer-use.ts. It mirrors the
6
+ // pure-mapper-plus-injectable-shim pattern proven in src/claude-agent-sdk.ts:
7
+ //
8
+ // - PURE mappers (openAiActionToCua, parseOpenAiResponse) and request builders
9
+ // (buildInitialRequest, buildCallOutput, buildContinuationRequest) project the
10
+ // Responses wire shape to/from the provider-neutral CuaAction / CuaTurn types
11
+ // with no network, so they are fully unit-testable in CI (no key, no spend, no
12
+ // SDK); and
13
+ // - the live shim (createOpenAiResponsesProvider) does a RAW POST to the
14
+ // Responses endpoint (no SDK dependency) through an injectable FetchLike seam,
15
+ // so the retry, ZDR fallback, and state threading are testable with a fake.
16
+ //
17
+ // Public-safety invariants (this is an OSS repo): the apiKey only ever appears in
18
+ // the Authorization header, never in a returned object, thrown error, or comment.
19
+ // Request bodies (which carry base64 screenshots and the persona instructions)
20
+ // and screenshots are never logged or returned; nextTurn returns ONLY a CuaTurn,
21
+ // and the engine handles redaction of CuaTurn fields downstream. Error messages
22
+ // carry the HTTP status only, never the response body (it can echo the input).
23
+ //
24
+ // Wire capture (fixture provenance). The 0.6.1 parser incident — the parser read
25
+ // `computer_call.action` (singular) while the live API returns `actions` (array),
26
+ // and the hand-written fixtures encoded the SAME wrong shape, so tests passed in
27
+ // lockstep with the bug while every live action was silently dropped — taught us
28
+ // that deterministic fixtures must derive from CAPTURED live wire shapes, never
29
+ // from memory. Setting HUMANISH_CUA_WIRE_CAPTURE_DIR makes the live shim persist
30
+ // each successful Responses RESPONSE body into that directory as pretty-printed
31
+ // JSON, one file per provider call in call order (wire-001.json, wire-002.json,
32
+ // ...), for refreshing fixtures. The capture seam is:
33
+ // - OPT-IN: unset (or empty) env means zero behavior change — nothing is written;
34
+ // - RESPONSE-side only: request bodies carry base64 screenshots and the persona
35
+ // instructions and are NEVER captured; non-ok response bodies can echo the
36
+ // request and are never captured either;
37
+ // - REDACTED: every string field (keys and values) passes through the shared
38
+ // redactText (src/redaction.ts) before writing, so a secret-shaped echo in a
39
+ // response cannot persist to disk.
40
+ // Point the env var at a gitignored path (e.g. under .humanish/): raw captures must
41
+ // never be committed — fixtures derived from them must be minimal, hand-reviewed
42
+ // excerpts checked into tests deliberately.
43
+ export const OPENAI_RESPONSES_CU_CAPABILITIES = {
44
+ headless: true,
45
+ structuredTrace: true,
46
+ lanes: ["computer-use"],
47
+ producesScreenshots: true,
48
+ byoModel: false,
49
+ preGrantableApprovals: false,
50
+ inProcessTools: false,
51
+ license: "proprietary"
52
+ };
53
+ export const DEFAULT_OPENAI_CU_MODEL = "gpt-5.5";
54
+ // ---------------------------------------------------------------------------
55
+ // Defensive readers. The Responses wire shape is loosely typed (unknown), so we
56
+ // read every field defensively: a non-object is treated as empty, a non-number
57
+ // coordinate becomes 0, and a non-string text becomes "".
58
+ // ---------------------------------------------------------------------------
59
+ function asRecord(value) {
60
+ return typeof value === "object" && value !== null ? value : {};
61
+ }
62
+ function asArray(value) {
63
+ return Array.isArray(value) ? value : [];
64
+ }
65
+ function asNumber(value) {
66
+ return typeof value === "number" && Number.isFinite(value) ? value : 0;
67
+ }
68
+ function asString(value) {
69
+ return typeof value === "string" ? value : "";
70
+ }
71
+ function optionalNumber(value) {
72
+ return typeof value === "number" && Number.isFinite(value) ? value : undefined;
73
+ }
74
+ function optionalString(value) {
75
+ return typeof value === "string" && value.length > 0 ? value : undefined;
76
+ }
77
+ function asPoint(value) {
78
+ const point = asRecord(value);
79
+ return { x: asNumber(point.x), y: asNumber(point.y) };
80
+ }
81
+ /**
82
+ * Map an OpenAI computer action object to a provider-neutral CuaAction, or null
83
+ * for an unknown type. Every coordinate and field is read defensively so a
84
+ * malformed action never throws and a non-number coordinate becomes 0.
85
+ */
86
+ export function openAiActionToCua(action) {
87
+ const record = asRecord(action);
88
+ const type = asString(record.type);
89
+ switch (type) {
90
+ case "click": {
91
+ const button = record.button;
92
+ return {
93
+ kind: "click",
94
+ x: asNumber(record.x),
95
+ y: asNumber(record.y),
96
+ button: button === "right" || button === "middle" ? button : "left"
97
+ };
98
+ }
99
+ case "double_click":
100
+ return { kind: "double_click", x: asNumber(record.x), y: asNumber(record.y) };
101
+ case "move":
102
+ return { kind: "move", x: asNumber(record.x), y: asNumber(record.y) };
103
+ case "scroll":
104
+ return {
105
+ kind: "scroll",
106
+ x: asNumber(record.x),
107
+ y: asNumber(record.y),
108
+ dx: asNumber(record.scroll_x),
109
+ dy: asNumber(record.scroll_y)
110
+ };
111
+ case "type":
112
+ return { kind: "type", text: asString(record.text) };
113
+ case "keypress":
114
+ return { kind: "keypress", keys: asArray(record.keys).filter((key) => typeof key === "string") };
115
+ case "drag":
116
+ return { kind: "drag", path: asArray(record.path).map(asPoint) };
117
+ case "wait":
118
+ return { kind: "wait" };
119
+ case "screenshot":
120
+ return { kind: "screenshot" };
121
+ default:
122
+ return null;
123
+ }
124
+ }
125
+ // Collect plain strings or { text } entries from a reasoning summary/content array.
126
+ function collectTextEntries(value) {
127
+ const out = [];
128
+ for (const entry of asArray(value)) {
129
+ if (typeof entry === "string") {
130
+ if (entry.length > 0)
131
+ out.push(entry);
132
+ continue;
133
+ }
134
+ const text = asString(asRecord(entry).text);
135
+ if (text.length > 0)
136
+ out.push(text);
137
+ }
138
+ return out;
139
+ }
140
+ // Collect output_text strings from a message content array.
141
+ function collectMessageText(value) {
142
+ const out = [];
143
+ for (const entry of asArray(value)) {
144
+ const record = asRecord(entry);
145
+ if (asString(record.type) === "output_text") {
146
+ const text = asString(record.text);
147
+ if (text.length > 0)
148
+ out.push(text);
149
+ }
150
+ }
151
+ return out;
152
+ }
153
+ /**
154
+ * Parse a Responses API response into a provider-neutral CuaTurn plus the
155
+ * computer_call ids (needed to build the next turn's call outputs) and the raw
156
+ * output items (needed for ZDR explicit-context continuation). Pure: no network,
157
+ * no mutation of the input. Optional CuaTurn fields are only set when present so
158
+ * the result satisfies exactOptionalPropertyTypes.
159
+ */
160
+ export function parseOpenAiResponse(raw) {
161
+ const root = asRecord(raw);
162
+ const responseId = optionalString(root.id);
163
+ const output = asArray(root.output);
164
+ const actions = [];
165
+ const callIds = [];
166
+ const reasoningParts = [];
167
+ const messageParts = [];
168
+ const safetyChecks = [];
169
+ for (const rawItem of output) {
170
+ const item = asRecord(rawItem);
171
+ switch (asString(item.type)) {
172
+ case "reasoning":
173
+ reasoningParts.push(...collectTextEntries(item.summary), ...collectTextEntries(item.content));
174
+ break;
175
+ case "message":
176
+ messageParts.push(...collectMessageText(item.content));
177
+ break;
178
+ case "output_text": {
179
+ const text = asString(item.text);
180
+ if (text.length > 0)
181
+ messageParts.push(text);
182
+ break;
183
+ }
184
+ case "computer_call": {
185
+ const callId = optionalString(item.call_id);
186
+ if (callId !== undefined)
187
+ callIds.push(callId);
188
+ // The live Responses API returns the actions as an ARRAY (`item.actions`); a single
189
+ // computer_call can carry several. (An older/alt shape used a singular `item.action` —
190
+ // supported as a fallback.) Reading only `item.action` silently dropped EVERY action,
191
+ // which made the loop see zero actions and stop on a false `goal_satisfied`.
192
+ const rawActions = Array.isArray(item.actions)
193
+ ? item.actions
194
+ : item.action !== undefined
195
+ ? [item.action]
196
+ : [];
197
+ for (const rawAction of rawActions) {
198
+ const mapped = openAiActionToCua(rawAction);
199
+ if (mapped !== null)
200
+ actions.push(mapped);
201
+ }
202
+ // Preserve the wire triple verbatim: the API matches acknowledgements on
203
+ // `id`, so collapsing to a code string (and fabricating ids on echo)
204
+ // would silently break the proceed path.
205
+ for (const rawCheck of asArray(item.pending_safety_checks)) {
206
+ const check = asRecord(rawCheck);
207
+ const id = asString(check.id);
208
+ const code = asString(check.code);
209
+ safetyChecks.push({
210
+ id: id || code || "safety_check",
211
+ code: code || id || "safety_check",
212
+ message: asString(check.message) || code || id || "safety_check"
213
+ });
214
+ }
215
+ break;
216
+ }
217
+ default:
218
+ break;
219
+ }
220
+ }
221
+ const topText = asString(root.output_text);
222
+ if (topText.length > 0)
223
+ messageParts.push(topText);
224
+ const reasoning = reasoningParts.filter((part) => part.length > 0).join("\n");
225
+ const message = messageParts.filter((part) => part.length > 0).join("\n");
226
+ const usageRecord = asRecord(root.usage);
227
+ const usageInput = optionalNumber(usageRecord.input_tokens);
228
+ const usageOutput = optionalNumber(usageRecord.output_tokens);
229
+ const usage = usageInput === undefined && usageOutput === undefined
230
+ ? undefined
231
+ : { ...(usageInput === undefined ? {} : { input: usageInput }), ...(usageOutput === undefined ? {} : { output: usageOutput }) };
232
+ const turn = {
233
+ actions,
234
+ pendingSafetyChecks: safetyChecks,
235
+ done: actions.length === 0,
236
+ ...(responseId === undefined ? {} : { responseId }),
237
+ ...(reasoning.length > 0 ? { reasoning } : {}),
238
+ ...(message.length > 0 ? { message } : {}),
239
+ ...(usage === undefined ? {} : { usage })
240
+ };
241
+ return { turn, callIds, outputItems: output };
242
+ }
243
+ // The fields shared by the initial and continuation requests: the tool spec,
244
+ // truncation policy, reasoning effort, and (when configured) the safety id.
245
+ function sharedRequestFields(ctx) {
246
+ return {
247
+ model: ctx.model,
248
+ // Keep the task/persona contract present on every turn. Some computer-use
249
+ // continuations carry only screenshot call outputs; without repeating the
250
+ // instructions, a provider that does not fully retain prior state can drift
251
+ // into asking the operator what to do.
252
+ instructions: ctx.instructions,
253
+ // The Responses API `computer` tool takes no display/environment fields — the model infers
254
+ // resolution from the screenshots it is sent. (Sending display_* returns a 400
255
+ // "Unknown parameter tools[0].display_width", confirmed against the live API 2026-06.)
256
+ tools: [{ type: "computer" }],
257
+ truncation: "auto",
258
+ reasoning: { effort: ctx.reasoningEffort },
259
+ ...(ctx.safetyIdentifier === undefined ? {} : { safety_identifier: ctx.safetyIdentifier })
260
+ };
261
+ }
262
+ /** Build the first-turn request body: instructions + an initial user text input. */
263
+ export function buildInitialRequest(ctx) {
264
+ return {
265
+ ...sharedRequestFields(ctx),
266
+ input: [{ role: "user", content: [{ type: "input_text", text: ctx.instructions }] }]
267
+ };
268
+ }
269
+ /**
270
+ * Build one computer_call_output for a pending call id, carrying the latest
271
+ * screenshot as an inline data URL. Acknowledged safety checks (if any) are
272
+ * echoed back so the model can proceed past a check the harness approved.
273
+ *
274
+ * The screenshot param is `Buffer | undefined` because CuaObservation.screenshot is now
275
+ * optional (a non-vision executor omits it). This provider is a VISION model (it sets
276
+ * requiresFrame), so a missing frame is a hard error here — defense-in-depth: the loop's
277
+ * per-turn requiresFrame guard already fails closed before this is reached, but throwing keeps
278
+ * the mapper self-validating and isolable.
279
+ */
280
+ export function buildCallOutput(callId, screenshot, acknowledged) {
281
+ if (screenshot === undefined) {
282
+ throw new Error("openai-responses-cu requires observation.screenshot (it is a vision provider; pair a state-only executor with a non-vision provider)");
283
+ }
284
+ return {
285
+ type: "computer_call_output",
286
+ call_id: callId,
287
+ output: {
288
+ type: "computer_screenshot",
289
+ image_url: `data:image/png;base64,${screenshot.toString("base64")}`
290
+ },
291
+ ...(acknowledged && acknowledged.length > 0
292
+ ? { acknowledged_safety_checks: acknowledged.map(({ id, code, message }) => ({ id, code, message })) }
293
+ : {})
294
+ };
295
+ }
296
+ // Turn an optional context-hint string into an input item array (or empty).
297
+ function hintItems(contextHint) {
298
+ return contextHint ? [{ role: "user", content: [{ type: "input_text", text: contextHint }] }] : [];
299
+ }
300
+ /**
301
+ * Build a continuation request body. Two modes:
302
+ * - default: thread server-side state via previous_response_id and send only the
303
+ * new call outputs (plus an optional hint).
304
+ * - explicit-context (ZDR): no previous_response_id; the prior output items are
305
+ * re-sent inline ahead of the new call outputs so the model has full context
306
+ * without the server retaining any.
307
+ */
308
+ export function buildContinuationRequest(args) {
309
+ const { ctx, previousResponseId, callOutputs, contextHint, explicitContextItems } = args;
310
+ if (explicitContextItems === undefined) {
311
+ return {
312
+ ...sharedRequestFields(ctx),
313
+ previous_response_id: previousResponseId,
314
+ input: [...callOutputs, ...hintItems(contextHint)]
315
+ };
316
+ }
317
+ return {
318
+ ...sharedRequestFields(ctx),
319
+ input: [...explicitContextItems, ...callOutputs, ...hintItems(contextHint)]
320
+ };
321
+ }
322
+ // ---------------------------------------------------------------------------
323
+ // Wire capture (see the module header). Pure helpers, exported for unit tests.
324
+ // ---------------------------------------------------------------------------
325
+ /** The opt-in gate for response wire capture: a directory path, or unset for off. */
326
+ export const WIRE_CAPTURE_ENV = "HUMANISH_CUA_WIRE_CAPTURE_DIR";
327
+ /**
328
+ * Deep-copy a captured wire value with every string — object keys included —
329
+ * passed through the shared redactText, so a secret-shaped echo in a response
330
+ * can never persist to disk. Pure; non-string primitives pass through unchanged.
331
+ */
332
+ export function redactWireJson(value) {
333
+ if (typeof value === "string")
334
+ return redactText(value);
335
+ if (Array.isArray(value))
336
+ return value.map(redactWireJson);
337
+ if (typeof value === "object" && value !== null) {
338
+ return Object.fromEntries(Object.entries(value).map(([key, entry]) => [redactText(key), redactWireJson(entry)]));
339
+ }
340
+ return value;
341
+ }
342
+ /** Deterministic ordered capture file name for the 1-based nth provider call. */
343
+ export function wireCaptureFileName(callNumber) {
344
+ return `wire-${String(callNumber).padStart(3, "0")}.json`;
345
+ }
346
+ // A typed error so nextTurn can distinguish a ZDR-policy rejection (recoverable
347
+ // by switching to explicit-context mode) from any other non-ok status. It never
348
+ // carries the apiKey or the response body.
349
+ class ZdrError extends Error {
350
+ constructor() {
351
+ super("OpenAI Responses rejected server-side state (zero data retention)");
352
+ this.name = "ZdrError";
353
+ }
354
+ }
355
+ const DEFAULT_ENDPOINT = "https://api.openai.com/v1/responses";
356
+ // A 400 whose body mentions any of these means the account/org cannot use
357
+ // server-side response state, so we must fall back to explicit-context mode.
358
+ function isZdrRejection(bodyText) {
359
+ return (bodyText.includes("Zero Data Retention") ||
360
+ bodyText.includes("zero data retention") ||
361
+ bodyText.includes("previous_response_id"));
362
+ }
363
+ function defaultFetch() {
364
+ return async (url, init) => {
365
+ const res = await fetch(url, init);
366
+ return {
367
+ ok: res.ok,
368
+ status: res.status,
369
+ text: () => res.text(),
370
+ json: () => res.json()
371
+ };
372
+ };
373
+ }
374
+ function defaultDelay(ms) {
375
+ return new Promise((resolve) => {
376
+ const timer = setTimeout(resolve, ms);
377
+ if (typeof timer.unref === "function")
378
+ timer.unref();
379
+ });
380
+ }
381
+ function isAbortError(error) {
382
+ return error instanceof Error && error.name === "AbortError";
383
+ }
384
+ /**
385
+ * Create a stateful CuaProvider backed by the OpenAI Responses API. The first
386
+ * turn opens a session (buildInitialRequest); subsequent turns send the prior
387
+ * call outputs (with the latest screenshot) and thread state via
388
+ * previous_response_id, transparently falling back to explicit-context mode if
389
+ * the account rejects server-side retention. Transient HTTP failures are retried
390
+ * with exponential backoff. Returns ONLY a CuaTurn from nextTurn; nothing
391
+ * sensitive (the key, the request body, the screenshot, the raw response body)
392
+ * is ever returned or logged.
393
+ */
394
+ export function createOpenAiResponsesProvider(options) {
395
+ const model = options.model ?? DEFAULT_OPENAI_CU_MODEL;
396
+ const endpoint = options.endpoint ?? DEFAULT_ENDPOINT;
397
+ const reasoningEffort = options.reasoningEffort ?? "medium";
398
+ const maxRetries = options.maxRetries ?? 3;
399
+ const fetchFn = options.fetchFn ?? defaultFetch();
400
+ const delayFn = options.delayFn ?? defaultDelay;
401
+ // Opt-in response wire capture (see module header): unset/empty means OFF and
402
+ // zero behavior change. The counter is per-provider, so file order is call order.
403
+ const captureDir = optionalString((options.env ?? process.env)[WIRE_CAPTURE_ENV]?.trim());
404
+ let captureCount = 0;
405
+ // Persist one successful RESPONSE body, redacted and pretty-printed. Fails loud:
406
+ // a silent capture failure would mean missing turns in a fixture refresh — the
407
+ // exact "fixtures drift from the wire" pathology capture exists to prevent.
408
+ const captureResponse = async (raw) => {
409
+ if (captureDir === undefined)
410
+ return;
411
+ captureCount += 1;
412
+ await mkdir(captureDir, { recursive: true });
413
+ await writeFile(path.join(captureDir, wireCaptureFileName(captureCount)), `${JSON.stringify(redactWireJson(raw), null, 2)}\n`, "utf8");
414
+ };
415
+ let lastResponseId;
416
+ let pendingCallIds = [];
417
+ let lastOutputItems = [];
418
+ let mode = options.zeroDataRetention ? "explicit_context" : "previous_response_id";
419
+ const buildContext = (instructions) => ({
420
+ model,
421
+ instructions,
422
+ reasoningEffort,
423
+ ...(options.safetyIdentifier === undefined ? {} : { safetyIdentifier: options.safetyIdentifier })
424
+ });
425
+ // POST the JSON body and return the parsed JSON on success. Retries on
426
+ // transient statuses (408/409/429/>=500). Maps a ZDR-policy 400 to a typed
427
+ // ZdrError; any other non-ok status throws with the STATUS ONLY (never the
428
+ // body, which can echo the input/screenshot).
429
+ const post = async (body, signal) => {
430
+ const headers = {
431
+ Authorization: `Bearer ${options.apiKey}`,
432
+ "Content-Type": "application/json"
433
+ };
434
+ const payload = JSON.stringify(body);
435
+ let lastStatus = 0;
436
+ let sawNetworkError = false;
437
+ for (let attempt = 0; attempt <= maxRetries; attempt += 1) {
438
+ let res;
439
+ try {
440
+ res = await fetchFn(endpoint, {
441
+ method: "POST",
442
+ headers,
443
+ body: payload,
444
+ ...(signal === undefined ? {} : { signal })
445
+ });
446
+ }
447
+ catch (error) {
448
+ if (signal?.aborted === true || isAbortError(error)) {
449
+ throw error;
450
+ }
451
+ sawNetworkError = true;
452
+ if (attempt < maxRetries) {
453
+ await delayFn(2 ** attempt * 200);
454
+ continue;
455
+ }
456
+ throw new Error("OpenAI Responses network error");
457
+ }
458
+ if (res.ok) {
459
+ const parsed = await res.json();
460
+ // Capture AFTER ok and BEFORE parse-to-CuaTurn: responses only, never the
461
+ // request (screenshots/instructions) and never a non-ok body (input echo).
462
+ await captureResponse(parsed);
463
+ return parsed;
464
+ }
465
+ lastStatus = res.status;
466
+ if (res.status === 400) {
467
+ const bodyText = await res.text();
468
+ if (isZdrRejection(bodyText)) {
469
+ throw new ZdrError();
470
+ }
471
+ throw new Error("OpenAI Responses 400");
472
+ }
473
+ const retryable = res.status === 408 || res.status === 409 || res.status === 429 || res.status >= 500;
474
+ if (retryable && attempt < maxRetries) {
475
+ await delayFn(2 ** attempt * 200);
476
+ continue;
477
+ }
478
+ throw new Error(`OpenAI Responses ${res.status}`);
479
+ }
480
+ if (sawNetworkError) {
481
+ throw new Error("OpenAI Responses network error");
482
+ }
483
+ throw new Error(`OpenAI Responses ${lastStatus}`);
484
+ };
485
+ return {
486
+ id: "openai-responses-cu",
487
+ version: model,
488
+ capabilities: OPENAI_RESPONSES_CU_CAPABILITIES,
489
+ // This is a VISION provider: nextTurn sends the screenshot as the computer_call_output, so
490
+ // it cannot reason over a screenshot-less observation. The loop reads this to fail closed
491
+ // (harness_error) when a state-only executor is paired with it (provider-authoring contract).
492
+ requiresFrame: true,
493
+ async nextTurn(req, signal) {
494
+ const ctx = buildContext(req.instructions);
495
+ const isFirstTurn = lastResponseId === undefined && pendingCallIds.length === 0;
496
+ let raw;
497
+ if (isFirstTurn) {
498
+ raw = await post(buildInitialRequest(ctx), signal);
499
+ }
500
+ else {
501
+ const callOutputs = pendingCallIds.map((id) => buildCallOutput(id, req.observation.screenshot, req.acknowledgedSafetyChecks));
502
+ const buildBody = (explicitContextItems) => buildContinuationRequest({
503
+ ctx,
504
+ previousResponseId: lastResponseId,
505
+ callOutputs,
506
+ ...(req.contextHint === undefined ? {} : { contextHint: req.contextHint }),
507
+ ...(explicitContextItems === undefined ? {} : { explicitContextItems })
508
+ });
509
+ try {
510
+ raw = await post(buildBody(mode === "explicit_context" ? lastOutputItems : undefined), signal);
511
+ }
512
+ catch (error) {
513
+ if (error instanceof ZdrError) {
514
+ mode = "explicit_context";
515
+ raw = await post(buildBody(lastOutputItems), signal);
516
+ }
517
+ else {
518
+ throw error;
519
+ }
520
+ }
521
+ }
522
+ const parsed = parseOpenAiResponse(raw);
523
+ if (parsed.turn.responseId !== undefined)
524
+ lastResponseId = parsed.turn.responseId;
525
+ pendingCallIds = parsed.callIds;
526
+ lastOutputItems = parsed.outputItems;
527
+ return parsed.turn;
528
+ }
529
+ };
530
+ }
531
+ //# sourceMappingURL=openai-responses-cu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openai-responses-cu.js","sourceRoot":"","sources":["../src/openai-responses-cu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,iFAAiF;AACjF,uEAAuE;AACvE,8EAA8E;AAC9E,EAAE;AACF,gFAAgF;AAChF,kFAAkF;AAClF,iFAAiF;AACjF,kFAAkF;AAClF,eAAe;AACf,0EAA0E;AAC1E,kFAAkF;AAClF,+EAA+E;AAC/E,EAAE;AACF,kFAAkF;AAClF,kFAAkF;AAClF,+EAA+E;AAC/E,iFAAiF;AACjF,gFAAgF;AAChF,+EAA+E;AAC/E,EAAE;AACF,iFAAiF;AACjF,kFAAkF;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,EAAE,CAAC;wBAC9B,IAAI,GAAG,kBAAkB,CAAC;wBAC1B,GAAG,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC,CAAC;oBACvD,CAAC;yBAAM,CAAC;wBACN,MAAM,KAAK,CAAC;oBACd,CAAC;gBACH,CAAC;YACH,CAAC;YAED,MAAM,MAAM,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;YACxC,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,KAAK,SAAS;gBAAE,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;YAClF,cAAc,GAAG,MAAM,CAAC,OAAO,CAAC;YAChC,eAAe,GAAG,MAAM,CAAC,WAAW,CAAC;YACrC,OAAO,MAAM,CAAC,IAAI,CAAC;QACrB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,52 @@
1
+ export declare const OSS_LAB_SCHEMA = "humanish.oss-lab-result.v1";
2
+ export declare const DEFAULT_OSS_REPOS: readonly ["CorentinTh/it-tools", "drawdb-io/drawdb", "maciekt07/TodoApp", "lissy93/dashy"];
3
+ export interface OssLabOptions {
4
+ cwd: string;
5
+ keep?: boolean;
6
+ limit?: number;
7
+ repos?: string[];
8
+ runId?: string;
9
+ }
10
+ export interface OssLabStep {
11
+ durationMs: number;
12
+ name: string;
13
+ ok: boolean;
14
+ summary: string;
15
+ }
16
+ export interface OssLabRepoResult {
17
+ changedFiles: string[];
18
+ clonePath: string;
19
+ humanishRunId?: string;
20
+ observerPath?: string;
21
+ ok: boolean;
22
+ repo: string;
23
+ steps: OssLabStep[];
24
+ url: string;
25
+ warnings: string[];
26
+ }
27
+ export interface OssLabResult {
28
+ schema: typeof OSS_LAB_SCHEMA;
29
+ ok: boolean;
30
+ cleanup: {
31
+ kept: boolean;
32
+ sandboxRemoved: boolean;
33
+ };
34
+ completedAt: string;
35
+ cwd: string;
36
+ error?: {
37
+ code: "HUMANISH_INVALID_OSS_REPO" | "HUMANISH_INVALID_OSS_LIMIT";
38
+ message: string;
39
+ };
40
+ reportJsonPath?: string;
41
+ reportMarkdownPath?: string;
42
+ repos: OssLabRepoResult[];
43
+ runId: string;
44
+ sandboxPath: string;
45
+ startedAt: string;
46
+ warnings: string[];
47
+ }
48
+ export declare function normalizeOssRepoSlugs(input: string[] | undefined): string[];
49
+ export declare function validateOssRepoSlug(slug: string): boolean;
50
+ export declare function runOssLab(options: OssLabOptions): Promise<OssLabResult>;
51
+ /** Repo slug for run-id suffixes/artifact tokens: lowercased, non-alnum -> "-", trimmed. */
52
+ export declare function repoSlug(repo: string): string;