tryharness 0.7.53 → 0.7.57
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/README.md +23 -19
- package/assets/dsh-plugin.mjs +72 -0
- package/assets/opencode-plugin.js +4 -3
- package/cli.mjs +484 -90
- package/lib/activity.mjs +10 -10
- package/lib/adapters.mjs +173 -222
- package/lib/agentBinaries.mjs +71 -0
- package/lib/agentRuntimeConfig.mjs +1 -1
- package/lib/agentRuntimes.mjs +34 -18
- package/lib/agentSignIn.mjs +456 -0
- package/lib/answers.mjs +5 -5
- package/lib/archetypes.d.ts +64 -0
- package/lib/archetypes.js +989 -0
- package/lib/asks.mjs +4 -4
- package/lib/audit.mjs +666 -0
- package/lib/backupSetup.mjs +143 -0
- package/lib/boardAccess.mjs +24 -11
- package/lib/boardBackup.mjs +283 -0
- package/lib/boardFileCommands.mjs +6 -6
- package/lib/boardFiles.mjs +13 -12
- package/lib/boardMirror.mjs +124 -25
- package/lib/boardProtocol.json +88 -2
- package/lib/boardWaits.mjs +101 -0
- package/lib/book.mjs +659 -0
- package/lib/bridge.mjs +6 -6
- package/lib/cards.mjs +138 -28
- package/lib/cloudAgents.mjs +216 -0
- package/lib/cloudAi.mjs +1312 -0
- package/lib/cloudAssistants.mjs +242 -0
- package/lib/cloudBoot.mjs +119 -0
- package/lib/cloudSave.mjs +197 -0
- package/lib/cloudSsh.mjs +178 -0
- package/lib/commands.mjs +7 -2
- package/lib/context.mjs +19 -5
- package/lib/contractGate.mjs +399 -0
- package/lib/control-client.mjs +9 -1
- package/lib/controlSocket.mjs +86 -0
- package/lib/coordinator.mjs +252 -144
- package/lib/daemon.mjs +1351 -2767
- package/lib/desk.mjs +240 -0
- package/lib/desktop.mjs +178 -74
- package/lib/directLink.mjs +16 -5
- package/lib/environment.mjs +2 -1
- package/lib/environments.mjs +247 -9
- package/lib/firewall.mjs +9 -9
- package/lib/folders.mjs +20 -16
- package/lib/frames.mjs +2 -3
- package/lib/gitHost.mjs +174 -0
- package/lib/goalCommands.mjs +25 -7
- package/lib/goals.mjs +7 -7
- package/lib/guestRequests.mjs +94 -0
- package/lib/handoffs.mjs +8 -7
- package/lib/handover.mjs +4 -4
- package/lib/harnessModel.mjs +6 -6
- package/lib/harnessOffers.mjs +266 -0
- package/lib/hookDialects.mjs +298 -0
- package/lib/inference.mjs +26 -8
- package/lib/jobAnswers.mjs +190 -0
- package/lib/landed.mjs +887 -0
- package/lib/lane.mjs +42 -11
- package/lib/lessons.mjs +16 -16
- package/lib/library.mjs +3 -3
- package/lib/lineup.mjs +3 -0
- package/lib/linkRelay.mjs +574 -0
- package/lib/live.mjs +284 -13
- package/lib/localAgentAsk.mjs +74 -0
- package/lib/localStack.mjs +536 -0
- package/lib/localmodels.mjs +6 -4
- package/lib/loopBackstop.mjs +4 -4
- package/lib/machineIdentity.mjs +9 -1
- package/lib/machineRoutes.mjs +181 -2
- package/lib/machineRuns.mjs +76 -1
- package/lib/machineSeal.mjs +39 -12
- package/lib/mcp-stdio.mjs +163 -27
- package/lib/mcpRelay.mjs +1 -1
- package/lib/members.json +29 -2
- package/lib/members.mjs +1 -1
- package/lib/models.mjs +85 -31
- package/lib/museSession.mjs +21 -13
- package/lib/nativeHost.mjs +36 -8
- package/lib/neovim.mjs +126 -0
- package/lib/network.mjs +50 -5
- package/lib/notify.mjs +7 -5
- package/lib/nudge.mjs +50 -19
- package/lib/ocr.mjs +9 -9
- package/lib/onboard.mjs +26 -20
- package/lib/oneLine.mjs +7 -7
- package/lib/ownMachines.mjs +1223 -140
- package/lib/pairing.mjs +60 -16
- package/lib/paths.mjs +19 -1
- package/lib/peerProcess.mjs +124 -0
- package/lib/personModel.mjs +89 -0
- package/lib/personNotices.mjs +151 -0
- package/lib/phones.mjs +538 -31
- package/lib/placeCommands.mjs +4 -4
- package/lib/places.mjs +400 -12
- package/lib/profile.mjs +67 -14
- package/lib/projectGit.mjs +158 -14
- package/lib/projectPieces.mjs +902 -0
- package/lib/projectSettings.mjs +7 -4
- package/lib/projects.mjs +384 -62
- package/lib/provenance.mjs +5 -1
- package/lib/proxyLinks.mjs +267 -0
- package/lib/reactions.mjs +7 -5
- package/lib/readiness.mjs +145 -23
- package/lib/record.mjs +128 -0
- package/lib/redact.mjs +4 -4
- package/lib/relayLimits.mjs +62 -0
- package/lib/release.mjs +170 -0
- package/lib/releaseKeys.json +6 -0
- package/lib/repoLinks.mjs +4 -4
- package/lib/roomChannels.mjs +24 -0
- package/lib/roomPage.mjs +1 -1
- package/lib/runAuthority.mjs +101 -0
- package/lib/runBrief.mjs +19 -8
- package/lib/runWorker.mjs +31 -7
- package/lib/runner.mjs +223 -29
- package/lib/runtime-install.mjs +143 -9
- package/lib/schedules.mjs +2 -2
- package/lib/screens.mjs +1 -1
- package/lib/sealed.mjs +11 -2
- package/lib/sealedThreads.mjs +671 -0
- package/lib/secretPatterns.json +1 -1
- package/lib/secrets.mjs +4 -4
- package/lib/seen.mjs +6 -6
- package/lib/serverWords.mjs +175 -0
- package/lib/service.mjs +22 -12
- package/lib/sessionControl.mjs +378 -90
- package/lib/specialties.json +74 -0
- package/lib/specialties.mjs +477 -0
- package/lib/specialtyKeys.d.ts +3 -0
- package/lib/specialtyKeys.js +57 -0
- package/lib/specialtyNotice.mjs +147 -0
- package/lib/specialtySnapshot.mjs +138 -0
- package/lib/speech.mjs +5 -5
- package/lib/store.mjs +420 -36
- package/lib/stuck.mjs +1 -1
- package/lib/swarm.mjs +304 -37
- package/lib/swarmDevices.mjs +319 -0
- package/lib/swarmMemory.mjs +27 -25
- package/lib/t3.mjs +24 -15
- package/lib/taskCommands.mjs +80 -20
- package/lib/taskRooms.mjs +125 -0
- package/lib/taskRuns.mjs +45 -3
- package/lib/team.json +255 -148
- package/lib/team.mjs +554 -190
- package/lib/threadActions.mjs +315 -0
- package/lib/threadAuthority.mjs +101 -0
- package/lib/threadBriefs.mjs +178 -0
- package/lib/threadLine.mjs +116 -0
- package/lib/threadRuns.mjs +209 -50
- package/lib/threadView.mjs +20 -7
- package/lib/usageTotals.mjs +2 -3
- package/lib/vault.mjs +101 -10
- package/lib/vaultCloud.mjs +2 -2
- package/lib/vaultCommands.mjs +15 -6
- package/lib/vaultTools.js +2 -2
- package/lib/verdicts.mjs +328 -0
- package/lib/wakes.mjs +1 -1
- package/lib/watches.mjs +2 -2
- package/lib/windowAsks.mjs +13 -5
- package/lib/worktrees.mjs +157 -25
- package/npm-shrinkwrap.json +1093 -0
- package/package.json +12 -11
- package/release.json +220 -0
- package/lib/modelTiers.json +0 -1183
- package/lib/modelTiers.mjs +0 -133
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { nameOf } from "./members.mjs";
|
|
3
|
+
import { notifyDesktop } from "./notify.mjs";
|
|
4
|
+
import { underperforming as fromRecord } from "./record.mjs";
|
|
5
|
+
|
|
6
|
+
// When an agent is not living up to a specialty it carries: three or more runs with a verdict in it on its model, more
|
|
7
|
+
// rejected than accepted. The liaison tells the person once per agent, specialty and model, in the facts: a needs-you
|
|
8
|
+
// item of kind "agent" that opens the agent in the Swarm map, a notice on this computer and one on their phone. The
|
|
9
|
+
// item waits until the person keeps the specialty or removes it; the notice is never sent again for the same agent,
|
|
10
|
+
// specialty and model, kept or not.
|
|
11
|
+
|
|
12
|
+
const LIST = JSON.parse(
|
|
13
|
+
readFileSync(new URL("./specialties.json", import.meta.url), "utf8")
|
|
14
|
+
);
|
|
15
|
+
const NAMES = new Map(
|
|
16
|
+
LIST.headings.flatMap((heading) =>
|
|
17
|
+
heading.specialties.map((specialty) => [specialty.id, specialty.name])
|
|
18
|
+
)
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
// How often the record is read again for a step down. A verdict changes the record a few times a day at most.
|
|
22
|
+
const CHECK_EVERY_MS = 60_000;
|
|
23
|
+
|
|
24
|
+
// An item's id names the agent, specialty and model, in the characters a phone notice's address
|
|
25
|
+
// allows (as Harness's server sends those notices).
|
|
26
|
+
const idPart = (text) => String(text).replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
27
|
+
export const noticeIdOf = ({ agent, specialty, model }) =>
|
|
28
|
+
`agent:${idPart(agent)}:${idPart(specialty)}:${idPart(model)}`;
|
|
29
|
+
|
|
30
|
+
// "flint-local/flint" reads "flint": the model, not the provider it is reached through.
|
|
31
|
+
const modelName = (model) => String(model).split("/").at(-1);
|
|
32
|
+
|
|
33
|
+
/** The facts, as every surface says them: "Pi has had 1 of 4 debugging runs accepted on flint. Keep its …?" */
|
|
34
|
+
export function noticeWords({ agent, model, specialty, accepted, judged }) {
|
|
35
|
+
const name = NAMES.get(specialty) ?? specialty;
|
|
36
|
+
return `${nameOf(agent)} has had ${accepted} of ${judged} ${name} runs accepted on ${modelName(model)}. Keep its ${name} specialty?`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function createSpecialtyNotice({
|
|
40
|
+
store,
|
|
41
|
+
log = () => {},
|
|
42
|
+
// The record's step downs (record.mjs).
|
|
43
|
+
underperforming = fromRecord,
|
|
44
|
+
// Whether the agent still carries the specialty on that model: one the person removed waits on nobody.
|
|
45
|
+
carries = () => true,
|
|
46
|
+
// A notice on this computer: the daemon's, which the buddy posts itself while it runs, so a click opens the item
|
|
47
|
+
// ("agent:<id>" opens the agent in the Swarm map).
|
|
48
|
+
desktop = (title, line) => notifyDesktop(`${title}: ${line}`),
|
|
49
|
+
// Whether this computer may show a notice now (the person's notifications on, the lid not closed).
|
|
50
|
+
speaks = () => true,
|
|
51
|
+
// A message to Harness's server for the person's phone: ids only, never words.
|
|
52
|
+
phone = () => {},
|
|
53
|
+
now = () => new Date(),
|
|
54
|
+
}) {
|
|
55
|
+
/** Said once: on this computer in words, and to the phone as only the kind, the agent and the item. */
|
|
56
|
+
function tell(item) {
|
|
57
|
+
if (speaks())
|
|
58
|
+
desktop("Your swarm", item.text, `agent:${item.agent}`, item.id);
|
|
59
|
+
phone({
|
|
60
|
+
type: "needs_you",
|
|
61
|
+
kind: "agent",
|
|
62
|
+
agent: item.agent,
|
|
63
|
+
item: item.id,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const keptKey = (id) => `specialty-kept:${id}`;
|
|
68
|
+
const toldKey = (id) => `told:${id}`;
|
|
69
|
+
|
|
70
|
+
/** Each step down the person has not answered, as a needs-you item. */
|
|
71
|
+
function current() {
|
|
72
|
+
let found = [];
|
|
73
|
+
try {
|
|
74
|
+
found = underperforming(store);
|
|
75
|
+
} catch (error) {
|
|
76
|
+
log(`specialty notice: the record could not be read: ${error.message}`);
|
|
77
|
+
}
|
|
78
|
+
return found
|
|
79
|
+
.filter((step) => carries(step.agent, step.model, step.specialty))
|
|
80
|
+
.map((step) => {
|
|
81
|
+
const id = noticeIdOf(step);
|
|
82
|
+
return {
|
|
83
|
+
id,
|
|
84
|
+
kind: "agent",
|
|
85
|
+
agent: step.agent,
|
|
86
|
+
specialty: step.specialty,
|
|
87
|
+
specialtyName: NAMES.get(step.specialty) ?? step.specialty,
|
|
88
|
+
model: step.model,
|
|
89
|
+
accepted: step.accepted,
|
|
90
|
+
judged: step.judged,
|
|
91
|
+
text: noticeWords(step),
|
|
92
|
+
at: store.meta(toldKey(id)) || now().toISOString(),
|
|
93
|
+
};
|
|
94
|
+
})
|
|
95
|
+
.filter((item) => !store.meta(keptKey(item.id)));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** Tells each step down not told before; marked told first, so a failure to say it never says it twice. */
|
|
99
|
+
function check() {
|
|
100
|
+
for (const item of current()) {
|
|
101
|
+
if (store.meta(toldKey(item.id))) continue;
|
|
102
|
+
store.meta(toldKey(item.id), item.at);
|
|
103
|
+
try {
|
|
104
|
+
tell(item);
|
|
105
|
+
} catch (error) {
|
|
106
|
+
log(`specialty notice: ${item.id} not told: ${error.message}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** The person keeps the specialty: the item goes, and the notice is not sent again. Only the person answers. */
|
|
112
|
+
function command(request, agent) {
|
|
113
|
+
if (agent !== "user")
|
|
114
|
+
return {
|
|
115
|
+
ok: false,
|
|
116
|
+
error: "only the person keeps or removes an agent's specialty",
|
|
117
|
+
};
|
|
118
|
+
const id = String(request.item || "");
|
|
119
|
+
if (request.answer !== "keep")
|
|
120
|
+
return {
|
|
121
|
+
ok: false,
|
|
122
|
+
error:
|
|
123
|
+
'answer "keep"; to remove the specialty, remove it from the agent in the Swarm map',
|
|
124
|
+
};
|
|
125
|
+
const item = current().find((each) => each.id === id);
|
|
126
|
+
if (!item) return { ok: false, error: "that is no longer waiting on you" };
|
|
127
|
+
store.meta(keptKey(id), now().toISOString());
|
|
128
|
+
return { ok: true, item: id };
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
let timer = null;
|
|
132
|
+
return {
|
|
133
|
+
/** What waits on the person now, oldest first. */
|
|
134
|
+
needs: () => current().sort((a, b) => a.at.localeCompare(b.at)),
|
|
135
|
+
check,
|
|
136
|
+
command,
|
|
137
|
+
start() {
|
|
138
|
+
check();
|
|
139
|
+
timer ??= setInterval(check, CHECK_EVERY_MS);
|
|
140
|
+
timer.unref?.();
|
|
141
|
+
},
|
|
142
|
+
stop() {
|
|
143
|
+
clearInterval(timer);
|
|
144
|
+
timer = null;
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { effortKey, modelKey } from "./specialtyKeys.js";
|
|
2
|
+
|
|
3
|
+
// What public benchmarks show each agent's model does well, as Harness's server last sent it: the weekly specialty
|
|
4
|
+
// job's snapshot, fetched with the `specialties` bridge message when the server connects and once a day, the way
|
|
5
|
+
// harnessModel.mjs fetches Harness's catalog. The last good copy is kept in the board's meta, so a relay that cannot
|
|
6
|
+
// reach Harness still reads it, and a server with no snapshot or a failed fetch never empties it.
|
|
7
|
+
//
|
|
8
|
+
// The snapshot keeps results for a harness and model together and for the model alone; reading it for an agent prefers
|
|
9
|
+
// the agent's own harness, then the model alone.
|
|
10
|
+
|
|
11
|
+
const STORE_KEY = "specialty-snapshot";
|
|
12
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
13
|
+
|
|
14
|
+
const parsed = (text) => {
|
|
15
|
+
try {
|
|
16
|
+
return JSON.parse(text || "null");
|
|
17
|
+
} catch {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const isSnapshot = (value) =>
|
|
23
|
+
Boolean(value) &&
|
|
24
|
+
Number.isFinite(value.version) &&
|
|
25
|
+
Array.isArray(value.entries) &&
|
|
26
|
+
Array.isArray(value.sources);
|
|
27
|
+
|
|
28
|
+
// The relay's one snapshot, for readers that have no handle on it (specialties.mjs reads it through snapshotFor).
|
|
29
|
+
let current = null;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* `ask()` sends the `specialties` bridge message and resolves with Harness's answer ({ ok, list, snapshot }), or with
|
|
33
|
+
* null when this Harness does not offer it (an older server, or not connected).
|
|
34
|
+
*/
|
|
35
|
+
export function createSpecialtySnapshot({ ask, store, log }) {
|
|
36
|
+
/** { at, list, snapshot } as last fetched, plus the last fetch's error. */
|
|
37
|
+
let copy = parsed(store.meta(STORE_KEY));
|
|
38
|
+
|
|
39
|
+
const keep = (next) => {
|
|
40
|
+
copy = next;
|
|
41
|
+
store.meta(STORE_KEY, JSON.stringify(next));
|
|
42
|
+
};
|
|
43
|
+
const noteError = (message) => {
|
|
44
|
+
log(`Specialties from Harness: ${message}`);
|
|
45
|
+
keep({ ...(copy ?? {}), error: String(message).slice(0, 300) });
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/** Fetches the snapshot; true when a new copy was kept. A failure or an empty answer keeps the last copy. */
|
|
49
|
+
async function refresh() {
|
|
50
|
+
let reply;
|
|
51
|
+
try {
|
|
52
|
+
reply = await ask();
|
|
53
|
+
} catch (error) {
|
|
54
|
+
noteError(error.message);
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
if (reply == null) return false;
|
|
58
|
+
if (!reply.ok) {
|
|
59
|
+
noteError(reply.error || "Harness refused the request");
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
// Harness has had no good run yet: whatever this relay kept stays.
|
|
63
|
+
if (reply.snapshot == null) return false;
|
|
64
|
+
if (!isSnapshot(reply.snapshot)) {
|
|
65
|
+
noteError("the snapshot Harness sent is malformed");
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
keep({
|
|
69
|
+
at: new Date().toISOString(),
|
|
70
|
+
list: reply.list ?? copy?.list ?? null,
|
|
71
|
+
snapshot: reply.snapshot,
|
|
72
|
+
});
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* An agent's benchmark specialties on its model: [{ specialty, source, score, url, takenAt }], one per specialty and
|
|
78
|
+
* source. A result for this harness wins over the model alone; an effort-specific one over one with no effort named.
|
|
79
|
+
* [] before the first fetch, and for a model no source covers.
|
|
80
|
+
*/
|
|
81
|
+
function snapshotFor({ harness = null, model = null, effort = null } = {}) {
|
|
82
|
+
const entries = copy?.snapshot?.entries ?? [];
|
|
83
|
+
const key = modelKey(model);
|
|
84
|
+
if (!key) return [];
|
|
85
|
+
const level = effortKey(effort);
|
|
86
|
+
const fits = entries.filter(
|
|
87
|
+
(entry) =>
|
|
88
|
+
entry.model === key &&
|
|
89
|
+
(entry.harness === null || entry.harness === harness) &&
|
|
90
|
+
(entry.effort === null || entry.effort === level)
|
|
91
|
+
);
|
|
92
|
+
const closeness = (entry) =>
|
|
93
|
+
(entry.harness === harness && harness !== null ? 2 : 0) +
|
|
94
|
+
(entry.effort !== null ? 1 : 0);
|
|
95
|
+
const best = new Map();
|
|
96
|
+
for (const entry of fits) {
|
|
97
|
+
const slot = `${entry.specialty}\u0000${entry.source}`;
|
|
98
|
+
const held = best.get(slot);
|
|
99
|
+
if (!held || closeness(entry) > closeness(held)) best.set(slot, entry);
|
|
100
|
+
}
|
|
101
|
+
return [...best.values()].map((entry) => ({
|
|
102
|
+
specialty: entry.specialty,
|
|
103
|
+
source: entry.sourceName ?? entry.source,
|
|
104
|
+
score: entry.score,
|
|
105
|
+
url: entry.url,
|
|
106
|
+
takenAt: entry.takenAt,
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
let timer = null;
|
|
111
|
+
/** Fetches once a day from now on. */
|
|
112
|
+
function start() {
|
|
113
|
+
if (timer) return;
|
|
114
|
+
timer = setInterval(() => void refresh(), DAY_MS);
|
|
115
|
+
timer.unref?.();
|
|
116
|
+
}
|
|
117
|
+
function stop() {
|
|
118
|
+
clearInterval(timer);
|
|
119
|
+
timer = null;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** For the buddy: the snapshot's version and date, when it was fetched and the last error. */
|
|
123
|
+
const view = () => ({
|
|
124
|
+
version: copy?.snapshot?.version ?? null,
|
|
125
|
+
takenAt: copy?.snapshot?.takenAt ?? null,
|
|
126
|
+
fetchedAt: copy?.at ?? null,
|
|
127
|
+
...(copy?.error ? { error: copy.error } : {}),
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
const instance = { refresh, start, stop, snapshotFor, view };
|
|
131
|
+
current = instance;
|
|
132
|
+
return instance;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** snapshotFor of the relay's snapshot; [] before one is created or fetched. */
|
|
136
|
+
export function snapshotFor(query) {
|
|
137
|
+
return current ? current.snapshotFor(query) : [];
|
|
138
|
+
}
|
package/lib/speech.mjs
CHANGED
|
@@ -15,9 +15,9 @@ import {
|
|
|
15
15
|
// keyboard or silence writes nothing. On a Mac with macOS 26, Apple's own transcriber writes the words (the buddy's
|
|
16
16
|
// HarnessSpeech helper), steered toward the names the relay knows; elsewhere Parakeet does (its feature extractor,
|
|
17
17
|
// encoder and token-and-duration decode in plain JS on ONNX Runtime), and the names the relay knows (its agents, the
|
|
18
|
-
// person's folders and files) replace what it made of them when they sound alike. Moonshine stays
|
|
19
|
-
//
|
|
20
|
-
// Choices measured
|
|
18
|
+
// person's folders and files) replace what it made of them when they sound alike. Moonshine stays as the baseline it
|
|
19
|
+
// was measured against. The models are "extended": downloaded the first time the person holds Talk, never at setup.
|
|
20
|
+
// Choices measured on synthetic requests and real people reading.
|
|
21
21
|
|
|
22
22
|
export const RATE = 16_000;
|
|
23
23
|
export const SPEECH_IDS = ["vad", "speech"];
|
|
@@ -101,7 +101,7 @@ export function decodeWav(bytes) {
|
|
|
101
101
|
return { sampleRate: format.rate, samples };
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
/** 16-bit mono WAV bytes for samples at a rate (the buddy's recordings,
|
|
104
|
+
/** 16-bit mono WAV bytes for samples at a rate (the buddy's recordings, test clips). */
|
|
105
105
|
export function encodeWav(samples, sampleRate = RATE) {
|
|
106
106
|
const out = Buffer.alloc(44 + samples.length * 2);
|
|
107
107
|
out.write("RIFF", 0);
|
|
@@ -921,7 +921,7 @@ export function snapNames(text, entries, common = new Set()) {
|
|
|
921
921
|
const window = tokens.slice(i, i + n);
|
|
922
922
|
const between = String(text).slice(window[0].at, window.at(-1).end);
|
|
923
923
|
// Words run together only across spaces, commas, dots and hyphens.
|
|
924
|
-
if (/[^A-Za-z0-9\s
|
|
924
|
+
if (/[^A-Za-z0-9\s,.-]/.test(between)) break;
|
|
925
925
|
const dotted =
|
|
926
926
|
n > 1 &&
|
|
927
927
|
(/\./.test(between) ||
|