humanish 0.0.1 → 0.15.1

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 (205) hide show
  1. package/AGENTS.md +77 -0
  2. package/CONTRIBUTING.md +39 -0
  3. package/LICENSE +21 -0
  4. package/README.md +437 -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 +363 -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 +357 -0
  32. package/dist/codex-app-server-ui.js.map +1 -0
  33. package/dist/codex-app-server.d.ts +144 -0
  34. package/dist/codex-app-server.js +754 -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 +1094 -0
  50. package/dist/concurrent-shared-world-lab.js.map +1 -0
  51. package/dist/core/git-state.d.ts +33 -0
  52. package/dist/core/git-state.js +277 -0
  53. package/dist/core/git-state.js.map +1 -0
  54. package/dist/core/git-workspace.d.ts +31 -0
  55. package/dist/core/git-workspace.js +447 -0
  56. package/dist/core/git-workspace.js.map +1 -0
  57. package/dist/core/index.d.ts +4 -0
  58. package/dist/core/index.js +3 -0
  59. package/dist/core/index.js.map +1 -0
  60. package/dist/core/run-primitives.d.ts +66 -0
  61. package/dist/core/run-primitives.js +120 -0
  62. package/dist/core/run-primitives.js.map +1 -0
  63. package/dist/cua-actor-lab.d.ts +621 -0
  64. package/dist/cua-actor-lab.js +2845 -0
  65. package/dist/cua-actor-lab.js.map +1 -0
  66. package/dist/device-presets.d.ts +67 -0
  67. package/dist/device-presets.js +50 -0
  68. package/dist/device-presets.js.map +1 -0
  69. package/dist/e2b-desktop-executor.d.ts +101 -0
  70. package/dist/e2b-desktop-executor.js +309 -0
  71. package/dist/e2b-desktop-executor.js.map +1 -0
  72. package/dist/e2b-desktop-launch.d.ts +144 -0
  73. package/dist/e2b-desktop-launch.js +59 -0
  74. package/dist/e2b-desktop-launch.js.map +1 -0
  75. package/dist/e2b-detached.d.ts +53 -0
  76. package/dist/e2b-detached.js +130 -0
  77. package/dist/e2b-detached.js.map +1 -0
  78. package/dist/e2b-terminal-lab.d.ts +345 -0
  79. package/dist/e2b-terminal-lab.js +1532 -0
  80. package/dist/e2b-terminal-lab.js.map +1 -0
  81. package/dist/env-file.d.ts +14 -0
  82. package/dist/env-file.js +108 -0
  83. package/dist/env-file.js.map +1 -0
  84. package/dist/feedback.d.ts +51 -0
  85. package/dist/feedback.js +351 -0
  86. package/dist/feedback.js.map +1 -0
  87. package/dist/image-evidence.d.ts +2 -0
  88. package/dist/image-evidence.js +33 -0
  89. package/dist/image-evidence.js.map +1 -0
  90. package/dist/index.d.ts +63 -0
  91. package/dist/index.js +33 -0
  92. package/dist/index.js.map +1 -0
  93. package/dist/init-templates.d.ts +12 -0
  94. package/dist/init-templates.js +369 -0
  95. package/dist/init-templates.js.map +1 -0
  96. package/dist/init.d.ts +26 -0
  97. package/dist/init.js +429 -0
  98. package/dist/init.js.map +1 -0
  99. package/dist/lab-app-runner.d.ts +78 -0
  100. package/dist/lab-app-runner.js +403 -0
  101. package/dist/lab-app-runner.js.map +1 -0
  102. package/dist/lab-config.d.ts +583 -0
  103. package/dist/lab-config.js +1789 -0
  104. package/dist/lab-config.js.map +1 -0
  105. package/dist/lab-engine.d.ts +77 -0
  106. package/dist/lab-engine.js +216 -0
  107. package/dist/lab-engine.js.map +1 -0
  108. package/dist/lab-preflight.d.ts +67 -0
  109. package/dist/lab-preflight.js +385 -0
  110. package/dist/lab-preflight.js.map +1 -0
  111. package/dist/labs.d.ts +53 -0
  112. package/dist/labs.js +382 -0
  113. package/dist/labs.js.map +1 -0
  114. package/dist/observer-assets.d.ts +2 -0
  115. package/dist/observer-assets.js +2630 -0
  116. package/dist/observer-assets.js.map +1 -0
  117. package/dist/observer-data.d.ts +63 -0
  118. package/dist/observer-data.js +145 -0
  119. package/dist/observer-data.js.map +1 -0
  120. package/dist/observer-static.d.ts +39 -0
  121. package/dist/observer-static.js +306 -0
  122. package/dist/observer-static.js.map +1 -0
  123. package/dist/observer.d.ts +46 -0
  124. package/dist/observer.js +550 -0
  125. package/dist/observer.js.map +1 -0
  126. package/dist/openai-responses-cu.d.ts +113 -0
  127. package/dist/openai-responses-cu.js +545 -0
  128. package/dist/openai-responses-cu.js.map +1 -0
  129. package/dist/oss-lab.d.ts +52 -0
  130. package/dist/oss-lab.js +344 -0
  131. package/dist/oss-lab.js.map +1 -0
  132. package/dist/oss-meta-lab-scoring.d.ts +15 -0
  133. package/dist/oss-meta-lab-scoring.js +145 -0
  134. package/dist/oss-meta-lab-scoring.js.map +1 -0
  135. package/dist/oss-meta-lab.d.ts +277 -0
  136. package/dist/oss-meta-lab.js +4529 -0
  137. package/dist/oss-meta-lab.js.map +1 -0
  138. package/dist/oss-remote-telemetry.d.ts +77 -0
  139. package/dist/oss-remote-telemetry.js +403 -0
  140. package/dist/oss-remote-telemetry.js.map +1 -0
  141. package/dist/persona.d.ts +35 -0
  142. package/dist/persona.js +133 -0
  143. package/dist/persona.js.map +1 -0
  144. package/dist/pi-agent-core.d.ts +77 -0
  145. package/dist/pi-agent-core.js +203 -0
  146. package/dist/pi-agent-core.js.map +1 -0
  147. package/dist/program.d.ts +54 -0
  148. package/dist/program.js +2349 -0
  149. package/dist/program.js.map +1 -0
  150. package/dist/redaction.d.ts +90 -0
  151. package/dist/redaction.js +292 -0
  152. package/dist/redaction.js.map +1 -0
  153. package/dist/run-paths.d.ts +56 -0
  154. package/dist/run-paths.js +340 -0
  155. package/dist/run-paths.js.map +1 -0
  156. package/dist/run.d.ts +794 -0
  157. package/dist/run.js +4844 -0
  158. package/dist/run.js.map +1 -0
  159. package/dist/scripted-browser-actor.d.ts +297 -0
  160. package/dist/scripted-browser-actor.js +1399 -0
  161. package/dist/scripted-browser-actor.js.map +1 -0
  162. package/dist/scripted-browser-lab.d.ts +107 -0
  163. package/dist/scripted-browser-lab.js +788 -0
  164. package/dist/scripted-browser-lab.js.map +1 -0
  165. package/dist/selected-output-paths.d.ts +49 -0
  166. package/dist/selected-output-paths.js +354 -0
  167. package/dist/selected-output-paths.js.map +1 -0
  168. package/dist/shared-world-lab.d.ts +208 -0
  169. package/dist/shared-world-lab.js +1049 -0
  170. package/dist/shared-world-lab.js.map +1 -0
  171. package/dist/source-archive.d.ts +82 -0
  172. package/dist/source-archive.js +408 -0
  173. package/dist/source-archive.js.map +1 -0
  174. package/dist/stop-conditions.d.ts +26 -0
  175. package/dist/stop-conditions.js +66 -0
  176. package/dist/stop-conditions.js.map +1 -0
  177. package/dist/terminal-agent-actor.d.ts +36 -0
  178. package/dist/terminal-agent-actor.js +23 -0
  179. package/dist/terminal-agent-actor.js.map +1 -0
  180. package/docs/architecture/actor-contract.md +431 -0
  181. package/docs/architecture/github-feedback-loop.md +189 -0
  182. package/docs/architecture/local-codex-tui-actor.md +213 -0
  183. package/docs/architecture/observer.md +118 -0
  184. package/docs/architecture/oss-lab-poc.md +250 -0
  185. package/docs/architecture/project-layout.md +166 -0
  186. package/docs/architecture/state-driven-executor.md +203 -0
  187. package/docs/architecture/terminal-product-lane.md +148 -0
  188. package/docs/contracts/adapter-fixtures.md +80 -0
  189. package/docs/contracts/core.md +71 -0
  190. package/docs/contracts/feedback.md +145 -0
  191. package/docs/contracts/policy.md +311 -0
  192. package/docs/contracts/run-bundle.md +358 -0
  193. package/docs/contracts/schemas.md +984 -0
  194. package/docs/goals/current.md +428 -0
  195. package/docs/principles/invariants-and-defaults.md +135 -0
  196. package/docs/principles/self-driving-harness.md +129 -0
  197. package/docs/product/open-source-install-experience.md +237 -0
  198. package/docs/ramp/README.md +207 -0
  199. package/docs/release/open-source-readiness.md +208 -0
  200. package/docs/release/public-readiness-standard.md +205 -0
  201. package/docs/roadmap/world-class-open-source-v0.md +311 -0
  202. package/package.json +102 -8
  203. package/skills/humanish/SKILL.md +244 -0
  204. package/skills/humanish/agents/openai.yaml +7 -0
  205. package/index.js +0 -1
@@ -0,0 +1,208 @@
1
+ import type { ActorCompletionReason, ActorPersonaRef, ActorStatus } from "./actor-contract.js";
2
+ import { type BrowserLabAdapterHooks } from "./adapter-extension.js";
3
+ import { type CuaActorDescriptor } from "./actor-registry.js";
4
+ import type { CuaActorSessionOptions } from "./computer-use-actor.js";
5
+ import type { CuaLoopResult } from "./computer-use.js";
6
+ import { type DesktopBrowserEvidence, type SubjectPhaseEvent } from "./cua-actor-lab.js";
7
+ import { type E2BDesktopModule, type E2BDesktopSandbox } from "./e2b-desktop-launch.js";
8
+ import { type DetachedTimers } from "./e2b-detached.js";
9
+ import type { DevicePreset } from "./device-presets.js";
10
+ import { type LabConfig, type LabSubjectStateCheckpoint } from "./lab-config.js";
11
+ import { renderObserver, type ObserverResult } from "./observer.js";
12
+ import type { LocalTreeArchive } from "./source-archive.js";
13
+ import type { StopWhen } from "./stop-conditions.js";
14
+ import { type RunBundle, type RunSubjectProvenance, type SharedWorldCheckpoint } from "./run.js";
15
+ export declare const SHARED_WORLD_LAB_SCHEMA = "humanish.shared-world-lab-result.v1";
16
+ export declare const SHARED_WORLD_LAB_PROVIDER_METADATA: {
17
+ readonly mode: "shared-world-lab";
18
+ readonly tool: "humanish";
19
+ };
20
+ /**
21
+ * Library-level hooks mirroring CuaActorLabHooks — the DI seams that let CI drive the FULL
22
+ * orchestration with fakes at $0/zero-network. The fake desktop module records create/kill BY id
23
+ * and exposes NO `list` method (the by-id teardown rail is then provable by construction).
24
+ */
25
+ export interface SharedWorldLabHooks extends BrowserLabAdapterHooks {
26
+ /** Lazy-load the E2B desktop module (tests inject a fake; default loadE2BDesktopModule). */
27
+ loadDesktopModule?: () => Promise<E2BDesktopModule>;
28
+ /** Runs once after sandbox creation, before subject provisioning (library setup seam). */
29
+ prepareDesktop?: (desktop: E2BDesktopSandbox) => Promise<void>;
30
+ /** The per-seat computer-use session runner (default: the resolved actor descriptor's). */
31
+ runSession?: (options: CuaActorSessionOptions) => Promise<CuaLoopResult>;
32
+ /** The operator environment (keys + subject env values). Defaults to process.env. */
33
+ env?: Record<string, string | undefined>;
34
+ renderObserverFn?: typeof renderObserver;
35
+ /** Injected clock/sleep for the detached-step polling (tests only). */
36
+ detachedTimers?: DetachedTimers;
37
+ /**
38
+ * Subject-provisioning phase sink (mirrors CuaActorLabHooks.onPhase): one call per
39
+ * started/completed boundary during the ONE shared-plane provision (clone route: clone, install,
40
+ * build, serve start, ready, subject.state seed-step groups; local-tree route: upload, extract,
41
+ * install, build, serve start, ready, seed-step groups - no clone phase). Defaults to one stderr
42
+ * line per event. Override in tests to capture instead of writing to real stderr.
43
+ */
44
+ onPhase?: (event: SubjectPhaseEvent) => void;
45
+ /**
46
+ * CONCURRENT route only (#164 phase 2): the harness clock used to MEASURE each actor's laneWindow
47
+ * [start,end] (default Date.now). The deterministic heart test does NOT override this — overlap is
48
+ * produced by a rendezvous latch in the fake runSession + measured by the REAL clock (FIX-1), so
49
+ * the windows are real, not injected. (A test may override only for non-overlap assertions.)
50
+ */
51
+ now?: () => number;
52
+ /** CONCURRENT route only: the background stateSeries prober cadence (ms). Default 1000. */
53
+ proberCadenceMs?: number;
54
+ /**
55
+ * Local-tree packing DI seam (tests only, no npm dependency needed to exercise the route):
56
+ * defaults to createLocalTreeArchive(root, opts) plus a host-side read of the produced archive
57
+ * file into an ArrayBuffer (the SAME default cua-actor-lab.ts uses). Called ONCE per run, before
58
+ * the ONE shared-plane sandbox is created, on the live local-tree route.
59
+ */
60
+ packLocalTree?: (args: {
61
+ root: string;
62
+ extraExclude?: string[];
63
+ maxArchiveBytes?: number;
64
+ }) => Promise<{
65
+ archive: LocalTreeArchive;
66
+ buffer: ArrayBuffer;
67
+ }>;
68
+ }
69
+ export interface RunSharedWorldLabOptions {
70
+ cwd: string;
71
+ config: LabConfig;
72
+ /** Resolved upstream (scenario.mode + CLI override); defaults safe (dry-run). */
73
+ dryRun: boolean;
74
+ open?: boolean;
75
+ runId?: string;
76
+ hooks?: SharedWorldLabHooks;
77
+ }
78
+ export type SharedWorldLabErrorCode = "HUMANISH_SHARED_WORLD_LAB_FAILED" | "HUMANISH_SHARED_WORLD_LAB_ACTOR_UNSUPPORTED" | "HUMANISH_SHARED_WORLD_LAB_INVALID" | "HUMANISH_SHARED_WORLD_LAB_KEYS_MISSING" | "HUMANISH_SHARED_WORLD_LAB_SUBJECT_ENV_MISSING";
79
+ /** One role seat's terminal outcome in the result projection. */
80
+ export interface SharedWorldRoleResult {
81
+ id: string;
82
+ index: number;
83
+ persona: string;
84
+ /** Terminal role status; "blocked" = fail-fast skipped it; "contract_proof_only" = dry-run. */
85
+ status: ActorStatus | "blocked" | "contract_proof_only";
86
+ ok: boolean;
87
+ session?: {
88
+ status: ActorStatus;
89
+ completionReason: ActorCompletionReason;
90
+ reason: string;
91
+ screenshots: number;
92
+ };
93
+ /** The user-data-dir profile this seat drove (proves per-seat isolation). */
94
+ profileDir: string;
95
+ /** Set when the role was skipped by fail-fast (a pinned reason string). */
96
+ skippedReason?: string;
97
+ error?: {
98
+ code: SharedWorldLabErrorCode;
99
+ message: string;
100
+ };
101
+ }
102
+ export interface SharedWorldLabResult {
103
+ schema: typeof SHARED_WORLD_LAB_SCHEMA;
104
+ /** True when the bundle verified AND (dry-run, or every role reached a terminal, engaged
105
+ * verdict without a harness error). The roles' pass/fail is evidence, not the lab's exit code. */
106
+ ok: boolean;
107
+ cwd: string;
108
+ labId: string;
109
+ /** The registry-resolved actor id that ran (or would run) the seats. */
110
+ actor: string;
111
+ topology: "shared-world";
112
+ /** The DECLARED number of role seats. */
113
+ roleCount: number;
114
+ /** The role ids that actually took a turn, in declared order. */
115
+ sequence: string[];
116
+ dryRun: boolean;
117
+ runId: string;
118
+ /** Live-only: the ONE shared sandbox's lifecycle proof (the stream/key value is never surfaced). */
119
+ sandbox?: {
120
+ sandboxId: string;
121
+ killed: boolean;
122
+ };
123
+ /** Subject provenance (invariant 5): the ONE shared plane. */
124
+ subject?: RunSubjectProvenance;
125
+ roles: SharedWorldRoleResult[];
126
+ observer?: ObserverResult;
127
+ warnings: string[];
128
+ error?: {
129
+ code: SharedWorldLabErrorCode;
130
+ message: string;
131
+ };
132
+ }
133
+ /** A fully-resolved role seat (internal). */
134
+ interface RoleSpec {
135
+ roleId: string;
136
+ /** 0-based. */
137
+ roleIndex: number;
138
+ simId: string;
139
+ streamId: string;
140
+ persona: ActorPersonaRef;
141
+ instructions: string;
142
+ /** The role's declared device (a PROMPT SIGNAL — see the file's FIDELITY NOTE). */
143
+ deviceName: string;
144
+ /** Deterministic harness-owned completion guard. Lane-level override, else actor default. */
145
+ stopWhen?: StopWhen;
146
+ entry?: string;
147
+ seatUrl: string;
148
+ screenshotDir: string;
149
+ traceArtifactPath: string;
150
+ profileDir: string;
151
+ }
152
+ /** One role seat's end-to-end run outcome (internal; projected into the result + the bundle). */
153
+ interface RoleOutcome {
154
+ spec: RoleSpec;
155
+ session?: CuaLoopResult;
156
+ sessionError?: string;
157
+ screenshots: string[];
158
+ desktopBrowser?: DesktopBrowserEvidence;
159
+ /** Set when fail-fast skipped this role before it ran. */
160
+ skippedReason?: string;
161
+ noEngagement: boolean;
162
+ harnessError: boolean;
163
+ /** The checkpoint snapshot taken AFTER this role's turn (absent for skipped roles). */
164
+ afterCheckpoint?: SharedWorldCheckpoint;
165
+ }
166
+ /** Combine a snapshot's per-probe digests into ONE sha256-16 (digest-only; no raw value). */
167
+ export declare function combineCheckpointDigest(parts: string[]): string;
168
+ /**
169
+ * Run ONE checkpoint snapshot LIVE: each declared probe runs read-only via the detached
170
+ * primitive; its stdout is literal-scrubbed (provisioned values + the probe's declared redact
171
+ * literals, folded into `scrub`) then pattern-redacted, then digested. Only the COMBINED digest
172
+ * persists — never the raw value (the seed-step lockdown). Unique step names per snapshot prevent
173
+ * stale-status reuse across snapshots.
174
+ */
175
+ export declare function runCheckpointSnapshot(args: {
176
+ desktop: E2BDesktopSandbox;
177
+ snapshotIndex: number;
178
+ name: string;
179
+ checkpoints: LabSubjectStateCheckpoint[];
180
+ prevDigest: string | undefined;
181
+ scrub: (text: string) => string;
182
+ requestTimeoutMs: number;
183
+ timers: DetachedTimers;
184
+ }): Promise<SharedWorldCheckpoint>;
185
+ /** The DECLARED (dry-run) checkpoint snapshot: digest the probe RECIPE (command digests), no run. */
186
+ export declare function declaredCheckpointSnapshot(name: string, checkpoints: LabSubjectStateCheckpoint[]): SharedWorldCheckpoint;
187
+ /** sha256-16 over the ordered seed-step command digests — the seeded-state RECIPE identity. */
188
+ export declare function seedRecipeDigest(config: LabConfig): string;
189
+ export declare function runSharedWorldLab(options: RunSharedWorldLabOptions): Promise<SharedWorldLabResult>;
190
+ /** Project the shared-world run into a humanish.run-bundle.v1 with the sharedWorld evidence block. */
191
+ export declare function buildSharedWorldBundle(args: {
192
+ config: LabConfig;
193
+ descriptor: CuaActorDescriptor;
194
+ createdAt: string;
195
+ dryRun: boolean;
196
+ runId: string;
197
+ source: RunBundle["source"];
198
+ roleSpecs: RoleSpec[];
199
+ roleOutcomes: RoleOutcome[];
200
+ baselineCheckpoint: SharedWorldCheckpoint;
201
+ subject: RunSubjectProvenance;
202
+ sandboxResolution: [number, number];
203
+ sandboxPreset: DevicePreset;
204
+ seedDigest: string;
205
+ subjectCommit?: string;
206
+ failFastReason?: string;
207
+ }): RunBundle;
208
+ export {};