@kolisachint/hoocode-agent 0.4.102 → 0.4.103

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.
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Drives the external `voicetools` binary and streams its stdout line protocol
3
+ * into callbacks. One line per event on stdout (stderr is free for debug logs):
4
+ *
5
+ * ```text
6
+ * STATUS recording # state transition (recording | transcribing | ...)
7
+ * SEGMENT hello world # a chunk of decoded text
8
+ * DONE # finished successfully
9
+ * ERROR no model found # fatal error; process exits non-zero
10
+ * ```
11
+ *
12
+ * The caller wires `onSegment` to inject text into the editor (via bracketed
13
+ * paste) and `onStatus` / `onError` to surface feedback.
14
+ */
15
+ export type VoiceStatus = "recording" | "transcribing" | "done" | string;
16
+ export interface VoiceTranscribeHandlers {
17
+ /** A decoded chunk of text. Injected into the editor by the caller. */
18
+ onSegment: (text: string) => void;
19
+ /** A state transition reported by the binary, or `"done"` on completion. */
20
+ onStatus: (status: VoiceStatus) => void;
21
+ /** A fatal error: spawn failure, protocol ERROR line, or non-zero exit. */
22
+ onError: (message: string) => void;
23
+ }
24
+ /**
25
+ * A running voice-transcribe session. Call `stop()` to cancel early (e.g. the
26
+ * user pressing the shortcut again). `stop()` is idempotent.
27
+ */
28
+ export interface VoiceSession {
29
+ stop(): void;
30
+ readonly running: boolean;
31
+ }
32
+ export declare function startVoiceTranscribe(bin: string, handlers: VoiceTranscribeHandlers): VoiceSession;
33
+ //# sourceMappingURL=voice-transcribe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voice-transcribe.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/voice-transcribe.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,cAAc,GAAG,MAAM,GAAG,MAAM,CAAC;AAEzE,MAAM,WAAW,uBAAuB;IACvC,uEAAuE;IACvE,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,4EAA4E;IAC5E,QAAQ,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IACxC,2EAA2E;IAC3E,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC5B,IAAI,IAAI,IAAI,CAAC;IACb,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC1B;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,uBAAuB,GAAG,YAAY,CAoEjG","sourcesContent":["import { createInterface, type Interface } from \"node:readline\";\nimport { type ChildProcess, spawn } from \"child_process\";\n\n/**\n * Drives the external `voicetools` binary and streams its stdout line protocol\n * into callbacks. One line per event on stdout (stderr is free for debug logs):\n *\n * ```text\n * STATUS recording # state transition (recording | transcribing | ...)\n * SEGMENT hello world # a chunk of decoded text\n * DONE # finished successfully\n * ERROR no model found # fatal error; process exits non-zero\n * ```\n *\n * The caller wires `onSegment` to inject text into the editor (via bracketed\n * paste) and `onStatus` / `onError` to surface feedback.\n */\n\nexport type VoiceStatus = \"recording\" | \"transcribing\" | \"done\" | string;\n\nexport interface VoiceTranscribeHandlers {\n\t/** A decoded chunk of text. Injected into the editor by the caller. */\n\tonSegment: (text: string) => void;\n\t/** A state transition reported by the binary, or `\"done\"` on completion. */\n\tonStatus: (status: VoiceStatus) => void;\n\t/** A fatal error: spawn failure, protocol ERROR line, or non-zero exit. */\n\tonError: (message: string) => void;\n}\n\n/**\n * A running voice-transcribe session. Call `stop()` to cancel early (e.g. the\n * user pressing the shortcut again). `stop()` is idempotent.\n */\nexport interface VoiceSession {\n\tstop(): void;\n\treadonly running: boolean;\n}\n\nexport function startVoiceTranscribe(bin: string, handlers: VoiceTranscribeHandlers): VoiceSession {\n\tlet proc: ChildProcess;\n\ttry {\n\t\tproc = spawn(bin, [\"transcribe\"], {\n\t\t\tstdio: [\"ignore\", \"pipe\", \"ignore\"],\n\t\t});\n\t} catch (err) {\n\t\thandlers.onError(err instanceof Error ? err.message : String(err));\n\t\treturn { stop: () => {}, running: false };\n\t}\n\n\tlet stopped = false;\n\tlet finished = false;\n\tlet rl: Interface | undefined;\n\n\tconst finish = (): void => {\n\t\tif (finished) return;\n\t\tfinished = true;\n\t\trl?.close();\n\t};\n\n\tif (!proc.stdout) {\n\t\tproc.kill();\n\t\thandlers.onError(\"failed to capture voicetools stdout\");\n\t\treturn { stop: () => {}, running: false };\n\t}\n\n\trl = createInterface({ input: proc.stdout });\n\trl.on(\"line\", (line) => {\n\t\tif (line.startsWith(\"STATUS \")) {\n\t\t\thandlers.onStatus(line.slice(7).trim());\n\t\t} else if (line.startsWith(\"SEGMENT \")) {\n\t\t\thandlers.onSegment(line.slice(8));\n\t\t} else if (line === \"DONE\") {\n\t\t\thandlers.onStatus(\"done\");\n\t\t\tfinish();\n\t\t} else if (line.startsWith(\"ERROR \")) {\n\t\t\thandlers.onError(line.slice(6).trim());\n\t\t\tfinish();\n\t\t}\n\t});\n\n\tproc.on(\"error\", (err) => {\n\t\tif (stopped || finished) return;\n\t\tfinish();\n\t\thandlers.onError(err.message);\n\t});\n\n\tproc.on(\"close\", (code) => {\n\t\tconst wasFinished = finished;\n\t\tfinish();\n\t\tif (stopped || wasFinished) return;\n\t\tif (code && code !== 0) {\n\t\t\thandlers.onError(`voicetools exited with code ${code}`);\n\t\t}\n\t});\n\n\treturn {\n\t\tstop: () => {\n\t\t\tif (stopped) return;\n\t\t\tstopped = true;\n\t\t\tfinish();\n\t\t\tproc.kill();\n\t\t},\n\t\tget running() {\n\t\t\treturn !finished && !stopped;\n\t\t},\n\t};\n}\n"]}
@@ -0,0 +1,73 @@
1
+ import { createInterface } from "node:readline";
2
+ import { spawn } from "child_process";
3
+ export function startVoiceTranscribe(bin, handlers) {
4
+ let proc;
5
+ try {
6
+ proc = spawn(bin, ["transcribe"], {
7
+ stdio: ["ignore", "pipe", "ignore"],
8
+ });
9
+ }
10
+ catch (err) {
11
+ handlers.onError(err instanceof Error ? err.message : String(err));
12
+ return { stop: () => { }, running: false };
13
+ }
14
+ let stopped = false;
15
+ let finished = false;
16
+ let rl;
17
+ const finish = () => {
18
+ if (finished)
19
+ return;
20
+ finished = true;
21
+ rl?.close();
22
+ };
23
+ if (!proc.stdout) {
24
+ proc.kill();
25
+ handlers.onError("failed to capture voicetools stdout");
26
+ return { stop: () => { }, running: false };
27
+ }
28
+ rl = createInterface({ input: proc.stdout });
29
+ rl.on("line", (line) => {
30
+ if (line.startsWith("STATUS ")) {
31
+ handlers.onStatus(line.slice(7).trim());
32
+ }
33
+ else if (line.startsWith("SEGMENT ")) {
34
+ handlers.onSegment(line.slice(8));
35
+ }
36
+ else if (line === "DONE") {
37
+ handlers.onStatus("done");
38
+ finish();
39
+ }
40
+ else if (line.startsWith("ERROR ")) {
41
+ handlers.onError(line.slice(6).trim());
42
+ finish();
43
+ }
44
+ });
45
+ proc.on("error", (err) => {
46
+ if (stopped || finished)
47
+ return;
48
+ finish();
49
+ handlers.onError(err.message);
50
+ });
51
+ proc.on("close", (code) => {
52
+ const wasFinished = finished;
53
+ finish();
54
+ if (stopped || wasFinished)
55
+ return;
56
+ if (code && code !== 0) {
57
+ handlers.onError(`voicetools exited with code ${code}`);
58
+ }
59
+ });
60
+ return {
61
+ stop: () => {
62
+ if (stopped)
63
+ return;
64
+ stopped = true;
65
+ finish();
66
+ proc.kill();
67
+ },
68
+ get running() {
69
+ return !finished && !stopped;
70
+ },
71
+ };
72
+ }
73
+ //# sourceMappingURL=voice-transcribe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voice-transcribe.js","sourceRoot":"","sources":["../../../src/modes/interactive/voice-transcribe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAkB,MAAM,eAAe,CAAC;AAChE,OAAO,EAAqB,KAAK,EAAE,MAAM,eAAe,CAAC;AAqCzD,MAAM,UAAU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OAAO;gBAAE,OAAO;YACpB,OAAO,GAAG,IAAI,CAAC;YACf,MAAM,EAAE,CAAC;YACT,IAAI,CAAC,IAAI,EAAE,CAAC;QAAA,CACZ;QACD,IAAI,OAAO,GAAG;YACb,OAAO,CAAC,QAAQ,IAAI,CAAC,OAAO,CAAC;QAAA,CAC7B;KACD,CAAC;AAAA,CACF","sourcesContent":["import { createInterface, type Interface } from \"node:readline\";\nimport { type ChildProcess, spawn } from \"child_process\";\n\n/**\n * Drives the external `voicetools` binary and streams its stdout line protocol\n * into callbacks. One line per event on stdout (stderr is free for debug logs):\n *\n * ```text\n * STATUS recording # state transition (recording | transcribing | ...)\n * SEGMENT hello world # a chunk of decoded text\n * DONE # finished successfully\n * ERROR no model found # fatal error; process exits non-zero\n * ```\n *\n * The caller wires `onSegment` to inject text into the editor (via bracketed\n * paste) and `onStatus` / `onError` to surface feedback.\n */\n\nexport type VoiceStatus = \"recording\" | \"transcribing\" | \"done\" | string;\n\nexport interface VoiceTranscribeHandlers {\n\t/** A decoded chunk of text. Injected into the editor by the caller. */\n\tonSegment: (text: string) => void;\n\t/** A state transition reported by the binary, or `\"done\"` on completion. */\n\tonStatus: (status: VoiceStatus) => void;\n\t/** A fatal error: spawn failure, protocol ERROR line, or non-zero exit. */\n\tonError: (message: string) => void;\n}\n\n/**\n * A running voice-transcribe session. Call `stop()` to cancel early (e.g. the\n * user pressing the shortcut again). `stop()` is idempotent.\n */\nexport interface VoiceSession {\n\tstop(): void;\n\treadonly running: boolean;\n}\n\nexport function startVoiceTranscribe(bin: string, handlers: VoiceTranscribeHandlers): VoiceSession {\n\tlet proc: ChildProcess;\n\ttry {\n\t\tproc = spawn(bin, [\"transcribe\"], {\n\t\t\tstdio: [\"ignore\", \"pipe\", \"ignore\"],\n\t\t});\n\t} catch (err) {\n\t\thandlers.onError(err instanceof Error ? err.message : String(err));\n\t\treturn { stop: () => {}, running: false };\n\t}\n\n\tlet stopped = false;\n\tlet finished = false;\n\tlet rl: Interface | undefined;\n\n\tconst finish = (): void => {\n\t\tif (finished) return;\n\t\tfinished = true;\n\t\trl?.close();\n\t};\n\n\tif (!proc.stdout) {\n\t\tproc.kill();\n\t\thandlers.onError(\"failed to capture voicetools stdout\");\n\t\treturn { stop: () => {}, running: false };\n\t}\n\n\trl = createInterface({ input: proc.stdout });\n\trl.on(\"line\", (line) => {\n\t\tif (line.startsWith(\"STATUS \")) {\n\t\t\thandlers.onStatus(line.slice(7).trim());\n\t\t} else if (line.startsWith(\"SEGMENT \")) {\n\t\t\thandlers.onSegment(line.slice(8));\n\t\t} else if (line === \"DONE\") {\n\t\t\thandlers.onStatus(\"done\");\n\t\t\tfinish();\n\t\t} else if (line.startsWith(\"ERROR \")) {\n\t\t\thandlers.onError(line.slice(6).trim());\n\t\t\tfinish();\n\t\t}\n\t});\n\n\tproc.on(\"error\", (err) => {\n\t\tif (stopped || finished) return;\n\t\tfinish();\n\t\thandlers.onError(err.message);\n\t});\n\n\tproc.on(\"close\", (code) => {\n\t\tconst wasFinished = finished;\n\t\tfinish();\n\t\tif (stopped || wasFinished) return;\n\t\tif (code && code !== 0) {\n\t\t\thandlers.onError(`voicetools exited with code ${code}`);\n\t\t}\n\t});\n\n\treturn {\n\t\tstop: () => {\n\t\t\tif (stopped) return;\n\t\t\tstopped = true;\n\t\t\tfinish();\n\t\t\tproc.kill();\n\t\t},\n\t\tget running() {\n\t\t\treturn !finished && !stopped;\n\t\t},\n\t};\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kolisachint/hoocode-extension-custom-provider-anthropic",
3
3
  "private": true,
4
- "version": "0.2.99",
4
+ "version": "0.2.100",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "bun": ">=1.0.0"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kolisachint/hoocode-extension-custom-provider-gitlab-duo",
3
3
  "private": true,
4
- "version": "0.2.99",
4
+ "version": "0.2.100",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "bun": ">=1.0.0"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kolisachint/hoocode-extension-sandbox",
3
3
  "private": true,
4
- "version": "0.2.99",
4
+ "version": "0.2.100",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "bun": ">=1.0.0"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kolisachint/hoocode-extension-with-deps",
3
3
  "private": true,
4
- "version": "0.2.99",
4
+ "version": "0.2.100",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "bun": ">=1.0.0"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kolisachint/hoocode-agent",
3
- "version": "0.4.102",
3
+ "version": "0.4.103",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "hoocodeConfig": {
@@ -45,9 +45,9 @@
45
45
  "prepublishOnly": "npm run clean && npm run build"
46
46
  },
47
47
  "dependencies": {
48
- "@kolisachint/hoocode-agent-core": "^0.4.102",
49
- "@kolisachint/hoocode-ai": "^0.4.102",
50
- "@kolisachint/hoocode-tui": "^0.4.102",
48
+ "@kolisachint/hoocode-agent-core": "^0.4.103",
49
+ "@kolisachint/hoocode-ai": "^0.4.103",
50
+ "@kolisachint/hoocode-tui": "^0.4.103",
51
51
  "@silvia-odwyer/photon-node": "^0.3.4",
52
52
  "chalk": "^5.5.0",
53
53
  "cli-highlight": "^2.1.11",