@yadsh/dsh-qa-surface 0.15.5 → 0.15.7
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/lib/access/model-policy.js +124 -0
- package/lib/access/model-policy.js.map +1 -0
- package/lib/access/model.js +5 -0
- package/lib/access/model.js.map +1 -1
- package/lib/access/service.js +77 -3
- package/lib/access/service.js.map +1 -1
- package/lib/admin/service.js +6 -0
- package/lib/admin/service.js.map +1 -1
- package/lib/client/admin/ModelPolicyEditor.js +52 -0
- package/lib/client/admin/ModelPolicyEditor.js.map +1 -0
- package/lib/client/admin/QaAdmin.js +4 -2
- package/lib/client/admin/QaAdmin.js.map +1 -1
- package/lib/client/admin/pages/Users.js +18 -2
- package/lib/client/admin/pages/Users.js.map +1 -1
- package/lib/client/admin/shared.js +3 -0
- package/lib/client/admin/shared.js.map +1 -1
- package/lib/client/components/QaChangelog.js +26 -0
- package/lib/client/components/QaChangelog.js.map +1 -1
- package/lib/client/index.js +1 -0
- package/lib/client/index.js.map +1 -1
- package/lib/client/settings/sections/session.js +2 -2
- package/lib/client/settings/sections/session.js.map +1 -1
- package/lib/client/types.js.map +1 -1
- package/lib/client.js +366 -92
- package/lib/client.js.map +1 -1
- package/lib/index.js +37 -17
- package/lib/index.js.map +1 -1
- package/lib/integration/host-runner.js +2 -10
- package/lib/integration/host-runner.js.map +1 -1
- package/lib/secure-session.js +43 -8
- package/lib/secure-session.js.map +1 -1
- package/lib/session-model.js +40 -0
- package/lib/session-model.js.map +1 -0
- package/lib/typert.host.js +211 -80
- package/lib/typert.remote-client.d.ts +3 -1
- package/lib/typert.remote-client.js +184 -75
- package/lib/types/access/model-policy.d.ts +95 -0
- package/lib/types/access/service.d.ts +41 -4
- package/lib/types/client/admin/ModelPolicyEditor.d.ts +23 -0
- package/lib/types/client/types.d.ts +3 -1
- package/lib/types/index.d.ts +20 -4
- package/lib/types/secure-session.d.ts +33 -1
- package/lib/types/session-model.d.ts +24 -0
- package/lib/types/types.d.ts +35 -0
- package/package.json +4 -4
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { assertModelPairAvailable, projectModelCatalog, } from "./access/model-policy.js";
|
|
2
|
+
/**
|
|
3
|
+
* Put one fresh session on the pair its model policy names.
|
|
4
|
+
*
|
|
5
|
+
* The check runs here rather than after the selection because the Host answers
|
|
6
|
+
* an unknown model by failing the first question of the chat, in words that
|
|
7
|
+
* name neither the pair nor the policy it came from. Refusing at the door keeps
|
|
8
|
+
* the chat uncreated and the operator's journal on the same line as the reason.
|
|
9
|
+
*
|
|
10
|
+
* Absent pair means no layer of the policy spoke: the session keeps whatever
|
|
11
|
+
* the Host's own default composition gives it.
|
|
12
|
+
*
|
|
13
|
+
* @param ctx - the Host context, for the model catalog and the selection.
|
|
14
|
+
* @param sessionId - the session the Host just created.
|
|
15
|
+
* @param policy - the resolved policy of this session.
|
|
16
|
+
* @param logger - where the applied pair is recorded, with its layer.
|
|
17
|
+
* @returns the pair the session was put on, or `undefined` when none applied.
|
|
18
|
+
*/
|
|
19
|
+
export async function applySessionModelPolicy(ctx, sessionId, policy, logger) {
|
|
20
|
+
const pair = policy.pair;
|
|
21
|
+
if (pair === undefined)
|
|
22
|
+
return undefined;
|
|
23
|
+
assertModelPairAvailable(pair, projectModelCatalog(await ctx.sessionController.modelCatalog()));
|
|
24
|
+
await ctx.sessionController.selectModel({
|
|
25
|
+
sessionId,
|
|
26
|
+
provider: pair.provider,
|
|
27
|
+
model: pair.model,
|
|
28
|
+
...(pair.reasoningEffort === undefined
|
|
29
|
+
? {}
|
|
30
|
+
: { reasoningEffort: pair.reasoningEffort }),
|
|
31
|
+
});
|
|
32
|
+
logger.info("session.model-selected", {
|
|
33
|
+
sessionId: String(sessionId),
|
|
34
|
+
provider: pair.provider,
|
|
35
|
+
model: pair.model,
|
|
36
|
+
layer: policy.layer ?? "deployment",
|
|
37
|
+
});
|
|
38
|
+
return pair;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=session-model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-model.js","sourceRoot":"","sources":["../src/session-model.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,wBAAwB,EACxB,mBAAmB,GAEpB,MAAM,0BAA0B,CAAC;AAGlC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,GAAY,EACZ,SAAoB,EACpB,MAA4B,EAC5B,MAAoB;IAEpB,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;IACzB,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACzC,wBAAwB,CACtB,IAAI,EACJ,mBAAmB,CAAC,MAAM,GAAG,CAAC,iBAAiB,CAAC,YAAY,EAAE,CAAC,CAChE,CAAC;IACF,MAAM,GAAG,CAAC,iBAAiB,CAAC,WAAW,CAAC;QACtC,SAAS;QACT,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,GAAG,CAAC,IAAI,CAAC,eAAe,KAAK,SAAS;YACpC,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,eAAe,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC;KAC/C,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,wBAAwB,EAAE;QACpC,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC;QAC5B,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,YAAY;KACpC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC"}
|