@defai.digital/ax-cli 0.0.34 → 0.2.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/README.md +749 -272
- package/dist/agent/grok-agent.d.ts +7 -1
- package/dist/agent/grok-agent.js +22 -9
- package/dist/agent/grok-agent.js.map +1 -1
- package/dist/commands/mcp.js +1 -1
- package/dist/commands/mcp.js.map +1 -1
- package/dist/constants.d.ts +116 -0
- package/dist/constants.js +115 -0
- package/dist/constants.js.map +1 -0
- package/dist/grok/client.d.ts +133 -2
- package/dist/grok/client.js +173 -16
- package/dist/grok/client.js.map +1 -1
- package/dist/grok/types.d.ts +291 -0
- package/dist/grok/types.js +127 -0
- package/dist/grok/types.js.map +1 -0
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/mcp/client.d.ts +3 -8
- package/dist/mcp/client.js +17 -9
- package/dist/mcp/client.js.map +1 -1
- package/dist/mcp/config.d.ts +1 -1
- package/dist/mcp/config.js +24 -4
- package/dist/mcp/config.js.map +1 -1
- package/dist/mcp/transports.js +1 -1
- package/dist/mcp/transports.js.map +1 -1
- package/dist/schemas/api-schemas.d.ts +569 -0
- package/dist/schemas/api-schemas.js +116 -0
- package/dist/schemas/api-schemas.js.map +1 -0
- package/dist/schemas/confirmation-schemas.d.ts +60 -0
- package/dist/schemas/confirmation-schemas.js +41 -0
- package/dist/schemas/confirmation-schemas.js.map +1 -0
- package/dist/schemas/index-unified.d.ts +12 -0
- package/dist/schemas/index-unified.js +17 -0
- package/dist/schemas/index-unified.js.map +1 -0
- package/dist/schemas/index.d.ts +229 -37
- package/dist/schemas/settings-schemas.d.ts +179 -0
- package/dist/schemas/settings-schemas.js +52 -0
- package/dist/schemas/settings-schemas.js.map +1 -0
- package/dist/schemas/tool-schemas.d.ts +241 -0
- package/dist/schemas/tool-schemas.js +79 -0
- package/dist/schemas/tool-schemas.js.map +1 -0
- package/dist/tools/search.js +2 -2
- package/dist/tools/search.js.map +1 -1
- package/dist/ui/components/api-key-input.js +2 -2
- package/dist/ui/components/api-key-input.js.map +1 -1
- package/dist/ui/components/chat-history.js +2 -0
- package/dist/ui/components/chat-history.js.map +1 -1
- package/dist/ui/components/chat-interface.js +31 -1
- package/dist/ui/components/chat-interface.js.map +1 -1
- package/dist/ui/components/mcp-status.js +1 -1
- package/dist/ui/components/mcp-status.js.map +1 -1
- package/dist/ui/components/reasoning-display.d.ts +109 -0
- package/dist/ui/components/reasoning-display.js +110 -0
- package/dist/ui/components/reasoning-display.js.map +1 -0
- package/dist/ui/shared/max-sized-box.js +1 -1
- package/dist/ui/shared/max-sized-box.js.map +1 -1
- package/dist/utils/cache.d.ts +75 -0
- package/dist/utils/cache.js +137 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/confirmation-service.js +2 -2
- package/dist/utils/confirmation-service.js.map +1 -1
- package/dist/utils/error-handler.d.ts +43 -0
- package/dist/utils/error-handler.js +70 -0
- package/dist/utils/error-handler.js.map +1 -0
- package/dist/utils/index.d.ts +13 -0
- package/dist/utils/index.js +23 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/path-validator.d.ts +30 -0
- package/dist/utils/path-validator.js +67 -0
- package/dist/utils/path-validator.js.map +1 -0
- package/dist/utils/performance.d.ts +72 -0
- package/dist/utils/performance.js +114 -0
- package/dist/utils/performance.js.map +1 -0
- package/dist/utils/settings-manager.d.ts +2 -18
- package/dist/utils/settings-manager.js +19 -6
- package/dist/utils/settings-manager.js.map +1 -1
- package/dist/utils/token-counter.d.ts +10 -1
- package/dist/utils/token-counter.js +27 -6
- package/dist/utils/token-counter.js.map +1 -1
- package/eslint.config.js +60 -0
- package/package.json +24 -6
- package/vitest.config.ts +20 -0
- package/.automatosx/agents/aerospace-scientist.yaml +0 -159
- package/.automatosx/agents/architecture.yaml +0 -244
- package/.automatosx/agents/backend.yaml +0 -172
- package/.automatosx/agents/ceo.yaml +0 -105
- package/.automatosx/agents/creative-marketer.yaml +0 -173
- package/.automatosx/agents/cto.yaml +0 -118
- package/.automatosx/agents/data-scientist.yaml +0 -200
- package/.automatosx/agents/data.yaml +0 -106
- package/.automatosx/agents/design.yaml +0 -115
- package/.automatosx/agents/devops.yaml +0 -124
- package/.automatosx/agents/frontend.yaml +0 -171
- package/.automatosx/agents/fullstack.yaml +0 -172
- package/.automatosx/agents/mobile.yaml +0 -185
- package/.automatosx/agents/product.yaml +0 -103
- package/.automatosx/agents/quality.yaml +0 -93
- package/.automatosx/agents/quantum-engineer.yaml +0 -167
- package/.automatosx/agents/researcher.yaml +0 -122
- package/.automatosx/agents/security.yaml +0 -115
- package/.automatosx/agents/standard.yaml +0 -214
- package/.automatosx/agents/writer.yaml +0 -122
- package/.automatosx/feature-flags.json +0 -13
- package/.automatosx/memory/memory.db +0 -0
- package/.automatosx/providers/README.md +0 -117
- package/.automatosx/providers/grok-zai.yaml.template +0 -61
- package/.automatosx/providers/grok.yaml.template +0 -71
- package/.automatosx/status/backend-1763517593334-85037.json +0 -9
- package/.automatosx/status/quality-1763516867087-82043.json +0 -9
- package/.automatosx/status/quality-1763516976722-84817.json +0 -9
- package/.automatosx/status/security-1763517871950-87357.json +0 -9
- package/.automatosx/teams/business.yaml +0 -56
- package/.automatosx/teams/core.yaml +0 -60
- package/.automatosx/teams/design.yaml +0 -58
- package/.automatosx/teams/engineering.yaml +0 -69
- package/.automatosx/teams/research.yaml +0 -56
- package/.automatosx/templates/analyst.yaml +0 -60
- package/.automatosx/templates/assistant.yaml +0 -48
- package/.automatosx/templates/basic-agent.yaml +0 -28
- package/.automatosx/templates/code-reviewer.yaml +0 -52
- package/.automatosx/templates/debugger.yaml +0 -63
- package/.automatosx/templates/designer.yaml +0 -69
- package/.automatosx/templates/developer.yaml +0 -60
- package/.automatosx/templates/fullstack-developer.yaml +0 -395
- package/.automatosx/templates/qa-specialist.yaml +0 -71
- package/.claude/mcp/automatosx.json +0 -244
- package/.claude/settings.local.json +0 -34
- package/.grok/settings.json +0 -37
- package/automatosx/PRD/README.md +0 -9
- package/automatosx/tmp/README.md +0 -10
- package/automatosx.config.json +0 -333
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface ReasoningDisplayProps {
|
|
3
|
+
/**
|
|
4
|
+
* Reasoning content from GLM-4.6 thinking mode
|
|
5
|
+
*/
|
|
6
|
+
content: string;
|
|
7
|
+
/**
|
|
8
|
+
* Whether to show the reasoning content
|
|
9
|
+
* @default true
|
|
10
|
+
*/
|
|
11
|
+
visible?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Whether this is a streaming update
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
isStreaming?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* ReasoningDisplay Component
|
|
20
|
+
*
|
|
21
|
+
* Displays GLM-4.6 reasoning content (thinking mode) with visual
|
|
22
|
+
* separation from the final answer.
|
|
23
|
+
*
|
|
24
|
+
* Features:
|
|
25
|
+
* - Collapsible/expandable reasoning section
|
|
26
|
+
* - Visual distinction with dimmed styling
|
|
27
|
+
* - Streaming support with indicator
|
|
28
|
+
* - Clear separation from final answer
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* <ReasoningDisplay
|
|
33
|
+
* content="Let me break down this problem step by step..."
|
|
34
|
+
* visible={showReasoning}
|
|
35
|
+
* isStreaming={true}
|
|
36
|
+
* />
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function ReasoningDisplay({ content, visible, isStreaming, }: ReasoningDisplayProps): React.JSX.Element | null;
|
|
40
|
+
/**
|
|
41
|
+
* CollapsibleReasoningDisplay Component
|
|
42
|
+
*
|
|
43
|
+
* Advanced version with collapse/expand functionality.
|
|
44
|
+
* Allows users to toggle visibility of reasoning content.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```tsx
|
|
48
|
+
* <CollapsibleReasoningDisplay
|
|
49
|
+
* content="Step 1: Analyze the input..."
|
|
50
|
+
* defaultCollapsed={false}
|
|
51
|
+
* />
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export interface CollapsibleReasoningDisplayProps {
|
|
55
|
+
content: string;
|
|
56
|
+
/**
|
|
57
|
+
* Whether the reasoning is collapsed by default
|
|
58
|
+
* @default false
|
|
59
|
+
*/
|
|
60
|
+
defaultCollapsed?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Whether this is a streaming update
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
65
|
+
isStreaming?: boolean;
|
|
66
|
+
}
|
|
67
|
+
export declare function CollapsibleReasoningDisplay({ content, defaultCollapsed, isStreaming, }: CollapsibleReasoningDisplayProps): React.JSX.Element | null;
|
|
68
|
+
/**
|
|
69
|
+
* ReasoningSection Component
|
|
70
|
+
*
|
|
71
|
+
* Wrapper for multiple reasoning steps or sections.
|
|
72
|
+
* Useful for displaying step-by-step thought processes.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```tsx
|
|
76
|
+
* <ReasoningSection
|
|
77
|
+
* steps={[
|
|
78
|
+
* "Step 1: Understanding the problem...",
|
|
79
|
+
* "Step 2: Analyzing the code...",
|
|
80
|
+
* "Step 3: Proposing a solution..."
|
|
81
|
+
* ]}
|
|
82
|
+
* />
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export interface ReasoningSectionProps {
|
|
86
|
+
/**
|
|
87
|
+
* Array of reasoning steps
|
|
88
|
+
*/
|
|
89
|
+
steps: string[];
|
|
90
|
+
/**
|
|
91
|
+
* Whether to show step numbers
|
|
92
|
+
* @default true
|
|
93
|
+
*/
|
|
94
|
+
showStepNumbers?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Whether this is actively streaming
|
|
97
|
+
* @default false
|
|
98
|
+
*/
|
|
99
|
+
isStreaming?: boolean;
|
|
100
|
+
}
|
|
101
|
+
export declare function ReasoningSection({ steps, showStepNumbers, isStreaming, }: ReasoningSectionProps): React.JSX.Element | null;
|
|
102
|
+
/**
|
|
103
|
+
* Utility function to parse reasoning content into steps
|
|
104
|
+
* Detects common step patterns like "Step 1:", "1.", etc.
|
|
105
|
+
*
|
|
106
|
+
* @param content - Raw reasoning content
|
|
107
|
+
* @returns Array of reasoning steps
|
|
108
|
+
*/
|
|
109
|
+
export declare function parseReasoningSteps(content: string): string[];
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Box, Text } from "ink";
|
|
3
|
+
/**
|
|
4
|
+
* ReasoningDisplay Component
|
|
5
|
+
*
|
|
6
|
+
* Displays GLM-4.6 reasoning content (thinking mode) with visual
|
|
7
|
+
* separation from the final answer.
|
|
8
|
+
*
|
|
9
|
+
* Features:
|
|
10
|
+
* - Collapsible/expandable reasoning section
|
|
11
|
+
* - Visual distinction with dimmed styling
|
|
12
|
+
* - Streaming support with indicator
|
|
13
|
+
* - Clear separation from final answer
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <ReasoningDisplay
|
|
18
|
+
* content="Let me break down this problem step by step..."
|
|
19
|
+
* visible={showReasoning}
|
|
20
|
+
* isStreaming={true}
|
|
21
|
+
* />
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export function ReasoningDisplay({ content, visible = true, isStreaming = false, }) {
|
|
25
|
+
// Don't render if not visible or no content
|
|
26
|
+
if (!visible || !content || content.trim().length === 0) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
return (React.createElement(Box, { flexDirection: "column", marginBottom: 1, paddingLeft: 2, borderStyle: "single", borderColor: "gray" },
|
|
30
|
+
React.createElement(Box, { flexDirection: "row", marginBottom: 0 },
|
|
31
|
+
React.createElement(Text, { color: "cyan", dimColor: true },
|
|
32
|
+
"\uD83D\uDCAD Thinking",
|
|
33
|
+
isStreaming ? "..." : "")),
|
|
34
|
+
React.createElement(Box, { flexDirection: "column", paddingLeft: 1 },
|
|
35
|
+
React.createElement(Text, { color: "white", dimColor: true, italic: true }, content))));
|
|
36
|
+
}
|
|
37
|
+
export function CollapsibleReasoningDisplay({ content, defaultCollapsed = false, isStreaming = false, }) {
|
|
38
|
+
const [isCollapsed] = React.useState(defaultCollapsed);
|
|
39
|
+
// const setIsCollapsed = ...; // TODO: Implement toggle functionality with user input
|
|
40
|
+
if (!content || content.trim().length === 0) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
// Extract first line as preview
|
|
44
|
+
const lines = content.split("\n");
|
|
45
|
+
const preview = lines[0]?.slice(0, 80) || "";
|
|
46
|
+
const hasMore = content.length > 80 || lines.length > 1;
|
|
47
|
+
return (React.createElement(Box, { flexDirection: "column", marginBottom: 1, paddingLeft: 2, borderStyle: "single", borderColor: "gray" },
|
|
48
|
+
React.createElement(Box, { flexDirection: "row", marginBottom: 0 },
|
|
49
|
+
React.createElement(Text, { color: "cyan", dimColor: true },
|
|
50
|
+
isCollapsed ? "▸" : "▾",
|
|
51
|
+
" \uD83D\uDCAD Thinking",
|
|
52
|
+
isStreaming ? "..." : "",
|
|
53
|
+
hasMore && isCollapsed && (React.createElement(Text, { dimColor: true }, " (click to expand)")))),
|
|
54
|
+
React.createElement(Box, { flexDirection: "column", paddingLeft: 1 }, isCollapsed ? (React.createElement(Text, { color: "white", dimColor: true, italic: true },
|
|
55
|
+
preview,
|
|
56
|
+
hasMore && "...")) : (React.createElement(Text, { color: "white", dimColor: true, italic: true }, content)))));
|
|
57
|
+
}
|
|
58
|
+
export function ReasoningSection({ steps, showStepNumbers = true, isStreaming = false, }) {
|
|
59
|
+
if (!steps || steps.length === 0) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
return (React.createElement(Box, { flexDirection: "column", marginBottom: 1, paddingLeft: 2, borderStyle: "single", borderColor: "gray" },
|
|
63
|
+
React.createElement(Box, { flexDirection: "row", marginBottom: 0 },
|
|
64
|
+
React.createElement(Text, { color: "cyan", dimColor: true },
|
|
65
|
+
"\uD83D\uDCAD Thinking Process",
|
|
66
|
+
isStreaming ? "..." : "")),
|
|
67
|
+
React.createElement(Box, { flexDirection: "column", paddingLeft: 1 }, steps.map((step, index) => (React.createElement(Box, { key: index, flexDirection: "row", marginY: 0 },
|
|
68
|
+
showStepNumbers && (React.createElement(Text, { color: "cyan", dimColor: true },
|
|
69
|
+
index + 1,
|
|
70
|
+
".",
|
|
71
|
+
" ")),
|
|
72
|
+
React.createElement(Text, { color: "white", dimColor: true, italic: true }, step)))))));
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Utility function to parse reasoning content into steps
|
|
76
|
+
* Detects common step patterns like "Step 1:", "1.", etc.
|
|
77
|
+
*
|
|
78
|
+
* @param content - Raw reasoning content
|
|
79
|
+
* @returns Array of reasoning steps
|
|
80
|
+
*/
|
|
81
|
+
export function parseReasoningSteps(content) {
|
|
82
|
+
if (!content || content.trim().length === 0)
|
|
83
|
+
return [];
|
|
84
|
+
// Try to detect step patterns
|
|
85
|
+
const stepPatterns = [
|
|
86
|
+
/^Step \d+:/im,
|
|
87
|
+
/^\d+\./m,
|
|
88
|
+
/^-\s/m,
|
|
89
|
+
/^\*\s/m,
|
|
90
|
+
];
|
|
91
|
+
for (const pattern of stepPatterns) {
|
|
92
|
+
if (pattern.test(content)) {
|
|
93
|
+
// Split by the pattern
|
|
94
|
+
const steps = content
|
|
95
|
+
.split(/(?=^Step \d+:|^\d+\.|^-\s|^\*\s)/m)
|
|
96
|
+
.filter(s => s.trim().length > 0)
|
|
97
|
+
.map(s => s.trim());
|
|
98
|
+
if (steps.length > 1) {
|
|
99
|
+
return steps;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
// If no patterns found, split by paragraphs
|
|
104
|
+
const paragraphs = content
|
|
105
|
+
.split("\n\n")
|
|
106
|
+
.filter(p => p.trim().length > 0)
|
|
107
|
+
.map(p => p.trim());
|
|
108
|
+
return paragraphs.length > 1 ? paragraphs : [content];
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=reasoning-display.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reasoning-display.js","sourceRoot":"","sources":["../../../src/ui/components/reasoning-display.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAmBhC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAC/B,OAAO,EACP,OAAO,GAAG,IAAI,EACd,WAAW,GAAG,KAAK,GACG;IACtB,4CAA4C;IAC5C,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,YAAY,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,WAAW,EAAC,QAAQ,EAAC,WAAW,EAAC,MAAM;QAClG,oBAAC,GAAG,IAAC,aAAa,EAAC,KAAK,EAAC,YAAY,EAAE,CAAC;YACtC,oBAAC,IAAI,IAAC,KAAK,EAAC,MAAM,EAAC,QAAQ;;gBACb,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAC/B,CACH;QACN,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,WAAW,EAAE,CAAC;YACxC,oBAAC,IAAI,IAAC,KAAK,EAAC,OAAO,EAAC,QAAQ,QAAC,MAAM,UAChC,OAAO,CACH,CACH,CACF,CACP,CAAC;AACJ,CAAC;AA8BD,MAAM,UAAU,2BAA2B,CAAC,EAC1C,OAAO,EACP,gBAAgB,GAAG,KAAK,EACxB,WAAW,GAAG,KAAK,GACc;IACjC,MAAM,CAAC,WA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AAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEvD,8BAA8B;IAC9B,MAAM,YAAY,GAAG;QACnB,cAAc;QACd,SAAS;QACT,OAAO;QACP,QAAQ;KACT,CAAC;IAEF,KAAK,MAAM,OAAO,IAAI,YAAY,EAAE,CAAC;QACnC,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YAC1B,uBAAuB;YACvB,MAAM,KAAK,GAAG,OAAO;iBAClB,KAAK,CAAC,mCAAmC,CAAC;iBAC1C,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;iBAChC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;YAEtB,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACrB,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;IACH,CAAC;IAED,4CAA4C;IAC5C,MAAM,UAAU,GAAG,OAAO;SACvB,KAAK,CAAC,MAAM,CAAC;SACb,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;SAChC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAEtB,OAAO,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Box } from 'ink';
|
|
3
|
-
export const MaxSizedBox = ({ maxHeight, maxWidth, children, ...props }) => {
|
|
3
|
+
export const MaxSizedBox = ({ maxHeight: _maxHeight, maxWidth: _maxWidth, children, ...props }) => {
|
|
4
4
|
return (React.createElement(Box, { flexDirection: "column", ...props }, children));
|
|
5
5
|
};
|
|
6
6
|
//# sourceMappingURL=max-sized-box.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"max-sized-box.js","sourceRoot":"","sources":["../../../src/ui/shared/max-sized-box.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAQ1B,MAAM,CAAC,MAAM,WAAW,GAA+B,CAAC,EACtD,SAAS,
|
|
1
|
+
{"version":3,"file":"max-sized-box.js","sourceRoot":"","sources":["../../../src/ui/shared/max-sized-box.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAQ1B,MAAM,CAAC,MAAM,WAAW,GAA+B,CAAC,EACtD,SAAS,EAAE,UAAU,EACrB,QAAQ,EAAE,SAAS,EACnB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,EAAE;IACH,OAAO,CACL,oBAAC,GAAG,IACF,aAAa,EAAC,QAAQ,KAClB,KAAK,IAER,QAAQ,CACL,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic LRU Cache implementation for performance optimization
|
|
3
|
+
* Provides consistent caching across the application
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* const cache = new LRUCache<string, number>({ maxSize: 100 });
|
|
8
|
+
* cache.set('key', 42);
|
|
9
|
+
* const value = cache.get('key'); // 42
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export interface CacheOptions {
|
|
13
|
+
/** Maximum number of entries in cache (default: 1000) */
|
|
14
|
+
maxSize?: number;
|
|
15
|
+
/** Time to live in milliseconds (optional) */
|
|
16
|
+
ttl?: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Least Recently Used (LRU) Cache with optional TTL
|
|
20
|
+
*/
|
|
21
|
+
export declare class LRUCache<K, V> {
|
|
22
|
+
private cache;
|
|
23
|
+
private readonly maxSize;
|
|
24
|
+
private readonly ttl?;
|
|
25
|
+
constructor(options?: CacheOptions);
|
|
26
|
+
/**
|
|
27
|
+
* Get value from cache
|
|
28
|
+
* Returns undefined if not found or expired
|
|
29
|
+
*/
|
|
30
|
+
get(key: K): V | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Set value in cache with LRU eviction
|
|
33
|
+
*/
|
|
34
|
+
set(key: K, value: V): void;
|
|
35
|
+
/**
|
|
36
|
+
* Check if key exists and is not expired
|
|
37
|
+
*/
|
|
38
|
+
has(key: K): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Delete entry from cache
|
|
41
|
+
*/
|
|
42
|
+
delete(key: K): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Clear all entries
|
|
45
|
+
*/
|
|
46
|
+
clear(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Get cache size
|
|
49
|
+
*/
|
|
50
|
+
size(): number;
|
|
51
|
+
/**
|
|
52
|
+
* Get all keys (in LRU order)
|
|
53
|
+
*/
|
|
54
|
+
keys(): K[];
|
|
55
|
+
/**
|
|
56
|
+
* Get cache statistics
|
|
57
|
+
*/
|
|
58
|
+
stats(): {
|
|
59
|
+
size: number;
|
|
60
|
+
maxSize: number;
|
|
61
|
+
ttl?: number;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Create a memoized version of an async function with caching
|
|
66
|
+
*/
|
|
67
|
+
export declare function memoizeAsync<TArgs extends any[], TReturn>(fn: (...args: TArgs) => Promise<TReturn>, options?: CacheOptions & {
|
|
68
|
+
keyFn?: (...args: TArgs) => string;
|
|
69
|
+
}): (...args: TArgs) => Promise<TReturn>;
|
|
70
|
+
/**
|
|
71
|
+
* Create a memoized version of a sync function with caching
|
|
72
|
+
*/
|
|
73
|
+
export declare function memoize<TArgs extends any[], TReturn>(fn: (...args: TArgs) => TReturn, options?: CacheOptions & {
|
|
74
|
+
keyFn?: (...args: TArgs) => string;
|
|
75
|
+
}): (...args: TArgs) => TReturn;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic LRU Cache implementation for performance optimization
|
|
3
|
+
* Provides consistent caching across the application
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* const cache = new LRUCache<string, number>({ maxSize: 100 });
|
|
8
|
+
* cache.set('key', 42);
|
|
9
|
+
* const value = cache.get('key'); // 42
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Least Recently Used (LRU) Cache with optional TTL
|
|
14
|
+
*/
|
|
15
|
+
export class LRUCache {
|
|
16
|
+
cache;
|
|
17
|
+
maxSize;
|
|
18
|
+
ttl;
|
|
19
|
+
constructor(options = {}) {
|
|
20
|
+
this.cache = new Map();
|
|
21
|
+
this.maxSize = options.maxSize || 1000;
|
|
22
|
+
this.ttl = options.ttl;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Get value from cache
|
|
26
|
+
* Returns undefined if not found or expired
|
|
27
|
+
*/
|
|
28
|
+
get(key) {
|
|
29
|
+
const entry = this.cache.get(key);
|
|
30
|
+
if (!entry) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
// Check if expired
|
|
34
|
+
if (this.ttl && Date.now() - entry.timestamp > this.ttl) {
|
|
35
|
+
this.cache.delete(key);
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
// Move to end (most recently used)
|
|
39
|
+
this.cache.delete(key);
|
|
40
|
+
this.cache.set(key, entry);
|
|
41
|
+
return entry.value;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Set value in cache with LRU eviction
|
|
45
|
+
*/
|
|
46
|
+
set(key, value) {
|
|
47
|
+
// Remove if already exists (to update position)
|
|
48
|
+
this.cache.delete(key);
|
|
49
|
+
// Evict oldest if at max size
|
|
50
|
+
if (this.cache.size >= this.maxSize) {
|
|
51
|
+
const firstKey = this.cache.keys().next().value;
|
|
52
|
+
if (firstKey !== undefined) {
|
|
53
|
+
this.cache.delete(firstKey);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// Add new entry
|
|
57
|
+
this.cache.set(key, {
|
|
58
|
+
value,
|
|
59
|
+
timestamp: Date.now(),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Check if key exists and is not expired
|
|
64
|
+
*/
|
|
65
|
+
has(key) {
|
|
66
|
+
return this.get(key) !== undefined;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Delete entry from cache
|
|
70
|
+
*/
|
|
71
|
+
delete(key) {
|
|
72
|
+
return this.cache.delete(key);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Clear all entries
|
|
76
|
+
*/
|
|
77
|
+
clear() {
|
|
78
|
+
this.cache.clear();
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Get cache size
|
|
82
|
+
*/
|
|
83
|
+
size() {
|
|
84
|
+
return this.cache.size;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Get all keys (in LRU order)
|
|
88
|
+
*/
|
|
89
|
+
keys() {
|
|
90
|
+
return Array.from(this.cache.keys());
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Get cache statistics
|
|
94
|
+
*/
|
|
95
|
+
stats() {
|
|
96
|
+
return {
|
|
97
|
+
size: this.cache.size,
|
|
98
|
+
maxSize: this.maxSize,
|
|
99
|
+
ttl: this.ttl,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Create a memoized version of an async function with caching
|
|
105
|
+
*/
|
|
106
|
+
export function memoizeAsync(fn, options = {}) {
|
|
107
|
+
const cache = new LRUCache(options);
|
|
108
|
+
const keyFn = options.keyFn || ((...args) => JSON.stringify(args));
|
|
109
|
+
return async (...args) => {
|
|
110
|
+
const key = keyFn(...args);
|
|
111
|
+
const cached = cache.get(key);
|
|
112
|
+
if (cached !== undefined) {
|
|
113
|
+
return cached;
|
|
114
|
+
}
|
|
115
|
+
const result = await fn(...args);
|
|
116
|
+
cache.set(key, result);
|
|
117
|
+
return result;
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Create a memoized version of a sync function with caching
|
|
122
|
+
*/
|
|
123
|
+
export function memoize(fn, options = {}) {
|
|
124
|
+
const cache = new LRUCache(options);
|
|
125
|
+
const keyFn = options.keyFn || ((...args) => JSON.stringify(args));
|
|
126
|
+
return (...args) => {
|
|
127
|
+
const key = keyFn(...args);
|
|
128
|
+
const cached = cache.get(key);
|
|
129
|
+
if (cached !== undefined) {
|
|
130
|
+
return cached;
|
|
131
|
+
}
|
|
132
|
+
const result = fn(...args);
|
|
133
|
+
cache.set(key, result);
|
|
134
|
+
return result;
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/utils/cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAcH;;GAEG;AACH,MAAM,OAAO,QAAQ;IACX,KAAK,CAAwB;IACpB,OAAO,CAAS;IAChB,GAAG,CAAU;IAE9B,YAAY,UAAwB,EAAE;QACpC,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC;QACvC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IACzB,CAAC;IAED;;;OAGG;IACH,GAAG,CAAC,GAAM;QACR,MAAM,KAAK,GAAG,IAAI,CAAC,K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C,CAAC;QACvB,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,OAAO,CACrB,EAA+B,EAC/B,UAAiE,EAAE;IAEnE,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAkB,OAAO,CAAC,CAAC;IACrD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IAEnE,OAAO,CAAC,GAAG,IAAW,EAAW,EAAE;QACjC,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;QAC3B,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAE9B,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,MAAM,MAAM,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;QAC3B,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACvB,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -33,7 +33,7 @@ export class ConfirmationService extends EventEmitter {
|
|
|
33
33
|
try {
|
|
34
34
|
await this.openInVSCode(options.filename);
|
|
35
35
|
}
|
|
36
|
-
catch
|
|
36
|
+
catch {
|
|
37
37
|
// If VS Code opening fails, continue without it
|
|
38
38
|
options.showVSCodeOpen = false;
|
|
39
39
|
}
|
|
@@ -82,7 +82,7 @@ export class ConfirmationService extends EventEmitter {
|
|
|
82
82
|
await execAsync(`${cmd} "${filename}"`);
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
|
-
catch
|
|
85
|
+
catch {
|
|
86
86
|
// Continue to next command
|
|
87
87
|
continue;
|
|
88
88
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirmation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AE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;YACzD,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;YAChC,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAClC,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,YAAY,CAAC,QAAgB;QACzC,iCAAiC;QACjC,MAAM,QAAQ,GAAG,CAAC,MAAM,EAAE,eAAe,EAAE,QAAQ,CAAC,CAAC;QAErD,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;YAC3B,IAAI,CAAC;gBACH,MAAM,SAAS,CAAC,SAAS,GAAG,EAAE,CAAC,CAAC;gBAChC,MAAM,SAAS,CAAC,GAAG,GAAG,KAAK,QAAQ,GAAG,CAAC,CAAC;gBACxC,OAAO;YACT,CAAC;YAAC,MAAM,CAAC;gBACP,2BAA2B;gBAC3B,SAAS;YACX,CAAC;QACH,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACvC,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,mBAAmB,KAAK,IAAI,CAAC;IAC3C,CAAC;IAED,YAAY;QACV,IAAI,CAAC,YAAY,GAAG;YAClB,cAAc,EAAE,KAAK;YACrB,YAAY,EAAE,KAAK;YACnB,aAAa,EAAE,KAAK;SACrB,CAAC;IACJ,CAAC;IAED,eAAe;QACb,OAAO,EAAE,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;IAClC,CAAC;IAED,cAAc,CACZ,QAA6D,EAC7D,KAAc;QAEd,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;IACtC,CAAC;CACF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized error handling utilities
|
|
3
|
+
* Provides consistent error messages and logging
|
|
4
|
+
*/
|
|
5
|
+
import { ToolResult } from '../types/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Standard error categories
|
|
8
|
+
*/
|
|
9
|
+
export declare enum ErrorCategory {
|
|
10
|
+
FILE_OPERATION = "File Operation",
|
|
11
|
+
BASH_COMMAND = "Bash Command",
|
|
12
|
+
MCP_CONNECTION = "MCP Connection",
|
|
13
|
+
TOOL_EXECUTION = "Tool Execution",
|
|
14
|
+
VALIDATION = "Validation",
|
|
15
|
+
NETWORK = "Network",
|
|
16
|
+
CONFIGURATION = "Configuration"
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Create a standardized error message
|
|
20
|
+
*/
|
|
21
|
+
export declare function createErrorMessage(category: ErrorCategory, operation: string, error: unknown): string;
|
|
22
|
+
/**
|
|
23
|
+
* Create a standardized ToolResult error
|
|
24
|
+
*/
|
|
25
|
+
export declare function createToolError(category: ErrorCategory, operation: string, error: unknown): ToolResult;
|
|
26
|
+
/**
|
|
27
|
+
* Create a standardized ToolResult success
|
|
28
|
+
*/
|
|
29
|
+
export declare function createToolSuccess(output: string): ToolResult;
|
|
30
|
+
/**
|
|
31
|
+
* Safely parse JSON with error handling
|
|
32
|
+
*/
|
|
33
|
+
export declare function safeJsonParse<T>(json: string): {
|
|
34
|
+
success: true;
|
|
35
|
+
data: T;
|
|
36
|
+
} | {
|
|
37
|
+
success: false;
|
|
38
|
+
error: string;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Wrap async operation with consistent error handling
|
|
42
|
+
*/
|
|
43
|
+
export declare function wrapToolOperation<T>(category: ErrorCategory, operation: string, fn: () => Promise<T>): Promise<ToolResult>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized error handling utilities
|
|
3
|
+
* Provides consistent error messages and logging
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Standard error categories
|
|
7
|
+
*/
|
|
8
|
+
export var ErrorCategory;
|
|
9
|
+
(function (ErrorCategory) {
|
|
10
|
+
ErrorCategory["FILE_OPERATION"] = "File Operation";
|
|
11
|
+
ErrorCategory["BASH_COMMAND"] = "Bash Command";
|
|
12
|
+
ErrorCategory["MCP_CONNECTION"] = "MCP Connection";
|
|
13
|
+
ErrorCategory["TOOL_EXECUTION"] = "Tool Execution";
|
|
14
|
+
ErrorCategory["VALIDATION"] = "Validation";
|
|
15
|
+
ErrorCategory["NETWORK"] = "Network";
|
|
16
|
+
ErrorCategory["CONFIGURATION"] = "Configuration";
|
|
17
|
+
})(ErrorCategory || (ErrorCategory = {}));
|
|
18
|
+
/**
|
|
19
|
+
* Create a standardized error message
|
|
20
|
+
*/
|
|
21
|
+
export function createErrorMessage(category, operation, error) {
|
|
22
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
23
|
+
return `[${category}] ${operation} failed: ${errorMessage}`;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Create a standardized ToolResult error
|
|
27
|
+
*/
|
|
28
|
+
export function createToolError(category, operation, error) {
|
|
29
|
+
return {
|
|
30
|
+
success: false,
|
|
31
|
+
error: createErrorMessage(category, operation, error),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Create a standardized ToolResult success
|
|
36
|
+
*/
|
|
37
|
+
export function createToolSuccess(output) {
|
|
38
|
+
return {
|
|
39
|
+
success: true,
|
|
40
|
+
output,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Safely parse JSON with error handling
|
|
45
|
+
*/
|
|
46
|
+
export function safeJsonParse(json) {
|
|
47
|
+
try {
|
|
48
|
+
const data = JSON.parse(json);
|
|
49
|
+
return { success: true, data };
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
return {
|
|
53
|
+
success: false,
|
|
54
|
+
error: error instanceof Error ? error.message : 'Invalid JSON',
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Wrap async operation with consistent error handling
|
|
60
|
+
*/
|
|
61
|
+
export async function wrapToolOperation(category, operation, fn) {
|
|
62
|
+
try {
|
|
63
|
+
const result = await fn();
|
|
64
|
+
return createToolSuccess(typeof result === 'string' ? result : JSON.stringify(result));
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
return createToolError(category, operation, error);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=error-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-handler.js","sourceRoot":"","sources":["../../src/utils/error-handler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,MAAM,CAAN,IAAY,aAQX;AARD,WAAY,aAAa;IACvB,kDAAiC,CAAA;IACjC,8CAA6B,CAAA;IAC7B,kDAAiC,CAAA;IACjC,kDAAiC,CAAA;IACjC,0CAAyB,CAAA;IACzB,oCAAmB,CAAA;IACnB,gDAA+B,CAAA;AACjC,CAAC,EARW,aAAa,KAAb,aAAa,QAQxB;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,QAAuB,EACvB,SAAiB,EACjB,KAAc;IAEd,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5E,OAAO,IAAI,QAAQ,KAAK,SAAS,YAAY,YAAY,EAAE,CAAC;AAC9D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAC7B,QAAuB,EACvB,SAAiB,EACjB,KAAc;IAEd,OAAO;QACL,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,kBAAkB,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC;KACtD,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC9C,OAAO;QACL,OAAO,EAAE,IAAI;QACb,MAAM;KACP,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAC3B,IAAY;IAEZ,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAM,CAAC;QACnC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACjC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc;SAC/D,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,QAAuB,EACvB,SAAiB,EACjB,EAAoB;IAEpB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC;QAC1B,OAAO,iBAAiB,CACtB,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAC7D,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,eAAe,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IACrD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified utility exports
|
|
3
|
+
* Central location for all utility functions and classes
|
|
4
|
+
*/
|
|
5
|
+
export * from './cache.js';
|
|
6
|
+
export * from './error-handler.js';
|
|
7
|
+
export * from './path-validator.js';
|
|
8
|
+
export * from './settings-manager.js';
|
|
9
|
+
export * from './token-counter.js';
|
|
10
|
+
export * from './text-utils.js';
|
|
11
|
+
export * from './confirmation-service.js';
|
|
12
|
+
export * from './custom-instructions.js';
|
|
13
|
+
export * from './performance.js';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified utility exports
|
|
3
|
+
* Central location for all utility functions and classes
|
|
4
|
+
*/
|
|
5
|
+
// Cache utilities
|
|
6
|
+
export * from './cache.js';
|
|
7
|
+
// Error handling
|
|
8
|
+
export * from './error-handler.js';
|
|
9
|
+
// Path validation
|
|
10
|
+
export * from './path-validator.js';
|
|
11
|
+
// Settings management
|
|
12
|
+
export * from './settings-manager.js';
|
|
13
|
+
// Token counting
|
|
14
|
+
export * from './token-counter.js';
|
|
15
|
+
// Text utilities
|
|
16
|
+
export * from './text-utils.js';
|
|
17
|
+
// Confirmation service
|
|
18
|
+
export * from './confirmation-service.js';
|
|
19
|
+
// Custom instructions
|
|
20
|
+
export * from './custom-instructions.js';
|
|
21
|
+
// Performance monitoring
|
|
22
|
+
export * from './performance.js';
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,kBAAkB;AAClB,cAAc,YAAY,CAAC;AAE3B,iBAAiB;AACjB,cAAc,oBAAoB,CAAC;AAEnC,kBAAkB;AAClB,cAAc,qBAAqB,CAAC;AAEpC,sBAAsB;AACtB,cAAc,uBAAuB,CAAC;AAEtC,iBAAiB;AACjB,cAAc,oBAAoB,CAAC;AAEnC,iBAAiB;AACjB,cAAc,iBAAiB,CAAC;AAEhC,uBAAuB;AACvB,cAAc,2BAA2B,CAAC;AAE1C,sBAAsB;AACtB,cAAc,0BAA0B,CAAC;AAEzC,yBAAyB;AACzB,cAAc,kBAAkB,CAAC"}
|