@lincyaw/workspace 1.0.0-rc.42 → 1.0.0-rc.43
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/package.json +5 -5
- package/src/node/serve.ts +5 -3
- package/src/node/speech-settings.ts +6 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lincyaw/workspace",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.43",
|
|
4
4
|
"description": "Presmium's workspace service (presmium serve): documents, their history, reviews and the workspace site",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
"mime-types": "3.0.2",
|
|
35
35
|
"playwright-chromium": "1.64.1",
|
|
36
36
|
"yaml": "^2.9.1",
|
|
37
|
-
"@lincyaw/compiler": "1.0.0-rc.
|
|
38
|
-
"@lincyaw/kernel": "1.0.0-rc.
|
|
39
|
-
"@lincyaw/server": "1.0.0-rc.
|
|
37
|
+
"@lincyaw/compiler": "1.0.0-rc.43",
|
|
38
|
+
"@lincyaw/kernel": "1.0.0-rc.43",
|
|
39
|
+
"@lincyaw/server": "1.0.0-rc.43"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/mime-types": "^3.0.1",
|
|
43
|
-
"@lincyaw/mcp": "1.0.0-rc.
|
|
43
|
+
"@lincyaw/mcp": "1.0.0-rc.43"
|
|
44
44
|
}
|
|
45
45
|
}
|
package/src/node/serve.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { join, relative } from 'node:path'
|
|
|
9
9
|
import { Compiler, operatorDir as resolveOperatorDir, pluginLogger, runBlock, workspacePlugins } from '@lincyaw/compiler'
|
|
10
10
|
import type { Compilation, CompilerOptions } from '@lincyaw/compiler'
|
|
11
11
|
import { CHANGE_REVIEW, DOCUMENT_FILES, DOCUMENT_LOCKS, DOCUMENT_VOICE_TASKS, errorMessage, PreviewPreparing, PRODUCTION_AUDIO_AUTHORING, REVISIONS, SPEECH, VOICEOVER, VOICEOVER_EXECUTION } from '@lincyaw/kernel'
|
|
12
|
-
import { irRevision,
|
|
12
|
+
import { irRevision, OperatorSpeechSettings, serveStateDir } from '@lincyaw/kernel/node'
|
|
13
13
|
import { speechSettingsRoute } from './speech-settings.ts'
|
|
14
14
|
import type { ApprovalKind, CanonicalSource, ChangeReviewService, Finding, IRDocument, Logger, ProductionAudioAuthoring, ServiceToken, SiteSpec, SpeechService } from '@lincyaw/kernel'
|
|
15
15
|
import { serverConfigKey, servedDocument, startServer } from '@lincyaw/server'
|
|
@@ -91,6 +91,7 @@ export async function serveWorkspace(options: ServeOptions): Promise<WorkspaceSe
|
|
|
91
91
|
if (env.PRESMIUM_AGENT_CANDIDATE === '1') config.settings['presmium.assistant'] = { ...config.settings['presmium.assistant'], review: 'auto' }
|
|
92
92
|
const { root } = config
|
|
93
93
|
const operatorDirectory = resolveOperatorDir(root, options.operatorDir ?? env.PRESMIUM_OPERATOR_DIR)
|
|
94
|
+
const speechSettings = new OperatorSpeechSettings(operatorDirectory, name => env[name])
|
|
94
95
|
const stateDir = makeStateDir(root, env)
|
|
95
96
|
const docs = () => listDocuments(config)
|
|
96
97
|
const compileSessions = new Map<string, CompileSession>()
|
|
@@ -170,7 +171,7 @@ export async function serveWorkspace(options: ServeOptions): Promise<WorkspaceSe
|
|
|
170
171
|
services: [...serverServices, ...workspaceServices],
|
|
171
172
|
bundled: options.bundled,
|
|
172
173
|
operatorDir: operatorDirectory,
|
|
173
|
-
secret:
|
|
174
|
+
secret: speechSettings.secret,
|
|
174
175
|
})
|
|
175
176
|
|
|
176
177
|
// Coalesce only in-flight discovery. A later read reassembles actual services and problems;
|
|
@@ -270,6 +271,7 @@ export async function serveWorkspace(options: ServeOptions): Promise<WorkspaceSe
|
|
|
270
271
|
get audioAuthoring() { return audioAuthoring?.service },
|
|
271
272
|
get imageAuthoring() { return imageAuthoring?.service },
|
|
272
273
|
get voiceAuthoring() { return voiceAuthoring?.service },
|
|
274
|
+
speechSettings,
|
|
273
275
|
get transcriptions() { return transcriptions },
|
|
274
276
|
get transcriptionAdoption() { return transcriptionAdoption?.service },
|
|
275
277
|
get capture() { return capture?.service },
|
|
@@ -391,7 +393,7 @@ export async function serveWorkspace(options: ServeOptions): Promise<WorkspaceSe
|
|
|
391
393
|
audioAuthoring = createDocumentAudioAuthoring({ root, editor, revisions: history?.revisions, services: authoringServices, reviewRequired: config.settings['presmium.assistant']?.review === 'required' })
|
|
392
394
|
imageAuthoring = createDocumentImageAuthoring({ root, editor, revisions: history?.revisions, reviewRequired: config.settings['presmium.assistant']?.review === 'required' })
|
|
393
395
|
const routeOptions = {
|
|
394
|
-
speechSettings: speechSettingsRoute(
|
|
396
|
+
speechSettings: speechSettingsRoute(speechSettings),
|
|
395
397
|
config,
|
|
396
398
|
editor,
|
|
397
399
|
documentEditor,
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Route,
|
|
3
|
-
import {
|
|
1
|
+
import { jsonResponse, problemResponse } from '@lincyaw/kernel'
|
|
2
|
+
import type { Route, SpeechSettings } from '@lincyaw/kernel'
|
|
3
|
+
import { SpeechSettingsError, validateSpeechSettingsChange } from '@lincyaw/kernel/node'
|
|
4
4
|
|
|
5
5
|
/** Global operator route: works before opening a document and never returns credential values. */
|
|
6
|
-
export function speechSettingsRoute(
|
|
7
|
-
const settings = new OperatorSpeechSettings(directory, fallback)
|
|
6
|
+
export function speechSettingsRoute(settings: SpeechSettings): Route {
|
|
8
7
|
return { role: 'owner', maxBody: 16384, handle: async request => {
|
|
9
8
|
try {
|
|
10
9
|
if (request.method === 'GET') return jsonResponse(settings.read(), 200, { 'cache-control': 'no-store' })
|
|
11
10
|
if (request.method !== 'POST') return problemResponse(405, 'GET or POST')
|
|
12
11
|
const body: unknown = await request.json().catch(() => undefined)
|
|
13
|
-
if (!
|
|
14
|
-
|
|
15
|
-
return jsonResponse(await settings.change(body as unknown as SpeechSettingsChange), 200, { 'cache-control': 'no-store' })
|
|
12
|
+
if (!validateSpeechSettingsChange(body)) return problemResponse(400, 'speech-settings-invalid')
|
|
13
|
+
return jsonResponse(await settings.change(body), 200, { 'cache-control': 'no-store' })
|
|
16
14
|
} catch (error) {
|
|
17
15
|
const code = error instanceof SpeechSettingsError ? error.code : 'speech-settings-unavailable'
|
|
18
16
|
return problemResponse(code === 'speech-settings-invalid' ? 400 : code === 'speech-settings-conflict' || code === 'speech-settings-busy' ? 409 : 503, code)
|