@rcrsr/rill-ext-pinecone 0.9.0 → 0.16.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/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  // Generated by dts-bundle-generator v9.5.1
2
2
 
3
- import { ExtensionConfigSchema, ExtensionResult } from '@rcrsr/rill';
3
+ import { ExtensionConfigSchema, ExtensionManifest, ExtensionResult } from '@rcrsr/rill';
4
4
 
5
5
  /**
6
6
  * Type definitions for Pinecone extension.
@@ -83,7 +83,8 @@ export type PineconeExtensionConfig = PineconeConfig;
83
83
  * ```
84
84
  */
85
85
  export declare function createPineconeExtension(config: PineconeConfig): ExtensionResult;
86
- export declare const VERSION = "0.0.1";
86
+ export declare const VERSION: string;
87
87
  export declare const configSchema: ExtensionConfigSchema;
88
+ export declare const extensionManifest: ExtensionManifest;
88
89
 
89
90
  export {};
package/dist/index.js CHANGED
@@ -1,9 +1,13 @@
1
+ // src/index.ts
2
+ import { createRequire } from "module";
3
+
1
4
  // src/factory.ts
2
5
  import { Pinecone } from "@pinecone-database/pinecone";
3
6
  import {
4
- RuntimeError as RuntimeError4,
7
+ RuntimeError as RuntimeError6,
5
8
  emitExtensionEvent as emitExtensionEvent3,
6
- createVector
9
+ createVector,
10
+ rillTypeToTypeValue
7
11
  } from "@rcrsr/rill";
8
12
 
9
13
  // ../../shared/ext-vector/dist/errors.js
@@ -111,18 +115,158 @@ function assertRequired(value, fieldName) {
111
115
  // ../../shared/ext-vector/dist/wrapper.js
112
116
  import { emitExtensionEvent as emitExtensionEvent2 } from "@rcrsr/rill";
113
117
 
118
+ // ../../shared/ext-vector/dist/param.js
119
+ import { RuntimeError as RuntimeError4 } from "@rcrsr/rill";
120
+ function validateParamName(name) {
121
+ if (name === "")
122
+ throw new RuntimeError4("RILL-R001", "param name must not be empty");
123
+ if (/\s/.test(name))
124
+ throw new RuntimeError4("RILL-R001", "param name must be a valid identifier");
125
+ }
126
+ function vectorParam(name) {
127
+ validateParamName(name);
128
+ return {
129
+ name,
130
+ type: { type: "vector" },
131
+ defaultValue: void 0,
132
+ annotations: {}
133
+ };
134
+ }
135
+
136
+ // ../../shared/ext-param/dist/param.js
137
+ import { RuntimeError as RuntimeError5 } from "@rcrsr/rill";
138
+ function validateParamName2(name) {
139
+ if (name === "") {
140
+ throw new RuntimeError5("RILL-R001", "param name must not be empty");
141
+ }
142
+ if (/\s/.test(name)) {
143
+ throw new RuntimeError5("RILL-R001", "param name must be a valid identifier");
144
+ }
145
+ }
146
+ function buildAnnotations(desc) {
147
+ if (desc !== void 0) {
148
+ return { description: desc };
149
+ }
150
+ return {};
151
+ }
152
+ var p = {
153
+ /**
154
+ * IR-1: Creates a string parameter descriptor.
155
+ *
156
+ * @param name - Parameter name (must be a valid identifier)
157
+ * @param desc - Optional description
158
+ * @returns RillParam with type 'string'
159
+ */
160
+ str(name, desc) {
161
+ validateParamName2(name);
162
+ return {
163
+ name,
164
+ type: { type: "string" },
165
+ defaultValue: void 0,
166
+ annotations: buildAnnotations(desc)
167
+ };
168
+ },
169
+ /**
170
+ * IR-2: Creates a number parameter descriptor.
171
+ *
172
+ * @param name - Parameter name (must be a valid identifier)
173
+ * @param desc - Optional description
174
+ * @param def - Optional default value
175
+ * @returns RillParam with type 'number'
176
+ */
177
+ num(name, desc, def) {
178
+ validateParamName2(name);
179
+ return {
180
+ name,
181
+ type: { type: "number" },
182
+ defaultValue: def,
183
+ annotations: buildAnnotations(desc)
184
+ };
185
+ },
186
+ /**
187
+ * IR-3: Creates a boolean parameter descriptor.
188
+ *
189
+ * @param name - Parameter name (must be a valid identifier)
190
+ * @param desc - Optional description
191
+ * @param def - Optional default value
192
+ * @returns RillParam with type 'bool'
193
+ */
194
+ bool(name, desc, def) {
195
+ validateParamName2(name);
196
+ return {
197
+ name,
198
+ type: { type: "bool" },
199
+ defaultValue: def,
200
+ annotations: buildAnnotations(desc)
201
+ };
202
+ },
203
+ /**
204
+ * IR-4: Creates a dict parameter descriptor.
205
+ *
206
+ * @param name - Parameter name (must be a valid identifier)
207
+ * @param desc - Optional description
208
+ * @param def - Optional default value
209
+ * @param fields - Optional structural field definitions (RillFieldDef with type and optional defaultValue)
210
+ * @returns RillParam with type 'dict' (with fields if provided)
211
+ */
212
+ dict(name, desc, def, fields) {
213
+ validateParamName2(name);
214
+ const type = fields !== void 0 ? { type: "dict", fields } : { type: "dict" };
215
+ return {
216
+ name,
217
+ type,
218
+ defaultValue: def,
219
+ annotations: buildAnnotations(desc)
220
+ };
221
+ },
222
+ /**
223
+ * IR-5: Creates a list parameter descriptor.
224
+ *
225
+ * @param name - Parameter name (must be a valid identifier)
226
+ * @param itemType - Optional element type; omitted when not provided
227
+ * @param desc - Optional description
228
+ * @returns RillParam with type 'list' (with element if itemType provided)
229
+ */
230
+ list(name, itemType, desc) {
231
+ validateParamName2(name);
232
+ const type = itemType !== void 0 ? { type: "list", element: itemType } : { type: "list" };
233
+ return {
234
+ name,
235
+ type,
236
+ defaultValue: void 0,
237
+ annotations: buildAnnotations(desc)
238
+ };
239
+ },
240
+ /**
241
+ * IR-6: Creates a callable parameter descriptor.
242
+ *
243
+ * @param name - Parameter name (must be a valid identifier)
244
+ * @param desc - Optional description
245
+ * @returns RillParam with type 'closure'
246
+ */
247
+ callable(name, desc) {
248
+ validateParamName2(name);
249
+ return {
250
+ name,
251
+ type: { type: "closure" },
252
+ defaultValue: void 0,
253
+ annotations: buildAnnotations(desc)
254
+ };
255
+ }
256
+ };
257
+
114
258
  // src/factory.ts
115
259
  function mapPineconeError(error) {
116
260
  if (error instanceof Error) {
117
261
  const message = error.message;
118
262
  if (message.toLowerCase().includes("authentication")) {
119
- return new RuntimeError4(
263
+ return new RuntimeError6(
120
264
  "RILL-R004",
121
265
  "pinecone: authentication failed (401)"
122
266
  );
123
267
  }
124
268
  if (message.toLowerCase().includes("index") && message.toLowerCase().includes("not found")) {
125
- return new RuntimeError4("RILL-R004", "pinecone: collection not found");
269
+ return new RuntimeError6("RILL-R004", "pinecone: collection not found");
126
270
  }
127
271
  }
128
272
  return mapVectorError("pinecone", error);
@@ -157,15 +301,15 @@ function createPineconeExtension(config) {
157
301
  // IR-1: pinecone::upsert
158
302
  upsert: {
159
303
  params: [
160
- { name: "id", type: "string" },
161
- { name: "vector", type: "vector" },
162
- { name: "metadata", type: "dict", defaultValue: {} }
304
+ p.str("id"),
305
+ vectorParam("vector"),
306
+ p.dict("metadata", void 0, {})
163
307
  ],
164
308
  fn: async (args, ctx) => {
165
309
  checkDisposed2();
166
- const id = args[0];
167
- const vector = args[1];
168
- const metadataArg = args[2] ?? {};
310
+ const id = args["id"];
311
+ const vector = args["vector"];
312
+ const metadataArg = args["metadata"] ?? {};
169
313
  const metadata = convertMetadata(metadataArg);
170
314
  return withEventEmission(
171
315
  ctx,
@@ -190,17 +334,17 @@ function createPineconeExtension(config) {
190
334
  }
191
335
  );
192
336
  },
193
- description: "Insert or update single vector with metadata",
194
- returnType: "dict"
337
+ annotations: { description: "Insert or update single vector with metadata" },
338
+ returnType: rillTypeToTypeValue({ type: "dict", fields: { id: { type: { type: "string" } }, success: { type: { type: "bool" } } } })
195
339
  },
196
340
  // IR-2: pinecone::upsert_batch
197
341
  upsert_batch: {
198
- params: [{ name: "items", type: "list" }],
342
+ params: [p.list("items")],
199
343
  fn: async (args, ctx) => {
200
344
  const startTime = Date.now();
201
345
  try {
202
346
  checkDisposed2();
203
- const items = args[0];
347
+ const items = args["items"];
204
348
  let succeeded = 0;
205
349
  const index = client.Index(factoryIndex);
206
350
  for (let i = 0; i < items.length; i++) {
@@ -275,19 +419,23 @@ function createPineconeExtension(config) {
275
419
  throw rillError;
276
420
  }
277
421
  },
278
- description: "Batch insert/update vectors",
279
- returnType: "dict"
422
+ annotations: { description: "Batch insert/update vectors" },
423
+ returnType: rillTypeToTypeValue({ type: "dict", fields: { succeeded: { type: { type: "number" } }, failed: { type: { type: "string" } }, error: { type: { type: "string" } } } })
280
424
  },
281
425
  // IR-3: pinecone::search
282
426
  search: {
283
427
  params: [
284
- { name: "vector", type: "vector" },
285
- { name: "options", type: "dict", defaultValue: {} }
428
+ vectorParam("vector"),
429
+ p.dict("options", void 0, {}, {
430
+ k: { type: { type: "number" }, defaultValue: 10 },
431
+ filter: { type: { type: "dict" }, defaultValue: {} },
432
+ score_threshold: { type: { type: "number" }, defaultValue: 0 }
433
+ })
286
434
  ],
287
435
  fn: async (args, ctx) => {
288
436
  checkDisposed2();
289
- const vector = args[0];
290
- const options = args[1] ?? {};
437
+ const vector = args["vector"];
438
+ const options = args["options"] ?? {};
291
439
  const k = typeof options["k"] === "number" ? options["k"] : 10;
292
440
  const filter = options["filter"] ?? {};
293
441
  const scoreThreshold = typeof options["score_threshold"] === "number" ? options["score_threshold"] : void 0;
@@ -347,15 +495,15 @@ function createPineconeExtension(config) {
347
495
  throw rillError;
348
496
  }
349
497
  },
350
- description: "Search k nearest neighbors",
351
- returnType: "list"
498
+ annotations: { description: "Search k nearest neighbors" },
499
+ returnType: rillTypeToTypeValue({ type: "list", element: { type: "dict", fields: { id: { type: { type: "string" } }, score: { type: { type: "number" } }, metadata: { type: { type: "dict" } } } } })
352
500
  },
353
501
  // IR-4: pinecone::get
354
502
  get: {
355
- params: [{ name: "id", type: "string" }],
503
+ params: [p.str("id")],
356
504
  fn: async (args, ctx) => {
357
505
  checkDisposed2();
358
- const id = args[0];
506
+ const id = args["id"];
359
507
  return withEventEmission(
360
508
  ctx,
361
509
  "pinecone",
@@ -365,12 +513,12 @@ function createPineconeExtension(config) {
365
513
  const index = client.Index(factoryIndex);
366
514
  const response = await index.namespace(factoryNamespace).fetch({ ids: [id] });
367
515
  if (!response.records || response.records[id] === void 0) {
368
- throw new RuntimeError4("RILL-R004", "pinecone: id not found");
516
+ throw new RuntimeError6("RILL-R004", "pinecone: id not found");
369
517
  }
370
518
  const record = response.records[id];
371
519
  const vectorData = record.values;
372
520
  if (!vectorData || !Array.isArray(vectorData)) {
373
- throw new RuntimeError4(
521
+ throw new RuntimeError6(
374
522
  "RILL-R004",
375
523
  "pinecone: invalid vector format"
376
524
  );
@@ -385,15 +533,15 @@ function createPineconeExtension(config) {
385
533
  }
386
534
  );
387
535
  },
388
- description: "Fetch vector by ID",
389
- returnType: "dict"
536
+ annotations: { description: "Fetch vector by ID" },
537
+ returnType: rillTypeToTypeValue({ type: "dict", fields: { id: { type: { type: "string" } }, vector: { type: { type: "vector" } }, metadata: { type: { type: "dict" } } } })
390
538
  },
391
539
  // IR-5: pinecone::delete
392
540
  delete: {
393
- params: [{ name: "id", type: "string" }],
541
+ params: [p.str("id")],
394
542
  fn: async (args, ctx) => {
395
543
  checkDisposed2();
396
- const id = args[0];
544
+ const id = args["id"];
397
545
  return withEventEmission(
398
546
  ctx,
399
547
  "pinecone",
@@ -410,17 +558,17 @@ function createPineconeExtension(config) {
410
558
  }
411
559
  );
412
560
  },
413
- description: "Delete vector by ID",
414
- returnType: "dict"
561
+ annotations: { description: "Delete vector by ID" },
562
+ returnType: rillTypeToTypeValue({ type: "dict", fields: { id: { type: { type: "string" } }, deleted: { type: { type: "bool" } } } })
415
563
  },
416
564
  // IR-6: pinecone::delete_batch
417
565
  delete_batch: {
418
- params: [{ name: "ids", type: "list" }],
566
+ params: [p.list("ids")],
419
567
  fn: async (args, ctx) => {
420
568
  const startTime = Date.now();
421
569
  try {
422
570
  checkDisposed2();
423
- const ids = args[0];
571
+ const ids = args["ids"];
424
572
  let succeeded = 0;
425
573
  const index = client.Index(factoryIndex);
426
574
  for (let i = 0; i < ids.length; i++) {
@@ -467,8 +615,8 @@ function createPineconeExtension(config) {
467
615
  throw rillError;
468
616
  }
469
617
  },
470
- description: "Batch delete vectors",
471
- returnType: "dict"
618
+ annotations: { description: "Batch delete vectors" },
619
+ returnType: rillTypeToTypeValue({ type: "dict", fields: { succeeded: { type: { type: "number" } }, failed: { type: { type: "string" } }, error: { type: { type: "string" } } } })
472
620
  },
473
621
  // IR-7: pinecone::count
474
622
  count: {
@@ -488,23 +636,26 @@ function createPineconeExtension(config) {
488
636
  }
489
637
  );
490
638
  },
491
- description: "Return total vector count in collection",
492
- returnType: "number"
639
+ annotations: { description: "Return total vector count in collection" },
640
+ returnType: rillTypeToTypeValue({ type: "number" })
493
641
  },
494
642
  // IR-8: pinecone::create_collection
495
643
  create_collection: {
496
644
  params: [
497
- { name: "name", type: "string" },
498
- { name: "options", type: "dict", defaultValue: {} }
645
+ p.str("name"),
646
+ p.dict("options", void 0, {}, {
647
+ dimensions: { type: { type: "number" } },
648
+ distance: { type: { type: "string" }, defaultValue: "cosine" }
649
+ })
499
650
  ],
500
651
  fn: async (args, ctx) => {
501
652
  checkDisposed2();
502
- const name = args[0];
503
- const options = args[1] ?? {};
653
+ const name = args["name"];
654
+ const options = args["options"] ?? {};
504
655
  const dimensions = options["dimensions"];
505
656
  const distance = options["distance"] ?? "cosine";
506
657
  if (!dimensions || typeof dimensions !== "number" || dimensions <= 0) {
507
- throw new RuntimeError4(
658
+ throw new RuntimeError6(
508
659
  "RILL-R004",
509
660
  "pinecone: dimensions must be a positive integer"
510
661
  );
@@ -541,15 +692,15 @@ function createPineconeExtension(config) {
541
692
  }
542
693
  );
543
694
  },
544
- description: "Create new vector collection",
545
- returnType: "dict"
695
+ annotations: { description: "Create new vector collection" },
696
+ returnType: rillTypeToTypeValue({ type: "dict", fields: { name: { type: { type: "string" } }, created: { type: { type: "bool" } } } })
546
697
  },
547
698
  // IR-9: pinecone::delete_collection
548
699
  delete_collection: {
549
- params: [{ name: "name", type: "string" }],
700
+ params: [p.str("name")],
550
701
  fn: async (args, ctx) => {
551
702
  checkDisposed2();
552
- const name = args[0];
703
+ const name = args["name"];
553
704
  return withEventEmission(
554
705
  ctx,
555
706
  "pinecone",
@@ -564,8 +715,8 @@ function createPineconeExtension(config) {
564
715
  }
565
716
  );
566
717
  },
567
- description: "Delete vector collection",
568
- returnType: "dict"
718
+ annotations: { description: "Delete vector collection" },
719
+ returnType: rillTypeToTypeValue({ type: "dict", fields: { name: { type: { type: "string" } }, deleted: { type: { type: "bool" } } } })
569
720
  },
570
721
  // IR-10: pinecone::list_collections
571
722
  list_collections: {
@@ -584,8 +735,8 @@ function createPineconeExtension(config) {
584
735
  }
585
736
  );
586
737
  },
587
- description: "List all collection names",
588
- returnType: "list"
738
+ annotations: { description: "List all collection names" },
739
+ returnType: rillTypeToTypeValue({ type: "list", element: { type: "string" } })
589
740
  },
590
741
  // IR-11: pinecone::describe
591
742
  describe: {
@@ -621,8 +772,8 @@ function createPineconeExtension(config) {
621
772
  }
622
773
  );
623
774
  },
624
- description: "Describe configured collection",
625
- returnType: "dict"
775
+ annotations: { description: "Describe configured collection" },
776
+ returnType: rillTypeToTypeValue({ type: "dict", fields: { name: { type: { type: "string" } }, count: { type: { type: "number" } }, dimensions: { type: { type: "number" } }, distance: { type: { type: "string" } } } })
626
777
  }
627
778
  };
628
779
  result.dispose = dispose2;
@@ -630,15 +781,23 @@ function createPineconeExtension(config) {
630
781
  }
631
782
 
632
783
  // src/index.ts
633
- var VERSION = "0.0.1";
784
+ var _require = createRequire(import.meta.url);
785
+ var _pkg = _require("../package.json");
786
+ var VERSION = _pkg.version;
634
787
  var configSchema = {
635
788
  apiKey: { type: "string", required: true, secret: true },
636
789
  index: { type: "string", required: true },
637
790
  namespace: { type: "string" },
638
791
  timeout: { type: "number" }
639
792
  };
793
+ var extensionManifest = {
794
+ factory: createPineconeExtension,
795
+ configSchema,
796
+ version: VERSION
797
+ };
640
798
  export {
641
799
  VERSION,
642
800
  configSchema,
643
- createPineconeExtension
801
+ createPineconeExtension,
802
+ extensionManifest
644
803
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rcrsr/rill-ext-pinecone",
3
- "version": "0.9.0",
3
+ "version": "0.16.0",
4
4
  "description": "rill extension for Pinecone vector database integration",
5
5
  "license": "MIT",
6
6
  "author": "Andre Bremer",
@@ -17,10 +17,10 @@
17
17
  "scripting"
18
18
  ],
19
19
  "peerDependencies": {
20
- "@rcrsr/rill": "^0.9.0"
20
+ "@rcrsr/rill": "~0.16.0"
21
21
  },
22
22
  "devDependencies": {
23
- "@rcrsr/rill": "^0.9.0",
23
+ "@rcrsr/rill": "~0.16.0",
24
24
  "@types/node": "^25.3.0",
25
25
  "dts-bundle-generator": "^9.5.1",
26
26
  "tsup": "^8.5.1",
@@ -43,7 +43,8 @@
43
43
  "access": "public"
44
44
  },
45
45
  "dependencies": {
46
- "@pinecone-database/pinecone": "^7.1.0"
46
+ "@pinecone-database/pinecone": "^7.1.0",
47
+ "@rcrsr/rill-ext-param-shared": "^0.0.1"
47
48
  },
48
49
  "scripts": {
49
50
  "build": "tsup && dts-bundle-generator --config dts-bundle-generator.config.cjs",