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.
- package/CHANGELOG.md +1402 -467
- package/README.md +188 -60
- package/dist/analyze.d.ts +5 -0
- package/dist/analyze.d.ts.map +1 -1
- package/dist/analyze.js +96 -47
- package/dist/analyze.js.map +1 -1
- package/dist/anthropic/adapter.d.ts +14 -3
- package/dist/anthropic/adapter.d.ts.map +1 -1
- package/dist/anthropic/adapter.js +190 -39
- package/dist/anthropic/adapter.js.map +1 -1
- package/dist/ask.d.ts +60 -4
- package/dist/ask.d.ts.map +1 -1
- package/dist/ask.js +1068 -206
- package/dist/ask.js.map +1 -1
- package/dist/encoding.d.ts +17 -0
- package/dist/encoding.d.ts.map +1 -0
- package/dist/encoding.js +852 -0
- package/dist/encoding.js.map +1 -0
- package/dist/errors.d.ts +4 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +15 -0
- package/dist/errors.js.map +1 -1
- package/dist/events.d.ts +333 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +159 -0
- package/dist/events.js.map +1 -0
- package/dist/evidence.d.ts +2 -0
- package/dist/evidence.d.ts.map +1 -1
- package/dist/evidence.js +3 -2
- package/dist/evidence.js.map +1 -1
- package/dist/extract.d.ts +35 -3
- package/dist/extract.d.ts.map +1 -1
- package/dist/extract.js +626 -58
- package/dist/extract.js.map +1 -1
- package/dist/gemini/adapter.d.ts +17 -8
- package/dist/gemini/adapter.d.ts.map +1 -1
- package/dist/gemini/adapter.js +108 -61
- package/dist/gemini/adapter.js.map +1 -1
- package/dist/gemini/chat.d.ts +23 -3
- package/dist/gemini/chat.d.ts.map +1 -1
- package/dist/gemini/chat.js +6 -2
- package/dist/gemini/chat.js.map +1 -1
- package/dist/gemini/errors.d.ts +9 -4
- package/dist/gemini/errors.d.ts.map +1 -1
- package/dist/gemini/errors.js +32 -0
- package/dist/gemini/errors.js.map +1 -1
- package/dist/gemini/generate.d.ts +10 -2
- package/dist/gemini/generate.d.ts.map +1 -1
- package/dist/gemini/generate.js +13 -7
- package/dist/gemini/generate.js.map +1 -1
- package/dist/gemini/index.d.ts +3 -3
- package/dist/gemini/index.d.ts.map +1 -1
- package/dist/gemini/index.js +2 -2
- package/dist/gemini/index.js.map +1 -1
- package/dist/gemini/sse.d.ts +1 -1
- package/dist/gemini/sse.d.ts.map +1 -1
- package/dist/gemini/sse.js +1 -1
- package/dist/gemini/sse.js.map +1 -1
- package/dist/http.d.ts +116 -0
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +347 -1
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +11 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/library.d.ts +67 -5
- package/dist/library.d.ts.map +1 -1
- package/dist/library.js +405 -85
- package/dist/library.js.map +1 -1
- package/dist/map-reduce.d.ts +28 -1
- package/dist/map-reduce.d.ts.map +1 -1
- package/dist/map-reduce.js +240 -52
- package/dist/map-reduce.js.map +1 -1
- package/dist/model.d.ts +84 -2
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +182 -1
- package/dist/model.js.map +1 -1
- package/dist/node/handlers.d.ts +20 -4
- package/dist/node/handlers.d.ts.map +1 -1
- package/dist/node/handlers.js +122 -20
- package/dist/node/handlers.js.map +1 -1
- package/dist/node/index.d.ts +2 -0
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +1 -0
- package/dist/node/index.js.map +1 -1
- package/dist/node/sse.d.ts +59 -0
- package/dist/node/sse.d.ts.map +1 -0
- package/dist/node/sse.js +174 -0
- package/dist/node/sse.js.map +1 -0
- package/dist/openai/adapter.d.ts +29 -5
- package/dist/openai/adapter.d.ts.map +1 -1
- package/dist/openai/adapter.js +311 -37
- package/dist/openai/adapter.js.map +1 -1
- package/dist/output-limit.d.ts +14 -2
- package/dist/output-limit.d.ts.map +1 -1
- package/dist/output-limit.js +39 -10
- package/dist/output-limit.js.map +1 -1
- package/dist/pause.d.ts +24 -0
- package/dist/pause.d.ts.map +1 -0
- package/dist/pause.js +38 -0
- package/dist/pause.js.map +1 -0
- package/dist/pdf-pages.d.ts +32 -2
- package/dist/pdf-pages.d.ts.map +1 -1
- package/dist/pdf-pages.js +275 -14
- package/dist/pdf-pages.js.map +1 -1
- package/dist/pdf-pictures.d.ts +30 -3
- package/dist/pdf-pictures.d.ts.map +1 -1
- package/dist/pdf-pictures.js +50 -8
- package/dist/pdf-pictures.js.map +1 -1
- package/dist/pdf-work.d.ts +40 -0
- package/dist/pdf-work.d.ts.map +1 -0
- package/dist/pdf-work.js +734 -0
- package/dist/pdf-work.js.map +1 -0
- package/dist/plan.d.ts +22 -4
- package/dist/plan.d.ts.map +1 -1
- package/dist/plan.js +61 -12
- package/dist/plan.js.map +1 -1
- package/dist/retry.d.ts +23 -1
- package/dist/retry.d.ts.map +1 -1
- package/dist/retry.js +33 -3
- package/dist/retry.js.map +1 -1
- package/dist/search.d.ts +8 -2
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +60 -10
- package/dist/search.js.map +1 -1
- package/dist/sse.d.ts +35 -2
- package/dist/sse.d.ts.map +1 -1
- package/dist/sse.js +145 -31
- package/dist/sse.js.map +1 -1
- package/dist/stores.d.ts.map +1 -1
- package/dist/stores.js +5 -2
- package/dist/stores.js.map +1 -1
- package/dist/text-index.d.ts +6 -0
- package/dist/text-index.d.ts.map +1 -1
- package/dist/text-index.js +25 -8
- package/dist/text-index.js.map +1 -1
- package/dist/text.d.ts +62 -2
- package/dist/text.d.ts.map +1 -1
- package/dist/text.js +314 -14
- package/dist/text.js.map +1 -1
- package/dist/tools.d.ts +61 -1
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +269 -42
- package/dist/tools.js.map +1 -1
- package/dist/types.d.ts +102 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/zip-directory.d.ts +43 -0
- package/dist/zip-directory.d.ts.map +1 -0
- package/dist/zip-directory.js +130 -0
- package/dist/zip-directory.js.map +1 -0
- package/docs/README.md +288 -0
- package/docs/api.md +37 -381
- package/docs/configuration.md +28 -558
- package/docs/getting-started.md +407 -223
- package/docs/guides/anthropic.md +590 -0
- package/docs/guides/conversations.md +629 -0
- package/docs/guides/costs-and-limits.md +726 -0
- package/docs/guides/deployment.md +654 -0
- package/docs/guides/errors-and-reliability.md +735 -0
- package/docs/guides/explorer-model.md +399 -0
- package/docs/guides/openai-compatible.md +602 -0
- package/docs/guides/own-adapter-and-loop.md +1169 -0
- package/docs/guides/pdfs.md +971 -0
- package/docs/guides/storage.md +731 -0
- package/docs/guides/testing.md +1199 -0
- package/docs/guides/vertex-and-gemini.md +717 -0
- package/docs/guides/web-app.md +1589 -0
- package/docs/how-it-works.md +1012 -164
- package/docs/measurements.md +881 -0
- package/docs/publishing.md +274 -46
- package/docs/reference/anthropic.md +427 -0
- package/docs/reference/ask.md +892 -0
- package/docs/reference/errors-and-retries.md +758 -0
- package/docs/reference/events.md +993 -0
- package/docs/reference/gemini.md +823 -0
- package/docs/reference/library.md +1467 -0
- package/docs/reference/node.md +528 -0
- package/docs/reference/openai.md +385 -0
- package/docs/reference/tools.md +883 -0
- package/docs/security.md +897 -103
- package/docs/troubleshooting.md +1390 -0
- package/package.json +2 -2
- package/src/analyze.ts +93 -42
- package/src/anthropic/adapter.ts +196 -39
- package/src/ask.ts +1087 -202
- package/src/encoding.ts +850 -0
- package/src/errors.ts +17 -0
- package/src/events.ts +442 -0
- package/src/evidence.ts +5 -2
- package/src/extract.ts +602 -62
- package/src/gemini/adapter.ts +118 -65
- package/src/gemini/chat.ts +28 -4
- package/src/gemini/errors.ts +34 -1
- package/src/gemini/generate.ts +23 -10
- package/src/gemini/index.ts +3 -3
- package/src/gemini/sse.ts +1 -1
- package/src/http.ts +376 -1
- package/src/index.ts +27 -5
- package/src/library.ts +459 -85
- package/src/map-reduce.ts +252 -51
- package/src/model.ts +236 -3
- package/src/node/handlers.ts +137 -22
- package/src/node/index.ts +2 -0
- package/src/node/sse.ts +198 -0
- package/src/openai/adapter.ts +306 -38
- package/src/output-limit.ts +44 -8
- package/src/pause.ts +41 -0
- package/src/pdf-pages.ts +268 -15
- package/src/pdf-pictures.ts +56 -9
- package/src/pdf-work.ts +722 -0
- package/src/plan.ts +68 -12
- package/src/retry.ts +49 -5
- package/src/search.ts +63 -10
- package/src/sse.ts +153 -28
- package/src/stores.ts +5 -2
- package/src/text-index.ts +26 -7
- package/src/text.ts +323 -13
- package/src/tools.ts +261 -42
- package/src/types.ts +107 -4
- package/src/zip-directory.ts +136 -0
package/docs/publishing.md
CHANGED
|
@@ -1,81 +1,309 @@
|
|
|
1
1
|
# Publishing to npm
|
|
2
2
|
|
|
3
|
-
For maintainers.
|
|
4
|
-
|
|
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
|
-
##
|
|
8
|
+
## The changelog
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
93
|
+
git switch main
|
|
94
|
+
git pull
|
|
95
|
+
git switch -c release/0.6.0
|
|
22
96
|
```
|
|
23
97
|
|
|
24
|
-
|
|
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
|
-
|
|
100
|
+
3. Run the checks, and look at what npm will publish:
|
|
28
101
|
|
|
29
|
-
```bash
|
|
30
|
-
npm
|
|
31
|
-
npm run
|
|
32
|
-
|
|
33
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
46
|
-
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
|
|
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
|
-
|
|
58
|
-
-
|
|
59
|
-
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
69
|
-
#
|
|
70
|
-
|
|
280
|
+
npm login
|
|
281
|
+
npm whoami # prints your npm user name
|
|
282
|
+
npm owner ls llm-large-files
|
|
71
283
|
```
|
|
72
284
|
|
|
73
|
-
|
|
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
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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`.
|