@laplace.live/persona-sdk 1.2.0 → 1.3.0

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.
@@ -1,3 +1,4 @@
1
+ import type { Hotkey } from '../wire/types.ts';
1
2
  /** True when the combo carries a command modifier and so may be registered globally. */
2
3
  export declare function hasCommandModifier(accelerator: string | null): boolean;
3
4
  /**
@@ -6,3 +7,9 @@ export declare function hasCommandModifier(accelerator: string | null): boolean;
6
7
  * every writer canonicalizes; it does not validate one.
7
8
  */
8
9
  export declare function canRunInBackground(accelerator: string | null): boolean;
10
+ /** True when a model hotkey is meant to fire while Persona sits in the background — what main registers on, and what the globe shows. */
11
+ export declare function hotkeyRunsInBackground(h: Hotkey): boolean;
12
+ /** Accelerators bound by more than one entry — the warning every shortcut list raises. */
13
+ export declare function duplicateAccelerators(bindings: readonly {
14
+ accelerator: string | null;
15
+ }[]): Set<string>;
@@ -20,3 +20,20 @@ export function canRunInBackground(accelerator) {
20
20
  return false;
21
21
  return hasCommandModifier(accelerator) || accelerator.split('+').every(isControllerTriggerName);
22
22
  }
23
+ /** True when a model hotkey is meant to fire while Persona sits in the background — what main registers on, and what the globe shows. */
24
+ export function hotkeyRunsInBackground(h) {
25
+ return h.global && h.active && h.action !== null && canRunInBackground(h.accelerator);
26
+ }
27
+ /** Accelerators bound by more than one entry — the warning every shortcut list raises. */
28
+ export function duplicateAccelerators(bindings) {
29
+ const seen = new Set();
30
+ const dupes = new Set();
31
+ for (const b of bindings) {
32
+ if (b.accelerator === null)
33
+ continue;
34
+ if (seen.has(b.accelerator))
35
+ dupes.add(b.accelerator);
36
+ seen.add(b.accelerator);
37
+ }
38
+ return dupes;
39
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laplace.live/persona-sdk",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "TypeScript SDK and wire schema for the LAPLACE Persona plugin API",
5
5
  "license": "MIT",
6
6
  "type": "module",