llm-large-files 0.5.0 → 0.7.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.
Files changed (221) hide show
  1. package/CHANGELOG.md +1402 -467
  2. package/README.md +188 -60
  3. package/dist/analyze.d.ts +5 -0
  4. package/dist/analyze.d.ts.map +1 -1
  5. package/dist/analyze.js +96 -47
  6. package/dist/analyze.js.map +1 -1
  7. package/dist/anthropic/adapter.d.ts +14 -3
  8. package/dist/anthropic/adapter.d.ts.map +1 -1
  9. package/dist/anthropic/adapter.js +190 -39
  10. package/dist/anthropic/adapter.js.map +1 -1
  11. package/dist/ask.d.ts +60 -4
  12. package/dist/ask.d.ts.map +1 -1
  13. package/dist/ask.js +1068 -206
  14. package/dist/ask.js.map +1 -1
  15. package/dist/encoding.d.ts +17 -0
  16. package/dist/encoding.d.ts.map +1 -0
  17. package/dist/encoding.js +852 -0
  18. package/dist/encoding.js.map +1 -0
  19. package/dist/errors.d.ts +4 -0
  20. package/dist/errors.d.ts.map +1 -1
  21. package/dist/errors.js +15 -0
  22. package/dist/errors.js.map +1 -1
  23. package/dist/events.d.ts +333 -0
  24. package/dist/events.d.ts.map +1 -0
  25. package/dist/events.js +159 -0
  26. package/dist/events.js.map +1 -0
  27. package/dist/evidence.d.ts +2 -0
  28. package/dist/evidence.d.ts.map +1 -1
  29. package/dist/evidence.js +3 -2
  30. package/dist/evidence.js.map +1 -1
  31. package/dist/extract.d.ts +35 -3
  32. package/dist/extract.d.ts.map +1 -1
  33. package/dist/extract.js +626 -58
  34. package/dist/extract.js.map +1 -1
  35. package/dist/gemini/adapter.d.ts +17 -8
  36. package/dist/gemini/adapter.d.ts.map +1 -1
  37. package/dist/gemini/adapter.js +108 -61
  38. package/dist/gemini/adapter.js.map +1 -1
  39. package/dist/gemini/chat.d.ts +23 -3
  40. package/dist/gemini/chat.d.ts.map +1 -1
  41. package/dist/gemini/chat.js +6 -2
  42. package/dist/gemini/chat.js.map +1 -1
  43. package/dist/gemini/errors.d.ts +9 -4
  44. package/dist/gemini/errors.d.ts.map +1 -1
  45. package/dist/gemini/errors.js +32 -0
  46. package/dist/gemini/errors.js.map +1 -1
  47. package/dist/gemini/generate.d.ts +10 -2
  48. package/dist/gemini/generate.d.ts.map +1 -1
  49. package/dist/gemini/generate.js +13 -7
  50. package/dist/gemini/generate.js.map +1 -1
  51. package/dist/gemini/index.d.ts +3 -3
  52. package/dist/gemini/index.d.ts.map +1 -1
  53. package/dist/gemini/index.js +2 -2
  54. package/dist/gemini/index.js.map +1 -1
  55. package/dist/gemini/sse.d.ts +1 -1
  56. package/dist/gemini/sse.d.ts.map +1 -1
  57. package/dist/gemini/sse.js +1 -1
  58. package/dist/gemini/sse.js.map +1 -1
  59. package/dist/http.d.ts +116 -0
  60. package/dist/http.d.ts.map +1 -1
  61. package/dist/http.js +347 -1
  62. package/dist/http.js.map +1 -1
  63. package/dist/index.d.ts +11 -6
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +6 -4
  66. package/dist/index.js.map +1 -1
  67. package/dist/library.d.ts +67 -5
  68. package/dist/library.d.ts.map +1 -1
  69. package/dist/library.js +405 -85
  70. package/dist/library.js.map +1 -1
  71. package/dist/map-reduce.d.ts +28 -1
  72. package/dist/map-reduce.d.ts.map +1 -1
  73. package/dist/map-reduce.js +240 -52
  74. package/dist/map-reduce.js.map +1 -1
  75. package/dist/model.d.ts +84 -2
  76. package/dist/model.d.ts.map +1 -1
  77. package/dist/model.js +182 -1
  78. package/dist/model.js.map +1 -1
  79. package/dist/node/handlers.d.ts +20 -4
  80. package/dist/node/handlers.d.ts.map +1 -1
  81. package/dist/node/handlers.js +122 -20
  82. package/dist/node/handlers.js.map +1 -1
  83. package/dist/node/index.d.ts +2 -0
  84. package/dist/node/index.d.ts.map +1 -1
  85. package/dist/node/index.js +1 -0
  86. package/dist/node/index.js.map +1 -1
  87. package/dist/node/sse.d.ts +59 -0
  88. package/dist/node/sse.d.ts.map +1 -0
  89. package/dist/node/sse.js +174 -0
  90. package/dist/node/sse.js.map +1 -0
  91. package/dist/openai/adapter.d.ts +29 -5
  92. package/dist/openai/adapter.d.ts.map +1 -1
  93. package/dist/openai/adapter.js +311 -37
  94. package/dist/openai/adapter.js.map +1 -1
  95. package/dist/output-limit.d.ts +14 -2
  96. package/dist/output-limit.d.ts.map +1 -1
  97. package/dist/output-limit.js +39 -10
  98. package/dist/output-limit.js.map +1 -1
  99. package/dist/pause.d.ts +24 -0
  100. package/dist/pause.d.ts.map +1 -0
  101. package/dist/pause.js +38 -0
  102. package/dist/pause.js.map +1 -0
  103. package/dist/pdf-pages.d.ts +32 -2
  104. package/dist/pdf-pages.d.ts.map +1 -1
  105. package/dist/pdf-pages.js +275 -14
  106. package/dist/pdf-pages.js.map +1 -1
  107. package/dist/pdf-pictures.d.ts +30 -3
  108. package/dist/pdf-pictures.d.ts.map +1 -1
  109. package/dist/pdf-pictures.js +50 -8
  110. package/dist/pdf-pictures.js.map +1 -1
  111. package/dist/pdf-work.d.ts +40 -0
  112. package/dist/pdf-work.d.ts.map +1 -0
  113. package/dist/pdf-work.js +734 -0
  114. package/dist/pdf-work.js.map +1 -0
  115. package/dist/plan.d.ts +22 -4
  116. package/dist/plan.d.ts.map +1 -1
  117. package/dist/plan.js +61 -12
  118. package/dist/plan.js.map +1 -1
  119. package/dist/retry.d.ts +23 -1
  120. package/dist/retry.d.ts.map +1 -1
  121. package/dist/retry.js +33 -3
  122. package/dist/retry.js.map +1 -1
  123. package/dist/search.d.ts +8 -2
  124. package/dist/search.d.ts.map +1 -1
  125. package/dist/search.js +60 -10
  126. package/dist/search.js.map +1 -1
  127. package/dist/sse.d.ts +35 -2
  128. package/dist/sse.d.ts.map +1 -1
  129. package/dist/sse.js +145 -31
  130. package/dist/sse.js.map +1 -1
  131. package/dist/stores.d.ts.map +1 -1
  132. package/dist/stores.js +5 -2
  133. package/dist/stores.js.map +1 -1
  134. package/dist/text-index.d.ts +6 -0
  135. package/dist/text-index.d.ts.map +1 -1
  136. package/dist/text-index.js +25 -8
  137. package/dist/text-index.js.map +1 -1
  138. package/dist/text.d.ts +62 -2
  139. package/dist/text.d.ts.map +1 -1
  140. package/dist/text.js +314 -14
  141. package/dist/text.js.map +1 -1
  142. package/dist/tools.d.ts +61 -1
  143. package/dist/tools.d.ts.map +1 -1
  144. package/dist/tools.js +269 -42
  145. package/dist/tools.js.map +1 -1
  146. package/dist/types.d.ts +102 -3
  147. package/dist/types.d.ts.map +1 -1
  148. package/dist/zip-directory.d.ts +43 -0
  149. package/dist/zip-directory.d.ts.map +1 -0
  150. package/dist/zip-directory.js +130 -0
  151. package/dist/zip-directory.js.map +1 -0
  152. package/docs/README.md +288 -0
  153. package/docs/api.md +37 -381
  154. package/docs/configuration.md +28 -558
  155. package/docs/getting-started.md +407 -223
  156. package/docs/guides/anthropic.md +590 -0
  157. package/docs/guides/conversations.md +629 -0
  158. package/docs/guides/costs-and-limits.md +726 -0
  159. package/docs/guides/deployment.md +654 -0
  160. package/docs/guides/errors-and-reliability.md +735 -0
  161. package/docs/guides/explorer-model.md +399 -0
  162. package/docs/guides/openai-compatible.md +602 -0
  163. package/docs/guides/own-adapter-and-loop.md +1169 -0
  164. package/docs/guides/pdfs.md +971 -0
  165. package/docs/guides/storage.md +731 -0
  166. package/docs/guides/testing.md +1199 -0
  167. package/docs/guides/vertex-and-gemini.md +717 -0
  168. package/docs/guides/web-app.md +1589 -0
  169. package/docs/how-it-works.md +1012 -164
  170. package/docs/measurements.md +881 -0
  171. package/docs/publishing.md +274 -46
  172. package/docs/reference/anthropic.md +427 -0
  173. package/docs/reference/ask.md +892 -0
  174. package/docs/reference/errors-and-retries.md +758 -0
  175. package/docs/reference/events.md +993 -0
  176. package/docs/reference/gemini.md +823 -0
  177. package/docs/reference/library.md +1467 -0
  178. package/docs/reference/node.md +528 -0
  179. package/docs/reference/openai.md +385 -0
  180. package/docs/reference/tools.md +883 -0
  181. package/docs/security.md +897 -103
  182. package/docs/troubleshooting.md +1390 -0
  183. package/package.json +2 -2
  184. package/src/analyze.ts +93 -42
  185. package/src/anthropic/adapter.ts +196 -39
  186. package/src/ask.ts +1087 -202
  187. package/src/encoding.ts +850 -0
  188. package/src/errors.ts +17 -0
  189. package/src/events.ts +442 -0
  190. package/src/evidence.ts +5 -2
  191. package/src/extract.ts +602 -62
  192. package/src/gemini/adapter.ts +118 -65
  193. package/src/gemini/chat.ts +28 -4
  194. package/src/gemini/errors.ts +34 -1
  195. package/src/gemini/generate.ts +23 -10
  196. package/src/gemini/index.ts +3 -3
  197. package/src/gemini/sse.ts +1 -1
  198. package/src/http.ts +376 -1
  199. package/src/index.ts +27 -5
  200. package/src/library.ts +459 -85
  201. package/src/map-reduce.ts +252 -51
  202. package/src/model.ts +236 -3
  203. package/src/node/handlers.ts +137 -22
  204. package/src/node/index.ts +2 -0
  205. package/src/node/sse.ts +198 -0
  206. package/src/openai/adapter.ts +306 -38
  207. package/src/output-limit.ts +44 -8
  208. package/src/pause.ts +41 -0
  209. package/src/pdf-pages.ts +268 -15
  210. package/src/pdf-pictures.ts +56 -9
  211. package/src/pdf-work.ts +722 -0
  212. package/src/plan.ts +68 -12
  213. package/src/retry.ts +49 -5
  214. package/src/search.ts +63 -10
  215. package/src/sse.ts +153 -28
  216. package/src/stores.ts +5 -2
  217. package/src/text-index.ts +26 -7
  218. package/src/text.ts +323 -13
  219. package/src/tools.ts +261 -42
  220. package/src/types.ts +107 -4
  221. package/src/zip-directory.ts +136 -0
@@ -1,81 +1,309 @@
1
1
  # Publishing to npm
2
2
 
3
- For maintainers. The first release is published by hand. After that, tagging a version publishes
4
- it from GitHub Actions.
3
+ For maintainers. This page covers how a version of `llm-large-files` reaches npm: the changelog
4
+ while the version is in development, the release pull request, the tag that starts the release
5
+ workflow, and publishing by hand when the workflow's publish step fails. Working on the code
6
+ itself is in [CONTRIBUTING.md](https://github.com/renanbazinin/llm-large-files/blob/main/CONTRIBUTING.md).
5
7
 
6
- ## One-time setup
8
+ ## The changelog
7
9
 
8
- 1. **Create an npm account** at <https://www.npmjs.com/signup> and verify your email.
9
- 2. **Turn on two-factor authentication** (Account → Two-Factor Authentication). npm requires it to
10
- publish.
11
- 3. **Log in from this machine:**
10
+ [CHANGELOG.md](../CHANGELOG.md) is written for the developers who upgrade. Each pull request with
11
+ a change they can see adds its entry in the same pull request, so the changelog is ready when the
12
+ version is.
13
+
14
+ ### While a version is in development
15
+
16
+ Changes go under the top version heading, marked "not released yet". The heading already names the
17
+ version the changes will ship in:
18
+
19
+ ```markdown
20
+ ## 0.6.0 — not released yet
21
+ ```
22
+
23
+ When the top version already has a date (it was released), start a new heading above it with the
24
+ next version: a patch (0.6.1) when nothing in it needs a change in the user's code, a minor
25
+ (0.7.0) when something does (see [Versioning](#versioning)). If a change made later turns a
26
+ patch into a version that needs changes, raise the number in the heading.
27
+
28
+ A version that was never published ships in the next one, and that version's **Upgrading** part
29
+ is written for apps on the last version that was.
30
+
31
+ A template of an entry is in a comment at the top of CHANGELOG.md.
32
+
33
+ ### What an entry holds
34
+
35
+ Each version opens with two to four sentences on what it is about. Then four parts, in this order:
36
+
37
+ | Part | What goes in it |
38
+ | --- | --- |
39
+ | `### Upgrading: what you need to change` | Always present. First, whether code written for the previous version compiles as it is. Then each difference in behavior an app may need to act on: what changed, whom it affects, what to do. A change to the text the model is sent is one of these: the provider's prompt cache misses once after it (0.6.0: the tool guide, two tool descriptions, the frame of a file sent whole). A version with nothing to change says so: "Nothing." |
40
+ | `### New: what you can add` | Each addition (an export, an option, a tool, a field of a result) in one or two lines, with a link to the page that explains it, and a short sample for the ones most apps will use. |
41
+ | `### Changed: what works differently` | Behavior that changes with no change to the app's code: a default, a retry, a limit, how a plan is made. Also what a change to the text the model is sent (tool descriptions, the tool guide, the instructions) makes models do. When a point under **Upgrading** links here, this part says how the behavior works, not again what an app must do. One or two lines each. |
42
+ | `### Fixed` | Bugs, grouped by area, told by what an app developer saw, with the numbers that matter. One or two lines each. |
43
+
44
+ To know whether code written for the previous version still compiles, compare the public types of
45
+ the last release with the current build. For example, after 0.5.0:
46
+
47
+ ```bash
48
+ npm run build
49
+ mkdir -p ../api-old
50
+ npm pack llm-large-files@0.5.0 --pack-destination ../api-old
51
+ tar -xzf ../api-old/llm-large-files-0.5.0.tgz -C ../api-old
52
+ diff -ru -x '*.js' -x '*.map' ../api-old/package/dist dist
53
+ ```
54
+
55
+ The diff shows only the `.d.ts` files. A removed or renamed export, a new required option, a new
56
+ required member of a type an app implements, a narrower parameter type, or a new member of a union
57
+ an app receives (a `ModelErrorKind`, a `DocumentFormat`) goes in **Upgrading**: an exhaustive
58
+ `switch`, or a `Record` keyed by the union, needs the new case. A new export, a new optional option
59
+ or field, or a wider parameter type goes in **New**.
60
+
61
+ ### At release
62
+
63
+ The release pull request makes two edits:
64
+
65
+ 1. Replace "not released yet" with the date of the release, as YYYY-MM-DD. For a release on
66
+ 24 November 2026:
67
+
68
+ ```markdown
69
+ ## 0.6.0 — 2026-11-24
70
+ ```
71
+
72
+ 2. Bump the version in package.json and package-lock.json to the same number:
12
73
 
13
74
  ```bash
14
- npm login
15
- npm whoami # should print your npm username
75
+ npm version 0.6.0 --no-git-tag-version # the number in the changelog heading
16
76
  ```
17
77
 
18
- 4. **Check the name is still free.** A 404 means it's available:
78
+ `npm version minor` or `npm version patch` works the next number out from package.json (0.6.0
79
+ becomes 0.7.0 or 0.6.1). Give the number itself when the heading skips one.
80
+
81
+ Keep `--no-git-tag-version`. Without it, `npm version` refuses to run while the changelog edit
82
+ is not committed, and when it runs it commits and tags `v0.6.0` on your branch. The squash merge
83
+ then puts a different commit on `main`, and that tag points at a commit that is not on `main`.
84
+
85
+ ## Releasing a version
86
+
87
+ A release is a pull request squash-merged into `main`, then an annotated tag on the merged commit.
88
+ Pushing the tag starts the release workflow.
89
+
90
+ 1. Start a branch from an up-to-date `main`:
19
91
 
20
92
  ```bash
21
- npm view llm-large-files
93
+ git switch main
94
+ git pull
95
+ git switch -c release/0.6.0
22
96
  ```
23
97
 
24
- If it's taken, change `"name"` in `package.json`, either to another name or to a scope you own
25
- such as `@your-user/large-files`. Then update the imports in README, docs, and examples.
98
+ 2. Date the changelog heading and bump the version, as in [At release](#at-release).
26
99
 
27
- ## First release (by hand)
100
+ 3. Run the checks, and look at what npm will publish:
28
101
 
29
- ```bash
30
- npm ci
31
- npm run check # typecheck, tests, build
32
- npm pack --dry-run # review the file list: dist/, src/, docs/, README, LICENSE, CHANGELOG
33
- npm publish --access public
102
+ ```bash
103
+ npm run check # typecheck, tests, build
104
+ npm pack --dry-run # dist/, src/, docs/, CHANGELOG.md, README.md, LICENSE, package.json
105
+ ```
106
+
107
+ `files` in package.json publishes all of `dist/`, `src/` and `docs/`. CONTRIBUTING.md,
108
+ `examples/` and `test/` are not published.
109
+
110
+ 4. Commit, push, and open a pull request titled "Release 0.6.0: what the version is about". Wait
111
+ for CI (Node 20, 22 and 24, on Ubuntu and Windows), then squash-merge it.
112
+
113
+ 5. Tag the merged commit and push the tag:
114
+
115
+ ```bash
116
+ git switch main
117
+ git pull
118
+ git log -1 --oneline # must be the release commit: "Release 0.6.0: ... (#N)"
119
+ git tag -a v0.6.0 -m "Release 0.6.0"
120
+ git push origin v0.6.0
121
+ ```
122
+
123
+ The tag must be `v` followed by exactly the `version` in package.json: the workflow checks it.
124
+ It checks nothing else, so a tag on a later commit passes too. If another pull request was
125
+ merged after the release, tag the release commit by its hash:
126
+ `git tag -a v0.6.0 <hash> -m "Release 0.6.0"`.
127
+
128
+ 6. Watch the release workflow:
129
+
130
+ ```bash
131
+ gh run list --workflow release.yml --limit 1
132
+ gh run watch <run-id>
133
+ ```
134
+
135
+ If its publish step fails, see [When the publish step fails](#when-the-publish-step-fails).
136
+
137
+ 7. Approve the staged version. The workflow stages it (`npm stage publish`): it is uploaded with
138
+ its provenance, but not installable yet. Open npmjs.com → your account → **Staged Packages**,
139
+ check that it is `llm-large-files` with the version of the tag, and click **Approve**; npm asks
140
+ for the account's two-factor approval. From a terminal logged in to npm, `npm stage approve
141
+ <stage-id>` does the same. Until then `npm view llm-large-files@0.7.0` answers 404. A staged
142
+ version you do not want is removed with **Reject** (or `npm stage reject <stage-id>`), and the
143
+ same version can be staged again.
144
+
145
+ 8. [Check the release](#checking-a-release).
146
+
147
+ 9. Create the GitHub release from the version's section of CHANGELOG.md. The workflow does not
148
+ make one, and the changelog sends readers to the releases page:
149
+
150
+ ```bash
151
+ awk 'index($0, "## 0.6.0 ") == 1 { p = 1; next } /^## / { p = 0 } p' CHANGELOG.md \
152
+ | sed 's#](docs/#](https://github.com/renanbazinin/llm-large-files/blob/v0.6.0/docs/#g' > notes.md
153
+ gh release create v0.6.0 --verify-tag --title "0.6.0" --notes-file notes.md
154
+ ```
155
+
156
+ The `awk` keeps the lines between the `## 0.6.0 — …` heading and the next `## ` heading. The
157
+ changelog's links are relative to the repository root, so `sed` points them at the docs of the
158
+ tag. `--verify-tag` stops when the tag is not on GitHub yet.
159
+
160
+ ## What the release workflow does
161
+
162
+ `.github/workflows/release.yml` runs when a tag that starts with `v` is pushed. It runs on Ubuntu
163
+ with Node 24 and no dependency cache (a poisoned cache could expose the publish token), and asks
164
+ GitHub for `contents: read` and `id-token: write`. Its steps:
165
+
166
+ | Step | Fails when |
167
+ | --- | --- |
168
+ | `npm ci` | package-lock.json does not match package.json. |
169
+ | Check the tag matches package.json | The tag is not `v` + the `version` in package.json: for example `v0.6.0` on a commit whose package.json still says 0.5.0. |
170
+ | `npm run check` | The typecheck, a test or the build fails. |
171
+ | Check that this job can identify itself to npm | The job has no identity token: "No identity token for this job. The workflow needs the id-token write permission." |
172
+ | `npm stage publish --provenance --access public --loglevel verbose` | npm does not accept the job's identity for this package, or the trusted publisher does not allow staging (see below). The version is staged, not public, until a maintainer approves it. |
173
+
174
+ When a step before the publish fails, nothing was published. Fix the cause on `main` with a pull
175
+ request, delete the tag (`git tag -d v0.6.0`, then `git push origin :refs/tags/v0.6.0`), and tag
176
+ the fixed commit.
177
+
178
+ ### Trusted publishing
179
+
180
+ The workflow uses npm trusted publishing: npm exchanges the job's GitHub identity for a short-lived
181
+ token, so no npm token is stored anywhere. It works only when the package's settings on npmjs.com
182
+ name this workflow. Open the package on npmjs.com → Settings → Trusted Publisher → GitHub Actions:
183
+
184
+ - Organization or user: `renanbazinin`
185
+ - Repository: `llm-large-files`
186
+ - Workflow filename: `release.yml`
187
+ - Environment name: empty
188
+ - Permissions: `npm stage publish` only (npm's default and its recommendation). Leave `npm publish`
189
+ off: then a pushed tag, or a changed workflow, can never make a version public without a
190
+ maintainer's two-factor approval.
191
+
192
+ A new trusted publisher must be used for a first successful publish within two days, or npm drops
193
+ it and it has to be added again.
194
+
195
+ The workflow reads no token, so an `NPM_TOKEN` secret is ignored. It used to set `NODE_AUTH_TOKEN`
196
+ from that secret; when the secret did not exist the value was empty, and with an empty token npm
197
+ did not try trusted publishing and failed with `ENEEDAUTH`. Keep `NODE_AUTH_TOKEN` unset on the
198
+ publish step.
199
+
200
+ `--provenance` attaches a signed statement that links the package to the commit and the workflow
201
+ that built it. npm can make one only inside a supported CI job, so a version published by hand has
202
+ none. npm checks the trusted publisher only at publish time, and says why it refused an identity
203
+ only in the verbose log: that is why the step runs with `--loglevel verbose`.
204
+
205
+ ## When the publish step fails
206
+
207
+ **`403 Forbidden … OIDC permission denied for this action`.** npm accepted the job's identity
208
+ (`npm verbose oidc Successfully retrieved and set token`) but the trusted publisher does not allow
209
+ what the step asked for: a plain `npm publish` against a publisher that allows staging only. This
210
+ happened on the first v0.7.0 run, before the step was `npm stage publish`. Make the step and the
211
+ publisher's permissions agree, then tag again.
212
+
213
+ The publish step has failed with trusted publishing before: on every tag from v0.2.0 to v0.5.0, and
214
+ each of those versions was published by hand. The first v0.2.0 run failed with `ENEEDAUTH` (the
215
+ empty token above). Every run since shows this in the verbose log:
216
+
217
+ ```text
218
+ npm verbose oidc Failed token exchange request with body message: OIDC token exchange error - package not found
219
+ npm error code E404
220
+ npm error 404 Not Found - PUT https://registry.npmjs.org/llm-large-files - Not found
34
221
  ```
35
222
 
36
- npm asks for your 2FA code (or opens the browser). Then confirm:
223
+ npm did not accept the job's identity for this package: the trusted publisher on npmjs.com is
224
+ missing, or does not match the values above. Every step before the publish passed, so the tagged
225
+ commit is good. There are two ways to finish the release.
226
+
227
+ **Fix trusted publishing, then run the job again.** Correct the setting on npmjs.com (this needs an
228
+ npm account that may publish the package), then `gh run rerun <run-id> --failed`. The version is
229
+ published with provenance. This works only while the version is not on npm yet.
230
+
231
+ **Publish by hand from a clean checkout of the tag:**
37
232
 
38
233
  ```bash
39
- npm view llm-large-files version
234
+ git clone --depth 1 --branch v0.6.0 https://github.com/renanbazinin/llm-large-files.git release-v0.6.0
235
+ cd release-v0.6.0
236
+ npm ci
237
+ npm whoami # an npm account that may publish the package; run npm login if not
238
+ npm publish --access public
40
239
  ```
41
240
 
42
- and try it in an empty folder:
241
+ - Use a clean checkout, not your working copy. `files` publishes everything under `dist/`, `src/`
242
+ and `docs/`, so an untracked or changed file there would go to npm too. The checkout also makes
243
+ sure the version is exactly the tag's.
244
+ - `prepublishOnly` runs `npm run check` first; its build deletes `dist/` and builds it again.
245
+ - npm asks for the account's two-factor approval: it prints
246
+ `Authenticate your account at: https://www.npmjs.com/auth/cli/…` (or asks for a one-time code).
247
+ Open the link, on any device, and approve. npm waits only a few minutes (about five in past
248
+ releases) and then gives up, so the person who approves must be there before you run it.
249
+ - Leave out `--provenance`: it works only inside a supported CI job.
250
+ - Before it publishes, npm prints `npm notice shasum:` for the package. The failed job's log has
251
+ the same line. When the two match, npm got the same build that CI checked; for 0.5.0 they
252
+ matched.
253
+
254
+ ## Checking a release
43
255
 
44
256
  ```bash
45
- mkdir try-it && cd try-it && npm init -y && npm install llm-large-files
46
- node -e "import('llm-large-files').then(m => console.log(Object.keys(m)))"
257
+ npm view llm-large-files version # the latest version
258
+ npm view llm-large-files@0.6.0 dist.shasum
47
259
  ```
48
260
 
49
- ## Automatic releases (after the first)
50
-
51
- `.github/workflows/release.yml` publishes when a `v*` tag is pushed. Connect it to npm once, using
52
- either method:
261
+ After npm prints `+ llm-large-files@0.6.0`, the registry can take several minutes to list the
262
+ version (about one minute for 0.4.1, about five for 0.5.0). A 404 in that time is not a failed
263
+ publish: wait before you test from the registry.
53
264
 
54
- **Option A: trusted publishing (recommended, no secret to rotate).**
55
- On npmjs.com, open the package → Settings → Trusted Publisher → GitHub Actions, and enter:
265
+ Then try it in an empty folder:
56
266
 
57
- - Organization or user: `renanbazinin`
58
- - Repository: `llm-large-files`
59
- - Workflow filename: `release.yml`
267
+ ```bash
268
+ mkdir try-it && cd try-it && npm init -y && npm install llm-large-files@0.6.0
269
+ node -e "import('llm-large-files').then((m) => console.log(Object.keys(m).length, 'exports'))"
270
+ node -e "import('llm-large-files/gemini').then((m) => console.log(Object.keys(m)))"
271
+ ```
60
272
 
61
- **Option B: a token.** Create a granular access token on npmjs.com (Access Tokens → Generate New
62
- Token → Granular, with read and write on this package). Add it to the GitHub repository as the
63
- secret `NPM_TOKEN`. The workflow uses it when present.
273
+ ## Access
64
274
 
65
- Then each release is:
275
+ To publish by hand or change the trusted publisher, you need an npm account that may publish
276
+ `llm-large-files`, with two-factor authentication on (npm requires it to publish), logged in on
277
+ your machine:
66
278
 
67
279
  ```bash
68
- npm version patch # or minor / major: bumps package.json, commits, and tags vX.Y.Z
69
- # add the release notes to CHANGELOG.md first, or amend them in before pushing
70
- git push --follow-tags
280
+ npm login
281
+ npm whoami # prints your npm user name
282
+ npm owner ls llm-large-files
71
283
  ```
72
284
 
73
- The workflow runs the full check, then publishes with provenance (a signed link from the package
74
- back to the exact commit and workflow that built it).
285
+ An owner adds another maintainer with `npm owner add <npm-user> llm-large-files`.
75
286
 
76
287
  ## Versioning
77
288
 
78
- Follow [semantic versioning](https://semver.org). While the version is `0.x`, a minor bump (`0.2.0`)
79
- may include breaking changes; say so in the changelog. Breaking changes include anything in
80
- `docs/api.md`, the tool names and arguments the model sees, and the HTTP responses of
81
- `llm-large-files/node`.
289
+ Versions follow [semantic versioning](https://semver.org). While the version is `0.x`, a patch
290
+ (0.6.1) never needs a change in the user's code. A version that needs one is at least a minor
291
+ (0.7.0), and its **Upgrading** part says what to change. 0.6.0 is a minor: its
292
+ **Upgrading** part says what to change from 0.5.0.
293
+
294
+ These are public, and a change to them can need a change in someone's code:
295
+
296
+ - Everything exported from the five entry points (`llm-large-files`, `llm-large-files/gemini`,
297
+ `llm-large-files/openai`, `llm-large-files/anthropic`, `llm-large-files/node`): names,
298
+ signatures, options and their defaults. That includes the types an app implements:
299
+ `ModelAdapter`, `DocumentStore` and `Extractor`. A new required member or argument breaks every
300
+ adapter, store or extractor written for the previous version, so make new members optional.
301
+ - The tools the model sees: their names, arguments and result fields. The rest of the text the
302
+ model is sent (tool descriptions, the tool guide, the instructions) breaks no code but changes
303
+ answers: it goes under **Upgrading** (the cache miss) and **Changed** (what models do
304
+ differently).
305
+ - The routes, requests, responses and statuses of the HTTP handlers in `llm-large-files/node`.
306
+ - What a store already holds: a new version reads documents an older one stored. (0.4.0 gave
307
+ documents stored by older versions their line index the first time they were used.)
308
+ - The supported Node versions (`engines`: 20.19 or later) and the version ranges of the optional
309
+ peers `jszip`, `unpdf` and `@cantoo/pdf-lib`.