@istarry/dsh-chat-edit 0.1.0 → 0.1.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/lib/index.js +33 -14
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -576,10 +576,10 @@ async function createSeededSession(ctx, seed, sourceSessionId) {
|
|
|
576
576
|
for (const event of seed) {
|
|
577
577
|
if (event.type !== "model/selection") continue;
|
|
578
578
|
const data = event.data;
|
|
579
|
-
if (data?.
|
|
580
|
-
provider = data.
|
|
581
|
-
model = data.
|
|
582
|
-
reasoningEffort = data.
|
|
579
|
+
if (data?.provider !== void 0 && data.model !== void 0) {
|
|
580
|
+
provider = data.provider;
|
|
581
|
+
model = data.model;
|
|
582
|
+
reasoningEffort = data.reasoningEffort;
|
|
583
583
|
}
|
|
584
584
|
}
|
|
585
585
|
if (provider === void 0 || model === void 0) {
|
|
@@ -591,17 +591,36 @@ async function createSeededSession(ctx, seed, sourceSessionId) {
|
|
|
591
591
|
reasoningEffort = sel?.reasoningEffort;
|
|
592
592
|
} catch {}
|
|
593
593
|
}
|
|
594
|
-
let agentPreset;
|
|
595
|
-
let setup;
|
|
596
594
|
const query = ctx.get("sessionQuery");
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
595
|
+
const composer = ctx.get("sessionController")?.agents;
|
|
596
|
+
const presets = ctx.get("agentPresets");
|
|
597
|
+
if (query === void 0 || composer === void 0 && presets === void 0) throw new RemoteError("gateway/internal", "reply-edit: cannot compose an Agent preset for the new session; refusing to create a crippled session", {});
|
|
598
|
+
const composition = await (async () => {
|
|
599
|
+
const env_2 = {
|
|
600
|
+
stack: [],
|
|
601
|
+
error: void 0,
|
|
602
|
+
hasError: false
|
|
603
|
+
};
|
|
604
|
+
try {
|
|
605
|
+
const observation = __addDisposableResource(env_2, await query.observeSession(SessionId(sourceSessionId)), false);
|
|
606
|
+
if (composer !== void 0 && typeof composer.composeAgent === "function" && typeof composer.presetForObservation === "function") return await composer.composeAgent(composer.presetForObservation(observation));
|
|
607
|
+
if (presets === void 0) throw new RemoteError("gateway/internal", "reply-edit: no Agent preset service; refusing to create a crippled session", {});
|
|
608
|
+
const projected = observation;
|
|
609
|
+
const resolvedId = (await presets.resolve(projected.projections?.values?.agentPreset)).id;
|
|
610
|
+
return {
|
|
611
|
+
agentPreset: resolvedId,
|
|
612
|
+
setup: (agentCtx) => presets.mount(agentCtx, resolvedId)
|
|
613
|
+
};
|
|
614
|
+
} catch (e_2) {
|
|
615
|
+
env_2.error = e_2;
|
|
616
|
+
env_2.hasError = true;
|
|
617
|
+
} finally {
|
|
618
|
+
__disposeResources(env_2);
|
|
619
|
+
}
|
|
620
|
+
})();
|
|
621
|
+
const agentPreset = composition.agentPreset;
|
|
622
|
+
const setup = composition.setup;
|
|
623
|
+
if (setup === void 0) throw new RemoteError("gateway/internal", "reply-edit: Agent composition produced no setup; refusing to create a crippled session", {});
|
|
605
624
|
const childId = `session-${randomUUID()}`;
|
|
606
625
|
let inheritedEventCount = seed.length;
|
|
607
626
|
for (const [index, event] of seed.entries()) if (event.type === "session/end-seed" && event.data.inherited === true) inheritedEventCount = index;
|