@jackle.dev/zalox-plugin 1.0.15 → 1.0.17
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/package.json +1 -1
- package/src/tools-scenario.ts +19 -6
- package/src/tools-template.ts +24 -7
- package/src/tools.ts +26 -10
package/package.json
CHANGED
package/src/tools-scenario.ts
CHANGED
|
@@ -1,14 +1,27 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
1
|
import { createTemplate } from './core/templates.js';
|
|
3
2
|
|
|
4
3
|
export const zaloxScenarioTool = {
|
|
5
4
|
name: 'zalox_scenario',
|
|
6
5
|
description: 'Import scenario templates (Playbook) from a URL or Registry ID.',
|
|
7
|
-
parameters:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
parameters: {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: {
|
|
9
|
+
action: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
enum: ['import'],
|
|
12
|
+
description: 'Action to perform'
|
|
13
|
+
},
|
|
14
|
+
url: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'Direct URL to scenario JSON'
|
|
17
|
+
},
|
|
18
|
+
registryId: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
description: 'Registry ID (e.g., "appointment-booking", "viettel-tracking")'
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
required: ['action'],
|
|
24
|
+
},
|
|
12
25
|
execute: async (args: any) => {
|
|
13
26
|
const { action, url, registryId } = args;
|
|
14
27
|
if (action !== 'import') return 'Only import action supported';
|
package/src/tools-template.ts
CHANGED
|
@@ -1,15 +1,32 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
1
|
import { createTemplate, listTemplates, getTemplate, renderTemplate, deleteTemplate } from './core/templates.js';
|
|
3
2
|
|
|
4
3
|
export const zaloxTemplateTool = {
|
|
5
4
|
name: 'zalox_template',
|
|
6
5
|
description: 'Manage and use message templates.',
|
|
7
|
-
parameters:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
parameters: {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: {
|
|
9
|
+
action: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
enum: ['list', 'get', 'create', 'delete', 'render'],
|
|
12
|
+
description: 'Action to perform'
|
|
13
|
+
},
|
|
14
|
+
name: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'Template name or ID (required for get/create/delete/render)'
|
|
17
|
+
},
|
|
18
|
+
content: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
description: 'Content for create (supports {{variable}})'
|
|
21
|
+
},
|
|
22
|
+
vars: {
|
|
23
|
+
type: 'object',
|
|
24
|
+
additionalProperties: { type: 'string' },
|
|
25
|
+
description: 'Variables for render (key-value pairs)'
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
required: ['action'],
|
|
29
|
+
},
|
|
13
30
|
execute: async (args: any) => {
|
|
14
31
|
const { action, name, content, vars } = args;
|
|
15
32
|
|
package/src/tools.ts
CHANGED
|
@@ -1,19 +1,36 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
1
|
import { getCachedApi } from './client.js';
|
|
3
2
|
|
|
4
3
|
export const zaloxGroupTool = {
|
|
5
4
|
name: 'zalox_group',
|
|
6
5
|
description: 'Manage Zalo groups: kick members, add members, or get group info.',
|
|
7
|
-
parameters:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
parameters: {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: {
|
|
9
|
+
action: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
enum: ['kick', 'add', 'info'],
|
|
12
|
+
description: 'Action to perform'
|
|
13
|
+
},
|
|
14
|
+
groupId: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'Target Group ID'
|
|
17
|
+
},
|
|
18
|
+
userId: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
description: 'Target User ID (required for kick/add)'
|
|
21
|
+
},
|
|
22
|
+
profile: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
default: 'default',
|
|
25
|
+
description: 'Zalo profile to use'
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
required: ['action', 'groupId'],
|
|
29
|
+
},
|
|
13
30
|
execute: async (args: any) => {
|
|
14
31
|
const { action, groupId, userId, profile } = args;
|
|
15
|
-
const cached = getCachedApi(profile);
|
|
16
|
-
if (!cached) throw new Error(`Profile ${profile} not connected`);
|
|
32
|
+
const cached = getCachedApi(profile || 'default');
|
|
33
|
+
if (!cached) throw new Error(`Profile ${profile || 'default'} not connected`);
|
|
17
34
|
|
|
18
35
|
const api = cached.api as any;
|
|
19
36
|
|
|
@@ -32,7 +49,6 @@ export const zaloxGroupTool = {
|
|
|
32
49
|
|
|
33
50
|
if (action === 'info') {
|
|
34
51
|
const info = await api.getGroupInfo(groupId);
|
|
35
|
-
// Simplify info to avoid huge context
|
|
36
52
|
const simple = {
|
|
37
53
|
id: info.id,
|
|
38
54
|
name: info.name,
|