comfy-ts 1.2.0 → 1.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.
- package/README.md +66 -0
- package/dist/DefinedWorkflow-C_QAxKr3.js +737 -0
- package/dist/DefinedWorkflow-C_QAxKr3.js.map +1 -0
- package/dist/DraftsSt-DcOTn0QR.js +434 -0
- package/dist/DraftsSt-DcOTn0QR.js.map +1 -0
- package/dist/cli.js +15 -5
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +476 -202
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +98 -40
- package/dist/index.d.ts +117 -59
- package/dist/index.js +468 -193
- package/dist/index.js.map +1 -1
- package/dist/run-serve-CN0DhrsA.js +638 -0
- package/dist/run-serve-CN0DhrsA.js.map +1 -0
- package/dist/{run-tui-BAdizWsO.js → run-tui-bN2hSD5i.js} +250 -447
- package/dist/run-tui-bN2hSD5i.js.map +1 -0
- package/dist/state-COlKYipO.js +4743 -0
- package/dist/state-COlKYipO.js.map +1 -0
- package/dist/web.d.ts +17340 -0
- package/dist/{state-BYbxDgfr.js → web.js} +1903 -1592
- package/dist/web.js.map +1 -0
- package/examples/web/example.ts +71 -0
- package/examples/web/index.html +77 -0
- package/examples/web/serve.ts +42 -0
- package/examples/web/tsconfig.json +15 -0
- package/package.json +10 -3
- package/src/cli/comfy-ts-cli.ts +15 -5
- package/src/cli/serve/ServeApp.ts +378 -0
- package/src/cli/serve/applyVarPayload.ts +119 -0
- package/src/cli/serve/describeVar.ts +74 -0
- package/src/cli/serve/run-serve.ts +169 -0
- package/src/cli/tui/components/StatusBar.tsx +1 -0
- package/src/cli/tui/components/TreePanel.tsx +17 -3
- package/src/cli/tui/components/TuiApp.tsx +7 -2
- package/src/cli/tui/components/VarsPanel.tsx +67 -34
- package/src/cli/tui/imageClipboard.ts +39 -0
- package/src/cli/tui/listWindow.ts +36 -0
- package/src/cli/tui/state/ExecSt.ts +48 -0
- package/src/cli/tui/state/TreeSt.ts +25 -0
- package/src/cli/tui/state/TuiSt.ts +34 -0
- package/src/coreExports.ts +118 -0
- package/src/host/ComfyHost.ts +23 -23
- package/src/host/ResilientWebsocket.ts +93 -47
- package/src/host/hostUrl.ts +2 -1
- package/src/host/loraManagerApi.ts +6 -7
- package/src/index.ts +8 -107
- package/src/litegraph/convertFlowToLiteGraphJSON.ts +11 -7
- package/src/manager/loaders/step2_custom-node-list-loader.ts +4 -4
- package/src/manager/loaders/step3_extension-node-map-loader.ts +3 -3
- package/src/manager/loaders/step4_model-list-loader.ts +7 -7
- package/src/manager/loaders/step5_alter-list-loader.ts +2 -2
- package/src/manager/loaders/step6_github-stats-loader.ts +2 -2
- package/src/runner/ComfyExecution.ts +32 -12
- package/src/runner/MediaImage.ts +18 -30
- package/src/runner/outputPath.ts +75 -0
- package/src/sdk-generator/ComfySchema.ts +2 -2
- package/src/sdk-generator/inputWidgetKind.ts +50 -11
- package/src/sdk-generator/litegraphToApiRequestPayload.ts +14 -7
- package/src/state.ts +13 -9
- package/src/storage/ComfyStorage.ts +144 -0
- package/src/storage/nodeStorage.ts +9 -0
- package/src/utils/downloadFile.ts +11 -69
- package/src/utils/hashArrayBuffer.ts +3 -4
- package/src/utils/lazySharp.ts +25 -0
- package/src/utils/sha1.ts +69 -0
- package/src/vars/ComfyVars.ts +13 -6
- package/src/vars/loraKeywords.ts +6 -6
- package/src/web.ts +13 -0
- package/dist/run-tui-BAdizWsO.js.map +0 -1
- package/dist/state-BYbxDgfr.js.map +0 -1
- package/src/utils/writeFile.ts +0 -16
package/src/vars/loraKeywords.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
|
|
2
1
|
import { observable, runInAction } from 'mobx'
|
|
3
|
-
import {
|
|
2
|
+
import { join } from 'pathe'
|
|
3
|
+
import { getComfyStorage } from 'src/storage/ComfyStorage.ts'
|
|
4
4
|
import { logError } from 'src/utils/log.ts'
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -21,9 +21,10 @@ function loadOnce(): void {
|
|
|
21
21
|
if (loaded) return
|
|
22
22
|
loaded = true
|
|
23
23
|
const path = filePath()
|
|
24
|
-
|
|
24
|
+
const text = getComfyStorage().readTextIfExists(path)
|
|
25
|
+
if (text == null) return
|
|
25
26
|
try {
|
|
26
|
-
const raw: unknown = JSON.parse(
|
|
27
|
+
const raw: unknown = JSON.parse(text)
|
|
27
28
|
if (raw == null || typeof raw !== 'object') return
|
|
28
29
|
runInAction(() => {
|
|
29
30
|
for (const [name, kw] of Object.entries(raw)) if (typeof kw === 'string') keywords.set(name, kw)
|
|
@@ -48,8 +49,7 @@ export function setLoraKeyword(name: string, keyword: string): void {
|
|
|
48
49
|
})
|
|
49
50
|
const path = filePath()
|
|
50
51
|
try {
|
|
51
|
-
|
|
52
|
-
writeFileSync(path, JSON.stringify(Object.fromEntries([...keywords.entries()].sort()), null, 2))
|
|
52
|
+
getComfyStorage().writeText(path, JSON.stringify(Object.fromEntries([...keywords.entries()].sort()), null, 2))
|
|
53
53
|
} catch (e) {
|
|
54
54
|
logError(`[loraKeywords] write failed ${path}: ${String(e)}`)
|
|
55
55
|
}
|
package/src/web.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* comfy-ts/web — the BROWSER entry (architecture item 13): same library,
|
|
3
|
+
* in-memory storage, native WebSocket, no sharp. Types still come from a
|
|
4
|
+
* generated sdk.d.ts included in the consumer's tsconfig.
|
|
5
|
+
* Importing both entries in one process: the LAST import wins the default
|
|
6
|
+
* backend — pass ComfyTS.create({ storage }) to be explicit (SSR setups).
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
import { createMemoryStorage, setDefaultComfyStorage } from 'src/storage/ComfyStorage.ts'
|
|
10
|
+
|
|
11
|
+
setDefaultComfyStorage(createMemoryStorage())
|
|
12
|
+
|
|
13
|
+
export * from 'src/coreExports.ts'
|