@nativestudio/cli 0.3.0-rc.21 → 0.3.0-rc.27
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/COMPATIBILITY.json +11 -11
- package/components/runtime.json +7 -7
- package/components/runtime.tgz +0 -0
- package/dist/_chunks/backup-retirement-5OTAYZYN.js +1 -0
- package/dist/_chunks/caller-DPHTMOBN.js +1 -0
- package/dist/_chunks/{chunk-MZWEFYHE.js → chunk-24ZFLWWU.js} +1 -1
- package/dist/_chunks/chunk-25WUWVDK.js +1 -0
- package/dist/_chunks/{chunk-QGK6G6YS.js → chunk-4UQRT3ZH.js} +1 -1
- package/dist/_chunks/chunk-6MYLFBLH.js +1 -0
- package/dist/_chunks/chunk-6YVGVNEH.js +1 -0
- package/dist/_chunks/{chunk-7IVAYDU3.js → chunk-7TXIHIZ5.js} +1 -1
- package/dist/_chunks/chunk-A3MJERGH.js +1 -0
- package/dist/_chunks/{chunk-DLW42PJ6.js → chunk-AZQLZA47.js} +1 -1
- package/dist/_chunks/{chunk-ZYXHPTT2.js → chunk-BNGPPUA3.js} +1 -1
- package/dist/_chunks/chunk-CBJIFAHD.js +1 -0
- package/dist/_chunks/chunk-CUCC4RFF.js +1 -0
- package/dist/_chunks/{chunk-76E5R3OC.js → chunk-DBOQPJLY.js} +1 -1
- package/dist/_chunks/chunk-DEXSJABJ.js +1 -0
- package/dist/_chunks/chunk-EOWXXTEF.js +1 -0
- package/dist/_chunks/chunk-EPH3TRYV.js +1 -0
- package/dist/_chunks/chunk-EYOGMJW2.js +1 -0
- package/dist/_chunks/{chunk-ZMJYBUS3.js → chunk-FRZDYDOP.js} +1 -1
- package/dist/_chunks/chunk-IKJ6VNJ6.js +1 -0
- package/dist/_chunks/chunk-ISPIV2P6.js +1 -0
- package/dist/_chunks/chunk-IYYCCA44.js +1 -0
- package/dist/_chunks/chunk-KAW7T5TR.js +1 -0
- package/dist/_chunks/chunk-KGS6SI5Y.js +1 -0
- package/dist/_chunks/chunk-LNKE3Z3X.js +1 -0
- package/dist/_chunks/{chunk-X5PBZTKX.js → chunk-LRIVN74V.js} +1 -1
- package/dist/_chunks/chunk-LVVSTKDW.js +1 -0
- package/dist/_chunks/chunk-LZAC64FB.js +1 -0
- package/dist/_chunks/chunk-M32FI2OA.js +1 -0
- package/dist/_chunks/chunk-N4ORSVTY.js +1 -0
- package/dist/_chunks/{chunk-KOCUZ3AE.js → chunk-NEZ7IY5E.js} +1 -1
- package/dist/_chunks/{chunk-LTNJ45JP.js → chunk-NW3ODW7Y.js} +1 -1
- package/dist/_chunks/chunk-NX4JWZWV.js +1 -0
- package/dist/_chunks/chunk-PC54RQIE.js +1 -0
- package/dist/_chunks/chunk-Q7MTMC6D.js +1 -0
- package/dist/_chunks/chunk-QCBLU6D6.js +1 -0
- package/dist/_chunks/chunk-QLHMJUBH.js +1 -0
- package/dist/_chunks/{chunk-5Y7J2OYL.js → chunk-RASQZMYI.js} +2 -2
- package/dist/_chunks/chunk-RRYZZBXN.js +1 -0
- package/dist/_chunks/chunk-SCLI4ALP.js +1 -0
- package/dist/_chunks/chunk-SCOSFTMM.js +1 -0
- package/dist/_chunks/chunk-UFUFQA5U.js +1 -0
- package/dist/_chunks/chunk-UOYNCE7I.js +1 -0
- package/dist/_chunks/{chunk-OW6R4MAQ.js → chunk-USOV7NK4.js} +1 -1
- package/dist/_chunks/chunk-VJ4SCIR5.js +1 -0
- package/dist/_chunks/chunk-VKXFHOAR.js +1 -0
- package/dist/_chunks/chunk-VXANXYQL.js +1 -0
- package/dist/_chunks/chunk-XMZKBILZ.js +1 -0
- package/dist/_chunks/chunk-Z44SK6DZ.js +1 -0
- package/dist/_chunks/component-contract-B6VKGV2V.js +1 -0
- package/dist/_chunks/component-preflight-FYYYXV6C.js +1 -0
- package/dist/_chunks/connect-75RAY2SE.js +1 -0
- package/dist/_chunks/device-management-JGV4YU7S.js +1 -0
- package/dist/_chunks/device-preflight-ZPWOMGHI.js +1 -0
- package/dist/_chunks/device-provider-inspection-C4IRVW3V.js +1 -0
- package/dist/_chunks/devices-inventory-OAY2HON2.js +1 -0
- package/dist/_chunks/devices-main-6PDXFRE2.js +1 -0
- package/dist/_chunks/files-G2HINGMA.js +1 -0
- package/dist/_chunks/host-component-W5DIBO65.js +1 -0
- package/dist/_chunks/host-help-AYTWACIM.js +1 -0
- package/dist/_chunks/host-main-E34OH232.js +1 -0
- package/dist/_chunks/http-profile-BFWO2A2T.js +1 -0
- package/dist/_chunks/library-main-BDS4ANNF.js +1 -0
- package/dist/_chunks/local-main-EF3Y6EHU.js +1 -0
- package/dist/_chunks/local-mcp-ME7ZQBUT.js +1 -0
- package/dist/_chunks/main-7Q5Y5MVK.js +2 -0
- package/dist/_chunks/mcp-VEJ6GVUK.js +1 -0
- package/dist/_chunks/model-cleanup-22VY6NWS.js +1 -0
- package/dist/_chunks/model-management-RZ4LQYMW.js +1 -0
- package/dist/_chunks/model-plan-retirement-4V2J3AUA.js +1 -0
- package/dist/_chunks/model-retention-F4WNSTJO.js +1 -0
- package/dist/_chunks/model-slot-retirement-KL6MVDGL.js +1 -0
- package/dist/_chunks/oauth-Z26E4LJQ.js +1 -0
- package/dist/_chunks/observe-entry-ZV26WLCP.js +1 -0
- package/dist/_chunks/provider-change-U34UP6ER.js +1 -0
- package/dist/_chunks/remote-client-6F6KRJA6.js +1 -0
- package/dist/_chunks/render-main-ID5JWWKY.js +1 -0
- package/dist/_chunks/source-import-YW6YEMEN.js +1 -0
- package/dist/_chunks/src-36KAJDK4.js +1 -0
- package/dist/_chunks/stdio-main-YR5TITX2.js +1 -0
- package/dist/_chunks/workspace-main-ZFR7ZY3R.js +1 -0
- package/dist/_types/cli/local/desktop-contract.d.ts +349 -40
- package/dist/_types/cli/local/desktop-device-contract.d.ts +89 -78
- package/dist/_types/cli/local/desktop-device-owner.d.ts +14 -14
- package/dist/_types/cli/local/desktop-device-state.d.ts +13 -8
- package/dist/_types/cli/local/desktop-owner.d.ts +130 -30
- package/dist/_types/cli/local/ledger.d.ts +285 -0
- package/dist/_types/cli/local/lifecycle-gates.d.ts +8 -0
- package/dist/_types/cli/local/manager.d.ts +11 -1107
- package/dist/_types/cli/local/mcp-tools.d.ts +3 -0
- package/dist/_types/contracts/artifact.d.ts +2 -0
- package/dist/_types/contracts/component-status.d.ts +9 -0
- package/dist/_types/contracts/device-openai-asr.d.ts +479 -0
- package/dist/_types/contracts/device-render.d.ts +6 -0
- package/dist/_types/contracts/external-agent-access.d.ts +7 -0
- package/dist/_types/contracts/index.d.ts +3 -0
- package/dist/_types/contracts/interface/media-output.d.ts +4 -1
- package/dist/_types/contracts/interface/operation.d.ts +44 -0
- package/dist/_types/contracts/interface/production-snapshot.d.ts +39 -0
- package/dist/_types/contracts/interface/query.d.ts +38 -0
- package/dist/_types/contracts/local-execution/backup-retirement.d.ts +162 -0
- package/dist/_types/contracts/local-execution/claim-resolution.d.ts +1470 -0
- package/dist/_types/contracts/local-execution/components.d.ts +1 -1
- package/dist/_types/contracts/local-execution/cpu-preparation.d.ts +23 -0
- package/dist/_types/contracts/local-execution/credential-request.d.ts +20 -0
- package/dist/_types/contracts/local-execution/external-generation.d.ts +59 -2
- package/dist/_types/contracts/local-execution/index.d.ts +12 -0
- package/dist/_types/contracts/local-execution/ipc.d.ts +27 -0
- package/dist/_types/contracts/local-execution/library-command.d.ts +303 -5
- package/dist/_types/contracts/local-execution/library-result.d.ts +217 -3
- package/dist/_types/contracts/local-execution/lifecycle.d.ts +35 -0
- package/dist/_types/contracts/local-execution/local-navigation.d.ts +3 -0
- package/dist/_types/contracts/local-execution/management.d.ts +12 -12
- package/dist/_types/contracts/local-execution/model-cleanup.d.ts +60 -0
- package/dist/_types/contracts/local-execution/model-inspection.d.ts +365 -0
- package/dist/_types/contracts/local-execution/openai-asr.d.ts +105 -0
- package/dist/_types/contracts/local-execution/openai-realtime-speech.d.ts +151 -0
- package/dist/_types/contracts/local-execution/preview.d.ts +15 -4
- package/dist/_types/contracts/local-execution/processor-capability.d.ts +6 -0
- package/dist/_types/contracts/local-execution/processor-direct.d.ts +140 -4
- package/dist/_types/contracts/local-execution/processor-outcomes.d.ts +145 -0
- package/dist/_types/contracts/local-execution/processor-recipes.d.ts +163 -3
- package/dist/_types/contracts/local-execution/processor.d.ts +2422 -322
- package/dist/_types/contracts/local-execution/project-source-direct.d.ts +1 -0
- package/dist/_types/contracts/local-execution/provider-inspection.d.ts +58 -0
- package/dist/_types/contracts/local-execution/provider-release.d.ts +53 -0
- package/dist/_types/contracts/local-execution/provider-selection.d.ts +58 -0
- package/dist/_types/contracts/local-execution/recognition.d.ts +30 -0
- package/dist/_types/contracts/local-execution/speech.d.ts +1 -1
- package/dist/_types/contracts/local-execution/versions.d.ts +2 -0
- package/dist/_types/contracts/media-observation.d.ts +56 -0
- package/dist/_types/contracts/native-speech-http.d.ts +15 -0
- package/dist/_types/contracts/navigation-context.d.ts +144 -0
- package/dist/_types/contracts/navigation-groups.d.ts +1 -1
- package/dist/_types/contracts/navigation.d.ts +2 -0
- package/dist/_types/contracts/observation-profile.d.ts +12 -0
- package/dist/_types/contracts/openai-asr.d.ts +55 -0
- package/dist/_types/contracts/provider-catalog.d.ts +44 -0
- package/dist/_types/contracts/provider-models.d.ts +115 -3
- package/dist/_types/contracts/provider.d.ts +93 -7
- package/dist/_types/contracts/render-readiness.d.ts +74 -1
- package/dist/_types/contracts/repair-strategy.d.ts +1 -1
- package/dist/_types/contracts/sound-making-plan.d.ts +41 -0
- package/dist/_types/contracts/source-workspace.d.ts +2 -0
- package/dist/_types/contracts/speech-cost.d.ts +129 -0
- package/dist/_types/contracts/speech.d.ts +50 -0
- package/dist/_types/contracts/transcription.d.ts +11 -0
- package/dist/_types/sdk/local-runtime/components.d.ts +6 -0
- package/dist/_types/sdk/local-runtime-client.d.ts +35 -23
- package/dist/entry.js +1 -1
- package/dist/local-management.js +1 -1
- package/dist/local-navigation.js +1 -1
- package/package.json +3 -2
- package/dist/_chunks/chunk-27KI24GK.js +0 -1
- package/dist/_chunks/chunk-2S7FI3HF.js +0 -1
- package/dist/_chunks/chunk-3RNDOAQI.js +0 -1
- package/dist/_chunks/chunk-3TOXIJ7K.js +0 -1
- package/dist/_chunks/chunk-4AD4PNUX.js +0 -1
- package/dist/_chunks/chunk-7I7ARCY7.js +0 -1
- package/dist/_chunks/chunk-7P2NA6TH.js +0 -1
- package/dist/_chunks/chunk-DMA53YVU.js +0 -1
- package/dist/_chunks/chunk-ETK7GYCB.js +0 -1
- package/dist/_chunks/chunk-FFXSXE3G.js +0 -1
- package/dist/_chunks/chunk-H4FH6STZ.js +0 -1
- package/dist/_chunks/chunk-LDBXGRCQ.js +0 -1
- package/dist/_chunks/chunk-PQCA4X5H.js +0 -1
- package/dist/_chunks/chunk-SM2I7TJ3.js +0 -1
- package/dist/_chunks/chunk-VXYZCCCQ.js +0 -1
- package/dist/_chunks/chunk-VYCNG6TR.js +0 -1
- package/dist/_chunks/chunk-WLQMICJN.js +0 -1
- package/dist/_chunks/chunk-WTJVS2VS.js +0 -1
- package/dist/_chunks/chunk-X5MVC46N.js +0 -1
- package/dist/_chunks/component-contract-2JHTRTOB.js +0 -1
- package/dist/_chunks/component-preflight-6OWDQAZT.js +0 -1
- package/dist/_chunks/connect-7TJDWXV4.js +0 -1
- package/dist/_chunks/device-management-JPS4HG34.js +0 -1
- package/dist/_chunks/device-preflight-GTQ67H7C.js +0 -1
- package/dist/_chunks/devices-inventory-E6ZLXCVR.js +0 -1
- package/dist/_chunks/devices-main-2BMCANKU.js +0 -1
- package/dist/_chunks/files-JJ6YOULB.js +0 -1
- package/dist/_chunks/host-component-ZYQ5ETVL.js +0 -1
- package/dist/_chunks/host-help-VNLA3YOV.js +0 -1
- package/dist/_chunks/host-main-KLWW7R47.js +0 -1
- package/dist/_chunks/http-profile-3VVSWYA5.js +0 -1
- package/dist/_chunks/library-main-3WWH7UYV.js +0 -1
- package/dist/_chunks/local-main-5BW63USP.js +0 -1
- package/dist/_chunks/local-mcp-AARKBDU5.js +0 -1
- package/dist/_chunks/main-LGYJ3ZCN.js +0 -2
- package/dist/_chunks/mcp-BLSK636Q.js +0 -1
- package/dist/_chunks/oauth-RPME2XYB.js +0 -1
- package/dist/_chunks/observe-entry-JVZAMB7N.js +0 -1
- package/dist/_chunks/remote-client-25Z65VJU.js +0 -1
- package/dist/_chunks/render-main-6Z3DKCWL.js +0 -1
- package/dist/_chunks/source-import-PNMCMTK7.js +0 -1
- package/dist/_chunks/src-7HSJFRVQ.js +0 -1
- package/dist/_chunks/stdio-main-HNLJCG45.js +0 -1
- package/dist/_chunks/workspace-main-QX5JGEMR.js +0 -1
|
@@ -2,6 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import { SpeechParametersSchema } from "./speech-parameters.js";
|
|
3
3
|
export { SpeechParametersSchema, SpeechParameterRuleSchema, SpeechVoiceSchema, } from "./speech-parameters.js";
|
|
4
4
|
export type { SpeechVoiceModel } from "./speech-parameters.js";
|
|
5
|
+
export declare const openAiRealtimeSpeechModel = "gpt-realtime-2.1-mini";
|
|
5
6
|
export declare const SpeechModelProfileSchema: z.ZodObject<{
|
|
6
7
|
id: z.ZodString;
|
|
7
8
|
version: z.ZodInt;
|
|
@@ -11,16 +12,28 @@ export declare const SpeechModelProfileSchema: z.ZodObject<{
|
|
|
11
12
|
GEMINI: "GEMINI";
|
|
12
13
|
OPENAI: "OPENAI";
|
|
13
14
|
XAI: "XAI";
|
|
15
|
+
NATIVE_SPEECH: "NATIVE_SPEECH";
|
|
14
16
|
}>;
|
|
15
17
|
modelId: z.ZodNullable<z.ZodString>;
|
|
16
18
|
protocol: z.ZodEnum<{
|
|
17
19
|
QWEN_TTS: "QWEN_TTS";
|
|
18
20
|
QWEN_AUDIO_TTS: "QWEN_AUDIO_TTS";
|
|
19
21
|
OPENAI_TTS: "OPENAI_TTS";
|
|
22
|
+
OPENAI_REALTIME_TTS_V1: "OPENAI_REALTIME_TTS_V1";
|
|
20
23
|
XAI_TTS: "XAI_TTS";
|
|
21
24
|
GEMINI_INTERACTIONS_TTS: "GEMINI_INTERACTIONS_TTS";
|
|
22
25
|
VOLCENGINE_TTS: "VOLCENGINE_TTS";
|
|
26
|
+
NATIVE_SPEECH_TTS_V1: "NATIVE_SPEECH_TTS_V1";
|
|
23
27
|
}>;
|
|
28
|
+
nativeSpeech: z.ZodOptional<z.ZodObject<{
|
|
29
|
+
digest: z.ZodString;
|
|
30
|
+
revision: z.ZodString;
|
|
31
|
+
runtimeVersion: z.ZodString;
|
|
32
|
+
qualification: z.ZodEnum<{
|
|
33
|
+
TEST_ONLY: "TEST_ONLY";
|
|
34
|
+
AVAILABLE: "AVAILABLE";
|
|
35
|
+
}>;
|
|
36
|
+
}, z.core.$strict>>;
|
|
24
37
|
label: z.ZodString;
|
|
25
38
|
textMaxCharacters: z.ZodInt;
|
|
26
39
|
requestTimeoutMs: z.ZodInt;
|
|
@@ -81,16 +94,28 @@ export declare const SpeechExecutionBindingSchema: z.ZodObject<{
|
|
|
81
94
|
GEMINI: "GEMINI";
|
|
82
95
|
OPENAI: "OPENAI";
|
|
83
96
|
XAI: "XAI";
|
|
97
|
+
NATIVE_SPEECH: "NATIVE_SPEECH";
|
|
84
98
|
}>;
|
|
85
99
|
modelId: z.ZodNullable<z.ZodString>;
|
|
86
100
|
protocol: z.ZodEnum<{
|
|
87
101
|
QWEN_TTS: "QWEN_TTS";
|
|
88
102
|
QWEN_AUDIO_TTS: "QWEN_AUDIO_TTS";
|
|
89
103
|
OPENAI_TTS: "OPENAI_TTS";
|
|
104
|
+
OPENAI_REALTIME_TTS_V1: "OPENAI_REALTIME_TTS_V1";
|
|
90
105
|
XAI_TTS: "XAI_TTS";
|
|
91
106
|
GEMINI_INTERACTIONS_TTS: "GEMINI_INTERACTIONS_TTS";
|
|
92
107
|
VOLCENGINE_TTS: "VOLCENGINE_TTS";
|
|
108
|
+
NATIVE_SPEECH_TTS_V1: "NATIVE_SPEECH_TTS_V1";
|
|
93
109
|
}>;
|
|
110
|
+
nativeSpeech: z.ZodOptional<z.ZodObject<{
|
|
111
|
+
digest: z.ZodString;
|
|
112
|
+
revision: z.ZodString;
|
|
113
|
+
runtimeVersion: z.ZodString;
|
|
114
|
+
qualification: z.ZodEnum<{
|
|
115
|
+
TEST_ONLY: "TEST_ONLY";
|
|
116
|
+
AVAILABLE: "AVAILABLE";
|
|
117
|
+
}>;
|
|
118
|
+
}, z.core.$strict>>;
|
|
94
119
|
label: z.ZodString;
|
|
95
120
|
textMaxCharacters: z.ZodInt;
|
|
96
121
|
requestTimeoutMs: z.ZodInt;
|
|
@@ -287,16 +312,28 @@ export declare const SpeechGenerationViewSchema: z.ZodObject<{
|
|
|
287
312
|
GEMINI: "GEMINI";
|
|
288
313
|
OPENAI: "OPENAI";
|
|
289
314
|
XAI: "XAI";
|
|
315
|
+
NATIVE_SPEECH: "NATIVE_SPEECH";
|
|
290
316
|
}>;
|
|
291
317
|
modelId: z.ZodNullable<z.ZodString>;
|
|
292
318
|
protocol: z.ZodEnum<{
|
|
293
319
|
QWEN_TTS: "QWEN_TTS";
|
|
294
320
|
QWEN_AUDIO_TTS: "QWEN_AUDIO_TTS";
|
|
295
321
|
OPENAI_TTS: "OPENAI_TTS";
|
|
322
|
+
OPENAI_REALTIME_TTS_V1: "OPENAI_REALTIME_TTS_V1";
|
|
296
323
|
XAI_TTS: "XAI_TTS";
|
|
297
324
|
GEMINI_INTERACTIONS_TTS: "GEMINI_INTERACTIONS_TTS";
|
|
298
325
|
VOLCENGINE_TTS: "VOLCENGINE_TTS";
|
|
326
|
+
NATIVE_SPEECH_TTS_V1: "NATIVE_SPEECH_TTS_V1";
|
|
299
327
|
}>;
|
|
328
|
+
nativeSpeech: z.ZodOptional<z.ZodObject<{
|
|
329
|
+
digest: z.ZodString;
|
|
330
|
+
revision: z.ZodString;
|
|
331
|
+
runtimeVersion: z.ZodString;
|
|
332
|
+
qualification: z.ZodEnum<{
|
|
333
|
+
TEST_ONLY: "TEST_ONLY";
|
|
334
|
+
AVAILABLE: "AVAILABLE";
|
|
335
|
+
}>;
|
|
336
|
+
}, z.core.$strict>>;
|
|
300
337
|
label: z.ZodString;
|
|
301
338
|
textMaxCharacters: z.ZodInt;
|
|
302
339
|
requestTimeoutMs: z.ZodInt;
|
|
@@ -943,16 +980,28 @@ export declare const SpeechOptionsSchema: z.ZodObject<{
|
|
|
943
980
|
GEMINI: "GEMINI";
|
|
944
981
|
OPENAI: "OPENAI";
|
|
945
982
|
XAI: "XAI";
|
|
983
|
+
NATIVE_SPEECH: "NATIVE_SPEECH";
|
|
946
984
|
}>;
|
|
947
985
|
modelId: z.ZodNullable<z.ZodString>;
|
|
948
986
|
protocol: z.ZodEnum<{
|
|
949
987
|
QWEN_TTS: "QWEN_TTS";
|
|
950
988
|
QWEN_AUDIO_TTS: "QWEN_AUDIO_TTS";
|
|
951
989
|
OPENAI_TTS: "OPENAI_TTS";
|
|
990
|
+
OPENAI_REALTIME_TTS_V1: "OPENAI_REALTIME_TTS_V1";
|
|
952
991
|
XAI_TTS: "XAI_TTS";
|
|
953
992
|
GEMINI_INTERACTIONS_TTS: "GEMINI_INTERACTIONS_TTS";
|
|
954
993
|
VOLCENGINE_TTS: "VOLCENGINE_TTS";
|
|
994
|
+
NATIVE_SPEECH_TTS_V1: "NATIVE_SPEECH_TTS_V1";
|
|
955
995
|
}>;
|
|
996
|
+
nativeSpeech: z.ZodOptional<z.ZodObject<{
|
|
997
|
+
digest: z.ZodString;
|
|
998
|
+
revision: z.ZodString;
|
|
999
|
+
runtimeVersion: z.ZodString;
|
|
1000
|
+
qualification: z.ZodEnum<{
|
|
1001
|
+
TEST_ONLY: "TEST_ONLY";
|
|
1002
|
+
AVAILABLE: "AVAILABLE";
|
|
1003
|
+
}>;
|
|
1004
|
+
}, z.core.$strict>>;
|
|
956
1005
|
label: z.ZodString;
|
|
957
1006
|
textMaxCharacters: z.ZodInt;
|
|
958
1007
|
requestTimeoutMs: z.ZodInt;
|
|
@@ -997,6 +1046,7 @@ export declare const SpeechOptionsSchema: z.ZodObject<{
|
|
|
997
1046
|
connectionLabel: z.ZodString;
|
|
998
1047
|
connectionVersion: z.ZodInt;
|
|
999
1048
|
executionTarget: z.ZodOptional<z.ZodLiteral<"TENANT_DEVICE">>;
|
|
1049
|
+
accounting: z.ZodOptional<z.ZodLiteral<"ACTUAL_PROVIDER_USAGE">>;
|
|
1000
1050
|
}, z.core.$strict>>;
|
|
1001
1051
|
possiblyTruncated: z.ZodBoolean;
|
|
1002
1052
|
}, z.core.$strict>;
|
|
@@ -8,6 +8,7 @@ export declare const AsrProfileSchema: z.ZodObject<{
|
|
|
8
8
|
GEMINI: "GEMINI";
|
|
9
9
|
OPENAI: "OPENAI";
|
|
10
10
|
XAI: "XAI";
|
|
11
|
+
NATIVE_SPEECH: "NATIVE_SPEECH";
|
|
11
12
|
}>;
|
|
12
13
|
sourceUrl: z.ZodURL;
|
|
13
14
|
verifiedAt: z.ZodISODate;
|
|
@@ -17,7 +18,17 @@ export declare const AsrProfileSchema: z.ZodObject<{
|
|
|
17
18
|
OPENAI_TRANSCRIPTION_V1: "OPENAI_TRANSCRIPTION_V1";
|
|
18
19
|
OPENAI_WHISPER_TRANSCRIPTION_V1: "OPENAI_WHISPER_TRANSCRIPTION_V1";
|
|
19
20
|
QWEN_ASR_V1: "QWEN_ASR_V1";
|
|
21
|
+
NATIVE_SPEECH_ASR_V1: "NATIVE_SPEECH_ASR_V1";
|
|
20
22
|
}>;
|
|
23
|
+
nativeSpeech: z.ZodOptional<z.ZodObject<{
|
|
24
|
+
digest: z.ZodString;
|
|
25
|
+
revision: z.ZodString;
|
|
26
|
+
runtimeVersion: z.ZodString;
|
|
27
|
+
qualification: z.ZodEnum<{
|
|
28
|
+
TEST_ONLY: "TEST_ONLY";
|
|
29
|
+
AVAILABLE: "AVAILABLE";
|
|
30
|
+
}>;
|
|
31
|
+
}, z.core.$strict>>;
|
|
21
32
|
modes: z.ZodTuple<[z.ZodLiteral<"TRANSCRIPTION">], null>;
|
|
22
33
|
inputKinds: z.ZodArray<z.ZodEnum<{
|
|
23
34
|
VIDEO: "VIDEO";
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
export { LocalRuntimeComponentSchema, LocalComponentBytesSchema, RuntimeCaptionAssets, } from "../../contracts/local-execution/index.js";
|
|
2
2
|
export type { LocalRuntimeComponent } from "../../contracts/local-execution/index.js";
|
|
3
|
+
export { LocalManagedModelSchema, LocalModelRevisionSchema, LocalModelDisableInputSchema, LocalModelDisablePlanSchema, LocalWhisperPrepareInputSchema, LocalWhisperPreparePlanSchema, LocalModelIntegrityReportSchema, LocalModelInventorySchema, LocalModelRetentionInventorySchema, LocalJournalBackupInspectionSchema, LocalRecoveryBackupInspectionSchema, LocalModelRetentionReasonSchema, LocalModelPlanRetirementSchema, LocalModelSlotRetirementSchema, LocalModelSlotRetirementReceiptSchema, LocalModelPlanRetirementReceiptSchema, kokoroCpuProfile, cpuSpeechResources, } from "../../contracts/local-execution/index.js";
|
|
4
|
+
export { LocalExternalProcessorSchema, LocalProviderCredentialFileStateSchema, LocalProviderInspectionSchema, } from "../../contracts/local-execution/index.js";
|
|
5
|
+
export type { LocalProviderInspection } from "../../contracts/local-execution/index.js";
|
|
6
|
+
export { LocalProviderSelectionSchema, LocalProviderChangeSourceSchema, LocalProviderChangePlanSchema, LocalProviderChangeResultSchema, } from "../../contracts/local-execution/index.js";
|
|
7
|
+
export { LocalBackupCoverageSchema, LocalBackupRetirementPlanSchema, LocalBackupRetirementReceiptSchema, } from "../../contracts/local-execution/index.js";
|
|
8
|
+
export { LocalStoppedJournalEvidenceSchema, LocalModelCleanupInputSchema, LocalModelCleanupPlanSchema, LocalModelCleanupReceiptSchema, } from "../../contracts/local-execution/index.js";
|
|
@@ -731,10 +731,12 @@ export declare class NativeStudioLocalRuntimeClient {
|
|
|
731
731
|
} | {
|
|
732
732
|
operation: "runtime.status";
|
|
733
733
|
includeDevice?: true | undefined;
|
|
734
|
+
includeConfigurationFingerprint?: true | undefined;
|
|
734
735
|
} | {
|
|
735
736
|
operation: "runtime.doctor";
|
|
736
737
|
} | {
|
|
737
738
|
operation: "runtime.inventory";
|
|
739
|
+
includeProviderWork?: true | undefined;
|
|
738
740
|
} | {
|
|
739
741
|
operation: "session.issue";
|
|
740
742
|
tenantId: string;
|
|
@@ -743,6 +745,7 @@ export declare class NativeStudioLocalRuntimeClient {
|
|
|
743
745
|
} | {
|
|
744
746
|
operation: "runtime.stop";
|
|
745
747
|
expectedRuntimeRevision: number;
|
|
748
|
+
includeProviderWork?: true | undefined;
|
|
746
749
|
} | {
|
|
747
750
|
operation: "execution.inspect";
|
|
748
751
|
input: {
|
|
@@ -788,11 +791,12 @@ export declare class NativeStudioLocalRuntimeClient {
|
|
|
788
791
|
actualVersion: string;
|
|
789
792
|
recovery: "REDISCOVER_CAPABILITY" | "CHECK_DEVICE_RELEASE";
|
|
790
793
|
} | undefined;
|
|
794
|
+
configurationFingerprint?: string | undefined;
|
|
791
795
|
deviceCapabilities?: {
|
|
792
796
|
deviceRevision: number;
|
|
793
797
|
tenantMediaValidation: boolean;
|
|
794
798
|
tenantMediaProcessing: boolean;
|
|
795
|
-
processorCapabilities: ("KEYFRAME_GENERATE" | "VIDEO_GENERATE" | "SPEECH_SYNTHESIZE" | "SPEECH_EXTERNAL_QWEN" | "TEMPORAL_SAMPLE" | "DELIVERY_VALIDATE" | "COMPOSITION_RENDER" | "IMPORTED_VISUAL_NORMALIZE" | "SOURCE_SYNC_AUDIO" | "IMPORT_ORIGINAL" | "LOCAL_MEDIA_INSPECT" | "LOCAL_MEDIA_PUBLISH" | "IMPORT_PROJECT_SOURCE" | "REGISTER_VISUAL_SEQUENCE" | "REFERENCE_PREVIEW" | "SPEECH_SYNTHESIZE_CPU" | "TRANSCRIBE_AUDIO" | "TRANSCRIBE_EXTERNAL_QWEN")[];
|
|
799
|
+
processorCapabilities: ("KEYFRAME_GENERATE" | "VIDEO_GENERATE" | "SPEECH_SYNTHESIZE" | "SPEECH_EXTERNAL_QWEN" | "TEMPORAL_SAMPLE" | "DELIVERY_VALIDATE" | "COMPOSITION_RENDER" | "IMPORTED_VISUAL_NORMALIZE" | "SOURCE_SYNC_AUDIO" | "IMPORT_ORIGINAL" | "LOCAL_MEDIA_INSPECT" | "LOCAL_MEDIA_PUBLISH" | "IMPORT_PROJECT_SOURCE" | "REGISTER_VISUAL_SEQUENCE" | "REFERENCE_PREVIEW" | "SPEECH_SYNTHESIZE_CPU" | "SPEECH_EXTERNAL_OPENAI_REALTIME" | "TRANSCRIBE_AUDIO" | "TRANSCRIBE_NATIVE_SPEECH" | "TRANSCRIBE_EXTERNAL_QWEN" | "TRANSCRIBE_EXTERNAL_OPENAI")[];
|
|
796
800
|
} | undefined;
|
|
797
801
|
} | {
|
|
798
802
|
binding: {
|
|
@@ -872,25 +876,6 @@ export declare class NativeStudioLocalRuntimeClient {
|
|
|
872
876
|
reason: "READY" | "GRANT_EXPIRED" | "GRANT_REQUIRED" | "RUNTIME_UNAVAILABLE";
|
|
873
877
|
grantFingerprint: string | null;
|
|
874
878
|
inference: "REMOTE_OPENAI";
|
|
875
|
-
} | {
|
|
876
|
-
historical: true;
|
|
877
|
-
items: {
|
|
878
|
-
snapshot: {
|
|
879
|
-
projectId: string;
|
|
880
|
-
title: string;
|
|
881
|
-
savedAt: string;
|
|
882
|
-
expiresAt: string;
|
|
883
|
-
productions: {
|
|
884
|
-
id: string;
|
|
885
|
-
title: string;
|
|
886
|
-
}[];
|
|
887
|
-
possiblyTruncated: boolean;
|
|
888
|
-
};
|
|
889
|
-
draft: {
|
|
890
|
-
text: string;
|
|
891
|
-
revision: number;
|
|
892
|
-
};
|
|
893
|
-
}[];
|
|
894
879
|
} | {
|
|
895
880
|
items: {
|
|
896
881
|
reference: {
|
|
@@ -995,6 +980,25 @@ export declare class NativeStudioLocalRuntimeClient {
|
|
|
995
980
|
totalBytes: number;
|
|
996
981
|
quotaBytes: number;
|
|
997
982
|
availableDiskBytes: number;
|
|
983
|
+
} | {
|
|
984
|
+
historical: true;
|
|
985
|
+
items: {
|
|
986
|
+
snapshot: {
|
|
987
|
+
projectId: string;
|
|
988
|
+
title: string;
|
|
989
|
+
savedAt: string;
|
|
990
|
+
expiresAt: string;
|
|
991
|
+
productions: {
|
|
992
|
+
id: string;
|
|
993
|
+
title: string;
|
|
994
|
+
}[];
|
|
995
|
+
possiblyTruncated: boolean;
|
|
996
|
+
};
|
|
997
|
+
draft: {
|
|
998
|
+
text: string;
|
|
999
|
+
revision: number;
|
|
1000
|
+
};
|
|
1001
|
+
}[];
|
|
998
1002
|
} | {
|
|
999
1003
|
runtimeRevision: number;
|
|
1000
1004
|
descriptor: {
|
|
@@ -1022,6 +1026,7 @@ export declare class NativeStudioLocalRuntimeClient {
|
|
|
1022
1026
|
pendingExecutions: number;
|
|
1023
1027
|
pendingRequests: number;
|
|
1024
1028
|
pendingRenderers: string[];
|
|
1029
|
+
pendingProviderWork?: number | undefined;
|
|
1025
1030
|
} | {
|
|
1026
1031
|
settings: {
|
|
1027
1032
|
revision: number;
|
|
@@ -1157,6 +1162,7 @@ export declare class NativeStudioLocalRuntimeClient {
|
|
|
1157
1162
|
pendingExecutions: number;
|
|
1158
1163
|
pendingRequests: number;
|
|
1159
1164
|
pendingRenderers: string[];
|
|
1165
|
+
pendingProviderWork?: number | undefined;
|
|
1160
1166
|
} | undefined;
|
|
1161
1167
|
backupPath?: string | undefined;
|
|
1162
1168
|
} | null>;
|
|
@@ -1558,10 +1564,12 @@ export declare class NativeStudioLocalRuntimeClient {
|
|
|
1558
1564
|
} | {
|
|
1559
1565
|
operation: "runtime.status";
|
|
1560
1566
|
includeDevice?: true | undefined;
|
|
1567
|
+
includeConfigurationFingerprint?: true | undefined;
|
|
1561
1568
|
} | {
|
|
1562
1569
|
operation: "runtime.doctor";
|
|
1563
1570
|
} | {
|
|
1564
1571
|
operation: "runtime.inventory";
|
|
1572
|
+
includeProviderWork?: true | undefined;
|
|
1565
1573
|
} | {
|
|
1566
1574
|
operation: "session.issue";
|
|
1567
1575
|
tenantId: string;
|
|
@@ -1570,6 +1578,7 @@ export declare class NativeStudioLocalRuntimeClient {
|
|
|
1570
1578
|
} | {
|
|
1571
1579
|
operation: "runtime.stop";
|
|
1572
1580
|
expectedRuntimeRevision: number;
|
|
1581
|
+
includeProviderWork?: true | undefined;
|
|
1573
1582
|
} | {
|
|
1574
1583
|
operation: "execution.inspect";
|
|
1575
1584
|
input: {
|
|
@@ -1615,11 +1624,12 @@ export declare class NativeStudioLocalRuntimeClient {
|
|
|
1615
1624
|
actualVersion: string;
|
|
1616
1625
|
recovery: "REDISCOVER_CAPABILITY" | "CHECK_DEVICE_RELEASE";
|
|
1617
1626
|
} | undefined;
|
|
1627
|
+
configurationFingerprint?: string | undefined;
|
|
1618
1628
|
deviceCapabilities?: {
|
|
1619
1629
|
deviceRevision: number;
|
|
1620
1630
|
tenantMediaValidation: boolean;
|
|
1621
1631
|
tenantMediaProcessing: boolean;
|
|
1622
|
-
processorCapabilities: ("KEYFRAME_GENERATE" | "VIDEO_GENERATE" | "SPEECH_SYNTHESIZE" | "SPEECH_EXTERNAL_QWEN" | "TEMPORAL_SAMPLE" | "DELIVERY_VALIDATE" | "COMPOSITION_RENDER" | "IMPORTED_VISUAL_NORMALIZE" | "SOURCE_SYNC_AUDIO" | "IMPORT_ORIGINAL" | "LOCAL_MEDIA_INSPECT" | "LOCAL_MEDIA_PUBLISH" | "IMPORT_PROJECT_SOURCE" | "REGISTER_VISUAL_SEQUENCE" | "REFERENCE_PREVIEW" | "SPEECH_SYNTHESIZE_CPU" | "TRANSCRIBE_AUDIO" | "TRANSCRIBE_EXTERNAL_QWEN")[];
|
|
1632
|
+
processorCapabilities: ("KEYFRAME_GENERATE" | "VIDEO_GENERATE" | "SPEECH_SYNTHESIZE" | "SPEECH_EXTERNAL_QWEN" | "TEMPORAL_SAMPLE" | "DELIVERY_VALIDATE" | "COMPOSITION_RENDER" | "IMPORTED_VISUAL_NORMALIZE" | "SOURCE_SYNC_AUDIO" | "IMPORT_ORIGINAL" | "LOCAL_MEDIA_INSPECT" | "LOCAL_MEDIA_PUBLISH" | "IMPORT_PROJECT_SOURCE" | "REGISTER_VISUAL_SEQUENCE" | "REFERENCE_PREVIEW" | "SPEECH_SYNTHESIZE_CPU" | "SPEECH_EXTERNAL_OPENAI_REALTIME" | "TRANSCRIBE_AUDIO" | "TRANSCRIBE_NATIVE_SPEECH" | "TRANSCRIBE_EXTERNAL_QWEN" | "TRANSCRIBE_EXTERNAL_OPENAI")[];
|
|
1623
1633
|
} | undefined;
|
|
1624
1634
|
}>;
|
|
1625
1635
|
doctor(signal?: AbortSignal): Promise<{
|
|
@@ -1662,6 +1672,7 @@ export declare class NativeStudioLocalRuntimeClient {
|
|
|
1662
1672
|
pendingExecutions: number;
|
|
1663
1673
|
pendingRequests: number;
|
|
1664
1674
|
pendingRenderers: string[];
|
|
1675
|
+
pendingProviderWork?: number | undefined;
|
|
1665
1676
|
}>;
|
|
1666
1677
|
grantAgent(raw: unknown, approval: string): Promise<{
|
|
1667
1678
|
configured: boolean;
|
|
@@ -2749,7 +2760,8 @@ export declare class NativeStudioLocalRuntimeClient {
|
|
|
2749
2760
|
}
|
|
2750
2761
|
export { LocalSessionConnectorSchema } from "../contracts/local-execution/index.js";
|
|
2751
2762
|
export { NativeStudioSdkError } from "./errors.js";
|
|
2752
|
-
export { LocalRuntimeDescriptorSchema, LocalManagementInventorySchema, LocalSignedCatalogueSchema, LocalReleaseSchema, LocalBundledReleaseSchema, LocalUpdatePlanSchema, LocalToolChoiceSchema, LocalClientNextActionSchema,
|
|
2763
|
+
export { LocalRuntimeDescriptorSchema, LocalManagementInventorySchema, LocalSignedCatalogueSchema, LocalReleaseSchema, LocalBundledReleaseSchema, LocalUpdatePlanSchema, LocalToolChoiceSchema, LocalClientNextActionSchema, newerVersion, // 渠道读取者使用同一 SemVer 优先级。
|
|
2764
|
+
canonicalLocalJson, LocalSessionConnectorSchema as LocalConnectorSchema, } from "../contracts/local-execution/index.js";
|
|
2753
2765
|
export type { LocalRelease, LocalSignedCatalogue, LocalUpdatePlan, LocalToolChoice, LocalRuntimeDescriptor, LocalSessionConnector, } from "../contracts/local-execution/index.js";
|
|
2754
2766
|
export { NativeStudioLocalDeviceClient } from "./local-runtime/device-client.js";
|
|
2755
2767
|
export { EnrollLocalDeviceSchema, RevokeLocalDeviceSchema, StartLocalPreviewSchema, StartLocalFinalRenderSchema, LocalDeviceTransportConfigurationSchema, } from "../contracts/local-execution/index.js";
|
|
@@ -2767,4 +2779,4 @@ export { importedNormalizationValidationProfile, referenceThumbnailProfile, tena
|
|
|
2767
2779
|
export { processorFamilies } from "../contracts/local-execution/index.js";
|
|
2768
2780
|
export type { TenantProcessorKind } from "../contracts/local-execution/index.js";
|
|
2769
2781
|
export * from "./local-runtime/components.js";
|
|
2770
|
-
export { CpuSpeechPrepareInputSchema, CpuSpeechPreparedSchema, } from "../contracts/local-execution/index.js";
|
|
2782
|
+
export { CpuSpeechPrepareInputSchema, CpuSpeechPreparedSchema, CpuSpeechPreparationFailureSchema, } from "../contracts/local-execution/index.js";
|
package/dist/entry.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
if(process.argv[2]==="observe"){process.exitCode=await(await import("./_chunks/observe-entry-
|
|
2
|
+
if(process.argv[2]==="observe"){process.exitCode=await(await import("./_chunks/observe-entry-ZV26WLCP.js")).runObservationEntry(process.argv.slice(3))}else if(process.argv[2]==="host"){const{runHostCli}=await import("./_chunks/host-main-E34OH232.js");const result=await runHostCli(process.argv.slice(3));process.stdout.write(JSON.stringify(result.output)+"\n");process.exitCode=result.exitCode}else if(process.argv[2]==="local"){if(process.argv[3]==="mcp"){const{runLocalMcp}=await import("./_chunks/local-mcp-ME7ZQBUT.js");process.exitCode=await runLocalMcp(process.argv.slice(4))}else{const{runLocalCli}=await import("./_chunks/local-main-EF3Y6EHU.js");const result=await runLocalCli(process.argv.slice(3));process.stdout.write(JSON.stringify(result.output)+"\n");process.exitCode=result.exitCode}}else if(process.argv[2]==="mcp"){const{runMcpStdio}=await import("./_chunks/stdio-main-YR5TITX2.js");process.exitCode=await runMcpStdio(process.argv.slice(3),process.env)}else{const{runRemoteCli}=await import("./_chunks/main-7Q5Y5MVK.js");const result=await runRemoteCli(process.argv.slice(2));process.stdout.write(JSON.stringify(result.output)+"\n");process.exitCode=result.exitCode}
|
package/dist/local-management.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{prepareInstalledCpuSpeech}from"./_chunks/chunk-VXYZCCCQ.js";import{configureDesktopChannel,desktopChannelInfo,desktopRuntimeChannel}from"./_chunks/chunk-7IVAYDU3.js";import{DesktopBootstrapReplySchema,DesktopBootstrapRequestSchema,DesktopOwnerRequestSchema,DesktopRuntimeStatusSchema,desktopOwnerResponses,runDesktopAgentRequest,runDesktopOfflineRequest,runDesktopStorageRequest,runDesktopWorkspaceRequest}from"./_chunks/chunk-WLQMICJN.js";import{DesktopLibraryImportRequestSchema,DesktopLibraryImportSeedSchema,DesktopLibraryMediaRequestSchema,DesktopLibraryPrepareRequestSchema,DesktopLibraryReplySchema,DesktopLibraryRequestSchema,prepareDesktopLibraryImport,runDesktopLibraryImport,runDesktopLibraryMedia,runDesktopLibraryRequest}from"./_chunks/chunk-DMA53YVU.js";import{desktopDevicePending,runDesktopDeviceRequest}from"./_chunks/chunk-PQCA4X5H.js";import"./_chunks/chunk-H4FH6STZ.js";import{disableDesktopAutomation}from"./_chunks/chunk-MZWEFYHE.js";import{LocalInstallationManager,captureInstalledTools,ownerClient,socketAbsent,toolPreference}from"./_chunks/chunk-FFXSXE3G.js";import{desktopDeviceConnector}from"./_chunks/chunk-ETK7GYCB.js";import{DesktopDeviceReplySchema,DesktopDeviceScopeSchema}from"./_chunks/chunk-SM2I7TJ3.js";import{LocalReleaseSchema,catalogue,newerVersion}from"./_chunks/chunk-LDBXGRCQ.js";import{canonicalLocalJson}from"./_chunks/chunk-2S7FI3HF.js";import{directory,fail,optional,read,sha256,write}from"./_chunks/chunk-DLW42PJ6.js";import"./_chunks/chunk-WTJVS2VS.js";import"./_chunks/chunk-TT7IA5HB.js";async function desktopRuntimeStatus(manager){const status=await manager.status();const stopped=!status.running&&status.activeVersion?await socketAbsent((await manager.configuration()).stateDirectory):false;const active=(await manager.ledger.current()).value.active;const tools=active?.toolsConfigPath?await toolPreference(active.toolsConfigPath,null):null;return DesktopRuntimeStatusSchema.parse({protocol:"NVS_DESKTOP_RUNTIME_STATUS_V1",state:status.running?"RUNNING":stopped?"STOPPED":status.activeVersion?"UNAVAILABLE":"INSTALL_REQUIRED",activeVersion:status.activeVersion,phase:status.phase,toolMode:tools?.mode??null,...tools?.cpuSpeech?{speech:{voiceIds:tools.cpuSpeech.voiceIds}}:{}})}import{z}from"zod";import{join}from"node:path";import{randomUUID}from"node:crypto";var digest=z.string().regex(/^[a-f0-9]{64}$/);var intentSchema=z.strictObject({id:z.uuid(),channel:z.strictObject({protocol:z.literal("NVS_DESKTOP_RUNTIME_CHANNEL_V1"),catalogueUrl:z.string().url(),publicKey:z.string()}),release:LocalReleaseSchema,installationRevision:z.int().nonnegative(),expiresAt:z.iso.datetime()});async function runDesktopBootstrap(home,raw,bundled){const{call}=DesktopBootstrapRequestSchema.parse(raw),manager=await LocalInstallationManager.open(home),root=await directory(join(home,"bootstrap-plans"));let intent,fingerprint;if(call.action==="prepare"){const info=await desktopChannelInfo(manager,bundled);if(!info.channelFingerprint)fail("DESKTOP_CHANNEL_REQUIRED");const configuration=info.configured?await manager.configuration():null;if(configuration&&!configuration.publicKeyFile)fail("DESKTOP_CHANNEL_CHANGED");const channel=desktopRuntimeChannel(configuration?{protocol:"NVS_DESKTOP_RUNTIME_CHANNEL_V1",catalogueUrl:configuration.catalogueUrl,publicKey:(await read(configuration.publicKeyFile,16384)).toString()}:bundled);const publicKeyFile=join(root,channel.fingerprint+".pem");try{await write(publicKeyFile,channel.value.publicKey,true)}catch(e){if(e.code!=="EEXIST"||(await read(publicKeyFile,16384)).toString()!==channel.value.publicKey)throw e}const trusted=await catalogue({catalogueUrl:channel.value.catalogueUrl,publicKeyFile});const candidates=trusted.signed.catalogue.releases.filter(r=>r.descriptor.workProtocol==="NVS_LOCAL_WORK_V2"&&r.descriptor.platform.os===process.platform&&r.descriptor.platform.architecture===process.arch&&!!r.tools);const release=candidates.reduce((a,b)=>!a||newerVersion(b.descriptor.version,a.descriptor.version)?b:a,null);if(!release)fail("LOCAL_PROFILE_UNAVAILABLE");intent=intentSchema.parse({id:randomUUID(),channel:channel.value,release,installationRevision:(await manager.ledger.current()).value.revision,expiresAt:new Date(Math.min(Date.now()+18e5,Date.parse(trusted.signed.catalogue.expiresAt))).toISOString()});fingerprint=sha256(canonicalLocalJson(intent));await write(join(root,intent.id+".json"),canonicalLocalJson({intent,fingerprint}),true)}else{const saved=z.strictObject({intent:intentSchema,fingerprint:digest}).parse(JSON.parse((await read(join(root,call.id+".json"),131072)).toString()));intent=saved.intent;fingerprint=saved.fingerprint;if(fingerprint!==call.fingerprint||fingerprint!==sha256(canonicalLocalJson(intent))||intent.id!==call.id)fail("PLAN_CHANGED");const receiptFile=join(root,intent.id+".installation.json");const receipt=z.strictObject({id:z.uuid(),fingerprint:digest}).nullable().parse(await optional(receiptFile));if(receipt){const state=(await manager.ledger.current()).value;if(state.transition){if(state.transition.planId!==receipt.id)fail("RECOVERY_REQUIRED");await manager.reconcile(receipt.id,receipt.fingerprint)}}else{if(Date.parse(intent.expiresAt)<=Date.now()||(await manager.ledger.current()).value.revision!==intent.installationRevision)fail("PLAN_CHANGED");const trust=desktopRuntimeChannel(intent.channel);await configureDesktopChannel(manager,trust.fingerprint,intent.channel);const plan=await manager.prepare(intent.release.descriptor.version,{mode:"MANAGED"});if(canonicalLocalJson(plan.release)!==canonicalLocalJson(intent.release))fail("PLAN_CHANGED");await write(receiptFile,canonicalLocalJson({id:plan.planId,fingerprint:plan.fingerprint}),true);await manager.apply(plan.planId,plan.fingerprint)}const installed=(await manager.ledger.current()).value;if(installed.transition||canonicalLocalJson(installed.active?.descriptor)!==canonicalLocalJson(intent.release.descriptor))fail("RECOVERY_REQUIRED");const configuration=await manager.configuration(),report=await(await ownerClient(configuration.stateDirectory)).doctor();if(!report.executionProfiles?.includes("STUDIO_MEDIA_V2"))fail("LOCAL_PROFILE_UNAVAILABLE");if((await desktopRuntimeStatus(manager)).state!=="RUNNING")fail("RECOVERY_REQUIRED")}return DesktopBootstrapReplySchema.parse({id:intent.id,fingerprint,version:intent.release.descriptor.version,host:new URL(intent.channel.catalogueUrl).host,bytes:intent.release.package.byteSize+Object.values(intent.release.tools??{}).reduce((sum,a)=>sum+a.byteSize,0),expiresAt:intent.expiresAt,installed:call.action==="apply"})}async function runDesktopOwnerRequest(home,raw,bundledChannel){const request=DesktopOwnerRequestSchema.parse(raw),manager=await LocalInstallationManager.open(home);let result;switch(request.operation){case"library":result=await runDesktopLibraryRequest(home,request);break;case"library-import":result=await runDesktopLibraryImport(home,request);break;case"library-import-prepare":result=await prepareDesktopLibraryImport(request);break;case"bootstrap":result=await runDesktopBootstrap(home,request,bundledChannel);break;case"agent":result=await runDesktopAgentRequest(home,request);break;case"offline":result=await runDesktopOfflineRequest(home,request);break;case"storage":result=await runDesktopStorageRequest(home,request);break;case"workspace":result=await runDesktopWorkspaceRequest(home,request);break;case"device":result=await runDesktopDeviceRequest(home,request);break;case"status":case"start":case"stop":if(request.operation==="start")await manager.start();if(request.operation==="stop"){await disableDesktopAutomation(home);await manager.stop()}result=await desktopRuntimeStatus(manager);break;case"configuration":result=await desktopChannelInfo(manager,bundledChannel);break;case"configure":await configureDesktopChannel(manager,request.channelFingerprint,bundledChannel);result=await desktopRuntimeStatus(manager);break;case"check":{const checked=await manager.check();result={protocol:"NVS_DESKTOP_RUNTIME_UPDATES_V1",activeVersion:checked.installation.activeVersion,versions:checked.available.map(v=>({version:v.version,rejected:checked.rejectedVersions.includes(v.version)})),notifications:checked.notifications};break}case"speech-prepare":{const prepared=await prepareInstalledCpuSpeech(manager,request.input),plan=prepared.plan;result={protocol:"NVS_DESKTOP_OWNER_PLAN_V1",plan:{kind:"APPLY",toolMode:plan.toolSelection?.mode,planId:plan.planId,fingerprint:plan.fingerprint,version:plan.release.descriptor.version,previousVersion:(await manager.status()).activeVersion,expiresAt:plan.expiresAt,phase:"PREPARED"}};break}case"prepare":case"tools-prepare":{const choice=request.operation==="tools-prepare"?request.choice.mode==="MANAGED"?request.choice:await captureInstalledTools(request.choice):void 0;const plan=await manager.prepare(request.version,choice);result={protocol:"NVS_DESKTOP_OWNER_PLAN_V1",plan:{kind:"APPLY",...choice?{toolMode:choice.mode}:{},planId:plan.planId,fingerprint:plan.fingerprint,version:plan.release.descriptor.version,previousVersion:(await manager.status()).activeVersion,expiresAt:plan.expiresAt,phase:"PREPARED"}};break}case"recovery":{const current=(await manager.ledger.current()).value,transition=current.transition;let plan=null;if(transition){const original=await manager.plan(transition.planId);if(original.fingerprint!==transition.fingerprint)fail("PLAN_CHANGED");plan={kind:"RECOVER",planId:original.planId,fingerprint:original.fingerprint,version:original.release.descriptor.version,previousVersion:transition.previous?.descriptor.version??null,expiresAt:original.expiresAt,phase:transition.phase}}result={protocol:"NVS_DESKTOP_OWNER_PLAN_V1",plan};break}case"apply":case"recover":if(request.operation==="apply")await manager.apply(request.planId,request.fingerprint);else await manager.reconcile(request.planId,request.fingerprint);result=await desktopRuntimeStatus(manager);break;case"reject":await manager.reject(request.version);result=await desktopRuntimeStatus(manager);break}return desktopOwnerResponses[request.operation].parse(result)}import{lstat,readFile,chmod}from"node:fs/promises";import{join as join2,isAbsolute,dirname}from"node:path";async function verifiedSource(source,expected,limit){if(!isAbsolute(source)||!/^[a-f0-9]{64}$/.test(expected))fail("DESKTOP_DISTRIBUTION_INVALID");const stat=await lstat(source);if(!stat.isFile()||stat.isSymbolicLink()||stat.size>limit)fail("DESKTOP_DISTRIBUTION_INVALID");const bytes=await readFile(source);if(bytes.length>limit||sha256(bytes)!==expected)fail("DESKTOP_DISTRIBUTION_INVALID");return bytes}async function retain(target,bytes,expected,limit,mode){try{if(sha256(await read(target,limit))!==expected)fail("DESKTOP_DISTRIBUTION_INVALID")}catch(error){if(error.code!=="ENOENT")throw error;try{await write(target,bytes,true)}catch(error2){if(error2.code!=="EEXIST")throw error2}if(sha256(await read(target,limit))!==expected)fail("DESKTOP_DISTRIBUTION_INVALID")}await chmod(target,mode)}async function materializeDesktopNode(home,source,expected,licenseDigest){const bytes=await verifiedSource(source,expected,160*1024*1024);const license=licenseDigest?await verifiedSource(join2(dirname(source),"LICENSE.txt"),licenseDigest,2*1024*1024):null;const base=await directory(join2(await directory(home),"nodes",expected)),target=join2(base,process.platform==="win32"?"node.exe":"node");if(license)await retain(join2(base,"LICENSE.txt"),license,licenseDigest,2*1024*1024,256);await retain(target,bytes,expected,160*1024*1024,320);return target}async function runLocalManagement(home,operation){if(!["status","start","stop"].includes(operation))throw Error("INVALID_INPUT");const manager=await LocalInstallationManager.open(home);if(operation==="start")await manager.start();if(operation==="stop")await manager.stop();return desktopRuntimeStatus(manager)}export{DesktopDeviceReplySchema,DesktopDeviceScopeSchema,DesktopLibraryImportRequestSchema,DesktopLibraryImportSeedSchema,DesktopLibraryMediaRequestSchema,DesktopLibraryPrepareRequestSchema,DesktopLibraryReplySchema,DesktopLibraryRequestSchema,DesktopOwnerRequestSchema,desktopDeviceConnector,desktopDevicePending,desktopOwnerResponses,desktopRuntimeChannel,materializeDesktopNode,prepareDesktopLibraryImport,runDesktopLibraryMedia,runDesktopOwnerRequest,runLocalManagement};
|
|
1
|
+
import{configureDesktopChannel,desktopChannelInfo,desktopRuntimeChannel}from"./_chunks/chunk-7TXIHIZ5.js";import{DesktopBootstrapReplySchema,DesktopBootstrapRequestSchema,DesktopOwnerRequestSchema,DesktopRuntimeStatusSchema,desktopOwnerResponses,prepareDesktopModel,readDesktopModels,runDesktopAgentRequest,runDesktopOfflineRequest,runDesktopStorageRequest,runDesktopWorkspaceRequest}from"./_chunks/chunk-VXANXYQL.js";import{DesktopLibraryImportRequestSchema,DesktopLibraryImportSeedSchema,DesktopLibraryMediaRequestSchema,DesktopLibraryPrepareRequestSchema,DesktopLibraryReplySchema,DesktopLibraryRequestSchema,prepareDesktopLibraryImport,runDesktopLibraryImport,runDesktopLibraryMedia,runDesktopLibraryRequest}from"./_chunks/chunk-SCLI4ALP.js";import{desktopDevicePending,runDesktopDeviceRequest}from"./_chunks/chunk-PC54RQIE.js";import{applyDeviceProviderChange,prepareDeviceProviderChange}from"./_chunks/chunk-EYOGMJW2.js";import"./_chunks/chunk-IYYCCA44.js";import{disableDesktopAutomation}from"./_chunks/chunk-24ZFLWWU.js";import"./_chunks/chunk-LNKE3Z3X.js";import{inspectDeviceProviders}from"./_chunks/chunk-NX4JWZWV.js";import"./_chunks/chunk-25WUWVDK.js";import"./_chunks/chunk-LZAC64FB.js";import{LocalInstallationManager}from"./_chunks/chunk-A3MJERGH.js";import"./_chunks/chunk-6MYLFBLH.js";import{prepareInstalledCpuSpeech}from"./_chunks/chunk-QCBLU6D6.js";import{captureInstalledTools,toolPreference}from"./_chunks/chunk-QLHMJUBH.js";import"./_chunks/chunk-DEXSJABJ.js";import"./_chunks/chunk-KGS6SI5Y.js";import"./_chunks/chunk-KAW7T5TR.js";import{ownerClient,socketAbsent}from"./_chunks/chunk-6YVGVNEH.js";import"./_chunks/chunk-N4ORSVTY.js";import"./_chunks/chunk-RRYZZBXN.js";import"./_chunks/chunk-LVVSTKDW.js";import{DesktopDeviceReplySchema,DesktopDeviceScopeSchema,desktopDeviceConnector}from"./_chunks/chunk-EPH3TRYV.js";import{catalogue}from"./_chunks/chunk-VKXFHOAR.js";import"./_chunks/chunk-EOWXXTEF.js";import"./_chunks/chunk-XMZKBILZ.js";import{LocalReleaseSchema,canonicalLocalJson,newerVersion}from"./_chunks/chunk-UOYNCE7I.js";import{directory,fail,optional,read,sha256,write}from"./_chunks/chunk-AZQLZA47.js";import"./_chunks/chunk-Z44SK6DZ.js";import"./_chunks/chunk-M32FI2OA.js";import"./_chunks/chunk-TT7IA5HB.js";async function desktopRuntimeStatus(manager){const status=await manager.status();const stopped=!status.running&&status.activeVersion?await socketAbsent((await manager.configuration()).stateDirectory):false;const active=(await manager.ledger.current()).value.active;const tools=active?.toolsConfigPath?await toolPreference(active.toolsConfigPath,null):null;return DesktopRuntimeStatusSchema.parse({protocol:"NVS_DESKTOP_RUNTIME_STATUS_V1",state:status.running?"RUNNING":stopped?"STOPPED":status.activeVersion?"UNAVAILABLE":"INSTALL_REQUIRED",activeVersion:status.activeVersion,phase:status.phase,toolMode:tools?.mode??null,...tools?.cpuSpeech?{speech:{voiceIds:tools.cpuSpeech.voiceIds}}:{}})}import{z}from"zod";import{join}from"node:path";import{randomUUID}from"node:crypto";var digest=z.string().regex(/^[a-f0-9]{64}$/);var intentSchema=z.strictObject({id:z.uuid(),channel:z.strictObject({protocol:z.literal("NVS_DESKTOP_RUNTIME_CHANNEL_V1"),catalogueUrl:z.string().url(),publicKey:z.string()}),release:LocalReleaseSchema,installationRevision:z.int().nonnegative(),expiresAt:z.iso.datetime()});async function runDesktopBootstrap(home,raw,bundled){const{call}=DesktopBootstrapRequestSchema.parse(raw),manager=await LocalInstallationManager.open(home),root=await directory(join(home,"bootstrap-plans"));let intent,fingerprint;if(call.action==="prepare"){const info=await desktopChannelInfo(manager,bundled);if(!info.channelFingerprint)fail("DESKTOP_CHANNEL_REQUIRED");const configuration=info.configured?await manager.configuration():null;if(configuration&&!configuration.publicKeyFile)fail("DESKTOP_CHANNEL_CHANGED");const channel=desktopRuntimeChannel(configuration?{protocol:"NVS_DESKTOP_RUNTIME_CHANNEL_V1",catalogueUrl:configuration.catalogueUrl,publicKey:(await read(configuration.publicKeyFile,16384)).toString()}:bundled);const publicKeyFile=join(root,channel.fingerprint+".pem");try{await write(publicKeyFile,channel.value.publicKey,true)}catch(e){if(e.code!=="EEXIST"||(await read(publicKeyFile,16384)).toString()!==channel.value.publicKey)throw e}const trusted=await catalogue({catalogueUrl:channel.value.catalogueUrl,publicKeyFile});const candidates=trusted.signed.catalogue.releases.filter(r=>r.descriptor.workProtocol==="NVS_LOCAL_WORK_V2"&&r.descriptor.platform.os===process.platform&&r.descriptor.platform.architecture===process.arch&&!!r.tools);const release=candidates.reduce((a,b)=>!a||newerVersion(b.descriptor.version,a.descriptor.version)?b:a,null);if(!release)fail("LOCAL_PROFILE_UNAVAILABLE");intent=intentSchema.parse({id:randomUUID(),channel:channel.value,release,installationRevision:(await manager.ledger.current()).value.revision,expiresAt:new Date(Math.min(Date.now()+18e5,Date.parse(trusted.signed.catalogue.expiresAt))).toISOString()});fingerprint=sha256(canonicalLocalJson(intent));await write(join(root,intent.id+".json"),canonicalLocalJson({intent,fingerprint}),true)}else{const saved=z.strictObject({intent:intentSchema,fingerprint:digest}).parse(JSON.parse((await read(join(root,call.id+".json"),131072)).toString()));intent=saved.intent;fingerprint=saved.fingerprint;if(fingerprint!==call.fingerprint||fingerprint!==sha256(canonicalLocalJson(intent))||intent.id!==call.id)fail("PLAN_CHANGED");const receiptFile=join(root,intent.id+".installation.json");const receipt=z.strictObject({id:z.uuid(),fingerprint:digest}).nullable().parse(await optional(receiptFile));if(receipt){const state=(await manager.ledger.current()).value;if(state.transition){if(state.transition.planId!==receipt.id)fail("RECOVERY_REQUIRED");await manager.reconcile(receipt.id,receipt.fingerprint)}}else{if(Date.parse(intent.expiresAt)<=Date.now()||(await manager.ledger.current()).value.revision!==intent.installationRevision)fail("PLAN_CHANGED");const trust=desktopRuntimeChannel(intent.channel);await configureDesktopChannel(manager,trust.fingerprint,intent.channel);const plan=await manager.prepare(intent.release.descriptor.version,{mode:"MANAGED"});if(canonicalLocalJson(plan.release)!==canonicalLocalJson(intent.release))fail("PLAN_CHANGED");await write(receiptFile,canonicalLocalJson({id:plan.planId,fingerprint:plan.fingerprint}),true);await manager.apply(plan.planId,plan.fingerprint)}const installed=(await manager.ledger.current()).value;if(installed.transition||canonicalLocalJson(installed.active?.descriptor)!==canonicalLocalJson(intent.release.descriptor))fail("RECOVERY_REQUIRED");const configuration=await manager.configuration(),report=await(await ownerClient(configuration.stateDirectory)).doctor();if(!report.executionProfiles?.includes("STUDIO_MEDIA_V2"))fail("LOCAL_PROFILE_UNAVAILABLE");if((await desktopRuntimeStatus(manager)).state!=="RUNNING")fail("RECOVERY_REQUIRED")}return DesktopBootstrapReplySchema.parse({id:intent.id,fingerprint,version:intent.release.descriptor.version,host:new URL(intent.channel.catalogueUrl).host,bytes:intent.release.package.byteSize+Object.values(intent.release.tools??{}).reduce((sum,a)=>sum+a.byteSize,0),expiresAt:intent.expiresAt,installed:call.action==="apply"})}async function runDesktopOwnerRequest(home,raw,bundledChannel){const request=DesktopOwnerRequestSchema.parse(raw);if(request.operation==="device-provider-prepare")return desktopOwnerResponses[request.operation].parse(await prepareDeviceProviderChange(home,request.scope,request.source));if(request.operation==="device-provider-apply")return desktopOwnerResponses[request.operation].parse(await applyDeviceProviderChange(home,request.scope,request.source,request.approval));if(request.operation==="device-provider-inspect")return desktopOwnerResponses[request.operation].parse(await inspectDeviceProviders(home,request.scope));if(request.operation==="models-inspect"||request.operation==="models-retention")return desktopOwnerResponses[request.operation].parse(await readDesktopModels(home,request));if(request.operation==="model-disable-prepare"||request.operation==="model-whisper-prepare")return desktopOwnerResponses[request.operation].parse(await prepareDesktopModel(home,request));const manager=await LocalInstallationManager.open(home);let result;switch(request.operation){case"library":result=await runDesktopLibraryRequest(home,request);break;case"library-import":result=await runDesktopLibraryImport(home,request);break;case"library-import-prepare":result=await prepareDesktopLibraryImport(request);break;case"bootstrap":result=await runDesktopBootstrap(home,request,bundledChannel);break;case"agent":result=await runDesktopAgentRequest(home,request);break;case"offline":result=await runDesktopOfflineRequest(home,request);break;case"storage":result=await runDesktopStorageRequest(home,request);break;case"workspace":result=await runDesktopWorkspaceRequest(home,request);break;case"device":result=await runDesktopDeviceRequest(home,request);break;case"status":case"start":case"stop":if(request.operation==="start")await manager.start();if(request.operation==="stop"){await disableDesktopAutomation(home);await manager.stop()}result=await desktopRuntimeStatus(manager);break;case"configuration":result=await desktopChannelInfo(manager,bundledChannel);break;case"configure":await configureDesktopChannel(manager,request.channelFingerprint,bundledChannel);result=await desktopRuntimeStatus(manager);break;case"check":{const checked=await manager.check();result={protocol:"NVS_DESKTOP_RUNTIME_UPDATES_V1",activeVersion:checked.installation.activeVersion,versions:checked.available.map(v=>({version:v.version,rejected:checked.rejectedVersions.includes(v.version)})),notifications:checked.notifications};break}case"speech-prepare":{const prepared=await prepareInstalledCpuSpeech(manager,request.input),plan=prepared.plan;result={protocol:"NVS_DESKTOP_OWNER_PLAN_V1",plan:{kind:"APPLY",toolMode:plan.toolSelection?.mode,planId:plan.planId,fingerprint:plan.fingerprint,version:plan.release.descriptor.version,previousVersion:(await manager.status()).activeVersion,expiresAt:plan.expiresAt,phase:"PREPARED"}};break}case"prepare":case"tools-prepare":{const choice=request.operation==="tools-prepare"?request.choice.mode==="MANAGED"?request.choice:await captureInstalledTools(request.choice):void 0;const plan=await manager.prepare(request.version,choice);result={protocol:"NVS_DESKTOP_OWNER_PLAN_V1",plan:{kind:"APPLY",...choice?{toolMode:choice.mode}:{},planId:plan.planId,fingerprint:plan.fingerprint,version:plan.release.descriptor.version,previousVersion:(await manager.status()).activeVersion,expiresAt:plan.expiresAt,phase:"PREPARED"}};break}case"recovery":{const current=(await manager.ledger.current()).value,transition=current.transition;let plan=null;if(transition){const original=await manager.plan(transition.planId);if(original.fingerprint!==transition.fingerprint)fail("PLAN_CHANGED");plan={kind:"RECOVER",planId:original.planId,fingerprint:original.fingerprint,version:original.release.descriptor.version,previousVersion:transition.previous?.descriptor.version??null,expiresAt:original.expiresAt,phase:transition.phase}}result={protocol:"NVS_DESKTOP_OWNER_PLAN_V1",plan};break}case"apply":case"recover":if(request.operation==="apply")await manager.apply(request.planId,request.fingerprint);else await manager.reconcile(request.planId,request.fingerprint);result=await desktopRuntimeStatus(manager);break;case"reject":await manager.reject(request.version);result=await desktopRuntimeStatus(manager);break}return desktopOwnerResponses[request.operation].parse(result)}import{lstat,readFile,chmod}from"node:fs/promises";import{join as join2,isAbsolute,dirname}from"node:path";async function verifiedSource(source,expected,limit){if(!isAbsolute(source)||!/^[a-f0-9]{64}$/.test(expected))fail("DESKTOP_DISTRIBUTION_INVALID");const stat=await lstat(source);if(!stat.isFile()||stat.isSymbolicLink()||stat.size>limit)fail("DESKTOP_DISTRIBUTION_INVALID");const bytes=await readFile(source);if(bytes.length>limit||sha256(bytes)!==expected)fail("DESKTOP_DISTRIBUTION_INVALID");return bytes}async function retain(target,bytes,expected,limit,mode){try{if(sha256(await read(target,limit))!==expected)fail("DESKTOP_DISTRIBUTION_INVALID")}catch(error){if(error.code!=="ENOENT")throw error;try{await write(target,bytes,true)}catch(error2){if(error2.code!=="EEXIST")throw error2}if(sha256(await read(target,limit))!==expected)fail("DESKTOP_DISTRIBUTION_INVALID")}await chmod(target,mode)}async function materializeDesktopNode(home,source,expected,licenseDigest){const bytes=await verifiedSource(source,expected,160*1024*1024);const license=licenseDigest?await verifiedSource(join2(dirname(source),"LICENSE.txt"),licenseDigest,2*1024*1024):null;const base=await directory(join2(await directory(home),"nodes",expected)),target=join2(base,process.platform==="win32"?"node.exe":"node");if(license)await retain(join2(base,"LICENSE.txt"),license,licenseDigest,2*1024*1024,256);await retain(target,bytes,expected,160*1024*1024,320);return target}async function runLocalManagement(home,operation){if(!["status","start","stop"].includes(operation))throw Error("INVALID_INPUT");const manager=await LocalInstallationManager.open(home);if(operation==="start")await manager.start();if(operation==="stop")await manager.stop();return desktopRuntimeStatus(manager)}export{DesktopDeviceReplySchema,DesktopDeviceScopeSchema,DesktopLibraryImportRequestSchema,DesktopLibraryImportSeedSchema,DesktopLibraryMediaRequestSchema,DesktopLibraryPrepareRequestSchema,DesktopLibraryReplySchema,DesktopLibraryRequestSchema,DesktopOwnerRequestSchema,desktopDeviceConnector,desktopDevicePending,desktopOwnerResponses,desktopRuntimeChannel,materializeDesktopNode,prepareDesktopLibraryImport,runDesktopLibraryMedia,runDesktopOwnerRequest,runLocalManagement};
|
package/dist/local-navigation.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{LocalMcpTools}from"./_chunks/chunk-
|
|
1
|
+
import{LocalMcpTools}from"./_chunks/chunk-CUCC4RFF.js";import{DesktopDeviceScopeSchema,desktopDeviceConnector}from"./_chunks/chunk-EPH3TRYV.js";import"./_chunks/chunk-VKXFHOAR.js";import"./_chunks/chunk-EOWXXTEF.js";import"./_chunks/chunk-XMZKBILZ.js";import"./_chunks/chunk-UOYNCE7I.js";import"./_chunks/chunk-AZQLZA47.js";import"./_chunks/chunk-Z44SK6DZ.js";import"./_chunks/chunk-M32FI2OA.js";import"./_chunks/chunk-TT7IA5HB.js";async function openDesktopDeviceTools(raw,home){const scope=DesktopDeviceScopeSchema.parse(raw);return LocalMcpTools.open(await desktopDeviceConnector(home,scope),home)}export{LocalMcpTools,openDesktopDeviceTools};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nativestudio/cli",
|
|
3
|
-
"version": "0.3.0-rc.
|
|
3
|
+
"version": "0.3.0-rc.27",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"engines": {
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"zod": "4.6.7",
|
|
22
|
-
"@modelcontextprotocol/client": "2.4.0"
|
|
22
|
+
"@modelcontextprotocol/client": "2.4.0",
|
|
23
|
+
"@linbuilds/resourcesdk": "0.3.2"
|
|
23
24
|
},
|
|
24
25
|
"bin": {
|
|
25
26
|
"nvs": "./dist/entry.js"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{FileOAuthProvider,withProfileLock}from"./chunk-7I7ARCY7.js";import{directory,optional,privateDirectory,write}from"./chunk-DLW42PJ6.js";import{CliAccountExchangeSchema,CliAccountIdentitySchema,CliAccountSessionSchema,CliAccountStartSchema,CliAccountStartedSchema,ProjectLibraryPageSchema,ProjectWorkspaceSchema}from"./chunk-WTJVS2VS.js";import{secureEndpoint}from"./chunk-KOCUZ3AE.js";import{NativeStudioSdkError}from"./chunk-TT7IA5HB.js";import{homedir}from"node:os";import{isAbsolute,join}from"node:path";import{realpath}from"node:fs/promises";function connectionError(code){throw new NativeStudioSdkError(code,"INVALID_INPUT","NO_WRITE")}async function clientHome(environment,create=false){const path=environment.NATIVESTUDIO_CLIENT_HOME??join(homedir(),".nativestudio","client");if(!isAbsolute(path))connectionError("CLIENT_HOME_ABSOLUTE_REQUIRED");if(create)return directory(path);await privateDirectory(path);const root=await realpath(path);if(/(?:^|[\\/])(?:node_modules|_npx)(?:[\\/]|$)/.test(root))connectionError("CLIENT_HOME_PRIVATE_REQUIRED");return root}import{join as join2}from"node:path";import{z as z2}from"zod";import{z}from"zod";function accountServerOrigin(value){const url=new URL(value);if(url.pathname!=="/"||url.search||url.hash||url.username||url.password||!(url.protocol==="https:"||url.protocol==="http:"&&["127.0.0.1","localhost","[::1]"].includes(url.hostname)))throw new NativeStudioSdkError("ACCOUNT_SERVER_ORIGIN_REQUIRED","INVALID_INPUT","NO_WRITE");return url.origin}var NativeStudioAccountClient=class{constructor(options){this.options=options;this.serverOrigin=accountServerOrigin(options.serverOrigin);if(options.accessToken&&!/^nvsh_[A-Za-z0-9_-]{43}$/.test(options.accessToken))throw new NativeStudioSdkError("INVALID_ACCOUNT_CREDENTIAL","INVALID_INPUT","NO_WRITE")}options;serverOrigin;async request(action,schema,options={}){if(options.credential&&!this.options.accessToken)throw new NativeStudioSdkError("ACCOUNT_LOGIN_REQUIRED","INVALID_INPUT","NO_WRITE");const write2=options.body!==void 0;let response;try{response=await(this.options.fetch??fetch)(`${this.serverOrigin}/api/cli-account/${action}${options.query?"?"+options.query:""}`,{method:write2?"POST":"GET",cache:"no-store",redirect:"error",credentials:"omit",signal:AbortSignal.any([AbortSignal.timeout(15e3),...options.signal?[options.signal]:[]]),headers:{...write2?{"content-type":"application/json"}:{},...options.credential?{authorization:"Bearer "+this.options.accessToken}:{}},...write2?{body:JSON.stringify(options.body)}:{}})}catch{throw new NativeStudioSdkError("ACCOUNT_TRANSPORT_FAILED","BLOCKED",write2?"UNKNOWN":"NO_WRITE")}if(!response.ok){await response.body?.cancel();throw new NativeStudioSdkError(response.status===401?"ACCOUNT_SESSION_EXPIRED_OR_REVOKED":"ACCOUNT_REQUEST_REJECTED","BLOCKED",write2&&response.status>=500?"UNKNOWN":"REJECTED",response.status)}try{if(!(response.headers.get("content-type")??"").startsWith("application/json"))throw Error();const reader=response.body?.getReader();if(!reader)throw Error();const chunks=[];let size=0;try{while(true){const part=await reader.read();if(part.done)break;size+=part.value.byteLength;if(size>1024*1024){await reader.cancel();throw Error()}chunks.push(part.value)}}finally{reader.releaseLock()}const bytes=new Uint8Array(size);let offset=0;for(const part of chunks){bytes.set(part,offset);offset+=part.length}return schema.parse(JSON.parse(new TextDecoder().decode(bytes)))}catch{throw new NativeStudioSdkError("ACCOUNT_RESPONSE_INVALID","BLOCKED",write2?"UNKNOWN":"NO_WRITE")}}async metadata(signal){return this.request("metadata",z.strictObject({protocol:z.literal("NVS_CLI_ACCOUNT_V1"),serverOrigin:z.literal(this.serverOrigin)}),{signal})}start(input,signal){return this.request("start",CliAccountStartedSchema,{body:CliAccountStartSchema.parse(input),signal})}exchange(input,signal){return this.request("exchange",CliAccountSessionSchema,{body:CliAccountExchangeSchema.parse(input),signal})}me(signal){return this.request("me",CliAccountIdentitySchema,{credential:true,signal})}logout(signal){return this.request("logout",z.strictObject({changed:z.literal(true)}),{credential:true,body:{},signal})}async projects(input,signal){const value=z.strictObject({tenantId:z.uuid(),limit:z.number().int().min(1).max(100).optional(),next:z.string().min(1).max(8192).optional()}).parse(input);const result=await this.request("projects",ProjectLibraryPageSchema,{credential:true,signal,query:new URLSearchParams({tenantId:value.tenantId,...value.limit?{limit:String(value.limit)}:{},...value.next?{next:value.next}:{}})});if(result.items.some(p=>p.tenantId!==value.tenantId))throw new NativeStudioSdkError("ACCOUNT_RESPONSE_SCOPE_MISMATCH","BLOCKED","NO_WRITE");return result}async project(input,signal){const value=z.strictObject({tenantId:z.uuid(),projectId:z.uuid()}).parse(input);const result=await this.request("project",ProjectWorkspaceSchema,{credential:true,signal,query:new URLSearchParams(value)});if(result.project.id!==value.projectId||result.project.tenantId!==value.tenantId)throw new NativeStudioSdkError("ACCOUNT_RESPONSE_SCOPE_MISMATCH","BLOCKED","NO_WRITE");return result}};var AccountStateSchema=z2.strictObject({version:z2.literal(1),epoch:z2.uuid(),serverOrigin:z2.string().refine(v=>{try{return accountServerOrigin(v)===v}catch{return false}}),principalId:z2.uuid(),expiresAt:z2.iso.datetime(),workspaceId:z2.uuid().nullable(),projectId:z2.uuid().nullable(),state:z2.enum(["ACTIVE","REVOKE_PENDING","SIGNED_OUT"]),accessToken:z2.string().regex(/^nvsh_[A-Za-z0-9_-]{43}$/).nullable()}).refine(v=>v.state==="SIGNED_OUT"===(v.accessToken===null)&&(!v.projectId||Boolean(v.workspaceId)));function accountError(code,outcome="NO_WRITE"){throw new NativeStudioSdkError(code,outcome==="UNKNOWN"?"INTERNAL_OPERATIONAL_FAILURE":["ACCOUNT_LOGIN_INPUT_INVALID","ACCOUNT_COMMAND_INPUT_INVALID"].includes(code)?"INVALID_INPUT":"BLOCKED",outcome)}async function readAccount(root){const value=await optional(join2(root,"account.json"));if(value===null)return null;const parsed=AccountStateSchema.safeParse(value);if(!parsed.success)accountError("ACCOUNT_STATE_INVALID");return parsed.data}async function saveAccount(root,value){const account=AccountStateSchema.parse(value);await write(join2(root,"account.json"),JSON.stringify(account))}async function withAccountLock(root,action){try{return await withProfileLock(join2(root,"account.json"),action)}catch(error){if(error.code==="EEXIST")accountError("ACCOUNT_COMMAND_BUSY");throw error}}function requireAccount(value){if(!value)accountError("ACCOUNT_LOGIN_REQUIRED");if(value.state==="REVOKE_PENDING")accountError("ACCOUNT_LOGOUT_OUTCOME_UNKNOWN","UNKNOWN");if(value.state!=="ACTIVE"||Date.parse(value.expiresAt)<=Date.now())accountError("ACCOUNT_LOGIN_REQUIRED");return value}import{join as join3}from"node:path";var uuid="[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";var tenantPath=new RegExp(`^/mcp/external/v1/tenants/(${uuid})$`,"i");function tenantConnection(resource){const url=secureEndpoint(resource),match=tenantPath.exec(url.pathname);if(!match)connectionError("TENANT_MCP_URL_REQUIRED");return{resource:url.href,tenantId:match[1].toLowerCase()}}async function saveConnection(root,profile,expectedEpoch){return withAccountLock(root,()=>saveConnectionLocked(root,profile,expectedEpoch))}async function saveConnectionLocked(root,profile,expectedEpoch){if(!/^profile-[0-9a-f-]{36}\.json$/.test(profile))throw Error();const provider=await FileOAuthProvider.load(join3(root,profile));const scope=tenantConnection(provider.data.resource);if(!provider.data.token?.access_token||provider.data.pendingExchange)throw Error();const account=await readAccount(root);if(account?.epoch!==expectedEpoch)connectionError("ACCOUNT_CHANGED_DURING_CONNECTION");if(account&&(account.state!=="ACTIVE"||account.workspaceId!==scope.tenantId))connectionError("ACCOUNT_WORKSPACE_SELECTION_REQUIRED");await write(join3(root,"connection.json"),JSON.stringify({version:3,profile,...scope,...account?{accountEpoch:account.epoch}:{}}));return{scope:provider.data.token.scope??provider.data.scope,expiresAt:provider.data.expiresAt}}async function loadConnection(environment){let root;try{root=await clientHome(environment)}catch(e){if(e.code==="ENOENT")return null;throw e}const value=await optional(join3(root,"connection.json"));if(value===null)return null;if(value.version!==3||typeof value.profile!=="string"||!/^profile-[0-9a-f-]{36}\.json$/.test(value.profile)||typeof value.resource!=="string")connectionError("CONNECTION_INVALID");const scope=tenantConnection(value.resource);if(scope.tenantId!==value.tenantId||value.projectId!==void 0)connectionError("CONNECTION_SCOPE_MISMATCH");const account=await readAccount(root);if(value.accountEpoch!==void 0&&(!account||typeof value.accountEpoch!=="string"))connectionError("CONNECTION_ACCOUNT_MISMATCH");if(account&&(account.state!=="ACTIVE"||value.accountEpoch!==account.epoch||scope.tenantId!==account.workspaceId))connectionError("CONNECTION_ACCOUNT_MISMATCH");const profile=join3(root,value.profile),provider=await FileOAuthProvider.load(profile);if(provider.data.resource!==scope.resource||!provider.data.token?.access_token)connectionError("CONNECTION_PROFILE_MISMATCH");return{...scope,profile,scope:provider.data.token.scope??provider.data.scope,requestedScope:provider.data.scope,expiresAt:provider.data.expiresAt,exchangeUnresolved:Boolean(provider.data.pendingExchange)}}var authentication=["--profile","--origin","--mcp-url","--token-env","--token-file"];async function defaultConnection(options,environment,tenant){if(authentication.some(key=>options.has(key)))return;const connection=await loadConnection(environment);if(!connection)connectionError("TENANT_CONNECTION_REQUIRED");if(options.has("--tenant")&&options.get("--tenant")!==connection.tenantId)connectionError("CONNECTION_SCOPE_MISMATCH");options.set("--profile",connection.profile);if(tenant)options.set("--tenant",connection.tenantId)}async function connectionStatus(environment){const value=await loadConnection(environment);return{exitCode:0,output:value?{semanticStatus:"SUCCESS",connected:true,credentialPurpose:"TENANT_MCP",accountSessionVerified:false,verification:"LOCAL_METADATA_ONLY",resource:value.resource,tenantId:value.tenantId,scope:value.scope,requestedScope:value.requestedScope,expiresAt:value.expiresAt,credentialState:value.exchangeUnresolved?"EXCHANGE_UNRESOLVED":typeof value.expiresAt==="number"&&value.expiresAt>Date.now()+3e4?"CACHED":"REFRESH_REQUIRED",nextSteps:value.exchangeUnresolved?["Wait for the active authorization command. If it returned OAUTH_OUTCOME_UNKNOWN, run nvs connect --mcp-url <workspace-connection-url>."]:["nvs find --query <intent>","nvs capabilities","nvs mcp"]}:{semanticStatus:"NEEDS_INPUT",connected:false,credentialPurpose:"TENANT_MCP",accountSessionVerified:false,nextSteps:["Open Agent access in the workspace settings, then authorize the workspace once.","nvs connect --mcp-url <workspace-connection-url>"]}}}export{connectionError,clientHome,accountServerOrigin,NativeStudioAccountClient,accountError,readAccount,saveAccount,withAccountLock,requireAccount,tenantConnection,saveConnection,loadConnection,defaultConnection,connectionStatus};
|