mino-voice-notes 0.1.0 → 0.1.1
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/LICENSE +21 -0
- package/README.md +2 -2
- package/lib/client.js +494 -0
- package/lib/client.js.map +1 -0
- package/lib/index.js +636 -0
- package/lib/types/client/VNotesPage.d.ts +7 -0
- package/lib/types/client/api.d.ts +21 -0
- package/lib/types/client/index.d.ts +9 -0
- package/lib/types/client/locales.d.ts +27 -0
- package/lib/types/client/recorder.d.ts +13 -0
- package/lib/types/index.d.ts +13 -0
- package/lib/types/store.d.ts +30 -0
- package/package.json +5 -5
- package/src/client/index.tsx +3 -3
- package/src/client/vnotes.module.css +2 -2
- package/src/index.ts +1 -1
- package/src/store.ts +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** 录音引擎:getUserMedia → AudioContext(16kHz mono) → ScriptProcessor → PCM16 →
|
|
2
|
+
* WAV 编码,每 SEGMENT_MS 冲一段回调上传。官方 voice-input 同路径(16kHz mono PCM16 WAV),
|
|
3
|
+
* 但用 ScriptProcessorNode(AudioWorklet 内联 worker 在 tsdown 单文件包里要多绕一层)。
|
|
4
|
+
*/
|
|
5
|
+
export interface Recorder {
|
|
6
|
+
readonly seconds: () => number;
|
|
7
|
+
stop(): Promise<void>;
|
|
8
|
+
dispose(): void;
|
|
9
|
+
}
|
|
10
|
+
/** PCM16 WAV 封装(RIFF 头 + interleaved s16le)。 */
|
|
11
|
+
export declare function encodeWav(chunks: Float32Array[], totalSamples: number, sampleRate?: number): ArrayBuffer;
|
|
12
|
+
export declare function wavToBase64(buf: ArrayBuffer): string;
|
|
13
|
+
export declare function startRecording(onSegment: (wav: ArrayBuffer, durationMs: number) => void | Promise<void>): Promise<Recorder>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** mino-voice-notes 宿主半:vnote_* 模型工具 + 分段上传/分享路由 + speechToText 转写 + 服务缝。
|
|
2
|
+
*
|
|
3
|
+
* 解耦边界(全官方缝,零他插件私域):
|
|
4
|
+
* - 录音段:自有 client 半经 MediaRecorder/AudioWorklet 采 PCM16 WAV → POST /mino-voice-notes/api/segment
|
|
5
|
+
* - 转写:ctx.speechToText(resolve→transcribe 官方缝;sensevoice provider 由 voice-input bundle 内置)
|
|
6
|
+
* - 纪要:模型读 vnote_get 的转写文 → vnote_update 写回 summary → 可 lore_post 投 feed(软依赖,不耦合)
|
|
7
|
+
* - 分享:/mino-voice-notes/s/<shareId> 只读页(web 档鉴权域内,本地链接)
|
|
8
|
+
* - 服务缝:ctx.provide('mino-voice-notes') 暴露 start/stop/getStatus 给 meeting-detect 等消费方
|
|
9
|
+
*/
|
|
10
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
11
|
+
export declare const name = "mino-voice-notes";
|
|
12
|
+
export declare const inject: string[];
|
|
13
|
+
export declare function apply(ctx: Context): void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type VNoteStatus = 'recording' | 'transcribing' | 'ready' | 'failed';
|
|
2
|
+
export interface VNoteSegment {
|
|
3
|
+
seq: number;
|
|
4
|
+
file: string;
|
|
5
|
+
bytes: number;
|
|
6
|
+
durationMs?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface VNote {
|
|
9
|
+
id: string;
|
|
10
|
+
title: string;
|
|
11
|
+
status: VNoteStatus;
|
|
12
|
+
createdAt: string;
|
|
13
|
+
updatedAt: string;
|
|
14
|
+
stoppedAt?: string;
|
|
15
|
+
segments: VNoteSegment[];
|
|
16
|
+
transcript?: string;
|
|
17
|
+
summary?: string;
|
|
18
|
+
shareId?: string;
|
|
19
|
+
error?: string;
|
|
20
|
+
audioSeconds?: number;
|
|
21
|
+
}
|
|
22
|
+
export declare function loadNotes(): Record<string, VNote>;
|
|
23
|
+
export declare function saveNotes(notes: Record<string, VNote>): void;
|
|
24
|
+
export declare function getNote(id: string): VNote | undefined;
|
|
25
|
+
export declare function putNote(note: VNote): void;
|
|
26
|
+
export declare function deleteNote(id: string): boolean;
|
|
27
|
+
export declare function segmentPath(id: string, seq: number): string;
|
|
28
|
+
export declare function appendSegment(id: string, seq: number, wav: Buffer, durationMs?: number): VNoteSegment;
|
|
29
|
+
export declare function readSegment(id: string, seq: number): Buffer | undefined;
|
|
30
|
+
export declare function newId(): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mino-voice-notes",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "「语音笔记」面板:录音→分段→本机转写→纪要→本地分享页,全官方解耦缝。",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh-plugin",
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"tsdown": "^0.22.2",
|
|
54
54
|
"typescript": "^5.6.0"
|
|
55
55
|
},
|
|
56
|
+
"engines": {
|
|
57
|
+
"dsh": ">=0.2.2-alpha.1 <0.3.0"
|
|
58
|
+
},
|
|
56
59
|
"dsh": {
|
|
57
|
-
"engines": {
|
|
58
|
-
"dsh": ">=0.2.2-alpha.1 <0.3.0"
|
|
59
|
-
},
|
|
60
60
|
"bundle": {
|
|
61
61
|
"patch": "./cordis.patch.yml"
|
|
62
62
|
},
|
|
@@ -69,4 +69,4 @@
|
|
|
69
69
|
"platform": "web"
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
}
|
|
72
|
+
}
|
package/src/client/index.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/** mino-voice-notes 客户端半:注册进 mino-
|
|
2
|
-
* 与 mino-
|
|
1
|
+
/** mino-voice-notes 客户端半:注册进 mino-lore 的「语音」tab 座位。
|
|
2
|
+
* 与 mino-lore 同款注册法(slots.inject 座位缺席则安静缺席)。
|
|
3
3
|
* 数据面:同源 fetch 自有路由;录音经 MediaRecorder 同款 getUserMedia+PCM16 WAV 链。
|
|
4
4
|
*/
|
|
5
5
|
import type { Context } from '@deepseek-ai/cordis'
|
|
@@ -9,7 +9,7 @@ import { en, zh, type CopyKey } from './locales.ts'
|
|
|
9
9
|
export const inject = ['slots', 'locale']
|
|
10
10
|
|
|
11
11
|
const NS = 'mino-voice-notes'
|
|
12
|
-
const SEAT = '
|
|
12
|
+
const SEAT = 'lore.page.voice'
|
|
13
13
|
|
|
14
14
|
interface SlotsFace {
|
|
15
15
|
inject(key: string, callback: () => (() => void) | void): () => void
|
package/src/index.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* 解耦边界(全官方缝,零他插件私域):
|
|
4
4
|
* - 录音段:自有 client 半经 MediaRecorder/AudioWorklet 采 PCM16 WAV → POST /mino-voice-notes/api/segment
|
|
5
5
|
* - 转写:ctx.speechToText(resolve→transcribe 官方缝;sensevoice provider 由 voice-input bundle 内置)
|
|
6
|
-
* - 纪要:模型读 vnote_get 的转写文 → vnote_update 写回 summary → 可
|
|
6
|
+
* - 纪要:模型读 vnote_get 的转写文 → vnote_update 写回 summary → 可 lore_post 投 feed(软依赖,不耦合)
|
|
7
7
|
* - 分享:/mino-voice-notes/s/<shareId> 只读页(web 档鉴权域内,本地链接)
|
|
8
8
|
* - 服务缝:ctx.provide('mino-voice-notes') 暴露 start/stop/getStatus 给 meeting-detect 等消费方
|
|
9
9
|
*/
|
package/src/store.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** mino-voice-notes 自有存储:notes.json 元数据索引 + audio/<id>/<seq>.wav 分段文件。
|
|
2
2
|
* 位置 `$DSH_HOME/mino-voice-notes/`(无 DSH_HOME 时 `~/.mino/mino-voice-notes/`)——
|
|
3
|
-
* 与 mino-
|
|
3
|
+
* 与 mino-lore 同一落点约定,不读其他插件私有目录。
|
|
4
4
|
*/
|
|
5
5
|
import { mkdirSync, readFileSync, writeFileSync, rmSync } from 'node:fs'
|
|
6
6
|
import { join } from 'node:path'
|