@compilr-dev/cli 0.5.11 → 0.5.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo.app +1 -1
- package/dist/.tsbuildinfo.data +1 -1
- package/dist/.tsbuildinfo.domain +1 -1
- package/dist/.tsbuildinfo.foundation +1 -1
- package/dist/agent.js +1 -1
- package/dist/anchors/index.d.ts +1 -1
- package/dist/anchors/index.js +1 -1
- package/dist/anchors/project-anchors.d.ts +9 -60
- package/dist/anchors/project-anchors.js +31 -173
- package/dist/commands-v2/handlers/session.js +2 -2
- package/dist/commands-v2/types.d.ts +1 -2
- package/dist/compilr-diff-companion.vsix +0 -0
- package/dist/multi-agent/capability-loader.js +1 -1
- package/dist/multi-agent/checkpointer.d.ts +5 -4
- package/dist/multi-agent/checkpointer.js +25 -5
- package/dist/multi-agent/custom-agents.d.ts +5 -62
- package/dist/multi-agent/custom-agents.js +10 -136
- package/dist/multi-agent/delegation-tracker.d.ts +5 -146
- package/dist/multi-agent/delegation-tracker.js +7 -218
- package/dist/multi-agent/index.d.ts +14 -18
- package/dist/multi-agent/index.js +22 -23
- package/dist/repl-v2.js +1 -1
- package/dist/settings/index.d.ts +3 -14
- package/dist/settings/index.js +5 -32
- package/dist/settings/mcp-config.d.ts +7 -54
- package/dist/settings/mcp-config.js +18 -104
- package/dist/tools/delegation-status.js +1 -1
- package/dist/tools/platform-adapter.d.ts +2 -12
- package/dist/tools/platform-adapter.js +52 -171
- package/dist/ui/overlay/impl/background-overlay-v2.d.ts +1 -1
- package/dist/ui/overlay/impl/custom-agent-form-overlay-v2.d.ts +1 -1
- package/dist/ui/overlay/impl/custom-agent-form-overlay-v2.js +1 -4
- package/dist/ui/overlay/impl/delegations-overlay-v2.js +1 -1
- package/dist/ui/overlay/impl/team-overlay-v2.d.ts +1 -1
- package/dist/ui/overlay/impl/team-overlay-v2.js +1 -1
- package/package.json +2 -2
package/dist/agent.js
CHANGED
|
@@ -9,7 +9,7 @@ import { Agent, ContextManager, DEFAULT_CONTEXT_CONFIG, createTaskTool, createSu
|
|
|
9
9
|
import { isAutoCompactEnabled, isDelegationEnabled, getSetting } from './settings/index.js';
|
|
10
10
|
import { getApiKey } from './utils/credentials.js';
|
|
11
11
|
import { createToolRegistry, createMinimalToolRegistry, getDirectTools, getMetaTools, initializeMetaTools, getToolIndexForSystemPrompt, getFilteredToolIndexForSystemPrompt, getToolStats, setMetaToolFilter, createToolFallback, getRegisteredMetaTools, } from './tools.js';
|
|
12
|
-
import { TOOL_GROUPS } from '
|
|
12
|
+
import { TOOL_GROUPS } from '@compilr-dev/sdk';
|
|
13
13
|
import { setCapabilityManager } from './multi-agent/capability-loader.js';
|
|
14
14
|
import { getAgentRegistry } from './agents/registry.js';
|
|
15
15
|
import { SystemPromptBuilder } from './system-prompt/index.js';
|
package/dist/anchors/index.d.ts
CHANGED
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* Re-exports the project-anchors API for managing persistent
|
|
5
5
|
* critical information that survives context compaction.
|
|
6
6
|
*/
|
|
7
|
-
export { getAnchorManager, getGlobalAnchorManager, clearProjectAnchors, getFormattedAnchors, addAnchor, getAllAnchors, getProjectsWithAnchors, getAnchorStats, clearManagerCache, } from './project-anchors.js';
|
|
7
|
+
export { getAnchorManager, getGlobalAnchorManager, getAnchorStore, setAnchorStore, clearProjectAnchors, getFormattedAnchors, addAnchor, getAllAnchors, getProjectsWithAnchors, getAnchorStats, clearManagerCache, } from './project-anchors.js';
|
|
8
8
|
export type { Anchor, AnchorInput, AnchorQueryOptions } from './project-anchors.js';
|
|
9
9
|
export { AnchorManager } from '@compilr-dev/sdk';
|
package/dist/anchors/index.js
CHANGED
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* Re-exports the project-anchors API for managing persistent
|
|
5
5
|
* critical information that survives context compaction.
|
|
6
6
|
*/
|
|
7
|
-
export { getAnchorManager, getGlobalAnchorManager, clearProjectAnchors, getFormattedAnchors, addAnchor, getAllAnchors, getProjectsWithAnchors, getAnchorStats, clearManagerCache, } from './project-anchors.js';
|
|
7
|
+
export { getAnchorManager, getGlobalAnchorManager, getAnchorStore, setAnchorStore, clearProjectAnchors, getFormattedAnchors, addAnchor, getAllAnchors, getProjectsWithAnchors, getAnchorStats, clearManagerCache, } from './project-anchors.js';
|
|
8
8
|
// Re-export the AnchorManager type from agents for consumers
|
|
9
9
|
export { AnchorManager } from '@compilr-dev/sdk';
|
|
@@ -1,79 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Project Anchors
|
|
2
|
+
* Project Anchors — Thin wrapper around SDK's ProjectAnchorStore.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* Storage structure:
|
|
8
|
-
* {dataPath}/anchors/
|
|
9
|
-
* ├── global.json # Non-project anchors
|
|
10
|
-
* └── project-{id}.json # Per-project anchors
|
|
4
|
+
* Provides the same function-level API the CLI has always used,
|
|
5
|
+
* backed by the shared ProjectAnchorStore from @compilr-dev/sdk.
|
|
11
6
|
*/
|
|
12
|
-
import {
|
|
13
|
-
import type { Anchor, AnchorInput, AnchorQueryOptions } from '@compilr-dev/sdk';
|
|
7
|
+
import { ProjectAnchorStore } from '@compilr-dev/sdk';
|
|
8
|
+
import type { Anchor, AnchorInput, AnchorQueryOptions, AnchorManager } from '@compilr-dev/sdk';
|
|
14
9
|
export type { Anchor, AnchorInput, AnchorQueryOptions };
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*
|
|
20
|
-
* @param projectId - Project ID, or null for global anchors
|
|
21
|
-
* @returns AnchorManager instance
|
|
22
|
-
*/
|
|
10
|
+
/** Get the singleton store (exposed for platform-adapter to use directly). */
|
|
11
|
+
export declare function getAnchorStore(): ProjectAnchorStore;
|
|
12
|
+
/** Replace the singleton store (for platform-adapter to inject one with getCurrentProjectId). */
|
|
13
|
+
export declare function setAnchorStore(s: ProjectAnchorStore): void;
|
|
23
14
|
export declare function getAnchorManager(projectId: string | null): AnchorManager;
|
|
24
|
-
/**
|
|
25
|
-
* Get the global anchor manager
|
|
26
|
-
*/
|
|
27
15
|
export declare function getGlobalAnchorManager(): AnchorManager;
|
|
28
|
-
/**
|
|
29
|
-
* Clear all anchors for a project
|
|
30
|
-
*
|
|
31
|
-
* Should be called when a project is deleted.
|
|
32
|
-
*
|
|
33
|
-
* @param projectId - Project ID to clear
|
|
34
|
-
* @returns Number of anchors removed
|
|
35
|
-
*/
|
|
36
16
|
export declare function clearProjectAnchors(projectId: string): number;
|
|
37
|
-
/**
|
|
38
|
-
* Get formatted anchor content for injection into system prompt
|
|
39
|
-
*
|
|
40
|
-
* Combines global anchors with project-specific anchors.
|
|
41
|
-
*
|
|
42
|
-
* @param projectId - Optional project ID to include project anchors
|
|
43
|
-
* @returns Formatted anchor string for system prompt
|
|
44
|
-
*/
|
|
45
17
|
export declare function getFormattedAnchors(projectId?: string): string;
|
|
46
|
-
/**
|
|
47
|
-
* Add an anchor
|
|
48
|
-
*
|
|
49
|
-
* Convenience function that routes to the appropriate manager.
|
|
50
|
-
*
|
|
51
|
-
* @param input - Anchor input with optional projectId
|
|
52
|
-
* @returns Created anchor
|
|
53
|
-
*/
|
|
54
18
|
export declare function addAnchor(input: AnchorInput & {
|
|
55
19
|
projectId?: string;
|
|
56
20
|
}): Anchor;
|
|
57
|
-
/**
|
|
58
|
-
* Get all anchors across all managers
|
|
59
|
-
*
|
|
60
|
-
* @param options - Query options
|
|
61
|
-
* @returns Array of all anchors
|
|
62
|
-
*/
|
|
63
21
|
export declare function getAllAnchors(options?: AnchorQueryOptions): Anchor[];
|
|
64
|
-
/**
|
|
65
|
-
* Get list of project IDs that have anchor files
|
|
66
|
-
*/
|
|
67
22
|
export declare function getProjectsWithAnchors(): string[];
|
|
68
|
-
/**
|
|
69
|
-
* Get anchor statistics
|
|
70
|
-
*/
|
|
71
23
|
export declare function getAnchorStats(): {
|
|
72
24
|
globalCount: number;
|
|
73
25
|
projectCounts: Map<string, number>;
|
|
74
26
|
totalTokens: number;
|
|
75
27
|
};
|
|
76
|
-
/**
|
|
77
|
-
* Clear all cached managers (useful for testing or refresh)
|
|
78
|
-
*/
|
|
79
28
|
export declare function clearManagerCache(): void;
|
|
@@ -1,202 +1,60 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Project Anchors
|
|
2
|
+
* Project Anchors — Thin wrapper around SDK's ProjectAnchorStore.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* Storage structure:
|
|
8
|
-
* {dataPath}/anchors/
|
|
9
|
-
* ├── global.json # Non-project anchors
|
|
10
|
-
* └── project-{id}.json # Per-project anchors
|
|
4
|
+
* Provides the same function-level API the CLI has always used,
|
|
5
|
+
* backed by the shared ProjectAnchorStore from @compilr-dev/sdk.
|
|
11
6
|
*/
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import { AnchorManager } from '@compilr-dev/sdk';
|
|
7
|
+
import { join } from 'path';
|
|
8
|
+
import { ProjectAnchorStore } from '@compilr-dev/sdk';
|
|
15
9
|
import { getDataPath } from '../settings/paths.js';
|
|
16
10
|
// =============================================================================
|
|
17
|
-
//
|
|
18
|
-
// =============================================================================
|
|
19
|
-
/**
|
|
20
|
-
* Cache of anchor managers by project ID (null = global)
|
|
21
|
-
*/
|
|
22
|
-
const managers = new Map();
|
|
11
|
+
// Singleton Store
|
|
23
12
|
// =============================================================================
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
13
|
+
let store = null;
|
|
14
|
+
function getStore() {
|
|
15
|
+
if (!store) {
|
|
16
|
+
store = new ProjectAnchorStore({
|
|
17
|
+
anchorsDir: join(getDataPath(), 'anchors'),
|
|
18
|
+
getCurrentProjectId: () => undefined, // Overridden by platform-adapter
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return store;
|
|
31
22
|
}
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
function getPersistPath(projectId) {
|
|
36
|
-
const anchorsDir = getAnchorsDir();
|
|
37
|
-
const filename = projectId ? `project-${projectId}.json` : 'global.json';
|
|
38
|
-
return path.join(anchorsDir, filename);
|
|
23
|
+
/** Get the singleton store (exposed for platform-adapter to use directly). */
|
|
24
|
+
export function getAnchorStore() {
|
|
25
|
+
return getStore();
|
|
39
26
|
}
|
|
40
|
-
/**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
function ensureAnchorsDir() {
|
|
44
|
-
const anchorsDir = getAnchorsDir();
|
|
45
|
-
if (!fs.existsSync(anchorsDir)) {
|
|
46
|
-
fs.mkdirSync(anchorsDir, { recursive: true });
|
|
47
|
-
}
|
|
27
|
+
/** Replace the singleton store (for platform-adapter to inject one with getCurrentProjectId). */
|
|
28
|
+
export function setAnchorStore(s) {
|
|
29
|
+
store = s;
|
|
48
30
|
}
|
|
49
31
|
// =============================================================================
|
|
50
|
-
// Public API
|
|
32
|
+
// Public API (delegates to store)
|
|
51
33
|
// =============================================================================
|
|
52
|
-
/**
|
|
53
|
-
* Get anchor manager for a project (or global if projectId is null)
|
|
54
|
-
*
|
|
55
|
-
* Creates a new manager if one doesn't exist, using file-based persistence.
|
|
56
|
-
*
|
|
57
|
-
* @param projectId - Project ID, or null for global anchors
|
|
58
|
-
* @returns AnchorManager instance
|
|
59
|
-
*/
|
|
60
34
|
export function getAnchorManager(projectId) {
|
|
61
|
-
|
|
62
|
-
const existing = managers.get(projectId);
|
|
63
|
-
if (existing)
|
|
64
|
-
return existing;
|
|
65
|
-
}
|
|
66
|
-
ensureAnchorsDir();
|
|
67
|
-
const manager = new AnchorManager({
|
|
68
|
-
persistPath: getPersistPath(projectId),
|
|
69
|
-
// Only include default safety anchors for global manager
|
|
70
|
-
includeDefaults: projectId === null,
|
|
71
|
-
maxAnchors: 50,
|
|
72
|
-
maxTokens: 4000,
|
|
73
|
-
});
|
|
74
|
-
managers.set(projectId, manager);
|
|
75
|
-
return manager;
|
|
35
|
+
return getStore().getManager(projectId);
|
|
76
36
|
}
|
|
77
|
-
/**
|
|
78
|
-
* Get the global anchor manager
|
|
79
|
-
*/
|
|
80
37
|
export function getGlobalAnchorManager() {
|
|
81
|
-
return
|
|
38
|
+
return getStore().getGlobalManager();
|
|
82
39
|
}
|
|
83
|
-
/**
|
|
84
|
-
* Clear all anchors for a project
|
|
85
|
-
*
|
|
86
|
-
* Should be called when a project is deleted.
|
|
87
|
-
*
|
|
88
|
-
* @param projectId - Project ID to clear
|
|
89
|
-
* @returns Number of anchors removed
|
|
90
|
-
*/
|
|
91
40
|
export function clearProjectAnchors(projectId) {
|
|
92
|
-
|
|
93
|
-
let removed = 0;
|
|
94
|
-
if (manager) {
|
|
95
|
-
removed = manager.clear();
|
|
96
|
-
managers.delete(projectId);
|
|
97
|
-
}
|
|
98
|
-
// Also delete the persistence file
|
|
99
|
-
const filePath = getPersistPath(projectId);
|
|
100
|
-
if (fs.existsSync(filePath)) {
|
|
101
|
-
fs.unlinkSync(filePath);
|
|
102
|
-
}
|
|
103
|
-
return removed;
|
|
41
|
+
return getStore().clearProjectAnchors(projectId);
|
|
104
42
|
}
|
|
105
|
-
/**
|
|
106
|
-
* Get formatted anchor content for injection into system prompt
|
|
107
|
-
*
|
|
108
|
-
* Combines global anchors with project-specific anchors.
|
|
109
|
-
*
|
|
110
|
-
* @param projectId - Optional project ID to include project anchors
|
|
111
|
-
* @returns Formatted anchor string for system prompt
|
|
112
|
-
*/
|
|
113
43
|
export function getFormattedAnchors(projectId) {
|
|
114
|
-
|
|
115
|
-
// Get global anchors
|
|
116
|
-
const globalManager = getGlobalAnchorManager();
|
|
117
|
-
const globalFormatted = globalManager.format();
|
|
118
|
-
if (globalFormatted) {
|
|
119
|
-
parts.push(globalFormatted);
|
|
120
|
-
}
|
|
121
|
-
// Get project-specific anchors if project ID provided
|
|
122
|
-
if (projectId) {
|
|
123
|
-
const projectManager = getAnchorManager(projectId);
|
|
124
|
-
const projectFormatted = projectManager.format();
|
|
125
|
-
if (projectFormatted) {
|
|
126
|
-
if (parts.length > 0) {
|
|
127
|
-
parts.push(''); // Empty line separator
|
|
128
|
-
parts.push(`### Project Anchors (${projectId})`);
|
|
129
|
-
}
|
|
130
|
-
parts.push(projectFormatted);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
return parts.join('\n');
|
|
44
|
+
return getStore().getFormattedAnchors(projectId);
|
|
134
45
|
}
|
|
135
|
-
/**
|
|
136
|
-
* Add an anchor
|
|
137
|
-
*
|
|
138
|
-
* Convenience function that routes to the appropriate manager.
|
|
139
|
-
*
|
|
140
|
-
* @param input - Anchor input with optional projectId
|
|
141
|
-
* @returns Created anchor
|
|
142
|
-
*/
|
|
143
46
|
export function addAnchor(input) {
|
|
144
|
-
|
|
145
|
-
return manager.add(input);
|
|
47
|
+
return getStore().addAnchor(input);
|
|
146
48
|
}
|
|
147
|
-
/**
|
|
148
|
-
* Get all anchors across all managers
|
|
149
|
-
*
|
|
150
|
-
* @param options - Query options
|
|
151
|
-
* @returns Array of all anchors
|
|
152
|
-
*/
|
|
153
49
|
export function getAllAnchors(options) {
|
|
154
|
-
|
|
155
|
-
for (const manager of managers.values()) {
|
|
156
|
-
allAnchors.push(...manager.getAll(options));
|
|
157
|
-
}
|
|
158
|
-
return allAnchors;
|
|
50
|
+
return getStore().getAllAnchors(options);
|
|
159
51
|
}
|
|
160
|
-
/**
|
|
161
|
-
* Get list of project IDs that have anchor files
|
|
162
|
-
*/
|
|
163
52
|
export function getProjectsWithAnchors() {
|
|
164
|
-
|
|
165
|
-
if (!fs.existsSync(anchorsDir)) {
|
|
166
|
-
return [];
|
|
167
|
-
}
|
|
168
|
-
const files = fs.readdirSync(anchorsDir);
|
|
169
|
-
const projectIds = [];
|
|
170
|
-
for (const file of files) {
|
|
171
|
-
const match = /^project-(.+)\.json$/.exec(file);
|
|
172
|
-
if (match && match[1]) {
|
|
173
|
-
projectIds.push(match[1]);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
return projectIds;
|
|
53
|
+
return getStore().getProjectsWithAnchors();
|
|
177
54
|
}
|
|
178
|
-
/**
|
|
179
|
-
* Get anchor statistics
|
|
180
|
-
*/
|
|
181
55
|
export function getAnchorStats() {
|
|
182
|
-
|
|
183
|
-
const projectCounts = new Map();
|
|
184
|
-
let totalTokens = globalManager.getTotalTokens();
|
|
185
|
-
// Load all project managers to get stats
|
|
186
|
-
for (const projectId of getProjectsWithAnchors()) {
|
|
187
|
-
const manager = getAnchorManager(projectId);
|
|
188
|
-
projectCounts.set(projectId, manager.size);
|
|
189
|
-
totalTokens += manager.getTotalTokens();
|
|
190
|
-
}
|
|
191
|
-
return {
|
|
192
|
-
globalCount: globalManager.size,
|
|
193
|
-
projectCounts,
|
|
194
|
-
totalTokens,
|
|
195
|
-
};
|
|
56
|
+
return getStore().getAnchorStats();
|
|
196
57
|
}
|
|
197
|
-
/**
|
|
198
|
-
* Clear all cached managers (useful for testing or refresh)
|
|
199
|
-
*/
|
|
200
58
|
export function clearManagerCache() {
|
|
201
|
-
|
|
59
|
+
getStore().clearCache();
|
|
202
60
|
}
|
|
@@ -148,7 +148,7 @@ export function saveCurrentTeam(team) {
|
|
|
148
148
|
// Save shared context
|
|
149
149
|
checkpointer.saveSharedContext(projectId, team.sharedContext);
|
|
150
150
|
// Save artifacts
|
|
151
|
-
team.artifactStore
|
|
151
|
+
checkpointer.saveArtifactStore(projectId, team.artifactStore);
|
|
152
152
|
}
|
|
153
153
|
/**
|
|
154
154
|
* Load the team for the current project.
|
|
@@ -502,7 +502,7 @@ export async function handleProjectSwitch(oldProjectId, agent, teamOptions, agen
|
|
|
502
502
|
try {
|
|
503
503
|
checkpointer.saveTeam(oldProjectId, teamOptions.team);
|
|
504
504
|
checkpointer.saveSharedContext(oldProjectId, teamOptions.team.sharedContext);
|
|
505
|
-
teamOptions.team.artifactStore
|
|
505
|
+
checkpointer.saveArtifactStore(oldProjectId, teamOptions.team.artifactStore);
|
|
506
506
|
}
|
|
507
507
|
catch {
|
|
508
508
|
// Best effort - continue even if save fails
|
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { Agent, ContextManager } from '@compilr-dev/sdk';
|
|
8
8
|
import type { TerminalUI, AgentMessage } from '../ui/terminal-ui.js';
|
|
9
|
-
import type { AgentTeam } from '
|
|
10
|
-
import type { BackgroundSessionInfo } from '../multi-agent/types.js';
|
|
9
|
+
import type { AgentTeam, BackgroundSessionInfo } from '@compilr-dev/sdk';
|
|
11
10
|
export type { BackgroundSessionInfo };
|
|
12
11
|
/**
|
|
13
12
|
* Context passed to V2 command handlers.
|
|
Binary file
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* (set by agent.ts during createAgent()). Provides a high-level function
|
|
6
6
|
* for slash command handlers to load capability packs required by a skill.
|
|
7
7
|
*/
|
|
8
|
-
import { SKILL_REQUIREMENTS } from '
|
|
8
|
+
import { SKILL_REQUIREMENTS } from '@compilr-dev/sdk';
|
|
9
9
|
// =============================================================================
|
|
10
10
|
// Module-level state
|
|
11
11
|
// =============================================================================
|
|
@@ -13,10 +13,7 @@
|
|
|
13
13
|
* ├── index.json
|
|
14
14
|
* └── {id}.json
|
|
15
15
|
*/
|
|
16
|
-
import type
|
|
17
|
-
import { AgentTeam, type AgentTeamConfig } from './team.js';
|
|
18
|
-
import { SharedContextManager } from './shared-context.js';
|
|
19
|
-
import { ArtifactStore } from './artifacts.js';
|
|
16
|
+
import { AgentTeam, ArtifactStore, SharedContextManager, type AgentTeamConfig, type SerializedTeamAgent, type TeamMetadata } from '@compilr-dev/sdk';
|
|
20
17
|
/**
|
|
21
18
|
* TeamCheckpointer handles persistence for multi-agent teams
|
|
22
19
|
*/
|
|
@@ -107,6 +104,10 @@ export declare class TeamCheckpointer {
|
|
|
107
104
|
* The ArtifactStore handles its own persistence
|
|
108
105
|
*/
|
|
109
106
|
getArtifactStore(projectId: number | null): ArtifactStore;
|
|
107
|
+
/**
|
|
108
|
+
* Save an artifact store to disk for a project
|
|
109
|
+
*/
|
|
110
|
+
saveArtifactStore(projectId: number | null, store: ArtifactStore): void;
|
|
110
111
|
/**
|
|
111
112
|
* Check if artifacts exist for this project
|
|
112
113
|
*/
|
|
@@ -15,9 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import * as fs from 'node:fs';
|
|
17
17
|
import * as path from 'node:path';
|
|
18
|
-
import { AgentTeam } from '
|
|
19
|
-
import { SharedContextManager } from './shared-context.js';
|
|
20
|
-
import { ArtifactStore } from './artifacts.js';
|
|
18
|
+
import { AgentTeam, ArtifactStore, SharedContextManager, } from '@compilr-dev/sdk';
|
|
21
19
|
import { getActiveTerminalSessionId } from './session-registry.js';
|
|
22
20
|
const ARTIFACTS_DIR = 'artifacts';
|
|
23
21
|
/**
|
|
@@ -341,11 +339,33 @@ export class TeamCheckpointer {
|
|
|
341
339
|
* The ArtifactStore handles its own persistence
|
|
342
340
|
*/
|
|
343
341
|
getArtifactStore(projectId) {
|
|
342
|
+
const store = new ArtifactStore();
|
|
344
343
|
const artifactsPath = this.getArtifactsPath(projectId);
|
|
345
|
-
const
|
|
346
|
-
|
|
344
|
+
const dataFile = path.join(artifactsPath, 'artifacts.json');
|
|
345
|
+
if (fs.existsSync(dataFile)) {
|
|
346
|
+
try {
|
|
347
|
+
const raw = fs.readFileSync(dataFile, 'utf-8');
|
|
348
|
+
const data = JSON.parse(raw);
|
|
349
|
+
store.restore(data);
|
|
350
|
+
}
|
|
351
|
+
catch {
|
|
352
|
+
// Corrupted file — start fresh
|
|
353
|
+
}
|
|
354
|
+
}
|
|
347
355
|
return store;
|
|
348
356
|
}
|
|
357
|
+
/**
|
|
358
|
+
* Save an artifact store to disk for a project
|
|
359
|
+
*/
|
|
360
|
+
saveArtifactStore(projectId, store) {
|
|
361
|
+
const artifactsPath = this.getArtifactsPath(projectId);
|
|
362
|
+
if (!fs.existsSync(artifactsPath)) {
|
|
363
|
+
fs.mkdirSync(artifactsPath, { recursive: true });
|
|
364
|
+
}
|
|
365
|
+
const dataFile = path.join(artifactsPath, 'artifacts.json');
|
|
366
|
+
const serialized = store.serialize();
|
|
367
|
+
fs.writeFileSync(dataFile, JSON.stringify(serialized, null, 2));
|
|
368
|
+
}
|
|
349
369
|
/**
|
|
350
370
|
* Check if artifacts exist for this project
|
|
351
371
|
*/
|
|
@@ -1,64 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Custom Agent Definitions
|
|
2
|
+
* Custom Agent Definitions - CLI Filesystem Layer
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Pure logic (types, validation, generation) lives in @compilr-dev/sdk.
|
|
5
|
+
* This file provides CLI-specific filesystem operations for loading/saving.
|
|
6
6
|
*/
|
|
7
|
-
import { type
|
|
8
|
-
|
|
9
|
-
export interface CustomAgentDefinition {
|
|
10
|
-
id: string;
|
|
11
|
-
displayName: string;
|
|
12
|
-
specialty: string;
|
|
13
|
-
personality?: string;
|
|
14
|
-
mascot: string;
|
|
15
|
-
createdAt: string;
|
|
16
|
-
toolConfig?: ToolConfig;
|
|
17
|
-
enabledSkills?: string[];
|
|
18
|
-
modelTier?: ModelTier;
|
|
19
|
-
}
|
|
20
|
-
export type { ToolConfig, ToolProfile };
|
|
21
|
-
/**
|
|
22
|
-
* Mascots available for custom agents.
|
|
23
|
-
* These are distinct from predefined role mascots.
|
|
24
|
-
*/
|
|
25
|
-
export declare const CUSTOM_MASCOTS: string[];
|
|
26
|
-
/**
|
|
27
|
-
* Assign a mascot from the available pool.
|
|
28
|
-
* Avoids mascots already in use by other custom agents.
|
|
29
|
-
*/
|
|
30
|
-
export declare function assignMascot(existingAgents: CustomAgentDefinition[]): string;
|
|
31
|
-
/**
|
|
32
|
-
* Generate system prompt for a custom agent.
|
|
33
|
-
* Uses a template-based approach (no LLM call).
|
|
34
|
-
* Includes tool awareness if the agent has tool restrictions.
|
|
35
|
-
*/
|
|
36
|
-
export declare function generateCustomAgentSystemPrompt(agent: CustomAgentDefinition): string;
|
|
37
|
-
/**
|
|
38
|
-
* Get the tool filter (list of allowed tools) for a custom agent.
|
|
39
|
-
* Returns undefined for full access (no filtering).
|
|
40
|
-
*/
|
|
41
|
-
export declare function getCustomAgentToolFilter(agent: CustomAgentDefinition): string[] | undefined;
|
|
42
|
-
/**
|
|
43
|
-
* Get the profile display name for a custom agent.
|
|
44
|
-
*/
|
|
45
|
-
export declare function getCustomAgentProfileLabel(agent: CustomAgentDefinition): string;
|
|
46
|
-
/**
|
|
47
|
-
* Validate agent ID format.
|
|
48
|
-
* Must be lowercase letters, numbers, and underscores.
|
|
49
|
-
* Must start with a letter.
|
|
50
|
-
*/
|
|
51
|
-
export declare function validateAgentId(id: string): {
|
|
52
|
-
valid: boolean;
|
|
53
|
-
error?: string;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Check if agent ID is already in use.
|
|
57
|
-
*/
|
|
58
|
-
export declare function isAgentIdTaken(id: string, existingCustomAgents: CustomAgentDefinition[], teamAgentIds: string[], predefinedRoleIds: string[]): {
|
|
59
|
-
taken: boolean;
|
|
60
|
-
reason?: string;
|
|
61
|
-
};
|
|
7
|
+
import { type CustomAgentDefinition } from '@compilr-dev/sdk';
|
|
8
|
+
export { type CustomAgentDefinition, type TeamToolConfig as ToolConfig, type ToolProfile, CUSTOM_MASCOTS, assignMascot, generateCustomAgentSystemPrompt, getCustomAgentToolFilter, getCustomAgentProfileLabel, validateAgentId, isAgentIdTaken, createCustomAgentDefinition, } from '@compilr-dev/sdk';
|
|
62
9
|
/**
|
|
63
10
|
* Load custom agents from project directory.
|
|
64
11
|
* Returns empty array if file doesn't exist.
|
|
@@ -77,7 +24,3 @@ export declare function addCustomAgent(projectPath: string, agent: CustomAgentDe
|
|
|
77
24
|
* Remove a custom agent by ID and save.
|
|
78
25
|
*/
|
|
79
26
|
export declare function removeCustomAgent(projectPath: string, agentId: string): boolean;
|
|
80
|
-
/**
|
|
81
|
-
* Create a new CustomAgentDefinition with auto-assigned mascot.
|
|
82
|
-
*/
|
|
83
|
-
export declare function createCustomAgentDefinition(id: string, displayName: string, specialty: string, personality: string | undefined, existingAgents: CustomAgentDefinition[], toolConfig?: ToolConfig, enabledSkills?: string[], modelTier?: ModelTier): CustomAgentDefinition;
|