@cesdk/node 1.77.0-nightly.20260612 → 1.77.0-rc.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.
package/index.d.mts CHANGED
@@ -6684,6 +6684,12 @@ declare class CreativeEngine {
6684
6684
  event: EventAPI;
6685
6685
  scene: SceneAPI;
6686
6686
  variable: VariableAPI;
6687
+ /**
6688
+ * Register, run, and discover named, overridable actions. On headless Node the registry
6689
+ * starts with only the engine-default `ly.img.*` actions (no host UI), but the API is
6690
+ * identical to the browser engine.
6691
+ */
6692
+ actions: EngineActions;
6687
6693
  version: string;
6688
6694
 
6689
6695
  /**
@@ -8099,6 +8105,97 @@ export declare type EffectTypeLonghand = `//ly.img.ubq/effect/${EffectTypeShorth
8099
8105
  /** @public */
8100
8106
  export declare type EffectTypeShorthand = (typeof EFFECT_TYPES)[number];
8101
8107
 
8108
+ /** @public Known action ids from {@link EngineActionsRegistry}. */
8109
+ export declare type EngineActionId = keyof EngineActionsRegistry & string;
8110
+
8111
+ /** @public Info about a registered action, from {@link EngineActions.list}. */
8112
+ export declare interface EngineActionInfo {
8113
+ /** The action id, e.g. `nudge`. */
8114
+ id: string;
8115
+ /** Whether the action currently says it can run. */
8116
+ enabled: boolean;
8117
+ /** Optional JSON description of the arguments it accepts. */
8118
+ argSchema: string | null;
8119
+ }
8120
+
8121
+ /**
8122
+ * @public Named, overridable actions for one engine. Actions are either JS
8123
+ * closures you register or engine defaults (e.g. undo/redo), and
8124
+ * either kind can override the other by reusing the id.
8125
+ *
8126
+ * JS-registered actions run directly in JS, so on the web you get full fidelity:
8127
+ * {@link get} hands back the raw function and {@link run} passes args/results by
8128
+ * reference (non-serializable payloads like File/Blob work). The engine also keeps
8129
+ * a JSON trampoline per action so defaults run natively and host actions stay
8130
+ * reachable across the FFI — that path is JSON-only and async. Engine defaults you
8131
+ * have not overridden are reachable only via {@link run}; {@link get} returns undefined.
8132
+ *
8133
+ * @remarks Main-thread only. {@link get} is web-only; use run/has/list cross-platform.
8134
+ */
8135
+ export declare class EngineActions {
8136
+ #private;
8137
+
8138
+ /**
8139
+ * Register an action, replacing any existing one with the same id.
8140
+ *
8141
+ * @param id - The action id (e.g. `undo`). Reusing an engine default's id overrides it.
8142
+ * @param fn - The action body (sync or async). On the web it runs directly with
8143
+ * any JS values. Across the FFI args/results are JSON, so only serializable
8144
+ * payloads work there.
8145
+ */
8146
+ register<K extends EngineActionId>(id: K, fn: EngineActionsRegistry[K] extends (...args: any[]) => any ? EngineActionsRegistry[K] : EngineCustomActionFunction): void;
8147
+ register(id: string, fn: EngineCustomActionFunction): void;
8148
+ /**
8149
+ * Get the raw registered function for an id so you can call it synchronously.
8150
+ *
8151
+ * Returns the exact function you registered. Returns `undefined` for unknown ids
8152
+ * and engine-default native actions (which have no JS function) — use {@link run}
8153
+ * for those.
8154
+ *
8155
+ * @remarks Web-only.
8156
+ */
8157
+ get<K extends EngineActionId>(id: K): EngineActionsRegistry[K] | undefined;
8158
+ get(id: string): EngineCustomActionFunction | undefined;
8159
+ /**
8160
+ * Run an action by id and return its result as a Promise.
8161
+ *
8162
+ * JS-registered actions are called directly (args/result by reference). Engine
8163
+ * defaults go across the FFI (JSON args/result).
8164
+ *
8165
+ * @param id - The action id.
8166
+ * @param args - Arguments forwarded to the action.
8167
+ * @returns The action's result, or a rejection if the id is unknown or it threw.
8168
+ */
8169
+ run<K extends EngineActionId>(id: K, ...args: EngineActionsRegistry[K] extends (...args: infer A) => any ? A : unknown[]): Promise<EngineActionsRegistry[K] extends (...args: any[]) => infer R ? Awaited<R> : unknown>;
8170
+ run<R = unknown>(id: string, ...args: unknown[]): Promise<R>;
8171
+ /** Whether an action with this id is registered (host or engine default). */
8172
+ has(id: string): boolean;
8173
+ /**
8174
+ * Remove a host action, or revert an overridden engine default to its built-in.
8175
+ *
8176
+ * If you override an engine default (such as `select` or `undo`), unregistering the id restores
8177
+ * the default rather than leaving it unhandled. A custom id you registered yourself is removed
8178
+ * entirely. Returns `false` only when the id is unknown.
8179
+ */
8180
+ unregister(id: string): boolean;
8181
+ /** List registered actions, optionally filtered by a `*` glob matcher on the id. */
8182
+ list(options?: {
8183
+ matcher?: string;
8184
+ }): EngineActionInfo[];
8185
+
8186
+ }
8187
+
8188
+ /**
8189
+ * @public Hook for hosts to add strongly-typed action ids. Augment via
8190
+ * `declare module '@cesdk/engine'` to get autocomplete on register/run while
8191
+ * still allowing custom string ids.
8192
+ */
8193
+ export declare interface EngineActionsRegistry {
8194
+ }
8195
+
8196
+ /** @public A generic, untyped action function for custom ids. */
8197
+ export declare type EngineCustomActionFunction = (...args: any[]) => unknown;
8198
+
8102
8199
  /**
8103
8200
  * Represents an engine plugin.
8104
8201
  *
@@ -9882,6 +9979,7 @@ export declare interface Settings {
9882
9979
 
9883
9980
 
9884
9981
 
9982
+
9885
9983
 
9886
9984
 
9887
9985
  }
package/index.d.ts CHANGED
@@ -6684,6 +6684,12 @@ declare class CreativeEngine {
6684
6684
  event: EventAPI;
6685
6685
  scene: SceneAPI;
6686
6686
  variable: VariableAPI;
6687
+ /**
6688
+ * Register, run, and discover named, overridable actions. On headless Node the registry
6689
+ * starts with only the engine-default `ly.img.*` actions (no host UI), but the API is
6690
+ * identical to the browser engine.
6691
+ */
6692
+ actions: EngineActions;
6687
6693
  version: string;
6688
6694
 
6689
6695
  /**
@@ -8099,6 +8105,97 @@ export declare type EffectTypeLonghand = `//ly.img.ubq/effect/${EffectTypeShorth
8099
8105
  /** @public */
8100
8106
  export declare type EffectTypeShorthand = (typeof EFFECT_TYPES)[number];
8101
8107
 
8108
+ /** @public Known action ids from {@link EngineActionsRegistry}. */
8109
+ export declare type EngineActionId = keyof EngineActionsRegistry & string;
8110
+
8111
+ /** @public Info about a registered action, from {@link EngineActions.list}. */
8112
+ export declare interface EngineActionInfo {
8113
+ /** The action id, e.g. `nudge`. */
8114
+ id: string;
8115
+ /** Whether the action currently says it can run. */
8116
+ enabled: boolean;
8117
+ /** Optional JSON description of the arguments it accepts. */
8118
+ argSchema: string | null;
8119
+ }
8120
+
8121
+ /**
8122
+ * @public Named, overridable actions for one engine. Actions are either JS
8123
+ * closures you register or engine defaults (e.g. undo/redo), and
8124
+ * either kind can override the other by reusing the id.
8125
+ *
8126
+ * JS-registered actions run directly in JS, so on the web you get full fidelity:
8127
+ * {@link get} hands back the raw function and {@link run} passes args/results by
8128
+ * reference (non-serializable payloads like File/Blob work). The engine also keeps
8129
+ * a JSON trampoline per action so defaults run natively and host actions stay
8130
+ * reachable across the FFI — that path is JSON-only and async. Engine defaults you
8131
+ * have not overridden are reachable only via {@link run}; {@link get} returns undefined.
8132
+ *
8133
+ * @remarks Main-thread only. {@link get} is web-only; use run/has/list cross-platform.
8134
+ */
8135
+ export declare class EngineActions {
8136
+ #private;
8137
+
8138
+ /**
8139
+ * Register an action, replacing any existing one with the same id.
8140
+ *
8141
+ * @param id - The action id (e.g. `undo`). Reusing an engine default's id overrides it.
8142
+ * @param fn - The action body (sync or async). On the web it runs directly with
8143
+ * any JS values. Across the FFI args/results are JSON, so only serializable
8144
+ * payloads work there.
8145
+ */
8146
+ register<K extends EngineActionId>(id: K, fn: EngineActionsRegistry[K] extends (...args: any[]) => any ? EngineActionsRegistry[K] : EngineCustomActionFunction): void;
8147
+ register(id: string, fn: EngineCustomActionFunction): void;
8148
+ /**
8149
+ * Get the raw registered function for an id so you can call it synchronously.
8150
+ *
8151
+ * Returns the exact function you registered. Returns `undefined` for unknown ids
8152
+ * and engine-default native actions (which have no JS function) — use {@link run}
8153
+ * for those.
8154
+ *
8155
+ * @remarks Web-only.
8156
+ */
8157
+ get<K extends EngineActionId>(id: K): EngineActionsRegistry[K] | undefined;
8158
+ get(id: string): EngineCustomActionFunction | undefined;
8159
+ /**
8160
+ * Run an action by id and return its result as a Promise.
8161
+ *
8162
+ * JS-registered actions are called directly (args/result by reference). Engine
8163
+ * defaults go across the FFI (JSON args/result).
8164
+ *
8165
+ * @param id - The action id.
8166
+ * @param args - Arguments forwarded to the action.
8167
+ * @returns The action's result, or a rejection if the id is unknown or it threw.
8168
+ */
8169
+ run<K extends EngineActionId>(id: K, ...args: EngineActionsRegistry[K] extends (...args: infer A) => any ? A : unknown[]): Promise<EngineActionsRegistry[K] extends (...args: any[]) => infer R ? Awaited<R> : unknown>;
8170
+ run<R = unknown>(id: string, ...args: unknown[]): Promise<R>;
8171
+ /** Whether an action with this id is registered (host or engine default). */
8172
+ has(id: string): boolean;
8173
+ /**
8174
+ * Remove a host action, or revert an overridden engine default to its built-in.
8175
+ *
8176
+ * If you override an engine default (such as `select` or `undo`), unregistering the id restores
8177
+ * the default rather than leaving it unhandled. A custom id you registered yourself is removed
8178
+ * entirely. Returns `false` only when the id is unknown.
8179
+ */
8180
+ unregister(id: string): boolean;
8181
+ /** List registered actions, optionally filtered by a `*` glob matcher on the id. */
8182
+ list(options?: {
8183
+ matcher?: string;
8184
+ }): EngineActionInfo[];
8185
+
8186
+ }
8187
+
8188
+ /**
8189
+ * @public Hook for hosts to add strongly-typed action ids. Augment via
8190
+ * `declare module '@cesdk/engine'` to get autocomplete on register/run while
8191
+ * still allowing custom string ids.
8192
+ */
8193
+ export declare interface EngineActionsRegistry {
8194
+ }
8195
+
8196
+ /** @public A generic, untyped action function for custom ids. */
8197
+ export declare type EngineCustomActionFunction = (...args: any[]) => unknown;
8198
+
8102
8199
  /**
8103
8200
  * Represents an engine plugin.
8104
8201
  *
@@ -9882,6 +9979,7 @@ export declare interface Settings {
9882
9979
 
9883
9980
 
9884
9981
 
9982
+
9885
9983
 
9886
9984
 
9887
9985
  }