@nekro-nxt/contracts 0.1.0 → 0.3.0

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.mjs CHANGED
@@ -523,10 +523,10 @@ const configSchema = {
523
523
  //#region src/extension-capabilities.ts
524
524
  /**
525
525
  * Host capability level this build implements. A Revision that declares `requires.sdk` above it is rejected at
526
- * import with an "upgrade NekroNXT" message instead of an opaque schema error. Bump only when a new optional
527
- * Manifest capability ships; never reuse a level for a different meaning.
526
+ * import with an "upgrade NekroNXT" message instead of an opaque schema error. Bump when a Manifest capability
527
+ * ships; never reuse a level for a different meaning. Level 7 is Manifest V7 (host instance + agent attachments).
528
528
  */
529
- const EXTENSION_SDK_LEVEL = 6;
529
+ const EXTENSION_SDK_LEVEL = 7;
530
530
  const ExtensionRequiresSchema = z.object({ sdk: z.number().int().min(1).max(1e3) }).strict();
531
531
  /** `api.example.com` or `*.example.com` (subdomains only); lower-case DNS labels, no scheme, port or path. */
532
532
  const ExtensionNetworkDomainSchema = z.string().trim().toLowerCase().max(253).regex(/^(\*\.)?(?=.{1,253}$)([a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)(\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+$/u, { message: "网络域名必须是 api.example.com 或 *.example.com 形式,不含协议、端口和路径。" });
@@ -657,8 +657,8 @@ const mcpTarget = (server) => server.transport === "stdio" ? JSON.stringify([
657
657
  server.url
658
658
  ]);
659
659
  /**
660
- * Optional Host capabilities of an agent-scope Revision. Every field is additive to Manifest V6: an absent field
661
- * means the Revision cannot use that capability, exactly as before the field existed.
660
+ * Agent-layer capabilities (`permissions.agent`): what the extension may do inside the agents it is enabled for. An
661
+ * absent field means the extension cannot use that capability.
662
662
  */
663
663
  const ExtensionCapabilitiesSchema = z.object({
664
664
  network: ExtensionNetworkCapabilitySchema.optional(),
@@ -672,6 +672,22 @@ const ExtensionCapabilitiesSchema = z.object({
672
672
  mcp: ExtensionMcpCapabilitySchema.optional(),
673
673
  context: z.array(ExtensionContextContributionSchema).max(8).refine((value) => new Set(value.map(({ name }) => name)).size === value.length, "上下文名称不能重复。").optional()
674
674
  }).strict();
675
+ /**
676
+ * Host-layer capabilities (`permissions.host`): what the extension's single host instance may do through the `nxt`
677
+ * service its factory receives. Host storage is the extension's `shared` partition.
678
+ */
679
+ const HostLayerCapabilitiesSchema = z.object({
680
+ network: ExtensionNetworkCapabilitySchema.optional(),
681
+ storage: z.object({ quotaBytes: z.number().int().min(1024).max(EXTENSION_STORAGE_MAX_QUOTA_BYTES).optional() }).strict().optional()
682
+ }).strict();
683
+ /** Host-layer capabilities in the agent-capability shape, so digests, expansion and summaries share one implementation. */
684
+ const hostLayerAsCapabilities = (host) => host === void 0 || Object.keys(host).length === 0 ? void 0 : {
685
+ ...host.network === void 0 ? {} : { network: host.network },
686
+ ...host.storage === void 0 ? {} : { storage: {
687
+ scopes: ["shared"],
688
+ ...host.storage.quotaBytes === void 0 ? {} : { quotaBytes: host.storage.quotaBytes }
689
+ } }
690
+ };
675
691
  const NETWORK_MODE_RANK = {
676
692
  domains: 0,
677
693
  config: 1,
@@ -709,8 +725,11 @@ const extensionCapabilitiesExpand = (previous, next) => {
709
725
  if (next.llm !== void 0 && (previous?.llm === void 0 || next.llm.maxCallsPerTurn > previous.llm.maxCallsPerTurn || next.llm.maxOutputTokens > previous.llm.maxOutputTokens)) return true;
710
726
  return false;
711
727
  };
712
- /** User-facing summary of declared capabilities, in a stable order, for approval and inspection pages. */
713
- const summarizeExtensionCapabilities = (capabilities) => {
728
+ /**
729
+ * User-facing summary of declared capabilities, in a stable order, for approval and inspection pages. `layer: 'host'`
730
+ * phrases host-layer capabilities (passed through {@link hostLayerAsCapabilities}) for the host instance.
731
+ */
732
+ const summarizeExtensionCapabilities = (capabilities, options = {}) => {
714
733
  if (capabilities === void 0) return [];
715
734
  const items = [];
716
735
  const network = capabilities.network;
@@ -724,7 +743,7 @@ const summarizeExtensionCapabilities = (capabilities) => {
724
743
  key: "network",
725
744
  risk: "normal",
726
745
  label: "访问你在配置中填写的地址",
727
- detail: network.fields.join("、")
746
+ detail: network.fields.map((field) => options.fieldTitle?.(field) ?? field).join("、")
728
747
  });
729
748
  else if (network?.mode === "unrestricted") items.push({
730
749
  key: "network",
@@ -732,7 +751,12 @@ const summarizeExtensionCapabilities = (capabilities) => {
732
751
  label: "访问任意公网地址",
733
752
  detail: network.purpose
734
753
  });
735
- if (capabilities.storage !== void 0) {
754
+ if (capabilities.storage !== void 0 && options.layer === "host") items.push({
755
+ key: "storage",
756
+ risk: "normal",
757
+ label: "在本机保存扩展数据,页面与启用它的智能体共用"
758
+ });
759
+ else if (capabilities.storage !== void 0) {
736
760
  const shared = capabilities.storage.scopes.includes("shared");
737
761
  items.push({
738
762
  key: "storage",
@@ -904,8 +928,14 @@ const HostPageContributionSchema = z.object({
904
928
  description: z.string().trim().max(120).optional(),
905
929
  icon: HostPageIconSchema,
906
930
  objectPane: z.enum(["navigation", "hidden"]),
907
- startPath: z.string().trim().regex(/^(?:[a-z0-9][a-z0-9/_-]*)?$/u)
931
+ startPath: z.string().trim().regex(/^(?:[a-z0-9][a-z0-9/_-]*)?$/u),
932
+ /** Registers a navigation rail entry for this page; at most one page of an extension may declare it. */
933
+ rail: z.object({ order: z.number().int().min(0).max(999).optional() }).strict().optional()
908
934
  }).strict();
935
+ /** Rail position of a page that registers a rail entry without an explicit order. */
936
+ const HOST_PAGE_DEFAULT_RAIL_ORDER = 100;
937
+ /** The stored rail position of a page; `null` when the page has no rail entry. */
938
+ const hostPageRailOrder = (page) => page.rail === void 0 ? null : page.rail.order ?? 100;
909
939
  const HostUiNavigationItemSchema = z.object({
910
940
  id: z.string().trim().min(1).max(80),
911
941
  label: z.string().trim().min(1).max(80),
@@ -949,12 +979,7 @@ const HostUiNetworkOriginSchema = z.string().url().transform((value, context) =>
949
979
  }
950
980
  return url.origin;
951
981
  });
952
- const HostUiPermissionDeclarationSchema = z.object({
953
- permissions: z.array(HostUiPermissionSchema).max(HostUiPermissionSchema.options.length),
954
- networkOrigins: z.array(HostUiNetworkOriginSchema).max(32).default([]),
955
- /** Host capabilities of an agent-scope Revision; absent keeps the pre-capability digest unchanged. */
956
- capabilities: ExtensionCapabilitiesSchema.optional()
957
- }).strict().superRefine((value, context) => {
982
+ const checkBrowserPermissions = (value, context) => {
958
983
  if (new Set(value.permissions).size !== value.permissions.length) context.addIssue({
959
984
  code: "custom",
960
985
  path: ["permissions"],
@@ -970,6 +995,44 @@ const HostUiPermissionDeclarationSchema = z.object({
970
995
  path: ["networkOrigins"],
971
996
  message: "Host UI network origins require network.request."
972
997
  });
998
+ };
999
+ /**
1000
+ * One approval: browser-side permissions plus the capabilities of one layer. Grants, digests and the approval page
1001
+ * use this shape for both the host approval and each agent approval.
1002
+ */
1003
+ const HostUiPermissionDeclarationSchema = z.object({
1004
+ permissions: z.array(HostUiPermissionSchema).max(HostUiPermissionSchema.options.length),
1005
+ networkOrigins: z.array(HostUiNetworkOriginSchema).max(32).default([]),
1006
+ capabilities: ExtensionCapabilitiesSchema.optional()
1007
+ }).strict().superRefine(checkBrowserPermissions);
1008
+ /**
1009
+ * Manifest V7 `permissions`: browser-side permissions of pages and panels (`host.call`), host-layer capabilities used
1010
+ * by the single host instance, and agent-layer capabilities used inside each enabled agent.
1011
+ */
1012
+ const ExtensionPermissionsSchema = z.object({
1013
+ permissions: z.array(HostUiPermissionSchema).max(HostUiPermissionSchema.options.length).default([]),
1014
+ networkOrigins: z.array(HostUiNetworkOriginSchema).max(32).default([]),
1015
+ host: HostLayerCapabilitiesSchema.optional(),
1016
+ agent: ExtensionCapabilitiesSchema.optional()
1017
+ }).strict().superRefine(checkBrowserPermissions);
1018
+ const EMPTY_EXTENSION_PERMISSIONS = {
1019
+ permissions: [],
1020
+ networkOrigins: []
1021
+ };
1022
+ /** What installing the extension on this machine asks the user to approve. */
1023
+ const hostPermissionDeclaration = (permissions) => {
1024
+ const capabilities = hostLayerAsCapabilities(permissions.host);
1025
+ return {
1026
+ permissions: [...permissions.permissions],
1027
+ networkOrigins: [...permissions.networkOrigins],
1028
+ ...capabilities === void 0 ? {} : { capabilities }
1029
+ };
1030
+ };
1031
+ /** What enabling the extension for one agent asks the user to approve. */
1032
+ const agentPermissionDeclaration = (permissions) => ({
1033
+ permissions: [],
1034
+ networkOrigins: [],
1035
+ ...permissions.agent === void 0 || Object.keys(permissions.agent).length === 0 ? {} : { capabilities: permissions.agent }
973
1036
  });
974
1037
  const HostUiOwnerSchema = z.discriminatedUnion("kind", [z.object({
975
1038
  kind: z.literal("extension"),
@@ -991,6 +1054,8 @@ const HostUiPageEntrySchema = z.object({
991
1054
  startPath: z.string(),
992
1055
  visible: z.boolean(),
993
1056
  sortOrder: z.number().int().nonnegative(),
1057
+ /** Present when the page registered a navigation rail entry; lower orders come first. */
1058
+ rail: z.object({ order: z.number().int().min(0).max(999) }).strict().optional(),
994
1059
  routeBase: z.string().regex(/^\/apps\/hup_[0-9A-Za-z]+$/u),
995
1060
  client: z.object({
996
1061
  moduleUrl: z.string().startsWith("/"),
@@ -1035,12 +1100,17 @@ const ExtensionPanelAnchorSchema = z.enum([
1035
1100
  "extension",
1036
1101
  "connection"
1037
1102
  ]);
1038
- const AGENT_PANEL_ANCHORS = [
1039
- "agent",
1040
- "channel",
1041
- "extension"
1042
- ];
1043
- const ADAPTER_PANEL_ANCHORS = ["connection", "channel"];
1103
+ /**
1104
+ * Which layer a panel belongs to. Agent and channel panels follow the agents the extension is enabled for (a channel
1105
+ * panel also shows on channels of the extension's own adapter); extension and connection panels belong to the host
1106
+ * instance.
1107
+ */
1108
+ const PANEL_ANCHOR_LAYER = {
1109
+ agent: "agent",
1110
+ channel: "agent",
1111
+ extension: "host",
1112
+ connection: "host"
1113
+ };
1044
1114
  const PanelDensitySchema = z.enum(["compact", "full"]);
1045
1115
  const ConnectionPanelRoleSchema = z.enum([
1046
1116
  "setup",
@@ -1103,8 +1173,21 @@ const MessageRendererContributionSchema = z.object({
1103
1173
  kind: z.literal("message-renderer"),
1104
1174
  richKind: RichKindSchema
1105
1175
  }).strict();
1106
- /** Optional configuration surface shared by every extension scope. */
1176
+ /** What an extension provides, derived from its Manifest; for listing and filtering, never a lifecycle switch. */
1177
+ const EXTENSION_PROVIDES = [
1178
+ "agent",
1179
+ "page",
1180
+ "adapter",
1181
+ "mcp"
1182
+ ];
1183
+ const ExtensionProvideSchema = z.enum(EXTENSION_PROVIDES);
1184
+ /** One configuration form: a serialized Schemastery document. */
1107
1185
  const ExtensionConfigDeclarationSchema = z.object({ schema: ConfigSchemaDocumentSchema }).strict();
1186
+ /** Manifest V7 `config`: the host instance's configuration and each enabled agent's configuration. */
1187
+ const ExtensionLayeredConfigSchema = z.object({
1188
+ host: ExtensionConfigDeclarationSchema.optional(),
1189
+ agent: ExtensionConfigDeclarationSchema.optional()
1190
+ }).strict();
1108
1191
  /** Product projection of what one Revision contributes to the shell. */
1109
1192
  const ExtensionUiContributionsSchema = z.object({
1110
1193
  panels: z.array(PanelContributionSchema).max(16),
@@ -1285,23 +1368,126 @@ const COMMUNITY_REVIEW_STATUSES = [
1285
1368
  "incomplete"
1286
1369
  ];
1287
1370
  const CommunityReviewStatusSchema = z.enum(COMMUNITY_REVIEW_STATUSES);
1288
- const CommunityGradeSchema = z.enum([
1289
- "A",
1290
- "B",
1291
- "C",
1292
- "D"
1371
+ /** 社区评级的六个维度(审查标准 v1),从正上方顺时针排列成六边形。 */
1372
+ const COMMUNITY_RATING_DIMENSIONS = [
1373
+ "security",
1374
+ "openness",
1375
+ "reliability",
1376
+ "lightweight",
1377
+ "usability",
1378
+ "craft"
1379
+ ];
1380
+ const COMMUNITY_RATING_DIMENSION_LABELS = {
1381
+ security: "安全",
1382
+ openness: "开放",
1383
+ reliability: "稳定",
1384
+ lightweight: "轻量",
1385
+ usability: "易用",
1386
+ craft: "工艺"
1387
+ };
1388
+ /** 社区的审查员,评级与审查记录以她署名。 */
1389
+ const COMMUNITY_REVIEWER_NAME = "小澄";
1390
+ /** 社区判定的达成标签;不认识的标签不显示。扩展页面最多显示 {@link COMMUNITY_RATING_BADGE_LIMIT} 个。 */
1391
+ const COMMUNITY_RATING_BADGES = {
1392
+ "zero-permission": {
1393
+ label: "零权限",
1394
+ description: "没有申请任何权限。"
1395
+ },
1396
+ "least-privilege": {
1397
+ label: "最小权限",
1398
+ description: "声明的每项能力都用得上,安全满星。"
1399
+ },
1400
+ "no-network": {
1401
+ label: "不联网",
1402
+ description: "不访问任何网络。"
1403
+ },
1404
+ "scoped-network": {
1405
+ label: "限定地址联网",
1406
+ description: "只访问指定域名或用户在配置中填写的地址。"
1407
+ },
1408
+ "managed-secrets": {
1409
+ label: "凭据托管",
1410
+ description: "凭据都是配置中的凭据字段,经宿主读取,没有写进源码。"
1411
+ },
1412
+ "readable-source": {
1413
+ label: "源码可读",
1414
+ description: "没有混淆、压缩或内嵌大段编码内容。"
1415
+ },
1416
+ "open-source": {
1417
+ label: "开源",
1418
+ description: "填写了公开的源码仓库。"
1419
+ },
1420
+ "readable-errors": {
1421
+ label: "错误可读",
1422
+ description: "失败时都返回给用户看的说明,稳定满星。"
1423
+ },
1424
+ "stable-context": {
1425
+ label: "上下文稳定",
1426
+ description: "不占上下文,或注入的上下文稳定、不破坏提示缓存。"
1427
+ },
1428
+ "complete-docs": {
1429
+ label: "说明完整",
1430
+ description: "有图标和介绍,易用至少四星。"
1431
+ }
1432
+ };
1433
+ const COMMUNITY_RATING_BADGE_LIMIT = 4;
1434
+ /** 一次发布的评级:六维星级、综合评分(各维度平均,保留一位小数)与达成标签。 */
1435
+ const CommunityRatingSchema = z.object({
1436
+ standard: z.string().max(20),
1437
+ score: z.number().min(1).max(5),
1438
+ dimensions: z.array(z.object({
1439
+ key: z.string().max(40),
1440
+ stars: z.number().int().min(1).max(5),
1441
+ headline: z.string().max(200),
1442
+ cap: z.string().max(200).optional()
1443
+ })).max(16),
1444
+ badges: z.array(z.string().max(40)).max(32)
1445
+ });
1446
+ /** 市场的排序方式。 */
1447
+ const COMMUNITY_EXTENSION_SORTS = [
1448
+ {
1449
+ key: "updated",
1450
+ label: "最近更新"
1451
+ },
1452
+ {
1453
+ key: "score",
1454
+ label: "综合评分"
1455
+ },
1456
+ {
1457
+ key: "downloads",
1458
+ label: "下载最多"
1459
+ },
1460
+ {
1461
+ key: "newest",
1462
+ label: "最新上架"
1463
+ }
1464
+ ];
1465
+ const CommunityExtensionSortSchema = z.enum([
1466
+ "updated",
1467
+ "score",
1468
+ "downloads",
1469
+ "newest"
1293
1470
  ]);
1294
1471
  const CommunityReleaseIdSchema = z.string().regex(/^rel_[0-9A-Za-z]+$/u);
1295
1472
  const CommunityAccountSchema = z.object({
1296
1473
  handle: z.string().min(1).max(80),
1297
1474
  displayName: z.string().max(200),
1298
1475
  avatarUrl: z.string().url().nullable()
1299
- }).strict();
1476
+ });
1477
+ const CommunityEnvironmentSchema = z.enum([
1478
+ "production",
1479
+ "staging",
1480
+ "development"
1481
+ ]);
1300
1482
  const CommunityStatusSchema = z.object({
1301
1483
  communityUrl: z.string().url(),
1484
+ /** 社区自我声明的环境;连不上或旧版社区时为 null。 */
1485
+ environment: CommunityEnvironmentSchema.nullable(),
1302
1486
  account: CommunityAccountSchema.nullable(),
1303
- signedInAt: z.number().int().nullable()
1304
- }).strict();
1487
+ signedInAt: z.number().int().nullable(),
1488
+ /** 最近一次更新检查发现的可更新扩展数量(只读缓存,不发起网络请求)。 */
1489
+ updatesAvailable: z.number().int().nonnegative()
1490
+ });
1305
1491
  const CommunityPermissionItemSchema = z.object({
1306
1492
  key: z.string().max(120),
1307
1493
  level: z.enum([
@@ -1310,47 +1496,190 @@ const CommunityPermissionItemSchema = z.object({
1310
1496
  "high"
1311
1497
  ]),
1312
1498
  label: z.string().max(200),
1313
- detail: z.string().max(2e3).optional()
1314
- }).strict();
1499
+ detail: z.string().max(2e3).optional(),
1500
+ /** `host`: approved when installed on this machine; `agent`: approved when enabled for an agent. */
1501
+ layer: z.enum(["host", "agent"]).optional()
1502
+ });
1315
1503
  const CommunityReleaseSchema = z.object({
1316
1504
  id: CommunityReleaseIdSchema,
1317
1505
  reviewStatus: CommunityReviewStatusSchema,
1318
- grade: CommunityGradeSchema.nullable(),
1506
+ /** 审查完成后的评级;尚未审查、审查未完成或旧版社区时为 null。 */
1507
+ rating: CommunityRatingSchema.nullable(),
1319
1508
  permissions: z.array(CommunityPermissionItemSchema).max(64),
1320
1509
  packageSize: z.number().int().nonnegative(),
1321
1510
  requiresSdk: z.number().int().positive().nullable(),
1322
1511
  notes: z.string().max(2e3),
1323
1512
  createdAt: z.number().int()
1324
- }).strict();
1513
+ });
1514
+ /** 社区为官方扩展保留的发布者标识:官方扩展由多位官方成员维护,对外不显示个人账号。 */
1515
+ const COMMUNITY_OFFICIAL_HANDLE = "nekro-nxt";
1516
+ /** 发布者的展示文字:官方扩展显示「NekroNXT 官方」,其余显示 @账号。 */
1517
+ const communityPublisherLabel = (handle) => handle === "nekro-nxt" ? "NekroNXT 官方" : `@${handle}`;
1325
1518
  const CommunityExtensionSummarySchema = z.object({
1326
1519
  id: ExtensionIdSchema,
1327
- scope: z.enum([
1328
- "agent",
1329
- "host-adapter",
1330
- "host-ui"
1331
- ]),
1520
+ /** What the extension provides, derived from its Manifest; unknown future labels are dropped. */
1521
+ provides: z.array(z.string().max(32)).max(8),
1332
1522
  displayName: z.string().max(200),
1333
1523
  summary: z.string().max(1e3),
1334
1524
  tags: z.array(z.string().max(40)).max(16),
1525
+ /** 最新公开发布包内的扩展图标(社区的绝对地址);没有图标或旧版社区时为 null。 */
1526
+ iconUrl: z.string().url().nullable(),
1527
+ /** 由社区后台认定的官方扩展;此时发布者是社区保留的官方主页(`COMMUNITY_OFFICIAL_HANDLE`)。 */
1528
+ official: z.boolean(),
1335
1529
  publisher: CommunityAccountSchema,
1336
1530
  latest: CommunityReleaseSchema.nullable(),
1337
1531
  downloads: z.number().int().nonnegative(),
1338
1532
  updatedAt: z.number().int(),
1339
1533
  pageUrl: z.string().url()
1340
- }).strict();
1534
+ });
1341
1535
  const CommunityExtensionDetailSchema = CommunityExtensionSummarySchema.extend({
1342
1536
  description: z.string().max(2e4),
1343
1537
  sourceUrl: z.string().url().nullable(),
1538
+ /** 公开的审查记录:评级、总评、各维度说明,以及发现与自动检查的标题。 */
1344
1539
  review: z.object({
1345
1540
  status: CommunityReviewStatusSchema,
1346
- grade: CommunityGradeSchema.nullable(),
1541
+ rating: CommunityRatingSchema.nullable(),
1347
1542
  summary: z.string().max(2e3).nullable(),
1348
- highlights: z.array(z.object({
1543
+ dimensions: z.array(z.object({
1544
+ key: z.string().max(40),
1545
+ notes: z.string().max(2e3)
1546
+ })).max(16),
1547
+ findings: z.array(z.object({
1548
+ dimension: z.string().max(40),
1349
1549
  severity: z.string().max(20),
1350
1550
  title: z.string().max(200)
1351
- }).strict()).max(16)
1352
- }).strict().nullable()
1353
- }).strict();
1551
+ })).max(64),
1552
+ checks: z.array(z.object({
1553
+ severity: z.string().max(20),
1554
+ title: z.string().max(200)
1555
+ })).max(64),
1556
+ reviewedAt: z.number().int().nullable()
1557
+ }).nullable()
1558
+ });
1559
+ /**
1560
+ * 发布时随包提交的条目信息(作者自己写的介绍)。首次发布用于建条目;之后提供了哪项就覆盖哪项,未提供的保持不变。
1561
+ */
1562
+ const COMMUNITY_LISTING_LIMITS = {
1563
+ summary: 160,
1564
+ description: 2e4,
1565
+ tags: 8,
1566
+ tag: 40
1567
+ };
1568
+ const CommunityListingInputSchema = z.object({
1569
+ summary: z.string().trim().max(COMMUNITY_LISTING_LIMITS.summary).optional(),
1570
+ description: z.string().max(COMMUNITY_LISTING_LIMITS.description).optional(),
1571
+ tags: z.array(z.string().trim().min(1).max(COMMUNITY_LISTING_LIMITS.tag)).max(COMMUNITY_LISTING_LIMITS.tags).optional(),
1572
+ sourceUrl: z.string().trim().url().refine((value) => /^https?:\/\//iu.test(value), "源码地址必须是 http(s) 链接。").optional()
1573
+ });
1574
+ const CommunityEndpointSchema = z.object({
1575
+ url: z.string().url(),
1576
+ source: z.enum([
1577
+ "setting",
1578
+ "environment",
1579
+ "default"
1580
+ ]),
1581
+ defaultUrl: z.string().url(),
1582
+ environmentUrl: z.string().url().nullable(),
1583
+ /** 当前地址是未加密的非本机地址。 */
1584
+ insecure: z.boolean()
1585
+ });
1586
+ const CommunitySourceSchema = z.object({
1587
+ kind: z.literal("community"),
1588
+ communityUrl: z.string().url(),
1589
+ releaseId: CommunityReleaseIdSchema,
1590
+ publisherHandle: z.string().min(1).max(80),
1591
+ installedAt: z.number().int().nonnegative()
1592
+ });
1593
+ const CommunityInstalledItemSchema = z.object({
1594
+ extensionId: ExtensionIdSchema,
1595
+ displayName: z.string(),
1596
+ revisionId: z.string(),
1597
+ source: CommunitySourceSchema,
1598
+ /** 来源与当前社区地址一致时才能检查更新。 */
1599
+ sameCommunity: z.boolean(),
1600
+ /** 社区仍有这个条目。 */
1601
+ found: z.boolean(),
1602
+ delisted: z.boolean(),
1603
+ delistedReason: z.string().nullable(),
1604
+ releaseWithdrawn: z.boolean(),
1605
+ latest: CommunityReleaseSchema.nullable(),
1606
+ updateAvailable: z.boolean(),
1607
+ addedPermissions: z.array(CommunityPermissionItemSchema)
1608
+ });
1609
+ const CommunityInstalledSchema = z.object({
1610
+ checkedAt: z.number().int().nullable(),
1611
+ items: z.array(CommunityInstalledItemSchema)
1612
+ });
1613
+ const CommunityMyExtensionSchema = CommunityExtensionSummarySchema.extend({
1614
+ releases: z.array(CommunityReleaseSchema.extend({ withdrawn: z.boolean() })),
1615
+ delisted: z.boolean(),
1616
+ delistedReason: z.string().nullable()
1617
+ });
1618
+ /** 审查发现可归属的维度:六个评级维度加合规。 */
1619
+ const COMMUNITY_REVIEW_DIMENSION_LABELS = {
1620
+ ...COMMUNITY_RATING_DIMENSION_LABELS,
1621
+ compliance: "合规"
1622
+ };
1623
+ /** 作者看到的完整审查报告。 */
1624
+ const CommunityReviewReportSchema = z.object({
1625
+ releaseId: CommunityReleaseIdSchema,
1626
+ status: CommunityReviewStatusSchema,
1627
+ rating: CommunityRatingSchema.nullable(),
1628
+ deterministic: z.array(z.object({
1629
+ severity: z.enum([
1630
+ "info",
1631
+ "warning",
1632
+ "risk",
1633
+ "block"
1634
+ ]),
1635
+ title: z.string(),
1636
+ detail: z.string(),
1637
+ file: z.string().optional(),
1638
+ line: z.number().int().optional()
1639
+ })),
1640
+ ai: z.object({
1641
+ summary: z.string(),
1642
+ verdict: z.string(),
1643
+ compliance: z.object({
1644
+ ok: z.boolean(),
1645
+ notes: z.string()
1646
+ }).nullable(),
1647
+ dimensions: z.array(z.object({
1648
+ key: z.string(),
1649
+ stars: z.number().int().min(1).max(5),
1650
+ headline: z.string(),
1651
+ notes: z.string(),
1652
+ /** 不满五星时拿下一颗星的修改建议。 */
1653
+ nextStar: z.string().optional()
1654
+ })),
1655
+ findings: z.array(z.object({
1656
+ dimension: z.string(),
1657
+ severity: z.enum([
1658
+ "info",
1659
+ "suggestion",
1660
+ "warning",
1661
+ "risk",
1662
+ "critical"
1663
+ ]),
1664
+ title: z.string(),
1665
+ detail: z.string(),
1666
+ file: z.string().optional(),
1667
+ line: z.number().int().optional(),
1668
+ suggestion: z.string().optional()
1669
+ })),
1670
+ exploitability: z.string().optional()
1671
+ }).nullable(),
1672
+ model: z.string().nullable(),
1673
+ error: z.string().nullable(),
1674
+ decisions: z.array(z.object({
1675
+ decision: z.string(),
1676
+ note: z.string(),
1677
+ by: z.string(),
1678
+ createdAt: z.number().int()
1679
+ })),
1680
+ finishedAt: z.number().int().nullable(),
1681
+ reportUrl: z.string().url()
1682
+ });
1354
1683
  /** 安装者看到的审查标签:只描述审查发现,不做「安全」担保。 */
1355
1684
  const communityReviewLabel = (status) => {
1356
1685
  switch (status) {
@@ -1387,6 +1716,91 @@ const communityReviewLabel = (status) => {
1387
1716
  }
1388
1717
  };
1389
1718
  //#endregion
1719
+ //#region src/community-personas.ts
1720
+ /**
1721
+ * 社区人设在本机的投影:名称、头像、简介、作者介绍、标签与人设正文(对应智能体的 `persona`)。不含模型与扩展。
1722
+ * Host 宽松读取社区响应并归一到这些结构;头像改写为本机代理地址,页面不直接跨域读取社区图片。
1723
+ */
1724
+ const CommunityPersonaIdSchema = z.string().regex(/^psn_[0-9A-Za-z]+$/u);
1725
+ const CommunityPersonaRevisionIdSchema = z.string().regex(/^prv_[0-9A-Za-z]+$/u);
1726
+ /** 人设正文上限,与智能体设定一致。 */
1727
+ const COMMUNITY_PERSONA_MAX_LENGTH = 64 * 1024;
1728
+ /** 发布头像上限(社区约定 ≤512 KiB 的 PNG、JPEG 或 WebP)。 */
1729
+ const COMMUNITY_PERSONA_AVATAR_MAX_BYTES = 512 * 1024;
1730
+ const COMMUNITY_PERSONA_AVATAR_TYPES = [
1731
+ "image/png",
1732
+ "image/jpeg",
1733
+ "image/webp"
1734
+ ];
1735
+ const TagsSchema = z.array(z.string().min(1).max(40)).max(16);
1736
+ const CommunityPersonaSummarySchema = z.object({
1737
+ id: CommunityPersonaIdSchema,
1738
+ name: z.string().min(1).max(200),
1739
+ summary: z.string().max(1e3),
1740
+ tags: TagsSchema,
1741
+ /** 本机代理地址 `/api/community/personas/<id>/avatar?v=…`;没有头像时为 null。 */
1742
+ avatarUrl: z.string().startsWith("/api/community/personas/").nullable(),
1743
+ official: z.boolean(),
1744
+ publisher: CommunityAccountSchema,
1745
+ installs: z.number().int().nonnegative(),
1746
+ updatedAt: z.number().int(),
1747
+ pageUrl: z.string().url()
1748
+ });
1749
+ const CommunityPersonaDetailSchema = CommunityPersonaSummarySchema.extend({
1750
+ description: z.string().max(2e4),
1751
+ persona: z.string().max(COMMUNITY_PERSONA_MAX_LENGTH),
1752
+ revision: z.object({
1753
+ id: CommunityPersonaRevisionIdSchema,
1754
+ notes: z.string().max(2e3),
1755
+ createdAt: z.number().int()
1756
+ }),
1757
+ review: z.object({
1758
+ status: z.enum(["approved", "flagged"]),
1759
+ summary: z.string().max(2e3).nullable()
1760
+ }).nullable()
1761
+ });
1762
+ const CommunityPersonaReviewStatusSchema = z.enum([
1763
+ "pending",
1764
+ "approved",
1765
+ "flagged",
1766
+ "rejected"
1767
+ ]);
1768
+ const CommunityMyPersonaSchema = CommunityPersonaSummarySchema.extend({
1769
+ status: z.enum(["listed", "delisted"]),
1770
+ latestRevision: z.object({
1771
+ id: CommunityPersonaRevisionIdSchema,
1772
+ createdAt: z.number().int(),
1773
+ reviewStatus: CommunityPersonaReviewStatusSchema,
1774
+ reviewSummary: z.string().max(2e3).nullable()
1775
+ })
1776
+ });
1777
+ const CommunityMyPersonasSchema = z.object({
1778
+ items: z.array(CommunityMyPersonaSchema),
1779
+ /** 本机智能体最近一次发布到当前社区的人设,用于「更新已发布的人设」。 */
1780
+ agentLinks: z.record(AgentIdSchema, CommunityPersonaIdSchema)
1781
+ });
1782
+ /** 作者看到的审查状态文字。 */
1783
+ const communityPersonaReviewLabel = (status) => {
1784
+ switch (status) {
1785
+ case "approved": return {
1786
+ tone: "ok",
1787
+ label: "已公开"
1788
+ };
1789
+ case "pending": return {
1790
+ tone: "neutral",
1791
+ label: "审查中"
1792
+ };
1793
+ case "flagged": return {
1794
+ tone: "warn",
1795
+ label: "待人工复核"
1796
+ };
1797
+ case "rejected": return {
1798
+ tone: "bad",
1799
+ label: "未通过"
1800
+ };
1801
+ }
1802
+ };
1803
+ //#endregion
1390
1804
  //#region src/host-api.ts
1391
1805
  const EmptyParamsSchema = z.object({}).strict();
1392
1806
  const NoRequestBodySchema = z.undefined();
@@ -1521,6 +1935,24 @@ const AgentModelSchema = z.object({
1521
1935
  model: NonEmptyStringSchema,
1522
1936
  reasoningEffort: NonEmptyStringSchema.optional()
1523
1937
  }).strict();
1938
+ /**
1939
+ * An enable or disable request of one agent extension that has not settled: `waiting` until the agent reaches a safe
1940
+ * gap (its current reply ends), or `failed` with the reason until the next request replaces it.
1941
+ */
1942
+ /** What one approval asks the user to grant and whether the current grant already covers it. */
1943
+ const ExtensionPermissionRequirementSchema = z.object({
1944
+ declaration: HostUiPermissionDeclarationSchema,
1945
+ permissionDigest: z.string().regex(/^[a-f0-9]{64}$/u),
1946
+ approvalRequired: z.boolean()
1947
+ }).strict();
1948
+ const ExtensionActivationTransitionSchema = z.object({
1949
+ agentId: AgentIdSchema,
1950
+ target: z.enum(["enabled", "disabled"]),
1951
+ extensionRevisionId: ExtensionRevisionIdSchema.optional(),
1952
+ state: z.enum(["waiting", "failed"]),
1953
+ message: z.string().optional(),
1954
+ since: z.number().int().safe().nonnegative()
1955
+ }).strict();
1524
1956
  const ImageUnderstandingPolicyApiSchema = z.object({
1525
1957
  history: z.object({
1526
1958
  mode: z.literal("persistent-distinct"),
@@ -1669,7 +2101,9 @@ const HostSnapshotMessageSchema = z.object({
1669
2101
  parts: z.array(SnapshotMessagePartSchema),
1670
2102
  sender: z.object({
1671
2103
  memberId: ChannelMemberIdSchema,
1672
- displayName: z.string().optional()
2104
+ displayName: z.string().optional(),
2105
+ /** The sender is the account of this agent on this host, answering the channel through another connection. */
2106
+ localAgentId: AgentIdSchema.optional()
1673
2107
  }).strict().optional(),
1674
2108
  mentionedConnectionAccount: z.boolean().optional(),
1675
2109
  activityKey: AdapterActivityKeySchema.optional(),
@@ -1823,6 +2257,16 @@ const ChannelRuntimeStepSchema = z.object({
1823
2257
  firstTokenMs: z.number().int().nonnegative().optional(),
1824
2258
  usage: ChannelRuntimeUsageSchema.optional()
1825
2259
  }).strict();
2260
+ /** One message that entered the model's input during a turn: channel admissions and host or DSH injections. */
2261
+ const ChannelRuntimeInputSchema = z.object({
2262
+ messageId: z.string().min(1),
2263
+ /** DSH `user/message` source kind, e.g. `nekro-nxt-channel` or `nekro-nxt-handoff`. */
2264
+ source: z.string().min(1),
2265
+ /** Channel Events carried by a channel admission. */
2266
+ eventCount: z.number().int().positive().optional(),
2267
+ preview: z.string().optional(),
2268
+ at: z.number().int().safe().nonnegative().optional()
2269
+ }).strict();
1826
2270
  const ChannelRuntimeTurnSchema = z.object({
1827
2271
  turn: z.number().int().nonnegative(),
1828
2272
  state: z.enum([
@@ -1854,7 +2298,9 @@ const ChannelRuntimeTurnSchema = z.object({
1854
2298
  /** Session log time the turn closed; absent while it is still running. */
1855
2299
  endedAt: z.number().int().safe().nonnegative().optional(),
1856
2300
  /** Newest Channel Event of the admission that opened this turn; absent for non-channel turns. */
1857
- triggerEventId: ChannelEventIdSchema.optional()
2301
+ triggerEventId: ChannelEventIdSchema.optional(),
2302
+ /** Messages that entered the model's input during the turn, in log order; absent when there were none. */
2303
+ inputs: z.array(ChannelRuntimeInputSchema).optional()
1858
2304
  }).strict();
1859
2305
  const ChannelRuntimeOccupancySchema = z.object({
1860
2306
  projectedTokens: z.number().int().nonnegative(),
@@ -1933,6 +2379,54 @@ const ChannelRuntimeSseDataSchema = ChannelRuntimeProjectionSchema.extend({
1933
2379
  revision: z.number().int().positive(),
1934
2380
  truncated: z.boolean().optional()
1935
2381
  }).strict();
2382
+ const ChannelRuntimeContextSchema = z.object({
2383
+ available: z.boolean(),
2384
+ route: z.object({
2385
+ provider: z.string(),
2386
+ model: z.string(),
2387
+ contextWindow: z.number().int().positive().optional(),
2388
+ reasoningEffort: z.string().optional(),
2389
+ temperature: z.number().optional(),
2390
+ maxTokens: z.number().int().positive().optional()
2391
+ }).strict().optional(),
2392
+ instructions: z.array(z.object({
2393
+ role: z.enum(["system", "developer"]),
2394
+ text: z.string(),
2395
+ truncated: z.boolean()
2396
+ }).strict()),
2397
+ tools: z.array(z.object({
2398
+ name: z.string(),
2399
+ description: z.string().optional(),
2400
+ parameters: z.string().optional()
2401
+ }).strict()),
2402
+ changes: z.array(z.object({
2403
+ at: z.number().nonnegative().optional(),
2404
+ reason: z.enum([
2405
+ "initial",
2406
+ "resume",
2407
+ "change",
2408
+ "series"
2409
+ ]),
2410
+ toolCount: z.number().int().nonnegative()
2411
+ }).strict())
2412
+ }).strict();
2413
+ /** A channel's own instructions for whoever answers it, with recent earlier versions to restore. */
2414
+ const ChannelPromptViewSchema = z.object({
2415
+ document: PromptDocumentV1Schema,
2416
+ /** The agent may not rewrite a locked prompt. */
2417
+ locked: z.boolean(),
2418
+ /** 0 before the first save; send it back as `expectedRevision`. */
2419
+ revision: z.number().int().nonnegative(),
2420
+ maxChars: z.number().int().positive(),
2421
+ updatedBy: z.enum(["admin", "agent"]).optional(),
2422
+ updatedAt: z.number().int().nonnegative().optional(),
2423
+ revisions: z.array(z.object({
2424
+ revision: z.number().int().positive(),
2425
+ document: PromptDocumentV1Schema,
2426
+ updatedBy: z.enum(["admin", "agent"]),
2427
+ updatedAt: z.number().int().nonnegative()
2428
+ }).strict())
2429
+ }).strict();
1936
2430
  const AdapterConnectionCreationSchema = z.object({
1937
2431
  mode: z.enum(["schema-form", "qr-login"]),
1938
2432
  actionLabel: z.string().trim().min(1).optional(),
@@ -2269,11 +2763,15 @@ const HostSnapshotSchema = z.object({
2269
2763
  unreadCount: 0,
2270
2764
  unreadCapped: false
2271
2765
  }),
2766
+ /** Other agents on this host that answer the same platform channel through another connection; absent when none. */
2767
+ localAgentIds: z.array(AgentIdSchema).min(1).optional(),
2272
2768
  bindings: z.array(z.object({
2273
2769
  channelId: ChannelIdSchema,
2274
2770
  agentId: AgentIdSchema,
2275
2771
  triggerPolicy: TriggerPolicySchema,
2276
2772
  processingFeedback: z.enum(["auto", "off"]).default("auto"),
2773
+ /** Absent means `observe`. */
2774
+ localAgentMessages: z.enum(["observe", "trigger"]).optional(),
2277
2775
  activityTriggerOverrides: ActivityTriggerOverridesSchema.default({}),
2278
2776
  boundAt: z.number().int().safe().nonnegative()
2279
2777
  }).strict())
@@ -2352,11 +2850,8 @@ const HostSnapshotSchema = z.object({
2352
2850
  }).strict()).default([]),
2353
2851
  extensions: z.array(z.object({
2354
2852
  id: ExtensionIdSchema,
2355
- scope: z.enum([
2356
- "agent",
2357
- "host-adapter",
2358
- "host-ui"
2359
- ]),
2853
+ /** What the latest Revision provides; listing and filtering only. */
2854
+ provides: z.array(ExtensionProvideSchema),
2360
2855
  slug: NonEmptyStringSchema,
2361
2856
  displayName: z.string(),
2362
2857
  description: z.string(),
@@ -2366,13 +2861,18 @@ const HostSnapshotSchema = z.object({
2366
2861
  revisionNumber: z.number().int().positive(),
2367
2862
  format: z.enum(["current", "unavailable"]).optional(),
2368
2863
  ui: ExtensionUiContributionsSchema.default(EMPTY_EXTENSION_UI_CONTRIBUTIONS),
2369
- configSchema: ConfigSchemaDocumentSchema.optional(),
2864
+ /** The host instance's configuration form (`config.host`). */
2865
+ hostConfigSchema: ConfigSchemaDocumentSchema.optional(),
2866
+ /** Each enabled agent's configuration form (`config.agent`). */
2867
+ agentConfigSchema: ConfigSchemaDocumentSchema.optional(),
2868
+ /** 扩展包自带图标的读取路径(同源、按摘要寻址、可长期缓存);没有图标时缺省。 */
2869
+ iconUrl: z.string().regex(/^\/api\/extensions\/[^/]+\/revisions\/[^/]+\/icon\/[a-f0-9]{64}\.(?:svg|png|webp)$/u).optional(),
2370
2870
  createdAt: z.number().int().safe().nonnegative(),
2371
- scope: z.enum([
2372
- "agent",
2373
- "host-adapter",
2374
- "host-ui"
2375
- ]),
2871
+ /** 从社区安装的保存记录的来源;本机保存与文件导入没有来源。 */
2872
+ source: CommunitySourceSchema.optional(),
2873
+ provides: z.array(ExtensionProvideSchema),
2874
+ /** Whether this Revision can be enabled for agents (agent-layer contributions or capabilities). */
2875
+ agentLayer: z.boolean(),
2376
2876
  contributions: z.array(z.string()),
2377
2877
  verification: z.object({
2378
2878
  verifiedAt: z.number().int().nonnegative(),
@@ -2389,9 +2889,11 @@ const HostSnapshotSchema = z.object({
2389
2889
  renderedPages: z.array(HostPageContributionSchema).max(8).optional(),
2390
2890
  usedUiComponents: z.array(HostUiKitComponentNameSchema).optional(),
2391
2891
  pageGeometry: z.array(HostUiPageGeometryEvidenceSchema).max(8).optional(),
2392
- permissions: HostUiPermissionDeclarationSchema.optional(),
2393
- permissionDigest: z.string().regex(/^[a-f0-9]{64}$/u).optional(),
2394
- permissionApprovalRequired: z.boolean().optional(),
2892
+ permissions: ExtensionPermissionsSchema.optional(),
2893
+ /** Installing this Revision on the machine, against the current host grant. */
2894
+ hostPermission: ExtensionPermissionRequirementSchema.optional(),
2895
+ /** Enabling this Revision for an agent that has no grant yet. */
2896
+ agentPermission: ExtensionPermissionRequirementSchema.optional(),
2395
2897
  adapter: z.object({
2396
2898
  apiVersion: z.literal(2),
2397
2899
  key: NonEmptyStringSchema,
@@ -2439,10 +2941,14 @@ const HostSnapshotSchema = z.object({
2439
2941
  observedAt: z.number().int().safe().nonnegative()
2440
2942
  }).strict()).optional()
2441
2943
  }).strict()),
2944
+ /** Present only while some agent's enable or disable request is waiting or has failed. */
2945
+ activationTransitions: z.array(ExtensionActivationTransitionSchema).optional(),
2442
2946
  installation: z.object({
2443
2947
  extensionRevisionId: ExtensionRevisionIdSchema,
2444
2948
  installedAt: z.number().int().safe().nonnegative(),
2949
+ /** Secret fields are removed; `configuredSecrets` lists those the Host stores. */
2445
2950
  config: JsonValueSchema.default({}),
2951
+ configuredSecrets: z.array(z.string()).optional(),
2446
2952
  runtime: z.object({
2447
2953
  status: z.enum([
2448
2954
  "active",
@@ -2453,11 +2959,8 @@ const HostSnapshotSchema = z.object({
2453
2959
  observedAt: z.number().int().safe().nonnegative()
2454
2960
  }).optional()
2455
2961
  }).strict().optional(),
2456
- hostUiPermission: z.object({
2457
- declaration: HostUiPermissionDeclarationSchema,
2458
- permissionDigest: z.string().regex(/^[a-f0-9]{64}$/u),
2459
- approvalRequired: z.boolean()
2460
- }).strict().optional(),
2962
+ /** Installing the latest Revision on this machine, against the current host grant. */
2963
+ hostPermission: ExtensionPermissionRequirementSchema.optional(),
2461
2964
  hostClientDiagnostic: z.object({
2462
2965
  revisionId: ExtensionRevisionIdSchema,
2463
2966
  status: z.enum(["loaded", "failed"]),
@@ -2815,6 +3318,19 @@ const LlmProviderCredentialSchema = z.object({
2815
3318
  source: z.string().optional(),
2816
3319
  writable: z.boolean()
2817
3320
  }).strict();
3321
+ /**
3322
+ * The latest connection test that still describes the provider's saved address, protocol and API key. Tests made
3323
+ * before one of those changed are dropped. Never carries a key, request or response body.
3324
+ */
3325
+ const LlmProviderTestResultSchema = z.object({
3326
+ /** Epoch milliseconds when the test finished. */
3327
+ at: z.number().int().nonnegative(),
3328
+ ok: z.boolean(),
3329
+ /** Short failure reason shown to the user; absent when the test passed. */
3330
+ message: z.string().max(240).optional(),
3331
+ /** The model the test asked. */
3332
+ model: NonEmptyStringSchema.optional()
3333
+ }).strict();
2818
3334
  const LlmProviderViewSchema = z.object({
2819
3335
  provider: NonEmptyStringSchema,
2820
3336
  displayName: z.string(),
@@ -2831,7 +3347,9 @@ const LlmProviderViewSchema = z.object({
2831
3347
  /** The model list was edited on this host; built-in providers can restore their own catalog. */
2832
3348
  modelsCustomized: z.boolean(),
2833
3349
  /** The provider's adapter can list the models its endpoint offers. */
2834
- discoverable: z.boolean()
3350
+ discoverable: z.boolean(),
3351
+ /** `null` when the current configuration was never tested; absent from hosts that do not record tests. */
3352
+ lastTest: LlmProviderTestResultSchema.nullable().optional()
2835
3353
  }).strict();
2836
3354
  const LlmProviderSettingsSchema = z.object({
2837
3355
  writable: z.boolean(),
@@ -2872,11 +3390,7 @@ const ExtensionImportInspectionSchema = z.object({
2872
3390
  revisionId: ExtensionRevisionIdSchema,
2873
3391
  slug: NonEmptyStringSchema,
2874
3392
  displayName: NonEmptyStringSchema,
2875
- scope: z.enum([
2876
- "agent",
2877
- "host-adapter",
2878
- "host-ui"
2879
- ]),
3393
+ provides: z.array(ExtensionProvideSchema),
2880
3394
  idempotent: z.boolean(),
2881
3395
  slugConflict: z.boolean()
2882
3396
  }).strict();
@@ -2923,6 +3437,7 @@ const agentExtensionParam = z.object({
2923
3437
  agentId: AgentIdSchema,
2924
3438
  extensionId: ExtensionIdSchema
2925
3439
  }).strict();
3440
+ const PermissionApprovalSchema = z.object({ permissionDigest: z.string().regex(/^[a-f0-9]{64}$/u) }).strict();
2926
3441
  const extensionParam = z.object({ extensionId: ExtensionIdSchema }).strict();
2927
3442
  const dshPluginPackageParam = z.object({ packageId: DshPluginPackageIdSchema }).strict();
2928
3443
  const dshPluginEntryParam = z.object({ entryId: DshPluginEntryIdSchema }).strict();
@@ -3258,6 +3773,8 @@ const HostApiContracts = {
3258
3773
  channelId: ChannelIdSchema,
3259
3774
  triggerPolicy: TriggerPolicySchema,
3260
3775
  processingFeedback: z.enum(["auto", "off"]).optional(),
3776
+ /** Messages from another local agent's account: `observe` keeps them as context unless they @ this agent. */
3777
+ localAgentMessages: z.enum(["observe", "trigger"]).optional(),
3261
3778
  activityTriggerOverrides: ActivityTriggerOverridesSchema.optional()
3262
3779
  }).strict(),
3263
3780
  response: z.object({
@@ -3265,6 +3782,7 @@ const HostApiContracts = {
3265
3782
  agentId: AgentIdSchema,
3266
3783
  triggerPolicy: TriggerPolicySchema,
3267
3784
  processingFeedback: z.enum(["auto", "off"]).default("auto"),
3785
+ localAgentMessages: z.enum(["observe", "trigger"]).optional(),
3268
3786
  activityTriggerOverrides: ActivityTriggerOverridesSchema.default({}),
3269
3787
  boundAt: z.number().int().safe().nonnegative()
3270
3788
  }).strict(),
@@ -3359,6 +3877,52 @@ const HostApiContracts = {
3359
3877
  }).strict(),
3360
3878
  error: HostApiErrorSchema
3361
3879
  }),
3880
+ getChannelRuntimeContext: defineContract({
3881
+ method: "GET",
3882
+ path: "/api/channels/:channelId/runtime/context",
3883
+ params: channelParam,
3884
+ request: NoRequestBodySchema,
3885
+ response: ChannelRuntimeContextSchema,
3886
+ error: HostApiErrorSchema
3887
+ }),
3888
+ getChannelRuntimeInput: defineContract({
3889
+ method: "GET",
3890
+ path: "/api/channels/:channelId/runtime/inputs/:messageId",
3891
+ params: z.object({
3892
+ channelId: ChannelIdSchema,
3893
+ messageId: z.string().trim().min(1).max(200)
3894
+ }).strict(),
3895
+ request: NoRequestBodySchema,
3896
+ response: z.object({
3897
+ messageId: z.string(),
3898
+ available: z.boolean(),
3899
+ source: z.string().optional(),
3900
+ text: z.string().optional(),
3901
+ truncated: z.boolean()
3902
+ }).strict(),
3903
+ error: HostApiErrorSchema
3904
+ }),
3905
+ getChannelPrompt: defineContract({
3906
+ method: "GET",
3907
+ path: "/api/channels/:channelId/prompt",
3908
+ params: channelParam,
3909
+ request: NoRequestBodySchema,
3910
+ response: ChannelPromptViewSchema,
3911
+ error: HostApiErrorSchema
3912
+ }),
3913
+ updateChannelPrompt: defineContract({
3914
+ method: "PUT",
3915
+ path: "/api/channels/:channelId/prompt",
3916
+ params: channelParam,
3917
+ request: z.object({
3918
+ document: PromptDocumentV1Schema,
3919
+ locked: z.boolean(),
3920
+ /** The revision the edit started from; a newer stored revision rejects the save. */
3921
+ expectedRevision: z.number().int().nonnegative()
3922
+ }).strict(),
3923
+ response: ChannelPromptViewSchema,
3924
+ error: HostApiErrorSchema
3925
+ }),
3362
3926
  resetChannelContext: defineContract({
3363
3927
  invalidatesSnapshot: true,
3364
3928
  method: "POST",
@@ -3692,11 +4256,11 @@ const HostApiContracts = {
3692
4256
  path: "/api/community/extensions",
3693
4257
  params: z.object({
3694
4258
  query: z.string().trim().max(80).optional(),
3695
- scope: z.enum([
3696
- "agent",
3697
- "host-adapter",
3698
- "host-ui"
3699
- ]).optional(),
4259
+ provides: ExtensionProvideSchema.optional(),
4260
+ /** 只列社区后台认定的官方扩展。 */
4261
+ official: z.enum(["1"]).optional(),
4262
+ /** 排序方式,默认最近更新;游标只在同一种排序下有效。 */
4263
+ sort: CommunityExtensionSortSchema.optional(),
3700
4264
  cursor: z.string().max(200).optional()
3701
4265
  }).strict(),
3702
4266
  request: NoRequestBodySchema,
@@ -3716,6 +4280,92 @@ const HostApiContracts = {
3716
4280
  error: HostApiErrorSchema
3717
4281
  }),
3718
4282
  /** 下载社区发布并按包摘要校验,结果与本地文件导入的检查相同,再经 `commitExtensionImport` 确认。 */
4283
+ getCommunityEndpoint: defineContract({
4284
+ method: "GET",
4285
+ path: "/api/community/endpoint",
4286
+ params: EmptyParamsSchema,
4287
+ request: NoRequestBodySchema,
4288
+ response: CommunityEndpointSchema,
4289
+ error: HostApiErrorSchema
4290
+ }),
4291
+ /** 修改社区地址;`url: null` 恢复为环境变量或默认地址。非加密的局域网地址需要确认风险。 */
4292
+ updateCommunityEndpoint: defineContract({
4293
+ method: "PUT",
4294
+ path: "/api/community/endpoint",
4295
+ params: EmptyParamsSchema,
4296
+ request: z.object({
4297
+ url: z.string().max(300).nullable(),
4298
+ acknowledgeInsecure: z.boolean()
4299
+ }).strict(),
4300
+ response: CommunityEndpointSchema,
4301
+ error: HostApiErrorSchema
4302
+ }),
4303
+ testCommunityEndpoint: defineContract({
4304
+ timeoutMs: 3e4,
4305
+ method: "POST",
4306
+ path: "/api/community/endpoint/test",
4307
+ params: EmptyParamsSchema,
4308
+ request: z.object({
4309
+ url: z.string().max(300),
4310
+ acknowledgeInsecure: z.boolean()
4311
+ }).strict(),
4312
+ response: z.object({
4313
+ ok: z.boolean(),
4314
+ message: z.string(),
4315
+ name: z.string().optional(),
4316
+ environment: z.enum([
4317
+ "production",
4318
+ "staging",
4319
+ "development"
4320
+ ]).optional()
4321
+ }).strict(),
4322
+ error: HostApiErrorSchema
4323
+ }),
4324
+ listCommunityInstalled: defineContract({
4325
+ timeoutMs: 3e4,
4326
+ method: "GET",
4327
+ path: "/api/community/installed",
4328
+ params: z.object({ refresh: z.enum(["1"]).optional() }).strict(),
4329
+ request: NoRequestBodySchema,
4330
+ response: CommunityInstalledSchema,
4331
+ error: HostApiErrorSchema
4332
+ }),
4333
+ listCommunityMine: defineContract({
4334
+ timeoutMs: 3e4,
4335
+ method: "GET",
4336
+ path: "/api/community/mine",
4337
+ params: EmptyParamsSchema,
4338
+ request: NoRequestBodySchema,
4339
+ response: z.object({ items: z.array(CommunityMyExtensionSchema) }).strict(),
4340
+ error: HostApiErrorSchema
4341
+ }),
4342
+ getCommunityReleaseReview: defineContract({
4343
+ timeoutMs: 3e4,
4344
+ method: "GET",
4345
+ path: "/api/community/releases/:releaseId/review",
4346
+ params: z.object({ releaseId: CommunityReleaseIdSchema }).strict(),
4347
+ request: NoRequestBodySchema,
4348
+ response: CommunityReviewReportSchema,
4349
+ error: HostApiErrorSchema
4350
+ }),
4351
+ requestCommunityReview: defineContract({
4352
+ timeoutMs: 3e4,
4353
+ method: "POST",
4354
+ path: "/api/community/releases/:releaseId/review",
4355
+ params: z.object({ releaseId: CommunityReleaseIdSchema }).strict(),
4356
+ request: NoRequestBodySchema,
4357
+ response: z.object({ ok: z.literal(true) }).strict(),
4358
+ error: HostApiErrorSchema
4359
+ }),
4360
+ withdrawCommunityRelease: defineContract({
4361
+ timeoutMs: 3e4,
4362
+ method: "POST",
4363
+ path: "/api/community/releases/:releaseId/withdraw",
4364
+ params: z.object({ releaseId: CommunityReleaseIdSchema }).strict(),
4365
+ request: NoRequestBodySchema,
4366
+ response: z.object({ ok: z.literal(true) }).strict(),
4367
+ error: HostApiErrorSchema
4368
+ }),
3719
4369
  importCommunityRelease: defineContract({
3720
4370
  timeoutMs: 12e4,
3721
4371
  method: "POST",
@@ -3733,7 +4383,9 @@ const HostApiContracts = {
3733
4383
  request: z.object({
3734
4384
  extensionId: ExtensionIdSchema,
3735
4385
  revisionId: ExtensionRevisionIdSchema,
3736
- notes: z.string().max(2e3)
4386
+ notes: z.string().max(2e3),
4387
+ /** 作者填写的条目信息;省略的字段不改动社区上已有的内容。 */
4388
+ listing: CommunityListingInputSchema.optional()
3737
4389
  }).strict(),
3738
4390
  response: z.object({
3739
4391
  releaseId: CommunityReleaseIdSchema,
@@ -3747,6 +4399,102 @@ const HostApiContracts = {
3747
4399
  }).strict(),
3748
4400
  error: HostApiErrorSchema
3749
4401
  }),
4402
+ listCommunityPersonas: defineContract({
4403
+ timeoutMs: 3e4,
4404
+ method: "GET",
4405
+ path: "/api/community/personas",
4406
+ params: z.object({
4407
+ query: z.string().trim().min(1).max(200).optional(),
4408
+ tag: z.string().trim().min(1).max(40).optional(),
4409
+ official: z.literal("1").optional(),
4410
+ cursor: z.string().min(1).max(500).optional()
4411
+ }).strict(),
4412
+ request: NoRequestBodySchema,
4413
+ response: z.object({
4414
+ items: z.array(CommunityPersonaSummarySchema),
4415
+ nextCursor: z.string().nullable()
4416
+ }).strict(),
4417
+ error: HostApiErrorSchema
4418
+ }),
4419
+ getCommunityPersona: defineContract({
4420
+ timeoutMs: 3e4,
4421
+ method: "GET",
4422
+ path: "/api/community/personas/:personaId",
4423
+ params: z.object({ personaId: CommunityPersonaIdSchema }).strict(),
4424
+ request: NoRequestBodySchema,
4425
+ response: CommunityPersonaDetailSchema,
4426
+ error: HostApiErrorSchema
4427
+ }),
4428
+ /**
4429
+ * 把社区人设装进本机:新建一个智能体,或为现有智能体保存一次只换设定(及可选名称)的新配置。头像下载后作为
4430
+ * 智能体头像;下载失败不影响安装。`expectedRevisionId` 是用户看过的修订,社区已更新时拒绝,避免装入未看过的内容。
4431
+ */
4432
+ installCommunityPersona: defineContract({
4433
+ invalidatesSnapshot: true,
4434
+ timeoutMs: 6e4,
4435
+ method: "POST",
4436
+ path: "/api/community/personas/:personaId/install",
4437
+ params: z.object({ personaId: CommunityPersonaIdSchema }).strict(),
4438
+ request: z.discriminatedUnion("target", [z.object({
4439
+ target: z.literal("new"),
4440
+ expectedRevisionId: CommunityPersonaRevisionIdSchema,
4441
+ displayName: z.string().trim().min(1).max(80),
4442
+ model: AgentModelSchema,
4443
+ useAvatar: z.boolean()
4444
+ }).strict(), z.object({
4445
+ target: z.literal("replace"),
4446
+ expectedRevisionId: CommunityPersonaRevisionIdSchema,
4447
+ agentId: AgentIdSchema,
4448
+ expectedCurrentRevisionId: AgentRevisionIdSchema,
4449
+ /** 同时改名;省略时保留原名称。 */
4450
+ displayName: z.string().trim().min(1).max(80).optional(),
4451
+ useAvatar: z.boolean()
4452
+ }).strict()]),
4453
+ response: z.object({
4454
+ agentId: AgentIdSchema,
4455
+ channelId: ChannelIdSchema.nullable(),
4456
+ currentRevisionId: AgentRevisionIdSchema,
4457
+ avatar: z.enum([
4458
+ "applied",
4459
+ "none",
4460
+ "failed"
4461
+ ])
4462
+ }).strict(),
4463
+ error: HostApiErrorSchema
4464
+ }),
4465
+ listCommunityMyPersonas: defineContract({
4466
+ timeoutMs: 3e4,
4467
+ method: "GET",
4468
+ path: "/api/community/mine/personas",
4469
+ params: EmptyParamsSchema,
4470
+ request: NoRequestBodySchema,
4471
+ response: CommunityMyPersonasSchema,
4472
+ error: HostApiErrorSchema
4473
+ }),
4474
+ /** 把智能体的设定分享到社区;带 `personaId` 时更新自己已发布的人设(生成新修订并重新审查)。 */
4475
+ publishCommunityPersona: defineContract({
4476
+ timeoutMs: 6e4,
4477
+ method: "POST",
4478
+ path: "/api/community/personas/publish",
4479
+ params: EmptyParamsSchema,
4480
+ request: z.object({
4481
+ agentId: AgentIdSchema,
4482
+ personaId: CommunityPersonaIdSchema.optional(),
4483
+ name: z.string().trim().min(1).max(80),
4484
+ summary: z.string().trim().min(1).max(200),
4485
+ description: z.string().max(2e4),
4486
+ tags: z.array(z.string().trim().min(1).max(40)).max(16),
4487
+ persona: z.string().trim().min(1).max(COMMUNITY_PERSONA_MAX_LENGTH),
4488
+ notes: z.string().max(2e3).optional(),
4489
+ /** 页面缩放后的头像(Base64);省略时不上传头像,更新时保留社区上的原头像。 */
4490
+ avatar: z.object({
4491
+ mediaType: z.enum(COMMUNITY_PERSONA_AVATAR_TYPES),
4492
+ base64: z.string().min(1).max(Math.ceil(512 * 1024 * 4 / 3) + 4)
4493
+ }).strict().optional()
4494
+ }).strict(),
4495
+ response: CommunityMyPersonaSchema,
4496
+ error: HostApiErrorSchema
4497
+ }),
3750
4498
  testMcpServer: defineContract({
3751
4499
  timeoutMs: 3e4,
3752
4500
  method: "POST",
@@ -4148,8 +4896,18 @@ const HostApiContracts = {
4148
4896
  method: "POST",
4149
4897
  path: "/api/extensions/:extensionId/revisions/:revisionId/call",
4150
4898
  params: extensionRevisionParam,
4899
+ /**
4900
+ * A panel's call to its extension's host instance. The Host checks the anchor (the agent has the extension
4901
+ * enabled; the channel or connection exists) and hands the extension the resolved caller.
4902
+ */
4151
4903
  request: z.object({
4152
- agentId: AgentIdSchema,
4904
+ /** Absent: the call comes from the extension itself, like a page call. */
4905
+ anchor: z.object({
4906
+ kind: ExtensionPanelAnchorSchema,
4907
+ id: NonEmptyStringSchema
4908
+ }).strict().optional(),
4909
+ /** The agent the panel is shown for; must be the responding agent of an anchored channel. */
4910
+ agentId: AgentIdSchema.optional(),
4153
4911
  method: NonEmptyStringSchema,
4154
4912
  input: JsonValueSchema.optional()
4155
4913
  }).strict(),
@@ -4186,16 +4944,26 @@ const HostApiContracts = {
4186
4944
  params: agentExtensionParam,
4187
4945
  request: z.object({
4188
4946
  revisionId: ExtensionRevisionIdSchema,
4189
- permissionApproval: z.object({ permissionDigest: z.string().regex(/^[a-f0-9]{64}$/u) }).strict().optional()
4947
+ /** Approval of the agent-layer capabilities. */
4948
+ permissionApproval: PermissionApprovalSchema.optional(),
4949
+ /** Approval of the host layer when enabling also installs or switches the extension on this machine. */
4950
+ hostPermissionApproval: PermissionApprovalSchema.optional()
4190
4951
  }).strict(),
4191
- response: z.object({ activation: z.object({
4192
- agentId: AgentIdSchema,
4193
- extensionId: ExtensionIdSchema,
4194
- extensionRevisionId: ExtensionRevisionIdSchema,
4195
- config: JsonValueSchema,
4196
- configuredSecrets: z.array(z.string()).optional(),
4197
- activatedAt: z.number().int().safe().nonnegative()
4198
- }).strict() }).strict(),
4952
+ /**
4953
+ * The committed Activation, or — while the agent is still replying — `pending` with the accepted request; it then
4954
+ * takes effect at the agent's next safe gap and its progress appears in the snapshot's `activationTransitions`.
4955
+ */
4956
+ response: z.object({
4957
+ activation: z.object({
4958
+ agentId: AgentIdSchema,
4959
+ extensionId: ExtensionIdSchema,
4960
+ extensionRevisionId: ExtensionRevisionIdSchema,
4961
+ config: JsonValueSchema,
4962
+ configuredSecrets: z.array(z.string()).optional(),
4963
+ activatedAt: z.number().int().safe().nonnegative()
4964
+ }).strict().optional(),
4965
+ pending: ExtensionActivationTransitionSchema.optional()
4966
+ }).strict().refine((value) => value.activation === void 0 !== (value.pending === void 0), "启用结果必须二选一。"),
4199
4967
  error: HostApiErrorSchema
4200
4968
  }),
4201
4969
  deactivateExtension: defineContract({
@@ -4204,7 +4972,11 @@ const HostApiContracts = {
4204
4972
  path: "/api/agents/:agentId/extensions/:extensionId/activation",
4205
4973
  params: agentExtensionParam,
4206
4974
  request: NoRequestBodySchema,
4207
- response: z.object({ disabled: z.literal(true) }).strict(),
4975
+ /** `pending` is present when the agent is still replying; the Activation is removed at its next safe gap. */
4976
+ response: z.object({
4977
+ disabled: z.literal(true),
4978
+ pending: ExtensionActivationTransitionSchema.optional()
4979
+ }).strict(),
4208
4980
  error: HostApiErrorSchema
4209
4981
  }),
4210
4982
  updateExtensionActivationConfig: defineContract({
@@ -4229,8 +5001,15 @@ const HostApiContracts = {
4229
5001
  method: "PUT",
4230
5002
  path: "/api/extensions/:extensionId/installation/config",
4231
5003
  params: extensionParam,
4232
- request: z.object({ config: JsonValueSchema }).strict(),
4233
- response: z.object({ config: JsonValueSchema }).strict(),
5004
+ request: z.object({
5005
+ config: JsonValueSchema,
5006
+ /** Write-only credential drafts keyed by secret field; an absent or empty draft keeps the stored one. */
5007
+ secrets: z.record(z.string(), z.string().max(8192)).optional()
5008
+ }).strict(),
5009
+ response: z.object({
5010
+ config: JsonValueSchema,
5011
+ configuredSecrets: z.array(z.string()).optional()
5012
+ }).strict(),
4234
5013
  error: HostApiErrorSchema
4235
5014
  }),
4236
5015
  installHostExtension: defineContract({
@@ -4241,7 +5020,10 @@ const HostApiContracts = {
4241
5020
  params: extensionParam,
4242
5021
  request: z.object({
4243
5022
  revisionId: ExtensionRevisionIdSchema,
4244
- permissionApproval: z.object({ permissionDigest: z.string().regex(/^[a-f0-9]{64}$/u) }).strict().optional()
5023
+ /** Approval of the host layer (browser permissions and `permissions.host`). */
5024
+ permissionApproval: PermissionApprovalSchema.optional(),
5025
+ /** Approval of expanded agent-layer capabilities for the agents that move to this Revision. */
5026
+ agentPermissionApproval: PermissionApprovalSchema.optional()
4245
5027
  }).strict(),
4246
5028
  response: z.object({ installation: z.object({
4247
5029
  extensionId: ExtensionIdSchema,
@@ -4470,6 +5252,6 @@ function buildHostApiPath(name, input) {
4470
5252
  return buildValidatedHostApiPath(HostApiContracts[name], input);
4471
5253
  }
4472
5254
  //#endregion
4473
- export { ACTIVITY_MAX_BUCKETS, ACTIVITY_MAX_WINDOW_MS, ACTIVITY_MIN_BUCKET_MS, ADAPTER_PANEL_ANCHORS, AGENT_PANEL_ANCHORS, ActivityQuerySchema, AdapterActivityKeySchema, AdmissionIdSchema, AgentAppearanceSchema, AgentIdSchema, AgentRevisionChangedFieldSchema, AgentRevisionHistorySchema, AgentRevisionIdSchema, AssetIdSchema, AttentionItemSchema, AttentionListSchema, AuthoringAttemptIdSchema, AuthoringTaskIdSchema, CHANNEL_UNREAD_COUNT_CAP, COMMUNITY_REVIEW_STATUSES, CONFIG_SCHEMA_MAX_BYTES, ChannelActivitySeriesSchema, ChannelActivitySummarySchema, ChannelEventIdSchema, ChannelFactSseDataSchema, ChannelFactSseItemSchema, ChannelIdSchema, ChannelMemberIdSchema, ChannelPendingContextSchema, ChannelRuntimeCacheSampleSchema, ChannelRuntimeCacheSchema, ChannelRuntimeOccupancySchema, ChannelRuntimePerformanceSampleSchema, ChannelRuntimePerformanceSchema, ChannelRuntimePhaseSchema, ChannelRuntimeProjectionSchema, ChannelRuntimeSseDataSchema, ChannelRuntimeStepSchema, ChannelRuntimeToolSchema, ChannelRuntimeTurnSchema, ChannelRuntimeUsageSchema, ClientNotificationFeedResponseSchema, ClientNotificationSchema, CommunityAccountSchema, CommunityExtensionDetailSchema, CommunityExtensionSummarySchema, CommunityGradeSchema, CommunityPermissionItemSchema, CommunityReleaseIdSchema, CommunityReleaseSchema, CommunityReviewStatusSchema, CommunityStatusSchema, ConfigSchemaDocumentSchema, ConfigSchemaMetaSchema, ConfigSchemaNodeSchema, ConnectionEventIdSchema, ConnectionIdSchema, ConnectionPanelRoleSchema, ConnectionTestResultSchema, DshCredentialRefSchema, DshCredentialViewSchema, DshCredentialsChangedSseDataSchema, DshNxtHostUiSchema, DshPluginCatalogEntrySchema, DshPluginEntryIdSchema, DshPluginOperationSseDataSchema, DshPluginPackageIdSchema, DshSettingsChangedSseDataSchema, DshSettingsMutationRequestSchema, DshSettingsNamespaceSchema, DshSettingsPathOperationSchema, DshSettingsPathSchema, DynamicChangedSseDataSchema, DynamicClientApprovalPolicySchema, EMPTY_CONFIG_SCHEMA, EMPTY_EXTENSION_UI_CONTRIBUTIONS, EXTENSION_CONTEXT_DYNAMIC_MAX_CHARS, EXTENSION_CONTEXT_STATIC_MAX_CHARS, EXTENSION_DATA_HOOK_PERMISSIONS, EXTENSION_INBOUND_HOOK_MAX_TIMEOUT_MS, EXTENSION_JOB_MAX_RUNTIME, EXTENSION_LLM_MAX_CALLS_PER_TURN, EXTENSION_LLM_MAX_OUTPUT_TOKENS, EXTENSION_SDK_LEVEL, EXTENSION_STORAGE_DEFAULT_QUOTA_BYTES, EXTENSION_STORAGE_MAX_QUOTA_BYTES, EXTENSION_STORAGE_SCOPES, EpisodeHandoffIdSchema, EpisodeIdSchema, ExtensionCapabilitiesSchema, ExtensionConfigDeclarationSchema, ExtensionContextContributionSchema, ExtensionDeclaredJobSchema, ExtensionIdSchema, ExtensionImportInspectionSchema, ExtensionInboundHookCapabilitySchema, ExtensionJobsCapabilitySchema, ExtensionLlmCapabilitySchema, ExtensionMcpCapabilitySchema, ExtensionMcpServerNameSchema, ExtensionMcpServerSchema, ExtensionMcpValueSchema, ExtensionNetworkCapabilitySchema, ExtensionNetworkDomainSchema, ExtensionPanelAnchorSchema, ExtensionPanelDeclarationSchema, ExtensionPlatformCapabilitySchema, ExtensionRequiresSchema, ExtensionRevisionIdSchema, ExtensionStorageCapabilitySchema, ExtensionStorageScopeSchema, ExtensionUiContributionsSchema, HOST_UI_KIT_COMPONENT_NAMES, HostApiContracts, HostApiErrorSchema, HostConnectionEventSchema, HostIconNameSchema, HostPageContributionSchema, HostPageIconSchema, HostSnapshotMessageSchema, HostSnapshotSchema, HostSseEventSchema, HostSseStatusDataSchema, HostSyncCursorSchema, HostUiKitComponentNameSchema, HostUiNavigationGroupSchema, HostUiNavigationItemSchema, HostUiNavigationModelSchema, HostUiNetworkOriginSchema, HostUiOwnerSchema, HostUiPageEntrySchema, HostUiPageGeometryEvidenceSchema, HostUiPageInstanceIdSchema, HostUiPagePreferencesSchema, HostUiPermissionDeclarationSchema, HostUiPermissionSchema, HostUpgradeSummarySchema, INSECURE_HTTP_MANAGEMENT_PAIR_PROOF_PREFIX, ImageUnderstandingPolicyApiSchema, InsecureHttpManagementChallengeResponseSchema, InstanceDescriptorSchema, InstanceDescriptorWireSchema, JsonValueSchema, LlmDiscoveredModelSchema, LlmModelInputModalitiesSchema, LlmProviderCredentialSchema, LlmProviderModelSchema, LlmProviderSettingsSchema, LlmProviderViewSchema, LogicalMessageIdSchema, MANAGEMENT_PAIR_PROOF_PREFIX, ManagementChallengeResponseSchema, ManagementDeviceEnrollmentRequestSchema, ManagementDeviceEnrollmentResponseSchema, ManagementDeviceIdSchema, ManagementDeviceViewSchema, ManagementSessionRequestSchema, ManagementSessionResponseSchema, McpServerFormSchema, MessagePartSchema, MessagePartsSchema, MessageRendererContributionSchema, NonEmptyMessagePartsSchema, NotificationEventKeySchema, NotificationSettingsViewSchema, OutboundIntentIdSchema, PROMPT_DOCUMENT_MAX_PLAIN_TEXT_LENGTH, PROMPT_DOCUMENT_MAX_REFERENCES, PanelContributionSchema, PanelDensitySchema, PhysicalDeliveryIdSchema, PlatformIdentityIdSchema, PlatformUserListResponseSchema, PromptDocumentV1Schema, PromptSegmentSchema, RICH_EXTENSION_MAX_BYTES, RichExtensionSchema, RichKindSchema, RichTargetUrlSchema, RuntimeCompatibilityDiagnosticSchema, ScheduledTaskIdSchema, ScheduledTaskSchema, ServerInstanceIdSchema, TestBarkNotificationRequestSchema, ToolViewContributionSchema, ToolViewDensitySchema, UpdateNotificationSettingsRequestSchema, WorkTreeOrderSchema, activityDurationMs, buildHostApiContractPath, buildHostApiPath, communityReviewLabel, configDescription, configFieldKind, configFields, configSchema, configSecretKeys, extensionCapabilitiesExpand, insecureHttpManagementPairProofMessage, managementPairProofMessage, mcpSecretFields, messagePartAssetId, messagePartAssetIds, messagePartsSearchText, normalizePromptDocument, parseConfigValue, parseJsonValue, parseMessageParts, promptDocumentFromText, promptDocumentPlainText, richPartContextText, summarizeExtensionCapabilities, validateConfigValue };
5255
+ export { ACTIVITY_MAX_BUCKETS, ACTIVITY_MAX_WINDOW_MS, ACTIVITY_MIN_BUCKET_MS, ActivityQuerySchema, AdapterActivityKeySchema, AdmissionIdSchema, AgentAppearanceSchema, AgentIdSchema, AgentRevisionChangedFieldSchema, AgentRevisionHistorySchema, AgentRevisionIdSchema, AssetIdSchema, AttentionItemSchema, AttentionListSchema, AuthoringAttemptIdSchema, AuthoringTaskIdSchema, CHANNEL_UNREAD_COUNT_CAP, COMMUNITY_EXTENSION_SORTS, COMMUNITY_LISTING_LIMITS, COMMUNITY_OFFICIAL_HANDLE, COMMUNITY_PERSONA_AVATAR_MAX_BYTES, COMMUNITY_PERSONA_AVATAR_TYPES, COMMUNITY_PERSONA_MAX_LENGTH, COMMUNITY_RATING_BADGES, COMMUNITY_RATING_BADGE_LIMIT, COMMUNITY_RATING_DIMENSIONS, COMMUNITY_RATING_DIMENSION_LABELS, COMMUNITY_REVIEWER_NAME, COMMUNITY_REVIEW_DIMENSION_LABELS, COMMUNITY_REVIEW_STATUSES, CONFIG_SCHEMA_MAX_BYTES, ChannelActivitySeriesSchema, ChannelActivitySummarySchema, ChannelEventIdSchema, ChannelFactSseDataSchema, ChannelFactSseItemSchema, ChannelIdSchema, ChannelMemberIdSchema, ChannelPendingContextSchema, ChannelPromptViewSchema, ChannelRuntimeCacheSampleSchema, ChannelRuntimeCacheSchema, ChannelRuntimeContextSchema, ChannelRuntimeInputSchema, ChannelRuntimeOccupancySchema, ChannelRuntimePerformanceSampleSchema, ChannelRuntimePerformanceSchema, ChannelRuntimePhaseSchema, ChannelRuntimeProjectionSchema, ChannelRuntimeSseDataSchema, ChannelRuntimeStepSchema, ChannelRuntimeToolSchema, ChannelRuntimeTurnSchema, ChannelRuntimeUsageSchema, ClientNotificationFeedResponseSchema, ClientNotificationSchema, CommunityAccountSchema, CommunityEndpointSchema, CommunityEnvironmentSchema, CommunityExtensionDetailSchema, CommunityExtensionSortSchema, CommunityExtensionSummarySchema, CommunityInstalledItemSchema, CommunityInstalledSchema, CommunityListingInputSchema, CommunityMyExtensionSchema, CommunityMyPersonaSchema, CommunityMyPersonasSchema, CommunityPermissionItemSchema, CommunityPersonaDetailSchema, CommunityPersonaIdSchema, CommunityPersonaReviewStatusSchema, CommunityPersonaRevisionIdSchema, CommunityPersonaSummarySchema, CommunityRatingSchema, CommunityReleaseIdSchema, CommunityReleaseSchema, CommunityReviewReportSchema, CommunityReviewStatusSchema, CommunitySourceSchema, CommunityStatusSchema, ConfigSchemaDocumentSchema, ConfigSchemaMetaSchema, ConfigSchemaNodeSchema, ConnectionEventIdSchema, ConnectionIdSchema, ConnectionPanelRoleSchema, ConnectionTestResultSchema, DshCredentialRefSchema, DshCredentialViewSchema, DshCredentialsChangedSseDataSchema, DshNxtHostUiSchema, DshPluginCatalogEntrySchema, DshPluginEntryIdSchema, DshPluginOperationSseDataSchema, DshPluginPackageIdSchema, DshSettingsChangedSseDataSchema, DshSettingsMutationRequestSchema, DshSettingsNamespaceSchema, DshSettingsPathOperationSchema, DshSettingsPathSchema, DynamicChangedSseDataSchema, DynamicClientApprovalPolicySchema, EMPTY_CONFIG_SCHEMA, EMPTY_EXTENSION_PERMISSIONS, EMPTY_EXTENSION_UI_CONTRIBUTIONS, EXTENSION_CONTEXT_DYNAMIC_MAX_CHARS, EXTENSION_CONTEXT_STATIC_MAX_CHARS, EXTENSION_DATA_HOOK_PERMISSIONS, EXTENSION_INBOUND_HOOK_MAX_TIMEOUT_MS, EXTENSION_JOB_MAX_RUNTIME, EXTENSION_LLM_MAX_CALLS_PER_TURN, EXTENSION_LLM_MAX_OUTPUT_TOKENS, EXTENSION_PROVIDES, EXTENSION_SDK_LEVEL, EXTENSION_STORAGE_DEFAULT_QUOTA_BYTES, EXTENSION_STORAGE_MAX_QUOTA_BYTES, EXTENSION_STORAGE_SCOPES, EpisodeHandoffIdSchema, EpisodeIdSchema, ExtensionActivationTransitionSchema, ExtensionCapabilitiesSchema, ExtensionConfigDeclarationSchema, ExtensionContextContributionSchema, ExtensionDeclaredJobSchema, ExtensionIdSchema, ExtensionImportInspectionSchema, ExtensionInboundHookCapabilitySchema, ExtensionJobsCapabilitySchema, ExtensionLayeredConfigSchema, ExtensionLlmCapabilitySchema, ExtensionMcpCapabilitySchema, ExtensionMcpServerNameSchema, ExtensionMcpServerSchema, ExtensionMcpValueSchema, ExtensionNetworkCapabilitySchema, ExtensionNetworkDomainSchema, ExtensionPanelAnchorSchema, ExtensionPanelDeclarationSchema, ExtensionPermissionRequirementSchema, ExtensionPermissionsSchema, ExtensionPlatformCapabilitySchema, ExtensionProvideSchema, ExtensionRequiresSchema, ExtensionRevisionIdSchema, ExtensionStorageCapabilitySchema, ExtensionStorageScopeSchema, ExtensionUiContributionsSchema, HOST_PAGE_DEFAULT_RAIL_ORDER, HOST_UI_KIT_COMPONENT_NAMES, HostApiContracts, HostApiErrorSchema, HostConnectionEventSchema, HostIconNameSchema, HostLayerCapabilitiesSchema, HostPageContributionSchema, HostPageIconSchema, HostSnapshotMessageSchema, HostSnapshotSchema, HostSseEventSchema, HostSseStatusDataSchema, HostSyncCursorSchema, HostUiKitComponentNameSchema, HostUiNavigationGroupSchema, HostUiNavigationItemSchema, HostUiNavigationModelSchema, HostUiNetworkOriginSchema, HostUiOwnerSchema, HostUiPageEntrySchema, HostUiPageGeometryEvidenceSchema, HostUiPageInstanceIdSchema, HostUiPagePreferencesSchema, HostUiPermissionDeclarationSchema, HostUiPermissionSchema, HostUpgradeSummarySchema, INSECURE_HTTP_MANAGEMENT_PAIR_PROOF_PREFIX, ImageUnderstandingPolicyApiSchema, InsecureHttpManagementChallengeResponseSchema, InstanceDescriptorSchema, InstanceDescriptorWireSchema, JsonValueSchema, LlmDiscoveredModelSchema, LlmModelInputModalitiesSchema, LlmProviderCredentialSchema, LlmProviderModelSchema, LlmProviderSettingsSchema, LlmProviderTestResultSchema, LlmProviderViewSchema, LogicalMessageIdSchema, MANAGEMENT_PAIR_PROOF_PREFIX, ManagementChallengeResponseSchema, ManagementDeviceEnrollmentRequestSchema, ManagementDeviceEnrollmentResponseSchema, ManagementDeviceIdSchema, ManagementDeviceViewSchema, ManagementSessionRequestSchema, ManagementSessionResponseSchema, McpServerFormSchema, MessagePartSchema, MessagePartsSchema, MessageRendererContributionSchema, NonEmptyMessagePartsSchema, NotificationEventKeySchema, NotificationSettingsViewSchema, OutboundIntentIdSchema, PANEL_ANCHOR_LAYER, PROMPT_DOCUMENT_MAX_PLAIN_TEXT_LENGTH, PROMPT_DOCUMENT_MAX_REFERENCES, PanelContributionSchema, PanelDensitySchema, PhysicalDeliveryIdSchema, PlatformIdentityIdSchema, PlatformUserListResponseSchema, PromptDocumentV1Schema, PromptSegmentSchema, RICH_EXTENSION_MAX_BYTES, RichExtensionSchema, RichKindSchema, RichTargetUrlSchema, RuntimeCompatibilityDiagnosticSchema, ScheduledTaskIdSchema, ScheduledTaskSchema, ServerInstanceIdSchema, TestBarkNotificationRequestSchema, ToolViewContributionSchema, ToolViewDensitySchema, UpdateNotificationSettingsRequestSchema, WorkTreeOrderSchema, activityDurationMs, agentPermissionDeclaration, buildHostApiContractPath, buildHostApiPath, communityPersonaReviewLabel, communityPublisherLabel, communityReviewLabel, configDescription, configFieldKind, configFields, configSchema, configSecretKeys, extensionCapabilitiesExpand, hostLayerAsCapabilities, hostPageRailOrder, hostPermissionDeclaration, insecureHttpManagementPairProofMessage, managementPairProofMessage, mcpSecretFields, messagePartAssetId, messagePartAssetIds, messagePartsSearchText, normalizePromptDocument, parseConfigValue, parseJsonValue, parseMessageParts, promptDocumentFromText, promptDocumentPlainText, richPartContextText, summarizeExtensionCapabilities, validateConfigValue };
4474
5256
 
4475
5257
  //# sourceMappingURL=index.mjs.map