@atom-workflow-agent/workflow-engine 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 +201 -0
- package/README.md +36 -0
- package/README.zh-CN.md +36 -0
- package/dist/cache/cache.d.ts +18 -0
- package/dist/cache/cache.d.ts.map +1 -0
- package/dist/cache/cache.js +44 -0
- package/dist/cache/cache.js.map +1 -0
- package/dist/diagnostics/public-value.d.ts +5 -0
- package/dist/diagnostics/public-value.d.ts.map +1 -0
- package/dist/diagnostics/public-value.js +23 -0
- package/dist/diagnostics/public-value.js.map +1 -0
- package/dist/diagnostics/run-diagnostics.d.ts +12 -0
- package/dist/diagnostics/run-diagnostics.d.ts.map +1 -0
- package/dist/diagnostics/run-diagnostics.js +90 -0
- package/dist/diagnostics/run-diagnostics.js.map +1 -0
- package/dist/diagnostics/run-graph-overlay.d.ts +5 -0
- package/dist/diagnostics/run-graph-overlay.d.ts.map +1 -0
- package/dist/diagnostics/run-graph-overlay.js +125 -0
- package/dist/diagnostics/run-graph-overlay.js.map +1 -0
- package/dist/diagnostics/run-root-cause.d.ts +4 -0
- package/dist/diagnostics/run-root-cause.d.ts.map +1 -0
- package/dist/diagnostics/run-root-cause.js +111 -0
- package/dist/diagnostics/run-root-cause.js.map +1 -0
- package/dist/handoff/host-handoff.d.ts +59 -0
- package/dist/handoff/host-handoff.d.ts.map +1 -0
- package/dist/handoff/host-handoff.js +235 -0
- package/dist/handoff/host-handoff.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/machine/runtime-machine.d.ts +151 -0
- package/dist/machine/runtime-machine.d.ts.map +1 -0
- package/dist/machine/runtime-machine.js +141 -0
- package/dist/machine/runtime-machine.js.map +1 -0
- package/dist/policy/retry.d.ts +10 -0
- package/dist/policy/retry.d.ts.map +1 -0
- package/dist/policy/retry.js +40 -0
- package/dist/policy/retry.js.map +1 -0
- package/dist/ports/runtime-ports.d.ts +25 -0
- package/dist/ports/runtime-ports.d.ts.map +1 -0
- package/dist/ports/runtime-ports.js +2 -0
- package/dist/ports/runtime-ports.js.map +1 -0
- package/dist/revision/workflow-revision.d.ts +18 -0
- package/dist/revision/workflow-revision.d.ts.map +1 -0
- package/dist/revision/workflow-revision.js +115 -0
- package/dist/revision/workflow-revision.js.map +1 -0
- package/dist/runtime/durable-workflow-engine.d.ts +78 -0
- package/dist/runtime/durable-workflow-engine.d.ts.map +1 -0
- package/dist/runtime/durable-workflow-engine.js +1593 -0
- package/dist/runtime/durable-workflow-engine.js.map +1 -0
- package/dist/runtime/resume-delivery.d.ts +19 -0
- package/dist/runtime/resume-delivery.d.ts.map +1 -0
- package/dist/runtime/resume-delivery.js +53 -0
- package/dist/runtime/resume-delivery.js.map +1 -0
- package/dist/runtime/resume-directive.d.ts +6 -0
- package/dist/runtime/resume-directive.d.ts.map +1 -0
- package/dist/runtime/resume-directive.js +22 -0
- package/dist/runtime/resume-directive.js.map +1 -0
- package/dist/runtime/state-machines.d.ts +5 -0
- package/dist/runtime/state-machines.d.ts.map +1 -0
- package/dist/runtime/state-machines.js +53 -0
- package/dist/runtime/state-machines.js.map +1 -0
- package/dist/store/execution-run-storage-layout.d.ts +15 -0
- package/dist/store/execution-run-storage-layout.d.ts.map +1 -0
- package/dist/store/execution-run-storage-layout.js +26 -0
- package/dist/store/execution-run-storage-layout.js.map +1 -0
- package/dist/store/local-artifact-store.d.ts +18 -0
- package/dist/store/local-artifact-store.d.ts.map +1 -0
- package/dist/store/local-artifact-store.js +79 -0
- package/dist/store/local-artifact-store.js.map +1 -0
- package/dist/store/local-execution-run-store.d.ts +52 -0
- package/dist/store/local-execution-run-store.d.ts.map +1 -0
- package/dist/store/local-execution-run-store.js +143 -0
- package/dist/store/local-execution-run-store.js.map +1 -0
- package/dist/store/local-workflow-store.d.ts +22 -0
- package/dist/store/local-workflow-store.d.ts.map +1 -0
- package/dist/store/local-workflow-store.js +145 -0
- package/dist/store/local-workflow-store.js.map +1 -0
- package/dist/store/runtime-snapshot.d.ts +56 -0
- package/dist/store/runtime-snapshot.d.ts.map +1 -0
- package/dist/store/runtime-snapshot.js +4 -0
- package/dist/store/runtime-snapshot.js.map +1 -0
- package/dist/store/workflow-storage-layout.d.ts +7 -0
- package/dist/store/workflow-storage-layout.d.ts.map +1 -0
- package/dist/store/workflow-storage-layout.js +18 -0
- package/dist/store/workflow-storage-layout.js.map +1 -0
- package/dist/topology/workflow-topology.d.ts +4 -0
- package/dist/topology/workflow-topology.d.ts.map +1 -0
- package/dist/topology/workflow-topology.js +76 -0
- package/dist/topology/workflow-topology.js.map +1 -0
- package/package.json +54 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# @atom-workflow-agent/workflow-engine
|
|
2
|
+
|
|
3
|
+
[English](README.md) | [简体中文](README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
Immutable workflow revision storage and durable execution of frozen IR.
|
|
6
|
+
|
|
7
|
+
## Responsibilities
|
|
8
|
+
|
|
9
|
+
- Stores and verifies immutable workflow revisions.
|
|
10
|
+
- Resolves a stable Workflow name/id to latest, or `name@revision` to one exact immutable Revision.
|
|
11
|
+
- Schedules Atom, Switch, Map, and Join nodes with bounded revisits, retry, cache, and artifacts.
|
|
12
|
+
- Accepts Signal and HostTask responses transactionally, persists one durable continuation, and retries or recovers `resume()` with the same payload when policy permits.
|
|
13
|
+
- Persists Runs, events, checkpoints, Signals, HostTasks, recovery, and safe diagnostic projections.
|
|
14
|
+
- Projects a primary root cause, retry evidence, pending interaction, Artifact index, and exact next action without exposing internal checkpoints.
|
|
15
|
+
- Accepts application adapters through `WorkflowRunStore`, `WorkflowArtifactStore`, and `WorkflowAtomResolver`.
|
|
16
|
+
|
|
17
|
+
## Boundaries
|
|
18
|
+
|
|
19
|
+
- Does not plan workflows or discover packages.
|
|
20
|
+
|
|
21
|
+
## Main entry points
|
|
22
|
+
|
|
23
|
+
- `DurableWorkflowEngine`
|
|
24
|
+
- `RuntimeMachine`
|
|
25
|
+
- `LocalWorkflowStore`
|
|
26
|
+
- `LocalExecutionRunStore`
|
|
27
|
+
- `WorkflowRunStore` / `WorkflowArtifactStore` / `WorkflowAtomResolver`
|
|
28
|
+
|
|
29
|
+
## Development
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pnpm --filter @atom-workflow-agent/workflow-engine typecheck
|
|
33
|
+
pnpm --filter @atom-workflow-agent/workflow-engine test
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
See the project [documentation](../../docs/README.md) for shared concepts and complete flows.
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# @atom-workflow-agent/workflow-engine
|
|
2
|
+
|
|
3
|
+
[English](README.md) | [简体中文](README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
不可变 Workflow Revision 存储与冻结 IR 的持久执行引擎。
|
|
6
|
+
|
|
7
|
+
## 职责
|
|
8
|
+
|
|
9
|
+
- 存储并复验不可变 Workflow Revision。
|
|
10
|
+
- 将稳定 Workflow 名称/id 解析到最新版本,或将 `名称@版本` 精确解析到一个不可变 Revision。
|
|
11
|
+
- 调度 Atom、Switch、Map、Join,并处理有界回访、重试、缓存和 Artifact。
|
|
12
|
+
- 以事务方式接收 Signal 与 HostTask 响应,持久化唯一 Continuation,并在策略允许时使用同一份数据重试或恢复 `resume()`。
|
|
13
|
+
- 持久化 Run、事件、checkpoint、Signal、HostTask、恢复与安全诊断投影。
|
|
14
|
+
- 在不暴露内部 checkpoint 的前提下投影首要根因、重试证据、待处理交互、Artifact 索引和准确下一动作。
|
|
15
|
+
- 通过 `WorkflowRunStore`、`WorkflowArtifactStore` 与 `WorkflowAtomResolver` 接受应用层适配器。
|
|
16
|
+
|
|
17
|
+
## 边界
|
|
18
|
+
|
|
19
|
+
- 不规划 Workflow,也不发现 Package。
|
|
20
|
+
|
|
21
|
+
## 主要入口
|
|
22
|
+
|
|
23
|
+
- `DurableWorkflowEngine`
|
|
24
|
+
- `RuntimeMachine`
|
|
25
|
+
- `LocalWorkflowStore`
|
|
26
|
+
- `LocalExecutionRunStore`
|
|
27
|
+
- `WorkflowRunStore` / `WorkflowArtifactStore` / `WorkflowAtomResolver`
|
|
28
|
+
|
|
29
|
+
## 开发
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pnpm --filter @atom-workflow-agent/workflow-engine typecheck
|
|
33
|
+
pnpm --filter @atom-workflow-agent/workflow-engine test
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
通用概念与完整流程见项目[中文文档](../../docs/README.zh-CN.md)。
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface Cache {
|
|
2
|
+
get<T>(key: string): Promise<T | undefined>;
|
|
3
|
+
set<T>(key: string, value: T, ttlMs: number): Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
export declare function stableCacheKey(value: unknown): string;
|
|
6
|
+
export declare class MemoryCache implements Cache {
|
|
7
|
+
private readonly entries;
|
|
8
|
+
get<T>(key: string): Promise<T | undefined>;
|
|
9
|
+
set<T>(key: string, value: T, ttlMs: number): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export declare class FileCache implements Cache {
|
|
12
|
+
private readonly directory;
|
|
13
|
+
constructor(directory: string);
|
|
14
|
+
get<T>(key: string): Promise<T | undefined>;
|
|
15
|
+
set<T>(key: string, value: T, ttlMs: number): Promise<void>;
|
|
16
|
+
private pathFor;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/cache/cache.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,KAAK;IACpB,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IAC5C,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7D;AAID,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAErD;AAED,qBAAa,WAAY,YAAW,KAAK;IACvC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6C;IAC/D,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAQ3C,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGlE;AAED,qBAAa,SAAU,YAAW,KAAK;IACzB,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,MAAM;IACxC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAQ3C,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOjE,OAAO,CAAC,OAAO;CAChB"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
export function stableCacheKey(value) {
|
|
5
|
+
return createHash("sha256").update(JSON.stringify(value)).digest("hex");
|
|
6
|
+
}
|
|
7
|
+
export class MemoryCache {
|
|
8
|
+
entries = new Map();
|
|
9
|
+
async get(key) {
|
|
10
|
+
const entry = this.entries.get(key);
|
|
11
|
+
if (!entry || entry.expiresAt <= Date.now()) {
|
|
12
|
+
this.entries.delete(key);
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
return entry.value;
|
|
16
|
+
}
|
|
17
|
+
async set(key, value, ttlMs) {
|
|
18
|
+
this.entries.set(key, { value, expiresAt: Date.now() + ttlMs });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export class FileCache {
|
|
22
|
+
directory;
|
|
23
|
+
constructor(directory) {
|
|
24
|
+
this.directory = directory;
|
|
25
|
+
}
|
|
26
|
+
async get(key) {
|
|
27
|
+
try {
|
|
28
|
+
const envelope = JSON.parse(await readFile(this.pathFor(key), "utf8"));
|
|
29
|
+
return envelope.expiresAt > Date.now() ? envelope.value : undefined;
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
async set(key, value, ttlMs) {
|
|
36
|
+
await mkdir(this.directory, { recursive: true });
|
|
37
|
+
const path = this.pathFor(key);
|
|
38
|
+
const temporary = `${path}.${process.pid}.tmp`;
|
|
39
|
+
await writeFile(temporary, JSON.stringify({ value, expiresAt: Date.now() + ttlMs }), "utf8");
|
|
40
|
+
await rename(temporary, path);
|
|
41
|
+
}
|
|
42
|
+
pathFor(key) { return join(this.directory, `${key}.json`); }
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/cache/cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU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E,MAAM,CAAC,CAAqB,CAAC;YAC3F,OAAO,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;QACtE,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;IACD,KAAK,CAAC,GAAG,CAAI,GAAW,EAAE,KAAQ,EAAE,KAAa;QAC/C,MAAM,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACjD,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC/B,MAAM,SAAS,GAAG,GAAG,IAAI,IAAI,OAAO,CAAC,GAAG,MAAM,CAAC;QAC/C,MAAM,SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;QAC7F,MAAM,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAChC,CAAC;IACO,OAAO,CAAC,GAAW,IAAY,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CACrF"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { JsonValue } from "@atom-workflow-agent/contracts";
|
|
2
|
+
export declare function publicValueHash(value: unknown): string;
|
|
3
|
+
/** Stable bounded projection shared by diagnostics and read-only visualization. */
|
|
4
|
+
export declare function projectPublicValue(value: JsonValue, key?: string, depth?: number): JsonValue;
|
|
5
|
+
//# sourceMappingURL=public-value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-value.d.ts","sourceRoot":"","sources":["../../src/diagnostics/public-value.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAKhE,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEtD;AAED,mFAAmF;AACnF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,SAAK,EAAE,KAAK,SAAI,GAAG,SAAS,CAQnF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
const NEVER_EXPOSE = /(?:continuation(?:token)?|authorization|password|passwd|secret|api[-_]?key|access[-_]?token|refresh[-_]?token|cookie|environment|env|path|cwd)$/i;
|
|
3
|
+
const SENSITIVE_TEXT = /(?:prompt|instruction|rawoutput|response)$/i;
|
|
4
|
+
export function publicValueHash(value) {
|
|
5
|
+
return `sha256:${createHash("sha256").update(JSON.stringify(value)).digest("hex")}`;
|
|
6
|
+
}
|
|
7
|
+
/** Stable bounded projection shared by diagnostics and read-only visualization. */
|
|
8
|
+
export function projectPublicValue(value, key = "", depth = 0) {
|
|
9
|
+
if (NEVER_EXPOSE.test(key))
|
|
10
|
+
return { redacted: true, hash: publicValueHash(value) };
|
|
11
|
+
if (SENSITIVE_TEXT.test(key))
|
|
12
|
+
return { redacted: true, hash: publicValueHash(value), type: Array.isArray(value) ? "array" : typeof value };
|
|
13
|
+
if (typeof value === "string")
|
|
14
|
+
return value.length > 512 ? `${value.slice(0, 512)}…[truncated:${value.length}]` : value;
|
|
15
|
+
if (value === null || typeof value !== "object")
|
|
16
|
+
return value;
|
|
17
|
+
if (depth >= 8)
|
|
18
|
+
return { truncated: true, hash: publicValueHash(value) };
|
|
19
|
+
if (Array.isArray(value))
|
|
20
|
+
return value.slice(0, 100).map((item) => projectPublicValue(item, key, depth + 1));
|
|
21
|
+
return Object.fromEntries(Object.entries(value).slice(0, 200).map(([name, item]) => [name, projectPublicValue(item, name, depth + 1)]));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=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IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;IACzE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,kBAAkB,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;IAC7G,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1I,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { RunDiagnosticLevel, RunDiagnosticView, RuntimeEvent } from "@atom-workflow-agent/contracts";
|
|
2
|
+
import type { RuntimeSnapshot } from "../store/runtime-snapshot.js";
|
|
3
|
+
export interface RunDiagnosticOptions {
|
|
4
|
+
readonly level?: RunDiagnosticLevel;
|
|
5
|
+
readonly cursor?: string;
|
|
6
|
+
readonly limit?: number;
|
|
7
|
+
readonly nodeId?: string;
|
|
8
|
+
readonly activationId?: string;
|
|
9
|
+
readonly attemptId?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function projectRunDiagnostic(snapshot: RuntimeSnapshot, events: readonly RuntimeEvent[], options?: RunDiagnosticOptions): RunDiagnosticView;
|
|
12
|
+
//# sourceMappingURL=run-diagnostics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-diagnostics.d.ts","sourceRoot":"","sources":["../../src/diagnostics/run-diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,kBAAkB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACrH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAGpE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,CAAC,EAAE,kBAAkB,CAAC;IACpC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAUD,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,eAAe,EAAE,MAAM,EAAE,SAAS,YAAY,EAAE,EAAE,OAAO,GAAE,oBAAyB,GAAG,iBAAiB,CA4EtJ"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { projectPublicValue as bounded, publicValueHash as hash } from "./public-value.js";
|
|
2
|
+
function page(values, cursor, requested) {
|
|
3
|
+
const offset = cursor === undefined ? 0 : Number(cursor);
|
|
4
|
+
if (!Number.isInteger(offset) || offset < 0)
|
|
5
|
+
throw Object.assign(new Error("Diagnostic cursor is invalid"), { code: "RUN_DIAGNOSTIC_CURSOR_INVALID" });
|
|
6
|
+
const limit = Math.min(Math.max(requested ?? 100, 1), 1000);
|
|
7
|
+
const items = values.slice(offset, offset + limit);
|
|
8
|
+
return { items, page: { limit, returned: items.length, ...(offset + items.length < values.length ? { nextCursor: String(offset + items.length) } : {}) } };
|
|
9
|
+
}
|
|
10
|
+
export function projectRunDiagnostic(snapshot, events, options = {}) {
|
|
11
|
+
const level = options.level ?? "summary";
|
|
12
|
+
const filteredNodes = snapshot.nodeRuns.filter((node) => (!options.nodeId || node.nodeId === options.nodeId) && (!options.activationId || node.activationId === options.activationId));
|
|
13
|
+
const activationIds = new Set(filteredNodes.map((node) => node.activationId));
|
|
14
|
+
const filteredAttempts = snapshot.attempts.filter((attempt) => (!options.attemptId || attempt.attemptId === options.attemptId) && (!options.nodeId || attempt.nodeId === options.nodeId) && (!options.activationId || attempt.activationId === options.activationId));
|
|
15
|
+
const attemptIds = new Set(filteredAttempts.map((attempt) => attempt.attemptId));
|
|
16
|
+
const filteredEvents = events.filter((event) => (!options.nodeId || event.nodeId === options.nodeId) && (!options.activationId || event.activationId === options.activationId) && (!options.attemptId || event.attemptId === options.attemptId));
|
|
17
|
+
const missing = [];
|
|
18
|
+
if (!snapshot.revision)
|
|
19
|
+
missing.push("workflowRevision");
|
|
20
|
+
if (!snapshot.ir)
|
|
21
|
+
missing.push("workflowIR");
|
|
22
|
+
const completeness = {
|
|
23
|
+
status: missing.length ? "partial" : "complete",
|
|
24
|
+
missingSections: missing,
|
|
25
|
+
lastEventSequence: events.at(-1)?.sequence ?? -1,
|
|
26
|
+
evidenceHash: hash({ runId: snapshot.run.runId, revision: snapshot.revision?.workflowRevisionId, nodeRuns: snapshot.nodeRuns.length, attempts: snapshot.attempts.length, lastEvent: events.at(-1)?.sequence ?? -1 }),
|
|
27
|
+
};
|
|
28
|
+
const run = bounded({
|
|
29
|
+
runId: snapshot.run.runId,
|
|
30
|
+
status: snapshot.run.status,
|
|
31
|
+
goal: snapshot.run.goal,
|
|
32
|
+
planId: snapshot.run.planId ?? null,
|
|
33
|
+
workflowRevisionId: snapshot.revision.workflowRevisionId,
|
|
34
|
+
workflowIrHash: snapshot.ir.hash,
|
|
35
|
+
outputs: snapshot.run.outputs ?? {},
|
|
36
|
+
error: snapshot.run.error ?? null,
|
|
37
|
+
createdAt: snapshot.run.createdAt,
|
|
38
|
+
startedAt: snapshot.run.startedAt ?? null,
|
|
39
|
+
endedAt: snapshot.run.endedAt ?? null,
|
|
40
|
+
counts: { nodeActivations: snapshot.nodeRuns.length, attempts: snapshot.attempts.length, resumeDeliveries: snapshot.resumeDeliveries.length, artifacts: snapshot.artifacts.length, events: events.length },
|
|
41
|
+
decisions: snapshot.decisions,
|
|
42
|
+
maps: snapshot.mapRuns.map((map) => ({ mapRunId: map.mapRunId, nodeId: map.mapNodeId, status: map.status, itemCount: map.items.length, completed: map.completedIndices.length })),
|
|
43
|
+
pending: {
|
|
44
|
+
signals: snapshot.signals.filter((item) => item.status === "waiting").length,
|
|
45
|
+
hostTasks: snapshot.hostTasks.filter((item) => item.status === "waiting").length,
|
|
46
|
+
continuations: snapshot.resumeDeliveries.filter((item) => item.status === "accepted" || item.status === "processing" || item.status === "retry_wait").length,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
if (level === "summary")
|
|
50
|
+
return { schemaVersion: "1.0", level, run, completeness };
|
|
51
|
+
if (level === "timeline") {
|
|
52
|
+
const result = page(filteredEvents.map((event) => bounded(event)), options.cursor, options.limit);
|
|
53
|
+
return { schemaVersion: "1.0", level, run, completeness, timeline: result.items, page: result.page };
|
|
54
|
+
}
|
|
55
|
+
const evidenceRows = filteredNodes.map((node) => {
|
|
56
|
+
const nodeAttempts = filteredAttempts.filter((attempt) => attempt.activationId === node.activationId);
|
|
57
|
+
const declaration = snapshot.ir.nodes.find((candidate) => candidate.id === node.nodeId);
|
|
58
|
+
const atomEvidence = declaration?.kind === "atom" ? snapshot.revision.referencedAtoms.find((atom) => atom.key === declaration.atom.key) : undefined;
|
|
59
|
+
return bounded({
|
|
60
|
+
declaration: declaration ? {
|
|
61
|
+
kind: declaration.kind,
|
|
62
|
+
...(declaration.kind === "atom" ? { atom: declaration.atom.key, manifestHash: atomEvidence?.manifestHash ?? null, inputSchemaHash: atomEvidence?.inputSchemaHash ?? null, outputSchemaHash: atomEvidence?.outputSchemaHash ?? null, declaredInput: declaration.input, effectivePolicy: declaration.effectivePolicy } : {}),
|
|
63
|
+
} : null,
|
|
64
|
+
node: {
|
|
65
|
+
nodeId: node.nodeId, activationId: node.activationId, activationIndex: node.activationIndex, status: node.status,
|
|
66
|
+
input: node.input ?? null, inputHash: node.input === undefined ? null : hash(node.input),
|
|
67
|
+
output: node.output ?? null, outputHash: node.output === undefined ? null : hash(node.output),
|
|
68
|
+
artifacts: node.artifacts, error: node.error ?? null,
|
|
69
|
+
},
|
|
70
|
+
attempts: nodeAttempts.map((attempt) => ({
|
|
71
|
+
attemptId: attempt.attemptId, state: attempt.state, phase: attempt.phase, tickCount: attempt.tickCount,
|
|
72
|
+
activeDurationMs: attempt.activeDurationMs, checkpointHash: attempt.checkpointHash ?? null,
|
|
73
|
+
lifecycleState: attempt.lifecycleSnapshot ?? null, error: attempt.error ?? null,
|
|
74
|
+
})),
|
|
75
|
+
events: filteredEvents.filter((event) => event.activationId === node.activationId || (event.attemptId && attemptIds.has(event.attemptId))).map((event) => ({ sequence: event.sequence, type: event.type, timestamp: event.timestamp, data: event.data })),
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
const result = page(evidenceRows, options.cursor, options.limit);
|
|
79
|
+
return { schemaVersion: "1.0", level, run, completeness, evidence: bounded({
|
|
80
|
+
rows: result.items,
|
|
81
|
+
unmatchedAttemptCount: filteredAttempts.filter((attempt) => !activationIds.has(attempt.activationId)).length,
|
|
82
|
+
edgeTraversals: snapshot.edgeTraversals,
|
|
83
|
+
signals: snapshot.signals,
|
|
84
|
+
hostTasks: snapshot.hostTasks,
|
|
85
|
+
resumeDeliveries: snapshot.resumeDeliveries.map(({ payload: _payload, submissionHash: _submissionHash, ...delivery }) => delivery),
|
|
86
|
+
resourceLeases: snapshot.resourceLeases,
|
|
87
|
+
artifacts: snapshot.artifacts.map((artifact) => ({ id: artifact.id, kind: artifact.kind, hash: artifact.hash, path: artifact.path ?? null, metadata: artifact.metadata })),
|
|
88
|
+
}), page: result.page };
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=run-diagnostics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run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C,OAAO,EAAE,QAAQ,CAAC,OAAO;YACzB,SAAS,EAAE,QAAQ,CAAC,SAAS;YAC7B,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAE,GAAG,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC;YAClI,cAAc,EAAE,QAAQ,CAAC,cAAc;YACvC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,IAAI,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;SACnJ,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type RunGraphOverlay, type RuntimeEvent } from "@atom-workflow-agent/contracts";
|
|
2
|
+
import type { RuntimeSnapshot } from "../store/runtime-snapshot.js";
|
|
3
|
+
/** Runtime-internal state is reduced to a stable, bounded public overlay here. */
|
|
4
|
+
export declare function projectRunGraphOverlay(snapshot: RuntimeSnapshot, events: readonly RuntimeEvent[]): RunGraphOverlay;
|
|
5
|
+
//# sourceMappingURL=run-graph-overlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-graph-overlay.d.ts","sourceRoot":"","sources":["../../src/diagnostics/run-graph-overlay.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,YAAY,EAElB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAuBpE,kFAAkF;AAClF,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,eAAe,EAAE,MAAM,EAAE,SAAS,YAAY,EAAE,GAAG,eAAe,CAsGlH"}
|