@sid-ai/sid-sdk 0.1.0 → 0.1.1
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/README.md +14 -68
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
It assigns stable short IDs, selects relevant snippets, tracks character ranges
|
|
5
5
|
already shown, masks repeated text, and renders SID's `<doc>` format.
|
|
6
6
|
|
|
7
|
-
Node.js 22+ is supported through ESM and CommonJS. The
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
Node.js 22+ is supported through ESM and CommonJS. The snippet engine is already
|
|
8
|
+
compiled and bundled in the npm package. Installation requires no compiler,
|
|
9
|
+
additional runtime, or separate build step. Browser and shared-memory
|
|
10
|
+
worker-thread caches are not supported.
|
|
10
11
|
|
|
11
12
|
## Installation and use
|
|
12
13
|
|
|
@@ -50,14 +51,14 @@ snippet selection. Both entry points share the same classes.
|
|
|
50
51
|
- `IdStream({ alphabet?, length?, seed? })`: `mint()` returns an ID, `at(index)` does not consume it, and `next()` follows the iterator protocol. Exhaustion throws `IdSpaceExhausted`. Counters `space`, `minted`, and `remaining` are BigInts.
|
|
51
52
|
|
|
52
53
|
Document records can contain structured-cloneable values. Returned documents are
|
|
53
|
-
the shared stored objects
|
|
54
|
+
the shared stored objects; avoid modifying them after recording
|
|
54
55
|
seen ranges. Display fields default to all document keys, so keep private fields
|
|
55
56
|
out of the record or pass an explicit list. The seen ledger is keyed by document
|
|
56
|
-
ID
|
|
57
|
+
ID: use one content field per document when tracking seen text.
|
|
57
58
|
|
|
58
59
|
## Character ranges and language support
|
|
59
60
|
|
|
60
|
-
Ranges are half-open **Unicode code-point offsets
|
|
61
|
+
Ranges are half-open **Unicode code-point offsets**. These differ from the UTF-16
|
|
61
62
|
indices used by JavaScript `String.slice`. For example, `😀a` has two SDK
|
|
62
63
|
characters. Combining marks count separately. Rendered references and
|
|
63
64
|
`doc_length` use the same coordinate system.
|
|
@@ -74,11 +75,7 @@ lowercase Unicode UAX #29 tokenization without removing stopwords. Named
|
|
|
74
75
|
languages use Alyze's stopword lists; there is no stemming. A per-call `language`
|
|
75
76
|
overrides the cache default. Stopword-only queries select the earliest window.
|
|
76
77
|
|
|
77
|
-
##
|
|
78
|
-
|
|
79
|
-
The reference is [`sidhq/sid-python` at `c25f929`](https://github.com/sidhq/sid-python/tree/c25f9299a90d17735473ca401ae45fa4b41e25d8).
|
|
80
|
-
The Rust algorithm and Alyze 0.1.5 are retained. Tests include Python-generated
|
|
81
|
-
snippet offsets and exact XML/Markdown fixtures, including every language.
|
|
78
|
+
## Rendering
|
|
82
79
|
|
|
83
80
|
XML preserves SID's model-facing format: escape `&`, `<`, and `>`; leave quotes
|
|
84
81
|
unchanged; omit falsy attributes; write integers unquoted. This is the SID
|
|
@@ -89,67 +86,16 @@ integral numbers render as integers because JavaScript does not distinguish
|
|
|
89
86
|
`1` from `1.0`. Use strings for custom metadata representations. Default field
|
|
90
87
|
order follows JavaScript key ordering; pass `displayFields` for explicit order.
|
|
91
88
|
|
|
92
|
-
Seeded ID streams are reproducible within this SDK
|
|
93
|
-
|
|
94
|
-
preserved. Invalid input throws `TypeError` or `RangeError`; document lookup
|
|
89
|
+
Seeded ID streams are reproducible within this SDK. Forks share one collision-free
|
|
90
|
+
ID stream. Invalid input throws `TypeError` or `RangeError`; document lookup
|
|
95
91
|
failures throw `Error`.
|
|
96
92
|
|
|
97
|
-
##
|
|
98
|
-
|
|
99
|
-
Install Node.js 22+ and Rust through rustup. The checked-in toolchain selects
|
|
100
|
-
Rust 1.88.0 and the WASM target.
|
|
101
|
-
|
|
102
|
-
```sh
|
|
103
|
-
cargo install wasm-bindgen-cli --version 0.2.100 --locked
|
|
104
|
-
npm ci
|
|
105
|
-
npm run check
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
The ignored `sid-python/` checkout is only a development reference. To regenerate
|
|
109
|
-
fixtures, check out the pinned revision, build its extension with the Python
|
|
110
|
-
project's development instructions, then run:
|
|
111
|
-
|
|
112
|
-
```sh
|
|
113
|
-
sid-python/.venv/bin/python scripts/generate-python-fixtures.py
|
|
114
|
-
```
|
|
93
|
+
## Contributing
|
|
115
94
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
both module formats, and compiles TypeScript consumers.
|
|
119
|
-
|
|
120
|
-
## Releases
|
|
121
|
-
|
|
122
|
-
Every successful push to `main` publishes its head revision, including documentation
|
|
123
|
-
changes. CI tests Node 22 and 24 on Linux, macOS, and Windows before publishing.
|
|
124
|
-
Versions begin at `0.1.0` and automatically increment the highest published or
|
|
125
|
-
reserved patch version. Versions change only in the release workspace; Git tags
|
|
126
|
-
identify source revisions, whose package manifest retains the development version.
|
|
127
|
-
|
|
128
|
-
The release queue serializes runs (up to GitHub's 100 pending-run limit). A `v*`
|
|
129
|
-
tag reserves a version for a SHA before publication. Rerun a failed workflow to
|
|
130
|
-
reuse that version and recover missing GitHub release metadata. Do not delete or
|
|
131
|
-
move reservation tags. Network, authorization, and version conflicts fail loudly.
|
|
132
|
-
An older delayed revision gets a `revision-<sha>` npm tag, so it cannot move
|
|
133
|
-
`latest` backward. npm publishing selects the tag directly and needs no separate
|
|
134
|
-
token-authorized `npm dist-tag` operation.
|
|
135
|
-
|
|
136
|
-
### One-time npm setup
|
|
137
|
-
|
|
138
|
-
1. Ensure the publishing account can create public packages in the `sid-ai` npm organization.
|
|
139
|
-
2. Add a narrowly scoped, short-lived granular npm token as the repository/environment
|
|
140
|
-
secret `NPM_TOKEN`, with creation/publish rights and any required 2FA bypass.
|
|
141
|
-
Rerun the initial Release workflow to publish the fully tested `0.1.0` package.
|
|
142
|
-
3. In the npm package settings, configure a GitHub trusted publisher: organization
|
|
143
|
-
`sidhq`, repository `sid-typescript`, workflow `release.yml`, environment `npm`.
|
|
144
|
-
Allow direct `npm publish`. Avoid required environment approvals if releases
|
|
145
|
-
should remain automatic.
|
|
146
|
-
4. Remove the bootstrap secret and revoke the token. Subsequent runs authenticate
|
|
147
|
-
with GitHub OIDC and publish with provenance.
|
|
148
|
-
|
|
149
|
-
See [npm trusted publishing](https://docs.npmjs.com/trusted-publishers/) and
|
|
150
|
-
[GitHub concurrency](https://docs.github.com/en/actions/how-tos/write-workflows/choose-when-workflows-run/control-workflow-concurrency).
|
|
95
|
+
See the [contributor guide](https://github.com/sidhq/sid-typescript/blob/main/CONTRIBUTING.md)
|
|
96
|
+
for source builds, testing, and release maintenance.
|
|
151
97
|
|
|
152
98
|
## License
|
|
153
99
|
|
|
154
100
|
MIT. See [LICENSE](LICENSE) and [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)
|
|
155
|
-
for
|
|
101
|
+
for copyright and third-party dependency notices.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sid-ai/sid-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Stable document IDs, relevant snippets, and seen-text tracking for AI agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"@types/node": "^22.0.0",
|
|
45
45
|
"typescript": "~5.9.3"
|
|
46
46
|
},
|
|
47
|
-
"sidSourceCommit": "
|
|
47
|
+
"sidSourceCommit": "7d11d81e2b7776af084dacf8fca88c9b40de7405"
|
|
48
48
|
}
|