@nekro-nxt/contracts 0.6.0 → 0.7.1
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 +436 -109
- package/dist/index.mjs.map +1 -1
- package/lib/types/extension-capabilities.d.ts +109 -4
- package/lib/types/extension-capabilities.d.ts.map +1 -1
- package/lib/types/extension-ui.d.ts +75 -6
- package/lib/types/extension-ui.d.ts.map +1 -1
- package/lib/types/host-api.d.ts +1352 -524
- package/lib/types/host-api.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/extension-capabilities.ts +208 -6
- package/src/extension-ui.ts +13 -1
- package/src/host-api.ts +271 -97
package/src/host-api.ts
CHANGED
|
@@ -9,7 +9,11 @@ import {
|
|
|
9
9
|
hostLogSourceSchema,
|
|
10
10
|
hostLogStatusSchema,
|
|
11
11
|
} from './logs.js'
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
EXTENSION_DOWNLOAD_MAX_BYTES,
|
|
14
|
+
EXTENSION_DOWNLOAD_MIN_BYTES,
|
|
15
|
+
McpServerFormSchema,
|
|
16
|
+
} from './extension-capabilities.js'
|
|
13
17
|
import {
|
|
14
18
|
BoundCredentialsSchema,
|
|
15
19
|
CredentialBindingsRequestSchema,
|
|
@@ -315,7 +319,7 @@ export const ImageUnderstandingPolicyApiSchema = z
|
|
|
315
319
|
restoreAfterCompaction: z
|
|
316
320
|
.object({
|
|
317
321
|
recentMessages: z.number().int().min(1).max(100),
|
|
318
|
-
maxImages: z.number().int().min(
|
|
322
|
+
maxImages: z.number().int().min(0).max(50),
|
|
319
323
|
})
|
|
320
324
|
.strict(),
|
|
321
325
|
})
|
|
@@ -365,6 +369,8 @@ const AgentCapabilitiesSchema = z
|
|
|
365
369
|
/** Network for commands; absent in older clients means on. */
|
|
366
370
|
commandNetwork: z.boolean().default(true),
|
|
367
371
|
communityFeedbackAuto: z.boolean().default(false),
|
|
372
|
+
/** Voice messages reach the agent with a transcript (附加功能 F10). */
|
|
373
|
+
voiceTranscription: z.boolean().default(false),
|
|
368
374
|
/** Linked accounts this agent's commands act as, one per platform; absent in older clients means none. */
|
|
369
375
|
commandAccounts: z.array(CommandAccountGrantSchema).max(8).default([]),
|
|
370
376
|
/**
|
|
@@ -508,6 +514,12 @@ export const ModelFallbackReasonSchema = z.enum(['quota', 'rate-limit', 'unavail
|
|
|
508
514
|
export type ModelFallbackReason = z.output<typeof ModelFallbackReasonSchema>
|
|
509
515
|
|
|
510
516
|
/** How long a model that failed is passed over before conversations try it again. */
|
|
517
|
+
/** 设置 → 存储 → 扩展下载上限: the most one extension download (`files.fromUrl`) may write. */
|
|
518
|
+
export const ExtensionDownloadSettingsSchema = z
|
|
519
|
+
.object({ maxBytes: z.number().int().min(EXTENSION_DOWNLOAD_MIN_BYTES).max(EXTENSION_DOWNLOAD_MAX_BYTES) })
|
|
520
|
+
.strict()
|
|
521
|
+
export type ExtensionDownloadSettings = z.output<typeof ExtensionDownloadSettingsSchema>
|
|
522
|
+
|
|
511
523
|
export const ModelFallbackSettingsSchema = z
|
|
512
524
|
.object({
|
|
513
525
|
/** After rate limits, server errors, timeouts or empty replies that outlasted the usual retries. */
|
|
@@ -621,6 +633,7 @@ const UpdateAgentCapabilitiesRequestSchema = AgentCapabilitiesSchema.partial()
|
|
|
621
633
|
codeRun: z.boolean().optional(),
|
|
622
634
|
commandNetwork: z.boolean().optional(),
|
|
623
635
|
communityFeedbackAuto: z.boolean().optional(),
|
|
636
|
+
voiceTranscription: z.boolean().optional(),
|
|
624
637
|
commandAccounts: z.array(CommandAccountGrantSchema).max(8).optional(),
|
|
625
638
|
extensionAutonomy: z.enum(['manual', 'confirm', 'autonomous']).optional(),
|
|
626
639
|
extensionRequesters: z.enum(['everyone', 'admins']).optional(),
|
|
@@ -726,6 +739,8 @@ export const HostSnapshotMessageSchema = z
|
|
|
726
739
|
trigger: z.enum(['default', 'suppress', 'force']),
|
|
727
740
|
hidden: z.boolean(),
|
|
728
741
|
annotation: z.string().optional(),
|
|
742
|
+
/** What NekroNXT itself added for the agent, such as the transcript of a voice message. */
|
|
743
|
+
hostAnnotations: z.array(z.object({ label: z.string(), text: z.string() }).strict()).optional(),
|
|
729
744
|
extensions: z.array(z.string()),
|
|
730
745
|
problems: z.array(z.string()).optional(),
|
|
731
746
|
})
|
|
@@ -860,6 +875,12 @@ export const ChannelRuntimeUsageSchema = z
|
|
|
860
875
|
})
|
|
861
876
|
.strict()
|
|
862
877
|
|
|
878
|
+
/** The latest progress a running extension tool reported. */
|
|
879
|
+
export const ChannelRuntimeToolProgressSchema = z
|
|
880
|
+
.object({ text: z.string().min(1).max(200), fraction: z.number().min(0).max(1).optional() })
|
|
881
|
+
.strict()
|
|
882
|
+
export type ChannelRuntimeToolProgress = z.output<typeof ChannelRuntimeToolProgressSchema>
|
|
883
|
+
|
|
863
884
|
const channelRuntimeToolFields = {
|
|
864
885
|
callId: NonEmptyStringSchema,
|
|
865
886
|
name: NonEmptyStringSchema,
|
|
@@ -871,6 +892,8 @@ const channelRuntimeToolFields = {
|
|
|
871
892
|
/** `cancelled`: an extension stopped the message before it was sent. */
|
|
872
893
|
deliveryState: z.enum(['sent', 'partially-sent', 'failed', 'unknown', 'cancelled']).optional(),
|
|
873
894
|
durationMs: z.number().int().nonnegative().optional(),
|
|
895
|
+
/** Set while the tool runs and has reported progress. */
|
|
896
|
+
progress: ChannelRuntimeToolProgressSchema.optional(),
|
|
874
897
|
}
|
|
875
898
|
|
|
876
899
|
export const ChannelRuntimeToolSchema = z
|
|
@@ -1208,6 +1231,20 @@ export const ChannelContextPolicyViewSchema = z
|
|
|
1208
1231
|
|
|
1209
1232
|
export type ChannelContextPolicyView = z.output<typeof ChannelContextPolicyViewSchema>
|
|
1210
1233
|
|
|
1234
|
+
/** One desktop installer of a release; `urls` lists the sources to try in order. */
|
|
1235
|
+
export const ProductDownloadSchema = z
|
|
1236
|
+
.object({
|
|
1237
|
+
platform: z.enum(['mac', 'win', 'linux']),
|
|
1238
|
+
arch: z.enum(['arm64', 'x64']),
|
|
1239
|
+
name: z.string().min(1),
|
|
1240
|
+
size: z.number().int().positive(),
|
|
1241
|
+
sha256: z.string().regex(/^[a-f0-9]{64}$/u),
|
|
1242
|
+
urls: z.array(z.string().url()).min(1),
|
|
1243
|
+
})
|
|
1244
|
+
.strict()
|
|
1245
|
+
|
|
1246
|
+
export type ProductDownload = z.output<typeof ProductDownloadSchema>
|
|
1247
|
+
|
|
1211
1248
|
/** Whether a newer release exists on the build's own channel; development builds are never compared. */
|
|
1212
1249
|
export const ProductUpdateStatusSchema = z
|
|
1213
1250
|
.object({
|
|
@@ -1222,6 +1259,8 @@ export const ProductUpdateStatusSchema = z
|
|
|
1222
1259
|
commit: z.string().optional(),
|
|
1223
1260
|
url: z.string().url(),
|
|
1224
1261
|
publishedAt: z.number().int().nonnegative().optional(),
|
|
1262
|
+
/** Desktop installers of this release; the desktop app downloads its own and checks size and digest. */
|
|
1263
|
+
downloads: z.array(ProductDownloadSchema).optional(),
|
|
1225
1264
|
})
|
|
1226
1265
|
.strict()
|
|
1227
1266
|
.optional(),
|
|
@@ -1282,30 +1321,10 @@ export const SubConversationSettingsSchema = z.object({ retention: SubConversati
|
|
|
1282
1321
|
export const RetrievalModeSchema = z.enum(['keyword', 'builtin'])
|
|
1283
1322
|
export type RetrievalMode = z.output<typeof RetrievalModeSchema>
|
|
1284
1323
|
|
|
1285
|
-
/** Search used by extension indexes (表情包与扩展素材能力 §6.4). */
|
|
1324
|
+
/** Search used by extension indexes (表情包与扩展素材能力 §6.4); the model itself is the `retrieval` add-on. */
|
|
1286
1325
|
export const RetrievalStatusSchema = z
|
|
1287
1326
|
.object({
|
|
1288
1327
|
mode: RetrievalModeSchema,
|
|
1289
|
-
builtin: z
|
|
1290
|
-
.object({
|
|
1291
|
-
model: z.string(),
|
|
1292
|
-
/** False where no inference runtime is published for this system and processor. */
|
|
1293
|
-
supported: z.boolean(),
|
|
1294
|
-
downloadBytes: z.number().int().nonnegative(),
|
|
1295
|
-
install: z.discriminatedUnion('state', [
|
|
1296
|
-
z.object({ state: z.literal('not-installed') }).strict(),
|
|
1297
|
-
z
|
|
1298
|
-
.object({
|
|
1299
|
-
state: z.literal('downloading'),
|
|
1300
|
-
receivedBytes: z.number().int().nonnegative(),
|
|
1301
|
-
totalBytes: z.number().int().nonnegative(),
|
|
1302
|
-
})
|
|
1303
|
-
.strict(),
|
|
1304
|
-
z.object({ state: z.literal('installed') }).strict(),
|
|
1305
|
-
z.object({ state: z.literal('failed'), error: z.string() }).strict(),
|
|
1306
|
-
]),
|
|
1307
|
-
})
|
|
1308
|
-
.strict(),
|
|
1309
1328
|
vectors: z
|
|
1310
1329
|
.object({
|
|
1311
1330
|
documents: z.number().int().nonnegative(),
|
|
@@ -1541,6 +1560,14 @@ export const AttentionItemSchema = z
|
|
|
1541
1560
|
label: z.string().min(1).max(40),
|
|
1542
1561
|
})
|
|
1543
1562
|
.strict(),
|
|
1563
|
+
/**
|
|
1564
|
+
* The shared cause several items come from: a connection (its outage and the deliveries it failed) or an agent
|
|
1565
|
+
* (its failed turns and unusable models). Dismissing by cause keeps it quiet until the cause recovers.
|
|
1566
|
+
*/
|
|
1567
|
+
cause: z
|
|
1568
|
+
.object({ key: z.string().min(1).max(200), label: z.string().min(1).max(120) })
|
|
1569
|
+
.strict()
|
|
1570
|
+
.optional(),
|
|
1544
1571
|
occurredAt: z.number().int().safe().nonnegative(),
|
|
1545
1572
|
})
|
|
1546
1573
|
.strict()
|
|
@@ -1661,42 +1688,128 @@ export const ScheduledTaskSchema = z
|
|
|
1661
1688
|
|
|
1662
1689
|
export type ScheduledTask = z.output<typeof ScheduledTaskSchema>
|
|
1663
1690
|
|
|
1664
|
-
/**
|
|
1665
|
-
export const
|
|
1691
|
+
/** Programs and models NekroNXT installs on request (附加功能); `<data root>/runtimes`, left out of backups. */
|
|
1692
|
+
export const AddonIdSchema = z.enum(['media', 'speech', 'retrieval', 'node', 'github-cli', 'browser'])
|
|
1693
|
+
export type AddonId = z.output<typeof AddonIdSchema>
|
|
1694
|
+
|
|
1695
|
+
/** `extension`: used by extensions; `agent`: used by agents' commands; `host`: used by NekroNXT itself. */
|
|
1696
|
+
export const AddonGroupSchema = z.enum(['extension', 'agent', 'host'])
|
|
1697
|
+
export type AddonGroup = z.output<typeof AddonGroupSchema>
|
|
1698
|
+
|
|
1699
|
+
/**
|
|
1700
|
+
* `installed`: downloaded and ready; `available`: usable without installing (bundled, found on this device, cloud);
|
|
1701
|
+
* `needs-config`: usable once configured (cloud).
|
|
1702
|
+
*/
|
|
1703
|
+
export const AddonStateSchema = z.enum([
|
|
1704
|
+
'not-installed',
|
|
1705
|
+
'installing',
|
|
1706
|
+
'installed',
|
|
1707
|
+
'failed',
|
|
1708
|
+
'unsupported',
|
|
1709
|
+
'available',
|
|
1710
|
+
'needs-config',
|
|
1711
|
+
])
|
|
1712
|
+
export type AddonState = z.output<typeof AddonStateSchema>
|
|
1713
|
+
|
|
1714
|
+
const AddonProgressSchema = z
|
|
1666
1715
|
.object({
|
|
1667
|
-
|
|
1668
|
-
|
|
1716
|
+
receivedBytes: z.number().int().nonnegative(),
|
|
1717
|
+
totalBytes: z.number().int().nonnegative().optional(),
|
|
1718
|
+
})
|
|
1719
|
+
.strict()
|
|
1720
|
+
|
|
1721
|
+
/** One way an add-on can be provided, such as a program found on this device or one NekroNXT downloads. */
|
|
1722
|
+
export const AddonProviderStatusSchema = z
|
|
1723
|
+
.object({
|
|
1724
|
+
id: NonEmptyStringSchema,
|
|
1725
|
+
title: NonEmptyStringSchema,
|
|
1726
|
+
summary: z.string(),
|
|
1727
|
+
state: AddonStateSchema,
|
|
1728
|
+
/** `bundled`: installed with NekroNXT; `system`: found on this device; `downloaded`: fetched by NekroNXT. */
|
|
1729
|
+
source: z.enum(['bundled', 'system', 'downloaded', 'cloud']).optional(),
|
|
1730
|
+
/** The installed version, or the one an install fetches. */
|
|
1669
1731
|
version: z.string().optional(),
|
|
1670
|
-
|
|
1732
|
+
resources: z
|
|
1671
1733
|
.object({
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1734
|
+
/** Approximate for this system and processor. */
|
|
1735
|
+
downloadBytes: z.number().int().nonnegative().optional(),
|
|
1736
|
+
/** Measured from its own folder after install. */
|
|
1737
|
+
installedBytes: z.number().int().nonnegative().optional(),
|
|
1738
|
+
memoryBytes: z.number().int().nonnegative().optional(),
|
|
1739
|
+
/** Short differences worth comparing, such as languages or speed. */
|
|
1740
|
+
notes: z.array(z.string()).default([]),
|
|
1677
1741
|
})
|
|
1678
|
-
.strict()
|
|
1679
|
-
|
|
1742
|
+
.strict(),
|
|
1743
|
+
/** One entry per component that carries its own license. */
|
|
1744
|
+
licenses: z
|
|
1745
|
+
.array(z.object({ component: z.string().optional(), name: NonEmptyStringSchema, url: z.url() }).strict())
|
|
1746
|
+
.default([]),
|
|
1747
|
+
/** Where downloads come from, for display. */
|
|
1748
|
+
sources: z.array(z.string()).default([]),
|
|
1749
|
+
progress: AddonProgressSchema.optional(),
|
|
1750
|
+
error: z.string().optional(),
|
|
1751
|
+
/** Other add-ons it needs to work. */
|
|
1752
|
+
dependsOn: z.array(AddonIdSchema).default([]),
|
|
1753
|
+
installable: z.boolean(),
|
|
1754
|
+
removable: z.boolean(),
|
|
1755
|
+
})
|
|
1756
|
+
.strict()
|
|
1757
|
+
export type AddonProviderStatus = z.output<typeof AddonProviderStatusSchema>
|
|
1758
|
+
|
|
1759
|
+
/** One add-on (a capability) as 设置 → 附加功能 shows it; the registry on the server is its only source. */
|
|
1760
|
+
export const AddonStatusSchema = z
|
|
1761
|
+
.object({
|
|
1762
|
+
id: AddonIdSchema,
|
|
1763
|
+
group: AddonGroupSchema,
|
|
1764
|
+
title: NonEmptyStringSchema,
|
|
1765
|
+
summary: z.string(),
|
|
1766
|
+
/** Who relies on it, as labels people recognise. */
|
|
1767
|
+
usedBy: z.array(z.string()),
|
|
1768
|
+
/** The selected provider's state, or, while none can be used, the one closest to usable. */
|
|
1769
|
+
state: AddonStateSchema,
|
|
1770
|
+
progress: AddonProgressSchema.optional(),
|
|
1771
|
+
/** The provider in use; absent while none can be used. */
|
|
1772
|
+
selected: NonEmptyStringSchema.optional(),
|
|
1773
|
+
/** In declared order; providers that do not exist on this device are left out. */
|
|
1774
|
+
providers: z.array(AddonProviderStatusSchema),
|
|
1680
1775
|
})
|
|
1681
1776
|
.strict()
|
|
1777
|
+
export type AddonStatus = z.output<typeof AddonStatusSchema>
|
|
1682
1778
|
|
|
1683
|
-
|
|
1779
|
+
/** Languages speech recognition can be asked for; `auto` lets the provider tell. */
|
|
1780
|
+
export const SpeechLanguageSchema = z.enum(['auto', 'zh', 'en', 'ja', 'ko', 'yue'])
|
|
1781
|
+
export type SpeechLanguage = z.output<typeof SpeechLanguageSchema>
|
|
1684
1782
|
|
|
1685
|
-
/** The
|
|
1686
|
-
export const
|
|
1687
|
-
|
|
1783
|
+
/** The cloud provider of the `speech` add-on: a provider from 设置 → 模型 and the transcription model it serves. */
|
|
1784
|
+
export const SpeechCloudSettingsSchema = z
|
|
1785
|
+
.object({
|
|
1786
|
+
provider: NonEmptyStringSchema,
|
|
1787
|
+
model: z.string().trim().min(1).max(200),
|
|
1788
|
+
/** Used when a caller does not name a language. */
|
|
1789
|
+
language: SpeechLanguageSchema.optional(),
|
|
1790
|
+
})
|
|
1791
|
+
.strict()
|
|
1792
|
+
export type SpeechCloudSettings = z.output<typeof SpeechCloudSettingsSchema>
|
|
1688
1793
|
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1794
|
+
export const SpeechSettingsSchema = z
|
|
1795
|
+
.object({
|
|
1796
|
+
cloud: SpeechCloudSettingsSchema.nullable(),
|
|
1797
|
+
/** Configured providers with an OpenAI-compatible address, the ones cloud transcription can use. */
|
|
1798
|
+
providers: z.array(z.object({ provider: NonEmptyStringSchema, displayName: z.string() }).strict()),
|
|
1799
|
+
})
|
|
1800
|
+
.strict()
|
|
1801
|
+
export type SpeechSettings = z.output<typeof SpeechSettingsSchema>
|
|
1802
|
+
|
|
1803
|
+
/** Whether a capability that needs an add-on can run now; details live in `addons`. */
|
|
1804
|
+
export const AddonAvailabilitySchema = z.object({ available: z.boolean() }).strict()
|
|
1805
|
+
export type AddonAvailability = z.output<typeof AddonAvailabilitySchema>
|
|
1692
1806
|
|
|
1693
1807
|
/** A platform's own program that linked accounts work through, such as the GitHub CLI. */
|
|
1694
1808
|
export const LinkedAccountPlatformToolSchema = z
|
|
1695
1809
|
.object({
|
|
1696
|
-
/** The
|
|
1810
|
+
/** The add-on it is installed as (`AddonStatus.id`). */
|
|
1697
1811
|
id: z.enum(['github-cli']),
|
|
1698
1812
|
name: z.string(),
|
|
1699
|
-
availability: GithubCliAvailabilitySchema,
|
|
1700
1813
|
})
|
|
1701
1814
|
.strict()
|
|
1702
1815
|
|
|
@@ -1735,7 +1848,7 @@ export const ExtensionRequestSchema = z
|
|
|
1735
1848
|
channelId: ChannelIdSchema.nullable(),
|
|
1736
1849
|
extensionId: ExtensionIdSchema.nullable(),
|
|
1737
1850
|
summary: z.string(),
|
|
1738
|
-
status: z.enum(['pending', 'approved', 'rejected', 'expired', 'completed', 'failed']),
|
|
1851
|
+
status: z.enum(['pending', 'approved', 'rejected', 'expired', 'completed', 'failed', 'superseded', 'withdrawn']),
|
|
1739
1852
|
autonomous: z.boolean(),
|
|
1740
1853
|
resultMessage: z.string().nullable(),
|
|
1741
1854
|
decidedBy: z.string().nullable(),
|
|
@@ -1787,12 +1900,14 @@ export const HostSnapshotSchema = z
|
|
|
1787
1900
|
capabilityAvailability: z
|
|
1788
1901
|
.object({
|
|
1789
1902
|
subagents: z.object({ available: z.boolean() }).strict(),
|
|
1790
|
-
/**
|
|
1791
|
-
codeRun:
|
|
1792
|
-
/**
|
|
1793
|
-
githubCli:
|
|
1794
|
-
/**
|
|
1795
|
-
verificationBrowser:
|
|
1903
|
+
/** The `node` add-on that `run_code` needs. */
|
|
1904
|
+
codeRun: AddonAvailabilitySchema.optional(),
|
|
1905
|
+
/** The `github-cli` add-on that commands use with a GitHub account. */
|
|
1906
|
+
githubCli: AddonAvailabilitySchema.optional(),
|
|
1907
|
+
/** The `browser` add-on that checks candidates when no page is open. */
|
|
1908
|
+
verificationBrowser: AddonAvailabilitySchema.optional(),
|
|
1909
|
+
/** The `speech` add-on that voice message transcription needs. */
|
|
1910
|
+
speechRecognition: AddonAvailabilitySchema.optional(),
|
|
1796
1911
|
/** What this host can confine for commands beyond file writes; optional in older hosts. */
|
|
1797
1912
|
commandConfinement: z.object({ readScope: z.boolean(), networkControl: z.boolean() }).strict().optional(),
|
|
1798
1913
|
webSearch: z
|
|
@@ -2224,6 +2339,7 @@ export const HostSnapshotSchema = z
|
|
|
2224
2339
|
authoringTasks: z.array(AuthoringTaskSummarySchema).default([]),
|
|
2225
2340
|
/** Open sub-conversations, and the most recently ended ones of each channel. */
|
|
2226
2341
|
subConversations: z.array(SubConversationSchema).default([]),
|
|
2342
|
+
addons: z.array(AddonStatusSchema).default([]),
|
|
2227
2343
|
scheduledTasks: z.array(ScheduledTaskSchema).default([]),
|
|
2228
2344
|
/** Extension requests waiting for an administrator. */
|
|
2229
2345
|
extensionRequests: z.array(ExtensionRequestSchema).default([]),
|
|
@@ -2352,6 +2468,8 @@ export const DshPluginCatalogEntrySchema = z
|
|
|
2352
2468
|
installSource: z.enum(['registry', 'tarball', 'imported']).optional(),
|
|
2353
2469
|
/** Published by the DSH maintainers on npm for the DSH release this build runs. */
|
|
2354
2470
|
official: z.boolean().optional(),
|
|
2471
|
+
/** Third-party installed plugins: whether an administrator allowed them to submit images to the model. */
|
|
2472
|
+
imageSubmission: z.boolean().optional(),
|
|
2355
2473
|
installedAt: z.number().int().safe().nonnegative().optional(),
|
|
2356
2474
|
clientUiDetected: z.boolean().optional(),
|
|
2357
2475
|
hostUi: DshNxtHostUiSchema.optional(),
|
|
@@ -2765,6 +2883,22 @@ const agentExtensionParam = z.object({ agentId: AgentIdSchema, extensionId: Exte
|
|
|
2765
2883
|
|
|
2766
2884
|
const PermissionApprovalSchema = z.object({ permissionDigest: z.string().regex(/^[a-f0-9]{64}$/u) }).strict()
|
|
2767
2885
|
|
|
2886
|
+
/**
|
|
2887
|
+
* What keeps a version from being cleaned up: in use, enabled for an agent, released to a community, kept by hand,
|
|
2888
|
+
* the start of a branch, the base of an open revision, needed by 回到上一个版本, or named by a pending request.
|
|
2889
|
+
*/
|
|
2890
|
+
export const ExtensionRevisionProtectionSchema = z.enum([
|
|
2891
|
+
'installed',
|
|
2892
|
+
'active',
|
|
2893
|
+
'released',
|
|
2894
|
+
'kept',
|
|
2895
|
+
'branch',
|
|
2896
|
+
'revising',
|
|
2897
|
+
'undo',
|
|
2898
|
+
'request',
|
|
2899
|
+
])
|
|
2900
|
+
export type ExtensionRevisionProtection = z.output<typeof ExtensionRevisionProtectionSchema>
|
|
2901
|
+
|
|
2768
2902
|
/** One version of one line in the lineage view of an extension family. */
|
|
2769
2903
|
export const ExtensionLineageNodeSchema = z
|
|
2770
2904
|
.object({
|
|
@@ -2776,6 +2910,10 @@ export const ExtensionLineageNodeSchema = z
|
|
|
2776
2910
|
createdAt: z.number().int().nonnegative(),
|
|
2777
2911
|
current: z.boolean(),
|
|
2778
2912
|
releaseNumbers: z.array(z.number().int().positive()),
|
|
2913
|
+
/** Marked by an administrator to keep. */
|
|
2914
|
+
kept: z.boolean(),
|
|
2915
|
+
/** Why the version cannot be cleaned up; absent when it can. */
|
|
2916
|
+
protectedBy: ExtensionRevisionProtectionSchema.optional(),
|
|
2779
2917
|
})
|
|
2780
2918
|
.strict()
|
|
2781
2919
|
|
|
@@ -3788,6 +3926,22 @@ export const HostApiContracts = {
|
|
|
3788
3926
|
response: CompactionSettingsSchema,
|
|
3789
3927
|
error: HostApiErrorSchema,
|
|
3790
3928
|
}),
|
|
3929
|
+
getExtensionDownloadSettings: defineContract({
|
|
3930
|
+
method: 'GET',
|
|
3931
|
+
path: '/api/settings/extension-downloads',
|
|
3932
|
+
params: EmptyParamsSchema,
|
|
3933
|
+
request: NoRequestBodySchema,
|
|
3934
|
+
response: ExtensionDownloadSettingsSchema,
|
|
3935
|
+
error: HostApiErrorSchema,
|
|
3936
|
+
}),
|
|
3937
|
+
updateExtensionDownloadSettings: defineContract({
|
|
3938
|
+
method: 'PUT',
|
|
3939
|
+
path: '/api/settings/extension-downloads',
|
|
3940
|
+
params: EmptyParamsSchema,
|
|
3941
|
+
request: ExtensionDownloadSettingsSchema,
|
|
3942
|
+
response: ExtensionDownloadSettingsSchema,
|
|
3943
|
+
error: HostApiErrorSchema,
|
|
3944
|
+
}),
|
|
3791
3945
|
getModelFallbackSettings: defineContract({
|
|
3792
3946
|
method: 'GET',
|
|
3793
3947
|
path: '/api/settings/model-fallback',
|
|
@@ -3838,74 +3992,55 @@ export const HostApiContracts = {
|
|
|
3838
3992
|
response: RetrievalStatusSchema,
|
|
3839
3993
|
error: HostApiErrorSchema,
|
|
3840
3994
|
}),
|
|
3841
|
-
|
|
3842
|
-
method: '
|
|
3843
|
-
path: '/api/settings/
|
|
3844
|
-
params: EmptyParamsSchema,
|
|
3845
|
-
request: NoRequestBodySchema,
|
|
3846
|
-
response: RetrievalStatusSchema,
|
|
3847
|
-
error: HostApiErrorSchema,
|
|
3848
|
-
}),
|
|
3849
|
-
removeRetrievalModel: defineContract({
|
|
3850
|
-
method: 'DELETE',
|
|
3851
|
-
path: '/api/settings/retrieval/model',
|
|
3995
|
+
getSpeechSettings: defineContract({
|
|
3996
|
+
method: 'GET',
|
|
3997
|
+
path: '/api/settings/speech',
|
|
3852
3998
|
params: EmptyParamsSchema,
|
|
3853
3999
|
request: NoRequestBodySchema,
|
|
3854
|
-
response:
|
|
4000
|
+
response: SpeechSettingsSchema,
|
|
3855
4001
|
error: HostApiErrorSchema,
|
|
3856
4002
|
}),
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
path: '/api/runtimes/code-run-node/download',
|
|
4003
|
+
updateSpeechSettings: defineContract({
|
|
4004
|
+
method: 'PUT',
|
|
4005
|
+
path: '/api/settings/speech',
|
|
3861
4006
|
params: EmptyParamsSchema,
|
|
3862
|
-
request:
|
|
3863
|
-
response:
|
|
4007
|
+
request: z.object({ cloud: SpeechCloudSettingsSchema.nullable() }).strict(),
|
|
4008
|
+
response: SpeechSettingsSchema,
|
|
3864
4009
|
error: HostApiErrorSchema,
|
|
3865
4010
|
}),
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
path: '/api/runtimes/code-run-node',
|
|
4011
|
+
listAddons: defineContract({
|
|
4012
|
+
method: 'GET',
|
|
4013
|
+
path: '/api/addons',
|
|
3870
4014
|
params: EmptyParamsSchema,
|
|
3871
4015
|
request: NoRequestBodySchema,
|
|
3872
|
-
response:
|
|
4016
|
+
response: z.object({ addons: z.array(AddonStatusSchema) }).strict(),
|
|
3873
4017
|
error: HostApiErrorSchema,
|
|
3874
4018
|
}),
|
|
3875
|
-
|
|
4019
|
+
installAddonProvider: defineContract({
|
|
3876
4020
|
invalidatesSnapshot: true,
|
|
3877
4021
|
method: 'POST',
|
|
3878
|
-
path: '/api/
|
|
3879
|
-
params:
|
|
4022
|
+
path: '/api/addons/:id/providers/:provider/install',
|
|
4023
|
+
params: z.object({ id: AddonIdSchema, provider: NonEmptyStringSchema }).strict(),
|
|
3880
4024
|
request: NoRequestBodySchema,
|
|
3881
|
-
response:
|
|
4025
|
+
response: AddonStatusSchema,
|
|
3882
4026
|
error: HostApiErrorSchema,
|
|
3883
4027
|
}),
|
|
3884
|
-
|
|
4028
|
+
removeAddonProvider: defineContract({
|
|
3885
4029
|
invalidatesSnapshot: true,
|
|
3886
4030
|
method: 'DELETE',
|
|
3887
|
-
path: '/api/
|
|
3888
|
-
params:
|
|
3889
|
-
request: NoRequestBodySchema,
|
|
3890
|
-
response: GithubCliAvailabilitySchema,
|
|
3891
|
-
error: HostApiErrorSchema,
|
|
3892
|
-
}),
|
|
3893
|
-
downloadVerificationBrowser: defineContract({
|
|
3894
|
-
invalidatesSnapshot: true,
|
|
3895
|
-
method: 'POST',
|
|
3896
|
-
path: '/api/runtimes/verification-browser/download',
|
|
3897
|
-
params: EmptyParamsSchema,
|
|
4031
|
+
path: '/api/addons/:id/providers/:provider',
|
|
4032
|
+
params: z.object({ id: AddonIdSchema, provider: NonEmptyStringSchema }).strict(),
|
|
3898
4033
|
request: NoRequestBodySchema,
|
|
3899
|
-
response:
|
|
4034
|
+
response: AddonStatusSchema,
|
|
3900
4035
|
error: HostApiErrorSchema,
|
|
3901
4036
|
}),
|
|
3902
|
-
|
|
4037
|
+
selectAddonProvider: defineContract({
|
|
3903
4038
|
invalidatesSnapshot: true,
|
|
3904
|
-
method: '
|
|
3905
|
-
path: '/api/
|
|
3906
|
-
params:
|
|
3907
|
-
request:
|
|
3908
|
-
response:
|
|
4039
|
+
method: 'PUT',
|
|
4040
|
+
path: '/api/addons/:id/selection',
|
|
4041
|
+
params: z.object({ id: AddonIdSchema }).strict(),
|
|
4042
|
+
request: z.object({ provider: NonEmptyStringSchema }).strict(),
|
|
4043
|
+
response: AddonStatusSchema,
|
|
3909
4044
|
error: HostApiErrorSchema,
|
|
3910
4045
|
}),
|
|
3911
4046
|
getLinkedAccounts: defineContract({
|
|
@@ -4294,6 +4429,14 @@ export const HostApiContracts = {
|
|
|
4294
4429
|
response: z.object({ disabled: z.literal(true) }).strict(),
|
|
4295
4430
|
error: HostApiErrorSchema,
|
|
4296
4431
|
}),
|
|
4432
|
+
setDshPluginImageSubmission: defineContract({
|
|
4433
|
+
method: 'PUT',
|
|
4434
|
+
path: '/api/dsh/plugin-installs/:packageId/image-submission',
|
|
4435
|
+
params: dshPluginPackageParam,
|
|
4436
|
+
request: z.object({ allowed: z.boolean() }).strict(),
|
|
4437
|
+
response: z.object({ allowed: z.boolean() }).strict(),
|
|
4438
|
+
error: HostApiErrorSchema,
|
|
4439
|
+
}),
|
|
4297
4440
|
removeDshPluginPackage: defineContract({
|
|
4298
4441
|
invalidatesSnapshot: true,
|
|
4299
4442
|
method: 'DELETE',
|
|
@@ -5508,6 +5651,20 @@ export const HostApiContracts = {
|
|
|
5508
5651
|
response: z.object({ dismissed: z.literal(true), revision: z.string().min(1) }).strict(),
|
|
5509
5652
|
error: HostApiErrorSchema,
|
|
5510
5653
|
}),
|
|
5654
|
+
dismissAttentionBatch: defineContract({
|
|
5655
|
+
method: 'POST',
|
|
5656
|
+
path: '/api/attention/dismiss',
|
|
5657
|
+
params: EmptyParamsSchema,
|
|
5658
|
+
request: z
|
|
5659
|
+
.object({
|
|
5660
|
+
ids: z.array(z.string().min(1).max(200)).max(200),
|
|
5661
|
+
/** Causes to keep quiet until they recover; new items of these causes are not shown meanwhile. */
|
|
5662
|
+
causes: z.array(z.string().min(1).max(200)).max(200),
|
|
5663
|
+
})
|
|
5664
|
+
.strict(),
|
|
5665
|
+
response: z.object({ dismissed: z.literal(true), revision: z.string().min(1) }).strict(),
|
|
5666
|
+
error: HostApiErrorSchema,
|
|
5667
|
+
}),
|
|
5511
5668
|
getChannelPending: defineContract({
|
|
5512
5669
|
method: 'GET',
|
|
5513
5670
|
path: '/api/channels/:channelId/pending',
|
|
@@ -5622,6 +5779,23 @@ export const HostApiContracts = {
|
|
|
5622
5779
|
response: ExtensionLineageSchema,
|
|
5623
5780
|
error: HostApiErrorSchema,
|
|
5624
5781
|
}),
|
|
5782
|
+
setExtensionRevisionKept: defineContract({
|
|
5783
|
+
method: 'POST',
|
|
5784
|
+
path: '/api/extensions/:extensionId/revisions/:revisionId/keep',
|
|
5785
|
+
params: z.object({ extensionId: ExtensionIdSchema, revisionId: ExtensionRevisionIdSchema }).strict(),
|
|
5786
|
+
request: z.object({ kept: z.boolean() }).strict(),
|
|
5787
|
+
response: z.object({ kept: z.boolean() }).strict(),
|
|
5788
|
+
error: HostApiErrorSchema,
|
|
5789
|
+
}),
|
|
5790
|
+
deleteExtensionRevisions: defineContract({
|
|
5791
|
+
invalidatesSnapshot: true,
|
|
5792
|
+
method: 'POST',
|
|
5793
|
+
path: '/api/extensions/:extensionId/revisions/delete',
|
|
5794
|
+
params: extensionParam,
|
|
5795
|
+
request: z.object({ revisionIds: z.array(ExtensionRevisionIdSchema).min(1).max(200) }).strict(),
|
|
5796
|
+
response: z.object({ deleted: z.number().int().nonnegative() }).strict(),
|
|
5797
|
+
error: HostApiErrorSchema,
|
|
5798
|
+
}),
|
|
5625
5799
|
branchExtension: defineContract({
|
|
5626
5800
|
invalidatesSnapshot: true,
|
|
5627
5801
|
timeoutMs: 300_000,
|