@qilin-agent/client-shortcuts 0.0.0-stage → 3.1.4

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.
@@ -0,0 +1,13 @@
1
+ import type { DesktopKeyboardApi, ShortcutConfigSnapshot } from '../protocol.ts';
2
+ import type { ShortcutRegistry } from './registry.ts';
3
+ /**
4
+ * Route native menu, main-frame, and embedded-frame input through the shared command registry.
5
+ * @param window - trusted product document.
6
+ * @param keyboard - top-frame preload capability.
7
+ * @param registry - window-local command owner.
8
+ * @param snapshot - latest accepted configuration.
9
+ * @param reset - clears pending fixed sequences when native input bypasses DOM delivery.
10
+ * @returns disposer releasing native input.
11
+ */
12
+ export declare function installNativeKeyboard(window: Window, keyboard: DesktopKeyboardApi, registry: ShortcutRegistry, snapshot: () => ShortcutConfigSnapshot, reset?: () => void): () => void;
13
+ //# sourceMappingURL=native.d.ts.map
@@ -0,0 +1,80 @@
1
+ import type { ShortcutCommandId, ShortcutConfigSnapshot, ShortcutDefinition, ShortcutPlatform, ShortcutRuntime } from '../protocol.ts';
2
+ import type { ShortcutCatalogEntry, ShortcutCommand, ShortcutContext, ShortcutGesture, ShortcutFixedCommand, ShortcutFixedCatalogEntry } from './types.ts';
3
+ /** Dispatch consumption is independent of later business-operation success. */
4
+ type ShortcutDispatch = {
5
+ status: 'handled';
6
+ commandId: ShortcutCommandId;
7
+ } | {
8
+ status: 'blocked';
9
+ commandId: ShortcutCommandId;
10
+ reason: string;
11
+ } | {
12
+ status: 'pass';
13
+ };
14
+ /** Application command registry; adapters own event listeners, feature plugins own actions. */
15
+ export declare class ShortcutRegistry {
16
+ readonly runtime: ShortcutRuntime;
17
+ readonly platform: ShortcutPlatform;
18
+ private readonly commands;
19
+ private readonly fixedCommands;
20
+ private readonly conflicts;
21
+ private readonly bindings;
22
+ private readonly state;
23
+ /** Effective localized rows derived from the accepted configuration. */
24
+ readonly catalog: {
25
+ getSnapshot: () => readonly ShortcutCatalogEntry[];
26
+ subscribe: (listener: () => void) => () => void;
27
+ };
28
+ /** Accepted preferences and visible read diagnostics. */
29
+ readonly config: {
30
+ getSnapshot: () => ShortcutConfigSnapshot;
31
+ subscribe: (listener: () => void) => () => void;
32
+ };
33
+ /** Fixed local operations whose owning plugins are mounted. */
34
+ readonly fixedCatalog: import("@qilin-agent/client-store").SnapshotStore<readonly ShortcutFixedCatalogEntry[]>;
35
+ constructor(runtime: ShortcutRuntime, platform: ShortcutPlatform, config?: ShortcutConfigSnapshot);
36
+ /**
37
+ * Return the serializable active catalog for storage validation.
38
+ * @returns definitions without callbacks or localized labels.
39
+ */
40
+ definitions(): readonly ShortcutDefinition[];
41
+ /**
42
+ * Register a read-only input action whose keys cannot be assigned to editable commands.
43
+ * @param command - owner-localized action and readable sequence.
44
+ * @returns idempotent disposer removing its reference row.
45
+ */
46
+ registerFixed(command: ShortcutFixedCommand): () => void;
47
+ private refreshFixedLabels;
48
+ /**
49
+ * Publish accepted preferences and all derived labels atomically.
50
+ * @param config - storage owner's latest accepted snapshot.
51
+ */
52
+ configure(config: ShortcutConfigSnapshot): void;
53
+ /**
54
+ * Register atomically after checking defaults for all supported platforms and shells.
55
+ * @param command - feature-owned command definition.
56
+ * @returns idempotent disposer removing both matching and catalog entries.
57
+ */
58
+ register(command: ShortcutCommand): () => void;
59
+ /**
60
+ * Recompute effective bindings when preferences, commands, or locale change.
61
+ * @param config - accepted configuration, defaulting to the current snapshot.
62
+ */
63
+ refreshLabels(config?: ShortcutConfigSnapshot): void;
64
+ /**
65
+ * Invoke a native menu selection independently of its optional key binding.
66
+ * @param id - registered product command.
67
+ * @param context - live input owner and modal state.
68
+ */
69
+ invoke(id: ShortcutCommandId, context: ShortcutContext): void;
70
+ /**
71
+ * Windows/macOS Desktop bindings override local regions and modal controls independently of their configuration source.
72
+ * @param gesture - normalized DOM/native input facts.
73
+ * @param context - synchronous input and modal owner.
74
+ * @param consume - adapter's preventDefault, called before business execution.
75
+ * @returns handled, blocked with a reason, or pass for local/system input.
76
+ */
77
+ dispatch(gesture: ShortcutGesture, context: ShortcutContext, consume: () => void): ShortcutDispatch;
78
+ }
79
+ export {};
80
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1,20 @@
1
+ import type { DesktopShortcutsApi, ShortcutConfigSnapshot, ShortcutPlatform } from '../protocol.ts';
2
+ /** Browser-profile and origin-local preference key. */
3
+ export declare const SHORTCUT_STORAGE_KEY = "qilin.keybindings.v1";
4
+ /**
5
+ * Connect localStorage and same-origin external updates to the shared transaction coordinator.
6
+ * @param window - owning browser window.
7
+ * @param platform - visiting device platform.
8
+ * @param publish - accepts complete configuration snapshots.
9
+ * @returns adapter and lifecycle disposal.
10
+ */
11
+ export declare function webShortcutStorage(window: Window, platform: ShortcutPlatform, publish: (snapshot: ShortcutConfigSnapshot) => void): DesktopShortcutsApi & {
12
+ dispose(): void;
13
+ };
14
+ /**
15
+ * Read the origin-scoped preload capability; a missing bridge is an explicit configuration failure.
16
+ * @param window - product window.
17
+ * @returns the restricted Desktop API, or undefined while the preload is unavailable.
18
+ */
19
+ export declare function desktopShortcutStorage(window: Window): DesktopShortcutsApi | undefined;
20
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1,146 @@
1
+ /** Command contributions and immutable catalog values. */
2
+ import type { ObservableSnapshot } from '@qilin-agent/client-store';
3
+ import type { BindingIssue, NormalizedBinding, ShortcutConfigSnapshot, ShortcutEdit, ShortcutRevision, ShortcutSaveResult, ShortcutBinding, ShortcutCommandId, ShortcutPlatform, ShortcutProfile, ShortcutRuntime } from '../protocol.ts';
4
+ /** Local input owner resolved before an application command. */
5
+ export type ShortcutRegion = 'page' | 'editable' | 'terminal';
6
+ /** Synchronous DOM context; owners capture business targets in resolve(). */
7
+ export interface ShortcutContext {
8
+ readonly source?: 'keyboard' | 'menu' | 'iframe' | 'webview';
9
+ readonly region: ShortcutRegion;
10
+ readonly modal: string | null;
11
+ /** Original input element, or null when no document target is available. */
12
+ readonly target: Element | null;
13
+ }
14
+ /** A resolved action captures its target; failures remain the owner's responsibility. */
15
+ export type ShortcutResolution = {
16
+ status: 'handled';
17
+ run(): void;
18
+ } | {
19
+ status: 'blocked';
20
+ reason: string;
21
+ } | {
22
+ status: 'pass';
23
+ };
24
+ /** One command's labels, defaults, input ownership, and target resolver. */
25
+ export interface ShortcutCommand {
26
+ readonly id: ShortcutCommandId;
27
+ readonly label: () => string;
28
+ readonly aliases: readonly string[];
29
+ readonly defaults: Readonly<Partial<Record<ShortcutProfile, ShortcutBinding>>>;
30
+ readonly regions: readonly ShortcutRegion[];
31
+ /**
32
+ * Allowed modal identifiers for Web/Linux keyboard input and explicit menu actions;
33
+ * Windows/macOS Desktop keyboard bindings take priority.
34
+ */
35
+ readonly modals: readonly string[];
36
+ resolve(context: ShortcutContext): ShortcutResolution;
37
+ }
38
+ /** JSON-compatible catalog row, shared by reference, tooltips, and controls. */
39
+ export interface ShortcutCatalogEntry {
40
+ readonly id: ShortcutCommandId;
41
+ readonly label: string;
42
+ readonly aliases: readonly string[];
43
+ readonly keys: readonly string[];
44
+ readonly aria: string | undefined;
45
+ readonly binding: NormalizedBinding | null;
46
+ readonly modified: boolean;
47
+ readonly conflicts: readonly ShortcutCommandId[];
48
+ readonly issue: BindingIssue | null;
49
+ }
50
+ /** Keyboard adapter input, with composition and local consumption already resolved. */
51
+ export interface ShortcutGesture {
52
+ readonly code: string;
53
+ /** Second physical key currently held with code; matching ignores pair order. */
54
+ readonly secondCode?: string;
55
+ readonly control: boolean;
56
+ readonly alt: boolean;
57
+ readonly shift: boolean;
58
+ readonly meta: boolean;
59
+ readonly repeat: boolean;
60
+ readonly composing: boolean;
61
+ readonly defaultPrevented: boolean;
62
+ }
63
+ /** Local fixed input delivered after controls, or a sequence-invalidating interaction. */
64
+ export type ShortcutFixedInput = {
65
+ readonly type: 'keydown';
66
+ readonly gesture: ShortcutGesture;
67
+ readonly context: ShortcutContext;
68
+ consume(): void;
69
+ } | {
70
+ readonly type: 'reset';
71
+ };
72
+ /** Read-only input action contributed while its owning feature is mounted. */
73
+ export interface ShortcutFixedCommand {
74
+ readonly id: ShortcutCommandId;
75
+ readonly label: () => string;
76
+ readonly keys: readonly string[];
77
+ /** One or more physical combinations reserved by this action, including individual steps of a sequence. */
78
+ readonly bindings: readonly [ShortcutBinding, ...ShortcutBinding[]];
79
+ readonly group: 'application' | 'input' | 'menus' | 'approval';
80
+ }
81
+ /** Localized fixed-action row; its key sequence is not an editable binding. */
82
+ export interface ShortcutFixedCatalogEntry {
83
+ readonly id: ShortcutCommandId;
84
+ readonly label: string;
85
+ readonly keys: readonly string[];
86
+ readonly bindings: readonly NormalizedBinding[];
87
+ readonly group: ShortcutFixedCommand['group'];
88
+ }
89
+ /** Feature-facing keyboard registry. */
90
+ export interface Shortcuts {
91
+ readonly runtime: ShortcutRuntime;
92
+ readonly platform: ShortcutPlatform;
93
+ readonly catalog: ObservableSnapshot<readonly ShortcutCatalogEntry[]>;
94
+ readonly config: ObservableSnapshot<ShortcutConfigSnapshot>;
95
+ readonly fixedCatalog: ObservableSnapshot<readonly ShortcutFixedCatalogEntry[]>;
96
+ readonly stopSequenceMs: number;
97
+ /**
98
+ * Contribute one fixed action and reserve its keys against editable bindings.
99
+ * @param command - owner-localized name, group, readable keys, and reserved physical combinations.
100
+ * @returns idempotent disposer removing the fixed row.
101
+ */
102
+ registerFixed(command: ShortcutFixedCommand): () => void;
103
+ /**
104
+ * Observe locally arbitrated input and interaction resets for fixed sequences.
105
+ * @param listener - owner handler; composing or consumed input must not trigger actions.
106
+ * @returns disposer releasing the handler.
107
+ */
108
+ observeFixedInput(listener: (input: ShortcutFixedInput) => void): () => void;
109
+ /**
110
+ * Describe a candidate using the device's physical-key and reservation rules; invalid codes throw.
111
+ * @param binding - candidate combination, or null for an unbound command.
112
+ * @returns canonical binding, visible keys, rejection reason, and overlapping editable/fixed command IDs.
113
+ */
114
+ describeBinding(binding: ShortcutBinding | null): {
115
+ binding: NormalizedBinding | null;
116
+ keys: readonly string[];
117
+ issue: BindingIssue | null;
118
+ conflicts: readonly ShortcutCommandId[];
119
+ };
120
+ /**
121
+ * Save a reviewed edit; failures preserve both accepted preferences and the caller's draft.
122
+ * @param edit - set, clear, reset, or reset-all operation.
123
+ * @param revision - accepted revision reviewed by the user.
124
+ * @returns persistence outcome and current accepted configuration.
125
+ * @throws when publishing the accepted command catalog fails.
126
+ */
127
+ edit(edit: ShortcutEdit, revision: ShortcutRevision): Promise<ShortcutSaveResult>;
128
+ /**
129
+ * Suppress native menu accelerators while the recording layer owns keyboard input; reject if Desktop cannot acknowledge it.
130
+ * @param active - whether the recording layer is mounted.
131
+ * @returns completion of the native interception update.
132
+ */
133
+ recording(active: boolean): Promise<void>;
134
+ /**
135
+ * Request closure of the Desktop window using the currently accepted shortcut revision.
136
+ * @returns completion of the native request; rejects outside Desktop or when the bridge request fails.
137
+ */
138
+ closeWindow(): Promise<void>;
139
+ /**
140
+ * Register a command; duplicate ids and overlapping default bindings throw.
141
+ * @param command - feature-owned labels, defaults, and target resolver.
142
+ * @returns disposer removing the binding and catalog entry.
143
+ */
144
+ register(command: ShortcutCommand): () => void;
145
+ }
146
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,10 @@
1
+ /** Window-local timing accepted by the Host and browser keyboard service. */
2
+ import z from '@qilin-agent/schemastery';
3
+ /** Fixed shortcut sequence settings. */
4
+ export interface Config {
5
+ /** Maximum interval between independent Escape presses for stopping a reply, in milliseconds. */
6
+ stopSequenceMs: number;
7
+ }
8
+ /** Validated deployment settings for fixed keyboard sequences. */
9
+ export declare const Config: z<Partial<Config>, Config>;
10
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1,100 @@
1
+ import type { NormalizedBinding, ShortcutBinding, ShortcutCommandId, ShortcutPlatform, ShortcutProfile, ShortcutRuntime } from './binding.ts';
2
+ /** Overrides are platform-local; absent commands inherit defaults and null explicitly unbinds. */
3
+ export interface ShortcutDocument {
4
+ readonly schemaVersion: 1 | 2;
5
+ readonly profiles: Readonly<Partial<Record<ShortcutProfile, Readonly<Record<string, ShortcutBinding | null>>>>>;
6
+ }
7
+ /** Serializable command definitions accepted from the trusted product frame. */
8
+ export interface ShortcutDefinition {
9
+ readonly id: ShortcutCommandId;
10
+ readonly defaults: Readonly<Partial<Record<ShortcutProfile, ShortcutBinding>>>;
11
+ /** Fixed actions reserve one or more combinations instead of exposing an editable default. */
12
+ readonly fixed?: readonly [ShortcutBinding, ...ShortcutBinding[]];
13
+ }
14
+ /** Validation failures select localized copy in the UI. */
15
+ export type BindingIssue = 'reserved' | 'unsupported-browser' | 'modifier-required' | 'unsupported-key';
16
+ /** A conflicting row keeps its requested binding visible but cannot execute it. */
17
+ export interface EffectiveShortcut {
18
+ readonly id: ShortcutCommandId;
19
+ readonly binding: NormalizedBinding | null;
20
+ readonly modified: boolean;
21
+ readonly conflicts: readonly ShortcutCommandId[];
22
+ readonly issue: BindingIssue | null;
23
+ }
24
+ /** One revision-checked preference edit, limited to the current runtime and platform. */
25
+ export type ShortcutEdit = {
26
+ type: 'set';
27
+ id: ShortcutCommandId;
28
+ binding: ShortcutBinding | null;
29
+ } | {
30
+ type: 'reset';
31
+ id: ShortcutCommandId;
32
+ } | {
33
+ type: 'reset-all';
34
+ };
35
+ /**
36
+ * Validate JSON binding fields before normalization; unknown fields are rejected to prevent lossy rewrites.
37
+ * @param value - file or IPC input.
38
+ * @returns a binding with a supported physical code, or null for explicit removal.
39
+ */
40
+ export declare function parseBinding(value: unknown): ShortcutBinding | null;
41
+ /**
42
+ * Decode the complete document while preserving dormant command overrides.
43
+ * @param raw - stored JSON, or null for a missing document.
44
+ * @returns the accepted document or a classified read failure.
45
+ */
46
+ export declare function parseShortcutDocument(raw: string | null): ShortcutDocument | 'invalid' | 'future';
47
+ /**
48
+ * Check system, editor, and browser reservations using expanded physical modifiers.
49
+ * @param binding - normalized candidate.
50
+ * @param runtime - receiving application shell.
51
+ * @param platform - receiving device.
52
+ * @returns the rejection reason, or null when this combination is allowed.
53
+ */
54
+ export declare function bindingIssue(binding: NormalizedBinding, runtime: ShortcutRuntime, platform: ShortcutPlatform): BindingIssue | null;
55
+ /**
56
+ * Select the command owner's explicit default for one device profile.
57
+ * @param definition - command identity and per-profile defaults.
58
+ * @param runtime - receiving shell.
59
+ * @param platform - receiving device.
60
+ * @returns the declared physical binding, or undefined for an unbound action.
61
+ */
62
+ export declare function resolveShortcutDefault(definition: ShortcutDefinition, runtime: ShortcutRuntime, platform: ShortcutPlatform): ShortcutBinding | undefined;
63
+ /**
64
+ * Resolve overrides and conflicts independently of registration order. Explicit overrides displace defaults.
65
+ * @param definitions - active commands.
66
+ * @param document - accepted preferences.
67
+ * @param runtime - receiving shell.
68
+ * @param platform - receiving device.
69
+ * @returns every active command, including unavailable conflicting bindings.
70
+ */
71
+ export declare function effectiveShortcuts(definitions: readonly ShortcutDefinition[], document: ShortcutDocument, runtime: ShortcutRuntime, platform: ShortcutPlatform): readonly EffectiveShortcut[];
72
+ /**
73
+ * Detect identical combinations or a single key contained in a two-key chord.
74
+ * @param left - normalized candidate.
75
+ * @param right - normalized occupied binding.
76
+ * @returns whether both bindings require the same modifiers and overlap.
77
+ */
78
+ export declare function overlappingBindings(left: NormalizedBinding, right: NormalizedBinding): boolean;
79
+ /**
80
+ * Apply an edit without modifying other profiles or dormant overrides.
81
+ * @param document - accepted document.
82
+ * @param edit - validated operation.
83
+ * @param runtime - current shell.
84
+ * @param platform - current device.
85
+ * @returns the candidate document, pending conflict checks and durable storage.
86
+ */
87
+ export declare function editShortcutDocument(document: ShortcutDocument, edit: ShortcutEdit, runtime: ShortcutRuntime, platform: ShortcutPlatform): ShortcutDocument;
88
+ /**
89
+ * Validate a preference edit at the Desktop IPC boundary.
90
+ * @param value - untrusted renderer request.
91
+ * @returns the constrained operation; malformed requests throw.
92
+ */
93
+ export declare function parseShortcutEdit(value: unknown): ShortcutEdit;
94
+ /**
95
+ * Validate the trusted product's serializable command catalog at IPC ingress.
96
+ * @param value - renderer-supplied active command definitions.
97
+ * @returns validated definitions; duplicate IDs, overlapping defaults, and unsupported combinations throw.
98
+ */
99
+ export declare function parseShortcutDefinitions(value: unknown): readonly ShortcutDefinition[];
100
+ //# sourceMappingURL=configuration.d.ts.map
@@ -0,0 +1,11 @@
1
+ /** Host configuration for window-local keyboard sequences. */
2
+ import type { Context } from '@qilin-agent/kylin';
3
+ import type { Config } from './config.ts';
4
+ export { Config } from './config.ts';
5
+ /**
6
+ * Embed validated keyboard settings in product pages.
7
+ * @param ctx - Host context serving browser pages.
8
+ * @param config - sequence timing adopted when the page loads.
9
+ */
10
+ export declare function apply(ctx: Context, config: Config): void;
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,32 @@
1
+ /** Trusted product-window input exchanged with Electron's top-frame preload. */
2
+ import type { ShortcutRevision } from './persistence.ts';
3
+ import type { ShortcutCommandId } from './binding.ts';
4
+ /** Native input carries the accepted configuration identity; frame names identify the focused iframe or browser guest embedding element. */
5
+ export type DesktopShortcutInput = {
6
+ readonly revision: ShortcutRevision;
7
+ } & ({
8
+ readonly kind: 'menu';
9
+ readonly commandId: ShortcutCommandId;
10
+ } | {
11
+ readonly kind: 'keyboard' | 'iframe' | 'webview';
12
+ readonly frameName: string;
13
+ readonly code: string;
14
+ readonly secondCode?: string;
15
+ readonly control: boolean;
16
+ readonly alt: boolean;
17
+ readonly shift: boolean;
18
+ readonly meta: boolean;
19
+ readonly repeat: boolean;
20
+ });
21
+ /** Window-scoped capabilities exposed only to the product main frame. */
22
+ export interface DesktopKeyboardApi {
23
+ /** Subscribe to verified native input. @param listener - current document consumer. @returns listener disposer. */
24
+ subscribe(listener: (input: DesktopShortcutInput) => void): () => void;
25
+ /**
26
+ * Close the owning window if its configuration is still current.
27
+ * @param revision - accepted configuration identity.
28
+ * @returns IPC completion.
29
+ */
30
+ closeWindow(revision: ShortcutRevision): Promise<void>;
31
+ }
32
+ //# sourceMappingURL=native.d.ts.map
@@ -0,0 +1,76 @@
1
+ import type { Branded } from '@qilin-agent/brand';
2
+ import type { BindingIssue, ShortcutDefinition, ShortcutDocument, ShortcutEdit } from './configuration.ts';
3
+ import type { ShortcutCommandId, ShortcutPlatform, ShortcutRuntime } from './binding.ts';
4
+ /** Opaque accepted-state identity, invalidated by configuration and catalog changes. */
5
+ export type ShortcutRevision = Branded<'ShortcutRevision'>;
6
+ /** Read state retains the last accepted document on failure; loading does not enable commands. */
7
+ export interface ShortcutConfigSnapshot {
8
+ readonly revision: ShortcutRevision;
9
+ /** Monotonic within one storage-owner lifetime; clients discard out-of-order IPC replies. */
10
+ readonly sequence: number;
11
+ readonly document: ShortcutDocument;
12
+ readonly status: 'loading' | 'ready' | 'unreadable';
13
+ readonly error: 'read' | 'invalid' | 'future' | null;
14
+ readonly usingDefaults: boolean;
15
+ }
16
+ /** Save failures never replace effective preferences. */
17
+ export interface ShortcutSaveResult {
18
+ readonly status: 'saved' | 'stale' | 'unreadable' | 'write-failed' | 'not-ready' | 'conflict';
19
+ readonly snapshot: ShortcutConfigSnapshot;
20
+ readonly issue?: BindingIssue;
21
+ readonly conflicts?: readonly ShortcutCommandId[];
22
+ }
23
+ /** Storage adapter owns path/origin isolation and complete replacement on successful writes. */
24
+ export interface ShortcutStorage {
25
+ read(): string | null | Promise<string | null>;
26
+ write(raw: string): void | Promise<void>;
27
+ }
28
+ /** Restricted Desktop preload API; file paths and accelerators never cross from Renderer. */
29
+ export interface DesktopShortcutsApi {
30
+ get(definitions: readonly ShortcutDefinition[]): Promise<ShortcutConfigSnapshot>;
31
+ edit(edit: ShortcutEdit, revision: ShortcutRevision): Promise<ShortcutSaveResult>;
32
+ subscribe(listener: (snapshot: ShortcutConfigSnapshot) => void): () => void;
33
+ recording(active: boolean): Promise<void>;
34
+ }
35
+ /**
36
+ * Create a disabled initial snapshot for asynchronous adapter startup.
37
+ * @returns a fresh configuration with no accepted persisted state.
38
+ */
39
+ export declare function initialShortcutConfig(): ShortcutConfigSnapshot;
40
+ /** Single-writer coordinator shared by localStorage and Electron's atomic file adapter. */
41
+ export declare class ShortcutPersistence {
42
+ private readonly storage;
43
+ private readonly runtime;
44
+ private readonly platform;
45
+ private readonly rereadBeforeWrite;
46
+ private readonly publish;
47
+ private snapshot;
48
+ private raw;
49
+ private queue;
50
+ private definitions;
51
+ private active;
52
+ constructor(storage: ShortcutStorage, runtime: ShortcutRuntime, platform: ShortcutPlatform, rereadBeforeWrite: boolean, publish: (snapshot: ShortcutConfigSnapshot) => void);
53
+ /**
54
+ * Install or revoke a product catalog and invalidate drafts from its previous lifetime.
55
+ * @param definitions - current trusted definitions, or null while the product is not ready.
56
+ */
57
+ setDefinitions(definitions: readonly ShortcutDefinition[] | null): void;
58
+ /** Stop accepting edits or publishing late completions. */
59
+ dispose(): void;
60
+ /**
61
+ * Read the current file; failures retain the last accepted document and disable ordinary writes.
62
+ * @returns the accepted snapshot or diagnostic snapshot.
63
+ */
64
+ readCurrent(): Promise<ShortcutConfigSnapshot>;
65
+ /**
66
+ * Compare the draft revision, validate the complete candidate, then persist before publishing.
67
+ * @param edit - constrained preference operation.
68
+ * @param revision - state against which the user reviewed the edit.
69
+ * @returns a classified outcome and the currently accepted snapshot.
70
+ */
71
+ edit(edit: ShortcutEdit, revision: ShortcutRevision): Promise<ShortcutSaveResult>;
72
+ private serialize;
73
+ private accept;
74
+ private read;
75
+ }
76
+ //# sourceMappingURL=persistence.d.ts.map
@@ -0,0 +1,6 @@
1
+ /** Physical-key and versioned preference protocol shared by Client and Desktop main. */
2
+ export * from './binding.ts';
3
+ export * from './configuration.ts';
4
+ export * from './persistence.ts';
5
+ export * from './native.ts';
6
+ //# sourceMappingURL=protocol.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,71 @@
1
1
  {
2
2
  "name": "@qilin-agent/client-shortcuts",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "description": "Application keyboard command registry and physical-key routing",
4
+ "version": "3.1.4",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/kkutysllb/QiLin.git",
11
+ "directory": "packages/client/shortcuts"
12
+ },
13
+ "engines": {
14
+ "node": "^22.19.0 || >=24.0.0"
15
+ },
16
+ "type": "module",
17
+ "main": "lib/index.js",
18
+ "types": "lib/types/index.d.ts",
19
+ "exports": {
20
+ ".": {
21
+ "types": "./lib/types/index.d.ts",
22
+ "default": "./lib/index.js"
23
+ },
24
+ "./client": {
25
+ "types": "./lib/types/client/index.d.ts",
26
+ "default": "./lib/client.js"
27
+ },
28
+ "./src/*": "./src/*",
29
+ "./package.json": "./package.json",
30
+ "./protocol": {
31
+ "types": "./lib/types/protocol.d.ts",
32
+ "default": "./lib/protocol.js"
33
+ }
34
+ },
35
+ "files": [
36
+ "lib/index.js",
37
+ "lib/client.js",
38
+ "lib/protocol.js",
39
+ "lib/types/**/*.d.ts"
40
+ ],
41
+ "license": "MIT",
42
+ "qilin": {
43
+ "client": {
44
+ "inject": [
45
+ "@qilin-agent/client-locale"
46
+ ],
47
+ "platform": "web"
48
+ }
49
+ },
50
+ "peerDependencies": {
51
+ "@qilin-agent/kylin": "~4.0.3"
52
+ },
53
+ "devDependencies": {
54
+ "@qilin-agent/brand": "3.1.4",
55
+ "@qilin-agent/client-locale": "3.1.4",
56
+ "@qilin-agent/kylin": "~4.0.3",
57
+ "@qilin-agent/client-store": "3.1.4",
58
+ "@qilin-agent/host-webserver": "3.1.4",
59
+ "@qilin-agent/client-test-runtime": "3.1.4",
60
+ "@qilin-agent/client-ui-primitives": "3.1.4"
61
+ },
62
+ "dependencies": {
63
+ "@qilin-agent/schemastery": "~3.18.3",
64
+ "@qilin-agent/util-values": "3.1.4",
65
+ "@qilin-agent/util-crypto": "3.1.4"
66
+ },
67
+ "scripts": {
68
+ "bundle": "tsdown",
69
+ "watch": "tsdown --watch"
70
+ }
6
71
  }