tauri-plugin-askit-api 0.5.1 → 0.6.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/dist-js/index.cjs CHANGED
@@ -4,88 +4,97 @@ var core = require('@tauri-apps/api/core');
4
4
 
5
5
  // agent definition
6
6
  async function getAgentDefinition() {
7
- return await core.invoke('plugin:askit|get_agent_definition', {});
7
+ return await core.invoke("plugin:askit|get_agent_definition", {});
8
8
  }
9
9
  async function getAgentDefinitions() {
10
- return await core.invoke('plugin:askit|get_agent_definitions', {});
10
+ return await core.invoke("plugin:askit|get_agent_definitions", {});
11
+ }
12
+ // agent spec
13
+ async function getAgentSpec(agentId) {
14
+ return await core.invoke("plugin:askit|get_agent_spec", { agentId });
11
15
  }
12
16
  // flow
13
17
  async function getAgentFlows() {
14
- return await core.invoke('plugin:askit|get_agent_flows', {});
18
+ return await core.invoke("plugin:askit|get_agent_flows", {});
15
19
  }
16
20
  async function newAgentFlow(flowName) {
17
- return await core.invoke('plugin:askit|new_agent_flow', { flowName });
21
+ return await core.invoke("plugin:askit|new_agent_flow", { flowName });
18
22
  }
19
23
  async function renameAgentFlow(flowId, newName) {
20
- return await core.invoke('plugin:askit|rename_agent_flow', { flowId, newName });
24
+ return await core.invoke("plugin:askit|rename_agent_flow", {
25
+ flowId,
26
+ newName,
27
+ });
21
28
  }
22
29
  async function uniqueFlowName(name) {
23
- return await core.invoke('plugin:askit|unique_flow_name', { name });
30
+ return await core.invoke("plugin:askit|unique_flow_name", { name });
24
31
  }
25
32
  async function addAgentFlow(agentFlow) {
26
- await core.invoke('plugin:askit|add_agent_flow', { agentFlow });
33
+ await core.invoke("plugin:askit|add_agent_flow", { agentFlow });
27
34
  }
28
35
  async function removeAgentFlow(id) {
29
- await core.invoke('plugin:askit|remove_agent_flow', { id });
36
+ await core.invoke("plugin:askit|remove_agent_flow", { id });
30
37
  }
31
38
  async function insertAgentFlow(agentFlow) {
32
- await core.invoke('plugin:askit|insert_agent_flow', { agentFlow });
39
+ await core.invoke("plugin:askit|insert_agent_flow", { agentFlow });
33
40
  }
34
41
  async function copySubFlow(nodes, edges) {
35
- return await core.invoke('plugin:askit|copy_sub_flow', { nodes, edges });
42
+ return await core.invoke("plugin:askit|copy_sub_flow", { nodes, edges });
36
43
  }
37
44
  async function startAgentFlow(id) {
38
- await core.invoke('plugin:askit|start_agent_flow', { id });
45
+ await core.invoke("plugin:askit|start_agent_flow", { id });
39
46
  }
40
47
  async function stopAgentFlow(id) {
41
- await core.invoke('plugin:askit|stop_agent_flow', { id });
48
+ await core.invoke("plugin:askit|stop_agent_flow", { id });
42
49
  }
43
50
  // nodes
44
51
  async function newAgentFlowNode(defName) {
45
- return await core.invoke('plugin:askit|new_agent_flow_node', { defName });
52
+ return await core.invoke("plugin:askit|new_agent_flow_node", { defName });
46
53
  }
47
54
  async function addAgentFlowNode(flowId, node) {
48
- await core.invoke('plugin:askit|add_agent_flow_node', { flowId, node });
55
+ await core.invoke("plugin:askit|add_agent_flow_node", { flowId, node });
49
56
  }
50
57
  async function removeAgentFlowNode(flowId, nodeId) {
51
- await core.invoke('plugin:askit|remove_agent_flow_node', { flowId, nodeId });
58
+ await core.invoke("plugin:askit|remove_agent_flow_node", { flowId, nodeId });
52
59
  }
53
60
  // edge
54
61
  async function addAgentFlowEdge(flowId, edge) {
55
- await core.invoke('plugin:askit|add_agent_flow_edge', { flowId, edge });
62
+ await core.invoke("plugin:askit|add_agent_flow_edge", { flowId, edge });
56
63
  }
57
64
  async function removeAgentFlowEdge(flowId, edgeId) {
58
- await core.invoke('plugin:askit|remove_agent_flow_edge', { flowId, edgeId });
65
+ await core.invoke("plugin:askit|remove_agent_flow_edge", { flowId, edgeId });
59
66
  }
60
67
  // agent
61
68
  async function startAgent(agentId) {
62
- await core.invoke('plugin:askit|start_agent', { agentId });
69
+ await core.invoke("plugin:askit|start_agent", { agentId });
63
70
  }
64
71
  async function stopAgent(agentId) {
65
- await core.invoke('plugin:askit|stop_agent', { agentId });
72
+ await core.invoke("plugin:askit|stop_agent", { agentId });
66
73
  }
67
74
  // board
68
75
  async function writeBoard(board, message) {
69
- await core.invoke('plugin:askit|write_board', { board, message });
76
+ await core.invoke("plugin:askit|write_board", { board, message });
70
77
  }
71
78
  // configs
72
79
  async function setAgentConfigs(agentId, configs) {
73
- await core.invoke('plugin:askit|set_agent_configs', { agentId, configs });
80
+ await core.invoke("plugin:askit|set_agent_configs", { agentId, configs });
74
81
  }
75
82
  async function getGlobalConfigs(defName) {
76
- return await core.invoke('plugin:askit|get_global_configs', { defName });
83
+ return await core.invoke("plugin:askit|get_global_configs", { defName });
77
84
  }
78
85
  async function getGlobalConfigsMap() {
79
- return await core.invoke('plugin:askit|get_global_configs_map', {});
86
+ return await core.invoke("plugin:askit|get_global_configs_map", {});
80
87
  }
81
88
  async function setGlobalConfigs(defName, configs) {
82
- await core.invoke('plugin:askit|set_global_configs', { defName, configs });
89
+ await core.invoke("plugin:askit|set_global_configs", { defName, configs });
83
90
  }
84
91
  async function setGlobalConfigsMap(configs) {
85
- await core.invoke('plugin:askit|set_global_configs_map', { configs });
92
+ await core.invoke("plugin:askit|set_global_configs_map", { configs });
86
93
  }
87
94
  async function getAgentDefaultConfigs(defName) {
88
- return await core.invoke('plugin:askit|get_agent_default_configs', { defName });
95
+ return await core.invoke("plugin:askit|get_agent_default_configs", {
96
+ defName,
97
+ });
89
98
  }
90
99
 
91
100
  exports.addAgentFlow = addAgentFlow;
@@ -96,6 +105,7 @@ exports.getAgentDefaultConfigs = getAgentDefaultConfigs;
96
105
  exports.getAgentDefinition = getAgentDefinition;
97
106
  exports.getAgentDefinitions = getAgentDefinitions;
98
107
  exports.getAgentFlows = getAgentFlows;
108
+ exports.getAgentSpec = getAgentSpec;
99
109
  exports.getGlobalConfigs = getGlobalConfigs;
100
110
  exports.getGlobalConfigsMap = getGlobalConfigsMap;
101
111
  exports.insertAgentFlow = insertAgentFlow;
@@ -3,34 +3,35 @@ export type AgentGlobalConfigsMap = Record<string, AgentConfigs>;
3
3
  export type AgentDefinition = {
4
4
  kind: string;
5
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_configs: AgentDefaultConfigs | null;
13
- global_configs: AgentGlobalConfigs | null;
14
- display_configs: AgentDisplayConfigs | null;
6
+ title?: string | null;
7
+ description?: string | null;
8
+ category?: string | null;
9
+ inputs?: string[] | null;
10
+ outputs?: string[] | null;
11
+ default_configs?: AgentConfigSpecs | null;
12
+ global_configs?: AgentGlobalConfigSpecs | null;
13
+ display_configs?: AgentDisplayConfigSpecs | null;
14
+ native_thread?: boolean | null;
15
15
  };
16
- export type AgentDefaultConfigs = [string, AgentConfigEntry][];
17
- export type AgentGlobalConfigs = [string, AgentConfigEntry][];
18
- export type AgentConfigEntry = {
16
+ export type AgentConfigSpecs = Record<string, AgentConfigSpec>;
17
+ export type AgentGlobalConfigSpecs = Record<string, AgentConfigSpec>;
18
+ export type AgentConfigSpec = {
19
19
  value: any;
20
20
  type: AgentConfigValueType | null;
21
21
  title?: string | null;
22
22
  description?: string | null;
23
23
  hidden?: boolean | null;
24
24
  };
25
- export type AgentConfigValueType = "unit" | "boolean" | "integer" | "number" | "string" | "password" | "text" | "object";
26
- export type AgentDisplayConfigs = [string, AgentDisplayConfigEntry][];
27
- export type AgentDisplayConfigEntry = {
25
+ export type AgentConfigValueType = string;
26
+ export type AgentDisplayConfigSpecs = Record<string, AgentDisplayConfigSpec>;
27
+ export type AgentDisplayConfigSpec = {
28
+ value?: any | null;
28
29
  type: AgentDisplayConfigType | null;
29
30
  title?: string | null;
30
31
  description?: string | null;
31
32
  hideTitle?: boolean | null;
32
33
  };
33
- export type AgentDisplayConfigType = "*" | "boolean" | "integer" | "number" | "string" | "text" | "object" | "messages";
34
+ export type AgentDisplayConfigType = string;
34
35
  export type AgentFlows = Record<string, AgentFlow>;
35
36
  export type AgentFlow = {
36
37
  id: string;
@@ -41,16 +42,19 @@ export type AgentFlow = {
41
42
  };
42
43
  export type AgentConfigsMap = Record<string, AgentConfigs>;
43
44
  export type AgentConfigs = Record<string, any>;
44
- export type AgentFlowNode = {
45
- id: string;
45
+ export type AgentSpec = {
46
46
  def_name: string;
47
+ inputs?: string[] | null;
48
+ outputs?: string[] | null;
49
+ configs?: AgentConfigs | null;
50
+ config_specs?: AgentConfigSpecs | null;
51
+ display_config_specs?: AgentDisplayConfigSpecs | null;
52
+ };
53
+ export type AgentFlowNodeExtensions = Record<string, any>;
54
+ export type AgentFlowNode = AgentFlowNodeExtensions & {
55
+ id: string;
47
56
  enabled: boolean;
48
- configs: AgentConfigs | null;
49
- title: string | null;
50
- x: number;
51
- y: number;
52
- width?: number;
53
- height?: number;
57
+ spec: AgentSpec;
54
58
  };
55
59
  export type AgentFlowEdge = {
56
60
  id: string;
@@ -87,12 +91,16 @@ export type ErrorMessage = {
87
91
  agent_id: string;
88
92
  message: string;
89
93
  };
94
+ export type AgentSpecUpdatedMessage = {
95
+ agent_id: string;
96
+ };
90
97
  export type InputMessage = {
91
98
  agent_id: string;
92
99
  ch: string;
93
100
  };
94
101
  export declare function getAgentDefinition(): Promise<AgentDefinition | null>;
95
102
  export declare function getAgentDefinitions(): Promise<AgentDefinitions>;
103
+ export declare function getAgentSpec(agentId: string): Promise<AgentSpec | null>;
96
104
  export declare function getAgentFlows(): Promise<AgentFlows>;
97
105
  export declare function newAgentFlow(flowName: string): Promise<AgentFlow>;
98
106
  export declare function renameAgentFlow(flowId: string, newName: string): Promise<string>;
@@ -111,9 +119,9 @@ export declare function removeAgentFlowEdge(flowId: string, edgeId: string): Pro
111
119
  export declare function startAgent(agentId: string): Promise<void>;
112
120
  export declare function stopAgent(agentId: string): Promise<void>;
113
121
  export declare function writeBoard(board: string, message: string): Promise<void>;
114
- export declare function setAgentConfigs(agentId: string, configs: Record<string, any>): Promise<void>;
122
+ export declare function setAgentConfigs(agentId: string, configs: AgentConfigs): Promise<void>;
115
123
  export declare function getGlobalConfigs(defName: string): Promise<AgentConfigs | null>;
116
124
  export declare function getGlobalConfigsMap(): Promise<AgentConfigsMap>;
117
125
  export declare function setGlobalConfigs(defName: string, configs: AgentConfigs): Promise<void>;
118
126
  export declare function setGlobalConfigsMap(configs: AgentConfigsMap): Promise<void>;
119
- export declare function getAgentDefaultConfigs(defName: string): Promise<AgentDefaultConfigs | null>;
127
+ export declare function getAgentDefaultConfigs(defName: string): Promise<AgentConfigSpecs | null>;
package/dist-js/index.js CHANGED
@@ -2,88 +2,97 @@ import { invoke } from '@tauri-apps/api/core';
2
2
 
3
3
  // agent definition
4
4
  async function getAgentDefinition() {
5
- return await invoke('plugin:askit|get_agent_definition', {});
5
+ return await invoke("plugin:askit|get_agent_definition", {});
6
6
  }
7
7
  async function getAgentDefinitions() {
8
- return await invoke('plugin:askit|get_agent_definitions', {});
8
+ return await invoke("plugin:askit|get_agent_definitions", {});
9
+ }
10
+ // agent spec
11
+ async function getAgentSpec(agentId) {
12
+ return await invoke("plugin:askit|get_agent_spec", { agentId });
9
13
  }
10
14
  // flow
11
15
  async function getAgentFlows() {
12
- return await invoke('plugin:askit|get_agent_flows', {});
16
+ return await invoke("plugin:askit|get_agent_flows", {});
13
17
  }
14
18
  async function newAgentFlow(flowName) {
15
- return await invoke('plugin:askit|new_agent_flow', { flowName });
19
+ return await invoke("plugin:askit|new_agent_flow", { flowName });
16
20
  }
17
21
  async function renameAgentFlow(flowId, newName) {
18
- return await invoke('plugin:askit|rename_agent_flow', { flowId, newName });
22
+ return await invoke("plugin:askit|rename_agent_flow", {
23
+ flowId,
24
+ newName,
25
+ });
19
26
  }
20
27
  async function uniqueFlowName(name) {
21
- return await invoke('plugin:askit|unique_flow_name', { name });
28
+ return await invoke("plugin:askit|unique_flow_name", { name });
22
29
  }
23
30
  async function addAgentFlow(agentFlow) {
24
- await invoke('plugin:askit|add_agent_flow', { agentFlow });
31
+ await invoke("plugin:askit|add_agent_flow", { agentFlow });
25
32
  }
26
33
  async function removeAgentFlow(id) {
27
- await invoke('plugin:askit|remove_agent_flow', { id });
34
+ await invoke("plugin:askit|remove_agent_flow", { id });
28
35
  }
29
36
  async function insertAgentFlow(agentFlow) {
30
- await invoke('plugin:askit|insert_agent_flow', { agentFlow });
37
+ await invoke("plugin:askit|insert_agent_flow", { agentFlow });
31
38
  }
32
39
  async function copySubFlow(nodes, edges) {
33
- return await invoke('plugin:askit|copy_sub_flow', { nodes, edges });
40
+ return await invoke("plugin:askit|copy_sub_flow", { nodes, edges });
34
41
  }
35
42
  async function startAgentFlow(id) {
36
- await invoke('plugin:askit|start_agent_flow', { id });
43
+ await invoke("plugin:askit|start_agent_flow", { id });
37
44
  }
38
45
  async function stopAgentFlow(id) {
39
- await invoke('plugin:askit|stop_agent_flow', { id });
46
+ await invoke("plugin:askit|stop_agent_flow", { id });
40
47
  }
41
48
  // nodes
42
49
  async function newAgentFlowNode(defName) {
43
- return await invoke('plugin:askit|new_agent_flow_node', { defName });
50
+ return await invoke("plugin:askit|new_agent_flow_node", { defName });
44
51
  }
45
52
  async function addAgentFlowNode(flowId, node) {
46
- await invoke('plugin:askit|add_agent_flow_node', { flowId, node });
53
+ await invoke("plugin:askit|add_agent_flow_node", { flowId, node });
47
54
  }
48
55
  async function removeAgentFlowNode(flowId, nodeId) {
49
- await invoke('plugin:askit|remove_agent_flow_node', { flowId, nodeId });
56
+ await invoke("plugin:askit|remove_agent_flow_node", { flowId, nodeId });
50
57
  }
51
58
  // edge
52
59
  async function addAgentFlowEdge(flowId, edge) {
53
- await invoke('plugin:askit|add_agent_flow_edge', { flowId, edge });
60
+ await invoke("plugin:askit|add_agent_flow_edge", { flowId, edge });
54
61
  }
55
62
  async function removeAgentFlowEdge(flowId, edgeId) {
56
- await invoke('plugin:askit|remove_agent_flow_edge', { flowId, edgeId });
63
+ await invoke("plugin:askit|remove_agent_flow_edge", { flowId, edgeId });
57
64
  }
58
65
  // agent
59
66
  async function startAgent(agentId) {
60
- await invoke('plugin:askit|start_agent', { agentId });
67
+ await invoke("plugin:askit|start_agent", { agentId });
61
68
  }
62
69
  async function stopAgent(agentId) {
63
- await invoke('plugin:askit|stop_agent', { agentId });
70
+ await invoke("plugin:askit|stop_agent", { agentId });
64
71
  }
65
72
  // board
66
73
  async function writeBoard(board, message) {
67
- await invoke('plugin:askit|write_board', { board, message });
74
+ await invoke("plugin:askit|write_board", { board, message });
68
75
  }
69
76
  // configs
70
77
  async function setAgentConfigs(agentId, configs) {
71
- await invoke('plugin:askit|set_agent_configs', { agentId, configs });
78
+ await invoke("plugin:askit|set_agent_configs", { agentId, configs });
72
79
  }
73
80
  async function getGlobalConfigs(defName) {
74
- return await invoke('plugin:askit|get_global_configs', { defName });
81
+ return await invoke("plugin:askit|get_global_configs", { defName });
75
82
  }
76
83
  async function getGlobalConfigsMap() {
77
- return await invoke('plugin:askit|get_global_configs_map', {});
84
+ return await invoke("plugin:askit|get_global_configs_map", {});
78
85
  }
79
86
  async function setGlobalConfigs(defName, configs) {
80
- await invoke('plugin:askit|set_global_configs', { defName, configs });
87
+ await invoke("plugin:askit|set_global_configs", { defName, configs });
81
88
  }
82
89
  async function setGlobalConfigsMap(configs) {
83
- await invoke('plugin:askit|set_global_configs_map', { configs });
90
+ await invoke("plugin:askit|set_global_configs_map", { configs });
84
91
  }
85
92
  async function getAgentDefaultConfigs(defName) {
86
- return await invoke('plugin:askit|get_agent_default_configs', { defName });
93
+ return await invoke("plugin:askit|get_agent_default_configs", {
94
+ defName,
95
+ });
87
96
  }
88
97
 
89
- export { addAgentFlow, addAgentFlowEdge, addAgentFlowNode, copySubFlow, getAgentDefaultConfigs, getAgentDefinition, getAgentDefinitions, getAgentFlows, getGlobalConfigs, getGlobalConfigsMap, insertAgentFlow, newAgentFlow, newAgentFlowNode, removeAgentFlow, removeAgentFlowEdge, removeAgentFlowNode, renameAgentFlow, setAgentConfigs, setGlobalConfigs, setGlobalConfigsMap, startAgent, startAgentFlow, stopAgent, stopAgentFlow, uniqueFlowName, writeBoard };
98
+ export { addAgentFlow, addAgentFlowEdge, addAgentFlowNode, copySubFlow, getAgentDefaultConfigs, getAgentDefinition, getAgentDefinitions, getAgentFlows, getAgentSpec, getGlobalConfigs, getGlobalConfigsMap, insertAgentFlow, newAgentFlow, newAgentFlowNode, removeAgentFlow, removeAgentFlowEdge, removeAgentFlowNode, renameAgentFlow, setAgentConfigs, setGlobalConfigs, setGlobalConfigsMap, startAgent, startAgentFlow, stopAgent, stopAgentFlow, uniqueFlowName, writeBoard };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tauri-plugin-askit-api",
3
- "version": "0.5.1",
3
+ "version": "0.6.0",
4
4
  "license": "MIT OR Apache-2.0",
5
5
  "author": "Akira Ishino",
6
6
  "description": "Tauri plugin for Agent Stream Kit",