@larkup/cli 0.1.20 → 0.2.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.
@@ -20,13 +20,30 @@ var LanceDBAdapter = class {
20
20
  throw new Error("LanceDB Cloud requires both a URI and an API key.");
21
21
  }
22
22
  if (!this.config.uri.startsWith("db://")) {
23
- throw new Error(
24
- "LanceDB Cloud URI must start with 'db://' (e.g. db://my-database)."
25
- );
23
+ throw new Error("LanceDB Cloud URI must start with 'db://' (e.g. db://my-database).");
26
24
  }
27
25
  this.conn = await lancedb.connect(this.config.uri, {
28
26
  apiKey: this.config.apiKey
29
27
  });
28
+ } else if (this.config.mode === "s3") {
29
+ if (!this.config.s3Uri || !this.config.s3AccessKeyId || !this.config.s3SecretAccessKey) {
30
+ throw new Error(
31
+ "S3-compatible LanceDB requires a URI, access key ID, and secret access key."
32
+ );
33
+ }
34
+ if (!this.config.s3Uri.startsWith("s3://")) {
35
+ throw new Error(
36
+ "S3-compatible LanceDB URI must start with 's3://' (e.g. s3://my-bucket/lancedb)."
37
+ );
38
+ }
39
+ this.conn = await lancedb.connect(this.config.s3Uri, {
40
+ storageOptions: {
41
+ aws_access_key_id: this.config.s3AccessKeyId,
42
+ aws_secret_access_key: this.config.s3SecretAccessKey,
43
+ ...this.config.s3Endpoint ? { aws_endpoint: this.config.s3Endpoint } : {},
44
+ ...this.config.s3Region ? { aws_region: this.config.s3Region } : {}
45
+ }
46
+ });
30
47
  } else {
31
48
  const dir = this.config.dbPath?.trim() || "./.larkup/lancedb";
32
49
  let abs = path.isAbsolute(dir) ? dir : path.join(process.cwd(), dir);
@@ -44,9 +61,7 @@ var LanceDBAdapter = class {
44
61
  );
45
62
  }
46
63
  } else {
47
- throw new Error(
48
- `Could not create directory for LanceDB at "${abs}": ${err.message}`
49
- );
64
+ throw new Error(`Could not create directory for LanceDB at "${abs}": ${err.message}`);
50
65
  }
51
66
  }
52
67
  this.conn = await lancedb.connect(abs);
@@ -68,6 +83,15 @@ var LanceDBAdapter = class {
68
83
  }
69
84
  this.table = null;
70
85
  }
86
+ async deleteByDocumentIds(documentIds) {
87
+ if (documentIds.length === 0) return;
88
+ if (!this.table) {
89
+ await this.init();
90
+ if (!this.table) return;
91
+ }
92
+ const idsString = documentIds.map((id) => `'${id}'`).join(", ");
93
+ await this.table.delete(`documentId IN (${idsString})`);
94
+ }
71
95
  toRow(r) {
72
96
  return {
73
97
  id: r.id,
@@ -116,7 +140,6 @@ var LanceDBAdapter = class {
116
140
  const rows = await this.table.search(vector).limit(topK).toArray();
117
141
  return rows.map((row) => ({
118
142
  id: row.id,
119
- // Convert L2 distance → a 0..1 similarity-ish score for display.
120
143
  score: typeof row._distance === "number" ? 1 / (1 + row._distance) : 0,
121
144
  text: row.text,
122
145
  title: row.title,
@@ -131,7 +154,8 @@ var LanceDBAdapter = class {
131
154
  await this.connect();
132
155
  return;
133
156
  } catch (err) {
134
- throw new Error(`Failed to connect to local LanceDB: ${err.message}`);
157
+ const label = this.config.mode === "s3" ? "S3-compatible LanceDB" : "local LanceDB";
158
+ throw new Error(`Failed to connect to ${label}: ${err.message}`);
135
159
  }
136
160
  }
137
161
  let conn;
@@ -1,9 +1,7 @@
1
1
  import "./chunk-3RG5ZIWI.js";
2
2
 
3
3
  // ../../packages/vector-stores/src/adapters/pinecone.ts
4
- import {
5
- Pinecone
6
- } from "@pinecone-database/pinecone";
4
+ import { Pinecone } from "@pinecone-database/pinecone";
7
5
  var SPARSE_BATCH = 48;
8
6
  var BASE_INTER_BATCH_DELAY_MS = 7e3;
9
7
  var RATE_LIMIT_WAIT_MS = 65e3;
@@ -66,6 +64,14 @@ var PineconeAdapter = class {
66
64
  } catch {
67
65
  }
68
66
  }
67
+ async deleteByDocumentIds(documentIds) {
68
+ if (documentIds.length === 0) return;
69
+ try {
70
+ await this.ns().deleteMany({ filter: { documentId: { $in: documentIds } } });
71
+ } catch (err) {
72
+ console.error("Failed to delete vectors by documentIds in Pinecone:", err);
73
+ }
74
+ }
69
75
  // ── Sparse vector generation with rate-limit handling ─────────────────────
70
76
  /**
71
77
  * Call Pinecone Inference API for one batch of texts, retrying on 429.
@@ -177,9 +183,7 @@ var PineconeAdapter = class {
177
183
  });
178
184
  return;
179
185
  }
180
- const sparseVecs = await this.buildSparseVectors(
181
- records.map((r) => r.text)
182
- );
186
+ const sparseVecs = await this.buildSparseVectors(records.map((r) => r.text));
183
187
  await this.ns().upsert({
184
188
  records: records.map((r, i) => ({
185
189
  id: r.id,
@@ -246,9 +250,7 @@ var PineconeAdapter = class {
246
250
  }
247
251
  throw new Error(`Failed to connect to Pinecone: ${err.message}`);
248
252
  }
249
- const indexModel = (indexList.indexes ?? []).find(
250
- (i) => i.name === this.indexName
251
- );
253
+ const indexModel = (indexList.indexes ?? []).find((i) => i.name === this.indexName);
252
254
  if (!indexModel) {
253
255
  throw new Error(
254
256
  `Index "${this.indexName}" does not exist in your Pinecone project. Please create it first.`
@@ -261,9 +263,7 @@ var PineconeAdapter = class {
261
263
  }
262
264
  if (this.needsSparse) {
263
265
  if (!this.config.sparseModel) {
264
- throw new Error(
265
- "Hybrid/lexical search requires a sparse model to be selected."
266
- );
266
+ throw new Error("Hybrid/lexical search requires a sparse model to be selected.");
267
267
  }
268
268
  const metric = indexModel.metric ?? indexModel.spec?.metric;
269
269
  if (metric && metric !== "dotproduct") {
@@ -276,15 +276,7 @@ var PineconeAdapter = class {
276
276
  };
277
277
  function hitFromMatch(m) {
278
278
  const meta = m.metadata ?? {};
279
- const {
280
- text,
281
- title,
282
- url,
283
- source,
284
- documentId,
285
- chunkIndex,
286
- ...customMetadata
287
- } = meta;
279
+ const { text, title, url, source, documentId, chunkIndex, ...customMetadata } = meta;
288
280
  return {
289
281
  id: m.id,
290
282
  score: m.score ?? 0,
@@ -0,0 +1,19 @@
1
+ import {
2
+ buildRegistry,
3
+ fetchToolFromHub,
4
+ getAllCategories,
5
+ getAllTools,
6
+ getToolById,
7
+ getToolsWithCapability,
8
+ invalidateRegistryCache
9
+ } from "./chunk-NH7TTMXS.js";
10
+ import "./chunk-3RG5ZIWI.js";
11
+ export {
12
+ buildRegistry,
13
+ fetchToolFromHub,
14
+ getAllCategories,
15
+ getAllTools,
16
+ getToolById,
17
+ getToolsWithCapability,
18
+ invalidateRegistryCache
19
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@larkup/cli",
3
- "version": "0.1.20",
3
+ "version": "0.2.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -28,8 +28,9 @@
28
28
  "cli-table3": "^0.6.5",
29
29
  "commander": "^13.1.0",
30
30
  "zod": "^4.4.3",
31
- "@larkup/core": "0.1.20",
32
- "@larkup/vector-stores": "0.1.20"
31
+ "@larkup/core": "0.2.0",
32
+ "@larkup/marketplace": "0.1.1",
33
+ "@larkup/vector-stores": "0.1.21"
33
34
  },
34
35
  "devDependencies": {
35
36
  "tsup": "^8.0.0",