@aexol/spectral 0.9.258 → 0.9.259

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.
@@ -39,11 +39,13 @@ export declare function refreshCloudAgents(opts: {
39
39
  * (SYSTEM_AGENTS, read-only) plus cloud agents from the backend cache
40
40
  * (refreshCloudAgents, managed in Aexol Studio).
41
41
  *
42
- * Precedence: cloud agents override system agents on name collision, but
43
- * ALL cloud agents are returned — including same-named subagents that live
44
- * under different PRIMARY agents (subagent names are no longer globally
45
- * unique per team; name resolution is parent-aware, see
46
- * `resolveAgentByName`). Primaries remain unique per team by construction.
42
+ * Discovery is name-agnostic: ALL agents are returned, including cloud
43
+ * agents that share a name with a system agent (subagent names are no
44
+ * longer globally unique per team). Name-collision precedence is applied
45
+ * at resolution time in `resolveAgentByName` (system agents win in
46
+ * team-wide mode; a primary's own subtree wins in scoped mode).
47
+ * Primaries remain unique per team by construction (the backend blocks
48
+ * reserved system names for cloud primaries).
47
49
  * Never throws and never touches the network — offline / logged-out
48
50
  * sessions simply get the system agents.
49
51
  */
@@ -74,6 +76,17 @@ export type AgentSubtreeRef = Pick<AgentConfig, "id" | "name">;
74
76
  * back to team-wide resolution.
75
77
  */
76
78
  export declare function agentsInSubtree(agents: AgentConfig[], activePrimary?: AgentSubtreeRef | null): AgentConfig[];
79
+ /**
80
+ * The set of agents a session can actually reach:
81
+ *
82
+ * - Scoped (an `activePrimary` cloud primary): the primary's subtree plus
83
+ * the built-in system agents — a same-named cloud subagent in the
84
+ * subtree intentionally shadows the system agent, so system agents are
85
+ * only appended when their name is free in the subtree.
86
+ * - Team-wide (no active primary): system agents win over same-named
87
+ * cloud agents (dedupe keeps the system row, first).
88
+ */
89
+ export declare function reachableAgents(agents: AgentConfig[], activePrimary?: AgentSubtreeRef | null): AgentConfig[];
77
90
  /**
78
91
  * Outcome of resolving an agent name against a discovered agent list,
79
92
  * optionally scoped to an active primary's subtree.
@@ -93,16 +106,23 @@ export type AgentResolution = {
93
106
  /**
94
107
  * Resolve an agent name to a single agent.
95
108
  *
96
- * - With an `activePrimary` ref (a cloud primary with a backend id):
109
+ * - Team-wide (no `activePrimary`, e.g. the built-in ghost session):
110
+ * SYSTEM agents always win over same-named cloud agents, so a cloud
111
+ * subagent named "executor" can no longer hijack the system executor.
112
+ * Only when no system agent has that name does resolution fall through
113
+ * to the cloud first-match (historical behavior for team-wide
114
+ * duplicates — not an error in fallback mode).
115
+ * - Scoped (an `activePrimary` cloud primary with a backend id):
97
116
  * candidates are scoped to the primary's subtree (the primary itself +
98
117
  * its direct children, plus any other agent sharing the primary's name),
99
118
  * so same-named subagents under different primaries resolve to the
100
- * caller's own subtree. A name that matches multiple agents within the
101
- * subtree (legacy data) is ambiguous — the caller must surface the
102
- * conflict, never silently pick one.
103
- * - Without one (standalone session / system primary): team-wide
104
- * first-match, exactly the historical behavior (duplicates across the
105
- * team are not an error in fallback mode).
119
+ * caller's own subtree. A same-named cloud subagent in the subtree
120
+ * intentionally shadows the system agent (that primary's own
121
+ * "executor"). If the name is NOT in the subtree, resolution falls back
122
+ * to SYSTEM agents (never to cloud agents of other trees). A name that
123
+ * matches multiple agents within the subtree (legacy data) is
124
+ * ambiguous — the caller must surface the conflict, never silently
125
+ * pick one.
106
126
  */
107
127
  export declare function resolveAgentByName(name: string, agents: AgentConfig[], activePrimary?: AgentSubtreeRef | null): AgentResolution;
108
128
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/agent/agents.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;AAC/C,MAAM,WAAW,WAAW;IAC1B,oEAAoE;IACpE,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,E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ENTS, read-only) plus cloud agents from the backend cache
220
220
  * (refreshCloudAgents, managed in Aexol Studio).
221
221
  *
222
- * Precedence: cloud agents override system agents on name collision, but
223
- * ALL cloud agents are returned — including same-named subagents that live
224
- * under different PRIMARY agents (subagent names are no longer globally
225
- * unique per team; name resolution is parent-aware, see
226
- * `resolveAgentByName`). Primaries remain unique per team by construction.
222
+ * Discovery is name-agnostic: ALL agents are returned, including cloud
223
+ * agents that share a name with a system agent (subagent names are no
224
+ * longer globally unique per team). Name-collision precedence is applied
225
+ * at resolution time in `resolveAgentByName` (system agents win in
226
+ * team-wide mode; a primary's own subtree wins in scoped mode).
227
+ * Primaries remain unique per team by construction (the backend blocks
228
+ * reserved system names for cloud primaries).
227
229
  * Never throws and never touches the network — offline / logged-out
228
230
  * sessions simply get the system agents.
229
231
  */
230
232
  export function discoverAgents(teamId) {
231
233
  const cloudAgents = getCloudAgentCache(teamId ?? LEGACY_CLOUD_TEAM).agents;
232
- const cloudNames = new Set(cloudAgents.map((a) => a.name));
233
- return [
234
- // System agents survive only when no cloud agent shadows their name.
235
- ...SYSTEM_AGENTS.filter((a) => !cloudNames.has(a.name)),
236
- ...cloudAgents,
237
- ];
234
+ return [...SYSTEM_AGENTS, ...cloudAgents];
238
235
  }
239
236
  export function discoverPrimaryAgent(teamId) {
240
237
  const agents = discoverAgents(teamId);
@@ -242,8 +239,9 @@ export function discoverPrimaryAgent(teamId) {
242
239
  if (primaries.length === 0)
243
240
  return null;
244
241
  if (primaries.length > 1) {
245
- // Cloud agents override built-in system agents (same precedence as
246
- // discovery): a cloud primary always wins over the built-in ghost.
242
+ // A cloud primary always wins over the built-in ghost. (Cloud
243
+ // primaries cannot use reserved system names — the backend blocks
244
+ // it — so this only fires for a genuine primary-selection override.)
247
245
  const cloudPrimary = primaries.find((a) => a.source === "cloud");
248
246
  const chosen = cloudPrimary ?? primaries[0];
249
247
  console.warn(chalk.yellow(`Multiple primary agents found (${primaries.map((a) => a.name).join(", ")}). Using "${chosen.name}".`));
@@ -287,19 +285,52 @@ export function agentsInSubtree(agents, activePrimary) {
287
285
  (activePrimary.id !== undefined &&
288
286
  (a.id === activePrimary.id || a.parentId === activePrimary.id)));
289
287
  }
288
+ /**
289
+ * The set of agents a session can actually reach:
290
+ *
291
+ * - Scoped (an `activePrimary` cloud primary): the primary's subtree plus
292
+ * the built-in system agents — a same-named cloud subagent in the
293
+ * subtree intentionally shadows the system agent, so system agents are
294
+ * only appended when their name is free in the subtree.
295
+ * - Team-wide (no active primary): system agents win over same-named
296
+ * cloud agents (dedupe keeps the system row, first).
297
+ */
298
+ export function reachableAgents(agents, activePrimary) {
299
+ if (!activePrimary) {
300
+ const systemAgents = agents.filter((a) => a.source === "system");
301
+ const systemNames = new Set(systemAgents.map((a) => a.name));
302
+ return [
303
+ ...systemAgents,
304
+ ...agents.filter((a) => a.source !== "system" && !systemNames.has(a.name)),
305
+ ];
306
+ }
307
+ const subtree = agentsInSubtree(agents, activePrimary);
308
+ const subtreeNames = new Set(subtree.map((a) => a.name));
309
+ return [
310
+ ...subtree,
311
+ ...agents.filter((a) => a.source === "system" && !subtreeNames.has(a.name)),
312
+ ];
313
+ }
290
314
  /**
291
315
  * Resolve an agent name to a single agent.
292
316
  *
293
- * - With an `activePrimary` ref (a cloud primary with a backend id):
317
+ * - Team-wide (no `activePrimary`, e.g. the built-in ghost session):
318
+ * SYSTEM agents always win over same-named cloud agents, so a cloud
319
+ * subagent named "executor" can no longer hijack the system executor.
320
+ * Only when no system agent has that name does resolution fall through
321
+ * to the cloud first-match (historical behavior for team-wide
322
+ * duplicates — not an error in fallback mode).
323
+ * - Scoped (an `activePrimary` cloud primary with a backend id):
294
324
  * candidates are scoped to the primary's subtree (the primary itself +
295
325
  * its direct children, plus any other agent sharing the primary's name),
296
326
  * so same-named subagents under different primaries resolve to the
297
- * caller's own subtree. A name that matches multiple agents within the
298
- * subtree (legacy data) is ambiguous — the caller must surface the
299
- * conflict, never silently pick one.
300
- * - Without one (standalone session / system primary): team-wide
301
- * first-match, exactly the historical behavior (duplicates across the
302
- * team are not an error in fallback mode).
327
+ * caller's own subtree. A same-named cloud subagent in the subtree
328
+ * intentionally shadows the system agent (that primary's own
329
+ * "executor"). If the name is NOT in the subtree, resolution falls back
330
+ * to SYSTEM agents (never to cloud agents of other trees). A name that
331
+ * matches multiple agents within the subtree (legacy data) is
332
+ * ambiguous — the caller must surface the conflict, never silently
333
+ * pick one.
303
334
  */
304
335
  export function resolveAgentByName(name, agents, activePrimary) {
305
336
  const scope = agentsInSubtree(agents, activePrimary);
@@ -307,13 +338,26 @@ export function resolveAgentByName(name, agents, activePrimary) {
307
338
  if (matches.length === 1)
308
339
  return { status: "ok", agent: matches[0] };
309
340
  if (matches.length > 1 && !activePrimary) {
310
- // Fallback mode: historical team-wide first-match. Duplicates across
311
- // the team are only an error inside a scoped subtree.
312
- return { status: "ok", agent: matches[0] };
341
+ // Team-wide: a system agent always beats same-named cloud agents;
342
+ // otherwise keep the historical first-match. Duplicates across the
343
+ // team are only an error inside a scoped subtree.
344
+ const systemMatch = matches.find((a) => a.source === "system");
345
+ return { status: "ok", agent: systemMatch ?? matches[0] };
313
346
  }
314
347
  if (matches.length > 1)
315
348
  return { status: "ambiguous", name, conflicting: matches };
316
- return { status: "not-found", name, candidates: scope };
349
+ if (!activePrimary)
350
+ return { status: "not-found", name, candidates: scope };
351
+ // Scoped: no match in the subtree — fall back to built-in system
352
+ // agents (never to cloud agents of other trees).
353
+ const systemMatch = agents.find((a) => a.source === "system" && a.name === name);
354
+ if (systemMatch)
355
+ return { status: "ok", agent: systemMatch };
356
+ const candidates = [
357
+ ...scope,
358
+ ...agents.filter((a) => a.source === "system"),
359
+ ];
360
+ return { status: "not-found", name, candidates };
317
361
  }
318
362
  /**
319
363
  * Prepend the primary agent's system prompt above the base system prompt.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;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;;;OAMG;IACH,wBAAwB,CAAC,EAAE,MAAM,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CAC3D,GACC,IAAI,CAwbN"}
@@ -37,7 +37,7 @@ import { RETRY_DEFAULT_BASE_DELAY_MS, RETRY_DEFAULT_MAX_RETRIES, RETRY_MAX_BACKO
37
37
  import { mutateSystemPrompt } from "../sdk/coding-agent/core/system-prompt-mutator.js";
38
38
  import { sleep } from "../sdk/coding-agent/utils/sleep.js";
39
39
  import { Type } from "typebox";
40
- import { discoverAgents, agentMetadataBlock, resolveAgentByName, agentsInSubtree, resolveSelectedPrimaryAgent, } from "./agents.js";
40
+ import { discoverAgents, agentMetadataBlock, resolveAgentByName, reachableAgents, resolveSelectedPrimaryAgent, } from "./agents.js";
41
41
  import { loadAgentSettings } from "../server/handlers/agent-settings.js";
42
42
  import { buildTpsUsageFields, computeTpsMetrics, } from "../server/agent-bridge/tps-metrics.js";
43
43
  import { randomUUID } from "node:crypto";
@@ -1048,9 +1048,12 @@ export default function subagentExtension(ext, opts) {
1048
1048
  const subtree = activePrimaryRef?.id
1049
1049
  ? activePrimaryRef
1050
1050
  : null;
1051
- // Agent listings in error messages are scoped to the same subtree
1052
- // so the model only sees what it can actually resolve.
1053
- const visibleAgents = agentsInSubtree(agents, subtree);
1051
+ // Agent listings in error messages reflect the reachable set —
1052
+ // subtree + system agents in scoped mode (a session under a
1053
+ // cloud primary can still delegate to built-in system agents),
1054
+ // system-first dedupe in team-wide mode — so the model only sees
1055
+ // what it can actually resolve.
1056
+ const visibleAgents = reachableAgents(agents, subtree);
1054
1057
  const hasChain = (params.chain?.length ?? 0) > 0;
1055
1058
  const hasTasks = (params.tasks?.length ?? 0) > 0;
1056
1059
  const hasSingle = Boolean(params.agent && params.task);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aexol/spectral",
3
- "version": "0.9.258",
3
+ "version": "0.9.259",
4
4
  "description": "AI coding agent for Aexol with relay-based browser access.",
5
5
  "type": "module",
6
6
  "private": false,