File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -303,6 +303,31 @@ describe('loadLocalAgents', () => {
303303 expect ( existsSync ( markerFile ) ) . toBe ( false )
304304 } )
305305
306+ test ( 'loads valid agent definitions that use shorthand required fields' , async ( ) => {
307+ mkdirSync ( agentsDir , { recursive : true } )
308+ writeAgentFile (
309+ agentsDir ,
310+ 'shorthand-agent.ts' ,
311+ `
312+ const id = 'shorthand-agent'
313+ const model = '${ MODEL_NAME } '
314+
315+ export default {
316+ id,
317+ displayName: 'Shorthand Agent',
318+ model
319+ }
320+ ` ,
321+ )
322+
323+ const result : LoadedAgents = await loadLocalAgents ( {
324+ agentsPath : agentsDir ,
325+ } )
326+
327+ expect ( result [ 'shorthand-agent' ] ) . toBeDefined ( )
328+ expect ( result [ 'shorthand-agent' ] ! . model ) . toBe ( MODEL_NAME )
329+ } )
330+
306331 test ( 'skips quarantined skill directories without importing executable scripts' , async ( ) => {
307332 const quarantineScriptsDir = path . join (
308333 agentsDir ,
Original file line number Diff line number Diff line change @@ -137,8 +137,8 @@ const looksLikeAgentDefinitionSource = (fullPath: string): boolean => {
137137 }
138138
139139 return (
140- / ( ^ | [ , { ] \s * ) [ ' " ] ? i d [ ' " ] ? \s * : / m. test ( source ) ||
141- / ( ^ | [ , { ] \s * ) [ ' " ] ? m o d e l [ ' " ] ? \s * : / m. test ( source )
140+ / (?: ^ | [ ^ \w $ ] ) i d (?: [ ^ \w $ ] | $ ) / m. test ( source ) ||
141+ / (?: ^ | [ ^ \w $ ] ) m o d e l (?: [ ^ \w $ ] | $ ) / m. test ( source )
142142 )
143143}
144144
You can’t perform that action at this time.
0 commit comments