@wisdoverse/dsh-inline-media-viewer 1.0.5 → 1.0.6
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/CHANGELOG.md +5 -0
- package/index.js +3 -4
- package/lib.js +7 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/index.js
CHANGED
|
@@ -22,12 +22,12 @@ import { isAbsolute, resolve } from "node:path";
|
|
|
22
22
|
import z from "@deepseek-ai/schemastery";
|
|
23
23
|
import { installSettingsSection, settingsNamespace } from "@deepseek-ai/dsh-settings";
|
|
24
24
|
|
|
25
|
-
import { COMFY_DEFAULT_ORIGIN, MAX_BYTES, comfyUrl, isInside, mimeOf, normalizeComfyOrigin, testing } from "./lib.js";
|
|
25
|
+
import { COMFY_DEFAULT_ORIGIN, MAX_BYTES, comfyUrl, isInside, mimeOf, normalizeComfyOrigin, resolveSessionCwd, testing } from "./lib.js";
|
|
26
26
|
|
|
27
27
|
export { testing } from "./lib.js";
|
|
28
28
|
|
|
29
29
|
export const name = "dsh-inline-media-viewer";
|
|
30
|
-
export const inject = ["connection", "sessions", "settings"];
|
|
30
|
+
export const inject = ["connection", "sessions", "sessionQuery", "settings"];
|
|
31
31
|
|
|
32
32
|
const CHANNEL = "/inline-media";
|
|
33
33
|
const ENDPOINT = "read";
|
|
@@ -119,8 +119,7 @@ async function readRemote(source, signal, settingsValue) {
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
async function readLocal(ctx, source, sessionId) {
|
|
122
|
-
const
|
|
123
|
-
const cwd = session?.header?.cwd;
|
|
122
|
+
const cwd = await resolveSessionCwd(ctx.sessions, ctx.sessionQuery, sessionId);
|
|
124
123
|
if (!cwd) throw new Error("session working directory is unavailable");
|
|
125
124
|
const mime = mimeOf(source);
|
|
126
125
|
if (!mime) throw new Error("unsupported media extension");
|
package/lib.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* dsh-inline-media-viewer —
|
|
2
|
+
* dsh-inline-media-viewer — dependency-free helpers.
|
|
3
3
|
*
|
|
4
4
|
* This module has NO runtime dependencies: unit tests and reviewers can import
|
|
5
5
|
* it anywhere. Integration concerns (RPC channel, settings registration) live
|
|
@@ -79,6 +79,11 @@ export function isInside(root, target) {
|
|
|
79
79
|
return rel === "" || (!isAbsolute(rel) && rel !== ".." && !rel.startsWith(`..${sep}`));
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
export async function resolveSessionCwd(sessions, sessionQuery, sessionId) {
|
|
83
|
+
const live = sessions.get(sessionId);
|
|
84
|
+
return live ? live.header.cwd : (await sessionQuery.readSession(sessionId)).session.cwd;
|
|
85
|
+
}
|
|
86
|
+
|
|
82
87
|
/**
|
|
83
88
|
* Parse a user-configured ComfyUI address into a canonical origin URL.
|
|
84
89
|
*
|
|
@@ -175,4 +180,5 @@ export const testing = Object.freeze({
|
|
|
175
180
|
isInside,
|
|
176
181
|
mimeOf,
|
|
177
182
|
normalizeComfyOrigin,
|
|
183
|
+
resolveSessionCwd,
|
|
178
184
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wisdoverse/dsh-inline-media-viewer",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Persistent inline image, video, and audio previews for DeepSeek Harness Web conversations, with workspace-confined local reads and an optional ComfyUI proxy.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|