@nexface/agent 0.1.14 → 0.1.15-alpha.0
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/agent.d.ts +2 -1
- package/dist/agent.js +323 -877
- package/dist/agent.js.map +1 -0
- package/dist/browser-policy/gpt.js +12 -36
- package/dist/browser-policy/gpt.js.map +1 -0
- package/dist/browser-policy/jev.js +9 -21
- package/dist/browser-policy/jev.js.map +1 -0
- package/dist/browser-policy/response-error.js +2 -4
- package/dist/browser-policy/response-error.js.map +1 -0
- package/dist/browser-policy/shared.js +21 -49
- package/dist/browser-policy/shared.js.map +1 -0
- package/dist/browser-prompt.generated.js +1 -0
- package/dist/browser-prompt.generated.js.map +1 -0
- package/dist/browser-prompt.js +1 -0
- package/dist/browser-prompt.js.map +1 -0
- package/dist/errors.d.ts +2 -2
- package/dist/errors.js +4 -3
- package/dist/errors.js.map +1 -0
- package/dist/history-compaction.js +26 -47
- package/dist/history-compaction.js.map +1 -0
- package/dist/history-version.js +4 -11
- package/dist/history-version.js.map +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/model/binding.js +1 -0
- package/dist/model/binding.js.map +1 -0
- package/dist/model/error.js +1 -0
- package/dist/model/error.js.map +1 -0
- package/dist/model/internal-adapter.js +2 -1
- package/dist/model/internal-adapter.js.map +1 -0
- package/dist/model/types.js +1 -0
- package/dist/model/types.js.map +1 -0
- package/dist/models/{k.js → 39.js} +336 -168
- package/dist/models/851.js +10 -0
- package/dist/models/_chunks/360-7e580bb2.js +1189 -0
- package/dist/models/_chunks/474-e1813138.js +8304 -0
- package/dist/models/_chunks/86-c0c5ac98.js +453 -0
- package/dist/models/_chunks/anthropic-messages~1-d35e3e7d.js +8057 -0
- package/dist/models/_chunks/deferred-tools-90f3c977.js +37 -0
- package/dist/models/_chunks/error-body-8bee35c2.js +134 -0
- package/dist/models/_chunks/google-generative-ai~1-2ba71457.js +22104 -0
- package/dist/models/_chunks/openai-completions~1-b340f0e0.js +1285 -0
- package/dist/models/_chunks/openai-responses~1-b53c65c2.js +958 -0
- package/dist/models/anthropic-messages.js +20 -5
- package/dist/models/google-generative-ai.js +19 -4
- package/dist/models/openai-completions.js +10 -3
- package/dist/models/openai-responses.js +10 -3
- package/dist/models/rslib-runtime.js +56 -32
- package/dist/page-decision.js +59 -197
- package/dist/page-decision.js.map +1 -0
- package/dist/page-decisions/gpt.js +1 -0
- package/dist/page-decisions/gpt.js.map +1 -0
- package/dist/page-decisions/jev.js +1 -0
- package/dist/page-decisions/jev.js.map +1 -0
- package/dist/page-decisions/shared.js +9 -26
- package/dist/page-decisions/shared.js.map +1 -0
- package/dist/page-diagnostics.js +3 -8
- package/dist/page-diagnostics.js.map +1 -0
- package/dist/page-observation.js +6 -11
- package/dist/page-observation.js.map +1 -0
- package/dist/request.js +41 -169
- package/dist/request.js.map +1 -0
- package/dist/shared/definition.js +1 -0
- package/dist/shared/definition.js.map +1 -0
- package/dist/shared/errors.d.ts +1 -1
- package/dist/shared/errors.js +1 -0
- package/dist/shared/errors.js.map +1 -0
- package/dist/shared/page-protocol.js +1 -0
- package/dist/shared/page-protocol.js.map +1 -0
- package/dist/shared/page-tools.js +1 -0
- package/dist/shared/page-tools.js.map +1 -0
- package/dist/shared/runtime-controller.d.ts +0 -1
- package/dist/shared/runtime-controller.js +1 -0
- package/dist/shared/runtime-controller.js.map +1 -0
- package/dist/shared/runtime-execution.js +1 -0
- package/dist/shared/runtime-execution.js.map +1 -0
- package/dist/shared/schema.js +19 -45
- package/dist/shared/schema.js.map +1 -0
- package/dist/shared/tool-registry.d.ts +6 -0
- package/dist/shared/tool-registry.js +10 -0
- package/dist/shared/tool-registry.js.map +1 -0
- package/dist/tool-catalog.js +25 -23
- package/dist/tool-catalog.js.map +1 -0
- package/dist/tool-result.js +3 -7
- package/dist/tool-result.js.map +1 -0
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -0
- package/package.json +2 -6
- package/dist/models/3.js +0 -5553
- package/dist/models/3e.js +0 -4
- package/dist/models/6.js +0 -506
- package/dist/models/anthropic-messages~1.js +0 -5629
- package/dist/models/deferred-tools.js +0 -28
- package/dist/models/error-body.js +0 -64
- package/dist/models/google-generative-ai~1.js +0 -18305
- package/dist/models/google-generative-ai~1.js.LICENSE.txt +0 -5
- package/dist/models/openai-completions~1.js +0 -987
- package/dist/models/openai-responses~1.js +0 -848
- package/dist/models/v.js +0 -346
|
@@ -1,10 +1,24 @@
|
|
|
1
|
-
import { lazyApi, AgentModelError, flattenModelCatalog, createProtocolModelConfig } from "./
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { lazyApi, AgentModelError, flattenModelCatalog, createProtocolModelConfig } from "./39.js";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const anthropicMessagesApi = () => lazyApi(() => import("./_chunks/anthropic-messages~1-d35e3e7d.js").then(m => m.anthropic_messages_namespaceObject));
|
|
5
|
+
//# sourceMappingURL=anthropic-messages.lazy.js.map
|
|
6
|
+
var anthropic_namespaceObject = /*#__PURE__*/JSON.parse('{"anthropic-messages":{"claude-fable-5":{"id":"claude-fable-5","name":"Claude Fable 5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":10,"output":50,"cacheRead":1,"cacheWrite":12.5},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"xhigh":"xhigh","max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsStrictTools":true}},"claude-haiku-4-5":{"id":"claude-haiku-4-5","name":"Claude Haiku 4.5 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":1,"output":5,"cacheRead":0.1,"cacheWrite":1.25},"contextWindow":200000,"maxTokens":64000,"compat":{"supportsStrictTools":true}},"claude-haiku-4-5-20251001":{"id":"claude-haiku-4-5-20251001","name":"Claude Haiku 4.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":1,"output":5,"cacheRead":0.1,"cacheWrite":1.25},"contextWindow":200000,"maxTokens":64000,"compat":{"supportsStrictTools":true}},"claude-opus-4-5":{"id":"claude-opus-4-5","name":"Claude Opus 4.5 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":200000,"maxTokens":64000,"compat":{"supportsStrictTools":true}},"claude-opus-4-5-20251101":{"id":"claude-opus-4-5-20251101","name":"Claude Opus 4.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":200000,"maxTokens":64000,"compat":{"supportsStrictTools":true}},"claude-opus-4-6":{"id":"claude-opus-4-6","name":"Claude Opus 4.6","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsStrictTools":true}},"claude-opus-4-7":{"id":"claude-opus-4-7","name":"Claude Opus 4.7","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"xhigh":"xhigh","max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsTemperature":false,"supportsStrictTools":true}},"claude-opus-4-8":{"id":"claude-opus-4-8","name":"Claude Opus 4.8","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"xhigh":"xhigh","max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsTemperature":false,"supportsStrictTools":true}},"claude-opus-5":{"id":"claude-opus-5","name":"Claude Opus 5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"xhigh":"xhigh","max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsTemperature":false,"supportsStrictTools":true}},"claude-sonnet-4-5":{"id":"claude-sonnet-4-5","name":"Claude Sonnet 4.5 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":1000000,"maxTokens":64000,"compat":{"supportsStrictTools":true}},"claude-sonnet-4-5-20250929":{"id":"claude-sonnet-4-5-20250929","name":"Claude Sonnet 4.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":1000000,"maxTokens":64000,"compat":{"supportsStrictTools":true}},"claude-sonnet-4-6":{"id":"claude-sonnet-4-6","name":"Claude Sonnet 4.6","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsStrictTools":true}},"claude-sonnet-5":{"id":"claude-sonnet-5","name":"Claude Sonnet 5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":10,"cacheRead":0.2,"cacheWrite":2.5},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"xhigh":"xhigh","max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsStrictTools":true}}}}')
|
|
7
|
+
// This file is auto-generated by scripts/generate-models.ts
|
|
8
|
+
// Do not edit manually - run 'npm run generate-models' to update
|
|
9
|
+
|
|
10
|
+
|
|
4
11
|
const ANTHROPIC_MODELS = flattenModelCatalog("anthropic", anthropic_namespaceObject);
|
|
12
|
+
//# sourceMappingURL=anthropic.models.js.map
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
5
17
|
function createModelConfig(config) {
|
|
6
|
-
const hasAuthorizationHeader = Object.keys(config.headers ?? {}).some((name)=>
|
|
7
|
-
if (hasAuthorizationHeader || config.apiKey?.includes("sk-ant-oat") || Object.values(config.headers ?? {}).some((value)=>"string"
|
|
18
|
+
const hasAuthorizationHeader = Object.keys(config.headers ?? {}).some((name)=>name.toLowerCase() === "authorization");
|
|
19
|
+
if (hasAuthorizationHeader || config.apiKey?.includes("sk-ant-oat") || Object.values(config.headers ?? {}).some((value)=>typeof value === "string" && value.includes("sk-ant-oat"))) {
|
|
20
|
+
throw new AgentModelError("MODEL_CONFIG_INVALID", "Anthropic OAuth tokens and Authorization headers are not supported by the browser model entry.");
|
|
21
|
+
}
|
|
8
22
|
return createProtocolModelConfig({
|
|
9
23
|
provider: "anthropic",
|
|
10
24
|
api: "anthropic-messages",
|
|
@@ -14,4 +28,5 @@ function createModelConfig(config) {
|
|
|
14
28
|
resolveCatalogModel: (model)=>Object.values(ANTHROPIC_MODELS).find(({ id })=>id === model)
|
|
15
29
|
}, config);
|
|
16
30
|
}
|
|
31
|
+
|
|
17
32
|
export { createModelConfig };
|
|
@@ -1,9 +1,23 @@
|
|
|
1
|
-
import { lazyApi, AgentModelError, flattenModelCatalog, createProtocolModelConfig } from "./
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { lazyApi, AgentModelError, flattenModelCatalog, createProtocolModelConfig } from "./39.js";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const googleGenerativeAIApi = () => lazyApi(() => import("./_chunks/google-generative-ai~1-2ba71457.js").then(m => m.google_generative_ai_namespaceObject));
|
|
5
|
+
//# sourceMappingURL=google-generative-ai.lazy.js.map
|
|
6
|
+
var google_namespaceObject = /*#__PURE__*/JSON.parse('{"google-generative-ai":{"deep-research-max-preview-04-2026":{"id":"deep-research-max-preview-04-2026","name":"Deep Research Max Preview (Apr-21-2026)","api":"google-generative-ai","provider":"google","baseUrl":"https://generativelanguage.googleapis.com/v1beta","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":12,"cacheRead":0.2,"cacheWrite":0},"contextWindow":131072,"maxTokens":65536},"deep-research-preview-04-2026":{"id":"deep-research-preview-04-2026","name":"Deep Research Preview (Apr-21-2026)","api":"google-generative-ai","provider":"google","baseUrl":"https://generativelanguage.googleapis.com/v1beta","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":12,"cacheRead":0.2,"cacheWrite":0},"contextWindow":131072,"maxTokens":65536},"gemini-2.0-flash":{"id":"gemini-2.0-flash","name":"Gemini 2.0 Flash","api":"google-generative-ai","provider":"google","baseUrl":"https://generativelanguage.googleapis.com/v1beta","reasoning":false,"input":["text","image"],"cost":{"input":0.1,"output":0.4,"cacheRead":0.025,"cacheWrite":0},"contextWindow":1048576,"maxTokens":8192},"gemini-2.0-flash-lite":{"id":"gemini-2.0-flash-lite","name":"Gemini 2.0 Flash-Lite","api":"google-generative-ai","provider":"google","baseUrl":"https://generativelanguage.googleapis.com/v1beta","reasoning":false,"input":["text","image"],"cost":{"input":0.075,"output":0.3,"cacheRead":0,"cacheWrite":0},"contextWindow":1048576,"maxTokens":8192},"gemini-2.5-computer-use-preview-10-2025":{"id":"gemini-2.5-computer-use-preview-10-2025","name":"Gemini 2.5 Computer Use Preview 10-2025","api":"google-generative-ai","provider":"google","baseUrl":"https://generativelanguage.googleapis.com/v1beta","reasoning":true,"input":["text","image"],"cost":{"input":1.25,"output":10,"cacheRead":0,"cacheWrite":0},"contextWindow":131072,"maxTokens":65536},"gemini-2.5-flash":{"id":"gemini-2.5-flash","name":"Gemini 2.5 Flash","api":"google-generative-ai","provider":"google","baseUrl":"https://generativelanguage.googleapis.com/v1beta","reasoning":true,"input":["text","image"],"cost":{"input":0.3,"output":2.5,"cacheRead":0.03,"cacheWrite":0},"contextWindow":1048576,"maxTokens":65536},"gemini-2.5-flash-lite":{"id":"gemini-2.5-flash-lite","name":"Gemini 2.5 Flash-Lite","api":"google-generative-ai","provider":"google","baseUrl":"https://generativelanguage.googleapis.com/v1beta","reasoning":true,"input":["text","image"],"cost":{"input":0.1,"output":0.4,"cacheRead":0.01,"cacheWrite":0},"contextWindow":1048576,"maxTokens":65536},"gemini-2.5-pro":{"id":"gemini-2.5-pro","name":"Gemini 2.5 Pro","api":"google-generative-ai","provider":"google","baseUrl":"https://generativelanguage.googleapis.com/v1beta","reasoning":true,"input":["text","image"],"cost":{"input":1.25,"output":10,"cacheRead":0.125,"cacheWrite":0},"contextWindow":1048576,"maxTokens":65536},"gemini-3-flash-preview":{"id":"gemini-3-flash-preview","name":"Gemini 3 Flash Preview","api":"google-generative-ai","provider":"google","baseUrl":"https://generativelanguage.googleapis.com/v1beta","reasoning":true,"input":["text","image"],"cost":{"input":0.5,"output":3,"cacheRead":0.05,"cacheWrite":0},"contextWindow":1048576,"maxTokens":65536,"thinkingLevelMap":{"off":null}},"gemini-3-pro-preview":{"id":"gemini-3-pro-preview","name":"Gemini 3 Pro Preview","api":"google-generative-ai","provider":"google","baseUrl":"https://generativelanguage.googleapis.com/v1beta","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":12,"cacheRead":0.2,"cacheWrite":0},"contextWindow":1048576,"maxTokens":65536,"thinkingLevelMap":{"off":null,"minimal":null,"low":"LOW","medium":null,"high":"HIGH"}},"gemini-3.1-flash-lite":{"id":"gemini-3.1-flash-lite","name":"Gemini 3.1 Flash Lite","api":"google-generative-ai","provider":"google","baseUrl":"https://generativelanguage.googleapis.com/v1beta","reasoning":true,"input":["text","image"],"cost":{"input":0.25,"output":1.5,"cacheRead":0.025,"cacheWrite":0},"contextWindow":1048576,"maxTokens":65536,"thinkingLevelMap":{"off":null}},"gemini-3.1-flash-lite-image":{"id":"gemini-3.1-flash-lite-image","name":"Nano Banana 2 Lite","api":"google-generative-ai","provider":"google","baseUrl":"https://generativelanguage.googleapis.com/v1beta","reasoning":true,"input":["text","image"],"cost":{"input":0.25,"output":30,"cacheRead":0,"cacheWrite":0},"contextWindow":65536,"maxTokens":65536,"thinkingLevelMap":{"off":null}},"gemini-3.1-flash-lite-preview":{"id":"gemini-3.1-flash-lite-preview","name":"Gemini 3.1 Flash Lite Preview","api":"google-generative-ai","provider":"google","baseUrl":"https://generativelanguage.googleapis.com/v1beta","reasoning":true,"input":["text","image"],"cost":{"input":0.25,"output":1.5,"cacheRead":0.025,"cacheWrite":0},"contextWindow":1048576,"maxTokens":65536,"thinkingLevelMap":{"off":null}},"gemini-3.1-flash-live-preview":{"id":"gemini-3.1-flash-live-preview","name":"Gemini 3.1 Flash Live Preview","api":"google-generative-ai","provider":"google","baseUrl":"https://generativelanguage.googleapis.com/v1beta","reasoning":true,"input":["text","image"],"cost":{"input":0.75,"output":4.5,"cacheRead":0,"cacheWrite":0},"contextWindow":131072,"maxTokens":65536,"thinkingLevelMap":{"off":null}},"gemini-3.1-pro-preview":{"id":"gemini-3.1-pro-preview","name":"Gemini 3.1 Pro Preview","api":"google-generative-ai","provider":"google","baseUrl":"https://generativelanguage.googleapis.com/v1beta","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":12,"cacheRead":0.2,"cacheWrite":0},"contextWindow":1048576,"maxTokens":65536,"thinkingLevelMap":{"off":null,"minimal":null,"low":"LOW","medium":null,"high":"HIGH"}},"gemini-3.1-pro-preview-customtools":{"id":"gemini-3.1-pro-preview-customtools","name":"Gemini 3.1 Pro Preview Custom Tools","api":"google-generative-ai","provider":"google","baseUrl":"https://generativelanguage.googleapis.com/v1beta","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":12,"cacheRead":0.2,"cacheWrite":0},"contextWindow":1048576,"maxTokens":65536,"thinkingLevelMap":{"off":null,"minimal":null,"low":"LOW","medium":null,"high":"HIGH"}},"gemini-3.5-flash":{"id":"gemini-3.5-flash","name":"Gemini 3.5 Flash","api":"google-generative-ai","provider":"google","baseUrl":"https://generativelanguage.googleapis.com/v1beta","reasoning":true,"input":["text","image"],"cost":{"input":1.5,"output":9,"cacheRead":0.15,"cacheWrite":0},"contextWindow":1048576,"maxTokens":65536,"thinkingLevelMap":{"off":null}},"gemini-3.5-flash-lite":{"id":"gemini-3.5-flash-lite","name":"Gemini 3.5 Flash Lite","api":"google-generative-ai","provider":"google","baseUrl":"https://generativelanguage.googleapis.com/v1beta","reasoning":true,"input":["text","image"],"cost":{"input":0.3,"output":2.5,"cacheRead":0.03,"cacheWrite":0},"contextWindow":1048576,"maxTokens":65536,"thinkingLevelMap":{"off":null}},"gemini-3.6-flash":{"id":"gemini-3.6-flash","name":"Gemini 3.6 Flash","api":"google-generative-ai","provider":"google","baseUrl":"https://generativelanguage.googleapis.com/v1beta","reasoning":true,"input":["text","image"],"cost":{"input":1.5,"output":7.5,"cacheRead":0.15,"cacheWrite":0},"contextWindow":1048576,"maxTokens":65536,"thinkingLevelMap":{"off":null}},"gemini-flash-latest":{"id":"gemini-flash-latest","name":"Gemini Flash Latest","api":"google-generative-ai","provider":"google","baseUrl":"https://generativelanguage.googleapis.com/v1beta","reasoning":true,"input":["text","image"],"cost":{"input":1.5,"output":9,"cacheRead":0.15,"cacheWrite":0},"contextWindow":1048576,"maxTokens":65536,"thinkingLevelMap":{"off":null}},"gemini-flash-lite-latest":{"id":"gemini-flash-lite-latest","name":"Gemini Flash-Lite Latest","api":"google-generative-ai","provider":"google","baseUrl":"https://generativelanguage.googleapis.com/v1beta","reasoning":true,"input":["text","image"],"cost":{"input":0.25,"output":1.5,"cacheRead":0.025,"cacheWrite":0},"contextWindow":1048576,"maxTokens":65536,"thinkingLevelMap":{"off":null}},"gemini-robotics-er-1.6-preview":{"id":"gemini-robotics-er-1.6-preview","name":"Gemini Robotics-ER 1.6 Preview","api":"google-generative-ai","provider":"google","baseUrl":"https://generativelanguage.googleapis.com/v1beta","reasoning":true,"input":["text","image"],"cost":{"input":1,"output":5,"cacheRead":0,"cacheWrite":0},"contextWindow":131072,"maxTokens":65536},"gemma-4-26b-a4b-it":{"id":"gemma-4-26b-a4b-it","name":"Gemma 4 26B A4B IT","api":"google-generative-ai","provider":"google","baseUrl":"https://generativelanguage.googleapis.com/v1beta","reasoning":true,"input":["text","image"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"contextWindow":262144,"maxTokens":32768,"thinkingLevelMap":{"off":null,"minimal":"MINIMAL","low":null,"medium":null,"high":"HIGH"}},"gemma-4-31b-it":{"id":"gemma-4-31b-it","name":"Gemma 4 31B IT","api":"google-generative-ai","provider":"google","baseUrl":"https://generativelanguage.googleapis.com/v1beta","reasoning":true,"input":["text","image"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"contextWindow":262144,"maxTokens":32768,"thinkingLevelMap":{"off":null,"minimal":"MINIMAL","low":null,"medium":null,"high":"HIGH"}}}}')
|
|
7
|
+
// This file is auto-generated by scripts/generate-models.ts
|
|
8
|
+
// Do not edit manually - run 'npm run generate-models' to update
|
|
9
|
+
|
|
10
|
+
|
|
4
11
|
const GOOGLE_MODELS = flattenModelCatalog("google", google_namespaceObject);
|
|
12
|
+
//# sourceMappingURL=google.models.js.map
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
5
17
|
function createModelConfig(config) {
|
|
6
|
-
if (
|
|
18
|
+
if (config.timeoutMs !== undefined) {
|
|
19
|
+
throw new AgentModelError("MODEL_CONFIG_INVALID", "timeoutMs is not supported by the Google Generative AI model entry.");
|
|
20
|
+
}
|
|
7
21
|
return createProtocolModelConfig({
|
|
8
22
|
provider: "google",
|
|
9
23
|
api: "google-generative-ai",
|
|
@@ -14,4 +28,5 @@ function createModelConfig(config) {
|
|
|
14
28
|
resolveCatalogModel: (model)=>Object.values(GOOGLE_MODELS).find(({ id })=>id === model)
|
|
15
29
|
}, config);
|
|
16
30
|
}
|
|
31
|
+
|
|
17
32
|
export { createModelConfig };
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import { lazyApi, createProtocolModelConfig } from "./
|
|
2
|
-
import { OPENAI_MODELS } from "./
|
|
3
|
-
|
|
1
|
+
import { lazyApi, createProtocolModelConfig } from "./39.js";
|
|
2
|
+
import { OPENAI_MODELS } from "./851.js";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
const openAICompletionsApi = () => lazyApi(() => import("./_chunks/openai-completions~1-b340f0e0.js"));
|
|
6
|
+
//# sourceMappingURL=openai-completions.lazy.js.map
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
4
10
|
function createModelConfig(config) {
|
|
5
11
|
return createProtocolModelConfig({
|
|
6
12
|
provider: "openai-compatible",
|
|
@@ -9,4 +15,5 @@ function createModelConfig(config) {
|
|
|
9
15
|
resolveCatalogModel: (model)=>Object.values(OPENAI_MODELS).find(({ id })=>id === model)
|
|
10
16
|
}, config);
|
|
11
17
|
}
|
|
18
|
+
|
|
12
19
|
export { createModelConfig };
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import { lazyApi, createProtocolModelConfig } from "./
|
|
2
|
-
import { OPENAI_MODELS } from "./
|
|
3
|
-
|
|
1
|
+
import { lazyApi, createProtocolModelConfig } from "./39.js";
|
|
2
|
+
import { OPENAI_MODELS } from "./851.js";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
const openAIResponsesApi = () => lazyApi(() => import("./_chunks/openai-responses~1-b53c65c2.js").then(m => m.openai_responses_namespaceObject));
|
|
6
|
+
//# sourceMappingURL=openai-responses.lazy.js.map
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
4
10
|
function createModelConfig(config) {
|
|
5
11
|
return createProtocolModelConfig({
|
|
6
12
|
provider: "openai-compatible",
|
|
@@ -9,4 +15,5 @@ function createModelConfig(config) {
|
|
|
9
15
|
resolveCatalogModel: (model)=>Object.values(OPENAI_MODELS).find(({ id })=>id === model)
|
|
10
16
|
}, config);
|
|
11
17
|
}
|
|
18
|
+
|
|
12
19
|
export { createModelConfig };
|
|
@@ -1,35 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
|
|
2
|
+
var __webpack_modules__ = {};
|
|
3
|
+
// The module cache
|
|
4
|
+
var __webpack_module_cache__ = {};
|
|
5
|
+
// The require function
|
|
6
|
+
function __webpack_require__(moduleId) {
|
|
7
|
+
// Check if module is in cache
|
|
8
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
9
|
+
if (cachedModule !== undefined) {
|
|
10
|
+
return cachedModule.exports;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
12
|
+
// Create a new module (and put it into the cache)
|
|
13
|
+
var module = (__webpack_module_cache__[moduleId] = {
|
|
14
|
+
exports: {}
|
|
15
|
+
});
|
|
16
|
+
// Execute the module function
|
|
17
|
+
__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
18
|
+
|
|
19
|
+
// Return the exports of the module
|
|
20
|
+
return module.exports;
|
|
21
|
+
}
|
|
22
|
+
// expose the modules object (__webpack_modules__)
|
|
23
|
+
__webpack_require__.m = __webpack_modules__;
|
|
24
|
+
|
|
25
|
+
// webpack/runtime/define_property_getters
|
|
26
|
+
(() => {
|
|
27
|
+
__webpack_require__.d = (exports, getters, values) => {
|
|
28
|
+
var define = (defs, kind) => {
|
|
29
|
+
for(var key in defs) {
|
|
30
|
+
if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
|
|
31
|
+
Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
define(getters, "get");
|
|
36
|
+
define(values, "value");
|
|
25
37
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
38
|
+
})();
|
|
39
|
+
// webpack/runtime/esm_register_module
|
|
40
|
+
(() => {
|
|
41
|
+
__webpack_require__.add = function registerModules(modules) { Object.assign(__webpack_require__.m, modules) }
|
|
42
|
+
|
|
43
|
+
})();
|
|
44
|
+
// webpack/runtime/has_own_property
|
|
45
|
+
(() => {
|
|
46
|
+
__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
47
|
+
})();
|
|
48
|
+
// webpack/runtime/make_namespace_object
|
|
49
|
+
(() => {
|
|
50
|
+
// define __esModule on exports
|
|
51
|
+
__webpack_require__.r = (exports) => {
|
|
52
|
+
if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
53
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
54
|
+
}
|
|
55
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
34
56
|
};
|
|
35
|
-
|
|
57
|
+
})();
|
|
58
|
+
|
|
59
|
+
export { __webpack_require__ };
|
package/dist/page-decision.js
CHANGED
|
@@ -3,50 +3,23 @@ export function readPageDecisionUsage(value) {
|
|
|
3
3
|
return;
|
|
4
4
|
const raw = value;
|
|
5
5
|
const usage = {};
|
|
6
|
-
for (const [key, source] of [
|
|
7
|
-
["inputTokens", raw.input_tokens ?? raw.prompt_tokens],
|
|
8
|
-
["outputTokens", raw.output_tokens ?? raw.completion_tokens],
|
|
9
|
-
]) {
|
|
6
|
+
for (const [key, source] of [["inputTokens", raw.input_tokens ?? raw.prompt_tokens], ["outputTokens", raw.output_tokens ?? raw.completion_tokens]]) {
|
|
10
7
|
if (typeof source === "number" && Number.isSafeInteger(source) && source >= 0)
|
|
11
8
|
usage[key] = source;
|
|
12
9
|
}
|
|
13
10
|
return Object.keys(usage).length ? usage : undefined;
|
|
14
11
|
}
|
|
15
|
-
const OPERATIONS = new Set([
|
|
16
|
-
"click",
|
|
17
|
-
"fill",
|
|
18
|
-
"check",
|
|
19
|
-
"uncheck",
|
|
20
|
-
"select",
|
|
21
|
-
"scrollUp",
|
|
22
|
-
"scrollDown",
|
|
23
|
-
"wait",
|
|
24
|
-
]);
|
|
12
|
+
const OPERATIONS = new Set(["click", "fill", "check", "uncheck", "select", "scrollUp", "scrollDown", "wait"]);
|
|
25
13
|
export function validatePageDecisionObservation(value) {
|
|
26
14
|
const page = value;
|
|
27
|
-
if (!page ||
|
|
28
|
-
typeof page !== "
|
|
29
|
-
typeof page.
|
|
30
|
-
!page.snapshotId ||
|
|
31
|
-
typeof page.url !== "string" ||
|
|
32
|
-
typeof page.title !== "string" ||
|
|
33
|
-
typeof page.content !== "string" ||
|
|
34
|
-
typeof page.truncated !== "boolean" ||
|
|
35
|
-
!Array.isArray(page.actions) ||
|
|
36
|
-
page.actions.length > 250 ||
|
|
37
|
-
page.content.length > 100_000)
|
|
15
|
+
if (!page || typeof page !== "object" || typeof page.snapshotId !== "string" || !page.snapshotId
|
|
16
|
+
|| typeof page.url !== "string" || typeof page.title !== "string" || typeof page.content !== "string"
|
|
17
|
+
|| typeof page.truncated !== "boolean" || !Array.isArray(page.actions) || page.actions.length > 250 || page.content.length > 100_000)
|
|
38
18
|
throw new Error("Invalid actions observation.");
|
|
39
19
|
const ids = new Set();
|
|
40
20
|
for (const action of page.actions) {
|
|
41
|
-
if (!action ||
|
|
42
|
-
typeof action.
|
|
43
|
-
!action.id ||
|
|
44
|
-
ids.has(action.id) ||
|
|
45
|
-
!OPERATIONS.has(action.operation) ||
|
|
46
|
-
typeof action.label !== "string" ||
|
|
47
|
-
typeof action.role !== "string" ||
|
|
48
|
-
!action.state ||
|
|
49
|
-
typeof action.state !== "object")
|
|
21
|
+
if (!action || typeof action.id !== "string" || !action.id || ids.has(action.id) || !OPERATIONS.has(action.operation)
|
|
22
|
+
|| typeof action.label !== "string" || typeof action.role !== "string" || !action.state || typeof action.state !== "object")
|
|
50
23
|
throw new Error("Invalid action candidate.");
|
|
51
24
|
ids.add(action.id);
|
|
52
25
|
}
|
|
@@ -68,29 +41,15 @@ export function validatePageDecisionResult(value, observation) {
|
|
|
68
41
|
const result = value;
|
|
69
42
|
if (!result || typeof result !== "object" || Array.isArray(result))
|
|
70
43
|
throw new Error("Invalid page decision result.");
|
|
71
|
-
if (result.usage !== undefined &&
|
|
72
|
-
(
|
|
73
|
-
typeof result.usage !== "object" ||
|
|
74
|
-
Array.isArray(result.usage) ||
|
|
75
|
-
Object.entries(result.usage).some(([key, value]) => !["inputTokens", "outputTokens"].includes(key) ||
|
|
76
|
-
typeof value !== "number" ||
|
|
77
|
-
!Number.isSafeInteger(value) ||
|
|
78
|
-
value < 0)))
|
|
44
|
+
if (result.usage !== undefined && (!result.usage || typeof result.usage !== "object" || Array.isArray(result.usage)
|
|
45
|
+
|| Object.entries(result.usage).some(([key, value]) => !["inputTokens", "outputTokens"].includes(key) || typeof value !== "number" || !Number.isSafeInteger(value) || value < 0)))
|
|
79
46
|
throw new Error("Invalid page decision usage.");
|
|
80
47
|
if (result.status === "done" || result.status === "blocked") {
|
|
81
48
|
if ("actionId" in result)
|
|
82
49
|
throw new Error("Invalid page decision result.");
|
|
83
|
-
if (result.status === "blocked" &&
|
|
84
|
-
result.reason !== undefined &&
|
|
85
|
-
(typeof result.reason !== "string" || result.reason.length > 2000))
|
|
50
|
+
if (result.status === "blocked" && result.reason !== undefined && (typeof result.reason !== "string" || result.reason.length > 2000))
|
|
86
51
|
throw new Error("Invalid page decision reason.");
|
|
87
|
-
return {
|
|
88
|
-
status: result.status,
|
|
89
|
-
usage: result.usage,
|
|
90
|
-
...(result.status === "blocked" && result.reason !== undefined
|
|
91
|
-
? { reason: result.reason }
|
|
92
|
-
: {}),
|
|
93
|
-
};
|
|
52
|
+
return { status: result.status, usage: result.usage, ...(result.status === "blocked" && result.reason !== undefined ? { reason: result.reason } : {}) };
|
|
94
53
|
}
|
|
95
54
|
if (result.status !== "action" || typeof result.actionId !== "string")
|
|
96
55
|
throw new Error("Invalid page decision result.");
|
|
@@ -101,23 +60,12 @@ export function validatePageDecisionResult(value, observation) {
|
|
|
101
60
|
}
|
|
102
61
|
export function validatePageTask(value) {
|
|
103
62
|
const task = value;
|
|
104
|
-
const validStage = (stage, maxLength) => stage &&
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
stage.goal.length <= maxLength;
|
|
111
|
-
if (!task ||
|
|
112
|
-
typeof task !== "object" ||
|
|
113
|
-
Array.isArray(task) ||
|
|
114
|
-
Object.keys(task).some((key) => !["goal", "stages"].includes(key)) ||
|
|
115
|
-
!validStage({ goal: task.goal }, 8000) ||
|
|
116
|
-
(task.stages !== undefined &&
|
|
117
|
-
(!Array.isArray(task.stages) ||
|
|
118
|
-
task.stages.length < 1 ||
|
|
119
|
-
task.stages.length > 8 ||
|
|
120
|
-
!task.stages.every((stage) => validStage(stage, 2000))))) {
|
|
63
|
+
const validStage = (stage, maxLength) => stage && typeof stage === "object" && !Array.isArray(stage)
|
|
64
|
+
&& Object.keys(stage).every((key) => key === "goal")
|
|
65
|
+
&& typeof stage.goal === "string" && stage.goal.trim() && stage.goal.length <= maxLength;
|
|
66
|
+
if (!task || typeof task !== "object" || Array.isArray(task) || Object.keys(task).some((key) => !["goal", "stages"].includes(key))
|
|
67
|
+
|| !validStage({ goal: task.goal }, 8000)
|
|
68
|
+
|| (task.stages !== undefined && (!Array.isArray(task.stages) || task.stages.length < 1 || task.stages.length > 8 || !task.stages.every((stage) => validStage(stage, 2000))))) {
|
|
121
69
|
throw new Error("Invalid page task state.");
|
|
122
70
|
}
|
|
123
71
|
return { goal: task.goal, ...(task.stages ? { stages: structuredClone(task.stages) } : {}) };
|
|
@@ -125,134 +73,48 @@ export function validatePageTask(value) {
|
|
|
125
73
|
export function validatePageProgress(value) {
|
|
126
74
|
const progress = value;
|
|
127
75
|
const stageCount = progress?.stages?.length ?? 1;
|
|
128
|
-
const validCompletedStages = progress?.completedStages === undefined ||
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
(
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
"toUrl",
|
|
168
|
-
"text",
|
|
169
|
-
"completedActions",
|
|
170
|
-
"errorCode",
|
|
171
|
-
].includes(key)) &&
|
|
172
|
-
typeof action.operation === "string" &&
|
|
173
|
-
action.operation.length <= 100 &&
|
|
174
|
-
typeof action.label === "string" &&
|
|
175
|
-
action.label.length <= 200 &&
|
|
176
|
-
["executed", "partial", "failed", "unknown"].includes(action.outcome) &&
|
|
177
|
-
Number.isInteger(action.completedActions) &&
|
|
178
|
-
action.completedActions >= 0 &&
|
|
179
|
-
action.completedActions <= 30 &&
|
|
180
|
-
(action.text === undefined ||
|
|
181
|
-
(typeof action.text === "string" && action.text.length <= 200)) &&
|
|
182
|
-
(action.errorCode === undefined ||
|
|
183
|
-
(typeof action.errorCode === "string" && action.errorCode.length <= 100)) &&
|
|
184
|
-
[action.fromUrl, action.toUrl].every((url) => url === undefined || (typeof url === "string" && url.length <= 2000))));
|
|
185
|
-
if (!progress ||
|
|
186
|
-
Object.keys(progress).some((key) => ![
|
|
187
|
-
"goal",
|
|
188
|
-
"stages",
|
|
189
|
-
"stageIndex",
|
|
190
|
-
"completedStages",
|
|
191
|
-
"stage",
|
|
192
|
-
"recentActions",
|
|
193
|
-
"blockedRecheckUsed",
|
|
194
|
-
"actionHistory",
|
|
195
|
-
"actionHistoryTruncated",
|
|
196
|
-
"transitions",
|
|
197
|
-
].includes(key)) ||
|
|
198
|
-
!Number.isInteger(progress.stageIndex ?? 0) ||
|
|
199
|
-
(progress.stageIndex ?? 0) < 0 ||
|
|
200
|
-
(progress.stageIndex ?? 0) >= stageCount ||
|
|
201
|
-
!validCompletedStages ||
|
|
202
|
-
(progress.completedStages?.length ?? 0) !== (progress.stageIndex ?? 0) ||
|
|
203
|
-
(progress.blockedRecheckUsed !== undefined &&
|
|
204
|
-
typeof progress.blockedRecheckUsed !== "boolean") ||
|
|
205
|
-
(progress.actionHistoryTruncated !== undefined &&
|
|
206
|
-
typeof progress.actionHistoryTruncated !== "boolean") ||
|
|
207
|
-
!["observe", "decide"].includes(progress.stage) ||
|
|
208
|
-
!Array.isArray(progress.recentActions) ||
|
|
209
|
-
progress.recentActions.length > 6 ||
|
|
210
|
-
!validHistory ||
|
|
211
|
-
!validTransitions ||
|
|
212
|
-
progress.recentActions.some((action) => !action ||
|
|
213
|
-
Object.keys(action).some((key) => ![
|
|
214
|
-
"actionId",
|
|
215
|
-
"operation",
|
|
216
|
-
"label",
|
|
217
|
-
"text",
|
|
218
|
-
"outcome",
|
|
219
|
-
"fromUrl",
|
|
220
|
-
"toUrl",
|
|
221
|
-
"observationChanged",
|
|
222
|
-
].includes(key)) ||
|
|
223
|
-
[action.actionId, action.operation, action.label].some((v) => typeof v !== "string" || v.length > 2000) ||
|
|
224
|
-
(action.text !== undefined &&
|
|
225
|
-
(typeof action.text !== "string" || action.text.length > 2000)) ||
|
|
226
|
-
(action.observationChanged !== undefined &&
|
|
227
|
-
typeof action.observationChanged !== "boolean") ||
|
|
228
|
-
[action.fromUrl, action.toUrl].some((url) => url !== undefined && (typeof url !== "string" || url.length > 16000)) ||
|
|
229
|
-
!["executed", "failed", "unknown"].includes(action.outcome)))
|
|
76
|
+
const validCompletedStages = progress?.completedStages === undefined || (Array.isArray(progress.completedStages)
|
|
77
|
+
&& progress.completedStages.length <= 8
|
|
78
|
+
&& progress.completedStages.every((item, index) => item && typeof item === "object" && !Array.isArray(item)
|
|
79
|
+
&& Object.keys(item).every((key) => ["stageIndex", "lastObservedUrl", "lastObservedPage"].includes(key))
|
|
80
|
+
&& item.stageIndex === index && item.stageIndex < stageCount
|
|
81
|
+
&& typeof item.lastObservedUrl === "string" && item.lastObservedUrl.length <= 2000
|
|
82
|
+
&& item.lastObservedPage && typeof item.lastObservedPage === "object" && !Array.isArray(item.lastObservedPage)
|
|
83
|
+
&& Object.keys(item.lastObservedPage).every((key) => ["url", "title", "content", "truncated"].includes(key))
|
|
84
|
+
&& typeof item.lastObservedPage.url === "string" && item.lastObservedPage.url.length <= 2000
|
|
85
|
+
&& typeof item.lastObservedPage.title === "string" && item.lastObservedPage.title.length <= 2000
|
|
86
|
+
&& typeof item.lastObservedPage.content === "string" && item.lastObservedPage.content.length <= 2000
|
|
87
|
+
&& typeof item.lastObservedPage.truncated === "boolean"));
|
|
88
|
+
const validTransitions = progress?.transitions === undefined || (Array.isArray(progress.transitions)
|
|
89
|
+
&& progress.transitions.length <= 24 && progress.transitions.every((transition) => transition
|
|
90
|
+
&& Object.keys(transition).length === 4 && ["from", "to", "operation", "label"].every((key) => typeof transition[key] === "string" && transition[key].length <= 200)));
|
|
91
|
+
const validHistory = progress?.actionHistory === undefined || (Array.isArray(progress.actionHistory)
|
|
92
|
+
&& progress.actionHistory.length <= 64
|
|
93
|
+
&& progress.actionHistory.every((action) => action && typeof action === "object"
|
|
94
|
+
&& Object.keys(action).every((key) => ["operation", "label", "outcome", "fromUrl", "toUrl", "text", "completedActions", "errorCode"].includes(key))
|
|
95
|
+
&& typeof action.operation === "string" && action.operation.length <= 100
|
|
96
|
+
&& typeof action.label === "string" && action.label.length <= 200
|
|
97
|
+
&& ["executed", "partial", "failed", "unknown"].includes(action.outcome)
|
|
98
|
+
&& Number.isInteger(action.completedActions) && action.completedActions >= 0 && action.completedActions <= 30
|
|
99
|
+
&& (action.text === undefined || (typeof action.text === "string" && action.text.length <= 200))
|
|
100
|
+
&& (action.errorCode === undefined || (typeof action.errorCode === "string" && action.errorCode.length <= 100))
|
|
101
|
+
&& [action.fromUrl, action.toUrl].every((url) => url === undefined || (typeof url === "string" && url.length <= 2000))));
|
|
102
|
+
if (!progress || Object.keys(progress).some((key) => !["goal", "stages", "stageIndex", "completedStages", "stage", "recentActions", "blockedRecheckUsed", "actionHistory", "actionHistoryTruncated", "transitions"].includes(key))
|
|
103
|
+
|| !Number.isInteger(progress.stageIndex ?? 0) || (progress.stageIndex ?? 0) < 0 || (progress.stageIndex ?? 0) >= stageCount
|
|
104
|
+
|| !validCompletedStages || (progress.completedStages?.length ?? 0) !== (progress.stageIndex ?? 0)
|
|
105
|
+
|| (progress.blockedRecheckUsed !== undefined && typeof progress.blockedRecheckUsed !== "boolean")
|
|
106
|
+
|| (progress.actionHistoryTruncated !== undefined && typeof progress.actionHistoryTruncated !== "boolean")
|
|
107
|
+
|| !["observe", "decide"].includes(progress.stage) || !Array.isArray(progress.recentActions) || progress.recentActions.length > 6
|
|
108
|
+
|| !validHistory || !validTransitions
|
|
109
|
+
|| progress.recentActions.some((action) => !action || Object.keys(action).some((key) => !["actionId", "operation", "label", "text", "outcome", "fromUrl", "toUrl", "observationChanged"].includes(key))
|
|
110
|
+
|| [action.actionId, action.operation, action.label].some((v) => typeof v !== "string" || v.length > 2000)
|
|
111
|
+
|| (action.text !== undefined && (typeof action.text !== "string" || action.text.length > 2000))
|
|
112
|
+
|| (action.observationChanged !== undefined && typeof action.observationChanged !== "boolean")
|
|
113
|
+
|| [action.fromUrl, action.toUrl].some((url) => url !== undefined && (typeof url !== "string" || url.length > 16000))
|
|
114
|
+
|| !["executed", "failed", "unknown"].includes(action.outcome)))
|
|
230
115
|
throw new Error("Invalid page progress.");
|
|
231
|
-
if (progress.recentActions.some((action) => action.outcome === "unknown") ||
|
|
232
|
-
progress.actionHistory?.some((action) => action.outcome === "unknown"))
|
|
116
|
+
if (progress.recentActions.some((action) => action.outcome === "unknown") || progress.actionHistory?.some((action) => action.outcome === "unknown"))
|
|
233
117
|
throw new Error("Cannot resume an unknown page outcome.");
|
|
234
|
-
return {
|
|
235
|
-
...validatePageTask({
|
|
236
|
-
goal: progress.goal,
|
|
237
|
-
...(progress.stages ? { stages: progress.stages } : {}),
|
|
238
|
-
}),
|
|
239
|
-
stage: progress.stage,
|
|
240
|
-
...(progress.stageIndex === undefined ? {} : { stageIndex: progress.stageIndex }),
|
|
241
|
-
...(progress.completedStages === undefined
|
|
242
|
-
? {}
|
|
243
|
-
: { completedStages: structuredClone(progress.completedStages) }),
|
|
244
|
-
...(progress.blockedRecheckUsed === undefined
|
|
245
|
-
? {}
|
|
246
|
-
: { blockedRecheckUsed: progress.blockedRecheckUsed }),
|
|
247
|
-
recentActions: structuredClone(progress.recentActions),
|
|
248
|
-
...(progress.actionHistory === undefined
|
|
249
|
-
? {}
|
|
250
|
-
: { actionHistory: structuredClone(progress.actionHistory) }),
|
|
251
|
-
...(progress.actionHistoryTruncated === undefined
|
|
252
|
-
? {}
|
|
253
|
-
: { actionHistoryTruncated: progress.actionHistoryTruncated }),
|
|
254
|
-
...(progress.transitions === undefined
|
|
255
|
-
? {}
|
|
256
|
-
: { transitions: structuredClone(progress.transitions) }),
|
|
257
|
-
};
|
|
118
|
+
return { ...validatePageTask({ goal: progress.goal, ...(progress.stages ? { stages: progress.stages } : {}) }), stage: progress.stage, ...(progress.stageIndex === undefined ? {} : { stageIndex: progress.stageIndex }), ...(progress.completedStages === undefined ? {} : { completedStages: structuredClone(progress.completedStages) }), ...(progress.blockedRecheckUsed === undefined ? {} : { blockedRecheckUsed: progress.blockedRecheckUsed }), recentActions: structuredClone(progress.recentActions), ...(progress.actionHistory === undefined ? {} : { actionHistory: structuredClone(progress.actionHistory) }), ...(progress.actionHistoryTruncated === undefined ? {} : { actionHistoryTruncated: progress.actionHistoryTruncated }), ...(progress.transitions === undefined ? {} : { transitions: structuredClone(progress.transitions) }) };
|
|
258
119
|
}
|
|
120
|
+
//# sourceMappingURL=page-decision.js.map
|