crewx 0.1.0 → 0.1.2
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/LICENSE +197 -9
- package/README.md +120 -28
- package/crewx.yaml +1273 -0
- package/dist/agent.types.d.ts +92 -0
- package/dist/agent.types.js +16 -0
- package/dist/agent.types.js.map +1 -0
- package/dist/ai-provider.service.d.ts +25 -0
- package/dist/ai-provider.service.js +138 -0
- package/dist/ai-provider.service.js.map +1 -0
- package/dist/ai.service.d.ts +50 -0
- package/dist/ai.service.js +625 -0
- package/dist/ai.service.js.map +1 -0
- package/dist/app.module.d.ts +5 -0
- package/dist/app.module.js +88 -0
- package/dist/app.module.js.map +1 -0
- package/dist/cli/chat.handler.d.ts +19 -0
- package/dist/cli/chat.handler.js +429 -0
- package/dist/cli/chat.handler.js.map +1 -0
- package/dist/cli/cli.handler.d.ts +4 -0
- package/dist/cli/cli.handler.js +93 -0
- package/dist/cli/cli.handler.js.map +1 -0
- package/dist/cli/doctor.handler.d.ts +36 -0
- package/dist/cli/doctor.handler.js +382 -0
- package/dist/cli/doctor.handler.js.map +1 -0
- package/dist/cli/execute.handler.d.ts +2 -0
- package/dist/cli/execute.handler.js +269 -0
- package/dist/cli/execute.handler.js.map +1 -0
- package/dist/cli/help.handler.d.ts +2 -0
- package/dist/cli/help.handler.js +10 -0
- package/dist/cli/help.handler.js.map +1 -0
- package/dist/cli/init.handler.d.ts +25 -0
- package/dist/cli/init.handler.js +355 -0
- package/dist/cli/init.handler.js.map +1 -0
- package/dist/cli/query.handler.d.ts +2 -0
- package/dist/cli/query.handler.js +351 -0
- package/dist/cli/query.handler.js.map +1 -0
- package/dist/cli/templates.handler.d.ts +2 -0
- package/dist/cli/templates.handler.js +100 -0
- package/dist/cli/templates.handler.js.map +1 -0
- package/dist/cli-options.d.ts +22 -0
- package/dist/cli-options.js +195 -0
- package/dist/cli-options.js.map +1 -0
- package/dist/config/timeout.config.d.ts +14 -0
- package/dist/config/timeout.config.js +34 -0
- package/dist/config/timeout.config.js.map +1 -0
- package/dist/constants.d.ts +4 -0
- package/dist/constants.js +8 -0
- package/dist/constants.js.map +1 -0
- package/dist/conversation/base-conversation-history.provider.d.ts +12 -0
- package/dist/conversation/base-conversation-history.provider.js +45 -0
- package/dist/conversation/base-conversation-history.provider.js.map +1 -0
- package/dist/conversation/cli-conversation-history.provider.d.ts +16 -0
- package/dist/conversation/cli-conversation-history.provider.js +104 -0
- package/dist/conversation/cli-conversation-history.provider.js.map +1 -0
- package/dist/conversation/conversation-config.d.ts +9 -0
- package/dist/conversation/conversation-config.js +25 -0
- package/dist/conversation/conversation-config.js.map +1 -0
- package/dist/conversation/conversation-history.interface.d.ts +25 -0
- package/dist/conversation/conversation-history.interface.js +3 -0
- package/dist/conversation/conversation-history.interface.js.map +1 -0
- package/dist/conversation/conversation-provider.factory.d.ts +10 -0
- package/dist/conversation/conversation-provider.factory.js +50 -0
- package/dist/conversation/conversation-provider.factory.js.map +1 -0
- package/dist/conversation/conversation-storage.service.d.ts +15 -0
- package/dist/conversation/conversation-storage.service.js +182 -0
- package/dist/conversation/conversation-storage.service.js.map +1 -0
- package/dist/conversation/index.d.ts +7 -0
- package/dist/conversation/index.js +24 -0
- package/dist/conversation/index.js.map +1 -0
- package/dist/conversation/slack-conversation-history.provider.d.ts +22 -0
- package/dist/conversation/slack-conversation-history.provider.js +239 -0
- package/dist/conversation/slack-conversation-history.provider.js.map +1 -0
- package/dist/crewx.tool.d.ts +421 -0
- package/dist/crewx.tool.js +1240 -0
- package/dist/crewx.tool.js.map +1 -0
- package/dist/knowledge/DocumentManager.d.ts +4 -0
- package/dist/knowledge/DocumentManager.js +119 -0
- package/dist/knowledge/DocumentManager.js.map +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +230 -0
- package/dist/main.js.map +1 -0
- package/dist/mcp.controller.d.ts +8 -0
- package/dist/mcp.controller.js +60 -0
- package/dist/mcp.controller.js.map +1 -0
- package/dist/project.service.d.ts +44 -0
- package/dist/project.service.js +299 -0
- package/dist/project.service.js.map +1 -0
- package/dist/providers/ai-provider.interface.d.ts +30 -0
- package/dist/providers/ai-provider.interface.js +11 -0
- package/dist/providers/ai-provider.interface.js.map +1 -0
- package/dist/providers/base-ai.provider.d.ts +42 -0
- package/dist/providers/base-ai.provider.js +515 -0
- package/dist/providers/base-ai.provider.js.map +1 -0
- package/dist/providers/claude.provider.d.ts +25 -0
- package/dist/providers/claude.provider.js +376 -0
- package/dist/providers/claude.provider.js.map +1 -0
- package/dist/providers/copilot.provider.d.ts +25 -0
- package/dist/providers/copilot.provider.js +280 -0
- package/dist/providers/copilot.provider.js.map +1 -0
- package/dist/providers/gemini.provider.d.ts +22 -0
- package/dist/providers/gemini.provider.js +163 -0
- package/dist/providers/gemini.provider.js.map +1 -0
- package/dist/services/agent-loader.service.d.ts +23 -0
- package/dist/services/agent-loader.service.js +313 -0
- package/dist/services/agent-loader.service.js.map +1 -0
- package/dist/services/config-validator.service.d.ts +28 -0
- package/dist/services/config-validator.service.js +427 -0
- package/dist/services/config-validator.service.js.map +1 -0
- package/dist/services/config.service.d.ts +25 -0
- package/dist/services/config.service.js +102 -0
- package/dist/services/config.service.js.map +1 -0
- package/dist/services/context-enhancement.service.d.ts +13 -0
- package/dist/services/context-enhancement.service.js +169 -0
- package/dist/services/context-enhancement.service.js.map +1 -0
- package/dist/services/document-loader.service.d.ts +16 -0
- package/dist/services/document-loader.service.js +137 -0
- package/dist/services/document-loader.service.js.map +1 -0
- package/dist/services/help.service.d.ts +5 -0
- package/dist/services/help.service.js +112 -0
- package/dist/services/help.service.js.map +1 -0
- package/dist/services/intelligent-compression.service.d.ts +20 -0
- package/dist/services/intelligent-compression.service.js +179 -0
- package/dist/services/intelligent-compression.service.js.map +1 -0
- package/dist/services/parallel-processing.service.d.ts +108 -0
- package/dist/services/parallel-processing.service.js +266 -0
- package/dist/services/parallel-processing.service.js.map +1 -0
- package/dist/services/result-formatter.service.d.ts +27 -0
- package/dist/services/result-formatter.service.js +126 -0
- package/dist/services/result-formatter.service.js.map +1 -0
- package/dist/services/task-management.service.d.ts +63 -0
- package/dist/services/task-management.service.js +270 -0
- package/dist/services/task-management.service.js.map +1 -0
- package/dist/services/template.service.d.ts +36 -0
- package/dist/services/template.service.js +195 -0
- package/dist/services/template.service.js.map +1 -0
- package/dist/services/tool-call.service.d.ts +53 -0
- package/dist/services/tool-call.service.js +819 -0
- package/dist/services/tool-call.service.js.map +1 -0
- package/dist/slack/formatters/message.formatter.d.ts +25 -0
- package/dist/slack/formatters/message.formatter.js +246 -0
- package/dist/slack/formatters/message.formatter.js.map +1 -0
- package/dist/slack/slack-bot.d.ts +23 -0
- package/dist/slack/slack-bot.js +435 -0
- package/dist/slack/slack-bot.js.map +1 -0
- package/dist/stderr.logger.d.ts +8 -0
- package/dist/stderr.logger.js +26 -0
- package/dist/stderr.logger.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/utils/config-utils.d.ts +15 -0
- package/dist/utils/config-utils.js +69 -0
- package/dist/utils/config-utils.js.map +1 -0
- package/dist/utils/error-utils.d.ts +3 -0
- package/dist/utils/error-utils.js +27 -0
- package/dist/utils/error-utils.js.map +1 -0
- package/dist/utils/math-utils.d.ts +3 -0
- package/dist/utils/math-utils.js +10 -0
- package/dist/utils/math-utils.js.map +1 -0
- package/dist/utils/mcp-installer.d.ts +20 -0
- package/dist/utils/mcp-installer.js +199 -0
- package/dist/utils/mcp-installer.js.map +1 -0
- package/dist/utils/mention-parser.d.ts +18 -0
- package/dist/utils/mention-parser.js +136 -0
- package/dist/utils/mention-parser.js.map +1 -0
- package/dist/utils/simple-security.d.ts +3 -0
- package/dist/utils/simple-security.js +20 -0
- package/dist/utils/simple-security.js.map +1 -0
- package/dist/utils/stdin-utils.d.ts +2 -0
- package/dist/utils/stdin-utils.js +87 -0
- package/dist/utils/stdin-utils.js.map +1 -0
- package/dist/utils/string-utils.d.ts +1 -0
- package/dist/utils/string-utils.js +10 -0
- package/dist/utils/string-utils.js.map +1 -0
- package/dist/utils/template-processor.d.ts +32 -0
- package/dist/utils/template-processor.js +188 -0
- package/dist/utils/template-processor.js.map +1 -0
- package/docs/agent-configuration.md +373 -0
- package/docs/agent-registry-strategy.md +348 -0
- package/docs/branding-decision-crewx.md +395 -0
- package/docs/claude-code-docker-guide.md +264 -0
- package/docs/cli-guide.md +295 -0
- package/docs/development.md +595 -0
- package/docs/guides/agent-best-practices.md +97 -0
- package/docs/guides/bug-management.md +600 -0
- package/docs/guides/git-bug-reference.md +366 -0
- package/docs/mcp-integration.md +187 -0
- package/docs/process/development-workflow.md +84 -0
- package/docs/roadmap.md +528 -0
- package/docs/rules/branch-protection.md +40 -0
- package/docs/standards/rc-versioning.md +60 -0
- package/docs/standards/report-structure.md +67 -0
- package/docs/templates.md +517 -0
- package/docs/tools.md +583 -0
- package/docs/troubleshooting.md +585 -0
- package/package.json +106 -21
- package/bin/crewx.js +0 -20
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.parseCliOptions = parseCliOptions;
|
|
40
|
+
const yargs_1 = __importDefault(require("yargs"));
|
|
41
|
+
const helpers_1 = require("yargs/helpers");
|
|
42
|
+
const fs = __importStar(require("fs"));
|
|
43
|
+
const path = __importStar(require("path"));
|
|
44
|
+
function parseCliOptions() {
|
|
45
|
+
const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, '../package.json'), 'utf-8'));
|
|
46
|
+
const parsed = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
|
|
47
|
+
.version(packageJson.version)
|
|
48
|
+
.command('query [message...]', 'Query agents with a message', (yargs) => {
|
|
49
|
+
yargs.positional('message', {
|
|
50
|
+
description: 'Message to send to agents (supports @agent mentions). Multiple arguments will be joined.',
|
|
51
|
+
type: 'string',
|
|
52
|
+
array: true
|
|
53
|
+
});
|
|
54
|
+
})
|
|
55
|
+
.command('q [message...]', 'Shorthand for query', (yargs) => {
|
|
56
|
+
yargs.positional('message', {
|
|
57
|
+
description: 'Message to send to agents (supports @agent mentions). Multiple arguments will be joined.',
|
|
58
|
+
type: 'string',
|
|
59
|
+
array: true
|
|
60
|
+
});
|
|
61
|
+
})
|
|
62
|
+
.command('execute [task...]', 'Execute a task with agents', (yargs) => {
|
|
63
|
+
yargs.positional('task', {
|
|
64
|
+
description: 'Task to execute with agents (supports @agent mentions). Multiple arguments will be joined.',
|
|
65
|
+
type: 'string',
|
|
66
|
+
array: true
|
|
67
|
+
});
|
|
68
|
+
})
|
|
69
|
+
.command('x [task...]', 'Shorthand for execute', (yargs) => {
|
|
70
|
+
yargs.positional('task', {
|
|
71
|
+
description: 'Task to execute with agents (supports @agent mentions). Multiple arguments will be joined.',
|
|
72
|
+
type: 'string',
|
|
73
|
+
array: true
|
|
74
|
+
});
|
|
75
|
+
})
|
|
76
|
+
.command('doctor', 'Check AI provider status', () => { })
|
|
77
|
+
.command('init', 'Initialize CodeCrew project', (yargs) => {
|
|
78
|
+
yargs.option('template', {
|
|
79
|
+
alias: 't',
|
|
80
|
+
type: 'string',
|
|
81
|
+
default: 'default',
|
|
82
|
+
description: 'Template to use (default, minimal, development, production)'
|
|
83
|
+
});
|
|
84
|
+
yargs.option('template-version', {
|
|
85
|
+
type: 'string',
|
|
86
|
+
default: 'main',
|
|
87
|
+
description: 'Template version to download (main, v0.1.8, etc.)'
|
|
88
|
+
});
|
|
89
|
+
yargs.option('force', {
|
|
90
|
+
alias: 'f',
|
|
91
|
+
type: 'boolean',
|
|
92
|
+
default: false,
|
|
93
|
+
description: 'Overwrite existing configuration file'
|
|
94
|
+
});
|
|
95
|
+
})
|
|
96
|
+
.command('templates', 'Manage agent templates', (yargs) => {
|
|
97
|
+
yargs.command('list', 'List available templates');
|
|
98
|
+
yargs.command('update', 'Clear cache and re-download templates');
|
|
99
|
+
})
|
|
100
|
+
.command('mcp', 'Start MCP server for IDE integration', () => { })
|
|
101
|
+
.command('slack', 'Start Slack Bot server', (yargs) => {
|
|
102
|
+
yargs.option('agent', {
|
|
103
|
+
alias: 'a',
|
|
104
|
+
type: 'string',
|
|
105
|
+
default: 'claude',
|
|
106
|
+
description: 'Default agent to use for Slack conversations (claude, copilot, gemini, or custom agent ID)'
|
|
107
|
+
});
|
|
108
|
+
})
|
|
109
|
+
.command('help', 'Show help', () => { })
|
|
110
|
+
.option('install', {
|
|
111
|
+
type: 'boolean',
|
|
112
|
+
default: false,
|
|
113
|
+
description: 'Run installation and setup process'
|
|
114
|
+
})
|
|
115
|
+
.option('log', {
|
|
116
|
+
type: 'boolean',
|
|
117
|
+
default: false,
|
|
118
|
+
description: 'Enable detailed logging'
|
|
119
|
+
})
|
|
120
|
+
.option('protocol', {
|
|
121
|
+
choices: ['STDIO', 'HTTP'],
|
|
122
|
+
default: 'STDIO',
|
|
123
|
+
description: 'MCP protocol to use'
|
|
124
|
+
})
|
|
125
|
+
.option('port', {
|
|
126
|
+
type: 'number',
|
|
127
|
+
default: 3000,
|
|
128
|
+
description: 'Port for HTTP protocol (if used)'
|
|
129
|
+
})
|
|
130
|
+
.option('config', {
|
|
131
|
+
alias: 'c',
|
|
132
|
+
type: 'string',
|
|
133
|
+
description: 'Path to agents configuration file (default: crewx.yaml or agents.yaml)'
|
|
134
|
+
})
|
|
135
|
+
.option('allow-tool', {
|
|
136
|
+
type: 'array',
|
|
137
|
+
default: [],
|
|
138
|
+
description: 'Allowed tools for Copilot agent (e.g., terminal,files,web)',
|
|
139
|
+
coerce: (value) => {
|
|
140
|
+
if (typeof value === 'string') {
|
|
141
|
+
return value.split(',').map(tool => tool.trim());
|
|
142
|
+
}
|
|
143
|
+
return value || [];
|
|
144
|
+
}
|
|
145
|
+
})
|
|
146
|
+
.option('raw', {
|
|
147
|
+
type: 'boolean',
|
|
148
|
+
default: false,
|
|
149
|
+
description: 'Output only AI response without formatting (useful for piping)'
|
|
150
|
+
})
|
|
151
|
+
.option('load-project-context', {
|
|
152
|
+
type: 'boolean',
|
|
153
|
+
default: true,
|
|
154
|
+
description: 'Load project context from CLAUDE.md files'
|
|
155
|
+
})
|
|
156
|
+
.option('project-context-max-length', {
|
|
157
|
+
type: 'number',
|
|
158
|
+
default: 2000,
|
|
159
|
+
description: 'Maximum length for project context'
|
|
160
|
+
})
|
|
161
|
+
.option('enable-intelligent-compression', {
|
|
162
|
+
type: 'boolean',
|
|
163
|
+
default: true,
|
|
164
|
+
description: 'Use intelligent conversation compression'
|
|
165
|
+
})
|
|
166
|
+
.option('thread', {
|
|
167
|
+
alias: 't',
|
|
168
|
+
type: 'string',
|
|
169
|
+
description: 'Thread ID for conversation continuity'
|
|
170
|
+
})
|
|
171
|
+
.help(false)
|
|
172
|
+
.parseSync();
|
|
173
|
+
return {
|
|
174
|
+
install: parsed.install,
|
|
175
|
+
log: parsed.log,
|
|
176
|
+
protocol: parsed.protocol,
|
|
177
|
+
port: parsed.port,
|
|
178
|
+
allowTool: parsed['allow-tool'] || [],
|
|
179
|
+
raw: parsed.raw,
|
|
180
|
+
loadProjectContext: parsed['load-project-context'],
|
|
181
|
+
projectContextMaxLength: parsed['project-context-max-length'],
|
|
182
|
+
enableIntelligentCompression: parsed['enable-intelligent-compression'],
|
|
183
|
+
thread: parsed.thread,
|
|
184
|
+
command: parsed._[0],
|
|
185
|
+
query: Array.isArray(parsed.message) ? parsed.message : (parsed.message ? [parsed.message] : undefined),
|
|
186
|
+
execute: Array.isArray(parsed.task) ? parsed.task : (parsed.task ? [parsed.task] : undefined),
|
|
187
|
+
doctor: parsed._[0] === 'doctor',
|
|
188
|
+
config: parsed.config,
|
|
189
|
+
template: parsed.template,
|
|
190
|
+
templateVersion: parsed['template-version'],
|
|
191
|
+
force: parsed.force,
|
|
192
|
+
slackAgent: parsed.agent
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
//# sourceMappingURL=cli-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-options.js","sourceRoot":"","sources":["../src/cli-options.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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C,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAc,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACvG,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,QAAQ;QAChC,MAAM,EAAE,MAAM,CAAC,MAAM;QAErB,QAAQ,EAAE,MAAM,CAAC,QAAkB;QACnC,eAAe,EAAE,MAAM,CAAC,kBAAkB,CAAW;QACrD,KAAK,EAAE,MAAM,CAAC,KAAgB;QAE9B,UAAU,EAAE,MAAM,CAAC,KAAe;KACnC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface TimeoutConfig {
|
|
2
|
+
claudeQuery: number;
|
|
3
|
+
claudeExecute: number;
|
|
4
|
+
geminiQuery: number;
|
|
5
|
+
geminiExecute: number;
|
|
6
|
+
copilotQuery: number;
|
|
7
|
+
copilotExecute: number;
|
|
8
|
+
parallel: number;
|
|
9
|
+
stdinInitial: number;
|
|
10
|
+
stdinChunk: number;
|
|
11
|
+
stdinComplete: number;
|
|
12
|
+
}
|
|
13
|
+
export declare function getTimeoutConfig(): TimeoutConfig;
|
|
14
|
+
export declare function getDefaultTimeoutConfig(): TimeoutConfig;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTimeoutConfig = getTimeoutConfig;
|
|
4
|
+
exports.getDefaultTimeoutConfig = getDefaultTimeoutConfig;
|
|
5
|
+
const DEFAULT_TIMEOUTS = {
|
|
6
|
+
claudeQuery: 1800000,
|
|
7
|
+
claudeExecute: 1800000,
|
|
8
|
+
geminiQuery: 1800000,
|
|
9
|
+
geminiExecute: 1800000,
|
|
10
|
+
copilotQuery: 1800000,
|
|
11
|
+
copilotExecute: 1800000,
|
|
12
|
+
parallel: 1800000,
|
|
13
|
+
stdinInitial: 30000,
|
|
14
|
+
stdinChunk: 1800000,
|
|
15
|
+
stdinComplete: 100,
|
|
16
|
+
};
|
|
17
|
+
function getTimeoutConfig() {
|
|
18
|
+
return {
|
|
19
|
+
claudeQuery: parseInt(process.env.CREWCODE_TIMEOUT_CLAUDE_QUERY || '') || DEFAULT_TIMEOUTS.claudeQuery,
|
|
20
|
+
claudeExecute: parseInt(process.env.CREWCODE_TIMEOUT_CLAUDE_EXECUTE || '') || DEFAULT_TIMEOUTS.claudeExecute,
|
|
21
|
+
geminiQuery: parseInt(process.env.CREWCODE_TIMEOUT_GEMINI_QUERY || '') || DEFAULT_TIMEOUTS.geminiQuery,
|
|
22
|
+
geminiExecute: parseInt(process.env.CREWCODE_TIMEOUT_GEMINI_EXECUTE || '') || DEFAULT_TIMEOUTS.geminiExecute,
|
|
23
|
+
copilotQuery: parseInt(process.env.CREWCODE_TIMEOUT_COPILOT_QUERY || '') || DEFAULT_TIMEOUTS.copilotQuery,
|
|
24
|
+
copilotExecute: parseInt(process.env.CREWCODE_TIMEOUT_COPILOT_EXECUTE || '') || DEFAULT_TIMEOUTS.copilotExecute,
|
|
25
|
+
parallel: parseInt(process.env.CREWCODE_TIMEOUT_PARALLEL || '') || DEFAULT_TIMEOUTS.parallel,
|
|
26
|
+
stdinInitial: parseInt(process.env.CREWCODE_TIMEOUT_STDIN_INITIAL || '') || DEFAULT_TIMEOUTS.stdinInitial,
|
|
27
|
+
stdinChunk: parseInt(process.env.CREWCODE_TIMEOUT_STDIN_CHUNK || '') || DEFAULT_TIMEOUTS.stdinChunk,
|
|
28
|
+
stdinComplete: parseInt(process.env.CREWCODE_TIMEOUT_STDIN_COMPLETE || '') || DEFAULT_TIMEOUTS.stdinComplete,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function getDefaultTimeoutConfig() {
|
|
32
|
+
return { ...DEFAULT_TIMEOUTS };
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=timeout.config.js.map
|
|
@@ -0,0 +1 @@
|
|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,GAAG,CAAC,8BAA8B,IAAI,EAAE,CAAC,IAAI,gBAAgB,CAAC,YAAY;QACzG,UAAU,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,4BAA4B,IAAI,EAAE,CAAC,IAAI,gBAAgB,CAAC,UAAU;QACnG,aAAa,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,+BAA+B,IAAI,EAAE,CAAC,IAAI,gBAAgB,CAAC,aAAa;KAC7G,CAAC;AACJ,CAAC;AAKD,SAAgB,uBAAuB;IACrC,OAAO,EAAE,GAAG,gBAAgB,EAAE,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_MAX_FILES = exports.DEFAULT_MAX_FILE_SIZE = exports.PREFIX_TOOL_NAME = exports.SERVER_NAME = void 0;
|
|
4
|
+
exports.SERVER_NAME = 'crewx';
|
|
5
|
+
exports.PREFIX_TOOL_NAME = 'crewx_';
|
|
6
|
+
exports.DEFAULT_MAX_FILE_SIZE = 1024 * 1024;
|
|
7
|
+
exports.DEFAULT_MAX_FILES = 100;
|
|
8
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG,OAAO,CAAC;AACtB,QAAA,gBAAgB,GAAG,QAAQ,CAAC;AAC5B,QAAA,qBAAqB,GAAG,IAAI,GAAG,IAAI,CAAC;AACpC,QAAA,iBAAiB,GAAG,GAAG,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Logger } from '@nestjs/common';
|
|
2
|
+
import { ConversationThread, FetchHistoryOptions, IConversationHistoryProvider } from './conversation-history.interface';
|
|
3
|
+
import { IntelligentCompressionService } from '../services/intelligent-compression.service';
|
|
4
|
+
export declare abstract class BaseConversationHistoryProvider implements IConversationHistoryProvider {
|
|
5
|
+
protected readonly logger: Logger;
|
|
6
|
+
protected compressionService?: IntelligentCompressionService;
|
|
7
|
+
constructor(loggerContext: string, compressionService?: IntelligentCompressionService);
|
|
8
|
+
abstract fetchHistory(threadId: string, options?: FetchHistoryOptions): Promise<ConversationThread>;
|
|
9
|
+
abstract hasHistory(threadId: string): Promise<boolean>;
|
|
10
|
+
formatForAI(thread: ConversationThread, options?: FetchHistoryOptions): Promise<string>;
|
|
11
|
+
protected sanitizeMessage(text: string): string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseConversationHistoryProvider = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
class BaseConversationHistoryProvider {
|
|
6
|
+
constructor(loggerContext, compressionService) {
|
|
7
|
+
this.logger = new common_1.Logger(loggerContext);
|
|
8
|
+
this.compressionService = compressionService;
|
|
9
|
+
}
|
|
10
|
+
async formatForAI(thread, options) {
|
|
11
|
+
const maxLength = options?.maxContextLength || 4000;
|
|
12
|
+
const limit = options?.limit || 20;
|
|
13
|
+
const excludeCurrent = options?.excludeCurrent ?? true;
|
|
14
|
+
let messages = [...thread.messages];
|
|
15
|
+
if (excludeCurrent && messages.length > 0) {
|
|
16
|
+
messages = messages.slice(0, -1);
|
|
17
|
+
}
|
|
18
|
+
if (messages.length === 0) {
|
|
19
|
+
return '';
|
|
20
|
+
}
|
|
21
|
+
if (this.compressionService && messages.length > limit) {
|
|
22
|
+
this.logger.debug(`Using intelligent compression for ${messages.length} messages`);
|
|
23
|
+
const threadForCompression = {
|
|
24
|
+
...thread,
|
|
25
|
+
messages: messages
|
|
26
|
+
};
|
|
27
|
+
return await this.compressionService.compressConversationHistory(threadForCompression, {
|
|
28
|
+
maxTokens: Math.floor(maxLength / 4),
|
|
29
|
+
maxMessages: limit,
|
|
30
|
+
preserveRecentCount: Math.min(5, Math.floor(limit / 4)),
|
|
31
|
+
preserveImportant: true
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return '';
|
|
35
|
+
}
|
|
36
|
+
sanitizeMessage(text) {
|
|
37
|
+
return text
|
|
38
|
+
.replace(/password[:\s]*\S+/gi, 'password: ***')
|
|
39
|
+
.replace(/token[:\s]*\S+/gi, 'token: ***')
|
|
40
|
+
.replace(/api[_-]?key[:\s]*\S+/gi, 'api_key: ***')
|
|
41
|
+
.replace(/secret[:\s]*\S+/gi, 'secret: ***');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.BaseConversationHistoryProvider = BaseConversationHistoryProvider;
|
|
45
|
+
//# sourceMappingURL=base-conversation-history.provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-conversation-history.provider.js","sourceRoot":"","sources":["../../src/conversation/base-conversation-history.provider.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AAYxC,MAAsB,+BAA+B;IAMnD,YACE,aAAqB,EACrB,kBAAkD;QAElD,IAAI,CAAC,MAAM,GAAG,IAAI,eAAM,CAAC,aAAa,CAAC,CAAC;QACxC,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IAC/C,CAAC;IAcD,KAAK,CAAC,WAAW,CACf,MAA0B,EAC1B,OAA6B;QAE7B,MAAM,SAAS,GAAG,OAAO,EAAE,gBAAgB,IAAI,IAAI,CAAC;QACpD,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC;QACnC,MAAM,cAAc,GAAG,OAAO,EAAE,cAAc,IAAI,IAAI,CAAC;QAEvD,IAAI,QAAQ,GAAG,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QAGpC,IAAI,cAAc,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC1C,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACnC,CAAC;QAGD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1B,OAAO,EAAE,CAAC;QACZ,CAAC;QAGD,IAAI,IAAI,CAAC,kBAAkB,IAAI,QAAQ,CAAC,MAAM,GAAG,KAAK,EAAE,CAAC;YACvD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,qCAAqC,QAAQ,CAAC,MAAM,WAAW,CAAC,CAAC;YAEnF,MAAM,oBAAoB,GAAuB;gBAC/C,GAAG,MAAM;gBACT,QAAQ,EAAE,QAAQ;aACnB,CAAC;YAEF,OAAO,MAAM,IAAI,CAAC,kBAAkB,CAAC,2BAA2B,CAC9D,oBAAoB,EACpB;gBACE,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC;gBACpC,WAAW,EAAE,KAAK;gBAClB,mBAAmB,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;gBACvD,iBAAiB,EAAE,IAAI;aACxB,CACF,CAAC;QACJ,CAAC;QAMD,OAAO,EAAE,CAAC;IACZ,CAAC;IAKS,eAAe,CAAC,IAAY;QACpC,OAAO,IAAI;aACR,OAAO,CAAC,qBAAqB,EAAE,eAAe,CAAC;aAC/C,OAAO,CAAC,kBAAkB,EAAE,YAAY,CAAC;aACzC,OAAO,CAAC,wBAAwB,EAAE,cAAc,CAAC;aACjD,OAAO,CAAC,mBAAmB,EAAE,aAAa,CAAC,CAAC;IACjD,CAAC;CACF;AAnFD,0EAmFC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseConversationHistoryProvider } from './base-conversation-history.provider';
|
|
2
|
+
import { ConversationMessage, ConversationThread, FetchHistoryOptions } from './conversation-history.interface';
|
|
3
|
+
export declare class CliConversationHistoryProvider extends BaseConversationHistoryProvider {
|
|
4
|
+
private storage;
|
|
5
|
+
constructor();
|
|
6
|
+
initialize(): Promise<void>;
|
|
7
|
+
fetchHistory(threadId: string, options?: FetchHistoryOptions): Promise<ConversationThread>;
|
|
8
|
+
addMessage(threadId: string, userId: string, text: string, isAssistant?: boolean): Promise<ConversationMessage>;
|
|
9
|
+
hasHistory(threadId: string): Promise<boolean>;
|
|
10
|
+
formatForAI(thread: ConversationThread, options?: FetchHistoryOptions): Promise<string>;
|
|
11
|
+
listThreads(): Promise<string[]>;
|
|
12
|
+
deleteThread(threadId: string): Promise<void>;
|
|
13
|
+
createThread(threadId?: string): Promise<string>;
|
|
14
|
+
private createEmptyThread;
|
|
15
|
+
cleanupOldThreads(daysToKeep?: number): Promise<number>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var CliConversationHistoryProvider_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.CliConversationHistoryProvider = void 0;
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
const base_conversation_history_provider_1 = require("./base-conversation-history.provider");
|
|
16
|
+
const conversation_storage_service_1 = require("./conversation-storage.service");
|
|
17
|
+
let CliConversationHistoryProvider = CliConversationHistoryProvider_1 = class CliConversationHistoryProvider extends base_conversation_history_provider_1.BaseConversationHistoryProvider {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(CliConversationHistoryProvider_1.name);
|
|
20
|
+
this.storage = new conversation_storage_service_1.ConversationStorageService();
|
|
21
|
+
}
|
|
22
|
+
async initialize() {
|
|
23
|
+
await this.storage.initialize();
|
|
24
|
+
}
|
|
25
|
+
async fetchHistory(threadId, options) {
|
|
26
|
+
try {
|
|
27
|
+
this.logger.log(`Fetching CLI thread history: ${threadId}`);
|
|
28
|
+
const thread = await this.storage.loadThread(threadId);
|
|
29
|
+
if (!thread) {
|
|
30
|
+
return this.createEmptyThread(threadId);
|
|
31
|
+
}
|
|
32
|
+
if (options?.limit && thread.messages.length > options.limit) {
|
|
33
|
+
thread.messages = thread.messages.slice(-options.limit);
|
|
34
|
+
}
|
|
35
|
+
this.logger.log(`Retrieved ${thread.messages.length} messages from CLI thread`);
|
|
36
|
+
return thread;
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
this.logger.error(`Error fetching CLI thread history: ${error.message}`);
|
|
40
|
+
return this.createEmptyThread(threadId);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async addMessage(threadId, userId, text, isAssistant = false) {
|
|
44
|
+
const message = {
|
|
45
|
+
id: `${Date.now()}-${Math.random().toString(36).substring(7)}`,
|
|
46
|
+
userId,
|
|
47
|
+
text: this.sanitizeMessage(text),
|
|
48
|
+
timestamp: new Date(),
|
|
49
|
+
isAssistant,
|
|
50
|
+
};
|
|
51
|
+
try {
|
|
52
|
+
await this.storage.addMessage(threadId, message, 'cli');
|
|
53
|
+
this.logger.debug(`Message added to thread ${threadId}`);
|
|
54
|
+
return message;
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
this.logger.error(`Failed to add message: ${error.message}`);
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async hasHistory(threadId) {
|
|
62
|
+
return await this.storage.hasThread(threadId);
|
|
63
|
+
}
|
|
64
|
+
formatForAI(thread, options) {
|
|
65
|
+
return super.formatForAI(thread, options);
|
|
66
|
+
}
|
|
67
|
+
async listThreads() {
|
|
68
|
+
return await this.storage.listThreads();
|
|
69
|
+
}
|
|
70
|
+
async deleteThread(threadId) {
|
|
71
|
+
await this.storage.deleteThread(threadId);
|
|
72
|
+
this.logger.log(`Thread deleted: ${threadId}`);
|
|
73
|
+
}
|
|
74
|
+
async createThread(threadId) {
|
|
75
|
+
const id = threadId || `cli-${Date.now()}`;
|
|
76
|
+
const thread = {
|
|
77
|
+
threadId: id,
|
|
78
|
+
platform: 'cli',
|
|
79
|
+
messages: [],
|
|
80
|
+
metadata: {
|
|
81
|
+
createdAt: new Date().toISOString(),
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
await this.storage.saveThread(thread);
|
|
85
|
+
this.logger.log(`New thread created: ${id}`);
|
|
86
|
+
return id;
|
|
87
|
+
}
|
|
88
|
+
createEmptyThread(threadId) {
|
|
89
|
+
return {
|
|
90
|
+
threadId,
|
|
91
|
+
platform: 'cli',
|
|
92
|
+
messages: [],
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
async cleanupOldThreads(daysToKeep = 30) {
|
|
96
|
+
return await this.storage.cleanupOldThreads(daysToKeep);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
exports.CliConversationHistoryProvider = CliConversationHistoryProvider;
|
|
100
|
+
exports.CliConversationHistoryProvider = CliConversationHistoryProvider = CliConversationHistoryProvider_1 = __decorate([
|
|
101
|
+
(0, common_1.Injectable)(),
|
|
102
|
+
__metadata("design:paramtypes", [])
|
|
103
|
+
], CliConversationHistoryProvider);
|
|
104
|
+
//# sourceMappingURL=cli-conversation-history.provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-conversation-history.provider.js","sourceRoot":"","sources":["../../src/conversation/cli-con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QAC1C,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,mBAAmB,QAAQ,EAAE,CAAC,CAAC;IACjD,CAAC;IAKD,KAAK,CAAC,YAAY,CAAC,QAAiB;QAClC,MAAM,EAAE,GAAG,QAAQ,IAAI,OAAO,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;QAE3C,MAAM,MAAM,GAAuB;YACjC,QAAQ,EAAE,EAAE;YACZ,QAAQ,EAAE,KAAK;YACf,QAAQ,EAAE,EAAE;YACZ,QAAQ,EAAE;gBACR,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;aACpC;SACF,CAAC;QAEF,MAAM,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACtC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAAC;QAE7C,OAAO,EAAE,CAAC;IACZ,CAAC;IAKO,iBAAiB,CAAC,QAAgB;QACxC,OAAO;YACL,QAAQ;YACR,QAAQ,EAAE,KAAK;YACf,QAAQ,EAAE,EAAE;SACb,CAAC;IACJ,CAAC;IAKD,KAAK,CAAC,iBAAiB,CAAC,aAAqB,EAAE;QAC7C,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAC1D,CAAC;CACF,CAAA;AA7IY,wEAA8B;yCAA9B,8BAA8B;IAD1C,IAAA,mBAAU,GAAE;;GACA,8BAA8B,CA6I1C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface ConversationConfig {
|
|
2
|
+
maxMessages: number;
|
|
3
|
+
maxContextLength: number;
|
|
4
|
+
cacheTTL: number;
|
|
5
|
+
maxCacheSize: number;
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const DEFAULT_CONVERSATION_CONFIG: ConversationConfig;
|
|
9
|
+
export declare function getConversationConfig(): ConversationConfig;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_CONVERSATION_CONFIG = void 0;
|
|
4
|
+
exports.getConversationConfig = getConversationConfig;
|
|
5
|
+
exports.DEFAULT_CONVERSATION_CONFIG = {
|
|
6
|
+
maxMessages: 20,
|
|
7
|
+
maxContextLength: 4000,
|
|
8
|
+
cacheTTL: 30000,
|
|
9
|
+
maxCacheSize: 100,
|
|
10
|
+
enabled: true,
|
|
11
|
+
};
|
|
12
|
+
function getConversationConfig() {
|
|
13
|
+
return {
|
|
14
|
+
maxMessages: parseInt(process.env.CONVERSATION_MAX_MESSAGES ||
|
|
15
|
+
String(exports.DEFAULT_CONVERSATION_CONFIG.maxMessages)),
|
|
16
|
+
maxContextLength: parseInt(process.env.CONVERSATION_MAX_CONTEXT_LENGTH ||
|
|
17
|
+
String(exports.DEFAULT_CONVERSATION_CONFIG.maxContextLength)),
|
|
18
|
+
cacheTTL: parseInt(process.env.CONVERSATION_CACHE_TTL ||
|
|
19
|
+
String(exports.DEFAULT_CONVERSATION_CONFIG.cacheTTL)),
|
|
20
|
+
maxCacheSize: parseInt(process.env.CONVERSATION_MAX_CACHE_SIZE ||
|
|
21
|
+
String(exports.DEFAULT_CONVERSATION_CONFIG.maxCacheSize)),
|
|
22
|
+
enabled: process.env.CONVERSATION_HISTORY_ENABLED !== 'false',
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=conversation-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-config.js","sourceRoot":"","sources":["../../src/conversation/conversation-config.ts"],"names":[],"mappings":";;;AAkCA,sDAoBC;AA/BY,QAAA,2BAA2B,GAAuB;IAC7D,WAAW,EAAE,EAAE;IACf,gBAAgB,EAAE,IAAI;IACtB,QAAQ,EAAE,KAAK;IACf,YAAY,EAAE,GAAG;IACjB,OAAO,EAAE,IAAI;CACd,CAAC;AAKF,SAAgB,qBAAqB;IACnC,OAAO;QACL,WAAW,EAAE,QAAQ,CACnB,OAAO,CAAC,GAAG,CAAC,yBAAyB;YACnC,MAAM,CAAC,mCAA2B,CAAC,WAAW,CAAC,CAClD;QACD,gBAAgB,EAAE,QAAQ,CACxB,OAAO,CAAC,GAAG,CAAC,+BAA+B;YACzC,MAAM,CAAC,mCAA2B,CAAC,gBAAgB,CAAC,CACvD;QACD,QAAQ,EAAE,QAAQ,CAChB,OAAO,CAAC,GAAG,CAAC,sBAAsB;YAChC,MAAM,CAAC,mCAA2B,CAAC,QAAQ,CAAC,CAC/C;QACD,YAAY,EAAE,QAAQ,CACpB,OAAO,CAAC,GAAG,CAAC,2BAA2B;YACrC,MAAM,CAAC,mCAA2B,CAAC,YAAY,CAAC,CACnD;QACD,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,4BAA4B,KAAK,OAAO;KAC9D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface ConversationMessage {
|
|
2
|
+
id: string;
|
|
3
|
+
userId: string;
|
|
4
|
+
text: string;
|
|
5
|
+
timestamp: Date;
|
|
6
|
+
isAssistant: boolean;
|
|
7
|
+
metadata?: Record<string, any>;
|
|
8
|
+
}
|
|
9
|
+
export interface ConversationThread {
|
|
10
|
+
threadId: string;
|
|
11
|
+
platform: 'slack' | 'cli';
|
|
12
|
+
messages: ConversationMessage[];
|
|
13
|
+
metadata?: Record<string, any>;
|
|
14
|
+
hasMore?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface FetchHistoryOptions {
|
|
17
|
+
limit?: number;
|
|
18
|
+
maxContextLength?: number;
|
|
19
|
+
excludeCurrent?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface IConversationHistoryProvider {
|
|
22
|
+
fetchHistory(threadId: string, options?: FetchHistoryOptions): Promise<ConversationThread>;
|
|
23
|
+
formatForAI(thread: ConversationThread, options?: FetchHistoryOptions): Promise<string>;
|
|
24
|
+
hasHistory(threadId: string): Promise<boolean>;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-history.interface.js","sourceRoot":"","sources":["../../src/conversation/conversation-history.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IConversationHistoryProvider } from './conversation-history.interface';
|
|
2
|
+
export type Platform = 'slack' | 'cli';
|
|
3
|
+
export declare class ConversationProviderFactory {
|
|
4
|
+
private readonly logger;
|
|
5
|
+
private providers;
|
|
6
|
+
getProvider(platform: Platform): IConversationHistoryProvider;
|
|
7
|
+
private createProvider;
|
|
8
|
+
hasProvider(platform: Platform): boolean;
|
|
9
|
+
clearProviders(): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var ConversationProviderFactory_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ConversationProviderFactory = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
const slack_conversation_history_provider_1 = require("./slack-conversation-history.provider");
|
|
13
|
+
const cli_conversation_history_provider_1 = require("./cli-conversation-history.provider");
|
|
14
|
+
let ConversationProviderFactory = ConversationProviderFactory_1 = class ConversationProviderFactory {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.logger = new common_1.Logger(ConversationProviderFactory_1.name);
|
|
17
|
+
this.providers = new Map();
|
|
18
|
+
}
|
|
19
|
+
getProvider(platform) {
|
|
20
|
+
let provider = this.providers.get(platform);
|
|
21
|
+
if (!provider) {
|
|
22
|
+
provider = this.createProvider(platform);
|
|
23
|
+
this.providers.set(platform, provider);
|
|
24
|
+
this.logger.log(`Created ${platform} conversation history provider`);
|
|
25
|
+
}
|
|
26
|
+
return provider;
|
|
27
|
+
}
|
|
28
|
+
createProvider(platform) {
|
|
29
|
+
switch (platform) {
|
|
30
|
+
case 'slack':
|
|
31
|
+
return new slack_conversation_history_provider_1.SlackConversationHistoryProvider();
|
|
32
|
+
case 'cli':
|
|
33
|
+
return new cli_conversation_history_provider_1.CliConversationHistoryProvider();
|
|
34
|
+
default:
|
|
35
|
+
throw new Error(`Unsupported platform: ${platform}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
hasProvider(platform) {
|
|
39
|
+
return this.providers.has(platform);
|
|
40
|
+
}
|
|
41
|
+
clearProviders() {
|
|
42
|
+
this.providers.clear();
|
|
43
|
+
this.logger.log('All conversation providers cleared');
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
exports.ConversationProviderFactory = ConversationProviderFactory;
|
|
47
|
+
exports.ConversationProviderFactory = ConversationProviderFactory = ConversationProviderFactory_1 = __decorate([
|
|
48
|
+
(0, common_1.Injectable)()
|
|
49
|
+
], ConversationProviderFactory);
|
|
50
|
+
//# sourceMappingURL=conversation-provider.factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-provider.factory.js","sourceRoot":"","sources":["../../src/conversation/conversation-provider.factory.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAoD;AAEpD,+FAAyF;AACzF,2FAAqF;AAQ9E,IAAM,2BAA2B,mCAAjC,MAAM,2BAA2B;IAAjC;QACY,WAAM,GAAG,IAAI,eAAM,CAAC,6BAA2B,CAAC,IAAI,CAAC,CAAC;QAC/D,cAAS,GAAgD,IAAI,GAAG,EAAE,CAAC;IA6C7E,CAAC;IAxCC,WAAW,CAAC,QAAkB;QAC5B,IAAI,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAE5C,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;YACzC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YACvC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,QAAQ,gCAAgC,CAAC,CAAC;QACvE,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;IAKO,cAAc,CAAC,QAAkB;QACvC,QAAQ,QAAQ,EAAE,CAAC;YACjB,KAAK,OAAO;gBACV,OAAO,IAAI,sEAAgC,EAAE,CAAC;YAChD,KAAK,KAAK;gBACR,OAAO,IAAI,kEAA8B,EAAE,CAAC;YAC9C;gBACE,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,EAAE,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;IAKD,WAAW,CAAC,QAAkB;QAC5B,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACtC,CAAC;IAKD,cAAc;QACZ,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QACvB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;IACxD,CAAC;CACF,CAAA;AA/CY,kEAA2B;sCAA3B,2BAA2B;IADvC,IAAA,mBAAU,GAAE;GACA,2BAA2B,CA+CvC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ConversationThread, ConversationMessage } from './conversation-history.interface';
|
|
2
|
+
export declare class ConversationStorageService {
|
|
3
|
+
private readonly logger;
|
|
4
|
+
private readonly storageDir;
|
|
5
|
+
constructor();
|
|
6
|
+
initialize(): Promise<void>;
|
|
7
|
+
saveThread(thread: ConversationThread): Promise<void>;
|
|
8
|
+
loadThread(threadId: string): Promise<ConversationThread | null>;
|
|
9
|
+
addMessage(threadId: string, message: ConversationMessage, platform?: 'slack' | 'cli'): Promise<ConversationThread>;
|
|
10
|
+
listThreads(): Promise<string[]>;
|
|
11
|
+
deleteThread(threadId: string): Promise<void>;
|
|
12
|
+
hasThread(threadId: string): Promise<boolean>;
|
|
13
|
+
private getThreadPath;
|
|
14
|
+
cleanupOldThreads(daysToKeep?: number): Promise<number>;
|
|
15
|
+
}
|