@openvcs/sdk 0.3.0-edge.20260423.28 → 0.3.0-edge.20260423.31

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.
@@ -250,11 +250,17 @@ function getOrCreateMenu(menuId, label, options) {
250
250
  exports.createMenu = getOrCreateMenu;
251
251
  /** Adds one item to a menu. */
252
252
  function addMenuItem(menuId, item) {
253
- createMenuHandle(menuId).addItem(item);
253
+ const handle = createMenuHandle(menuId);
254
+ if (!handle)
255
+ return;
256
+ handle.addItem(item);
254
257
  }
255
258
  /** Adds one separator to a menu. */
256
259
  function addMenuSeparator(menuId, beforeAction) {
257
- createMenuHandle(menuId).addSeparator(beforeAction);
260
+ const handle = createMenuHandle(menuId);
261
+ if (!handle)
262
+ return;
263
+ handle.addSeparator(beforeAction);
258
264
  }
259
265
  /** Removes one menu from the registry. */
260
266
  function removeMenu(menuId) {
@@ -292,7 +298,10 @@ function invoke(cmd, args) {
292
298
  /** Emits a notification when the host helper is available. */
293
299
  function notify(msg) {
294
300
  const openvcs = getOpenVCS();
295
- openvcs?.notify(msg);
301
+ if (!openvcs) {
302
+ throw new Error('OpenVCS host is not available in this runtime');
303
+ }
304
+ openvcs.notify(msg);
296
305
  }
297
306
  /** Builds SDK delegates from the local menu/action registries. */
298
307
  function createMenuPluginDelegates() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openvcs/sdk",
3
- "version": "0.3.0-edge.20260423.28",
3
+ "version": "0.3.0-edge.20260423.31",
4
4
  "description": "OpenVCS SDK CLI for plugin scaffolding and runtime asset builds",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "homepage": "https://openvcs.app/",
@@ -328,12 +328,16 @@ export const createMenu = getOrCreateMenu;
328
328
 
329
329
  /** Adds one item to a menu. */
330
330
  export function addMenuItem(menuId: string, item: MenubarItem): void {
331
- createMenuHandle(menuId).addItem(item);
331
+ const handle = createMenuHandle(menuId);
332
+ if (!handle) return;
333
+ handle.addItem(item);
332
334
  }
333
335
 
334
336
  /** Adds one separator to a menu. */
335
337
  export function addMenuSeparator(menuId: string, beforeAction?: string): void {
336
- createMenuHandle(menuId).addSeparator(beforeAction);
338
+ const handle = createMenuHandle(menuId);
339
+ if (!handle) return;
340
+ handle.addSeparator(beforeAction);
337
341
  }
338
342
 
339
343
  /** Removes one menu from the registry. */
@@ -374,7 +378,10 @@ export function invoke<T = unknown>(cmd: string, args?: unknown): Promise<T> {
374
378
  /** Emits a notification when the host helper is available. */
375
379
  export function notify(msg: string): void {
376
380
  const openvcs = getOpenVCS();
377
- openvcs?.notify(msg);
381
+ if (!openvcs) {
382
+ throw new Error('OpenVCS host is not available in this runtime');
383
+ }
384
+ openvcs.notify(msg);
378
385
  }
379
386
 
380
387
  /** Builds SDK delegates from the local menu/action registries. */