Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AIPexStudio AIPex SkillManager initialize

From Leeroopedia
Knowledge Sources
Domains Plugin_Systems, Skill_Management
Last Updated 2026-10-24 12:00 GMT

Overview

Concrete initialization method for the SkillManager singleton that sets up storage, executor, built-in skills, and the skill registry with event notification.

Description

The SkillManager.initialize method orchestrates the entire skill system startup. It initializes `skillStorage` (IndexedDB + ZenFS), `skillExecutor` (QuickJS VM), loads built-in skills (skill-creator-browser, ux-audit-walkthrough, wcag22-a11y-audit) from bundled `?raw` imports, reloads skills from storage, and initializes `skillRegistry` with all skill metadata. The manager is a singleton with an event system (`subscribe`/`_emit`) for skill_loaded, skill_unloaded, skill_enabled, and skill_disabled events. Configuration includes `autoLoadEnabledSkills` (default true), `maxConcurrentExecutions` (default 5), and `scriptTimeout` (default 30000ms).

Usage

  • Initialize skill system: `await skillManager.initialize()` (call once on extension startup)
  • Subscribe to events: `skillManager.subscribe("skill_loaded", (data) => { ... })`
  • Configuration: pass `SkillManagerConfig` to the constructor.

Code Reference

Source Location

  • Repository: AIPex
  • File: packages/browser-runtime/src/skill/lib/services/skill-manager.ts
  • Lines: L32-120 (class, initialize, event system), L770 (singleton export)

Signature

export class SkillManager {
  constructor(config?: SkillManagerConfig)
  async initialize(): Promise<void>
  subscribe(event: SkillEventType, callback: SkillSubscriber): () => void
  unsubscribe(event: SkillEventType, callback: SkillSubscriber): void
}

interface SkillManagerConfig {
  autoLoadEnabledSkills?: boolean;
  maxConcurrentExecutions?: number;
  scriptTimeout?: number;
}

type SkillEventType = "skill_loaded" | "skill_unloaded" | "skill_enabled" | "skill_disabled";

// Singleton: export const skillManager = new SkillManager();

Import

import { skillManager } from "@aipexstudio/browser-runtime";

I/O Contract

Inputs

Name Type Required Description
config SkillManagerConfig No Configuration (defaults: autoLoad=true, maxConcurrent=5, timeout=30000)

Outputs

Name Type Description
returns Promise<void> Resolves when all components initialized

Usage Examples

Initialize on Extension Startup

import { skillManager } from "@aipexstudio/browser-runtime";

// Subscribe to skill events
skillManager.subscribe("skill_loaded", (skill) => {
  console.log("Skill loaded:", skill.name);
});

// Initialize on extension startup
await skillManager.initialize();
console.log("Skill system ready");

Custom Configuration

import { SkillManager } from "@aipexstudio/browser-runtime";

const customManager = new SkillManager({
  autoLoadEnabledSkills: false,
  maxConcurrentExecutions: 3,
  scriptTimeout: 10000,
});
await customManager.initialize();

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment