claude-db 0.12.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/cli/commands/pick.js +4 -2
- package/dist/pick/run.d.ts +6 -0
- package/dist/pick/run.js +8 -1
- package/dist/util/claude-cli.d.ts +1 -0
- package/dist/util/claude-cli.js +15 -3
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.12.1
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- **Memories shown with a prompt are picked by Haiku 5.5.** When the account or provider cannot use it, the
|
|
8
|
+
pick falls back to `haiku` on its own. `claude-db pick` shows both. Turning chats into facts still uses
|
|
9
|
+
`haiku`.
|
|
10
|
+
|
|
3
11
|
## 0.12.0
|
|
4
12
|
|
|
5
13
|
### Added
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { loadConfig, setConfigValue } from '../../config/index.js';
|
|
2
|
-
import { PICK_BUDGET } from '../../pick/run.js';
|
|
2
|
+
import { PICK_BUDGET, pickModel } from '../../pick/run.js';
|
|
3
3
|
import { budgetUsage, describePause } from '../../util/daily-budget.js';
|
|
4
4
|
export function pickStatus(config, now = Date.now()) {
|
|
5
5
|
const { pick } = config;
|
|
@@ -9,7 +9,9 @@ export function pickStatus(config, now = Date.now()) {
|
|
|
9
9
|
const usage = budgetUsage(PICK_BUDGET, now);
|
|
10
10
|
const pause = describePause(usage, now);
|
|
11
11
|
const paused = pause ? `, paused ${pause}` : '';
|
|
12
|
-
|
|
12
|
+
const { model, fallback } = pickModel(config);
|
|
13
|
+
const models = fallback ? `${model}, else ${fallback}` : model;
|
|
14
|
+
return `pick : on (${models}), ${usage.used} of ${pick.dailyLimit} picks used today${paused}`;
|
|
13
15
|
}
|
|
14
16
|
export function cmdPick(argv) {
|
|
15
17
|
const [first] = argv;
|
package/dist/pick/run.d.ts
CHANGED
|
@@ -21,5 +21,11 @@ export interface PickRequest {
|
|
|
21
21
|
export declare function takePick(config: Config, now?: number): boolean;
|
|
22
22
|
export declare function recordPickFailure(reason: string, now?: number): void;
|
|
23
23
|
export declare function recordPickSuccess(now?: number): void;
|
|
24
|
+
interface PickModel {
|
|
25
|
+
model: string;
|
|
26
|
+
fallback?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare function pickModel(config: Config): PickModel;
|
|
24
29
|
export declare function headlessPicker(config: Config): PickRunner;
|
|
25
30
|
export declare function pickMemories(ctx: RecallContext, request: PickRequest, run: PickRunner): Promise<PickOutcome>;
|
|
31
|
+
export {};
|
package/dist/pick/run.js
CHANGED
|
@@ -5,6 +5,7 @@ import { recordFailure, recordSuccess, takeBudget } from '../util/daily-budget.j
|
|
|
5
5
|
import { PICK_SYSTEM_PROMPT, buildPickPrompt, parsePicks } from './prompt.js';
|
|
6
6
|
export const PICK_BUDGET = 'pick';
|
|
7
7
|
const TIMEOUT_MS = 30_000;
|
|
8
|
+
const LATEST_HAIKU = 'claude-haiku-5-5';
|
|
8
9
|
export function takePick(config, now = Date.now()) {
|
|
9
10
|
return config.pick.enabled && takeBudget(PICK_BUDGET, config.pick.dailyLimit, 1, now);
|
|
10
11
|
}
|
|
@@ -14,10 +15,16 @@ export function recordPickFailure(reason, now = Date.now()) {
|
|
|
14
15
|
export function recordPickSuccess(now = Date.now()) {
|
|
15
16
|
recordSuccess(PICK_BUDGET, now);
|
|
16
17
|
}
|
|
18
|
+
export function pickModel(config) {
|
|
19
|
+
const { model } = config.pick;
|
|
20
|
+
return model === 'haiku' ? { model: LATEST_HAIKU, fallback: model } : { model };
|
|
21
|
+
}
|
|
17
22
|
export function headlessPicker(config) {
|
|
18
|
-
|
|
23
|
+
const { model, fallback } = pickModel(config);
|
|
24
|
+
return (prompt) => runHeadlessResult(prompt, model, TIMEOUT_MS, {
|
|
19
25
|
flags: [['--system-prompt', PICK_SYSTEM_PROMPT], ['--tools', ''], ['--strict-mcp-config']],
|
|
20
26
|
env: { MAX_THINKING_TOKENS: '0' },
|
|
27
|
+
...(fallback ? { fallbackModel: fallback } : {}),
|
|
21
28
|
});
|
|
22
29
|
}
|
|
23
30
|
export async function pickMemories(ctx, request, run) {
|
package/dist/util/claude-cli.js
CHANGED
|
@@ -7,12 +7,19 @@ const OPTIONAL_FLAGS = [
|
|
|
7
7
|
['--no-session-persistence'],
|
|
8
8
|
];
|
|
9
9
|
const UNKNOWN_OPTION = /unknown option '(--[\w-]+)'/i;
|
|
10
|
+
const MODEL_UNAVAILABLE = /issue with the selected model/i;
|
|
10
11
|
export async function runHeadlessResult(prompt, model, timeoutMs, options = {}) {
|
|
11
12
|
let optional = [...OPTIONAL_FLAGS, ...(options.flags ?? [])];
|
|
13
|
+
let current = model;
|
|
12
14
|
for (;;) {
|
|
13
|
-
const result = await call(['-p', prompt, '--model',
|
|
15
|
+
const result = await call(['-p', prompt, '--model', current, ...optional.flat()], timeoutMs, options.env ?? {});
|
|
14
16
|
if (result.ok)
|
|
15
17
|
return { ok: true, stdout: result.stdout };
|
|
18
|
+
const { fallbackModel } = options;
|
|
19
|
+
if (fallbackModel && current !== fallbackModel && MODEL_UNAVAILABLE.test(result.stdout)) {
|
|
20
|
+
current = fallbackModel;
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
16
23
|
const rejected = UNKNOWN_OPTION.exec(result.stderr)?.[1];
|
|
17
24
|
const remaining = optional.filter((flags) => flags[0] !== rejected);
|
|
18
25
|
if (remaining.length === optional.length)
|
|
@@ -69,12 +76,17 @@ function call(args, timeoutMs, env) {
|
|
|
69
76
|
return;
|
|
70
77
|
}
|
|
71
78
|
const text = String(stderr);
|
|
72
|
-
done({
|
|
79
|
+
done({
|
|
80
|
+
ok: false,
|
|
81
|
+
stdout: String(stdout),
|
|
82
|
+
stderr: text,
|
|
83
|
+
reason: describeFailure(error, text, timeoutMs),
|
|
84
|
+
});
|
|
73
85
|
});
|
|
74
86
|
child.stdin?.end();
|
|
75
87
|
}
|
|
76
88
|
catch (error) {
|
|
77
|
-
done({ ok: false, stderr: '', reason: describeFailure(error, '', timeoutMs) });
|
|
89
|
+
done({ ok: false, stdout: '', stderr: '', reason: describeFailure(error, '', timeoutMs) });
|
|
78
90
|
}
|
|
79
91
|
});
|
|
80
92
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-db",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "Free, open-source memory for Claude Code. Remembers why decisions were made and maps your code. Your own database (SQLite, Postgres or MongoDB), no cloud, no subscription.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -130,10 +130,10 @@
|
|
|
130
130
|
"access": "public"
|
|
131
131
|
},
|
|
132
132
|
"optionalDependencies": {
|
|
133
|
-
"claude-db-grammars-linux-x64": "0.12.
|
|
134
|
-
"claude-db-grammars-linux-arm64": "0.12.
|
|
135
|
-
"claude-db-grammars-darwin-x64": "0.12.
|
|
136
|
-
"claude-db-grammars-darwin-arm64": "0.12.
|
|
137
|
-
"claude-db-grammars-win32-x64": "0.12.
|
|
133
|
+
"claude-db-grammars-linux-x64": "0.12.1",
|
|
134
|
+
"claude-db-grammars-linux-arm64": "0.12.1",
|
|
135
|
+
"claude-db-grammars-darwin-x64": "0.12.1",
|
|
136
|
+
"claude-db-grammars-darwin-arm64": "0.12.1",
|
|
137
|
+
"claude-db-grammars-win32-x64": "0.12.1"
|
|
138
138
|
}
|
|
139
139
|
}
|