@vgai/live 0.4.1-canary.20260715.0 → 0.4.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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@vgai/live",
3
3
  "author": "Volter AI, Inc.",
4
4
  "license": "Apache-2.0",
5
- "version": "0.4.1-canary.20260715.0",
5
+ "version": "0.4.1",
6
6
  "type": "module",
7
7
  "repository": {
8
8
  "type": "git",
@@ -30,9 +30,9 @@
30
30
  "build": "tsc -p tsconfig.build.json"
31
31
  },
32
32
  "dependencies": {
33
- "@vgai/editor-sdk": "0.4.1-canary.20260715.0",
34
- "@vgai/probe": "0.4.1-canary.20260715.0",
35
- "@vgai/sdk": "0.4.1-canary.20260715.0"
33
+ "@vgai/editor-sdk": "0.4.1",
34
+ "@vgai/probe": "0.4.1",
35
+ "@vgai/sdk": "0.4.1"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "@playwright/test": ">=1.58.2 <2"
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `@vgai/live` — `{ editor, game, page }` over the session wire
2
+ * `@vgai/live` — `{ editor, game, page, tools }` over the session wire
3
3
  * (docs/SHARED-SESSION-SPEC.md, Wave 2). Editor control consolidates HERE
4
4
  * from the ~19 `vgai` CLI verbs: a plain node/tsx script gets
5
5
  * `import { editor, game, page } from '@vgai/live'` instead of shelling out
@@ -45,6 +45,7 @@ import { createGameClient } from './game.js';
45
45
  import { lazyChainProxy } from './lazy-proxy.js';
46
46
  import { type ResolvedSession, resolveSession, type SessionResolutionDeps } from './session.js';
47
47
  import { createLazySession } from './singleton.js';
48
+ import { LiveTools } from './tools.js';
48
49
 
49
50
  export type { EditorClient } from '@vgai/editor-sdk';
50
51
  export type { GameClient } from '@vgai/probe';
@@ -59,6 +60,7 @@ export type {
59
60
  export { findProjectRootFrom, resolveSession } from './session.js';
60
61
  export type { LazySession } from './singleton.js';
61
62
  export { createLazySession } from './singleton.js';
63
+ export { LiveTools } from './tools.js';
62
64
 
63
65
  /** A `game.page(step)`-shaped call — see this module's doc comment for the closure-capture limitation. */
64
66
  export type PageStep = GameClient['page'];
@@ -68,6 +70,8 @@ export interface LiveSession {
68
70
  game: GameClient;
69
71
  /** `GameClient.page` bound to `game` — see this module's own doc comment for the wire limitation. */
70
72
  page: PageStep;
73
+ /** Registered project callables: enumerate, inspect, and invoke. */
74
+ tools: LiveTools;
71
75
  /** The resolved session this is bound to — useful for logging/debugging which port/project a script attached to. */
72
76
  session: ResolvedSession;
73
77
  }
@@ -87,7 +91,8 @@ export async function connect(
87
91
  const editor = new LiveEditor(client, resolved.projectRoot);
88
92
  const game = createGameClient(resolved.port);
89
93
  const page: PageStep = (step) => game.page(step);
90
- return { editor, game, page, session: resolved };
94
+ const tools = new LiveTools(client);
95
+ return { editor, game, page, tools, session: resolved };
91
96
  }
92
97
 
93
98
  // ---------------------------------------------------------------------------
@@ -113,3 +118,6 @@ export const game: GameClient = lazyChainProxy<GameClient>(() =>
113
118
  export const page: PageStep = lazyChainProxy<PageStep>(() =>
114
119
  lazySession.ensure().then((s) => s.page),
115
120
  );
121
+ export const tools: LiveTools = lazyChainProxy<LiveTools>(() =>
122
+ lazySession.ensure().then((s) => s.tools),
123
+ );
package/src/tools.ts ADDED
@@ -0,0 +1,32 @@
1
+ /** Registered project tools over the current shared editor session. */
2
+
3
+ import type {
4
+ EditorClient,
5
+ ProjectToolCatalog,
6
+ ProjectToolCatalogEntry,
7
+ ProjectToolOutcome,
8
+ } from '@vgai/editor-sdk';
9
+
10
+ export class LiveTools {
11
+ constructor(private readonly client: EditorClient) {}
12
+
13
+ /** Enumerate the exact `package.json#vgai.tools` catalog without executing it. */
14
+ async list(): Promise<ProjectToolCatalog> {
15
+ return this.client.listProjectTools();
16
+ }
17
+
18
+ /** Return one tool's discoverable metadata, or `null` when it is not registered. */
19
+ async describe(name: string): Promise<ProjectToolCatalogEntry | null> {
20
+ const catalog = await this.list();
21
+ return catalog.tools.find((tool) => tool.name === name) ?? null;
22
+ }
23
+
24
+ /** Invoke the same validated callable used by the editor and CLI. */
25
+ async call(
26
+ name: string,
27
+ input: unknown = {},
28
+ options: { confirm?: boolean } = {},
29
+ ): Promise<ProjectToolOutcome> {
30
+ return this.client.runProjectTool(name, input, options);
31
+ }
32
+ }