@midscene/core 1.16.2 → 1.16.6-beta-20261023073257.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/es/agent/agent.mjs +11 -11
- package/dist/es/agent/agent.mjs.map +1 -1
- package/dist/es/agent/insight.mjs.map +1 -1
- package/dist/es/agent/tasks.mjs +72 -39
- package/dist/es/agent/tasks.mjs.map +1 -1
- package/dist/es/agent/utils.mjs +1 -1
- package/dist/es/ai-model/connectivity/run-connectivity-test.mjs +27 -22
- package/dist/es/ai-model/connectivity/run-connectivity-test.mjs.map +1 -1
- package/dist/es/ai-model/index.mjs +4 -2
- package/dist/es/ai-model/model-adapter/resolve.mjs +4 -2
- package/dist/es/ai-model/model-adapter/resolve.mjs.map +1 -1
- package/dist/es/ai-model/models/jev/adapter.mjs +6 -110
- package/dist/es/ai-model/models/jev/adapter.mjs.map +1 -1
- package/dist/es/ai-model/models/jev/boolean.mjs +48 -0
- package/dist/es/ai-model/models/jev/boolean.mjs.map +1 -0
- package/dist/es/ai-model/models/jev/image.mjs +39 -36
- package/dist/es/ai-model/models/jev/image.mjs.map +1 -1
- package/dist/es/ai-model/models/jev/locate.mjs +48 -0
- package/dist/es/ai-model/models/jev/locate.mjs.map +1 -0
- package/dist/es/ai-model/models/jev/planning-action.mjs +35 -0
- package/dist/es/ai-model/models/jev/planning-action.mjs.map +1 -0
- package/dist/es/ai-model/models/jev/planning-context.mjs +38 -0
- package/dist/es/ai-model/models/jev/planning-context.mjs.map +1 -0
- package/dist/es/ai-model/models/jev/planning-decision.mjs +68 -0
- package/dist/es/ai-model/models/jev/planning-decision.mjs.map +1 -0
- package/dist/es/ai-model/models/jev/planning.mjs +19 -131
- package/dist/es/ai-model/models/jev/planning.mjs.map +1 -1
- package/dist/es/ai-model/models/model-fallback.mjs +28 -0
- package/dist/es/ai-model/models/model-fallback.mjs.map +1 -0
- package/dist/es/ai-model/service-caller/call-ai.mjs +54 -27
- package/dist/es/ai-model/service-caller/call-ai.mjs.map +1 -1
- package/dist/es/ai-model/service-caller/codex/call-codex.mjs.map +1 -1
- package/dist/es/ai-model/service-caller/index.mjs +2 -2
- package/dist/es/ai-model/service-caller/model-call.mjs +3 -3
- package/dist/es/ai-model/service-caller/model-call.mjs.map +1 -1
- package/dist/es/ai-model/service-caller/openai/call-openai.mjs +4 -2
- package/dist/es/ai-model/service-caller/openai/call-openai.mjs.map +1 -1
- package/dist/es/ai-model/service-caller/openai/chat-completion/chat-completion.mjs.map +1 -1
- package/dist/es/ai-model/service-caller/openai/openai-client.mjs.map +1 -1
- package/dist/es/ai-model/service-caller/openai/responses/responses.mjs.map +1 -1
- package/dist/es/ai-model/service-caller/openai/siwc/authorization.mjs +117 -0
- package/dist/es/ai-model/service-caller/openai/siwc/authorization.mjs.map +1 -0
- package/dist/es/ai-model/service-caller/openai/siwc/credential-storage.mjs +66 -0
- package/dist/es/ai-model/service-caller/openai/siwc/credential-storage.mjs.map +1 -0
- package/dist/es/ai-model/service-caller/openai/siwc/errors.mjs +42 -0
- package/dist/es/ai-model/service-caller/openai/siwc/errors.mjs.map +1 -0
- package/dist/es/ai-model/service-caller/openai/siwc/index.mjs +7 -0
- package/dist/es/ai-model/service-caller/openai/siwc/prepare-call.mjs +33 -0
- package/dist/es/ai-model/service-caller/openai/siwc/prepare-call.mjs.map +1 -0
- package/dist/es/ai-model/service-caller/openai/siwc/refresh.mjs +60 -0
- package/dist/es/ai-model/service-caller/openai/siwc/refresh.mjs.map +1 -0
- package/dist/es/ai-model/service-caller/openai/siwc/token-manager.mjs +51 -0
- package/dist/es/ai-model/service-caller/openai/siwc/token-manager.mjs.map +1 -0
- package/dist/es/ai-model/service-caller/system-one/call-system-one.mjs +69 -0
- package/dist/es/ai-model/service-caller/system-one/call-system-one.mjs.map +1 -0
- package/dist/es/ai-model/service-caller/system-one/index.mjs +3 -0
- package/dist/es/ai-model/service-caller/system-one/prepare-system-one.mjs +44 -0
- package/dist/es/ai-model/service-caller/system-one/prepare-system-one.mjs.map +1 -0
- package/dist/es/ai-model/service-caller/system-one/schema.mjs +32 -0
- package/dist/es/ai-model/service-caller/system-one/schema.mjs.map +1 -0
- package/dist/es/ai-model/service-caller/system-one/utils.mjs +34 -0
- package/dist/es/ai-model/service-caller/system-one/utils.mjs.map +1 -0
- package/dist/es/ai-model/service-caller/utils.mjs +2 -2
- package/dist/es/ai-model/service-caller/utils.mjs.map +1 -1
- package/dist/es/ai-model/shared/model-locate-result/factory.mjs +7 -3
- package/dist/es/ai-model/shared/model-locate-result/factory.mjs.map +1 -1
- package/dist/es/ai-model/shared/model-locate-result/pixel-mapper.mjs +10 -4
- package/dist/es/ai-model/shared/model-locate-result/pixel-mapper.mjs.map +1 -1
- package/dist/es/ai-model/shared/model-locate-result/types.mjs.map +1 -1
- package/dist/es/ai-model/shared/model-locate-result/validation.mjs +4 -0
- package/dist/es/ai-model/shared/model-locate-result/validation.mjs.map +1 -1
- package/dist/es/ai-model/workflows/grounding/locate.mjs +2 -2
- package/dist/es/ai-model/workflows/grounding/locate.mjs.map +1 -1
- package/dist/es/ai-model/workflows/grounding/section-locate.mjs +2 -2
- package/dist/es/ai-model/workflows/grounding/section-locate.mjs.map +1 -1
- package/dist/es/ai-model/workflows/insight/boolean.mjs +1 -1
- package/dist/es/ai-model/workflows/insight/boolean.mjs.map +1 -1
- package/dist/es/ai-model/workflows/insight/extraction.mjs +3 -3
- package/dist/es/ai-model/workflows/insight/extraction.mjs.map +1 -1
- package/dist/es/ai-model/workflows/planning/standard-planning.mjs +4 -3
- package/dist/es/ai-model/workflows/planning/standard-planning.mjs.map +1 -1
- package/dist/es/ai-model/workflows/recorder-generation/playwright.mjs +2 -2
- package/dist/es/ai-model/workflows/recorder-generation/playwright.mjs.map +1 -1
- package/dist/es/ai-model/workflows/recorder-generation/yaml.mjs +2 -2
- package/dist/es/ai-model/workflows/recorder-generation/yaml.mjs.map +1 -1
- package/dist/es/device/index.mjs +7 -0
- package/dist/es/device/index.mjs.map +1 -1
- package/dist/es/report-html-template.mjs +1 -1
- package/dist/es/service/index.mjs +2 -1
- package/dist/es/service/index.mjs.map +1 -1
- package/dist/es/types.mjs.map +1 -1
- package/dist/es/utils.mjs +1 -1
- package/dist/lib/agent/agent.js +11 -11
- package/dist/lib/agent/agent.js.map +1 -1
- package/dist/lib/agent/insight.js.map +1 -1
- package/dist/lib/agent/tasks.js +72 -39
- package/dist/lib/agent/tasks.js.map +1 -1
- package/dist/lib/agent/utils.js +1 -1
- package/dist/lib/ai-model/connectivity/run-connectivity-test.js +27 -22
- package/dist/lib/ai-model/connectivity/run-connectivity-test.js.map +1 -1
- package/dist/lib/ai-model/index.js +34 -5
- package/dist/lib/ai-model/model-adapter/resolve.js +4 -2
- package/dist/lib/ai-model/model-adapter/resolve.js.map +1 -1
- package/dist/lib/ai-model/models/jev/adapter.js +6 -110
- package/dist/lib/ai-model/models/jev/adapter.js.map +1 -1
- package/dist/lib/ai-model/models/jev/boolean.js +82 -0
- package/dist/lib/ai-model/models/jev/boolean.js.map +1 -0
- package/dist/lib/ai-model/models/jev/image.js +41 -35
- package/dist/lib/ai-model/models/jev/image.js.map +1 -1
- package/dist/lib/ai-model/models/jev/locate.js +82 -0
- package/dist/lib/ai-model/models/jev/locate.js.map +1 -0
- package/dist/lib/ai-model/models/jev/planning-action.js +69 -0
- package/dist/lib/ai-model/models/jev/planning-action.js.map +1 -0
- package/dist/lib/ai-model/models/jev/planning-context.js +72 -0
- package/dist/lib/ai-model/models/jev/planning-context.js.map +1 -0
- package/dist/lib/ai-model/models/jev/planning-decision.js +102 -0
- package/dist/lib/ai-model/models/jev/planning-decision.js.map +1 -0
- package/dist/lib/ai-model/models/jev/planning.js +19 -131
- package/dist/lib/ai-model/models/jev/planning.js.map +1 -1
- package/dist/lib/ai-model/models/{task-routing.js → model-fallback.js} +11 -11
- package/dist/lib/ai-model/models/model-fallback.js.map +1 -0
- package/dist/lib/ai-model/service-caller/call-ai.js +59 -29
- package/dist/lib/ai-model/service-caller/call-ai.js.map +1 -1
- package/dist/lib/ai-model/service-caller/codex/call-codex.js.map +1 -1
- package/dist/lib/ai-model/service-caller/index.js +6 -3
- package/dist/lib/ai-model/service-caller/model-call.js +2 -2
- package/dist/lib/ai-model/service-caller/model-call.js.map +1 -1
- package/dist/lib/ai-model/service-caller/openai/call-openai.js +4 -2
- package/dist/lib/ai-model/service-caller/openai/call-openai.js.map +1 -1
- package/dist/lib/ai-model/service-caller/openai/chat-completion/chat-completion.js.map +1 -1
- package/dist/lib/ai-model/service-caller/openai/openai-client.js.map +1 -1
- package/dist/lib/ai-model/service-caller/openai/responses/responses.js.map +1 -1
- package/dist/lib/ai-model/service-caller/openai/siwc/authorization.js +157 -0
- package/dist/lib/ai-model/service-caller/openai/siwc/authorization.js.map +1 -0
- package/dist/lib/ai-model/service-caller/openai/siwc/credential-storage.js +103 -0
- package/dist/lib/ai-model/service-caller/openai/siwc/credential-storage.js.map +1 -0
- package/dist/lib/ai-model/service-caller/openai/siwc/errors.js +85 -0
- package/dist/lib/ai-model/service-caller/openai/siwc/errors.js.map +1 -0
- package/dist/lib/ai-model/service-caller/openai/siwc/index.js +64 -0
- package/dist/lib/ai-model/service-caller/openai/siwc/index.js.map +1 -0
- package/dist/lib/ai-model/service-caller/openai/siwc/prepare-call.js +67 -0
- package/dist/lib/ai-model/service-caller/openai/siwc/prepare-call.js.map +1 -0
- package/dist/lib/ai-model/service-caller/openai/siwc/refresh.js +94 -0
- package/dist/lib/ai-model/service-caller/openai/siwc/refresh.js.map +1 -0
- package/dist/lib/ai-model/service-caller/openai/siwc/token-manager.js +85 -0
- package/dist/lib/ai-model/service-caller/openai/siwc/token-manager.js.map +1 -0
- package/dist/lib/ai-model/service-caller/system-one/call-system-one.js +103 -0
- package/dist/lib/ai-model/service-caller/system-one/call-system-one.js.map +1 -0
- package/dist/lib/ai-model/service-caller/system-one/index.js +42 -0
- package/dist/lib/ai-model/service-caller/system-one/index.js.map +1 -0
- package/dist/lib/ai-model/service-caller/system-one/prepare-system-one.js +78 -0
- package/dist/lib/ai-model/service-caller/system-one/prepare-system-one.js.map +1 -0
- package/dist/lib/ai-model/service-caller/system-one/schema.js +69 -0
- package/dist/lib/ai-model/service-caller/system-one/schema.js.map +1 -0
- package/dist/lib/ai-model/service-caller/system-one/utils.js +68 -0
- package/dist/lib/ai-model/service-caller/system-one/utils.js.map +1 -0
- package/dist/lib/ai-model/service-caller/utils.js +2 -2
- package/dist/lib/ai-model/service-caller/utils.js.map +1 -1
- package/dist/lib/ai-model/shared/model-locate-result/factory.js +7 -3
- package/dist/lib/ai-model/shared/model-locate-result/factory.js.map +1 -1
- package/dist/lib/ai-model/shared/model-locate-result/pixel-mapper.js +10 -4
- package/dist/lib/ai-model/shared/model-locate-result/pixel-mapper.js.map +1 -1
- package/dist/lib/ai-model/shared/model-locate-result/types.js.map +1 -1
- package/dist/lib/ai-model/shared/model-locate-result/validation.js +4 -0
- package/dist/lib/ai-model/shared/model-locate-result/validation.js.map +1 -1
- package/dist/lib/ai-model/workflows/grounding/locate.js +1 -1
- package/dist/lib/ai-model/workflows/grounding/locate.js.map +1 -1
- package/dist/lib/ai-model/workflows/grounding/section-locate.js +1 -1
- package/dist/lib/ai-model/workflows/grounding/section-locate.js.map +1 -1
- package/dist/lib/ai-model/workflows/insight/boolean.js +1 -1
- package/dist/lib/ai-model/workflows/insight/boolean.js.map +1 -1
- package/dist/lib/ai-model/workflows/insight/extraction.js +2 -2
- package/dist/lib/ai-model/workflows/insight/extraction.js.map +1 -1
- package/dist/lib/ai-model/workflows/planning/standard-planning.js +3 -2
- package/dist/lib/ai-model/workflows/planning/standard-planning.js.map +1 -1
- package/dist/lib/ai-model/workflows/recorder-generation/playwright.js +1 -1
- package/dist/lib/ai-model/workflows/recorder-generation/playwright.js.map +1 -1
- package/dist/lib/ai-model/workflows/recorder-generation/yaml.js +1 -1
- package/dist/lib/ai-model/workflows/recorder-generation/yaml.js.map +1 -1
- package/dist/lib/device/index.js +7 -0
- package/dist/lib/device/index.js.map +1 -1
- package/dist/lib/report-html-template.js +1 -1
- package/dist/lib/service/index.js +2 -1
- package/dist/lib/service/index.js.map +1 -1
- package/dist/lib/test-runner/engine/index.js +2 -2
- package/dist/lib/test-runner/node/index.js +2 -2
- package/dist/lib/types.js.map +1 -1
- package/dist/lib/utils.js +1 -1
- package/dist/types/agent/agent.d.ts.map +1 -1
- package/dist/types/agent/insight.d.ts +2 -2
- package/dist/types/agent/insight.d.ts.map +1 -1
- package/dist/types/agent/tasks.d.ts.map +1 -1
- package/dist/types/ai-model/connectivity/run-connectivity-test.d.ts.map +1 -1
- package/dist/types/ai-model/index.d.ts +4 -1
- package/dist/types/ai-model/index.d.ts.map +1 -1
- package/dist/types/ai-model/model-adapter/resolve.d.ts +2 -1
- package/dist/types/ai-model/model-adapter/resolve.d.ts.map +1 -1
- package/dist/types/ai-model/model-adapter/types.d.ts +8 -5
- package/dist/types/ai-model/model-adapter/types.d.ts.map +1 -1
- package/dist/types/ai-model/models/gpt.d.ts +2 -2
- package/dist/types/ai-model/models/jev/adapter.d.ts +4 -5
- package/dist/types/ai-model/models/jev/adapter.d.ts.map +1 -1
- package/dist/types/ai-model/models/jev/boolean.d.ts +3 -0
- package/dist/types/ai-model/models/jev/boolean.d.ts.map +1 -0
- package/dist/types/ai-model/models/jev/image.d.ts +11 -11
- package/dist/types/ai-model/models/jev/image.d.ts.map +1 -1
- package/dist/types/ai-model/models/jev/locate.d.ts +3 -0
- package/dist/types/ai-model/models/jev/locate.d.ts.map +1 -0
- package/dist/types/ai-model/models/jev/planning-action.d.ts +6 -0
- package/dist/types/ai-model/models/jev/planning-action.d.ts.map +1 -0
- package/dist/types/ai-model/models/jev/planning-context.d.ts +23 -0
- package/dist/types/ai-model/models/jev/planning-context.d.ts.map +1 -0
- package/dist/types/ai-model/models/jev/planning-decision.d.ts +35 -0
- package/dist/types/ai-model/models/jev/planning-decision.d.ts.map +1 -0
- package/dist/types/ai-model/models/jev/planning.d.ts.map +1 -1
- package/dist/types/ai-model/models/model-fallback.d.ts +6 -0
- package/dist/types/ai-model/models/model-fallback.d.ts.map +1 -0
- package/dist/types/ai-model/models/registry.d.ts +4 -3
- package/dist/types/ai-model/models/registry.d.ts.map +1 -1
- package/dist/types/ai-model/service-caller/call-ai.d.ts +3 -1
- package/dist/types/ai-model/service-caller/call-ai.d.ts.map +1 -1
- package/dist/types/ai-model/service-caller/codex/call-codex.d.ts +5 -3
- package/dist/types/ai-model/service-caller/codex/call-codex.d.ts.map +1 -1
- package/dist/types/ai-model/service-caller/index.d.ts +1 -1
- package/dist/types/ai-model/service-caller/index.d.ts.map +1 -1
- package/dist/types/ai-model/service-caller/model-call.d.ts +2 -2
- package/dist/types/ai-model/service-caller/model-call.d.ts.map +1 -1
- package/dist/types/ai-model/service-caller/openai/call-openai.d.ts +2 -2
- package/dist/types/ai-model/service-caller/openai/call-openai.d.ts.map +1 -1
- package/dist/types/ai-model/service-caller/openai/chat-completion/chat-completion.d.ts +4 -2
- package/dist/types/ai-model/service-caller/openai/chat-completion/chat-completion.d.ts.map +1 -1
- package/dist/types/ai-model/service-caller/openai/responses/responses.d.ts +4 -2
- package/dist/types/ai-model/service-caller/openai/responses/responses.d.ts.map +1 -1
- package/dist/types/ai-model/service-caller/openai/siwc/authorization.d.ts +42 -0
- package/dist/types/ai-model/service-caller/openai/siwc/authorization.d.ts.map +1 -0
- package/dist/types/ai-model/service-caller/openai/siwc/credential-storage.d.ts +21 -0
- package/dist/types/ai-model/service-caller/openai/siwc/credential-storage.d.ts.map +1 -0
- package/dist/types/ai-model/service-caller/openai/siwc/errors.d.ts +10 -0
- package/dist/types/ai-model/service-caller/openai/siwc/errors.d.ts.map +1 -0
- package/dist/types/ai-model/service-caller/openai/siwc/index.d.ts +7 -0
- package/dist/types/ai-model/service-caller/openai/siwc/index.d.ts.map +1 -0
- package/dist/types/ai-model/service-caller/openai/siwc/prepare-call.d.ts +8 -0
- package/dist/types/ai-model/service-caller/openai/siwc/prepare-call.d.ts.map +1 -0
- package/dist/types/ai-model/service-caller/openai/siwc/refresh.d.ts +19 -0
- package/dist/types/ai-model/service-caller/openai/siwc/refresh.d.ts.map +1 -0
- package/dist/types/ai-model/service-caller/openai/siwc/token-manager.d.ts +10 -0
- package/dist/types/ai-model/service-caller/openai/siwc/token-manager.d.ts.map +1 -0
- package/dist/types/ai-model/service-caller/system-one/call-system-one.d.ts +4 -0
- package/dist/types/ai-model/service-caller/system-one/call-system-one.d.ts.map +1 -0
- package/dist/types/ai-model/service-caller/system-one/index.d.ts +3 -0
- package/dist/types/ai-model/service-caller/system-one/index.d.ts.map +1 -0
- package/dist/types/ai-model/service-caller/system-one/prepare-system-one.d.ts +21 -0
- package/dist/types/ai-model/service-caller/system-one/prepare-system-one.d.ts.map +1 -0
- package/dist/types/ai-model/service-caller/{system-one.d.ts → system-one/schema.d.ts} +1 -22
- package/dist/types/ai-model/service-caller/system-one/schema.d.ts.map +1 -0
- package/dist/types/ai-model/service-caller/system-one/utils.d.ts +6 -0
- package/dist/types/ai-model/service-caller/system-one/utils.d.ts.map +1 -0
- package/dist/types/ai-model/service-caller/types.d.ts +0 -3
- package/dist/types/ai-model/service-caller/types.d.ts.map +1 -1
- package/dist/types/ai-model/service-caller/utils.d.ts +3 -3
- package/dist/types/ai-model/shared/model-locate-result/factory.d.ts.map +1 -1
- package/dist/types/ai-model/shared/model-locate-result/index.d.ts +1 -1
- package/dist/types/ai-model/shared/model-locate-result/index.d.ts.map +1 -1
- package/dist/types/ai-model/shared/model-locate-result/pixel-mapper.d.ts +3 -3
- package/dist/types/ai-model/shared/model-locate-result/pixel-mapper.d.ts.map +1 -1
- package/dist/types/ai-model/shared/model-locate-result/types.d.ts +4 -0
- package/dist/types/ai-model/shared/model-locate-result/types.d.ts.map +1 -1
- package/dist/types/ai-model/shared/model-locate-result/validation.d.ts.map +1 -1
- package/dist/types/ai-model/workflows/grounding/locate.d.ts.map +1 -1
- package/dist/types/ai-model/workflows/grounding/section-locate.d.ts.map +1 -1
- package/dist/types/ai-model/workflows/insight/boolean.d.ts.map +1 -1
- package/dist/types/ai-model/workflows/insight/extraction.d.ts +2 -0
- package/dist/types/ai-model/workflows/insight/extraction.d.ts.map +1 -1
- package/dist/types/ai-model/workflows/planning/standard-planning.d.ts.map +1 -1
- package/dist/types/ai-model/workflows/planning/types.d.ts +2 -1
- package/dist/types/ai-model/workflows/planning/types.d.ts.map +1 -1
- package/dist/types/ai-model/workflows/recorder-generation/playwright.d.ts.map +1 -1
- package/dist/types/ai-model/workflows/recorder-generation/yaml.d.ts.map +1 -1
- package/dist/types/device/index.d.ts +1 -0
- package/dist/types/device/index.d.ts.map +1 -1
- package/dist/types/service/index.d.ts +1 -1
- package/dist/types/service/index.d.ts.map +1 -1
- package/dist/types/types.d.ts +14 -3
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +3 -2
- package/dist/es/ai-model/models/task-routing.mjs +0 -28
- package/dist/es/ai-model/models/task-routing.mjs.map +0 -1
- package/dist/es/ai-model/service-caller/system-one.mjs +0 -163
- package/dist/es/ai-model/service-caller/system-one.mjs.map +0 -1
- package/dist/lib/ai-model/models/task-routing.js.map +0 -1
- package/dist/lib/ai-model/service-caller/system-one.js +0 -206
- package/dist/lib/ai-model/service-caller/system-one.js.map +0 -1
- package/dist/types/ai-model/models/task-routing.d.ts +0 -6
- package/dist/types/ai-model/models/task-routing.d.ts.map +0 -1
- package/dist/types/ai-model/service-caller/system-one.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-model/models/jev/image.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../../../src/ai-model/models/jev/image.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { Buffer } from 'node:buffer';\nimport {
|
|
1
|
+
{"version":3,"file":"ai-model/models/jev/image.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../../../src/ai-model/models/jev/image.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { Buffer } from 'node:buffer';\nimport { parseBase64, preProcessImageUrl } from '@midscene/shared/img';\nimport { assert } from '@midscene/shared/utils';\nimport { createLocateResultCodec } from '../../shared/model-locate-result';\nimport type { PixelLocateResult } from '../../shared/model-locate-result';\nimport { prepareUserPrompt } from '../../shared/multimodal-prompt';\n\nexport async function prepareJevImage(url: string) {\n const base64 = await preProcessImageUrl(url, true);\n assert(\n Buffer.from(parseBase64(base64).body, 'base64').length <= 16 * 1024 * 1024,\n 'Jev image exceeds 16 MiB',\n );\n return { imageBase64: base64 };\n}\n\nconst jevBoxCodec = createLocateResultCodec({\n coordinates: {\n shape: 'bbox',\n normalizedBy: 1,\n rounding: 'none',\n boundsType: 'edges',\n },\n});\n\nexport function mapJevBox(\n box: { left: number; top: number; right: number; bottom: number },\n targetSize: { width: number; height: number },\n): PixelLocateResult {\n return jevBoxCodec.toPixelResult([box.left, box.top, box.right, box.bottom], {\n preparedSize: targetSize,\n });\n}\n\nexport async function prepareReferences(\n prompt: Parameters<typeof prepareUserPrompt>[0],\n) {\n const { referenceImages } = await prepareUserPrompt(prompt);\n const prepared = await Promise.all(\n referenceImages.map(async (image, index) => ({\n key: `reference_${index}`,\n name: image.name,\n image: await prepareJevImage(image.url),\n })),\n );\n return {\n references: prepared.map(({ key, name }) => ({\n image: `\\`${key}\\``,\n name,\n })),\n images: Object.fromEntries(\n prepared.map(({ key, image }) => [key, image.imageBase64]),\n ),\n };\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","prepareJevImage","url","base64","preProcessImageUrl","assert","Buffer","parseBase64","jevBoxCodec","createLocateResultCodec","mapJevBox","box","targetSize","prepareReferences","prompt","referenceImages","prepareUserPrompt","prepared","Promise","image","index","name"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,CAACI,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFL,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,eAAlB,OAAOM,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D;;;;;;;;;;;;;;ACCO,eAAeI,gBAAgBC,GAAW;IAC/C,MAAMC,SAAS,MAAMC,AAAAA,IAAAA,oBAAAA,kBAAAA,AAAAA,EAAmBF,KAAK;IAC7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(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
jevLocate: ()=>jevLocate
|
|
28
|
+
});
|
|
29
|
+
const external_common_js_namespaceObject = require("../../../common.js");
|
|
30
|
+
const utils_namespaceObject = require("@midscene/shared/utils");
|
|
31
|
+
const index_js_namespaceObject = require("../../service-caller/index.js");
|
|
32
|
+
const schema_js_namespaceObject = require("../../service-caller/system-one/schema.js");
|
|
33
|
+
const external_image_js_namespaceObject = require("./image.js");
|
|
34
|
+
const jevLocate = async ({ targetElementDescription, locateImage, options })=>{
|
|
35
|
+
const image = await (0, external_image_js_namespaceObject.prepareJevImage)(locateImage.imageBase64);
|
|
36
|
+
const references = await (0, external_image_js_namespaceObject.prepareReferences)(targetElementDescription);
|
|
37
|
+
const target = (0, external_common_js_namespaceObject.userPromptToString)(targetElementDescription);
|
|
38
|
+
const response = await (0, index_js_namespaceObject.callSystemOneAI)({
|
|
39
|
+
state: {
|
|
40
|
+
target,
|
|
41
|
+
references: references.references
|
|
42
|
+
},
|
|
43
|
+
images: {
|
|
44
|
+
screenshot: image.imageBase64,
|
|
45
|
+
...references.images
|
|
46
|
+
},
|
|
47
|
+
questions: {
|
|
48
|
+
present: {
|
|
49
|
+
type: 'noul',
|
|
50
|
+
instructions: 'Is the target described in `target` present in `screenshot`? Reference images, if any, describe the target; they are not the screenshot.'
|
|
51
|
+
},
|
|
52
|
+
target: {
|
|
53
|
+
type: 'box',
|
|
54
|
+
instructions: 'The single target described in `target`, in `screenshot`.'
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}, options.modelRuntime, {
|
|
58
|
+
abortSignal: options.abortSignal
|
|
59
|
+
});
|
|
60
|
+
const { answers } = schema_js_namespaceObject.systemOneResponseSchema.parse(JSON.parse(response.content));
|
|
61
|
+
(0, utils_namespaceObject.assert)('noul' === answers.present.type && 'box' === answers.target.type, 'Invalid Jev locate answers');
|
|
62
|
+
return {
|
|
63
|
+
rawResponse: response.content,
|
|
64
|
+
usage: response.usage,
|
|
65
|
+
...answers.present.noul >= 0.5 ? {
|
|
66
|
+
locatedPixelResult: (0, external_image_js_namespaceObject.mapJevBox)(answers.target.box, locateImage)
|
|
67
|
+
} : {
|
|
68
|
+
errors: [
|
|
69
|
+
'The target is not present in the screenshot'
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
exports.jevLocate = __webpack_exports__.jevLocate;
|
|
75
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
76
|
+
"jevLocate"
|
|
77
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
78
|
+
Object.defineProperty(exports, '__esModule', {
|
|
79
|
+
value: true
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
//# sourceMappingURL=locate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-model/models/jev/locate.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../../../src/ai-model/models/jev/locate.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { userPromptToString } from '@/common';\nimport { assert } from '@midscene/shared/utils';\nimport { callSystemOneAI } from '../../service-caller';\nimport { systemOneResponseSchema } from '../../service-caller/system-one/schema';\nimport type { LocateFn } from '../../workflows/grounding/types';\nimport { mapJevBox, prepareJevImage, prepareReferences } from './image';\n\nexport const jevLocate: LocateFn = async ({\n targetElementDescription,\n locateImage,\n options,\n}) => {\n const image = await prepareJevImage(locateImage.imageBase64);\n const references = await prepareReferences(targetElementDescription);\n const target = userPromptToString(targetElementDescription);\n const response = await callSystemOneAI(\n {\n state: { target, references: references.references },\n images: { screenshot: image.imageBase64, ...references.images },\n questions: {\n present: {\n type: 'noul',\n instructions:\n 'Is the target described in `target` present in `screenshot`? Reference images, if any, describe the target; they are not the screenshot.',\n },\n target: {\n type: 'box',\n instructions:\n 'The single target described in `target`, in `screenshot`.',\n },\n },\n },\n options.modelRuntime,\n { abortSignal: options.abortSignal },\n );\n const { answers } = systemOneResponseSchema.parse(\n JSON.parse(response.content),\n );\n assert(\n answers.present.type === 'noul' && answers.target.type === 'box',\n 'Invalid Jev locate answers',\n );\n return {\n rawResponse: response.content,\n usage: response.usage,\n ...(answers.present.noul >= 0.5\n ? {\n locatedPixelResult: mapJevBox(answers.target.box, locateImage),\n }\n : { errors: ['The target is not present in the screenshot'] }),\n };\n};\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","jevLocate","targetElementDescription","locateImage","options","image","prepareJevImage","references","prepareReferences","target","userPromptToString","response","callSystemOneAI","answers","systemOneResponseSchema","JSON","assert","mapJevBox"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,CAACI,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFL,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,eAAlB,OAAOM,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D;;;;;;;;;;;;ACCO,MAAMI,YAAsB,OAAO,EACxCC,wBAAwB,EACxBC,WAAW,EACXC,OAAO,EACR;IACC,MAAMC,QAAQ,MAAMC,AAAAA,IAAAA,kCAAAA,eAAAA,AAAAA,EAAgBH,YAAY,WAAW;IAC3D,MAAMI,aAAa,MAAMC,AAAAA,IAAAA,kCAAAA,iBAAAA,AAAAA,EAAkBN;IAC3C,MAAMO,SAASC,AAAAA,IAAAA,mCAAAA,kBAAAA,AAAAA,EAAmBR;IAClC,MAAMS,WAAW,MAAMC,AAAAA,IAAAA,yBAAAA,eAAAA,AAAAA,EACrB;QACE,OAAO;YAAEH;YAAQ,YAAYF,WAAW,UAAU;QAAC;QACnD,QAAQ;YAAE,YAAYF,MAAM,WAAW;YAAE,GAAGE,WAAW,MAAM;QAAC;QAC9D,WAAW;YACT,SAAS;gBACP,MAAM;gBACN,cACE;YACJ;YACA,QAAQ;gBACN,MAAM;gBACN,cACE;YACJ;QACF;IACF,GACAH,QAAQ,YAAY,EACpB;QAAE,aAAaA,QAAQ,WAAW;IAAC;IAErC,MAAM,EAAES,OAAO,EAAE,GAAGC,0BAAAA,uBAAAA,CAAAA,KAA6B,CAC/CC,KAAK,KAAK,CAACJ,SAAS,OAAO;IAE7BK,IAAAA,sBAAAA,MAAAA,AAAAA,EACEH,AAAyB,WAAzBA,QAAQ,OAAO,CAAC,IAAI,IAAeA,AAAwB,UAAxBA,QAAQ,MAAM,CAAC,IAAI,EACtD;IAEF,OAAO;QACL,aAAaF,SAAS,OAAO;QAC7B,OAAOA,SAAS,KAAK;QACrB,GAAIE,QAAQ,OAAO,CAAC,IAAI,IAAI,MACxB;YACE,oBAAoBI,AAAAA,IAAAA,kCAAAA,SAAAA,AAAAA,EAAUJ,QAAQ,MAAM,CAAC,GAAG,EAAEV;QACpD,IACA;YAAE,QAAQ;gBAAC;aAA8C;QAAC,CAAC;IACjE;AACF"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
buildJevAction: ()=>buildJevAction
|
|
28
|
+
});
|
|
29
|
+
const external_common_js_namespaceObject = require("../../../common.js");
|
|
30
|
+
const utils_namespaceObject = require("@midscene/shared/utils");
|
|
31
|
+
const external_image_js_namespaceObject = require("./image.js");
|
|
32
|
+
function buildJevAction(decision, context, instruction, options) {
|
|
33
|
+
const { choice } = decision;
|
|
34
|
+
if ('complete' === choice.kind) return [];
|
|
35
|
+
(0, utils_namespaceObject.assert)('action' === choice.kind, 'Delegated actions must use the default planner');
|
|
36
|
+
const action = choice.action;
|
|
37
|
+
const fields = action.paramSchema ? (0, external_common_js_namespaceObject.findAllMidsceneLocatorField)(action.paramSchema) : [];
|
|
38
|
+
const locatedPixelResult = (()=>{
|
|
39
|
+
if (!options.includeLocateInPlanning || 1 !== fields.length) return;
|
|
40
|
+
(0, utils_namespaceObject.assert)(decision.target?.type === 'box', 'Missing Jev planning target box');
|
|
41
|
+
return (0, external_image_js_namespaceObject.mapJevBox)(decision.target.box, options.context.shotSize);
|
|
42
|
+
})();
|
|
43
|
+
const param = Object.fromEntries(fields.map((field)=>[
|
|
44
|
+
field,
|
|
45
|
+
{
|
|
46
|
+
prompt: `Locate the target for parameter ${JSON.stringify(field)} of action ${JSON.stringify(action.name)} (${action.description ?? action.name}) for the NEXT step toward this goal. Use the current screenshot as authoritative and consider execution feedback. Task context: ${JSON.stringify(context.state)}`,
|
|
47
|
+
images: instruction.referenceImages,
|
|
48
|
+
...locatedPixelResult ? {
|
|
49
|
+
locatedPixelResult
|
|
50
|
+
} : {}
|
|
51
|
+
}
|
|
52
|
+
]));
|
|
53
|
+
(0, external_common_js_namespaceObject.parseActionParam)(param, action.paramSchema);
|
|
54
|
+
return [
|
|
55
|
+
{
|
|
56
|
+
type: action.name,
|
|
57
|
+
param
|
|
58
|
+
}
|
|
59
|
+
];
|
|
60
|
+
}
|
|
61
|
+
exports.buildJevAction = __webpack_exports__.buildJevAction;
|
|
62
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
63
|
+
"buildJevAction"
|
|
64
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
65
|
+
Object.defineProperty(exports, '__esModule', {
|
|
66
|
+
value: true
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
//# sourceMappingURL=planning-action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-model/models/jev/planning-action.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../../../src/ai-model/models/jev/planning-action.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { findAllMidsceneLocatorField, parseActionParam } from '@/common';\nimport type { PlanningAction } from '@/types';\nimport { assert } from '@midscene/shared/utils';\nimport type { PlanFn, PlanOptions } from '../../workflows/planning/types';\nimport { mapJevBox } from './image';\nimport type { JevPlanningContext } from './planning-context';\nimport type { JevActionDecision } from './planning-decision';\n\nexport function buildJevAction(\n decision: JevActionDecision,\n context: JevPlanningContext,\n instruction: Parameters<PlanFn>[0],\n options: PlanOptions,\n): PlanningAction[] {\n const { choice } = decision;\n if (choice.kind === 'complete') {\n return [];\n }\n assert(\n choice.kind === 'action',\n 'Delegated actions must use the default planner',\n );\n const action = choice.action;\n const fields = action.paramSchema\n ? findAllMidsceneLocatorField(action.paramSchema)\n : [];\n const locatedPixelResult = (() => {\n if (!options.includeLocateInPlanning || fields.length !== 1) {\n return undefined;\n }\n assert(decision.target?.type === 'box', 'Missing Jev planning target box');\n return mapJevBox(decision.target.box, options.context.shotSize);\n })();\n const param = Object.fromEntries(\n fields.map((field) => [\n field,\n {\n prompt: `Locate the target for parameter ${JSON.stringify(field)} of action ${JSON.stringify(action.name)} (${action.description ?? action.name}) for the NEXT step toward this goal. Use the current screenshot as authoritative and consider execution feedback. Task context: ${JSON.stringify(context.state)}`,\n images: instruction.referenceImages,\n ...(locatedPixelResult ? { locatedPixelResult } : {}),\n },\n ]),\n );\n // Validate declared direct-action support before handing the plan to execution.\n parseActionParam(param, action.paramSchema);\n return [{ type: action.name, param }];\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","buildJevAction","decision","context","instruction","options","choice","assert","action","fields","findAllMidsceneLocatorField","locatedPixelResult","mapJevBox","param","field","JSON","parseActionParam"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,CAACI,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFL,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,eAAlB,OAAOM,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG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H,OAAOL,OAAO,WAAW;IAC1C,OAAO;QAAC;YAAE,MAAMA,OAAO,IAAI;YAAEK;QAAM;KAAE;AACvC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
prepareJevPlanningContext: ()=>prepareJevPlanningContext
|
|
28
|
+
});
|
|
29
|
+
const external_image_js_namespaceObject = require("./image.js");
|
|
30
|
+
async function prepareJevPlanningContext(instruction, options) {
|
|
31
|
+
const history = options.conversationHistory;
|
|
32
|
+
const image = await (0, external_image_js_namespaceObject.prepareJevImage)(options.context.screenshot.base64);
|
|
33
|
+
const references = await Promise.all(instruction.referenceImages.map(async (reference, index)=>({
|
|
34
|
+
key: `reference_${index}`,
|
|
35
|
+
name: reference.name,
|
|
36
|
+
image: await (0, external_image_js_namespaceObject.prepareJevImage)(reference.url)
|
|
37
|
+
})));
|
|
38
|
+
const state = {
|
|
39
|
+
goal: instruction.text,
|
|
40
|
+
context: options.actionContext,
|
|
41
|
+
history: history.historicalLogsToText(),
|
|
42
|
+
memory: history.memoriesToText(),
|
|
43
|
+
feedback: history.pendingFeedbackMessage,
|
|
44
|
+
references: references.map(({ key, name })=>({
|
|
45
|
+
image: `\`${key}\``,
|
|
46
|
+
name
|
|
47
|
+
})),
|
|
48
|
+
availableActions: options.actionSpace.map(({ name, description })=>({
|
|
49
|
+
name,
|
|
50
|
+
description
|
|
51
|
+
}))
|
|
52
|
+
};
|
|
53
|
+
return {
|
|
54
|
+
state,
|
|
55
|
+
images: {
|
|
56
|
+
screenshot: image.imageBase64,
|
|
57
|
+
...Object.fromEntries(references.map(({ key, image })=>[
|
|
58
|
+
key,
|
|
59
|
+
image.imageBase64
|
|
60
|
+
]))
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
exports.prepareJevPlanningContext = __webpack_exports__.prepareJevPlanningContext;
|
|
65
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
66
|
+
"prepareJevPlanningContext"
|
|
67
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
68
|
+
Object.defineProperty(exports, '__esModule', {
|
|
69
|
+
value: true
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
//# sourceMappingURL=planning-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-model/models/jev/planning-context.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../../../src/ai-model/models/jev/planning-context.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import type { PlanFn, PlanOptions } from '../../workflows/planning/types';\nimport { prepareJevImage } from './image';\n\nexport async function prepareJevPlanningContext(\n instruction: Parameters<PlanFn>[0],\n options: PlanOptions,\n) {\n const history = options.conversationHistory;\n const image = await prepareJevImage(options.context.screenshot.base64);\n const references = await Promise.all(\n instruction.referenceImages.map(async (reference, index) => ({\n key: `reference_${index}`,\n name: reference.name,\n image: await prepareJevImage(reference.url),\n })),\n );\n const state = {\n goal: instruction.text,\n context: options.actionContext,\n history: history.historicalLogsToText(),\n memory: history.memoriesToText(),\n feedback: history.pendingFeedbackMessage,\n references: references.map(({ key, name }) => ({\n image: `\\`${key}\\``,\n name,\n })),\n availableActions: options.actionSpace.map(({ name, description }) => ({\n name,\n description,\n })),\n };\n return {\n state,\n images: {\n screenshot: image.imageBase64,\n ...Object.fromEntries(\n references.map(({ key, image }) => [key, image.imageBase64]),\n ),\n },\n };\n}\n\nexport type JevPlanningContext = Awaited<\n ReturnType<typeof prepareJevPlanningContext>\n>;\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","prepareJevPlanningContext","instruction","options","history","image","prepareJevImage","references","Promise","reference","index","state","name","description"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,CAACI,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,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ES,KAAK,EAAE,GAAK;oBAACT;oBAAKS,MAAM,WAAW;iBAAC,EAC5D;QACH;IACF;AACF"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
decideJevAction: ()=>decideJevAction
|
|
28
|
+
});
|
|
29
|
+
const external_common_js_namespaceObject = require("../../../common.js");
|
|
30
|
+
const utils_namespaceObject = require("@midscene/shared/utils");
|
|
31
|
+
const index_js_namespaceObject = require("../../service-caller/index.js");
|
|
32
|
+
const schema_js_namespaceObject = require("../../service-caller/system-one/schema.js");
|
|
33
|
+
async function decideJevAction(context, options) {
|
|
34
|
+
const criteria = {
|
|
35
|
+
'control:complete': 'The entire user goal is already satisfied, confirmed by the current screenshot and execution feedback. No text answer is requested.',
|
|
36
|
+
'control:delegate': 'The next step needs generated output, an explanation of why the task cannot be completed, or something not covered by the action choices. Delegate to the default model.'
|
|
37
|
+
};
|
|
38
|
+
const choices = new Map([
|
|
39
|
+
[
|
|
40
|
+
'control:complete',
|
|
41
|
+
{
|
|
42
|
+
kind: 'complete'
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
[
|
|
46
|
+
'control:delegate',
|
|
47
|
+
{
|
|
48
|
+
kind: 'delegate'
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
]);
|
|
52
|
+
for (const action of options.actionSpace){
|
|
53
|
+
const kind = action.supportedBySystemOne ? 'action' : 'delegate';
|
|
54
|
+
const key = `${kind}:${action.name}`;
|
|
55
|
+
(0, utils_namespaceObject.assert)(!choices.has(key), `Duplicate Jev planning choice: ${key}`);
|
|
56
|
+
choices.set(key, {
|
|
57
|
+
kind,
|
|
58
|
+
action
|
|
59
|
+
});
|
|
60
|
+
criteria[key] = `${action.name}: ${action.description ?? action.name}. ${'action' === kind ? 'Perform this action.' : 'Suggest this action and delegate the next planning step, including its parameters, to the default model.'}`;
|
|
61
|
+
}
|
|
62
|
+
(0, utils_namespaceObject.assert)(choices.size <= 255, 'Jev Choice supports at most 255 options');
|
|
63
|
+
const locateInPlanning = options.includeLocateInPlanning && options.actionSpace.some((action)=>action.supportedBySystemOne && action.paramSchema && 1 === (0, external_common_js_namespaceObject.findAllMidsceneLocatorField)(action.paramSchema).length);
|
|
64
|
+
const response = await (0, index_js_namespaceObject.callSystemOneAI)({
|
|
65
|
+
...context,
|
|
66
|
+
questions: {
|
|
67
|
+
...locateInPlanning ? {
|
|
68
|
+
target: {
|
|
69
|
+
type: 'box',
|
|
70
|
+
instructions: 'Identify the single UI element to interact with in the NEXT step toward `goal`, using the current `screenshot`, context, history and feedback. Return its bounding box in `screenshot`. This is the target of the next direct action (such as Tap, DoubleClick, Hover or ClearInput), not the final goal of the entire task. Reference images describe targets, not the current page. If the next step needs no target or must be delegated, this box is unused.'
|
|
71
|
+
}
|
|
72
|
+
} : {},
|
|
73
|
+
action: {
|
|
74
|
+
type: 'choice',
|
|
75
|
+
instructions: 'Choose exactly the next step toward `goal` using the current `screenshot`, context, history and feedback. History records proposed actions; feedback and current screenshot establish what actually happened. Do not repeat completed steps. Reference images describe targets, not the current page. A delegate choice means the named action is likely needed; it has not been executed. Choose control:complete only when no requested work or text answer remains.',
|
|
76
|
+
criteria
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}, options.modelRuntime, {
|
|
80
|
+
abortSignal: options.abortSignal
|
|
81
|
+
});
|
|
82
|
+
const { answers } = schema_js_namespaceObject.systemOneResponseSchema.parse(JSON.parse(response.content));
|
|
83
|
+
(0, utils_namespaceObject.assert)('choice' === answers.action.type, 'Invalid Jev planning action');
|
|
84
|
+
const selected = answers.action.choice;
|
|
85
|
+
const choice = choices.get(selected);
|
|
86
|
+
(0, utils_namespaceObject.assert)(choice, `Unknown Jev planning choice: ${selected}`);
|
|
87
|
+
return {
|
|
88
|
+
selected,
|
|
89
|
+
choice,
|
|
90
|
+
response,
|
|
91
|
+
target: locateInPlanning ? answers.target : void 0
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
exports.decideJevAction = __webpack_exports__.decideJevAction;
|
|
95
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
96
|
+
"decideJevAction"
|
|
97
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
98
|
+
Object.defineProperty(exports, '__esModule', {
|
|
99
|
+
value: true
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
//# sourceMappingURL=planning-decision.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-model/models/jev/planning-decision.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../../../src/ai-model/models/jev/planning-decision.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { findAllMidsceneLocatorField } from '@/common';\nimport type { DeviceAction } from '@/types';\nimport { assert } from '@midscene/shared/utils';\nimport { callSystemOneAI } from '../../service-caller';\nimport { systemOneResponseSchema } from '../../service-caller/system-one/schema';\nimport type { PlanOptions } from '../../workflows/planning/types';\nimport type { JevPlanningContext } from './planning-context';\n\ntype JevPlanningChoice =\n | { kind: 'complete' }\n | { kind: 'delegate'; action?: DeviceAction }\n | { kind: 'action'; action: DeviceAction };\n\nexport async function decideJevAction(\n context: JevPlanningContext,\n options: PlanOptions,\n) {\n const criteria: Record<string, string> = {\n 'control:complete':\n 'The entire user goal is already satisfied, confirmed by the current screenshot and execution feedback. No text answer is requested.',\n 'control:delegate':\n 'The next step needs generated output, an explanation of why the task cannot be completed, or something not covered by the action choices. Delegate to the default model.',\n };\n const choices = new Map<string, JevPlanningChoice>([\n ['control:complete', { kind: 'complete' }],\n ['control:delegate', { kind: 'delegate' }],\n ]);\n for (const action of options.actionSpace) {\n const kind = action.supportedBySystemOne ? 'action' : 'delegate';\n const key = `${kind}:${action.name}`;\n assert(!choices.has(key), `Duplicate Jev planning choice: ${key}`);\n choices.set(key, { kind, action });\n criteria[key] = `${action.name}: ${action.description ?? action.name}. ${\n kind === 'action'\n ? 'Perform this action.'\n : 'Suggest this action and delegate the next planning step, including its parameters, to the default model.'\n }`;\n }\n assert(choices.size <= 255, 'Jev Choice supports at most 255 options');\n const locateInPlanning =\n options.includeLocateInPlanning &&\n options.actionSpace.some(\n (action) =>\n action.supportedBySystemOne &&\n action.paramSchema &&\n findAllMidsceneLocatorField(action.paramSchema).length === 1,\n );\n const response = await callSystemOneAI(\n {\n ...context,\n questions: {\n ...(locateInPlanning\n ? {\n target: {\n type: 'box' as const,\n instructions:\n 'Identify the single UI element to interact with in the NEXT step toward `goal`, using the current `screenshot`, context, history and feedback. Return its bounding box in `screenshot`. This is the target of the next direct action (such as Tap, DoubleClick, Hover or ClearInput), not the final goal of the entire task. Reference images describe targets, not the current page. If the next step needs no target or must be delegated, this box is unused.',\n },\n }\n : {}),\n action: {\n type: 'choice',\n instructions:\n 'Choose exactly the next step toward `goal` using the current `screenshot`, context, history and feedback. History records proposed actions; feedback and current screenshot establish what actually happened. Do not repeat completed steps. Reference images describe targets, not the current page. A delegate choice means the named action is likely needed; it has not been executed. Choose control:complete only when no requested work or text answer remains.',\n criteria,\n },\n },\n },\n options.modelRuntime,\n { abortSignal: options.abortSignal },\n );\n const { answers } = systemOneResponseSchema.parse(\n JSON.parse(response.content),\n );\n assert(answers.action.type === 'choice', 'Invalid Jev planning action');\n const selected = answers.action.choice;\n const choice = choices.get(selected);\n assert(choice, `Unknown Jev planning choice: ${selected}`);\n return {\n selected,\n choice,\n response,\n target: locateInPlanning ? answers.target : undefined,\n };\n}\n\nexport type JevActionDecision = Awaited<ReturnType<typeof decideJevAction>>;\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","decideJevAction","context","options","criteria","choices","Map","action","kind","assert","locateInPlanning","findAllMidsceneLocatorField","response","callSystemOneAI","answers","systemOneResponseSchema","JSON","selected","choice","undefined"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,G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mCAAAA,2BAAAA,AAAAA,EAA4BJ,OAAO,WAAW,EAAE,MAAM;IAE5D,MAAMK,WAAW,MAAMC,AAAAA,IAAAA,yBAAAA,eAAAA,AAAAA,EACrB;QACE,GAAGX,OAAO;QACV,WAAW;YACT,GAAIQ,mBACA;gBACE,QAAQ;oBACN,MAAM;oBACN,cACE;gBACJ;YACF,IACA,CAAC,CAAC;YACN,QAAQ;gBACN,MAAM;gBACN,cACE;gBACFN;YACF;QACF;IACF,GACAD,QAAQ,YAAY,EACpB;QAAE,aAAaA,QAAQ,WAAW;IAAC;IAErC,MAAM,EAAEW,OAAO,EAAE,GAAGC,0BAAAA,uBAAAA,CAAAA,KAA6B,CAC/CC,KAAK,KAAK,CAACJ,SAAS,OAAO;IAE7BH,IAAAA,sBAAAA,MAAAA,AAAAA,EAAOK,AAAwB,aAAxBA,QAAQ,MAAM,CAAC,IAAI,EAAe;IACzC,MAAMG,WAAWH,QAAQ,MAAM,CAAC,MAAM;IACtC,MAAMI,SAASb,QAAQ,GAAG,CAACY;IAC3BR,IAAAA,sBAAAA,MAAAA,AAAAA,EAAOS,QAAQ,CAAC,6BAA6B,EAAED,UAAU;IACzD,OAAO;QACLA;QACAC;QACAN;QACA,QAAQF,mBAAmBI,QAAQ,MAAM,GAAGK;IAC9C;AACF"}
|
|
@@ -27,139 +27,27 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
27
27
|
jevPlan: ()=>jevPlan
|
|
28
28
|
});
|
|
29
29
|
const external_common_js_namespaceObject = require("../../../common.js");
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const standard_planning_js_namespaceObject = require("../../workflows/planning/standard-planning.js");
|
|
34
|
-
const external_image_js_namespaceObject = require("./image.js");
|
|
30
|
+
const external_planning_action_js_namespaceObject = require("./planning-action.js");
|
|
31
|
+
const external_planning_context_js_namespaceObject = require("./planning-context.js");
|
|
32
|
+
const external_planning_decision_js_namespaceObject = require("./planning-decision.js");
|
|
35
33
|
const jevPlan = async (instruction, options)=>{
|
|
34
|
+
if (options.actionSpace.length + 2 > 255) throw new Error('Jev planning supports at most 253 actions (255 choices including completion and delegation).');
|
|
36
35
|
const history = options.conversationHistory;
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
...usage,
|
|
50
|
-
intent: 'planning'
|
|
51
|
-
}) : void 0,
|
|
52
|
-
modelRouting: {
|
|
53
|
-
requestedModel: options.modelRuntime.config.modelName,
|
|
54
|
-
requestedSlot: options.modelRuntime.config.slot,
|
|
55
|
-
task: 'planning',
|
|
56
|
-
reason
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
const planner = 'custom' === runtime.adapter.planning.kind ? runtime.adapter.planning.planFn : standard_planning_js_namespaceObject.standardPlan;
|
|
60
|
-
return planner(instruction, {
|
|
61
|
-
...options,
|
|
62
|
-
modelRuntime: runtime,
|
|
63
|
-
includeLocateInPlanning: false
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
const image = await (0, external_image_js_namespaceObject.prepareJevImage)(options.context.screenshot.base64);
|
|
67
|
-
const references = await Promise.all(instruction.referenceImages.map(async (reference, index)=>({
|
|
68
|
-
key: `reference_${index}`,
|
|
69
|
-
name: reference.name,
|
|
70
|
-
image: await (0, external_image_js_namespaceObject.prepareJevImage)(reference.url)
|
|
71
|
-
})));
|
|
72
|
-
const state = {
|
|
73
|
-
goal: instruction.text,
|
|
74
|
-
context: options.actionContext,
|
|
75
|
-
history: history.historicalLogsToText(),
|
|
76
|
-
memory: history.memoriesToText(),
|
|
77
|
-
feedback: history.pendingFeedbackMessage,
|
|
78
|
-
references: references.map(({ key, name })=>({
|
|
79
|
-
image: `\`${key}\``,
|
|
80
|
-
name
|
|
81
|
-
})),
|
|
82
|
-
availableActions: options.actionSpace.map(({ name, description })=>({
|
|
83
|
-
name,
|
|
84
|
-
description
|
|
85
|
-
}))
|
|
86
|
-
};
|
|
87
|
-
const criteria = {
|
|
88
|
-
Complete: 'The entire user goal is already satisfied, confirmed by the current screenshot and execution feedback. No text answer is requested.',
|
|
89
|
-
Delegate: 'The next step requires text input, generated output, an action or parameters not covered by the other choices. Also use for impossible tasks needing explanation.'
|
|
90
|
-
};
|
|
91
|
-
for (const action of options.actionSpace)if ('Tap' === action.name || 'Scroll' === action.name || 'Sleep' === action.name) criteria[action.name] = 'Sleep' === action.name ? 'Wait 800 ms for a transient loading state.' : action.description ?? action.name;
|
|
92
|
-
const response = await (0, index_js_namespaceObject.callAI)([], options.modelRuntime, {
|
|
93
|
-
abortSignal: options.abortSignal,
|
|
94
|
-
systemOneRequest: {
|
|
95
|
-
state,
|
|
96
|
-
images: {
|
|
97
|
-
screenshot: image.imageBase64,
|
|
98
|
-
...Object.fromEntries(references.map(({ key, image })=>[
|
|
99
|
-
key,
|
|
100
|
-
image.imageBase64
|
|
101
|
-
]))
|
|
102
|
-
},
|
|
103
|
-
questions: {
|
|
104
|
-
action: {
|
|
105
|
-
type: 'choice',
|
|
106
|
-
instructions: 'Choose exactly the next step toward `goal` using the current `screenshot`, context, history and feedback. History records proposed actions; feedback and current screenshot establish what actually happened. Do not repeat completed steps. Reference images describe targets, not the current page.',
|
|
107
|
-
criteria
|
|
108
|
-
},
|
|
109
|
-
...criteria.Scroll ? {
|
|
110
|
-
direction: {
|
|
111
|
-
type: 'choice',
|
|
112
|
-
instructions: 'If scrolling is the next step toward `goal`, which direction reveals the desired off-screen content? Evaluate from the screenshot and history independently of the action question.',
|
|
113
|
-
criteria: {
|
|
114
|
-
down: 'Reveal content below',
|
|
115
|
-
up: 'Reveal content above',
|
|
116
|
-
left: 'Reveal content to the left',
|
|
117
|
-
right: 'Reveal content to the right'
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
} : {}
|
|
121
|
-
}
|
|
36
|
+
const context = await (0, external_planning_context_js_namespaceObject.prepareJevPlanningContext)(instruction, options);
|
|
37
|
+
const decision = await (0, external_planning_decision_js_namespaceObject.decideJevAction)(context, options);
|
|
38
|
+
const { selected, choice, response } = decision;
|
|
39
|
+
if ('delegate' === choice.kind) return {
|
|
40
|
+
actions: [],
|
|
41
|
+
log: `Jev selected ${selected}`,
|
|
42
|
+
rawResponse: response.content,
|
|
43
|
+
usage: response.usage,
|
|
44
|
+
shouldContinuePlanning: true,
|
|
45
|
+
delegation: {
|
|
46
|
+
reason: choice.action ? `The previous planner suggested ${choice.action.name}; delegating planning with this action as an advisory suggestion` : 'The previous planner delegated planning of the next step',
|
|
47
|
+
suggestedAction: choice.action?.name
|
|
122
48
|
}
|
|
123
|
-
});
|
|
124
|
-
const { answers } = system_one_js_namespaceObject.systemOneResponseSchema.parse(JSON.parse(response.content));
|
|
125
|
-
(0, utils_namespaceObject.assert)('choice' === answers.action.type, 'Invalid Jev planning action');
|
|
126
|
-
const selected = answers.action.choice;
|
|
127
|
-
if ('Delegate' === selected) return delegate('The next step requires parameters or output that Jev cannot generate');
|
|
128
|
-
if (('Tap' === selected || 'Scroll' === selected) && options.locateModelRuntime?.config.modelFamily !== 'jev') return delegate("The configured Locate model requires a concrete target description from a general-purpose planner");
|
|
129
|
-
const locate = {
|
|
130
|
-
prompt: `Locate the single ${'Scroll' === selected ? 'scrollable region to scroll' : 'element to tap'} for the NEXT step toward this goal. Use the current screenshot as authoritative. Previous proposals may have failed; use feedback. Task context: ${JSON.stringify(state)}`,
|
|
131
|
-
images: instruction.referenceImages
|
|
132
49
|
};
|
|
133
|
-
const actions = (()
|
|
134
|
-
if ('Complete' === selected) return [];
|
|
135
|
-
if ('Sleep' === selected) return [
|
|
136
|
-
{
|
|
137
|
-
type: 'Sleep',
|
|
138
|
-
param: {
|
|
139
|
-
timeMs: 800
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
];
|
|
143
|
-
if ('Tap' === selected) return [
|
|
144
|
-
{
|
|
145
|
-
type: 'Tap',
|
|
146
|
-
param: {
|
|
147
|
-
locate
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
];
|
|
151
|
-
(0, utils_namespaceObject.assert)('Scroll' === selected && answers.direction?.type === 'choice', 'Invalid Jev scroll action');
|
|
152
|
-
return [
|
|
153
|
-
{
|
|
154
|
-
type: 'Scroll',
|
|
155
|
-
param: {
|
|
156
|
-
locate,
|
|
157
|
-
direction: answers.direction.choice,
|
|
158
|
-
scrollType: 'singleAction'
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
];
|
|
162
|
-
})();
|
|
50
|
+
const actions = (0, external_planning_action_js_namespaceObject.buildJevAction)(decision, context, instruction, options);
|
|
163
51
|
const log = `Jev selected ${selected}`;
|
|
164
52
|
const feedback = history.pendingFeedbackMessage;
|
|
165
53
|
history.resetPendingFeedbackMessageIfExists();
|
|
@@ -184,8 +72,8 @@ const jevPlan = async (instruction, options)=>{
|
|
|
184
72
|
log,
|
|
185
73
|
rawResponse: response.content,
|
|
186
74
|
usage: response.usage,
|
|
187
|
-
shouldContinuePlanning: '
|
|
188
|
-
...'
|
|
75
|
+
shouldContinuePlanning: 'complete' !== choice.kind,
|
|
76
|
+
...'complete' === choice.kind ? {
|
|
189
77
|
finalizeSuccess: true
|
|
190
78
|
} : {},
|
|
191
79
|
yamlFlow: (0, external_common_js_namespaceObject.buildYamlFlowFromPlans)(actions, options.actionSpace)
|