forge-terminal 0.4.4 → 0.5.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 (151) hide show
  1. package/README.md +104 -19
  2. package/dist/chunks/{about-credits-QMC5GQU2.js → about-credits-5UQU5WHE.js} +2 -2
  3. package/dist/chunks/args-QKAIL3E4.js +3 -0
  4. package/dist/chunks/{available-GYIHVSRX.js → available-M6Z62OWE.js} +1 -1
  5. package/dist/chunks/boot-MGR26CBU.js +3 -0
  6. package/dist/chunks/catalog-VPSTQTFD.js +3 -0
  7. package/dist/chunks/check-B6NP7BEM.js +3 -0
  8. package/dist/chunks/chunk-37P6QZ5Q.js +3 -0
  9. package/dist/chunks/chunk-3GJ7GV3V.js +19 -0
  10. package/dist/chunks/{chunk-EHARO6IS.js → chunk-57M4J2BR.js} +1 -1
  11. package/dist/chunks/chunk-63XCSYHM.js +3 -0
  12. package/dist/chunks/{chunk-JFJ3ZJQL.js → chunk-63ZK5SRQ.js} +1 -1
  13. package/dist/chunks/chunk-C4UCCBCX.js +3 -0
  14. package/dist/chunks/{chunk-DERIWZAT.js → chunk-CKZBBDAW.js} +1 -1
  15. package/dist/chunks/chunk-DZOBIUV6.js +3 -0
  16. package/dist/chunks/chunk-EKTUUKDP.js +80 -0
  17. package/dist/chunks/chunk-F34DPQFQ.js +63 -0
  18. package/dist/chunks/chunk-G46QQBT3.js +3 -0
  19. package/dist/chunks/chunk-GSK2A3TN.js +3 -0
  20. package/dist/chunks/chunk-H3DIRJFE.js +3 -0
  21. package/dist/chunks/chunk-HKINXTUW.js +3 -0
  22. package/dist/chunks/chunk-HOZ6XGQQ.js +6 -0
  23. package/dist/chunks/chunk-I6754KTB.js +36 -0
  24. package/dist/chunks/{chunk-YYB3TTGT.js → chunk-JMBEZPYC.js} +1 -1
  25. package/dist/chunks/chunk-K7KKCR7V.js +6 -0
  26. package/dist/chunks/chunk-KH5DHZ2U.js +8 -0
  27. package/dist/chunks/chunk-KXKQDFHX.js +3 -0
  28. package/dist/chunks/chunk-LVYQVJOF.js +3 -0
  29. package/dist/chunks/chunk-N6RCLJE6.js +4 -0
  30. package/dist/chunks/chunk-N72E43Z3.js +3 -0
  31. package/dist/chunks/chunk-NDECMPOM.js +3 -0
  32. package/dist/chunks/chunk-NXJGO66P.js +3 -0
  33. package/dist/chunks/chunk-OK7XOZFO.js +3 -0
  34. package/dist/chunks/chunk-P4RAYEM7.js +6 -0
  35. package/dist/chunks/{chunk-EX7KZBI6.js → chunk-PE5LAYGF.js} +1 -1
  36. package/dist/chunks/chunk-PPR7B5AR.js +3 -0
  37. package/dist/chunks/chunk-Q6KQWJ4J.js +3 -0
  38. package/dist/chunks/{chunk-GJ2GZHRI.js → chunk-RMD7F3QX.js} +1 -1
  39. package/dist/chunks/chunk-SK2UZ25Y.js +3 -0
  40. package/dist/chunks/chunk-SNDFMJIX.js +3 -0
  41. package/dist/chunks/{chunk-IGF6ZFTM.js → chunk-SZRSAL64.js} +1 -1
  42. package/dist/chunks/chunk-THDAQBQ3.js +3 -0
  43. package/dist/chunks/chunk-TL5MACSF.js +3 -0
  44. package/dist/chunks/chunk-V3I6DSF4.js +3 -0
  45. package/dist/chunks/{chunk-M7A55JKD.js → chunk-W6SY5PPG.js} +2 -2
  46. package/dist/chunks/chunk-WC6SJN5Y.js +3 -0
  47. package/dist/chunks/chunk-WE6KP4FR.js +3 -0
  48. package/dist/chunks/chunk-WIPP5TWQ.js +3 -0
  49. package/dist/chunks/{chunk-I2IATJNL.js → chunk-XBOMWF34.js} +1 -1
  50. package/dist/chunks/chunk-XRI5XKEB.js +66 -0
  51. package/dist/chunks/chunk-Y7LOIHFU.js +3 -0
  52. package/dist/chunks/chunk-YINYF6C7.js +3 -0
  53. package/dist/chunks/chunk-ZRHYGR2L.js +134 -0
  54. package/dist/chunks/chunk-ZZZAPVKM.js +3 -0
  55. package/dist/chunks/clip-command-R2NKW4TI.js +3 -0
  56. package/dist/chunks/clipboard-GICOXMMN.js +3 -0
  57. package/dist/chunks/colour-APVBMEJQ.js +3 -0
  58. package/dist/chunks/command-GYCYLUHN.js +3 -0
  59. package/dist/chunks/config-command-6YUMMZF3.js +3 -0
  60. package/dist/chunks/continue-editing-QE5RRIMG.js +3 -0
  61. package/dist/chunks/decoded-UNCEUPNW.js +3 -0
  62. package/dist/chunks/entry-TSLQHDP7.js +6 -0
  63. package/dist/chunks/execute-S5WN34PS.js +3 -0
  64. package/dist/chunks/extensions-XI5R74TS.js +3 -0
  65. package/dist/chunks/{extensions-command-L2AT6OVR.js → extensions-command-25JOL47P.js} +1 -1
  66. package/dist/chunks/ffmpeg-3CJ6C37W.js +3 -0
  67. package/dist/chunks/image-QSTDWHJ4.js +3 -0
  68. package/dist/chunks/install-IDUHZTTS.js +3 -0
  69. package/dist/chunks/{install-V62EEK54.js → install-L5C2UT6M.js} +1 -1
  70. package/dist/chunks/install-size-PZUFEDGI.js +3 -0
  71. package/dist/chunks/launch-LFFWVTFE.js +17 -0
  72. package/dist/chunks/libs-EK64ACG3.js +3 -0
  73. package/dist/chunks/lock-PTQUMNYX.js +3 -0
  74. package/dist/chunks/manager-CQ6NNQY4.js +4 -0
  75. package/dist/chunks/needed-MYXIUZI4.js +3 -0
  76. package/dist/chunks/own-WNA6BFYL.js +3 -0
  77. package/dist/chunks/{paths-5XI5L4KW.js → paths-EOYKOUBC.js} +1 -1
  78. package/dist/chunks/pdfium-WFGSET5S.js +3 -0
  79. package/dist/chunks/preferences-3P4V2EDX.js +3 -0
  80. package/dist/chunks/preset-command-HMOFTZSG.js +3 -0
  81. package/dist/chunks/registry-4IOXO6DT.js +3 -0
  82. package/dist/chunks/{reveal-L6TBFOMV.js → reveal-D5FCZYOA.js} +1 -1
  83. package/dist/chunks/run-HGZVOXRW.js +5 -0
  84. package/dist/chunks/{server-7PMVIYWQ.js → server-KKF3XBQG.js} +8 -8
  85. package/dist/chunks/text-layer-LHZNDMPZ.js +3 -0
  86. package/dist/chunks/{theme-Z6X54JY4.js → theme-NAWQ77WF.js} +1 -1
  87. package/dist/chunks/transcribe-Q5NLWSSR.js +3 -0
  88. package/dist/chunks/transcribe-command-2L7F7MCG.js +3 -0
  89. package/dist/chunks/{update-command-GMBG7BK6.js → update-command-JCTCRPCS.js} +1 -1
  90. package/dist/chunks/update-note-FRMHMUMD.js +3 -0
  91. package/dist/chunks/watch-command-XCCMIQIM.js +3 -0
  92. package/dist/fonts/NotoSans-Bold.ttf.gz +0 -0
  93. package/dist/fonts/NotoSans-Regular.ttf.gz +0 -0
  94. package/dist/fonts/OFL.txt +93 -0
  95. package/dist/helpers/forge-transcribe +0 -0
  96. package/dist/helpers/forge-transcribe-whisper.mjs +525 -0
  97. package/dist/index.js +8 -8
  98. package/dist/third-party-licenses.txt +98 -0
  99. package/package.json +45 -10
  100. package/dist/chunks/args-VPUOIDWE.js +0 -3
  101. package/dist/chunks/boot-FOKV7OHT.js +0 -3
  102. package/dist/chunks/catalog-YSMT3PXT.js +0 -3
  103. package/dist/chunks/check-KAR72Y4X.js +0 -3
  104. package/dist/chunks/chunk-3UEQ2OX6.js +0 -3
  105. package/dist/chunks/chunk-5B5XXH22.js +0 -3
  106. package/dist/chunks/chunk-5IS7O673.js +0 -6
  107. package/dist/chunks/chunk-5SMYDPVX.js +0 -63
  108. package/dist/chunks/chunk-6FUVEO3A.js +0 -78
  109. package/dist/chunks/chunk-6L6C3GJU.js +0 -3
  110. package/dist/chunks/chunk-AAXBN572.js +0 -4
  111. package/dist/chunks/chunk-BZXDNDPG.js +0 -3
  112. package/dist/chunks/chunk-DOWMSJ6R.js +0 -3
  113. package/dist/chunks/chunk-EXLXSKRH.js +0 -3
  114. package/dist/chunks/chunk-FH3R2YYD.js +0 -19
  115. package/dist/chunks/chunk-I63TO22X.js +0 -3
  116. package/dist/chunks/chunk-IWFVEMDN.js +0 -3
  117. package/dist/chunks/chunk-JSMGNA55.js +0 -3
  118. package/dist/chunks/chunk-KAHWYWNT.js +0 -3
  119. package/dist/chunks/chunk-LDKF7KIZ.js +0 -6
  120. package/dist/chunks/chunk-LNB5D67B.js +0 -3
  121. package/dist/chunks/chunk-M66BUNYO.js +0 -3
  122. package/dist/chunks/chunk-NWREILRP.js +0 -66
  123. package/dist/chunks/chunk-PSEIJXGT.js +0 -3
  124. package/dist/chunks/chunk-QR6QHTC3.js +0 -3
  125. package/dist/chunks/chunk-QXTXBMTM.js +0 -3
  126. package/dist/chunks/chunk-SMBK6BTC.js +0 -3
  127. package/dist/chunks/chunk-TDW6KQH6.js +0 -3
  128. package/dist/chunks/chunk-TMQDQLY7.js +0 -21
  129. package/dist/chunks/chunk-XEQVXPPY.js +0 -3
  130. package/dist/chunks/chunk-XSOCV3F2.js +0 -3
  131. package/dist/chunks/chunk-YWKMG5WO.js +0 -3
  132. package/dist/chunks/clip-command-SGB3B4OJ.js +0 -3
  133. package/dist/chunks/clipboard-CPHPA4FH.js +0 -3
  134. package/dist/chunks/colour-QMGYV6WQ.js +0 -3
  135. package/dist/chunks/command-I5M275ZV.js +0 -3
  136. package/dist/chunks/config-command-TYNYVUMP.js +0 -3
  137. package/dist/chunks/entry-3PEVSH2X.js +0 -6
  138. package/dist/chunks/execute-WQJ37VKD.js +0 -3
  139. package/dist/chunks/extensions-ZKOWPSLD.js +0 -3
  140. package/dist/chunks/ffmpeg-PF3VLTHK.js +0 -3
  141. package/dist/chunks/image-J4FT4ACZ.js +0 -3
  142. package/dist/chunks/install-2A5BGKQU.js +0 -3
  143. package/dist/chunks/launch-L5DKAUA3.js +0 -15
  144. package/dist/chunks/lock-KN7CF4YN.js +0 -3
  145. package/dist/chunks/manager-TEZ3V4L4.js +0 -4
  146. package/dist/chunks/preferences-4VETUGMN.js +0 -3
  147. package/dist/chunks/preset-command-HORY7KZQ.js +0 -3
  148. package/dist/chunks/run-6BK4REXK.js +0 -4
  149. package/dist/chunks/transcribe-command-YUSBCQEQ.js +0 -3
  150. package/dist/chunks/update-note-RQG2RZNR.js +0 -3
  151. package/dist/chunks/watch-command-DUHMTXQL.js +0 -3
@@ -0,0 +1,525 @@
1
+ #!/usr/bin/env node
2
+ // forge-transcribe over whisper.cpp: the same protocol as forge-transcribe.swift
3
+ // (spec 2026-10-17-transcribe-design §4.1), backed by whisper.cpp and ffmpeg
4
+ // instead of Apple's recogniser. Forge runs it on Windows, on Linux, and on a
5
+ // Mac where Apple's recogniser is not there (Intel, or before macOS 26). Every
6
+ // line on stdout is one JSON object: progress events while it works, then one
7
+ // result.
8
+ //
9
+ // forge-transcribe-whisper.mjs status [--locale <id>]
10
+ // forge-transcribe-whisper.mjs probe <file>
11
+ // forge-transcribe-whisper.mjs run <file> [--locale <id>] [--notes [--detail ...]]
12
+ //
13
+ // Needs ffmpeg and whisper.cpp's `whisper-cli` (or `whisper-cpp`). Forge passes
14
+ // the ones it found as FORGE_FFMPEG and FORGE_WHISPER_CLI (the whisper
15
+ // extension's); without them they are looked for on PATH, and on a Mac in
16
+ // Homebrew's two prefixes as well. The speech model (ggml-base q5_1, multilingual)
17
+ // is downloaded once into the OS's cache folder, pinned by its sha256.
18
+ // Overrides: FORGE_WHISPER_CLI, FORGE_FFMPEG, FORGE_WHISPER_MODEL (a .bin path).
19
+ // Notes need Apple's on-device model, so they are reported as unsupported.
20
+ // No dependencies beyond Node; original Forge code, MIT.
21
+ import { spawn } from 'node:child_process'
22
+ import { createHash } from 'node:crypto'
23
+ import {
24
+ accessSync,
25
+ constants,
26
+ createWriteStream,
27
+ mkdirSync,
28
+ mkdtempSync,
29
+ readFileSync,
30
+ renameSync,
31
+ rmSync,
32
+ statSync,
33
+ } from 'node:fs'
34
+ import { availableParallelism, homedir, tmpdir } from 'node:os'
35
+ import { join, posix, win32 } from 'node:path'
36
+ import { pathToFileURL } from 'node:url'
37
+
38
+ // MARK: - Output
39
+
40
+ function emit(object) {
41
+ process.stdout.write(`${JSON.stringify(object)}\n`)
42
+ }
43
+
44
+ function fail(code, message) {
45
+ emit({ ok: false, code, message })
46
+ cleanup()
47
+ process.exit(1)
48
+ }
49
+
50
+ /**
51
+ * What to install, in this OS's words. Forge says the same (transcribeNeeds
52
+ * in src/engines/transcribe.ts); a test holds the two to one wording.
53
+ */
54
+ export function needs(platform = process.platform, missing = ['whisper']) {
55
+ const whisper = missing.includes('whisper') || !missing.includes('ffmpeg')
56
+ const ffmpeg = missing.includes('ffmpeg')
57
+ const parts = [
58
+ whisper && 'the whisper extension (forge extensions add whisper, or /extensions)',
59
+ ffmpeg &&
60
+ (platform === 'darwin'
61
+ ? 'ffmpeg (brew install ffmpeg)'
62
+ : platform === 'win32'
63
+ ? 'ffmpeg (winget install ffmpeg)'
64
+ : 'ffmpeg on your PATH'),
65
+ ].filter(Boolean)
66
+ if (platform === 'darwin') return `Transcribe on this Mac needs ${parts.join(' and ')}.`
67
+ if (platform === 'win32') return `Transcribe on Windows needs ${parts.join(' and ')}.`
68
+ if (platform === 'linux') return `Transcribe on Linux needs ${parts.join(' and ')}.`
69
+ return 'Transcribe needs macOS, Windows or Linux.'
70
+ }
71
+
72
+ // MARK: - Arguments
73
+
74
+ export function parseArgs(argv) {
75
+ const rest = [...argv]
76
+ const args = { command: rest.shift() ?? '', file: undefined, locale: undefined, notes: false }
77
+ while (rest.length > 0) {
78
+ const a = rest.shift()
79
+ if (a === '--locale') args.locale = rest.shift()
80
+ else if (a === '--notes') args.notes = true
81
+ else if (a === '--detail') rest.shift()
82
+ else if (args.file === undefined) args.file = a
83
+ }
84
+ return args
85
+ }
86
+
87
+ // MARK: - Tools
88
+
89
+ /** An environment variable; on Windows names are case-blind (`Path`, `PATH`). */
90
+ function envValue(env, name, platform) {
91
+ if (platform !== 'win32') return env[name]
92
+ const key = Object.keys(env).find((k) => k.toUpperCase() === name)
93
+ return key === undefined ? undefined : env[key]
94
+ }
95
+
96
+ /** Windows has no exec bit (access X_OK only says the file is there), so a file is enough there. */
97
+ function runnable(path, platform) {
98
+ try {
99
+ if (platform !== 'win32') accessSync(path, constants.X_OK)
100
+ return statSync(path).isFile()
101
+ } catch {
102
+ return false
103
+ }
104
+ }
105
+
106
+ /**
107
+ * The endings Windows runs a bare name with, from PATHEXT. Of those only .exe
108
+ * and .com start without a shell (spawn refuses .bat and .cmd), so only they count.
109
+ */
110
+ function windowsEndings(env) {
111
+ const listed = (envValue(env, 'PATHEXT', 'win32') ?? '.COM;.EXE')
112
+ .split(';')
113
+ .map((e) => e.trim().toLowerCase())
114
+ .filter((e) => e === '.exe' || e === '.com')
115
+ return listed.length > 0 ? [...new Set(listed)] : ['.exe']
116
+ }
117
+
118
+ /**
119
+ * The first of `names` on PATH (then Homebrew's prefixes on a Mac, which a
120
+ * shell started from Finder may leave off PATH), or the override when it is
121
+ * set (and runnable).
122
+ */
123
+ export function findTool(override, names, env = process.env, platform = process.platform) {
124
+ const pinned = envValue(env, override, platform)
125
+ if (pinned) return runnable(pinned, platform) ? pinned : undefined
126
+ const dirs = (envValue(env, 'PATH', platform) ?? '')
127
+ .split(platform === 'win32' ? ';' : ':')
128
+ .filter(Boolean)
129
+ if (platform === 'darwin') dirs.push('/opt/homebrew/bin', '/usr/local/bin')
130
+ const endings = platform === 'win32' ? windowsEndings(env) : ['']
131
+ for (const dir of dirs) {
132
+ for (const name of names) {
133
+ for (const ending of endings) {
134
+ const path = join(dir, name + ending)
135
+ if (runnable(path, platform)) return path
136
+ }
137
+ }
138
+ }
139
+ return undefined
140
+ }
141
+
142
+ // Homebrew's whisper-cpp formula installs whisper-cli; older builds called it whisper-cpp.
143
+ const whisperCli = () => findTool('FORGE_WHISPER_CLI', ['whisper-cli', 'whisper-cpp'])
144
+ const ffmpeg = () => findTool('FORGE_FFMPEG', ['ffmpeg'])
145
+
146
+ /** What is not there, by the names `needs` takes. */
147
+ function missingTools() {
148
+ return [!whisperCli() && 'whisper', !ffmpeg() && 'ffmpeg'].filter(Boolean)
149
+ }
150
+
151
+ // MARK: - Languages
152
+
153
+ /** The languages whisper's multilingual models know, by ISO 639-1 code (whisper.cpp's g_lang). */
154
+ const LANGS = new Set(
155
+ (
156
+ 'en zh de es ru ko fr ja pt tr pl ca nl ar sv it id hi fi vi he uk el ms cs ro da hu ta no ' +
157
+ 'th ur hr bg lt la mi ml cy sk te fa lv bn sr az sl kn et mk br eu is hy ne mn bs kk sq sw ' +
158
+ 'gl mr pa si km sn yo so af oc ka be tg sd gu am yi lo uz fo ht ps tk nn mt sa lb my bo tl ' +
159
+ 'mg as tt haw ln ha ba jw su yue'
160
+ ).split(' '),
161
+ )
162
+
163
+ /**
164
+ * The system's language: the POSIX locale variables (en_US.UTF-8 -> en_US),
165
+ * else what the OS tells Node (Windows and a Mac's GUI set no LANG), else en.
166
+ */
167
+ export function systemLocale(
168
+ env = process.env,
169
+ fallback = Intl.DateTimeFormat().resolvedOptions().locale,
170
+ ) {
171
+ const raw = env.LC_ALL || env.LC_MESSAGES || env.LANG || ''
172
+ const id = raw.split('.')[0].split('@')[0]
173
+ if (id === 'C' || id === 'POSIX') return 'en'
174
+ if (id !== '') return id
175
+ const os = String(fallback ?? '').replace(/-/g, '_')
176
+ return os === '' || os === 'und' ? 'en' : os
177
+ }
178
+
179
+ /** `en-US`/`en_US` -> { id: 'en_US', lang: 'en' }, or undefined when whisper has no model for it. */
180
+ export function resolveLocale(wanted) {
181
+ const id = String(wanted).replace(/-/g, '_')
182
+ const lang = id.split('_')[0].toLowerCase()
183
+ return LANGS.has(lang) ? { id, lang } : undefined
184
+ }
185
+
186
+ // MARK: - Sound
187
+
188
+ const scratch = []
189
+ function cleanup() {
190
+ // Retries: on Windows a file stays locked for a moment after its process is killed.
191
+ for (const dir of scratch.splice(0))
192
+ rmSync(dir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 })
193
+ }
194
+
195
+ /** Run a tool to the end; resolves with its exit code and output. */
196
+ function run(cmd, argv, { onStdoutLine } = {}) {
197
+ return new Promise((resolve) => {
198
+ const child = spawn(cmd, argv, { stdio: ['ignore', 'pipe', 'pipe'], windowsHide: true })
199
+ children.add(child)
200
+ let stdout = ''
201
+ let stderr = ''
202
+ let pending = ''
203
+ child.stdout.on('data', (chunk) => {
204
+ const text = chunk.toString()
205
+ stdout += text
206
+ if (!onStdoutLine) return
207
+ pending += text
208
+ const lines = pending.split('\n')
209
+ pending = lines.pop() ?? ''
210
+ for (const line of lines) onStdoutLine(line)
211
+ })
212
+ child.stderr.on('data', (chunk) => {
213
+ stderr += chunk.toString()
214
+ })
215
+ child.on('error', (e) => {
216
+ children.delete(child)
217
+ resolve({ code: -1, signal: null, stdout, stderr: stderr + e.message })
218
+ })
219
+ child.on('close', (code, signal) => {
220
+ children.delete(child)
221
+ resolve({ code: code ?? -1, signal, stdout, stderr })
222
+ })
223
+ })
224
+ }
225
+
226
+ const children = new Set()
227
+
228
+ /** What ffmpeg says the file holds: whether it has sound, and its length when it knows it. */
229
+ async function inspect(path) {
230
+ const r = await run(ffmpeg(), ['-hide_banner', '-nostdin', '-i', path])
231
+ const readable = /^\s*Input #0/m.test(r.stderr)
232
+ const sound = /Stream #\d+:\d+.*: Audio:/.test(r.stderr)
233
+ const d = r.stderr.match(/Duration: (\d+):(\d{2}):(\d{2}(?:\.\d+)?)/)
234
+ const seconds = d ? Number(d[1]) * 3600 + Number(d[2]) * 60 + Number(d[3]) : undefined
235
+ return { readable, sound, seconds }
236
+ }
237
+
238
+ /** The length of a 16-bit mono 16 kHz wav, from its data chunk. */
239
+ export function wavSeconds(buffer) {
240
+ let at = 12
241
+ while (at + 8 <= buffer.length) {
242
+ const id = buffer.toString('ascii', at, at + 4)
243
+ const size = buffer.readUInt32LE(at + 4)
244
+ if (id === 'data') return Math.min(size, buffer.length - at - 8) / 32000
245
+ at += 8 + size + (size % 2)
246
+ }
247
+ return 0
248
+ }
249
+
250
+ /** Decode to the 16 kHz mono wav whisper wants; refuses files with no sound. */
251
+ async function decode(path) {
252
+ const facts = await inspect(path)
253
+ if (!facts.readable) fail('unreadable', 'ffmpeg cannot read this file.')
254
+ if (!facts.sound) fail('no-sound', 'This file has no sound.')
255
+ const dir = mkdtempSync(join(tmpdir(), 'forge-whisper-'))
256
+ scratch.push(dir)
257
+ const wav = join(dir, 'sound.wav')
258
+ const r = await run(ffmpeg(), [
259
+ '-hide_banner',
260
+ '-nostdin',
261
+ '-loglevel',
262
+ 'error',
263
+ '-i',
264
+ path,
265
+ '-vn',
266
+ '-ac',
267
+ '1',
268
+ '-ar',
269
+ '16000',
270
+ '-c:a',
271
+ 'pcm_s16le',
272
+ '-f',
273
+ 'wav',
274
+ wav,
275
+ ])
276
+ if (r.code !== 0) fail('unreadable', 'ffmpeg could not decode the sound.')
277
+ const seconds = wavSeconds(readFileSync(wav))
278
+ if (seconds <= 0) fail('no-sound', 'This file has no sound.')
279
+ return { dir, wav, seconds }
280
+ }
281
+
282
+ // MARK: - Model
283
+
284
+ /**
285
+ * ggml-base (multilingual), compressed to 5 bits (q5_1) as whisper.cpp
286
+ * publishes it: 60 MB against the full model's 148, under Forge's 100 MB
287
+ * ceiling for a model. The whisper extension carries this same file as
288
+ * model.bin (FORGE_WHISPER_MODEL); it is downloaded here only for a
289
+ * whisper-cli of the user's own.
290
+ */
291
+ export const MODEL = {
292
+ name: 'ggml-base-q5_1.bin',
293
+ url: 'https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-base-q5_1.bin',
294
+ sha256: '422f1ae452ade6f30a004d7e5c6a43195e4433bc370bf23fac9cc591f01a8898',
295
+ }
296
+
297
+ /** Where the model is kept: each OS's own folder for caches. */
298
+ export function cacheDir(env = process.env, platform = process.platform, home = homedir()) {
299
+ if (platform === 'win32') {
300
+ const local = envValue(env, 'LOCALAPPDATA', platform) || win32.join(home, 'AppData', 'Local')
301
+ return win32.join(local, 'forge', 'whisper')
302
+ }
303
+ if (platform === 'darwin') return posix.join(home, 'Library', 'Caches', 'forge', 'whisper')
304
+ return posix.join(env.XDG_CACHE_HOME || posix.join(home, '.cache'), 'forge', 'whisper')
305
+ }
306
+
307
+ async function model() {
308
+ const pinned = process.env.FORGE_WHISPER_MODEL
309
+ if (pinned) {
310
+ try {
311
+ if (statSync(pinned).isFile()) return pinned
312
+ } catch {}
313
+ fail('model', `FORGE_WHISPER_MODEL points at nothing: ${pinned}`)
314
+ }
315
+ const dir = cacheDir()
316
+ const path = join(dir, MODEL.name)
317
+ try {
318
+ if (statSync(path).isFile()) return path
319
+ } catch {}
320
+ mkdirSync(dir, { recursive: true })
321
+ const part = `${path}.part`
322
+ try {
323
+ const res = await fetch(MODEL.url)
324
+ if (!res.ok || !res.body) throw new Error(`HTTP ${res.status}`)
325
+ const total = Number(res.headers.get('content-length')) || 0
326
+ const hash = createHash('sha256')
327
+ const out = createWriteStream(part)
328
+ let done = 0
329
+ let shown = -1
330
+ for await (const chunk of res.body) {
331
+ hash.update(chunk)
332
+ if (!out.write(chunk)) await new Promise((r) => out.once('drain', r))
333
+ done += chunk.length
334
+ const fraction = total > 0 ? Math.min(done / total, 1) : 0
335
+ if (Math.floor(fraction * 100) !== shown) {
336
+ shown = Math.floor(fraction * 100)
337
+ emit({ event: 'model', fraction })
338
+ }
339
+ }
340
+ await new Promise((resolve, reject) => out.end((e) => (e ? reject(e) : resolve())))
341
+ if (hash.digest('hex') !== MODEL.sha256) throw new Error('checksum mismatch')
342
+ renameSync(part, path)
343
+ return path
344
+ } catch {
345
+ rmSync(part, { force: true })
346
+ fail('model', 'The speech model could not be downloaded.')
347
+ }
348
+ }
349
+
350
+ // MARK: - Speech
351
+
352
+ /** `[00:01:02.340 --> 00:01:05.000] text` -> the end, in seconds. */
353
+ export function heardUntil(line) {
354
+ const m = line.match(/-->\s*(\d+):(\d{2}):(\d{2}(?:\.\d+)?)\]/)
355
+ return m ? Number(m[1]) * 3600 + Number(m[2]) * 60 + Number(m[3]) : undefined
356
+ }
357
+
358
+ /** whisper's markers for no speech, e.g. [BLANK_AUDIO], [Music], (applause). */
359
+ const MARKER = /^\s*(\[[^\]]*\]|\([^)]*\))\s*$/
360
+
361
+ /** whisper-cli's --output-json -> Forge's segments. */
362
+ export function segmentsOf(json) {
363
+ const out = []
364
+ for (const s of json.transcription ?? []) {
365
+ const text = String(s.text ?? '').trim()
366
+ if (text === '' || MARKER.test(text)) continue
367
+ out.push({
368
+ start: Number(s.offsets?.from ?? 0) / 1000,
369
+ end: Number(s.offsets?.to ?? 0) / 1000,
370
+ text,
371
+ })
372
+ }
373
+ return out
374
+ }
375
+
376
+ async function transcribe(wav, dir, lang, seconds) {
377
+ const modelPath = await model()
378
+ const base = join(dir, 'transcript')
379
+ const threads = String(Math.max(1, Math.min(availableParallelism(), 8)))
380
+ const r = await run(
381
+ whisperCli(),
382
+ ['-m', modelPath, '-f', wav, '-l', lang, '-t', threads, '-oj', '-of', base],
383
+ {
384
+ onStdoutLine: (line) => {
385
+ const end = heardUntil(line)
386
+ if (end !== undefined)
387
+ emit({ event: 'heard', seconds: Math.min(end, seconds), of: seconds })
388
+ },
389
+ },
390
+ )
391
+ const why = startFailure(r.code, r.signal)
392
+ if (why) fail('runtime', why)
393
+ if (r.code !== 0) fail('speech', `Transcription failed: whisper-cli exited ${r.code}`)
394
+ let json
395
+ try {
396
+ json = JSON.parse(readFileSync(`${base}.json`, 'utf8'))
397
+ } catch {
398
+ fail('speech', 'Transcription failed: whisper-cli wrote no transcript')
399
+ }
400
+ return { segments: segmentsOf(json), language: json.result?.language }
401
+ }
402
+
403
+ // MARK: - Main
404
+
405
+ /** STATUS_DLL_NOT_FOUND: Windows could not start whisper-cli.exe for a missing DLL. */
406
+ const DLL_NOT_FOUND = [0xc0000135, 0xc0000135 - 2 ** 32]
407
+
408
+ /**
409
+ * Why whisper-cli could not run here, in words, or undefined when it simply
410
+ * failed: on Windows a missing Visual C++ runtime; anywhere, a processor
411
+ * without the instructions it was built for (the extension's x64 Linux build
412
+ * needs AVX2).
413
+ */
414
+ export function startFailure(code, signal, platform = process.platform, arch = process.arch) {
415
+ if (signal === 'SIGILL')
416
+ return "whisper-cli stopped: this processor lacks instructions it was built for. Use your system's whisper-cli (set FORGE_WHISPER_CLI)."
417
+ if (platform !== 'win32' || !DLL_NOT_FOUND.includes(code)) return undefined
418
+ return `whisper-cli could not start: it needs the Microsoft Visual C++ Redistributable (https://aka.ms/vs/17/release/vc_redist.${arch === 'arm64' ? 'arm64' : 'x64'}.exe).`
419
+ }
420
+
421
+ /** Take ffmpeg and whisper-cli down, wait briefly for them to go, then the scratch files, then this. */
422
+ let stopping = false
423
+ async function stop() {
424
+ // Asked once by stdin closing, maybe again by the parent check while it waits.
425
+ if (stopping) return
426
+ stopping = true
427
+ const left = [...children]
428
+ for (const child of left) child.kill()
429
+ await Promise.race([
430
+ Promise.all(
431
+ left.map(
432
+ (c) =>
433
+ new Promise((r) =>
434
+ c.exitCode !== null || c.signalCode !== null ? r() : c.once('close', r),
435
+ ),
436
+ ),
437
+ ),
438
+ new Promise((r) => setTimeout(r, 2000)),
439
+ ])
440
+ cleanup()
441
+ process.exit(1)
442
+ }
443
+
444
+ /**
445
+ * How Forge stops a run. With FORGE_HELPER_STOP_ON_EOF=1 it closes this
446
+ * helper's stdin, which also happens by itself when Forge goes away: a signal
447
+ * could not do this on Windows, where every kill is TerminateProcess and would
448
+ * leave whisper-cli running on. Without it (run by hand), a Forge that dies is
449
+ * noticed by this helper being handed to another parent (POSIX).
450
+ */
451
+ function watchForStop() {
452
+ if (process.env.FORGE_HELPER_STOP_ON_EOF === '1') {
453
+ process.stdin.on('end', stop)
454
+ process.stdin.on('error', stop)
455
+ process.stdin.resume()
456
+ }
457
+ const parent = process.ppid
458
+ const timer = setInterval(() => {
459
+ if (process.ppid !== parent) stop()
460
+ }, 500)
461
+ timer.unref()
462
+ }
463
+
464
+ async function main(argv) {
465
+ const args = parseArgs(argv)
466
+ switch (args.command) {
467
+ case 'status': {
468
+ const locale = resolveLocale(args.locale ?? systemLocale())
469
+ const missing = missingTools()
470
+ emit({
471
+ ok: true,
472
+ speech: missing.length === 0,
473
+ locale: locale?.id ?? null,
474
+ notes: 'unsupported',
475
+ missing,
476
+ })
477
+ return
478
+ }
479
+ case 'probe': {
480
+ if (!args.file) fail('usage', 'probe needs a file')
481
+ if (!ffmpeg()) fail('unsupported', needs(process.platform, missingTools()))
482
+ const facts = await inspect(args.file)
483
+ if (!facts.readable) fail('unreadable', 'ffmpeg cannot read this file.')
484
+ if (!facts.sound) fail('no-sound', 'This file has no sound.')
485
+ const seconds = facts.seconds ?? (await decode(args.file)).seconds
486
+ emit({ ok: true, seconds, sound: true })
487
+ return
488
+ }
489
+ case 'run': {
490
+ if (!args.file) fail('usage', 'run needs a file')
491
+ const missing = missingTools()
492
+ if (missing.length > 0) fail('unsupported', needs(process.platform, missing))
493
+ // No --locale: whisper hears which language it is, as the Mac's own language would be used there.
494
+ const locale = args.locale === undefined ? undefined : resolveLocale(args.locale)
495
+ if (args.locale !== undefined && locale === undefined)
496
+ fail('locale', `whisper.cpp does not support ${args.locale}.`)
497
+ watchForStop()
498
+ const { dir, wav, seconds } = await decode(args.file)
499
+ const { segments, language } = await transcribe(wav, dir, locale?.lang ?? 'auto', seconds)
500
+ emit({
501
+ ok: true,
502
+ locale: locale?.id ?? language ?? systemLocale(),
503
+ seconds,
504
+ segments,
505
+ })
506
+ return
507
+ }
508
+ default:
509
+ fail('usage', 'usage: forge-transcribe status|probe|run')
510
+ }
511
+ }
512
+
513
+ // Run only as the helper, not when a test imports it.
514
+ if (
515
+ (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) ||
516
+ process.argv[1]?.endsWith('forge-transcribe-whisper.mjs')
517
+ ) {
518
+ main(process.argv.slice(2))
519
+ .then(() => {
520
+ cleanup()
521
+ // A watched stdin would keep this process alive after its answer.
522
+ process.stdin.destroy()
523
+ })
524
+ .catch((e) => fail('speech', `Transcription failed: ${e?.message ?? e}`))
525
+ }
package/dist/index.js CHANGED
@@ -1,24 +1,24 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __forgeCreateRequire } from 'node:module';
3
3
  const require = __forgeCreateRequire(import.meta.url);
4
- import{b as w,d as C}from"./chunks/chunk-IBPGC4N2.js";import{f as x}from"./chunks/chunk-EHARO6IS.js";import"./chunks/chunk-PSEIJXGT.js";import{c as b,d as S}from"./chunks/chunk-5SMYDPVX.js";import"./chunks/chunk-U5TEGDGH.js";import"./chunks/chunk-QVACE4IE.js";import"./chunks/chunk-HZDYZ5RD.js";import"./chunks/chunk-QR6QHTC3.js";import"./chunks/chunk-6L6C3GJU.js";import"./chunks/chunk-EEQSUBBL.js";import"./chunks/chunk-YYB3TTGT.js";import"./chunks/chunk-KAHWYWNT.js";import"./chunks/chunk-SMBK6BTC.js";import"./chunks/chunk-EXLXSKRH.js";import{F as $,d as f,ma as E,na as m}from"./chunks/chunk-3UEQ2OX6.js";import"./chunks/chunk-J7FLFHQJ.js";import"./chunks/chunk-LDKF7KIZ.js";import{a as c}from"./chunks/chunk-I2IATJNL.js";import"./chunks/chunk-AAXBN572.js";import"./chunks/chunk-HON4OV7M.js";import"./chunks/chunk-M66BUNYO.js";import"./chunks/chunk-TMUK2DD3.js";import*as F from"node:module";function v(e){return f(e)?e:E(e)}function k(e,n){return m(v(e),{debug:n})}function T(e,n){process.once("beforeExit",()=>{e()||(n(new Error("Forge stopped before it finished: it was waiting for input that never came.")),process.exitCode=1)})}F.enableCompileCache?.();function B({completed:e,total:n}){e===0?process.stderr.write(`Converting ${n} files
4
+ import{e as x,f as S}from"./chunks/chunk-F34DPQFQ.js";import{b as w,d as C}from"./chunks/chunk-IBPGC4N2.js";import"./chunks/chunk-U5TEGDGH.js";import"./chunks/chunk-QVACE4IE.js";import"./chunks/chunk-HZDYZ5RD.js";import"./chunks/chunk-JMBEZPYC.js";import"./chunks/chunk-Y7LOIHFU.js";import{f as b}from"./chunks/chunk-57M4J2BR.js";import"./chunks/chunk-63XCSYHM.js";import"./chunks/chunk-PPR7B5AR.js";import{a as c}from"./chunks/chunk-XBOMWF34.js";import"./chunks/chunk-V3I6DSF4.js";import"./chunks/chunk-EEQSUBBL.js";import"./chunks/chunk-K7KKCR7V.js";import"./chunks/chunk-LVYQVJOF.js";import"./chunks/chunk-N6RCLJE6.js";import"./chunks/chunk-WE6KP4FR.js";import"./chunks/chunk-KH5DHZ2U.js";import"./chunks/chunk-HON4OV7M.js";import"./chunks/chunk-SNDFMJIX.js";import"./chunks/chunk-THDAQBQ3.js";import"./chunks/chunk-DZOBIUV6.js";import"./chunks/chunk-TL5MACSF.js";import{H as $,d as f,va as E,wa as m}from"./chunks/chunk-WIPP5TWQ.js";import"./chunks/chunk-J7FLFHQJ.js";import"./chunks/chunk-H3DIRJFE.js";import"./chunks/chunk-KXKQDFHX.js";import"./chunks/chunk-TMUK2DD3.js";import*as F from"node:module";function v(e){return f(e)?e:E(e)}function k(e,n){return m(v(e),{debug:n})}function T(e,n){process.once("beforeExit",()=>{e()||(n(new Error("Forge stopped before it finished: it was waiting for input that never came.")),process.exitCode=1)})}F.enableCompileCache?.();function B({completed:e,total:n}){e===0?process.stderr.write(`Converting ${n} files
5
5
  `):process.stderr.write(` ${e}/${n}
6
- `)}async function I(){let e=process.argv.slice(2),n=e.includes("--debug"),p=b(e);try{if(e[0]==="__update-check"){let{checkNow:r}=await import("./chunks/check-KAR72Y4X.js");await r();return}if(e[0]==="menu"){let{openedFor:r,parseMenuArgs:t}=await import("./chunks/command-I5M275ZV.js"),s=t(e.slice(1));if(s.kind==="open"){let{applyColourPreference:h}=await import("./chunks/theme-Z6X54JY4.js");h();let{bootShell:A}=await import("./chunks/boot-FOKV7OHT.js");await A(void 0,{opened:r(s.action,s.paths)});return}let{runMenuCommand:a}=await import("./chunks/entry-3PEVSH2X.js");process.exitCode=await a(s,c);return}if(e[0]==="mcp"){let{runMcpServer:r}=await import("./chunks/server-7PMVIYWQ.js");await r(e.slice(1));return}let o=S(e);if(o.kind==="shell"){if(p)throw $("No files given.","Name a file, for example: forge photo.jpg --to webp --json");if(!process.stdout.isTTY||!process.stdin.isTTY){process.stderr.write(`Forge needs a file and a target format.
6
+ `)}async function I(){let e=process.argv.slice(2),n=e.includes("--debug"),p=x(e);try{if(e[0]==="__update-check"){let{checkNow:r}=await import("./chunks/check-B6NP7BEM.js");await r();return}if(e[0]==="menu"){let{openedFor:r,parseMenuArgs:t}=await import("./chunks/command-GYCYLUHN.js"),s=t(e.slice(1));if(s.kind==="open"){let{applyColourPreference:h}=await import("./chunks/theme-NAWQ77WF.js");h();let{bootShell:A}=await import("./chunks/boot-MGR26CBU.js");await A(void 0,{opened:r(s.action,s.paths)});return}let{runMenuCommand:a}=await import("./chunks/entry-TSLQHDP7.js");process.exitCode=await a(s,c);return}if(e[0]==="mcp"){let{runMcpServer:r}=await import("./chunks/server-KKF3XBQG.js");await r(e.slice(1));return}let o=S(e);if(o.kind==="shell"){if(p)throw $("No files given.","Name a file, for example: forge photo.jpg --to webp --json");if(!process.stdout.isTTY||!process.stdin.isTTY){process.stderr.write(`Forge needs a file and a target format.
7
7
  Try: forge photo.jpg --to webp
8
- `),process.exitCode=2;return}let{applyColourPreference:r}=await import("./chunks/theme-Z6X54JY4.js");r();let{bootShell:t}=await import("./chunks/boot-FOKV7OHT.js");await t(void 0,{menuNote:async()=>(await import("./chunks/entry-3PEVSH2X.js")).menuAtStart(c)});return}if(o.kind==="watch"){let{runWatch:r}=await import("./chunks/watch-command-DUHMTXQL.js"),t=new AbortController;process.once("SIGINT",()=>t.abort()),process.exitCode=await r(o,{out:s=>process.stdout.write(`${s}
9
- `),json:p,signal:t.signal});return}if(o.kind==="uninstall"){let{runUninstall:r}=await import("./chunks/entry-3PEVSH2X.js");process.exitCode=await r(c,t=>process.stdout.write(`${t}
10
- `));return}let{execute:l}=await import("./chunks/execute-WQJ37VKD.js"),i,y=0,P=(r,t)=>{let s=Date.now();if(r<t&&s-y<100)return;y=s;let a=h=>(h/1e6).toFixed(1);process.stderr.write(`\r downloading ${a(r)} / ${a(t)} MB${r>=t?`
8
+ `),process.exitCode=2;return}let{applyColourPreference:r}=await import("./chunks/theme-NAWQ77WF.js");r();let{bootShell:t}=await import("./chunks/boot-MGR26CBU.js");await t(void 0,{menuNote:async()=>(await import("./chunks/entry-TSLQHDP7.js")).menuAtStart(c)});return}if(o.kind==="watch"){let{runWatch:r}=await import("./chunks/watch-command-XCCMIQIM.js"),t=new AbortController;process.once("SIGINT",()=>t.abort()),process.exitCode=await r(o,{out:s=>process.stdout.write(`${s}
9
+ `),json:p,signal:t.signal});return}if(o.kind==="uninstall"){let{runUninstall:r}=await import("./chunks/entry-TSLQHDP7.js");process.exitCode=await r(c,t=>process.stdout.write(`${t}
10
+ `));return}let{execute:l}=await import("./chunks/execute-S5WN34PS.js"),i,y=0,P=(r,t)=>{let s=Date.now();if(r<t&&s-y<100)return;y=s;let a=h=>(h/1e6).toFixed(1);process.stderr.write(`\r downloading ${a(r)} / ${a(t)} MB${r>=t?`
11
11
  `:""}`)},d=!!process.stderr.isTTY&&!p,g=new AbortController;o.kind==="extension-op"&&process.once("SIGINT",()=>g.abort());let u=await l(o,{json:p,...d?{onInstalling:r=>{i=w(process.stderr,`installing Forge ${r}`)}}:{},signal:g.signal,...d?{onDownload:P}:{},colour:!!process.stdout.isTTY&&!p&&C(),onProgress:d?r=>{r.completed>0&&i?.stop(),B(r)}:void 0,...d?{onSearch:r=>{i??=w(process.stderr,"finding the smallest that fits"),i.update(r)},onEncode:r=>{i??=w(process.stderr,"encoding"),i.update(r)}}:{}});if(i?.stop(),u.stdout.length>0&&process.stdout.write(`${u.stdout.join(`
12
12
  `)}
13
13
  `),u.stderr.length>0&&process.stderr.write(`${u.stderr.join(`
14
14
  `)}
15
- `),process.exitCode=g.signal.aborted?130:u.exitCode,d&&process.stdout.isTTY&&o.kind!=="update")try{let{afterCommand:r,spawnRefresh:t}=await import("./chunks/update-note-RQG2RZNR.js"),{runningScript:s}=await import("./chunks/install-V62EEK54.js"),a=await r(c,{refresh:()=>t(s(process.argv[1])),colour:C()});a.length>0&&process.stderr.write(`
15
+ `),process.exitCode=g.signal.aborted?130:u.exitCode,d&&process.stdout.isTTY&&o.kind!=="update")try{let{afterCommand:r,spawnRefresh:t}=await import("./chunks/update-note-FRMHMUMD.js"),{runningScript:s}=await import("./chunks/install-L5C2UT6M.js"),a=await r(c,{refresh:()=>t(s(process.argv[1])),colour:C()});a.length>0&&process.stderr.write(`
16
16
  ${a.join(`
17
17
  `)}
18
- `)}catch{}}catch(o){if(f(o)){p?process.stdout.write(`${JSON.stringify(x(c,o))}
18
+ `)}catch{}}catch(o){if(f(o)){p?process.stdout.write(`${JSON.stringify(b(c,o))}
19
19
  `):process.stderr.write(`${m(o,{debug:n}).join(`
20
20
  `)}
21
- `),process.exitCode=2;return}if(o instanceof Error&&"code"in o&&"exitCode"in o){let l=o.code;process.exitCode=l==="commander.helpDisplayed"||l==="commander.version"?0:2;return}throw o}}function j(e){let n=process.argv.slice(2);if(b(n)){process.stdout.write(`${JSON.stringify(x(c,v(e)))}
21
+ `),process.exitCode=2;return}if(o instanceof Error&&"code"in o&&"exitCode"in o){let l=o.code;process.exitCode=l==="commander.helpDisplayed"||l==="commander.version"?0:2;return}throw o}}function j(e){let n=process.argv.slice(2);if(x(n)){process.stdout.write(`${JSON.stringify(b(c,v(e)))}
22
22
  `);return}process.stderr.write(`${k(e,n.includes("--debug")).join(`
23
23
  `)}
24
24
  `)}var N=!1;T(()=>N,j);try{await I()}catch(e){j(e),process.exitCode=1}finally{N=!0}export{c as VERSION};
@@ -2854,3 +2854,101 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2854
2854
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2855
2855
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2856
2856
  SOFTWARE.
2857
+
2858
+ ------------------------------------------------------------------------
2859
+
2860
+ Noto Sans (fonts/NotoSans-*.ttf.gz) — OFL-1.1
2861
+
2862
+ Copyright 2022 The Noto Project Authors (https://github.com/notofonts/latin-greek-cyrillic)
2863
+
2864
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
2865
+ This license is copied below, and is also available with a FAQ at:
2866
+ https://scripts.sil.org/OFL
2867
+
2868
+
2869
+ -----------------------------------------------------------
2870
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
2871
+ -----------------------------------------------------------
2872
+
2873
+ PREAMBLE
2874
+ The goals of the Open Font License (OFL) are to stimulate worldwide
2875
+ development of collaborative font projects, to support the font creation
2876
+ efforts of academic and linguistic communities, and to provide a free and
2877
+ open framework in which fonts may be shared and improved in partnership
2878
+ with others.
2879
+
2880
+ The OFL allows the licensed fonts to be used, studied, modified and
2881
+ redistributed freely as long as they are not sold by themselves. The
2882
+ fonts, including any derivative works, can be bundled, embedded,
2883
+ redistributed and/or sold with any software provided that any reserved
2884
+ names are not used by derivative works. The fonts and derivatives,
2885
+ however, cannot be released under any other type of license. The
2886
+ requirement for fonts to remain under this license does not apply
2887
+ to any document created using the fonts or their derivatives.
2888
+
2889
+ DEFINITIONS
2890
+ "Font Software" refers to the set of files released by the Copyright
2891
+ Holder(s) under this license and clearly marked as such. This may
2892
+ include source files, build scripts and documentation.
2893
+
2894
+ "Reserved Font Name" refers to any names specified as such after the
2895
+ copyright statement(s).
2896
+
2897
+ "Original Version" refers to the collection of Font Software components as
2898
+ distributed by the Copyright Holder(s).
2899
+
2900
+ "Modified Version" refers to any derivative made by adding to, deleting,
2901
+ or substituting -- in part or in whole -- any of the components of the
2902
+ Original Version, by changing formats or by porting the Font Software to a
2903
+ new environment.
2904
+
2905
+ "Author" refers to any designer, engineer, programmer, technical
2906
+ writer or other person who contributed to the Font Software.
2907
+
2908
+ PERMISSION & CONDITIONS
2909
+ Permission is hereby granted, free of charge, to any person obtaining
2910
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
2911
+ redistribute, and sell modified and unmodified copies of the Font
2912
+ Software, subject to the following conditions:
2913
+
2914
+ 1) Neither the Font Software nor any of its individual components,
2915
+ in Original or Modified Versions, may be sold by itself.
2916
+
2917
+ 2) Original or Modified Versions of the Font Software may be bundled,
2918
+ redistributed and/or sold with any software, provided that each copy
2919
+ contains the above copyright notice and this license. These can be
2920
+ included either as stand-alone text files, human-readable headers or
2921
+ in the appropriate machine-readable metadata fields within text or
2922
+ binary files as long as those fields can be easily viewed by the user.
2923
+
2924
+ 3) No Modified Version of the Font Software may use the Reserved Font
2925
+ Name(s) unless explicit written permission is granted by the corresponding
2926
+ Copyright Holder. This restriction only applies to the primary font name as
2927
+ presented to the users.
2928
+
2929
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
2930
+ Software shall not be used to promote, endorse or advertise any
2931
+ Modified Version, except to acknowledge the contribution(s) of the
2932
+ Copyright Holder(s) and the Author(s) or with their explicit written
2933
+ permission.
2934
+
2935
+ 5) The Font Software, modified or unmodified, in part or in whole,
2936
+ must be distributed entirely under this license, and must not be
2937
+ distributed under any other license. The requirement for fonts to
2938
+ remain under this license does not apply to any document created
2939
+ using the Font Software.
2940
+
2941
+ TERMINATION
2942
+ This license becomes null and void if any of the above conditions are
2943
+ not met.
2944
+
2945
+ DISCLAIMER
2946
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
2947
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
2948
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
2949
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
2950
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
2951
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
2952
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2953
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
2954
+ OTHER DEALINGS IN THE FONT SOFTWARE.