@openclaw/typesafe 2026.10.10 → 2026.11.5-beta.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.
Files changed (86) hide show
  1. package/README.md +28 -2
  2. package/dist/.setup/client-DI7wM7N-.mjs +361 -0
  3. package/dist/.setup/{errors-BCfRF_ub.mjs → errors-BEKARoBh.mjs} +15 -1
  4. package/dist/.source-module-urls/cb128076f461604fb70d7e9adeed8a53c97339bf983a26e3f0598f525dcccb17.json +1 -1
  5. package/dist/index.js +435 -65
  6. package/node_modules/typebox/build/format/duration.d.mts +2 -2
  7. package/node_modules/typebox/build/format/duration.mjs +2 -2
  8. package/node_modules/typebox/build/format/idn_email.d.mts +1 -0
  9. package/node_modules/typebox/build/format/idn_email.mjs +1 -0
  10. package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -1
  11. package/node_modules/typebox/build/format/idn_hostname.mjs +1 -1
  12. package/node_modules/typebox/build/format/ipv4.d.mts +2 -2
  13. package/node_modules/typebox/build/format/ipv4.mjs +2 -2
  14. package/node_modules/typebox/build/format/ipv6.d.mts +1 -1
  15. package/node_modules/typebox/build/format/ipv6.mjs +1 -1
  16. package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
  17. package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
  18. package/node_modules/typebox/build/schema/build.mjs +1 -0
  19. package/node_modules/typebox/build/schema/engine/_unique.d.mts +4 -2
  20. package/node_modules/typebox/build/schema/engine/_unique.mjs +7 -3
  21. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +3 -3
  22. package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +0 -3
  23. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +15 -17
  24. package/node_modules/typebox/build/schema/engine/contains.mjs +3 -3
  25. package/node_modules/typebox/build/schema/engine/index.d.mts +1 -0
  26. package/node_modules/typebox/build/schema/engine/index.mjs +1 -0
  27. package/node_modules/typebox/build/schema/engine/items.mjs +7 -4
  28. package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -2
  29. package/node_modules/typebox/build/schema/engine/minContains.mjs +3 -3
  30. package/node_modules/typebox/build/schema/engine/oneOf.mjs +2 -2
  31. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +2 -2
  32. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -2
  33. package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +2 -2
  34. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +2 -2
  35. package/node_modules/typebox/build/system/hashing/hash.mjs +63 -34
  36. package/node_modules/typebox/build/system/locale/en_US.mjs +2 -1
  37. package/node_modules/typebox/build/system/memory/assign.d.mts +2 -8
  38. package/node_modules/typebox/build/system/memory/assign.mjs +13 -6
  39. package/node_modules/typebox/build/system/memory/clone.d.mts +4 -5
  40. package/node_modules/typebox/build/system/memory/clone.mjs +8 -96
  41. package/node_modules/typebox/build/system/memory/create.d.mts +1 -5
  42. package/node_modules/typebox/build/system/memory/create.mjs +18 -13
  43. package/node_modules/typebox/build/system/memory/deep.d.mts +2 -0
  44. package/node_modules/typebox/build/system/memory/deep.mjs +108 -0
  45. package/node_modules/typebox/build/system/memory/discard.d.mts +1 -1
  46. package/node_modules/typebox/build/system/memory/discard.mjs +9 -8
  47. package/node_modules/typebox/build/system/memory/finalize.d.mts +4 -0
  48. package/node_modules/typebox/build/system/memory/finalize.mjs +30 -0
  49. package/node_modules/typebox/build/system/memory/keys.d.mts +2 -0
  50. package/node_modules/typebox/build/system/memory/keys.mjs +8 -0
  51. package/node_modules/typebox/build/system/memory/update.d.mts +1 -4
  52. package/node_modules/typebox/build/system/memory/update.mjs +43 -16
  53. package/node_modules/typebox/build/type/engine/call/index.d.mts +1 -0
  54. package/node_modules/typebox/build/type/engine/call/index.mjs +1 -0
  55. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +2 -24
  56. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +2 -29
  57. package/node_modules/typebox/build/type/engine/evaluate/index.d.mts +1 -0
  58. package/node_modules/typebox/build/type/engine/evaluate/index.mjs +1 -0
  59. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +5 -1
  60. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +6 -1
  61. package/node_modules/typebox/build/type/engine/evaluate/property.d.mts +30 -0
  62. package/node_modules/typebox/build/type/engine/evaluate/property.mjs +29 -0
  63. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +1 -3
  64. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +1 -4
  65. package/node_modules/typebox/build/type/engine/object/from_intersect.d.mts +2 -2
  66. package/node_modules/typebox/build/type/engine/object/from_intersect.mjs +2 -2
  67. package/node_modules/typebox/build/type/engine/object/from_union.d.mts +2 -2
  68. package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
  69. package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +1 -3
  70. package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +1 -4
  71. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +1 -3
  72. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +1 -4
  73. package/node_modules/typebox/build/type/engine/this/index.d.mts +1 -0
  74. package/node_modules/typebox/build/type/engine/this/index.mjs +1 -0
  75. package/node_modules/typebox/build/value/clone/clone.d.mts +4 -3
  76. package/node_modules/typebox/build/value/clone/clone.mjs +5 -7
  77. package/node_modules/typebox/build/value/repair/from_cyclic.d.mts +2 -0
  78. package/node_modules/typebox/build/value/repair/from_cyclic.mjs +6 -0
  79. package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +25 -14
  80. package/node_modules/typebox/package.json +1 -1
  81. package/node_modules/typebox/readme.md +1 -1
  82. package/openclaw.plugin.json +197 -47
  83. package/package.json +5 -5
  84. package/dist/.setup/client-CjL-E0U1.mjs +0 -393
  85. package/node_modules/typebox/build/system/memory/freeze.d.mts +0 -4
  86. package/node_modules/typebox/build/system/memory/freeze.mjs +0 -6
package/README.md CHANGED
@@ -7,8 +7,11 @@ decision-model API. Core supplies the provider-neutral `decision_evaluate` agent
7
7
  tool when the agent has an effective `decisionModel` selection, subject to normal
8
8
  tool policy and harness capabilities. No separate tool enablement is required.
9
9
 
10
- Requires OpenClaw and plugin API **2026.9.6 or later**. Released OpenClaw
11
- 2026.9.5 does not include the decision API.
10
+ This adapter requires the prepared Decision V2 API. Released OpenClaw
11
+ `2026.10.4` exposes V1 only. For development, use a matching source checkout
12
+ containing the prepared V2 runtime and this plugin. Packaged use requires a
13
+ supporting paired host/plugin release; the older installation floor alone does
14
+ not establish V2 compatibility.
12
15
 
13
16
  ```sh
14
17
  openclaw plugins install @openclaw/typesafe
@@ -26,6 +29,29 @@ server's loopback origin, such as `http://127.0.0.1:8009`, omit `apiKey`, and se
26
29
  Start the server separately with your chosen checkpoint; the decision-model
27
30
  selection labels requests and does not download or load a model.
28
31
 
32
+ For a separate inference host or HTTPS reverse proxy, use the standard
33
+ `models.providers.typesafe` configuration with `baseUrl`, optional `apiKey`,
34
+ `models: []`, and the shared `request` settings for auth, private-network policy,
35
+ proxy, and TLS. This route never inherits the legacy hosted plugin credential.
36
+ Evaluations send user content to the configured server; use HTTPS and select
37
+ a server you trust. Set the server's routing model ID as `decisionModel`.
38
+
29
39
  See the [TypeSafe AI setup guide](https://docs.openclaw.ai/plugins/typesafe) and
30
40
  [decision-model documentation](https://docs.openclaw.ai/concepts/decision-models)
31
41
  for configuration, rubrics, and API semantics.
42
+
43
+ ## Live adapter test
44
+
45
+ From a matching source checkout, inject a TypeSafe-issued `TYPESAFE_API_KEY`
46
+ through your secret manager, then run:
47
+
48
+ ```sh
49
+ OPENCLAW_LIVE_TEST=1 node scripts/run-vitest.mjs --config test/vitest/vitest.live.config.ts extensions/typesafe/src/decisions.live.test.ts
50
+ ```
51
+
52
+ The test sends two synthetic Boolean/Choice/Score batches (text and a generated
53
+ 320 × 320 PNG) to hosted Jev and consumes the account's allowance. It skips without both the opt-in flag and key. It checks
54
+ the registered V2 adapter and real transport with an isolated prepared credential;
55
+ it does not test host credential discovery or change any model selection. When
56
+ HTTPS proxy environment settings are present, the test explicitly selects the
57
+ shared environment-proxy transport (including protected-key egress).
@@ -0,0 +1,361 @@
1
+ import { a as HOSTED_ORIGIN, c as providerBaseUrl, o as hasCredentials, r as evaluationError, s as localBaseUrl, t as EvaluationError, u as usesHostedEndpoint } from "./errors-BEKARoBh.mjs";
2
+ import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input";
3
+ import { createProviderCredentialMatcher, fetchWithProviderHttpGuard, resolveProviderHttpRequestConfigWithOriginTrust, resolveProviderTransportSsrFPolicy, sanitizeConfiguredModelProviderRequest } from "openclaw/plugin-sdk/provider-http";
4
+ import { buildTimeoutAbortSignal } from "openclaw/plugin-sdk/extension-shared";
5
+ import { responseWithRelease, shouldUseEnvHttpProxyForUrl, withTrustedEnvProxyGuardedFetchMode } from "openclaw/plugin-sdk/fetch-runtime";
6
+ import { readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
7
+ import { parseRetryAfterHeaderSeconds } from "openclaw/plugin-sdk/retry-runtime";
8
+ import { isDeepStrictEqual } from "node:util";
9
+ // extensions/typesafe/src/schema-validator.generated.js
10
+ /*!
11
+ TypeBox
12
+
13
+ The MIT License (MIT)
14
+
15
+ Copyright (c) 2017-2026 Haydn Paterson
16
+
17
+ Permission is hereby granted, free of charge, to any person obtaining a copy
18
+ of this software and associated documentation files (the "Software"), to deal
19
+ in the Software without restriction, including without limitation the rights
20
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
+ copies of the Software, and to permit persons to whom the Software is
22
+ furnished to do so, subject to the following conditions:
23
+
24
+ The above copyright notice and this permission notice shall be included in
25
+ all copies or substantial portions of the Software.
26
+
27
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
33
+ THE SOFTWARE.
34
+ */
35
+ function CodePointCount(value) {
36
+ let result = 0, index = 0, prev = 0;
37
+ for (; index < value.length;) {
38
+ let next = value.charCodeAt(index++) >> 10;
39
+ result += +((prev << 8 | next) !== 13879), prev = next;
40
+ }
41
+ return result;
42
+ }
43
+ var isEvaluationInput = (() => {
44
+ let External = [
45
+ /(^state$|^questions$|^model$)/u,
46
+ /(?!)/u,
47
+ /(?!)/u,
48
+ /(^type$|^instructions$|^criteria$)/u,
49
+ /(?!)/u,
50
+ /(^true$|^false$)/u,
51
+ /(?!)/u,
52
+ /(?!)/u,
53
+ /(^type$|^instructions$|^criteria$)/u,
54
+ /(?!)/u,
55
+ /(?!)/u,
56
+ /(?!)/u,
57
+ /(^type$|^instructions$|^criteria$)/u,
58
+ /(?!)/u,
59
+ /(?!)/u,
60
+ /^[a-zA-Z0-9._/-]+$/u
61
+ ], check_0 = (value) => typeof value == "object" && value !== null && !Array.isArray(value) && "state" in value && "questions" in value && Object.getOwnPropertyNames(value).every((unique_0, unique_1) => External[0].test(unique_0) || !1) && (typeof value.state == "string" || typeof value.state == "object" && value.state !== null && !Array.isArray(value.state) && Object.getOwnPropertyNames(value.state).every((unique_2, unique_3) => External[1].test(unique_2) || !0) && !0 || Array.isArray(value.state) && value.state.every((unique_4, index) => !0) || value.state === null) && typeof value.questions == "object" && value.questions !== null && !Array.isArray(value.questions) && Object.getOwnPropertyNames(value.questions).every((unique_5, unique_6) => External[2].test(unique_5) || typeof value.questions[unique_5] == "object" && value.questions[unique_5] !== null && !Array.isArray(value.questions[unique_5]) && "type" in value.questions[unique_5] && Object.getOwnPropertyNames(value.questions[unique_5]).every((unique_7, unique_8) => External[3].test(unique_7) || !1) && typeof value.questions[unique_5].type == "string" && value.questions[unique_5].type === "noul" && (value.questions[unique_5].instructions === void 0 || !("instructions" in value.questions[unique_5]) || typeof value.questions[unique_5].instructions == "string" || typeof value.questions[unique_5].instructions == "object" && value.questions[unique_5].instructions !== null && !Array.isArray(value.questions[unique_5].instructions) && Object.getOwnPropertyNames(value.questions[unique_5].instructions).every((unique_9, unique_10) => External[4].test(unique_9) || !0) && !0 || Array.isArray(value.questions[unique_5].instructions) && value.questions[unique_5].instructions.every((unique_11, index) => !0) || value.questions[unique_5].instructions === null) && (value.questions[unique_5].criteria === void 0 || !("criteria" in value.questions[unique_5]) || typeof value.questions[unique_5].criteria == "object" && value.questions[unique_5].criteria !== null && !Array.isArray(value.questions[unique_5].criteria) && Object.getOwnPropertyNames(value.questions[unique_5].criteria).every((unique_12, unique_13) => External[5].test(unique_12) || !1) && (value.questions[unique_5].criteria.true === void 0 || !("true" in value.questions[unique_5].criteria) || typeof value.questions[unique_5].criteria.true == "string" || typeof value.questions[unique_5].criteria.true == "object" && value.questions[unique_5].criteria.true !== null && !Array.isArray(value.questions[unique_5].criteria.true) && Object.getOwnPropertyNames(value.questions[unique_5].criteria.true).every((unique_14, unique_15) => External[6].test(unique_14) || !0) && !0 || Array.isArray(value.questions[unique_5].criteria.true) && value.questions[unique_5].criteria.true.every((unique_16, index) => !0) || value.questions[unique_5].criteria.true === null) && (value.questions[unique_5].criteria.false === void 0 || !("false" in value.questions[unique_5].criteria) || typeof value.questions[unique_5].criteria.false == "string" || typeof value.questions[unique_5].criteria.false == "object" && value.questions[unique_5].criteria.false !== null && !Array.isArray(value.questions[unique_5].criteria.false) && Object.getOwnPropertyNames(value.questions[unique_5].criteria.false).every((unique_17, unique_18) => External[7].test(unique_17) || !0) && !0 || Array.isArray(value.questions[unique_5].criteria.false) && value.questions[unique_5].criteria.false.every((unique_19, index) => !0) || value.questions[unique_5].criteria.false === null) || value.questions[unique_5].criteria === null) || typeof value.questions[unique_5] == "object" && value.questions[unique_5] !== null && !Array.isArray(value.questions[unique_5]) && "type" in value.questions[unique_5] && "criteria" in value.questions[unique_5] && Object.getOwnPropertyNames(value.questions[unique_5]).every((unique_20, unique_21) => External[8].test(unique_20) || !1) && typeof value.questions[unique_5].type == "string" && value.questions[unique_5].type === "choice" && (value.questions[unique_5].instructions === void 0 || !("instructions" in value.questions[unique_5]) || typeof value.questions[unique_5].instructions == "string" || typeof value.questions[unique_5].instructions == "object" && value.questions[unique_5].instructions !== null && !Array.isArray(value.questions[unique_5].instructions) && Object.getOwnPropertyNames(value.questions[unique_5].instructions).every((unique_22, unique_23) => External[9].test(unique_22) || !0) && !0 || Array.isArray(value.questions[unique_5].instructions) && value.questions[unique_5].instructions.every((unique_24, index) => !0) || value.questions[unique_5].instructions === null) && typeof value.questions[unique_5].criteria == "object" && value.questions[unique_5].criteria !== null && !Array.isArray(value.questions[unique_5].criteria) && Object.getOwnPropertyNames(value.questions[unique_5].criteria).every((unique_25, unique_26) => External[10].test(unique_25) || typeof value.questions[unique_5].criteria[unique_25] == "string" || typeof value.questions[unique_5].criteria[unique_25] == "object" && value.questions[unique_5].criteria[unique_25] !== null && !Array.isArray(value.questions[unique_5].criteria[unique_25]) && Object.getOwnPropertyNames(value.questions[unique_5].criteria[unique_25]).every((unique_27, unique_28) => External[11].test(unique_27) || !0) && !0 || Array.isArray(value.questions[unique_5].criteria[unique_25]) && value.questions[unique_5].criteria[unique_25].every((unique_29, index) => !0) || value.questions[unique_5].criteria[unique_25] === null) && Object.getOwnPropertyNames(value.questions[unique_5].criteria).length >= 2 && Object.getOwnPropertyNames(value.questions[unique_5].criteria).length <= 255 || typeof value.questions[unique_5] == "object" && value.questions[unique_5] !== null && !Array.isArray(value.questions[unique_5]) && "type" in value.questions[unique_5] && "criteria" in value.questions[unique_5] && Object.getOwnPropertyNames(value.questions[unique_5]).every((unique_30, unique_31) => External[12].test(unique_30) || !1) && typeof value.questions[unique_5].type == "string" && value.questions[unique_5].type === "score" && (value.questions[unique_5].instructions === void 0 || !("instructions" in value.questions[unique_5]) || typeof value.questions[unique_5].instructions == "string" || typeof value.questions[unique_5].instructions == "object" && value.questions[unique_5].instructions !== null && !Array.isArray(value.questions[unique_5].instructions) && Object.getOwnPropertyNames(value.questions[unique_5].instructions).every((unique_32, unique_33) => External[13].test(unique_32) || !0) && !0 || Array.isArray(value.questions[unique_5].instructions) && value.questions[unique_5].instructions.every((unique_34, index) => !0) || value.questions[unique_5].instructions === null) && Array.isArray(value.questions[unique_5].criteria) && value.questions[unique_5].criteria.every((unique_35, index) => typeof unique_35 == "string" || typeof unique_35 == "object" && unique_35 !== null && !Array.isArray(unique_35) && Object.getOwnPropertyNames(unique_35).every((unique_36, unique_37) => External[14].test(unique_36) || !0) && !0 || Array.isArray(unique_35) && unique_35.every((unique_38, index2) => !0) || unique_35 === null) && value.questions[unique_5].criteria.length >= 2 && value.questions[unique_5].criteria.length <= 10) && Object.getOwnPropertyNames(value.questions).length >= 1 && (value.model === void 0 || !("model" in value) || typeof value.model == "string" && (value.model.length >= 2 || value.model.length >= 1 && CodePointCount(value.model) >= 1) && (value.model.length <= 128 || value.model.length <= 256 && CodePointCount(value.model) <= 128) && External[15].test(value.model));
62
+ return (value) => check_0(value);
63
+ })();
64
+ var isEvaluation = (() => {
65
+ let External = [
66
+ /^[a-zA-Z0-9._/-]+$/u,
67
+ /(?!)/u,
68
+ /(?!)/u,
69
+ /(?!)/u,
70
+ /(?!)/u,
71
+ /(?!)/u
72
+ ], check_0 = (value) => typeof value == "object" && value !== null && !Array.isArray(value) && "model" in value && "answers" in value && "usage" in value && typeof value.model == "string" && (value.model.length >= 2 || value.model.length >= 1 && CodePointCount(value.model) >= 1) && (value.model.length <= 128 || value.model.length <= 256 && CodePointCount(value.model) <= 128) && External[0].test(value.model) && typeof value.answers == "object" && value.answers !== null && !Array.isArray(value.answers) && Object.getOwnPropertyNames(value.answers).every((unique_0, unique_1) => External[1].test(unique_0) || typeof value.answers[unique_0] == "object" && value.answers[unique_0] !== null && !Array.isArray(value.answers[unique_0]) && "type" in value.answers[unique_0] && "noul" in value.answers[unique_0] && Object.getOwnPropertyNames(value.answers[unique_0]).length === 2 && typeof value.answers[unique_0].type == "string" && value.answers[unique_0].type === "noul" && Number.isFinite(value.answers[unique_0].noul) && value.answers[unique_0].noul >= 0 && value.answers[unique_0].noul <= 1 || typeof value.answers[unique_0] == "object" && value.answers[unique_0] !== null && !Array.isArray(value.answers[unique_0]) && "type" in value.answers[unique_0] && "choice" in value.answers[unique_0] && "confidence" in value.answers[unique_0] && "probabilities" in value.answers[unique_0] && Object.getOwnPropertyNames(value.answers[unique_0]).length === 4 && typeof value.answers[unique_0].type == "string" && value.answers[unique_0].type === "choice" && typeof value.answers[unique_0].choice == "string" && Number.isFinite(value.answers[unique_0].confidence) && value.answers[unique_0].confidence >= 0 && value.answers[unique_0].confidence <= 1 && typeof value.answers[unique_0].probabilities == "object" && value.answers[unique_0].probabilities !== null && !Array.isArray(value.answers[unique_0].probabilities) && Object.getOwnPropertyNames(value.answers[unique_0].probabilities).every((unique_2, unique_3) => External[2].test(unique_2) || Number.isFinite(value.answers[unique_0].probabilities[unique_2]) && value.answers[unique_0].probabilities[unique_2] >= 0 && value.answers[unique_0].probabilities[unique_2] <= 1) && Object.getOwnPropertyNames(value.answers[unique_0].probabilities).length >= 2 && Object.getOwnPropertyNames(value.answers[unique_0].probabilities).length <= 255 || typeof value.answers[unique_0] == "object" && value.answers[unique_0] !== null && !Array.isArray(value.answers[unique_0]) && "type" in value.answers[unique_0] && "score" in value.answers[unique_0] && "confidence" in value.answers[unique_0] && "probabilities" in value.answers[unique_0] && "legend" in value.answers[unique_0] && Object.getOwnPropertyNames(value.answers[unique_0]).length === 5 && typeof value.answers[unique_0].type == "string" && value.answers[unique_0].type === "score" && Number.isFinite(value.answers[unique_0].score) && value.answers[unique_0].score >= 0 && value.answers[unique_0].score <= 9 && Number.isFinite(value.answers[unique_0].confidence) && value.answers[unique_0].confidence >= 0 && value.answers[unique_0].confidence <= 1 && typeof value.answers[unique_0].probabilities == "object" && value.answers[unique_0].probabilities !== null && !Array.isArray(value.answers[unique_0].probabilities) && Object.getOwnPropertyNames(value.answers[unique_0].probabilities).every((unique_4, unique_5) => External[3].test(unique_4) || Number.isFinite(value.answers[unique_0].probabilities[unique_4]) && value.answers[unique_0].probabilities[unique_4] >= 0 && value.answers[unique_0].probabilities[unique_4] <= 1) && Object.getOwnPropertyNames(value.answers[unique_0].probabilities).length >= 2 && Object.getOwnPropertyNames(value.answers[unique_0].probabilities).length <= 255 && typeof value.answers[unique_0].legend == "object" && value.answers[unique_0].legend !== null && !Array.isArray(value.answers[unique_0].legend) && Object.getOwnPropertyNames(value.answers[unique_0].legend).every((unique_6, unique_7) => External[4].test(unique_6) || typeof value.answers[unique_0].legend[unique_6] == "string" || typeof value.answers[unique_0].legend[unique_6] == "object" && value.answers[unique_0].legend[unique_6] !== null && !Array.isArray(value.answers[unique_0].legend[unique_6]) && Object.getOwnPropertyNames(value.answers[unique_0].legend[unique_6]).every((unique_8, unique_9) => External[5].test(unique_8) || !0) && !0 || Array.isArray(value.answers[unique_0].legend[unique_6]) && value.answers[unique_0].legend[unique_6].every((unique_10, index) => !0) || value.answers[unique_0].legend[unique_6] === null) && Object.getOwnPropertyNames(value.answers[unique_0].legend).length >= 2 && Object.getOwnPropertyNames(value.answers[unique_0].legend).length <= 10) && Object.getOwnPropertyNames(value.answers).length >= 1 && typeof value.usage == "object" && value.usage !== null && !Array.isArray(value.usage) && "input_tokens" in value.usage && "output_tokens" in value.usage && Number.isInteger(value.usage.input_tokens) && (!(Number.isFinite(value.usage.input_tokens) || typeof value.usage.input_tokens == "bigint") || value.usage.input_tokens >= 0 && value.usage.input_tokens <= 9007199254740991) && Number.isInteger(value.usage.output_tokens) && (!(Number.isFinite(value.usage.output_tokens) || typeof value.usage.output_tokens == "bigint") || value.usage.output_tokens >= 0 && value.usage.output_tokens <= 9007199254740991);
73
+ return (value) => check_0(value);
74
+ })();
75
+ var isEvaluationQuestion = (() => {
76
+ let External = [
77
+ /(^type$|^instructions$|^criteria$)/u,
78
+ /(?!)/u,
79
+ /(^true$|^false$)/u,
80
+ /(?!)/u,
81
+ /(?!)/u,
82
+ /(^type$|^instructions$|^criteria$)/u,
83
+ /(?!)/u,
84
+ /(?!)/u,
85
+ /(?!)/u,
86
+ /(^type$|^instructions$|^criteria$)/u,
87
+ /(?!)/u,
88
+ /(?!)/u
89
+ ], check_0 = (value) => typeof value == "object" && value !== null && !Array.isArray(value) && "type" in value && Object.getOwnPropertyNames(value).every((unique_0, unique_1) => External[0].test(unique_0) || !1) && typeof value.type == "string" && value.type === "noul" && (value.instructions === void 0 || !("instructions" in value) || typeof value.instructions == "string" || typeof value.instructions == "object" && value.instructions !== null && !Array.isArray(value.instructions) && Object.getOwnPropertyNames(value.instructions).every((unique_2, unique_3) => External[1].test(unique_2) || !0) && !0 || Array.isArray(value.instructions) && value.instructions.every((unique_4, index) => !0) || value.instructions === null) && (value.criteria === void 0 || !("criteria" in value) || typeof value.criteria == "object" && value.criteria !== null && !Array.isArray(value.criteria) && Object.getOwnPropertyNames(value.criteria).every((unique_5, unique_6) => External[2].test(unique_5) || !1) && (value.criteria.true === void 0 || !("true" in value.criteria) || typeof value.criteria.true == "string" || typeof value.criteria.true == "object" && value.criteria.true !== null && !Array.isArray(value.criteria.true) && Object.getOwnPropertyNames(value.criteria.true).every((unique_7, unique_8) => External[3].test(unique_7) || !0) && !0 || Array.isArray(value.criteria.true) && value.criteria.true.every((unique_9, index) => !0) || value.criteria.true === null) && (value.criteria.false === void 0 || !("false" in value.criteria) || typeof value.criteria.false == "string" || typeof value.criteria.false == "object" && value.criteria.false !== null && !Array.isArray(value.criteria.false) && Object.getOwnPropertyNames(value.criteria.false).every((unique_10, unique_11) => External[4].test(unique_10) || !0) && !0 || Array.isArray(value.criteria.false) && value.criteria.false.every((unique_12, index) => !0) || value.criteria.false === null) || value.criteria === null) || typeof value == "object" && value !== null && !Array.isArray(value) && "type" in value && "criteria" in value && Object.getOwnPropertyNames(value).every((unique_13, unique_14) => External[5].test(unique_13) || !1) && typeof value.type == "string" && value.type === "choice" && (value.instructions === void 0 || !("instructions" in value) || typeof value.instructions == "string" || typeof value.instructions == "object" && value.instructions !== null && !Array.isArray(value.instructions) && Object.getOwnPropertyNames(value.instructions).every((unique_15, unique_16) => External[6].test(unique_15) || !0) && !0 || Array.isArray(value.instructions) && value.instructions.every((unique_17, index) => !0) || value.instructions === null) && typeof value.criteria == "object" && value.criteria !== null && !Array.isArray(value.criteria) && Object.getOwnPropertyNames(value.criteria).every((unique_18, unique_19) => External[7].test(unique_18) || typeof value.criteria[unique_18] == "string" || typeof value.criteria[unique_18] == "object" && value.criteria[unique_18] !== null && !Array.isArray(value.criteria[unique_18]) && Object.getOwnPropertyNames(value.criteria[unique_18]).every((unique_20, unique_21) => External[8].test(unique_20) || !0) && !0 || Array.isArray(value.criteria[unique_18]) && value.criteria[unique_18].every((unique_22, index) => !0) || value.criteria[unique_18] === null) && Object.getOwnPropertyNames(value.criteria).length >= 2 && Object.getOwnPropertyNames(value.criteria).length <= 255 || typeof value == "object" && value !== null && !Array.isArray(value) && "type" in value && "criteria" in value && Object.getOwnPropertyNames(value).every((unique_23, unique_24) => External[9].test(unique_23) || !1) && typeof value.type == "string" && value.type === "score" && (value.instructions === void 0 || !("instructions" in value) || typeof value.instructions == "string" || typeof value.instructions == "object" && value.instructions !== null && !Array.isArray(value.instructions) && Object.getOwnPropertyNames(value.instructions).every((unique_25, unique_26) => External[10].test(unique_25) || !0) && !0 || Array.isArray(value.instructions) && value.instructions.every((unique_27, index) => !0) || value.instructions === null) && Array.isArray(value.criteria) && value.criteria.every((unique_28, index) => typeof unique_28 == "string" || typeof unique_28 == "object" && unique_28 !== null && !Array.isArray(unique_28) && Object.getOwnPropertyNames(unique_28).every((unique_29, unique_30) => External[11].test(unique_29) || !0) && !0 || Array.isArray(unique_28) && unique_28.every((unique_31, index2) => !0) || unique_28 === null) && value.criteria.length >= 2 && value.criteria.length <= 10;
90
+ return (value) => check_0(value);
91
+ })();
92
+ // extensions/typesafe/src/schema.ts
93
+ const MAX_JSON_BYTES = 4194304;
94
+ const MAX_JSON_NODES = 262144;
95
+ const MAX_JSON_DEPTH = 64;
96
+ /** Reject non-JSON values and excessive structure before schema validation or serialization. */
97
+ function assertBoundedJson(value) {
98
+ let nodes = 0;
99
+ const visit = (node, depth) => {
100
+ if (++nodes > MAX_JSON_NODES || depth > MAX_JSON_DEPTH) throw new EvaluationError("TypeSafe JSON exceeds resource limits (262144 nodes or depth 64).", "unsupported-input");
101
+ if (node === null || typeof node === "string" || typeof node === "boolean") return;
102
+ if (typeof node === "number" && Number.isFinite(node)) return;
103
+ if (typeof node !== "object" || !node) throw new EvaluationError("TypeSafe input must be JSON.", "unsupported-input");
104
+ const array = Array.isArray(node);
105
+ const prototype = Object.getPrototypeOf(node);
106
+ if (array ? prototype !== Array.prototype : prototype !== Object.prototype && prototype !== null) throw new EvaluationError("TypeSafe input must be plain JSON.", "unsupported-input");
107
+ if (array) {
108
+ if (node.length > MAX_JSON_NODES || Object.keys(node).length !== node.length || Object.hasOwn(node, "toJSON")) throw new EvaluationError("TypeSafe input must be a bounded JSON array.", "unsupported-input");
109
+ for (let index = 0; index < node.length; index++) {
110
+ const descriptor = Object.getOwnPropertyDescriptor(node, index);
111
+ if (!descriptor?.enumerable || !("value" in descriptor)) throw new EvaluationError("TypeSafe input must be plain JSON.", "unsupported-input");
112
+ visit(descriptor.value, depth + 1);
113
+ }
114
+ return;
115
+ }
116
+ for (const key of Object.getOwnPropertyNames(node)) {
117
+ if ([
118
+ "__proto__",
119
+ "constructor",
120
+ "prototype"
121
+ ].includes(key)) throw new EvaluationError("TypeSafe input contains a reserved key.", "unsupported-input");
122
+ const descriptor = Object.getOwnPropertyDescriptor(node, key);
123
+ if (!descriptor?.enumerable || !("value" in descriptor)) throw new EvaluationError("TypeSafe input must be plain JSON.", "unsupported-input");
124
+ visit(descriptor.value, depth + 1);
125
+ }
126
+ };
127
+ visit(value, 0);
128
+ if (Buffer.byteLength(JSON.stringify(value), "utf8") > 4194304) throw new EvaluationError("TypeSafe JSON exceeds the plugin resource limit of 4 MiB.", "unsupported-input");
129
+ }
130
+ /** Validate without including supplied state in diagnostics. */
131
+ function parseInput(value) {
132
+ assertBoundedJson(value);
133
+ if (!isEvaluationInput(value)) {
134
+ if (value && typeof value === "object" && "questions" in value && value.questions && typeof value.questions === "object" && !Array.isArray(value.questions)) {
135
+ for (const [index, q] of Object.values(value.questions).entries()) if (!isEvaluationQuestion(q)) {
136
+ const kind = q && typeof q === "object" && "type" in q ? q.type : void 0;
137
+ const hint = kind === "choice" ? "Choice requires 2–255 criteria descriptions." : kind === "score" ? "Score requires 2–10 ordered criteria descriptions." : kind === "noul" ? "Noul criteria may contain only true/false descriptions, or null." : "type must be choice, score, or noul.";
138
+ throw new EvaluationError(`Invalid TypeSafe questions entry #${index + 1}: ${hint} Instructions/descriptions accept text, object, array, or null; no extra question fields.`, "unsupported-input");
139
+ }
140
+ }
141
+ throw new EvaluationError("Invalid TypeSafe evaluation input: supply state (text/object/array/null), a nonempty questions map, and optionally a valid model ID; no extra fields.", "unsupported-input");
142
+ }
143
+ return value;
144
+ }
145
+ /** Check the response schema and correspondence to this exact question batch. */
146
+ function parseResult(value, input) {
147
+ try {
148
+ assertBoundedJson(value);
149
+ if (!isEvaluation(value)) throw new Error();
150
+ const questions = Object.entries(input.questions);
151
+ if (Object.keys(value.answers).length !== questions.length) throw new Error();
152
+ for (const [id, expected] of questions) {
153
+ const answer = value.answers[id];
154
+ if (!answer || answer.type !== expected.type) throw new Error();
155
+ if (answer.type === "noul") continue;
156
+ const labels = expected.type === "score" ? expected.criteria.map((_, index) => String(index)) : expected.type === "choice" ? Object.keys(expected.criteria) : [];
157
+ if (Object.keys(answer.probabilities).length !== labels.length || labels.some((label) => !Object.hasOwn(answer.probabilities, label))) throw new Error();
158
+ if (!(Object.values(answer.probabilities).reduce((sum, item) => sum + item, 0) > 0)) throw new Error();
159
+ if (answer.type === "choice" && !labels.includes(answer.choice)) throw new Error();
160
+ if (answer.type === "score" && expected.type === "score") {
161
+ if (answer.score > labels.length - 1 || Object.keys(answer.legend).length !== labels.length || labels.some((label, index) => !isDeepStrictEqual(answer.legend[label], expected.criteria[index]))) throw new Error();
162
+ }
163
+ }
164
+ return value;
165
+ } catch {
166
+ throw new Error("TypeSafe returned an invalid evaluation response.");
167
+ }
168
+ }
169
+ // extensions/typesafe/src/client.ts
170
+ const IMAGE_OPT_IN_HEADER = "TypeSafe-Danger-Zone-Images";
171
+ const API_BASE_URL = `${HOSTED_ORIGIN}/v1`;
172
+ function httpError(response) {
173
+ if (response.status === 401 || response.status === 403) return new EvaluationError("TypeSafe authentication failed; check the configured credential and account access.", "authentication");
174
+ if (response.status === 429) {
175
+ const milliseconds = response.headers.get("retry-after-ms");
176
+ const parsedMilliseconds = milliseconds?.trim() ? Number(milliseconds) : NaN;
177
+ const seconds = parseRetryAfterHeaderSeconds(response.headers.get("retry-after"));
178
+ const retryAfterMs = Number.isFinite(parsedMilliseconds) && parsedMilliseconds >= 0 ? parsedMilliseconds : seconds === void 0 ? void 0 : seconds * 1e3;
179
+ return new EvaluationError("TypeSafe rate limit reached; retry later.", "rate-limited", retryAfterMs);
180
+ }
181
+ if (response.status === 400 || response.status === 413 || response.status === 422) return new EvaluationError("TypeSafe rejected the supplied input.", "unsupported-input");
182
+ return new EvaluationError("TypeSafe service rejected the evaluation request.", "transport");
183
+ }
184
+ /** Evaluate explicit state without ambient credentials, retries, or vendor diagnostics. */
185
+ async function evaluate(input, config, abortSignal, deadlineMonotonicMs, isAdmissible, assets) {
186
+ if (abortSignal?.aborted) throw evaluationError(void 0, true);
187
+ const parsed = parseInput(input);
188
+ const model = parsed.model;
189
+ if (!model) throw new EvaluationError("TypeSafe requires a host-selected model.", "unsupported-input");
190
+ const hosted = usesHostedEndpoint(config);
191
+ if (model === "kev-latest" && hosted) throw new EvaluationError("Kev requires a local System One server. Configure baseUrl in TypeSafe plugin Settings.", "unsupported-input");
192
+ if (!hasCredentials(config)) throw new Error("TypeSafe API key is missing. Configure a SecretRef in plugin Settings.");
193
+ try {
194
+ let wireInput = parsed;
195
+ if (!assets && !hosted) {
196
+ const questions = {};
197
+ for (const [id, question] of Object.entries(parsed.questions)) {
198
+ const instructions = question.instructions ?? null;
199
+ if (question.type === "score") questions[id] = {
200
+ ...question,
201
+ instructions,
202
+ criteria: question.criteria.map((level) => typeof level === "string" ? level : level === null ? "" : JSON.stringify(level))
203
+ };
204
+ else questions[id] = {
205
+ ...question,
206
+ instructions
207
+ };
208
+ }
209
+ wireInput = {
210
+ ...parsed,
211
+ questions
212
+ };
213
+ }
214
+ const baseUrl = config.providerConfig ? providerBaseUrl(config.providerConfig.baseUrl) : localBaseUrl(config.baseUrl);
215
+ const apiBaseUrl = config.providerConfig ? baseUrl : baseUrl ? `${baseUrl}/v1` : API_BASE_URL;
216
+ if (assets && apiBaseUrl !== API_BASE_URL) throw new EvaluationError("TypeSafe images require hosted Jev at /v1.", "unsupported-input");
217
+ let resolved;
218
+ let configuredRequest;
219
+ try {
220
+ configuredRequest = sanitizeConfiguredModelProviderRequest(config.providerConfig?.request);
221
+ const headers = {};
222
+ for (const [name, value] of Object.entries(config.providerConfig?.headers ?? {})) {
223
+ const headerValue = normalizeResolvedSecretInputString({
224
+ value,
225
+ path: `models.providers.typesafe.headers.${name}`
226
+ });
227
+ if (headerValue !== void 0) headers[name] = headerValue;
228
+ }
229
+ const credential = !baseUrl || config.providerConfig ? config.apiKey : void 0;
230
+ resolved = resolveProviderHttpRequestConfigWithOriginTrust({
231
+ provider: "typesafe",
232
+ capability: "other",
233
+ transport: "http",
234
+ baseUrl: apiBaseUrl,
235
+ defaultBaseUrl: API_BASE_URL,
236
+ defaultHeaders: {
237
+ ...credential && config.providerConfig?.authHeader !== false ? { Authorization: `Bearer ${credential}` } : {},
238
+ Accept: "application/json",
239
+ "Content-Type": "application/json",
240
+ ...headers
241
+ },
242
+ request: configuredRequest
243
+ });
244
+ } catch {
245
+ throw new EvaluationError("TypeSafe provider credentials or request settings are unavailable.", "credentials-unavailable");
246
+ }
247
+ resolved.headers.delete(IMAGE_OPT_IN_HEADER);
248
+ const reflectsCredential = createProviderCredentialMatcher({
249
+ headers: resolved.headers,
250
+ request: configuredRequest,
251
+ configuredHeaderNames: Object.keys(config.providerConfig?.headers ?? {}),
252
+ defaultAuthHeader: "Authorization",
253
+ defaultAuthPrefix: "Bearer "
254
+ });
255
+ if (assets) resolved.headers.set(IMAGE_OPT_IN_HEADER, "true");
256
+ const endpoint = `${resolved.baseUrl}/systemone`;
257
+ const policy = baseUrl ? resolveProviderTransportSsrFPolicy({
258
+ baseUrl: resolved.baseUrl,
259
+ url: endpoint,
260
+ allowPrivateNetwork: resolved.allowPrivateNetwork,
261
+ trustConfiguredBaseUrlOrigin: resolved.trustConfiguredBaseUrlOrigin
262
+ }) : void 0;
263
+ const body = JSON.stringify({
264
+ ...wireInput,
265
+ model,
266
+ ...assets ? { assets } : {}
267
+ });
268
+ if (Buffer.byteLength(body) > (assets ? 33554432 : 4194304)) throw new EvaluationError("TypeSafe request exceeds its limit.", "unsupported-input");
269
+ const timeoutMs = deadlineMonotonicMs === void 0 ? config.timeoutMs : Math.min(config.timeoutMs, deadlineMonotonicMs - performance.now());
270
+ if (timeoutMs <= 0) throw new EvaluationError("TypeSafe evaluation timed out.", "transport");
271
+ const { signal, cleanup } = buildTimeoutAbortSignal({
272
+ signal: abortSignal,
273
+ timeoutMs,
274
+ operation: "TypeSafe evaluation"
275
+ });
276
+ const assertActive = () => {
277
+ signal?.throwIfAborted();
278
+ if (deadlineMonotonicMs !== void 0 && performance.now() >= deadlineMonotonicMs) throw new EvaluationError("TypeSafe evaluation timed out.", "transport");
279
+ if (isAdmissible && !isAdmissible()) throw new EvaluationError("TypeSafe evaluation is no longer admitted.", "transport");
280
+ };
281
+ let responsePayload;
282
+ try {
283
+ assertActive();
284
+ const request = {
285
+ url: endpoint,
286
+ fetchImpl: globalThis.fetch,
287
+ requireHttps: !baseUrl || new URL(baseUrl).protocol === "https:",
288
+ policy,
289
+ dispatcherPolicy: resolved.dispatcherPolicy,
290
+ ...baseUrl && new URL(baseUrl).hostname === "localhost" ? { lookupFn: async () => [{
291
+ address: "127.0.0.1",
292
+ family: 4
293
+ }, {
294
+ address: "::1",
295
+ family: 6
296
+ }] } : {},
297
+ maxRedirects: 0,
298
+ signal,
299
+ beforeRequest: assertActive,
300
+ init: {
301
+ method: "POST",
302
+ headers: resolved.headers,
303
+ body
304
+ }
305
+ };
306
+ const guarded = await fetchWithProviderHttpGuard(!baseUrl && !resolved.dispatcherPolicy && shouldUseEnvHttpProxyForUrl(endpoint) ? withTrustedEnvProxyGuardedFetchMode(request) : request);
307
+ let releasePromise;
308
+ const release = () => releasePromise ??= Promise.resolve().then(() => guarded.release());
309
+ let payload;
310
+ try {
311
+ const response = responseWithRelease(guarded.response, release);
312
+ if (!response.ok) {
313
+ await response.body?.cancel();
314
+ throw httpError(response);
315
+ }
316
+ const bytes = await readResponseWithLimit(response, MAX_JSON_BYTES, {
317
+ signal,
318
+ onOverflow: () => new EvaluationError("TypeSafe response exceeds its limit.", "invalid-response")
319
+ });
320
+ let text;
321
+ try {
322
+ text = new TextDecoder("utf-8", { fatal: true }).decode(bytes);
323
+ payload = JSON.parse(text);
324
+ } catch {
325
+ throw new EvaluationError("TypeSafe returned invalid JSON.", "invalid-response");
326
+ }
327
+ const decodedText = JSON.stringify(payload);
328
+ if (reflectsCredential(text) || decodedText !== text && reflectsCredential(decodedText)) throw new EvaluationError("TypeSafe evaluation failed or returned an invalid response.", "invalid-response");
329
+ } finally {
330
+ await release();
331
+ }
332
+ signal?.throwIfAborted();
333
+ responsePayload = payload;
334
+ } catch (error) {
335
+ if (abortSignal?.aborted) throw new EvaluationError("TypeSafe evaluation cancelled.", "transport");
336
+ if (signal?.aborted) throw new EvaluationError("TypeSafe evaluation timed out.", "transport");
337
+ if (error instanceof EvaluationError) throw error;
338
+ throw new EvaluationError("TypeSafe transport unavailable.", "transport");
339
+ } finally {
340
+ cleanup();
341
+ }
342
+ abortSignal?.throwIfAborted();
343
+ if (!assets && !hosted) {
344
+ if (!responsePayload || typeof responsePayload !== "object" || Array.isArray(responsePayload)) throw new Error("Invalid local System One response.");
345
+ if ("latency_ms" in responsePayload) {
346
+ const { latency_ms, ...payload } = responsePayload;
347
+ if (typeof latency_ms !== "number" || !Number.isFinite(latency_ms) || latency_ms < 0) throw new Error("Invalid local System One latency metadata.");
348
+ responsePayload = payload;
349
+ }
350
+ }
351
+ const evaluation = parseResult(responsePayload, wireInput);
352
+ if (!assets && !hosted) for (const [id, question] of Object.entries(parsed.questions)) {
353
+ const answer = evaluation.answers[id];
354
+ if (question.type === "score" && answer?.type === "score") answer.legend = Object.fromEntries(question.criteria.map((level, index) => [String(index), level]));
355
+ }
356
+ return { evaluation };
357
+ } catch (error) {
358
+ throw evaluationError(error, abortSignal?.aborted ?? false);
359
+ }
360
+ }
361
+ export { evaluate };
@@ -29,6 +29,20 @@ const ConfigSchema = Type.Object({
29
29
  default: 3e4
30
30
  }))
31
31
  }, { additionalProperties: false });
32
+ const HOSTED_ORIGIN = "https://api.typesafe.ai";
33
+ /** Model providers configure the API root; origin-only System One URLs imply /v1. */
34
+ function providerBaseUrl(value) {
35
+ const parsed = value ? URL.parse(value) : null;
36
+ if (!parsed || !["http:", "https:"].includes(parsed.protocol) || parsed.username || parsed.password || parsed.search || parsed.hash) throw new Error("Invalid models.providers.typesafe.baseUrl; use an HTTP(S) API base URL without credentials, query, or fragment.");
37
+ parsed.pathname = parsed.pathname.replace(/\/+$/, "") || "/v1";
38
+ return parsed.toString().replace(/\/+$/, "");
39
+ }
40
+ function usesHostedEndpoint(config) {
41
+ return !config.baseUrl || new URL(config.baseUrl).origin === "https://api.typesafe.ai";
42
+ }
43
+ function hasCredentials(config) {
44
+ return !config.credentialsUnavailable && Boolean(config.baseUrl || config.apiKey);
45
+ }
32
46
  /** A configured endpoint grants access to one loopback origin, never arbitrary private hosts. */
33
47
  function localBaseUrl(value) {
34
48
  if (value === void 0) return;
@@ -75,4 +89,4 @@ function decisionFailure(error) {
75
89
  };
76
90
  throw new Error("TypeSafe decision adapter contract failure.");
77
91
  }
78
- export { localBaseUrl as a, ConfigSchema as i, decisionFailure as n, runtimeConfig as o, evaluationError as r, EvaluationError as t };
92
+ export { HOSTED_ORIGIN as a, providerBaseUrl as c, ConfigSchema as i, runtimeConfig as l, decisionFailure as n, hasCredentials as o, evaluationError as r, localBaseUrl as s, EvaluationError as t, usesHostedEndpoint as u };
@@ -1 +1 @@
1
- {"version":3,"entries":[{"output":"index.js","source":"extensions/typesafe/index.ts"}],"chunks":[{"output":".setup/client-CjL-E0U1.mjs","sha256":"718fc6a2ab2e254185c7f856a98adce040ef398186bda69617005d55d2ff274b","facadeSource":"extensions/typesafe/src/client.ts","sources":["extensions/typesafe/src/client.ts","extensions/typesafe/src/local.ts","extensions/typesafe/src/schema.ts","extensions/typesafe/src/transport.ts"]},{"output":".setup/errors-BCfRF_ub.mjs","sha256":"fe9e6a92afc52555823245f42cffc93448c7e607eef4202ce99e4188bd0b98bd","facadeSource":null,"sources":["extensions/typesafe/src/config.ts","extensions/typesafe/src/errors.ts"]},{"output":"index.js","sha256":"631e8261e0c9b28de1fd86934b1a8b94d477c0a800e97e6aa964e55e68c29e37","facadeSource":"extensions/typesafe/index.ts","sources":["extensions/typesafe/index.ts","extensions/typesafe/src/credentials.ts","extensions/typesafe/src/decisions.ts"]}],"unrenderedSources":[]}
1
+ {"version":3,"entries":[{"output":"index.js","source":"extensions/typesafe/index.ts"}],"chunks":[{"output":".setup/client-DI7wM7N-.mjs","sha256":"c2bf5117466053d799751214c8c15858b26601a00f2bd5576a844a8cf993243c","facadeSource":"extensions/typesafe/src/client.ts","sources":["extensions/typesafe/src/client.ts","extensions/typesafe/src/schema-validator.generated.js","extensions/typesafe/src/schema.ts"]},{"output":".setup/errors-BEKARoBh.mjs","sha256":"f79730614710fdd9a257f0ffab888aee49670d6546baa9047388f426723b0ac8","facadeSource":null,"sources":["extensions/typesafe/src/config.ts","extensions/typesafe/src/errors.ts"]},{"output":"index.js","sha256":"39629ab9c86f1d6eb079732f83c853866800dee1ad077f6c0aa75e8424f6caa7","facadeSource":"extensions/typesafe/index.ts","sources":["extensions/typesafe/index.ts","extensions/typesafe/openclaw.plugin.json","extensions/typesafe/src/credentials.ts","extensions/typesafe/src/decisions.ts"]}],"unrenderedSources":[]}