@hol-org/rb-client 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.
- package/dist/index.cjs +344 -104
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +342 -104
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -29,6 +29,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
// src/index.ts
|
|
30
30
|
var src_exports = {};
|
|
31
31
|
__export(src_exports, {
|
|
32
|
+
GUARD_CANONICAL_PATH_PREFIX: () => GUARD_CANONICAL_PATH_PREFIX,
|
|
33
|
+
GUARD_COMPAT_PATH_PREFIX: () => GUARD_COMPAT_PATH_PREFIX,
|
|
32
34
|
HOL_CHAT_PROTOCOL_ID: () => HOL_CHAT_PROTOCOL_ID,
|
|
33
35
|
RegistryBrokerClient: () => RegistryBrokerClient,
|
|
34
36
|
RegistryBrokerError: () => RegistryBrokerError,
|
|
@@ -4293,10 +4295,98 @@ async function registerOwnedMoltbookAgent(client, uaid, request) {
|
|
|
4293
4295
|
}
|
|
4294
4296
|
|
|
4295
4297
|
// ../../src/services/registry-broker/client/guard.ts
|
|
4298
|
+
function isStatusError(error) {
|
|
4299
|
+
if (error instanceof RegistryBrokerError) {
|
|
4300
|
+
return true;
|
|
4301
|
+
}
|
|
4302
|
+
if (typeof error !== "object" || error === null || !("status" in error)) {
|
|
4303
|
+
return false;
|
|
4304
|
+
}
|
|
4305
|
+
return typeof Reflect.get(error, "status") === "number";
|
|
4306
|
+
}
|
|
4307
|
+
function toPortalCanonicalGuardPath(path) {
|
|
4308
|
+
const segments = path.split("/");
|
|
4309
|
+
const findPatternStart = (size, matcher) => {
|
|
4310
|
+
for (let startIndex = segments.length - size; startIndex >= 0; startIndex -= 1) {
|
|
4311
|
+
if (matcher(startIndex)) {
|
|
4312
|
+
return startIndex;
|
|
4313
|
+
}
|
|
4314
|
+
}
|
|
4315
|
+
return -1;
|
|
4316
|
+
};
|
|
4317
|
+
const replaceAt = (startIndex, consumed) => [
|
|
4318
|
+
...segments.slice(0, startIndex),
|
|
4319
|
+
"api",
|
|
4320
|
+
"guard",
|
|
4321
|
+
...segments.slice(startIndex + consumed)
|
|
4322
|
+
].join("/");
|
|
4323
|
+
const registryStart = findPatternStart(
|
|
4324
|
+
4,
|
|
4325
|
+
(startIndex) => segments[startIndex] === "registry" && segments[startIndex + 1] === "api" && /^v\d+$/.test(segments[startIndex + 2] ?? "") && segments[startIndex + 3] === "guard"
|
|
4326
|
+
);
|
|
4327
|
+
if (registryStart >= 0) {
|
|
4328
|
+
return replaceAt(registryStart, 4);
|
|
4329
|
+
}
|
|
4330
|
+
const apiVersionStart = findPatternStart(
|
|
4331
|
+
3,
|
|
4332
|
+
(startIndex) => segments[startIndex] === "api" && /^v\d+$/.test(segments[startIndex + 1] ?? "") && segments[startIndex + 2] === "guard"
|
|
4333
|
+
);
|
|
4334
|
+
if (apiVersionStart >= 0) {
|
|
4335
|
+
return replaceAt(apiVersionStart, 3);
|
|
4336
|
+
}
|
|
4337
|
+
for (let index = segments.length - 1; index >= 0; index -= 1) {
|
|
4338
|
+
if (segments[index] === "guard" && segments[index - 1] !== "api") {
|
|
4339
|
+
return [
|
|
4340
|
+
...segments.slice(0, index),
|
|
4341
|
+
"api",
|
|
4342
|
+
"guard",
|
|
4343
|
+
...segments.slice(index + 1)
|
|
4344
|
+
].join("/");
|
|
4345
|
+
}
|
|
4346
|
+
}
|
|
4347
|
+
return path;
|
|
4348
|
+
}
|
|
4349
|
+
function buildPortalCanonicalGuardUrl(baseUrl, path) {
|
|
4350
|
+
const target = new URL(path, "https://guard.local");
|
|
4351
|
+
const normalizedBasePath = (() => {
|
|
4352
|
+
try {
|
|
4353
|
+
const base = new URL(baseUrl);
|
|
4354
|
+
return base.pathname.replace(/\/+$/, "");
|
|
4355
|
+
} catch {
|
|
4356
|
+
return baseUrl.replace(/\/+$/, "");
|
|
4357
|
+
}
|
|
4358
|
+
})();
|
|
4359
|
+
const requestedPath = `${normalizedBasePath}${target.pathname}`;
|
|
4360
|
+
const canonicalPath = toPortalCanonicalGuardPath(requestedPath);
|
|
4361
|
+
const canonicalRelativePath = `${canonicalPath}${target.search}`;
|
|
4362
|
+
try {
|
|
4363
|
+
const base = new URL(baseUrl);
|
|
4364
|
+
return `${base.origin}${canonicalRelativePath}`;
|
|
4365
|
+
} catch {
|
|
4366
|
+
return canonicalRelativePath;
|
|
4367
|
+
}
|
|
4368
|
+
}
|
|
4369
|
+
async function requestPortalFirstJson(client, path, init) {
|
|
4370
|
+
try {
|
|
4371
|
+
return await client.requestJson(path, init);
|
|
4372
|
+
} catch (error) {
|
|
4373
|
+
if (isStatusError(error) && (error.status === 404 || error.status === 501)) {
|
|
4374
|
+
return client.requestAbsoluteJson(
|
|
4375
|
+
buildPortalCanonicalGuardUrl(client.baseUrl, path),
|
|
4376
|
+
init
|
|
4377
|
+
);
|
|
4378
|
+
}
|
|
4379
|
+
throw error;
|
|
4380
|
+
}
|
|
4381
|
+
}
|
|
4296
4382
|
async function getGuardSession(client) {
|
|
4297
|
-
const raw = await
|
|
4298
|
-
|
|
4299
|
-
|
|
4383
|
+
const raw = await requestPortalFirstJson(
|
|
4384
|
+
client,
|
|
4385
|
+
"/guard/auth/session",
|
|
4386
|
+
{
|
|
4387
|
+
method: "GET"
|
|
4388
|
+
}
|
|
4389
|
+
);
|
|
4300
4390
|
return client.parseWithSchema(
|
|
4301
4391
|
raw,
|
|
4302
4392
|
guardSessionResponseSchema,
|
|
@@ -4304,9 +4394,13 @@ async function getGuardSession(client) {
|
|
|
4304
4394
|
);
|
|
4305
4395
|
}
|
|
4306
4396
|
async function getGuardEntitlements(client) {
|
|
4307
|
-
const raw = await
|
|
4308
|
-
|
|
4309
|
-
|
|
4397
|
+
const raw = await requestPortalFirstJson(
|
|
4398
|
+
client,
|
|
4399
|
+
"/guard/entitlements",
|
|
4400
|
+
{
|
|
4401
|
+
method: "GET"
|
|
4402
|
+
}
|
|
4403
|
+
);
|
|
4310
4404
|
return client.parseWithSchema(
|
|
4311
4405
|
raw,
|
|
4312
4406
|
guardSessionResponseSchema,
|
|
@@ -4314,9 +4408,13 @@ async function getGuardEntitlements(client) {
|
|
|
4314
4408
|
);
|
|
4315
4409
|
}
|
|
4316
4410
|
async function getGuardBillingBalance(client) {
|
|
4317
|
-
const raw = await
|
|
4318
|
-
|
|
4319
|
-
|
|
4411
|
+
const raw = await requestPortalFirstJson(
|
|
4412
|
+
client,
|
|
4413
|
+
"/guard/billing/balance",
|
|
4414
|
+
{
|
|
4415
|
+
method: "GET"
|
|
4416
|
+
}
|
|
4417
|
+
);
|
|
4320
4418
|
return client.parseWithSchema(
|
|
4321
4419
|
raw,
|
|
4322
4420
|
guardBalanceResponseSchema,
|
|
@@ -4330,9 +4428,13 @@ async function getGuardFeed(client, limit) {
|
|
|
4330
4428
|
}
|
|
4331
4429
|
const query = params.toString();
|
|
4332
4430
|
const suffix = query ? `?${query}` : "";
|
|
4333
|
-
const raw = await
|
|
4334
|
-
|
|
4335
|
-
|
|
4431
|
+
const raw = await requestPortalFirstJson(
|
|
4432
|
+
client,
|
|
4433
|
+
`/guard/feed${suffix}`,
|
|
4434
|
+
{
|
|
4435
|
+
method: "GET"
|
|
4436
|
+
}
|
|
4437
|
+
);
|
|
4336
4438
|
return client.parseWithSchema(
|
|
4337
4439
|
raw,
|
|
4338
4440
|
guardFeedResponseSchema,
|
|
@@ -4340,9 +4442,13 @@ async function getGuardFeed(client, limit) {
|
|
|
4340
4442
|
);
|
|
4341
4443
|
}
|
|
4342
4444
|
async function getGuardOverview(client) {
|
|
4343
|
-
const raw = await
|
|
4344
|
-
|
|
4345
|
-
|
|
4445
|
+
const raw = await requestPortalFirstJson(
|
|
4446
|
+
client,
|
|
4447
|
+
"/guard/overview",
|
|
4448
|
+
{
|
|
4449
|
+
method: "GET"
|
|
4450
|
+
}
|
|
4451
|
+
);
|
|
4346
4452
|
return client.parseWithSchema(
|
|
4347
4453
|
raw,
|
|
4348
4454
|
guardOverviewResponseSchema,
|
|
@@ -4354,7 +4460,8 @@ async function getGuardTrustByHash(client, sha256) {
|
|
|
4354
4460
|
if (!normalizedHash) {
|
|
4355
4461
|
throw new Error("sha256 is required");
|
|
4356
4462
|
}
|
|
4357
|
-
const raw = await
|
|
4463
|
+
const raw = await requestPortalFirstJson(
|
|
4464
|
+
client,
|
|
4358
4465
|
`/guard/trust/by-hash/${encodeURIComponent(normalizedHash)}`,
|
|
4359
4466
|
{ method: "GET" }
|
|
4360
4467
|
);
|
|
@@ -4376,7 +4483,8 @@ async function resolveGuardTrust(client, query) {
|
|
|
4376
4483
|
params.set("version", query.version.trim());
|
|
4377
4484
|
}
|
|
4378
4485
|
const suffix = params.size > 0 ? `?${params.toString()}` : "";
|
|
4379
|
-
const raw = await
|
|
4486
|
+
const raw = await requestPortalFirstJson(
|
|
4487
|
+
client,
|
|
4380
4488
|
`/guard/trust/resolve${suffix}`,
|
|
4381
4489
|
{ method: "GET" }
|
|
4382
4490
|
);
|
|
@@ -4387,9 +4495,13 @@ async function resolveGuardTrust(client, query) {
|
|
|
4387
4495
|
);
|
|
4388
4496
|
}
|
|
4389
4497
|
async function getGuardRevocations(client) {
|
|
4390
|
-
const raw = await
|
|
4391
|
-
|
|
4392
|
-
|
|
4498
|
+
const raw = await requestPortalFirstJson(
|
|
4499
|
+
client,
|
|
4500
|
+
"/guard/revocations",
|
|
4501
|
+
{
|
|
4502
|
+
method: "GET"
|
|
4503
|
+
}
|
|
4504
|
+
);
|
|
4393
4505
|
return client.parseWithSchema(
|
|
4394
4506
|
raw,
|
|
4395
4507
|
guardRevocationResponseSchema,
|
|
@@ -4397,9 +4509,13 @@ async function getGuardRevocations(client) {
|
|
|
4397
4509
|
);
|
|
4398
4510
|
}
|
|
4399
4511
|
async function fetchGuardAdvisories(client) {
|
|
4400
|
-
const raw = await
|
|
4401
|
-
|
|
4402
|
-
|
|
4512
|
+
const raw = await requestPortalFirstJson(
|
|
4513
|
+
client,
|
|
4514
|
+
"/guard/advisories",
|
|
4515
|
+
{
|
|
4516
|
+
method: "GET"
|
|
4517
|
+
}
|
|
4518
|
+
);
|
|
4403
4519
|
return client.parseWithSchema(
|
|
4404
4520
|
raw,
|
|
4405
4521
|
guardRevocationResponseSchema,
|
|
@@ -4407,9 +4523,13 @@ async function fetchGuardAdvisories(client) {
|
|
|
4407
4523
|
);
|
|
4408
4524
|
}
|
|
4409
4525
|
async function fetchGuardPolicy(client) {
|
|
4410
|
-
const raw = await
|
|
4411
|
-
|
|
4412
|
-
|
|
4526
|
+
const raw = await requestPortalFirstJson(
|
|
4527
|
+
client,
|
|
4528
|
+
"/guard/policy/fetch",
|
|
4529
|
+
{
|
|
4530
|
+
method: "GET"
|
|
4531
|
+
}
|
|
4532
|
+
);
|
|
4413
4533
|
return client.parseWithSchema(
|
|
4414
4534
|
raw,
|
|
4415
4535
|
guardPolicySchema,
|
|
@@ -4417,9 +4537,13 @@ async function fetchGuardPolicy(client) {
|
|
|
4417
4537
|
);
|
|
4418
4538
|
}
|
|
4419
4539
|
async function getGuardInventory(client) {
|
|
4420
|
-
const raw = await
|
|
4421
|
-
|
|
4422
|
-
|
|
4540
|
+
const raw = await requestPortalFirstJson(
|
|
4541
|
+
client,
|
|
4542
|
+
"/guard/inventory",
|
|
4543
|
+
{
|
|
4544
|
+
method: "GET"
|
|
4545
|
+
}
|
|
4546
|
+
);
|
|
4423
4547
|
return client.parseWithSchema(
|
|
4424
4548
|
raw,
|
|
4425
4549
|
guardInventoryResponseSchema,
|
|
@@ -4427,9 +4551,13 @@ async function getGuardInventory(client) {
|
|
|
4427
4551
|
);
|
|
4428
4552
|
}
|
|
4429
4553
|
async function getGuardReceiptHistory(client) {
|
|
4430
|
-
const raw = await
|
|
4431
|
-
|
|
4432
|
-
|
|
4554
|
+
const raw = await requestPortalFirstJson(
|
|
4555
|
+
client,
|
|
4556
|
+
"/guard/history",
|
|
4557
|
+
{
|
|
4558
|
+
method: "GET"
|
|
4559
|
+
}
|
|
4560
|
+
);
|
|
4433
4561
|
return client.parseWithSchema(
|
|
4434
4562
|
raw,
|
|
4435
4563
|
guardReceiptHistoryResponseSchema,
|
|
@@ -4441,7 +4569,8 @@ async function getGuardArtifactTimeline(client, artifactId) {
|
|
|
4441
4569
|
if (!normalizedArtifactId) {
|
|
4442
4570
|
throw new Error("artifactId is required");
|
|
4443
4571
|
}
|
|
4444
|
-
const raw = await
|
|
4572
|
+
const raw = await requestPortalFirstJson(
|
|
4573
|
+
client,
|
|
4445
4574
|
`/guard/history/${encodeURIComponent(normalizedArtifactId)}`,
|
|
4446
4575
|
{ method: "GET" }
|
|
4447
4576
|
);
|
|
@@ -4452,7 +4581,7 @@ async function getGuardArtifactTimeline(client, artifactId) {
|
|
|
4452
4581
|
);
|
|
4453
4582
|
}
|
|
4454
4583
|
async function exportGuardAbom(client) {
|
|
4455
|
-
const raw = await client
|
|
4584
|
+
const raw = await requestPortalFirstJson(client, "/guard/abom", {
|
|
4456
4585
|
method: "GET"
|
|
4457
4586
|
});
|
|
4458
4587
|
return client.parseWithSchema(
|
|
@@ -4466,7 +4595,8 @@ async function exportGuardArtifactAbom(client, artifactId) {
|
|
|
4466
4595
|
if (!normalizedArtifactId) {
|
|
4467
4596
|
throw new Error("artifactId is required");
|
|
4468
4597
|
}
|
|
4469
|
-
const raw = await
|
|
4598
|
+
const raw = await requestPortalFirstJson(
|
|
4599
|
+
client,
|
|
4470
4600
|
`/guard/abom/${encodeURIComponent(normalizedArtifactId)}`,
|
|
4471
4601
|
{ method: "GET" }
|
|
4472
4602
|
);
|
|
@@ -4477,9 +4607,13 @@ async function exportGuardArtifactAbom(client, artifactId) {
|
|
|
4477
4607
|
);
|
|
4478
4608
|
}
|
|
4479
4609
|
async function exportGuardReceipts(client) {
|
|
4480
|
-
const raw = await
|
|
4481
|
-
|
|
4482
|
-
|
|
4610
|
+
const raw = await requestPortalFirstJson(
|
|
4611
|
+
client,
|
|
4612
|
+
"/guard/receipts/export",
|
|
4613
|
+
{
|
|
4614
|
+
method: "GET"
|
|
4615
|
+
}
|
|
4616
|
+
);
|
|
4483
4617
|
return client.parseWithSchema(
|
|
4484
4618
|
raw,
|
|
4485
4619
|
guardReceiptExportResponseSchema,
|
|
@@ -4487,9 +4621,13 @@ async function exportGuardReceipts(client) {
|
|
|
4487
4621
|
);
|
|
4488
4622
|
}
|
|
4489
4623
|
async function getGuardInventoryDiff(client) {
|
|
4490
|
-
const raw = await
|
|
4491
|
-
|
|
4492
|
-
|
|
4624
|
+
const raw = await requestPortalFirstJson(
|
|
4625
|
+
client,
|
|
4626
|
+
"/guard/inventory/diff",
|
|
4627
|
+
{
|
|
4628
|
+
method: "GET"
|
|
4629
|
+
}
|
|
4630
|
+
);
|
|
4493
4631
|
return client.parseWithSchema(
|
|
4494
4632
|
raw,
|
|
4495
4633
|
guardInventoryDiffResponseSchema,
|
|
@@ -4497,9 +4635,13 @@ async function getGuardInventoryDiff(client) {
|
|
|
4497
4635
|
);
|
|
4498
4636
|
}
|
|
4499
4637
|
async function getGuardDevices(client) {
|
|
4500
|
-
const raw = await
|
|
4501
|
-
|
|
4502
|
-
|
|
4638
|
+
const raw = await requestPortalFirstJson(
|
|
4639
|
+
client,
|
|
4640
|
+
"/guard/devices",
|
|
4641
|
+
{
|
|
4642
|
+
method: "GET"
|
|
4643
|
+
}
|
|
4644
|
+
);
|
|
4503
4645
|
return client.parseWithSchema(
|
|
4504
4646
|
raw,
|
|
4505
4647
|
guardDeviceListResponseSchema,
|
|
@@ -4507,9 +4649,13 @@ async function getGuardDevices(client) {
|
|
|
4507
4649
|
);
|
|
4508
4650
|
}
|
|
4509
4651
|
async function getGuardAlertPreferences(client) {
|
|
4510
|
-
const raw = await
|
|
4511
|
-
|
|
4512
|
-
|
|
4652
|
+
const raw = await requestPortalFirstJson(
|
|
4653
|
+
client,
|
|
4654
|
+
"/guard/alerts/preferences",
|
|
4655
|
+
{
|
|
4656
|
+
method: "GET"
|
|
4657
|
+
}
|
|
4658
|
+
);
|
|
4513
4659
|
return client.parseWithSchema(
|
|
4514
4660
|
raw,
|
|
4515
4661
|
guardAlertPreferencesSchema,
|
|
@@ -4517,10 +4663,14 @@ async function getGuardAlertPreferences(client) {
|
|
|
4517
4663
|
);
|
|
4518
4664
|
}
|
|
4519
4665
|
async function updateGuardAlertPreferences(client, payload) {
|
|
4520
|
-
const raw = await
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4666
|
+
const raw = await requestPortalFirstJson(
|
|
4667
|
+
client,
|
|
4668
|
+
"/guard/alerts/preferences",
|
|
4669
|
+
{
|
|
4670
|
+
method: "PUT",
|
|
4671
|
+
body: payload
|
|
4672
|
+
}
|
|
4673
|
+
);
|
|
4524
4674
|
return client.parseWithSchema(
|
|
4525
4675
|
raw,
|
|
4526
4676
|
guardAlertPreferencesSchema,
|
|
@@ -4528,9 +4678,13 @@ async function updateGuardAlertPreferences(client, payload) {
|
|
|
4528
4678
|
);
|
|
4529
4679
|
}
|
|
4530
4680
|
async function getGuardExceptions(client) {
|
|
4531
|
-
const raw = await
|
|
4532
|
-
|
|
4533
|
-
|
|
4681
|
+
const raw = await requestPortalFirstJson(
|
|
4682
|
+
client,
|
|
4683
|
+
"/guard/exceptions",
|
|
4684
|
+
{
|
|
4685
|
+
method: "GET"
|
|
4686
|
+
}
|
|
4687
|
+
);
|
|
4534
4688
|
return client.parseWithSchema(
|
|
4535
4689
|
raw,
|
|
4536
4690
|
guardExceptionListResponseSchema,
|
|
@@ -4538,9 +4692,13 @@ async function getGuardExceptions(client) {
|
|
|
4538
4692
|
);
|
|
4539
4693
|
}
|
|
4540
4694
|
async function getGuardWatchlist(client) {
|
|
4541
|
-
const raw = await
|
|
4542
|
-
|
|
4543
|
-
|
|
4695
|
+
const raw = await requestPortalFirstJson(
|
|
4696
|
+
client,
|
|
4697
|
+
"/guard/watchlist",
|
|
4698
|
+
{
|
|
4699
|
+
method: "GET"
|
|
4700
|
+
}
|
|
4701
|
+
);
|
|
4544
4702
|
return client.parseWithSchema(
|
|
4545
4703
|
raw,
|
|
4546
4704
|
guardWatchlistResponseSchema,
|
|
@@ -4548,10 +4706,14 @@ async function getGuardWatchlist(client) {
|
|
|
4548
4706
|
);
|
|
4549
4707
|
}
|
|
4550
4708
|
async function lookupGuardWatchlist(client, payload) {
|
|
4551
|
-
const raw = await
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4709
|
+
const raw = await requestPortalFirstJson(
|
|
4710
|
+
client,
|
|
4711
|
+
"/guard/watchlist/lookup",
|
|
4712
|
+
{
|
|
4713
|
+
method: "POST",
|
|
4714
|
+
body: payload
|
|
4715
|
+
}
|
|
4716
|
+
);
|
|
4555
4717
|
return client.parseWithSchema(
|
|
4556
4718
|
raw,
|
|
4557
4719
|
guardWatchlistLookupResponseSchema,
|
|
@@ -4559,9 +4721,13 @@ async function lookupGuardWatchlist(client, payload) {
|
|
|
4559
4721
|
);
|
|
4560
4722
|
}
|
|
4561
4723
|
async function getGuardPainSignals(client) {
|
|
4562
|
-
const raw = await
|
|
4563
|
-
|
|
4564
|
-
|
|
4724
|
+
const raw = await requestPortalFirstJson(
|
|
4725
|
+
client,
|
|
4726
|
+
"/guard/signals/pain",
|
|
4727
|
+
{
|
|
4728
|
+
method: "GET"
|
|
4729
|
+
}
|
|
4730
|
+
);
|
|
4565
4731
|
return client.parseWithSchema(
|
|
4566
4732
|
raw,
|
|
4567
4733
|
guardPainSignalListResponseSchema,
|
|
@@ -4569,7 +4735,8 @@ async function getGuardPainSignals(client) {
|
|
|
4569
4735
|
);
|
|
4570
4736
|
}
|
|
4571
4737
|
async function getGuardAggregatedPainSignals(client) {
|
|
4572
|
-
const raw = await
|
|
4738
|
+
const raw = await requestPortalFirstJson(
|
|
4739
|
+
client,
|
|
4573
4740
|
"/guard/signals/pain/aggregate",
|
|
4574
4741
|
{
|
|
4575
4742
|
method: "GET"
|
|
@@ -4582,7 +4749,7 @@ async function getGuardAggregatedPainSignals(client) {
|
|
|
4582
4749
|
);
|
|
4583
4750
|
}
|
|
4584
4751
|
async function getGuardPreflightVerdict(client, path, payload) {
|
|
4585
|
-
const raw = await client
|
|
4752
|
+
const raw = await requestPortalFirstJson(client, path, {
|
|
4586
4753
|
method: "POST",
|
|
4587
4754
|
body: payload
|
|
4588
4755
|
});
|
|
@@ -4607,10 +4774,14 @@ async function getGuardPreExecutionVerdict(client, payload) {
|
|
|
4607
4774
|
);
|
|
4608
4775
|
}
|
|
4609
4776
|
async function ingestGuardPainSignals(client, items) {
|
|
4610
|
-
const raw = await
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4777
|
+
const raw = await requestPortalFirstJson(
|
|
4778
|
+
client,
|
|
4779
|
+
"/guard/signals/pain",
|
|
4780
|
+
{
|
|
4781
|
+
method: "POST",
|
|
4782
|
+
body: { items }
|
|
4783
|
+
}
|
|
4784
|
+
);
|
|
4614
4785
|
return client.parseWithSchema(
|
|
4615
4786
|
raw,
|
|
4616
4787
|
guardPainSignalListResponseSchema,
|
|
@@ -4618,10 +4789,14 @@ async function ingestGuardPainSignals(client, items) {
|
|
|
4618
4789
|
);
|
|
4619
4790
|
}
|
|
4620
4791
|
async function submitGuardReceipts(client, payload) {
|
|
4621
|
-
const raw = await
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4792
|
+
const raw = await requestPortalFirstJson(
|
|
4793
|
+
client,
|
|
4794
|
+
"/guard/receipts/submit",
|
|
4795
|
+
{
|
|
4796
|
+
method: "POST",
|
|
4797
|
+
body: payload
|
|
4798
|
+
}
|
|
4799
|
+
);
|
|
4625
4800
|
return client.parseWithSchema(
|
|
4626
4801
|
raw,
|
|
4627
4802
|
guardReceiptSyncResponseSchema,
|
|
@@ -4629,10 +4804,14 @@ async function submitGuardReceipts(client, payload) {
|
|
|
4629
4804
|
);
|
|
4630
4805
|
}
|
|
4631
4806
|
async function addGuardWatchlistItem(client, payload) {
|
|
4632
|
-
const raw = await
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4807
|
+
const raw = await requestPortalFirstJson(
|
|
4808
|
+
client,
|
|
4809
|
+
"/guard/watchlist",
|
|
4810
|
+
{
|
|
4811
|
+
method: "POST",
|
|
4812
|
+
body: payload
|
|
4813
|
+
}
|
|
4814
|
+
);
|
|
4636
4815
|
return client.parseWithSchema(
|
|
4637
4816
|
raw,
|
|
4638
4817
|
guardWatchlistResponseSchema,
|
|
@@ -4644,7 +4823,8 @@ async function removeGuardWatchlistItem(client, artifactId) {
|
|
|
4644
4823
|
if (!normalizedArtifactId) {
|
|
4645
4824
|
throw new Error("artifactId is required");
|
|
4646
4825
|
}
|
|
4647
|
-
const raw = await
|
|
4826
|
+
const raw = await requestPortalFirstJson(
|
|
4827
|
+
client,
|
|
4648
4828
|
`/guard/watchlist/${encodeURIComponent(normalizedArtifactId)}`,
|
|
4649
4829
|
{ method: "DELETE" }
|
|
4650
4830
|
);
|
|
@@ -4655,10 +4835,14 @@ async function removeGuardWatchlistItem(client, artifactId) {
|
|
|
4655
4835
|
);
|
|
4656
4836
|
}
|
|
4657
4837
|
async function addGuardException(client, payload) {
|
|
4658
|
-
const raw = await
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4838
|
+
const raw = await requestPortalFirstJson(
|
|
4839
|
+
client,
|
|
4840
|
+
"/guard/exceptions",
|
|
4841
|
+
{
|
|
4842
|
+
method: "POST",
|
|
4843
|
+
body: payload
|
|
4844
|
+
}
|
|
4845
|
+
);
|
|
4662
4846
|
return client.parseWithSchema(
|
|
4663
4847
|
raw,
|
|
4664
4848
|
guardExceptionListResponseSchema,
|
|
@@ -4666,10 +4850,14 @@ async function addGuardException(client, payload) {
|
|
|
4666
4850
|
);
|
|
4667
4851
|
}
|
|
4668
4852
|
async function requestGuardException(client, payload) {
|
|
4669
|
-
const raw = await
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4853
|
+
const raw = await requestPortalFirstJson(
|
|
4854
|
+
client,
|
|
4855
|
+
"/guard/exceptions/request",
|
|
4856
|
+
{
|
|
4857
|
+
method: "POST",
|
|
4858
|
+
body: payload
|
|
4859
|
+
}
|
|
4860
|
+
);
|
|
4673
4861
|
return client.parseWithSchema(
|
|
4674
4862
|
raw,
|
|
4675
4863
|
guardExceptionListResponseSchema,
|
|
@@ -4677,10 +4865,14 @@ async function requestGuardException(client, payload) {
|
|
|
4677
4865
|
);
|
|
4678
4866
|
}
|
|
4679
4867
|
async function syncGuardInventory(client, payload) {
|
|
4680
|
-
const raw = await
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4868
|
+
const raw = await requestPortalFirstJson(
|
|
4869
|
+
client,
|
|
4870
|
+
"/guard/inventory/sync",
|
|
4871
|
+
{
|
|
4872
|
+
method: "POST",
|
|
4873
|
+
body: payload
|
|
4874
|
+
}
|
|
4875
|
+
);
|
|
4684
4876
|
return client.parseWithSchema(
|
|
4685
4877
|
raw,
|
|
4686
4878
|
guardReceiptSyncResponseSchema,
|
|
@@ -4692,7 +4884,8 @@ async function removeGuardException(client, exceptionId) {
|
|
|
4692
4884
|
if (!normalizedExceptionId) {
|
|
4693
4885
|
throw new Error("exceptionId is required");
|
|
4694
4886
|
}
|
|
4695
|
-
const raw = await
|
|
4887
|
+
const raw = await requestPortalFirstJson(
|
|
4888
|
+
client,
|
|
4696
4889
|
`/guard/exceptions/${encodeURIComponent(normalizedExceptionId)}`,
|
|
4697
4890
|
{ method: "DELETE" }
|
|
4698
4891
|
);
|
|
@@ -4703,9 +4896,13 @@ async function removeGuardException(client, exceptionId) {
|
|
|
4703
4896
|
);
|
|
4704
4897
|
}
|
|
4705
4898
|
async function getGuardTeamPolicyPack(client) {
|
|
4706
|
-
const raw = await
|
|
4707
|
-
|
|
4708
|
-
|
|
4899
|
+
const raw = await requestPortalFirstJson(
|
|
4900
|
+
client,
|
|
4901
|
+
"/guard/team/policy-pack",
|
|
4902
|
+
{
|
|
4903
|
+
method: "GET"
|
|
4904
|
+
}
|
|
4905
|
+
);
|
|
4709
4906
|
return client.parseWithSchema(
|
|
4710
4907
|
raw,
|
|
4711
4908
|
guardTeamPolicyPackSchema,
|
|
@@ -4713,10 +4910,14 @@ async function getGuardTeamPolicyPack(client) {
|
|
|
4713
4910
|
);
|
|
4714
4911
|
}
|
|
4715
4912
|
async function updateGuardTeamPolicyPack(client, payload) {
|
|
4716
|
-
const raw = await
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4913
|
+
const raw = await requestPortalFirstJson(
|
|
4914
|
+
client,
|
|
4915
|
+
"/guard/team/policy-pack",
|
|
4916
|
+
{
|
|
4917
|
+
method: "PUT",
|
|
4918
|
+
body: payload
|
|
4919
|
+
}
|
|
4920
|
+
);
|
|
4720
4921
|
return client.parseWithSchema(
|
|
4721
4922
|
raw,
|
|
4722
4923
|
guardTeamPolicyPackSchema,
|
|
@@ -4724,10 +4925,14 @@ async function updateGuardTeamPolicyPack(client, payload) {
|
|
|
4724
4925
|
);
|
|
4725
4926
|
}
|
|
4726
4927
|
async function syncGuardReceipts(client, payload) {
|
|
4727
|
-
const raw = await
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4928
|
+
const raw = await requestPortalFirstJson(
|
|
4929
|
+
client,
|
|
4930
|
+
"/guard/receipts/sync",
|
|
4931
|
+
{
|
|
4932
|
+
method: "POST",
|
|
4933
|
+
body: payload
|
|
4934
|
+
}
|
|
4935
|
+
);
|
|
4731
4936
|
return client.parseWithSchema(
|
|
4732
4937
|
raw,
|
|
4733
4938
|
guardReceiptSyncResponseSchema,
|
|
@@ -6063,7 +6268,7 @@ var RegistryBrokerClient = class _RegistryBrokerClient {
|
|
|
6063
6268
|
const normalisedPath = path.startsWith("/") ? path : `/${path}`;
|
|
6064
6269
|
return `${this.baseUrl}${normalisedPath}`;
|
|
6065
6270
|
}
|
|
6066
|
-
|
|
6271
|
+
buildRequestInit(config) {
|
|
6067
6272
|
const headers = new Headers();
|
|
6068
6273
|
Object.entries(this.defaultHeaders).forEach(([key, value]) => {
|
|
6069
6274
|
headers.set(key, value);
|
|
@@ -6089,6 +6294,10 @@ var RegistryBrokerClient = class _RegistryBrokerClient {
|
|
|
6089
6294
|
headers.set("content-type", "application/json");
|
|
6090
6295
|
}
|
|
6091
6296
|
}
|
|
6297
|
+
return init;
|
|
6298
|
+
}
|
|
6299
|
+
async request(path, config) {
|
|
6300
|
+
const init = this.buildRequestInit(config);
|
|
6092
6301
|
const response = await this.fetchImpl(this.buildUrl(path), init);
|
|
6093
6302
|
if (response.ok) {
|
|
6094
6303
|
return response;
|
|
@@ -6100,6 +6309,19 @@ var RegistryBrokerClient = class _RegistryBrokerClient {
|
|
|
6100
6309
|
body: errorBody
|
|
6101
6310
|
});
|
|
6102
6311
|
}
|
|
6312
|
+
async requestAbsolute(url, config) {
|
|
6313
|
+
const init = this.buildRequestInit(config);
|
|
6314
|
+
const response = await this.fetchImpl(url, init);
|
|
6315
|
+
if (response.ok) {
|
|
6316
|
+
return response;
|
|
6317
|
+
}
|
|
6318
|
+
const errorBody = await this.extractErrorBody(response);
|
|
6319
|
+
throw new RegistryBrokerError("Registry broker request failed", {
|
|
6320
|
+
status: response.status,
|
|
6321
|
+
statusText: response.statusText,
|
|
6322
|
+
body: errorBody
|
|
6323
|
+
});
|
|
6324
|
+
}
|
|
6103
6325
|
async requestJson(path, config) {
|
|
6104
6326
|
const response = await this.request(path, config);
|
|
6105
6327
|
const contentType = response.headers?.get("content-type") ?? "";
|
|
@@ -6112,6 +6334,18 @@ var RegistryBrokerClient = class _RegistryBrokerClient {
|
|
|
6112
6334
|
}
|
|
6113
6335
|
return await response.json();
|
|
6114
6336
|
}
|
|
6337
|
+
async requestAbsoluteJson(url, config) {
|
|
6338
|
+
const response = await this.requestAbsolute(url, config);
|
|
6339
|
+
const contentType = response.headers?.get("content-type") ?? "";
|
|
6340
|
+
if (!JSON_CONTENT_TYPE.test(contentType)) {
|
|
6341
|
+
const body = await response.text();
|
|
6342
|
+
throw new RegistryBrokerParseError(
|
|
6343
|
+
"Expected JSON response from registry broker",
|
|
6344
|
+
body
|
|
6345
|
+
);
|
|
6346
|
+
}
|
|
6347
|
+
return await response.json();
|
|
6348
|
+
}
|
|
6115
6349
|
async getAgentFeedback(uaid, options = {}) {
|
|
6116
6350
|
const normalized = uaid.trim();
|
|
6117
6351
|
if (!normalized) {
|
|
@@ -7037,6 +7271,10 @@ var isPendingRegisterAgentResponse = (response) => response.status === "pending"
|
|
|
7037
7271
|
var isPartialRegisterAgentResponse = (response) => response.status === "partial" && response.success === false;
|
|
7038
7272
|
var isSuccessRegisterAgentResponse = (response) => response.success === true && response.status !== "pending";
|
|
7039
7273
|
|
|
7274
|
+
// ../../src/services/registry-broker/types.ts
|
|
7275
|
+
var GUARD_CANONICAL_PATH_PREFIX = "/api/guard";
|
|
7276
|
+
var GUARD_COMPAT_PATH_PREFIX = "/guard";
|
|
7277
|
+
|
|
7040
7278
|
// ../../src/services/registry-broker/hol-chat-ops.ts
|
|
7041
7279
|
var HOL_CHAT_PROTOCOL_ID = "hol-chat";
|
|
7042
7280
|
var isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
@@ -7094,6 +7332,8 @@ var buildJobStatusMessage = (input) => JSON.stringify({
|
|
|
7094
7332
|
});
|
|
7095
7333
|
// Annotate the CommonJS export names for ESM import in node:
|
|
7096
7334
|
0 && (module.exports = {
|
|
7335
|
+
GUARD_CANONICAL_PATH_PREFIX,
|
|
7336
|
+
GUARD_COMPAT_PATH_PREFIX,
|
|
7097
7337
|
HOL_CHAT_PROTOCOL_ID,
|
|
7098
7338
|
RegistryBrokerClient,
|
|
7099
7339
|
RegistryBrokerError,
|