@compilr-dev/sdk 0.17.15 → 0.17.16
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/project-types/configs.js +21 -9
- package/dist/project-types/types.d.ts +13 -0
- package/dist/team/team-agent.d.ts +15 -1
- package/dist/team/team-agent.js +43 -0
- package/dist/team/team.d.ts +12 -0
- package/dist/team/team.js +37 -0
- package/package.json +1 -1
|
@@ -50,11 +50,11 @@ export const softwareConfig = {
|
|
|
50
50
|
},
|
|
51
51
|
],
|
|
52
52
|
suggestedAgents: [
|
|
53
|
-
{ role: '
|
|
54
|
-
{ role: '
|
|
53
|
+
{ role: 'dev', label: 'Developer', description: 'Writes and debugs code' },
|
|
54
|
+
{ role: 'arch', label: 'Architect', description: 'System design and technical decisions' },
|
|
55
55
|
{ role: 'qa', label: 'QA', description: 'Testing and quality assurance' },
|
|
56
56
|
{ role: 'pm', label: 'PM', description: 'Project planning and coordination' },
|
|
57
|
-
{ role: 'security', label: 'Security', description: 'Security review and hardening' },
|
|
57
|
+
{ role: 'security', label: 'Security Auditor', description: 'Security review and hardening' },
|
|
58
58
|
],
|
|
59
59
|
documentTemplates: [
|
|
60
60
|
{ type: 'prd', label: 'PRD', description: 'Product Requirements Document' },
|
|
@@ -485,13 +485,20 @@ export const contentConfig = {
|
|
|
485
485
|
role: 'strategist',
|
|
486
486
|
label: 'Content Strategist',
|
|
487
487
|
description: 'Planning, ideation, calendar, repurposing',
|
|
488
|
+
systemPromptAddition: 'You own the content STRATEGY — audience, pillars, editorial calendar, channel mix, and repurposing. Turn goals into a publishable plan and brief the copywriter and visual director. Think in campaigns and cadence, not one-off posts.',
|
|
488
489
|
},
|
|
489
490
|
{
|
|
490
491
|
role: 'writer',
|
|
491
492
|
label: 'Copywriter',
|
|
492
493
|
description: 'Headlines, captions, CTAs, long-form copy',
|
|
494
|
+
systemPromptAddition: 'You write the COPY — headlines, hooks, captions, CTAs, and long-form. Match the brand voice, write for the channel, and make every line earn attention. Hand visuals to the Visual Director.',
|
|
495
|
+
},
|
|
496
|
+
// Canonical `visual` role (Visual Director) — carries its own canvas-first prompt.
|
|
497
|
+
{
|
|
498
|
+
role: 'visual',
|
|
499
|
+
label: 'Visual Director',
|
|
500
|
+
description: 'Infographics, carousels, visual briefs',
|
|
493
501
|
},
|
|
494
|
-
{ role: 'designer', label: 'Visual Director', description: 'Visual briefs from Brand Model' },
|
|
495
502
|
{
|
|
496
503
|
role: 'editor',
|
|
497
504
|
label: 'Editor',
|
|
@@ -601,7 +608,7 @@ export const techDocsConfig = {
|
|
|
601
608
|
],
|
|
602
609
|
suggestedAgents: [
|
|
603
610
|
{
|
|
604
|
-
role: '
|
|
611
|
+
role: 'docs',
|
|
605
612
|
label: 'Technical Writer',
|
|
606
613
|
description: 'Clear technical writing and documentation',
|
|
607
614
|
},
|
|
@@ -711,9 +718,10 @@ export const courseConfig = {
|
|
|
711
718
|
description: 'Curriculum design, sequencing, pedagogy',
|
|
712
719
|
},
|
|
713
720
|
{
|
|
714
|
-
role: '
|
|
721
|
+
role: 'writer',
|
|
715
722
|
label: 'Content Designer',
|
|
716
723
|
description: 'Lesson planning, exercises, assessments',
|
|
724
|
+
systemPromptAddition: 'You are the INSTRUCTIONAL DESIGNER — turn learning objectives into lessons, activities, and assessments with clear scaffolding and pacing. Align every piece to an objective.',
|
|
717
725
|
},
|
|
718
726
|
{ role: 'reviewer', label: 'Reviewer', description: 'Pedagogical quality, balance, coverage' },
|
|
719
727
|
],
|
|
@@ -820,21 +828,25 @@ export const bookConfig = {
|
|
|
820
828
|
},
|
|
821
829
|
{ id: 'review', label: 'Review', description: 'Structural review', completionCheck: 'manual' },
|
|
822
830
|
],
|
|
831
|
+
// Three writer-based specialists — distinct prompts, distinct display names.
|
|
823
832
|
suggestedAgents: [
|
|
824
833
|
{
|
|
825
|
-
role: '
|
|
834
|
+
role: 'writer',
|
|
826
835
|
label: 'Plotter',
|
|
827
836
|
description: 'Story architecture, beats, pacing, plot threads',
|
|
837
|
+
systemPromptAddition: 'You own STRUCTURE — premise, arc, beats, pacing, and stakes across the whole book. Keep the throughline coherent and flag sagging middles. You outline; you do not prose scenes.',
|
|
828
838
|
},
|
|
829
839
|
{
|
|
830
|
-
role: '
|
|
840
|
+
role: 'writer',
|
|
831
841
|
label: 'Character Dev',
|
|
832
842
|
description: 'Characters, arcs, relationships, voice',
|
|
843
|
+
systemPromptAddition: 'You own CHARACTER — motivation, voice, arcs, and relationships. Keep each character consistent and growing, and ensure their voices are distinct.',
|
|
833
844
|
},
|
|
834
845
|
{
|
|
835
|
-
role: '
|
|
846
|
+
role: 'writer',
|
|
836
847
|
label: 'Scene Writer',
|
|
837
848
|
description: 'Scene construction, setting, POV, transitions',
|
|
849
|
+
systemPromptAddition: 'You write SCENES — prose that shows, with sensory detail, subtext, and momentum. Enter late, leave early; every scene turns on a change.',
|
|
838
850
|
},
|
|
839
851
|
],
|
|
840
852
|
documentTemplates: [
|
|
@@ -23,11 +23,24 @@ export interface ProjectPhase {
|
|
|
23
23
|
* A suggested agent role for this project type.
|
|
24
24
|
*/
|
|
25
25
|
export interface SuggestedAgent {
|
|
26
|
+
/** BASE canonical role the specialist runs on (dev, writer, strategist, …). */
|
|
26
27
|
role: string;
|
|
28
|
+
/** Display name — becomes the created agent's displayName (not the generic role name). */
|
|
27
29
|
label: string;
|
|
28
30
|
description: string;
|
|
29
31
|
/** Auto-add on project creation? */
|
|
30
32
|
autoAdd?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Specialist prompt appended to the base role's prompt — makes an advertised
|
|
35
|
+
* specialist real (e.g. a "Plotter" on the `writer` role). Optional: when
|
|
36
|
+
* absent, the agent is a plain base-role agent that just carries `label` as
|
|
37
|
+
* its display name. See specialized-team-agents-spec §4.
|
|
38
|
+
*/
|
|
39
|
+
systemPromptAddition?: string;
|
|
40
|
+
/** Optional tool-profile override when the base role's profile lacks a need. */
|
|
41
|
+
toolProfile?: string;
|
|
42
|
+
/** Optional extra skills to enable for this specialist. */
|
|
43
|
+
skills?: string[];
|
|
31
44
|
}
|
|
32
45
|
/**
|
|
33
46
|
* A document template available for this project type.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - Optional tool filtering
|
|
9
9
|
*/
|
|
10
10
|
import type { Agent, AgentConfig, ContextManager } from '@compilr-dev/agents';
|
|
11
|
-
import type { TeamAgentConfig, SerializedTeamAgent, MascotExpression, AgentRole } from './types.js';
|
|
11
|
+
import type { TeamAgentConfig, SerializedTeamAgent, MascotExpression, AgentRole, ToolProfile } from './types.js';
|
|
12
12
|
import type { ModelTier } from '../models/index.js';
|
|
13
13
|
import type { ProviderType } from '../config.js';
|
|
14
14
|
import type { SharedContextManager } from './shared-context.js';
|
|
@@ -186,6 +186,20 @@ export declare class TeamAgent {
|
|
|
186
186
|
* @param modelTier - Optional model tier override (defaults to role's default tier)
|
|
187
187
|
*/
|
|
188
188
|
static fromRole(role: AgentRole, id?: string, modelTier?: ModelTier): TeamAgent;
|
|
189
|
+
/**
|
|
190
|
+
* Create a specialized TeamAgent from a BASE role plus overrides — used for the
|
|
191
|
+
* project wizard's "specialist" agents (e.g. a Copywriter on the `writer` role, a
|
|
192
|
+
* Plotter on `writer`). Runs the base role's behavior with an appended specialist
|
|
193
|
+
* prompt and a custom display name (the wizard label), without needing a new
|
|
194
|
+
* first-class AgentRole. See specialized-team-agents-spec §4.
|
|
195
|
+
*/
|
|
196
|
+
static fromSpecialist(baseRole: AgentRole, opts: {
|
|
197
|
+
id?: string;
|
|
198
|
+
displayName?: string;
|
|
199
|
+
systemPromptAddition?: string;
|
|
200
|
+
toolProfile?: ToolProfile;
|
|
201
|
+
modelTier?: ModelTier;
|
|
202
|
+
}): TeamAgent;
|
|
189
203
|
/**
|
|
190
204
|
* Create a TeamAgent from a custom agent definition
|
|
191
205
|
*/
|
package/dist/team/team-agent.js
CHANGED
|
@@ -479,6 +479,49 @@ export class TeamAgent {
|
|
|
479
479
|
modelTier: modelTier ?? metadata.defaultModelTier,
|
|
480
480
|
});
|
|
481
481
|
}
|
|
482
|
+
/**
|
|
483
|
+
* Create a specialized TeamAgent from a BASE role plus overrides — used for the
|
|
484
|
+
* project wizard's "specialist" agents (e.g. a Copywriter on the `writer` role, a
|
|
485
|
+
* Plotter on `writer`). Runs the base role's behavior with an appended specialist
|
|
486
|
+
* prompt and a custom display name (the wizard label), without needing a new
|
|
487
|
+
* first-class AgentRole. See specialized-team-agents-spec §4.
|
|
488
|
+
*/
|
|
489
|
+
static fromSpecialist(baseRole, opts) {
|
|
490
|
+
const metadata = ROLE_METADATA[baseRole];
|
|
491
|
+
const profile = opts.toolProfile ?? metadata.defaultToolProfile;
|
|
492
|
+
const toolFilter = profile ? getToolsForProfile(profile) : undefined;
|
|
493
|
+
// Base role prompt + the specialist addition (specialization on top of role).
|
|
494
|
+
let systemPromptAddition = metadata.defaultSystemPromptAddition ?? '';
|
|
495
|
+
if (opts.systemPromptAddition?.trim()) {
|
|
496
|
+
systemPromptAddition = systemPromptAddition
|
|
497
|
+
? `${systemPromptAddition}\n\n${opts.systemPromptAddition.trim()}`
|
|
498
|
+
: opts.systemPromptAddition.trim();
|
|
499
|
+
}
|
|
500
|
+
if (profile && profile !== 'full') {
|
|
501
|
+
const toolAwareness = generateToolAwarenessPrompt({ profile });
|
|
502
|
+
systemPromptAddition = systemPromptAddition
|
|
503
|
+
? `${systemPromptAddition}\n\n${toolAwareness}`
|
|
504
|
+
: toolAwareness;
|
|
505
|
+
}
|
|
506
|
+
// Specialists always get collaboration guidance (never the coordinator path).
|
|
507
|
+
const specialistGuidance = generateSpecialistGuidance(baseRole);
|
|
508
|
+
systemPromptAddition = systemPromptAddition
|
|
509
|
+
? `${systemPromptAddition}\n\n${specialistGuidance}`
|
|
510
|
+
: specialistGuidance;
|
|
511
|
+
return new TeamAgent({
|
|
512
|
+
id: opts.id ?? baseRole,
|
|
513
|
+
displayName: opts.displayName ?? metadata.displayName,
|
|
514
|
+
mascot: metadata.mascot,
|
|
515
|
+
role: baseRole,
|
|
516
|
+
description: metadata.description,
|
|
517
|
+
systemPromptAddition: systemPromptAddition || undefined,
|
|
518
|
+
useMinimalSystemPrompt: metadata.useMinimalSystemPrompt,
|
|
519
|
+
noTools: metadata.noTools,
|
|
520
|
+
toolFilter,
|
|
521
|
+
toolProfile: profile,
|
|
522
|
+
modelTier: opts.modelTier ?? metadata.defaultModelTier,
|
|
523
|
+
});
|
|
524
|
+
}
|
|
482
525
|
/**
|
|
483
526
|
* Create a TeamAgent from a custom agent definition
|
|
484
527
|
*/
|
package/dist/team/team.d.ts
CHANGED
|
@@ -173,6 +173,18 @@ export declare class AgentTeam {
|
|
|
173
173
|
* @param modelTier - Optional model tier override (defaults to role's default tier)
|
|
174
174
|
*/
|
|
175
175
|
addAgentFromRole(role: AgentRole, id?: string, modelTier?: ModelTier): Promise<TeamAgent>;
|
|
176
|
+
/**
|
|
177
|
+
* Add a SPECIALIST agent — a base role with a custom display name and an
|
|
178
|
+
* appended specialist prompt (project-wizard specialists, e.g. Copywriter on
|
|
179
|
+
* `writer`, Plotter on `writer`). See specialized-team-agents-spec §4.
|
|
180
|
+
*/
|
|
181
|
+
addSpecialistAgent(baseRole: AgentRole, opts: {
|
|
182
|
+
id?: string;
|
|
183
|
+
displayName?: string;
|
|
184
|
+
systemPromptAddition?: string;
|
|
185
|
+
toolProfile?: import('./tool-config.js').ToolProfile;
|
|
186
|
+
modelTier?: ModelTier;
|
|
187
|
+
}): Promise<TeamAgent>;
|
|
176
188
|
/**
|
|
177
189
|
* Add a custom agent from a CustomAgentDefinition
|
|
178
190
|
*/
|
package/dist/team/team.js
CHANGED
|
@@ -239,6 +239,43 @@ export class AgentTeam {
|
|
|
239
239
|
this.emit({ type: 'agent:added', agentId });
|
|
240
240
|
return teamAgent;
|
|
241
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
* Add a SPECIALIST agent — a base role with a custom display name and an
|
|
244
|
+
* appended specialist prompt (project-wizard specialists, e.g. Copywriter on
|
|
245
|
+
* `writer`, Plotter on `writer`). See specialized-team-agents-spec §4.
|
|
246
|
+
*/
|
|
247
|
+
async addSpecialistAgent(baseRole, opts) {
|
|
248
|
+
// Default the id to a slug of the display name so same-base-role specialists
|
|
249
|
+
// (three writers: Plotter/Character Dev/Scene Writer) get distinct ids.
|
|
250
|
+
const slug = opts.displayName
|
|
251
|
+
? opts.displayName
|
|
252
|
+
.toLowerCase()
|
|
253
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
254
|
+
.replace(/^-+|-+$/g, '')
|
|
255
|
+
: '';
|
|
256
|
+
let agentId = opts.id ?? (slug || baseRole);
|
|
257
|
+
if (this._sessionRegistry) {
|
|
258
|
+
const globalIds = this._sessionRegistry.getGlobalAgentIds();
|
|
259
|
+
const localIds = Array.from(this.agents.keys());
|
|
260
|
+
const resolved = resolveAgentIdCollision(agentId, localIds, globalIds);
|
|
261
|
+
if (resolved.wasCollision) {
|
|
262
|
+
const originalId = agentId;
|
|
263
|
+
agentId = resolved.id;
|
|
264
|
+
this.emit({ type: 'agent:collision', originalId, agentId: resolved.id });
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
if (this.agents.has(agentId)) {
|
|
268
|
+
throw new Error(`Agent '${agentId}' already exists in team`);
|
|
269
|
+
}
|
|
270
|
+
const teamAgent = TeamAgent.fromSpecialist(baseRole, { ...opts, id: agentId });
|
|
271
|
+
this.agents.set(agentId, teamAgent);
|
|
272
|
+
await teamAgent.initialize(this.agentFactory, this._sharedContext);
|
|
273
|
+
this._sharedContext.addAgent(agentId);
|
|
274
|
+
this.updateTeamRoster();
|
|
275
|
+
this.updatedAt = new Date();
|
|
276
|
+
this.emit({ type: 'agent:added', agentId });
|
|
277
|
+
return teamAgent;
|
|
278
|
+
}
|
|
242
279
|
/**
|
|
243
280
|
* Add a custom agent from a CustomAgentDefinition
|
|
244
281
|
*/
|