humanish 0.55.0 → 0.57.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 (41) hide show
  1. package/dist/actor-contract.d.ts +3 -2
  2. package/dist/actor-contract.js.map +1 -1
  3. package/dist/agent-session.d.ts +11 -0
  4. package/dist/agent-session.js +43 -0
  5. package/dist/agent-session.js.map +1 -0
  6. package/dist/cua-actor-lab.d.ts +10 -0
  7. package/dist/cua-actor-lab.js +145 -21
  8. package/dist/cua-actor-lab.js.map +1 -1
  9. package/dist/e2b-terminal-lab.js +36 -1
  10. package/dist/e2b-terminal-lab.js.map +1 -1
  11. package/dist/lab-config.d.ts +29 -4
  12. package/dist/lab-config.js +47 -8
  13. package/dist/lab-config.js.map +1 -1
  14. package/dist/lab-engine.js +6 -0
  15. package/dist/lab-engine.js.map +1 -1
  16. package/dist/labs.d.ts +6 -0
  17. package/dist/labs.js +4 -1
  18. package/dist/labs.js.map +1 -1
  19. package/dist/program.d.ts +9 -0
  20. package/dist/program.js +79 -4
  21. package/dist/program.js.map +1 -1
  22. package/dist/reasoning-effort.js +4 -2
  23. package/dist/reasoning-effort.js.map +1 -1
  24. package/dist/run-projection.d.ts +4 -0
  25. package/dist/run-projection.js +1 -0
  26. package/dist/run-projection.js.map +1 -1
  27. package/dist/run.d.ts +9 -0
  28. package/dist/run.js +23 -15
  29. package/dist/run.js.map +1 -1
  30. package/dist/terminal-encoding.d.ts +17 -0
  31. package/dist/terminal-encoding.js +80 -0
  32. package/dist/terminal-encoding.js.map +1 -0
  33. package/dist/tui-app.js +118 -118
  34. package/dist/tui-contract.d.ts +17 -0
  35. package/dist/tui-contract.js +22 -0
  36. package/dist/tui-contract.js.map +1 -1
  37. package/docs/contracts/schemas.md +13 -5
  38. package/docs/goals/current.md +2 -2
  39. package/docs/principles/actor-fidelity.md +23 -1
  40. package/docs/ramp/README.md +1 -1
  41. package/package.json +1 -1
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Does this environment declare a UTF-8 locale? The POSIX variables are checked in the order the C
3
+ * library resolves them (LC_ALL overrides LC_CTYPE overrides LANG).
4
+ *
5
+ * Windows terminals declare none of these and are handled as UTF-8: modern Windows Terminal and
6
+ * PowerShell render it, and the failure this guards against is a Unix locale that says C/POSIX.
7
+ */
8
+ export declare function terminalRendersUnicode(env?: NodeJS.ProcessEnv): boolean;
9
+ /**
10
+ * Rewrite a string so a non-UTF-8 terminal can read it. A no-op when the terminal handles Unicode,
11
+ * so the good case keeps every glyph it was designed with.
12
+ *
13
+ * Characters with no declared fallback are replaced with `?` rather than passed through: passing
14
+ * them through is what produced `���` in the first place, and one `?` is at least legible as
15
+ * "something did not survive".
16
+ */
17
+ export declare function forTerminal(text: string, env?: NodeJS.ProcessEnv): string;
@@ -0,0 +1,80 @@
1
+ // Whether this terminal can render the characters we write to it.
2
+ //
3
+ // FOUND BY A PARTICIPANT, not by us (labs/tui-self-study.yaml): a computer-use participant sitting
4
+ // at a stock desktop ran `humanish` and read back `humanish ��� run realistic synthetic personas`.
5
+ // The em dash is three bytes of UTF-8, and a terminal whose locale is not UTF-8 renders each byte
6
+ // as a replacement glyph. Every ASCII character on the same screen was fine, which is exactly the
7
+ // signature.
8
+ //
9
+ // The honest fix is not "stop using em dashes" — it is to ask what the terminal can render and mean
10
+ // it. A surface that emits characters its own terminal cannot decode is not being expressive, it is
11
+ // producing garbage that reads as a bug in the tool.
12
+ const UTF8 = /utf-?8/i;
13
+ /**
14
+ * Does this environment declare a UTF-8 locale? The POSIX variables are checked in the order the C
15
+ * library resolves them (LC_ALL overrides LC_CTYPE overrides LANG).
16
+ *
17
+ * Windows terminals declare none of these and are handled as UTF-8: modern Windows Terminal and
18
+ * PowerShell render it, and the failure this guards against is a Unix locale that says C/POSIX.
19
+ */
20
+ export function terminalRendersUnicode(env = process.env) {
21
+ if (process.platform === "win32")
22
+ return true;
23
+ const declared = env.LC_ALL ?? env.LC_CTYPE ?? env.LANG;
24
+ if (declared === undefined || declared.trim().length === 0) {
25
+ // Nothing declared at all. A bare login shell on a stock image lands here, and that is the
26
+ // case the participant hit — assume it cannot, because the failure is silent and ugly while
27
+ // the fallback is merely plainer.
28
+ return false;
29
+ }
30
+ return UTF8.test(declared);
31
+ }
32
+ /**
33
+ * The ASCII stand-in for a character, when the terminal cannot render the real one. Anything with
34
+ * no entry here is already ASCII and passes through.
35
+ */
36
+ const ASCII_FALLBACKS = new Map([
37
+ ["—", "--"],
38
+ ["–", "-"],
39
+ ["’", "'"],
40
+ ["‘", "'"],
41
+ ["“", '"'],
42
+ ["”", '"'],
43
+ ["…", "..."],
44
+ ["·", "-"],
45
+ ["❯", ">"],
46
+ ["‹", "<"],
47
+ ["▸", ">"],
48
+ ["✓", "+"],
49
+ ["⚑", "!"],
50
+ ["⏎", "Enter"],
51
+ ["↑", "^"],
52
+ ["↓", "v"],
53
+ ["←", "<-"],
54
+ ["→", "->"],
55
+ ["×", "x"],
56
+ ["≈", "~"],
57
+ ["✗", "x"]
58
+ ]);
59
+ /**
60
+ * Rewrite a string so a non-UTF-8 terminal can read it. A no-op when the terminal handles Unicode,
61
+ * so the good case keeps every glyph it was designed with.
62
+ *
63
+ * Characters with no declared fallback are replaced with `?` rather than passed through: passing
64
+ * them through is what produced `���` in the first place, and one `?` is at least legible as
65
+ * "something did not survive".
66
+ */
67
+ export function forTerminal(text, env = process.env) {
68
+ if (terminalRendersUnicode(env))
69
+ return text;
70
+ let out = "";
71
+ for (const character of text) {
72
+ if (character.codePointAt(0) < 128) {
73
+ out += character;
74
+ continue;
75
+ }
76
+ out += ASCII_FALLBACKS.get(character) ?? "?";
77
+ }
78
+ return out;
79
+ }
80
+ //# sourceMappingURL=terminal-encoding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminal-encoding.js","sourceRoot":"","sources":["../src/terminal-encoding.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,EAAE;AACF,mGAAmG;AACnG,mGAAmG;AACnG,kGAAkG;AAClG,kG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