@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.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,
@@ -975,10 +977,14 @@ var guardBucketBalanceSchema = import_zod2.z.object({
975
977
  });
976
978
  var guardPrincipalSchema = import_zod2.z.object({
977
979
  signedIn: import_zod2.z.boolean(),
980
+ principalType: import_zod2.z.enum(["user", "service"]).default("user"),
978
981
  userId: import_zod2.z.string().optional(),
979
982
  email: import_zod2.z.string().optional(),
980
983
  accountId: import_zod2.z.string().optional(),
981
984
  stripeCustomerId: import_zod2.z.string().optional(),
985
+ serviceId: import_zod2.z.string().optional(),
986
+ workspaceId: import_zod2.z.string().optional(),
987
+ serviceLabel: import_zod2.z.string().optional(),
982
988
  roles: import_zod2.z.array(import_zod2.z.string())
983
989
  });
984
990
  var guardEntitlementsSchema = import_zod2.z.object({
@@ -1005,6 +1011,65 @@ var guardBalanceResponseSchema = import_zod2.z.object({
1005
1011
  bucketingMode: import_zod2.z.enum(["shared-ledger", "product-bucketed"]),
1006
1012
  buckets: import_zod2.z.array(guardBucketBalanceSchema)
1007
1013
  });
1014
+ var guardFeedItemSchema = import_zod2.z.object({
1015
+ id: import_zod2.z.string(),
1016
+ artifactType: import_zod2.z.enum(["skill", "plugin"]),
1017
+ slug: import_zod2.z.string(),
1018
+ name: import_zod2.z.string(),
1019
+ href: import_zod2.z.string(),
1020
+ ecosystem: import_zod2.z.string().optional(),
1021
+ safetyScore: import_zod2.z.number().nullable().optional(),
1022
+ trustScore: import_zod2.z.number().nullable().optional(),
1023
+ verified: import_zod2.z.boolean(),
1024
+ recommendation: import_zod2.z.enum(["monitor", "review", "block"]),
1025
+ updatedAt: import_zod2.z.string()
1026
+ });
1027
+ var guardFeedSummarySchema = import_zod2.z.object({
1028
+ total: import_zod2.z.number(),
1029
+ monitorCount: import_zod2.z.number(),
1030
+ reviewCount: import_zod2.z.number(),
1031
+ blockCount: import_zod2.z.number()
1032
+ });
1033
+ var guardFeedResponseSchema = import_zod2.z.object({
1034
+ generatedAt: import_zod2.z.string(),
1035
+ items: import_zod2.z.array(guardFeedItemSchema),
1036
+ summary: guardFeedSummarySchema
1037
+ });
1038
+ var guardIntegrationSchema = import_zod2.z.object({
1039
+ id: import_zod2.z.enum(["openclaw", "hermes"]),
1040
+ name: import_zod2.z.string(),
1041
+ status: import_zod2.z.enum(["available", "planned"]),
1042
+ href: import_zod2.z.string().nullable(),
1043
+ summary: import_zod2.z.string()
1044
+ });
1045
+ var guardActionItemSchema = import_zod2.z.object({
1046
+ title: import_zod2.z.string(),
1047
+ description: import_zod2.z.string(),
1048
+ href: import_zod2.z.string()
1049
+ });
1050
+ var guardOverviewResponseSchema = import_zod2.z.object({
1051
+ generatedAt: import_zod2.z.string(),
1052
+ principal: guardPrincipalSchema,
1053
+ entitlements: guardEntitlementsSchema,
1054
+ balance: import_zod2.z.object({
1055
+ accountId: import_zod2.z.string(),
1056
+ availableCredits: import_zod2.z.number()
1057
+ }).nullable(),
1058
+ trustFeed: guardFeedResponseSchema,
1059
+ integrations: import_zod2.z.array(guardIntegrationSchema),
1060
+ actionItems: import_zod2.z.array(guardActionItemSchema)
1061
+ });
1062
+ var guardPolicySchema = import_zod2.z.object({
1063
+ mode: import_zod2.z.enum(["observe", "prompt", "enforce"]),
1064
+ defaultAction: import_zod2.z.enum(["allow", "warn", "block"]),
1065
+ unknownPublisherAction: import_zod2.z.enum(["review", "block", "allow"]),
1066
+ changedHashAction: import_zod2.z.enum(["allow", "warn", "require-reapproval", "block"]),
1067
+ newNetworkDomainAction: import_zod2.z.enum(["allow", "warn", "block"]),
1068
+ subprocessAction: import_zod2.z.enum(["allow", "warn", "block"]),
1069
+ telemetryEnabled: import_zod2.z.boolean(),
1070
+ syncEnabled: import_zod2.z.boolean(),
1071
+ updatedAt: import_zod2.z.string()
1072
+ });
1008
1073
  var guardTrustMatchSchema = import_zod2.z.object({
1009
1074
  artifactId: import_zod2.z.string(),
1010
1075
  artifactName: import_zod2.z.string(),
@@ -1040,7 +1105,13 @@ var guardRevocationSchema = import_zod2.z.object({
1040
1105
  artifactName: import_zod2.z.string(),
1041
1106
  reason: import_zod2.z.string(),
1042
1107
  severity: import_zod2.z.enum(["low", "medium", "high"]),
1043
- publishedAt: import_zod2.z.string()
1108
+ publishedAt: import_zod2.z.string(),
1109
+ confidence: import_zod2.z.number().optional(),
1110
+ remediation: import_zod2.z.string().nullable().optional(),
1111
+ scope: import_zod2.z.enum(["artifact", "publisher", "domain", "workspace", "ecosystem"]).optional(),
1112
+ source: import_zod2.z.string().optional(),
1113
+ firstSeenAt: import_zod2.z.string().optional(),
1114
+ lastUpdatedAt: import_zod2.z.string().optional()
1044
1115
  });
1045
1116
  var guardRevocationResponseSchema = import_zod2.z.object({
1046
1117
  generatedAt: import_zod2.z.string(),
@@ -1134,7 +1205,12 @@ var guardReceiptSyncResponseSchema = import_zod2.z.object({
1134
1205
  syncedAt: import_zod2.z.string(),
1135
1206
  receiptsStored: import_zod2.z.number(),
1136
1207
  inventoryStored: import_zod2.z.number().optional(),
1137
- inventoryDiff: guardInventoryDiffResponseSchema.optional()
1208
+ inventoryDiff: guardInventoryDiffResponseSchema.optional(),
1209
+ advisories: import_zod2.z.array(guardRevocationSchema).optional(),
1210
+ policy: guardPolicySchema.optional(),
1211
+ alertPreferences: import_zod2.z.lazy(() => guardAlertPreferencesSchema).optional(),
1212
+ exceptions: import_zod2.z.array(import_zod2.z.lazy(() => guardExceptionItemSchema)).optional(),
1213
+ teamPolicyPack: import_zod2.z.lazy(() => guardTeamPolicyPackSchema).optional()
1138
1214
  });
1139
1215
  var guardInventoryResponseSchema = import_zod2.z.object({
1140
1216
  generatedAt: import_zod2.z.string(),
@@ -1220,6 +1296,59 @@ var guardWatchlistResponseSchema = import_zod2.z.object({
1220
1296
  generatedAt: import_zod2.z.string(),
1221
1297
  items: import_zod2.z.array(guardWatchlistItemSchema)
1222
1298
  });
1299
+ var guardWatchlistLookupMatchSchema = import_zod2.z.object({
1300
+ artifactId: import_zod2.z.string().nullable(),
1301
+ publisher: import_zod2.z.string().nullable(),
1302
+ domain: import_zod2.z.string().nullable(),
1303
+ source: import_zod2.z.enum(["watchlist", "team-policy"]),
1304
+ reason: import_zod2.z.string()
1305
+ });
1306
+ var guardWatchlistLookupResponseSchema = import_zod2.z.object({
1307
+ generatedAt: import_zod2.z.string(),
1308
+ matched: import_zod2.z.boolean(),
1309
+ scope: import_zod2.z.enum(["artifact", "publisher", "domain", "none"]),
1310
+ item: guardWatchlistLookupMatchSchema.nullable()
1311
+ });
1312
+ var guardPainSignalSchema = import_zod2.z.object({
1313
+ signalId: import_zod2.z.string(),
1314
+ signalName: import_zod2.z.string(),
1315
+ artifactId: import_zod2.z.string(),
1316
+ artifactName: import_zod2.z.string(),
1317
+ artifactType: import_zod2.z.enum(["skill", "plugin"]),
1318
+ harness: import_zod2.z.string(),
1319
+ latestSummary: import_zod2.z.string(),
1320
+ firstSeenAt: import_zod2.z.string(),
1321
+ lastSeenAt: import_zod2.z.string(),
1322
+ count: import_zod2.z.number(),
1323
+ source: import_zod2.z.literal("scanner"),
1324
+ publisher: import_zod2.z.string().optional()
1325
+ });
1326
+ var guardPainSignalListResponseSchema = import_zod2.z.object({
1327
+ generatedAt: import_zod2.z.string(),
1328
+ items: import_zod2.z.array(guardPainSignalSchema)
1329
+ });
1330
+ var guardPainSignalAggregateSchema = import_zod2.z.object({
1331
+ artifactId: import_zod2.z.string(),
1332
+ artifactName: import_zod2.z.string(),
1333
+ artifactType: import_zod2.z.enum(["skill", "plugin"]),
1334
+ signalName: import_zod2.z.string(),
1335
+ latestSummary: import_zod2.z.string(),
1336
+ firstSeenAt: import_zod2.z.string(),
1337
+ lastSeenAt: import_zod2.z.string(),
1338
+ totalCount: import_zod2.z.number(),
1339
+ consumerCount: import_zod2.z.number(),
1340
+ harnesses: import_zod2.z.array(import_zod2.z.string()),
1341
+ publishers: import_zod2.z.array(import_zod2.z.string())
1342
+ });
1343
+ var guardPainSignalAggregateResponseSchema = import_zod2.z.object({
1344
+ generatedAt: import_zod2.z.string(),
1345
+ summary: import_zod2.z.object({
1346
+ totalSignals: import_zod2.z.number(),
1347
+ uniqueArtifacts: import_zod2.z.number(),
1348
+ uniqueConsumers: import_zod2.z.number()
1349
+ }),
1350
+ items: import_zod2.z.array(guardPainSignalAggregateSchema)
1351
+ });
1223
1352
  var guardExceptionItemSchema = import_zod2.z.object({
1224
1353
  exceptionId: import_zod2.z.string(),
1225
1354
  scope: import_zod2.z.enum(["artifact", "publisher", "harness", "global"]),
@@ -1237,6 +1366,45 @@ var guardExceptionListResponseSchema = import_zod2.z.object({
1237
1366
  generatedAt: import_zod2.z.string(),
1238
1367
  items: import_zod2.z.array(guardExceptionItemSchema)
1239
1368
  });
1369
+ var guardPreflightEvidenceSchema = import_zod2.z.object({
1370
+ category: import_zod2.z.enum([
1371
+ "policy",
1372
+ "trust",
1373
+ "watchlist",
1374
+ "team-policy",
1375
+ "exception"
1376
+ ]),
1377
+ source: import_zod2.z.string(),
1378
+ detail: import_zod2.z.string()
1379
+ });
1380
+ var guardPreflightRequestSchema = import_zod2.z.object({
1381
+ harness: import_zod2.z.string(),
1382
+ artifactName: import_zod2.z.string(),
1383
+ artifactType: import_zod2.z.enum(["skill", "plugin"]),
1384
+ artifactId: import_zod2.z.string().optional(),
1385
+ artifactSlug: import_zod2.z.string().optional(),
1386
+ artifactHash: import_zod2.z.string().optional(),
1387
+ publisher: import_zod2.z.string().optional(),
1388
+ domain: import_zod2.z.string().optional(),
1389
+ launchSummary: import_zod2.z.string().optional(),
1390
+ capabilities: import_zod2.z.array(import_zod2.z.string()).optional(),
1391
+ workspacePath: import_zod2.z.string().optional()
1392
+ });
1393
+ var guardPreflightVerdictResponseSchema = import_zod2.z.object({
1394
+ generatedAt: import_zod2.z.string(),
1395
+ principal: guardPrincipalSchema,
1396
+ decision: import_zod2.z.enum(["allow", "review", "block"]),
1397
+ recommendation: import_zod2.z.enum(["monitor", "review", "block"]),
1398
+ rationale: import_zod2.z.string(),
1399
+ category: import_zod2.z.enum(["exception", "team-policy", "watchlist", "trust", "policy"]).optional(),
1400
+ confidence: import_zod2.z.number().optional(),
1401
+ freshnessTimestamp: import_zod2.z.string().optional(),
1402
+ evidenceSources: import_zod2.z.array(import_zod2.z.string()).optional(),
1403
+ scope: import_zod2.z.enum(["artifact", "publisher", "domain", "policy"]),
1404
+ matchedEvidence: import_zod2.z.array(guardPreflightEvidenceSchema),
1405
+ matchedException: guardExceptionItemSchema.nullable(),
1406
+ trustMatch: guardTrustMatchSchema.nullable()
1407
+ });
1240
1408
  var guardTeamPolicyAuditItemSchema = import_zod2.z.object({
1241
1409
  changedAt: import_zod2.z.string(),
1242
1410
  actor: import_zod2.z.string(),
@@ -1245,8 +1413,13 @@ var guardTeamPolicyAuditItemSchema = import_zod2.z.object({
1245
1413
  });
1246
1414
  var guardTeamPolicyPackSchema = import_zod2.z.object({
1247
1415
  name: import_zod2.z.string(),
1248
- sharedHarnessDefaults: import_zod2.z.record(import_zod2.z.string(), import_zod2.z.enum(["observe", "prompt", "enforce"])),
1416
+ sharedHarnessDefaults: import_zod2.z.record(
1417
+ import_zod2.z.string(),
1418
+ import_zod2.z.enum(["observe", "prompt", "enforce"])
1419
+ ),
1249
1420
  allowedPublishers: import_zod2.z.array(import_zod2.z.string()),
1421
+ blockedPublishers: import_zod2.z.array(import_zod2.z.string()).optional(),
1422
+ blockedDomains: import_zod2.z.array(import_zod2.z.string()).optional(),
1250
1423
  blockedArtifacts: import_zod2.z.array(import_zod2.z.string()),
1251
1424
  alertChannel: import_zod2.z.enum(["email", "slack", "teams", "webhook"]),
1252
1425
  updatedAt: import_zod2.z.string(),
@@ -1661,13 +1834,11 @@ var skillDeprecationsResponseSchema = import_zod2.z.object({
1661
1834
  name: import_zod2.z.string(),
1662
1835
  items: import_zod2.z.array(skillDeprecationRecordSchema)
1663
1836
  }).passthrough();
1664
- var skillSecurityBreakdownFindingSchema = import_zod2.z.record(jsonValueSchema);
1665
- var skillSecurityBreakdownSummarySchema = import_zod2.z.record(jsonValueSchema);
1666
1837
  var skillSecurityBreakdownResponseSchema = import_zod2.z.object({
1667
1838
  jobId: import_zod2.z.string(),
1668
1839
  score: import_zod2.z.number().nullable().optional(),
1669
- findings: import_zod2.z.array(skillSecurityBreakdownFindingSchema).optional(),
1670
- summary: skillSecurityBreakdownSummarySchema.optional(),
1840
+ findings: import_zod2.z.array(jsonValueSchema).optional(),
1841
+ summary: jsonValueSchema.optional(),
1671
1842
  generatedAt: import_zod2.z.string().nullable().optional(),
1672
1843
  scannerVersion: import_zod2.z.string().nullable().optional()
1673
1844
  }).passthrough();
@@ -4124,10 +4295,98 @@ async function registerOwnedMoltbookAgent(client, uaid, request) {
4124
4295
  }
4125
4296
 
4126
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
+ }
4127
4382
  async function getGuardSession(client) {
4128
- const raw = await client.requestJson("/guard/auth/session", {
4129
- method: "GET"
4130
- });
4383
+ const raw = await requestPortalFirstJson(
4384
+ client,
4385
+ "/guard/auth/session",
4386
+ {
4387
+ method: "GET"
4388
+ }
4389
+ );
4131
4390
  return client.parseWithSchema(
4132
4391
  raw,
4133
4392
  guardSessionResponseSchema,
@@ -4135,9 +4394,13 @@ async function getGuardSession(client) {
4135
4394
  );
4136
4395
  }
4137
4396
  async function getGuardEntitlements(client) {
4138
- const raw = await client.requestJson("/guard/entitlements", {
4139
- method: "GET"
4140
- });
4397
+ const raw = await requestPortalFirstJson(
4398
+ client,
4399
+ "/guard/entitlements",
4400
+ {
4401
+ method: "GET"
4402
+ }
4403
+ );
4141
4404
  return client.parseWithSchema(
4142
4405
  raw,
4143
4406
  guardSessionResponseSchema,
@@ -4145,21 +4408,60 @@ async function getGuardEntitlements(client) {
4145
4408
  );
4146
4409
  }
4147
4410
  async function getGuardBillingBalance(client) {
4148
- const raw = await client.requestJson("/guard/billing/balance", {
4149
- method: "GET"
4150
- });
4411
+ const raw = await requestPortalFirstJson(
4412
+ client,
4413
+ "/guard/billing/balance",
4414
+ {
4415
+ method: "GET"
4416
+ }
4417
+ );
4151
4418
  return client.parseWithSchema(
4152
4419
  raw,
4153
4420
  guardBalanceResponseSchema,
4154
4421
  "guard billing balance response"
4155
4422
  );
4156
4423
  }
4424
+ async function getGuardFeed(client, limit) {
4425
+ const params = new URLSearchParams();
4426
+ if (typeof limit === "number" && Number.isFinite(limit) && Math.trunc(limit) > 0) {
4427
+ params.set("limit", String(Math.trunc(limit)));
4428
+ }
4429
+ const query = params.toString();
4430
+ const suffix = query ? `?${query}` : "";
4431
+ const raw = await requestPortalFirstJson(
4432
+ client,
4433
+ `/guard/feed${suffix}`,
4434
+ {
4435
+ method: "GET"
4436
+ }
4437
+ );
4438
+ return client.parseWithSchema(
4439
+ raw,
4440
+ guardFeedResponseSchema,
4441
+ "guard feed response"
4442
+ );
4443
+ }
4444
+ async function getGuardOverview(client) {
4445
+ const raw = await requestPortalFirstJson(
4446
+ client,
4447
+ "/guard/overview",
4448
+ {
4449
+ method: "GET"
4450
+ }
4451
+ );
4452
+ return client.parseWithSchema(
4453
+ raw,
4454
+ guardOverviewResponseSchema,
4455
+ "guard overview response"
4456
+ );
4457
+ }
4157
4458
  async function getGuardTrustByHash(client, sha256) {
4158
4459
  const normalizedHash = sha256.trim();
4159
4460
  if (!normalizedHash) {
4160
4461
  throw new Error("sha256 is required");
4161
4462
  }
4162
- const raw = await client.requestJson(
4463
+ const raw = await requestPortalFirstJson(
4464
+ client,
4163
4465
  `/guard/trust/by-hash/${encodeURIComponent(normalizedHash)}`,
4164
4466
  { method: "GET" }
4165
4467
  );
@@ -4181,7 +4483,8 @@ async function resolveGuardTrust(client, query) {
4181
4483
  params.set("version", query.version.trim());
4182
4484
  }
4183
4485
  const suffix = params.size > 0 ? `?${params.toString()}` : "";
4184
- const raw = await client.requestJson(
4486
+ const raw = await requestPortalFirstJson(
4487
+ client,
4185
4488
  `/guard/trust/resolve${suffix}`,
4186
4489
  { method: "GET" }
4187
4490
  );
@@ -4192,19 +4495,55 @@ async function resolveGuardTrust(client, query) {
4192
4495
  );
4193
4496
  }
4194
4497
  async function getGuardRevocations(client) {
4195
- const raw = await client.requestJson("/guard/revocations", {
4196
- method: "GET"
4197
- });
4498
+ const raw = await requestPortalFirstJson(
4499
+ client,
4500
+ "/guard/revocations",
4501
+ {
4502
+ method: "GET"
4503
+ }
4504
+ );
4198
4505
  return client.parseWithSchema(
4199
4506
  raw,
4200
4507
  guardRevocationResponseSchema,
4201
4508
  "guard revocations response"
4202
4509
  );
4203
4510
  }
4511
+ async function fetchGuardAdvisories(client) {
4512
+ const raw = await requestPortalFirstJson(
4513
+ client,
4514
+ "/guard/advisories",
4515
+ {
4516
+ method: "GET"
4517
+ }
4518
+ );
4519
+ return client.parseWithSchema(
4520
+ raw,
4521
+ guardRevocationResponseSchema,
4522
+ "guard advisories response"
4523
+ );
4524
+ }
4525
+ async function fetchGuardPolicy(client) {
4526
+ const raw = await requestPortalFirstJson(
4527
+ client,
4528
+ "/guard/policy/fetch",
4529
+ {
4530
+ method: "GET"
4531
+ }
4532
+ );
4533
+ return client.parseWithSchema(
4534
+ raw,
4535
+ guardPolicySchema,
4536
+ "guard policy response"
4537
+ );
4538
+ }
4204
4539
  async function getGuardInventory(client) {
4205
- const raw = await client.requestJson("/guard/inventory", {
4206
- method: "GET"
4207
- });
4540
+ const raw = await requestPortalFirstJson(
4541
+ client,
4542
+ "/guard/inventory",
4543
+ {
4544
+ method: "GET"
4545
+ }
4546
+ );
4208
4547
  return client.parseWithSchema(
4209
4548
  raw,
4210
4549
  guardInventoryResponseSchema,
@@ -4212,9 +4551,13 @@ async function getGuardInventory(client) {
4212
4551
  );
4213
4552
  }
4214
4553
  async function getGuardReceiptHistory(client) {
4215
- const raw = await client.requestJson("/guard/history", {
4216
- method: "GET"
4217
- });
4554
+ const raw = await requestPortalFirstJson(
4555
+ client,
4556
+ "/guard/history",
4557
+ {
4558
+ method: "GET"
4559
+ }
4560
+ );
4218
4561
  return client.parseWithSchema(
4219
4562
  raw,
4220
4563
  guardReceiptHistoryResponseSchema,
@@ -4226,7 +4569,8 @@ async function getGuardArtifactTimeline(client, artifactId) {
4226
4569
  if (!normalizedArtifactId) {
4227
4570
  throw new Error("artifactId is required");
4228
4571
  }
4229
- const raw = await client.requestJson(
4572
+ const raw = await requestPortalFirstJson(
4573
+ client,
4230
4574
  `/guard/history/${encodeURIComponent(normalizedArtifactId)}`,
4231
4575
  { method: "GET" }
4232
4576
  );
@@ -4237,7 +4581,7 @@ async function getGuardArtifactTimeline(client, artifactId) {
4237
4581
  );
4238
4582
  }
4239
4583
  async function exportGuardAbom(client) {
4240
- const raw = await client.requestJson("/guard/abom", {
4584
+ const raw = await requestPortalFirstJson(client, "/guard/abom", {
4241
4585
  method: "GET"
4242
4586
  });
4243
4587
  return client.parseWithSchema(
@@ -4246,10 +4590,30 @@ async function exportGuardAbom(client) {
4246
4590
  "guard abom response"
4247
4591
  );
4248
4592
  }
4593
+ async function exportGuardArtifactAbom(client, artifactId) {
4594
+ const normalizedArtifactId = artifactId.trim();
4595
+ if (!normalizedArtifactId) {
4596
+ throw new Error("artifactId is required");
4597
+ }
4598
+ const raw = await requestPortalFirstJson(
4599
+ client,
4600
+ `/guard/abom/${encodeURIComponent(normalizedArtifactId)}`,
4601
+ { method: "GET" }
4602
+ );
4603
+ return client.parseWithSchema(
4604
+ raw,
4605
+ guardAbomResponseSchema,
4606
+ "guard artifact abom response"
4607
+ );
4608
+ }
4249
4609
  async function exportGuardReceipts(client) {
4250
- const raw = await client.requestJson("/guard/receipts/export", {
4251
- method: "GET"
4252
- });
4610
+ const raw = await requestPortalFirstJson(
4611
+ client,
4612
+ "/guard/receipts/export",
4613
+ {
4614
+ method: "GET"
4615
+ }
4616
+ );
4253
4617
  return client.parseWithSchema(
4254
4618
  raw,
4255
4619
  guardReceiptExportResponseSchema,
@@ -4257,9 +4621,13 @@ async function exportGuardReceipts(client) {
4257
4621
  );
4258
4622
  }
4259
4623
  async function getGuardInventoryDiff(client) {
4260
- const raw = await client.requestJson("/guard/inventory/diff", {
4261
- method: "GET"
4262
- });
4624
+ const raw = await requestPortalFirstJson(
4625
+ client,
4626
+ "/guard/inventory/diff",
4627
+ {
4628
+ method: "GET"
4629
+ }
4630
+ );
4263
4631
  return client.parseWithSchema(
4264
4632
  raw,
4265
4633
  guardInventoryDiffResponseSchema,
@@ -4267,9 +4635,13 @@ async function getGuardInventoryDiff(client) {
4267
4635
  );
4268
4636
  }
4269
4637
  async function getGuardDevices(client) {
4270
- const raw = await client.requestJson("/guard/devices", {
4271
- method: "GET"
4272
- });
4638
+ const raw = await requestPortalFirstJson(
4639
+ client,
4640
+ "/guard/devices",
4641
+ {
4642
+ method: "GET"
4643
+ }
4644
+ );
4273
4645
  return client.parseWithSchema(
4274
4646
  raw,
4275
4647
  guardDeviceListResponseSchema,
@@ -4277,9 +4649,13 @@ async function getGuardDevices(client) {
4277
4649
  );
4278
4650
  }
4279
4651
  async function getGuardAlertPreferences(client) {
4280
- const raw = await client.requestJson("/guard/alerts/preferences", {
4281
- method: "GET"
4282
- });
4652
+ const raw = await requestPortalFirstJson(
4653
+ client,
4654
+ "/guard/alerts/preferences",
4655
+ {
4656
+ method: "GET"
4657
+ }
4658
+ );
4283
4659
  return client.parseWithSchema(
4284
4660
  raw,
4285
4661
  guardAlertPreferencesSchema,
@@ -4287,10 +4663,14 @@ async function getGuardAlertPreferences(client) {
4287
4663
  );
4288
4664
  }
4289
4665
  async function updateGuardAlertPreferences(client, payload) {
4290
- const raw = await client.requestJson("/guard/alerts/preferences", {
4291
- method: "PUT",
4292
- body: payload
4293
- });
4666
+ const raw = await requestPortalFirstJson(
4667
+ client,
4668
+ "/guard/alerts/preferences",
4669
+ {
4670
+ method: "PUT",
4671
+ body: payload
4672
+ }
4673
+ );
4294
4674
  return client.parseWithSchema(
4295
4675
  raw,
4296
4676
  guardAlertPreferencesSchema,
@@ -4298,9 +4678,13 @@ async function updateGuardAlertPreferences(client, payload) {
4298
4678
  );
4299
4679
  }
4300
4680
  async function getGuardExceptions(client) {
4301
- const raw = await client.requestJson("/guard/exceptions", {
4302
- method: "GET"
4303
- });
4681
+ const raw = await requestPortalFirstJson(
4682
+ client,
4683
+ "/guard/exceptions",
4684
+ {
4685
+ method: "GET"
4686
+ }
4687
+ );
4304
4688
  return client.parseWithSchema(
4305
4689
  raw,
4306
4690
  guardExceptionListResponseSchema,
@@ -4308,20 +4692,126 @@ async function getGuardExceptions(client) {
4308
4692
  );
4309
4693
  }
4310
4694
  async function getGuardWatchlist(client) {
4311
- const raw = await client.requestJson("/guard/watchlist", {
4312
- method: "GET"
4313
- });
4695
+ const raw = await requestPortalFirstJson(
4696
+ client,
4697
+ "/guard/watchlist",
4698
+ {
4699
+ method: "GET"
4700
+ }
4701
+ );
4314
4702
  return client.parseWithSchema(
4315
4703
  raw,
4316
4704
  guardWatchlistResponseSchema,
4317
4705
  "guard watchlist response"
4318
4706
  );
4319
4707
  }
4320
- async function addGuardWatchlistItem(client, payload) {
4321
- const raw = await client.requestJson("/guard/watchlist", {
4708
+ async function lookupGuardWatchlist(client, payload) {
4709
+ const raw = await requestPortalFirstJson(
4710
+ client,
4711
+ "/guard/watchlist/lookup",
4712
+ {
4713
+ method: "POST",
4714
+ body: payload
4715
+ }
4716
+ );
4717
+ return client.parseWithSchema(
4718
+ raw,
4719
+ guardWatchlistLookupResponseSchema,
4720
+ "guard watchlist lookup response"
4721
+ );
4722
+ }
4723
+ async function getGuardPainSignals(client) {
4724
+ const raw = await requestPortalFirstJson(
4725
+ client,
4726
+ "/guard/signals/pain",
4727
+ {
4728
+ method: "GET"
4729
+ }
4730
+ );
4731
+ return client.parseWithSchema(
4732
+ raw,
4733
+ guardPainSignalListResponseSchema,
4734
+ "guard pain signals response"
4735
+ );
4736
+ }
4737
+ async function getGuardAggregatedPainSignals(client) {
4738
+ const raw = await requestPortalFirstJson(
4739
+ client,
4740
+ "/guard/signals/pain/aggregate",
4741
+ {
4742
+ method: "GET"
4743
+ }
4744
+ );
4745
+ return client.parseWithSchema(
4746
+ raw,
4747
+ guardPainSignalAggregateResponseSchema,
4748
+ "guard aggregated pain signals response"
4749
+ );
4750
+ }
4751
+ async function getGuardPreflightVerdict(client, path, payload) {
4752
+ const raw = await requestPortalFirstJson(client, path, {
4322
4753
  method: "POST",
4323
4754
  body: payload
4324
4755
  });
4756
+ return client.parseWithSchema(
4757
+ raw,
4758
+ guardPreflightVerdictResponseSchema,
4759
+ "guard preflight verdict response"
4760
+ );
4761
+ }
4762
+ async function getGuardPreInstallVerdict(client, payload) {
4763
+ return getGuardPreflightVerdict(
4764
+ client,
4765
+ "/guard/verdict/pre-install",
4766
+ payload
4767
+ );
4768
+ }
4769
+ async function getGuardPreExecutionVerdict(client, payload) {
4770
+ return getGuardPreflightVerdict(
4771
+ client,
4772
+ "/guard/verdict/pre-execution",
4773
+ payload
4774
+ );
4775
+ }
4776
+ async function ingestGuardPainSignals(client, items) {
4777
+ const raw = await requestPortalFirstJson(
4778
+ client,
4779
+ "/guard/signals/pain",
4780
+ {
4781
+ method: "POST",
4782
+ body: { items }
4783
+ }
4784
+ );
4785
+ return client.parseWithSchema(
4786
+ raw,
4787
+ guardPainSignalListResponseSchema,
4788
+ "guard pain signals response"
4789
+ );
4790
+ }
4791
+ async function submitGuardReceipts(client, payload) {
4792
+ const raw = await requestPortalFirstJson(
4793
+ client,
4794
+ "/guard/receipts/submit",
4795
+ {
4796
+ method: "POST",
4797
+ body: payload
4798
+ }
4799
+ );
4800
+ return client.parseWithSchema(
4801
+ raw,
4802
+ guardReceiptSyncResponseSchema,
4803
+ "guard receipt submit response"
4804
+ );
4805
+ }
4806
+ async function addGuardWatchlistItem(client, payload) {
4807
+ const raw = await requestPortalFirstJson(
4808
+ client,
4809
+ "/guard/watchlist",
4810
+ {
4811
+ method: "POST",
4812
+ body: payload
4813
+ }
4814
+ );
4325
4815
  return client.parseWithSchema(
4326
4816
  raw,
4327
4817
  guardWatchlistResponseSchema,
@@ -4333,7 +4823,8 @@ async function removeGuardWatchlistItem(client, artifactId) {
4333
4823
  if (!normalizedArtifactId) {
4334
4824
  throw new Error("artifactId is required");
4335
4825
  }
4336
- const raw = await client.requestJson(
4826
+ const raw = await requestPortalFirstJson(
4827
+ client,
4337
4828
  `/guard/watchlist/${encodeURIComponent(normalizedArtifactId)}`,
4338
4829
  { method: "DELETE" }
4339
4830
  );
@@ -4344,22 +4835,57 @@ async function removeGuardWatchlistItem(client, artifactId) {
4344
4835
  );
4345
4836
  }
4346
4837
  async function addGuardException(client, payload) {
4347
- const raw = await client.requestJson("/guard/exceptions", {
4348
- method: "POST",
4349
- body: payload
4350
- });
4838
+ const raw = await requestPortalFirstJson(
4839
+ client,
4840
+ "/guard/exceptions",
4841
+ {
4842
+ method: "POST",
4843
+ body: payload
4844
+ }
4845
+ );
4351
4846
  return client.parseWithSchema(
4352
4847
  raw,
4353
4848
  guardExceptionListResponseSchema,
4354
4849
  "guard exceptions response"
4355
4850
  );
4356
4851
  }
4852
+ async function requestGuardException(client, payload) {
4853
+ const raw = await requestPortalFirstJson(
4854
+ client,
4855
+ "/guard/exceptions/request",
4856
+ {
4857
+ method: "POST",
4858
+ body: payload
4859
+ }
4860
+ );
4861
+ return client.parseWithSchema(
4862
+ raw,
4863
+ guardExceptionListResponseSchema,
4864
+ "guard exception request response"
4865
+ );
4866
+ }
4867
+ async function syncGuardInventory(client, payload) {
4868
+ const raw = await requestPortalFirstJson(
4869
+ client,
4870
+ "/guard/inventory/sync",
4871
+ {
4872
+ method: "POST",
4873
+ body: payload
4874
+ }
4875
+ );
4876
+ return client.parseWithSchema(
4877
+ raw,
4878
+ guardReceiptSyncResponseSchema,
4879
+ "guard inventory sync response"
4880
+ );
4881
+ }
4357
4882
  async function removeGuardException(client, exceptionId) {
4358
4883
  const normalizedExceptionId = exceptionId.trim();
4359
4884
  if (!normalizedExceptionId) {
4360
4885
  throw new Error("exceptionId is required");
4361
4886
  }
4362
- const raw = await client.requestJson(
4887
+ const raw = await requestPortalFirstJson(
4888
+ client,
4363
4889
  `/guard/exceptions/${encodeURIComponent(normalizedExceptionId)}`,
4364
4890
  { method: "DELETE" }
4365
4891
  );
@@ -4370,9 +4896,13 @@ async function removeGuardException(client, exceptionId) {
4370
4896
  );
4371
4897
  }
4372
4898
  async function getGuardTeamPolicyPack(client) {
4373
- const raw = await client.requestJson("/guard/team/policy-pack", {
4374
- method: "GET"
4375
- });
4899
+ const raw = await requestPortalFirstJson(
4900
+ client,
4901
+ "/guard/team/policy-pack",
4902
+ {
4903
+ method: "GET"
4904
+ }
4905
+ );
4376
4906
  return client.parseWithSchema(
4377
4907
  raw,
4378
4908
  guardTeamPolicyPackSchema,
@@ -4380,10 +4910,14 @@ async function getGuardTeamPolicyPack(client) {
4380
4910
  );
4381
4911
  }
4382
4912
  async function updateGuardTeamPolicyPack(client, payload) {
4383
- const raw = await client.requestJson("/guard/team/policy-pack", {
4384
- method: "PUT",
4385
- body: payload
4386
- });
4913
+ const raw = await requestPortalFirstJson(
4914
+ client,
4915
+ "/guard/team/policy-pack",
4916
+ {
4917
+ method: "PUT",
4918
+ body: payload
4919
+ }
4920
+ );
4387
4921
  return client.parseWithSchema(
4388
4922
  raw,
4389
4923
  guardTeamPolicyPackSchema,
@@ -4391,10 +4925,14 @@ async function updateGuardTeamPolicyPack(client, payload) {
4391
4925
  );
4392
4926
  }
4393
4927
  async function syncGuardReceipts(client, payload) {
4394
- const raw = await client.requestJson("/guard/receipts/sync", {
4395
- method: "POST",
4396
- body: payload
4397
- });
4928
+ const raw = await requestPortalFirstJson(
4929
+ client,
4930
+ "/guard/receipts/sync",
4931
+ {
4932
+ method: "POST",
4933
+ body: payload
4934
+ }
4935
+ );
4398
4936
  return client.parseWithSchema(
4399
4937
  raw,
4400
4938
  guardReceiptSyncResponseSchema,
@@ -5730,7 +6268,7 @@ var RegistryBrokerClient = class _RegistryBrokerClient {
5730
6268
  const normalisedPath = path.startsWith("/") ? path : `/${path}`;
5731
6269
  return `${this.baseUrl}${normalisedPath}`;
5732
6270
  }
5733
- async request(path, config) {
6271
+ buildRequestInit(config) {
5734
6272
  const headers = new Headers();
5735
6273
  Object.entries(this.defaultHeaders).forEach(([key, value]) => {
5736
6274
  headers.set(key, value);
@@ -5756,6 +6294,10 @@ var RegistryBrokerClient = class _RegistryBrokerClient {
5756
6294
  headers.set("content-type", "application/json");
5757
6295
  }
5758
6296
  }
6297
+ return init;
6298
+ }
6299
+ async request(path, config) {
6300
+ const init = this.buildRequestInit(config);
5759
6301
  const response = await this.fetchImpl(this.buildUrl(path), init);
5760
6302
  if (response.ok) {
5761
6303
  return response;
@@ -5767,6 +6309,19 @@ var RegistryBrokerClient = class _RegistryBrokerClient {
5767
6309
  body: errorBody
5768
6310
  });
5769
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
+ }
5770
6325
  async requestJson(path, config) {
5771
6326
  const response = await this.request(path, config);
5772
6327
  const contentType = response.headers?.get("content-type") ?? "";
@@ -5779,6 +6334,18 @@ var RegistryBrokerClient = class _RegistryBrokerClient {
5779
6334
  }
5780
6335
  return await response.json();
5781
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
+ }
5782
6349
  async getAgentFeedback(uaid, options = {}) {
5783
6350
  const normalized = uaid.trim();
5784
6351
  if (!normalized) {
@@ -6217,6 +6784,12 @@ var RegistryBrokerClient = class _RegistryBrokerClient {
6217
6784
  async getGuardBillingBalance() {
6218
6785
  return getGuardBillingBalance(this);
6219
6786
  }
6787
+ async getGuardFeed(limit) {
6788
+ return getGuardFeed(this, limit);
6789
+ }
6790
+ async getGuardOverview() {
6791
+ return getGuardOverview(this);
6792
+ }
6220
6793
  async getGuardTrustByHash(sha256) {
6221
6794
  return getGuardTrustByHash(this, sha256);
6222
6795
  }
@@ -6226,6 +6799,12 @@ var RegistryBrokerClient = class _RegistryBrokerClient {
6226
6799
  async getGuardRevocations() {
6227
6800
  return getGuardRevocations(this);
6228
6801
  }
6802
+ async fetchGuardAdvisories() {
6803
+ return fetchGuardAdvisories(this);
6804
+ }
6805
+ async fetchGuardPolicy() {
6806
+ return fetchGuardPolicy(this);
6807
+ }
6229
6808
  async getGuardInventory() {
6230
6809
  return getGuardInventory(this);
6231
6810
  }
@@ -6241,6 +6820,9 @@ var RegistryBrokerClient = class _RegistryBrokerClient {
6241
6820
  async exportGuardAbom() {
6242
6821
  return exportGuardAbom(this);
6243
6822
  }
6823
+ async exportGuardArtifactAbom(artifactId) {
6824
+ return exportGuardArtifactAbom(this, artifactId);
6825
+ }
6244
6826
  async exportGuardReceipts() {
6245
6827
  return exportGuardReceipts(this);
6246
6828
  }
@@ -6259,6 +6841,21 @@ var RegistryBrokerClient = class _RegistryBrokerClient {
6259
6841
  async getGuardWatchlist() {
6260
6842
  return getGuardWatchlist(this);
6261
6843
  }
6844
+ async lookupGuardWatchlist(payload) {
6845
+ return lookupGuardWatchlist(this, payload);
6846
+ }
6847
+ async getGuardPainSignals() {
6848
+ return getGuardPainSignals(this);
6849
+ }
6850
+ async getGuardAggregatedPainSignals() {
6851
+ return getGuardAggregatedPainSignals(this);
6852
+ }
6853
+ async getGuardPreInstallVerdict(payload) {
6854
+ return getGuardPreInstallVerdict(this, payload);
6855
+ }
6856
+ async getGuardPreExecutionVerdict(payload) {
6857
+ return getGuardPreExecutionVerdict(this, payload);
6858
+ }
6262
6859
  async addGuardWatchlistItem(payload) {
6263
6860
  return addGuardWatchlistItem(this, payload);
6264
6861
  }
@@ -6268,12 +6865,24 @@ var RegistryBrokerClient = class _RegistryBrokerClient {
6268
6865
  async addGuardException(payload) {
6269
6866
  return addGuardException(this, payload);
6270
6867
  }
6868
+ async requestGuardException(payload) {
6869
+ return requestGuardException(this, payload);
6870
+ }
6271
6871
  async removeGuardException(exceptionId) {
6272
6872
  return removeGuardException(this, exceptionId);
6273
6873
  }
6874
+ async ingestGuardPainSignals(items) {
6875
+ return ingestGuardPainSignals(this, items);
6876
+ }
6274
6877
  async syncGuardReceipts(payload) {
6275
6878
  return syncGuardReceipts(this, payload);
6276
6879
  }
6880
+ async syncGuardInventory(payload) {
6881
+ return syncGuardInventory(this, payload);
6882
+ }
6883
+ async submitGuardReceipts(payload) {
6884
+ return submitGuardReceipts(this, payload);
6885
+ }
6277
6886
  async getGuardTeamPolicyPack() {
6278
6887
  return getGuardTeamPolicyPack(this);
6279
6888
  }
@@ -6662,6 +7271,10 @@ var isPendingRegisterAgentResponse = (response) => response.status === "pending"
6662
7271
  var isPartialRegisterAgentResponse = (response) => response.status === "partial" && response.success === false;
6663
7272
  var isSuccessRegisterAgentResponse = (response) => response.success === true && response.status !== "pending";
6664
7273
 
7274
+ // ../../src/services/registry-broker/types.ts
7275
+ var GUARD_CANONICAL_PATH_PREFIX = "/api/guard";
7276
+ var GUARD_COMPAT_PATH_PREFIX = "/guard";
7277
+
6665
7278
  // ../../src/services/registry-broker/hol-chat-ops.ts
6666
7279
  var HOL_CHAT_PROTOCOL_ID = "hol-chat";
6667
7280
  var isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
@@ -6719,6 +7332,8 @@ var buildJobStatusMessage = (input) => JSON.stringify({
6719
7332
  });
6720
7333
  // Annotate the CommonJS export names for ESM import in node:
6721
7334
  0 && (module.exports = {
7335
+ GUARD_CANONICAL_PATH_PREFIX,
7336
+ GUARD_COMPAT_PATH_PREFIX,
6722
7337
  HOL_CHAT_PROTOCOL_ID,
6723
7338
  RegistryBrokerClient,
6724
7339
  RegistryBrokerError,