@compilr-dev/sdk 0.1.28 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent.js +16 -4
- package/dist/config.d.ts +12 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.js +27 -1
- package/dist/team/activity.d.ts +21 -0
- package/dist/team/activity.js +34 -0
- package/dist/team/agent-selection.d.ts +53 -0
- package/dist/team/agent-selection.js +88 -0
- package/dist/team/artifacts.d.ts +175 -0
- package/dist/team/artifacts.js +279 -0
- package/dist/team/collision-utils.d.ts +16 -0
- package/dist/team/collision-utils.js +28 -0
- package/dist/team/context-resolver.d.ts +97 -0
- package/dist/team/context-resolver.js +322 -0
- package/dist/team/custom-agents.d.ts +68 -0
- package/dist/team/custom-agents.js +150 -0
- package/dist/team/delegation-tracker.d.ts +147 -0
- package/dist/team/delegation-tracker.js +215 -0
- package/dist/team/index.d.ts +34 -0
- package/dist/team/index.js +30 -0
- package/dist/team/interfaces.d.ts +36 -0
- package/dist/team/interfaces.js +7 -0
- package/dist/team/mention-parser.d.ts +64 -0
- package/dist/team/mention-parser.js +138 -0
- package/dist/team/shared-context.d.ts +293 -0
- package/dist/team/shared-context.js +673 -0
- package/dist/team/skill-requirements.d.ts +66 -0
- package/dist/team/skill-requirements.js +178 -0
- package/dist/team/task-assignment.d.ts +69 -0
- package/dist/team/task-assignment.js +123 -0
- package/dist/team/task-suggestion.d.ts +31 -0
- package/dist/team/task-suggestion.js +84 -0
- package/dist/team/team-agent.d.ts +201 -0
- package/dist/team/team-agent.js +492 -0
- package/dist/team/team.d.ts +297 -0
- package/dist/team/team.js +615 -0
- package/dist/team/tool-config.d.ts +110 -0
- package/dist/team/tool-config.js +739 -0
- package/dist/team/types.d.ts +211 -0
- package/dist/team/types.js +638 -0
- package/package.json +1 -1
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SharedContextManager - Shared context across team agents
|
|
3
|
+
*
|
|
4
|
+
* Provides a lightweight, token-budgeted context layer that's injected
|
|
5
|
+
* into all agent system prompts. Enables cross-agent knowledge sharing.
|
|
6
|
+
*
|
|
7
|
+
* Token Budget: ~4000 tokens (2% of 200K context)
|
|
8
|
+
*/
|
|
9
|
+
import type { ArtifactType, ArtifactSummary } from './artifacts.js';
|
|
10
|
+
/**
|
|
11
|
+
* Project information in shared context
|
|
12
|
+
*/
|
|
13
|
+
export interface SharedProjectInfo {
|
|
14
|
+
id: number | null;
|
|
15
|
+
name: string;
|
|
16
|
+
path: string;
|
|
17
|
+
memorySummary: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Team roster in shared context
|
|
21
|
+
*/
|
|
22
|
+
export interface SharedTeamInfo {
|
|
23
|
+
agents: string[];
|
|
24
|
+
activeAgent: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Team roster entry with full agent info for team awareness
|
|
28
|
+
*/
|
|
29
|
+
export interface TeamRosterEntry {
|
|
30
|
+
id: string;
|
|
31
|
+
displayName: string;
|
|
32
|
+
mascot: string;
|
|
33
|
+
role: string;
|
|
34
|
+
expertise: string[];
|
|
35
|
+
isActive: boolean;
|
|
36
|
+
todoCount?: number;
|
|
37
|
+
workItemCount?: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A decision made by an agent
|
|
41
|
+
*/
|
|
42
|
+
export interface SharedDecision {
|
|
43
|
+
id: string;
|
|
44
|
+
agent: string;
|
|
45
|
+
summary: string;
|
|
46
|
+
reasoning?: string;
|
|
47
|
+
timestamp: Date;
|
|
48
|
+
supersededBy?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Token budget tracking
|
|
52
|
+
*/
|
|
53
|
+
export interface TokenBudget {
|
|
54
|
+
max: number;
|
|
55
|
+
current: number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Activity type for team activity feed
|
|
59
|
+
*/
|
|
60
|
+
export type TeamActivityType = 'artifact_created' | 'artifact_updated' | 'task_completed' | 'decision_made';
|
|
61
|
+
/**
|
|
62
|
+
* Team activity entry for activity feed
|
|
63
|
+
*/
|
|
64
|
+
export interface TeamActivity {
|
|
65
|
+
agentId: string;
|
|
66
|
+
timestamp: Date;
|
|
67
|
+
action: TeamActivityType;
|
|
68
|
+
summary: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Full shared context structure
|
|
72
|
+
*/
|
|
73
|
+
export interface SharedContext {
|
|
74
|
+
project: SharedProjectInfo;
|
|
75
|
+
team: SharedTeamInfo;
|
|
76
|
+
decisions: SharedDecision[];
|
|
77
|
+
artifactIndex: ArtifactSummary[];
|
|
78
|
+
tokenBudget: TokenBudget;
|
|
79
|
+
updatedAt: Date;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Serialized shared context for persistence
|
|
83
|
+
*/
|
|
84
|
+
export interface SerializedSharedContext {
|
|
85
|
+
version: number;
|
|
86
|
+
project: {
|
|
87
|
+
id: number | null;
|
|
88
|
+
name: string;
|
|
89
|
+
path: string;
|
|
90
|
+
memorySummary: string;
|
|
91
|
+
};
|
|
92
|
+
decisions: Array<{
|
|
93
|
+
id: string;
|
|
94
|
+
agent: string;
|
|
95
|
+
summary: string;
|
|
96
|
+
reasoning?: string;
|
|
97
|
+
timestamp: string;
|
|
98
|
+
supersededBy?: string;
|
|
99
|
+
}>;
|
|
100
|
+
artifactIndex: Array<{
|
|
101
|
+
id: string;
|
|
102
|
+
name: string;
|
|
103
|
+
agent: string;
|
|
104
|
+
type: ArtifactType;
|
|
105
|
+
summary: string;
|
|
106
|
+
updatedAt: string;
|
|
107
|
+
}>;
|
|
108
|
+
updatedAt: string;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Manages shared context across all team agents
|
|
112
|
+
*/
|
|
113
|
+
export declare class SharedContextManager {
|
|
114
|
+
private readonly project;
|
|
115
|
+
private readonly team;
|
|
116
|
+
private teamRoster;
|
|
117
|
+
private recentActivity;
|
|
118
|
+
private decisions;
|
|
119
|
+
private artifactIndex;
|
|
120
|
+
private readonly tokenBudget;
|
|
121
|
+
private updatedAt;
|
|
122
|
+
constructor(options?: {
|
|
123
|
+
project?: Partial<SharedProjectInfo>;
|
|
124
|
+
maxTokens?: number;
|
|
125
|
+
});
|
|
126
|
+
/**
|
|
127
|
+
* Update project information
|
|
128
|
+
*/
|
|
129
|
+
setProject(project: Partial<SharedProjectInfo>): void;
|
|
130
|
+
/**
|
|
131
|
+
* Get project information
|
|
132
|
+
*/
|
|
133
|
+
getProject(): SharedProjectInfo;
|
|
134
|
+
/**
|
|
135
|
+
* Update team roster
|
|
136
|
+
*/
|
|
137
|
+
setTeam(agents: string[], activeAgent?: string): void;
|
|
138
|
+
/**
|
|
139
|
+
* Set active agent
|
|
140
|
+
*/
|
|
141
|
+
setActiveAgent(agentId: string): void;
|
|
142
|
+
/**
|
|
143
|
+
* Add an agent to the team
|
|
144
|
+
*/
|
|
145
|
+
addAgent(agentId: string): void;
|
|
146
|
+
/**
|
|
147
|
+
* Remove an agent from the team
|
|
148
|
+
*/
|
|
149
|
+
removeAgent(agentId: string): void;
|
|
150
|
+
/**
|
|
151
|
+
* Get team roster
|
|
152
|
+
*/
|
|
153
|
+
getTeam(): SharedTeamInfo;
|
|
154
|
+
/**
|
|
155
|
+
* Update the full team roster with agent details
|
|
156
|
+
* Called when team composition changes
|
|
157
|
+
*/
|
|
158
|
+
updateTeamRoster(entries: TeamRosterEntry[]): void;
|
|
159
|
+
/**
|
|
160
|
+
* Set active agent in the roster
|
|
161
|
+
* Called on agent switch
|
|
162
|
+
*/
|
|
163
|
+
setRosterActiveAgent(agentId: string): void;
|
|
164
|
+
/**
|
|
165
|
+
* Get the full team roster
|
|
166
|
+
*/
|
|
167
|
+
getTeamRoster(): TeamRosterEntry[];
|
|
168
|
+
/**
|
|
169
|
+
* Check if team roster is available (more than just default agent)
|
|
170
|
+
*/
|
|
171
|
+
hasTeamRoster(): boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Update task counts for an agent
|
|
174
|
+
* Called by REPL when todo list or work items change
|
|
175
|
+
*/
|
|
176
|
+
updateAgentTaskCounts(agentId: string, todoCount: number, workItemCount: number): void;
|
|
177
|
+
/**
|
|
178
|
+
* Update task counts for all agents
|
|
179
|
+
* Called with a map of agentId -> { todoCount, workItemCount }
|
|
180
|
+
*/
|
|
181
|
+
updateAllAgentTaskCounts(counts: Record<string, {
|
|
182
|
+
todoCount: number;
|
|
183
|
+
workItemCount: number;
|
|
184
|
+
}>): void;
|
|
185
|
+
/**
|
|
186
|
+
* Record a team activity
|
|
187
|
+
* Called when significant actions occur (artifact created, task completed, etc.)
|
|
188
|
+
*/
|
|
189
|
+
recordActivity(activity: Omit<TeamActivity, 'timestamp'>): void;
|
|
190
|
+
/**
|
|
191
|
+
* Get recent activity
|
|
192
|
+
*/
|
|
193
|
+
getRecentActivity(): TeamActivity[];
|
|
194
|
+
/**
|
|
195
|
+
* Check if there is recent activity to display
|
|
196
|
+
*/
|
|
197
|
+
hasRecentActivity(): boolean;
|
|
198
|
+
/**
|
|
199
|
+
* Clear activity feed
|
|
200
|
+
*/
|
|
201
|
+
clearActivity(): void;
|
|
202
|
+
/**
|
|
203
|
+
* Add a decision to the shared context
|
|
204
|
+
*/
|
|
205
|
+
addDecision(decision: Omit<SharedDecision, 'id' | 'timestamp'>): string;
|
|
206
|
+
/**
|
|
207
|
+
* Update/supersede a decision
|
|
208
|
+
*/
|
|
209
|
+
supersededDecision(oldId: string, newDecision: Omit<SharedDecision, 'id' | 'timestamp'>): string;
|
|
210
|
+
/**
|
|
211
|
+
* Get all decisions (active only by default)
|
|
212
|
+
*/
|
|
213
|
+
getDecisions(includeSuperseded?: boolean): SharedDecision[];
|
|
214
|
+
/**
|
|
215
|
+
* Clear all decisions
|
|
216
|
+
*/
|
|
217
|
+
clearDecisions(): void;
|
|
218
|
+
/**
|
|
219
|
+
* Update the artifact index (called by ArtifactStore)
|
|
220
|
+
*/
|
|
221
|
+
setArtifactIndex(index: ArtifactSummary[]): void;
|
|
222
|
+
/**
|
|
223
|
+
* Add an artifact to the index
|
|
224
|
+
*/
|
|
225
|
+
addArtifactToIndex(artifact: ArtifactSummary): void;
|
|
226
|
+
/**
|
|
227
|
+
* Remove an artifact from the index
|
|
228
|
+
*/
|
|
229
|
+
removeArtifactFromIndex(artifactId: string): void;
|
|
230
|
+
/**
|
|
231
|
+
* Get artifact index
|
|
232
|
+
*/
|
|
233
|
+
getArtifactIndex(): ArtifactSummary[];
|
|
234
|
+
/**
|
|
235
|
+
* Update token count based on current content
|
|
236
|
+
*/
|
|
237
|
+
private updateTokenCount;
|
|
238
|
+
/**
|
|
239
|
+
* Check if adding content would exceed budget
|
|
240
|
+
*/
|
|
241
|
+
wouldExceedBudget(additionalTokens: number): boolean;
|
|
242
|
+
/**
|
|
243
|
+
* Get token budget status
|
|
244
|
+
*/
|
|
245
|
+
getTokenBudget(): TokenBudget;
|
|
246
|
+
/**
|
|
247
|
+
* Get utilization percentage
|
|
248
|
+
*/
|
|
249
|
+
getUtilization(): number;
|
|
250
|
+
/**
|
|
251
|
+
* Format shared context for injection into system prompt.
|
|
252
|
+
* @param options.excludeRoster - If true, omit the team roster (it will be injected via anchor instead)
|
|
253
|
+
*/
|
|
254
|
+
format(options?: {
|
|
255
|
+
excludeRoster?: boolean;
|
|
256
|
+
}): string;
|
|
257
|
+
/**
|
|
258
|
+
* Format team roster as a table for team awareness
|
|
259
|
+
*/
|
|
260
|
+
formatTeamRoster(): string;
|
|
261
|
+
/**
|
|
262
|
+
* Build handoff suggestions based on team composition
|
|
263
|
+
*/
|
|
264
|
+
private buildHandoffSuggestions;
|
|
265
|
+
/**
|
|
266
|
+
* Format recent activity feed for team awareness
|
|
267
|
+
*/
|
|
268
|
+
private formatRecentActivity;
|
|
269
|
+
/**
|
|
270
|
+
* Format a timestamp as "Xm ago", "Xh ago", etc.
|
|
271
|
+
*/
|
|
272
|
+
private formatTimeAgo;
|
|
273
|
+
/**
|
|
274
|
+
* Format a compact version (for token-constrained situations)
|
|
275
|
+
*/
|
|
276
|
+
formatCompact(): string;
|
|
277
|
+
/**
|
|
278
|
+
* Mark as updated
|
|
279
|
+
*/
|
|
280
|
+
private touch;
|
|
281
|
+
/**
|
|
282
|
+
* Serialize for persistence
|
|
283
|
+
*/
|
|
284
|
+
serialize(): SerializedSharedContext;
|
|
285
|
+
/**
|
|
286
|
+
* Restore from serialized data
|
|
287
|
+
*/
|
|
288
|
+
static fromSerialized(data: SerializedSharedContext): SharedContextManager;
|
|
289
|
+
/**
|
|
290
|
+
* Get the full context object
|
|
291
|
+
*/
|
|
292
|
+
getContext(): SharedContext;
|
|
293
|
+
}
|