@loomwork/effect-runtime 0.0.0-stage → 0.1.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 +8 -0
- package/README.md +65 -2
- package/dist/EffectRuntime.d.ts +121 -0
- package/dist/EffectRuntime.d.ts.map +1 -0
- package/dist/EffectRuntime.js +422 -0
- package/dist/EffectRuntime.js.map +1 -0
- package/dist/authz.d.ts +228 -0
- package/dist/authz.d.ts.map +1 -0
- package/dist/authz.js +281 -0
- package/dist/authz.js.map +1 -0
- package/dist/effects/A2AEffect.d.ts +14 -0
- package/dist/effects/A2AEffect.d.ts.map +1 -0
- package/dist/effects/A2AEffect.js +21 -0
- package/dist/effects/A2AEffect.js.map +1 -0
- package/dist/effects/HumanEffect.d.ts +13 -0
- package/dist/effects/HumanEffect.d.ts.map +1 -0
- package/dist/effects/HumanEffect.js +21 -0
- package/dist/effects/HumanEffect.js.map +1 -0
- package/dist/effects/LazyEffect.d.ts +10 -0
- package/dist/effects/LazyEffect.d.ts.map +1 -0
- package/dist/effects/LazyEffect.js +28 -0
- package/dist/effects/LazyEffect.js.map +1 -0
- package/dist/effects/LlmEffect.d.ts +27 -0
- package/dist/effects/LlmEffect.d.ts.map +1 -0
- package/dist/effects/LlmEffect.js +27 -0
- package/dist/effects/LlmEffect.js.map +1 -0
- package/dist/effects/ToolEffect.d.ts +38 -0
- package/dist/effects/ToolEffect.d.ts.map +1 -0
- package/dist/effects/ToolEffect.js +31 -0
- package/dist/effects/ToolEffect.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/policy.d.ts +76 -0
- package/dist/policy.d.ts.map +1 -0
- package/dist/policy.js +212 -0
- package/dist/policy.js.map +1 -0
- package/dist/types.d.ts +416 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +28 -0
- package/dist/types.js.map +1 -0
- package/package.json +56 -3
- package/src/EffectRuntime.ts +484 -0
- package/src/authz.ts +424 -0
- package/src/effects/HumanEffect.ts +25 -0
- package/src/effects/LazyEffect.ts +25 -0
- package/src/effects/LlmEffect.ts +39 -0
- package/src/effects/ToolEffect.ts +59 -0
- package/src/index.ts +48 -0
- package/src/policy.ts +296 -0
- package/src/types.ts +428 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
202
|
+
|
package/NOTICE
ADDED
package/README.md
CHANGED
|
@@ -1,3 +1,66 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @loomwork/effect-runtime
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The isolation layer between a flow and the outside world. Everything a flow does that is not pure,
|
|
4
|
+
a tool call, an LLM call, a human prompt, an agent-to-agent request, is an `Effect` run through an
|
|
5
|
+
`EffectRuntime`, which wraps it in composable middleware (retry, rate limit, telemetry, ...) and
|
|
6
|
+
applies the kernel's protection ring: capability authorization (`GrantTable`, `PolicyAuthorizer`,
|
|
7
|
+
signed delegation), metering and quotas, deadlines and delivery fencing.
|
|
8
|
+
|
|
9
|
+
## When to use it
|
|
10
|
+
|
|
11
|
+
- You are registering the runnable side of a tool or model (`effects.register("id", effect)`), or
|
|
12
|
+
writing middleware or an authorizer.
|
|
13
|
+
- Otherwise it is wired for you: `defineConfig` builds the `EffectRuntime`, and
|
|
14
|
+
`execution.registerEffects` is where an app registers its effects.
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
Not published to npm yet: `"@loomwork/effect-runtime": "workspace:*"` in this workspace, or a `link:`
|
|
19
|
+
override from a sibling checkout (see [AGENTS.md](../../AGENTS.md)).
|
|
20
|
+
|
|
21
|
+
## Entry points
|
|
22
|
+
|
|
23
|
+
`@loomwork/effect-runtime` (single entry): `EffectRuntime`, the effect kinds `ToolEffect`, `LlmEffect`,
|
|
24
|
+
`HumanEffect` (plus the lazy variant `LazyEffect`), the `Effect` / `EffectMiddleware` types, the
|
|
25
|
+
authorization surface (`GrantTable`, `PolicyAuthorizer`, `DelegationAuthorizer`, `signDelegation`,
|
|
26
|
+
`verifyDelegation`, `attenuateDelegation`) and `CapabilityDeniedError`.
|
|
27
|
+
|
|
28
|
+
## Example
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { defineConfig } from "@loomwork/app";
|
|
32
|
+
import { ToolEffect, type Effect } from "@loomwork/effect-runtime";
|
|
33
|
+
|
|
34
|
+
declare const lookup: Effect; // for example: new ToolEffect(async (input) => ...)
|
|
35
|
+
|
|
36
|
+
const app = defineConfig({
|
|
37
|
+
storage: { kind: "memory" },
|
|
38
|
+
flows: [],
|
|
39
|
+
execution: {
|
|
40
|
+
registerEffects: (effects) => {
|
|
41
|
+
effects.register("lookup", lookup); // the id a tool$ definition / ctx.run names
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
await app.close();
|
|
46
|
+
void ToolEffect;
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Key concepts
|
|
50
|
+
|
|
51
|
+
- **Middleware** is statically ordered and replay-safe: it wraps effect execution only, never the
|
|
52
|
+
fold. Reference middleware (retry, rate limit) lives in [`@loomwork/middleware`](../middleware/README.md);
|
|
53
|
+
see [ADR 0006](../../docs/adr/0006-config-and-effect-middleware.md).
|
|
54
|
+
- **Capability grants (K2)**, quotas (K3), cancellation (K8) and delivery guarantees (K9) apply at
|
|
55
|
+
this seam: [kernel guide pages](../../docs/user-guide/grants-and-strict-mode.md),
|
|
56
|
+
[ADR 0021](../../docs/adr/0021-k9-effect-delivery-contract-idempotency-fencing.md).
|
|
57
|
+
- Effects are `journaled` (recorded and replayed) or `ambient`; a transient facade
|
|
58
|
+
(`invokeTransient`) runs one without an execution
|
|
59
|
+
([ADR 0066](../../docs/adr/0066-transient-effect-invocation-facade.md)).
|
|
60
|
+
|
|
61
|
+
## See also
|
|
62
|
+
|
|
63
|
+
- [API reference: Effects](../../docs/api-reference.org) (`@loomwork/effect-runtime`).
|
|
64
|
+
- [User guide, section 3: Effects and middleware](../../docs/user-guide.md#3-effects--middleware).
|
|
65
|
+
- [`@loomwork/app`](../app/README.md), [`@loomwork/agent`](../agent/README.md),
|
|
66
|
+
[`@loomwork/workflow-runtime`](../workflow-runtime/README.md).
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { type EffectRuntimeOptions } from "./authz";
|
|
2
|
+
import type { Effect, EffectContext, EffectMiddleware, ErrorChannelSchema, TransientInvokeOptions } from "./types";
|
|
3
|
+
export declare class EffectRuntime {
|
|
4
|
+
private readonly registry;
|
|
5
|
+
private readonly middleware;
|
|
6
|
+
private readonly authorizer;
|
|
7
|
+
private readonly scheduler;
|
|
8
|
+
private readonly warmer;
|
|
9
|
+
private readonly onWarn;
|
|
10
|
+
/**
|
|
11
|
+
* @param middleware Cross-cutting middleware applied around every effect
|
|
12
|
+
* execution, in order — `middleware[0]` is outermost. The list is fixed here
|
|
13
|
+
* (static ⇒ deterministic across replay). An empty list (the default) makes
|
|
14
|
+
* `execute` behave identically to a bare effect call.
|
|
15
|
+
* @param options Optional `authorizer` (K2 protection ring), `scheduler` (M6 —
|
|
16
|
+
* route effects through it for bounded concurrency + priority), and `warmer` (M6 —
|
|
17
|
+
* advisory off-log pre-warm). All omittable; the empty case is the zero-overhead
|
|
18
|
+
* direct path with today's behaviour.
|
|
19
|
+
*/
|
|
20
|
+
constructor(middleware?: readonly EffectMiddleware[], options?: EffectRuntimeOptions);
|
|
21
|
+
register(toolId: string, effect: Effect): void;
|
|
22
|
+
execute<TIn = unknown, TOut = unknown>(toolId: string, input: TIn, ctx: EffectContext): Promise<TOut>;
|
|
23
|
+
private resourceOf;
|
|
24
|
+
private runSeam;
|
|
25
|
+
/**
|
|
26
|
+
* Run a single registered effect ONCE, off the durable path — the supported
|
|
27
|
+
* façade over the already-blessed transient invocation (DE-series eval; ADR
|
|
28
|
+
* 0065 "don't make it a run until something durable happens"). It is exactly
|
|
29
|
+
* {@link execute}, but the framework owns the {@link EffectContext} instead of
|
|
30
|
+
* every caller hand-rolling one.
|
|
31
|
+
*
|
|
32
|
+
* What it does NOT do — the load-bearing guarantee (R1): nothing is written.
|
|
33
|
+
* The EffectRuntime holds no event store, no journal, and no fence, so a
|
|
34
|
+
* transient invocation produces zero envelopes, no `EXECUTION_STARTED`, no
|
|
35
|
+
* `STEP_*`, and no snapshot — structurally, not by convention. This is the
|
|
36
|
+
* sanctioned side of the ADR 0065 line: no execution, no fold, no recovery.
|
|
37
|
+
*
|
|
38
|
+
* Middleware contract (R3): the SAME statically configured effect-runtime
|
|
39
|
+
* middleware chain that a durable step's effect call runs also runs here —
|
|
40
|
+
* retry/backoff and the K2 authorizer are effect-local and remain in force.
|
|
41
|
+
* What is bypassed is everything ABOVE this layer: the workflow interpreter's
|
|
42
|
+
* journaling/durability (fold, `ExecutionJournal`, fencing, snapshots) is not
|
|
43
|
+
* EffectRuntime middleware at all, so there is nothing to opt out of.
|
|
44
|
+
*
|
|
45
|
+
* `ctx.emit` is a no-op sink (R4): an effect that emits transiently has the
|
|
46
|
+
* event DROPPED by construction — never buffered, never later flushed. Do not
|
|
47
|
+
* author a transient effect that relies on emitting durable state.
|
|
48
|
+
*
|
|
49
|
+
* The synthesized identity is throwaway: `idempotencyKey` is left unset, so do
|
|
50
|
+
* NOT rely on provider-side dedup across transient calls (they carry no stable
|
|
51
|
+
* key — a transient read path is expected to be retry-on-client).
|
|
52
|
+
*
|
|
53
|
+
* L30: `opts.as` stamps the call with an existing execution's identity (used by
|
|
54
|
+
* `ctx.decide`'s scope); it changes the claimed identity only, not R1-R5.
|
|
55
|
+
*
|
|
56
|
+
* @param opts optional {@link TransientInvokeOptions} — `signal` (cancellation,
|
|
57
|
+
* R5), `principal` (authz still enforced if wired), `label` (trace tag; without
|
|
58
|
+
* `as` also the synthetic executionId an authorizer may grant by).
|
|
59
|
+
*/
|
|
60
|
+
invokeTransient<TIn = unknown, TOut = unknown>(toolId: string, input: TIn, opts?: TransientInvokeOptions): Promise<TOut>;
|
|
61
|
+
/**
|
|
62
|
+
* ADR 0119 — the per-call delta pipe between a streaming effect and the caller's
|
|
63
|
+
* sink. It owns every rule that makes a live tail safe:
|
|
64
|
+
* - REFUSED (undefined) when any middleware `inspectsOutput` — streaming would
|
|
65
|
+
* deliver text past a check that cannot see it; the call runs non-streamed.
|
|
66
|
+
* - A reasoning delta (ADR 0133 D6) passes its own `deltaGuard` instances the same way and
|
|
67
|
+
* reaches the per-call sink and the effect's configured REASONING sink, never its text
|
|
68
|
+
* `deltaSink`.
|
|
69
|
+
* - Each text delta passes the middleware `deltaGuard`s FIRST; a guard that throws
|
|
70
|
+
* severs the stream and the offending delta is never delivered.
|
|
71
|
+
* - Text is delivered as untrusted (tainted) content.
|
|
72
|
+
* - Silent once the call settled or the call's signal aborted (an effect that
|
|
73
|
+
* ignores the signal cannot reach a caller who moved on).
|
|
74
|
+
* - A retry (the effect re-executed) resets guards and sends a `reset` chunk.
|
|
75
|
+
* - The effect's own `done` chunk is held; the terminal chunk is sent by
|
|
76
|
+
* {@link finish} after the call SUCCEEDED.
|
|
77
|
+
* - The caller's sink throwing never fails the call (warned).
|
|
78
|
+
*/
|
|
79
|
+
private deltaPipe;
|
|
80
|
+
has(toolId: string): boolean;
|
|
81
|
+
/** The registered effects, in registration order (read-only; for a composition root's boot-time checks). */
|
|
82
|
+
entries(): IterableIterator<[string, Effect]>;
|
|
83
|
+
/**
|
|
84
|
+
* Advisory pre-warm for a capability, ahead of when it's needed (latency-only,
|
|
85
|
+
* off the durable path). Spins up the registered effect's own cold resource
|
|
86
|
+
* (`Effect.warm` — e.g. a K7 child process or an LLM connection) AND fires the
|
|
87
|
+
* configured {@link Warmer} seam. Never throws: an unregistered toolId is a
|
|
88
|
+
* no-op and a warm failure is swallowed (the real call just runs cold). Does
|
|
89
|
+
* NOT authorize, meter, emit, or touch the fold — warming a capability is not
|
|
90
|
+
* invoking it (P10).
|
|
91
|
+
*/
|
|
92
|
+
warm(toolId: string): void;
|
|
93
|
+
/**
|
|
94
|
+
* K9.3 — a registered effect's declared delivery semantic
|
|
95
|
+
* (`new ToolEffect(fn, { idempotent })` / `tool$({ idempotent })`). `false`
|
|
96
|
+
* means recovery must not silently re-run an attempt in an unknown state;
|
|
97
|
+
* `undefined` (undeclared, or no such effect) keeps the legacy at-least-once
|
|
98
|
+
* re-run. Pure/synchronous so the recovery decision is deterministic.
|
|
99
|
+
*/
|
|
100
|
+
declaredIdempotence(toolId: string): boolean | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* DE-4 — a registered effect's declared failure channels (`Effect.errors`).
|
|
103
|
+
* The kernel's registry fallback when the invoking step declares no `errors:`
|
|
104
|
+
* map of its own; `undefined` (undeclared, or no such effect) means every
|
|
105
|
+
* TypedFailure from this effect degrades to the legacy untyped failure. Pure/
|
|
106
|
+
* synchronous so the replay decision is deterministic.
|
|
107
|
+
*/
|
|
108
|
+
declaredErrors(toolId: string): Record<string, ErrorChannelSchema> | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* A registered effect's declared determinism-boundary mode (ADR 0073), for tooling —
|
|
111
|
+
* `@loomwork/verify` reads it to flag a `journaled` effect reached from a `ctx.decide`
|
|
112
|
+
* scope, which the transient seam refuses. `undefined` when undeclared or unregistered.
|
|
113
|
+
*/
|
|
114
|
+
modeOf(toolId: string): Effect["mode"] | undefined;
|
|
115
|
+
/**
|
|
116
|
+
* The registered effect's kind, for tooling: `tool` / `llm` / `human` / `a2a` or any custom
|
|
117
|
+
* name (ADR 0115). Only `"human"` has kernel semantics (it parks).
|
|
118
|
+
*/
|
|
119
|
+
kindOf(toolId: string): Effect["kind"] | undefined;
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=EffectRuntime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EffectRuntime.d.ts","sourceRoot":"","sources":["../src/EffectRuntime.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,KAAK,oBAAoB,EAE1B,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,EAEV,MAAM,EACN,aAAa,EAEb,gBAAgB,EAEhB,kBAAkB,EAClB,sBAAsB,EAEvB,MAAM,SAAS,CAAC;AAEjB,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA6B;IACtD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA8B;IACzD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAmC;IAC9D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAwB;IAClD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqB;IAC5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4B;IAEnD;;;;;;;;;OASG;gBACS,UAAU,GAAE,SAAS,gBAAgB,EAAO,EAAE,OAAO,GAAE,oBAAyB;IAQ5F,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAWxC,OAAO,CAAC,GAAG,GAAG,OAAO,EAAE,IAAI,GAAG,OAAO,EACzC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,GAAG,EACV,GAAG,EAAE,aAAa,GACjB,OAAO,CAAC,IAAI,CAAC;IAsBhB,OAAO,CAAC,UAAU;YAgBJ,OAAO;IAgGrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;IACG,eAAe,CAAC,GAAG,GAAG,OAAO,EAAE,IAAI,GAAG,OAAO,EACjD,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,GAAG,EACV,IAAI,GAAE,sBAA2B,GAChC,OAAO,CAAC,IAAI,CAAC;IA6BhB;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAO,CAAC,SAAS;IAoIjB,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAI5B,4GAA4G;IAC5G,OAAO,IAAI,gBAAgB,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAI7C;;;;;;;;OAQG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAY1B;;;;;;OAMG;IACH,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAIxD;;;;;;OAMG;IACH,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,GAAG,SAAS;IAI9E;;;;OAIG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,SAAS;IAIlD;;;OAGG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,SAAS;CAGnD"}
|