@standardagents/builder 0.11.9 → 0.11.11

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.
@@ -2694,7 +2694,9 @@ var init_ToolExecutor = __esm({
2694
2694
  agentConfig: promptAgent,
2695
2695
  storage: state.storage,
2696
2696
  env: state.env,
2697
- threadId: `${state.threadId}-prompt-${call.id}`,
2697
+ // Use root thread ID - sub-prompts share the parent's thread
2698
+ // Messages are namespaced by depth and prompt, not by threadId
2699
+ threadId: state.rootState?.threadId || state.threadId,
2698
2700
  thread: state.thread,
2699
2701
  // Pass through parent thread instance and metadata
2700
2702
  context: {
@@ -4791,6 +4793,7 @@ var init_FlowEngine = __esm({
4791
4793
  messageHistory: [],
4792
4794
  sequence: stateInput.sequence || {
4793
4795
  queue: [],
4796
+ queuedTools: [],
4794
4797
  isHandling: false
4795
4798
  },
4796
4799
  active: stateInput.active || {
@@ -4924,6 +4927,22 @@ var init_FlowEngine = __esm({
4924
4927
  if (toolsToExecute && toolsToExecute.length > 0 || state.sequence.queue.length > 0) {
4925
4928
  await ToolExecutor.executeSequence(state, toolsToExecute || []);
4926
4929
  }
4930
+ if (state.sequence.queuedTools.length > 0 && state.currentLogId) {
4931
+ const queuedToolsJson = JSON.stringify(state.sequence.queuedTools);
4932
+ await state.storage.sql.exec(
4933
+ `UPDATE logs SET queued_tools = ?1 WHERE id = ?2`,
4934
+ queuedToolsJson,
4935
+ state.currentLogId
4936
+ );
4937
+ if (state.emitLog) {
4938
+ state.emitLog({
4939
+ type: "log_queued_tools",
4940
+ log_id: state.currentLogId,
4941
+ queued_tools: queuedToolsJson
4942
+ });
4943
+ }
4944
+ state.sequence.queuedTools = [];
4945
+ }
4927
4946
  if (await state.thread.instance.shouldStop() || state.abortController?.signal.aborted) {
4928
4947
  throw new Error("aborted");
4929
4948
  }
@@ -6763,9 +6782,12 @@ function queueTool(flow, toolName, args = {}) {
6763
6782
  name: toolName,
6764
6783
  arguments: JSON.stringify(args)
6765
6784
  },
6766
- forceAllow: true
6785
+ forceAllow: true,
6786
+ queued_at: Date.now() * 1e3
6787
+ // Microseconds to match other timestamps
6767
6788
  };
6768
6789
  flow.sequence.queue.push(toolCall);
6790
+ flow.sequence.queuedTools.push(toolCall);
6769
6791
  }
6770
6792
  async function injectMessage(flow, options) {
6771
6793
  const messageId = options.id ?? crypto.randomUUID();