// src/contexts/StudioConfigContext.tsx
import { createContext, useContext } from "react";

// src/lib/capability-shape.ts
var DEFAULT_STUDIO_CAPABILITIES = {
  general: {
    read: true,
    write: true
  },
  source: {
    read: true,
    write: true
  },
  domains: {
    read: true,
    write: true
  },
  apiKeys: {
    read: true,
    write: true
  },
  team: {
    read: true,
    write: false
  },
  files: {
    read: true,
    proposeChanges: true
  },
  deploys: {
    read: true,
    promote: true,
    manage: true
  },
  evals: {
    read: true,
    run: true
  },
  secrets: {
    read: true,
    write: true
  },
  automations: {
    read: true,
    run: true,
    write: true
  },
  setup: {
    read: true,
    run: true
  },
  memory: {
    read: true,
    write: true
  },
  feedback: {
    read: true,
    review: true
  },
  activity: {
    read: true
  }
};
function mergeStudioCapabilities(input) {
  if (!input) return DEFAULT_STUDIO_CAPABILITIES;
  const deploys = {
    ...DEFAULT_STUDIO_CAPABILITIES.deploys,
    ...input.deploys
  };
  if (input.deploys?.promote === false && input.deploys.manage === void 0) {
    deploys.manage = false;
  }
  return {
    general: {
      ...DEFAULT_STUDIO_CAPABILITIES.general,
      ...input.general
    },
    source: {
      ...DEFAULT_STUDIO_CAPABILITIES.source,
      ...input.source
    },
    domains: {
      ...DEFAULT_STUDIO_CAPABILITIES.domains,
      ...input.domains
    },
    apiKeys: {
      ...DEFAULT_STUDIO_CAPABILITIES.apiKeys,
      ...input.apiKeys
    },
    team: {
      ...DEFAULT_STUDIO_CAPABILITIES.team,
      ...input.team
    },
    files: {
      ...DEFAULT_STUDIO_CAPABILITIES.files,
      ...input.files
    },
    deploys,
    evals: {
      ...DEFAULT_STUDIO_CAPABILITIES.evals,
      ...input.evals
    },
    secrets: {
      ...DEFAULT_STUDIO_CAPABILITIES.secrets,
      ...input.secrets
    },
    automations: {
      ...DEFAULT_STUDIO_CAPABILITIES.automations,
      ...input.automations
    },
    setup: {
      ...DEFAULT_STUDIO_CAPABILITIES.setup,
      ...input.setup
    },
    memory: {
      ...DEFAULT_STUDIO_CAPABILITIES.memory,
      ...input.memory
    },
    feedback: {
      ...DEFAULT_STUDIO_CAPABILITIES.feedback,
      ...input.feedback
    },
    activity: {
      ...DEFAULT_STUDIO_CAPABILITIES.activity,
      ...input.activity
    }
  };
}

// src/contexts/StudioConfigContext.tsx
var StudioConfigContext = createContext({
  agentName: "Agent",
  runtimeUrl: "http://localhost:3847",
  agentId: "default",
  registryUrl: "https://api.amodalai.com",
  capabilities: DEFAULT_STUDIO_CAPABILITIES
});
function useStudioConfig() {
  return useContext(StudioConfigContext);
}
function useStudioCapabilities() {
  return mergeStudioCapabilities(useStudioConfig().capabilities);
}
export {
  StudioConfigContext,
  useStudioCapabilities,
  useStudioConfig
};
/**
 * @license
 * Copyright 2026 Amodal Labs, Inc.
 * SPDX-License-Identifier: MIT
 */
//# sourceMappingURL=config.js.map
