@standardagents/builder 0.37.6 → 0.37.8

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 +121 -6
  2. package/dist/built-in-routes.js.map +1 -1
  3. package/dist/client/{ApiKeysView-Pk5oljVU.js → ApiKeysView-L85eJb6G.js} +1 -1
  4. package/dist/client/{CenteredContentView-HGpMGAQj.js → CenteredContentView-D9jkWoLc.js} +1 -1
  5. package/dist/client/{CompositionView-DN8dTOCO.js → CompositionView-BGp0EJCk.js} +1 -1
  6. package/dist/client/{ConfirmDialog.vue_vue_type_script_setup_true_lang--j_hnMZ0.js → ConfirmDialog.vue_vue_type_script_setup_true_lang-DgwqZrLV.js} +1 -1
  7. package/dist/client/{CopyButton.vue_vue_type_script_setup_true_lang-CpJDcbZx.js → CopyButton.vue_vue_type_script_setup_true_lang-B8cGgU2J.js} +1 -1
  8. package/dist/client/{DataTable.vue_vue_type_script_setup_true_lang-unLrY-PY.js → DataTable.vue_vue_type_script_setup_true_lang-CRBXym9D.js} +1 -1
  9. package/dist/client/{JsonViewer-BYj_yrGB.js → JsonViewer-DkHnIfq3.js} +1 -1
  10. package/dist/client/{LoginView-CfVqItZV.js → LoginView-BXD9Odc-.js} +1 -1
  11. package/dist/client/{MarketplaceView-Cidt0nLf.js → MarketplaceView-DEnujUBs.js} +1 -1
  12. package/dist/client/{Modal.vue_vue_type_script_setup_true_lang-C1dmm1HX.js → Modal.vue_vue_type_script_setup_true_lang-keKEwm3K.js} +1 -1
  13. package/dist/client/{ModelModal.vue_vue_type_script_setup_true_lang-DIKLuPXT.js → ModelModal.vue_vue_type_script_setup_true_lang-t1n0bbJe.js} +1 -1
  14. package/dist/client/{ModelsView-DH6wNe38.js → ModelsView-BkCLr8sp.js} +1 -1
  15. package/dist/client/{PromptEditView-D_VjoAa-.js → PromptEditView-BjCfsJQE.js} +1 -1
  16. package/dist/client/{PromptModal-a9LTOWNt.js → PromptModal-nxu_LIv6.js} +1 -1
  17. package/dist/client/{PromptsView-BCCCryKR.js → PromptsView-1yXGCmEZ.js} +1 -1
  18. package/dist/client/{ProvidersView-CF4x5F6G.js → ProvidersView-DxF6gafk.js} +1 -1
  19. package/dist/client/{ThreadInspectorPane.vue_vue_type_script_setup_true_lang-D5VDoQiK.js → ThreadInspectorPane.vue_vue_type_script_setup_true_lang-CjwWJ3uw.js} +14 -14
  20. package/dist/client/{ThreadsView-BzscU1l2.js → ThreadsView-CBup_w8u.js} +1 -1
  21. package/dist/client/{ToolsView-CeEtxDZV.js → ToolsView-B30TfXU9.js} +1 -1
  22. package/dist/client/{UsersView-Di5cmUYL.js → UsersView-kE7Xr4f3.js} +1 -1
  23. package/dist/client/{VariablesView-CXUr05jD.js → VariablesView-yYuynG0M.js} +1 -1
  24. package/dist/client/assets/{ThreadInspectorPane-D9ZMzSTn.css → ThreadInspectorPane-BRGO_P0_.css} +1 -1
  25. package/dist/client/{index-BMqXblce.js → index-AUGwDdSH.js} +2 -2
  26. package/dist/client/index.html +1 -1
  27. package/dist/index.js +56 -5
  28. package/dist/index.js.map +1 -1
  29. package/dist/plugin.js.map +1 -1
  30. package/dist/runtime.d.ts +0 -1
  31. package/dist/runtime.js +56 -5
  32. package/dist/runtime.js.map +1 -1
  33. package/package.json +5 -5
package/dist/runtime.d.ts CHANGED
@@ -116,7 +116,6 @@ declare function canAccessThread(auth: AuthContext, thread: {
116
116
  user_id: string | null;
117
117
  }): boolean;
118
118
 
119
- /** Central API exposure policy shared by the generated Worker router and tests. */
120
119
  declare function isHostedInstance(env: Record<string, unknown> | undefined): boolean;
121
120
  /**
122
121
  * Local-only conveniences are enabled by the request destination, not merely
package/dist/runtime.js CHANGED
@@ -9551,7 +9551,12 @@ ${msg.content}` : `${imageDescriptions}${nonImageList}`;
9551
9551
  const threadState = ThreadStateImpl.fromFlowState(state);
9552
9552
  for (const executor of executors) {
9553
9553
  try {
9554
- result = await executor(threadState, result);
9554
+ const hooked = await executor(threadState, _FlowEngine.rowToHookMessage(result));
9555
+ result = {
9556
+ ...result,
9557
+ ...hooked,
9558
+ attachments: hooked.attachments === void 0 ? result.attachments : hooked.attachments === null ? null : typeof hooked.attachments === "string" ? hooked.attachments : JSON.stringify(hooked.attachments)
9559
+ };
9555
9560
  } catch (error) {
9556
9561
  console.error("[Hooks] \u2717 Error running before_create_message hook:", error);
9557
9562
  }
@@ -9571,12 +9576,31 @@ ${msg.content}` : `${imageDescriptions}${nonImageList}`;
9571
9576
  const threadState = ThreadStateImpl.fromFlowState(state);
9572
9577
  for (const executor of executors) {
9573
9578
  try {
9574
- await executor(threadState, message);
9579
+ await executor(threadState, _FlowEngine.rowToHookMessage(message));
9575
9580
  } catch (error) {
9576
9581
  console.error("[Hooks] \u2717 Error running after_create_message hook:", error);
9577
9582
  }
9578
9583
  }
9579
9584
  }
9585
+ /**
9586
+ * Builder rows store `attachments` as a JSON string; the spec hook surface
9587
+ * carries parsed AttachmentRef[]. Convert at every hook boundary so hooks
9588
+ * see the spec shape and cannot corrupt the stored row shape.
9589
+ */
9590
+ static rowToHookMessage(row) {
9591
+ const { attachments, ...rest } = row;
9592
+ let parsed = void 0;
9593
+ if (attachments === null) parsed = null;
9594
+ else if (typeof attachments === "string" && attachments) {
9595
+ try {
9596
+ const p = JSON.parse(attachments);
9597
+ parsed = Array.isArray(p) ? p : void 0;
9598
+ } catch {
9599
+ parsed = void 0;
9600
+ }
9601
+ }
9602
+ return { ...rest, attachments: parsed };
9603
+ }
9580
9604
  /**
9581
9605
  * Run the before_update_message hook if it exists
9582
9606
  * This hook allows developers to modify a message before it's updated
@@ -9615,7 +9639,7 @@ ${msg.content}` : `${imageDescriptions}${nonImageList}`;
9615
9639
  const threadState = ThreadStateImpl.fromFlowState(state);
9616
9640
  for (const executor of executors) {
9617
9641
  try {
9618
- await executor(threadState, message);
9642
+ await executor(threadState, _FlowEngine.rowToHookMessage(message));
9619
9643
  } catch (error) {
9620
9644
  console.error("[Hooks] \u2717 Error running after_update_message hook:", error);
9621
9645
  }
@@ -10704,7 +10728,11 @@ ${msg.content}` : `${imageDescriptions}${nonImageList}`;
10704
10728
  const threadState = ThreadStateImpl.fromFlowState(state);
10705
10729
  for (const executor of executors) {
10706
10730
  try {
10707
- result = await executor(threadState, result);
10731
+ const byId = /* @__PURE__ */ new Map();
10732
+ for (const row of result) if (row.id) byId.set(row.id, row);
10733
+ const hookView = result.map((row) => _FlowEngine.rowToHookMessage(row));
10734
+ const kept = await executor(threadState, hookView);
10735
+ result = kept.map((m) => m.id && byId.get(m.id) || null).filter((row) => row !== null);
10708
10736
  } catch (error) {
10709
10737
  console.error("[Hooks] \u2717 Error running filter_messages hook:", error);
10710
10738
  }
@@ -14291,9 +14319,25 @@ var init_ThreadStateImpl = __esm({
14291
14319
  parent_id: msg.parent_id,
14292
14320
  depth: msg.depth,
14293
14321
  silent: msg.silent,
14294
- metadata: msg.metadata
14322
+ metadata: msg.metadata,
14323
+ status: msg.status,
14324
+ tool_status: msg.tool_status,
14325
+ attachments: this._parseAttachmentRefs(msg.attachments)
14295
14326
  };
14296
14327
  };
14328
+ /** Builder rows store attachments as a JSON string of AttachmentRef[];
14329
+ * spec messages carry the parsed refs. Dropping them here is what made
14330
+ * generated assets invisible to every session_state consumer. */
14331
+ _parseAttachmentRefs = (raw) => {
14332
+ if (!raw) return void 0;
14333
+ if (Array.isArray(raw)) return raw;
14334
+ try {
14335
+ const parsed = JSON.parse(raw);
14336
+ return Array.isArray(parsed) ? parsed : void 0;
14337
+ } catch {
14338
+ return void 0;
14339
+ }
14340
+ };
14297
14341
  _mapFileRecord = (record) => {
14298
14342
  return {
14299
14343
  path: record.path,
@@ -14963,6 +15007,10 @@ var PUBLIC_ROUTES = /* @__PURE__ */ new Set([
14963
15007
  function isProviderIconRoute(routePath) {
14964
15008
  return /^\/api\/providers\/[^/]+\/icon$/.test(routePath);
14965
15009
  }
15010
+ function isPublicThreadFileRoute(routePath, method) {
15011
+ if (method !== "GET" && method !== "HEAD") return false;
15012
+ return /^\/api\/threads\/[^/]+\/public\/.+/.test(routePath);
15013
+ }
14966
15014
  function isHostedInstance(env) {
14967
15015
  const value = env?.STANDARD_AGENTS_HOSTED;
14968
15016
  if (typeof value === "string") {
@@ -14989,6 +15037,9 @@ function isPublicApiRoute(routePath, request, env) {
14989
15037
  if (isProviderIconRoute(routePath)) {
14990
15038
  return true;
14991
15039
  }
15040
+ if (isPublicThreadFileRoute(routePath, request.method.toUpperCase())) {
15041
+ return true;
15042
+ }
14992
15043
  if (!isTrustedLocalDevelopmentRequest(request, env)) return false;
14993
15044
  return routePath === "/api/threads" || routePath.startsWith("/api/threads/") || routePath === "/api/platform" || routePath.startsWith("/api/platform/") || routePath === "/api/platform-session" || routePath.startsWith("/api/platform-session/") || routePath === "/api/platform-auth" || routePath.startsWith("/api/platform-auth/");
14994
15045
  }