kyomei 0.1.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.
Files changed (3) hide show
  1. package/index.d.ts +51 -0
  2. package/index.js +17 -0
  3. package/package.json +16 -0
package/index.d.ts ADDED
@@ -0,0 +1,51 @@
1
+ export interface PatchboardClient {
2
+ /** Execute the patchboard with optional input data. */
3
+ execute(input?: unknown): Promise<{ run_id: string; items: unknown[] }>;
4
+ }
5
+
6
+ export interface DeviceClient {
7
+ /** Get device information. */
8
+ info(): Promise<unknown>;
9
+ }
10
+
11
+ export interface DiskClient {
12
+ /** Get a URL for a file in this disk. */
13
+ url(path: string): string;
14
+ /** List files in the disk, optionally filtered by path prefix. */
15
+ list(path?: string): Promise<unknown>;
16
+ }
17
+
18
+ export interface KyomeiSDK {
19
+ /** Current project ID. */
20
+ readonly projectId: string;
21
+ /** Access a patchboard by name and execute it. */
22
+ patchboard(name: string): PatchboardClient;
23
+ /** Access a device by name. */
24
+ device(name: string): DeviceClient;
25
+ /** Access a disk/storage by name. */
26
+ disk(name: string): DiskClient;
27
+ /** Navigate to a path. */
28
+ navigate(path: string): void;
29
+ }
30
+
31
+ /**
32
+ * React hook to access the Kyomei SDK.
33
+ * Only available inside code components rendered by the Kyomei Surface Runtime.
34
+ *
35
+ * @example
36
+ * ```tsx
37
+ * import { useKyomei } from "kyomei";
38
+ *
39
+ * export default function OrderList() {
40
+ * const k = useKyomei();
41
+ * const [orders, setOrders] = React.useState([]);
42
+ *
43
+ * React.useEffect(() => {
44
+ * k.patchboard("get-orders").execute({ page: 1 }).then(r => setOrders(r.items));
45
+ * }, []);
46
+ *
47
+ * return <div>{JSON.stringify(orders)}</div>;
48
+ * }
49
+ * ```
50
+ */
51
+ export declare function useKyomei(): KyomeiSDK;
package/index.js ADDED
@@ -0,0 +1,17 @@
1
+ // Kyomei SDK runtime stub.
2
+ // Actual implementation is injected by the Kyomei Surface Runtime via window.__KYOMEI_SDK__.
3
+ // This file exists so the package is importable at build time (esbuild marks it as external).
4
+
5
+ "use strict";
6
+
7
+ function useKyomei() {
8
+ if (typeof window !== "undefined" && window.__KYOMEI_SDK__) {
9
+ return window.__KYOMEI_SDK__;
10
+ }
11
+ throw new Error(
12
+ "useKyomei() is only available inside code components rendered by the Kyomei Surface Runtime."
13
+ );
14
+ }
15
+
16
+ module.exports = { useKyomei };
17
+ module.exports.useKyomei = useKyomei;
package/package.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "kyomei",
3
+ "version": "0.1.0",
4
+ "description": "Kyomei SDK — access patchboards, devices, and storage from code components",
5
+ "types": "index.d.ts",
6
+ "main": "index.js",
7
+ "files": [
8
+ "index.d.ts",
9
+ "index.js"
10
+ ],
11
+ "keywords": ["kyomei", "sdk", "automation", "patchboard"],
12
+ "license": "MIT",
13
+ "peerDependencies": {
14
+ "react": ">=18"
15
+ }
16
+ }