@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.
- package/README.md +135 -0
- package/native/dendrite-bridge-manifest.json +38 -0
- package/native/dendrite-bridge.json +15 -0
- package/native/include/axon_dendrite_bridge.h +460 -0
- package/native/libaxon_dendrite_bridge.so +0 -0
- package/package.json +67 -0
- package/runtime/easynet-runtime-rs-0.27.14-x86_64-unknown-linux-gnu.tar.gz +0 -0
- package/runtime/runtime-bridge-manifest.json +20 -0
- package/runtime/runtime-bridge.json +9 -0
- package/src/ability_lifecycle.d.ts +140 -0
- package/src/ability_lifecycle.js +525 -0
- package/src/capability_request.d.ts +14 -0
- package/src/capability_request.js +247 -0
- package/src/dendrite_bridge/bridge.d.ts +98 -0
- package/src/dendrite_bridge/bridge.js +712 -0
- package/src/dendrite_bridge/ffi.d.ts +60 -0
- package/src/dendrite_bridge/ffi.js +139 -0
- package/src/dendrite_bridge/index.d.ts +3 -0
- package/src/dendrite_bridge/index.js +25 -0
- package/src/dendrite_bridge/types.d.ts +179 -0
- package/src/dendrite_bridge/types.js +23 -0
- package/src/dendrite_bridge.d.ts +1 -0
- package/src/dendrite_bridge.js +27 -0
- package/src/errors.d.ts +83 -0
- package/src/errors.js +146 -0
- package/src/index.d.ts +55 -0
- package/src/index.js +164 -0
- package/src/koffi.d.ts +34 -0
- package/src/mcp/server.d.ts +29 -0
- package/src/mcp/server.js +190 -0
- package/src/presets/ability_dispatch/args.d.ts +5 -0
- package/src/presets/ability_dispatch/args.js +36 -0
- package/src/presets/ability_dispatch/bundle.d.ts +7 -0
- package/src/presets/ability_dispatch/bundle.js +102 -0
- package/src/presets/ability_dispatch/media.d.ts +6 -0
- package/src/presets/ability_dispatch/media.js +48 -0
- package/src/presets/ability_dispatch/orchestrator.d.ts +21 -0
- package/src/presets/ability_dispatch/orchestrator.js +117 -0
- package/src/presets/ability_dispatch/workflow.d.ts +50 -0
- package/src/presets/ability_dispatch/workflow.js +333 -0
- package/src/presets/ability_dispatch.d.ts +1 -0
- package/src/presets/ability_dispatch.js +2 -0
- package/src/presets/remote_control/config.d.ts +16 -0
- package/src/presets/remote_control/config.js +63 -0
- package/src/presets/remote_control/descriptor.d.ts +34 -0
- package/src/presets/remote_control/descriptor.js +183 -0
- package/src/presets/remote_control/handlers.d.ts +12 -0
- package/src/presets/remote_control/handlers.js +279 -0
- package/src/presets/remote_control/kit.d.ts +22 -0
- package/src/presets/remote_control/kit.js +72 -0
- package/src/presets/remote_control/kit.test.js +87 -0
- package/src/presets/remote_control/orchestrator.d.ts +28 -0
- package/src/presets/remote_control/orchestrator.js +118 -0
- package/src/presets/remote_control/specs.d.ts +2 -0
- package/src/presets/remote_control/specs.js +152 -0
- package/src/presets/remote_control_case.d.ts +7 -0
- package/src/presets/remote_control_case.js +3 -0
- package/src/receipt.d.ts +46 -0
- package/src/receipt.js +98 -0
- package/src/tool_adapter.d.ts +90 -0
- package/src/tool_adapter.js +169 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { DendriteError } from "../capability_request.js";
|
|
2
|
+
export declare const DEFAULT_TIMEOUT_MS = 30000;
|
|
3
|
+
export declare const DEFAULT_CONNECT_TIMEOUT_MS = 5000;
|
|
4
|
+
interface DendriteBridgeJson {
|
|
5
|
+
ok: boolean;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
}
|
|
8
|
+
export { DendriteError };
|
|
9
|
+
export type DendriteJsonFn<TArgs extends unknown[] = unknown[]> = (...args: TArgs) => string | null;
|
|
10
|
+
export type DendriteBridgeLib = {
|
|
11
|
+
axon_dendrite_client_open_json: DendriteJsonFn<[string]>;
|
|
12
|
+
axon_dendrite_client_close_json: DendriteJsonFn<[bigint]>;
|
|
13
|
+
axon_dendrite_unary_call_json: DendriteJsonFn<[bigint, string]>;
|
|
14
|
+
axon_dendrite_server_stream_call_json: DendriteJsonFn<[bigint, string]>;
|
|
15
|
+
axon_dendrite_client_stream_call_json: DendriteJsonFn<[bigint, string]>;
|
|
16
|
+
axon_dendrite_bidi_stream_call_json: DendriteJsonFn<[bigint, string]>;
|
|
17
|
+
axon_dendrite_invoke_ability_json: DendriteJsonFn<[bigint, string]>;
|
|
18
|
+
axon_dendrite_protocol_catalog_json: DendriteJsonFn<[]>;
|
|
19
|
+
axon_dendrite_invoke_protocol_json: DendriteJsonFn<[bigint, string]>;
|
|
20
|
+
axon_dendrite_list_nodes_json: DendriteJsonFn<[bigint, string]>;
|
|
21
|
+
axon_dendrite_register_node_json: DendriteJsonFn<[bigint, string]>;
|
|
22
|
+
axon_dendrite_deregister_node_json?: DendriteJsonFn<[bigint, string]>;
|
|
23
|
+
axon_dendrite_heartbeat_json: DendriteJsonFn<[bigint, string]>;
|
|
24
|
+
axon_dendrite_publish_capability_json: DendriteJsonFn<[bigint, string]>;
|
|
25
|
+
axon_dendrite_install_capability_json: DendriteJsonFn<[bigint, string]>;
|
|
26
|
+
axon_dendrite_activate_capability_json: DendriteJsonFn<[bigint, string]>;
|
|
27
|
+
axon_dendrite_list_a2a_agents_json: DendriteJsonFn<[bigint, string]>;
|
|
28
|
+
axon_dendrite_get_a2a_agent_card_json: DendriteJsonFn<[bigint, string]>;
|
|
29
|
+
axon_dendrite_send_a2a_task_json: DendriteJsonFn<[bigint, string]>;
|
|
30
|
+
axon_dendrite_deploy_mcp_list_dir_json: DendriteJsonFn<[bigint, string]>;
|
|
31
|
+
axon_dendrite_list_mcp_tools_json: DendriteJsonFn<[bigint, string]>;
|
|
32
|
+
axon_dendrite_call_mcp_tool_json: DendriteJsonFn<[bigint, string]>;
|
|
33
|
+
axon_dendrite_uninstall_capability_json: DendriteJsonFn<[bigint, string]>;
|
|
34
|
+
axon_dendrite_update_mcp_list_dir_json: DendriteJsonFn<[bigint, string]>;
|
|
35
|
+
axon_dendrite_voice_create_call_json: DendriteJsonFn<[bigint, string]>;
|
|
36
|
+
axon_dendrite_voice_get_call_json: DendriteJsonFn<[bigint, string]>;
|
|
37
|
+
axon_dendrite_voice_join_call_json: DendriteJsonFn<[bigint, string]>;
|
|
38
|
+
axon_dendrite_voice_leave_call_json: DendriteJsonFn<[bigint, string]>;
|
|
39
|
+
axon_dendrite_voice_update_media_path_json: DendriteJsonFn<[bigint, string]>;
|
|
40
|
+
axon_dendrite_voice_report_call_metrics_json: DendriteJsonFn<[bigint, string]>;
|
|
41
|
+
axon_dendrite_voice_end_call_json: DendriteJsonFn<[bigint, string]>;
|
|
42
|
+
axon_dendrite_voice_watch_call_events_json: DendriteJsonFn<[bigint, string]>;
|
|
43
|
+
axon_dendrite_voice_create_transport_session_json: DendriteJsonFn<[bigint, string]>;
|
|
44
|
+
axon_dendrite_voice_get_transport_session_json: DendriteJsonFn<[bigint, string]>;
|
|
45
|
+
axon_dendrite_voice_set_transport_description_json: DendriteJsonFn<[bigint, string]>;
|
|
46
|
+
axon_dendrite_voice_add_transport_candidate_json: DendriteJsonFn<[bigint, string]>;
|
|
47
|
+
axon_dendrite_voice_refresh_transport_lease_json: DendriteJsonFn<[bigint, string]>;
|
|
48
|
+
axon_dendrite_voice_end_transport_session_json: DendriteJsonFn<[bigint, string]>;
|
|
49
|
+
axon_dendrite_voice_watch_transport_events_json: DendriteJsonFn<[bigint, string]>;
|
|
50
|
+
axon_dendrite_server_stream_open_json?: DendriteJsonFn<[bigint, string]>;
|
|
51
|
+
axon_dendrite_stream_next_json?: DendriteJsonFn<[bigint, string]>;
|
|
52
|
+
axon_dendrite_stream_close_json?: DendriteJsonFn<[bigint]>;
|
|
53
|
+
axon_dendrite_bidi_stream_open_json?: DendriteJsonFn<[bigint, string]>;
|
|
54
|
+
axon_dendrite_bidi_stream_send_json?: DendriteJsonFn<[bigint, string]>;
|
|
55
|
+
axon_dendrite_protocol_coverage_json: DendriteJsonFn<[]>;
|
|
56
|
+
};
|
|
57
|
+
export declare function resolveLibraryPath(explicitPath?: string): string;
|
|
58
|
+
export declare function loadDendriteLib(libraryPath: string): DendriteBridgeLib;
|
|
59
|
+
export declare function requireBridgeFn<TArgs extends unknown[]>(fn: DendriteJsonFn<TArgs> | undefined, featureMessage: string): DendriteJsonFn<TArgs>;
|
|
60
|
+
export declare function callJson<TArgs extends unknown[]>(fn: DendriteJsonFn<TArgs>, ...args: TArgs): DendriteBridgeJson;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// EasyNet Axon for AgentNet
|
|
2
|
+
// =========================
|
|
3
|
+
//
|
|
4
|
+
// File: sdk/node/src/dendrite_bridge/ffi.ts
|
|
5
|
+
// Description: FFI loading and JSON calling layer for the Dendrite native bridge; resolves the shared library, binds koffi function pointers, and provides the callJson helper.
|
|
6
|
+
//
|
|
7
|
+
// Protocol Responsibility:
|
|
8
|
+
// - Loads the native dendrite bridge shared library and exposes typed function bindings.
|
|
9
|
+
// - Provides the low-level callJson helper that handles JSON serialization/error mapping.
|
|
10
|
+
//
|
|
11
|
+
// Implementation Approach:
|
|
12
|
+
// - Uses koffi for native FFI binding.
|
|
13
|
+
// - Keeps library resolution and error handling explicit.
|
|
14
|
+
//
|
|
15
|
+
// Usage Contract:
|
|
16
|
+
// - Callers should use loadDendriteLib to obtain function bindings, then callJson to invoke them.
|
|
17
|
+
// - Errors are surfaced as DendriteError instances.
|
|
18
|
+
//
|
|
19
|
+
// Architectural Position:
|
|
20
|
+
// - Part of the Node SDK dendrite_bridge submodule layer.
|
|
21
|
+
// - Should not embed class or interface logic outside FFI concerns.
|
|
22
|
+
//
|
|
23
|
+
// Author: Silan.Hu
|
|
24
|
+
// Email: silan.hu@u.nus.edu
|
|
25
|
+
// Copyright (c) 2026-2027 easynet. All rights reserved.
|
|
26
|
+
import { createRequire } from "node:module";
|
|
27
|
+
import { existsSync } from "node:fs";
|
|
28
|
+
import { dirname, resolve } from "node:path";
|
|
29
|
+
import { fileURLToPath } from "node:url";
|
|
30
|
+
import { DendriteError } from "../capability_request.js";
|
|
31
|
+
const require = createRequire(import.meta.url);
|
|
32
|
+
const koffi = require("koffi");
|
|
33
|
+
export const DEFAULT_TIMEOUT_MS = 30000;
|
|
34
|
+
export const DEFAULT_CONNECT_TIMEOUT_MS = 5000;
|
|
35
|
+
export { DendriteError };
|
|
36
|
+
export function resolveLibraryPath(explicitPath) {
|
|
37
|
+
if (explicitPath)
|
|
38
|
+
return explicitPath;
|
|
39
|
+
if (process.env.EASYNET_DENDRITE_BRIDGE_LIB)
|
|
40
|
+
return process.env.EASYNET_DENDRITE_BRIDGE_LIB;
|
|
41
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
42
|
+
const candidates = [
|
|
43
|
+
resolve(here, "../../native/libaxon_dendrite_bridge.dylib"),
|
|
44
|
+
resolve(here, "../../native/libaxon_dendrite_bridge.so"),
|
|
45
|
+
resolve(here, "../../native/axon_dendrite_bridge.dll"),
|
|
46
|
+
];
|
|
47
|
+
for (const c of candidates) {
|
|
48
|
+
if (existsSync(c))
|
|
49
|
+
return c;
|
|
50
|
+
}
|
|
51
|
+
throw new DendriteError("dendrite bridge library not found; set EASYNET_DENDRITE_BRIDGE_LIB or ensure package contains native/libaxon_dendrite_bridge.*");
|
|
52
|
+
}
|
|
53
|
+
export function loadDendriteLib(libraryPath) {
|
|
54
|
+
const lib = koffi.load(libraryPath);
|
|
55
|
+
const freeString = lib.func("void axon_dendrite_string_free(void *ptr)");
|
|
56
|
+
const bridgeString = koffi.disposable("str", (ptr) => {
|
|
57
|
+
if (ptr)
|
|
58
|
+
freeString(ptr);
|
|
59
|
+
});
|
|
60
|
+
const optionalJsonFn = (name, argTypes) => {
|
|
61
|
+
try {
|
|
62
|
+
return lib.func(name, bridgeString, argTypes);
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
return {
|
|
69
|
+
axon_dendrite_client_open_json: lib.func("axon_dendrite_client_open_json", bridgeString, ["str"]),
|
|
70
|
+
axon_dendrite_client_close_json: lib.func("axon_dendrite_client_close_json", bridgeString, ["uint64_t"]),
|
|
71
|
+
axon_dendrite_unary_call_json: lib.func("axon_dendrite_unary_call_json", bridgeString, ["uint64_t", "str"]),
|
|
72
|
+
axon_dendrite_server_stream_call_json: lib.func("axon_dendrite_server_stream_call_json", bridgeString, ["uint64_t", "str"]),
|
|
73
|
+
axon_dendrite_client_stream_call_json: lib.func("axon_dendrite_client_stream_call_json", bridgeString, ["uint64_t", "str"]),
|
|
74
|
+
axon_dendrite_bidi_stream_call_json: lib.func("axon_dendrite_bidi_stream_call_json", bridgeString, ["uint64_t", "str"]),
|
|
75
|
+
axon_dendrite_invoke_ability_json: lib.func("axon_dendrite_invoke_ability_json", bridgeString, ["uint64_t", "str"]),
|
|
76
|
+
axon_dendrite_protocol_catalog_json: lib.func("axon_dendrite_protocol_catalog_json", bridgeString, []),
|
|
77
|
+
axon_dendrite_invoke_protocol_json: lib.func("axon_dendrite_invoke_protocol_json", bridgeString, ["uint64_t", "str"]),
|
|
78
|
+
axon_dendrite_list_nodes_json: lib.func("axon_dendrite_list_nodes_json", bridgeString, ["uint64_t", "str"]),
|
|
79
|
+
axon_dendrite_register_node_json: lib.func("axon_dendrite_register_node_json", bridgeString, ["uint64_t", "str"]),
|
|
80
|
+
axon_dendrite_deregister_node_json: optionalJsonFn("axon_dendrite_deregister_node_json", ["uint64_t", "str"]),
|
|
81
|
+
axon_dendrite_heartbeat_json: lib.func("axon_dendrite_heartbeat_json", bridgeString, ["uint64_t", "str"]),
|
|
82
|
+
axon_dendrite_publish_capability_json: lib.func("axon_dendrite_publish_capability_json", bridgeString, ["uint64_t", "str"]),
|
|
83
|
+
axon_dendrite_install_capability_json: lib.func("axon_dendrite_install_capability_json", bridgeString, ["uint64_t", "str"]),
|
|
84
|
+
axon_dendrite_activate_capability_json: lib.func("axon_dendrite_activate_capability_json", bridgeString, ["uint64_t", "str"]),
|
|
85
|
+
axon_dendrite_list_a2a_agents_json: lib.func("axon_dendrite_list_a2a_agents_json", bridgeString, ["uint64_t", "str"]),
|
|
86
|
+
axon_dendrite_get_a2a_agent_card_json: lib.func("axon_dendrite_get_a2a_agent_card_json", bridgeString, ["uint64_t", "str"]),
|
|
87
|
+
axon_dendrite_send_a2a_task_json: lib.func("axon_dendrite_send_a2a_task_json", bridgeString, ["uint64_t", "str"]),
|
|
88
|
+
axon_dendrite_deploy_mcp_list_dir_json: lib.func("axon_dendrite_deploy_mcp_list_dir_json", bridgeString, ["uint64_t", "str"]),
|
|
89
|
+
axon_dendrite_list_mcp_tools_json: lib.func("axon_dendrite_list_mcp_tools_json", bridgeString, ["uint64_t", "str"]),
|
|
90
|
+
axon_dendrite_call_mcp_tool_json: lib.func("axon_dendrite_call_mcp_tool_json", bridgeString, ["uint64_t", "str"]),
|
|
91
|
+
axon_dendrite_uninstall_capability_json: lib.func("axon_dendrite_uninstall_capability_json", bridgeString, ["uint64_t", "str"]),
|
|
92
|
+
axon_dendrite_update_mcp_list_dir_json: lib.func("axon_dendrite_update_mcp_list_dir_json", bridgeString, ["uint64_t", "str"]),
|
|
93
|
+
axon_dendrite_voice_create_call_json: lib.func("axon_dendrite_voice_create_call_json", bridgeString, ["uint64_t", "str"]),
|
|
94
|
+
axon_dendrite_voice_get_call_json: lib.func("axon_dendrite_voice_get_call_json", bridgeString, ["uint64_t", "str"]),
|
|
95
|
+
axon_dendrite_voice_join_call_json: lib.func("axon_dendrite_voice_join_call_json", bridgeString, ["uint64_t", "str"]),
|
|
96
|
+
axon_dendrite_voice_leave_call_json: lib.func("axon_dendrite_voice_leave_call_json", bridgeString, ["uint64_t", "str"]),
|
|
97
|
+
axon_dendrite_voice_update_media_path_json: lib.func("axon_dendrite_voice_update_media_path_json", bridgeString, ["uint64_t", "str"]),
|
|
98
|
+
axon_dendrite_voice_report_call_metrics_json: lib.func("axon_dendrite_voice_report_call_metrics_json", bridgeString, ["uint64_t", "str"]),
|
|
99
|
+
axon_dendrite_voice_end_call_json: lib.func("axon_dendrite_voice_end_call_json", bridgeString, ["uint64_t", "str"]),
|
|
100
|
+
axon_dendrite_voice_watch_call_events_json: lib.func("axon_dendrite_voice_watch_call_events_json", bridgeString, ["uint64_t", "str"]),
|
|
101
|
+
axon_dendrite_voice_create_transport_session_json: lib.func("axon_dendrite_voice_create_transport_session_json", bridgeString, ["uint64_t", "str"]),
|
|
102
|
+
axon_dendrite_voice_get_transport_session_json: lib.func("axon_dendrite_voice_get_transport_session_json", bridgeString, ["uint64_t", "str"]),
|
|
103
|
+
axon_dendrite_voice_set_transport_description_json: lib.func("axon_dendrite_voice_set_transport_description_json", bridgeString, ["uint64_t", "str"]),
|
|
104
|
+
axon_dendrite_voice_add_transport_candidate_json: lib.func("axon_dendrite_voice_add_transport_candidate_json", bridgeString, ["uint64_t", "str"]),
|
|
105
|
+
axon_dendrite_voice_refresh_transport_lease_json: lib.func("axon_dendrite_voice_refresh_transport_lease_json", bridgeString, ["uint64_t", "str"]),
|
|
106
|
+
axon_dendrite_voice_end_transport_session_json: lib.func("axon_dendrite_voice_end_transport_session_json", bridgeString, ["uint64_t", "str"]),
|
|
107
|
+
axon_dendrite_voice_watch_transport_events_json: lib.func("axon_dendrite_voice_watch_transport_events_json", bridgeString, ["uint64_t", "str"]),
|
|
108
|
+
// Incremental streaming
|
|
109
|
+
axon_dendrite_server_stream_open_json: optionalJsonFn("axon_dendrite_server_stream_open_json", ["uint64_t", "str"]),
|
|
110
|
+
axon_dendrite_stream_next_json: optionalJsonFn("axon_dendrite_stream_next_json", ["uint64_t", "str"]),
|
|
111
|
+
axon_dendrite_stream_close_json: optionalJsonFn("axon_dendrite_stream_close_json", ["uint64_t"]),
|
|
112
|
+
axon_dendrite_bidi_stream_open_json: optionalJsonFn("axon_dendrite_bidi_stream_open_json", ["uint64_t", "str"]),
|
|
113
|
+
axon_dendrite_bidi_stream_send_json: optionalJsonFn("axon_dendrite_bidi_stream_send_json", ["uint64_t", "str"]),
|
|
114
|
+
axon_dendrite_protocol_coverage_json: lib.func("axon_dendrite_protocol_coverage_json", bridgeString, []),
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
export function requireBridgeFn(fn, featureMessage) {
|
|
118
|
+
if (!fn) {
|
|
119
|
+
throw new DendriteError(featureMessage);
|
|
120
|
+
}
|
|
121
|
+
return fn;
|
|
122
|
+
}
|
|
123
|
+
export function callJson(fn, ...args) {
|
|
124
|
+
const raw = fn(...args);
|
|
125
|
+
if (typeof raw !== "string" || raw.length === 0) {
|
|
126
|
+
throw new DendriteError("dendrite bridge returned empty payload");
|
|
127
|
+
}
|
|
128
|
+
let parsed;
|
|
129
|
+
try {
|
|
130
|
+
parsed = JSON.parse(raw);
|
|
131
|
+
}
|
|
132
|
+
catch (err) {
|
|
133
|
+
throw new DendriteError(`dendrite bridge returned invalid JSON: ${err instanceof SyntaxError ? err.message : String(err)}`);
|
|
134
|
+
}
|
|
135
|
+
if (!parsed.ok) {
|
|
136
|
+
throw new DendriteError(String(parsed.error ?? "unknown dendrite bridge error"));
|
|
137
|
+
}
|
|
138
|
+
return parsed;
|
|
139
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// EasyNet Axon for AgentNet
|
|
2
|
+
// =========================
|
|
3
|
+
//
|
|
4
|
+
// File: sdk/node/src/dendrite_bridge/index.ts
|
|
5
|
+
// Description: Barrel re-exports for the dendrite_bridge submodule; gathers types, FFI helpers, and the DendriteBridge class into a single entry point.
|
|
6
|
+
//
|
|
7
|
+
// Protocol Responsibility:
|
|
8
|
+
// - Re-exports the public API surface of the dendrite_bridge submodule.
|
|
9
|
+
//
|
|
10
|
+
// Implementation Approach:
|
|
11
|
+
// - Pure re-exports with no additional logic.
|
|
12
|
+
//
|
|
13
|
+
// Usage Contract:
|
|
14
|
+
// - Import from this module (or from the parent dendrite_bridge.ts barrel) to access all public dendrite_bridge symbols.
|
|
15
|
+
//
|
|
16
|
+
// Architectural Position:
|
|
17
|
+
// - Part of the Node SDK dendrite_bridge submodule layer.
|
|
18
|
+
// - Should not embed logic beyond re-exports.
|
|
19
|
+
//
|
|
20
|
+
// Author: Silan.Hu
|
|
21
|
+
// Email: silan.hu@u.nus.edu
|
|
22
|
+
// Copyright (c) 2026-2027 easynet. All rights reserved.
|
|
23
|
+
export * from "./types.js";
|
|
24
|
+
export { DendriteBridge, DendriteServerStream, DendriteBidiStream } from "./bridge.js";
|
|
25
|
+
export { DendriteError } from "./ffi.js";
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
export interface DendriteBridgeOptions {
|
|
2
|
+
endpoint: string;
|
|
3
|
+
connectTimeoutMs?: number;
|
|
4
|
+
libraryPath?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface DendriteUnaryCallOptions {
|
|
7
|
+
metadata?: Record<string, string>;
|
|
8
|
+
timeoutMs?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface DendriteAbilityCallOptions extends DendriteUnaryCallOptions {
|
|
11
|
+
subjectId?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface DendriteStreamCallOptions extends DendriteUnaryCallOptions {
|
|
14
|
+
maxChunks?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface DendriteClientStreamCallOptions extends DendriteUnaryCallOptions {
|
|
17
|
+
maxRequestChunks?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface DendriteBidiStreamCallOptions extends DendriteUnaryCallOptions {
|
|
20
|
+
maxRequestChunks?: number;
|
|
21
|
+
maxResponseChunks?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface DendriteListNodesOptions {
|
|
24
|
+
ownerId?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface DendriteRegisterNodeOptions {
|
|
27
|
+
displayName?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface DendritePublishCapabilityOptions {
|
|
30
|
+
version: string;
|
|
31
|
+
digest?: string;
|
|
32
|
+
signatureBase64: string;
|
|
33
|
+
tags?: string[];
|
|
34
|
+
requirements?: Record<string, string>;
|
|
35
|
+
metadata?: Record<string, string>;
|
|
36
|
+
payloadUri?: string;
|
|
37
|
+
payloadSizeBytes?: number;
|
|
38
|
+
packageBytesBase64?: string;
|
|
39
|
+
signatureFingerprint?: string;
|
|
40
|
+
packageFingerprint?: string;
|
|
41
|
+
publisherKeyVersion?: number;
|
|
42
|
+
}
|
|
43
|
+
export interface DendriteInstallCapabilityOptions {
|
|
44
|
+
version: string;
|
|
45
|
+
digest?: string;
|
|
46
|
+
requireConsent?: boolean;
|
|
47
|
+
allowTransferredCode?: boolean;
|
|
48
|
+
executionMode?: string;
|
|
49
|
+
installTimeoutSeconds?: number;
|
|
50
|
+
payloadDigest?: string;
|
|
51
|
+
payloadSizeBytes?: number;
|
|
52
|
+
signatureFingerprint?: string;
|
|
53
|
+
packageFingerprint?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface DendriteListA2aAgentsOptions {
|
|
56
|
+
tags?: string[];
|
|
57
|
+
ownerId?: string;
|
|
58
|
+
limit?: number;
|
|
59
|
+
}
|
|
60
|
+
export interface DendriteSendA2aTaskOptions {
|
|
61
|
+
inputJson?: unknown;
|
|
62
|
+
inputBase64?: string;
|
|
63
|
+
taskId?: string;
|
|
64
|
+
idempotencyKey?: string;
|
|
65
|
+
}
|
|
66
|
+
export interface DendriteDeployMcpListDirOptions {
|
|
67
|
+
targetPath?: string;
|
|
68
|
+
commandTemplate?: string;
|
|
69
|
+
packageId?: string;
|
|
70
|
+
capabilityName?: string;
|
|
71
|
+
toolName?: string;
|
|
72
|
+
version?: string;
|
|
73
|
+
digest?: string;
|
|
74
|
+
signatureBase64?: string;
|
|
75
|
+
packageBytesBase64?: string;
|
|
76
|
+
}
|
|
77
|
+
export interface DendriteListMcpToolsOptions {
|
|
78
|
+
namePattern?: string;
|
|
79
|
+
tags?: string[];
|
|
80
|
+
nodeId?: string;
|
|
81
|
+
}
|
|
82
|
+
export interface DendriteCallMcpToolOptions {
|
|
83
|
+
targetNodeId?: string;
|
|
84
|
+
argumentsJson?: unknown;
|
|
85
|
+
argumentsBase64?: string;
|
|
86
|
+
}
|
|
87
|
+
export interface DendriteUninstallCapabilityOptions {
|
|
88
|
+
deactivateFirst?: boolean;
|
|
89
|
+
deactivateReason?: string;
|
|
90
|
+
force?: boolean;
|
|
91
|
+
}
|
|
92
|
+
export interface DendriteUpdateMcpListDirOptions extends DendriteDeployMcpListDirOptions {
|
|
93
|
+
existingInstallId?: string;
|
|
94
|
+
deactivateOld?: boolean;
|
|
95
|
+
uninstallOld?: boolean;
|
|
96
|
+
forceUninstall?: boolean;
|
|
97
|
+
deactivateReason?: string;
|
|
98
|
+
}
|
|
99
|
+
export interface DendriteVoiceCodecProfileOptions {
|
|
100
|
+
codec?: string;
|
|
101
|
+
sampleRateHz?: number;
|
|
102
|
+
channels?: number;
|
|
103
|
+
ptimeMs?: number;
|
|
104
|
+
maxBitrateKbps?: number;
|
|
105
|
+
fecEnabled?: boolean;
|
|
106
|
+
dtxEnabled?: boolean;
|
|
107
|
+
}
|
|
108
|
+
export interface DendriteVoiceMetricsOptions {
|
|
109
|
+
rttMs?: number;
|
|
110
|
+
jitterMs?: number;
|
|
111
|
+
packetLossRatio?: number;
|
|
112
|
+
concealedSamples?: number;
|
|
113
|
+
audioLevelDbov?: number;
|
|
114
|
+
}
|
|
115
|
+
export interface DendriteVoiceDescriptionOptions {
|
|
116
|
+
sdpType?: number;
|
|
117
|
+
sdp?: string;
|
|
118
|
+
updatedAtUnixMs?: number;
|
|
119
|
+
revisionId?: string;
|
|
120
|
+
}
|
|
121
|
+
export interface DendriteVoiceCandidateOptions {
|
|
122
|
+
candidate?: string;
|
|
123
|
+
sdpMid?: string;
|
|
124
|
+
sdpMlineIndex?: number;
|
|
125
|
+
usernameFragment?: string;
|
|
126
|
+
gatheredAtUnixMs?: number;
|
|
127
|
+
}
|
|
128
|
+
export interface DendriteVoiceCreateCallOptions {
|
|
129
|
+
callId?: string;
|
|
130
|
+
displayName?: string;
|
|
131
|
+
participantLimit?: number;
|
|
132
|
+
preferredCodec?: DendriteVoiceCodecProfileOptions;
|
|
133
|
+
metadata?: Record<string, string>;
|
|
134
|
+
}
|
|
135
|
+
export interface DendriteVoiceJoinCallOptions {
|
|
136
|
+
participantId?: string;
|
|
137
|
+
nodeId?: string;
|
|
138
|
+
transport?: number;
|
|
139
|
+
streamSessionId?: string;
|
|
140
|
+
codecProfile?: DendriteVoiceCodecProfileOptions;
|
|
141
|
+
muted?: boolean;
|
|
142
|
+
}
|
|
143
|
+
export interface DendriteVoiceUpdateMediaPathOptions {
|
|
144
|
+
transport?: number;
|
|
145
|
+
streamSessionId?: string;
|
|
146
|
+
muted?: boolean;
|
|
147
|
+
}
|
|
148
|
+
export interface DendriteVoiceEndCallOptions {
|
|
149
|
+
endReason?: number;
|
|
150
|
+
detail?: string;
|
|
151
|
+
}
|
|
152
|
+
export interface DendriteVoiceWatchOptions {
|
|
153
|
+
fromSequence?: number;
|
|
154
|
+
maxEvents?: number;
|
|
155
|
+
timeoutMs?: number;
|
|
156
|
+
}
|
|
157
|
+
export interface DendriteVoiceCreateTransportSessionOptions {
|
|
158
|
+
transportSessionId?: string;
|
|
159
|
+
transport?: number;
|
|
160
|
+
localDescription?: DendriteVoiceDescriptionOptions;
|
|
161
|
+
requestedTtlSeconds?: number;
|
|
162
|
+
metadata?: Record<string, string>;
|
|
163
|
+
}
|
|
164
|
+
export interface DendriteVoiceEndTransportSessionOptions {
|
|
165
|
+
failed?: boolean;
|
|
166
|
+
reason?: string;
|
|
167
|
+
}
|
|
168
|
+
export interface DendriteProtocolInvokeOptions {
|
|
169
|
+
service?: string;
|
|
170
|
+
rpc?: string;
|
|
171
|
+
path?: string;
|
|
172
|
+
requestBytes?: Uint8Array;
|
|
173
|
+
requestChunks?: Uint8Array[];
|
|
174
|
+
metadata?: Record<string, string>;
|
|
175
|
+
timeoutMs?: number;
|
|
176
|
+
maxChunks?: number;
|
|
177
|
+
maxRequestChunks?: number;
|
|
178
|
+
maxResponseChunks?: number;
|
|
179
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// EasyNet Axon for AgentNet
|
|
2
|
+
// =========================
|
|
3
|
+
//
|
|
4
|
+
// File: sdk/node/src/dendrite_bridge/types.ts
|
|
5
|
+
// Description: Exported interface declarations for the DendriteBridge module; extracted from dendrite_bridge.ts to allow type-only imports without circular dependencies.
|
|
6
|
+
//
|
|
7
|
+
// Protocol Responsibility:
|
|
8
|
+
// - Defines the option/contract interfaces used by DendriteBridge methods and consumed by capability_request.ts.
|
|
9
|
+
//
|
|
10
|
+
// Implementation Approach:
|
|
11
|
+
// - Pure type declarations with no runtime code.
|
|
12
|
+
//
|
|
13
|
+
// Usage Contract:
|
|
14
|
+
// - Import types from this module when you need DendriteBridge option shapes without pulling in FFI or class code.
|
|
15
|
+
//
|
|
16
|
+
// Architectural Position:
|
|
17
|
+
// - Part of the Node SDK dendrite_bridge submodule layer.
|
|
18
|
+
// - Should not embed runtime logic or side effects.
|
|
19
|
+
//
|
|
20
|
+
// Author: Silan.Hu
|
|
21
|
+
// Email: silan.hu@u.nus.edu
|
|
22
|
+
// Copyright (c) 2026-2027 easynet. All rights reserved.
|
|
23
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./dendrite_bridge/index.js";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// EasyNet Axon for AgentNet
|
|
2
|
+
// =========================
|
|
3
|
+
//
|
|
4
|
+
// File: sdk/node/src/dendrite_bridge.ts
|
|
5
|
+
// Description: Source file for Node SDK facade and Dendrite integration; keeps behavior explicit and interoperable across language/runtime boundaries, including tenant/principal invocation context bridging.
|
|
6
|
+
//
|
|
7
|
+
// Protocol Responsibility:
|
|
8
|
+
// - Implements Node SDK facade and Dendrite integration contracts required by current Axon service and SDK surfaces.
|
|
9
|
+
// - Preserves stable request/response semantics and error mapping for dendrite_bridge.ts call paths.
|
|
10
|
+
//
|
|
11
|
+
// Implementation Approach:
|
|
12
|
+
// - Uses small typed helpers and explicit control flow to avoid hidden side effects.
|
|
13
|
+
// - Keeps protocol translation and transport details close to this module boundary.
|
|
14
|
+
//
|
|
15
|
+
// Usage Contract:
|
|
16
|
+
// - Callers should provide valid tenant/resource/runtime context before invoking exported APIs; principal context is optional and, when provided, is mapped to EasyNet subject context.
|
|
17
|
+
// - Errors should be treated as typed protocol/runtime outcomes rather than silently ignored.
|
|
18
|
+
//
|
|
19
|
+
// Architectural Position:
|
|
20
|
+
// - Part of the Node SDK facade and Dendrite integration layer.
|
|
21
|
+
// - Should not embed unrelated orchestration logic outside this file's responsibility.
|
|
22
|
+
//
|
|
23
|
+
// Author: Silan.Hu
|
|
24
|
+
// Email: silan.hu@u.nus.edu
|
|
25
|
+
// Copyright (c) 2026-2027 easynet. All rights reserved.
|
|
26
|
+
// Barrel re-export — implementation lives in dendrite_bridge/ submodules.
|
|
27
|
+
export * from "./dendrite_bridge/index.js";
|
package/src/errors.d.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/** Base error for all Axon SDK errors. */
|
|
2
|
+
export declare class AxonError extends Error {
|
|
3
|
+
/** Canonical error code for cross-SDK mapping. */
|
|
4
|
+
readonly code: string;
|
|
5
|
+
constructor(message: string);
|
|
6
|
+
}
|
|
7
|
+
/** Input validation or configuration error (before any network call). */
|
|
8
|
+
export declare class AxonConfigError extends AxonError {
|
|
9
|
+
readonly code = "VALIDATION";
|
|
10
|
+
constructor(message: string);
|
|
11
|
+
}
|
|
12
|
+
/** Native bridge initialization or connection to the Axon runtime failed. */
|
|
13
|
+
export declare class AxonBridgeError extends AxonError {
|
|
14
|
+
readonly code = "BRIDGE";
|
|
15
|
+
constructor(message: string);
|
|
16
|
+
}
|
|
17
|
+
/** The requested ability is not installed on the target node. */
|
|
18
|
+
export declare class AxonNotInstalledError extends AxonError {
|
|
19
|
+
readonly code = "NOT_INSTALLED";
|
|
20
|
+
constructor(message: string);
|
|
21
|
+
}
|
|
22
|
+
/** The ability is installed but not yet activated. */
|
|
23
|
+
export declare class AxonNotActivatedError extends AxonError {
|
|
24
|
+
readonly code = "NOT_ACTIVATED";
|
|
25
|
+
constructor(message: string);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Remote invocation or deploy operation failed.
|
|
29
|
+
*
|
|
30
|
+
* When thrown from a deploy pipeline the optional `trace` field carries the
|
|
31
|
+
* {@link DeployTrace} collected before the failure, so callers can inspect
|
|
32
|
+
* per-phase timing even on error:
|
|
33
|
+
*
|
|
34
|
+
* ```ts
|
|
35
|
+
* try { await deployToNode(bridge, tenant, nodeId, desc, sig); }
|
|
36
|
+
* catch (e) { if (e instanceof AxonInvocationError && e.trace) console.log(e.trace); }
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare class AxonInvocationError extends AxonError {
|
|
40
|
+
readonly code = "INVOCATION";
|
|
41
|
+
readonly remotePayload?: Record<string, unknown>;
|
|
42
|
+
/** Deploy trace collected before the failure (if available). */
|
|
43
|
+
readonly trace?: unknown;
|
|
44
|
+
constructor(message: string, remotePayload?: Record<string, unknown>, trace?: unknown);
|
|
45
|
+
}
|
|
46
|
+
/** Streaming transport was interrupted before completion. */
|
|
47
|
+
export declare class AxonStreamError extends AxonError {
|
|
48
|
+
readonly code = "STREAM";
|
|
49
|
+
constructor(message: string);
|
|
50
|
+
}
|
|
51
|
+
/** A governance policy rejected the operation. */
|
|
52
|
+
export declare class AxonPolicyDeniedError extends AxonError {
|
|
53
|
+
readonly code = "POLICY_DENIED";
|
|
54
|
+
constructor(message: string);
|
|
55
|
+
}
|
|
56
|
+
/** MCP transport or protocol error. */
|
|
57
|
+
export declare class AxonMcpError extends AxonError {
|
|
58
|
+
readonly code = "MCP";
|
|
59
|
+
constructor(message: string);
|
|
60
|
+
}
|
|
61
|
+
/** Operation completed with partial failures (e.g. `forgetAll`). */
|
|
62
|
+
export declare class AxonPartialSuccessError extends AxonError {
|
|
63
|
+
readonly code = "PARTIAL_SUCCESS";
|
|
64
|
+
readonly succeeded: number;
|
|
65
|
+
readonly failed: number;
|
|
66
|
+
readonly details?: unknown;
|
|
67
|
+
constructor(message: string, succeeded: number, failed: number, details?: unknown);
|
|
68
|
+
}
|
|
69
|
+
/** JSON serialization or deserialization error. */
|
|
70
|
+
export declare class AxonJsonError extends AxonError {
|
|
71
|
+
readonly code = "JSON";
|
|
72
|
+
constructor(message: string);
|
|
73
|
+
}
|
|
74
|
+
/** Filesystem or general I/O error. */
|
|
75
|
+
export declare class AxonIoError extends AxonError {
|
|
76
|
+
readonly code = "IO";
|
|
77
|
+
constructor(message: string);
|
|
78
|
+
}
|
|
79
|
+
/** A required FFI symbol was not found in the native library. */
|
|
80
|
+
export declare class AxonSymbolNotFoundError extends AxonError {
|
|
81
|
+
readonly code = "SYMBOL_NOT_FOUND";
|
|
82
|
+
constructor(message: string);
|
|
83
|
+
}
|