@volter/twin-upstashvector 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 +233 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.js +45 -0
- package/dist/src/index.d.ts +14 -0
- package/dist/src/index.js +106 -0
- package/dist/src/upstashvector-budget.d.ts +84 -0
- package/dist/src/upstashvector-budget.js +443 -0
- package/dist/src/upstashvector-capabilities.d.ts +4 -0
- package/dist/src/upstashvector-capabilities.js +1108 -0
- package/dist/src/upstashvector-conformance.d.ts +7 -0
- package/dist/src/upstashvector-conformance.js +163 -0
- package/dist/src/upstashvector-connector.d.ts +109 -0
- package/dist/src/upstashvector-connector.js +286 -0
- package/dist/src/upstashvector-filter.d.ts +80 -0
- package/dist/src/upstashvector-filter.js +564 -0
- package/dist/src/upstashvector-server.d.ts +32 -0
- package/dist/src/upstashvector-server.js +56 -0
- package/dist/src/upstashvector-store.d.ts +248 -0
- package/dist/src/upstashvector-store.js +883 -0
- package/dist/src/upstashvector-twin.d.ts +67 -0
- package/dist/src/upstashvector-twin.js +287 -0
- package/package.json +51 -0
- package/src/cli.ts +47 -0
- package/src/index.ts +193 -0
- package/src/upstashvector-budget.ts +489 -0
- package/src/upstashvector-capabilities.ts +1242 -0
- package/src/upstashvector-conformance.ts +175 -0
- package/src/upstashvector-connector.ts +328 -0
- package/src/upstashvector-filter.ts +525 -0
- package/src/upstashvector-server.ts +86 -0
- package/src/upstashvector-store.ts +944 -0
- package/src/upstashvector-twin.ts +347 -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,233 @@
|
|
|
1
|
+
# @volter/twin-upstashvector
|
|
2
|
+
|
|
3
|
+
A local, stateful, vendor-faithful twin of the **Upstash Vector** REST API, built on the shared
|
|
4
|
+
[`@volter/world-core`](../../world-core) kernel.
|
|
5
|
+
|
|
6
|
+
Point the real, unmodified [`@upstash/vector`](https://www.npmjs.com/package/@upstash/vector) SDK at
|
|
7
|
+
it with nothing but its own public `url` option and it works:
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { Index } from '@upstash/vector';
|
|
11
|
+
|
|
12
|
+
const index = new Index({ url: 'http://127.0.0.1:PORT', token: 'any-non-empty-token' });
|
|
13
|
+
|
|
14
|
+
await index.upsert([{ id: 'lotr', vector: [1, 0, 0], metadata: { genre: 'fantasy' } }]);
|
|
15
|
+
await index.query({ vector: [1, 0, 0], topK: 3, filter: "genre = 'fantasy'", includeMetadata: true });
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
bunx world-upstashvector serve --port 8080 --dimension 1536 --similarity COSINE
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## What makes this a twin and not a mock
|
|
23
|
+
|
|
24
|
+
**The scores are computed, never faked.** `/query` ranks by a similarity score derived from the
|
|
25
|
+
stored coordinates, using Upstash's own published normalizations
|
|
26
|
+
([similarity functions](https://upstash.com/docs/vector/features/similarityfunctions)):
|
|
27
|
+
|
|
28
|
+
| metric | score |
|
|
29
|
+
|---|---|
|
|
30
|
+
| `COSINE` | `(1 + cosine_similarity(v1, v2)) / 2` |
|
|
31
|
+
| `EUCLIDEAN` | `1 / (1 + squared_distance(v1, v2))` |
|
|
32
|
+
| `DOT_PRODUCT` | `(1 + dot_product(v1, v2)) / 2` |
|
|
33
|
+
|
|
34
|
+
So every ranking this twin produces is hand-checkable with a calculator: an exact match under
|
|
35
|
+
`COSINE` scores exactly `1`, an orthogonal vector exactly `0.5`, an opposed vector exactly `0`. A
|
|
36
|
+
vector twin whose `score` was a counter, a random number, or an insertion-order rank would let a
|
|
37
|
+
broken retrieval pipeline pass its tests — which is the entire failure this pack exists to prevent.
|
|
38
|
+
Changing the metric genuinely changes the **order**, not just the number.
|
|
39
|
+
|
|
40
|
+
**Metadata filtering is a real language.** `filter` strings are tokenized, parsed to an AST and
|
|
41
|
+
evaluated — `=`, `!=`, `<`, `>`, `<=`, `>=`, `GLOB`, `NOT GLOB`, `IN`, `NOT IN`, `CONTAINS`,
|
|
42
|
+
`NOT CONTAINS`, `HAS FIELD`, `HAS NOT FIELD`, `AND`/`OR` with the vendor's documented precedence
|
|
43
|
+
(`AND` binds tighter), parentheses, arbitrarily nested `.` paths, and `[n]` / `[#-1]` array
|
|
44
|
+
indexing. An expression this pack's own tests never anticipated still works, and a **malformed
|
|
45
|
+
filter is rejected with a 400 rather than silently matching everything** — a filter language that
|
|
46
|
+
ignored a typo would turn one mistake into a full-index data leak.
|
|
47
|
+
|
|
48
|
+
**State lives in the kernel action log**, not in a map: every vector is one kernel subject, so a
|
|
49
|
+
restart against the same `--root` answers the same `/query`.
|
|
50
|
+
|
|
51
|
+
## Endpoints
|
|
52
|
+
|
|
53
|
+
| | |
|
|
54
|
+
|---|---|
|
|
55
|
+
| `POST /upsert[/{ns}]` | one vector object or an array of them |
|
|
56
|
+
| `POST /query[/{ns}]` | an object is one query; an **array** is `queryMany` |
|
|
57
|
+
| `POST /fetch[/{ns}]` | by `ids` (positionally aligned, `null` for a miss) or by `prefix` |
|
|
58
|
+
| `POST /range[/{ns}]` | offset cursor; `nextCursor` is `""` when exhausted |
|
|
59
|
+
| `POST /update[/{ns}]` | `{updated: 0\|1}`, `metadataUpdateMode` `OVERWRITE`\|`PATCH` |
|
|
60
|
+
| `POST\|DELETE /delete[/{ns}]` | by `ids`, `prefix` or metadata `filter` → `{deleted: N}` |
|
|
61
|
+
| `POST\|DELETE /reset[/{ns}]`, `/reset?all` | empty one namespace, or all of them |
|
|
62
|
+
| `GET\|POST /info` | counts, configuration, and the per-namespace map |
|
|
63
|
+
| `GET\|POST /list-namespaces` | the default namespace is named `""` |
|
|
64
|
+
| `POST\|DELETE /delete-namespace/{ns}` | removes the namespace **and** its contents |
|
|
65
|
+
|
|
66
|
+
Three protocol facts a naive twin gets wrong, all confirmed against the installed SDK's own source:
|
|
67
|
+
|
|
68
|
+
1. **Every SDK call is a `POST`**, whatever the docs say the method is — `@upstash/vector`'s
|
|
69
|
+
`HttpClient` hardcodes `method: "POST"`, so although the docs spell `/reset` and
|
|
70
|
+
`/delete-namespace` as `-X DELETE`, the real client never sends `DELETE`. Both are accepted.
|
|
71
|
+
2. **Namespaces are a path suffix, not a body field.** `index.namespace("ns").query(...)` becomes
|
|
72
|
+
`POST /query/ns`. A twin reading `body.namespace` would serve every namespaced request out of
|
|
73
|
+
the default namespace — every tenant seeing every other tenant's vectors.
|
|
74
|
+
3. **`/query` is overloaded on body shape**, and a **single-element** `queryMany` batch answers
|
|
75
|
+
**flat** rather than nested. The SDK's `QueryManyCommand.exec` re-nests exactly that case, and
|
|
76
|
+
its own comment documents it as real API behaviour.
|
|
77
|
+
|
|
78
|
+
## Coverage
|
|
79
|
+
|
|
80
|
+
Partial and honest: the capability manifest (`src/upstashvector-capabilities.ts`) is the **real
|
|
81
|
+
vendor surface** as the denominator — every REST endpoint crossed with every documented feature
|
|
82
|
+
(namespaces, filtering, metadata, similarity functions, sparse/hybrid indexes, embedding models,
|
|
83
|
+
resumable queries, plan limits) — so features this twin has **not** built appear as `todo`s rather
|
|
84
|
+
than being quietly left out of the count. Run `bun scripts/manifest-baseline-one.ts upstashvector`
|
|
85
|
+
for the current numbers.
|
|
86
|
+
|
|
87
|
+
Modeled and proven: the ten endpoints above, dense vectors with a configurable dimension, all three
|
|
88
|
+
similarity metrics computed for real, namespaces (isolation, list, delete), the full metadata-filter
|
|
89
|
+
language, `metadataUpdateMode`, Bearer auth with a 401, the `{result}` / `{error, status}` envelope,
|
|
90
|
+
`readOnly` mode, and a connector that pulls a real index over an **injected** client.
|
|
91
|
+
|
|
92
|
+
### Planned (todo), and what this twin does not run
|
|
93
|
+
|
|
94
|
+
- **The `data`-based endpoints** (`/upsert-data`, `/query-data`) are filed as gaps and **fail
|
|
95
|
+
loudly with a 404** naming them. This twin runs no embedding model, and hashing text into a
|
|
96
|
+
pseudo-vector would return confident nonsense rankings that look exactly like a working retrieval
|
|
97
|
+
pipeline. Send an explicit `vector` — which this twin fully supports — to model the same flow.
|
|
98
|
+
- **`pendingVectorCount`** is filed as a gap: the vendor indexes asynchronously, so a just-upserted
|
|
99
|
+
vector is briefly pending and unqueryable, while this twin's upsert is synchronous and the count
|
|
100
|
+
is always `0`. Callers testing read-your-own-write get the strictest behaviour, never a flaky one.
|
|
101
|
+
- Scoring is **exhaustive and therefore exact**: every vector in the namespace is scored and ranked,
|
|
102
|
+
rather than reproducing DiskANN's approximate recall. Consequence worth knowing: **this twin will
|
|
103
|
+
never reproduce a recall miss the real index would have.** A single local process likewise has no
|
|
104
|
+
replicas, so there is no replication lag to observe.
|
|
105
|
+
|
|
106
|
+
### Grounding, and what could NOT be grounded
|
|
107
|
+
|
|
108
|
+
Grounded (2026-08-19) from the vendor's REST endpoint docs, its feature docs, and the
|
|
109
|
+
**actually-installed `@upstash/vector@1.2.3` source** (its `HttpClient` and every `Command`'s
|
|
110
|
+
endpoint construction) — see `spec-sources.json`.
|
|
111
|
+
|
|
112
|
+
**This pack had no live Upstash Vector index to probe**, unlike its sibling
|
|
113
|
+
[`upstash`](../upstash), which live-probed a real ephemeral database for every literal
|
|
114
|
+
error string. That difference is disclosed rather than papered over:
|
|
115
|
+
|
|
116
|
+
- **Two** error messages here are the vendor's verbatim published text: the dimension mismatch
|
|
117
|
+
`Invalid vector dimension: N, expected: M` (the `/upsert` page's own 422 example) and the 401
|
|
118
|
+
body `{"error": "Unauthorized: Invalid auth token", "status": 401}` (the get-started page's own
|
|
119
|
+
error example — note the capital `I`). The capabilities that assert them say so.
|
|
120
|
+
- Every **other** error capability asserts the **status code** and the documented `{error, status}`
|
|
121
|
+
**envelope**, both of which are grounded, and does **not** claim a vendor wording this pack never
|
|
122
|
+
read. `upstashvector.errors.vendor_error_strings` is the filed gap for closing this with a live
|
|
123
|
+
probe.
|
|
124
|
+
- Four behaviours are explicitly **twin-defined** where the vendor is silent, and are marked as
|
|
125
|
+
such in the manifest and in code: the query **tie-break** (equal scores order by id ascending, so
|
|
126
|
+
rankings are reproducible), the **zero-vector** cosine result (`0` similarity → score `0.5`,
|
|
127
|
+
rather than letting a `NaN` serialise to `null`), **refusing to delete the default namespace**
|
|
128
|
+
(`/reset` is how you empty it), and **refusing an empty `filter` on `/delete`** — on `/query` an
|
|
129
|
+
empty filter harmlessly means "no filter", but the same reading on a delete would mean "match
|
|
130
|
+
every vector", so a caller's template rendering to `""` gets a 400 rather than a wiped namespace.
|
|
131
|
+
|
|
132
|
+
### A pull is a mirror, and local writes win over it
|
|
133
|
+
|
|
134
|
+
`syncUpstashVectorFromReal` writes the kernel's **observed** layer; local writes are projected
|
|
135
|
+
**over** it. So an id you have already upserted locally keeps its local value, and a later pull of
|
|
136
|
+
that same id does not surface. That is deliberate — a mirror refresh must never silently revert a
|
|
137
|
+
local commit — and it is the same fork model `qstash` and `upstash` use. But it means "pulled
|
|
138
|
+
vectors are queryable" holds for ids with **no** local write, not unconditionally, and the pull
|
|
139
|
+
currently counts shadowed ids in `deltasAppended` as though they landed. Filed as
|
|
140
|
+
`upstashvector.connector.pull_shadowed_by_local_writes`.
|
|
141
|
+
|
|
142
|
+
### Safe methods never mutate
|
|
143
|
+
|
|
144
|
+
`GET` and `HEAD` are safe methods (RFC 9110), so neither can modify the index here: a `GET /reset`
|
|
145
|
+
or `HEAD /delete` is refused `405` and changes nothing. No documented Upstash Vector client sends
|
|
146
|
+
one — the SDK `POST`s everything — so the cost of refusing is zero for real callers, while the cost
|
|
147
|
+
of allowing it is an index destroyed by something that thought it was reading. What the real
|
|
148
|
+
service does with those requests is unverified and filed as
|
|
149
|
+
`upstashvector.protocol.get_on_a_write_endpoint`.
|
|
150
|
+
|
|
151
|
+
A pulled index also has no `config` subject, so its dimension is **inferred** from the stored
|
|
152
|
+
vectors when they all agree — so `/info` reports the real dimension, a mis-sized query gets the
|
|
153
|
+
vendor's 422 rather than a silent empty result, and a later upsert cannot lock in a rival dimension
|
|
154
|
+
and orphan the pulled data. (`upstashvector.connector.pull_index_configuration` tracks pulling the
|
|
155
|
+
declared value from `/info` instead of inferring it.) If a pull ever delivers **mixed** lengths, no
|
|
156
|
+
dimension can be honestly inferred, so the next write is **refused** — start the twin with an
|
|
157
|
+
explicit `--dimension` rather than letting one write orphan the others.
|
|
158
|
+
|
|
159
|
+
The connector also **refuses** a vendor row it cannot store faithfully, by id: a non-numeric or
|
|
160
|
+
overflow-scale coordinate, or an id/namespace carrying an unpaired UTF-16 surrogate. Coercing
|
|
161
|
+
instead would substitute a different vector for the real one — `NaN` becomes `null` in JSON and
|
|
162
|
+
`Number(null)` is `0`.
|
|
163
|
+
|
|
164
|
+
### Rate budget
|
|
165
|
+
|
|
166
|
+
Upstash publishes **no requests-per-second limit for Upstash Vector** — this was checked, and the
|
|
167
|
+
absence is the finding. The published figures are per-**day** caps and per-request billing
|
|
168
|
+
($0.4/100K on Pay-As-You-Go; 10,000 queries/day on Free), plus shape limits (max dimension 1,536
|
|
169
|
+
Free → 5,000 Pro, max topK 1,000, metadata 48 KB/vector, data 1 MB/vector). Since no scalar rate is
|
|
170
|
+
documented, the declaration stays **at** the kernel's austere fallback — 60 units / 60s at the
|
|
171
|
+
default weight of 2 = **30 requests/minute** — rather than inventing headroom. `range` costs 6
|
|
172
|
+
because its cost scales with the customer's index rather than with the request, and it is the only
|
|
173
|
+
entrypoint that loops.
|
|
174
|
+
|
|
175
|
+
**What that ceiling does and does not protect.** It bounds a **burst** (a 60-second rolling window,
|
|
176
|
+
fail-closed) and is the tightest burst the architecture permits without a published vendor rate to
|
|
177
|
+
cite. It does **not** bound daily spend: 30/minute is 43,200/day, roughly **4.3x looser** than the
|
|
178
|
+
Free tier's 10,000 queries/day, so sustained pulling at the ceiling would exhaust a Free index's
|
|
179
|
+
daily quota in about 5.5 hours. A rolling-minute window structurally cannot bound a daily quota —
|
|
180
|
+
watch that yourself on a long or repeated sync. (Contrast `upstash`, which *is* more permissive than the fallback, and
|
|
181
|
+
is so precisely because Upstash publishes a scalar 10,000 commands/sec for Redis.)
|
|
182
|
+
|
|
183
|
+
### Host routing — a shared apex with `upstash`
|
|
184
|
+
|
|
185
|
+
Upstash Vector index endpoints and Upstash Redis database endpoints live on the **same apex**,
|
|
186
|
+
`*.upstash.io`, so the injector's `VENDOR_HOSTS` table has to tell them apart. It does so by host
|
|
187
|
+
**shape**, which is stable and checkable:
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
Vector https://<slug>-<region>-vector.upstash.io e.g. living-whale-89944-us1-vector.upstash.io
|
|
191
|
+
Redis https://<slug>.upstash.io e.g. striking-osprey-20681.upstash.io
|
|
192
|
+
QStash https://qstash.upstash.io (fixed host, its own pack)
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Every real Upstash Vector host carries a `-vector` token immediately before `.upstash.io`, so
|
|
196
|
+
`upstashvector` matches `h.endsWith('-vector.upstash.io')` and `upstash` was narrowed to
|
|
197
|
+
exclude it. Without that narrowing the pre-existing Redis suffix matcher would have swallowed every
|
|
198
|
+
Vector request the moment `UPSTASH_TWIN_URL` was set — a silently mis-routed request that
|
|
199
|
+
looks like a bug in the wrong pack. See `packages/world-core/inject.cjs` and
|
|
200
|
+
`scripts/vendor-hosts.test.ts`, which pins both directions.
|
|
201
|
+
|
|
202
|
+
### No UI mirror
|
|
203
|
+
|
|
204
|
+
Upstash Vector is an **API-first** vendor: an integrator *calls* this product from code, and the
|
|
205
|
+
Upstash console is a provisioning-and-metrics dashboard — where you create an index and read its
|
|
206
|
+
charts — not where the work happens. Nobody browses their vector index to do their job; they query
|
|
207
|
+
it from an application. So this pack ships **no mirror** and has **no UI capabilities**; a screen
|
|
208
|
+
here would be a fabricated one. This is the same call as the sibling `upstash` pack and as
|
|
209
|
+
`pinecone`, the repo's other vector-database twin. The capability test asserts it, so a UI
|
|
210
|
+
capability cannot appear here by accident.
|
|
211
|
+
|
|
212
|
+
## Layout
|
|
213
|
+
|
|
214
|
+
| file | |
|
|
215
|
+
|---|---|
|
|
216
|
+
| `src/upstashvector-twin.ts` | the request handler — routing, auth, envelope |
|
|
217
|
+
| `src/upstashvector-store.ts` | the index core: kernel-backed state **and the similarity math** |
|
|
218
|
+
| `src/upstashvector-filter.ts` | the metadata-filter tokenizer, parser and evaluator |
|
|
219
|
+
| `src/upstashvector-server.ts` | `createUpstashVectorTwinServer({ root, port, readOnly, token, dimension, similarityFunction })` |
|
|
220
|
+
| `src/upstashvector-connector.ts` | pull over an **injected** client (no SDK import, no token held) |
|
|
221
|
+
| `src/upstashvector-budget.ts` | the rate-budget declaration + the guard every live call goes through |
|
|
222
|
+
| `src/upstashvector-capabilities.ts` | the capability manifest — the real vendor surface |
|
|
223
|
+
| `src/upstashvector-conformance.ts` | dev-only endpoint probes (lazy-imported by the CLI) |
|
|
224
|
+
|
|
225
|
+
## Tests
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
bun test src/*.test.ts
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
`src/upstashvector-sdk.integration.test.ts` drives the **real, unmodified** `@upstash/vector` SDK
|
|
232
|
+
against the twin over HTTP — the fidelity proof. The SDK is a **devDependency only**; the pack
|
|
233
|
+
imports no SDK at runtime and holds no token.
|
package/dist/src/cli.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { keepProcessAlive } from '@volter/world-core/lifecycle';
|
|
3
|
+
// world-upstashvector CLI: serve the KERNEL-BACKED Upstash Vector REST twin, or run conformance.
|
|
4
|
+
// State lives in the @volter/world-core action log (no in-memory side-store). Conformance is dev-only +
|
|
5
|
+
// lazy-imported so the bin runs without @volter/world-tooling (E2).
|
|
6
|
+
import { hasFlag, optionValue } from '@volter/world-core/args';
|
|
7
|
+
import { createUpstashVectorTwinServer } from "./upstashvector-server.js";
|
|
8
|
+
import { SIMILARITY_FUNCTIONS } from "./upstashvector-store.js";
|
|
9
|
+
const [cmd, ...rest] = process.argv.slice(2);
|
|
10
|
+
const port = Number(optionValue(rest, '--port', String(process.env.PORT ?? '0'))) || undefined;
|
|
11
|
+
const root = optionValue(rest, '--root') || undefined;
|
|
12
|
+
// The token this twin will DEMAND. Omit it and any non-empty credential is accepted (a missing one
|
|
13
|
+
// is still a vendor-shaped 401) — the right default for a local twin that holds no real secret.
|
|
14
|
+
const token = optionValue(rest, '--token') || undefined;
|
|
15
|
+
const dimension = Number(optionValue(rest, '--dimension', '0')) || undefined;
|
|
16
|
+
const similarityRaw = optionValue(rest, '--similarity') || undefined;
|
|
17
|
+
const readOnly = hasFlag(rest, '--read-only'); // a twin accepts writes unless started read-only
|
|
18
|
+
if (similarityRaw !== undefined && !SIMILARITY_FUNCTIONS.includes(similarityRaw.toUpperCase())) {
|
|
19
|
+
process.stderr.write(`--similarity must be one of ${SIMILARITY_FUNCTIONS.join(', ')}\n`);
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
const similarityFunction = similarityRaw?.toUpperCase();
|
|
23
|
+
if (cmd === 'serve' || cmd === undefined) {
|
|
24
|
+
const s = await createUpstashVectorTwinServer({
|
|
25
|
+
readOnly,
|
|
26
|
+
...(root ? { root } : {}),
|
|
27
|
+
...(port ? { port } : {}),
|
|
28
|
+
...(token ? { token } : {}),
|
|
29
|
+
...(dimension ? { dimension } : {}),
|
|
30
|
+
...(similarityFunction ? { similarityFunction } : {}),
|
|
31
|
+
});
|
|
32
|
+
process.stdout.write(`upstashvector twin (Upstash Vector REST: /upsert /query /fetch /range /delete /update /reset /info, namespaces as a path suffix)${readOnly ? ' [read-only]' : ''} at http://127.0.0.1:${s.port}\n`
|
|
33
|
+
+ ` point a client at it with UPSTASH_VECTOR_REST_URL=http://127.0.0.1:${s.port} and any non-empty UPSTASH_VECTOR_REST_TOKEN\n`);
|
|
34
|
+
await keepProcessAlive();
|
|
35
|
+
}
|
|
36
|
+
else if (cmd === 'conformance') {
|
|
37
|
+
const { checkUpstashVectorConformance } = await import("./upstashvector-conformance.js");
|
|
38
|
+
const report = await checkUpstashVectorConformance();
|
|
39
|
+
process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
|
|
40
|
+
if (!report.ok)
|
|
41
|
+
process.exitCode = 1;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
process.stdout.write('Usage: world-upstashvector serve|conformance [--port N] [--root DIR] [--token T] [--dimension N] [--similarity COSINE|EUCLIDEAN|DOT_PRODUCT] [--read-only]\n');
|
|
45
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { handleUpstashVectorTwinRequest, routeUpstashVectorPath, upstashvectorTwinSnapshot, extractUpstashVectorCredential, UPSTASH_VECTOR_UNAUTHORIZED_ERROR, } from './upstashvector-twin.js';
|
|
2
|
+
export type { UpstashVectorRequest, UpstashVectorResponse, UpstashVectorRoute, UpstashVectorCommand, UpstashVectorTwinSnapshot, } from './upstashvector-twin.js';
|
|
3
|
+
export { IndexSpace, SERVICE, DEFAULT_NAMESPACE, DEFAULT_SIMILARITY, SIMILARITY_FUNCTIONS, UPSTASHVECTOR_RESOURCE_TYPES, CONFIG_SUBJECT_ID, VectorApiError, ReadOnlyError, cosineSimilarity, dotProduct, squaredDistance, similarityScore, vectorSubjectId, namespaceSubjectId, } from './upstashvector-store.js';
|
|
4
|
+
export type { SimilarityFunction, VectorContext, VectorRow, UpstashVectorResourceType, } from './upstashvector-store.js';
|
|
5
|
+
export { parseFilter, tokenizeFilter, evaluateFilter, matchesFilter, resolvePath, parsePath, globMatch, FilterError, MISSING, } from './upstashvector-filter.js';
|
|
6
|
+
export type { FilterNode, FilterValue, ComparisonOp, Token, TokenKind } from './upstashvector-filter.js';
|
|
7
|
+
export { createUpstashVectorTwinFetch, createUpstashVectorTwinServer } from './upstashvector-server.js';
|
|
8
|
+
export type { UpstashVectorServerOptions, UpstashVectorTwinFetchOptions } from './upstashvector-server.js';
|
|
9
|
+
export { mapVector, mapNamespace, pullUpstashVectorRange, pullUpstashVectorNamespaces, syncUpstashVectorFromReal, } from './upstashvector-connector.js';
|
|
10
|
+
export type { UpstashVectorLikeClient, UpstashVectorRealVector, UpstashVectorBudgetedOptions, } from './upstashvector-connector.js';
|
|
11
|
+
export { UPSTASHVECTOR_BUDGETED_METHODS, UPSTASHVECTOR_BUDGET_CEILING, UPSTASHVECTOR_BUDGET_MAX_RETRY_AFTER_S, UPSTASHVECTOR_BUDGET_WINDOW_MS, UPSTASHVECTOR_CALL_WEIGHTS, UPSTASHVECTOR_RATE_BUDGET, UpstashVectorBudget, UpstashVectorBudgetError, upstashvectorBudgetPath, upstashvectorCallWeight, upstashvectorClientBudget, guardUpstashVectorClient, } from './upstashvector-budget.js';
|
|
12
|
+
export type { UpstashVectorBudgetErrorKind, UpstashVectorBudgetOptions, UpstashVectorBudgetReservation, UpstashVectorBudgetSnapshot, } from './upstashvector-budget.js';
|
|
13
|
+
import { type TwinPack } from '@volter/world-core';
|
|
14
|
+
export declare const pack: TwinPack;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// @volter/twin-upstashvector — the Upstash Vector REST API twin, built on the shared @volter/world-core
|
|
2
|
+
// kernel. Per-index host transport (`https://<slug>-<region>-vector.upstash.io`), the vendor's
|
|
3
|
+
// command-per-path REST surface (`/upsert`, `/query`, `/fetch`, `/range`, `/delete`, `/update`,
|
|
4
|
+
// `/reset`, `/info`, `/list-namespaces`, `/delete-namespace`) with namespaces as a PATH SUFFIX,
|
|
5
|
+
// Bearer-token auth, and the `{result}` / `{error,status}` envelope.
|
|
6
|
+
//
|
|
7
|
+
// Behind that protocol is a REAL vector index. Two things make that claim more than a slogan:
|
|
8
|
+
//
|
|
9
|
+
// 1. THE SCORES ARE COMPUTED, NEVER FAKED. `/query` ranks by a similarity score derived from the
|
|
10
|
+
// stored coordinates using Upstash's own published normalizations —
|
|
11
|
+
// COSINE `(1 + cosine_similarity)/2`, EUCLIDEAN `1/(1 + squared_distance)`,
|
|
12
|
+
// DOT_PRODUCT `(1 + dot_product)/2` — so any ranking this twin produces can be hand-checked
|
|
13
|
+
// with a calculator. A vector twin whose `score` was a counter or an insertion-order rank
|
|
14
|
+
// would let a broken retrieval pipeline pass its tests, which is the exact failure this pack
|
|
15
|
+
// exists to prevent.
|
|
16
|
+
// 2. METADATA FILTERING IS A REAL LANGUAGE. `filter` strings are tokenized, parsed to an AST and
|
|
17
|
+
// evaluated (`=`, `!=`, `<`, `>`, `<=`, `>=`, `GLOB`, `IN`, `NOT IN`, `CONTAINS`,
|
|
18
|
+
// `HAS FIELD`, `HAS NOT FIELD`, `AND`/`OR` with the documented precedence, nested `.` paths and
|
|
19
|
+
// `[]`/`[#-n]` array indexing) — so an expression this pack's own tests never anticipated
|
|
20
|
+
// still works, and a malformed one is REJECTED rather than silently matching everything.
|
|
21
|
+
//
|
|
22
|
+
// State lives ENTIRELY in the kernel action log (no side-store): every vector is one kernel
|
|
23
|
+
// subject, so a restart against the same root answers the same `/query`.
|
|
24
|
+
//
|
|
25
|
+
// THE FILED GAPS: this twin runs no embedding model, so the `data`-based `/upsert-data` and
|
|
26
|
+
// `/query-data` surfaces fail loudly rather than hashing text into a fake vector; sparse/hybrid
|
|
27
|
+
// indexes and the resumable-query family are modeled as filed gaps, not silently accepted.
|
|
28
|
+
// See README ## Coverage.
|
|
29
|
+
export { handleUpstashVectorTwinRequest, routeUpstashVectorPath, upstashvectorTwinSnapshot, extractUpstashVectorCredential, UPSTASH_VECTOR_UNAUTHORIZED_ERROR, } from "./upstashvector-twin.js";
|
|
30
|
+
// The index core — exported so a caller can drive the vector semantics (and the MATH) in-process,
|
|
31
|
+
// without HTTP. `similarityScore` in particular is the claim this pack stands on, so it must be
|
|
32
|
+
// callable and checkable directly.
|
|
33
|
+
export { IndexSpace, SERVICE, DEFAULT_NAMESPACE, DEFAULT_SIMILARITY, SIMILARITY_FUNCTIONS, UPSTASHVECTOR_RESOURCE_TYPES, CONFIG_SUBJECT_ID, VectorApiError, ReadOnlyError, cosineSimilarity, dotProduct, squaredDistance, similarityScore, vectorSubjectId, namespaceSubjectId, } from "./upstashvector-store.js";
|
|
34
|
+
// The metadata-filter language. Exported because filter fidelity is a headline claim of this pack
|
|
35
|
+
// and a consumer (or a reviewer) must be able to run an expression against it directly.
|
|
36
|
+
export { parseFilter, tokenizeFilter, evaluateFilter, matchesFilter, resolvePath, parsePath, globMatch, FilterError, MISSING, } from "./upstashvector-filter.js";
|
|
37
|
+
export { createUpstashVectorTwinFetch, createUpstashVectorTwinServer } from "./upstashvector-server.js";
|
|
38
|
+
export { mapVector, mapNamespace, pullUpstashVectorRange, pullUpstashVectorNamespaces, syncUpstashVectorFromReal, } from "./upstashvector-connector.js";
|
|
39
|
+
// The client-side rate budget — the fail-closed backstop every live call goes through. The
|
|
40
|
+
// MECHANISM is the kernel's shared, vendor-agnostic `RateBudget`; what lives here is this vendor's
|
|
41
|
+
// DECLARATION (window/ceiling/per-method weights) plus `guardUpstashVectorClient`, the choke point
|
|
42
|
+
// the connector entrypoints apply unconditionally. Exported so an operator can inspect spend
|
|
43
|
+
// (`snapshot`) and a caller can catch `UpstashVectorBudgetError` by type; there is deliberately no
|
|
44
|
+
// export that disables the guard.
|
|
45
|
+
export { UPSTASHVECTOR_BUDGETED_METHODS, UPSTASHVECTOR_BUDGET_CEILING, UPSTASHVECTOR_BUDGET_MAX_RETRY_AFTER_S, UPSTASHVECTOR_BUDGET_WINDOW_MS, UPSTASHVECTOR_CALL_WEIGHTS, UPSTASHVECTOR_RATE_BUDGET, UpstashVectorBudget, UpstashVectorBudgetError, upstashvectorBudgetPath, upstashvectorCallWeight, upstashvectorClientBudget, guardUpstashVectorClient, } from "./upstashvector-budget.js";
|
|
46
|
+
// Registry descriptor: the pack self-describes so tooling can discover it.
|
|
47
|
+
import { registerPack } from '@volter/world-core';
|
|
48
|
+
import { performUpstashVectorAction, syncUpstashVectorFromRemote } from "./upstashvector-connector.js";
|
|
49
|
+
import { UPSTASHVECTOR_RATE_BUDGET as RATE_BUDGET } from "./upstashvector-budget.js";
|
|
50
|
+
export const pack = {
|
|
51
|
+
// PROTOCOL 2 (docs/contributing/architecture.md#protocol-2-the-pack-is-a-plugin): the pack is a plugin — its wire, its tree, and its half of
|
|
52
|
+
// the real state system. Moved 2026-09-08.
|
|
53
|
+
protocol: '2',
|
|
54
|
+
// The refresh ranges every namespace, which on a real index is a lot of vectors. Fifteen minutes.
|
|
55
|
+
refresh: { every: '15m', webhook: false, onDemand: { atMost: '30s' } },
|
|
56
|
+
stateSystem: { perform: performUpstashVectorAction, refresh: syncUpstashVectorFromRemote },
|
|
57
|
+
// The round trip is an upsert — Upstash Vector's own write, and an upsert of the same id is the
|
|
58
|
+
// vendor's own idempotence rather than a refusal, so a second send on a branch lands cleanly.
|
|
59
|
+
roundTrip: { method: 'POST', path: '/upsert', body: { id: 'round-trip', vector: [0.1, 0.2, 0.3], metadata: { round: 'trip' } }, headers: { authorization: 'Bearer round-trip' } },
|
|
60
|
+
parityOrigin: 'http://twin',
|
|
61
|
+
shapeParity: 'held',
|
|
62
|
+
// The SAME object upstashvector-budget.ts declares at module load — one source of truth, so
|
|
63
|
+
// registering the pack and importing the connector can never arm two different ceilings.
|
|
64
|
+
rateBudget: RATE_BUDGET,
|
|
65
|
+
vendor: 'upstashvector',
|
|
66
|
+
transport: 'rest',
|
|
67
|
+
archetype: 'crud',
|
|
68
|
+
bin: 'world-upstashvector',
|
|
69
|
+
resources: ['vector', 'namespace', 'config'],
|
|
70
|
+
specSource: 'upstash.com/docs/vector/api/endpoints/* + features/{namespaces,filtering,similarityfunctions,metadata} + the installed @upstash/vector@1.2.3 compiled source (HttpClient + every Command\'s endpoint construction); see spec-sources.json.',
|
|
71
|
+
description: 'Upstash Vector REST twin — a real stateful dense-vector index (upsert/query/fetch/range/update/delete/reset/info, namespaces as a path suffix) served over Upstash Vector\'s REST protocol with Bearer auth and the {result}/{error,status} envelope. Similarity scores are COMPUTED from the stored coordinates using Upstash\'s own published normalizations (cosine/euclidean/dot-product), and metadata filtering is a real parsed expression language, so rankings are hand-checkable rather than faked. Kernel-backed; no embedding model (data-based upsert/query fail loudly).',
|
|
72
|
+
browserRouting: { apiPathPrefix: '/', loaderHost: 'https://twin-vector.upstash.io' },
|
|
73
|
+
// Adoption, moved off the central maps unchanged (descriptor-first back-migration, adding-a-twin.md §3,
|
|
74
|
+
// 2026-08-31). The `scopes` entry is the exact PACKAGE name, not an apex: the @upstash/ scope
|
|
75
|
+
// spans several DIFFERENT Upstash products, each with its own pack. The stem comes from
|
|
76
|
+
// UPSTASH_VECTOR_REST_URL / _REST_TOKEN (the SDK's own env names, including its NEXT_PUBLIC_
|
|
77
|
+
// variants, which the framework-prefix strip handles).
|
|
78
|
+
adoption: {
|
|
79
|
+
// Upstash's official Vector Python SDK (upstash/vector-py).
|
|
80
|
+
pypi: ['upstash-vector'],
|
|
81
|
+
sdks: ['@upstash/vector'], scopes: ['@upstash/vector'], envStems: ['UPSTASHVECTOR'],
|
|
82
|
+
},
|
|
83
|
+
// SAME APEX as Upstash Redis, so the two are told apart by host SHAPE — the one discriminator
|
|
84
|
+
// that is stable and checkable:
|
|
85
|
+
// Vector https://<slug>-<region>-vector.upstash.io (living-whale-89944-us1-vector.upstash.io,
|
|
86
|
+
// boss-lioness-52864-gcp-usc1-vector.upstash.io)
|
|
87
|
+
// Redis https://<slug>.upstash.io (striking-osprey-20681.upstash.io)
|
|
88
|
+
// Every real Vector index endpoint carries a `-vector` token immediately before the apex: the
|
|
89
|
+
// product suffix is appended to the index slug (which is where the region lives). Corroborated
|
|
90
|
+
// three ways — ~90 literal hostnames found in public code, live DNS (real index hosts CNAME into
|
|
91
|
+
// per-region `*-vector` fleets), and the REST token itself, which base64-decodes to
|
|
92
|
+
// `<slug><role>` where `<slug>` is exactly the host minus `-vector.upstash.io`.
|
|
93
|
+
//
|
|
94
|
+
// The two predicates are MUTUALLY EXCLUSIVE by construction rather than by declaration order:
|
|
95
|
+
// the Redis rule (still in the hand VENDOR_HOSTS table, because it needs exclusions this
|
|
96
|
+
// descriptor's rule kinds cannot express) explicitly excludes `*-vector.upstash.io`, and
|
|
97
|
+
// vendor-hosts.test.ts pins both directions. `resolveTwin` iterates VENDOR_HOSTS in insertion
|
|
98
|
+
// order, so an overlap would have made routing depend on key order — it does not.
|
|
99
|
+
//
|
|
100
|
+
// Upstash publishes no hostname format in its docs (every example uses the
|
|
101
|
+
// $UPSTASH_VECTOR_REST_URL placeholder), so this rule is grounded in observed reality rather
|
|
102
|
+
// than a spec. A custom-domain or private-link Vector endpoint would not match; that is the safe
|
|
103
|
+
// direction — it simply is not intercepted, rather than being routed to the wrong twin.
|
|
104
|
+
hosts: [{ suffix: '-vector.upstash.io' }],
|
|
105
|
+
};
|
|
106
|
+
registerPack(pack);
|