@nekro-nxt/contracts 0.5.0 → 0.7.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
@@ -21,7 +21,13 @@ const MessageDeliverySummarySchema = z.object({
21
21
  action: z.string().max(120).optional(),
22
22
  retcode: z.number().int().safe().optional()
23
23
  }).strict()).max(20),
24
- omittedIssues: z.number().int().nonnegative().optional()
24
+ omittedIssues: z.number().int().nonnegative().optional(),
25
+ /** Extensions that changed the message before it was sent, the content they produced and what they appended. */
26
+ processing: z.object({
27
+ processedBy: z.array(z.string()),
28
+ parts: z.array(z.unknown()).optional(),
29
+ followUps: z.array(z.string()).optional()
30
+ }).strict().optional()
25
31
  }).strict();
26
32
  const brandedId = (prefix, brand) => z.string().regex(new RegExp(`^${prefix}_[0-9A-Za-z]+$`), `${brand} has an invalid format.`).brand(brand);
27
33
  const AgentIdSchema = brandedId("agt", "AgentId");
@@ -47,6 +53,8 @@ const HostUiPageInstanceIdSchema = brandedId("hup", "HostUiPageInstanceId");
47
53
  const AuthoringTaskIdSchema = brandedId("aut", "AuthoringTaskId");
48
54
  const AuthoringAttemptIdSchema = brandedId("aua", "AuthoringAttemptId");
49
55
  const SubConversationIdSchema = brandedId("cnv", "SubConversationId");
56
+ const CredentialIdSchema = brandedId("crd", "CredentialId");
57
+ const LinkedAccountIdSchema = brandedId("acc", "LinkedAccountId");
50
58
  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.");
51
59
  const PromptTextSegmentSchema = z.object({
52
60
  type: z.literal("text"),
@@ -257,8 +265,9 @@ const messagePartsSearchText = (parts) => parts.flatMap((part) => {
257
265
  * product form can render and the Host can validate without executing Schema callbacks.
258
266
  *
259
267
  * Supported nodes: object (dict), string, number, natural, percent, boolean, const, union of consts (enum) and
260
- * array of primitives. `meta.role: 'secret'` marks a write-only credential. NekroNXT reads three extra meta keys:
261
- * `hint` (help text), `advanced` (collapsed by default) and `visibleWhen` (show only when a sibling equals a value).
268
+ * array of primitives. `meta.role: 'secret'` marks a write-only credential. NekroNXT reads four extra meta keys:
269
+ * `hint` (help text), `advanced` (collapsed by default), `visibleWhen` (show only when a sibling equals a value) and
270
+ * `agentWritable: false` (only an administrator may change the field, in the console).
262
271
  */
263
272
  const CONFIG_SCHEMA_MAX_BYTES = 64 * 1024;
264
273
  const DescriptionSchema = z.union([z.string(), z.record(z.string(), z.string())]);
@@ -278,6 +287,8 @@ const ConfigSchemaMetaSchema = z.object({
278
287
  }).optional(),
279
288
  advanced: z.boolean().optional(),
280
289
  group: z.string().max(40).optional(),
290
+ /** `false` keeps the field out of the agent's reach: only an administrator changes it, in the console. */
291
+ agentWritable: z.boolean().optional(),
281
292
  visibleWhen: z.object({
282
293
  key: z.string().min(1).max(64),
283
294
  equals: JsonValueSchema
@@ -322,6 +333,11 @@ const EMPTY_CONFIG_SCHEMA = {
322
333
  type: "object",
323
334
  dict: {}
324
335
  };
336
+ const configFieldLevel = (field, networkFields) => {
337
+ if (field.adminOnly) return "admin";
338
+ if (field.kind === "secret") return "secret";
339
+ return (networkFields instanceof Set ? networkFields : new Set(networkFields)).has(field.key) ? "network" : "normal";
340
+ };
325
341
  const configDescription = (meta) => {
326
342
  const description = meta?.description;
327
343
  if (typeof description === "string") return description;
@@ -360,9 +376,12 @@ const configFields = (document) => Object.entries(document.dict).map(([key, node
360
376
  advanced: node.meta?.advanced === true,
361
377
  ...node.meta?.group === void 0 ? {} : { group: node.meta.group },
362
378
  ...options === void 0 ? {} : { options },
379
+ adminOnly: node.meta?.agentWritable === false,
363
380
  node
364
381
  };
365
382
  });
383
+ /** Fields declared `meta.agentWritable: false`. */
384
+ const adminOnlyConfigKeys = (document) => configFields(document).filter((field) => field.adminOnly).map((field) => field.key);
366
385
  const configSecretKeys = (document) => configFields(document).filter((field) => field.kind === "secret").map((field) => field.key);
367
386
  const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
368
387
  const sameJson = (left, right) => JSON.stringify(left) === JSON.stringify(right);
@@ -516,7 +535,8 @@ const fieldMeta = (title, options = {}) => ({
516
535
  ...options.default === void 0 ? {} : { default: options.default },
517
536
  ...options.required === void 0 ? {} : { required: options.required },
518
537
  ...options.advanced === void 0 ? {} : { advanced: options.advanced },
519
- ...options.group === void 0 ? {} : { group: options.group }
538
+ ...options.group === void 0 ? {} : { group: options.group },
539
+ ...options.agentWritable === void 0 ? {} : { agentWritable: options.agentWritable }
520
540
  });
521
541
  /** Builds serialized Schemastery documents without depending on the Schemastery runtime. */
522
542
  const configSchema = {
@@ -568,8 +588,17 @@ const configSchema = {
568
588
  * 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
569
589
  * 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
590
  * migration hook and administrator-only commands. Level 11 lists the pictures of an inbound message to inbound hooks.
591
+ * Level 12 adds credential placeholders (`secrets.placeholder`) that `http.fetch` fills for the credential's domains.
592
+ * Level 13 adds outbound processing (`harness.onOutbound`, `permissions.agent.outbound`).
593
+ * Level 14 adds work files (`files`), reading Asset bytes (`assets.read`), high-detail tool images (`toolImages`),
594
+ * long-running tools (`timeoutSeconds`, `execute(args, { signal, progress })`), media processing (`media`), command
595
+ * profiles (`commands`) and speech to text (`speech`).
571
596
  */
572
- const EXTENSION_SDK_LEVEL = 11;
597
+ const EXTENSION_SDK_LEVEL = 14;
598
+ /** Work files, Asset reads, high-detail tool images, tool time limits, media, commands and speech need this level. */
599
+ const EXTENSION_FILES_SDK_LEVEL = 14;
600
+ /** Outbound processing needs this level; packages that declare `permissions.agent.outbound` declare it. */
601
+ const EXTENSION_OUTBOUND_SDK_LEVEL = 13;
573
602
  /** Lineage, `dataVersion` and administrator-only commands need this level; packages that carry them declare it. */
574
603
  const EXTENSION_GOVERNANCE_SDK_LEVEL = 10;
575
604
  /**
@@ -600,6 +629,18 @@ const EXTENSION_SDK_RELEASES = [
600
629
  {
601
630
  level: 11,
602
631
  version: "0.6.0"
632
+ },
633
+ {
634
+ level: 12,
635
+ version: "0.7.0"
636
+ },
637
+ {
638
+ level: 13,
639
+ version: "0.7.0"
640
+ },
641
+ {
642
+ level: 14,
643
+ version: "0.8.0"
603
644
  }
604
645
  ];
605
646
  /** The oldest NekroNXT version that supports `level`; undefined for a level no release supports yet. */
@@ -659,6 +700,21 @@ const ExtensionInboundHookCapabilitySchema = z.object({
659
700
  mayForceTrigger: z.boolean(),
660
701
  timeoutMs: z.number().int().min(100).max(EXTENSION_INBOUND_HOOK_MAX_TIMEOUT_MS)
661
702
  }).strict();
703
+ const EXTENSION_OUTBOUND_MAX_TIMEOUT_MS = 15e3;
704
+ /**
705
+ * Outbound processing of the agent's own messages. `read` sees each message after it was delivered; `transform` may
706
+ * replace its content or append messages before it is sent; `cancel` may stop it. `onTimeout` decides what happens
707
+ * when the handler times out or throws before sending: `send` (default) sends the message as it is.
708
+ */
709
+ const ExtensionOutboundCapabilitySchema = z.object({
710
+ read: z.literal(true).optional(),
711
+ transform: z.literal(true).optional(),
712
+ cancel: z.literal(true).optional(),
713
+ timeoutMs: z.number().int().min(100).max(EXTENSION_OUTBOUND_MAX_TIMEOUT_MS),
714
+ onTimeout: z.enum(["send", "cancel"]).optional()
715
+ }).strict().refine((value) => value.read === true || value.transform === true || value.cancel === true, "outbound 至少声明 read、transform 或 cancel 中的一项。");
716
+ /** Whether the extension takes part before sending (and so in the agent's processing order). */
717
+ const outboundProcessesBeforeSend = (outbound) => outbound?.transform === true || outbound?.cancel === true;
662
718
  const EXTENSION_JOB_MAX_RUNTIME = 50;
663
719
  const ExtensionDeclaredJobSchema = z.object({
664
720
  id: z.string().trim().regex(/^[a-z0-9][a-z0-9-]{0,39}$/u, "定时任务 id 只能使用小写字母、数字和连字符。"),
@@ -687,12 +743,42 @@ const EXTENSION_ASSET_LIBRARY_MAX_QUOTA_BYTES = 32 * 1024 * 1024 * 1024;
687
743
  const ExtensionAssetLibraryCapabilitySchema = z.object({ quotaBytes: z.number().int().min(1024 * 1024).max(EXTENSION_ASSET_LIBRARY_MAX_QUOTA_BYTES).optional() }).strict();
688
744
  /**
689
745
  * `write` creates Assets in the current channel; `library` keeps Assets in the extension's own library so they can be
690
- * used in any channel later.
746
+ * used in any channel later; `read` reads the bytes of Assets the current channel can see or the library holds.
691
747
  */
692
748
  const ExtensionAssetsCapabilitySchema = z.object({
693
749
  write: z.literal(true).optional(),
694
- library: ExtensionAssetLibraryCapabilitySchema.optional()
695
- }).strict().refine((value) => value.write !== void 0 || value.library !== void 0, "assets 至少声明 write 或 library。");
750
+ library: ExtensionAssetLibraryCapabilitySchema.optional(),
751
+ read: z.literal(true).optional()
752
+ }).strict().refine((value) => value.write !== void 0 || value.library !== void 0 || value.read !== void 0, "assets 至少声明 write、library 或 read。");
753
+ const EXTENSION_FILES_DEFAULT_TEMP_QUOTA_BYTES = 1024 * 1024 * 1024;
754
+ const EXTENSION_FILES_DEFAULT_CACHE_QUOTA_BYTES = 1024 * 1024 * 1024;
755
+ const EXTENSION_FILES_MAX_QUOTA_BYTES = 16 * 1024 * 1024 * 1024;
756
+ const FilesQuotaSchema = z.number().int().min(1024 * 1024).max(EXTENSION_FILES_MAX_QUOTA_BYTES);
757
+ /**
758
+ * Work files passed between services by `fileId`. Temporary files expire a day after they are written; cache entries
759
+ * stay until the cache quota is full, then the least recently used go first.
760
+ */
761
+ const ExtensionFilesCapabilitySchema = z.object({
762
+ tempQuotaBytes: FilesQuotaSchema.optional(),
763
+ cacheQuotaBytes: FilesQuotaSchema.optional()
764
+ }).strict();
765
+ /** Tool result pictures with `detail: 'high'` reach the model at up to 2048 px on the long side. */
766
+ const ExtensionToolImagesCapabilitySchema = z.object({ highDetail: z.literal(true) }).strict();
767
+ /**
768
+ * Command profiles extensions may run (`nxt.commands`, 附加功能 F7), and the add-on that provides each program. A new
769
+ * program needs a profile on the server and a row here.
770
+ */
771
+ const ExtensionCommandProfileIdSchema = z.enum(["ffmpeg", "ffprobe"], { message: "命令档案只能是 ffmpeg、ffprobe。" });
772
+ const EXTENSION_COMMAND_PROFILES = {
773
+ ffmpeg: "media",
774
+ ffprobe: "media"
775
+ };
776
+ /** Programs run through their command profiles: confined to the call's own files, without network. */
777
+ const ExtensionCommandsCapabilitySchema = z.object({ profiles: z.array(ExtensionCommandProfileIdSchema).min(1).max(ExtensionCommandProfileIdSchema.options.length).refine((value) => new Set(value).size === value.length, "命令档案不能重复。") }).strict();
778
+ const EXTENSION_SPEECH_MAX_CALLS_PER_MINUTE = 60;
779
+ const EXTENSION_SPEECH_DEFAULT_CALLS_PER_MINUTE = 10;
780
+ /** Speech to text with the provider chosen in 设置 → 附加功能, which may be a cloud service. */
781
+ const ExtensionSpeechCapabilitySchema = z.object({ maxCallsPerMinute: z.number().int().min(1).max(60).default(10) }).strict();
696
782
  const IndexNameSchema = z.string().trim().regex(/^[a-z][a-z0-9_]{0,31}$/u, "索引、字段和过滤项名称只能使用小写字母、数字和下划线,以字母开头。");
697
783
  const EXTENSION_INDEX_MAX_TEXT_FIELDS = 4;
698
784
  const EXTENSION_INDEX_MAX_FILTERS = 4;
@@ -721,8 +807,15 @@ const ExtensionModelsCapabilitySchema = z.object({
721
807
  maxCallsPerMinute: z.number().int().min(1).max(120),
722
808
  maxOutputTokens: z.number().int().min(64).max(EXTENSION_LLM_MAX_OUTPUT_TOKENS)
723
809
  }).strict();
724
- /** A header or environment value: literal text, or the current value of a `meta.role: 'secret'` config field. */
725
- const ExtensionMcpValueSchema = z.union([z.string().max(4096), z.object({ secret: z.string().trim().min(1).max(64) }).strict()]);
810
+ /**
811
+ * A header or environment value: literal text, the current value of a `meta.role: 'secret'` config field, or a named
812
+ * credential (by id or name) that the agent may use.
813
+ */
814
+ const ExtensionMcpValueSchema = z.union([
815
+ z.string().max(4096),
816
+ z.object({ secret: z.string().trim().min(1).max(64) }).strict(),
817
+ z.object({ credential: z.string().trim().min(1).max(64) }).strict()
818
+ ]);
726
819
  /** Becomes the model-facing tool prefix `mcp__<name>__`. */
727
820
  const ExtensionMcpServerNameSchema = z.string().regex(/^[A-Za-z0-9_-]{1,32}$/u);
728
821
  const McpValueMapSchema = z.record(z.string().regex(/^[A-Za-z_][A-Za-z0-9_-]{0,127}$/u), ExtensionMcpValueSchema).refine((value) => Object.keys(value).length <= 32, "最多 32 项。").default({});
@@ -747,7 +840,9 @@ const ExtensionMcpCapabilitySchema = z.object({ servers: z.array(ExtensionMcpSer
747
840
  const McpFormValueSchema = z.object({
748
841
  name: z.string().regex(/^[A-Za-z_][A-Za-z0-9_-]{0,127}$/u, "名称只能包含字母、数字、下划线和连字符。"),
749
842
  value: z.string().max(4096),
750
- secret: z.boolean().default(false)
843
+ secret: z.boolean().default(false),
844
+ /** Takes the value from this named credential instead; `value` and `secret` are then ignored. */
845
+ credential: z.string().trim().min(1).max(64).optional()
751
846
  }).strict();
752
847
  const McpServerFormSchema = z.discriminatedUnion("transport", [z.object({
753
848
  transport: z.literal("streamable-http"),
@@ -762,7 +857,7 @@ const McpServerFormSchema = z.discriminatedUnion("transport", [z.object({
762
857
  env: z.array(McpFormValueSchema).max(32).default([])
763
858
  }).strict()]);
764
859
  /** Secret config fields an MCP declaration reads. */
765
- const mcpSecretFields = (mcp) => [...new Set((mcp?.servers ?? []).flatMap((server) => Object.values(server.transport === "stdio" ? server.env : server.headers).flatMap((value) => typeof value === "string" ? [] : [value.secret])))];
860
+ const mcpSecretFields = (mcp) => [...new Set((mcp?.servers ?? []).flatMap((server) => Object.values(server.transport === "stdio" ? server.env : server.headers).flatMap((value) => typeof value === "string" || !("secret" in value) ? [] : [value.secret])))];
766
861
  /** What a server connects to; changing it needs a new approval, unlike its credentials. */
767
862
  const mcpTarget = (server) => server.transport === "stdio" ? JSON.stringify([
768
863
  "stdio",
@@ -782,11 +877,18 @@ const ExtensionCapabilitiesSchema = z.object({
782
877
  network: ExtensionNetworkCapabilitySchema.optional(),
783
878
  storage: ExtensionStorageCapabilitySchema.optional(),
784
879
  assets: ExtensionAssetsCapabilitySchema.optional(),
880
+ files: ExtensionFilesCapabilitySchema.optional(),
881
+ toolImages: ExtensionToolImagesCapabilitySchema.optional(),
882
+ /** `nxt.media`: probe, frames, audio and convert on the media add-on. */
883
+ media: z.literal(true).optional(),
884
+ commands: ExtensionCommandsCapabilitySchema.optional(),
885
+ speech: ExtensionSpeechCapabilitySchema.optional(),
785
886
  index: ExtensionIndexCapabilitySchema.optional(),
786
887
  /** Host layer only; the agent layer uses `llm`, which runs on the agent's own model. */
787
888
  models: ExtensionModelsCapabilitySchema.optional(),
788
889
  history: z.object({ read: z.literal(true) }).strict().optional(),
789
890
  inboundHook: ExtensionInboundHookCapabilitySchema.optional(),
891
+ outbound: ExtensionOutboundCapabilitySchema.optional(),
790
892
  jobs: ExtensionJobsCapabilitySchema.optional(),
791
893
  platform: ExtensionPlatformCapabilitySchema.optional(),
792
894
  llm: ExtensionLlmCapabilitySchema.optional(),
@@ -800,8 +902,18 @@ const ExtensionCapabilitiesSchema = z.object({
800
902
  const HostLayerCapabilitiesSchema = z.object({
801
903
  network: ExtensionNetworkCapabilitySchema.optional(),
802
904
  storage: z.object({ quotaBytes: z.number().int().min(1024).max(EXTENSION_STORAGE_MAX_QUOTA_BYTES).optional() }).strict().optional(),
803
- /** The same library agent attachments use; the host instance lists and imports into it. */
804
- assets: z.object({ library: ExtensionAssetLibraryCapabilitySchema }).strict().optional(),
905
+ /**
906
+ * The same library agent attachments use; the host instance lists and imports into it. `read` reads the bytes of
907
+ * library Assets.
908
+ */
909
+ assets: z.object({
910
+ library: ExtensionAssetLibraryCapabilitySchema.optional(),
911
+ read: z.literal(true).optional()
912
+ }).strict().refine((value) => value.library !== void 0 || value.read !== void 0, "assets 至少声明 library 或 read。").optional(),
913
+ files: ExtensionFilesCapabilitySchema.optional(),
914
+ media: z.literal(true).optional(),
915
+ commands: ExtensionCommandsCapabilitySchema.optional(),
916
+ speech: ExtensionSpeechCapabilitySchema.optional(),
805
917
  /** The same collections agent attachments declare; pages search and maintain them. */
806
918
  index: ExtensionIndexCapabilitySchema.optional(),
807
919
  models: ExtensionModelsCapabilitySchema.optional()
@@ -813,7 +925,14 @@ const hostLayerAsCapabilities = (host) => host === void 0 || Object.keys(host).l
813
925
  scopes: ["shared"],
814
926
  ...host.storage.quotaBytes === void 0 ? {} : { quotaBytes: host.storage.quotaBytes }
815
927
  } },
816
- ...host.assets === void 0 ? {} : { assets: { library: host.assets.library } },
928
+ ...host.assets === void 0 ? {} : { assets: {
929
+ ...host.assets.library === void 0 ? {} : { library: host.assets.library },
930
+ ...host.assets.read === void 0 ? {} : { read: host.assets.read }
931
+ } },
932
+ ...host.files === void 0 ? {} : { files: host.files },
933
+ ...host.media === void 0 ? {} : { media: host.media },
934
+ ...host.commands === void 0 ? {} : { commands: host.commands },
935
+ ...host.speech === void 0 ? {} : { speech: host.speech },
817
936
  ...host.index === void 0 ? {} : { index: host.index },
818
937
  ...host.models === void 0 ? {} : { models: host.models }
819
938
  };
@@ -841,6 +960,12 @@ const extensionCapabilitiesExpand = (previous, next) => {
841
960
  if (next.storage?.scopes.some((scope) => !(previous?.storage?.scopes ?? []).includes(scope))) return true;
842
961
  if (next.assets?.write !== void 0 && previous?.assets?.write === void 0) return true;
843
962
  if (next.assets?.library !== void 0 && previous?.assets?.library === void 0) return true;
963
+ if (next.assets?.read !== void 0 && previous?.assets?.read === void 0) return true;
964
+ if (next.files !== void 0 && previous?.files === void 0) return true;
965
+ if (next.toolImages !== void 0 && previous?.toolImages === void 0) return true;
966
+ if (next.media !== void 0 && previous?.media === void 0) return true;
967
+ if ((next.commands?.profiles ?? []).some((profile) => !(previous?.commands?.profiles ?? []).includes(profile))) return true;
968
+ if (next.speech !== void 0 && (previous?.speech === void 0 || next.speech.maxCallsPerMinute > previous.speech.maxCallsPerMinute)) return true;
844
969
  if (next.models !== void 0 && (previous?.models === void 0 || next.models.maxCallsPerMinute > previous.models.maxCallsPerMinute || next.models.maxOutputTokens > previous.models.maxOutputTokens)) return true;
845
970
  if (next.history !== void 0 && previous?.history === void 0) return true;
846
971
  const platformKey = ({ adapter, action }) => `${adapter}:${action}`;
@@ -850,6 +975,9 @@ const extensionCapabilitiesExpand = (previous, next) => {
850
975
  const hook = next.inboundHook;
851
976
  const previousHook = previous?.inboundHook;
852
977
  if (hook !== void 0 && (previousHook === void 0 || hook.reads === "all" && previousHook.reads === "triggered" || hook.mayHide && !previousHook.mayHide || hook.mayForceTrigger && !previousHook.mayForceTrigger)) return true;
978
+ const outbound = next.outbound;
979
+ const previousOutbound = previous?.outbound;
980
+ if (outbound !== void 0 && (previousOutbound === void 0 || outbound.read === true && previousOutbound.read !== true || outbound.transform === true && previousOutbound.transform !== true || outbound.cancel === true && previousOutbound.cancel !== true || outbound.onTimeout === "cancel" && previousOutbound.onTimeout !== "cancel")) return true;
853
981
  if (next.jobs?.runtime !== void 0 && (previous?.jobs?.runtime === void 0 || next.jobs.runtime.maxActive > previous.jobs.runtime.maxActive)) return true;
854
982
  const previousMcp = new Set((previous?.mcp?.servers ?? []).map(mcpTarget));
855
983
  if ((next.mcp?.servers ?? []).some((server) => !previousMcp.has(mcpTarget(server)))) return true;
@@ -858,6 +986,20 @@ const extensionCapabilitiesExpand = (previous, next) => {
858
986
  };
859
987
  const formatLibraryQuota = (bytes) => bytes >= 1024 * 1024 * 1024 ? `${+(bytes / 1024 / 1024 / 1024).toFixed(1)} GB` : `${Math.round(bytes / 1024 / 1024)} MB`;
860
988
  /**
989
+ * Add-ons the declared capabilities need (附加功能 F13), in a stable order: `media` needs 媒体处理, `speech` needs
990
+ * 语音识别, and each command profile needs the add-on that provides its program. Pass both layers, host-layer ones
991
+ * through {@link hostLayerAsCapabilities}.
992
+ */
993
+ const requiredExtensionAddons = (...layers) => {
994
+ const needed = /* @__PURE__ */ new Set();
995
+ for (const capabilities of layers) {
996
+ if (capabilities?.media !== void 0) needed.add("media");
997
+ if (capabilities?.speech !== void 0) needed.add("speech");
998
+ for (const profile of capabilities?.commands?.profiles ?? []) needed.add(EXTENSION_COMMAND_PROFILES[profile]);
999
+ }
1000
+ return ["media", "speech"].filter((id) => needed.has(id));
1001
+ };
1002
+ /**
861
1003
  * User-facing summary of declared capabilities, in a stable order, for approval and inspection pages. `layer: 'host'`
862
1004
  * phrases host-layer capabilities (passed through {@link hostLayerAsCapabilities}) for the host instance.
863
1005
  */
@@ -907,6 +1049,45 @@ const summarizeExtensionCapabilities = (capabilities, options = {}) => {
907
1049
  label: "把频道里的图片收进扩展资源库,之后可以在其他频道使用",
908
1050
  detail: `最多 ${formatLibraryQuota(capabilities.assets.library.quotaBytes ?? 2147483648)}`
909
1051
  });
1052
+ if (capabilities.assets?.read !== void 0) items.push(options.layer === "host" ? {
1053
+ key: "assets.read",
1054
+ risk: "normal",
1055
+ label: "读取扩展资源库里的文件"
1056
+ } : {
1057
+ key: "assets.read",
1058
+ risk: "sensitive",
1059
+ label: "读取当前频道里的图片和文件"
1060
+ });
1061
+ if (capabilities.files !== void 0) items.push({
1062
+ key: "files",
1063
+ risk: "normal",
1064
+ label: "在本机存放临时文件和缓存",
1065
+ detail: `临时文件最多 ${formatLibraryQuota(capabilities.files.tempQuotaBytes ?? 1073741824)},缓存最多 ${formatLibraryQuota(capabilities.files.cacheQuotaBytes ?? 1073741824)}`
1066
+ });
1067
+ if (capabilities.toolImages !== void 0) items.push({
1068
+ key: "toolImages",
1069
+ risk: "normal",
1070
+ label: "以高细节向智能体展示图片",
1071
+ detail: "计入智能体用量"
1072
+ });
1073
+ if (capabilities.media !== void 0) items.push({
1074
+ key: "media",
1075
+ risk: "normal",
1076
+ label: "处理音频、视频和图片"
1077
+ });
1078
+ if (capabilities.commands !== void 0) items.push({
1079
+ key: "commands",
1080
+ risk: "high",
1081
+ label: "在本机运行程序",
1082
+ detail: capabilities.commands.profiles.join("、"),
1083
+ scope: "只能读写交给它的文件,不能联网"
1084
+ });
1085
+ if (capabilities.speech !== void 0) items.push({
1086
+ key: "speech",
1087
+ risk: "sensitive",
1088
+ label: "把音频转成文字",
1089
+ detail: `音频可能发给「设置 → 附加功能」里选择的语音识别服务,每分钟最多 ${capabilities.speech.maxCallsPerMinute} 次`
1090
+ });
910
1091
  if (capabilities.index !== void 0) items.push({
911
1092
  key: "index",
912
1093
  risk: "normal",
@@ -934,6 +1115,29 @@ const summarizeExtensionCapabilities = (capabilities, options = {}) => {
934
1115
  ...effects === "" ? {} : { detail: `可以${effects}` }
935
1116
  });
936
1117
  }
1118
+ const outbound = capabilities.outbound;
1119
+ if (outbound !== void 0) {
1120
+ if (outbound.transform === true) items.push({
1121
+ key: "outbound.transform",
1122
+ risk: "high",
1123
+ label: "在智能体的消息发出前修改内容或追加消息"
1124
+ });
1125
+ if (outbound.cancel === true) items.push({
1126
+ key: "outbound.cancel",
1127
+ risk: "high",
1128
+ label: "取消智能体要发出的消息"
1129
+ });
1130
+ if (outbound.read === true) items.push({
1131
+ key: "outbound.read",
1132
+ risk: "sensitive",
1133
+ label: "查看智能体发出的每条消息"
1134
+ });
1135
+ if (outbound.onTimeout === "cancel" && (outbound.transform === true || outbound.cancel === true)) items.push({
1136
+ key: "outbound.onTimeout",
1137
+ risk: "high",
1138
+ label: "这个扩展出错时,智能体的消息会发不出去"
1139
+ });
1140
+ }
937
1141
  const jobs = capabilities.jobs;
938
1142
  if (jobs?.declared !== void 0 && jobs.declared.length > 0) items.push({
939
1143
  key: "jobs.declared",
@@ -1376,12 +1580,28 @@ const EXTENSION_DATA_HOOK_PERMISSIONS = {
1376
1580
  * too old for what it uses.
1377
1581
  */
1378
1582
  const requiredExtensionSdkLevel = (permissions) => {
1583
+ const level14 = [
1584
+ permissions?.host?.files === void 0 && permissions?.agent?.files === void 0 ? void 0 : "工作文件",
1585
+ permissions?.host?.assets?.read === void 0 && permissions?.agent?.assets?.read === void 0 ? void 0 : "读取频道文件",
1586
+ permissions?.agent?.toolImages === void 0 ? void 0 : "高细节图片",
1587
+ permissions?.host?.media === void 0 && permissions?.agent?.media === void 0 ? void 0 : "媒体处理",
1588
+ permissions?.host?.commands === void 0 && permissions?.agent?.commands === void 0 ? void 0 : "运行程序",
1589
+ permissions?.host?.speech === void 0 && permissions?.agent?.speech === void 0 ? void 0 : "语音识别"
1590
+ ].filter((name) => name !== void 0);
1591
+ if (level14.length > 0) return {
1592
+ level: 14,
1593
+ capabilities: level14
1594
+ };
1379
1595
  const level8 = [
1380
- permissions?.host?.assets === void 0 ? void 0 : "扩展资源库",
1596
+ permissions?.host?.assets?.library === void 0 ? void 0 : "扩展资源库",
1381
1597
  permissions?.agent?.assets?.library === void 0 ? void 0 : "扩展资源库",
1382
1598
  permissions?.host?.index === void 0 && permissions?.agent?.index === void 0 ? void 0 : "检索索引",
1383
1599
  permissions?.host?.models === void 0 ? void 0 : "本机层模型调用"
1384
1600
  ].filter((name) => name !== void 0);
1601
+ if (permissions?.agent?.outbound !== void 0) return {
1602
+ level: 13,
1603
+ capabilities: ["出站处理"]
1604
+ };
1385
1605
  return level8.length > 0 ? {
1386
1606
  level: 8,
1387
1607
  capabilities: [...new Set(level8)]
@@ -1812,6 +2032,262 @@ const hostLogStreamEventSchema = z.discriminatedUnion("type", [
1812
2032
  })
1813
2033
  ]);
1814
2034
  //#endregion
2035
+ //#region src/credentials.ts
2036
+ /**
2037
+ * Named credentials (智能体扩展配置与凭据 C1–C5): one entry is added once and reused by extensions, MCP servers and
2038
+ * commands. The value is write-only; every view below carries metadata only. Accounts on platforms such as GitHub are
2039
+ * linked accounts (`linked-accounts.ts`), granted per agent, not credentials.
2040
+ */
2041
+ const CREDENTIAL_NAME_MAX_CHARS = 64;
2042
+ const CREDENTIAL_DESCRIPTION_MAX_CHARS = 500;
2043
+ const CREDENTIAL_VALUE_MAX_CHARS = 16384;
2044
+ /** Values shorter than this are not hidden from tool results; the form warns when one is saved. */
2045
+ const CREDENTIAL_REDACTABLE_MIN_CHARS = 8;
2046
+ /** How a credential reaches code: `request` only as a placeholder filled by `nxt.http.fetch`; `program` as the value. */
2047
+ const CredentialUsageSchema = z.enum(["request", "program"]);
2048
+ /** Agents that may use a credential: every agent, or the listed ones. */
2049
+ const CredentialAgentScopeSchema = z.union([z.object({ all: z.literal(true) }).strict(), z.object({ agentIds: z.array(AgentIdSchema).max(256) }).strict()]);
2050
+ /** Shown in redaction markers (`[凭据:名称]`), so brackets and control characters are not allowed. */
2051
+ const CredentialNameSchema = z.string().trim().min(1, "名称不能为空。").max(64, `名称最多 64 个字符。`).regex(/^[^\u0000-\u001f\u007f[\]]+$/u, "名称不能包含方括号或控制字符。");
2052
+ const CredentialDescriptionSchema = z.string().trim().max(500, `说明最多 500 个字符。`);
2053
+ const CredentialDomainsSchema = z.array(ExtensionNetworkDomainSchema).max(32);
2054
+ /**
2055
+ * Names a credential's environment variable cannot take: the shell, the tools' own configuration, and the variables
2056
+ * linked accounts give commands (`GH_TOKEN` and the `gh` settings).
2057
+ */
2058
+ const RESERVED_COMMAND_ENV = /* @__PURE__ */ new Set([
2059
+ "PATH",
2060
+ "HOME",
2061
+ "USER",
2062
+ "LOGNAME",
2063
+ "SHELL",
2064
+ "PWD",
2065
+ "OLDPWD",
2066
+ "TMPDIR",
2067
+ "TEMP",
2068
+ "TMP",
2069
+ "LANG",
2070
+ "TERM",
2071
+ "NODE_OPTIONS",
2072
+ "NODE_PATH",
2073
+ "GH_TOKEN",
2074
+ "GH_CONFIG_DIR",
2075
+ "GH_PROMPT_DISABLED",
2076
+ "GH_NO_UPDATE_NOTIFIER",
2077
+ "GH_NO_EXTENSION_UPDATE_NOTIFIER",
2078
+ "GIT_TERMINAL_PROMPT",
2079
+ "GIT_CONFIG_COUNT"
2080
+ ]);
2081
+ const RESERVED_COMMAND_ENV_PREFIXES = [
2082
+ "LC_",
2083
+ "LD_",
2084
+ "DYLD_",
2085
+ "GIT_CONFIG_",
2086
+ "NEKRO_",
2087
+ "DSH_"
2088
+ ];
2089
+ /** The environment variable a program credential reaches commands under. */
2090
+ const CredentialEnvNameSchema = z.string().trim().max(64).regex(/^[A-Z_][A-Z0-9_]*$/u, "环境变量名只能使用大写字母、数字和下划线,且不能以数字开头。").refine((name) => !RESERVED_COMMAND_ENV.has(name) && !RESERVED_COMMAND_ENV_PREFIXES.some((prefix) => name.startsWith(prefix)), "这个环境变量名由系统使用,请换一个。");
2091
+ const CredentialValueSchema = z.string().min(1).max(CREDENTIAL_VALUE_MAX_CHARS);
2092
+ /** What uses one credential right now: extension secret fields bound to it and agents whose commands receive it. */
2093
+ const CredentialUsersSchema = z.object({
2094
+ extensions: z.array(z.object({
2095
+ extensionId: ExtensionIdSchema,
2096
+ name: z.string(),
2097
+ /** Agents whose own configuration binds it; empty when only the host configuration does. */
2098
+ agentIds: z.array(AgentIdSchema),
2099
+ host: z.boolean()
2100
+ }).strict()),
2101
+ /** Agents with commands enabled whose commands receive it. */
2102
+ commandAgents: z.array(AgentIdSchema)
2103
+ }).strict();
2104
+ const CredentialViewSchema = z.object({
2105
+ id: CredentialIdSchema,
2106
+ name: CredentialNameSchema,
2107
+ description: z.string(),
2108
+ usage: CredentialUsageSchema,
2109
+ domains: z.array(z.string()),
2110
+ agentScope: CredentialAgentScopeSchema,
2111
+ autoUse: z.boolean(),
2112
+ /** Program credentials: the environment variable agents' commands receive it under, or `null` when they do not. */
2113
+ envName: z.string().nullable(),
2114
+ /** Agents an administrator let use it while automatic use is off. */
2115
+ approvedAgentIds: z.array(AgentIdSchema),
2116
+ /** False when the stored value is too short to hide from tool results, or cannot be read. */
2117
+ redactable: z.boolean(),
2118
+ /** False when the stored value cannot be read any more; the entry stays so it can be replaced. */
2119
+ available: z.boolean(),
2120
+ usedBy: CredentialUsersSchema,
2121
+ createdAt: z.number().int().nonnegative(),
2122
+ updatedAt: z.number().int().nonnegative(),
2123
+ lastUsedAt: z.number().int().nonnegative().nullable()
2124
+ }).strict();
2125
+ /** A model provider listed with the credentials; `open` lets agents and extensions call it through the host. */
2126
+ const ModelProviderAccessSchema = z.object({
2127
+ provider: z.string().min(1),
2128
+ name: z.string(),
2129
+ open: z.boolean()
2130
+ }).strict();
2131
+ /**
2132
+ * An agent asked for a credential that does not exist yet. The settings link pre-fills the add form; saving a
2133
+ * credential with this name wakes the agent in the channel it asked from.
2134
+ */
2135
+ const CredentialRequestViewSchema = z.object({
2136
+ id: z.string().min(1).max(64),
2137
+ name: CredentialNameSchema,
2138
+ purpose: z.string(),
2139
+ domains: z.array(z.string()),
2140
+ usage: CredentialUsageSchema,
2141
+ agentId: AgentIdSchema,
2142
+ channelId: ChannelIdSchema.nullable(),
2143
+ createdAt: z.number().int().nonnegative(),
2144
+ /** Settings route that opens the add form pre-filled, see {@link credentialRequestRoute}. */
2145
+ route: z.string()
2146
+ }).strict();
2147
+ const CredentialsViewSchema = z.object({
2148
+ credentials: z.array(CredentialViewSchema),
2149
+ modelProviders: z.array(ModelProviderAccessSchema),
2150
+ requests: z.array(CredentialRequestViewSchema)
2151
+ }).strict();
2152
+ const CreateCredentialRequestSchema = z.object({
2153
+ name: CredentialNameSchema,
2154
+ description: CredentialDescriptionSchema.default(""),
2155
+ agentScope: CredentialAgentScopeSchema.default({ all: true }),
2156
+ autoUse: z.boolean().default(true),
2157
+ usage: CredentialUsageSchema.default("request"),
2158
+ domains: CredentialDomainsSchema.default([]),
2159
+ /** Program credentials only. */
2160
+ envName: CredentialEnvNameSchema.optional(),
2161
+ value: CredentialValueSchema,
2162
+ /** The agent request this form was opened from, if any. */
2163
+ requestId: z.string().min(1).max(64).optional()
2164
+ }).strict();
2165
+ /** Metadata changes; omitted fields keep their value. */
2166
+ const UpdateCredentialRequestSchema = z.object({
2167
+ name: CredentialNameSchema.optional(),
2168
+ description: CredentialDescriptionSchema.optional(),
2169
+ usage: CredentialUsageSchema.optional(),
2170
+ domains: CredentialDomainsSchema.optional(),
2171
+ agentScope: CredentialAgentScopeSchema.optional(),
2172
+ autoUse: z.boolean().optional(),
2173
+ /** `null` stops giving it to commands; only program credentials take one. */
2174
+ envName: CredentialEnvNameSchema.nullable().optional(),
2175
+ /** Replaces the agents allowed to use it while automatic use is off, for example to withdraw an approval. */
2176
+ approvedAgentIds: z.array(AgentIdSchema).max(256).optional()
2177
+ }).strict();
2178
+ const ReplaceCredentialValueRequestSchema = z.object({ value: CredentialValueSchema }).strict();
2179
+ /** Removing a credential that is in use needs `confirm`; without it the result lists who uses it. */
2180
+ const RemoveCredentialRequestSchema = z.object({ confirm: z.boolean().default(false) }).strict();
2181
+ const RemoveCredentialResultSchema = z.discriminatedUnion("removed", [z.object({
2182
+ removed: z.literal(true),
2183
+ view: CredentialsViewSchema
2184
+ }).strict(), z.object({
2185
+ removed: z.literal(false),
2186
+ usedBy: CredentialUsersSchema
2187
+ }).strict()]);
2188
+ const CredentialConsumerKindSchema = z.enum([
2189
+ "extension",
2190
+ "command",
2191
+ "mcp",
2192
+ "model"
2193
+ ]);
2194
+ /** One recorded use. The newest 500 per credential are kept, none older than 90 days. */
2195
+ const CredentialUseSchema = z.object({
2196
+ at: z.number().int().nonnegative(),
2197
+ agentId: AgentIdSchema.nullable(),
2198
+ channelId: ChannelIdSchema.nullable(),
2199
+ requesterMemberId: z.string().nullable(),
2200
+ consumerKind: CredentialConsumerKindSchema,
2201
+ consumerId: z.string(),
2202
+ /** Extension display name or MCP server name, when it is still known. */
2203
+ consumerName: z.string().nullable(),
2204
+ targetHost: z.string().nullable()
2205
+ }).strict();
2206
+ const CredentialUsesViewSchema = z.object({ uses: z.array(CredentialUseSchema) }).strict();
2207
+ const SetModelProviderAccessRequestSchema = z.object({ open: z.boolean() }).strict();
2208
+ /**
2209
+ * The settings route that opens the add form pre-filled from an agent's request: the credential section with `add=1`
2210
+ * plus `name`, `purpose`, `domains` (comma separated), `usage` and `request` (the request id) as query parameters.
2211
+ */
2212
+ const credentialRequestRoute = (request) => {
2213
+ const query = new URLSearchParams({
2214
+ add: "1",
2215
+ name: request.name,
2216
+ request: request.id,
2217
+ usage: request.usage
2218
+ });
2219
+ if (request.purpose !== "") query.set("purpose", request.purpose);
2220
+ if (request.domains.length > 0) query.set("domains", request.domains.join(","));
2221
+ return `/settings/credentials?${query.toString()}`;
2222
+ };
2223
+ /** Secret fields of an extension configuration layer bound to a named credential, by field. */
2224
+ const BoundCredentialsSchema = z.record(z.string(), CredentialIdSchema);
2225
+ /** Binds secret fields to named credentials; `null` removes the binding and leaves the field unset. */
2226
+ const CredentialBindingsRequestSchema = z.record(z.string(), CredentialIdSchema.nullable());
2227
+ //#endregion
2228
+ //#region src/linked-accounts.ts
2229
+ /**
2230
+ * Linked accounts (设置 → 关联账号): third-party accounts that agents' commands act as. The library only keeps them;
2231
+ * an agent's commands receive an account only through its `commandAccounts` grant (命令账号授权 A1、A2). Tokens are
2232
+ * write-only; every view below carries metadata only.
2233
+ */
2234
+ /** Platforms the host can link accounts of; each grant names one account per platform. */
2235
+ const LinkedAccountPlatformIdSchema = z.enum(["github"]);
2236
+ /** How an account is added: a typed token, or the token of a login the platform's local CLI holds (read once). */
2237
+ const LinkedAccountMethodSchema = z.enum(["token", "gh-login"]);
2238
+ /** A login the local `gh` holds, offered as a quick way to link a GitHub account. */
2239
+ const LocalGithubLoginSchema = z.object({
2240
+ login: z.string().trim().min(1),
2241
+ active: z.boolean()
2242
+ }).strict();
2243
+ const tokenFields = {
2244
+ method: z.literal("token"),
2245
+ token: z.string().trim().min(1).max(512)
2246
+ };
2247
+ const ghLoginFields = {
2248
+ method: z.literal("gh-login"),
2249
+ login: z.string().trim().min(1).max(128)
2250
+ };
2251
+ /** Where a token comes from: typed, or read once from a login of the platform's local CLI. */
2252
+ const LinkedAccountTokenSourceSchema = z.discriminatedUnion("method", [z.object(tokenFields).strict(), z.object(ghLoginFields).strict()]);
2253
+ const LinkedAccountViewSchema = z.object({
2254
+ id: LinkedAccountIdSchema,
2255
+ platform: LinkedAccountPlatformIdSchema,
2256
+ /** The account name on the platform, as the platform reported it when the token was verified. */
2257
+ login: z.string(),
2258
+ /** Token scopes where the platform reports them (GitHub classic tokens); `null` otherwise. */
2259
+ scopes: z.array(z.string()).nullable(),
2260
+ source: LinkedAccountMethodSchema,
2261
+ /** False when the stored token cannot be read any more; the account stays so it can be replaced or removed. */
2262
+ available: z.boolean(),
2263
+ /** Agents whose capabilities grant this account. */
2264
+ grantedAgentIds: z.array(AgentIdSchema),
2265
+ createdAt: z.number().int().nonnegative(),
2266
+ updatedAt: z.number().int().nonnegative(),
2267
+ lastUsedAt: z.number().int().nonnegative().nullable()
2268
+ }).strict();
2269
+ /** Links an account: the platform plus how its token is given. */
2270
+ const AddLinkedAccountRequestSchema = z.discriminatedUnion("method", [z.object({
2271
+ platform: LinkedAccountPlatformIdSchema,
2272
+ ...tokenFields
2273
+ }).strict(), z.object({
2274
+ platform: LinkedAccountPlatformIdSchema,
2275
+ ...ghLoginFields
2276
+ }).strict()]);
2277
+ /** A new token for an account; it must belong to the same account on the platform. */
2278
+ const ReplaceLinkedAccountTokenRequestSchema = LinkedAccountTokenSourceSchema;
2279
+ /** Removing a granted account needs `confirm`; without it the result lists the agents it is granted to. */
2280
+ const RemoveLinkedAccountRequestSchema = z.object({ confirm: z.boolean().default(false) }).strict();
2281
+ /** One recorded use: an agent's command environment carried the account. Newest 500 per account, none over 90 days. */
2282
+ const LinkedAccountUseSchema = z.object({
2283
+ at: z.number().int().nonnegative(),
2284
+ agentId: AgentIdSchema.nullable(),
2285
+ channelId: ChannelIdSchema.nullable(),
2286
+ consumerKind: z.enum(["command"]),
2287
+ consumerId: z.string()
2288
+ }).strict();
2289
+ const LinkedAccountUsesViewSchema = z.object({ uses: z.array(LinkedAccountUseSchema) }).strict();
2290
+ //#endregion
1815
2291
  //#region src/runtime-compatibility.ts
1816
2292
  const RuntimeCompatibilityDiagnosticSchema = z.object({
1817
2293
  objectKind: z.enum([
@@ -1852,6 +2328,86 @@ const HostUpgradeSummarySchema = z.object({
1852
2328
  diagnostics: z.array(RuntimeCompatibilityDiagnosticSchema)
1853
2329
  }).strict();
1854
2330
  //#endregion
2331
+ //#region src/response-timing.ts
2332
+ /** Bounds of the numeric response timing settings; the host rejects values outside them. */
2333
+ const RESPONSE_TIMING_LIMITS = {
2334
+ waitMaxQuietSeconds: {
2335
+ min: 5,
2336
+ max: 300
2337
+ },
2338
+ waitMaxTotalSeconds: {
2339
+ min: 10,
2340
+ max: 900
2341
+ },
2342
+ debounceSeconds: {
2343
+ min: 0,
2344
+ max: 30
2345
+ },
2346
+ debounceMaxSeconds: {
2347
+ min: 1,
2348
+ max: 120
2349
+ },
2350
+ debounceMaxMessages: {
2351
+ min: 1,
2352
+ max: 20
2353
+ },
2354
+ attentionSeconds: {
2355
+ min: 5,
2356
+ max: 600
2357
+ },
2358
+ midWakesPerMinute: {
2359
+ min: 1,
2360
+ max: 30
2361
+ }
2362
+ };
2363
+ const bounded = (key) => z.number().int().min(RESPONSE_TIMING_LIMITS[key].min).max(RESPONSE_TIMING_LIMITS[key].max).optional();
2364
+ /**
2365
+ * Per-binding timing of when the agent speaks (Decision 2026-10-31 响应时机与智能响应). Every field is optional: an
2366
+ * omitted one uses {@link RESPONSE_TIMING_DEFAULTS}. Waiting applies to every policy that answers messages; the rest
2367
+ * only to `smart`.
2368
+ */
2369
+ const ResponseTimingSettingsSchema = z.object({
2370
+ /** The agent may end a turn with `waiting-for-more` and be woken when the speaker goes quiet. */
2371
+ waitEnabled: z.boolean().optional(),
2372
+ /** Longest quiet period one wait may ask for. */
2373
+ waitMaxQuietSeconds: bounded("waitMaxQuietSeconds"),
2374
+ /** Longest the agent may keep waiting for one person, counted from the first wait. */
2375
+ waitMaxTotalSeconds: bounded("waitMaxTotalSeconds"),
2376
+ /** Smart: wait for the speaker to stay quiet this long before a turn starts; 0 starts at once. */
2377
+ debounceSeconds: bounded("debounceSeconds"),
2378
+ /** Smart: start anyway once this long has passed since the first message. */
2379
+ debounceMaxSeconds: bounded("debounceMaxSeconds"),
2380
+ /** Smart: start anyway once this many messages from the speaker are collected. */
2381
+ debounceMaxMessages: bounded("debounceMaxMessages"),
2382
+ /** Smart: a message that contains the agent's name or an alias wakes it. */
2383
+ nameWake: z.boolean().optional(),
2384
+ /** Smart: after someone talks with the agent, their next messages wake it for a while. */
2385
+ attentionWake: z.boolean().optional(),
2386
+ attentionSeconds: bounded("attentionSeconds"),
2387
+ /** Smart: name and attention wakes per channel per minute; strong signals are never limited. */
2388
+ midWakesPerMinute: bounded("midWakesPerMinute")
2389
+ }).strict();
2390
+ const RESPONSE_TIMING_DEFAULTS = {
2391
+ waitEnabled: true,
2392
+ waitMaxQuietSeconds: 60,
2393
+ waitMaxTotalSeconds: 120,
2394
+ debounceSeconds: 3,
2395
+ debounceMaxSeconds: 30,
2396
+ debounceMaxMessages: 5,
2397
+ nameWake: true,
2398
+ attentionWake: true,
2399
+ attentionSeconds: 60,
2400
+ midWakesPerMinute: 3
2401
+ };
2402
+ /** Shortest quiet period a wait may ask for, whatever the channel allows. */
2403
+ const RESPONSE_WAIT_MIN_QUIET_SECONDS = 5;
2404
+ const resolveResponseTiming = (settings) => ({
2405
+ ...RESPONSE_TIMING_DEFAULTS,
2406
+ ...Object.fromEntries(Object.entries(settings ?? {}).filter(([, value]) => value !== void 0))
2407
+ });
2408
+ /** Extra names that wake the agent in smart mode; the display name always counts too. */
2409
+ const AgentAliasesSchema = z.array(z.string().trim().min(1).max(32)).max(16).transform((aliases) => [...new Set(aliases)]);
2410
+ //#endregion
1855
2411
  //#region src/management-api.ts
1856
2412
  const NonEmptyStringSchema$1 = z.string().trim().min(1);
1857
2413
  const Base64UrlSchema = z.string().regex(/^[A-Za-z0-9_-]+$/u);
@@ -1935,7 +2491,7 @@ const ClientNotificationSchema = z.object({
1935
2491
  title: z.string().trim().min(1).max(80),
1936
2492
  body: z.string().trim().min(1).max(240),
1937
2493
  occurredAt: z.number().int().nonnegative(),
1938
- route: z.string().regex(/^\/(?:(?:live|channels|agents|workshop|wiring|settings|community|apps|work|connections|users|extensions)(?:\/[^?#]*)?)?$/u).optional()
2494
+ route: z.string().regex(/^\/(?:(?:live|channels|agents|workshop|wiring|settings|community|apps|work|connections|users|extensions)(?:\/[^?#]*)?)?(?:\?[^#]*)?$/u).optional()
1939
2495
  }).strict();
1940
2496
  const MANAGEMENT_PAIR_PROOF_PREFIX = "nxt-management-pair-v1";
1941
2497
  const managementPairProofMessage = (input) => [
@@ -2182,6 +2738,14 @@ const CommunityExtensionDetailSchema = CommunityExtensionSummarySchema.extend({
2182
2738
  }).nullable()
2183
2739
  });
2184
2740
  /**
2741
+ * 本机缓存的社区目录读取附带的时间:`fetchedAt` 是这份内容从社区取回的时间;`stale` 表示社区这次没能读取,
2742
+ * 返回的是较早的一份。
2743
+ */
2744
+ const CommunityFreshnessSchema = z.object({
2745
+ fetchedAt: z.number().int().nonnegative(),
2746
+ stale: z.boolean()
2747
+ });
2748
+ /**
2185
2749
  * 发布时随包提交的条目信息(作者自己写的介绍)。首次发布用于建条目;之后提供了哪项就覆盖哪项,未提供的保持不变。
2186
2750
  */
2187
2751
  const COMMUNITY_LISTING_LIMITS = {
@@ -3007,7 +3571,7 @@ const ImageUnderstandingPolicyApiSchema = z.object({
3007
3571
  ]),
3008
3572
  restoreAfterCompaction: z.object({
3009
3573
  recentMessages: z.number().int().min(1).max(100),
3010
- maxImages: z.number().int().min(1).max(50)
3574
+ maxImages: z.number().int().min(0).max(50)
3011
3575
  }).strict()
3012
3576
  }).strict(),
3013
3577
  textModel: z.discriminatedUnion("mode", [z.object({ mode: z.literal("disabled") }).strict(), z.object({
@@ -3016,16 +3580,19 @@ const ImageUnderstandingPolicyApiSchema = z.object({
3016
3580
  maxTokens: z.number().int().min(256).max(8192)
3017
3581
  }).strict()])
3018
3582
  }).strict();
3019
- const CommandAccountServiceSchema = z.enum(["github"]);
3020
3583
  const CommandAccountUsageSchema = z.enum([
3021
3584
  "read",
3022
3585
  "issues",
3023
3586
  "pull-requests",
3024
3587
  "push"
3025
3588
  ]);
3589
+ /**
3590
+ * One linked account the agent's commands act as, at most one per platform (`service`). Grants saved before linked
3591
+ * accounts name the account without its `acc_` prefix; both forms resolve to the same account.
3592
+ */
3026
3593
  const CommandAccountGrantSchema = z.object({
3027
- service: CommandAccountServiceSchema,
3028
- accountId: NonEmptyStringSchema.max(64),
3594
+ service: LinkedAccountPlatformIdSchema,
3595
+ accountId: NonEmptyStringSchema.max(72),
3029
3596
  /** Told to the agent as guidance, not enforced; empty gives no hint. */
3030
3597
  usage: z.array(CommandAccountUsageSchema).max(4).default([])
3031
3598
  }).strict();
@@ -3043,7 +3610,9 @@ const AgentCapabilitiesSchema = z.object({
3043
3610
  /** Network for commands; absent in older clients means on. */
3044
3611
  commandNetwork: z.boolean().default(true),
3045
3612
  communityFeedbackAuto: z.boolean().default(false),
3046
- /** Accounts this agent's commands may act as; absent in older clients means none. */
3613
+ /** Voice messages reach the agent with a transcript (附加功能 F10). */
3614
+ voiceTranscription: z.boolean().default(false),
3615
+ /** Linked accounts this agent's commands act as, one per platform; absent in older clients means none. */
3047
3616
  commandAccounts: z.array(CommandAccountGrantSchema).max(8).default([]),
3048
3617
  /**
3049
3618
  * What the agent may do with extensions without the console: `manual` only develops and test-runs, `confirm` asks
@@ -3055,10 +3624,21 @@ const AgentCapabilitiesSchema = z.object({
3055
3624
  "autonomous"
3056
3625
  ]).default("manual"),
3057
3626
  /** Whose requests make the agent develop or change extensions: anyone in the channel, or administrators only. */
3058
- extensionRequesters: z.enum(["everyone", "admins"]).default("everyone")
3627
+ extensionRequesters: z.enum(["everyone", "admins"]).default("everyone"),
3628
+ /**
3629
+ * Whose requests make the agent change extension configuration. With `everyone`, members may only have it change
3630
+ * ordinary fields of its own configuration; network fields, the host layer and credentials still need an
3631
+ * administrator.
3632
+ */
3633
+ extensionConfigRequesters: z.enum(["everyone", "admins"]).default("admins")
3059
3634
  }).strict();
3060
3635
  const DynamicClientApprovalPolicySchema = z.enum(["manual", "automatic"]);
3061
- const NotificationEventKeySchema = z.enum(["dynamic-client-approval-requested", "community-feedback-update"]);
3636
+ const NotificationEventKeySchema = z.enum([
3637
+ "dynamic-client-approval-requested",
3638
+ "community-feedback-update",
3639
+ "credential-requested",
3640
+ "extension-notification"
3641
+ ]);
3062
3642
  const NotificationSettingsViewSchema = z.object({
3063
3643
  revision: z.number().int().positive().optional(),
3064
3644
  system: z.object({ enabled: z.boolean() }).strict(),
@@ -3069,7 +3649,9 @@ const NotificationSettingsViewSchema = z.object({
3069
3649
  }).strict(),
3070
3650
  events: z.object({
3071
3651
  "dynamic-client-approval-requested": z.boolean(),
3072
- "community-feedback-update": z.boolean().default(true)
3652
+ "community-feedback-update": z.boolean().default(true),
3653
+ "credential-requested": z.boolean().default(true),
3654
+ "extension-notification": z.boolean().default(true)
3073
3655
  }).strict()
3074
3656
  }).strict();
3075
3657
  const UpdateNotificationSettingsRequestSchema = z.object({
@@ -3083,7 +3665,9 @@ const UpdateNotificationSettingsRequestSchema = z.object({
3083
3665
  }).strict(),
3084
3666
  events: z.object({
3085
3667
  "dynamic-client-approval-requested": z.boolean(),
3086
- "community-feedback-update": z.boolean().optional()
3668
+ "community-feedback-update": z.boolean().optional(),
3669
+ "credential-requested": z.boolean().optional(),
3670
+ "extension-notification": z.boolean().optional()
3087
3671
  }).strict()
3088
3672
  }).strict().refine((value) => !(value.bark.deviceKey !== void 0 && value.bark.clearDeviceKey === true), {
3089
3673
  message: "不能同时更新并清除 Bark Device Key。",
@@ -3097,13 +3681,99 @@ const ClientNotificationFeedResponseSchema = z.object({
3097
3681
  cursor: z.number().int().nonnegative(),
3098
3682
  notifications: z.array(ClientNotificationSchema)
3099
3683
  }).strict();
3684
+ /** Which model writes one kind of compaction summary: that kind's default, or a model chosen for this agent. */
3685
+ const AgentCompactionModelChoiceSchema = z.discriminatedUnion("mode", [z.object({ mode: z.literal("follow") }).strict(), z.object({
3686
+ mode: z.literal("custom"),
3687
+ model: AgentModelSchema
3688
+ }).strict()]);
3689
+ /**
3690
+ * In-session compaction follows the main model by default, so the replayed conversation hits the provider's cache;
3691
+ * compaction into a new session follows the host's compaction model.
3692
+ */
3693
+ const AgentCompactionPolicySchema = z.object({
3694
+ inSession: AgentCompactionModelChoiceSchema,
3695
+ newSession: AgentCompactionModelChoiceSchema
3696
+ }).strict();
3697
+ /** The host's idle compaction threshold, summary model and wait limit. */
3698
+ const CompactionSettingsSchema = z.object({
3699
+ /** Minimum context occupancy for idle rollover; older settings inherit 50%. */
3700
+ idleThresholdPercent: z.number().int().min(1).max(100).default(50),
3701
+ newSessionModel: z.discriminatedUnion("mode", [z.object({ mode: z.literal("main") }).strict(), z.object({
3702
+ mode: z.literal("custom"),
3703
+ model: AgentModelSchema
3704
+ }).strict()]),
3705
+ /** Past this the new session starts with a fallback note instead of a summary. */
3706
+ timeoutSeconds: z.number().int().min(30).max(900)
3707
+ }).strict();
3708
+ const DEFAULT_COMPACTION_SETTINGS = {
3709
+ idleThresholdPercent: 50,
3710
+ newSessionModel: { mode: "main" },
3711
+ timeoutSeconds: 180
3712
+ };
3713
+ const FALLBACK_MODEL_LIMIT = 3;
3714
+ /**
3715
+ * Models an agent switches to, in order, when its main model has used up its quota or stays unavailable after the
3716
+ * usual retries. Empty leaves the main model alone, as before fallback models existed.
3717
+ */
3718
+ const AgentFallbackModelsSchema = z.array(AgentModelSchema).max(3).refine((models) => new Set(models.map((model) => `${model.provider}\0${model.model}`)).size === models.length, "备用模型不能重复。");
3719
+ /** Why a channel conversation left its main model. */
3720
+ const ModelFallbackReasonSchema = z.enum([
3721
+ "quota",
3722
+ "rate-limit",
3723
+ "unavailable"
3724
+ ]);
3725
+ /** How long a model that failed is passed over before conversations try it again. */
3726
+ const ModelFallbackSettingsSchema = z.object({
3727
+ /** After rate limits, server errors, timeouts or empty replies that outlasted the usual retries. */
3728
+ unavailableCooldownMinutes: z.number().int().min(1).max(240),
3729
+ /** After the quota or balance ran out. */
3730
+ quotaCooldownMinutes: z.number().int().min(5).max(1440)
3731
+ }).strict();
3732
+ const DEFAULT_MODEL_FALLBACK_SETTINGS = {
3733
+ unavailableCooldownMinutes: 10,
3734
+ quotaCooldownMinutes: 60
3735
+ };
3736
+ /** The name an agent passes to open a sub-conversation on its main model; no candidate may take it. */
3737
+ const SUB_CONVERSATION_MAIN_MODEL = "主模型";
3738
+ const SUB_CONVERSATION_MODEL_LIMITS = {
3739
+ candidates: 8,
3740
+ name: 20,
3741
+ guidance: 200
3742
+ };
3743
+ /**
3744
+ * Models an agent may open sub-conversations with, each named so the agent can pick it and described so it knows
3745
+ * when to. Without a `default`, a sub-conversation opened without naming a model follows the main model.
3746
+ */
3747
+ const AgentSubConversationModelsSchema = z.object({
3748
+ candidates: z.array(z.object({
3749
+ name: z.string().trim().min(1, "请填写子对话模型的名称。").max(SUB_CONVERSATION_MODEL_LIMITS.name).regex(/^[^\s,,、]+(?: [^\s,,、]+)*$/u, "子对话模型的名称不能含换行、逗号或顿号。").refine((name) => name !== SUB_CONVERSATION_MAIN_MODEL, `「${SUB_CONVERSATION_MAIN_MODEL}」是保留名称。`),
3750
+ model: AgentModelSchema,
3751
+ guidance: z.string().trim().max(SUB_CONVERSATION_MODEL_LIMITS.guidance)
3752
+ }).strict()).max(SUB_CONVERSATION_MODEL_LIMITS.candidates),
3753
+ default: z.string().trim().min(1).optional()
3754
+ }).strict().superRefine((policy, context) => {
3755
+ const names = policy.candidates.map((candidate) => candidate.name);
3756
+ if (new Set(names).size !== names.length) context.addIssue({
3757
+ code: "custom",
3758
+ message: "子对话模型的名称不能重复。"
3759
+ });
3760
+ if (policy.default !== void 0 && !names.includes(policy.default)) context.addIssue({
3761
+ code: "custom",
3762
+ message: "默认的子对话模型不在候选里。"
3763
+ });
3764
+ });
3765
+ const NO_SUB_CONVERSATION_MODELS = { candidates: [] };
3100
3766
  const AgentRevisionRequestContentSchema = z.object({
3101
3767
  displayName: z.string().trim().min(1).max(80),
3102
3768
  persona: z.string().max(64 * 1024).default(""),
3103
3769
  personaDocument: PromptDocumentV1Schema.optional(),
3104
3770
  model: AgentModelSchema,
3105
3771
  imagePolicy: ImageUnderstandingPolicyApiSchema.optional(),
3106
- dynamicClientApprovalPolicy: DynamicClientApprovalPolicySchema.optional()
3772
+ dynamicClientApprovalPolicy: DynamicClientApprovalPolicySchema.optional(),
3773
+ compaction: AgentCompactionPolicySchema.optional(),
3774
+ subConversationModels: AgentSubConversationModelsSchema.optional(),
3775
+ fallbackModels: AgentFallbackModelsSchema.optional(),
3776
+ aliases: AgentAliasesSchema.optional()
3107
3777
  }).strict();
3108
3778
  const validatePersonaDocumentProjection = (value, context) => {
3109
3779
  if (value.personaDocument !== void 0 && promptDocumentPlainText(value.personaDocument) !== value.persona) context.addIssue({
@@ -3124,17 +3794,20 @@ const UpdateAgentCapabilitiesRequestSchema = AgentCapabilitiesSchema.partial().e
3124
3794
  codeRun: z.boolean().optional(),
3125
3795
  commandNetwork: z.boolean().optional(),
3126
3796
  communityFeedbackAuto: z.boolean().optional(),
3797
+ voiceTranscription: z.boolean().optional(),
3127
3798
  commandAccounts: z.array(CommandAccountGrantSchema).max(8).optional(),
3128
3799
  extensionAutonomy: z.enum([
3129
3800
  "manual",
3130
3801
  "confirm",
3131
3802
  "autonomous"
3132
3803
  ]).optional(),
3133
- extensionRequesters: z.enum(["everyone", "admins"]).optional()
3804
+ extensionRequesters: z.enum(["everyone", "admins"]).optional(),
3805
+ extensionConfigRequesters: z.enum(["everyone", "admins"]).optional()
3134
3806
  }).strict().refine((value) => Object.values(value).some((entry) => entry !== void 0), "至少提供一个能力。");
3135
3807
  const TriggerPolicySchema = z.enum([
3136
3808
  "always",
3137
3809
  "mentioned-or-replied",
3810
+ "smart",
3138
3811
  "command",
3139
3812
  "observe-only"
3140
3813
  ]);
@@ -3143,6 +3816,16 @@ const WorkTreeOrderSchema = z.object({
3143
3816
  channelIdsByAgent: z.record(AgentIdSchema, z.array(ChannelIdSchema)),
3144
3817
  unboundChannelIds: z.array(ChannelIdSchema)
3145
3818
  }).strict();
3819
+ /** The group key of 「未接线」 in `collapsedGroupIds`; agent groups use the agent id. */
3820
+ const UNBOUND_CHANNEL_GROUP_ID = "unbound";
3821
+ /**
3822
+ * How the console arranges its channel list: pinned channels in their order and the groups it has collapsed. Shared
3823
+ * by every device signed in to the console; it never changes bindings.
3824
+ */
3825
+ const ChannelListViewSchema = z.object({
3826
+ pinnedChannelIds: z.array(ChannelIdSchema).max(200),
3827
+ collapsedGroupIds: z.array(z.union([AgentIdSchema, z.literal(UNBOUND_CHANNEL_GROUP_ID)])).max(500)
3828
+ }).strict();
3146
3829
  const SnapshotMessagePartSchema = z.discriminatedUnion("type", [
3147
3830
  z.object({
3148
3831
  type: z.literal("text"),
@@ -3233,14 +3916,31 @@ const HostSnapshotMessageSchema = z.object({
3233
3916
  ]),
3234
3917
  hidden: z.boolean(),
3235
3918
  annotation: z.string().optional(),
3919
+ /** What NekroNXT itself added for the agent, such as the transcript of a voice message. */
3920
+ hostAnnotations: z.array(z.object({
3921
+ label: z.string(),
3922
+ text: z.string()
3923
+ }).strict()).optional(),
3236
3924
  extensions: z.array(z.string()),
3237
3925
  problems: z.array(z.string()).optional()
3238
3926
  }).strict().optional(),
3927
+ /** Extensions that processed the agent's message before it was sent; `followUp` marks a message one appended. */
3928
+ outboundProcessing: z.object({
3929
+ extensions: z.array(z.string()),
3930
+ rewritten: z.boolean(),
3931
+ followUp: z.literal(true).optional()
3932
+ }).strict().optional(),
3239
3933
  /** A scheduled task came due: a Host fact shown as a notice, not a member message. */
3240
3934
  scheduledTask: z.object({
3241
3935
  label: z.string(),
3242
3936
  extensionName: z.string().optional(),
3243
3937
  note: z.string().optional()
3938
+ }).strict().optional(),
3939
+ /** The agent finished waiting for someone to finish speaking: a Host fact shown as a notice. */
3940
+ responseWait: z.object({
3941
+ displayName: z.string().optional(),
3942
+ cause: z.enum(["quiet", "limit"]),
3943
+ waitedSeconds: z.number().int().nonnegative()
3244
3944
  }).strict().optional()
3245
3945
  }).strict();
3246
3946
  const HostConnectionEventSchema = z.object({
@@ -3317,6 +4017,7 @@ const ChannelRuntimePhaseSchema = z.enum([
3317
4017
  "idle",
3318
4018
  "thinking",
3319
4019
  "using-tool",
4020
+ "compacting",
3320
4021
  "waiting-input",
3321
4022
  "unavailable"
3322
4023
  ]);
@@ -3328,6 +4029,11 @@ const ChannelRuntimeUsageSchema = z.object({
3328
4029
  cacheWriteTokens: z.number().int().nonnegative().optional(),
3329
4030
  reasoningTokens: z.number().int().nonnegative().optional()
3330
4031
  }).strict();
4032
+ /** The latest progress a running extension tool reported. */
4033
+ const ChannelRuntimeToolProgressSchema = z.object({
4034
+ text: z.string().min(1).max(200),
4035
+ fraction: z.number().min(0).max(1).optional()
4036
+ }).strict();
3331
4037
  const channelRuntimeToolFields = {
3332
4038
  callId: NonEmptyStringSchema,
3333
4039
  name: NonEmptyStringSchema,
@@ -3340,13 +4046,17 @@ const channelRuntimeToolFields = {
3340
4046
  inputPreview: z.string().optional(),
3341
4047
  resultPreview: z.string().optional(),
3342
4048
  wroteToChannel: z.boolean().optional(),
4049
+ /** `cancelled`: an extension stopped the message before it was sent. */
3343
4050
  deliveryState: z.enum([
3344
4051
  "sent",
3345
4052
  "partially-sent",
3346
4053
  "failed",
3347
- "unknown"
4054
+ "unknown",
4055
+ "cancelled"
3348
4056
  ]).optional(),
3349
- durationMs: z.number().int().nonnegative().optional()
4057
+ durationMs: z.number().int().nonnegative().optional(),
4058
+ /** Set while the tool runs and has reported progress. */
4059
+ progress: ChannelRuntimeToolProgressSchema.optional()
3350
4060
  };
3351
4061
  const ChannelRuntimeToolSchema = z.object({
3352
4062
  ...channelRuntimeToolFields,
@@ -3516,6 +4226,18 @@ const ChannelRuntimeProjectionSchema = z.object({
3516
4226
  episodeId: EpisodeIdSchema.optional(),
3517
4227
  phase: ChannelRuntimePhaseSchema,
3518
4228
  summary: z.string(),
4229
+ /** A compaction under way: inside the current session, or before a new session opens. */
4230
+ compaction: z.object({
4231
+ kind: z.enum(["in-session", "new-session"]),
4232
+ startedAt: z.number().int().nonnegative()
4233
+ }).strict().optional(),
4234
+ /** The conversation runs on a fallback model; it tries the main model again at a new message after `retryMainAt`. */
4235
+ modelFallback: z.object({
4236
+ model: AgentModelSchema,
4237
+ reason: ModelFallbackReasonSchema,
4238
+ since: z.number().int().nonnegative(),
4239
+ retryMainAt: z.number().int().nonnegative()
4240
+ }).strict().optional(),
3519
4241
  pendingInjectCount: z.number().int().nonnegative(),
3520
4242
  occupancy: ChannelRuntimeOccupancySchema.optional(),
3521
4243
  cache: ChannelRuntimeCacheSchema.optional(),
@@ -3605,6 +4327,19 @@ const ChannelContextPolicyViewSchema = z.object({
3605
4327
  /** False while the channel follows the defaults. */
3606
4328
  custom: z.boolean()
3607
4329
  }).strict();
4330
+ /** One desktop installer of a release; `urls` lists the sources to try in order. */
4331
+ const ProductDownloadSchema = z.object({
4332
+ platform: z.enum([
4333
+ "mac",
4334
+ "win",
4335
+ "linux"
4336
+ ]),
4337
+ arch: z.enum(["arm64", "x64"]),
4338
+ name: z.string().min(1),
4339
+ size: z.number().int().positive(),
4340
+ sha256: z.string().regex(/^[a-f0-9]{64}$/u),
4341
+ urls: z.array(z.string().url()).min(1)
4342
+ }).strict();
3608
4343
  /** Whether a newer release exists on the build's own channel; development builds are never compared. */
3609
4344
  const ProductUpdateStatusSchema = z.object({
3610
4345
  channel: z.enum([
@@ -3626,7 +4361,9 @@ const ProductUpdateStatusSchema = z.object({
3626
4361
  version: z.string(),
3627
4362
  commit: z.string().optional(),
3628
4363
  url: z.string().url(),
3629
- publishedAt: z.number().int().nonnegative().optional()
4364
+ publishedAt: z.number().int().nonnegative().optional(),
4365
+ /** Desktop installers of this release; the desktop app downloads its own and checks size and digest. */
4366
+ downloads: z.array(ProductDownloadSchema).optional()
3630
4367
  }).strict().optional(),
3631
4368
  checkedAt: z.number().int().nonnegative().optional(),
3632
4369
  error: z.string().optional(),
@@ -3667,6 +4404,8 @@ const SubConversationSchema = z.object({
3667
4404
  /** What it handed back to the channel's conversation when it ended. */
3668
4405
  summary: z.string().max(4e3).optional(),
3669
4406
  authoringTaskId: AuthoringTaskIdSchema.optional(),
4407
+ /** The model a model-driven sub-conversation talks in; absent for scripts and ones opened before it was kept. */
4408
+ model: AgentModelSchema.optional(),
3670
4409
  createdAt: z.number().int().nonnegative(),
3671
4410
  closedAt: z.number().int().nonnegative().optional()
3672
4411
  }).strict();
@@ -3682,28 +4421,9 @@ const DEFAULT_SUB_CONVERSATION_RETENTION = "7d";
3682
4421
  const SubConversationSettingsSchema = z.object({ retention: SubConversationRetentionSchema }).strict();
3683
4422
  /** `keyword`: SQLite keyword search only; `builtin`: keywords fused with the built-in semantic model. */
3684
4423
  const RetrievalModeSchema = z.enum(["keyword", "builtin"]);
3685
- /** Search used by extension indexes (表情包与扩展素材能力 §6.4). */
4424
+ /** Search used by extension indexes (表情包与扩展素材能力 §6.4); the model itself is the `retrieval` add-on. */
3686
4425
  const RetrievalStatusSchema = z.object({
3687
4426
  mode: RetrievalModeSchema,
3688
- builtin: z.object({
3689
- model: z.string(),
3690
- /** False where no inference runtime is published for this system and processor. */
3691
- supported: z.boolean(),
3692
- downloadBytes: z.number().int().nonnegative(),
3693
- install: z.discriminatedUnion("state", [
3694
- z.object({ state: z.literal("not-installed") }).strict(),
3695
- z.object({
3696
- state: z.literal("downloading"),
3697
- receivedBytes: z.number().int().nonnegative(),
3698
- totalBytes: z.number().int().nonnegative()
3699
- }).strict(),
3700
- z.object({ state: z.literal("installed") }).strict(),
3701
- z.object({
3702
- state: z.literal("failed"),
3703
- error: z.string()
3704
- }).strict()
3705
- ])
3706
- }).strict(),
3707
4427
  vectors: z.object({
3708
4428
  documents: z.number().int().nonnegative(),
3709
4429
  embedded: z.number().int().nonnegative(),
@@ -3848,7 +4568,8 @@ const AttentionItemSchema = z.object({
3848
4568
  "agent-model-unavailable",
3849
4569
  "agent-vision-unavailable",
3850
4570
  "logs-unavailable",
3851
- "community-feedback"
4571
+ "community-feedback",
4572
+ "extension-update"
3852
4573
  ]),
3853
4574
  severity: z.enum([
3854
4575
  "critical",
@@ -3863,7 +4584,8 @@ const AttentionItemSchema = z.object({
3863
4584
  "connection",
3864
4585
  "agent",
3865
4586
  "logs",
3866
- "community-feedback"
4587
+ "community-feedback",
4588
+ "extension-update"
3867
4589
  ]),
3868
4590
  id: NonEmptyStringSchema
3869
4591
  }).strict(),
@@ -3884,10 +4606,19 @@ const AttentionItemSchema = z.object({
3884
4606
  "open-connection",
3885
4607
  "open-agent",
3886
4608
  "open-logs",
3887
- "open-community-feedback"
4609
+ "open-community-feedback",
4610
+ "open-extension-updates"
3888
4611
  ]),
3889
4612
  label: z.string().min(1).max(40)
3890
4613
  }).strict(),
4614
+ /**
4615
+ * The shared cause several items come from: a connection (its outage and the deliveries it failed) or an agent
4616
+ * (its failed turns and unusable models). Dismissing by cause keeps it quiet until the cause recovers.
4617
+ */
4618
+ cause: z.object({
4619
+ key: z.string().min(1).max(200),
4620
+ label: z.string().min(1).max(120)
4621
+ }).strict().optional(),
3891
4622
  occurredAt: z.number().int().safe().nonnegative()
3892
4623
  }).strict();
3893
4624
  const AttentionListSchema = z.object({
@@ -3991,64 +4722,143 @@ const ScheduledTaskSchema = z.object({
3991
4722
  lastFiredAt: z.number().int().safe().optional(),
3992
4723
  createdAt: z.number().int().safe()
3993
4724
  }).strict();
3994
- /** The Node that runs `run_code` programs, and the download the desktop app offers when there is none. */
3995
- const CodeRunAvailabilitySchema = z.object({
3996
- available: z.boolean(),
4725
+ /** Programs and models NekroNXT installs on request (附加功能); `<data root>/runtimes`, left out of backups. */
4726
+ const AddonIdSchema = z.enum([
4727
+ "media",
4728
+ "speech",
4729
+ "retrieval",
4730
+ "node",
4731
+ "github-cli",
4732
+ "browser"
4733
+ ]);
4734
+ /** `extension`: used by extensions; `agent`: used by agents' commands; `host`: used by NekroNXT itself. */
4735
+ const AddonGroupSchema = z.enum([
4736
+ "extension",
4737
+ "agent",
4738
+ "host"
4739
+ ]);
4740
+ /**
4741
+ * `installed`: downloaded and ready; `available`: usable without installing (bundled, found on this device, cloud);
4742
+ * `needs-config`: usable once configured (cloud).
4743
+ */
4744
+ const AddonStateSchema = z.enum([
4745
+ "not-installed",
4746
+ "installing",
4747
+ "installed",
4748
+ "failed",
4749
+ "unsupported",
4750
+ "available",
4751
+ "needs-config"
4752
+ ]);
4753
+ const AddonProgressSchema = z.object({
4754
+ receivedBytes: z.number().int().nonnegative(),
4755
+ totalBytes: z.number().int().nonnegative().optional()
4756
+ }).strict();
4757
+ /** One way an add-on can be provided, such as a program found on this device or one NekroNXT downloads. */
4758
+ const AddonProviderStatusSchema = z.object({
4759
+ id: NonEmptyStringSchema,
4760
+ title: NonEmptyStringSchema,
4761
+ summary: z.string(),
4762
+ state: AddonStateSchema,
4763
+ /** `bundled`: installed with NekroNXT; `system`: found on this device; `downloaded`: fetched by NekroNXT. */
3997
4764
  source: z.enum([
3998
- "host",
4765
+ "bundled",
3999
4766
  "system",
4000
- "downloaded"
4767
+ "downloaded",
4768
+ "cloud"
4001
4769
  ]).optional(),
4770
+ /** The installed version, or the one an install fetches. */
4002
4771
  version: z.string().optional(),
4003
- download: z.object({
4004
- version: z.string(),
4005
- state: z.enum([
4006
- "idle",
4007
- "downloading",
4008
- "failed"
4009
- ]),
4010
- receivedBytes: z.number().int().nonnegative().optional(),
4011
- totalBytes: z.number().int().nonnegative().optional(),
4012
- error: z.string().optional()
4013
- }).strict().optional()
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()
4772
+ resources: z.object({
4773
+ /** Approximate for this system and processor. */
4774
+ downloadBytes: z.number().int().nonnegative().optional(),
4775
+ /** Measured from its own folder after install. */
4776
+ installedBytes: z.number().int().nonnegative().optional(),
4777
+ memoryBytes: z.number().int().nonnegative().optional(),
4778
+ /** Short differences worth comparing, such as languages or speed. */
4779
+ notes: z.array(z.string()).default([])
4780
+ }).strict(),
4781
+ /** One entry per component that carries its own license. */
4782
+ licenses: z.array(z.object({
4783
+ component: z.string().optional(),
4784
+ name: NonEmptyStringSchema,
4785
+ url: z.url()
4786
+ }).strict()).default([]),
4787
+ /** Where downloads come from, for display. */
4788
+ sources: z.array(z.string()).default([]),
4789
+ progress: AddonProgressSchema.optional(),
4790
+ error: z.string().optional(),
4791
+ /** Other add-ons it needs to work. */
4792
+ dependsOn: z.array(AddonIdSchema).default([]),
4793
+ installable: z.boolean(),
4794
+ removable: z.boolean()
4795
+ }).strict();
4796
+ /** One add-on (a capability) as 设置 → 附加功能 shows it; the registry on the server is its only source. */
4797
+ const AddonStatusSchema = z.object({
4798
+ id: AddonIdSchema,
4799
+ group: AddonGroupSchema,
4800
+ title: NonEmptyStringSchema,
4801
+ summary: z.string(),
4802
+ /** Who relies on it, as labels people recognise. */
4803
+ usedBy: z.array(z.string()),
4804
+ /** The selected provider's state, or, while none can be used, the one closest to usable. */
4805
+ state: AddonStateSchema,
4806
+ progress: AddonProgressSchema.optional(),
4807
+ /** The provider in use; absent while none can be used. */
4808
+ selected: NonEmptyStringSchema.optional(),
4809
+ /** In declared order; providers that do not exist on this device are left out. */
4810
+ providers: z.array(AddonProviderStatusSchema)
4811
+ }).strict();
4812
+ /** Languages speech recognition can be asked for; `auto` lets the provider tell. */
4813
+ const SpeechLanguageSchema = z.enum([
4814
+ "auto",
4815
+ "zh",
4816
+ "en",
4817
+ "ja",
4818
+ "ko",
4819
+ "yue"
4820
+ ]);
4821
+ /** The cloud provider of the `speech` add-on: a provider from 设置 → 模型 and the transcription model it serves. */
4822
+ const SpeechCloudSettingsSchema = z.object({
4823
+ provider: NonEmptyStringSchema,
4824
+ model: z.string().trim().min(1).max(200),
4825
+ /** Used when a caller does not name a language. */
4826
+ language: SpeechLanguageSchema.optional()
4827
+ }).strict();
4828
+ const SpeechSettingsSchema = z.object({
4829
+ cloud: SpeechCloudSettingsSchema.nullable(),
4830
+ /** Configured providers with an OpenAI-compatible address, the ones cloud transcription can use. */
4831
+ providers: z.array(z.object({
4832
+ provider: NonEmptyStringSchema,
4833
+ displayName: z.string()
4834
+ }).strict())
4038
4835
  }).strict();
4039
- const CommandAccountsViewSchema = z.object({
4040
- accounts: z.array(CommandAccountSchema),
4836
+ /** Whether a capability that needs an add-on can run now; details live in `addons`. */
4837
+ const AddonAvailabilitySchema = z.object({ available: z.boolean() }).strict();
4838
+ /** A platform's own program that linked accounts work through, such as the GitHub CLI. */
4839
+ const LinkedAccountPlatformToolSchema = z.object({
4840
+ /** The add-on it is installed as (`AddonStatus.id`). */
4841
+ id: z.enum(["github-cli"]),
4842
+ name: z.string()
4843
+ }).strict();
4844
+ /** 设置 → 关联账号: every platform the host supports, with its accounts and tools. */
4845
+ const LinkedAccountsViewSchema = z.object({
4846
+ platforms: z.array(z.object({
4847
+ id: LinkedAccountPlatformIdSchema,
4848
+ name: z.string(),
4849
+ addMethods: z.array(LinkedAccountMethodSchema),
4850
+ tool: LinkedAccountPlatformToolSchema.optional(),
4851
+ accounts: z.array(LinkedAccountViewSchema)
4852
+ }).strict()),
4041
4853
  /** Logins found in the local GitHub CLI; empty when it is missing or not logged in. */
4042
- localLogins: z.array(LocalGithubLoginSchema)
4854
+ localGithubLogins: z.array(LocalGithubLoginSchema)
4043
4855
  }).strict();
4044
- const AddCommandAccountRequestSchema = z.discriminatedUnion("source", [z.object({
4045
- source: z.literal("token"),
4046
- service: CommandAccountServiceSchema,
4047
- token: NonEmptyStringSchema.max(512)
4856
+ const RemoveLinkedAccountResultSchema = z.discriminatedUnion("removed", [z.object({
4857
+ removed: z.literal(true),
4858
+ view: LinkedAccountsViewSchema
4048
4859
  }).strict(), z.object({
4049
- source: z.literal("gh-login"),
4050
- service: CommandAccountServiceSchema,
4051
- login: NonEmptyStringSchema.max(128)
4860
+ removed: z.literal(false),
4861
+ grantedAgentIds: z.array(AgentIdSchema)
4052
4862
  }).strict()]);
4053
4863
  /** An extension action an agent asked an administrator to confirm, or one it took on its own. */
4054
4864
  const ExtensionRequestSchema = z.object({
@@ -4064,7 +4874,9 @@ const ExtensionRequestSchema = z.object({
4064
4874
  "rejected",
4065
4875
  "expired",
4066
4876
  "completed",
4067
- "failed"
4877
+ "failed",
4878
+ "superseded",
4879
+ "withdrawn"
4068
4880
  ]),
4069
4881
  autonomous: z.boolean(),
4070
4882
  resultMessage: z.string().nullable(),
@@ -4093,16 +4905,26 @@ const HostSnapshotSchema = z.object({
4093
4905
  id: NonEmptyStringSchema,
4094
4906
  name: z.string(),
4095
4907
  description: z.string().optional(),
4096
- inputModalities: z.array(z.string()).optional()
4908
+ inputModalities: z.array(z.string()).optional(),
4909
+ /** Selectable thinking levels, least to most; absent when the model offers no choice. */
4910
+ reasoning: z.object({
4911
+ efforts: z.array(z.object({
4912
+ id: NonEmptyStringSchema,
4913
+ name: z.string()
4914
+ }).strict()).min(1),
4915
+ defaultEffort: NonEmptyStringSchema.optional()
4916
+ }).strict().optional()
4097
4917
  }).strict()),
4098
4918
  capabilityAvailability: z.object({
4099
4919
  subagents: z.object({ available: z.boolean() }).strict(),
4100
- /** Optional in older hosts, which never offer `run_code`. */
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(),
4920
+ /** The `node` add-on that `run_code` needs. */
4921
+ codeRun: AddonAvailabilitySchema.optional(),
4922
+ /** The `github-cli` add-on that commands use with a GitHub account. */
4923
+ githubCli: AddonAvailabilitySchema.optional(),
4924
+ /** The `browser` add-on that checks candidates when no page is open. */
4925
+ verificationBrowser: AddonAvailabilitySchema.optional(),
4926
+ /** The `speech` add-on that voice message transcription needs. */
4927
+ speechRecognition: AddonAvailabilitySchema.optional(),
4106
4928
  /** What this host can confine for commands beyond file writes; optional in older hosts. */
4107
4929
  commandConfinement: z.object({
4108
4930
  readScope: z.boolean(),
@@ -4121,8 +4943,6 @@ const HostSnapshotSchema = z.object({
4121
4943
  }).strict(),
4122
4944
  connectionAdapters: z.array(AdapterConnectionDescriptorSchema),
4123
4945
  notificationSettings: NotificationSettingsViewSchema,
4124
- /** Optional in older hosts, which have no account library. */
4125
- commandAccounts: z.array(CommandAccountSchema).optional(),
4126
4946
  agents: z.array(z.object({
4127
4947
  id: AgentIdSchema,
4128
4948
  displayName: z.string(),
@@ -4132,6 +4952,19 @@ const HostSnapshotSchema = z.object({
4132
4952
  capabilities: AgentCapabilitiesSchema,
4133
4953
  imagePolicy: ImageUnderstandingPolicyApiSchema,
4134
4954
  dynamicClientApprovalPolicy: DynamicClientApprovalPolicySchema,
4955
+ /** Optional for older hosts, whose agents always follow both defaults. */
4956
+ compaction: AgentCompactionPolicySchema.optional(),
4957
+ /** Optional for older hosts, whose agents offer no candidates. */
4958
+ subConversationModels: AgentSubConversationModelsSchema.optional(),
4959
+ /** Optional for older hosts, whose agents have no fallback models. */
4960
+ fallbackModels: AgentFallbackModelsSchema.optional(),
4961
+ /** Optional for older hosts, whose agents have no aliases. */
4962
+ aliases: AgentAliasesSchema.optional(),
4963
+ /**
4964
+ * Enabled extensions that process the agent's messages before they are sent, in the order they run. Absent
4965
+ * when none does.
4966
+ */
4967
+ outboundOrder: z.array(ExtensionIdSchema).optional(),
4135
4968
  imageDiagnostics: z.object({
4136
4969
  route: z.object({
4137
4970
  mode: z.enum([
@@ -4200,6 +5033,8 @@ const HostSnapshotSchema = z.object({
4200
5033
  /** Absent means `observe`. */
4201
5034
  localAgentMessages: z.enum(["observe", "trigger"]).optional(),
4202
5035
  activityTriggerOverrides: ActivityTriggerOverridesSchema.default({}),
5036
+ /** Absent on older hosts; missing keys use the defaults. */
5037
+ responseTiming: ResponseTimingSettingsSchema.optional(),
4203
5038
  boundAt: z.number().int().safe().nonnegative()
4204
5039
  }).strict())
4205
5040
  }).strict()),
@@ -4208,6 +5043,10 @@ const HostSnapshotSchema = z.object({
4208
5043
  channelIdsByAgent: {},
4209
5044
  unboundChannelIds: []
4210
5045
  }),
5046
+ channelListView: ChannelListViewSchema.default({
5047
+ pinnedChannelIds: [],
5048
+ collapsedGroupIds: []
5049
+ }),
4211
5050
  messages: z.array(HostSnapshotMessageSchema),
4212
5051
  connections: z.array(z.object({
4213
5052
  id: ConnectionIdSchema,
@@ -4215,6 +5054,7 @@ const HostSnapshotSchema = z.object({
4215
5054
  alias: ConnectionAliasOutputSchema.optional(),
4216
5055
  activityTriggerDefaults: z.array(AdapterActivityKeySchema).default([]),
4217
5056
  configuredSecrets: z.array(z.string()).optional(),
5057
+ boundCredentials: BoundCredentialsSchema.optional(),
4218
5058
  status: z.object({
4219
5059
  state: z.enum([
4220
5060
  "stopped",
@@ -4378,6 +5218,7 @@ const HostSnapshotSchema = z.object({
4378
5218
  /** Secret fields are removed; `configuredSecrets` lists those the Host stores. */
4379
5219
  config: JsonValueSchema,
4380
5220
  configuredSecrets: z.array(z.string()).optional(),
5221
+ boundCredentials: BoundCredentialsSchema.optional(),
4381
5222
  activatedAt: z.number().int().safe().nonnegative(),
4382
5223
  runtime: z.object({
4383
5224
  status: z.enum([
@@ -4411,6 +5252,7 @@ const HostSnapshotSchema = z.object({
4411
5252
  /** Secret fields are removed; `configuredSecrets` lists those the Host stores. */
4412
5253
  config: JsonValueSchema.default({}),
4413
5254
  configuredSecrets: z.array(z.string()).optional(),
5255
+ boundCredentials: BoundCredentialsSchema.optional(),
4414
5256
  runtime: z.object({
4415
5257
  status: z.enum([
4416
5258
  "active",
@@ -4477,6 +5319,7 @@ const HostSnapshotSchema = z.object({
4477
5319
  authoringTasks: z.array(AuthoringTaskSummarySchema).default([]),
4478
5320
  /** Open sub-conversations, and the most recently ended ones of each channel. */
4479
5321
  subConversations: z.array(SubConversationSchema).default([]),
5322
+ addons: z.array(AddonStatusSchema).default([]),
4480
5323
  scheduledTasks: z.array(ScheduledTaskSchema).default([]),
4481
5324
  /** Extension requests waiting for an administrator. */
4482
5325
  extensionRequests: z.array(ExtensionRequestSchema).default([])
@@ -4603,6 +5446,10 @@ const DshPluginCatalogEntrySchema = z.object({
4603
5446
  "tarball",
4604
5447
  "imported"
4605
5448
  ]).optional(),
5449
+ /** Published by the DSH maintainers on npm for the DSH release this build runs. */
5450
+ official: z.boolean().optional(),
5451
+ /** Third-party installed plugins: whether an administrator allowed them to submit images to the model. */
5452
+ imageSubmission: z.boolean().optional(),
4606
5453
  installedAt: z.number().int().safe().nonnegative().optional(),
4607
5454
  clientUiDetected: z.boolean().optional(),
4608
5455
  hostUi: DshNxtHostUiSchema.optional(),
@@ -4614,6 +5461,8 @@ const DshPluginCatalogEntrySchema = z.object({
4614
5461
  suggestedScope: z.enum(["host", "agent"]),
4615
5462
  selectedScope: z.enum(["host", "agent"]).optional(),
4616
5463
  config: JsonValueSchema,
5464
+ /** Host services this official entry declared and received; known once it has loaded. */
5465
+ grantedServices: z.array(NonEmptyStringSchema).optional(),
4617
5466
  activations: z.array(z.object({
4618
5467
  targetKey: NonEmptyStringSchema,
4619
5468
  target: z.enum(["host", "agent"]),
@@ -4622,18 +5471,24 @@ const DshPluginCatalogEntrySchema = z.object({
4622
5471
  diagnostic: z.object({
4623
5472
  status: z.enum([
4624
5473
  "active",
5474
+ "pending",
4625
5475
  "load-failed",
4626
5476
  "restore-failed",
4627
5477
  "dispose-failed"
4628
5478
  ]),
4629
5479
  phase: z.enum([
4630
5480
  "import",
5481
+ "dependency",
4631
5482
  "apply",
4632
5483
  "update",
4633
5484
  "dispose",
4634
5485
  "restore"
4635
5486
  ]),
4636
5487
  message: z.string().optional(),
5488
+ /** Services a pending entry still waits for. */
5489
+ waitingFor: z.array(NonEmptyStringSchema).optional(),
5490
+ /** The waited-for services this entry can never receive, since only official plugins get them. */
5491
+ restrictedServices: z.array(NonEmptyStringSchema).optional(),
4637
5492
  observedAt: z.number().int().safe().nonnegative()
4638
5493
  }).optional()
4639
5494
  }).strict())
@@ -4780,19 +5635,23 @@ const HostSseEventSchema = z.discriminatedUnion("event", [
4780
5635
  ]);
4781
5636
  /** Request content a model accepts; `image` enables native vision for agents using the model. */
4782
5637
  const LlmModelInputModalitiesSchema = z.array(z.enum(["text", "image"])).min(1);
5638
+ /** Thinking levels a model offers, least to most; the ids are the adapter's own. */
5639
+ const LlmModelReasoningEffortsSchema = z.array(NonEmptyStringSchema).min(1);
4783
5640
  const LlmProviderModelSchema = z.object({
4784
5641
  id: NonEmptyStringSchema,
4785
5642
  name: NonEmptyStringSchema,
4786
5643
  contextWindow: z.number().int().positive().optional(),
4787
5644
  maxTokens: z.number().int().positive().optional(),
4788
- inputModalities: LlmModelInputModalitiesSchema.optional()
5645
+ inputModalities: LlmModelInputModalitiesSchema.optional(),
5646
+ reasoningEfforts: LlmModelReasoningEffortsSchema.optional()
4789
5647
  }).strict();
4790
5648
  const LlmDiscoveredModelSchema = z.object({
4791
5649
  id: NonEmptyStringSchema,
4792
5650
  name: NonEmptyStringSchema.optional(),
4793
5651
  contextWindow: z.number().int().positive().optional(),
4794
5652
  maxTokens: z.number().int().positive().optional(),
4795
- inputModalities: LlmModelInputModalitiesSchema.optional()
5653
+ inputModalities: LlmModelInputModalitiesSchema.optional(),
5654
+ reasoningEfforts: LlmModelReasoningEffortsSchema.optional()
4796
5655
  }).strict();
4797
5656
  const LlmProviderCredentialSchema = z.object({
4798
5657
  configured: z.boolean(),
@@ -4830,7 +5689,62 @@ const LlmProviderViewSchema = z.object({
4830
5689
  /** The provider's adapter can list the models its endpoint offers. */
4831
5690
  discoverable: z.boolean(),
4832
5691
  /** `null` when the current configuration was never tested; absent from hosts that do not record tests. */
4833
- lastTest: LlmProviderTestResultSchema.nullable().optional()
5692
+ lastTest: LlmProviderTestResultSchema.nullable().optional(),
5693
+ /** Present when the provider can sign in with a subscription account instead of an API key. */
5694
+ subscription: z.object({
5695
+ label: NonEmptyStringSchema,
5696
+ /** The route uses the signed-in account rather than an API key. */
5697
+ active: z.boolean(),
5698
+ accountLabel: z.string().nullable()
5699
+ }).strict().optional()
5700
+ }).strict();
5701
+ const SubscriptionStatusSchema = z.object({
5702
+ provider: NonEmptyStringSchema,
5703
+ label: NonEmptyStringSchema,
5704
+ usageUrl: z.url(),
5705
+ available: z.boolean(),
5706
+ mode: z.enum([
5707
+ "unconfigured",
5708
+ "api-key",
5709
+ "subscription"
5710
+ ]),
5711
+ activeAccountId: z.string().nullable(),
5712
+ accounts: z.array(z.object({
5713
+ id: NonEmptyStringSchema,
5714
+ label: NonEmptyStringSchema,
5715
+ email: z.string().nullable(),
5716
+ createdAt: z.number().int().nonnegative()
5717
+ }).strict()),
5718
+ login: z.object({
5719
+ id: NonEmptyStringSchema,
5720
+ status: z.enum([
5721
+ "running",
5722
+ "authorized",
5723
+ "cancelled",
5724
+ "failed"
5725
+ ]),
5726
+ notices: z.array(z.object({
5727
+ message: z.string(),
5728
+ url: z.string().optional(),
5729
+ code: z.string().optional()
5730
+ }).strict()),
5731
+ prompt: z.object({
5732
+ id: NonEmptyStringSchema,
5733
+ kind: z.enum([
5734
+ "text",
5735
+ "secret",
5736
+ "select"
5737
+ ]),
5738
+ message: z.string(),
5739
+ placeholder: z.string().optional(),
5740
+ options: z.array(z.object({
5741
+ id: z.string(),
5742
+ label: z.string(),
5743
+ description: z.string().optional()
5744
+ }).strict()).optional()
5745
+ }).strict().nullable(),
5746
+ error: z.string().nullable()
5747
+ }).strict().nullable()
4834
5748
  }).strict();
4835
5749
  const LlmProviderSettingsSchema = z.object({
4836
5750
  writable: z.boolean(),
@@ -4883,6 +5797,8 @@ const defineContract = (contract) => ({
4883
5797
  parseError: (input) => contract.error.parse(input)
4884
5798
  });
4885
5799
  const agentParam = z.object({ agentId: AgentIdSchema }).strict();
5800
+ const credentialParam = z.object({ credentialId: CredentialIdSchema }).strict();
5801
+ const linkedAccountParam = z.object({ accountId: LinkedAccountIdSchema }).strict();
4886
5802
  const agentRevisionParam = z.object({
4887
5803
  agentId: AgentIdSchema,
4888
5804
  revisionId: AgentRevisionIdSchema
@@ -4893,7 +5809,11 @@ const AgentRevisionChangedFieldSchema = z.enum([
4893
5809
  "model",
4894
5810
  "capabilities",
4895
5811
  "imagePolicy",
4896
- "approvalPolicy"
5812
+ "approvalPolicy",
5813
+ "compaction",
5814
+ "subConversationModels",
5815
+ "fallbackModels",
5816
+ "aliases"
4897
5817
  ]);
4898
5818
  const AgentRevisionHistorySchema = z.object({
4899
5819
  agentId: AgentIdSchema,
@@ -4919,6 +5839,20 @@ const agentExtensionParam = z.object({
4919
5839
  extensionId: ExtensionIdSchema
4920
5840
  }).strict();
4921
5841
  const PermissionApprovalSchema = z.object({ permissionDigest: z.string().regex(/^[a-f0-9]{64}$/u) }).strict();
5842
+ /**
5843
+ * What keeps a version from being cleaned up: in use, enabled for an agent, released to a community, kept by hand,
5844
+ * the start of a branch, the base of an open revision, needed by 回到上一个版本, or named by a pending request.
5845
+ */
5846
+ const ExtensionRevisionProtectionSchema = z.enum([
5847
+ "installed",
5848
+ "active",
5849
+ "released",
5850
+ "kept",
5851
+ "branch",
5852
+ "revising",
5853
+ "undo",
5854
+ "request"
5855
+ ]);
4922
5856
  /** One version of one line in the lineage view of an extension family. */
4923
5857
  const ExtensionLineageNodeSchema = z.object({
4924
5858
  revisionId: ExtensionRevisionIdSchema,
@@ -4933,7 +5867,11 @@ const ExtensionLineageNodeSchema = z.object({
4933
5867
  ]),
4934
5868
  createdAt: z.number().int().nonnegative(),
4935
5869
  current: z.boolean(),
4936
- releaseNumbers: z.array(z.number().int().positive())
5870
+ releaseNumbers: z.array(z.number().int().positive()),
5871
+ /** Marked by an administrator to keep. */
5872
+ kept: z.boolean(),
5873
+ /** Why the version cannot be cleaned up; absent when it can. */
5874
+ protectedBy: ExtensionRevisionProtectionSchema.optional()
4937
5875
  }).strict();
4938
5876
  /** Every line of the family an extension belongs to: the original and every branch of a branch on this machine. */
4939
5877
  const ExtensionLineageSchema = z.object({ lines: z.array(z.object({
@@ -5039,6 +5977,38 @@ const AdministratorSchema = z.object({
5039
5977
  addedAt: z.number().int().nonnegative()
5040
5978
  }).strict();
5041
5979
  const extensionParam = z.object({ extensionId: ExtensionIdSchema }).strict();
5980
+ const ExtensionConfigVersionSourceSchema = z.enum([
5981
+ "console",
5982
+ "agent",
5983
+ "chat-admin",
5984
+ "revert",
5985
+ "auto-revert"
5986
+ ]);
5987
+ /**
5988
+ * One saved state of an extension's host configuration or of one agent's configuration. Versions are numbered per
5989
+ * extension, layer and agent; reverting writes an old one again as a new version. Secret fields only show whether
5990
+ * they were set and which named credential they were bound to.
5991
+ */
5992
+ const ExtensionConfigVersionSchema = z.object({
5993
+ id: z.number().int().positive(),
5994
+ extensionId: ExtensionIdSchema,
5995
+ layer: z.enum(["host", "agent"]),
5996
+ agentId: AgentIdSchema.nullable(),
5997
+ version: z.number().int().positive(),
5998
+ config: JsonValueSchema,
5999
+ configuredSecrets: z.array(z.string()).optional(),
6000
+ boundCredentials: z.record(z.string(), CredentialIdSchema).optional(),
6001
+ source: ExtensionConfigVersionSourceSchema,
6002
+ actorAgentId: AgentIdSchema.nullable(),
6003
+ requesterMemberId: z.string().nullable(),
6004
+ reason: z.string().nullable(),
6005
+ createdAt: z.number().int().nonnegative()
6006
+ }).strict();
6007
+ const extensionConfigVersionParam = z.object({
6008
+ extensionId: ExtensionIdSchema,
6009
+ /** Decimal text of the version id; the path builder only takes strings. */
6010
+ versionId: z.string().regex(/^[1-9]\d{0,15}$/u)
6011
+ }).strict();
5042
6012
  const dshPluginPackageParam = z.object({ packageId: DshPluginPackageIdSchema }).strict();
5043
6013
  const dshPluginEntryParam = z.object({ entryId: DshPluginEntryIdSchema }).strict();
5044
6014
  const extensionRevisionParam = z.object({
@@ -5281,13 +6251,25 @@ const HostApiContracts = {
5281
6251
  response: z.object({
5282
6252
  task: AuthoringTaskSummarySchema,
5283
6253
  attempts: z.array(AuthoringAttemptSummarySchema),
5284
- /** Secret fields of the latest candidate and which have a test value for this task's dynamic runs. */
5285
- testSecrets: z.object({
6254
+ /**
6255
+ * Test configuration of this task's dynamic runs: fields of the latest candidate the user can type, which
6256
+ * credentials are set, the user's values and the values the agent provided.
6257
+ */
6258
+ testConfig: z.object({
5286
6259
  fields: z.array(z.object({
5287
6260
  key: z.string(),
5288
- title: z.string()
6261
+ title: z.string(),
6262
+ kind: z.enum([
6263
+ "secret",
6264
+ "string",
6265
+ "number"
6266
+ ])
5289
6267
  }).strict()),
5290
- configured: z.array(z.string())
6268
+ configured: z.array(z.string()),
6269
+ values: z.record(z.string(), z.union([z.string(), z.number()])),
6270
+ agentValues: z.record(z.string(), JsonValueSchema),
6271
+ /** Secret fields bound to a named credential, by the user or else by the agent. */
6272
+ boundCredentials: BoundCredentialsSchema.optional()
5291
6273
  }).strict().optional(),
5292
6274
  events: z.array(z.object({
5293
6275
  sequence: z.number().int().positive(),
@@ -5334,12 +6316,22 @@ const HostApiContracts = {
5334
6316
  response: AuthoringTaskSummarySchema,
5335
6317
  error: HostApiErrorSchema
5336
6318
  }),
5337
- setAuthoringTestSecrets: defineContract({
6319
+ setAuthoringTestConfig: defineContract({
5338
6320
  method: "PUT",
5339
6321
  path: "/api/authoring/tasks/:taskId/test-secrets",
5340
6322
  params: authoringTaskParam,
5341
- request: z.object({ secrets: z.record(z.string(), z.string().max(8192)) }).strict(),
5342
- response: z.object({ configured: z.array(z.string()) }).strict(),
6323
+ request: z.object({
6324
+ secrets: z.record(z.string(), z.string().max(8192)),
6325
+ /** Text and number values; an empty string goes back to the agent's value or the default. */
6326
+ values: z.record(z.string(), z.union([z.string().max(8192), z.number()])).optional(),
6327
+ /** Secret fields to bind to named credentials instead of a typed value; `null` leaves the field unset. */
6328
+ credentialBindings: CredentialBindingsRequestSchema.optional()
6329
+ }).strict(),
6330
+ response: z.object({
6331
+ configured: z.array(z.string()),
6332
+ values: z.record(z.string(), z.union([z.string(), z.number()])),
6333
+ boundCredentials: BoundCredentialsSchema.optional()
6334
+ }).strict(),
5343
6335
  error: HostApiErrorSchema
5344
6336
  }),
5345
6337
  deleteAuthoringTask: defineContract({
@@ -5544,7 +6536,9 @@ const HostApiContracts = {
5544
6536
  processingFeedback: z.enum(["auto", "off"]).optional(),
5545
6537
  /** Messages from another local agent's account: `observe` keeps them as context unless they @ this agent. */
5546
6538
  localAgentMessages: z.enum(["observe", "trigger"]).optional(),
5547
- activityTriggerOverrides: ActivityTriggerOverridesSchema.optional()
6539
+ activityTriggerOverrides: ActivityTriggerOverridesSchema.optional(),
6540
+ /** Omitted keeps the binding's current timing; `{}` resets every field to its default. */
6541
+ responseTiming: ResponseTimingSettingsSchema.optional()
5548
6542
  }).strict(),
5549
6543
  response: z.object({
5550
6544
  channelId: ChannelIdSchema,
@@ -5554,6 +6548,7 @@ const HostApiContracts = {
5554
6548
  processingFeedback: z.enum(["auto", "off"]).default("auto"),
5555
6549
  localAgentMessages: z.enum(["observe", "trigger"]).optional(),
5556
6550
  activityTriggerOverrides: ActivityTriggerOverridesSchema.default({}),
6551
+ responseTiming: ResponseTimingSettingsSchema.optional(),
5557
6552
  boundAt: z.number().int().safe().nonnegative()
5558
6553
  }).strict(),
5559
6554
  error: HostApiErrorSchema
@@ -5579,6 +6574,23 @@ const HostApiContracts = {
5579
6574
  response: WorkTreeOrderSchema,
5580
6575
  error: HostApiErrorSchema
5581
6576
  }),
6577
+ getChannelListView: defineContract({
6578
+ method: "GET",
6579
+ path: "/api/channel-list-view",
6580
+ params: EmptyParamsSchema,
6581
+ request: NoRequestBodySchema,
6582
+ response: ChannelListViewSchema,
6583
+ error: HostApiErrorSchema
6584
+ }),
6585
+ updateChannelListView: defineContract({
6586
+ invalidatesSnapshot: true,
6587
+ method: "PUT",
6588
+ path: "/api/channel-list-view",
6589
+ params: EmptyParamsSchema,
6590
+ request: ChannelListViewSchema,
6591
+ response: ChannelListViewSchema,
6592
+ error: HostApiErrorSchema
6593
+ }),
5582
6594
  listChannelMessages: defineContract({
5583
6595
  method: "GET",
5584
6596
  path: "/api/channels/:channelId/messages",
@@ -5824,6 +6836,39 @@ const HostApiContracts = {
5824
6836
  response: MessagePacingSettingsSchema,
5825
6837
  error: HostApiErrorSchema
5826
6838
  }),
6839
+ getCompactionSettings: defineContract({
6840
+ method: "GET",
6841
+ path: "/api/settings/compaction",
6842
+ params: EmptyParamsSchema,
6843
+ request: NoRequestBodySchema,
6844
+ response: CompactionSettingsSchema,
6845
+ error: HostApiErrorSchema
6846
+ }),
6847
+ updateCompactionSettings: defineContract({
6848
+ invalidatesSnapshot: true,
6849
+ method: "PUT",
6850
+ path: "/api/settings/compaction",
6851
+ params: EmptyParamsSchema,
6852
+ request: CompactionSettingsSchema,
6853
+ response: CompactionSettingsSchema,
6854
+ error: HostApiErrorSchema
6855
+ }),
6856
+ getModelFallbackSettings: defineContract({
6857
+ method: "GET",
6858
+ path: "/api/settings/model-fallback",
6859
+ params: EmptyParamsSchema,
6860
+ request: NoRequestBodySchema,
6861
+ response: ModelFallbackSettingsSchema,
6862
+ error: HostApiErrorSchema
6863
+ }),
6864
+ updateModelFallbackSettings: defineContract({
6865
+ method: "PUT",
6866
+ path: "/api/settings/model-fallback",
6867
+ params: EmptyParamsSchema,
6868
+ request: ModelFallbackSettingsSchema,
6869
+ response: ModelFallbackSettingsSchema,
6870
+ error: HostApiErrorSchema
6871
+ }),
5827
6872
  getUpgradeBackupSettings: defineContract({
5828
6873
  method: "GET",
5829
6874
  path: "/api/settings/upgrade-backup",
@@ -5859,109 +6904,173 @@ const HostApiContracts = {
5859
6904
  response: RetrievalStatusSchema,
5860
6905
  error: HostApiErrorSchema
5861
6906
  }),
5862
- downloadRetrievalModel: defineContract({
5863
- method: "POST",
5864
- path: "/api/settings/retrieval/model/download",
6907
+ getSpeechSettings: defineContract({
6908
+ method: "GET",
6909
+ path: "/api/settings/speech",
5865
6910
  params: EmptyParamsSchema,
5866
6911
  request: NoRequestBodySchema,
5867
- response: RetrievalStatusSchema,
6912
+ response: SpeechSettingsSchema,
5868
6913
  error: HostApiErrorSchema
5869
6914
  }),
5870
- removeRetrievalModel: defineContract({
5871
- method: "DELETE",
5872
- path: "/api/settings/retrieval/model",
6915
+ updateSpeechSettings: defineContract({
6916
+ method: "PUT",
6917
+ path: "/api/settings/speech",
6918
+ params: EmptyParamsSchema,
6919
+ request: z.object({ cloud: SpeechCloudSettingsSchema.nullable() }).strict(),
6920
+ response: SpeechSettingsSchema,
6921
+ error: HostApiErrorSchema
6922
+ }),
6923
+ listAddons: defineContract({
6924
+ method: "GET",
6925
+ path: "/api/addons",
5873
6926
  params: EmptyParamsSchema,
5874
6927
  request: NoRequestBodySchema,
5875
- response: RetrievalStatusSchema,
6928
+ response: z.object({ addons: z.array(AddonStatusSchema) }).strict(),
5876
6929
  error: HostApiErrorSchema
5877
6930
  }),
5878
- downloadCodeRunNode: defineContract({
6931
+ installAddonProvider: defineContract({
5879
6932
  invalidatesSnapshot: true,
5880
6933
  method: "POST",
5881
- path: "/api/runtimes/code-run-node/download",
5882
- params: EmptyParamsSchema,
6934
+ path: "/api/addons/:id/providers/:provider/install",
6935
+ params: z.object({
6936
+ id: AddonIdSchema,
6937
+ provider: NonEmptyStringSchema
6938
+ }).strict(),
5883
6939
  request: NoRequestBodySchema,
5884
- response: CodeRunAvailabilitySchema,
6940
+ response: AddonStatusSchema,
5885
6941
  error: HostApiErrorSchema
5886
6942
  }),
5887
- removeCodeRunNode: defineContract({
6943
+ removeAddonProvider: defineContract({
5888
6944
  invalidatesSnapshot: true,
5889
6945
  method: "DELETE",
5890
- path: "/api/runtimes/code-run-node",
5891
- params: EmptyParamsSchema,
6946
+ path: "/api/addons/:id/providers/:provider",
6947
+ params: z.object({
6948
+ id: AddonIdSchema,
6949
+ provider: NonEmptyStringSchema
6950
+ }).strict(),
5892
6951
  request: NoRequestBodySchema,
5893
- response: CodeRunAvailabilitySchema,
6952
+ response: AddonStatusSchema,
5894
6953
  error: HostApiErrorSchema
5895
6954
  }),
5896
- downloadGithubCli: defineContract({
6955
+ selectAddonProvider: defineContract({
5897
6956
  invalidatesSnapshot: true,
5898
- method: "POST",
5899
- path: "/api/runtimes/github-cli/download",
5900
- params: EmptyParamsSchema,
5901
- request: NoRequestBodySchema,
5902
- response: GithubCliAvailabilitySchema,
6957
+ method: "PUT",
6958
+ path: "/api/addons/:id/selection",
6959
+ params: z.object({ id: AddonIdSchema }).strict(),
6960
+ request: z.object({ provider: NonEmptyStringSchema }).strict(),
6961
+ response: AddonStatusSchema,
5903
6962
  error: HostApiErrorSchema
5904
6963
  }),
5905
- removeGithubCli: defineContract({
5906
- invalidatesSnapshot: true,
5907
- method: "DELETE",
5908
- path: "/api/runtimes/github-cli",
6964
+ getLinkedAccounts: defineContract({
6965
+ method: "GET",
6966
+ path: "/api/settings/linked-accounts",
5909
6967
  params: EmptyParamsSchema,
5910
6968
  request: NoRequestBodySchema,
5911
- response: GithubCliAvailabilitySchema,
6969
+ response: LinkedAccountsViewSchema,
5912
6970
  error: HostApiErrorSchema
5913
6971
  }),
5914
- downloadVerificationBrowser: defineContract({
6972
+ addLinkedAccount: defineContract({
5915
6973
  invalidatesSnapshot: true,
5916
6974
  method: "POST",
5917
- path: "/api/runtimes/verification-browser/download",
6975
+ path: "/api/settings/linked-accounts",
5918
6976
  params: EmptyParamsSchema,
5919
- request: NoRequestBodySchema,
5920
- response: VerificationBrowserAvailabilitySchema,
6977
+ request: AddLinkedAccountRequestSchema,
6978
+ response: LinkedAccountsViewSchema,
5921
6979
  error: HostApiErrorSchema
5922
6980
  }),
5923
- removeVerificationBrowser: defineContract({
6981
+ replaceLinkedAccountToken: defineContract({
5924
6982
  invalidatesSnapshot: true,
5925
- method: "DELETE",
5926
- path: "/api/runtimes/verification-browser",
5927
- params: EmptyParamsSchema,
6983
+ method: "PUT",
6984
+ path: "/api/settings/linked-accounts/:accountId/token",
6985
+ params: linkedAccountParam,
6986
+ request: ReplaceLinkedAccountTokenRequestSchema,
6987
+ response: LinkedAccountsViewSchema,
6988
+ error: HostApiErrorSchema
6989
+ }),
6990
+ removeLinkedAccount: defineContract({
6991
+ invalidatesSnapshot: true,
6992
+ method: "POST",
6993
+ path: "/api/settings/linked-accounts/:accountId/remove",
6994
+ params: linkedAccountParam,
6995
+ request: RemoveLinkedAccountRequestSchema,
6996
+ response: RemoveLinkedAccountResultSchema,
6997
+ error: HostApiErrorSchema
6998
+ }),
6999
+ getLinkedAccountUses: defineContract({
7000
+ method: "GET",
7001
+ path: "/api/settings/linked-accounts/:accountId/uses",
7002
+ params: linkedAccountParam,
5928
7003
  request: NoRequestBodySchema,
5929
- response: VerificationBrowserAvailabilitySchema,
7004
+ response: LinkedAccountUsesViewSchema,
5930
7005
  error: HostApiErrorSchema
5931
7006
  }),
5932
- getCommandAccounts: defineContract({
7007
+ getCredentials: defineContract({
5933
7008
  method: "GET",
5934
- path: "/api/settings/command-accounts",
7009
+ path: "/api/settings/credentials",
5935
7010
  params: EmptyParamsSchema,
5936
7011
  request: NoRequestBodySchema,
5937
- response: CommandAccountsViewSchema,
7012
+ response: CredentialsViewSchema,
5938
7013
  error: HostApiErrorSchema
5939
7014
  }),
5940
- addCommandAccount: defineContract({
7015
+ createCredential: defineContract({
5941
7016
  invalidatesSnapshot: true,
5942
7017
  method: "POST",
5943
- path: "/api/settings/command-accounts",
7018
+ path: "/api/settings/credentials",
5944
7019
  params: EmptyParamsSchema,
5945
- request: AddCommandAccountRequestSchema,
5946
- response: CommandAccountsViewSchema,
7020
+ request: CreateCredentialRequestSchema,
7021
+ response: CredentialsViewSchema,
5947
7022
  error: HostApiErrorSchema
5948
7023
  }),
5949
- replaceCommandAccountToken: defineContract({
7024
+ updateCredential: defineContract({
7025
+ invalidatesSnapshot: true,
7026
+ method: "PATCH",
7027
+ path: "/api/settings/credentials/:credentialId",
7028
+ params: credentialParam,
7029
+ request: UpdateCredentialRequestSchema,
7030
+ response: CredentialsViewSchema,
7031
+ error: HostApiErrorSchema
7032
+ }),
7033
+ replaceCredentialValue: defineContract({
5950
7034
  invalidatesSnapshot: true,
5951
7035
  method: "PUT",
5952
- path: "/api/settings/command-accounts/:accountId",
5953
- params: z.object({ accountId: NonEmptyStringSchema.max(64) }).strict(),
5954
- request: AddCommandAccountRequestSchema,
5955
- response: CommandAccountsViewSchema,
7036
+ path: "/api/settings/credentials/:credentialId/value",
7037
+ params: credentialParam,
7038
+ request: ReplaceCredentialValueRequestSchema,
7039
+ response: CredentialsViewSchema,
5956
7040
  error: HostApiErrorSchema
5957
7041
  }),
5958
- removeCommandAccount: defineContract({
7042
+ removeCredential: defineContract({
5959
7043
  invalidatesSnapshot: true,
7044
+ method: "POST",
7045
+ path: "/api/settings/credentials/:credentialId/remove",
7046
+ params: credentialParam,
7047
+ request: RemoveCredentialRequestSchema,
7048
+ response: RemoveCredentialResultSchema,
7049
+ error: HostApiErrorSchema
7050
+ }),
7051
+ getCredentialUses: defineContract({
7052
+ method: "GET",
7053
+ path: "/api/settings/credentials/:credentialId/uses",
7054
+ params: credentialParam,
7055
+ request: NoRequestBodySchema,
7056
+ response: CredentialUsesViewSchema,
7057
+ error: HostApiErrorSchema
7058
+ }),
7059
+ dismissCredentialRequest: defineContract({
5960
7060
  method: "DELETE",
5961
- path: "/api/settings/command-accounts/:accountId",
5962
- params: z.object({ accountId: NonEmptyStringSchema.max(64) }).strict(),
7061
+ path: "/api/settings/credentials/requests/:requestId",
7062
+ params: z.object({ requestId: NonEmptyStringSchema.max(64) }).strict(),
5963
7063
  request: NoRequestBodySchema,
5964
- response: CommandAccountsViewSchema,
7064
+ response: CredentialsViewSchema,
7065
+ error: HostApiErrorSchema
7066
+ }),
7067
+ setModelProviderAccess: defineContract({
7068
+ invalidatesSnapshot: true,
7069
+ method: "PUT",
7070
+ path: "/api/settings/credentials/model-providers/:provider",
7071
+ params: z.object({ provider: NonEmptyStringSchema.max(128) }).strict(),
7072
+ request: SetModelProviderAccessRequestSchema,
7073
+ response: CredentialsViewSchema,
5965
7074
  error: HostApiErrorSchema
5966
7075
  }),
5967
7076
  getChannelMemberNotes: defineContract({
@@ -6260,6 +7369,14 @@ const HostApiContracts = {
6260
7369
  response: z.object({ disabled: z.literal(true) }).strict(),
6261
7370
  error: HostApiErrorSchema
6262
7371
  }),
7372
+ setDshPluginImageSubmission: defineContract({
7373
+ method: "PUT",
7374
+ path: "/api/dsh/plugin-installs/:packageId/image-submission",
7375
+ params: dshPluginPackageParam,
7376
+ request: z.object({ allowed: z.boolean() }).strict(),
7377
+ response: z.object({ allowed: z.boolean() }).strict(),
7378
+ error: HostApiErrorSchema
7379
+ }),
6263
7380
  removeDshPluginPackage: defineContract({
6264
7381
  invalidatesSnapshot: true,
6265
7382
  method: "DELETE",
@@ -6479,22 +7596,27 @@ const HostApiContracts = {
6479
7596
  official: z.enum(["1"]).optional(),
6480
7597
  /** 排序方式,默认最近更新;游标只在同一种排序下有效。 */
6481
7598
  sort: CommunityExtensionSortSchema.optional(),
6482
- cursor: z.string().max(200).optional()
7599
+ cursor: z.string().max(200).optional(),
7600
+ /** 跳过本机缓存,重新向社区读取。 */
7601
+ refresh: z.enum(["1"]).optional()
6483
7602
  }).strict(),
6484
7603
  request: NoRequestBodySchema,
6485
7604
  response: z.object({
6486
7605
  items: z.array(CommunityExtensionSummarySchema),
6487
7606
  nextCursor: z.string().nullable()
6488
- }).strict(),
7607
+ }).extend(CommunityFreshnessSchema.shape).strict(),
6489
7608
  error: HostApiErrorSchema
6490
7609
  }),
6491
7610
  getCommunityExtension: defineContract({
6492
7611
  timeoutMs: 3e4,
6493
7612
  method: "GET",
6494
7613
  path: "/api/community/extensions/:extensionId",
6495
- params: z.object({ extensionId: ExtensionIdSchema }).strict(),
7614
+ params: z.object({
7615
+ extensionId: ExtensionIdSchema,
7616
+ refresh: z.enum(["1"]).optional()
7617
+ }).strict(),
6496
7618
  request: NoRequestBodySchema,
6497
- response: CommunityExtensionDetailSchema,
7619
+ response: CommunityExtensionDetailSchema.extend(CommunityFreshnessSchema.shape),
6498
7620
  error: HostApiErrorSchema
6499
7621
  }),
6500
7622
  /** 下载社区发布并按包摘要校验,结果与本地文件导入的检查相同,再经 `commitExtensionImport` 确认。 */
@@ -6626,22 +7748,27 @@ const HostApiContracts = {
6626
7748
  query: z.string().trim().min(1).max(200).optional(),
6627
7749
  tag: z.string().trim().min(1).max(40).optional(),
6628
7750
  official: z.literal("1").optional(),
6629
- cursor: z.string().min(1).max(500).optional()
7751
+ cursor: z.string().min(1).max(500).optional(),
7752
+ /** 跳过本机缓存,重新向社区读取。 */
7753
+ refresh: z.enum(["1"]).optional()
6630
7754
  }).strict(),
6631
7755
  request: NoRequestBodySchema,
6632
7756
  response: z.object({
6633
7757
  items: z.array(CommunityPersonaSummarySchema),
6634
7758
  nextCursor: z.string().nullable()
6635
- }).strict(),
7759
+ }).extend(CommunityFreshnessSchema.shape).strict(),
6636
7760
  error: HostApiErrorSchema
6637
7761
  }),
6638
7762
  getCommunityPersona: defineContract({
6639
7763
  timeoutMs: 3e4,
6640
7764
  method: "GET",
6641
7765
  path: "/api/community/personas/:personaId",
6642
- params: z.object({ personaId: CommunityPersonaIdSchema }).strict(),
7766
+ params: z.object({
7767
+ personaId: CommunityPersonaIdSchema,
7768
+ refresh: z.enum(["1"]).optional()
7769
+ }).strict(),
6643
7770
  request: NoRequestBodySchema,
6644
- response: CommunityPersonaDetailSchema,
7771
+ response: CommunityPersonaDetailSchema.extend(CommunityFreshnessSchema.shape),
6645
7772
  error: HostApiErrorSchema
6646
7773
  }),
6647
7774
  /**
@@ -6818,6 +7945,46 @@ const HostApiContracts = {
6818
7945
  response: LlmProviderSettingsSchema,
6819
7946
  error: HostApiErrorSchema
6820
7947
  }),
7948
+ llmSubscriptionStatus: defineContract({
7949
+ method: "GET",
7950
+ path: "/api/llm/subscriptions/:provider",
7951
+ params: llmProviderParam,
7952
+ request: NoRequestBodySchema,
7953
+ response: SubscriptionStatusSchema,
7954
+ error: HostApiErrorSchema
7955
+ }),
7956
+ llmSubscriptionAction: defineContract({
7957
+ invalidatesSnapshot: true,
7958
+ method: "POST",
7959
+ path: "/api/llm/subscriptions/:provider",
7960
+ params: llmProviderParam,
7961
+ request: z.discriminatedUnion("action", [
7962
+ z.object({
7963
+ action: z.literal("use-subscription"),
7964
+ expectedRevision: z.number().int().nonnegative()
7965
+ }).strict(),
7966
+ z.object({ action: z.enum(["login", "cancel"]) }).strict(),
7967
+ z.object({
7968
+ action: z.literal("answer"),
7969
+ promptId: NonEmptyStringSchema,
7970
+ value: z.string().max(4096)
7971
+ }).strict(),
7972
+ z.object({
7973
+ action: z.enum(["activate", "remove"]),
7974
+ accountId: NonEmptyStringSchema
7975
+ }).strict(),
7976
+ z.object({
7977
+ action: z.literal("rename"),
7978
+ accountId: NonEmptyStringSchema,
7979
+ label: z.string().min(1).max(80)
7980
+ }).strict()
7981
+ ]),
7982
+ response: z.object({
7983
+ status: SubscriptionStatusSchema,
7984
+ revocationConfirmed: z.boolean().optional()
7985
+ }).strict(),
7986
+ error: HostApiErrorSchema
7987
+ }),
6821
7988
  llmDiscoverModels: defineContract({
6822
7989
  method: "POST",
6823
7990
  path: "/api/llm/discover-models",
@@ -7183,6 +8350,7 @@ const HostApiContracts = {
7183
8350
  extensionRevisionId: ExtensionRevisionIdSchema,
7184
8351
  config: JsonValueSchema,
7185
8352
  configuredSecrets: z.array(z.string()).optional(),
8353
+ boundCredentials: BoundCredentialsSchema.optional(),
7186
8354
  activatedAt: z.number().int().safe().nonnegative()
7187
8355
  }).strict().optional(),
7188
8356
  pending: ExtensionActivationTransitionSchema.optional()
@@ -7202,6 +8370,16 @@ const HostApiContracts = {
7202
8370
  }).strict(),
7203
8371
  error: HostApiErrorSchema
7204
8372
  }),
8373
+ putAgentOutboundOrder: defineContract({
8374
+ invalidatesSnapshot: true,
8375
+ method: "PUT",
8376
+ path: "/api/agents/:agentId/outbound-order",
8377
+ params: agentParam,
8378
+ /** Every enabled extension that processes the agent's messages before sending, in the new order. */
8379
+ request: z.object({ extensionIds: z.array(ExtensionIdSchema).max(64) }).strict(),
8380
+ response: z.object({ extensionIds: z.array(ExtensionIdSchema) }).strict(),
8381
+ error: HostApiErrorSchema
8382
+ }),
7205
8383
  updateExtensionActivationConfig: defineContract({
7206
8384
  invalidatesSnapshot: true,
7207
8385
  method: "PUT",
@@ -7210,11 +8388,14 @@ const HostApiContracts = {
7210
8388
  request: z.object({
7211
8389
  config: JsonValueSchema,
7212
8390
  /** Write-only credential drafts keyed by secret field; an absent or empty draft keeps the stored one. */
7213
- secrets: z.record(z.string(), z.string().max(8192)).optional()
8391
+ secrets: z.record(z.string(), z.string().max(8192)).optional(),
8392
+ /** Secret fields to bind to named credentials instead of a typed value; a field takes one or the other. */
8393
+ credentialBindings: CredentialBindingsRequestSchema.optional()
7214
8394
  }).strict(),
7215
8395
  response: z.object({
7216
8396
  config: JsonValueSchema,
7217
- configuredSecrets: z.array(z.string()).optional()
8397
+ configuredSecrets: z.array(z.string()).optional(),
8398
+ boundCredentials: BoundCredentialsSchema.optional()
7218
8399
  }).strict(),
7219
8400
  error: HostApiErrorSchema
7220
8401
  }),
@@ -7227,14 +8408,37 @@ const HostApiContracts = {
7227
8408
  request: z.object({
7228
8409
  config: JsonValueSchema,
7229
8410
  /** Write-only credential drafts keyed by secret field; an absent or empty draft keeps the stored one. */
7230
- secrets: z.record(z.string(), z.string().max(8192)).optional()
8411
+ secrets: z.record(z.string(), z.string().max(8192)).optional(),
8412
+ /** Secret fields to bind to named credentials instead of a typed value; a field takes one or the other. */
8413
+ credentialBindings: CredentialBindingsRequestSchema.optional()
7231
8414
  }).strict(),
7232
8415
  response: z.object({
7233
8416
  config: JsonValueSchema,
7234
- configuredSecrets: z.array(z.string()).optional()
8417
+ configuredSecrets: z.array(z.string()).optional(),
8418
+ boundCredentials: BoundCredentialsSchema.optional()
7235
8419
  }).strict(),
7236
8420
  error: HostApiErrorSchema
7237
8421
  }),
8422
+ /** Configuration history of one extension, newest first: the host layer and every agent's configuration. */
8423
+ getExtensionConfigVersions: defineContract({
8424
+ method: "GET",
8425
+ path: "/api/extensions/:extensionId/config-versions",
8426
+ params: extensionParam,
8427
+ request: NoRequestBodySchema,
8428
+ response: z.object({ versions: z.array(ExtensionConfigVersionSchema) }).strict(),
8429
+ error: HostApiErrorSchema
8430
+ }),
8431
+ /** Writes an earlier configuration again as a new version of the same layer (and agent). */
8432
+ revertExtensionConfig: defineContract({
8433
+ invalidatesSnapshot: true,
8434
+ timeoutMs: 3e5,
8435
+ method: "POST",
8436
+ path: "/api/extensions/:extensionId/config-versions/:versionId/revert",
8437
+ params: extensionConfigVersionParam,
8438
+ request: z.object({ reason: z.string().trim().max(500).optional() }).strict(),
8439
+ response: z.object({ version: ExtensionConfigVersionSchema }).strict(),
8440
+ error: HostApiErrorSchema
8441
+ }),
7238
8442
  installHostExtension: defineContract({
7239
8443
  invalidatesSnapshot: true,
7240
8444
  timeoutMs: 3e5,
@@ -7345,6 +8549,21 @@ upTo: z.object({
7345
8549
  }).strict(),
7346
8550
  error: HostApiErrorSchema
7347
8551
  }),
8552
+ dismissAttentionBatch: defineContract({
8553
+ method: "POST",
8554
+ path: "/api/attention/dismiss",
8555
+ params: EmptyParamsSchema,
8556
+ request: z.object({
8557
+ ids: z.array(z.string().min(1).max(200)).max(200),
8558
+ /** Causes to keep quiet until they recover; new items of these causes are not shown meanwhile. */
8559
+ causes: z.array(z.string().min(1).max(200)).max(200)
8560
+ }).strict(),
8561
+ response: z.object({
8562
+ dismissed: z.literal(true),
8563
+ revision: z.string().min(1)
8564
+ }).strict(),
8565
+ error: HostApiErrorSchema
8566
+ }),
7348
8567
  getChannelPending: defineContract({
7349
8568
  method: "GET",
7350
8569
  path: "/api/channels/:channelId/pending",
@@ -7470,6 +8689,26 @@ upTo: z.object({
7470
8689
  response: ExtensionLineageSchema,
7471
8690
  error: HostApiErrorSchema
7472
8691
  }),
8692
+ setExtensionRevisionKept: defineContract({
8693
+ method: "POST",
8694
+ path: "/api/extensions/:extensionId/revisions/:revisionId/keep",
8695
+ params: z.object({
8696
+ extensionId: ExtensionIdSchema,
8697
+ revisionId: ExtensionRevisionIdSchema
8698
+ }).strict(),
8699
+ request: z.object({ kept: z.boolean() }).strict(),
8700
+ response: z.object({ kept: z.boolean() }).strict(),
8701
+ error: HostApiErrorSchema
8702
+ }),
8703
+ deleteExtensionRevisions: defineContract({
8704
+ invalidatesSnapshot: true,
8705
+ method: "POST",
8706
+ path: "/api/extensions/:extensionId/revisions/delete",
8707
+ params: extensionParam,
8708
+ request: z.object({ revisionIds: z.array(ExtensionRevisionIdSchema).min(1).max(200) }).strict(),
8709
+ response: z.object({ deleted: z.number().int().nonnegative() }).strict(),
8710
+ error: HostApiErrorSchema
8711
+ }),
7473
8712
  branchExtension: defineContract({
7474
8713
  invalidatesSnapshot: true,
7475
8714
  timeoutMs: 3e5,
@@ -7666,9 +8905,9 @@ const buildValidatedHostApiPath = (contract, input) => {
7666
8905
  const consumed = /* @__PURE__ */ new Set();
7667
8906
  const pathname = contract.path.replace(pathParameterPattern, (_placeholder, key) => {
7668
8907
  const value = params[key];
7669
- if (typeof value !== "string") throw new TypeError(`Host API path parameter ${key} must be a string.`);
8908
+ if (typeof value !== "string" && typeof value !== "number") throw new TypeError(`Host API path parameter ${key} must be a string or number.`);
7670
8909
  consumed.add(key);
7671
- return encodeURIComponent(value);
8910
+ return encodeURIComponent(String(value));
7672
8911
  });
7673
8912
  const query = new URLSearchParams();
7674
8913
  for (const [key, value] of Object.entries(params)) {
@@ -7686,6 +8925,6 @@ function buildHostApiPath(name, input) {
7686
8925
  return buildValidatedHostApiPath(HostApiContracts[name], input);
7687
8926
  }
7688
8927
  //#endregion
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 };
8928
+ export { ACTIVITY_MAX_BUCKETS, ACTIVITY_MAX_WINDOW_MS, ACTIVITY_MIN_BUCKET_MS, ActivityQuerySchema, AdapterActivityKeySchema, AddLinkedAccountRequestSchema, AddonAvailabilitySchema, AddonGroupSchema, AddonIdSchema, AddonProviderStatusSchema, AddonStateSchema, AddonStatusSchema, AdministratorSchema, AdmissionIdSchema, AgentAliasesSchema, AgentAppearanceSchema, AgentCompactionModelChoiceSchema, AgentCompactionPolicySchema, AgentFallbackModelsSchema, AgentIdSchema, AgentRevisionChangedFieldSchema, AgentRevisionHistorySchema, AgentRevisionIdSchema, AgentSubConversationModelsSchema, AssetIdSchema, AttentionItemSchema, AttentionListSchema, AuthoringAttemptIdSchema, AuthoringTaskIdSchema, BoundCredentialsSchema, 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, CREDENTIAL_DESCRIPTION_MAX_CHARS, CREDENTIAL_NAME_MAX_CHARS, CREDENTIAL_REDACTABLE_MIN_CHARS, CREDENTIAL_VALUE_MAX_CHARS, ChannelActivitySeriesSchema, ChannelActivitySummarySchema, ChannelContextPolicySchema, ChannelContextPolicyViewSchema, ChannelEventIdSchema, ChannelFactSseDataSchema, ChannelFactSseItemSchema, ChannelIdSchema, ChannelListViewSchema, ChannelMemberIdSchema, ChannelMemberNotesViewSchema, ChannelMemoryActivitySchema, ChannelPendingContextSchema, ChannelPromptViewSchema, ChannelRuntimeCacheSampleSchema, ChannelRuntimeCacheSchema, ChannelRuntimeContextSchema, ChannelRuntimeInputSchema, ChannelRuntimeOccupancySchema, ChannelRuntimePerformanceSampleSchema, ChannelRuntimePerformanceSchema, ChannelRuntimePhaseSchema, ChannelRuntimeProjectionSchema, ChannelRuntimeSseDataSchema, ChannelRuntimeStepSchema, ChannelRuntimeToolProgressSchema, ChannelRuntimeToolSchema, ChannelRuntimeTurnSchema, ChannelRuntimeUsageSchema, ClientNotificationFeedResponseSchema, ClientNotificationSchema, CommandAccountUsageSchema, 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, CommunityFreshnessSchema, CommunityInstalledItemSchema, CommunityInstalledSchema, CommunityListingInputSchema, CommunityMyExtensionSchema, CommunityMyPersonaSchema, CommunityMyPersonasSchema, CommunityPermissionItemSchema, CommunityPersonaDetailSchema, CommunityPersonaIdSchema, CommunityPersonaReviewStatusSchema, CommunityPersonaRevisionIdSchema, CommunityPersonaSummarySchema, CommunityRatingSchema, CommunityReleaseIdSchema, CommunityReleaseSchema, CommunityReviewReportSchema, CommunityReviewStatusSchema, CommunitySourceSchema, CommunityStatusSchema, CommunitySyncItemSchema, CommunitySyncSchema, CompactionSettingsSchema, ConfigSchemaDocumentSchema, ConfigSchemaMetaSchema, ConfigSchemaNodeSchema, ConnectionEventIdSchema, ConnectionIdSchema, ConnectionPanelRoleSchema, ConnectionTestResultSchema, CreateCredentialRequestSchema, CredentialAgentScopeSchema, CredentialBindingsRequestSchema, CredentialConsumerKindSchema, CredentialDescriptionSchema, CredentialDomainsSchema, CredentialEnvNameSchema, CredentialIdSchema, CredentialNameSchema, CredentialRequestViewSchema, CredentialUsageSchema, CredentialUseSchema, CredentialUsersSchema, CredentialUsesViewSchema, CredentialValueSchema, CredentialViewSchema, CredentialsViewSchema, DEFAULT_CHANNEL_CONTEXT_POLICY, DEFAULT_COMPACTION_SETTINGS, DEFAULT_MESSAGE_PACING, DEFAULT_MODEL_FALLBACK_SETTINGS, 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_COMMAND_PROFILES, EXTENSION_CONTEXT_DYNAMIC_MAX_CHARS, EXTENSION_CONTEXT_STATIC_MAX_CHARS, EXTENSION_DATA_HOOK_PERMISSIONS, EXTENSION_FILES_DEFAULT_CACHE_QUOTA_BYTES, EXTENSION_FILES_DEFAULT_TEMP_QUOTA_BYTES, EXTENSION_FILES_MAX_QUOTA_BYTES, EXTENSION_FILES_SDK_LEVEL, 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_OUTBOUND_MAX_TIMEOUT_MS, EXTENSION_OUTBOUND_SDK_LEVEL, EXTENSION_PROVIDES, EXTENSION_SDK_BASE_LEVEL, EXTENSION_SDK_LEVEL, EXTENSION_SDK_RELEASES, EXTENSION_SPEECH_DEFAULT_CALLS_PER_MINUTE, EXTENSION_SPEECH_MAX_CALLS_PER_MINUTE, EXTENSION_STORAGE_DEFAULT_QUOTA_BYTES, EXTENSION_STORAGE_MAX_QUOTA_BYTES, EXTENSION_STORAGE_SCOPES, EpisodeHandoffIdSchema, EpisodeIdSchema, ExtensionActivationTransitionSchema, ExtensionAssetLibraryCapabilitySchema, ExtensionAssetsCapabilitySchema, ExtensionCapabilitiesSchema, ExtensionCommandProfileIdSchema, ExtensionCommandsCapabilitySchema, ExtensionConfigDeclarationSchema, ExtensionConfigVersionSchema, ExtensionConfigVersionSourceSchema, ExtensionContextContributionSchema, ExtensionDataMigrationInputSchema, ExtensionDataPackageInspectionSchema, ExtensionDataPreviewSchema, ExtensionDataSourceSchema, ExtensionDataStateSchema, ExtensionDeclaredJobSchema, ExtensionFilesCapabilitySchema, ExtensionIdSchema, ExtensionImportInspectionSchema, ExtensionInboundHookCapabilitySchema, ExtensionIndexCapabilitySchema, ExtensionIndexCollectionSchema, ExtensionJobsCapabilitySchema, ExtensionLayeredConfigSchema, ExtensionLineageNodeSchema, ExtensionLineageSchema, ExtensionLlmCapabilitySchema, ExtensionMcpCapabilitySchema, ExtensionMcpServerNameSchema, ExtensionMcpServerSchema, ExtensionMcpValueSchema, ExtensionModelsCapabilitySchema, ExtensionNetworkCapabilitySchema, ExtensionNetworkDomainSchema, ExtensionOutboundCapabilitySchema, ExtensionPanelAnchorSchema, ExtensionPanelDeclarationSchema, ExtensionPermissionRequirementSchema, ExtensionPermissionsSchema, ExtensionPlatformCapabilitySchema, ExtensionProvideSchema, ExtensionRequestSchema, ExtensionRequiresSchema, ExtensionRevisionIdSchema, ExtensionRevisionProtectionSchema, ExtensionSpeechCapabilitySchema, ExtensionStorageCapabilitySchema, ExtensionStorageScopeSchema, ExtensionToolImagesCapabilitySchema, ExtensionUiContributionsSchema, FALLBACK_MODEL_LIMIT, 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, LinkedAccountIdSchema, LinkedAccountMethodSchema, LinkedAccountPlatformIdSchema, LinkedAccountPlatformToolSchema, LinkedAccountTokenSourceSchema, LinkedAccountUseSchema, LinkedAccountUsesViewSchema, LinkedAccountViewSchema, LinkedAccountsViewSchema, LlmDiscoveredModelSchema, LlmModelInputModalitiesSchema, LlmModelReasoningEffortsSchema, 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, ModelFallbackReasonSchema, ModelFallbackSettingsSchema, ModelProviderAccessSchema, NO_SUB_CONVERSATION_MODELS, NonEmptyMessagePartsSchema, NotificationEventKeySchema, NotificationSettingsViewSchema, OutboundIntentIdSchema, PANEL_ANCHOR_LAYER, PROMPT_DOCUMENT_MAX_PLAIN_TEXT_LENGTH, PROMPT_DOCUMENT_MAX_REFERENCES, PanelContributionSchema, PanelDensitySchema, PhysicalDeliveryIdSchema, PlatformIdentityIdSchema, PlatformUserListResponseSchema, ProductDownloadSchema, ProductUpdateStatusSchema, PromptDocumentV1Schema, PromptSegmentSchema, RESPONSE_TIMING_DEFAULTS, RESPONSE_TIMING_LIMITS, RESPONSE_WAIT_MIN_QUIET_SECONDS, RICH_EXTENSION_MAX_BYTES, RemoveCredentialRequestSchema, RemoveCredentialResultSchema, RemoveLinkedAccountRequestSchema, RemoveLinkedAccountResultSchema, ReplaceCredentialValueRequestSchema, ReplaceLinkedAccountTokenRequestSchema, ResponseTimingSettingsSchema, RetrievalModeSchema, RetrievalStatusSchema, RichExtensionSchema, RichKindSchema, RichTargetUrlSchema, RuntimeCompatibilityDiagnosticSchema, SUB_CONVERSATION_MAIN_MODEL, SUB_CONVERSATION_MODEL_LIMITS, ScheduledTaskIdSchema, ScheduledTaskSchema, ServerInstanceIdSchema, SetModelProviderAccessRequestSchema, SpeechCloudSettingsSchema, SpeechLanguageSchema, SpeechSettingsSchema, SubConversationIdSchema, SubConversationRetentionSchema, SubConversationSchema, SubConversationSettingsSchema, SubscriptionStatusSchema, TestBarkNotificationRequestSchema, ToolViewContributionSchema, ToolViewDensitySchema, UNBOUND_CHANNEL_GROUP_ID, UpdateCredentialRequestSchema, UpdateNotificationSettingsRequestSchema, UpgradeBackupModeSchema, UpgradeBackupSettingsSchema, WorkTreeOrderSchema, activityDurationMs, adminOnlyConfigKeys, agentPermissionDeclaration, buildHostApiContractPath, buildHostApiPath, commandNameOf, commandUsage, communityPersonaReviewLabel, communityPublisherLabel, communityReviewLabel, configDescription, configFieldKind, configFieldLevel, configFields, configSchema, configSecretKeys, credentialRequestRoute, 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, outboundProcessesBeforeSend, parseCommandArguments, parseConfigValue, parseJsonValue, parseMessageParts, promptDocumentFromText, promptDocumentPlainText, recognizeCommand, requiredExtensionAddons, requiredExtensionSdkLevel, resolveResponseTiming, richPartContextText, summarizeExtensionCapabilities, tokenizeCommand, undeliveredCommandReplies, validateConfigValue };
7690
8929
 
7691
8930
  //# sourceMappingURL=index.mjs.map