@standardagents/builder 0.22.0 → 0.22.1

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
@@ -6066,9 +6066,10 @@ var init_context = __esm({
6066
6066
  // src/agents/FlowEngine.ts
6067
6067
  var FlowEngine_exports = {};
6068
6068
  __export(FlowEngine_exports, {
6069
- FlowEngine: () => FlowEngine
6069
+ FlowEngine: () => FlowEngine,
6070
+ HookBlockedExecutionError: () => HookBlockedExecutionError
6070
6071
  });
6071
- var IMMEDIATE_BOOTSTRAP_TOOL_NAME, FlowEngine;
6072
+ var IMMEDIATE_BOOTSTRAP_TOOL_NAME, HookBlockedExecutionError, FlowEngine;
6072
6073
  var init_FlowEngine = __esm({
6073
6074
  "src/agents/FlowEngine.ts"() {
6074
6075
  init_types();
@@ -6079,6 +6080,12 @@ var init_FlowEngine = __esm({
6079
6080
  init_sessionTools();
6080
6081
  init_ThreadStateImpl();
6081
6082
  IMMEDIATE_BOOTSTRAP_TOOL_NAME = "bootstrap_immediate_subagent";
6083
+ HookBlockedExecutionError = class extends Error {
6084
+ constructor(message) {
6085
+ super(message);
6086
+ this.name = "HookBlockedExecutionError";
6087
+ }
6088
+ };
6082
6089
  FlowEngine = class _FlowEngine {
6083
6090
  static IMMEDIATE_SCOPED_ENV_CONTEXT_KEY = "__immediate_scoped_env_by_call_id";
6084
6091
  /**
@@ -6626,7 +6633,26 @@ This usually points to something I can't fix from here \u2014 for example the wo
6626
6633
  state.messageHistory = await this.loadMessageHistory(state);
6627
6634
  const context = await this.assembleContext(state);
6628
6635
  state.allowedTools = context.tools;
6629
- context.messages = await this.runPrefilterLLMHistoryHook(state, context.messages);
6636
+ try {
6637
+ context.messages = await this.runPrefilterLLMHistoryHook(state, context.messages);
6638
+ } catch (error) {
6639
+ if (error instanceof HookBlockedExecutionError) {
6640
+ const threadState = ThreadStateImpl.fromFlowState(state);
6641
+ await threadState.injectMessage({ role: "assistant", content: error.message });
6642
+ state.stopped = true;
6643
+ state.stoppedBy = state.currentSide;
6644
+ state.stopReason = error.message;
6645
+ state.stopReasonCode = "hook_blocked";
6646
+ state.emitTelemetry?.({
6647
+ type: "stopped",
6648
+ reason: state.stopReason,
6649
+ side: state.currentSide,
6650
+ timestamp: Date.now()
6651
+ });
6652
+ return;
6653
+ }
6654
+ throw error;
6655
+ }
6630
6656
  const pendingMessageId = await this.createPendingMessage(state);
6631
6657
  state.pendingMessageId = pendingMessageId;
6632
6658
  let responseStatus = "completed";
@@ -8782,6 +8808,9 @@ ${lines.join("\n\n")}`
8782
8808
  try {
8783
8809
  result = await executor(threadState, result);
8784
8810
  } catch (error) {
8811
+ if (error && typeof error === "object" && error.block === true) {
8812
+ throw new HookBlockedExecutionError(error instanceof Error ? error.message : String(error));
8813
+ }
8785
8814
  console.error("[Hooks] \u2717 Error running prefilter_llm_history hook:", error);
8786
8815
  }
8787
8816
  }
@@ -20849,6 +20878,14 @@ function isPublicRoute(routePath, hosted) {
20849
20878
  return true;
20850
20879
  }
20851
20880
 
20881
+ // Device-code CLI login: start/poll are public by design (possession of the
20882
+ // one-time code is the secret) and the approve page must reach its controller
20883
+ // even when anonymous so it can redirect the browser through the platform
20884
+ // login (the controller enforces session auth itself).
20885
+ if (routePath === '/api/auth/device/start' || routePath.startsWith('/api/auth/device/')) {
20886
+ return true;
20887
+ }
20888
+
20852
20889
  // Provider icon routes are public (used by <img src>)
20853
20890
  if (routePath.startsWith('/api/providers/') && routePath.includes('/icon')) {
20854
20891
  return true;