@e2e-dev/core 0.0.0-stage → 0.0.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/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +28 -2
- package/dist/.build.json +1 -0
- package/dist/agent/act-validation.d.ts +50 -0
- package/dist/agent/act-validation.js +206 -0
- package/dist/agent/act.d.ts +70 -0
- package/dist/agent/act.js +526 -0
- package/dist/agent/action-dispatcher.d.ts +239 -0
- package/dist/agent/action-dispatcher.js +834 -0
- package/dist/agent/action-names.d.ts +36 -0
- package/dist/agent/action-names.js +99 -0
- package/dist/agent/actions.d.ts +186 -0
- package/dist/agent/actions.js +269 -0
- package/dist/agent/agent-brand.d.ts +13 -0
- package/dist/agent/agent-brand.js +10 -0
- package/dist/agent/ai-sdk.d.ts +33 -0
- package/dist/agent/ai-sdk.js +83 -0
- package/dist/agent/call-options.d.ts +9 -0
- package/dist/agent/call-options.js +27 -0
- package/dist/agent/default-agent.d.ts +37 -0
- package/dist/agent/default-agent.js +243 -0
- package/dist/agent/derived.d.ts +59 -0
- package/dist/agent/derived.js +125 -0
- package/dist/agent/error.d.ts +76 -0
- package/dist/agent/error.js +129 -0
- package/dist/agent/executor.d.ts +583 -0
- package/dist/agent/executor.js +54 -0
- package/dist/agent/index.d.ts +14 -0
- package/dist/agent/index.js +357 -0
- package/dist/agent/invocation.d.ts +209 -0
- package/dist/agent/invocation.js +319 -0
- package/dist/agent/ledger.d.ts +40 -0
- package/dist/agent/ledger.js +78 -0
- package/dist/agent/loop-guards.d.ts +86 -0
- package/dist/agent/loop-guards.js +186 -0
- package/dist/agent/message-shape.d.ts +14 -0
- package/dist/agent/message-shape.js +30 -0
- package/dist/agent/model/adapter.d.ts +106 -0
- package/dist/agent/model/adapter.js +39 -0
- package/dist/agent/model/overflow.d.ts +19 -0
- package/dist/agent/model/overflow.js +81 -0
- package/dist/agent/model/provider-hints.d.ts +64 -0
- package/dist/agent/model/provider-hints.js +125 -0
- package/dist/agent/model/schema.d.ts +19 -0
- package/dist/agent/model/schema.js +82 -0
- package/dist/agent/model/sdk.d.ts +83 -0
- package/dist/agent/model/sdk.js +361 -0
- package/dist/agent/model/stall.d.ts +10 -0
- package/dist/agent/model/stall.js +52 -0
- package/dist/agent/model/tool-choice.d.ts +53 -0
- package/dist/agent/model/tool-choice.js +90 -0
- package/dist/agent/observation-budget.d.ts +28 -0
- package/dist/agent/observation-budget.js +46 -0
- package/dist/agent/observation-feed.d.ts +193 -0
- package/dist/agent/observation-feed.js +443 -0
- package/dist/agent/observation.d.ts +268 -0
- package/dist/agent/observation.js +584 -0
- package/dist/agent/operation-queue.d.ts +20 -0
- package/dist/agent/operation-queue.js +26 -0
- package/dist/agent/phases.d.ts +75 -0
- package/dist/agent/phases.js +144 -0
- package/dist/agent/pixels.d.ts +21 -0
- package/dist/agent/pixels.js +52 -0
- package/dist/agent/point-tap.d.ts +87 -0
- package/dist/agent/point-tap.js +137 -0
- package/dist/agent/primitives.d.ts +105 -0
- package/dist/agent/primitives.js +803 -0
- package/dist/agent/prompts.d.ts +63 -0
- package/dist/agent/prompts.js +147 -0
- package/dist/agent/protocol.d.ts +67 -0
- package/dist/agent/protocol.js +165 -0
- package/dist/agent/public.d.ts +20 -0
- package/dist/agent/public.js +19 -0
- package/dist/agent/reading.d.ts +65 -0
- package/dist/agent/reading.js +169 -0
- package/dist/agent/redaction.d.ts +4 -0
- package/dist/agent/redaction.js +20 -0
- package/dist/agent/replay.d.ts +105 -0
- package/dist/agent/replay.js +490 -0
- package/dist/agent/sample-files.d.ts +16 -0
- package/dist/agent/sample-files.js +66 -0
- package/dist/agent/screen-update.d.ts +114 -0
- package/dist/agent/screen-update.js +338 -0
- package/dist/agent/scroll-target.d.ts +24 -0
- package/dist/agent/scroll-target.js +53 -0
- package/dist/agent/secrets.d.ts +19 -0
- package/dist/agent/secrets.js +40 -0
- package/dist/agent/settle-policy.d.ts +55 -0
- package/dist/agent/settle-policy.js +75 -0
- package/dist/agent/step-accounting.d.ts +110 -0
- package/dist/agent/step-accounting.js +224 -0
- package/dist/agent/step-cache.d.ts +263 -0
- package/dist/agent/step-cache.js +707 -0
- package/dist/agent/tool-loop.d.ts +88 -0
- package/dist/agent/tool-loop.js +799 -0
- package/dist/agent/tool-output.d.ts +30 -0
- package/dist/agent/tool-output.js +59 -0
- package/dist/agent/tool.d.ts +37 -0
- package/dist/agent/tool.js +59 -0
- package/dist/agent/transcript-compaction.d.ts +37 -0
- package/dist/agent/transcript-compaction.js +185 -0
- package/dist/agent/upload-paths.d.ts +28 -0
- package/dist/agent/upload-paths.js +68 -0
- package/dist/agent/usage.d.ts +47 -0
- package/dist/agent/usage.js +91 -0
- package/dist/cache/anchors.d.ts +103 -0
- package/dist/cache/anchors.js +339 -0
- package/dist/cache/context.d.ts +164 -0
- package/dist/cache/context.js +202 -0
- package/dist/cache/decide.d.ts +39 -0
- package/dist/cache/decide.js +37 -0
- package/dist/cache/identity.d.ts +135 -0
- package/dist/cache/identity.js +140 -0
- package/dist/cache/recorder.d.ts +103 -0
- package/dist/cache/recorder.js +290 -0
- package/dist/cache/rekeyed.d.ts +49 -0
- package/dist/cache/rekeyed.js +91 -0
- package/dist/cache/relocate.d.ts +107 -0
- package/dist/cache/relocate.js +258 -0
- package/dist/cache/route.d.ts +51 -0
- package/dist/cache/route.js +171 -0
- package/dist/cache/store.d.ts +76 -0
- package/dist/cache/store.js +121 -0
- package/dist/cache/template.d.ts +83 -0
- package/dist/cache/template.js +254 -0
- package/dist/cache/trace-fields.d.ts +10 -0
- package/dist/cache/trace-fields.js +17 -0
- package/dist/cache/trace-read.d.ts +15 -0
- package/dist/cache/trace-read.js +458 -0
- package/dist/cache/trace.d.ts +411 -0
- package/dist/cache/trace.js +267 -0
- package/dist/config/agent.d.ts +103 -0
- package/dist/config/agent.js +314 -0
- package/dist/config/app.d.ts +139 -0
- package/dist/config/app.js +231 -0
- package/dist/config/command.d.ts +47 -0
- package/dist/config/command.js +125 -0
- package/dist/config/resolve.d.ts +140 -0
- package/dist/config/resolve.js +773 -0
- package/dist/config/secrets.d.ts +96 -0
- package/dist/config/secrets.js +47 -0
- package/dist/config/targets.d.ts +98 -0
- package/dist/config/targets.js +136 -0
- package/dist/config/validate.d.ts +18 -0
- package/dist/config/validate.js +68 -0
- package/dist/core/agent.d.ts +72 -0
- package/dist/core/agent.js +126 -0
- package/dist/core/index.d.ts +11 -0
- package/dist/core/index.js +9 -0
- package/dist/core/internals.d.ts +43 -0
- package/dist/core/internals.js +54 -0
- package/dist/core/launch.d.ts +100 -0
- package/dist/core/launch.js +224 -0
- package/dist/core/signals.d.ts +22 -0
- package/dist/core/signals.js +74 -0
- package/dist/core/state.d.ts +55 -0
- package/dist/core/state.js +170 -0
- package/dist/engine/computed-style.d.ts +7 -0
- package/dist/engine/computed-style.js +16 -0
- package/dist/engine/contract.d.ts +395 -0
- package/dist/engine/contract.js +167 -0
- package/dist/engine/index.d.ts +886 -0
- package/dist/engine/index.js +48 -0
- package/dist/engine/manifest.d.ts +39 -0
- package/dist/engine/manifest.js +323 -0
- package/dist/engine/protocol/client.d.ts +77 -0
- package/dist/engine/protocol/client.js +509 -0
- package/dist/engine/protocol/connection.d.ts +77 -0
- package/dist/engine/protocol/connection.js +238 -0
- package/dist/engine/protocol/manifest.d.ts +22 -0
- package/dist/engine/protocol/manifest.js +77 -0
- package/dist/engine/protocol/protocol.d.ts +188 -0
- package/dist/engine/protocol/protocol.js +185 -0
- package/dist/engine/protocol/server.d.ts +21 -0
- package/dist/engine/protocol/server.js +241 -0
- package/dist/engine/protocol/transport.d.ts +73 -0
- package/dist/engine/protocol/transport.js +123 -0
- package/dist/engine/recording.d.ts +77 -0
- package/dist/engine/recording.js +96 -0
- package/dist/engine/resolve.d.ts +36 -0
- package/dist/engine/resolve.js +176 -0
- package/dist/engine/session.d.ts +36 -0
- package/dist/engine/session.js +459 -0
- package/dist/engine/surface.d.ts +187 -0
- package/dist/engine/surface.js +10 -0
- package/dist/engine/timing.d.ts +2 -0
- package/dist/engine/timing.js +7 -0
- package/dist/expect/attempt.d.ts +25 -0
- package/dist/expect/attempt.js +33 -0
- package/dist/expect/poll-scope.d.ts +60 -0
- package/dist/expect/poll-scope.js +131 -0
- package/dist/expect/samples.d.ts +40 -0
- package/dist/expect/samples.js +85 -0
- package/dist/expect/soft.d.ts +30 -0
- package/dist/expect/soft.js +89 -0
- package/dist/internal/abandoned.d.ts +25 -0
- package/dist/internal/abandoned.js +43 -0
- package/dist/internal/ai-trace.d.ts +151 -0
- package/dist/internal/ai-trace.js +460 -0
- package/dist/internal/atomic-write.d.ts +16 -0
- package/dist/internal/atomic-write.js +43 -0
- package/dist/internal/brands.d.ts +15 -0
- package/dist/internal/brands.js +29 -0
- package/dist/internal/client-identity.d.ts +9 -0
- package/dist/internal/client-identity.js +14 -0
- package/dist/internal/dates.d.ts +9 -0
- package/dist/internal/dates.js +13 -0
- package/dist/internal/debug.d.ts +42 -0
- package/dist/internal/debug.js +101 -0
- package/dist/internal/env.d.ts +5 -0
- package/dist/internal/env.js +11 -0
- package/dist/internal/errors.d.ts +192 -0
- package/dist/internal/errors.js +400 -0
- package/dist/internal/expected-failure.d.ts +24 -0
- package/dist/internal/expected-failure.js +52 -0
- package/dist/internal/geometry.d.ts +37 -0
- package/dist/internal/geometry.js +72 -0
- package/dist/internal/globs.d.ts +68 -0
- package/dist/internal/globs.js +236 -0
- package/dist/internal/ids.d.ts +37 -0
- package/dist/internal/ids.js +129 -0
- package/dist/internal/image.d.ts +64 -0
- package/dist/internal/image.js +231 -0
- package/dist/internal/json-value.d.ts +14 -0
- package/dist/internal/json-value.js +60 -0
- package/dist/internal/keys.d.ts +3 -0
- package/dist/internal/keys.js +11 -0
- package/dist/internal/objects.d.ts +20 -0
- package/dist/internal/objects.js +13 -0
- package/dist/internal/options.d.ts +28 -0
- package/dist/internal/options.js +63 -0
- package/dist/internal/package-version.d.ts +7 -0
- package/dist/internal/package-version.js +22 -0
- package/dist/internal/paths.d.ts +36 -0
- package/dist/internal/paths.js +88 -0
- package/dist/internal/realm-slot.d.ts +13 -0
- package/dist/internal/realm-slot.js +22 -0
- package/dist/internal/recording-modes.d.ts +83 -0
- package/dist/internal/recording-modes.js +77 -0
- package/dist/internal/redact.d.ts +115 -0
- package/dist/internal/redact.js +648 -0
- package/dist/internal/regexp.d.ts +9 -0
- package/dist/internal/regexp.js +26 -0
- package/dist/internal/roles.d.ts +16 -0
- package/dist/internal/roles.js +39 -0
- package/dist/internal/source.d.ts +31 -0
- package/dist/internal/source.js +69 -0
- package/dist/internal/standard-schema.d.ts +6 -0
- package/dist/internal/standard-schema.js +16 -0
- package/dist/internal/suggest.d.ts +19 -0
- package/dist/internal/suggest.js +76 -0
- package/dist/internal/text.d.ts +60 -0
- package/dist/internal/text.js +95 -0
- package/dist/internal/time.d.ts +142 -0
- package/dist/internal/time.js +290 -0
- package/dist/internal/unserved-model.d.ts +5 -0
- package/dist/internal/unserved-model.js +22 -0
- package/dist/internal/urls.d.ts +70 -0
- package/dist/internal/urls.js +212 -0
- package/dist/locator/engine.d.ts +227 -0
- package/dist/locator/engine.js +600 -0
- package/dist/locator/expression.d.ts +40 -0
- package/dist/locator/expression.js +173 -0
- package/dist/locator/screen.d.ts +47 -0
- package/dist/locator/screen.js +574 -0
- package/dist/params.d.ts +21 -0
- package/dist/params.js +27 -0
- package/dist/run/artifacts.d.ts +95 -0
- package/dist/run/artifacts.js +325 -0
- package/dist/run/budget.d.ts +38 -0
- package/dist/run/budget.js +65 -0
- package/dist/run/declared-processes.d.ts +20 -0
- package/dist/run/declared-processes.js +22 -0
- package/dist/run/engine-sessions.d.ts +147 -0
- package/dist/run/engine-sessions.js +300 -0
- package/dist/run/fixture-recording.d.ts +24 -0
- package/dist/run/fixture-recording.js +104 -0
- package/dist/run/fixtures.d.ts +110 -0
- package/dist/run/fixtures.js +429 -0
- package/dist/run/managed-process.d.ts +113 -0
- package/dist/run/managed-process.js +445 -0
- package/dist/run/output.d.ts +28 -0
- package/dist/run/output.js +17 -0
- package/dist/run/process-pool.d.ts +40 -0
- package/dist/run/process-pool.js +110 -0
- package/dist/run/provision.d.ts +142 -0
- package/dist/run/provision.js +236 -0
- package/dist/run/recordings.d.ts +51 -0
- package/dist/run/recordings.js +131 -0
- package/dist/run/records.d.ts +267 -0
- package/dist/run/records.js +77 -0
- package/dist/run/redact-opening.d.ts +3 -0
- package/dist/run/redact-opening.js +23 -0
- package/dist/run/screenshots.d.ts +54 -0
- package/dist/run/screenshots.js +42 -0
- package/dist/run/secrecy.d.ts +78 -0
- package/dist/run/secrecy.js +131 -0
- package/dist/run/sessions.d.ts +76 -0
- package/dist/run/sessions.js +298 -0
- package/dist/run/standalone-attempt.d.ts +145 -0
- package/dist/run/standalone-attempt.js +198 -0
- package/dist/run/standalone.d.ts +47 -0
- package/dist/run/standalone.js +196 -0
- package/dist/run/step-screens.d.ts +53 -0
- package/dist/run/step-screens.js +102 -0
- package/dist/run/steps.d.ts +483 -0
- package/dist/run/steps.js +506 -0
- package/dist/run/worker-models.d.ts +29 -0
- package/dist/run/worker-models.js +66 -0
- package/dist/secrets.d.ts +50 -0
- package/dist/secrets.js +146 -0
- package/dist/types.d.ts +1488 -0
- package/dist/types.js +5 -0
- package/package.json +81 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
package/README.md
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @e2e-dev/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Drive a browser or a native app from code. `@e2e-dev/core` is the
|
|
4
|
+
[e2e](https://github.com/e2e-inc/e2e) engines without the test runner: no
|
|
5
|
+
config file, no report, no `expect`. An optional
|
|
6
|
+
agent acts on the screen from plain-language instructions. The test runner,
|
|
7
|
+
`e2e`, is built on it, and the engines peer on it.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @e2e-dev/core @e2e-dev/web
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { launch } from '@e2e-dev/core';
|
|
15
|
+
import { web } from '@e2e-dev/web/engine';
|
|
16
|
+
|
|
17
|
+
await using shop = await launch(web(), { app: { url: 'https://shop.example.com' } });
|
|
18
|
+
await using session = await shop.newSession();
|
|
19
|
+
await session.app.open('/products/A-1001');
|
|
20
|
+
const price = await session.screen.getByTestId('sale-price').textContent();
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The same code drives an iOS or Android app with `mobile()` from
|
|
24
|
+
`@e2e-dev/mobile/engine`. See [the @e2e-dev/core guide](https://e2e.com/docs/core)
|
|
25
|
+
for sessions, saved state, secrets, and the agent with its replay cache.
|
|
26
|
+
|
|
27
|
+
The entries are `@e2e-dev/core`, `@e2e-dev/core/agent`, and
|
|
28
|
+
`@e2e-dev/core/engine`. Everything under `@e2e-dev/core/lib/*` is internal to
|
|
29
|
+
`e2e` and the engines, and may change in any release.
|
package/dist/.build.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":"0.0.0"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input and verdict validation for the act dispatch (spec 02, 16). Pure
|
|
3
|
+
* functions with no dispatch state: everything a step's arguments and an
|
|
4
|
+
* executor's verdict must satisfy before the harness trusts them.
|
|
5
|
+
*/
|
|
6
|
+
import { type ParamTemplate } from '../cache/template.ts';
|
|
7
|
+
import type { ActOptions, AgentParams, JsonValue, Secret } from '../types.ts';
|
|
8
|
+
import { type StepVerdict } from './executor.ts';
|
|
9
|
+
/** Spec 02: canonical non-secret parameters are capped at 64 KiB, 32 levels. */
|
|
10
|
+
export declare const MAX_PARAMS_BYTES = 65536;
|
|
11
|
+
/** Normalizes and bounds the instruction per spec 02. */
|
|
12
|
+
export declare function validateInstruction(instruction: string, api: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* The `act` type has no `schema` and no `vision`, and no key outside
|
|
15
|
+
* `ActOptions`; a caller outside the type checker who passes one still fails
|
|
16
|
+
* loudly instead of being silently ignored. The pre-0.8 shapes land here too: `act(instruction,
|
|
17
|
+
* params)` arrives as an options bag of the caller's own keys, and
|
|
18
|
+
* `act(instruction, params, options)` as a third argument.
|
|
19
|
+
*/
|
|
20
|
+
export declare function validateActOptions(options: ActOptions | undefined, extraArguments: number): void;
|
|
21
|
+
/**
|
|
22
|
+
* Validates parameters and returns an inert, secret-free snapshot plus what
|
|
23
|
+
* the walk found in it: the declared secrets and the `unique()` values. A
|
|
24
|
+
* `Secret` is projected to `{ kind: 'secret', name, purpose }` — its
|
|
25
|
+
* plaintext never enters the snapshot, the prompt, or any log — and is
|
|
26
|
+
* fillable only through `actions.typeSecret`. A `Unique` is projected to its
|
|
27
|
+
* string, so the model and the executor see a plain value, and is listed by
|
|
28
|
+
* JSON Pointer for the trace cache to template. The JSON round-trip is
|
|
29
|
+
* deliberate: it bounds the canonical size (spec 02) and freezes what the
|
|
30
|
+
* executor sees, so a getter or proxy cannot change values — or run code —
|
|
31
|
+
* during later serialization. `api` names the call in error messages.
|
|
32
|
+
*/
|
|
33
|
+
export declare function validateParams(params: AgentParams | undefined, api: string): {
|
|
34
|
+
projected: Readonly<Record<string, JsonValue>> | undefined;
|
|
35
|
+
secrets: ReadonlyMap<string, Secret>;
|
|
36
|
+
templates: readonly ParamTemplate[];
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Projected params with `redact` applied to every string in them, object
|
|
40
|
+
* keys included, and their `unique()` templates moved with their leaves: a
|
|
41
|
+
* template's pointer follows the redacted keys and its value is redacted as
|
|
42
|
+
* the leaf is, so the trace cache slots what the params hold. `api` names
|
|
43
|
+
* the call in error messages.
|
|
44
|
+
*/
|
|
45
|
+
export declare function redactParams(params: Readonly<Record<string, JsonValue>>, templates: readonly ParamTemplate[], redact: (text: string) => string, api: string): {
|
|
46
|
+
params: Readonly<Record<string, JsonValue>>;
|
|
47
|
+
templates: readonly ParamTemplate[];
|
|
48
|
+
};
|
|
49
|
+
/** Closes the verdict grammar: the executor cannot invent statuses or codes. */
|
|
50
|
+
export declare function validateVerdict(verdict: unknown, executorName: string): StepVerdict;
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input and verdict validation for the act dispatch (spec 02, 16). Pure
|
|
3
|
+
* functions with no dispatch state: everything a step's arguments and an
|
|
4
|
+
* executor's verdict must satisfy before the harness trusts them.
|
|
5
|
+
*/
|
|
6
|
+
import { ConfigurationError, TestError } from '../internal/errors.js';
|
|
7
|
+
import { validateJsonValue } from '../internal/json-value.js';
|
|
8
|
+
import { paramPointer } from '../cache/template.js';
|
|
9
|
+
import { isSecret } from '../secrets.js';
|
|
10
|
+
import { isUnique } from '../params.js';
|
|
11
|
+
import { AgentError, CATEGORY_BY_CODE } from './error.js';
|
|
12
|
+
import { BLOCKABLE_CODES } from './executor.js';
|
|
13
|
+
const MAX_SUMMARY_CHARS = 2_000;
|
|
14
|
+
/** Spec 02: instructions are 1 through 8 KiB UTF-8 after NFC. */
|
|
15
|
+
const MAX_INSTRUCTION_BYTES = 8_192;
|
|
16
|
+
/** Spec 02: canonical non-secret parameters are capped at 64 KiB, 32 levels. */
|
|
17
|
+
export const MAX_PARAMS_BYTES = 65_536;
|
|
18
|
+
const MAX_PARAMS_DEPTH = 32;
|
|
19
|
+
/** Normalizes and bounds the instruction per spec 02. */
|
|
20
|
+
export function validateInstruction(instruction, api) {
|
|
21
|
+
if (typeof instruction !== 'string' || instruction.trim() === '') {
|
|
22
|
+
throw new TestError('INVALID_ARGUMENT', `${api} requires a non-empty instruction`);
|
|
23
|
+
}
|
|
24
|
+
const normalized = instruction.normalize('NFC');
|
|
25
|
+
const bytes = new TextEncoder().encode(normalized).byteLength;
|
|
26
|
+
if (bytes > MAX_INSTRUCTION_BYTES) {
|
|
27
|
+
throw new TestError('INVALID_ARGUMENT', `${api} instruction is ${bytes} bytes; the maximum is ${MAX_INSTRUCTION_BYTES}`);
|
|
28
|
+
}
|
|
29
|
+
return normalized;
|
|
30
|
+
}
|
|
31
|
+
const ACT_OPTION_KEYS = new Set(['params', 'timeout', 'maxSteps', 'maxModelCalls', 'agent', 'onAction', 'onBeforeAction']);
|
|
32
|
+
/**
|
|
33
|
+
* The `act` type has no `schema` and no `vision`, and no key outside
|
|
34
|
+
* `ActOptions`; a caller outside the type checker who passes one still fails
|
|
35
|
+
* loudly instead of being silently ignored. The pre-0.8 shapes land here too: `act(instruction,
|
|
36
|
+
* params)` arrives as an options bag of the caller's own keys, and
|
|
37
|
+
* `act(instruction, params, options)` as a third argument.
|
|
38
|
+
*/
|
|
39
|
+
export function validateActOptions(options, extraArguments) {
|
|
40
|
+
if (extraArguments > 0) {
|
|
41
|
+
throw new TestError('INVALID_ARGUMENT', 'agent.act takes two arguments: act(instruction, { params, timeout, maxSteps, maxModelCalls })');
|
|
42
|
+
}
|
|
43
|
+
if (options === undefined)
|
|
44
|
+
return;
|
|
45
|
+
if (typeof options !== 'object' || options === null || Array.isArray(options)) {
|
|
46
|
+
throw new TestError('INVALID_ARGUMENT', 'agent.act options must be a plain object');
|
|
47
|
+
}
|
|
48
|
+
const loose = options;
|
|
49
|
+
if (loose.schema !== undefined) {
|
|
50
|
+
throw new ConfigurationError('UNSUPPORTED_CAPABILITY', 'agent.act structured output (options.schema) is not part of this milestone');
|
|
51
|
+
}
|
|
52
|
+
if (loose.vision !== undefined) {
|
|
53
|
+
throw new ConfigurationError('UNSUPPORTED_CAPABILITY', 'agent.act takes no vision option: the model works from the tree and asks for a screenshot itself when the tree lacks what it needs; vision is a judgment option (assert, waitFor, extract)');
|
|
54
|
+
}
|
|
55
|
+
const onBeforeAction = options.onBeforeAction;
|
|
56
|
+
if (onBeforeAction !== undefined && typeof onBeforeAction !== 'function') {
|
|
57
|
+
throw new TestError('INVALID_ARGUMENT', 'agent.act options.onBeforeAction must be a function');
|
|
58
|
+
}
|
|
59
|
+
const onAction = options.onAction;
|
|
60
|
+
if (onAction !== undefined && typeof onAction !== 'function') {
|
|
61
|
+
throw new TestError('INVALID_ARGUMENT', 'agent.act options.onAction must be a function');
|
|
62
|
+
}
|
|
63
|
+
const unknown = Object.keys(options).filter((key) => !ACT_OPTION_KEYS.has(key));
|
|
64
|
+
if (unknown.length > 0) {
|
|
65
|
+
const listed = unknown.map((key) => JSON.stringify(key)).join(', ');
|
|
66
|
+
throw new TestError('INVALID_ARGUMENT', `agent.act options has no ${unknown.length === 1 ? 'key' : 'keys'} ${listed}; the values an instruction refers to go under params: act(instruction, { params: { ${unknown.join(', ')} } })`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Validates parameters and returns an inert, secret-free snapshot plus what
|
|
71
|
+
* the walk found in it: the declared secrets and the `unique()` values. A
|
|
72
|
+
* `Secret` is projected to `{ kind: 'secret', name, purpose }` — its
|
|
73
|
+
* plaintext never enters the snapshot, the prompt, or any log — and is
|
|
74
|
+
* fillable only through `actions.typeSecret`. A `Unique` is projected to its
|
|
75
|
+
* string, so the model and the executor see a plain value, and is listed by
|
|
76
|
+
* JSON Pointer for the trace cache to template. The JSON round-trip is
|
|
77
|
+
* deliberate: it bounds the canonical size (spec 02) and freezes what the
|
|
78
|
+
* executor sees, so a getter or proxy cannot change values — or run code —
|
|
79
|
+
* during later serialization. `api` names the call in error messages.
|
|
80
|
+
*/
|
|
81
|
+
export function validateParams(params, api) {
|
|
82
|
+
if (params === undefined)
|
|
83
|
+
return { projected: undefined, secrets: new Map(), templates: [] };
|
|
84
|
+
if (typeof params !== 'object' || params === null || Array.isArray(params)) {
|
|
85
|
+
throw new TestError('INVALID_ARGUMENT', `${api} params must be a plain object`);
|
|
86
|
+
}
|
|
87
|
+
const found = { secrets: new Map(), templates: [] };
|
|
88
|
+
const projectedRaw = projectParams(params, '', found, new Set(), api);
|
|
89
|
+
validateJsonValue(projectedRaw, `${api} params`, { maxDepth: MAX_PARAMS_DEPTH });
|
|
90
|
+
const canonical = JSON.stringify(projectedRaw);
|
|
91
|
+
const bytes = new TextEncoder().encode(canonical).byteLength;
|
|
92
|
+
if (bytes > MAX_PARAMS_BYTES) {
|
|
93
|
+
throw new TestError('INVALID_ARGUMENT', `${api} params are ${bytes} canonical bytes; the maximum is ${MAX_PARAMS_BYTES}`);
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
// oxlint-disable-next-line e2e/no-unchecked-json -- canonical is this function's own JSON.stringify of a plain object validateJsonValue just checked
|
|
97
|
+
projected: JSON.parse(canonical),
|
|
98
|
+
secrets: found.secrets,
|
|
99
|
+
templates: found.templates,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Projected params with `redact` applied to every string in them, object
|
|
104
|
+
* keys included, and their `unique()` templates moved with their leaves: a
|
|
105
|
+
* template's pointer follows the redacted keys and its value is redacted as
|
|
106
|
+
* the leaf is, so the trace cache slots what the params hold. `api` names
|
|
107
|
+
* the call in error messages.
|
|
108
|
+
*/
|
|
109
|
+
export function redactParams(params, templates, redact, api) {
|
|
110
|
+
const pointers = new Map();
|
|
111
|
+
const redacted = redactJson(params, redact, { from: '', to: '' }, pointers, api);
|
|
112
|
+
return {
|
|
113
|
+
params: redacted,
|
|
114
|
+
templates: templates.map((template) => ({
|
|
115
|
+
pointer: pointers.get(template.pointer) ?? template.pointer,
|
|
116
|
+
value: redact(template.value),
|
|
117
|
+
})),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* `value` with `redact` applied to every string in it, object keys included.
|
|
122
|
+
* Records in `pointers` where each node's pointer (`at.from`) lands once its
|
|
123
|
+
* keys are redacted (`at.to`). Two keys of one object that redact alike would
|
|
124
|
+
* leave one value standing for both, so that is `INVALID_ARGUMENT`.
|
|
125
|
+
*/
|
|
126
|
+
function redactJson(value, redact, at, pointers, api) {
|
|
127
|
+
pointers.set(at.from, at.to);
|
|
128
|
+
if (typeof value === 'string')
|
|
129
|
+
return redact(value);
|
|
130
|
+
if (Array.isArray(value)) {
|
|
131
|
+
return value.map((entry, index) => redactJson(entry, redact, { from: paramPointer(at.from, index), to: paramPointer(at.to, index) }, pointers, api));
|
|
132
|
+
}
|
|
133
|
+
if (typeof value !== 'object' || value === null)
|
|
134
|
+
return value;
|
|
135
|
+
const out = {};
|
|
136
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
137
|
+
const clean = redact(key);
|
|
138
|
+
if (Object.hasOwn(out, clean)) {
|
|
139
|
+
throw new TestError('INVALID_ARGUMENT', `${api} params has two keys that read ${JSON.stringify(clean)} once secret values are redacted; a key cannot be told apart by a secret`);
|
|
140
|
+
}
|
|
141
|
+
// Defined, not assigned, so a `__proto__` key stays an own property.
|
|
142
|
+
Object.defineProperty(out, clean, {
|
|
143
|
+
value: redactJson(entry, redact, { from: paramPointer(at.from, key), to: paramPointer(at.to, clean) }, pointers, api),
|
|
144
|
+
enumerable: true,
|
|
145
|
+
writable: true,
|
|
146
|
+
configurable: true,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
return out;
|
|
150
|
+
}
|
|
151
|
+
/** Replaces every Secret leaf with its placeholder and every Unique leaf with its value, collecting both. */
|
|
152
|
+
function projectParams(value, pointer, found, seen, api) {
|
|
153
|
+
if (isSecret(value)) {
|
|
154
|
+
found.secrets.set(value.name, value);
|
|
155
|
+
return { kind: 'secret', name: value.name, purpose: value.purpose };
|
|
156
|
+
}
|
|
157
|
+
if (isUnique(value)) {
|
|
158
|
+
found.templates.push({ pointer, value: value.value });
|
|
159
|
+
return value.value;
|
|
160
|
+
}
|
|
161
|
+
if (typeof value !== 'object' || value === null)
|
|
162
|
+
return value;
|
|
163
|
+
if (seen.has(value)) {
|
|
164
|
+
throw new TestError('INVALID_ARGUMENT', `${api} params contains a cycle`);
|
|
165
|
+
}
|
|
166
|
+
seen.add(value);
|
|
167
|
+
if (Array.isArray(value)) {
|
|
168
|
+
return value.map((entry, index) => projectParams(entry, paramPointer(pointer, index), found, seen, api));
|
|
169
|
+
}
|
|
170
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, projectParams(entry, paramPointer(pointer, key), found, seen, api)]));
|
|
171
|
+
}
|
|
172
|
+
/** Closes the verdict grammar: the executor cannot invent statuses or codes. */
|
|
173
|
+
export function validateVerdict(verdict, executorName) {
|
|
174
|
+
const invalid = (issue) => {
|
|
175
|
+
throw new AgentError('MODEL_OUTPUT_INVALID', `executor "${executorName}" returned an invalid verdict: ${issue}`);
|
|
176
|
+
};
|
|
177
|
+
if (typeof verdict !== 'object' || verdict === null)
|
|
178
|
+
return invalid('not an object');
|
|
179
|
+
const candidate = verdict;
|
|
180
|
+
const status = candidate['status'];
|
|
181
|
+
if (status !== 'passed' && status !== 'failed' && status !== 'blocked') {
|
|
182
|
+
return invalid(`status must be passed, failed, or blocked, got ${JSON.stringify(status)}`);
|
|
183
|
+
}
|
|
184
|
+
const summary = candidate['summary'];
|
|
185
|
+
if (typeof summary !== 'string' || summary.trim() === '') {
|
|
186
|
+
return invalid('summary must be a non-empty string');
|
|
187
|
+
}
|
|
188
|
+
const errorCode = candidate['errorCode'];
|
|
189
|
+
if (errorCode !== undefined) {
|
|
190
|
+
if (typeof errorCode !== 'string' || !(errorCode in CATEGORY_BY_CODE)) {
|
|
191
|
+
return invalid(`unknown errorCode ${JSON.stringify(errorCode)}`);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
const code = errorCode;
|
|
195
|
+
if (status === 'passed' && code !== undefined) {
|
|
196
|
+
return invalid('a passed verdict cannot carry an errorCode');
|
|
197
|
+
}
|
|
198
|
+
if (status === 'blocked' && (code === undefined || !BLOCKABLE_CODES.has(code))) {
|
|
199
|
+
return invalid(`blocked requires a blockable errorCode (one of ${[...BLOCKABLE_CODES].join(', ')})`);
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
status,
|
|
203
|
+
summary: summary.trim().slice(0, MAX_SUMMARY_CHARS),
|
|
204
|
+
...(code === undefined ? {} : { errorCode: code }),
|
|
205
|
+
};
|
|
206
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Harness-owned dispatch of one `agent.act()` step.
|
|
3
|
+
*
|
|
4
|
+
* The harness opens the step and hands only the thinking to the configured
|
|
5
|
+
* executor; everything the executor can touch is built here from four
|
|
6
|
+
* collaborators, each owning one concern of the step:
|
|
7
|
+
*
|
|
8
|
+
* - `StepAccounting`: the clock, the budgets, the hard stop, the metrics.
|
|
9
|
+
* - `ObservationFeed`: every capture, the settle, the id ring, the pixel decision.
|
|
10
|
+
* - `ActionDispatcher`: the verb table, target resolution, recording.
|
|
11
|
+
* - `StepTraceSession`: replay, live recording, and the stage-or-evict decision.
|
|
12
|
+
*
|
|
13
|
+
* Capabilities beyond the grammar (secret fills, the trace cache) are modules
|
|
14
|
+
* over those collaborators, borrowed through a small host each. What stays in
|
|
15
|
+
* this file is the wiring, the executor's context, and the mapping of the
|
|
16
|
+
* executor's verdict onto the runner's error taxonomy.
|
|
17
|
+
*/
|
|
18
|
+
import type { ActionHook, ActOptions, AssertOptions, BeforeActionHook, ActResult, AgentErrorCode, JsonValue, Secret, VisionMode } from '../types.ts';
|
|
19
|
+
import type { AgentContext, AgentSelection } from './invocation.ts';
|
|
20
|
+
import type { ParamTemplate } from '../cache/template.ts';
|
|
21
|
+
/** What a dispatch needs of the agent a step runs with; an interactive step supplies its own. */
|
|
22
|
+
export type DispatchAgent = Pick<AgentSelection, 'name' | 'config' | 'executor' | 'agentContext'>;
|
|
23
|
+
/** Everything one dispatched step is, resolved before the step opens. */
|
|
24
|
+
export interface DispatchSpec {
|
|
25
|
+
/** The public API the step ran as, or `session` for a step a host drives from outside the loop. */
|
|
26
|
+
readonly api: 'agent.act' | 'agent.assert' | 'session';
|
|
27
|
+
readonly kind: 'act' | 'assert';
|
|
28
|
+
readonly instruction: string;
|
|
29
|
+
readonly params: Readonly<Record<string, JsonValue>> | undefined;
|
|
30
|
+
/** Secrets declared in the params, by stable name. */
|
|
31
|
+
readonly secrets: ReadonlyMap<string, Secret>;
|
|
32
|
+
/** The `unique()` values in the params, by JSON Pointer; the trace cache templates them. */
|
|
33
|
+
readonly templates: readonly ParamTemplate[];
|
|
34
|
+
/** The code a code-less non-passing verdict maps to. */
|
|
35
|
+
readonly defaultFailureCode: AgentErrorCode;
|
|
36
|
+
readonly timeout: number | undefined;
|
|
37
|
+
readonly maxSteps: number | undefined;
|
|
38
|
+
readonly maxModelCalls: number | undefined;
|
|
39
|
+
/** The configured agent the call named, if any. */
|
|
40
|
+
readonly agent: string | undefined;
|
|
41
|
+
/** Assert only: whether the harness keeps a redacted screenshot after the verdict; `false` opts out. */
|
|
42
|
+
readonly screenshot?: boolean;
|
|
43
|
+
/** Assert only: the `vision` the call asked for; the executor must declare `vision: true` to receive it. */
|
|
44
|
+
readonly vision?: VisionMode;
|
|
45
|
+
/** Act only: the test's hook for each completed action. */
|
|
46
|
+
readonly onAction?: ActionHook | undefined;
|
|
47
|
+
/** Act only: the test's hook before each action. */
|
|
48
|
+
readonly onBeforeAction?: BeforeActionHook | undefined;
|
|
49
|
+
}
|
|
50
|
+
/** Runs one `agent.act()` call as a harness-dispatched executor step. */
|
|
51
|
+
export declare function runActStep(runtime: AgentContext, instruction: string, options: ActOptions | undefined, extraArguments?: number): Promise<ActResult>;
|
|
52
|
+
/**
|
|
53
|
+
* Runs one `agent.assert()` call through the executor socket. Used when a
|
|
54
|
+
* custom executor is configured or exploration is requested. The brain that
|
|
55
|
+
* plans flows also judges assertions, so swapping brains swaps all the thinking. The built-in
|
|
56
|
+
* single-judgment tier remains the default-path implementation. `screenshot`
|
|
57
|
+
* is harness evidence taken after the verdict, so it is honored here as on
|
|
58
|
+
* the default path; `vision` is what the executor's model sees, so it reaches
|
|
59
|
+
* only an executor that declares `vision: true`.
|
|
60
|
+
*/
|
|
61
|
+
export declare function runAssertStep(runtime: AgentContext, assertion: string, options: AssertOptions | undefined): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Opens the step, tries a cached replay, delegates to the executor when the
|
|
64
|
+
* cache misses or diverges, settles the verdict, and hands the outcome to the
|
|
65
|
+
* cache session, which owns the stage-or-evict decision
|
|
66
|
+
* (`StepTraceSession.conclude`). An assert is a verification step: its
|
|
67
|
+
* passing is what confirms the traces staged before it at attempt end
|
|
68
|
+
* (cache/context.ts).
|
|
69
|
+
*/
|
|
70
|
+
export declare function dispatchAgentStep(runtime: AgentContext, raw: DispatchSpec, agent?: DispatchAgent): Promise<ActResult>;
|