@forgeax/engine-tool-runtime 0.1.2
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/README.md +96 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/artifacts.d.ts +76 -0
- package/dist/capability.d.ts +85 -0
- package/dist/carrier.d.ts +68 -0
- package/dist/errors.d.ts +16 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.mjs +1275 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lease.d.ts +16 -0
- package/dist/migration.d.ts +44 -0
- package/dist/runtime.d.ts +10 -0
- package/dist/snapshot.d.ts +3 -0
- package/dist/timing.d.ts +16 -0
- package/dist/transport.d.ts +69 -0
- package/dist/types.d.ts +314 -0
- package/package.json +53 -0
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/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# `@forgeax/engine-tool-runtime`
|
|
2
|
+
|
|
3
|
+
AI tools follow one discoverable proposition: `list -> describe -> run -> terminal`.
|
|
4
|
+
This focused package owns the realm-neutral contract only. A contribution keeps its
|
|
5
|
+
descriptor and executor together, while DevKit and other hosts provide the authority
|
|
6
|
+
and physical realm.
|
|
7
|
+
|
|
8
|
+
Preview descriptors may add a portable `preview` contract containing `realm`, a
|
|
9
|
+
`ToolSubjectRef`, and a `SnapshotRef`; `evidence` remains the required
|
|
10
|
+
`ArtifactRef` kind list. `defineTool` rejects a preview contract whose realm does
|
|
11
|
+
not match its descriptor, so a consumer cannot silently execute in another realm.
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
const tool = defineTool({
|
|
15
|
+
id: 'author.write',
|
|
16
|
+
title: 'Write author state',
|
|
17
|
+
summary: 'Writes one project value.',
|
|
18
|
+
realm: 'build',
|
|
19
|
+
argsSchema,
|
|
20
|
+
resultSchema,
|
|
21
|
+
evidence: [],
|
|
22
|
+
}, async (args, context) => ({ ok: true, value: await write(args, context.signal) }));
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Terminal payloads contain only typed results, serialized `snapshotAfter`, `ArtifactRef`
|
|
26
|
+
values, and an optional `ToolCleanupReport`. A live handle, canvas, renderer, page,
|
|
27
|
+
Fiber, or carrier is never part of the portable contract. Providers call
|
|
28
|
+
`context.setCleanupReport` before terminal; the runtime publishes one terminal only
|
|
29
|
+
after required evidence and lexical cleanup are complete. A non-zero resource census
|
|
30
|
+
turns a would-be success into `tool-cleanup-failed`.
|
|
31
|
+
|
|
32
|
+
This package has no filesystem, Vite, WebGPU, Editor, or second registry dependency.
|
|
33
|
+
|
|
34
|
+
## Fiber-local typed capabilities
|
|
35
|
+
|
|
36
|
+
`defineToolCapability<T>(id)` creates only a static identity. A host adapter passes
|
|
37
|
+
one `capabilityResolver` when it runs a selected Entry; the executor obtains a
|
|
38
|
+
Fiber-local service with `context.require(capability)`. The result is a typed
|
|
39
|
+
`{ ok: true, value }` or a closed `ToolRuntimeError`. The token never enters tool
|
|
40
|
+
arguments, terminal results, artifacts, or a second service registry.
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
const previewHost = defineToolCapability<PreviewHost>('previewHost');
|
|
44
|
+
const contribution = defineTool(descriptor, async (_args, context) => {
|
|
45
|
+
const host = context.require(previewHost);
|
|
46
|
+
if (!host.ok) return host;
|
|
47
|
+
return host.value.withSession(context.signal);
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The resolver is valid only while the owning ToolRun lease is active. A missing
|
|
52
|
+
service returns `tool-capability-unavailable`; a resolver retained past terminal
|
|
53
|
+
returns `tool-run-terminal`. Hosts bridge their active Cordis Context through
|
|
54
|
+
`@forgeax/engine-plugin` and do not expose raw Context to executors.
|
|
55
|
+
|
|
56
|
+
## Optional service boundary
|
|
57
|
+
|
|
58
|
+
`createServiceCapability` accepts a workload-scoped `ServiceAdmissionRef` and
|
|
59
|
+
validates its tool, descriptor, recipe, code, browser, backend, 300-frame sample,
|
|
60
|
+
correctness, threshold, cleanup, and eviction facts. A missing or mismatched report
|
|
61
|
+
produces the closed `tool-service-capability-absent` state; callers cannot admit a
|
|
62
|
+
service with a boolean. `createAuthenticatedLoopbackTransport`
|
|
63
|
+
accepts only loopback HTTP and a bearer token; its request is structured-clone
|
|
64
|
+
safe and carries descriptor/recipe digests plus JSON arguments. The transport
|
|
65
|
+
does not add an operation registry or transfer live World, Renderer, Canvas,
|
|
66
|
+
Context, Fiber, or GPU handles. Hosts must retain a private executor and use it
|
|
67
|
+
when admission is absent or when the disposable service is deleted.
|
|
68
|
+
|
|
69
|
+
## Capability migration
|
|
70
|
+
|
|
71
|
+
Migration is a finite, versioned contract rather than a live runtime handoff.
|
|
72
|
+
`createCapabilityToken` records source and expected target probes;
|
|
73
|
+
`probeMigrationTarget` must succeed before a target is used. A migration recipe
|
|
74
|
+
carries only JSON arguments, `SnapshotRef`, and `ArtifactRef` values. Recursive
|
|
75
|
+
live `world`, `renderer`, `canvas`, `context`, `fiber`, `page`, `carrier`, `ui`,
|
|
76
|
+
`selection`, `draft`, `undo`, and `session` state is rejected with
|
|
77
|
+
`tool-migration-live-state`.
|
|
78
|
+
|
|
79
|
+
> [!IMPORTANT]
|
|
80
|
+
> A target probe failure is a structured capability failure. It never transfers
|
|
81
|
+
> a live World, Renderer, Canvas, Context, Fiber, page, carrier, or UI session.
|
|
82
|
+
|
|
83
|
+
## Authenticated ephemeral visible carrier
|
|
84
|
+
|
|
85
|
+
The visible carrier transport is an ephemeral two-process boundary. A host
|
|
86
|
+
publishes a POD offer containing `offerId`, loopback `endpoint`, bearer token,
|
|
87
|
+
`generation`, `descriptorDigest`, `recipeDigest`, and `expiresAt`. The consumer
|
|
88
|
+
must complete `lease -> start -> execute -> exit`; the transport never creates a
|
|
89
|
+
ToolRun, registry, World, or fallback executor.
|
|
90
|
+
|
|
91
|
+
`createAuthenticatedCarrierTransport` authenticates every request and exposes
|
|
92
|
+
structured failures with stable `code`, `expected`, `hint`, and optional
|
|
93
|
+
`detail`. Digest/auth failures require a fresh offer. Provider exit after
|
|
94
|
+
`start` is terminal (`carrier-provider-exit` or `carrier-exited`): report one
|
|
95
|
+
failure and never execute through a second fallback path. Capture and cleanup
|
|
96
|
+
failures remain structured so retry is allowed only from a safe snapshot.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"fileNames":["../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../src/types.ts","../src/errors.ts","../src/artifacts.ts","../src/capability.ts","../src/carrier.ts","../src/lease.ts","../src/migration.ts","../src/timing.ts","../src/runtime.ts","../src/snapshot.ts","../src/transport.ts","../src/index.ts"],"fileIdsList":[[60,61],[60],[60,61,62,63,64,65,66,67,68,69,70],[60,61,62],[60,61,62,65,67],[60,63,64]],"fileInfos":[{"version":"bcd24271a113971ba9eb71ff8cb01bc6b0f872a85c23fdbe5d93065b375933cd","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f88bedbeb09c6f5a6645cb24c7c55f1aa22d19ae96c8e6959cbd8b85a707bc6","impliedFormat":1},{"version":"7fe93b39b810eadd916be8db880dd7f0f7012a5cc6ffb62de8f62a2117fa6f1f","impliedFormat":1},{"version":"bb0074cc08b84a2374af33d8bf044b80851ccc9e719a5e202eacf40db2c31600","impliedFormat":1},{"version":"1a7daebe4f45fb03d9ec53d60008fbf9ac45a697fdc89e4ce218bc94b94f94d6","impliedFormat":1},{"version":"f94b133a3cb14a288803be545ac2683e0d0ff6661bcd37e31aaaec54fc382aed","impliedFormat":1},{"version":"f59d0650799f8782fd74cf73c19223730c6d1b9198671b1c5b3a38e1188b5953","impliedFormat":1},{"version":"8a15b4607d9a499e2dbeed9ec0d3c0d7372c850b2d5f1fb259e8f6d41d468a84","impliedFormat":1},{"version":"26e0fe14baee4e127f4365d1ae0b276f400562e45e19e35fd2d4c296684715e6","impliedFormat":1},{"version":"d6b1eba8496bdd0eed6fc8a685768fe01b2da4a0388b5fe7df558290bffcf32f","affectsGlobalScope":true,"impliedFormat":1},{"version":"7f57fc4404ff020bc45b9c620aff2b40f700b95fe31164024c453a5e3c163c54","impliedFormat":1},{"version":"eadcffda2aa84802c73938e589b9e58248d74c59cb7fcbca6474e3435ac15504","affectsGlobalScope":true,"impliedFormat":1},{"version":"105ba8ff7ba746404fe1a2e189d1d3d2e0eb29a08c18dded791af02f29fb4711","affectsGlobalScope":true,"impliedFormat":1},{"version":"00343ca5b2e3d48fa5df1db6e32ea2a59afab09590274a6cccb1dbae82e60c7c","affectsGlobalScope":true,"impliedFormat":1},{"version":"ebd9f816d4002697cb2864bea1f0b70a103124e18a8cd9645eeccc09bdf80ab4","affectsGlobalScope":true,"impliedFormat":1},{"version":"2c1afac30a01772cd2a9a298a7ce7706b5892e447bb46bdbeef720f7b5da77ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"7b0225f483e4fa685625ebe43dd584bb7973bbd84e66a6ba7bbe175ee1048b4f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c0a4b8ac6ce74679c1da2b3795296f5896e31c38e888469a8e0f99dc3305de60","affectsGlobalScope":true,"impliedFormat":1},{"version":"3084a7b5f569088e0146533a00830e206565de65cae2239509168b11434cd84f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c5079c53f0f141a0698faa903e76cb41cd664e3efb01cc17a5c46ec2eb0bef42","affectsGlobalScope":true,"impliedFormat":1},{"version":"32cafbc484dea6b0ab62cf8473182bbcb23020d70845b406f80b7526f38ae862","affectsGlobalScope":true,"impliedFormat":1},{"version":"fca4cdcb6d6c5ef18a869003d02c9f0fd95df8cfaf6eb431cd3376bc034cad36","affectsGlobalScope":true,"impliedFormat":1},{"version":"b93ec88115de9a9dc1b602291b85baf825c85666bf25985cc5f698073892b467","affectsGlobalScope":true,"impliedFormat":1},{"version":"f5c06dcc3fe849fcb297c247865a161f995cc29de7aa823afdd75aaaddc1419b","affectsGlobalScope":true,"impliedFormat":1},{"version":"b77e16112127a4b169ef0b8c3a4d730edf459c5f25fe52d5e436a6919206c4d7","affectsGlobalScope":true,"impliedFormat":1},{"version":"fbffd9337146eff822c7c00acbb78b01ea7ea23987f6c961eba689349e744f8c","affectsGlobalScope":true,"impliedFormat":1},{"version":"a995c0e49b721312f74fdfb89e4ba29bd9824c770bbb4021d74d2bf560e4c6bd","affectsGlobalScope":true,"impliedFormat":1},{"version":"c7b3542146734342e440a84b213384bfa188835537ddbda50d30766f0593aff9","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce6180fa19b1cccd07ee7f7dbb9a367ac19c0ed160573e4686425060b6df7f57","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f02e2476bccb9dbe21280d6090f0df17d2f66b74711489415a8aa4df73c9675","affectsGlobalScope":true,"impliedFormat":1},{"version":"45e3ab34c1c013c8ab2dc1ba4c80c780744b13b5676800ae2e3be27ae862c40c","affectsGlobalScope":true,"impliedFormat":1},{"version":"805c86f6cca8d7702a62a844856dbaa2a3fd2abef0536e65d48732441dde5b5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"e42e397f1a5a77994f0185fd1466520691456c772d06bf843e5084ceb879a0ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"f4c2b41f90c95b1c532ecc874bd3c111865793b23aebcc1c3cbbabcd5d76ffb0","affectsGlobalScope":true,"impliedFormat":1},{"version":"ab26191cfad5b66afa11b8bf935ef1cd88fabfcb28d30b2dfa6fad877d050332","affectsGlobalScope":true,"impliedFormat":1},{"version":"2088bc26531e38fb05eedac2951480db5309f6be3fa4a08d2221abb0f5b4200d","affectsGlobalScope":true,"impliedFormat":1},{"version":"cb9d366c425fea79716a8fb3af0d78e6b22ebbab3bd64d25063b42dc9f531c1e","affectsGlobalScope":true,"impliedFormat":1},{"version":"500934a8089c26d57ebdb688fc9757389bb6207a3c8f0674d68efa900d2abb34","affectsGlobalScope":true,"impliedFormat":1},{"version":"689da16f46e647cef0d64b0def88910e818a5877ca5379ede156ca3afb780ac3","affectsGlobalScope":true,"impliedFormat":1},{"version":"bc21cc8b6fee4f4c2440d08035b7ea3c06b3511314c8bab6bef7a92de58a2593","affectsGlobalScope":true,"impliedFormat":1},{"version":"7ca53d13d2957003abb47922a71866ba7cb2068f8d154877c596d63c359fed25","affectsGlobalScope":true,"impliedFormat":1},{"version":"54725f8c4df3d900cb4dac84b64689ce29548da0b4e9b7c2de61d41c79293611","affectsGlobalScope":true,"impliedFormat":1},{"version":"e5594bc3076ac29e6c1ebda77939bc4c8833de72f654b6e376862c0473199323","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f3eb332c2d73e729f3364fcc0c2b375e72a121e8157d25a82d67a138c83a95c","affectsGlobalScope":true,"impliedFormat":1},{"version":"6f4427f9642ce8d500970e4e69d1397f64072ab73b97e476b4002a646ac743b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"48915f327cd1dea4d7bd358d9dc7732f58f9e1626a29cc0c05c8c692419d9bb7","affectsGlobalScope":true,"impliedFormat":1},{"version":"b7bf9377723203b5a6a4b920164df22d56a43f593269ba6ae1fdc97774b68855","affectsGlobalScope":true,"impliedFormat":1},{"version":"db9709688f82c9e5f65a119c64d835f906efe5f559d08b11642d56eb85b79357","affectsGlobalScope":true,"impliedFormat":1},{"version":"4b25b8c874acd1a4cf8444c3617e037d444d19080ac9f634b405583fd10ce1f7","affectsGlobalScope":true,"impliedFormat":1},{"version":"37be57d7c90cf1f8112ee2636a068d8fd181289f82b744160ec56a7dc158a9f5","affectsGlobalScope":true,"impliedFormat":1},{"version":"a917a49ac94cd26b754ab84e113369a75d1a47a710661d7cd25e961cc797065f","affectsGlobalScope":true,"impliedFormat":1},{"version":"6d3261badeb7843d157ef3e6f5d1427d0eeb0af0cf9df84a62cfd29fd47ac86e","affectsGlobalScope":true,"impliedFormat":1},{"version":"195daca651dde22f2167ac0d0a05e215308119a3100f5e6268e8317d05a92526","affectsGlobalScope":true,"impliedFormat":1},{"version":"8b11e4285cd2bb164a4dc09248bdec69e9842517db4ca47c1ba913011e44ff2f","affectsGlobalScope":true,"impliedFormat":1},{"version":"0508571a52475e245b02bc50fa1394065a0a3d05277fbf5120c3784b85651799","affectsGlobalScope":true,"impliedFormat":1},{"version":"8f9af488f510c3015af3cc8c267a9e9d96c4dd38a1fdff0e11dc5a544711415b","affectsGlobalScope":true,"impliedFormat":1},{"version":"fc611fea8d30ea72c6bbfb599c9b4d393ce22e2f5bfef2172534781e7d138104","affectsGlobalScope":true,"impliedFormat":1},{"version":"1ce14b81c5cc821994aa8ec1d42b220dd41b27fcc06373bce3958af7421b77d4","affectsGlobalScope":true,"impliedFormat":1},{"version":"b3a048b3e9302ef9a34ef4ebb9aecfb28b66abb3bce577206a79fee559c230da","affectsGlobalScope":true,"impliedFormat":1},{"version":"393e4728dc3d9af1b8a9de1144214b7096d2d0cf43798471dc5cf4b446c0205a","signature":"4a5b020726455dd70acdf34ccc435273e6333cbb1a3ff08b6c451148c61b21fd"},{"version":"b2c16dc48c4643d964fc78406f49524a728ddcbc09d4ccc8fc855e93ec4eb990","signature":"eb4d76417ff2ac49726b2efaf83e5b9924f7040151293d092e1ba38905479a02"},{"version":"b44a043f0a79132e14e883ee622cf9806f1e39f21a11d261d442d0ce0ef1518e","signature":"3bae912eb95706a507e668cdfe378bb612c81b46323aae337689fabc00c3ae29"},{"version":"b0e82cde376d38136035317c5c74916976d7a8489082e36e4100bf70ad5cc9d9","signature":"129aaa58f8b8ed74d8ef3ab03d3219f1b5a7b2902c4e111e080abdaf043686ef"},{"version":"ef03c9c06ec1ae633072c34e1c57c2dfc2ac1db4d0c62da1bc788197e33d58b7","signature":"c0a9cb9a3fe662b66cf598c1e2e6bc799b423699b81249bb62586acbc817b1e7"},{"version":"0f248a1b7c7d036649994ea77d49ebe1c09dc71597708d280a3a21466b506b75","signature":"7d3bbcb2ef65e80202188d77d2e06f30c5d5d2603ca49cde35a6b298565247e9"},{"version":"3c13e9b4d9021c31fbc81932286963987a2ba06ec0dd123a0d0141eaf2e97215","signature":"f90ae41777b29281dcd4aa3fafb9d84c6b328860d639114a8c3fcf36beb23817"},{"version":"52958a5e456b1972852a0a58720d4f151cdb12d8e09e7f1bdce5b68e0b7870dc","signature":"9fec96292881b3ee00f9b34d757887223221db25d0fb534b521743e9be298d9f"},{"version":"96df02f84776e55764c80c838b4241cc66245888520da5edc522f2366414048e","signature":"eadfe727983087acea4f17095671faba65ba5233acaed7213f140269d4528c9a"},{"version":"1b0251d64231d0d13df51f37d91f6335f5a78cf023a9c27f197015893c2b06cd","signature":"6bbe3b367d76debfa83ec26a13d0013f8dad891cddd8909a1fbdcdb719b064d9"},{"version":"e8508ba12cf867760ac0ba90bf52e0f0b733dd13a4ecfec095418a1e6b963a47","signature":"fbd59a37ab9b1a3a21f2e968b539f91453e560507d9e92748f0623f7118306be"},{"version":"8b8b982a25a2a68d1fe58cca06e8f71e7a20bbff01a80070eb973d7e672e6edb","signature":"92523b7353d096bd2464e1611035b284803894aa952541021922567dfe9f15aa"}],"root":[[60,71]],"options":{"composite":true,"declaration":true,"emitDeclarationOnly":true,"exactOptionalPropertyTypes":true,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitOverride":true,"noImplicitReturns":true,"noUncheckedIndexedAccess":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","rootDir":"../src","skipLibCheck":true,"strict":true,"target":9,"tsBuildInfoFile":"./.tsbuildinfo","useDefineForClassFields":true,"verbatimModuleSyntax":true},"referencedMap":[[62,1],[63,2],[61,2],[71,3],[66,4],[68,5],[69,2],[67,2],[70,6]],"latestChangedDtsFile":"./index.d.ts","version":"6.0.3"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { artifactManifestError } from './errors.js';
|
|
2
|
+
import type { ArtifactRef, JsonValue, SnapshotRef, ToolEvidenceKind } from './types.js';
|
|
3
|
+
export type PreviewArtifactRole = 'report' | 'rhi-tape' | 'capture' | 'fresh-replay' | 'profile-capture' | 'contact-sheet';
|
|
4
|
+
export type PreviewArtifactKind = 'report' | 'rhi-tape' | 'png' | 'profile-capture' | 'contact-sheet';
|
|
5
|
+
export interface PreviewArtifactIdentity {
|
|
6
|
+
readonly runId: string;
|
|
7
|
+
readonly snapshotDigest: string;
|
|
8
|
+
readonly subjectDigest: string;
|
|
9
|
+
readonly presentationDigest: string;
|
|
10
|
+
readonly captureId: string;
|
|
11
|
+
readonly frameId: number;
|
|
12
|
+
}
|
|
13
|
+
export interface PreviewArtifactManifestEntry {
|
|
14
|
+
readonly owner: string;
|
|
15
|
+
readonly kind: PreviewArtifactKind;
|
|
16
|
+
readonly role: PreviewArtifactRole;
|
|
17
|
+
readonly uri: string;
|
|
18
|
+
readonly digest: string;
|
|
19
|
+
readonly byteLength: number;
|
|
20
|
+
readonly mediaType: string;
|
|
21
|
+
readonly derivedFrom: readonly string[];
|
|
22
|
+
}
|
|
23
|
+
export interface PreviewArtifactManifest {
|
|
24
|
+
readonly schemaVersion: '2.0.0';
|
|
25
|
+
readonly identity: PreviewArtifactIdentity;
|
|
26
|
+
readonly artifacts: readonly PreviewArtifactManifestEntry[];
|
|
27
|
+
}
|
|
28
|
+
export type PreviewArtifactManifestValidation = {
|
|
29
|
+
readonly ok: true;
|
|
30
|
+
readonly value: PreviewArtifactManifest;
|
|
31
|
+
} | {
|
|
32
|
+
readonly ok: false;
|
|
33
|
+
readonly error: ReturnType<typeof artifactManifestError>;
|
|
34
|
+
};
|
|
35
|
+
export interface ToolArtifactIdentity {
|
|
36
|
+
readonly runId: string;
|
|
37
|
+
readonly snapshotDigest: string;
|
|
38
|
+
readonly stepId: string;
|
|
39
|
+
readonly frameId: number;
|
|
40
|
+
readonly captureId: string;
|
|
41
|
+
}
|
|
42
|
+
export interface ToolArtifactManifestEntry {
|
|
43
|
+
readonly owner: string;
|
|
44
|
+
readonly kind: ToolEvidenceKind;
|
|
45
|
+
readonly uri: string;
|
|
46
|
+
readonly digest: string;
|
|
47
|
+
readonly byteLength: number;
|
|
48
|
+
readonly mediaType?: string;
|
|
49
|
+
readonly derivedFrom?: readonly string[];
|
|
50
|
+
}
|
|
51
|
+
export interface ToolArtifactManifest {
|
|
52
|
+
readonly schemaVersion: '1.0.0';
|
|
53
|
+
readonly identity: ToolArtifactIdentity;
|
|
54
|
+
readonly artifacts: readonly ToolArtifactManifestEntry[];
|
|
55
|
+
}
|
|
56
|
+
export type ArtifactManifestValidation = {
|
|
57
|
+
readonly ok: true;
|
|
58
|
+
readonly value: ToolArtifactManifest;
|
|
59
|
+
} | {
|
|
60
|
+
readonly ok: false;
|
|
61
|
+
readonly error: ReturnType<typeof artifactManifestError>;
|
|
62
|
+
};
|
|
63
|
+
export declare function createArtifactManifest(manifest: ToolArtifactManifest): ToolArtifactManifest;
|
|
64
|
+
export declare function validateArtifactManifest(manifest: ToolArtifactManifest, required: readonly ToolEvidenceKind[]): ArtifactManifestValidation;
|
|
65
|
+
export declare function createPreviewArtifactManifest(manifest: PreviewArtifactManifest): PreviewArtifactManifest;
|
|
66
|
+
export declare function validatePreviewArtifactManifest(manifest: PreviewArtifactManifest, requiredRoles: readonly PreviewArtifactRole[]): PreviewArtifactManifestValidation;
|
|
67
|
+
export declare function isSerializableValue(value: unknown, seen?: Set<object>): value is JsonValue;
|
|
68
|
+
export declare function createArtifactRef(input: {
|
|
69
|
+
readonly kind: ToolEvidenceKind | 'tool-result' | 'receipt';
|
|
70
|
+
readonly digest: string;
|
|
71
|
+
readonly uri?: string;
|
|
72
|
+
readonly mediaType?: string;
|
|
73
|
+
readonly sizeBytes?: number;
|
|
74
|
+
}): ArtifactRef;
|
|
75
|
+
export declare function createSnapshotRef(input: SnapshotRef): SnapshotRef;
|
|
76
|
+
export declare function validateArtifactRefs(value: unknown): value is readonly ArtifactRef[];
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { ToolCapability, ToolCapabilityResolver, ToolRealm, ToolRuntimeError } from './types.js';
|
|
2
|
+
/** A static service identity. The value and its lifecycle remain Fiber-local. */
|
|
3
|
+
export declare function defineToolCapability<T>(id: string): ToolCapability<T>;
|
|
4
|
+
export declare function createCapabilityResolver(resolve: <T>(capability: ToolCapability<T>) => T | undefined): ToolCapabilityResolver;
|
|
5
|
+
export interface ServiceAdmissionRef {
|
|
6
|
+
readonly schema: 'forgeax.tool-service-admission-ref.v1';
|
|
7
|
+
readonly reportDigest: string;
|
|
8
|
+
readonly toolId: string;
|
|
9
|
+
readonly descriptorDigest: string;
|
|
10
|
+
readonly recipeDigest: string;
|
|
11
|
+
readonly workloadClass: string;
|
|
12
|
+
readonly codeDigest: string;
|
|
13
|
+
readonly browserVersion: string;
|
|
14
|
+
readonly backend: 'webgpu';
|
|
15
|
+
readonly frameCount: number;
|
|
16
|
+
readonly samples: {
|
|
17
|
+
readonly privateCold: number;
|
|
18
|
+
readonly privateWarm: number;
|
|
19
|
+
readonly serviceCold: number;
|
|
20
|
+
readonly serviceWarm: number;
|
|
21
|
+
};
|
|
22
|
+
readonly correctness: {
|
|
23
|
+
readonly terminalEquivalent: boolean;
|
|
24
|
+
readonly artifactIntegrity: boolean;
|
|
25
|
+
readonly freshReplay: boolean;
|
|
26
|
+
readonly hiddenParity: boolean;
|
|
27
|
+
readonly drawCalls: number;
|
|
28
|
+
readonly nonBlackPixels: number;
|
|
29
|
+
};
|
|
30
|
+
readonly performance: {
|
|
31
|
+
readonly privateMedianMs: number;
|
|
32
|
+
readonly privateP95Ms: number;
|
|
33
|
+
readonly privateMaxMs: number;
|
|
34
|
+
readonly privateRssBytes: number;
|
|
35
|
+
readonly serviceMedianMs: number;
|
|
36
|
+
readonly serviceP95Ms: number;
|
|
37
|
+
readonly serviceMaxMs: number;
|
|
38
|
+
readonly serviceRssBytes: number;
|
|
39
|
+
};
|
|
40
|
+
readonly cleanupPassed: boolean;
|
|
41
|
+
readonly evictionPassed: boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface ServiceAdmissionExpectation {
|
|
44
|
+
readonly toolId: string;
|
|
45
|
+
readonly descriptorDigest: string;
|
|
46
|
+
readonly recipeDigest: string;
|
|
47
|
+
readonly workloadClass: string;
|
|
48
|
+
readonly codeDigest: string;
|
|
49
|
+
readonly browserVersion: string;
|
|
50
|
+
readonly backend: 'webgpu';
|
|
51
|
+
}
|
|
52
|
+
export type ServiceCapability = {
|
|
53
|
+
readonly available: true;
|
|
54
|
+
readonly reportDigest?: string;
|
|
55
|
+
} | {
|
|
56
|
+
readonly available: false;
|
|
57
|
+
readonly code: 'tool-service-capability-absent';
|
|
58
|
+
readonly expected: 'an admitted acceleration service';
|
|
59
|
+
readonly hint: 'Use the private executor and rerun benchmark admission before enabling service.';
|
|
60
|
+
readonly detail: {
|
|
61
|
+
readonly reason: string;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export declare function createServiceCapability(admission: ServiceAdmissionRef | undefined, expected: ServiceAdmissionExpectation): ServiceCapability;
|
|
65
|
+
export interface RealmCapability {
|
|
66
|
+
readonly realm: ToolRealm;
|
|
67
|
+
readonly supported: boolean;
|
|
68
|
+
readonly reason?: 'realm-capability-unavailable';
|
|
69
|
+
}
|
|
70
|
+
export interface RealmCapabilityMatrix {
|
|
71
|
+
readonly catalogDigest: string;
|
|
72
|
+
readonly realms: Readonly<Record<ToolRealm, RealmCapability>>;
|
|
73
|
+
}
|
|
74
|
+
export interface RealmCapabilityInput {
|
|
75
|
+
readonly catalogDigest: string;
|
|
76
|
+
readonly supported: Readonly<Record<ToolRealm, boolean>>;
|
|
77
|
+
}
|
|
78
|
+
export declare function createRealmCapabilityMatrix(input: RealmCapabilityInput): RealmCapabilityMatrix;
|
|
79
|
+
export type RealmBootstrapValidation = {
|
|
80
|
+
readonly ok: true;
|
|
81
|
+
} | {
|
|
82
|
+
readonly ok: false;
|
|
83
|
+
readonly error: ToolRuntimeError;
|
|
84
|
+
};
|
|
85
|
+
export declare function validateRealmBootstrapPayload(value: unknown): RealmBootstrapValidation;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export type CarrierPhase = 'offered' | 'leased' | 'started' | 'exited' | 'expired' | 'fallback';
|
|
2
|
+
export type CarrierErrorCode = 'carrier-consumer-mismatch' | 'carrier-token-invalid' | 'carrier-offer-expired' | 'carrier-started' | 'carrier-exited' | 'carrier-lease-required' | 'carrier-payload-live-state' | 'carrier-descriptor-mismatch' | 'carrier-recipe-mismatch' | 'carrier-provider-exit' | 'carrier-capture-failed' | 'carrier-cleanup-failed';
|
|
3
|
+
export interface CarrierError {
|
|
4
|
+
readonly code: CarrierErrorCode;
|
|
5
|
+
readonly expected: string;
|
|
6
|
+
readonly hint: string;
|
|
7
|
+
readonly detail: Readonly<Record<string, unknown>>;
|
|
8
|
+
}
|
|
9
|
+
export interface CarrierOffer {
|
|
10
|
+
readonly schemaVersion: '1.0.0';
|
|
11
|
+
readonly projectId: string;
|
|
12
|
+
readonly consumerId: string;
|
|
13
|
+
readonly offerId: string;
|
|
14
|
+
readonly endpoint: string;
|
|
15
|
+
readonly bearerToken: string;
|
|
16
|
+
readonly livenessToken: string;
|
|
17
|
+
readonly expiresAt: number;
|
|
18
|
+
readonly descriptorDigest?: string;
|
|
19
|
+
readonly recipeDigest?: string;
|
|
20
|
+
readonly state: 'offered';
|
|
21
|
+
}
|
|
22
|
+
export interface CarrierLease {
|
|
23
|
+
readonly leaseId: string;
|
|
24
|
+
readonly offerId: string;
|
|
25
|
+
readonly consumerId: string;
|
|
26
|
+
readonly state: 'leased';
|
|
27
|
+
}
|
|
28
|
+
export interface CarrierState {
|
|
29
|
+
readonly state: CarrierPhase;
|
|
30
|
+
readonly leaseId?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface CarrierStateMachine {
|
|
33
|
+
readonly offer: CarrierOffer;
|
|
34
|
+
readonly lease: {
|
|
35
|
+
(request: CarrierLeaseRequest): CarrierResult<CarrierLease>;
|
|
36
|
+
(leaseId: string, request: CarrierLeaseRequest): CarrierResult<CarrierLease>;
|
|
37
|
+
};
|
|
38
|
+
readonly started: (leaseId: string) => CarrierResult<CarrierState>;
|
|
39
|
+
readonly exit: (leaseId: string) => CarrierResult<CarrierState>;
|
|
40
|
+
readonly fallback: () => CarrierResult<CarrierState>;
|
|
41
|
+
readonly snapshot: () => CarrierState;
|
|
42
|
+
}
|
|
43
|
+
export interface CarrierLeaseRequest {
|
|
44
|
+
readonly consumerId: string;
|
|
45
|
+
readonly bearerToken: string;
|
|
46
|
+
readonly now: number;
|
|
47
|
+
readonly descriptorDigest?: string;
|
|
48
|
+
readonly recipeDigest?: string;
|
|
49
|
+
}
|
|
50
|
+
export type CarrierResult<T> = {
|
|
51
|
+
readonly ok: true;
|
|
52
|
+
readonly value: T;
|
|
53
|
+
readonly state: CarrierPhase;
|
|
54
|
+
} | {
|
|
55
|
+
readonly ok: false;
|
|
56
|
+
readonly error: CarrierError;
|
|
57
|
+
};
|
|
58
|
+
export interface CarrierStateMachineOptions {
|
|
59
|
+
readonly projectId: string;
|
|
60
|
+
readonly consumerId: string;
|
|
61
|
+
readonly endpoint: string;
|
|
62
|
+
readonly now: number;
|
|
63
|
+
readonly ttlMs: number;
|
|
64
|
+
readonly payload?: unknown;
|
|
65
|
+
readonly descriptorDigest?: string;
|
|
66
|
+
readonly recipeDigest?: string;
|
|
67
|
+
}
|
|
68
|
+
export declare function createCarrierStateMachine(options: CarrierStateMachineOptions): CarrierStateMachine;
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { JsonValue, ToolEvidenceKind, ToolRealm, ToolRuntimeError } from './types.js';
|
|
2
|
+
export declare function invalidArgsError(message: string, value: JsonValue): ToolRuntimeError;
|
|
3
|
+
export declare function capabilityUnavailableError(capability: string, realm: ToolRealm): ToolRuntimeError;
|
|
4
|
+
export declare function snapshotStaleError(expectedDigest: string, actualDigest: string): ToolRuntimeError;
|
|
5
|
+
export declare function domainFailureError(code: string, expected?: string, hint?: string, payload?: JsonValue): ToolRuntimeError;
|
|
6
|
+
export declare function artifactIncompleteError(missing: readonly ToolEvidenceKind[], runId: string): ToolRuntimeError;
|
|
7
|
+
export declare function cancellationError(reason: string): ToolRuntimeError;
|
|
8
|
+
export declare function timeoutError(deadlineMs: number): ToolRuntimeError;
|
|
9
|
+
export declare function disconnectedError(transport: string): ToolRuntimeError;
|
|
10
|
+
export declare function terminalError(runId: string, outcome: 'succeeded' | 'failed'): ToolRuntimeError;
|
|
11
|
+
export declare function cleanupError(runId: string, message: string): ToolRuntimeError;
|
|
12
|
+
export declare function artifactManifestError(expected: string, hint: string, detail: {
|
|
13
|
+
readonly reason: string;
|
|
14
|
+
readonly runId?: string;
|
|
15
|
+
}): ToolRuntimeError;
|
|
16
|
+
export declare function timingError(reason: string): ToolRuntimeError;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { type ArtifactManifestValidation, createArtifactManifest, createArtifactRef, createPreviewArtifactManifest, createSnapshotRef, isSerializableValue, type PreviewArtifactIdentity, type PreviewArtifactKind, type PreviewArtifactManifest, type PreviewArtifactManifestEntry, type PreviewArtifactManifestValidation, type PreviewArtifactRole, type ToolArtifactIdentity, type ToolArtifactManifest, type ToolArtifactManifestEntry, validateArtifactManifest, validateArtifactRefs, validatePreviewArtifactManifest, } from './artifacts.js';
|
|
2
|
+
export { createCapabilityResolver, createRealmCapabilityMatrix, createServiceCapability, defineToolCapability, type RealmBootstrapValidation, type RealmCapability, type RealmCapabilityInput, type RealmCapabilityMatrix, type ServiceAdmissionExpectation, type ServiceAdmissionRef, type ServiceCapability, validateRealmBootstrapPayload, } from './capability.js';
|
|
3
|
+
export { type CarrierError, type CarrierErrorCode, type CarrierLease, type CarrierLeaseRequest, type CarrierOffer, type CarrierPhase, type CarrierResult, type CarrierState, type CarrierStateMachine, type CarrierStateMachineOptions, createCarrierStateMachine, } from './carrier.js';
|
|
4
|
+
export { artifactIncompleteError, cancellationError, capabilityUnavailableError, cleanupError, disconnectedError, domainFailureError, invalidArgsError, snapshotStaleError, terminalError, timeoutError, } from './errors.js';
|
|
5
|
+
export { createLexicalLease, type LeaseCleanupFailure, type LeaseTermination, type LeaseTerminationReason, type LexicalLease, } from './lease.js';
|
|
6
|
+
export { type CapabilityToken, createCapabilityToken, createMigrationRecipe, type MigrationCapabilityProbe, type MigrationOperation, type MigrationPayloadValidation, type MigrationRecipe, probeMigrationTarget, validateMigrationPayload, } from './migration.js';
|
|
7
|
+
export { createToolRuntime, defineTool, type ToolRuntime } from './runtime.js';
|
|
8
|
+
export { isSnapshotRef, terminalSnapshot } from './snapshot.js';
|
|
9
|
+
export { createExclusiveTiming, type ExclusiveTiming, type ExclusiveTimingResult, finishToolTiming, startToolTiming, } from './timing.js';
|
|
10
|
+
export { type AuthenticatedCarrierTransport, type AuthenticatedCarrierTransportOptions, type AuthenticatedLoopbackTransport, type AuthenticatedLoopbackTransportOptions, type CarrierExecutionRequest, type CarrierTransport, CarrierTransportError, createAuthenticatedCarrierTransport, createAuthenticatedLoopbackTransport, createLoopbackTransport, type ServiceWireHandler, type ServiceWireRequest, } from './transport.js';
|
|
11
|
+
export type { ArtifactRef, JsonPrimitive, JsonValue, SnapshotRef, ToolCapability, ToolCapabilityResolver, ToolCapabilityResult, ToolCleanupCensus, ToolCleanupReport, ToolContribution, ToolDescriptor, ToolDomainFailure, ToolEvidenceKind, ToolExecutionContext, ToolExecutor, ToolExecutorResult, ToolExecutorValue, ToolPhaseObservation, ToolPreviewContract, ToolRealm, ToolRecoveryAction, ToolResourceKind, ToolResourceObservation, ToolRun, ToolRunEvent, ToolRunOptions, ToolRuntimeError, ToolRuntimeErrorCode, ToolSchema, ToolSchemaResult, ToolSnapshotInput, ToolSubjectRef, ToolTerminal, ToolTiming, ToolTimingPhase, } from './types.js';
|