@hailer/mcp 1.1.12 → 1.1.13
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/CHANGELOG.md +0 -7
- package/{.claude → dist}/CLAUDE.md +2 -2
- package/dist/app.js +18 -5
- package/dist/bot/bot-config.d.ts +10 -1
- package/dist/bot/bot-config.js +64 -3
- package/dist/bot/bot-manager.d.ts +2 -0
- package/dist/bot/bot-manager.js +9 -2
- package/dist/bot/bot.d.ts +33 -0
- package/dist/bot/bot.js +461 -160
- package/dist/bot/services/message-classifier.js +17 -0
- package/dist/bot/services/permission-guard.d.ts +52 -0
- package/dist/bot/services/permission-guard.js +149 -0
- package/dist/bot/services/types.d.ts +5 -0
- package/dist/bot/services/typing-indicator.d.ts +6 -1
- package/dist/bot/services/typing-indicator.js +19 -3
- package/dist/cli.js +0 -0
- package/dist/config.d.ts +6 -1
- package/dist/config.js +43 -0
- package/dist/core.js +3 -6
- package/dist/lib/discussion-lock.d.ts +42 -0
- package/dist/lib/discussion-lock.js +110 -0
- package/dist/mcp/UserContextCache.d.ts +5 -0
- package/dist/mcp/UserContextCache.js +51 -19
- package/dist/mcp/hailer-clients.d.ts +19 -1
- package/dist/mcp/hailer-clients.js +158 -24
- package/dist/mcp/session-store.d.ts +68 -0
- package/dist/mcp/session-store.js +169 -0
- package/dist/mcp/signal-handler.js +2 -0
- package/dist/mcp/tool-registry.d.ts +17 -4
- package/dist/mcp/tool-registry.js +37 -7
- package/dist/mcp/tools/activity.js +99 -7
- package/dist/mcp/tools/app-scaffold.js +304 -336
- package/dist/mcp/tools/bot-config/constants.d.ts +23 -0
- package/dist/mcp/tools/bot-config/constants.js +94 -0
- package/dist/mcp/tools/bot-config/core.d.ts +253 -0
- package/dist/mcp/tools/bot-config/core.js +2456 -0
- package/dist/mcp/tools/bot-config/index.d.ts +10 -0
- package/dist/mcp/tools/bot-config/index.js +59 -0
- package/dist/mcp/tools/bot-config/tools.d.ts +7 -0
- package/dist/mcp/tools/bot-config/tools.js +15 -0
- package/dist/mcp/tools/bot-config/types.d.ts +50 -0
- package/dist/mcp/tools/bot-config/types.js +6 -0
- package/dist/mcp/tools/bug-fixer-tools.d.ts +45 -0
- package/dist/mcp/tools/bug-fixer-tools.js +1096 -0
- package/dist/mcp/tools/company.d.ts +9 -0
- package/dist/mcp/tools/company.js +88 -0
- package/dist/mcp/tools/discussion.js +68 -0
- package/dist/mcp/tools/document.d.ts +11 -0
- package/dist/mcp/tools/document.js +741 -0
- package/dist/mcp/tools/investigate.d.ts +9 -0
- package/dist/mcp/tools/investigate.js +254 -0
- package/dist/mcp/tools/workflow-permissions.d.ts +15 -0
- package/dist/mcp/tools/workflow-permissions.js +204 -0
- package/dist/mcp/tools/workflow.js +57 -18
- package/dist/mcp/utils/index.d.ts +2 -0
- package/dist/mcp/utils/index.js +12 -1
- package/dist/mcp/utils/role-utils.d.ts +74 -0
- package/dist/mcp/utils/role-utils.js +151 -0
- package/dist/mcp/utils/types.d.ts +43 -1
- package/dist/mcp/utils/types.js +14 -0
- package/dist/mcp/webhook-handler.d.ts +4 -0
- package/dist/mcp/webhook-handler.js +8 -0
- package/dist/mcp-server.d.ts +23 -2
- package/dist/mcp-server.js +639 -127
- package/dist/plugins/vipunen/client.d.ts +150 -0
- package/dist/plugins/vipunen/client.js +535 -0
- package/dist/plugins/vipunen/config/schema-config.json +19 -0
- package/dist/plugins/vipunen/config/schema-doc.json +22 -0
- package/dist/plugins/vipunen/index.d.ts +41 -0
- package/dist/plugins/vipunen/index.js +88 -0
- package/dist/plugins/vipunen/tools.d.ts +26 -0
- package/dist/plugins/vipunen/tools.js +501 -0
- package/dist/stdio-server.d.ts +14 -0
- package/dist/stdio-server.js +101 -0
- package/package.json +2 -1
- package/.claude/agents/agent-ada-skill-builder.md +0 -94
- package/.claude/agents/agent-alejandro-function-fields.md +0 -342
- package/.claude/agents/agent-bjorn-config-audit.md +0 -103
- package/.claude/agents/agent-builder-agent-creator.md +0 -130
- package/.claude/agents/agent-code-simplifier.md +0 -53
- package/.claude/agents/agent-dmitri-activity-crud.md +0 -159
- package/.claude/agents/agent-giuseppe-app-builder.md +0 -247
- package/.claude/agents/agent-gunther-mcp-tools.md +0 -39
- package/.claude/agents/agent-helga-workflow-config.md +0 -204
- package/.claude/agents/agent-igor-activity-mover-automation.md +0 -125
- package/.claude/agents/agent-ingrid-doc-templates.md +0 -261
- package/.claude/agents/agent-ivan-monolith.md +0 -154
- package/.claude/agents/agent-kenji-data-reader.md +0 -86
- package/.claude/agents/agent-lars-code-inspector.md +0 -102
- package/.claude/agents/agent-marco-mockup-builder.md +0 -110
- package/.claude/agents/agent-marcus-api-documenter.md +0 -323
- package/.claude/agents/agent-marketplace-publisher.md +0 -280
- package/.claude/agents/agent-marketplace-reviewer.md +0 -309
- package/.claude/agents/agent-permissions-handler.md +0 -208
- package/.claude/agents/agent-simple-writer.md +0 -48
- package/.claude/agents/agent-svetlana-code-review.md +0 -171
- package/.claude/agents/agent-tanya-test-runner.md +0 -333
- package/.claude/agents/agent-ui-designer.md +0 -100
- package/.claude/agents/agent-viktor-sql-insights.md +0 -212
- package/.claude/agents/agent-web-search.md +0 -55
- package/.claude/agents/agent-yevgeni-discussions.md +0 -45
- package/.claude/agents/agent-zara-zapier.md +0 -159
- package/.claude/commands/app-squad.md +0 -135
- package/.claude/commands/audit-squad.md +0 -158
- package/.claude/commands/autoplan.md +0 -563
- package/.claude/commands/cleanup-squad.md +0 -98
- package/.claude/commands/config-squad.md +0 -106
- package/.claude/commands/crud-squad.md +0 -87
- package/.claude/commands/data-squad.md +0 -97
- package/.claude/commands/debug-squad.md +0 -303
- package/.claude/commands/doc-squad.md +0 -65
- package/.claude/commands/handoff.md +0 -137
- package/.claude/commands/health.md +0 -49
- package/.claude/commands/help.md +0 -29
- package/.claude/commands/help:agents.md +0 -151
- package/.claude/commands/help:commands.md +0 -78
- package/.claude/commands/help:faq.md +0 -79
- package/.claude/commands/help:plugins.md +0 -50
- package/.claude/commands/help:skills.md +0 -93
- package/.claude/commands/help:tools.md +0 -75
- package/.claude/commands/hotfix-squad.md +0 -112
- package/.claude/commands/integration-squad.md +0 -82
- package/.claude/commands/janitor-squad.md +0 -167
- package/.claude/commands/learn-auto.md +0 -120
- package/.claude/commands/learn.md +0 -120
- package/.claude/commands/mcp-list.md +0 -27
- package/.claude/commands/onboard-squad.md +0 -140
- package/.claude/commands/plan-workspace.md +0 -732
- package/.claude/commands/prd.md +0 -130
- package/.claude/commands/project-status.md +0 -82
- package/.claude/commands/publish.md +0 -138
- package/.claude/commands/recap.md +0 -69
- package/.claude/commands/restore.md +0 -64
- package/.claude/commands/review-squad.md +0 -152
- package/.claude/commands/save.md +0 -24
- package/.claude/commands/stats.md +0 -19
- package/.claude/commands/swarm.md +0 -210
- package/.claude/commands/tool-builder.md +0 -39
- package/.claude/commands/ws-pull.md +0 -44
- package/.claude/hooks/_shared-memory.cjs +0 -305
- package/.claude/hooks/_utils.cjs +0 -108
- package/.claude/hooks/agent-failure-detector.cjs +0 -383
- package/.claude/hooks/agent-usage-logger.cjs +0 -204
- package/.claude/hooks/app-edit-guard.cjs +0 -494
- package/.claude/hooks/auto-learn.cjs +0 -304
- package/.claude/hooks/bash-guard.cjs +0 -272
- package/.claude/hooks/builder-mode-manager.cjs +0 -354
- package/.claude/hooks/bulk-activity-guard.cjs +0 -271
- package/.claude/hooks/context-watchdog.cjs +0 -230
- package/.claude/hooks/delegation-reminder.cjs +0 -465
- package/.claude/hooks/design-system-lint.cjs +0 -271
- package/.claude/hooks/post-scaffold-hook.cjs +0 -181
- package/.claude/hooks/prompt-guard.cjs +0 -354
- package/.claude/hooks/publish-template-guard.cjs +0 -147
- package/.claude/hooks/session-start.cjs +0 -35
- package/.claude/hooks/shared-memory-writer.cjs +0 -147
- package/.claude/hooks/skill-injector.cjs +0 -140
- package/.claude/hooks/skill-usage-logger.cjs +0 -258
- package/.claude/hooks/src-edit-guard.cjs +0 -240
- package/.claude/hooks/sync-marketplace-agents.cjs +0 -346
- package/.claude/settings.json +0 -257
- package/.claude/skills/SDK-activity-patterns/SKILL.md +0 -428
- package/.claude/skills/SDK-document-templates/SKILL.md +0 -1033
- package/.claude/skills/SDK-function-fields/SKILL.md +0 -542
- package/.claude/skills/SDK-generate-skill/SKILL.md +0 -92
- package/.claude/skills/SDK-init-skill/SKILL.md +0 -127
- package/.claude/skills/SDK-insight-queries/SKILL.md +0 -787
- package/.claude/skills/SDK-ws-config-skill/SKILL.md +0 -1139
- package/.claude/skills/agent-structure/SKILL.md +0 -98
- package/.claude/skills/api-documentation-patterns/SKILL.md +0 -474
- package/.claude/skills/chrome-mcp-reference/SKILL.md +0 -370
- package/.claude/skills/delegation-routing/SKILL.md +0 -202
- package/.claude/skills/frontend-design/SKILL.md +0 -254
- package/.claude/skills/hailer-activity-mover/SKILL.md +0 -213
- package/.claude/skills/hailer-api-client/SKILL.md +0 -518
- package/.claude/skills/hailer-app-builder/SKILL.md +0 -1434
- package/.claude/skills/hailer-apps-pictures/SKILL.md +0 -269
- package/.claude/skills/hailer-design-system/SKILL.md +0 -235
- package/.claude/skills/hailer-monolith-automations/SKILL.md +0 -686
- package/.claude/skills/hailer-permissions-system/SKILL.md +0 -121
- package/.claude/skills/hailer-project-protocol/SKILL.md +0 -488
- package/.claude/skills/hailer-rest-api/SKILL.md +0 -61
- package/.claude/skills/hailer-rest-api/hailer-activities.md +0 -184
- package/.claude/skills/hailer-rest-api/hailer-admin.md +0 -473
- package/.claude/skills/hailer-rest-api/hailer-calendar.md +0 -256
- package/.claude/skills/hailer-rest-api/hailer-feed.md +0 -249
- package/.claude/skills/hailer-rest-api/hailer-insights.md +0 -195
- package/.claude/skills/hailer-rest-api/hailer-messaging.md +0 -276
- package/.claude/skills/hailer-rest-api/hailer-workflows.md +0 -283
- package/.claude/skills/insight-join-patterns/SKILL.md +0 -174
- package/.claude/skills/integration-patterns/SKILL.md +0 -421
- package/.claude/skills/json-only-output/SKILL.md +0 -72
- package/.claude/skills/lsp-setup/SKILL.md +0 -160
- package/.claude/skills/mcp-direct-tools/SKILL.md +0 -153
- package/.claude/skills/optional-parameters/SKILL.md +0 -72
- package/.claude/skills/publish-hailer-app/SKILL.md +0 -244
- package/.claude/skills/testing-patterns/SKILL.md +0 -630
- package/.claude/skills/tool-builder/SKILL.md +0 -250
- package/.claude/skills/tool-parameter-usage/SKILL.md +0 -126
- package/.claude/skills/tool-response-verification/SKILL.md +0 -92
- package/.claude/skills/zapier-hailer-patterns/SKILL.md +0 -581
- package/.mcp.json +0 -13
- package/.opencode/agent/agent-ada-skill-builder.md +0 -35
- package/.opencode/agent/agent-alejandro-function-fields.md +0 -39
- package/.opencode/agent/agent-bjorn-config-audit.md +0 -36
- package/.opencode/agent/agent-builder-agent-creator.md +0 -39
- package/.opencode/agent/agent-code-simplifier.md +0 -31
- package/.opencode/agent/agent-dmitri-activity-crud.md +0 -40
- package/.opencode/agent/agent-giuseppe-app-builder.md +0 -37
- package/.opencode/agent/agent-gunther-mcp-tools.md +0 -39
- package/.opencode/agent/agent-helga-workflow-config.md +0 -203
- package/.opencode/agent/agent-igor-activity-mover-automation.md +0 -46
- package/.opencode/agent/agent-ingrid-doc-templates.md +0 -39
- package/.opencode/agent/agent-ivan-monolith.md +0 -46
- package/.opencode/agent/agent-kenji-data-reader.md +0 -53
- package/.opencode/agent/agent-lars-code-inspector.md +0 -28
- package/.opencode/agent/agent-marco-mockup-builder.md +0 -42
- package/.opencode/agent/agent-marcus-api-documenter.md +0 -53
- package/.opencode/agent/agent-marketplace-publisher.md +0 -44
- package/.opencode/agent/agent-marketplace-reviewer.md +0 -42
- package/.opencode/agent/agent-permissions-handler.md +0 -50
- package/.opencode/agent/agent-simple-writer.md +0 -45
- package/.opencode/agent/agent-svetlana-code-review.md +0 -39
- package/.opencode/agent/agent-tanya-test-runner.md +0 -57
- package/.opencode/agent/agent-ui-designer.md +0 -56
- package/.opencode/agent/agent-viktor-sql-insights.md +0 -34
- package/.opencode/agent/agent-web-search.md +0 -42
- package/.opencode/agent/agent-yevgeni-discussions.md +0 -37
- package/.opencode/agent/agent-zara-zapier.md +0 -53
- package/.opencode/commands/app-squad.md +0 -135
- package/.opencode/commands/audit-squad.md +0 -158
- package/.opencode/commands/autoplan.md +0 -563
- package/.opencode/commands/cleanup-squad.md +0 -98
- package/.opencode/commands/config-squad.md +0 -106
- package/.opencode/commands/crud-squad.md +0 -87
- package/.opencode/commands/data-squad.md +0 -97
- package/.opencode/commands/debug-squad.md +0 -303
- package/.opencode/commands/doc-squad.md +0 -65
- package/.opencode/commands/handoff.md +0 -137
- package/.opencode/commands/health.md +0 -49
- package/.opencode/commands/help-agents.md +0 -151
- package/.opencode/commands/help-commands.md +0 -32
- package/.opencode/commands/help-faq.md +0 -29
- package/.opencode/commands/help-plugins.md +0 -28
- package/.opencode/commands/help-skills.md +0 -7
- package/.opencode/commands/help-tools.md +0 -40
- package/.opencode/commands/help.md +0 -28
- package/.opencode/commands/hotfix-squad.md +0 -112
- package/.opencode/commands/integration-squad.md +0 -82
- package/.opencode/commands/janitor-squad.md +0 -167
- package/.opencode/commands/learn-auto.md +0 -120
- package/.opencode/commands/learn.md +0 -120
- package/.opencode/commands/mcp-list.md +0 -27
- package/.opencode/commands/onboard-squad.md +0 -140
- package/.opencode/commands/plan-workspace.md +0 -732
- package/.opencode/commands/prd.md +0 -131
- package/.opencode/commands/project-status.md +0 -82
- package/.opencode/commands/publish.md +0 -138
- package/.opencode/commands/recap.md +0 -69
- package/.opencode/commands/restore.md +0 -64
- package/.opencode/commands/review-squad.md +0 -152
- package/.opencode/commands/save.md +0 -24
- package/.opencode/commands/stats.md +0 -19
- package/.opencode/commands/swarm.md +0 -210
- package/.opencode/commands/tool-builder.md +0 -39
- package/.opencode/commands/ws-pull.md +0 -44
- package/.opencode/opencode.json +0 -28
- package/SESSION-HANDOFF.md +0 -68
- package/inbox/2026-03-04-bot-config-patterns.md +0 -24
- package/scripts/postinstall.cjs +0 -64
- package/scripts/test-hal-tools.ts +0 -154
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Orchestrator-driven parallel swarm for large-scale tasks
|
|
3
|
-
argument-hint: "description of what to do across many items"
|
|
4
|
-
allowed-tools: Task, Bash, Read, Glob
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Swarm
|
|
8
|
-
|
|
9
|
-
Orchestrator-driven parallel execution: analyze the task, discover work items, pick agents, split into chunks, dispatch workers, aggregate results.
|
|
10
|
-
|
|
11
|
-
**Goal:** $ARGUMENTS
|
|
12
|
-
|
|
13
|
-
## Protocol
|
|
14
|
-
|
|
15
|
-
### Step 1: Analyze the Task
|
|
16
|
-
|
|
17
|
-
Read `$ARGUMENTS` and determine:
|
|
18
|
-
|
|
19
|
-
- **What needs to be done?** (review, edit, check, migrate, update, clean up)
|
|
20
|
-
- **What are the work items?** (files, activities, workflows, agents, skills, configs)
|
|
21
|
-
- **What scope?** (explicit path/glob from user, or infer from task description)
|
|
22
|
-
|
|
23
|
-
If the scope is unclear, use Glob or Bash to discover items:
|
|
24
|
-
|
|
25
|
-
```
|
|
26
|
-
# Files
|
|
27
|
-
Glob("src/**/*.ts")
|
|
28
|
-
Glob(".claude/agents/*.md")
|
|
29
|
-
Glob("workspace/*/fields.ts")
|
|
30
|
-
|
|
31
|
-
# Activities (use Kenji to count/list)
|
|
32
|
-
Task(subagent_type="agent-kenji-data-reader", prompt="Count and list activity IDs for [workflow]")
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
If fewer than 5 items are discovered, **abort swarm** and suggest running a regular squad or single agent instead. Swarm is for scale.
|
|
36
|
-
|
|
37
|
-
### Step 2: Pick Agent(s)
|
|
38
|
-
|
|
39
|
-
Based on the task type, select the right agent(s):
|
|
40
|
-
|
|
41
|
-
| Task Type | Agent | Examples |
|
|
42
|
-
|-----------|-------|---------|
|
|
43
|
-
| Code review, security audit | **Svetlana** | "review for bugs", "security check", "find vulnerabilities" |
|
|
44
|
-
| Dead code, unused imports, type errors | **Lars** | "find dead code", "check types", "unused imports" |
|
|
45
|
-
| Small edits, string replacements, rule additions | **Simple Writer** | "add header to each file", "replace X with Y", "update rule" |
|
|
46
|
-
| Code cleanup, simplification | **Code Simplifier** | "clean up", "simplify", "refactor for clarity" |
|
|
47
|
-
| Config audit, structure validation | **Bjorn** | "check config", "validate structure", "audit settings" |
|
|
48
|
-
| Data state checks, field validation | **Kenji** | "check all activities", "verify field values", "find missing data" |
|
|
49
|
-
| Query patterns, data analysis | **Viktor** | "analyze patterns", "find anomalies across workflows" |
|
|
50
|
-
| Activity updates, bulk mutations | **Dmitri** | "update all activities", "move to phase", "set field values" |
|
|
51
|
-
|
|
52
|
-
**Multi-agent swarms:** If the task spans multiple domains, assign different agent types to different items. For example, "clean up the project" might use Lars for `.ts` files, Bjorn for config files, and Code Simplifier for app components.
|
|
53
|
-
|
|
54
|
-
### Step 3: Calculate Workers
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
items_count = total discovered items
|
|
58
|
-
items_per_worker = 10 (default)
|
|
59
|
-
max_workers = 5
|
|
60
|
-
|
|
61
|
-
worker_count = min(ceil(items_count / items_per_worker), max_workers)
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
Split items into `worker_count` chunks. Try to keep chunks roughly equal size.
|
|
65
|
-
|
|
66
|
-
For multi-agent swarms, group items by agent type first, then chunk within each type.
|
|
67
|
-
|
|
68
|
-
### Step 4: Dispatch Workers
|
|
69
|
-
|
|
70
|
-
Launch all workers in parallel using multiple Task tool calls in a single message. All workers run in background (`run_in_background: true`).
|
|
71
|
-
|
|
72
|
-
Each worker gets:
|
|
73
|
-
|
|
74
|
-
```
|
|
75
|
-
Task(subagent_type="[selected-agent]",
|
|
76
|
-
run_in_background: true,
|
|
77
|
-
prompt="SWARM WORKER [N] of [TOTAL]
|
|
78
|
-
|
|
79
|
-
TASK: [User's description from $ARGUMENTS]
|
|
80
|
-
|
|
81
|
-
YOUR ITEMS ([count]):
|
|
82
|
-
- [item 1]
|
|
83
|
-
- [item 2]
|
|
84
|
-
- [item 3]
|
|
85
|
-
...
|
|
86
|
-
|
|
87
|
-
Process each item and report results in this format:
|
|
88
|
-
|
|
89
|
-
RESULTS:
|
|
90
|
-
- [item]: [status] - [details]
|
|
91
|
-
- [item]: [status] - [details]
|
|
92
|
-
|
|
93
|
-
SUMMARY:
|
|
94
|
-
- Processed: [count]
|
|
95
|
-
- Passed: [count]
|
|
96
|
-
- Issues found: [count]
|
|
97
|
-
- Failed: [count]")
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
Tell the user:
|
|
101
|
-
```
|
|
102
|
-
Launched [worker_count] workers across [items_count] items.
|
|
103
|
-
Running in background - what else do you want to work on?
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
### Step 5: Collect Results
|
|
107
|
-
|
|
108
|
-
When workers complete (check via Read on output files or TaskOutput), aggregate all results.
|
|
109
|
-
|
|
110
|
-
If any worker failed or timed out:
|
|
111
|
-
- Report which items were in the failed worker's batch
|
|
112
|
-
- Offer to retry just those items
|
|
113
|
-
|
|
114
|
-
### Step 6: Report
|
|
115
|
-
|
|
116
|
-
```markdown
|
|
117
|
-
## Swarm Report
|
|
118
|
-
|
|
119
|
-
### Task
|
|
120
|
-
[User's description]
|
|
121
|
-
|
|
122
|
-
### Execution
|
|
123
|
-
- **Items:** [total count]
|
|
124
|
-
- **Workers:** [worker count] x [agent type(s)]
|
|
125
|
-
- **Duration:** [time from dispatch to last worker completion]
|
|
126
|
-
|
|
127
|
-
---
|
|
128
|
-
|
|
129
|
-
### Results by Worker
|
|
130
|
-
|
|
131
|
-
#### Worker 1 ([agent type]) - [X items]
|
|
132
|
-
- [item]: [status] - [details]
|
|
133
|
-
- [item]: [status] - [details]
|
|
134
|
-
...
|
|
135
|
-
|
|
136
|
-
#### Worker 2 ([agent type]) - [X items]
|
|
137
|
-
...
|
|
138
|
-
|
|
139
|
-
---
|
|
140
|
-
|
|
141
|
-
### Aggregate Summary
|
|
142
|
-
|
|
143
|
-
| Status | Count |
|
|
144
|
-
|--------|-------|
|
|
145
|
-
| Passed / Clean | X |
|
|
146
|
-
| Issues Found | X |
|
|
147
|
-
| Failed / Error | X |
|
|
148
|
-
|
|
149
|
-
### Issues Found
|
|
150
|
-
[Grouped and deduplicated list of all issues across all workers]
|
|
151
|
-
|
|
152
|
-
1. **[item]**: [issue description]
|
|
153
|
-
2. **[item]**: [issue description]
|
|
154
|
-
...
|
|
155
|
-
|
|
156
|
-
### Failed Items
|
|
157
|
-
[If any workers failed, list their items for retry]
|
|
158
|
-
|
|
159
|
-
### Next Steps
|
|
160
|
-
- [Suggested follow-up based on results]
|
|
161
|
-
- [If issues found: suggest /hotfix-squad or Simple Writer to fix]
|
|
162
|
-
- [If edits made: suggest /review-squad to verify]
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
## Options
|
|
166
|
-
|
|
167
|
-
| Flag | Effect |
|
|
168
|
-
|------|--------|
|
|
169
|
-
| `--workers=N` | Override worker count (default: auto-calculated, max 5) |
|
|
170
|
-
| `--dry-run` | Show what would be dispatched without actually running |
|
|
171
|
-
| `--no-bg` | Run workers in foreground (wait for all to complete) |
|
|
172
|
-
|
|
173
|
-
## Examples
|
|
174
|
-
|
|
175
|
-
```
|
|
176
|
-
# Review all source files for security
|
|
177
|
-
/swarm "review all TypeScript files in src/ for security vulnerabilities"
|
|
178
|
-
→ Discovers 47 .ts files, spawns 5 Svetlana workers
|
|
179
|
-
|
|
180
|
-
# Bulk edit agent files
|
|
181
|
-
/swarm "add a '## Version History' section to every agent file"
|
|
182
|
-
→ Discovers 27 agent .md files, spawns 3 Simple Writer workers
|
|
183
|
-
|
|
184
|
-
# Validate workspace configs
|
|
185
|
-
/swarm "check all workflow field definitions for missing descriptions"
|
|
186
|
-
→ Discovers 12 fields.ts files, spawns 2 Kenji workers
|
|
187
|
-
|
|
188
|
-
# Multi-agent cleanup
|
|
189
|
-
/swarm "clean up the entire apps/ directory"
|
|
190
|
-
→ Discovers 34 files: 20 .tsx → Code Simplifier, 8 .ts → Lars, 6 configs → Bjorn
|
|
191
|
-
→ Spawns 5 workers across 3 agent types
|
|
192
|
-
|
|
193
|
-
# Data validation
|
|
194
|
-
/swarm "verify all Customer activities have a valid email field"
|
|
195
|
-
→ Kenji counts 200 customers, spawns 5 Kenji workers (40 each)
|
|
196
|
-
|
|
197
|
-
# Dry run to preview
|
|
198
|
-
/swarm "update all skills to use consistent headers" --dry-run
|
|
199
|
-
→ Shows: "Would dispatch 4 Simple Writer workers across 32 skill files"
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
## Notes
|
|
203
|
-
|
|
204
|
-
- Minimum 5 items to trigger swarm (below that, use a regular agent)
|
|
205
|
-
- Default max 5 workers to avoid overwhelming the system
|
|
206
|
-
- Workers run in background by default so user can keep working
|
|
207
|
-
- Multi-agent swarms naturally emerge from the orchestrator's routing logic
|
|
208
|
-
- For write operations (Dmitri, Simple Writer), consider running --dry-run first
|
|
209
|
-
- Swarm vs Squad: Swarm is raw parallel execution without quality gates. Workers operate independently. Squads have convergence, synthesis, and loops. Use swarm for bulk independent items, squads for coordinated workflows.
|
|
210
|
-
- Swarm + squad can combine: `/swarm "review src/"` finds issues, then user can run `/hotfix-squad` on results. This is a manual handoff - user confirms.
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Activate tool-builder mode to implement a new MCP tool
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Tool Builder Mode
|
|
6
|
-
|
|
7
|
-
Loading `tool-builder` skill for MCP tool patterns...
|
|
8
|
-
|
|
9
|
-
**What tool should I build?**
|
|
10
|
-
|
|
11
|
-
Please provide:
|
|
12
|
-
|
|
13
|
-
- **Tool Name**: `tool_name` (snake_case)
|
|
14
|
-
- **Purpose**: What does it do?
|
|
15
|
-
- **API Endpoint**: `v3.endpoint.method`
|
|
16
|
-
- **Request Format**: `[arg1, arg2]`
|
|
17
|
-
- **Response Format**: What the API returns
|
|
18
|
-
- **Target File**: Which file in `src/mcp/tools/`?
|
|
19
|
-
- **Tool Group**: READ | WRITE | PLAYGROUND
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
**Example:**
|
|
24
|
-
```
|
|
25
|
-
Tool Name: list_insights
|
|
26
|
-
Purpose: List all insights in workspace
|
|
27
|
-
API Endpoint: v3.insight.list
|
|
28
|
-
Request: [workspaceId]
|
|
29
|
-
Response: { insights: [{_id, name, query, sources}] }
|
|
30
|
-
Target File: insight.ts
|
|
31
|
-
Tool Group: PLAYGROUND
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
I'll:
|
|
35
|
-
1. Load tool-builder skill
|
|
36
|
-
2. Read existing patterns in target file
|
|
37
|
-
3. Implement the tool
|
|
38
|
-
4. Register in src/app.ts
|
|
39
|
-
5. Report what was created
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Pull workspace configuration from Hailer (READ-ONLY)
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
Pull the current workspace configuration from Hailer and save it locally.
|
|
6
|
-
|
|
7
|
-
**What this does:**
|
|
8
|
-
- Downloads workflows, insights, teams, groups, and phases from Hailer workspace
|
|
9
|
-
- Saves configuration as JSON files to the `WORKSPACE_CONFIG_PATH` directory
|
|
10
|
-
- READ-ONLY operation - does not modify anything on Hailer
|
|
11
|
-
- Safe to run anytime
|
|
12
|
-
|
|
13
|
-
**Requirements:**
|
|
14
|
-
- Must have `WORKSPACE_CONFIG_PATH` set in `.env.local`
|
|
15
|
-
- Hailer credentials must be configured
|
|
16
|
-
|
|
17
|
-
**Instructions for Claude:**
|
|
18
|
-
|
|
19
|
-
1. Read `.env.local` file to get `WORKSPACE_CONFIG_PATH`
|
|
20
|
-
2. Run: `cd "$WORKSPACE_CONFIG_PATH" && npm run pull`
|
|
21
|
-
3. **AUTOMATICALLY read the generated files to load context:**
|
|
22
|
-
- Read `workspace/enums.ts` (complete file - contains ALL field and phase IDs)
|
|
23
|
-
- List `workspace/` directory to see all workflow folders
|
|
24
|
-
- Read 1-2 example workflow configs (main.ts, fields.ts, phases.ts) to understand structure
|
|
25
|
-
4. Provide summary of what workflows were pulled and confirm context is loaded
|
|
26
|
-
|
|
27
|
-
**What gets downloaded:**
|
|
28
|
-
- `workspace/enums.ts` - Type-safe field and phase ID enums for ALL workflows
|
|
29
|
-
- `workspace/workflows.ts` - Main workflows export
|
|
30
|
-
- `workspace/insights.ts` - SQL insight definitions
|
|
31
|
-
- `workspace/teams.ts` - Team structures
|
|
32
|
-
- `workspace/groups.ts` - User groups
|
|
33
|
-
- `workspace/<workflow_name>/` - Individual workflow configs (main.ts, fields.ts, phases.ts)
|
|
34
|
-
|
|
35
|
-
**Why automatic reading matters:**
|
|
36
|
-
- Loads all field/phase IDs into conversation context immediately
|
|
37
|
-
- Enables local-first strategy without manual file reads
|
|
38
|
-
- Saves 75% of API calls and hundreds of tokens on subsequent operations
|
|
39
|
-
- You'll know the workspace structure instantly
|
|
40
|
-
|
|
41
|
-
**Common use cases:**
|
|
42
|
-
- Backup current workspace configuration
|
|
43
|
-
- Review workflow structures locally
|
|
44
|
-
- Prepare for making configuration changes
|
package/.opencode/opencode.json
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://opencode.ai/config.json",
|
|
3
|
-
"permission": {
|
|
4
|
-
"bash": {
|
|
5
|
-
"*": "ask",
|
|
6
|
-
"rm -rf *": "deny",
|
|
7
|
-
"rm -r *": "deny"
|
|
8
|
-
},
|
|
9
|
-
"doom_loop": "ask",
|
|
10
|
-
"read": {
|
|
11
|
-
"*": "allow",
|
|
12
|
-
"*.env": "deny",
|
|
13
|
-
"*.env.*": "deny",
|
|
14
|
-
"*.env.example": "allow"
|
|
15
|
-
},
|
|
16
|
-
"edit": "ask",
|
|
17
|
-
"external_directory": "ask",
|
|
18
|
-
"webfetch": "ask",
|
|
19
|
-
"websearch": "ask"
|
|
20
|
-
},
|
|
21
|
-
"mcp": {
|
|
22
|
-
"hailer": {
|
|
23
|
-
"type": "remote",
|
|
24
|
-
"url": "http://localhost:3030/api/mcp?apiKey=unique-api-key-for-this-agent",
|
|
25
|
-
"enabled": true
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
package/SESSION-HANDOFF.md
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
# Session Handoff
|
|
2
|
-
|
|
3
|
-
**Last Updated:** 2026-03-04
|
|
4
|
-
|
|
5
|
-
## What Was Done
|
|
6
|
-
|
|
7
|
-
### System Prompt — Full End-to-End Wiring
|
|
8
|
-
Wired `systemPrompt` field from Agent Directory through the entire bot pipeline:
|
|
9
|
-
|
|
10
|
-
- **`src/bot-config/constants.ts`** — added `FIELD_KEY_SYSTEM_PROMPT`
|
|
11
|
-
- **`src/bot-config/context.ts`** — `BotSchema.fields.systemPrompt`, `BotCredentials.systemPrompt`, schema discovery, `extractCredentials()`
|
|
12
|
-
- **`src/bot-config/webhooks.ts`** — extract systemPrompt in `extractCredentialsFromActivity()`
|
|
13
|
-
- **`src/bot-config/loader.ts`** — `BotConfigFile` types + `saveBotConfig()` includes systemPrompt
|
|
14
|
-
- **`src/bot/bot-config.ts`** — `BotConfig.systemPrompt`, reads from `orchestrator.systemPrompt`
|
|
15
|
-
- **`src/bot/bot-manager.ts`** — `BotUpdateEntry.systemPrompt`, passes to Bot; smart restart logic: if only systemPrompt changed (credentials same) → `bot.updateSystemPrompt()` without restart
|
|
16
|
-
- **`src/bot/bot.ts`** — `_systemPrompt` instance field (hot-swappable), `updateSystemPrompt()` public method, `buildSystemPrompt()` uses custom prompt + always appends `<bot-identity>` + `<workspace-context>`
|
|
17
|
-
- **`src/commands/seed-config.ts`** — `extractSystemPromptFromActivity()`, wired into orchestrator + specialist output
|
|
18
|
-
- **`src/mcp/webhook-handler.ts`** — `BotEntry.systemPrompt`, `WorkspaceConfig.orchestrator.systemPrompt`, extracts from webhook payload
|
|
19
|
-
|
|
20
|
-
### System Prompt Design
|
|
21
|
-
- Custom prompt from AI Hub used as full body; `{wsName}`, `{userId}`, `{botName}` substituted at runtime
|
|
22
|
-
- `<bot-identity>` and `<workspace-context>` always appended by bot — never stored
|
|
23
|
-
- Workspace-isolated: each `Bot` instance has own `_systemPrompt`, `BotManager.bots` Map keyed by workspaceId
|
|
24
|
-
- Phase change → full restart picks up new prompt from config file
|
|
25
|
-
- Field edit → webhook fires (with delay) → `handleBotConfigWebhook()` → `updateSystemPrompt()` (no restart)
|
|
26
|
-
|
|
27
|
-
## Current Work
|
|
28
|
-
|
|
29
|
-
### Uncommitted — All System Prompt Changes
|
|
30
|
-
10 files modified, compiles clean (`tsc --noEmit` passes). Not yet committed or pushed.
|
|
31
|
-
|
|
32
|
-
## Next Steps
|
|
33
|
-
|
|
34
|
-
1. **Commit the system prompt wiring** — all 10 files are ready
|
|
35
|
-
2. **Test end-to-end**: edit prompt in AI Hub → wait for webhook → verify bot uses new prompt
|
|
36
|
-
3. **Cloudflare** — user mentioned needing this (for remote MCP / public webhook URL). See `docs/prd-remote-mcp-server.md` and `docs/prd-remote-mcp-connector.md`
|
|
37
|
-
4. **`activityId` passthrough** (optional improvement) — pass orchestrator's `activityId` into Bot so it can subscribe to `activities.updated` socket signal for instant prompt updates (vs waiting for webhook)
|
|
38
|
-
|
|
39
|
-
## Key Decisions
|
|
40
|
-
|
|
41
|
-
- **Hot-swap without restart**: Only credentials change triggers bot restart; systemPrompt-only changes apply live via `updateSystemPrompt()`
|
|
42
|
-
- **Workspace isolation**: Guaranteed by `Map<workspaceId, Bot>` — webhook `cid` field routes to correct bot instance
|
|
43
|
-
- **Webhook-driven updates**: Phase change → webhook (requires public URL). Field-only changes → webhook fires with delay. Socket `activities.updated` would be instant but requires `activityId` passthrough (not yet done)
|
|
44
|
-
- **Prompt structure**: Custom prompt replaces the rules section; `<bot-identity>` + `<workspace-context>` always runtime-injected
|
|
45
|
-
|
|
46
|
-
## Files Modified (uncommitted)
|
|
47
|
-
|
|
48
|
-
- `src/bot-config/constants.ts` — FIELD_KEY_SYSTEM_PROMPT
|
|
49
|
-
- `src/bot-config/context.ts` — BotSchema, BotCredentials, discovery, extractCredentials
|
|
50
|
-
- `src/bot-config/loader.ts` — BotConfigFile types + saveBotConfig
|
|
51
|
-
- `src/bot-config/webhooks.ts` — extractCredentialsFromActivity
|
|
52
|
-
- `src/bot/bot-config.ts` — BotConfig + loadBotConfigs
|
|
53
|
-
- `src/bot/bot-manager.ts` — BotUpdateEntry, smart restart, updateSystemPrompt call
|
|
54
|
-
- `src/bot/bot.ts` — _systemPrompt field, updateSystemPrompt(), buildSystemPrompt(), email/password getters
|
|
55
|
-
- `src/commands/seed-config.ts` — extractSystemPromptFromActivity + wired into output
|
|
56
|
-
- `src/mcp/webhook-handler.ts` — BotEntry, WorkspaceConfig types + extraction
|
|
57
|
-
|
|
58
|
-
## Context to Preserve
|
|
59
|
-
|
|
60
|
-
- Agent Directory workflow ID: `69885261c432a499a35313b6`
|
|
61
|
-
- Deployed phase: `8fa543c69749ab4e8f9e3967`, Retired phase: `df66a80fe7cfde1c3b928038`
|
|
62
|
-
- AI Hub app: `695e3665701ef8e3824beebe`, marketplace targetId: `698351e8dda756e689368b60`
|
|
63
|
-
- `systemPrompt` field key must be exactly `systemPrompt` (camelCase) — field type: textarea
|
|
64
|
-
- **seed-config.ts is an independent copy** of field extraction — NOT shared with context.ts. Always update both when adding new Agent Directory fields
|
|
65
|
-
- **Two bot-config readers**: `src/bot-config/loader.ts` (BotContext/webhook path) AND `src/bot/bot-config.ts` (BotManager startup path) — both need updating
|
|
66
|
-
- **webhook-handler.ts has its own local types** (BotEntry, WorkspaceConfig) — update independently
|
|
67
|
-
- Webhook fires on phase changes; field edits may have delay before webhook triggers
|
|
68
|
-
- `app-edit-guard --agent-on` does NOT propagate to subagents — do ai-hub edits directly
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# Bot Config Field Wiring Patterns
|
|
2
|
-
|
|
3
|
-
**Date:** 2026-03-04
|
|
4
|
-
**Context:** Adding systemPrompt field to Agent Directory pipeline
|
|
5
|
-
|
|
6
|
-
## Key Gotchas
|
|
7
|
-
|
|
8
|
-
### seed-config.ts is an independent copy
|
|
9
|
-
`src/commands/seed-config.ts` has its own field extraction logic completely separate from `src/bot-config/context.ts`. When adding a new Agent Directory field, you MUST update BOTH files — they don't share code.
|
|
10
|
-
|
|
11
|
-
### Two separate bot-config readers
|
|
12
|
-
- `src/bot-config/loader.ts` — BotContext system, used by webhook/signal path
|
|
13
|
-
- `src/bot/bot-config.ts` — simple flat reader, used by BotManager on startup
|
|
14
|
-
|
|
15
|
-
Both read from `.bot-config/*.json` but in different ways. Both need updating when adding new fields.
|
|
16
|
-
|
|
17
|
-
### webhook-handler.ts has its own local types
|
|
18
|
-
`BotEntry` and `WorkspaceConfig` are defined locally inside `webhook-handler.ts`, not imported from anywhere. Must update them independently when adding fields.
|
|
19
|
-
|
|
20
|
-
### Webhook fires on phase changes only (with delay)
|
|
21
|
-
Field edits (e.g. systemPrompt) trigger the webhook but with a delay — Hailer batches/debounces. Phase changes are more immediate. For truly instant field-change detection, subscribe to the `activities.updated` socket signal inside the Bot (requires knowing the bot's own `activityId`).
|
|
22
|
-
|
|
23
|
-
### Hot-swap system prompts without restart
|
|
24
|
-
Pattern for live-updatable config in Bot: store as a separate instance field (`_systemPrompt`) distinct from `this.config`. Expose `updateSystemPrompt(prompt)` public method. BotManager can call it without restarting the bot — only restart when credentials actually change.
|
package/scripts/postinstall.cjs
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* postinstall: Copies .claude/ (agents, skills, hooks) to the project root.
|
|
4
|
-
* Runs automatically after `npm install @hailer/mcp`.
|
|
5
|
-
* Skips when installing in the hailer-mcp repo itself (development).
|
|
6
|
-
*/
|
|
7
|
-
const fs = require('fs');
|
|
8
|
-
const path = require('path');
|
|
9
|
-
|
|
10
|
-
// Find the project root by walking up from node_modules/@hailer/mcp/
|
|
11
|
-
function findProjectRoot() {
|
|
12
|
-
let dir = __dirname;
|
|
13
|
-
// Walk up until we find a package.json that isn't ours
|
|
14
|
-
for (let i = 0; i < 10; i++) {
|
|
15
|
-
dir = path.dirname(dir);
|
|
16
|
-
const pkgPath = path.join(dir, 'package.json');
|
|
17
|
-
if (fs.existsSync(pkgPath)) {
|
|
18
|
-
try {
|
|
19
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
20
|
-
// Skip if this is our own package.json
|
|
21
|
-
if (pkg.name === '@hailer/mcp') continue;
|
|
22
|
-
return dir;
|
|
23
|
-
} catch { continue; }
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function copyDir(src, dest) {
|
|
30
|
-
if (!fs.existsSync(src)) return;
|
|
31
|
-
fs.mkdirSync(dest, { recursive: true });
|
|
32
|
-
|
|
33
|
-
for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
|
|
34
|
-
const srcPath = path.join(src, entry.name);
|
|
35
|
-
const destPath = path.join(dest, entry.name);
|
|
36
|
-
|
|
37
|
-
if (entry.isDirectory()) {
|
|
38
|
-
copyDir(srcPath, destPath);
|
|
39
|
-
} else {
|
|
40
|
-
// Don't overwrite user's local settings
|
|
41
|
-
if (entry.name === 'settings.local.json' && fs.existsSync(destPath)) continue;
|
|
42
|
-
fs.copyFileSync(srcPath, destPath);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const projectRoot = findProjectRoot();
|
|
48
|
-
|
|
49
|
-
// Skip if we can't find a project root or if running in dev (our own repo)
|
|
50
|
-
if (!projectRoot) {
|
|
51
|
-
console.log('@hailer/mcp: skipping agent install (no project root found)');
|
|
52
|
-
process.exit(0);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const src = path.join(__dirname, '..', '.claude');
|
|
56
|
-
const dest = path.join(projectRoot, '.claude');
|
|
57
|
-
|
|
58
|
-
if (!fs.existsSync(src)) {
|
|
59
|
-
console.log('@hailer/mcp: no .claude/ directory in package, skipping');
|
|
60
|
-
process.exit(0);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
copyDir(src, dest);
|
|
64
|
-
console.log(`@hailer/mcp: agents installed to ${dest}`);
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env npx ts-node
|
|
2
|
-
/**
|
|
3
|
-
* HAL Tools Test - Simple version
|
|
4
|
-
* Just calls each tool and shows the result. No magic.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import * as dotenv from 'dotenv';
|
|
8
|
-
import * as path from 'path';
|
|
9
|
-
|
|
10
|
-
dotenv.config({ path: path.join(__dirname, '..', '.env.local') });
|
|
11
|
-
|
|
12
|
-
const MCP_URL = process.env.MCP_SERVER_URL || 'http://localhost:3030/api/mcp';
|
|
13
|
-
|
|
14
|
-
async function call(apiKey: string, tool: string, args: Record<string, unknown> = {}) {
|
|
15
|
-
console.log(`\n>>> ${tool}`);
|
|
16
|
-
console.log(` args: ${JSON.stringify(args)}`);
|
|
17
|
-
|
|
18
|
-
const res = await fetch(`${MCP_URL}?apiKey=${apiKey}`, {
|
|
19
|
-
method: 'POST',
|
|
20
|
-
headers: { 'Content-Type': 'application/json' },
|
|
21
|
-
body: JSON.stringify({
|
|
22
|
-
jsonrpc: '2.0',
|
|
23
|
-
id: '1',
|
|
24
|
-
method: 'tools/call',
|
|
25
|
-
params: { name: tool, arguments: args },
|
|
26
|
-
}),
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const text = await res.text();
|
|
30
|
-
for (const line of text.split('\n')) {
|
|
31
|
-
if (line.startsWith('data: ')) {
|
|
32
|
-
const data = JSON.parse(line.substring(6));
|
|
33
|
-
if (data.error) {
|
|
34
|
-
console.log(`<<< ERROR: ${data.error.message}`);
|
|
35
|
-
return { error: true, data: null };
|
|
36
|
-
}
|
|
37
|
-
const content = data.result?.content?.[0]?.text || '';
|
|
38
|
-
// Show first 500 chars
|
|
39
|
-
console.log(`<<< ${content.substring(0, 500)}${content.length > 500 ? '...' : ''}`);
|
|
40
|
-
return { error: false, content };
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
console.log('<<< NO RESPONSE');
|
|
44
|
-
return { error: true, data: null };
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
async function main() {
|
|
48
|
-
const apiKey = process.env.MCP_CLIENT_API_KEY;
|
|
49
|
-
if (!apiKey) {
|
|
50
|
-
console.error('Set MCP_CLIENT_API_KEY in .env.local');
|
|
51
|
-
process.exit(1);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
console.log('=== HAL TOOLS TEST ===\n');
|
|
55
|
-
|
|
56
|
-
// Get a workflow to work with
|
|
57
|
-
const wf = await call(apiKey, 'list_workflows_minimal', {});
|
|
58
|
-
const wfMatch = wf.content?.match(/`([a-f0-9]{24})`/);
|
|
59
|
-
const workflowId = wfMatch?.[1];
|
|
60
|
-
console.log(`\n[Using workflowId: ${workflowId}]`);
|
|
61
|
-
|
|
62
|
-
if (!workflowId) {
|
|
63
|
-
console.log('No workflow found, stopping');
|
|
64
|
-
process.exit(1);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Get phase
|
|
68
|
-
const ph = await call(apiKey, 'list_workflow_phases', { workflowId });
|
|
69
|
-
const phMatch = ph.content?.match(/`([a-f0-9]{24})`/);
|
|
70
|
-
const phaseId = phMatch?.[1];
|
|
71
|
-
console.log(`\n[Using phaseId: ${phaseId}]`);
|
|
72
|
-
|
|
73
|
-
// Schema
|
|
74
|
-
await call(apiKey, 'get_workflow_schema', { workflowId, phaseId });
|
|
75
|
-
|
|
76
|
-
// List activities
|
|
77
|
-
await call(apiKey, 'list_activities', { workflowId, phaseId, fields: '[]' });
|
|
78
|
-
|
|
79
|
-
// Count
|
|
80
|
-
await call(apiKey, 'count_activities', { workflowId });
|
|
81
|
-
|
|
82
|
-
// Create activity
|
|
83
|
-
const created = await call(apiKey, 'create_activity', {
|
|
84
|
-
workflowId,
|
|
85
|
-
name: `TEST_${Date.now()}`
|
|
86
|
-
});
|
|
87
|
-
const actMatch = created.content?.match(/\*\*ID\*\*:\s*([a-f0-9]{24})/);
|
|
88
|
-
const activityId = actMatch?.[1];
|
|
89
|
-
console.log(`\n[Created activityId: ${activityId}]`);
|
|
90
|
-
|
|
91
|
-
if (activityId) {
|
|
92
|
-
// Show it
|
|
93
|
-
await call(apiKey, 'show_activity_by_id', { activityId });
|
|
94
|
-
|
|
95
|
-
// Update it
|
|
96
|
-
await call(apiKey, 'update_activity', { activityId, name: `UPDATED_${Date.now()}` });
|
|
97
|
-
|
|
98
|
-
// Delete it (this tool doesn't exist yet)
|
|
99
|
-
await call(apiKey, 'delete_activity', { activityId });
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// Insights
|
|
103
|
-
await call(apiKey, 'list_insights', {});
|
|
104
|
-
|
|
105
|
-
const sources = [{
|
|
106
|
-
name: 'src',
|
|
107
|
-
workflowId,
|
|
108
|
-
fields: [{ meta: 'name', name: 'Name', as: 'name' }]
|
|
109
|
-
}];
|
|
110
|
-
|
|
111
|
-
await call(apiKey, 'preview_insight', { sources, query: 'SELECT * FROM src LIMIT 3' });
|
|
112
|
-
|
|
113
|
-
const ins = await call(apiKey, 'create_insight', {
|
|
114
|
-
name: `TEST_${Date.now()}`,
|
|
115
|
-
sources,
|
|
116
|
-
query: 'SELECT * FROM src LIMIT 3'
|
|
117
|
-
});
|
|
118
|
-
const insMatch = ins.content?.match(/`([a-f0-9]{24})`/);
|
|
119
|
-
const insightId = insMatch?.[1];
|
|
120
|
-
|
|
121
|
-
if (insightId) {
|
|
122
|
-
await call(apiKey, 'get_insight_data', { insightId });
|
|
123
|
-
await call(apiKey, 'remove_insight', { insightId });
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// Discussions
|
|
127
|
-
await call(apiKey, 'list_my_discussions', {});
|
|
128
|
-
|
|
129
|
-
if (activityId) {
|
|
130
|
-
await call(apiKey, 'join_discussion', { activityId });
|
|
131
|
-
// Get discussion from activity
|
|
132
|
-
const act = await call(apiKey, 'show_activity_by_id', { activityId });
|
|
133
|
-
const discMatch = act.content?.match(/discussion.*?([a-f0-9]{24})/i);
|
|
134
|
-
const discussionId = discMatch?.[1];
|
|
135
|
-
|
|
136
|
-
if (discussionId) {
|
|
137
|
-
await call(apiKey, 'fetch_discussion_messages', { discussionId });
|
|
138
|
-
await call(apiKey, 'add_discussion_message', { discussionId, content: 'TEST' });
|
|
139
|
-
await call(apiKey, 'get_activity_from_discussion', { discussionId });
|
|
140
|
-
await call(apiKey, 'leave_discussion', { discussionId });
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// Other
|
|
145
|
-
await call(apiKey, 'list_workflows', {});
|
|
146
|
-
await call(apiKey, 'list_apps', {});
|
|
147
|
-
await call(apiKey, 'list_templates', {});
|
|
148
|
-
await call(apiKey, 'get_workspace_balance', {});
|
|
149
|
-
await call(apiKey, 'search_workspace_users', { query: 'test' });
|
|
150
|
-
|
|
151
|
-
console.log('\n=== DONE ===');
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
main().catch(console.error);
|