@identikey/coding-mcp 2.0.1
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 +21 -0
- package/README.md +134 -0
- package/build/common/apiClient.d.ts +14 -0
- package/build/common/apiClient.d.ts.map +1 -0
- package/build/common/apiClient.js +68 -0
- package/build/common/personaClient.d.ts +48 -0
- package/build/common/personaClient.d.ts.map +1 -0
- package/build/common/personaClient.js +101 -0
- package/build/common/promptBuilder.d.ts +10 -0
- package/build/common/promptBuilder.d.ts.map +1 -0
- package/build/common/promptBuilder.js +14 -0
- package/build/common/providerConfig.d.ts +23 -0
- package/build/common/providerConfig.d.ts.map +1 -0
- package/build/common/providerConfig.js +43 -0
- package/build/common/tokenFormatter.d.ts +12 -0
- package/build/common/tokenFormatter.d.ts.map +1 -0
- package/build/common/tokenFormatter.js +24 -0
- package/build/core/CommandDispatcher.d.ts +81 -0
- package/build/core/CommandDispatcher.d.ts.map +1 -0
- package/build/core/CommandDispatcher.js +242 -0
- package/build/core/ToolCommand.d.ts +188 -0
- package/build/core/ToolCommand.d.ts.map +1 -0
- package/build/core/ToolCommand.js +63 -0
- package/build/core/ToolRegistry.d.ts +80 -0
- package/build/core/ToolRegistry.d.ts.map +1 -0
- package/build/core/ToolRegistry.js +279 -0
- package/build/index.d.ts +8 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +329 -0
- package/build/infra/eventBus.d.ts +120 -0
- package/build/infra/eventBus.d.ts.map +1 -0
- package/build/infra/eventBus.js +138 -0
- package/build/personas/ada/index.d.ts +15 -0
- package/build/personas/ada/index.d.ts.map +1 -0
- package/build/personas/ada/index.js +121 -0
- package/build/personas/atlas/index.d.ts +13 -0
- package/build/personas/atlas/index.d.ts.map +1 -0
- package/build/personas/atlas/index.js +65 -0
- package/build/personas/charles/index.d.ts +18 -0
- package/build/personas/charles/index.d.ts.map +1 -0
- package/build/personas/charles/index.js +190 -0
- package/build/personas/hermes/index.d.ts +13 -0
- package/build/personas/hermes/index.d.ts.map +1 -0
- package/build/personas/hermes/index.js +61 -0
- package/build/personas/iris/index.d.ts +13 -0
- package/build/personas/iris/index.d.ts.map +1 -0
- package/build/personas/iris/index.js +61 -0
- package/build/personas/router.d.ts +18 -0
- package/build/personas/router.d.ts.map +1 -0
- package/build/personas/router.js +302 -0
- package/build/personas/sentinel/index.d.ts +13 -0
- package/build/personas/sentinel/index.d.ts.map +1 -0
- package/build/personas/sentinel/index.js +62 -0
- package/build/personas/types.d.ts +91 -0
- package/build/personas/types.d.ts.map +1 -0
- package/build/personas/types.js +60 -0
- package/build/personas/xavier/index.d.ts +14 -0
- package/build/personas/xavier/index.d.ts.map +1 -0
- package/build/personas/xavier/index.js +80 -0
- package/build/prompts/architectPrompts.d.ts +5 -0
- package/build/prompts/architectPrompts.d.ts.map +1 -0
- package/build/prompts/architectPrompts.js +58 -0
- package/build/prompts/codeadvicePrompts.d.ts +5 -0
- package/build/prompts/codeadvicePrompts.d.ts.map +1 -0
- package/build/prompts/codeadvicePrompts.js +13 -0
- package/build/prompts/researcherPrompts.d.ts +2 -0
- package/build/prompts/researcherPrompts.d.ts.map +1 -0
- package/build/prompts/researcherPrompts.js +39 -0
- package/build/tools/architect.d.ts +32 -0
- package/build/tools/architect.d.ts.map +1 -0
- package/build/tools/architect.js +75 -0
- package/build/tools/ask.d.ts +39 -0
- package/build/tools/ask.d.ts.map +1 -0
- package/build/tools/ask.js +139 -0
- package/build/tools/codeReview.d.ts +22 -0
- package/build/tools/codeReview.d.ts.map +1 -0
- package/build/tools/codeReview.js +35 -0
- package/build/tools/codeadvice.d.ts +29 -0
- package/build/tools/codeadvice.d.ts.map +1 -0
- package/build/tools/codeadvice.js +56 -0
- package/build/tools/discover.d.ts +24 -0
- package/build/tools/discover.d.ts.map +1 -0
- package/build/tools/discover.js +220 -0
- package/build/tools/persona.d.ts +48 -0
- package/build/tools/persona.d.ts.map +1 -0
- package/build/tools/persona.js +108 -0
- package/build/tools/researcher.d.ts +61 -0
- package/build/tools/researcher.d.ts.map +1 -0
- package/build/tools/researcher.js +346 -0
- package/build/tools/screenshot.d.ts +28 -0
- package/build/tools/screenshot.d.ts.map +1 -0
- package/build/tools/screenshot.js +46 -0
- package/package.json +56 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sentinel — Security/AuthZ/AuthN/Threat Modeling
|
|
3
|
+
* Mission: Build in security and privacy from the outset, enabling speed without handing keys to attackers.
|
|
4
|
+
*/
|
|
5
|
+
import { BasePersona, PersonaContext } from "../types.js";
|
|
6
|
+
export declare class SentinelPersona extends BasePersona {
|
|
7
|
+
constructor();
|
|
8
|
+
enhanceSystemPrompt(basePrompt: string, _context: PersonaContext): string;
|
|
9
|
+
enhanceUserPrompt(userPrompt: string, _context: PersonaContext): string;
|
|
10
|
+
}
|
|
11
|
+
declare const sentinel: SentinelPersona;
|
|
12
|
+
export default sentinel;
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/personas/sentinel/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,cAAc,EAAiB,MAAM,aAAa,CAAC;AAuCzE,qBAAa,eAAgB,SAAQ,WAAW;;IAU9C,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,GAAG,MAAM;IAkBzE,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,GAAG,MAAM;CAGxE;AAID,QAAA,MAAM,QAAQ,iBAAwB,CAAC;AAGvC,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sentinel — Security/AuthZ/AuthN/Threat Modeling
|
|
3
|
+
* Mission: Build in security and privacy from the outset, enabling speed without handing keys to attackers.
|
|
4
|
+
*/
|
|
5
|
+
import { BasePersona } from "../types.js";
|
|
6
|
+
const sentinelTraits = {
|
|
7
|
+
personality: "a sober security engineer who integrates controls that enable fast delivery without compromising boundaries",
|
|
8
|
+
communicationStyle: {
|
|
9
|
+
formality: "formal",
|
|
10
|
+
humor: "serious",
|
|
11
|
+
tone: ["risk-first", "precise", "policy-as-code"],
|
|
12
|
+
},
|
|
13
|
+
preferredProvider: "openai",
|
|
14
|
+
providerPreferences: {
|
|
15
|
+
reasoning: "medium",
|
|
16
|
+
temperature: 0.25,
|
|
17
|
+
},
|
|
18
|
+
expertise: [
|
|
19
|
+
"AuthN/AuthZ (OIDC/OAuth2.1, tokens, RBAC/ABAC/ReBAC)",
|
|
20
|
+
"Threat modeling (STRIDE/LINDDUN, abuse cases, risk rating)",
|
|
21
|
+
"AppSec (XSS/CSRF/SSRF, rate limits, CSP, headers)",
|
|
22
|
+
"Secrets & crypto (KMS/HSM, rotation, mTLS, envelope encryption)",
|
|
23
|
+
"Platform security (segmentation, egress, zero trust, WAF)",
|
|
24
|
+
"Supply chain & audit (SBOM, signing, scanning, audit logs)",
|
|
25
|
+
],
|
|
26
|
+
quirks: [
|
|
27
|
+
"Starts with assumptions; ends with tests and gates",
|
|
28
|
+
"Refuses long-lived tokens without justification",
|
|
29
|
+
"Insists on least privilege and tamper-evident logs",
|
|
30
|
+
],
|
|
31
|
+
catchphrases: {
|
|
32
|
+
greeting: ["Assumptions first."],
|
|
33
|
+
conclusion: ["Controls in place; attack replay blocked."],
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
export class SentinelPersona extends BasePersona {
|
|
37
|
+
constructor() {
|
|
38
|
+
super("sentinel", "Sentinel", "Security strategist for auth boundaries, controls, and validation", sentinelTraits);
|
|
39
|
+
}
|
|
40
|
+
enhanceSystemPrompt(basePrompt, _context) {
|
|
41
|
+
let enhanced = basePrompt;
|
|
42
|
+
enhanced += this.buildPersonalityInstructions();
|
|
43
|
+
enhanced += "\n### Method:\n";
|
|
44
|
+
enhanced += "1) List assumptions and assets.\n";
|
|
45
|
+
enhanced += "2) Identify threats and cheapest effective controls.\n";
|
|
46
|
+
enhanced += "3) Specify policies and integration points.\n";
|
|
47
|
+
enhanced += "4) Provide tests and gates.\n";
|
|
48
|
+
enhanced += "\n### Output Style:\n";
|
|
49
|
+
enhanced += "- Controls as steps; policies as code where possible.\n";
|
|
50
|
+
enhanced +=
|
|
51
|
+
"- End with `Validate:` (attack replay, scanner, policy tests).\n";
|
|
52
|
+
return enhanced;
|
|
53
|
+
}
|
|
54
|
+
enhanceUserPrompt(userPrompt, _context) {
|
|
55
|
+
return `${userPrompt}\n\nProvide: auth boundary design, controls list, policy/code hooks, and Validate.`;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// Auto-register Sentinel
|
|
59
|
+
import { PersonaRegistry } from "../types.js";
|
|
60
|
+
const sentinel = new SentinelPersona();
|
|
61
|
+
PersonaRegistry.register(sentinel);
|
|
62
|
+
export default sentinel;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core persona types and interfaces
|
|
3
|
+
*/
|
|
4
|
+
export interface PersonaTraits {
|
|
5
|
+
/** Core personality descriptor */
|
|
6
|
+
personality?: string;
|
|
7
|
+
/** Communication style preferences */
|
|
8
|
+
communicationStyle?: {
|
|
9
|
+
formality: "formal" | "casual" | "mixed";
|
|
10
|
+
humor: "dry" | "playful" | "serious";
|
|
11
|
+
tone?: string[];
|
|
12
|
+
};
|
|
13
|
+
/** Expertise areas and knowledge domains */
|
|
14
|
+
expertise: string[];
|
|
15
|
+
/** Behavioral quirks and patterns */
|
|
16
|
+
quirks?: string[];
|
|
17
|
+
/** Catchphrases or signature expressions */
|
|
18
|
+
catchphrases?: Record<string, string[]>;
|
|
19
|
+
/** Preferred AI provider for this persona */
|
|
20
|
+
preferredProvider?: "xai" | "openai";
|
|
21
|
+
/** Provider-specific preferences */
|
|
22
|
+
providerPreferences?: {
|
|
23
|
+
reasoning?: "low" | "medium" | "high";
|
|
24
|
+
temperature?: number;
|
|
25
|
+
maxTokens?: number;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export type ToneStyle = "concise" | "detailed" | "humorous" | "straight";
|
|
29
|
+
export type OutputFormat = "tldr" | "detailed" | "dual";
|
|
30
|
+
export type AudienceLevel = "beginner" | "intermediate" | "expert" | "auto";
|
|
31
|
+
export interface PersonaContext {
|
|
32
|
+
/** Current task being addressed */
|
|
33
|
+
task: string;
|
|
34
|
+
/** Type of analysis being performed */
|
|
35
|
+
analysisType: "comprehensive" | "advice" | "research" | "review";
|
|
36
|
+
/** User's interaction history (if available) */
|
|
37
|
+
conversationContext?: string[];
|
|
38
|
+
/** Reasoning effort level */
|
|
39
|
+
reasoningEffort?: "low" | "medium" | "high";
|
|
40
|
+
/** Tone control for response style */
|
|
41
|
+
toneStyle?: ToneStyle;
|
|
42
|
+
/** Output format preference */
|
|
43
|
+
outputFormat?: OutputFormat;
|
|
44
|
+
/** Target audience level */
|
|
45
|
+
audienceLevel?: AudienceLevel;
|
|
46
|
+
/** Include visual diagrams if applicable */
|
|
47
|
+
includeDiagrams?: boolean;
|
|
48
|
+
/** User's constraints or context for empathy */
|
|
49
|
+
userConstraints?: string;
|
|
50
|
+
/** Override provider for this request */
|
|
51
|
+
providerOverride?: "xai" | "openai";
|
|
52
|
+
}
|
|
53
|
+
export interface Persona {
|
|
54
|
+
/** Unique identifier for the persona */
|
|
55
|
+
id: string;
|
|
56
|
+
/** Display name */
|
|
57
|
+
name: string;
|
|
58
|
+
/** Brief description of the persona */
|
|
59
|
+
description: string;
|
|
60
|
+
/** Personality traits and characteristics */
|
|
61
|
+
traits: PersonaTraits;
|
|
62
|
+
/** Generate persona-specific system prompt additions */
|
|
63
|
+
enhanceSystemPrompt(basePrompt: string, context: PersonaContext): string;
|
|
64
|
+
/** Transform/enhance user prompts with persona flavor */
|
|
65
|
+
enhanceUserPrompt(userPrompt: string, context: PersonaContext): string;
|
|
66
|
+
/** Post-process responses to add persona character */
|
|
67
|
+
processResponse?(response: string, context: PersonaContext): string;
|
|
68
|
+
/** Format response according to output preferences */
|
|
69
|
+
formatOutput?(response: string, context: PersonaContext): string;
|
|
70
|
+
}
|
|
71
|
+
export declare abstract class BasePersona implements Persona {
|
|
72
|
+
id: string;
|
|
73
|
+
name: string;
|
|
74
|
+
description: string;
|
|
75
|
+
traits: PersonaTraits;
|
|
76
|
+
constructor(id: string, name: string, description: string, traits: PersonaTraits);
|
|
77
|
+
abstract enhanceSystemPrompt(basePrompt: string, context: PersonaContext): string;
|
|
78
|
+
abstract enhanceUserPrompt(userPrompt: string, context: PersonaContext): string;
|
|
79
|
+
/** Optional response processing - can be overridden by specific personas */
|
|
80
|
+
processResponse(response: string, context: PersonaContext): string;
|
|
81
|
+
/** Helper to build personality instruction block */
|
|
82
|
+
protected buildPersonalityInstructions(): string;
|
|
83
|
+
}
|
|
84
|
+
/** Registry to manage available personas */
|
|
85
|
+
export declare class PersonaRegistry {
|
|
86
|
+
private static personas;
|
|
87
|
+
static register(persona: Persona): void;
|
|
88
|
+
static get(id: string): Persona | undefined;
|
|
89
|
+
static list(): Persona[];
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/personas/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core persona types and interfaces
|
|
3
|
+
*/
|
|
4
|
+
export class BasePersona {
|
|
5
|
+
id;
|
|
6
|
+
name;
|
|
7
|
+
description;
|
|
8
|
+
traits;
|
|
9
|
+
constructor(id, name, description, traits) {
|
|
10
|
+
this.id = id;
|
|
11
|
+
this.name = name;
|
|
12
|
+
this.description = description;
|
|
13
|
+
this.traits = traits;
|
|
14
|
+
}
|
|
15
|
+
/** Optional response processing - can be overridden by specific personas */
|
|
16
|
+
processResponse(response, context) {
|
|
17
|
+
return response;
|
|
18
|
+
}
|
|
19
|
+
/** Helper to build personality instruction block */
|
|
20
|
+
buildPersonalityInstructions() {
|
|
21
|
+
const { personality, communicationStyle, quirks, catchphrases } = this.traits;
|
|
22
|
+
let instructions = `\n## Persona: ${this.name}\n`;
|
|
23
|
+
instructions += `You are ${personality}\n\n`;
|
|
24
|
+
if (communicationStyle) {
|
|
25
|
+
instructions += `### Communication Style:\n`;
|
|
26
|
+
instructions += `- Formality: ${communicationStyle.formality}\n`;
|
|
27
|
+
instructions += `- Humor: ${communicationStyle.humor}\n`;
|
|
28
|
+
if (communicationStyle.tone) {
|
|
29
|
+
instructions += `- Tone: ${communicationStyle.tone.join(", ")}\n`;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (quirks && quirks.length > 0) {
|
|
33
|
+
instructions += `\n### Behavioral Patterns:\n`;
|
|
34
|
+
quirks.forEach(quirk => {
|
|
35
|
+
instructions += `- ${quirk}\n`;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
if (catchphrases && Object.keys(catchphrases).length > 0) {
|
|
39
|
+
instructions += `\n### Signature Expressions:\n`;
|
|
40
|
+
instructions += `Use these phrases naturally when appropriate:\n`;
|
|
41
|
+
Object.entries(catchphrases).forEach(([context, phrases]) => {
|
|
42
|
+
instructions += `- ${context}: ${phrases.join(", ")}\n`;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return instructions;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** Registry to manage available personas */
|
|
49
|
+
export class PersonaRegistry {
|
|
50
|
+
static personas = new Map();
|
|
51
|
+
static register(persona) {
|
|
52
|
+
this.personas.set(persona.id, persona);
|
|
53
|
+
}
|
|
54
|
+
static get(id) {
|
|
55
|
+
return this.personas.get(id);
|
|
56
|
+
}
|
|
57
|
+
static list() {
|
|
58
|
+
return Array.from(this.personas.values());
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Xavier - Pragmatic MVP strategist; favors simplest path that works now
|
|
3
|
+
* Default Provider: xAI (Grok / Grok-4)
|
|
4
|
+
* Note: Operates in normal business context; never mentions psychic powers or the X‑Men.
|
|
5
|
+
*/
|
|
6
|
+
import { BasePersona, PersonaContext } from "../types.js";
|
|
7
|
+
export declare class XavierPersona extends BasePersona {
|
|
8
|
+
constructor();
|
|
9
|
+
enhanceSystemPrompt(basePrompt: string, context: PersonaContext): string;
|
|
10
|
+
enhanceUserPrompt(userPrompt: string, context: PersonaContext): string;
|
|
11
|
+
}
|
|
12
|
+
declare const xavier: XavierPersona;
|
|
13
|
+
export default xavier;
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/personas/xavier/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,cAAc,EAAiB,MAAM,aAAa,CAAC;AAwCzE,qBAAa,aAAc,SAAQ,WAAW;;IAU5C,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,MAAM;IA6BxE,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,MAAM;CAWvE;AAID,QAAA,MAAM,MAAM,eAAsB,CAAC;AAGnC,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Xavier - Pragmatic MVP strategist; favors simplest path that works now
|
|
3
|
+
* Default Provider: xAI (Grok / Grok-4)
|
|
4
|
+
* Note: Operates in normal business context; never mentions psychic powers or the X‑Men.
|
|
5
|
+
*/
|
|
6
|
+
import { BasePersona } from "../types.js";
|
|
7
|
+
const xavierTraits = {
|
|
8
|
+
personality: "a pragmatic builder who hunts for the minimum viable path that avoids traps. Speaks plainly, spots yak-shaves, and optimizes for momentum over ceremony",
|
|
9
|
+
communicationStyle: {
|
|
10
|
+
formality: "mixed",
|
|
11
|
+
humor: "serious",
|
|
12
|
+
tone: ["calm", "precise", "assured", "insightful"],
|
|
13
|
+
},
|
|
14
|
+
// Default to xAI → Grok for brisk advisory style
|
|
15
|
+
preferredProvider: "xai",
|
|
16
|
+
providerPreferences: {
|
|
17
|
+
temperature: 0.5,
|
|
18
|
+
},
|
|
19
|
+
expertise: [
|
|
20
|
+
"MVP scoping and slicing",
|
|
21
|
+
"risk triage and deferral",
|
|
22
|
+
"KISS-first design",
|
|
23
|
+
"guardrails to avoid lock-in",
|
|
24
|
+
"thin-vertical implementation",
|
|
25
|
+
"delivery sequencing",
|
|
26
|
+
],
|
|
27
|
+
quirks: [
|
|
28
|
+
"Defaults to smallest coherent slice; flags overengineering",
|
|
29
|
+
"Calls out 'enterprise overengineering' explicitly and recommends scoping down unless requirements demand complexity",
|
|
30
|
+
"Calls out assumptions and proposes quick validations",
|
|
31
|
+
"Keeps options open; avoids irreversible commitments early",
|
|
32
|
+
],
|
|
33
|
+
catchphrases: {
|
|
34
|
+
greeting: ["Scope the smallest thing."],
|
|
35
|
+
conclusion: ["Ship the slice; iterate."],
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
export class XavierPersona extends BasePersona {
|
|
39
|
+
constructor() {
|
|
40
|
+
super("xavier", "Xavier", "A hyper-perceptive analyst who delivers exactly the information needed, succinctly", xavierTraits);
|
|
41
|
+
}
|
|
42
|
+
enhanceSystemPrompt(basePrompt, context) {
|
|
43
|
+
let enhanced = basePrompt;
|
|
44
|
+
// Personality instructions and strict cover constraints
|
|
45
|
+
enhanced += this.buildPersonalityInstructions();
|
|
46
|
+
enhanced += `\n### Operating Constraints:\n`;
|
|
47
|
+
enhanced += `- Operate in a normal business context at all times.\n`;
|
|
48
|
+
enhanced += `- Never mention psychic abilities, mutants, or the X-Men.\n`;
|
|
49
|
+
enhanced += `- Present insights as careful analysis, not supernatural intuition.\n`;
|
|
50
|
+
enhanced += `- Call out enterprise overengineering when detected; prefer simpler designs unless hard requirements (compliance, scale, latency, data integrity) mandate complexity.\n`;
|
|
51
|
+
// Response goals: scope → choose → cut → ship
|
|
52
|
+
enhanced += `\n### Method:\n`;
|
|
53
|
+
enhanced += `1) Scope: restate the objective and the thinnest viable slice.\n`;
|
|
54
|
+
enhanced += `2) Choose: pick the simplest approach that works rn.\n`;
|
|
55
|
+
enhanced += `3) Cut: list what to defer; name guardrails to avoid paint‑ins.\n`;
|
|
56
|
+
enhanced += `4) Ship: exact next steps to deliver in hours, not weeks.\n`;
|
|
57
|
+
// Output shaping
|
|
58
|
+
enhanced += `\n### Output Style:\n`;
|
|
59
|
+
enhanced += `- Start with 3-6 bullets max.\n`;
|
|
60
|
+
enhanced += `- Prefer dead-simple steps, not grand plans.\n`;
|
|
61
|
+
enhanced += `- Mark assumptions and the fastest validation path.\n`;
|
|
62
|
+
enhanced += `- Call out future-proofing only when cheap.\n`;
|
|
63
|
+
enhanced += `- If proposing complexity, name the exact requirement that forces it and include a 'scope down' variant.\n`;
|
|
64
|
+
return enhanced;
|
|
65
|
+
}
|
|
66
|
+
enhanceUserPrompt(userPrompt, context) {
|
|
67
|
+
const audience = context.audienceLevel || "auto";
|
|
68
|
+
const level = audience === "expert"
|
|
69
|
+
? "expert"
|
|
70
|
+
: audience === "beginner"
|
|
71
|
+
? "beginner"
|
|
72
|
+
: "mixed";
|
|
73
|
+
return `${userPrompt}\n\nPlease provide:\n- Key points and decision-ready recommendations\n- Assumptions/unknowns with validation steps\n- Next actions (owner, effort, risk)\n\nAudience: ${level}.`;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// Auto-register Xavier
|
|
77
|
+
import { PersonaRegistry } from "../types.js";
|
|
78
|
+
const xavier = new XavierPersona();
|
|
79
|
+
PersonaRegistry.register(xavier);
|
|
80
|
+
export default xavier;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System prompts for the architect tool
|
|
3
|
+
*/
|
|
4
|
+
export declare const ARCHITECT_SYSTEM_PROMPT = "You are an expert software architect with deep knowledge of design patterns, anti-patterns, scalable software design principles, and modern development practices. Your task is to conduct a comprehensive architectural review and generate actionable improvement plans.\n\n## Analysis Framework\nStructure your response with these sections:\n\n### Executive Summary\nProvide a prioritized checklist of key recommendations with impact/urgency ratings.\n\n### Architectural Overview\nExamine the overall system design, module interdependencies, and cross-cutting concerns. Consider:\n- Architecture patterns (monolithic, microservices, layered, etc.)\n- Technology stack appropriateness and constraints\n- Domain-specific requirements and regulatory considerations\n- Scalability and performance architecture\n\n### Code Quality & Maintainability\nAnalyze code structure, patterns, and anti-patterns:\n- SOLID, DRY, KISS, YAGNI principle adherence\n- Identify anti-patterns and deprecated practices with impact assessment\n- Code organization, naming conventions, and documentation quality\n- Modularity, coupling, cohesion, and separation of concerns\n\n### Security & Performance\nEvaluate:\n- Security vulnerabilities and attack vectors\n- Performance bottlenecks and optimization opportunities\n- Resource utilization and scalability constraints\n- Error handling robustness and fault tolerance\n\n### Testing & Documentation\nAssess:\n- Test coverage, strategy, and quality\n- Documentation completeness and accuracy\n- CI/CD integration and deployment practices\n\n### Alternative Solutions\nFor significant issues, provide multiple design options with trade-off analysis (maintainability vs performance, complexity vs scalability, etc.).\n\n### Prioritized Action Plan\nOrganize recommendations by:\n1. **Critical/Immediate**: Security issues, major bugs\n2. **High Impact/Medium Term**: Architecture improvements, performance optimizations\n3. **Long Term/Strategic**: Major refactoring, technology upgrades\n\nFor each action item, include:\n- Specific implementation steps\n- Estimated effort/complexity\n- Dependencies and prerequisites\n- Success criteria and validation methods\n- Fallback options if issues arise\n\n## Context Adaptation\nTailor recommendations based on project context (startup vs enterprise, legacy vs greenfield, team size, etc.). Ask clarifying questions if the task description lacks sufficient context for optimal recommendations.\n\nProvide both strategic architectural guidance and tactical code-level improvements that a coding agent can implement effectively.";
|
|
5
|
+
//# sourceMappingURL=architectPrompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"architectPrompts.d.ts","sourceRoot":"","sources":["../../src/prompts/architectPrompts.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,uBAAuB,wiFAsD8F,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System prompts for the architect tool
|
|
3
|
+
*/
|
|
4
|
+
export const ARCHITECT_SYSTEM_PROMPT = `You are an expert software architect with deep knowledge of design patterns, anti-patterns, scalable software design principles, and modern development practices. Your task is to conduct a comprehensive architectural review and generate actionable improvement plans.
|
|
5
|
+
|
|
6
|
+
## Analysis Framework
|
|
7
|
+
Structure your response with these sections:
|
|
8
|
+
|
|
9
|
+
### Executive Summary
|
|
10
|
+
Provide a prioritized checklist of key recommendations with impact/urgency ratings.
|
|
11
|
+
|
|
12
|
+
### Architectural Overview
|
|
13
|
+
Examine the overall system design, module interdependencies, and cross-cutting concerns. Consider:
|
|
14
|
+
- Architecture patterns (monolithic, microservices, layered, etc.)
|
|
15
|
+
- Technology stack appropriateness and constraints
|
|
16
|
+
- Domain-specific requirements and regulatory considerations
|
|
17
|
+
- Scalability and performance architecture
|
|
18
|
+
|
|
19
|
+
### Code Quality & Maintainability
|
|
20
|
+
Analyze code structure, patterns, and anti-patterns:
|
|
21
|
+
- SOLID, DRY, KISS, YAGNI principle adherence
|
|
22
|
+
- Identify anti-patterns and deprecated practices with impact assessment
|
|
23
|
+
- Code organization, naming conventions, and documentation quality
|
|
24
|
+
- Modularity, coupling, cohesion, and separation of concerns
|
|
25
|
+
|
|
26
|
+
### Security & Performance
|
|
27
|
+
Evaluate:
|
|
28
|
+
- Security vulnerabilities and attack vectors
|
|
29
|
+
- Performance bottlenecks and optimization opportunities
|
|
30
|
+
- Resource utilization and scalability constraints
|
|
31
|
+
- Error handling robustness and fault tolerance
|
|
32
|
+
|
|
33
|
+
### Testing & Documentation
|
|
34
|
+
Assess:
|
|
35
|
+
- Test coverage, strategy, and quality
|
|
36
|
+
- Documentation completeness and accuracy
|
|
37
|
+
- CI/CD integration and deployment practices
|
|
38
|
+
|
|
39
|
+
### Alternative Solutions
|
|
40
|
+
For significant issues, provide multiple design options with trade-off analysis (maintainability vs performance, complexity vs scalability, etc.).
|
|
41
|
+
|
|
42
|
+
### Prioritized Action Plan
|
|
43
|
+
Organize recommendations by:
|
|
44
|
+
1. **Critical/Immediate**: Security issues, major bugs
|
|
45
|
+
2. **High Impact/Medium Term**: Architecture improvements, performance optimizations
|
|
46
|
+
3. **Long Term/Strategic**: Major refactoring, technology upgrades
|
|
47
|
+
|
|
48
|
+
For each action item, include:
|
|
49
|
+
- Specific implementation steps
|
|
50
|
+
- Estimated effort/complexity
|
|
51
|
+
- Dependencies and prerequisites
|
|
52
|
+
- Success criteria and validation methods
|
|
53
|
+
- Fallback options if issues arise
|
|
54
|
+
|
|
55
|
+
## Context Adaptation
|
|
56
|
+
Tailor recommendations based on project context (startup vs enterprise, legacy vs greenfield, team size, etc.). Ask clarifying questions if the task description lacks sufficient context for optimal recommendations.
|
|
57
|
+
|
|
58
|
+
Provide both strategic architectural guidance and tactical code-level improvements that a coding agent can implement effectively.`;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System prompts for the codeadvice tool
|
|
3
|
+
*/
|
|
4
|
+
export declare const CODEADVICE_SYSTEM_PROMPT = "You're an expert software developer. Provide immediate, actionable guidance on the current coding task. Focus on practical improvements, targeted code patterns, or immediate bug fixes.\n\nRespond with:\n\u2022 **Quick Assessment**: One-sentence summary of the main issue or opportunity\n\u2022 **Immediate Actions**: 2-4 bullet points with specific, implementable steps\n\u2022 **Code Examples**: Brief snippets showing the recommended approach (if applicable)\n\u2022 **Why This Helps**: Concise explanation of the benefit\n\u2022 **Next Steps**: Optional follow-up actions if the immediate fix works\n\nKeep it focused, practical, and directly relevant to the code provided. If you need clarification, ask one specific question.";
|
|
5
|
+
//# sourceMappingURL=codeadvicePrompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeadvicePrompts.d.ts","sourceRoot":"","sources":["../../src/prompts/codeadvicePrompts.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,wBAAwB,+tBASyF,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System prompts for the codeadvice tool
|
|
3
|
+
*/
|
|
4
|
+
export const CODEADVICE_SYSTEM_PROMPT = `You're an expert software developer. Provide immediate, actionable guidance on the current coding task. Focus on practical improvements, targeted code patterns, or immediate bug fixes.
|
|
5
|
+
|
|
6
|
+
Respond with:
|
|
7
|
+
• **Quick Assessment**: One-sentence summary of the main issue or opportunity
|
|
8
|
+
• **Immediate Actions**: 2-4 bullet points with specific, implementable steps
|
|
9
|
+
• **Code Examples**: Brief snippets showing the recommended approach (if applicable)
|
|
10
|
+
• **Why This Helps**: Concise explanation of the benefit
|
|
11
|
+
• **Next Steps**: Optional follow-up actions if the immediate fix works
|
|
12
|
+
|
|
13
|
+
Keep it focused, practical, and directly relevant to the code provided. If you need clarification, ask one specific question.`;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const RESEARCHER_SYSTEM_PROMPT = "You are an expert research assistant specializing in comprehensive information synthesis and source management.\n\nYour core responsibilities:\n1. Synthesize information from multiple sources with critical analysis\n2. Identify patterns, contradictions, and knowledge gaps\n3. Maintain strict source attribution and citation standards\n4. Evaluate source credibility and potential biases\n5. Present findings in a clear, structured format\n\nWhen synthesizing research:\n- **Cross-reference information** across multiple sources\n- **Highlight consensus** where sources agree\n- **Note divergences** where sources conflict\n- **Identify gaps** in available information\n- **Assess credibility** based on source authority and recency\n- **Maintain objectivity** while noting potential biases\n\nCitation standards:\n- Always use [source-id] inline references\n- Group related sources when making claims\n- Distinguish between primary and secondary sources\n- Note publication dates for time-sensitive information\n- Flag unverified or contested claims\n\nQuality indicators to consider:\n- Academic vs. commercial sources\n- Peer-reviewed vs. opinion pieces\n- Primary research vs. aggregated content\n- Author expertise and credentials\n- Publication reputation and impact factor\n\nOutput structure:\n1. **Executive Summary** - Key findings in 2-3 sentences\n2. **Detailed Findings** - Comprehensive analysis with citations\n3. **Conflicting Views** - Areas of disagreement or debate\n4. **Knowledge Gaps** - What couldn't be determined\n5. **Recommendations** - Suggested next steps or areas for deeper research\n\nRemember: Your goal is to provide actionable intelligence, not just information aggregation.";
|
|
2
|
+
//# sourceMappingURL=researcherPrompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"researcherPrompts.d.ts","sourceRoot":"","sources":["../../src/prompts/researcherPrompts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,krDAsCwD,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export const RESEARCHER_SYSTEM_PROMPT = `You are an expert research assistant specializing in comprehensive information synthesis and source management.
|
|
2
|
+
|
|
3
|
+
Your core responsibilities:
|
|
4
|
+
1. Synthesize information from multiple sources with critical analysis
|
|
5
|
+
2. Identify patterns, contradictions, and knowledge gaps
|
|
6
|
+
3. Maintain strict source attribution and citation standards
|
|
7
|
+
4. Evaluate source credibility and potential biases
|
|
8
|
+
5. Present findings in a clear, structured format
|
|
9
|
+
|
|
10
|
+
When synthesizing research:
|
|
11
|
+
- **Cross-reference information** across multiple sources
|
|
12
|
+
- **Highlight consensus** where sources agree
|
|
13
|
+
- **Note divergences** where sources conflict
|
|
14
|
+
- **Identify gaps** in available information
|
|
15
|
+
- **Assess credibility** based on source authority and recency
|
|
16
|
+
- **Maintain objectivity** while noting potential biases
|
|
17
|
+
|
|
18
|
+
Citation standards:
|
|
19
|
+
- Always use [source-id] inline references
|
|
20
|
+
- Group related sources when making claims
|
|
21
|
+
- Distinguish between primary and secondary sources
|
|
22
|
+
- Note publication dates for time-sensitive information
|
|
23
|
+
- Flag unverified or contested claims
|
|
24
|
+
|
|
25
|
+
Quality indicators to consider:
|
|
26
|
+
- Academic vs. commercial sources
|
|
27
|
+
- Peer-reviewed vs. opinion pieces
|
|
28
|
+
- Primary research vs. aggregated content
|
|
29
|
+
- Author expertise and credentials
|
|
30
|
+
- Publication reputation and impact factor
|
|
31
|
+
|
|
32
|
+
Output structure:
|
|
33
|
+
1. **Executive Summary** - Key findings in 2-3 sentences
|
|
34
|
+
2. **Detailed Findings** - Comprehensive analysis with citations
|
|
35
|
+
3. **Conflicting Views** - Areas of disagreement or debate
|
|
36
|
+
4. **Knowledge Gaps** - What couldn't be determined
|
|
37
|
+
5. **Recommendations** - Suggested next steps or areas for deeper research
|
|
38
|
+
|
|
39
|
+
Remember: Your goal is to provide actionable intelligence, not just information aggregation.`;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Architect tool
|
|
4
|
+
* - Calls an AI model (xAI Grok or OpenAI GPT-5) to generate comprehensive architectural reviews
|
|
5
|
+
* - Input: 'task' (description of the task), 'code' (one or more code files concatenated)
|
|
6
|
+
* - Provides detailed analysis with executive summary, architectural overview, and prioritized action plans
|
|
7
|
+
*/
|
|
8
|
+
export declare const architectToolName = "architect";
|
|
9
|
+
export declare const architectToolDescription = "Conducts comprehensive architectural reviews and generates detailed improvement plans for codebases.";
|
|
10
|
+
export declare const ArchitectToolSchema: z.ZodObject<{
|
|
11
|
+
task: z.ZodString;
|
|
12
|
+
code: z.ZodString;
|
|
13
|
+
reasoning_effort: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
|
|
14
|
+
persona: z.ZodOptional<z.ZodString>;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
code: string;
|
|
17
|
+
task: string;
|
|
18
|
+
reasoning_effort?: "low" | "medium" | "high" | undefined;
|
|
19
|
+
persona?: string | undefined;
|
|
20
|
+
}, {
|
|
21
|
+
code: string;
|
|
22
|
+
task: string;
|
|
23
|
+
reasoning_effort?: "low" | "medium" | "high" | undefined;
|
|
24
|
+
persona?: string | undefined;
|
|
25
|
+
}>;
|
|
26
|
+
export declare function runArchitectTool(args: z.infer<typeof ArchitectToolSchema>): Promise<{
|
|
27
|
+
content: {
|
|
28
|
+
type: string;
|
|
29
|
+
text: string;
|
|
30
|
+
}[];
|
|
31
|
+
}>;
|
|
32
|
+
//# sourceMappingURL=architect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"architect.d.ts","sourceRoot":"","sources":["../../src/tools/architect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB;;;;;GAKG;AAEH,eAAO,MAAM,iBAAiB,cAAc,CAAC;AAC7C,eAAO,MAAM,wBAAwB,yGACmE,CAAC;AAEzG,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;EAiB9B,CAAC;AAEH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC;;;;;GAiD1C"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { callAIProvider } from "../common/apiClient.js";
|
|
3
|
+
import { callAIWithPersona } from "../common/personaClient.js";
|
|
4
|
+
import { chooseProvider, } from "../common/providerConfig.js";
|
|
5
|
+
import { ARCHITECT_SYSTEM_PROMPT } from "../prompts/architectPrompts.js";
|
|
6
|
+
/**
|
|
7
|
+
* Architect tool
|
|
8
|
+
* - Calls an AI model (xAI Grok or OpenAI GPT-5) to generate comprehensive architectural reviews
|
|
9
|
+
* - Input: 'task' (description of the task), 'code' (one or more code files concatenated)
|
|
10
|
+
* - Provides detailed analysis with executive summary, architectural overview, and prioritized action plans
|
|
11
|
+
*/
|
|
12
|
+
export const architectToolName = "architect";
|
|
13
|
+
export const architectToolDescription = "Conducts comprehensive architectural reviews and generates detailed improvement plans for codebases.";
|
|
14
|
+
export const ArchitectToolSchema = z.object({
|
|
15
|
+
task: z.string().min(1, "Task description is required."),
|
|
16
|
+
code: z
|
|
17
|
+
.string()
|
|
18
|
+
.min(1, "Code string is required (one or more files concatenated)."),
|
|
19
|
+
reasoning_effort: z
|
|
20
|
+
.enum(["low", "medium", "high"])
|
|
21
|
+
.optional()
|
|
22
|
+
.describe("How hard the model should think (low/medium/high). High uses more reasoning tokens but provides better analysis."),
|
|
23
|
+
persona: z
|
|
24
|
+
.string()
|
|
25
|
+
.optional()
|
|
26
|
+
.describe("Persona to apply (e.g., 'charles' for British architect). Leave empty for standard analysis."),
|
|
27
|
+
});
|
|
28
|
+
export async function runArchitectTool(args) {
|
|
29
|
+
const { task, code, reasoning_effort = "high", persona } = args;
|
|
30
|
+
try {
|
|
31
|
+
// Use persona-aware client if persona is specified
|
|
32
|
+
const result = persona
|
|
33
|
+
? await callAIWithPersona({
|
|
34
|
+
systemPrompt: ARCHITECT_SYSTEM_PROMPT,
|
|
35
|
+
task,
|
|
36
|
+
code,
|
|
37
|
+
analysisType: "comprehensive",
|
|
38
|
+
reasoningEffort: reasoning_effort,
|
|
39
|
+
personaId: persona,
|
|
40
|
+
})
|
|
41
|
+
: await (async () => {
|
|
42
|
+
const selectedProvider = chooseProvider({
|
|
43
|
+
analysisType: "comprehensive",
|
|
44
|
+
reasoningEffort: reasoning_effort,
|
|
45
|
+
textHint: task,
|
|
46
|
+
});
|
|
47
|
+
return callAIProvider({
|
|
48
|
+
systemPrompt: ARCHITECT_SYSTEM_PROMPT,
|
|
49
|
+
task,
|
|
50
|
+
code,
|
|
51
|
+
analysisType: "comprehensive",
|
|
52
|
+
reasoningEffort: reasoning_effort,
|
|
53
|
+
provider: selectedProvider,
|
|
54
|
+
});
|
|
55
|
+
})();
|
|
56
|
+
return {
|
|
57
|
+
content: [
|
|
58
|
+
{
|
|
59
|
+
type: "text",
|
|
60
|
+
text: result,
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
return {
|
|
67
|
+
content: [
|
|
68
|
+
{
|
|
69
|
+
type: "text",
|
|
70
|
+
text: `Architect Error: ${error.message || error}`,
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Ask tool - Smart routing to the best persona based on query analysis
|
|
4
|
+
* Primary UX for natural language interaction with personas
|
|
5
|
+
*/
|
|
6
|
+
export declare const askToolName = "ask";
|
|
7
|
+
export declare const askToolDescription = "Ask a question naturally and get routed to the best expert persona automatically. You can also address a persona directly, e.g., 'ask xavier: <your question>' or 'charles: <your question>' to force that persona.";
|
|
8
|
+
export declare const AskToolSchema: z.ZodObject<{
|
|
9
|
+
persona_id: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"auto">, z.ZodString]>>>;
|
|
10
|
+
query: z.ZodString;
|
|
11
|
+
context: z.ZodOptional<z.ZodString>;
|
|
12
|
+
hint: z.ZodOptional<z.ZodString>;
|
|
13
|
+
explain_routing: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
14
|
+
reasoning_effort: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"low">, z.ZodLiteral<"medium">, z.ZodLiteral<"high">]>>;
|
|
15
|
+
provider: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"xai">, z.ZodLiteral<"openai">]>>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
query: string;
|
|
18
|
+
persona_id: string;
|
|
19
|
+
explain_routing: boolean;
|
|
20
|
+
context?: string | undefined;
|
|
21
|
+
reasoning_effort?: "low" | "medium" | "high" | undefined;
|
|
22
|
+
hint?: string | undefined;
|
|
23
|
+
provider?: "xai" | "openai" | undefined;
|
|
24
|
+
}, {
|
|
25
|
+
query: string;
|
|
26
|
+
context?: string | undefined;
|
|
27
|
+
reasoning_effort?: "low" | "medium" | "high" | undefined;
|
|
28
|
+
persona_id?: string | undefined;
|
|
29
|
+
hint?: string | undefined;
|
|
30
|
+
explain_routing?: boolean | undefined;
|
|
31
|
+
provider?: "xai" | "openai" | undefined;
|
|
32
|
+
}>;
|
|
33
|
+
export declare function runAskTool(args: z.infer<typeof AskToolSchema>): Promise<{
|
|
34
|
+
content: {
|
|
35
|
+
type: string;
|
|
36
|
+
text: string;
|
|
37
|
+
}[];
|
|
38
|
+
}>;
|
|
39
|
+
//# sourceMappingURL=ask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ask.d.ts","sourceRoot":"","sources":["../../src/tools/ask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;;GAGG;AAEH,eAAO,MAAM,WAAW,QAAQ,CAAC;AACjC,eAAO,MAAM,kBAAkB,wNACwL,CAAC;AAExN,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;EAsCxB,CAAC;AAEH,wBAAsB,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC;;;;;GAiHnE"}
|