tauri-plugin-askit-api 0.2.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 +1 -0
- package/dist-js/index.cjs +116 -0
- package/dist-js/index.d.ts +113 -0
- package/dist-js/index.js +89 -0
- package/package.json +34 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Tauri Plugin askit
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@tauri-apps/api/core');
|
|
4
|
+
|
|
5
|
+
// agent definition
|
|
6
|
+
async function getAgentDefinition() {
|
|
7
|
+
return await core.invoke('plugin:askit|get_agent_definition', {});
|
|
8
|
+
}
|
|
9
|
+
async function getAgentDefinitions() {
|
|
10
|
+
return await core.invoke('plugin:askit|get_agent_definitions', {});
|
|
11
|
+
}
|
|
12
|
+
// flow
|
|
13
|
+
async function getAgentFlows() {
|
|
14
|
+
return await core.invoke('plugin:askit|get_agent_flows', {});
|
|
15
|
+
}
|
|
16
|
+
async function newAgentFlow(flowName) {
|
|
17
|
+
return await core.invoke('plugin:askit|new_agent_flow', { flowName });
|
|
18
|
+
}
|
|
19
|
+
async function renameAgentFlow(oldName, newName) {
|
|
20
|
+
return await core.invoke('plugin:askit|rename_agent_flow', { oldName, newName });
|
|
21
|
+
}
|
|
22
|
+
async function uniqueFlowName(name) {
|
|
23
|
+
return await core.invoke('plugin:askit|unique_flow_name', { name });
|
|
24
|
+
}
|
|
25
|
+
async function addAgentFlow(agentFlow) {
|
|
26
|
+
await core.invoke('plugin:askit|add_agent_flow', { agentFlow });
|
|
27
|
+
}
|
|
28
|
+
async function removeAgentFlow(flowName) {
|
|
29
|
+
await core.invoke('plugin:askit|remove_agent_flow', { flowName });
|
|
30
|
+
}
|
|
31
|
+
async function insertAgentFlow(agentFlow) {
|
|
32
|
+
await core.invoke('plugin:askit|insert_agent_flow', { agentFlow });
|
|
33
|
+
}
|
|
34
|
+
async function copySubFlow(nodes, edges) {
|
|
35
|
+
return await core.invoke('plugin:askit|copy_sub_flow', { nodes, edges });
|
|
36
|
+
}
|
|
37
|
+
async function startAgentFlow(flowName) {
|
|
38
|
+
await core.invoke('plugin:askit|start_agent_flow', { flowName });
|
|
39
|
+
}
|
|
40
|
+
async function stopAgentFlow(flowName) {
|
|
41
|
+
await core.invoke('plugin:askit|stop_agent_flow', { flowName });
|
|
42
|
+
}
|
|
43
|
+
// nodes
|
|
44
|
+
async function newAgentFlowNode(defName) {
|
|
45
|
+
await core.invoke('plugin:askit|new_agent_flow_node', { defName });
|
|
46
|
+
}
|
|
47
|
+
async function addAgentFlowNode(flowName, node) {
|
|
48
|
+
await core.invoke('plugin:askit|add_agent_flow_node', { flowName, node });
|
|
49
|
+
}
|
|
50
|
+
async function removeAgentFlowNode(flowName, nodeId) {
|
|
51
|
+
await core.invoke('plugin:askit|remove_agent_flow_node', { flowName, nodeId });
|
|
52
|
+
}
|
|
53
|
+
// edge
|
|
54
|
+
async function addAgentFlowEdge(flowName, edge) {
|
|
55
|
+
await core.invoke('plugin:askit|add_agent_flow_edge', { flowName, edge });
|
|
56
|
+
}
|
|
57
|
+
async function removeAgentFlowEdge(flowName, edgeId) {
|
|
58
|
+
await core.invoke('plugin:askit|remove_agent_flow_edge', { flowName, edgeId });
|
|
59
|
+
}
|
|
60
|
+
// agent
|
|
61
|
+
async function startAgent(agentId) {
|
|
62
|
+
await core.invoke('plugin:askit|start_agent', { agentId });
|
|
63
|
+
}
|
|
64
|
+
async function stopAgent(agentId) {
|
|
65
|
+
await core.invoke('plugin:askit|stop_agent', { agentId });
|
|
66
|
+
}
|
|
67
|
+
// board
|
|
68
|
+
async function writeBoard(board, message) {
|
|
69
|
+
await core.invoke('plugin:askit|write_board', { board, message });
|
|
70
|
+
}
|
|
71
|
+
// config
|
|
72
|
+
async function setAgentConfig(agentId, config) {
|
|
73
|
+
await core.invoke('plugin:askit|set_agent_config', { agentId, config });
|
|
74
|
+
}
|
|
75
|
+
async function getGlobalConfig(defName) {
|
|
76
|
+
return await core.invoke('plugin:askit|get_global_config', { defName });
|
|
77
|
+
}
|
|
78
|
+
async function getGlobalConfigs() {
|
|
79
|
+
return await core.invoke('plugin:askit|get_global_configs', {});
|
|
80
|
+
}
|
|
81
|
+
async function setGlobalConfig(defName, config) {
|
|
82
|
+
await core.invoke('plugin:askit|set_global_config', { defName, config });
|
|
83
|
+
}
|
|
84
|
+
async function setGlobalConfigs(configs) {
|
|
85
|
+
await core.invoke('plugin:askit|set_global_configs', { configs });
|
|
86
|
+
}
|
|
87
|
+
async function getAgentDefaultConfig(defName) {
|
|
88
|
+
return await core.invoke('plugin:askit|get_agent_default_config', { defName });
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
exports.addAgentFlow = addAgentFlow;
|
|
92
|
+
exports.addAgentFlowEdge = addAgentFlowEdge;
|
|
93
|
+
exports.addAgentFlowNode = addAgentFlowNode;
|
|
94
|
+
exports.copySubFlow = copySubFlow;
|
|
95
|
+
exports.getAgentDefaultConfig = getAgentDefaultConfig;
|
|
96
|
+
exports.getAgentDefinition = getAgentDefinition;
|
|
97
|
+
exports.getAgentDefinitions = getAgentDefinitions;
|
|
98
|
+
exports.getAgentFlows = getAgentFlows;
|
|
99
|
+
exports.getGlobalConfig = getGlobalConfig;
|
|
100
|
+
exports.getGlobalConfigs = getGlobalConfigs;
|
|
101
|
+
exports.insertAgentFlow = insertAgentFlow;
|
|
102
|
+
exports.newAgentFlow = newAgentFlow;
|
|
103
|
+
exports.newAgentFlowNode = newAgentFlowNode;
|
|
104
|
+
exports.removeAgentFlow = removeAgentFlow;
|
|
105
|
+
exports.removeAgentFlowEdge = removeAgentFlowEdge;
|
|
106
|
+
exports.removeAgentFlowNode = removeAgentFlowNode;
|
|
107
|
+
exports.renameAgentFlow = renameAgentFlow;
|
|
108
|
+
exports.setAgentConfig = setAgentConfig;
|
|
109
|
+
exports.setGlobalConfig = setGlobalConfig;
|
|
110
|
+
exports.setGlobalConfigs = setGlobalConfigs;
|
|
111
|
+
exports.startAgent = startAgent;
|
|
112
|
+
exports.startAgentFlow = startAgentFlow;
|
|
113
|
+
exports.stopAgent = stopAgent;
|
|
114
|
+
exports.stopAgentFlow = stopAgentFlow;
|
|
115
|
+
exports.uniqueFlowName = uniqueFlowName;
|
|
116
|
+
exports.writeBoard = writeBoard;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
export type AgentDefinitions = Record<string, AgentDefinition>;
|
|
2
|
+
export type AgentGlobalConfigs = Record<string, AgentConfigs>;
|
|
3
|
+
export type AgentDefinition = {
|
|
4
|
+
kind: string;
|
|
5
|
+
name: string;
|
|
6
|
+
title: string | null;
|
|
7
|
+
description: string | null;
|
|
8
|
+
category: string | null;
|
|
9
|
+
path: string;
|
|
10
|
+
inputs: string[] | null;
|
|
11
|
+
outputs: string[] | null;
|
|
12
|
+
default_config: AgentDefaultConfig | null;
|
|
13
|
+
global_config: AgentGlobalConfig | null;
|
|
14
|
+
display_config: AgentDisplayConfig | null;
|
|
15
|
+
};
|
|
16
|
+
export type AgentDefaultConfig = [string, AgentConfigEntry][];
|
|
17
|
+
export type AgentGlobalConfig = [string, AgentConfigEntry][];
|
|
18
|
+
export type AgentConfigEntry = {
|
|
19
|
+
value: any;
|
|
20
|
+
type: AgentConfigValueType | null;
|
|
21
|
+
title?: string | null;
|
|
22
|
+
description?: string | null;
|
|
23
|
+
hidden?: boolean | null;
|
|
24
|
+
};
|
|
25
|
+
export type AgentConfigValueType = "unit" | "boolean" | "integer" | "number" | "string" | "password" | "text" | "object";
|
|
26
|
+
export type AgentDisplayConfig = [string, AgentDisplayConfigEntry][];
|
|
27
|
+
export type AgentDisplayConfigEntry = {
|
|
28
|
+
type: AgentDisplayConfigType | null;
|
|
29
|
+
title?: string | null;
|
|
30
|
+
description?: string | null;
|
|
31
|
+
hideTitle?: boolean | null;
|
|
32
|
+
};
|
|
33
|
+
export type AgentDisplayConfigType = "*" | "boolean" | "integer" | "number" | "string" | "text" | "object" | "messages";
|
|
34
|
+
export type AgentFlows = Record<string, AgentFlow>;
|
|
35
|
+
export type AgentFlow = {
|
|
36
|
+
nodes: AgentFlowNode[];
|
|
37
|
+
edges: AgentFlowEdge[];
|
|
38
|
+
name: string;
|
|
39
|
+
viewport: Viewport | null;
|
|
40
|
+
};
|
|
41
|
+
export type AgentConfigs = Record<string, AgentConfig>;
|
|
42
|
+
export type AgentConfig = Record<string, any>;
|
|
43
|
+
export type AgentFlowNode = {
|
|
44
|
+
id: string;
|
|
45
|
+
def_name: string;
|
|
46
|
+
enabled: boolean;
|
|
47
|
+
config: AgentConfig | null;
|
|
48
|
+
title: string | null;
|
|
49
|
+
x: number;
|
|
50
|
+
y: number;
|
|
51
|
+
width?: number;
|
|
52
|
+
height?: number;
|
|
53
|
+
};
|
|
54
|
+
export type AgentFlowEdge = {
|
|
55
|
+
id: string;
|
|
56
|
+
source: string;
|
|
57
|
+
source_handle: string | null;
|
|
58
|
+
target: string;
|
|
59
|
+
target_handle: string | null;
|
|
60
|
+
};
|
|
61
|
+
export type Viewport = {
|
|
62
|
+
x: number;
|
|
63
|
+
y: number;
|
|
64
|
+
zoom: number;
|
|
65
|
+
};
|
|
66
|
+
export type CoreSettings = {
|
|
67
|
+
autostart: boolean;
|
|
68
|
+
shortcut_keys: Record<string, string>;
|
|
69
|
+
};
|
|
70
|
+
export type Settings = {
|
|
71
|
+
core: CoreSettings;
|
|
72
|
+
agents: Record<string, AgentDefinition>;
|
|
73
|
+
agent_flows: AgentFlow[];
|
|
74
|
+
};
|
|
75
|
+
export type DisplayMessage = {
|
|
76
|
+
agent_id: string;
|
|
77
|
+
key: string;
|
|
78
|
+
data: any;
|
|
79
|
+
};
|
|
80
|
+
export type ErrorMessage = {
|
|
81
|
+
agent_id: string;
|
|
82
|
+
message: string;
|
|
83
|
+
};
|
|
84
|
+
export type InputMessage = {
|
|
85
|
+
agent_id: string;
|
|
86
|
+
ch: string;
|
|
87
|
+
};
|
|
88
|
+
export declare function getAgentDefinition(): Promise<AgentDefinition | null>;
|
|
89
|
+
export declare function getAgentDefinitions(): Promise<AgentDefinitions>;
|
|
90
|
+
export declare function getAgentFlows(): Promise<AgentFlows>;
|
|
91
|
+
export declare function newAgentFlow(flowName: string): Promise<AgentFlow>;
|
|
92
|
+
export declare function renameAgentFlow(oldName: string, newName: string): Promise<string>;
|
|
93
|
+
export declare function uniqueFlowName(name: string): Promise<string>;
|
|
94
|
+
export declare function addAgentFlow(agentFlow: AgentFlow): Promise<void>;
|
|
95
|
+
export declare function removeAgentFlow(flowName: string): Promise<void>;
|
|
96
|
+
export declare function insertAgentFlow(agentFlow: AgentFlow): Promise<void>;
|
|
97
|
+
export declare function copySubFlow(nodes: AgentFlowNode[], edges: AgentFlowEdge[]): Promise<[AgentFlowNode[], AgentFlowEdge[]]>;
|
|
98
|
+
export declare function startAgentFlow(flowName: string): Promise<void>;
|
|
99
|
+
export declare function stopAgentFlow(flowName: string): Promise<void>;
|
|
100
|
+
export declare function newAgentFlowNode(defName: string): Promise<void>;
|
|
101
|
+
export declare function addAgentFlowNode(flowName: string, node: AgentFlowNode): Promise<void>;
|
|
102
|
+
export declare function removeAgentFlowNode(flowName: string, nodeId: string): Promise<void>;
|
|
103
|
+
export declare function addAgentFlowEdge(flowName: string, edge: AgentFlowEdge): Promise<void>;
|
|
104
|
+
export declare function removeAgentFlowEdge(flowName: string, edgeId: string): Promise<void>;
|
|
105
|
+
export declare function startAgent(agentId: string): Promise<void>;
|
|
106
|
+
export declare function stopAgent(agentId: string): Promise<void>;
|
|
107
|
+
export declare function writeBoard(board: string, message: string): Promise<void>;
|
|
108
|
+
export declare function setAgentConfig(agentId: string, config: Record<string, any>): Promise<void>;
|
|
109
|
+
export declare function getGlobalConfig(defName: string): Promise<AgentConfig | null>;
|
|
110
|
+
export declare function getGlobalConfigs(): Promise<AgentConfigs>;
|
|
111
|
+
export declare function setGlobalConfig(defName: string, config: AgentConfig): Promise<void>;
|
|
112
|
+
export declare function setGlobalConfigs(configs: AgentConfigs): Promise<void>;
|
|
113
|
+
export declare function getAgentDefaultConfig(defName: string): Promise<AgentDefaultConfig | null>;
|
package/dist-js/index.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { invoke } from '@tauri-apps/api/core';
|
|
2
|
+
|
|
3
|
+
// agent definition
|
|
4
|
+
async function getAgentDefinition() {
|
|
5
|
+
return await invoke('plugin:askit|get_agent_definition', {});
|
|
6
|
+
}
|
|
7
|
+
async function getAgentDefinitions() {
|
|
8
|
+
return await invoke('plugin:askit|get_agent_definitions', {});
|
|
9
|
+
}
|
|
10
|
+
// flow
|
|
11
|
+
async function getAgentFlows() {
|
|
12
|
+
return await invoke('plugin:askit|get_agent_flows', {});
|
|
13
|
+
}
|
|
14
|
+
async function newAgentFlow(flowName) {
|
|
15
|
+
return await invoke('plugin:askit|new_agent_flow', { flowName });
|
|
16
|
+
}
|
|
17
|
+
async function renameAgentFlow(oldName, newName) {
|
|
18
|
+
return await invoke('plugin:askit|rename_agent_flow', { oldName, newName });
|
|
19
|
+
}
|
|
20
|
+
async function uniqueFlowName(name) {
|
|
21
|
+
return await invoke('plugin:askit|unique_flow_name', { name });
|
|
22
|
+
}
|
|
23
|
+
async function addAgentFlow(agentFlow) {
|
|
24
|
+
await invoke('plugin:askit|add_agent_flow', { agentFlow });
|
|
25
|
+
}
|
|
26
|
+
async function removeAgentFlow(flowName) {
|
|
27
|
+
await invoke('plugin:askit|remove_agent_flow', { flowName });
|
|
28
|
+
}
|
|
29
|
+
async function insertAgentFlow(agentFlow) {
|
|
30
|
+
await invoke('plugin:askit|insert_agent_flow', { agentFlow });
|
|
31
|
+
}
|
|
32
|
+
async function copySubFlow(nodes, edges) {
|
|
33
|
+
return await invoke('plugin:askit|copy_sub_flow', { nodes, edges });
|
|
34
|
+
}
|
|
35
|
+
async function startAgentFlow(flowName) {
|
|
36
|
+
await invoke('plugin:askit|start_agent_flow', { flowName });
|
|
37
|
+
}
|
|
38
|
+
async function stopAgentFlow(flowName) {
|
|
39
|
+
await invoke('plugin:askit|stop_agent_flow', { flowName });
|
|
40
|
+
}
|
|
41
|
+
// nodes
|
|
42
|
+
async function newAgentFlowNode(defName) {
|
|
43
|
+
await invoke('plugin:askit|new_agent_flow_node', { defName });
|
|
44
|
+
}
|
|
45
|
+
async function addAgentFlowNode(flowName, node) {
|
|
46
|
+
await invoke('plugin:askit|add_agent_flow_node', { flowName, node });
|
|
47
|
+
}
|
|
48
|
+
async function removeAgentFlowNode(flowName, nodeId) {
|
|
49
|
+
await invoke('plugin:askit|remove_agent_flow_node', { flowName, nodeId });
|
|
50
|
+
}
|
|
51
|
+
// edge
|
|
52
|
+
async function addAgentFlowEdge(flowName, edge) {
|
|
53
|
+
await invoke('plugin:askit|add_agent_flow_edge', { flowName, edge });
|
|
54
|
+
}
|
|
55
|
+
async function removeAgentFlowEdge(flowName, edgeId) {
|
|
56
|
+
await invoke('plugin:askit|remove_agent_flow_edge', { flowName, edgeId });
|
|
57
|
+
}
|
|
58
|
+
// agent
|
|
59
|
+
async function startAgent(agentId) {
|
|
60
|
+
await invoke('plugin:askit|start_agent', { agentId });
|
|
61
|
+
}
|
|
62
|
+
async function stopAgent(agentId) {
|
|
63
|
+
await invoke('plugin:askit|stop_agent', { agentId });
|
|
64
|
+
}
|
|
65
|
+
// board
|
|
66
|
+
async function writeBoard(board, message) {
|
|
67
|
+
await invoke('plugin:askit|write_board', { board, message });
|
|
68
|
+
}
|
|
69
|
+
// config
|
|
70
|
+
async function setAgentConfig(agentId, config) {
|
|
71
|
+
await invoke('plugin:askit|set_agent_config', { agentId, config });
|
|
72
|
+
}
|
|
73
|
+
async function getGlobalConfig(defName) {
|
|
74
|
+
return await invoke('plugin:askit|get_global_config', { defName });
|
|
75
|
+
}
|
|
76
|
+
async function getGlobalConfigs() {
|
|
77
|
+
return await invoke('plugin:askit|get_global_configs', {});
|
|
78
|
+
}
|
|
79
|
+
async function setGlobalConfig(defName, config) {
|
|
80
|
+
await invoke('plugin:askit|set_global_config', { defName, config });
|
|
81
|
+
}
|
|
82
|
+
async function setGlobalConfigs(configs) {
|
|
83
|
+
await invoke('plugin:askit|set_global_configs', { configs });
|
|
84
|
+
}
|
|
85
|
+
async function getAgentDefaultConfig(defName) {
|
|
86
|
+
return await invoke('plugin:askit|get_agent_default_config', { defName });
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export { addAgentFlow, addAgentFlowEdge, addAgentFlowNode, copySubFlow, getAgentDefaultConfig, getAgentDefinition, getAgentDefinitions, getAgentFlows, getGlobalConfig, getGlobalConfigs, insertAgentFlow, newAgentFlow, newAgentFlowNode, removeAgentFlow, removeAgentFlowEdge, removeAgentFlowNode, renameAgentFlow, setAgentConfig, setGlobalConfig, setGlobalConfigs, startAgent, startAgentFlow, stopAgent, stopAgentFlow, uniqueFlowName, writeBoard };
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tauri-plugin-askit-api",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"license": "MIT OR Apache-2.0",
|
|
5
|
+
"author": "Akira Ishino",
|
|
6
|
+
"description": "Tauri plugin for Agent Stream 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
|
+
}
|