@gracefultools/astrid-sdk 0.3.2 → 0.3.3
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/dist/config/index.d.ts +108 -37
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +135 -40
- package/dist/config/index.js.map +1 -1
- package/dist/executors/openai.d.ts +3 -10
- package/dist/executors/openai.d.ts.map +1 -1
- package/dist/executors/openai.js +142 -86
- package/dist/executors/openai.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/config/index.d.ts
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Astrid Configuration Loader
|
|
2
|
+
* Astrid Configuration Loader (v2.0)
|
|
3
3
|
*
|
|
4
4
|
* Loads project-specific configuration from .astrid.config.json
|
|
5
|
-
*
|
|
6
|
-
* - Project structure
|
|
7
|
-
* - Platform detection patterns
|
|
8
|
-
* - AI agent preferences
|
|
9
|
-
* - Timeouts and limits
|
|
5
|
+
* Provides config-driven behavior for AI agents.
|
|
10
6
|
*/
|
|
11
7
|
export interface ProjectStructure {
|
|
12
|
-
/**
|
|
8
|
+
/** User-friendly name for this part of the project */
|
|
9
|
+
name?: string;
|
|
10
|
+
/** Description of the platform/framework */
|
|
13
11
|
description: string;
|
|
14
|
-
/** Root directory for this part of the project
|
|
15
|
-
|
|
16
|
-
/** File patterns to search
|
|
17
|
-
|
|
12
|
+
/** Root directory for this part of the project */
|
|
13
|
+
rootPath: string;
|
|
14
|
+
/** File patterns to search */
|
|
15
|
+
filePatterns: string[];
|
|
18
16
|
/** Key directories to mention */
|
|
19
|
-
|
|
17
|
+
keyDirectories?: string[];
|
|
20
18
|
}
|
|
21
19
|
export interface PlatformDetection {
|
|
22
20
|
/** Name of the platform (e.g., "ios", "android", "web") */
|
|
@@ -28,59 +26,132 @@ export interface PlatformDetection {
|
|
|
28
26
|
/** Hints to give the AI for this platform */
|
|
29
27
|
hints?: string[];
|
|
30
28
|
}
|
|
29
|
+
export interface AgentConfig {
|
|
30
|
+
/** Planning timeout in minutes */
|
|
31
|
+
planningTimeoutMinutes: number;
|
|
32
|
+
/** Execution timeout in minutes */
|
|
33
|
+
executionTimeoutMinutes: number;
|
|
34
|
+
/** Max iterations for planning */
|
|
35
|
+
maxPlanningIterations: number;
|
|
36
|
+
/** Max iterations for execution */
|
|
37
|
+
maxExecutionIterations: number;
|
|
38
|
+
/** Additional context to always include in prompts */
|
|
39
|
+
additionalContext?: string;
|
|
40
|
+
/** Model parameters per phase */
|
|
41
|
+
modelParameters: {
|
|
42
|
+
planning: {
|
|
43
|
+
temperature: number;
|
|
44
|
+
maxTokens: number;
|
|
45
|
+
topP?: number;
|
|
46
|
+
};
|
|
47
|
+
execution: {
|
|
48
|
+
temperature: number;
|
|
49
|
+
maxTokens: number;
|
|
50
|
+
topP?: number;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export interface ValidationConfig {
|
|
55
|
+
/** Maximum files per plan */
|
|
56
|
+
maxFilesPerPlan: number;
|
|
57
|
+
/** Minimum files per plan */
|
|
58
|
+
minFilesPerPlan: number;
|
|
59
|
+
/** Reject plans with no files */
|
|
60
|
+
rejectEmptyPlans: boolean;
|
|
61
|
+
/** Maximum file modification size in bytes */
|
|
62
|
+
maxModificationSize: number;
|
|
63
|
+
/** Maximum context truncation length */
|
|
64
|
+
contextTruncationLength: number;
|
|
65
|
+
/** Max glob results to return */
|
|
66
|
+
maxGlobResults: number;
|
|
67
|
+
}
|
|
68
|
+
export interface SafetyConfig {
|
|
69
|
+
/** Blocked bash command patterns */
|
|
70
|
+
blockedBashPatterns: string[];
|
|
71
|
+
/** Require plan approval before execution */
|
|
72
|
+
requirePlanApproval: boolean;
|
|
73
|
+
/** Enforce protected paths */
|
|
74
|
+
enforceProtectedPaths: boolean;
|
|
75
|
+
/** Maximum budget per task in USD */
|
|
76
|
+
maxBudgetPerTask: number;
|
|
77
|
+
/** Maximum cost per API call */
|
|
78
|
+
maxCostPerCall: number;
|
|
79
|
+
}
|
|
80
|
+
export interface RetryConfig {
|
|
81
|
+
/** Maximum retry attempts */
|
|
82
|
+
maxRetries: number;
|
|
83
|
+
/** Initial backoff in milliseconds */
|
|
84
|
+
initialBackoffMs: number;
|
|
85
|
+
/** Maximum backoff in milliseconds */
|
|
86
|
+
maxBackoffMs: number;
|
|
87
|
+
/** Backoff multiplier */
|
|
88
|
+
backoffMultiplier: number;
|
|
89
|
+
/** API timeout in milliseconds */
|
|
90
|
+
apiTimeoutMs: number;
|
|
91
|
+
}
|
|
31
92
|
export interface AstridConfig {
|
|
32
|
-
/** Schema version
|
|
93
|
+
/** Schema version */
|
|
33
94
|
version: string;
|
|
34
95
|
/** Project name */
|
|
35
96
|
projectName?: string;
|
|
36
97
|
/** Brief description of the project */
|
|
37
98
|
description?: string;
|
|
38
|
-
/** Project structure
|
|
99
|
+
/** Project structure */
|
|
39
100
|
structure?: Record<string, ProjectStructure>;
|
|
40
|
-
/** Platform detection rules
|
|
101
|
+
/** Platform detection rules */
|
|
41
102
|
platforms?: PlatformDetection[];
|
|
42
|
-
/** AI agent configuration */
|
|
43
|
-
agent?: {
|
|
44
|
-
/** Planning timeout in minutes (default: 10) */
|
|
45
|
-
planningTimeoutMinutes?: number;
|
|
46
|
-
/** Execution timeout in minutes (default: 15) */
|
|
47
|
-
executionTimeoutMinutes?: number;
|
|
48
|
-
/** Max iterations for planning (default: 30) */
|
|
49
|
-
maxPlanningIterations?: number;
|
|
50
|
-
/** Max iterations for execution (default: 50) */
|
|
51
|
-
maxExecutionIterations?: number;
|
|
52
|
-
/** Additional context to always include in prompts */
|
|
53
|
-
additionalContext?: string;
|
|
54
|
-
};
|
|
55
103
|
/** Files/patterns the agent should never modify */
|
|
56
104
|
protectedPaths?: string[];
|
|
57
105
|
/** Custom instructions for the AI agent */
|
|
58
106
|
customInstructions?: string;
|
|
107
|
+
/** Agent configuration */
|
|
108
|
+
agent?: Partial<AgentConfig>;
|
|
109
|
+
/** Validation rules */
|
|
110
|
+
validation?: Partial<ValidationConfig>;
|
|
111
|
+
/** Safety rules */
|
|
112
|
+
safety?: Partial<SafetyConfig>;
|
|
113
|
+
/** Retry configuration */
|
|
114
|
+
retry?: Partial<RetryConfig>;
|
|
115
|
+
}
|
|
116
|
+
export interface ResolvedAstridConfig extends Omit<AstridConfig, 'agent' | 'validation' | 'safety' | 'retry'> {
|
|
117
|
+
agent: AgentConfig;
|
|
118
|
+
validation: ValidationConfig;
|
|
119
|
+
safety: SafetyConfig;
|
|
120
|
+
retry: RetryConfig;
|
|
59
121
|
}
|
|
60
|
-
export declare const
|
|
122
|
+
export declare const DEFAULT_BLOCKED_BASH_PATTERNS: string[];
|
|
123
|
+
export declare const DEFAULT_PROTECTED_PATHS: string[];
|
|
124
|
+
export declare const CONFIG_DEFAULTS: ResolvedAstridConfig;
|
|
61
125
|
/**
|
|
62
126
|
* Load Astrid configuration from a repository
|
|
63
|
-
* Looks for .astrid.config.json in the repo root
|
|
64
127
|
*/
|
|
65
|
-
export declare function loadAstridConfig(repoPath: string): Promise<
|
|
128
|
+
export declare function loadAstridConfig(repoPath: string): Promise<ResolvedAstridConfig>;
|
|
66
129
|
/**
|
|
67
130
|
* Clear the cached configuration
|
|
68
131
|
*/
|
|
69
132
|
export declare function clearConfigCache(): void;
|
|
70
133
|
/**
|
|
71
|
-
* Detect which platform a task belongs to
|
|
134
|
+
* Detect which platform a task belongs to
|
|
72
135
|
*/
|
|
73
|
-
export declare function detectPlatform(config:
|
|
136
|
+
export declare function detectPlatform(config: ResolvedAstridConfig, taskTitle: string, taskDescription: string | null): PlatformDetection | null;
|
|
74
137
|
/**
|
|
75
138
|
* Generate project structure prompt from config
|
|
76
139
|
*/
|
|
77
|
-
export declare function generateStructurePrompt(config:
|
|
140
|
+
export declare function generateStructurePrompt(config: ResolvedAstridConfig): string;
|
|
78
141
|
/**
|
|
79
|
-
* Generate platform-specific hints
|
|
142
|
+
* Generate platform-specific hints
|
|
80
143
|
*/
|
|
81
144
|
export declare function generatePlatformHints(platform: PlatformDetection | null): string;
|
|
82
145
|
/**
|
|
83
|
-
* Get the initial glob pattern for a task
|
|
146
|
+
* Get the initial glob pattern for a task
|
|
147
|
+
*/
|
|
148
|
+
export declare function getInitialGlobPattern(config: ResolvedAstridConfig, platform: PlatformDetection | null): string;
|
|
149
|
+
/**
|
|
150
|
+
* Check if a command is blocked by safety rules
|
|
151
|
+
*/
|
|
152
|
+
export declare function isBlockedCommand(command: string, config: ResolvedAstridConfig): boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Check if a path is protected
|
|
84
155
|
*/
|
|
85
|
-
export declare function
|
|
156
|
+
export declare function isProtectedPath(filePath: string, config: ResolvedAstridConfig): boolean;
|
|
86
157
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,MAAM,WAAW,gBAAgB;IAC/B,sDAAsD;IACtD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,4CAA4C;IAC5C,WAAW,EAAE,MAAM,CAAA;IACnB,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAA;IAChB,8BAA8B;IAC9B,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,iCAAiC;IACjC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;CAC1B;AAED,MAAM,WAAW,iBAAiB;IAChC,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAA;IACZ,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,gDAAgD;IAChD,YAAY,EAAE,MAAM,EAAE,CA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UAYzC,CAAA;AAED,eAAO,MAAM,uBAAuB,UAUnC,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,oBA6C7B,CAAA;AAiCD;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAsBtF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC;AAMD;;GAEG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,oBAAoB,EAC5B,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,GAAG,IAAI,GAC7B,iBAAiB,GAAG,IAAI,CAiB1B;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAmB5E;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,GAAG,MAAM,CAgBhF;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,oBAAoB,EAC5B,QAAQ,EAAE,iBAAiB,GAAG,IAAI,GACjC,MAAM,CAKR;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAKvF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAiBvF"}
|
package/dist/config/index.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Astrid Configuration Loader
|
|
3
|
+
* Astrid Configuration Loader (v2.0)
|
|
4
4
|
*
|
|
5
5
|
* Loads project-specific configuration from .astrid.config.json
|
|
6
|
-
*
|
|
7
|
-
* - Project structure
|
|
8
|
-
* - Platform detection patterns
|
|
9
|
-
* - AI agent preferences
|
|
10
|
-
* - Timeouts and limits
|
|
6
|
+
* Provides config-driven behavior for AI agents.
|
|
11
7
|
*/
|
|
12
8
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
13
9
|
if (k2 === undefined) k2 = k;
|
|
@@ -43,60 +39,129 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
43
39
|
};
|
|
44
40
|
})();
|
|
45
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
-
exports.
|
|
42
|
+
exports.CONFIG_DEFAULTS = exports.DEFAULT_PROTECTED_PATHS = exports.DEFAULT_BLOCKED_BASH_PATTERNS = void 0;
|
|
47
43
|
exports.loadAstridConfig = loadAstridConfig;
|
|
48
44
|
exports.clearConfigCache = clearConfigCache;
|
|
49
45
|
exports.detectPlatform = detectPlatform;
|
|
50
46
|
exports.generateStructurePrompt = generateStructurePrompt;
|
|
51
47
|
exports.generatePlatformHints = generatePlatformHints;
|
|
52
48
|
exports.getInitialGlobPattern = getInitialGlobPattern;
|
|
49
|
+
exports.isBlockedCommand = isBlockedCommand;
|
|
50
|
+
exports.isProtectedPath = isProtectedPath;
|
|
53
51
|
const fs = __importStar(require("fs/promises"));
|
|
54
52
|
const path = __importStar(require("path"));
|
|
55
53
|
// ============================================================================
|
|
56
54
|
// DEFAULT CONFIGURATION
|
|
57
55
|
// ============================================================================
|
|
58
|
-
exports.
|
|
59
|
-
|
|
56
|
+
exports.DEFAULT_BLOCKED_BASH_PATTERNS = [
|
|
57
|
+
'rm -rf /',
|
|
58
|
+
'rm -rf ~',
|
|
59
|
+
'rm -rf *',
|
|
60
|
+
'sudo',
|
|
61
|
+
'> /dev/',
|
|
62
|
+
'mkfs',
|
|
63
|
+
'dd if=',
|
|
64
|
+
':(){:|:&};:',
|
|
65
|
+
'chmod -R 777 /',
|
|
66
|
+
'wget -O - | sh',
|
|
67
|
+
'curl | sh',
|
|
68
|
+
];
|
|
69
|
+
exports.DEFAULT_PROTECTED_PATHS = [
|
|
70
|
+
'.env',
|
|
71
|
+
'.env.local',
|
|
72
|
+
'.env.production',
|
|
73
|
+
'.env.*.local',
|
|
74
|
+
'*.pem',
|
|
75
|
+
'*.key',
|
|
76
|
+
'**/credentials.json',
|
|
77
|
+
'**/secrets.*',
|
|
78
|
+
'.git/**',
|
|
79
|
+
];
|
|
80
|
+
exports.CONFIG_DEFAULTS = {
|
|
81
|
+
version: '2.0',
|
|
82
|
+
projectName: undefined,
|
|
83
|
+
description: undefined,
|
|
84
|
+
structure: {},
|
|
85
|
+
platforms: [],
|
|
86
|
+
protectedPaths: exports.DEFAULT_PROTECTED_PATHS,
|
|
87
|
+
customInstructions: '',
|
|
60
88
|
agent: {
|
|
61
89
|
planningTimeoutMinutes: 10,
|
|
62
90
|
executionTimeoutMinutes: 15,
|
|
63
91
|
maxPlanningIterations: 30,
|
|
64
92
|
maxExecutionIterations: 50,
|
|
65
|
-
|
|
93
|
+
additionalContext: '',
|
|
94
|
+
modelParameters: {
|
|
95
|
+
planning: { temperature: 0.7, maxTokens: 8192, topP: 1.0 },
|
|
96
|
+
execution: { temperature: 0.2, maxTokens: 8192, topP: 1.0 },
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
validation: {
|
|
100
|
+
maxFilesPerPlan: 5,
|
|
101
|
+
minFilesPerPlan: 1,
|
|
102
|
+
rejectEmptyPlans: true,
|
|
103
|
+
maxModificationSize: 60000,
|
|
104
|
+
contextTruncationLength: 8000,
|
|
105
|
+
maxGlobResults: 100,
|
|
106
|
+
},
|
|
107
|
+
safety: {
|
|
108
|
+
blockedBashPatterns: exports.DEFAULT_BLOCKED_BASH_PATTERNS,
|
|
109
|
+
requirePlanApproval: false,
|
|
110
|
+
enforceProtectedPaths: true,
|
|
111
|
+
maxBudgetPerTask: 5.0,
|
|
112
|
+
maxCostPerCall: 1.0,
|
|
113
|
+
},
|
|
114
|
+
retry: {
|
|
115
|
+
maxRetries: 3,
|
|
116
|
+
initialBackoffMs: 2000,
|
|
117
|
+
maxBackoffMs: 30000,
|
|
118
|
+
backoffMultiplier: 2,
|
|
119
|
+
apiTimeoutMs: 120000,
|
|
120
|
+
},
|
|
66
121
|
};
|
|
67
122
|
// ============================================================================
|
|
68
123
|
// CONFIGURATION LOADER
|
|
69
124
|
// ============================================================================
|
|
125
|
+
function isObject(item) {
|
|
126
|
+
return item !== null && typeof item === 'object' && !Array.isArray(item);
|
|
127
|
+
}
|
|
128
|
+
function deepMerge(target, source) {
|
|
129
|
+
const result = { ...target };
|
|
130
|
+
for (const key of Object.keys(source)) {
|
|
131
|
+
const sourceValue = source[key];
|
|
132
|
+
const targetValue = target[key];
|
|
133
|
+
if (sourceValue === undefined) {
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
if (isObject(sourceValue) && isObject(targetValue)) {
|
|
137
|
+
result[key] = deepMerge(targetValue, sourceValue);
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
result[key] = sourceValue;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return result;
|
|
144
|
+
}
|
|
70
145
|
let cachedConfig = null;
|
|
71
146
|
/**
|
|
72
147
|
* Load Astrid configuration from a repository
|
|
73
|
-
* Looks for .astrid.config.json in the repo root
|
|
74
148
|
*/
|
|
75
149
|
async function loadAstridConfig(repoPath) {
|
|
76
|
-
// Return cached config if same repo
|
|
77
150
|
if (cachedConfig && cachedConfig.repoPath === repoPath) {
|
|
78
151
|
return cachedConfig.config;
|
|
79
152
|
}
|
|
80
153
|
const configPath = path.join(repoPath, '.astrid.config.json');
|
|
154
|
+
let userConfig = {};
|
|
81
155
|
try {
|
|
82
156
|
const content = await fs.readFile(configPath, 'utf-8');
|
|
83
|
-
|
|
84
|
-
// Merge with defaults
|
|
85
|
-
const config = {
|
|
86
|
-
...exports.DEFAULT_CONFIG,
|
|
87
|
-
...userConfig,
|
|
88
|
-
agent: {
|
|
89
|
-
...exports.DEFAULT_CONFIG.agent,
|
|
90
|
-
...userConfig.agent,
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
cachedConfig = { config, repoPath };
|
|
94
|
-
return config;
|
|
157
|
+
userConfig = JSON.parse(content);
|
|
95
158
|
}
|
|
96
159
|
catch {
|
|
97
160
|
// Config file doesn't exist or is invalid - use defaults
|
|
98
|
-
return exports.DEFAULT_CONFIG;
|
|
99
161
|
}
|
|
162
|
+
const resolved = deepMerge(exports.CONFIG_DEFAULTS, userConfig);
|
|
163
|
+
cachedConfig = { config: resolved, repoPath };
|
|
164
|
+
return resolved;
|
|
100
165
|
}
|
|
101
166
|
/**
|
|
102
167
|
* Clear the cached configuration
|
|
@@ -108,7 +173,7 @@ function clearConfigCache() {
|
|
|
108
173
|
// HELPER FUNCTIONS
|
|
109
174
|
// ============================================================================
|
|
110
175
|
/**
|
|
111
|
-
* Detect which platform a task belongs to
|
|
176
|
+
* Detect which platform a task belongs to
|
|
112
177
|
*/
|
|
113
178
|
function detectPlatform(config, taskTitle, taskDescription) {
|
|
114
179
|
if (!config.platforms?.length) {
|
|
@@ -132,40 +197,70 @@ function generateStructurePrompt(config) {
|
|
|
132
197
|
if (!config.structure || Object.keys(config.structure).length === 0) {
|
|
133
198
|
return '';
|
|
134
199
|
}
|
|
135
|
-
|
|
136
|
-
for (const [
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
200
|
+
const lines = ['## Project Structure'];
|
|
201
|
+
for (const [key, structure] of Object.entries(config.structure)) {
|
|
202
|
+
const name = structure.name || key;
|
|
203
|
+
lines.push(`### ${name}`);
|
|
204
|
+
lines.push(structure.description);
|
|
205
|
+
lines.push(`Root: \`${structure.rootPath}\``);
|
|
206
|
+
if (structure.keyDirectories?.length) {
|
|
207
|
+
lines.push(`Key directories: ${structure.keyDirectories.join(', ')}`);
|
|
140
208
|
}
|
|
141
|
-
|
|
209
|
+
lines.push('');
|
|
142
210
|
}
|
|
143
|
-
return
|
|
211
|
+
return lines.join('\n');
|
|
144
212
|
}
|
|
145
213
|
/**
|
|
146
|
-
* Generate platform-specific hints
|
|
214
|
+
* Generate platform-specific hints
|
|
147
215
|
*/
|
|
148
216
|
function generatePlatformHints(platform) {
|
|
149
217
|
if (!platform) {
|
|
150
218
|
return '';
|
|
151
219
|
}
|
|
152
|
-
|
|
153
|
-
|
|
220
|
+
const lines = [`## Platform: ${platform.name}`];
|
|
221
|
+
lines.push(`File patterns: ${platform.filePatterns.join(', ')}`);
|
|
154
222
|
if (platform.hints?.length) {
|
|
223
|
+
lines.push('\nHints:');
|
|
155
224
|
for (const hint of platform.hints) {
|
|
156
|
-
|
|
225
|
+
lines.push(`- ${hint}`);
|
|
157
226
|
}
|
|
158
227
|
}
|
|
159
|
-
return
|
|
228
|
+
return lines.join('\n');
|
|
160
229
|
}
|
|
161
230
|
/**
|
|
162
|
-
* Get the initial glob pattern for a task
|
|
231
|
+
* Get the initial glob pattern for a task
|
|
163
232
|
*/
|
|
164
233
|
function getInitialGlobPattern(config, platform) {
|
|
165
234
|
if (platform?.filePatterns?.length) {
|
|
166
235
|
return platform.filePatterns[0];
|
|
167
236
|
}
|
|
168
|
-
// Default to TypeScript files
|
|
169
237
|
return '**/*.ts';
|
|
170
238
|
}
|
|
239
|
+
/**
|
|
240
|
+
* Check if a command is blocked by safety rules
|
|
241
|
+
*/
|
|
242
|
+
function isBlockedCommand(command, config) {
|
|
243
|
+
const normalizedCommand = command.toLowerCase();
|
|
244
|
+
return config.safety.blockedBashPatterns.some(pattern => normalizedCommand.includes(pattern.toLowerCase()));
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Check if a path is protected
|
|
248
|
+
*/
|
|
249
|
+
function isProtectedPath(filePath, config) {
|
|
250
|
+
if (!config.protectedPaths?.length)
|
|
251
|
+
return false;
|
|
252
|
+
const normalizedPath = filePath.replace(/\\/g, '/');
|
|
253
|
+
for (const pattern of config.protectedPaths) {
|
|
254
|
+
if (pattern.includes('*')) {
|
|
255
|
+
const regex = new RegExp('^' + pattern.replace(/\*/g, '.*').replace(/\?/g, '.') + '$');
|
|
256
|
+
if (regex.test(normalizedPath))
|
|
257
|
+
return true;
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
if (normalizedPath === pattern || normalizedPath.endsWith(`/${pattern}`))
|
|
261
|
+
return true;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
171
266
|
//# sourceMappingURL=index.js.map
|
package/dist/config/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2OH,4CAsBC;AAKD,4CAEC;AASD,wCAqBC;AAKD,0DAmBC;AAKD,sDAgBC;AAKD,sDAQC;AAKD,4CAKC;AAKD,0CAiBC;AA9XD,gDAAiC;AACjC,2CAA4B;AAyH5B,+EAA+E;AAC/E,wBAAwB;AACxB,+EAA+E;AAElE,QAAA,6BAA6B,GAAG;IAC3C,UAAU;IACV,UAAU;IACV,UAAU;IACV,MAAM;IACN,SAAS;IACT,MAAM;IACN,QAAQ;IACR,aAAa;IACb,gBAAgB;IAChB,gBAAgB;IAChB,WAAW;CACZ,CAAA;AAEY,QAAA,uBAAuB,GAAG;IACrC,MAAM;IACN,YAAY;IACZ,iBAAiB;IACjB,cAAc;IACd,OAAO;IACP,OAAO;IACP,qBAAqB;IACrB,cAAc;IACd,SAAS;CACV,CAAA;AAEY,QAAA,eAAe,GAAyB;IACnD,OAAO,EAAE,KAAK;IACd,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,SAAS;IACtB,SAAS,EAAE,EAAE;IACb,SAAS,EAAE,EAAE;IACb,cAAc,EAAE,+BAAuB;IACvC,kBAAkB,EAAE,EAAE;IAEtB,KAAK,EAAE;QACL,sBAAsB,EAAE,EAAE;QAC1B,uBAAuB,EAAE,E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AiB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAA;IAC/C,OAAO,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CACtD,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAClD,CAAA;AACH,CAAC;AAED;;GAEG;AACH,SAAgB,eAAe,CAAC,QAAgB,EAAE,MAA4B;IAC5E,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM;QAAE,OAAO,KAAK,CAAA;IAEhD,MAAM,cAAc,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IAEnD,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC;QAC5C,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1B,MAAM,KAAK,GAAG,IAAI,MAAM,CACtB,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,GAAG,CAC7D,CAAA;YACD,IAAI,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC;gBAAE,OAAO,IAAI,CAAA;QAC7C,CAAC;aAAM,CAAC;YACN,IAAI,cAAc,KAAK,OAAO,IAAI,cAAc,CAAC,QAAQ,CAAC,IAAI,OAAO,EAAE,CAAC;gBAAE,OAAO,IAAI,CAAA;QACvF,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC"}
|
|
@@ -1,24 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* OpenAI Agent Executor
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* Provides similar capabilities to Claude Agent SDK but using GPT models.
|
|
4
|
+
* Thin wrapper around OpenAI API that uses config-driven behavior.
|
|
6
5
|
*/
|
|
7
6
|
import type { ImplementationPlan, ExecutionResult, PlanningResult, Logger, ProgressCallback } from '../types/index.js';
|
|
8
7
|
export interface OpenAIExecutorConfig {
|
|
9
|
-
/** Path to the cloned repository */
|
|
10
8
|
repoPath: string;
|
|
11
|
-
/** OpenAI API key */
|
|
12
9
|
apiKey: string;
|
|
13
|
-
/** Model to use */
|
|
14
10
|
model?: string;
|
|
15
|
-
/** Maximum iterations for tool use loop */
|
|
16
11
|
maxIterations?: number;
|
|
17
|
-
/** Logger function */
|
|
18
12
|
logger?: Logger;
|
|
19
|
-
/** Callback for progress updates */
|
|
20
13
|
onProgress?: ProgressCallback;
|
|
21
14
|
}
|
|
22
|
-
export declare function planWithOpenAI(taskTitle: string, taskDescription: string | null,
|
|
23
|
-
export declare function executeWithOpenAI(plan: ImplementationPlan, taskTitle: string, taskDescription: string | null,
|
|
15
|
+
export declare function planWithOpenAI(taskTitle: string, taskDescription: string | null, executorConfig: OpenAIExecutorConfig): Promise<PlanningResult>;
|
|
16
|
+
export declare function executeWithOpenAI(plan: ImplementationPlan, taskTitle: string, taskDescription: string | null, executorConfig: OpenAIExecutorConfig): Promise<ExecutionResult>;
|
|
24
17
|
//# sourceMappingURL=openai.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../src/executors/openai.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../src/executors/openai.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,MAAM,EACN,gBAAgB,EACjB,MAAM,mBAAmB,CAAA;AAgB1B,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,gBAAgB,CAAA;CAC9B;AAyUD,wBAAsB,cAAc,CAClC,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,GAAG,IAAI,EAC9B,cAAc,EAAE,oBAAoB,GACnC,OAAO,CAAC,cAAc,CAAC,CA0IzB;AAMD,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,kBAAkB,EACxB,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,GAAG,IAAI,EAC9B,cAAc,EAAE,oBAAoB,GACnC,OAAO,CAAC,eAAe,CAAC,CA+J1B"}
|
package/dist/executors/openai.js
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* OpenAI Agent Executor
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* Provides similar capabilities to Claude Agent SDK but using GPT models.
|
|
5
|
+
* Thin wrapper around OpenAI API that uses config-driven behavior.
|
|
7
6
|
*/
|
|
8
7
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
8
|
if (k2 === undefined) k2 = k;
|
|
@@ -46,6 +45,7 @@ const path = __importStar(require("path"));
|
|
|
46
45
|
const child_process_1 = require("child_process");
|
|
47
46
|
const glob_1 = require("glob");
|
|
48
47
|
const agent_config_js_1 = require("../utils/agent-config.js");
|
|
48
|
+
const index_js_1 = require("../config/index.js");
|
|
49
49
|
// ============================================================================
|
|
50
50
|
// TOOL DEFINITIONS
|
|
51
51
|
// ============================================================================
|
|
@@ -58,7 +58,7 @@ const TOOLS = [
|
|
|
58
58
|
parameters: {
|
|
59
59
|
type: 'object',
|
|
60
60
|
properties: {
|
|
61
|
-
file_path: { type: 'string', description: 'Path to the file
|
|
61
|
+
file_path: { type: 'string', description: 'Path to the file' }
|
|
62
62
|
},
|
|
63
63
|
required: ['file_path']
|
|
64
64
|
}
|
|
@@ -68,7 +68,7 @@ const TOOLS = [
|
|
|
68
68
|
type: 'function',
|
|
69
69
|
function: {
|
|
70
70
|
name: 'write_file',
|
|
71
|
-
description: 'Write content to a file
|
|
71
|
+
description: 'Write content to a file',
|
|
72
72
|
parameters: {
|
|
73
73
|
type: 'object',
|
|
74
74
|
properties: {
|
|
@@ -88,7 +88,7 @@ const TOOLS = [
|
|
|
88
88
|
type: 'object',
|
|
89
89
|
properties: {
|
|
90
90
|
file_path: { type: 'string', description: 'Path to the file' },
|
|
91
|
-
old_string: { type: 'string', description: 'String to find
|
|
91
|
+
old_string: { type: 'string', description: 'String to find' },
|
|
92
92
|
new_string: { type: 'string', description: 'Replacement string' }
|
|
93
93
|
},
|
|
94
94
|
required: ['file_path', 'old_string', 'new_string']
|
|
@@ -99,11 +99,11 @@ const TOOLS = [
|
|
|
99
99
|
type: 'function',
|
|
100
100
|
function: {
|
|
101
101
|
name: 'run_bash',
|
|
102
|
-
description: 'Run a bash command
|
|
102
|
+
description: 'Run a bash command',
|
|
103
103
|
parameters: {
|
|
104
104
|
type: 'object',
|
|
105
105
|
properties: {
|
|
106
|
-
command: { type: 'string', description: 'The bash command
|
|
106
|
+
command: { type: 'string', description: 'The bash command' }
|
|
107
107
|
},
|
|
108
108
|
required: ['command']
|
|
109
109
|
}
|
|
@@ -117,7 +117,7 @@ const TOOLS = [
|
|
|
117
117
|
parameters: {
|
|
118
118
|
type: 'object',
|
|
119
119
|
properties: {
|
|
120
|
-
pattern: { type: 'string', description: 'Glob pattern
|
|
120
|
+
pattern: { type: 'string', description: 'Glob pattern' }
|
|
121
121
|
},
|
|
122
122
|
required: ['pattern']
|
|
123
123
|
}
|
|
@@ -132,7 +132,7 @@ const TOOLS = [
|
|
|
132
132
|
type: 'object',
|
|
133
133
|
properties: {
|
|
134
134
|
pattern: { type: 'string', description: 'Search pattern' },
|
|
135
|
-
file_pattern: { type: 'string', description: 'Optional glob pattern
|
|
135
|
+
file_pattern: { type: 'string', description: 'Optional glob pattern' }
|
|
136
136
|
},
|
|
137
137
|
required: ['pattern']
|
|
138
138
|
}
|
|
@@ -147,15 +147,15 @@ const TOOLS = [
|
|
|
147
147
|
type: 'object',
|
|
148
148
|
properties: {
|
|
149
149
|
commit_message: { type: 'string', description: 'Git commit message' },
|
|
150
|
-
pr_title: { type: 'string', description: '
|
|
151
|
-
pr_description: { type: 'string', description: '
|
|
150
|
+
pr_title: { type: 'string', description: 'PR title' },
|
|
151
|
+
pr_description: { type: 'string', description: 'PR description' }
|
|
152
152
|
},
|
|
153
153
|
required: ['commit_message', 'pr_title', 'pr_description']
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
];
|
|
158
|
-
async function executeTool(name, args, repoPath) {
|
|
158
|
+
async function executeTool(name, args, repoPath, config) {
|
|
159
159
|
try {
|
|
160
160
|
switch (name) {
|
|
161
161
|
case 'read_file': {
|
|
@@ -199,9 +199,8 @@ async function executeTool(name, args, repoPath) {
|
|
|
199
199
|
}
|
|
200
200
|
case 'run_bash': {
|
|
201
201
|
const command = args.command;
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
return { success: false, result: 'Error: Dangerous command blocked' };
|
|
202
|
+
if ((0, index_js_1.isBlockedCommand)(command, config)) {
|
|
203
|
+
return { success: false, result: 'Error: Command blocked by safety policy' };
|
|
205
204
|
}
|
|
206
205
|
try {
|
|
207
206
|
const output = (0, child_process_1.execSync)(command, {
|
|
@@ -220,13 +219,16 @@ async function executeTool(name, args, repoPath) {
|
|
|
220
219
|
case 'glob_files': {
|
|
221
220
|
const pattern = args.pattern;
|
|
222
221
|
const files = await (0, glob_1.glob)(pattern, { cwd: repoPath, nodir: true });
|
|
223
|
-
return {
|
|
222
|
+
return {
|
|
223
|
+
success: true,
|
|
224
|
+
result: files.slice(0, config.validation.maxGlobResults).join('\n') || '(no matches)'
|
|
225
|
+
};
|
|
224
226
|
}
|
|
225
227
|
case 'grep_search': {
|
|
226
228
|
const pattern = args.pattern;
|
|
227
229
|
const filePattern = args.file_pattern || '.';
|
|
228
230
|
try {
|
|
229
|
-
const output = (0, child_process_1.execSync)(`grep -rn "${pattern.replace(/"/g, '\\"')}" ${filePattern} | head
|
|
231
|
+
const output = (0, child_process_1.execSync)(`grep -rn "${pattern.replace(/"/g, '\\"')}" ${filePattern} | head -${config.validation.maxGlobResults}`, { cwd: repoPath, encoding: 'utf-8', timeout: 30000 });
|
|
230
232
|
return { success: true, result: output || '(no matches)' };
|
|
231
233
|
}
|
|
232
234
|
catch {
|
|
@@ -243,31 +245,57 @@ async function executeTool(name, args, repoPath) {
|
|
|
243
245
|
return { success: false, result: `Error: ${error instanceof Error ? error.message : String(error)}` };
|
|
244
246
|
}
|
|
245
247
|
}
|
|
246
|
-
async function callOpenAI(messages, apiKey, model) {
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
248
|
+
async function callOpenAI(messages, apiKey, model, config) {
|
|
249
|
+
const { maxRetries, initialBackoffMs, maxBackoffMs, backoffMultiplier, apiTimeoutMs } = config.retry;
|
|
250
|
+
let lastError = null;
|
|
251
|
+
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
252
|
+
const controller = new AbortController();
|
|
253
|
+
const timeoutId = setTimeout(() => controller.abort(), apiTimeoutMs);
|
|
254
|
+
try {
|
|
255
|
+
const response = await fetch('https://api.openai.com/v1/chat/completions', {
|
|
256
|
+
method: 'POST',
|
|
257
|
+
headers: {
|
|
258
|
+
'Content-Type': 'application/json',
|
|
259
|
+
'Authorization': `Bearer ${apiKey}`
|
|
260
|
+
},
|
|
261
|
+
signal: controller.signal,
|
|
262
|
+
body: JSON.stringify({
|
|
263
|
+
model,
|
|
264
|
+
messages,
|
|
265
|
+
tools: TOOLS,
|
|
266
|
+
tool_choice: 'auto',
|
|
267
|
+
max_tokens: config.agent.modelParameters.execution.maxTokens,
|
|
268
|
+
temperature: config.agent.modelParameters.execution.temperature
|
|
269
|
+
})
|
|
270
|
+
});
|
|
271
|
+
clearTimeout(timeoutId);
|
|
272
|
+
if (response.ok) {
|
|
273
|
+
return response.json();
|
|
274
|
+
}
|
|
275
|
+
const errorText = await response.text();
|
|
276
|
+
if (response.status === 429 && attempt < maxRetries - 1) {
|
|
277
|
+
const waitTime = Math.min(initialBackoffMs * Math.pow(backoffMultiplier, attempt), maxBackoffMs);
|
|
278
|
+
await new Promise(resolve => setTimeout(resolve, waitTime));
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
lastError = new Error(`OpenAI API error (${response.status}): ${errorText.substring(0, 200)}`);
|
|
282
|
+
break;
|
|
283
|
+
}
|
|
284
|
+
catch (fetchError) {
|
|
285
|
+
clearTimeout(timeoutId);
|
|
286
|
+
lastError = fetchError instanceof Error ? fetchError : new Error(String(fetchError));
|
|
287
|
+
if (attempt < maxRetries - 1) {
|
|
288
|
+
await new Promise(resolve => setTimeout(resolve, initialBackoffMs));
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
264
292
|
}
|
|
265
|
-
|
|
293
|
+
throw lastError || new Error('OpenAI API call failed');
|
|
266
294
|
}
|
|
267
|
-
async function loadAstridMd(repoPath) {
|
|
295
|
+
async function loadAstridMd(repoPath, maxLength) {
|
|
268
296
|
try {
|
|
269
297
|
const content = await fs.readFile(path.join(repoPath, 'ASTRID.md'), 'utf-8');
|
|
270
|
-
return content.length >
|
|
298
|
+
return content.length > maxLength ? content.substring(0, maxLength) + '\n\n[truncated...]' : content;
|
|
271
299
|
}
|
|
272
300
|
catch {
|
|
273
301
|
return null;
|
|
@@ -276,25 +304,34 @@ async function loadAstridMd(repoPath) {
|
|
|
276
304
|
// ============================================================================
|
|
277
305
|
// PLANNING
|
|
278
306
|
// ============================================================================
|
|
279
|
-
async function planWithOpenAI(taskTitle, taskDescription,
|
|
280
|
-
const log =
|
|
281
|
-
const onProgress =
|
|
282
|
-
const model =
|
|
283
|
-
log('info', 'Starting OpenAI planning', { repoPath:
|
|
307
|
+
async function planWithOpenAI(taskTitle, taskDescription, executorConfig) {
|
|
308
|
+
const log = executorConfig.logger || (() => { });
|
|
309
|
+
const onProgress = executorConfig.onProgress || (() => { });
|
|
310
|
+
const model = executorConfig.model || agent_config_js_1.DEFAULT_MODELS.openai;
|
|
311
|
+
log('info', 'Starting OpenAI planning', { repoPath: executorConfig.repoPath, taskTitle });
|
|
284
312
|
onProgress('Initializing OpenAI for planning...');
|
|
285
|
-
|
|
313
|
+
// Load config
|
|
314
|
+
const config = await (0, index_js_1.loadAstridConfig)(executorConfig.repoPath);
|
|
315
|
+
const platform = (0, index_js_1.detectPlatform)(config, taskTitle, taskDescription || '');
|
|
316
|
+
const initialPattern = (0, index_js_1.getInitialGlobPattern)(config, platform);
|
|
317
|
+
const astridMd = await loadAstridMd(executorConfig.repoPath, config.validation.contextTruncationLength);
|
|
318
|
+
const structurePrompt = (0, index_js_1.generateStructurePrompt)(config);
|
|
319
|
+
const platformHints = (0, index_js_1.generatePlatformHints)(platform);
|
|
286
320
|
const systemPrompt = `You are an AI coding assistant analyzing a codebase to create an implementation plan.
|
|
287
321
|
|
|
322
|
+
${structurePrompt}
|
|
323
|
+
${platformHints}
|
|
288
324
|
${astridMd ? `## Project Context\n${astridMd}\n` : ''}
|
|
325
|
+
${config.customInstructions ? `## Custom Instructions\n${config.customInstructions}\n` : ''}
|
|
289
326
|
|
|
290
327
|
## Your Task
|
|
291
|
-
|
|
328
|
+
Create an implementation plan for: "${taskTitle}"
|
|
292
329
|
${taskDescription ? `\nDetails: ${taskDescription}` : ''}
|
|
293
330
|
|
|
294
331
|
## Instructions
|
|
295
332
|
1. Use glob_files and grep_search to explore the codebase
|
|
296
333
|
2. Use read_file to examine relevant files
|
|
297
|
-
3. Create a focused implementation plan
|
|
334
|
+
3. Create a focused implementation plan (max ${config.validation.maxFilesPerPlan} files)
|
|
298
335
|
|
|
299
336
|
When ready, respond with ONLY a JSON block:
|
|
300
337
|
\`\`\`json
|
|
@@ -307,18 +344,23 @@ When ready, respond with ONLY a JSON block:
|
|
|
307
344
|
}
|
|
308
345
|
\`\`\`
|
|
309
346
|
|
|
310
|
-
RULES: Maximum
|
|
347
|
+
RULES: Maximum ${config.validation.maxFilesPerPlan} files, be SURGICAL.`;
|
|
311
348
|
const messages = [
|
|
312
349
|
{ role: 'system', content: systemPrompt },
|
|
313
|
-
{ role: 'user', content: `
|
|
350
|
+
{ role: 'user', content: `Start by calling glob_files with pattern "${initialPattern}" to find relevant files, then create an implementation plan for: ${taskTitle}` }
|
|
314
351
|
];
|
|
315
352
|
let totalInputTokens = 0;
|
|
316
353
|
let totalOutputTokens = 0;
|
|
317
|
-
const maxIterations =
|
|
354
|
+
const maxIterations = executorConfig.maxIterations || config.agent.maxPlanningIterations;
|
|
355
|
+
const timeoutMs = config.agent.planningTimeoutMinutes * 60 * 1000;
|
|
356
|
+
const startTime = Date.now();
|
|
318
357
|
try {
|
|
319
358
|
for (let i = 0; i < maxIterations; i++) {
|
|
359
|
+
if (Date.now() - startTime > timeoutMs) {
|
|
360
|
+
return { success: false, error: `Planning timed out after ${config.agent.planningTimeoutMinutes} minutes` };
|
|
361
|
+
}
|
|
320
362
|
onProgress(`Planning iteration ${i + 1}...`);
|
|
321
|
-
const response = await callOpenAI(messages,
|
|
363
|
+
const response = await callOpenAI(messages, executorConfig.apiKey, model, config);
|
|
322
364
|
totalInputTokens += response.usage.prompt_tokens;
|
|
323
365
|
totalOutputTokens += response.usage.completion_tokens;
|
|
324
366
|
const choice = response.choices[0];
|
|
@@ -332,10 +374,10 @@ RULES: Maximum 5 files, be SURGICAL.`;
|
|
|
332
374
|
for (const toolCall of assistantMessage.tool_calls) {
|
|
333
375
|
const args = JSON.parse(toolCall.function.arguments);
|
|
334
376
|
onProgress(`Using tool: ${toolCall.function.name}`);
|
|
335
|
-
const result = await executeTool(toolCall.function.name, args,
|
|
377
|
+
const result = await executeTool(toolCall.function.name, args, executorConfig.repoPath, config);
|
|
336
378
|
messages.push({
|
|
337
379
|
role: 'tool',
|
|
338
|
-
content: result.result.substring(0,
|
|
380
|
+
content: result.result.substring(0, config.validation.contextTruncationLength),
|
|
339
381
|
tool_call_id: toolCall.id
|
|
340
382
|
});
|
|
341
383
|
}
|
|
@@ -346,12 +388,10 @@ RULES: Maximum 5 files, be SURGICAL.`;
|
|
|
346
388
|
if (jsonMatch) {
|
|
347
389
|
try {
|
|
348
390
|
const plan = JSON.parse(jsonMatch[1]);
|
|
349
|
-
// Validate plan has at least 1 file
|
|
350
391
|
if (!plan.files || plan.files.length === 0) {
|
|
351
|
-
log('warn', 'Plan has no files, asking model to explore more', {});
|
|
352
392
|
messages.push({
|
|
353
393
|
role: 'user',
|
|
354
|
-
content: 'Your plan has no files
|
|
394
|
+
content: 'Your plan has no files. You MUST use glob_files and read_file first, then provide a plan with specific files. Please call glob_files now.'
|
|
355
395
|
});
|
|
356
396
|
continue;
|
|
357
397
|
}
|
|
@@ -369,21 +409,19 @@ RULES: Maximum 5 files, be SURGICAL.`;
|
|
|
369
409
|
log('warn', 'Failed to parse plan JSON', {});
|
|
370
410
|
}
|
|
371
411
|
}
|
|
372
|
-
// Check if first iteration without tool calls
|
|
373
412
|
if (i === 0) {
|
|
374
|
-
log('warn', 'First iteration had no tool calls - prompting model to use tools', {});
|
|
375
413
|
messages.push({
|
|
376
414
|
role: 'user',
|
|
377
|
-
content: 'You must use the tools to explore the codebase. Please call glob_files with an appropriate pattern
|
|
415
|
+
content: 'You must use the tools to explore the codebase. Please call glob_files with an appropriate pattern.'
|
|
378
416
|
});
|
|
379
417
|
continue;
|
|
380
418
|
}
|
|
381
419
|
}
|
|
382
420
|
if (choice.finish_reason === 'stop') {
|
|
383
|
-
messages.push({ role: 'user', content: 'Please provide the implementation plan as a JSON block with at least one file
|
|
421
|
+
messages.push({ role: 'user', content: 'Please provide the implementation plan as a JSON block with at least one file.' });
|
|
384
422
|
}
|
|
385
423
|
}
|
|
386
|
-
return { success: false, error: 'Max iterations reached
|
|
424
|
+
return { success: false, error: 'Max iterations reached' };
|
|
387
425
|
}
|
|
388
426
|
catch (error) {
|
|
389
427
|
return { success: false, error: error instanceof Error ? error.message : String(error) };
|
|
@@ -392,16 +430,24 @@ RULES: Maximum 5 files, be SURGICAL.`;
|
|
|
392
430
|
// ============================================================================
|
|
393
431
|
// EXECUTION
|
|
394
432
|
// ============================================================================
|
|
395
|
-
async function executeWithOpenAI(plan, taskTitle, taskDescription,
|
|
396
|
-
const log =
|
|
397
|
-
const onProgress =
|
|
398
|
-
const model =
|
|
399
|
-
log('info', 'Starting OpenAI execution', { repoPath:
|
|
433
|
+
async function executeWithOpenAI(plan, taskTitle, taskDescription, executorConfig) {
|
|
434
|
+
const log = executorConfig.logger || (() => { });
|
|
435
|
+
const onProgress = executorConfig.onProgress || (() => { });
|
|
436
|
+
const model = executorConfig.model || agent_config_js_1.DEFAULT_MODELS.openai;
|
|
437
|
+
log('info', 'Starting OpenAI execution', { repoPath: executorConfig.repoPath, filesInPlan: plan.files.length });
|
|
400
438
|
onProgress('Initializing OpenAI agent...');
|
|
401
|
-
|
|
439
|
+
// Load config
|
|
440
|
+
const config = await (0, index_js_1.loadAstridConfig)(executorConfig.repoPath);
|
|
441
|
+
const platform = (0, index_js_1.detectPlatform)(config, taskTitle, taskDescription || '');
|
|
442
|
+
const astridMd = await loadAstridMd(executorConfig.repoPath, config.validation.contextTruncationLength);
|
|
443
|
+
const structurePrompt = (0, index_js_1.generateStructurePrompt)(config);
|
|
444
|
+
const platformHints = (0, index_js_1.generatePlatformHints)(platform);
|
|
402
445
|
const systemPrompt = `You are an AI coding assistant implementing changes to a codebase.
|
|
403
446
|
|
|
447
|
+
${structurePrompt}
|
|
448
|
+
${platformHints}
|
|
404
449
|
${astridMd ? `## Project Context\n${astridMd}\n` : ''}
|
|
450
|
+
${config.customInstructions ? `## Custom Instructions\n${config.customInstructions}\n` : ''}
|
|
405
451
|
|
|
406
452
|
## Task
|
|
407
453
|
Implement: "${taskTitle}"
|
|
@@ -411,14 +457,14 @@ ${taskDescription ? `\nDetails: ${taskDescription}` : ''}
|
|
|
411
457
|
${JSON.stringify(plan, null, 2)}
|
|
412
458
|
|
|
413
459
|
## Instructions
|
|
414
|
-
1. Read the files
|
|
415
|
-
2. Make the necessary changes
|
|
460
|
+
1. Read the files in the plan
|
|
461
|
+
2. Make the necessary changes
|
|
416
462
|
3. Run tests if available
|
|
417
|
-
4.
|
|
463
|
+
4. Call task_complete when done
|
|
418
464
|
|
|
419
465
|
## Rules
|
|
420
|
-
- Follow the
|
|
421
|
-
- Make minimal
|
|
466
|
+
- Follow the plan exactly
|
|
467
|
+
- Make minimal changes
|
|
422
468
|
- Test your changes`;
|
|
423
469
|
const messages = [
|
|
424
470
|
{ role: 'system', content: systemPrompt },
|
|
@@ -427,11 +473,29 @@ ${JSON.stringify(plan, null, 2)}
|
|
|
427
473
|
const fileChanges = new Map();
|
|
428
474
|
let totalInputTokens = 0;
|
|
429
475
|
let totalOutputTokens = 0;
|
|
430
|
-
const maxIterations =
|
|
476
|
+
const maxIterations = executorConfig.maxIterations || config.agent.maxExecutionIterations;
|
|
477
|
+
const timeoutMs = config.agent.executionTimeoutMinutes * 60 * 1000;
|
|
478
|
+
const startTime = Date.now();
|
|
431
479
|
try {
|
|
432
480
|
for (let i = 0; i < maxIterations; i++) {
|
|
481
|
+
if (Date.now() - startTime > timeoutMs) {
|
|
482
|
+
const files = Array.from(fileChanges.entries()).map(([p, c]) => ({ path: p, ...c }));
|
|
483
|
+
return {
|
|
484
|
+
success: files.length > 0,
|
|
485
|
+
files,
|
|
486
|
+
commitMessage: `feat: ${taskTitle}`,
|
|
487
|
+
prTitle: `feat: ${taskTitle}`,
|
|
488
|
+
prDescription: taskDescription || taskTitle,
|
|
489
|
+
error: `Execution timed out after ${config.agent.executionTimeoutMinutes} minutes`,
|
|
490
|
+
usage: {
|
|
491
|
+
inputTokens: totalInputTokens,
|
|
492
|
+
outputTokens: totalOutputTokens,
|
|
493
|
+
costUSD: (totalInputTokens * 0.0025 + totalOutputTokens * 0.01) / 1000
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
}
|
|
433
497
|
onProgress(`Implementation iteration ${i + 1}...`);
|
|
434
|
-
const response = await callOpenAI(messages,
|
|
498
|
+
const response = await callOpenAI(messages, executorConfig.apiKey, model, config);
|
|
435
499
|
totalInputTokens += response.usage.prompt_tokens;
|
|
436
500
|
totalOutputTokens += response.usage.completion_tokens;
|
|
437
501
|
const choice = response.choices[0];
|
|
@@ -447,11 +511,7 @@ ${JSON.stringify(plan, null, 2)}
|
|
|
447
511
|
const toolName = toolCall.function.name;
|
|
448
512
|
onProgress(`Using tool: ${toolName}`);
|
|
449
513
|
if (toolName === 'task_complete') {
|
|
450
|
-
const files = Array.from(fileChanges.entries()).map(([p,
|
|
451
|
-
path: p,
|
|
452
|
-
content: change.content,
|
|
453
|
-
action: change.action
|
|
454
|
-
}));
|
|
514
|
+
const files = Array.from(fileChanges.entries()).map(([p, c]) => ({ path: p, ...c }));
|
|
455
515
|
return {
|
|
456
516
|
success: true,
|
|
457
517
|
files,
|
|
@@ -465,7 +525,7 @@ ${JSON.stringify(plan, null, 2)}
|
|
|
465
525
|
}
|
|
466
526
|
};
|
|
467
527
|
}
|
|
468
|
-
const result = await executeTool(toolName, args,
|
|
528
|
+
const result = await executeTool(toolName, args, executorConfig.repoPath, config);
|
|
469
529
|
if (result.fileChange) {
|
|
470
530
|
fileChanges.set(result.fileChange.path, {
|
|
471
531
|
content: result.fileChange.content,
|
|
@@ -474,7 +534,7 @@ ${JSON.stringify(plan, null, 2)}
|
|
|
474
534
|
}
|
|
475
535
|
messages.push({
|
|
476
536
|
role: 'tool',
|
|
477
|
-
content: result.result.substring(0,
|
|
537
|
+
content: result.result.substring(0, config.validation.contextTruncationLength),
|
|
478
538
|
tool_call_id: toolCall.id
|
|
479
539
|
});
|
|
480
540
|
}
|
|
@@ -483,15 +543,11 @@ ${JSON.stringify(plan, null, 2)}
|
|
|
483
543
|
if (choice.finish_reason === 'stop') {
|
|
484
544
|
messages.push({
|
|
485
545
|
role: 'user',
|
|
486
|
-
content: 'Please call task_complete to finalize
|
|
546
|
+
content: 'Please call task_complete to finalize.'
|
|
487
547
|
});
|
|
488
548
|
}
|
|
489
549
|
}
|
|
490
|
-
const files = Array.from(fileChanges.entries()).map(([p,
|
|
491
|
-
path: p,
|
|
492
|
-
content: change.content,
|
|
493
|
-
action: change.action
|
|
494
|
-
}));
|
|
550
|
+
const files = Array.from(fileChanges.entries()).map(([p, c]) => ({ path: p, ...c }));
|
|
495
551
|
return {
|
|
496
552
|
success: files.length > 0,
|
|
497
553
|
files,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai.js","sourceRoot":"","sources":["../../src/executors/openai.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6UH,wCAkIC;AAMD,8CAkJC;AArmBD,gDAAiC;AACjC,2CAA4B;AAC5B,iDAAwC;AACxC,+BAA2B;AAQ3B,8DAAyD;AA4BzD,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E,MAAM,KAAK,GAAG;IACZ;QACE,IAAI,EAAE,UAAmB;QACzB,QAAQ,EAAE;YACR,IAAI,EAAE,WAAW;YACjB,WAAW,EAAE,6BAA6B;YAC1C,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,8CAA8C,EAAE;iBAC3F;gBACD,QAAQ,EAAE,CAAC,WAAW,CAAC;aACxB;SACF;KACF;IACD;QACE,IAAI,EAAE,UAAmB;QACzB,QAAQ,EAAE;YACR,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,iDAAiD;YAC9D,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE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KAAK,CAAC,MAAM,GAAG,CAAC;YACzB,KAAK;YACL,aAAa,EAAE,SAAS,SAAS,EAAE;YACnC,OAAO,EAAE,SAAS,SAAS,EAAE;YAC7B,aAAa,EAAE,eAAe,IAAI,SAAS;YAC3C,KAAK,EAAE,wBAAwB;YAC/B,KAAK,EAAE;gBACL,WAAW,EAAE,gBAAgB;gBAC7B,YAAY,EAAE,iBAAiB;gBAC/B,OAAO,EAAE,CAAC,gBAAgB,GAAG,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAAC,GAAG,IAAI;aACvE;SACF,CAAA;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,EAAE;YACT,aAAa,EAAE,EAAE;YACjB,OAAO,EAAE,EAAE;YACX,aAAa,EAAE,EAAE;YACjB,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;SAC9D,CAAA;IACH,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* AI agent SDK for automated coding tasks with Claude, OpenAI, and Gemini
|
|
5
5
|
*/
|
|
6
6
|
export type { CodeGenerationRequest, GeneratedCode, ImplementationPlan, ExecutionResult, PlanningResult, AIService, AIAgentConfig, LogLevel, Logger, ProgressCallback, AstridTask, AstridList, PreviousTaskContext, RepositoryContextCache, } from './types/index.js';
|
|
7
|
-
export { loadAstridConfig, clearConfigCache, detectPlatform, generateStructurePrompt, generatePlatformHints, getInitialGlobPattern,
|
|
7
|
+
export { loadAstridConfig, clearConfigCache, detectPlatform, generateStructurePrompt, generatePlatformHints, getInitialGlobPattern, isBlockedCommand, isProtectedPath, CONFIG_DEFAULTS, type AstridConfig, type ResolvedAstridConfig, type ProjectStructure, type PlatformDetection, type AgentConfig, type ValidationConfig, type SafetyConfig, type RetryConfig, } from './config/index.js';
|
|
8
8
|
export { AI_AGENT_CONFIG, SUGGESTED_MODELS, DEFAULT_MODELS, getAgentConfig, getAgentService, getAgentModel, getAgentContextFile, isRegisteredAgent, getRegisteredAgentEmails, getAllAgentConfigs, } from './utils/agent-config.js';
|
|
9
9
|
export { planWithClaude, executeWithClaude, prepareRepository, type ClaudeExecutorConfig, } from './executors/claude.js';
|
|
10
10
|
export { planWithOpenAI, executeWithOpenAI, type OpenAIExecutorConfig, } from './executors/openai.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,YAAY,EACV,qBAAqB,EACrB,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,SAAS,EACT,aAAa,EACb,QAAQ,EACR,MAAM,EACN,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,kBAAkB,CAAA;AAGzB,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,YAAY,EACV,qBAAqB,EACrB,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,SAAS,EACT,aAAa,EACb,QAAQ,EACR,MAAM,EACN,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,kBAAkB,CAAA;AAGzB,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,WAAW,GACjB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,wBAAwB,EACxB,kBAAkB,GACnB,MAAM,yBAAyB,CAAA;AAGhC,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,KAAK,oBAAoB,GAC1B,MAAM,uBAAuB,CAAA;AAG9B,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,KAAK,oBAAoB,GAC1B,MAAM,uBAAuB,CAAA;AAG9B,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,KAAK,oBAAoB,GAC1B,MAAM,uBAAuB,CAAA;AAG9B,OAAO,EACL,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,cAAc,GACpB,MAAM,4BAA4B,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* AI agent SDK for automated coding tasks with Claude, OpenAI, and Gemini
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.AstridOAuthClient = exports.executeWithGemini = exports.planWithGemini = exports.executeWithOpenAI = exports.planWithOpenAI = exports.prepareRepository = exports.executeWithClaude = exports.planWithClaude = exports.getAllAgentConfigs = exports.getRegisteredAgentEmails = exports.isRegisteredAgent = exports.getAgentContextFile = exports.getAgentModel = exports.getAgentService = exports.getAgentConfig = exports.DEFAULT_MODELS = exports.SUGGESTED_MODELS = exports.AI_AGENT_CONFIG = exports.
|
|
8
|
+
exports.AstridOAuthClient = exports.executeWithGemini = exports.planWithGemini = exports.executeWithOpenAI = exports.planWithOpenAI = exports.prepareRepository = exports.executeWithClaude = exports.planWithClaude = exports.getAllAgentConfigs = exports.getRegisteredAgentEmails = exports.isRegisteredAgent = exports.getAgentContextFile = exports.getAgentModel = exports.getAgentService = exports.getAgentConfig = exports.DEFAULT_MODELS = exports.SUGGESTED_MODELS = exports.AI_AGENT_CONFIG = exports.CONFIG_DEFAULTS = exports.isProtectedPath = exports.isBlockedCommand = exports.getInitialGlobPattern = exports.generatePlatformHints = exports.generateStructurePrompt = exports.detectPlatform = exports.clearConfigCache = exports.loadAstridConfig = void 0;
|
|
9
9
|
// Configuration
|
|
10
10
|
var index_js_1 = require("./config/index.js");
|
|
11
11
|
Object.defineProperty(exports, "loadAstridConfig", { enumerable: true, get: function () { return index_js_1.loadAstridConfig; } });
|
|
@@ -14,7 +14,9 @@ Object.defineProperty(exports, "detectPlatform", { enumerable: true, get: functi
|
|
|
14
14
|
Object.defineProperty(exports, "generateStructurePrompt", { enumerable: true, get: function () { return index_js_1.generateStructurePrompt; } });
|
|
15
15
|
Object.defineProperty(exports, "generatePlatformHints", { enumerable: true, get: function () { return index_js_1.generatePlatformHints; } });
|
|
16
16
|
Object.defineProperty(exports, "getInitialGlobPattern", { enumerable: true, get: function () { return index_js_1.getInitialGlobPattern; } });
|
|
17
|
-
Object.defineProperty(exports, "
|
|
17
|
+
Object.defineProperty(exports, "isBlockedCommand", { enumerable: true, get: function () { return index_js_1.isBlockedCommand; } });
|
|
18
|
+
Object.defineProperty(exports, "isProtectedPath", { enumerable: true, get: function () { return index_js_1.isProtectedPath; } });
|
|
19
|
+
Object.defineProperty(exports, "CONFIG_DEFAULTS", { enumerable: true, get: function () { return index_js_1.CONFIG_DEFAULTS; } });
|
|
18
20
|
// Agent Configuration
|
|
19
21
|
var agent_config_js_1 = require("./utils/agent-config.js");
|
|
20
22
|
Object.defineProperty(exports, "AI_AGENT_CONFIG", { enumerable: true, get: function () { return agent_config_js_1.AI_AGENT_CONFIG; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAoBH,gBAAgB;AAChB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAoBH,gBAAgB;AAChB,8CAkB0B;AAjBxB,4GAAA,gBAAgB,OAAA;AAChB,4GAAA,gBAAgB,OAAA;AAChB,0GAAA,cAAc,OAAA;AACd,mHAAA,uBAAuB,OAAA;AACvB,iHAAA,qBAAqB,OAAA;AACrB,iHAAA,qBAAqB,OAAA;AACrB,4GAAA,gBAAgB,OAAA;AAChB,2GAAA,eAAe,OAAA;AACf,2GAAA,eAAe,OAAA;AAWjB,sBAAsB;AACtB,2DAWgC;AAV9B,kHAAA,eAAe,OAAA;AACf,mHAAA,gBAAgB,OAAA;AAChB,iHAAA,cAAc,OAAA;AACd,iHAAA,cAAc,OAAA;AACd,kHAAA,eAAe,OAAA;AACf,gHAAA,aAAa,OAAA;AACb,sHAAA,mBAAmB,OAAA;AACnB,oHAAA,iBAAiB,OAAA;AACjB,2HAAA,wBAAwB,OAAA;AACxB,qHAAA,kBAAkB,OAAA;AAGpB,kBAAkB;AAClB,mDAK8B;AAJ5B,2GAAA,cAAc,OAAA;AACd,8GAAA,iBAAiB,OAAA;AACjB,8GAAA,iBAAiB,OAAA;AAInB,kBAAkB;AAClB,mDAI8B;AAH5B,2GAAA,cAAc,OAAA;AACd,8GAAA,iBAAiB,OAAA;AAInB,kBAAkB;AAClB,mDAI8B;AAH5B,2GAAA,cAAc,OAAA;AACd,8GAAA,iBAAiB,OAAA;AAInB,sBAAsB;AACtB,8DAOmC;AANjC,oHAAA,iBAAiB,OAAA"}
|