llmist 12.3.0 → 12.3.2

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.cjs CHANGED
@@ -9085,6 +9085,33 @@ ${endPrefix}`
9085
9085
  }
9086
9086
  });
9087
9087
 
9088
+ // src/agent/hook-utils.ts
9089
+ function mergeObservers(child, parent) {
9090
+ if (!child && !parent) return void 0;
9091
+ if (!child) return parent;
9092
+ if (!parent) return child;
9093
+ const merged = { ...parent };
9094
+ for (const key of Object.keys(child)) {
9095
+ const childFn = child[key];
9096
+ const parentFn = parent[key];
9097
+ if (!childFn) continue;
9098
+ if (!parentFn) {
9099
+ merged[key] = childFn;
9100
+ } else {
9101
+ merged[key] = async (ctx) => {
9102
+ await childFn(ctx);
9103
+ await parentFn(ctx);
9104
+ };
9105
+ }
9106
+ }
9107
+ return merged;
9108
+ }
9109
+ var init_hook_utils = __esm({
9110
+ "src/agent/hook-utils.ts"() {
9111
+ "use strict";
9112
+ }
9113
+ });
9114
+
9088
9115
  // src/gadgets/schema-introspector.ts
9089
9116
  function getDef(schema) {
9090
9117
  return schema._def;
@@ -9948,6 +9975,7 @@ var init_executor = __esm({
9948
9975
  import_fast_deep_equal = __toESM(require("fast-deep-equal"), 1);
9949
9976
  import_zod2 = require("zod");
9950
9977
  init_builder();
9978
+ init_hook_utils();
9951
9979
  init_client();
9952
9980
  init_constants();
9953
9981
  init_execution_tree();
@@ -9960,7 +9988,7 @@ var init_executor = __esm({
9960
9988
  init_parser();
9961
9989
  init_typed_gadget();
9962
9990
  GadgetExecutor = class {
9963
- constructor(registry, requestHumanInput, logger, defaultGadgetTimeoutMs, errorFormatterOptions, client, mediaStore, agentConfig, subagentConfig, tree, parentNodeId, baseDepth, parentObservers) {
9991
+ constructor(registry, requestHumanInput, logger, defaultGadgetTimeoutMs, errorFormatterOptions, client, mediaStore, agentConfig, subagentConfig, tree, parentNodeId, baseDepth, parentObservers, currentObservers) {
9964
9992
  this.registry = registry;
9965
9993
  this.requestHumanInput = requestHumanInput;
9966
9994
  this.defaultGadgetTimeoutMs = defaultGadgetTimeoutMs;
@@ -9972,6 +10000,7 @@ var init_executor = __esm({
9972
10000
  this.parentNodeId = parentNodeId;
9973
10001
  this.baseDepth = baseDepth;
9974
10002
  this.parentObservers = parentObservers;
10003
+ this.currentObservers = currentObservers;
9975
10004
  this.logger = logger ?? createLogger({ name: "llmist:executor" });
9976
10005
  this.errorFormatter = new GadgetExecutionErrorFormatter(errorFormatterOptions);
9977
10006
  this.argPrefix = errorFormatterOptions?.argPrefix ?? GADGET_ARG_PREFIX;
@@ -10141,7 +10170,8 @@ var init_executor = __esm({
10141
10170
  // Parent observer hooks for subagent visibility
10142
10171
  // When a subagent uses withParentContext(ctx), it will receive these
10143
10172
  // and call them for gadget events in addition to its own hooks
10144
- parentObservers: this.parentObservers
10173
+ // Merge child and parent observers so both get called (child first, then parent)
10174
+ parentObservers: mergeObservers(this.currentObservers, this.parentObservers)
10145
10175
  };
10146
10176
  let rawResult;
10147
10177
  if (timeoutMs && timeoutMs > 0) {
@@ -10528,7 +10558,9 @@ var init_stream_processor = __esm({
10528
10558
  options.parentNodeId,
10529
10559
  options.baseDepth,
10530
10560
  // Parent observer hooks for subagent visibility
10531
- options.parentObservers
10561
+ options.parentObservers,
10562
+ // Current agent's observers for subagent inheritance
10563
+ options.hooks?.observers
10532
10564
  );
10533
10565
  }
10534
10566
  /**