@smeltjs/core 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/README.md +55 -0
- package/THIRD-PARTY.md +140 -0
- package/dist/apply.d.ts +145 -0
- package/dist/apply.d.ts.map +1 -0
- package/dist/apply.js +244 -0
- package/dist/apply.js.map +1 -0
- package/dist/cache/prefix.d.ts +164 -0
- package/dist/cache/prefix.d.ts.map +1 -0
- package/dist/cache/prefix.js +361 -0
- package/dist/cache/prefix.js.map +1 -0
- package/dist/cli/args.d.ts +71 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +308 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/bin.d.ts +3 -0
- package/dist/cli/bin.d.ts.map +1 -0
- package/dist/cli/bin.js +161 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/config.d.ts +73 -0
- package/dist/cli/config.d.ts.map +1 -0
- package/dist/cli/config.js +144 -0
- package/dist/cli/config.js.map +1 -0
- package/dist/cli/init.d.ts +56 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +449 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/report.d.ts +44 -0
- package/dist/cli/report.d.ts.map +1 -0
- package/dist/cli/report.js +113 -0
- package/dist/cli/report.js.map +1 -0
- package/dist/cli/resolve.d.ts +103 -0
- package/dist/cli/resolve.d.ts.map +1 -0
- package/dist/cli/resolve.js +106 -0
- package/dist/cli/resolve.js.map +1 -0
- package/dist/cli/run.d.ts +99 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +351 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/detect.d.ts +16 -0
- package/dist/detect.d.ts.map +1 -0
- package/dist/detect.js +18 -0
- package/dist/detect.js.map +1 -0
- package/dist/errors.d.ts +88 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +107 -0
- package/dist/errors.js.map +1 -0
- package/dist/hash.d.ts +13 -0
- package/dist/hash.d.ts.map +1 -0
- package/dist/hash.js +16 -0
- package/dist/hash.js.map +1 -0
- package/dist/index.d.ts +121 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +93 -0
- package/dist/index.js.map +1 -0
- package/dist/lang/bash.d.ts +3 -0
- package/dist/lang/bash.d.ts.map +1 -0
- package/dist/lang/bash.js +28 -0
- package/dist/lang/bash.js.map +1 -0
- package/dist/lang/c.d.ts +3 -0
- package/dist/lang/c.d.ts.map +1 -0
- package/dist/lang/c.js +39 -0
- package/dist/lang/c.js.map +1 -0
- package/dist/lang/c_sharp.d.ts +3 -0
- package/dist/lang/c_sharp.d.ts.map +1 -0
- package/dist/lang/c_sharp.js +37 -0
- package/dist/lang/c_sharp.js.map +1 -0
- package/dist/lang/cpp.d.ts +3 -0
- package/dist/lang/cpp.d.ts.map +1 -0
- package/dist/lang/cpp.js +46 -0
- package/dist/lang/cpp.js.map +1 -0
- package/dist/lang/go.d.ts +3 -0
- package/dist/lang/go.d.ts.map +1 -0
- package/dist/lang/go.js +31 -0
- package/dist/lang/go.js.map +1 -0
- package/dist/lang/java.d.ts +3 -0
- package/dist/lang/java.d.ts.map +1 -0
- package/dist/lang/java.js +34 -0
- package/dist/lang/java.js.map +1 -0
- package/dist/lang/javascript.d.ts +3 -0
- package/dist/lang/javascript.d.ts.map +1 -0
- package/dist/lang/javascript.js +28 -0
- package/dist/lang/javascript.js.map +1 -0
- package/dist/lang/kotlin.d.ts +3 -0
- package/dist/lang/kotlin.d.ts.map +1 -0
- package/dist/lang/kotlin.js +37 -0
- package/dist/lang/kotlin.js.map +1 -0
- package/dist/lang/php.d.ts +3 -0
- package/dist/lang/php.d.ts.map +1 -0
- package/dist/lang/php.js +37 -0
- package/dist/lang/php.js.map +1 -0
- package/dist/lang/profile.d.ts +130 -0
- package/dist/lang/profile.d.ts.map +1 -0
- package/dist/lang/profile.js +2 -0
- package/dist/lang/profile.js.map +1 -0
- package/dist/lang/python.d.ts +3 -0
- package/dist/lang/python.d.ts.map +1 -0
- package/dist/lang/python.js +33 -0
- package/dist/lang/python.js.map +1 -0
- package/dist/lang/registry.d.ts +31 -0
- package/dist/lang/registry.d.ts.map +1 -0
- package/dist/lang/registry.js +89 -0
- package/dist/lang/registry.js.map +1 -0
- package/dist/lang/ruby.d.ts +3 -0
- package/dist/lang/ruby.d.ts.map +1 -0
- package/dist/lang/ruby.js +47 -0
- package/dist/lang/ruby.js.map +1 -0
- package/dist/lang/rust.d.ts +3 -0
- package/dist/lang/rust.d.ts.map +1 -0
- package/dist/lang/rust.js +45 -0
- package/dist/lang/rust.js.map +1 -0
- package/dist/lang/swift.d.ts +3 -0
- package/dist/lang/swift.d.ts.map +1 -0
- package/dist/lang/swift.js +34 -0
- package/dist/lang/swift.js.map +1 -0
- package/dist/lang/tsx.d.ts +4 -0
- package/dist/lang/tsx.d.ts.map +1 -0
- package/dist/lang/tsx.js +11 -0
- package/dist/lang/tsx.js.map +1 -0
- package/dist/lang/typescript.d.ts +18 -0
- package/dist/lang/typescript.d.ts.map +1 -0
- package/dist/lang/typescript.js +61 -0
- package/dist/lang/typescript.js.map +1 -0
- package/dist/net/policy.d.ts +49 -0
- package/dist/net/policy.d.ts.map +1 -0
- package/dist/net/policy.js +120 -0
- package/dist/net/policy.js.map +1 -0
- package/dist/plan/grammar.d.ts +38 -0
- package/dist/plan/grammar.d.ts.map +1 -0
- package/dist/plan/grammar.js +85 -0
- package/dist/plan/grammar.js.map +1 -0
- package/dist/plan/lexical.d.ts +51 -0
- package/dist/plan/lexical.d.ts.map +1 -0
- package/dist/plan/lexical.js +167 -0
- package/dist/plan/lexical.js.map +1 -0
- package/dist/plan/planners.d.ts +35 -0
- package/dist/plan/planners.d.ts.map +1 -0
- package/dist/plan/planners.js +26 -0
- package/dist/plan/planners.js.map +1 -0
- package/dist/plan/structural.d.ts +68 -0
- package/dist/plan/structural.d.ts.map +1 -0
- package/dist/plan/structural.js +458 -0
- package/dist/plan/structural.js.map +1 -0
- package/dist/repomap/cache.d.ts +53 -0
- package/dist/repomap/cache.d.ts.map +1 -0
- package/dist/repomap/cache.js +139 -0
- package/dist/repomap/cache.js.map +1 -0
- package/dist/repomap/map.d.ts +161 -0
- package/dist/repomap/map.d.ts.map +1 -0
- package/dist/repomap/map.js +302 -0
- package/dist/repomap/map.js.map +1 -0
- package/dist/repomap/rank.d.ts +52 -0
- package/dist/repomap/rank.d.ts.map +1 -0
- package/dist/repomap/rank.js +155 -0
- package/dist/repomap/rank.js.map +1 -0
- package/dist/repomap/tags.d.ts +47 -0
- package/dist/repomap/tags.d.ts.map +1 -0
- package/dist/repomap/tags.js +101 -0
- package/dist/repomap/tags.js.map +1 -0
- package/dist/retrieve.d.ts +14 -0
- package/dist/retrieve.d.ts.map +1 -0
- package/dist/retrieve.js +44 -0
- package/dist/retrieve.js.map +1 -0
- package/dist/stages.d.ts +22 -0
- package/dist/stages.d.ts.map +1 -0
- package/dist/stages.js +33 -0
- package/dist/stages.js.map +1 -0
- package/dist/stats.d.ts +40 -0
- package/dist/stats.d.ts.map +1 -0
- package/dist/stats.js +37 -0
- package/dist/stats.js.map +1 -0
- package/dist/store-dir.d.ts +98 -0
- package/dist/store-dir.d.ts.map +1 -0
- package/dist/store-dir.js +379 -0
- package/dist/store-dir.js.map +1 -0
- package/dist/store.d.ts +36 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +56 -0
- package/dist/store.js.map +1 -0
- package/dist/types.d.ts +298 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/grammars/tree-sitter-bash.wasm +0 -0
- package/grammars/tree-sitter-c.wasm +0 -0
- package/grammars/tree-sitter-c_sharp.wasm +0 -0
- package/grammars/tree-sitter-cpp.wasm +0 -0
- package/grammars/tree-sitter-go.wasm +0 -0
- package/grammars/tree-sitter-java.wasm +0 -0
- package/grammars/tree-sitter-javascript.wasm +0 -0
- package/grammars/tree-sitter-kotlin.wasm +0 -0
- package/grammars/tree-sitter-php.wasm +0 -0
- package/grammars/tree-sitter-python.wasm +0 -0
- package/grammars/tree-sitter-ruby.wasm +0 -0
- package/grammars/tree-sitter-rust.wasm +0 -0
- package/grammars/tree-sitter-swift.wasm +0 -0
- package/grammars/tree-sitter-tsx.wasm +0 -0
- package/grammars/tree-sitter-typescript.wasm +0 -0
- package/package.json +68 -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,55 @@
|
|
|
1
|
+
# @smeltjs/core
|
|
2
|
+
|
|
3
|
+
Structure-aware, reversible context optimization for coding agents. Zero network calls.
|
|
4
|
+
|
|
5
|
+
This is the library package. The project README, the four laws and their reasoning, the
|
|
6
|
+
build plan and the consumer contract all live in the repository root:
|
|
7
|
+
**https://github.com/mong-x/smelt**
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { createSmelter } from '@smeltjs/core';
|
|
11
|
+
|
|
12
|
+
const smelter = createSmelter({ defaultBudgetBytes: 8_000 });
|
|
13
|
+
|
|
14
|
+
const result = await smelter.smelt(toolOutput, {
|
|
15
|
+
path: 'src/server.ts',
|
|
16
|
+
focus: ['handleRequest'],
|
|
17
|
+
budgetBytes: 4_000,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
result.text; // send this to the model
|
|
21
|
+
smelter.tool; // the `smelt_retrieve` tool that gives it the rest back
|
|
22
|
+
smelter.stats().expansionRate; // whether you cut too much
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
There is also a CLI, installed as `smelt` (or run via `npx @smeltjs/core`):
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
smelt src/server.ts --budget 4000 --focus handleRequest # text on stdout, report on stderr
|
|
29
|
+
smelt --budget 4000 --focus TypeError < build.log
|
|
30
|
+
smelt --strategy structural src/api.ts --budget 4000 # parse-tree collapse for code
|
|
31
|
+
smelt --reconstruct result.json # the round trip, from a shell
|
|
32
|
+
smelt init # the setup wizard: defaults, back-navigation, smelt.config.json
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Budgets are UTF-8 bytes, permanently** — the only unit computable locally for every
|
|
36
|
+
model, which is what makes the zero-network guarantee possible. Pass a `measure` if you
|
|
37
|
+
want a token count in the result as well; the budget stays bytes.
|
|
38
|
+
|
|
39
|
+
**Two stability promises.** The marker format (`<<smelt/v1: … >>`) and the
|
|
40
|
+
`smelt_retrieve` tool name are stable from 0.1 and treated as 1.0, because markers go into
|
|
41
|
+
prompts and a silent change to one shows up as worse model output with no error anywhere.
|
|
42
|
+
The TypeScript API is `0.x` and may move.
|
|
43
|
+
|
|
44
|
+
The parsers ship inside this tarball — no native build step, no post-install download.
|
|
45
|
+
That makes smelt a redistributor, so [`THIRD-PARTY.md`](./THIRD-PARTY.md) carries the
|
|
46
|
+
licences, generated from package metadata rather than written by hand.
|
|
47
|
+
|
|
48
|
+
**0.x.** The full v1 slice plan has shipped: structural planning (tree-sitter, with
|
|
49
|
+
signatures and doc comments always kept), the lexical planner, a persistent
|
|
50
|
+
content-addressed store, cache-prefix hygiene (detect, never rewrite), a repo-map
|
|
51
|
+
planner modelled on Aider's, the `smelt init` wizard, and a committed measurement
|
|
52
|
+
harness. An unsupported language under `strategy: 'structural'` is refused, never
|
|
53
|
+
approximated. See [`docs/HANDOFF.md`](https://github.com/mong-x/smelt/blob/main/docs/HANDOFF.md).
|
|
54
|
+
|
|
55
|
+
Apache-2.0.
|
package/THIRD-PARTY.md
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
<!-- GENERATED FILE — do not edit by hand.
|
|
4
|
+
Produced by scripts/generate-third-party.mjs from installed package metadata,
|
|
5
|
+
the bundled grammar files, and packages/core/grammar-provenance.json.
|
|
6
|
+
Regenerate with `pnpm generate:third-party`; a stale copy fails
|
|
7
|
+
packages/core/test/guards/third-party.test.ts. -->
|
|
8
|
+
|
|
9
|
+
`@smeltjs/core` redistributes the files listed below inside its npm tarball. Everything here is someone else's work, under someone else's licence.
|
|
10
|
+
|
|
11
|
+
Attribution is required rather than courteous, because the parsers are **shipped**, not merely depended on: that is what makes "no native compilation, works offline" true. If you redistribute smelt, this file travels with it.
|
|
12
|
+
|
|
13
|
+
## Runtime dependencies
|
|
14
|
+
|
|
15
|
+
### web-tree-sitter 0.25.10 — MIT
|
|
16
|
+
|
|
17
|
+
- Repository: https://github.com/tree-sitter/tree-sitter
|
|
18
|
+
- Declared range: `~0.25.10`
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
The MIT License (MIT)
|
|
22
|
+
|
|
23
|
+
Copyright (c) 2018-2024 Max Brunsfeld
|
|
24
|
+
|
|
25
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
26
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
27
|
+
in the Software without restriction, including without limitation the rights
|
|
28
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
29
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
30
|
+
furnished to do so, subject to the following conditions:
|
|
31
|
+
|
|
32
|
+
The above copyright notice and this permission notice shall be included in all
|
|
33
|
+
copies or substantial portions of the Software.
|
|
34
|
+
|
|
35
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
36
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
37
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
38
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
39
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
40
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
41
|
+
SOFTWARE.
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Bundled tree-sitter grammars
|
|
45
|
+
|
|
46
|
+
The `.wasm` parsers in `grammars/` were taken from **tree-sitter-wasms 0.1.13** (Unlicense), which prebuilds them. The packaging licence covers the packaging; each grammar carries its own, listed after the table.
|
|
47
|
+
|
|
48
|
+
| file | from | version range | licence | bytes | sha256 |
|
|
49
|
+
| ----------------------------- | ---------------------- | ------------- | ------- | ------- | ------------------ |
|
|
50
|
+
| `tree-sitter-bash.wasm` | tree-sitter-bash | `^0.20.5` | MIT | 1400214 | `807dcdb1380a59be` |
|
|
51
|
+
| `tree-sitter-c.wasm` | tree-sitter-c | `^0.20.7` | MIT | 792959 | `056b25072382f72d` |
|
|
52
|
+
| `tree-sitter-c_sharp.wasm` | tree-sitter-c-sharp | `^0.20.0` | MIT | 3978594 | `6266a7e32d68a345` |
|
|
53
|
+
| `tree-sitter-cpp.wasm` | tree-sitter-cpp | `^0.20.4` | MIT | 4662978 | `f6afdf53bfd6de76` |
|
|
54
|
+
| `tree-sitter-go.wasm` | tree-sitter-go | `^0.20.0` | MIT | 235957 | `9963ca89b616eaf0` |
|
|
55
|
+
| `tree-sitter-java.wasm` | tree-sitter-java | `^0.20.2` | MIT | 430239 | `637aac4415fb39a2` |
|
|
56
|
+
| `tree-sitter-javascript.wasm` | tree-sitter-javascript | `^0.20.3` | MIT | 647334 | `63812b9e275d2685` |
|
|
57
|
+
| `tree-sitter-kotlin.wasm` | tree-sitter-kotlin | `^0.3.1` | MIT | 4052705 | `b5cb00c8d06ed0f1` |
|
|
58
|
+
| `tree-sitter-php.wasm` | tree-sitter-php | `^0.22.0` | MIT | 812594 | `55bb617b6f01e14b` |
|
|
59
|
+
| `tree-sitter-python.wasm` | tree-sitter-python | `^0.21.0` | MIT | 476105 | `9056d0fb0c337810` |
|
|
60
|
+
| `tree-sitter-ruby.wasm` | tree-sitter-ruby | `^0.20.1` | MIT | 2106447 | `93a5022855314cdb` |
|
|
61
|
+
| `tree-sitter-rust.wasm` | tree-sitter-rust | `^0.20.4` | MIT | 818756 | `4409921a70d0aa5b` |
|
|
62
|
+
| `tree-sitter-swift.wasm` | tree-sitter-swift | `^0.4.0` | MIT | 3147876 | `41c4fdb2249a3aa6` |
|
|
63
|
+
| `tree-sitter-tsx.wasm` | tree-sitter-typescript | `^0.20.5` | MIT | 2411272 | `6aa3b2c70e76f5d4` |
|
|
64
|
+
| `tree-sitter-typescript.wasm` | tree-sitter-typescript | `^0.20.5` | MIT | 2342690 | `8515404dceed38e1` |
|
|
65
|
+
|
|
66
|
+
### Copyright notices
|
|
67
|
+
|
|
68
|
+
Licence identifiers and copyright lines below were verified on **2026-09-02** against the npm registry and each repository's `LICENSE` file, and are recorded in `grammar-provenance.json`. They are not derivable on this machine: a `.wasm` blob carries no metadata, and the grammar packages are tree-sitter-wasms's own devDependencies, so they are never installed here.
|
|
69
|
+
|
|
70
|
+
- **tree-sitter-bash** — MIT — Copyright (c) 2017 Max Brunsfeld — https://github.com/tree-sitter/tree-sitter-bash
|
|
71
|
+
- **tree-sitter-c** — MIT — Copyright (c) 2014 Max Brunsfeld — https://github.com/tree-sitter/tree-sitter-c
|
|
72
|
+
- **tree-sitter-c-sharp** — MIT — Copyright (c) 2014-2023 Max Brunsfeld, Damien Guard, Amaan Qureshi, and contributors. — https://github.com/tree-sitter/tree-sitter-c-sharp
|
|
73
|
+
- **tree-sitter-cpp** — MIT — Copyright (c) 2014 Max Brunsfeld — https://github.com/tree-sitter/tree-sitter-cpp
|
|
74
|
+
- **tree-sitter-go** — MIT — Copyright (c) 2014 Max Brunsfeld — https://github.com/tree-sitter/tree-sitter-go
|
|
75
|
+
- **tree-sitter-java** — MIT — Copyright (c) 2017 Ayman Nadeem — https://github.com/tree-sitter/tree-sitter-java
|
|
76
|
+
- **tree-sitter-javascript** — MIT — Copyright (c) 2014 Max Brunsfeld — https://github.com/tree-sitter/tree-sitter-javascript
|
|
77
|
+
- **tree-sitter-kotlin** — MIT — Copyright (c) 2019 fwcd — https://github.com/fwcd/tree-sitter-kotlin
|
|
78
|
+
- **tree-sitter-php** — MIT — Copyright (c) 2017 Josh Vera, GitHub — https://github.com/tree-sitter/tree-sitter-php
|
|
79
|
+
- **tree-sitter-python** — MIT — Copyright (c) 2016 Max Brunsfeld — https://github.com/tree-sitter/tree-sitter-python
|
|
80
|
+
- **tree-sitter-ruby** — MIT — Copyright (c) 2016 Rob Rix — https://github.com/tree-sitter/tree-sitter-ruby
|
|
81
|
+
- **tree-sitter-rust** — MIT — Copyright (c) 2017 Maxim Sokolov — https://github.com/tree-sitter/tree-sitter-rust
|
|
82
|
+
- **tree-sitter-swift** — MIT — Copyright (c) 2021 alex-pinkus — https://github.com/alex-pinkus/tree-sitter-swift
|
|
83
|
+
- **tree-sitter-typescript** — MIT — Copyright (c) 2017 Max Brunsfeld — https://github.com/tree-sitter/tree-sitter-typescript
|
|
84
|
+
|
|
85
|
+
### Packaging licence
|
|
86
|
+
|
|
87
|
+
```text
|
|
88
|
+
This is free and unencumbered software released into the public domain.
|
|
89
|
+
|
|
90
|
+
Anyone is free to copy, modify, publish, use, compile, sell, or
|
|
91
|
+
distribute this software, either in source code form or as a compiled
|
|
92
|
+
binary, for any purpose, commercial or non-commercial, and by any
|
|
93
|
+
means.
|
|
94
|
+
|
|
95
|
+
In jurisdictions that recognize copyright laws, the author or authors
|
|
96
|
+
of this software dedicate any and all copyright interest in the
|
|
97
|
+
software to the public domain. We make this dedication for the benefit
|
|
98
|
+
of the public at large and to the detriment of our heirs and
|
|
99
|
+
successors. We intend this dedication to be an overt act of
|
|
100
|
+
relinquishment in perpetuity of all present and future rights to this
|
|
101
|
+
software under copyright law.
|
|
102
|
+
|
|
103
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
104
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
105
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
106
|
+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
107
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
108
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
109
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
110
|
+
|
|
111
|
+
For more information, please refer to <https://unlicense.org>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### The MIT licence
|
|
115
|
+
|
|
116
|
+
Every grammar above is MIT. The body is reproduced once, quoted from the installed `web-tree-sitter` `LICENSE` — each grammar's own copy differs only in the copyright line listed above.
|
|
117
|
+
|
|
118
|
+
```text
|
|
119
|
+
The MIT License (MIT)
|
|
120
|
+
|
|
121
|
+
Copyright (c) 2018-2024 Max Brunsfeld
|
|
122
|
+
|
|
123
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
124
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
125
|
+
in the Software without restriction, including without limitation the rights
|
|
126
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
127
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
128
|
+
furnished to do so, subject to the following conditions:
|
|
129
|
+
|
|
130
|
+
The above copyright notice and this permission notice shall be included in all
|
|
131
|
+
copies or substantial portions of the Software.
|
|
132
|
+
|
|
133
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
134
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
135
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
136
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
137
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
138
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
139
|
+
SOFTWARE.
|
|
140
|
+
```
|
package/dist/apply.d.ts
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import type { DetectedLanguage, ElisionPlan, ElisionStore, MarkerPricing, Measure, SmeltResult } from './types.ts';
|
|
2
|
+
/** Everything the marker text is allowed to depend on. */
|
|
3
|
+
export interface MarkerInfo {
|
|
4
|
+
readonly hash: string;
|
|
5
|
+
readonly bytes: number;
|
|
6
|
+
readonly rule: string;
|
|
7
|
+
readonly explanation: string;
|
|
8
|
+
}
|
|
9
|
+
export type MarkerBuilder = (info: MarkerInfo) => string;
|
|
10
|
+
/**
|
|
11
|
+
* The version of the marker format itself, carried **in band** in every marker.
|
|
12
|
+
*
|
|
13
|
+
* The marker is the one part of smelt a *model* sees, and it goes into prompts.
|
|
14
|
+
* Changing its shape changes model behaviour downstream and shows up as worse output
|
|
15
|
+
* with no error anywhere — this project's signature failure mode, shipped as a patch
|
|
16
|
+
* release. So the wire surface is frozen from 0.1 and treated as 1.0
|
|
17
|
+
* (`CONTRIBUTING.md` § "Two promises, not one"), and a future format is *additive and
|
|
18
|
+
* identifiable*: `smelt/v2` markers can coexist with `smelt/v1` ones, and a consumer
|
|
19
|
+
* parsing markers can tell which it is holding. A format that changed silently would
|
|
20
|
+
* be a substitution; this makes it a declaration.
|
|
21
|
+
*
|
|
22
|
+
* `test/guards/marker-format.test.ts` pins the rendered marker per version and fails if
|
|
23
|
+
* the format moves without the version moving.
|
|
24
|
+
*/
|
|
25
|
+
export declare const MARKER_FORMAT_VERSION = "v1";
|
|
26
|
+
/**
|
|
27
|
+
* The default marker.
|
|
28
|
+
*
|
|
29
|
+
* Its shape is the user-facing form of Laws 2 and 3, in one line the model reads:
|
|
30
|
+
* *which format this is* (the version), *what was removed* (the explanation), *how
|
|
31
|
+
* much* (the byte count), and *how to get it back* (the hash). Anything that cannot
|
|
32
|
+
* fill in all of those is not allowed to be an elision.
|
|
33
|
+
*
|
|
34
|
+
* `<<…>>` rather than a Unicode bracket because it survives every tokenizer, terminal,
|
|
35
|
+
* and diff tool without becoming three tokens of nothing.
|
|
36
|
+
*/
|
|
37
|
+
export declare const defaultMarker: MarkerBuilder;
|
|
38
|
+
/**
|
|
39
|
+
* Line-comment leaders per language: the marker always lands as a comment in the
|
|
40
|
+
* survivor's own syntax, because a bare marker line breaks the syntax of what remains
|
|
41
|
+
* around it — in **every** grammar this was tested against, not just the indented ones.
|
|
42
|
+
*
|
|
43
|
+
* The failure classes, each verified by reparsing a bare-marker survivor:
|
|
44
|
+
*
|
|
45
|
+
* - **python** — significant indentation means a parse error does not stay local.
|
|
46
|
+
* The ERROR node swallows the *neighbouring definitions too* — the survivor stops
|
|
47
|
+
* being Python at all, not just at the marker line.
|
|
48
|
+
* - **ruby** and **bash** — the marker *begins with* `<<`, which both languages read
|
|
49
|
+
* as a heredoc operator. A bare marker line opens a heredoc whose terminator never
|
|
50
|
+
* arrives, and everything after it — every kept declaration — is swallowed into a
|
|
51
|
+
* string literal.
|
|
52
|
+
* - **php** — `<<` is an operator here too: the kept function after a bare marker is
|
|
53
|
+
* re-typed into an anonymous-function operand inside the marker's binary
|
|
54
|
+
* expression. The kept declaration is no longer a declaration in the survivor.
|
|
55
|
+
* - **kotlin**, **swift**, and the rest of the brace-delimited set (typescript, tsx,
|
|
56
|
+
* javascript, rust, go, java, c, cpp, c_sharp) — the folk claim that braces keep a
|
|
57
|
+
* parse error local is **empirically false**: reparsing each language's fixture
|
|
58
|
+
* survivor with its own bundled grammar shows ERROR nodes spanning the kept
|
|
59
|
+
* declarations (a C function's signature absorbed into an ERROR, fifteen cascading
|
|
60
|
+
* ERRORs in swift, and so on). The survivor-reparse guard in
|
|
61
|
+
* `test/guards/structural.test.ts` now asserts the opposite property for every
|
|
62
|
+
* structural language: the survivor reparses with no new issues.
|
|
63
|
+
*
|
|
64
|
+
* Only `'unknown'` keeps the bare marker — lexical text has no syntax to break.
|
|
65
|
+
*
|
|
66
|
+
* This does **not** move the frozen wire surface. The `<<smelt/v1: … >>` core is
|
|
67
|
+
* rendered by {@link defaultMarker}, byte-identical and still versioned in band; the
|
|
68
|
+
* leader is part of the substituted marker text, so `outputRange` covers it and
|
|
69
|
+
* reconstruction stays byte-exact. A comment leader in the survivor's own syntax is
|
|
70
|
+
* the one wrapping that cannot change what a model reads out of the marker.
|
|
71
|
+
*
|
|
72
|
+
* A derived view: each leader is the `markerLeader` fact on the language's
|
|
73
|
+
* {@link LanguageProfile} (`src/lang/`), collected here so marker construction keeps
|
|
74
|
+
* one lookup table.
|
|
75
|
+
*/
|
|
76
|
+
export declare const MARKER_LINE_COMMENT_LEADERS: Readonly<Partial<Record<DetectedLanguage, string>>>;
|
|
77
|
+
/**
|
|
78
|
+
* The marker builder for a language: {@link defaultMarker}, wrapped in the language's
|
|
79
|
+
* line-comment leader when {@link MARKER_LINE_COMMENT_LEADERS} names one — so a Python
|
|
80
|
+
* survivor still parses as Python. Everything else gets `base` unchanged.
|
|
81
|
+
*/
|
|
82
|
+
export declare function markerForLanguage(language: DetectedLanguage, base?: MarkerBuilder): MarkerBuilder;
|
|
83
|
+
/**
|
|
84
|
+
* The one adapter behind the {@link MarkerPricing} seam.
|
|
85
|
+
*
|
|
86
|
+
* Marker cost is this module's fact: `applyPlan` renders the marker, so only this
|
|
87
|
+
* module can price it without guessing. The pricing is built from the **exact builder
|
|
88
|
+
* `applyPlan` will use** — the same resolution, in the same order: a caller-supplied
|
|
89
|
+
* builder (`SmelterConfig.marker` / `ApplyOptions.marker`) wins wholesale, otherwise
|
|
90
|
+
* the language's leader-wrapped default via {@link markerForLanguage}.
|
|
91
|
+
*
|
|
92
|
+
* The custom-builder leg is load-bearing, not a convenience: a caller who installs a
|
|
93
|
+
* longer `MarkerBuilder` changes what every elision costs, and a planner still pricing
|
|
94
|
+
* the *default* marker would keep planning elisions the real marker makes
|
|
95
|
+
* unprofitable — cuts that grow the output, silently. Pricing with the builder's own
|
|
96
|
+
* rendering closes that hole: `costBytes` measures the marker *that builder* would
|
|
97
|
+
* emit, byte for byte.
|
|
98
|
+
*
|
|
99
|
+
* `createSmelter` (and through it, the CLI) calls this centrally, once per smelt call;
|
|
100
|
+
* a caller driving `planLexical`/`planStructural` directly builds its own and puts it
|
|
101
|
+
* on the {@link PlanInput}.
|
|
102
|
+
*/
|
|
103
|
+
export declare function markerPricing(language?: DetectedLanguage, markerBuilder?: MarkerBuilder): MarkerPricing;
|
|
104
|
+
export interface ApplyOptions {
|
|
105
|
+
/**
|
|
106
|
+
* Overrides the marker builder. The default follows the *plan's* language —
|
|
107
|
+
* {@link markerForLanguage} — so the documented composition
|
|
108
|
+
* `planStructural → applyPlan` lands a `# `-led marker in python without the caller
|
|
109
|
+
* wiring it, the same as `createSmelter` does. A bare {@link defaultMarker} in a
|
|
110
|
+
* python survivor is exactly the parse-breaking failure the leader exists to prevent.
|
|
111
|
+
*/
|
|
112
|
+
readonly marker?: MarkerBuilder;
|
|
113
|
+
/** A consumer-supplied counter. See {@link Measure}; the budget stays in bytes. */
|
|
114
|
+
readonly measure?: Measure;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Turn a plan into text.
|
|
118
|
+
*
|
|
119
|
+
* This is the only function in smelt that removes anything, and it contains no
|
|
120
|
+
* judgement at all: it validates the plan, stores every removed run, substitutes
|
|
121
|
+
* markers, and records where each marker landed. All the deciding happens in a
|
|
122
|
+
* {@link Planner}, which is why a plan can be reviewed before a byte moves.
|
|
123
|
+
*
|
|
124
|
+
* @throws {RangeOutOfBoundsError} if a range falls outside the input's UTF-8 bytes.
|
|
125
|
+
* @throws {OverlappingElisionError} if two ranges overlap — applying both would
|
|
126
|
+
* corrupt the output, and picking a winner would be a silent guess.
|
|
127
|
+
*/
|
|
128
|
+
export declare function applyPlan(text: string, plan: ElisionPlan, store: ElisionStore, options?: ApplyOptions): SmeltResult;
|
|
129
|
+
/**
|
|
130
|
+
* Put it all back. `reconstruct(smelt(x), store) === x`, byte for byte — this is Law 3
|
|
131
|
+
* expressed as an executable equation, and `test/guards/reversibility.test.ts` asserts
|
|
132
|
+
* it on every input the suite knows about.
|
|
133
|
+
*
|
|
134
|
+
* Reads through `peek`, **not** `retrieve`: `retrieveCalls` and the expansion rate
|
|
135
|
+
* exist to count *the model asking for hidden material back* — the honest signal this
|
|
136
|
+
* whole project sells. A caller reassembling the original (to diff it, to verify a
|
|
137
|
+
* round trip, to write it to disk) is not that, and counting it would inflate the one
|
|
138
|
+
* number that must never flatter. The guard in
|
|
139
|
+
* `test/guards/expansion-counter.test.ts` pins this: reconstruction leaves every
|
|
140
|
+
* counter exactly where it was.
|
|
141
|
+
*
|
|
142
|
+
* @throws {UnknownHashError} if the store no longer holds an elision's bytes.
|
|
143
|
+
*/
|
|
144
|
+
export declare function reconstruct(result: SmeltResult, store: ElisionStore): string;
|
|
145
|
+
//# sourceMappingURL=apply.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../src/apply.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAGV,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,OAAO,EACP,WAAW,EACZ,MAAM,YAAY,CAAC;AAEpB,0DAA0D;AAC1D,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,UAAU,KAAK,MAAM,CAAC;AAEzD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAE1C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa,EAAE,aACoE,CAAC;AAEjG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC,CAKzF,CAAC;AAEJ;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,gBAAgB,EAC1B,IAAI,GAAE,aAA6B,GAClC,aAAa,CAIf;AAQD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,GAAE,gBAA4B,EACtC,aAAa,CAAC,EAAE,aAAa,GAC5B,aAAa,CAef;AAED,MAAM,WAAW,YAAY;IAC3B;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC;IAChC,mFAAmF;IACnF,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,YAAY,EACnB,OAAO,GAAE,YAAiB,GACzB,WAAW,CA6Eb;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,GAAG,MAAM,CAiB5E"}
|