@ordewell/core 0.4.22 → 0.4.23
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/dist/{chunk-DV3YIKRA.mjs → chunk-O2MFTRHA.mjs} +3 -3
- package/dist/{chunk-DV3YIKRA.mjs.map → chunk-O2MFTRHA.mjs.map} +1 -1
- package/dist/index.d.mts +18 -4
- package/dist/index.d.ts +18 -4
- package/dist/index.js +42 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -21
- package/dist/index.mjs.map +1 -1
- package/dist/plan-utils.mjs +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
textHasTaskOps,
|
|
38
38
|
truncateCheckpointSummary,
|
|
39
39
|
validateTaskEdit
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-O2MFTRHA.mjs";
|
|
41
41
|
import {
|
|
42
42
|
PLAN_ENVELOPE_KEY,
|
|
43
43
|
PlanParseError,
|
|
@@ -11426,7 +11426,6 @@ var Session = class {
|
|
|
11426
11426
|
approvalPolicy;
|
|
11427
11427
|
fetcher;
|
|
11428
11428
|
settingsFn;
|
|
11429
|
-
currentAllowlist = {};
|
|
11430
11429
|
/** Last discovered model catalog — lets sync plan commits clamp thinking efforts to real variants. */
|
|
11431
11430
|
modelsCache = {};
|
|
11432
11431
|
unsubObserver = null;
|
|
@@ -11631,7 +11630,6 @@ var Session = class {
|
|
|
11631
11630
|
this.beginFreshPlan();
|
|
11632
11631
|
this.approvalPolicy.reset();
|
|
11633
11632
|
this.modelsCache = {};
|
|
11634
|
-
this.currentAllowlist = {};
|
|
11635
11633
|
this.remintSessionId();
|
|
11636
11634
|
}
|
|
11637
11635
|
runnerModesFor(runners) {
|
|
@@ -11641,17 +11639,41 @@ var Session = class {
|
|
|
11641
11639
|
* The catalog a model/task-mode edit is checked against — the same
|
|
11642
11640
|
* discovered models and manifest modes the per-turn catalog block shows the
|
|
11643
11641
|
* planner, so a refusal here can never name something invalid that the
|
|
11644
|
-
* planner was never told about.
|
|
11645
|
-
*
|
|
11642
|
+
* planner was never told about. The catalog is not filtered by the
|
|
11643
|
+
* allowlist here — {@link checkModelAndModeValidity} narrows by
|
|
11646
11644
|
* allowlist itself, the same way `coerceAssignments` does.
|
|
11647
11645
|
*/
|
|
11648
11646
|
editCatalog() {
|
|
11649
11647
|
return {
|
|
11650
|
-
modelsByRunner: this.
|
|
11648
|
+
modelsByRunner: this.models(),
|
|
11651
11649
|
runnerModes: this.runnerModesFor(this.plan?.runners ?? []),
|
|
11652
|
-
perRunnerAllowlist: this.
|
|
11650
|
+
perRunnerAllowlist: this.allowlist()
|
|
11653
11651
|
};
|
|
11654
11652
|
}
|
|
11653
|
+
/**
|
|
11654
|
+
* The allowlist in force right now. Unset means no restriction — falling
|
|
11655
|
+
* back to the one planning started under would keep a restriction the user
|
|
11656
|
+
* has since cleared.
|
|
11657
|
+
*/
|
|
11658
|
+
allowlist() {
|
|
11659
|
+
return this.settingsFn().modelAllowlist ?? {};
|
|
11660
|
+
}
|
|
11661
|
+
/**
|
|
11662
|
+
* The discovered catalog as the resolver holds it now, per runner, with this
|
|
11663
|
+
* session's own discovery as the fallback where the resolver has nothing
|
|
11664
|
+
* cached. The resolver's cache outlives this session's snapshot in both
|
|
11665
|
+
* directions — an allowlist picker re-discovers into it mid-session — and a
|
|
11666
|
+
* model allowed after that must reach the planner with its real label and
|
|
11667
|
+
* variants, not as an id-only stub. Never triggers discovery itself.
|
|
11668
|
+
*/
|
|
11669
|
+
models() {
|
|
11670
|
+
const out = { ...this.modelsCache };
|
|
11671
|
+
for (const runner of /* @__PURE__ */ new Set([...Object.keys(out), ...this.plan?.runners ?? []])) {
|
|
11672
|
+
const cached2 = this.modelResolver.getCachedRunnerModels(runner);
|
|
11673
|
+
if (cached2.length > 0) out[runner] = cached2;
|
|
11674
|
+
}
|
|
11675
|
+
return out;
|
|
11676
|
+
}
|
|
11655
11677
|
get planState() {
|
|
11656
11678
|
return this.plan;
|
|
11657
11679
|
}
|
|
@@ -11789,8 +11811,7 @@ var Session = class {
|
|
|
11789
11811
|
this.modelsCache = modelsByRunner;
|
|
11790
11812
|
const runnerModes = this.runnerModesFor(chosenRunners);
|
|
11791
11813
|
const { verificationEnabled, modelAllowlist } = this.settingsFn();
|
|
11792
|
-
|
|
11793
|
-
const filteredModels = filterModelsForPrompt(modelsByRunner, this.currentAllowlist);
|
|
11814
|
+
const filteredModels = filterModelsForPrompt(modelsByRunner, modelAllowlist ?? {});
|
|
11794
11815
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
11795
11816
|
this.plan = {
|
|
11796
11817
|
tasks: [],
|
|
@@ -11915,12 +11936,12 @@ ${TASK_QUERY_ANSWER_OR_OPS}` : answer,
|
|
|
11915
11936
|
*/
|
|
11916
11937
|
taskQueryAnswer(query) {
|
|
11917
11938
|
const runners = this.plan?.runners ?? [];
|
|
11918
|
-
const allowlist = this.
|
|
11939
|
+
const allowlist = this.allowlist();
|
|
11919
11940
|
return renderTaskQueryAnswer(query, this.store.planTasks, {
|
|
11920
11941
|
runners,
|
|
11921
11942
|
// Allowlist-filtered like the always-on block: a read must not offer a
|
|
11922
11943
|
// model the planner is forbidden to assign.
|
|
11923
|
-
models: filterModelsForPrompt(this.
|
|
11944
|
+
models: filterModelsForPrompt(this.models(), allowlist),
|
|
11924
11945
|
modes: this.runnerModesFor(runners),
|
|
11925
11946
|
autonomousDefault: this.config.autonomousMode
|
|
11926
11947
|
});
|
|
@@ -11981,7 +12002,7 @@ The plan is unchanged. Rephrase the request, or adjust the tasks manually.`,
|
|
|
11981
12002
|
*
|
|
11982
12003
|
* Built from the allowlist-filtered view (`filterModelsForPrompt`), the same
|
|
11983
12004
|
* one the system prompt used — a restricted allowlist stays a hard bound on
|
|
11984
|
-
* every turn, not just the first.
|
|
12005
|
+
* every turn, not just the first. {@link models} itself is never
|
|
11985
12006
|
* filtered: `coerceAssignments` needs the full discovered catalog alongside
|
|
11986
12007
|
* the allowlist to resolve labels and clamp effort to real variants.
|
|
11987
12008
|
*
|
|
@@ -11991,8 +12012,8 @@ The plan is unchanged. Rephrase the request, or adjust the tasks manually.`,
|
|
|
11991
12012
|
*/
|
|
11992
12013
|
catalogBlock() {
|
|
11993
12014
|
if (!this.plan) return null;
|
|
11994
|
-
const allowlist = this.
|
|
11995
|
-
const filteredModels = filterModelsForPrompt(this.
|
|
12015
|
+
const allowlist = this.allowlist();
|
|
12016
|
+
const filteredModels = filterModelsForPrompt(this.models(), allowlist);
|
|
11996
12017
|
const runnerModes = this.runnerModesFor(this.plan.runners);
|
|
11997
12018
|
const autonomousDefault = this.config.autonomousMode;
|
|
11998
12019
|
const modelLines = this.plan.runners.map((runner) => {
|
|
@@ -12076,8 +12097,8 @@ Execution is RUNNING${locked.length ? ` \u2014 these tasks are locked: ${locked.
|
|
|
12076
12097
|
const plan = this.mutatePlan(
|
|
12077
12098
|
() => {
|
|
12078
12099
|
this.plan.researchLog = [...this.plan.researchLog ?? [], ...turn.researchLog];
|
|
12079
|
-
const allowlist = this.
|
|
12080
|
-
const coerced = coerceAssignments(result.tasks, allowlist, this.plan.runners, this.
|
|
12100
|
+
const allowlist = this.allowlist();
|
|
12101
|
+
const coerced = coerceAssignments(result.tasks, allowlist, this.plan.runners, this.models());
|
|
12081
12102
|
if (this.orchestrator.isRunning) {
|
|
12082
12103
|
this.orchestrator.reconcilePlan(coerced, this.plan.runners);
|
|
12083
12104
|
} else {
|
|
@@ -12109,8 +12130,7 @@ Execution is RUNNING${locked.length ? ` \u2014 these tasks are locked: ${locked.
|
|
|
12109
12130
|
this.modelsCache = modelsByRunner;
|
|
12110
12131
|
const runnerModes = this.runnerModesFor(runners);
|
|
12111
12132
|
const { verificationEnabled, modelAllowlist } = this.settingsFn();
|
|
12112
|
-
|
|
12113
|
-
const filteredModels = filterModelsForPrompt(modelsByRunner, this.currentAllowlist);
|
|
12133
|
+
const filteredModels = filterModelsForPrompt(modelsByRunner, modelAllowlist ?? {});
|
|
12114
12134
|
const goal = this.goal || priorHistory.find((m) => m.role === "user")?.content || userMessage;
|
|
12115
12135
|
return this.aiService.startConversation({
|
|
12116
12136
|
goal,
|
|
@@ -12158,8 +12178,8 @@ Execution is RUNNING${locked.length ? ` \u2014 these tasks are locked: ${locked.
|
|
|
12158
12178
|
return this.mutatePlan(() => {
|
|
12159
12179
|
this.plan.researchLog = [...this.plan.researchLog ?? [], ...turn.researchLog];
|
|
12160
12180
|
this.capturePrd(turn.text);
|
|
12161
|
-
const allowlist = this.
|
|
12162
|
-
const coerced = coerceAssignments(turn.tasks, allowlist, this.plan.runners, this.
|
|
12181
|
+
const allowlist = this.allowlist();
|
|
12182
|
+
const coerced = coerceAssignments(turn.tasks, allowlist, this.plan.runners, this.models());
|
|
12163
12183
|
this.orchestrator.loadPlan(coerced, this.plan.runners);
|
|
12164
12184
|
this.store.resetForRun({ preserveCompleted: false });
|
|
12165
12185
|
this.appendTranscript("assistant", `Plan generated with ${coerced.length} task${coerced.length === 1 ? "" : "s"}.`, now, "plan_generated");
|
|
@@ -12410,7 +12430,7 @@ Execution is RUNNING${locked.length ? ` \u2014 these tasks are locked: ${locked.
|
|
|
12410
12430
|
const allowed = effectiveAllowlist(
|
|
12411
12431
|
this.settingsFn().modelAllowlist?.[runner],
|
|
12412
12432
|
runner,
|
|
12413
|
-
{ ...this.
|
|
12433
|
+
{ ...this.models(), [runner]: catalog.models }
|
|
12414
12434
|
);
|
|
12415
12435
|
if (!allowed) return catalog;
|
|
12416
12436
|
const models = catalog.models.filter((m) => allowed.includes(m.modelId));
|