@deimoscloud/coreai 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierrc +9 -0
- package/AGENT_SPEC.md +347 -0
- package/ARCHITECTURE.md +547 -0
- package/DRAFT_PRD.md +1440 -0
- package/IMPLEMENTATION_PLAN.md +256 -0
- package/PRODUCT.md +473 -0
- package/README.md +303 -0
- package/WORKFLOWS.md +295 -0
- package/agents/_templates/ic-engineer.md +185 -0
- package/agents/_templates/reviewer.md +182 -0
- package/agents/backend-engineer.yaml +72 -0
- package/agents/devops-engineer.yaml +72 -0
- package/agents/engineering-manager.yaml +70 -0
- package/agents/examples/android-engineer.md +302 -0
- package/agents/examples/backend-engineer.md +320 -0
- package/agents/examples/devops-engineer.md +742 -0
- package/agents/examples/engineering-manager.md +469 -0
- package/agents/examples/frontend-engineer.md +58 -0
- package/agents/examples/product-manager.md +315 -0
- package/agents/examples/qa-engineer.md +371 -0
- package/agents/examples/security-engineer.md +525 -0
- package/agents/examples/solutions-architect.md +351 -0
- package/agents/examples/wearos-engineer.md +359 -0
- package/agents/frontend-engineer.yaml +72 -0
- package/commands/core/check-inbox.md +34 -0
- package/commands/core/delegate.md +30 -0
- package/commands/core/git-commit.md +144 -0
- package/commands/core/pr-create.md +193 -0
- package/commands/core/review.md +56 -0
- package/commands/core/sprint-status.md +65 -0
- package/commands/optional/docs-update.md +200 -0
- package/commands/optional/jira-create.md +200 -0
- package/commands/optional/jira-transition.md +184 -0
- package/commands/optional/worktree-cleanup.md +167 -0
- package/commands/optional/worktree-setup.md +110 -0
- package/dist/cli/index.js +4037 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/index.d.ts +2978 -0
- package/dist/index.js +3867 -0
- package/dist/index.js.map +1 -0
- package/eslint.config.js +29 -0
- package/jest.config.js +22 -0
- package/knowledge-library/README.md +118 -0
- package/knowledge-library/android-engineer/context/current.txt +42 -0
- package/knowledge-library/android-engineer/control/decisions.txt +9 -0
- package/knowledge-library/android-engineer/control/dependencies.txt +19 -0
- package/knowledge-library/android-engineer/control/objectives.txt +26 -0
- package/knowledge-library/android-engineer/history/.gitkeep +0 -0
- package/knowledge-library/android-engineer/inbox/processed/.gitkeep +0 -0
- package/knowledge-library/android-engineer/outbox/.gitkeep +0 -0
- package/knowledge-library/android-engineer/tech/.gitkeep +0 -0
- package/knowledge-library/architecture.txt +61 -0
- package/knowledge-library/backend-engineer/context/current.txt +42 -0
- package/knowledge-library/backend-engineer/control/decisions.txt +9 -0
- package/knowledge-library/backend-engineer/control/dependencies.txt +19 -0
- package/knowledge-library/backend-engineer/control/objectives.txt +26 -0
- package/knowledge-library/backend-engineer/history/.gitkeep +0 -0
- package/knowledge-library/backend-engineer/inbox/processed/.gitkeep +0 -0
- package/knowledge-library/backend-engineer/outbox/.gitkeep +0 -0
- package/knowledge-library/backend-engineer/tech/.gitkeep +0 -0
- package/knowledge-library/context.txt +52 -0
- package/knowledge-library/devops-engineer/context/current.txt +42 -0
- package/knowledge-library/devops-engineer/control/decisions.txt +9 -0
- package/knowledge-library/devops-engineer/control/dependencies.txt +19 -0
- package/knowledge-library/devops-engineer/control/objectives.txt +26 -0
- package/knowledge-library/devops-engineer/history/.gitkeep +0 -0
- package/knowledge-library/devops-engineer/inbox/processed/.gitkeep +0 -0
- package/knowledge-library/devops-engineer/outbox/.gitkeep +0 -0
- package/knowledge-library/devops-engineer/tech/.gitkeep +0 -0
- package/knowledge-library/engineering-manager/context/current.txt +40 -0
- package/knowledge-library/engineering-manager/control/decisions.txt +9 -0
- package/knowledge-library/engineering-manager/control/objectives.txt +27 -0
- package/knowledge-library/engineering-manager/history/.gitkeep +0 -0
- package/knowledge-library/engineering-manager/inbox/processed/.gitkeep +0 -0
- package/knowledge-library/engineering-manager/outbox/.gitkeep +0 -0
- package/knowledge-library/engineering-manager/tech/.gitkeep +0 -0
- package/knowledge-library/prd.txt +81 -0
- package/knowledge-library/product-manager/context/current.txt +42 -0
- package/knowledge-library/product-manager/control/decisions.txt +9 -0
- package/knowledge-library/product-manager/control/dependencies.txt +19 -0
- package/knowledge-library/product-manager/control/objectives.txt +26 -0
- package/knowledge-library/product-manager/history/.gitkeep +0 -0
- package/knowledge-library/product-manager/inbox/processed/.gitkeep +0 -0
- package/knowledge-library/product-manager/outbox/.gitkeep +0 -0
- package/knowledge-library/product-manager/tech/.gitkeep +0 -0
- package/knowledge-library/qa-engineer/context/current.txt +42 -0
- package/knowledge-library/qa-engineer/control/decisions.txt +9 -0
- package/knowledge-library/qa-engineer/control/dependencies.txt +19 -0
- package/knowledge-library/qa-engineer/control/objectives.txt +26 -0
- package/knowledge-library/qa-engineer/history/.gitkeep +0 -0
- package/knowledge-library/qa-engineer/inbox/processed/.gitkeep +0 -0
- package/knowledge-library/qa-engineer/outbox/.gitkeep +0 -0
- package/knowledge-library/qa-engineer/tech/.gitkeep +0 -0
- package/knowledge-library/security-engineer/context/current.txt +42 -0
- package/knowledge-library/security-engineer/control/decisions.txt +9 -0
- package/knowledge-library/security-engineer/control/dependencies.txt +19 -0
- package/knowledge-library/security-engineer/control/objectives.txt +26 -0
- package/knowledge-library/security-engineer/history/.gitkeep +0 -0
- package/knowledge-library/security-engineer/inbox/processed/.gitkeep +0 -0
- package/knowledge-library/security-engineer/outbox/.gitkeep +0 -0
- package/knowledge-library/security-engineer/tech/.gitkeep +0 -0
- package/knowledge-library/solutions-architect/context/current.txt +42 -0
- package/knowledge-library/solutions-architect/control/decisions.txt +9 -0
- package/knowledge-library/solutions-architect/control/dependencies.txt +19 -0
- package/knowledge-library/solutions-architect/control/objectives.txt +26 -0
- package/knowledge-library/solutions-architect/history/.gitkeep +0 -0
- package/knowledge-library/solutions-architect/inbox/processed/.gitkeep +0 -0
- package/knowledge-library/solutions-architect/outbox/.gitkeep +0 -0
- package/knowledge-library/solutions-architect/tech/.gitkeep +0 -0
- package/knowledge-library/wearos-engineer/context/current.txt +42 -0
- package/knowledge-library/wearos-engineer/control/decisions.txt +9 -0
- package/knowledge-library/wearos-engineer/control/dependencies.txt +19 -0
- package/knowledge-library/wearos-engineer/control/objectives.txt +26 -0
- package/knowledge-library/wearos-engineer/history/.gitkeep +0 -0
- package/knowledge-library/wearos-engineer/inbox/processed/.gitkeep +0 -0
- package/knowledge-library/wearos-engineer/outbox/.gitkeep +0 -0
- package/knowledge-library/wearos-engineer/tech/.gitkeep +0 -0
- package/package.json +66 -0
- package/schemas/agent.schema.json +171 -0
- package/schemas/coreai.config.schema.json +257 -0
- package/scripts/add-agent.sh +323 -0
- package/scripts/install.sh +354 -0
- package/src/adapters/factory.test.ts +386 -0
- package/src/adapters/factory.ts +305 -0
- package/src/adapters/index.ts +113 -0
- package/src/adapters/interfaces.ts +268 -0
- package/src/adapters/mcp/client.test.ts +130 -0
- package/src/adapters/mcp/client.ts +451 -0
- package/src/adapters/mcp/discovery.test.ts +315 -0
- package/src/adapters/mcp/discovery.ts +340 -0
- package/src/adapters/mcp/index.ts +66 -0
- package/src/adapters/mcp/mapper.test.ts +218 -0
- package/src/adapters/mcp/mapper.ts +536 -0
- package/src/adapters/mcp/registry.test.ts +433 -0
- package/src/adapters/mcp/registry.ts +550 -0
- package/src/adapters/mcp/types.ts +258 -0
- package/src/adapters/native/filesystem.test.ts +350 -0
- package/src/adapters/native/filesystem.ts +393 -0
- package/src/adapters/native/github.test.ts +173 -0
- package/src/adapters/native/github.ts +627 -0
- package/src/adapters/native/index.ts +22 -0
- package/src/adapters/native/selector.test.ts +224 -0
- package/src/adapters/native/selector.ts +150 -0
- package/src/adapters/types.ts +270 -0
- package/src/agents/compiler.test.ts +399 -0
- package/src/agents/compiler.ts +359 -0
- package/src/agents/index.ts +36 -0
- package/src/agents/loader.test.ts +319 -0
- package/src/agents/loader.ts +143 -0
- package/src/agents/resolver.test.ts +282 -0
- package/src/agents/resolver.ts +262 -0
- package/src/agents/types.ts +87 -0
- package/src/cache/index.ts +38 -0
- package/src/cache/interfaces.ts +283 -0
- package/src/cache/manager.test.ts +266 -0
- package/src/cache/manager.ts +388 -0
- package/src/cache/provider.test.ts +485 -0
- package/src/cache/provider.ts +745 -0
- package/src/cache/types.test.ts +192 -0
- package/src/cache/types.ts +313 -0
- package/src/cli/commands/build.test.ts +248 -0
- package/src/cli/commands/build.ts +244 -0
- package/src/cli/commands/cache.test.ts +221 -0
- package/src/cli/commands/cache.ts +229 -0
- package/src/cli/commands/index.ts +63 -0
- package/src/cli/commands/init.test.ts +173 -0
- package/src/cli/commands/init.ts +296 -0
- package/src/cli/commands/skills.test.ts +272 -0
- package/src/cli/commands/skills.ts +348 -0
- package/src/cli/commands/status.test.ts +392 -0
- package/src/cli/commands/status.ts +332 -0
- package/src/cli/commands/sync.test.ts +213 -0
- package/src/cli/commands/sync.ts +251 -0
- package/src/cli/commands/validate.test.ts +216 -0
- package/src/cli/commands/validate.ts +340 -0
- package/src/cli/index.test.ts +190 -0
- package/src/cli/index.ts +493 -0
- package/src/commands/context.test.ts +163 -0
- package/src/commands/context.ts +111 -0
- package/src/commands/index.ts +56 -0
- package/src/commands/loader.test.ts +273 -0
- package/src/commands/loader.ts +355 -0
- package/src/commands/registry.test.ts +384 -0
- package/src/commands/registry.ts +248 -0
- package/src/commands/runner.test.ts +297 -0
- package/src/commands/runner.ts +222 -0
- package/src/commands/types.ts +361 -0
- package/src/config/index.ts +19 -0
- package/src/config/loader.test.ts +262 -0
- package/src/config/loader.ts +188 -0
- package/src/config/types.ts +154 -0
- package/src/context/index.ts +14 -0
- package/src/context/loader.test.ts +334 -0
- package/src/context/loader.ts +357 -0
- package/src/index.test.ts +13 -0
- package/src/index.ts +244 -0
- package/src/knowledge-library/index.ts +44 -0
- package/src/knowledge-library/manager.test.ts +536 -0
- package/src/knowledge-library/manager.ts +804 -0
- package/src/knowledge-library/types.ts +432 -0
- package/src/skills/generator.test.ts +602 -0
- package/src/skills/generator.ts +491 -0
- package/src/skills/index.ts +27 -0
- package/src/skills/templates.ts +520 -0
- package/src/skills/types.ts +251 -0
- package/templates/completion-report.md +72 -0
- package/templates/feedback.md +56 -0
- package/templates/project-files/CLAUDE.md.template +109 -0
- package/templates/project-files/coreai.json.example +47 -0
- package/templates/project-files/mcp.json.template +20 -0
- package/templates/review-complete.md +64 -0
- package/templates/review-request.md +67 -0
- package/templates/task-assignment.md +51 -0
- package/tsconfig.build.json +4 -0
- package/tsconfig.json +26 -0
- package/tsup.config.ts +23 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2978 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CoreAI Configuration Types
|
|
3
|
+
*
|
|
4
|
+
* TypeScript types corresponding to the JSON schema at schemas/coreai.config.schema.json
|
|
5
|
+
*/
|
|
6
|
+
type ProjectType = 'software' | 'infrastructure' | 'data' | 'mobile';
|
|
7
|
+
type IssueTrackerProvider = 'jira' | 'linear' | 'github-issues' | 'azure-devops';
|
|
8
|
+
type GitProvider = 'github' | 'gitlab' | 'bitbucket' | 'azure-devops';
|
|
9
|
+
type DocumentationProvider = 'confluence' | 'notion' | 'github-wiki' | 'local';
|
|
10
|
+
type StateProvider = 'confluence' | 'notion' | 's3' | 'github-repo' | 'local';
|
|
11
|
+
type AdapterStrategy = 'mcp' | 'native' | 'auto';
|
|
12
|
+
interface ProjectConfig {
|
|
13
|
+
name: string;
|
|
14
|
+
type?: ProjectType;
|
|
15
|
+
root?: string;
|
|
16
|
+
}
|
|
17
|
+
interface TeamConfig {
|
|
18
|
+
agents?: string[];
|
|
19
|
+
}
|
|
20
|
+
interface IssueTrackerConfig {
|
|
21
|
+
project_key?: string;
|
|
22
|
+
base_url?: string;
|
|
23
|
+
[key: string]: unknown;
|
|
24
|
+
}
|
|
25
|
+
interface IssueTrackerIntegration {
|
|
26
|
+
provider: IssueTrackerProvider;
|
|
27
|
+
config?: IssueTrackerConfig;
|
|
28
|
+
strategy?: AdapterStrategy;
|
|
29
|
+
}
|
|
30
|
+
interface GitConfig {
|
|
31
|
+
owner?: string;
|
|
32
|
+
repo?: string;
|
|
33
|
+
default_branch?: string;
|
|
34
|
+
[key: string]: unknown;
|
|
35
|
+
}
|
|
36
|
+
interface GitIntegration {
|
|
37
|
+
provider: GitProvider;
|
|
38
|
+
config?: GitConfig;
|
|
39
|
+
strategy?: AdapterStrategy;
|
|
40
|
+
}
|
|
41
|
+
interface DocumentationConfig {
|
|
42
|
+
space_key?: string;
|
|
43
|
+
base_url?: string;
|
|
44
|
+
base_path?: string;
|
|
45
|
+
[key: string]: unknown;
|
|
46
|
+
}
|
|
47
|
+
interface DocumentationIntegration {
|
|
48
|
+
provider: DocumentationProvider;
|
|
49
|
+
config?: DocumentationConfig;
|
|
50
|
+
strategy?: AdapterStrategy;
|
|
51
|
+
}
|
|
52
|
+
interface StateConfig {
|
|
53
|
+
space_key?: string;
|
|
54
|
+
base_path?: string;
|
|
55
|
+
bucket?: string;
|
|
56
|
+
[key: string]: unknown;
|
|
57
|
+
}
|
|
58
|
+
interface StateIntegration {
|
|
59
|
+
provider: StateProvider;
|
|
60
|
+
config?: StateConfig;
|
|
61
|
+
strategy?: AdapterStrategy;
|
|
62
|
+
}
|
|
63
|
+
interface IntegrationsConfig {
|
|
64
|
+
issue_tracker?: IssueTrackerIntegration;
|
|
65
|
+
git?: GitIntegration;
|
|
66
|
+
documentation?: DocumentationIntegration;
|
|
67
|
+
state?: StateIntegration;
|
|
68
|
+
}
|
|
69
|
+
interface QualityGate {
|
|
70
|
+
command: string;
|
|
71
|
+
required?: boolean;
|
|
72
|
+
}
|
|
73
|
+
type QualityGatesConfig = Record<string, QualityGate>;
|
|
74
|
+
interface TechStackConfig {
|
|
75
|
+
primary_language?: string;
|
|
76
|
+
frameworks?: string[];
|
|
77
|
+
cloud?: string;
|
|
78
|
+
[key: string]: unknown;
|
|
79
|
+
}
|
|
80
|
+
interface McpConfig {
|
|
81
|
+
expose_adapters?: boolean;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Cache configuration
|
|
85
|
+
*/
|
|
86
|
+
interface CacheConfig {
|
|
87
|
+
/**
|
|
88
|
+
* Enable caching (default: true)
|
|
89
|
+
*/
|
|
90
|
+
enabled?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Cache directory path (default: .coreai/cache)
|
|
93
|
+
*/
|
|
94
|
+
path?: string;
|
|
95
|
+
/**
|
|
96
|
+
* Default TTL in seconds (default: 3600)
|
|
97
|
+
*/
|
|
98
|
+
ttl?: number;
|
|
99
|
+
/**
|
|
100
|
+
* Maximum cache size in bytes (default: 100MB)
|
|
101
|
+
*/
|
|
102
|
+
max_size?: number;
|
|
103
|
+
/**
|
|
104
|
+
* Maximum number of entries (default: 1000)
|
|
105
|
+
*/
|
|
106
|
+
max_entries?: number;
|
|
107
|
+
/**
|
|
108
|
+
* Enable automatic cleanup of expired entries (default: true)
|
|
109
|
+
*/
|
|
110
|
+
auto_cleanup?: boolean;
|
|
111
|
+
}
|
|
112
|
+
interface CoreAIConfig {
|
|
113
|
+
version?: '1.0';
|
|
114
|
+
project?: ProjectConfig;
|
|
115
|
+
team?: TeamConfig;
|
|
116
|
+
integrations?: IntegrationsConfig;
|
|
117
|
+
quality_gates?: QualityGatesConfig;
|
|
118
|
+
tech_stack?: TechStackConfig;
|
|
119
|
+
mcp?: McpConfig;
|
|
120
|
+
cache?: CacheConfig;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Configuration with all defaults applied
|
|
124
|
+
*/
|
|
125
|
+
interface ResolvedCoreAIConfig extends CoreAIConfig {
|
|
126
|
+
project: Required<ProjectConfig>;
|
|
127
|
+
team: Required<TeamConfig>;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Configuration Loader
|
|
132
|
+
*
|
|
133
|
+
* Handles config file discovery, parsing, validation, and defaults.
|
|
134
|
+
*/
|
|
135
|
+
|
|
136
|
+
declare class ConfigError extends Error {
|
|
137
|
+
readonly code: ConfigErrorCode;
|
|
138
|
+
readonly details?: unknown | undefined;
|
|
139
|
+
constructor(message: string, code: ConfigErrorCode, details?: unknown | undefined);
|
|
140
|
+
}
|
|
141
|
+
type ConfigErrorCode = 'NOT_FOUND' | 'PARSE_ERROR' | 'VALIDATION_ERROR' | 'READ_ERROR';
|
|
142
|
+
/**
|
|
143
|
+
* Find the config file by walking up the directory tree
|
|
144
|
+
*/
|
|
145
|
+
declare function findConfigFile(startDir?: string): string | null;
|
|
146
|
+
/**
|
|
147
|
+
* Load and validate configuration from a file path
|
|
148
|
+
*/
|
|
149
|
+
declare function loadConfigFromFile(filePath: string): ResolvedCoreAIConfig;
|
|
150
|
+
/**
|
|
151
|
+
* Load configuration by searching for config file
|
|
152
|
+
*/
|
|
153
|
+
declare function loadConfig(startDir?: string): ResolvedCoreAIConfig;
|
|
154
|
+
/**
|
|
155
|
+
* Check if a config file exists in the given directory or parent directories
|
|
156
|
+
*/
|
|
157
|
+
declare function configExists(startDir?: string): boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Get the path to the config file, or null if not found
|
|
160
|
+
*/
|
|
161
|
+
declare function getConfigPath(startDir?: string): string | null;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* CoreAI Agent Types
|
|
165
|
+
*
|
|
166
|
+
* TypeScript types corresponding to the JSON schema at schemas/agent.schema.json
|
|
167
|
+
*/
|
|
168
|
+
type AgentType = 'ic-engineer' | 'manager' | 'specialist' | 'coordinator';
|
|
169
|
+
type WorkflowType = 'ticket-implementation' | 'bug-investigation' | 'code-review' | 'planning-estimation';
|
|
170
|
+
interface AgentExpertise {
|
|
171
|
+
primary?: string[];
|
|
172
|
+
tech_stack?: string;
|
|
173
|
+
[key: string]: unknown;
|
|
174
|
+
}
|
|
175
|
+
interface AgentPrinciples {
|
|
176
|
+
code_quality?: string[];
|
|
177
|
+
testing?: string[];
|
|
178
|
+
security?: string[];
|
|
179
|
+
performance?: string[];
|
|
180
|
+
[key: string]: string[] | undefined;
|
|
181
|
+
}
|
|
182
|
+
interface AgentBehaviors {
|
|
183
|
+
workflow?: WorkflowType;
|
|
184
|
+
quality_gates?: string;
|
|
185
|
+
[key: string]: unknown;
|
|
186
|
+
}
|
|
187
|
+
interface AgentContextSources {
|
|
188
|
+
shared?: string[];
|
|
189
|
+
personal?: string[];
|
|
190
|
+
}
|
|
191
|
+
interface AgentCommunication {
|
|
192
|
+
inbox?: string;
|
|
193
|
+
outbox?: string;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Raw agent definition as loaded from YAML (before variable resolution)
|
|
197
|
+
*/
|
|
198
|
+
interface AgentDefinition {
|
|
199
|
+
role: string;
|
|
200
|
+
type: AgentType;
|
|
201
|
+
display_name: string;
|
|
202
|
+
description: string;
|
|
203
|
+
responsibilities?: string[];
|
|
204
|
+
expertise?: AgentExpertise;
|
|
205
|
+
skills?: string[];
|
|
206
|
+
principles?: AgentPrinciples;
|
|
207
|
+
behaviors?: AgentBehaviors;
|
|
208
|
+
context_sources?: AgentContextSources;
|
|
209
|
+
communication?: AgentCommunication;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Agent definition after variable resolution
|
|
213
|
+
*/
|
|
214
|
+
interface ResolvedAgentDefinition extends AgentDefinition {
|
|
215
|
+
expertise?: AgentExpertise & {
|
|
216
|
+
tech_stack?: Record<string, unknown>;
|
|
217
|
+
};
|
|
218
|
+
behaviors?: AgentBehaviors & {
|
|
219
|
+
quality_gates?: Record<string, unknown>;
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Agent source location
|
|
224
|
+
*/
|
|
225
|
+
type AgentSource = 'core' | 'custom' | 'override';
|
|
226
|
+
/**
|
|
227
|
+
* Agent metadata including source information
|
|
228
|
+
*/
|
|
229
|
+
interface AgentMetadata {
|
|
230
|
+
definition: AgentDefinition;
|
|
231
|
+
source: AgentSource;
|
|
232
|
+
filePath: string;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Agent Loader
|
|
237
|
+
*
|
|
238
|
+
* Handles loading and validating agent YAML definitions.
|
|
239
|
+
*/
|
|
240
|
+
|
|
241
|
+
declare class AgentError extends Error {
|
|
242
|
+
readonly code: AgentErrorCode;
|
|
243
|
+
readonly details?: unknown | undefined;
|
|
244
|
+
constructor(message: string, code: AgentErrorCode, details?: unknown | undefined);
|
|
245
|
+
}
|
|
246
|
+
type AgentErrorCode = 'NOT_FOUND' | 'PARSE_ERROR' | 'VALIDATION_ERROR' | 'READ_ERROR';
|
|
247
|
+
/**
|
|
248
|
+
* Parse YAML content into an agent definition
|
|
249
|
+
*/
|
|
250
|
+
declare function parseAgentYaml(content: string, filePath?: string): unknown;
|
|
251
|
+
/**
|
|
252
|
+
* Validate parsed YAML against agent schema
|
|
253
|
+
*/
|
|
254
|
+
declare function validateAgentDefinition(agent: unknown): AgentDefinition;
|
|
255
|
+
/**
|
|
256
|
+
* Load and validate an agent definition from a file
|
|
257
|
+
*/
|
|
258
|
+
declare function loadAgentFromFile(filePath: string): AgentDefinition;
|
|
259
|
+
/**
|
|
260
|
+
* Load all agents from a directory
|
|
261
|
+
*/
|
|
262
|
+
declare function loadAgentsFromDirectory(dir: string, source: AgentSource): Map<string, AgentMetadata>;
|
|
263
|
+
/**
|
|
264
|
+
* Get the agent role name from a filename
|
|
265
|
+
*/
|
|
266
|
+
declare function getRoleFromFilename(filePath: string): string;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Variable Resolution System
|
|
270
|
+
*
|
|
271
|
+
* Resolves variable placeholders in agent definitions.
|
|
272
|
+
* Supports: ${config.*}, ${agent.*}, ${remote.*}
|
|
273
|
+
*/
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Context for variable resolution
|
|
277
|
+
*/
|
|
278
|
+
interface ResolutionContext {
|
|
279
|
+
config?: CoreAIConfig;
|
|
280
|
+
agent?: AgentDefinition;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Options for variable resolution
|
|
284
|
+
*/
|
|
285
|
+
interface ResolutionOptions {
|
|
286
|
+
/**
|
|
287
|
+
* If true, throw an error for unresolved variables.
|
|
288
|
+
* If false, leave unresolved variables as-is.
|
|
289
|
+
* Default: false
|
|
290
|
+
*/
|
|
291
|
+
strict?: boolean;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Error thrown when variable resolution fails
|
|
295
|
+
*/
|
|
296
|
+
declare class ResolutionError extends Error {
|
|
297
|
+
readonly variable: string;
|
|
298
|
+
readonly path?: string | undefined;
|
|
299
|
+
constructor(message: string, variable: string, path?: string | undefined);
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Resolve all variables in a string
|
|
303
|
+
*/
|
|
304
|
+
declare function resolveString(input: string, context: ResolutionContext, options?: ResolutionOptions): string;
|
|
305
|
+
/**
|
|
306
|
+
* Check if a string contains variable placeholders
|
|
307
|
+
*/
|
|
308
|
+
declare function hasVariables(input: string): boolean;
|
|
309
|
+
/**
|
|
310
|
+
* Extract all variable references from a string
|
|
311
|
+
*/
|
|
312
|
+
declare function extractVariables$1(input: string): string[];
|
|
313
|
+
/**
|
|
314
|
+
* Recursively resolve all variables in an object
|
|
315
|
+
*/
|
|
316
|
+
declare function resolveObject<T>(obj: T, context: ResolutionContext, options?: ResolutionOptions): T;
|
|
317
|
+
/**
|
|
318
|
+
* Resolve all variables in an agent definition
|
|
319
|
+
*/
|
|
320
|
+
declare function resolveAgentDefinition(agent: AgentDefinition, config?: CoreAIConfig, options?: ResolutionOptions): AgentDefinition;
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Agent Compiler
|
|
324
|
+
*
|
|
325
|
+
* Transforms YAML agent definitions into Claude-compatible Markdown files.
|
|
326
|
+
*/
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Options for compiling agents
|
|
330
|
+
*/
|
|
331
|
+
interface CompileOptions {
|
|
332
|
+
/**
|
|
333
|
+
* Output directory for compiled markdown files.
|
|
334
|
+
* Default: .claude/agents
|
|
335
|
+
*/
|
|
336
|
+
outputDir?: string;
|
|
337
|
+
/**
|
|
338
|
+
* Core agents directory (built-in agents).
|
|
339
|
+
* Default: uses package's agents/ directory
|
|
340
|
+
*/
|
|
341
|
+
coreAgentsDir?: string;
|
|
342
|
+
/**
|
|
343
|
+
* Custom agents directory (project-specific agents).
|
|
344
|
+
* Default: coreai/agents in project root
|
|
345
|
+
*/
|
|
346
|
+
customAgentsDir?: string;
|
|
347
|
+
/**
|
|
348
|
+
* Project root directory.
|
|
349
|
+
* Default: process.cwd()
|
|
350
|
+
*/
|
|
351
|
+
projectRoot?: string;
|
|
352
|
+
/**
|
|
353
|
+
* Filter function to select which agents to compile.
|
|
354
|
+
* Returns true to include the agent, false to exclude.
|
|
355
|
+
*/
|
|
356
|
+
filter?: (agent: AgentDefinition) => boolean;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Result of compiling agents
|
|
360
|
+
*/
|
|
361
|
+
interface CompileResult {
|
|
362
|
+
/**
|
|
363
|
+
* Successfully compiled agents
|
|
364
|
+
*/
|
|
365
|
+
compiled: {
|
|
366
|
+
role: string;
|
|
367
|
+
source: AgentSource;
|
|
368
|
+
outputPath: string;
|
|
369
|
+
}[];
|
|
370
|
+
/**
|
|
371
|
+
* Agents that failed to compile
|
|
372
|
+
*/
|
|
373
|
+
errors: {
|
|
374
|
+
role: string;
|
|
375
|
+
source: AgentSource;
|
|
376
|
+
error: string;
|
|
377
|
+
}[];
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Generate markdown content from a resolved agent definition
|
|
381
|
+
*/
|
|
382
|
+
declare function generateAgentMarkdown(agent: AgentDefinition): string;
|
|
383
|
+
/**
|
|
384
|
+
* Compile a single agent to markdown
|
|
385
|
+
*/
|
|
386
|
+
declare function compileAgent(agent: AgentDefinition, config?: CoreAIConfig): string;
|
|
387
|
+
/**
|
|
388
|
+
* Load all agents from core and custom directories
|
|
389
|
+
*/
|
|
390
|
+
declare function loadAllAgents(options?: CompileOptions): Map<string, AgentMetadata>;
|
|
391
|
+
/**
|
|
392
|
+
* Filter agents based on team configuration
|
|
393
|
+
*/
|
|
394
|
+
declare function filterAgentsByTeam(agents: Map<string, AgentMetadata>, config?: CoreAIConfig): Map<string, AgentMetadata>;
|
|
395
|
+
/**
|
|
396
|
+
* Compile all agents and write to output directory
|
|
397
|
+
*/
|
|
398
|
+
declare function compileAgents(config?: CoreAIConfig, options?: CompileOptions): CompileResult;
|
|
399
|
+
/**
|
|
400
|
+
* Get the default core agents directory
|
|
401
|
+
*/
|
|
402
|
+
declare function getCoreAgentsDir(): string;
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Adapter Types
|
|
406
|
+
*
|
|
407
|
+
* Common types used across all adapters.
|
|
408
|
+
*/
|
|
409
|
+
/**
|
|
410
|
+
* The type of adapter
|
|
411
|
+
*/
|
|
412
|
+
type AdapterType = 'issue_tracker' | 'git' | 'documentation' | 'state';
|
|
413
|
+
/**
|
|
414
|
+
* How the adapter connects to the service
|
|
415
|
+
*/
|
|
416
|
+
type AdapterImplementation = 'mcp' | 'native' | 'mock';
|
|
417
|
+
/**
|
|
418
|
+
* Base metadata for all adapters
|
|
419
|
+
*/
|
|
420
|
+
interface AdapterInfo {
|
|
421
|
+
/**
|
|
422
|
+
* Type of adapter
|
|
423
|
+
*/
|
|
424
|
+
type: AdapterType;
|
|
425
|
+
/**
|
|
426
|
+
* Provider name (e.g., 'github', 'jira', 'confluence')
|
|
427
|
+
*/
|
|
428
|
+
provider: string;
|
|
429
|
+
/**
|
|
430
|
+
* How this adapter is implemented
|
|
431
|
+
*/
|
|
432
|
+
implementation: AdapterImplementation;
|
|
433
|
+
/**
|
|
434
|
+
* Whether the adapter is currently connected/available
|
|
435
|
+
*/
|
|
436
|
+
connected: boolean;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Common issue status values
|
|
440
|
+
*/
|
|
441
|
+
type IssueStatus = 'backlog' | 'todo' | 'in_progress' | 'in_review' | 'done' | 'closed' | string;
|
|
442
|
+
/**
|
|
443
|
+
* Common pull request status values
|
|
444
|
+
*/
|
|
445
|
+
type PullRequestStatus = 'open' | 'merged' | 'closed' | 'draft';
|
|
446
|
+
/**
|
|
447
|
+
* Common review decision values
|
|
448
|
+
*/
|
|
449
|
+
type ReviewDecision = 'approve' | 'request_changes' | 'comment';
|
|
450
|
+
/**
|
|
451
|
+
* Issue data structure
|
|
452
|
+
*/
|
|
453
|
+
interface Issue {
|
|
454
|
+
id: string;
|
|
455
|
+
key: string;
|
|
456
|
+
title: string;
|
|
457
|
+
description?: string;
|
|
458
|
+
status: IssueStatus;
|
|
459
|
+
assignee?: string;
|
|
460
|
+
reporter?: string;
|
|
461
|
+
labels?: string[];
|
|
462
|
+
priority?: string;
|
|
463
|
+
created_at?: string;
|
|
464
|
+
updated_at?: string;
|
|
465
|
+
url?: string;
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Data for creating an issue
|
|
469
|
+
*/
|
|
470
|
+
interface CreateIssueData {
|
|
471
|
+
title: string;
|
|
472
|
+
description?: string;
|
|
473
|
+
assignee?: string;
|
|
474
|
+
labels?: string[];
|
|
475
|
+
priority?: string;
|
|
476
|
+
type?: string;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Data for updating an issue
|
|
480
|
+
*/
|
|
481
|
+
interface UpdateIssueData {
|
|
482
|
+
title?: string;
|
|
483
|
+
description?: string;
|
|
484
|
+
assignee?: string;
|
|
485
|
+
labels?: string[];
|
|
486
|
+
priority?: string;
|
|
487
|
+
status?: IssueStatus;
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Query parameters for listing issues
|
|
491
|
+
*/
|
|
492
|
+
interface IssueQuery {
|
|
493
|
+
assignee?: string;
|
|
494
|
+
status?: IssueStatus | IssueStatus[];
|
|
495
|
+
labels?: string[];
|
|
496
|
+
limit?: number;
|
|
497
|
+
offset?: number;
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Pull request data structure
|
|
501
|
+
*/
|
|
502
|
+
interface PullRequest {
|
|
503
|
+
id: string;
|
|
504
|
+
number: number;
|
|
505
|
+
title: string;
|
|
506
|
+
description?: string;
|
|
507
|
+
status: PullRequestStatus;
|
|
508
|
+
author?: string;
|
|
509
|
+
source_branch: string;
|
|
510
|
+
target_branch: string;
|
|
511
|
+
created_at?: string;
|
|
512
|
+
updated_at?: string;
|
|
513
|
+
merged_at?: string;
|
|
514
|
+
url?: string;
|
|
515
|
+
reviewers?: string[];
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Data for creating a pull request
|
|
519
|
+
*/
|
|
520
|
+
interface CreatePullRequestData {
|
|
521
|
+
title: string;
|
|
522
|
+
description?: string;
|
|
523
|
+
source_branch: string;
|
|
524
|
+
target_branch: string;
|
|
525
|
+
draft?: boolean;
|
|
526
|
+
reviewers?: string[];
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Query parameters for listing pull requests
|
|
530
|
+
*/
|
|
531
|
+
interface PullRequestQuery {
|
|
532
|
+
status?: PullRequestStatus | PullRequestStatus[];
|
|
533
|
+
author?: string;
|
|
534
|
+
limit?: number;
|
|
535
|
+
offset?: number;
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* Review data for a pull request
|
|
539
|
+
*/
|
|
540
|
+
interface Review {
|
|
541
|
+
id: string;
|
|
542
|
+
pull_request_id: string;
|
|
543
|
+
author: string;
|
|
544
|
+
decision: ReviewDecision;
|
|
545
|
+
body?: string;
|
|
546
|
+
created_at?: string;
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* Data for creating a review
|
|
550
|
+
*/
|
|
551
|
+
interface CreateReviewData {
|
|
552
|
+
decision: ReviewDecision;
|
|
553
|
+
body?: string;
|
|
554
|
+
comments?: ReviewComment[];
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Comment on a specific line in a review
|
|
558
|
+
*/
|
|
559
|
+
interface ReviewComment {
|
|
560
|
+
path: string;
|
|
561
|
+
line: number;
|
|
562
|
+
body: string;
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Documentation page data structure
|
|
566
|
+
*/
|
|
567
|
+
interface DocumentationPage {
|
|
568
|
+
id: string;
|
|
569
|
+
title: string;
|
|
570
|
+
content?: string;
|
|
571
|
+
path?: string;
|
|
572
|
+
url?: string;
|
|
573
|
+
parent_id?: string;
|
|
574
|
+
created_at?: string;
|
|
575
|
+
updated_at?: string;
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* Query parameters for searching documentation
|
|
579
|
+
*/
|
|
580
|
+
interface DocumentationQuery {
|
|
581
|
+
query: string;
|
|
582
|
+
space?: string;
|
|
583
|
+
limit?: number;
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* File/directory entry for state provider
|
|
587
|
+
*/
|
|
588
|
+
interface StateEntry {
|
|
589
|
+
path: string;
|
|
590
|
+
name: string;
|
|
591
|
+
type: 'file' | 'directory';
|
|
592
|
+
size?: number;
|
|
593
|
+
modified_at?: string;
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* Options for state operations
|
|
597
|
+
*/
|
|
598
|
+
interface StateOptions {
|
|
599
|
+
/**
|
|
600
|
+
* Create parent directories if they don't exist
|
|
601
|
+
*/
|
|
602
|
+
recursive?: boolean;
|
|
603
|
+
/**
|
|
604
|
+
* Encoding for text content
|
|
605
|
+
*/
|
|
606
|
+
encoding?: BufferEncoding;
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* Adapter error with context
|
|
610
|
+
*/
|
|
611
|
+
declare class AdapterError extends Error {
|
|
612
|
+
readonly code: AdapterErrorCode;
|
|
613
|
+
readonly adapter?: AdapterInfo;
|
|
614
|
+
constructor(message: string, code: AdapterErrorCode, adapter?: AdapterInfo, cause?: Error);
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
617
|
+
* Error codes for adapter operations
|
|
618
|
+
*/
|
|
619
|
+
type AdapterErrorCode = 'not_found' | 'unauthorized' | 'forbidden' | 'rate_limited' | 'network_error' | 'invalid_request' | 'not_implemented' | 'connection_failed' | 'provider_error' | 'operation_failed' | 'invalid_operation' | 'not_connected' | 'invalid_config';
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* Adapter Interfaces
|
|
623
|
+
*
|
|
624
|
+
* Abstract interfaces for integration adapters that can be implemented
|
|
625
|
+
* via MCP servers or native API clients.
|
|
626
|
+
*/
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* Base interface that all adapters implement
|
|
630
|
+
*/
|
|
631
|
+
interface BaseAdapter {
|
|
632
|
+
/**
|
|
633
|
+
* Get adapter metadata
|
|
634
|
+
*/
|
|
635
|
+
getInfo(): AdapterInfo;
|
|
636
|
+
/**
|
|
637
|
+
* Check if the adapter is connected and available
|
|
638
|
+
*/
|
|
639
|
+
isConnected(): boolean;
|
|
640
|
+
/**
|
|
641
|
+
* Connect to the service (if needed)
|
|
642
|
+
*/
|
|
643
|
+
connect(): Promise<void>;
|
|
644
|
+
/**
|
|
645
|
+
* Disconnect from the service
|
|
646
|
+
*/
|
|
647
|
+
disconnect(): Promise<void>;
|
|
648
|
+
}
|
|
649
|
+
/**
|
|
650
|
+
* Issue Tracker Adapter
|
|
651
|
+
*
|
|
652
|
+
* For integrating with issue tracking systems like Jira, Linear, GitHub Issues, etc.
|
|
653
|
+
*/
|
|
654
|
+
interface IssueTrackerAdapter extends BaseAdapter {
|
|
655
|
+
/**
|
|
656
|
+
* Get a single issue by ID or key
|
|
657
|
+
*/
|
|
658
|
+
getIssue(idOrKey: string): Promise<Issue>;
|
|
659
|
+
/**
|
|
660
|
+
* List issues matching the query
|
|
661
|
+
*/
|
|
662
|
+
listIssues(query?: IssueQuery): Promise<Issue[]>;
|
|
663
|
+
/**
|
|
664
|
+
* Create a new issue
|
|
665
|
+
*/
|
|
666
|
+
createIssue(data: CreateIssueData): Promise<Issue>;
|
|
667
|
+
/**
|
|
668
|
+
* Update an existing issue
|
|
669
|
+
*/
|
|
670
|
+
updateIssue(idOrKey: string, data: UpdateIssueData): Promise<Issue>;
|
|
671
|
+
/**
|
|
672
|
+
* Transition an issue to a new status
|
|
673
|
+
*/
|
|
674
|
+
transitionIssue(idOrKey: string, status: IssueStatus): Promise<Issue>;
|
|
675
|
+
/**
|
|
676
|
+
* Add a comment to an issue
|
|
677
|
+
*/
|
|
678
|
+
addComment(idOrKey: string, comment: string): Promise<void>;
|
|
679
|
+
/**
|
|
680
|
+
* Get available transitions/statuses for an issue
|
|
681
|
+
*/
|
|
682
|
+
getTransitions?(idOrKey: string): Promise<IssueStatus[]>;
|
|
683
|
+
/**
|
|
684
|
+
* Assign an issue to a user
|
|
685
|
+
*/
|
|
686
|
+
assignIssue?(idOrKey: string, assignee: string): Promise<Issue>;
|
|
687
|
+
/**
|
|
688
|
+
* Link two issues together
|
|
689
|
+
*/
|
|
690
|
+
linkIssues?(sourceKey: string, targetKey: string, linkType: string): Promise<void>;
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* Git Provider Adapter
|
|
694
|
+
*
|
|
695
|
+
* For integrating with Git hosting services like GitHub, GitLab, Bitbucket, etc.
|
|
696
|
+
*/
|
|
697
|
+
interface GitProviderAdapter extends BaseAdapter {
|
|
698
|
+
/**
|
|
699
|
+
* Get a pull request by ID or number
|
|
700
|
+
*/
|
|
701
|
+
getPullRequest(idOrNumber: string | number): Promise<PullRequest>;
|
|
702
|
+
/**
|
|
703
|
+
* List pull requests matching the query
|
|
704
|
+
*/
|
|
705
|
+
listPullRequests(query?: PullRequestQuery): Promise<PullRequest[]>;
|
|
706
|
+
/**
|
|
707
|
+
* Create a new pull request
|
|
708
|
+
*/
|
|
709
|
+
createPullRequest(data: CreatePullRequestData): Promise<PullRequest>;
|
|
710
|
+
/**
|
|
711
|
+
* Update a pull request
|
|
712
|
+
*/
|
|
713
|
+
updatePullRequest?(idOrNumber: string | number, data: Partial<CreatePullRequestData>): Promise<PullRequest>;
|
|
714
|
+
/**
|
|
715
|
+
* Merge a pull request
|
|
716
|
+
*/
|
|
717
|
+
mergePullRequest(idOrNumber: string | number, options?: {
|
|
718
|
+
method?: 'merge' | 'squash' | 'rebase';
|
|
719
|
+
message?: string;
|
|
720
|
+
}): Promise<void>;
|
|
721
|
+
/**
|
|
722
|
+
* Close a pull request without merging
|
|
723
|
+
*/
|
|
724
|
+
closePullRequest(idOrNumber: string | number): Promise<void>;
|
|
725
|
+
/**
|
|
726
|
+
* Add a review to a pull request
|
|
727
|
+
*/
|
|
728
|
+
addReview(idOrNumber: string | number, review: CreateReviewData): Promise<Review>;
|
|
729
|
+
/**
|
|
730
|
+
* Get reviews for a pull request
|
|
731
|
+
*/
|
|
732
|
+
getReviews?(idOrNumber: string | number): Promise<Review[]>;
|
|
733
|
+
/**
|
|
734
|
+
* Request reviewers for a pull request
|
|
735
|
+
*/
|
|
736
|
+
requestReviewers?(idOrNumber: string | number, reviewers: string[]): Promise<void>;
|
|
737
|
+
/**
|
|
738
|
+
* Add a comment to a pull request
|
|
739
|
+
*/
|
|
740
|
+
addPullRequestComment?(idOrNumber: string | number, comment: string): Promise<void>;
|
|
741
|
+
/**
|
|
742
|
+
* Get the diff for a pull request
|
|
743
|
+
*/
|
|
744
|
+
getPullRequestDiff?(idOrNumber: string | number): Promise<string>;
|
|
745
|
+
/**
|
|
746
|
+
* Get files changed in a pull request
|
|
747
|
+
*/
|
|
748
|
+
getPullRequestFiles?(idOrNumber: string | number): Promise<string[]>;
|
|
749
|
+
}
|
|
750
|
+
/**
|
|
751
|
+
* Documentation Provider Adapter
|
|
752
|
+
*
|
|
753
|
+
* For integrating with documentation systems like Confluence, Notion, GitHub Wiki, etc.
|
|
754
|
+
*/
|
|
755
|
+
interface DocumentationProviderAdapter extends BaseAdapter {
|
|
756
|
+
/**
|
|
757
|
+
* Get a documentation page by ID
|
|
758
|
+
*/
|
|
759
|
+
getPage(id: string): Promise<DocumentationPage>;
|
|
760
|
+
/**
|
|
761
|
+
* Get page content (may be separate from metadata in some systems)
|
|
762
|
+
*/
|
|
763
|
+
getPageContent(id: string): Promise<string>;
|
|
764
|
+
/**
|
|
765
|
+
* Search for documentation pages
|
|
766
|
+
*/
|
|
767
|
+
searchPages(query: DocumentationQuery): Promise<DocumentationPage[]>;
|
|
768
|
+
/**
|
|
769
|
+
* List pages in a space or parent
|
|
770
|
+
*/
|
|
771
|
+
listPages?(parentId?: string): Promise<DocumentationPage[]>;
|
|
772
|
+
/**
|
|
773
|
+
* Create a new page
|
|
774
|
+
*/
|
|
775
|
+
createPage?(title: string, content: string, parentId?: string): Promise<DocumentationPage>;
|
|
776
|
+
/**
|
|
777
|
+
* Update an existing page
|
|
778
|
+
*/
|
|
779
|
+
updatePage?(id: string, title?: string, content?: string): Promise<DocumentationPage>;
|
|
780
|
+
}
|
|
781
|
+
/**
|
|
782
|
+
* State Provider Adapter
|
|
783
|
+
*
|
|
784
|
+
* For managing local state like KnowledgeLibrary, which may be stored
|
|
785
|
+
* on the filesystem, in a cloud bucket, or in a documentation system.
|
|
786
|
+
*/
|
|
787
|
+
interface StateProviderAdapter extends BaseAdapter {
|
|
788
|
+
/**
|
|
789
|
+
* Read content from a path
|
|
790
|
+
*/
|
|
791
|
+
read(path: string, options?: StateOptions): Promise<string>;
|
|
792
|
+
/**
|
|
793
|
+
* Write content to a path
|
|
794
|
+
*/
|
|
795
|
+
write(path: string, content: string, options?: StateOptions): Promise<void>;
|
|
796
|
+
/**
|
|
797
|
+
* Check if a path exists
|
|
798
|
+
*/
|
|
799
|
+
exists(path: string): Promise<boolean>;
|
|
800
|
+
/**
|
|
801
|
+
* List entries in a directory
|
|
802
|
+
*/
|
|
803
|
+
list(path: string): Promise<StateEntry[]>;
|
|
804
|
+
/**
|
|
805
|
+
* Delete a file or directory
|
|
806
|
+
*/
|
|
807
|
+
delete(path: string, options?: StateOptions): Promise<void>;
|
|
808
|
+
/**
|
|
809
|
+
* Create a directory
|
|
810
|
+
*/
|
|
811
|
+
mkdir?(path: string, options?: StateOptions): Promise<void>;
|
|
812
|
+
/**
|
|
813
|
+
* Move/rename a file or directory
|
|
814
|
+
*/
|
|
815
|
+
move?(source: string, destination: string): Promise<void>;
|
|
816
|
+
/**
|
|
817
|
+
* Copy a file or directory
|
|
818
|
+
*/
|
|
819
|
+
copy?(source: string, destination: string): Promise<void>;
|
|
820
|
+
}
|
|
821
|
+
/**
|
|
822
|
+
* Union type of all adapter types
|
|
823
|
+
*/
|
|
824
|
+
type Adapter = IssueTrackerAdapter | GitProviderAdapter | DocumentationProviderAdapter | StateProviderAdapter;
|
|
825
|
+
|
|
826
|
+
/**
|
|
827
|
+
* Adapter Factory
|
|
828
|
+
*
|
|
829
|
+
* Creates and manages adapter instances based on configuration.
|
|
830
|
+
*/
|
|
831
|
+
|
|
832
|
+
/**
|
|
833
|
+
* Options for creating an adapter
|
|
834
|
+
*/
|
|
835
|
+
interface AdapterFactoryOptions {
|
|
836
|
+
/**
|
|
837
|
+
* Override the strategy from config
|
|
838
|
+
*/
|
|
839
|
+
strategy?: AdapterStrategy;
|
|
840
|
+
/**
|
|
841
|
+
* Force a specific implementation
|
|
842
|
+
*/
|
|
843
|
+
implementation?: AdapterImplementation;
|
|
844
|
+
}
|
|
845
|
+
/**
|
|
846
|
+
* Adapter Factory
|
|
847
|
+
*
|
|
848
|
+
* Creates adapter instances based on configuration and available implementations.
|
|
849
|
+
*/
|
|
850
|
+
declare class AdapterFactory {
|
|
851
|
+
private config;
|
|
852
|
+
private adapters;
|
|
853
|
+
/**
|
|
854
|
+
* Registry of adapter creators by type
|
|
855
|
+
*/
|
|
856
|
+
private creators;
|
|
857
|
+
constructor(config: CoreAIConfig);
|
|
858
|
+
/**
|
|
859
|
+
* Register an adapter creator
|
|
860
|
+
*/
|
|
861
|
+
registerCreator<T extends AdapterType>(type: T, implementation: AdapterImplementation, creator: (config: CoreAIConfig) => Promise<Adapter>): void;
|
|
862
|
+
/**
|
|
863
|
+
* Get an issue tracker adapter
|
|
864
|
+
*/
|
|
865
|
+
getIssueTracker(options?: AdapterFactoryOptions): Promise<IssueTrackerAdapter>;
|
|
866
|
+
/**
|
|
867
|
+
* Get a git provider adapter
|
|
868
|
+
*/
|
|
869
|
+
getGitProvider(options?: AdapterFactoryOptions): Promise<GitProviderAdapter>;
|
|
870
|
+
/**
|
|
871
|
+
* Get a documentation provider adapter
|
|
872
|
+
*/
|
|
873
|
+
getDocumentationProvider(options?: AdapterFactoryOptions): Promise<DocumentationProviderAdapter>;
|
|
874
|
+
/**
|
|
875
|
+
* Get a state provider adapter
|
|
876
|
+
*/
|
|
877
|
+
getStateProvider(options?: AdapterFactoryOptions): Promise<StateProviderAdapter>;
|
|
878
|
+
/**
|
|
879
|
+
* Get an adapter by type
|
|
880
|
+
*/
|
|
881
|
+
getAdapter(type: AdapterType, options?: AdapterFactoryOptions): Promise<Adapter>;
|
|
882
|
+
/**
|
|
883
|
+
* Check if an adapter type is configured
|
|
884
|
+
*/
|
|
885
|
+
hasIntegration(type: AdapterType): boolean;
|
|
886
|
+
/**
|
|
887
|
+
* Get information about a configured integration
|
|
888
|
+
*/
|
|
889
|
+
getIntegrationInfo(type: AdapterType): {
|
|
890
|
+
provider: string;
|
|
891
|
+
strategy: AdapterStrategy;
|
|
892
|
+
} | null;
|
|
893
|
+
/**
|
|
894
|
+
* Disconnect and clear all cached adapters
|
|
895
|
+
*/
|
|
896
|
+
disconnectAll(): Promise<void>;
|
|
897
|
+
/**
|
|
898
|
+
* Get the strategy for an adapter type
|
|
899
|
+
*/
|
|
900
|
+
private getStrategy;
|
|
901
|
+
/**
|
|
902
|
+
* Select the implementation based on strategy and availability
|
|
903
|
+
*/
|
|
904
|
+
private selectImplementation;
|
|
905
|
+
/**
|
|
906
|
+
* Create an adapter instance
|
|
907
|
+
*/
|
|
908
|
+
private createAdapter;
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* Create an adapter factory from configuration
|
|
912
|
+
*/
|
|
913
|
+
declare function createAdapterFactory(config: CoreAIConfig): AdapterFactory;
|
|
914
|
+
/**
|
|
915
|
+
* Create adapter info helper
|
|
916
|
+
*/
|
|
917
|
+
declare function createAdapterInfo(type: AdapterType, provider: string, implementation: AdapterImplementation, connected?: boolean): AdapterInfo;
|
|
918
|
+
|
|
919
|
+
/**
|
|
920
|
+
* Cache Types
|
|
921
|
+
*
|
|
922
|
+
* Type definitions for the shared context cache system.
|
|
923
|
+
*/
|
|
924
|
+
/**
|
|
925
|
+
* Source type for cached content
|
|
926
|
+
*/
|
|
927
|
+
type CacheSource = 'confluence' | 'github' | 'notion' | 'local' | 'custom';
|
|
928
|
+
/**
|
|
929
|
+
* Cache entry status
|
|
930
|
+
*/
|
|
931
|
+
type CacheStatus = 'valid' | 'stale' | 'expired' | 'error';
|
|
932
|
+
/**
|
|
933
|
+
* Metadata for a cached entry
|
|
934
|
+
*/
|
|
935
|
+
interface CacheMetadata {
|
|
936
|
+
/**
|
|
937
|
+
* Unique key for this cache entry
|
|
938
|
+
*/
|
|
939
|
+
key: string;
|
|
940
|
+
/**
|
|
941
|
+
* Source provider (e.g., 'confluence', 'github')
|
|
942
|
+
*/
|
|
943
|
+
source: CacheSource;
|
|
944
|
+
/**
|
|
945
|
+
* Original source URL or identifier
|
|
946
|
+
*/
|
|
947
|
+
sourceUrl: string;
|
|
948
|
+
/**
|
|
949
|
+
* When the content was cached
|
|
950
|
+
*/
|
|
951
|
+
cachedAt: string;
|
|
952
|
+
/**
|
|
953
|
+
* When the content expires (ISO date string)
|
|
954
|
+
*/
|
|
955
|
+
expiresAt: string;
|
|
956
|
+
/**
|
|
957
|
+
* ETag or version hash from source (for conditional fetching)
|
|
958
|
+
*/
|
|
959
|
+
etag?: string;
|
|
960
|
+
/**
|
|
961
|
+
* Content hash for integrity checking
|
|
962
|
+
*/
|
|
963
|
+
contentHash: string;
|
|
964
|
+
/**
|
|
965
|
+
* Size in bytes
|
|
966
|
+
*/
|
|
967
|
+
size: number;
|
|
968
|
+
/**
|
|
969
|
+
* Content type (e.g., 'text/markdown', 'application/json')
|
|
970
|
+
*/
|
|
971
|
+
contentType: string;
|
|
972
|
+
/**
|
|
973
|
+
* Original title or name
|
|
974
|
+
*/
|
|
975
|
+
title?: string;
|
|
976
|
+
/**
|
|
977
|
+
* Last modified timestamp from source
|
|
978
|
+
*/
|
|
979
|
+
lastModified?: string;
|
|
980
|
+
/**
|
|
981
|
+
* Custom tags for categorization
|
|
982
|
+
*/
|
|
983
|
+
tags?: string[];
|
|
984
|
+
}
|
|
985
|
+
/**
|
|
986
|
+
* A cached content entry
|
|
987
|
+
*/
|
|
988
|
+
interface CacheEntry<T = string> {
|
|
989
|
+
/**
|
|
990
|
+
* Entry metadata
|
|
991
|
+
*/
|
|
992
|
+
metadata: CacheMetadata;
|
|
993
|
+
/**
|
|
994
|
+
* The cached content
|
|
995
|
+
*/
|
|
996
|
+
content: T;
|
|
997
|
+
}
|
|
998
|
+
/**
|
|
999
|
+
* Options for cache operations
|
|
1000
|
+
*/
|
|
1001
|
+
interface CacheOptions {
|
|
1002
|
+
/**
|
|
1003
|
+
* Time-to-live in seconds (default: 3600 = 1 hour)
|
|
1004
|
+
*/
|
|
1005
|
+
ttl?: number;
|
|
1006
|
+
/**
|
|
1007
|
+
* Force refresh even if cached
|
|
1008
|
+
*/
|
|
1009
|
+
forceRefresh?: boolean;
|
|
1010
|
+
/**
|
|
1011
|
+
* Skip cache and fetch directly
|
|
1012
|
+
*/
|
|
1013
|
+
skipCache?: boolean;
|
|
1014
|
+
/**
|
|
1015
|
+
* Custom tags to apply
|
|
1016
|
+
*/
|
|
1017
|
+
tags?: string[];
|
|
1018
|
+
}
|
|
1019
|
+
/**
|
|
1020
|
+
* Options for listing cache entries
|
|
1021
|
+
*/
|
|
1022
|
+
interface CacheListOptions {
|
|
1023
|
+
/**
|
|
1024
|
+
* Filter by source
|
|
1025
|
+
*/
|
|
1026
|
+
source?: CacheSource;
|
|
1027
|
+
/**
|
|
1028
|
+
* Filter by tag
|
|
1029
|
+
*/
|
|
1030
|
+
tag?: string;
|
|
1031
|
+
/**
|
|
1032
|
+
* Filter by status
|
|
1033
|
+
*/
|
|
1034
|
+
status?: CacheStatus;
|
|
1035
|
+
/**
|
|
1036
|
+
* Maximum entries to return
|
|
1037
|
+
*/
|
|
1038
|
+
limit?: number;
|
|
1039
|
+
}
|
|
1040
|
+
/**
|
|
1041
|
+
* Cache statistics
|
|
1042
|
+
*/
|
|
1043
|
+
interface CacheStats {
|
|
1044
|
+
/**
|
|
1045
|
+
* Total number of entries
|
|
1046
|
+
*/
|
|
1047
|
+
totalEntries: number;
|
|
1048
|
+
/**
|
|
1049
|
+
* Total size in bytes
|
|
1050
|
+
*/
|
|
1051
|
+
totalSize: number;
|
|
1052
|
+
/**
|
|
1053
|
+
* Number of valid entries
|
|
1054
|
+
*/
|
|
1055
|
+
validEntries: number;
|
|
1056
|
+
/**
|
|
1057
|
+
* Number of stale entries
|
|
1058
|
+
*/
|
|
1059
|
+
staleEntries: number;
|
|
1060
|
+
/**
|
|
1061
|
+
* Number of expired entries
|
|
1062
|
+
*/
|
|
1063
|
+
expiredEntries: number;
|
|
1064
|
+
/**
|
|
1065
|
+
* Entries by source
|
|
1066
|
+
*/
|
|
1067
|
+
bySource: Record<CacheSource, number>;
|
|
1068
|
+
/**
|
|
1069
|
+
* Oldest entry timestamp
|
|
1070
|
+
*/
|
|
1071
|
+
oldestEntry?: string;
|
|
1072
|
+
/**
|
|
1073
|
+
* Newest entry timestamp
|
|
1074
|
+
*/
|
|
1075
|
+
newestEntry?: string;
|
|
1076
|
+
}
|
|
1077
|
+
/**
|
|
1078
|
+
* Result of a sync operation
|
|
1079
|
+
*/
|
|
1080
|
+
interface SyncResult {
|
|
1081
|
+
/**
|
|
1082
|
+
* Number of entries added
|
|
1083
|
+
*/
|
|
1084
|
+
added: number;
|
|
1085
|
+
/**
|
|
1086
|
+
* Number of entries updated
|
|
1087
|
+
*/
|
|
1088
|
+
updated: number;
|
|
1089
|
+
/**
|
|
1090
|
+
* Number of entries removed
|
|
1091
|
+
*/
|
|
1092
|
+
removed: number;
|
|
1093
|
+
/**
|
|
1094
|
+
* Number of entries that failed to sync
|
|
1095
|
+
*/
|
|
1096
|
+
failed: number;
|
|
1097
|
+
/**
|
|
1098
|
+
* Error messages for failed entries
|
|
1099
|
+
*/
|
|
1100
|
+
errors: {
|
|
1101
|
+
key: string;
|
|
1102
|
+
error: string;
|
|
1103
|
+
}[];
|
|
1104
|
+
/**
|
|
1105
|
+
* Duration of sync in milliseconds
|
|
1106
|
+
*/
|
|
1107
|
+
duration: number;
|
|
1108
|
+
}
|
|
1109
|
+
/**
|
|
1110
|
+
* Cache error codes
|
|
1111
|
+
*/
|
|
1112
|
+
type CacheErrorCode = 'not_found' | 'expired' | 'invalid_key' | 'write_failed' | 'read_failed' | 'fetch_failed' | 'invalid_config' | 'storage_full';
|
|
1113
|
+
/**
|
|
1114
|
+
* Cache-specific error
|
|
1115
|
+
*/
|
|
1116
|
+
declare class CacheError extends Error {
|
|
1117
|
+
readonly code: CacheErrorCode;
|
|
1118
|
+
readonly key?: string | undefined;
|
|
1119
|
+
readonly cause?: Error | undefined;
|
|
1120
|
+
constructor(message: string, code: CacheErrorCode, key?: string | undefined, cause?: Error | undefined);
|
|
1121
|
+
}
|
|
1122
|
+
/**
|
|
1123
|
+
* Default cache directory paths
|
|
1124
|
+
*/
|
|
1125
|
+
declare const CACHE_PATHS: {
|
|
1126
|
+
/**
|
|
1127
|
+
* Root cache directory (relative to project root)
|
|
1128
|
+
*/
|
|
1129
|
+
readonly ROOT: ".coreai/cache";
|
|
1130
|
+
/**
|
|
1131
|
+
* Content storage directory
|
|
1132
|
+
*/
|
|
1133
|
+
readonly CONTENT: ".coreai/cache/content";
|
|
1134
|
+
/**
|
|
1135
|
+
* Metadata storage directory
|
|
1136
|
+
*/
|
|
1137
|
+
readonly METADATA: ".coreai/cache/metadata";
|
|
1138
|
+
/**
|
|
1139
|
+
* Index file for fast lookups
|
|
1140
|
+
*/
|
|
1141
|
+
readonly INDEX: ".coreai/cache/index.json";
|
|
1142
|
+
/**
|
|
1143
|
+
* Lock file for concurrent access
|
|
1144
|
+
*/
|
|
1145
|
+
readonly LOCK: ".coreai/cache/.lock";
|
|
1146
|
+
};
|
|
1147
|
+
/**
|
|
1148
|
+
* Default cache configuration
|
|
1149
|
+
*/
|
|
1150
|
+
declare const DEFAULT_CACHE_CONFIG: {
|
|
1151
|
+
/**
|
|
1152
|
+
* Default TTL in seconds (1 hour)
|
|
1153
|
+
*/
|
|
1154
|
+
readonly ttl: 3600;
|
|
1155
|
+
/**
|
|
1156
|
+
* Maximum cache size in bytes (100MB)
|
|
1157
|
+
*/
|
|
1158
|
+
readonly maxSize: number;
|
|
1159
|
+
/**
|
|
1160
|
+
* Maximum number of entries
|
|
1161
|
+
*/
|
|
1162
|
+
readonly maxEntries: 1000;
|
|
1163
|
+
/**
|
|
1164
|
+
* Enable automatic cleanup of expired entries
|
|
1165
|
+
*/
|
|
1166
|
+
readonly autoCleanup: true;
|
|
1167
|
+
/**
|
|
1168
|
+
* Cleanup interval in seconds (1 hour)
|
|
1169
|
+
*/
|
|
1170
|
+
readonly cleanupInterval: 3600;
|
|
1171
|
+
};
|
|
1172
|
+
|
|
1173
|
+
/**
|
|
1174
|
+
* Cache Interfaces
|
|
1175
|
+
*
|
|
1176
|
+
* Interface definitions for the cache system.
|
|
1177
|
+
*/
|
|
1178
|
+
|
|
1179
|
+
/**
|
|
1180
|
+
* Cache provider interface
|
|
1181
|
+
*
|
|
1182
|
+
* Defines the contract for cache implementations.
|
|
1183
|
+
*/
|
|
1184
|
+
interface CacheProvider {
|
|
1185
|
+
/**
|
|
1186
|
+
* Initialize the cache (create directories, load index)
|
|
1187
|
+
*/
|
|
1188
|
+
initialize(): Promise<void>;
|
|
1189
|
+
/**
|
|
1190
|
+
* Check if the cache is initialized
|
|
1191
|
+
*/
|
|
1192
|
+
isInitialized(): boolean;
|
|
1193
|
+
/**
|
|
1194
|
+
* Get a cached entry by key
|
|
1195
|
+
*
|
|
1196
|
+
* @param key - Cache key
|
|
1197
|
+
* @param options - Optional cache options
|
|
1198
|
+
* @returns The cached entry or null if not found/expired
|
|
1199
|
+
*/
|
|
1200
|
+
get<T = string>(key: string, options?: CacheOptions): Promise<CacheEntry<T> | null>;
|
|
1201
|
+
/**
|
|
1202
|
+
* Get the content only (convenience method)
|
|
1203
|
+
*
|
|
1204
|
+
* @param key - Cache key
|
|
1205
|
+
* @param options - Optional cache options
|
|
1206
|
+
* @returns The cached content or null if not found/expired
|
|
1207
|
+
*/
|
|
1208
|
+
getContent<T = string>(key: string, options?: CacheOptions): Promise<T | null>;
|
|
1209
|
+
/**
|
|
1210
|
+
* Set a cache entry
|
|
1211
|
+
*
|
|
1212
|
+
* @param key - Cache key
|
|
1213
|
+
* @param content - Content to cache
|
|
1214
|
+
* @param metadata - Partial metadata (key and cachedAt will be set automatically)
|
|
1215
|
+
* @param options - Optional cache options
|
|
1216
|
+
*/
|
|
1217
|
+
set<T = string>(key: string, content: T, metadata: Partial<CacheMetadata>, options?: CacheOptions): Promise<void>;
|
|
1218
|
+
/**
|
|
1219
|
+
* Check if a key exists in the cache
|
|
1220
|
+
*
|
|
1221
|
+
* @param key - Cache key
|
|
1222
|
+
* @returns True if the key exists (regardless of expiration)
|
|
1223
|
+
*/
|
|
1224
|
+
has(key: string): Promise<boolean>;
|
|
1225
|
+
/**
|
|
1226
|
+
* Delete a cache entry
|
|
1227
|
+
*
|
|
1228
|
+
* @param key - Cache key
|
|
1229
|
+
* @returns True if the entry was deleted
|
|
1230
|
+
*/
|
|
1231
|
+
delete(key: string): Promise<boolean>;
|
|
1232
|
+
/**
|
|
1233
|
+
* Get the status of a cache entry
|
|
1234
|
+
*
|
|
1235
|
+
* @param key - Cache key
|
|
1236
|
+
* @returns The cache status or null if not found
|
|
1237
|
+
*/
|
|
1238
|
+
getStatus(key: string): Promise<CacheStatus | null>;
|
|
1239
|
+
/**
|
|
1240
|
+
* Get metadata for a cache entry
|
|
1241
|
+
*
|
|
1242
|
+
* @param key - Cache key
|
|
1243
|
+
* @returns The metadata or null if not found
|
|
1244
|
+
*/
|
|
1245
|
+
getMetadata(key: string): Promise<CacheMetadata | null>;
|
|
1246
|
+
/**
|
|
1247
|
+
* Update metadata for a cache entry
|
|
1248
|
+
*
|
|
1249
|
+
* @param key - Cache key
|
|
1250
|
+
* @param metadata - Partial metadata to update
|
|
1251
|
+
*/
|
|
1252
|
+
updateMetadata(key: string, metadata: Partial<CacheMetadata>): Promise<void>;
|
|
1253
|
+
/**
|
|
1254
|
+
* List cache entries
|
|
1255
|
+
*
|
|
1256
|
+
* @param options - List filter options
|
|
1257
|
+
* @returns Array of metadata entries
|
|
1258
|
+
*/
|
|
1259
|
+
list(options?: CacheListOptions): Promise<CacheMetadata[]>;
|
|
1260
|
+
/**
|
|
1261
|
+
* Get cache statistics
|
|
1262
|
+
*/
|
|
1263
|
+
getStats(): Promise<CacheStats>;
|
|
1264
|
+
/**
|
|
1265
|
+
* Clear all cache entries
|
|
1266
|
+
*
|
|
1267
|
+
* @returns Number of entries cleared
|
|
1268
|
+
*/
|
|
1269
|
+
clear(): Promise<number>;
|
|
1270
|
+
/**
|
|
1271
|
+
* Clear expired entries only
|
|
1272
|
+
*
|
|
1273
|
+
* @returns Number of entries cleared
|
|
1274
|
+
*/
|
|
1275
|
+
clearExpired(): Promise<number>;
|
|
1276
|
+
/**
|
|
1277
|
+
* Clear entries by source
|
|
1278
|
+
*
|
|
1279
|
+
* @param source - Source to clear
|
|
1280
|
+
* @returns Number of entries cleared
|
|
1281
|
+
*/
|
|
1282
|
+
clearBySource(source: string): Promise<number>;
|
|
1283
|
+
/**
|
|
1284
|
+
* Clear entries by tag
|
|
1285
|
+
*
|
|
1286
|
+
* @param tag - Tag to clear
|
|
1287
|
+
* @returns Number of entries cleared
|
|
1288
|
+
*/
|
|
1289
|
+
clearByTag(tag: string): Promise<number>;
|
|
1290
|
+
}
|
|
1291
|
+
/**
|
|
1292
|
+
* Remote fetcher interface
|
|
1293
|
+
*
|
|
1294
|
+
* Used by the cache to fetch content from remote sources.
|
|
1295
|
+
*/
|
|
1296
|
+
interface RemoteFetcher {
|
|
1297
|
+
/**
|
|
1298
|
+
* Fetch content from a remote source
|
|
1299
|
+
*
|
|
1300
|
+
* @param url - Source URL or identifier
|
|
1301
|
+
* @param options - Fetch options
|
|
1302
|
+
* @returns The fetched content and metadata
|
|
1303
|
+
*/
|
|
1304
|
+
fetch(url: string, options?: FetchOptions): Promise<{
|
|
1305
|
+
content: string;
|
|
1306
|
+
metadata: Partial<CacheMetadata>;
|
|
1307
|
+
}>;
|
|
1308
|
+
/**
|
|
1309
|
+
* Check if content has changed (conditional fetch)
|
|
1310
|
+
*
|
|
1311
|
+
* @param url - Source URL or identifier
|
|
1312
|
+
* @param etag - Previous ETag
|
|
1313
|
+
* @returns True if content has changed
|
|
1314
|
+
*/
|
|
1315
|
+
hasChanged(url: string, etag?: string): Promise<boolean>;
|
|
1316
|
+
}
|
|
1317
|
+
/**
|
|
1318
|
+
* Options for remote fetching
|
|
1319
|
+
*/
|
|
1320
|
+
interface FetchOptions {
|
|
1321
|
+
/**
|
|
1322
|
+
* Request timeout in milliseconds
|
|
1323
|
+
*/
|
|
1324
|
+
timeout?: number;
|
|
1325
|
+
/**
|
|
1326
|
+
* ETag for conditional fetching
|
|
1327
|
+
*/
|
|
1328
|
+
etag?: string;
|
|
1329
|
+
/**
|
|
1330
|
+
* Custom headers
|
|
1331
|
+
*/
|
|
1332
|
+
headers?: Record<string, string>;
|
|
1333
|
+
}
|
|
1334
|
+
/**
|
|
1335
|
+
* Cache manager interface
|
|
1336
|
+
*
|
|
1337
|
+
* Higher-level interface that combines caching with remote fetching.
|
|
1338
|
+
*/
|
|
1339
|
+
interface CacheManager$1 {
|
|
1340
|
+
/**
|
|
1341
|
+
* Get content with cache-first strategy
|
|
1342
|
+
*
|
|
1343
|
+
* 1. Check cache
|
|
1344
|
+
* 2. If cached and valid, return cached content
|
|
1345
|
+
* 3. If stale or missing, fetch from remote
|
|
1346
|
+
* 4. Cache the fetched content
|
|
1347
|
+
* 5. Return the content
|
|
1348
|
+
*
|
|
1349
|
+
* @param key - Cache key
|
|
1350
|
+
* @param url - Remote URL to fetch if not cached
|
|
1351
|
+
* @param options - Cache and fetch options
|
|
1352
|
+
*/
|
|
1353
|
+
getWithFallback<T = string>(key: string, url: string, options?: CacheOptions & FetchOptions): Promise<CacheEntry<T>>;
|
|
1354
|
+
/**
|
|
1355
|
+
* Sync all entries from a source
|
|
1356
|
+
*
|
|
1357
|
+
* @param source - Source to sync
|
|
1358
|
+
* @param options - Sync options
|
|
1359
|
+
*/
|
|
1360
|
+
syncSource(source: string, options?: SyncOptions): Promise<SyncResult>;
|
|
1361
|
+
/**
|
|
1362
|
+
* Sync specific entries
|
|
1363
|
+
*
|
|
1364
|
+
* @param keys - Keys to sync
|
|
1365
|
+
* @param options - Sync options
|
|
1366
|
+
*/
|
|
1367
|
+
syncEntries(keys: string[], options?: SyncOptions): Promise<SyncResult>;
|
|
1368
|
+
/**
|
|
1369
|
+
* Register a fetcher for a source
|
|
1370
|
+
*
|
|
1371
|
+
* @param source - Source identifier
|
|
1372
|
+
* @param fetcher - Fetcher implementation
|
|
1373
|
+
*/
|
|
1374
|
+
registerFetcher(source: string, fetcher: RemoteFetcher): void;
|
|
1375
|
+
/**
|
|
1376
|
+
* Check if a fetcher is registered for a source
|
|
1377
|
+
*
|
|
1378
|
+
* @param source - Source identifier
|
|
1379
|
+
*/
|
|
1380
|
+
hasFetcher(source: string): boolean;
|
|
1381
|
+
/**
|
|
1382
|
+
* Get the underlying cache provider
|
|
1383
|
+
*/
|
|
1384
|
+
getCache(): CacheProvider;
|
|
1385
|
+
}
|
|
1386
|
+
/**
|
|
1387
|
+
* Options for sync operations
|
|
1388
|
+
*/
|
|
1389
|
+
interface SyncOptions {
|
|
1390
|
+
/**
|
|
1391
|
+
* Force refresh all entries
|
|
1392
|
+
*/
|
|
1393
|
+
force?: boolean;
|
|
1394
|
+
/**
|
|
1395
|
+
* Continue on error
|
|
1396
|
+
*/
|
|
1397
|
+
continueOnError?: boolean;
|
|
1398
|
+
/**
|
|
1399
|
+
* Maximum concurrent fetches
|
|
1400
|
+
*/
|
|
1401
|
+
concurrency?: number;
|
|
1402
|
+
/**
|
|
1403
|
+
* Progress callback
|
|
1404
|
+
*/
|
|
1405
|
+
onProgress?: (completed: number, total: number) => void;
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
/**
|
|
1409
|
+
* File-based Cache Provider
|
|
1410
|
+
*
|
|
1411
|
+
* Implements CacheProvider using the local filesystem.
|
|
1412
|
+
* Stores content in files with separate metadata JSON files.
|
|
1413
|
+
*/
|
|
1414
|
+
|
|
1415
|
+
/**
|
|
1416
|
+
* Options for creating a file cache provider
|
|
1417
|
+
*/
|
|
1418
|
+
interface FileCacheProviderOptions {
|
|
1419
|
+
/**
|
|
1420
|
+
* Base path for cache storage (project root)
|
|
1421
|
+
*/
|
|
1422
|
+
basePath: string;
|
|
1423
|
+
/**
|
|
1424
|
+
* Default TTL in seconds
|
|
1425
|
+
*/
|
|
1426
|
+
ttl?: number;
|
|
1427
|
+
/**
|
|
1428
|
+
* Maximum cache size in bytes
|
|
1429
|
+
*/
|
|
1430
|
+
maxSize?: number;
|
|
1431
|
+
/**
|
|
1432
|
+
* Maximum number of entries
|
|
1433
|
+
*/
|
|
1434
|
+
maxEntries?: number;
|
|
1435
|
+
}
|
|
1436
|
+
/**
|
|
1437
|
+
* File-based cache provider implementation
|
|
1438
|
+
*/
|
|
1439
|
+
declare class FileCacheProvider implements CacheProvider {
|
|
1440
|
+
private basePath;
|
|
1441
|
+
private cachePath;
|
|
1442
|
+
private contentPath;
|
|
1443
|
+
private metadataPath;
|
|
1444
|
+
private indexPath;
|
|
1445
|
+
private ttl;
|
|
1446
|
+
private maxSize;
|
|
1447
|
+
private maxEntries;
|
|
1448
|
+
private initialized;
|
|
1449
|
+
private index;
|
|
1450
|
+
constructor(options: FileCacheProviderOptions);
|
|
1451
|
+
/**
|
|
1452
|
+
* Initialize the cache (create directories, load index)
|
|
1453
|
+
*/
|
|
1454
|
+
initialize(): Promise<void>;
|
|
1455
|
+
/**
|
|
1456
|
+
* Check if the cache is initialized
|
|
1457
|
+
*/
|
|
1458
|
+
isInitialized(): boolean;
|
|
1459
|
+
/**
|
|
1460
|
+
* Get a cached entry by key
|
|
1461
|
+
*/
|
|
1462
|
+
get<T = string>(key: string, options?: CacheOptions): Promise<CacheEntry<T> | null>;
|
|
1463
|
+
/**
|
|
1464
|
+
* Get the content only (convenience method)
|
|
1465
|
+
*/
|
|
1466
|
+
getContent<T = string>(key: string, options?: CacheOptions): Promise<T | null>;
|
|
1467
|
+
/**
|
|
1468
|
+
* Set a cache entry
|
|
1469
|
+
*/
|
|
1470
|
+
set<T = string>(key: string, content: T, metadata: Partial<CacheMetadata>, options?: CacheOptions): Promise<void>;
|
|
1471
|
+
/**
|
|
1472
|
+
* Check if a key exists in the cache
|
|
1473
|
+
*/
|
|
1474
|
+
has(key: string): Promise<boolean>;
|
|
1475
|
+
/**
|
|
1476
|
+
* Delete a cache entry
|
|
1477
|
+
*/
|
|
1478
|
+
delete(key: string): Promise<boolean>;
|
|
1479
|
+
/**
|
|
1480
|
+
* Get the status of a cache entry
|
|
1481
|
+
*/
|
|
1482
|
+
getStatus(key: string): Promise<CacheStatus | null>;
|
|
1483
|
+
/**
|
|
1484
|
+
* Get metadata for a cache entry
|
|
1485
|
+
*/
|
|
1486
|
+
getMetadata(key: string): Promise<CacheMetadata | null>;
|
|
1487
|
+
/**
|
|
1488
|
+
* Update metadata for a cache entry
|
|
1489
|
+
*/
|
|
1490
|
+
updateMetadata(key: string, metadata: Partial<CacheMetadata>): Promise<void>;
|
|
1491
|
+
/**
|
|
1492
|
+
* List cache entries
|
|
1493
|
+
*/
|
|
1494
|
+
list(options?: CacheListOptions): Promise<CacheMetadata[]>;
|
|
1495
|
+
/**
|
|
1496
|
+
* Get cache statistics
|
|
1497
|
+
*/
|
|
1498
|
+
getStats(): Promise<CacheStats>;
|
|
1499
|
+
/**
|
|
1500
|
+
* Clear all cache entries
|
|
1501
|
+
*/
|
|
1502
|
+
clear(): Promise<number>;
|
|
1503
|
+
/**
|
|
1504
|
+
* Clear expired entries only
|
|
1505
|
+
*/
|
|
1506
|
+
clearExpired(): Promise<number>;
|
|
1507
|
+
/**
|
|
1508
|
+
* Clear entries by source
|
|
1509
|
+
*/
|
|
1510
|
+
clearBySource(source: string): Promise<number>;
|
|
1511
|
+
/**
|
|
1512
|
+
* Clear entries by tag
|
|
1513
|
+
*/
|
|
1514
|
+
clearByTag(tag: string): Promise<number>;
|
|
1515
|
+
private ensureInitialized;
|
|
1516
|
+
private loadIndex;
|
|
1517
|
+
private saveIndex;
|
|
1518
|
+
private createEmptyIndex;
|
|
1519
|
+
private rebuildIndex;
|
|
1520
|
+
private getEntryStatus;
|
|
1521
|
+
private sanitizeKey;
|
|
1522
|
+
private hashContent;
|
|
1523
|
+
}
|
|
1524
|
+
/**
|
|
1525
|
+
* Create a file cache provider
|
|
1526
|
+
*/
|
|
1527
|
+
declare function createFileCacheProvider(options: FileCacheProviderOptions): FileCacheProvider;
|
|
1528
|
+
|
|
1529
|
+
/**
|
|
1530
|
+
* Cache Manager
|
|
1531
|
+
*
|
|
1532
|
+
* Higher-level cache management that combines caching with remote fetching.
|
|
1533
|
+
* Implements cache-first resolution with remote fallback strategy.
|
|
1534
|
+
*/
|
|
1535
|
+
|
|
1536
|
+
/**
|
|
1537
|
+
* Options for creating a cache manager
|
|
1538
|
+
*/
|
|
1539
|
+
interface CacheManagerOptions {
|
|
1540
|
+
/**
|
|
1541
|
+
* The underlying cache provider
|
|
1542
|
+
*/
|
|
1543
|
+
cache: CacheProvider;
|
|
1544
|
+
/**
|
|
1545
|
+
* Default TTL in seconds
|
|
1546
|
+
*/
|
|
1547
|
+
defaultTtl?: number;
|
|
1548
|
+
/**
|
|
1549
|
+
* Default source for new entries
|
|
1550
|
+
*/
|
|
1551
|
+
defaultSource?: CacheSource;
|
|
1552
|
+
}
|
|
1553
|
+
/**
|
|
1554
|
+
* Cache manager implementation
|
|
1555
|
+
*
|
|
1556
|
+
* Provides cache-first resolution strategy:
|
|
1557
|
+
* 1. Check cache for valid entry
|
|
1558
|
+
* 2. If cached and valid, return cached content
|
|
1559
|
+
* 3. If stale or missing, fetch from remote
|
|
1560
|
+
* 4. Cache the fetched content
|
|
1561
|
+
* 5. Return the content
|
|
1562
|
+
*/
|
|
1563
|
+
declare class CacheManager implements CacheManager$1 {
|
|
1564
|
+
private cache;
|
|
1565
|
+
private fetchers;
|
|
1566
|
+
private defaultTtl;
|
|
1567
|
+
private defaultSource;
|
|
1568
|
+
constructor(options: CacheManagerOptions);
|
|
1569
|
+
/**
|
|
1570
|
+
* Get content with cache-first strategy
|
|
1571
|
+
*/
|
|
1572
|
+
getWithFallback<T = string>(key: string, url: string, options?: CacheOptions & FetchOptions): Promise<CacheEntry<T>>;
|
|
1573
|
+
/**
|
|
1574
|
+
* Sync all entries from a source
|
|
1575
|
+
*/
|
|
1576
|
+
syncSource(source: string, options?: SyncOptions): Promise<SyncResult>;
|
|
1577
|
+
/**
|
|
1578
|
+
* Sync specific entries
|
|
1579
|
+
*/
|
|
1580
|
+
syncEntries(keys: string[], options?: SyncOptions): Promise<SyncResult>;
|
|
1581
|
+
/**
|
|
1582
|
+
* Register a fetcher for a source
|
|
1583
|
+
*/
|
|
1584
|
+
registerFetcher(source: string, fetcher: RemoteFetcher): void;
|
|
1585
|
+
/**
|
|
1586
|
+
* Get the underlying cache provider
|
|
1587
|
+
*/
|
|
1588
|
+
getCache(): CacheProvider;
|
|
1589
|
+
/**
|
|
1590
|
+
* Check if a fetcher is registered for a source
|
|
1591
|
+
*/
|
|
1592
|
+
hasFetcher(source: string): boolean;
|
|
1593
|
+
/**
|
|
1594
|
+
* Get all registered sources
|
|
1595
|
+
*/
|
|
1596
|
+
getRegisteredSources(): string[];
|
|
1597
|
+
private fetchAndCache;
|
|
1598
|
+
private getSourceFromUrl;
|
|
1599
|
+
private chunkArray;
|
|
1600
|
+
}
|
|
1601
|
+
/**
|
|
1602
|
+
* Create a cache manager
|
|
1603
|
+
*/
|
|
1604
|
+
declare function createCacheManager(options: CacheManagerOptions): CacheManager;
|
|
1605
|
+
|
|
1606
|
+
/**
|
|
1607
|
+
* Context Loader
|
|
1608
|
+
*
|
|
1609
|
+
* Loads shared context from remote documentation providers with cache-first resolution.
|
|
1610
|
+
* Handles first-run scenarios when cache is empty.
|
|
1611
|
+
*/
|
|
1612
|
+
|
|
1613
|
+
/**
|
|
1614
|
+
* Context source definition
|
|
1615
|
+
*/
|
|
1616
|
+
interface ContextSource {
|
|
1617
|
+
/**
|
|
1618
|
+
* Unique identifier for this context
|
|
1619
|
+
*/
|
|
1620
|
+
key: string;
|
|
1621
|
+
/**
|
|
1622
|
+
* Remote URL to fetch from
|
|
1623
|
+
*/
|
|
1624
|
+
url: string;
|
|
1625
|
+
/**
|
|
1626
|
+
* Optional title for the context
|
|
1627
|
+
*/
|
|
1628
|
+
title?: string;
|
|
1629
|
+
/**
|
|
1630
|
+
* Optional tags for categorization
|
|
1631
|
+
*/
|
|
1632
|
+
tags?: string[];
|
|
1633
|
+
/**
|
|
1634
|
+
* Whether this context is required (fail if cannot load)
|
|
1635
|
+
*/
|
|
1636
|
+
required?: boolean;
|
|
1637
|
+
}
|
|
1638
|
+
/**
|
|
1639
|
+
* Context load result
|
|
1640
|
+
*/
|
|
1641
|
+
interface ContextLoadResult {
|
|
1642
|
+
/**
|
|
1643
|
+
* Successfully loaded contexts
|
|
1644
|
+
*/
|
|
1645
|
+
loaded: {
|
|
1646
|
+
key: string;
|
|
1647
|
+
content: string;
|
|
1648
|
+
fromCache: boolean;
|
|
1649
|
+
metadata: CacheMetadata;
|
|
1650
|
+
}[];
|
|
1651
|
+
/**
|
|
1652
|
+
* Failed contexts
|
|
1653
|
+
*/
|
|
1654
|
+
failed: {
|
|
1655
|
+
key: string;
|
|
1656
|
+
error: string;
|
|
1657
|
+
required: boolean;
|
|
1658
|
+
}[];
|
|
1659
|
+
/**
|
|
1660
|
+
* Total duration in milliseconds
|
|
1661
|
+
*/
|
|
1662
|
+
duration: number;
|
|
1663
|
+
}
|
|
1664
|
+
/**
|
|
1665
|
+
* Options for the context loader
|
|
1666
|
+
*/
|
|
1667
|
+
interface ContextLoaderOptions {
|
|
1668
|
+
/**
|
|
1669
|
+
* The cache manager to use
|
|
1670
|
+
*/
|
|
1671
|
+
cacheManager: CacheManager$1;
|
|
1672
|
+
/**
|
|
1673
|
+
* Default TTL for cached contexts (seconds)
|
|
1674
|
+
*/
|
|
1675
|
+
defaultTtl?: number;
|
|
1676
|
+
/**
|
|
1677
|
+
* Whether to fail on any required context failure
|
|
1678
|
+
*/
|
|
1679
|
+
failOnRequired?: boolean;
|
|
1680
|
+
/**
|
|
1681
|
+
* Maximum concurrent fetches
|
|
1682
|
+
*/
|
|
1683
|
+
concurrency?: number;
|
|
1684
|
+
}
|
|
1685
|
+
/**
|
|
1686
|
+
* Options for loading contexts
|
|
1687
|
+
*/
|
|
1688
|
+
interface LoadOptions extends CacheOptions, FetchOptions {
|
|
1689
|
+
/**
|
|
1690
|
+
* Continue loading other contexts if one fails
|
|
1691
|
+
*/
|
|
1692
|
+
continueOnError?: boolean;
|
|
1693
|
+
/**
|
|
1694
|
+
* Progress callback
|
|
1695
|
+
*/
|
|
1696
|
+
onProgress?: (loaded: number, total: number, current: string) => void;
|
|
1697
|
+
}
|
|
1698
|
+
/**
|
|
1699
|
+
* Context Loader
|
|
1700
|
+
*
|
|
1701
|
+
* Provides cache-first context resolution with graceful degradation
|
|
1702
|
+
* for first-run scenarios when the cache is empty.
|
|
1703
|
+
*/
|
|
1704
|
+
declare class ContextLoader {
|
|
1705
|
+
private cacheManager;
|
|
1706
|
+
private defaultTtl;
|
|
1707
|
+
private failOnRequired;
|
|
1708
|
+
private concurrency;
|
|
1709
|
+
constructor(options: ContextLoaderOptions);
|
|
1710
|
+
/**
|
|
1711
|
+
* Load a single context
|
|
1712
|
+
*/
|
|
1713
|
+
load(source: ContextSource, options?: LoadOptions): Promise<CacheEntry<string>>;
|
|
1714
|
+
/**
|
|
1715
|
+
* Load multiple contexts
|
|
1716
|
+
*/
|
|
1717
|
+
loadMany(sources: ContextSource[], options?: LoadOptions): Promise<ContextLoadResult>;
|
|
1718
|
+
/**
|
|
1719
|
+
* Load contexts by tag
|
|
1720
|
+
*/
|
|
1721
|
+
loadByTag(tag: string, _options?: LoadOptions): Promise<ContextLoadResult>;
|
|
1722
|
+
/**
|
|
1723
|
+
* Refresh all contexts (sync from remote)
|
|
1724
|
+
*/
|
|
1725
|
+
refresh(sources: ContextSource[], options?: LoadOptions): Promise<ContextLoadResult>;
|
|
1726
|
+
/**
|
|
1727
|
+
* Check if all required contexts are available (cached or fetchable)
|
|
1728
|
+
*/
|
|
1729
|
+
checkAvailability(sources: ContextSource[]): Promise<{
|
|
1730
|
+
available: string[];
|
|
1731
|
+
missing: string[];
|
|
1732
|
+
errors: string[];
|
|
1733
|
+
}>;
|
|
1734
|
+
/**
|
|
1735
|
+
* Get the cache manager
|
|
1736
|
+
*/
|
|
1737
|
+
getCacheManager(): CacheManager$1;
|
|
1738
|
+
private getSourceFromHostname;
|
|
1739
|
+
private chunkArray;
|
|
1740
|
+
}
|
|
1741
|
+
/**
|
|
1742
|
+
* Create a context loader
|
|
1743
|
+
*/
|
|
1744
|
+
declare function createContextLoader(options: ContextLoaderOptions): ContextLoader;
|
|
1745
|
+
|
|
1746
|
+
/**
|
|
1747
|
+
* Command Framework Types
|
|
1748
|
+
*
|
|
1749
|
+
* Type definitions for the CoreAI command registration and execution system.
|
|
1750
|
+
*/
|
|
1751
|
+
|
|
1752
|
+
/**
|
|
1753
|
+
* Command category for organization
|
|
1754
|
+
*/
|
|
1755
|
+
type CommandCategory = 'core' | 'optional' | 'custom';
|
|
1756
|
+
/**
|
|
1757
|
+
* Integration dependency for a command
|
|
1758
|
+
*/
|
|
1759
|
+
interface IntegrationDependency {
|
|
1760
|
+
/**
|
|
1761
|
+
* Adapter type required
|
|
1762
|
+
*/
|
|
1763
|
+
type: AdapterType;
|
|
1764
|
+
/**
|
|
1765
|
+
* Whether this integration is required or optional
|
|
1766
|
+
* If required and missing, command won't be registered
|
|
1767
|
+
* If optional and missing, command degrades gracefully
|
|
1768
|
+
*/
|
|
1769
|
+
required: boolean;
|
|
1770
|
+
/**
|
|
1771
|
+
* Description of what this integration is used for
|
|
1772
|
+
*/
|
|
1773
|
+
description?: string;
|
|
1774
|
+
}
|
|
1775
|
+
/**
|
|
1776
|
+
* Command metadata parsed from markdown frontmatter
|
|
1777
|
+
*/
|
|
1778
|
+
interface CommandMetadata {
|
|
1779
|
+
/**
|
|
1780
|
+
* Command name (derived from filename)
|
|
1781
|
+
*/
|
|
1782
|
+
name: string;
|
|
1783
|
+
/**
|
|
1784
|
+
* Human-readable description
|
|
1785
|
+
*/
|
|
1786
|
+
description: string;
|
|
1787
|
+
/**
|
|
1788
|
+
* Hint for command arguments
|
|
1789
|
+
*/
|
|
1790
|
+
argumentHint?: string;
|
|
1791
|
+
/**
|
|
1792
|
+
* Command category
|
|
1793
|
+
*/
|
|
1794
|
+
category: CommandCategory;
|
|
1795
|
+
/**
|
|
1796
|
+
* Integration dependencies
|
|
1797
|
+
*/
|
|
1798
|
+
dependencies: IntegrationDependency[];
|
|
1799
|
+
/**
|
|
1800
|
+
* Path to the source markdown file
|
|
1801
|
+
*/
|
|
1802
|
+
sourcePath: string;
|
|
1803
|
+
/**
|
|
1804
|
+
* Whether command is available (all required deps satisfied)
|
|
1805
|
+
*/
|
|
1806
|
+
available: boolean;
|
|
1807
|
+
/**
|
|
1808
|
+
* Reason command is unavailable (if not available)
|
|
1809
|
+
*/
|
|
1810
|
+
unavailableReason?: string;
|
|
1811
|
+
}
|
|
1812
|
+
/**
|
|
1813
|
+
* Runtime context available during command execution
|
|
1814
|
+
*/
|
|
1815
|
+
interface CommandContext {
|
|
1816
|
+
/**
|
|
1817
|
+
* Loaded configuration (may be null if no config file)
|
|
1818
|
+
*/
|
|
1819
|
+
config: ResolvedCoreAIConfig | null;
|
|
1820
|
+
/**
|
|
1821
|
+
* Adapter factory for accessing integrations
|
|
1822
|
+
*/
|
|
1823
|
+
adapterFactory: AdapterFactory | null;
|
|
1824
|
+
/**
|
|
1825
|
+
* Project root directory
|
|
1826
|
+
*/
|
|
1827
|
+
projectRoot: string;
|
|
1828
|
+
/**
|
|
1829
|
+
* Check if an integration is available
|
|
1830
|
+
*/
|
|
1831
|
+
hasIntegration(type: AdapterType): boolean;
|
|
1832
|
+
/**
|
|
1833
|
+
* Get adapter with graceful handling
|
|
1834
|
+
* Returns null if not available instead of throwing
|
|
1835
|
+
*/
|
|
1836
|
+
getAdapterSafe<T>(type: AdapterType): Promise<T | null>;
|
|
1837
|
+
}
|
|
1838
|
+
/**
|
|
1839
|
+
* Base options available to all commands
|
|
1840
|
+
*/
|
|
1841
|
+
interface BaseCommandOptions {
|
|
1842
|
+
/**
|
|
1843
|
+
* Output format
|
|
1844
|
+
*/
|
|
1845
|
+
format?: 'text' | 'json';
|
|
1846
|
+
/**
|
|
1847
|
+
* Verbose output
|
|
1848
|
+
*/
|
|
1849
|
+
verbose?: boolean;
|
|
1850
|
+
/**
|
|
1851
|
+
* Project root directory override
|
|
1852
|
+
*/
|
|
1853
|
+
projectRoot?: string;
|
|
1854
|
+
}
|
|
1855
|
+
/**
|
|
1856
|
+
* Result of command execution
|
|
1857
|
+
*/
|
|
1858
|
+
interface CommandResult<T = unknown> {
|
|
1859
|
+
/**
|
|
1860
|
+
* Whether command completed successfully
|
|
1861
|
+
*/
|
|
1862
|
+
success: boolean;
|
|
1863
|
+
/**
|
|
1864
|
+
* Result data (command-specific)
|
|
1865
|
+
*/
|
|
1866
|
+
data?: T;
|
|
1867
|
+
/**
|
|
1868
|
+
* Error message if failed
|
|
1869
|
+
*/
|
|
1870
|
+
error?: string;
|
|
1871
|
+
/**
|
|
1872
|
+
* Warnings that occurred during execution
|
|
1873
|
+
*/
|
|
1874
|
+
warnings?: string[];
|
|
1875
|
+
/**
|
|
1876
|
+
* Steps that were skipped due to missing integrations
|
|
1877
|
+
*/
|
|
1878
|
+
skippedSteps?: {
|
|
1879
|
+
step: string;
|
|
1880
|
+
reason: string;
|
|
1881
|
+
}[];
|
|
1882
|
+
}
|
|
1883
|
+
/**
|
|
1884
|
+
* Command handler function signature
|
|
1885
|
+
*/
|
|
1886
|
+
type CommandHandler<TOptions = BaseCommandOptions, TResult = unknown> = (args: string[], options: TOptions, context: CommandContext) => Promise<CommandResult<TResult>>;
|
|
1887
|
+
/**
|
|
1888
|
+
* Command definition for programmatic commands
|
|
1889
|
+
*/
|
|
1890
|
+
interface CommandDefinition<TOptions = BaseCommandOptions, TResult = unknown> {
|
|
1891
|
+
/**
|
|
1892
|
+
* Command name
|
|
1893
|
+
*/
|
|
1894
|
+
name: string;
|
|
1895
|
+
/**
|
|
1896
|
+
* Human-readable description
|
|
1897
|
+
*/
|
|
1898
|
+
description: string;
|
|
1899
|
+
/**
|
|
1900
|
+
* Command category
|
|
1901
|
+
*/
|
|
1902
|
+
category: CommandCategory;
|
|
1903
|
+
/**
|
|
1904
|
+
* Integration dependencies
|
|
1905
|
+
*/
|
|
1906
|
+
dependencies?: IntegrationDependency[];
|
|
1907
|
+
/**
|
|
1908
|
+
* Option definitions for Commander.js
|
|
1909
|
+
*/
|
|
1910
|
+
options?: CommandOptionDefinition[];
|
|
1911
|
+
/**
|
|
1912
|
+
* Positional argument definitions
|
|
1913
|
+
*/
|
|
1914
|
+
arguments?: CommandArgumentDefinition[];
|
|
1915
|
+
/**
|
|
1916
|
+
* Command handler
|
|
1917
|
+
*/
|
|
1918
|
+
handler: CommandHandler<TOptions, TResult>;
|
|
1919
|
+
/**
|
|
1920
|
+
* Subcommands (for command groups like 'agents list', 'agents show')
|
|
1921
|
+
*/
|
|
1922
|
+
subcommands?: CommandDefinition[];
|
|
1923
|
+
}
|
|
1924
|
+
/**
|
|
1925
|
+
* Command option definition
|
|
1926
|
+
*/
|
|
1927
|
+
interface CommandOptionDefinition {
|
|
1928
|
+
/**
|
|
1929
|
+
* Option flags (e.g., '-f, --force')
|
|
1930
|
+
*/
|
|
1931
|
+
flags: string;
|
|
1932
|
+
/**
|
|
1933
|
+
* Description
|
|
1934
|
+
*/
|
|
1935
|
+
description: string;
|
|
1936
|
+
/**
|
|
1937
|
+
* Default value
|
|
1938
|
+
*/
|
|
1939
|
+
defaultValue?: unknown;
|
|
1940
|
+
/**
|
|
1941
|
+
* Whether option is required
|
|
1942
|
+
*/
|
|
1943
|
+
required?: boolean;
|
|
1944
|
+
}
|
|
1945
|
+
/**
|
|
1946
|
+
* Command argument definition
|
|
1947
|
+
*/
|
|
1948
|
+
interface CommandArgumentDefinition {
|
|
1949
|
+
/**
|
|
1950
|
+
* Argument name
|
|
1951
|
+
*/
|
|
1952
|
+
name: string;
|
|
1953
|
+
/**
|
|
1954
|
+
* Description
|
|
1955
|
+
*/
|
|
1956
|
+
description: string;
|
|
1957
|
+
/**
|
|
1958
|
+
* Whether argument is required
|
|
1959
|
+
*/
|
|
1960
|
+
required?: boolean;
|
|
1961
|
+
/**
|
|
1962
|
+
* Default value
|
|
1963
|
+
*/
|
|
1964
|
+
defaultValue?: unknown;
|
|
1965
|
+
}
|
|
1966
|
+
/**
|
|
1967
|
+
* Markdown command definition (parsed from file)
|
|
1968
|
+
*/
|
|
1969
|
+
interface MarkdownCommand {
|
|
1970
|
+
/**
|
|
1971
|
+
* Command metadata
|
|
1972
|
+
*/
|
|
1973
|
+
metadata: CommandMetadata;
|
|
1974
|
+
/**
|
|
1975
|
+
* Raw markdown content (instructions for agents)
|
|
1976
|
+
*/
|
|
1977
|
+
content: string;
|
|
1978
|
+
/**
|
|
1979
|
+
* Parsed sections from markdown
|
|
1980
|
+
*/
|
|
1981
|
+
sections: {
|
|
1982
|
+
title?: string;
|
|
1983
|
+
instructions?: string;
|
|
1984
|
+
fallbacks?: string;
|
|
1985
|
+
outputFormat?: string;
|
|
1986
|
+
};
|
|
1987
|
+
}
|
|
1988
|
+
/**
|
|
1989
|
+
* Command registry entry
|
|
1990
|
+
*/
|
|
1991
|
+
interface RegistryEntry {
|
|
1992
|
+
/**
|
|
1993
|
+
* Command metadata
|
|
1994
|
+
*/
|
|
1995
|
+
metadata: CommandMetadata;
|
|
1996
|
+
/**
|
|
1997
|
+
* Command definition (for programmatic commands)
|
|
1998
|
+
*/
|
|
1999
|
+
definition?: CommandDefinition;
|
|
2000
|
+
/**
|
|
2001
|
+
* Markdown command (for agent commands)
|
|
2002
|
+
*/
|
|
2003
|
+
markdownCommand?: MarkdownCommand;
|
|
2004
|
+
/**
|
|
2005
|
+
* Source type
|
|
2006
|
+
*/
|
|
2007
|
+
source: 'programmatic' | 'markdown';
|
|
2008
|
+
}
|
|
2009
|
+
/**
|
|
2010
|
+
* Options for loading commands from directory
|
|
2011
|
+
*/
|
|
2012
|
+
interface CommandLoaderOptions {
|
|
2013
|
+
/**
|
|
2014
|
+
* Directory to load commands from
|
|
2015
|
+
*/
|
|
2016
|
+
directory: string;
|
|
2017
|
+
/**
|
|
2018
|
+
* Category to assign to loaded commands
|
|
2019
|
+
*/
|
|
2020
|
+
category: CommandCategory;
|
|
2021
|
+
/**
|
|
2022
|
+
* Recursively search subdirectories
|
|
2023
|
+
*/
|
|
2024
|
+
recursive?: boolean;
|
|
2025
|
+
/**
|
|
2026
|
+
* Filter function to include/exclude commands
|
|
2027
|
+
*/
|
|
2028
|
+
filter?: (metadata: CommandMetadata) => boolean;
|
|
2029
|
+
}
|
|
2030
|
+
/**
|
|
2031
|
+
* Result of loading commands
|
|
2032
|
+
*/
|
|
2033
|
+
interface CommandLoadResult {
|
|
2034
|
+
/**
|
|
2035
|
+
* Successfully loaded commands
|
|
2036
|
+
*/
|
|
2037
|
+
loaded: MarkdownCommand[];
|
|
2038
|
+
/**
|
|
2039
|
+
* Failed to load
|
|
2040
|
+
*/
|
|
2041
|
+
errors: {
|
|
2042
|
+
path: string;
|
|
2043
|
+
error: string;
|
|
2044
|
+
}[];
|
|
2045
|
+
}
|
|
2046
|
+
|
|
2047
|
+
/**
|
|
2048
|
+
* Command Context
|
|
2049
|
+
*
|
|
2050
|
+
* Runtime context for command execution with graceful degradation support.
|
|
2051
|
+
*/
|
|
2052
|
+
|
|
2053
|
+
/**
|
|
2054
|
+
* Options for creating a command context
|
|
2055
|
+
*/
|
|
2056
|
+
interface CreateContextOptions {
|
|
2057
|
+
/**
|
|
2058
|
+
* Project root directory
|
|
2059
|
+
*/
|
|
2060
|
+
projectRoot?: string;
|
|
2061
|
+
/**
|
|
2062
|
+
* Pre-loaded configuration (if already loaded)
|
|
2063
|
+
*/
|
|
2064
|
+
config?: ResolvedCoreAIConfig;
|
|
2065
|
+
/**
|
|
2066
|
+
* Pre-created adapter factory (if already created)
|
|
2067
|
+
*/
|
|
2068
|
+
adapterFactory?: AdapterFactory;
|
|
2069
|
+
}
|
|
2070
|
+
/**
|
|
2071
|
+
* Create a command execution context
|
|
2072
|
+
*
|
|
2073
|
+
* Handles configuration loading and adapter factory creation with graceful fallbacks.
|
|
2074
|
+
*/
|
|
2075
|
+
declare function createCommandContext(options?: CreateContextOptions): CommandContext;
|
|
2076
|
+
/**
|
|
2077
|
+
* Cleanup resources in a command context
|
|
2078
|
+
*/
|
|
2079
|
+
declare function cleanupContext(context: CommandContext): Promise<void>;
|
|
2080
|
+
/**
|
|
2081
|
+
* Execute a function with automatic context cleanup
|
|
2082
|
+
*/
|
|
2083
|
+
declare function withContext<T>(options: CreateContextOptions, fn: (context: CommandContext) => Promise<T>): Promise<T>;
|
|
2084
|
+
|
|
2085
|
+
/**
|
|
2086
|
+
* Command Registry
|
|
2087
|
+
*
|
|
2088
|
+
* Central registry for command registration and discovery.
|
|
2089
|
+
*/
|
|
2090
|
+
|
|
2091
|
+
/**
|
|
2092
|
+
* Command Registry
|
|
2093
|
+
*
|
|
2094
|
+
* Manages registration and lookup of commands.
|
|
2095
|
+
*/
|
|
2096
|
+
declare class CommandRegistry {
|
|
2097
|
+
private commands;
|
|
2098
|
+
private adapterFactory;
|
|
2099
|
+
/**
|
|
2100
|
+
* Set the adapter factory for dependency checking
|
|
2101
|
+
*/
|
|
2102
|
+
setAdapterFactory(factory: AdapterFactory | null): void;
|
|
2103
|
+
/**
|
|
2104
|
+
* Register a programmatic command
|
|
2105
|
+
*/
|
|
2106
|
+
register(definition: CommandDefinition): void;
|
|
2107
|
+
/**
|
|
2108
|
+
* Register a markdown command
|
|
2109
|
+
*/
|
|
2110
|
+
registerMarkdown(command: MarkdownCommand): void;
|
|
2111
|
+
/**
|
|
2112
|
+
* Register multiple commands
|
|
2113
|
+
*/
|
|
2114
|
+
registerAll(definitions: CommandDefinition[]): void;
|
|
2115
|
+
/**
|
|
2116
|
+
* Register multiple markdown commands
|
|
2117
|
+
*/
|
|
2118
|
+
registerAllMarkdown(commands: MarkdownCommand[]): void;
|
|
2119
|
+
/**
|
|
2120
|
+
* Unregister a command
|
|
2121
|
+
*/
|
|
2122
|
+
unregister(name: string): boolean;
|
|
2123
|
+
/**
|
|
2124
|
+
* Get a command by name
|
|
2125
|
+
*/
|
|
2126
|
+
get(name: string): RegistryEntry | undefined;
|
|
2127
|
+
/**
|
|
2128
|
+
* Check if a command exists
|
|
2129
|
+
*/
|
|
2130
|
+
has(name: string): boolean;
|
|
2131
|
+
/**
|
|
2132
|
+
* Get all registered commands
|
|
2133
|
+
*/
|
|
2134
|
+
getAll(): RegistryEntry[];
|
|
2135
|
+
/**
|
|
2136
|
+
* Get available commands (dependencies satisfied)
|
|
2137
|
+
*/
|
|
2138
|
+
getAvailable(): RegistryEntry[];
|
|
2139
|
+
/**
|
|
2140
|
+
* Get unavailable commands
|
|
2141
|
+
*/
|
|
2142
|
+
getUnavailable(): RegistryEntry[];
|
|
2143
|
+
/**
|
|
2144
|
+
* Get commands by category
|
|
2145
|
+
*/
|
|
2146
|
+
getByCategory(category: CommandCategory): RegistryEntry[];
|
|
2147
|
+
/**
|
|
2148
|
+
* Get command names
|
|
2149
|
+
*/
|
|
2150
|
+
getNames(): string[];
|
|
2151
|
+
/**
|
|
2152
|
+
* Clear all registered commands
|
|
2153
|
+
*/
|
|
2154
|
+
clear(): void;
|
|
2155
|
+
/**
|
|
2156
|
+
* Get the number of registered commands
|
|
2157
|
+
*/
|
|
2158
|
+
get size(): number;
|
|
2159
|
+
/**
|
|
2160
|
+
* Check and update availability for a command metadata
|
|
2161
|
+
*/
|
|
2162
|
+
private checkAvailability;
|
|
2163
|
+
/**
|
|
2164
|
+
* Get missing dependencies
|
|
2165
|
+
*/
|
|
2166
|
+
private getMissingDependencies;
|
|
2167
|
+
/**
|
|
2168
|
+
* Update availability for all commands
|
|
2169
|
+
*/
|
|
2170
|
+
private updateAvailability;
|
|
2171
|
+
/**
|
|
2172
|
+
* Get dependency status for a command
|
|
2173
|
+
*/
|
|
2174
|
+
getDependencyStatus(name: string): {
|
|
2175
|
+
satisfied: IntegrationDependency[];
|
|
2176
|
+
missing: IntegrationDependency[];
|
|
2177
|
+
} | null;
|
|
2178
|
+
}
|
|
2179
|
+
/**
|
|
2180
|
+
* Create a new command registry
|
|
2181
|
+
*/
|
|
2182
|
+
declare function createCommandRegistry(): CommandRegistry;
|
|
2183
|
+
/**
|
|
2184
|
+
* Get or create the global command registry
|
|
2185
|
+
*/
|
|
2186
|
+
declare function getGlobalRegistry(): CommandRegistry;
|
|
2187
|
+
/**
|
|
2188
|
+
* Reset the global registry (primarily for testing)
|
|
2189
|
+
*/
|
|
2190
|
+
declare function resetGlobalRegistry(): void;
|
|
2191
|
+
|
|
2192
|
+
/**
|
|
2193
|
+
* Command Loader
|
|
2194
|
+
*
|
|
2195
|
+
* Loads commands from markdown files in the coreai/commands/ directory.
|
|
2196
|
+
*/
|
|
2197
|
+
|
|
2198
|
+
/**
|
|
2199
|
+
* Load a single command from a markdown file
|
|
2200
|
+
*/
|
|
2201
|
+
declare function loadCommandFromFile(filePath: string, baseDir: string, categoryOverride?: CommandCategory): Promise<MarkdownCommand>;
|
|
2202
|
+
/**
|
|
2203
|
+
* Load commands from a directory
|
|
2204
|
+
*/
|
|
2205
|
+
declare function loadCommandsFromDirectory(options: CommandLoaderOptions): Promise<CommandLoadResult>;
|
|
2206
|
+
/**
|
|
2207
|
+
* Load commands from the default CoreAI commands directory
|
|
2208
|
+
*/
|
|
2209
|
+
declare function loadCoreAICommands(projectRoot: string): Promise<CommandLoadResult>;
|
|
2210
|
+
/**
|
|
2211
|
+
* Load commands from both core and custom directories
|
|
2212
|
+
*/
|
|
2213
|
+
declare function loadAllCommands(coreCommandsDir: string, customCommandsDir?: string): Promise<CommandLoadResult>;
|
|
2214
|
+
|
|
2215
|
+
/**
|
|
2216
|
+
* Command Runner
|
|
2217
|
+
*
|
|
2218
|
+
* Executes commands with graceful degradation support.
|
|
2219
|
+
*/
|
|
2220
|
+
|
|
2221
|
+
/**
|
|
2222
|
+
* Options for running a command
|
|
2223
|
+
*/
|
|
2224
|
+
interface RunCommandOptions extends BaseCommandOptions {
|
|
2225
|
+
/**
|
|
2226
|
+
* Pre-created command context
|
|
2227
|
+
*/
|
|
2228
|
+
context?: CommandContext;
|
|
2229
|
+
/**
|
|
2230
|
+
* Whether to clean up context after execution
|
|
2231
|
+
*/
|
|
2232
|
+
cleanupAfter?: boolean;
|
|
2233
|
+
}
|
|
2234
|
+
/**
|
|
2235
|
+
* Run a registered command
|
|
2236
|
+
*/
|
|
2237
|
+
declare function runCommand<TResult = unknown>(registry: CommandRegistry, name: string, args: string[], options?: RunCommandOptions): Promise<CommandResult<TResult>>;
|
|
2238
|
+
/**
|
|
2239
|
+
* Execute a step with graceful degradation
|
|
2240
|
+
*
|
|
2241
|
+
* If the required integration is not available, returns a skip result instead of failing.
|
|
2242
|
+
*/
|
|
2243
|
+
declare function executeWithDegradation<T>(context: CommandContext, dependency: IntegrationDependency, step: () => Promise<T>, fallback?: () => Promise<T>): Promise<{
|
|
2244
|
+
result: T | null;
|
|
2245
|
+
skipped: boolean;
|
|
2246
|
+
reason?: string;
|
|
2247
|
+
}>;
|
|
2248
|
+
/**
|
|
2249
|
+
* Create a command handler with automatic degradation tracking
|
|
2250
|
+
*/
|
|
2251
|
+
declare function createDegradingHandler<TOptions extends BaseCommandOptions, TResult>(handler: (args: string[], options: TOptions, context: CommandContext, track: StepTracker) => Promise<TResult>): CommandDefinition<TOptions, TResult>['handler'];
|
|
2252
|
+
/**
|
|
2253
|
+
* Tracks skipped steps and warnings during command execution
|
|
2254
|
+
*/
|
|
2255
|
+
declare class StepTracker {
|
|
2256
|
+
readonly skippedSteps: {
|
|
2257
|
+
step: string;
|
|
2258
|
+
reason: string;
|
|
2259
|
+
}[];
|
|
2260
|
+
readonly warnings: string[];
|
|
2261
|
+
/**
|
|
2262
|
+
* Record a skipped step
|
|
2263
|
+
*/
|
|
2264
|
+
skip(step: string, reason: string): void;
|
|
2265
|
+
/**
|
|
2266
|
+
* Record a warning
|
|
2267
|
+
*/
|
|
2268
|
+
warn(message: string): void;
|
|
2269
|
+
/**
|
|
2270
|
+
* Execute a step with optional fallback
|
|
2271
|
+
*/
|
|
2272
|
+
tryStep<T>(stepName: string, context: CommandContext, dependency: IntegrationDependency, step: () => Promise<T>, fallback?: () => Promise<T>): Promise<T | null>;
|
|
2273
|
+
}
|
|
2274
|
+
|
|
2275
|
+
/**
|
|
2276
|
+
* Skill Types
|
|
2277
|
+
*
|
|
2278
|
+
* Type definitions for skill generation and templates.
|
|
2279
|
+
*/
|
|
2280
|
+
|
|
2281
|
+
/**
|
|
2282
|
+
* Skill category
|
|
2283
|
+
*/
|
|
2284
|
+
type SkillCategory = 'core' | 'optional' | 'custom';
|
|
2285
|
+
/**
|
|
2286
|
+
* Integration dependency for a skill
|
|
2287
|
+
*/
|
|
2288
|
+
interface SkillDependency {
|
|
2289
|
+
/**
|
|
2290
|
+
* Integration type required
|
|
2291
|
+
*/
|
|
2292
|
+
type: AdapterType;
|
|
2293
|
+
/**
|
|
2294
|
+
* Whether this integration is required (vs optional)
|
|
2295
|
+
*/
|
|
2296
|
+
required: boolean;
|
|
2297
|
+
/**
|
|
2298
|
+
* Description of why this integration is needed
|
|
2299
|
+
*/
|
|
2300
|
+
description?: string;
|
|
2301
|
+
}
|
|
2302
|
+
/**
|
|
2303
|
+
* Skill template definition
|
|
2304
|
+
*/
|
|
2305
|
+
interface SkillTemplate {
|
|
2306
|
+
/**
|
|
2307
|
+
* Template name/identifier
|
|
2308
|
+
*/
|
|
2309
|
+
name: string;
|
|
2310
|
+
/**
|
|
2311
|
+
* Human-readable description
|
|
2312
|
+
*/
|
|
2313
|
+
description: string;
|
|
2314
|
+
/**
|
|
2315
|
+
* Hint for command arguments
|
|
2316
|
+
*/
|
|
2317
|
+
argumentHint?: string;
|
|
2318
|
+
/**
|
|
2319
|
+
* Skill category
|
|
2320
|
+
*/
|
|
2321
|
+
category: SkillCategory;
|
|
2322
|
+
/**
|
|
2323
|
+
* Integration dependencies
|
|
2324
|
+
*/
|
|
2325
|
+
dependencies?: SkillDependency[];
|
|
2326
|
+
/**
|
|
2327
|
+
* Markdown content with placeholders
|
|
2328
|
+
*/
|
|
2329
|
+
content: string;
|
|
2330
|
+
}
|
|
2331
|
+
/**
|
|
2332
|
+
* Variables available for substitution in skill templates
|
|
2333
|
+
*/
|
|
2334
|
+
interface SkillVariables {
|
|
2335
|
+
PROJECT_NAME?: string;
|
|
2336
|
+
PROJECT_ROOT?: string;
|
|
2337
|
+
PROJECT_TYPE?: string;
|
|
2338
|
+
JIRA_PROJECT?: string;
|
|
2339
|
+
JIRA_URL?: string;
|
|
2340
|
+
LINEAR_TEAM?: string;
|
|
2341
|
+
GITHUB_REPO?: string;
|
|
2342
|
+
GITHUB_OWNER?: string;
|
|
2343
|
+
GITLAB_PROJECT?: string;
|
|
2344
|
+
DEFAULT_BRANCH?: string;
|
|
2345
|
+
CONFLUENCE_SPACE?: string;
|
|
2346
|
+
CONFLUENCE_URL?: string;
|
|
2347
|
+
NOTION_WORKSPACE?: string;
|
|
2348
|
+
DOCS_PATH?: string;
|
|
2349
|
+
LINT_CMD?: string;
|
|
2350
|
+
TEST_CMD?: string;
|
|
2351
|
+
BUILD_CMD?: string;
|
|
2352
|
+
STATIC_ANALYSIS_CMD?: string;
|
|
2353
|
+
PRIMARY_LANGUAGE?: string;
|
|
2354
|
+
[key: string]: string | undefined;
|
|
2355
|
+
}
|
|
2356
|
+
/**
|
|
2357
|
+
* Options for generating skills
|
|
2358
|
+
*/
|
|
2359
|
+
interface GenerateSkillsOptions {
|
|
2360
|
+
/**
|
|
2361
|
+
* Project root directory
|
|
2362
|
+
*/
|
|
2363
|
+
projectRoot?: string;
|
|
2364
|
+
/**
|
|
2365
|
+
* Output directory for generated skills
|
|
2366
|
+
* Default: .claude/commands
|
|
2367
|
+
*/
|
|
2368
|
+
outputDir?: string;
|
|
2369
|
+
/**
|
|
2370
|
+
* Directory containing custom skill templates
|
|
2371
|
+
*/
|
|
2372
|
+
customTemplatesDir?: string;
|
|
2373
|
+
/**
|
|
2374
|
+
* Whether to include core skills
|
|
2375
|
+
* Default: true
|
|
2376
|
+
*/
|
|
2377
|
+
includeCoreSkills?: boolean;
|
|
2378
|
+
/**
|
|
2379
|
+
* Whether to include optional skills based on integrations
|
|
2380
|
+
* Default: true
|
|
2381
|
+
*/
|
|
2382
|
+
includeOptionalSkills?: boolean;
|
|
2383
|
+
/**
|
|
2384
|
+
* Specific skills to generate (by name)
|
|
2385
|
+
* If not specified, generates all applicable skills
|
|
2386
|
+
*/
|
|
2387
|
+
skills?: string[];
|
|
2388
|
+
/**
|
|
2389
|
+
* Whether to overwrite existing skills
|
|
2390
|
+
* Default: false
|
|
2391
|
+
*/
|
|
2392
|
+
overwrite?: boolean;
|
|
2393
|
+
/**
|
|
2394
|
+
* Additional variables for substitution
|
|
2395
|
+
*/
|
|
2396
|
+
variables?: Record<string, string>;
|
|
2397
|
+
}
|
|
2398
|
+
/**
|
|
2399
|
+
* Result of generating a single skill
|
|
2400
|
+
*/
|
|
2401
|
+
interface GeneratedSkill {
|
|
2402
|
+
/**
|
|
2403
|
+
* Skill name
|
|
2404
|
+
*/
|
|
2405
|
+
name: string;
|
|
2406
|
+
/**
|
|
2407
|
+
* Category of the skill
|
|
2408
|
+
*/
|
|
2409
|
+
category: SkillCategory;
|
|
2410
|
+
/**
|
|
2411
|
+
* Output path where skill was written
|
|
2412
|
+
*/
|
|
2413
|
+
outputPath: string;
|
|
2414
|
+
/**
|
|
2415
|
+
* Whether the skill was newly created or updated
|
|
2416
|
+
*/
|
|
2417
|
+
action: 'created' | 'updated' | 'skipped';
|
|
2418
|
+
/**
|
|
2419
|
+
* Reason for skipping (if applicable)
|
|
2420
|
+
*/
|
|
2421
|
+
skipReason?: string;
|
|
2422
|
+
}
|
|
2423
|
+
/**
|
|
2424
|
+
* Error from skill generation
|
|
2425
|
+
*/
|
|
2426
|
+
interface SkillError {
|
|
2427
|
+
/**
|
|
2428
|
+
* Skill name that failed
|
|
2429
|
+
*/
|
|
2430
|
+
name: string;
|
|
2431
|
+
/**
|
|
2432
|
+
* Error message
|
|
2433
|
+
*/
|
|
2434
|
+
error: string;
|
|
2435
|
+
}
|
|
2436
|
+
/**
|
|
2437
|
+
* Result of skill generation
|
|
2438
|
+
*/
|
|
2439
|
+
interface GenerateSkillsResult {
|
|
2440
|
+
/**
|
|
2441
|
+
* Successfully generated skills
|
|
2442
|
+
*/
|
|
2443
|
+
generated: GeneratedSkill[];
|
|
2444
|
+
/**
|
|
2445
|
+
* Skills that failed to generate
|
|
2446
|
+
*/
|
|
2447
|
+
errors: SkillError[];
|
|
2448
|
+
/**
|
|
2449
|
+
* Variables used for substitution
|
|
2450
|
+
*/
|
|
2451
|
+
variables: SkillVariables;
|
|
2452
|
+
}
|
|
2453
|
+
|
|
2454
|
+
/**
|
|
2455
|
+
* Skill Generator
|
|
2456
|
+
*
|
|
2457
|
+
* Generates Claude skills from templates based on project configuration.
|
|
2458
|
+
* Skills are output to .claude/commands/ directory.
|
|
2459
|
+
*/
|
|
2460
|
+
|
|
2461
|
+
/**
|
|
2462
|
+
* Extract variables from config for template substitution
|
|
2463
|
+
*/
|
|
2464
|
+
declare function extractVariables(config?: ResolvedCoreAIConfig | null): SkillVariables;
|
|
2465
|
+
/**
|
|
2466
|
+
* Substitute variables in template content
|
|
2467
|
+
*/
|
|
2468
|
+
declare function substituteVariables(content: string, variables: SkillVariables): string;
|
|
2469
|
+
/**
|
|
2470
|
+
* Check if a skill's dependencies are satisfied
|
|
2471
|
+
*/
|
|
2472
|
+
declare function checkDependencies(skill: SkillTemplate, config?: ResolvedCoreAIConfig | null): {
|
|
2473
|
+
satisfied: boolean;
|
|
2474
|
+
missing: SkillDependency[];
|
|
2475
|
+
};
|
|
2476
|
+
/**
|
|
2477
|
+
* Load custom skill templates from a directory
|
|
2478
|
+
*/
|
|
2479
|
+
declare function loadCustomTemplates(templatesDir: string): SkillTemplate[];
|
|
2480
|
+
/**
|
|
2481
|
+
* Generate skills from templates
|
|
2482
|
+
*/
|
|
2483
|
+
declare function generateSkills(config: ResolvedCoreAIConfig | undefined, options?: GenerateSkillsOptions): GenerateSkillsResult;
|
|
2484
|
+
/**
|
|
2485
|
+
* Format skill generation result for display
|
|
2486
|
+
*/
|
|
2487
|
+
declare function formatGenerateResult(result: GenerateSkillsResult): string;
|
|
2488
|
+
|
|
2489
|
+
/**
|
|
2490
|
+
* Built-in Skill Templates
|
|
2491
|
+
*
|
|
2492
|
+
* Core skill templates that are included with CoreAI.
|
|
2493
|
+
* These templates use {{VARIABLE}} placeholders for substitution.
|
|
2494
|
+
*/
|
|
2495
|
+
|
|
2496
|
+
/**
|
|
2497
|
+
* All built-in skill templates
|
|
2498
|
+
*/
|
|
2499
|
+
declare const builtInSkills: SkillTemplate[];
|
|
2500
|
+
|
|
2501
|
+
/**
|
|
2502
|
+
* KnowledgeLibrary Types
|
|
2503
|
+
*
|
|
2504
|
+
* Type definitions for local agent state management.
|
|
2505
|
+
*/
|
|
2506
|
+
/**
|
|
2507
|
+
* Message type for inbox/outbox messages
|
|
2508
|
+
*/
|
|
2509
|
+
type MessageType = 'task-assignment' | 'completion-report' | 'review-request' | 'feedback' | 'status-update' | 'question' | 'response';
|
|
2510
|
+
/**
|
|
2511
|
+
* Priority levels for messages
|
|
2512
|
+
*/
|
|
2513
|
+
type MessagePriority = 'P0' | 'P1' | 'P2' | 'P3';
|
|
2514
|
+
/**
|
|
2515
|
+
* Message metadata from frontmatter
|
|
2516
|
+
*/
|
|
2517
|
+
interface MessageMetadata {
|
|
2518
|
+
/**
|
|
2519
|
+
* Message type
|
|
2520
|
+
*/
|
|
2521
|
+
type: MessageType;
|
|
2522
|
+
/**
|
|
2523
|
+
* Sender agent name
|
|
2524
|
+
*/
|
|
2525
|
+
from: string;
|
|
2526
|
+
/**
|
|
2527
|
+
* Recipient agent name
|
|
2528
|
+
*/
|
|
2529
|
+
to: string;
|
|
2530
|
+
/**
|
|
2531
|
+
* Timestamp of the message
|
|
2532
|
+
*/
|
|
2533
|
+
date: Date;
|
|
2534
|
+
/**
|
|
2535
|
+
* Associated ticket key (optional)
|
|
2536
|
+
*/
|
|
2537
|
+
ticket?: string;
|
|
2538
|
+
/**
|
|
2539
|
+
* Message priority (optional)
|
|
2540
|
+
*/
|
|
2541
|
+
priority?: MessagePriority;
|
|
2542
|
+
/**
|
|
2543
|
+
* Message subject
|
|
2544
|
+
*/
|
|
2545
|
+
subject?: string;
|
|
2546
|
+
}
|
|
2547
|
+
/**
|
|
2548
|
+
* An inbox/outbox message
|
|
2549
|
+
*/
|
|
2550
|
+
interface Message {
|
|
2551
|
+
/**
|
|
2552
|
+
* Message filename
|
|
2553
|
+
*/
|
|
2554
|
+
filename: string;
|
|
2555
|
+
/**
|
|
2556
|
+
* Full file path
|
|
2557
|
+
*/
|
|
2558
|
+
path: string;
|
|
2559
|
+
/**
|
|
2560
|
+
* Message metadata from frontmatter
|
|
2561
|
+
*/
|
|
2562
|
+
metadata: MessageMetadata;
|
|
2563
|
+
/**
|
|
2564
|
+
* Raw message content (including frontmatter)
|
|
2565
|
+
*/
|
|
2566
|
+
rawContent: string;
|
|
2567
|
+
/**
|
|
2568
|
+
* Message body (excluding frontmatter)
|
|
2569
|
+
*/
|
|
2570
|
+
body: string;
|
|
2571
|
+
}
|
|
2572
|
+
/**
|
|
2573
|
+
* Agent context state
|
|
2574
|
+
*/
|
|
2575
|
+
interface AgentContext {
|
|
2576
|
+
/**
|
|
2577
|
+
* Current task or assignment
|
|
2578
|
+
*/
|
|
2579
|
+
currentTask?: string;
|
|
2580
|
+
/**
|
|
2581
|
+
* Current ticket being worked on
|
|
2582
|
+
*/
|
|
2583
|
+
currentTicket?: string;
|
|
2584
|
+
/**
|
|
2585
|
+
* Current state/status
|
|
2586
|
+
*/
|
|
2587
|
+
status?: string;
|
|
2588
|
+
/**
|
|
2589
|
+
* Last updated timestamp
|
|
2590
|
+
*/
|
|
2591
|
+
lastUpdated: Date;
|
|
2592
|
+
/**
|
|
2593
|
+
* Additional context notes
|
|
2594
|
+
*/
|
|
2595
|
+
notes?: string;
|
|
2596
|
+
}
|
|
2597
|
+
/**
|
|
2598
|
+
* Agent objective entry
|
|
2599
|
+
*/
|
|
2600
|
+
interface Objective {
|
|
2601
|
+
/**
|
|
2602
|
+
* Objective description
|
|
2603
|
+
*/
|
|
2604
|
+
description: string;
|
|
2605
|
+
/**
|
|
2606
|
+
* Success criteria
|
|
2607
|
+
*/
|
|
2608
|
+
successCriteria?: string[];
|
|
2609
|
+
/**
|
|
2610
|
+
* Deadline (optional)
|
|
2611
|
+
*/
|
|
2612
|
+
deadline?: Date;
|
|
2613
|
+
/**
|
|
2614
|
+
* Priority
|
|
2615
|
+
*/
|
|
2616
|
+
priority?: MessagePriority;
|
|
2617
|
+
/**
|
|
2618
|
+
* Status
|
|
2619
|
+
*/
|
|
2620
|
+
status: 'pending' | 'in_progress' | 'completed' | 'blocked';
|
|
2621
|
+
}
|
|
2622
|
+
/**
|
|
2623
|
+
* Decision log entry
|
|
2624
|
+
*/
|
|
2625
|
+
interface Decision {
|
|
2626
|
+
/**
|
|
2627
|
+
* Decision timestamp
|
|
2628
|
+
*/
|
|
2629
|
+
date: Date;
|
|
2630
|
+
/**
|
|
2631
|
+
* What was decided
|
|
2632
|
+
*/
|
|
2633
|
+
decision: string;
|
|
2634
|
+
/**
|
|
2635
|
+
* Context/reasoning
|
|
2636
|
+
*/
|
|
2637
|
+
reasoning?: string;
|
|
2638
|
+
/**
|
|
2639
|
+
* Related ticket or task
|
|
2640
|
+
*/
|
|
2641
|
+
relatedTo?: string;
|
|
2642
|
+
}
|
|
2643
|
+
/**
|
|
2644
|
+
* Dependency tracking entry
|
|
2645
|
+
*/
|
|
2646
|
+
interface Dependency {
|
|
2647
|
+
/**
|
|
2648
|
+
* What this agent/task depends on
|
|
2649
|
+
*/
|
|
2650
|
+
blockedBy?: string[];
|
|
2651
|
+
/**
|
|
2652
|
+
* What depends on this agent/task
|
|
2653
|
+
*/
|
|
2654
|
+
blocking?: string[];
|
|
2655
|
+
/**
|
|
2656
|
+
* Last updated
|
|
2657
|
+
*/
|
|
2658
|
+
lastUpdated: Date;
|
|
2659
|
+
}
|
|
2660
|
+
/**
|
|
2661
|
+
* Agent control state (objectives, decisions, dependencies)
|
|
2662
|
+
*/
|
|
2663
|
+
interface AgentControl {
|
|
2664
|
+
objectives: Objective[];
|
|
2665
|
+
decisions: Decision[];
|
|
2666
|
+
dependencies: Dependency;
|
|
2667
|
+
}
|
|
2668
|
+
/**
|
|
2669
|
+
* Directory paths within an agent's KnowledgeLibrary
|
|
2670
|
+
*/
|
|
2671
|
+
interface AgentDirectories {
|
|
2672
|
+
/**
|
|
2673
|
+
* Root directory for this agent
|
|
2674
|
+
*/
|
|
2675
|
+
root: string;
|
|
2676
|
+
/**
|
|
2677
|
+
* Inbox for incoming messages
|
|
2678
|
+
*/
|
|
2679
|
+
inbox: string;
|
|
2680
|
+
/**
|
|
2681
|
+
* Processed messages archive
|
|
2682
|
+
*/
|
|
2683
|
+
inboxProcessed: string;
|
|
2684
|
+
/**
|
|
2685
|
+
* Outbox for sent messages
|
|
2686
|
+
*/
|
|
2687
|
+
outbox: string;
|
|
2688
|
+
/**
|
|
2689
|
+
* Context directory
|
|
2690
|
+
*/
|
|
2691
|
+
context: string;
|
|
2692
|
+
/**
|
|
2693
|
+
* Control directory (objectives, decisions, dependencies)
|
|
2694
|
+
*/
|
|
2695
|
+
control: string;
|
|
2696
|
+
/**
|
|
2697
|
+
* Historical records
|
|
2698
|
+
*/
|
|
2699
|
+
history: string;
|
|
2700
|
+
/**
|
|
2701
|
+
* Technical notes and research
|
|
2702
|
+
*/
|
|
2703
|
+
tech: string;
|
|
2704
|
+
}
|
|
2705
|
+
/**
|
|
2706
|
+
* Full KnowledgeLibrary state for an agent
|
|
2707
|
+
*/
|
|
2708
|
+
interface AgentKnowledgeState {
|
|
2709
|
+
/**
|
|
2710
|
+
* Agent name/identifier
|
|
2711
|
+
*/
|
|
2712
|
+
agentName: string;
|
|
2713
|
+
/**
|
|
2714
|
+
* Directory paths
|
|
2715
|
+
*/
|
|
2716
|
+
directories: AgentDirectories;
|
|
2717
|
+
/**
|
|
2718
|
+
* Current context
|
|
2719
|
+
*/
|
|
2720
|
+
context?: AgentContext;
|
|
2721
|
+
/**
|
|
2722
|
+
* Control state
|
|
2723
|
+
*/
|
|
2724
|
+
control?: AgentControl;
|
|
2725
|
+
/**
|
|
2726
|
+
* Unprocessed inbox messages
|
|
2727
|
+
*/
|
|
2728
|
+
pendingMessages: Message[];
|
|
2729
|
+
/**
|
|
2730
|
+
* Initialization status
|
|
2731
|
+
*/
|
|
2732
|
+
initialized: boolean;
|
|
2733
|
+
}
|
|
2734
|
+
/**
|
|
2735
|
+
* Options for initializing KnowledgeLibrary
|
|
2736
|
+
*/
|
|
2737
|
+
interface InitKnowledgeLibraryOptions {
|
|
2738
|
+
/**
|
|
2739
|
+
* Project root directory
|
|
2740
|
+
*/
|
|
2741
|
+
projectRoot?: string;
|
|
2742
|
+
/**
|
|
2743
|
+
* Base directory for KnowledgeLibrary
|
|
2744
|
+
* Default: KnowledgeLibrary
|
|
2745
|
+
*/
|
|
2746
|
+
basePath?: string;
|
|
2747
|
+
/**
|
|
2748
|
+
* Whether to create default files
|
|
2749
|
+
*/
|
|
2750
|
+
createDefaults?: boolean;
|
|
2751
|
+
}
|
|
2752
|
+
/**
|
|
2753
|
+
* Result of KnowledgeLibrary initialization
|
|
2754
|
+
*/
|
|
2755
|
+
interface InitKnowledgeLibraryResult {
|
|
2756
|
+
/**
|
|
2757
|
+
* Whether initialization was successful
|
|
2758
|
+
*/
|
|
2759
|
+
success: boolean;
|
|
2760
|
+
/**
|
|
2761
|
+
* Created directories
|
|
2762
|
+
*/
|
|
2763
|
+
createdDirs: string[];
|
|
2764
|
+
/**
|
|
2765
|
+
* Created files
|
|
2766
|
+
*/
|
|
2767
|
+
createdFiles: string[];
|
|
2768
|
+
/**
|
|
2769
|
+
* Error message if failed
|
|
2770
|
+
*/
|
|
2771
|
+
error?: string;
|
|
2772
|
+
}
|
|
2773
|
+
/**
|
|
2774
|
+
* Options for reading messages
|
|
2775
|
+
*/
|
|
2776
|
+
interface ReadMessagesOptions {
|
|
2777
|
+
/**
|
|
2778
|
+
* Filter by message type
|
|
2779
|
+
*/
|
|
2780
|
+
type?: MessageType;
|
|
2781
|
+
/**
|
|
2782
|
+
* Filter by sender
|
|
2783
|
+
*/
|
|
2784
|
+
from?: string;
|
|
2785
|
+
/**
|
|
2786
|
+
* Filter by priority
|
|
2787
|
+
*/
|
|
2788
|
+
priority?: MessagePriority;
|
|
2789
|
+
/**
|
|
2790
|
+
* Include processed messages
|
|
2791
|
+
*/
|
|
2792
|
+
includeProcessed?: boolean;
|
|
2793
|
+
/**
|
|
2794
|
+
* Maximum number of messages to return
|
|
2795
|
+
*/
|
|
2796
|
+
limit?: number;
|
|
2797
|
+
}
|
|
2798
|
+
/**
|
|
2799
|
+
* Options for writing a message
|
|
2800
|
+
*/
|
|
2801
|
+
interface WriteMessageOptions {
|
|
2802
|
+
/**
|
|
2803
|
+
* Message type
|
|
2804
|
+
*/
|
|
2805
|
+
type: MessageType;
|
|
2806
|
+
/**
|
|
2807
|
+
* Sender agent
|
|
2808
|
+
*/
|
|
2809
|
+
from: string;
|
|
2810
|
+
/**
|
|
2811
|
+
* Recipient agent
|
|
2812
|
+
*/
|
|
2813
|
+
to: string;
|
|
2814
|
+
/**
|
|
2815
|
+
* Message subject
|
|
2816
|
+
*/
|
|
2817
|
+
subject: string;
|
|
2818
|
+
/**
|
|
2819
|
+
* Message body content
|
|
2820
|
+
*/
|
|
2821
|
+
body: string;
|
|
2822
|
+
/**
|
|
2823
|
+
* Associated ticket key
|
|
2824
|
+
*/
|
|
2825
|
+
ticket?: string;
|
|
2826
|
+
/**
|
|
2827
|
+
* Message priority
|
|
2828
|
+
*/
|
|
2829
|
+
priority?: MessagePriority;
|
|
2830
|
+
}
|
|
2831
|
+
/**
|
|
2832
|
+
* Global KnowledgeLibrary state
|
|
2833
|
+
*/
|
|
2834
|
+
interface KnowledgeLibraryState {
|
|
2835
|
+
/**
|
|
2836
|
+
* Base path for KnowledgeLibrary
|
|
2837
|
+
*/
|
|
2838
|
+
basePath: string;
|
|
2839
|
+
/**
|
|
2840
|
+
* Global context file path
|
|
2841
|
+
*/
|
|
2842
|
+
contextPath: string;
|
|
2843
|
+
/**
|
|
2844
|
+
* Architecture notes file path
|
|
2845
|
+
*/
|
|
2846
|
+
architecturePath: string;
|
|
2847
|
+
/**
|
|
2848
|
+
* PRD file path
|
|
2849
|
+
*/
|
|
2850
|
+
prdPath: string;
|
|
2851
|
+
/**
|
|
2852
|
+
* List of initialized agents
|
|
2853
|
+
*/
|
|
2854
|
+
agents: string[];
|
|
2855
|
+
}
|
|
2856
|
+
|
|
2857
|
+
/**
|
|
2858
|
+
* KnowledgeLibrary Manager
|
|
2859
|
+
*
|
|
2860
|
+
* Manages the KnowledgeLibrary directory structure and agent state.
|
|
2861
|
+
*/
|
|
2862
|
+
|
|
2863
|
+
/**
|
|
2864
|
+
* Default KnowledgeLibrary base path
|
|
2865
|
+
*/
|
|
2866
|
+
declare const DEFAULT_KNOWLEDGE_LIBRARY_PATH = "KnowledgeLibrary";
|
|
2867
|
+
/**
|
|
2868
|
+
* Standard files in a KnowledgeLibrary
|
|
2869
|
+
*/
|
|
2870
|
+
declare const STANDARD_FILES: {
|
|
2871
|
+
readonly context: "context.txt";
|
|
2872
|
+
readonly architecture: "architecture.txt";
|
|
2873
|
+
readonly prd: "prd.txt";
|
|
2874
|
+
};
|
|
2875
|
+
/**
|
|
2876
|
+
* Standard directories for each agent
|
|
2877
|
+
*/
|
|
2878
|
+
declare const AGENT_DIRECTORIES: readonly ["inbox", "inbox/processed", "outbox", "context", "control", "history", "tech"];
|
|
2879
|
+
/**
|
|
2880
|
+
* Standard files in an agent's control directory
|
|
2881
|
+
*/
|
|
2882
|
+
declare const CONTROL_FILES: {
|
|
2883
|
+
readonly objectives: "objectives.txt";
|
|
2884
|
+
readonly decisions: "decisions.txt";
|
|
2885
|
+
readonly dependencies: "dependencies.txt";
|
|
2886
|
+
};
|
|
2887
|
+
/**
|
|
2888
|
+
* Get the path to an agent's directories
|
|
2889
|
+
*/
|
|
2890
|
+
declare function getAgentDirectories(basePath: string, agentName: string): AgentDirectories;
|
|
2891
|
+
/**
|
|
2892
|
+
* Initialize the KnowledgeLibrary base structure
|
|
2893
|
+
*/
|
|
2894
|
+
declare function initKnowledgeLibrary(options?: InitKnowledgeLibraryOptions): InitKnowledgeLibraryResult;
|
|
2895
|
+
/**
|
|
2896
|
+
* Initialize an agent's KnowledgeLibrary directories
|
|
2897
|
+
*/
|
|
2898
|
+
declare function initAgentKnowledgeLibrary(agentName: string, options?: InitKnowledgeLibraryOptions): InitKnowledgeLibraryResult;
|
|
2899
|
+
/**
|
|
2900
|
+
* Check if a KnowledgeLibrary exists for an agent
|
|
2901
|
+
*/
|
|
2902
|
+
declare function agentKnowledgeLibraryExists(agentName: string, options?: {
|
|
2903
|
+
projectRoot?: string;
|
|
2904
|
+
basePath?: string;
|
|
2905
|
+
}): boolean;
|
|
2906
|
+
/**
|
|
2907
|
+
* Get the KnowledgeLibrary state for an agent
|
|
2908
|
+
*/
|
|
2909
|
+
declare function getAgentKnowledgeState(agentName: string, options?: {
|
|
2910
|
+
projectRoot?: string;
|
|
2911
|
+
basePath?: string;
|
|
2912
|
+
}): AgentKnowledgeState;
|
|
2913
|
+
/**
|
|
2914
|
+
* Generate a message filename
|
|
2915
|
+
*/
|
|
2916
|
+
declare function generateMessageFilename(from: string, subject: string): string;
|
|
2917
|
+
/**
|
|
2918
|
+
* Read inbox messages for an agent
|
|
2919
|
+
*/
|
|
2920
|
+
declare function readInboxMessages(agentName: string, options?: {
|
|
2921
|
+
projectRoot?: string;
|
|
2922
|
+
basePath?: string;
|
|
2923
|
+
} & ReadMessagesOptions): Message[];
|
|
2924
|
+
/**
|
|
2925
|
+
* Write a message to an agent's inbox
|
|
2926
|
+
*/
|
|
2927
|
+
declare function writeInboxMessage(options: WriteMessageOptions & {
|
|
2928
|
+
projectRoot?: string;
|
|
2929
|
+
basePath?: string;
|
|
2930
|
+
}): {
|
|
2931
|
+
success: boolean;
|
|
2932
|
+
path?: string;
|
|
2933
|
+
error?: string;
|
|
2934
|
+
};
|
|
2935
|
+
/**
|
|
2936
|
+
* Mark a message as processed (move to processed folder)
|
|
2937
|
+
*/
|
|
2938
|
+
declare function markMessageProcessed(agentName: string, messageFilename: string, options?: {
|
|
2939
|
+
projectRoot?: string;
|
|
2940
|
+
basePath?: string;
|
|
2941
|
+
}): {
|
|
2942
|
+
success: boolean;
|
|
2943
|
+
error?: string;
|
|
2944
|
+
};
|
|
2945
|
+
/**
|
|
2946
|
+
* Get global KnowledgeLibrary state
|
|
2947
|
+
*/
|
|
2948
|
+
declare function getKnowledgeLibraryState(options?: {
|
|
2949
|
+
projectRoot?: string;
|
|
2950
|
+
basePath?: string;
|
|
2951
|
+
}): KnowledgeLibraryState | null;
|
|
2952
|
+
/**
|
|
2953
|
+
* Update agent context
|
|
2954
|
+
*/
|
|
2955
|
+
declare function updateAgentContext(agentName: string, context: Partial<AgentContext>, options?: {
|
|
2956
|
+
projectRoot?: string;
|
|
2957
|
+
basePath?: string;
|
|
2958
|
+
}): {
|
|
2959
|
+
success: boolean;
|
|
2960
|
+
error?: string;
|
|
2961
|
+
};
|
|
2962
|
+
/**
|
|
2963
|
+
* Format KnowledgeLibrary state for display
|
|
2964
|
+
*/
|
|
2965
|
+
declare function formatKnowledgeLibraryState(state: KnowledgeLibraryState | null): string;
|
|
2966
|
+
/**
|
|
2967
|
+
* Format agent knowledge state for display
|
|
2968
|
+
*/
|
|
2969
|
+
declare function formatAgentKnowledgeState(state: AgentKnowledgeState): string;
|
|
2970
|
+
|
|
2971
|
+
/**
|
|
2972
|
+
* CoreAI - A configurable, team-ready AI agent orchestration platform.
|
|
2973
|
+
*
|
|
2974
|
+
* This is the main library export for programmatic usage.
|
|
2975
|
+
*/
|
|
2976
|
+
declare const VERSION = "0.1.0";
|
|
2977
|
+
|
|
2978
|
+
export { AGENT_DIRECTORIES, type Adapter, AdapterError, type AdapterErrorCode, AdapterFactory, type AdapterFactoryOptions, type AdapterImplementation, type AdapterInfo, type AdapterType, type AgentContext, type AgentControl, type AgentDefinition, type AgentDirectories, AgentError, type AgentErrorCode, type AgentKnowledgeState, type AgentMetadata, type AgentSource, type AgentType, type BaseAdapter, type BaseCommandOptions, CACHE_PATHS, CONTROL_FILES, type CacheConfig, type CacheEntry, CacheError, type CacheErrorCode, type CacheListOptions, type CacheManager$1 as CacheManager, type CacheManagerOptions, type CacheMetadata, type CacheOptions, type CacheProvider, type CacheSource, type CacheStats, type CacheStatus, type CommandArgumentDefinition, type CommandCategory, type CommandContext, type CommandDefinition, type CommandHandler, type CommandLoadResult, type CommandLoaderOptions, type CommandMetadata, type CommandOptionDefinition, CommandRegistry, type CommandResult, type CompileOptions, type CompileResult, ConfigError, type ConfigErrorCode, type ContextLoadResult, ContextLoader, type ContextLoaderOptions, type ContextSource, type CoreAIConfig, type CreateContextOptions, type CreateIssueData, type CreatePullRequestData, type CreateReviewData, DEFAULT_CACHE_CONFIG, DEFAULT_KNOWLEDGE_LIBRARY_PATH, type Decision, type Dependency, type DocumentationPage, type DocumentationProviderAdapter, type DocumentationQuery, type FetchOptions, CacheManager as FileCacheManager, FileCacheProvider, type FileCacheProviderOptions, type GenerateSkillsOptions, type GenerateSkillsResult, type GeneratedSkill, type GitProviderAdapter, type InitKnowledgeLibraryOptions, type InitKnowledgeLibraryResult, type IntegrationDependency, type IntegrationsConfig, type Issue, type IssueQuery, type IssueStatus, type IssueTrackerAdapter, type KnowledgeLibraryState, type LoadOptions, type MarkdownCommand, type Message, type MessageMetadata, type MessagePriority, type MessageType, type Objective, type ProjectConfig, type PullRequest, type PullRequestQuery, type PullRequestStatus, type QualityGatesConfig, type ReadMessagesOptions, type RegistryEntry, type RemoteFetcher, type ResolutionContext, ResolutionError, type ResolutionOptions, type ResolvedAgentDefinition, type ResolvedCoreAIConfig, type Review, type ReviewComment, type ReviewDecision, type RunCommandOptions, STANDARD_FILES, type SkillCategory, type SkillDependency, type SkillError, type SkillTemplate, type SkillVariables, type StateEntry, type StateOptions, type StateProviderAdapter, StepTracker, type SyncOptions, type SyncResult, type TeamConfig, type TechStackConfig, type UpdateIssueData, VERSION, type WorkflowType, type WriteMessageOptions, agentKnowledgeLibraryExists, builtInSkills, checkDependencies, cleanupContext, compileAgent, compileAgents, configExists, createAdapterFactory, createAdapterInfo, createCacheManager, createCommandContext, createCommandRegistry, createContextLoader, createDegradingHandler, createFileCacheProvider, executeWithDegradation, extractVariables as extractSkillVariables, extractVariables$1 as extractVariables, filterAgentsByTeam, findConfigFile, formatAgentKnowledgeState, formatGenerateResult, formatKnowledgeLibraryState, generateAgentMarkdown, generateMessageFilename, generateSkills, getAgentDirectories, getAgentKnowledgeState, getConfigPath, getCoreAgentsDir, getGlobalRegistry, getKnowledgeLibraryState, getRoleFromFilename, hasVariables, initAgentKnowledgeLibrary, initKnowledgeLibrary, loadAgentFromFile, loadAgentsFromDirectory, loadAllAgents, loadAllCommands, loadCommandFromFile, loadCommandsFromDirectory, loadConfig, loadConfigFromFile, loadCoreAICommands, loadCustomTemplates, markMessageProcessed, parseAgentYaml, readInboxMessages, resetGlobalRegistry, resolveAgentDefinition, resolveObject, resolveString, runCommand, substituteVariables, updateAgentContext, validateAgentDefinition, withContext, writeInboxMessage };
|