@@ -70,6 +70,13 @@ import {
7070 updateMemoryExtraType as _updateMemoryExtraType ,
7171 deleteMemoryExtraType as _deleteMemoryExtraType ,
7272} from '../../memory/config.js' ;
73+ import {
74+ loadConfig ,
75+ updateMaxSteps ,
76+ updateMaxStopContinuations ,
77+ updateContextCompactionModel ,
78+ updateMemoryModel ,
79+ } from '@codingcode/infra/config' ;
7380import { MemoryService } from '../../memory/index.js' ;
7481import { createRunWithLayer , errorResponse } from '../util.js' ;
7582
@@ -268,7 +275,11 @@ export async function createSettingsRouter(rt: ManagedRt): Promise<Hono> {
268275 // ---- Memory ----
269276 settingsRouter . get ( '/memory/config' , ( c ) => {
270277 const cfg = getMemoryConfig ( ) ;
271- return c . json ( { enabled : cfg . enabled , types : getAllTypesWithStatus ( cfg ) } ) ;
278+ return c . json ( {
279+ enabled : cfg . enabled ,
280+ types : getAllTypesWithStatus ( cfg ) ,
281+ model : cfg . model ,
282+ } ) ;
272283 } ) ;
273284
274285 settingsRouter . post ( '/memory/enabled' , async ( c ) => {
@@ -333,6 +344,34 @@ export async function createSettingsRouter(rt: ManagedRt): Promise<Hono> {
333344 }
334345 } ) ;
335346
347+ settingsRouter . post ( '/memory/model' , async ( c ) => {
348+ const body = ( await c . req . json ( ) ) as { model : string } ;
349+ updateMemoryModel ( body . model ) ;
350+ return c . json ( { model : body . model } ) ;
351+ } ) ;
352+
353+ // ---- Agent config ----
354+ settingsRouter . get ( '/agent/config' , ( c ) => {
355+ const cfg = loadConfig ( ) ;
356+ return c . json ( { maxSteps : cfg . maxSteps , maxStopContinuations : cfg . maxStopContinuations } ) ;
357+ } ) ;
358+
359+ settingsRouter . post ( '/agent/config' , async ( c ) => {
360+ const body = ( await c . req . json ( ) ) as { maxSteps ?: number ; maxStopContinuations ?: number } ;
361+ if ( body . maxSteps !== undefined ) updateMaxSteps ( body . maxSteps ) ;
362+ if ( body . maxStopContinuations !== undefined )
363+ updateMaxStopContinuations ( body . maxStopContinuations ) ;
364+ const cfg = loadConfig ( ) ;
365+ return c . json ( { maxSteps : cfg . maxSteps , maxStopContinuations : cfg . maxStopContinuations } ) ;
366+ } ) ;
367+
368+ // ---- Context config ----
369+ settingsRouter . post ( '/context/compaction-model' , async ( c ) => {
370+ const body = ( await c . req . json ( ) ) as { compactionModel : string } ;
371+ updateContextCompactionModel ( body . compactionModel ) ;
372+ return c . json ( { compactionModel : body . compactionModel } ) ;
373+ } ) ;
374+
336375 // ---- Agents ----
337376 settingsRouter . get ( '/agents' , ( c ) => {
338377 const rawCwd = c . req . query ( 'cwd' ) ;
0 commit comments