@jackle.dev/zalox-plugin 1.0.9 → 1.0.11

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.9",
3
+ "version": "1.0.11",
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",
@@ -3,11 +3,11 @@ import { createTemplate } from './core/templates.js';
3
3
 
4
4
  export const zaloxScenarioTool = {
5
5
  name: 'zalox_scenario',
6
- description: 'Import scenario templates from a URL or Registry ID.',
6
+ description: 'Import scenario templates (Playbook) from a URL or Registry ID.',
7
7
  parameters: z.object({
8
8
  action: z.enum(['import']),
9
9
  url: z.string().optional().describe('Direct URL to scenario JSON'),
10
- registryId: z.string().optional().describe('Registry ID (e.g., "appointment-booking")'),
10
+ registryId: z.string().optional().describe('Registry ID (e.g., "appointment-booking", "viettel-tracking")'),
11
11
  }),
12
12
  execute: async (args: any) => {
13
13
  const { action, url, registryId } = args;
@@ -42,11 +42,35 @@ export const zaloxScenarioTool = {
42
42
  }
43
43
 
44
44
  let report = `Imported scenario "${data.name || 'Unknown'}":\n${results.join('\n')}`;
45
-
46
- if (data.instructions) {
47
- report += `\n\nšŸ“š SOP / INSTRUCTIONS (Save to MEMORY.md):\n${data.instructions}`;
45
+
46
+ // Analyze Requirements (Playbook Logic)
47
+ const reqs = data.requirements || {};
48
+ const flow = data.flow || [];
49
+ const setup = data.setup || {};
50
+ const warnings = [];
51
+
52
+ if (reqs.packages && reqs.packages.length > 0) {
53
+ warnings.push(`šŸ“¦ Packages required: ${reqs.packages.join(', ')}`);
48
54
  }
49
-
55
+ if (reqs.env && reqs.env.length > 0) {
56
+ warnings.push(`šŸ”‘ Environment variables needed: ${reqs.env.join(', ')}`);
57
+ }
58
+ if (reqs.tools && reqs.tools.length > 0) {
59
+ warnings.push(`šŸ› ļø Agent tools required: ${reqs.tools.join(', ')}`);
60
+ }
61
+
62
+ if (warnings.length > 0 || flow.length > 0) {
63
+ report += `\n\n🚨 PLAYBOOK REQUIREMENTS:\n${warnings.join('\n')}`;
64
+
65
+ if (setup.commands && setup.commands.length > 0) {
66
+ report += `\n\nšŸ› ļø SETUP GUIDE (Ask user to run/confirm):\n`;
67
+ if (setup.guide) report += `ā„¹ļø ${setup.guide}\n`;
68
+ report += `Commands:\n${setup.commands.map((c: string) => `> ${c}`).join('\n')}`;
69
+ }
70
+
71
+ report += `\n\nšŸ“‹ EXECUTION FLOW (SOP):\n${flow.join('\n')}`;
72
+ }
73
+
50
74
  return report;
51
75
  } catch (e: any) {
52
76
  return `Scenario import failed: ${e.message}`;