@standardagents/builder 0.25.5 → 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.
@@ -2397,8 +2397,11 @@ var init_LLMRequest = __esm({
2397
2397
  */
2398
2398
  static async logError(state, error, errorType, modelId, startTime, existingLogId) {
2399
2399
  try {
2400
- const rawErrorMessage = error instanceof Error ? error.message : String(error);
2400
+ let rawErrorMessage = error instanceof Error ? error.message : String(error);
2401
2401
  const errorStack = error instanceof Error ? error.stack : void 0;
2402
+ if (error instanceof Error && error.name === "AbortError" && /operation was aborted/i.test(rawErrorMessage)) {
2403
+ rawErrorMessage = state.abortController?.signal?.aborted ? "Aborted: the execution this request belonged to was cancelled (user stop, watchdog takeover, or a restart) \u2014 retries and fallbacks of a cancelled execution fail immediately." : "Aborted: the request's connection was cancelled mid-flight (provider disconnect or executor restart).";
2404
+ }
2402
2405
  let errorMessage = rawErrorMessage;
2403
2406
  let parsedProviderBody = null;
2404
2407
  const trimmedRaw = rawErrorMessage.trim();
@@ -7723,6 +7726,25 @@ This usually points to something I can't fix from here \u2014 for example the wo
7723
7726
  return null;
7724
7727
  }
7725
7728
  }
7729
+ /**
7730
+ * Registry entries the model may see (and therefore manage). Hidden
7731
+ * subagent relationships (`SubagentToolConfig.hidden` — infrastructure
7732
+ * children like background compaction) are excluded from the injected
7733
+ * "Active subagent instances" message: a listed instance reads as the
7734
+ * model's to clean up, and terminate_subagent on an infrastructure child
7735
+ * kills work the runtime depends on. Static and pure for direct testing.
7736
+ */
7737
+ static filterModelVisibleSubagents(registry, promptTools) {
7738
+ if (registry.length === 0) return registry;
7739
+ const hidden = /* @__PURE__ */ new Set();
7740
+ for (const config of promptTools ?? []) {
7741
+ if (typeof config === "object" && config !== null && "name" in config && config.hidden === true) {
7742
+ hidden.add(config.name);
7743
+ }
7744
+ }
7745
+ if (hidden.size === 0) return registry;
7746
+ return registry.filter((entry) => !hidden.has(entry.name));
7747
+ }
7726
7748
  static async getSubagentRegistry(state) {
7727
7749
  if (typeof state.thread.instance.getChildrenRegistry === "function") {
7728
7750
  try {
@@ -7981,7 +8003,10 @@ ${msg.content}` : `${imageDescriptions}${nonImageList}`;
7981
8003
  });
7982
8004
  }
7983
8005
  }
7984
- const subagentRegistry = await this.getSubagentRegistry(state);
8006
+ const subagentRegistry = _FlowEngine.filterModelVisibleSubagents(
8007
+ await this.getSubagentRegistry(state),
8008
+ state.prompt?._tools
8009
+ );
7985
8010
  if (subagentRegistry.length > 0) {
7986
8011
  const fallbackNameMap = await this.resolveRegistryThreadNameMap(state, subagentRegistry);
7987
8012
  const lines = subagentRegistry.map((entry) => {