@hanhnd/agent-kit 1.0.41 → 1.0.42
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/cli.js +11 -10
- package/dist/server.js +11 -10
- package/dist/services/digest/digest-llama-local.test.js +58 -15
- package/dist/services/digest/model-registry.js +9 -9
- package/dist/services/digest/providers/llama-local.d.ts +3 -0
- package/dist/services/digest/providers/llama-local.js +4 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -15136,26 +15136,26 @@ var DigestModelRegistryError = class extends Error {
|
|
|
15136
15136
|
var DIGEST_MODEL_REGISTRY = {
|
|
15137
15137
|
["tiny" /* TINY */]: {
|
|
15138
15138
|
id: "tiny" /* TINY */,
|
|
15139
|
-
ggufUri: "hf:
|
|
15140
|
-
approxSizeBytes:
|
|
15139
|
+
ggufUri: "hf:lmstudio-community/Qwen3.5-0.8B-GGUF/Qwen3.5-0.8B-Q4_K_M.gguf",
|
|
15140
|
+
approxSizeBytes: 528e6,
|
|
15141
15141
|
license: "Apache-2.0",
|
|
15142
|
-
sourceUrl: "https://huggingface.co/
|
|
15142
|
+
sourceUrl: "https://huggingface.co/lmstudio-community/Qwen3.5-0.8B-GGUF",
|
|
15143
15143
|
enabled: true
|
|
15144
15144
|
},
|
|
15145
15145
|
["base" /* BASE */]: {
|
|
15146
15146
|
id: "base" /* BASE */,
|
|
15147
|
-
ggufUri: "hf:
|
|
15148
|
-
approxSizeBytes:
|
|
15147
|
+
ggufUri: "hf:lmstudio-community/Qwen3.5-2B-GGUF/Qwen3.5-2B-Q4_K_M.gguf",
|
|
15148
|
+
approxSizeBytes: 127e7,
|
|
15149
15149
|
license: "Apache-2.0",
|
|
15150
|
-
sourceUrl: "https://huggingface.co/
|
|
15150
|
+
sourceUrl: "https://huggingface.co/lmstudio-community/Qwen3.5-2B-GGUF",
|
|
15151
15151
|
enabled: true
|
|
15152
15152
|
},
|
|
15153
15153
|
["large" /* LARGE */]: {
|
|
15154
15154
|
id: "large" /* LARGE */,
|
|
15155
|
-
ggufUri: "hf:
|
|
15156
|
-
approxSizeBytes:
|
|
15155
|
+
ggufUri: "hf:lmstudio-community/Qwen3.5-4B-GGUF/Qwen3.5-4B-Q4_K_M.gguf",
|
|
15156
|
+
approxSizeBytes: 271e7,
|
|
15157
15157
|
license: "Apache-2.0",
|
|
15158
|
-
sourceUrl: "https://huggingface.co/
|
|
15158
|
+
sourceUrl: "https://huggingface.co/lmstudio-community/Qwen3.5-4B-GGUF",
|
|
15159
15159
|
enabled: true
|
|
15160
15160
|
}
|
|
15161
15161
|
};
|
|
@@ -15315,7 +15315,8 @@ async function createLlamaLocalDigestProvider(modelId) {
|
|
|
15315
15315
|
const response = await withTimeout(
|
|
15316
15316
|
session.prompt(userContent, {
|
|
15317
15317
|
maxTokens: LLAMA_MAX_GENERATED_TOKENS,
|
|
15318
|
-
temperature: LLAMA_TEMPERATURE
|
|
15318
|
+
temperature: LLAMA_TEMPERATURE,
|
|
15319
|
+
budgets: { thoughtTokens: 0 }
|
|
15319
15320
|
}),
|
|
15320
15321
|
options.timeoutMs,
|
|
15321
15322
|
() => new LlamaLocalDigestProviderError(`Llama provider timed out after ${options.timeoutMs}ms`)
|
package/dist/server.js
CHANGED
|
@@ -37811,26 +37811,26 @@ var DigestModelRegistryError = class extends Error {
|
|
|
37811
37811
|
var DIGEST_MODEL_REGISTRY = {
|
|
37812
37812
|
["tiny" /* TINY */]: {
|
|
37813
37813
|
id: "tiny" /* TINY */,
|
|
37814
|
-
ggufUri: "hf:
|
|
37815
|
-
approxSizeBytes:
|
|
37814
|
+
ggufUri: "hf:lmstudio-community/Qwen3.5-0.8B-GGUF/Qwen3.5-0.8B-Q4_K_M.gguf",
|
|
37815
|
+
approxSizeBytes: 528e6,
|
|
37816
37816
|
license: "Apache-2.0",
|
|
37817
|
-
sourceUrl: "https://huggingface.co/
|
|
37817
|
+
sourceUrl: "https://huggingface.co/lmstudio-community/Qwen3.5-0.8B-GGUF",
|
|
37818
37818
|
enabled: true
|
|
37819
37819
|
},
|
|
37820
37820
|
["base" /* BASE */]: {
|
|
37821
37821
|
id: "base" /* BASE */,
|
|
37822
|
-
ggufUri: "hf:
|
|
37823
|
-
approxSizeBytes:
|
|
37822
|
+
ggufUri: "hf:lmstudio-community/Qwen3.5-2B-GGUF/Qwen3.5-2B-Q4_K_M.gguf",
|
|
37823
|
+
approxSizeBytes: 127e7,
|
|
37824
37824
|
license: "Apache-2.0",
|
|
37825
|
-
sourceUrl: "https://huggingface.co/
|
|
37825
|
+
sourceUrl: "https://huggingface.co/lmstudio-community/Qwen3.5-2B-GGUF",
|
|
37826
37826
|
enabled: true
|
|
37827
37827
|
},
|
|
37828
37828
|
["large" /* LARGE */]: {
|
|
37829
37829
|
id: "large" /* LARGE */,
|
|
37830
|
-
ggufUri: "hf:
|
|
37831
|
-
approxSizeBytes:
|
|
37830
|
+
ggufUri: "hf:lmstudio-community/Qwen3.5-4B-GGUF/Qwen3.5-4B-Q4_K_M.gguf",
|
|
37831
|
+
approxSizeBytes: 271e7,
|
|
37832
37832
|
license: "Apache-2.0",
|
|
37833
|
-
sourceUrl: "https://huggingface.co/
|
|
37833
|
+
sourceUrl: "https://huggingface.co/lmstudio-community/Qwen3.5-4B-GGUF",
|
|
37834
37834
|
enabled: true
|
|
37835
37835
|
}
|
|
37836
37836
|
};
|
|
@@ -37948,7 +37948,8 @@ async function createLlamaLocalDigestProvider(modelId) {
|
|
|
37948
37948
|
const response = await withTimeout(
|
|
37949
37949
|
session.prompt(userContent, {
|
|
37950
37950
|
maxTokens: LLAMA_MAX_GENERATED_TOKENS,
|
|
37951
|
-
temperature: LLAMA_TEMPERATURE
|
|
37951
|
+
temperature: LLAMA_TEMPERATURE,
|
|
37952
|
+
budgets: { thoughtTokens: 0 }
|
|
37952
37953
|
}),
|
|
37953
37954
|
options.timeoutMs,
|
|
37954
37955
|
() => new LlamaLocalDigestProviderError(`Llama provider timed out after ${options.timeoutMs}ms`)
|
|
@@ -1,21 +1,64 @@
|
|
|
1
1
|
import * as assert from 'node:assert/strict';
|
|
2
2
|
import { describe, test } from 'node:test';
|
|
3
|
-
import { createLlamaLocalDigestProvider } from '../digest/providers/llama-local.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
import { createLlamaLocalDigestProvider, sanitizeConversationDigestMarkdown, titleFromSource, trimConversationExport, } from '../digest/providers/llama-local.js';
|
|
4
|
+
describe('titleFromSource', () => {
|
|
5
|
+
test('strips the extension and turns separators into spaces', () => {
|
|
6
|
+
assert.equal(titleFromSource('/a/b/conv_claude_1bda-2b2b.md'), 'conv claude 1bda 2b2b');
|
|
7
|
+
});
|
|
8
|
+
test('handles a bare filename with no directory', () => {
|
|
9
|
+
assert.equal(titleFromSource('inbox.md'), 'inbox');
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
describe('trimConversationExport', () => {
|
|
13
|
+
test('returns the trimmed content unchanged when within the limit', () => {
|
|
14
|
+
assert.equal(trimConversationExport(' hello world ', 100), 'hello world');
|
|
15
|
+
});
|
|
16
|
+
test('keeps the tail and prepends an omission notice when over the limit', () => {
|
|
17
|
+
const content = 'A'.repeat(50) + 'TAIL_MARKER';
|
|
18
|
+
const out = trimConversationExport(content, 11);
|
|
19
|
+
assert.match(out, /^\[Earlier conversation content omitted/);
|
|
20
|
+
assert.ok(out.endsWith('TAIL_MARKER'), 'keeps the most recent content');
|
|
21
|
+
assert.equal(out.split('\n\n')[1], 'TAIL_MARKER');
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
describe('sanitizeConversationDigestMarkdown', () => {
|
|
25
|
+
test('unwraps a fenced markdown block', () => {
|
|
26
|
+
const out = sanitizeConversationDigestMarkdown('```markdown\n# Title\n\nbody\n```');
|
|
27
|
+
assert.equal(out, '# Title\n\nbody\n');
|
|
28
|
+
});
|
|
29
|
+
test('leaves unfenced text intact and guarantees a single trailing newline', () => {
|
|
30
|
+
const out = sanitizeConversationDigestMarkdown(' plain summary ');
|
|
31
|
+
assert.equal(out, 'plain summary\n');
|
|
32
|
+
});
|
|
33
|
+
test('does not strip text that merely mentions a code fence inline', () => {
|
|
34
|
+
const out = sanitizeConversationDigestMarkdown('Use ```bash``` to run it.');
|
|
35
|
+
assert.equal(out, 'Use ```bash``` to run it.\n');
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
describe('createLlamaLocalDigestProvider (opt-in real model)', () => {
|
|
39
|
+
const INPUT = {
|
|
40
|
+
sourcePath: '.agent-kit/wiki/raw/conv_2026-05-19T00-45-17-697Z.md',
|
|
41
|
+
contentHash: 'tiny',
|
|
42
|
+
content: '**User:** use local digest generation for archived conversations',
|
|
43
|
+
};
|
|
44
|
+
test('generates a digest with the documented metadata header and a non-empty body', { skip: !process.env.AGENT_KIT_DIGEST_MODEL_ID }, async () => {
|
|
11
45
|
const modelId = process.env.AGENT_KIT_DIGEST_MODEL_ID;
|
|
12
46
|
const provider = await createLlamaLocalDigestProvider(modelId);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
47
|
+
try {
|
|
48
|
+
const output = await provider.generateDigestMarkdown(INPUT, {
|
|
49
|
+
modelId,
|
|
50
|
+
maxInputChars: 1000,
|
|
51
|
+
timeoutMs: 120_000,
|
|
52
|
+
});
|
|
53
|
+
assert.match(output, /^## Digest: conv 2026/);
|
|
54
|
+
assert.match(output, /\| \*\*Source\*\* \| .*conv_2026-05-19/);
|
|
55
|
+
assert.match(output, new RegExp(`\\| \\*\\*Model\\*\\* \\| ${modelId} \\|`));
|
|
56
|
+
assert.doesNotMatch(output, /<\/?think>/i);
|
|
57
|
+
const body = output.replace(/^##[\s\S]*?\n\n/, '').trim();
|
|
58
|
+
assert.ok(body.length > 0, 'expected a non-empty digest body');
|
|
59
|
+
}
|
|
60
|
+
finally {
|
|
61
|
+
await provider.dispose?.();
|
|
62
|
+
}
|
|
20
63
|
});
|
|
21
64
|
});
|
|
@@ -8,26 +8,26 @@ class DigestModelRegistryError extends Error {
|
|
|
8
8
|
const DIGEST_MODEL_REGISTRY = {
|
|
9
9
|
[DigestModelId.TINY]: {
|
|
10
10
|
id: DigestModelId.TINY,
|
|
11
|
-
ggufUri: 'hf:
|
|
12
|
-
approxSizeBytes:
|
|
11
|
+
ggufUri: 'hf:lmstudio-community/Qwen3.5-0.8B-GGUF/Qwen3.5-0.8B-Q4_K_M.gguf',
|
|
12
|
+
approxSizeBytes: 528_000_000,
|
|
13
13
|
license: 'Apache-2.0',
|
|
14
|
-
sourceUrl: 'https://huggingface.co/
|
|
14
|
+
sourceUrl: 'https://huggingface.co/lmstudio-community/Qwen3.5-0.8B-GGUF',
|
|
15
15
|
enabled: true,
|
|
16
16
|
},
|
|
17
17
|
[DigestModelId.BASE]: {
|
|
18
18
|
id: DigestModelId.BASE,
|
|
19
|
-
ggufUri: 'hf:
|
|
20
|
-
approxSizeBytes:
|
|
19
|
+
ggufUri: 'hf:lmstudio-community/Qwen3.5-2B-GGUF/Qwen3.5-2B-Q4_K_M.gguf',
|
|
20
|
+
approxSizeBytes: 1_270_000_000,
|
|
21
21
|
license: 'Apache-2.0',
|
|
22
|
-
sourceUrl: 'https://huggingface.co/
|
|
22
|
+
sourceUrl: 'https://huggingface.co/lmstudio-community/Qwen3.5-2B-GGUF',
|
|
23
23
|
enabled: true,
|
|
24
24
|
},
|
|
25
25
|
[DigestModelId.LARGE]: {
|
|
26
26
|
id: DigestModelId.LARGE,
|
|
27
|
-
ggufUri: 'hf:
|
|
28
|
-
approxSizeBytes:
|
|
27
|
+
ggufUri: 'hf:lmstudio-community/Qwen3.5-4B-GGUF/Qwen3.5-4B-Q4_K_M.gguf',
|
|
28
|
+
approxSizeBytes: 2_710_000_000,
|
|
29
29
|
license: 'Apache-2.0',
|
|
30
|
-
sourceUrl: 'https://huggingface.co/
|
|
30
|
+
sourceUrl: 'https://huggingface.co/lmstudio-community/Qwen3.5-4B-GGUF',
|
|
31
31
|
enabled: true,
|
|
32
32
|
},
|
|
33
33
|
};
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import type { ConversationDigestProvider } from '../types.js';
|
|
2
|
+
export declare function titleFromSource(sourcePath: string): string;
|
|
3
|
+
export declare function trimConversationExport(content: string, maxInputChars: number): string;
|
|
4
|
+
export declare function sanitizeConversationDigestMarkdown(generatedText: string): string;
|
|
2
5
|
export declare function createLlamaLocalDigestProvider(modelId: string): Promise<ConversationDigestProvider>;
|
|
@@ -11,13 +11,13 @@ class LlamaLocalDigestProviderError extends Error {
|
|
|
11
11
|
this.name = 'LlamaLocalDigestProviderError';
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
function titleFromSource(sourcePath) {
|
|
14
|
+
export function titleFromSource(sourcePath) {
|
|
15
15
|
return path
|
|
16
16
|
.basename(sourcePath)
|
|
17
17
|
.replace(/\.[^.]+$/, '')
|
|
18
18
|
.replace(/[_-]+/g, ' ');
|
|
19
19
|
}
|
|
20
|
-
function trimConversationExport(content, maxInputChars) {
|
|
20
|
+
export function trimConversationExport(content, maxInputChars) {
|
|
21
21
|
const trimmed = content.trim();
|
|
22
22
|
if (trimmed.length <= maxInputChars)
|
|
23
23
|
return trimmed;
|
|
@@ -54,7 +54,7 @@ function stripCodeFence(text) {
|
|
|
54
54
|
const match = trimmed.match(/^```(?:markdown|md)?\s*\n([\s\S]*?)\n```$/i);
|
|
55
55
|
return match ? match[1].trim() : trimmed;
|
|
56
56
|
}
|
|
57
|
-
function sanitizeConversationDigestMarkdown(generatedText) {
|
|
57
|
+
export function sanitizeConversationDigestMarkdown(generatedText) {
|
|
58
58
|
return stripCodeFence(generatedText).trim() + '\n';
|
|
59
59
|
}
|
|
60
60
|
export async function createLlamaLocalDigestProvider(modelId) {
|
|
@@ -104,6 +104,7 @@ export async function createLlamaLocalDigestProvider(modelId) {
|
|
|
104
104
|
const response = await withTimeout(session.prompt(userContent, {
|
|
105
105
|
maxTokens: LLAMA_MAX_GENERATED_TOKENS,
|
|
106
106
|
temperature: LLAMA_TEMPERATURE,
|
|
107
|
+
budgets: { thoughtTokens: 0 },
|
|
107
108
|
}), options.timeoutMs, () => new LlamaLocalDigestProviderError(`Llama provider timed out after ${options.timeoutMs}ms`));
|
|
108
109
|
const metadata = `## Digest: ${titleFromSource(input.sourcePath)}
|
|
109
110
|
|