@isaacriehm/cairn-core 0.1.0 → 0.1.4
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/dist/.tsbuildinfo +1 -1
- package/dist/ground/schemas.d.ts +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/dist/join/index.d.ts +6 -1
- package/dist/join/index.js +1 -1
- package/dist/join/index.js.map +1 -1
- package/dist/mcp/schemas.d.ts +4 -4
- package/package.json +4 -4
- package/dist/init/daemon-autostart.d.ts +0 -16
- package/dist/init/daemon-autostart.js +0 -95
- package/dist/init/daemon-autostart.js.map +0 -1
- package/dist/init/mapper-legacy.d.ts +0 -148
- package/dist/init/mapper-legacy.js +0 -238
- package/dist/init/mapper-legacy.js.map +0 -1
- package/dist/init/secrets.d.ts +0 -18
- package/dist/init/secrets.js +0 -76
- package/dist/init/secrets.js.map +0 -1
- package/dist/init/setup-runners.d.ts +0 -15
- package/dist/init/setup-runners.js +0 -143
- package/dist/init/setup-runners.js.map +0 -1
- package/dist/mirror/clone.d.ts +0 -6
- package/dist/mirror/clone.js +0 -48
- package/dist/mirror/clone.js.map +0 -1
- package/dist/mirror/dirty-overlap.d.ts +0 -13
- package/dist/mirror/dirty-overlap.js +0 -42
- package/dist/mirror/dirty-overlap.js.map +0 -1
- package/dist/mirror/index.d.ts +0 -7
- package/dist/mirror/index.js +0 -7
- package/dist/mirror/index.js.map +0 -1
- package/dist/mirror/paths.d.ts +0 -18
- package/dist/mirror/paths.js +0 -45
- package/dist/mirror/paths.js.map +0 -1
- package/dist/mirror/push.d.ts +0 -9
- package/dist/mirror/push.js +0 -27
- package/dist/mirror/push.js.map +0 -1
- package/dist/mirror/state.d.ts +0 -4
- package/dist/mirror/state.js +0 -36
- package/dist/mirror/state.js.map +0 -1
- package/dist/mirror/sync.d.ts +0 -9
- package/dist/mirror/sync.js +0 -33
- package/dist/mirror/sync.js.map +0 -1
- package/dist/mirror/types.d.ts +0 -77
- package/dist/mirror/types.js +0 -2
- package/dist/mirror/types.js.map +0 -1
- package/dist/tier0/ollama.d.ts +0 -22
- package/dist/tier0/ollama.js +0 -63
- package/dist/tier0/ollama.js.map +0 -1
- package/dist/voice/index.d.ts +0 -4
- package/dist/voice/index.js +0 -4
- package/dist/voice/index.js.map +0 -1
- package/dist/voice/model.d.ts +0 -23
- package/dist/voice/model.js +0 -46
- package/dist/voice/model.js.map +0 -1
- package/dist/voice/pipe.d.ts +0 -9
- package/dist/voice/pipe.js +0 -47
- package/dist/voice/pipe.js.map +0 -1
- package/dist/voice/transcribe.d.ts +0 -3
- package/dist/voice/transcribe.js +0 -43
- package/dist/voice/transcribe.js.map +0 -1
- package/dist/voice/types.d.ts +0 -26
- package/dist/voice/types.js +0 -9
- package/dist/voice/types.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dirty-overlap.js","sourceRoot":"","sources":["../../src/mirror/dirty-overlap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGjD,MAAM,GAAG,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAE3C;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,IAAyB;IAEzB,MAAM,MAAM,GAAG,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACrD,MAAM,IAAI,GAAG,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAE5C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;IACnC,MAAM,UAAU,GAAG;QACjB,GAAG,MAAM,CAAC,SAAS;QACnB,GAAG,MAAM,CAAC,QAAQ;QAClB,GAAG,MAAM,CAAC,OAAO;QACjB,GAAG,MAAM,CAAC,OAAO;QACjB,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAClC,GAAG,MAAM,CAAC,MAAM;KACjB,CAAC;IACF,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;IAC9C,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAEjF,GAAG,CAAC,KAAK,CACP;QACE,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,UAAU,EAAE,KAAK,CAAC,MAAM;QACxB,YAAY,EAAE,WAAW,CAAC,MAAM;KACjC,EACD,qBAAqB,CACtB,CAAC;IAEF,OAAO;QACL,UAAU,EAAE,KAAK;QACjB,gBAAgB,EAAE,WAAW;QAC7B,OAAO,EAAE,WAAW,CAAC,MAAM,GAAG,CAAC;KAChC,CAAC;AACJ,CAAC"}
|
package/dist/mirror/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { ensureMirror } from "./clone.js";
|
|
2
|
-
export { syncMirror } from "./sync.js";
|
|
3
|
-
export { pushMirror } from "./push.js";
|
|
4
|
-
export { checkLocalDirtyOverlap } from "./dirty-overlap.js";
|
|
5
|
-
export { harnessHome, reposRoot, stateRoot, modelsRoot, mirrorPath, projectStatePath, mirrorRecordPath, normalizeProjectName, } from "./paths.js";
|
|
6
|
-
export { readMirrorRecord, writeMirrorRecord, requireMirrorRecord, } from "./state.js";
|
|
7
|
-
export type { ProjectName, MirrorRecord, SyncResult, PushResult, DirtyOverlapResult, CloneOptions, SyncOptions, PushOptions, DirtyOverlapOptions, } from "./types.js";
|
package/dist/mirror/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { ensureMirror } from "./clone.js";
|
|
2
|
-
export { syncMirror } from "./sync.js";
|
|
3
|
-
export { pushMirror } from "./push.js";
|
|
4
|
-
export { checkLocalDirtyOverlap } from "./dirty-overlap.js";
|
|
5
|
-
export { harnessHome, reposRoot, stateRoot, modelsRoot, mirrorPath, projectStatePath, mirrorRecordPath, normalizeProjectName, } from "./paths.js";
|
|
6
|
-
export { readMirrorRecord, writeMirrorRecord, requireMirrorRecord, } from "./state.js";
|
|
7
|
-
//# sourceMappingURL=index.js.map
|
package/dist/mirror/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mirror/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EACL,WAAW,EACX,SAAS,EACT,SAAS,EACT,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,YAAY,CAAC"}
|
package/dist/mirror/paths.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { ProjectName } from "./types.js";
|
|
2
|
-
export declare function harnessHome(): string;
|
|
3
|
-
export declare function reposRoot(): string;
|
|
4
|
-
export declare function stateRoot(): string;
|
|
5
|
-
export declare function modelsRoot(): string;
|
|
6
|
-
export declare function mirrorPath(projectName: ProjectName): string;
|
|
7
|
-
export declare function projectStatePath(projectName: ProjectName): string;
|
|
8
|
-
export declare function mirrorRecordPath(projectName: ProjectName): string;
|
|
9
|
-
/**
|
|
10
|
-
* Normalize a free-form name (package.json `name`, directory name) into the
|
|
11
|
-
* filesystem slug used as a directory key.
|
|
12
|
-
*
|
|
13
|
-
* - Lowercased
|
|
14
|
-
* - Scoped names (`@org/pkg`) use the path-after-slash
|
|
15
|
-
* - Non-alphanumerics collapse to a single underscore
|
|
16
|
-
* - Leading/trailing underscores stripped
|
|
17
|
-
*/
|
|
18
|
-
export declare function normalizeProjectName(raw: string): ProjectName;
|
package/dist/mirror/paths.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { homedir } from "node:os";
|
|
2
|
-
import { join, resolve } from "node:path";
|
|
3
|
-
const HARNESS_HOME_ROOT = ".local/harness";
|
|
4
|
-
export function harnessHome() {
|
|
5
|
-
return resolve(homedir(), HARNESS_HOME_ROOT);
|
|
6
|
-
}
|
|
7
|
-
export function reposRoot() {
|
|
8
|
-
return join(harnessHome(), "repos");
|
|
9
|
-
}
|
|
10
|
-
export function stateRoot() {
|
|
11
|
-
return join(harnessHome(), "state");
|
|
12
|
-
}
|
|
13
|
-
export function modelsRoot() {
|
|
14
|
-
return join(harnessHome(), "models");
|
|
15
|
-
}
|
|
16
|
-
export function mirrorPath(projectName) {
|
|
17
|
-
return join(reposRoot(), projectName);
|
|
18
|
-
}
|
|
19
|
-
export function projectStatePath(projectName) {
|
|
20
|
-
return join(stateRoot(), projectName);
|
|
21
|
-
}
|
|
22
|
-
export function mirrorRecordPath(projectName) {
|
|
23
|
-
return join(projectStatePath(projectName), "mirror.json");
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Normalize a free-form name (package.json `name`, directory name) into the
|
|
27
|
-
* filesystem slug used as a directory key.
|
|
28
|
-
*
|
|
29
|
-
* - Lowercased
|
|
30
|
-
* - Scoped names (`@org/pkg`) use the path-after-slash
|
|
31
|
-
* - Non-alphanumerics collapse to a single underscore
|
|
32
|
-
* - Leading/trailing underscores stripped
|
|
33
|
-
*/
|
|
34
|
-
export function normalizeProjectName(raw) {
|
|
35
|
-
const afterScope = raw.includes("/") ? (raw.split("/").pop() ?? raw) : raw;
|
|
36
|
-
const slug = afterScope
|
|
37
|
-
.toLowerCase()
|
|
38
|
-
.replace(/[^a-z0-9]+/g, "_")
|
|
39
|
-
.replace(/^_+|_+$/g, "");
|
|
40
|
-
if (slug.length === 0) {
|
|
41
|
-
throw new Error(`Cannot normalize project name from "${raw}" — result is empty`);
|
|
42
|
-
}
|
|
43
|
-
return slug;
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=paths.js.map
|
package/dist/mirror/paths.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/mirror/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAG1C,MAAM,iBAAiB,GAAG,gBAAgB,CAAC;AAE3C,MAAM,UAAU,WAAW;IACzB,OAAO,OAAO,CAAC,OAAO,EAAE,EAAE,iBAAiB,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,SAAS;IACvB,OAAO,IAAI,CAAC,WAAW,EAAE,EAAE,OAAO,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,SAAS;IACvB,OAAO,IAAI,CAAC,WAAW,EAAE,EAAE,OAAO,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,OAAO,IAAI,CAAC,WAAW,EAAE,EAAE,QAAQ,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,WAAwB;IACjD,OAAO,IAAI,CAAC,SAAS,EAAE,EAAE,WAAW,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,WAAwB;IACvD,OAAO,IAAI,CAAC,SAAS,EAAE,EAAE,WAAW,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,WAAwB;IACvD,OAAO,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,EAAE,aAAa,CAAC,CAAC;AAC5D,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAC9C,MAAM,UAAU,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAC3E,MAAM,IAAI,GAAG,UAAU;SACpB,WAAW,EAAE;SACb,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;SAC3B,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IAC3B,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,uCAAuC,GAAG,qBAAqB,CAAC,CAAC;IACnF,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/mirror/push.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { PushOptions, PushResult } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Pushes the mirror's current HEAD to origin. Caller commits first.
|
|
4
|
-
*
|
|
5
|
-
* Force pushes are refused unless `force: true` is explicitly set; the only
|
|
6
|
-
* time the harness sets that is during recovery flows that have explicit
|
|
7
|
-
* operator authorization. Routine pushes never force.
|
|
8
|
-
*/
|
|
9
|
-
export declare function pushMirror(opts: PushOptions): Promise<PushResult>;
|
package/dist/mirror/push.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { simpleGit } from "simple-git";
|
|
2
|
-
import { logger } from "../logger.js";
|
|
3
|
-
import { requireMirrorRecord } from "./state.js";
|
|
4
|
-
const log = logger("mirror.push");
|
|
5
|
-
/**
|
|
6
|
-
* Pushes the mirror's current HEAD to origin. Caller commits first.
|
|
7
|
-
*
|
|
8
|
-
* Force pushes are refused unless `force: true` is explicitly set; the only
|
|
9
|
-
* time the harness sets that is during recovery flows that have explicit
|
|
10
|
-
* operator authorization. Routine pushes never force.
|
|
11
|
-
*/
|
|
12
|
-
export async function pushMirror(opts) {
|
|
13
|
-
const record = requireMirrorRecord(opts.projectName);
|
|
14
|
-
const branch = opts.branch ?? record.defaultBranch;
|
|
15
|
-
const repo = simpleGit(record.mirrorPath);
|
|
16
|
-
const sha = (await repo.revparse(["HEAD"])).trim();
|
|
17
|
-
log.info({ projectName: opts.projectName, branch, sha, force: opts.force === true }, "pushing");
|
|
18
|
-
const args = ["origin", branch];
|
|
19
|
-
if (opts.force === true)
|
|
20
|
-
args.unshift("--force-with-lease");
|
|
21
|
-
const result = await repo.push(args);
|
|
22
|
-
const pushedAt = new Date().toISOString();
|
|
23
|
-
const raw = JSON.stringify(result);
|
|
24
|
-
log.info({ projectName: opts.projectName, branch, sha }, "push complete");
|
|
25
|
-
return { sha, branch, pushedAt, raw };
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=push.js.map
|
package/dist/mirror/push.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"push.js","sourceRoot":"","sources":["../../src/mirror/push.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGjD,MAAM,GAAG,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;AAElC;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAiB;IAChD,MAAM,MAAM,GAAG,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACrD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,aAAa,CAAC;IACnD,MAAM,IAAI,GAAG,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAE1C,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACnD,GAAG,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,KAAK,IAAI,EAAE,EAAE,SAAS,CAAC,CAAC;IAEhG,MAAM,IAAI,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI;QAAE,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAE5D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,QAAQ,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC1C,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAEnC,GAAG,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,eAAe,CAAC,CAAC;IAC1E,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC;AACxC,CAAC"}
|
package/dist/mirror/state.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { MirrorRecord, ProjectName } from "./types.js";
|
|
2
|
-
export declare function readMirrorRecord(projectName: ProjectName): MirrorRecord | null;
|
|
3
|
-
export declare function writeMirrorRecord(record: MirrorRecord): void;
|
|
4
|
-
export declare function requireMirrorRecord(projectName: ProjectName): MirrorRecord;
|
package/dist/mirror/state.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { dirname } from "node:path";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import { mirrorRecordPath } from "./paths.js";
|
|
5
|
-
const MirrorRecordSchema = z.object({
|
|
6
|
-
projectName: z.string().min(1),
|
|
7
|
-
userTreePath: z.string().min(1),
|
|
8
|
-
originUrl: z.string().min(1),
|
|
9
|
-
defaultBranch: z.string().min(1),
|
|
10
|
-
mirrorPath: z.string().min(1),
|
|
11
|
-
lastSyncedAt: z.string().nullable(),
|
|
12
|
-
lastSha: z.string().nullable(),
|
|
13
|
-
createdAt: z.string().min(1),
|
|
14
|
-
});
|
|
15
|
-
export function readMirrorRecord(projectName) {
|
|
16
|
-
const path = mirrorRecordPath(projectName);
|
|
17
|
-
if (!existsSync(path))
|
|
18
|
-
return null;
|
|
19
|
-
const raw = readFileSync(path, "utf8");
|
|
20
|
-
const parsed = JSON.parse(raw);
|
|
21
|
-
return MirrorRecordSchema.parse(parsed);
|
|
22
|
-
}
|
|
23
|
-
export function writeMirrorRecord(record) {
|
|
24
|
-
const validated = MirrorRecordSchema.parse(record);
|
|
25
|
-
const path = mirrorRecordPath(record.projectName);
|
|
26
|
-
mkdirSync(dirname(path), { recursive: true });
|
|
27
|
-
writeFileSync(path, `${JSON.stringify(validated, null, 2)}\n`, "utf8");
|
|
28
|
-
}
|
|
29
|
-
export function requireMirrorRecord(projectName) {
|
|
30
|
-
const record = readMirrorRecord(projectName);
|
|
31
|
-
if (!record) {
|
|
32
|
-
throw new Error(`No mirror record for project "${projectName}". Run \`harness mirror init\` first.`);
|
|
33
|
-
}
|
|
34
|
-
return record;
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=state.js.map
|
package/dist/mirror/state.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/mirror/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA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AC,MAAoB;IACpD,MAAM,SAAS,GAAG,kBAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACnD,MAAM,IAAI,GAAG,gBAAgB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAClD,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,aAAa,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACzE,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,WAAwB;IAC1D,MAAM,MAAM,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAC7C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CACb,iCAAiC,WAAW,uCAAuC,CACpF,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/mirror/sync.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { SyncOptions, SyncResult } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Pins the mirror to origin/<branch> via fetch + reset --hard. Caller is
|
|
4
|
-
* responsible for ensuring no in-flight task is touching the mirror — the
|
|
5
|
-
* orchestrator gates this on the FIFO queue idle state.
|
|
6
|
-
*
|
|
7
|
-
* Returns the SHA pin captured immediately after the reset.
|
|
8
|
-
*/
|
|
9
|
-
export declare function syncMirror(opts: SyncOptions): Promise<SyncResult>;
|
package/dist/mirror/sync.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { simpleGit } from "simple-git";
|
|
2
|
-
import { logger } from "../logger.js";
|
|
3
|
-
import { readMirrorRecord, requireMirrorRecord, writeMirrorRecord } from "./state.js";
|
|
4
|
-
const log = logger("mirror.sync");
|
|
5
|
-
/**
|
|
6
|
-
* Pins the mirror to origin/<branch> via fetch + reset --hard. Caller is
|
|
7
|
-
* responsible for ensuring no in-flight task is touching the mirror — the
|
|
8
|
-
* orchestrator gates this on the FIFO queue idle state.
|
|
9
|
-
*
|
|
10
|
-
* Returns the SHA pin captured immediately after the reset.
|
|
11
|
-
*/
|
|
12
|
-
export async function syncMirror(opts) {
|
|
13
|
-
const record = requireMirrorRecord(opts.projectName);
|
|
14
|
-
const branch = opts.branch ?? record.defaultBranch;
|
|
15
|
-
const repo = simpleGit(record.mirrorPath);
|
|
16
|
-
log.info({ projectName: opts.projectName, branch }, "fetching origin");
|
|
17
|
-
await repo.fetch("origin");
|
|
18
|
-
log.info({ projectName: opts.projectName, target: `origin/${branch}` }, "hard-resetting mirror");
|
|
19
|
-
await repo.reset(["--hard", `origin/${branch}`]);
|
|
20
|
-
const sha = (await repo.revparse(["HEAD"])).trim();
|
|
21
|
-
const syncedAt = new Date().toISOString();
|
|
22
|
-
// Re-read in case another process wrote in parallel; merge sync fields only.
|
|
23
|
-
const fresh = readMirrorRecord(opts.projectName) ?? record;
|
|
24
|
-
writeMirrorRecord({
|
|
25
|
-
...fresh,
|
|
26
|
-
defaultBranch: fresh.defaultBranch === branch ? fresh.defaultBranch : fresh.defaultBranch,
|
|
27
|
-
lastSyncedAt: syncedAt,
|
|
28
|
-
lastSha: sha,
|
|
29
|
-
});
|
|
30
|
-
log.info({ projectName: opts.projectName, sha, branch }, "sync complete");
|
|
31
|
-
return { sha, branch, syncedAt };
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=sync.js.map
|
package/dist/mirror/sync.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../src/mirror/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MA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,CAAC,CAAC;IAEH,GAAG,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,eAAe,CAAC,CAAC;IAC1E,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AACnC,CAAC"}
|
package/dist/mirror/types.d.ts
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Project-name slug used as the directory key under
|
|
3
|
-
* ~/.local/harness/{repos,state}/<name>/.
|
|
4
|
-
*
|
|
5
|
-
* Normalized by `normalizeProjectName` from package.json `name` (preferred)
|
|
6
|
-
* or directory name. Lowercased; non-alphanumerics → underscores.
|
|
7
|
-
*/
|
|
8
|
-
export type ProjectName = string;
|
|
9
|
-
/**
|
|
10
|
-
* Persisted at ~/.local/harness/state/<projectName>/mirror.json.
|
|
11
|
-
*
|
|
12
|
-
* Owned by the harness; the user's working tree at userTreePath is sacred —
|
|
13
|
-
* harness reads it for dirty-overlap checks, never writes.
|
|
14
|
-
*/
|
|
15
|
-
export interface MirrorRecord {
|
|
16
|
-
projectName: ProjectName;
|
|
17
|
-
/** Absolute path to the user's primary working tree. Read-only for harness. */
|
|
18
|
-
userTreePath: string;
|
|
19
|
-
/** Origin URL discovered at adoption (or supplied). */
|
|
20
|
-
originUrl: string;
|
|
21
|
-
/** Default branch (resolved at adoption from origin/HEAD). */
|
|
22
|
-
defaultBranch: string;
|
|
23
|
-
/** Absolute path to the parallel mirror clone. */
|
|
24
|
-
mirrorPath: string;
|
|
25
|
-
/** ISO timestamp of last successful sync. */
|
|
26
|
-
lastSyncedAt: string | null;
|
|
27
|
-
/** SHA at HEAD after last sync. */
|
|
28
|
-
lastSha: string | null;
|
|
29
|
-
/** ISO timestamp the record was created. */
|
|
30
|
-
createdAt: string;
|
|
31
|
-
}
|
|
32
|
-
export interface SyncResult {
|
|
33
|
-
/** SHA pin captured immediately after fetch + reset. */
|
|
34
|
-
sha: string;
|
|
35
|
-
/** Branch the mirror is pinned to (default origin/<defaultBranch>). */
|
|
36
|
-
branch: string;
|
|
37
|
-
syncedAt: string;
|
|
38
|
-
}
|
|
39
|
-
export interface PushResult {
|
|
40
|
-
/** SHA pushed to origin. */
|
|
41
|
-
sha: string;
|
|
42
|
-
branch: string;
|
|
43
|
-
pushedAt: string;
|
|
44
|
-
/** Stdout from git push, kept for the run event log. */
|
|
45
|
-
raw: string;
|
|
46
|
-
}
|
|
47
|
-
export interface DirtyOverlapResult {
|
|
48
|
-
/** Files with un-committed changes in the user's working tree. */
|
|
49
|
-
dirtyFiles: string[];
|
|
50
|
-
/** Subset of dirtyFiles that match any of the run's target globs. */
|
|
51
|
-
overlappingFiles: string[];
|
|
52
|
-
/** True iff overlappingFiles is non-empty. */
|
|
53
|
-
overlap: boolean;
|
|
54
|
-
}
|
|
55
|
-
export interface CloneOptions {
|
|
56
|
-
projectName: ProjectName;
|
|
57
|
-
userTreePath: string;
|
|
58
|
-
originUrl: string;
|
|
59
|
-
defaultBranch?: string;
|
|
60
|
-
}
|
|
61
|
-
export interface SyncOptions {
|
|
62
|
-
projectName: ProjectName;
|
|
63
|
-
/** Override default branch for this sync (rare). */
|
|
64
|
-
branch?: string;
|
|
65
|
-
}
|
|
66
|
-
export interface PushOptions {
|
|
67
|
-
projectName: ProjectName;
|
|
68
|
-
/** Branch to push; defaults to record.defaultBranch. */
|
|
69
|
-
branch?: string;
|
|
70
|
-
/** Set to true only when explicitly authorized; otherwise refuse force pushes. */
|
|
71
|
-
force?: boolean;
|
|
72
|
-
}
|
|
73
|
-
export interface DirtyOverlapOptions {
|
|
74
|
-
projectName: ProjectName;
|
|
75
|
-
/** Globs from the dispatched run's tightened spec (target_path_globs). */
|
|
76
|
-
targetGlobs: string[];
|
|
77
|
-
}
|
package/dist/mirror/types.js
DELETED
package/dist/mirror/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/mirror/types.ts"],"names":[],"mappings":""}
|
package/dist/tier0/ollama.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Minimal Ollama HTTP client. Avoids pulling another dep just for two POSTs.
|
|
3
|
-
* Server defaults to http://localhost:11434 (Ollama's listen). The harness
|
|
4
|
-
* exposes `OLLAMA_HOST` env override per `.env.example`.
|
|
5
|
-
*/
|
|
6
|
-
export interface OllamaGenerateRequest {
|
|
7
|
-
host: string;
|
|
8
|
-
model: string;
|
|
9
|
-
prompt: string;
|
|
10
|
-
system?: string;
|
|
11
|
-
/** Set to "json" to ask the model for valid JSON output. */
|
|
12
|
-
format?: "json";
|
|
13
|
-
timeoutMs?: number;
|
|
14
|
-
}
|
|
15
|
-
export interface OllamaGenerateResponse {
|
|
16
|
-
response: string;
|
|
17
|
-
done: boolean;
|
|
18
|
-
total_duration?: number;
|
|
19
|
-
}
|
|
20
|
-
export declare function ollamaGenerate(req: OllamaGenerateRequest): Promise<OllamaGenerateResponse>;
|
|
21
|
-
export declare function ollamaIsAvailable(host: string): Promise<boolean>;
|
|
22
|
-
export declare function ollamaHasModel(host: string, model: string): Promise<boolean>;
|
package/dist/tier0/ollama.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Minimal Ollama HTTP client. Avoids pulling another dep just for two POSTs.
|
|
3
|
-
* Server defaults to http://localhost:11434 (Ollama's listen). The harness
|
|
4
|
-
* exposes `OLLAMA_HOST` env override per `.env.example`.
|
|
5
|
-
*/
|
|
6
|
-
export async function ollamaGenerate(req) {
|
|
7
|
-
const ctrl = new AbortController();
|
|
8
|
-
const timer = setTimeout(() => ctrl.abort(), req.timeoutMs ?? 30_000);
|
|
9
|
-
try {
|
|
10
|
-
const body = {
|
|
11
|
-
model: req.model,
|
|
12
|
-
prompt: req.prompt,
|
|
13
|
-
stream: false,
|
|
14
|
-
};
|
|
15
|
-
if (req.system !== undefined)
|
|
16
|
-
body["system"] = req.system;
|
|
17
|
-
if (req.format !== undefined)
|
|
18
|
-
body["format"] = req.format;
|
|
19
|
-
const res = await fetch(`${req.host}/api/generate`, {
|
|
20
|
-
method: "POST",
|
|
21
|
-
headers: { "content-type": "application/json" },
|
|
22
|
-
signal: ctrl.signal,
|
|
23
|
-
body: JSON.stringify(body),
|
|
24
|
-
});
|
|
25
|
-
if (!res.ok) {
|
|
26
|
-
throw new Error(`ollama HTTP ${res.status}: ${await res.text()}`);
|
|
27
|
-
}
|
|
28
|
-
return (await res.json());
|
|
29
|
-
}
|
|
30
|
-
finally {
|
|
31
|
-
clearTimeout(timer);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
export async function ollamaIsAvailable(host) {
|
|
35
|
-
try {
|
|
36
|
-
const ctrl = new AbortController();
|
|
37
|
-
const timer = setTimeout(() => ctrl.abort(), 1000);
|
|
38
|
-
const res = await fetch(`${host}/api/tags`, { signal: ctrl.signal });
|
|
39
|
-
clearTimeout(timer);
|
|
40
|
-
return res.ok;
|
|
41
|
-
}
|
|
42
|
-
catch {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
export async function ollamaHasModel(host, model) {
|
|
47
|
-
try {
|
|
48
|
-
const ctrl = new AbortController();
|
|
49
|
-
const timer = setTimeout(() => ctrl.abort(), 1500);
|
|
50
|
-
const res = await fetch(`${host}/api/tags`, { signal: ctrl.signal });
|
|
51
|
-
clearTimeout(timer);
|
|
52
|
-
if (!res.ok)
|
|
53
|
-
return false;
|
|
54
|
-
const json = (await res.json());
|
|
55
|
-
if (!json.models)
|
|
56
|
-
return false;
|
|
57
|
-
return json.models.some((m) => m.name === model || m.name.startsWith(`${model}:`));
|
|
58
|
-
}
|
|
59
|
-
catch {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
//# sourceMappingURL=ollama.js.map
|
package/dist/tier0/ollama.js.map
DELETED
|
@@ -1 +0,0 @@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AC,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC;IACrF,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
package/dist/voice/index.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { transcribeBuffer, transcribeUrl } from "./transcribe.js";
|
|
2
|
-
export { freeWhisper, getWhisper, whisperModelExists, WHISPER_MODEL_FILE, WHISPER_MODEL_PATH, WHISPER_MODELS_DIR, } from "./model.js";
|
|
3
|
-
export { audioToPcm } from "./pipe.js";
|
|
4
|
-
export type { TranscribeOptions, TranscriptionResult, TranscriptionSegment, } from "./types.js";
|
package/dist/voice/index.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { transcribeBuffer, transcribeUrl } from "./transcribe.js";
|
|
2
|
-
export { freeWhisper, getWhisper, whisperModelExists, WHISPER_MODEL_FILE, WHISPER_MODEL_PATH, WHISPER_MODELS_DIR, } from "./model.js";
|
|
3
|
-
export { audioToPcm } from "./pipe.js";
|
|
4
|
-
//# sourceMappingURL=index.js.map
|
package/dist/voice/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/voice/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EACL,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/voice/model.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Whisper } from "smart-whisper";
|
|
2
|
-
/**
|
|
3
|
-
* Whisper model spec is locked at L11: large-v3-turbo Q5_0. Hardcoded path
|
|
4
|
-
* (operator hates env vars; only secrets/brand/domain go in env).
|
|
5
|
-
*
|
|
6
|
-
* Operator install:
|
|
7
|
-
* brew install whisper-cpp
|
|
8
|
-
* curl -L -o ~/.local/harness/models/ggml-large-v3-turbo-q5_0.bin \
|
|
9
|
-
* "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-large-v3-turbo-q5_0.bin?download=true"
|
|
10
|
-
*
|
|
11
|
-
* Phase 16 init script automates the curl.
|
|
12
|
-
*/
|
|
13
|
-
export declare const WHISPER_MODEL_FILE = "ggml-large-v3-turbo-q5_0.bin";
|
|
14
|
-
export declare const WHISPER_MODELS_DIR: string;
|
|
15
|
-
export declare const WHISPER_MODEL_PATH: string;
|
|
16
|
-
export declare function whisperModelExists(): boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Lazy-singleton Whisper. smart-whisper's `offload` parameter offloads the
|
|
19
|
-
* model from RAM after N idle seconds; loading on next call. Default 60s
|
|
20
|
-
* keeps the model warm during a burst of voice notes.
|
|
21
|
-
*/
|
|
22
|
-
export declare function getWhisper(): Whisper;
|
|
23
|
-
export declare function freeWhisper(): Promise<void>;
|
package/dist/voice/model.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
|
-
import { homedir } from "node:os";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
import { Whisper } from "smart-whisper";
|
|
5
|
-
import { logger } from "../logger.js";
|
|
6
|
-
const log = logger("voice.model");
|
|
7
|
-
/**
|
|
8
|
-
* Whisper model spec is locked at L11: large-v3-turbo Q5_0. Hardcoded path
|
|
9
|
-
* (operator hates env vars; only secrets/brand/domain go in env).
|
|
10
|
-
*
|
|
11
|
-
* Operator install:
|
|
12
|
-
* brew install whisper-cpp
|
|
13
|
-
* curl -L -o ~/.local/harness/models/ggml-large-v3-turbo-q5_0.bin \
|
|
14
|
-
* "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-large-v3-turbo-q5_0.bin?download=true"
|
|
15
|
-
*
|
|
16
|
-
* Phase 16 init script automates the curl.
|
|
17
|
-
*/
|
|
18
|
-
export const WHISPER_MODEL_FILE = "ggml-large-v3-turbo-q5_0.bin";
|
|
19
|
-
export const WHISPER_MODELS_DIR = join(homedir(), ".local", "harness", "models");
|
|
20
|
-
export const WHISPER_MODEL_PATH = join(WHISPER_MODELS_DIR, WHISPER_MODEL_FILE);
|
|
21
|
-
export function whisperModelExists() {
|
|
22
|
-
return existsSync(WHISPER_MODEL_PATH);
|
|
23
|
-
}
|
|
24
|
-
let _whisper;
|
|
25
|
-
/**
|
|
26
|
-
* Lazy-singleton Whisper. smart-whisper's `offload` parameter offloads the
|
|
27
|
-
* model from RAM after N idle seconds; loading on next call. Default 60s
|
|
28
|
-
* keeps the model warm during a burst of voice notes.
|
|
29
|
-
*/
|
|
30
|
-
export function getWhisper() {
|
|
31
|
-
if (_whisper)
|
|
32
|
-
return _whisper;
|
|
33
|
-
if (!whisperModelExists()) {
|
|
34
|
-
throw new Error(`whisper model not found at ${WHISPER_MODEL_PATH} — run \`harness init\` or download manually`);
|
|
35
|
-
}
|
|
36
|
-
log.info({ path: WHISPER_MODEL_PATH }, "loading whisper model");
|
|
37
|
-
_whisper = new Whisper(WHISPER_MODEL_PATH, { gpu: true, offload: 60 });
|
|
38
|
-
return _whisper;
|
|
39
|
-
}
|
|
40
|
-
export async function freeWhisper() {
|
|
41
|
-
if (_whisper) {
|
|
42
|
-
await _whisper.free();
|
|
43
|
-
_whisper = undefined;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=model.js.map
|
package/dist/voice/model.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/voice/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OA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itrary audio bytes through ffmpeg → 16 kHz mono Float32 PCM.
|
|
3
|
-
*
|
|
4
|
-
* Audio bytes flow stdin→stdout; nothing touches disk (L12).
|
|
5
|
-
*
|
|
6
|
-
* `ffmpeg` must be on PATH. macOS: `brew install ffmpeg`. Phase 16 init
|
|
7
|
-
* script verifies and prompts to install.
|
|
8
|
-
*/
|
|
9
|
-
export declare function audioToPcm(audio: Buffer): Promise<Float32Array>;
|
package/dist/voice/pipe.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { spawn } from "node:child_process";
|
|
2
|
-
/**
|
|
3
|
-
* Pipe arbitrary audio bytes through ffmpeg → 16 kHz mono Float32 PCM.
|
|
4
|
-
*
|
|
5
|
-
* Audio bytes flow stdin→stdout; nothing touches disk (L12).
|
|
6
|
-
*
|
|
7
|
-
* `ffmpeg` must be on PATH. macOS: `brew install ffmpeg`. Phase 16 init
|
|
8
|
-
* script verifies and prompts to install.
|
|
9
|
-
*/
|
|
10
|
-
export async function audioToPcm(audio) {
|
|
11
|
-
return new Promise((resolve, reject) => {
|
|
12
|
-
const ff = spawn("ffmpeg", [
|
|
13
|
-
"-loglevel",
|
|
14
|
-
"error",
|
|
15
|
-
"-i",
|
|
16
|
-
"pipe:0",
|
|
17
|
-
"-ar",
|
|
18
|
-
"16000",
|
|
19
|
-
"-ac",
|
|
20
|
-
"1",
|
|
21
|
-
"-f",
|
|
22
|
-
"f32le",
|
|
23
|
-
"pipe:1",
|
|
24
|
-
]);
|
|
25
|
-
const chunks = [];
|
|
26
|
-
let stderr = "";
|
|
27
|
-
ff.stdout.on("data", (chunk) => chunks.push(chunk));
|
|
28
|
-
ff.stderr.on("data", (chunk) => {
|
|
29
|
-
stderr += chunk.toString("utf8");
|
|
30
|
-
});
|
|
31
|
-
ff.on("error", (err) => reject(err));
|
|
32
|
-
ff.on("close", (code) => {
|
|
33
|
-
if (code !== 0) {
|
|
34
|
-
reject(new Error(`ffmpeg exited ${code}: ${stderr.trim()}`));
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
const concat = Buffer.concat(chunks);
|
|
38
|
-
// Float32Array requires a 4-byte-aligned ArrayBuffer; copy to ensure.
|
|
39
|
-
const aligned = new ArrayBuffer(concat.length);
|
|
40
|
-
new Uint8Array(aligned).set(concat);
|
|
41
|
-
resolve(new Float32Array(aligned));
|
|
42
|
-
});
|
|
43
|
-
ff.stdin.write(audio);
|
|
44
|
-
ff.stdin.end();
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=pipe.js.map
|
package/dist/voice/pipe.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pipe.js","sourceRoot":"","sources":["../../src/voice/pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,KAAa;IAC5C,OAAO,IAAI,OAAO,CAAe,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACnD,MAAM,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE;YACzB,WAAW;YACX,OAAO;YACP,IAAI;YACJ,QAAQ;YACR,KAAK;YACL,OAAO;YACP,KAAK;YACL,GAAG;YACH,IAAI;YACJ,OAAO;YACP,QAAQ;SACT,CAAC,CAAC;QACH,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QAC5D,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE;YACrC,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QACrC,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YACtB,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;gBACf,MAAM,CAAC,IAAI,KAAK,CAAC,iBAAiB,IAAI,KAAK,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;gBAC7D,OAAO;YACT,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACrC,sEAAsE;YACtE,MAAM,OAAO,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAC/C,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACpC,OAAO,CAAC,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACtB,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;IACjB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { TranscribeOptions, TranscriptionResult } from "./types.js";
|
|
2
|
-
export declare function transcribeBuffer(audio: Buffer, opts?: TranscribeOptions): Promise<TranscriptionResult>;
|
|
3
|
-
export declare function transcribeUrl(attachmentUrl: string, opts?: TranscribeOptions): Promise<TranscriptionResult>;
|
package/dist/voice/transcribe.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { logger } from "../logger.js";
|
|
2
|
-
import { getWhisper } from "./model.js";
|
|
3
|
-
import { audioToPcm } from "./pipe.js";
|
|
4
|
-
const log = logger("voice.transcribe");
|
|
5
|
-
export async function transcribeBuffer(audio, opts = {}) {
|
|
6
|
-
const startedAt = Date.now();
|
|
7
|
-
const pcm = await audioToPcm(audio);
|
|
8
|
-
const language = opts.language ?? "en";
|
|
9
|
-
const whisper = getWhisper();
|
|
10
|
-
const task = await whisper.transcribe(pcm, {
|
|
11
|
-
language,
|
|
12
|
-
format: "detail",
|
|
13
|
-
no_timestamps: false,
|
|
14
|
-
print_progress: false,
|
|
15
|
-
print_realtime: false,
|
|
16
|
-
print_special: false,
|
|
17
|
-
print_timestamps: false,
|
|
18
|
-
suppress_blank: true,
|
|
19
|
-
...(opts.initialPrompt !== undefined ? { initial_prompt: opts.initialPrompt } : {}),
|
|
20
|
-
});
|
|
21
|
-
const detailed = await task.result;
|
|
22
|
-
const segments = detailed.map((d) => ({
|
|
23
|
-
from: d.from,
|
|
24
|
-
to: d.to,
|
|
25
|
-
text: d.text.trim(),
|
|
26
|
-
confidence: typeof d.confidence === "number" ? d.confidence : 0,
|
|
27
|
-
}));
|
|
28
|
-
const text = segments.map((s) => s.text).join(" ").trim();
|
|
29
|
-
const avgLogprob = segments.length > 0
|
|
30
|
-
? segments.reduce((sum, s) => sum + s.confidence, 0) / segments.length
|
|
31
|
-
: 0;
|
|
32
|
-
const durationMs = Date.now() - startedAt;
|
|
33
|
-
log.info({ chars: text.length, segments: segments.length, avgLogprob, durationMs }, "transcribed");
|
|
34
|
-
return { text, avgLogprob, segments, language, durationMs };
|
|
35
|
-
}
|
|
36
|
-
export async function transcribeUrl(attachmentUrl, opts = {}) {
|
|
37
|
-
const res = await fetch(attachmentUrl);
|
|
38
|
-
if (!res.ok)
|
|
39
|
-
throw new Error(`attachment fetch ${res.status} for ${attachmentUrl}`);
|
|
40
|
-
const buf = Buffer.from(await res.arrayBuffer());
|
|
41
|
-
return transcribeBuffer(buf, opts);
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=transcribe.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transcribe.js","sourceRoot":"","sources":["../../src/voice/transcribe.ts"],"names":[],"mapp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