humanish 0.116.0 → 0.118.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 (120) hide show
  1. package/CHANGELOG.md +40 -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/analysis/admission.d.ts +7 -2
  20. package/dist/analysis/admission.js +12 -3
  21. package/dist/analysis/automatic-config.d.ts +6 -1
  22. package/dist/analysis/automatic-config.js +12 -11
  23. package/dist/analysis/execute.d.ts +19 -7
  24. package/dist/analysis/execute.js +55 -17
  25. package/dist/browser-control/protocol.d.ts +86 -6
  26. package/dist/browser-control/protocol.js +13 -6
  27. package/dist/cli/commands/analyze.js +2 -1
  28. package/dist/cli/commands/study-format.js +8 -11
  29. package/dist/cli/commands/study-route-computer-use.js +2 -2
  30. package/dist/cli/commands/study-route-scripted.js +2 -2
  31. package/dist/cli/commands/study-route-shared-world.js +5 -3
  32. package/dist/cli/commands/study-route-terminal.js +2 -2
  33. package/dist/cli/commands/study-run.js +3 -3
  34. package/dist/cli/commands/study.js +2 -2
  35. package/dist/cli/doctor.js +11 -1
  36. package/dist/cli/io.js +3 -2
  37. package/dist/comms/lease-store.d.ts +1 -1
  38. package/dist/comms/lease-store.js +3 -2
  39. package/dist/comms/receiving-types.d.ts +2 -0
  40. package/dist/comms/receiving-types.js +2 -0
  41. package/dist/guest/desktop-executor.js +3 -1
  42. package/dist/observer-app.html +7 -7
  43. package/dist/routes/computer-use/e2b-desktop/prepare.js +40 -31
  44. package/dist/routes/computer-use/fanout-bundle.js +2 -1
  45. package/dist/routes/computer-use/fanout-records.js +2 -1
  46. package/dist/routes/computer-use/local-vm.js +5 -2
  47. package/dist/routes/computer-use/participant-model.js +9 -0
  48. package/dist/routes/computer-use/participant-runs.js +3 -9
  49. package/dist/routes/computer-use/plan.d.ts +3 -1
  50. package/dist/routes/computer-use/plan.js +29 -9
  51. package/dist/routes/computer-use/single-bundle.js +7 -4
  52. package/dist/routes/computer-use/subject-projection.js +2 -0
  53. package/dist/routes/computer-use/types.d.ts +1 -1
  54. package/dist/routes/scripted/plan.d.ts +4 -1
  55. package/dist/routes/scripted/plan.js +25 -2
  56. package/dist/routes/scripted/setup.js +1 -4
  57. package/dist/routes/scripted/types.d.ts +1 -1
  58. package/dist/routes/shared-world/participant-specs.js +2 -2
  59. package/dist/routes/shared-world/plan.d.ts +3 -1
  60. package/dist/routes/shared-world/plan.js +39 -7
  61. package/dist/routes/shared-world/route.js +2 -2
  62. package/dist/routes/terminal/live-sandbox.d.ts +1 -1
  63. package/dist/routes/terminal/live-sandbox.js +14 -11
  64. package/dist/routes/terminal/sandbox.d.ts +4 -3
  65. package/dist/routes/terminal/sandbox.js +5 -5
  66. package/dist/run/bundle-shape.js +2 -1
  67. package/dist/run/bundle.d.ts +5 -3
  68. package/dist/run/projection.js +7 -2
  69. package/dist/run/route-shell.js +10 -5
  70. package/dist/run/subject-name.d.ts +11 -0
  71. package/dist/run/subject-name.js +11 -0
  72. package/dist/study/automatic-analysis-plan.d.ts +28 -0
  73. package/dist/study/automatic-analysis-plan.js +57 -0
  74. package/dist/study/composition-rules.js +1 -1
  75. package/dist/study/config.js +10 -21
  76. package/dist/study/doctor.js +17 -3
  77. package/dist/study/keys.d.ts +2 -0
  78. package/dist/study/keys.js +2 -0
  79. package/dist/study/migrate/v2.js +2 -1
  80. package/dist/study/parse/actors.d.ts +1 -1
  81. package/dist/study/parse/actors.js +9 -1
  82. package/dist/study/parse/front.d.ts +1 -1
  83. package/dist/study/parse/front.js +7 -1
  84. package/dist/study/plan-base.d.ts +2 -0
  85. package/dist/study/plan-base.js +3 -0
  86. package/dist/study/plan-participants.d.ts +4 -0
  87. package/dist/study/plan-participants.js +6 -5
  88. package/dist/study/plan-types.d.ts +8 -3
  89. package/dist/study/plan.d.ts +4 -4
  90. package/dist/study/plan.js +21 -12
  91. package/dist/study/preflight-result.js +2 -2
  92. package/dist/study/preflight.d.ts +2 -1
  93. package/dist/study/preflight.js +12 -3
  94. package/dist/study/routing.d.ts +5 -4
  95. package/dist/study/routing.js +16 -7
  96. package/dist/study/summary.d.ts +3 -3
  97. package/dist/study/summary.js +3 -5
  98. package/dist/study/types.d.ts +14 -0
  99. package/dist/study/validation.d.ts +7 -2
  100. package/dist/study/validation.js +30 -14
  101. package/dist/study/warnings.js +12 -0
  102. package/dist/subject/serve.d.ts +3 -0
  103. package/dist/subject/serve.js +4 -1
  104. package/dist/substrates/detached.js +14 -7
  105. package/dist/substrates/e2b/desktop-executor.d.ts +0 -2
  106. package/dist/substrates/e2b/desktop-executor.js +3 -3
  107. package/dist/substrates/e2b/lifetime.d.ts +75 -4
  108. package/dist/substrates/e2b/lifetime.js +134 -10
  109. package/dist/substrates/e2b/subject-sandbox.js +2 -6
  110. package/dist/tui-app.js +119 -118
  111. package/dist/verify/artifacts.d.ts +19 -4
  112. package/dist/verify/artifacts.js +39 -8
  113. package/dist/verify/verify.js +6 -15
  114. package/docs/architecture/browser-control.md +10 -4
  115. package/docs/contracts/run-bundle.md +7 -6
  116. package/docs/contracts/schemas.md +33 -19
  117. package/docs/contracts/study-analysis.md +2 -2
  118. package/docs/principles/invariants-and-defaults.md +1 -1
  119. package/docs/product/automatic-analysis.md +4 -3
  120. package/package.json +2 -2
@@ -4,7 +4,7 @@ import { existsSync } from "node:fs";
4
4
  import path from "node:path";
5
5
  import { DOCTOR_KEYS, probeKeySources, } from "../keys/key-resolution.js";
6
6
  import { desktopPeerAdvice, humanishInstall, } from "../substrates/e2b/peer-install.js";
7
- import { describeSandboxCeiling, sandboxCeiling } from "../substrates/e2b/lifetime.js";
7
+ import { concurrentSandboxes, describeConcurrentSandboxes, describeSandboxCeiling, sandboxCeiling, } from "../substrates/e2b/lifetime.js";
8
8
  import { nodeSupportsTui, terminalSurfaceMessage, TUI_BUNDLE_URL } from "../tui/contract.js";
9
9
  import { detectLocalAgents, localAgentDoctorMessage, localAgentReady, NO_LOCAL_AGENT_MESSAGE, } from "../actors/local-agent/cli.js";
10
10
  import { leftoverClaudeTranscripts } from "../actors/local-agent/claude-participant.js";
@@ -97,6 +97,7 @@ export async function doctor(cwdInput, options = {}) {
97
97
  ...(await projectChecks(projectRoot)),
98
98
  await desktopSdkCheck(setup),
99
99
  sandboxCeilingCheck(env),
100
+ concurrentSandboxesCheck(env),
100
101
  terminalSurfaceCheck(),
101
102
  ...versionCheck(env),
102
103
  ...localAgentChecks(agents),
@@ -198,6 +199,15 @@ function sandboxCeilingCheck(env) {
198
199
  const ceiling = sandboxCeiling(env);
199
200
  return { name: "e2b sandbox ceiling", ok: ceiling.ok, message: describeSandboxCeiling(ceiling) };
200
201
  }
202
+ /** How many sandboxes the E2B planners run at once, and where that number came from. */
203
+ function concurrentSandboxesCheck(env) {
204
+ const limit = concurrentSandboxes(env);
205
+ return {
206
+ name: "e2b concurrent sandboxes",
207
+ ok: limit.ok,
208
+ message: describeConcurrentSandboxes(limit),
209
+ };
210
+ }
201
211
  /**
202
212
  * The optional peer dep every live browser and terminal route needs. `npx -y humanish` does not
203
213
  * pull optional peers, so without this check an adopter's first live run fails on it, safely and at
package/dist/cli/io.js CHANGED
@@ -1,10 +1,10 @@
1
- import { automaticAnalysisSucceeded, } from "../analysis/automatic-completion.js";
2
1
  import { costRefusal, refusedCost } from "../analysis/admission.js";
3
2
  import { Command, Option } from "commander";
4
3
  import { loadEnvFile, recordDotenvNames } from "../keys/env-file.js";
5
4
  import { discoverProviderKeys } from "../keys/key-resolution.js";
6
5
  import { deriveRunFacts } from "./telemetry.js";
7
6
  import { warnAndQueue, withQueuedWarnings } from "./deprecations.js";
7
+ import { PARTICIPANT_LIMIT_SKIP, PARTICIPANT_LIMIT_SKIP_TEXT, studyAnalysisSucceeded, } from "../study/automatic-analysis-plan.js";
8
8
  import { forTerminal } from "../routes/terminal/encoding.js";
9
9
  import { cli } from "./invocation.js";
10
10
  export const CLI_RESPONSE_SCHEMA = "humanish.cli-response.v1";
@@ -295,6 +295,7 @@ const ANALYSIS_REASON_TEXT = {
295
295
  AUTOMATIC_ANALYSIS_BUSY: "skipped because another analysis is running",
296
296
  AUTOMATIC_ANALYSIS_ADMISSION_REFUSED: "refused before it started: its configuration, question, evidence or cost did not pass admission",
297
297
  AUTOMATIC_ANALYSIS_CLEANUP_UNCONFIRMED: "not started because the run's cleanup was not confirmed",
298
+ [PARTICIPANT_LIMIT_SKIP]: PARTICIPANT_LIMIT_SKIP_TEXT,
298
299
  AUTOMATIC_ANALYSIS_REUSED: "complete, reusing an earlier analysis of the same evidence",
299
300
  AUTOMATIC_ANALYSIS_LIMITATIONS: "partial, because it covered only part of the evidence",
300
301
  AUTOMATIC_ANALYSIS_ADMISSION_EXCEEDED: "partial, because it went over its estimated cost or output",
@@ -320,5 +321,5 @@ export function automaticAnalysisEnvelope(result) {
320
321
  !("ok" in result))
321
322
  return result;
322
323
  const run = result;
323
- return { ...run, runOk: run.ok, ok: run.ok && automaticAnalysisSucceeded(run) };
324
+ return { ...run, runOk: run.ok, ok: run.ok && studyAnalysisSucceeded(run) };
324
325
  }
@@ -1,4 +1,4 @@
1
- import type { ReceivingIdentity, ReceivingLease } from "./receiving-types.js";
1
+ import { type ReceivingIdentity, type ReceivingLease } from "./receiving-types.js";
2
2
  declare const SCHEMA = "humanish.comms-lease-journal.v1";
3
3
  type PhysicalIdentity = {
4
4
  path: string;
@@ -6,6 +6,7 @@ import { homedir, hostname } from "node:os";
6
6
  import path from "node:path";
7
7
  import { isRecord } from "../run/type-guards.js";
8
8
  import { isReceivingProviderId } from "./providers.js";
9
+ import { MAX_RECEIVING_INBOXES, } from "./receiving-types.js";
9
10
  const SCHEMA = "humanish.comms-lease-journal.v1";
10
11
  const MAX_BYTES = 1_048_576;
11
12
  const UUID = /^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/;
@@ -117,7 +118,7 @@ function parseJournal(text) {
117
118
  !safeString(value.updatedAt) ||
118
119
  !Array.isArray(value.leases) ||
119
120
  value.leases.length < 1 ||
120
- value.leases.length > 64)
121
+ value.leases.length > MAX_RECEIVING_INBOXES)
121
122
  fail();
122
123
  const participants = new Set();
123
124
  const leaseIds = new Set();
@@ -470,7 +471,7 @@ export class CommsLeaseStore {
470
471
  !KEY_ENV.test(options.apiKeyEnv) ||
471
472
  !validReceivingIdentity(options.identity) ||
472
473
  options.participants.length < 1 ||
473
- options.participants.length > 64 ||
474
+ options.participants.length > MAX_RECEIVING_INBOXES ||
474
475
  new Set(options.participants).size !== options.participants.length ||
475
476
  options.participants.some((id) => !LOCAL_ID.test(id)))
476
477
  fail();
@@ -3,6 +3,8 @@ import type { ReceivingProviderId } from "./providers.js";
3
3
  import type { CommsInlineImage } from "./types.js";
4
4
  /** authenticate() rejects with this code when the credential cannot acquire fresh inboxes. */
5
5
  export declare const RECEIVING_SCOPE_UNSUPPORTED = "comms_scope_unsupported";
6
+ /** The most inboxes one run leases, one per participant; the lease journal holds this many. */
7
+ export declare const MAX_RECEIVING_INBOXES = 64;
6
8
  export interface ReceivingContext {
7
9
  signal?: AbortSignal;
8
10
  timeoutMs?: number;
@@ -1,3 +1,5 @@
1
1
  /** authenticate() rejects with this code when the credential cannot acquire fresh inboxes. */
2
2
  export const RECEIVING_SCOPE_UNSUPPORTED = "comms_scope_unsupported";
3
+ /** The most inboxes one run leases, one per participant; the lease journal holds this many. */
4
+ export const MAX_RECEIVING_INBOXES = 64;
3
5
  export const COMMS_RECEIVING_SCHEMA = "humanish.comms-receiving.v2";
@@ -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.