@easynet-run/node 0.27.14

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 (61) hide show
  1. package/README.md +135 -0
  2. package/native/dendrite-bridge-manifest.json +38 -0
  3. package/native/dendrite-bridge.json +15 -0
  4. package/native/include/axon_dendrite_bridge.h +460 -0
  5. package/native/libaxon_dendrite_bridge.so +0 -0
  6. package/package.json +67 -0
  7. package/runtime/easynet-runtime-rs-0.27.14-x86_64-unknown-linux-gnu.tar.gz +0 -0
  8. package/runtime/runtime-bridge-manifest.json +20 -0
  9. package/runtime/runtime-bridge.json +9 -0
  10. package/src/ability_lifecycle.d.ts +140 -0
  11. package/src/ability_lifecycle.js +525 -0
  12. package/src/capability_request.d.ts +14 -0
  13. package/src/capability_request.js +247 -0
  14. package/src/dendrite_bridge/bridge.d.ts +98 -0
  15. package/src/dendrite_bridge/bridge.js +712 -0
  16. package/src/dendrite_bridge/ffi.d.ts +60 -0
  17. package/src/dendrite_bridge/ffi.js +139 -0
  18. package/src/dendrite_bridge/index.d.ts +3 -0
  19. package/src/dendrite_bridge/index.js +25 -0
  20. package/src/dendrite_bridge/types.d.ts +179 -0
  21. package/src/dendrite_bridge/types.js +23 -0
  22. package/src/dendrite_bridge.d.ts +1 -0
  23. package/src/dendrite_bridge.js +27 -0
  24. package/src/errors.d.ts +83 -0
  25. package/src/errors.js +146 -0
  26. package/src/index.d.ts +55 -0
  27. package/src/index.js +164 -0
  28. package/src/koffi.d.ts +34 -0
  29. package/src/mcp/server.d.ts +29 -0
  30. package/src/mcp/server.js +190 -0
  31. package/src/presets/ability_dispatch/args.d.ts +5 -0
  32. package/src/presets/ability_dispatch/args.js +36 -0
  33. package/src/presets/ability_dispatch/bundle.d.ts +7 -0
  34. package/src/presets/ability_dispatch/bundle.js +102 -0
  35. package/src/presets/ability_dispatch/media.d.ts +6 -0
  36. package/src/presets/ability_dispatch/media.js +48 -0
  37. package/src/presets/ability_dispatch/orchestrator.d.ts +21 -0
  38. package/src/presets/ability_dispatch/orchestrator.js +117 -0
  39. package/src/presets/ability_dispatch/workflow.d.ts +50 -0
  40. package/src/presets/ability_dispatch/workflow.js +333 -0
  41. package/src/presets/ability_dispatch.d.ts +1 -0
  42. package/src/presets/ability_dispatch.js +2 -0
  43. package/src/presets/remote_control/config.d.ts +16 -0
  44. package/src/presets/remote_control/config.js +63 -0
  45. package/src/presets/remote_control/descriptor.d.ts +34 -0
  46. package/src/presets/remote_control/descriptor.js +183 -0
  47. package/src/presets/remote_control/handlers.d.ts +12 -0
  48. package/src/presets/remote_control/handlers.js +279 -0
  49. package/src/presets/remote_control/kit.d.ts +22 -0
  50. package/src/presets/remote_control/kit.js +72 -0
  51. package/src/presets/remote_control/kit.test.js +87 -0
  52. package/src/presets/remote_control/orchestrator.d.ts +28 -0
  53. package/src/presets/remote_control/orchestrator.js +118 -0
  54. package/src/presets/remote_control/specs.d.ts +2 -0
  55. package/src/presets/remote_control/specs.js +152 -0
  56. package/src/presets/remote_control_case.d.ts +7 -0
  57. package/src/presets/remote_control_case.js +3 -0
  58. package/src/receipt.d.ts +46 -0
  59. package/src/receipt.js +98 -0
  60. package/src/tool_adapter.d.ts +90 -0
  61. package/src/tool_adapter.js +169 -0
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@easynet-run/node",
3
+ "version": "0.27.14",
4
+ "description": "EasyNet Axon Node.js SDK (sidecar-first with Dendrite bridge payload).",
5
+ "license": "Apache-2.0",
6
+ "homepage": "https://easynet.run",
7
+ "author": "Silan Hu <silan.hu@u.nus.edu>",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/EasyRemote/EasyNet-Axon.git",
11
+ "directory": "sdk/node"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/EasyRemote/EasyNet-Axon/issues"
15
+ },
16
+ "type": "module",
17
+ "scripts": {
18
+ "build": "tsc",
19
+ "check": "tsc --noEmit",
20
+ "types:check": "tsc -p tsconfig.types.json --noEmit",
21
+ "types:build": "tsc -p tsconfig.types.json",
22
+ "types:verify": "npm run types:build && test -f dist/types/index.d.ts && test -f dist/types/dendrite_bridge.d.ts",
23
+ "types": "npm run types:check && npm run types:verify"
24
+ },
25
+ "main": "src/index.js",
26
+ "types": "src/index.d.ts",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./src/index.d.ts",
30
+ "default": "./src/index.js"
31
+ },
32
+ "./presets/remote-control": {
33
+ "types": "./src/presets/remote_control_case.d.ts",
34
+ "default": "./src/presets/remote_control_case.js"
35
+ },
36
+ "./presets/ability-dispatch": {
37
+ "types": "./src/presets/ability_dispatch.d.ts",
38
+ "default": "./src/presets/ability_dispatch.js"
39
+ },
40
+ "./mcp": {
41
+ "types": "./src/mcp/server.d.ts",
42
+ "default": "./src/mcp/server.js"
43
+ },
44
+ "./tool-adapter": {
45
+ "types": "./src/tool_adapter.d.ts",
46
+ "default": "./src/tool_adapter.js"
47
+ }
48
+ },
49
+ "files": [
50
+ "src/**/*.js",
51
+ "src/**/*.d.ts",
52
+ "runtime",
53
+ "native",
54
+ "README.md"
55
+ ],
56
+ "dependencies": {
57
+ "koffi": "^2.15.1"
58
+ },
59
+ "devDependencies": {
60
+ "@types/node": "^20.19.17",
61
+ "typescript": "^5.9.2"
62
+ },
63
+ "sideEffects": false,
64
+ "publishConfig": {
65
+ "access": "public"
66
+ }
67
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "runtime_version": "0.27.14",
3
+ "target": "x86_64-unknown-linux-gnu",
4
+ "os": "linux",
5
+ "arch": "x86_64",
6
+ "artifact": {
7
+ "path": "runtime/easynet-runtime-rs-0.27.14-x86_64-unknown-linux-gnu.tar.gz",
8
+ "sha256": "382b54020ba9caa97e175fdec8e99a45f52209e40d36214f33efc741482e2072",
9
+ "binary_name": "axon-runtime"
10
+ },
11
+ "language_bridge_descriptors": [
12
+ "python/runtime-bridge.json",
13
+ "node/runtime-bridge.json",
14
+ "react/runtime-bridge.json",
15
+ "go/runtime-bridge.json",
16
+ "java/runtime-bridge.json",
17
+ "swift/runtime-bridge.json"
18
+ ],
19
+ "generated_at_utc": "2026-03-19T17:45:33Z"
20
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "language": "node",
3
+ "runtime_version": "0.27.14",
4
+ "target": "x86_64-unknown-linux-gnu",
5
+ "runtime_artifact_path": "runtime/easynet-runtime-rs-0.27.14-x86_64-unknown-linux-gnu.tar.gz",
6
+ "binary_relative_path": "axon-runtime",
7
+ "recommended_extract": "tar -xzf runtime/easynet-runtime-rs-0.27.14-x86_64-unknown-linux-gnu.tar.gz -C <runtime_dir>",
8
+ "recommended_launch": "AXON_ENFORCE_MTLS=false <runtime_dir>/axon-runtime"
9
+ }
@@ -0,0 +1,140 @@
1
+ import { type ChildProcess } from "node:child_process";
2
+ import { type DeployTrace } from "./receipt.js";
3
+ import type { ToolSpec } from "./tool_adapter.js";
4
+ export interface AbilityDescriptor {
5
+ name: string;
6
+ description: string;
7
+ commandTemplate: string;
8
+ inputSchema: Record<string, unknown>;
9
+ outputSchema: Record<string, unknown>;
10
+ version: string;
11
+ tags: string[];
12
+ resourceUri: string;
13
+ }
14
+ export type AbilityTarget = "claude" | "codex" | "openclaw" | "agent_skills";
15
+ export interface AbilityExportResult {
16
+ abilityMd: string;
17
+ invokeScript: string;
18
+ abilityName: string;
19
+ }
20
+ export type { ToolSpec };
21
+ export interface BridgeInterface {
22
+ deployAbilityPackage(tenant: string, nodeId: string, args: Record<string, unknown>): Promise<Record<string, unknown>>;
23
+ listMcpTools(tenant: string, namePattern: string, nodeId: string): Promise<Record<string, unknown>[]>;
24
+ callMcpToolWithArgs(tenant: string, toolName: string, nodeId: string, args: Record<string, unknown>): Promise<Record<string, unknown>>;
25
+ uninstallAbilityWithReason(tenant: string, nodeId: string, installId: string, reason: string): Promise<Record<string, unknown>>;
26
+ listNodes(tenant: string, ownerId: string | null): Promise<Record<string, unknown>[]>;
27
+ deregisterNode(tenant: string, nodeId: string, reason: string): Promise<Record<string, unknown>>;
28
+ drainNode(tenant: string, nodeId: string, reason: string): Promise<Record<string, unknown>>;
29
+ }
30
+ /** Bridge subset for read-only operations. */
31
+ export type ReadBridge = Pick<BridgeInterface, "listMcpTools" | "listNodes">;
32
+ /** Bridge subset for deployment and uninstall operations. */
33
+ export type WriteBridge = Pick<BridgeInterface, "deployAbilityPackage" | "uninstallAbilityWithReason" | "callMcpToolWithArgs">;
34
+ /** Bridge subset for full lifecycle operations (read + write + device management). */
35
+ export type FullBridge = BridgeInterface;
36
+ export interface ServerHandle {
37
+ /** The EasyNet connection URL. */
38
+ endpoint: string;
39
+ /** The server child process (null if connecting to existing). */
40
+ process: ChildProcess | null;
41
+ /** Path to the runtime log file (null if connecting to existing). */
42
+ logFile: string | null;
43
+ /** Stop the server (only if this handle spawned it). */
44
+ stop(): void;
45
+ }
46
+ /**
47
+ * Start or connect to an Axon runtime.
48
+ *
49
+ * @example
50
+ * // Auto-start a local server (zero config):
51
+ * const srv = await startServer();
52
+ *
53
+ * // Connect via axon:// transport URI:
54
+ * const srv = await startServer("axon://localhost");
55
+ * const srv = await startServer("axon://10.0.0.5:50084");
56
+ *
57
+ * // Federation mode — connect the local runtime to a Hub:
58
+ * const srv = await startServer(undefined, { hub: "axon://hub.easynet.run:50084" });
59
+ */
60
+ export declare function startServer(endpoint?: string, options?: {
61
+ logFile?: string;
62
+ timeoutMs?: number;
63
+ /** If true, disables mTLS enforcement. Defaults to true for local auto-start. */
64
+ insecure?: boolean;
65
+ /** Hub Runtime endpoint for federation mode. */
66
+ hub?: string;
67
+ /** Tenant used for federation RPCs. Defaults to "default". */
68
+ hubTenant?: string;
69
+ /** Human-readable label for this runtime in federation membership. */
70
+ hubLabel?: string;
71
+ /** Pre-shared join token used for outbound federation authentication. */
72
+ hubJoinToken?: string;
73
+ }): Promise<ServerHandle>;
74
+ export declare function createAbility(opts: {
75
+ name: string;
76
+ description: string;
77
+ commandTemplate: string;
78
+ inputSchema?: Record<string, unknown>;
79
+ outputSchema?: Record<string, unknown>;
80
+ version?: string;
81
+ tags?: string[];
82
+ resourceUri?: string;
83
+ }): AbilityDescriptor;
84
+ export declare function toToolSpec(descriptor: AbilityDescriptor): ToolSpec;
85
+ export declare function exportAbility(descriptor: AbilityDescriptor, target?: AbilityTarget, axonEndpoint?: string): AbilityExportResult;
86
+ export interface DeployResult {
87
+ result: Record<string, unknown>;
88
+ trace: DeployTrace;
89
+ }
90
+ /**
91
+ * Deploy an AbilityDescriptor to a node via the MCP deploy pipeline.
92
+ *
93
+ * The underlying bridge call executes a three-phase pipeline
94
+ * (Publish → Install → Activate). This function wraps the entire
95
+ * pipeline in a single {@link DeployTrace} receipt so callers get
96
+ * wall-clock timing and error codes even on failure.
97
+ *
98
+ * On failure an {@link AxonInvocationError} is thrown with its `trace`
99
+ * field set to the collected {@link DeployTrace}:
100
+ *
101
+ * ```ts
102
+ * try { await deployToNode(bridge, tenant, nodeId, desc, sig); }
103
+ * catch (e) { if (e instanceof AxonInvocationError) console.log(e.trace); }
104
+ * ```
105
+ */
106
+ export declare function deployToNode(bridge: Pick<BridgeInterface, "deployAbilityPackage">, tenant: string, nodeId: string, descriptor: AbilityDescriptor, signature: string): Promise<DeployResult>;
107
+ export declare function listAbilities(bridge: Pick<BridgeInterface, "listMcpTools">, tenant: string, nodeId: string): Promise<Record<string, unknown>[]>;
108
+ export declare function invokeAbility(bridge: Pick<BridgeInterface, "callMcpToolWithArgs">, tenant: string, nodeId: string, toolName: string, args?: Record<string, unknown>): Promise<Record<string, unknown>>;
109
+ export declare function uninstallAbility(bridge: Pick<BridgeInterface, "uninstallAbilityWithReason">, tenant: string, nodeId: string, installId: string, reason?: string): Promise<Record<string, unknown>>;
110
+ export declare function discoverNodes(bridge: Pick<BridgeInterface, "listNodes">, tenant: string): Promise<Record<string, unknown>[]>;
111
+ export declare function executeCommand(bridge: Pick<BridgeInterface, "callMcpToolWithArgs" | "deployAbilityPackage" | "uninstallAbilityWithReason">, tenant: string, nodeId: string, command: string): Promise<Record<string, unknown>>;
112
+ export interface ForgetAllFailure {
113
+ tool_name: string;
114
+ error: string;
115
+ }
116
+ export interface ForgetAllResult {
117
+ removed: string[];
118
+ removed_count: number;
119
+ failed: ForgetAllFailure[];
120
+ failed_count: number;
121
+ }
122
+ /**
123
+ * Remove all deployed abilities from a device.
124
+ * Requires `confirm = true` as a safety gate (destructive operation).
125
+ *
126
+ * When `options.dryRun` is `true`, the function lists all abilities that would
127
+ * be removed without performing any uninstalls. The `confirm` parameter is
128
+ * ignored for dry-run calls since no data is modified.
129
+ *
130
+ * @throws {AxonPartialSuccessError} When any uninstall fails (partial or total failure).
131
+ * @throws {AxonConfigError} When `confirm` is not `true` and `dryRun` is not set.
132
+ */
133
+ export declare function forgetAll(bridge: Pick<BridgeInterface, "listMcpTools" | "uninstallAbilityWithReason">, tenant: string, nodeId: string, confirm?: boolean, options?: {
134
+ dryRun?: boolean;
135
+ }): Promise<ForgetAllResult>;
136
+ export declare function disconnectDevice(bridge: Pick<BridgeInterface, "deregisterNode">, tenant: string, nodeId: string, reason?: string): Promise<Record<string, unknown>>;
137
+ export declare function drainDevice(bridge: Pick<BridgeInterface, "drainNode">, tenant: string, nodeId: string, reason?: string): Promise<Record<string, unknown>>;
138
+ export declare function listRemoteTools(bridge: Pick<BridgeInterface, "listMcpTools">, tenant: string, namePattern?: string, nodeId?: string): Promise<Record<string, unknown>[]>;
139
+ export declare function buildDeployPackage(args: Record<string, unknown>, signature: string): Record<string, unknown>;
140
+ export declare function deployPackage(bridge: Pick<BridgeInterface, "deployAbilityPackage">, tenant: string, nodeId: string, packageDescriptor: Record<string, unknown>): Promise<Record<string, unknown>>;