@hol-org/rb-client 0.1.179 → 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.js CHANGED
@@ -916,10 +916,14 @@ var guardBucketBalanceSchema = z2.object({
916
916
  });
917
917
  var guardPrincipalSchema = z2.object({
918
918
  signedIn: z2.boolean(),
919
+ principalType: z2.enum(["user", "service"]).default("user"),
919
920
  userId: z2.string().optional(),
920
921
  email: z2.string().optional(),
921
922
  accountId: z2.string().optional(),
922
923
  stripeCustomerId: z2.string().optional(),
924
+ serviceId: z2.string().optional(),
925
+ workspaceId: z2.string().optional(),
926
+ serviceLabel: z2.string().optional(),
923
927
  roles: z2.array(z2.string())
924
928
  });
925
929
  var guardEntitlementsSchema = z2.object({
@@ -946,6 +950,65 @@ var guardBalanceResponseSchema = z2.object({
946
950
  bucketingMode: z2.enum(["shared-ledger", "product-bucketed"]),
947
951
  buckets: z2.array(guardBucketBalanceSchema)
948
952
  });
953
+ var guardFeedItemSchema = z2.object({
954
+ id: z2.string(),
955
+ artifactType: z2.enum(["skill", "plugin"]),
956
+ slug: z2.string(),
957
+ name: z2.string(),
958
+ href: z2.string(),
959
+ ecosystem: z2.string().optional(),
960
+ safetyScore: z2.number().nullable().optional(),
961
+ trustScore: z2.number().nullable().optional(),
962
+ verified: z2.boolean(),
963
+ recommendation: z2.enum(["monitor", "review", "block"]),
964
+ updatedAt: z2.string()
965
+ });
966
+ var guardFeedSummarySchema = z2.object({
967
+ total: z2.number(),
968
+ monitorCount: z2.number(),
969
+ reviewCount: z2.number(),
970
+ blockCount: z2.number()
971
+ });
972
+ var guardFeedResponseSchema = z2.object({
973
+ generatedAt: z2.string(),
974
+ items: z2.array(guardFeedItemSchema),
975
+ summary: guardFeedSummarySchema
976
+ });
977
+ var guardIntegrationSchema = z2.object({
978
+ id: z2.enum(["openclaw", "hermes"]),
979
+ name: z2.string(),
980
+ status: z2.enum(["available", "planned"]),
981
+ href: z2.string().nullable(),
982
+ summary: z2.string()
983
+ });
984
+ var guardActionItemSchema = z2.object({
985
+ title: z2.string(),
986
+ description: z2.string(),
987
+ href: z2.string()
988
+ });
989
+ var guardOverviewResponseSchema = z2.object({
990
+ generatedAt: z2.string(),
991
+ principal: guardPrincipalSchema,
992
+ entitlements: guardEntitlementsSchema,
993
+ balance: z2.object({
994
+ accountId: z2.string(),
995
+ availableCredits: z2.number()
996
+ }).nullable(),
997
+ trustFeed: guardFeedResponseSchema,
998
+ integrations: z2.array(guardIntegrationSchema),
999
+ actionItems: z2.array(guardActionItemSchema)
1000
+ });
1001
+ var guardPolicySchema = z2.object({
1002
+ mode: z2.enum(["observe", "prompt", "enforce"]),
1003
+ defaultAction: z2.enum(["allow", "warn", "block"]),
1004
+ unknownPublisherAction: z2.enum(["review", "block", "allow"]),
1005
+ changedHashAction: z2.enum(["allow", "warn", "require-reapproval", "block"]),
1006
+ newNetworkDomainAction: z2.enum(["allow", "warn", "block"]),
1007
+ subprocessAction: z2.enum(["allow", "warn", "block"]),
1008
+ telemetryEnabled: z2.boolean(),
1009
+ syncEnabled: z2.boolean(),
1010
+ updatedAt: z2.string()
1011
+ });
949
1012
  var guardTrustMatchSchema = z2.object({
950
1013
  artifactId: z2.string(),
951
1014
  artifactName: z2.string(),
@@ -981,7 +1044,13 @@ var guardRevocationSchema = z2.object({
981
1044
  artifactName: z2.string(),
982
1045
  reason: z2.string(),
983
1046
  severity: z2.enum(["low", "medium", "high"]),
984
- publishedAt: z2.string()
1047
+ publishedAt: z2.string(),
1048
+ confidence: z2.number().optional(),
1049
+ remediation: z2.string().nullable().optional(),
1050
+ scope: z2.enum(["artifact", "publisher", "domain", "workspace", "ecosystem"]).optional(),
1051
+ source: z2.string().optional(),
1052
+ firstSeenAt: z2.string().optional(),
1053
+ lastUpdatedAt: z2.string().optional()
985
1054
  });
986
1055
  var guardRevocationResponseSchema = z2.object({
987
1056
  generatedAt: z2.string(),
@@ -1075,7 +1144,12 @@ var guardReceiptSyncResponseSchema = z2.object({
1075
1144
  syncedAt: z2.string(),
1076
1145
  receiptsStored: z2.number(),
1077
1146
  inventoryStored: z2.number().optional(),
1078
- inventoryDiff: guardInventoryDiffResponseSchema.optional()
1147
+ inventoryDiff: guardInventoryDiffResponseSchema.optional(),
1148
+ advisories: z2.array(guardRevocationSchema).optional(),
1149
+ policy: guardPolicySchema.optional(),
1150
+ alertPreferences: z2.lazy(() => guardAlertPreferencesSchema).optional(),
1151
+ exceptions: z2.array(z2.lazy(() => guardExceptionItemSchema)).optional(),
1152
+ teamPolicyPack: z2.lazy(() => guardTeamPolicyPackSchema).optional()
1079
1153
  });
1080
1154
  var guardInventoryResponseSchema = z2.object({
1081
1155
  generatedAt: z2.string(),
@@ -1161,6 +1235,59 @@ var guardWatchlistResponseSchema = z2.object({
1161
1235
  generatedAt: z2.string(),
1162
1236
  items: z2.array(guardWatchlistItemSchema)
1163
1237
  });
1238
+ var guardWatchlistLookupMatchSchema = z2.object({
1239
+ artifactId: z2.string().nullable(),
1240
+ publisher: z2.string().nullable(),
1241
+ domain: z2.string().nullable(),
1242
+ source: z2.enum(["watchlist", "team-policy"]),
1243
+ reason: z2.string()
1244
+ });
1245
+ var guardWatchlistLookupResponseSchema = z2.object({
1246
+ generatedAt: z2.string(),
1247
+ matched: z2.boolean(),
1248
+ scope: z2.enum(["artifact", "publisher", "domain", "none"]),
1249
+ item: guardWatchlistLookupMatchSchema.nullable()
1250
+ });
1251
+ var guardPainSignalSchema = z2.object({
1252
+ signalId: z2.string(),
1253
+ signalName: z2.string(),
1254
+ artifactId: z2.string(),
1255
+ artifactName: z2.string(),
1256
+ artifactType: z2.enum(["skill", "plugin"]),
1257
+ harness: z2.string(),
1258
+ latestSummary: z2.string(),
1259
+ firstSeenAt: z2.string(),
1260
+ lastSeenAt: z2.string(),
1261
+ count: z2.number(),
1262
+ source: z2.literal("scanner"),
1263
+ publisher: z2.string().optional()
1264
+ });
1265
+ var guardPainSignalListResponseSchema = z2.object({
1266
+ generatedAt: z2.string(),
1267
+ items: z2.array(guardPainSignalSchema)
1268
+ });
1269
+ var guardPainSignalAggregateSchema = z2.object({
1270
+ artifactId: z2.string(),
1271
+ artifactName: z2.string(),
1272
+ artifactType: z2.enum(["skill", "plugin"]),
1273
+ signalName: z2.string(),
1274
+ latestSummary: z2.string(),
1275
+ firstSeenAt: z2.string(),
1276
+ lastSeenAt: z2.string(),
1277
+ totalCount: z2.number(),
1278
+ consumerCount: z2.number(),
1279
+ harnesses: z2.array(z2.string()),
1280
+ publishers: z2.array(z2.string())
1281
+ });
1282
+ var guardPainSignalAggregateResponseSchema = z2.object({
1283
+ generatedAt: z2.string(),
1284
+ summary: z2.object({
1285
+ totalSignals: z2.number(),
1286
+ uniqueArtifacts: z2.number(),
1287
+ uniqueConsumers: z2.number()
1288
+ }),
1289
+ items: z2.array(guardPainSignalAggregateSchema)
1290
+ });
1164
1291
  var guardExceptionItemSchema = z2.object({
1165
1292
  exceptionId: z2.string(),
1166
1293
  scope: z2.enum(["artifact", "publisher", "harness", "global"]),
@@ -1178,6 +1305,45 @@ var guardExceptionListResponseSchema = z2.object({
1178
1305
  generatedAt: z2.string(),
1179
1306
  items: z2.array(guardExceptionItemSchema)
1180
1307
  });
1308
+ var guardPreflightEvidenceSchema = z2.object({
1309
+ category: z2.enum([
1310
+ "policy",
1311
+ "trust",
1312
+ "watchlist",
1313
+ "team-policy",
1314
+ "exception"
1315
+ ]),
1316
+ source: z2.string(),
1317
+ detail: z2.string()
1318
+ });
1319
+ var guardPreflightRequestSchema = z2.object({
1320
+ harness: z2.string(),
1321
+ artifactName: z2.string(),
1322
+ artifactType: z2.enum(["skill", "plugin"]),
1323
+ artifactId: z2.string().optional(),
1324
+ artifactSlug: z2.string().optional(),
1325
+ artifactHash: z2.string().optional(),
1326
+ publisher: z2.string().optional(),
1327
+ domain: z2.string().optional(),
1328
+ launchSummary: z2.string().optional(),
1329
+ capabilities: z2.array(z2.string()).optional(),
1330
+ workspacePath: z2.string().optional()
1331
+ });
1332
+ var guardPreflightVerdictResponseSchema = z2.object({
1333
+ generatedAt: z2.string(),
1334
+ principal: guardPrincipalSchema,
1335
+ decision: z2.enum(["allow", "review", "block"]),
1336
+ recommendation: z2.enum(["monitor", "review", "block"]),
1337
+ rationale: z2.string(),
1338
+ category: z2.enum(["exception", "team-policy", "watchlist", "trust", "policy"]).optional(),
1339
+ confidence: z2.number().optional(),
1340
+ freshnessTimestamp: z2.string().optional(),
1341
+ evidenceSources: z2.array(z2.string()).optional(),
1342
+ scope: z2.enum(["artifact", "publisher", "domain", "policy"]),
1343
+ matchedEvidence: z2.array(guardPreflightEvidenceSchema),
1344
+ matchedException: guardExceptionItemSchema.nullable(),
1345
+ trustMatch: guardTrustMatchSchema.nullable()
1346
+ });
1181
1347
  var guardTeamPolicyAuditItemSchema = z2.object({
1182
1348
  changedAt: z2.string(),
1183
1349
  actor: z2.string(),
@@ -1186,8 +1352,13 @@ var guardTeamPolicyAuditItemSchema = z2.object({
1186
1352
  });
1187
1353
  var guardTeamPolicyPackSchema = z2.object({
1188
1354
  name: z2.string(),
1189
- sharedHarnessDefaults: z2.record(z2.string(), z2.enum(["observe", "prompt", "enforce"])),
1355
+ sharedHarnessDefaults: z2.record(
1356
+ z2.string(),
1357
+ z2.enum(["observe", "prompt", "enforce"])
1358
+ ),
1190
1359
  allowedPublishers: z2.array(z2.string()),
1360
+ blockedPublishers: z2.array(z2.string()).optional(),
1361
+ blockedDomains: z2.array(z2.string()).optional(),
1191
1362
  blockedArtifacts: z2.array(z2.string()),
1192
1363
  alertChannel: z2.enum(["email", "slack", "teams", "webhook"]),
1193
1364
  updatedAt: z2.string(),
@@ -1602,13 +1773,11 @@ var skillDeprecationsResponseSchema = z2.object({
1602
1773
  name: z2.string(),
1603
1774
  items: z2.array(skillDeprecationRecordSchema)
1604
1775
  }).passthrough();
1605
- var skillSecurityBreakdownFindingSchema = z2.record(jsonValueSchema);
1606
- var skillSecurityBreakdownSummarySchema = z2.record(jsonValueSchema);
1607
1776
  var skillSecurityBreakdownResponseSchema = z2.object({
1608
1777
  jobId: z2.string(),
1609
1778
  score: z2.number().nullable().optional(),
1610
- findings: z2.array(skillSecurityBreakdownFindingSchema).optional(),
1611
- summary: skillSecurityBreakdownSummarySchema.optional(),
1779
+ findings: z2.array(jsonValueSchema).optional(),
1780
+ summary: jsonValueSchema.optional(),
1612
1781
  generatedAt: z2.string().nullable().optional(),
1613
1782
  scannerVersion: z2.string().nullable().optional()
1614
1783
  }).passthrough();
@@ -4064,10 +4233,98 @@ async function registerOwnedMoltbookAgent(client, uaid, request) {
4064
4233
  }
4065
4234
 
4066
4235
  // ../../src/services/registry-broker/client/guard.ts
4236
+ function isStatusError(error) {
4237
+ if (error instanceof RegistryBrokerError) {
4238
+ return true;
4239
+ }
4240
+ if (typeof error !== "object" || error === null || !("status" in error)) {
4241
+ return false;
4242
+ }
4243
+ return typeof Reflect.get(error, "status") === "number";
4244
+ }
4245
+ function toPortalCanonicalGuardPath(path) {
4246
+ const segments = path.split("/");
4247
+ const findPatternStart = (size, matcher) => {
4248
+ for (let startIndex = segments.length - size; startIndex >= 0; startIndex -= 1) {
4249
+ if (matcher(startIndex)) {
4250
+ return startIndex;
4251
+ }
4252
+ }
4253
+ return -1;
4254
+ };
4255
+ const replaceAt = (startIndex, consumed) => [
4256
+ ...segments.slice(0, startIndex),
4257
+ "api",
4258
+ "guard",
4259
+ ...segments.slice(startIndex + consumed)
4260
+ ].join("/");
4261
+ const registryStart = findPatternStart(
4262
+ 4,
4263
+ (startIndex) => segments[startIndex] === "registry" && segments[startIndex + 1] === "api" && /^v\d+$/.test(segments[startIndex + 2] ?? "") && segments[startIndex + 3] === "guard"
4264
+ );
4265
+ if (registryStart >= 0) {
4266
+ return replaceAt(registryStart, 4);
4267
+ }
4268
+ const apiVersionStart = findPatternStart(
4269
+ 3,
4270
+ (startIndex) => segments[startIndex] === "api" && /^v\d+$/.test(segments[startIndex + 1] ?? "") && segments[startIndex + 2] === "guard"
4271
+ );
4272
+ if (apiVersionStart >= 0) {
4273
+ return replaceAt(apiVersionStart, 3);
4274
+ }
4275
+ for (let index = segments.length - 1; index >= 0; index -= 1) {
4276
+ if (segments[index] === "guard" && segments[index - 1] !== "api") {
4277
+ return [
4278
+ ...segments.slice(0, index),
4279
+ "api",
4280
+ "guard",
4281
+ ...segments.slice(index + 1)
4282
+ ].join("/");
4283
+ }
4284
+ }
4285
+ return path;
4286
+ }
4287
+ function buildPortalCanonicalGuardUrl(baseUrl, path) {
4288
+ const target = new URL(path, "https://guard.local");
4289
+ const normalizedBasePath = (() => {
4290
+ try {
4291
+ const base = new URL(baseUrl);
4292
+ return base.pathname.replace(/\/+$/, "");
4293
+ } catch {
4294
+ return baseUrl.replace(/\/+$/, "");
4295
+ }
4296
+ })();
4297
+ const requestedPath = `${normalizedBasePath}${target.pathname}`;
4298
+ const canonicalPath = toPortalCanonicalGuardPath(requestedPath);
4299
+ const canonicalRelativePath = `${canonicalPath}${target.search}`;
4300
+ try {
4301
+ const base = new URL(baseUrl);
4302
+ return `${base.origin}${canonicalRelativePath}`;
4303
+ } catch {
4304
+ return canonicalRelativePath;
4305
+ }
4306
+ }
4307
+ async function requestPortalFirstJson(client, path, init) {
4308
+ try {
4309
+ return await client.requestJson(path, init);
4310
+ } catch (error) {
4311
+ if (isStatusError(error) && (error.status === 404 || error.status === 501)) {
4312
+ return client.requestAbsoluteJson(
4313
+ buildPortalCanonicalGuardUrl(client.baseUrl, path),
4314
+ init
4315
+ );
4316
+ }
4317
+ throw error;
4318
+ }
4319
+ }
4067
4320
  async function getGuardSession(client) {
4068
- const raw = await client.requestJson("/guard/auth/session", {
4069
- method: "GET"
4070
- });
4321
+ const raw = await requestPortalFirstJson(
4322
+ client,
4323
+ "/guard/auth/session",
4324
+ {
4325
+ method: "GET"
4326
+ }
4327
+ );
4071
4328
  return client.parseWithSchema(
4072
4329
  raw,
4073
4330
  guardSessionResponseSchema,
@@ -4075,9 +4332,13 @@ async function getGuardSession(client) {
4075
4332
  );
4076
4333
  }
4077
4334
  async function getGuardEntitlements(client) {
4078
- const raw = await client.requestJson("/guard/entitlements", {
4079
- method: "GET"
4080
- });
4335
+ const raw = await requestPortalFirstJson(
4336
+ client,
4337
+ "/guard/entitlements",
4338
+ {
4339
+ method: "GET"
4340
+ }
4341
+ );
4081
4342
  return client.parseWithSchema(
4082
4343
  raw,
4083
4344
  guardSessionResponseSchema,
@@ -4085,21 +4346,60 @@ async function getGuardEntitlements(client) {
4085
4346
  );
4086
4347
  }
4087
4348
  async function getGuardBillingBalance(client) {
4088
- const raw = await client.requestJson("/guard/billing/balance", {
4089
- method: "GET"
4090
- });
4349
+ const raw = await requestPortalFirstJson(
4350
+ client,
4351
+ "/guard/billing/balance",
4352
+ {
4353
+ method: "GET"
4354
+ }
4355
+ );
4091
4356
  return client.parseWithSchema(
4092
4357
  raw,
4093
4358
  guardBalanceResponseSchema,
4094
4359
  "guard billing balance response"
4095
4360
  );
4096
4361
  }
4362
+ async function getGuardFeed(client, limit) {
4363
+ const params = new URLSearchParams();
4364
+ if (typeof limit === "number" && Number.isFinite(limit) && Math.trunc(limit) > 0) {
4365
+ params.set("limit", String(Math.trunc(limit)));
4366
+ }
4367
+ const query = params.toString();
4368
+ const suffix = query ? `?${query}` : "";
4369
+ const raw = await requestPortalFirstJson(
4370
+ client,
4371
+ `/guard/feed${suffix}`,
4372
+ {
4373
+ method: "GET"
4374
+ }
4375
+ );
4376
+ return client.parseWithSchema(
4377
+ raw,
4378
+ guardFeedResponseSchema,
4379
+ "guard feed response"
4380
+ );
4381
+ }
4382
+ async function getGuardOverview(client) {
4383
+ const raw = await requestPortalFirstJson(
4384
+ client,
4385
+ "/guard/overview",
4386
+ {
4387
+ method: "GET"
4388
+ }
4389
+ );
4390
+ return client.parseWithSchema(
4391
+ raw,
4392
+ guardOverviewResponseSchema,
4393
+ "guard overview response"
4394
+ );
4395
+ }
4097
4396
  async function getGuardTrustByHash(client, sha256) {
4098
4397
  const normalizedHash = sha256.trim();
4099
4398
  if (!normalizedHash) {
4100
4399
  throw new Error("sha256 is required");
4101
4400
  }
4102
- const raw = await client.requestJson(
4401
+ const raw = await requestPortalFirstJson(
4402
+ client,
4103
4403
  `/guard/trust/by-hash/${encodeURIComponent(normalizedHash)}`,
4104
4404
  { method: "GET" }
4105
4405
  );
@@ -4121,7 +4421,8 @@ async function resolveGuardTrust(client, query) {
4121
4421
  params.set("version", query.version.trim());
4122
4422
  }
4123
4423
  const suffix = params.size > 0 ? `?${params.toString()}` : "";
4124
- const raw = await client.requestJson(
4424
+ const raw = await requestPortalFirstJson(
4425
+ client,
4125
4426
  `/guard/trust/resolve${suffix}`,
4126
4427
  { method: "GET" }
4127
4428
  );
@@ -4132,19 +4433,55 @@ async function resolveGuardTrust(client, query) {
4132
4433
  );
4133
4434
  }
4134
4435
  async function getGuardRevocations(client) {
4135
- const raw = await client.requestJson("/guard/revocations", {
4136
- method: "GET"
4137
- });
4436
+ const raw = await requestPortalFirstJson(
4437
+ client,
4438
+ "/guard/revocations",
4439
+ {
4440
+ method: "GET"
4441
+ }
4442
+ );
4138
4443
  return client.parseWithSchema(
4139
4444
  raw,
4140
4445
  guardRevocationResponseSchema,
4141
4446
  "guard revocations response"
4142
4447
  );
4143
4448
  }
4449
+ async function fetchGuardAdvisories(client) {
4450
+ const raw = await requestPortalFirstJson(
4451
+ client,
4452
+ "/guard/advisories",
4453
+ {
4454
+ method: "GET"
4455
+ }
4456
+ );
4457
+ return client.parseWithSchema(
4458
+ raw,
4459
+ guardRevocationResponseSchema,
4460
+ "guard advisories response"
4461
+ );
4462
+ }
4463
+ async function fetchGuardPolicy(client) {
4464
+ const raw = await requestPortalFirstJson(
4465
+ client,
4466
+ "/guard/policy/fetch",
4467
+ {
4468
+ method: "GET"
4469
+ }
4470
+ );
4471
+ return client.parseWithSchema(
4472
+ raw,
4473
+ guardPolicySchema,
4474
+ "guard policy response"
4475
+ );
4476
+ }
4144
4477
  async function getGuardInventory(client) {
4145
- const raw = await client.requestJson("/guard/inventory", {
4146
- method: "GET"
4147
- });
4478
+ const raw = await requestPortalFirstJson(
4479
+ client,
4480
+ "/guard/inventory",
4481
+ {
4482
+ method: "GET"
4483
+ }
4484
+ );
4148
4485
  return client.parseWithSchema(
4149
4486
  raw,
4150
4487
  guardInventoryResponseSchema,
@@ -4152,9 +4489,13 @@ async function getGuardInventory(client) {
4152
4489
  );
4153
4490
  }
4154
4491
  async function getGuardReceiptHistory(client) {
4155
- const raw = await client.requestJson("/guard/history", {
4156
- method: "GET"
4157
- });
4492
+ const raw = await requestPortalFirstJson(
4493
+ client,
4494
+ "/guard/history",
4495
+ {
4496
+ method: "GET"
4497
+ }
4498
+ );
4158
4499
  return client.parseWithSchema(
4159
4500
  raw,
4160
4501
  guardReceiptHistoryResponseSchema,
@@ -4166,7 +4507,8 @@ async function getGuardArtifactTimeline(client, artifactId) {
4166
4507
  if (!normalizedArtifactId) {
4167
4508
  throw new Error("artifactId is required");
4168
4509
  }
4169
- const raw = await client.requestJson(
4510
+ const raw = await requestPortalFirstJson(
4511
+ client,
4170
4512
  `/guard/history/${encodeURIComponent(normalizedArtifactId)}`,
4171
4513
  { method: "GET" }
4172
4514
  );
@@ -4177,7 +4519,7 @@ async function getGuardArtifactTimeline(client, artifactId) {
4177
4519
  );
4178
4520
  }
4179
4521
  async function exportGuardAbom(client) {
4180
- const raw = await client.requestJson("/guard/abom", {
4522
+ const raw = await requestPortalFirstJson(client, "/guard/abom", {
4181
4523
  method: "GET"
4182
4524
  });
4183
4525
  return client.parseWithSchema(
@@ -4186,10 +4528,30 @@ async function exportGuardAbom(client) {
4186
4528
  "guard abom response"
4187
4529
  );
4188
4530
  }
4531
+ async function exportGuardArtifactAbom(client, artifactId) {
4532
+ const normalizedArtifactId = artifactId.trim();
4533
+ if (!normalizedArtifactId) {
4534
+ throw new Error("artifactId is required");
4535
+ }
4536
+ const raw = await requestPortalFirstJson(
4537
+ client,
4538
+ `/guard/abom/${encodeURIComponent(normalizedArtifactId)}`,
4539
+ { method: "GET" }
4540
+ );
4541
+ return client.parseWithSchema(
4542
+ raw,
4543
+ guardAbomResponseSchema,
4544
+ "guard artifact abom response"
4545
+ );
4546
+ }
4189
4547
  async function exportGuardReceipts(client) {
4190
- const raw = await client.requestJson("/guard/receipts/export", {
4191
- method: "GET"
4192
- });
4548
+ const raw = await requestPortalFirstJson(
4549
+ client,
4550
+ "/guard/receipts/export",
4551
+ {
4552
+ method: "GET"
4553
+ }
4554
+ );
4193
4555
  return client.parseWithSchema(
4194
4556
  raw,
4195
4557
  guardReceiptExportResponseSchema,
@@ -4197,9 +4559,13 @@ async function exportGuardReceipts(client) {
4197
4559
  );
4198
4560
  }
4199
4561
  async function getGuardInventoryDiff(client) {
4200
- const raw = await client.requestJson("/guard/inventory/diff", {
4201
- method: "GET"
4202
- });
4562
+ const raw = await requestPortalFirstJson(
4563
+ client,
4564
+ "/guard/inventory/diff",
4565
+ {
4566
+ method: "GET"
4567
+ }
4568
+ );
4203
4569
  return client.parseWithSchema(
4204
4570
  raw,
4205
4571
  guardInventoryDiffResponseSchema,
@@ -4207,9 +4573,13 @@ async function getGuardInventoryDiff(client) {
4207
4573
  );
4208
4574
  }
4209
4575
  async function getGuardDevices(client) {
4210
- const raw = await client.requestJson("/guard/devices", {
4211
- method: "GET"
4212
- });
4576
+ const raw = await requestPortalFirstJson(
4577
+ client,
4578
+ "/guard/devices",
4579
+ {
4580
+ method: "GET"
4581
+ }
4582
+ );
4213
4583
  return client.parseWithSchema(
4214
4584
  raw,
4215
4585
  guardDeviceListResponseSchema,
@@ -4217,9 +4587,13 @@ async function getGuardDevices(client) {
4217
4587
  );
4218
4588
  }
4219
4589
  async function getGuardAlertPreferences(client) {
4220
- const raw = await client.requestJson("/guard/alerts/preferences", {
4221
- method: "GET"
4222
- });
4590
+ const raw = await requestPortalFirstJson(
4591
+ client,
4592
+ "/guard/alerts/preferences",
4593
+ {
4594
+ method: "GET"
4595
+ }
4596
+ );
4223
4597
  return client.parseWithSchema(
4224
4598
  raw,
4225
4599
  guardAlertPreferencesSchema,
@@ -4227,10 +4601,14 @@ async function getGuardAlertPreferences(client) {
4227
4601
  );
4228
4602
  }
4229
4603
  async function updateGuardAlertPreferences(client, payload) {
4230
- const raw = await client.requestJson("/guard/alerts/preferences", {
4231
- method: "PUT",
4232
- body: payload
4233
- });
4604
+ const raw = await requestPortalFirstJson(
4605
+ client,
4606
+ "/guard/alerts/preferences",
4607
+ {
4608
+ method: "PUT",
4609
+ body: payload
4610
+ }
4611
+ );
4234
4612
  return client.parseWithSchema(
4235
4613
  raw,
4236
4614
  guardAlertPreferencesSchema,
@@ -4238,9 +4616,13 @@ async function updateGuardAlertPreferences(client, payload) {
4238
4616
  );
4239
4617
  }
4240
4618
  async function getGuardExceptions(client) {
4241
- const raw = await client.requestJson("/guard/exceptions", {
4242
- method: "GET"
4243
- });
4619
+ const raw = await requestPortalFirstJson(
4620
+ client,
4621
+ "/guard/exceptions",
4622
+ {
4623
+ method: "GET"
4624
+ }
4625
+ );
4244
4626
  return client.parseWithSchema(
4245
4627
  raw,
4246
4628
  guardExceptionListResponseSchema,
@@ -4248,20 +4630,126 @@ async function getGuardExceptions(client) {
4248
4630
  );
4249
4631
  }
4250
4632
  async function getGuardWatchlist(client) {
4251
- const raw = await client.requestJson("/guard/watchlist", {
4252
- method: "GET"
4253
- });
4633
+ const raw = await requestPortalFirstJson(
4634
+ client,
4635
+ "/guard/watchlist",
4636
+ {
4637
+ method: "GET"
4638
+ }
4639
+ );
4254
4640
  return client.parseWithSchema(
4255
4641
  raw,
4256
4642
  guardWatchlistResponseSchema,
4257
4643
  "guard watchlist response"
4258
4644
  );
4259
4645
  }
4260
- async function addGuardWatchlistItem(client, payload) {
4261
- const raw = await client.requestJson("/guard/watchlist", {
4646
+ async function lookupGuardWatchlist(client, payload) {
4647
+ const raw = await requestPortalFirstJson(
4648
+ client,
4649
+ "/guard/watchlist/lookup",
4650
+ {
4651
+ method: "POST",
4652
+ body: payload
4653
+ }
4654
+ );
4655
+ return client.parseWithSchema(
4656
+ raw,
4657
+ guardWatchlistLookupResponseSchema,
4658
+ "guard watchlist lookup response"
4659
+ );
4660
+ }
4661
+ async function getGuardPainSignals(client) {
4662
+ const raw = await requestPortalFirstJson(
4663
+ client,
4664
+ "/guard/signals/pain",
4665
+ {
4666
+ method: "GET"
4667
+ }
4668
+ );
4669
+ return client.parseWithSchema(
4670
+ raw,
4671
+ guardPainSignalListResponseSchema,
4672
+ "guard pain signals response"
4673
+ );
4674
+ }
4675
+ async function getGuardAggregatedPainSignals(client) {
4676
+ const raw = await requestPortalFirstJson(
4677
+ client,
4678
+ "/guard/signals/pain/aggregate",
4679
+ {
4680
+ method: "GET"
4681
+ }
4682
+ );
4683
+ return client.parseWithSchema(
4684
+ raw,
4685
+ guardPainSignalAggregateResponseSchema,
4686
+ "guard aggregated pain signals response"
4687
+ );
4688
+ }
4689
+ async function getGuardPreflightVerdict(client, path, payload) {
4690
+ const raw = await requestPortalFirstJson(client, path, {
4262
4691
  method: "POST",
4263
4692
  body: payload
4264
4693
  });
4694
+ return client.parseWithSchema(
4695
+ raw,
4696
+ guardPreflightVerdictResponseSchema,
4697
+ "guard preflight verdict response"
4698
+ );
4699
+ }
4700
+ async function getGuardPreInstallVerdict(client, payload) {
4701
+ return getGuardPreflightVerdict(
4702
+ client,
4703
+ "/guard/verdict/pre-install",
4704
+ payload
4705
+ );
4706
+ }
4707
+ async function getGuardPreExecutionVerdict(client, payload) {
4708
+ return getGuardPreflightVerdict(
4709
+ client,
4710
+ "/guard/verdict/pre-execution",
4711
+ payload
4712
+ );
4713
+ }
4714
+ async function ingestGuardPainSignals(client, items) {
4715
+ const raw = await requestPortalFirstJson(
4716
+ client,
4717
+ "/guard/signals/pain",
4718
+ {
4719
+ method: "POST",
4720
+ body: { items }
4721
+ }
4722
+ );
4723
+ return client.parseWithSchema(
4724
+ raw,
4725
+ guardPainSignalListResponseSchema,
4726
+ "guard pain signals response"
4727
+ );
4728
+ }
4729
+ async function submitGuardReceipts(client, payload) {
4730
+ const raw = await requestPortalFirstJson(
4731
+ client,
4732
+ "/guard/receipts/submit",
4733
+ {
4734
+ method: "POST",
4735
+ body: payload
4736
+ }
4737
+ );
4738
+ return client.parseWithSchema(
4739
+ raw,
4740
+ guardReceiptSyncResponseSchema,
4741
+ "guard receipt submit response"
4742
+ );
4743
+ }
4744
+ async function addGuardWatchlistItem(client, payload) {
4745
+ const raw = await requestPortalFirstJson(
4746
+ client,
4747
+ "/guard/watchlist",
4748
+ {
4749
+ method: "POST",
4750
+ body: payload
4751
+ }
4752
+ );
4265
4753
  return client.parseWithSchema(
4266
4754
  raw,
4267
4755
  guardWatchlistResponseSchema,
@@ -4273,7 +4761,8 @@ async function removeGuardWatchlistItem(client, artifactId) {
4273
4761
  if (!normalizedArtifactId) {
4274
4762
  throw new Error("artifactId is required");
4275
4763
  }
4276
- const raw = await client.requestJson(
4764
+ const raw = await requestPortalFirstJson(
4765
+ client,
4277
4766
  `/guard/watchlist/${encodeURIComponent(normalizedArtifactId)}`,
4278
4767
  { method: "DELETE" }
4279
4768
  );
@@ -4284,22 +4773,57 @@ async function removeGuardWatchlistItem(client, artifactId) {
4284
4773
  );
4285
4774
  }
4286
4775
  async function addGuardException(client, payload) {
4287
- const raw = await client.requestJson("/guard/exceptions", {
4288
- method: "POST",
4289
- body: payload
4290
- });
4776
+ const raw = await requestPortalFirstJson(
4777
+ client,
4778
+ "/guard/exceptions",
4779
+ {
4780
+ method: "POST",
4781
+ body: payload
4782
+ }
4783
+ );
4291
4784
  return client.parseWithSchema(
4292
4785
  raw,
4293
4786
  guardExceptionListResponseSchema,
4294
4787
  "guard exceptions response"
4295
4788
  );
4296
4789
  }
4790
+ async function requestGuardException(client, payload) {
4791
+ const raw = await requestPortalFirstJson(
4792
+ client,
4793
+ "/guard/exceptions/request",
4794
+ {
4795
+ method: "POST",
4796
+ body: payload
4797
+ }
4798
+ );
4799
+ return client.parseWithSchema(
4800
+ raw,
4801
+ guardExceptionListResponseSchema,
4802
+ "guard exception request response"
4803
+ );
4804
+ }
4805
+ async function syncGuardInventory(client, payload) {
4806
+ const raw = await requestPortalFirstJson(
4807
+ client,
4808
+ "/guard/inventory/sync",
4809
+ {
4810
+ method: "POST",
4811
+ body: payload
4812
+ }
4813
+ );
4814
+ return client.parseWithSchema(
4815
+ raw,
4816
+ guardReceiptSyncResponseSchema,
4817
+ "guard inventory sync response"
4818
+ );
4819
+ }
4297
4820
  async function removeGuardException(client, exceptionId) {
4298
4821
  const normalizedExceptionId = exceptionId.trim();
4299
4822
  if (!normalizedExceptionId) {
4300
4823
  throw new Error("exceptionId is required");
4301
4824
  }
4302
- const raw = await client.requestJson(
4825
+ const raw = await requestPortalFirstJson(
4826
+ client,
4303
4827
  `/guard/exceptions/${encodeURIComponent(normalizedExceptionId)}`,
4304
4828
  { method: "DELETE" }
4305
4829
  );
@@ -4310,9 +4834,13 @@ async function removeGuardException(client, exceptionId) {
4310
4834
  );
4311
4835
  }
4312
4836
  async function getGuardTeamPolicyPack(client) {
4313
- const raw = await client.requestJson("/guard/team/policy-pack", {
4314
- method: "GET"
4315
- });
4837
+ const raw = await requestPortalFirstJson(
4838
+ client,
4839
+ "/guard/team/policy-pack",
4840
+ {
4841
+ method: "GET"
4842
+ }
4843
+ );
4316
4844
  return client.parseWithSchema(
4317
4845
  raw,
4318
4846
  guardTeamPolicyPackSchema,
@@ -4320,10 +4848,14 @@ async function getGuardTeamPolicyPack(client) {
4320
4848
  );
4321
4849
  }
4322
4850
  async function updateGuardTeamPolicyPack(client, payload) {
4323
- const raw = await client.requestJson("/guard/team/policy-pack", {
4324
- method: "PUT",
4325
- body: payload
4326
- });
4851
+ const raw = await requestPortalFirstJson(
4852
+ client,
4853
+ "/guard/team/policy-pack",
4854
+ {
4855
+ method: "PUT",
4856
+ body: payload
4857
+ }
4858
+ );
4327
4859
  return client.parseWithSchema(
4328
4860
  raw,
4329
4861
  guardTeamPolicyPackSchema,
@@ -4331,10 +4863,14 @@ async function updateGuardTeamPolicyPack(client, payload) {
4331
4863
  );
4332
4864
  }
4333
4865
  async function syncGuardReceipts(client, payload) {
4334
- const raw = await client.requestJson("/guard/receipts/sync", {
4335
- method: "POST",
4336
- body: payload
4337
- });
4866
+ const raw = await requestPortalFirstJson(
4867
+ client,
4868
+ "/guard/receipts/sync",
4869
+ {
4870
+ method: "POST",
4871
+ body: payload
4872
+ }
4873
+ );
4338
4874
  return client.parseWithSchema(
4339
4875
  raw,
4340
4876
  guardReceiptSyncResponseSchema,
@@ -5670,7 +6206,7 @@ var RegistryBrokerClient = class _RegistryBrokerClient {
5670
6206
  const normalisedPath = path.startsWith("/") ? path : `/${path}`;
5671
6207
  return `${this.baseUrl}${normalisedPath}`;
5672
6208
  }
5673
- async request(path, config) {
6209
+ buildRequestInit(config) {
5674
6210
  const headers = new Headers();
5675
6211
  Object.entries(this.defaultHeaders).forEach(([key, value]) => {
5676
6212
  headers.set(key, value);
@@ -5696,6 +6232,10 @@ var RegistryBrokerClient = class _RegistryBrokerClient {
5696
6232
  headers.set("content-type", "application/json");
5697
6233
  }
5698
6234
  }
6235
+ return init;
6236
+ }
6237
+ async request(path, config) {
6238
+ const init = this.buildRequestInit(config);
5699
6239
  const response = await this.fetchImpl(this.buildUrl(path), init);
5700
6240
  if (response.ok) {
5701
6241
  return response;
@@ -5707,6 +6247,19 @@ var RegistryBrokerClient = class _RegistryBrokerClient {
5707
6247
  body: errorBody
5708
6248
  });
5709
6249
  }
6250
+ async requestAbsolute(url, config) {
6251
+ const init = this.buildRequestInit(config);
6252
+ const response = await this.fetchImpl(url, init);
6253
+ if (response.ok) {
6254
+ return response;
6255
+ }
6256
+ const errorBody = await this.extractErrorBody(response);
6257
+ throw new RegistryBrokerError("Registry broker request failed", {
6258
+ status: response.status,
6259
+ statusText: response.statusText,
6260
+ body: errorBody
6261
+ });
6262
+ }
5710
6263
  async requestJson(path, config) {
5711
6264
  const response = await this.request(path, config);
5712
6265
  const contentType = response.headers?.get("content-type") ?? "";
@@ -5719,6 +6272,18 @@ var RegistryBrokerClient = class _RegistryBrokerClient {
5719
6272
  }
5720
6273
  return await response.json();
5721
6274
  }
6275
+ async requestAbsoluteJson(url, config) {
6276
+ const response = await this.requestAbsolute(url, config);
6277
+ const contentType = response.headers?.get("content-type") ?? "";
6278
+ if (!JSON_CONTENT_TYPE.test(contentType)) {
6279
+ const body = await response.text();
6280
+ throw new RegistryBrokerParseError(
6281
+ "Expected JSON response from registry broker",
6282
+ body
6283
+ );
6284
+ }
6285
+ return await response.json();
6286
+ }
5722
6287
  async getAgentFeedback(uaid, options = {}) {
5723
6288
  const normalized = uaid.trim();
5724
6289
  if (!normalized) {
@@ -6157,6 +6722,12 @@ var RegistryBrokerClient = class _RegistryBrokerClient {
6157
6722
  async getGuardBillingBalance() {
6158
6723
  return getGuardBillingBalance(this);
6159
6724
  }
6725
+ async getGuardFeed(limit) {
6726
+ return getGuardFeed(this, limit);
6727
+ }
6728
+ async getGuardOverview() {
6729
+ return getGuardOverview(this);
6730
+ }
6160
6731
  async getGuardTrustByHash(sha256) {
6161
6732
  return getGuardTrustByHash(this, sha256);
6162
6733
  }
@@ -6166,6 +6737,12 @@ var RegistryBrokerClient = class _RegistryBrokerClient {
6166
6737
  async getGuardRevocations() {
6167
6738
  return getGuardRevocations(this);
6168
6739
  }
6740
+ async fetchGuardAdvisories() {
6741
+ return fetchGuardAdvisories(this);
6742
+ }
6743
+ async fetchGuardPolicy() {
6744
+ return fetchGuardPolicy(this);
6745
+ }
6169
6746
  async getGuardInventory() {
6170
6747
  return getGuardInventory(this);
6171
6748
  }
@@ -6181,6 +6758,9 @@ var RegistryBrokerClient = class _RegistryBrokerClient {
6181
6758
  async exportGuardAbom() {
6182
6759
  return exportGuardAbom(this);
6183
6760
  }
6761
+ async exportGuardArtifactAbom(artifactId) {
6762
+ return exportGuardArtifactAbom(this, artifactId);
6763
+ }
6184
6764
  async exportGuardReceipts() {
6185
6765
  return exportGuardReceipts(this);
6186
6766
  }
@@ -6199,6 +6779,21 @@ var RegistryBrokerClient = class _RegistryBrokerClient {
6199
6779
  async getGuardWatchlist() {
6200
6780
  return getGuardWatchlist(this);
6201
6781
  }
6782
+ async lookupGuardWatchlist(payload) {
6783
+ return lookupGuardWatchlist(this, payload);
6784
+ }
6785
+ async getGuardPainSignals() {
6786
+ return getGuardPainSignals(this);
6787
+ }
6788
+ async getGuardAggregatedPainSignals() {
6789
+ return getGuardAggregatedPainSignals(this);
6790
+ }
6791
+ async getGuardPreInstallVerdict(payload) {
6792
+ return getGuardPreInstallVerdict(this, payload);
6793
+ }
6794
+ async getGuardPreExecutionVerdict(payload) {
6795
+ return getGuardPreExecutionVerdict(this, payload);
6796
+ }
6202
6797
  async addGuardWatchlistItem(payload) {
6203
6798
  return addGuardWatchlistItem(this, payload);
6204
6799
  }
@@ -6208,12 +6803,24 @@ var RegistryBrokerClient = class _RegistryBrokerClient {
6208
6803
  async addGuardException(payload) {
6209
6804
  return addGuardException(this, payload);
6210
6805
  }
6806
+ async requestGuardException(payload) {
6807
+ return requestGuardException(this, payload);
6808
+ }
6211
6809
  async removeGuardException(exceptionId) {
6212
6810
  return removeGuardException(this, exceptionId);
6213
6811
  }
6812
+ async ingestGuardPainSignals(items) {
6813
+ return ingestGuardPainSignals(this, items);
6814
+ }
6214
6815
  async syncGuardReceipts(payload) {
6215
6816
  return syncGuardReceipts(this, payload);
6216
6817
  }
6818
+ async syncGuardInventory(payload) {
6819
+ return syncGuardInventory(this, payload);
6820
+ }
6821
+ async submitGuardReceipts(payload) {
6822
+ return submitGuardReceipts(this, payload);
6823
+ }
6217
6824
  async getGuardTeamPolicyPack() {
6218
6825
  return getGuardTeamPolicyPack(this);
6219
6826
  }
@@ -6602,6 +7209,10 @@ var isPendingRegisterAgentResponse = (response) => response.status === "pending"
6602
7209
  var isPartialRegisterAgentResponse = (response) => response.status === "partial" && response.success === false;
6603
7210
  var isSuccessRegisterAgentResponse = (response) => response.success === true && response.status !== "pending";
6604
7211
 
7212
+ // ../../src/services/registry-broker/types.ts
7213
+ var GUARD_CANONICAL_PATH_PREFIX = "/api/guard";
7214
+ var GUARD_COMPAT_PATH_PREFIX = "/guard";
7215
+
6605
7216
  // ../../src/services/registry-broker/hol-chat-ops.ts
6606
7217
  var HOL_CHAT_PROTOCOL_ID = "hol-chat";
6607
7218
  var isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
@@ -6658,6 +7269,8 @@ var buildJobStatusMessage = (input) => JSON.stringify({
6658
7269
  data: { job_id: input.jobId }
6659
7270
  });
6660
7271
  export {
7272
+ GUARD_CANONICAL_PATH_PREFIX,
7273
+ GUARD_COMPAT_PATH_PREFIX,
6661
7274
  HOL_CHAT_PROTOCOL_ID,
6662
7275
  RegistryBrokerClient,
6663
7276
  RegistryBrokerError,