humanish 0.18.0 → 0.19.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 (43) hide show
  1. package/README.md +21 -0
  2. package/dist/actor-contract.d.ts +10 -0
  3. package/dist/actor-contract.js.map +1 -1
  4. package/dist/computer-use-actor.d.ts +4 -0
  5. package/dist/computer-use-actor.js +3 -1
  6. package/dist/computer-use-actor.js.map +1 -1
  7. package/dist/computer-use.d.ts +16 -0
  8. package/dist/computer-use.js +26 -1
  9. package/dist/computer-use.js.map +1 -1
  10. package/dist/concurrent-shared-world-lab.js +1 -0
  11. package/dist/concurrent-shared-world-lab.js.map +1 -1
  12. package/dist/cua-actor-lab.d.ts +33 -3
  13. package/dist/cua-actor-lab.js +169 -2
  14. package/dist/cua-actor-lab.js.map +1 -1
  15. package/dist/index.d.ts +3 -1
  16. package/dist/index.js +1 -0
  17. package/dist/index.js.map +1 -1
  18. package/dist/lab-config.d.ts +12 -0
  19. package/dist/lab-config.js +12 -0
  20. package/dist/lab-config.js.map +1 -1
  21. package/dist/observer-assets.js +37 -3
  22. package/dist/observer-assets.js.map +1 -1
  23. package/dist/observer-data.d.ts +7 -1
  24. package/dist/observer-data.js +1 -0
  25. package/dist/observer-data.js.map +1 -1
  26. package/dist/observer-library.d.ts +4 -0
  27. package/dist/observer-library.js +8 -1
  28. package/dist/observer-library.js.map +1 -1
  29. package/dist/observer.d.ts +3 -0
  30. package/dist/observer.js +5 -1
  31. package/dist/observer.js.map +1 -1
  32. package/dist/pricing.d.ts +78 -0
  33. package/dist/pricing.js +100 -0
  34. package/dist/pricing.js.map +1 -0
  35. package/dist/run.d.ts +54 -0
  36. package/dist/run.js +86 -0
  37. package/dist/run.js.map +1 -1
  38. package/docs/architecture/actor-contract.md +12 -0
  39. package/docs/contracts/run-bundle.md +23 -0
  40. package/docs/contracts/schemas.md +89 -2
  41. package/docs/goals/current.md +1 -1
  42. package/docs/ramp/README.md +1 -1
  43. package/package.json +1 -1
@@ -165,6 +165,7 @@ export interface ActorTrace {
165
165
  counts: Record<string, number>;
166
166
  items: ActorTraceItem[];
167
167
  tokenUsage?: { input?: number; output?: number; total?: number; costUsd?: number };
168
+ estimatedCost?: ActorEstimatedCost; // humanish.actor-estimated-cost.v1 (additive)
168
169
  capabilities: ActorCapabilities;
169
170
  }
170
171
 
@@ -232,6 +233,17 @@ export interface Actor {
232
233
  target URLs, or unredacted provider payloads in the trace.
233
234
  - **Capabilities.** Declare them honestly; the registry uses them to refuse
234
235
  unsuitable dispatch.
236
+ - **Cost (estimate vs. charge).** `tokenUsage.costUsd` stays RESERVED for a
237
+ real, provider-returned charge (the codex/agent-SDK path) — a bare `costUsd`
238
+ always means "the provider billed this". The optional `estimatedCost`
239
+ (`humanish.actor-estimated-cost.v1`) is a SEPARATE, differently-named field: a
240
+ token-derived rate-table multiply from the operator-editable `src/pricing.ts`,
241
+ labeled honestly as an estimate and projected up into `RunBundle.cost` (see
242
+ [`../contracts/schemas.md`](../contracts/schemas.md) → Run Cost Summary And
243
+ Estimated Actor Cost). The CUA lab computes and attaches `estimatedCost` at the
244
+ lab boundary before persisting the trace, so the pure computer-use loop never
245
+ depends on the pricing table. An unknown model yields
246
+ `estimatedCostUsd: null` + a `reason`, never a guessed charge.
235
247
 
236
248
  ## The scripted-browser lane (shipped)
237
249
 
@@ -112,6 +112,29 @@ instead (a dirty working tree cannot be commit-pinned), and `app-url` carries
112
112
  no code pin at all. No path, basename, or other host-machine string ever
113
113
  enters this field; identity is digests, a sha, a boolean, and counts.
114
114
 
115
+ ## Cost Estimate (advisory)
116
+
117
+ `cost` is optional and additive (`humanish.run-cost-summary.v1`): the
118
+ computer-use lane's run-level cost ESTIMATE — the sum of each lane's
119
+ token-derived model cost plus one aggregate E2B desktop-minute figure. It is an
120
+ ESTIMATE, never authoritative: every dollar is a rate-table multiply from the
121
+ operator-editable `src/pricing.ts`, carries the pricing `ratesAsOf` date and
122
+ `source`, and is surfaced with the "estimated (rates as of `<date>`)" label —
123
+ never a bare charge. It follows the same **declared-absent** discipline as the
124
+ terminal cost ledger: an unpriceable line stays present with
125
+ `estimatedCostUsd: null` + a `reason` and contributes nothing;
126
+ `estimatedTotalUsd` is `null` iff every line is null (never coerced to `0`).
127
+ Dry-runs and lanes that spend nothing omit `cost` entirely, so pre-existing
128
+ bundles stay byte-stable. Each lane's own estimate also rides its
129
+ `stream.actor.estimatedCost` (`humanish.actor-estimated-cost.v1`), kept distinct
130
+ from the reserved provider-returned `tokenUsage.costUsd`. See
131
+ [`schemas.md`](schemas.md) → Run Cost Summary And Estimated Actor Cost.
132
+
133
+ `humanish verify` treats cost as ADVISORY on magnitude and FAIL-CLOSED on
134
+ labeling: absence passes, but a claimed dollar figure without its `ratesAsOf`
135
+ date + `source`, or a total that does not match its known lines, fails. Verify
136
+ never inspects the magnitude — a correctly-labeled large estimate still passes.
137
+
115
138
  ## Adapter Score
116
139
 
117
140
  `adapterScore` is optional and namespaced. It lets a downstream adapter summarize
@@ -3,7 +3,7 @@
3
3
  Date: 2026-06-02 (current-state note updated 2026-07-14)
4
4
 
5
5
  Status: reference map for the major contracts shipped through source version
6
- `0.18.0`; it is not an exhaustive inventory of command/result envelopes. Exported types,
6
+ `0.19.0`; it is not an exhaustive inventory of command/result envelopes. Exported types,
7
7
  schema constants, parsers, and validators in `src/` are authoritative. Rows
8
8
  marked "reserved" name layering intent only — no code emits or validates them
9
9
  yet. Do not emit a reserved schema.
@@ -43,6 +43,9 @@ workflow without leaking private upstream truth into core.
43
43
  | Feedback | `humanish.feedback.v1` | `public-safe-feedback` |
44
44
  | Terminal cost ledger | `humanish.terminal-cost-ledger.v1` | see Terminal Cost Ledger below |
45
45
  | Terminal no-spend proof | `humanish.terminal-no-spend-proof.v1` | see Terminal Cost Ledger below |
46
+ | Pricing (operator-editable rates) | `humanish.pricing.v1` (`src/pricing.ts`; dated per-model + E2B desktop rates) | see Run Cost Summary And Estimated Actor Cost below |
47
+ | Run cost summary | `humanish.run-cost-summary.v1` (additive `RunBundle.cost`; estimate, never a charge) | see Run Cost Summary And Estimated Actor Cost below |
48
+ | Estimated actor cost | `humanish.actor-estimated-cost.v1` (additive `ActorTrace.estimatedCost`) | see Run Cost Summary And Estimated Actor Cost below |
46
49
  | Adapter score | `humanish.adapter-score.v1` (`RunBundle.adapterScore`; namespaced; route-specific acceptance semantics) | see Product-Adapter Extension Seam below |
47
50
  | Adapter artifact | `humanish.adapter-artifact.v1` (`RunBundle.adapterArtifacts[]`; namespaced; local relative proof references) | see Product-Adapter Extension Seam below |
48
51
  | Shared-world evidence | `humanish.shared-world.v1` (additive `RunBundle.sharedWorld` + `RunBundle.attributionClass`; `topologyMode: sequential \| concurrent`) | see Shared-World Evidence below |
@@ -607,6 +610,14 @@ Core-owned fields:
607
610
  distinct from `timed_out`, which stays reserved for a zero-progress deadline
608
611
  hit and remains a failure)
609
612
  - `ids`, `counts`, `items[]`, optional `tokenUsage`, `capabilities`
613
+ - optional `estimatedCost` (`humanish.actor-estimated-cost.v1`): a token-derived
614
+ cost ESTIMATE for this lane (see Run Cost Summary And Estimated Actor Cost).
615
+ It is deliberately a DIFFERENT field from `tokenUsage.costUsd`: a bare
616
+ `costUsd` is RESERVED for a real provider-returned charge, while
617
+ `estimatedCost.estimatedCostUsd` is a rate-table multiply, named honestly as
618
+ an estimate so a reader can never confuse the two (invariant 6). Absent on
619
+ codex/scripted lanes and on every pre-existing bundle; a `null`
620
+ `estimatedCostUsd` is DECLARED ABSENT (unknown rate / no usage), never 0.
610
621
 
611
622
  Unexpected actor-loop diagnostics live inside `items[]` as
612
623
  `kind: notice`, `status: error` rows. They are public-safe evidence, not crash
@@ -661,7 +672,7 @@ mode (`loopback | exposed | share-safe-open`), the loopback host/port,
661
672
  `allowEmails`, `allowDomains` — operator-supplied allow rules, public-safe to
662
673
  echo to the operator's own stdout, never persisted into any bundle), runs
663
674
  listed, computed warnings, and the `ServeErrorCode` union. Exposure auth is
664
- tunnel-edge only — as of 0.18.0 there are no `capabilityUrl`/`publicCapabilityUrl`
675
+ tunnel-edge only — as of 0.19.0 there are no `capabilityUrl`/`publicCapabilityUrl`
665
676
  /`ttlMinutes` fields, no `--auth`/`--ttl` flags, and no `capability-link` mode
666
677
  (the in-process `observer-auth.ts` capability-link was removed as a pre-1.0
667
678
  breaking change).
@@ -743,6 +754,82 @@ measure) and never grant a green pass (they surface as unmeasured). `verifyRun`
743
754
  fails closed when a live bundle lacks the cost ledger or no-spend proof, when the
744
755
  proof claims zero on a `null` line, or when known spend exceeds the declared cap.
745
756
 
757
+ ## Run Cost Summary And Estimated Actor Cost
758
+
759
+ The computer-use (CUA) lane surfaces an ADVISORY, additive cost ESTIMATE. It is
760
+ never authoritative: every dollar figure is a rate-table multiply, labeled
761
+ "estimated (rates as of `<date>`)", and is NEVER presented as a provider charge
762
+ (invariant 6). Three new `.v1` schema tags ship, all additive and optional so
763
+ `humanish.run-bundle.v1` stays v1 and every pre-existing bundle is byte-stable:
764
+
765
+ - `humanish.pricing.v1` — the OPERATOR-EDITABLE rate table in `src/pricing.ts`:
766
+ dated per-model input/output USD-per-token rates and an E2B desktop
767
+ USD-per-minute rate, each with a public pricing-page `source` and an `asOf`
768
+ date. A prominent banner says these are estimates to update when providers
769
+ change pricing. Some entries are `placeholder: true` stand-ins (the shipped
770
+ `gpt-5.5` model rate and the E2B desktop rate) — an operator MUST confirm them
771
+ before trusting the magnitude; the flag propagates into every estimate so a
772
+ stand-in is never mistaken for a live rate. An UNKNOWN model/desktop rate is
773
+ DECLARED ABSENT (`estimatedCostUsd: null` + a `reason`), never guessed.
774
+ - `humanish.actor-estimated-cost.v1` — `ActorTrace.estimatedCost`: one lane's
775
+ token-derived model cost, with `estimatedCostUsd` (or `null` + `reason`
776
+ `no_rate_for_model`/`no_token_usage`), `ratesAsOf`, `source`, `modelId`,
777
+ optional `placeholder`, and a `breakdown`.
778
+ - `humanish.run-cost-summary.v1` — `RunBundle.cost`: the sum of every lane's
779
+ `model-tokens` line PLUS one aggregate `desktop-minutes` line.
780
+
781
+ The summary follows the SAME null discipline as the terminal cost ledger above.
782
+ `estimatedTotalUsd` sums ONLY the non-null `breakdown` lines and is `null` iff
783
+ EVERY line is null (never coerced to `0`); a present-but-unpriceable line stays
784
+ in `breakdown` with `estimatedCostUsd: null` + a `reason` (it records that we
785
+ tried and could not price it) and contributes nothing. `fullyEstimated` is
786
+ `false` when any applicable line is null (the total is then a lower bound);
787
+ `placeholder` is true when any contributing rate is a stand-in; `ratesAsOf` is
788
+ the MIN (oldest) `asOf` across contributing rates — an aggregate is only as fresh
789
+ as its stalest input, so MAX would overclaim freshness (each `breakdown` line
790
+ keeps its own true `asOf`). `desktopMinutes` is a HOST-SIDE
791
+ create→teardown span — an approximation of E2B's server-side billed lifetime, so
792
+ the desktop dollar figure is doubly an estimate.
793
+
794
+ ```yaml
795
+ schema: humanish.run-cost-summary.v1
796
+ currency: usd
797
+ estimatedTotalUsd: 11.60167 # sum of KNOWN lines only; null iff every line null
798
+ ratesAsOf: "2026-08-01"
799
+ fullyEstimated: true # both breakdown lines are priced (no null line)
800
+ placeholder: true # a stand-in rate contributed
801
+ breakdown:
802
+ - { kind: model-tokens, laneId: lane-01, modelId: computer-use-preview,
803
+ estimatedCostUsd: 11.60, ratesAsOf: "2026-08-01", source: "openai.com/api/pricing" }
804
+ - { kind: desktop-minutes, estimatedCostUsd: 0.00167, ratesAsOf: "2026-08-01",
805
+ source: "…e2b.dev/pricing", placeholder: true }
806
+ tokenUsage: { input: 3843523, output: 5869, total: 3849392 }
807
+ desktopMinutes: 1
808
+ note: "Estimated 11.60167 USD total…"
809
+ ```
810
+
811
+ `verifyRun` asserts LABELING/provenance, never MAGNITUDE. Absence PASSES
812
+ (fail-open on display): a bundle with no cost, a null estimate, or a lane without
813
+ `estimatedCost` verifies fine. A CLAIMED number FAILS closed when it lacks its
814
+ `ratesAsOf` date or `source`, or when `estimatedTotalUsd` does not equal the
815
+ rounded sum of its non-null lines (a null line coerced to 0 is a mechanism
816
+ mismatch). A correctly-labeled huge estimate still passes. Cost is neither a
817
+ secret nor a share-blocker, so it never affects `shareSafety`.
818
+
819
+ **Fail-closed spend cap.** `execution.caps.maxUsd` (the terminal lane's
820
+ `LabScenarioCaps` shape, consumed on the CUA route) aborts a session the moment
821
+ its running ESTIMATED spend crosses the cap — the runaway-retry guard. It is a
822
+ **PER-LANE** cap: enforced INSIDE each lane's loop independently, so an N-lane
823
+ fan-out can spend up to N × `maxUsd` before any lane aborts (the run bundle
824
+ warns with the true ~N × cap ceiling; a shared run-level budget is future work).
825
+ A lane that does real work THEN crosses its cap ends `budget_reached` (passed); a
826
+ zero-action runaway that crosses it ends `gave_up` (failed) — the cap classifies
827
+ its outcome honestly rather than greenlighting the runaway it exists to catch.
828
+ Absent = uncapped (the historical behavior); `maxUsd: 0` = no-spend. A cap on a
829
+ model `src/pricing.ts` cannot price is REFUSED at preflight
830
+ (`HUMANISH_CUA_LAB_UNPRICED_CAP`) before any sandbox rather than run uncapped —
831
+ an unenforceable cap is more dangerous than none.
832
+
746
833
  ## Product-Adapter Extension Seam
747
834
 
748
835
  The terminal-product and browser/computer-use lanes let an adopter attach
@@ -16,7 +16,7 @@ Humanish should be the open-source CLI that lets a maintainer ask:
16
16
  The answer should be observable, verifiable, public-safe, and easy to turn into
17
17
  actionable feedback.
18
18
 
19
- ## Current Program Truth (source `0.18.0`)
19
+ ## Current Program Truth (source `0.19.0`)
20
20
 
21
21
  The package source and repository implementation in this tree agree on these
22
22
  points:
@@ -2,7 +2,7 @@
2
2
 
3
3
  Status: public-safe contributor and agent ramp.
4
4
 
5
- Package/source version in this tree: `0.18.0` (2026-08-02). The containment boundary introduced in
5
+ Package/source version in this tree: `0.19.0` (2026-08-02). The containment boundary introduced in
6
6
  `0.15.1` remains in force: managed run and output paths bind to validated
7
7
  physical filesystem identities, and stored provider IDs are evidence, not
8
8
  cleanup authority. The bundled OSS meta-lab is dry-run only until
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "humanish",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "Open-source-safe CLI for persona simulation, observer review, and public-safe feedback drafts.",
5
5
  "author": "Daniel G Wilson <daniel@danielgwilson.com>",
6
6
  "keywords": [