File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,8 +31,9 @@ export declare const OPENCODE_VERSION: string
3131/**
3232 * List of expected agent names (without .md extension).
3333 * This is the single source of truth for agent filenames.
34+ * Frozen to prevent accidental mutation.
3435 */
35- export declare const AGENT_NAMES : string [ ]
36+ export declare const AGENT_NAMES : readonly [ "opencoder" , "opencoder-planner" , "opencoder-builder" ]
3637
3738/** Minimum character count for valid agent files */
3839export declare const MIN_CONTENT_LENGTH : number
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ describe("index.ts exports", () => {
3939 const files = readdirSync ( agentsDir )
4040 const mdFiles = files . filter ( ( f ) => f . endsWith ( ".md" ) )
4141 const agentNamesFromFiles = mdFiles . map ( ( f ) => f . replace ( / \. m d $ / , "" ) ) . sort ( )
42- const agentNamesFromExport = [ ...agents ] . sort ( )
42+ const agentNamesFromExport = ( [ ...agents ] as string [ ] ) . sort ( )
4343
4444 expect ( agentNamesFromExport ) . toEqual ( agentNamesFromFiles )
4545 } )
Original file line number Diff line number Diff line change @@ -397,23 +397,23 @@ describe("paths.mjs exports", () => {
397397 it ( "should prevent push to AGENT_NAMES" , ( ) => {
398398 const originalLength = AGENT_NAMES . length
399399 expect ( ( ) => {
400- ; ( AGENT_NAMES as string [ ] ) . push ( "new-agent" )
400+ ; ( AGENT_NAMES as unknown as string [ ] ) . push ( "new-agent" )
401401 } ) . toThrow ( )
402402 expect ( AGENT_NAMES . length ) . toBe ( originalLength )
403403 } )
404404
405405 it ( "should prevent modification of AGENT_NAMES elements" , ( ) => {
406406 const originalFirst = AGENT_NAMES [ 0 ]
407407 expect ( ( ) => {
408- ; ( AGENT_NAMES as string [ ] ) [ 0 ] = "modified"
408+ ; ( AGENT_NAMES as unknown as string [ ] ) [ 0 ] = "modified"
409409 } ) . toThrow ( )
410410 expect ( AGENT_NAMES [ 0 ] ) . toBe ( originalFirst )
411411 } )
412412
413413 it ( "should prevent pop from AGENT_NAMES" , ( ) => {
414414 const originalLength = AGENT_NAMES . length
415415 expect ( ( ) => {
416- ; ( AGENT_NAMES as string [ ] ) . pop ( )
416+ ; ( AGENT_NAMES as unknown as string [ ] ) . pop ( )
417417 } ) . toThrow ( )
418418 expect ( AGENT_NAMES . length ) . toBe ( originalLength )
419419 } )
You can’t perform that action at this time.
0 commit comments