@hanzo/build 0.2.51 → 0.2.53

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 (98) hide show
  1. package/README.md +109 -55
  2. package/lib/api/billing.d.ts +39 -0
  3. package/lib/api/billing.js +41 -0
  4. package/lib/api/coding.d.ts +4 -1
  5. package/lib/api/coding.js +2 -0
  6. package/lib/api/environment.d.ts +12 -0
  7. package/lib/api/environment.js +39 -1
  8. package/lib/api/github.d.ts +42 -4
  9. package/lib/api/github.js +79 -16
  10. package/lib/api/limits.d.ts +69 -0
  11. package/lib/api/limits.js +86 -0
  12. package/lib/api/links.d.ts +42 -0
  13. package/lib/api/links.js +65 -0
  14. package/lib/api/pref.d.ts +5 -3
  15. package/lib/api/pref.js +0 -3
  16. package/lib/api/turn.d.ts +10 -1
  17. package/lib/api/turn.js +16 -4
  18. package/lib/api/work.d.ts +75 -24
  19. package/lib/api/work.js +132 -27
  20. package/lib/builder.d.ts +0 -10
  21. package/lib/builder.js +21 -54
  22. package/lib/choice.d.ts +21 -0
  23. package/lib/choice.js +40 -1
  24. package/lib/customize/agents.d.ts +1 -1
  25. package/lib/customize/agents.js +21 -19
  26. package/lib/customize/connectors.d.ts +1 -1
  27. package/lib/customize/connectors.js +80 -31
  28. package/lib/customize/index.d.ts +2 -0
  29. package/lib/customize/index.js +23 -19
  30. package/lib/customize/load.d.ts +9 -0
  31. package/lib/customize/load.js +22 -0
  32. package/lib/customize/plugins.d.ts +1 -1
  33. package/lib/customize/plugins.js +21 -19
  34. package/lib/customize/say.d.ts +1 -0
  35. package/lib/customize/say.js +38 -0
  36. package/lib/customize/skills.d.ts +1 -1
  37. package/lib/customize/skills.js +23 -17
  38. package/lib/customize/ui.d.ts +28 -11
  39. package/lib/customize/ui.js +29 -21
  40. package/lib/data.d.ts +13 -0
  41. package/lib/data.js +70 -0
  42. package/lib/desk.d.ts +6 -1
  43. package/lib/desk.js +43 -19
  44. package/lib/environment.d.ts +11 -3
  45. package/lib/environment.js +53 -13
  46. package/lib/foot.js +10 -6
  47. package/lib/forge.js +255 -92
  48. package/lib/host.d.ts +1 -1
  49. package/lib/index.d.ts +28 -2
  50. package/lib/index.js +26 -2
  51. package/lib/landing.d.ts +0 -10
  52. package/lib/landing.js +79 -47
  53. package/lib/merge.d.ts +223 -0
  54. package/lib/merge.js +380 -0
  55. package/lib/meter.d.ts +31 -0
  56. package/lib/meter.js +45 -0
  57. package/lib/mind.d.ts +60 -0
  58. package/lib/mind.js +187 -0
  59. package/lib/nav.d.ts +11 -0
  60. package/lib/nav.js +75 -0
  61. package/lib/panel.d.ts +45 -0
  62. package/lib/panel.js +115 -0
  63. package/lib/pick.d.ts +8 -0
  64. package/lib/pick.js +18 -1
  65. package/lib/plan.d.ts +78 -0
  66. package/lib/plan.js +133 -0
  67. package/lib/project.d.ts +16 -1
  68. package/lib/project.js +100 -32
  69. package/lib/prompt.d.ts +75 -0
  70. package/lib/prompt.js +125 -0
  71. package/lib/prose.js +14 -10
  72. package/lib/reply.d.ts +36 -0
  73. package/lib/reply.js +124 -0
  74. package/lib/route.d.ts +28 -4
  75. package/lib/route.js +48 -1
  76. package/lib/run.js +87 -52
  77. package/lib/section.d.ts +1 -1
  78. package/lib/section.js +7 -11
  79. package/lib/settings/billing.js +16 -9
  80. package/lib/settings/code.js +15 -12
  81. package/lib/settings/credits.d.ts +9 -0
  82. package/lib/settings/credits.js +110 -0
  83. package/lib/settings/plan.d.ts +17 -0
  84. package/lib/settings/plan.js +108 -0
  85. package/lib/settings/usage.js +11 -119
  86. package/lib/shelf.js +3 -3
  87. package/lib/standing.d.ts +44 -0
  88. package/lib/standing.js +64 -0
  89. package/lib/sync.js +23 -9
  90. package/lib/tabs.d.ts +53 -0
  91. package/lib/tabs.js +197 -0
  92. package/lib/tools.d.ts +2 -9
  93. package/lib/tools.js +20 -25
  94. package/lib/transcript.d.ts +10 -1
  95. package/lib/transcript.js +25 -10
  96. package/lib/voice.d.ts +2 -13
  97. package/lib/voice.js +7 -73
  98. package/package.json +20 -3
package/lib/voice.js CHANGED
@@ -1,15 +1,8 @@
1
1
  /**
2
- * Dictation into the draft, heard by the platform.
3
- *
4
- * The microphone is recorded in this browser and the recording is transcribed
5
- * by `POST /v1/audio/transcriptions` on the platform, through `@hanzo/voice` —
6
- * never by a browser's built-in recognizer, which ships the audio to its
7
- * vendor. Press to record, press again to stop; the words land in the draft.
8
- * Where there is no microphone or no recorder, `able` is false and the control
9
- * says so rather than recording into nothing.
2
+ * The language dictation listens in. The microphone itself is the composer's
3
+ * (prompt.tsx, @hanzo/voice): heard by the platform, never by a browser's
4
+ * built-in recognizer, which ships the audio to its vendor.
10
5
  */
11
- import { speech } from '@hanzo/voice';
12
- import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
13
6
  import { usePrefs } from './prefs.js';
14
7
  export const LANGUAGES = [
15
8
  { id: 'en', label: 'English' },
@@ -24,67 +17,8 @@ export function spoken() {
24
17
  const nav = typeof navigator !== 'undefined' ? navigator.language.split('-')[0] : 'en';
25
18
  return LANGUAGES.some((l) => l.id === nav) ? nav : 'en';
26
19
  }
27
- /** Whether this browser can record the microphone at all. A page that is not a secure context has no media devices. */
28
- function recordable() {
29
- return typeof window.MediaRecorder === 'function' && Boolean(navigator.mediaDevices?.getUserMedia);
30
- }
31
- export function useDictation(t, onText, onNote) {
32
- const [on, setOn] = useState(false);
33
- const [busy, setBusy] = useState(false);
34
- const [able, setAble] = useState(false);
35
- const rec = useRef(null);
36
- const said = useRef(onText);
37
- said.current = onText;
38
- const note = useRef(onNote);
39
- note.current = onNote;
40
- // The person's saved language (Settings → General), else this browser's, else English.
41
- const kept = usePrefs();
42
- const language = LANGUAGES.some((l) => l.id === kept.prefs.language) ? kept.prefs.language : spoken();
43
- const setLanguage = useCallback((id) => kept.save({ language: id }).catch((e) => note.current(e.message)), [kept]);
44
- const ear = useMemo(() => speech({ baseUrl: t.api, token: t.token, ear: 'whisper' }), [t]);
45
- useEffect(() => setAble(recordable()), []);
46
- const toggle = useCallback(async () => {
47
- if (rec.current) {
48
- rec.current.stop();
49
- return;
50
- }
51
- let stream;
52
- try {
53
- stream = await navigator.mediaDevices.getUserMedia({ audio: { echoCancellation: true, noiseSuppression: true } });
54
- }
55
- catch {
56
- note.current('The microphone is not available to this page.');
57
- return;
58
- }
59
- const chunks = [];
60
- const r = new MediaRecorder(stream);
61
- r.ondataavailable = (e) => {
62
- if (e.data.size)
63
- chunks.push(e.data);
64
- };
65
- r.onstop = () => {
66
- rec.current = null;
67
- setOn(false);
68
- for (const track of stream.getTracks())
69
- track.stop();
70
- const audio = new Blob(chunks, { type: r.mimeType || 'audio/webm' });
71
- if (!audio.size)
72
- return;
73
- setBusy(true);
74
- ear
75
- .transcribe(audio, { language })
76
- .then((text) => {
77
- const words = text.trim();
78
- if (words)
79
- said.current(words);
80
- })
81
- .catch((e) => note.current(e.message))
82
- .finally(() => setBusy(false));
83
- };
84
- rec.current = r;
85
- r.start();
86
- setOn(true);
87
- }, [ear, language]);
88
- useEffect(() => () => rec.current?.stop(), []);
89
- return { on, busy, able, toggle, language, setLanguage, languages: LANGUAGES };
20
+ /** The person's saved language (Settings → General), else this browser's, else English. */
21
+ export function useSpoken() {
22
+ const { prefs } = usePrefs();
23
+ return LANGUAGES.some((l) => l.id === prefs.language) ? prefs.language : spoken();
90
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/build",
3
- "version": "0.2.51",
3
+ "version": "0.2.53",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "description": "Hanzo Build — say what you want, watch it built, deployed and running. The builder as a component, mounted by the Hanzo app at hanzo.ai.",
@@ -8,12 +8,13 @@
8
8
  "node": ">=22.18"
9
9
  },
10
10
  "devDependencies": {
11
+ "@hanzo/composer": "0.2.0",
11
12
  "@hanzo/font": "1.9.3",
12
13
  "@hanzo/gui": "8.3.5",
13
14
  "@hanzo/iam": "0.21.28",
14
15
  "@hanzo/ui": "8.27.77",
15
16
  "@hanzo/vite": "0.1.4",
16
- "@hanzo/voice": "0.1.8",
17
+ "@hanzo/voice": "0.1.18",
17
18
  "@hanzogui/lucide-icons-2": "8.3.5",
18
19
  "@hanzogui/next-theme": "8.3.5",
19
20
  "@playwright/test": "1.63.0",
@@ -38,6 +39,21 @@
38
39
  "import": "./lib/index.js",
39
40
  "default": "./lib/index.js"
40
41
  },
42
+ "./plan": {
43
+ "types": "./lib/plan.d.ts",
44
+ "import": "./lib/plan.js",
45
+ "default": "./lib/plan.js"
46
+ },
47
+ "./route": {
48
+ "types": "./lib/route.d.ts",
49
+ "import": "./lib/route.js",
50
+ "default": "./lib/route.js"
51
+ },
52
+ "./mind": {
53
+ "types": "./lib/mind.d.ts",
54
+ "import": "./lib/mind.js",
55
+ "default": "./lib/mind.js"
56
+ },
41
57
  "./package.json": "./package.json"
42
58
  },
43
59
  "files": [
@@ -59,7 +75,8 @@
59
75
  "@hanzo/ui": ">=8.27.67",
60
76
  "@hanzogui/lucide-icons-2": ">=8.3.5",
61
77
  "react": ">=19.2.8",
62
- "@hanzo/voice": ">=0.1.8"
78
+ "@hanzo/voice": ">=0.1.16",
79
+ "@hanzo/composer": ">=0.2.0"
63
80
  },
64
81
  "scripts": {
65
82
  "dev": "vite",