@volter/editor-live 0.5.63 → 0.5.65
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/BUNDLED_NOTICES +4 -2
- package/dist/index.js +184 -17
- package/dist/index.js.map +4 -4
- package/package.json +3 -3
- package/src/session.ts +24 -4
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/editor-live",
|
|
3
3
|
"author": "Volter AI, Inc.",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.65",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"node": ">=22"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@volter/editor-sdk": "0.5.
|
|
34
|
-
"@volter/editor-project": "0.5.
|
|
33
|
+
"@volter/editor-sdk": "0.5.65",
|
|
34
|
+
"@volter/editor-project": "0.5.65",
|
|
35
35
|
"undici": "^7.28.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
package/src/session.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { existsSync, readFileSync, realpathSync } from 'node:fs';
|
|
7
7
|
import { dirname, join, resolve } from 'node:path';
|
|
8
8
|
import { resolveManifestPath } from '@volter/editor-project/manifest/locate';
|
|
9
|
+
import { resolveProductForProject } from '@volter/editor-sdk/session/product-locator';
|
|
9
10
|
import {
|
|
10
11
|
EDITOR_SESSION_DISCOVERY_TIMEOUT_MS,
|
|
11
12
|
type EditorSessionInfo,
|
|
@@ -176,14 +177,14 @@ function noMatchingSessionRefusal(
|
|
|
176
177
|
`@volter/editor-live: could not READ the editor session registry while looking for ${projectRoot} — ` +
|
|
177
178
|
`${discoveryFailure}. This is not the answer "no editor is running": the question went ` +
|
|
178
179
|
'unanswered, so nothing is known about what is live. Retry (a probe can time out while ' +
|
|
179
|
-
|
|
180
|
+
`the box is loaded); if it keeps failing, ${sessionsCommandFor(projectRoot)} asks the same question directly.`,
|
|
180
181
|
);
|
|
181
182
|
}
|
|
182
183
|
if (sessions.length === 0) {
|
|
183
184
|
return new Error(
|
|
184
185
|
`@volter/editor-live: the editor session registry is readable and lists NO live sessions, so none ` +
|
|
185
186
|
`covers ${projectRoot}. @volter/editor-live only attaches to an already-running session — it ` +
|
|
186
|
-
|
|
187
|
+
`never starts one — so run ${editCommandFor(projectRoot)} in that project first, then retry.`,
|
|
187
188
|
);
|
|
188
189
|
}
|
|
189
190
|
const listed = sessions
|
|
@@ -196,7 +197,7 @@ function noMatchingSessionRefusal(
|
|
|
196
197
|
` live sessions:\n${listed}\n` +
|
|
197
198
|
' If one of those is meant to be this project, the two paths differ after resolution — ' +
|
|
198
199
|
'the usual cause is a git worktree or a symlink, where the session was opened through a ' +
|
|
199
|
-
|
|
200
|
+
`different path to the same files. Run ${editCommandFor(projectRoot)} from THIS path, or use the path the ` +
|
|
200
201
|
'session lists.',
|
|
201
202
|
);
|
|
202
203
|
}
|
|
@@ -211,7 +212,7 @@ export async function resolveSession(
|
|
|
211
212
|
const projectRoot = findRoot(projectDir);
|
|
212
213
|
if (projectRoot === null) {
|
|
213
214
|
throw new Error(
|
|
214
|
-
`@volter/editor-live: no vgai.project.json found in ${projectDir} or any parent directory — is this a
|
|
215
|
+
`@volter/editor-live: no vgai.project.json found in ${projectDir} or any parent directory — is this a project?`,
|
|
215
216
|
);
|
|
216
217
|
}
|
|
217
218
|
|
|
@@ -265,3 +266,22 @@ export async function resolveSession(
|
|
|
265
266
|
|
|
266
267
|
return { port: match.port, projectRoot };
|
|
267
268
|
}
|
|
269
|
+
|
|
270
|
+
/** `` `<product> edit` `` for the product this project declares, or a generic
|
|
271
|
+
* phrase when it declares none — this package serves every product and
|
|
272
|
+
* names only the one the project installed. */
|
|
273
|
+
function editCommandFor(projectRoot: string): string {
|
|
274
|
+
return verbFor(projectRoot, 'edit');
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function sessionsCommandFor(projectRoot: string): string {
|
|
278
|
+
return verbFor(projectRoot, 'sessions');
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
function verbFor(projectRoot: string, verb: string): string {
|
|
282
|
+
try {
|
|
283
|
+
return `\`${resolveProductForProject(projectRoot).command} ${verb}\``;
|
|
284
|
+
} catch {
|
|
285
|
+
return `its product's \`${verb}\` command`;
|
|
286
|
+
}
|
|
287
|
+
}
|