-
Notifications
You must be signed in to change notification settings - Fork 144
simplify SkillReference, remove index field, calculate based on array index
#1947
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -107,8 +107,8 @@ const activitiesPlanner = subAgent({ | |||||||
| description: 'Plans activities based on weather conditions', | ||||||||
| prompt: 'Help users plan activities based on current weather.', | ||||||||
| skills: () => [ | ||||||||
| { id: 'weather-safety-guardrails', index: 0 }, | ||||||||
| { id: 'structured-itinerary-responses', index: 1 }, | ||||||||
| { id: 'weather-safety-guardrails' }, | ||||||||
| { id: 'structured-itinerary-responses' }, | ||||||||
| ], | ||||||||
| }); | ||||||||
| ``` | ||||||||
|
|
@@ -118,9 +118,10 @@ const activitiesPlanner = subAgent({ | |||||||
| | Field | Type | Required | Description | | ||||||||
| |-------|------|----------|-------------| | ||||||||
| | `id` | string | Yes | The skill identifier (matches the `name` in SKILL.md). | | ||||||||
| | `index` | number | No | Controls ordering. Higher index = higher priority in the prompt. | | ||||||||
| | `alwaysLoaded` | boolean | No | If `true`, skill content is always included. If `false` (default), loaded on demand. | | ||||||||
|
|
||||||||
| Skill order and priority follow the order of items in the `skills` array. | ||||||||
|
Comment on lines
122
to
+123
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💭 Consider Clarify priority direction Issue: The statement "Skill order and priority follow the order of items in the Why: The system prompt instruction in Fix: Consider clarifying the priority semantics:
Suggested change
Refs: |
||||||||
|
|
||||||||
| ### Attaching Skills | ||||||||
|
|
||||||||
| Define attached skills to subagents: | ||||||||
|
|
@@ -130,13 +131,7 @@ const mySubAgent = subAgent({ | |||||||
| id: 'my-sub-agent', | ||||||||
| name: 'My Sub Agent', | ||||||||
| prompt: 'You are a helpful assistant.', | ||||||||
| skills: () => [ | ||||||||
| { | ||||||||
| id: 'inline-skill', | ||||||||
| index: 0, | ||||||||
| alwaysLoaded: true, | ||||||||
| }, | ||||||||
| ], | ||||||||
| skills: () => [{ id: 'inline-skill', alwaysLoaded: true } ], | ||||||||
| }); | ||||||||
| ``` | ||||||||
|
|
||||||||
|
|
@@ -212,8 +207,8 @@ const activitiesPlanner = subAgent({ | |||||||
| description: 'Plans activities considering weather conditions', | ||||||||
| prompt: 'Help users find activities based on weather forecasts.', | ||||||||
| skills: () => [ | ||||||||
| { id: 'weather-safety-guardrails', index: 0 }, | ||||||||
| { id: 'structured-itinerary-responses', index: 1 }, | ||||||||
| { id: 'weather-safety-guardrails' }, | ||||||||
| { id: 'structured-itinerary-responses' }, | ||||||||
| ], | ||||||||
| }); | ||||||||
|
|
||||||||
|
|
||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ import type { | |
| FullAgentDefinition, | ||
| McpTransportConfig, | ||
| ModelSettings, | ||
| SkillSelect, | ||
| StatusUpdateSettings, | ||
| SubAgentApiInsert, | ||
| ToolInsert, | ||
|
|
@@ -81,21 +82,16 @@ export interface ToolResult { | |
| error?: string; | ||
| } | ||
|
|
||
| export interface SkillDefinition { | ||
| export type SkillDefinition = Pick< | ||
| SkillSelect, | ||
| 'id' | 'name' | 'description' | 'content' | 'metadata' | 'createdAt' | 'updatedAt' | ||
| >; | ||
|
|
||
| export interface SkillReference { | ||
| id: string; | ||
| name: string; | ||
| description: string; | ||
| content: string; | ||
| metadata: Record<string, string> | null; | ||
| createdAt?: string; | ||
| updatedAt?: string; | ||
| /** @default false */ | ||
| alwaysLoaded?: boolean; | ||
| } | ||
|
Comment on lines
+90
to
94
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟠 MAJOR Breaking type contract change Issue: The Before: export type SkillReference =
| string
| { id: string; index?: number; alwaysLoaded?: boolean }
| { skillId: string; index?: number; alwaysLoaded?: boolean }
| (SkillDefinition & { index?: number; alwaysLoaded?: boolean });After: export interface SkillReference {
id: string;
alwaysLoaded?: boolean;
}Why: This is a breaking change for TypeScript consumers of
The runtime implementation in Fix: Either:
Refs:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 MINOR Type asymmetry between input and output Issue: The input type Why: Users cannot specify Fix: Consider making the return type's getSkills(): Array<{
id: string;
index: number; // Always calculated from array position
alwaysLoaded?: boolean;
skill?: SkillDefinition;
}>;Refs: |
||
|
|
||
| export type SkillReference = | ||
| | string | ||
| | { id: string; index?: number; alwaysLoaded?: boolean } | ||
| | { skillId: string; index?: number; alwaysLoaded?: boolean } | ||
| | (SkillDefinition & { index?: number; alwaysLoaded?: boolean }); | ||
| export type AllDelegateInputInterface = | ||
| | SubAgentInterface | ||
| | subAgentExternalAgentInterface | ||
|
|
@@ -350,7 +346,7 @@ export type subAgentTeamAgentInterface = { | |
|
|
||
| export interface AgentInterface { | ||
| init(): Promise<void>; | ||
| setConfig(tenantId: string, projectId: string, apiUrl: string, skills?: SkillDefinition[]): void; | ||
| setConfig(tenantId: string, projectId: string, apiUrl: string): void; | ||
| getId(): string; | ||
| getName(): string; | ||
| getDescription(): string | undefined; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.