@vfarcic/dot-ai 0.115.0 → 0.117.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -18
- package/dist/core/ai-provider-factory.d.ts +4 -2
- package/dist/core/ai-provider-factory.d.ts.map +1 -1
- package/dist/core/ai-provider-factory.js +17 -6
- package/dist/core/capability-operations.js +1 -1
- package/dist/core/generic-session-manager.d.ts +67 -0
- package/dist/core/generic-session-manager.d.ts.map +1 -0
- package/dist/core/generic-session-manager.js +192 -0
- package/dist/core/pattern-operations.js +1 -1
- package/dist/core/providers/noop-provider.d.ts +47 -0
- package/dist/core/providers/noop-provider.d.ts.map +1 -0
- package/dist/core/providers/noop-provider.js +63 -0
- package/dist/core/schema.d.ts.map +1 -1
- package/dist/core/schema.js +13 -13
- package/dist/core/session-utils.d.ts +3 -6
- package/dist/core/session-utils.d.ts.map +1 -1
- package/dist/core/session-utils.js +5 -13
- package/dist/core/shared-prompt-loader.d.ts +15 -3
- package/dist/core/shared-prompt-loader.d.ts.map +1 -1
- package/dist/core/shared-prompt-loader.js +67 -14
- package/dist/core/unified-creation-session.d.ts +3 -10
- package/dist/core/unified-creation-session.d.ts.map +1 -1
- package/dist/core/unified-creation-session.js +34 -75
- package/dist/core/unified-creation-types.d.ts +31 -22
- package/dist/core/unified-creation-types.d.ts.map +1 -1
- package/dist/evaluation/eval-runner.js +12 -3
- package/dist/evaluation/evaluators/base-comparative.d.ts +2 -0
- package/dist/evaluation/evaluators/base-comparative.d.ts.map +1 -1
- package/dist/evaluation/evaluators/base-comparative.js +13 -1
- package/dist/evaluation/graph-generator.d.ts +56 -0
- package/dist/evaluation/graph-generator.d.ts.map +1 -0
- package/dist/evaluation/graph-generator.js +694 -0
- package/dist/evaluation/metadata-loader.d.ts +39 -0
- package/dist/evaluation/metadata-loader.d.ts.map +1 -0
- package/dist/evaluation/metadata-loader.js +74 -0
- package/dist/evaluation/platform-synthesizer.d.ts +5 -1
- package/dist/evaluation/platform-synthesizer.d.ts.map +1 -1
- package/dist/evaluation/platform-synthesizer.js +65 -23
- package/dist/evaluation/run-platform-synthesis.js +22 -5
- package/dist/interfaces/mcp.d.ts.map +1 -1
- package/dist/interfaces/mcp.js +9 -34
- package/dist/tools/answer-question.d.ts.map +1 -1
- package/dist/tools/answer-question.js +12 -12
- package/dist/tools/choose-solution.js +1 -1
- package/dist/tools/generate-manifests.d.ts.map +1 -1
- package/dist/tools/generate-manifests.js +9 -10
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +6 -6
- package/dist/tools/organizational-data.js +12 -12
- package/dist/tools/project-setup/discovery.d.ts +15 -0
- package/dist/tools/project-setup/discovery.d.ts.map +1 -0
- package/dist/tools/project-setup/discovery.js +104 -0
- package/dist/tools/project-setup/generate-scope.d.ts +15 -0
- package/dist/tools/project-setup/generate-scope.d.ts.map +1 -0
- package/dist/tools/project-setup/generate-scope.js +237 -0
- package/dist/tools/project-setup/report-scan.d.ts +15 -0
- package/dist/tools/project-setup/report-scan.d.ts.map +1 -0
- package/dist/tools/project-setup/report-scan.js +156 -0
- package/dist/tools/project-setup/types.d.ts +111 -0
- package/dist/tools/project-setup/types.d.ts.map +1 -0
- package/dist/tools/project-setup/types.js +8 -0
- package/dist/tools/project-setup.d.ts +28 -0
- package/dist/tools/project-setup.d.ts.map +1 -0
- package/dist/tools/project-setup.js +134 -0
- package/dist/tools/recommend.js +1 -1
- package/dist/tools/remediate.js +1 -1
- package/dist/tools/version.d.ts +0 -7
- package/dist/tools/version.d.ts.map +1 -1
- package/dist/tools/version.js +5 -34
- package/package.json +4 -2
- package/prompts/capability-inference.md +2 -2
- package/prompts/infrastructure-trigger-expansion.md +2 -2
- package/prompts/intent-analysis.md +2 -2
- package/prompts/kyverno-generation.md +14 -14
- package/prompts/manifest-generation.md +5 -5
- package/prompts/map-intent-to-operation.md +2 -2
- package/prompts/pattern-complete-error.md +1 -1
- package/prompts/pattern-complete-success.md +4 -4
- package/prompts/pattern-rationale.md +1 -1
- package/prompts/pattern-resources.md +1 -1
- package/prompts/pattern-review.md +5 -5
- package/prompts/policy-complete-apply.md +4 -4
- package/prompts/policy-complete-discard.md +1 -1
- package/prompts/policy-complete-error.md +1 -1
- package/prompts/policy-complete-save.md +4 -4
- package/prompts/policy-complete-success.md +4 -4
- package/prompts/policy-namespace-scope.md +1 -1
- package/prompts/question-generation.md +5 -5
- package/prompts/resource-analysis.md +3 -3
- package/prompts/resource-selection.md +3 -3
- package/prompts/solution-enhancement.md +4 -4
- package/scripts/anthropic.nu +9 -13
- package/scripts/common.nu +31 -33
- package/scripts/ingress.nu +5 -4
- package/scripts/kubernetes.nu +38 -53
- package/dist/core/doc-discovery.d.ts +0 -38
- package/dist/core/doc-discovery.d.ts.map +0 -1
- package/dist/core/doc-discovery.js +0 -231
- package/dist/core/doc-testing-session.d.ts +0 -109
- package/dist/core/doc-testing-session.d.ts.map +0 -1
- package/dist/core/doc-testing-session.js +0 -696
- package/dist/core/doc-testing-types.d.ts +0 -127
- package/dist/core/doc-testing-types.d.ts.map +0 -1
- package/dist/core/doc-testing-types.js +0 -53
- package/dist/core/nushell-runtime.d.ts +0 -39
- package/dist/core/nushell-runtime.d.ts.map +0 -1
- package/dist/core/nushell-runtime.js +0 -103
- package/dist/core/platform-operations.d.ts +0 -70
- package/dist/core/platform-operations.d.ts.map +0 -1
- package/dist/core/platform-operations.js +0 -294
- package/dist/tools/build-platform.d.ts +0 -25
- package/dist/tools/build-platform.d.ts.map +0 -1
- package/dist/tools/build-platform.js +0 -277
- package/dist/tools/test-docs.d.ts +0 -22
- package/dist/tools/test-docs.d.ts.map +0 -1
- package/dist/tools/test-docs.js +0 -351
- package/prompts/doc-testing-done.md +0 -51
- package/prompts/doc-testing-fix.md +0 -120
- package/prompts/doc-testing-scan.md +0 -140
- package/prompts/doc-testing-test-section.md +0 -169
- package/prompts/platform-operations-parse-script-help.md +0 -68
- package/scripts/ack.nu +0 -195
- package/scripts/argo-workflows.nu +0 -47
- package/scripts/argocd.nu +0 -85
- package/scripts/aso.nu +0 -74
- package/scripts/backstage.nu +0 -349
- package/scripts/cert-manager.nu +0 -13
- package/scripts/cnpg.nu +0 -14
- package/scripts/dot.nu +0 -32
- package/scripts/external-secrets.nu +0 -110
- package/scripts/gatekeeper.nu +0 -19
- package/scripts/github.nu +0 -42
- package/scripts/image.nu +0 -67
- package/scripts/kro.nu +0 -11
- package/scripts/kubevela.nu +0 -22
- package/scripts/port.nu +0 -71
- package/scripts/prometheus.nu +0 -21
- package/scripts/registry.nu +0 -55
- package/scripts/storage.nu +0 -210
- package/scripts/tests.nu +0 -12
- package/scripts/velero.nu +0 -45
- package/shared-prompts/validate-docs.md +0 -22
package/README.md
CHANGED
|
@@ -30,18 +30,19 @@ DEVELOPER NOTE: This tool is under active development with incomplete functional
|
|
|
30
30
|
- **DevOps Teams**: Create and manage Kubernetes clusters through natural language interactions
|
|
31
31
|
-->
|
|
32
32
|
|
|
33
|
-
### Documentation Testing
|
|
34
|
-
- **Documentation Maintainers**: Automatically validate documentation accuracy and catch outdated content
|
|
35
|
-
- **Technical Writers**: Identify which sections need updates and prioritize work effectively
|
|
36
|
-
- **Open Source Maintainers**: Ensure documentation works correctly for new contributors
|
|
37
|
-
|
|
38
33
|
### Shared Prompts Library
|
|
39
34
|
- **Development Teams**: Share proven prompts across projects without file management
|
|
40
35
|
- **Project Managers**: Standardize workflows with consistent prompt usage across teams
|
|
41
36
|
- **Individual Developers**: Access curated prompt library via native slash commands
|
|
42
37
|
|
|
38
|
+
### Project Setup & Governance
|
|
39
|
+
- **Project Maintainers**: Bootstrap new repositories with governance, legal, and security files
|
|
40
|
+
- **Development Teams**: Standardize repository setup and workflows across projects
|
|
41
|
+
- **Security Teams**: Implement consistent security policies, vulnerability reporting, and compliance standards
|
|
42
|
+
|
|
43
43
|
### AI Integration
|
|
44
44
|
- **AI Agents**: Integrate all capabilities with Claude Code, Cursor, or VS Code for conversational workflows
|
|
45
|
+
- **Multiple AI Providers**: Choose from multiple AI models and providers to optimize for quality, cost, and reliability - see [AI Model Configuration](./docs/mcp-setup.md#ai-model-configuration)
|
|
45
46
|
- **REST API**: Access all tools via standard HTTP endpoints for CI/CD pipelines, automation scripts, and traditional applications
|
|
46
47
|
|
|
47
48
|
## Key Features
|
|
@@ -99,14 +100,6 @@ DEVELOPER NOTE: This tool is under active development with incomplete functional
|
|
|
99
100
|
📖 [Learn more →](./docs/mcp-build-platform-guide.md)
|
|
100
101
|
-->
|
|
101
102
|
|
|
102
|
-
### Documentation Testing & Validation
|
|
103
|
-
📖 **Automated Testing**: Validates documentation by executing commands and testing examples
|
|
104
|
-
🔍 **Two-Phase Validation**: Tests both functionality (does it work?) and semantic accuracy (are descriptions truthful?)
|
|
105
|
-
🛠️ **Fix Application**: User-driven selection and application of recommended documentation improvements
|
|
106
|
-
💾 **Session Management**: Resumable testing workflows for large documentation sets
|
|
107
|
-
|
|
108
|
-
📖 [Learn more →](./docs/mcp-documentation-testing-guide.md)
|
|
109
|
-
|
|
110
103
|
### Organizational Pattern Management
|
|
111
104
|
🏛️ **Pattern Creation**: Define organizational deployment patterns that capture institutional knowledge
|
|
112
105
|
🧠 **AI Enhancement**: Patterns automatically enhance deployment recommendations with organizational context
|
|
@@ -125,16 +118,26 @@ DEVELOPER NOTE: This tool is under active development with incomplete functional
|
|
|
125
118
|
📖 [Learn more →](./docs/policy-management-guide.md)
|
|
126
119
|
|
|
127
120
|
### Shared Prompts Library
|
|
128
|
-
🎯 **Native Slash Commands**: Prompts appear as `/dot-ai:prompt-name` in your coding agent
|
|
129
|
-
📚 **Curated Library**: Access proven prompts for code review, documentation, architecture, and project management
|
|
130
|
-
🔄 **Zero Setup**: Connect to MCP server and prompts are immediately available across all projects
|
|
121
|
+
🎯 **Native Slash Commands**: Prompts appear as `/dot-ai:prompt-name` in your coding agent
|
|
122
|
+
📚 **Curated Library**: Access proven prompts for code review, documentation, architecture, and project management
|
|
123
|
+
🔄 **Zero Setup**: Connect to MCP server and prompts are immediately available across all projects
|
|
131
124
|
🤝 **Team Consistency**: Standardized prompt usage with centralized management
|
|
132
125
|
|
|
133
126
|
📖 [Learn more →](./docs/mcp-prompts-guide.md)
|
|
134
127
|
|
|
128
|
+
### Project Setup & Governance
|
|
129
|
+
📦 **Repository Audit**: Scans repositories to identify missing governance, legal, and automation files
|
|
130
|
+
📋 **25+ Templates**: Generates LICENSE, CODE_OF_CONDUCT, CONTRIBUTING, SECURITY, GitHub workflows, and automation
|
|
131
|
+
🔧 **GitHub Automation**: Sets up Renovate for dependency updates, PR labeling, and stale issue management
|
|
132
|
+
🛡️ **Security Workflows**: Includes OpenSSF Scorecard for security posture analysis
|
|
133
|
+
✅ **Standards-Based**: All templates based on authoritative sources (Contributor Covenant, OpenSSF, GitHub)
|
|
134
|
+
|
|
135
|
+
📖 [Learn more →](./docs/mcp-project-setup-guide.md)
|
|
136
|
+
|
|
135
137
|
### AI Integration
|
|
136
|
-
⚡ **MCP Integration**: Works seamlessly with Claude Code, Cursor, or VS Code through Model Context Protocol
|
|
137
|
-
🤖 **Conversational Interface**: Natural language interaction for deployment,
|
|
138
|
+
⚡ **MCP Integration**: Works seamlessly with Claude Code, Cursor, or VS Code through Model Context Protocol
|
|
139
|
+
🤖 **Conversational Interface**: Natural language interaction for deployment, remediation, pattern management, and shared prompt workflows
|
|
140
|
+
🎯 **Multiple AI Providers**: Choose from multiple AI models and providers to optimize for quality, cost, and reliability - see [AI Model Configuration](./docs/mcp-setup.md#ai-model-configuration)
|
|
138
141
|
|
|
139
142
|
**Setup Required**: See the [MCP Setup Guide](./docs/mcp-setup.md) for complete configuration instructions.
|
|
140
143
|
|
|
@@ -38,12 +38,14 @@ export declare class AIProviderFactory {
|
|
|
38
38
|
* Detects provider from AI_PROVIDER env var (defaults to 'anthropic')
|
|
39
39
|
* and loads corresponding API key from environment.
|
|
40
40
|
*
|
|
41
|
+
* If no API keys are configured, returns a NoOpAIProvider that allows
|
|
42
|
+
* the MCP server to start but returns helpful errors when AI is needed.
|
|
43
|
+
*
|
|
41
44
|
* Supports AI_PROVIDER_SDK env var to override SDK choice:
|
|
42
45
|
* - 'native' (default): Use native provider SDK
|
|
43
46
|
* - 'vercel': Use Vercel AI SDK for the provider
|
|
44
47
|
*
|
|
45
|
-
* @returns Configured AI provider instance
|
|
46
|
-
* @throws Error if required environment variables are missing
|
|
48
|
+
* @returns Configured AI provider instance or NoOpProvider if no keys available
|
|
47
49
|
*/
|
|
48
50
|
static createFromEnv(): AIProvider;
|
|
49
51
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-provider-factory.d.ts","sourceRoot":"","sources":["../../src/core/ai-provider-factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,UAAU,EACV,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"ai-provider-factory.d.ts","sourceRoot":"","sources":["../../src/core/ai-provider-factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,UAAU,EACV,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AA+BjC;;;;;;;;;;;;;;GAcG;AACH,qBAAa,iBAAiB;IAC5B;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,UAAU;IAgCnD;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,aAAa,IAAI,UAAU;IA2DlC;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAItC;;;;;OAKG;IACH,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAMrD;;;;OAIG;IACH,MAAM,CAAC,qBAAqB,IAAI,MAAM,EAAE;IAMxC;;;;;OAKG;IACH,MAAM,CAAC,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;CAGxD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,UAAU,CAE7C"}
|
|
@@ -13,6 +13,7 @@ exports.AIProviderFactory = void 0;
|
|
|
13
13
|
exports.createAIProvider = createAIProvider;
|
|
14
14
|
const anthropic_provider_1 = require("./providers/anthropic-provider");
|
|
15
15
|
const vercel_provider_1 = require("./providers/vercel-provider");
|
|
16
|
+
const noop_provider_1 = require("./providers/noop-provider");
|
|
16
17
|
const model_config_1 = require("./model-config");
|
|
17
18
|
/**
|
|
18
19
|
* Provider environment variable mappings
|
|
@@ -86,29 +87,39 @@ class AIProviderFactory {
|
|
|
86
87
|
* Detects provider from AI_PROVIDER env var (defaults to 'anthropic')
|
|
87
88
|
* and loads corresponding API key from environment.
|
|
88
89
|
*
|
|
90
|
+
* If no API keys are configured, returns a NoOpAIProvider that allows
|
|
91
|
+
* the MCP server to start but returns helpful errors when AI is needed.
|
|
92
|
+
*
|
|
89
93
|
* Supports AI_PROVIDER_SDK env var to override SDK choice:
|
|
90
94
|
* - 'native' (default): Use native provider SDK
|
|
91
95
|
* - 'vercel': Use Vercel AI SDK for the provider
|
|
92
96
|
*
|
|
93
|
-
* @returns Configured AI provider instance
|
|
94
|
-
* @throws Error if required environment variables are missing
|
|
97
|
+
* @returns Configured AI provider instance or NoOpProvider if no keys available
|
|
95
98
|
*/
|
|
96
99
|
static createFromEnv() {
|
|
97
100
|
const providerType = process.env.AI_PROVIDER || 'anthropic';
|
|
98
101
|
const sdkPreference = process.env.AI_PROVIDER_SDK || 'native';
|
|
99
102
|
// Validate provider is implemented
|
|
100
103
|
if (!IMPLEMENTED_PROVIDERS.includes(providerType)) {
|
|
101
|
-
|
|
102
|
-
|
|
104
|
+
// Write to stderr for logging
|
|
105
|
+
process.stderr.write(`WARNING: Invalid AI_PROVIDER: ${providerType}. ` +
|
|
106
|
+
`Must be one of: ${IMPLEMENTED_PROVIDERS.join(', ')}. ` +
|
|
107
|
+
`Falling back to NoOpProvider.\n`);
|
|
108
|
+
return new noop_provider_1.NoOpAIProvider();
|
|
103
109
|
}
|
|
104
110
|
// Get API key for the provider
|
|
105
111
|
const apiKeyEnvVar = PROVIDER_ENV_KEYS[providerType];
|
|
106
112
|
if (!apiKeyEnvVar) {
|
|
107
|
-
|
|
113
|
+
process.stderr.write(`WARNING: No API key environment variable defined for provider: ${providerType}. ` +
|
|
114
|
+
`Falling back to NoOpProvider.\n`);
|
|
115
|
+
return new noop_provider_1.NoOpAIProvider();
|
|
108
116
|
}
|
|
109
117
|
const apiKey = process.env[apiKeyEnvVar];
|
|
110
118
|
if (!apiKey) {
|
|
111
|
-
|
|
119
|
+
process.stderr.write(`INFO: ${apiKeyEnvVar} not configured. ` +
|
|
120
|
+
`AI features will be unavailable. ` +
|
|
121
|
+
`Tools that don't require AI (prompts, project-setup) will still work.\n`);
|
|
122
|
+
return new noop_provider_1.NoOpAIProvider();
|
|
112
123
|
}
|
|
113
124
|
// Get optional model override
|
|
114
125
|
const model = process.env.AI_MODEL;
|
|
@@ -346,7 +346,7 @@ async function handleCapabilityProgress(args, logger, requestId) {
|
|
|
346
346
|
sessionId: args.sessionId
|
|
347
347
|
});
|
|
348
348
|
// Get session directory first
|
|
349
|
-
const sessionDir = (0, session_utils_1.getAndValidateSessionDirectory)(
|
|
349
|
+
const sessionDir = (0, session_utils_1.getAndValidateSessionDirectory)(false);
|
|
350
350
|
let sessionId = args.sessionId;
|
|
351
351
|
let sessionFilePath;
|
|
352
352
|
// If no sessionId provided, auto-discover the latest session
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic Session Manager
|
|
3
|
+
*
|
|
4
|
+
* Reusable file-based session management for MCP tools
|
|
5
|
+
* Provides CRUD operations with persistent storage
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* const manager = new GenericSessionManager<MySessionData>('myprefix', args);
|
|
9
|
+
* const session = manager.createSession({ myData: 'value' });
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Generic session structure
|
|
13
|
+
* T is the type of data stored in the session
|
|
14
|
+
*/
|
|
15
|
+
export interface GenericSession<T = any> {
|
|
16
|
+
sessionId: string;
|
|
17
|
+
createdAt: string;
|
|
18
|
+
updatedAt: string;
|
|
19
|
+
data: T;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Generic session manager with file-based storage
|
|
23
|
+
*/
|
|
24
|
+
export declare class GenericSessionManager<T = any> {
|
|
25
|
+
private prefix;
|
|
26
|
+
private sessionDir;
|
|
27
|
+
private sessionsPath;
|
|
28
|
+
/**
|
|
29
|
+
* Create a new session manager
|
|
30
|
+
* @param prefix - Prefix for session IDs and directory (e.g., 'proj', 'pattern', 'test')
|
|
31
|
+
*/
|
|
32
|
+
constructor(prefix: string);
|
|
33
|
+
/**
|
|
34
|
+
* Create a new session
|
|
35
|
+
* Pattern: {prefix}-{timestamp}-{uuid}
|
|
36
|
+
*/
|
|
37
|
+
createSession(initialData?: T): GenericSession<T>;
|
|
38
|
+
/**
|
|
39
|
+
* Get an existing session
|
|
40
|
+
*/
|
|
41
|
+
getSession(sessionId: string): GenericSession<T> | null;
|
|
42
|
+
/**
|
|
43
|
+
* Update session data (merges with existing data)
|
|
44
|
+
*/
|
|
45
|
+
updateSession(sessionId: string, newData: Partial<T>): GenericSession<T> | null;
|
|
46
|
+
/**
|
|
47
|
+
* Replace session data entirely
|
|
48
|
+
*/
|
|
49
|
+
replaceSession(sessionId: string, newData: T): GenericSession<T> | null;
|
|
50
|
+
/**
|
|
51
|
+
* Delete a session
|
|
52
|
+
*/
|
|
53
|
+
deleteSession(sessionId: string): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* List all sessions (returns session IDs)
|
|
56
|
+
*/
|
|
57
|
+
listSessions(): string[];
|
|
58
|
+
/**
|
|
59
|
+
* Clear all sessions (useful for testing)
|
|
60
|
+
*/
|
|
61
|
+
clearAllSessions(): void;
|
|
62
|
+
/**
|
|
63
|
+
* Save session to file
|
|
64
|
+
*/
|
|
65
|
+
private saveSession;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=generic-session-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generic-session-manager.d.ts","sourceRoot":"","sources":["../../src/core/generic-session-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH;;;GAGG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,GAAG;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,CAAC,CAAC;CACT;AAED;;GAEG;AACH,qBAAa,qBAAqB,CAAC,CAAC,GAAG,GAAG;IACxC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,YAAY,CAAS;IAE7B;;;OAGG;gBACS,MAAM,EAAE,MAAM;IAW1B;;;OAGG;IACH,aAAa,CAAC,WAAW,GAAE,CAAW,GAAG,cAAc,CAAC,CAAC,CAAC;IAgB1D;;OAEG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,IAAI;IAgBvD;;OAEG;IACH,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,IAAI;IAc/E;;OAEG;IACH,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,IAAI;IAcvE;;OAEG;IACH,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAgBzC;;OAEG;IACH,YAAY,IAAI,MAAM,EAAE;IAgBxB;;OAEG;IACH,gBAAgB,IAAI,IAAI;IAiBxB;;OAEG;IACH,OAAO,CAAC,WAAW;CAIpB"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Generic Session Manager
|
|
4
|
+
*
|
|
5
|
+
* Reusable file-based session management for MCP tools
|
|
6
|
+
* Provides CRUD operations with persistent storage
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* const manager = new GenericSessionManager<MySessionData>('myprefix', args);
|
|
10
|
+
* const session = manager.createSession({ myData: 'value' });
|
|
11
|
+
*/
|
|
12
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
15
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
16
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
17
|
+
}
|
|
18
|
+
Object.defineProperty(o, k2, desc);
|
|
19
|
+
}) : (function(o, m, k, k2) {
|
|
20
|
+
if (k2 === undefined) k2 = k;
|
|
21
|
+
o[k2] = m[k];
|
|
22
|
+
}));
|
|
23
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
24
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
25
|
+
}) : function(o, v) {
|
|
26
|
+
o["default"] = v;
|
|
27
|
+
});
|
|
28
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
29
|
+
var ownKeys = function(o) {
|
|
30
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
31
|
+
var ar = [];
|
|
32
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
33
|
+
return ar;
|
|
34
|
+
};
|
|
35
|
+
return ownKeys(o);
|
|
36
|
+
};
|
|
37
|
+
return function (mod) {
|
|
38
|
+
if (mod && mod.__esModule) return mod;
|
|
39
|
+
var result = {};
|
|
40
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
41
|
+
__setModuleDefault(result, mod);
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
})();
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.GenericSessionManager = void 0;
|
|
47
|
+
const fs = __importStar(require("fs"));
|
|
48
|
+
const path = __importStar(require("path"));
|
|
49
|
+
const crypto_1 = require("crypto");
|
|
50
|
+
const session_utils_1 = require("./session-utils");
|
|
51
|
+
/**
|
|
52
|
+
* Generic session manager with file-based storage
|
|
53
|
+
*/
|
|
54
|
+
class GenericSessionManager {
|
|
55
|
+
prefix;
|
|
56
|
+
sessionDir;
|
|
57
|
+
sessionsPath;
|
|
58
|
+
/**
|
|
59
|
+
* Create a new session manager
|
|
60
|
+
* @param prefix - Prefix for session IDs and directory (e.g., 'proj', 'pattern', 'test')
|
|
61
|
+
*/
|
|
62
|
+
constructor(prefix) {
|
|
63
|
+
this.prefix = prefix;
|
|
64
|
+
this.sessionDir = (0, session_utils_1.getAndValidateSessionDirectory)(true);
|
|
65
|
+
this.sessionsPath = path.join(this.sessionDir, `${prefix}-sessions`);
|
|
66
|
+
// Create sessions directory if it doesn't exist
|
|
67
|
+
if (!fs.existsSync(this.sessionsPath)) {
|
|
68
|
+
fs.mkdirSync(this.sessionsPath, { recursive: true });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Create a new session
|
|
73
|
+
* Pattern: {prefix}-{timestamp}-{uuid}
|
|
74
|
+
*/
|
|
75
|
+
createSession(initialData = {}) {
|
|
76
|
+
const sessionId = `${this.prefix}-${Date.now()}-${(0, crypto_1.randomUUID)().substring(0, 8)}`;
|
|
77
|
+
const now = new Date().toISOString();
|
|
78
|
+
const session = {
|
|
79
|
+
sessionId,
|
|
80
|
+
createdAt: now,
|
|
81
|
+
updatedAt: now,
|
|
82
|
+
data: initialData,
|
|
83
|
+
};
|
|
84
|
+
this.saveSession(session);
|
|
85
|
+
return session;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Get an existing session
|
|
89
|
+
*/
|
|
90
|
+
getSession(sessionId) {
|
|
91
|
+
try {
|
|
92
|
+
const sessionFile = path.join(this.sessionsPath, `${sessionId}.json`);
|
|
93
|
+
if (!fs.existsSync(sessionFile)) {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
const sessionData = fs.readFileSync(sessionFile, 'utf8');
|
|
97
|
+
return JSON.parse(sessionData);
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
console.error(`Failed to load session ${sessionId}:`, error);
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Update session data (merges with existing data)
|
|
106
|
+
*/
|
|
107
|
+
updateSession(sessionId, newData) {
|
|
108
|
+
const session = this.getSession(sessionId);
|
|
109
|
+
if (!session) {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
session.data = { ...session.data, ...newData };
|
|
113
|
+
session.updatedAt = new Date().toISOString();
|
|
114
|
+
this.saveSession(session);
|
|
115
|
+
return session;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Replace session data entirely
|
|
119
|
+
*/
|
|
120
|
+
replaceSession(sessionId, newData) {
|
|
121
|
+
const session = this.getSession(sessionId);
|
|
122
|
+
if (!session) {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
session.data = newData;
|
|
126
|
+
session.updatedAt = new Date().toISOString();
|
|
127
|
+
this.saveSession(session);
|
|
128
|
+
return session;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Delete a session
|
|
132
|
+
*/
|
|
133
|
+
deleteSession(sessionId) {
|
|
134
|
+
try {
|
|
135
|
+
const sessionFile = path.join(this.sessionsPath, `${sessionId}.json`);
|
|
136
|
+
if (!fs.existsSync(sessionFile)) {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
fs.unlinkSync(sessionFile);
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
console.error(`Failed to delete session ${sessionId}:`, error);
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* List all sessions (returns session IDs)
|
|
149
|
+
*/
|
|
150
|
+
listSessions() {
|
|
151
|
+
try {
|
|
152
|
+
if (!fs.existsSync(this.sessionsPath)) {
|
|
153
|
+
return [];
|
|
154
|
+
}
|
|
155
|
+
return fs
|
|
156
|
+
.readdirSync(this.sessionsPath)
|
|
157
|
+
.filter((file) => file.endsWith('.json'))
|
|
158
|
+
.map((file) => file.replace('.json', ''));
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
console.error('Failed to list sessions:', error);
|
|
162
|
+
return [];
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Clear all sessions (useful for testing)
|
|
167
|
+
*/
|
|
168
|
+
clearAllSessions() {
|
|
169
|
+
try {
|
|
170
|
+
if (!fs.existsSync(this.sessionsPath)) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
const sessions = fs.readdirSync(this.sessionsPath);
|
|
174
|
+
for (const file of sessions) {
|
|
175
|
+
if (file.endsWith('.json')) {
|
|
176
|
+
fs.unlinkSync(path.join(this.sessionsPath, file));
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
catch (error) {
|
|
181
|
+
console.error('Failed to clear sessions:', error);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Save session to file
|
|
186
|
+
*/
|
|
187
|
+
saveSession(session) {
|
|
188
|
+
const sessionFile = path.join(this.sessionsPath, `${session.sessionId}.json`);
|
|
189
|
+
fs.writeFileSync(sessionFile, JSON.stringify(session, null, 2), 'utf8');
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
exports.GenericSessionManager = GenericSessionManager;
|
|
@@ -238,7 +238,7 @@ async function handlePatternOperation(operation, args, logger, requestId, valida
|
|
|
238
238
|
});
|
|
239
239
|
// Clean up session file after successful Vector DB storage
|
|
240
240
|
try {
|
|
241
|
-
const sessionDir = (0, session_utils_1.getAndValidateSessionDirectory)(
|
|
241
|
+
const sessionDir = (0, session_utils_1.getAndValidateSessionDirectory)(false);
|
|
242
242
|
const sessionFile = path.join(sessionDir, 'pattern-sessions', `${workflowStep.sessionId}.json`);
|
|
243
243
|
if (fs.existsSync(sessionFile)) {
|
|
244
244
|
fs.unlinkSync(sessionFile);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* No-Op AI Provider
|
|
3
|
+
*
|
|
4
|
+
* Placeholder provider used when no AI API keys are configured.
|
|
5
|
+
* Allows the MCP server to start successfully even without AI capabilities,
|
|
6
|
+
* enabling tools that don't require AI (e.g., prompts, project-setup) to function.
|
|
7
|
+
*/
|
|
8
|
+
import { AIProvider, AIResponse, AgenticResult, ToolLoopConfig } from '../ai-provider.interface';
|
|
9
|
+
export declare class NoOpAIProvider implements AIProvider {
|
|
10
|
+
private static readonly ERROR_MESSAGE;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a NoOp provider that doesn't require API keys
|
|
13
|
+
*/
|
|
14
|
+
constructor();
|
|
15
|
+
/**
|
|
16
|
+
* Always returns false since no actual AI provider is configured
|
|
17
|
+
*/
|
|
18
|
+
isInitialized(): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Returns a placeholder model name
|
|
21
|
+
*/
|
|
22
|
+
getDefaultModel(): string;
|
|
23
|
+
/**
|
|
24
|
+
* Returns the provider type
|
|
25
|
+
*/
|
|
26
|
+
getProviderType(): string;
|
|
27
|
+
/**
|
|
28
|
+
* Returns the model name
|
|
29
|
+
*/
|
|
30
|
+
getModelName(): string;
|
|
31
|
+
/**
|
|
32
|
+
* Returns the SDK provider
|
|
33
|
+
*/
|
|
34
|
+
getSDKProvider(): string;
|
|
35
|
+
/**
|
|
36
|
+
* Throws error explaining AI is not available
|
|
37
|
+
*/
|
|
38
|
+
sendMessage(_message: string, _operation?: string, _evaluationContext?: {
|
|
39
|
+
user_intent?: string;
|
|
40
|
+
interaction_id?: string;
|
|
41
|
+
}): Promise<AIResponse>;
|
|
42
|
+
/**
|
|
43
|
+
* Throws error explaining AI is not available
|
|
44
|
+
*/
|
|
45
|
+
toolLoop(_config: ToolLoopConfig): Promise<AgenticResult>;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=noop-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noop-provider.d.ts","sourceRoot":"","sources":["../../../src/core/providers/noop-provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,UAAU,EACV,UAAU,EACV,aAAa,EACb,cAAc,EACf,MAAM,0BAA0B,CAAC;AAElC,qBAAa,cAAe,YAAW,UAAU;IAC/C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAEgD;IAErF;;OAEG;;IAKH;;OAEG;IACH,aAAa,IAAI,OAAO;IAIxB;;OAEG;IACH,eAAe,IAAI,MAAM;IAIzB;;OAEG;IACH,eAAe,IAAI,MAAM;IAIzB;;OAEG;IACH,YAAY,IAAI,MAAM;IAItB;;OAEG;IACH,cAAc,IAAI,MAAM;IAIxB;;OAEG;IACG,WAAW,CACf,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,EACnB,kBAAkB,CAAC,EAAE;QACnB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,GACA,OAAO,CAAC,UAAU,CAAC;IAItB;;OAEG;IACG,QAAQ,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CAGhE"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* No-Op AI Provider
|
|
4
|
+
*
|
|
5
|
+
* Placeholder provider used when no AI API keys are configured.
|
|
6
|
+
* Allows the MCP server to start successfully even without AI capabilities,
|
|
7
|
+
* enabling tools that don't require AI (e.g., prompts, project-setup) to function.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.NoOpAIProvider = void 0;
|
|
11
|
+
class NoOpAIProvider {
|
|
12
|
+
static ERROR_MESSAGE = 'AI provider is not available. No API keys configured. ' +
|
|
13
|
+
'Please set ANTHROPIC_API_KEY, OPENAI_API_KEY, or another supported provider key.';
|
|
14
|
+
/**
|
|
15
|
+
* Creates a NoOp provider that doesn't require API keys
|
|
16
|
+
*/
|
|
17
|
+
constructor() {
|
|
18
|
+
// No initialization needed
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Always returns false since no actual AI provider is configured
|
|
22
|
+
*/
|
|
23
|
+
isInitialized() {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Returns a placeholder model name
|
|
28
|
+
*/
|
|
29
|
+
getDefaultModel() {
|
|
30
|
+
return 'none';
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Returns the provider type
|
|
34
|
+
*/
|
|
35
|
+
getProviderType() {
|
|
36
|
+
return 'noop';
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Returns the model name
|
|
40
|
+
*/
|
|
41
|
+
getModelName() {
|
|
42
|
+
return 'none';
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Returns the SDK provider
|
|
46
|
+
*/
|
|
47
|
+
getSDKProvider() {
|
|
48
|
+
return 'noop';
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Throws error explaining AI is not available
|
|
52
|
+
*/
|
|
53
|
+
async sendMessage(_message, _operation, _evaluationContext) {
|
|
54
|
+
throw new Error(NoOpAIProvider.ERROR_MESSAGE);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Throws error explaining AI is not available
|
|
58
|
+
*/
|
|
59
|
+
async toolLoop(_config) {
|
|
60
|
+
throw new Error(NoOpAIProvider.ERROR_MESSAGE);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.NoOpAIProvider = NoOpAIProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/core/schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAIlD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAWrD,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACrC,QAAQ,C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AU;IAyCnC;;OAEG;IACG,iBAAiB,CACrB,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,EACpD,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAuE9B;;OAEG;YACW,wBAAwB;IAmBtC;;OAEG;IACH,OAAO,CAAC,2BAA2B;IA+CnC;;OAEG;YACW,0BAA0B;IAyCxC;;OAEG;YACW,0BAA0B;IA6ExC;;OAEG;IACH,OAAO,CAAC,8BAA8B;IAOtC;;OAEG;IACH,OAAO,CAAC,2BAA2B;IAanC;;OAEG;IACH,OAAO,CAAC,4BAA4B;IAYpC;;;OAGG;YACW,sBAAsB;IAsBpC;;OAEG;YACW,oBAAoB;IAmDlC;;OAEG;YACW,sBAAsB;IAkEpC;;OAEG;YACW,uBAAuB;CAuItC"}
|
package/dist/core/schema.js
CHANGED
|
@@ -428,7 +428,6 @@ class ResourceRecommender {
|
|
|
428
428
|
* Load and format solution assembly prompt from file
|
|
429
429
|
*/
|
|
430
430
|
async loadSolutionAssemblyPrompt(intent, resources, patterns) {
|
|
431
|
-
const template = (0, shared_prompt_loader_1.loadPrompt)('resource-selection');
|
|
432
431
|
// Format resources for the prompt with capability information
|
|
433
432
|
const resourcesText = resources.map((resource, index) => {
|
|
434
433
|
return `${index}: ${resource.kind.toUpperCase()}
|
|
@@ -449,10 +448,11 @@ class ResourceRecommender {
|
|
|
449
448
|
Rationale: ${pattern.rationale}
|
|
450
449
|
Triggers: ${pattern.triggers?.join(', ') || 'None'}`).join('\n')
|
|
451
450
|
: 'No organizational patterns found for this request.';
|
|
452
|
-
return
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
451
|
+
return (0, shared_prompt_loader_1.loadPrompt)('resource-selection', {
|
|
452
|
+
intent,
|
|
453
|
+
resources: resourcesText,
|
|
454
|
+
patterns: patternsContext
|
|
455
|
+
});
|
|
456
456
|
}
|
|
457
457
|
/**
|
|
458
458
|
* Add pattern-suggested resources that are missing from capability search results
|
|
@@ -758,14 +758,14 @@ Available Node Labels: ${clusterOptions.nodeLabels.length > 0 ? clusterOptions.n
|
|
|
758
758
|
Triggers: ${result.policy.triggers?.join(', ') || 'None'}
|
|
759
759
|
Score: ${result.score.toFixed(3)} (${result.matchType})`).join('\n')
|
|
760
760
|
: 'No organizational policies found for this request.';
|
|
761
|
-
//
|
|
762
|
-
const
|
|
763
|
-
|
|
764
|
-
.
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
761
|
+
// Generate question prompt with variables
|
|
762
|
+
const questionPrompt = (0, shared_prompt_loader_1.loadPrompt)('question-generation', {
|
|
763
|
+
intent,
|
|
764
|
+
solution_description: solution.description,
|
|
765
|
+
resource_details: resourceDetails,
|
|
766
|
+
cluster_options: clusterOptionsText,
|
|
767
|
+
policy_context: policyContextText
|
|
768
|
+
});
|
|
769
769
|
const response = await this.aiProvider.sendMessage(questionPrompt, 'recommend-question-generation', {
|
|
770
770
|
user_intent: `Generate deployment questions for: ${intent}`,
|
|
771
771
|
interaction_id: interaction_id || 'recommend_question_generation'
|
|
@@ -3,13 +3,11 @@
|
|
|
3
3
|
* Provides consistent session directory resolution and validation across all tools
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
* Get session directory from
|
|
7
|
-
* CLI parameter takes precedence over environment variable
|
|
6
|
+
* Get session directory from environment variable
|
|
8
7
|
*
|
|
9
|
-
* @param args - Tool arguments that may contain sessionDir
|
|
10
8
|
* @returns Resolved session directory path (can be relative or absolute)
|
|
11
9
|
*/
|
|
12
|
-
export declare function getSessionDirectory(
|
|
10
|
+
export declare function getSessionDirectory(): string;
|
|
13
11
|
/**
|
|
14
12
|
* Validate session directory exists and is accessible
|
|
15
13
|
* Works with both relative and absolute paths
|
|
@@ -21,9 +19,8 @@ export declare function validateSessionDirectory(sessionDir: string, requireWrit
|
|
|
21
19
|
/**
|
|
22
20
|
* Get and validate session directory in one call
|
|
23
21
|
*
|
|
24
|
-
* @param args - Tool arguments that may contain sessionDir
|
|
25
22
|
* @param requireWrite - Whether to test write permissions (default: false)
|
|
26
23
|
* @returns Validated session directory path
|
|
27
24
|
*/
|
|
28
|
-
export declare function getAndValidateSessionDirectory(
|
|
25
|
+
export declare function getAndValidateSessionDirectory(requireWrite?: boolean): string;
|
|
29
26
|
//# sourceMappingURL=session-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-utils.d.ts","sourceRoot":"","sources":["../../src/core/session-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH
|
|
1
|
+
{"version":3,"file":"session-utils.d.ts","sourceRoot":"","sources":["../../src/core/session-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAS5C;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,GAAE,OAAe,GAAG,IAAI,CA4ChG;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,YAAY,GAAE,OAAe,GAAG,MAAM,CAIpF"}
|