MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / runREPL

Function runREPL

main.go:255–322  ·  view source on GitHub ↗
(ctx context.Context, engine *agent.QueryEngine, state *agent.AgentState, store *session.Store, sessionID string)

Source from the content-addressed store, hash-verified

253 effectiveCWD := ""
254 if *cwd != "" {
255 abs, err := filepath.Abs(*cwd)
256 if err != nil {
257 return err
258 }
259 effectiveCWD = abs
260 }
261 cfg := config.NewConfigForCWD(effectiveCWD)
262 if len(cfg.PathErrors) > 0 {
263 return fmt.Errorf("invalid AppRoot configuration: %s", strings.Join(cfg.PathErrors, "; "))
264 }
265 if err := apppaths.PrepareRuntime(cfg.Paths, "dev"); err != nil {
266 if errors.Is(err, apppaths.ErrMigrationRequired) {
267 return fmt.Errorf("%w; run 'lumina-backend layout migrate --dry-run' then '--apply'", err)
268 }
269 return err
270 }
271 if *model != "" {
272 cfg.APIModel = *model
273 config.PinFields(&cfg, "api_model")
274 }
275 if *apiType != "" {
276 cfg.APIType = *apiType
277 config.PinFields(&cfg, "api_type")
278 }
279 if *apiKey != "" {
280 cfg.APIKey = *apiKey
281 config.PinFields(&cfg, "api_key")
282 }
283 if *baseURL != "" {
284 cfg.APIBaseURL = *baseURL
285 config.PinFields(&cfg, "api_base_url")
286 }
287 if *maxTokens > 0 {
288 cfg.APIMaxTokens = *maxTokens
289 config.PinFields(&cfg, "api_max_tokens")
290 }
291 if *yolo {
292 cfg.Yolo = true
293 }
294 if err := apppaths.EnsureProjectManifest(cfg.ProjectPaths, time.Now()); err != nil {
295 return err
296 }
297 if *bare {
298 cfg.LongTermMemoryEnabled = false
299 }
300 if *harnessMode != "" {
301 cfg.HarnessMode = strings.TrimSpace(*harnessMode)
302 config.PinFields(&cfg, "harness_mode")
303 }
304 config.ApplyHarnessDefaults(&cfg)
305 if cfg.LongTermMemoryEnabled {
306 if err := cfg.ValidateMemoryConfig(); err != nil {
307 return err
308 }
309 fabric, err := agent.OpenConfiguredMemoryFabric(context.Background(), cfg, false)
310 if err != nil {
311 return fmt.Errorf("open Memory Fabric: %w", err)
312 }

Callers 1

runFunction · 0.85

Calls 11

ShutdownMethod · 0.95
MountStateSnapshotMethod · 0.95
RunSubmitMessageMethod · 0.95
resolveSkillPickerSlashFunction · 0.85
handleREPLSlashCommandFunction · 0.85
SkillRegistryMethod · 0.80
ShutdownMethod · 0.65
ExportSnapshotMethod · 0.45

Tested by

no test coverage detected