zilmate 1.0.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.
Files changed (166) hide show
  1. package/.env.example +14 -0
  2. package/README.md +326 -0
  3. package/agent-docs.md +264 -0
  4. package/dist/agents/chat.agent.d.ts +30 -0
  5. package/dist/agents/chat.agent.d.ts.map +1 -0
  6. package/dist/agents/chat.agent.js +16 -0
  7. package/dist/agents/chat.agent.js.map +1 -0
  8. package/dist/agents/docs-research.agent.d.ts +127 -0
  9. package/dist/agents/docs-research.agent.d.ts.map +1 -0
  10. package/dist/agents/docs-research.agent.js +29 -0
  11. package/dist/agents/docs-research.agent.js.map +1 -0
  12. package/dist/agents/image.agent.d.ts +9 -0
  13. package/dist/agents/image.agent.d.ts.map +1 -0
  14. package/dist/agents/image.agent.js +12 -0
  15. package/dist/agents/image.agent.js.map +1 -0
  16. package/dist/agents/manager.d.ts +140 -0
  17. package/dist/agents/manager.d.ts.map +1 -0
  18. package/dist/agents/manager.js +150 -0
  19. package/dist/agents/manager.js.map +1 -0
  20. package/dist/agents/post.agent.d.ts +7 -0
  21. package/dist/agents/post.agent.d.ts.map +1 -0
  22. package/dist/agents/post.agent.js +12 -0
  23. package/dist/agents/post.agent.js.map +1 -0
  24. package/dist/agents/quick-help.agent.d.ts +30 -0
  25. package/dist/agents/quick-help.agent.d.ts.map +1 -0
  26. package/dist/agents/quick-help.agent.js +16 -0
  27. package/dist/agents/quick-help.agent.js.map +1 -0
  28. package/dist/cli/confirm.d.ts +5 -0
  29. package/dist/cli/confirm.d.ts.map +1 -0
  30. package/dist/cli/confirm.js +35 -0
  31. package/dist/cli/confirm.js.map +1 -0
  32. package/dist/cli/doctor.d.ts +53 -0
  33. package/dist/cli/doctor.d.ts.map +1 -0
  34. package/dist/cli/doctor.js +141 -0
  35. package/dist/cli/doctor.js.map +1 -0
  36. package/dist/cli/format.d.ts +12 -0
  37. package/dist/cli/format.d.ts.map +1 -0
  38. package/dist/cli/format.js +167 -0
  39. package/dist/cli/format.js.map +1 -0
  40. package/dist/cli/interactive.d.ts +2 -0
  41. package/dist/cli/interactive.d.ts.map +1 -0
  42. package/dist/cli/interactive.js +80 -0
  43. package/dist/cli/interactive.js.map +1 -0
  44. package/dist/cli/setup.d.ts +14 -0
  45. package/dist/cli/setup.d.ts.map +1 -0
  46. package/dist/cli/setup.js +145 -0
  47. package/dist/cli/setup.js.map +1 -0
  48. package/dist/cli/triggers.d.ts +43 -0
  49. package/dist/cli/triggers.d.ts.map +1 -0
  50. package/dist/cli/triggers.js +221 -0
  51. package/dist/cli/triggers.js.map +1 -0
  52. package/dist/config/env.d.ts +26 -0
  53. package/dist/config/env.d.ts.map +1 -0
  54. package/dist/config/env.js +59 -0
  55. package/dist/config/env.js.map +1 -0
  56. package/dist/config/models.d.ts +22 -0
  57. package/dist/config/models.d.ts.map +1 -0
  58. package/dist/config/models.js +38 -0
  59. package/dist/config/models.js.map +1 -0
  60. package/dist/index.d.ts +3 -0
  61. package/dist/index.d.ts.map +1 -0
  62. package/dist/index.js +452 -0
  63. package/dist/index.js.map +1 -0
  64. package/dist/memory/composio-session.d.ts +9 -0
  65. package/dist/memory/composio-session.d.ts.map +1 -0
  66. package/dist/memory/composio-session.js +33 -0
  67. package/dist/memory/composio-session.js.map +1 -0
  68. package/dist/memory/history.d.ts +11 -0
  69. package/dist/memory/history.d.ts.map +1 -0
  70. package/dist/memory/history.js +33 -0
  71. package/dist/memory/history.js.map +1 -0
  72. package/dist/memory/local-store.d.ts +4 -0
  73. package/dist/memory/local-store.d.ts.map +1 -0
  74. package/dist/memory/local-store.js +24 -0
  75. package/dist/memory/local-store.js.map +1 -0
  76. package/dist/memory/long-term.d.ts +13 -0
  77. package/dist/memory/long-term.d.ts.map +1 -0
  78. package/dist/memory/long-term.js +67 -0
  79. package/dist/memory/long-term.js.map +1 -0
  80. package/dist/memory/redis.d.ts +4 -0
  81. package/dist/memory/redis.d.ts.map +1 -0
  82. package/dist/memory/redis.js +18 -0
  83. package/dist/memory/redis.js.map +1 -0
  84. package/dist/memory/scratchpad.d.ts +3 -0
  85. package/dist/memory/scratchpad.d.ts.map +1 -0
  86. package/dist/memory/scratchpad.js +22 -0
  87. package/dist/memory/scratchpad.js.map +1 -0
  88. package/dist/runtime/confirm.d.ts +13 -0
  89. package/dist/runtime/confirm.d.ts.map +1 -0
  90. package/dist/runtime/confirm.js +17 -0
  91. package/dist/runtime/confirm.js.map +1 -0
  92. package/dist/runtime/progress.d.ts +8 -0
  93. package/dist/runtime/progress.d.ts.map +1 -0
  94. package/dist/runtime/progress.js +15 -0
  95. package/dist/runtime/progress.js.map +1 -0
  96. package/dist/safety/approvals.d.ts +6 -0
  97. package/dist/safety/approvals.d.ts.map +1 -0
  98. package/dist/safety/approvals.js +8 -0
  99. package/dist/safety/approvals.js.map +1 -0
  100. package/dist/safety/limits.d.ts +8 -0
  101. package/dist/safety/limits.d.ts.map +1 -0
  102. package/dist/safety/limits.js +10 -0
  103. package/dist/safety/limits.js.map +1 -0
  104. package/dist/safety/redaction.d.ts +2 -0
  105. package/dist/safety/redaction.d.ts.map +1 -0
  106. package/dist/safety/redaction.js +9 -0
  107. package/dist/safety/redaction.js.map +1 -0
  108. package/dist/server.d.ts +54 -0
  109. package/dist/server.d.ts.map +1 -0
  110. package/dist/server.js +69 -0
  111. package/dist/server.js.map +1 -0
  112. package/dist/tools/app-knowledge.tool.d.ts +4 -0
  113. package/dist/tools/app-knowledge.tool.d.ts.map +1 -0
  114. package/dist/tools/app-knowledge.tool.js +30 -0
  115. package/dist/tools/app-knowledge.tool.js.map +1 -0
  116. package/dist/tools/composio.tool.d.ts +15 -0
  117. package/dist/tools/composio.tool.d.ts.map +1 -0
  118. package/dist/tools/composio.tool.js +272 -0
  119. package/dist/tools/composio.tool.js.map +1 -0
  120. package/dist/tools/docs-fetch.tool.d.ts +6 -0
  121. package/dist/tools/docs-fetch.tool.d.ts.map +1 -0
  122. package/dist/tools/docs-fetch.tool.js +62 -0
  123. package/dist/tools/docs-fetch.tool.js.map +1 -0
  124. package/dist/tools/docs-search.tool.d.ts +4 -0
  125. package/dist/tools/docs-search.tool.d.ts.map +1 -0
  126. package/dist/tools/docs-search.tool.js +14 -0
  127. package/dist/tools/docs-search.tool.js.map +1 -0
  128. package/dist/tools/image-generate.tool.d.ts +22 -0
  129. package/dist/tools/image-generate.tool.d.ts.map +1 -0
  130. package/dist/tools/image-generate.tool.js +113 -0
  131. package/dist/tools/image-generate.tool.js.map +1 -0
  132. package/dist/tools/memory.tool.d.ts +18 -0
  133. package/dist/tools/memory.tool.d.ts.map +1 -0
  134. package/dist/tools/memory.tool.js +53 -0
  135. package/dist/tools/memory.tool.js.map +1 -0
  136. package/dist/tools/post-generate.tool.d.ts +5 -0
  137. package/dist/tools/post-generate.tool.d.ts.map +1 -0
  138. package/dist/tools/post-generate.tool.js +19 -0
  139. package/dist/tools/post-generate.tool.js.map +1 -0
  140. package/dist/tools/scratchpad.tool.d.ts +7 -0
  141. package/dist/tools/scratchpad.tool.d.ts.map +1 -0
  142. package/dist/tools/scratchpad.tool.js +29 -0
  143. package/dist/tools/scratchpad.tool.js.map +1 -0
  144. package/dist/tools/triggers.tool.d.ts +72 -0
  145. package/dist/tools/triggers.tool.d.ts.map +1 -0
  146. package/dist/tools/triggers.tool.js +108 -0
  147. package/dist/tools/triggers.tool.js.map +1 -0
  148. package/dist/tools/web-search.tool.d.ts +94 -0
  149. package/dist/tools/web-search.tool.d.ts.map +1 -0
  150. package/dist/tools/web-search.tool.js +214 -0
  151. package/dist/tools/web-search.tool.js.map +1 -0
  152. package/dist/tools/zilo-docs.tool.d.ts +26 -0
  153. package/dist/tools/zilo-docs.tool.d.ts.map +1 -0
  154. package/dist/tools/zilo-docs.tool.js +150 -0
  155. package/dist/tools/zilo-docs.tool.js.map +1 -0
  156. package/install.ps1 +62 -0
  157. package/package.json +88 -0
  158. package/src/doc/README.md +49 -0
  159. package/src/doc/admin-tools-and-sms-campaigns.md +99 -0
  160. package/src/doc/escalation-checklist.md +97 -0
  161. package/src/doc/payments-and-payouts.md +82 -0
  162. package/src/doc/shift-lifecycle-and-disputes.md +95 -0
  163. package/src/doc/support-macros.md +40 -0
  164. package/src/doc/venue-support-playbook.md +145 -0
  165. package/src/doc/verification-and-trust.md +88 -0
  166. package/src/doc/worker-support-playbook.md +160 -0
@@ -0,0 +1,150 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { tool } from 'ai';
5
+ import { z } from 'zod';
6
+ import { clampText } from '../safety/limits.js';
7
+ import { emitProgress } from '../runtime/progress.js';
8
+ const projectRoot = path.resolve(fileURLToPath(new URL('../..', import.meta.url)));
9
+ const docsRoot = path.join(projectRoot, 'src', 'doc');
10
+ const ziloDocs = [
11
+ {
12
+ key: 'readme',
13
+ filename: 'README.md',
14
+ title: 'ZiloShift Support Docs Overview',
15
+ description: 'Core support principles, triage questions, risk warnings, and how to use the playbooks.',
16
+ },
17
+ {
18
+ key: 'worker-support-playbook',
19
+ filename: 'worker-support-playbook.md',
20
+ title: 'Worker Support Playbook',
21
+ description: 'Worker onboarding, shift discovery, applications, attendance, payouts, profile, and tone guidance.',
22
+ },
23
+ {
24
+ key: 'venue-support-playbook',
25
+ filename: 'venue-support-playbook.md',
26
+ title: 'Venue Support Playbook',
27
+ description: 'Venue setup, billing, posting, applicants, trust signals, completion, and account support.',
28
+ },
29
+ {
30
+ key: 'payments-and-payouts',
31
+ filename: 'payments-and-payouts.md',
32
+ title: 'Payments and Payouts',
33
+ description: 'Market payment providers, venue billing, worker payouts, profile promotion, refunds, and disputes.',
34
+ },
35
+ {
36
+ key: 'verification-and-trust',
37
+ filename: 'verification-and-trust.md',
38
+ title: 'Verification and Trust',
39
+ description: 'Worker, venue, Ghana owner, business, payout, and support verification guidance.',
40
+ },
41
+ {
42
+ key: 'shift-lifecycle-and-disputes',
43
+ filename: 'shift-lifecycle-and-disputes.md',
44
+ title: 'Shift Lifecycle and Disputes',
45
+ description: 'Shift posting, applying, accepting, clocking, completion, disputes, and escalation guidance.',
46
+ },
47
+ {
48
+ key: 'admin-tools-and-sms-campaigns',
49
+ filename: 'admin-tools-and-sms-campaigns.md',
50
+ title: 'Admin Tools and SMS Campaigns',
51
+ description: 'Admin dashboard, user management, coupons, SMS campaigns, and operational guardrails.',
52
+ },
53
+ {
54
+ key: 'support-macros',
55
+ filename: 'support-macros.md',
56
+ title: 'Support Macros',
57
+ description: 'Reusable replies for workers, venues, payments, verification, disputes, and SMS issues.',
58
+ },
59
+ {
60
+ key: 'escalation-checklist',
61
+ filename: 'escalation-checklist.md',
62
+ title: 'Escalation Checklist',
63
+ description: 'When to escalate support cases and what facts to collect before handing off.',
64
+ },
65
+ ];
66
+ const docsByKey = new Map(ziloDocs.map((doc) => [doc.key, doc]));
67
+ async function readZiloDocContent(key) {
68
+ const doc = docsByKey.get(key);
69
+ if (!doc) {
70
+ const known = ziloDocs.map((item) => item.key).join(', ');
71
+ throw new Error(`Unknown Zilo doc key "${key}". Known keys: ${known}`);
72
+ }
73
+ const filePath = path.join(docsRoot, doc.filename);
74
+ const content = await readFile(filePath, 'utf8');
75
+ return { ...doc, content };
76
+ }
77
+ function normalize(input) {
78
+ return input.toLowerCase().replace(/[^a-z0-9]+/g, ' ').trim();
79
+ }
80
+ function scoreDoc(content, terms) {
81
+ const normalized = normalize(content);
82
+ return terms.reduce((score, term) => score + (normalized.includes(term) ? 1 : 0), 0);
83
+ }
84
+ function createSnippet(content, terms, maxLength = 650) {
85
+ const lower = content.toLowerCase();
86
+ const firstIndex = terms
87
+ .map((term) => lower.indexOf(term.toLowerCase()))
88
+ .filter((index) => index >= 0)
89
+ .sort((a, b) => a - b)[0];
90
+ const start = Math.max(0, (firstIndex ?? 0) - 180);
91
+ const snippet = content.slice(start, start + maxLength).replace(/\s+/g, ' ').trim();
92
+ return start > 0 ? `...${snippet}` : snippet;
93
+ }
94
+ export const ziloDocsTools = {
95
+ listZiloDocs: tool({
96
+ description: 'List local ZiloShift support/product documentation available for on-demand reading.',
97
+ inputSchema: z.object({}),
98
+ execute: async () => {
99
+ emitProgress({ type: 'tool:start', label: 'Listing Zilo docs' });
100
+ const docs = ziloDocs.map(({ key, title, description }) => ({ key, title, description }));
101
+ emitProgress({ type: 'tool:end', label: 'Zilo docs listed', detail: `${docs.length} document${docs.length === 1 ? '' : 's'}` });
102
+ return docs;
103
+ },
104
+ }),
105
+ readZiloDoc: tool({
106
+ description: 'Read one allowlisted local ZiloShift support/product doc by key. Use this after listZiloDocs or searchZiloDocs.',
107
+ inputSchema: z.object({
108
+ key: z.string().min(2),
109
+ maxChars: z.number().int().min(500).max(12000).optional(),
110
+ }),
111
+ execute: async ({ key, maxChars }) => {
112
+ emitProgress({ type: 'fetch:start', label: 'Reading Zilo doc', detail: key });
113
+ const doc = await readZiloDocContent(key);
114
+ emitProgress({ type: 'fetch:end', label: 'Zilo doc ready', detail: doc.title });
115
+ return {
116
+ key: doc.key,
117
+ title: doc.title,
118
+ description: doc.description,
119
+ content: clampText(doc.content, maxChars ?? 6000),
120
+ };
121
+ },
122
+ }),
123
+ searchZiloDocs: tool({
124
+ description: 'Search local ZiloShift docs and return compact snippets. Prefer this before web search for ZiloShift product behavior.',
125
+ inputSchema: z.object({
126
+ query: z.string().min(2),
127
+ maxResults: z.number().int().min(1).max(8).optional(),
128
+ }),
129
+ execute: async ({ query, maxResults }) => {
130
+ emitProgress({ type: 'search:start', label: 'Searching Zilo docs', detail: query });
131
+ const terms = normalize(query).split(' ').filter((term) => term.length > 2);
132
+ const docs = await Promise.all(ziloDocs.map((doc) => readZiloDocContent(doc.key)));
133
+ const results = docs
134
+ .map((doc) => ({
135
+ key: doc.key,
136
+ title: doc.title,
137
+ description: doc.description,
138
+ score: scoreDoc(`${doc.title}\n${doc.description}\n${doc.content}`, terms),
139
+ snippet: createSnippet(doc.content, terms),
140
+ }))
141
+ .filter((doc) => doc.score > 0)
142
+ .sort((a, b) => b.score - a.score)
143
+ .slice(0, maxResults ?? 5)
144
+ .map(({ key, title, description, snippet }) => ({ key, title, description, snippet }));
145
+ emitProgress({ type: 'search:end', label: 'Zilo docs search complete', detail: `${results.length} match${results.length === 1 ? '' : 'es'}` });
146
+ return results;
147
+ },
148
+ }),
149
+ };
150
+ //# sourceMappingURL=zilo-docs.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zilo-docs.tool.js","sourceRoot":"","sources":["../../src/tools/zilo-docs.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACnF,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAStD,MAAM,QAAQ,GAAG;IACf;QACE,GAAG,EAAE,QAAQ;QACb,QAAQ,EAAE,WAAW;QACrB,KAAK,EAAE,iCAAiC;QACxC,WAAW,EAAE,yFAAyF;KACvG;IACD;QACE,GAAG,EAAE,yBAAyB;QAC9B,QAAQ,EAAE,4BAA4B;QACtC,KAAK,EAAE,yBAAyB;QAChC,WAAW,EAAE,oGAAoG;KAClH;IACD;QACE,GAAG,EAAE,wBAAwB;QAC7B,QAAQ,EAAE,2BAA2B;QACrC,KAAK,EAAE,wBAAwB;QAC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AI,EAAE,YAAY,EAAE,KAAK,EAAE,2BAA2B,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,SAAS,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC/I,OAAO,OAAO,CAAC;QACjB,CAAC;KACF,CAAC;CACH,CAAC"}
package/install.ps1 ADDED
@@ -0,0 +1,62 @@
1
+ param(
2
+ [ValidateSet("github", "npm")]
3
+ [string]$Source = "github",
4
+ [string]$GitHubPackage = "github:zester4/zilo-manager",
5
+ [string]$NpmPackage = "zilmate",
6
+ [switch]$NoSetup,
7
+ [switch]$NoPing,
8
+ [switch]$NoTalk
9
+ )
10
+
11
+ $ErrorActionPreference = "Stop"
12
+
13
+ function Require-Command($Name, $InstallHint) {
14
+ if (-not (Get-Command $Name -ErrorAction SilentlyContinue)) {
15
+ throw "$Name is required. $InstallHint"
16
+ }
17
+ }
18
+
19
+ function Invoke-Step($Label, $Command) {
20
+ Write-Host "`n$Label" -ForegroundColor Cyan
21
+ $program = $Command[0]
22
+ $arguments = @($Command | Select-Object -Skip 1)
23
+ & $program @arguments
24
+ if ($LASTEXITCODE -ne 0) {
25
+ throw "Command failed: $($Command -join ' ')"
26
+ }
27
+ }
28
+
29
+ Require-Command "node" "Install Node.js LTS from https://nodejs.org/."
30
+ Require-Command "npm" "Install Node.js LTS from https://nodejs.org/."
31
+
32
+ $target = if ($Source -eq "npm") { $NpmPackage } else { $GitHubPackage }
33
+ Write-Host "Installing ZilMate from $target ..." -ForegroundColor Cyan
34
+ npm install -g $target
35
+ if ($LASTEXITCODE -ne 0) {
36
+ throw "ZilMate install failed."
37
+ }
38
+
39
+ Write-Host "`nZilMate installed. Checking command..." -ForegroundColor Green
40
+ zilmate --help
41
+ if ($LASTEXITCODE -ne 0) {
42
+ throw "ZilMate command check failed."
43
+ }
44
+
45
+ if (-not $NoSetup) {
46
+ Invoke-Step "Starting ZilMate setup..." @("zilmate", "setup")
47
+ } else {
48
+ Write-Host "`nRun 'zilmate setup' later to create your .env file." -ForegroundColor Yellow
49
+ }
50
+
51
+ if (-not $NoPing) {
52
+ Invoke-Step "Verifying AI Gateway with zilmate ping..." @("zilmate", "ping")
53
+ } else {
54
+ Write-Host "`nSkipping ping. Run 'zilmate ping' later to verify your key." -ForegroundColor Yellow
55
+ }
56
+
57
+ if (-not $NoTalk) {
58
+ Write-Host "`nStarting ZilMate talk. Type /exit to quit." -ForegroundColor Green
59
+ zilmate talk
60
+ } else {
61
+ Write-Host "`nRun 'zilmate talk' when you are ready." -ForegroundColor Yellow
62
+ }
package/package.json ADDED
@@ -0,0 +1,88 @@
1
+ {
2
+ "name": "zilmate",
3
+ "version": "1.0.0",
4
+ "description": "ZilMate CLI multi-agent assistant for ZiloShift workflows.",
5
+ "type": "module",
6
+ "main": "dist/server.js",
7
+ "types": "dist/server.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/server.d.ts",
11
+ "import": "./dist/server.js"
12
+ },
13
+ "./server": {
14
+ "types": "./dist/server.d.ts",
15
+ "import": "./dist/server.js"
16
+ },
17
+ "./cli": {
18
+ "types": "./dist/index.d.ts",
19
+ "import": "./dist/index.js"
20
+ }
21
+ },
22
+ "scripts": {
23
+ "build": "tsc",
24
+ "cli": "tsx src/index.ts",
25
+ "zilmate": "tsx src/index.ts",
26
+ "talk": "tsx src/index.ts talk",
27
+ "start": "node dist/index.js",
28
+ "models": "tsx src/index.ts models",
29
+ "doctor": "tsx src/index.ts doctor",
30
+ "config": "tsx src/index.ts config",
31
+ "memory": "tsx src/index.ts memory",
32
+ "triggers": "tsx src/index.ts triggers",
33
+ "test": "npm run build",
34
+ "prepare": "npm run build",
35
+ "pack:dry": "npm pack --dry-run",
36
+ "prepublishOnly": "npm run build"
37
+ },
38
+ "keywords": [
39
+ "ziloshift",
40
+ "zilmate",
41
+ "agents",
42
+ "ai-sdk",
43
+ "vercel-ai-gateway",
44
+ "cli"
45
+ ],
46
+ "author": "",
47
+ "license": "ISC",
48
+ "dependencies": {
49
+ "@composio/core": "^0.10.0",
50
+ "@composio/vercel": "^0.9.2",
51
+ "@tavily/core": "^0.7.5",
52
+ "@upstash/redis": "^1.38.0",
53
+ "ai": "^6.0.198",
54
+ "chalk": "^5.6.2",
55
+ "commander": "^15.0.0",
56
+ "dotenv": "^17.4.2",
57
+ "marked": "^15.0.12",
58
+ "marked-terminal": "^7.3.0",
59
+ "tsx": "^4.22.4",
60
+ "zod": "^4.4.3"
61
+ },
62
+ "devDependencies": {
63
+ "@types/node": "^25.9.2",
64
+ "typescript": "^6.0.3"
65
+ },
66
+ "bin": {
67
+ "zilmate": "dist/index.js"
68
+ },
69
+ "files": [
70
+ "dist",
71
+ "src/doc",
72
+ "agent-docs.md",
73
+ "README.md",
74
+ ".env.example",
75
+ "install.ps1"
76
+ ],
77
+ "repository": {
78
+ "type": "git",
79
+ "url": "git+https://github.com/zester4/zilo-manager.git"
80
+ },
81
+ "bugs": {
82
+ "url": "https://github.com/zester4/zilo-manager/issues"
83
+ },
84
+ "homepage": "https://github.com/zester4/zilo-manager#readme",
85
+ "engines": {
86
+ "node": ">=20.0.0"
87
+ }
88
+ }
@@ -0,0 +1,49 @@
1
+ # ZiloShift Support Training Docs
2
+
3
+ These docs train support staff to help workers and venues use ZiloShift confidently, safely, and consistently.
4
+
5
+ ## Who These Docs Are For
6
+
7
+ - Customer support agents helping workers and venues.
8
+ - Operations staff reviewing verification, payments, disputes, and shift issues.
9
+ - Admin users handling SMS campaigns, account questions, and escalation.
10
+
11
+ ## Core Support Principles
12
+
13
+ 1. Protect user safety and money first.
14
+ 2. Verify the account, role, country, and shift before giving specific advice.
15
+ 3. Do not ask users to share passwords, full card details, full ID numbers, or private API keys.
16
+ 4. Explain next steps clearly and avoid blaming the user.
17
+ 5. Escalate when money, identity, fraud, safety, legal, or platform bugs are involved.
18
+
19
+ ## Platform Overview
20
+
21
+ ZiloShift connects workers with venues that need shift cover. Workers create profiles, verify identity, add roles/certifications, browse shifts in their city, apply, get accepted, clock in/out, message venues, and receive payouts. Venues verify their business, connect payment/billing, post shifts, review applicants, accept workers, coordinate through messages, and confirm completion.
22
+
23
+ ## Support Areas
24
+
25
+ - [Worker Support Playbook](./worker-support-playbook.md)
26
+ - [Venue Support Playbook](./venue-support-playbook.md)
27
+ - [Verification And Trust](./verification-and-trust.md)
28
+ - [Payments And Payouts](./payments-and-payouts.md)
29
+ - [Shift Lifecycle And Disputes](./shift-lifecycle-and-disputes.md)
30
+ - [Admin Tools And SMS Campaigns](./admin-tools-and-sms-campaigns.md)
31
+ - [Support Macros](./support-macros.md)
32
+ - [Escalation Checklist](./escalation-checklist.md)
33
+
34
+ ## Quick Triage Questions
35
+
36
+ Ask these before troubleshooting:
37
+
38
+ 1. Are you a worker or venue?
39
+ 2. What country are you in?
40
+ 3. What email or phone number is on the account?
41
+ 4. What page were you on when the issue happened?
42
+ 5. If it is about a shift, what is the role, date, venue/company, and city?
43
+ 6. If it is about payment, what provider was shown: Hubtel, Paystack, Razorpay, Stripe, or bank/card?
44
+ 7. What exact error message did you see?
45
+
46
+ ## Risk Warning
47
+
48
+ Do not manually override identity verification, payment status, payout destination, worker reliability, cancellation penalties, or dispute outcomes unless an authorized admin or engineering escalation confirms it.
49
+
@@ -0,0 +1,99 @@
1
+ # Admin Tools And SMS Campaigns
2
+
3
+ This guide trains admins to use campaign tools, verification queues, user management, shifts, payments, and disputes.
4
+
5
+ ## Admin SMS Campaigns
6
+
7
+ SMS campaigns are for Ghana users through Hubtel SMS.
8
+
9
+ Supported audiences:
10
+
11
+ - Workers.
12
+ - Venues.
13
+ - Both workers and venues.
14
+
15
+ The campaign tool should:
16
+
17
+ 1. Let admin choose audience.
18
+ 2. Preview real recipients.
19
+ 3. Show skipped users missing phone numbers.
20
+ 4. Send a test SMS before bulk sending.
21
+ 5. Send personalized batch SMS through Hubtel.
22
+ 6. Save campaign logs in `sms_campaigns`.
23
+
24
+ ## Hubtel SMS Contract
25
+
26
+ The gateway follows Hubtel SMS docs:
27
+
28
+ - Single test SMS: `POST /v1/messages/send`.
29
+ - Personalized batch SMS: `POST /v1/messages/batch/personalized/send`.
30
+ - Basic Auth is built from SMS credentials.
31
+ - Sender ID max length is 11 characters.
32
+
33
+ Supported variables:
34
+
35
+ - `{{first_name}}`
36
+ - `{{last_name}}`
37
+ - `{{name}}`
38
+ - `{{company_name}}`
39
+ - `{{account_type}}`
40
+ - `{{city}}`
41
+ - `{{town}}`
42
+
43
+ ## SMS Troubleshooting
44
+
45
+ If test SMS returns 400:
46
+
47
+ - Check Hubtel error details.
48
+ - Check phone format normalizes to `233...`.
49
+ - Check sender ID is 11 characters or less.
50
+ - Check message length is not too long.
51
+ - Check SMS account credit.
52
+ - Check if recipient is blacklisted.
53
+ - Check SMS credentials.
54
+
55
+ If no workers appear:
56
+
57
+ - Check Ghana workers have profile phone numbers.
58
+ - Workers without phone numbers are skipped.
59
+
60
+ If venues appear but workers do not:
61
+
62
+ - Venue phone may exist on `venues.phone`.
63
+ - Worker phone must exist on `profiles.phone`.
64
+
65
+ ## Admin Verification Page
66
+
67
+ Admins can review identity and business verification.
68
+
69
+ Do not approve:
70
+
71
+ - Mismatched names.
72
+ - Blurry IDs.
73
+ - Missing liveness.
74
+ - Suspicious duplicate accounts.
75
+
76
+ ## Admin Payments Page
77
+
78
+ Admins should use this for:
79
+
80
+ - Captured payments.
81
+ - Payout status.
82
+ - Failed provider responses.
83
+ - Refund checks.
84
+
85
+ Never expose secret keys in admin notes or user replies.
86
+
87
+ ## Admin Disputes Page
88
+
89
+ Admins should review:
90
+
91
+ - Worker/venue claims.
92
+ - Shift status.
93
+ - Clock-in/out.
94
+ - Messages.
95
+ - Payment status.
96
+ - Reliability/no-show history.
97
+
98
+ Keep notes factual and timestamped.
99
+
@@ -0,0 +1,97 @@
1
+ # Escalation Checklist
2
+
3
+ Use this checklist before escalating to engineering, operations, compliance, or payments.
4
+
5
+ ## Required Information
6
+
7
+ - User type: worker or venue.
8
+ - User email or phone.
9
+ - Country.
10
+ - City/town.
11
+ - Page or feature.
12
+ - Exact error message.
13
+ - Time and date of issue.
14
+ - Browser/device if relevant.
15
+ - Screenshots if available.
16
+
17
+ ## Shift Escalation
18
+
19
+ Include:
20
+
21
+ - Shift role.
22
+ - Shift date/time.
23
+ - Venue/company name.
24
+ - Worker name.
25
+ - Application status.
26
+ - Shift status.
27
+ - Clock-in/out records.
28
+ - Payment ID if available.
29
+
30
+ ## Verification Escalation
31
+
32
+ Include:
33
+
34
+ - Country.
35
+ - Verification provider: Ghana/Hubtel or Didit.
36
+ - Current status.
37
+ - Whether front/back/liveness completed.
38
+ - Whether account name matches ID name.
39
+ - Any rejection reason.
40
+
41
+ Do not include full ID number in normal support tickets.
42
+
43
+ ## Payment Escalation
44
+
45
+ Include:
46
+
47
+ - Provider: Hubtel, Paystack, Razorpay, Stripe.
48
+ - Amount and currency.
49
+ - Reference/checkout ID/payment ID.
50
+ - User ID.
51
+ - Shift ID if related.
52
+ - Provider response.
53
+ - Whether money was captured, pending, failed, refunded, or paid out.
54
+
55
+ ## SMS Escalation
56
+
57
+ Include:
58
+
59
+ - Audience: workers, venues, or both.
60
+ - Test or batch.
61
+ - Sender ID.
62
+ - Normalized phone number.
63
+ - Hubtel response details.
64
+ - Gateway PM2 log line.
65
+ - Whether account has SMS credit.
66
+
67
+ ## Fraud Or Abuse Escalation
68
+
69
+ Escalate immediately if:
70
+
71
+ - Duplicate accounts suspected.
72
+ - Same ID used by multiple accounts.
73
+ - Same payout account used by multiple unrelated workers.
74
+ - Referral farming suspected.
75
+ - Worker changes name around verification.
76
+ - Venue asks users to pay off-platform.
77
+ - Harassment, threats, unsafe venue, or unsafe worker behavior reported.
78
+
79
+ ## Engineering Escalation Format
80
+
81
+ Use this format:
82
+
83
+ ```text
84
+ Issue:
85
+ User type:
86
+ Country/city:
87
+ User ID/email:
88
+ Shift ID/payment ID:
89
+ Expected behavior:
90
+ Actual behavior:
91
+ Exact error:
92
+ Steps to reproduce:
93
+ Logs/response:
94
+ Impact:
95
+ Urgency:
96
+ ```
97
+
@@ -0,0 +1,82 @@
1
+ # Payments And Payouts
2
+
3
+ Use this guide to support billing setup, shift payment, worker payout, profile promotion, and country-specific payment rails.
4
+
5
+ ## Payment Provider By Market
6
+
7
+ - Ghana: Hubtel for checkout, SMS, worker payout, and Ghana-specific flows.
8
+ - Nigeria, Kenya, South Africa: Paystack where configured.
9
+ - India: Razorpay.
10
+ - UK, US, and other markets: Stripe where configured.
11
+
12
+ ## Venue Billing
13
+
14
+ Venues may need to connect billing before posting or paying for shifts.
15
+
16
+ Ghana venue billing:
17
+
18
+ - Uses Hubtel gateway `/api/checkout/initiate`.
19
+ - Requires gateway `SUPABASE_SERVICE_ROLE_KEY` to be a real service_role key.
20
+ - Requires Hubtel checkout credentials and account number.
21
+ - Writes checkout/payment state into `payments`.
22
+
23
+ Common errors:
24
+
25
+ - `SUPABASE_SERVICE_ROLE_KEY must have role service_role, not anon`: gateway env uses anon key. Replace with Supabase service role key and restart PM2.
26
+ - `Could not find worker_amount column`: live `payments` schema missing compatibility column. Add column and reload schema.
27
+ - Upstream 500: check gateway PM2 logs and Hubtel response body.
28
+
29
+ ## Worker Payout
30
+
31
+ Workers must have valid payout details before payout can complete.
32
+
33
+ Ghana worker payout:
34
+
35
+ - Mobile money or bank details.
36
+ - Phone/account name should be verified where possible.
37
+ - Hubtel sends money or bank transfer through gateway.
38
+
39
+ Other markets:
40
+
41
+ - Paystack recipients/subaccounts for supported African countries.
42
+ - Razorpay fund accounts for India.
43
+ - Stripe Connect for Stripe markets.
44
+
45
+ ## Profile Promotion
46
+
47
+ Workers can pay to promote their profile for 7 days.
48
+
49
+ Provider routing:
50
+
51
+ - Ghana: Hubtel checkout.
52
+ - Paystack countries: Paystack checkout.
53
+ - India: Razorpay checkout.
54
+ - Other markets: Stripe checkout.
55
+
56
+ If profile promotion payment succeeds but profile is not promoted:
57
+
58
+ - Check payment verification function for the provider.
59
+ - Check `profile_promotions`.
60
+ - Check `workers.promoted_until`.
61
+ - Escalate if provider captured payment but app did not update.
62
+
63
+ ## Refunds And Disputes
64
+
65
+ Do not promise refunds until status is confirmed.
66
+
67
+ Escalate when:
68
+
69
+ - Worker no-show.
70
+ - Venue cancels after worker acceptance.
71
+ - Worker cancels after acceptance.
72
+ - Payment captured but shift canceled.
73
+ - Duplicate charge.
74
+ - Wrong amount.
75
+
76
+ ## Payment Safety Rules
77
+
78
+ - Never ask users for full card numbers.
79
+ - Never share service_role keys, API keys, Basic Auth tokens, or gateway tokens.
80
+ - Never manually mark payment captured without provider evidence.
81
+ - Always record provider, reference, amount, currency, and user ID in escalations.
82
+