@compilr-dev/sdk 0.10.18 → 0.10.19
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/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/team/index.d.ts +2 -0
- package/dist/team/index.js +4 -0
- package/dist/team/role-aliases.d.ts +61 -0
- package/dist/team/role-aliases.js +69 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
*/
|
|
36
36
|
export { createCompilrAgent } from './agent.js';
|
|
37
37
|
export type { CompilrAgentConfig, CompilrAgent, RunOptions, RunResult, ToolCallRecord, ToolConfig, UsageInfo, ProviderType, PermissionCallback, GuardrailConfig, ContextConfig, CapabilitiesConfig, } from './config.js';
|
|
38
|
-
export { AgentTeam, TeamAgent, SharedContextManager, ArtifactStore, DelegationTracker, ContextResolver, createDelegationStatusTool, createHandoffTool, buildHandoffTaskMessage, validateHandoffIntent, HandoffStash, } from './team/index.js';
|
|
38
|
+
export { AgentTeam, TeamAgent, SharedContextManager, ArtifactStore, DelegationTracker, ContextResolver, createDelegationStatusTool, createHandoffTool, buildHandoffTaskMessage, validateHandoffIntent, HandoffStash, ROLE_NAME_ALIASES, normalizeRoleName, } from './team/index.js';
|
|
39
39
|
export type { AgentTeamConfig, TeamAgentConfig, 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
|
-
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, SkillToolRequirement, } from './team/index.js';
|
|
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, 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
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';
|
|
43
43
|
export { codingPreset, readOnlyPreset, resolvePreset } from './presets/index.js';
|
package/dist/index.js
CHANGED
|
@@ -41,7 +41,7 @@ export { createCompilrAgent } from './agent.js';
|
|
|
41
41
|
// Multi-Agent Team Orchestration
|
|
42
42
|
// =============================================================================
|
|
43
43
|
// Core classes
|
|
44
|
-
export { AgentTeam, TeamAgent, SharedContextManager, ArtifactStore, DelegationTracker, ContextResolver, createDelegationStatusTool, createHandoffTool, buildHandoffTaskMessage, validateHandoffIntent, HandoffStash, } from './team/index.js';
|
|
44
|
+
export { AgentTeam, TeamAgent, SharedContextManager, ArtifactStore, DelegationTracker, ContextResolver, createDelegationStatusTool, createHandoffTool, buildHandoffTaskMessage, validateHandoffIntent, HandoffStash, ROLE_NAME_ALIASES, normalizeRoleName, } from './team/index.js';
|
|
45
45
|
// Constants
|
|
46
46
|
export { ROLE_METADATA, ROLE_EXPERTISE, ROLE_GROUPS, PREDEFINED_ROLE_IDS, TOOL_GROUPS, TOOL_PROFILES, PROFILE_INFO, SKILL_REQUIREMENTS, CUSTOM_MASCOTS, buildAgentWorkshopData, buildSuggestedRolesMap,
|
|
47
47
|
// Plan mode
|
package/dist/team/index.d.ts
CHANGED
|
@@ -42,3 +42,5 @@ export { createDelegationStatusTool, createHandoffTool } from './delegation-tool
|
|
|
42
42
|
export type { HandoffResult, HandoffToolConfig } from './delegation-tools.js';
|
|
43
43
|
export { buildHandoffTaskMessage, validateHandoffIntent, HandoffStash, } from './handoff-orchestration.js';
|
|
44
44
|
export type { HandoffIntent, HandoffValidationResult } from './handoff-orchestration.js';
|
|
45
|
+
export { ROLE_NAME_ALIASES, normalizeRoleName } from './role-aliases.js';
|
|
46
|
+
export type { NormalizedRole } from './role-aliases.js';
|
package/dist/team/index.js
CHANGED
|
@@ -36,3 +36,7 @@ export { createDelegationStatusTool, createHandoffTool } from './delegation-tool
|
|
|
36
36
|
// Handoff orchestration helpers — shared between CLI and Desktop for the
|
|
37
37
|
// post-turn stash/dispatch pattern. See handoff-orchestration.ts header.
|
|
38
38
|
export { buildHandoffTaskMessage, validateHandoffIntent, HandoffStash, } from './handoff-orchestration.js';
|
|
39
|
+
// Role-name aliases — longform → canonical AgentRole short key. Shared
|
|
40
|
+
// between CLI and Desktop for `suggestedAgents` translation when batch-
|
|
41
|
+
// adding a project type's default team. See role-aliases.ts header.
|
|
42
|
+
export { ROLE_NAME_ALIASES, normalizeRoleName } from './role-aliases.js';
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Role-name aliases — longform → canonical AgentRole short key.
|
|
3
|
+
*
|
|
4
|
+
* The project-type configs (`src/project-types/configs.ts`) use a mix of
|
|
5
|
+
* longform role names (`developer`, `architect`, `technical-writer`) and
|
|
6
|
+
* canonical short keys (`qa`, `pm`, `writer`, `researcher`) in their
|
|
7
|
+
* `suggestedAgents` lists. `TeamAgent.addAgentFromRole` only accepts the
|
|
8
|
+
* canonical short keys (`AgentRole`).
|
|
9
|
+
*
|
|
10
|
+
* Hosts (CLI, Desktop) that auto-add `suggestedAgents` into a team need
|
|
11
|
+
* to translate the mixed input to the canonical form before calling
|
|
12
|
+
* `addAgentFromRole`. This module is the single source of truth for that
|
|
13
|
+
* mapping — previously duplicated between the desktop's
|
|
14
|
+
* `lib/role-mascots.ts:toSdkRole` and the CLI's inline `LONG_TO_SHORT`
|
|
15
|
+
* map in `commands-v2/handlers/project.ts`.
|
|
16
|
+
*
|
|
17
|
+
* The alias targets are best-fit mappings, not exact equivalents:
|
|
18
|
+
* security → reviewer (security review work, no dedicated agent yet)
|
|
19
|
+
* designer → default (no design agent yet)
|
|
20
|
+
* plotter / scene-writer / character-dev / content-designer → writer
|
|
21
|
+
* (writing-adjacent roles that share the writer agent)
|
|
22
|
+
*
|
|
23
|
+
* When a new TeamAgent role is added to `AgentRole`, prefer that role
|
|
24
|
+
* over the alias here. E.g., when a real `security` TeamAgent ships,
|
|
25
|
+
* update the alias to `security → security` (or remove the alias and
|
|
26
|
+
* add `security` to `AgentRole` so it's pass-through).
|
|
27
|
+
*/
|
|
28
|
+
import type { AgentRole } from './types.js';
|
|
29
|
+
/** Longform role names mapped to canonical AgentRole short keys. */
|
|
30
|
+
export declare const ROLE_NAME_ALIASES: Record<string, AgentRole>;
|
|
31
|
+
/** Result of `normalizeRoleName`. Three states: pass-through (the input was
|
|
32
|
+
* already canonical), mapped (an alias was applied), or unknown (input is
|
|
33
|
+
* neither and we fell back to `'default'`). */
|
|
34
|
+
export interface NormalizedRole {
|
|
35
|
+
/** The canonical short AgentRole. */
|
|
36
|
+
role: AgentRole;
|
|
37
|
+
/** True if `ROLE_NAME_ALIASES` rewrote the input. */
|
|
38
|
+
mapped: boolean;
|
|
39
|
+
/** True if the input was neither a canonical role nor a known alias.
|
|
40
|
+
* Callers can either treat this as an error or accept the `'default'`
|
|
41
|
+
* fallback that's been set on `role`. */
|
|
42
|
+
unknown: boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Normalise a role name to the canonical `AgentRole`.
|
|
46
|
+
*
|
|
47
|
+
* Behaviour:
|
|
48
|
+
* - Input is already a canonical short key → pass through, `mapped: false`,
|
|
49
|
+
* `unknown: false`.
|
|
50
|
+
* - Input matches a known longform alias → mapped to the canonical key,
|
|
51
|
+
* `mapped: true`, `unknown: false`.
|
|
52
|
+
* - Input is neither → returns `'default'`, `mapped: false`, `unknown: true`.
|
|
53
|
+
* Callers typically log/warn and skip rather than silently add the
|
|
54
|
+
* default agent.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* normalizeRoleName('developer') // { role: 'dev', mapped: true, unknown: false }
|
|
58
|
+
* normalizeRoleName('qa') // { role: 'qa', mapped: false, unknown: false }
|
|
59
|
+
* normalizeRoleName('astronaut') // { role: 'default', mapped: false, unknown: true }
|
|
60
|
+
*/
|
|
61
|
+
export declare function normalizeRoleName(role: string): NormalizedRole;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Role-name aliases — longform → canonical AgentRole short key.
|
|
3
|
+
*
|
|
4
|
+
* The project-type configs (`src/project-types/configs.ts`) use a mix of
|
|
5
|
+
* longform role names (`developer`, `architect`, `technical-writer`) and
|
|
6
|
+
* canonical short keys (`qa`, `pm`, `writer`, `researcher`) in their
|
|
7
|
+
* `suggestedAgents` lists. `TeamAgent.addAgentFromRole` only accepts the
|
|
8
|
+
* canonical short keys (`AgentRole`).
|
|
9
|
+
*
|
|
10
|
+
* Hosts (CLI, Desktop) that auto-add `suggestedAgents` into a team need
|
|
11
|
+
* to translate the mixed input to the canonical form before calling
|
|
12
|
+
* `addAgentFromRole`. This module is the single source of truth for that
|
|
13
|
+
* mapping — previously duplicated between the desktop's
|
|
14
|
+
* `lib/role-mascots.ts:toSdkRole` and the CLI's inline `LONG_TO_SHORT`
|
|
15
|
+
* map in `commands-v2/handlers/project.ts`.
|
|
16
|
+
*
|
|
17
|
+
* The alias targets are best-fit mappings, not exact equivalents:
|
|
18
|
+
* security → reviewer (security review work, no dedicated agent yet)
|
|
19
|
+
* designer → default (no design agent yet)
|
|
20
|
+
* plotter / scene-writer / character-dev / content-designer → writer
|
|
21
|
+
* (writing-adjacent roles that share the writer agent)
|
|
22
|
+
*
|
|
23
|
+
* When a new TeamAgent role is added to `AgentRole`, prefer that role
|
|
24
|
+
* over the alias here. E.g., when a real `security` TeamAgent ships,
|
|
25
|
+
* update the alias to `security → security` (or remove the alias and
|
|
26
|
+
* add `security` to `AgentRole` so it's pass-through).
|
|
27
|
+
*/
|
|
28
|
+
import { PREDEFINED_ROLE_IDS } from './types.js';
|
|
29
|
+
/** Longform role names mapped to canonical AgentRole short keys. */
|
|
30
|
+
export const ROLE_NAME_ALIASES = {
|
|
31
|
+
developer: 'dev',
|
|
32
|
+
architect: 'arch',
|
|
33
|
+
'technical-writer': 'docs',
|
|
34
|
+
security: 'reviewer',
|
|
35
|
+
designer: 'default',
|
|
36
|
+
'character-dev': 'writer',
|
|
37
|
+
'content-designer': 'writer',
|
|
38
|
+
plotter: 'writer',
|
|
39
|
+
'scene-writer': 'writer',
|
|
40
|
+
};
|
|
41
|
+
const SDK_ROLE_PASSTHROUGH = new Set(PREDEFINED_ROLE_IDS);
|
|
42
|
+
/**
|
|
43
|
+
* Normalise a role name to the canonical `AgentRole`.
|
|
44
|
+
*
|
|
45
|
+
* Behaviour:
|
|
46
|
+
* - Input is already a canonical short key → pass through, `mapped: false`,
|
|
47
|
+
* `unknown: false`.
|
|
48
|
+
* - Input matches a known longform alias → mapped to the canonical key,
|
|
49
|
+
* `mapped: true`, `unknown: false`.
|
|
50
|
+
* - Input is neither → returns `'default'`, `mapped: false`, `unknown: true`.
|
|
51
|
+
* Callers typically log/warn and skip rather than silently add the
|
|
52
|
+
* default agent.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* normalizeRoleName('developer') // { role: 'dev', mapped: true, unknown: false }
|
|
56
|
+
* normalizeRoleName('qa') // { role: 'qa', mapped: false, unknown: false }
|
|
57
|
+
* normalizeRoleName('astronaut') // { role: 'default', mapped: false, unknown: true }
|
|
58
|
+
*/
|
|
59
|
+
export function normalizeRoleName(role) {
|
|
60
|
+
if (SDK_ROLE_PASSTHROUGH.has(role)) {
|
|
61
|
+
return { role: role, mapped: false, unknown: false };
|
|
62
|
+
}
|
|
63
|
+
// hasOwn is needed because Record<string, T> reports every string key as
|
|
64
|
+
// present at the type level even when it isn't — we need the runtime check.
|
|
65
|
+
if (Object.prototype.hasOwnProperty.call(ROLE_NAME_ALIASES, role)) {
|
|
66
|
+
return { role: ROLE_NAME_ALIASES[role], mapped: true, unknown: false };
|
|
67
|
+
}
|
|
68
|
+
return { role: 'default', mapped: false, unknown: true };
|
|
69
|
+
}
|