@tangle-network/agent-app 3.0.6 → 3.0.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.
@@ -82,13 +82,13 @@ import {
82
82
  turnCarriesFiles,
83
83
  turnPromptText,
84
84
  withProducerStream
85
- } from "../chunk-VGGSCEI6.js";
85
+ } from "../chunk-LKDPKY7R.js";
86
86
  import "../chunk-SBHFMDR7.js";
87
87
  import "../chunk-H6BRJU5M.js";
88
88
  import "../chunk-4DBHC63F.js";
89
89
  import "../chunk-RN4WPTBH.js";
90
90
  import "../chunk-MM6RLOXF.js";
91
- import "../chunk-FDPQ67MN.js";
91
+ import "../chunk-T6ZDWHP5.js";
92
92
  import "../chunk-F4TUZYMX.js";
93
93
  import {
94
94
  redactErrorMessage
@@ -28,7 +28,7 @@ import {
28
28
  sandboxRunFailureDetail,
29
29
  streamSandboxPrompt,
30
30
  turnStorageBindings
31
- } from "./chunk-FDPQ67MN.js";
31
+ } from "./chunk-T6ZDWHP5.js";
32
32
  import {
33
33
  redactErrorMessage
34
34
  } from "./chunk-MH74DY2I.js";
@@ -4154,4 +4154,4 @@ export {
4154
4154
  createChatTurnRoutes,
4155
4155
  streamChatRouteAsSandboxEvents
4156
4156
  };
4157
- //# sourceMappingURL=chunk-VGGSCEI6.js.map
4157
+ //# sourceMappingURL=chunk-LKDPKY7R.js.map
@@ -2012,12 +2012,13 @@ var RECENT_LIMIT = 1e3;
2012
2012
  var REASONS = ["page-open", "composer-focus", "heartbeat"];
2013
2013
  var THREAD_ID = /^[A-Za-z0-9_:.-]{1,128}$/;
2014
2014
  async function requestIntent(request) {
2015
- if (Number(request.headers.get("content-length") ?? 0) > 1024) return { reason: "page-open" };
2015
+ if (Number(request.headers.get("content-length") ?? 0) > 1024) return void 0;
2016
2016
  try {
2017
2017
  const body = await request.clone().json();
2018
2018
  const reason = REASONS.find((known) => known === body?.reason) ?? "page-open";
2019
- const threadId = typeof body?.threadId === "string" && THREAD_ID.test(body.threadId) ? body.threadId : void 0;
2020
- return { reason, ...threadId ? { threadId } : {} };
2019
+ const threadId = body?.threadId;
2020
+ if (threadId !== void 0 && (typeof threadId !== "string" || !THREAD_ID.test(threadId))) return void 0;
2021
+ return { reason, ...typeof threadId === "string" ? { threadId } : {} };
2021
2022
  } catch {
2022
2023
  return { reason: "page-open" };
2023
2024
  }
@@ -2132,9 +2133,11 @@ function createWorkspacePrewarmRoute(options) {
2132
2133
  return new Response(null, { status: 405, headers: { Allow: "POST" } });
2133
2134
  }
2134
2135
  if (isAutomatedPrewarmRequest(request)) return reply({ outcome: "automated", ms: 0 });
2136
+ const intent = await requestIntent(request);
2137
+ if (!intent) return reply({ outcome: "declined", ms: now() - started, reason: "invalid_thread" });
2135
2138
  let auth;
2136
2139
  try {
2137
- auth = await options.authorize({ request, context, ...await requestIntent(request) });
2140
+ auth = await options.authorize({ request, context, ...intent });
2138
2141
  } catch (err) {
2139
2142
  emit({ type: "failed", key: "", ms: now() - started, error: err instanceof Error ? err.message : String(err) });
2140
2143
  return reply({ outcome: "failed", ms: now() - started });
@@ -4329,4 +4332,4 @@ export {
4329
4332
  deleteSecret,
4330
4333
  mintSandboxScopedToken
4331
4334
  };
4332
- //# sourceMappingURL=chunk-FDPQ67MN.js.map
4335
+ //# sourceMappingURL=chunk-T6ZDWHP5.js.map