@jackle.dev/zalox-plugin 1.0.14 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jackle.dev/zalox-plugin",
3
- "version": "1.0.14",
3
+ "version": "1.0.17",
4
4
  "description": "OpenClaw channel plugin for Zalo via zca-js (in-process, single login)",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
package/src/listener.ts CHANGED
@@ -376,7 +376,7 @@ export async function startInProcessListener(
376
376
  const textMention = content.includes(`@${name}`) || content.includes('@Tiệp Lê');
377
377
 
378
378
  // DEBUG Group logic
379
- console.log(`[ZaloX] Group msg: mentioned=${isMentioned} textMention=${textMention} name=${name} content="${content}"`);
379
+ console.log(`[ZaloX] Group Check: ownId=${ownId} mentioned=${isMentioned} textMention=${textMention} content="${content}"`);
380
380
 
381
381
  if (!isMentioned && !textMention && !content.startsWith('/')) {
382
382
  return;
@@ -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: z.object({
8
- action: z.enum(['import']),
9
- url: z.string().optional().describe('Direct URL to scenario JSON'),
10
- registryId: z.string().optional().describe('Registry ID (e.g., "appointment-booking", "viettel-tracking")'),
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';
@@ -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: z.object({
8
- action: z.enum(['list', 'get', 'create', 'delete', 'render']),
9
- name: z.string().optional().describe('Template name or ID (required for get/create/delete/render)'),
10
- content: z.string().optional().describe('Content for create (supports {{variable}})'),
11
- vars: z.record(z.string()).optional().describe('Variables for render'),
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: z.object({
8
- action: z.enum(['kick', 'add', 'info']),
9
- groupId: z.string(),
10
- userId: z.string().optional(),
11
- profile: z.string().optional().default('default'),
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,