@standardagents/builder 0.41.21 → 0.41.22

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.
Files changed (33) hide show
  1. package/dist/built-in-routes.js +56 -17
  2. package/dist/built-in-routes.js.map +1 -1
  3. package/dist/client/{ApiKeysView-DJ5e-6IS.js → ApiKeysView-D4g6ZNWG.js} +1 -1
  4. package/dist/client/{CenteredContentView-DH6ikaTT.js → CenteredContentView-B3WUhJPU.js} +1 -1
  5. package/dist/client/{CompositionView-C9pK57FR.js → CompositionView-pL0H07yI.js} +1 -1
  6. package/dist/client/{ConfirmDialog.vue_vue_type_script_setup_true_lang-9-6_KYkD.js → ConfirmDialog.vue_vue_type_script_setup_true_lang-uehuZFVv.js} +1 -1
  7. package/dist/client/{CopyButton.vue_vue_type_script_setup_true_lang-C5uwr2FJ.js → CopyButton.vue_vue_type_script_setup_true_lang-vwNMv4kh.js} +1 -1
  8. package/dist/client/{DataTable.vue_vue_type_script_setup_true_lang-n5tnXZVz.js → DataTable.vue_vue_type_script_setup_true_lang-lgIAQ4Oz.js} +1 -1
  9. package/dist/client/{JsonViewer-CsxlDLYj.js → JsonViewer-BsC-w_01.js} +1 -1
  10. package/dist/client/LoginView-DriOurmS.js +1 -0
  11. package/dist/client/{MarketplaceView-CEusJBzY.js → MarketplaceView-7pl01VFg.js} +1 -1
  12. package/dist/client/{Modal.vue_vue_type_script_setup_true_lang-B_YbDdpO.js → Modal.vue_vue_type_script_setup_true_lang-CQE6ME9a.js} +1 -1
  13. package/dist/client/{ModelModal.vue_vue_type_script_setup_true_lang-DXwJcbrW.js → ModelModal.vue_vue_type_script_setup_true_lang-Dv-GVzNy.js} +1 -1
  14. package/dist/client/{ModelsView-Cs7N2v6t.js → ModelsView-BDxyu8pj.js} +1 -1
  15. package/dist/client/{PromptEditView-B82KeSCI.js → PromptEditView-Brn_lMum.js} +1 -1
  16. package/dist/client/{PromptModal-B_QwV83W.js → PromptModal-BeqgBmpj.js} +1 -1
  17. package/dist/client/{PromptsView-B3iCVeqG.js → PromptsView-Dgu1UMES.js} +1 -1
  18. package/dist/client/{ProvidersView-BUr74f5F.js → ProvidersView-B3SPkaxt.js} +1 -1
  19. package/dist/client/{ThreadInspectorPane.vue_vue_type_script_setup_true_lang-Bk0yDRsY.js → ThreadInspectorPane.vue_vue_type_script_setup_true_lang-DaArzwIz.js} +1 -1
  20. package/dist/client/{ThreadsView-DvRb3bRz.js → ThreadsView-D0hT0NXg.js} +1 -1
  21. package/dist/client/{ToolsView-DtoMgKuf.js → ToolsView-BitH87Mf.js} +1 -1
  22. package/dist/client/{UsersView-CnBhWD5G.js → UsersView-BArKqDfJ.js} +1 -1
  23. package/dist/client/{VariablesView-D2Zj2_RJ.js → VariablesView-BJtT_XLQ.js} +1 -1
  24. package/dist/client/assets/index-Bu6PNXui.css +1 -0
  25. package/dist/client/{index-DH0i006N.js → index-CAiyJVjz.js} +2 -2
  26. package/dist/client/index.html +2 -2
  27. package/dist/index.js +55 -16
  28. package/dist/index.js.map +1 -1
  29. package/dist/runtime.js +55 -16
  30. package/dist/runtime.js.map +1 -1
  31. package/package.json +5 -5
  32. package/dist/client/LoginView-BOFP143E.js +0 -1
  33. package/dist/client/assets/index-yfhU3str.css +0 -1
@@ -5182,7 +5182,7 @@ Message one with subagent_message(referenceId, message).`
5182
5182
  parent: childThread.parent ?? state.threadId,
5183
5183
  terminated: childThread.terminated ?? null,
5184
5184
  created_at: childThread.created_at ?? Math.floor(Date.now() / 1e3)
5185
- });
5185
+ }, { env: state.env });
5186
5186
  await FlowEngine2.runAfterSubagentCreatedHook(state, childState);
5187
5187
  } catch (error) {
5188
5188
  console.error("[Hooks] \u2717 Error running after_subagent_created hook:", error);
@@ -24821,8 +24821,8 @@ var init_ThreadStateImpl = __esm({
24821
24821
  if (!child || child.parent !== this.threadId) {
24822
24822
  return null;
24823
24823
  }
24824
- const durableId = this._threadInstance.env.AGENT_BUILDER_THREAD.idFromName(referenceId);
24825
- const childStub = this._threadInstance.env.AGENT_BUILDER_THREAD.get(durableId);
24824
+ const threads = this._getThreadNamespace();
24825
+ const childStub = threads.get(threads.idFromName(referenceId));
24826
24826
  return _ThreadStateImpl.fromThreadInstance(childStub, {
24827
24827
  id: child.id,
24828
24828
  agent_id: child.agent_name,
@@ -24834,7 +24834,7 @@ var init_ThreadStateImpl = __esm({
24834
24834
  parent: child.parent ?? null,
24835
24835
  terminated: child.terminated ?? null,
24836
24836
  created_at: child.created_at
24837
- });
24837
+ }, this._relatedRuntimeContext());
24838
24838
  }
24839
24839
  async getParentThread() {
24840
24840
  const agentBuilder = this._getAgentBuilderStub();
@@ -24847,8 +24847,8 @@ var init_ThreadStateImpl = __esm({
24847
24847
  if (!parent) {
24848
24848
  return null;
24849
24849
  }
24850
- const durableId = this._threadInstance.env.AGENT_BUILDER_THREAD.idFromName(parentId);
24851
- const parentStub = this._threadInstance.env.AGENT_BUILDER_THREAD.get(durableId);
24850
+ const threads = this._getThreadNamespace();
24851
+ const parentStub = threads.get(threads.idFromName(parentId));
24852
24852
  return _ThreadStateImpl.fromThreadInstance(parentStub, {
24853
24853
  id: parent.id,
24854
24854
  agent_id: parent.agent_name,
@@ -24860,7 +24860,7 @@ var init_ThreadStateImpl = __esm({
24860
24860
  parent: parent.parent ?? null,
24861
24861
  terminated: parent.terminated ?? null,
24862
24862
  created_at: parent.created_at
24863
- });
24863
+ }, this._relatedRuntimeContext());
24864
24864
  }
24865
24865
  // ─────────────────────────────────────────────────────────────────────────
24866
24866
  // Tool Invocation
@@ -25121,14 +25121,14 @@ var init_ThreadStateImpl = __esm({
25121
25121
  canPark && toolCallId ? { toolCallId, side } : void 0
25122
25122
  );
25123
25123
  if (local.ok || !this.isNoClient(local)) return local;
25124
- const env2 = this._threadInstance.env;
25125
- if (env2?.AGENT_BUILDER_THREAD) {
25124
+ const threads = this._optionalThreadNamespace();
25125
+ if (threads) {
25126
25126
  const seen = /* @__PURE__ */ new Set([this._metadata.id]);
25127
25127
  let parentId = await this.resolveParentThreadId(this._metadata.id);
25128
25128
  while (parentId && !seen.has(parentId)) {
25129
25129
  seen.add(parentId);
25130
25130
  try {
25131
- const stub = env2.AGENT_BUILDER_THREAD.get(env2.AGENT_BUILDER_THREAD.idFromName(parentId));
25131
+ const stub = threads.get(threads.idFromName(parentId));
25132
25132
  const res = await stub.callClientTool(request);
25133
25133
  if (res.ok || !this.isNoClient(res)) return res;
25134
25134
  } catch {
@@ -25276,8 +25276,8 @@ var init_ThreadStateImpl = __esm({
25276
25276
  if (threadId === this._metadata.id && this._metadata.parent) {
25277
25277
  return this._metadata.parent;
25278
25278
  }
25279
- const env2 = this._threadInstance.env;
25280
- if (!env2?.AGENT_BUILDER) return null;
25279
+ const env2 = this._optionalRuntimeEnv();
25280
+ if (!env2) return null;
25281
25281
  for (let attempt = 0; attempt < 3; attempt++) {
25282
25282
  try {
25283
25283
  const agentBuilder = env2.AGENT_BUILDER.get(env2.AGENT_BUILDER.idFromName("singleton"));
@@ -25685,8 +25685,8 @@ var init_ThreadStateImpl = __esm({
25685
25685
  return null;
25686
25686
  }
25687
25687
  try {
25688
- const threadNamespace = this._threadInstance.env.AGENT_BUILDER_THREAD;
25689
- if (!threadNamespace || typeof threadNamespace.idFromName !== "function" || typeof threadNamespace.get !== "function") {
25688
+ const threadNamespace = this._optionalThreadNamespace();
25689
+ if (!threadNamespace) {
25690
25690
  return null;
25691
25691
  }
25692
25692
  const durableId = threadNamespace.idFromName(parentThreadId);
@@ -25698,8 +25698,8 @@ var init_ThreadStateImpl = __esm({
25698
25698
  }
25699
25699
  async _getParentThreadStub() {
25700
25700
  const parentThreadId = await this._getParentThreadId();
25701
- const durableId = this._threadInstance.env.AGENT_BUILDER_THREAD.idFromName(parentThreadId);
25702
- const parentStub = this._threadInstance.env.AGENT_BUILDER_THREAD.get(durableId);
25701
+ const threads = this._getThreadNamespace();
25702
+ const parentStub = threads.get(threads.idFromName(parentThreadId));
25703
25703
  return { parentThreadId, parentStub };
25704
25704
  }
25705
25705
  _getAgentBuilderStub() {
@@ -25725,6 +25725,45 @@ var init_ThreadStateImpl = __esm({
25725
25725
  }
25726
25726
  return instanceEnv;
25727
25727
  }
25728
+ /** `_getRuntimeEnv`, or null where this state has no usable environment. */
25729
+ _optionalRuntimeEnv() {
25730
+ if (isThreadStateRuntimeEnvironment(this._runtimeContext.env)) {
25731
+ return this._runtimeContext.env;
25732
+ }
25733
+ const instanceEnv = this._threadInstance.env;
25734
+ return isThreadStateRuntimeEnvironment(instanceEnv) ? instanceEnv : null;
25735
+ }
25736
+ /**
25737
+ * The thread Durable Object namespace, from the runtime env (the recorded
25738
+ * context env first). Never `this._threadInstance.env` directly: on a
25739
+ * stub-backed state that is a pipelined RpcPromise proxy.
25740
+ */
25741
+ _getThreadNamespace() {
25742
+ const namespace = this._optionalThreadNamespace();
25743
+ if (!namespace) {
25744
+ this._getRuntimeEnv();
25745
+ throw new Error("Thread namespace unavailable: AGENT_BUILDER_THREAD binding is missing.");
25746
+ }
25747
+ return namespace;
25748
+ }
25749
+ _optionalThreadNamespace() {
25750
+ const env2 = this._optionalRuntimeEnv();
25751
+ const namespace = env2?.AGENT_BUILDER_THREAD;
25752
+ return isRuntimeDurableNamespace(namespace) ? namespace : null;
25753
+ }
25754
+ /**
25755
+ * The runtime context for a ThreadState this state hands out for another
25756
+ * thread (its parent, a child). That state is stub-backed, so it carries
25757
+ * this state's environment, and the user-scope reentrancy guard, with it:
25758
+ * without them every env-dependent surface on the handle (`user()`,
25759
+ * `env()`, user values, its own parent/child lookups) throws.
25760
+ */
25761
+ _relatedRuntimeContext() {
25762
+ return {
25763
+ env: this._getRuntimeEnv(),
25764
+ ...this._runtimeContext.inUserScope === true ? { inUserScope: true } : {}
25765
+ };
25766
+ }
25728
25767
  /** The per-user hub stub for this thread's user (user-scope surfaces). */
25729
25768
  _getUserHubStub(userId) {
25730
25769
  const env2 = this._getRuntimeEnv();
@@ -80158,7 +80197,7 @@ var config_get_default = defineController2(async ({ config, env: env2, req }) =>
80158
80197
  });
80159
80198
 
80160
80199
  // src/version.ts
80161
- var BUILDER_VERSION = "0.41.21".length > 0 ? "0.41.21" : "dev";
80200
+ var BUILDER_VERSION = "0.41.22".length > 0 ? "0.41.22" : "dev";
80162
80201
 
80163
80202
  // src/api/diagnostics.get.ts
80164
80203
  init_LLMRequest();