hoomanjs 1.41.0 → 1.42.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/README.md +26 -701
- package/dist/acp/acp-agent.js +48 -29
- package/dist/acp/acp-agent.js.map +1 -1
- package/dist/chat/app.js +29 -27
- package/dist/chat/app.js.map +1 -1
- package/dist/chat/components/BottomChrome.d.ts +4 -1
- package/dist/chat/components/BottomChrome.js +3 -2
- package/dist/chat/components/BottomChrome.js.map +1 -1
- package/dist/chat/components/DownloadPanel.d.ts +9 -0
- package/dist/chat/components/DownloadPanel.js +16 -0
- package/dist/chat/components/DownloadPanel.js.map +1 -0
- package/dist/chat/components/StatusBar.js +5 -5
- package/dist/chat/components/StatusBar.js.map +1 -1
- package/dist/cli.js +23 -23
- package/dist/cli.js.map +1 -1
- package/dist/configure/app.js +30 -2
- package/dist/configure/app.js.map +1 -1
- package/dist/core/agent/index.js +0 -6
- package/dist/core/agent/index.js.map +1 -1
- package/dist/core/agent/prompt-cache-plugin.d.ts +1 -1
- package/dist/core/agent/prompt-cache-plugin.js +1 -1
- package/dist/core/config.d.ts +60 -0
- package/dist/core/config.js +25 -5
- package/dist/core/config.js.map +1 -1
- package/dist/core/mcp/index.d.ts +3 -3
- package/dist/core/mcp/index.js +2 -2
- package/dist/core/mcp/index.js.map +1 -1
- package/dist/core/mcp/manager.d.ts +28 -0
- package/dist/core/mcp/manager.js +171 -2
- package/dist/core/mcp/manager.js.map +1 -1
- package/dist/core/models/anthropic.d.ts +4 -3
- package/dist/core/models/anthropic.js.map +1 -1
- package/dist/core/models/download-progress.d.ts +65 -0
- package/dist/core/models/download-progress.js +154 -0
- package/dist/core/models/download-progress.js.map +1 -0
- package/dist/core/models/index.js +1 -0
- package/dist/core/models/index.js.map +1 -1
- package/dist/core/models/llama-cpp/gbnf-schema.d.ts +32 -0
- package/dist/core/models/llama-cpp/gbnf-schema.js +272 -0
- package/dist/core/models/llama-cpp/gbnf-schema.js.map +1 -0
- package/dist/core/models/llama-cpp/index.d.ts +8 -0
- package/dist/core/models/llama-cpp/index.js +37 -0
- package/dist/core/models/llama-cpp/index.js.map +1 -0
- package/dist/core/models/llama-cpp/resolve-model.d.ts +28 -0
- package/dist/core/models/llama-cpp/resolve-model.js +307 -0
- package/dist/core/models/llama-cpp/resolve-model.js.map +1 -0
- package/dist/core/models/llama-cpp/strands-llama-cpp.d.ts +40 -0
- package/dist/core/models/llama-cpp/strands-llama-cpp.js +422 -0
- package/dist/core/models/llama-cpp/strands-llama-cpp.js.map +1 -0
- package/dist/core/models/minimax.d.ts +2 -1
- package/dist/core/models/minimax.js +49 -7
- package/dist/core/models/minimax.js.map +1 -1
- package/dist/core/models/types.d.ts +125 -7
- package/dist/core/models/types.js +22 -2
- package/dist/core/models/types.js.map +1 -1
- package/dist/core/prompts/environment.d.ts +10 -1
- package/dist/core/prompts/environment.js +15 -1
- package/dist/core/prompts/environment.js.map +1 -1
- package/dist/core/prompts/static/environment.md +2 -1
- package/dist/core/prompts/static/web-search.md +1 -1
- package/dist/core/prompts/system.d.ts +6 -0
- package/dist/core/prompts/system.js +7 -1
- package/dist/core/prompts/system.js.map +1 -1
- package/dist/core/skills/built-in/hooman-config/SKILL.md +21 -5
- package/dist/core/skills/built-in/hooman-config/providers.md +2 -0
- package/dist/core/skills/built-in/hooman-mcp/SKILL.md +20 -0
- package/dist/core/tools/ask-user.d.ts +8 -0
- package/dist/core/tools/ask-user.js +8 -4
- package/dist/core/tools/ask-user.js.map +1 -1
- package/dist/core/tools/time.js +1 -1
- package/dist/core/tools/time.js.map +1 -1
- package/dist/core/utils/logging.d.ts +29 -0
- package/dist/core/utils/logging.js +64 -0
- package/dist/core/utils/logging.js.map +1 -0
- package/dist/daemon/index.js +5 -0
- package/dist/daemon/index.js.map +1 -1
- package/dist/daemon/questions.d.ts +18 -0
- package/dist/daemon/questions.js +44 -0
- package/dist/daemon/questions.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import { existsSync } from "fs";
|
|
2
|
+
import { homedir } from "os";
|
|
3
|
+
import { basename, isAbsolute, join, sep } from "path";
|
|
4
|
+
import { downloadFileToCacheDir, listFiles } from "@huggingface/hub";
|
|
5
|
+
import { cachePath } from "../../utils/paths.js";
|
|
6
|
+
import { emitModelDownloadProgress } from "../download-progress.js";
|
|
7
|
+
/** GGUF files are cached under `~/.hooman/cache/huggingface` (HF cache layout). */
|
|
8
|
+
export const llamaCppCacheDir = () => join(cachePath(), "huggingface");
|
|
9
|
+
const SHARD_SUFFIX = /-(\d{5})-of-(\d{5})\.gguf$/i;
|
|
10
|
+
function expandHome(p) {
|
|
11
|
+
if (p === "~" || p.startsWith(`~${sep}`) || p.startsWith("~/")) {
|
|
12
|
+
return join(homedir(), p.slice(1));
|
|
13
|
+
}
|
|
14
|
+
return p;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Parse an LLM `model` value into either a local GGUF path or a Hugging Face
|
|
18
|
+
* repo designation. Accepted shapes (an optional `hf:` prefix is stripped):
|
|
19
|
+
* - `/abs/path/model.gguf`, `./rel/model.gguf`, `~/models/model.gguf`
|
|
20
|
+
* - `owner/repo` (the repo's GGUF file is auto-detected)
|
|
21
|
+
* - `owner/repo:Q8_0` (pick the variant matching a quant tag, llama.cpp style)
|
|
22
|
+
* - `owner/repo/path/to/file.gguf` (pin an exact file, e.g. a quant variant)
|
|
23
|
+
*/
|
|
24
|
+
export function parseModelSpec(model) {
|
|
25
|
+
let spec = (model.startsWith("hf:") ? model.slice(3) : model).trim();
|
|
26
|
+
if (spec.length === 0) {
|
|
27
|
+
throw new Error("llama.cpp model is not configured");
|
|
28
|
+
}
|
|
29
|
+
let quant;
|
|
30
|
+
const quantMatch = spec.match(/^([^:]+\/[^:]+):([\w.-]+)$/);
|
|
31
|
+
if (quantMatch) {
|
|
32
|
+
spec = quantMatch[1];
|
|
33
|
+
quant = quantMatch[2];
|
|
34
|
+
}
|
|
35
|
+
if (spec.toLowerCase().endsWith(".gguf")) {
|
|
36
|
+
const expanded = expandHome(spec);
|
|
37
|
+
if (isAbsolute(expanded) ||
|
|
38
|
+
spec.startsWith("./") ||
|
|
39
|
+
spec.startsWith("../") ||
|
|
40
|
+
existsSync(expanded)) {
|
|
41
|
+
return { kind: "local", path: expanded };
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const segments = spec.split("/").filter((s) => s.length > 0);
|
|
45
|
+
if (segments.length >= 3 && spec.toLowerCase().endsWith(".gguf")) {
|
|
46
|
+
return {
|
|
47
|
+
kind: "hub",
|
|
48
|
+
repo: segments.slice(0, 2).join("/"),
|
|
49
|
+
filePath: segments.slice(2).join("/"),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
if (segments.length === 2) {
|
|
53
|
+
return { kind: "hub", repo: spec, ...(quant ? { quant } : {}) };
|
|
54
|
+
}
|
|
55
|
+
throw new Error(`Invalid llama.cpp model "${model}". Use a local .gguf path, ` +
|
|
56
|
+
`"owner/repo", "owner/repo:QUANT", or "owner/repo/path/to/file.gguf".`);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Preferred quantizations when a repo ships several GGUF variants, best
|
|
60
|
+
* quality/size trade-off first. Files matching none rank after all matches.
|
|
61
|
+
*/
|
|
62
|
+
const QUANT_PREFERENCE = [
|
|
63
|
+
"q4_k_m",
|
|
64
|
+
"q4_k_s",
|
|
65
|
+
"q4_0",
|
|
66
|
+
"q5_k_m",
|
|
67
|
+
"q5_0",
|
|
68
|
+
"q6_k",
|
|
69
|
+
"q8_0",
|
|
70
|
+
"f16",
|
|
71
|
+
"bf16",
|
|
72
|
+
];
|
|
73
|
+
function quantRank(filePath) {
|
|
74
|
+
const lower = filePath.toLowerCase();
|
|
75
|
+
const index = QUANT_PREFERENCE.findIndex((quant) => lower.includes(quant));
|
|
76
|
+
return index === -1 ? QUANT_PREFERENCE.length : index;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Auto-detect the GGUF file to use in a Hugging Face repo. Ignores `mmproj`
|
|
80
|
+
* projector and `mtp` (multi-token-prediction) companion files; for sharded
|
|
81
|
+
* models returns the first shard (its siblings are downloaded alongside it).
|
|
82
|
+
* With a `quant` tag (e.g. `Q8_0` from `owner/repo:Q8_0`) only files whose
|
|
83
|
+
* name contains that tag are considered. Otherwise, when several distinct
|
|
84
|
+
* GGUF variants exist, common quantizations are preferred (Q4_K_M first) and
|
|
85
|
+
* ties break alphabetically — pin `owner/repo/file.gguf` to override.
|
|
86
|
+
*/
|
|
87
|
+
async function pickGgufFile(repo, accessToken, quant) {
|
|
88
|
+
let ggufFiles = [];
|
|
89
|
+
for await (const entry of listFiles({
|
|
90
|
+
repo,
|
|
91
|
+
recursive: true,
|
|
92
|
+
...(accessToken ? { accessToken } : {}),
|
|
93
|
+
})) {
|
|
94
|
+
const lower = entry.path.toLowerCase();
|
|
95
|
+
if (entry.type === "file" &&
|
|
96
|
+
lower.endsWith(".gguf") &&
|
|
97
|
+
!lower.includes("mmproj") &&
|
|
98
|
+
!/(^|[/-])mtp([.-]|$)/.test(lower)) {
|
|
99
|
+
ggufFiles.push(entry.path);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (ggufFiles.length === 0) {
|
|
103
|
+
throw new Error(`No .gguf file found in Hugging Face repo "${repo}".`);
|
|
104
|
+
}
|
|
105
|
+
if (quant) {
|
|
106
|
+
const tag = quant.toLowerCase();
|
|
107
|
+
const matches = ggufFiles.filter((f) => {
|
|
108
|
+
const name = f.toLowerCase();
|
|
109
|
+
// Match the tag on a word boundary (e.g. `Q8_0` should not match
|
|
110
|
+
// `UD-Q8_K_XL`, and `Q4_K_M` should not match `Q4_K_M-MTP`).
|
|
111
|
+
return new RegExp(`(^|[^a-z0-9])${tag.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}($|[^a-z0-9_])`).test(name);
|
|
112
|
+
});
|
|
113
|
+
if (matches.length === 0) {
|
|
114
|
+
throw new Error(`No .gguf file matching quant "${quant}" found in Hugging Face repo "${repo}".`);
|
|
115
|
+
}
|
|
116
|
+
ggufFiles = matches;
|
|
117
|
+
}
|
|
118
|
+
ggufFiles.sort((a, b) => quantRank(a) - quantRank(b) || a.localeCompare(b));
|
|
119
|
+
const nonShards = ggufFiles.filter((f) => !SHARD_SUFFIX.test(f));
|
|
120
|
+
if (nonShards.length > 0) {
|
|
121
|
+
return nonShards[0];
|
|
122
|
+
}
|
|
123
|
+
const firstShards = ggufFiles.filter((f) => {
|
|
124
|
+
const m = f.match(SHARD_SUFFIX);
|
|
125
|
+
return m !== null && Number(m[1]) === 1;
|
|
126
|
+
});
|
|
127
|
+
return firstShards[0] ?? ggufFiles[0];
|
|
128
|
+
}
|
|
129
|
+
/** Minimum time between "downloading" progress emissions. */
|
|
130
|
+
const PROGRESS_EMIT_INTERVAL_MS = 250;
|
|
131
|
+
/** Window over which the transfer rate (and thus the ETA) is smoothed. */
|
|
132
|
+
const SPEED_WINDOW_MS = 5_000;
|
|
133
|
+
/** Responses smaller than this are treated as API chatter, not the file. */
|
|
134
|
+
const MIN_DOWNLOAD_BODY_BYTES = 1024 * 1024;
|
|
135
|
+
/**
|
|
136
|
+
* Byte-counting `fetch` for {@link downloadFileToCacheDir} that reports
|
|
137
|
+
* download progress (percent, bytes, speed, ETA) for the file's blob GET.
|
|
138
|
+
* API calls made through the same fetch (`pathsInfo`, the `Range: bytes=0-0`
|
|
139
|
+
* download-info probe) are passed through untouched; cache hits never fetch
|
|
140
|
+
* the blob at all, so no events fire for already-downloaded models.
|
|
141
|
+
*/
|
|
142
|
+
function createProgressReporter(base) {
|
|
143
|
+
let started = false;
|
|
144
|
+
let received = 0;
|
|
145
|
+
let total;
|
|
146
|
+
let lastEmitAt = 0;
|
|
147
|
+
let samples = [];
|
|
148
|
+
const snapshot = (status) => {
|
|
149
|
+
const now = Date.now();
|
|
150
|
+
samples.push({ at: now, received });
|
|
151
|
+
samples = samples.filter((s) => now - s.at <= SPEED_WINDOW_MS);
|
|
152
|
+
const first = samples[0];
|
|
153
|
+
const elapsedMs = now - first.at;
|
|
154
|
+
const bytesPerSecond = elapsedMs > 0
|
|
155
|
+
? ((received - first.received) / elapsedMs) * 1000
|
|
156
|
+
: undefined;
|
|
157
|
+
const etaSeconds = status === "downloading" &&
|
|
158
|
+
total !== undefined &&
|
|
159
|
+
bytesPerSecond !== undefined &&
|
|
160
|
+
bytesPerSecond > 0
|
|
161
|
+
? (total - received) / bytesPerSecond
|
|
162
|
+
: undefined;
|
|
163
|
+
return {
|
|
164
|
+
...base,
|
|
165
|
+
status,
|
|
166
|
+
receivedBytes: received,
|
|
167
|
+
...(total !== undefined ? { totalBytes: total } : {}),
|
|
168
|
+
...(bytesPerSecond !== undefined && bytesPerSecond >= 0
|
|
169
|
+
? { bytesPerSecond }
|
|
170
|
+
: {}),
|
|
171
|
+
...(etaSeconds !== undefined ? { etaSeconds } : {}),
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
const countingFetch = async (input, init) => {
|
|
175
|
+
const response = await fetch(input, init);
|
|
176
|
+
const method = (init?.method ?? (input instanceof Request ? input.method : "GET")).toUpperCase();
|
|
177
|
+
const requestHeaders = new Headers(init?.headers ?? (input instanceof Request ? input.headers : undefined));
|
|
178
|
+
const contentLength = Number(response.headers.get("content-length"));
|
|
179
|
+
const isBlobDownload = method === "GET" &&
|
|
180
|
+
!requestHeaders.has("Range") &&
|
|
181
|
+
response.status === 200 &&
|
|
182
|
+
response.body !== null &&
|
|
183
|
+
(!Number.isFinite(contentLength) ||
|
|
184
|
+
contentLength >= MIN_DOWNLOAD_BODY_BYTES);
|
|
185
|
+
if (!isBlobDownload) {
|
|
186
|
+
return response;
|
|
187
|
+
}
|
|
188
|
+
started = true;
|
|
189
|
+
received = 0;
|
|
190
|
+
samples = [];
|
|
191
|
+
total =
|
|
192
|
+
Number.isFinite(contentLength) && contentLength > 0
|
|
193
|
+
? contentLength
|
|
194
|
+
: undefined;
|
|
195
|
+
emitModelDownloadProgress(snapshot("downloading"));
|
|
196
|
+
lastEmitAt = Date.now();
|
|
197
|
+
const counted = response.body.pipeThrough(new TransformStream({
|
|
198
|
+
transform: (chunk, controller) => {
|
|
199
|
+
received += chunk.byteLength;
|
|
200
|
+
const now = Date.now();
|
|
201
|
+
if (now - lastEmitAt >= PROGRESS_EMIT_INTERVAL_MS) {
|
|
202
|
+
lastEmitAt = now;
|
|
203
|
+
emitModelDownloadProgress(snapshot("downloading"));
|
|
204
|
+
}
|
|
205
|
+
controller.enqueue(chunk);
|
|
206
|
+
},
|
|
207
|
+
}));
|
|
208
|
+
return new Response(counted, {
|
|
209
|
+
status: response.status,
|
|
210
|
+
statusText: response.statusText,
|
|
211
|
+
headers: response.headers,
|
|
212
|
+
});
|
|
213
|
+
};
|
|
214
|
+
return {
|
|
215
|
+
fetch: countingFetch,
|
|
216
|
+
done: () => {
|
|
217
|
+
if (started) {
|
|
218
|
+
emitModelDownloadProgress(snapshot("done"));
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
error: (message) => {
|
|
222
|
+
if (started) {
|
|
223
|
+
emitModelDownloadProgress({ ...snapshot("error"), error: message });
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
/** Download one file with progress reporting (cache hits stay silent). */
|
|
229
|
+
async function downloadFileWithProgress(options) {
|
|
230
|
+
const reporter = createProgressReporter({
|
|
231
|
+
model: options.model,
|
|
232
|
+
file: basename(options.filePath),
|
|
233
|
+
...(options.shard ? { shard: options.shard } : {}),
|
|
234
|
+
});
|
|
235
|
+
try {
|
|
236
|
+
// `xet: false` forces the plain-HTTP single-stream download path instead
|
|
237
|
+
// of xet chunk reconstruction, so the counting fetch sees one measurable
|
|
238
|
+
// response. `downloadFileToCacheDir` forwards extra params to
|
|
239
|
+
// `downloadFile`, which honors it; the option just isn't in its public
|
|
240
|
+
// type, hence the cast.
|
|
241
|
+
const params = {
|
|
242
|
+
repo: options.repo,
|
|
243
|
+
path: options.filePath,
|
|
244
|
+
cacheDir: options.cacheDir,
|
|
245
|
+
fetch: reporter.fetch,
|
|
246
|
+
...options.credentials,
|
|
247
|
+
xet: false,
|
|
248
|
+
};
|
|
249
|
+
const local = await downloadFileToCacheDir(params);
|
|
250
|
+
reporter.done();
|
|
251
|
+
return local;
|
|
252
|
+
}
|
|
253
|
+
catch (e) {
|
|
254
|
+
reporter.error(e instanceof Error ? e.message : String(e));
|
|
255
|
+
throw e;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Resolve a model spec to a local GGUF file path, downloading it from the
|
|
260
|
+
* Hugging Face Hub into the Hooman cache when needed. For sharded GGUFs all
|
|
261
|
+
* shards are fetched and the first shard's path is returned (llama.cpp finds
|
|
262
|
+
* the siblings next to it). Download progress is reported process-wide via
|
|
263
|
+
* `subscribeModelDownloadProgress` (see `../download-progress.ts`).
|
|
264
|
+
*/
|
|
265
|
+
export async function resolveModelFile(model, hfToken) {
|
|
266
|
+
const parsed = parseModelSpec(model);
|
|
267
|
+
if (parsed.kind === "local") {
|
|
268
|
+
if (!existsSync(parsed.path)) {
|
|
269
|
+
throw new Error(`llama.cpp model file not found: ${parsed.path}`);
|
|
270
|
+
}
|
|
271
|
+
return parsed.path;
|
|
272
|
+
}
|
|
273
|
+
const accessToken = hfToken?.trim() || process.env.HF_TOKEN?.trim();
|
|
274
|
+
const filePath = parsed.filePath ??
|
|
275
|
+
(await pickGgufFile(parsed.repo, accessToken, parsed.quant));
|
|
276
|
+
const credentials = accessToken ? { accessToken } : {};
|
|
277
|
+
const cacheDir = llamaCppCacheDir();
|
|
278
|
+
const shardMatch = filePath.match(SHARD_SUFFIX);
|
|
279
|
+
if (shardMatch) {
|
|
280
|
+
const total = Number(shardMatch[2]);
|
|
281
|
+
const prefix = filePath.slice(0, -shardMatch[0].length);
|
|
282
|
+
let firstShardPath;
|
|
283
|
+
for (let i = 1; i <= total; i++) {
|
|
284
|
+
const shard = `${prefix}-${String(i).padStart(5, "0")}-of-${shardMatch[2]}.gguf`;
|
|
285
|
+
const local = await downloadFileWithProgress({
|
|
286
|
+
repo: parsed.repo,
|
|
287
|
+
filePath: shard,
|
|
288
|
+
cacheDir,
|
|
289
|
+
credentials,
|
|
290
|
+
model,
|
|
291
|
+
shard: { index: i, total },
|
|
292
|
+
});
|
|
293
|
+
if (i === 1) {
|
|
294
|
+
firstShardPath = local;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return firstShardPath;
|
|
298
|
+
}
|
|
299
|
+
return downloadFileWithProgress({
|
|
300
|
+
repo: parsed.repo,
|
|
301
|
+
filePath,
|
|
302
|
+
cacheDir,
|
|
303
|
+
credentials,
|
|
304
|
+
model,
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
//# sourceMappingURL=resolve-model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-model.js","sourceRoot":"","sources":["../../../../src/core/models/llama-cpp/resolve-model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAGpE,mFAAmF;AACnF,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,aAAa,CAAC,CAAC;AAMvE,MAAM,YAAY,GAAG,6BAA6B,CAAC;AAEnD,SAAS,UA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MAAM,CAAC,IAAI;gBACjB,QAAQ,EAAE,KAAK;gBACf,QAAQ;gBACR,WAAW;gBACX,KAAK;gBACL,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE;aAC3B,CAAC,CAAC;YACH,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;gBACZ,cAAc,GAAG,KAAK,CAAC;YACzB,CAAC;QACH,CAAC;QACD,OAAO,cAAe,CAAC;IACzB,CAAC;IAED,OAAO,wBAAwB,CAAC;QAC9B,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,QAAQ;QACR,QAAQ;QACR,WAAW;QACX,KAAK;KACN,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Model } from "@strands-agents/sdk";
|
|
2
|
+
import type { BaseModelConfig, Message, StreamOptions } from "@strands-agents/sdk";
|
|
3
|
+
import type { ModelStreamEvent } from "@strands-agents/sdk";
|
|
4
|
+
export interface LlamaCppModelConfig extends BaseModelConfig {
|
|
5
|
+
/**
|
|
6
|
+
* Model spec: local `.gguf` path, `owner/repo` Hugging Face repo (GGUF file
|
|
7
|
+
* auto-detected), or `owner/repo/path/to/file.gguf`.
|
|
8
|
+
*/
|
|
9
|
+
modelId?: string;
|
|
10
|
+
/** Hugging Face access token for gated/private repos (falls back to `HF_TOKEN`). */
|
|
11
|
+
hfToken?: string;
|
|
12
|
+
/** GPU backend forwarded to `getLlama` (default `"auto"`). `false` = CPU only. */
|
|
13
|
+
gpu?: "auto" | "metal" | "cuda" | "vulkan" | false;
|
|
14
|
+
/** Context size in tokens (default: adapted to the model and free VRAM/RAM). */
|
|
15
|
+
contextSize?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Thinking controls. Presence enables reasoning: the resolved chat wrapper is
|
|
18
|
+
* configured to allow thought segments (Qwen `thoughts: "auto"`, Gemma 4
|
|
19
|
+
* `reasoning: true`, Harmony `reasoningEffort` mapped from `effort`). Absence
|
|
20
|
+
* disables it: wrappers are told to discourage thoughts and the thought-token
|
|
21
|
+
* budget is forced to `0` so stray thought segments are closed immediately.
|
|
22
|
+
*/
|
|
23
|
+
reasoning?: {
|
|
24
|
+
effort?: "minimal" | "low" | "medium" | "high";
|
|
25
|
+
};
|
|
26
|
+
/** Cap on thought-segment tokens while reasoning is enabled. */
|
|
27
|
+
thoughtBudgetTokens?: number;
|
|
28
|
+
}
|
|
29
|
+
/** Strands {@link Model} backed by in-process llama.cpp via `node-llama-cpp`. */
|
|
30
|
+
export declare class StrandsLlamaCppModel extends Model<LlamaCppModelConfig> {
|
|
31
|
+
private config;
|
|
32
|
+
private chatPromise;
|
|
33
|
+
private context;
|
|
34
|
+
constructor(config: LlamaCppModelConfig);
|
|
35
|
+
updateConfig(modelConfig: LlamaCppModelConfig): void;
|
|
36
|
+
getConfig(): LlamaCppModelConfig;
|
|
37
|
+
private getChat;
|
|
38
|
+
private initChat;
|
|
39
|
+
stream(messages: Message[], options?: StreamOptions): AsyncIterable<ModelStreamEvent>;
|
|
40
|
+
}
|