@volter/live 0.5.209 → 0.5.210

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 CHANGED
@@ -3,9 +3,9 @@ Bundled license notices
3
3
  These notices accompany code incorporated into this package. Separate npm dependencies retain their own licenses.
4
4
 
5
5
 
6
- @volter/project@0.5.209
6
+ @volter/project@0.5.210
7
7
  Declared license: Apache-2.0
8
- Source: the unmodified npm package @volter/project@0.5.209, from https://github.com/volter-ai/editor.git
8
+ Source: the unmodified npm package @volter/project@0.5.210, from https://github.com/volter-ai/editor.git
9
9
 
10
10
  --- packages/project/LICENSE ---
11
11
 
@@ -223,9 +223,9 @@ repository. Original source hashes and revision are recorded in
223
223
  provenance/editor-contracts.json. LICENSE contains the Apache-2.0 text.
224
224
 
225
225
 
226
- @volter/sdk@0.5.209
226
+ @volter/sdk@0.5.210
227
227
  Declared license: Apache-2.0
228
- Source: the unmodified npm package @volter/sdk@0.5.209, from https://github.com/volter-ai/editor.git
228
+ Source: the unmodified npm package @volter/sdk@0.5.210, from https://github.com/volter-ai/editor.git
229
229
 
230
230
  --- packages/sdk/LICENSE ---
231
231
 
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ export { LiveEditorDocument } from './editor-document.js';
6
6
  export type { DocumentGestureOptions, DocumentKeyOptions, DocumentPasteOptions } from './editor-document.js';
7
7
  export { LiveTools } from './tools.js';
8
8
  export { editorMemberHint, withEditorMemberHints } from './member-hints.js';
9
- export { resolveSession, findProjectRootFrom } from './session.js';
9
+ export { resolveSession, findProjectRootFrom, NO_SESSION_FOR_PROJECT } from './session.js';
10
10
  export type { ResolvedSession, SessionResolutionDeps, SessionListingTransport, ProjectSessionHint } from './session.js';
11
11
  export type { ActiveDocumentCapture, EditorView, PresentedEditorView } from '@volter/sdk';
12
12
  export interface LiveBindings {
package/dist/index.js CHANGED
@@ -1924,7 +1924,7 @@ function lazyChainProxy(resolveRoot, path = [], hint) {
1924
1924
  }
1925
1925
 
1926
1926
  // src/session.ts
1927
- import { existsSync as existsSync3, readFileSync as readFileSync3, realpathSync as realpathSync2 } from "node:fs";
1927
+ import { existsSync as existsSync3, readFileSync as readFileSync3, realpathSync as realpathSync2, statSync } from "node:fs";
1928
1928
  import { dirname as dirname2, join as join4, resolve as resolve2 } from "node:path";
1929
1929
 
1930
1930
  // ../project/src/manifest/locate.ts
@@ -2275,6 +2275,16 @@ function canonicalPath(path) {
2275
2275
  return resolve2(path);
2276
2276
  }
2277
2277
  }
2278
+ function sameDirectory(a, b) {
2279
+ try {
2280
+ const x = statSync(a, { bigint: true });
2281
+ const y = statSync(b, { bigint: true });
2282
+ return x.dev === y.dev && x.ino === y.ino;
2283
+ } catch {
2284
+ return false;
2285
+ }
2286
+ }
2287
+ var NO_SESSION_FOR_PROJECT = "VOLTER_NO_SESSION_FOR_PROJECT";
2278
2288
  function readProjectSession(projectRoot) {
2279
2289
  try {
2280
2290
  const value = JSON.parse(
@@ -2314,18 +2324,19 @@ function noMatchingSessionRefusal(projectRoot, canon, sessions, discoveryFailure
2314
2324
  );
2315
2325
  }
2316
2326
  if (sessions.length === 0) {
2317
- return new Error(
2327
+ return Object.assign(new Error(
2318
2328
  `@volter/live: the editor session registry is readable and lists NO live sessions, so none covers ${projectRoot}. @volter/live only attaches to an already-running session \u2014 it never starts one \u2014 so run ${editCommandFor(projectRoot)} in that project first, then retry.`
2319
- );
2329
+ ), { code: NO_SESSION_FOR_PROJECT });
2320
2330
  }
2321
2331
  const listed = sessions.map((s) => ` port ${s.port} \u2192 ${s.project === null ? "(no project)" : s.project}`).join("\n");
2322
- return new Error(
2332
+ const thisFolderElsewhere = sessions.some((s) => s.project !== null && sameDirectory(s.project, projectRoot));
2333
+ return Object.assign(new Error(
2323
2334
  `@volter/live: ${sessions.length} live editor session(s) are running, but none of them opens ${projectRoot}. @volter/live never silently attaches to a different project.
2324
2335
  looking for (resolved): ${canon}
2325
2336
  live sessions:
2326
2337
  ${listed}
2327
2338
  If one of those is meant to be this project, the two paths differ after resolution \u2014 the usual cause is a git worktree or a symlink, where the session was opened through a different path to the same files. Run ${editCommandFor(projectRoot)} from THIS path, or use the path the session lists.`
2328
- );
2339
+ ), thisFolderElsewhere ? {} : { code: NO_SESSION_FOR_PROJECT });
2329
2340
  }
2330
2341
  async function resolveSession(projectDir = process.cwd(), deps = {}) {
2331
2342
  const findRoot = deps.findProjectRootFrom ?? findProjectRootFrom;
@@ -2443,6 +2454,7 @@ export {
2443
2454
  LiveEditor,
2444
2455
  LiveEditorDocument,
2445
2456
  LiveTools,
2457
+ NO_SESSION_FOR_PROJECT,
2446
2458
  connect,
2447
2459
  editor,
2448
2460
  editorMemberHint,