tauri-plugin-modular-agent-api 0.12.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/README.md ADDED
@@ -0,0 +1 @@
1
+ # Tauri Plugin for Modular Agent Kit
@@ -0,0 +1,172 @@
1
+ 'use strict';
2
+
3
+ var core = require('@tauri-apps/api/core');
4
+
5
+ // preset
6
+ async function newPreset() {
7
+ return await core.invoke("plugin:modular-agent|new_preset", {});
8
+ }
9
+ // export async function renamePreset(
10
+ // id: string,
11
+ // name: string
12
+ // ): Promise<string> {
13
+ // return await invoke<any>("plugin:modular-agent|rename_preset", {
14
+ // id,
15
+ // name,
16
+ // });
17
+ // }
18
+ // export async function uniquePresetName(name: string): Promise<string> {
19
+ // return await invoke<any>("plugin:modular-agent|unique_preset_name", { name });
20
+ // }
21
+ async function addPreset(spec) {
22
+ return await core.invoke("plugin:modular-agent|add_preset", { spec });
23
+ }
24
+ async function removePreset(id) {
25
+ await core.invoke("plugin:modular-agent|remove_preset", { id });
26
+ }
27
+ async function startPreset(id) {
28
+ await core.invoke("plugin:modular-agent|start_preset", { id });
29
+ }
30
+ async function stopPreset(id) {
31
+ await core.invoke("plugin:modular-agent|stop_preset", { id });
32
+ }
33
+ async function openPresetFromFile(path) {
34
+ return await core.invoke("plugin:modular-agent|open_preset_from_file", { path });
35
+ }
36
+ async function savePreset(id) {
37
+ await core.invoke("plugin:modular-agent|save_preset", { id });
38
+ }
39
+ async function savePresetAs(id, path) {
40
+ await core.invoke("plugin:modular-agent|save_preset_as", { id, path });
41
+ }
42
+ async function getPresetFileName(id) {
43
+ return await core.invoke("plugin:modular-agent|get_preset_file_name", { id });
44
+ }
45
+ async function setPresetFileName(id, fileName) {
46
+ await core.invoke("plugin:modular-agent|set_preset_file_name", { id, fileName });
47
+ }
48
+ async function getPresetSpec(id) {
49
+ return await core.invoke("plugin:modular-agent|get_preset_spec", { id });
50
+ }
51
+ async function updatePresetSpec(id, value) {
52
+ await core.invoke("plugin:modular-agent|update_preset_spec", { id, value });
53
+ }
54
+ async function getPresetInfo(id) {
55
+ return await core.invoke("plugin:modular-agent|get_preset_info", { id });
56
+ }
57
+ async function getPresetInfos() {
58
+ return await core.invoke("plugin:modular-agent|get_preset_infos", {});
59
+ }
60
+ // agent
61
+ async function getAgentDefinition() {
62
+ return await core.invoke("plugin:modular-agent|get_agent_definition", {});
63
+ }
64
+ async function getAgentDefinitions() {
65
+ return await core.invoke("plugin:modular-agent|get_agent_definitions", {});
66
+ }
67
+ // agent spec
68
+ async function getAgentSpec(agentId) {
69
+ return await core.invoke("plugin:modular-agent|get_agent_spec", { agentId });
70
+ }
71
+ async function updateAgentSpec(agentId, value) {
72
+ await core.invoke("plugin:modular-agent|update_agent_spec", {
73
+ agentId,
74
+ value,
75
+ });
76
+ }
77
+ // agents
78
+ async function newAgentSpec(defName) {
79
+ return await core.invoke("plugin:modular-agent|new_agent_spec", { defName });
80
+ }
81
+ async function addAgent(presetId, spec) {
82
+ return await core.invoke("plugin:modular-agent|add_agent", {
83
+ presetId,
84
+ spec,
85
+ });
86
+ }
87
+ async function removeAgent(presetId, agentId) {
88
+ await core.invoke("plugin:modular-agent|remove_agent", {
89
+ presetId,
90
+ agentId,
91
+ });
92
+ }
93
+ // connection
94
+ async function addConnection(presetId, connection) {
95
+ await core.invoke("plugin:modular-agent|add_connection", {
96
+ presetId,
97
+ connection,
98
+ });
99
+ }
100
+ async function removeConnection(presetId, connection) {
101
+ await core.invoke("plugin:modular-agent|remove_connection", {
102
+ presetId,
103
+ connection,
104
+ });
105
+ }
106
+ async function addAgentsAndConnections(presetId, agents, connections) {
107
+ return await core.invoke("plugin:modular-agent|add_agents_and_connections", {
108
+ presetId,
109
+ agents,
110
+ connections,
111
+ });
112
+ }
113
+ // agent
114
+ async function startAgent(agentId) {
115
+ await core.invoke("plugin:modular-agent|start_agent", { agentId });
116
+ }
117
+ async function stopAgent(agentId) {
118
+ await core.invoke("plugin:modular-agent|stop_agent", { agentId });
119
+ }
120
+ // board
121
+ async function writeBoard(board, message) {
122
+ await core.invoke("plugin:modular-agent|write_board", { board, message });
123
+ }
124
+ // configs
125
+ async function setAgentConfigs(agentId, configs) {
126
+ await core.invoke("plugin:modular-agent|set_agent_configs", { agentId, configs });
127
+ }
128
+ async function getGlobalConfigs(defName) {
129
+ return await core.invoke("plugin:modular-agent|get_global_configs", { defName });
130
+ }
131
+ async function getGlobalConfigsMap() {
132
+ return await core.invoke("plugin:modular-agent|get_global_configs_map", {});
133
+ }
134
+ async function setGlobalConfigs(defName, configs) {
135
+ await core.invoke("plugin:modular-agent|set_global_configs", { defName, configs });
136
+ }
137
+ async function setGlobalConfigsMap(configs) {
138
+ await core.invoke("plugin:modular-agent|set_global_configs_map", { configs });
139
+ }
140
+
141
+ exports.addAgent = addAgent;
142
+ exports.addAgentsAndConnections = addAgentsAndConnections;
143
+ exports.addConnection = addConnection;
144
+ exports.addPreset = addPreset;
145
+ exports.getAgentDefinition = getAgentDefinition;
146
+ exports.getAgentDefinitions = getAgentDefinitions;
147
+ exports.getAgentSpec = getAgentSpec;
148
+ exports.getGlobalConfigs = getGlobalConfigs;
149
+ exports.getGlobalConfigsMap = getGlobalConfigsMap;
150
+ exports.getPresetFileName = getPresetFileName;
151
+ exports.getPresetInfo = getPresetInfo;
152
+ exports.getPresetInfos = getPresetInfos;
153
+ exports.getPresetSpec = getPresetSpec;
154
+ exports.newAgentSpec = newAgentSpec;
155
+ exports.newPreset = newPreset;
156
+ exports.openPresetFromFile = openPresetFromFile;
157
+ exports.removeAgent = removeAgent;
158
+ exports.removeConnection = removeConnection;
159
+ exports.removePreset = removePreset;
160
+ exports.savePreset = savePreset;
161
+ exports.savePresetAs = savePresetAs;
162
+ exports.setAgentConfigs = setAgentConfigs;
163
+ exports.setGlobalConfigs = setGlobalConfigs;
164
+ exports.setGlobalConfigsMap = setGlobalConfigsMap;
165
+ exports.setPresetFileName = setPresetFileName;
166
+ exports.startAgent = startAgent;
167
+ exports.startPreset = startPreset;
168
+ exports.stopAgent = stopAgent;
169
+ exports.stopPreset = stopPreset;
170
+ exports.updateAgentSpec = updateAgentSpec;
171
+ exports.updatePresetSpec = updatePresetSpec;
172
+ exports.writeBoard = writeBoard;
@@ -0,0 +1,95 @@
1
+ export type PresetInfo = {
2
+ id: string;
3
+ name: string;
4
+ running: boolean;
5
+ };
6
+ export type AgentDefinitions = Record<string, AgentDefinition>;
7
+ export type AgentDefinition = {
8
+ kind: string;
9
+ name: string;
10
+ title?: string | null;
11
+ hide_title?: boolean | null;
12
+ description?: string | null;
13
+ category?: string | null;
14
+ inputs?: string[] | null;
15
+ outputs?: string[] | null;
16
+ configs?: AgentConfigSpecs | null;
17
+ global_configs?: AgentGlobalConfigs | null;
18
+ native_thread?: boolean | null;
19
+ };
20
+ export type AgentConfigSpecs = Record<string, AgentConfigSpec>;
21
+ export type AgentGlobalConfigs = Record<string, AgentConfigSpec>;
22
+ export type AgentConfigSpec = {
23
+ value: any;
24
+ type: string | null;
25
+ title?: string | null;
26
+ hide_title?: boolean | null;
27
+ description?: string | null;
28
+ hidden?: boolean | null;
29
+ readonly?: boolean | null;
30
+ };
31
+ export type PresetSpec = {
32
+ agents: AgentSpec[];
33
+ connections: ConnectionSpec[];
34
+ viewport: Viewport | null;
35
+ };
36
+ export type AgentConfigsMap = Record<string, AgentConfigs>;
37
+ export type AgentGlobalConfigsMap = Record<string, AgentConfigs>;
38
+ export type AgentConfigs = Record<string, any>;
39
+ export type AgentSpecExtensions = Record<string, any>;
40
+ export type AgentSpec = {
41
+ id?: string | null;
42
+ def_name: string;
43
+ inputs?: string[] | null;
44
+ outputs?: string[] | null;
45
+ configs?: AgentConfigs | null;
46
+ config_specs?: AgentConfigSpecs | null;
47
+ disabled?: boolean | null;
48
+ } & AgentSpecExtensions;
49
+ export type ConnectionSpec = {
50
+ source: string;
51
+ source_handle: string | null;
52
+ target: string;
53
+ target_handle: string | null;
54
+ };
55
+ export type Viewport = {
56
+ x: number;
57
+ y: number;
58
+ zoom: number;
59
+ };
60
+ export type BoardMessage = {
61
+ key: string;
62
+ value: any;
63
+ };
64
+ export declare function newPreset(): Promise<[string, string]>;
65
+ export declare function addPreset(spec: PresetSpec): Promise<string>;
66
+ export declare function removePreset(id: string): Promise<void>;
67
+ export declare function startPreset(id: string): Promise<void>;
68
+ export declare function stopPreset(id: string): Promise<void>;
69
+ export declare function openPresetFromFile(path: string): Promise<string>;
70
+ export declare function savePreset(id: string): Promise<void>;
71
+ export declare function savePresetAs(id: string, path: string): Promise<void>;
72
+ export declare function getPresetFileName(id: string): Promise<string | null>;
73
+ export declare function setPresetFileName(id: string, fileName: string): Promise<void>;
74
+ export declare function getPresetSpec(id: string): Promise<PresetSpec | null>;
75
+ export declare function updatePresetSpec(id: string, value: Partial<PresetSpec>): Promise<void>;
76
+ export declare function getPresetInfo(id: string): Promise<PresetInfo | null>;
77
+ export declare function getPresetInfos(): Promise<PresetInfo[]>;
78
+ export declare function getAgentDefinition(): Promise<AgentDefinition | null>;
79
+ export declare function getAgentDefinitions(): Promise<AgentDefinitions>;
80
+ export declare function getAgentSpec(agentId: string): Promise<AgentSpec | null>;
81
+ export declare function updateAgentSpec(agentId: string, value: Partial<AgentSpec>): Promise<void>;
82
+ export declare function newAgentSpec(defName: string): Promise<AgentSpec>;
83
+ export declare function addAgent(presetId: string, spec: AgentSpec): Promise<string>;
84
+ export declare function removeAgent(presetId: string, agentId: string): Promise<void>;
85
+ export declare function addConnection(presetId: string, connection: ConnectionSpec): Promise<void>;
86
+ export declare function removeConnection(presetId: string, connection: ConnectionSpec): Promise<void>;
87
+ export declare function addAgentsAndConnections(presetId: string, agents: AgentSpec[], connections: ConnectionSpec[]): Promise<[AgentSpec[], ConnectionSpec[]]>;
88
+ export declare function startAgent(agentId: string): Promise<void>;
89
+ export declare function stopAgent(agentId: string): Promise<void>;
90
+ export declare function writeBoard(board: string, message: string): Promise<void>;
91
+ export declare function setAgentConfigs(agentId: string, configs: AgentConfigs): Promise<void>;
92
+ export declare function getGlobalConfigs(defName: string): Promise<AgentConfigs | null>;
93
+ export declare function getGlobalConfigsMap(): Promise<AgentConfigsMap>;
94
+ export declare function setGlobalConfigs(defName: string, configs: AgentConfigs): Promise<void>;
95
+ export declare function setGlobalConfigsMap(configs: AgentConfigsMap): Promise<void>;
@@ -0,0 +1,139 @@
1
+ import { invoke } from '@tauri-apps/api/core';
2
+
3
+ // preset
4
+ async function newPreset() {
5
+ return await invoke("plugin:modular-agent|new_preset", {});
6
+ }
7
+ // export async function renamePreset(
8
+ // id: string,
9
+ // name: string
10
+ // ): Promise<string> {
11
+ // return await invoke<any>("plugin:modular-agent|rename_preset", {
12
+ // id,
13
+ // name,
14
+ // });
15
+ // }
16
+ // export async function uniquePresetName(name: string): Promise<string> {
17
+ // return await invoke<any>("plugin:modular-agent|unique_preset_name", { name });
18
+ // }
19
+ async function addPreset(spec) {
20
+ return await invoke("plugin:modular-agent|add_preset", { spec });
21
+ }
22
+ async function removePreset(id) {
23
+ await invoke("plugin:modular-agent|remove_preset", { id });
24
+ }
25
+ async function startPreset(id) {
26
+ await invoke("plugin:modular-agent|start_preset", { id });
27
+ }
28
+ async function stopPreset(id) {
29
+ await invoke("plugin:modular-agent|stop_preset", { id });
30
+ }
31
+ async function openPresetFromFile(path) {
32
+ return await invoke("plugin:modular-agent|open_preset_from_file", { path });
33
+ }
34
+ async function savePreset(id) {
35
+ await invoke("plugin:modular-agent|save_preset", { id });
36
+ }
37
+ async function savePresetAs(id, path) {
38
+ await invoke("plugin:modular-agent|save_preset_as", { id, path });
39
+ }
40
+ async function getPresetFileName(id) {
41
+ return await invoke("plugin:modular-agent|get_preset_file_name", { id });
42
+ }
43
+ async function setPresetFileName(id, fileName) {
44
+ await invoke("plugin:modular-agent|set_preset_file_name", { id, fileName });
45
+ }
46
+ async function getPresetSpec(id) {
47
+ return await invoke("plugin:modular-agent|get_preset_spec", { id });
48
+ }
49
+ async function updatePresetSpec(id, value) {
50
+ await invoke("plugin:modular-agent|update_preset_spec", { id, value });
51
+ }
52
+ async function getPresetInfo(id) {
53
+ return await invoke("plugin:modular-agent|get_preset_info", { id });
54
+ }
55
+ async function getPresetInfos() {
56
+ return await invoke("plugin:modular-agent|get_preset_infos", {});
57
+ }
58
+ // agent
59
+ async function getAgentDefinition() {
60
+ return await invoke("plugin:modular-agent|get_agent_definition", {});
61
+ }
62
+ async function getAgentDefinitions() {
63
+ return await invoke("plugin:modular-agent|get_agent_definitions", {});
64
+ }
65
+ // agent spec
66
+ async function getAgentSpec(agentId) {
67
+ return await invoke("plugin:modular-agent|get_agent_spec", { agentId });
68
+ }
69
+ async function updateAgentSpec(agentId, value) {
70
+ await invoke("plugin:modular-agent|update_agent_spec", {
71
+ agentId,
72
+ value,
73
+ });
74
+ }
75
+ // agents
76
+ async function newAgentSpec(defName) {
77
+ return await invoke("plugin:modular-agent|new_agent_spec", { defName });
78
+ }
79
+ async function addAgent(presetId, spec) {
80
+ return await invoke("plugin:modular-agent|add_agent", {
81
+ presetId,
82
+ spec,
83
+ });
84
+ }
85
+ async function removeAgent(presetId, agentId) {
86
+ await invoke("plugin:modular-agent|remove_agent", {
87
+ presetId,
88
+ agentId,
89
+ });
90
+ }
91
+ // connection
92
+ async function addConnection(presetId, connection) {
93
+ await invoke("plugin:modular-agent|add_connection", {
94
+ presetId,
95
+ connection,
96
+ });
97
+ }
98
+ async function removeConnection(presetId, connection) {
99
+ await invoke("plugin:modular-agent|remove_connection", {
100
+ presetId,
101
+ connection,
102
+ });
103
+ }
104
+ async function addAgentsAndConnections(presetId, agents, connections) {
105
+ return await invoke("plugin:modular-agent|add_agents_and_connections", {
106
+ presetId,
107
+ agents,
108
+ connections,
109
+ });
110
+ }
111
+ // agent
112
+ async function startAgent(agentId) {
113
+ await invoke("plugin:modular-agent|start_agent", { agentId });
114
+ }
115
+ async function stopAgent(agentId) {
116
+ await invoke("plugin:modular-agent|stop_agent", { agentId });
117
+ }
118
+ // board
119
+ async function writeBoard(board, message) {
120
+ await invoke("plugin:modular-agent|write_board", { board, message });
121
+ }
122
+ // configs
123
+ async function setAgentConfigs(agentId, configs) {
124
+ await invoke("plugin:modular-agent|set_agent_configs", { agentId, configs });
125
+ }
126
+ async function getGlobalConfigs(defName) {
127
+ return await invoke("plugin:modular-agent|get_global_configs", { defName });
128
+ }
129
+ async function getGlobalConfigsMap() {
130
+ return await invoke("plugin:modular-agent|get_global_configs_map", {});
131
+ }
132
+ async function setGlobalConfigs(defName, configs) {
133
+ await invoke("plugin:modular-agent|set_global_configs", { defName, configs });
134
+ }
135
+ async function setGlobalConfigsMap(configs) {
136
+ await invoke("plugin:modular-agent|set_global_configs_map", { configs });
137
+ }
138
+
139
+ export { addAgent, addAgentsAndConnections, addConnection, addPreset, getAgentDefinition, getAgentDefinitions, getAgentSpec, getGlobalConfigs, getGlobalConfigsMap, getPresetFileName, getPresetInfo, getPresetInfos, getPresetSpec, newAgentSpec, newPreset, openPresetFromFile, removeAgent, removeConnection, removePreset, savePreset, savePresetAs, setAgentConfigs, setGlobalConfigs, setGlobalConfigsMap, setPresetFileName, startAgent, startPreset, stopAgent, stopPreset, updateAgentSpec, updatePresetSpec, writeBoard };
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "tauri-plugin-modular-agent-api",
3
+ "version": "0.12.0",
4
+ "license": "MIT OR Apache-2.0",
5
+ "author": "Akira Ishino",
6
+ "description": "Tauri plugin for Modular Agent Kit",
7
+ "type": "module",
8
+ "types": "./dist-js/index.d.ts",
9
+ "main": "./dist-js/index.cjs",
10
+ "module": "./dist-js/index.js",
11
+ "exports": {
12
+ "types": "./dist-js/index.d.ts",
13
+ "import": "./dist-js/index.js",
14
+ "require": "./dist-js/index.cjs"
15
+ },
16
+ "files": [
17
+ "dist-js",
18
+ "README.md"
19
+ ],
20
+ "scripts": {
21
+ "build": "rollup -c",
22
+ "prepublishOnly": "pnpm build",
23
+ "pretest": "pnpm build"
24
+ },
25
+ "dependencies": {
26
+ "@tauri-apps/api": "^2.0.0"
27
+ },
28
+ "devDependencies": {
29
+ "@rollup/plugin-typescript": "^12.0.0",
30
+ "rollup": "^4.9.6",
31
+ "typescript": "^5.3.3",
32
+ "tslib": "^2.6.2"
33
+ }
34
+ }