@nredd/pi-subagents 0.0.0-stage → 0.22.0-nredd.10
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/LICENSE +21 -0
- package/README.md +1444 -2
- package/dist/chunks/chunk-MSGGFB5Q.ts +6755 -0
- package/dist/chunks/chunk-MSGGFB5Q.ts.map +7 -0
- package/dist/chunks/conversation-viewer-A7AMRDVY.ts +15 -0
- package/dist/chunks/conversation-viewer-A7AMRDVY.ts.map +7 -0
- package/dist/index.ts +9874 -0
- package/dist/index.ts.map +7 -0
- package/package.json +82 -4
- package/src/abortable.ts +43 -0
- package/src/agent-color.ts +161 -0
- package/src/agent-file-toggle.ts +298 -0
- package/src/agent-manager.ts +2431 -0
- package/src/agent-runner.ts +1703 -0
- package/src/agent-source-badge.ts +75 -0
- package/src/agent-types.ts +346 -0
- package/src/child-context.ts +33 -0
- package/src/clock.ts +25 -0
- package/src/completion-outbox.ts +144 -0
- package/src/context.ts +58 -0
- package/src/cross-extension-rpc.ts +200 -0
- package/src/custom-agents.ts +441 -0
- package/src/default-agents.ts +126 -0
- package/src/detached-results.ts +150 -0
- package/src/enabled-models.ts +181 -0
- package/src/enterprise-local.ts +67 -0
- package/src/env.ts +33 -0
- package/src/error-message.ts +11 -0
- package/src/git-path.ts +66 -0
- package/src/group-join.ts +142 -0
- package/src/home-paths.ts +27 -0
- package/src/index.ts +5047 -0
- package/src/invocation-config.ts +158 -0
- package/src/memory.ts +179 -0
- package/src/mention-clone.ts +200 -0
- package/src/mention.ts +141 -0
- package/src/model-call.ts +83 -0
- package/src/model-resolver.ts +333 -0
- package/src/model-scope.ts +71 -0
- package/src/model-selection.ts +170 -0
- package/src/model-tiers.ts +176 -0
- package/src/nested-tools.ts +512 -0
- package/src/notification-result.ts +118 -0
- package/src/output-file.ts +186 -0
- package/src/package-resources.ts +639 -0
- package/src/plan-mode-children.ts +176 -0
- package/src/process-budget.ts +346 -0
- package/src/prompts.ts +161 -0
- package/src/quota-admission.ts +121 -0
- package/src/resource-loader.ts +65 -0
- package/src/schedule-store.ts +153 -0
- package/src/schedule.ts +514 -0
- package/src/settings.ts +851 -0
- package/src/skill-loader.ts +288 -0
- package/src/stale-ctx.ts +16 -0
- package/src/startup-error.ts +29 -0
- package/src/status-note.ts +113 -0
- package/src/structured-output.ts +130 -0
- package/src/types.ts +487 -0
- package/src/ui/agent-mention.ts +219 -0
- package/src/ui/agent-row.ts +245 -0
- package/src/ui/agent-widget.ts +722 -0
- package/src/ui/conversation-viewer.ts +837 -0
- package/src/ui/fallback-flag.ts +114 -0
- package/src/ui/fleet-list.ts +1020 -0
- package/src/ui/fleet-state.ts +154 -0
- package/src/ui/notification-view.ts +139 -0
- package/src/ui/schedule-menu.ts +105 -0
- package/src/ui/select-item.ts +45 -0
- package/src/ui/viewer-keys.ts +39 -0
- package/src/ui/workflow-card.ts +459 -0
- package/src/ui/workflow-dialog.ts +1138 -0
- package/src/ui/workflow-menu.ts +193 -0
- package/src/usage.ts +167 -0
- package/src/workflow/collisions.ts +123 -0
- package/src/workflow/entry.ts +47 -0
- package/src/workflow/host.ts +398 -0
- package/src/workflow/journal.ts +176 -0
- package/src/workflow/json-schema.ts +129 -0
- package/src/workflow/meta.ts +329 -0
- package/src/workflow/progress.ts +554 -0
- package/src/workflow/runtime.ts +1249 -0
- package/src/workflow/saved.ts +259 -0
- package/src/workflow/task.ts +317 -0
- package/src/workflow/tool-description.ts +200 -0
- package/src/workflow/worker-source.ts +903 -0
- package/src/worktree.ts +520 -0
- package/src/xml.ts +13 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* model-call.ts -- what an agent's in-flight model call is doing right now.
|
|
3
|
+
*
|
|
4
|
+
* A single model call can sit silent for minutes (long thinking, a slow
|
|
5
|
+
* provider), and the widget used to say `thinking…` for all of it with nothing
|
|
6
|
+
* to tell a busy agent from a dead stream. This tracks the call from the
|
|
7
|
+
* session's streaming events so every surface can say how long it has been
|
|
8
|
+
* thinking, how much it has written, or that it has gone quiet.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/** One streaming event from an assistant message, as the runner reports it. */
|
|
12
|
+
export type ModelCallEvent =
|
|
13
|
+
| { type: "start" }
|
|
14
|
+
| { type: "delta"; kind: "thinking" | "writing"; chars: number }
|
|
15
|
+
/** A stream event that carries no text (block boundaries): proof of life only. */
|
|
16
|
+
| { type: "beat" }
|
|
17
|
+
| { type: "end" };
|
|
18
|
+
|
|
19
|
+
export interface ModelCallState {
|
|
20
|
+
startedAt: number;
|
|
21
|
+
/** The last stream event of any kind, which is what `stalled?` is measured from. */
|
|
22
|
+
lastEventAt: number;
|
|
23
|
+
kind: "thinking" | "writing";
|
|
24
|
+
/** Characters streamed as text or tool-call arguments this call. */
|
|
25
|
+
writtenChars: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Silence this long mid-call reads as stalled. */
|
|
29
|
+
export const STALL_MS = 2 * 60_000;
|
|
30
|
+
|
|
31
|
+
/** Rough characters per token, for a figure shown before the provider reports usage. */
|
|
32
|
+
const CHARS_PER_TOKEN = 4;
|
|
33
|
+
|
|
34
|
+
/** Fold one event into `current`; `undefined` means no call is in flight. */
|
|
35
|
+
export function applyModelCallEvent(
|
|
36
|
+
current: ModelCallState | undefined,
|
|
37
|
+
event: ModelCallEvent,
|
|
38
|
+
now: number,
|
|
39
|
+
): ModelCallState | undefined {
|
|
40
|
+
switch (event.type) {
|
|
41
|
+
case "start":
|
|
42
|
+
return { startedAt: now, lastEventAt: now, kind: "thinking", writtenChars: 0 };
|
|
43
|
+
case "end":
|
|
44
|
+
return undefined;
|
|
45
|
+
case "beat":
|
|
46
|
+
return current ? { ...current, lastEventAt: now } : current;
|
|
47
|
+
case "delta": {
|
|
48
|
+
const base = current ?? { startedAt: now, lastEventAt: now, kind: "thinking" as const, writtenChars: 0 };
|
|
49
|
+
return {
|
|
50
|
+
...base,
|
|
51
|
+
lastEventAt: now,
|
|
52
|
+
// Once it has started writing, a late thinking block does not flip it back.
|
|
53
|
+
kind: event.kind === "writing" ? "writing" : base.kind,
|
|
54
|
+
writtenChars: base.writtenChars + (event.kind === "writing" ? event.chars : 0),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** `41s`, `2m41s`, `1h05m`. */
|
|
61
|
+
export function formatClock(ms: number): string {
|
|
62
|
+
const total = Math.max(0, Math.floor(ms / 1000));
|
|
63
|
+
if (total < 60) return `${total}s`;
|
|
64
|
+
const minutes = Math.floor(total / 60);
|
|
65
|
+
if (minutes < 60) return `${minutes}m${String(total % 60).padStart(2, "0")}s`;
|
|
66
|
+
return `${Math.floor(minutes / 60)}h${String(minutes % 60).padStart(2, "0")}m`;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* `thinking · 2m41s`, `writing · 3.2k tok`, or `stalled? · 2m41s`; undefined
|
|
71
|
+
* when no call is in flight.
|
|
72
|
+
*/
|
|
73
|
+
export function describeModelCall(state: ModelCallState | undefined, now: number): string | undefined {
|
|
74
|
+
if (!state) return undefined;
|
|
75
|
+
const silent = now - state.lastEventAt;
|
|
76
|
+
if (silent >= STALL_MS) return `stalled? · ${formatClock(silent)}`;
|
|
77
|
+
if (state.kind === "writing") {
|
|
78
|
+
// `950`, `3.2k`.
|
|
79
|
+
const tokens = Math.round(state.writtenChars / CHARS_PER_TOKEN);
|
|
80
|
+
return `writing · ${tokens < 1_000 ? `${tokens}` : `${(tokens / 1_000).toFixed(1).replace(/\.0$/, "")}k`} tok`;
|
|
81
|
+
}
|
|
82
|
+
return `thinking · ${formatClock(now - state.startedAt)}`;
|
|
83
|
+
}
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model resolution: exact match ("provider/modelId") with fuzzy fallback for tool inputs.
|
|
3
|
+
*/
|
|
4
|
+
import { exactTierModel } from "./model-tiers.js";
|
|
5
|
+
|
|
6
|
+
export interface ModelEntry {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
provider: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface ModelRegistry {
|
|
13
|
+
find(provider: string, modelId: string): any;
|
|
14
|
+
getAll(): any[];
|
|
15
|
+
getAvailable?(): any[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Logical model aliases supplied only by trusted global machine configuration. */
|
|
19
|
+
let modelAliases = new Map<string, string[]>();
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Replace the configured logical aliases. Alias keys are case-insensitive;
|
|
23
|
+
* candidates are canonical provider/model IDs and are resolved against the
|
|
24
|
+
* available registry at dispatch time.
|
|
25
|
+
*/
|
|
26
|
+
export function setModelAliases(aliases: Record<string, string[]> | undefined): void {
|
|
27
|
+
modelAliases = new Map(
|
|
28
|
+
Object.entries(aliases ?? {}).map(([alias, candidates]) => [alias.toLowerCase(), [...candidates]]),
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Per-agent model overrides from trusted global configuration: agent `type`
|
|
34
|
+
* (or `"*"`) -> model input. Resolved through `resolveModel`, so a value may be
|
|
35
|
+
* an alias, an exact `provider/id`, or a fuzzy name.
|
|
36
|
+
*/
|
|
37
|
+
let agentModels = new Map<string, string>();
|
|
38
|
+
|
|
39
|
+
/** Replace the configured per-agent model map. Keys are matched case-insensitively. */
|
|
40
|
+
export function setAgentModels(models: Record<string, string> | undefined): void {
|
|
41
|
+
agentModels = new Map(Object.entries(models ?? {}).map(([type, model]) => [type.toLowerCase(), model]));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** A snapshot for the shared selection policy; callers cannot mutate configuration. */
|
|
45
|
+
export function getAgentModels(): ReadonlyMap<string, string> {
|
|
46
|
+
return new Map(agentModels);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Narrows fuzzy candidates to the models the user enabled (pi's `enabledModels`),
|
|
51
|
+
* as lowercase `provider/id` keys. Injected rather than imported so this module
|
|
52
|
+
* stays free of settings I/O; `undefined` means no scope is configured. An
|
|
53
|
+
* unresolved dispatch passes its config root only for its diagnostic.
|
|
54
|
+
*/
|
|
55
|
+
export type ModelScopeProvider = (
|
|
56
|
+
registry: ModelRegistry,
|
|
57
|
+
context?: { cwd: string; homeDir?: string },
|
|
58
|
+
) => ReadonlySet<string> | undefined;
|
|
59
|
+
|
|
60
|
+
let modelScopeProvider: ModelScopeProvider | undefined;
|
|
61
|
+
|
|
62
|
+
/** Install (or clear) the enabled-model scope used to rank fuzzy matches. */
|
|
63
|
+
export function setModelScopeProvider(provider: ModelScopeProvider | undefined): void {
|
|
64
|
+
modelScopeProvider = provider;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** A copy for diagnostics and tests; callers cannot mutate resolver state. */
|
|
68
|
+
export function getModelAliases(): ReadonlyMap<string, readonly string[]> {
|
|
69
|
+
return new Map([...modelAliases].map(([alias, candidates]) => [alias, [...candidates]]));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Both display forms of a model. The short one goes on tight rows (the widget,
|
|
74
|
+
* the Agent tool result), the canonical one where there is room to disambiguate
|
|
75
|
+
* two providers serving a similarly-named model (the conversation viewer).
|
|
76
|
+
*
|
|
77
|
+
* One function, because `index.ts` labels the model it resolved before the run
|
|
78
|
+
* and `agent-manager.ts` relabels it from the live session afterwards — the two
|
|
79
|
+
* must agree or the label would visibly change the moment the session starts.
|
|
80
|
+
*/
|
|
81
|
+
export function describeModel(
|
|
82
|
+
model: { provider: string; id: string; name?: string },
|
|
83
|
+
): { modelName: string; modelId: string } {
|
|
84
|
+
return {
|
|
85
|
+
modelName: (model.name ?? model.id).replace(/^Claude\s+/i, "").toLowerCase(),
|
|
86
|
+
modelId: `${model.provider}/${model.id}`,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* A CONFIG model (`agentModels`, an agent's `model:`, a stored job's model) that
|
|
92
|
+
* did not resolve, so the spawn ran on the parent model instead. Recorded once on
|
|
93
|
+
* the `AgentRecord` by the shared spawn path; every surface reads it from there.
|
|
94
|
+
*/
|
|
95
|
+
export interface ModelFallback {
|
|
96
|
+
/** The configured input that failed to resolve. */
|
|
97
|
+
input: string;
|
|
98
|
+
/** Further configured inputs that also failed (e.g. a stored job model AND an `agentModels` override). */
|
|
99
|
+
also?: string[];
|
|
100
|
+
/** `provider/id` of the model actually used; absent when the session default (a parent with no model) ran. */
|
|
101
|
+
used?: string;
|
|
102
|
+
/** Whose model `used` is: the parent's (default) or the agent's own configured model (`agentModels` / definition `model:`), which took over from an unresolved stored model. */
|
|
103
|
+
via?: "parent" | "agent";
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** The fallback outcome for `input` when the spawn ran on `parent`. */
|
|
107
|
+
export function modelFallbackTo(input: string, parent: { provider: string; id: string } | undefined): ModelFallback {
|
|
108
|
+
return parent ? { input, used: `${parent.provider}/${parent.id}` } : { input };
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The disclosure line for a fallback: same `Note:` prefix as the unknown-agent-type
|
|
113
|
+
* note. Empty string when there was none, so callers can concatenate it blindly.
|
|
114
|
+
*/
|
|
115
|
+
export function modelFallbackNote(fallback: ModelFallback | undefined): string {
|
|
116
|
+
if (!fallback) return "";
|
|
117
|
+
const whose = fallback.via === "agent" ? "the agent's own model" : "parent model";
|
|
118
|
+
const used = fallback.used ? `${whose} ${fallback.used}` : "the session default model";
|
|
119
|
+
const inputs = [fallback.input, ...(fallback.also ?? [])];
|
|
120
|
+
const named = inputs.length === 1 ? `model "${inputs[0]}" did` : `models ${inputs.map(i => `"${i}"`).join(", ")} did`;
|
|
121
|
+
return `Note: configured ${named} not resolve; running on ${used}.`;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** API id pi gives virtual catalog entries such as `router/default`; they never reach a provider. */
|
|
125
|
+
const VIRTUAL_MODEL_API = "pi-virtual";
|
|
126
|
+
|
|
127
|
+
/** Whether `model` is a virtual (router) selection rather than a physical model. */
|
|
128
|
+
export function isVirtualModel(model: { api?: string } | undefined): boolean {
|
|
129
|
+
return model?.api === VIRTUAL_MODEL_API;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** The pre-response label of a virtual selection: no physical model has answered yet. */
|
|
133
|
+
export function describeVirtualModel(model: { provider: string; id: string; name?: string }): {
|
|
134
|
+
modelName: string;
|
|
135
|
+
modelId: string;
|
|
136
|
+
} {
|
|
137
|
+
const described = describeModel(model);
|
|
138
|
+
return { ...described, modelName: `${described.modelName} (routing)` };
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* The physical model behind an assistant message, or `undefined` when the
|
|
143
|
+
* message names none (an error from failed routing carries the virtual model).
|
|
144
|
+
*
|
|
145
|
+
* With a virtual selection (`agentModels["*"] = "router/default"`) the session
|
|
146
|
+
* model is the router; only responses record where a request actually went, so
|
|
147
|
+
* rows must be relabelled from them. `registry` supplies the display name, and
|
|
148
|
+
* is optional: without it the id stands in.
|
|
149
|
+
*/
|
|
150
|
+
export function describePhysicalModel(
|
|
151
|
+
message: { api?: string; provider?: string; model?: string } | undefined,
|
|
152
|
+
registry?: { find?(provider: string, modelId: string): { name?: string } | undefined },
|
|
153
|
+
): { modelName: string; modelId: string } | undefined {
|
|
154
|
+
if (!message?.provider || !message.model || isVirtualModel(message)) return undefined;
|
|
155
|
+
const found = registry?.find?.(message.provider, message.model);
|
|
156
|
+
return describeModel({ provider: message.provider, id: message.model, name: found?.name });
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** Parsed `[major, minor]` of a model id, or undefined when the family has no known scheme. */
|
|
160
|
+
export type ModelVersion = readonly [major: number, minor: number];
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Pull a version out of a model id (provider prefix ignored):
|
|
164
|
+
* - `claude-<family>-<n>[-<n>]`, e.g. `claude-opus-4-6`, `claude-opus-5`
|
|
165
|
+
* - `claude-<n>[-<n>]-<family>`, e.g. `claude-3-5-sonnet-20241022`
|
|
166
|
+
* - `gpt-<n>[.<n>]-<variant>`, e.g. `gpt-6.1-sol`
|
|
167
|
+
* A minor is one or two digits, so a trailing `-20250514` date stamp is never
|
|
168
|
+
* read as one. Dots and dashes are interchangeable between the parts.
|
|
169
|
+
*/
|
|
170
|
+
export function parseModelVersion(id: string): ModelVersion | undefined {
|
|
171
|
+
const bare = id.slice(id.lastIndexOf("/") + 1).toLowerCase();
|
|
172
|
+
const claude = /^claude-[a-z]+-(\d{1,2})(?:[-.](\d{1,2})(?!\d))?(?:-|$)/.exec(bare)
|
|
173
|
+
?? /^claude-(\d{1,2})(?:[-.](\d{1,2})(?!\d))?-[a-z]/.exec(bare);
|
|
174
|
+
const match = claude ?? /^gpt-(\d+)(?:[.-](\d{1,2})(?!\d))?(?:-|$)/.exec(bare);
|
|
175
|
+
if (!match) return undefined;
|
|
176
|
+
return [Number(match[1]), Number(match[2] ?? 0)];
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/** Descending version order; an unversioned model sorts after every versioned one. */
|
|
180
|
+
function compareVersionsDesc(a: ModelVersion | undefined, b: ModelVersion | undefined): number {
|
|
181
|
+
if (a && b) return b[0] - a[0] || b[1] - a[1];
|
|
182
|
+
return a ? -1 : b ? 1 : 0;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Resolve a model string to a Model instance.
|
|
187
|
+
* Tries exact match first ("provider/modelId"), then fuzzy match against all available models.
|
|
188
|
+
* Returns the Model on success, or an error message string on failure.
|
|
189
|
+
*/
|
|
190
|
+
export function resolveModel(
|
|
191
|
+
input: string,
|
|
192
|
+
registry: ModelRegistry,
|
|
193
|
+
context?: { cwd: string; homeDir?: string },
|
|
194
|
+
): any | string {
|
|
195
|
+
const aliasCandidates = modelAliases.get(input.trim().toLowerCase());
|
|
196
|
+
if (aliasCandidates) {
|
|
197
|
+
for (const candidate of aliasCandidates) {
|
|
198
|
+
const resolved = exactTierModel(candidate, registry);
|
|
199
|
+
if (resolved) return resolved;
|
|
200
|
+
}
|
|
201
|
+
return `Model alias "${input}" has no available candidate.\n\nCandidates:\n${aliasCandidates.map(candidate => ` ${candidate}`).join("\n")}`;
|
|
202
|
+
}
|
|
203
|
+
return resolveCanonicalModel(input, registry, context);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Pick among fuzzy candidates. Restricted to the enabled model scope when one is
|
|
208
|
+
* configured and any candidate is in it, then newest parsed version first, then
|
|
209
|
+
* match score. A bare family name like "opus" therefore means the newest opus
|
|
210
|
+
* the user has enabled, not whichever id happens to be shortest.
|
|
211
|
+
*/
|
|
212
|
+
function scopedCandidates<T extends { entry: ModelEntry }>(
|
|
213
|
+
candidates: T[],
|
|
214
|
+
registry: ModelRegistry,
|
|
215
|
+
context?: { cwd: string; homeDir?: string },
|
|
216
|
+
): T[] {
|
|
217
|
+
const scope = modelScopeProvider?.(registry, context);
|
|
218
|
+
const scoped = scope ? candidates.filter(candidate => scope.has(`${candidate.entry.provider}/${candidate.entry.id}`.toLowerCase())) : [];
|
|
219
|
+
return scoped.length > 0 ? scoped : candidates;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/** Stable tie-breaker independent of registry insertion order and locale. */
|
|
223
|
+
function compareModelIdentity(a: ModelEntry, b: ModelEntry): number {
|
|
224
|
+
const left = `${a.provider}/${a.id}`;
|
|
225
|
+
const right = `${b.provider}/${b.id}`;
|
|
226
|
+
return Number(left > right) - Number(left < right);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function rankFuzzy(
|
|
230
|
+
matches: { entry: ModelEntry; score: number }[],
|
|
231
|
+
registry: ModelRegistry,
|
|
232
|
+
context?: { cwd: string; homeDir?: string },
|
|
233
|
+
): ModelEntry | undefined {
|
|
234
|
+
const ranked = scopedCandidates(matches, registry, context)
|
|
235
|
+
.map(c => ({ ...c, version: parseModelVersion(c.entry.id) }))
|
|
236
|
+
.sort((a, b) => compareVersionsDesc(a.version, b.version) || b.score - a.score || compareModelIdentity(a.entry, b.entry));
|
|
237
|
+
return ranked[0]?.entry;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/** Numeric runs stay ordered and contiguous: `5-5` cannot reuse the `5` in `4-5`. */
|
|
241
|
+
function versionRuns(value: string): string[] {
|
|
242
|
+
return [...value.replace(/-\d{8}$/, "").matchAll(/(?:^|[\s-])(\d+(?:[\s-]+\d+)*)(?=$|[\s-])/g)].map(match => match[1]!.replace(/\s+/g, "-"));
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/** Resolve an exact or fuzzy provider/model request without consulting aliases. */
|
|
246
|
+
function resolveCanonicalModel(
|
|
247
|
+
input: string,
|
|
248
|
+
registry: ModelRegistry,
|
|
249
|
+
context?: { cwd: string; homeDir?: string },
|
|
250
|
+
): any | string {
|
|
251
|
+
// Available models (those with auth configured)
|
|
252
|
+
const all = (registry.getAvailable?.() ?? registry.getAll()) as ModelEntry[];
|
|
253
|
+
const availableSet = new Set(all.map(m => `${m.provider}/${m.id}`.toLowerCase()));
|
|
254
|
+
|
|
255
|
+
// 1. Exact match: "provider/modelId" — only if available (has auth)
|
|
256
|
+
const slashIdx = input.indexOf("/");
|
|
257
|
+
if (slashIdx !== -1) {
|
|
258
|
+
const provider = input.slice(0, slashIdx);
|
|
259
|
+
const modelId = input.slice(slashIdx + 1);
|
|
260
|
+
if (availableSet.has(input.toLowerCase())) {
|
|
261
|
+
const found = registry.find(provider, modelId);
|
|
262
|
+
if (found) return found;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// 2. Fuzzy match against available models. Normalize separators so cosmetic
|
|
267
|
+
// punctuation differences still match — e.g. "claude-haiku-4.5" and
|
|
268
|
+
// "claude-haiku-4-5" (dot vs dash in the version) resolve to the same model.
|
|
269
|
+
const normalize = (s: string) => s.toLowerCase().replace(/\./g, "-");
|
|
270
|
+
const query = normalize(input);
|
|
271
|
+
const requestedVersions = versionRuns(query.slice(slashIdx + 1));
|
|
272
|
+
|
|
273
|
+
// Score each model: prefer exact id match > id contains > name contains > provider+id contains
|
|
274
|
+
const matches: { entry: ModelEntry; score: number }[] = [];
|
|
275
|
+
|
|
276
|
+
for (const m of all) {
|
|
277
|
+
const id = normalize(m.id);
|
|
278
|
+
const name = normalize(m.name);
|
|
279
|
+
const full = normalize(`${m.provider}/${m.id}`);
|
|
280
|
+
const idVersions = versionRuns(id);
|
|
281
|
+
const versions = idVersions.length > 0 ? idVersions : versionRuns(name);
|
|
282
|
+
// Filter before scope/ranking, including substring and name matches. A
|
|
283
|
+
// major-only input can select a newer minor, but never another major or
|
|
284
|
+
// a minor token masquerading as the requested major.
|
|
285
|
+
if (!requestedVersions.every(requested => versions.some(version => version === requested || version.startsWith(`${requested}-`)))) continue;
|
|
286
|
+
|
|
287
|
+
let score = 0;
|
|
288
|
+
if (id === query || full === query) {
|
|
289
|
+
score = 100; // exact
|
|
290
|
+
} else if (id.includes(query) || full.includes(query)) {
|
|
291
|
+
score = 60 + (query.length / id.length) * 30; // substring, prefer tighter matches
|
|
292
|
+
} else if (name.includes(query)) {
|
|
293
|
+
score = 40 + (query.length / name.length) * 20;
|
|
294
|
+
} else if (
|
|
295
|
+
// A trailing date-stamp token (e.g. "20251001") is optional, so a
|
|
296
|
+
// date-pinned config like "claude-haiku-4-5-20251001" still matches an
|
|
297
|
+
// undated registry id like "claude-haiku-4-5".
|
|
298
|
+
query
|
|
299
|
+
.split(/[\s\-/]+/)
|
|
300
|
+
.every(part => /^\d{8}$/.test(part) || id.includes(part) || name.includes(part) || m.provider.toLowerCase().includes(part))
|
|
301
|
+
) {
|
|
302
|
+
score = 20; // all parts present somewhere
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
if (score >= 20) matches.push({ entry: m, score });
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// An exact id (or provider/id) is the caller naming a model, not describing
|
|
309
|
+
// one: it wins outright, whatever the scope or any newer sibling.
|
|
310
|
+
const exact = matches.filter(c => c.score === 100);
|
|
311
|
+
const exactBest = exact.sort((a, b) => compareModelIdentity(a.entry, b.entry))[0];
|
|
312
|
+
const bestMatch = exactBest ? exactBest.entry : rankFuzzy(matches, registry, context);
|
|
313
|
+
if (bestMatch) {
|
|
314
|
+
const found = registry.find(bestMatch.provider, bestMatch.id);
|
|
315
|
+
if (found) return found;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// 3. Provider fallback: a "provider/modelId" query that didn't match under the
|
|
319
|
+
// named provider (exact or fuzzy above) retries against all providers. The
|
|
320
|
+
// named provider is preferred when present; this only kicks in when it isn't,
|
|
321
|
+
// so the same model from another provider beats falling back to "inherit".
|
|
322
|
+
if (slashIdx !== -1) {
|
|
323
|
+
const bare = resolveCanonicalModel(input.slice(slashIdx + 1), registry, context);
|
|
324
|
+
if (typeof bare !== "string") return bare;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// 4. No match — list available models
|
|
328
|
+
const modelList = scopedCandidates(all.map(entry => ({ entry })), registry, context)
|
|
329
|
+
.map(({ entry }) => ` ${entry.provider}/${entry.id}`)
|
|
330
|
+
.sort()
|
|
331
|
+
.join("\n");
|
|
332
|
+
return `Model not found: "${input}".\n\nAvailable models:\n${modelList}`;
|
|
333
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* model-scope.ts — `scopeModels` policy, shared by the top-level Agent tool and
|
|
3
|
+
* the nested delegation tools so a nested spawn can't escape the allowlist the
|
|
4
|
+
* top-level path enforces.
|
|
5
|
+
*
|
|
6
|
+
* State lives here (rather than in an index.ts closure) for the same reason
|
|
7
|
+
* `disableDefaults` lives in agent-types.ts: both entry points need it.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { isModelInScope, type ModelRegistryRef, readEnabledModels, resolveEnabledModels } from "./enabled-models.js";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* When enabled, subagent model choices are validated against `enabledModels`
|
|
14
|
+
* from pi's settings — both global `<agentDir>/settings.json` and project-local
|
|
15
|
+
* `<cwd>/.pi/settings.json` (project overrides global). Off by default; opt-in
|
|
16
|
+
* via `/agents → Settings`. See the SubagentsSettings.scopeModels docstring for
|
|
17
|
+
* the hard-error vs warn-and-proceed policy and its rationale.
|
|
18
|
+
*/
|
|
19
|
+
let scopeModelsEnabled = false;
|
|
20
|
+
|
|
21
|
+
export function isScopeModelsEnabled(): boolean { return scopeModelsEnabled; }
|
|
22
|
+
export function setScopeModelsEnabled(enabled: boolean): void { scopeModelsEnabled = enabled; }
|
|
23
|
+
|
|
24
|
+
export type ModelScopeVerdict =
|
|
25
|
+
/** In scope, or nothing to validate against (feature off / no allowlist). */
|
|
26
|
+
| { kind: "ok" }
|
|
27
|
+
/** Caller-supplied out-of-scope choice — refuse the spawn with this message. */
|
|
28
|
+
| { kind: "error"; message: string }
|
|
29
|
+
/** Frontmatter-pinned or parent-inherited — proceed, but tell the user. */
|
|
30
|
+
| { kind: "warn"; message: string };
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Check the effective resolved model against the user's enabledModels list.
|
|
34
|
+
*
|
|
35
|
+
* scopeModels guards against *runtime* LLM choices, not user-level config:
|
|
36
|
+
* - Caller-supplied out-of-scope → hard error (the orchestrator made an explicit
|
|
37
|
+
* out-of-scope choice; surface it so it picks differently).
|
|
38
|
+
* - Frontmatter-pinned or parent-inherited out-of-scope → warn but proceed (the
|
|
39
|
+
* user authored/installed this agent or chose the parent's model; trust it).
|
|
40
|
+
*/
|
|
41
|
+
export function checkModelScope(args: {
|
|
42
|
+
homeDir?: string;
|
|
43
|
+
model: { provider: string; id: string } | undefined;
|
|
44
|
+
cwd: string;
|
|
45
|
+
modelRegistry: ModelRegistryRef;
|
|
46
|
+
/** True when the model came from the tool call rather than frontmatter. */
|
|
47
|
+
callerSupplied: boolean;
|
|
48
|
+
/** Display name used in the warning toast. */
|
|
49
|
+
agentLabel: string;
|
|
50
|
+
/** The raw `model:` input, when there was one. */
|
|
51
|
+
modelInput?: string;
|
|
52
|
+
}): ModelScopeVerdict {
|
|
53
|
+
const { model, cwd, modelRegistry, callerSupplied, agentLabel, modelInput } = args;
|
|
54
|
+
if (!scopeModelsEnabled || !model) return { kind: "ok" };
|
|
55
|
+
|
|
56
|
+
const allowed = resolveEnabledModels(readEnabledModels(cwd, args.homeDir), modelRegistry, cwd, args.homeDir);
|
|
57
|
+
if (!allowed || isModelInScope(model, allowed)) return { kind: "ok" };
|
|
58
|
+
|
|
59
|
+
if (callerSupplied) {
|
|
60
|
+
const list = [...allowed].sort().map(m => ` ${m}`).join("\n");
|
|
61
|
+
return {
|
|
62
|
+
kind: "error",
|
|
63
|
+
message: `Model not in scope: "${modelInput}".\n\nAllowed models (from enabledModels):\n${list}`,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
const modelLabel = modelInput ?? `${model.provider}/${model.id}`;
|
|
67
|
+
return {
|
|
68
|
+
kind: "warn",
|
|
69
|
+
message: `Agent "${agentLabel}" using out-of-scope model "${modelLabel}"`,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/** One selection policy for every dispatch, independent of its transport. */
|
|
2
|
+
import type { Api, Model } from "@earendil-works/pi-ai";
|
|
3
|
+
import { type Clock, realClock } from "./clock.js";
|
|
4
|
+
import { describeModel, describeVirtualModel, getAgentModels, getModelAliases, isVirtualModel, type ModelFallback, type ModelRegistry, modelFallbackNote, modelFallbackTo, resolveModel } from "./model-resolver.js";
|
|
5
|
+
import { checkModelScope } from "./model-scope.js";
|
|
6
|
+
import { exactTierModel, getModelResolution, parseTierBinding, resolveTier, type TierBinding, type TierDisclosure, type TierOutcome, tierBinding, tierNote } from "./model-tiers.js";
|
|
7
|
+
import { type AdmissionEvents, admissionOutcome, type QuotaBlock } from "./quota-admission.js";
|
|
8
|
+
|
|
9
|
+
/** Exact compatibility pins for user-defined legacy Explore definitions. User aliases win. */
|
|
10
|
+
const LEGACY_MODEL_PINS = new Map([
|
|
11
|
+
["claude-haiku-4-5", "anthropic/claude-haiku-4-5"],
|
|
12
|
+
]);
|
|
13
|
+
|
|
14
|
+
/** The winning precedence level, before resolution or fallback. */
|
|
15
|
+
export type ModelSource = "param" | "agentModels:type" | "agentModels:*" | "definition" | "parent";
|
|
16
|
+
|
|
17
|
+
/** Keep the original request even when it could not be resolved. */
|
|
18
|
+
export interface ModelSelection {
|
|
19
|
+
requested?: string;
|
|
20
|
+
source: ModelSource;
|
|
21
|
+
model: Model<Api> | undefined;
|
|
22
|
+
outcome: "resolved" | "inherited" | "fallback";
|
|
23
|
+
fallback?: ModelFallback;
|
|
24
|
+
scopeWarning?: string;
|
|
25
|
+
/** Serializable tier provenance, retained when the answering model changes. */
|
|
26
|
+
tier?: TierOutcome;
|
|
27
|
+
/** A prepared binding is resolved with admission before starting the child. */
|
|
28
|
+
tierBinding?: TierBinding;
|
|
29
|
+
tierAdmitted?: boolean;
|
|
30
|
+
/** Startup-only parent floor if credentials/profile disappear between preflight and admission. */
|
|
31
|
+
tierParent?: Model<Api>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Choose the input once: explicit parameter > type > wildcard > definition; blank strings are unset. */
|
|
35
|
+
export function modelRequest(type: string, definitionModel?: string, paramModel?: string | Model<Api> | null): {
|
|
36
|
+
requested?: string;
|
|
37
|
+
source: ModelSource;
|
|
38
|
+
} {
|
|
39
|
+
if (paramModel != null && (typeof paramModel !== "string" || paramModel.trim() !== "")) {
|
|
40
|
+
return { requested: typeof paramModel === "string" ? paramModel : `${paramModel.provider}/${paramModel.id}`, source: "param" };
|
|
41
|
+
}
|
|
42
|
+
const overrides = getAgentModels();
|
|
43
|
+
const typed = overrides.get(type.toLowerCase());
|
|
44
|
+
if (typed?.trim()) return { requested: typed, source: "agentModels:type" };
|
|
45
|
+
const wildcard = overrides.get("*");
|
|
46
|
+
if (wildcard?.trim()) return { requested: wildcard, source: "agentModels:*" };
|
|
47
|
+
if (definitionModel?.trim()) return { requested: definitionModel, source: "definition" };
|
|
48
|
+
return { source: "parent" };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Choose an exact configured input or tier binding before record creation.
|
|
53
|
+
* Only explicit non-tier tool inputs retain fuzzy matching. Tier admission is
|
|
54
|
+
* asynchronous and completes through admitModelSelection before startup; this
|
|
55
|
+
* synchronous preflight preserves spawn's immediate-id and validation contract.
|
|
56
|
+
* An already-open resume keeps the record and does not select again.
|
|
57
|
+
*/
|
|
58
|
+
export function selectModel(request: {
|
|
59
|
+
homeDir?: string;
|
|
60
|
+
agentType: string;
|
|
61
|
+
definitionModel?: string;
|
|
62
|
+
paramModel?: string | Model<Api> | null;
|
|
63
|
+
parentModel: Model<Api> | undefined;
|
|
64
|
+
registry: ModelRegistry;
|
|
65
|
+
cwd: string;
|
|
66
|
+
agentLabel?: string;
|
|
67
|
+
}): ModelSelection | string {
|
|
68
|
+
const input = modelRequest(request.agentType, request.definitionModel, request.paramModel);
|
|
69
|
+
let selection: ModelSelection = { ...input, model: request.parentModel, outcome: "inherited" };
|
|
70
|
+
if (input.requested) {
|
|
71
|
+
const requested = input.requested.trim();
|
|
72
|
+
const legacy = getModelAliases().get(requested.toLowerCase());
|
|
73
|
+
const legacyBinding = legacy ? parseTierBinding("legacy", legacy) : undefined;
|
|
74
|
+
// Preserve existing enterprise manifests during the built-in Explore migration.
|
|
75
|
+
// An explicit cheap binding always wins, even when it is unavailable.
|
|
76
|
+
const cheapCompatibility = requested === "@cheap" && request.agentType === "Explore"
|
|
77
|
+
&& input.source === "definition"
|
|
78
|
+
? parseTierBinding("cheap", getModelAliases().get("claude-haiku-4-5")) : undefined;
|
|
79
|
+
const binding = requested.startsWith("@") ? tierBinding(requested.slice(1)) ?? cheapCompatibility
|
|
80
|
+
: legacyBinding ? { ...legacyBinding, tier: requested } : undefined;
|
|
81
|
+
if (requested.startsWith("@") || legacy) {
|
|
82
|
+
const tier = requested.startsWith("@") ? requested.slice(1) : requested;
|
|
83
|
+
const refs = binding?.kind === "routed" ? [binding.profile] : binding?.members ?? [];
|
|
84
|
+
const model = refs.map(ref => exactTierModel(ref, request.registry)).find(Boolean);
|
|
85
|
+
if (!binding || !model) {
|
|
86
|
+
const outcome: TierOutcome = binding ? { kind: "unavailable", tier, tried: refs } : { kind: "unmapped", tier };
|
|
87
|
+
const mode = outcome.kind === "unmapped" ? getModelResolution().onUnmapped : getModelResolution().onUnavailable;
|
|
88
|
+
if (mode === "error") return `Model tier @${tier} is ${outcome.kind}.`;
|
|
89
|
+
selection = { ...selection, tier: outcome, outcome: "fallback", fallback: modelFallbackTo(input.requested, request.parentModel) };
|
|
90
|
+
} else {
|
|
91
|
+
selection = { ...input, model, outcome: "resolved", tierBinding: binding, tierParent: request.parentModel };
|
|
92
|
+
}
|
|
93
|
+
} else {
|
|
94
|
+
const compatibilityPin = input.source === "definition" && request.agentType === "Explore"
|
|
95
|
+
? LEGACY_MODEL_PINS.get(requested) : undefined;
|
|
96
|
+
const resolved = request.paramModel != null && typeof request.paramModel === "object"
|
|
97
|
+
? request.paramModel : input.source === "param" ? resolveModel(requested, request.registry, { cwd: request.cwd, homeDir: request.homeDir })
|
|
98
|
+
: exactTierModel(compatibilityPin ?? requested, request.registry) ?? `Model not found: "${requested}".`;
|
|
99
|
+
if (typeof resolved !== "string") selection = { ...input, model: resolved, outcome: "resolved" };
|
|
100
|
+
else if (compatibilityPin) {
|
|
101
|
+
const tier: TierOutcome = { kind: "unavailable", tier: requested, tried: [compatibilityPin] };
|
|
102
|
+
if (getModelResolution().onUnavailable === "error") return `Model tier @${requested} is unavailable.`;
|
|
103
|
+
selection = { ...selection, tier, outcome: "fallback", fallback: modelFallbackTo(input.requested, request.parentModel) };
|
|
104
|
+
} else {
|
|
105
|
+
if (input.source === "param" || getModelResolution().onUnavailable === "error") return resolved;
|
|
106
|
+
selection = { ...selection, outcome: "fallback", fallback: modelFallbackTo(input.requested, request.parentModel) };
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const scope = checkModelScope({
|
|
111
|
+
model: selection.model, cwd: request.cwd, modelRegistry: request.registry,
|
|
112
|
+
callerSupplied: input.source === "param" && !selection.tierBinding && !selection.tier, agentLabel: request.agentLabel ?? request.agentType,
|
|
113
|
+
modelInput: input.requested, homeDir: request.homeDir,
|
|
114
|
+
});
|
|
115
|
+
if (scope.kind === "error") return scope.message;
|
|
116
|
+
if (scope.kind === "warn") selection.scopeWarning = scope.message;
|
|
117
|
+
return selection;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** Label an admitted physical model before any response, without replacing the virtual selection. */
|
|
121
|
+
export function describeSelection(selection: ModelSelection | undefined, registry: ModelRegistry): { modelName?: string; modelId?: string } {
|
|
122
|
+
const admitted = selection?.tier?.kind === "routed" ? selection.tier.admitted : undefined;
|
|
123
|
+
if (admitted) {
|
|
124
|
+
const slash = admitted.indexOf("/");
|
|
125
|
+
const provider = admitted.slice(0, slash);
|
|
126
|
+
const id = admitted.slice(slash + 1);
|
|
127
|
+
return describeModel(registry.find(provider, id) ?? { provider, id });
|
|
128
|
+
}
|
|
129
|
+
const model = selection?.model;
|
|
130
|
+
return model ? isVirtualModel(model) ? describeVirtualModel(model) : describeModel(model) : {};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** Resolved selection identity for model-facing text, not an actionable fallback warning. */
|
|
134
|
+
export function modelIdentityNote(carrier: { modelSelection?: ModelSelection; modelTier?: TierDisclosure } | undefined): string {
|
|
135
|
+
const selected = carrier?.modelSelection?.model;
|
|
136
|
+
// Tier notes already carry admission/answer provenance. Literal virtual
|
|
137
|
+
// selections have no such evidence, so never claim their alias is a leaf.
|
|
138
|
+
return selected && !carrier?.modelTier
|
|
139
|
+
? `Resolved model: ${selected.provider}/${selected.id}${isVirtualModel(selected) ? " (routing alias; physical response model: unknown)" : ""}.`
|
|
140
|
+
: "";
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** One disclosure for records, persisted details, workflows and notices. */
|
|
144
|
+
export function modelSelectionNote(carrier: { modelTier?: TierDisclosure; modelFallback?: ModelFallback; invocation?: { modelId?: string } } | undefined): string {
|
|
145
|
+
const tier = carrier?.modelTier;
|
|
146
|
+
const fallback = carrier?.modelFallback;
|
|
147
|
+
const sameRequest = tier && (fallback?.input === tier.tier || fallback?.input === `@${tier.tier}`);
|
|
148
|
+
return [tierNote(tier, carrier?.invocation?.modelId), sameRequest ? "" : modelFallbackNote(fallback)].filter(Boolean).join("\n");
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** Admission for tiers is made once and is shared by every transport. */
|
|
152
|
+
export async function admitModelSelection(selection: ModelSelection, registry: ModelRegistry, events: AdmissionEvents, clock: Clock = realClock, signal?: AbortSignal): Promise<QuotaBlock | undefined> {
|
|
153
|
+
if (!selection.tierBinding || selection.tierAdmitted) return selection.tier?.kind === "exhausted" ? selection.tier.block : undefined;
|
|
154
|
+
selection.tier = await resolveTier(selection.tierBinding.tier, {
|
|
155
|
+
registry, binding: selection.tierBinding, admit: ref => admissionOutcome(events, ref, undefined, clock, signal),
|
|
156
|
+
});
|
|
157
|
+
selection.tierAdmitted = true;
|
|
158
|
+
if (selection.tier.kind === "routed" || selection.tier.kind === "static") selection.model = selection.tier.model;
|
|
159
|
+
if (selection.tier.kind === "exhausted") return selection.tier.block;
|
|
160
|
+
// The binding is handed to `resolveTier`, so it is never `unmapped` here.
|
|
161
|
+
if (selection.tier.kind === "unavailable") {
|
|
162
|
+
if (getModelResolution().onUnavailable === "error") throw new Error(`Model tier @${selection.tier.tier} is unavailable.`);
|
|
163
|
+
selection.model = selection.tierParent;
|
|
164
|
+
selection.outcome = "fallback";
|
|
165
|
+
selection.fallback = modelFallbackTo(selection.requested ?? `@${selection.tier.tier}`, selection.tierParent);
|
|
166
|
+
delete selection.tierBinding;
|
|
167
|
+
}
|
|
168
|
+
delete selection.tierParent;
|
|
169
|
+
return undefined;
|
|
170
|
+
}
|