@hashgraphonline/standards-sdk 0.1.180 → 0.1.181

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.
Files changed (132) hide show
  1. package/dist/browser/services/registry-broker/client/base-client.d.ts +3 -0
  2. package/dist/browser/services/registry-broker/client/base-client.d.ts.map +1 -1
  3. package/dist/browser/services/registry-broker/client/guard.d.ts.map +1 -1
  4. package/dist/browser/services/registry-broker/types.d.ts +3 -0
  5. package/dist/browser/services/registry-broker/types.d.ts.map +1 -1
  6. package/dist/browser-root/services/registry-broker/client/base-client.d.ts +3 -0
  7. package/dist/browser-root/services/registry-broker/client/base-client.d.ts.map +1 -1
  8. package/dist/browser-root/services/registry-broker/client/guard.d.ts.map +1 -1
  9. package/dist/browser-root/services/registry-broker/types.d.ts +3 -0
  10. package/dist/browser-root/services/registry-broker/types.d.ts.map +1 -1
  11. package/dist/browser-root/standards-sdk.root-browser.js +340 -104
  12. package/dist/browser-root/standards-sdk.root-browser.js.map +1 -1
  13. package/dist/cjs/services/registry-broker/client/base-client.d.ts +3 -0
  14. package/dist/cjs/services/registry-broker/client/base-client.d.ts.map +1 -1
  15. package/dist/cjs/services/registry-broker/client/guard.d.ts.map +1 -1
  16. package/dist/cjs/services/registry-broker/types.d.ts +3 -0
  17. package/dist/cjs/services/registry-broker/types.d.ts.map +1 -1
  18. package/dist/cjs/standards-sdk.cjs +1 -1
  19. package/dist/cjs/standards-sdk.cjs.map +1 -1
  20. package/dist/es/services/registry-broker/client/base-client.d.ts +3 -0
  21. package/dist/es/services/registry-broker/client/base-client.d.ts.map +1 -1
  22. package/dist/es/services/registry-broker/client/guard.d.ts.map +1 -1
  23. package/dist/es/services/registry-broker/types.d.ts +3 -0
  24. package/dist/es/services/registry-broker/types.d.ts.map +1 -1
  25. package/dist/es/standards-sdk.es.js +10 -7
  26. package/dist/es/standards-sdk.es.js.map +1 -1
  27. package/dist/es/standards-sdk.es104.js +1 -1
  28. package/dist/es/standards-sdk.es106.js +1 -1
  29. package/dist/es/standards-sdk.es108.js +1 -1
  30. package/dist/es/standards-sdk.es11.js +1 -1
  31. package/dist/es/standards-sdk.es110.js +1 -1
  32. package/dist/es/standards-sdk.es116.js +1 -1
  33. package/dist/es/standards-sdk.es12.js +1 -1
  34. package/dist/es/standards-sdk.es121.js +1 -1
  35. package/dist/es/standards-sdk.es127.js +2 -2
  36. package/dist/es/standards-sdk.es142.js +1 -1
  37. package/dist/es/standards-sdk.es145.js +43 -14
  38. package/dist/es/standards-sdk.es145.js.map +1 -1
  39. package/dist/es/standards-sdk.es147.js +3 -3
  40. package/dist/es/standards-sdk.es148.js +4 -81
  41. package/dist/es/standards-sdk.es148.js.map +1 -1
  42. package/dist/es/standards-sdk.es149.js +71 -77
  43. package/dist/es/standards-sdk.es149.js.map +1 -1
  44. package/dist/es/standards-sdk.es150.js +80 -53
  45. package/dist/es/standards-sdk.es150.js.map +1 -1
  46. package/dist/es/standards-sdk.es151.js +53 -152
  47. package/dist/es/standards-sdk.es151.js.map +1 -1
  48. package/dist/es/standards-sdk.es152.js +159 -7
  49. package/dist/es/standards-sdk.es152.js.map +1 -1
  50. package/dist/es/standards-sdk.es153.js +7 -86
  51. package/dist/es/standards-sdk.es153.js.map +1 -1
  52. package/dist/es/standards-sdk.es154.js +64 -43
  53. package/dist/es/standards-sdk.es154.js.map +1 -1
  54. package/dist/es/standards-sdk.es155.js +65 -30
  55. package/dist/es/standards-sdk.es155.js.map +1 -1
  56. package/dist/es/standards-sdk.es156.js +30 -34
  57. package/dist/es/standards-sdk.es156.js.map +1 -1
  58. package/dist/es/standards-sdk.es157.js +34 -48
  59. package/dist/es/standards-sdk.es157.js.map +1 -1
  60. package/dist/es/standards-sdk.es158.js +48 -138
  61. package/dist/es/standards-sdk.es158.js.map +1 -1
  62. package/dist/es/standards-sdk.es159.js +133 -37
  63. package/dist/es/standards-sdk.es159.js.map +1 -1
  64. package/dist/es/standards-sdk.es16.js +2 -2
  65. package/dist/es/standards-sdk.es160.js +42 -2352
  66. package/dist/es/standards-sdk.es160.js.map +1 -1
  67. package/dist/es/standards-sdk.es162.js +2352 -672
  68. package/dist/es/standards-sdk.es162.js.map +1 -1
  69. package/dist/es/standards-sdk.es163.js +15 -54
  70. package/dist/es/standards-sdk.es163.js.map +1 -1
  71. package/dist/es/standards-sdk.es165.js +63 -71
  72. package/dist/es/standards-sdk.es165.js.map +1 -1
  73. package/dist/es/standards-sdk.es166.js +48 -192
  74. package/dist/es/standards-sdk.es166.js.map +1 -1
  75. package/dist/es/standards-sdk.es167.js +79 -15
  76. package/dist/es/standards-sdk.es167.js.map +1 -1
  77. package/dist/es/standards-sdk.es168.js +181 -54
  78. package/dist/es/standards-sdk.es168.js.map +1 -1
  79. package/dist/es/standards-sdk.es175.js +653 -120
  80. package/dist/es/standards-sdk.es175.js.map +1 -1
  81. package/dist/es/standards-sdk.es176.js +111 -303
  82. package/dist/es/standards-sdk.es176.js.map +1 -1
  83. package/dist/es/standards-sdk.es177.js +297 -225
  84. package/dist/es/standards-sdk.es177.js.map +1 -1
  85. package/dist/es/standards-sdk.es178.js +239 -176
  86. package/dist/es/standards-sdk.es178.js.map +1 -1
  87. package/dist/es/standards-sdk.es179.js +178 -101
  88. package/dist/es/standards-sdk.es179.js.map +1 -1
  89. package/dist/es/standards-sdk.es18.js +4 -4
  90. package/dist/es/standards-sdk.es180.js +75 -108
  91. package/dist/es/standards-sdk.es180.js.map +1 -1
  92. package/dist/es/standards-sdk.es181.js +116 -148
  93. package/dist/es/standards-sdk.es181.js.map +1 -1
  94. package/dist/es/standards-sdk.es182.js +143 -439
  95. package/dist/es/standards-sdk.es182.js.map +1 -1
  96. package/dist/es/standards-sdk.es183.js +661 -162
  97. package/dist/es/standards-sdk.es183.js.map +1 -1
  98. package/dist/es/standards-sdk.es184.js +156 -206
  99. package/dist/es/standards-sdk.es184.js.map +1 -1
  100. package/dist/es/standards-sdk.es185.js +219 -223
  101. package/dist/es/standards-sdk.es185.js.map +1 -1
  102. package/dist/es/standards-sdk.es186.js +242 -0
  103. package/dist/es/standards-sdk.es186.js.map +1 -0
  104. package/dist/es/standards-sdk.es19.js +2 -2
  105. package/dist/es/standards-sdk.es22.js +1 -1
  106. package/dist/es/standards-sdk.es27.js +4 -4
  107. package/dist/es/standards-sdk.es35.js +2 -2
  108. package/dist/es/standards-sdk.es36.js +2 -2
  109. package/dist/es/standards-sdk.es4.js +1 -1
  110. package/dist/es/standards-sdk.es53.js +1 -1
  111. package/dist/es/standards-sdk.es56.js +1 -1
  112. package/dist/es/standards-sdk.es59.js +1 -1
  113. package/dist/es/standards-sdk.es62.js +1 -1
  114. package/dist/es/standards-sdk.es63.js +2 -2
  115. package/dist/es/standards-sdk.es64.js +1 -1
  116. package/dist/es/standards-sdk.es65.js +1 -1
  117. package/dist/es/standards-sdk.es67.js +3 -3
  118. package/dist/es/standards-sdk.es7.js +1 -1
  119. package/dist/es/standards-sdk.es71.js +1 -1
  120. package/dist/es/standards-sdk.es72.js +2 -2
  121. package/dist/es/standards-sdk.es75.js +2 -2
  122. package/dist/es/standards-sdk.es76.js +1 -1
  123. package/dist/es/standards-sdk.es78.js +1 -1
  124. package/dist/es/standards-sdk.es83.js +1 -1
  125. package/dist/es/standards-sdk.es84.js +2 -2
  126. package/dist/es/standards-sdk.es85.js +1 -1
  127. package/dist/es/standards-sdk.es88.js +1 -1
  128. package/dist/es/standards-sdk.es90.js +1 -1
  129. package/dist/es/standards-sdk.es94.js +3 -3
  130. package/dist/es/standards-sdk.es98.js +1 -1
  131. package/dist/es/standards-sdk.es99.js +1 -1
  132. package/package.json +1 -1
@@ -10127,10 +10127,98 @@ async function registerOwnedMoltbookAgent(client, uaid, request) {
10127
10127
  "moltbook owner registration update response"
10128
10128
  );
10129
10129
  }
10130
+ function isStatusError(error) {
10131
+ if (error instanceof RegistryBrokerError) {
10132
+ return true;
10133
+ }
10134
+ if (typeof error !== "object" || error === null || !("status" in error)) {
10135
+ return false;
10136
+ }
10137
+ return typeof Reflect.get(error, "status") === "number";
10138
+ }
10139
+ function toPortalCanonicalGuardPath(path) {
10140
+ const segments = path.split("/");
10141
+ const findPatternStart = (size2, matcher) => {
10142
+ for (let startIndex = segments.length - size2; startIndex >= 0; startIndex -= 1) {
10143
+ if (matcher(startIndex)) {
10144
+ return startIndex;
10145
+ }
10146
+ }
10147
+ return -1;
10148
+ };
10149
+ const replaceAt = (startIndex, consumed) => [
10150
+ ...segments.slice(0, startIndex),
10151
+ "api",
10152
+ "guard",
10153
+ ...segments.slice(startIndex + consumed)
10154
+ ].join("/");
10155
+ const registryStart = findPatternStart(
10156
+ 4,
10157
+ (startIndex) => segments[startIndex] === "registry" && segments[startIndex + 1] === "api" && /^v\d+$/.test(segments[startIndex + 2] ?? "") && segments[startIndex + 3] === "guard"
10158
+ );
10159
+ if (registryStart >= 0) {
10160
+ return replaceAt(registryStart, 4);
10161
+ }
10162
+ const apiVersionStart = findPatternStart(
10163
+ 3,
10164
+ (startIndex) => segments[startIndex] === "api" && /^v\d+$/.test(segments[startIndex + 1] ?? "") && segments[startIndex + 2] === "guard"
10165
+ );
10166
+ if (apiVersionStart >= 0) {
10167
+ return replaceAt(apiVersionStart, 3);
10168
+ }
10169
+ for (let index2 = segments.length - 1; index2 >= 0; index2 -= 1) {
10170
+ if (segments[index2] === "guard" && segments[index2 - 1] !== "api") {
10171
+ return [
10172
+ ...segments.slice(0, index2),
10173
+ "api",
10174
+ "guard",
10175
+ ...segments.slice(index2 + 1)
10176
+ ].join("/");
10177
+ }
10178
+ }
10179
+ return path;
10180
+ }
10181
+ function buildPortalCanonicalGuardUrl(baseUrl, path) {
10182
+ const target = new URL(path, "https://guard.local");
10183
+ const normalizedBasePath = (() => {
10184
+ try {
10185
+ const base = new URL(baseUrl);
10186
+ return base.pathname.replace(/\/+$/, "");
10187
+ } catch {
10188
+ return baseUrl.replace(/\/+$/, "");
10189
+ }
10190
+ })();
10191
+ const requestedPath = `${normalizedBasePath}${target.pathname}`;
10192
+ const canonicalPath = toPortalCanonicalGuardPath(requestedPath);
10193
+ const canonicalRelativePath = `${canonicalPath}${target.search}`;
10194
+ try {
10195
+ const base = new URL(baseUrl);
10196
+ return `${base.origin}${canonicalRelativePath}`;
10197
+ } catch {
10198
+ return canonicalRelativePath;
10199
+ }
10200
+ }
10201
+ async function requestPortalFirstJson(client, path, init) {
10202
+ try {
10203
+ return await client.requestJson(path, init);
10204
+ } catch (error) {
10205
+ if (isStatusError(error) && (error.status === 404 || error.status === 501)) {
10206
+ return client.requestAbsoluteJson(
10207
+ buildPortalCanonicalGuardUrl(client.baseUrl, path),
10208
+ init
10209
+ );
10210
+ }
10211
+ throw error;
10212
+ }
10213
+ }
10130
10214
  async function getGuardSession(client) {
10131
- const raw = await client.requestJson("/guard/auth/session", {
10132
- method: "GET"
10133
- });
10215
+ const raw = await requestPortalFirstJson(
10216
+ client,
10217
+ "/guard/auth/session",
10218
+ {
10219
+ method: "GET"
10220
+ }
10221
+ );
10134
10222
  return client.parseWithSchema(
10135
10223
  raw,
10136
10224
  guardSessionResponseSchema,
@@ -10138,9 +10226,13 @@ async function getGuardSession(client) {
10138
10226
  );
10139
10227
  }
10140
10228
  async function getGuardEntitlements(client) {
10141
- const raw = await client.requestJson("/guard/entitlements", {
10142
- method: "GET"
10143
- });
10229
+ const raw = await requestPortalFirstJson(
10230
+ client,
10231
+ "/guard/entitlements",
10232
+ {
10233
+ method: "GET"
10234
+ }
10235
+ );
10144
10236
  return client.parseWithSchema(
10145
10237
  raw,
10146
10238
  guardSessionResponseSchema,
@@ -10148,9 +10240,13 @@ async function getGuardEntitlements(client) {
10148
10240
  );
10149
10241
  }
10150
10242
  async function getGuardBillingBalance(client) {
10151
- const raw = await client.requestJson("/guard/billing/balance", {
10152
- method: "GET"
10153
- });
10243
+ const raw = await requestPortalFirstJson(
10244
+ client,
10245
+ "/guard/billing/balance",
10246
+ {
10247
+ method: "GET"
10248
+ }
10249
+ );
10154
10250
  return client.parseWithSchema(
10155
10251
  raw,
10156
10252
  guardBalanceResponseSchema,
@@ -10164,9 +10260,13 @@ async function getGuardFeed(client, limit) {
10164
10260
  }
10165
10261
  const query = params.toString();
10166
10262
  const suffix = query ? `?${query}` : "";
10167
- const raw = await client.requestJson(`/guard/feed${suffix}`, {
10168
- method: "GET"
10169
- });
10263
+ const raw = await requestPortalFirstJson(
10264
+ client,
10265
+ `/guard/feed${suffix}`,
10266
+ {
10267
+ method: "GET"
10268
+ }
10269
+ );
10170
10270
  return client.parseWithSchema(
10171
10271
  raw,
10172
10272
  guardFeedResponseSchema,
@@ -10174,9 +10274,13 @@ async function getGuardFeed(client, limit) {
10174
10274
  );
10175
10275
  }
10176
10276
  async function getGuardOverview(client) {
10177
- const raw = await client.requestJson("/guard/overview", {
10178
- method: "GET"
10179
- });
10277
+ const raw = await requestPortalFirstJson(
10278
+ client,
10279
+ "/guard/overview",
10280
+ {
10281
+ method: "GET"
10282
+ }
10283
+ );
10180
10284
  return client.parseWithSchema(
10181
10285
  raw,
10182
10286
  guardOverviewResponseSchema,
@@ -10188,7 +10292,8 @@ async function getGuardTrustByHash(client, sha2562) {
10188
10292
  if (!normalizedHash) {
10189
10293
  throw new Error("sha256 is required");
10190
10294
  }
10191
- const raw = await client.requestJson(
10295
+ const raw = await requestPortalFirstJson(
10296
+ client,
10192
10297
  `/guard/trust/by-hash/${encodeURIComponent(normalizedHash)}`,
10193
10298
  { method: "GET" }
10194
10299
  );
@@ -10210,7 +10315,8 @@ async function resolveGuardTrust(client, query) {
10210
10315
  params.set("version", query.version.trim());
10211
10316
  }
10212
10317
  const suffix = params.size > 0 ? `?${params.toString()}` : "";
10213
- const raw = await client.requestJson(
10318
+ const raw = await requestPortalFirstJson(
10319
+ client,
10214
10320
  `/guard/trust/resolve${suffix}`,
10215
10321
  { method: "GET" }
10216
10322
  );
@@ -10221,9 +10327,13 @@ async function resolveGuardTrust(client, query) {
10221
10327
  );
10222
10328
  }
10223
10329
  async function getGuardRevocations(client) {
10224
- const raw = await client.requestJson("/guard/revocations", {
10225
- method: "GET"
10226
- });
10330
+ const raw = await requestPortalFirstJson(
10331
+ client,
10332
+ "/guard/revocations",
10333
+ {
10334
+ method: "GET"
10335
+ }
10336
+ );
10227
10337
  return client.parseWithSchema(
10228
10338
  raw,
10229
10339
  guardRevocationResponseSchema,
@@ -10231,9 +10341,13 @@ async function getGuardRevocations(client) {
10231
10341
  );
10232
10342
  }
10233
10343
  async function fetchGuardAdvisories(client) {
10234
- const raw = await client.requestJson("/guard/advisories", {
10235
- method: "GET"
10236
- });
10344
+ const raw = await requestPortalFirstJson(
10345
+ client,
10346
+ "/guard/advisories",
10347
+ {
10348
+ method: "GET"
10349
+ }
10350
+ );
10237
10351
  return client.parseWithSchema(
10238
10352
  raw,
10239
10353
  guardRevocationResponseSchema,
@@ -10241,9 +10355,13 @@ async function fetchGuardAdvisories(client) {
10241
10355
  );
10242
10356
  }
10243
10357
  async function fetchGuardPolicy(client) {
10244
- const raw = await client.requestJson("/guard/policy/fetch", {
10245
- method: "GET"
10246
- });
10358
+ const raw = await requestPortalFirstJson(
10359
+ client,
10360
+ "/guard/policy/fetch",
10361
+ {
10362
+ method: "GET"
10363
+ }
10364
+ );
10247
10365
  return client.parseWithSchema(
10248
10366
  raw,
10249
10367
  guardPolicySchema,
@@ -10251,9 +10369,13 @@ async function fetchGuardPolicy(client) {
10251
10369
  );
10252
10370
  }
10253
10371
  async function getGuardInventory(client) {
10254
- const raw = await client.requestJson("/guard/inventory", {
10255
- method: "GET"
10256
- });
10372
+ const raw = await requestPortalFirstJson(
10373
+ client,
10374
+ "/guard/inventory",
10375
+ {
10376
+ method: "GET"
10377
+ }
10378
+ );
10257
10379
  return client.parseWithSchema(
10258
10380
  raw,
10259
10381
  guardInventoryResponseSchema,
@@ -10261,9 +10383,13 @@ async function getGuardInventory(client) {
10261
10383
  );
10262
10384
  }
10263
10385
  async function getGuardReceiptHistory(client) {
10264
- const raw = await client.requestJson("/guard/history", {
10265
- method: "GET"
10266
- });
10386
+ const raw = await requestPortalFirstJson(
10387
+ client,
10388
+ "/guard/history",
10389
+ {
10390
+ method: "GET"
10391
+ }
10392
+ );
10267
10393
  return client.parseWithSchema(
10268
10394
  raw,
10269
10395
  guardReceiptHistoryResponseSchema,
@@ -10275,7 +10401,8 @@ async function getGuardArtifactTimeline(client, artifactId) {
10275
10401
  if (!normalizedArtifactId) {
10276
10402
  throw new Error("artifactId is required");
10277
10403
  }
10278
- const raw = await client.requestJson(
10404
+ const raw = await requestPortalFirstJson(
10405
+ client,
10279
10406
  `/guard/history/${encodeURIComponent(normalizedArtifactId)}`,
10280
10407
  { method: "GET" }
10281
10408
  );
@@ -10286,7 +10413,7 @@ async function getGuardArtifactTimeline(client, artifactId) {
10286
10413
  );
10287
10414
  }
10288
10415
  async function exportGuardAbom(client) {
10289
- const raw = await client.requestJson("/guard/abom", {
10416
+ const raw = await requestPortalFirstJson(client, "/guard/abom", {
10290
10417
  method: "GET"
10291
10418
  });
10292
10419
  return client.parseWithSchema(
@@ -10300,7 +10427,8 @@ async function exportGuardArtifactAbom(client, artifactId) {
10300
10427
  if (!normalizedArtifactId) {
10301
10428
  throw new Error("artifactId is required");
10302
10429
  }
10303
- const raw = await client.requestJson(
10430
+ const raw = await requestPortalFirstJson(
10431
+ client,
10304
10432
  `/guard/abom/${encodeURIComponent(normalizedArtifactId)}`,
10305
10433
  { method: "GET" }
10306
10434
  );
@@ -10311,9 +10439,13 @@ async function exportGuardArtifactAbom(client, artifactId) {
10311
10439
  );
10312
10440
  }
10313
10441
  async function exportGuardReceipts(client) {
10314
- const raw = await client.requestJson("/guard/receipts/export", {
10315
- method: "GET"
10316
- });
10442
+ const raw = await requestPortalFirstJson(
10443
+ client,
10444
+ "/guard/receipts/export",
10445
+ {
10446
+ method: "GET"
10447
+ }
10448
+ );
10317
10449
  return client.parseWithSchema(
10318
10450
  raw,
10319
10451
  guardReceiptExportResponseSchema,
@@ -10321,9 +10453,13 @@ async function exportGuardReceipts(client) {
10321
10453
  );
10322
10454
  }
10323
10455
  async function getGuardInventoryDiff(client) {
10324
- const raw = await client.requestJson("/guard/inventory/diff", {
10325
- method: "GET"
10326
- });
10456
+ const raw = await requestPortalFirstJson(
10457
+ client,
10458
+ "/guard/inventory/diff",
10459
+ {
10460
+ method: "GET"
10461
+ }
10462
+ );
10327
10463
  return client.parseWithSchema(
10328
10464
  raw,
10329
10465
  guardInventoryDiffResponseSchema,
@@ -10331,9 +10467,13 @@ async function getGuardInventoryDiff(client) {
10331
10467
  );
10332
10468
  }
10333
10469
  async function getGuardDevices(client) {
10334
- const raw = await client.requestJson("/guard/devices", {
10335
- method: "GET"
10336
- });
10470
+ const raw = await requestPortalFirstJson(
10471
+ client,
10472
+ "/guard/devices",
10473
+ {
10474
+ method: "GET"
10475
+ }
10476
+ );
10337
10477
  return client.parseWithSchema(
10338
10478
  raw,
10339
10479
  guardDeviceListResponseSchema,
@@ -10341,9 +10481,13 @@ async function getGuardDevices(client) {
10341
10481
  );
10342
10482
  }
10343
10483
  async function getGuardAlertPreferences(client) {
10344
- const raw = await client.requestJson("/guard/alerts/preferences", {
10345
- method: "GET"
10346
- });
10484
+ const raw = await requestPortalFirstJson(
10485
+ client,
10486
+ "/guard/alerts/preferences",
10487
+ {
10488
+ method: "GET"
10489
+ }
10490
+ );
10347
10491
  return client.parseWithSchema(
10348
10492
  raw,
10349
10493
  guardAlertPreferencesSchema,
@@ -10351,10 +10495,14 @@ async function getGuardAlertPreferences(client) {
10351
10495
  );
10352
10496
  }
10353
10497
  async function updateGuardAlertPreferences(client, payload) {
10354
- const raw = await client.requestJson("/guard/alerts/preferences", {
10355
- method: "PUT",
10356
- body: payload
10357
- });
10498
+ const raw = await requestPortalFirstJson(
10499
+ client,
10500
+ "/guard/alerts/preferences",
10501
+ {
10502
+ method: "PUT",
10503
+ body: payload
10504
+ }
10505
+ );
10358
10506
  return client.parseWithSchema(
10359
10507
  raw,
10360
10508
  guardAlertPreferencesSchema,
@@ -10362,9 +10510,13 @@ async function updateGuardAlertPreferences(client, payload) {
10362
10510
  );
10363
10511
  }
10364
10512
  async function getGuardExceptions(client) {
10365
- const raw = await client.requestJson("/guard/exceptions", {
10366
- method: "GET"
10367
- });
10513
+ const raw = await requestPortalFirstJson(
10514
+ client,
10515
+ "/guard/exceptions",
10516
+ {
10517
+ method: "GET"
10518
+ }
10519
+ );
10368
10520
  return client.parseWithSchema(
10369
10521
  raw,
10370
10522
  guardExceptionListResponseSchema,
@@ -10372,9 +10524,13 @@ async function getGuardExceptions(client) {
10372
10524
  );
10373
10525
  }
10374
10526
  async function getGuardWatchlist(client) {
10375
- const raw = await client.requestJson("/guard/watchlist", {
10376
- method: "GET"
10377
- });
10527
+ const raw = await requestPortalFirstJson(
10528
+ client,
10529
+ "/guard/watchlist",
10530
+ {
10531
+ method: "GET"
10532
+ }
10533
+ );
10378
10534
  return client.parseWithSchema(
10379
10535
  raw,
10380
10536
  guardWatchlistResponseSchema,
@@ -10382,10 +10538,14 @@ async function getGuardWatchlist(client) {
10382
10538
  );
10383
10539
  }
10384
10540
  async function lookupGuardWatchlist(client, payload) {
10385
- const raw = await client.requestJson("/guard/watchlist/lookup", {
10386
- method: "POST",
10387
- body: payload
10388
- });
10541
+ const raw = await requestPortalFirstJson(
10542
+ client,
10543
+ "/guard/watchlist/lookup",
10544
+ {
10545
+ method: "POST",
10546
+ body: payload
10547
+ }
10548
+ );
10389
10549
  return client.parseWithSchema(
10390
10550
  raw,
10391
10551
  guardWatchlistLookupResponseSchema,
@@ -10393,9 +10553,13 @@ async function lookupGuardWatchlist(client, payload) {
10393
10553
  );
10394
10554
  }
10395
10555
  async function getGuardPainSignals(client) {
10396
- const raw = await client.requestJson("/guard/signals/pain", {
10397
- method: "GET"
10398
- });
10556
+ const raw = await requestPortalFirstJson(
10557
+ client,
10558
+ "/guard/signals/pain",
10559
+ {
10560
+ method: "GET"
10561
+ }
10562
+ );
10399
10563
  return client.parseWithSchema(
10400
10564
  raw,
10401
10565
  guardPainSignalListResponseSchema,
@@ -10403,7 +10567,8 @@ async function getGuardPainSignals(client) {
10403
10567
  );
10404
10568
  }
10405
10569
  async function getGuardAggregatedPainSignals(client) {
10406
- const raw = await client.requestJson(
10570
+ const raw = await requestPortalFirstJson(
10571
+ client,
10407
10572
  "/guard/signals/pain/aggregate",
10408
10573
  {
10409
10574
  method: "GET"
@@ -10416,7 +10581,7 @@ async function getGuardAggregatedPainSignals(client) {
10416
10581
  );
10417
10582
  }
10418
10583
  async function getGuardPreflightVerdict(client, path, payload) {
10419
- const raw = await client.requestJson(path, {
10584
+ const raw = await requestPortalFirstJson(client, path, {
10420
10585
  method: "POST",
10421
10586
  body: payload
10422
10587
  });
@@ -10441,10 +10606,14 @@ async function getGuardPreExecutionVerdict(client, payload) {
10441
10606
  );
10442
10607
  }
10443
10608
  async function ingestGuardPainSignals(client, items) {
10444
- const raw = await client.requestJson("/guard/signals/pain", {
10445
- method: "POST",
10446
- body: { items }
10447
- });
10609
+ const raw = await requestPortalFirstJson(
10610
+ client,
10611
+ "/guard/signals/pain",
10612
+ {
10613
+ method: "POST",
10614
+ body: { items }
10615
+ }
10616
+ );
10448
10617
  return client.parseWithSchema(
10449
10618
  raw,
10450
10619
  guardPainSignalListResponseSchema,
@@ -10452,10 +10621,14 @@ async function ingestGuardPainSignals(client, items) {
10452
10621
  );
10453
10622
  }
10454
10623
  async function submitGuardReceipts(client, payload) {
10455
- const raw = await client.requestJson("/guard/receipts/submit", {
10456
- method: "POST",
10457
- body: payload
10458
- });
10624
+ const raw = await requestPortalFirstJson(
10625
+ client,
10626
+ "/guard/receipts/submit",
10627
+ {
10628
+ method: "POST",
10629
+ body: payload
10630
+ }
10631
+ );
10459
10632
  return client.parseWithSchema(
10460
10633
  raw,
10461
10634
  guardReceiptSyncResponseSchema,
@@ -10463,10 +10636,14 @@ async function submitGuardReceipts(client, payload) {
10463
10636
  );
10464
10637
  }
10465
10638
  async function addGuardWatchlistItem(client, payload) {
10466
- const raw = await client.requestJson("/guard/watchlist", {
10467
- method: "POST",
10468
- body: payload
10469
- });
10639
+ const raw = await requestPortalFirstJson(
10640
+ client,
10641
+ "/guard/watchlist",
10642
+ {
10643
+ method: "POST",
10644
+ body: payload
10645
+ }
10646
+ );
10470
10647
  return client.parseWithSchema(
10471
10648
  raw,
10472
10649
  guardWatchlistResponseSchema,
@@ -10478,7 +10655,8 @@ async function removeGuardWatchlistItem(client, artifactId) {
10478
10655
  if (!normalizedArtifactId) {
10479
10656
  throw new Error("artifactId is required");
10480
10657
  }
10481
- const raw = await client.requestJson(
10658
+ const raw = await requestPortalFirstJson(
10659
+ client,
10482
10660
  `/guard/watchlist/${encodeURIComponent(normalizedArtifactId)}`,
10483
10661
  { method: "DELETE" }
10484
10662
  );
@@ -10489,10 +10667,14 @@ async function removeGuardWatchlistItem(client, artifactId) {
10489
10667
  );
10490
10668
  }
10491
10669
  async function addGuardException(client, payload) {
10492
- const raw = await client.requestJson("/guard/exceptions", {
10493
- method: "POST",
10494
- body: payload
10495
- });
10670
+ const raw = await requestPortalFirstJson(
10671
+ client,
10672
+ "/guard/exceptions",
10673
+ {
10674
+ method: "POST",
10675
+ body: payload
10676
+ }
10677
+ );
10496
10678
  return client.parseWithSchema(
10497
10679
  raw,
10498
10680
  guardExceptionListResponseSchema,
@@ -10500,10 +10682,14 @@ async function addGuardException(client, payload) {
10500
10682
  );
10501
10683
  }
10502
10684
  async function requestGuardException(client, payload) {
10503
- const raw = await client.requestJson("/guard/exceptions/request", {
10504
- method: "POST",
10505
- body: payload
10506
- });
10685
+ const raw = await requestPortalFirstJson(
10686
+ client,
10687
+ "/guard/exceptions/request",
10688
+ {
10689
+ method: "POST",
10690
+ body: payload
10691
+ }
10692
+ );
10507
10693
  return client.parseWithSchema(
10508
10694
  raw,
10509
10695
  guardExceptionListResponseSchema,
@@ -10511,10 +10697,14 @@ async function requestGuardException(client, payload) {
10511
10697
  );
10512
10698
  }
10513
10699
  async function syncGuardInventory(client, payload) {
10514
- const raw = await client.requestJson("/guard/inventory/sync", {
10515
- method: "POST",
10516
- body: payload
10517
- });
10700
+ const raw = await requestPortalFirstJson(
10701
+ client,
10702
+ "/guard/inventory/sync",
10703
+ {
10704
+ method: "POST",
10705
+ body: payload
10706
+ }
10707
+ );
10518
10708
  return client.parseWithSchema(
10519
10709
  raw,
10520
10710
  guardReceiptSyncResponseSchema,
@@ -10526,7 +10716,8 @@ async function removeGuardException(client, exceptionId) {
10526
10716
  if (!normalizedExceptionId) {
10527
10717
  throw new Error("exceptionId is required");
10528
10718
  }
10529
- const raw = await client.requestJson(
10719
+ const raw = await requestPortalFirstJson(
10720
+ client,
10530
10721
  `/guard/exceptions/${encodeURIComponent(normalizedExceptionId)}`,
10531
10722
  { method: "DELETE" }
10532
10723
  );
@@ -10537,9 +10728,13 @@ async function removeGuardException(client, exceptionId) {
10537
10728
  );
10538
10729
  }
10539
10730
  async function getGuardTeamPolicyPack(client) {
10540
- const raw = await client.requestJson("/guard/team/policy-pack", {
10541
- method: "GET"
10542
- });
10731
+ const raw = await requestPortalFirstJson(
10732
+ client,
10733
+ "/guard/team/policy-pack",
10734
+ {
10735
+ method: "GET"
10736
+ }
10737
+ );
10543
10738
  return client.parseWithSchema(
10544
10739
  raw,
10545
10740
  guardTeamPolicyPackSchema,
@@ -10547,10 +10742,14 @@ async function getGuardTeamPolicyPack(client) {
10547
10742
  );
10548
10743
  }
10549
10744
  async function updateGuardTeamPolicyPack(client, payload) {
10550
- const raw = await client.requestJson("/guard/team/policy-pack", {
10551
- method: "PUT",
10552
- body: payload
10553
- });
10745
+ const raw = await requestPortalFirstJson(
10746
+ client,
10747
+ "/guard/team/policy-pack",
10748
+ {
10749
+ method: "PUT",
10750
+ body: payload
10751
+ }
10752
+ );
10554
10753
  return client.parseWithSchema(
10555
10754
  raw,
10556
10755
  guardTeamPolicyPackSchema,
@@ -10558,10 +10757,14 @@ async function updateGuardTeamPolicyPack(client, payload) {
10558
10757
  );
10559
10758
  }
10560
10759
  async function syncGuardReceipts(client, payload) {
10561
- const raw = await client.requestJson("/guard/receipts/sync", {
10562
- method: "POST",
10563
- body: payload
10564
- });
10760
+ const raw = await requestPortalFirstJson(
10761
+ client,
10762
+ "/guard/receipts/sync",
10763
+ {
10764
+ method: "POST",
10765
+ body: payload
10766
+ }
10767
+ );
10565
10768
  return client.parseWithSchema(
10566
10769
  raw,
10567
10770
  guardReceiptSyncResponseSchema,
@@ -11882,7 +12085,7 @@ class RegistryBrokerClient {
11882
12085
  const normalisedPath = path.startsWith("/") ? path : `/${path}`;
11883
12086
  return `${this.baseUrl}${normalisedPath}`;
11884
12087
  }
11885
- async request(path, config) {
12088
+ buildRequestInit(config) {
11886
12089
  const headers = new Headers();
11887
12090
  Object.entries(this.defaultHeaders).forEach(([key, value]) => {
11888
12091
  headers.set(key, value);
@@ -11908,6 +12111,10 @@ class RegistryBrokerClient {
11908
12111
  headers.set("content-type", "application/json");
11909
12112
  }
11910
12113
  }
12114
+ return init;
12115
+ }
12116
+ async request(path, config) {
12117
+ const init = this.buildRequestInit(config);
11911
12118
  const response = await this.fetchImpl(this.buildUrl(path), init);
11912
12119
  if (response.ok) {
11913
12120
  return response;
@@ -11919,6 +12126,19 @@ class RegistryBrokerClient {
11919
12126
  body: errorBody
11920
12127
  });
11921
12128
  }
12129
+ async requestAbsolute(url, config) {
12130
+ const init = this.buildRequestInit(config);
12131
+ const response = await this.fetchImpl(url, init);
12132
+ if (response.ok) {
12133
+ return response;
12134
+ }
12135
+ const errorBody = await this.extractErrorBody(response);
12136
+ throw new RegistryBrokerError("Registry broker request failed", {
12137
+ status: response.status,
12138
+ statusText: response.statusText,
12139
+ body: errorBody
12140
+ });
12141
+ }
11922
12142
  async requestJson(path, config) {
11923
12143
  const response = await this.request(path, config);
11924
12144
  const contentType = response.headers?.get("content-type") ?? "";
@@ -11931,6 +12151,18 @@ class RegistryBrokerClient {
11931
12151
  }
11932
12152
  return await response.json();
11933
12153
  }
12154
+ async requestAbsoluteJson(url, config) {
12155
+ const response = await this.requestAbsolute(url, config);
12156
+ const contentType = response.headers?.get("content-type") ?? "";
12157
+ if (!JSON_CONTENT_TYPE.test(contentType)) {
12158
+ const body = await response.text();
12159
+ throw new RegistryBrokerParseError(
12160
+ "Expected JSON response from registry broker",
12161
+ body
12162
+ );
12163
+ }
12164
+ return await response.json();
12165
+ }
11934
12166
  async getAgentFeedback(uaid, options = {}) {
11935
12167
  const normalized = uaid.trim();
11936
12168
  if (!normalized) {
@@ -12855,6 +13087,8 @@ class RegistryBrokerClient {
12855
13087
  const isPendingRegisterAgentResponse = (response) => response.status === "pending";
12856
13088
  const isPartialRegisterAgentResponse = (response) => response.status === "partial" && response.success === false;
12857
13089
  const isSuccessRegisterAgentResponse = (response) => response.success === true && response.status !== "pending";
13090
+ const GUARD_CANONICAL_PATH_PREFIX = "/api/guard";
13091
+ const GUARD_COMPAT_PATH_PREFIX = "/guard";
12858
13092
  const HOL_CHAT_PROTOCOL_ID = "hol-chat";
12859
13093
  const isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
12860
13094
  const isHolChatOp = (value) => {
@@ -43225,6 +43459,8 @@ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
43225
43459
  traditionalChinese: wordlist
43226
43460
  }, Symbol.toStringTag, { value: "Module" }));
43227
43461
  export {
43462
+ GUARD_CANONICAL_PATH_PREFIX,
43463
+ GUARD_COMPAT_PATH_PREFIX,
43228
43464
  HOL_CHAT_PROTOCOL_ID,
43229
43465
  Logger,
43230
43466
  RegistryBrokerClient,