dsh-model-think-level 2.5.0 → 2.6.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 +7 -0
- package/lib/client/image-config-client.d.ts +7 -22
- package/lib/client/injection/imagegen-entry.d.ts +4 -17
- package/lib/client.js +6 -5
- package/lib/client.js.map +3 -3
- package/lib/history-compat.d.ts +5 -3
- package/lib/image/config.d.ts +11 -15
- package/lib/image/generate.d.ts +3 -3
- package/lib/image/state.d.ts +45 -0
- package/lib/image/tool.d.ts +1 -1
- package/lib/index.js +308 -125
- package/lib/index.js.map +4 -4
- package/package.json +1 -1
package/lib/history-compat.d.ts
CHANGED
|
@@ -31,9 +31,11 @@
|
|
|
31
31
|
* the provider demands:
|
|
32
32
|
*
|
|
33
33
|
* 1. `portable_ids` — drop the foreign item handle from every replayable block:
|
|
34
|
-
* the `id` inside a reasoning signature, the `
|
|
35
|
-
*
|
|
36
|
-
*
|
|
34
|
+
* the `id` inside a reasoning signature, the whole `textSignature`, and the
|
|
35
|
+
* `itemId` half of a tool call's `callId|itemId`. The server then treats the
|
|
36
|
+
* item as new instead of resolving a foreign handle. A text signature cannot
|
|
37
|
+
* keep its `phase` once the id is gone: pi-ai only reads `{v:1, id, phase?}`,
|
|
38
|
+
* and a signature without a string `id` is sent verbatim as the item id.
|
|
37
39
|
* 2. `drop_reasoning` — additionally stop replaying historical reasoning items
|
|
38
40
|
* altogether (the `thinkingSignature` is removed; the visible thinking text
|
|
39
41
|
* stays in the local history untouched). Reasoning is the other thing bound
|
package/lib/image/config.d.ts
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Image configuration types, pure model derivation and legacy v2 parsing.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* same marker the Models page and the auto-fill write), and this file layers
|
|
9
|
-
* the user's per-model overrides (endpoint verdict, param abilities, picked
|
|
10
|
-
* size/quality/n) on top. Syncing keeps every override keyed by model id, so a
|
|
11
|
-
* model that leaves the settings document drops out and one that comes back
|
|
12
|
-
* keeps its overrides.
|
|
4
|
+
* Live model membership and connections are supplied by ImageConfiguration in
|
|
5
|
+
* state.ts from the host's resolved llm-pi-ai settings. Runtime consumers must
|
|
6
|
+
* use that adapter; the v2 file helpers below are retained for compatibility
|
|
7
|
+
* tests and legacy preference/diagnostic migration only.
|
|
13
8
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
9
|
+
* image.json now stores v3 preferences and connection-scoped observations. A
|
|
10
|
+
* stored v2 models[] snapshot never authorizes a model or supplies a connection
|
|
11
|
+
* to a live image operation.
|
|
17
12
|
*
|
|
18
13
|
* @module dsh-model-think-level/image/config
|
|
19
14
|
*/
|
|
@@ -42,7 +37,7 @@ export interface ImageModelSeed {
|
|
|
42
37
|
readonly baseURL: string;
|
|
43
38
|
readonly keyRef?: string;
|
|
44
39
|
}
|
|
45
|
-
/** One image model
|
|
40
|
+
/** One current derived image model, combined with connection-scoped diagnostics. */
|
|
46
41
|
export interface ImageModel {
|
|
47
42
|
readonly id: string;
|
|
48
43
|
readonly route: string;
|
|
@@ -67,7 +62,7 @@ export interface ImageDefaults {
|
|
|
67
62
|
readonly n: number;
|
|
68
63
|
readonly timeoutMs: number;
|
|
69
64
|
}
|
|
70
|
-
/**
|
|
65
|
+
/** One live runtime projection; version 2 is the legacy structural contract. */
|
|
71
66
|
export interface ImageConfig {
|
|
72
67
|
readonly version: 2;
|
|
73
68
|
/**
|
|
@@ -94,6 +89,7 @@ export declare const IMAGE_FALLBACK_PARAMS: ImageParams;
|
|
|
94
89
|
export declare function imageConfigFilePath(home?: string): string;
|
|
95
90
|
/** A fresh, empty config. */
|
|
96
91
|
export declare function emptyImageConfig(now?: () => Date): ImageConfig;
|
|
92
|
+
export declare function parseImageParams(raw: unknown): ImageParams | undefined;
|
|
97
93
|
/**
|
|
98
94
|
* Parse an already-decoded config document. Never throws and never trusts the
|
|
99
95
|
* input: anything unrecognisable is dropped field by field, so a hand-edited
|
package/lib/image/generate.d.ts
CHANGED
|
@@ -95,8 +95,8 @@ export declare class GenerateError extends Error {
|
|
|
95
95
|
}
|
|
96
96
|
/** The faces this core needs from its host. All injectable for tests. */
|
|
97
97
|
export interface GenerateDeps {
|
|
98
|
-
/**
|
|
99
|
-
readonly config
|
|
98
|
+
/** One operation's live snapshot, supplied by the host; never read a disk catalogue. */
|
|
99
|
+
readonly config: () => ImageConfig;
|
|
100
100
|
/** Resolve one credential reference to its value. */
|
|
101
101
|
readonly resolveKey: (ref: string, signal?: AbortSignal) => Promise<string | undefined>;
|
|
102
102
|
/** The fetch beneath any wrapper — the images call must not be re-intercepted. */
|
|
@@ -104,7 +104,7 @@ export interface GenerateDeps {
|
|
|
104
104
|
/** Base dir for relative `outputDir`s (defaults to the harness home). */
|
|
105
105
|
readonly home?: () => string;
|
|
106
106
|
/** Persist `lastGoodParams` after a successful fallback (host: config file). */
|
|
107
|
-
readonly persistLastGood?: (modelId: string, params: ImageModel['lastGoodParams']) => void;
|
|
107
|
+
readonly persistLastGood?: (modelId: string, params: ImageModel['lastGoodParams'], model: ImageModel) => void;
|
|
108
108
|
/** Now, for file stamps (defaults to Date.now). */
|
|
109
109
|
readonly now?: () => number;
|
|
110
110
|
/** Per-call timeout override (ms). */
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type ImageConfig, type ImageDefaults, type ImageModel, type ImageParams } from './config.js';
|
|
2
|
+
export interface ImageObservation {
|
|
3
|
+
/** Hash of the connection that produced this observation; contains no URL or key. */
|
|
4
|
+
readonly source: string;
|
|
5
|
+
readonly endpoint: ImageModel['endpoint'];
|
|
6
|
+
readonly lastGoodParams: ImageParams | null;
|
|
7
|
+
}
|
|
8
|
+
export interface ImagePreferences {
|
|
9
|
+
readonly version: 3;
|
|
10
|
+
readonly enabled: boolean;
|
|
11
|
+
readonly defaultModel: string | null;
|
|
12
|
+
readonly defaults: ImageDefaults;
|
|
13
|
+
readonly outputDir: string;
|
|
14
|
+
readonly observations: Readonly<Record<string, ImageObservation>>;
|
|
15
|
+
}
|
|
16
|
+
interface SettingsDescriptor {
|
|
17
|
+
readonly ns: string;
|
|
18
|
+
readonly value?: unknown;
|
|
19
|
+
readonly revision?: number;
|
|
20
|
+
}
|
|
21
|
+
export declare class ImageConfigurationError extends Error {
|
|
22
|
+
readonly code: 'settings-unavailable' | 'settings-invalid' | 'preferences-unreadable';
|
|
23
|
+
constructor(code: 'settings-unavailable' | 'settings-invalid' | 'preferences-unreadable', message: string);
|
|
24
|
+
}
|
|
25
|
+
/** One source adapter for every consumer; an operation captures one read(). */
|
|
26
|
+
export declare class ImageConfiguration {
|
|
27
|
+
private readonly deps;
|
|
28
|
+
private readonly file;
|
|
29
|
+
private readonly now;
|
|
30
|
+
constructor(deps: {
|
|
31
|
+
readonly describe: () => readonly SettingsDescriptor[];
|
|
32
|
+
readonly file?: string;
|
|
33
|
+
readonly now?: () => Date;
|
|
34
|
+
});
|
|
35
|
+
private load;
|
|
36
|
+
preferences(): ImagePreferences;
|
|
37
|
+
private base;
|
|
38
|
+
read(): ImageConfig;
|
|
39
|
+
private project;
|
|
40
|
+
/** The saved switch wins even while the model provider is unavailable. */
|
|
41
|
+
forGeneration(): ImageConfig;
|
|
42
|
+
update(mutate: (preferences: ImagePreferences) => ImagePreferences): ImagePreferences;
|
|
43
|
+
record(model: ImageModel, params: ImageParams | null): void;
|
|
44
|
+
}
|
|
45
|
+
export {};
|
package/lib/image/tool.d.ts
CHANGED
|
@@ -113,4 +113,4 @@ export declare function registerGenerateImageTool(ctx: Context, deps: ImageToolD
|
|
|
113
113
|
* several candidates the resolver refuses, and the hint then has to say so —
|
|
114
114
|
* naming a model there is a promise the call cannot keep.
|
|
115
115
|
*/
|
|
116
|
-
export declare function imageToolHint(config: ImageConfig): string;
|
|
116
|
+
export declare function imageToolHint(config: ImageConfig, toolName?: string): string;
|