@nekro-nxt/contracts 0.4.0 → 0.5.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
@@ -1,5 +1,28 @@
1
1
  import { z } from "zod";
2
2
  //#region src/domain.ts
3
+ /** Rendered send-tool result consumed by both the agent and the product detail view. */
4
+ const MessageDeliverySummarySchema = z.object({
5
+ status: z.enum([
6
+ "sent",
7
+ "partially-sent",
8
+ "failed",
9
+ "unknown"
10
+ ]),
11
+ issues: z.array(z.object({
12
+ status: z.enum(["failed", "unknown"]),
13
+ message: z.string().max(1e3),
14
+ kind: z.enum([
15
+ "transient",
16
+ "permanent",
17
+ "rate-limited",
18
+ "authentication",
19
+ "invalid"
20
+ ]).optional(),
21
+ action: z.string().max(120).optional(),
22
+ retcode: z.number().int().safe().optional()
23
+ }).strict()).max(20),
24
+ omittedIssues: z.number().int().nonnegative().optional()
25
+ }).strict();
3
26
  const brandedId = (prefix, brand) => z.string().regex(new RegExp(`^${prefix}_[0-9A-Za-z]+$`), `${brand} has an invalid format.`).brand(brand);
4
27
  const AgentIdSchema = brandedId("agt", "AgentId");
5
28
  const AgentRevisionIdSchema = brandedId("arev", "AgentRevisionId");
@@ -23,6 +46,7 @@ const DshPluginEntryIdSchema = brandedId("dse", "DshPluginEntryId");
23
46
  const HostUiPageInstanceIdSchema = brandedId("hup", "HostUiPageInstanceId");
24
47
  const AuthoringTaskIdSchema = brandedId("aut", "AuthoringTaskId");
25
48
  const AuthoringAttemptIdSchema = brandedId("aua", "AuthoringAttemptId");
49
+ const SubConversationIdSchema = brandedId("cnv", "SubConversationId");
26
50
  const AdapterActivityKeySchema = z.string().trim().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$/u, "Adapter activity key has an invalid format.");
27
51
  const PromptTextSegmentSchema = z.object({
28
52
  type: z.literal("text"),
@@ -119,7 +143,12 @@ const MessagePartSchema = z.discriminatedUnion("type", [
119
143
  z.object({
120
144
  type: z.literal("image"),
121
145
  assetId: AssetIdSchema,
122
- alt: z.string().optional()
146
+ alt: z.string().optional(),
147
+ /**
148
+ * The platform reported the picture as a sticker. A hint only: a sticker dragged in from a desktop client and
149
+ * pictures from platforms without this signal arrive unmarked.
150
+ */
151
+ sticker: z.literal(true).optional()
123
152
  }).strict(),
124
153
  z.object({
125
154
  type: z.literal("file"),
@@ -151,17 +180,17 @@ const NonEmptyMessagePartsSchema = MessagePartsSchema.min(1);
151
180
  function parseMessageParts(input) {
152
181
  return MessagePartsSchema.parse(input);
153
182
  }
154
- const collectRichAssetIds = (value, into) => {
183
+ const collectRichAssetIds = (value, into, imagesOnly = false) => {
155
184
  if (value === null || value === void 0 || typeof value === "boolean" || typeof value === "number") return;
156
185
  if (typeof value === "string") return;
157
186
  if (Array.isArray(value)) {
158
- for (const item of value) collectRichAssetIds(item, into);
187
+ for (const item of value) collectRichAssetIds(item, into, imagesOnly);
159
188
  return;
160
189
  }
161
- for (const [key, child] of Object.entries(value)) if ((key === "imageAssetId" || key === "previewAssetId") && typeof child === "string") {
190
+ for (const [key, child] of Object.entries(value)) if ((key === "imageAssetId" || key === "previewAssetId" || !imagesOnly && (key === "audioAssetId" || key === "fileAssetId")) && typeof child === "string") {
162
191
  const parsed = AssetIdSchema.safeParse(child);
163
192
  if (parsed.success) into.push(parsed.data);
164
- } else collectRichAssetIds(child, into);
193
+ } else collectRichAssetIds(child, into, imagesOnly);
165
194
  };
166
195
  const messagePartAssetIds = (part) => {
167
196
  if (part.type === "image" || part.type === "file" || part.type === "audio") return [part.assetId];
@@ -172,6 +201,14 @@ const messagePartAssetIds = (part) => {
172
201
  return ids;
173
202
  };
174
203
  const messagePartAssetId = (part) => messagePartAssetIds(part)[0];
204
+ /** Only actual pictures enter visual context; forwarded files and recordings retain their own media kind. */
205
+ const messagePartImageAssetIds = (part) => {
206
+ if (part.type === "image") return [part.assetId];
207
+ if (part.type !== "rich") return [];
208
+ const ids = part.previewAssetId ? [part.previewAssetId] : [];
209
+ collectRichAssetIds(part.extension, ids, true);
210
+ return ids;
211
+ };
175
212
  const asJsonRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
176
213
  const richItemLine = (value) => {
177
214
  const item = asJsonRecord(value);
@@ -182,10 +219,14 @@ const richItemLine = (value) => {
182
219
  const cardSummary = typeof card?.["summary"] === "string" ? card["summary"] : typeof card?.["title"] === "string" ? card["title"] : void 0;
183
220
  const imageName = typeof item["imageName"] === "string" ? item["imageName"] : void 0;
184
221
  const imageText = typeof item["imageAssetId"] === "string" ? `[图片${imageName ? ` ${imageName}` : ""}]` : void 0;
222
+ const audioText = typeof item["audioAssetId"] === "string" ? `[语音 ${item["audioAssetId"]}]` : void 0;
223
+ const fileText = typeof item["fileAssetId"] === "string" ? `[${typeof item["fileMediaType"] === "string" && item["fileMediaType"].startsWith("video/") ? "视频" : "文件"} ${item["fileAssetId"]}${typeof item["fileName"] === "string" ? `:${item["fileName"]}` : ""}]` : void 0;
185
224
  const body = [
186
225
  text,
187
226
  cardSummary ? `[卡片] ${cardSummary}` : void 0,
188
- imageText
227
+ imageText,
228
+ audioText,
229
+ fileText
189
230
  ].filter((part) => Boolean(part && part.length > 0)).join(" ");
190
231
  if (!sender && !body) return void 0;
191
232
  return sender ? `${sender}:${body}` : body;
@@ -525,9 +566,12 @@ const configSchema = {
525
566
  * Host capability level this build implements. A Revision that declares `requires.sdk` above it is rejected at
526
567
  * import with an "upgrade NekroNXT" message instead of an opaque schema error. Bump when a Manifest capability
527
568
  * ships; never reuse a level for a different meaning. Level 7 is Manifest V7 (host instance + agent attachments); level 8 adds the asset library, image info, tool result
528
- * images, the search index and host-layer model calls.
569
+ * images, the search index and host-layer model calls. Level 9 adds the structured logger and explicit chat commands. Level 10 adds version lineage, the data version with its
570
+ * migration hook and administrator-only commands. Level 11 lists the pictures of an inbound message to inbound hooks.
529
571
  */
530
- const EXTENSION_SDK_LEVEL = 8;
572
+ const EXTENSION_SDK_LEVEL = 11;
573
+ /** Lineage, `dataVersion` and administrator-only commands need this level; packages that carry them declare it. */
574
+ const EXTENSION_GOVERNANCE_SDK_LEVEL = 10;
531
575
  /**
532
576
  * The first NekroNXT version of each capability level, so users read "needs NekroNXT 0.5.0" rather than a level
533
577
  * number. Add the row for a new level in the change that raises EXTENSION_SDK_LEVEL; a test keeps the two in step.
@@ -544,6 +588,18 @@ const EXTENSION_SDK_RELEASES = [
544
588
  {
545
589
  level: 8,
546
590
  version: "0.5.0"
591
+ },
592
+ {
593
+ level: 9,
594
+ version: "0.6.0"
595
+ },
596
+ {
597
+ level: 10,
598
+ version: "0.6.0"
599
+ },
600
+ {
601
+ level: 11,
602
+ version: "0.6.0"
547
603
  }
548
604
  ];
549
605
  /** The oldest NekroNXT version that supports `level`; undefined for a level no release supports yet. */
@@ -1335,6 +1391,427 @@ const requiredExtensionSdkLevel = (permissions) => {
1335
1391
  };
1336
1392
  };
1337
1393
  //#endregion
1394
+ //#region src/commands.ts
1395
+ const COMMAND_DEFAULT_TIMEOUT_SECONDS = 60;
1396
+ const COMMAND_MAX_TIMEOUT_SECONDS = 600;
1397
+ /**
1398
+ * Who may run a command. `channel-admin` is granted per channel; `admin` is an instance administrator (the signed-in
1399
+ * console or a platform account listed in Settings → Administrators) and also holds every channel's `channel-admin`.
1400
+ */
1401
+ const CommandPermissionSchema = z.enum([
1402
+ "public",
1403
+ "channel-admin",
1404
+ "admin"
1405
+ ]);
1406
+ const nameSchema = z.string().min(1).max(64).regex(/^[\p{L}\p{N}_-]+$/u);
1407
+ const scalarSchema = z.union([
1408
+ z.string(),
1409
+ z.number().finite(),
1410
+ z.boolean()
1411
+ ]);
1412
+ const CommandParameterSchema = z.object({
1413
+ name: nameSchema,
1414
+ description: z.string().max(500).optional(),
1415
+ kind: z.enum(["positional", "option"]),
1416
+ type: z.enum([
1417
+ "string",
1418
+ "number",
1419
+ "integer",
1420
+ "boolean"
1421
+ ]),
1422
+ required: z.boolean().optional(),
1423
+ default: scalarSchema.optional(),
1424
+ choices: z.array(scalarSchema).min(1).max(100).optional(),
1425
+ min: z.number().finite().optional(),
1426
+ max: z.number().finite().optional()
1427
+ }).strict();
1428
+ const CommandDefinitionSchema = z.object({
1429
+ name: nameSchema,
1430
+ aliases: z.array(nameSchema).max(16).default([]),
1431
+ description: z.string().min(1).max(1e3),
1432
+ parameters: z.array(CommandParameterSchema).max(32).default([]),
1433
+ examples: z.array(z.string().max(2e3)).max(16).default([]),
1434
+ minimumPermission: CommandPermissionSchema.default("public"),
1435
+ enabledByDefault: z.boolean().default(true),
1436
+ /**
1437
+ * Where the result goes when an administrator runs the command from the console (Web or Desktop) in an external
1438
+ * channel. `local` (default) shows it in the console only; `channel` also sends it through the bot account, and
1439
+ * the console labels the command accordingly. Platform-originated commands always reply in their conversation.
1440
+ */
1441
+ consoleReply: z.enum(["local", "channel"]).default("local"),
1442
+ /**
1443
+ * How long an extension handler may run before it is cancelled and recorded as timed out, so a stuck handler
1444
+ * cannot hold the channel's command queue. Built-in commands ignore it.
1445
+ */
1446
+ timeoutSeconds: z.number().int().min(1).max(600).default(60)
1447
+ }).strict().superRefine((definition, ctx) => {
1448
+ const names = [definition.name, ...definition.aliases];
1449
+ if (new Set(names).size !== names.length) ctx.addIssue({
1450
+ code: "custom",
1451
+ message: "命令名称和别名不能重复。"
1452
+ });
1453
+ if (new Set(definition.parameters.map((p) => p.name)).size !== definition.parameters.length) ctx.addIssue({
1454
+ code: "custom",
1455
+ message: "参数名称不能重复。"
1456
+ });
1457
+ let optional = false;
1458
+ for (const p of definition.parameters) {
1459
+ if (p.min !== void 0 && p.max !== void 0 && p.min > p.max) ctx.addIssue({
1460
+ code: "custom",
1461
+ message: `参数 ${p.name} 的范围无效。`
1462
+ });
1463
+ if (p.kind === "positional") {
1464
+ if (optional && p.required) ctx.addIssue({
1465
+ code: "custom",
1466
+ message: "必填位置参数必须在可选参数之前。"
1467
+ });
1468
+ if (!p.required || p.default !== void 0) optional = true;
1469
+ }
1470
+ if (p.default !== void 0) try {
1471
+ if (validateValue(p, String(p.default)) !== p.default) throw new Error("默认值类型不匹配。");
1472
+ } catch {
1473
+ ctx.addIssue({
1474
+ code: "custom",
1475
+ message: `参数 ${p.name} 的默认值无效。`
1476
+ });
1477
+ }
1478
+ }
1479
+ });
1480
+ const CommandPolicySchema = z.object({
1481
+ enabled: z.boolean().optional(),
1482
+ permission: CommandPermissionSchema.optional()
1483
+ }).strict();
1484
+ const CommandExecutionIdentitySchema = z.object({
1485
+ source: z.enum(["web", "platform"]),
1486
+ connectionId: ConnectionIdSchema.optional(),
1487
+ platformUserId: z.string().optional(),
1488
+ displayName: z.string(),
1489
+ viewerId: z.string().optional()
1490
+ }).strict();
1491
+ const CommandResultSchema = z.object({
1492
+ parts: z.array(MessagePartSchema).min(1).max(32).refine((parts) => parts.every((p) => [
1493
+ "text",
1494
+ "image",
1495
+ "file"
1496
+ ].includes(p.type)), "命令结果仅支持文本、图片和文件。"),
1497
+ summary: z.string().max(2e3).optional()
1498
+ }).strict();
1499
+ /** An execution may send a few progress replies before its final result. */
1500
+ const COMMAND_MAX_PROGRESS_REPLIES = 5;
1501
+ const CommandReplySchema = z.object({
1502
+ /** Position within the execution; the final result always has the highest ordinal. */
1503
+ ordinal: z.number().int().nonnegative(),
1504
+ kind: z.enum(["progress", "final"]),
1505
+ parts: CommandResultSchema.shape.parts,
1506
+ /** Set once the reply has an Outbound; absent with `error` means planning failed. */
1507
+ intentId: OutboundIntentIdSchema.optional(),
1508
+ error: z.string().optional()
1509
+ }).strict();
1510
+ const CommandExecutionRecordSchema = z.object({
1511
+ id: z.string().min(1),
1512
+ channelId: ChannelIdSchema,
1513
+ source: z.enum(["web", "platform"]),
1514
+ requestId: z.string().min(1).max(200),
1515
+ eventId: ChannelEventIdSchema.optional(),
1516
+ rawText: z.string(),
1517
+ identity: CommandExecutionIdentitySchema,
1518
+ commandName: z.string().optional(),
1519
+ commandVersion: z.string().optional(),
1520
+ extensionRevisionId: ExtensionRevisionIdSchema.optional(),
1521
+ agentId: AgentIdSchema.optional(),
1522
+ agentRevisionId: AgentRevisionIdSchema.optional(),
1523
+ status: z.enum([
1524
+ "pending",
1525
+ "running",
1526
+ "succeeded",
1527
+ "failed",
1528
+ "uncertain"
1529
+ ]),
1530
+ result: CommandResultSchema.optional(),
1531
+ error: z.string().optional(),
1532
+ /** Replies in send order. A platform command's replies go to its conversation; see `replyLocal`. */
1533
+ replies: z.array(CommandReplySchema).max(6).default([]),
1534
+ /** No reply is sent on purpose (unauthorized or unknown platform command, or console-local result). */
1535
+ replySuppressed: z.boolean().optional(),
1536
+ /** The result was kept in the console on purpose and never sent to the platform. */
1537
+ replyLocal: z.boolean().optional(),
1538
+ createdAt: z.number().int().nonnegative(),
1539
+ completedAt: z.number().int().nonnegative().optional()
1540
+ }).strict();
1541
+ /** Replies that still need an Outbound or a recorded failure. */
1542
+ const undeliveredCommandReplies = (record) => record.replySuppressed === true ? [] : record.replies.filter((reply) => reply.intentId === void 0 && reply.error === void 0);
1543
+ const CommandCatalogEntrySchema = z.object({
1544
+ definition: CommandDefinitionSchema,
1545
+ fullName: z.string(),
1546
+ source: z.string(),
1547
+ extensionRevisionId: ExtensionRevisionIdSchema.optional(),
1548
+ enabled: z.boolean(),
1549
+ permission: CommandPermissionSchema,
1550
+ usage: z.string(),
1551
+ available: z.boolean(),
1552
+ unavailableReason: z.string().optional(),
1553
+ globalPolicy: CommandPolicySchema.optional(),
1554
+ channelPolicy: CommandPolicySchema.optional()
1555
+ }).strict();
1556
+ /** Shell-like quoting without evaluation or interpolation. */
1557
+ function tokenizeCommand(text) {
1558
+ const tokens = [];
1559
+ let value = "", quote = "", escaped = false, started = false;
1560
+ for (const char of text) {
1561
+ if (escaped) {
1562
+ value += char;
1563
+ escaped = false;
1564
+ started = true;
1565
+ continue;
1566
+ }
1567
+ if (char === "\\") {
1568
+ escaped = true;
1569
+ started = true;
1570
+ continue;
1571
+ }
1572
+ if (quote) {
1573
+ if (char === quote) quote = "";
1574
+ else value += char;
1575
+ continue;
1576
+ }
1577
+ if (char === "\"" || char === "'") {
1578
+ quote = char;
1579
+ started = true;
1580
+ continue;
1581
+ }
1582
+ if (/\s/u.test(char)) {
1583
+ if (started) tokens.push(value);
1584
+ value = "";
1585
+ started = false;
1586
+ continue;
1587
+ }
1588
+ value += char;
1589
+ started = true;
1590
+ }
1591
+ if (escaped || quote) throw new Error("引号或转义未闭合。");
1592
+ if (started) tokens.push(value);
1593
+ return tokens;
1594
+ }
1595
+ function validateValue(p, raw) {
1596
+ let value = raw;
1597
+ if (p.type === "boolean") {
1598
+ if (!["true", "false"].includes(raw)) throw new Error(`参数 ${p.name} 必须为 true 或 false。`);
1599
+ value = raw === "true";
1600
+ } else if (p.type !== "string") {
1601
+ value = Number(raw);
1602
+ if (raw.trim() === "" || !Number.isFinite(value) || p.type === "integer" && !Number.isSafeInteger(value)) throw new Error(`参数 ${p.name} 必须为${p.type === "integer" ? "整数" : "数字"}。`);
1603
+ }
1604
+ const size = typeof value === "string" ? [...value].length : typeof value === "number" ? value : void 0;
1605
+ if (size !== void 0 && (p.min !== void 0 && size < p.min || p.max !== void 0 && size > p.max)) throw new Error(`参数 ${p.name} 超出允许范围。`);
1606
+ if (p.choices !== void 0 && !p.choices.includes(value)) throw new Error(`参数 ${p.name} 必须为:${p.choices.join("、")}。`);
1607
+ return value;
1608
+ }
1609
+ function parseCommandArguments(definition, tokens) {
1610
+ const args = /* @__PURE__ */ new Map();
1611
+ const positions = definition.parameters.filter((p) => p.kind === "positional");
1612
+ let index = 0, options = true;
1613
+ for (let i = 0; i < tokens.length; i++) {
1614
+ const token = tokens[i];
1615
+ if (options && token === "--") {
1616
+ options = false;
1617
+ continue;
1618
+ }
1619
+ let p, raw = token;
1620
+ if (options && token.startsWith("--")) {
1621
+ const equal = token.indexOf("=");
1622
+ const key = token.slice(2, equal < 0 ? void 0 : equal);
1623
+ p = definition.parameters.find((p) => p.kind === "option" && p.name === key);
1624
+ if (!p) throw new Error(`未知选项:--${key}`);
1625
+ if (equal >= 0) raw = token.slice(equal + 1);
1626
+ else if (p.type === "boolean" && (tokens[i + 1] === void 0 || !["true", "false"].includes(tokens[i + 1]))) raw = "true";
1627
+ else {
1628
+ const next = tokens[++i];
1629
+ if (next === void 0 || next.startsWith("--")) throw new Error(`选项 --${key} 缺少值。`);
1630
+ raw = next;
1631
+ }
1632
+ } else {
1633
+ p = positions[index++];
1634
+ if (!p) throw new Error(`多余参数:${token}`);
1635
+ }
1636
+ if (args.has(p.name)) throw new Error(`重复参数:${p.name}`);
1637
+ args.set(p.name, validateValue(p, raw));
1638
+ }
1639
+ for (const p of definition.parameters) {
1640
+ if (args.has(p.name)) continue;
1641
+ if (p.default !== void 0) args.set(p.name, p.default);
1642
+ else if (p.required) throw new Error(`缺少参数:${p.kind === "option" ? "--" : ""}${p.name}`);
1643
+ }
1644
+ return Object.fromEntries(args);
1645
+ }
1646
+ function commandUsage(definition, name = definition.name) {
1647
+ return "/" + name + definition.parameters.map((p) => {
1648
+ const value = p.kind === "option" ? `--${p.name} ${p.type === "boolean" ? "[true|false]" : `<${p.name}>`}` : `<${p.name}>`;
1649
+ return " " + (p.required ? value : `[${value}]`);
1650
+ }).join("");
1651
+ }
1652
+ function recognizeCommand(parts, botMemberId, options = {}) {
1653
+ let input = parts;
1654
+ while (input.length > 1 && input[0]?.type === "text" && input[0].text.trim() === "") input = input.slice(1);
1655
+ let addressed = options.addressed === true;
1656
+ let mentionPart = false;
1657
+ if (input[0]?.type === "mention") {
1658
+ if (botMemberId === void 0 || input[0].memberId !== botMemberId) return { kind: "chat" };
1659
+ input = input.slice(1);
1660
+ addressed = true;
1661
+ mentionPart = true;
1662
+ }
1663
+ if (options.requireMention === true && !addressed) return { kind: "chat" };
1664
+ if (input.length === 0 || input.some((p) => p.type !== "text")) return { kind: "chat" };
1665
+ let text = input.map((p) => p.type === "text" ? p.text : "").join("").trimStart();
1666
+ if (options.addressed === true && !mentionPart) text = text.replace(/^@\S+\s+/u, "");
1667
+ if (text.startsWith("//")) return {
1668
+ kind: "escaped",
1669
+ parts: [{
1670
+ type: "text",
1671
+ text: text.slice(1)
1672
+ }]
1673
+ };
1674
+ if (!text.startsWith("/")) return { kind: "chat" };
1675
+ return {
1676
+ kind: "command",
1677
+ text
1678
+ };
1679
+ }
1680
+ /** The command name a recognized text invokes (`/name args` → `name`). */
1681
+ const commandNameOf = (text) => /^\/(\S*)/u.exec(text.trimStart())?.[1] ?? "";
1682
+ //#endregion
1683
+ //#region src/logs.ts
1684
+ /** Log summaries are labels; leave structured diagnostics and stacks untouched. */
1685
+ function formatLogMessage(message) {
1686
+ return message.trimEnd().replace(/[。.]$/u, "");
1687
+ }
1688
+ const hostLogLevelSchema = z.enum([
1689
+ "debug",
1690
+ "info",
1691
+ "warn",
1692
+ "error"
1693
+ ]);
1694
+ const hostLogSourceKindSchema = z.enum([
1695
+ "system",
1696
+ "dsh-plugin",
1697
+ "extension",
1698
+ "connection",
1699
+ "unknown"
1700
+ ]);
1701
+ const hostLogSourceSchema = z.object({
1702
+ kind: hostLogSourceKindSchema,
1703
+ id: z.string().min(1).max(512),
1704
+ name: z.string().min(1).max(512),
1705
+ version: z.string().max(512).optional(),
1706
+ component: z.string().max(512).optional()
1707
+ }).strict();
1708
+ const hostLogScopeSchema = z.object({
1709
+ extensionId: z.string().max(512).optional(),
1710
+ revisionId: z.string().max(512).optional(),
1711
+ connectionId: z.string().max(512).optional(),
1712
+ agentId: z.string().max(512).optional(),
1713
+ channelId: z.string().max(512).optional(),
1714
+ sessionId: z.string().max(512).optional(),
1715
+ episodeId: z.string().max(512).optional(),
1716
+ operationId: z.string().max(512).optional()
1717
+ }).strict();
1718
+ const hostLogEntrySchema = z.object({
1719
+ id: z.string(),
1720
+ sequence: z.number().int().nonnegative(),
1721
+ timestamp: z.iso.datetime(),
1722
+ runId: z.string(),
1723
+ level: hostLogLevelSchema,
1724
+ message: z.string(),
1725
+ source: hostLogSourceSchema,
1726
+ scope: hostLogScopeSchema.optional(),
1727
+ details: z.json().optional(),
1728
+ code: z.string().optional(),
1729
+ redacted: z.boolean(),
1730
+ truncated: z.boolean()
1731
+ }).strict();
1732
+ const hostLogQuerySchema = z.object({
1733
+ levels: z.array(hostLogLevelSchema).max(4).optional(),
1734
+ sourceKinds: z.array(hostLogSourceKindSchema).max(5).optional(),
1735
+ sourceIds: z.array(z.string().max(512)).max(100).optional(),
1736
+ sources: z.array(hostLogSourceSchema.pick({
1737
+ kind: true,
1738
+ id: true
1739
+ })).max(100).optional(),
1740
+ scope: hostLogScopeSchema.optional(),
1741
+ keyword: z.string().max(1e3).optional(),
1742
+ from: z.iso.datetime().optional(),
1743
+ to: z.iso.datetime().optional(),
1744
+ olderCursor: z.string().max(128).optional(),
1745
+ afterCursor: z.string().max(128).optional(),
1746
+ headCursor: z.string().max(128).optional(),
1747
+ limit: z.number().int().min(1).max(500).optional()
1748
+ }).strict();
1749
+ const hostLogPageSchema = z.object({
1750
+ entries: z.array(hostLogEntrySchema),
1751
+ olderCursor: z.string().nullable(),
1752
+ headCursor: z.string(),
1753
+ hasMore: z.boolean(),
1754
+ gap: z.enum(["expired", "reset"]).optional()
1755
+ }).strict();
1756
+ const hostLogSettingsSchema = z.object({
1757
+ retentionDays: z.number().int().min(1).max(30),
1758
+ maxSizeMiB: z.number().int().min(64).max(2048),
1759
+ revision: z.number().int().nonnegative()
1760
+ }).strict();
1761
+ const hostLogSettingsUpdateSchema = hostLogSettingsSchema;
1762
+ const hostLogDebugRequestSchema = z.object({
1763
+ source: hostLogSourceSchema.pick({
1764
+ kind: true,
1765
+ id: true
1766
+ }).optional(),
1767
+ durationMinutes: z.union([
1768
+ z.literal(5),
1769
+ z.literal(15),
1770
+ z.literal(30)
1771
+ ]).default(15)
1772
+ }).strict();
1773
+ const hostLogDebugLeaseSchema = hostLogDebugRequestSchema.extend({
1774
+ id: z.string(),
1775
+ expiresAt: z.iso.datetime()
1776
+ });
1777
+ const hostLogStatusSchema = z.object({
1778
+ state: z.enum([
1779
+ "ready",
1780
+ "degraded",
1781
+ "closed"
1782
+ ]),
1783
+ runId: z.string(),
1784
+ headCursor: z.string(),
1785
+ bytes: z.number().nonnegative(),
1786
+ count: z.number().int().nonnegative(),
1787
+ oldestTimestamp: z.iso.datetime().nullable(),
1788
+ newestTimestamp: z.iso.datetime().nullable(),
1789
+ queuedBytes: z.number().nonnegative(),
1790
+ droppedCount: z.number().int().nonnegative(),
1791
+ debugLeases: z.array(hostLogDebugLeaseSchema),
1792
+ error: z.string().optional()
1793
+ }).strict();
1794
+ const hostLogStreamEventSchema = z.discriminatedUnion("type", [
1795
+ z.object({
1796
+ type: z.literal("entries"),
1797
+ entries: z.array(hostLogEntrySchema),
1798
+ cursor: z.string()
1799
+ }),
1800
+ z.object({
1801
+ type: z.literal("gap"),
1802
+ reason: z.enum([
1803
+ "expired",
1804
+ "reset",
1805
+ "overflow"
1806
+ ]),
1807
+ cursor: z.string()
1808
+ }),
1809
+ z.object({
1810
+ type: z.literal("status"),
1811
+ status: hostLogStatusSchema
1812
+ })
1813
+ ]);
1814
+ //#endregion
1338
1815
  //#region src/runtime-compatibility.ts
1339
1816
  const RuntimeCompatibilityDiagnosticSchema = z.object({
1340
1817
  objectKind: z.enum([
@@ -1458,7 +1935,7 @@ const ClientNotificationSchema = z.object({
1458
1935
  title: z.string().trim().min(1).max(80),
1459
1936
  body: z.string().trim().min(1).max(240),
1460
1937
  occurredAt: z.number().int().nonnegative(),
1461
- route: z.string().regex(/^\/(?:(?:live|channels|agents|workshop|wiring|settings|apps|work|connections|users|extensions)(?:\/[^?#]*)?)?$/u).optional()
1938
+ route: z.string().regex(/^\/(?:(?:live|channels|agents|workshop|wiring|settings|community|apps|work|connections|users|extensions)(?:\/[^?#]*)?)?$/u).optional()
1462
1939
  }).strict();
1463
1940
  const MANAGEMENT_PAIR_PROOF_PREFIX = "nxt-management-pair-v1";
1464
1941
  const managementPairProofMessage = (input) => [
@@ -1598,6 +2075,8 @@ const CommunityExtensionSortSchema = z.enum([
1598
2075
  ]);
1599
2076
  const CommunityReleaseIdSchema = z.string().regex(/^rel_[0-9A-Za-z]+$/u);
1600
2077
  const CommunityAccountSchema = z.object({
2078
+ /** Immutable community identity; absent when connected to a community predating feedback support. */
2079
+ id: z.string().min(1).max(100).optional(),
1601
2080
  handle: z.string().min(1).max(80),
1602
2081
  displayName: z.string().max(200),
1603
2082
  avatarUrl: z.string().url().nullable()
@@ -1608,6 +2087,7 @@ const CommunityEnvironmentSchema = z.enum([
1608
2087
  "development"
1609
2088
  ]);
1610
2089
  const CommunityStatusSchema = z.object({
2090
+ features: z.array(z.string()).optional(),
1611
2091
  communityUrl: z.string().url(),
1612
2092
  /** 社区自我声明的环境;连不上或旧版社区时为 null。 */
1613
2093
  environment: CommunityEnvironmentSchema.nullable(),
@@ -1637,7 +2117,13 @@ const CommunityReleaseSchema = z.object({
1637
2117
  packageSize: z.number().int().nonnegative(),
1638
2118
  requiresSdk: z.number().int().positive().nullable(),
1639
2119
  notes: z.string().max(2e3),
1640
- createdAt: z.number().int()
2120
+ createdAt: z.number().int(),
2121
+ /** Release number on the community line; absent from older communities. */
2122
+ number: z.number().int().positive().optional(),
2123
+ /** Revision the release contains and its lineage, so NekroNXT can tell fast-forward from divergence. */
2124
+ revisionId: ExtensionRevisionIdSchema.optional(),
2125
+ parentRevisionId: ExtensionRevisionIdSchema.nullable().optional(),
2126
+ ancestry: z.array(ExtensionRevisionIdSchema).max(256).optional()
1641
2127
  });
1642
2128
  /** 社区为官方扩展保留的发布者标识:官方扩展由多位官方成员维护,对外不显示个人账号。 */
1643
2129
  const COMMUNITY_OFFICIAL_HANDLE = "nekro-nxt";
@@ -1658,7 +2144,18 @@ const CommunityExtensionSummarySchema = z.object({
1658
2144
  latest: CommunityReleaseSchema.nullable(),
1659
2145
  downloads: z.number().int().nonnegative(),
1660
2146
  updatedAt: z.number().int(),
1661
- pageUrl: z.string().url()
2147
+ pageUrl: z.string().url(),
2148
+ /**
2149
+ * The extension and version this one is a branch of; null for an original line or an older community. Without a
2150
+ * displayName the origin is not public on the community.
2151
+ */
2152
+ branchOf: z.object({
2153
+ extensionId: ExtensionIdSchema,
2154
+ revisionId: ExtensionRevisionIdSchema.nullable(),
2155
+ displayName: z.string().max(200).nullable()
2156
+ }).nullable().optional(),
2157
+ /** Public branches made from this extension. */
2158
+ branchCount: z.number().int().nonnegative().optional()
1662
2159
  });
1663
2160
  const CommunityExtensionDetailSchema = CommunityExtensionSummarySchema.extend({
1664
2161
  description: z.string().max(2e4),
@@ -1718,6 +2215,45 @@ const CommunitySourceSchema = z.object({
1718
2215
  publisherHandle: z.string().min(1).max(80),
1719
2216
  installedAt: z.number().int().nonnegative()
1720
2217
  });
2218
+ /**
2219
+ * How this machine's current version of one extension relates to the community's newest public release, with the
2220
+ * action that relation calls for. `role` says whether this machine may publish the line or only follows it.
2221
+ */
2222
+ const CommunitySyncItemSchema = z.object({
2223
+ extensionId: ExtensionIdSchema,
2224
+ displayName: z.string(),
2225
+ communityUrl: z.string().url(),
2226
+ role: z.enum(["owner", "subscriber"]),
2227
+ currentRevisionId: ExtensionRevisionIdSchema,
2228
+ currentVersionLabel: z.string(),
2229
+ /** Release the current version is, when it is one. */
2230
+ currentRelease: z.object({
2231
+ id: CommunityReleaseIdSchema,
2232
+ number: z.number().int().positive().nullable()
2233
+ }).nullable(),
2234
+ /** `remote-ahead`: update; `local-ahead`: publish (owner) or local changes (subscriber); `diverged`: merge first. */
2235
+ status: z.enum([
2236
+ "same",
2237
+ "remote-ahead",
2238
+ "local-ahead",
2239
+ "diverged",
2240
+ "unrelated",
2241
+ "unknown"
2242
+ ]),
2243
+ found: z.boolean(),
2244
+ delisted: z.boolean(),
2245
+ delistedReason: z.string().nullable(),
2246
+ /** The release the current version came from was withdrawn by its author. */
2247
+ releaseWithdrawn: z.boolean(),
2248
+ latest: CommunityReleaseSchema.nullable(),
2249
+ /** The user chose to keep local changes over `latest`; it is not offered again. */
2250
+ dismissed: z.boolean(),
2251
+ addedPermissions: z.array(CommunityPermissionItemSchema)
2252
+ });
2253
+ const CommunitySyncSchema = z.object({
2254
+ checkedAt: z.number().int().nullable(),
2255
+ items: z.array(CommunitySyncItemSchema)
2256
+ });
1721
2257
  const CommunityInstalledItemSchema = z.object({
1722
2258
  extensionId: ExtensionIdSchema,
1723
2259
  displayName: z.string(),
@@ -1929,6 +2465,371 @@ const communityPersonaReviewLabel = (status) => {
1929
2465
  }
1930
2466
  };
1931
2467
  //#endregion
2468
+ //#region src/community-feedback.ts
2469
+ const COMMUNITY_FEEDBACK_STATUSES = [
2470
+ "new",
2471
+ "needs_info",
2472
+ "triaged",
2473
+ "planned",
2474
+ "fixed",
2475
+ "duplicate",
2476
+ "wontfix",
2477
+ "withdrawn"
2478
+ ];
2479
+ const CommunityFeedbackStatusSchema = z.enum(COMMUNITY_FEEDBACK_STATUSES);
2480
+ const COMMUNITY_FEEDBACK_STATUS_LABELS = {
2481
+ new: "新反馈",
2482
+ needs_info: "需要补充",
2483
+ triaged: "已确认",
2484
+ planned: "已计划",
2485
+ fixed: "已修复",
2486
+ duplicate: "重复",
2487
+ wontfix: "不处理",
2488
+ withdrawn: "已撤回"
2489
+ };
2490
+ const CommunityFeedbackKindSchema = z.enum([
2491
+ "bug",
2492
+ "suggestion",
2493
+ "question"
2494
+ ]);
2495
+ const CommunityFeedbackIdSchema = z.string().regex(/^fbk_[0-9a-z]{26}$/u).brand();
2496
+ const CommunityFeedbackRefSchema = z.string().regex(/^FB-[1-9][0-9]*$/u);
2497
+ const CommunityFeedbackTargetSchema = z.union([z.literal("nxt"), z.object({
2498
+ extensionId: z.string().regex(/^ext_[0-9A-Za-z]+$/u),
2499
+ version: z.string().max(120).optional()
2500
+ }).strict()]);
2501
+ const version = z.string().trim().min(1).max(120);
2502
+ const timestamp = z.number().int().nonnegative();
2503
+ const CommunityFeedbackExtensionDiagnosticSchema = z.object({
2504
+ extensionId: z.string().max(100),
2505
+ version,
2506
+ accessLevel: z.string().max(80).optional(),
2507
+ activation: z.enum(["host", "agent"]).optional()
2508
+ }).strict();
2509
+ const CommunityFeedbackDiagnosticEntrySchema = z.object({
2510
+ kind: z.enum([
2511
+ "compatibility",
2512
+ "extension",
2513
+ "connection"
2514
+ ]),
2515
+ summary: z.string().max(2e3),
2516
+ extensionId: z.string().max(100).optional()
2517
+ }).strict();
2518
+ /** An explicit allowlist: credentials, account grants and arbitrary host configuration never cross this boundary. */
2519
+ const CommunityFeedbackDiagnosticsSchema = z.object({
2520
+ nxtVersion: version.optional(),
2521
+ releaseChannel: z.enum([
2522
+ "stable",
2523
+ "preview",
2524
+ "development"
2525
+ ]).optional(),
2526
+ hostKind: z.enum(["desktop", "server"]).optional(),
2527
+ platform: z.string().max(80).optional(),
2528
+ arch: z.string().max(40).optional(),
2529
+ dshVersion: version.optional(),
2530
+ adapters: z.array(z.string().max(100)).max(64).optional(),
2531
+ agent: z.object({
2532
+ accessLevel: z.string().max(80),
2533
+ subagents: z.boolean(),
2534
+ fileTools: z.boolean(),
2535
+ webSearch: z.boolean(),
2536
+ dynamicCreation: z.boolean(),
2537
+ developmentShell: z.boolean(),
2538
+ unrestrictedFileAccess: z.boolean(),
2539
+ scheduledTasks: z.boolean(),
2540
+ codeRun: z.boolean(),
2541
+ commandNetwork: z.boolean(),
2542
+ communityFeedbackAuto: z.boolean()
2543
+ }).strict().optional(),
2544
+ extensions: z.array(CommunityFeedbackExtensionDiagnosticSchema).max(256).optional(),
2545
+ entries: z.array(CommunityFeedbackDiagnosticEntrySchema).max(32).optional(),
2546
+ instanceId: z.string().min(1).max(100).optional()
2547
+ }).strict();
2548
+ const CommunityFeedbackExcerptSchema = z.array(z.object({
2549
+ speaker: z.string().max(80),
2550
+ text: z.string().max(6e3)
2551
+ }).strict()).max(8);
2552
+ const CommunityFeedbackCreateSchema = z.object({
2553
+ clientRequestId: z.string().min(1).max(160),
2554
+ kind: CommunityFeedbackKindSchema,
2555
+ target: CommunityFeedbackTargetSchema,
2556
+ title: z.string().trim().min(1).max(120),
2557
+ body: z.string().trim().min(1).max(8e3),
2558
+ diagnostics: CommunityFeedbackDiagnosticsSchema.default({}),
2559
+ excerpt: CommunityFeedbackExcerptSchema.optional(),
2560
+ excerptSharedWithAuthor: z.boolean().default(false),
2561
+ source: z.enum([
2562
+ "assistant",
2563
+ "assistant_auto",
2564
+ "form",
2565
+ "web"
2566
+ ]),
2567
+ instanceId: z.string().min(1).max(100).optional()
2568
+ }).strict();
2569
+ const CommunityFeedbackMessageInputSchema = z.object({
2570
+ body: z.string().trim().min(1).max(4e3),
2571
+ audience: z.enum(["everyone", "staff"]).default("everyone")
2572
+ }).strict();
2573
+ const CommunityFeedbackSupplementSchema = z.object({
2574
+ diagnostics: CommunityFeedbackDiagnosticsSchema.optional(),
2575
+ excerpt: CommunityFeedbackExcerptSchema.optional(),
2576
+ excerptSharedWithAuthor: z.boolean().optional()
2577
+ }).strict();
2578
+ const CommunityFeedbackWithdrawSchema = z.object({ deleteText: z.boolean().default(false) }).strict();
2579
+ const CommunityFeedbackConfirmSchema = z.object({ clientVersion: version }).strict();
2580
+ const CommunityFeedbackReopenSchema = z.object({ note: z.string().trim().min(1).max(2e3) }).strict();
2581
+ const CommunityFeedbackAffectedSchema = z.object({
2582
+ diagnostics: CommunityFeedbackDiagnosticsSchema.optional(),
2583
+ nxtVersion: version.optional()
2584
+ }).strict();
2585
+ const CommunityFeedbackTransitionSchema = z.object({
2586
+ status: CommunityFeedbackStatusSchema,
2587
+ fixedIn: version.optional(),
2588
+ duplicateOf: CommunityFeedbackRefSchema.optional(),
2589
+ note: z.string().trim().max(2e3).optional()
2590
+ }).strict();
2591
+ const CommunityFeedbackLabelsSchema = z.object({
2592
+ labels: z.array(z.string().trim().min(1).max(40)).max(20),
2593
+ priority: z.enum([
2594
+ "low",
2595
+ "normal",
2596
+ "high"
2597
+ ]).nullable()
2598
+ }).strict();
2599
+ const CommunityFeedbackLinkSchema = z.object({ githubUrl: z.string().url().max(1e3).refine((value) => /^https:\/\/github\.com\/[^/]+\/[^/]+\/issues\/[1-9][0-9]*$/u.test(value)).nullable() }).strict();
2600
+ const CommunityFeedbackVisibilitySchema = z.object({ visibility: z.enum(["private", "public"]) }).strict();
2601
+ const CommunityFeedbackEventDataSchema = z.object({
2602
+ from: CommunityFeedbackStatusSchema.optional(),
2603
+ to: CommunityFeedbackStatusSchema.optional(),
2604
+ fixedIn: version.nullable().optional(),
2605
+ duplicateOf: CommunityFeedbackRefSchema.nullable().optional(),
2606
+ note: z.string().max(2e3).optional(),
2607
+ labels: z.array(z.string()).optional(),
2608
+ priority: z.enum([
2609
+ "low",
2610
+ "normal",
2611
+ "high"
2612
+ ]).nullable().optional(),
2613
+ visibility: z.enum(["private", "public"]).optional(),
2614
+ clientVersion: version.optional(),
2615
+ messageId: z.string().optional(),
2616
+ audience: z.enum(["everyone", "staff"]).optional(),
2617
+ deleteText: z.boolean().optional(),
2618
+ affected: z.boolean().optional()
2619
+ }).strict();
2620
+ const CommunityFeedbackEventSchema = z.object({
2621
+ seq: z.number().int().positive(),
2622
+ ref: CommunityFeedbackRefSchema,
2623
+ type: z.enum([
2624
+ "created",
2625
+ "message",
2626
+ "status_changed",
2627
+ "labeled",
2628
+ "priority_changed",
2629
+ "linked_issue",
2630
+ "duplicate_marked",
2631
+ "fixed_in_set",
2632
+ "visibility_changed",
2633
+ "affected_added",
2634
+ "withdrawn",
2635
+ "reopened",
2636
+ "supplemented",
2637
+ "fix_confirmed"
2638
+ ]),
2639
+ actorKind: z.enum([
2640
+ "user",
2641
+ "admin",
2642
+ "author",
2643
+ "token",
2644
+ "system"
2645
+ ]).optional(),
2646
+ actor: z.string().optional(),
2647
+ tokenId: z.string().optional(),
2648
+ data: CommunityFeedbackEventDataSchema,
2649
+ createdAt: timestamp,
2650
+ title: z.string().optional(),
2651
+ status: CommunityFeedbackStatusSchema.optional()
2652
+ });
2653
+ const CommunityFeedbackMessageSchema = z.object({
2654
+ id: z.string(),
2655
+ authorKind: z.enum([
2656
+ "user",
2657
+ "admin",
2658
+ "author",
2659
+ "system"
2660
+ ]),
2661
+ author: z.string().nullable(),
2662
+ audience: z.enum(["everyone", "staff"]),
2663
+ body: z.string(),
2664
+ createdAt: timestamp
2665
+ });
2666
+ const CommunityFeedbackSummarySchema = z.object({
2667
+ id: CommunityFeedbackIdSchema,
2668
+ ref: CommunityFeedbackRefSchema,
2669
+ title: z.string(),
2670
+ kind: CommunityFeedbackKindSchema.optional(),
2671
+ target: CommunityFeedbackTargetSchema.optional(),
2672
+ status: CommunityFeedbackStatusSchema,
2673
+ fixedIn: version.nullable(),
2674
+ affectedCount: z.number().int().nonnegative(),
2675
+ source: CommunityFeedbackCreateSchema.shape.source.optional(),
2676
+ confirmedCount: z.number().int().nonnegative().optional(),
2677
+ createdAt: timestamp.optional(),
2678
+ updatedAt: timestamp.optional()
2679
+ });
2680
+ /** Optional private fields are emitted only by the server's role-specific projection. */
2681
+ const CommunityFeedbackSchema = CommunityFeedbackSummarySchema.extend({
2682
+ access: z.enum([
2683
+ "owner",
2684
+ "admin",
2685
+ "author",
2686
+ "subscriber",
2687
+ "public"
2688
+ ]),
2689
+ body: z.string().optional(),
2690
+ diagnostics: CommunityFeedbackDiagnosticsSchema.optional(),
2691
+ excerpt: CommunityFeedbackExcerptSchema.nullable().optional(),
2692
+ excerptSharedWithAuthor: z.boolean().optional(),
2693
+ messages: z.array(CommunityFeedbackMessageSchema).optional(),
2694
+ events: z.array(CommunityFeedbackEventSchema).optional(),
2695
+ submitter: z.string().optional(),
2696
+ instanceId: z.string().nullable().optional(),
2697
+ priority: z.enum([
2698
+ "low",
2699
+ "normal",
2700
+ "high"
2701
+ ]).nullable().optional(),
2702
+ labels: z.array(z.string()).optional(),
2703
+ visibility: z.enum(["private", "public"]).optional(),
2704
+ duplicateOf: CommunityFeedbackRefSchema.nullable().optional(),
2705
+ githubUrl: z.string().nullable().optional(),
2706
+ closedAt: timestamp.nullable().optional(),
2707
+ purgedAt: timestamp.nullable().optional(),
2708
+ confirmed: z.boolean().default(false),
2709
+ affected: z.boolean().default(false),
2710
+ affectedDiagnostics: z.array(z.object({
2711
+ user: z.string(),
2712
+ diagnostics: CommunityFeedbackDiagnosticsSchema.nullable(),
2713
+ nxtVersion: version.nullable(),
2714
+ createdAt: timestamp
2715
+ })).optional()
2716
+ });
2717
+ const CommunityFeedbackListSchema = z.object({
2718
+ items: z.array(CommunityFeedbackSummarySchema),
2719
+ cursor: z.string().nullable()
2720
+ });
2721
+ const CommunityFeedbackChangesSchema = z.object({
2722
+ events: z.array(CommunityFeedbackEventSchema),
2723
+ cursor: z.number().int().nonnegative(),
2724
+ hasMore: z.boolean()
2725
+ });
2726
+ const CommunityFeedbackDigestSchema = z.object({
2727
+ since: timestamp,
2728
+ counts: z.object({
2729
+ status: z.record(CommunityFeedbackStatusSchema, z.number().int().nonnegative()),
2730
+ kind: z.record(CommunityFeedbackKindSchema, z.number().int().nonnegative()),
2731
+ target: z.record(z.enum(["nxt", "extension"]), z.number().int().nonnegative()),
2732
+ extensions: z.record(z.string(), z.number().int().nonnegative())
2733
+ }),
2734
+ newItems: z.array(CommunityFeedbackSummarySchema),
2735
+ awaitingReply: z.array(CommunityFeedbackSummarySchema),
2736
+ mostAffected: z.array(CommunityFeedbackSummarySchema),
2737
+ unconfirmedFixes: z.array(CommunityFeedbackSummarySchema),
2738
+ fixedCount: z.number().int().nonnegative()
2739
+ });
2740
+ //#endregion
2741
+ //#region src/community-feedback-host.ts
2742
+ const CommunityFeedbackDraftIdSchema = z.string().regex(/^fbd_[0-9A-Za-z]+$/u).brand();
2743
+ const CommunityFeedbackDraftStateSchema = z.enum([
2744
+ "awaiting",
2745
+ "sending",
2746
+ "sent",
2747
+ "failed",
2748
+ "discarded"
2749
+ ]);
2750
+ const CommunityFeedbackDraftSchema = z.object({
2751
+ id: CommunityFeedbackDraftIdSchema,
2752
+ communityUrl: z.string().url(),
2753
+ communityUserId: z.string().min(1).nullable(),
2754
+ agentId: AgentIdSchema.nullable(),
2755
+ channelId: ChannelIdSchema.nullable(),
2756
+ kind: CommunityFeedbackKindSchema,
2757
+ target: CommunityFeedbackTargetSchema,
2758
+ title: z.string().max(120),
2759
+ body: z.string().max(8e3),
2760
+ excerpt: CommunityFeedbackExcerptSchema.nullable(),
2761
+ excerptSharedWithAuthor: z.boolean(),
2762
+ diagnostics: CommunityFeedbackDiagnosticsSchema,
2763
+ state: CommunityFeedbackDraftStateSchema,
2764
+ requestedBy: z.string(),
2765
+ auto: z.boolean(),
2766
+ error: z.string().nullable(),
2767
+ createdAt: z.number().int().nonnegative(),
2768
+ updatedAt: z.number().int().nonnegative()
2769
+ }).strict();
2770
+ const CommunityFeedbackItemSchema = z.object({
2771
+ ref: CommunityFeedbackRefSchema,
2772
+ communityUrl: z.string().url(),
2773
+ communityUserId: z.string().min(1),
2774
+ channelId: ChannelIdSchema.nullable(),
2775
+ draftId: CommunityFeedbackDraftIdSchema.nullable(),
2776
+ title: z.string(),
2777
+ kind: CommunityFeedbackKindSchema.nullable(),
2778
+ target: CommunityFeedbackTargetSchema.nullable(),
2779
+ status: CommunityFeedbackStatusSchema,
2780
+ fixedIn: z.string().nullable(),
2781
+ unread: z.boolean(),
2782
+ lastEventSeq: z.number().int().nonnegative(),
2783
+ createdAt: z.number().int().nonnegative(),
2784
+ updatedAt: z.number().int().nonnegative()
2785
+ }).strict();
2786
+ const CommunityFeedbackDraftInputSchema = z.object({
2787
+ kind: CommunityFeedbackKindSchema,
2788
+ target: CommunityFeedbackTargetSchema,
2789
+ title: z.string().trim().min(1).max(120),
2790
+ body: z.string().trim().min(1).max(8e3),
2791
+ conversationRefs: z.array(LogicalMessageIdSchema).max(8).optional()
2792
+ }).strict();
2793
+ const CommunityFeedbackDraftUpdateSchema = z.object({
2794
+ title: z.string().trim().min(1).max(120),
2795
+ body: z.string().trim().min(1).max(8e3),
2796
+ includeExcerpt: z.boolean(),
2797
+ excerptSharedWithAuthor: z.boolean().default(false),
2798
+ expectedUpdatedAt: z.number().int().nonnegative()
2799
+ }).strict();
2800
+ const CommunityFeedbackSettingsSchema = z.object({
2801
+ enabled: z.boolean(),
2802
+ supported: z.boolean(),
2803
+ signedIn: z.boolean(),
2804
+ communityUrl: z.string().url(),
2805
+ communityUserId: z.string().nullable(),
2806
+ consentedAt: z.number().int().nonnegative().nullable()
2807
+ }).strict();
2808
+ const CommunityFeedbackSettingsUpdateSchema = z.object({
2809
+ enabled: z.boolean(),
2810
+ consent: z.boolean().default(false)
2811
+ }).strict();
2812
+ const CommunityFeedbackSnapshotSchema = z.object({
2813
+ enabled: z.boolean(),
2814
+ signedIn: z.boolean(),
2815
+ pendingDrafts: z.number().int().nonnegative(),
2816
+ unread: z.number().int().nonnegative()
2817
+ }).strict();
2818
+ const CommunityFeedbackLocalListSchema = z.object({
2819
+ drafts: z.array(CommunityFeedbackDraftSchema),
2820
+ items: z.array(CommunityFeedbackItemSchema),
2821
+ syncError: z.string().optional()
2822
+ }).strict();
2823
+ const CommunityFeedbackPayloadSchema = z.object({
2824
+ payload: CommunityFeedbackCreateSchema,
2825
+ redactions: z.array(z.string())
2826
+ }).strict();
2827
+ const CommunityFeedbackLastPayloadSchema = z.object({
2828
+ ref: CommunityFeedbackRefSchema,
2829
+ sentAt: z.number().int().nonnegative(),
2830
+ payload: CommunityFeedbackCreateSchema
2831
+ }).strict().nullable();
2832
+ //#endregion
1932
2833
  //#region src/host-api.ts
1933
2834
  const EmptyParamsSchema = z.object({}).strict();
1934
2835
  const NoRequestBodySchema = z.undefined();
@@ -1968,6 +2869,9 @@ const DynamicAttemptErrorSchema = z.object({
1968
2869
  ]),
1969
2870
  message: z.string(),
1970
2871
  stack: z.string().optional(),
2872
+ /** A render failure also names the contribution slot that failed and whether its frame gave up. */
2873
+ slot: NonEmptyStringSchema.optional(),
2874
+ abdicated: z.boolean().optional(),
1971
2875
  pluginId: DynamicIdSchema,
1972
2876
  packageId: DynamicIdSchema,
1973
2877
  pluginRunId: DynamicIdSchema
@@ -1992,7 +2896,8 @@ const AuthoringTaskStatusSchema = z.enum([
1992
2896
  "failed",
1993
2897
  "interrupted",
1994
2898
  "stopped",
1995
- "completed"
2899
+ "completed",
2900
+ "paused"
1996
2901
  ]);
1997
2902
  const AuthoringAttemptStateSchema = z.enum([
1998
2903
  "drafting",
@@ -2031,6 +2936,8 @@ const AuthoringAttemptSummarySchema = z.object({
2031
2936
  message: z.string(),
2032
2937
  repairable: z.boolean()
2033
2938
  }).strict().optional(),
2939
+ /** Verified without loading its interface, because no browser was available; the interface itself is unchecked. */
2940
+ uiUnverified: z.boolean().optional(),
2034
2941
  createdAt: z.number().int().nonnegative(),
2035
2942
  settledAt: z.number().int().nonnegative().optional()
2036
2943
  }).strict();
@@ -2042,6 +2949,15 @@ const AuthoringTaskSummarySchema = z.object({
2042
2949
  title: z.string(),
2043
2950
  requirementSummary: z.string(),
2044
2951
  status: AuthoringTaskStatusSchema,
2952
+ /** `create` builds a new extension; `revise` changes `targetExtensionId` starting from `baseRevisionId`. */
2953
+ kind: z.enum(["create", "revise"]).default("create"),
2954
+ targetExtensionId: ExtensionIdSchema.optional(),
2955
+ baseRevisionId: ExtensionRevisionIdSchema.optional(),
2956
+ referenceRevisionId: ExtensionRevisionIdSchema.optional(),
2957
+ /** Why the task is paused; it continues when the agent picks it up in a later conversation. */
2958
+ pausedReason: z.string().optional(),
2959
+ /** The conversation the task runs in is live, so its candidate can be previewed directly. */
2960
+ live: z.boolean().default(false),
2045
2961
  approvalPolicy: z.enum(["risk-stable", "fully-automatic"]),
2046
2962
  approvedRiskDigest: z.string().regex(/^[a-f0-9]{64}$/u).optional(),
2047
2963
  revision: z.number().int().positive(),
@@ -2100,6 +3016,19 @@ const ImageUnderstandingPolicyApiSchema = z.object({
2100
3016
  maxTokens: z.number().int().min(256).max(8192)
2101
3017
  }).strict()])
2102
3018
  }).strict();
3019
+ const CommandAccountServiceSchema = z.enum(["github"]);
3020
+ const CommandAccountUsageSchema = z.enum([
3021
+ "read",
3022
+ "issues",
3023
+ "pull-requests",
3024
+ "push"
3025
+ ]);
3026
+ const CommandAccountGrantSchema = z.object({
3027
+ service: CommandAccountServiceSchema,
3028
+ accountId: NonEmptyStringSchema.max(64),
3029
+ /** Told to the agent as guidance, not enforced; empty gives no hint. */
3030
+ usage: z.array(CommandAccountUsageSchema).max(4).default([])
3031
+ }).strict();
2103
3032
  const AgentCapabilitiesSchema = z.object({
2104
3033
  subagents: z.boolean(),
2105
3034
  fileTools: z.boolean(),
@@ -2112,10 +3041,24 @@ const AgentCapabilitiesSchema = z.object({
2112
3041
  /** Tools are called from one TypeScript program (`run_code`); takes effect only with `developmentShell`. */
2113
3042
  codeRun: z.boolean().default(false),
2114
3043
  /** Network for commands; absent in older clients means on. */
2115
- commandNetwork: z.boolean().default(true)
3044
+ commandNetwork: z.boolean().default(true),
3045
+ communityFeedbackAuto: z.boolean().default(false),
3046
+ /** Accounts this agent's commands may act as; absent in older clients means none. */
3047
+ commandAccounts: z.array(CommandAccountGrantSchema).max(8).default([]),
3048
+ /**
3049
+ * What the agent may do with extensions without the console: `manual` only develops and test-runs, `confirm` asks
3050
+ * an administrator in the channel for every step, `autonomous` takes ordinary steps that only affect itself.
3051
+ */
3052
+ extensionAutonomy: z.enum([
3053
+ "manual",
3054
+ "confirm",
3055
+ "autonomous"
3056
+ ]).default("manual"),
3057
+ /** Whose requests make the agent develop or change extensions: anyone in the channel, or administrators only. */
3058
+ extensionRequesters: z.enum(["everyone", "admins"]).default("everyone")
2116
3059
  }).strict();
2117
3060
  const DynamicClientApprovalPolicySchema = z.enum(["manual", "automatic"]);
2118
- const NotificationEventKeySchema = z.enum(["dynamic-client-approval-requested"]);
3061
+ const NotificationEventKeySchema = z.enum(["dynamic-client-approval-requested", "community-feedback-update"]);
2119
3062
  const NotificationSettingsViewSchema = z.object({
2120
3063
  revision: z.number().int().positive().optional(),
2121
3064
  system: z.object({ enabled: z.boolean() }).strict(),
@@ -2124,7 +3067,10 @@ const NotificationSettingsViewSchema = z.object({
2124
3067
  serverUrl: z.url(),
2125
3068
  deviceKeyConfigured: z.boolean()
2126
3069
  }).strict(),
2127
- events: z.record(NotificationEventKeySchema, z.boolean())
3070
+ events: z.object({
3071
+ "dynamic-client-approval-requested": z.boolean(),
3072
+ "community-feedback-update": z.boolean().default(true)
3073
+ }).strict()
2128
3074
  }).strict();
2129
3075
  const UpdateNotificationSettingsRequestSchema = z.object({
2130
3076
  expectedRevision: z.number().int().positive().optional(),
@@ -2135,7 +3081,10 @@ const UpdateNotificationSettingsRequestSchema = z.object({
2135
3081
  deviceKey: z.string().trim().min(1).max(2048).optional(),
2136
3082
  clearDeviceKey: z.boolean().optional()
2137
3083
  }).strict(),
2138
- events: z.record(NotificationEventKeySchema, z.boolean())
3084
+ events: z.object({
3085
+ "dynamic-client-approval-requested": z.boolean(),
3086
+ "community-feedback-update": z.boolean().optional()
3087
+ }).strict()
2139
3088
  }).strict().refine((value) => !(value.bark.deviceKey !== void 0 && value.bark.clearDeviceKey === true), {
2140
3089
  message: "不能同时更新并清除 Bark Device Key。",
2141
3090
  path: ["bark"]
@@ -2173,7 +3122,15 @@ const ReviseAgentRequestSchema = AgentRevisionRequestContentSchema.extend({ expe
2173
3122
  const UpdateAgentCapabilitiesRequestSchema = AgentCapabilitiesSchema.partial().extend({
2174
3123
  scheduledTasks: z.boolean().optional(),
2175
3124
  codeRun: z.boolean().optional(),
2176
- commandNetwork: z.boolean().optional()
3125
+ commandNetwork: z.boolean().optional(),
3126
+ communityFeedbackAuto: z.boolean().optional(),
3127
+ commandAccounts: z.array(CommandAccountGrantSchema).max(8).optional(),
3128
+ extensionAutonomy: z.enum([
3129
+ "manual",
3130
+ "confirm",
3131
+ "autonomous"
3132
+ ]).optional(),
3133
+ extensionRequesters: z.enum(["everyone", "admins"]).optional()
2177
3134
  }).strict().refine((value) => Object.values(value).some((entry) => entry !== void 0), "至少提供一个能力。");
2178
3135
  const TriggerPolicySchema = z.enum([
2179
3136
  "always",
@@ -2199,7 +3156,8 @@ const SnapshotMessagePartSchema = z.discriminatedUnion("type", [
2199
3156
  z.object({
2200
3157
  type: z.literal("image"),
2201
3158
  assetId: AssetIdSchema,
2202
- alt: z.string().optional()
3159
+ alt: z.string().optional(),
3160
+ sticker: z.literal(true).optional()
2203
3161
  }).strict(),
2204
3162
  z.object({
2205
3163
  type: z.literal("file"),
@@ -2258,7 +3216,14 @@ const HostSnapshotMessageSchema = z.object({
2258
3216
  action: z.enum(["retry", "confirm-delivered"]),
2259
3217
  resolvedAt: z.number().int().safe().nonnegative()
2260
3218
  }).strict().optional(),
2261
- origin: z.enum(["admin-console"]).optional(),
3219
+ origin: z.enum([
3220
+ "admin-console",
3221
+ "command",
3222
+ "extension-notice"
3223
+ ]).optional(),
3224
+ command: CommandExecutionRecordSchema.optional(),
3225
+ /** A host notice about extension work: a request an administrator must confirm, or what an action did. */
3226
+ extensionNotice: z.object({ requestNumber: z.number().int().positive().optional() }).strict().optional(),
2262
3227
  /** What the agent's inbound hooks decided for this message, when anything differs from the default. */
2263
3228
  inboundHook: z.object({
2264
3229
  trigger: z.enum([
@@ -2328,7 +3293,9 @@ const PlatformUserListResponseSchema = z.object({
2328
3293
  }).strict(),
2329
3294
  activeChannelCount: z.number().int().nonnegative(),
2330
3295
  channelPreview: z.array(PlatformUserChannelPreviewSchema).max(3),
2331
- historicalOnly: z.boolean()
3296
+ historicalOnly: z.boolean(),
3297
+ /** Listed in Settings → Administrators. */
3298
+ administrator: z.boolean().default(false)
2332
3299
  }).strict()),
2333
3300
  facets: z.object({
2334
3301
  adapters: z.array(PlatformUserFacetAdapterSchema),
@@ -2674,6 +3641,45 @@ const MessagePacingSchema = z.enum([
2674
3641
  ]);
2675
3642
  const DEFAULT_MESSAGE_PACING = "normal";
2676
3643
  const MessagePacingSettingsSchema = z.object({ pacing: MessagePacingSchema }).strict();
3644
+ /**
3645
+ * A conversation of its own under a channel's conversation (docs/NekroNxt界面交互模型.md §5.6): the agent opens one
3646
+ * for a separate piece of work, and the host opens scripted ones to check creation candidates. It has its own log
3647
+ * and context, and is shown under its channel.
3648
+ */
3649
+ const SubConversationSchema = z.object({
3650
+ id: SubConversationIdSchema,
3651
+ channelId: ChannelIdSchema,
3652
+ episodeId: EpisodeIdSchema,
3653
+ agentId: AgentIdSchema,
3654
+ title: z.string().min(1).max(200),
3655
+ /** `agent`: the agent opened it with a tool; `host`: NekroNXT opened it, such as to check a candidate. */
3656
+ openedBy: z.enum(["agent", "host"]),
3657
+ /** `model`: the agent's model talks in it; `script`: the host plays fixed tool calls. */
3658
+ driver: z.enum(["model", "script"]),
3659
+ status: z.enum(["open", "closed"]),
3660
+ closeReason: z.enum([
3661
+ "completed",
3662
+ "closed-by-agent",
3663
+ "closed-by-admin",
3664
+ "failed",
3665
+ "conversation-ended"
3666
+ ]).optional(),
3667
+ /** What it handed back to the channel's conversation when it ended. */
3668
+ summary: z.string().max(4e3).optional(),
3669
+ authoringTaskId: AuthoringTaskIdSchema.optional(),
3670
+ createdAt: z.number().int().nonnegative(),
3671
+ closedAt: z.number().int().nonnegative().optional()
3672
+ }).strict();
3673
+ /** How long ended sub-conversations are kept before they are cleaned up. */
3674
+ const SubConversationRetentionSchema = z.enum([
3675
+ "1d",
3676
+ "3d",
3677
+ "7d",
3678
+ "30d",
3679
+ "never"
3680
+ ]);
3681
+ const DEFAULT_SUB_CONVERSATION_RETENTION = "7d";
3682
+ const SubConversationSettingsSchema = z.object({ retention: SubConversationRetentionSchema }).strict();
2677
3683
  /** `keyword`: SQLite keyword search only; `builtin`: keywords fused with the built-in semantic model. */
2678
3684
  const RetrievalModeSchema = z.enum(["keyword", "builtin"]);
2679
3685
  /** Search used by extension indexes (表情包与扩展素材能力 §6.4). */
@@ -2709,6 +3715,26 @@ const RetrievalStatusSchema = z.object({
2709
3715
  error: z.string().optional()
2710
3716
  }).strict()
2711
3717
  }).strict();
3718
+ /** Where the Host keeps restore points it takes before an upgrade, or none. */
3719
+ const UpgradeBackupModeSchema = z.enum([
3720
+ "data",
3721
+ "directory",
3722
+ "off"
3723
+ ]);
3724
+ const UpgradeBackupSettingsSchema = z.object({
3725
+ mode: UpgradeBackupModeSchema,
3726
+ /** The chosen directory when `mode` is `directory`. */
3727
+ directory: z.string().nullable(),
3728
+ /** Set through the server's environment; the settings page cannot change it. */
3729
+ locked: z.boolean(),
3730
+ /** Restore points kept; older ones are removed after an upgrade succeeds. */
3731
+ keep: z.number().int().positive(),
3732
+ /** Restore points currently in the chosen place. */
3733
+ usage: z.object({
3734
+ count: z.number().int().nonnegative(),
3735
+ bytes: z.number().int().nonnegative()
3736
+ }).strict()
3737
+ }).strict();
2712
3738
  /** What the agent keeps about individual members of one channel; each note comes with that member's messages. */
2713
3739
  const ChannelMemberNotesViewSchema = z.object({
2714
3740
  notes: z.array(z.object({
@@ -2820,7 +3846,9 @@ const AttentionItemSchema = z.object({
2820
3846
  "authoring-approval",
2821
3847
  "connection-unhealthy",
2822
3848
  "agent-model-unavailable",
2823
- "agent-vision-unavailable"
3849
+ "agent-vision-unavailable",
3850
+ "logs-unavailable",
3851
+ "community-feedback"
2824
3852
  ]),
2825
3853
  severity: z.enum([
2826
3854
  "critical",
@@ -2833,7 +3861,9 @@ const AttentionItemSchema = z.object({
2833
3861
  "channel",
2834
3862
  "authoring-task",
2835
3863
  "connection",
2836
- "agent"
3864
+ "agent",
3865
+ "logs",
3866
+ "community-feedback"
2837
3867
  ]),
2838
3868
  id: NonEmptyStringSchema
2839
3869
  }).strict(),
@@ -2852,7 +3882,9 @@ const AttentionItemSchema = z.object({
2852
3882
  "resolve-delivery",
2853
3883
  "open-authoring-task",
2854
3884
  "open-connection",
2855
- "open-agent"
3885
+ "open-agent",
3886
+ "open-logs",
3887
+ "open-community-feedback"
2856
3888
  ]),
2857
3889
  label: z.string().min(1).max(40)
2858
3890
  }).strict(),
@@ -2980,7 +4012,69 @@ const CodeRunAvailabilitySchema = z.object({
2980
4012
  error: z.string().optional()
2981
4013
  }).strict().optional()
2982
4014
  }).strict();
4015
+ /** The GitHub CLI commands call: found on this machine, or downloaded by NekroNXT where it can. */
4016
+ const GithubCliAvailabilitySchema = CodeRunAvailabilitySchema;
4017
+ /** The optional headless Chromium that loads and checks creation candidates when no page is open. */
4018
+ const VerificationBrowserAvailabilitySchema = CodeRunAvailabilitySchema;
4019
+ /**
4020
+ * One account in the host's library. The library only keeps accounts; an account takes effect only for the agents
4021
+ * whose capabilities grant it, which `usedBy` lists.
4022
+ */
4023
+ const CommandAccountSchema = z.object({
4024
+ id: NonEmptyStringSchema.max(64),
4025
+ service: CommandAccountServiceSchema,
4026
+ /** The account name on the service. */
4027
+ login: NonEmptyStringSchema,
4028
+ source: z.enum(["token", "gh-login"]),
4029
+ /** Token scopes where the service reports them (classic tokens); absent for fine-grained tokens. */
4030
+ scopes: z.array(z.string()).optional(),
4031
+ createdAt: z.number().int().nonnegative(),
4032
+ usedBy: z.array(AgentIdSchema)
4033
+ }).strict();
4034
+ /** A login the local `gh` holds, offered as a quick way to add an account. */
4035
+ const LocalGithubLoginSchema = z.object({
4036
+ login: NonEmptyStringSchema,
4037
+ active: z.boolean()
4038
+ }).strict();
4039
+ const CommandAccountsViewSchema = z.object({
4040
+ accounts: z.array(CommandAccountSchema),
4041
+ /** Logins found in the local GitHub CLI; empty when it is missing or not logged in. */
4042
+ localLogins: z.array(LocalGithubLoginSchema)
4043
+ }).strict();
4044
+ const AddCommandAccountRequestSchema = z.discriminatedUnion("source", [z.object({
4045
+ source: z.literal("token"),
4046
+ service: CommandAccountServiceSchema,
4047
+ token: NonEmptyStringSchema.max(512)
4048
+ }).strict(), z.object({
4049
+ source: z.literal("gh-login"),
4050
+ service: CommandAccountServiceSchema,
4051
+ login: NonEmptyStringSchema.max(128)
4052
+ }).strict()]);
4053
+ /** An extension action an agent asked an administrator to confirm, or one it took on its own. */
4054
+ const ExtensionRequestSchema = z.object({
4055
+ number: z.number().int().positive(),
4056
+ kind: z.string(),
4057
+ agentId: AgentIdSchema,
4058
+ channelId: ChannelIdSchema.nullable(),
4059
+ extensionId: ExtensionIdSchema.nullable(),
4060
+ summary: z.string(),
4061
+ status: z.enum([
4062
+ "pending",
4063
+ "approved",
4064
+ "rejected",
4065
+ "expired",
4066
+ "completed",
4067
+ "failed"
4068
+ ]),
4069
+ autonomous: z.boolean(),
4070
+ resultMessage: z.string().nullable(),
4071
+ decidedBy: z.string().nullable(),
4072
+ createdAt: z.number().int().nonnegative(),
4073
+ expiresAt: z.number().int().nonnegative(),
4074
+ decidedAt: z.number().int().nonnegative().nullable()
4075
+ }).strict();
2983
4076
  const HostSnapshotSchema = z.object({
4077
+ communityFeedback: CommunityFeedbackSnapshotSchema.optional(),
2984
4078
  upgrade: HostUpgradeSummarySchema.optional(),
2985
4079
  cursor: HostSyncCursorSchema,
2986
4080
  diagnosticsSampledAt: z.number().int().nonnegative(),
@@ -3005,12 +4099,17 @@ const HostSnapshotSchema = z.object({
3005
4099
  subagents: z.object({ available: z.boolean() }).strict(),
3006
4100
  /** Optional in older hosts, which never offer `run_code`. */
3007
4101
  codeRun: CodeRunAvailabilitySchema.optional(),
4102
+ /** Optional in older hosts, which never offer command accounts. */
4103
+ githubCli: GithubCliAvailabilitySchema.optional(),
4104
+ /** Optional in older hosts, which check candidates only in an open page. */
4105
+ verificationBrowser: VerificationBrowserAvailabilitySchema.optional(),
3008
4106
  /** What this host can confine for commands beyond file writes; optional in older hosts. */
3009
4107
  commandConfinement: z.object({
3010
4108
  readScope: z.boolean(),
3011
4109
  networkControl: z.boolean()
3012
4110
  }).strict().optional(),
3013
4111
  webSearch: z.object({
4112
+ unavailableReason: z.string().optional(),
3014
4113
  provider: z.literal("deepseek-official"),
3015
4114
  available: z.boolean(),
3016
4115
  credentialConfigured: z.boolean(),
@@ -3022,6 +4121,8 @@ const HostSnapshotSchema = z.object({
3022
4121
  }).strict(),
3023
4122
  connectionAdapters: z.array(AdapterConnectionDescriptorSchema),
3024
4123
  notificationSettings: NotificationSettingsViewSchema,
4124
+ /** Optional in older hosts, which have no account library. */
4125
+ commandAccounts: z.array(CommandAccountSchema).optional(),
3025
4126
  agents: z.array(z.object({
3026
4127
  id: AgentIdSchema,
3027
4128
  displayName: z.string(),
@@ -3079,6 +4180,8 @@ const HostSnapshotSchema = z.object({
3079
4180
  "direct"
3080
4181
  ]),
3081
4182
  displayName: z.string().optional(),
4183
+ localDisplayName: z.string().optional(),
4184
+ platformDisplayName: z.string().optional(),
3082
4185
  boundAgentId: AgentIdSchema.optional(),
3083
4186
  runtimePhase: ChannelRuntimePhaseSchema.default("idle"),
3084
4187
  activity: ChannelActivitySummarySchema.default({
@@ -3091,6 +4194,8 @@ const HostSnapshotSchema = z.object({
3091
4194
  channelId: ChannelIdSchema,
3092
4195
  agentId: AgentIdSchema,
3093
4196
  triggerPolicy: TriggerPolicySchema,
4197
+ /** Channel pause, independent of the response rule. */
4198
+ paused: z.boolean().default(false),
3094
4199
  processingFeedback: z.enum(["auto", "off"]).default("auto"),
3095
4200
  /** Absent means `observe`. */
3096
4201
  localAgentMessages: z.enum(["observe", "trigger"]).optional(),
@@ -3109,6 +4214,7 @@ const HostSnapshotSchema = z.object({
3109
4214
  adapterKey: NonEmptyStringSchema,
3110
4215
  alias: ConnectionAliasOutputSchema.optional(),
3111
4216
  activityTriggerDefaults: z.array(AdapterActivityKeySchema).default([]),
4217
+ configuredSecrets: z.array(z.string()).optional(),
3112
4218
  status: z.object({
3113
4219
  state: z.enum([
3114
4220
  "stopped",
@@ -3178,9 +4284,45 @@ const HostSnapshotSchema = z.object({
3178
4284
  displayName: z.string(),
3179
4285
  description: z.string(),
3180
4286
  createdByAgentId: AgentIdSchema.optional(),
4287
+ /** The Revision of another extension this one was branched from. */
4288
+ branchOf: z.object({
4289
+ extensionId: ExtensionIdSchema,
4290
+ revisionId: ExtensionRevisionIdSchema,
4291
+ /** Present while the original is on this machine. */
4292
+ displayName: z.string().optional()
4293
+ }).strict().optional(),
4294
+ /** Shape version of the data stored on this machine. */
4295
+ dataVersion: z.number().int().positive().default(1),
4296
+ /** The unfinished revise task of this extension, if any. */
4297
+ openRevisionTaskId: AuthoringTaskIdSchema.optional(),
4298
+ /** Whether this machine publishes (`owner`) or follows the line on each community. */
4299
+ communityLinks: z.array(z.object({
4300
+ communityUrl: z.string(),
4301
+ role: z.enum(["owner", "subscriber"])
4302
+ }).strict()).default([]),
3181
4303
  revisions: z.array(z.object({
3182
4304
  id: ExtensionRevisionIdSchema,
3183
4305
  revisionNumber: z.number().int().positive(),
4306
+ /** Version number from the lineage, `v3` (or `v3·2` for a second Revision of the same generation). */
4307
+ versionLabel: z.string(),
4308
+ parentRevisionId: ExtensionRevisionIdSchema.optional(),
4309
+ origin: z.enum([
4310
+ "authored",
4311
+ "file",
4312
+ "community",
4313
+ "branch"
4314
+ ]),
4315
+ authoringTaskId: AuthoringTaskIdSchema.optional(),
4316
+ dataVersion: z.number().int().positive(),
4317
+ /** Community releases this Revision is; installs and publishes from here both record one. */
4318
+ releases: z.array(z.object({
4319
+ communityUrl: z.string(),
4320
+ releaseId: CommunityReleaseIdSchema,
4321
+ number: z.number().int().positive().nullable(),
4322
+ publisherHandle: z.string(),
4323
+ via: z.enum(["install", "publish"]),
4324
+ recordedAt: z.number().int().nonnegative()
4325
+ }).strict()).default([]),
3184
4326
  format: z.enum(["current", "unavailable"]).optional(),
3185
4327
  ui: ExtensionUiContributionsSchema.default(EMPTY_EXTENSION_UI_CONTRIBUTIONS),
3186
4328
  /** The host instance's configuration form (`config.host`). */
@@ -3190,8 +4332,6 @@ const HostSnapshotSchema = z.object({
3190
4332
  /** 扩展包自带图标的读取路径(同源、按摘要寻址、可长期缓存);没有图标时缺省。 */
3191
4333
  iconUrl: z.string().regex(/^\/api\/extensions\/[^/]+\/revisions\/[^/]+\/icon\/[a-f0-9]{64}\.(?:svg|png|webp)$/u).optional(),
3192
4334
  createdAt: z.number().int().safe().nonnegative(),
3193
- /** 从社区安装的版本的来源;本机保存与文件导入没有来源。 */
3194
- source: CommunitySourceSchema.optional(),
3195
4335
  provides: z.array(ExtensionProvideSchema),
3196
4336
  /** Whether this Revision can be enabled for agents (agent-layer contributions or capabilities). */
3197
4337
  agentLayer: z.boolean(),
@@ -3335,17 +4475,36 @@ const HostSnapshotSchema = z.object({
3335
4475
  }).strict()
3336
4476
  }).strict()),
3337
4477
  authoringTasks: z.array(AuthoringTaskSummarySchema).default([]),
3338
- scheduledTasks: z.array(ScheduledTaskSchema).default([])
4478
+ /** Open sub-conversations, and the most recently ended ones of each channel. */
4479
+ subConversations: z.array(SubConversationSchema).default([]),
4480
+ scheduledTasks: z.array(ScheduledTaskSchema).default([]),
4481
+ /** Extension requests waiting for an administrator. */
4482
+ extensionRequests: z.array(ExtensionRequestSchema).default([])
3339
4483
  }).strict();
3340
- const MessageInputPartSchema = z.discriminatedUnion("type", [z.object({
3341
- type: z.literal("text"),
3342
- text: z.string().trim().min(1)
3343
- }).strict(), z.object({
3344
- type: z.literal("mention"),
3345
- memberId: ChannelMemberIdSchema
3346
- }).strict()]);
4484
+ const CHANNEL_COMPOSER_MAX_ATTACHMENTS = 20;
4485
+ const CHANNEL_COMPOSER_MAX_BYTES = 64 * 1024 * 1024;
4486
+ const MessageInputPartSchema = z.discriminatedUnion("type", [
4487
+ z.object({
4488
+ type: z.literal("text"),
4489
+ text: z.string().trim().min(1)
4490
+ }).strict(),
4491
+ z.object({
4492
+ type: z.literal("mention"),
4493
+ memberId: ChannelMemberIdSchema
4494
+ }).strict(),
4495
+ z.object({
4496
+ type: z.literal("image"),
4497
+ assetId: AssetIdSchema,
4498
+ alt: z.string().trim().max(500).optional()
4499
+ }).strict(),
4500
+ z.object({
4501
+ type: z.literal("file"),
4502
+ assetId: AssetIdSchema,
4503
+ name: z.string().trim().max(255).optional()
4504
+ }).strict()
4505
+ ]);
3347
4506
  const SendChannelMessageRequestSchema = z.object({
3348
- parts: z.array(MessageInputPartSchema).min(1),
4507
+ parts: z.array(MessageInputPartSchema).min(1).max(256).refine((parts) => parts.filter((part) => part.type === "image" || part.type === "file").length <= 20, "每条消息最多添加 20 个附件。"),
3349
4508
  clientEventId: NonEmptyStringSchema.optional(),
3350
4509
  senderMemberId: ChannelMemberIdSchema.optional()
3351
4510
  }).strict().refine((body) => body.parts.every((part) => part.type !== "text" || [...part.text].length <= 64 * 1024), "Message text must not exceed 64 KiB.");
@@ -3760,6 +4919,125 @@ const agentExtensionParam = z.object({
3760
4919
  extensionId: ExtensionIdSchema
3761
4920
  }).strict();
3762
4921
  const PermissionApprovalSchema = z.object({ permissionDigest: z.string().regex(/^[a-f0-9]{64}$/u) }).strict();
4922
+ /** One version of one line in the lineage view of an extension family. */
4923
+ const ExtensionLineageNodeSchema = z.object({
4924
+ revisionId: ExtensionRevisionIdSchema,
4925
+ extensionId: ExtensionIdSchema,
4926
+ label: z.string(),
4927
+ parentRevisionId: ExtensionRevisionIdSchema.optional(),
4928
+ origin: z.enum([
4929
+ "authored",
4930
+ "file",
4931
+ "community",
4932
+ "branch"
4933
+ ]),
4934
+ createdAt: z.number().int().nonnegative(),
4935
+ current: z.boolean(),
4936
+ releaseNumbers: z.array(z.number().int().positive())
4937
+ }).strict();
4938
+ /** Every line of the family an extension belongs to: the original and every branch of a branch on this machine. */
4939
+ const ExtensionLineageSchema = z.object({ lines: z.array(z.object({
4940
+ extensionId: ExtensionIdSchema,
4941
+ displayName: z.string(),
4942
+ branchOf: z.object({
4943
+ extensionId: ExtensionIdSchema,
4944
+ revisionId: ExtensionRevisionIdSchema
4945
+ }).strict().optional(),
4946
+ nodes: z.array(ExtensionLineageNodeSchema)
4947
+ }).strict()) }).strict();
4948
+ const DataChangeCountSchema = z.object({
4949
+ added: z.number().int().nonnegative(),
4950
+ overwritten: z.number().int().nonnegative(),
4951
+ removed: z.number().int().nonnegative(),
4952
+ unchanged: z.number().int().nonnegative()
4953
+ }).strict();
4954
+ /** Where a data migration takes data from. */
4955
+ const ExtensionDataSourceSchema = z.discriminatedUnion("kind", [
4956
+ z.object({
4957
+ kind: z.literal("extension"),
4958
+ extensionId: ExtensionIdSchema
4959
+ }).strict(),
4960
+ z.object({
4961
+ kind: z.literal("snapshot"),
4962
+ snapshotId: z.string().min(1).max(80)
4963
+ }).strict(),
4964
+ z.object({
4965
+ kind: z.literal("package"),
4966
+ token: z.string().min(1).max(80)
4967
+ }).strict()
4968
+ ]);
4969
+ const ExtensionDataMigrationInputSchema = z.object({
4970
+ source: ExtensionDataSourceSchema,
4971
+ mode: z.enum(["overwrite", "replace"]),
4972
+ /** Storage of a source agent goes to the mapped agent here; unmapped agents are skipped. */
4973
+ agentMap: z.record(z.string(), AgentIdSchema).optional(),
4974
+ /** Also move the host and agent configuration (never credentials) the same way. */
4975
+ includeConfig: z.boolean().optional()
4976
+ }).strict();
4977
+ const ExtensionDataPreviewSchema = z.object({
4978
+ diff: z.object({
4979
+ storage: DataChangeCountSchema,
4980
+ index: DataChangeCountSchema,
4981
+ library: DataChangeCountSchema
4982
+ }).strict(),
4983
+ destructive: z.boolean(),
4984
+ sourceDataVersion: z.number().int().positive(),
4985
+ targetDataVersion: z.number().int().positive(),
4986
+ needsMigration: z.boolean(),
4987
+ /** Configuration fields that would change, when configuration moves too. */
4988
+ config: z.object({
4989
+ hostFields: z.array(z.string()),
4990
+ agents: z.array(z.object({
4991
+ agentId: AgentIdSchema,
4992
+ fields: z.array(z.string())
4993
+ }).strict())
4994
+ }).strict().optional()
4995
+ }).strict();
4996
+ const ExtensionDataStateSchema = z.object({
4997
+ dataVersion: z.number().int().positive(),
4998
+ counts: z.object({
4999
+ storage: z.number().int().nonnegative(),
5000
+ index: z.number().int().nonnegative(),
5001
+ library: z.number().int().nonnegative()
5002
+ }).strict(),
5003
+ snapshots: z.array(z.object({
5004
+ id: z.string(),
5005
+ reason: z.enum([
5006
+ "switch",
5007
+ "migration",
5008
+ "manual"
5009
+ ]),
5010
+ label: z.string(),
5011
+ dataVersion: z.number().int().positive(),
5012
+ byteSize: z.number().int().nonnegative(),
5013
+ createdAt: z.number().int().nonnegative()
5014
+ }).strict())
5015
+ }).strict();
5016
+ const ExtensionDataPackageInspectionSchema = z.object({
5017
+ token: z.string(),
5018
+ extensionId: z.string(),
5019
+ displayName: z.string(),
5020
+ dataVersion: z.number().int().positive(),
5021
+ exportedAt: z.number().int().nonnegative(),
5022
+ agents: z.array(z.object({
5023
+ id: z.string(),
5024
+ name: z.string()
5025
+ }).strict()),
5026
+ counts: z.object({
5027
+ storage: z.number().int().nonnegative(),
5028
+ index: z.number().int().nonnegative(),
5029
+ library: z.number().int().nonnegative()
5030
+ }).strict()
5031
+ }).strict();
5032
+ const AdministratorSchema = z.object({
5033
+ connectionId: ConnectionIdSchema,
5034
+ connectionName: z.string(),
5035
+ platformUserId: z.string(),
5036
+ identityId: PlatformIdentityIdSchema.optional(),
5037
+ displayName: z.string(),
5038
+ addedVia: z.enum(["console", "claim"]),
5039
+ addedAt: z.number().int().nonnegative()
5040
+ }).strict();
3763
5041
  const extensionParam = z.object({ extensionId: ExtensionIdSchema }).strict();
3764
5042
  const dshPluginPackageParam = z.object({ packageId: DshPluginPackageIdSchema }).strict();
3765
5043
  const dshPluginEntryParam = z.object({ entryId: DshPluginEntryIdSchema }).strict();
@@ -3771,6 +5049,7 @@ const dshSettingsParam = z.object({ namespace: NonEmptyStringSchema }).strict();
3771
5049
  const dshCredentialParam = z.object({ ref: DshCredentialRefSchema }).strict();
3772
5050
  const llmProviderParam = z.object({ provider: NonEmptyStringSchema }).strict();
3773
5051
  const authoringTaskParam = z.object({ taskId: AuthoringTaskIdSchema }).strict();
5052
+ const subConversationParam = z.object({ conversationId: SubConversationIdSchema }).strict();
3774
5053
  const scheduledTaskParam = z.object({ taskId: ScheduledTaskIdSchema }).strict();
3775
5054
  const authoringAttemptParam = z.object({
3776
5055
  taskId: AuthoringTaskIdSchema,
@@ -3806,6 +5085,174 @@ const encodeBinaryUpload = (input) => ({
3806
5085
  }
3807
5086
  });
3808
5087
  const HostApiContracts = {
5088
+ listCommands: defineContract({
5089
+ method: "GET",
5090
+ path: "/api/commands",
5091
+ params: z.object({ channelId: ChannelIdSchema.optional() }).strict(),
5092
+ request: NoRequestBodySchema,
5093
+ response: z.object({
5094
+ commands: z.array(CommandCatalogEntrySchema),
5095
+ problems: z.array(z.string()),
5096
+ /** Host-wide behavior: whether platform members without a grant are told so. */
5097
+ settings: z.object({ unauthorizedFeedback: z.boolean() }).strict(),
5098
+ /** Present when a channel was requested. */
5099
+ channel: z.object({
5100
+ kind: z.enum([
5101
+ "internal",
5102
+ "direct",
5103
+ "group"
5104
+ ]),
5105
+ /** The channel is an external group where commands must address the account. */
5106
+ requiresMention: z.boolean(),
5107
+ bareCommands: z.boolean()
5108
+ }).strict().optional()
5109
+ }).strict(),
5110
+ error: HostApiErrorSchema
5111
+ }),
5112
+ executeCommand: defineContract({
5113
+ method: "POST",
5114
+ path: "/api/commands/execute",
5115
+ params: EmptyParamsSchema,
5116
+ request: z.object({
5117
+ channelId: ChannelIdSchema,
5118
+ text: z.string().min(1).max(16e3),
5119
+ requestId: z.string().min(1).max(200)
5120
+ }).strict(),
5121
+ response: CommandExecutionRecordSchema,
5122
+ error: HostApiErrorSchema,
5123
+ invalidatesSnapshot: true
5124
+ }),
5125
+ getCommandExecution: defineContract({
5126
+ method: "GET",
5127
+ path: "/api/commands/executions/:executionId",
5128
+ params: z.object({ executionId: z.string().min(1) }).strict(),
5129
+ request: NoRequestBodySchema,
5130
+ response: CommandExecutionRecordSchema,
5131
+ error: HostApiErrorSchema
5132
+ }),
5133
+ setCommandPolicy: defineContract({
5134
+ method: "PUT",
5135
+ path: "/api/commands/policy",
5136
+ params: EmptyParamsSchema,
5137
+ request: z.object({
5138
+ scope: z.union([z.literal("global"), ChannelIdSchema]),
5139
+ name: z.string().min(1),
5140
+ policy: CommandPolicySchema
5141
+ }).strict(),
5142
+ response: z.object({ saved: z.literal(true) }).strict(),
5143
+ error: HostApiErrorSchema,
5144
+ invalidatesSnapshot: true
5145
+ }),
5146
+ listCommandMembers: defineContract({
5147
+ method: "GET",
5148
+ path: "/api/commands/members/:channelId",
5149
+ params: z.object({ channelId: ChannelIdSchema }).strict(),
5150
+ request: NoRequestBodySchema,
5151
+ response: z.object({ members: z.array(z.object({
5152
+ identityId: PlatformIdentityIdSchema,
5153
+ displayName: z.string(),
5154
+ platformUserId: z.string(),
5155
+ authorized: z.boolean()
5156
+ }).strict()) }).strict(),
5157
+ error: HostApiErrorSchema
5158
+ }),
5159
+ setCommandSettings: defineContract({
5160
+ method: "PUT",
5161
+ path: "/api/commands/settings",
5162
+ params: EmptyParamsSchema,
5163
+ request: z.object({ unauthorizedFeedback: z.boolean() }).strict(),
5164
+ response: z.object({ saved: z.literal(true) }).strict(),
5165
+ error: HostApiErrorSchema
5166
+ }),
5167
+ setCommandChannelSettings: defineContract({
5168
+ method: "PUT",
5169
+ path: "/api/commands/channel-settings",
5170
+ params: EmptyParamsSchema,
5171
+ request: z.object({
5172
+ channelId: ChannelIdSchema,
5173
+ bareCommands: z.boolean()
5174
+ }).strict(),
5175
+ response: z.object({ saved: z.literal(true) }).strict(),
5176
+ error: HostApiErrorSchema,
5177
+ invalidatesSnapshot: true
5178
+ }),
5179
+ setCommandGrant: defineContract({
5180
+ method: "PUT",
5181
+ path: "/api/commands/grants",
5182
+ params: EmptyParamsSchema,
5183
+ request: z.object({
5184
+ channelId: ChannelIdSchema,
5185
+ identityId: PlatformIdentityIdSchema,
5186
+ enabled: z.boolean()
5187
+ }).strict(),
5188
+ response: z.object({ saved: z.literal(true) }).strict(),
5189
+ error: HostApiErrorSchema,
5190
+ invalidatesSnapshot: true
5191
+ }),
5192
+ queryLogs: defineContract({
5193
+ method: "GET",
5194
+ path: "/api/logs",
5195
+ params: z.object({ query: z.string().max(32768).optional() }).strict(),
5196
+ request: NoRequestBodySchema,
5197
+ response: hostLogPageSchema,
5198
+ error: HostApiErrorSchema
5199
+ }),
5200
+ getLog: defineContract({
5201
+ method: "GET",
5202
+ path: "/api/logs/:id",
5203
+ params: z.object({ id: z.string().min(1).max(256) }).strict(),
5204
+ request: NoRequestBodySchema,
5205
+ response: z.object({ entry: hostLogEntrySchema }).strict(),
5206
+ error: HostApiErrorSchema
5207
+ }),
5208
+ logSources: defineContract({
5209
+ method: "GET",
5210
+ path: "/api/logs/sources",
5211
+ params: EmptyParamsSchema,
5212
+ request: NoRequestBodySchema,
5213
+ response: z.object({ sources: z.array(hostLogSourceSchema) }).strict(),
5214
+ error: HostApiErrorSchema
5215
+ }),
5216
+ logStatus: defineContract({
5217
+ method: "GET",
5218
+ path: "/api/logs/status",
5219
+ params: EmptyParamsSchema,
5220
+ request: NoRequestBodySchema,
5221
+ response: hostLogStatusSchema,
5222
+ error: HostApiErrorSchema
5223
+ }),
5224
+ logSettings: defineContract({
5225
+ method: "GET",
5226
+ path: "/api/logs/settings",
5227
+ params: EmptyParamsSchema,
5228
+ request: NoRequestBodySchema,
5229
+ response: hostLogSettingsSchema,
5230
+ error: HostApiErrorSchema
5231
+ }),
5232
+ updateLogSettings: defineContract({
5233
+ method: "PUT",
5234
+ path: "/api/logs/settings",
5235
+ params: EmptyParamsSchema,
5236
+ request: hostLogSettingsSchema,
5237
+ response: hostLogSettingsSchema,
5238
+ error: HostApiErrorSchema
5239
+ }),
5240
+ startLogDebug: defineContract({
5241
+ method: "POST",
5242
+ path: "/api/logs/debug",
5243
+ params: EmptyParamsSchema,
5244
+ request: hostLogDebugRequestSchema,
5245
+ response: z.object({ lease: hostLogDebugLeaseSchema }).strict(),
5246
+ error: HostApiErrorSchema
5247
+ }),
5248
+ stopLogDebug: defineContract({
5249
+ method: "DELETE",
5250
+ path: "/api/logs/debug/:id",
5251
+ params: z.object({ id: z.string().min(1).max(256) }).strict(),
5252
+ request: NoRequestBodySchema,
5253
+ response: z.object({ stopped: z.literal(true) }).strict(),
5254
+ error: HostApiErrorSchema
5255
+ }),
3809
5256
  retryRuntimeCompatibility: defineContract({
3810
5257
  method: "POST",
3811
5258
  path: "/api/runtime/compatibility/retry",
@@ -4103,6 +5550,7 @@ const HostApiContracts = {
4103
5550
  channelId: ChannelIdSchema,
4104
5551
  agentId: AgentIdSchema,
4105
5552
  triggerPolicy: TriggerPolicySchema,
5553
+ paused: z.boolean().default(false),
4106
5554
  processingFeedback: z.enum(["auto", "off"]).default("auto"),
4107
5555
  localAgentMessages: z.enum(["observe", "trigger"]).optional(),
4108
5556
  activityTriggerOverrides: ActivityTriggerOverridesSchema.default({}),
@@ -4160,12 +5608,48 @@ const HostApiContracts = {
4160
5608
  }).strict(),
4161
5609
  error: HostApiErrorSchema
4162
5610
  }),
5611
+ uploadChannelAsset: defineContract({
5612
+ method: "POST",
5613
+ path: "/api/channels/:channelId/assets",
5614
+ params: channelParam,
5615
+ request: BinaryUploadRequestSchema,
5616
+ encodeRequest: (input) => ({
5617
+ body: input.bytes,
5618
+ headers: {
5619
+ "content-type": "application/octet-stream",
5620
+ "x-file-name": encodeURIComponent(input.fileName ?? "附件")
5621
+ }
5622
+ }),
5623
+ response: z.object({
5624
+ assetId: AssetIdSchema,
5625
+ mediaType: z.string().min(1),
5626
+ byteSize: z.number().int().nonnegative(),
5627
+ fileName: z.string().min(1).max(255),
5628
+ partType: z.enum(["image", "file"])
5629
+ }).strict(),
5630
+ error: HostApiErrorSchema
5631
+ }),
5632
+ deleteChannelAsset: defineContract({
5633
+ method: "DELETE",
5634
+ path: "/api/channels/:channelId/assets/:assetId",
5635
+ params: z.object({
5636
+ channelId: ChannelIdSchema,
5637
+ assetId: AssetIdSchema
5638
+ }).strict(),
5639
+ request: NoRequestBodySchema,
5640
+ response: z.object({
5641
+ assetId: AssetIdSchema,
5642
+ revoked: z.literal(true)
5643
+ }).strict(),
5644
+ error: HostApiErrorSchema
5645
+ }),
4163
5646
  renameChannel: defineContract({
4164
5647
  invalidatesSnapshot: true,
4165
5648
  method: "POST",
4166
5649
  path: "/api/channels/:channelId/display-name",
4167
5650
  params: channelParam,
4168
- request: z.object({ displayName: z.string().trim().min(1).max(120) }).strict(),
5651
+ /** Empty selects the known platform name for an external channel. */
5652
+ request: z.object({ displayName: z.string().trim().max(120) }).strict(),
4169
5653
  response: z.object({
4170
5654
  channelId: ChannelIdSchema,
4171
5655
  displayName: z.string().trim().min(1).max(120)
@@ -4207,6 +5691,59 @@ const HostApiContracts = {
4207
5691
  response: ChannelRuntimeContextSchema,
4208
5692
  error: HostApiErrorSchema
4209
5693
  }),
5694
+ listSubConversations: defineContract({
5695
+ method: "GET",
5696
+ path: "/api/sub-conversations/channels/:channelId",
5697
+ params: channelParam,
5698
+ request: NoRequestBodySchema,
5699
+ response: z.object({ items: z.array(SubConversationSchema) }).strict(),
5700
+ error: HostApiErrorSchema
5701
+ }),
5702
+ getSubConversationRuntime: defineContract({
5703
+ method: "GET",
5704
+ path: "/api/sub-conversations/:conversationId/runtime",
5705
+ params: subConversationParam,
5706
+ request: NoRequestBodySchema,
5707
+ response: z.object({
5708
+ conversation: SubConversationSchema,
5709
+ runtime: ChannelRuntimeProjectionSchema
5710
+ }).strict(),
5711
+ error: HostApiErrorSchema
5712
+ }),
5713
+ closeSubConversation: defineContract({
5714
+ invalidatesSnapshot: true,
5715
+ method: "POST",
5716
+ path: "/api/sub-conversations/:conversationId/close",
5717
+ params: subConversationParam,
5718
+ request: z.object({}).strict(),
5719
+ response: SubConversationSchema,
5720
+ error: HostApiErrorSchema
5721
+ }),
5722
+ deleteSubConversation: defineContract({
5723
+ invalidatesSnapshot: true,
5724
+ method: "DELETE",
5725
+ path: "/api/sub-conversations/:conversationId",
5726
+ params: subConversationParam,
5727
+ request: NoRequestBodySchema,
5728
+ response: z.object({ deleted: z.literal(true) }).strict(),
5729
+ error: HostApiErrorSchema
5730
+ }),
5731
+ getSubConversationSettings: defineContract({
5732
+ method: "GET",
5733
+ path: "/api/settings/sub-conversations",
5734
+ params: EmptyParamsSchema,
5735
+ request: NoRequestBodySchema,
5736
+ response: SubConversationSettingsSchema,
5737
+ error: HostApiErrorSchema
5738
+ }),
5739
+ updateSubConversationSettings: defineContract({
5740
+ method: "PUT",
5741
+ path: "/api/settings/sub-conversations",
5742
+ params: EmptyParamsSchema,
5743
+ request: SubConversationSettingsSchema,
5744
+ response: SubConversationSettingsSchema,
5745
+ error: HostApiErrorSchema
5746
+ }),
4210
5747
  getChannelRuntimeInput: defineContract({
4211
5748
  method: "GET",
4212
5749
  path: "/api/channels/:channelId/runtime/inputs/:messageId",
@@ -4287,6 +5824,25 @@ const HostApiContracts = {
4287
5824
  response: MessagePacingSettingsSchema,
4288
5825
  error: HostApiErrorSchema
4289
5826
  }),
5827
+ getUpgradeBackupSettings: defineContract({
5828
+ method: "GET",
5829
+ path: "/api/settings/upgrade-backup",
5830
+ params: EmptyParamsSchema,
5831
+ request: NoRequestBodySchema,
5832
+ response: UpgradeBackupSettingsSchema,
5833
+ error: HostApiErrorSchema
5834
+ }),
5835
+ updateUpgradeBackupSettings: defineContract({
5836
+ method: "PUT",
5837
+ path: "/api/settings/upgrade-backup",
5838
+ params: EmptyParamsSchema,
5839
+ request: z.object({
5840
+ mode: UpgradeBackupModeSchema,
5841
+ directory: z.string().trim().min(1).max(1024).optional()
5842
+ }).strict(),
5843
+ response: UpgradeBackupSettingsSchema,
5844
+ error: HostApiErrorSchema
5845
+ }),
4290
5846
  getRetrievalStatus: defineContract({
4291
5847
  method: "GET",
4292
5848
  path: "/api/settings/retrieval",
@@ -4337,6 +5893,77 @@ const HostApiContracts = {
4337
5893
  response: CodeRunAvailabilitySchema,
4338
5894
  error: HostApiErrorSchema
4339
5895
  }),
5896
+ downloadGithubCli: defineContract({
5897
+ invalidatesSnapshot: true,
5898
+ method: "POST",
5899
+ path: "/api/runtimes/github-cli/download",
5900
+ params: EmptyParamsSchema,
5901
+ request: NoRequestBodySchema,
5902
+ response: GithubCliAvailabilitySchema,
5903
+ error: HostApiErrorSchema
5904
+ }),
5905
+ removeGithubCli: defineContract({
5906
+ invalidatesSnapshot: true,
5907
+ method: "DELETE",
5908
+ path: "/api/runtimes/github-cli",
5909
+ params: EmptyParamsSchema,
5910
+ request: NoRequestBodySchema,
5911
+ response: GithubCliAvailabilitySchema,
5912
+ error: HostApiErrorSchema
5913
+ }),
5914
+ downloadVerificationBrowser: defineContract({
5915
+ invalidatesSnapshot: true,
5916
+ method: "POST",
5917
+ path: "/api/runtimes/verification-browser/download",
5918
+ params: EmptyParamsSchema,
5919
+ request: NoRequestBodySchema,
5920
+ response: VerificationBrowserAvailabilitySchema,
5921
+ error: HostApiErrorSchema
5922
+ }),
5923
+ removeVerificationBrowser: defineContract({
5924
+ invalidatesSnapshot: true,
5925
+ method: "DELETE",
5926
+ path: "/api/runtimes/verification-browser",
5927
+ params: EmptyParamsSchema,
5928
+ request: NoRequestBodySchema,
5929
+ response: VerificationBrowserAvailabilitySchema,
5930
+ error: HostApiErrorSchema
5931
+ }),
5932
+ getCommandAccounts: defineContract({
5933
+ method: "GET",
5934
+ path: "/api/settings/command-accounts",
5935
+ params: EmptyParamsSchema,
5936
+ request: NoRequestBodySchema,
5937
+ response: CommandAccountsViewSchema,
5938
+ error: HostApiErrorSchema
5939
+ }),
5940
+ addCommandAccount: defineContract({
5941
+ invalidatesSnapshot: true,
5942
+ method: "POST",
5943
+ path: "/api/settings/command-accounts",
5944
+ params: EmptyParamsSchema,
5945
+ request: AddCommandAccountRequestSchema,
5946
+ response: CommandAccountsViewSchema,
5947
+ error: HostApiErrorSchema
5948
+ }),
5949
+ replaceCommandAccountToken: defineContract({
5950
+ invalidatesSnapshot: true,
5951
+ method: "PUT",
5952
+ path: "/api/settings/command-accounts/:accountId",
5953
+ params: z.object({ accountId: NonEmptyStringSchema.max(64) }).strict(),
5954
+ request: AddCommandAccountRequestSchema,
5955
+ response: CommandAccountsViewSchema,
5956
+ error: HostApiErrorSchema
5957
+ }),
5958
+ removeCommandAccount: defineContract({
5959
+ invalidatesSnapshot: true,
5960
+ method: "DELETE",
5961
+ path: "/api/settings/command-accounts/:accountId",
5962
+ params: z.object({ accountId: NonEmptyStringSchema.max(64) }).strict(),
5963
+ request: NoRequestBodySchema,
5964
+ response: CommandAccountsViewSchema,
5965
+ error: HostApiErrorSchema
5966
+ }),
4340
5967
  getChannelMemberNotes: defineContract({
4341
5968
  method: "GET",
4342
5969
  path: "/api/channels/:channelId/member-notes",
@@ -4494,11 +6121,15 @@ const HostApiContracts = {
4494
6121
  method: "POST",
4495
6122
  path: "/api/connections/:connectionId/configuration",
4496
6123
  params: connectionParam,
4497
- request: z.object({ configuration: z.record(z.string(), z.union([
4498
- z.string(),
4499
- z.number(),
4500
- z.boolean()
4501
- ])) }).strict(),
6124
+ request: z.object({
6125
+ configuration: z.record(z.string(), z.union([
6126
+ z.string(),
6127
+ z.number(),
6128
+ z.boolean()
6129
+ ])),
6130
+ /** Omitted keys keep their value; null explicitly clears an optional credential. */
6131
+ credentials: z.record(z.string().min(1), z.string().min(1).max(16384).nullable()).optional()
6132
+ }).strict(),
4502
6133
  response: z.object({
4503
6134
  connectionId: ConnectionIdSchema,
4504
6135
  configuration: z.record(z.string(), z.union([
@@ -4684,6 +6315,142 @@ const HostApiContracts = {
4684
6315
  response: CommunityStatusSchema,
4685
6316
  error: HostApiErrorSchema
4686
6317
  }),
6318
+ getCommunityFeedbackSettings: defineContract({
6319
+ method: "GET",
6320
+ path: "/api/community/feedback/settings",
6321
+ params: EmptyParamsSchema,
6322
+ request: NoRequestBodySchema,
6323
+ response: CommunityFeedbackSettingsSchema,
6324
+ error: HostApiErrorSchema
6325
+ }),
6326
+ updateCommunityFeedbackSettings: defineContract({
6327
+ method: "PUT",
6328
+ path: "/api/community/feedback/settings",
6329
+ params: EmptyParamsSchema,
6330
+ request: CommunityFeedbackSettingsUpdateSchema,
6331
+ response: CommunityFeedbackSettingsSchema,
6332
+ error: HostApiErrorSchema,
6333
+ invalidatesSnapshot: true
6334
+ }),
6335
+ listCommunityFeedback: defineContract({
6336
+ timeoutMs: 6e4,
6337
+ method: "GET",
6338
+ path: "/api/community/feedback",
6339
+ params: z.object({ refresh: z.literal("1").optional() }).strict(),
6340
+ request: NoRequestBodySchema,
6341
+ response: CommunityFeedbackLocalListSchema,
6342
+ error: HostApiErrorSchema
6343
+ }),
6344
+ getCommunityFeedback: defineContract({
6345
+ timeoutMs: 6e4,
6346
+ method: "GET",
6347
+ path: "/api/community/feedback/items/:ref",
6348
+ params: z.object({ ref: CommunityFeedbackRefSchema }).strict(),
6349
+ request: NoRequestBodySchema,
6350
+ response: CommunityFeedbackSchema,
6351
+ error: HostApiErrorSchema
6352
+ }),
6353
+ createCommunityFeedbackDraft: defineContract({
6354
+ method: "POST",
6355
+ path: "/api/community/feedback/drafts",
6356
+ params: EmptyParamsSchema,
6357
+ request: CommunityFeedbackDraftInputSchema,
6358
+ response: CommunityFeedbackDraftSchema,
6359
+ error: HostApiErrorSchema,
6360
+ invalidatesSnapshot: true
6361
+ }),
6362
+ updateCommunityFeedbackDraft: defineContract({
6363
+ method: "PUT",
6364
+ path: "/api/community/feedback/drafts/:draftId",
6365
+ params: z.object({ draftId: CommunityFeedbackDraftIdSchema }).strict(),
6366
+ request: CommunityFeedbackDraftUpdateSchema,
6367
+ response: CommunityFeedbackDraftSchema,
6368
+ error: HostApiErrorSchema,
6369
+ invalidatesSnapshot: true
6370
+ }),
6371
+ sendCommunityFeedbackDraft: defineContract({
6372
+ timeoutMs: 6e4,
6373
+ method: "POST",
6374
+ path: "/api/community/feedback/drafts/:draftId/send",
6375
+ params: z.object({ draftId: CommunityFeedbackDraftIdSchema }).strict(),
6376
+ request: z.object({ consent: z.boolean().default(false) }).strict(),
6377
+ response: CommunityFeedbackDraftSchema,
6378
+ error: HostApiErrorSchema,
6379
+ invalidatesSnapshot: true
6380
+ }),
6381
+ discardCommunityFeedbackDraft: defineContract({
6382
+ method: "DELETE",
6383
+ path: "/api/community/feedback/drafts/:draftId",
6384
+ params: z.object({ draftId: CommunityFeedbackDraftIdSchema }).strict(),
6385
+ request: NoRequestBodySchema,
6386
+ response: CommunityFeedbackDraftSchema,
6387
+ error: HostApiErrorSchema,
6388
+ invalidatesSnapshot: true
6389
+ }),
6390
+ previewCommunityFeedbackPayload: defineContract({
6391
+ method: "GET",
6392
+ path: "/api/community/feedback/drafts/:draftId/preview",
6393
+ params: z.object({ draftId: CommunityFeedbackDraftIdSchema }).strict(),
6394
+ request: NoRequestBodySchema,
6395
+ response: CommunityFeedbackPayloadSchema,
6396
+ error: HostApiErrorSchema
6397
+ }),
6398
+ getLastSentCommunityFeedbackPayload: defineContract({
6399
+ method: "GET",
6400
+ path: "/api/community/feedback/last-sent",
6401
+ params: EmptyParamsSchema,
6402
+ request: NoRequestBodySchema,
6403
+ response: CommunityFeedbackLastPayloadSchema,
6404
+ error: HostApiErrorSchema
6405
+ }),
6406
+ replyCommunityFeedback: defineContract({
6407
+ method: "POST",
6408
+ path: "/api/community/feedback/items/:ref/messages",
6409
+ params: z.object({ ref: CommunityFeedbackRefSchema }).strict(),
6410
+ request: z.object({ body: z.string().trim().min(1).max(4e3) }).strict(),
6411
+ response: CommunityFeedbackSchema,
6412
+ error: HostApiErrorSchema,
6413
+ invalidatesSnapshot: true
6414
+ }),
6415
+ withdrawCommunityFeedback: defineContract({
6416
+ method: "POST",
6417
+ path: "/api/community/feedback/items/:ref/withdraw",
6418
+ params: z.object({ ref: CommunityFeedbackRefSchema }).strict(),
6419
+ request: CommunityFeedbackWithdrawSchema,
6420
+ response: CommunityFeedbackSchema,
6421
+ error: HostApiErrorSchema,
6422
+ invalidatesSnapshot: true
6423
+ }),
6424
+ reopenCommunityFeedback: defineContract({
6425
+ method: "POST",
6426
+ path: "/api/community/feedback/items/:ref/reopen",
6427
+ params: z.object({ ref: CommunityFeedbackRefSchema }).strict(),
6428
+ request: CommunityFeedbackReopenSchema,
6429
+ response: CommunityFeedbackSchema,
6430
+ error: HostApiErrorSchema,
6431
+ invalidatesSnapshot: true
6432
+ }),
6433
+ markCommunityFeedbackAffected: defineContract({
6434
+ method: "POST",
6435
+ path: "/api/community/feedback/items/:ref/affected",
6436
+ params: z.object({ ref: CommunityFeedbackRefSchema }).strict(),
6437
+ request: z.object({
6438
+ affected: z.boolean().default(true),
6439
+ consent: z.boolean().default(false)
6440
+ }).strict(),
6441
+ response: CommunityFeedbackSchema,
6442
+ error: HostApiErrorSchema,
6443
+ invalidatesSnapshot: true
6444
+ }),
6445
+ confirmCommunityFeedbackFixed: defineContract({
6446
+ method: "POST",
6447
+ path: "/api/community/feedback/items/:ref/confirm-fixed",
6448
+ params: z.object({ ref: CommunityFeedbackRefSchema }).strict(),
6449
+ request: z.object({}).strict(),
6450
+ response: CommunityFeedbackSchema,
6451
+ error: HostApiErrorSchema,
6452
+ invalidatesSnapshot: true
6453
+ }),
4687
6454
  startCommunityLogin: defineContract({
4688
6455
  method: "POST",
4689
6456
  path: "/api/community/login",
@@ -4772,13 +6539,13 @@ const HostApiContracts = {
4772
6539
  }).strict(),
4773
6540
  error: HostApiErrorSchema
4774
6541
  }),
4775
- listCommunityInstalled: defineContract({
4776
- timeoutMs: 3e4,
6542
+ listCommunitySync: defineContract({
6543
+ timeoutMs: 6e4,
4777
6544
  method: "GET",
4778
- path: "/api/community/installed",
6545
+ path: "/api/community/sync",
4779
6546
  params: z.object({ refresh: z.enum(["1"]).optional() }).strict(),
4780
6547
  request: NoRequestBodySchema,
4781
- response: CommunityInstalledSchema,
6548
+ response: CommunitySyncSchema,
4782
6549
  error: HostApiErrorSchema
4783
6550
  }),
4784
6551
  listCommunityMine: defineContract({
@@ -4840,6 +6607,7 @@ const HostApiContracts = {
4840
6607
  }).strict(),
4841
6608
  response: z.object({
4842
6609
  releaseId: CommunityReleaseIdSchema,
6610
+ releaseNumber: z.number().int().positive(),
4843
6611
  reviewStatus: CommunityReviewStatusSchema,
4844
6612
  pageUrl: z.string().url(),
4845
6613
  reportUrl: z.string().url(),
@@ -5183,7 +6951,19 @@ const HostApiContracts = {
5183
6951
  request: z.object({
5184
6952
  episodeId: EpisodeIdSchema,
5185
6953
  requestId: DynamicIdSchema,
5186
- pluginRunId: DynamicIdSchema.optional()
6954
+ pluginRunId: DynamicIdSchema.optional(),
6955
+ /**
6956
+ * Why the run did not go ahead: the user declined it, or the page could not start one of its halves. A failed
6957
+ * half is settled as a failed attempt (its Host is retracted and the agent hears about it), not as a decline.
6958
+ */
6959
+ reason: z.enum([
6960
+ "rejected",
6961
+ "host-half-failed",
6962
+ "client-half-failed"
6963
+ ]).optional(),
6964
+ startedHere: z.boolean().optional(),
6965
+ message: z.string().max(4e3).optional(),
6966
+ stack: z.string().max(16e3).optional()
5187
6967
  }).strict(),
5188
6968
  response: z.object({ accepted: z.boolean() }).strict(),
5189
6969
  error: HostApiErrorSchema
@@ -5318,23 +7098,15 @@ const HostApiContracts = {
5318
7098
  method: "POST",
5319
7099
  path: "/api/extensions/save-from-dynamic",
5320
7100
  params: EmptyParamsSchema,
5321
- request: z.union([z.object({
7101
+ request: z.object({
5322
7102
  taskId: AuthoringTaskIdSchema,
7103
+ /** The candidate the user saw; saving refuses when a newer one appeared since. */
5323
7104
  attemptId: AuthoringAttemptIdSchema,
5324
7105
  displayName: z.string().trim().min(1).max(80),
5325
7106
  slug: z.string().trim().regex(/^[a-z0-9][a-z0-9-]{1,62}[a-z0-9]$/u),
5326
7107
  description: z.string().max(500).default(""),
5327
7108
  targetExtensionId: ExtensionIdSchema.optional()
5328
- }).strict(), z.object({
5329
- agentId: AgentIdSchema,
5330
- episodeId: EpisodeIdSchema,
5331
- pluginId: DynamicIdSchema,
5332
- packageId: DynamicIdSchema,
5333
- displayName: z.string().trim().min(1).max(80),
5334
- slug: z.string().trim().regex(/^[a-z0-9][a-z0-9-]{1,62}[a-z0-9]$/u),
5335
- description: z.string().max(500).default(""),
5336
- targetExtensionId: ExtensionIdSchema.optional()
5337
- }).strict()]),
7109
+ }).strict(),
5338
7110
  response: z.object({
5339
7111
  extensionId: ExtensionIdSchema,
5340
7112
  revisionId: ExtensionRevisionIdSchema,
@@ -5474,7 +7246,9 @@ const HostApiContracts = {
5474
7246
  /** Approval of the host layer (browser permissions and `permissions.host`). */
5475
7247
  permissionApproval: PermissionApprovalSchema.optional(),
5476
7248
  /** Approval of expanded agent-layer capabilities for the agents that move to this Revision. */
5477
- agentPermissionApproval: PermissionApprovalSchema.optional()
7249
+ agentPermissionApproval: PermissionApprovalSchema.optional(),
7250
+ /** Data copy to put back first, when the target Revision only reads an older data version. */
7251
+ restoreDataSnapshotId: z.string().min(1).max(80).optional()
5478
7252
  }).strict(),
5479
7253
  response: z.object({ installation: z.object({
5480
7254
  extensionId: ExtensionIdSchema,
@@ -5592,6 +7366,19 @@ upTo: z.object({
5592
7366
  }).strict(),
5593
7367
  error: HostApiErrorSchema
5594
7368
  }),
7369
+ setChannelPaused: defineContract({
7370
+ method: "POST",
7371
+ path: "/api/channels/:channelId/pause",
7372
+ params: channelParam,
7373
+ request: z.object({ paused: z.boolean() }).strict(),
7374
+ response: z.object({
7375
+ paused: z.boolean(),
7376
+ changed: z.boolean(),
7377
+ stopped: z.boolean()
7378
+ }).strict(),
7379
+ error: HostApiErrorSchema,
7380
+ invalidatesSnapshot: true
7381
+ }),
5595
7382
  resolveOutbound: defineContract({
5596
7383
  method: "POST",
5597
7384
  path: "/api/outbound/:outboundId/resolve",
@@ -5674,6 +7461,202 @@ upTo: z.object({
5674
7461
  request: NoRequestBodySchema,
5675
7462
  response: z.object({ deleted: z.literal(true) }).strict(),
5676
7463
  error: HostApiErrorSchema
7464
+ }),
7465
+ getExtensionLineage: defineContract({
7466
+ method: "GET",
7467
+ path: "/api/extensions/:extensionId/lineage",
7468
+ params: extensionParam,
7469
+ request: NoRequestBodySchema,
7470
+ response: ExtensionLineageSchema,
7471
+ error: HostApiErrorSchema
7472
+ }),
7473
+ branchExtension: defineContract({
7474
+ invalidatesSnapshot: true,
7475
+ timeoutMs: 3e5,
7476
+ method: "POST",
7477
+ path: "/api/extensions/:extensionId/branch",
7478
+ params: extensionParam,
7479
+ request: z.object({
7480
+ revisionId: ExtensionRevisionIdSchema,
7481
+ name: z.string().trim().min(1).max(80),
7482
+ slug: z.string().trim().regex(/^[a-z0-9][a-z0-9-]{1,62}[a-z0-9]$/u).optional(),
7483
+ copyData: z.boolean()
7484
+ }).strict(),
7485
+ response: z.object({
7486
+ extensionId: ExtensionIdSchema,
7487
+ revisionId: ExtensionRevisionIdSchema
7488
+ }).strict(),
7489
+ error: HostApiErrorSchema
7490
+ }),
7491
+ rollbackExtension: defineContract({
7492
+ invalidatesSnapshot: true,
7493
+ timeoutMs: 3e5,
7494
+ method: "POST",
7495
+ path: "/api/extensions/:extensionId/revert",
7496
+ params: extensionParam,
7497
+ request: NoRequestBodySchema,
7498
+ response: z.object({ message: z.string() }).strict(),
7499
+ error: HostApiErrorSchema
7500
+ }),
7501
+ getExtensionData: defineContract({
7502
+ method: "GET",
7503
+ path: "/api/extensions/:extensionId/data",
7504
+ params: extensionParam,
7505
+ request: NoRequestBodySchema,
7506
+ response: ExtensionDataStateSchema,
7507
+ error: HostApiErrorSchema
7508
+ }),
7509
+ previewExtensionDataMigration: defineContract({
7510
+ timeoutMs: 6e4,
7511
+ method: "POST",
7512
+ path: "/api/extensions/:extensionId/data/preview",
7513
+ params: extensionParam,
7514
+ request: ExtensionDataMigrationInputSchema,
7515
+ response: ExtensionDataPreviewSchema,
7516
+ error: HostApiErrorSchema
7517
+ }),
7518
+ migrateExtensionData: defineContract({
7519
+ invalidatesSnapshot: true,
7520
+ timeoutMs: 3e5,
7521
+ method: "POST",
7522
+ path: "/api/extensions/:extensionId/data/migrate",
7523
+ params: extensionParam,
7524
+ request: ExtensionDataMigrationInputSchema,
7525
+ response: z.object({
7526
+ snapshotId: z.string(),
7527
+ preview: ExtensionDataPreviewSchema
7528
+ }).strict(),
7529
+ error: HostApiErrorSchema
7530
+ }),
7531
+ exportExtensionData: defineContract({
7532
+ method: "GET",
7533
+ timeoutMs: 3e5,
7534
+ path: "/api/extensions/:extensionId/data/export",
7535
+ params: extensionParam,
7536
+ request: NoRequestBodySchema,
7537
+ responseFormat: "bytes",
7538
+ response: z.instanceof(Uint8Array),
7539
+ error: HostApiErrorSchema
7540
+ }),
7541
+ /** The same package with the host and agent configuration; secrets are left out. */
7542
+ exportExtensionDataWithConfig: defineContract({
7543
+ method: "GET",
7544
+ timeoutMs: 3e5,
7545
+ path: "/api/extensions/:extensionId/data/export-config",
7546
+ params: extensionParam,
7547
+ request: NoRequestBodySchema,
7548
+ responseFormat: "bytes",
7549
+ response: z.instanceof(Uint8Array),
7550
+ error: HostApiErrorSchema
7551
+ }),
7552
+ createExtensionDataSnapshot: defineContract({
7553
+ method: "POST",
7554
+ path: "/api/extensions/:extensionId/data/snapshots",
7555
+ params: extensionParam,
7556
+ request: z.object({ label: z.string().trim().min(1).max(80) }).strict(),
7557
+ response: z.object({ snapshotId: z.string() }).strict(),
7558
+ error: HostApiErrorSchema
7559
+ }),
7560
+ inspectExtensionDataPackage: defineContract({
7561
+ timeoutMs: 3e5,
7562
+ method: "POST",
7563
+ path: "/api/extensions/data/inspect",
7564
+ params: EmptyParamsSchema,
7565
+ request: BinaryUploadRequestSchema,
7566
+ encodeRequest: encodeBinaryUpload,
7567
+ response: ExtensionDataPackageInspectionSchema,
7568
+ error: HostApiErrorSchema
7569
+ }),
7570
+ listExtensionRequests: defineContract({
7571
+ method: "GET",
7572
+ path: "/api/extension-requests",
7573
+ params: EmptyParamsSchema,
7574
+ request: NoRequestBodySchema,
7575
+ response: z.object({ requests: z.array(ExtensionRequestSchema) }).strict(),
7576
+ error: HostApiErrorSchema
7577
+ }),
7578
+ approveExtensionRequest: defineContract({
7579
+ invalidatesSnapshot: true,
7580
+ timeoutMs: 3e5,
7581
+ method: "POST",
7582
+ path: "/api/extension-requests/:number/approve",
7583
+ params: z.object({ number: z.coerce.number().int().positive() }).strict(),
7584
+ request: NoRequestBodySchema,
7585
+ response: z.object({ message: z.string() }).strict(),
7586
+ error: HostApiErrorSchema
7587
+ }),
7588
+ rejectExtensionRequest: defineContract({
7589
+ method: "POST",
7590
+ path: "/api/extension-requests/:number/reject",
7591
+ params: z.object({ number: z.coerce.number().int().positive() }).strict(),
7592
+ request: z.object({ reason: z.string().trim().max(500).optional() }).strict(),
7593
+ response: z.object({ ok: z.literal(true) }).strict(),
7594
+ error: HostApiErrorSchema
7595
+ }),
7596
+ listAdministrators: defineContract({
7597
+ method: "GET",
7598
+ path: "/api/administrators",
7599
+ params: EmptyParamsSchema,
7600
+ request: NoRequestBodySchema,
7601
+ response: z.object({ administrators: z.array(AdministratorSchema) }).strict(),
7602
+ error: HostApiErrorSchema
7603
+ }),
7604
+ addAdministrator: defineContract({
7605
+ method: "POST",
7606
+ path: "/api/administrators",
7607
+ params: EmptyParamsSchema,
7608
+ request: z.object({ identityId: PlatformIdentityIdSchema }).strict(),
7609
+ response: AdministratorSchema,
7610
+ error: HostApiErrorSchema
7611
+ }),
7612
+ removeAdministrator: defineContract({
7613
+ method: "POST",
7614
+ path: "/api/administrators/remove",
7615
+ params: EmptyParamsSchema,
7616
+ request: z.object({
7617
+ connectionId: ConnectionIdSchema,
7618
+ platformUserId: z.string().min(1)
7619
+ }).strict(),
7620
+ response: z.object({ ok: z.literal(true) }).strict(),
7621
+ error: HostApiErrorSchema
7622
+ }),
7623
+ createAdministratorClaimCode: defineContract({
7624
+ method: "POST",
7625
+ path: "/api/administrators/claim-code",
7626
+ params: EmptyParamsSchema,
7627
+ request: NoRequestBodySchema,
7628
+ response: z.object({
7629
+ code: z.string(),
7630
+ expiresAt: z.number().int().nonnegative()
7631
+ }).strict(),
7632
+ error: HostApiErrorSchema
7633
+ }),
7634
+ dismissCommunityRelease: defineContract({
7635
+ method: "POST",
7636
+ path: "/api/community/sync/:extensionId/dismiss",
7637
+ params: extensionParam,
7638
+ request: z.object({ releaseId: CommunityReleaseIdSchema.nullable() }).strict(),
7639
+ response: z.object({ ok: z.literal(true) }).strict(),
7640
+ error: HostApiErrorSchema
7641
+ }),
7642
+ updateFromCommunity: defineContract({
7643
+ invalidatesSnapshot: true,
7644
+ timeoutMs: 3e5,
7645
+ method: "POST",
7646
+ path: "/api/community/sync/:extensionId/update",
7647
+ params: extensionParam,
7648
+ request: NoRequestBodySchema,
7649
+ response: z.object({ message: z.string() }).strict(),
7650
+ error: HostApiErrorSchema
7651
+ }),
7652
+ archiveAuthoringTask: defineContract({
7653
+ invalidatesSnapshot: true,
7654
+ method: "POST",
7655
+ path: "/api/authoring/tasks/:taskId/archive",
7656
+ params: z.object({ taskId: AuthoringTaskIdSchema }).strict(),
7657
+ request: NoRequestBodySchema,
7658
+ response: z.object({ ok: z.literal(true) }).strict(),
7659
+ error: HostApiErrorSchema
5677
7660
  })
5678
7661
  };
5679
7662
  const pathParameterPattern = /:([A-Za-z][A-Za-z0-9]*)/gu;
@@ -5703,6 +7686,6 @@ function buildHostApiPath(name, input) {
5703
7686
  return buildValidatedHostApiPath(HostApiContracts[name], input);
5704
7687
  }
5705
7688
  //#endregion
5706
- 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, ChannelContextPolicySchema, ChannelContextPolicyViewSchema, ChannelEventIdSchema, ChannelFactSseDataSchema, ChannelFactSseItemSchema, ChannelIdSchema, ChannelMemberIdSchema, ChannelMemberNotesViewSchema, ChannelMemoryActivitySchema, ChannelPendingContextSchema, ChannelPromptViewSchema, ChannelRuntimeCacheSampleSchema, ChannelRuntimeCacheSchema, ChannelRuntimeContextSchema, ChannelRuntimeInputSchema, ChannelRuntimeOccupancySchema, ChannelRuntimePerformanceSampleSchema, ChannelRuntimePerformanceSchema, ChannelRuntimePhaseSchema, ChannelRuntimeProjectionSchema, ChannelRuntimeSseDataSchema, ChannelRuntimeStepSchema, ChannelRuntimeToolSchema, ChannelRuntimeTurnSchema, ChannelRuntimeUsageSchema, ClientNotificationFeedResponseSchema, ClientNotificationSchema, CodeRunAvailabilitySchema, 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, DEFAULT_CHANNEL_CONTEXT_POLICY, DEFAULT_MESSAGE_PACING, 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_ASSET_LIBRARY_DEFAULT_QUOTA_BYTES, EXTENSION_ASSET_LIBRARY_MAX_QUOTA_BYTES, EXTENSION_CONTEXT_DYNAMIC_MAX_CHARS, EXTENSION_CONTEXT_STATIC_MAX_CHARS, EXTENSION_DATA_HOOK_PERMISSIONS, EXTENSION_INBOUND_HOOK_MAX_TIMEOUT_MS, EXTENSION_INDEX_MAX_FILTERS, EXTENSION_INDEX_MAX_TEXT_FIELDS, EXTENSION_JOB_MAX_RUNTIME, EXTENSION_LLM_MAX_CALLS_PER_TURN, EXTENSION_LLM_MAX_OUTPUT_TOKENS, EXTENSION_MODEL_MAX_CALLS_PER_MINUTE, EXTENSION_PROVIDES, EXTENSION_SDK_BASE_LEVEL, EXTENSION_SDK_LEVEL, EXTENSION_SDK_RELEASES, EXTENSION_STORAGE_DEFAULT_QUOTA_BYTES, EXTENSION_STORAGE_MAX_QUOTA_BYTES, EXTENSION_STORAGE_SCOPES, EpisodeHandoffIdSchema, EpisodeIdSchema, ExtensionActivationTransitionSchema, ExtensionAssetLibraryCapabilitySchema, ExtensionAssetsCapabilitySchema, ExtensionCapabilitiesSchema, ExtensionConfigDeclarationSchema, ExtensionContextContributionSchema, ExtensionDeclaredJobSchema, ExtensionIdSchema, ExtensionImportInspectionSchema, ExtensionInboundHookCapabilitySchema, ExtensionIndexCapabilitySchema, ExtensionIndexCollectionSchema, ExtensionJobsCapabilitySchema, ExtensionLayeredConfigSchema, ExtensionLlmCapabilitySchema, ExtensionMcpCapabilitySchema, ExtensionMcpServerNameSchema, ExtensionMcpServerSchema, ExtensionMcpValueSchema, ExtensionModelsCapabilitySchema, 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, MessagePacingSchema, MessagePacingSettingsSchema, 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, ProductUpdateStatusSchema, PromptDocumentV1Schema, PromptSegmentSchema, RICH_EXTENSION_MAX_BYTES, RetrievalModeSchema, RetrievalStatusSchema, 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, extensionSdkVersion, hostLayerAsCapabilities, hostPageRailOrder, hostPermissionDeclaration, insecureHttpManagementPairProofMessage, managementPairProofMessage, mcpSecretFields, messagePartAssetId, messagePartAssetIds, messagePartsSearchText, normalizePromptDocument, parseConfigValue, parseJsonValue, parseMessageParts, promptDocumentFromText, promptDocumentPlainText, requiredExtensionSdkLevel, richPartContextText, summarizeExtensionCapabilities, validateConfigValue };
7689
+ export { ACTIVITY_MAX_BUCKETS, ACTIVITY_MAX_WINDOW_MS, ACTIVITY_MIN_BUCKET_MS, ActivityQuerySchema, AdapterActivityKeySchema, AddCommandAccountRequestSchema, AdministratorSchema, AdmissionIdSchema, AgentAppearanceSchema, AgentIdSchema, AgentRevisionChangedFieldSchema, AgentRevisionHistorySchema, AgentRevisionIdSchema, AssetIdSchema, AttentionItemSchema, AttentionListSchema, AuthoringAttemptIdSchema, AuthoringTaskIdSchema, CHANNEL_COMPOSER_MAX_ATTACHMENTS, CHANNEL_COMPOSER_MAX_BYTES, CHANNEL_UNREAD_COUNT_CAP, COMMAND_DEFAULT_TIMEOUT_SECONDS, COMMAND_MAX_PROGRESS_REPLIES, COMMAND_MAX_TIMEOUT_SECONDS, COMMUNITY_EXTENSION_SORTS, COMMUNITY_FEEDBACK_STATUSES, COMMUNITY_FEEDBACK_STATUS_LABELS, 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, ChannelContextPolicySchema, ChannelContextPolicyViewSchema, ChannelEventIdSchema, ChannelFactSseDataSchema, ChannelFactSseItemSchema, ChannelIdSchema, ChannelMemberIdSchema, ChannelMemberNotesViewSchema, ChannelMemoryActivitySchema, ChannelPendingContextSchema, ChannelPromptViewSchema, ChannelRuntimeCacheSampleSchema, ChannelRuntimeCacheSchema, ChannelRuntimeContextSchema, ChannelRuntimeInputSchema, ChannelRuntimeOccupancySchema, ChannelRuntimePerformanceSampleSchema, ChannelRuntimePerformanceSchema, ChannelRuntimePhaseSchema, ChannelRuntimeProjectionSchema, ChannelRuntimeSseDataSchema, ChannelRuntimeStepSchema, ChannelRuntimeToolSchema, ChannelRuntimeTurnSchema, ChannelRuntimeUsageSchema, ClientNotificationFeedResponseSchema, ClientNotificationSchema, CodeRunAvailabilitySchema, CommandAccountSchema, CommandAccountServiceSchema, CommandAccountUsageSchema, CommandAccountsViewSchema, CommandCatalogEntrySchema, CommandDefinitionSchema, CommandExecutionIdentitySchema, CommandExecutionRecordSchema, CommandParameterSchema, CommandPermissionSchema, CommandPolicySchema, CommandReplySchema, CommandResultSchema, CommunityAccountSchema, CommunityEndpointSchema, CommunityEnvironmentSchema, CommunityExtensionDetailSchema, CommunityExtensionSortSchema, CommunityExtensionSummarySchema, CommunityFeedbackAffectedSchema, CommunityFeedbackChangesSchema, CommunityFeedbackConfirmSchema, CommunityFeedbackCreateSchema, CommunityFeedbackDiagnosticEntrySchema, CommunityFeedbackDiagnosticsSchema, CommunityFeedbackDigestSchema, CommunityFeedbackDraftIdSchema, CommunityFeedbackDraftInputSchema, CommunityFeedbackDraftSchema, CommunityFeedbackDraftStateSchema, CommunityFeedbackDraftUpdateSchema, CommunityFeedbackEventDataSchema, CommunityFeedbackEventSchema, CommunityFeedbackExcerptSchema, CommunityFeedbackExtensionDiagnosticSchema, CommunityFeedbackIdSchema, CommunityFeedbackItemSchema, CommunityFeedbackKindSchema, CommunityFeedbackLabelsSchema, CommunityFeedbackLastPayloadSchema, CommunityFeedbackLinkSchema, CommunityFeedbackListSchema, CommunityFeedbackLocalListSchema, CommunityFeedbackMessageInputSchema, CommunityFeedbackMessageSchema, CommunityFeedbackPayloadSchema, CommunityFeedbackRefSchema, CommunityFeedbackReopenSchema, CommunityFeedbackSchema, CommunityFeedbackSettingsSchema, CommunityFeedbackSettingsUpdateSchema, CommunityFeedbackSnapshotSchema, CommunityFeedbackStatusSchema, CommunityFeedbackSummarySchema, CommunityFeedbackSupplementSchema, CommunityFeedbackTargetSchema, CommunityFeedbackTransitionSchema, CommunityFeedbackVisibilitySchema, CommunityFeedbackWithdrawSchema, CommunityInstalledItemSchema, CommunityInstalledSchema, CommunityListingInputSchema, CommunityMyExtensionSchema, CommunityMyPersonaSchema, CommunityMyPersonasSchema, CommunityPermissionItemSchema, CommunityPersonaDetailSchema, CommunityPersonaIdSchema, CommunityPersonaReviewStatusSchema, CommunityPersonaRevisionIdSchema, CommunityPersonaSummarySchema, CommunityRatingSchema, CommunityReleaseIdSchema, CommunityReleaseSchema, CommunityReviewReportSchema, CommunityReviewStatusSchema, CommunitySourceSchema, CommunityStatusSchema, CommunitySyncItemSchema, CommunitySyncSchema, ConfigSchemaDocumentSchema, ConfigSchemaMetaSchema, ConfigSchemaNodeSchema, ConnectionEventIdSchema, ConnectionIdSchema, ConnectionPanelRoleSchema, ConnectionTestResultSchema, DEFAULT_CHANNEL_CONTEXT_POLICY, DEFAULT_MESSAGE_PACING, DEFAULT_SUB_CONVERSATION_RETENTION, 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_ASSET_LIBRARY_DEFAULT_QUOTA_BYTES, EXTENSION_ASSET_LIBRARY_MAX_QUOTA_BYTES, EXTENSION_CONTEXT_DYNAMIC_MAX_CHARS, EXTENSION_CONTEXT_STATIC_MAX_CHARS, EXTENSION_DATA_HOOK_PERMISSIONS, EXTENSION_GOVERNANCE_SDK_LEVEL, EXTENSION_INBOUND_HOOK_MAX_TIMEOUT_MS, EXTENSION_INDEX_MAX_FILTERS, EXTENSION_INDEX_MAX_TEXT_FIELDS, EXTENSION_JOB_MAX_RUNTIME, EXTENSION_LLM_MAX_CALLS_PER_TURN, EXTENSION_LLM_MAX_OUTPUT_TOKENS, EXTENSION_MODEL_MAX_CALLS_PER_MINUTE, EXTENSION_PROVIDES, EXTENSION_SDK_BASE_LEVEL, EXTENSION_SDK_LEVEL, EXTENSION_SDK_RELEASES, EXTENSION_STORAGE_DEFAULT_QUOTA_BYTES, EXTENSION_STORAGE_MAX_QUOTA_BYTES, EXTENSION_STORAGE_SCOPES, EpisodeHandoffIdSchema, EpisodeIdSchema, ExtensionActivationTransitionSchema, ExtensionAssetLibraryCapabilitySchema, ExtensionAssetsCapabilitySchema, ExtensionCapabilitiesSchema, ExtensionConfigDeclarationSchema, ExtensionContextContributionSchema, ExtensionDataMigrationInputSchema, ExtensionDataPackageInspectionSchema, ExtensionDataPreviewSchema, ExtensionDataSourceSchema, ExtensionDataStateSchema, ExtensionDeclaredJobSchema, ExtensionIdSchema, ExtensionImportInspectionSchema, ExtensionInboundHookCapabilitySchema, ExtensionIndexCapabilitySchema, ExtensionIndexCollectionSchema, ExtensionJobsCapabilitySchema, ExtensionLayeredConfigSchema, ExtensionLineageNodeSchema, ExtensionLineageSchema, ExtensionLlmCapabilitySchema, ExtensionMcpCapabilitySchema, ExtensionMcpServerNameSchema, ExtensionMcpServerSchema, ExtensionMcpValueSchema, ExtensionModelsCapabilitySchema, ExtensionNetworkCapabilitySchema, ExtensionNetworkDomainSchema, ExtensionPanelAnchorSchema, ExtensionPanelDeclarationSchema, ExtensionPermissionRequirementSchema, ExtensionPermissionsSchema, ExtensionPlatformCapabilitySchema, ExtensionProvideSchema, ExtensionRequestSchema, ExtensionRequiresSchema, ExtensionRevisionIdSchema, ExtensionStorageCapabilitySchema, ExtensionStorageScopeSchema, ExtensionUiContributionsSchema, GithubCliAvailabilitySchema, 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, LocalGithubLoginSchema, LogicalMessageIdSchema, MANAGEMENT_PAIR_PROOF_PREFIX, ManagementChallengeResponseSchema, ManagementDeviceEnrollmentRequestSchema, ManagementDeviceEnrollmentResponseSchema, ManagementDeviceIdSchema, ManagementDeviceViewSchema, ManagementSessionRequestSchema, ManagementSessionResponseSchema, McpServerFormSchema, MessageDeliverySummarySchema, MessagePacingSchema, MessagePacingSettingsSchema, 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, ProductUpdateStatusSchema, PromptDocumentV1Schema, PromptSegmentSchema, RICH_EXTENSION_MAX_BYTES, RetrievalModeSchema, RetrievalStatusSchema, RichExtensionSchema, RichKindSchema, RichTargetUrlSchema, RuntimeCompatibilityDiagnosticSchema, ScheduledTaskIdSchema, ScheduledTaskSchema, ServerInstanceIdSchema, SubConversationIdSchema, SubConversationRetentionSchema, SubConversationSchema, SubConversationSettingsSchema, TestBarkNotificationRequestSchema, ToolViewContributionSchema, ToolViewDensitySchema, UpdateNotificationSettingsRequestSchema, UpgradeBackupModeSchema, UpgradeBackupSettingsSchema, VerificationBrowserAvailabilitySchema, WorkTreeOrderSchema, activityDurationMs, agentPermissionDeclaration, buildHostApiContractPath, buildHostApiPath, commandNameOf, commandUsage, communityPersonaReviewLabel, communityPublisherLabel, communityReviewLabel, configDescription, configFieldKind, configFields, configSchema, configSecretKeys, extensionCapabilitiesExpand, extensionSdkVersion, formatLogMessage, hostLayerAsCapabilities, hostLogDebugLeaseSchema, hostLogDebugRequestSchema, hostLogEntrySchema, hostLogLevelSchema, hostLogPageSchema, hostLogQuerySchema, hostLogScopeSchema, hostLogSettingsSchema, hostLogSettingsUpdateSchema, hostLogSourceKindSchema, hostLogSourceSchema, hostLogStatusSchema, hostLogStreamEventSchema, hostPageRailOrder, hostPermissionDeclaration, insecureHttpManagementPairProofMessage, managementPairProofMessage, mcpSecretFields, messagePartAssetId, messagePartAssetIds, messagePartImageAssetIds, messagePartsSearchText, normalizePromptDocument, parseCommandArguments, parseConfigValue, parseJsonValue, parseMessageParts, promptDocumentFromText, promptDocumentPlainText, recognizeCommand, requiredExtensionSdkLevel, richPartContextText, summarizeExtensionCapabilities, tokenizeCommand, undeliveredCommandReplies, validateConfigValue };
5707
7690
 
5708
7691
  //# sourceMappingURL=index.mjs.map