@bytexbyte/nxtlinq-ai-agent-ui-react-development 0.3.3 → 0.3.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.
@@ -1 +1 @@
1
- {"version":3,"file":"ChatBotContext.d.ts","sourceRoot":"","sources":["../../src/context/ChatBotContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAyB/B,OAAO,EAEL,kBAAkB,EAClB,YAAY,EAEb,MAAM,uBAAuB,CAAC;AAM/B,eAAO,MAAM,UAAU,0BAMtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAwvGlD,CAAC"}
1
+ {"version":3,"file":"ChatBotContext.d.ts","sourceRoot":"","sources":["../../src/context/ChatBotContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAyB/B,OAAO,EAEL,kBAAkB,EAClB,YAAY,EAEb,MAAM,uBAAuB,CAAC;AAM/B,eAAO,MAAM,UAAU,0BAMtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA4vGlD,CAAC"}
@@ -2481,8 +2481,10 @@ piiDisplayMode = 'redacted', voiceThresholds, debugVoiceRms = false, sttGlossary
2481
2481
  if (isFromAIAgent && !aitRef.current) {
2482
2482
  throw new Error('You must have an existing AIT before AI Agent can create new AITs');
2483
2483
  }
2484
- const timestamp = Math.floor(Date.now() / 1000);
2485
- const aitId = `did:polygon:nxtlinq:${currentAddress}:${timestamp}`;
2484
+ // aitId is assigned by AIT-Service (UUIDv7) and returned in the response. It must not be
2485
+ // minted here: the client cannot guarantee uniqueness, and this value feeds parentAITId, which
2486
+ // is part of the on-chain commitment -- a locally invented id would anchor a parent that does
2487
+ // not exist.
2486
2488
  const metadata = {
2487
2489
  permissions: newPermissions || permissions,
2488
2490
  issuedBy: currentAddress,
@@ -2490,17 +2492,14 @@ piiDisplayMode = 'redacted', voiceThresholds, debugVoiceRms = false, sttGlossary
2490
2492
  const metadataStr = stringify(metadata);
2491
2493
  // ethers v6: utils.keccak256 -> keccak256, utils.toUtf8Bytes -> toUtf8Bytes
2492
2494
  const metadataHash = ethers.keccak256(ethers.toUtf8Bytes(metadataStr));
2493
- const uploadResponse = await nxtlinqApi.metadata.createMetadata(metadata, nxtlinqAITServiceAccessToken || '');
2494
- if ('error' in uploadResponse) {
2495
- throw new Error(`Failed to upload metadata: ${uploadResponse.error}`);
2496
- }
2497
- const { metadataCid } = uploadResponse;
2495
+ // AIT-Service no longer publishes metadata to IPFS: the registry is hash-only, integrity comes
2496
+ // from the on-chain commitment, and /api/metadata has been removed. `permissions` now travels
2497
+ // in the request body instead of being recovered from a CID, so nothing is uploaded here.
2498
2498
  const createAITParams = {
2499
- aitId,
2500
2499
  controller: currentAddress,
2501
2500
  serviceId,
2501
+ permissions: metadata.permissions,
2502
2502
  metadataHash,
2503
- metadataCid,
2504
2503
  isFromAIAgent: isFromAIAgent,
2505
2504
  parentAITId: isFromAIAgent ? aitRef.current?.aitId : undefined,
2506
2505
  };
@@ -2508,12 +2507,17 @@ piiDisplayMode = 'redacted', voiceThresholds, debugVoiceRms = false, sttGlossary
2508
2507
  if ('error' in createAITResponse) {
2509
2508
  throw new Error(`Failed to create AIT: ${createAITResponse.error}`);
2510
2509
  }
2510
+ const aitId = createAITResponse.aitId;
2511
+ if (!aitId) {
2512
+ // Surfaced rather than substituted: this id becomes parentAITId on agent-created AITs, and
2513
+ // parentAITId is committed on chain. Guessing one would anchor a dangling parent link.
2514
+ throw new Error('AIT-Service did not return an aitId; refusing to invent one.');
2515
+ }
2511
2516
  const aitInfo = {
2512
2517
  aitId,
2513
2518
  controller: currentAddress,
2514
2519
  metadata,
2515
2520
  metadataHash,
2516
- metadataCid,
2517
2521
  };
2518
2522
  setAit(aitInfo);
2519
2523
  setPermissions(newPermissions || permissions);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytexbyte/nxtlinq-ai-agent-ui-react-development",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Official React Web UI for nxtlinq AI Agent — drop-in chat widget",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@bytexbyte/nxtlinq-ai-agent-core-development": "0.5.0",
42
- "@bytexbyte/nxtlinq-ai-agent-web-development": "0.3.1",
42
+ "@bytexbyte/nxtlinq-ai-agent-web-development": "0.3.2",
43
43
  "@emotion/react": "^11.14.0",
44
44
  "@emotion/styled": "^11.14.1",
45
45
  "@mui/icons-material": "^7.2.0",
@@ -2767,8 +2767,10 @@ export const ChatBotProvider: React.FC<ChatBotProps> = ({
2767
2767
  throw new Error('You must have an existing AIT before AI Agent can create new AITs');
2768
2768
  }
2769
2769
 
2770
- const timestamp = Math.floor(Date.now() / 1000);
2771
- const aitId = `did:polygon:nxtlinq:${currentAddress}:${timestamp}`;
2770
+ // aitId is assigned by AIT-Service (UUIDv7) and returned in the response. It must not be
2771
+ // minted here: the client cannot guarantee uniqueness, and this value feeds parentAITId, which
2772
+ // is part of the on-chain commitment -- a locally invented id would anchor a parent that does
2773
+ // not exist.
2772
2774
 
2773
2775
  const metadata = {
2774
2776
  permissions: newPermissions || permissions,
@@ -2779,19 +2781,15 @@ export const ChatBotProvider: React.FC<ChatBotProps> = ({
2779
2781
  // ethers v6: utils.keccak256 -> keccak256, utils.toUtf8Bytes -> toUtf8Bytes
2780
2782
  const metadataHash = ethers.keccak256(ethers.toUtf8Bytes(metadataStr));
2781
2783
 
2782
- const uploadResponse = await nxtlinqApi.metadata.createMetadata(metadata, nxtlinqAITServiceAccessToken || '');
2783
- if ('error' in uploadResponse) {
2784
- throw new Error(`Failed to upload metadata: ${uploadResponse.error}`);
2785
- }
2786
-
2787
- const { metadataCid } = uploadResponse;
2784
+ // AIT-Service no longer publishes metadata to IPFS: the registry is hash-only, integrity comes
2785
+ // from the on-chain commitment, and /api/metadata has been removed. `permissions` now travels
2786
+ // in the request body instead of being recovered from a CID, so nothing is uploaded here.
2788
2787
 
2789
2788
  const createAITParams = {
2790
- aitId,
2791
2789
  controller: currentAddress,
2792
2790
  serviceId,
2791
+ permissions: metadata.permissions,
2793
2792
  metadataHash,
2794
- metadataCid,
2795
2793
  isFromAIAgent: isFromAIAgent,
2796
2794
  parentAITId: isFromAIAgent ? aitRef.current?.aitId : undefined,
2797
2795
  };
@@ -2802,12 +2800,18 @@ export const ChatBotProvider: React.FC<ChatBotProps> = ({
2802
2800
  throw new Error(`Failed to create AIT: ${createAITResponse.error}`);
2803
2801
  }
2804
2802
 
2803
+ const aitId = (createAITResponse as { aitId?: string }).aitId;
2804
+ if (!aitId) {
2805
+ // Surfaced rather than substituted: this id becomes parentAITId on agent-created AITs, and
2806
+ // parentAITId is committed on chain. Guessing one would anchor a dangling parent link.
2807
+ throw new Error('AIT-Service did not return an aitId; refusing to invent one.');
2808
+ }
2809
+
2805
2810
  const aitInfo = {
2806
2811
  aitId,
2807
2812
  controller: currentAddress,
2808
2813
  metadata,
2809
2814
  metadataHash,
2810
- metadataCid,
2811
2815
  };
2812
2816
 
2813
2817
  setAit(aitInfo);