@arcadia-eternity/content-sdk 4.3.3 → 4.4.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.
Files changed (121) hide show
  1. package/README.md +3 -3
  2. package/bin/arcadia-content-mcp.mjs +2 -0
  3. package/bin/arcadia-content.mjs +2 -0
  4. package/dist/asset-inspect.d.ts +30 -0
  5. package/dist/asset-inspect.js +84 -0
  6. package/dist/author-api.d.ts +48 -0
  7. package/dist/author-api.js +128 -0
  8. package/dist/author-reference.d.ts +61 -0
  9. package/dist/author-reference.js +130 -0
  10. package/dist/build-content.d.ts +2 -0
  11. package/dist/build-content.js +29 -0
  12. package/dist/cli.d.ts +2 -0
  13. package/dist/cli.js +81 -0
  14. package/dist/content-query.d.ts +30 -0
  15. package/dist/content-query.js +326 -0
  16. package/dist/content-workspace.d.ts +204 -0
  17. package/dist/content-workspace.js +981 -0
  18. package/dist/debug-environments.d.ts +96 -0
  19. package/dist/debug-environments.js +135 -0
  20. package/dist/demo.d.ts +1 -0
  21. package/dist/demo.js +18 -0
  22. package/dist/effect-build.d.ts +3 -0
  23. package/dist/effect-build.js +44 -0
  24. package/dist/environment-rules.d.ts +7 -0
  25. package/dist/environment-rules.js +94 -0
  26. package/dist/environment.d.ts +48 -0
  27. package/dist/environment.js +184 -0
  28. package/dist/job-journal.d.ts +19 -0
  29. package/dist/job-journal.js +110 -0
  30. package/dist/jobs.d.ts +103 -0
  31. package/dist/jobs.js +626 -0
  32. package/dist/lib/content.d.ts +24 -0
  33. package/dist/lib/content.js +106 -0
  34. package/dist/lib/presentation.d.ts +26 -0
  35. package/dist/lib/presentation.js +252 -0
  36. package/dist/lib/yaml-sharing.d.ts +16 -0
  37. package/dist/lib/yaml-sharing.js +130 -0
  38. package/dist/managed-projects.d.ts +37 -0
  39. package/dist/managed-projects.js +305 -0
  40. package/dist/managed-sources.d.ts +28 -0
  41. package/dist/managed-sources.js +541 -0
  42. package/dist/mcp-contracts.d.ts +420 -0
  43. package/dist/mcp-contracts.js +146 -0
  44. package/dist/mcp.d.ts +2 -0
  45. package/dist/mcp.js +228 -0
  46. package/dist/module-path.d.ts +1 -0
  47. package/dist/module-path.js +8 -0
  48. package/dist/pack-project.d.ts +10 -0
  49. package/dist/pack-project.js +178 -0
  50. package/dist/preview-control.d.ts +17 -0
  51. package/dist/preview-control.js +273 -0
  52. package/dist/preview.d.ts +24 -0
  53. package/dist/preview.js +332 -0
  54. package/dist/project-teams.d.ts +51 -0
  55. package/dist/project-teams.js +106 -0
  56. package/dist/project.d.ts +18 -0
  57. package/dist/project.js +146 -0
  58. package/dist/rename.d.ts +2 -0
  59. package/dist/rename.js +128 -0
  60. package/dist/setup.d.ts +2 -0
  61. package/dist/setup.js +117 -0
  62. package/dist/source-lock.d.ts +9 -0
  63. package/dist/source-lock.js +117 -0
  64. package/dist/template/README.md +2 -0
  65. package/dist/template/docs/presentation.md +3 -3
  66. package/dist/template/package.json +3 -7
  67. package/dist/template/test/pack.test.mjs +10 -7
  68. package/dist/testing.d.ts +58 -0
  69. package/dist/testing.js +205 -0
  70. package/dist/types.d.ts +5 -0
  71. package/dist/types.js +14 -0
  72. package/dist/workbench-context.d.ts +10 -0
  73. package/dist/workbench-context.js +27 -0
  74. package/dist/workspace-cli.d.ts +1 -0
  75. package/dist/workspace-cli.js +66 -0
  76. package/dist/workspace-materials.d.ts +19 -0
  77. package/dist/workspace-materials.js +165 -0
  78. package/dist/workspace.d.ts +190 -0
  79. package/dist/workspace.js +726 -0
  80. package/package.json +34 -27
  81. package/dist/asset-inspect.mjs +0 -67
  82. package/dist/author-api.mjs +0 -112
  83. package/dist/author-reference.mjs +0 -121
  84. package/dist/build-content.mjs +0 -30
  85. package/dist/cli.mjs +0 -76
  86. package/dist/content-query.mjs +0 -283
  87. package/dist/content-workspace.d.mts +0 -161
  88. package/dist/content-workspace.mjs +0 -936
  89. package/dist/debug-environments.mjs +0 -154
  90. package/dist/demo.mjs +0 -22
  91. package/dist/effect-build.d.mts +0 -2
  92. package/dist/effect-build.mjs +0 -46
  93. package/dist/environment-rules.d.mts +0 -5
  94. package/dist/environment-rules.mjs +0 -92
  95. package/dist/environment.mjs +0 -183
  96. package/dist/job-journal.mjs +0 -94
  97. package/dist/jobs.mjs +0 -579
  98. package/dist/lib/content.mjs +0 -95
  99. package/dist/lib/presentation.mjs +0 -240
  100. package/dist/lib/yaml-sharing.mjs +0 -101
  101. package/dist/managed-projects.d.mts +0 -35
  102. package/dist/managed-projects.mjs +0 -303
  103. package/dist/managed-sources.d.mts +0 -19
  104. package/dist/managed-sources.mjs +0 -503
  105. package/dist/mcp-contracts.mjs +0 -153
  106. package/dist/mcp.mjs +0 -369
  107. package/dist/pack-project.mjs +0 -157
  108. package/dist/preview-control.mjs +0 -260
  109. package/dist/preview.mjs +0 -313
  110. package/dist/project-teams.mjs +0 -98
  111. package/dist/project.mjs +0 -140
  112. package/dist/rename.mjs +0 -112
  113. package/dist/setup.mjs +0 -134
  114. package/dist/source-lock.mjs +0 -103
  115. package/dist/testing.mjs +0 -204
  116. package/dist/workbench-context.mjs +0 -18
  117. package/dist/workspace-cli.mjs +0 -60
  118. package/dist/workspace-materials.mjs +0 -153
  119. package/dist/workspace.mjs +0 -684
  120. /package/dist/{index.d.mts → index.d.ts} +0 -0
  121. /package/dist/{index.mjs → index.js} +0 -0
@@ -1,283 +0,0 @@
1
- import { lstat, readFile, realpath } from 'node:fs/promises'
2
- import { dirname, join } from 'node:path'
3
- import { AuthorWorkspace, WorkspaceError, diagnostic } from './workspace.mjs'
4
- import { recordSharing } from './lib/yaml-sharing.mjs'
5
-
6
- const kinds = ['content', 'presentations', 'resources', 'assets', 'files', 'locales', 'diagnostics']
7
- const contentKinds = ['species', 'skills', 'marks', 'behaviors', 'presentations', 'resources']
8
- const localeKinds = {
9
- species: 'species',
10
- skill: 'skills',
11
- mark: 'marks',
12
- mark_ability: 'marks',
13
- mark_emblem: 'marks',
14
- mark_global: 'marks',
15
- }
16
- const compare = (a, b) => (a < b ? -1 : a > b ? 1 : 0)
17
- const invalid = message => {
18
- throw new WorkspaceError('QUERY_INVALID', message)
19
- }
20
- const pageBytes = 2 * 1024 * 1024
21
- const packageLimit = 256
22
- const packageNamePattern = /^(?:@[a-z0-9_.-]+\/)?[a-z0-9][a-z0-9_.-]*$/i
23
-
24
- function options(input) {
25
- const value = { kind: 'content', scope: 'project', detail: 'summary', search: '', offset: 0, limit: 50, ...input }
26
- if (!kinds.includes(value.kind)) invalid('查询类型无效')
27
- if (!['project', 'dependencies', 'all'].includes(value.scope)) invalid('查询范围无效')
28
- if (!['summary', 'full'].includes(value.detail)) invalid('查询详情级别无效')
29
- if (value.contentKind !== undefined && !contentKinds.includes(value.contentKind)) invalid('内容类型无效')
30
- for (const key of ['search', 'id', 'locale', 'namespace', 'packageName'])
31
- if (value[key] !== undefined && (typeof value[key] !== 'string' || value[key].length > 200))
32
- invalid(`${key} 需要不超过 200 字符的文本`)
33
- if (!Number.isInteger(value.offset) || value.offset < 0) invalid('offset 需要非负整数')
34
- if (!Number.isInteger(value.limit) || value.limit < 1 || value.limit > 100) invalid('limit 需要 1–100 的整数')
35
- return value
36
- }
37
-
38
- function runtimeDependencies(manifest) {
39
- const entries = new Map()
40
- for (const field of ['dependencies', 'peerDependencies', 'optionalDependencies'])
41
- for (const name of Object.keys(manifest[field] ?? {}).sort(compare)) {
42
- if (!packageNamePattern.test(name)) throw new WorkspaceError('DEPENDENCY_INVALID', '依赖包名无效', 'package.json')
43
- entries.set(name, field === 'optionalDependencies' || manifest.peerDependenciesMeta?.[name]?.optional === true)
44
- }
45
- return [...entries].sort(([a], [b]) => compare(a, b))
46
- }
47
-
48
- // Resolve declared packages without executing package exports or consulting global module paths.
49
- async function installedPackage(from, name) {
50
- for (let directory = from; ; directory = dirname(directory)) {
51
- const candidate = join(directory, 'node_modules', name)
52
- try {
53
- const root = await realpath(candidate)
54
- const file = join(root, 'package.json')
55
- const info = await lstat(file)
56
- if (!info.isFile() || info.size > pageBytes)
57
- throw new WorkspaceError('DEPENDENCY_INVALID', '依赖清单需要不超过 2 MiB 的普通文件', file)
58
- return { root, manifest: JSON.parse(await readFile(file, 'utf8')) }
59
- } catch (error) {
60
- if (error.code !== 'ENOENT') throw error
61
- }
62
- if (dirname(directory) === directory) throw new WorkspaceError('DEPENDENCY_MISSING', `未安装声明的依赖:${name}`)
63
- }
64
- }
65
-
66
- function provenance(snapshot, scope, manifest) {
67
- return {
68
- namespace: snapshot.project.namespace,
69
- packageName: manifest.name,
70
- packageVersion: manifest.version,
71
- projectId: snapshot.project.projectId,
72
- scope,
73
- readOnly: scope === 'dependencies' || !snapshot.capabilities.sourceEditing,
74
- }
75
- }
76
-
77
- async function catalogs(workspace, scope) {
78
- const manifest = JSON.parse((await workspace.read('package.json')).text)
79
- const project = await workspace.snapshot()
80
- const own = { snapshot: project, owner: provenance(project, 'project', manifest) }
81
- const result = scope === 'dependencies' ? [] : [own]
82
- const diagnostics = []
83
- if (scope === 'project') return { catalogs: result, diagnostics }
84
- const queue = runtimeDependencies(manifest).map(([name, optional]) => ({ from: workspace.root, name, optional }))
85
- const visited = new Set([workspace.root])
86
- const identities = new Map([[project.project.namespace, manifest.name]])
87
- let inspected = 0
88
- while (queue.length) {
89
- if (++inspected > packageLimit) {
90
- diagnostics.push({
91
- code: 'DEPENDENCY_QUERY_LIMIT',
92
- severity: 'warning',
93
- message: '依赖查询超过 256 项,请缩小依赖树;结果不完整',
94
- })
95
- break
96
- }
97
- const { from, name, optional } = queue.shift()
98
- let dependency
99
- try {
100
- const { root, manifest: metadata } = await installedPackage(from, name)
101
- if (visited.has(root)) continue
102
- visited.add(root)
103
- if (metadata.arcadia || metadata.name === '@arcadia-eternity/data-pack-base') {
104
- dependency = await AuthorWorkspace.open(root, { watch: false, readOnly: true, published: !!metadata.arcadia })
105
- const snapshot = await dependency.snapshot()
106
- const owner = provenance(snapshot, 'dependencies', metadata)
107
- const previous = identities.get(owner.namespace)
108
- if (previous !== undefined)
109
- diagnostics.push({
110
- ...owner,
111
- code: 'NAMESPACE_CONFLICT',
112
- severity: 'error',
113
- message: `命名空间 ${owner.namespace} 同时用于 ${previous} 和 ${metadata.name}`,
114
- })
115
- identities.set(owner.namespace, metadata.name)
116
- result.push({ snapshot, owner })
117
- // Match the loader's visible content dependencies: stop at each content package.
118
- } else {
119
- queue.push(
120
- ...runtimeDependencies(metadata).map(([child, absentAllowed]) => ({
121
- from: root,
122
- name: child,
123
- optional: absentAllowed,
124
- })),
125
- )
126
- }
127
- } catch (error) {
128
- if (!(optional && error.code === 'DEPENDENCY_MISSING'))
129
- diagnostics.push({ ...diagnostic(error), packageName: name, scope: 'dependencies', readOnly: true })
130
- } finally {
131
- await dependency?.close()
132
- }
133
- }
134
- return { catalogs: result, diagnostics }
135
- }
136
-
137
- function translations(snapshot, row, locale) {
138
- return snapshot.localeSources
139
- .flatMap(source =>
140
- localeKinds[source.namespace] === row.kind &&
141
- (!locale || source.language === locale) &&
142
- source.entries[row.record.id]
143
- ? [{ locale: source.language, localeNamespace: source.namespace, ...source.entries[row.record.id] }]
144
- : [],
145
- )
146
- .sort((a, b) => compare(a.locale, b.locale) || compare(a.localeNamespace, b.localeNamespace))
147
- }
148
-
149
- function nameFields(localizations, requested, fallback) {
150
- const locale = requested ?? localizations.find(entry => entry.locale === 'zh-CN')?.locale ?? localizations[0]?.locale
151
- const names = [
152
- ...new Set(
153
- localizations
154
- .filter(entry => entry.locale === locale)
155
- .map(entry => entry.name)
156
- .filter(Boolean),
157
- ),
158
- ]
159
- return {
160
- ...(locale ? { locale } : {}),
161
- ...(names.length === 1
162
- ? { name: names[0].slice(0, 200) }
163
- : !names.length && typeof fallback === 'string'
164
- ? { name: fallback.slice(0, 200) }
165
- : {}),
166
- ...(names.length > 1 ? { ambiguousName: true } : {}),
167
- }
168
- }
169
-
170
- function rowsFor({ snapshot, owner }, query) {
171
- const identify = (id, kind, source = {}) => ({
172
- ...owner,
173
- kind,
174
- id,
175
- qualifiedId: `${owner.namespace}:${id}`,
176
- ...source,
177
- })
178
- if (query.kind === 'locales')
179
- return snapshot.localeSources.flatMap(source =>
180
- Object.entries(source.entries).map(([id, record]) => {
181
- const row = identify(id, 'locales', {
182
- contentKind: localeKinds[source.namespace],
183
- file: source.file,
184
- version: source.version,
185
- locale: source.language,
186
- localeNamespace: source.namespace,
187
- ...(source.locations?.[id] ?? {}),
188
- })
189
- return {
190
- row,
191
- text: JSON.stringify({ ...row, ...record }),
192
- full: { ...row, record, sharedFields: recordSharing(source.sharedFields, id) },
193
- summary: {
194
- ...row,
195
- ...(record.name ? { name: record.name.slice(0, 200) } : {}),
196
- ...(record.description ? { descriptionPreview: record.description.slice(0, 240) } : {}),
197
- },
198
- }
199
- }),
200
- )
201
- if (query.kind === 'files' || query.kind === 'diagnostics')
202
- return (query.kind === 'files' ? snapshot.files : snapshot.diagnostics).map(entry => {
203
- const row = { ...owner, kind: query.kind, ...entry }
204
- return { row, text: JSON.stringify(row), full: row, summary: row }
205
- })
206
- if (query.kind === 'assets')
207
- return snapshot.assets.map(asset => {
208
- const definition = snapshot.records.find(
209
- row => row.kind === 'resources' && row.record.id === asset.id && row.file === asset.definition,
210
- )
211
- const { kind: resourceKind, ...metadata } = asset
212
- const row = identify(asset.id, 'assets', {
213
- contentKind: 'resources',
214
- resourceKind,
215
- ...metadata,
216
- ...(definition ? { version: definition.version, index: definition.index } : {}),
217
- })
218
- const { references, ...summary } = row
219
- return { row, text: JSON.stringify(row), full: row, summary: { ...summary, referenceCount: references.length } }
220
- })
221
- return snapshot.records
222
- .filter(row => !['presentations', 'resources'].includes(query.kind) || row.kind === query.kind)
223
- .map(source => {
224
- const localizations = translations(snapshot, source, query.locale)
225
- const row = identify(source.record.id, source.kind, {
226
- contentKind: source.kind,
227
- file: source.file,
228
- version: source.version,
229
- index: source.index,
230
- ...(source.line ? { line: source.line, column: source.column } : {}),
231
- ...nameFields(localizations, query.locale, source.record.name),
232
- })
233
- return {
234
- row,
235
- text: JSON.stringify({ ...row, record: source.record, localizations }),
236
- summary: row,
237
- full: { ...row, record: source.record, sharedFields: source.sharedFields, localizations },
238
- }
239
- })
240
- }
241
-
242
- /** Read-only discovery over disk data. Never loads effects or changes workbench selection/drafts. */
243
- export async function queryContent(workspace, input = {}) {
244
- const query = options(input)
245
- const { catalogs: sources, diagnostics } = await catalogs(workspace, query.scope)
246
- const needle = query.search.toLowerCase()
247
- const rows = sources
248
- .flatMap(source => rowsFor(source, query))
249
- .filter(
250
- ({ row, text }) =>
251
- (query.id === undefined || row.id === query.id || row.qualifiedId === query.id) &&
252
- (query.contentKind === undefined || row.contentKind === query.contentKind) &&
253
- (query.namespace === undefined || row.namespace === query.namespace) &&
254
- (query.packageName === undefined || row.packageName === query.packageName) &&
255
- (query.kind !== 'locales' || query.locale === undefined || row.locale === query.locale) &&
256
- text.toLowerCase().includes(needle),
257
- )
258
- if (
259
- query.id !== undefined &&
260
- ['content', 'presentations', 'resources', 'assets'].includes(query.kind) &&
261
- rows.length > 1
262
- )
263
- diagnostics.push({
264
- code: 'CONTENT_AMBIGUOUS',
265
- severity: 'warning',
266
- message: '此 ID 对应多个对象;请使用 contentKind、namespace 或 packageName 明确目标',
267
- })
268
- const items = []
269
- let bytes = 0
270
- for (const candidate of rows.slice(query.offset, query.offset + query.limit)) {
271
- const item = candidate[query.detail === 'full' ? 'full' : 'summary']
272
- const size = Buffer.byteLength(JSON.stringify(item))
273
- if (bytes + size > pageBytes) {
274
- if (!items.length)
275
- throw new WorkspaceError('QUERY_ITEM_TOO_LARGE', '此详情超过 2 MiB,请查询摘要并读取对应源码文件')
276
- break
277
- }
278
- bytes += size
279
- items.push(item)
280
- }
281
- const next = query.offset + items.length
282
- return { total: rows.length, offset: query.offset, nextOffset: next < rows.length ? next : null, items, diagnostics }
283
- }
@@ -1,161 +0,0 @@
1
- export interface EnvironmentRules {
2
- schemaVersion: 1
3
- tier?: string
4
- allow?: { species?: string[]; skills?: string[]; marks?: string[] }
5
- deny?: { species?: string[]; skills?: string[]; marks?: string[] }
6
- team?: { minSize?: number; maxSize?: number; uniqueSpecies?: boolean }
7
- }
8
- export interface EnvironmentDocument {
9
- schemaVersion: 2
10
- id: string
11
- name: string
12
- packages: Record<string, string>
13
- sources: string[]
14
- disabled?: { packages: Record<string, string>; sources: string[] }
15
- rules: EnvironmentRules
16
- requires: { engine?: string; sdk?: string; capabilities?: string[] }
17
- }
18
- export interface EnvironmentDraft {
19
- document: EnvironmentDocument
20
- revision: string
21
- }
22
- export interface EnvironmentVersion {
23
- format: 'arcadia.environment-version/1'
24
- versionId: string
25
- workspaceId: string
26
- environmentId: string
27
- document: EnvironmentDocument
28
- draftRevision: string
29
- contentRevision: string
30
- members?: {
31
- name: string
32
- version: string
33
- projectId: string
34
- namespace: string
35
- direct: boolean
36
- dependencies: string[]
37
- requiredBy: string[]
38
- }[]
39
- packages: unknown[]
40
- createdAt: number
41
- adopted: boolean
42
- materialDirectory: string
43
- directory: string
44
- status: 'ready'
45
- }
46
- export interface UnavailableVersion {
47
- versionId: string
48
- workspaceId: string
49
- environmentId?: string
50
- status: 'unavailable'
51
- reason: string
52
- }
53
- export interface PrepareVersionInput {
54
- onProgress?: (progress: { stage: string; completed?: number; total?: number }) => void | Promise<void>
55
- environmentId: string
56
- expectedRevision: string
57
- projectDirectory?: string
58
- directory?: string
59
- signal?: AbortSignal
60
- beforeCommit?: () => Promise<void>
61
- }
62
- export type StaticPreparer = (input: {
63
- directory: string
64
- draft: EnvironmentDocument
65
- signal?: AbortSignal
66
- }) => Promise<{
67
- contentRevision: string
68
- packages?: unknown[]
69
- }>
70
- export interface ContentWorkspaceOptions {
71
- maxBytes?: number
72
- maxFiles?: number
73
- stagingRetentionMs?: number
74
- resolveProject?: (environmentId: string) => string | undefined | Promise<string | undefined>
75
- acquireMaterials?: (directory: string, versionId: string) => Promise<() => void | Promise<void>>
76
- retentions?: {
77
- list(versionId: string): Promise<Record<string, unknown>[]>
78
- put?(versionId: string, retentionId: string): Promise<void>
79
- remove?(retentionId: string): Promise<void>
80
- }
81
- }
82
- export interface EnvironmentExport {
83
- format: 'arcadia.environment-export/1'
84
- document: EnvironmentDocument
85
- contentRevision: string
86
- files: { path: string; data: string }[]
87
- }
88
- export interface WorkspaceSnapshot {
89
- format: 'arcadia.workspace-snapshot/1'
90
- workspaceId: string
91
- drafts: EnvironmentDraft[]
92
- versions: {
93
- version: Pick<
94
- EnvironmentVersion,
95
- 'versionId' | 'environmentId' | 'document' | 'draftRevision' | 'contentRevision' | 'packages' | 'createdAt'
96
- >
97
- files: { path: string; data: string }[]
98
- }[]
99
- }
100
- export interface WorkspaceSnapshotStamp {
101
- workspaceId: string
102
- bootId: string
103
- generation: number
104
- }
105
- export interface WorkspaceSnapshotCapture {
106
- snapshot: WorkspaceSnapshot
107
- stamp: WorkspaceSnapshotStamp
108
- }
109
- export class ContentWorkspace {
110
- readonly root: string
111
- readonly workspaceId: string
112
- readonly bootId: string
113
- static open(directory: string, options?: ContentWorkspaceOptions): Promise<ContentWorkspace>
114
- listDrafts(): Promise<EnvironmentDraft[]>
115
- getDraft(environmentId: string): Promise<EnvironmentDraft>
116
- saveDraft(input: { document: unknown; expectedRevision: string | null }): Promise<EnvironmentDraft>
117
- deleteDraft(input: { environmentId: string; expectedRevision: string }): Promise<void>
118
- prepareVersion(input: PrepareVersionInput, preparer: StaticPreparer): Promise<EnvironmentVersion>
119
- adoptVersion(input: PrepareVersionInput, preparer: StaticPreparer): Promise<EnvironmentVersion>
120
- getVersion(versionId: string): Promise<EnvironmentVersion>
121
- listVersions(environmentId?: string): Promise<(EnvironmentVersion | UnavailableVersion)[]>
122
- acquire(versionId: string, owner?: string): Promise<EnvironmentVersion & { release(): Promise<void> }>
123
- retain(versionId: string, retentionId: string): Promise<void>
124
- releaseRetention(retentionId: string): Promise<void>
125
- references(versionId: string): Promise<Record<string, unknown>[]>
126
- deleteVersion(versionId: string): Promise<void>
127
- exportVersion(versionId: string): Promise<EnvironmentExport>
128
- exportSnapshot(): Promise<WorkspaceSnapshot>
129
- captureSnapshot(): Promise<WorkspaceSnapshotCapture>
130
- isSnapshotCurrent(stamp: WorkspaceSnapshotStamp): Promise<boolean>
131
- restoreSnapshot(
132
- snapshot: WorkspaceSnapshot,
133
- input: { mode: 'restore' | 'clone' },
134
- preparer: StaticPreparer,
135
- ): Promise<{ workspaceId: string; versionIds: Record<string, string> }>
136
- importVersion(
137
- bundle: EnvironmentExport,
138
- input: {
139
- environmentId?: string
140
- expectedRevision?: string | null
141
- signal?: AbortSignal
142
- beforeCommit?: () => Promise<void>
143
- importId?: string
144
- },
145
- preparer: StaticPreparer,
146
- ): Promise<EnvironmentVersion>
147
- recoverImport(importId: string): Promise<EnvironmentVersion>
148
- forgetImport(importId: string, input?: { discard?: boolean }): Promise<void>
149
- reconcile(): Promise<{
150
- workspaceId: string
151
- versions: (EnvironmentVersion | UnavailableVersion)[]
152
- abandoned: string[]
153
- }>
154
- close(input?: { force?: boolean }): Promise<void>
155
- cleanupStaging(): Promise<string[]>
156
- }
157
-
158
- export function setEnvironmentPackageEnabled(
159
- workspace: Pick<ContentWorkspace, 'listDrafts' | 'listVersions' | 'saveDraft'>,
160
- input: { environmentId: string; expectedRevision: string; name: string; enabled: boolean; cascade?: boolean },
161
- ): Promise<EnvironmentDraft>