@compilr-dev/sdk 0.24.0 → 0.24.2

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.
@@ -44,12 +44,12 @@ After creation, the project is set as active and agents can start working in it.
44
44
  content: `Each project type determines which agent roles, skills, and tools are most relevant:
45
45
 
46
46
  **software** — Agent roles: dev, pm, qa, arch. Skills: /design, /prd, /architecture, /scaffold, /build
47
- **research** — Agent roles: researcher, reviewer, writer. Skills: /outline, /literature-review, /methodology, /abstract
48
- **book** — Agent roles: editor, writer, reviewer. Skills: /outline, /chapter
49
- **course** — Agent roles: instructor, writer, reviewer. Skills: /outline, /lesson
50
- **business-plan** — Agent roles: analyst, strategist, writer. Skills: /business-vision, /market-analysis, /financial-model, /pitch
51
- **content-marketing** — Agent roles: writer, editor, strategist. Skills: /editorial-calendar, /article
52
- **tech-docs** — Agent roles: writer, dev, reviewer. Skills: /getting-started, /api-reference, /tutorial
47
+ **research** — Agent roles: researcher, reviewer, writer. Skills: /research-scaffold, /outline, /literature-review, /draft-section, /peer-review
48
+ **book** — Agent roles: editor, writer, reviewer. Skills: /book-outline, /character-design, /plot-threads, /scene-breakdown, /book-review
49
+ **course** — Agent roles: instructor, writer, reviewer. Skills: /curriculum-design, /lesson-plan, /assessment-design, /course-review
50
+ **business-plan** — Agent roles: analyst, strategist, writer. Skills: /business-vision, /market-analysis, /competitor-analysis, /financial-model, /pitch-outline, /business-review
51
+ **content-marketing** — Agent roles: writer, editor, strategist. Skills: /content-strategy, /content-calendar, /create-content, /content-review, /brand-setup
52
+ **tech-docs** — Agent roles: writer, dev, reviewer. Skills: /outline, /draft-section, /peer-review
53
53
 
54
54
  All project types support: teams, backlog, documents, knowledge base, file references, anchors.`,
55
55
  },
@@ -122,11 +122,11 @@ The delegated agent runs independently and returns results to the coordinator.`,
122
122
 
123
123
  Use them by typing / followed by the skill name (e.g., /design, /build).
124
124
 
125
- Skills vary by project type. Software projects have: /design, /prd, /architecture, /scaffold, /build, /backlog, /session-notes.
125
+ Skills vary by project type. Software projects have: /design, /sketch, /prd, /architecture, /scaffold, /build, /refine, /session-notes.
126
126
 
127
- Research projects have: /outline, /literature-review, /methodology, /abstract.
127
+ Research projects have: /research-scaffold, /outline, /literature-review, /draft-section, /peer-review.
128
128
 
129
- Business projects have: /business-vision, /market-analysis, /financial-model, /pitch.
129
+ Business projects have: /business-vision, /market-analysis, /competitor-analysis, /financial-model, /pitch-outline, /business-review.
130
130
 
131
131
  Skills can be combined with your own instructions: type /design then add context.`,
132
132
  },
package/dist/index.d.ts CHANGED
@@ -39,7 +39,7 @@ export { AgentTeam, TeamAgent, SharedContextManager, ArtifactStore, DelegationTr
39
39
  export type { AgentTeamConfig, TeamAgentConfig, TeamAgentUpdate, AgentUpdateResult, ITeamPersistence, IArtifactStorage, ISessionRegistry, CustomAgentDefinition, AgentTemplate, AgentWorkshopData, WorkshopRoleDef, WorkshopToolProfile, WorkshopModelTier, WorkshopSkillDef, PlanSubmitInfo, PlanSubmitResult, PlanModeExitInfo, PlanModeCallbacks, ToolConfig as TeamToolConfig, ToolTier, ToolGroup, ProfileInfo, } from './team/index.js';
40
40
  export type { AgentRole, RoleMetadata, ToolProfile, MascotExpression, BackgroundSessionInfo, SerializedTeam, SerializedTeamAgent, TeamMetadata, TeamEvent, TeamEventType, TeamEventHandler, Artifact, ArtifactType as TeamArtifactType, ArtifactSummary as TeamArtifactSummary, CreateArtifactOptions, UpdateArtifactOptions, SerializedArtifact, SharedContext, SharedProjectInfo, SharedTeamInfo, TeamRosterEntry, TeamActivity, TeamActivityType, SharedDecision, TokenBudget, SerializedSharedContext, ParsedMention, ParsedInput, ResolvedMention, ResolveOptions, ResolutionSource, Delegation, DelegationStatus, DelegationResult, CompletionEvent, CreateDelegationOptions, DelegationStats, DelegationTrackerEvents, HandoffResult, HandoffToolConfig, HandoffIntent, HandoffValidationResult, DelegateResult, DelegateToolConfig, DelegateBackgroundResult, DelegateBackgroundToolConfig, ConsultInput, ConsultResult, ConsultToolConfig, NormalizedRole, SkillToolRequirement, } from './team/index.js';
41
41
  export { ROLE_METADATA, ROLE_EXPERTISE, ROLE_GROUPS, PREDEFINED_ROLE_IDS, TOOL_GROUPS, TOOL_PROFILES, PROFILE_INFO, SKILL_REQUIREMENTS, CUSTOM_MASCOTS, buildAgentWorkshopData, buildSuggestedRolesMap, PLAN_MODE_BLOCKED_TOOLS, PLAN_MODE_DENIAL_MESSAGE, PLAN_MODE_PROMPT, isToolAllowedInPlanMode, getPlanModePrompt, } from './team/index.js';
42
- export { getToolsForProfile, detectProfileFromTools, isProfileReadOnly, generateToolAwarenessPrompt, generateCoordinatorGuidance, generateSpecialistGuidance, createDefaultToolConfig, validateToolConfig, getAllGroupIds, getGroupInfo, getGroupsByTier, getGroupsForProfile, assignMascot, generateCustomAgentSystemPrompt, getCustomAgentToolFilter, getCustomAgentProfileLabel, validateAgentId, isAgentIdTaken, createCustomAgentDefinition, listTemplates, getTemplate, saveTemplate, updateTemplate, deleteTemplate, createAgentFromTemplate, parseInputForMentions, getReferencedAgents, hasReferences, buildMessageWithContext, buildContextMap, findAgentForRole, findAgentById, getAvailableSpecialists, getSpecialistsSummary, hasSpecialists, suggestOwner, suggestOwners, matchesAgentExpertise, wouldCreateLoop, recordAssignment, getAssignmentHistory, clearAssignmentHistory, clearAllAssignmentHistory, canReassign, resolveAgentIdCollision, setActiveSharedContext, getActiveSharedContext, recordTeamActivity, getDefinedSkillNames, getSkillRequirements, checkSkillCompatibility, getCompatibleSkills, getAllRequiredTools, getSkillsByCategory, } from './team/index.js';
42
+ export { getToolsForProfile, detectProfileFromTools, isProfileReadOnly, generateToolAwarenessPrompt, generateCoordinatorGuidance, generateSpecialistGuidance, createDefaultToolConfig, validateToolConfig, getAllGroupIds, getGroupInfo, getGroupsByTier, getGroupsForProfile, assignMascot, generateCustomAgentSystemPrompt, mcpServerOf, filterMcpToolsByGrant, MCP_TOOL_PREFIX, getCustomAgentToolFilter, getCustomAgentProfileLabel, validateAgentId, isAgentIdTaken, createCustomAgentDefinition, listTemplates, getTemplate, saveTemplate, updateTemplate, deleteTemplate, createAgentFromTemplate, parseInputForMentions, getReferencedAgents, hasReferences, buildMessageWithContext, buildContextMap, findAgentForRole, findAgentById, getAvailableSpecialists, getSpecialistsSummary, hasSpecialists, suggestOwner, suggestOwners, matchesAgentExpertise, wouldCreateLoop, recordAssignment, getAssignmentHistory, clearAssignmentHistory, clearAllAssignmentHistory, canReassign, resolveAgentIdCollision, setActiveSharedContext, getActiveSharedContext, recordTeamActivity, getDefinedSkillNames, getSkillRequirements, checkSkillCompatibility, getCompatibleSkills, getAllRequiredTools, getSkillsByCategory, } from './team/index.js';
43
43
  export { codingPreset, readOnlyPreset, resolvePreset } from './presets/index.js';
44
44
  export type { Preset } from './presets/index.js';
45
45
  export type { AnyTool } from './presets/types.js';
package/dist/index.js CHANGED
@@ -53,7 +53,7 @@ getToolsForProfile, detectProfileFromTools, isProfileReadOnly, generateToolAware
53
53
  // Tool config (extended)
54
54
  createDefaultToolConfig, validateToolConfig, getAllGroupIds, getGroupInfo, getGroupsByTier, getGroupsForProfile,
55
55
  // Custom agents
56
- assignMascot, generateCustomAgentSystemPrompt, getCustomAgentToolFilter, getCustomAgentProfileLabel, validateAgentId, isAgentIdTaken, createCustomAgentDefinition,
56
+ assignMascot, generateCustomAgentSystemPrompt, mcpServerOf, filterMcpToolsByGrant, MCP_TOOL_PREFIX, getCustomAgentToolFilter, getCustomAgentProfileLabel, validateAgentId, isAgentIdTaken, createCustomAgentDefinition,
57
57
  // Agent templates
58
58
  listTemplates, getTemplate, saveTemplate, updateTemplate, deleteTemplate, createAgentFromTemplate,
59
59
  // Mention parsing
@@ -77,8 +77,14 @@ export interface CustomSkill {
77
77
  * /skill fork <name> → clone under a new name
78
78
  * /skill bind <cmd> → remap slash command to a custom skill
79
79
  *
80
- * This list is the union of all platform-skill names exported by
81
- * platform-skills.ts. Keep it in sync when adding new SDK skills.
80
+ * ⚠️ DERIVED, NOT MAINTAINED. This used to be a hand-written list with a comment saying "keep
81
+ * it in sync when adding new SDK skills". It drifted: 34 entries against 42 platform skills,
82
+ * missing the entire canvas family — so `/skill new canvas` was accepted, the user's skill
83
+ * silently outranked the SDK's (project and user scope beat sdk in `resolveSkillPrompt`), and
84
+ * the collision detector stayed quiet because it only warns about names it knows are reserved.
85
+ *
86
+ * A second copy of a list is a list that will disagree with the first. Deriving it costs one
87
+ * import and cannot go stale.
82
88
  */
83
89
  export declare const RESERVED_SKILL_NAMES: readonly string[];
84
90
  export declare function isReservedSkillName(name: string): boolean;
@@ -9,6 +9,7 @@
9
9
  * extensions live under the optional `compilr:` block, which
10
10
  * Anthropic-compatible runtimes ignore.
11
11
  */
12
+ import { platformSkills } from './platform-skills.js';
12
13
  /**
13
14
  * SDK skill names that are reserved — user/project skills cannot use these.
14
15
  *
@@ -17,51 +18,16 @@
17
18
  * /skill fork <name> → clone under a new name
18
19
  * /skill bind <cmd> → remap slash command to a custom skill
19
20
  *
20
- * This list is the union of all platform-skill names exported by
21
- * platform-skills.ts. Keep it in sync when adding new SDK skills.
21
+ * ⚠️ DERIVED, NOT MAINTAINED. This used to be a hand-written list with a comment saying "keep
22
+ * it in sync when adding new SDK skills". It drifted: 34 entries against 42 platform skills,
23
+ * missing the entire canvas family — so `/skill new canvas` was accepted, the user's skill
24
+ * silently outranked the SDK's (project and user scope beat sdk in `resolveSkillPrompt`), and
25
+ * the collision detector stayed quiet because it only warns about names it knows are reserved.
26
+ *
27
+ * A second copy of a list is a list that will disagree with the first. Deriving it costs one
28
+ * import and cannot go stale.
22
29
  */
23
- export const RESERVED_SKILL_NAMES = [
24
- // Software (9)
25
- 'design',
26
- 'sketch',
27
- 'prd',
28
- 'refine',
29
- 'refine-item',
30
- 'architecture',
31
- 'session-notes',
32
- 'build',
33
- 'scaffold',
34
- // Research (5)
35
- 'outline',
36
- 'literature-review',
37
- 'draft-section',
38
- 'peer-review',
39
- 'research-scaffold',
40
- // Business (6)
41
- 'business-vision',
42
- 'market-analysis',
43
- 'competitor-analysis',
44
- 'financial-model',
45
- 'pitch-outline',
46
- 'business-review',
47
- // Content (5)
48
- 'brand-setup',
49
- 'content-strategy',
50
- 'content-calendar',
51
- 'create-content',
52
- 'content-review',
53
- // Course (4)
54
- 'curriculum-design',
55
- 'lesson-plan',
56
- 'assessment-design',
57
- 'course-review',
58
- // Book (5)
59
- 'book-outline',
60
- 'character-design',
61
- 'plot-threads',
62
- 'scene-breakdown',
63
- 'book-review',
64
- ];
30
+ export const RESERVED_SKILL_NAMES = platformSkills.map((s) => s.name);
65
31
  export function isReservedSkillName(name) {
66
32
  return RESERVED_SKILL_NAMES.includes(name);
67
33
  }
@@ -7,6 +7,7 @@
7
7
  export { AgentTeam } from './team.js';
8
8
  export type { AgentTeamConfig } from './team.js';
9
9
  export { TeamAgent, isNarrowing, lostWriteAccess } from './team-agent.js';
10
+ export { mcpServerOf, filterMcpToolsByGrant, MCP_TOOL_PREFIX } from './mcp-servers.js';
10
11
  export type { TeamAgentUpdate, AgentUpdateResult } from './team-agent.js';
11
12
  export { SharedContextManager } from './shared-context.js';
12
13
  export type { SharedContext, SharedProjectInfo, SharedTeamInfo, TeamRosterEntry, TeamActivity, TeamActivityType, SharedDecision, TokenBudget, SerializedSharedContext, } from './shared-context.js';
@@ -7,6 +7,7 @@
7
7
  // Core classes
8
8
  export { AgentTeam } from './team.js';
9
9
  export { TeamAgent, isNarrowing, lostWriteAccess } from './team-agent.js';
10
+ export { mcpServerOf, filterMcpToolsByGrant, MCP_TOOL_PREFIX } from './mcp-servers.js';
10
11
  export { SharedContextManager } from './shared-context.js';
11
12
  export { ArtifactStore } from './artifacts.js';
12
13
  export { ROLE_METADATA, ROLE_EXPERTISE, ROLE_GROUPS, PREDEFINED_ROLE_IDS } from './types.js';
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Which MCP server owns a tool.
3
+ *
4
+ * `MCPManager` names every discovered tool `` `${prefix}_${server}_${tool}` `` (default prefix
5
+ * `mcp`). Recovering the server from the name is what lets a host honour a per-agent grant, and
6
+ * it is shared here because BOTH hosts need it and a second copy would eventually disagree with
7
+ * the first about which server owns `mcp_my_db_replica_list_tables`.
8
+ */
9
+ /** The prefix `MCPManager` is constructed with in both hosts. */
10
+ export declare const MCP_TOOL_PREFIX = "mcp";
11
+ /**
12
+ * The server a tool belongs to, or `null` when it cannot be told.
13
+ *
14
+ * ⚠️ DO NOT SPLIT ON `_`. Server names and tool names may both contain underscores, so
15
+ * `mcp_my_db_replica_list_tables` splits four ways and only one reading is right. Matching
16
+ * against the manager's own server list, LONGEST FIRST, is the only approach that cannot assign
17
+ * a tool to a server the user did not grant — `my_db` is a prefix of `my_db_replica`, and
18
+ * checking it first would hand the replica's tools to the wrong server.
19
+ *
20
+ * ⚠️ `null` MEANS "DO NOT GUESS", NOT "DENY". A caller should leave an unidentifiable tool
21
+ * alone: removing a capability because a name did not parse is a failure the user cannot see or
22
+ * act on, and the names come from servers we do not control.
23
+ */
24
+ export declare function mcpServerOf(toolName: string, servers: readonly string[], prefix?: string): string | null;
25
+ /**
26
+ * Filter MCP tools down to what an agent is granted.
27
+ *
28
+ * The shared half of enforcement: a host still decides WHEN to call it (at construction, where
29
+ * a tool the agent does not have cannot be called at all), but not what an absent grant means
30
+ * or how a tool maps to a server.
31
+ */
32
+ export declare function filterMcpToolsByGrant<T extends {
33
+ definition: {
34
+ name: string;
35
+ };
36
+ }>(tools: readonly T[], servers: readonly string[], grants: (server: string) => boolean, prefix?: string): T[];
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Which MCP server owns a tool.
3
+ *
4
+ * `MCPManager` names every discovered tool `` `${prefix}_${server}_${tool}` `` (default prefix
5
+ * `mcp`). Recovering the server from the name is what lets a host honour a per-agent grant, and
6
+ * it is shared here because BOTH hosts need it and a second copy would eventually disagree with
7
+ * the first about which server owns `mcp_my_db_replica_list_tables`.
8
+ */
9
+ /** The prefix `MCPManager` is constructed with in both hosts. */
10
+ export const MCP_TOOL_PREFIX = 'mcp';
11
+ /**
12
+ * The server a tool belongs to, or `null` when it cannot be told.
13
+ *
14
+ * ⚠️ DO NOT SPLIT ON `_`. Server names and tool names may both contain underscores, so
15
+ * `mcp_my_db_replica_list_tables` splits four ways and only one reading is right. Matching
16
+ * against the manager's own server list, LONGEST FIRST, is the only approach that cannot assign
17
+ * a tool to a server the user did not grant — `my_db` is a prefix of `my_db_replica`, and
18
+ * checking it first would hand the replica's tools to the wrong server.
19
+ *
20
+ * ⚠️ `null` MEANS "DO NOT GUESS", NOT "DENY". A caller should leave an unidentifiable tool
21
+ * alone: removing a capability because a name did not parse is a failure the user cannot see or
22
+ * act on, and the names come from servers we do not control.
23
+ */
24
+ export function mcpServerOf(toolName, servers, prefix = MCP_TOOL_PREFIX) {
25
+ const byLongest = [...servers].sort((a, b) => b.length - a.length);
26
+ for (const server of byLongest) {
27
+ if (toolName.startsWith(`${prefix}_${server}_`))
28
+ return server;
29
+ }
30
+ return null;
31
+ }
32
+ /**
33
+ * Filter MCP tools down to what an agent is granted.
34
+ *
35
+ * The shared half of enforcement: a host still decides WHEN to call it (at construction, where
36
+ * a tool the agent does not have cannot be called at all), but not what an absent grant means
37
+ * or how a tool maps to a server.
38
+ */
39
+ export function filterMcpToolsByGrant(tools, servers, grants, prefix = MCP_TOOL_PREFIX) {
40
+ return tools.filter((tool) => {
41
+ const server = mcpServerOf(tool.definition.name, servers, prefix);
42
+ return server === null || grants(server);
43
+ });
44
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilr-dev/sdk",
3
- "version": "0.24.0",
3
+ "version": "0.24.2",
4
4
  "description": "Universal agent runtime for building AI-powered applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",