dsh-model-think-level 2.6.5 → 2.6.6
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.
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Make a wire-protocol switch and its compat cleanup ONE write.
|
|
3
|
+
*
|
|
4
|
+
* The kernel validates a whole settings document at the moment it is written
|
|
5
|
+
* (`llm-pi-ai`'s `assertServiceable` -> `resolveModelCompat`): a model that
|
|
6
|
+
* still carries a switch its NEW protocol does not take fails resolution, and
|
|
7
|
+
* the write is refused outright --
|
|
8
|
+
*
|
|
9
|
+
* provider "free" model "gpt-6.1-sol" sets compat "supportsReasoningEffort",
|
|
10
|
+
* but its api is "openai-responses", which does not take it
|
|
11
|
+
*
|
|
12
|
+
* -- so the official card's Save bounces and the user is left to hand-edit
|
|
13
|
+
* `cordis.patch.yml`. The boot sweep and the idle pass heal that state
|
|
14
|
+
* afterwards, which is too late: the refusal already happened.
|
|
15
|
+
*
|
|
16
|
+
* The fix has to land INSIDE the same mutate call, because a separate write
|
|
17
|
+
* either races the card's frozen revision (issue #7: the user's own Save then
|
|
18
|
+
* fails with `settings/conflict`) or arrives after the refusal. This module is
|
|
19
|
+
* the pure half of that: given the ops a caller is about to send and the
|
|
20
|
+
* providers dict they apply to, it returns the ops with the now-foreign compat
|
|
21
|
+
* switches stripped from every model (and route compat block) the same write
|
|
22
|
+
* moves to a different protocol.
|
|
23
|
+
*
|
|
24
|
+
* Pure data logic -- no harness package, no DOM -- so it is unit-testable and
|
|
25
|
+
* shared by the write seam alone.
|
|
26
|
+
*
|
|
27
|
+
* @module dsh-model-think-level/compat-write
|
|
28
|
+
*/
|
|
29
|
+
/** The path-addressed edit shape the settings remote takes. */
|
|
30
|
+
export type WriteOp = {
|
|
31
|
+
op: 'set';
|
|
32
|
+
path: readonly string[];
|
|
33
|
+
value: unknown;
|
|
34
|
+
} | {
|
|
35
|
+
op: 'unset';
|
|
36
|
+
path: readonly string[];
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Whether this write moves any route to a different wire protocol.
|
|
40
|
+
*
|
|
41
|
+
* The cheap gate in front of {@link withCompatCleanup}: a write that leaves
|
|
42
|
+
* `api` alone cannot make an already-valid document invalid, so the caller
|
|
43
|
+
* skips the document read entirely. Exported because the write seam asks it
|
|
44
|
+
* before paying for a describe.
|
|
45
|
+
* @param ops - the ops a caller is about to send.
|
|
46
|
+
*/
|
|
47
|
+
export declare function protocolsSwitched(ops: readonly WriteOp[]): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Add the compat cleanup a protocol switch needs to the SAME write.
|
|
50
|
+
*
|
|
51
|
+
* For every route this write moves to a different protocol, the switches its
|
|
52
|
+
* models (and its route-level compat block) can no longer carry are stripped:
|
|
53
|
+
*
|
|
54
|
+
* - an op that already replaces the models array is cleaned in place, so the
|
|
55
|
+
* write still says exactly what its caller meant, minus the dead switches;
|
|
56
|
+
* - an op that replaces the whole profile is cleaned the same way;
|
|
57
|
+
* - otherwise a `set` on `providers.<route>.models` (and on the route compat
|
|
58
|
+
* block, when it carries one) is APPENDED, so the caller's own fields stay
|
|
59
|
+
* untouched and the cleanup travels in the same revision.
|
|
60
|
+
*
|
|
61
|
+
* @param ops - the ops the caller is about to send.
|
|
62
|
+
* @param providers - the user-layer providers dict they apply to.
|
|
63
|
+
* @returns the ops to send: the originals when no protocol moved or nothing
|
|
64
|
+
* needed cleaning, otherwise the cleaned/expanded set.
|
|
65
|
+
*/
|
|
66
|
+
export declare function withCompatCleanup(ops: readonly WriteOp[], providers: unknown): WriteOp[];
|
package/package.json
CHANGED