@standardagents/builder 0.25.6 → 0.25.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/dist/index.js CHANGED
@@ -7816,6 +7816,25 @@ This usually points to something I can't fix from here \u2014 for example the wo
7816
7816
  return null;
7817
7817
  }
7818
7818
  }
7819
+ /**
7820
+ * Registry entries the model may see (and therefore manage). Hidden
7821
+ * subagent relationships (`SubagentToolConfig.hidden` — infrastructure
7822
+ * children like background compaction) are excluded from the injected
7823
+ * "Active subagent instances" message: a listed instance reads as the
7824
+ * model's to clean up, and terminate_subagent on an infrastructure child
7825
+ * kills work the runtime depends on. Static and pure for direct testing.
7826
+ */
7827
+ static filterModelVisibleSubagents(registry, promptTools) {
7828
+ if (registry.length === 0) return registry;
7829
+ const hidden = /* @__PURE__ */ new Set();
7830
+ for (const config of promptTools ?? []) {
7831
+ if (typeof config === "object" && config !== null && "name" in config && config.hidden === true) {
7832
+ hidden.add(config.name);
7833
+ }
7834
+ }
7835
+ if (hidden.size === 0) return registry;
7836
+ return registry.filter((entry) => !hidden.has(entry.name));
7837
+ }
7819
7838
  static async getSubagentRegistry(state) {
7820
7839
  if (typeof state.thread.instance.getChildrenRegistry === "function") {
7821
7840
  try {
@@ -8074,7 +8093,10 @@ ${msg.content}` : `${imageDescriptions}${nonImageList}`;
8074
8093
  });
8075
8094
  }
8076
8095
  }
8077
- const subagentRegistry = await this.getSubagentRegistry(state);
8096
+ const subagentRegistry = _FlowEngine.filterModelVisibleSubagents(
8097
+ await this.getSubagentRegistry(state),
8098
+ state.prompt?._tools
8099
+ );
8078
8100
  if (subagentRegistry.length > 0) {
8079
8101
  const fallbackNameMap = await this.resolveRegistryThreadNameMap(state, subagentRegistry);
8080
8102
  const lines = subagentRegistry.map((entry) => {