@olane/o-node 0.7.12-alpha.1 → 0.7.12-alpha.4

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 ADDED
@@ -0,0 +1,34 @@
1
+ # Dual License: MIT OR Apache-2.0
2
+
3
+ Copyright (c) 2025 Olane Inc.
4
+
5
+ Olane OS is dual-licensed under your choice of either:
6
+
7
+ - **MIT License** (LICENSE-MIT or https://opensource.org/licenses/MIT)
8
+ - **Apache License, Version 2.0** (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
9
+
10
+ ## Why Dual Licensing?
11
+
12
+ Dual licensing provides developers with flexibility when integrating Olane OS into their projects:
13
+
14
+ - **Choose MIT**: If you prefer a simple, permissive license without patent provisions
15
+ - **Choose Apache 2.0**: If you desire explicit patent protection and other features of the Apache license
16
+
17
+ You may choose either license to govern your use of this software.
18
+
19
+ ## License Terms
20
+
21
+ ### MIT License
22
+ The MIT license is very permissive and allows users to do almost anything with the software, including using, copying, modifying, merging, publishing, distributing, and selling it. The primary requirement is that the original copyright and license notice must be included in all copies of the software.
23
+
24
+ See LICENSE-MIT for the full license text.
25
+
26
+ ### Apache License 2.0
27
+ The Apache License 2.0 is also a permissive free software license. It grants users the right to use, modify, and distribute the software. It also includes provisions regarding patent grants, which are not present in the MIT license.
28
+
29
+ See LICENSE-APACHE for the full license text.
30
+
31
+ ## Contributing
32
+
33
+ Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual-licensed as above, without any additional terms or conditions.
34
+
@@ -1 +1 @@
1
- {"version":3,"file":"o-node.search-resolver.d.ts","sourceRoot":"","sources":["../../../../src/router/resolvers/o-node.search-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,KAAK,EAEL,UAAU,EACV,cAAc,EAEd,aAAa,EAEd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,C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AAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CAoE/D"}
@@ -241,7 +241,12 @@ export class oSearchResolver extends oAddressResolver {
241
241
  .toString() // o://embeddings-text replace o://embeddings-text = ''
242
242
  .replace(address.toRootAddress().toString(), '');
243
243
  this.logger.debug('Extra params:', extraParams);
244
- const resolvedTargetAddress = new oAddress(selectedResult.address + extraParams);
244
+ // Check if selectedResult.address already contains the complete path
245
+ // This happens when registry finds via staticAddress - the returned address
246
+ // is the canonical hierarchical location, so we shouldn't append extraParams
247
+ const resultAddress = selectedResult.address;
248
+ const shouldAppendParams = extraParams && !resultAddress.endsWith(extraParams);
249
+ const resolvedTargetAddress = new oAddress(shouldAppendParams ? resultAddress + extraParams : resultAddress);
245
250
  // Set transports on the target address
246
251
  resolvedTargetAddress.setTransports(this.mapTransports(selectedResult));
247
252
  // Determine next hop and configure transports
@@ -515,6 +515,85 @@ describe('oSearchResolver', () => {
515
515
  }
516
516
  });
517
517
  });
518
+ describe('Address duplication bug fix', () => {
519
+ it('should NOT duplicate path segments when registry returns full hierarchical address', async () => {
520
+ // This test verifies the fix for the bug where o://services/embeddings-text
521
+ // was being resolved to o://leader/services/embeddings-text/services/embeddings-text
522
+ const address = new oNodeAddress('o://services/embeddings-text');
523
+ mockNode.use = async () => createResponse({
524
+ data: [
525
+ {
526
+ address: 'o://leader/services/embeddings-text',
527
+ staticAddress: 'o://embeddings-text',
528
+ transports: [
529
+ {
530
+ value: '/ip4/127.0.0.1/tcp/6001',
531
+ type: TransportType.LIBP2P,
532
+ },
533
+ ],
534
+ },
535
+ ],
536
+ });
537
+ const result = await resolver.resolve({
538
+ address,
539
+ targetAddress: address,
540
+ node: mockNode,
541
+ request: createRouterRequest(),
542
+ });
543
+ // Should be o://leader/services/embeddings-text, NOT o://leader/services/embeddings-text/embeddings-text
544
+ expect(result.targetAddress.value).to.equal('o://leader/services/embeddings-text');
545
+ });
546
+ it('should NOT duplicate when calling via static address', async () => {
547
+ const address = new oNodeAddress('o://embeddings-text');
548
+ mockNode.use = async () => createResponse({
549
+ data: [
550
+ {
551
+ address: 'o://leader/services/embeddings-text',
552
+ staticAddress: 'o://embeddings-text',
553
+ transports: [
554
+ {
555
+ value: '/ip4/127.0.0.1/tcp/6001',
556
+ type: TransportType.LIBP2P,
557
+ },
558
+ ],
559
+ },
560
+ ],
561
+ });
562
+ const result = await resolver.resolve({
563
+ address,
564
+ targetAddress: address,
565
+ node: mockNode,
566
+ request: createRouterRequest(),
567
+ });
568
+ expect(result.targetAddress.value).to.equal('o://leader/services/embeddings-text');
569
+ });
570
+ it('should still append legitimate extra params beyond the service name', async () => {
571
+ // If someone calls o://embeddings-text/custom/path, we should preserve /custom/path
572
+ const address = new oNodeAddress('o://embeddings-text/custom/path');
573
+ mockNode.use = async () => createResponse({
574
+ data: [
575
+ {
576
+ address: 'o://leader/services/embeddings-text',
577
+ staticAddress: 'o://embeddings-text',
578
+ transports: [
579
+ {
580
+ value: '/ip4/127.0.0.1/tcp/6001',
581
+ type: TransportType.LIBP2P,
582
+ },
583
+ ],
584
+ },
585
+ ],
586
+ });
587
+ const result = await resolver.resolve({
588
+ address,
589
+ targetAddress: address,
590
+ node: mockNode,
591
+ request: createRouterRequest(),
592
+ });
593
+ // Should append the extra /custom/path
594
+ expect(result.targetAddress.value).to.equal('o://leader/services/embeddings-text/custom/path');
595
+ });
596
+ });
518
597
  describe('Edge cases', () => {
519
598
  it('should handle address with long nested paths', async () => {
520
599
  const address = new oNodeAddress('o://leader/a/b/c/d/e/f');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olane/o-node",
3
- "version": "0.7.12-alpha.1",
3
+ "version": "0.7.12-alpha.4",
4
4
  "type": "module",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -54,11 +54,12 @@
54
54
  "typescript": "5.4.5"
55
55
  },
56
56
  "dependencies": {
57
- "@olane/o-config": "^0.7.11",
58
- "@olane/o-core": "^0.7.11",
59
- "@olane/o-protocol": "^0.7.11",
60
- "@olane/o-tool": "^0.7.11",
57
+ "@olane/o-config": "0.7.12-alpha.4",
58
+ "@olane/o-core": "0.7.12-alpha.4",
59
+ "@olane/o-protocol": "0.7.12-alpha.4",
60
+ "@olane/o-tool": "0.7.12-alpha.4",
61
61
  "debug": "^4.4.1",
62
62
  "dotenv": "^16.5.0"
63
- }
63
+ },
64
+ "gitHead": "13c575d61a455fce146303f4060c6628851a7223"
64
65
  }