dsh-plugin-comfy-scratch 0.0.0-stage → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +133 -0
- package/README.md +102 -2
- package/cordis.patch.yml +3 -0
- package/dist/client/index.d.ts +13 -0
- package/dist/client.js +34733 -0
- package/dist/host/index.d.ts +227 -0
- package/dist/host/index.js +39578 -0
- package/icon.svg +8 -0
- package/locale/en.json +22 -0
- package/locale/zh.json +22 -0
- package/package.json +116 -4
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import z from '@deepseek-ai/schemastery';
|
|
3
|
+
import { inspectAndSanitizeWildWorkflow } from '../compiler/index.js';
|
|
4
|
+
import type { LiveConfigValue } from '../dsh-ambient.js';
|
|
5
|
+
import { type CustomTwinGpuProfileInput, type DetectedGpuHardwareInfo, type DiscoveredDistroCandidate, type DiskVolumeSpaceInfo, type EnvironmentDiagnosticReport, type ExecutionGateMode, type HardwareBackendProfile, type HardwareProfileSetting, type HardwareTierId, type SimulatorMode, type SseEventType, type TwinGpuProfileId, type TwinGpuProfileSpec } from '../shared/index.js';
|
|
6
|
+
import { BootstrapSimulator, CustomNodeSimulator, LoraHubSimulator, TrainerCloudSimulator, type Rx9070XtSimulator } from '../simulator/index.js';
|
|
7
|
+
import { BootstrapProvisioner, type BootstrapSubprocessRunner } from './bootstrap-provisioner.js';
|
|
8
|
+
import { CustomNodeManager } from './custom-node-manager.js';
|
|
9
|
+
import { ComfyClient } from './comfy-client.js';
|
|
10
|
+
import { GalleryLibrary } from './gallery-library.js';
|
|
11
|
+
import { LoraHub, type LoraSourceEndpoints } from './lora-hub.js';
|
|
12
|
+
import { type AtomicReplaceFsOps, type DnsLookupFn } from './network-security.js';
|
|
13
|
+
import { PresetLibrary } from './preset-library.js';
|
|
14
|
+
import { ProcessManager, type ProcessPrioritySetter, type ProcessSpawner, type ProcessTreeKiller } from './process-manager.js';
|
|
15
|
+
import { QueueScheduler } from './queue-scheduler.js';
|
|
16
|
+
import { TrainerHub } from './trainer-hub.js';
|
|
17
|
+
import { SilentDeadlockWatchdog } from './watchdog.js';
|
|
18
|
+
export * from './comfy-client.js';
|
|
19
|
+
export * from './distro-detector.js';
|
|
20
|
+
export * from './gguf-security.js';
|
|
21
|
+
export * from './gallery-library.js';
|
|
22
|
+
export * from './bootstrap-provisioner.js';
|
|
23
|
+
export * from './custom-node-manager.js';
|
|
24
|
+
export * from './lora-hub.js';
|
|
25
|
+
export * from './mask-inspector.js';
|
|
26
|
+
export * from './network-security.js';
|
|
27
|
+
export * from './preset-library.js';
|
|
28
|
+
export * from './process-manager.js';
|
|
29
|
+
export * from './watchdog.js';
|
|
30
|
+
export * from './queue-scheduler.js';
|
|
31
|
+
export * from './stage-page.js';
|
|
32
|
+
export * from './tools.js';
|
|
33
|
+
export * from './trainer-hub.js';
|
|
34
|
+
export * from './xy-grid-compositor.js';
|
|
35
|
+
export * from './batch-sweep-manager.js';
|
|
36
|
+
export declare const PLUGIN_VERSION = "0.2.1";
|
|
37
|
+
export declare const API_PREFIX = "/comfy-scratch";
|
|
38
|
+
/** Cordis root plugin name — must match bare package name for dsh-client-modules. */
|
|
39
|
+
export declare const name = "dsh-plugin-comfy-scratch";
|
|
40
|
+
/** Required Host services (agents/settings resolved optionally via ctx.get). */
|
|
41
|
+
export declare const inject: readonly ["webServer", "connection", "tools"];
|
|
42
|
+
export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
43
|
+
comfyBaseUrl: z<string, string, "volatile-defined">;
|
|
44
|
+
comfyInstallDir: z<string, string, "volatile-defined">;
|
|
45
|
+
comfySharedDir: z<string, string, "volatile-defined">;
|
|
46
|
+
simulatorMode: z<"disabled" | "rx9070xt_twin", "disabled" | "rx9070xt_twin", "volatile-defined">;
|
|
47
|
+
hardwareProfile: z<"rocm_rx9070xt" | "cuda_nvidia" | "auto", "rocm_rx9070xt" | "cuda_nvidia" | "auto", "volatile-defined">;
|
|
48
|
+
pythonExecPath: z<string, string, "volatile-defined">;
|
|
49
|
+
defaultGateMode: z<"auto_run" | "review_first", "auto_run" | "review_first", "volatile-defined">;
|
|
50
|
+
defaultTier: z<"safe_720p" | "balanced_864p" | "high_1080p", "safe_720p" | "balanced_864p" | "high_1080p", "volatile-defined">;
|
|
51
|
+
watchdogSilentMs: z<number, number, "volatile-defined">;
|
|
52
|
+
autoPurgeIdleMs: z<number, number, "volatile-defined">;
|
|
53
|
+
belowNormalPriority: z<boolean, boolean, "volatile-defined">;
|
|
54
|
+
proxyUrl: z<string, string, "volatile-defined">;
|
|
55
|
+
civitaiApiKey: z<string, string, "volatile-defined">;
|
|
56
|
+
hfToken: z<string, string, "volatile-defined">;
|
|
57
|
+
cloudTrainerBaseUrl: z<string, string, "volatile-defined">;
|
|
58
|
+
cloudTrainerApiKey: z<string, string, "volatile-defined">;
|
|
59
|
+
}>>, Schemastery.ObjectT<NoInfer<{
|
|
60
|
+
comfyBaseUrl: z<string, string, "volatile-defined">;
|
|
61
|
+
comfyInstallDir: z<string, string, "volatile-defined">;
|
|
62
|
+
comfySharedDir: z<string, string, "volatile-defined">;
|
|
63
|
+
simulatorMode: z<"disabled" | "rx9070xt_twin", "disabled" | "rx9070xt_twin", "volatile-defined">;
|
|
64
|
+
hardwareProfile: z<"rocm_rx9070xt" | "cuda_nvidia" | "auto", "rocm_rx9070xt" | "cuda_nvidia" | "auto", "volatile-defined">;
|
|
65
|
+
pythonExecPath: z<string, string, "volatile-defined">;
|
|
66
|
+
defaultGateMode: z<"auto_run" | "review_first", "auto_run" | "review_first", "volatile-defined">;
|
|
67
|
+
defaultTier: z<"safe_720p" | "balanced_864p" | "high_1080p", "safe_720p" | "balanced_864p" | "high_1080p", "volatile-defined">;
|
|
68
|
+
watchdogSilentMs: z<number, number, "volatile-defined">;
|
|
69
|
+
autoPurgeIdleMs: z<number, number, "volatile-defined">;
|
|
70
|
+
belowNormalPriority: z<boolean, boolean, "volatile-defined">;
|
|
71
|
+
proxyUrl: z<string, string, "volatile-defined">;
|
|
72
|
+
civitaiApiKey: z<string, string, "volatile-defined">;
|
|
73
|
+
hfToken: z<string, string, "volatile-defined">;
|
|
74
|
+
cloudTrainerBaseUrl: z<string, string, "volatile-defined">;
|
|
75
|
+
cloudTrainerApiKey: z<string, string, "volatile-defined">;
|
|
76
|
+
}>>, "plain">;
|
|
77
|
+
export interface RuntimeEnvOverrides {
|
|
78
|
+
simulatorMode?: SimulatorMode;
|
|
79
|
+
comfyInstallDir?: string;
|
|
80
|
+
comfySharedDir?: string;
|
|
81
|
+
pythonExecPath?: string;
|
|
82
|
+
hardwareProfile?: HardwareProfileSetting;
|
|
83
|
+
comfyBaseUrl?: string;
|
|
84
|
+
}
|
|
85
|
+
export interface HostPluginRawConfig {
|
|
86
|
+
readonly comfyBaseUrl?: LiveConfigValue<string>;
|
|
87
|
+
readonly comfyInstallDir?: LiveConfigValue<string>;
|
|
88
|
+
readonly comfySharedDir?: LiveConfigValue<string>;
|
|
89
|
+
readonly simulatorMode?: LiveConfigValue<SimulatorMode>;
|
|
90
|
+
readonly hardwareProfile?: LiveConfigValue<HardwareProfileSetting>;
|
|
91
|
+
readonly pythonExecPath?: LiveConfigValue<string>;
|
|
92
|
+
readonly defaultGateMode?: LiveConfigValue<ExecutionGateMode>;
|
|
93
|
+
readonly defaultTier?: LiveConfigValue<HardwareTierId>;
|
|
94
|
+
readonly watchdogSilentMs?: LiveConfigValue<number>;
|
|
95
|
+
readonly autoPurgeIdleMs?: LiveConfigValue<number>;
|
|
96
|
+
readonly belowNormalPriority?: LiveConfigValue<boolean>;
|
|
97
|
+
readonly proxyUrl?: LiveConfigValue<string>;
|
|
98
|
+
readonly civitaiApiKey?: LiveConfigValue<string>;
|
|
99
|
+
readonly hfToken?: LiveConfigValue<string>;
|
|
100
|
+
readonly cloudTrainerBaseUrl?: LiveConfigValue<string>;
|
|
101
|
+
readonly cloudTrainerApiKey?: LiveConfigValue<string>;
|
|
102
|
+
}
|
|
103
|
+
export interface ResolvedHostSettings {
|
|
104
|
+
readonly comfyBaseUrl: string;
|
|
105
|
+
readonly comfyInstallDir: string;
|
|
106
|
+
readonly comfySharedDir: string;
|
|
107
|
+
readonly simulatorMode: SimulatorMode;
|
|
108
|
+
readonly configuredHardwareProfile: HardwareProfileSetting;
|
|
109
|
+
readonly hardwareProfile: HardwareBackendProfile;
|
|
110
|
+
readonly pythonExecPath: string;
|
|
111
|
+
readonly defaultGateMode: ExecutionGateMode;
|
|
112
|
+
readonly defaultTier: HardwareTierId;
|
|
113
|
+
readonly watchdogSilentMs: number;
|
|
114
|
+
readonly autoPurgeIdleMs: number;
|
|
115
|
+
readonly belowNormalPriority: boolean;
|
|
116
|
+
readonly proxyUrl: string;
|
|
117
|
+
readonly civitaiApiKey: string;
|
|
118
|
+
readonly hfToken: string;
|
|
119
|
+
readonly cloudTrainerBaseUrl: string;
|
|
120
|
+
readonly cloudTrainerApiKey: string;
|
|
121
|
+
}
|
|
122
|
+
export interface HostRuntimeDeps {
|
|
123
|
+
readonly simulator?: Rx9070XtSimulator;
|
|
124
|
+
readonly simulatorFactory?: (hooks: {
|
|
125
|
+
readonly onStdoutLine: (line: string) => void;
|
|
126
|
+
}) => Rx9070XtSimulator;
|
|
127
|
+
readonly spawner?: ProcessSpawner;
|
|
128
|
+
readonly processTreeKiller?: ProcessTreeKiller;
|
|
129
|
+
readonly isPidAlive?: (pid: number) => boolean;
|
|
130
|
+
readonly killVerifyTimeoutMs?: number;
|
|
131
|
+
readonly prioritySetter?: ProcessPrioritySetter;
|
|
132
|
+
readonly resolvePythonExecutable?: (installDir: string) => string;
|
|
133
|
+
readonly runtimeTempDir?: string;
|
|
134
|
+
readonly getSystemIdleMs?: () => Promise<number> | number;
|
|
135
|
+
readonly getCurrentGateMode?: () => ExecutionGateMode;
|
|
136
|
+
readonly cancelConfirmTimeoutMs?: number;
|
|
137
|
+
readonly watchdogCheckIntervalMs?: number;
|
|
138
|
+
readonly idlePollIntervalMs?: number;
|
|
139
|
+
readonly coldStartTimeoutMs?: number;
|
|
140
|
+
readonly restartReadyTimeoutMs?: number;
|
|
141
|
+
readonly pollIntervalMs?: number;
|
|
142
|
+
readonly now?: () => number;
|
|
143
|
+
readonly randomSeedGenerator?: () => number;
|
|
144
|
+
readonly fetchImpl?: typeof fetch;
|
|
145
|
+
readonly dnsLookup?: DnsLookupFn;
|
|
146
|
+
readonly allowedOutboundOrigins?: readonly string[];
|
|
147
|
+
readonly loraHub?: LoraHub;
|
|
148
|
+
readonly loraSimulator?: LoraHubSimulator;
|
|
149
|
+
readonly loraEndpoints?: Partial<LoraSourceEndpoints>;
|
|
150
|
+
readonly loraFetchImpl?: typeof fetch;
|
|
151
|
+
readonly loraProbeTimeoutMs?: number;
|
|
152
|
+
readonly loraSearchTimeoutMs?: number;
|
|
153
|
+
readonly loraMaxDownloadBytes?: number;
|
|
154
|
+
readonly loraReadTimeoutMs?: number;
|
|
155
|
+
readonly loraFileOps?: AtomicReplaceFsOps;
|
|
156
|
+
readonly trainerHub?: TrainerHub;
|
|
157
|
+
readonly trainerSimulator?: TrainerCloudSimulator;
|
|
158
|
+
readonly trainerCloudWorkerBaseUrl?: string;
|
|
159
|
+
readonly trainerTrustedCredentialOrigins?: readonly string[];
|
|
160
|
+
readonly trainerFetchImpl?: typeof fetch;
|
|
161
|
+
readonly trainerPollIntervalMs?: number;
|
|
162
|
+
readonly trainerCancelTimeoutMs?: number;
|
|
163
|
+
readonly trainerMaxArtifactBytes?: number;
|
|
164
|
+
readonly trainerReadTimeoutMs?: number;
|
|
165
|
+
readonly trainerFileOps?: AtomicReplaceFsOps;
|
|
166
|
+
readonly bootstrapProvisioner?: BootstrapProvisioner;
|
|
167
|
+
readonly bootstrapSimulator?: BootstrapSimulator;
|
|
168
|
+
readonly bootstrapSubprocessRunner?: BootstrapSubprocessRunner;
|
|
169
|
+
readonly customNodeManager?: CustomNodeManager;
|
|
170
|
+
readonly customNodeSimulator?: CustomNodeSimulator;
|
|
171
|
+
readonly customNodeSubprocessRunner?: BootstrapSubprocessRunner;
|
|
172
|
+
readonly gpuDetector?: () => Promise<DetectedGpuHardwareInfo>;
|
|
173
|
+
readonly diskScanner?: () => Promise<readonly DiskVolumeSpaceInfo[]>;
|
|
174
|
+
readonly distroScanner?: (customRootDir?: string) => Promise<readonly DiscoveredDistroCandidate[]>;
|
|
175
|
+
readonly dshHome?: string;
|
|
176
|
+
/** Persistent fallback shared dir (`<DSH_HOME>/storages/comfy-scratch-shared`) for zero-config DSH in-app installs. */
|
|
177
|
+
readonly autoPersistentSharedDir?: string;
|
|
178
|
+
readonly maxWorkflowImportBytes?: number;
|
|
179
|
+
readonly inspectWorkflow?: typeof inspectAndSanitizeWildWorkflow;
|
|
180
|
+
readonly galleryLibrary?: GalleryLibrary;
|
|
181
|
+
}
|
|
182
|
+
export interface HostRuntimeInstance {
|
|
183
|
+
readonly settings: ResolvedHostSettings;
|
|
184
|
+
readonly comfyClient: ComfyClient;
|
|
185
|
+
readonly processManager: ProcessManager;
|
|
186
|
+
readonly watchdog: SilentDeadlockWatchdog;
|
|
187
|
+
readonly queueScheduler: QueueScheduler;
|
|
188
|
+
readonly loraHub: LoraHub;
|
|
189
|
+
readonly trainerHub: TrainerHub;
|
|
190
|
+
readonly presetLibrary: PresetLibrary;
|
|
191
|
+
readonly galleryLibrary: GalleryLibrary;
|
|
192
|
+
readonly bootstrapProvisioner: BootstrapProvisioner;
|
|
193
|
+
readonly customNodeManager: CustomNodeManager;
|
|
194
|
+
waitForGalleryArchiveIdle(): Promise<void>;
|
|
195
|
+
getTwinProfiles(): {
|
|
196
|
+
readonly activeProfileId: TwinGpuProfileId;
|
|
197
|
+
readonly profiles: readonly TwinGpuProfileSpec[];
|
|
198
|
+
};
|
|
199
|
+
selectTwinProfile(profileId: TwinGpuProfileId): Promise<EnvironmentDiagnosticReport>;
|
|
200
|
+
saveCustomTwinProfile(input: CustomTwinGpuProfileInput): Promise<{
|
|
201
|
+
readonly created: TwinGpuProfileSpec;
|
|
202
|
+
readonly profiles: readonly TwinGpuProfileSpec[];
|
|
203
|
+
readonly report: EnvironmentDiagnosticReport;
|
|
204
|
+
}>;
|
|
205
|
+
deleteCustomTwinProfile(profileId: TwinGpuProfileId): Promise<{
|
|
206
|
+
readonly profiles: readonly TwinGpuProfileSpec[];
|
|
207
|
+
readonly activeProfileId: TwinGpuProfileId;
|
|
208
|
+
readonly report: EnvironmentDiagnosticReport;
|
|
209
|
+
}>;
|
|
210
|
+
inspectEnvironment(): Promise<EnvironmentDiagnosticReport>;
|
|
211
|
+
scanLocalDistros(customRootDir?: string): Promise<readonly DiscoveredDistroCandidate[]>;
|
|
212
|
+
applyEnvironmentOverrides(patch: RuntimeEnvOverrides): Promise<EnvironmentDiagnosticReport>;
|
|
213
|
+
dispose(): Promise<void>;
|
|
214
|
+
}
|
|
215
|
+
/** Reads either a plain value or a schemastery `.volatile()` live reference. */
|
|
216
|
+
export declare function liveValue<T>(value: LiveConfigValue<T> | undefined): T | undefined;
|
|
217
|
+
export declare function createHostSettingsReader(config?: HostPluginRawConfig, options?: {
|
|
218
|
+
readonly getOverrides?: () => RuntimeEnvOverrides;
|
|
219
|
+
readonly getDetectedGpu?: () => DetectedGpuHardwareInfo | null;
|
|
220
|
+
readonly dshHome?: string;
|
|
221
|
+
}): ResolvedHostSettings;
|
|
222
|
+
export declare function createHostRuntime(settings: ResolvedHostSettings, deps?: HostRuntimeDeps, callbacks?: {
|
|
223
|
+
readonly onSseBroadcast?: <T>(type: SseEventType, payload: T) => void;
|
|
224
|
+
readonly onStateSnapshotChange?: () => void;
|
|
225
|
+
}): HostRuntimeInstance;
|
|
226
|
+
export declare function apply(ctx: Context, config?: HostPluginRawConfig, runtimeDeps?: HostRuntimeDeps): void;
|
|
227
|
+
//# sourceMappingURL=index.d.ts.map
|