@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
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Investigation Tool - Spawn Claude Code agents to investigate local repos
|
|
3
|
+
*
|
|
4
|
+
* Uses `claude -p` (headless mode, subscription-based) to autonomously
|
|
5
|
+
* explore codebases, search for bugs, and analyze code.
|
|
6
|
+
*/
|
|
7
|
+
import { Tool } from '../tool-registry';
|
|
8
|
+
export declare const investigateRepoTool: Tool;
|
|
9
|
+
//# sourceMappingURL=investigate.d.ts.map
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Investigation Tool - Spawn Claude Code agents to investigate local repos
|
|
4
|
+
*
|
|
5
|
+
* Uses `claude -p` (headless mode, subscription-based) to autonomously
|
|
6
|
+
* explore codebases, search for bugs, and analyze code.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.investigateRepoTool = void 0;
|
|
10
|
+
const zod_1 = require("zod");
|
|
11
|
+
const child_process_1 = require("child_process");
|
|
12
|
+
const tool_registry_1 = require("../tool-registry");
|
|
13
|
+
const logger_1 = require("../../lib/logger");
|
|
14
|
+
const config_1 = require("../../config");
|
|
15
|
+
const logger = (0, logger_1.createLogger)({ component: 'investigate-tool' });
|
|
16
|
+
/**
|
|
17
|
+
* Resolve claude CLI path at module load
|
|
18
|
+
*/
|
|
19
|
+
const CLAUDE_BIN = (() => {
|
|
20
|
+
try {
|
|
21
|
+
return (0, child_process_1.execSync)('which claude', { encoding: 'utf-8' }).trim();
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return 'claude'; // fallback to PATH lookup
|
|
25
|
+
}
|
|
26
|
+
})();
|
|
27
|
+
/**
|
|
28
|
+
* Parse DEV_AI_REPOS env var into a name->path map.
|
|
29
|
+
* Format: "name1:/path/one,name2:/path/two"
|
|
30
|
+
*/
|
|
31
|
+
function parseRepoPaths() {
|
|
32
|
+
const raw = config_1.environment.DEV_AI_REPOS;
|
|
33
|
+
const map = new Map();
|
|
34
|
+
if (!raw)
|
|
35
|
+
return map;
|
|
36
|
+
for (const entry of raw.split(',')) {
|
|
37
|
+
const colonIdx = entry.indexOf(':');
|
|
38
|
+
if (colonIdx === -1)
|
|
39
|
+
continue;
|
|
40
|
+
const name = entry.slice(0, colonIdx).trim();
|
|
41
|
+
const repoPath = entry.slice(colonIdx + 1).trim();
|
|
42
|
+
if (name && repoPath) {
|
|
43
|
+
map.set(name, repoPath);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return map;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Resolve a repo name to its local filesystem path.
|
|
50
|
+
*/
|
|
51
|
+
function resolveRepoPath(repoName) {
|
|
52
|
+
const repos = parseRepoPaths();
|
|
53
|
+
return repos.get(repoName) || null;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Spawn `claude -p` in a repo directory and return its output.
|
|
57
|
+
*/
|
|
58
|
+
async function spawnInvestigation(prompt, cwd, maxTurns, repoName) {
|
|
59
|
+
const timeout = config_1.environment.DEV_AI_INVESTIGATION_TIMEOUT;
|
|
60
|
+
return new Promise((resolve, reject) => {
|
|
61
|
+
const proc = (0, child_process_1.spawn)(CLAUDE_BIN, [
|
|
62
|
+
'-p', prompt,
|
|
63
|
+
'--output-format', 'stream-json',
|
|
64
|
+
'--verbose',
|
|
65
|
+
'--allowedTools', 'Read,Glob,Grep,Bash,Task',
|
|
66
|
+
'--max-turns', String(maxTurns),
|
|
67
|
+
], {
|
|
68
|
+
cwd,
|
|
69
|
+
timeout,
|
|
70
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
71
|
+
env: {
|
|
72
|
+
...process.env,
|
|
73
|
+
// Strip MCP vars so investigation agent doesn't connect to our MCP server
|
|
74
|
+
MCP_SERVER_URL: undefined,
|
|
75
|
+
MCP_CLIENT_API_KEY: undefined,
|
|
76
|
+
MCP_CLIENT_ENABLED: undefined,
|
|
77
|
+
CLIENT_CONFIGS: undefined,
|
|
78
|
+
BOT_EMAIL: undefined,
|
|
79
|
+
BOT_PASSWORD: undefined,
|
|
80
|
+
BOT_API_BASE_URL: undefined,
|
|
81
|
+
ANTHROPIC_API_KEY: undefined,
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
let lineBuffer = '';
|
|
85
|
+
let resultText = '';
|
|
86
|
+
let stderr = '';
|
|
87
|
+
proc.stdout.on('data', (data) => {
|
|
88
|
+
lineBuffer += data.toString();
|
|
89
|
+
const lines = lineBuffer.split('\n');
|
|
90
|
+
lineBuffer = lines.pop() || ''; // Keep incomplete last line in buffer
|
|
91
|
+
for (const line of lines) {
|
|
92
|
+
const trimmed = line.trim();
|
|
93
|
+
if (!trimmed)
|
|
94
|
+
continue;
|
|
95
|
+
try {
|
|
96
|
+
const event = JSON.parse(trimmed);
|
|
97
|
+
if (event.type === 'system' && event.subtype === 'init') {
|
|
98
|
+
logger.debug(`[investigation:${repoName}] Agent initialized | tools: ${(event.tools || []).length} | model: ${event.model || 'unknown'}`);
|
|
99
|
+
}
|
|
100
|
+
else if (event.type === 'assistant' && event.message?.content) {
|
|
101
|
+
for (const block of event.message.content) {
|
|
102
|
+
if (block.type === 'tool_use') {
|
|
103
|
+
const inputStr = JSON.stringify(block.input || {});
|
|
104
|
+
logger.debug(`[investigation:${repoName}] Tool: ${block.name} ${inputStr.length > 200 ? inputStr.slice(0, 200) + '...' : inputStr}`);
|
|
105
|
+
}
|
|
106
|
+
else if (block.type === 'text') {
|
|
107
|
+
const text = (block.text || '').trim();
|
|
108
|
+
if (text) {
|
|
109
|
+
logger.debug(`[investigation:${repoName}] ${text.length > 300 ? text.slice(0, 300) + '...' : text}`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
else if (event.type === 'tool') {
|
|
115
|
+
const content = typeof event.content === 'string' ? event.content : JSON.stringify(event.content || '');
|
|
116
|
+
logger.debug(`[investigation:${repoName}] Tool result (${event.tool_name}): ${content.length > 300 ? content.slice(0, 300) + '...' : content}`);
|
|
117
|
+
}
|
|
118
|
+
else if (event.type === 'result') {
|
|
119
|
+
resultText = event.result || '';
|
|
120
|
+
const cost = event.total_cost_usd ? `$${event.total_cost_usd.toFixed(4)}` : 'unknown';
|
|
121
|
+
const duration = event.duration_ms ? `${(event.duration_ms / 1000).toFixed(1)}s` : 'unknown';
|
|
122
|
+
logger.info(`[investigation:${repoName}] Complete | ${resultText.length} chars | ${duration} | cost: ${cost}`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
// Non-JSON line
|
|
127
|
+
if (trimmed.length > 0) {
|
|
128
|
+
logger.debug(`[investigation:${repoName}] ${trimmed.length > 300 ? trimmed.slice(0, 300) + '...' : trimmed}`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
proc.stderr.on('data', (data) => {
|
|
134
|
+
const chunk = data.toString();
|
|
135
|
+
stderr += chunk;
|
|
136
|
+
const trimmed = chunk.trim();
|
|
137
|
+
if (trimmed) {
|
|
138
|
+
logger.warn(`[investigation:${repoName}] ${trimmed.length > 500 ? trimmed.slice(0, 500) + '...' : trimmed}`);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
proc.on('error', (err) => {
|
|
142
|
+
reject(new Error(`Failed to spawn claude: ${err.message}`));
|
|
143
|
+
});
|
|
144
|
+
proc.on('close', (code) => {
|
|
145
|
+
// Process any remaining data in lineBuffer
|
|
146
|
+
if (lineBuffer.trim()) {
|
|
147
|
+
try {
|
|
148
|
+
const event = JSON.parse(lineBuffer.trim());
|
|
149
|
+
if (event.type === 'result') {
|
|
150
|
+
resultText = event.result || '';
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
// ignore
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (code === 0) {
|
|
158
|
+
resolve(resultText || 'Investigation completed but returned no structured result.');
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
const errDetail = stderr.trim() || `exit code ${code}`;
|
|
162
|
+
reject(new Error(`Investigation failed: ${errDetail}`));
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
const investigateRepoSchema = zod_1.z.object({
|
|
168
|
+
repoName: zod_1.z.string().describe('Target repo name (must match a configured repo). Available repos depend on DEV_AI_REPOS config.'),
|
|
169
|
+
prompt: zod_1.z.string().describe('What to investigate - bug description, search query, code question, etc.'),
|
|
170
|
+
maxTurns: zod_1.z.number().optional().default(30).describe('Max investigation depth (number of agentic turns). Default: 30.'),
|
|
171
|
+
});
|
|
172
|
+
exports.investigateRepoTool = {
|
|
173
|
+
name: 'investigate_repo',
|
|
174
|
+
group: tool_registry_1.ToolGroup.PLAYGROUND,
|
|
175
|
+
description: 'Spawn a Claude Code agent to investigate code in a local repo. ' +
|
|
176
|
+
'Uses claude -p (headless mode, subscription-based). ' +
|
|
177
|
+
'The agent can explore files, search code, analyze the codebase autonomously, ' +
|
|
178
|
+
'and spawn investigation teams for parallel exploration of complex issues. ' +
|
|
179
|
+
'Returns the investigation findings as text.',
|
|
180
|
+
schema: investigateRepoSchema,
|
|
181
|
+
async execute(args, _context) {
|
|
182
|
+
const repos = parseRepoPaths();
|
|
183
|
+
// If no repos configured, return helpful error
|
|
184
|
+
if (repos.size === 0) {
|
|
185
|
+
return {
|
|
186
|
+
content: [{
|
|
187
|
+
type: 'text',
|
|
188
|
+
text: 'No repos configured. Set DEV_AI_REPOS in .env.local (format: "name:/path,name2:/path2").',
|
|
189
|
+
}],
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
const repoPath = resolveRepoPath(args.repoName);
|
|
193
|
+
if (!repoPath) {
|
|
194
|
+
const available = Array.from(repos.keys()).join(', ');
|
|
195
|
+
return {
|
|
196
|
+
content: [{
|
|
197
|
+
type: 'text',
|
|
198
|
+
text: `Unknown repo: "${args.repoName}". Available repos: ${available}`,
|
|
199
|
+
}],
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
const enhancedPrompt = `You are a lead investigator. Use parallel agents to explore the codebase efficiently.
|
|
203
|
+
|
|
204
|
+
HOW TO USE PARALLEL AGENTS:
|
|
205
|
+
- Call multiple Task tools in a SINGLE response to run them in parallel
|
|
206
|
+
- Each Task call blocks until that agent finishes and returns its findings directly to you
|
|
207
|
+
- Use subagent_type: "Explore" with model: "haiku" โ these are fast, read-only codebase search agents
|
|
208
|
+
- Do NOT use TeamCreate, SendMessage, or TaskCreate โ just call Task directly
|
|
209
|
+
|
|
210
|
+
APPROACH:
|
|
211
|
+
1. In your FIRST response, call 2-3 Task tools simultaneously, each with a focused search prompt
|
|
212
|
+
2. You will receive all their findings in the next turn
|
|
213
|
+
3. If needed, do additional targeted searches yourself with Grep/Read
|
|
214
|
+
4. Write your FINAL REPORT
|
|
215
|
+
|
|
216
|
+
REPORT FORMAT:
|
|
217
|
+
- Root cause of the issue
|
|
218
|
+
- Affected files with paths and line numbers
|
|
219
|
+
- Suggested fix with specific code changes
|
|
220
|
+
|
|
221
|
+
INVESTIGATION TASK:
|
|
222
|
+
${args.prompt}`;
|
|
223
|
+
logger.info('Starting investigation', {
|
|
224
|
+
repo: args.repoName,
|
|
225
|
+
repoPath,
|
|
226
|
+
maxTurns: args.maxTurns,
|
|
227
|
+
promptLength: enhancedPrompt.length,
|
|
228
|
+
});
|
|
229
|
+
try {
|
|
230
|
+
const result = await spawnInvestigation(enhancedPrompt, repoPath, args.maxTurns, args.repoName);
|
|
231
|
+
logger.info('Investigation completed', {
|
|
232
|
+
repo: args.repoName,
|
|
233
|
+
resultLength: result.length,
|
|
234
|
+
});
|
|
235
|
+
return {
|
|
236
|
+
content: [{
|
|
237
|
+
type: 'text',
|
|
238
|
+
text: result || 'Investigation completed but returned no output.',
|
|
239
|
+
}],
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
catch (error) {
|
|
243
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
244
|
+
logger.error('Investigation failed', { repo: args.repoName, error: errMsg });
|
|
245
|
+
return {
|
|
246
|
+
content: [{
|
|
247
|
+
type: 'text',
|
|
248
|
+
text: `Investigation failed: ${errMsg}`,
|
|
249
|
+
}],
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
};
|
|
254
|
+
//# sourceMappingURL=investigate.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow Permission Tools
|
|
3
|
+
*
|
|
4
|
+
* Tools for managing workflow member permissions in Hailer workspaces:
|
|
5
|
+
* - List members and their permission levels
|
|
6
|
+
* - Grant user or team access with a specific permission level
|
|
7
|
+
* - Revoke user or team access
|
|
8
|
+
* - Check what permissions a specific user has
|
|
9
|
+
*/
|
|
10
|
+
import { Tool } from '../tool-registry';
|
|
11
|
+
export declare const listWorkflowPermissionsTool: Tool;
|
|
12
|
+
export declare const grantWorkflowPermissionTool: Tool;
|
|
13
|
+
export declare const revokeWorkflowPermissionTool: Tool;
|
|
14
|
+
export declare const checkUserPermissionsTool: Tool;
|
|
15
|
+
//# sourceMappingURL=workflow-permissions.d.ts.map
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Workflow Permission Tools
|
|
4
|
+
*
|
|
5
|
+
* Tools for managing workflow member permissions in Hailer workspaces:
|
|
6
|
+
* - List members and their permission levels
|
|
7
|
+
* - Grant user or team access with a specific permission level
|
|
8
|
+
* - Revoke user or team access
|
|
9
|
+
* - Check what permissions a specific user has
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.checkUserPermissionsTool = exports.revokeWorkflowPermissionTool = exports.grantWorkflowPermissionTool = exports.listWorkflowPermissionsTool = void 0;
|
|
13
|
+
const zod_1 = require("zod");
|
|
14
|
+
const tool_registry_1 = require("../tool-registry");
|
|
15
|
+
const index_1 = require("../utils/index");
|
|
16
|
+
const tool_helpers_1 = require("../utils/tool-helpers");
|
|
17
|
+
const request_logger_1 = require("../../lib/request-logger");
|
|
18
|
+
const logger = (0, index_1.createLogger)({ component: 'workflow-permissions-tools' });
|
|
19
|
+
/** Ensure memberId has the required prefix (user_, team_, network_, group_) */
|
|
20
|
+
function ensureMemberPrefix(memberId) {
|
|
21
|
+
if (memberId.startsWith('user_') || memberId.startsWith('team_') ||
|
|
22
|
+
memberId.startsWith('network_') || memberId.startsWith('group_')) {
|
|
23
|
+
return memberId;
|
|
24
|
+
}
|
|
25
|
+
return `user_${memberId}`;
|
|
26
|
+
}
|
|
27
|
+
// ============================================================================
|
|
28
|
+
// TOOL 1: LIST WORKFLOW PERMISSIONS
|
|
29
|
+
// ============================================================================
|
|
30
|
+
exports.listWorkflowPermissionsTool = {
|
|
31
|
+
name: 'list_workflow_permissions',
|
|
32
|
+
group: tool_registry_1.ToolGroup.READ,
|
|
33
|
+
description: 'List members and their permission levels for a workflow',
|
|
34
|
+
schema: zod_1.z.object({
|
|
35
|
+
workflowId: zod_1.z
|
|
36
|
+
.string()
|
|
37
|
+
.describe('The workflow ID to list permissions for'),
|
|
38
|
+
}),
|
|
39
|
+
async execute(args, context) {
|
|
40
|
+
logger.debug('Listing workflow permissions', {
|
|
41
|
+
workflowId: args.workflowId,
|
|
42
|
+
apiKey: context.apiKey.substring(0, 8) + '...',
|
|
43
|
+
});
|
|
44
|
+
try {
|
|
45
|
+
const result = await context.hailer.request('v2.process.member.list', [args.workflowId]);
|
|
46
|
+
return (0, index_1.textResponse)(JSON.stringify(result, null, 2));
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
if (!request_logger_1.RequestLogger.getCurrent())
|
|
50
|
+
logger.error('Error listing workflow permissions', error);
|
|
51
|
+
const msg = error?.msg || error?.message || (0, index_1.getErrorMessage)(error);
|
|
52
|
+
return (0, index_1.errorResponse)(`Error listing workflow permissions: ${msg}`);
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
// ============================================================================
|
|
57
|
+
// TOOL 2: GRANT WORKFLOW PERMISSION
|
|
58
|
+
// ============================================================================
|
|
59
|
+
const permissionLevels = ['admin', 'any', 'ownteam', 'own'];
|
|
60
|
+
exports.grantWorkflowPermissionTool = {
|
|
61
|
+
name: 'grant_workflow_permission',
|
|
62
|
+
group: tool_registry_1.ToolGroup.WRITE,
|
|
63
|
+
description: 'Grant a user or team access to a workflow with a specific permission level',
|
|
64
|
+
schema: zod_1.z.object({
|
|
65
|
+
workflowId: zod_1.z
|
|
66
|
+
.string()
|
|
67
|
+
.describe('The workflow ID to grant permission on'),
|
|
68
|
+
memberId: zod_1.z
|
|
69
|
+
.string()
|
|
70
|
+
.describe('The user ID or team ID to grant access to'),
|
|
71
|
+
level: zod_1.z
|
|
72
|
+
.enum(permissionLevels)
|
|
73
|
+
.describe('Permission level: admin (full access), any (all activities), ownteam (own team activities), own (own activities only)'),
|
|
74
|
+
}),
|
|
75
|
+
async execute(args, context) {
|
|
76
|
+
logger.debug('Granting workflow permission', {
|
|
77
|
+
workflowId: args.workflowId,
|
|
78
|
+
memberId: args.memberId,
|
|
79
|
+
level: args.level,
|
|
80
|
+
apiKey: context.apiKey.substring(0, 8) + '...',
|
|
81
|
+
});
|
|
82
|
+
try {
|
|
83
|
+
const prefixedMemberId = ensureMemberPrefix(args.memberId);
|
|
84
|
+
// Step 1: Add as member first (may fail if already a member โ that's OK)
|
|
85
|
+
try {
|
|
86
|
+
await context.hailer.request('v2.process.member.add', [args.workflowId, prefixedMemberId]);
|
|
87
|
+
}
|
|
88
|
+
catch (addError) {
|
|
89
|
+
logger.debug('member.add failed (possibly already a member), continuing to grant', {
|
|
90
|
+
error: (0, index_1.getErrorMessage)(addError),
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
// Step 2: Set the permission level
|
|
94
|
+
const result = await context.hailer.request('v2.process.permissions.grant', [
|
|
95
|
+
args.workflowId,
|
|
96
|
+
prefixedMemberId,
|
|
97
|
+
args.level,
|
|
98
|
+
]);
|
|
99
|
+
return (0, index_1.textResponse)(JSON.stringify({
|
|
100
|
+
success: true,
|
|
101
|
+
workflowId: args.workflowId,
|
|
102
|
+
memberId: prefixedMemberId,
|
|
103
|
+
level: args.level,
|
|
104
|
+
result,
|
|
105
|
+
}, null, 2));
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
if (!request_logger_1.RequestLogger.getCurrent())
|
|
109
|
+
logger.error('Error granting workflow permission', error);
|
|
110
|
+
const msg = error?.msg || error?.message || (0, index_1.getErrorMessage)(error);
|
|
111
|
+
return (0, index_1.errorResponse)(`Error granting workflow permission: ${msg}`);
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
// ============================================================================
|
|
116
|
+
// TOOL 3: REVOKE WORKFLOW PERMISSION
|
|
117
|
+
// ============================================================================
|
|
118
|
+
exports.revokeWorkflowPermissionTool = {
|
|
119
|
+
name: 'revoke_workflow_permission',
|
|
120
|
+
group: tool_registry_1.ToolGroup.WRITE,
|
|
121
|
+
description: "Remove a user or team's access to a workflow",
|
|
122
|
+
schema: zod_1.z.object({
|
|
123
|
+
workflowId: zod_1.z
|
|
124
|
+
.string()
|
|
125
|
+
.describe('The workflow ID to revoke permission on'),
|
|
126
|
+
memberId: zod_1.z
|
|
127
|
+
.string()
|
|
128
|
+
.describe('The user ID or team ID to remove access from'),
|
|
129
|
+
}),
|
|
130
|
+
async execute(args, context) {
|
|
131
|
+
logger.debug('Revoking workflow permission', {
|
|
132
|
+
workflowId: args.workflowId,
|
|
133
|
+
memberId: args.memberId,
|
|
134
|
+
apiKey: context.apiKey.substring(0, 8) + '...',
|
|
135
|
+
});
|
|
136
|
+
try {
|
|
137
|
+
const prefixedMemberId = ensureMemberPrefix(args.memberId);
|
|
138
|
+
// Step 1: Deny permissions (may fail if no explicit grant โ that's OK)
|
|
139
|
+
try {
|
|
140
|
+
await context.hailer.request('v2.process.permissions.deny', [args.workflowId, prefixedMemberId]);
|
|
141
|
+
}
|
|
142
|
+
catch (denyError) {
|
|
143
|
+
logger.debug('permissions.deny failed (possibly no explicit grant), continuing to remove', {
|
|
144
|
+
error: (0, index_1.getErrorMessage)(denyError),
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
// Step 2: Remove from members
|
|
148
|
+
const result = await context.hailer.request('v2.process.member.remove', [
|
|
149
|
+
args.workflowId,
|
|
150
|
+
prefixedMemberId,
|
|
151
|
+
]);
|
|
152
|
+
return (0, index_1.textResponse)(JSON.stringify({
|
|
153
|
+
success: true,
|
|
154
|
+
workflowId: args.workflowId,
|
|
155
|
+
memberId: prefixedMemberId,
|
|
156
|
+
result,
|
|
157
|
+
}, null, 2));
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
if (!request_logger_1.RequestLogger.getCurrent())
|
|
161
|
+
logger.error('Error revoking workflow permission', error);
|
|
162
|
+
const msg = error?.msg || error?.message || (0, index_1.getErrorMessage)(error);
|
|
163
|
+
return (0, index_1.errorResponse)(`Error revoking workflow permission: ${msg}`);
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
// ============================================================================
|
|
168
|
+
// TOOL 4: CHECK USER PERMISSIONS
|
|
169
|
+
// ============================================================================
|
|
170
|
+
exports.checkUserPermissionsTool = {
|
|
171
|
+
name: 'check_user_permissions',
|
|
172
|
+
group: tool_registry_1.ToolGroup.READ,
|
|
173
|
+
description: 'Check what permissions a specific user has in the workspace',
|
|
174
|
+
schema: zod_1.z.object({
|
|
175
|
+
userId: zod_1.z
|
|
176
|
+
.string()
|
|
177
|
+
.describe('The user ID to check permissions for'),
|
|
178
|
+
workspaceId: zod_1.z
|
|
179
|
+
.string()
|
|
180
|
+
.optional()
|
|
181
|
+
.describe('The workspace ID to check permissions in. Defaults to the current workspace.'),
|
|
182
|
+
}),
|
|
183
|
+
async execute(args, context) {
|
|
184
|
+
logger.debug('Checking user permissions', {
|
|
185
|
+
userId: args.userId,
|
|
186
|
+
apiKey: context.apiKey.substring(0, 8) + '...',
|
|
187
|
+
});
|
|
188
|
+
try {
|
|
189
|
+
const workspaceId = (0, tool_helpers_1.getResolvedWorkspaceId)(args, context);
|
|
190
|
+
const result = await context.hailer.request('v3.user.permissions', [
|
|
191
|
+
args.userId,
|
|
192
|
+
workspaceId,
|
|
193
|
+
]);
|
|
194
|
+
return (0, index_1.textResponse)(JSON.stringify(result, null, 2));
|
|
195
|
+
}
|
|
196
|
+
catch (error) {
|
|
197
|
+
if (!request_logger_1.RequestLogger.getCurrent())
|
|
198
|
+
logger.error('Error checking user permissions', error);
|
|
199
|
+
const msg = error?.msg || error?.message || (0, index_1.getErrorMessage)(error);
|
|
200
|
+
return (0, index_1.errorResponse)(`Error checking user permissions: ${msg}`);
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
};
|
|
204
|
+
//# sourceMappingURL=workflow-permissions.js.map
|
|
@@ -54,7 +54,13 @@ function parseErrorType(errorMessage) {
|
|
|
54
54
|
// ============================================================================
|
|
55
55
|
// READ TOOLS - Workflow Schema and Information
|
|
56
56
|
// ============================================================================
|
|
57
|
-
const getWorkflowSchemaDescription =
|
|
57
|
+
const getWorkflowSchemaDescription = `Get workflow field structure - CALL THIS BEFORE create_activity or update_activity.
|
|
58
|
+
|
|
59
|
+
**Hailer Concept:** Shows all fields (columns) in a workflow with their IDs, types, and options. You MUST know field IDs to create or update activities.
|
|
60
|
+
|
|
61
|
+
**Returns:** Field IDs, labels, types (text, numeric, date, dropdown, user, activitylink), required status, dropdown options.
|
|
62
|
+
|
|
63
|
+
**Critical:** Never guess field IDs - always get them from this tool first.`;
|
|
58
64
|
exports.getWorkflowSchemaTool = {
|
|
59
65
|
name: 'get_workflow_schema',
|
|
60
66
|
group: tool_registry_1.ToolGroup.READ,
|
|
@@ -179,7 +185,13 @@ exports.getWorkflowSchemaTool = {
|
|
|
179
185
|
}
|
|
180
186
|
},
|
|
181
187
|
};
|
|
182
|
-
const listWorkflowPhasesDescription =
|
|
188
|
+
const listWorkflowPhasesDescription = `List phases (stages/statuses) in a workflow - REQUIRED to get phase IDs.
|
|
189
|
+
|
|
190
|
+
**Hailer Concept:** Phases are stages like "New" โ "In Progress" โ "Done". Activities move through phases as work progresses.
|
|
191
|
+
|
|
192
|
+
**When to use:** Before list_activities (need phaseId), before create_activity (need initial phase), before update_activity (to move to new phase).
|
|
193
|
+
|
|
194
|
+
**Returns:** Phase names, IDs, which phase is initial (for new items), which is endpoint (completed).`;
|
|
183
195
|
exports.listWorkflowPhasesTool = {
|
|
184
196
|
name: 'list_workflow_phases',
|
|
185
197
|
group: tool_registry_1.ToolGroup.READ,
|
|
@@ -258,7 +270,15 @@ exports.listWorkflowPhasesTool = {
|
|
|
258
270
|
}
|
|
259
271
|
},
|
|
260
272
|
};
|
|
261
|
-
const listWorkflowsDescription = `List workflows
|
|
273
|
+
const listWorkflowsDescription = `List workflows (processes/pipelines) in the Hailer workspace.
|
|
274
|
+
|
|
275
|
+
**Hailer Concept:** A Workflow is like a database table or Kanban board - it defines a process with fields (columns) and phases (stages). Examples: "Sales Pipeline", "Customer Database", "Project Tasks".
|
|
276
|
+
|
|
277
|
+
**When to use:** To see all available workflows, find workflow IDs, or understand the workspace structure.
|
|
278
|
+
|
|
279
|
+
**Returns:** Workflow names, IDs, activity counts, and relationships between workflows.
|
|
280
|
+
|
|
281
|
+
**Next steps:** Use \`list_workflow_phases\` to see stages, then \`get_workflow_schema\` for field structure.`;
|
|
262
282
|
exports.listWorkflowsTool = {
|
|
263
283
|
name: 'list_workflows',
|
|
264
284
|
group: tool_registry_1.ToolGroup.READ,
|
|
@@ -1069,23 +1089,15 @@ ${errorMessage}
|
|
|
1069
1089
|
// ============================================================================
|
|
1070
1090
|
// TOOL 5: LIST WORKFLOWS MINIMAL
|
|
1071
1091
|
// ============================================================================
|
|
1072
|
-
const listWorkflowsMinimalDescription =
|
|
1092
|
+
const listWorkflowsMinimalDescription = `Quick list of all workflows - START HERE to find workflow IDs.
|
|
1073
1093
|
|
|
1074
|
-
|
|
1075
|
-
- Uses cached data from init (v2.core.init) - **ZERO extra API calls**
|
|
1076
|
-
- Returns activity counts for ALL workflows in one call
|
|
1077
|
-
- **Preferred method for getting bulk workflow counts**
|
|
1078
|
-
- Much faster and more efficient than calling \`count_activities\` for each workflow
|
|
1094
|
+
**Hailer Concept:** Returns all workflows (processes/boards) with their IDs and names. This is usually your FIRST CALL to discover what's available.
|
|
1079
1095
|
|
|
1080
|
-
**When to use this
|
|
1081
|
-
- โ
Use \`list_workflows_minimal\` for: Bulk counts, workflow discovery, listing all workflows with counts
|
|
1082
|
-
- โ Use \`count_activities\` for: Phase-level breakdown, real-time count for single workflow
|
|
1096
|
+
**When to use:** User asks "show my tasks", "what workflows do I have", "find customers" - use this to locate the right workflow ID.
|
|
1083
1097
|
|
|
1084
|
-
**
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
- Starred status
|
|
1088
|
-
- Workspace ID`;
|
|
1098
|
+
**Returns:** Workflow name, ID, activity count. Use the ID in subsequent calls.
|
|
1099
|
+
|
|
1100
|
+
**Typical flow:** list_workflows_minimal โ list_workflow_phases โ get_workflow_schema โ list_activities`;
|
|
1089
1101
|
const listWorkflowsMinimalSchema = zod_1.z.object({
|
|
1090
1102
|
workspace: zod_1.z.string().optional().describe("Optional workspace ID or name"),
|
|
1091
1103
|
limit: zod_1.z.coerce.number().optional().describe("Maximum number of workflows to return"),
|
|
@@ -1313,7 +1325,34 @@ const updateWorkflowPhaseSchema = zod_1.z.object({
|
|
|
1313
1325
|
// ============================================================================
|
|
1314
1326
|
// CORE INIT TOOL - Workspace overview for terminal Claude Code sessions
|
|
1315
1327
|
// ============================================================================
|
|
1316
|
-
const coreInitDescription =
|
|
1328
|
+
const coreInitDescription = `๐ START HERE - Load workspace context and learn how to use Hailer tools.
|
|
1329
|
+
|
|
1330
|
+
## What is Hailer?
|
|
1331
|
+
Hailer is a workspace platform. Key concepts:
|
|
1332
|
+
- **Workflow** = process/board (like "Tasks", "Customers", "Sales Pipeline")
|
|
1333
|
+
- **Activity** = item/record/card in a workflow
|
|
1334
|
+
- **Phase** = stage/status (like "New" โ "In Progress" โ "Done")
|
|
1335
|
+
- **Field** = property/column on an activity (name, date, priority, etc.)
|
|
1336
|
+
|
|
1337
|
+
## How to use these tools:
|
|
1338
|
+
|
|
1339
|
+
**Step 1 - Find workflow:** \`list_workflows_minimal\` โ get workflow ID
|
|
1340
|
+
**Step 2 - Get phases:** \`list_workflow_phases(workflowId)\` โ get phase IDs
|
|
1341
|
+
**Step 3 - Get fields:** \`get_workflow_schema(workflowId, phaseId)\` โ get field IDs
|
|
1342
|
+
**Step 4 - Read/Write:**
|
|
1343
|
+
- \`list_activities\` - see items (requires workflowId, phaseId, fields[])
|
|
1344
|
+
- \`create_activity\` - create item (requires workflowId, use field IDs from schema)
|
|
1345
|
+
- \`update_activity\` - update item (requires activityId, use field IDs)
|
|
1346
|
+
|
|
1347
|
+
## Field value formats:
|
|
1348
|
+
- Text: \`"value"\`
|
|
1349
|
+
- Number: \`42\`
|
|
1350
|
+
- Date: Unix timestamp in ms \`1730937600000\`
|
|
1351
|
+
- Dropdown: exact option string \`"High"\`
|
|
1352
|
+
- User: user ID string \`"5f8a1b2c..."\`
|
|
1353
|
+
|
|
1354
|
+
## This tool returns:
|
|
1355
|
+
All workflows, phases, fields, and teams with IDs. Reference this data for all other calls.`;
|
|
1317
1356
|
exports.coreInitTool = {
|
|
1318
1357
|
name: 'core_init',
|
|
1319
1358
|
group: tool_registry_1.ToolGroup.READ,
|
|
@@ -12,5 +12,7 @@ export { transformActivity, transformActivities, transformFields, transformField
|
|
|
12
12
|
export { textResponse, errorResponse, successResponse, jsonResponse, paginatedResponse, listResponse, getErrorMessage, withErrorHandling, isErrorResponse } from './response-builder';
|
|
13
13
|
export { normalizePagination, calculatePaginationMeta, formatPaginationText } from './pagination';
|
|
14
14
|
export type { PaginationMeta, PaginationOptions } from './pagination';
|
|
15
|
+
export { deriveUserRole, getAllowedGroups, findCurrentUserMember, extractWorkspaceRoles, getAllowedGroupsForWorkspace, getMaxRole, checkWorkspaceAccess } from './role-utils';
|
|
15
16
|
export type * from './types';
|
|
17
|
+
export { normalizeInitProcesses } from './types';
|
|
16
18
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/mcp/utils/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Provides centralized access to all utility functions and types
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.formatPaginationText = exports.calculatePaginationMeta = exports.normalizePagination = exports.isErrorResponse = exports.withErrorHandling = exports.getErrorMessage = exports.listResponse = exports.paginatedResponse = exports.jsonResponse = exports.successResponse = exports.errorResponse = exports.textResponse = exports.formatActivityListResponse = exports.formatUserName = exports.formatTimestamp = exports.transformWorkflowFields = exports.transformPhases = exports.transformWorkflow = exports.findFieldByKey = exports.transformFieldValue = exports.transformFields = exports.transformActivities = exports.transformActivity = exports.HailerApiClient = exports.createSuccessResponse = exports.createErrorResponse = exports.handleApiResponse = exports.makeApiCall = exports.HailerApiError = exports.LogTag = exports.LogLevel = exports.logger = exports.createLogger = void 0;
|
|
7
|
+
exports.normalizeInitProcesses = exports.checkWorkspaceAccess = exports.getMaxRole = exports.getAllowedGroupsForWorkspace = exports.extractWorkspaceRoles = exports.findCurrentUserMember = exports.getAllowedGroups = exports.deriveUserRole = exports.formatPaginationText = exports.calculatePaginationMeta = exports.normalizePagination = exports.isErrorResponse = exports.withErrorHandling = exports.getErrorMessage = exports.listResponse = exports.paginatedResponse = exports.jsonResponse = exports.successResponse = exports.errorResponse = exports.textResponse = exports.formatActivityListResponse = exports.formatUserName = exports.formatTimestamp = exports.transformWorkflowFields = exports.transformPhases = exports.transformWorkflow = exports.findFieldByKey = exports.transformFieldValue = exports.transformFields = exports.transformActivities = exports.transformActivity = exports.HailerApiClient = exports.createSuccessResponse = exports.createErrorResponse = exports.handleApiResponse = exports.makeApiCall = exports.HailerApiError = exports.LogTag = exports.LogLevel = exports.logger = exports.createLogger = void 0;
|
|
8
8
|
// Logging utilities
|
|
9
9
|
var logger_1 = require("../../lib/logger");
|
|
10
10
|
Object.defineProperty(exports, "createLogger", { enumerable: true, get: function () { return logger_1.createLogger; } });
|
|
@@ -50,4 +50,15 @@ var pagination_1 = require("./pagination");
|
|
|
50
50
|
Object.defineProperty(exports, "normalizePagination", { enumerable: true, get: function () { return pagination_1.normalizePagination; } });
|
|
51
51
|
Object.defineProperty(exports, "calculatePaginationMeta", { enumerable: true, get: function () { return pagination_1.calculatePaginationMeta; } });
|
|
52
52
|
Object.defineProperty(exports, "formatPaginationText", { enumerable: true, get: function () { return pagination_1.formatPaginationText; } });
|
|
53
|
+
// Role-based access control
|
|
54
|
+
var role_utils_1 = require("./role-utils");
|
|
55
|
+
Object.defineProperty(exports, "deriveUserRole", { enumerable: true, get: function () { return role_utils_1.deriveUserRole; } });
|
|
56
|
+
Object.defineProperty(exports, "getAllowedGroups", { enumerable: true, get: function () { return role_utils_1.getAllowedGroups; } });
|
|
57
|
+
Object.defineProperty(exports, "findCurrentUserMember", { enumerable: true, get: function () { return role_utils_1.findCurrentUserMember; } });
|
|
58
|
+
Object.defineProperty(exports, "extractWorkspaceRoles", { enumerable: true, get: function () { return role_utils_1.extractWorkspaceRoles; } });
|
|
59
|
+
Object.defineProperty(exports, "getAllowedGroupsForWorkspace", { enumerable: true, get: function () { return role_utils_1.getAllowedGroupsForWorkspace; } });
|
|
60
|
+
Object.defineProperty(exports, "getMaxRole", { enumerable: true, get: function () { return role_utils_1.getMaxRole; } });
|
|
61
|
+
Object.defineProperty(exports, "checkWorkspaceAccess", { enumerable: true, get: function () { return role_utils_1.checkWorkspaceAccess; } });
|
|
62
|
+
var types_1 = require("./types");
|
|
63
|
+
Object.defineProperty(exports, "normalizeInitProcesses", { enumerable: true, get: function () { return types_1.normalizeInitProcesses; } });
|
|
53
64
|
//# sourceMappingURL=index.js.map
|