@1presence/speech 1.1.0 → 1.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1presence/speech",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "Free speech-to-text for Mac — dictate into any app using your browser's built-in voice recognition, no subscription required",
5
5
  "type": "module",
6
6
  "bin": {
@@ -31,10 +31,6 @@
31
31
  ],
32
32
  "license": "MIT",
33
33
  "homepage": "https://1presence.com",
34
- "repository": {
35
- "type": "git",
36
- "url": "https://github.com/jonathankata/presence"
37
- },
38
34
  "publishConfig": {
39
35
  "access": "public"
40
36
  }
package/public/index.html CHANGED
@@ -192,8 +192,11 @@
192
192
 
193
193
  // Display keeps paragraph breaks; app/terminal delivery must be one line so
194
194
  // paste guards (iTerm) do not treat newlines as a multi-line paste.
195
+ // Do not trim — live chunks often start with a leading space from getStreamSeparator.
195
196
  function formatTextForAppSend(text) {
196
- return normalizeSpeechText(String(text || "").replace(/\n+/g, " "));
197
+ return String(text || "")
198
+ .replace(/\n+/g, " ")
199
+ .replace(/[^\S\n]+/g, " ");
197
200
  }
198
201
 
199
202
  function capitalizeFirstWord(text) {
package/server.mjs CHANGED
@@ -74,11 +74,22 @@ end run
74
74
  }
75
75
 
76
76
  function typeIntoFocusedApp(text, pressEnter) {
77
+ // System Events often drops literal spaces inside keystroke strings from Node.
78
+ // Type each character and use keystroke space for space characters.
77
79
  const script = `
78
80
  on run argv
81
+ set inputText to item 1 of argv
82
+ set pressEnter to item 2 of argv
79
83
  tell application "System Events"
80
- keystroke item 1 of argv
81
- if item 2 of argv is "true" then
84
+ repeat with i from 1 to count of characters of inputText
85
+ set ch to character i of inputText
86
+ if ch is " " then
87
+ keystroke space
88
+ else
89
+ keystroke ch
90
+ end if
91
+ end repeat
92
+ if pressEnter is "true" then
82
93
  key code 36
83
94
  end if
84
95
  end tell